submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s348042362 | p03945 | C++ | #include<bits/stdc++.h>
using namespase std;
int main(){
int ans = 0;
string S;
cin >> S;
for(int i=1; i<S.length(); i++){
if(S[i]!=S[i-1]){
ans++;
}
}
cout << ans << endl;
return 0;
} | a.cc:2:7: error: expected nested-name-specifier before 'namespase'
2 | using namespase std;
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
5 | string S;
| ^~~~~~
a.cc:5:3: note: suggested alternatives:
In file included from /usr/include... |
s563690606 | p03945 | C++ | #include<cstdio>
#include<cstring>
using namespace std;
int main()
{
char n[];
int jsq=0,len;
scanf("%s",&n);
len=strlen(n);
for(int i=1;i<len;i++)
{
if(n[i]!=n[i+1])jsq++;
}
printf("%d",jsq);
} | a.cc: In function 'int main()':
a.cc:6:10: error: storage size of 'n' isn't known
6 | char n[];
| ^
|
s950978711 | p03945 | C++ | #include<cstdio>
#include<cstring>
using namespace std;
int main()
{
char n[];
int jsq=0,len;
scanf("%s",&n);
len=strlen(n);
for(int i=1;i<len;i++)
{
if(n[i]!=n[i+1])
jsq++;
}
printf("%d",jsq);
} | a.cc: In function 'int main()':
a.cc:6:10: error: storage size of 'n' isn't known
6 | char n[];
| ^
a.cc:10:17: error: 'i' was not declared in this scope
10 | for(int i=1;i<len;i++)
| ^
|
s137756584 | p03945 | C++ | #include<bits\stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int ans = 0;
for(int i = 1;i < s.length();i++){
if(s[i] != s[i-1]) ans++;
}
cout << ans << endl;
} | a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s361102150 | p03945 | C++ | #include<bits\stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int ans = 0;
for(int i = 1;i < s.length();i++){
if(s[i] != s[i-1]) ans++;
}
cout << ans << endl;
} | a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s884659687 | p03945 | C++ | #include<bits\stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int ans = 0;
for(int i = 1;i < s.length();i++){
if(s[i] != s[i-1]) ans++;
}
cout << ans << endl;
} | a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s661010338 | p03945 | C++ | #include<bits\stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int ans = 0;
for(int i = 1;i < s.length();i++){
if(s[i] != s[i-1]) ans++;
}
cout << ans << endl;
} | a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s928587664 | p03945 | C++ | #include<iostream>
#include<string.h>
using namespace std;
int main()
{
int i,n,sum=0;
char a[10010];
gets(a);
n=strlen(a);
for(i=0;i<n-1;i++)
{
if(a[i]!=a[i+1])sum++;
}
cout<<sum<<endl;
} | a.cc: In function 'int main()':
a.cc:8:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
8 | gets(a);
| ^~~~
| getw
|
s912485335 | p03945 | C++ | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int count=0;
Scanner sc=new Scanner(System.in);
String s;
s=sc.nextLine();
for(int i=1;i<s.length();i++) {
if(s.charAt(i)!=s.charAt(i-1))count++;
}
System.out.println(count);
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s389755564 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main () {
string s;
int a,i,y,x,W,H,N,num=0;
cin >> s;
for (i=0;i<s.size()-1;i++)
if (s[i]!=s[i+1]) num++;
cout << num << endl;
return 0;
}#include <bits/stdc++.h>
using namespace std;
int main () {
string s;
int a,i,y,x,W,... | a.cc:15:2: error: stray '#' in program
15 | }#include <bits/stdc++.h>
| ^
a.cc:15:3: error: 'include' does not name a type
15 | }#include <bits/stdc++.h>
| ^~~~~~~
a.cc:20:5: error: redefinition of 'int main()'
20 | int main () {
| ^~~~
a.cc:6:5: note: 'int main()' previously defined h... |
s142292055 | p03945 | C++ | #include <bits/stdc++.h>
int main(){
std::string s;
cin>>s;
long count=0;
for(int i=1; i<s.size(); i++){
if(s[i]!=s[i-1])
count++;
}
cout<<count;
} | a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
4 | cin>>s;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: '... |
s499745148 | p03945 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.nextInt();
int len = s.length();
StringBuilder sb = new StringBuilder();
int left = 0;
while(left<len){
int right = left+1;
... | Main.java:6: error: incompatible types: int cannot be converted to String
String s = sc.nextInt();
^
Main.java:12: error: cannot find symbol
while(right<N&&s.charAt(right)==s.charAt(left)) right++;
^
symbol: variable N
location: class Main
2... |
s189456497 | p03945 | C++ | #include<bits/stdc++.h>
char s[100001];
int main()
{
gets(s);
int ans=0;
for(int i=1;i<strlen(s);i++)
if(s[i]!=s[i-1])
ans++;
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:5:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
5 | gets(s);
| ^~~~
| getw
a.cc:10:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
10 | cout<<ans<<endl;
| ^~~~
| std::cout
In fi... |
s997866063 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
string a;
int ans;
int main()
{
cin>>a;
for(int s=1;s<a;s++)
{
if(a[s]!=a[s-1])ans++;
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:22: error: no match for 'operator<' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
8 | for(int s=1;s<a;s++)
| ~^~
| | |
| | std::string {aka std::__cxx11... |
s827416766 | p03945 | C++ | #include <bits/stdc++.h>
//#include <Rem>
using namespace std;
string s;
int count=0;
int main()
{
cin>>s;
char k=s[0];
for(int i=1; i<s.length(); i++)
{
if(s[i]!=k) count++;
k=s[i];
}
printf("%d\n",count);
return 0;
} | a.cc: In function 'int main()':
a.cc:14:22: error: reference to 'count' is ambiguous
14 | if(s[i]!=k) count++;
| ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:... |
s948874042 | p03945 | C++ | #pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragm... | a.cc:22:39: warning: bad option '-fwhole-program' to pragma 'optimize' [-Wpragmas]
22 | #pragma GCC optimize("-fwhole-program")
| ^
a.cc:29:41: warning: bad option '-fstrict-overflow' to pragma 'optimize' [-Wpragmas]
29 | #pragma GCC optimize("-fstrict-overflow")
... |
s051647124 | p03945 | C++ | #pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragm... | a.cc:22:39: warning: bad option '-fwhole-program' to pragma 'optimize' [-Wpragmas]
22 | #pragma GCC optimize("-fwhole-program")
| ^
a.cc:29:41: warning: bad option '-fstrict-overflow' to pragma 'optimize' [-Wpragmas]
29 | #pragma GCC optimize("-fstrict-overflow")
... |
s591470546 | p03945 | C++ | #include<cstdio>
char s[1e5+5];
int ans;
int main(){
scanf("%s",s);
for(int i=1;s[i];i++)
if(s[i]!=s[i-1])ans++;
printf("%d\n",ans);
} | a.cc:2:11: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
2 | char s[1e5+5];
| ~~~^~
a.cc:2:11: error: could not convert '(1.0e+5 + (double)5)' from 'double' to 'long unsigned int'
2 | char s[1e5+5];
| ~~~^~
| |
| ... |
s611908373 | p03945 | C | #include <stdio.h>int main() {
char s[100010];
int x = 0;
scanf("%s", s);
for (int i = 1; s[i] != '\0'; i++)
{
if (s[i - 1] != s[i]) {
x++;
}
}
printf("%d", x);
return 0;
} | main.c:1:19: warning: extra tokens at end of #include directive
1 | #include <stdio.h>int main() {
| ^~~
main.c:4:15: error: expected declaration specifiers or '...' before string constant
4 | scanf("%s", s);
| ^~~~
main.c:4:21: error: expected declaration spe... |
s390476035 | p03945 | C | #include<stdio.h>
#include<string.h>
#include<queue>
#include<algorithm>
using namespace std;
bool flag = true;
queue<char> que;
char fr, fr2;
void i_judge()
{
flag = true;
fr = que.front();
while(flag)
{
que.pop();
if(que.front() == fr)
flag = true;
else
flag = false;
}
}
int main()
{
char s[10... | main.c:3:9: fatal error: queue: No such file or directory
3 | #include<queue>
| ^~~~~~~
compilation terminated.
|
s935736816 | p03945 | C | #include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
bool flag = true;
queue<char> que;
char fr, fr2;
void i_judge()
{
flag = true;
fr = que.front();
while(flag)
{
que.pop();
if(que.front() == fr)
flag = true;
else
flag = false;
}
}
int main()
{
char s[1000... | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s481908116 | p03945 | C++ | #include<cstdio>
#include<cstring>
int main()
{
char a[10004];
gets(a);
int l=strlen(a);
int ant=0;
for(int i=1;i<l;i++)
{
if(a[i]!=a[i-1])
ant++;
}
printf("%d\n",ant);
return 0;
} | a.cc: In function 'int main()':
a.cc:6:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | gets(a);
| ^~~~
| getw
|
s498880110 | p03945 | Java | import java.util.Scanner;
public class ICPC_8_P4 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String game = sc.nextLine();
int reqMoves = 0;
if (game.length() > 1) {
for (int i = 0; i < game.length() - 1; i++) {
if (game.charAt(i) != game.charAt(i + 1)) {
reqM... | Main.java:3: error: class ICPC_8_P4 is public, should be declared in a file named ICPC_8_P4.java
public class ICPC_8_P4 {
^
1 error
|
s182668530 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
while (cin >> s) {
int n = s.length();
int cnt = 0;
for (int i = 1; i < n: ++i) {
if (s[i] != s[i-1]) ++cnt;
}
cout << cnt << "\n";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:25: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
11 | for (int i = 1; i < n: ++i) {
| ^
a.cc:11:30: error: expected ';' before ':' token
11 | for (int ... |
s380435332 | p03945 | C++ | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
char[] c = S.toCharArray();
int N = S.length();
int cnt = 0;
for(int i = 0 ; i < N - 1 ; i++) {
if(c[i] != c[i + 1]) {
cnt++;
}
}
System.out.print... | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s838323851 | p03945 | C++ | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
int i, j, k = 0, l, m, n;
using namespace std;
char S[100055], T[100055];
using namespace std;
int main() {
gets(S);
n = strlen(S);
for(i = 1; i < n; i++) {
if(S[i] != S[i-1]) ++l;
}
printf("%d\n", l);
} | a.cc: In function 'int main()':
a.cc:10:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
10 | gets(S);
| ^~~~
| getw
|
s584900072 | p03945 | C++ | #include<cstdio>
#include<cstring>
char s[100];
int ac,a,b,c,d;
int main(){
gets(s);
int len=strlen(s);
d=0; a=b=0;
for (int i=0; i<len; i++){
if (s[i]>='0'&&s[i]<='9'){
if (!d) a=a*10+s[i]-48;
else b=b*10+s[i]-48;
}
else if (s[i]=='+') c=1,d=1;
else if (s[i]=='-') c=-1,d=1;
}
printf("%d\n",a+c*b);
... | 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
|
s488639671 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
int res = 1;
bool flag;
cin >> s;
int len = s.size()
if (s[0] == 'B')
flag = 0;
else
flag = 1;
for (int i = 1; i < len; ++i)
{
if ((s[i] == 'B') && (!flag))
continue;
else if ((s[i] == 'W') && (flag))
continue;
else
{
res+... | a.cc: In function 'int main()':
a.cc:10:9: error: expected ',' or ';' before 'if'
10 | if (s[0] == 'B')
| ^~
a.cc:12:9: error: 'else' without a previous 'if'
12 | else
| ^~~~
|
s828942962 | p03945 | C++ | #include <iostream>
int main()
{
string s;
cin>>s;
} | a.cc: In function 'int main()':
a.cc:4:11: error: 'string' was not declared in this scope
4 | string s;
| ^~~~~~
a.cc:4:11: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/includ... |
s421272328 | p03945 | C++ | #include <bits/stdc++.h>
#define get_variable_name(x) #x
#define debug(x) cout << #x << " = " << x << endl
#define rep(i,n) for(int (i) = 0; (i) < (n); (i)++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())
#define REVERSE(x) reverse( (x).begin(),(x).end())
#define UNIQUE(x) (x).era... | a.cc: In function 'int main()':
a.cc:38:12: error: 's' was not declared in this scope
38 | cin >> s;
| ^
|
s722862657 | p03945 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <copy>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;
typedef ... | a.cc:14:10: fatal error: copy: No such file or directory
14 | #include <copy>
| ^~~~~~
compilation terminated.
|
s924172634 | p03945 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;
typedef long long ll;
ty... | a.cc: In function 'std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)':
a.cc:26:44: error: 'ostream_iterator' is not a member of 'std'
26 | std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
| ^~~~~~~~~~~~~~~~
a.cc:14:1: note: 's... |
s788091772 | p03945 | C++ | // cpp_console.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string s;
char h;
int cnt = 0;
cin >> s;
if(s[0] == s[s.length ()- 1]){
h = s[0];
for(int i = 1; i < s.length(); ++i){
if(h == s[i]... | a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s699882429 | p03945 | Java | public class Main {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
String board = scanner.next();
int stop = 0;
char last = board.charAt(0);
for (int i = 0; i < board.length(); i++) {
if (last != board.charAt(i)){
... | Main.java:4: error: cannot find symbol
Scanner scanner = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner scanner = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 ... |
s234957121 | p03945 | C++ | #include <string>
#include <iostream>
string osero;
char flag;
int answer = 0;
int main(){
cin >> osero;
flag = osero[0];
for (int i = 1; i < osero.size(); ++i){
if (osero[i] != flag){
answer++;
flag = osero[i];
}
}
printf("%d\n", answer);
return 0;
} | a.cc:4:1: error: 'string' does not name a type; did you mean 'stdin'?
4 | string osero;
| ^~~~~~
| stdin
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
9 | cin >> osero;
| ^~~
| std::cin
In file incl... |
s184507224 | p03945 | C++ | #include <iostream>
#include <string.h>
using namespace std;
int main() {
char s[100000];
size_t str=strlen(s);
scanf("%s",s);
int count=;0;
for(int i=0;i<str-1;i++){
for(j=i+1;j<str;j++){
if(s[i]!=s[j]){
count++;
}
}
}
cout<<count-1<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:19: error: expected primary-expression before ';' token
9 | int count=;0;
| ^
a.cc:11:21: error: 'j' was not declared in this scope
11 | for(j=i+1;j<str;j++){
| ^
|
s710618844 | p03945 | C++ | #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int x=0;
char s[100001];
cin >> s;
for(int i=1;i<strlen(s);i++)
{
if(s[i] != s[i-1])
{
x++;
}
}
cout << x;
} | a.cc: In function 'int main()':
a.cc:9:23: error: 'strlen' was not declared in this scope
9 | for(int i=1;i<strlen(s);i++)
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <stdlib.h>
+++... |
s955938131 | p03945 | C++ | #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int x=0;
char s[100001];
cin >> s;
for(int i=1;i<strlen(s);i++)
{
if(s[i] != s[i-1])
{
x++;
}
}
cout << x;
} | a.cc: In function 'int main()':
a.cc:9:23: error: 'strlen' was not declared in this scope
9 | for(int i=1;i<strlen(s);i++)
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <stdlib.h>
+++... |
s786090311 | p03945 | C++ | #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <string>
using namespace std;
int main() {
char S[100000];
scanf("%s", S);
int change = 0;
char c = S[0];
for (int i = 1; i < strlen(S); i++)
{
if (c != S[i]) change++;
c = S[i];
}
printf("%d\n", change);
r... | a.cc: In function 'int main()':
a.cc:12:25: error: 'strlen' was not declared in this scope
12 | for (int i = 1; i < strlen(S); i++)
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <string>
... |
s299106745 | p03945 | C++ | #include <iostream>
#include <string>
using namespace std;
int main()
{
char S[100000];
cin >> S;
int N = strlen(S);
int cnt = 0;
for (int i = 1; i < N; i++){
if (S[i] != S[i-1]) {
cnt++;
}
}
cout << cnt << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:12: error: 'strlen' was not declared in this scope
8 | int N = strlen(S);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
... |
s755756088 | p03945 | C++ | #include <iostream>
using namespace std;
int main()
{
char S[100000];
cin >> S;
int N = strlen(S);
int cnt = 0;
for (int i = 1; i < N; i++){
if (S[i] != S[i-1]) {
cnt++;
}
}
cout << cnt << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:12: error: 'strlen' was not declared in this scope
7 | int N = strlen(S);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
... |
s346078086 | p03945 | C++ | #include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
char s[100000];
int max(int a,int b) {
return (a < b) ? b : a;
}
int min(int a, int b) {
return (a > b) ? b : a;
}
int main() {
cin >> s;
int mode;
int num = 0;
if (s[0] == 'B') {
mode = 1;
}
else {
mode = 2;
}
int len = st... | a.cc: In function 'int main()':
a.cc:27:23: error: 'strlen' was not declared in this scope
27 | int len = strlen(s);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<algorithm>
+++ |+... |
s205630303 | p03945 | C++ | /#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
int main() {
string s;
cin >> s;
int cnt = 0;
char p;
rep(i, 0, s.length()) {
if (i == 0) p = s[i];
if (p != s[i]) {
cnt++;
p = s[i];
}
}
cout << cnt << endl;
return 0;
} | a.cc:1:2: error: stray '#' in program
1 | /#include<bits/stdc++.h>
| ^
a.cc:1:1: error: expected unqualified-id before '/' token
1 | /#include<bits/stdc++.h>
| ^
a.cc: In function 'int main()':
a.cc:7:9: error: 'string' was not declared in this scope
7 | string s;
| ^~~~~~... |
s711561680 | p03945 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// 整数の入力
String S = sc.next();
// スペース区切りの整数の入力
String sa[] = new String[S.length()];
int counter = 0;
for(int i=0; i<S.length(); i++){
sa[i] = S.charAt(i);
if(i > 1){
if(sa[i].e... | Main.java:11: error: incompatible types: char cannot be converted to String
sa[i] = S.charAt(i);
^
1 error
|
s547588408 | p03945 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// 整数の入力
String S = sc.nextInt();
// スペース区切りの整数の入力
String sa[] = new String[S.length];
int counter = 0;
for(int i=0; i<S.length; i++){
sa[i] = S.charAt(i);
if(i > 1){
if(sa[i].eq... | Main.java:6: error: incompatible types: int cannot be converted to String
String S = sc.nextInt();
^
Main.java:8: error: cannot find symbol
String sa[] = new String[S.length];
^
symbol: variable length
location: variable S of type String
Main.java:10: error: ... |
s497101649 | p03946 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <map>
using namespace std;
class Solution{
public:
int min_cost(const vector<int>& A){
map<int, int> freq;
for(int start = 0, i = start + 1; i <= A.size(); i ++)
if(i == A.size() || A[i] < A[i - 1]){
fr... | a.cc: In member function 'int Solution::min_cost(const std::vector<int>&)':
a.cc:22:9: error: 'assert' was not declared in this scope
22 | assert(freq.rbegin()->first > 0);
| ^~~~~~
a.cc:5:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>... |
s201507358 | p03946 | C++ | /*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#inclu... | a.cc: In function 'void solve()':
a.cc:37:15: error: 'INT_MAX' was not declared in this scope
37 | int mn = INT_MAX, x, mx = 0 ;
| ^~~~~~~
a.cc:18:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
17 | #include <functional>
+++ ... |
s056606204 | p03946 | C++ | #pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
using namespace std;
const int MAX_N = 100000;
int N, T;
int A[MAX_N];
map<int, int, greater<int>> mp;
int main()
{
ios::sync_with_stdio(false);
... | a.cc: In function 'int main()':
a.cc:25:16: error: 'INT_MAX' was not declared in this scope
25 | int minc = INT_MAX;
| ^~~~~~~
a.cc:9:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
8 | #include <queue>
+++ |+#include <climit... |
s555437434 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1... | a.cc: In function 'int main()':
a.cc:37:14: error: no matching function for call to 'max(std::map<long long int, int>::mapped_type&, long long int)'
37 | cout<<max(mp[MX],1ll)<<endl;
| ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_6... |
s661200896 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std ;
int n,t,sum,maxn,maxn1,ans,a[100001];
int main()
{
cin>>n>>t;
for(int i=1;i<=n;i++) cin>>a[i];
for(int i=n;i;i--)
{
maxn=max(a[i],maxn);
sum=max(maxn-a[i],sum);
}。
for(int i=n;i;i--)
{
maxn1=max(a[i],maxn1);
if(max... | a.cc:12:6: error: extended character 。 is not valid in an identifier
12 | }。
| ^
a.cc: In function 'int main()':
a.cc:12:6: error: '\U00003002' was not declared in this scope
12 | }。
| ^~
a.cc:13:17: error: 'i' was not declared in this scope
13 | for(int i=n;i;i--)
| ... |
s770317828 | p03946 | C++ | あ | a.cc:1:1: error: '\U00003042' does not name a type
1 | あ
| ^~
|
s885876539 | p03946 | 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:27:12: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'll' {aka 'long long int'})
27... |
s177019516 | p03946 | 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:32:34: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
32 | if(MINd==diff[i])S.insert(MIN[i]);
| ^
|
s231541768 | p03946 | C++ | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
#define DEBUG 1
#define ll long long
... | a.cc: In function 'int main()':
a.cc:38:18: error: 'MOD' was not declared in this scope
38 | int be_min = MOD;
| ^~~
|
s395928789 | p03946 | C++ | #include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),... | a.cc: In function 'int main()':
a.cc:47:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
47 | for(int i=n-1;i>=0:i--){
| ^
a.cc:47:21: error: expected ';' before ':' token
47 | for(int i=n-1;i>=0:i--){
| ... |
s134970308 | p03946 | Java | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int t = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = Integer.parseInt(sc.next());
int[] b = new int[n]; Arra... | Main.java:48: error: cannot find symbol
if((b[i]-a[i]==dis)&&!(bool[b[i]])) {
^
symbol: variable bool
location: class Main
Main.java:49: error: cannot find symbol
bool[b[i]] = true;
^
symbol: variable bool
location: class Main
2 errors
|
s715923003 | p03946 | Java | import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int t = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = Integer.parseInt(sc.next(... | Main.java:49: error: reached end of file while parsing
}
^
1 error
|
s772089009 | p03946 | C++ | #include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#define N 100005
using namespace std;
int n, t;
int a[N];
int main() {
cin>>n>>t;
for (int i = 0; i < n; ++i) {
cin>>a[i];
}
int minv = INT_MAX;
int maxv = 0;
for (int i = 0; i < n; ++i) {
if (i == 0) {
minv = min(minv, a[... | a.cc: In function 'int main()':
a.cc:14:14: error: 'INT_MAX' was not declared in this scope
14 | int minv = INT_MAX;
| ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include <set>
+++ |+#include <climits>
... |
s089468004 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(void){
int n,t,max=0,c=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2;i>=0;i--){
sort(b+i+1,b+i+2+c);
c++;
if(max==b[... | a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s707548678 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(){
int n,t,max=0,c=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2;i>=0;i--){
sort(b+i+1,b+i+2+c);
c++;
if(max==b[n-1]... | a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s820993972 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(){
int n,t,max=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2,c=0;i>=0;i--,c++){
sort(b+i+1,b+i+2+c);
if(max==b[n-1]-a[i]){
... | a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s510379950 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(){
long int n,t,max=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2,c=0;i>=0;i--,c++){
sort(b+i+1,b+i+2+c);
if(max==b[n-1]-a[i... | a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s104016134 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(){
int n,t,max=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2,c=0;i>=0;i--,c++){
sort(b+i+1,b+i+2+c);
if(max==b[n-1]-a[i]){
... | a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s983780163 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(void){
int n,t,max=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2,c=0;i>=0;i--,c++){
sort(b+i+1,b+i+2+c);
if(max==b[n-1]-a[i]... | a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s898932045 | p03946 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
typede... | a.cc: In function 'int main()':
a.cc:33:17: error: no matching function for call to 'min(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
33 | mn = min(mn, a[i]);
| ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/... |
s629422314 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;
int main()
{
int n,t,min=1000000009;
cin>>n>>t;
vector<int> a(n),b(n);
std::map<int, int> mp;
for (int i = 0; i < n; ++i)
{
cin>>a[i];
b[i] = (min>a[i] ? 0:a[i]-min);
min=std::min(min,a[i]);
mp[b[i]]++;
}
sort(b.... | a.cc: In function 'int main()':
a.cc:19:20: error: expected ']' before ';' token
19 | cout<<mp[b.back();
| ^
| ]
|
s564550193 | p03946 | C++ | N, T = map(int,input().split())
A = list(map(int,input().split()))
p = 0
ans = 1
for i in range(1, N):
if p == A[i] - A[i-1]:
ans += 1
elif p < A[i] - A[i-1]:
p = A[i] - A[i-1]
ans = 1
print(ans)
| a.cc:1:1: error: 'N' does not name a type
1 | N, T = map(int,input().split())
| ^
|
s537329939 | p03946 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else... | a.cc: In function 'int main()':
a.cc:117:2: error: expected '}' at end of input
117 | }
| ^
a.cc:86:11: note: to match this '{'
86 | int main(){
| ^
|
s293579122 | p03946 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else... | a.cc: In function 'int main()':
a.cc:122:2: error: expected '}' at end of input
122 | }
| ^
a.cc:86:11: note: to match this '{'
86 | int main(){
| ^
|
s237252327 | p03946 | C++ | #include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>
using namespace std;
using ll = long long;
void Print(vector<ll> nums)
{
for (int i = 0; i < nums.size(); i++)
{
cout << nums[i] << " ";
}
cout << endl;
}
int main()
{
int n, t;
cin ... | a.cc: In function 'int main()':
a.cc:32:18: error: 'pow' was not declared in this scope
32 | ll min = pow(10, 10);
| ^~~
|
s782695446 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int n,t,res=0;
vector <int> v;
cin >> n;
for(int i=0;i<n;i++)
{
cin >> t;
v.push_back(t);
}
int lo = v[0],hi=v[0];
for(int i=1;i<n;i++)
{
if(v[i]<hi)
{ ... | a.cc:3:21: error: extended character is not valid in an identifier
3 | using namespace std;
| ^
a.cc:3:21: error: '\U000000a0' does not name a type
3 | using namespace std;
| ^
|
s645912160 | p03946 | C++ | #include <bits/stdc++.h> using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n,t,res=0; vector <int> v; cin >> n; for(int i=0;i<n;i++) { cin >> t; v.push_back(t); } int lo = v[0],hi=v[0]; for(int i=1;i<n;i++) { if(v[i]<hi) { res++; lo = v[i]; hi = v[i]; } else { hi = v[i]; } } if(lo!=hi) ... | a.cc:1:26: warning: extra tokens at end of #include directive
1 | #include <bits/stdc++.h> using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n,t,res=0; vector <int> v; cin >> n; for(int i=0;i<n;i++) { cin >> t; v.push_back(t); } int lo = v[0],hi=v[0]; for(int i=1;i<n;i++) { if(v[i]<... |
s884984080 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int n,t,res=0;
vector <int> v;
cin >> n;
for(int i=0;i<n;i++)
{
cin >> t;
v.push_back(t);
}
in lo = v[0],hi=v[0];
for(int i=1;i<n;i++)
{
if(... | a.cc: In function 'int main()':
a.cc:20:5: error: 'in' was not declared in this scope; did you mean 'n'?
20 | in lo = v[0],hi=v[0];
| ^~
| n
a.cc:23:18: error: 'hi' was not declared in this scope; did you mean 'i'?
23 | if(v[i]<hi)
| ^~
| ... |
s796833660 | p03946 | C++ | #pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;... | a.cc:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
a.cc: In function 'void Sequence()':
a.cc:49:18: error: expected primary-expression before '<<' token
49 | cout << << endl;
| ^~
|
s085529532 | p03946 | 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>
#include <utility>
#define ALL(obj) (ob... | a.cc: In function 'int main()':
a.cc:50:20: error: 'max_v' was not declared in this scope
50 | }else if(cost==max_v-min_v){
| ^~~~~
|
s039901909 | p03946 | C++ | include<bits/stdc++.h>
using namespace std;
int main(){
int n,t,p,q=0,ans=0;
bool x[1000000001]={0};
scanf("%d %d",&n,&t);
vector<int> a(n);
for (auto&e:a) scanf("%d",&e);
p=a[0];
for (int i=1;i<n;i++) {
p=min(p,a[i]);
q=max(q,a[i]-p);
}
p=a[0];
for (int i=1;i<n... | a.cc:1:1: error: 'include' does not name a type
1 | include<bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'scanf' was not declared in this scope
8 | scanf("%d %d",&n,&t);
| ^~~~~
a.cc:9:5: error: 'vector' was not declared in this scope
9 | vector<int> a(n)... |
s757763813 | p03946 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(void)
{
int n, t;
cin >> n >> t;
vector<int> a(n);
vector<int> b(n);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n; i++)
{
int max = 0;
for (int j = i+1; j < n; j++)
{
if(a[j]-a[i] > max )
{
max = a[j] - a... | a.cc: In function 'int main()':
a.cc:30:9: error: 'sort' was not declared in this scope; did you mean 'short'?
30 | sort(b.begin(), b.end());
| ^~~~
| short
|
s488285251 | p03946 | C++ |
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>
#define rep(i,b) for(int i=0;i<b;i++)
#define rrep(i,a,b) for(int i=a;i<=b;i++)
#define for... | a.cc: In function 'int main()':
a.cc:41:24: error: 'INT_MAX' was not declared in this scope
41 | int min_cost = INT_MAX;
| ^~~~~~~
a.cc:16:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
15 | #include <iomanip>
+++... |
s656470087 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long int64;
#define debug(x) cerr << #x << ":" << x << endl;
int main()
{
int N, T;
cin >> N >> T;
vector< int64 > a(N);
for (int i = 0; i < N; ++i) cin >> a[i];
map< int64, int64 > mp;
int l = a[0];
for (int i = 0; i < N; ++i) {
if (i == N -... | a.cc: In function 'int main()':
a.cc:18:14: error: no matching function for call to 'min(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
18 | l = min(l, a[i]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
fr... |
s890941475 | p03946 | C++ | //#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include... | a.cc: In function 'int main()':
a.cc:56:27: error: invalid types 'll {aka long long int}[int]' for array subscript
56 | temp_m = (a[i] - a_min[i-1]);
| ^
|
s144615208 | p03946 | C++ | int main(void) {
int N,T;
scanf("%d %d",&N,&T);
int A,min=10000,ans=0,num=0;
for (int i = 0; i < N; i++) {
cin >> A;
min = std::min(min,A);
if (ans < A-min) {
ans = A - min;
num = 1;
}else if(ans == A-min){
num ++;
}
}
printf("%d\n",num);
}
| a.cc: In function 'int main()':
a.cc:3:3: error: 'scanf' was not declared in this scope
3 | scanf("%d %d",&N,&T);
| ^~~~~
a.cc:9:5: error: 'cin' was not declared in this scope; did you mean 'min'?
9 | cin >> A;
| ^~~
| min
a.cc:10:16: error: 'min' is not a member of 'std'
10... |
s540289043 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, t, a[100010];
cin >> n >> t;
for (int i = 0; i < n; i++) cin >> a[i];
long long p[100010] = {}, mi = 1 << 30;
for (int i = 0; i < n; i++) {
mi = min(mi, a[i]);
p[i] = a[i] - mi;
}
sort(p, p + n);
... | a.cc: In function 'int main()':
a.cc:12:17: error: no matching function for call to 'min(long long int&, int&)'
12 | mi = min(mi, a[i]);
| ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
... |
s241553421 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll ;
long long gcd(long long aaa,long long bbb) {
if(bbb==0) {
return aaa;
}
return gcd(bbb,aaa%bbb);
}
int main (){
ll N,T,M=0,ans=1,cmp=0,tmppp=0;
cin >> N >> T;
ll A[N],tmp,tmpp,mi[N],ma[N];
for(ll i = 0; i < N... | a.cc: In function 'int main()':
a.cc:24:13: error: 'm' was not declared in this scope
24 | m[i] = tmp;
| ^
|
s676856622 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x) cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int
signed main(void)
{
cin.tie(0);
ios:... | a.cc: In function 'int main()':
a.cc:9:13: error: 'long long long' is too long for GCC
9 | #define int long long int
| ^~~~
a.cc:3:22: note: in expansion of macro 'int'
3 | #define ll long long int
| ^~~
a.cc:23:39: note: in expansion of macro 'll'
23 | ... |
s523930087 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x) cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int
signed main(void)
{
cin.tie(0);
ios:... | a.cc: In function 'int main()':
a.cc:23:37: error: no matching function for call to 'max(int, long long int)'
23 | MAXyen = max(MAXyen, max(0, a[j-1] - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr... |
s749521969 | p03946 | C++ | #include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;
int main(void)
{
int N, T;
cin >> N >> T;
vector<long long> A(N);
for(int i=0; i<N; i++)
cin >> A[i];
long long y = A[0];
vector<long long> b(N);
for(int i=0; i<N; i++)
{
y = min(y, A[i]);
... | a.cc:33:39: error: 'b' was not declared in this scope
33 | long long maxb = *max_element(b.begin(), b.end());
| ^
a.cc:33:50: error: 'b' was not declared in this scope
33 | long long maxb = *max_element(b.begin(), b.end());
| ... |
s616503803 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int N, T, tmp, i, dif = 0;
vector<int> difnum(N, 0);
vector<int> Ai;
cin >> N >> T;
for (i = 0; i < N; ++i)
{
cin >> tmp;
Ai.push_back(tmp);
}
for (i = 0; i < N; ++i)
{
for (int j = 0; j < N - i - 1; ++j)
{
if (Ai[j] - Ai[i] > dif)
{
d... | a.cc: In function 'int main()':
a.cc:28:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>')
28 | cout << difnum;
| ~~~~ ^~ ~~~~~~
| | |
| | std::vector<int>
| std::o... |
s928390910 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int N, T, tmp, i, dif = 0, difnum = 0;
vector<int> Ai;
cin >> N >> T;
for (i = 0; i < N; ++i)
{
cin >> tmp;
Ai.push_back(tmp);
}
for (i = 0; i < N; ++i)
{
for (int j = 0; j < N - i - 1; ++j)
{
if (Ai[j] - Ai[i] > dif)
{
dif = Ai[j] - Ai... | a.cc: In function 'int main()':
a.cc:23:41: error: expected ';' before ':' token
23 | ++difnum:
| ^
| ;
|
s408189107 | p03946 | C++ | #include <iostream>
using namespace std;
int a[100000], b[100000], min, max = 0, n, t, c;
int main() {
cin >> n >> t;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
min = a[0];
for (int i = 0; i < n; i++) {
b[i] = a[i] - min;
if (b[i] < 0)min = a[i];
if (b[i] > max)max = b[i];
}
for (int i = 0; i < n; ... | a.cc: In function 'int main()':
a.cc:12:9: error: reference to 'min' is ambiguous
12 | min = a[0];
| ^~~
In file included 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,
... |
s688560796 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,t,count=0,max=0;
int a[100000]={};
cin>>n>>t;
for(int i=0;i<n;i++)cin>>a[i];
int min=a[0];
for(int i=1;i<n;i++){
if(a[i]<min)min=a[i];
if(a[i-1]<a[i])
if(a[i]-min>max){
max=a[i]-min;
count=0;
}
else (a[i]-min==max)count++;
}
cout... | a.cc: In function 'int main()':
a.cc:16:24: error: expected ';' before 'count'
16 | else (a[i]-min==max)count++;
| ^~~~~
| ;
|
s054497718 | p03946 | C++ | #include <iostream>
#include <array>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::max;
using std::max_element;
using std::count;
int main()
{
int N, T, maxProfit = 0;
cin >> N >> T;
vector<int> prices;
vector<int> maxProfits;
for(int i = 0; i < N; i++)... | a.cc:10:12: error: 'max_element' has not been declared in 'std'
10 | using std::max_element;
| ^~~~~~~~~~~
a.cc:11:12: error: 'count' has not been declared in 'std'
11 | using std::count;
| ^~~~~
a.cc: In function 'int main()':
a.cc:40:20: error: 'max_element' was not declared in... |
s339865698 | p03946 | C | #include <stdio.h>
int main(void){
int n,t,a[100000],i,j,max=-114514,ans=0;
scanf("%d %d",&n,&t);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
max=max>a[j]-a[i]?max:a[j]-a[i];
}
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(a[j]-a[i]==max){
ans++;
}
}
}
print... | main.c: In function 'main':
main.c:21:1: error: expected declaration or statement at end of input
21 | }
| ^
|
s183429960 | p03946 | C++ | a | a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s826460334 | p03946 | C++ | #include <stdlib.h>
#include <iostream>
using namespace std;
int main(){
int n;
int t;
cin >> n >> t;
int *a = (int*)malloc(n * sizeof(int));
int *mina = (int*)malloc(n * sizeof(int));
int minv = INT_MAX;
for(int i = 0; i < n; i++){
cin >> a[i];
if(minv > a[i]) minv = a[i];
mina[i] = minv;
}
int thi... | a.cc: In function 'int main()':
a.cc:13:20: error: 'INT_MAX' was not declared in this scope
13 | int minv = INT_MAX;
| ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
2 | #include <iostream>
+++ |+#incl... |
s008175932 | p03946 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, T;
cin >> N >> T;
int mini;
cin >> mini;
int maxi=0;
vector<int> A(n);
A[0] = 0;
for (int i=1; i<N; i++) {
cin >> A[i];
if (mini > A[i]) mini = A[i];
A[i] -= mini;
if (maxi < A[i]) maxi = A[i];
}
int a... | a.cc: In function 'int main()':
a.cc:12:17: error: 'n' was not declared in this scope
12 | vector<int> A(n);
| ^
|
s967532667 | p03946 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
using li = long int;
#define MAX_N 10000
int n;
int a[MAX_N] = {0};
int diff[MAX_N] = {0};
int mins[MAX_N] = {0};
int t;
void solve(){
int tmp_min = a[0];
for(int i = 0; i < n - 1; i++){
mins[i] = min(tmp_min, a[i]);
tmp_min = mins... | a.cc: In function 'void solve()':
a.cc:26:23: error: no matching function for call to 'max(li&, int&)'
26 | max_diff = max(max_diff, diff[i]);
| ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h... |
s769259185 | p03946 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdlib>
#define NMAX 100000
#define MMAX 10000
using namespace std;
vector<int > group[NMAX];
int main(){
int N,T,A[NMAX] = {},dif[NMAX] = {},most = 0,first,end = 0,num = 0,gr_num = 0;
cin >> N >> T;
for (int i = 0; i < N; ++i)
{
ci... | a.cc: In function 'int main()':
a.cc:22:33: error: 'sort' was not declared in this scope; did you mean 'short'?
22 | sort(group[gr_num].begin(), group[gr_num].end());
| ^~~~
| short
a.cc:28:25: error: 'sort' w... |
s292971749 | p03946 | C++ | // g++ temp.cpp
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published b... | a.cc: In function 'void solve()':
a.cc:147:23: error: 'l' was not declared in this scope
147 | } else if(a[i]-s==l){
| ^
a.cc:148:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
148 | ans++;
| ^~~
| abs
a.cc:151:7: error: 'ans' was no... |
s347471146 | p03946 | C++ | //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>
using namespa... | a.cc: In function 'int main()':
a.cc:37:25: error: expected ',' or ';' before 'if'
37 | if(val >0) diff.push_back(a[j]-a[i]);
| ^~
|
s885612449 | p03946 | C++ | //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>
using namespa... | a.cc: In function 'int main()':
a.cc:37:25: error: expected ',' or ';' before 'if'
37 | if(val) diff.push_back(a[j]-a[i]);
| ^~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.