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
n = int(input()) a = [0 for _ in range(n+1)] for i in range(1,n+1): if i*i>n: break for j in range(1,n+1): if i*i + j*j +i*j > n: break for k in range(1,n+1): tmp = i*i + j*j + k*k + i*j + j*k + k*i if tmp==n: a[tmp]+=1 else: break for i in range(1,n+1): print(a...
n = int(input()) a = [0 for _ in range(n+1)] for i in range(1,n+1): if i*i>n: break for j in range(1,n+1): if i*i + j*j +i*j > n: break for k in range(1,n+1): tmp = i*i + j*j + k*k + i*j + j*k + k*i if tmp<=n: a[tmp]+=1 else: break for i in range(1,n+1): print(a...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
140
N = int(input()) ans = [0 for _ in range(N + 1)] for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): v = x * x + y * y + z * z + x * y + y * z + z * x if v > N: continue ans[v] += 1 for i in range(N): print(ans[i])
N = int(input()) ans = [0 for _ in range(N + 1)] for x in range(1, 101): for y in range(1, 101): for z in range(1, 101): v = x * x + y * y + z * z + x * y + y * z + z * x if v > N: continue ans[v - 1] += 1 for i in range(N): print(ans[i])
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
104
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long int ll; typedef long double ld; #define rep(i, n) for (int i = 0; i < (n); ++i) #define Sort(Array) sort(Array.begin(), Ar...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long int ll; typedef long double ld; #define rep(i, n) for (int i = 0; i < (n); ++i) #define Sort(Array) sort(Array.begin(), Ar...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
262
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; // typedef vector<vector<ll>> Graph; const ll mod = 1e9 + 7; // const ll mo...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; // typedef vector<vector<ll>> Graph; const ll mod = 1e9 + 7; // const ll mo...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
653
#include <bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; #define speed \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; #define speed \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["+", 0, 14, 8, 9, 0, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 0, 25]]
1
220
#include <bits/stdc++.h> using namespace std; #define int long long const int INF = 1e9 + 7; int n, x, y, z, i; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; int m = sqrt(10 + n); vector<int> out(n + 1, 0); int ctr = 0; for (x = 1; x <= m + 1; x++) { for (y = 1; y <= m ...
#include <bits/stdc++.h> using namespace std; #define int long long const int INF = 1e9 + 7; int n, x, y, z, i; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; int m = sqrt(10 + n); vector<int> out(n + 1, 0); int ctr = 0; for (x = 1; x < m + 1; x++) { for (y = 1; y < m + ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
215
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
250
#include <bits/stdc++.h> using namespace std; int v[20000]; int main() { int n; scanf("%d", &n); for (int i = 0; i < 105; i++) { for (int j = 0; j < 105; j++) { for (int k = 0; k < 105; k++) { int t = i * i + j * j + k * k + i * j + j * k + k * i; if (t < 10050) v[t]++; }...
#include <bits/stdc++.h> using namespace std; int v[20000]; int main() { int n; scanf("%d", &n); for (int i = 1; i < 105; i++) { for (int j = 1; j < 105; j++) { for (int k = 1; k < 105; k++) { int t = i * i + j * j + k * k + i * j + j * k + k * i; if (t < 10050) v[t]++; }...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
150
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int main() { vector<int> a(1000000000); int n; cin >> n; for (int x = 1; x <= 100; x++) { for (int y = 1; y <= 100; y++) { for (int z = 1; z <= 100; z++) { a[x * x + y * y +...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int main() { vector<int> a(1000000); int n; cin >> n; for (int x = 1; x <= 100; x++) { for (int y = 1; y <= 100; y++) { for (int z = 1; z <= 100; z++) { a[x * x + y * y + z ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
143
int main() { int n, i, j, k; scanf("%d", &n); int m[n + 1]; for (i = 1; i <= n; i++) { m[i] = 0; } for (i = 1; i < 32; i++) { for (j = 1; j < 32; j++) { for (k = 1; k < 32; k++) { int s = i * i + j * j + k * k + i * j + j * k + k * i; if (s <= n) { m[s]++; } ...
int main() { int n, i, j, k; scanf("%d", &n); int m[n + 1]; for (i = 1; i <= n; i++) { m[i] = 0; } for (i = 1; i < 105; i++) { for (j = 1; j < 105; j++) { for (k = 1; k < 105; k++) { int s = i * i + j * j + k * k + i * j + j * k + k * i; if (s <= n) { m[s]++; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
0
169
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 2e5 + 10, mod = 1e9 + 7; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int ans[n + 1]; memset(ans, 0, sizeof(ans)); for (int i = 1; i <= 100; i+...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 2e5 + 10, mod = 1e9 + 7; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int ans[n + 1]; memset(ans, 0, sizeof(ans)); for (int i = 1; i <= 100; i+...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
214
#include <bits/stdc++.h> using namespace std; int main() { int N, x, y, z, cnt; cin >> N; int C[10010]; for (x = 1; x <= 100; x++) { for (y = 1; y <= 100; y++) { for (z = 1; (x * x + y * y + z * z + x * y + x * z + y * z) <= 10000; z++) { C[x * x + y * y + z * z + x * y + x * z + ...
#include <bits/stdc++.h> using namespace std; int main() { int N, x, y, z, cnt; cin >> N; int C[10100] = {}; for (x = 1; x <= 100; x++) { for (y = 1; y <= 100; y++) { for (z = 1; (x * x + y * y + z * z + x * y + x * z + y * z) <= 10010; z++) { C[x * x + y * y + z * z + x * y + x *...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
158
#include "bits/stdc++.h" using namespace std; // wierd debugging stuff #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( ...
#include "bits/stdc++.h" using namespace std; // wierd debugging stuff #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
753
#include <bits/stdc++.h> #include <sys/types.h> #include <unistd.h> #define _USE_MATH_DEFINES #define ll long long int using namespace std; // mp.reserve(1024); // mp.max_load_factor(0.25); bool sortit(const pair<ll, ll> &a, const pair<ll, ll> &b) { return (a.first - a.second > b.first - b.second); } int main() { ...
#include <bits/stdc++.h> #include <sys/types.h> #include <unistd.h> #define _USE_MATH_DEFINES #define ll long long int using namespace std; // mp.reserve(1024); // mp.max_load_factor(0.25); bool sortit(const pair<ll, ll> &a, const pair<ll, ll> &b) { return (a.first - a.second > b.first - b.second); } int main() { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
224
N = int(input()) cnt = [0] * 6 * 10000 + 1 for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): cnt[x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x] += 1 for i in range(1, N + 1): print(cnt[i])
N = int(input()) cnt = [0] * (6 * 10000 + 1) for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): cnt[x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x] += 1 for i in range(1, N + 1): print(cnt[i])
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]]
5
96
#include <cmath> #include <iostream> using namespace std; int main() { int n; cin >> n; int a[10000]; for (int i = 1; i <= 100; i++) { for (int j = 1; j <= 100; j++) { for (int k = 1; k <= 100; k++) { int l = pow(i, 2) + pow(j, 2) + pow(k, 2) + i * j + j * k + k * i; if (l < 10001) ...
#include <cmath> #include <iostream> using namespace std; int main() { int n; cin >> n; int a[10005] = {}; for (int i = 1; i <= 100; i++) { for (int j = 1; j <= 100; j++) { for (int k = 1; k <= 100; k++) { int l = pow(i, 2) + pow(j, 2) + pow(k, 2) + i * j + j * k + k * i; if (l < 10001...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
1
149
N=int(input()) a=[0]*10**4 for x in range(1,100): for y in range(1,100): for z in range(1,100): n=(x+y+z)**2-(x*y+y*z+z*x) if n<=10000: a[n-1]+=1 for n in range(1,N+1): print(a[n])
N=int(input()) a=[0]*10**4 for x in range(1,100): for y in range(1,100): for z in range(1,100): n=(x+y+z)**2-(x*y+y*z+z*x) if n<=10000: a[n-1]+=1 for n in range(N): print(a[n])
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
104
#include "math.h" #include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; int t; const int N = 10001; int arr[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); for (int i = 0...
#include "math.h" #include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; int t; const int N = 10001; int arr[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); for (int i = 0...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
206
#include "math.h" #include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; int t; const int N = 1000; int arr[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); for (int i = 0...
#include "math.h" #include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; int t; const int N = 10001; int arr[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); for (int i = ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 31, 13], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 31, 13], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 31, 13]]
1
291
#include <bits/stdc++.h> #include <string.h> #define pb push_back #define all(v) v.rbegin(), v.rend() #define see(x) cout << #x << " : " << (x) << endl; #define ya cout << "YES" << endl; #define no cout << "NO" << endl; #define ff first #define sc second #define pi 3.14159265359 typedef long long ll; using namespace st...
#include <bits/stdc++.h> #include <string.h> #define pb push_back #define all(v) v.rbegin(), v.rend() #define see(x) cout << #x << " : " << (x) << endl; #define ya cout << "YES" << endl; #define no cout << "NO" << endl; #define ff first #define sc second #define pi 3.14159265359 typedef long long ll; using namespace st...
[["-", 8, 9, 0, 7, 8, 7, 10, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 7, 10, 11, 12, 13], ["-", 0, 7, 8, 7, 8, 7, 10, 11, 12, 22], ["+", 0, 7, 8, 7, 8, 7, 10, 11, 12, 13]]
1
214
#include <iostream> #include <vector> using namespace std; int main(void) { int n; cin >> n; vector<int> ans(10001); for (int x = 1; x <= 100; x++) { for (int y = 1; y <= 100; y++) { for (int z = 1; z <= 100; z++) { int s = x * x + y * y + z * z; s += x * y + y * z + z * x; if...
#include <iostream> #include <vector> using namespace std; int main(void) { int n; cin >> n; vector<int> ans(10001); for (int x = 1; x <= 100; x++) { for (int y = 1; y <= 100; y++) { for (int z = 1; z <= 100; z++) { int s = x * x + y * y + z * z; s += x * y + y * z + z * x; if...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
148
#include <bits/stdc++.h> #include <iostream> using namespace std; #define int long long #define double long double #define endl "\n" #define pb push_back #define PI 3.1415926535897932384626433832795l #define F first #define S second #define mp make_pair #define f(i, n) for (int i = 0; i < n; i++) #define fastio ...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define int long long #define double long double #define endl "\n" #define pb push_back #define PI 3.1415926535897932384626433832795l #define F first #define S second #define mp make_pair #define f(i, n) for (int i = 0; i < n; i++) #define fastio ...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13]]
1
1,331
n = gets.to_i ans = Array.new(10**4 + 1, 0) ## x <= y <= zとする。 max_x = Math.sqrt(n/6).to_i max_y = Math.sqrt(n/3).to_i max_z = Math.sqrt(n).to_i (1..max_x).each do |x| (x..max_y).each do |y| (y..max_z).each do |z| result = x**2 + y**2 + z**2 + x*y + y*z + z*x break if result > n if x != y && y ...
n = gets.to_i ans = Array.new(10**4 + 1, 0) ## x <= y <= zとする。 max_x = Math.sqrt(n/6).to_i max_y = Math.sqrt(n/3).to_i max_z = Math.sqrt(n).to_i (1..max_x).each do |x| (x..max_y).each do |y| (y..max_z).each do |z| result = x**2 + y**2 + z**2 + x*y + y*z + z*x break if result > n if x != y && y ...
[["-", 0, 121, 75, 759, 75, 95, 0, 662, 12, 612], ["+", 0, 121, 75, 759, 75, 95, 0, 662, 12, 612]]
4
183
n = gets.to_i ans = Array.new(n+1, 0) ## x <= y <= zとする。 max_x = Math.sqrt(n/6).to_i + 1 max_y = Math.sqrt(n/3).to_i + 1 max_z = Math.sqrt(n).to_i + 1 (1..max_x).each do |x| (x..max_y).each do |y| (y..max_z).each do |z| result = x**2 + y**2 + z**2 + x*y + y*z + z*x if x == y && x == z plus_...
n = gets.to_i ans = Array.new(10**5, 0) ## x <= y <= zとする。 max_x = Math.sqrt(n/6).to_i + 1 max_y = Math.sqrt(n/3).to_i + 1 max_z = Math.sqrt(n).to_i + 1 (1..max_x).each do |x| (x..max_y).each do |y| (y..max_z).each do |z| result = x**2 + y**2 + z**2 + x*y + y*z + z*x if x == y && x == z plu...
[["-", 0, 662, 12, 652, 3, 4, 0, 738, 31, 22], ["-", 0, 662, 12, 652, 3, 4, 0, 738, 17, 72], ["-", 0, 662, 12, 652, 3, 4, 0, 738, 12, 612], ["+", 0, 662, 12, 652, 3, 4, 0, 738, 31, 612], ["+", 0, 662, 12, 652, 3, 4, 0, 738, 17, 578], ["+", 0, 662, 12, 652, 3, 4, 0, 738, 12, 612]]
4
173
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; #define int ll const ll mod = 1e9 + 7; int n; int ans[1001]; main() { cin >> n; for (int x = 1; x <= 101; x++) { for (int y = 1; y <= 101; y++) { for (int z = 1; z <= 101; z++) { int t = x * x + y ...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; #define int ll const ll mod = 1e9 + 7; int n; int ans[10001]; main() { cin >> n; for (int x = 1; x <= 101; x++) { for (int y = 1; y <= 101; y++) { for (int z = 1; z <= 101; z++) { int t = x * x + y...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
164
package main import ( "fmt" ) func main() { var N int fmt.Scan(&N) a := make([]int, 10010) for x := 1; x <= 100; x++ { for y := 1; y <= 100; y++ { for z := 1; z <= 100; z++ { v := x*x + y*y + z*z + x*y + y*z + z*x if v <= 10000 { a[v]++ } } } } for i := 0; i < N; i++ { fmt.Println(...
package main import ( "fmt" ) func main() { var N int fmt.Scan(&N) a := make([]int, 10010) for x := 1; x <= 100; x++ { for y := 1; y <= 100; y++ { for z := 1; z <= 100; z++ { v := x*x + y*y + z*z + x*y + y*z + z*x if v <= 10000 { a[v]++ } } } } for i := 1; i <= N; i++ { fmt.Println...
[["-", 0, 7, 0, 430, 10, 431, 12, 432, 0, 433], ["+", 0, 7, 0, 430, 10, 431, 12, 432, 0, 433], ["-", 8, 196, 0, 7, 0, 430, 15, 16, 17, 18], ["+", 8, 196, 0, 7, 0, 430, 15, 16, 17, 19]]
7
146
#include <bits/stdc++.h> using namespace std; int main() { int N; vector<int> igarashi(N); for (int i = 1; i < sqrt(N); i++) { for (int j = 1; j < sqrt(N); j++) { for (int k = 1; k < sqrt(N); k++) { int kyoko = i * i + j * j + k * k + i * j + j * k + k * i; if (kyoko <= N) { ...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> igarashi(N); for (int i = 1; i < sqrt(N); i++) { for (int j = 1; j < sqrt(N); j++) { for (int k = 1; k < sqrt(N); k++) { int kyoko = i * i + j * j + k * k + i * j + j * k + k * i; if (kyoko <= N) ...
[["+", 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
153
n = int(input()) cnt = [0] * 10001 for i in range(1, 100): for j in range(1, 100): for k in range(1, 100): x = i*i + j*j + k*k + i*j + j*k + i*k if(x <= 1000): cnt[x]+=1 for i in range(1, n+1): print(cnt[i])
n = int(input()) cnt = [0] * 10001 for i in range(1, 100): for j in range(1, 100): for k in range(1, 100): x = i*i + j*j + k*k + i*j + j*k + i*k if(x <= 10000): cnt[x]+=1 for i in range(1, n+1): print(cnt[i])
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 0, 612]]
5
102
#include "bits/stdc++.h" using namespace std; typedef long double ld; #define int long long typedef pair<int, int> pii; #define RAGE \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include "bits/stdc++.h" using namespace std; typedef long double ld; #define int long long typedef pair<int, int> pii; #define RAGE \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
595
N = int(input()) ans = [0]*((10**4)+1) for x in range(1,101): for y in range(1,101): for z in range(1,101): num = x * x + y * y + z * z + x * y + y * z + z * x if num <= N: ans[num] = ans[num] + 1 for i in range(N+1): print(ans[i])
N = int(input()) ans = [0]*((10**4)+1) for x in range(1,101): for y in range(1,101): for z in range(1,101): num = x * x + y * y + z * z + x * y + y * z + z * x if num <= N: ans[num] = ans[num] + 1 for i in range(N): print(ans[i+1])
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
111
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpii; typedef vector<pll> vpll; #de...
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpii; typedef vector<pll> vpll; #de...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0...
1
358
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> ans(N + 1); for (int x = 1; x <= 100; x++) { for (int y = 1; y <= 100; y++) { for (int z = 1; z <= 100; z++) { int s = x * x + y * y + z * z + x * y + y * z + z * x; if (s > N) { continu...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> ans(N + 1); for (int x = 1; x <= 100; x++) { for (int y = 1; y <= 100; y++) { for (int z = 1; z <= 100; z++) { int s = x * x + y * y + z * z + x * y + y * z + z * x; if (s > N) { continu...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
149
N = int(input()) ans = [0 for _ in range(10050)] for i in range(1,105): for j in range(1,105): for k in range(1,105): v = i*i + j*j + k*k + k*j + i*k + i*j if v < 10050: ans[v] += 1 for i in range(N): print(ans[i])
N = int(input()) ans = [0 for _ in range(10050)] for i in range(1,105): for j in range(1,105): for k in range(1,105): v = i*i + j*j + k*k + k*j + i*k + i*j if v < 10050: ans[v] += 1 for i in range(N): print(ans[i+1])
[["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
101
#include <iostream> namespace NS20200711Acing { class XYZtriplets final { public: XYZtriplets() = default; ~XYZtriplets() = default; public: void Run() { Input(); Calc(); Output(); } void Input() { std::cin >> m_N; } void Calc() { int max_k = 0; for (int i = 1; i < m_N; ++i) { ...
#include <iostream> namespace NS20200711Acing { class XYZtriplets final { public: XYZtriplets() = default; ~XYZtriplets() = default; public: void Run() { Input(); Calc(); Output(); } void Input() { std::cin >> m_N; } void Calc() { int max_k = 0; for (int i = 1; i < m_N; ++i) { ...
[["-", 8, 201, 0, 353, 8, 123, 0, 124, 365, 13], ["+", 8, 201, 0, 353, 8, 123, 0, 124, 365, 13]]
1
313
import math n = int(input()) max = int(math.sqrt(n) + 1) L = [0] * (n + 1) for x in range(1, max): for y in range(1, max): for z in range(1, max): tmp = x * x + y * y + z * z + x * y + y * z + z * x if tmp > n: continue L[tmp] += 1 for i in range(1, n): ...
import math n = int(input()) max = int(math.sqrt(n) + 1) L = [0] * (n + 1) for x in range(1, max): for y in range(1, max): for z in range(1, max): tmp = x * x + y * y + z * z + x * y + y * z + z * x if tmp > n: continue L[tmp] += 1 for i in range(1, n + ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
118
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; int main() { int n; cin >> n; vector<int> ans(n + 1, 0); for (int x = 1; x <= 100; x++) { for (int y = 1; y <= 100; y++) { for (int z = 1; z <= 100; z++) { int sum = x * x + y * y + z * z + x * y + y * ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; int main() { int n; cin >> n; vector<int> ans(1e5, 0); for (int x = 1; x <= 100; x++) { for (int y = 1; y <= 100; y++) { for (int z = 1; z <= 100; z++) { int sum = x * x + y * y + z * z + x * y + y * z ...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
152
#!/usr/bin/env python n = int(input()) given_a = list(map(int, input().split())) a = [] for k in given_a: if len(a) > 0 and a[-1] == k: continue else: a.append(k) money = 1000 kabu = 0 n = len(a) if n == 1: print(money) exit() for i in range(n): if n == 0: if a[i] > a[i...
#!/usr/bin/env python n = int(input()) given_a = list(map(int, input().split())) a = [] for k in given_a: if len(a) > 0 and a[-1] == k: continue else: a.append(k) money = 1000 kabu = 0 n = len(a) if n == 1: print(money) exit() for i in range(n): if i == 0: if a[i] > a[i...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
226
#include <algorithm> #include <iomanip> // std::setprecision() #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; #define rep(i, a, b) for (ll i = (a); i < (b); i++) #define YES cout << "YES" << endl; #d...
#include <algorithm> #include <iomanip> // std::setprecision() #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; #define rep(i, a, b) for (ll i = (a); i < (b); i++) #define YES cout << "YES" << endl; #d...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13]]
1
274
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; const int MOD = 1e9 + 7; const ll LINF = 1e18; int main() { ll n; cin >> n; vector<ll> a(n); for (ll i = 0; i < n; ++i) { cin >> a[i]; } ll ans = 1000; ll kabu = 0; for (ll i = 0; i < n - 1; ++i) { if (...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; const int MOD = 1e9 + 7; const ll LINF = 1e18; int main() { ll n; cin >> n; vector<ll> a(n); for (ll i = 0; i < n; ++i) { cin >> a[i]; } ll ans = 1000; ll kabu = 0; for (ll i = 0; i < n - 1; ++i) { if (...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
207
def main(): N = int(input()) *A, = map(int, input().split()) dp = [0] * (N + 1) dp[0] = 1000 for i, a in enumerate(A): dp[i + 1] = dp[i] for j in range(i): buy, rest = divmod(dp[j], A[j]) dp[i + 1] = max(dp[i], buy * A[i] + rest) print(dp[-1]) if __na...
def main(): N = int(input()) *A, = map(int, input().split()) dp = [0] * (N + 1) dp[0] = 1000 for i, a in enumerate(A): dp[i + 1] = dp[i] for j in range(i): buy, rest = divmod(dp[j], A[j]) dp[i + 1] = max(dp[i + 1], buy * a + rest) print(dp[-1]) if __n...
[["+", 12, 652, 3, 4, 0, 206, 206, 657, 17, 72], ["+", 12, 652, 3, 4, 0, 206, 206, 657, 12, 612], ["-", 3, 4, 0, 657, 31, 657, 12, 206, 51, 22], ["-", 3, 4, 0, 657, 31, 657, 12, 206, 0, 70], ["-", 3, 4, 0, 657, 31, 657, 12, 206, 206, 22], ["-", 3, 4, 0, 657, 31, 657, 12, 206, 0, 73], ["+", 12, 652, 3, 4, 0, 657, 31, 65...
5
132
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "trace.h" #else #define trace(args...) #endif using ll = long long; using ld = long double; using pii = pair<int, int>; using vi = vector<int>; #define mp make_pair #define ub upper_bound #define lb lower_bound #define fi first #define se second #defi...
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "trace.h" #else #define trace(args...) #endif using ll = long long; using ld = long double; using pii = pair<int, int>; using vi = vector<int>; #define mp make_pair #define ub upper_bound #define lb lower_bound #define fi first #define se second #defi...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
195
n=int(input()) a=list(map(int, input().split())) mon=1000 kai=0 for i in range(n-1): if a[i]>a[i+1]: mon+=kai*a[i] kai=0 elif a[i]<a[i+1]: kai=int(mon/a[i]) mon-=kai*a[i] mon+=kai*a[n-1] print(mon)
n=int(input()) a=list(map(int, input().split())) mon=1000 kai=0 for i in range(n-1): if a[i]>a[i+1]: mon+=kai*a[i] kai=0 elif a[i]<a[i+1] and kai==0: kai=int(mon/a[i]) mon-=kai*a[i] mon+=kai*a[n-1] print(mon)
[["+", 8, 196, 0, 57, 75, 665, 15, 679, 17, 355], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 0, 22], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 667, 60], ["+", 0, 57, 75, 665, 15, 679, 12, 666, 0, 612]]
5
111
#include <bits/stdc++.h> using namespace std; int main(void) { int stock = 0, money = 1000, n, a[80]; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) { if (a[i] < a[i + 1]) { // buy all stock = money / a[i]; money %= a[i]; } else if (a[i] > a[i +...
#include <bits/stdc++.h> using namespace std; int main(void) { long long int stock = 0, money = 1000, n, a[80]; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) { if (a[i] < a[i + 1]) { // buy all stock += money / a[i]; money %= a[i]; } else if (a...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]]
1
161
N = int(input()) A = list(map(int, input().split())) money = 1000 kabu = 0 for i in range(N-1): if kabu > 0: money += kabu*A[i] kabu = 0 elif A[i] < A[i+1]: kabu = money//A[i] money -= kabu*A[i] if kabu > 0: money += kabu*A[-1] print(money)
N = int(input()) A = list(map(int, input().split())) money = 1000 kabu = 0 for i in range(N-1): if kabu > 0: money += kabu*A[i] kabu = 0 if A[i] < A[i+1]: kabu = money//A[i] money -= kabu*A[i] if kabu > 0: money += kabu*A[-1] print(money)
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
104
n = int(input()) a = list(map(int, input())) money = 1000 for i in range(n-1): if a[i] < a[i+1]: money += (a[i+1]-a[i]) * (money//a[i]) print(money)
n = int(input()) a = list(map(int, input().split())) money = 1000 for i in range(n-1): if a[i] < a[i+1]: money += (a[i+1]-a[i]) * (money//a[i]) print(money)
[["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
75
#include <bits/stdc++.h> using namespace std; #define int long long // #define double long double #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORR(i, a, b) for (int i = (a); i > (b); --i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOREACH(x...
#include <bits/stdc++.h> using namespace std; #define int long long // #define double long double #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORR(i, a, b) for (int i = (a); i > (b); --i) #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOREACH(x...
[["+", 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
967
n = int(input()) a = list(map(int, input().split())) for i in range(n-1): if a[i] < a[i+1]: money += (a[i+1]-a[i])*(money//a[i]) print(money)
n = int(input()) a = list(map(int, input().split())) money = 1000 for i in range(n-1): if a[i] < a[i+1]: money += (a[i+1]-a[i])*(money//a[i]) print(money)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
76
n = int(input()) a = list(map(int,input().split())) money = 1000 kabu = 0 for i in range(n-1): if kabu==0: if a[i]<a[i+1]: kabu += money//a[i] money %= a[i] else: if a[i]>a[i+1]: money = kabu*a[i] kabu = 0 print(money+kabu*a[-1])
n = int(input()) a = list(map(int,input().split())) money = 1000 kabu = 0 for i in range(n-1): if kabu==0: if a[i]<=a[i+1]: kabu += money//a[i] money %= a[i] else: if a[i]>a[i+1]: money += kabu*a[i] kabu = 0 print(money+kabu*a[-1])
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 19], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107]]
5
111
N = int(input()) A = list(map(int, input().split())) money = 1000 stock = 0 for day in range(N): if day == N - 1: money += stock * A[day] stock = 0 elif A[day] == A[day+1]: continue elif A[day] < A[day+1]: stock = money // A[day] money = money % A[day] elif A[day...
N = int(input()) A = list(map(int, input().split())) money = 1000 stock = 0 for day in range(N): if day == N - 1: money += stock * A[day] stock = 0 elif A[day] == A[day+1]: continue elif A[day] < A[day+1]: stock += money // A[day] money = money % A[day] elif A[da...
[["-", 75, 665, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 17, 107]]
5
128
#include <iostream> #include <stdio.h> //#include <bits/stdc++.h> #include <algorithm> #include <cassert> #include <cmath> #include <cstdint> #include <cstring> #include <float.h> #include <iomanip> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> ...
#include <iostream> #include <stdio.h> //#include <bits/stdc++.h> #include <algorithm> #include <cassert> #include <cmath> #include <cstdint> #include <cstring> #include <float.h> #include <iomanip> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 73]]
1
261
n = int(input()) a = list(map(int, input().split())) kane = 1000 kabu = 0 if a[0] < a[1]: kabu = kane // a[0] kane %= kabu for i in range(1, n - 1): if a[i - 1] < a[i]: kane += a[i] * kabu kabu = 0 if a[i] < a[i + 1]: kabu = kane // a[i] kane %= a[i] kane += a[n - 1] * k...
n = int(input()) a = list(map(int, input().split())) kane = 1000 kabu = 0 if a[0] < a[1]: kabu = kane // a[0] kane %= a[0] for i in range(1, n - 1): if a[i - 1] < a[i]: kane += a[i] * kabu kabu = 0 if a[i] < a[i + 1]: kabu = kane // a[i] kane %= a[i] kane += a[n - 1] * k...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 0, 70], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 206, 612], ["+", 64, 196, 0, 1, 0, 677, 12, 206, 0, 73]]
5
130
import sys def input(): return sys.stdin.readline()[:-1] def main(): N = int(input()) A = list(map(int,input().split())) zougen = [-1 if A[i] > A[i + 1] else 1 for i in range(N - 1)] print(zougen) money = 1000 kabu = 0 for i in range(N-1): if zougen[i] == 1: kabu +=...
import sys def input(): return sys.stdin.readline()[:-1] def main(): N = int(input()) A = list(map(int,input().split())) zougen = [-1 if A[i] > A[i + 1] else 1 for i in range(N - 1)] money = 1000 kabu = 0 for i in range(N-1): if zougen[i] == 1: kabu += money // A[i] ...
[["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
158
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a(n); vector<int> aa(n - 1); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i++) { if (a[i + 1] > a[i]) { aa[i] = 1; } else if (a[i + 1] == a[i]) { aa[i...
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a(n); vector<int> aa(n - 1); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i++) { if (a[i + 1] > a[i]) { aa[i] = 1; } else if (a[i + 1] == a[i]) { aa[i...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]]
1
246
#include <stdio.h> int main(void) { int N, i; long long K = 0; long long M = 1000; scanf("%d", &N); int A[N]; for (i = 0; i < N; i++) { scanf("%d", &A[i]); } for (i = 0; i < N - 1; i++) { if (A[i] < A[i + 1]) { K = M / A[i]; M = M % A[i]; } if (A[i] > A[i + 1]) { M = ...
#include <stdio.h> int main(void) { int N, i; long long K = 0; long long M = 1000; scanf("%d", &N); int A[N]; for (i = 0; i < N; i++) { scanf("%d", &A[i]); } for (i = 0; i < N - 1; i++) { if (A[i] < A[i + 1]) { K = K + M / A[i]; M = M % A[i]; } if (A[i] > A[i + 1]) { ...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
173
#include <bits/stdc++.h> using namespace std; #define ll long long const char newl = '\n'; //***---***---***---Useless Code---***---***---***// template <class T> void read(T &t) { cin >> t; } template <class A, class... B> void read(A &a, B &...b) { read(a); read(b...); } template <class T> void read(vector<T> ...
#include <bits/stdc++.h> using namespace std; #define ll long long const char newl = '\n'; //***---***---***---Useless Code---***---***---***// template <class T> void read(T &t) { cin >> t; } template <class A, class... B> void read(A &a, B &...b) { read(a); read(b...); } template <class T> void read(vector<T> ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
532
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() vector<int> dx = {-1, -1, -1, 0, 0, 1, 1, 1}; vector<int> dy = {-1, 0, 1, -1, 1, -...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() vector<int> dx = {-1, -1, -1, 0, 0, 1, 1, 1}; vector<int> dy = {-1, 0, 1, -1, 1, -...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47]]
1
353
ni = lambda: int(input()) nm = lambda: map(int, input().split()) nl = lambda: list(map(int, input().split())) n = ni() a = nl() dp=[0]*(n+1) dp[0] = 1000 for i in range(1,n): dp[i]=dp[i-1] for j in range(i-1): v = dp[j] // a[j] w = dp[j] + (a[i]-a[j])*v dp[i] = max(dp[i],w) print(dp[n-1])
ni = lambda: int(input()) nm = lambda: map(int, input().split()) nl = lambda: list(map(int, input().split())) n = ni() a = nl() dp=[0]*(n+1) dp[0] = 1000 for i in range(1,n): dp[i]=dp[i-1] for j in range(i): v = dp[j] // a[j] w = dp[j] + (a[i]-a[j])*v dp[i] = max(dp[i],w) print(dp[n-1])
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
157
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; using namespace std; using P = pair<int, int>; int main() { int m = 1000; int n; cin >> n; vector<int> a(n); for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i <= n - 1; i++) { ll s = 0; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; using namespace std; using P = pair<int, int>; int main() { ll m = 1000; ll n; cin >> n; vector<ll> a(87); for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i <= n - 1; i++) { ll s = 0; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
153
#include <bits/stdc++.h> #include <cctype> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define ld long double #define PRY cout << "YES\n" #define PRN cout << "NO\n" #define SETP(sp) fixed << setprecision(sp) #define PB push_back #define GO ...
#include <bits/stdc++.h> #include <cctype> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define ld long double #define PRY cout << "YES\n" #define PRN cout << "NO\n" #define SETP(sp) fixed << setprecision(sp) #define PB push_back #define GO ...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72]]
1
324
N = int(intput()) stocks = list(map(int, input().split())) curr = 1000 for i in range(N - 1): cnt = 0 if stocks[i] < stocks[i + 1]: cnt = curr // stocks[i] curr += cnt * (stocks[i + 1] - stocks[i]) print(curr)
N = int(input()) stocks = list(map(int, input().split())) curr = 1000 for i in range(N - 1): cnt = 0 if stocks[i] < stocks[i + 1]: cnt = curr // stocks[i] curr += cnt * (stocks[i + 1] - stocks[i]) print(curr)
[["-", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22]]
5
83
n = int(input()) arr = list(map(int,input().split())) cur=1000 for i in range(n-1): p=0 if arr[i] < arr[i+1]: p=cur // a[i] cur += (arr[i+1] - arr[i])*cur print(cur)
n = int(input()) arr = list(map(int,input().split())) cur=1000 for i in range(n-1): p=0 if arr[i] < arr[i+1]: p=cur // arr[i] cur += (arr[i+1] - arr[i])*p print(cur)
[["-", 0, 1, 0, 662, 12, 657, 12, 206, 51, 22], ["+", 0, 1, 0, 662, 12, 657, 12, 206, 51, 22], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22]]
5
83
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> using namespace std; int main() { int n; int t[101]; long long sum = 1000; long long f; scanf("%d %d", &n); for (int i = 1; i <= n; i++) scanf("%d", &t[i]); for (int i = 1; i < n; i++) { ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> using namespace std; int main() { int n; int t[101]; long long sum = 1000; long long f; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &t[i]); for (int i = 1; i < n; i++) { ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
152
#include <bits/stdc++.h> using namespace std; #define ii(i, start, end, inc) for (int i = start; i < end; i += inc) #define dd(i, start, end, inc) for (int i = start; i > end; i -= inc) #define zz(i, n) for (int i = 0; i < n; ++i) #define pb push_back #define BHAAG ios_base::sync_with_stdio(false), cin.tie(0), cout.ti...
#include <bits/stdc++.h> using namespace std; #define ii(i, start, end, inc) for (int i = start; i < end; i += inc) #define dd(i, start, end, inc) for (int i = start; i > end; i -= inc) #define zz(i, n) for (int i = 0; i < n; ++i) #define pb push_back #define BHAAG ios_base::sync_with_stdio(false), cin.tie(0), cout.ti...
[["+", 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
468
N = int(input()) A = list(map(int, input().split())) money = 1000 for i in range(N): t = money + (A[i + 1] - A[i]) * (money // A[i]) money = max(money, t) print(money)
N = int(input()) A = list(map(int, input().split())) money = 1000 for i in range(N-1): t = money + (A[i + 1] - A[i]) * (money // A[i]) money = max(money, t) print(money)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
74
N = int(input()) A = list(map(int, input().split())) dp = [0] * 1000 dp[0] = 1000 for i in range(1, N): dp[i] = dp[i - 1] for j in range(i): kabu = dp[j] // A[j] money = dp[j] + (A[i] - A[j]) * kabu dp[i] = max(dp[i], money) print(dp[-1])
N = int(input()) A = list(map(int, input().split())) dp = [0] * N dp[0] = 1000 for i in range(1, N): dp[i] = dp[i - 1] for j in range(i): kabu = dp[j] // A[j] money = dp[j] + (A[i] - A[j]) * kabu dp[i] = max(dp[i], money) print(dp[-1])
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
120
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll n; cin >> n; vector<ll> a(n); ll ans = 1000; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) { ll s = 0; if (a[i] < a[i + 1]) s = ans / a[i]; ans += (a[i + 1] - a[i]) * s; } c...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll n; cin >> n; vector<ll> a(n); ll ans = 1000; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n - 1; ++i) { ll s = 0; if (a[i] < a[i + 1]) s = ans / a[i]; ans += (a[i + 1] - a[i]) * s; }...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
131
//---Vaidik Patel---// //-------------------Proud to be Indian--------------------------------// #include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set,multi multimap, map etc. #include <ext/pb_ds/tree_policy.hpp> //...
//---Vaidik Patel---// //-------------------Proud to be Indian--------------------------------// #include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set,multi multimap, map etc. #include <ext/pb_ds/tree_policy.hpp> //...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 26, 11, 17, 107], ["-", 0, 14, 8, 9, 0, 7, 26, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29]]
1
517
N = int(input()) A = list(map(int, input().split())) money = 1000 cnt = 0 if A[0] < A[1]: cnt += 1000 // A[0] money -= cnt * A[0] for i in range(1, N-1): if A[i] <= A[i - 1] and A[i] < A[i + 1]: cnt += money // A[i] money -= cnt * A[i] elif A[i] >= A[i-1] and A[i] > A[i + 1]: mon...
N = int(input()) A = list(map(int, input().split())) money = 1000 cnt = 0 if A[0] < A[1]: cnt += 1000 // A[0] money = money % A[0] for i in range(1, N-1): if A[i] <= A[i - 1] and A[i] < A[i + 1]: cnt += money // A[i] money = money % A[i] elif A[i] >= A[i-1] and A[i] > A[i + 1]: m...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110], ["-", 64, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["-", 64, 196, 0, 1, 0, 677, 12, 657, 17, 48], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, ...
5
169
#include <bits/stdc++.h> #include <iomanip> #define fast \ { \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> #include <iomanip> #define fast \ { \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
157
#include <bits/stdc++.h> #pragma GCC optimize("unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define watch(x) cout << (#x) << " is " << (x) << endl #define debug cout << "hi" << endl using namespace std; typedef long long ll; typedef long double ld; typedef ...
#include <bits/stdc++.h> #pragma GCC optimize("unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define watch(x) cout << (#x) << " is " << (x) << endl #define debug cout << "hi" << endl using namespace std; typedef long long ll; typedef long double ld; typedef ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
219
#include <bits/stdc++.h> using namespace std; int main() { int n; vector<int> nos(n + 1, 0); for (int x = 1; x <= 100; x++) for (int y = 1; y <= 100; y++) for (int z = 1; z <= 100; z++) { int val = x * x + y * y + z * z + x * y + x * z + y * z; if (val > n) continue; el...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> nos(n + 1, 0); for (int x = 1; x <= 100; x++) for (int y = 1; y <= 100; y++) for (int z = 1; z <= 100; z++) { int val = x * x + y * y + z * z + x * y + x * z + y * z; if (val > n) continue...
[["+", 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
140
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int64_t> f(N); for (int i = 0; i < N; i++) { f.at(i) = 0; } for (int j = 1; j < 101; j++) { for (int k = 1; k < 101; k++) { for (int l = 1; l < 101; l+...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int64_t> f(N); for (int i = 0; i < N; i++) { f.at(i) = 0; } for (int j = 1; j < 101; j++) { for (int k = 1; k < 101; k++) { for (int l = 1; l < 101; l+...
[["+", 0, 11, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 31, 2, 3, 4, 0, 16, 12, 13], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
224
#include <bits/stdc++.h> using namespace std; int main() { int N = 10010; vector<int> vec(N); int n; cin >> n; for (int i = 1; i * i < N; i++) { for (int j = 1; j * j < N; j++) { for (int k = 1; k * k < N; k++) { int a = i * i + j * j + k * k; int b = i * j + j * k + k * i; ...
#include <bits/stdc++.h> using namespace std; int main() { int N = 10010; vector<int> vec(N); int n; cin >> n; for (int i = 1; i * i < N; i++) { for (int j = 1; j * j < N; j++) { for (int k = 1; k * k < N; k++) { int a = i * i + j * j + k * k; int b = i * j + j * k + k * i; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
166
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, x, n) for (int i = x; i < (n); i++) #define ALL(n) begin(n), end(n) #define MOD (1000000007) #define INF (1e9) #define INFL (1e18) typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, x, n) for (int i = x; i < (n); i++) #define ALL(n) begin(n), end(n) #define MOD (1000000007) #define INF (1e9) #define INFL (1e18) typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
815
# -*- coding: utf-8 -*- # スペース区切りの整数の入力 N = int(input()) Ans = 0 numlist = [0] * 10000 if int(float(N)**0.5) <= 1: rMax = 1 else: rMax = int(float(N)**0.5) for x in range(1,rMax+1): for y in range(1,rMax+1): for z in range(1,rMax+1): Ans = x**2 + y**2 + z**2 + (x * y) + (y * z) + (z * x) if A...
# -*- coding: utf-8 -*- # スペース区切りの整数の入力 N = int(input()) Ans = 0 numlist = [0] * 10001 if int(float(N)**0.5) <= 1: rMax = 1 else: rMax = int(float(N)**0.5) for x in range(1,rMax+1): for y in range(1,rMax+1): for z in range(1,rMax+1): Ans = x**2 + y**2 + z**2 + (x * y) + (y * z) + (z * x) if A...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
146
#include <bits/stdc++.h> #define rep(i, n) for (int i = (0); i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define limit(...
#include <bits/stdc++.h> #define rep(i, n) for (int i = (0); i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define limit(...
[["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 31, 22]]
1
869
#include <bits/stdc++.h> #define rep(i, a) for (int i = 1; i < a; i++) // iは1////////////////// #define all(v) v.begin(), v.end() #define dcout cout << fixed << setprecision(15) #define arep(i, a) for (auto i : a) #define F first #define S second #define VE vector<int> #define pb(x) push_back(x) #define MOD 1000000007 ...
#include <bits/stdc++.h> #define rep(i, a) for (int i = 1; i < a; i++) // iは1////////////////// #define all(v) v.begin(), v.end() #define dcout cout << fixed << setprecision(15) #define arep(i, a) for (auto i : a) #define F first #define S second #define VE vector<int> #define pb(x) push_back(x) #define MOD 1000000007 ...
[["-", 31, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 22]]
1
166
n = int(input()) cont = [0 for i in range(10050)] for x in range(1,105): for y in range(1,105): for z in range(1,105): v = x**2 + y**2 + z**2 + z*x + y*z + x*y if v <= 10001: cont[v]+=1 for i in range(1,n): print(cont[i])
n = int(input()) cont = [0 for i in range(10050)] for x in range(1,105): for y in range(1,105): for z in range(1,105): v = x**2 + y**2 + z**2 + z*x + y*z + x*y if v <= 10001: cont[v]+=1 for i in range(1,n+1): print(cont[i])
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
103
n = int(input()) cnt = [0 for i in range(10001)] for x in range(1,101): for y in range(1, 105): for z in range(1, 105): ans = x**2 + y**2 + z**2 + x*y + y*z + z*x if ans <= 10000: cnt[ans] +=1 for i in range(1, N+1): print(cnt[i])
n = int(input()) cnt = [0 for i in range(10001)] for x in range(1,101): for y in range(1, 105): for z in range(1, 105): ans = x**2 + y**2 + z**2 + x*y + y*z + z*x if ans <= 10000: cnt[ans] +=1 for i in range(1,n+1): print(cnt[i])
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
105
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n + 1); for (int i = 1; i < 102; i++) for (int j = 1; j < 102; j++) for (int k = 1; k < 102; k++) { int s; s = i * i + j * j + k * k + i * j + j * k + k * i; if (s < n + 1) a.a...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n + 1); for (int i = 1; i < 102; i++) for (int j = 1; j < 102; j++) for (int k = 1; k < 102; k++) { int s; s = i * i + j * j + k * k + i * j + j * k + k * i; if (s < n + 1) a.a...
[["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
148
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; #define REP(i, n) for (ll i = 0; i < (n); ++i) #define RREP(i, n) for (ll i = (n)-1; i >= 0; --i) #define ALL(v) (v).begin(), (v).end() template <class T> using reverse_priority_queue = priority_queue<T, vector<T>, great...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; #define REP(i, n) for (ll i = 0; i < (n); ++i) #define RREP(i, n) for (ll i = (n)-1; i >= 0; --i) #define ALL(v) (v).begin(), (v).end() template <class T> using reverse_priority_queue = priority_queue<T, vector<T>, great...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
209
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int f(int x, int y, int z) { return (x * x + y * y + z * z + x * y + y * z + z * x); } int main() { int n; cin >> n; int max = 100; int nt = 0; int ans[n] = {}; for (int x = 1; x <= max; x++) { for (int y ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int f(int x, int y, int z) { return (x * x + y * y + z * z + x * y + y * z + z * x); } int main() { int n; cin >> n; int max = 100; int nt = 0; int ans[n + 1] = {}; for (int x = 1; x <= max; x++) { for (in...
[["+", 0, 43, 49, 50, 49, 80, 81, 16, 17, 72], ["+", 0, 43, 49, 50, 49, 80, 81, 16, 12, 13]]
1
183
N=int(input()) ans=[0 for _ in range(10050)] for x in range(1,100): for y in range(1,100): for z in range(1,100): v=x**2+y**2+z**2+x*y+y*z+z*x if v<10050: ans[v]+=1 for i in range(N): print(ans[i])
N=int(input()) ans=[0 for _ in range(10050)] for x in range(1,105): for y in range(1,105): for z in range(1,105): v=x**2+y**2+z**2+x*y+y*z+z*x if v<10050: ans[v]+=1 for i in range(N): print(ans[i+1])
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
101
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int N = sc.nextInt(); int re[] = new int[10050]; Arrays.fill(re, 0); for (int x = 1; x < 105; x++) { for (int y = 1; y < 105; y++) { for (int z = 1; z < 105; z...
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int N = sc.nextInt(); int re[] = new int[10050]; Arrays.fill(re, 0); for (int x = 1; x < 105; x++) { for (int y = 1; y < 105; y++) { for (int z = 1; z < 105; z...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
3
180
import sys import itertools as itr readline = sys.stdin.buffer.readline N=int(readline()) n=int(pow(N,0.5))-2 chk=list(itr.product(range(1,n),repeat=3)) cnt=[0]*(N+1) for _ in range(len(chk)): i=chk[_][0] j=chk[_][1] k=chk[_][2] if pow(i,2)+pow(j,2)+pow(k,2)+i*j+j*k+k*i<=N: cnt[pow(i,2)+pow(j,2)+pow(k,2)...
import sys import itertools as itr readline = sys.stdin.buffer.readline N=int(readline()) n=int(pow(N,0.5)) chk=list(itr.product(range(1,n),repeat=3)) cnt=[0]*(N+1) for _ in range(len(chk)): i=chk[_][0] j=chk[_][1] k=chk[_][2] if pow(i,2)+pow(j,2)+pow(k,2)+i*j+j*k+k*i<=N: cnt[pow(i,2)+pow(j,2)+pow(k,2)+i...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
197
N = int(input()) l = [0]*N for x in range(1,101): for y in range(1,101): for z in range(1,101): if (x**2+y**2+z**2+x*y+y*z+z*x)<N: l[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1 for i in l: print(i)
N = int(input()) l = [0]*N for x in range(1,101): for y in range(1,101): for z in range(1,101): if (x**2+y**2+z**2+x*y+y*z+z*x)<=N: l[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1 for i in l: print(i)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
113
#include <bits/stdc++.h> using namespace std; using ll = long long; ll goout(ll n) { ll count = 0; for (ll a = 1; a <= n; a++) { ll sub0 = (a * 3) * (a * 3) - (3 * a); if (sub0 > n) break; if (sub0 == n) count++; for (ll b = a + 1; b <= n; b++) { ll sub1 = (a + b + b) * (a + b + b)...
#include <bits/stdc++.h> using namespace std; using ll = long long; ll goout(ll n) { ll count = 0; for (ll a = 1; a <= n; a++) { ll sub0 = (a * 3) * (a * 3) - (3 * a * a); if (sub0 > n) break; if (sub0 == n) count++; for (ll b = a + 1; b <= n; b++) { ll sub1 = (a + b + b) * (a + b...
[["+", 49, 50, 51, 16, 12, 23, 0, 16, 17, 48], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 14, 8, 9, 0...
1
305
N = int(input()) from collections import defaultdict res = defaultdict(list) # 解の候補を生成 # x,y,zそれぞれに対して√1000位までやればよさそう limit = int(1000**.5)+1 for x in range(1, limit): for y in range(1, limit): for z in range(1, limit): f = x**2 + y**2 + z**2 + x*y + y*z + z*x res[f].append((x,y,z)...
N = int(input()) from collections import defaultdict res = defaultdict(list) # 解の候補を生成 # x,y,zそれぞれに対して√10000位までやればよさそう limit = int(10000**.5)+1 for x in range(1, limit): for y in range(1, limit): for z in range(1, limit): f = x**2 + y**2 + z**2 + x*y + y*z + z*x res[f].append((x,y,...
[["-", 12, 657, 31, 652, 3, 4, 0, 657, 31, 612], ["+", 12, 657, 31, 652, 3, 4, 0, 657, 31, 612]]
5
126
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define all(v) v.begin(), v.end() using namespace std; using ll = long long; using pi = pair<int, int>; const ll INF = 1LL << 60; int main() { vector<int> a(41), b, c; int n; cin >...
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define all(v) v.begin(), v.end() using namespace std; using ll = long long; using pi = pair<int, int>; const ll INF = 1LL << 60; int main() { vector<int> a(100), b, c; int n; cin ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
187
#include <bits/stdc++.h> using namespace std; // #define int long long #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) for (int i = 0; i < (n); i++) #define chmin(a, b) \ if ((a) > (b)) ...
#include <bits/stdc++.h> using namespace std; // #define int long long #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) for (int i = 0; i < (n); i++) #define chmin(a, b) \ if ((a) > (b)) ...
[["-", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
310
#C import math N = int(input()) count = [0] * 10100 for j in range(1, 105): for k in range(1, 105): for l in range(1, 105): v = (j+k+l) ** 2 - (j*k + k*l + l*j) if v <= 10050: count[v] += 1 for i in range(1, N): print(count[i])
#C N = int(input()) count = [0] * 10050 for j in range(1, 105): for k in range(1, 105): for l in range(1, 105): v = (j+k+l) ** 2 - (j*k + k*l + l*j) if v < 10050: count[v] += 1 for i in range(1, N+1): print(count[i])
[["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17,...
5
101
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; int main() { int n; cin >> n; vi cnt(n, 0); int c = sqrt(n) + 1; for (int x = 1; x <= c + 1; x++) { for (int y = 1; y <= c + 1; y++) { for (int z = 1; z <= c + 1; z++) { if (x * x + y * y + z * z + x * y + y * z + z * x <...
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; int main() { int n; cin >> n; vi cnt(n, 0); int c = sqrt(n) + 1; for (int x = 1; x <= c + 1; x++) { for (int y = 1; y <= c + 1; y++) { for (int z = 1; z <= c + 1; z++) { if (x * x + y * y + z * z + x * y + y * z + z * x <...
[["+", 0, 27, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 27, 28, 2, 3, 4, 0, 16, 12, 13]]
1
169
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(v) v.begin(), v.end() using ll = long long; using ull = unsigned long long; using namespace std; int main() { int N, val; cin >> N; vector<int> ans(N...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(v) v.begin(), v.end() using ll = long long; using ull = unsigned long long; using namespace std; int main() { int N, val; cin >> N; vector<int> ans(N...
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
184
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long long> vec(10000); for (int X = 1; X <= 100; X++) { for (int Y = X; Y <= 100; Y++) { for (int Z = Y; Z <= 100; Z++) { if (X * X + Y * Y + Z * Z + X * Y + X * Z + Y * Z < 10001) { if (X != Y && X !...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long long> vec(10000); for (int X = 1; X <= 100; X++) { for (int Y = X; Y <= 100; Y++) { for (int Z = Y; Z <= 100; Z++) { if (X * X + Y * Y + Z * Z + X * Y + X * Z + Y * Z < 10001) { if (X != Y && X !...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 107]]
1
265
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long long> vec(10000); for (int X = 1; X <= 100; X++) { for (int Y = 1; Y <= 100; Y++) { for (int Z = 1; Z <= 100; Z++) { if (X * X + Y * Y + Z * Z + X * Y + X * Z + Y * Z < 10001) { vec[X * X + Y * Y...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long long> vec(10000); for (int X = 1; X <= 100; X++) { for (int Y = 1; Y <= 100; Y++) { for (int Z = 1; Z <= 100; Z++) { if (X * X + Y * Y + Z * Z + X * Y + X * Z + Y * Z < 10001) { vec[X * X + Y * Y...
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
162
#include <bits/stdc++.h> using namespace std; typedef long long ll; int Binary_Search(ll first, ll last, vector<ll> v, ll search_value) { int pos = -1; while (first <= last) { ll mid = first + ((last - first) / 2); if (v[mid] == search_value) { pos = mid; break; } else if (search_value > v[m...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int Binary_Search(ll first, ll last, vector<ll> v, ll search_value) { int pos = -1; while (first <= last) { ll mid = first + ((last - first) / 2); if (v[mid] == search_value) { pos = mid; break; } else if (search_value > v[m...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
319
#include <bits/stdc++.h> #include <cmath> using namespace std; #define coutv(v) \ for (int i = 0; i < (v).size(); ++i) \ cout << v[i] << ' '; \ cout << en...
#include <bits/stdc++.h> #include <cmath> using namespace std; #define coutv(v) \ for (int i = 0; i < (v).size(); ++i) \ cout << v[i] << ' '; \ cout << en...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
199
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < N; i++) typedef long long ll; #define dump(x) cerr << #x << "=" << x << endl using P = pair<int, int>; int main() { int n; cin >> n; ll cnt = 0; map<ll, ll> mp; rep(i, 101) { rep(j, 101) { rep(k, 101) { ll t...
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 1; i < N; i++) typedef long long ll; #define dump(x) cerr << #x << "=" << x << endl using P = pair<int, int>; int main() { int n; cin >> n; ll cnt = 0; map<ll, ll> mp; rep(i, 101) { rep(j, 101) { rep(k, 101) { ll t...
[["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
149
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int N, tmp; cin >> N; vector<int> res(N + 1); for (int x = 1; x <= sqrt(N); ++x) { for (int y = 1; y <= sqrt(N); ++y) { for (int z = 1; z <= sqrt(N); ++z) { tmp = x * x + y * y + z * z + x * y + y * z + z...
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int N, tmp; cin >> N; vector<int> res(N + 1); for (int x = 1; x <= sqrt(N); ++x) { for (int y = 1; y <= sqrt(N); ++y) { for (int z = 1; z <= sqrt(N); ++z) { tmp = x * x + y * y + z * z + x * y + y * z + z...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
161
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] a = new int[100000]; for (int p = 1; p <= 100; p++) { for (int q = 1; q <= 100; q++) { for (int r = 1; r <= 100; r++) { int ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] a = new int[100000]; for (int p = 1; p <= 100; p++) { for (int q = 1; q <= 100; q++) { for (int r = 1; r <= 100; r++) { int ...
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 499], ["+", 0, 57, 64, 196, 0, 1, 0, 27, 0, 29]]
3
173