submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s818696282 | p04025 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,cont = 0,res = 0;
cin>>n;
int vals[n];
for (int k = 0; k <n;k++){
cin >> vals[k];
cont += vals[k];
}
//cout<<cont<<endl;
cont = round((float)cont/(float)n);
//cout<<cont<<endl;
for (int k = 0; k <n;k++){
res += (cont-vals[k])*(cont-vals[k]);... | a.cc:20:2: error: stray '#' in program
20 | }#include<bits/stdc++.h>
| ^
a.cc:20:3: error: 'include' does not name a type
20 | }#include<bits/stdc++.h>
| ^~~~~~~
a.cc:23:5: error: redefinition of 'int main()'
23 | int main(){
| ^~~~
a.cc:4:5: note: 'int main()' previously defined here
... |
s791474349 | p04025 | C++ | #include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#define INF 1000000000
#define MOD 1000000007
using namespace std;
int main()
{
int n;
int a[105];
int cost;
int minv = INF;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
... | a.cc: In function 'int main()':
a.cc:26:44: error: expected ';' before '}' token
26 | cost += (a[j] - i) * (a[j] - i)
| ^
| ;
27 | }
| ~
|
s258689617 | p04025 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int n;
cin >> n;
vector<int> a(n);
for(auto& x : a) cin >> x;
int mn = *min_element(a.begin(), a.end());
int mx = *max_element(a.begin(), a.end());
ll ans = 0;
ll sum = 0, sum2 = 0;
for(auto x : a) sum... | a.cc: In function 'int main()':
a.cc:12:3: error: 'll' was not declared in this scope
12 | ll ans = 0;
| ^~
a.cc:13:5: error: expected ';' before 'sum'
13 | ll sum = 0, sum2 = 0;
| ^~~~
| ;
a.cc:14:19: error: 'sum' was not declared in this scope
14 | for(auto x : a) sum += x, ... |
s288113943 | p04025 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int n;
cin >> n;
vector<int> a(n);
for(auto& x : a) cin >> x;
int mn = min_element(a.begin(), a.end());
int mx = max_element(a.begin(), a.end());
int ans = 0;
int sum = 0, sum2 ... | a.cc: In function 'int main()':
a.cc:15:23: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
15 | int mn = min_element(a.begin(), a.end());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
| |
| __gnu_... |
s563136941 | p04025 | C++ | #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
#define MAXN 105
int n,a[MAXN];
int solve(){
int totalcost;
int cost=INT_MAX;
for(int i=a[0];i<a[n];++i){
totalcost=0;
for(int j=1;j<=n;++j){
totalcost+=(a[j]-i)*(a[j]-i);
}
cost=min(cost,totalcost);
}
return cost;
}
int main(){... | a.cc: In function 'int solve()':
a.cc:9:18: error: 'INT_MAX' was not declared in this scope
9 | int cost=INT_MAX;
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include<cmath>
+++ |+#include <cli... |
s249975910 | p04025 | C++ | #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mn = 105;
int a[mn];
int main()
{
int n, i, l = 1 << 30, r = -(1 << 30);
scanf("%d", &n);
for(i = 1; i <= n; i++)
scanf("%d", &a[#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mn = 105;
int ... | a.cc:12:32: error: stray '#' in program
12 | scanf("%d", &a[#include<cstdio>
| ^
a.cc: In function 'int main()':
a.cc:12:33: error: 'include' was not declared in this scope
12 | scanf("%d", &a[#include<cstdio>
| ... |
s513492686 | p04025 | C++ | #include <iostream>
#include <algorithm>
#include <array>
#include <cmath>
#include <string>
using namespace std;
long long main() {
long long n,sum=0;
cin>>n;
long long input[n]={0};
for(long long i=0;i<n;i++){
cin>>input[i];
sum=sum+input[i];
}
long long midpt = (double)ceil(double(sum)/n);
long long cost... | cc1plus: error: '::main' must return 'int'
|
s913221369 | p04025 | C++ | //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <... | a.cc: In function 'int main()':
a.cc:85:5: error: 'else' without a previous 'if'
85 | else cout << min;
| ^~~~
|
s797545816 | p04025 | C++ | #include <cstdio>
#include <vector>
using namespace std;
int main()
{
int no_of_elements;
scanf("%d", &no_of_elements);
vector <int> A(no_of_elements + 1);
double sum = 0;
for(int i = 1; i <= no_of_elements; i++)
{
scanf("%d", &A[i]);
sum += a_i;
}
float mean = sum/n... | a.cc: In function 'int main()':
a.cc:17:16: error: 'a_i' was not declared in this scope
17 | sum += a_i;
| ^~~
|
s211964833 | p04025 | Java | public static void main(String[] args){
Scanner in=new Scanner(System.in);
int N=in.nextInt();
int[] arr=new int[N];
for (int i=0;i<N;i++){
arr[i]=in.nextInt();
}
int change=200*200*100;
for (int i=-100;i<=100;i++){
int temp=0;
for (int j=0;j<N;j++){
temp+=(i-arr[j])*(i-arr[j]);
}
if (t... | Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args){
^
(use --enable-preview to enable unnamed classes)
1 error
|
s396657047 | p04025 | C++ | #include <iostream>
using namespace std;
int main(){
int n,k[112345],sum=0,ans=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>k[i];
sum+=k[i];
}
if(sum%n==0) ave=sum/n;
else ave=sum/n+1;
for(int i=0;i<n;i++){
ans+=(k[i]-ave)*(k[i]-ave);
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:10:16: error: 'ave' was not declared in this scope
10 | if(sum%n==0) ave=sum/n;
| ^~~
a.cc:11:8: error: 'ave' was not declared in this scope
11 | else ave=sum/n+1;
| ^~~
a.cc:14:16: error: 'ave' was not declared in this scope
14 | a... |
s405592817 | p04025 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main() {
int a;
cin >> a;
int a[100];
for (int i = 0;i < n;i++)cin >> a[i];
int sq[201];
for (int i = 0;i <= 100;i++)sq[i] = i * i;
int m = 1000000;
sort(a, a + n);
for (int i = a[0];i <= a[n - 1];i++) {
int cost = 0;
for (int j = 0;j < n;j++... | a.cc: In function 'int main()':
a.cc:8:13: error: conflicting declaration 'int a [100]'
8 | int a[100];
| ^
a.cc:6:13: note: previous declaration as 'int a'
6 | int a;
| ^
a.cc:9:28: error: 'n' was not declared in this scope
9 | for (int i = 0;i < ... |
s277762172 | p04025 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#define lamba ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define all(x) x.begin(), x.end()
using namespace std;
const int zyan = 1e2 + 1;
int n, a[105], mn = zyan, mx = -zyan;
int fast() {
cin >> n;
for(int i=1;i<=n;i++){
cin >> a[i];
mn = min(mn, a[i]);... | a.cc: In function 'int fast()':
a.cc:44:1: warning: no return statement in function returning non-void [-Wreturn-type]
44 | }
| ^
a.cc: In function 'int main()':
a.cc:55:9: error: 'll' was not declared in this scope; did you mean 'all'?
55 | ll ans = 1e18;
| ^~
| all
a.cc... |
s114141695 | p04025 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[99], b[99], c[199], d, e, f, N;
cin >> N;
for(int i = 0; i < 100; i++)a[i] = 0;
for(int j = 0; j < 100; j++)b[j] = 0;
for(int k = 0; k < 200; k++)c[k] = 0;
for(int l = 0; l < N; l++){
cin >> a[l];
if(l == 0){
d = a[l];
e = a[l];
}
if(d >... | a.cc: In function 'int main()':
a.cc:22:20: error: expected primary-expression before '<' token
22 | for(int m = d; m =< e; m++){
| ^
|
s691799138 | p04025 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[99], b[99], e[99], N, c, d, f, g, p;
cin >> N;
for(int m = 0; m < N; m++)e[m] = 0;
for(int h = 0; h < N; h++)b[h] = 0;
for(int i = 0; i < N; i++){
a[i] = 0;
cin >> a[i];
}
for( int o = 0; o < N; j++){
f = a[o];g = a[o]
if(o = 0){
g = f; p =... | a.cc: In function 'int main()':
a.cc:12:25: error: 'j' was not declared in this scope
12 | for( int o = 0; o < N; j++){
| ^
a.cc:13:20: error: expected ';' before 'if'
13 | f = a[o];g = a[o]
| ^
| ;
14 | if(o = 0){
| ~... |
s175882269 | p04025 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[99], b[99], e[99], N, c, d;
for(int m = 0; m < N; m++)e[m] = 0;
for(int h = 0; h < N; h++)b[h] = 0;
cin >> N;
for(int i = 0; i < N; i++){
a[i]= 0;
cin >> a[i];
}
for( int j = 0; j < N; j++){
for( int k = -100; k < 101; k++){
for(int n = 0; ... | a.cc: In function 'int main()':
a.cc:15:14: error: lvalue required as left operand of assignment
15 | (a[n] - k)*(a[n] - k) = b[n];
| ~~~~~~~~~~^~~~~~~~~~~
|
s998537276 | p04025 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[99], b[99], e[99], N, c, d;
for(int m = 0; m < N; m++)e[m] = 0;
for(int h = 0; h < N; h++)b[h] = 0;
cin >> N;
for(int i = 0; i < N; i++){
a[i]= 0;
cin >> a[i];
}
for( int j = 0; j < N; j++){
for( int k = -100; k < 101; k++){
(a[j] - k)*(a[j]... | a.cc: In function 'int main()':
a.cc:14:14: error: lvalue required as left operand of assignment
14 | (a[j] - k)*(a[j] - k) = b[j];
| ~~~~~~~~~~^~~~~~~~~~~
|
s747263181 | p04025 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[99], b[99], e[99], N, c, d;
for(int m = 0; m < N; m++)e[m] = 0;
for(int h = 0; h < N; h++)b[h] = 0;
cin >> N;
for(int i = 0; i < N; i++){
a[i]= 0;
cin >> a[i];
}
for( int k = -100; k < 101; k++){
for( int j = 0; j < N; j++){
(a[j] - k)*(a[j]... | a.cc: In function 'int main()':
a.cc:14:14: error: lvalue required as left operand of assignment
14 | (a[j] - k)*(a[j] - k) = b[j];
| ~~~~~~~~~~^~~~~~~~~~~
a.cc:19:7: error: 'l' was not declared in this scope
19 | if( l == 0){
| ^
|
s890429959 | p04025 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[99], b[99], N, c, d;
for(int h = 0; h < N; h++)b[h] = 0;
cin >> N;
for(int i = 0; i < N; i++){
a[i]= 0;
cin >> a[i];
}
for( int k = -100; k < 101; k++){
for( int j = 0; j < N; j++){
(a[j] - k)*(a[j] - k) = b[j]
}
for( int l = 0; l < N; l+... | a.cc: In function 'int main()':
a.cc:13:14: error: lvalue required as left operand of assignment
13 | (a[j] - k)*(a[j] - k) = b[j]
| ~~~~~~~~~~^~~~~~~~~~~
a.cc:18:6: error: 'l' was not declared in this scope
18 | if( l = 0){
| ^
|
s564074726 | p04025 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[99], b[99], b, N, c;
for(int h = 0; h < N; h++)b[h] = 0;
cin >> N;
for(int i = 0; i < N; i++){
a[i]= 0;
cin >> a[i];
}
for( int k = -100; k < 101; k++){
for( int j = 0; j < N; j++){
(a[j] - k)*(a[j] - k) = b[j]
}
for( int l = 0; l < N; l+... | a.cc: In function 'int main()':
a.cc:4:20: error: conflicting declaration 'int b'
4 | int a[99], b[99], b, N, c;
| ^
a.cc:4:13: note: previous declaration as 'int b [99]'
4 | int a[99], b[99], b, N, c;
| ^
a.cc:13:14: error: lvalue required as left operand of assignm... |
s837002057 | p04025 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[99], b[99], b, N, c;
for(int h = 0; h < N; h++)b[h] = 0;
cin >> N;
for(int i = 0; i < N; i++){
a[i]= 0;
cin >> a[i];
}
for( int k = -100; k < 101; k++){
for( int j = 0; j < N; j++){
(a[j] - k)*(a[j] - k) = b[j]
}
for( int l = 0; l < N; l+... | a.cc: In function 'int main()':
a.cc:4:20: error: conflicting declaration 'int b'
4 | int a[99], b[99], b, N, c;
| ^
a.cc:4:13: note: previous declaration as 'int b [99]'
4 | int a[99], b[99], b, N, c;
| ^
a.cc:13:14: error: lvalue required as left operand of assignm... |
s282630200 | p04025 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[99], b[99], b, N, c;
for(int h = 0; h < N; h++)b[h] = 0;
cin >> N;
for(int i = 0; i < N; i++){
a[i]= 0;
cin >> a[i];
}
for( k = -100; k < 101; k++){
for( j = 0; j < N; j++){
(a[j] - k)*(a[j] - k) = b[j]
}
for( l = 0; l < N; l++){
c += b... | a.cc: In function 'int main()':
a.cc:4:20: error: conflicting declaration 'int b'
4 | int a[99], b[99], b, N, c;
| ^
a.cc:4:13: note: previous declaration as 'int b [99]'
4 | int a[99], b[99], b, N, c;
| ^
a.cc:11:7: error: 'k' was not declared in this scope
11 | ... |
s454026679 | p04025 | C++ | #include <bits/stdc++.h>
#define INF (1<<21)
using namespace std;
int main(){
int n, tmp = 0;
int v[210] = {}
long long ans = INF;
cin >> n;
for(int i = 0; i < n; i++) cin >> v[i];
for(int i = 0; i < 101; i++){
long long sum = 0;
for(int j = 0; j < n; j++){
sum += (i - v[j]) * (i - v[j]);
... | a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'long'
9 | long long ans = INF;
| ^~~~
a.cc:17:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
17 | ans = min(ans, sum);
| ^~~
| abs
a.cc:19:40: error: 'ans' was not declared in this ... |
s583731622 | p04025 | C++ | #include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long i... | a.cc: In function 'int main()':
a.cc:31:6: error: expected ';' before numeric constant
31 | s 1/= (double)n;
| ^~
| ;
|
s549089500 | p04025 | C++ | #include<iostream>
#include<algorithm>
#include <string>
#include<cstdio>
#include<stack>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
using namespa... | a.cc: In function 'int main()':
a.cc:39:33: error: 'pow' was not declared in this scope
39 | mini += pow(a[j]-i, 2);
| ^~~
|
s847992624 | p04025 | C++ | #include <iostream>
using namespace std;
typedef unsigned long long u64;
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
int cost_min = -1;
for (int i = -100; i <= 100; ++i) {
int cost = 0;
for (int j = 0; j... | a.cc:27:3: error: 'cout' does not name a type
27 | cout << cost_min << endl;
| ^~~~
a.cc:28:3: error: expected unqualified-id before 'return'
28 | return 0;
| ^~~~~~
a.cc:29:1: error: expected declaration before '}' token
29 | }
| ^
|
s432898277 | p04025 | C++ | #include<cstdio>
#include<vector>
#include<iostream>
#include<cstdio>
using namespace std;
const int big=(1<<30);
int gcd(int a,int b){if(a<b){swap(a,b);}if(b==0){return a;}return gcd(a%b,b);}
int main(void){
int n,ans=big,i,q,gen,j;
vector<int> a;
cin>>N;
for(i=0;i<n;i++){
scanf("%d",&q);
a.push_back(q);
}
f... | a.cc: In function 'int main()':
a.cc:11:14: error: 'N' was not declared in this scope
11 | cin>>N;
| ^
|
s857934183 | p04025 | C++ | #include<cstdio>
#include<vector>
#include<iostream>
#include<cstdio>
using namespace std;
const int big=(1<<30);
int gcd(int a,int b){if(a<b){swap(a,b);}if(b==0){return a;}return gcd(a%b,b);}
int main(void){
int N,ans=big,i,q,gen,j;
vector<int> a;
cin>>N;
for(i=0;i<n;i++){
scanf("%d",&q);
a.push_back(q);
}
f... | a.cc: In function 'int main()':
a.cc:12:19: error: 'n' was not declared in this scope
12 | for(i=0;i<n;i++){
| ^
a.cc:18:27: error: 'n' was not declared in this scope
18 | for(j=0;j<n;j++){
| ^
|
s518112099 | p04025 | C++ | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int n;
double sum = 0;
int[] a = new int[100];
n ... | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.L... |
s867427757 | p04025 | Java | import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class C1A{
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n=in.nextInt();
int[] a=new int[n];
long avg=0;
for(int i=0;i<n;i++){
... | Main.java:4: error: class C1A is public, should be declared in a file named C1A.java
public class C1A{
^
1 error
|
s616224044 | p04025 | C++ | #include <bits/stdc++.h>
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 x1 = sum/a;
int x2 = sum/a + 1;
int ans1 = 0;
int ans2 = 0;
for(int i=0;i<n;i++){
ans1 += pow(a[i] - x1,2);
ans2 += pow(a[i] - x2,2);
}
c... | a.cc: In function 'int main()':
a.cc:14:21: error: no match for 'operator/' (operand types are 'int' and 'std::vector<int>')
14 | int x1 = sum/a;
| ~~~^~
| | |
| int std::vector<int>
In file included from /usr/include/c++/14/ccomplex:39,
... |
s677205867 | p04025 | Java | public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
List<Integer> list = IntStream.range(0, N).mapToObj(x -> sc.nextInt())
.sorted((a, b) -> Integer.compare(b, a))
.collect(Collectors.toCollection(ArrayList::new));
int max=list.get(0)... | Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:6: error: cannot find symbol
... |
s944970117 | p04025 | Java | public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
List<Integer> list = IntStream.range(0, N).mapToObj(x -> sc.nextInt())
.sorted((a, b) -> Integer.compare(b, a))
.collect(Collectors.toCollection(ArrayList::new));
int max=list.get(0)... | Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:6: error: cannot find symbol
... |
s640323885 | p04025 | C++ | #include <bits/stdc++.h>
using namespace std;
inline int square(int x) {
return x * x;
}
int N;
int A[100];
int main() {
scanf("%d", &N);
for (int i = 0; i < N; i++)
scanf("%d", &A[i]);
int sum = 0;
for (int i = 0; i < N; i++)
sum += A[i];
int avg1 = sum / N, avg2 = avg1 + 1;
... | a.cc: In function 'int main()':
a.cc:25:18: error: request for member 'min' in '"%d"', which is of non-class type 'const char [3]'
25 | printf("%d". min(res1, res2));
| ^~~
|
s216575533 | p04025 | C++ | #include <bits/stdc++>
using namespace std;
inline int square(int x) {
return x * x;
}
int N;
int A[100];
int main() {
scanf("%d", &N);
for (int i = 0; i < N; i++)
scanf("%d", &A[i]);
int sum = 0;
for (int i = 0; i < N; i++)
sum += A[i];
int avg1 = sum / N, avg2 = avg1 + 1;
... | a.cc:1:10: fatal error: bits/stdc++: No such file or directory
1 | #include <bits/stdc++>
| ^~~~~~~~~~~~~
compilation terminated.
|
s267018422 | p04025 | C++ | #include<iostream>
#include<cstdio>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define INF INT_MAX/2
int N;
int a[100];
int main() {
cin >> N;
rep(i, 0, N) cin >> a[i];
int ans = INF;
rep(x, -100, 101) {
int sm = 0;
rep(i, 0, N) sm += abs(x - a[i])*abs(x - a[i]);
ans = min(ans, sm);
}
cou... | a.cc: In function 'int main()':
a.cc:5:13: error: 'INT_MAX' was not declared in this scope
5 | #define INF INT_MAX/2
| ^~~~~~~
a.cc:12:19: note: in expansion of macro 'INF'
12 | int ans = INF;
| ^~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this... |
s257353896 | p04025 | C++ | #include<iostream>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define INF INT_MAX/2
int N;
int a[100];
int main() {
cin >> N;
rep(i, 0, N) cin >> a[i];
int ans = INF;
rep(x, -100, 101) {
int sm = 0;
rep(i, 0, N) sm += abs(x - a[i])*abs(x - a[i]);
ans = min(ans, sm);
}
cout << ans << endl;
... | a.cc: In function 'int main()':
a.cc:4:13: error: 'INT_MAX' was not declared in this scope
4 | #define INF INT_MAX/2
| ^~~~~~~
a.cc:10:19: note: in expansion of macro 'INF'
10 | int ans = INF;
| ^~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this... |
s694019876 | p04025 | C++ | f( chk[x][y][z] ) return dt[x][y][z];
chk[x][y][z] = 1;
int &ret = dt[x][y][z] = 0;
if( y < st.size() )
{
if( z == 0 )
{
ret += dp(x+1, y+1, 0), ret%=MOD;
ret += dp(x+1, y, z+1), ret%=MOD;
}
else
{
ret += dp(x+1, y, z+1), ret%=... | a.cc:1:2: error: expected constructor, destructor, or type conversion before '(' token
1 | f( chk[x][y][z] ) return dt[x][y][z];
| ^
a.cc:2:5: error: 'chk' does not name a type
2 | chk[x][y][z] = 1;
| ^~~
a.cc:3:16: error: 'dt' was not declared in this scope
3 | int &ret = dt[x][y][... |
s526630083 | p04025 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
int main() {
int N;
cin >> N;
vector <int> A(N+5);
for (int i = 0; i < N; i++) {
int m;
cin >> m;
A.push_back(m);
}
int sigma = 0;
for (int i = 0; i < N; i++) {
... | a.cc: In function 'int main()':
a.cc:37:9: error: redeclaration of 'int cost'
37 | int cost = min(cost, cost3);
| ^~~~
a.cc:36:9: note: 'int cost' previously declared here
36 | int cost = min(cost1, cost2);
| ^~~~
|
s641563826 | p04025 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
int main() {
int N;
cin >> N;
vector <int> A(N+5);
for (int i = 0; i < N; i++) {
int m;
cin >> m;
A.push_back(m);
}
int sigma = 0;
for (int i = 0; i < N; i++) {
... | a.cc: In function 'int main()':
a.cc:37:9: error: redeclaration of 'int cost'
37 | int cost = min(cost, cost3);
| ^~~~
a.cc:36:9: note: 'int cost' previously declared here
36 | int cost = min(cost1, cost2);
| ^~~~
|
s379571971 | p04025 | C++ | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int ave(vector<int>& v)
{
long long sum = 0;
for (auto x : v) {
sum += x;
}
return static_cast<int>(ceil(static_cast<double>(sum) / v.size()));
}
int main()
{
int n;
vector<int> a;
cin >> n;
for (int i = 0; i < n; ++i) {... | a.cc: In function 'int main()':
a.cc:38:9: error: expected primary-expression at end of input
38 | return
| ^
a.cc:38:9: error: expected ';' at end of input
38 | return
| ^
| ;
a.cc:38:9: error: expected '}' at end of input
a.cc:17:1: note: to match this '{'
17 | {... |
s311144729 | p04025 | C++ | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<conio.h>
int main()
{
int n;
int numbers[100];
int all=0;
int avg;
int value1=0, value2=0;
scanf("%d\n", &n);
for (int i = 0; i < n-1; i++) {
scanf("%d ", &numbers[i]);
all += numbers[i];
}
scanf("%d", &numbers... | a.cc:6:9: fatal error: conio.h: No such file or directory
6 | #include<conio.h>
| ^~~~~~~~~
compilation terminated.
|
s223374829 | p04025 | Java | import java.io.*;
import java.util.*;
public class C_test {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
static final int P = 1_000_000_007;
int[] getSums(int from, int to, int c) {
int[] a = new int[to - from + 1];
Arrays.fill(a, 1);
int[] ret = new int[c + 1];
for (int i = 0... | Main.java:4: error: class C_test is public, should be declared in a file named C_test.java
public class C_test {
^
1 error
|
s980710594 | p04025 | Java | import java.util.Scanner;
public class R59 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++) a[i] = s.nextInt();
long min = Long.MAX_VALUE;
for(int i = -100; i <= 100; i++) {
long total = 0;
for(int j... | Main.java:4: error: class R59 is public, should be declared in a file named R59.java
public class R59 {
^
1 error
|
s339671175 | p04025 | C++ | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <c... | a.cc:38:12: warning: multi-character character constant [-Wmultichar]
38 | printf('%d\n', res);
| ^~~~~~
a.cc: In function 'int main()':
a.cc:38:12: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
38 | printf('%d\n', res);
| ^~~~~~
| ... |
s301427071 | p04025 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
double sum = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum = sum + a[i];
}
sum = (double)sum / (double)n;
//cout << sum << endl;
int ansl = floor(sum);
int ansh = ansl + 1;
int el = 0;
int ... | a.cc: In function 'int main()':
a.cc:18:20: error: 'floor' was not declared in this scope
18 | int ansl = floor(sum);
| ^~~~~
|
s348848792 | p04025 | C++ | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in... | a.cc:1:1: error: 'import' does not name a type
1 | import java.io.OutputStream;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.IOException;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmod... |
s053734762 | p04025 | Java | public class Main {
public static void main(String[] args) {
Solver solver = new Solver();
}
static class Solver {
IO io;
public Solver() {
this.io = new IO();
try {
solve();
} finally {
io.close();
}
... | Main.java:79: error: cannot find symbol
private class IO extends PrintWriter {
^
symbol: class PrintWriter
location: class Solver
Main.java:67: error: cannot find symbol
private List<Integer>[] toGraph(IO io, int n) {
^
symbol: class List
loca... |
s690441379 | p04025 | Java | import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) {
Solver solver = new Solver();
}
static class Solver {
IO io;
public Solver() {
this.io = new IO();
try {
solve();
} finally {
... | Main.java:4: error: class B is public, should be declared in a file named B.java
public class B {
^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
|
s720792076 | p04025 | C++ | #include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <cmath>
#define REP(i,m,n) for(int i=int... | a.cc:53:21: error: 'INT_MAX' was not declared in this scope
53 | constexpr int INF = INT_MAX;
| ^~~~~~~
a.cc:17:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
16 | #include <cmath>
+++ |+#include <climits>
17 |
|
s119572662 | p04025 | Java | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) {
Solver solver = new Solver();
}
static class Solver {
IO io;
public Solver() {
this.io = new IO();
try {
solve();
} finally {
... | Main.java:4: error: class A is public, should be declared in a file named A.java
public class A {
^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
|
s470293869 | p04025 | C++ | import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;
import java.io.*;
public class Main {
void solve() {
int N = sc.nextInt();
int[] a = sc.nextIntArray(N);
int ans = Integer.MAX_VALUE;
for (int c = -100; c <= 100; c++) {
int y = check(a, c);
ans = Math.min(ans, y);... | a.cc:1:1: error: 'import' does not name a type
1 | import static java.lang.Math.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import static java.util.Arrays.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available wi... |
s334558906 | p04026 | C++ | /*
vrrtll==???>;::::~~~~~~......`.`````````````````````...-?777!_.._?7u,~~~::::;>>??=lllttrrzu
rtll==??>>;::::~~~~......`.`````````````````` ..J77!`````````...`..._T,~~~~:::;;>??==lttrrv
tll=??>>;:::~~~~......``````````````````..J7^ ` `` ` `` .,```````...._4,.~~~::;;>>?===lttr
l=???>;;::~~~......`````HTSu,.`` `..J7! ... | a.cc:152:13: error: 'i' was not declared in this scope
152 | char nc = s[i] - 'a';
| ^
a.cc:153:1: error: 'c' does not name a type; did you mean 'vc'?
153 | c[nc][i]++;
| ^
| vc
a.cc:154:1: error: expected unqualified-id before 'if'
154 | if (!i) {
| ^~
|
s097308221 | p04026 | C++ | ///#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt,avx,avx2,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
/*
zet:
find_by_order(... | a.cc: In function 'void solve()':
a.cc:22:27: error: request for member 'size' in 'j', which is of non-class type 'int'
22 | #define size(x) (int)((x).size())
| ^~~~
a.cc:72:33: note: in expansion of macro 'size'
72 | for (int j = i + 1; j < size(j) && j - i + 1 < 4; ++j) {... |
s211114793 | p04026 | C++ | b#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 100010;
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
string s;
cin >> s ;
for(int i = 0;i<s.size() - 1;++i){
if(s[i] == s[i+1]){
cout << i + 1 << ' ' << i+2 << endl;
return 0;
}
if(i < s.size() -... | a.cc:1:2: error: stray '#' in program
1 | b#include <bits/stdc++.h>
| ^
a.cc:1:1: error: 'b' does not name a type
1 | b#include <bits/stdc++.h>
| ^
a.cc: In function 'int main()':
a.cc:7:9: error: 'ios' has not been declared
7 | ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
... |
s364314415 | p04026 | C++ | #include <iostream>
#include<string>
using namespace std;
int main()
{
string s;
int mark = 0;
for (int i = 0; i <= s.length()-1; i++)
{
if (s[i] == s[i + 1] && i + 1 < s.length())
{
mark = 1;
cout << i + 1 << " " << i + 2 << endl;
break;
}
else if (s[i] == s[i + 2] && i + 2 < s.length())
{
co... | a.cc:26:1: error: expected declaration before '}' token
26 | }
| ^
|
s750246838 | p04026 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[5009];
ll a[5000];
int main()
{
string s;cin>>s;
for(int i=0;i<s.size();i++){
set<char>ss;
ss.insert(s[i]);
if(i+1<s.size()){
ss.insert(s[i+1]);
if(ss.size()==1){
cout<<i+1<<" "<<i+2;
... | a.cc: In function 'int main()':
a.cc:22:26: error: expected '}' at end of input
22 | ss.insert(s[i+2]);
| ^
a.cc:21:24: note: to match this '{'
21 | if(i+2<s.size()){
| ^
a.cc:22:26: error: expected '}' at end of input
22 | ss.ins... |
s837493034 | p04026 | C++ | #include<bits/stdc++.h>
using namespace std;
char a[100005];
int p[60][100005],len[30],n;
void f(char a,int k){
int s;
if('a' <= a && a <= 'z') s = a - 'a' + 1;
if('A' <= a && a <= 'Z') s = a - 'A' + 27;
p[s][++len[s]] = k;
}
signed main(){
// freopen("date.in","r",stdin);
// freopen("date.out","w",stdout);
gets(a... | a.cc: In function 'int main()':
a.cc:14:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
14 | gets(a);
| ^~~~
| getw
|
s548508864 | p04026 | C++ | #define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable: 4244) // 最悪をします
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <tim... | a.cc: In member function 'std::vector<long long int> StressTest::create_permutation(long long int)':
a.cc:1377:9: warning: no return statement in function returning non-void [-Wreturn-type]
1377 | }
| ^
a.cc: In member function 'Graph StressTest::create_tree(long long int, bool, long long int)':
... |
s356847209 | p04026 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MOD2=998244353;
const double PI=acos(-1);
const ll INF=1e15;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghij... | a.cc: In function 'int main()':
a.cc:22:9: error: 'n' was not declared in this scope
22 | rep(i,n-1){
| ^
a.cc:11:33: note: in definition of macro 'FOR'
11 | #define FOR(i,a,b) for(ll i=a;i<b;i++)
| ^
a.cc:22:3: note: in expansion of macro 'rep'
22 | rep(... |
s547720159 | p04026 | Java | import java.io.*;
import java.util.*;
public class B {
public static final long mod = (long)1e9+7;
public static final long INF = Long.MAX_VALUE/2;
public static final int inf = Integer.MAX_VALUE/2;
static void solve(InputReader in, PrintWriter out){
char[] s = in.ns().toCharArray();
b... | Main.java:4: error: class B is public, should be declared in a file named B.java
public class B {
^
1 error
|
s129596339 | p04026 | C++ | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin()... | a.cc: In function 'int main()':
a.cc:44:10: error: 'i' was not declared in this scope
44 | if(s[i] == s[i+1]){
| ^
|
s406122035 | p04026 | C++ | #include<iostream>
using namespace std;
int main()
{
char arr[100000];
scanf("%s",arr);
int n=strlen(arr);
int p=0,a,b;
for(int i=0;i<n-2;i++)
{
if(arr[i]==arr[i+1])
{
p=1;
a=i;
b=i+1;
break;
}
else if(arr[i]==arr[i+... | a.cc: In function 'int main()':
a.cc:7:11: error: 'strlen' was not declared in this scope
7 | int n=strlen(arr);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2... |
s685178600 | p04026 | C++ | #include<iostream>
using namespace std;
int main()
{
char arr[100000];
scanf("%s",&arr);
int n=strlen(arr);
int p=0,a,b;
for(int i=0;i<n-2;i++)
{
if(arr[i]==arr[i+1])
{
p=1;
a=i;
b=i+1;
break;
}
else if(arr[i]==arr[i... | a.cc: In function 'int main()':
a.cc:7:11: error: 'strlen' was not declared in this scope
7 | int n=strlen(arr);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2... |
s047220015 | p04026 | 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:y... | 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 |... |
s997530228 | p04026 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
string s;
cin >> s;
int a[30]={0};
for(int i=0;i<s.size();i++){
a[s[i]-'a']++;
for(int j=0;j<26;j++){
if(a[j]> i/2 && a[j] != 1){
cout << "1" << " " << i << endl;
return 0;
... | a.cc: In function 'int main()':
a.cc:31:4: error: expected '}' at end of input
31 | }
| ^
a.cc:6:11: note: to match this '{'
6 | int main(){
| ^
|
s768218202 | p04026 | C++ | #include<bits/stdc++.h>
using namespace std;
main(){
string S;cin>>S;
int n=S.size();
if(n==2){
if(S[0]==S[1])cout<<"0 1"<<endl;
else cout<<"-1 -1"endl;
return 0;
}
for(int i=0;i<n-2;i++){
if(S[i]==S[i+1]||S[i]==S[i+2]||S[i+1]==S[i+2]){
cout<<i+1<<" "<<i+3<<endl;
return 0;
}
... | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:8:16: error: unable to find string literal operator 'operator""endl' with 'const char [6]', 'long unsigned int' arguments
8 | else cout<<"-1 -1"endl;
| ... |
s171271175 | p04026 | C++ | #include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
char s[N];
int main()
{
//freopen("H:\\c++1\\in.txt","r",stdin);
//freopen("H:\\c++1\\out.txt","w",stdout);
scanf("%s",s+1);
int len=strlen(s+1);
int l=-1,r=-1;
for(int i=1;i<len;i++){
if(s[i]==s[i+1]){
flag=1;
l=i,r=i+1;
break;
}
}
p... | a.cc: In function 'int main()':
a.cc:14:25: error: 'flag' was not declared in this scope
14 | flag=1;
| ^~~~
|
s646503731 | p04026 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
boo... | a.cc: In function 'int main()':
a.cc:50:2: error: expected '}' at end of input
50 | }
| ^
a.cc:21:11: note: to match this '{'
21 | int main(){
| ^
|
s726168947 | p04026 | Java | import java.util.*;
import java.io.*;
public class Main
{
public static void main(String[] args) { new Main(); }
FS in = new FS();
PrintWriter out = new PrintWriter(System.out);
int len;
char[] str;
boolean found = false;
Main() {
len = (str = in.next().toCharArray()).length;
for (int i = 0; i < len - 1... | Main.java:37: error: cannot find symbol
StringTokenizer st = new StringTokenzier("");
^
symbol: class StringTokenzier
location: class Main.FS
1 error
|
s240924835 | p04026 | C++ | include<bits/stdc++.h>
using namespace std;
string a,b;
int main()
{
cin>>a;
for(int s=1;s<a.size();s++)
{
if(a[s]==a[s-1])
{
cout<<s<<" "<<s+1<<endl;
return 0;
}
}
for(int s=2;s<a.size();s++)
{
if(a[s]==a[s-2])
{
cout<<... | a.cc:1:1: error: 'include' does not name a type
1 | include<bits/stdc++.h>
| ^~~~~~~
a.cc:3:1: error: 'string' does not name a type
3 | string a,b;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
6 | cin>>a;
| ^~~
a.cc:6:10: error: 'a'... |
s324944286 | p04026 | C++ | #include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
string s;cin>>s;
if(s.size()==2){
if(s[0]==s[1])cout<<"1 2";
else cout<<"-1... | a.cc:15:21: error: macro "rep" passed 3 arguments, but takes just 2
15 | rep(i,2,s.size()){
| ^
a.cc:7:9: note: macro "rep" defined here
7 | #define rep(i,n) reps(i,0,n)
| ^~~
a.cc: In function 'int main()':
a.cc:15:5: error: 'rep' was not declared in this scope
15 ... |
s440344805 | p04026 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string a; gets(a);
for(int i = 1; i < a.size(); i++){
if(a[i] == a[i-1]){
cout << i << " " << i+1 <<endl;
sum++;
}
}
if(sum == 0){
for(int i = 2; i < a.size(); i++){
if(a[i] == a[i-2]){
... | a.cc: In function 'int main()':
a.cc:4:19: error: 'gets' was not declared in this scope; did you mean 'getw'?
4 | string a; gets(a);
| ^~~~
| getw
a.cc:8:13: error: 'sum' was not declared in this scope
8 | sum++;
| ^~~
a.cc:11... |
s194693203 | p04026 | C++ | #include <iostream>
int a=-1,i; main(){
string s;
std::cin>>s;
for(i=0,i<s.length();i++;)if(s[i]==s[i+1]){if(i>0)a=i-1;else a=i;}
if(a!=-1)std::cout<<a<<" "<<a+2;
else std::cout<<-1<<" "<<-1;
}
| a.cc:2:13: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | int a=-1,i; main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:3:1: error: 'string' was not declared in this scope
3 | string s;
| ^~~~~~
a.cc:3:1: note: suggested alternatives:
In file included f... |
s227372006 | p04026 | C++ | s = input()
is_unbalanced = False
for i in range(len(s)-1):
if s[i] == s[i+1]:
print(i+1, i+2)
is_unbalanced = True
break
if is_unbalanced == False:
for i in range(len(s)-2):
if s[i] == s[i+2]:
print(i+1, i+2)
is_unbalanced = True
break
if is_u... | a.cc:1:1: error: 's' does not name a type
1 | s = input()
| ^
|
s526230271 | p04026 | C++ | Unbalanced
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll;
const int maxn = 1000005;
const int maxm = maxn*2;
const int inf = 0x3f3f3f3f;
char s[100005];
int main() {
... | a.cc:1:1: error: 'Unbalanced' does not name a type
1 | Unbalanced
| ^~~~~~~~~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
fr... |
s262771739 | p04026 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (500000)
#define pii pair<int, int>
/////////////////////////////////////////////////////////
class XY{... | a.cc: In function 'void Main()':
a.cc:102:13: error: 'N' was not declared in this scope
102 | if(i == N - 1) continue;
| ^
|
s799161090 | p04026 | C++ | #include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll;
const int mo = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < n; i++)
char str[210000];
void solve()
{
scanf("%s",str);
int n=st... | a.cc: In function 'void solve()':
a.cc:17:11: error: 'strlen' was not declared in this scope
17 | int n=strlen(str);
| ^~~~~~
a.cc:9:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
8 | #include <stack>
+++ |+#include <cstring>
... |
s451498774 | p04026 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long... | a.cc: In function 'void solve(std::string)':
a.cc:27:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
27 | return 0;
| ^
a.cc:31:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
3... |
s708725333 | p04026 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long n,i,j,d=1,b[100000],k;
char s[1000000];
gets(s);
cout<<"-1 -1";
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | gets(s);
| ^~~~
| getw
|
s250013267 | p04026 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
char a[100000];
gets(a);
int c[100000];
for(int i = 97; i <= 122; i++){
c[0] = 0;
for(int j = 0; j < strlen(a) ; j++){
if(a[j] == i){
c[j + 1] = c[j] + 1;
} else {
c[j + 1] = c[j];
}
}
for(int j = 1; j < strlen(a); j++){
for(int k... | a.cc: In function 'int main()':
a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | gets(a);
| ^~~~
| getw
|
s628454619 | p04026 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.PrintWriter;
import java.util.ArrayList;
public class ARC059B
{
static class Scanner
{
BufferedReader br;
StringTokenizer tk=... | Main.java:8: error: class ARC059B is public, should be declared in a file named ARC059B.java
public class ARC059B
^
1 error
|
s570740946 | p04026 | C++ | #include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
using namespace std;
int main(){
string s;
cin >> s;
if(s.size() == 2){
if(s[0] == ... | a.cc: In function 'int main()':
a.cc:20:21: error: expected identifier before numeric constant
20 | if(s[0] == [1]){
| ^
a.cc: In lambda function:
a.cc:20:23: error: expected '{' before ')' token
20 | if(s[0] == [1]){
| ^
a.cc: In function 'int... |
s262416831 | p04026 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,v) VL v(n);rep(i,n)cin>>v[i]
#define int long long
#define itn int
#define pb push_back
#define eb emplace_back
#define m_p make_pair
#... | a.cc: In function 'int main()':
a.cc:105:12: error: 'n' was not declared in this scope
105 | if(i+2<n && s[i]==s[i+2]){
| ^
|
s639561668 | p04026 | C++ | #include<iostream>
using namespace std;
int main(){
int a = -1,b = -1;
char s[100000];
scanf("%s",s);
for(int i = 0; i < n; i++){
if(s[i] == s[i+1] ){
a = i;
b = i +1;
break;
}
if(s[i] == s[i+2]){
a = i;
b = i+2;
break
}
}
cout << a << " " << b << "\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:9:29: error: 'n' was not declared in this scope
9 | for(int i = 0; i < n; i++){
| ^
a.cc:18:30: error: expected ';' before '}' token
18 | break
| ^
| ... |
s014953922 | p04026 | C++ | //
/*==========================================================*/
/* Template ver 2017-0720 | Created by JollyBee */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll... | a.cc: In function 'pii solve()':
a.cc:58:21: error: cannot convert 'int*' to 'const char*'
58 | int n = strlen(s+1);
| ~^~
| |
| int*
In file included from /usr/include/c++/14/cstring:43,
from /usr/include/x86_64-linux-... |
s243694556 | p04026 | C++ | #include <cstdio>
const int N=100005;
char a[N];
int main (){
scanf ("%s",a+1);
int n=strlen(a+1);
if (n==2) {
if (a[1]==a[2]) puts("1 2");
else puts("-1 -1");
return 0;
}
for (int i=1;i<=n-2;i++)
if ((a[i]==a[i+1])||(a[i]==a[i+2])||(a[i+1]==a[i+2])){
printf ("%d %d",i,i+2);return 0;
... | a.cc: In function 'int main()':
a.cc:6:9: error: 'strlen' was not declared in this scope
6 | int n=strlen(a+1);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <cstdio>
+++ |+#include <cstring>
2 | con... |
s814054319 | p04026 | C++ | #include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#de... | a.cc: In function 'int32_t main()':
a.cc:40:11: error: expected '}' at end of input
40 | return 0;}
| ^
a.cc:22:15: note: to match this '{'
22 | int32_t main(){
| ^
|
s805966525 | p04026 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s; cin >> s;
for(int i=0;i<n-2;i++) {
if(s[i]==s[i+1]||s[i+1]==s[i+2]||s[i]==s[i+2]) cout << i+1 << " " << i+3 << endl;
return 0;
}
cout << -1 << " " << -1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:17: error: 'n' was not declared in this scope
6 | for(int i=0;i<n-2;i++) {
| ^
|
s011110682 | p04026 | Java | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String t = sc.next();
sc.close();
int n = t.length();
if(n <= 2) {
System.out.println("-1 -1");
System.exit(0);
}
for(int i = 0; i < n - 2; i++) {
char c0 = t.charAt(i);
... | Main.java:21: error: cannot find symbol
Arrays.sort(k);
^
symbol: variable Arrays
location: class Main
1 error
|
s062705515 | p04026 | C++ | #include <iostream>
#include <malloc.h>
#include<stack>
#include<map>
#include<stdio.h>
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
struct Node
{
int a;
char c;
}w[1000000];
int n;
bool cmp(Node a,Node b)
{
return a.c<b.c;
}
int main()
{ set<char>s;
int i;
string ss;
cin>... | a.cc: In function 'int main()':
a.cc:52:31: error: expected ';' before '}' token
52 | break
| ^
| ;
53 | }
| ~
|
s606459264 | p04026 | C++ | #include <iostream>
#include <malloc.h>
#include<stack>
#include<map>
#include<stdio.h>
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
struct Node
{
int a;
char c;
}w[1000000];
int n;
bool cmp(Node a,Node b)
{
return a.c<b.c;
}
int main()
{ set<char>s;
int i;
string ss;
cin>... | a.cc: In function 'int main()':
a.cc:52:31: error: expected ';' before '}' token
52 | break
| ^
| ;
53 | }
| ~
|
s794724601 | p04026 | C++ | #include<cstdio>
using namespace std;
#include<cstring>
int main(){
char s[100010];
int n;
scanf("%s",s);
n=strlen(s);
for(int i=0;i<n-2;i++){
if(s[i]==s[i+1]){
printf("%d %d\n",i,i+1);
return 0;
}
else if(s[i]==s[i+2]){
printf("%d %d\n",i,i+2);
return 0;
}
}
if(s[... | a.cc: In function 'int main()':
a.cc:21:5: error: 'peinrf' was not declared in this scope; did you mean 'printf'?
21 | peinrf("%d %d\n",n-2,n-1);
| ^~~~~~
| printf
|
s447553703 | p04026 | C++ | #include<stdio.h>
int main(){
char s[111111];
int i,a=-1,b=-1;
for(i=0;i<111111;i++)
s[i]='\0';
scanf("%s",s);
if(s[0]==s[1]){
a=1;
b=2;
for(i=2;s[i]!='\0';i++){
if(s[i]==s[i-1]){
a=i;
b=i+1;
}
if(s[i]==s[i-2]){
a=i-1;
b=i+1;
}
}
printf("%d %d\n",a,b);
return 0;
} | a.cc: In function 'int main()':
a.cc:23:2: error: expected '}' at end of input
23 | }
| ^
a.cc:2:11: note: to match this '{'
2 | int main(){
| ^
|
s644031508 | p04026 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#define ALL(obj) (obj).begin(), (obj).e... | a.cc: In function 'int main()':
a.cc:38:3: error: 'n' was not declared in this scope
38 | n=s.size();
| ^
|
s565682068 | p04026 | C++ | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @auth... | a.cc:1:1: error: 'import' does not name a type
1 | import java.io.OutputStream;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.IOException;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmod... |
s819269804 | p04026 | C++ | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
void die(int x, int y) {
cout << x << " " << y;
die(0);
}
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
string s;
cin >> s;
int n = s.size();
for (int i = 1; i < n; ++i)
if (s[i] == s[i - 1])
die(i, i + 1);
else if (i... | a.cc: In function 'void die(int, int)':
a.cc:7:6: error: too few arguments to function 'void die(int, int)'
7 | die(0);
| ~~~^~~
a.cc:5:6: note: declared here
5 | void die(int x, int y) {
| ^~~
|
s158467547 | p04026 | C++ | #include <iostream>
using namespace std;
int main() {
string S;
cin >> S;
for (int i = 0; i < S.length() - 1; i++) {
if (S[i] == S[i + 1]) {
cout << i << ' ' << i + 1 << endl;
return 0;
}
if (i > 0) {
if (S[i - 1:] == S[i + 1]) {
cout ... | a.cc: In function 'int main()':
a.cc:13:24: error: expected ']' before ':' token
13 | if (S[i - 1:] == S[i + 1]) {
| ^
| ]
a.cc:13:24: error: expected ')' before ':' token
13 | if (S[i - 1:] == S[i + 1]) {
| ~ ... |
s976442744 | p04026 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int descending_compare(const void *a, const void *b){
if (*(int*)a > *(int*)b){
return -1;
}else if (*(int*)a == *(int*)b){
return 0;
}else{
return 1;
}
}
int ascending_compare(const void *a, const voi... | a.cc: In function 'int main()':
a.cc:106:62: error: expected primary-expression before ')' token
106 | if ((i != j && s[i] == s[j]) || s[i-1] == s[i+1])) {
| ^
|
s172399247 | p04026 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
//typedef long long ll;
#define INF (1LL << 31 - 1)
#define INFLL ((1LL << 62) - 1)
#define MOD int(1e9+7)
#define repi(i,j,n) for(int i = (j); i < (n); ++i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) for (int i = n; i >= 0; --i)
#define fi first... | a.cc: In function 'int main()':
a.cc:38:1: error: 'd' was not declared in this scope
38 | d
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.