submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s804816396 | p03720 | C++ | #include <iostream>
#include <vector>
#include <cstdint>
using namespace std;
int main()
{
int_least32_t n, m;
cin >> n >> m;
vector<int_least32_t> v( n. 0 );
int_least32_t a, b;
for(auto& x : v) {
cin >> a >> b;
++v[a - 1];
++v[b - 1];
}
for(auto$ x : v) {
cout << x << endl;
}
}
| a.cc: In function 'int main()':
a.cc:12:37: error: expected unqualified-id before numeric constant
12 | vector<int_least32_t> v( n. 0 );
| ^
a.cc:20:13: error: 'auto$' was not declared in this scope; did you mean 'auto'?
20 | for(auto$ x : v) {
| ^~~~~
| auto
a.cc:23:1: error: expected primary-expression before '}' token
23 | }
| ^
a.cc:22:10: error: expected ';' before '}' token
22 | }
| ^
| ;
23 | }
| ~
a.cc:23:1: error: expected primary-expression before '}' token
23 | }
| ^
a.cc:22:10: error: expected ')' before '}' token
22 | }
| ^
| )
23 | }
| ~
a.cc:20:12: note: to match this '('
20 | for(auto$ x : v) {
| ^
a.cc:23:1: error: expected primary-expression before '}' token
23 | }
| ^
|
s754976172 | p03720 | C++ | #include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
int m, n;int a[55];
ios::sync_with_stdio;
cin >> m >> n;
memset(a, 0, sizeof(a));
for (int i = 0; i < n; i++) {
int aa, bb;
cin >> aa >> bb;
a[aa]++;
a[bb]++;
}
for (int i = 1; i <= m; i++)
cout << a[i] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:9: error: 'memset' was not declared in this scope
15 | memset(a, 0, sizeof(a));
| ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
8 | #include <cstdlib>
+++ |+#include <cstring>
9 | using namespace std;
|
s423207501 | p03720 | C++ | #include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
using namespace std;
int a[1000];
int main()
{
int m, n;
cin >> m >> n;
memset(a, 0, sizeof(a));
for (int i = 0; i < n; i++) {
int aa, bb;
cin >> aa >> bb;
if (aa != bb) {
a[aa]++;
a[bb]++;
}
}
for (int i = 1; i <= m; i++)
cout << a[i] << endl;
//system("pause");
return 0;
} | a.cc: In function 'int main()':
a.cc:15:9: error: 'memset' was not declared in this scope
15 | memset(a, 0, sizeof(a));
| ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
8 | #include <cstdlib>
+++ |+#include <cstring>
9 | using namespace std;
|
s274033292 | p03720 | C++ | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int n, m, *ccnt, cnt;
scanf("%d %d", &n, &m);
ccnt = (int)malloc(sizeof(int) * n);
memset(ccnt, 0, m);
for(cnt = 0; cnt < m; cnt++)
{
scanf("%d %d", a, b);
ccnt[a - 1] +=1;
ccnt[b - 1] +=1;
}
for(cnt = 0; cnt < n;cnt++)
{
printf("%d\n", ccnt[cnt]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:12: error: cast from 'void*' to 'int' loses precision [-fpermissive]
9 | ccnt = (int)malloc(sizeof(int) * n);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:12: error: invalid conversion from 'int' to 'int*' [-fpermissive]
9 | ccnt = (int)malloc(sizeof(int) * n);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
a.cc:11:5: error: 'memset' was not declared in this scope
11 | memset(ccnt, 0, m);
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <stdlib.h>
+++ |+#include <cstring>
3 |
a.cc:15:24: error: 'a' was not declared in this scope
15 | scanf("%d %d", a, b);
| ^
a.cc:15:27: error: 'b' was not declared in this scope
15 | scanf("%d %d", a, b);
| ^
|
s074090162 | p03720 | C++ | #include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
using namespace std;
int a[1000];
int main()
{
int m, n;
cin >> m >> n;
memset(a, 0, sizeof(a));
for (int i = 0; i < n; i++) {
int aa, bb;
cin >> aa >> bb;
a[aa]++;
a[bb]++;
}
for (int i = 1; i <= m; i++)
cout << a[i] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:9: error: 'memset' was not declared in this scope
15 | memset(a, 0, sizeof(a));
| ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
8 | #include <cstdlib>
+++ |+#include <cstring>
9 | using namespace std;
|
s889027809 | p03720 | C++ | #include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
int i, j = 0;
int N, M = 0;
int A[50] = {};
int a, b = 0;
cin >> N;
cin >> M;
for (i = 0; i <= M-1; i++) {
cin >> a;
cin >> b;
A[a-1] += 1;
A[b-1] += 1;
}
for (j = 0; j <= N-1; j++) {
printf("%d\n", A[j]);
}
cin >> i;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
12 | cin >> N;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include <string.h>
+++ |+#include <iostream>
3 |
|
s168752378 | p03720 | C | include<stdio.h>
int main(void){
int n,m,a[100],b[100],i,j,count;
scanf("%d %d",&n,&m);
for(i=0;i<m;i++){
scanf("%d %d",&a[i],&b[i]);
}
count = 0;
for(i=0;i<n;i++){
count = 0;
for(j=0;j<m;j++){
if(a[j]==i+1){
count = count + 1;
}
if(b[j]==i+1){
count = count + 1;
}
}
printf("%d\n",count);
}
return 0;
} | main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
|
s427220796 | p03720 | C | include<stdio.h>
int main(void){
int n,m,a[100],b[100],i,j,count;
scanf("%d %d",&n,&m);
for(i=0;i<m;i++){;
scanf("%d %d",&a[i],&b[i]);
}
count = 0;
for(i=0;i<n;i++){
count = 0;
for(j=0;j<m;j++){
if(a[j]==i+1){
count = count + 1;
}
if(b[j]==i+1){
count = count + 1;
}
}
printf("%d\n",count);
}
return 0;
}
| main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
|
s058186878 | p03720 | C | #include<stdio.h>
int main(void){
int n, m;
int i;
int a, b;
int city[1000] = {0};
scanf("%d%d",&n,&m);
for(i = 0;i < N; ++i){
scanf("%d%d", &a, &b);
city[a] += 1;
city[b] += 1;
}
for(i = 1;i <= m; i++) printf("%d\n", city[i]);
return 0;
} | main.c: In function 'main':
main.c:9:16: error: 'N' undeclared (first use in this function)
9 | for(i = 0;i < N; ++i){
| ^
main.c:9:16: note: each undeclared identifier is reported only once for each function it appears in
|
s372269929 | p03720 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
int a[M], b[M];
for (int i = 0; i < M; i++) {
cin >> a[i] >> b[i];
}
int c[M];
for (int i = 0; i < M; i++) c[i] = 0;
for (int i = 0; i < M; i++) {
if (a[i] == i+1) c[i]++;
if (b[i] == i+1) c[i]++;
}
for (int i = 0; i < M; i++) {
c[i] /= 2
}
for (int i = 0; i < M; i++) {
cout << c[i] << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:22:14: error: expected ';' before '}' token
22 | c[i] /= 2
| ^
| ;
23 | }
| ~
|
s803575098 | p03720 | C++ | #include <cstdio>
#include <cstring>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
#define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl;
#define sci(x) int x;scanf("%d",&x);
#define scii(x, y) int x,y;scanf("%d%d",&x,&y);
#define REP(i,y) for(int i=0;i<(int)(y);i++)
#define REPP(i,y) for(int i=1;i<=(int)(y);i++)
vector<int> vec;
int main() {
scii(N,M)
REP(_,M) {
scii(a,b);
vec.push_back(a);
vec.push_back(b);
}
REPP(i,N) {
cout << count(vec.begin(), vec.end(), i) << endl;
}
} | a.cc: In function 'int main()':
a.cc:23:13: error: 'count' was not declared in this scope
23 | cout << count(vec.begin(), vec.end(), i) << endl;
| ^~~~~
|
s766358706 | p03720 | C++ | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(int argc, char* argv[]) {
int n, m; cin >> n >> m;
vector<int> a, b;
for (int i = 0; i < m; i++) {
int aa, bb; cin >> aa >> bb;
a.pushback(aa);
b.pushback(bb);
}
vector<int> ans;
for (int i = 0; i < n; i++) {
ans.pushback(0);
}
for (int i = 0; i < m; i++) {
ans[a[i] - 1]++;
ans[b[i] - 1]++;
}
for (auto x : ans) {
cout << x << endl;
}
return 0;
}
| a.cc: In function 'int main(int, char**)':
a.cc:11:19: error: 'class std::vector<int>' has no member named 'pushback'; did you mean 'push_back'?
11 | a.pushback(aa);
| ^~~~~~~~
| push_back
a.cc:12:19: error: 'class std::vector<int>' has no member named 'pushback'; did you mean 'push_back'?
12 | b.pushback(bb);
| ^~~~~~~~
| push_back
a.cc:16:21: error: 'class std::vector<int>' has no member named 'pushback'; did you mean 'push_back'?
16 | ans.pushback(0);
| ^~~~~~~~
| push_back
|
s850069407 | p03720 | C++ | 8 8
1 2
3 4
1 5
2 8
3 7
5 2
4 1
6 8 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 8 8
| ^
|
s331944572 | p03720 | C++ | 8 8
1 2
3 4
1 5
2 8
3 7
5 2
4 1
6 8 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 8 8
| ^
|
s252161530 | p03720 | C++ | #include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include<iomanip>
using namespace std;
int main() {
vector<int> load;
int n, m;
int s, e;
cin >> n >> m;
load.resize(n);
for (int& v : load) {
v = 0;
}
while (cin >> s >> e) {
load[s - 1]++;
load[e - 1]++;
}
for (int i = 0; i < n; i++) {
cout << load[i] << endl;
}
return 0;
| a.cc: In function 'int main()':
a.cc:36:18: error: expected '}' at end of input
36 | return 0;
| ^
a.cc:12:12: note: to match this '{'
12 | int main() {
| ^
|
s424697930 | p03720 | C | /*ABC*/
#include<stdio.h>
int main(){
int n,m;
scanf("%d %d",&n,&m);
int a[m],b[m],ans[n];
int i;
for(i=0;i<n;i++){
ans[i]=0;
}
for(i=0;i<m;i++){
scanf("%d %d",a[i],b[i]);
ans(a[i])++;
ans(b[i])++;
}
for(i=0;i<n;i++){
printf("%d\n",ans[i]);
}
return 0;
}
| main.c: In function 'main':
main.c:13:5: error: called object 'ans' is not a function or function pointer
13 | ans(a[i])++;
| ^~~
main.c:6:17: note: declared here
6 | int a[m],b[m],ans[n];
| ^~~
main.c:14:5: error: called object 'ans' is not a function or function pointer
14 | ans(b[i])++;
| ^~~
main.c:6:17: note: declared here
6 | int a[m],b[m],ans[n];
| ^~~
|
s121699315 | p03720 | C++ | #include <stdio.h>
void main(){
int n,m;
int road[100];
for(int i =0; i < 100; i++){
road[i] = 0;
}
scanf("%d%d", &n, &m);
for(int i =0; i < m; i++){
int a,b;
scanf("%d%d", &a, &b);
road[a-1]++;
road[b-1]++;
}
for(int i =0; i < n; i++){
printf("%d\n", road[i]);
}
}
| a.cc:3:1: error: '::main' must return 'int'
3 | void main(){
| ^~~~
|
s355774291 | p03720 | C | /*ABC*/
#include<stdio.h>
int main(){
int n,m;
scanf("%d %d",&n,&m);
int a[m],b[m],ans[n];
for(int i=0;i<n;i++){
ans[i]=0;
}
for(i=0;i<m;i++){
scanf("%d %d",a[i],b[i]);
ans(a[i])++;
ans(b[i])++;
}
for(i=0;i<n;i++){
printf("%d\n",ans[i]);
}
return 0;
}
| main.c: In function 'main':
main.c:10:7: error: 'i' undeclared (first use in this function)
10 | for(i=0;i<m;i++){
| ^
main.c:10:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:5: error: called object 'ans' is not a function or function pointer
12 | ans(a[i])++;
| ^~~
main.c:6:17: note: declared here
6 | int a[m],b[m],ans[n];
| ^~~
main.c:13:5: error: called object 'ans' is not a function or function pointer
13 | ans(b[i])++;
| ^~~
main.c:6:17: note: declared here
6 | int a[m],b[m],ans[n];
| ^~~
|
s637128020 | p03720 | C++ | #include<stdio.h>
int main()
{
int N,M;
int a[50],b[50],town[50];
int i;
scanf("%d %d",&N,&M);
for(i=0;i<M;i++)
scanf_n("%d %d",&a[i],&b[i]);
for(i=0;i<M;i++)
{
town[a[i]]++;
town[b[i]]++;
}
for(i=0;i<M;i++)
printf("%d\n",town[i]);
return 0;
} | a.cc: In function 'int main()':
a.cc:9:1: error: 'scanf_n' was not declared in this scope; did you mean 'scanf'?
9 | scanf_n("%d %d",&a[i],&b[i]);
| ^~~~~~~
| scanf
|
s188520237 | p03720 | C++ | int main() {
int N, M, a, b, R[50] = { 0 };
scanf("%d %d", &N, &M);
for (int i = 0; i < M; i++) {
scanf("%d %d", &a, &b);
R[a - 1]++;
R[b - 1]++;
}
for (int i = 0; i < N; i++)
printf("%d\n", R[i]);
while (true);
} | a.cc: In function 'int main()':
a.cc:3:9: error: 'scanf' was not declared in this scope
3 | scanf("%d %d", &N, &M);
| ^~~~~
a.cc:10:17: error: 'printf' was not declared in this scope
10 | printf("%d\n", R[i]);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | int main() {
|
s258253836 | p03720 | C++ | #include <iostream>
using namespace std;
int main(){
int n, m;
cin > n >> m;
int a[m], b[m];
for(int i=0; i<m; i++) cin >> a[i] >> b[i];
int r[n];
for(int i=0; i<n; i++) r[i]=0;
for(int i=0; i<m; i++){
r[a[i]-1] += 1;
}
for(int i=0; i<m; i++){
r[b[i]-1] += 1;
}
for(int i=0; i<n; i++) cout << r[i] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:13: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
6 | cin > n >> m;
| ~~~ ^ ~~~~~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:6:13: note: candidate: 'operator>(int, int)' (built-in)
6 | cin > n >> m;
| ~~~~^~~~~~~~
a.cc:6:13: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
6 | cin > n >> m;
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
6 | cin > n >> m;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
6 | cin > n >> m;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
6 | cin > n >> m;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
6 | cin > n >> m;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
6 | cin > n >> m;
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
6 | cin > n >> m;
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
6 | cin > n >> m;
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
6 | cin > n >> m;
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
6 | cin > n >> m;
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>'
6 | cin > n >> m;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:6:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>'
6 | cin > n >> m;
| ^
|
s694233147 | p03720 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ist istream_iterator
#define ost ostream_iterator
ll const inf = 100 * 1000;
int const N = (1 << 17) + 16;
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int n, m;
vector<int> cnt(n+1);
for(int i = 0; i < m; ++i) {
int x, y;
cin >> x >> y;
a[x]++;
a[y]++;
}
copy_n(a.begin()+1, n, ostream_iterator<int>(cout, "\n"));
cout << flush;
} | a.cc: In function 'int main()':
a.cc:22:5: error: 'a' was not declared in this scope
22 | a[x]++;
| ^
a.cc:26:10: error: 'a' was not declared in this scope
26 | copy_n(a.begin()+1, n, ostream_iterator<int>(cout, "\n"));
| ^
|
s927924530 | p03720 | C++ | #include <iostream>
#include <tuple>
#include <string>
#include <map>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <stdio.h>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <sstream>
#include <stdlib.h>
#include <functional>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define rrep(i,a,n) for(int i = a; i < n; i++)
#define INF (1<<29)
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define fi first
#define se second
#define pb push_back
#define PI 3.14159265358979323846
#define all(o) (o).begin(), (o).end()
#define rall(x) x.rbegin(),x.rend()
typedef double ld;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<ld> vd;
typedef vector < vc > vvc;
typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned long long int ulli;
const int dx[] = { 1, 0, -1, 0 };
const int dy[] = { 0, 1, 0, -1 };
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
const ld eps = 1e-10, pi = acos(-1.0);
#define MAX_N 100001
// combination
ll fact[MAX_N], factinv[MAX_N];
ll mod_pow(ll n, ll p, ll m) {
ll a = n;
ll x = 1;
while (p) {
if (p & 1) x = (x * a) % m;
a = (a * a) % m;
p >>= 1;
}
return x;
}
int extgcd(int a, int b, int& x, int&y) {
int d = a;
if (b != 0) {
d = extgcd(b, a % b, y, x);
y -= (a / b) * x;
}
else {
x = 1; y = 0;
}
return d;
}
int mod_inverse(int a, int m) {
int x, y;
extgcd(a, m, x, y);
return (m + x % m) % m;
}
ll inv(ll n) {
return mod_pow(n, MOD - 2, MOD);
}
void combInit() {
fact[0] = 1;
rrep(i, 1, MAX_N) fact[i] = fact[i - 1] * i % MOD;
factinv[MAX_N - 1] = inv(fact[MAX_N - 1]);
for (int i = MAX_N - 2; i >= 0; i--) factinv[i] = factinv[i + 1] * (i + 1) % MOD;
}
// ダイクストラ
/*
struct edge { int to, cost; };
vector < vector < edge > > G;
vi d;
void dijkstra(int s) {priority_queue<pii, vector< pii >, greater<pii> > que;d[s] = 0;que.push(pii(0, s));while (!que.empty()) {pii p = que.top(); que.pop();int v = p.second;if (d[v] < p.first) continue;rep(i, G[v].size()) {edge e = G[v][i];int cost = e.cost;if (d[v] + cost < d[e.to]) {d[e.to] = d[v] + e.cost;que.push(pii(d[e.to], e.to));}}}}
*/
// Union-Find木
int par[MAX_N], rnk[MAX_N], unionSize[MAX_N];
// はじめは全ての頂点が根
void UnionFindTreeInit(int n) {
rep(i, n) {
par[i] = i;
rnk[i] = 0;
unionSize[i] = 1;
}
}
//木の根元を求める
int root(int x) {
if (par[x] == x) return x; // 根を返す
else return par[x] = root(par[x]);
}
// 連結成分の大きさを取得
int componentSize(int x) {
return unionSize[root(x)];
}
// xとyが同じ集合に属するか否か
bool same(int x, int y) {
return root(x) == root(y);
}
// xとyの属する集合を併合
void unite(int x, int y) {
x = root(x);
y = root(y);
if (x == y) return;
if (rnk[x] < rnk[y]) {
par[x] = y;
unionSize[y] += unionSize[x];
}
else {
par[y] = x;
if (rnk[x] == rnk[y]) rnk[x]++;
unionSize[x] += unionSize[y];
}
}
//-----------------------------------------------------------------
//int dx[8] = { -1, 1, 0, 0, 1, 1, -1, -1 };
//int dy[8] = { 0, 0, 1, -1, 1, -1, -1, 1 };
struct edge { int to, cost; };
vector < vector < edge > > G;
vi d;
void dijkstra(int s) {
priority_queue<pii, vector< pii >, greater<pii> > que;
d[s] = 0;
que.push(pii(0, s));
while (!que.empty()) {
pii p = que.top();
que.pop();
int v = p.second;
if (d[v] < p.first) continue;
rep(i, G[v].size()) {
edge e = G[v][i];
int cost = e.cost;
if (d[v] + cost < d[e.to]) {
d[e.to] = d[v] + e.cost;
que.push(pii(d[e.to], e.to));
}
}
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n,m;
cin >> n >> m;
vvi G(n);
res(i, m) {
int a, b;
cin >> a >> b;
a--; b--;
G[a].push_back(b);
G[b].push_back(a);
}
res(i, n) {
cout << G[i].size() << endl;
}
}
| a.cc: In function 'int main()':
a.cc:178:13: error: 'i' was not declared in this scope
178 | res(i, m) {
| ^
a.cc:178:9: error: 'res' was not declared in this scope; did you mean 'rep'?
178 | res(i, m) {
| ^~~
| rep
|
s689053900 | p03720 | C++ | #include <iostream>
#include <map>
#include <numeric>
int main()
{
int n, m;
std::cin >> n >> m;
std::vector<std::vector<int> > v(n, std::vector<int>(n, 0));
for (int i = 0; i < m; i++) {
int a, b;
std::cin >> a >> b;
a--;
b--;
v[a][b] = 1;
v[b][a] = 1;
}
for (int i = 0; i < n; i++) {
std::cout << std::accumulate(v[i].begin(), v[i].end(), 0) << std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:14: error: 'vector' is not a member of 'std'
11 | std::vector<std::vector<int> > v(n, std::vector<int>(n, 0));
| ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
3 | #include <numeric>
+++ |+#include <vector>
4 |
a.cc:11:26: error: 'vector' is not a member of 'std'
11 | std::vector<std::vector<int> > v(n, std::vector<int>(n, 0));
| ^~~~~~
a.cc:11:26: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:11:33: error: expected primary-expression before 'int'
11 | std::vector<std::vector<int> > v(n, std::vector<int>(n, 0));
| ^~~
a.cc:19:17: error: 'v' was not declared in this scope
19 | v[a][b] = 1;
| ^
a.cc:24:46: error: 'v' was not declared in this scope
24 | std::cout << std::accumulate(v[i].begin(), v[i].end(), 0) << std::endl;
| ^
|
s137881029 | p03720 | C++ | #include <iostream>
#include <tuple>
#include <string>
#include <map>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <stdio.h>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <sstream>
#include <stdlib.h>
#include <functional>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define rrep(i,a,n) for(int i = a; i < n; i++)
#define INF (1<<29)
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define fi first
#define se second
#define pb push_back
#define PI 3.14159265358979323846
#define all(o) (o).begin(), (o).end()
#define rall(x) x.rbegin(),x.rend()
typedef double ld;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<ld> vd;
typedef vector < vc > vvc;
typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned long long int ulli;
const int dx[] = { 1, 0, -1, 0 };
const int dy[] = { 0, 1, 0, -1 };
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
const ld eps = 1e-10, pi = acos(-1.0);
#define MAX_N 100001
// combination
ll fact[MAX_N], factinv[MAX_N];
ll mod_pow(ll n, ll p, ll m) {
ll a = n;
ll x = 1;
while (p) {
if (p & 1) x = (x * a) % m;
a = (a * a) % m;
p >>= 1;
}
return x;
}
int extgcd(int a, int b, int& x, int&y) {
int d = a;
if (b != 0) {
d = extgcd(b, a % b, y, x);
y -= (a / b) * x;
}
else {
x = 1; y = 0;
}
return d;
}
int mod_inverse(int a, int m) {
int x, y;
extgcd(a, m, x, y);
return (m + x % m) % m;
}
ll inv(ll n) {
return mod_pow(n, MOD - 2, MOD);
}
void combInit() {
fact[0] = 1;
rrep(i, 1, MAX_N) fact[i] = fact[i - 1] * i % MOD;
factinv[MAX_N - 1] = inv(fact[MAX_N - 1]);
for (int i = MAX_N - 2; i >= 0; i--) factinv[i] = factinv[i + 1] * (i + 1) % MOD;
}
// ダイクストラ
/*
struct edge { int to, cost; };
vector < vector < edge > > G;
vi d;
void dijkstra(int s) {priority_queue<pii, vector< pii >, greater<pii> > que;d[s] = 0;que.push(pii(0, s));while (!que.empty()) {pii p = que.top(); que.pop();int v = p.second;if (d[v] < p.first) continue;rep(i, G[v].size()) {edge e = G[v][i];int cost = e.cost;if (d[v] + cost < d[e.to]) {d[e.to] = d[v] + e.cost;que.push(pii(d[e.to], e.to));}}}}
*/
// Union-Find木
int par[MAX_N], rnk[MAX_N], unionSize[MAX_N];
// はじめは全ての頂点が根
void UnionFindTreeInit(int n) {
rep(i, n) {
par[i] = i;
rnk[i] = 0;
unionSize[i] = 1;
}
}
//木の根元を求める
int root(int x) {
if (par[x] == x) return x; // 根を返す
else return par[x] = root(par[x]);
}
// 連結成分の大きさを取得
int componentSize(int x) {
return unionSize[root(x)];
}
// xとyが同じ集合に属するか否か
bool same(int x, int y) {
return root(x) == root(y);
}
// xとyの属する集合を併合
void unite(int x, int y) {
x = root(x);
y = root(y);
if (x == y) return;
if (rnk[x] < rnk[y]) {
par[x] = y;
unionSize[y] += unionSize[x];
}
else {
par[y] = x;
if (rnk[x] == rnk[y]) rnk[x]++;
unionSize[x] += unionSize[y];
}
}
//-----------------------------------------------------------------
//int dx[8] = { -1, 1, 0, 0, 1, 1, -1, -1 };
//int dy[8] = { 0, 0, 1, -1, 1, -1, -1, 1 };
struct edge { int to, cost; };
vector < vector < edge > > G;
vi d;
void dijkstra(int s) {
priority_queue<pii, vector< pii >, greater<pii> > que;
d[s] = 0;
que.push(pii(0, s));
while (!que.empty()) {
pii p = que.top();
que.pop();
int v = p.second;
if (d[v] < p.first) continue;
rep(i, G[v].size()) {
edge e = G[v][i];
int cost = e.cost;
if (d[v] + cost < d[e.to]) {
d[e.to] = d[v] + e.cost;
que.push(pii(d[e.to], e.to));
}
}
}
}
vector<tuple<int,int,int> > vv;
vi eds[120000];
int cl[120000]
int lst[120000];
ll n, m, Q;↲
int main() {
void dfs1(int v, int d, int c) {
if (!cl[v]) {
cl[v] = c;
}
if (lst[v] >= d)
return;
if (d == 0) {
return 0;
}
for (int u : eds[v]) {
dfs1(u, d - 1, c);
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n,m;
cin >> n >> m;
vvi G(n);
res(i, m) {
int a, b;
cin >> a >> b;
a--; b--;
G[a].push_back(b);
G[b].push_back(a);
}
res(i, n) {
cout << G[i].size() << endl;
}
}
| a.cc:174:12: error: extended character ↲ is not valid in an identifier
174 | ll n, m, Q;↲
| ^
a.cc:173:1: error: expected initializer before 'int'
173 | int lst[120000];
| ^~~
a.cc:174:12: error: '\U000021b2' does not name a type
174 | ll n, m, Q;↲
| ^
|
s659524942 | p03720 | C++ | #include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long int;
int arr[60];
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
arr[a]++;
arr[b]++;
}
for (int i = 1; i <= n; i++) {
cout << arr[i] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:15:9: error: 'cin' was not declared in this scope
15 | cin >> n >> m;
| ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
4 | #include <map>
+++ |+#include <iostream>
5 |
a.cc:26:17: error: 'cout' was not declared in this scope
26 | cout << arr[i] << endl;
| ^~~~
a.cc:26:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:26:35: error: 'endl' was not declared in this scope
26 | cout << arr[i] << endl;
| ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
4 | #include <map>
+++ |+#include <ostream>
5 |
|
s041847964 | p03720 | C++ | #include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define r(i,n) for(int i=0;i<n;i++)
int main(){
int n,m;
cin>>n>>m;
int a[n]={};
while(m--){
int q,w;
cin>>q>>w;
a[q-1]++;
q[w-1]++;
}
for(int i=0;i<n;i++)
cout<<a[i]<<endl;
} | a.cc: In function 'int main()':
a.cc:14:6: error: invalid types 'int[int]' for array subscript
14 | q[w-1]++;
| ^
|
s802073118 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int H, W;
int seen[10000][10000];
char S[10000][10000];
vector<pair<ll, ll>> prime_factorize(ll n) { //素因数分解と各素数の個数
vector<pair<ll, ll>> res;
for (ll i = 2; i * i <= n; i++)
{
if (n % i != 0)
{
continue;
}
int num = 0;
while (n % i == 0)
{
++num;
n /= i;
}
res.push_back(make_pair(i, num));
}
if (n != 1)
{
res.push_back(make_pair(n, 1));
}
return res;
}
long long GCD(long long a, long long b) {
if (b == 0) return a;
else return GCD(b, a % b);
}
ll lcm(ll x, ll y) {
return x / GCD(x, y) * y;//先に割り算をして掛けられる数を小さくして掛け算を行う
}
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void dfs(int st, int fi) {
// cout << st << " " << fi << endl;
if (st < 0 || fi < 0 || st >= H || fi >= W)
{
return ;
}
if (S[st][fi] == '#')
{
return ;
}
if (seen[st][fi] == 1)
{
return ;
}
if (S[st][fi] == '.')
{
seen[st][fi] = 1;
}
dfs(st + 1, fi);
dfs(st, fi + 1);
dfs(st, fi - 1);
dfs(st - 1, fi);
}
int main() {
ll N, K;
cin >> N >> K;
vector<ll> a(N), b(N);
vector<pair<ll, ll>> pa;
for(ll i = 0; i < N; i++) {
cin >> a[i] >> b[i];
pa.push_back(make_pair(a[i], b[i]));
}
map<ll, ll> p;
/* for(auto i : pa) {
cout << i.first << " " << i.second << endl;
}*/
for(ll i = 0; i < N; i++) {
p[a[i]] += b[i];
}
ll sum = 0;
ll ans = 0;
sort(p.begin(), p.end());
for(ll i = 0; i < N; i++) {
sum += p[a[i]];
// cout << sum << endl;
if(sum >= K) { ans = a[i]; cout << ans << endl; return 0; }
}
cout << ans << endl;
return 0;
}
| In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = _Rb_tree_iterator<pair<const long long int, long long int> >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = _Rb_tree_iterator<pair<const long long int, long long int> >]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:115:9: required from here
115 | sort(p.begin(), p.end());
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1906:50: error: no match for 'operator-' (operand types are 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' and 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >')
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::reverse_iterator<_Iterator>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::move_iterator<_IteratorL>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/valarray:605:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex |
s671508837 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int H, W;
int seen[10000][10000];
char S[10000][10000];
vector<pair<ll, ll>> prime_factorize(ll n) { //素因数分解と各素数の個数
vector<pair<ll, ll>> res;
for (ll i = 2; i * i <= n; i++)
{
if (n % i != 0)
{
continue;
}
int num = 0;
while (n % i == 0)
{
++num;
n /= i;
}
res.push_back(make_pair(i, num));
}
if (n != 1)
{
res.push_back(make_pair(n, 1));
}
return res;
}
long long GCD(long long a, long long b) {
if (b == 0) return a;
else return GCD(b, a % b);
}
ll lcm(ll x, ll y) {
return x / GCD(x, y) * y;//先に割り算をして掛けられる数を小さくして掛け算を行う
}
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void dfs(int st, int fi) {
// cout << st << " " << fi << endl;
if (st < 0 || fi < 0 || st >= H || fi >= W)
{
return ;
}
if (S[st][fi] == '#')
{
return ;
}
if (seen[st][fi] == 1)
{
return ;
}
if (S[st][fi] == '.')
{
seen[st][fi] = 1;
}
dfs(st + 1, fi);
dfs(st, fi + 1);
dfs(st, fi - 1);
dfs(st - 1, fi);
}
int main() {
ll N, K;
cin >> N >> K;
vector<ll> a(N), b(N);
vector<pair<ll, ll>> pa;
for(ll i = 0; i < N; i++) {
cin >> a[i] >> b[i];
pa.push_back(make_pair(a[i], b[i]));
}
map<ll, ll> p;
/* for(auto i : pa) {
cout << i.first << " " << i.second << endl;
}*/
for(ll i = 0; i < N; i++) {
p[a[i]] += b[i];
}
ll sum = 0;
ll ans = 0;
sort(p.begin(), p.end());
for(ll i = 0; i < N; i++) {
sum += p[i].second;
// cout << sum << endl;
if(sum >= K) { ans = p[i].first; cout << ans << endl; return 0; }
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:117:21: error: request for member 'second' in 'p.std::map<long long int, long long int>::operator[](i)', which is of non-class type 'std::map<long long int, long long int>::mapped_type' {aka 'long long int'}
117 | sum += p[i].second;
| ^~~~~~
a.cc:119:35: error: request for member 'first' in 'p.std::map<long long int, long long int>::operator[](i)', which is of non-class type 'std::map<long long int, long long int>::mapped_type' {aka 'long long int'}
119 | if(sum >= K) { ans = p[i].first; cout << ans << endl; return 0; }
| ^~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = _Rb_tree_iterator<pair<const long long int, long long int> >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = _Rb_tree_iterator<pair<const long long int, long long int> >]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:115:9: required from here
115 | sort(p.begin(), p.end());
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1906:50: error: no match for 'operator-' (operand types are 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' and 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >')
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::reverse_iterator<_Iterator>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::move_iterator<_IteratorL>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/valarray:605:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/i |
s349518482 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int H, W;
int seen[10000][10000];
char S[10000][10000];
vector<pair<ll, ll>> prime_factorize(ll n) { //素因数分解と各素数の個数
vector<pair<ll, ll>> res;
for (ll i = 2; i * i <= n; i++)
{
if (n % i != 0)
{
continue;
}
int num = 0;
while (n % i == 0)
{
++num;
n /= i;
}
res.push_back(make_pair(i, num));
}
if (n != 1)
{
res.push_back(make_pair(n, 1));
}
return res;
}
long long GCD(long long a, long long b) {
if (b == 0) return a;
else return GCD(b, a % b);
}
ll lcm(ll x, ll y) {
return x / GCD(x, y) * y;//先に割り算をして掛けられる数を小さくして掛け算を行う
}
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void dfs(int st, int fi) {
// cout << st << " " << fi << endl;
if (st < 0 || fi < 0 || st >= H || fi >= W)
{
return ;
}
if (S[st][fi] == '#')
{
return ;
}
if (seen[st][fi] == 1)
{
return ;
}
if (S[st][fi] == '.')
{
seen[st][fi] = 1;
}
dfs(st + 1, fi);
dfs(st, fi + 1);
dfs(st, fi - 1);
dfs(st - 1, fi);
}
int main() {
ll N, K;
cin >> N >> K;
vector<ll> a(N), b(N);
vector<pair<ll, ll>> pa(N);
for(ll i = 0; i < N; i++) {
cin >> a[i] >> b[i];
pa.push_back(make_pair(a[i], b[i]));
}
map<ll, ll> p;
for(ll i = 0; i < N; i++) {
p[a[i]] += b[i];
}
ll sum = 0;
ll ans = 0;
sort(pa.begin(), pa.end());
for(ll i = 0; i < N; i++) {
sum += pa.second;
if(sum >= K) { ans = pa.first; cout << ans << endl; return 0; }
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:114:19: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
114 | sum += pa.second;
| ^~~~~~
a.cc:115:33: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
115 | if(sum >= K) { ans = pa.first; cout << ans << endl; return 0; }
| ^~~~~
|
s744224034 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int H, W;
int seen[10000][10000];
char S[10000][10000];
vector<pair<ll, ll>> prime_factorize(ll n) { //素因数分解と各素数の個数
vector<pair<ll, ll>> res;
for (ll i = 2; i * i <= n; i++)
{
if (n % i != 0)
{
continue;
}
int num = 0;
while (n % i == 0)
{
++num;
n /= i;
}
res.push_back(make_pair(i, num));
}
if (n != 1)
{
res.push_back(make_pair(n, 1));
}
return res;
}
long long GCD(long long a, long long b) {
if (b == 0) return a;
else return GCD(b, a % b);
}
ll lcm(ll x, ll y) {
return x / GCD(x, y) * y;//先に割り算をして掛けられる数を小さくして掛け算を行う
}
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void dfs(int st, int fi) {
// cout << st << " " << fi << endl;
if (st < 0 || fi < 0 || st >= H || fi >= W)
{
return ;
}
if (S[st][fi] == '#')
{
return ;
}
if (seen[st][fi] == 1)
{
return ;
}
if (S[st][fi] == '.')
{
seen[st][fi] = 1;
}
dfs(st + 1, fi);
dfs(st, fi + 1);
dfs(st, fi - 1);
dfs(st - 1, fi);
}
int main() {
ll N, K;
cin >> N >> K;
vector<ll> a(N), b(N);
vector<ll> pa(N);
for(ll i = 0; i < N; i++) {
cin >> a[i] >> b[i];
pa.push_back(make_pair(a[i], b[i]));
}
map<ll, ll> p;
for(ll i = 0; i < N; i++) {
p[a[i]] += b[i];
}
ll sum = 0;
ll ans = 0;
sort(pa.begin(), pa.end());
for(ll i = 0; i < N; i++) {
sum += pa.second;
if(sum >= K) { ans = pa.first; cout << ans << endl; return 0; }
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:100:21: error: no matching function for call to 'std::vector<long long int>::push_back(std::pair<long long int, long long int>)'
100 | pa.push_back(make_pair(a[i], b[i]));
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'const std::vector<long long int>::value_type&' {aka 'const long long int&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::vector<long long int>::value_type&&' {aka 'long long int&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:114:19: error: 'class std::vector<long long int>' has no member named 'second'
114 | sum += pa.second;
| ^~~~~~
a.cc:115:33: error: 'class std::vector<long long int>' has no member named 'first'
115 | if(sum >= K) { ans = pa.first; cout << ans << endl; return 0; }
| ^~~~~
|
s754226921 | p03721 | C++ | /*Allah Vorosha*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define n_p next_permutation
#define p_p prev_permutation
#define in insert
#define rev reverse
#define pf push_front
#define pob pop_back
#define uniq(v) v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define all(x) (x).begin(),(x).end()
#define pof pop_front
#define ios ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define scn scanf
#define prt printf
#define rep(i, a, n) for(int i = a; i < n; i++)
#define mod 1000000007
#define yes cout << "YES\n"
#define no cout << "NO\n";
#define take for(auto &it : a) cin >> it;
#define out cout << a << "\n";
#define l_b lower_bound
#define u_b upper_bound
#define Max 100005
template<typename T> T mymax(T x, T y) {
return (x > y ? x : y);
}
using namespace std;
const int N = 1e5 + 5;
ll cnt[N];
void solve() {
int n;
ll k;
cin >> n >> k;
vector<int> a(n), b(n);
int mx = -1;
for(int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
cnt[a[i]] += (ll)b[i];
mx = max(mx, a[i]);
}
int mx = *max_element(all(a));
for(int i = 1; i <= mx; i++) {
k -= cnt[i];
if(k <= 0) {
cout << i << '\n'; return;
}
}
}
int main() {
solve();
return 0;
}
| a.cc: In function 'void solve()':
a.cc:49:9: error: redeclaration of 'int mx'
49 | int mx = *max_element(all(a));
| ^~
a.cc:43:9: note: 'int mx' previously declared here
43 | int mx = -1;
| ^~
|
s141145300 | p03721 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
/*
time:90m23s
wa:
反省:
考察:
*/
int main() {
int n;
long long k;
cin >> n >> k;
int a[100001], b[100001];
long long c[100001] = {0};
for(int i = 0; i < n; i++) {
cin >> a >> b;
c[a] = b;
}
for(int i = 1; i <= 100000; i++){
if(k <= c[i]){
cout << i << endl;
break;
}
k -= c[a];
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:13: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [100001]')
21 | cin >> a >> b;
| ~~~ ^~ ~
| | |
| | int [100001]
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:21:16: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*'
21 | cin >> a >> b;
| ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:21:16: error: invalid conversion from 'int*' to 'short int' [-fpermissive]
21 | cin >> a >> b;
| ^
| |
| int*
a.cc:21:16: error: cannot bind rvalue '(short int)((int*)(& a))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:21:16: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive]
21 | cin >> a >> b;
| ^
| |
| int*
a.cc:21:16: error: cannot bind rvalue '(short unsigned int)((int*)(& a))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:21:16: error: invalid conversion from 'int*' to 'int' [-fpermissive]
21 | cin >> a >> b;
| ^
| |
| int*
a.cc:21:16: error: cannot bind rvalue '(int)((int*)(& a))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:21:16: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive]
21 | cin >> a >> b;
| ^
| |
| int*
a.cc:21:16: error: cannot bind rvalue '(unsigned int)((int*)(& a))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:21:16: error: invalid conversion from 'int*' to 'long int' [-fpermissive]
21 | cin >> a >> b;
| ^
| |
| int*
a.cc:21:16: error: cannot bind rvalue '(long int)((int*)(& a))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:21:16: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive]
21 | cin >> a >> b;
| ^
| |
| int*
a.cc:21:16: error: cannot bind rvalue '(long unsigned int)((int*)(& a))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:21:16: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
21 | cin >> a >> b;
| ^
| |
| int*
a.cc:21:16: error: cannot bind rvalue '(long long int)((int*)(& a))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:21:16: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive]
21 | cin >> a >> b;
| ^
| |
| int*
a.cc:21:16: error: cannot bind rvalue '(long long unsigned int)((int*)(& a))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:21:16: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
21 | cin >> a >> b;
| ^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'int [100001]' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'int [100001]' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'int [100001]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'int [100001]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'int [100001]' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| |
s846643537 | p03721 | C++ | #include <bits/stdc++.h>
using namespace std;
#define plong pair<long,long>;
int main(){
int N;cin>>N;
long K;cin>>K;
vector<plong> A(N);
for(int i=0;i<N;i++){
long X,Y;cin>>X>>Y;
A.at(i)=make_pair(X,Y);
}
sort(A.begin(),A.end());
int X=0;
long count=0;
int ans=1;
while(true){
while(true){
if(A.at(X).first!=ans) break;
count+=A.at(X).second;
if(count>=K) break;
X++;
}
if(count>=K) break;
ans++;
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:4:15: error: template argument 1 is invalid
4 | #define plong pair<long,long>;
| ^~~~~~~~~~~~~~~
a.cc:9:10: note: in expansion of macro 'plong'
9 | vector<plong> A(N);
| ^~~~~
a.cc:4:15: error: template argument 2 is invalid
4 | #define plong pair<long,long>;
| ^~~~~~~~~~~~~~~
a.cc:9:10: note: in expansion of macro 'plong'
9 | vector<plong> A(N);
| ^~~~~
a.cc:9:15: error: expected primary-expression before '>' token
9 | vector<plong> A(N);
| ^
a.cc:9:17: error: 'A' was not declared in this scope
9 | vector<plong> A(N);
| ^
|
s170994189 | p03721 | C++ | #include <bits/stdc++.h>
using namespace std;
#define pl pair<long,long>;
int main(){
int N;cin>>N;
long K;cin>>K;
vector<pl> A(N);
for(int i=0;i<N;i++){
long X,Y;cin>>X>>Y;
A.at(i)=make_pair(X,Y);
}
sort(A.begin(),A.end());
int X=0;
long count=0;
int ans=1;
while(true){
while(true){
if(A.at(X).first!=ans) break;
count+=A.at(X).second;
if(count>=K) break;
X++;
}
if(count>=K) break;
ans++;
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:4:12: error: template argument 1 is invalid
4 | #define pl pair<long,long>;
| ^~~~~~~~~~~~~~~
a.cc:9:10: note: in expansion of macro 'pl'
9 | vector<pl> A(N);
| ^~
a.cc:4:12: error: template argument 2 is invalid
4 | #define pl pair<long,long>;
| ^~~~~~~~~~~~~~~
a.cc:9:10: note: in expansion of macro 'pl'
9 | vector<pl> A(N);
| ^~
a.cc:9:12: error: expected primary-expression before '>' token
9 | vector<pl> A(N);
| ^
a.cc:9:14: error: 'A' was not declared in this scope
9 | vector<pl> A(N);
| ^
|
s270510131 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
long long N,K;cin>>N>>K;long long M=0;
map<long long,long long>mp;
for(int X=0;X<N;X++){
int A,B;cin>>A>>B;
map[A]+=B;
}
for(auto p:mp){
long long A=p.first;long long B=p.second;M+=B;
if(M>K){
cout<<A<<emdl;break;
}
}
}
| a.cc: In function 'int main()':
a.cc:8:9: error: conflicting declaration 'auto A'
8 | map[A]+=B;
| ^
a.cc:7:9: note: previous declaration as 'int A'
7 | int A,B;cin>>A>>B;
| ^
a.cc:8:11: error: expected initializer before '+=' token
8 | map[A]+=B;
| ^~
a.cc:13:16: error: 'emdl' was not declared in this scope
13 | cout<<A<<emdl;break;
| ^~~~
|
s711238435 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
long long N,K;cin>>N>>K;long long M=0;
map<long long,long long>mp;
for(int X=0;X<N;X++){
int A,B;cin>>A>>B;
map[A]+=B;
}
for(auto p:mp){
long long A=p.first;long long B=p.second;M+=B;
if(M>K)
cout<<A<<emdl;break;
}
} | a.cc: In function 'int main()':
a.cc:8:9: error: conflicting declaration 'auto A'
8 | map[A]+=B;
| ^
a.cc:7:9: note: previous declaration as 'int A'
7 | int A,B;cin>>A>>B;
| ^
a.cc:8:11: error: expected initializer before '+=' token
8 | map[A]+=B;
| ^~
a.cc:13:16: error: 'emdl' was not declared in this scope
13 | cout<<A<<emdl;break;
| ^~~~
|
s504140530 | p03721 | C++ | #include <bits/stdc++.h>
using namespace std;
using pl pair<long,long>;
int main(){
long N,K;cin>>N>>K;
vector<pl> A(N);
for(int i=0;i<N;i++){
long X,Y;cin>>X>>Y;
A.at(i)=make_pair(X,Y);
}
sort(A.begin(),A.end());
int X=0;
long count=0;
int ans=1;
while(true){
while(true){
if(S.at(X).first!=ans) break;
count+=S.at(X).second;
if(count>=K) break;
X++;
}
if(count>=K) break;
ans++;
}
cout<<ans<<endl;
}
| a.cc:4:7: error: expected nested-name-specifier before 'pl'
4 | using pl pair<long,long>;
| ^~
a.cc: In function 'int main()':
a.cc:8:10: error: 'pl' was not declared in this scope
8 | vector<pl> A(N);
| ^~
a.cc:8:12: error: template argument 1 is invalid
8 | vector<pl> A(N);
| ^
a.cc:8:12: error: template argument 2 is invalid
a.cc:11:7: error: request for member 'at' in 'A', which is of non-class type 'int'
11 | A.at(i)=make_pair(X,Y);
| ^~
a.cc:13:10: error: request for member 'begin' in 'A', which is of non-class type 'int'
13 | sort(A.begin(),A.end());
| ^~~~~
a.cc:13:20: error: request for member 'end' in 'A', which is of non-class type 'int'
13 | sort(A.begin(),A.end());
| ^~~
a.cc:19:10: error: 'S' was not declared in this scope
19 | if(S.at(X).first!=ans) break;
| ^
a.cc:20:14: error: 'S' was not declared in this scope
20 | count+=S.at(X).second;
| ^
|
s476707228 | p03721 | Java | import java.util.*; import java.io.*; import java.math.*;
public class Main{
//Don't have to see. start------------------------------------------
static class InputIterator{
ArrayList<String> inputLine = new ArrayList<String>(1024);
int index = 0; int max; String read;
InputIterator(){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try{
while((read = br.readLine()) != null){
inputLine.add(read);
}
}catch(IOException e){}
max = inputLine.size();
}
boolean hasNext(){return (index < max);}
String next(){
if(hasNext()){
return inputLine.get(index++);
}else{
throw new IndexOutOfBoundsException("There is no more input");
}
}
}
static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
static PrintWriter out = new PrintWriter(System.out);
static void flush(){out.flush();}
static void myout(Object t){out.println(t);}
static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
static String next(){return ii.next();}
static boolean hasNext(){return ii.hasNext();}
static int nextInt(){return Integer.parseInt(next());}
static long nextLong(){return Long.parseLong(next());}
static double nextDouble(){return Double.parseDouble(next());}
static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
static ArrayList<Integer> nextIntArray(){
ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
for(int i = 0; i < input.size(); i++){
ret.add(Integer.parseInt(input.get(i)));
}
return ret;
}
static ArrayList<Long> nextLongArray(){
ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
for(int i = 0; i < input.size(); i++){
ret.add(Long.parseLong(input.get(i)));
}
return ret;
}
static String myconv(Object list, int no){//only join
String joinString = CONVSTR.get(no);
if(list instanceof String[]){
return String.join(joinString, (String[])list);
}else if(list instanceof ArrayList){
return String.join(joinString, (ArrayList)list);
}else{
throw new ClassCastException("Don't join");
}
}
static ArrayList<String> myconv(String str, int no){//only split
String splitString = CONVSTR.get(no);
return new ArrayList<String>(Arrays.asList(str.split(splitString)));
}
public static void main(String[] args){
CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
solve();flush();
}
//Don't have to see. end------------------------------------------
static void solve(){//Here is the main function
ArrayList<Integer> one = nextLongArray();
long N = one.get(0);
long K = one.get(1);
TreeMap<Long, Long> map = new TreeMap<Long, Long>();
for(int i = 0; i < N; i++){
ArrayList<Long> tmp = nextLongArray();
long A = tmp.get(0);
long B = tmp.get(1);
if(map.containsKey(A)){
map.put(A, map.get(A) + B);
}else{
map.put(A, B);
}
}
Iterator it = map.keySet().iterator();
while(it.hasNext()){
long key = (long)it.next();
K -= map.get(key);
if(K <= 0){
myout(key);
return;
}
}
}
//Method addition frame start
//Method addition frame end
}
| Main.java:72: error: incompatible types: ArrayList<Long> cannot be converted to ArrayList<Integer>
ArrayList<Integer> one = nextLongArray();
^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
|
s129804971 | p03721 | Java | import java.util.*; import java.io.*; import java.math.*;
public class Main{
//Don't have to see. start------------------------------------------
static class InputIterator{
ArrayList<String> inputLine = new ArrayList<String>(1024);
int index = 0; int max; String read;
InputIterator(){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try{
while((read = br.readLine()) != null){
inputLine.add(read);
}
}catch(IOException e){}
max = inputLine.size();
}
boolean hasNext(){return (index < max);}
String next(){
if(hasNext()){
return inputLine.get(index++);
}else{
throw new IndexOutOfBoundsException("There is no more input");
}
}
}
static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
static PrintWriter out = new PrintWriter(System.out);
static void flush(){out.flush();}
static void myout(Object t){out.println(t);}
static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
static String next(){return ii.next();}
static boolean hasNext(){return ii.hasNext();}
static int nextInt(){return Integer.parseInt(next());}
static long nextLong(){return Long.parseLong(next());}
static double nextDouble(){return Double.parseDouble(next());}
static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
static ArrayList<Integer> nextIntArray(){
ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
for(int i = 0; i < input.size(); i++){
ret.add(Integer.parseInt(input.get(i)));
}
return ret;
}
static ArrayList<Long> nextLongArray(){
ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
for(int i = 0; i < input.size(); i++){
ret.add(Long.parseLong(input.get(i)));
}
return ret;
}
static String myconv(Object list, int no){//only join
String joinString = CONVSTR.get(no);
if(list instanceof String[]){
return String.join(joinString, (String[])list);
}else if(list instanceof ArrayList){
return String.join(joinString, (ArrayList)list);
}else{
throw new ClassCastException("Don't join");
}
}
static ArrayList<String> myconv(String str, int no){//only split
String splitString = CONVSTR.get(no);
return new ArrayList<String>(Arrays.asList(str.split(splitString)));
}
public static void main(String[] args){
CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
solve();flush();
}
//Don't have to see. end------------------------------------------
static void solve(){//Here is the main function
ArrayList<Integer> one = nextIntArray();
int N = one.get(0);
int K = one.get(1);
TreeMap<Integer, Long> map = new TreeMap<Integer, Long>();
for(int i = 0; i < N; i++){
ArrayList<Integer> tmp = nextIntArray();
int A = tmp.get(0);
int B = tmp.get(1);
if(map.containsKey(A)){
map.put(A, map.get(A) + B);
}else{
map.put(A, B);
}
}
Iterator it = map.keySet().iterator();
while(it.hasNext()){
int key = (int)it.next();
K -= map.get(key);
if(K <= 0){
myout(key);
return;
}
}
}
//Method addition frame start
//Method addition frame end
}
| Main.java:83: error: incompatible types: int cannot be converted to Long
map.put(A, B);
^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
|
s357457432 | p03721 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll INF = 1e12;
const ll MOD = 1000000000 + 7;
#define PB push_back
#define PF push_front
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpi vector<pii>
#define vll vector<ll>
#define vpl vector<pll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define mii map<int, int>
#define mci map<char, int>
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pr_d(x) cout << fixed << setprecision(15) << x << endl
#define ud(c, x) distance(c.begin(), upper_bound(all(c), x))
#define ld(c, x) distance(c.begin(), lower_bound(all(c), x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep3(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep4(i, a, b) for (int i = (a); i > (b); --i)
#define pb push_back
#define out(x) cout << x << "\n"
bool odd(int i) { return i % 2; }
#define all(v) v.begin(), v.end()
#define size(x) int(x.size())
int gcd(int a, int b) { return __gcd(a, b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
void Yes_No(bool f) {
if (f)
printf("Yes\n");
else
printf("No\n");
}
void YES_NO(bool f) {
if (f)
printf("YES\n");
else
printf("NO\n");
}
template <typename T>
void deb1(T x) {
cout << "debug: " << x << "\n";
}
template <typename T>
bool chmax(T& a, const T& b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
if (a > b) {
a = b;
return true;
}
return false;
}
//-------------------ここから回答する-----------------------
void solve(void) {
ll n, k;
cin >> n >> k;
vll a(n), b(n);
rep(i, n) cin >> a[i] >> b[i];
mll mp;
rep(i, n) mp[a[i]] += b[i];
ll cta = 0;
for (auto i : mp) {
cta += i.se;
if (cta >= k) {
out(i.fi);
return;
}
}
}
int main(void) { solve(); }
| a.cc: In function 'void solve()':
a.cc:81:3: error: 'mll' was not declared in this scope; did you mean 'll'?
81 | mll mp;
| ^~~
| ll
a.cc:82:13: error: 'mp' was not declared in this scope
82 | rep(i, n) mp[a[i]] += b[i];
| ^~
a.cc:84:17: error: 'mp' was not declared in this scope
84 | for (auto i : mp) {
| ^~
|
s935788965 | p03721 | C++ | 10 500000
1 100000
1 100000
1 100000
1 100000
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 10 500000
| ^~
|
s512013904 | p03721 | C++ | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<stack>
#include<queue>
using namespace std;
typedef long long ll;
const int maxn = 200010;
lll n,m,k,cnt;
ll bas[maxn],a[maxn],b[maxn],arr[maxn],pre[maxn];
ll read(){ ll s=0,f=1; char ch=getchar(); while(ch<'0' || ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0' && ch<='9'){ s=s*10+ch-'0'; ch=getchar(); } return s*f; }
int main(){
memset(bas,0,sizeof(bas));
m = 0, cnt = 0;
n = read(), k=read();
for(int i=1;i<=n;i++)
{
a[i] = read(), b[i] = read();
m = max(m,a[i]);
bas[a[i]] += b[i];
}
for(int i=1;i<=m;i++){
if(bas[i]!=0) arr[++cnt] = i;
}
for(int i=1;i<=cnt;i++){
pre[i] = bas[arr[i]];
pre[i] += pre[i-1];
}
sort(arr+1,arr+cnt+1);
for(int i=1;i<=cnt;i++){
if(pre[i]>=k){
printf("%d\n",arr[i]);
break;
}
}
// for(int i=1;i<=cnt;i++){
// printf("%d ",pre[i]);
// }printf("\n");
// for(int i=1;i<=cnt;i++){
// printf("%d ",bas[arr[i]]);
// }printf("\n");
return 0;
} | a.cc:13:1: error: 'lll' does not name a type; did you mean 'll'?
13 | lll n,m,k,cnt;
| ^~~
| ll
a.cc: In function 'int main()':
a.cc:20:9: error: 'm' was not declared in this scope; did you mean 'tm'?
20 | m = 0, cnt = 0;
| ^
| tm
a.cc:20:16: error: 'cnt' was not declared in this scope; did you mean 'int'?
20 | m = 0, cnt = 0;
| ^~~
| int
a.cc:21:9: error: 'n' was not declared in this scope; did you mean 'yn'?
21 | n = read(), k=read();
| ^
| yn
a.cc:21:21: error: 'k' was not declared in this scope
21 | n = read(), k=read();
| ^
|
s831453383 | p03721 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll n,k;
cin >> n >> k;
vector<pair<ll,ll>> vec;
rep(i,n){
ll x,y;
cin >> x >> y;
vec.push_back(make_pair(x,y));
}
sort(vec.begin(),vec.end());
ll now=0;
rep(i,n){
now+=vec[i].second;
if(k<=now) {
cout << vec[i].first << endl;
break;
}
}
}
| a.cc:6:4: error: expected ';' before 'main'
6 | int main() {
| ^~~~~
| ;
|
s688258982 | p03721 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll n,k;
cin >> n >> k;
vector<pair<ll,ll>> vec;
rep(i,n){
ll x,y;
cin >> x >> y;
vec.push_back(make_pair(x,y));
}
sort(vec.begin(),vec.end());
ll now=0;
rep(i,n){
now+=vec[i].second;
if(k<=now) {
cout << vec[i].first << endl;
break;
}
}
} | a.cc: In function 'int main()':
a.cc:6:3: error: 'll' was not declared in this scope
6 | ll n,k;
| ^~
a.cc:7:10: error: 'n' was not declared in this scope; did you mean 'yn'?
7 | cin >> n >> k;
| ^
| yn
a.cc:7:15: error: 'k' was not declared in this scope
7 | cin >> n >> k;
| ^
a.cc:8:20: error: template argument 1 is invalid
8 | vector<pair<ll,ll>> vec;
| ^~
a.cc:8:20: error: template argument 2 is invalid
a.cc:10:7: error: expected ';' before 'x'
10 | ll x,y;
| ^~
| ;
a.cc:11:12: error: 'x' was not declared in this scope
11 | cin >> x >> y;
| ^
a.cc:11:17: error: 'y' was not declared in this scope
11 | cin >> x >> y;
| ^
a.cc:12:9: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
12 | vec.push_back(make_pair(x,y));
| ^~~~~~~~~
a.cc:14:12: error: request for member 'begin' in 'vec', which is of non-class type 'int'
14 | sort(vec.begin(),vec.end());
| ^~~~~
a.cc:14:24: error: request for member 'end' in 'vec', which is of non-class type 'int'
14 | sort(vec.begin(),vec.end());
| ^~~
a.cc:15:5: error: expected ';' before 'now'
15 | ll now=0;
| ^~~~
| ;
a.cc:17:5: error: 'now' was not declared in this scope; did you mean 'pow'?
17 | now+=vec[i].second;
| ^~~
| pow
a.cc:17:13: error: invalid types 'int[int]' for array subscript
17 | now+=vec[i].second;
| ^
a.cc:19:18: error: invalid types 'int[int]' for array subscript
19 | cout << vec[i].first << endl;
| ^
|
s544288760 | p03721 | Java |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long k = sc.nextInt();
HashMap<Integer, Long> map = new HashMap<Integer, Long>();
for(int i = 0; i < n; i++) {
int a = sc.nextInt();
long b = sc.nextLong();
if(map.containsKey(a)) {
map.put(a, map.get(a) + b);
} else {
map.put(a, b);
}
}
ArrayList<Integer> list = map.keySet();
Collections.sort(list);
int ans = 0;
for(int i = 0; i < list.size(); i++) {
int key = list.get(i);
k -= map.get(key);
if(k <= 0) {
ans = key;
break;
}
}
System.out.println(ans);
}
} | Main.java:19: error: incompatible types: Set<Integer> cannot be converted to ArrayList<Integer>
ArrayList<Integer> list = map.keySet();
^
1 error
|
s822583974 | p03721 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
int main() {
ll N, K;
cin >> N >> K;
ll A(N), B(N);
rep(i, N) {
cin >> A[i] >> B[i];
}
int i = 0;
while (K > 0) {
K -= B[i];
i++;
}
cout << A[i - 1] << endl;
} | a.cc: In function 'int main()':
a.cc:14:17: error: invalid types 'll {aka long long int}[int]' for array subscript
14 | cin >> A[i] >> B[i];
| ^
a.cc:14:25: error: invalid types 'll {aka long long int}[int]' for array subscript
14 | cin >> A[i] >> B[i];
| ^
a.cc:19:15: error: invalid types 'll {aka long long int}[int]' for array subscript
19 | K -= B[i];
| ^
a.cc:22:14: error: invalid types 'll {aka long long int}[int]' for array subscript
22 | cout << A[i - 1] << endl;
| ^
|
s527598983 | p03721 | Java | import java.util.*;
public class Main {
public static void main(final String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long k = sc.nextLong();
Map<Integer, Long> map = new TreeMap<>();
for (int i = 0; i < n; i++) {
int key = sc.nextInt();
long value = sc.nextLong();
long count = map.getOrDefault(key, 0 );
map.put(key, value + count);
}
for (Map.Entry<Integer, Long> e : map.entrySet()) {
if (k > e.getValue()) {
k -= e.getValue();
} else {
System.out.println(e.getKey());
return;
}
}
}
} | Main.java:12: error: incompatible types: int cannot be converted to Long
long count = map.getOrDefault(key, 0 );
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
|
s399744619 | p03721 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main(){
const int nmax = 100100;
int n,k;
int m[nmax];
cin >> n >> k;
rep(i,n){
int a,b;
cin >> a >> b;
m[a] += b;
}
int ans;
for (int i = 1; i <= AMAX; ++i){
if(k<=m[i]){
cout << i << endl;
return 0;
}
k -= m[i];
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:24: error: 'AMAX' was not declared in this scope
20 | for (int i = 1; i <= AMAX; ++i){
| ^~~~
|
s270929677 | p03721 | C++ | #include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long int;
const int INF = 1000000000;
const int LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;
const int M = 1e5 + 5;
int main(void)
{
int N, K;
cin >> N >> K;
vector<int> list(M, 0);
int value, cnt;
for (int i = 0; i < N; i++)
{
cin >> value >> cnt;
list[value] += cnt;
}
int ans = 0;
for (int i = 0; i < M; i++)
{
if (list[i] > 0)
{
K -= list[i];
if (K <= 0)
{
ans = i;
break;
}
}
}
cout << ans << "\n";
return (0);
} | a.cc:4:19: error: declaration does not declare anything [-fpermissive]
4 | typedef long long int;
| ^~~
a.cc:6:18: warning: overflow in conversion from 'long int' to 'int' changes value from '1000000000000000000' to '-1486618624' [-Woverflow]
6 | const int LINF = 1000000000000000000; //1e18
| ^~~~~~~~~~~~~~~~~~~
|
s060054465 | p03721 | C++ | #include <stdio.h>
#include <iostream>
int main(void)
{
long long n, k;
long long a, b;
const int AMAX = 100000;
long long cnt1[AMAX + 1];
long long cnt2[AMAX + 1];
long long c = 0;
long long t = 1;
std::cin >> n >> k;
for(long long i = 0; i < n; i++)
{
std::cin >> a >> b;
cnt1[c] = a;
cnt2[c++] = b;
}
for(long long j = 0; j < (c-1); j++)
{
if(J == (c-2) && t <= k)
{
std::cout << cnt1[j] << std::endl;
break;
}
else if( t <= k && (t + cnt2[j+1]) > k)
{
std::cout << cnt1[j] << std::endl;
break;
}
t += cnt2[j];
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:8: error: 'J' was not declared in this scope
25 | if(J == (c-2) && t <= k)
| ^
|
s912397251 | p03721 | C++ | #include <stdio.h>
#include <iostream>
int main(void)
{
long long n, k;
long long a, b;
const int AMAX = 100000;
long long cnt[AMAX + 1];
long long c = 0;
long long t = 0;
std::cin >> n >> k;
for(long long i = 0; i < n; i++)
{
std::cin >> a >> b;
cnt1[c] = a;
cnt2[c++] = b;
}
for(long long j = 0; j < c; j++)
{
if( cnt2[j] <= k && cnt2[j+1] > k)
{
std::cout << cnt1[j] << std::endl;
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:5: error: 'cnt1' was not declared in this scope; did you mean 'cnt'?
18 | cnt1[c] = a;
| ^~~~
| cnt
a.cc:19:5: error: 'cnt2' was not declared in this scope; did you mean 'cnt'?
19 | cnt2[c++] = b;
| ^~~~
| cnt
a.cc:24:9: error: 'cnt2' was not declared in this scope; did you mean 'cnt'?
24 | if( cnt2[j] <= k && cnt2[j+1] > k)
| ^~~~
| cnt
a.cc:26:20: error: 'cnt1' was not declared in this scope; did you mean 'cnt'?
26 | std::cout << cnt1[j] << std::endl;
| ^~~~
| cnt
|
s492668022 | p03721 | C++ | #include <bits/stdc++.h>
using namespace std;
#define SWAP(x,y,z) {if ( y > z ) swap(y,z); if ( x > y ) swap(x,y); if (y > z) swap(y,z);}
typedef long long ll;
typedef unsigned long long ull;
double const eps = 1e-6;
double const pi = 3.1415926535;
ll const mod = 1e9+7;
ll a[100005];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
ll k;
cin >> n >> k;
for ( int i = 1; i <= n; i++ )
{
int x,y;
cin >> x >> y;
a[x] += y;
}
for ( int i = 1; i <= 100000; i++ )
{
if ( k-a[i] <= 0 )
{
cout << i << '\n';
break;
}
k -= a[i];
}
| a.cc: In function 'int main()':
a.cc:37:6: error: expected '}' at end of input
37 | }
| ^
a.cc:16:1: note: to match this '{'
16 | {
| ^
|
s536867459 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll=long long int;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(){
ll n;
ll k;
cin>>n>>k;
vector<pair<int,int>>c(n);
rep(i,n){
cin>>c[i].first>>c[i].second;
}
sort(c.begin(),c.end());
int ans;
for(int i=1;i<n;i++){
if(c[i].second>k){
ans=c[i-1].first;
break;
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:26:2: error: expected '}' at end of input
26 | }
| ^
a.cc:6:11: note: to match this '{'
6 | int main(){
| ^
|
s388261569 | p03721 | C++ | #include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define ll long long
ll l1[100005];
int main()
{
ll n,m;
cin>>n>>m;
ll a,b,y=0,x=0;
for(int i=1;i<=n;i++){
cin>>a>>b;
x+=b;
//if(x>=m&&y==0)y=a;
l1[a]+=b;
}
for(int i=1;i<=100000;i++){
if(k<=l1[i]){
cout<<i<<endl;return 0;
}
k-=l1[i];
}
}
| a.cc: In function 'int main()':
a.cc:20:12: error: 'k' was not declared in this scope
20 | if(k<=l1[i]){
| ^
a.cc:23:9: error: 'k' was not declared in this scope
23 | k-=l1[i];
| ^
|
s199967751 | p03721 | C++ | #include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define ll long long
ll l1[55];
int main()
{
ll n,m;
cin>>n>>m;
ll a,b,y=0,x=0;
for(int i=1;i<=n;i++){
cin>>a>>b;
x+=b;
if(x>=m&&y=0)y=a;
}
cout<<y<<endl;
}
| a.cc: In function 'int main()':
a.cc:16:16: error: lvalue required as left operand of assignment
16 | if(x>=m&&y=0)y=a;
| ~~~~^~~
|
s475399934 | p03721 | C++ | #include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
using namespace std;
using ll=long long;
const int AMAX=100000;
ll cnt[AMAX+1];
int main(void){
int N;
ll K;
cin>>N>>K;
for(int i=0;i<N;++i) {
int A, B;
cin>>A>>B;
cnt[A]+=B;
}
for(int ans=1; ans<=AMAX;++ans){
if(K<=cnt[ans]) {
cout<<ans<<endl;
break;
}
K-=cnt[ans];
}
return0;
} | a.cc: In function 'int main()':
a.cc:38:7: error: 'return0' was not declared in this scope
38 | return0;
| ^~~~~~~
|
s324613256 | p03721 | C++ | #include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
using namespace std;
using ll=long long;
const int AMAX=100000;
ll cnt[AMAX+1];
int main(void){
int N;
ll K;
cin>>N>>K;
for(int i=0;i<N;++i) {
intA, B;
cin>>A>>B;
cnt[A]+=B;
}
for(int ans=1; ans<=AMAX;++ans){
if(K<=cnt[ans]) {
cout<<ans<<endl;
break;
}
K-=cnt[ans];
}
return0;
} | a.cc: In function 'int main()':
a.cc:26:9: error: 'intA' was not declared in this scope; did you mean 'int'?
26 | intA, B;
| ^~~~
| int
a.cc:26:15: error: 'B' was not declared in this scope
26 | intA, B;
| ^
a.cc:27:14: error: 'A' was not declared in this scope
27 | cin>>A>>B;
| ^
a.cc:38:7: error: 'return0' was not declared in this scope
38 | return0;
| ^~~~~~~
|
s414916670 | p03721 | C++ | #include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
using namespace std;
using ll=longlong;
const int AMAX=100000;
ll cnt[AMAX+1];
int main(void){
int N;
ll K;
cin>>N>>K;
for(int i=0;i<N;++i) {
intA, B;
cin>>A>>B;
cnt[A]+=B;
}
for(int ans=1; ans<=AMAX;++ans){
if(K<=cnt[ans]) {
cout<<ans<<endl;
break;
}
K-=cnt[ans];
}
return0;
} | a.cc:17:10: error: 'longlong' does not name a type
17 | using ll=longlong;
| ^~~~~~~~
a.cc:19:1: error: 'll' does not name a type
19 | ll cnt[AMAX+1];
| ^~
a.cc: In function 'int main()':
a.cc:23:3: error: 'll' was not declared in this scope
23 | ll K;
| ^~
a.cc:24:11: error: 'K' was not declared in this scope
24 | cin>>N>>K;
| ^
a.cc:26:5: error: 'intA' was not declared in this scope; did you mean 'int'?
26 | intA, B;
| ^~~~
| int
a.cc:26:11: error: 'B' was not declared in this scope
26 | intA, B;
| ^
a.cc:27:10: error: 'A' was not declared in this scope
27 | cin>>A>>B;
| ^
a.cc:28:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
28 | cnt[A]+=B;
| ^~~
| int
a.cc:31:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
31 | if(K<=cnt[ans]) {
| ^~~
| int
a.cc:35:8: error: 'cnt' was not declared in this scope; did you mean 'int'?
35 | K-=cnt[ans];
| ^~~
| int
a.cc:38:3: error: 'return0' was not declared in this scope
38 | return0;
| ^~~~~~~
|
s654953625 | p03721 | C++ | #include<iostream>
#define MAX 100010
using namespace std;
int main(){
long long n,k;
cin >> n >> k;
long long c[MAX] = {0};
for(int i = 0;i < n;i++){
long long a,b;
cin >> a >> b;
c[a] += b;
}
for(int ans = 0;ans < MAX;i++){
if(k <= c[ans]){
cout << ans << endl;
break;
}
k -= c[ans];
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:31: error: 'i' was not declared in this scope
15 | for(int ans = 0;ans < MAX;i++){
| ^
|
s478968197 | p03721 | C++ | #include<iostream>
#define MAX 100010
using namespace std;
int main(){
int n,k;
cin >> n >> k;
int c[MAX] = {0};
for(int i = 0;i < n;i++){
int a,b;
cin >> a >> b;
c[a] += b;
}
for(int ans = 0;ans < MAX;i++){
if(k <= c[ans]){
cout << ans << endl;
break;
}
k -= c[ans];
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:31: error: 'i' was not declared in this scope
15 | for(int ans = 0;ans < MAX;i++){
| ^
|
s822942387 | p03721 | C++ | #include<bits/stdc++.h>
#define MAX 100010
using namespace std;
int main(){
int n,k;
cin >> n >> k;
int c[MAX] = {0};
for(int i = 0;i < n;i++){
int a,b;
cin >> a >> b;
c[a] += b;
}
for(int ans = 0;ans < k;i++){
if(k <= c[ans]){
cout << ans << endl;
break;
}
k -= c[ans];
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:29: error: 'i' was not declared in this scope
15 | for(int ans = 0;ans < k;i++){
| ^
|
s082927475 | p03721 | C++ | #include<iostream>
#define MAX 100010
using namespace std;
int main(){
int n,k;
cin >> n >> k;
int c[MAX] = {0};
for(int i = 0;i < n;i++){
int a,b;
cin >> a >> b;
c[a] += b;
}
for(int ans = 0;ans < k;i++){
if(k <= c[ans]){
cout << ans << endl;
break;
}
k -= c[ans];
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:29: error: 'i' was not declared in this scope
15 | for(int ans = 0;ans < k;i++){
| ^
|
s619263899 | p03721 | C++ | #include<iostream>
#include<vector>
#include<utility>
using namespace std;
int main(){
int n,k;
cin >> n >> k;
vector < pair <int, int> > p(n);
for(int i = 0;i < n;i++){
int a,b;
cin >> a >> b;
p.at(i) = make_pair(a, b);
}
sort(p.begin(), p.end());
int count = 0;
for(int i = 0;i < n;i++){
k -= p[i].second;
if(k <= 0){
break;
}
count++;
}
cout << p[count].first << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'?
16 | sort(p.begin(), p.end());
| ^~~~
| short
|
s990559766 | p03721 | C | #include<stdio.h>
int main(){
int n;
long long int k;
scanf("%d%lld",&n,&k);
long long int num[100001] = {0};
for(int i = 1; i < =n; i++){
int a,b;
scanf("%d%d",&a,&b);
num[a] += b;
}
for(int i = 1; i <= 100000; ++i){
k = k-num[i];
if( k <= 0 ){
printf("%d",i);
return 0;
}
}
return 0;
} | main.c: In function 'main':
main.c:9:22: error: expected expression before '=' token
9 | for(int i = 1; i < =n; i++){
| ^
main.c:11:19: error: 'a' undeclared (first use in this function)
11 | scanf("%d%d",&a,&b);
| ^
main.c:11:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:22: error: 'b' undeclared (first use in this function)
11 | scanf("%d%d",&a,&b);
| ^
|
s393519606 | p03721 | C++ | #include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end() //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI; // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII; // VII a(n,VI(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP; // MP a;
typedef vector<pair<ll, ll>> PS;
template <class T, class U>
bool chmax(T &a, U b) {
if (a <= b) {
a = b;
return 1;
}
return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
os << "{";
rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
os << "}";
return os;
}
// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)
int main() {
ll n, m, k, x, y = 0, z = 0, h, ans=0, w, sum = 0, Max = -1, Min = 1e9+1;
string u= "";
bool ok=true;
cin >> n >> k;
VI a(100001);
rep(i,100001){
cin >> x >> y;
a[x] += y;
}
rep2(i,1,100001)){
if(k <= a[i]){
pri(i); return 0;
}
k -= a[i];
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:65:19: error: expected primary-expression before ')' token
65 | rep2(i,1,100001)){
| ^
|
s592263667 | p03721 | C++ | #include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end() //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI; // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII; // VII a(n,VI(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP; // MP a;
typedef vector<pair<ll, ll>> PS;
template <class T, class U>
bool chmax(T &a, U b) {
if (a <= b) {
a = b;
return 1;
}
return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
os << "{";
rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
os << "}";
return os;
}
// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)
int main() {
ll n, m, k, x, y = 0, z = 0, h, ans=0, w, sum = 0, Max = -1, Min = 1e9+1;
string u= "";
bool ok=true;
cin >> n >> k;
VI a(n);
rep(i,n){
cin >> x >> y;
a[x] += y;
}
rep(i,1,n+1){
if(k <= a[i]){
pri(i); return 0;
}
k -= a[i];
}
return 0;
}
| a.cc:65:14: error: macro "rep" passed 3 arguments, but takes just 2
65 | rep(i,1,n+1){
| ^
a.cc:3:9: note: macro "rep" defined here
3 | #define rep(i, n) for (int i = 0; i < n; i++)
| ^~~
a.cc: In function 'int main()':
a.cc:65:3: error: 'rep' was not declared in this scope
65 | rep(i,1,n+1){
| ^~~
|
s589406800 | p03721 | C++ | // include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
// func
// ------------------------------------------------
int CalcSumOfDigit(int n); // 各桁の和を計算する。
int getDigit(int n); // 数字の桁数を取得する。
string upper(string str); // 英字を大文字に変換する。
string lower(string str); // 英字を小文字に変換する。
// class
// ------------------------------------------------
class Combi
{
public:
Combi();
long long Combination(long long n, long long k);
long long nPk_modp(long long n, long long k, long long p);
private:
vector<vector<long long>> memo;
long long n_num;
long long k_num;
void Resize(long long n, long long k);
};
// define
// ------------------------------------------------
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(a) int((a).size())
#define rep(i,n) for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n) for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v) sort((v).begin(),(v).end())
#define rvsort(v) sort(rall((v)))
#define vi vector<int>
#define GCD(a,b) __gcd((a),(b))
#define LCM(a,b) (a)/GCD((a),(b))*(b)
#define kiriage(a,b) ((a)+(b)-1)/(b)
const int INF = 1e9;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<long> vll;
// code
// ------------------------------------------------
int main() {
ll n,k;
cin >> n >> k;
vector<pair<ll,ll>> h;
rep(i,n)
{
ll a,b;
cin >> a >> b;
pair<ll,ll> buf;
buf.first = a;
buf.second = b;
h.push_back(buf);
}
// auto comp = [](auto p,auto q){
// return p.first < q.second;
// };
sort(all(h),comp);
ll num = 0;
ll ans = 0;
rep(i,n)
{
num += h[i].second;
if(num >= k)
{
ans = h[i].first;
break;
}
}
cout << ans << endl;
return 0;
}
// funcの実体
// ------------------------------------------------
int getDigit(int n)
{
int i = 1;
while(1)
{
n = n / 10;
if(n == 1)
break;
i++;
}
return i;
}
int CalcSumOfDigit(int n)
{
int s = 0;
while(n)
{
s += n % 10;
n = n / 10;
}
return s;
}
string upper(string str)
{
for(auto itr = str.begin();itr != str.end() ; itr++)
{
if(97 <= *itr && *itr <= 122)
{
*itr = *itr - 32;
}
}
return str;
}
string lower(string str)
{
for(auto itr = str.begin();itr != str.end() ; itr++)
{
if(65 <= *itr && *itr <= 90)
{
*itr = *itr + 32;
}
}
return str;
}
Combi::Combi(){
n_num = -1;
k_num = -1;
};
ll Combi::Combination(ll n, ll k)
{
Resize(n,k);
ll ret;
if(memo[n][k] != 0)
{
ret = memo[n][k];
}
else if(n == k || k == 0)
{
memo[n][k] = 1;
ret = 1;
}
else
{
ret = Combination(n - 1, k - 1) + Combination(n - 1, k);
memo[n][k] = ret;
}
return ret;
}
void Combi::Resize(ll n, ll k)
{
if(n_num <= n || k_num <= k)
{
n_num = (n + 1) * 2;
k_num = (k + 1) * 2;
memo.resize(n_num);
for(auto itr = memo.begin(); itr != memo.end(); ++itr)
{
itr->resize(k_num);
}
}
}
long long Combi::nPk_modp(long long n, long long k, long long p)
{
ll ans = 1;
for(long long i = k; i <= n; i++)
{
ans = (ans * i) % p;
}
return ans;
};
| a.cc: In function 'int main()':
a.cc:72:17: error: 'comp' was not declared in this scope
72 | sort(all(h),comp);
| ^~~~
|
s973800288 | p03721 | C++ | int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n , k;
cin >> n >> k;
long long arr[100001] = {};
for (int i = 0 ; i < n ; i++){
int num , qty;
cin >> num >> qty;
arr[num] += qty;
}
long long count = 0;
for (int i = 1 ; i < 100001 ; i++ ){
count += arr[i];
if( count >= k ){
cout << i;
return 0;
}
}
} | a.cc: In function 'int main()':
a.cc:2:5: error: 'ios' has not been declared
2 | ios::sync_with_stdio(false);
| ^~~
a.cc:3:5: error: 'cin' was not declared in this scope
3 | cin.tie(0);
| ^~~
a.cc:16:10: error: 'cout' was not declared in this scope; did you mean 'count'?
16 | cout << i;
| ^~~~
| count
|
s596677124 | p03721 | C | #include<stdio.h>
#include<stdlib.h>
long max(long a, long b){
if(a > b) return a;
else return b;
}
long min(long a, long b){
if(a < b) return a;
else return b;
}
int sort(const void *a, const void *b){
return *(int*)a -*(int*)b;
}
int main(){
int n,k;
scanf("%d%d",&n,&k);
int num[100000] = {0};
for(int i = 0; i < n; ++i){
int a,b;
scanf("%d%d",&a,&b);
num[a] = b;
}
}
int ans = 0;
int index = 0;
for(int i = 0; i < 100000; ++i){
k = k-b[i];
if( k <= 0 ){
printf("%d",i);
return 0;
}
}
return 0;
}
| main.c:32:7: warning: built-in function 'index' declared as non-function [-Wbuiltin-declaration-mismatch]
32 | int index = 0;
| ^~~~~
main.c:33:3: error: expected identifier or '(' before 'for'
33 | for(int i = 0; i < 100000; ++i){
| ^~~
main.c:33:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
33 | for(int i = 0; i < 100000; ++i){
| ^
main.c:33:30: error: expected identifier or '(' before '++' token
33 | for(int i = 0; i < 100000; ++i){
| ^~
main.c:41:3: error: expected identifier or '(' before 'return'
41 | return 0;
| ^~~~~~
main.c:43:1: error: expected identifier or '(' before '}' token
43 | }
| ^
|
s838024422 | p03721 | C | 10 500000
1 100000
1 100000
1 100000
1 100000
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000 | main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 10 500000
| ^~
|
s103195204 | p03721 | C++ | #include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#define rep(i,n) for(int i = 0;i<(int)(n);i++);
using namespace std;
using ll = long long;
const ll INF = 100100100100100;
int main() {
ll N, K;
cin >> N >> K;//左から k個
vector<ll> a(N);
vector<ll> b(N);//b個代入
for (int i = 0; i < N; i++) cin >> a[i] >> b[i];
ll cnt = 0;
ll ans = 0;
while (K) {//Kからb[cnt]を引いていき、0を下回ったらストップ
if (b[cnt] >= K) {
ans = cnt;
K = 0;
}
else {
K -= b[cnt];
cnt++;
}
}
cout << a[ans] << endl;
| a.cc: In function 'int main()':
a.cc:42:32: error: expected '}' at end of input
42 | cout << a[ans] << endl;
| ^
a.cc:24:12: note: to match this '{'
24 | int main() {
| ^
|
s250306401 | p03721 | C++ | nclude <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#define rep(i,n) for(int i = 0;i<(int)(n);i++);
using namespace std;
using ll = long long;
const ll INF = 100100100100100;
int main() {
ll N, K;
cin >> N >> K;//hidarikara k
vector<ll> a(N);
vector<ll> b(N);//bko
for (int i = 0; i < N; i++) cin >> a[i] >> b[i];
ll cnt = 0;
while (K) {
if (b[cnt] >= K) K = 0;
else K -= b[cnt];
cnt++;
}
cout << a[cnt-1] << endl;
} | a.cc:1:1: error: 'nclude' does not name a type
1 | nclude <iostream> // cout, endl, cin
| ^~~~~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/char_traits.h:50:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared
144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type
146 | static _GLIBCXX14_CONSTEXPR std::size_t
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared
150 | find(const char_type* __s, std::size_t __n, const char_type& __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared
153 | move(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared
156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared
159 | assign(char_type* __s, std::size_t __n, char_type __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared
187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
| ^~~
/usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)':
/usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~
| __n
/usr/include/c++/14/bits/char_traits.h: At global scope:
/usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type
198 | _GLIBCXX14_CONSTEXPR std::size_t
|
s968023917 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,N) for(int i = 0; i < (N); i++)
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const long long INF = 1LL << 60;
//入力
ll cnt[100050];
int N,K;
int main(){
cin >> N >> K;
rep (i,N){
int A,B;
cin >> A >> B;
cnt[A] += B;
}
for (int ans = 1; ans < 100050; i++){
if (K <= cnt[ans]) {
cout << ans << endl;
break;
}
K -= cnt[ans];
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:37:37: error: 'i' was not declared in this scope
37 | for (int ans = 1; ans < 100050; i++){
| ^
|
s918319641 | p03721 | C++ | #include <bits/stdc++.h>
using ll = long long;
const int AMAX = 100000;
ll cnt[AMAX + 1];
int main(void) {
int N;
ll K;
cin >> N >> K;
for (int i = 0; i < N; ++i) {
int A, B;
cin >> A >> B;
cnt[A] += B;
}
for (int ans = 1; ans <= AMAX; ++ans){
if (K <= cnt[ans]) {
cout << ans << endl;
break;
}
K -= cnt[ans];
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
9 | cin >> N >> K;
| ^~~
| 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: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:19:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
19 | cout << ans << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:19:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
19 | cout << ans << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s166117165 | p03721 | C++ | #include <bits/stdc++.h>
using ll = long long;
const int AMAX = 100000;
ll cnt[AMAX + 1];
int main(void) {
int N;
ll K;
cin >> N >> K;
for (int i = 0; i < N; ++i) {
int A, B;
cin >> A >> B;
cnt[A] += B;
}
for (int ans = 1; ans <= AMAX; ++ans){
if (K <= cnt[ans]) {
cout << ans << endl;
break;
}
K -= cnt[ans];
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
9 | cin >> N >> K;
| ^~~
| 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: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:19:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
19 | cout << ans << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:19:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
19 | cout << ans << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s358186421 | p03721 | C++ | #include <bits/stdc++.h>
using namespace std;
long long gcd(long x,long y){
if(y==0)return x;
return gcd(y,x%y);
}
long long lcm(long x,long y){
return x*y/gcd(x,y);
}
long long ctoi(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
return 0;
}
long long main()
{
long long K,N,a,b;
map<long long,long long> mp;
cin>>N>>K;
for(long long i=1;i<=N;i++){
cin>>a>>b;
mp[a]+=b;
}
long long sum=0;
for(auto itr = mp.begin(); itr!=mp.end();itr++){
sum+=itr->second;
if(sum>=K){
cout<<itr->first<<endl;
return 0;
}
}
return 0;
} | cc1plus: error: '::main' must return 'int'
|
s942907147 | p03721 | C++ | include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> vec(100000,0);
int N, K;
cin >> N >> K;
for(int i = 0; i < N; i++){
int a,b;
cin >> a >> b;
vec[a] += b;
}
for(int i = 0; true; i++){
K -= vec[i];
if(K <= 0){
cout << i << endl;
return 0;
}
}
}
| a.cc:1:1: error: 'include' does not name a type
1 | include<bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'vector' was not declared in this scope
5 | vector<int> vec(100000,0);
| ^~~~~~
a.cc:5:10: error: expected primary-expression before 'int'
5 | vector<int> vec(100000,0);
| ^~~
a.cc:7:3: error: 'cin' was not declared in this scope
7 | cin >> N >> K;
| ^~~
a.cc:11:5: error: 'vec' was not declared in this scope
11 | vec[a] += b;
| ^~~
a.cc:15:10: error: 'vec' was not declared in this scope
15 | K -= vec[i];
| ^~~
a.cc:17:7: error: 'cout' was not declared in this scope
17 | cout << i << endl;
| ^~~~
a.cc:17:20: error: 'endl' was not declared in this scope
17 | cout << i << endl;
| ^~~~
|
s570591090 | p03721 | C++ | #include<iostream>
#include<numeric>
#include<set>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long li;
#define chmin(a,b) (a>(b)?a=(b),1:0)
#define abs(n) max((n),-(n))
#define dist(a,b) max((a)-(b),(b)-(a))
#define chmax(a,b) (a<(b)?a=(b),1:0)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define MOD 1000000000
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
// ここでストリームに obj を書き込みます。
auto itr=v.begin();
while(itr!=v.end()){
if(itr!=v.begin())cout << " ";
cout << *(itr++);
}
return os;
}
int main(){
int n; li k; cin >>n >>k;
vector<pair<int,int>> v;
rep(i,n){
int a,b; cin >>a >>b;
v.push_back({a,b});f
}
sort(v.begin(),v.end());
li t=0,i=0;
while(t<k){
t+=v[i++].second;
}
print(v[i-1].first);
}
| a.cc: In function 'int main()':
a.cc:38:24: error: 'f' was not declared in this scope
38 | v.push_back({a,b});f
| ^
|
s447476128 | p03721 | C++ | #include <iostream>
#include <vector>
#include <utility>
#include<algorithm>
using namespace std;
#define MAX 100000
int solve(int N,int K, int a[],int b[])
{
vector<pair<int, int>> ab;
for (int i = 0; i < N; ++i)
{
pair<int, int> temp;
temp.first = a[i];
temp.second = b[i];
ab.push_back(temp);
}
sort(ab.begin(), ab.end());
int ans = (ab.end() - 1)->first;
unsigned long long sum = 0;
for (auto itr = ab.begin(); itr != ab.end(); ++itr)
{
sum += unsigned long long(itr->second);
if (sum >= K)
{
ans = itr->first;
break;
}
}
return ans;
}
int main(int argc, char* argv[]) {
int N, K;
cin >> N >> K;
static int a[MAX], b[MAX];
for (int i = 0; i < N; ++i) {
cin >> a[i] >> b[i];
}
cout<<solve(N, K, a, b);
return 0;
}
| a.cc: In function 'int solve(int, int, int*, int*)':
a.cc:26:24: error: expected primary-expression before 'unsigned'
26 | sum += unsigned long long(itr->second);
| ^~~~~~~~
|
s787494319 | p03721 | C++ | #include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n,k;cin>>n>>k;
priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<>>que;
while(n--){
ll a,b;cin>>a>>b;
que.push(mp(a,b));
}
while(true){
ll num = que.front().F;
ll cnt = que.front().S;
que.pop();
if(cnt < k){
k-=cnt;
}else{
cout<<num<<endl;return 0;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:28:18: error: 'class std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<void> >' has no member named 'front'
28 | ll num = que.front().F;
| ^~~~~
a.cc:29:18: error: 'class std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<void> >' has no member named 'front'
29 | ll cnt = que.front().S;
| ^~~~~
|
s520869948 | p03721 | C++ |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
long long k;
cin >> n >> k;
vector<pair<int, int>> ans(n);
for (int i = 0; i < n; i++) {
int a, b;
cin >> a >> b;
ans.at(i).first = a;
ans.at(i).second = b;
}
sort(ans.begin(), ans.end());
long long k = 0;
for (int i = 0; i < n; i++) {
tmp += ans.at(i).second;
if (tmp >= k) {
cout << ans.at(i).first;
return 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:14: error: redeclaration of 'long long int k'
17 | long long k = 0;
| ^
a.cc:7:13: note: 'long long int k' previously declared here
7 | long long k;
| ^
a.cc:19:5: error: 'tmp' was not declared in this scope; did you mean 'tm'?
19 | tmp += ans.at(i).second;
| ^~~
| tm
|
s538457349 | p03721 | C++ | #include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int main(){
int N,K;
cin >> N >> K;
set<int> A;
map<int, int> AtoB;
rep(i, N){
int a, b;
cin >> a >> b;
A.insert(a);
AtoB[a] += b;
}
sort(A.begin(),A.end());
int ans;
for(int i: A){
K -= AtoB[i];
ans = i;
if(K<=0) break;
}
cout << ans << endl;
}
| In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = _Rb_tree_const_iterator<int>; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = _Rb_tree_const_iterator<int>]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:21:7: required from here
21 | sort(A.begin(),A.end());
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1906:50: error: no match for 'operator-' (operand types are 'std::_Rb_tree_const_iterator<int>' and 'std::_Rb_tree_const_iterator<int>')
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::move_iterator<_IteratorL>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/valarray:605:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
465 | operator-(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
388 | operator-(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed:
/usr |
s406401101 | p03721 | C++ | #include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
//桁数を求める
int main(){
int N,K;
cin >> N >> K;
set<int> A;
map<int, int> AtoB;
rep(i, N){
int a, b;
cin >> a >> b;
A.insert(a);
AtoB[a] += b;
}
sort(A.begin(),A.end());
for(int i: A){
K -= AtoB[i]
int ans = i;
if(K<=0) break;
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:24:16: error: expected ';' before 'int'
24 | K -= AtoB[i]
| ^
| ;
25 | int ans = i;
| ~~~
a.cc:31:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
31 | cout << ans << endl;
| ^~~
| abs
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = _Rb_tree_const_iterator<int>; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = _Rb_tree_const_iterator<int>]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:21:7: required from here
21 | sort(A.begin(),A.end());
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1906:50: error: no match for 'operator-' (operand types are 'std::_Rb_tree_const_iterator<int>' and 'std::_Rb_tree_const_iterator<int>')
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::move_iterator<_IteratorL>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/valarray:605:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
465 | operator-(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:465:5: note: candidate |
s267570397 | p03721 | C++ | #include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
//桁数を求める
int main(){
int N,K;
cin >> N >> K;
set<int> A;
map<int, int> AtoB;
rep(i, N){
int a, b;
cin >> a >> b;
set.insert(a);
map[a] += b;
}
sort(A.begin(),A.end());
for(int i: A){
K -= map[i]
int ans = 1;
if(K<=0) break;
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:16:8: error: expected unqualified-id before '.' token
16 | set.insert(a);
| ^
a.cc:17:9: error: conflicting declaration 'auto a'
17 | map[a] += b;
| ^
a.cc:14:9: note: previous declaration as 'int a'
14 | int a, b;
| ^
a.cc:17:12: error: expected initializer before '+=' token
17 | map[a] += b;
| ^~
a.cc:24:12: error: missing template arguments before '[' token
24 | K -= map[i]
| ^
a.cc:31:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
31 | cout << ans << endl;
| ^~~
| abs
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = _Rb_tree_const_iterator<int>; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = _Rb_tree_const_iterator<int>]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:21:7: required from here
21 | sort(A.begin(),A.end());
| ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1906:50: error: no match for 'operator-' (operand types are 'std::_Rb_tree_const_iterator<int>' and 'std::_Rb_tree_const_iterator<int>')
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::move_iterator<_IteratorL>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/valarray:605:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/ccomplex: |
s181642106 | p03721 | C++ |
cout<<ans<<en | a.cc:3:5: error: 'cout' does not name a type
3 | cout<<ans<<en
| ^~~~
|
s320348201 | p03721 | C++ | #include <bits/stdc++.h>
using namespace std;
vector <pair<int, int> > vec;
int main(){
int n, k;
scanf("%d%d", &n, &k);
for(int i = 0; i < n; i++) {
int a, b;
scanf("%d%d", &a, &b);
vec.push_back(make_pair(a, b));
}
sort(vec.begin(), vec.end());
for(int i = 0; i < n; i++) {
k -= a[i].second;
if(k <= 0) {
printf("%d\n", a[i].first);
return 0;
}
}
}
| a.cc: In function 'int main()':
a.cc:16:22: error: 'a' was not declared in this scope
16 | k -= a[i].second;
| ^
|
s786198059 | p03721 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
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="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
ll n,k;
cin >> n >> k;
vector<P> p(n);
rep(i,n){
cin >> p[i].first >> p[i].second;
}
sort(p.begin(),p.end());
ll cnt=0;
ll ans;
while(cnt<k){
cnt +=p[i].second;
ans=p[i].first;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:26:13: error: 'i' was not declared in this scope
26 | cnt +=p[i].second;
| ^
|
s484659125 | p03721 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
//#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEsL 2e9
#define PIE 3.1415a926535
template <class T>
inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T>
inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}
#define int ll
int main() {
#define int ll
int n, k;
cin >> n >> k;
vector<pair<int, int>> v;
int a, b;
rep(i,n) {
cin >> a >> b;
v.push_back(make_pair(a, b));
}
sort(all(v));
//rep(i, n) cout << v[i].first << endl;
ll sum = 0;
int res;
rep(i,n) {
sum += v[i].second;
if (sum>=k) {
res = v[i].first;
break;
}
else
{
}
}
cout << res << endl;
} | a.cc:33:13: error: '::main' must return 'int'
33 | #define int ll
| ^~
a.cc:34:1: note: in expansion of macro 'int'
34 | int main() {
| ^~~
|
s680373725 | p03721 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
//#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEsL 2e9
#define PIE 3.1415a926535
template <class T>
inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T>
inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}
#define int ll
int main() {
int n, k;
cin >> n >> k;
vector<pair<int, int>> v;
int a, b;
rep(i,n) {
cin >> a >> b;
v.push_back(make_pair(a, b));
}
sort(all(v));
//rep(i, n) cout << v[i].first << endl;
ll sum = 0;
int res;
rep(i,n) {
sum += v[i].second;
if (sum>=k) {
res = v[i].first;
break;
}
else
{
}
}
cout << res << endl;
} | a.cc:33:13: error: '::main' must return 'int'
33 | #define int ll
| ^~
a.cc:34:1: note: in expansion of macro 'int'
34 | int main() {
| ^~~
|
s743842155 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N;
int64_t K;
cin>>N>>K;
map<int,int64_t>M;
for(int i=0;i<N;i++){
int a,
int64_t b;
if(M.count(a))
M.at(a)+=b;
else
M[a]=b;
}int ans;
int64_t sum=0;
for(auto p:M){
auto k=p.first;
auto v=p.second;
sum+=v;
if(K<=sum){
ans=k; break;
}
}cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:13: error: expected initializer before 'b'
10 | int64_t b;
| ^
a.cc:12:16: error: 'b' was not declared in this scope
12 | M.at(a)+=b;
| ^
a.cc:14:12: error: 'b' was not declared in this scope
14 | M[a]=b;
| ^
|
s812268982 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
cin>>N>>K;
vector<pair<int,int>>M;
for(int i=0;i<N;i++){
int a,b;
cin>>a>>b;
pair<int,int>c=(b,a);
M.push_back(c);
}int ans;
int sum=0;
for(int i=0; ;i++){
sum+=M.at(i).first;
if(K<=sum){
ans=M.at(i).second; break;
}
}cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:22: error: conversion from 'int' to non-scalar type 'std::pair<int, int>' requested
10 | pair<int,int>c=(b,a);
| ^
|
s060351334 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
cin>>N>>K;
vector<pair<int,int>>M={};
for(int i=0;i<N;i++){
int a,b;
cin>>a>>b;
c=make_pair(b,a);
M.push_back(c);
}int ans;
int sum=0;
for(int i=0; ;i++){
sum+=M.at(i).first;
if(K<=sum){
ans=M.at(i).second; break;
}
}cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:4: error: 'c' was not declared in this scope
10 | c=make_pair(b,a);
| ^
|
s153232108 | p03721 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
cin>>N>>K;
vector<pair<int,int>>M={};
for(int i=0;i<N;i++){
int a,b;
cin>>a>>b;
c=make_pair(b,a);
M.push_back(c);
}int ans;
int sum=0;
for(int i=0; ;i++){
sum+=A.at(i).first;
if(K<=sum){
ans=A.at(i).second; break;
}
}cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:4: error: 'c' was not declared in this scope
10 | c=make_pair(b,a);
| ^
a.cc:15:8: error: 'A' was not declared in this scope
15 | sum+=A.at(i).first;
| ^
|
s814460231 | p03721 | C++ | #include<bits/stdc++h>
using namespace std;
int main(){
int N,K;
cin>>N>>K;
map<int,int>M;
for(int i=0;i<N;i++){
int a,b;
cin>>a>>b;
if(M.count(a))
M.at(a)+=b;
else
M[a]=b;
}int ans;
int sum=0;
for(auto p:M){
auto k=p.first;
auto v=p.second;
sum+=v;
if(K<=sum){
ans=k; break;
}
}cout<<ans<<endl;
return 0;
} | a.cc:1:9: fatal error: bits/stdc++h: No such file or directory
1 | #include<bits/stdc++h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s974544754 | p03721 | C++ | #include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;
using P = pair<ll, ll>;
int main() {
ll N, K;
cin >> N >> K;
vector<P> p(N);
for (int i = 0; i < N; i++) {
int a, b;
cin >> a >> b;
p[i] = P(a, b);
}
sort(ALL(P));
ll now
= 0;
for (int i = 0; i < N; i++) {
if (now < K && K <= now + p[i].second) {
cout << p[i].first << endl;
return 0;
} else {
now += p[i].second;
}
}
}
| a.cc: In function 'int main()':
a.cc:2:27: error: expected primary-expression before ')' token
2 | #define ALL(obj) begin(obj), end(obj)
| ^
a.cc:45:10: note: in expansion of macro 'ALL'
45 | sort(ALL(P));
| ^~~
a.cc:2:37: error: expected primary-expression before ')' token
2 | #define ALL(obj) begin(obj), end(obj)
| ^
a.cc:45:10: note: in expansion of macro 'ALL'
45 | sort(ALL(P));
| ^~~
|
s342491343 | p03721 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int count = 0;
int ans = 0;
int [] in = new int [100000];
int a,b;
for(int i=0;i<n;i++){a = sc.nextInt();
b = sc.nextInt();
in[a-1]+=b;
}
for(int i=0;i<a;i++){count+=in[i];
if(count>=k){ans=i;break;}
}
System.out.println(ans);
}
}
| Main.java:15: error: variable a might not have been initialized
for(int i=0;i<a;i++){count+=in[i];
^
1 error
|
s741893755 | p03721 | C | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int count = 0;
int ans = 0;
int [] in = new int [100000];
int a,b;
for(int i=0;i<n;i++){a = sc.nextInt();
b = sc.nextInt();
in[a-1]+=b;
}
for(int i=0;i<a;i++){count+=in[i];
if(count>=k){ans=i;break;}
}
System.out.println(ans);
}
}
| main.c:1:1: error: unknown type name 'import'
1 | import java.util.*;
| ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
1 | import java.util.*;
| ^
main.c:2:1: error: unknown type name 'public'
2 | public class Main {
| ^~~~~~
main.c:2:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
2 | public class Main {
| ^~~~
|
s818559949 | p03721 | C++ | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl
int list[100010];
int main(){
ll n,k;
cin >> n >> k;
int a,b;
ll ans = 0;
REP(i,n){
cin >> a >> b;
list[a]+=b;
}
REP(i,100010){
ans += list[i];
if(ans>=k){
COUT(i);
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:9: error: reference to 'list' is ambiguous
24 | list[a]+=b;
| ^~~~
In file included from /usr/include/c++/14/list:65,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150,
from a.cc:1:
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:16:5: note: 'int list [100010]'
16 | int list[100010];
| ^~~~
a.cc:27:16: error: reference to 'list' is ambiguous
27 | ans += list[i];
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:16:5: note: 'int list [100010]'
16 | int list[100010];
| ^~~~
|
s405921436 | p03721 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N; long long K;
cin >> N >> K;
vector<pair<long long, long long> > v(N);
for (int i = 0; i < N; ++i) cin >> v[i].first >> v[i].second;
// ソート
sort(v.begin(), v.end());
// a_i が小さい順に b_i を合計して K 以上になる瞬間をとらえる
long long res = 0;
long long sum = 0;
for (int i = 0; i < N; ++i) {
sum += v[i].second;
if (sum >= K) {
res = v[i].first; // sum >= K になった瞬間の a_i
break;
}
}
cout << res | a.cc: In function 'int main()':
a.cc:25:16: error: expected ';' at end of input
25 | cout << res
| ^
| ;
a.cc:25:16: error: expected '}' at end of input
a.cc:6:12: note: to match this '{'
6 | int main() {
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.