submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s705029805
p04031
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int N; cin>>N; int a[N]; int cost[200]={0}; for(int i=0;i<N;i++)cin>>a[N]; for(int i=-100;i<=100;i++){ for(int j=0;j<N;j++)cost[i+100]+=(a[j]-i)*(a[j]-i); } cout<<min_element(cost[0],cost[199])<<endl; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from...
s178379815
p04031
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int N; cin>>N; int a[N]; int cost[200]={0}; for(int i=0;i<N;i++)cin>>a[N]; for(int i=-100;i<=100;i++){ for(int j=0;j<N;j++)cost[i+100]+=(a[j]-i)*(a[j]-i); } cout<<min_element(cost.begin(),cost.end())<<endl; }
a.cc: In function 'int main()': a.cc:13:26: error: request for member 'begin' in 'cost', which is of non-class type 'int [200]' 13 | cout<<min_element(cost.begin(),cost.end())<<endl; | ^~~~~ a.cc:13:39: error: request for member 'end' in 'cost', which is of non-class type 'int [200]'...
s607833363
p04031
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int N; cin>>N; int a[N]; int cost[200]={0}; for(int i=0;i<N;i++)cin>>a[N]; for(int i=-100;i<=100;i++){ for(int j=0;j<N;j++)cost[i+100]+=(a[j]-i)*(a[j]-i); } cout<<cost.min()<<endl; }
a.cc: In function 'int main()': a.cc:13:14: error: request for member 'min' in 'cost', which is of non-class type 'int [200]' 13 | cout<<cost.min()<<endl; | ^~~
s372472771
p04031
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int N; cin>>N; int a[N]; int cost[200]={0}; for(int i=0;i<N;i++)cin>>a[N]; for(int i=-100;i<=100;i++){ for(int j=0;j<N;j++)cost+=(a[j]-i)*(a[j]-i); } cout<<cost.min()<<endl; }
a.cc: In function 'int main()': a.cc:11:29: error: incompatible types in assignment of 'int' to 'int [200]' 11 | for(int j=0;j<N;j++)cost+=(a[j]-i)*(a[j]-i); | ~~~~^~~~~~~~~~~~~~~~~~~ a.cc:13:14: error: request for member 'min' in 'cost', which is of non-class type 'int [200]' 13...
s399097892
p04031
Java
public class Main { public static void main(String[] args) { Scanner stdin =new Scanner(System.in); int n=stdin.nextInt(); int a[]=new int [n]; int i; for(i=0;i<n;i++){ a[i]=stdin.nextInt(); } int max=-300,min=300; for(i=0;i<n;i++){ if(max<a[i]) max=a[i]; if(min>a[i]) min=a[i]; } i...
Main.java:3: error: cannot find symbol Scanner stdin =new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner stdin =new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s974523257
p04031
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define INF (1<<30) #define INFLL (1ll<<60) typedef pair<ll, int> P; #define MOD (1000000007ll) ll sq(ll x){ return x*x; } int main(void){ int n,i; ll a[123],tmp,ans=INFLL,mx=-INFLL,mn=INFLL,j; cin >> n; for(i=0; i<n; ++i){ cin >> a[i]; mn =...
a.cc: In function 'int main()': a.cc:22:15: error: cannot resolve overloaded function 'min' based on conversion to type 'll' {aka 'long long int'} 22 | for(j=min; j<max; ++j){ | ^~~ a.cc:22:21: error: invalid operands of types 'll' {aka 'long long int'} and '<unresolved overloaded functio...
s070444518
p04031
C++
#include <iostream> #include <string> #include <algorithm> #include <cmath> #include <vector> #define size_t int using namespace std; typedef unsigned long ul; typedef unsigned long long ull; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; std::cin >> n; vector<int> a(n,0); for (size_t i ...
a.cc: In function 'int main()': a.cc:26:11: error: 'accumulate' was not declared in this scope 26 | int c = accumulate(a.begin(),a.end(), 0); | ^~~~~~~~~~
s346004608
p04031
C
#include <iostream> #include <string> #include <algorithm> #include <cmath> #include <vector> #define size_t int using namespace std; typedef unsigned long ul; typedef unsigned long long ull; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; std::cin >> n; vector<int> a(n,0); for (size_t i ...
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s426138665
p04031
C++
#include <iostream> #include <string> #include <algorithm> #include <cmath> #include <vector> #define size_t int using namespace std; typedef unsigned long ul; typedef unsigned long long ull; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; std::cin >> n; vector<int> a(n,0); for (size_t i ...
a.cc: In function 'int main()': a.cc:26:11: error: 'accumulate' was not declared in this scope 26 | int c = accumulate(a.begin(),a.end(), 0); | ^~~~~~~~~~
s172026051
p04031
C++
#include<math.h> using namespace std; int main() { // your code goes here int n,i,b,sum; double k; cin>>n; int a[n]; sum=0; for(i=0;i<n;i++) { cin>>a[i]; sum+=a[i]; } k=(double)sum/n; b=round(k); sum=0; for(i=0;i<n;i++) { sum+=(b-a[i])*(b-a[i]); } cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'cin' was not declared in this scope 8 | cin>>n; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include<math.h> +++ |+#include <iostream> 2 | using name...
s073351763
p04031
Java
import java.util.Scanner; public class ProblemC { public static int max_a (int[] array) { int val = array[0]; for (int i = 1; i < array.length; i++) { val = Math.max(val, array[i]); } return val; } public static int min_a (int[] array) { int val = arra...
Main.java:3: error: class ProblemC is public, should be declared in a file named ProblemC.java public class ProblemC { ^ 1 error
s035153941
p04031
C++
#include <cmath> #include <iostream> using namespace std; int main(void) { int N, a[100], cost, mincost = INT_MAX, max = 0, min = INT_MAX; cin >> N; for (int i = 0; i < N; i++) { cin >> a[i]; if (max < a[i]) max = a[i]; if (min > a[i]) min = a[i]; } for (int i = min; i <= max; i++) {...
a.cc: In function 'int main()': a.cc:7:34: error: 'INT_MAX' was not declared in this scope 7 | int N, a[100], cost, mincost = INT_MAX, max = 0, min = INT_MAX; | ^~~~~~~ a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <...
s798699743
p04031
C++
#include <iostream> using namespace std; int a[105]; int n, ll, rr; long res = 105 * 105; long check(long value) { long ret = 0; for (int i = 0; i < n; ++i) ret += (a[i] - value) * (a[i] - value); return ret; } int main() { ll = 105; rr = -105; cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; if...
a.cc: In function 'int main()': a.cc:33:34: error: lvalue required as increment operand 33 | for (int i = -1000; i <= 1000 ++i) | ^~~~ a.cc:33:41: error: expected ';' before 'i' 33 | for (int i = -1000; i <= 1000 ++i) | ...
s239232991
p04031
C++
#include <iostream> #include <set> using namespace std; int n, a[110]; set<int> st; int ab, ad; inline p(int x, int y) { return (x-y)*(x-y); } int main() { cin >> n; int sum = 0; st.clear(); for (int i = 0; i < n; ++ i) { cin >> a[i]; if (st.find(a[i]) == st.end()) sum += a[i]; ...
a.cc:9:8: error: ISO C++ forbids declaration of 'p' with no type [-fpermissive] 9 | inline p(int x, int y) { | ^
s970927354
p04031
C
#include<cstdio> #include<algorithm> using namespace std; int main() { int t; int a[110]; int sum; while(~scanf("%d",&t)) { sum=0; for(int i=0;i<t;i++) { scanf("%d",&a[i]); sum+=a[i]; } int ans=0; if(sum%t==0) { ...
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s703288806
p04031
C
#include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> using namespace std; int min(int x,int y) { return x>y?y:x; } int main() { int n; int a[205]; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&a[i]); sort(a,a+n); int ans=80000; int sum; for(int i=a[0];i<a[n-1];i++) { sum=0; for(...
main.c:3:9: fatal error: iostream: No such file or directory 3 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s854064749
p04031
C++
#include <stdio.h> int n; int m; int ans; int a[101]; int main(){ scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&a[i]); m+=a[i]; } if(m>0){ m=(m*10/n+5)/10; }else if(m<0){ m=(m*10/n-5)/10; }else if(m==0){ m=(m*10/n)/10; } for(int i=0;i<n;i++){ if(a[i]<m){ ans+=(m-a[i])*(m-a[i]); }else if(a[...
a.cc: In function 'int main()': a.cc:28:18: error: expected '}' at end of input 28 | return 0; | ^ a.cc:7:11: note: to match this '{' 7 | int main(){ | ^
s364090593
p04031
C++
#include <iostream> #include <vector> #include <map> #include <algorithm> #include <string> #include <cmath> #include <stack> #include <queue> #include <list> #include <set> using namespace std; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() #define itr(i, x) for(auto i = (x).begin()...
a.cc: In function 'int main()': a.cc:27:26: error: 'accumulate' was not declared in this scope 27 | double sum = (double)accumulate(all(an), 0); | ^~~~~~~~~~
s463549312
p04031
C++
#include <iostream> #include <vector> #include <map> #include <algorithm> #include <string> #include <cmath> #include <stack> #include <queue> #include <list> #include <set> using namespace std; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() #define itr(i, x) for(auto i = (x).begin()...
a.cc: In function 'int main()': a.cc:27:18: error: 'accumulate' was not declared in this scope 27 | double sum = accumulate(all(an), 0); | ^~~~~~~~~~
s436387979
p04031
C++
import java.util.*; // ABC 43-C // http://abc043.contest.atcoder.jp/tasks/arc059_a public class Main { public static void main (String[] args) throws java.lang.Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] nums = new int[n]; int sum = 0; for (int ...
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: expected unqualified-id before 'public' 6 | public class Main { | ^~~~~~
s378968379
p04031
C++
#include <iostream> #include<algorithm> using namespace std; int main() { int n,i,a[100],sum=0,num=0,res=0; cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } if (sum % n == 0) num = sum / n; else num = sum / n + 1; for (i = 0; i < n; i++) res += (int)pow((num - a[i]), 2); cout ...
a.cc: In function 'int main()': a.cc:20:29: error: 'pow' was not declared in this scope 20 | res += (int)pow((num - a[i]), 2); | ^~~
s767871790
p04031
C++
#include <iostream> #define FOR(i, begin, end) for(int i = (begin); i < (end); i++) #define REP(i, end) FOR(i, 0, end) using namespace std; int main(){ int size; cin >> size; int* p = new int[size]; REP(i, size) cin >> p[i]; int min, max; min = max = p[0]; int minAmount, maxAmount; //最小値、最大値がいくつあるか m...
a.cc: In function 'int main()': a.cc:49:30: error: 'pow' was not declared in this scope 49 | cost += (int)pow(p[i] - target, 2); | ^~~
s441762657
p04031
C++
#include <iostream> #include <vector> using namespace std; int main() { int N; int ave = 0, ans = 0; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a[i]; ave += a[i]; } ave = round(double(ave) / double(N)); for (int i = 0; i < N; i++) { ans += pow(a[i] - ave, 2); } cout << ans ...
a.cc: In function 'int main()': a.cc:19:15: error: 'round' was not declared in this scope 19 | ave = round(double(ave) / double(N)); | ^~~~~ a.cc:23:24: error: 'pow' was not declared in this scope 23 | ans += pow(a[i] - ave, 2); | ^~~
s543014776
p04031
C++
#include <iostream> #include <algorithm> #define MAX 100 using namespace std; int a[MAX]; int main() { int n, minv, maxv; cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; if (i == 0) { minv = a[i]; maxv = a[i]; } else { if (minv > a[i]) minv = a[i]; if (maxv < a[i]) maxv = a[i]; } } ...
a.cc: In function 'int main()': a.cc:35:25: error: 'LONG_MAX' was not declared in this scope 35 | cout << (res == LONG_MAX ? 0 :res) << endl; | ^~~~~~~~ a.cc:3:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #...
s058691040
p04031
C++
#include <iostream> #include <algorithm> #define MAX 100 using namespace std; int a[MAX]; int main() { int n, minv, maxv; cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; if (i == 0) { minv = a[i]; maxv = a[i]; } else { if (minv > a[i]) minv = a[i]; if (maxv < a[i]) maxv = a[i]; } } ...
a.cc: In function 'int main()': a.cc:23:35: error: 'LONG_MAX' was not declared in this scope 23 | long long cost = 0, res = LONG_MAX; | ^~~~~~~~ a.cc:3:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 |...
s502927202
p04031
C++
q
a.cc:1:1: error: 'q' does not name a type 1 | q | ^
s133945155
p04031
C
#include<stdio.h> #include<math.h> int main(void){ int N, a, i; unsigned long sum=0, ss=0, x; scanf("%d", &N); for(i = 0; i < N; i++){ scanf("%d", &a); sum += a; ss += a*a; } x = (int)floor(((double)sum)/N+0.5) printf("%lu\n", x*(N*x-2*sum)+ss); return 0; }
main.c: In function 'main': main.c:13:44: error: expected ';' before 'printf' 13 | x = (int)floor(((double)sum)/N+0.5) | ^ | ; 14 | printf("%lu\n", x*(N*x-2*sum)+ss); | ~~~~~~ ...
s878823233
p04031
C
#include<stdio.h> #include<stdlib.h> #include<limits.h> int main(void){ int N, *a, i, j, dif; unsigned long sum, min=ULONG_MAX; scanf("%d", &N); a = (int *)malloc(N*sizeof(int)); for(i = 0; i < N; i++){ scanf("%d" a+i); } for(i = (-100); i <=100 ; i++){ sum = 0; for(...
main.c: In function 'main': main.c:11:19: error: expected ')' before 'a' 11 | scanf("%d" a+i); | ~ ^~ | )
s784874756
p04031
C++
n = input() arr = map(int, raw_input().split()) if n == 1: print 0 else: mid = (arr[0] + arr[-1])/2 ans = 0 for e in arr: ans += (e-mid)**2 print ans
a.cc:1:1: error: 'n' does not name a type 1 | n = input() | ^
s421425398
p04031
C++
#include <iostream> using namespace std; int main(void){ int n, a[100], ans = 0; double sum = 0; cin >> n; for (int i = 0; i < n; i++){ cin >> a[i]; sum += a[i]; } sum /= n; sum = round(sum); for (int i = 0; i < n; i++){ ans += pow(((int)sum - a[i]), 2); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:15: error: 'round' was not declared in this scope 14 | sum = round(sum); | ^~~~~ a.cc:17:24: error: 'pow' was not declared in this scope 17 | ans += pow(((int)sum - a[i]), 2); | ^~~
s905648928
p04031
C++
//Be together #include <stdio.h> #include <stdlib.h> #include <math.h> int calcCost(int * array, int size, int y){ int sum = 0; for(int x = 0; x < size; x++){ sum += ((array[x] - y)*(array[x] - y)); } return sum; } int main(){ int n; scanf("%d",&n); int * arr = malloc(n*sizeof(int)); sca...
a.cc: In function 'int main()': a.cc:17:22: error: invalid conversion from 'void*' to 'int*' [-fpermissive] 17 | int * arr = malloc(n*sizeof(int)); | ~~~~~~^~~~~~~~~~~~~~~ | | | void*
s366572730
p04031
C++
#include <iostream> #include <vector> #include <cmath> #include <string> #include <algorithm> #include <numeric> using namespace std; vector<int> v; long long sum = INT_MAX; int n; long long cal(int k) { long long sum = 0; for (int i = 0; i < n; i++) { sum += pow(k - v[i], 2); } return sum; } int main() { ...
a.cc:9:17: error: 'INT_MAX' was not declared in this scope 9 | long long sum = INT_MAX; | ^~~~~~~ a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 6 | #include <numeric> +++ |+#include <climits> 7 | using namespace st...
s458123108
p04031
C++
#include<iostream> using namespace std; int main() { int n,min,max; min = 100; max = -100; cin >> n; int *a=new int [n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] > max) { max = a[i]; } if (a[i] < min) { min = a[i]; } } if (min == max) { cout << 0 << endl; } else { double mid =...
a.cc: In function 'int main()': a.cc:26:21: error: 'modf' was not declared in this scope 26 | b = modf(mid, &c); | ^~~~ a.cc:41:36: error: 'pow' was not declared in this scope 41 | double e = pow((a[i] - mid), 2); | ...
s535519675
p04031
C++
#define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define INF INT_MAX/3 #define PB push_back #define MP make_pair #define ALL(a) (a).begin(),(a).end() #define SET(a,c) memset(a,c,sizeof a) ...
a.cc: In function 'int main()': a.cc:6:13: error: 'INT_MAX' was not declared in this scope 6 | #define INF INT_MAX/3 | ^~~~~~~ a.cc:46:18: note: in expansion of macro 'INF' 46 | int last_sum = INF; | ^~~ a.cc:34:1: note: 'INT_MAX' is defined in header '<climits>'; this ...
s667196192
p04031
C++
#include<iostream> #include<vector> using namespace std; int main(int argc, char const *argv[]) { std::vector<int> v(100),costs(201); int n,i,k; cin>>n; for(i=0;i<n;i++){ cin>>v[i]; } for (i=-100; i <= 100; i++) { for (k = 0; k < n; i++) { costs[i+100]+=((i-v[k])*(i-v[k])); } } cou...
a.cc: In function 'int main(int, const char**)': a.cc:20:10: error: 'min_element' was not declared in this scope 20 | cout<<*min_element(costs.begin(),costs.end()); | ^~~~~~~~~~~
s884081286
p04031
C++
#include<iostream> #include<vector> using namespace std; int main(int argc, char const *argv[]) { std::vector<int> v(100),costs(201); int n,i,k; cin>>n; for(i=0;i<n;i++){ cin>>v[i]; } for (i=-100; i <= 100; i++) { for (k = 0; k < n; i++) { costs[i+100]+=(i-v[k])**2; } } cout<<*cost...
a.cc: In function 'int main(int, const char**)': a.cc:16:30: error: invalid type argument of unary '*' (have 'int') 16 | costs[i+100]+=(i-v[k])**2; | ^~ a.cc:20:16: error: 'class std::vector<int>' has no member named 'min_element' 20 | cout<<*costs.min_element(); |...
s703889440
p04031
C++
#include <iostream> #include <vector> using namespace std; const int INF = 1e9 + 10; int main() { int N; cin >> N; vector<int> an(N); int l = INF, r = -INF, c; for (int i = 0; i < N; i++) { int a; cin >> a; an[i] = a; l = min(l, an[i]); r = max(r, an[i]); } int s = INF; for...
a.cc: In function 'int main()': a.cc:29:18: error: expected ';' before '}' token 29 | s = min(s, t) | ^ | ; 30 | } | ~
s050799931
p04031
C
#include<stdio.h> #include<stdlib.h> #include<math.h> int main() { int loop; int N; int *a; int x, y; int sum; int best; scanf("%d", &N); a = malloc(sizeof(int)*N); best = INT_MAX; for (loop = 0; loop < N; loop++) { scanf("%d", &a[loop]); } for (x = -100; x <= 100; x++) { sum = 0; for (y = 0; y < N;...
main.c: In function 'main': main.c:15:16: error: 'INT_MAX' undeclared (first use in this function) 15 | best = INT_MAX; | ^~~~~~~ main.c:4:1: note: 'INT_MAX' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>' 3 | #include<math.h> +++ |+#incl...
s013962640
p04031
C
#include<stdio.h> #include<stdlib.h> #include<math.h> int main() { int loop; int N; int *a; int x, y; int sum = 0; int best = 0; scanf("%d", &N); a = malloc(sizeof(int)*N); for (loop = 0; loop < N; loop++) { scanf("%d", &a[loop]); } for (x = 1, x <= 100; x++) { for (y = 0; y < N; y++) { sum += pow(...
main.c: In function 'main': main.c:19:34: error: expected ';' before ')' token 19 | for (x = 1, x <= 100; x++) { | ^ | ;
s955556943
p04031
C++
#include<iostream> #include<cstdio> #include<string> #include<algorithm> #include<cstring> #include<vector> using namespace std; #define INT(x) int x; scanf("%d",&x) #define INPUT(x) scanf("%d",&x) #define REP1(x,n) for(int x = 0; x < n; x++) #define REP2(x,s,e) for(int x = s; x <= e; x++) #define BR printf("\n") #defi...
a.cc: In function 'int rec2(int*, int)': a.cc:24:19: error: no matching function for call to 'min(int, <unresolved overloaded function type>)' 24 | mini = min(rec(A,N,i),min); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c+...
s756875133
p04031
C++
#include<iostream> #include<cstdio> #include<string> #include<algorithm> #include<cstring> #include<vector> using namespace std; #define INT(x) int x; scanf("%d",&x) #define INPUT(x) scanf("%d",&x) #define REP1(x,n) for(int x = 0; x < n; x++) #define REP2(x,s,e) for(int x = s; x <= e; x++) #define BR printf("\n") #defi...
a.cc: In function 'int rec(int*, int, int)': a.cc:16:5: error: 'sum' was not declared in this scope 16 | sum = 0; | ^~~ a.cc: In function 'int rec2(int*, int)': a.cc:24:19: error: no matching function for call to 'min(int, <unresolved overloaded function type>)' 24 | mini = min(rec(A,N,i),mi...
s417002142
p04031
C++
#include <iostream> #include <vector> #include <cstdio> typedef long long ll; using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) int main(void){ int n; cin >> n; vector<int> v(n); rep(i, n) cin >> v[i]; ll sum = 1e9; for (int i = -100; i <= 100 ; ++i){ ll tmp = 0; rep(j, n){ tmp += pow((i - v[j])...
a.cc: In function 'int main()': a.cc:16:32: error: 'pow' was not declared in this scope 16 | tmp += pow((i - v[j]), 2); | ^~~
s455819478
p04031
C++
#include <iostream> #include <vector> #include <cstdio> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) int main(void){ int n; cin >> n; vector<int> v(n); rep(i, n) cin >> v[i]; ll sum = 1e9; for (int i = -100; i <= 100 ; ++i){ ll tmp = 0; rep(j, n){ tmp += pow((i - v[j]), 2); } sum = min(...
a.cc: In function 'int main()': a.cc:11:9: error: 'll' was not declared in this scope 11 | ll sum = 1e9; | ^~ a.cc:13:19: error: expected ';' before 'tmp' 13 | ll tmp = 0; | ^~~~ | ; a.cc:15:25: error: 'tmp' was not declared in ...
s971075481
p04031
C++
#include <iostream> #include <numeric> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; long long int s = 0; int t; vector<int> x; for (int i = 0; i < n; i++) { cin >> t; x.push_back(t); } int m = INT_MAX; for (int i = -100; i < 101; i++) { m = min(m, accumulate...
a.cc: In function 'int main()': a.cc:18:17: error: 'INT_MAX' was not declared in this scope 18 | int m = INT_MAX; | ^~~~~~~ a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 4 | #include <algorithm> +++ |+#include <...
s475199134
p04031
C++
#include<iostream> #include<vector> using namespace std; int main(){ int n; cin >> n; vector<int> a(n); int sum = 0; for(int i = 0; i < n; i++){ cin >> a[i]; sum += a[i]; } int min = INT_MAX; for(int p = 0; p <= 1; p++){ int ave = sum / n + p; int ans = 0; for(int i = 0; i < n; i++)...
a.cc: In function 'int main()': a.cc:14:13: error: 'INT_MAX' was not declared in this scope 14 | int min = INT_MAX; | ^~~~~~~ a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include<vector> +++ |+#include <climits> ...
s772561975
p04031
C++
#include <string> #include <iostream> using namespace std; int main() { int a,e,f; cin >> a; int b[a]; int c = 0; double d=0,g=a; while (a > c) { cin >> b[c]; c = c + 1; } c = 0; while (a > c) { d = d + b[c]; c = c + 1; } d = d / g; if (d>=0)f = d + 0.5; else d = d*(-1), f = d + 0.5, f = f*(-1); ...
a.cc:29:1: error: extended character   is not valid in an identifier 29 |   return 0; | ^ a.cc:29:1: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:29:1: error: '\U00003000\U00003000return' was not declared in this scope 29 |   return 0; | ^~~~~~~~~~
s644615339
p04031
C++
#include <iostream> #include <string> #include <vector> using namespace std; int main(){ int n,a,sum=0,ave,ans=0,temp=0; vector<int> v; cin >> n; for(int i = 0; i < n; i++){ cin >> a; v.push_back(a); sum+=a; } ave=sum/n; for(int i = 0; i < n; i++){ ans += (v[i]-ave)*(v[i]-ave); } for(...
a.cc: In function 'int main()': a.cc:19:22: error: expected primary-expression before ';' token 19 | for(int i = 0; i < ; i++){ | ^ a.cc:26:22: error: expected primary-expression before ';' token 26 | for(int i = 0; i < ; i++){ | ^
s387440429
p04031
C++
#include <iostream> #include <vector> #include <numeric> #include <algorithm> using namespace std; int main() { int N; cin >> N; int min, max, ans; vector<int> A; for (int i = 0; i < N; i++) { int tmp; cin >> tmp; A.push_back(tmp); } ans = INT_MAX; min = *min_element(A.b...
a.cc: In function 'int main()': a.cc:19:11: error: 'INT_MAX' was not declared in this scope 19 | ans = INT_MAX; | ^~~~~~~ a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 4 | #include <algorithm> +++ |+#include <climits> ...
s597340342
p04031
C++
#include <iostream> #include <string> #include <vector> using namespace std; int main(){ int n,a,sum=0,ave,ans=0,temp=0; vector<int> v; cin >> n; for(int i = 0; i < n; i++){ cin >> a; v.push_back(a); sum+=a; } ave=sun/n; for(int i = 0; i < n; i++){ ans += (v[i]-ave)*(v[i]-ave); } for(...
a.cc: In function 'int main()': a.cc:15:7: error: 'sun' was not declared in this scope; did you mean 'sum'? 15 | ave=sun/n; | ^~~ | sum
s603950725
p04031
C++
#include <iostream> ##include <string> #include <vector> using namespace std; int main(){ int n,a,sum=0,ave,ans=0,temp=0; vector<int> v; cin >> n; for(int i = 0; i < n; i++){ cin >> a; v.push_back(a); sum+=a; } ave=sun/n; for(int i = 0; i < n; i++){ ans += (v[i]-ave)*(v[i]-ave); } for...
a.cc:2:1: error: stray '##' in program 2 | ##include <string> | ^~ a.cc:2:3: error: 'include' does not name a type 2 | ##include <string> | ^~~~~~~ In file included from /usr/include/c++/14/vector:66, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h: In static member function 's...
s971452721
p04031
C++
#include <iostream> #include <math.h> using namespace std; int main(void){ int n; int max = 0; int min = 1000; int cost = 10000000; cin >> n; int arrray[n]; for(int i=0;i<n;i++){ cin >> arrray[i]; if(arrray[i] > max){ max = arrray[i]; ...
a.cc:21:21: error: extended character   is not valid in an identifier 21 | if(arrray[i] < min ){ | ^ a.cc: In function 'int main()': a.cc:21:21: error: expected ')' before '\U00003000' 21 | if(arrray[i] < min ){ | ~ ^~ | )...
s959279405
p04031
C++
#include <iostream> #include <math.h> using namespace std; int main(void){ int n; int max = 0; int min = 1000; int cost = 10000000; cin >> n; int arrray[n]; for(int i=0;i<n;i++){ cin >> arrray[i]; if(arrray[i] > max){ max = arrray[i]; ...
a.cc:21:21: error: extended character   is not valid in an identifier 21 | if(arrray[i] < min ){ | ^ a.cc: In function 'int main()': a.cc:21:21: error: expected ')' before '\U00003000' 21 | if(arrray[i] < min ){ | ~ ^~ | )...
s261863452
p04031
C++
#include <iostream> #include <string> #include <vector> using namespace std; int main(){ int n,a,sum=0,ave,ans=0; vector<int> v; cin >> n; for(int i = 0; i < n; i++){ cin >> a; v.push_back(a); sum+=a; } ave=sun/n; for(int i = 0; i < n; i++){ ans += (v[i]-ave)*(v[i]-ave); } cout << ans...
a.cc: In function 'int main()': a.cc:15:7: error: 'sun' was not declared in this scope; did you mean 'sum'? 15 | ave=sun/n; | ^~~ | sum
s950724315
p04031
C++
#include <iostream> ##include <string> #include <vector> using namespace std; int main(){ int n,a,sum=0,ave,ans=0; vector<int> v; cin >> n; for(int i = 0; i < n; i++){ cin >> a; v.push_back(a); sum+=a; } ave=sun/n; for(int i = 0; i < n; i++){ ans += (v[i]-ave)*(v[i]-ave); } cout << an...
a.cc:2:1: error: stray '##' in program 2 | ##include <string> | ^~ a.cc:2:3: error: 'include' does not name a type 2 | ##include <string> | ^~~~~~~ In file included from /usr/include/c++/14/vector:66, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h: In static member function 's...
s957777078
p04031
Java
import java.util.ArrayList; import java.util.List; import java.util.Scanner; import static java.lang.Math.round; public class Math{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int inputCount = sc.nextInt(); List<Integer> inputList = new ArrayList<Integer>(); for(int i=0;i<i...
Main.java:6: error: class Math is public, should be declared in a file named Math.java public class Math{ ^ 1 error
s787611363
p04031
C++
#include <iostream> #include<string> #include<vector> using namespace std; int calCost(vector<int>& nums, int i){ int ans = 0; for (auto& elem : nums){ ans += (elem - i)*(elem - i); } return ans; } int main() { int N,t,max=-100,min=100,minCost=INT_MAX; vector<int> nums; cin >> N; for (int i = 0; i < N; ++i){ ...
a.cc: In function 'int main()': a.cc:14:42: error: 'INT_MAX' was not declared in this scope 14 | int N,t,max=-100,min=100,minCost=INT_MAX; | ^~~~~~~ a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits...
s995346026
p04031
Java
import java.util.Arrays; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int num[] = new int[n]; int total = 0; for (int i = 0; i < n; i++) { int m = sc.nextInt(); ...
Main.java:4: error: class C is public, should be declared in a file named C.java public class C { ^ 1 error
s400734331
p04031
Java
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Math { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int inputCount = sc.nextInt(); List<Integer> inputList = new ArrayList<Integer>(); for(int i=0;i<inputCount;i++){ inputList.add(sc...
Main.java:5: error: class Math is public, should be declared in a file named Math.java public class Math { ^ Main.java:21: error: cannot find symbol int ave = (int)Math.ceil((double)sum/(double)inputCount); ^ symbol: method ceil(double) location: class Math 2 errors
s656624652
p04031
C++
import numpy as np N = int(raw_input()) a = np.array(map(int, raw_input().split())) cost = [] for y in xrange(a.min(), a.max() + 1): cost.append(np.sum((a - y) ** 2)) print min(cost)
a.cc:1:1: error: 'import' does not name a type 1 | import numpy as np | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s302726718
p04031
C
#include<stdio.h> int main(void){ int s[102],a[12]; int i,n,t=0,c=0,g,h,r=0,e=0; for(i=0,I<n,i++){ scanf("%d",&s[i]); t+=s[i]; } g=t/n; h=t/n; for(i=0;i<n;i++){ r+=(s[i]-g)*(s[i]-g); e+=(s[i]-h)*(s[i]-h); } if(r>e)printf("%d\n",e); else printf("%d\n",r); return 0; }
main.c: In function 'main': main.c:5:9: error: 'I' undeclared (first use in this function) 5 | for(i=0,I<n,i++){ | ^ main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in main.c:5:16: error: expected ';' before ')' token 5 | for(i=0,I<n,i++){ | ...
s418874382
p04031
C
#include<stdio.h> int main(void){ int s[12],a[12]; int i,n,t=0,c=0,g,h,r=0,e=0; for(i=0,I<n,i++){ scanf("%d",&s[i]); t+=s[i]; } g=t/n; h=t/n; for(i=0;i<n;i++){ r+=(s[i]-g)*(s[i]-g); e+=(s[i]-h)*(s[i]-h); } if(r>e)printf("%d\n",e); else printf("%d\n",r); return 0; }
main.c: In function 'main': main.c:5:9: error: 'I' undeclared (first use in this function) 5 | for(i=0,I<n,i++){ | ^ main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in main.c:5:16: error: expected ';' before ')' token 5 | for(i=0,I<n,i++){ | ...
s182459012
p04031
Java
import java.util.*; import java.lang.Math; public class Main{ public static void main(String[] args){ Scanner x= new Scanner(System.in); int c= x.nextInt(); int[] arr = new int[c]; double a =0; for(int i =0;i<c;i++){ arr[i]=x.nextInt(); a += arr[i]; } int a1 = a/c; int a2 = a1 +1; int r1=0; for(int i =0;i<c;i++)...
Main.java:15: error: incompatible types: possible lossy conversion from double to int int a1 = a/c; ^ Main.java:27: error: cannot find symbol r2 += Math.pow(arr[i]-a2 , 2); ^ symbol: variable r2 location: class Main Main.java:30: error: cannot find symbol System.out.prinln(Math.min(r1,r2)); ...
s209805321
p04031
C++
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <iomanip> #include <sstream> #include <fstream> #include <string> #include <vector> #include <deque> #include <queue> #include <stack> #include <set> #include <map> #include <algorithm> #include <functional> #include <utility> #include <bitset> #include <cmat...
a.cc: In function 'int main()': a.cc:36:22: error: 'INT_MAX' was not declared in this scope 36 | int d, min = INT_MAX; | ^~~~~~~ a.cc:21:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 20 | #include <cstdio> +++ |+#i...
s342518739
p04031
C++
n = int(raw_input()) a = map(int, raw_input().split()) sum = sum(a) if(sum >= 0): ave = int(float(sum) / n + 0.5) else: ave = int(float(sum) / n - 0.5) cost = 0 for item in a: cost += pow(abs(item - ave), 2) print cost,
a.cc:1:1: error: 'n' does not name a type 1 | n = int(raw_input()) | ^
s952491639
p04031
C++
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<bitset> #include<vector> #include<deque> #include<queue> #include<map> #include<set> #include<stack> #include<cmath> #include<iomanip> #include <functional> using namespace std; typedef long long ll; const int mod = 1000...
a.cc: In function 'int main()': a.cc:33:19: error: 'INT_MAX' was not declared in this scope 33 | int ans = INT_MAX; | ^~~~~~~ a.cc:16:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 15 | #include <functional> +++ |+#inc...
s912129313
p04031
C
#include <iostream> using namespace std; int round(double); int main(){ int N; cin >> N; int n; int A=0,B=0; for(int i=0; i<N; i++){ cin >> n; A += n*n; B += n; } double x = (double)B/N; // cout << x << endl; // cout << round(x) << endl; int modify = round(x); cout << N*modify*modify - 2* modify...
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s661190802
p04031
C++
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <ctime> #include <algorithm> #include <cstdlib> #include <utility> #include <vector> #include <iostream> #include <cstring> #include <set> #include <map> #include <string> namespace fastinput { /** Interface */ inline int readChar(); template <class T = in...
a.cc: In function 'int main()': a.cc:106:19: error: 'INT_MAX' was not declared in this scope 106 | int res = INT_MAX; | ^~~~~~~ a.cc:12:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 11 | #include <map> +++ |+#include <...
s211635907
p04032
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int n = s.size(); for(int i = 0; i < n; i++){ if(i < n-1 && s[i] == s[i+1]){ cout << i+1 << " " << i+2 << endl; return; }else if(i < n-2 && s[i] == s[i+2]){ cout << i+1 << " " << i+3 << endl; return; ...
a.cc: In function 'int main()': a.cc:9:7: error: return-statement with no value, in function returning 'int' [-fpermissive] 9 | return; | ^~~~~~ a.cc:12:7: error: return-statement with no value, in function returning 'int' [-fpermissive] 12 | return; | ^~~~~~
s338360490
p04032
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; for(int i = 0; i < s.size(); i++){ if(i < n-1 && s[i] == s[i+1]){ cout << i+1 << " " << i+2 << endl; return; }else if(i < n-2 && s[i] == s[i+2]){ cout << i+1 << " " << i+3 << endl; return; } } cout ...
a.cc: In function 'int main()': a.cc:6:12: error: 'n' was not declared in this scope 6 | if(i < n-1 && s[i] == s[i+1]){ | ^ a.cc:8:7: error: return-statement with no value, in function returning 'int' [-fpermissive] 8 | return; | ^~~~~~ a.cc:11:7: error: return-statement w...
s314004337
p04032
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; string s; int n; int main() { cin >> s; n = s.size(); for (int i = 0; i < n - 1; ++i) for (int j = i + 1; j < i + 3 && j < n; ++j) if (s[j] == s[i]) { cout << i + 1 << ' ' << j + 1 < endl; return 0; } cout << "-1 -1" << endl; }
a.cc: In function 'int main()': a.cc:14:63: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 14 | cout << i + 1 << ' ' << j + 1 < endl; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~...
s216138600
p04032
C++
# include <bits/stdc++.h> # define ll long long # define all(x) x.begin(), x.end() # define fastio ios_base::sync_with_stdio(false); cin.tie(NULL) # define MOD 1000000007 using namespace std; int main(){ //fastio; vector<vector<int>> a(26); char tmp=getchar(); int n=0; while (tmp>='a'&&tmp<='z'){ ...
a.cc: In function 'int main()': a.cc:40:2: error: expected '}' at end of input 40 | } | ^ a.cc:9:11: note: to match this '{' 9 | int main(){ | ^
s826484452
p04032
C++
include <iostream> #include <string> using namespace std; typedef long long ll; int main(){ string S; cin >> S; for(ll i = 1; i < S.size(); i++){ if(S[i]==S[i-1]){ if(i==S.size() - 1){ cout << i - 1 << " " << i + 1 << endl; return 0; } else{ cout << i << " " << i + 1<< endl; return 0...
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a typ...
s641553500
p04032
C++
#include<bits/stdc++.h> using namespace std; int arr[1000 * 100 + 1][26]; vector<int > indexes[26]; int main() { string str; cin >> str; int n = str.length(); for(int i = 0; i < n; i++) { int curr = str[i] - 'a'; if(i > 0) { arr[i][curr] += (arr[i-1][curr] + 1); } else { arr[i][curr]++; ...
a.cc: In function 'int main()': a.cc:29:35: error: cannot convert 'std::vector<int>' to 'int' in initialization 29 | int it = indexes[k]; | ~~~~~~~~~^ | | | std::vector<int>
s657114051
p04032
C++
#include<bits/stdc++.h> using namespace std; int arr[1000 * 100 + 1][26]; vector<int > indexes[26]; int main() { string str; cin >> str; int n = str.length(); for(int i = 0; i < n; i++) { int curr = str[i] - 'a'; if(i > 0) { arr[i][curr] += (arr[i-1][curr] + 1); } else { arr[i][curr]++; ...
a.cc: In function 'int main()': a.cc:30:37: error: no match for 'operator-' (operand types are 'int' and 'std::vector<int>') 30 | int len = i - it + 1; | ~ ^ ~~ | | | | in...
s081606575
p04032
C++
const int N = 2e3 + 7, M = N * 3; int n; modint f[M][M<<1], ans; int main() { rd(n), rd(P), n *= 3; f[0][M] = 1; for (int i = 0; i < n; i++) for (int j = -i; j <= i; j++) { f[i+1][j+1+M] += f[i][j+M]; f[i+2][j-1+M] += f[i][j+M] * (i + 1); f[i+3][j+M] += f[i][j+M] * (i + 1) * (i + 2); } for (int j = 0; ...
a.cc:3:1: error: 'modint' does not name a type 3 | modint f[M][M<<1], ans; | ^~~~~~ a.cc: In function 'int main()': a.cc:5:9: error: 'rd' was not declared in this scope 5 | rd(n), rd(P), n *= 3; | ^~ a.cc:5:19: error: 'P' was not declared in this scope 5 | rd(n), rd(P), n...
s495447449
p04032
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<int> vi; int main() { ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); string s; cin >> s; if(s.length() == 2) { if(s[i] == s[i + 1]) cout << i + 1 << " " << i + 2 <...
a.cc: In function 'int main()': a.cc:15:22: error: 'i' was not declared in this scope 15 | if(s[i] == s[i + 1]) cout << i + 1 << " " << i + 2 << endl; | ^
s674989261
p04032
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < n; ++i) using namespace std; typedef long long ll; typedef pair<int,int> P; const int INF=1001001001; int main(){ string s; cin>>s; int n; n=s.size(); vector<int>v(n); //bool check=false; ll ans=-1; if (n==2){ if (s[0]==s[1]){ co...
a.cc: In function 'int main()': a.cc:23:15: error: expected primary-expression before '<<' token 23 | cout<<1-<<" "<<-1; | ^~
s233291831
p04032
C++
#include <iostream> #include <stdio.h> #include <algorithm> #include <math.h> #include <list> #include <string> #include <map> #include <vector> #include <stack> #include <queue> #include <iomanip> // setprecisionを使用するのに必要 cout << fixed << setprecision(15) << p でpを小数点以下15桁表示 using namespace std; #define REPD(i, a, b) f...
a.cc: In function 'int main()': a.cc:28:14: error: 'i' was not declared in this scope 28 | if(S[i] == S[i+1]){ | ^
s102340214
p04032
C++
#include<bits/stdc++.h> using namespace std; int main() { char a[100005]; gets(a); int n=strlen(a); int p=0; for(int i=0; i<n-2; i++) { if(a[i]==a[i+1] || a[i]==a[i+2] || a[i+1]==a[i+2]) { p=i+1; break; } } if(p != 0) printf("%d...
a.cc: In function 'int main()': a.cc:7:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(a); | ^~~~ | getw
s462350351
p04032
C++
#include"bits/stdc++.h" #include <string> using namespace std; using ll = long long int; using ull = unsigned long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; #define int ll const double PI = acos(-1.0); const int MOD = (int)pow(10, 9) + 7; #define YES(n) cout << ((n) ? "Y...
a.cc: In constructor 'BitFlag::BitFlag(ull)': a.cc:96:126: error: no matching function for call to 'std::exception::exception(const char*)' 96 | throw std::exception(("ビットフラグは64bitまでしか対応してない 指定された数=" + to_string(n)).c_str()); | ...
s767677953
p04032
C++
#include"bits/stdc++.h" #include <string> using namespace std; using ll = long long int; using ull = unsigned long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; #define int ll const double PI = acos(-1.0); const int MOD = (int)pow(10, 9) + 7; #define YES(n) cout << ((n) ? "Y...
a.cc: In constructor 'BitFlag::BitFlag(ull)': a.cc:96:121: error: no matching function for call to 'std::exception::exception(const char*)' 96 | throw exception(("ビットフラグは64bitまでしか対応してない 指定された数=" + to_string(n)).c_str()); | ...
s977112311
p04032
C
#include<stdio.h> int main(){ char s[100001] = {'\0'}; scanf("%s", s); int size, i, flag; flag = -1; int a[26] = {0}; for(i = 0; s[i+1] != '\0'; i++){ if(s[i] == s[i+1]) break; if(s[i+2] == '\0') flag++; }; for(i = 0; s[i+2] != '\0'; i++){ if(s[i] == s[i+2]) break; if(s[i+3] == '\0') flag++; }; if(fl...
main.c: In function 'main': main.c:18:34: error: expected ';' before '}' token 18 | printf("-1 -1\n") | ^ | ; 19 | }else{ | ~
s302732150
p04032
C++
//#define _GLIBCXX_DEBUG #include<bits/stdc++.h> #define PI 3.14159265359 using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) const long long INF= 1e+18+1; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll> >vvl; typedef pair<ll,ll> P; typedef tuple<ll,ll,ll> T; const ll MOD=1000...
a.cc: In function 'int main()': a.cc:17:9: error: 'n' was not declared in this scope 17 | rep(i,n-1){ | ^ a.cc:5:43: note: in definition of macro 'rep' 5 | #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) | ^ a.cc:23:9: error: 'n' was not declared...
s677140116
p04032
C++
#include<bits/stdc++.h> using namespace std; int main() { while(t--) { string s; cin>>s; int flag = 1; for(int i=0;i<s.length()-1;i++) { if(s[i]==s[i+1]) { cout<<i+1<<" "<<i+2<<endl; flag = 0; break; ...
a.cc: In function 'int main()': a.cc:5:11: error: 't' was not declared in this scope; did you mean 'tm'? 5 | while(t--) | ^ | tm
s292542064
p04032
C++
int main(){ string s; cin >> s; if (s.size()==2){ if (s.at(0)==s.at(1)){ cout << 1 << " " << 2 << endl; } else { cout << -1 << " " << -1 << endl; } return 0; } for (int i=0; i<s.size()-2; i++){ if (s.at(i)==s.at(i+1) || s.at(i+1)==s.at(...
a.cc: In function 'int main()': a.cc:2:5: error: 'string' was not declared in this scope 2 | string s; | ^~~~~~ a.cc:3:5: error: 'cin' was not declared in this scope 3 | cin >> s; | ^~~ a.cc:3:12: error: 's' was not declared in this scope 3 | cin >> s; | ^ a....
s864252882
p04032
C++
#include <iostream> int main() { string s; std::cin >> s; int i; for (i = 0; i < s.size() - 2; i++) { if (s[i] == s[i + 1] || s[i] == s[i + 2]) { break; } } if (i == s.size() - 2) std::cout << -1 << " " << -1; else std::cout << i << " " << i + 2; return 0;...
a.cc: In function 'int main()': a.cc:5:5: error: 'string' was not declared in this scope 5 | string s; | ^~~~~~ a.cc:5:5: note: suggested alternatives: In file included from /usr/include/c++/14/iosfwd:41, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostre...
s798071227
p04032
C++
#include <iostream> int main() { string s; std::cin >> s; int i; for (i = 0; i < s.size() - 2; i++) { if (s[i] == s[i + 1] || s[i] == s[i + 2]) { break; } } if (i == s.size() - 2) std::cout << -1 << " " << -1; else std::cout << i << " " << i + 2; return 0;...
a.cc: In function 'int main()': a.cc:5:5: error: 'string' was not declared in this scope 5 | string s; | ^~~~~~ a.cc:5:5: note: suggested alternatives: In file included from /usr/include/c++/14/iosfwd:41, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostre...
s337024514
p04032
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; for(int i = 1; i < s.size(); ++i) { if(s[i] == s[i-1]){ cout << i << " " << i+1 << "\n"; return 0; } } if(s.size() >= 3){ for(int i = 2; i < n; ++i){ if(s[i] == s[i-2]){ cout << i-1 << " " ...
a.cc: In function 'int main()': a.cc:17:28: error: 'n' was not declared in this scope 17 | for(int i = 2; i < n; ++i){ | ^
s516231543
p04032
Java
public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); String n = scn.next(); boolean feka = false; int nigger1=-1; int nigger2=-1; for(int i = 0;i<n.length()-2;i++) { if(n.charAt(i)==n.charAt(i+2)) { feka = true; nigger1=i+1; nigger2=i+3; brea...
Main.java:3: error: cannot find symbol Scanner scn = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner scn = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s125230705
p04032
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int n = s.length(); for(int i=0;i<n-3;i++){ if(s[i]==s[i+1]){ if(s[i]==s[i+3]){ cout << i+1 << " " << i+4 << endl; return 0; } else if(s[i]==s[...
a.cc:38:5: error: redefinition of 'int main()' 38 | int main(){ | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main(){ | ^~~~
s250941307
p04032
C++
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; int idx[27], pre[27]; int main() { string s; cin>>s; int n =s.size(); vector<int> ans={-1, -1}; for (int i = 0; i < 26; ++i) { int minv1 = 0; int minv2 = INT_MAX; int idx1= 0; i...
a.cc: In function 'int main()': a.cc:15:17: error: 'INT_MAX' was not declared in this scope 15 | int minv2 = INT_MAX; | ^~~~~~~ a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 5 | #include <algorithm> +++ |+#include <...
s498719453
p04032
C++
import java.io.BufferedReader; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws java.lang.Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Solver s = new Solver(); System.out.print(s.solve(br.readLine())); } } class Solver { ...
a.cc:2:1: error: 'import' does not name a type 2 | import java.io.BufferedReader; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.io.InputStreamReader; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available wit...
s808310926
p04032
C++
#include<iostream> #include<string> using namespace std; int beki(int a,int b){ int ans=1; for(int i=0;i<b;i++){ ans=ans*a; } return ans; } int main(){ string a; cin>>a; int t=a.length(); for(int i-0;i<t-2;i++){ if(a[i]==a[i+1]){cout<<i<<" "<<i+1<<endl;return 0;} if(a[i]==a[i+2]){cout<<i<<" "<<i+2<<endl;return 0...
a.cc: In function 'int main()': a.cc:16:10: error: expected ';' before '-' token 16 | for(int i-0;i<t-2;i++){ | ^ | ; a.cc:16:18: error: expected ')' before ';' token 16 | for(int i-0;i<t-2;i++){ | ~ ^ | ) a.cc:16:19: error: 'i' was not dec...
s247393616
p04032
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ string s; cin>>s; int len=s.length(); int index=-1; for(int i=0;i<len-1;i++){ if(s[i]==s[i+1]){ index=i; break; } } if(index!=-1) cout<<index+1<<" "<<index+2; else{ ...
a.cc: In function 'int main()': a.cc:25:20: error: 'i' was not declared in this scope 25 | else cout<<i<<" "<<i+2; | ^
s461398198
p04032
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ string s; cin>>s; int len=s.length(); int index=-1; for(int i=0;i<len-1;i++){ if(s[i]==s[i+1]){ index=i; break; } } if(index==-1)cout<<"-1 -1"; else cout<<i+1<<" "<<i+2;...
a.cc: In function 'int main()': a.cc:16:16: error: 'i' was not declared in this scope 16 | else cout<<i+1<<" "<<i+2; | ^
s113726470
p04032
C++
#include <bits/stdc++.h> using namespace std; long long m=1e9+7; long long fact[1000001],inv[1000001]; long long modRecursive(long long a,long long b,long long c) { if(b == 0) return 1; if(b%2 ==0) return modRecursive((a*a)%c,b/2,c); else return ((a%c)*(modRecursive((a*a)%c,b/2,c)))%c; } int main() { int main(...
a.cc: In function 'int main()': a.cc:15:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 15 | int main() | ^~ a.cc:15:13: note: remove parentheses to default-initialize a variable 15 | int main() | ^~ | -- a....
s189953550
p04032
C++
include<iostream> #include<string> #include<vector> #include<algorithm> #include<set> using namespace std; // cin>>n>>k; // cout<<n<<k<<endl; //string S[100]; int main(){ string moji;cin>>moji; bool flag=false; if (moji.size()==2){ if (moji[0]==moji[1]){ cout<<"1 2"<<endl; flag=true; } }else{ int no...
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type...
s841580402
p04032
C++
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <vector> #include <cstdlib> #include <iomanip> #include <cmath> #include <ctime> #include <map> #include <set> #include <queue> #include <stack> using namespace std; #define lowbit(x) (x&(-x)) #define max(x,y) (x>y?x:...
a.cc: In function 'int main()': a.cc:42:7: error: 'i' was not declared in this scope 42 | ;i<s.size()-;i++){ | ^ a.cc:42:18: error: expected primary-expression before ';' token 42 | ;i<s.size()-;i++){ | ^ a.cc:54:10: error: 'flag' was not declared in this scope 54 |...
s453211827
p04032
C++
#include<bits/stdc++.h> using namespace std; int cnt[50]; int pos[50][100002]; char str[100002]; int main(){ // Init for(int i=0;i<50;i++){cnt[i]=0;} // Input cin>>str; for(int i=0;i<strlen(str);i++){ pos[str[i]-'a'][cnt[str[i]-'a']++]=i; } // Solve for(int i='a';i<='z';i++){ int lk=i-'a'; for(int ...
a.cc:33:9: error: 'cout' does not name a type 33 | cout<<"-1 -1"<<endl; | ^~~~ a.cc:34:9: error: expected unqualified-id before 'return' 34 | return(0); | ^~~~~~ a.cc:35:1: error: expected declaration before '}' token 35 | } | ^
s222527070
p04032
C++
#include<bits/stdc++.h> using namespace std; int cnt[50]; int pos[50][100002]; char str[100002]; int main(){ // Init for(int i=0;i<50;i++){cnt[i]=0;} // Input cin>>str; for(int i=0;i<strlen(str);i++){ pos[str[i]-'a'][cnt[str[i]-'a']++]=i; } // Solve for(int i='a';i<='z';i++){ int lk=i-'a'; for(int ...
a.cc: In function 'int main()': a.cc:25:74: error: 'k' was not declared in this scope 25 | cout<<pos[lk][j]+1<<" "<<pos[lk][k]+1<<endl; | ^ a.cc: At global scope: a.cc:33:9: error: 'cout' does not n...