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
import itertools N=int(input()) L=[0]*(10**4+10) X=[x for x in range(1,11)] plus=[0,1,3,6] for v in itertools.combinations_with_replacement(X,3): x,y,z=v[0],v[1],v[2] temp=len(set(v)) L[x**2+y**2+z**2+x*y+y*z+z*x]+=plus[temp] for i in range(1,N+1): print(L[i])
import itertools N=int(input()) L=[0]*(10**4+10) X=[x for x in range(1,101)] plus=[0,1,3,6] for v in itertools.combinations_with_replacement(X,3): x,y,z=v[0],v[1],v[2] temp=len(set(v)) try: L[x**2+y**2+z**2+x*y+y*z+z*x]+=plus[temp] except: continue for i in range(1,N+1): print(L[i])
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 8, 196, 0, 246, 0, 247], ["+", 0, 656, 0, 7, 8, 196, 0, 246, 0, 102], ["+", 0, 7, 8, 196, 0, 246, 0, 671, 0, 672], ["+", 0, 7, 8, 196, 0, 246, 0, 671, 0, 102], ["+", 0, 246, 0, 671, 0, 196, 0, 116, 0, 117]...
5
139
N = int(input()) answers = [0 for i in range(10**4+1)] for x in range(1,50): for y in range(x,50): for z in range(y,50): n = x**2+y**2+z**2+x*y+y*z+z*x if 0 <= n <= 10000: #print(x,y,z,n) c = len(set([x,y,z])) if c == 1: ...
N = int(input()) answers = [0 for i in range(10**4+1)] for x in range(1,42): for y in range(x,100): for z in range(y,100): n = x**2+y**2+z**2+x*y+y*z+z*x if 0 <= n <= 10000: #if n == 9803: # print(x,y,z,n) c = len(set([x,y,z])) ...
[["-", 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]]
5
149
#include <math.h> #include <stdio.h> #include <stdlib.h> int main(void) { int n; int a[10001] = {0}; int tmp; scanf("%d", &n); for (int i = 1; i < 45; i++) { for (int j = i; j < 50; j++) { for (int k = j; k < 100; k++) { tmp = i * i + j * j + k * k + i * j + j * k + k * i; if (tmp...
#include <math.h> #include <stdio.h> #include <stdlib.h> int main(void) { int n; int a[10001] = {0}; int tmp; scanf("%d", &n); for (int i = 1; i < 100; i++) { for (int j = i; j < 100; j++) { for (int k = j; k < 100; k++) { tmp = i * i + j * j + k * k + i * j + j * k + k * i; if (t...
[["-", 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, 23, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
218
#include <bits/stdc++.h> using namespace std; #define int int64_t signed main() { int n, ans, date[10000] = {}; int x = 1, y = 1, z = 1; cin >> n; for (int i = 1; i <= (int)sqrt(n); i++) { for (int j = 1; j <= (int)sqrt(n); j++) { for (int k = 1; k <= (int)sqrt(n); k++) { date[i * i + j * j + ...
#include <bits/stdc++.h> using namespace std; #define int int64_t signed main() { int n, ans, date[100000] = {}; int x = 1, y = 1, z = 1; cin >> n; for (int i = 1; i <= (int)sqrt(n); i++) { for (int j = 1; j <= (int)sqrt(n); j++) { for (int k = 1; k <= (int)sqrt(n); k++) { date[i * i + j * j +...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13]]
1
172
#include <bits/stdc++.h> using namespace std; int main() { long N; cin >> N; vector<long> a(100005); // for(int i=0;i<N;i++) cin>>a[i]; // sort(a.begin(),a.end()); // reverse(a.begin(),a.end()); // long ans=0; /* for(int i=1;i<=N;i++){ long ans=0; for(int x=1;i-x*x>=4;x++){ for(int y=1...
#include <bits/stdc++.h> using namespace std; int main() { long N; cin >> N; vector<long> a(100005); // for(int i=0;i<N;i++) cin>>a[i]; // sort(a.begin(),a.end()); // reverse(a.begin(),a.end()); // long ans=0; /* for(int i=1;i<=N;i++){ long ans=0; for(int x=1;i-x*x>=4;x++){ for(int y=1...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
135
import java.io.PrintWriter; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); int count = 0; double z = 0; PrintWriter out = new PrintWriter(System.out); for (int l = 1; l <= N; l++)...
import java.io.PrintWriter; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); int count = 0; double z = 0; PrintWriter out = new PrintWriter(System.out); for (int l = 1; l <= N; l++)...
[["-", 15, 16, 12, 492, 3, 4, 0, 16, 17, 85], ["-", 15, 16, 12, 492, 3, 4, 0, 16, 12, 499]]
3
252
#include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; void f(int n) { int ans = 0; for (int number = 1; number <= sqrt(n); number++) { int low = number + 1; int high = sqrt(n); while (low <= high) { if ((number * number) + (low * low) + (high * high) + (number * low...
#include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; void f(int n) { int ans = 0; for (int number = 1; number <= sqrt(n); number++) { int low = number; int high = sqrt(n); while (low <= high) { if ((number * number) + (low * low) + (high * high) + (number * low) + ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
251
import math N = int(input()) fn = {i+1:0 for i in range(N)} rtN = int(math.sqrt(N))+1 def n(x,y,z): return x**2 + y**2 + z**2 + x*y + y*z + z*x for x in range(1, rtN): for y in range(1, rtN): for z in range(1, rtN): n_ = n(x,y,z) try: f[n_] += 1 exce...
import math N = int(input()) fn = {i+1:0 for i in range(N)} rtN = int(math.sqrt(N))+1 def n(x,y,z): return x**2 + y**2 + z**2 + x*y + y*z + z*x for x in range(1, rtN): for y in range(1, rtN): for z in range(1, rtN): n_ = n(x,y,z) try: fn[n_] += 1 exc...
[["-", 8, 196, 0, 1, 0, 677, 31, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 51, 22]]
5
138
#!/usr/bin/env python3 n = int(input()) cnt = [0] * (1 + n) for a in range(1, 33): for b in range(1, 33): for c in range(1, 33): k = a ** 2 + b ** 2 + c ** 2 + a * b + b * c + c * a if k > n: continue else: cnt[k] += 1 for i in range(1, n +...
#!/usr/bin/env python3 n = int(input()) cnt = [0] * (1 + n) for a in range(1, 100): for b in range(1, 100): for c in range(1, 100): k = a ** 2 + b ** 2 + c ** 2 + a * b + b * c + c * a if k > n: continue else: cnt[k] += 1 for i in range(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]]
5
108
#include <stdio.h> int main() { int n, i, x, y, z; int a; int cnt = 0; scanf("%d", &n); for (i = 1; i <= n; i++) { for (x = 1; x <= 100; x++) { if ((x + 1) * (x + 1) >= i) break; else for (y = x; y <= 100; y++) { if ((y + 1) * (y + 1) >= i) break; ...
#include <stdio.h> int main() { int n, i, x, y, z; int a; int cnt = 0; scanf("%d", &n); for (i = 1; i <= n; i++) { for (x = 1; x <= 100; x++) { if ((x + 1) * (x + 1) >= i) break; else for (y = x; y <= 100; y++) { if ((y + 1) * (y + 1) >= i) break; ...
[["-", 75, 76, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 57, 64, 1, 0, 11, 12, 13]]
0
252
import itertools N = int(input()) rng = int(-(-N**0.5//1)) pat_list = list(itertools.product(range(1,rng),repeat=3)) cnt_list = [0 for i in range(rng**2*6)] for X, Y, Z in pat_list: cnt_list[X**2+Y**2+Z**2+X*Y+Y*Z+Z*X] += 1 for i in range(1, N): print(cnt_list[i])
import itertools N = int(input()) rng = int(-(-N**0.5//1)) pat_list = list(itertools.product(range(1,rng),repeat=3)) cnt_list = [0 for i in range(rng**2*6)] for X, Y, Z in pat_list: cnt_list[X**2+Y**2+Z**2+X*Y+Y*Z+Z*X] += 1 for i in range(1, N+1): print(cnt_list[i])
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
114
#include <algorithm> #include <iostream> #include <random> #include <utility> #include <vector> int main(void) { int n; std::cin >> n; std::vector<int> A(n + 1, 0); for (long long int x = 1; x * x <= n; ++x) { for (long long int y = 1; y * y + x * x <= n; ++y) { for (long long int z = 1;; ++z) { ...
#include <algorithm> #include <iostream> #include <random> #include <utility> #include <vector> int main(void) { int n; std::cin >> n; std::vector<int> A(n + 1, 0); for (long long int x = 1; x * x <= n; ++x) { for (long long int y = 1; y * y + x * x <= n; ++y) { for (long long int z = 1;; ++z) { ...
[["-", 0, 43, 49, 50, 51, 16, 12, 16, 12, 22], ["+", 0, 43, 49, 50, 51, 16, 12, 16, 12, 22]]
1
176
from collections import defaultdict from sys import stdin def main(): input = lambda: stdin.readline()[:-1] N = int(input()) ans = defaultdict(int) for x in range(1, 101): for y in range(1, 10): for z in range(1, 101): n = x * x + y * y + z * z + x * y + y * z + z ...
from collections import defaultdict from sys import stdin def main(): input = lambda: stdin.readline()[:-1] N = int(input()) ans = defaultdict(int) for x in range(1, 101): for y in range(1, 101): for z in range(1, 101): n = x * x + y * y + z * z + x * y + y * z + z...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
124
from math import sqrt n = int(input()) lim_n = int(sqrt(n)) result = [0] * n for i in range(2, lim_n+1): for j in range(2, i+1): for k in range(2, j+1): p = i**2+j**2+k**2 if p > 2*n: break if p % 2 == 1: continue if (j + k) -...
from math import sqrt n = int(input()) lim_n = int(sqrt(n*2)) result = [0] * n for i in range(2, lim_n+1): for j in range(2, i+1): for k in range(2, j+1): p = i**2+j**2+k**2 if p > 2*n: break if p % 2 == 1: continue if (j + k)...
[["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 48], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 75, 665, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+"...
5
172
#include <bits/stdc++.h> using namespace std; #define file \ { \ freopen("i.txt", "r", stdin); \ freopen("o.txt", "w", stdou...
#include <bits/stdc++.h> using namespace std; #define file \ { \ freopen("i.txt", "r", stdin); \ freopen("o.txt", "w", stdou...
[["-", 15, 339, 51, 16, 12, 23, 0, 42, 0, 32], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 17, 60]]
1
282
#include <bits/stdc++.h> using namespace std; int main() { int N; int F = 0; cin >> N; if (N < 0 or N > 10000) { F = 3; } int A = 0; vector<int> f(N); for (int i = 0; i < N; i++) { f.at(i) = 0; } int y = 1; int x = 1; for (int z = 1; z < 58; z++) { if (F == 3) { break; } ...
#include <bits/stdc++.h> using namespace std; int main() { int N; int F = 0; cin >> N; if (N < 0 or N > 10000) { F = 3; } int A = 0; vector<int> f(N); for (int i = 0; i < N; i++) { f.at(i) = 0; } int y = 1; int x = 1; for (int z = 1; z < N; z++) { if (F == 3) { break; } ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
325
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define int long long #define mp make_pair #define pr pair<long long, long long> #define vr vector<long long> #define mod1 1000000007 #define mod2 998244353 #define inf 1e18 #define ps(x, y) fixed << setprecision(y) <...
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define int long long #define mp make_pair #define pr pair<long long, long long> #define vr vector<long long> #define mod1 1000000007 #define mod2 998244353 #define inf 1e18 #define ps(x, y) fixed << setprecision(y) <...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
268
a = int(input()) b = round(a**0.5) + 1 print(b) x = [] for i in range(1,b): for j in range(1,b): for k in range(1,b): l = i**2 + j**2 + k**2 + i*j + j*k + k*i x.append(l) t = [0] * a for i in range(0,len(x)): if x[i] <= a: t[x[i]-1] = t[x[i]-1] + 1 for i in t: print...
a = int(input()) b = round(a**0.5) + 1 x = [] for i in range(1,b): for j in range(1,b): for k in range(1,b): l = i**2 + j**2 + k**2 + i*j + j*k + k*i x.append(l) t = [0] * a for i in range(0,len(x)): if x[i] <= a: t[x[i]-1] = t[x[i]-1] + 1 for i in t: print(i)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
145
def fx(n): s = [0]*(n+1) for i in range(1,10000): if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break for j in range(1, 10000): if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break for k in range(1, 10000): if (1+1+k)**2 - 1*1 - 1*k - k*1 > n: break formula = (i+j+k)**2 - i*j - j*k - k*i i...
def fx(n): s = [0]*(n+1) for i in range(1,10000): if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break for j in range(1, 10000): if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break for k in range(1, 10000): if (1+1+k)**2 - 1*1 - 1*k - k*1 > n: break formula = (i+j+k)**2 - i*j - j*k - k*i i...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
202
n = int(input()) cnt = [0] * n for x in range(1, int(n ** 0.5) + 1): for y in range(1, int(n ** 0.5) + 1): for z in range(1, int(n ** 0.5) + 1): num = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x if num <= n: print(num) cnt[num - 1] += 1 print(*cn...
n = int(input()) cnt = [0] * n for x in range(1, int(n ** 0.5) + 1): for y in range(1, int(n ** 0.5) + 1): for z in range(1, int(n ** 0.5) + 1): num = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x if num <= n: cnt[num - 1] += 1 print(*cnt, sep="\n")
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
119
N = int(input()) N2 = int(N**0.5) cnt = [0] * (9000) for x in range(1,N2+1): for y in range(1,N2+1): for z in range(1,N2+1): xyz = x*x + y*y + z*z + x*y + y*z + z*x cnt[xyz] += 1 # for i in range(1,N+1): print( cnt[i] )
N = int(input()) N2 = int(N**0.5) cnt = [0] * (90000) for x in range(1,N2+1): for y in range(1,N2+1): for z in range(1,N2+1): xyz = x*x + y*y + z*z + x*y + y*z + z*x cnt[xyz] += 1 # for i in range(1,N+1): print( cnt[i] )
[["-", 0, 1, 0, 662, 12, 657, 12, 23, 0, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 612]]
5
112
import sys sys.setrecursionlimit(10**9) def mi(): return map(int,input().split()) def ii(): return int(input()) def isp(): return input().split() def deb(text): print("-------\n{}\n-------".format(text)) INF=10**20 def main(): N=ii() j = math.ceil((N+1)**0.5) ans = [0] * (N+1) for x in range(1,j+1): ...
import math import sys sys.setrecursionlimit(10**9) def mi(): return map(int,input().split()) def ii(): return int(input()) def isp(): return input().split() def deb(text): print("-------\n{}\n-------".format(text)) INF=10**20 def main(): N=ii() j = math.ceil((N+1)**0.5) ans = [0] * (N+1) for x in ra...
[["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487]]
5
213
import numpy as np N = int(input()) ans = np.zeros(int(N)) if N<10001 and N>0: maxa = int(np.sqrt(N-2)) for x in range(1,maxa): for y in range(1,x): for z in range(1,y): p = x*x+y*y+z*z+x*y+y*z+z*x if p<N+1: ans[p-1] += 6 for x in ...
import numpy as np N = int(input()) ans = np.zeros(int(N)) if N<10001 and N>3: maxa = int(np.sqrt(N-2)) for x in range(1,maxa): for y in range(1,x): for z in range(1,y): p = x*x+y*y+z*z+x*y+y*z+z*x if p<N+1: ans[p-1] += 6 for x in ...
[["-", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612]]
5
251
n = int(input()) ans = [0 for _ in range(10**4 + 100)] for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): p = x**2 + y**2 + z**2 + x * y + y * z + z * x if p <= 10**4: ans[p] += 1 for i in range(n + 1): print(ans[i])
n = int(input()) ans = [0 for _ in range(10**5)] for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): p = x**2 + y**2 + z**2 + x * y + y * z + z * x if p <= 10**4: ans[p] += 1 for i in range(1, n + 1): print(ans[i])
[["-", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
109
/* C - XYZ Triplets */ #include <bits/stdc++.h> using namespace std; int Triplets(int n) { int ans = 0; if (n >= 6) { for (int i = 1; i <= sqrt(n - 2) - 1; i++) { for (int j = i; j <= sqrt(n - 2) - 1; j++) { for (int k = j; k <= sqrt(n - 2) - 1; k++) { if ((i + j) * (i + j) + (j + k) *...
/* C - XYZ Triplets */ #include <bits/stdc++.h> using namespace std; int Triplets(int n) { int ans = 0; if (n >= 6) { for (int i = 1; i <= sqrt(n - 2) - 1; i++) { for (int j = i; j <= sqrt(n - 2) - 1; j++) { for (int k = j; k <= sqrt(n - 2) - 1; k++) { if ((i + j) * (i + j) + (j + k) *...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 106], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 31, 22], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 17, 98], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60]]
1
229
import itertools N = int(input()) ans = [0]*N x = [] i=1 while 1: if (i+1)*(i+1)+2>=N: break i+=1 i+=1 for inputI in range(i): x.append(inputI+1) S = list(itertools.combinations_with_replacement(x, 3)) for s in S: sum = (s[0]+s[1])*(s[0]+s[2])+pow(s[1],2)+pow(s[2],2) if sum <= N:...
import itertools N = int(input()) ans = [0]*N x = [] i=1 while 1: if (i+1)*(i+1)+2>=N: break i+=1 i+=1 for inputI in range(i): x.append(inputI+1) S = list(itertools.combinations_with_replacement(x, 3)) for s in S: sum = (s[0]+s[1])*(s[0]+s[2])+pow(s[1],2)+pow(s[2],2) if sum <= N:...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 75, 665, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107]]
5
208
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: triplets # CreatedDate: 2020-07-11 22:09:08 +0900 # LastModified: 2020-07-11 22:30:08 +0900 # import os import sys # import numpy as np # import pandas as pd from itertools import combinations_with_replacement as nCr from collections import Counter def m...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: triplets # CreatedDate: 2020-07-11 22:09:08 +0900 # LastModified: 2020-07-11 22:31:12 +0900 # import os import sys # import numpy as np # import pandas as pd from itertools import combinations_with_replacement as nCr from collections import Counter def m...
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
308
import itertools import math import numpy as np N = int(input()) n_max = int(math.sqrt(N)) l = [i for i in range(1, 91)] score = np.zeros([10000]).astype(np.uint8) for c in itertools.combinations_with_replacement(l, 3): sum = c[0]**2 + c[1]**2 + c[2]**2 + c[0]*c[1] + c[0]*c[2] + c[1]*c[2] if sum <= 10000: if ...
import itertools import math import numpy as np N = int(input()) n_max = int(math.sqrt(N)) l = [i for i in range(1, n_max)] score = np.zeros([10000]).astype(np.uint8) for c in itertools.combinations_with_replacement(l, 3): sum = c[0]**2 + c[1]**2 + c[2]**2 + c[0]*c[1] + c[0]*c[2] + c[1]*c[2] if sum <= 10000: ...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22]]
5
199
import math n = int(input()) a = [0]*10001 b = math.ceil(math.sqrt(n)) + 1 for i in range(1,b): for j in range(1,b): for k in range(1,b): ans = ((i + j) ** 2 + (j + k) ** 2 + (k + i) ** 2) //2 a[ans] += 1 for i in range(1,n+1): print(a[i])
import math n = int(input()) a = [0]*100001 b = math.ceil(math.sqrt(n)) + 1 for i in range(1,b): for j in range(1,b): for k in range(1,b): ans = ((i + j) ** 2 + (j + k) ** 2 + (k + i) ** 2) //2 a[ans] += 1 for i in range(1,n+1): print(a[i])
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
116
n = int(input()) c = [0]*10001 for x in range(1,101): if(x > n): break for y in range(x,101): for z in range(y,101): p = int(((x+y)*(x+y) + (y+z)*(y+z) + (z+x)*(z+x))/2) if(n >= p): c[p] += 1 for i in range(1,n+1): print(c[i])
n = int(input()) c = [0]*10001 for x in range(1,101): if(x > n): break for y in range(1,101): for z in range(1,101): p = int(((x+y)*(x+y) + (y+z)*(y+z) + (z+x)*(z+x))/2) if(n >= p): c[p] += 1 for i in range(1,n+1): print(c[i])
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
129
import math N=int(input()) ans=[0]*(N+1) tempn=0 xmax=int(math.sqrt(N))+2 for x in range(1,xmax+2): ymax=xmax-x for y in range(1,ymax+1): zmax=ymax-y for z in range(1,zmax+1): tempn=((x+y+z)**2-(x*y+y*z+z*x)) if tempn <= N: ans[tempn]+=1 for i in range...
import math N=int(input()) ans=[0]*(N+1) tempn=0 xmax=int(math.sqrt(N)+1) for x in range(1,xmax+1): ymax=xmax-x for y in range(1,xmax+1): zmax=ymax-y for z in range(1,xmax+1): tempn=((x+y+z)**2-(x*y+y*z+z*x)) if tempn <= N: ans[tempn]+=1 for i in range...
[["-", 0, 662, 12, 657, 31, 652, 3, 4, 0, 25], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["...
5
142
n=int(input()) z=0 N=[0]*10000 ans=0 ko=0 for x in range(1,101): for y in range(1,101): for z in range(1,101): ko=x**2+y**2+z**2+x*y+y*z+z*x if ko<=n: N[ko]+=1 else: break for i in range(n): print(N[i])
n=int(input()) z=0 N=[0]*10000 ans=0 ko=0 for x in range(1,101): for y in range(1,101): for z in range(1,101): ko=x**2+y**2+z**2+x*y+y*z+z*x if ko<=n: N[ko-1]+=1 else: break for i in range(n): print(N[i])
[["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
108
#include <algorithm> #include <iostream> #include <string> using namespace std; int N; int main(void) { cin >> N; int A[N + 1]; for (int i = 0; i <= N; i++) A[i] = 0; long long total = 0; for (int i = 1; i <= N; i++) { for (int j = i; j <= N; j++) { for (int k = j; k <= N; k++) { tota...
#include <algorithm> #include <iostream> #include <string> using namespace std; int N; int main(void) { cin >> N; int A[N + 1]; for (int i = 0; i <= N; i++) A[i] = 0; long long total = 0; for (int i = 1; i <= N; i++) { for (int j = i; j <= N; j++) { for (int k = j; k <= N; k++) { tota...
[["-", 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
225
n = gets.to_i ary = [] n.times{ ary << 0 } (1..45).each do |i| (1..45).each do |j| (1..45).each do |k| check = i*i + j*j + k*k + i*j + j*k + i*k next if check > n ary[check-1] += 1 end end end puts ary
n = gets.to_i ary = [] n.times{ ary << 0 } (1..100).each do |i| (1..100).each do |j| (1..100).each do |k| check = i*i + j*j + k*k + i*j + j*k + i*k next if check > n ary[check-1] += 1 end end end puts ary
[["-", 0, 493, 0, 652, 486, 739, 0, 475, 444, 612], ["+", 0, 493, 0, 652, 486, 739, 0, 475, 444, 612], ["-", 8, 736, 0, 652, 486, 739, 0, 475, 444, 612], ["+", 8, 736, 0, 652, 486, 739, 0, 475, 444, 612]]
4
93
import itertools def calculateFunction(x, y, z): tmp = x + y + z return tmp * tmp - (x*y + y*z + z*x) lis = [] for i in range(50): lis.append(i+1) fullset = [0] * 10000 for team in itertools.product(lis, repeat = 3): ans = calculateFunction(team[0], team[1], team[2]) if (ans <= 10000): fu...
import itertools def calculateFunction(x, y, z): tmp = x + y + z return tmp * tmp - (x*y + y*z + z*x) lis = [] for i in range(110): lis.append(i+1) fullset = [0] * 10000 for team in itertools.product(lis, repeat = 3): ans = calculateFunction(team[0], team[1], team[2]) if (ans <= 10000): f...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
135
N = int(input()) List = [0 for _ in range(1000)] for x in range(1, 101): for y in range(1, 101): for z in range(1, 101): k = x**2 + y**2 + z**2 + x*y + y*z + z*x if k<=N: List[k-1] += 1 for i in range(N): print(List[i])
N = int(input()) List = [0 for _ in range(10000)] for x in range(1, 101): for y in range(1, 101): for z in range(1, 101): k = x**2 + y**2 + z**2 + x*y + y*z + z*x if k<=N: List[k-1] += 1 for i in range(N): print(List[i])
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
103
import itertools n = int(input()) ans_d = {i: 0 for i in range(1,10001)} p = itertools.product(range(1, 100), range(1, 100), range(1, 100)) for x, y, z in p: cnt = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (x * z) if cnt <= 10000: ans_d[cnt] += 1 for i, j in ans_d.items(): print(i,j) ...
import itertools n = int(input()) ans_d = {i: 0 for i in range(1,10001)} p = itertools.product(range(1, 100), range(1, 100), range(1, 100)) for x, y, z in p: cnt = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (x * z) if cnt <= 10000: ans_d[cnt] += 1 for i, j in ans_d.items(): print(j) ...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21]]
5
133
n = gets.to_i ans = [] t = Array.new(10**6,0) (1..50).to_a.repeated_permutation(3) do |xyz| x = xyz[0] y = xyz[1] z = xyz[2] i = x**2 + y**2 + z**2 + x*y + y*z + x*z j = t[i-1] h = j + 1 t[i-1] = h end (1..n).each do |m| puts t[m-1] end
n = gets.to_i ans = [] t = Array.new(10**6,0) (1..100).to_a.repeated_permutation(3) do |xyz| x = xyz[0] y = xyz[1] z = xyz[2] i = x**2 + y**2 + z**2 + x*y + y*z + x*z j = t[i-1] h = j + 1 t[i-1] = h end (1..n).each do |m| puts t[m-1] end
[["-", 0, 652, 486, 652, 486, 739, 0, 475, 444, 612], ["+", 0, 652, 486, 652, 486, 739, 0, 475, 444, 612]]
4
121
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; vector<int> qw(10000); for (long long i = 1; i * i <= n; ++i) for (long long ii = 1; ii * ii <= n; ++ii) for (long long iii = 1; iii * iii <= n; ++iii) if (1000 >= i * i + ii * ii + iii * iii + i * ii + i * iii +...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; vector<long long> qw(10000); for (long long i = 1; i * i <= n; ++i) for (long long ii = 1; ii * ii <= n; ++ii) for (long long iii = 1; iii * iii <= n; ++iii) if (10000 >= i * i + ii * ii + iii * iii + i * ii + i ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 8, 7, 8, 57, 15, 339, 51, 16, 31, 13], ["+", 8, 7, 8, 57, 15, 339, 51, 16, 31, 13]]
1
162
import collections N = int(input()) lst = [0]*75000 l = 0 res = 0 for i in range(1,42): for j in range(1,42): for k in range(1,42): lst[l] = i**2 + j**2 + k**2 + i*j + j*k + k*i l += 1 L = collections.Counter(lst) for h in range(1,N+1): print(L[h])
import collections N = int(input()) lst = [0]*1000000 l = 0 res = 0 for i in range(1,101): for j in range(1,101): for k in range(1,101): lst[l] = i**2 + j**2 + k**2 + i*j + j*k + k*i l += 1 L = collections.Counter(lst) for h in range(1,N+1): print(L[h])
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 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]]
5
111
N=int(input()) C=[0]*(2*N + 1) l=10**2 for i in range(l): for j in range(l): for k in range(l): x=i+1 y=j+1 z=k+1 s=(x+y)*(x+y)+(x+z)*(x+z)+(z+y)*(z+y) if(s<2*N): C[s]+=1 for i in range(N): print(C[2*(i+1)])
N=int(input()) C=[0]*(2*N + 1) l=10**2 for i in range(l): for j in range(l): for k in range(l): x=i+1 y=j+1 z=k+1 s=(x+y)*(x+y)+(x+z)*(x+z)+(z+y)*(z+y) if(s<(2*N+1)): C[s]+=1 for i in range(N): print(C[2*(i+1)])
[["+", 0, 57, 15, 23, 0, 666, 0, 23, 0, 24], ["+", 15, 23, 0, 666, 0, 23, 0, 657, 17, 72], ["+", 15, 23, 0, 666, 0, 23, 0, 657, 12, 612], ["+", 0, 57, 15, 23, 0, 666, 0, 23, 0, 25]]
5
138
import math n = int(input()) anslist = [0] * 10**4 for i in range(1, int(math.sqrt(int(10000/3)))+1): x = i for j in range(i, int(math.sqrt(int((10000-i**2)/2)))+1): y = j for k in range(j, int(math.sqrt(10000-i**2-j**2))+1): z = k uhen = x**2 + y**2 + z**2 + x*y + y*z +...
import math n = int(input()) anslist = [0] * 10**4 for i in range(1, int(math.sqrt(int(10000/3)))+1): x = i for j in range(i, int(math.sqrt(int((10000-i**2)/2)))+1): y = j for k in range(j, int(math.sqrt(10000-i**2-j**2))+1): z = k uhen = x**2 + y**2 + z**2 + x*y + y*z +...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 75, 665, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107]]
5
208
N = int(open(0).read()) cache = {} cnt = 0 c = int(N ** 0.5) cs = range(1, c) for x in cs: for y in cs: for z in cs: n = x*x + y*y + z*z + x*y + y*z + z*x if n in cache: cache[n] += 1 else: cache[n] = 1 print(cache) for i in range(1, N+1): ...
N = int(open(0).read()) cache = {} cnt = 0 c = int(N ** 0.5) cs = range(1, c) for x in cs: for y in cs: for z in cs: n = x*x + y*y + z*z + x*y + y*z + z*x if n in cache: cache[n] += 1 else: cache[n] = 1 for i in range(1, N+1): if i in c...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
129
#include <bits/stdc++.h> using namespace std; // typedef typedef long long ll; typedef vector<int> vi; typedef vector<string> vs; // define #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) int main() { int a, n; // vi c; cin >> n; vi d(50000, 0); for (int x = 1; x < 101; x+...
#include <bits/stdc++.h> using namespace std; // typedef typedef long long ll; typedef vector<int> vi; typedef vector<string> vs; // define #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) int main() { ll a, n; // vi c; cin >> n; vi d(100000, 0); for (int x = 1; x < 101; x+...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
183
#include <bits/stdc++.h> #define LL long long #define dl double template <class T> void rd(T &x) { x = 0; T f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch <= '9' && ch >= '0') x = x * 10 + ch - '0', ch = getchar(); x *= f; } ...
#include <bits/stdc++.h> #define LL long long #define dl double template <class T> void rd(T &x) { x = 0; T f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch <= '9' && ch >= '0') x = x * 10 + ch - '0', ch = getchar(); x *= f; } ...
[["+", 15, 339, 51, 16, 31, 16, 31, 74, 0, 24], ["+", 51, 16, 31, 16, 31, 74, 39, 77, 39, 40], ["+", 15, 339, 51, 16, 31, 16, 31, 74, 0, 25], ["+", 15, 339, 51, 16, 31, 16, 12, 74, 0, 24], ["+", 51, 16, 31, 16, 12, 74, 39, 77, 39, 40], ["+", 15, 339, 51, 16, 31, 16, 12, 74, 0, 25]]
1
379
n = int(input()) num = range(1, int(n ** 0.5) + 1) from itertools import combinations_with_replacement table = [0] * n for i in combinations_with_replacement(num, 3): #print(i) index = (i[0] + i[1] + i[2]) ** 2 - (i[0] * i[1] + i[0] * i[2] + i[1] * i[2]) if (i[0] + i[1] + i[2]) ** 2 - (i[0] * i[1] + i[0] ...
n = int(input()) num = range(1, int(n ** 0.5) + 1) from itertools import combinations_with_replacement table = [0] * n for i in combinations_with_replacement(num, 3): #print(i) index = (i[0] + i[1] + i[2]) ** 2 - (i[0] * i[1] + i[0] * i[2] + i[1] * i[2]) if (i[0] + i[1] + i[2]) ** 2 - (i[0] * i[1] + i[0] ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
227
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) #define ll long long int main() { ll N; cin >> N; ll n = 100; vector<int> counter(10001); for (int i = 1; i < n; i++) { for (int j = i; j < n; j++) { for (int k = j; k < n; k++) { int x = i + 1,...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) #define ll long long int main() { ll N; cin >> N; ll n = 100; vector<int> counter(10001); for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { for (int k = j; k < n; k++) { int x = i + 1,...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
224
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <deque> // deque #include <iomanip> // setprecision #include <iostream> // cout, endl, cin #include <map> // map #include <math.h> // sqrt #include <queue> // queue, priority_queue #include <set> // set #i...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <deque> // deque #include <iomanip> // setprecision #include <iostream> // cout, endl, cin #include <map> // map #include <math.h> // sqrt #include <queue> // queue, priority_queue #include <set> // set #i...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
276
import itertools import collections N = int(input()) count = [0]*N*5 m = int(N**0.5) for x, y, z in itertools.combinations_with_replacement(range(1, m+1), 3): n = x**2+y**2+z**2+x*y+y*z+z*x k = len(set({x, y, z})) if k == 1: count[n] += 1 elif k == 2: count[n] += 3 else: count[n] += 6 for n in...
import itertools import collections N = int(input()) count = [0]*N*100 m = int(N**0.5) for x, y, z in itertools.combinations_with_replacement(range(1, m+1), 3): n = x**2+y**2+z**2+x*y+y*z+z*x k = len(set({x, y, z})) if k == 1: count[n] += 1 elif k == 2: count[n] += 3 else: count[n] += 6 for n ...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
141
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[50005] = {0}; int main() { ios ::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> 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 x ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[60005] = {0}; int main() { ios ::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> 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 x ...
[["-", 0, 30, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 50, 49, 80, 81, 13]]
1
173
n = int(input()) ans = [0 for i in range(n)] for x in range(1,41): for y in range(1,41): for z in range(1,41): n_2 = x ** 2 + y ** 2 + z ** 2 + x*y + x*z + y*z if n_2 > int(len(ans)): continue ans[n_2-1] += 1 for i in range(n): print(ans[i])
n = int(input()) ans = [0 for i in range(n)] for x in range(1,100): for y in range(1,100): for z in range(1,100): n_2 = x ** 2 + y ** 2 + z ** 2 + x*y + x*z + y*z if n_2 > int(len(ans)): continue ans[n_2-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]]
5
110
n = int(input()) count = [0] * (10**6) s = 0 for i in range(1, 10): for j in range(1, 10): for k in range(1, 10): s = i * i + j * j + k * k + i * j + j * k + k * i count[s - 1] += 1 # if s != 0: # print(i,j,k) for i in range(n): print(count[i])
n = int(input()) count = [0] * (10**6) s = 0 for i in range(1, 101): for j in range(1, 101): for k in range(1, 101): s = i * i + j * j + k * k + i * j + j * k + k * i count[s - 1] += 1 for i in range(n): print(count[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]]
5
102
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; const int INF = 1000000000; const int MOD = 1000000007; int main() { ll n; cin >> n; ll ans[100000] = {}; for (int x = 1; x < 101; x++) { for (int y = 1; y < 10; y++) { ...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; const int INF = 1000000000; const int MOD = 1000000007; int main() { ll n; cin >> n; ll ans[100000] = {}; for (int x = 1; x < 101; x++) { for (int y = 1; y < 101; y++) { ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
159
import itertools ln = itertools.product(range(1,100),repeat = 3) #print(ln) line = [0 for i in range(10000)] #print(len(line)) for i in ln: x,y,z = i n = x**2 +y**2 + z**2 +x*y + y*z + z*x if n <=1000: line[n-1]+=1 N = int(input()) for i in range(N): print(line[i])
import itertools ln = itertools.product(range(1,100),repeat = 3) #print(ln) line = [0 for i in range(10000)] #print(len(line)) for i in ln: x,y,z = i n = x**2 +y**2 + z**2 +x*y + y*z + z*x if n <=10000: line[n-1]+=1 N = int(input()) for i in range(N): print(line[i])
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
106
''' J A I ~ S H R E E ~ R A M ''' # Title: aising2020_c.py # dated: 11-07-2020 17:43:44 # Creator & Template by : Udit Gupta @luctivud import math; from collections import * import sys; from functools import reduce # sys.setrecursionlimit(10**6) def get_ints(): return map(int, input().strip().split()) def ...
''' J A I ~ S H R E E ~ R A M ''' # Title: aising2020_c.py # dated: 11-07-2020 17:43:44 # Creator & Template by : Udit Gupta @luctivud import math; from collections import * import sys; from functools import reduce # sys.setrecursionlimit(10**6) def get_ints(): return map(int, input().strip().split()) def ...
[["-", 0, 656, 0, 52, 15, 666, 0, 657, 17, 48], ["-", 0, 656, 0, 52, 15, 666, 0, 657, 12, 22]]
5
407
#pragma region Headers #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #in...
#pragma region Headers #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #in...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
1,237
from itertools import combinations_with_replacement N = int(input()) ans = list(0 for _ in range(N)) for L in combinations_with_replacement(range(1, 6), 3): x = L[0] y = L[1] z = L[2] A = x**2 + y**2 + z**2 + x*y + y*z + z*x if A <= N: if x == y and y == z: ans[A - 1] += 1 elif x == y or y == z ...
from itertools import combinations_with_replacement N = int(input()) ans = list(0 for _ in range(N)) for L in combinations_with_replacement(range(1, 100), 3): x = L[0] y = L[1] z = L[2] A = x**2 + y**2 + z**2 + x*y + y*z + z*x if A <= N: if x == y and y == z: ans[A - 1] += 1 elif x == y or y == ...
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
145
n=int(input()) l=[0]*n for x in range(1,10**2+1): for y in range(1,10**2+1): for z in range(1,10**2+1): i=(x+y+z)**2-(x*y+y*z+x*z) if i<n: l[i-1]+=1 print(*l,sep="\n")
n=int(input()) l=[0]*n for x in range(1,10**2+10): for y in range(1,10**2+10): for z in range(1,10**2+10): i=(x+y+z)**2-(x*y+y*z+x*z) if i<=n: l[i-1]+=1 print(*l,sep="\n")
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
106
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> long f(int x, int y, int z) { const auto a = x + y + z; return a * a - (x * y + y * z + z * x); } std::vector<long> solve(int n) { std::vector<long> result(n); const int max = std::sqrt(n) + 1; f...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> long f(int x, int y, int z) { const auto a = x + y + z; return a * a - (x * y + y * z + z * x); } std::vector<long> solve(int n) { std::vector<long> result(n); const int max = std::sqrt(n) + 1; f...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
228
#include <algorithm> #include <cstring> #include <iostream> #include <math.h> #include <string.h> #define ll long long ll gcd(ll a, ll b) { ll s = 1, c; while (a && b) { if ((~a & 1) && (~b & 1)) a >>= 1, b >>= 1, s <<= 1; else if (~a & 1) a >>= 1; else if (~b & 1) b >>= 1; else if...
#include <algorithm> #include <cstring> #include <iostream> #include <math.h> #include <string.h> #define ll long long ll gcd(ll a, ll b) { ll s = 1, c; while (a && b) { if ((~a & 1) && (~b & 1)) a >>= 1, b >>= 1, s <<= 1; else if (~a & 1) a >>= 1; else if (~b & 1) b >>= 1; else if...
[["-", 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, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 7, 8, 7, 15, 16, 12, 13], ["+", 8, 9, 0, 7, 8, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 7, 8, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 7, 8, 7, ...
1
294
#include <bits/stdc++.h> using namespace std; #define sws \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define ll long ...
#include <bits/stdc++.h> using namespace std; #define sws \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define ll long ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
1
418
#include <bits/stdc++.h> const int N = 11000; const int N2 = 110; int cnt[N], dp[N2][N2][N2]; int n; void dfs(int x, int y, int z) { int sum = x * x + y * y + z * z + x * y + x * z + y * z; if (sum > 1000) return; ++cnt[sum]; if (dp[x + 1][y][z] == -1) { dp[x + 1][y][z] = 0; dfs(x + 1, y, z); ...
#include <bits/stdc++.h> const int N = 11000; const int N2 = 110; int cnt[N], dp[N2][N2][N2]; int n; void dfs(int x, int y, int z) { int sum = x * x + y * y + z * z + x * y + x * z + y * z; if (sum > 10000) return; ++cnt[sum]; if (dp[x + 1][y][z] == -1) { dp[x + 1][y][z] = 0; dfs(x + 1, y, z); ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
299
n=int(input()) a=[0]*100000 for x in range(1,101): for y in range(1,x+1): for z in range(1,y+1): if x==y: if y==z: ans=1 else: ans=3 else: if y==z: ans=3 else: ans=6 a[(x+y+z)**2-(x*y+y*z+z*x)-1]=ans for i in range(n): p...
n=int(input()) a=[0]*100000 for x in range(1,101): ans=0 for y in range(1,x+1): for z in range(1,y+1): if x==y: if y==z: ans=1 else: ans=3 else: if y==z: ans=3 else: ans=6 a[(x+y+z)**2-(x*y+y*z+z*x)-1]+=ans for i in rang...
[["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107]]
5
127
N = int(input()) Pls = [0]*(10**4+1) for x in range(1,101): for y in range(1,101): for z in range(1,101): k = x**2+y**2+z**2+x*y+y*z+z*x if k <= 10**4: Pls[k] = Pls[k] + 1 Pls.pop(0) for i in range(N+1): print(Pls[i])
N = int(input()) Pls = [0]*(10**4+1) for x in range(1,101): for y in range(1,101): for z in range(1,101): k = x**2+y**2+z**2+x*y+y*z+z*x if k <= 10**4: Pls[k] = Pls[k] + 1 Pls.pop(0) for i in range(N): print(Pls[i])
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
117
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(obj) (obj).begin(), (obj).end() #define debug(var) \ do { \ ...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(obj) (obj).begin(), (obj).end() #define debug(var) \ do { \ ...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
501
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; i <= (n); ++i) #define Sort(Array) sort(Array.begin(), Array.end()) #define Reverse(a) reverse(a.begin(), a.end()) #define out(ans) cout << ans << endl; int main() ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; i <= (n); ++i) #define Sort(Array) sort(Array.begin(), Array.end()) #define Reverse(a) reverse(a.begin(), a.end()) #define out(ans) cout << ans << endl; int main() ...
[["-", 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
228
#include <math.h> #include <stdio.h> #include <string.h> int a[1100]; 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, x, y, z; scanf("%d", &N); int i, cnt = 0, calc; for (x = 1; x <= N; x++) { for (y = 1; y < N; y++) { for (z = 1; z <= N; z+...
#include <math.h> #include <stdio.h> #include <string.h> int a[11000]; long f(int x, int y, int z) { return x * x + y * y + z * z + x * y + y * z + z * x; } int main() { long N, x, y, z; scanf("%ld", &N); long i, cnt = 0, calc; for (x = 1; x <= N; x++) { for (y = 1; y < N; y++) { for (z = 1; z <= ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3...
0
184
// // AISing 2020 // C // #include <algorithm> #include <cassert> #include <cmath> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <tuple> #include <vector> using namespace std; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #d...
// // AISing 2020 // C // #include <algorithm> #include <cassert> #include <cmath> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <tuple> #include <vector> using namespace std; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #d...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 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
282
import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { // Your code here! Scanner sc = new Scanner(System.in); String N = sc.nextLine(); int Nint = Integer.parseInt(N); int[] ans = new int[100000]; for (int x = 1; x <= 100; x++)...
import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { // Your code here! Scanner sc = new Scanner(System.in); String N = sc.nextLine(); int Nint = Integer.parseInt(N); int[] ans = new int[100000]; for (int x = 1; x <= 100; x++)...
[["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499]]
3
209
#include <algorithm> #include <iostream> #include <math.h> using namespace std; int main() { int n; int f[10005] = {0}; // (x+y)^2 + (y+z)^2 + (x+z)^2 = 2n cin >> n; for (int x = 1; x < 142; x++) { if (x * x > 2 * n) break; for (int y = 1; y < 142; y++) { if ((x + y) * (x + y) > 2 * n) ...
#include <algorithm> #include <iostream> #include <math.h> using namespace std; int main() { int n; int f[10005] = {0}; // (x+y)^2 + (y+z)^2 + (x+z)^2 = 2n cin >> n; for (int x = 1; x < 142; x++) { if (x * x > 2 * n) break; for (int y = 1; y < 142; y++) { if ((x + y) * (x + y) > 2 * n) ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
218
import java.math.*; import java.util.*; import java.util.function.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = Integer.valueOf(s.next()); int[] ret = new int[N + 1]; for (int x = 1; x < 32; x++) { for (int y = 1; y < 32; y++) { ...
import java.math.*; import java.util.*; import java.util.function.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = Integer.valueOf(s.next()); int[] ret = new int[N + 1]; for (int x = 1; x < 100; x++) { for (int y = 1; y < 100; y++) { ...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 499], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 499], ["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 499], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 499], ["-", 8, 196, 0, 57, 75, 196, 0, 116, 0, 117], ["+", 8, 196, 0, 57, 75, 196, 0, 93, 0, 94]]
3
228
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(100000); for (int i = 1; i <= 41; i++) { for (int j = 1; j <= 41; j++) { for (int k = 1; k <= 41; k++) { A.at(i * i + j * j + k * k + i * j + j * k + k * i)++; } } } for (int i = 1; i <= N; ...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(100000); for (int i = 1; i <= 102; i++) { for (int j = 1; j <= 102; j++) { for (int k = 1; k <= 102; k++) { A.at(i * i + j * j + k * k + i * j + j * k + k * i)++; } } } for (int i = 1; i <=...
[["-", 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]]
1
133
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll powk(ll a, ll n = 2) { ll r = 1; for (ll i = 0; i < n; i++) { r *= a; } return r; } int main() { ll n; cin >> n; vector<ll> a(n + 10); for (ll i = 1; i <= n; i++) { for (ll j = i; j <= n; j++) { for (ll k = j; k ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll powk(ll a, ll n = 2) { ll r = 1; for (ll i = 0; i < n; i++) { r *= a; } return r; } int main() { ll n; cin >> n; vector<ll> a(n + 10); for (ll i = 1; i <= n; i++) { for (ll j = i; j <= n; j++) { for (ll k = j; k ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
307
#include <bits/stdc++.h> using namespace std; #define optimizar_io \ ios_base::sync_with_stdio(false); \ cin.tie(0); typedef long long int ll; map<ll, ll> freq; ll f(ll x, ll y, ll z) { return x * x + y * y + z *...
#include <bits/stdc++.h> using namespace std; #define optimizar_io \ ios_base::sync_with_stdio(false); \ cin.tie(0); typedef long long int ll; map<ll, ll> freq; ll f(ll x, ll y, ll z) { return x * x + y * y + z *...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
235
#include <bits/stdc++.h> using namespace std; #define ll long long int long long int arr[10005]; int main() { ll n; cin >> n; for (long long int i = 1; i <= 50; i++) { for (long long int j = 1; j <= 50; j++) { for (long long int k = 1; k <= 50; k++) { ll val = i * i + j * j + k * k + i * j + j ...
#include <bits/stdc++.h> using namespace std; #define ll long long int long long int arr[10005]; int main() { ll n; cin >> n; for (long long int i = 1; i <= 100; i++) { for (long long int j = 1; j <= 100; j++) { for (long long int k = 1; k <= 100; k++) { ll val = i * i + j * j + k * k + i * j +...
[["-", 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]]
1
152
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; // change null_type here for map/set typedef tree<int, null_typ...
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; // change null_type here for map/set typedef tree<int, null_typ...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29]]
1
372
import itertools n=int(input()) a=[0]*n b=[] for i in range(1,45): b.append(i) lst=list(itertools.product(b,repeat=3)) for i in range(len(lst)): x,y,z=lst[i][0],lst[i][1],lst[i][2] c=(x+y+z)**2-(x*y+y*z+z*x) if c<=n: a[c-1]+=1 for i in range(n): print(a[i])
import itertools n=int(input()) a=[0]*n b=[] for i in range(1,101): b.append(i) lst=list(itertools.product(b,repeat=3)) for i in range(len(lst)): x,y,z=lst[i][0],lst[i][1],lst[i][2] c=(x+y+z)**2-(x*y+y*z+z*x) if c<=n: a[c-1]+=1 for i in range(n): print(a[i])
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
145
def s(): return input() def i(): return int(input()) def S(): return input().split() def I(): return map(int,input().split()) def X(): return list(input()) def L(): return list(input().split()) def l(): return list(map(int,input().split())) count = 0 ans = 0 N = i() L = [0]*N for x in range(1,100): for y in rang...
def s(): return input() def i(): return int(input()) def S(): return input().split() def I(): return map(int,input().split()) def X(): return list(input()) def L(): return list(input().split()) def l(): return list(map(int,input().split())) count = 0 ans = 0 N = i() L = [0]*N for x in range(1,100): for y in rang...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 75, 665, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107]]
5
237
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <list> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; int calc(int i) { double lim = sqrt((double)i); int ilim = (int)lim + 1; int val; int ans = 0; // �l���S������ for (i...
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <list> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; int calc(int i) { double lim = sqrt((double)i); int ilim = (int)lim + 1; int val; int ans = 0; // �l���S������ for (i...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
366
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; void Main() { int n; cin >> n; vector<int> ans(n + 1, 0); // for(int a = 1; a <= n; a++){ // int ans = 0; for (int i = 1; i <= 50; i++) { ...
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; void Main() { int n; cin >> n; vector<int> ans(n + 1, 0); // for(int a = 1; a <= n; a++){ // int ans = 0; for (int i = 1; i <= 100; i++) { ...
[["-", 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]]
1
270
def getN(): return int(input()) def getNM(): return map(int, input().split()) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(input()) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): return random.randint(ran1,...
def getN(): return int(input()) def getNM(): return map(int, input().split()) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(input()) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): return random.randint(ran1,...
[["-", 0, 57, 15, 666, 0, 657, 31, 657, 12, 612], ["+", 0, 57, 15, 666, 0, 657, 31, 657, 12, 612]]
5
420
#include <stdio.h> int main(void) { int n, x = 0, y = 0, z = 0, count = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { for (x = 1;; x++) { for (y = x;; y++) { for (z = y;; z++) { if ((x + y) * (x + y) + (y + z) * (y + z) + (z + x) * (z + x) == 2 * i) { // ...
#include <stdio.h> int main(void) { int n, x = 0, y = 0, z = 0, count = 0; scanf("%d", &n); for (int i = 1; i < n + 1; i++) { for (x = 1;; x++) { for (y = x;; y++) { for (z = y;; z++) { if ((x + y) * (x + y) + (y + z) * (y + z) + (z + x) * (z + x) == 2 * i) { ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
255
#include <cmath> #include <iomanip> #include <iostream> #include <utility> #include <vector> using namespace std; int main() { int N; cin >> N; int count[10001] = {}; int temp = 0; for (int x = 1; x < 101; ++x) { for (int y = 1; y < 101; ++y) { for (int z = 1; z < 101; ++z) { temp = x * ...
#include <cmath> #include <iomanip> #include <iostream> #include <utility> #include <vector> using namespace std; int main() { int N; cin >> N; int count[10001] = {}; int temp = 0; for (int x = 1; x < 101; ++x) { for (int y = 1; y < 101; ++y) { for (int z = 1; z < 101; ++z) { temp = x * ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
195
N = int(input()) results = [0] * N def g(x, y, z): return x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x for x in range(1,32): for y in range(1, 32): for z in range(1, 32): w = g(x,y,z) if w > N: break results[w - 1] += 1 for result in results: print(result)
N = int(input()) results = [0] * N def g(x, y, z): return x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): w = g(x,y,z) if w > N: break else: results[w - 1] += 1 for result in results: print(result)
[["-", 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, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102]]
5
112
N = int(input()) A = [0] * (10**4) import math import numpy tmp=0 for i in range(1,int(math.sqrt(N))): for j in range(1,int(math.sqrt(N))): for k in range(1,int(math.sqrt(N))): tmp=(i+j+k)**2-(i*j+j*k+i*k) if tmp<=10**4: A[tmp]+=1 for p in A[1:N+1]: print(p)
N = int(input()) A = [0] * (10**4+1) import math import numpy tmp=0 for i in range(1,int(math.sqrt(N))): for j in range(1,int(math.sqrt(N))): for k in range(1,int(math.sqrt(N))): tmp=(i+j+k)**2-(i*j+j*k+i*k) if tmp<=10**4: A[tmp]+=1 for p in A[1:N+1]: print(p)
[["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612]]
5
134
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[100000]; for (int i = 1; i <= n; ++i) a[i] = 0; for (int i = 1; i <= 10; ++i) for (int j = 1; j <= 10; ++j) for (int k = 1; k <= 10; ++k) ++a[i * i + j * j + k * k + i * k + j * k + i * j]; for (int i = 1; i <...
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[100000]; for (int i = 1; i <= n; ++i) a[i] = 0; for (int i = 1; i <= 100; ++i) for (int j = 1; j <= 100; ++j) for (int k = 1; k <= 100; ++k) ++a[i * i + j * j + k * k + i * k + j * k + i * j]; for (int i = 1; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 7, 8, 7, 15, 16, 12, 13], ["+", 8, 9, 0, 7, 8, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 7, 8, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 7, 8, 7, 15, 16, 12, 13]]
1
142
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, temp; cin >> n; int arr[1005] = {0}; for (int i = 1; i < 100; ++i) { for (int j = 1; j < 100; ++j) { for (int k = 1; k < 100; ++k) { ...
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, temp; cin >> n; int arr[10005] = {0}; for (int i = 1; i < 100; ++i) { for (int j = 1; j < 100; ++j) { for (int k = 1; k < 100; ++k) { ...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 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
169
N=int(input()) dp=[0]*(10**4+1) for i in range(1,100+1): for j in range(1,100+1): for k in range(1,100+1): a=(i+j)**2+(k+j)**2+(i+k)**2 if 10**4<a: break dp[a//2]+=1 for l in range(1,N+1): print(dp[l])
N=int(input()) dp=[0]*(10**4+1) for i in range(1,100+1): for j in range(1,100+1): for k in range(1,100+1): a=(i+j)**2+(k+j)**2+(i+k)**2 if 10**4<a//2: break dp[a//2]+=1 for l in range(1,N+1): print(dp[l])
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 676], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
117
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> ans(n + 1, 0); for (int x = 1; x * x <= n; x++) { for (int y = 1; y * y <= n; y++) { for (int z = 1; z * z <= n; z++) { int num = x * x + y * y + z * z + x * y + y * z + z * x; ans[num]++; } ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> ans(1000000, 0); for (int x = 1; x * x <= n; x++) { for (int y = 1; y * y <= n; y++) { for (int z = 1; z * z <= n; z++) { int num = x * x + y * y + z * z + x * y + y * z + z * x; ans[num]++; }...
[["-", 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
144
#include <bits/stdc++.h> using namespace std; #define pi acos(-1.0) #define MOD 1000000007 #define pb push_back #define cy cout << "Yes\n" #define cn cout << "No\n" typedef unsigned long long int ull; typedef long long int ll; int a[500005]; const int M = 1e4; ll cnt[M]; int main() { int n; cin >> n; for (int i ...
#include <bits/stdc++.h> using namespace std; #define pi acos(-1.0) #define MOD 1000000007 #define pb push_back #define cy cout << "Yes\n" #define cn cout << "No\n" typedef unsigned long long int ull; typedef long long int ll; int a[500005]; const int M = 1e4; ll cnt[M]; int main() { int n; cin >> n; for (int i ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
181
N=int(input()) ans = [0]*N for x in range(1,101): for y in range(1,101): for z in range(1, 101): n = x**2 + y**2 + z**2 + x*y + y*z + z*x if N > n: ans[n-1] += 1 for i in ans: print(i)
N=int(input()) ans = [0]*N for x in range(1,101): for y in range(1,101): for z in range(1, 101): n = x**2 + y**2 + z**2 + x*y + y*z + z*x if N >= n: ans[n-1] += 1 for i in ans: print(i)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
92
#include <bits/stdc++.h> using namespace std; int main(void) { long long N; cin >> N; vector<long long> f(N); for (long long n = 1; n <= N; n++) { if (n == 6) { cout << 1 << endl; continue; } long long count = 0; long long sqrtn = sqrt(n); for (long long x = 1; x <= sqrtn; x...
#include <bits/stdc++.h> using namespace std; int main(void) { long long N; cin >> N; vector<long long> f(N); for (long long n = 1; n <= N; n++) { if (n == 6) { cout << 1 << endl; continue; } long long count = 0; long long sqrtn = sqrt(n); for (long long x = 1; x <= sqrtn; x...
[["-", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
226
n = int(input()) a = [0] * 20000 for x in range(1, 20): for y in range(1, 20): for z in range(1, 20): i = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x a[i] += 1 print('\n'.join(map(str, a[1:n + 1])))
n = int(input()) a = [0] * 60001 for x in range(1, 101): for y in range(1, 101): for z in range(1, 101): i = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x a[i] += 1 print('\n'.join(map(str, a[1:n + 1])))
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 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]]
5
99
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main() { int n; cin >> n; vector<int> ans(1001, 0); for (int x = 1; x <= 100; x++) { for (int y = 1; y <= 100; y++) { for (int z = 1; z <= 100; z++) { int m = x * x + y * y...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main() { int n; cin >> n; vector<int> ans(10001, 0); for (int x = 1; x <= 100; x++) { for (int y = 1; y <= 100; y++) { for (int z = 1; z <= 100; z++) { int m = x * x + y * ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
157
import sys from math import ceil, floor, sqrt, sin, cos, pi from itertools import accumulate, permutations, combinations from math import gcd # 最大公約数 from collections import deque, Counter from operator import itemgetter from heapq import heappop,heappush sys.setrecursionlimit(10**7) def lcm(x, y): return ((x * y) // g...
import sys from math import ceil, floor, sqrt, sin, cos, pi from itertools import accumulate, permutations, combinations from math import gcd # 最大公約数 from collections import deque, Counter from operator import itemgetter from heapq import heappop,heappush sys.setrecursionlimit(10**7) def lcm(x, y): return ((x * y) // g...
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
196
import itertools n = int(input()) cnt = [0] * (10 ** 4 + 1) for x, y, z in itertools.product(range(1, 10 ** 2), repeat=3): idx = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x if idx <= 10 ** 4: cnt[idx] += 1 for num in cnt[1:]: print(num)
import itertools n = int(input()) cnt = [0] * (10 ** 4 + 1) for x, y, z in itertools.product(range(1, 10 ** 2), repeat=3): idx = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x if idx <= 10 ** 4: cnt[idx] += 1 for num in cnt[1 : n + 1]: print(num)
[["+", 0, 7, 12, 206, 206, 663, 0, 657, 31, 22], ["+", 0, 7, 12, 206, 206, 663, 0, 657, 17, 72], ["+", 0, 7, 12, 206, 206, 663, 0, 657, 12, 612]]
5
99
from math import sqrt l = [-1]+[0]*10**4 n = int(input()) for i in range(1,int(sqrt(n))+1): for j in range(1,int(sqrt(n))+1): for k in range(1,int(sqrt(n))+1): ans = i**2+j**2+k**2+i*j+j*k+k*i if ans <= 10*4: l[ans] += 1 for i in range(1,n+1): print(l[i])
from math import sqrt l = [-1]+[0]*10**4 n = int(input()) for i in range(1,int(sqrt(n))+2): for j in range(1,int(sqrt(n))+2): for k in range(1,int(sqrt(n))+2): ans = i**2+j**2+k**2+i*j+j*k+k*i if ans <= 10**4: l[ans] += 1 for i in range(1,n+1): print(l[i])
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 48], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 578]]
5
137
#include <iostream> using namespace std; int main(void) { int x, y, z, n, a[10010], temp; cin >> n; for (x = 1; x <= n; x++) { a[x] = 0; } for (x = 1; x * x < n; x++) { for (y = 1; y * y < n; y++) { for (z = 1; z * z < n; z++) { temp = x * x + y * y + z * z + x * y + y * z + z * x; ...
#include <iostream> using namespace std; int main(void) { int x, y, z, n, a[10010], temp; cin >> n; for (x = 1; x <= n; x++) { a[x] = 0; } for (x = 1; x * x < n; x++) { for (y = 1; y * y < n; y++) { for (z = 1; z * z < n; z++) { temp = x * x + y * y + z * z + x * y + y * z + z * x; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
177
n = int(input()) li = [0]*n for i in range(1,32): for j in range(1,32): for k in range(1,32): if i**2 + j**2 + k**2 + i*j + j*k + k*i <= n: li[i**2 + j**2 + k**2 + i*j + j*k + k*i -1] += 1 for i in range(n): print(li[i])
n = int(input()) li = [0]*n for i in range(1,100): for j in range(1,100): for k in range(1,100): if i**2 + j**2 + k**2 + i*j + j*k + k*i <= n: li[i**2 + j**2 + k**2 + i*j + j*k + k*i -1] += 1 for i in range(n): print(li[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]]
5
117
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> ans(n, 0); 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 f = i * i + j * j + k * k + i * j + j * k + k * i - 1; ans[f]++; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> ans(100000, 0); 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 f = i * i + j * j + k * k + i * j + j * k + k * i - 1; ans[f]++; ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
147