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
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll X; cin >> X; double m = 100; int n = 0; while (1) { n++; m = m * 1.01; if (m >= X) { cout << n << endl; break; } } return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll X; cin >> X; ll m = 100; int n = 0; while (1) { n++; m = m * 1.01; if (m >= X) { cout << n << endl; break; } } return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
68
import math x = int(input()) cnt = 0 risi=0 yokin=100 while x >= yokin: cnt+=1 yokin += math.floor(yokin * 0.01) print(cnt)
import math x = int(input()) cnt = 0 risi=0 yokin=100 while x > yokin: cnt+=1 yokin += math.floor(yokin * 0.01) print(cnt)
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 47]]
5
41
import sys try: sys.stdin = open(sys.path[0] + '\\input.txt', 'r') sys.stdout = open(sys.path[0] + '\\output.txt', 'w') except FileNotFoundError: pass x = int(input()) n = 100 t = 0 while n <= x: n += (0.01 * n) n = int(n) t += 1 # print(n, t) print(t)
import sys try: sys.stdin = open(sys.path[0] + '\\input.txt', 'r') sys.stdout = open(sys.path[0] + '\\output.txt', 'w') except FileNotFoundError: pass x = int(input()) n = 100 t = 0 while n < x: n += (0.01 * n) n = int(n) t += 1 # print(n, t) print(t)
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18]]
5
92
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for (int i = 0; i < (int)n; i++) #define rall(x) x.rbegin(), x.rend() #define all(x) x.begin(), x.end() #define PB push_back #define F first #define S second typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; const ll MOD = 1e9 +...
#include <bits/stdc++.h> using namespace std; #define FOR(i, n) for (int i = 0; i < (int)n; i++) #define rall(x) x.rbegin(), x.rend() #define all(x) x.begin(), x.end() #define PB push_back #define F first #define S second typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; const ll MOD = 1e9 +...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 108], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48]]
1
129
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x = scan.nextInt(); int tmp = 100; int cnt = 0; while (true) { cnt++; tmp += tmp * 1 / 100; if (tmp >= x) { System.out.println(cnt); ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long x = scan.nextLong(); long tmp = 100; long cnt = 0; while (true) { cnt++; tmp += tmp * 1 / 100; if (tmp >= x) { System.out.println(cnt); ...
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]]
3
90
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using namespace std; template <typename T> using vec = std::vector<T>; int main() { ll X; cin >> X; ll now = 100.0; int year = 0; while (now <= X) { now = now * 1.01; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using namespace std; template <typename T> using vec = std::vector<T>; int main() { ll X; cin >> X; ll now = 100; int year = 0; while (now < X) { now = now * 1.01; ++...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18]]
1
87
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { long long n; long long k = 100; long long ans = 0; while (k < n) { ans++; k = k + k / 100; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { long long n; cin >> n; long long k = 100; long long ans = 0; while (k < n) { ans++; k = k + k / 100; } cout << ans << 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
import math X = int(input()) bal = 100 i = 0 while (bal < X): bal = bal + math.floor(bal * 0.01) print(i)
import math X = int(input()) bal = 100 i = 0 while (bal < X): bal = bal + math.floor(bal * 0.01) i += 1 print(i)
[["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612]]
5
39
#include <bits/stdc++.h> using namespace std; int main() { int x; cin >> x; int p = 100; int ans = 0; while (p < x) { p += (p) / 100; ans++; } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int x, p; cin >> x; p = 100; int ans = 0; while (p < x) { p += (p) / 100; ans++; } cout << ans; return 0; }
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
55
x = int(input()) m = 100 year = 0 while m <= x: year += 1 m *= 1.01 m = int(m) print(year)
x = int(input()) m = 100 year = 0 while m < x: year += 1 m *= 1.01 m = int(m) print(year)
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18]]
5
35
x=int(input()) m=100 i=0 while(1): m=m*1.01 i+=1 if m>=x: print(i) break
x=int(input()) m=100 i=0 while(1): m=int(m*1.01) i+=1 if m>=x: print(i) break
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
37
x = int(input()) tmp = 100 for i in range(10 ** 20): if tmp >= x: print(i) exit() tmp *= 1.01
x = int(input()) tmp = 100 for i in range(10 ** 20): if tmp >= x: print(i) exit() tmp = int(tmp * 1.01)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 17, 108], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 48], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
36
x=input() tmp=100 for i in range(10000): if tmp>=x: print(i) break tmp+=tmp//100
x=int(input()) tmp=100 for i in range(10000): if tmp>=x: print(i) break tmp+=tmp//100
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
31
x = int(input()) i = 1 c = 100 while True: c = c * 1.01 if (c >= x): print(i) break else: i = i + 1
x = int(input()) i = 1 c = 100 while True: c = int(c * 1.01) if (c >= x): print(i) break else: i = i + 1
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
41
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> #define INF 1000000021 #define MOD 1000000007 #define pb push_back #define sqr(a) (a) * (a) #define M(a, b) make_pair(a, b) #define T(a, b, c) make_pair(a, make_pair(b, c)) #define F first #define S second #define all(x) (x.begin(), x.end()) #define d...
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> #define INF 1000000021 #define MOD 1000000007 #define pb push_back #define sqr(a) (a) * (a) #define M(a, b) make_pair(a, b) #define T(a, b, c) make_pair(a, make_pair(b, c)) #define F first #define S second #define all(x) (x.begin(), x.end()) #define d...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
329
from collections import deque, Counter, defaultdict from itertools import chain, combinations import json # import numpy as np import bisect import sys import math import bisect from functools import lru_cache sys.setrecursionlimit(10 ** 8) M = 10 ** 9 + 7 INF = 10 ** 17 def main(): N = int(input()) # A = [...
from collections import deque, Counter, defaultdict from itertools import chain, combinations import json # import numpy as np import bisect import sys import math import bisect from functools import lru_cache sys.setrecursionlimit(10 ** 8) M = 10 ** 9 + 7 INF = 10 ** 17 def main(): N = int(input()) # A = [...
[["-", 0, 52, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 667, 20]]
5
103
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define PI 3.14159265358979323846 constexpr int INF = numeric_limits<int>::max() / 2; constexpr long long INFL = numeric_limits<long long>::max() / 2; constexpr int MOD = 1000000007; using Graph = vector<vector<int>>; in...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define PI 3.14159265358979323846 constexpr int INF = numeric_limits<int>::max() / 2; constexpr long long INFL = numeric_limits<long long>::max() / 2; constexpr int MOD = 1000000007; using Graph = vector<vector<int>>; in...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["-", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
130
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--) #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) #define FORD(i, a, b) for (ll i = (a); i >= (b); i--) #define ALL(x) (x).begin(), (x).end()...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--) #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) #define FORD(i, a, b) for (ll i = (a); i >= (b); i--) #define ALL(x) (x).begin(), (x).end()...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
141
#include <algorithm> #include <array> #include <cmath> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <queue> #include <sstream> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <vector> #define REP...
#include <algorithm> #include <array> #include <cmath> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <queue> #include <sstream> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <vector> #define REP...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18]]
1
292
/* AuThOr Gwj */ #include <bits/stdc++.h> #define rb(a, b, c) for (int a = b; a <= c; ++a) #define rl(a, b, c) for (int a = b; a >= c; --a) #define LL long long #define IT iterator #define PB push_back #define II(a, b) make_pair(a, b) #define FIR first #define SEC second #define FREO freopen("check.out", "w", stdout) #...
/* AuThOr Gwj */ #include <bits/stdc++.h> #define rb(a, b, c) for (int a = b; a <= c; ++a) #define rl(a, b, c) for (int a = b; a >= c; --a) #define LL long long #define IT iterator #define PB push_back #define II(a, b) make_pair(a, b) #define FIR first #define SEC second #define FREO freopen("check.out", "w", stdout) #...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18]]
1
170
#include <bits/stdc++.h> using namespace std; long long a, b, c, d; string s, q; int main() { long long a; cin >> a; long long x = 100; while (x <= a) { x = x + 0.01 * x; b++; } cout << b; }
#include <bits/stdc++.h> using namespace std; long long a, b, c, d; string s, q; int main() { long long a; cin >> a; long long x = 100; while (x < a) { x = x + 0.01 * x; b++; } cout << b; }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18]]
1
64
import sys readline = sys.stdin.readline X = int(readline()) i = 0 a = 100 while True: i += 1 a *= 1.01 if a >= X: print(i) exit(0)
import sys readline = sys.stdin.readline X = int(readline()) i = 0 a = 100 while True: i += 1 a = int(a * 1.01) if a >= X: print(i) exit(0)
[["-", 0, 52, 8, 196, 0, 1, 0, 677, 17, 108], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 48], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
45
#include <bits/stdc++.h> #define MOD 1000000007LL using namespace std; typedef long long ll; typedef pair<int, int> P; int main(void) { ll x; scanf("%lld", &x); int cnt = 0; ll now = 100; while (now <= x) { now *= 1.01; cnt++; } printf("%d\n", cnt); return 0; }
#include <bits/stdc++.h> #define MOD 1000000007LL using namespace std; typedef long long ll; typedef pair<int, int> P; int main(void) { ll x; scanf("%lld", &x); int cnt = 0; ll now = 100; while (now < x) { now *= 1.01; cnt++; } printf("%d\n", cnt); return 0; }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18]]
1
81
x = int(input()) ans = 0 now = 100 while (now <= x): ans += 1 now = int(now*1.01) print(ans)
x = int(input()) ans = 0 now = 100 while (now < x): ans += 1 now += int(now*0.01) print(ans)
[["-", 0, 656, 0, 52, 15, 23, 0, 666, 667, 19], ["+", 0, 656, 0, 52, 15, 23, 0, 666, 667, 18], ["-", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 107], ["-", 0, 662, 12, 652, 3, 4, 0, 657, 12, 531], ["+", 0, 677, 12, 652, 3, 4, 0, 657, 12, 531]]
5
36
import math X=int(input()) a=0 o=100 while True: o*=1.01 o=math.floor() a+=1 if o>=X: print(a) break
import math X=int(input()) a=0 o=100 while True: o*=1.01 o=math.floor(o) a+=1 if o>=X: print(a) break
[["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
42
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define endl '\n' #define lfs cout << fixed << setprecision(10) #define ALL(a) (a).begin(), (a).end() #define ALLR(a) (a).rbegin(), (a).rend() #define spa << " " << #define fi first #define se second #define MP make_pair #define MT make_tuple #def...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define endl '\n' #define lfs cout << fixed << setprecision(10) #define ALL(a) (a).begin(), (a).end() #define ALLR(a) (a).rbegin(), (a).rend() #define spa << " " << #define fi first #define se second #define MP make_pair #define MT make_tuple #def...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 108], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 1, 0,...
1
889
/*input 3 4 3 1 3 3 100 1 2 2 10 2 3 2 10 */ #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int n, m, q; // vector<int> a(n), b(n), c(n), d(n); int a[11], b[11], c[11], d[11]; int dfs(int i, vector<int> &p) { int res = 0...
/*input 4 6 10 2 4 1 86568 1 4 0 90629 2 3 0 90310 3 4 1 29211 3 4 3 78537 3 4 2 8580 1 2 1 96263 1 4 2 2156 1 2 0 94325 1 4 3 94328 */ #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int n, m, q; // vector<int> a(n), b(n), ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
274
#include <bits/stdc++.h> using namespace std; using ll = long long; using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using pii = pair<int, int>; using pll = pair<ll, ll>; usi...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using pii = pair<int, int>; using pll = pair<ll, ll>; usi...
[["-", 0, 2, 3, 4, 0, 23, 0, 41, 75, 13], ["+", 0, 2, 3, 4, 0, 23, 0, 41, 75, 13]]
1
981
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define ALL(c) (c).begin(), (c).end() using namespace std; using ll = long long; using P = pair<int, int>; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) const int INF = 1e9 + 10; int N, M, Q; int a[55], b[55], c[55], d[55];...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define ALL(c) (c).begin(), (c).end() using namespace std; using ll = long long; using P = pair<int, int>; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) const int INF = 1e9 + 10; int N, M, Q; int a[55], b[55], c[55], d[55];...
[["-", 0, 14, 49, 53, 54, 55, 0, 356, 365, 13], ["+", 0, 14, 49, 53, 54, 55, 0, 356, 365, 13]]
1
274
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1000000007; #define INF 1LL << 30 #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(x) (x).begin(), (x).end() int n, m, q; int a[60], b[60], c[60], d[60]; ll ans = 0; void dfs(vector<int> &A) { if (A.size() == n) { ll ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1000000007; #define INF 1LL << 30 #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(x) (x).begin(), (x).end() int n, m, q; int a[60], b[60], c[60], d[60]; ll ans = 0; void dfs(vector<int> &A) { if (A.size() == n) { ll ...
[["-", 0, 43, 49, 50, 51, 23, 0, 41, 64, 13], ["+", 0, 43, 49, 50, 51, 23, 0, 41, 64, 13]]
1
271
#include <algorithm> #include <iostream> #include <queue> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) using namespace std; int n, m, q; vector<int> a, b, c, d; long long score(vector<int> A) { long long ans = 0; REP(i, q) { if (A[b[i]] - A[a[i]] == c[i]) ans += d[i]; } return a...
#include <algorithm> #include <iostream> #include <queue> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) using namespace std; int n, m, q; vector<int> a, b, c, d; long long score(vector<int> A) { long long ans = 0; REP(i, q) { if (A[b[i]] - A[a[i]] == c[i]) ans += d[i]; } return a...
[["-", 0, 43, 49, 50, 51, 23, 0, 41, 64, 13], ["+", 0, 43, 49, 50, 51, 23, 0, 41, 64, 13]]
1
298
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; #define chmax(x, y) x = max(x, y); const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, -1, 0, 1}; const int INF = 1001001001; int n, m, q; vector<int> a, b, c, d; int ans = 0; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; #define chmax(x, y) x = max(x, y); const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, -1, 0, 1}; const int INF = 1001001001; int n, m, q; vector<int> a, b, c, d; int ans = 0; ...
[["+", 0, 57, 64, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 51, 13]]
1
293
# # abc165 c # import sys from io import StringIO import unittest sys.setrecursionlimit(100000) class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.stdout.seek...
# # abc165 c # import sys from io import StringIO import unittest sys.setrecursionlimit(100000) class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.stdout.seek...
[["-", 15, 666, 0, 657, 12, 206, 206, 657, 12, 22], ["+", 15, 666, 0, 657, 12, 206, 206, 657, 12, 612]]
5
363
from itertools import combinations_with_replacement def main(): n, m, q = map(int, input().split()) qlist = [] for _ in range(q): qlist.append(tuple(map(int, input().split()))) nums = [i for i in range(0, m + 1)] alist = tuple(combinations_with_replacement(nums, n)) r = 0 for al in...
from itertools import combinations_with_replacement def main(): n, m, q = map(int, input().split()) qlist = [] for _ in range(q): qlist.append(tuple(map(int, input().split()))) nums = [i for i in range(1, m + 1)] alist = tuple(combinations_with_replacement(nums, n)) r = 0 for al in...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
168
def dfs(lst): global ans if len(lst) > n: return lowest = 0 if lst != []: lowest = lst[-1] for i in range(lowest, m+1): lst.append(i) dfs(lst) lst.pop() if len(lst) == n: cnt = 0 for i in range(q): a, b, c, d = ab[i] ...
def dfs(lst): global ans if len(lst) > n: return lowest = 1 if lst != []: lowest = lst[-1] for i in range(lowest, m+1): lst.append(i) dfs(lst) lst.pop() if len(lst) == n: cnt = 0 for i in range(q): a, b, c, d = ab[i] ...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
175
#include <bits/stdc++.h> using namespace std; #define int long long #define ALL(x) (x).begin(), (x).end() #define MAX(x) *max_element(ALL(x)) #define MIN(x) *min_element(ALL(x)) typedef pair<int, int> PI; typedef pair<int, pair<int, int>> PII; static const int INF = 1010000000000000017LL; static const double eps = 1...
#include <bits/stdc++.h> using namespace std; #define int long long #define ALL(x) (x).begin(), (x).end() #define MAX(x) *max_element(ALL(x)) #define MIN(x) *min_element(ALL(x)) typedef pair<int, int> PI; typedef pair<int, pair<int, int>> PII; static const int INF = 1010000000000000017LL; static const double eps = 1...
[["-", 0, 338, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 338, 8, 9, 0, 7, 15, 16, 12, 22]]
1
492
N, M, Q = map(int, input().split()) lis = [] for i in range(Q): a = list(map(int, input().split())) lis.append(a) big_lis = [] def dfs(string, n, m): if n == (N - 1): for i in range(m, M + 1): big_lis.append(string + [i]) else: for i in range(m, M + 1): dfs(st...
N, M, Q = map(int, input().split()) lis = [] for i in range(Q): a = list(map(int, input().split())) lis.append(a) big_lis = [] def dfs(string, n, m): if n == (N - 1): for i in range(m, M + 1): big_lis.append(string + [i]) else: for i in range(m, M + 1): dfs(st...
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 612]]
5
222
#!/usr/bin/env python3 import collections as cl import sys def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def main(): N, M, Q = MI() targets = [[] for i in range(Q)] for i in...
#!/usr/bin/env python3 import collections as cl import sys def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def main(): N, M, Q = MI() targets = [[] for i in range(Q)] for i in...
[["-", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 12, 612]]
5
255
import sys sys.setrecursionlimit(10 ** 6) N, M, Q = map(int, input().split()) Q = [list(map(int,input().split())) for _ in range(Q)] ans = 0 A = [] def dfs(): global A if len(A) == N: return global ans if len(A) == 0: start = 0 else: start = A[-1] for i in range(start, M ...
import sys sys.setrecursionlimit(10 ** 6) N, M, Q = map(int, input().split()) Q = [list(map(int,input().split())) for _ in range(Q)] ans = 0 A = [] def dfs(): global A if len(A) == N: return global ans if len(A) == 0: start = 1 else: start = A[-1] for i in range(start, ...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
188
#include <bits/stdc++.h> using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18; void print() { cout << endl; } template <typename Head, typename... Tail> void print(Head head, Tail... tail) { int size = sizeof...(Tail); cout << head; if (size > 0) { cout << " "; } print(tail....
#include <bits/stdc++.h> using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18; void print() { cout << endl; } template <typename Head, typename... Tail> void print(Head head, Tail... tail) { int size = sizeof...(Tail); cout << head; if (size > 0) { cout << " "; } print(tail....
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
424
#include <algorithm> #include <cmath> #include <iostream> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <vector> const long long MOD = 1000000007; using namespace std; typedef long long llong; // int isalpha(char ...
#include <algorithm> #include <cmath> #include <iostream> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <vector> const long long MOD = 1000000007; using namespace std; typedef long long llong; // int isalpha(char ...
[["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
381
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> using namespace std; #define intmax INT...
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> using namespace std; #define intmax INT...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 9, 0, 57, 64, 9, 0, 37, 0, 38]]
1
1,359
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define ll long long #define rep(i, n) for (int i = 0; i < int(n); i++) #define vi vector<int> using namespace std; const int INF = 1001001001; const int MOD = 1e9 + 7; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; template <class T> inlin...
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define ll long long #define rep(i, n) for (int i = 0; i < int(n); i++) #define vi vector<int> using namespace std; const int INF = 1001001001; const int MOD = 1e9 + 7; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; template <class T> inlin...
[["-", 0, 14, 49, 53, 54, 55, 0, 356, 0, 32], ["-", 49, 53, 54, 55, 0, 356, 365, 5, 0, 62], ["-", 49, 53, 54, 55, 0, 356, 365, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
409
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1;...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1;...
[["+", 51, 16, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 51, 16, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
412
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define int long long #define ll long long #define vi vector<int> #define pii pair<int, int> #define F first #define S second #define pb push_back #define rep(i, a, b) for (int i = a; i < b; i++) #define repr(i, a, b) for (int i = a - 1...
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define int long long #define ll long long #define vi vector<int> #define pii pair<int, int> #define F first #define S second #define pb push_back #define rep(i, a, b) for (int i = a; i < b; i++) #define repr(i, a, b) for (int i = a - 1...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
430
#include <bits/stdc++.h> //#include <mylib.h> using namespace std; // cin.sync_with_stdio(false); //===================================================== // マクロ定義部 いつかヘッダファイルに分ける //===================================================== #define FOR(i, a, b) for (ll i = (a); i < (b); ++i) #define FOR_EQ(i, a, b) for (ll i...
#include <bits/stdc++.h> //#include <mylib.h> using namespace std; // cin.sync_with_stdio(false); //===================================================== // マクロ定義部 いつかヘッダファイルに分ける //===================================================== #define FOR(i, a, b) for (ll i = (a); i < (b); ++i) #define FOR_EQ(i, a, b) for (ll i...
[["+", 49, 53, 54, 55, 0, 56, 49, 352, 0, 67], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
2,914
N, M, Q = map(int, input().split()) A = [] for i in range(Q): A.append(list(map(int, input().split()))) def calc(B, n): ans = 0 if len(B) < N: for i in range(n, M + 1): ans = max(ans, calc(B + [i], i)) return ans else: for j in range(Q): if B[A[j][1]-1] - B[A[j][0]-1] == A[j][2]: ...
N, M, Q = map(int, input().split()) A = [] for i in range(Q): A.append(list(map(int, input().split()))) def calc(B, n): ans = 0 #not enough length if len(B) < N: for i in range(n, M + 1): ans = max(ans, calc(B + [i], i)) #enough length else: #print("B:", B) for j in range(Q): if B[...
[["-", 64, 196, 0, 7, 8, 196, 0, 37, 0, 38], ["-", 64, 196, 0, 7, 8, 196, 0, 37, 0, 22]]
5
166
#include <bits/stdc++.h> using namespace std; int main(void) { int N, M, Q; cin >> N >> M >> Q; vector<int> a(Q), b(Q), c(Q), d(Q); for (int i = 0; i < Q; i++) { cin >> a[i] >> b[i] >> c[i] >> d[i]; a[i]--, b[i]--; } vector<int> A(N); string nm = ""; for (int i = 0; i <= N; i++) { nm += "0...
#include <bits/stdc++.h> using namespace std; int main(void) { int N, M, Q; cin >> N >> M >> Q; vector<int> a(Q), b(Q), c(Q), d(Q); for (int i = 0; i < Q; i++) { cin >> a[i] >> b[i] >> c[i] >> d[i]; a[i]--, b[i]--; } vector<int> A(N); string nm = ""; for (int i = 0; i < M; i++) { nm += "0"...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
335
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, a, b) for (int i = a; i < b; i++) #define all(x) x.begin(), x.end() #define fi first #define se second #define pb push_back #define debug...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, a, b) for (int i = a; i < b; i++) #define all(x) x.begin(), x.end() #define fi first #define se second #define pb push_back #define debug...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
452
#include <bits/stdc++.h> typedef long long int ll; using namespace std; int a[50], b[50], c[50], d[50]; int n, m, q; int mx = 0; vector<int> t; int check() { int curr = 0; for (int i = 0; i < q; i++) { if (t[b[i]] - t[a[i]] == c[i]) curr += d[i]; } return curr; } void dfs(int i, int cur) { if (i ...
#include <bits/stdc++.h> typedef long long int ll; using namespace std; int a[50], b[50], c[50], d[50]; int n, m, q; int mx = 0; vector<int> t; int check() { int curr = 0; for (int i = 0; i < q; i++) { if (t[b[i]] - t[a[i]] == c[i]) curr += d[i]; } return curr; } void dfs(int i, int cur) { if (i ...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]]
1
285
def backtrack(nums, N, cur_state, result): if len(cur_state) == N: result.append(cur_state[:]) else: for i in range(len(nums)): cur_state.append(nums[i]) backtrack(nums[i:], N, cur_state, result) cur_state.pop() def solve(): N,M,Q = [int(i) for i in input...
def backtrack(nums, N, cur_state, result): if len(cur_state) == N: result.append(cur_state[:]) else: for i in range(len(nums)): cur_state.append(nums[i]) backtrack(nums[i:], N, cur_state, result) cur_state.pop() def solve(): N,M,Q = [int(i) for i in input...
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
217
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define repo(i, n) for (int i = 1; i <= n; i++) #define INF 1001001001 #define INFll 100100100100100 // debug用 #define PrintVec(x) \ for (auto elementPrintVec : x) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define repo(i, n) for (int i = 1; i <= n; i++) #define INF 1001001001 #define INFll 100100100100100 // debug用 #define PrintVec(x) \ for (auto elementPrintVec : x) { ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
311
#include <bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; #define ll long long int #define ar array #define ld long double #define bigint int64_t #define vll vector<ll> #define pll ar<ll, 4> #define vpll vector<pll> #define pb push_back #define MOD 1000000007 #defi...
#include <bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; #define ll long long int #define ar array #define ld long double #define bigint int64_t #define vll vector<ll> #define pll ar<ll, 4> #define vpll vector<pll> #define pb push_back #define MOD 1000000007 #defi...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
2,094
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define INF 1e12 #define PB push_back #define PF push_front #define fi first #define se second #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vpi vector<pii> #define vll vector<ll> #define vp...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define INF 1e12 #define PB push_back #define PF push_front #define fi first #define se second #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vpi vector<pii> #define vll vector<ll> #define vp...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 56, 49, 185, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
709
#include <iostream> #include <vector> using namespace std; int main() { int n, m, q; cin >> n >> m >> q; vector<int> a(q), b(q), c(q), d(q); for (int i = 0; i < n; ++i) { cin >> a[i] >> b[i] >> c[i] >> d[i]; a[i]--; b[i]--; } int ans = 0; auto calc = [&](vector<int> &v) { int res = 0; ...
#include <iostream> #include <vector> using namespace std; int main() { int n, m, q; cin >> n >> m >> q; vector<int> a(q), b(q), c(q), d(q); for (int i = 0; i < q; ++i) { cin >> a[i] >> b[i] >> c[i] >> d[i]; a[i]--; b[i]--; } int ans = 0; auto calc = [&](vector<int> &v) { int res = 0; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
311
#include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using P = pair<int, int>; #include <algorithm> #include <map> #include <math.h> #include <queue> #include <set> const int INF = 1e9; vector<int> a, b, c, d; int n, m, q; int an = 0; void dfs...
#include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using P = pair<int, int>; #include <algorithm> #include <map> #include <math.h> #include <queue> #include <set> const int INF = 1e9; vector<int> a, b, c, d; int n, m, q; int an = 0; void dfs...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
265
import sys N, M, Q = map(int, input().split()) abcd = [tuple(map(int, sys.stdin.readline().split())) for _ in range(Q)] ans = 0 done = set() todo = [(i,) for i in range(1, M)] while todo: A = todo.pop() done.add(A) if len(A) == N: total = 0 for a, b, c, d in abcd: if A[b-1] - A[a...
import sys N, M, Q = map(int, input().split()) abcd = [tuple(map(int, sys.stdin.readline().split())) for _ in range(Q)] ans = 0 done = set() todo = [(i,) for i in range(1, M + 1)] while todo: A = todo.pop() done.add(A) if len(A) == N: total = 0 for a, b, c, d in abcd: if A[b-1] -...
[["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]]
5
182
#include "bits/stdc++.h" #define rep(i, j) for (int i = 0; i < j; i++) using namespace std; using ll = long long; using P = pair<int, int>; using ull = unsigned long long; ll gcd(ll x, ll y); int fac(ll n, vector<int> num); const int INF = 1001001001; // mint�p�̕ϐ� (10��9��) const int mod = 1000000007; struct mint ...
#include "bits/stdc++.h" #define rep(i, j) for (int i = 0; i < j; i++) using namespace std; using ll = long long; using P = pair<int, int>; using ull = unsigned long long; ll gcd(ll x, ll y); int fac(ll n, vector<int> num); const int INF = 1001001001; // mint�p�̒萔 (10��9��) const int mod = 1000000007; struct mint {...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
973
#include "bits/stdc++.h" #define rep(i, j) for (int i = 0; i < j; i++) using namespace std; using ll = long long; const int INF = 1001001001; /*struct mint { ll x; // typedef long long ll; mint(ll x = 0) :x((x% mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint& operator+=(const min...
#include "bits/stdc++.h" #define rep(i, j) for (int i = 0; i < j; i++) using namespace std; using ll = long long; const int INF = 1001001001; /*struct mint { ll x; // typedef long long ll; mint(ll x = 0) :x((x% mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint& operator+=(const min...
[["-", 75, 76, 0, 9, 0, 43, 49, 50, 51, 13], ["+", 75, 76, 0, 9, 0, 43, 49, 50, 51, 13]]
1
369
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define all(x) (x).begin(), (x).end() using ll = long long; string char_to_string(char val) { return string(1, val); } int char_to_int(char val) { return val - '0'; } template <class T> inline bool chmin(T ...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define all(x) (x).begin(), (x).end() using ll = long long; string char_to_string(char val) { return string(1, val); } int char_to_int(char val) { return val - '0'; } template <class T> inline bool chmin(T ...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13]]
1
391
# coding: utf-8 import itertools def main(): n, m, q = map(int, input().split()) matrix = [] for _ in range(q): row = list(map(int, input().split())) matrix.append(row) # print(matrix) A = list(range(1, m)) ans = 0 for tmp_A in itertools.combinations_with_replacement(A, n): ...
# coding: utf-8 import itertools def main(): n, m, q = map(int, input().split()) matrix = [] for _ in range(q): row = list(map(int, input().split())) matrix.append(row) # print(matrix) A = list(range(1, m+1)) ans = 0 for tmp_A in itertools.combinations_with_replacement(A, n):...
[["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
157
n,m,q=gets.split.map(&:to_i) s=q.times.map{gets.split.map(&:to_i)} ans=[] ary=[*1..m].repeated_combination(n).to_a ary.each do |i| sum=0 s.each do |a,b,c,d| if i[a-1]-i[b-1]==c sum+=d end end ans << sum end puts ans.max
n,m,q=gets.split.map(&:to_i) s=q.times.map{gets.split.map(&:to_i)} ans=[] ary=[*1..m].repeated_combination(n) ary.each do |i| sum=0 s.each do |a,b,c,d| if i[b-1]-i[a-1]==c sum+=d end end ans << sum end puts ans.max
[["-", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["-", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["-", 15, 738, 31, 738, 31, 742, 0, 738, 31, 22], ["+", 15, 738, 31, 738, 31, 742, 0, 738, 31, 22], ["-", 15, 738, 31, 738, 12, 742, 0, 738, 31, 22], ["+", 15, 738, 31, 738, 12, 742, 0, 738, 31, 22]]
4
104
n,m,q=gets.split.map(&:to_i) s=q.times.map{gets.split.map(&:to_i)} ans=[] ary=[*1..m].repeated_combination(n) ary.each do |i| sum=0 s.each do |a,b,c,d| if i[a-1]-i[b-1]==c sum+=d end end ans << sum end puts ans.max
n,m,q=gets.split.map(&:to_i) s=q.times.map{gets.split.map(&:to_i)} ans=[] ary=[*1..m].repeated_combination(n).to_a ary.each do |i| sum=0 s.each do |a,b,c,d| if i[b-1]-i[a-1]==c sum+=d end end ans << sum end puts ans.max
[["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["-", 15, 738, 31, 738, 31, 742, 0, 738, 31, 22], ["+", 15, 738, 31, 738, 31, 742, 0, 738, 31, 22], ["-", 15, 738, 31, 738, 12, 742, 0, 738, 31, 22], ["+", 15, 738, 31, 738, 12, 742, 0, 738, 31, 22]]
4
102
n, m, q = gets.split.map &:to_i abcd = q.times.map {gets.split.map &:to_i} max = 0 seq = [1] * n loop do sum = 0 abcds.each do |abcd| a, b, c, d = abcd if seq[b-1] - seq[a-1] == c sum += d end end max = [max, sum].max # next i = n-1 while i >= 0 if seq[i] == m i -= 1 else...
n, m, q = gets.split.map &:to_i abcds = q.times.map {gets.split.map &:to_i} max = 0 seq = [1] * n loop do sum = 0 abcds.each do |abcd| a, b, c, d = abcd if seq[b-1] - seq[a-1] == c sum += d end end max = [max, sum].max # next i = n-1 while i >= 0 if seq[i] == m i -= 1 els...
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22]]
4
150
from math import factorial as fact import math import sys import itertools import numpy as np from collections import Counter import datetime #入力:N(int:整数) def input1(): return int(input()) #入力:N,M(int:整数) def input2(): return map(int,input().split()) #入力:[n1,n2,...nk](int:整数配列) def input_array(): return list(ma...
from math import factorial as fact import math import sys import itertools import numpy as np from collections import Counter import datetime #入力:N(int:整数) def input1(): return int(input()) #入力:N,M(int:整数) def input2(): return map(int,input().split()) #入力:[n1,n2,...nk](int:整数配列) def input_array(): return list(ma...
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
416
import math goal = int(input()) cnt = 0 money = 100 while goal >= money: money = math.floor(money * 1.01) cnt +=1 print(cnt)
import math goal = int(input()) cnt = 0 money = 100 while goal > money: money = math.floor(money * 1.01) cnt +=1 print(cnt)
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 47]]
5
38
def main(): x = int(input()) c = 100 count = 0 while not c >= x: c += c * 0.01 count += 1 print(count) if __name__ == '__main__': main()
def main(): x = int(input()) c = 100 count = 0 while not c >= x: c += int(c * 0.01) count += 1 print(count) if __name__ == '__main__': main()
[["+", 8, 196, 0, 1, 0, 677, 12, 652, 63, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25]]
5
47
x = int(input()) n = 100 i = 1 while n < x: n += n // 100 i += 1 print(i)
x = int(input()) n = 100 i = 1 while n < x: n += n // 100 i += 1 print(i-1)
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
31
x = int(input()) cnt = 0 res = 100 while res <= x: res = res * 1.01 cnt += 1 print(cnt)
x = int(input()) cnt = 0 res = 100 while res < x: res = int(res * 1.01) cnt += 1 print(cnt)
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
31
x=int(input()) a=100 y=0 while a<=x: a=a*1.01//1 y+=1 print(y)
x=int(input()) a=100 y=0 while a<x: a=(a*1.01)//1 y+=1 print(y)
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25]]
5
33
#include <cmath> #include <iostream> #include <utility> using namespace std; typedef pair<int, int> pii; typedef long long ll; #define mp make_pair #define x first #define y second int main() { ll n; cin >> n; int tr = 0; int i = 1; ll x = 100ll; while (x < n) { x += x / 100ll; i++; } cout <<...
#include <cmath> #include <iostream> #include <utility> using namespace std; typedef pair<int, int> pii; typedef long long ll; #define mp make_pair #define x first #define y second int main() { ll n; cin >> n; int tr = 0; int i = 0; ll x = 100ll; while (x < n) { x += x / 100ll; i++; } cout <<...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
85
#include "bits/stdc++.h" using namespace std; #define watch(x) cout << (#x) << " is " << (x) << endl int main() { ios::sync_with_stdio(false); cin.tie(0); long long x; cin >> x; int ans = 0; for (long long i = 100; i <= x;) { i += (i / 100); ans++; } cout << ans << endl; return 0; }
#include "bits/stdc++.h" using namespace std; #define watch(x) cout << (#x) << " is " << (x) << endl int main() { ios::sync_with_stdio(false); cin.tie(0); long long x; cin >> x; int ans = 0; for (long long i = 100; i < x;) { i += (i / 100); ans++; } cout << ans << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
82
#include <bits/stdc++.h> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) #define drep(i, cc, n) for (int i = cc; i >= n; --i) #define sz(s) (int)(s.size()) #define vecprint(v) \ rep(i, 0, v.size() - 1) cout << v[i] << " "; ...
#include <bits/stdc++.h> #define rep(i, cc, n) for (int i = cc; i <= n; ++i) #define drep(i, cc, n) for (int i = cc; i >= n; --i) #define sz(s) (int)(s.size()) #define vecprint(v) \ rep(i, 0, v.size() - 1) cout << v[i] << " "; ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18]]
1
169
from math import sqrt,ceil # map(int,input().split()) n=int(input()) s=100 c=0 while(s<=n): p=s//100 s=s+p c+=1 print(c)
from math import sqrt,ceil # map(int,input().split()) n=int(input()) s=100 c=0 while(s<n): p=s//100 s=s+p c+=1 # print(s) print(c)
[["-", 0, 656, 0, 52, 15, 23, 0, 666, 667, 19], ["+", 0, 656, 0, 52, 15, 23, 0, 666, 667, 18]]
5
45
x=int(input()) price=100 yr=0 while price<x: price=price*1.01 yr+=1 print(yr)
x=int(input()) price=100 yr=0 while price<x: price=price*1.01 price=int(price) yr+=1 print(yr)
[["+", 0, 52, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
31
#include <bits/stdc++.h> #define f first #define s second #define MOD 1000000007 #define PMOD 998244353 #define pb(x) push_back(x) using namespace std; typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, ll> plii; typedef pair<int, pii> piii; const int INF = 1e9 + 10; const ll LINF = 1LL * INF * INF...
#include <bits/stdc++.h> #define f first #define s second #define MOD 1000000007 #define PMOD 998244353 #define pb(x) push_back(x) using namespace std; typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, ll> plii; typedef pair<int, pii> piii; const int INF = 1e9 + 10; const ll LINF = 1LL * INF * INF...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
482
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; int n, m, q; int a[51], b[51], c[51], d[51]; int ans = 0; // int n_use = 0, m_use = 0; void dfs(vector<int> A) { if (A.size() == n + 1) { int now = 0; for (int i = 0; i < q; i++) { if (A[b[i]] - A[a[i]] ...
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; int n, m, q; int a[51], b[51], c[51], d[51]; int ans = 0; // int n_use = 0, m_use = 0; void dfs(vector<int> A) { if (A.size() == n + 1) { int now = 0; for (int i = 0; i < q; i++) { if (A[b[i]] - A[a[i]] ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
242
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int n, m, q, ans = 0; vector<int> arr; vector<vector<int>> group; int score(); void dfs(int depth); int main() { cin >> n >> m >> q; arr.resize(n + 1, 1); group.resize(q, vector<int>(4)); rep(i, q) { rep(j, 4) cin >> ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int n, m, q, ans = 0; vector<int> arr; vector<vector<int>> group; int score(); void dfs(int depth); int main() { cin >> n >> m >> q; arr.resize(n + 1, 1); group.resize(q, vector<int>(4)); rep(i, q) { rep(j, 4) cin >> ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
288
#include <bits/stdc++.h> using namespace std; #define int long long int n, m, q; int a[60], b[60], c[60], d[60]; int ans = 0; void dfs(int depth, int val, vector<int> A) { if (depth == n) { int sum = 0; for (int i = 0; i < q; i++) { if (A[b[i]] - A[a[i]] == c[i]) { sum += d[i]; } ...
#include <bits/stdc++.h> using namespace std; #define int long long int n, m, q; int a[60], b[60], c[60], d[60]; int ans = 0; void dfs(int depth, int val, vector<int> A) { if (depth == n) { int sum = 0; for (int i = 0; i < q; i++) { if (A[b[i]] - A[a[i]] == c[i]) { sum += d[i]; } ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
263
N, M, Q = map(int, input().split()) abcd_list = [list(map(int, input().split())) for _ in range(Q)] Alist = [] def dfs(array): if len(array) == N: Alist.append(array) else: if not array: for i in range(M+1): dfs(array[:] + [i]) else: for i in range...
N, M, Q = map(int, input().split()) abcd_list = [list(map(int, input().split())) for _ in range(Q)] Alist = [] def dfs(array): if len(array) == N: Alist.append(array) else: if not array: for i in range(1, M+1): dfs(array[:] + [i]) else: for i in ra...
[["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
183
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; #define ALL(x) (x).begin(), (x).end() #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define pb push_back typedef vector<int> vint; typedef vector<ll> vll; template <typename T> istream &operator>>(istream &is, ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; #define ALL(x) (x).begin(), (x).end() #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define pb push_back typedef vector<int> vint; typedef vector<ll> vll; template <typename T> istream &operator>>(istream &is, ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
415
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int MOD = 1e9 + 7; using ll = long long; int main() { int n, m, q; cin >> n >> m >> q; vector<ll> a(n), b(n), c(n), d(n); rep(i, q) { int A, B, C, D; cin >> A >> B >> C >> D; A--; B--; a...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const int MOD = 1e9 + 7; using ll = long long; int main() { int n, m, q; cin >> n >> m >> q; vector<ll> a(q), b(q), c(q), d(q); rep(i, q) { int A, B, C, D; cin >> A >> B >> C >> D; A--; B--; a...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
442
from collections import deque def calc(nums): ret = 0 for a, b, c, d in req: if nums[b - 1] - nums[a - 1] == c: ret += d return ret n, m, q = list(map(int, input().split())) req = [list(map(int, input().split())) for _ in range(q)] ans = 0 que = deque() # [1]~[m]までキューに追加します。実は[1]...
from collections import deque def calc(nums): ret = 0 for a, b, c, d in req: if nums[b - 1] - nums[a - 1] == c: ret += d return ret n, m, q = list(map(int, input().split())) req = [list(map(int, input().split())) for _ in range(q)] ans = 0 que = deque() # [1]~[m]までキューに追加します。実は[1]...
[["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
187
from sys import stdin, setrecursionlimit def main(): input = stdin.buffer.readline n, m, q = map(int, input().split()) abcd = [list(map(int, input().split())) for _ in range(q)] arr = [] def dfs(num, ai): if len(ai) == n: arr.append(ai) elif len(ai) < n: f...
from sys import stdin, setrecursionlimit def main(): input = stdin.buffer.readline n, m, q = map(int, input().split()) abcd = [list(map(int, input().split())) for _ in range(q)] arr = [] def dfs(num, ai): if len(ai) == n: arr.append(ai) elif len(ai) < n: f...
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
191
#include <bits/stdc++.h> #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; #define lli long long int #define uli unsigned long long int #define INF 9999999999 #define rep(i, m, n) for (lli i = m; i < n; i++) #define rrep(i, m, n) for (lli i = m - 1; i >= n; i...
#include <bits/stdc++.h> #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; #define lli long long int #define uli unsigned long long int #define INF 9999999999 #define rep(i, m, n) for (lli i = m; i < n; i++) #define rrep(i, m, n) for (lli i = m - 1; i >= n; i...
[["-", 8, 9, 0, 42, 0, 356, 365, 2, 63, 22], ["-", 0, 42, 0, 356, 365, 2, 3, 4, 0, 24], ["-", 0, 42, 0, 356, 365, 2, 3, 4, 0, 22], ["-", 0, 42, 0, 356, 365, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
560
#include <bits/stdc++.h> #include <climits> using namespace std; int main(void) { int N, M, Q; cin >> N >> M >> Q; int a[Q], b[Q], c[Q], d[Q]; for (int i = 0; i < Q; i++) { cin >> a[i] >> b[i] >> c[i] >> d[i]; a[i]--; b[i]--; } queue<vector<int>> que; for (int i = 0; i < M; i++) { vec...
#include <bits/stdc++.h> #include <climits> using namespace std; int main(void) { int N, M, Q; cin >> N >> M >> Q; int a[Q], b[Q], c[Q], d[Q]; for (int i = 0; i < Q; i++) { cin >> a[i] >> b[i] >> c[i] >> d[i]; a[i]--; b[i]--; } queue<vector<int>> que; for (int i = 0; i < M; i++) { vec...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
372
# ENV[Z = 'RUBY_THREAD_VM_STACK_SIZE'] || exec( { Z => '50000000' },'ruby',$0) # readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) } # gets.split.map(&:to_i) n,m,q = gets.split.map(&:to_i) line = [] q.times do line << gets.chomp.split.map(&:to_i) end a = [*1..m].combination(n).to_a max_s = 0 a.each do |arr| ...
# ENV[Z = 'RUBY_THREAD_VM_STACK_SIZE'] || exec( { Z => '50000000' },'ruby',$0) # readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) } # gets.split.map(&:to_i) n,m,q = gets.split.map(&:to_i) line = [] q.times do line << gets.chomp.split.map(&:to_i) end a = [*1..m].repeated_combination(n).to_a max_s = 0 a.each d...
[["-", 0, 493, 0, 662, 12, 652, 486, 652, 735, 22], ["+", 0, 493, 0, 662, 12, 652, 486, 652, 735, 22]]
4
121
#include <bits/stdc++.h> #define REPZ(i, z, n) for (decltype(n) i = (z); i < (n); i++) #define REP(i, n) for (decltype(n) i = 0; i < (n); i++) #define ALL(v) v.begin(), v.end() #define SIZE(v) ((ll)(v).size()) #define MAX(v) (*max_element(all(v))) #define MIN(v) (*min_element(all(v))) #define INF 1000000000000 // 1E+12...
#include <bits/stdc++.h> #define REPZ(i, z, n) for (decltype(n) i = (z); i < (n); i++) #define REP(i, n) for (decltype(n) i = 0; i < (n); i++) #define ALL(v) v.begin(), v.end() #define SIZE(v) ((ll)(v).size()) #define MAX(v) (*max_element(all(v))) #define MIN(v) (*min_element(all(v))) #define INF 1000000000000 // 1E+12...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13]]
1
413
N, M, Q = map(int, input().split()) vec = [list(map(int, input().split())) for i in range(Q)] A = itertools.combinations_with_replacement(range(1,M+1), N) ans = 0 for a in A: tmp = 0 for v in vec: if (a[v[1]-1] - a[v[0]-1]) == v[2]: tmp += v[3] if ans < tmp: ans = tmp p...
import itertools N, M, Q = map(int, input().split()) vec = [list(map(int, input().split())) for i in range(Q)] A = itertools.combinations_with_replacement(range(1,M+1), N) ans = 0 for a in A: tmp = 0 for v in vec: if (a[v[1]-1] - a[v[0]-1]) == v[2]: tmp += v[3] if ans < tmp: ans...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
123
#include <algorithm> #include <iostream> #include <vector> using namespace std; int N, M, Q; vector<int> a, b, c, d; int select_num(vector<int> ary, int n, int count); int main() { cin >> N; cin >> M; cin >> Q; a = b = c = d = vector<int>(Q); for (int i = 0; i < Q; i++) { cin >> a[i]; cin >> b[i]...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int N, M, Q; vector<int> a, b, c, d; int select_num(vector<int> ary, int n, int count); int main() { cin >> N; cin >> M; cin >> Q; a = b = c = d = vector<int>(Q); for (int i = 0; i < Q; i++) { cin >> a[i]; cin >> b[i]...
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13]]
1
285
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return tr...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return tr...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
361
#include <bits/stdc++.h> using namespace std; const double PI = 3.14159265358979323846; typedef long long ll; const double EPS = 1e-9; #define rep(i, n) for (int i = 0; i < (n); ++i) //#define rep(i, n) for (ll i = 0; i < (n); ++i) const ll INF = 10e17; #define cmin(x, y) x = min(x, y) #define cmax(x, y) x = max(x, y...
#include <bits/stdc++.h> using namespace std; const double PI = 3.14159265358979323846; typedef long long ll; const double EPS = 1e-9; #define rep(i, n) for (int i = 0; i < (n); ++i) //#define rep(i, n) for (ll i = 0; i < (n); ++i) const ll INF = 10e17; #define cmin(x, y) x = min(x, y) #define cmax(x, y) x = max(x, y...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
548
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author champon */ #include <fstream> #include <iostream> //<editor-fold desc="definitions"> #include <bits/stdc++.h> #define se cout << "test ok" << endl; #define sp << " " << #define enl "\n" using namespace std; using ll = ...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author champon */ #include <fstream> #include <iostream> //<editor-fold desc="definitions"> #include <bits/stdc++.h> #define se cout << "test ok" << endl; #define sp << " " << #define enl "\n" using namespace std; using ll = ...
[["-", 0, 9, 0, 43, 49, 50, 51, 41, 64, 13], ["+", 0, 9, 0, 43, 49, 50, 51, 41, 64, 13]]
1
1,066
#include <bits/stdc++.h> #define st first #define nd second #define ll long long #define ld long double #define pb push_back #define emp emplace_back #define pii pair<int, int> #define usg unsigned #define sg signed #define mp make_pair using namespace std; void setIO() { ios::sync_with_stdio(0); cin.tie(0); c...
#include <bits/stdc++.h> #define st first #define nd second #define ll long long #define ld long double #define pb push_back #define emp emplace_back #define pii pair<int, int> #define usg unsigned #define sg signed #define mp make_pair using namespace std; void setIO() { ios::sync_with_stdio(0); cin.tie(0); c...
[["-", 0, 57, 64, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 8, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["-", 0, 57, 64, 9, 0, 7, 8, 9, 0, 46]]
1
349
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int a[60], b[60], c[60], d[60]; int main(void) { int ans = 0; int n, m, q; cin >> n >> m >> q; rep(i, q) { cin >> a[i] >> b[i] >> c[i] >> d[i]; } int itr[12], k[12]; for (int i = 0; i <= 11; i++) k[i] = 10; itr[...
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int a[60], b[60], c[60], d[60]; int main(void) { int ans = 0; int n, m, q; cin >> n >> m >> q; rep(i, q) { cin >> a[i] >> b[i] >> c[i] >> d[i]; } int itr[12], k[12]; for (int i = 0; i <= 11; i++) k[i] = m; itr[0...
[["-", 8, 9, 0, 7, 8, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 1, 0, 11, 12, 22]]
1
501
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; (i) < (int)(n); i++) using namespace std; int N, M, Q, A[55], B[55], C[55], D[55], S[15] = {0}; int maxD = 0; void repeat(int n) { if (n == N) { int d = 0; rep(i, Q) { if (S[B[i] - 1] - S[A[i...
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; (i) < (int)(n); i++) using namespace std; int N, M, Q, A[55], B[55], C[55], D[55], S[15] = {0}; int maxD = 0; void repeat(int n) { if (n == N) { int d = 0; rep(i, Q) { if (S[B[i] - 1] - S[A[i...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
245
import itertools #1~Mと仕切りN枚を適宜並べ、「左にあるかずの個数」を考える。 #1~N+Mの中からN個選ぶ N,M,Q = [int(hoge) for hoge in input().split()] L = list(itertools.combinations(range(1,M+N+1),N)) abcd = [[int(hoge) for hoge in input().split()] for q in range(Q)] curmax = 0 for l in L: suretu = [] score = 0 for n,k in enumerate(l):#数列を実際に...
import itertools #1~Mと仕切りN枚を適宜並べ、「左にあるかずの個数」を考える。 #1~N+Mの中からN個選ぶ N,M,Q = [int(hoge) for hoge in input().split()] L = list(itertools.combinations(range(1,M+N),N)) abcd = [[int(hoge) for hoge in input().split()] for q in range(Q)] curmax = 0 for l in L: suretu = [] score = 0 for n,k in enumerate(l):#数列を実際に生成...
[["-", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
155
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import math import collections n,m,q = map(int,input().split()) item = [] for i in range(q): a,b,c,d = map(int,input().split()) item.append([a,b,c,d]) a = [0 for i in range(11)] ans = 0 for i1 i...
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import math import collections n,m,q = map(int,input().split()) item = [] for i in range(q): a,b,c,d = map(int,input().split()) item.append([a,b,c,d]) a = [0 for i in range(11)] ans = 0 for i1 i...
[["-", 15, 666, 0, 657, 31, 206, 206, 657, 17, 33], ["-", 15, 666, 0, 657, 31, 206, 206, 657, 12, 612], ["-", 15, 666, 0, 657, 12, 206, 206, 657, 17, 33], ["-", 15, 666, 0, 657, 12, 206, 206, 657, 12, 612]]
5
327
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
376
#include <bits/stdc++.h> using namespace std; int n, m, q, a[60], b[60], c[60], d[60], A[60], ma; void dfs(int dep) { if (dep == n + 1) { int sum = 0; for (int i = 1; i <= q; i++) { if (A[b[i]] - A[a[i]] == c[i]) sum += d[i]; } ma = max(ma, sum); return; } for (int i = A[dep - 1]...
#include <bits/stdc++.h> using namespace std; int n, m, q, a[60], b[60], c[60], d[60], A[20], ma; void dfs(int dep) { if (dep == n + 1) { int sum = 0; for (int i = 1; i <= q; i++) { if (A[b[i]] - A[a[i]] == c[i]) sum += d[i]; } ma = max(ma, sum); return; } for (int i = A[dep - 1]...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22]]
1
221