submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s903793748
p03721
C++
#include <bits/stdc++.h> using namespace std; int N long long A[100001], K; int main(){ long long cnt = 0; cin >> N >> K; for(int i = 0; i < N; i++){ int a, b; cin >> a >> b; A[a] += b; } for(int i = 1; i < 100001; i++){ cnt += A[i]; if(cnt >= K){ printf("%d\n", i); return 0; } } return 0; }
a.cc:5:1: error: expected initializer before 'long' 5 | long long A[100001], K; | ^~~~ a.cc: In function 'int main()': a.cc:9:16: error: 'N' was not declared in this scope 9 | cin >> N >> K; | ^ a.cc:9:21: error: 'K' was not declared in this scope 9 | cin >> N >> K; | ^ a.cc:13:17: error: 'A' was not declared in this scope 13 | A[a] += b; | ^ a.cc:16:24: error: 'A' was not declared in this scope 16 | cnt += A[i]; | ^
s274544195
p03721
C++
#include<cstdio> using namespace std; const int A=1e5+5; long long bo[A]; int main() { int N,K,a,b,cnt=0; scanf("%d%d",&N,&K); for(int i=1;i<=N;i++) { scanf("%d%d",&a,&b); bo[a]+=b; } for(int i=1;i<=1e5;i++) { cnt+=bo[i]; if(cnt>=K) { printf("%d",i)\n; return 0; } } return 0; }
a.cc:19:39: error: stray '\' in program 19 | printf("%d",i)\n; | ^ a.cc: In function 'int main()': a.cc:19:39: error: expected ';' before 'n' 19 | printf("%d",i)\n; | ^~ | ;
s829878831
p03721
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #define df 0 int dc=100000; #define MAX 100010 typedef long int li; typedef struct{ int a; int b; }data; data array[MAX]; int comp(const void*a,const void*b){ int x=*((data*)a),y=*((data*)b); return x.a-y.a; } int main(){ if(df)printf("*** debug mode ***\n"); long int n,k,i; scanf("%ld%ld",&n,&k); for(i=0;i<n;i++){ int a,b; scanf("%d%d",&a,&b); array[i].a=a; array[i].b=b; } qsort(array,n,sizeof(data),comp); i=0; while(k>0){ k-=array[i].b; i++; } printf("%d",array[i-1].a); return 0; } /// confirm df==0 ///
main.c: In function 'comp': main.c:14:9: error: incompatible types when initializing type 'int' using type 'data' 14 | int x=*((data*)a),y=*((data*)b); | ^ main.c:14:23: error: incompatible types when initializing type 'int' using type 'data' 14 | int x=*((data*)a),y=*((data*)b); | ^ main.c:15:11: error: request for member 'a' in something not a structure or union 15 | return x.a-y.a; | ^ main.c:15:15: error: request for member 'a' in something not a structure or union 15 | return x.a-y.a; | ^
s001457836
p03721
C++
#include <iostream> #include <iomanip> #include <string> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <utility> #include <tuple> #include <algorithm> #include <cstdio> #include <cmath> using namespace std; #define rep(i, n) for(int i = 0; i < (n); i++) using ll = long long; int main() { int N; ll K; cin >> N >> K; vector<ll> v(1e5+1, 0); rep(i, N) { int a, b; cin >> a >> b; v[a] += b; } ll sum = 0 int ans; rep(i, N+1) { sum += v[i]; if(sum >= K) { ans = i; break; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:31:3: error: expected ',' or ';' before 'int' 31 | int ans; | ^~~ a.cc:35:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 35 | ans = i; | ^~~ | abs a.cc:39:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 39 | cout << ans << endl; | ^~~ | abs
s507331237
p03721
C++
// In His Name #include <Bits/stdc++.h> #define pb push_back #define F first #define S second #define ll long long #define gcd __gcd using namespace std; typedef pair<int, int> pii; ll n, k; map <ll, ll> mp; int main(){ ios_base::sync_with_stdio(0); cin >> n >> k; for (int i = 0 ; i < n ; i++){ int x, y; cin >> x >> y; mp[x] += y; } ll tedad = 0; for (auto u : mp){ tedad += u.S; if (tedad >= k){ cout << u.F; return 0; } } }
a.cc:3:10: fatal error: Bits/stdc++.h: No such file or directory 3 | #include <Bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s509787778
p03721
C++
n, k = [int(i) for i in input().split()] m = sorted([[int(i) for i in input().split()] for _ in range(n)] s=0 i=0 while s<k: s += m[i][1] i += 1 print(m[i-1][0])
a.cc:1:1: error: 'n' does not name a type 1 | n, k = [int(i) for i in input().split()] | ^
s450248299
p03721
C++
#include <bits/stdc++.h> #define int long long using namespace std; int main() { int a,b; cin>>a>>b; vector<pair<int,int>> vec(a); for(int i=0;i<a;i++){ int X,Y; cin >> X >> Y; vec.at(i) = make_pair(X,Y); } sort(vec.begin(),vec.end()); int count = 0; int answer = 0; for(int i = 0;i < a;i++) { if(b - count <= vec[i].second) { answer = vec[i].first; break; } count += vec[i].second; } cout << answer << endl; }
cc1plus: error: '::main' must return 'int'
s421129856
p03721
C++
#include <bits/stdc++.h> #define int long long using namespace std; int main() { int a,b; cin>>a>>b; vector<pair<int,int>> c(a); for(int i=0;i<a;i++){ int X,Y; cin >> X >> Y; c.at(i) = make_pair(X,Y); } sort(c.begin(),c.end()); int count = 0; int answer = 0; for(int i = 0;i < a;i++) { if(b - count <= c[i].second) { answer = c[i].first; break; } count += c[i].second; } cout << answer << endl; }
cc1plus: error: '::main' must return 'int'
s626857180
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b; cin>>a>>b; vector<pair<int,int>> c(a); for(int i=0;i<a;i++){ int X,Y; cin >> X >> Y; c.at(i) = make_pair(X,Y); } sort(vec.begin(),vec.end()); int count = 0; int answer = 0; for(int i = 0;i < a;i++) { if(b - count <= c[i].second) { answer = c[i].first; break; } count += c[i].second; }
a.cc: In function 'int main()': a.cc:12:8: error: 'vec' was not declared in this scope 12 | sort(vec.begin(),vec.end()); | ^~~ a.cc:21:10: error: expected '}' at end of input 21 | } | ^ a.cc:3:12: note: to match this '{' 3 | int main() { | ^
s103445380
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b; cin>>a>>b; vector<pair<int,int>> c(a); for(int i=0;i<a;i++){ int X,Y; cin >> X >> Y; c.at(i) = make_pair(X,Y); } sort(vec.begin(),vec.end()); int count = 0; int answer = 0; for(int i = 0;i < N;i++) { if(K - count <= vec[i].second) { answer = vec[i].first; break; } count += vec[i].second; }
a.cc: In function 'int main()': a.cc:12:8: error: 'vec' was not declared in this scope 12 | sort(vec.begin(),vec.end()); | ^~~ a.cc:15:27: error: 'N' was not declared in this scope 15 | for(int i = 0;i < N;i++) { | ^ a.cc:16:20: error: 'K' was not declared in this scope 16 | if(K - count <= vec[i].second) { | ^ a.cc:21:10: error: expected '}' at end of input 21 | } | ^ a.cc:3:12: note: to match this '{' 3 | int main() { | ^
s983844791
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b; cin>>a>>b; vector<pair<int,int>> c(a); for(int i=0;i<a;i++){ int X,Y; cin >> X >> Y; c.at(i) = make_pair(X,Y); } sort(c.begin(), c.end()); int count=0; for(int i=0;i<a;i++){ if(b-count<=c[i].second){ cout<<c[i].first<<endl; break; } count+=c[i]second; } }
a.cc: In function 'int main()': a.cc:19:8: error: no match for 'operator+=' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'}) 19 | count+=c[i]second;
s632656798
p03721
C++
#include <bits/stdc++.h> #define ll long long #define rep(X,N) for(ll X = 0; X < (N); X++) #define PI (acos(-1.0)) #define sorta(V) sort(V.begin(), V.end()) #define pback push_back #define mpair make_pair #define MODN 1000000007 #define ALL(V) (V).begin(),(V).end() using namespace std; int main(){ int n ll k; cin >> n >> k; vector<pair<int,int>> v; rep(i,n){ int a,b; cin >> a >> b; v.pback(mpair(a,b)); } sort(ALL(v)); int ans; rep(i,n){ ans = v[i].first; k = k - v[i].second; if(k <= 0) break; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:2:12: error: expected initializer before 'long' 2 | #define ll long long | ^~~~ a.cc:16:5: note: in expansion of macro 'll' 16 | ll k; | ^~ a.cc:17:12: error: 'n' was not declared in this scope; did you mean 'yn'? 17 | cin >> n >> k; | ^ | yn a.cc:17:17: error: 'k' was not declared in this scope 17 | cin >> n >> k; | ^
s339191865
p03721
C++
#include<bits/stdc++.h> #define rep(i,n,m) for(int i = (n); i <(m); i++) using namespace std; using ll = long long; int main() { ll n, k; cin >> n >> k; vector<int, int> ab; rep(i, 0, n) { int a, b; cin >> a >> b; ab.emplace_back(a, b); } sort(ab.begin(), ab.end()); int now = -1; for (int i = 0; i < ab.size() and k > 0; i++) { now = ab[i].first; k -= ab[i].second; } cout << now << endl; return 0; }
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: In instantiation of 'struct std::_Vector_base<int, int>': /usr/include/c++/14/bits/stl_vector.h:428:11: required from 'class std::vector<int, int>' 428 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ a.cc:11:22: required from here 11 | vector<int, int> ab; | ^~ /usr/include/c++/14/bits/stl_vector.h:87:28: error: 'int' is not a class, struct, or union type 87 | rebind<_Tp>::other _Tp_alloc_type; | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:89:9: error: 'int' is not a class, struct, or union type 89 | pointer; | ^~~~~~~ /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<int, int>': a.cc:11:22: required from here 11 | vector<int, int> ab; | ^~ /usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<int, int>::_Base' 518 | using _Base::_M_allocate; | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<int, int>::_Base' 519 | using _Base::_M_deallocate; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<int, int>::_Base' 521 | using _Base::_M_get_Tp_allocator; | ^~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/cassert:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33: /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = int]': a.cc:11:22: required from here 11 | vector<int, int> ab; | ^~ /usr/include/c++/14/bits/stl_vector.h:136:24: error: 'int' is not a class, struct, or union type 136 | _Vector_impl() _GLIBCXX_NOEXCEPT_IF( | ^~~~~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:16:12: error: 'class std::vector<int, int>' has no member named 'emplace_back' 16 | ab.emplace_back(a, b); | ^~~~~~~~~~~~ a.cc:18:13: error: 'class std::vector<int, int>' has no member named 'begin' 18 | sort(ab.begin(), ab.end()); | ^~~~~ a.cc:18:25: error: 'class std::vector<int, int>' has no member named 'end' 18 | sort(ab.begin(), ab.end()); | ^~~ a.cc:23:17: error: no match for 'operator[]' (operand types are 'std::vector<int, int>' and 'int') 23 | now = ab[i].first; | ^ a.cc:24:16: error: no match for 'operator[]' (operand types are 'std::vector<int, int>' and 'int') 24 | k -= ab[i].second; | ^ /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = int]': /usr/include/c++/14/bits/stl_vector.h:314:7: required from here 314 | _Vector_base() = default; | ^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:141:26: error: 'int' is not a class, struct, or union type 141 | : _Tp_alloc_type() | ^
s964049674
p03721
C++
#include<bits/stdc++.h> using namespace std; #define ll long long ll n,k; ll a,b; vector<pair<ll,ll> > num; vector<pair<ll,ll> > ::iterator iter; int main(){ cin>>n>>k; for(int i=1;i<=n;i++) { cin>>a>>b; num.insert(make_pair(a,b)); } ll sum=0; for(iter=num.begin();iter!=num.end();iter++) { sum+=iter->second; if(sum>=k) return 0*printf("%d\n",iter->first); } return 0; }
a.cc: In function 'int main()': a.cc:14:22: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::insert(std::pair<long long int, long long int>)' 14 | num.insert(make_pair(a,b)); | ~~~~~~~~~~^~~~~~~~~~~~~~~~ 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:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >]' 1484 | insert(const_iterator __position, _InputIterator __first, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/vector:72: /usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; iterator = std::vector<std::pair<long long int, long long int> >::iterator; const_iterator = std::vector<std::pair<long long int, long long int> >::const_iterator; value_type = std::pair<long long int, long long int>]' 133 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:133:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; iterator = std::vector<std::pair<long long int, long long int> >::iterator; const_iterator = std::vector<std::pair<long long int, long long int> >::const_iterator; value_type = std::pair<long long int, long long int>]' 1395 | insert(const_iterator __position, value_type&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; iterator = std::vector<std::pair<long long int, long long int> >::iterator; const_iterator = std::vector<std::pair<long long int, long long int> >::const_iterator]' 1413 | insert(const_iterator __position, initializer_list<value_type> __l) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; iterator = std::vector<std::pair<long long int, long long int> >::iterator; const_iterator = std::vector<std::pair<long long int, long long int> >::const_iterator; size_type = long unsigned int; value_type = std::pair<long long int, long long int>]' 1439 | insert(const_iterator __position, size_type __n, const value_type& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate expects 3 arguments, 1 provided
s527363983
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = (int)1e9 + 7; const int INF = (int)100100100; int main() { ll N; cin >> N; //ll N,M; cin >> N >> M; //string S; cin >> S; //ll H,W; cin >> H >> W; ll K; cin >> K; ll sum=0; ll num[100000]={}; for(int i=0;i<N;i++){ ll a,b; cin >> a >> b; num[a]+=b; } ll mat=0: for(int i=0;i<100001;i++){ mat+=num[i]; if(mat>=K){ cout << i; break; } } } /* */
a.cc: In function 'int main()': a.cc:20:13: error: expected ',' or ';' before ':' token 20 | ll mat=0: | ^ a.cc:21:21: error: 'i' was not declared in this scope 21 | for(int i=0;i<100001;i++){ | ^
s968790696
p03721
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> /* define */#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> /* define */ #define Yes(X) puts ( X ? "Yes" : "No") #define YES(X) puts ( X ? "YES" : "NO") #define FOR(i, a, b) for ( int i = a; i < b ; i++) #define REP(i, n) for ( int i = 0; i < n ; i++) #define max(a, b) (((a) > (b)) ? (a) : (b)) #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c)) #define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c)) /* const */ const int MOD = (int)1e9 + 7; /* alias */ typedef long long ll; typedef unsigned u; /* function */ int cmp(const void *a, const void *b) { return *(int*)a - *(int*)b; } int cmp2(const void *a, const void *b) { return *(int*)b - *(int*)a; } /* main */ int main() { ll n, k, a, b, c[100001] = { 0 }; scanf("%lld%lld", &n, &k); REP(i, n) { scanf("%lld%lld", &a, &b); c[a] += b; } REP(i, 100001) { if (k > c[i]) k -= c[i]; else { printf("%lld", i); return 0; } } } #define Yes(X) puts ( X ? "Yes" : "No") #define YES(X) puts ( X ? "YES" : "NO") #define FOR(i, a, b) for ( int i = a; i < b ; i++) #define REP(i, n) for ( int i = 0; i < n ; i++) #define max(a, b) (((a) > (b)) ? (a) : (b)) #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c)) #define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c)) /* const */ const int MOD = (int)1e9 + 7; /* alias */ typedef long long ll; typedef unsigned u; /* function */ int cmp(const void *a, const void *b) { return *(int*)a - *(int*)b; } int cmp2(const void *a, const void *b) { return *(int*)b - *(int*)a; } /* main */ int main() { int n, k, a, b; ll c[100001] = { 0 }; scanf("%d%d", &n, &k); REP(i, n) { scanf("%d%d", &a, &b); c[a] += b; } REP(i, 100001) { if (k > c[i]) k -= c[i]; else { printf("%d", i); return 0; } } }
main.c:67:11: error: redefinition of 'MOD' 67 | const int MOD = (int)1e9 + 7; | ^~~ main.c:26:11: note: previous definition of 'MOD' with type 'int' 26 | const int MOD = (int)1e9 + 7; | ^~~ main.c:74:5: error: redefinition of 'cmp' 74 | int cmp(const void *a, const void *b) { | ^~~ main.c:33:5: note: previous definition of 'cmp' with type 'int(const void *, const void *)' 33 | int cmp(const void *a, const void *b) { | ^~~ main.c:77:5: error: redefinition of 'cmp2' 77 | int cmp2(const void *a, const void *b) { | ^~~~ main.c:36:5: note: previous definition of 'cmp2' with type 'int(const void *, const void *)' 36 | int cmp2(const void *a, const void *b) { | ^~~~ main.c:83:5: error: redefinition of 'main' 83 | int main() { | ^~~~ main.c:42:5: note: previous definition of 'main' with type 'int()' 42 | int main() { | ^~~~
s234609462
p03721
C++
N, K = map(int, input().split()) acc = 0 while True: a, b = map(int, input().split()) acc += b if K <= acc: print(a) break
a.cc:1:1: error: 'N' does not name a type 1 | N, K = map(int, input().split()) | ^
s987838077
p03721
C++
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define REPS(i,s,n) for(int i=(s), i##_len=(n); i<i##_len; ++i) #define ALL(obj) (obj).begin(),(obj).end() typedef unsigned int uint; typedef unsigned long long int ull; typedef long long int ll; typedef pair<int,int> P; #define LINF ((ll)1 << 63 -1) #define INF 2000000007 #define MINF -2000000007 #define MAX 100005 const int MOD = 1e9+7; // テンプレ終了 //====================================================================// // int main(){ int N ll K;cin>>N>>K; vector<P> a(N); REP(i,N)cin>>a[i].first>>a[i].second; sort(ALL(a)); ll suml=0; int ans=-1; REP(i,N){ suml+=a[i].second; if(suml>=K){ ans = a[i].first; break; } } cout << (ans != -1 ? ans : a[a.size()-1].first) << endl; return 0; }
a.cc: In function 'int main()': a.cc:30:9: error: expected initializer before 'll' 30 | ll K;cin>>N>>K; | ^~ a.cc:30:19: error: 'N' was not declared in this scope 30 | ll K;cin>>N>>K; | ^ a.cc:30:22: error: 'K' was not declared in this scope 30 | ll K;cin>>N>>K; | ^
s217977697
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b; int c=0; cin>>a>>b; vector<pair<int,int>> d(a); for(int i=0;i<a;i++) { int e,f; cin >>e>>f; d.at(i) = make_pair(e,f); } sort(d.begin(), d.end()); for(int i=0;i<a;i++){ if(b<=c){ cout <<d[i].first; break; } c+=d[i].second; } }
a.cc: In function 'int main()': a.cc:20:13: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'second\U0000ff1b'; did you mean 'second'? 20 | c+=d[i].second; | ^~~~~~~~ | second
s096318458
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b; int c=0; cin>>a>>b; vector<int> e(a); vector<int> d(a); for(int i=0;i<a;i++){ cin>>e.at(i); cin>>d.at(i); } sort(e.begin(), e.end()) for(int i=0;i<a;i++){ c+=d.at(i); if(b<=c){ cout <<e.at(i); break; } } }
a.cc: In function 'int main()': a.cc:14:27: error: expected ';' before 'for' 14 | sort(e.begin(), e.end()) | ^ | ; 15 | for(int i=0;i<a;i++){ | ~~~ a.cc:15:15: error: 'i' was not declared in this scope 15 | for(int i=0;i<a;i++){ | ^
s049917921
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b; int c=0; int g=0; cin>>a>>b; vector<int> e(a); vector<int> d(a); for(int i=0;i<a;i++) g+=e.at(i); vector<int> f(g); for(int i=0;i<a;i++){ cin>>e.at(i); cin>>d.at(i); } for(int i=0;i<a;i++){ for(int j=0;i<d.at(i);j++) f.at(j)=e.at(i) } cout<<f.at(b); }
a.cc: In function 'int main()': a.cc:20:23: error: expected ';' before '}' token 20 | f.at(j)=e.at(i) | ^ | ; 21 | } | ~
s024791886
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b; int c=0; int g=0; cin>>a>>b; vector<int> e(a); vector<int> d(a); for(int i=0;i<a;i++) g+=e.at(i) vector<int> f(g); for(int i=0;i<a;i++){ cin>>e.at(i); cin>>d.at(i); } for(int i=0;i<a;i++){ for(int j=0;i<d.at(i);j++) f.at(j)=e.at(i) } cout<<f.at(b); }
a.cc: In function 'int main()': a.cc:12:15: error: expected ';' before 'vector' 12 | g+=e.at(i) | ^ | ; 13 | vector<int> f(g); | ~~~~~~ a.cc:20:8: error: 'f' was not declared in this scope 20 | f.at(j)=e.at(i) | ^ a.cc:22:9: error: 'f' was not declared in this scope 22 | cout<<f.at(b); | ^
s869494800
p03721
C++
#include<iostream> #include<vector> #include<map> #include<algorithm> #include<iomanip> int main(){ int N; long K; std::cin >> N >> K; std::map<int, int> ab; int temp1, temp2; for(int i = 0; i < N; i++){ std::cin >> temp1 >> temp2; auto itr = ab.find(temp1); if(itr != ab.end()) ab[temp1] += temp2; else ab[temp1] = temp2; } for(auto x : ab){ K -= x.second; if(K <= 0){ std::fixed; std::cout << setprecision(10) << x.first << std::endl; break; } } }
a.cc: In function 'int main()': a.cc:23:20: error: 'setprecision' was not declared in this scope; did you mean 'std::setprecision'? 23 | std::cout << setprecision(10) << x.first << std::endl; | ^~~~~~~~~~~~ | std::setprecision In file included from a.cc:5: /usr/include/c++/14/iomanip:202:3: note: 'std::setprecision' declared here 202 | setprecision(int __n) | ^~~~~~~~~~~~
s332704329
p03721
C++
#include<bits/stdc++.h> using namespace std; int main(){ long N,K,p,q;cin>>N;K; vector<int> a; for(int i=0;i<N;i++){ cin>>p>>q; for(int j=0;j<b;j++)a.push_back(p); } sort(a.begin(),a.end()); cout<<a.at(K-1)<<endl; }
a.cc: In function 'int main()': a.cc:8:19: error: 'b' was not declared in this scope 8 | for(int j=0;j<b;j++)a.push_back(p); | ^
s599825794
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b; int c=0; cin>>a>>b; vector<int> c(a); vector<int> d(a); for(int i=0;i<a;i++){ cin>>c.at(i); cin>>d.at(i); } for(int i=0;i<a;i++){ c+=d.at(i); if(b<=c) cout <<c.at(i); } }
a.cc: In function 'int main()': a.cc:8:15: error: conflicting declaration 'std::vector<int> c' 8 | vector<int> c(a); | ^ a.cc:6:7: note: previous declaration as 'int c' 6 | int c=0; | ^ a.cc:11:8: error: request for member 'at' in 'c', which is of non-class type 'int' 11 | cin>>c.at(i); | ^~ a.cc:17:16: error: request for member 'at' in 'c', which is of non-class type 'int' 17 | cout <<c.at(i); | ^~
s891717746
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b; int c=0; cin>>a>>b; vector<int> c(a); vector<int> d(a); for(int i=0;i<a;i++){ cin>>c.at(i); cin>>d.at(i); } for(int i=0;i<a;i++){ c+=d.at(i); if(b<=c) cout <<c.at(i); } }
a.cc: In function 'int main()': a.cc:8:15: error: conflicting declaration 'std::vector<int> c' 8 | vector<int> c(a); | ^ a.cc:6:7: note: previous declaration as 'int c' 6 | int c=0; | ^ a.cc:11:8: error: request for member 'at' in 'c', which is of non-class type 'int' 11 | cin>>c.at(i); | ^~ a.cc:17:16: error: request for member 'at' in 'c', which is of non-class type 'int' 17 | cout <<c.at(i); | ^~
s347265345
p03721
C++
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin>>a>>b; vector<vector<int>> c(2*a); for(int i=0;i<2*a;i++) cin>>c.at(i); vector<int> d(a); for(int i=0;i<a;i++) d.at(i)=c.at(2*i) sort() unsigned long long int d=0; for(int i=0;i<a;i++) d+=2*i+1; vector<int> e(d);
a.cc: In function 'int main()': a.cc:9:8: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'}) 9 | cin>>c.at(i); | ~~~^~~~~~~~~ | | | | | __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>} | std::istream {aka std::basic_istream<char>} In file included 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, 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>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /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>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /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>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /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>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /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>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /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>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /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>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /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>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /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>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /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 '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} 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 '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} 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 '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /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>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /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 '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} 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 '__gnu_
s962598763
p03721
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; long long K; long long ans = 0; cin >> N >> K; int a, b; int t[100100]; for(int i=0; i< N; ++i) { cin >> a >> b; t[a] = b; } for(int i=0; i< 100100; ++i) { if(sum >= K){ cout << i << endl; return 0; } K -= t[i]; } return 0; }
a.cc: In function 'int main()': a.cc:17:12: error: 'sum' was not declared in this scope 17 | if(sum >= K){ | ^~~
s996400619
p03721
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int a[100010], b[100010]; int N; ll K; cin >> N >> K; vector<pair<int, int>> v(N); rep(i, N) { int a2, b2; cin >> a2 >> b2; v.push.back(make_pair(a2, b2)); } sort(v.begin(), v.end()); rep(i, N) { a[i] = v[i].first; b[i] = v[i].second; } rep(i, N) { if(b[i] >= K) { cout << a[i] << endl; return 0; } else { K -= b[i]; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'push' 21 | v.push.back(make_pair(a2, b2)); | ^~~~
s212793508
p03721
C++
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <cmath> #include <vector> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int a[100010], b[100010]; int N; ll K; cin >> N >> K; vector<pair<int, int>> v; rep(i, N) { int a2, b2; cin >> a2 >> b2; v.push.back(make_pair(a2, b2)); } sort(v.begin(), v.end()); rep(i, N) { a[i] = v[i].first; b[i] = v[i].second; } rep(i, N) { if(b[i] >= K) { cout << a[i] << endl; return 0; } else { K -= b[i]; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'push' 21 | v.push.back(make_pair(a2, b2)); | ^~~~
s366937150
p03721
C++
#include "bits/stdc++.h" using namespace std; void solve(void) { long n, k; cin >> n >> k; vector<pair<long, long>> ps(n); for (int i = 0; i < n; i++) { cin >> ps[i].first >> ps[i].second; } sort(ps.begin(), ps.end()); long now = 0; for (int i = 0; i < n; i++) { now += bs[i]; if (now >= k) { cout << as[i] << endl; return; } } } int main() { solve(); //cout << "yui(*-v・)yui" << endl; return 0; }
a.cc: In function 'void solve()': a.cc:18:24: error: 'bs' was not declared in this scope; did you mean 'ps'? 18 | now += bs[i]; | ^~ | ps a.cc:21:33: error: 'as' was not declared in this scope; did you mean 'ps'? 21 | cout << as[i] << endl; | ^~ | ps
s558233305
p03721
C++
#define _CRT_SECURE_NO_WARNINGS #define MATH_PI 3.14159265358979323846264338327950288419716939 #define DIVIDER9 1000000007 #define lli long long int #include <iostream> #include <string.h> #include <fstream> #include <math.h> #include <iomanip> using namespace std; #ifdef _WIN32 #pragma warning(disable : 4101) signed wait(){ char wait_dummy[256]; scanf("%c", &wait_dummy); return 0; } template <typename ... Args> void dout(const char *format, Args const & ... args){ printf(format, args ...); } #define MAX_CHARBUF 65536 #define DATAFILE "data.dat" class csLocalInput{ int FileOpen(); public: FILE *fp; csLocalInput(); }; csLocalInput::csLocalInput() { FileOpen(); } int csLocalInput::FileOpen() { fp = fopen(DATAFILE, "rt"); return 1; } csLocalInput local_in; #define DEBUG 1 #else inline signed wait() { return 0; } inline void dout(const char *arg, ...) {} #endif template<typename T>inline void SWAP(T &a, T &b) { T t = a; a = b; b = t; } inline void CSWAP(char *&a, char *&b) { char *t = a; a = b; b = t; } #define CLIP(ptr, min, max) {if((min)<=(max)){if(ptr<(min)){ptr=(min);}if(ptr>(max)){ptr=(max);}}} #define Sin(deg) sin((deg)*MATH_PI/180.0) #define Cos(deg) cos((deg)*MATH_PI/180.0) #define Tan(deg) tan((deg)*MATH_PI/180.0) #define Rad(deg) ((deg)*MATH_PI/180.0) #define rep(param, num) for(int param=0 ; param<num ; ++param) #define fi(num) for(int i=0 ; i<num ; ++i) #define fj(num) for(int j=0 ; j<num ; ++j) #define fk(num) for(int k=0 ; k<num ; ++k) #define fl(num) for(int l=0 ; l<num ; ++l) #define fn(num) for(int n=0 ; n<num ; ++n) #define ffr(param, num) for(int param=num-1 ; param>=0 ; --param) #define fir(num) for(int i=num-1 ; i>=0 ; --i) #define fjr(num) for(int j=num-1 ; j>=0 ; --j) #define fkr(num) for(int k=num-1 ; k>=0 ; --k) #define flr(num) for(int l=num-1 ; l>=0 ; --l) #define fnr(num) for(int n=num-1 ; n>=0 ; --n) #define gi(p) int p; Gi(p) #define gi2(p1, p2) int p1, p2; Gi2(p1, p2) #define gi3(p1, p2, p3) int p1, p2, p3; Gi3(p1, p2, p3) #define gi4(p1, p2, p3, p4) int p1, p2, p3, p4; Gi4(p1, p2, p3, p4) #define glli(p) lli p; Glli(p) #define glli2(p1, p2) lli p1, p2; Glli2(p1, p2) #define glli3(p1, p2, p3) lli p1, p2, p3; Glli3(p1, p2, p3) #define glli4(p1, p2, p3, p4) lli p1, p2, p3, p4; Glli4(p1, p2, p3, p4) #define gf(p) double p; Gf(p); #define gf2(p1, p2) double p1, p2; Gf2(p1, p2); #define gf3(p1, p2, p3) double p1, p2, p3; Gf3(p1, p2, p3); #define gf4(p1, p2, p3, p4) double p1, p2, p3, p4; Gf4(p1, p2, p3, p4) #define Gi(p) Scanf("%d", p) #define Gi2(p1, p2) Scanf2("%d %d", p1, p2) #define Gi3(p1, p2, p3) Scanf3("%d %d %d", p1, p2, p3) #define Gi4(p1, p2, p3, p4) Scanf4("%d %d %d %d", p1, p2, p3, p4) #define Glli(p) Scanf("%lld", p) #define Glli2(p1, p2) Scanf2("%lld %lld", p1, p2) #define Glli3(p1, p2, p3) Scanf3("%lld %lld %lld", p1, p2, p3) #define Glli4(p1, p2, p3, p4) Scanf4("%lld %lld %lld %lld", p1, p2, p3, p4) #define Gf(p) Scanf("%f", p) #define Gf2(p1, p2) Scanf2("%f %f", p1, p2) #define Gf3(p1, p2, p3) Scanf3("%f %f %f", p1, p2, p3) #define Gf4(p1, p2, p3, p4) Scanf4("%f %f %f %f", p1, p2, p3, p4) #ifdef DEBUG #define Gc(buf) fscanf(local_in.fp, "%s", buf) #define Scanf(expr, p) fscanf(local_in.fp, expr, &p) #define Scanf2(expr, p1, p2) fscanf(local_in.fp, expr, &p1, &p2) #define Scanf3(expr, p1, p2, p3) fscanf(local_in.fp, expr, &p1, &p2, &p3) #define Scanf4(expr, p1, p2, p3, p4) fscanf(local_in.fp, expr, &p1, &p2, &p3, &p4) #else #define Gc(buf) Scanf("%s", buf) #define Scanf(expr, p) scanf(expr, &p) #define Scanf2(expr, p1, p2) scanf(expr, &p1, &p2) #define Scanf3(expr, p1, p2, p3) scanf(expr, &p1, &p2, &p3) #define Scanf4(expr, p1, p2, p3, p4) scanf(expr, &p1, &p2, &p3, &p4) #endif #define ans(p) cout << p << endl; #define ans_end(p) {cout << p << endl; return wait();} void CombSort(int N, int *ar, int order_ascending = 1) { if (N <= 1) return; int h = int(N / 1.3); int flag; int i; while (true) { flag = 0; for (i = 0; i + h < N; ++i) { if ((order_ascending&&ar[i] > ar[i + h]) || (!order_ascending&&ar[i] < ar[i + h])) { swap<int>(ar[i], ar[i + h]); flag = 1; } }if (h == 1 && !flag)break; if (h == 9 || h == 10) h = 11; if (h > 1)h = int(h / 1.3); } } void CombSort_ll(int N, lli *ar, int order_ascending = 1) { if (N <= 1) return; int h = int(N / 1.3); int flag; int i; while (true) { flag = 0; for (i = 0; i + h < N; ++i) { if ((order_ascending&&ar[i] > ar[i + h]) || (!order_ascending&&ar[i] < ar[i + h])) { swap<lli>(ar[i], ar[i + h]); flag = 1; } }if (h == 1 && !flag)break; if (h == 9 || h == 10) h = 11; if (h > 1)h = int(h / 1.3); } } int EuclideanAlgorithm(int N, int *ar){ fn(N - 1){ while (true){ if (ar[n] % ar[n + 1] == 0 || ar[n + 1] % ar[n] == 0) { ar[n + 1] = ar[n] < ar[n + 1] ? ar[n] : ar[n + 1]; break; } if (ar[n] > ar[n + 1]) { ar[n] %= ar[n + 1]; } else { ar[n + 1] %= ar[n]; } } } return ar[N - 1]; } template<typename T>void CombSort(int N, T *ar, int order_ascending = 1) { if (N <= 1) return; int i, flag; int h = int(N / 1.3); while (true) { flag = 0; for (i = 0; i + h < N; ++i) { if ( order_ascending && ar[i].SortValue > ar[i + h].SortValue || !order_ascending && ar[i].SortValue < ar[i + h].SortValue ) { SWAP<T>(ar[i], ar[i + h]); flag = 1; } } if (h > 1) { h = int(h / 1.3); if (h == 9 || h == 10) h = 11; } else { if (!flag) break; } } } #include <vector> #include <algorithm> struct UnionFind { vector<int> par; UnionFind(int N) : par(N) { for (int i = 0; i < N; i++) par[i] = i; } int root(int x) { if (par[x] == x) return x; return par[x] = root(par[x]); } void unite(int x, int y) { int rx = root(x); int ry = root(y); if (rx == ry) return; par[rx] = ry; } bool same(int x, int y) { int rx = root(x); int ry = root(y); return rx == ry; } }; void Replace(char *c, int len, char before, char after) { fi(len){ if(c[i] == before) c[i] = after; } } void Replace(char *c, char before, char after){ int len = strlen(c); Replace(c, len, before, after); } class csNode{ public: csNode(){ } }; class csStack{ public: csStack(){ num = 0; } void alloc(int size){ param = new int[size]; } void sort(int order = 1){ if(num > 1) CombSort(num, param, order); } int num; int *param; void push(int p){ param[num++] = p; } }; class csPosition{ public: csPosition(){x = y = 0;} int x, y; }; typedef class csPosition POS; template<typename T> class csPos{ public: csPos(){x = y = 0;} T x, y; }; char s[200010]; int index[100010][2]; signed main() { gi2(n, k); fi(n){ Gi2(index[i][0], index[i][1]); if(i > 0) index[i][1] += index[i-1][1]; } fi(n){ if(k <= index[i][1]){ ans_end(index[i][0]); } } return wait(); }
a.cc:249:20: error: 'int index [100010][2]' redeclared as different kind of entity 249 | int index[100010][2]; | ^ In file included from /usr/include/string.h:462, from a.cc:6: /usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)' 50 | extern const char *index (const char *__s, int __c) | ^~~~~ a.cc: In function 'int main()': a.cc:255:26: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 255 | Gi2(index[i][0], index[i][1]); | ^ a.cc:115:43: note: in definition of macro 'Scanf2' 115 | #define Scanf2(expr, p1, p2) scanf(expr, &p1, &p2) | ^~ a.cc:255:17: note: in expansion of macro 'Gi2' 255 | Gi2(index[i][0], index[i][1]); | ^~~ a.cc:255:39: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 255 | Gi2(index[i][0], index[i][1]); | ^ a.cc:115:48: note: in definition of macro 'Scanf2' 115 | #define Scanf2(expr, p1, p2) scanf(expr, &p1, &p2) | ^~ a.cc:255:17: note: in expansion of macro 'Gi2' 255 | Gi2(index[i][0], index[i][1]); | ^~~ a.cc:256:32: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 256 | if(i > 0) index[i][1] += index[i-1][1]; | ^ a.cc:256:47: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 256 | if(i > 0) index[i][1] += index[i-1][1]; | ^ a.cc:260:30: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 260 | if(k <= index[i][1]){ | ^ a.cc:261:38: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 261 | ans_end(index[i][0]); | ^ a.cc:120:29: note: in definition of macro 'ans_end' 120 | #define ans_end(p) {cout << p << endl; return wait();} | ^
s782270094
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { map<int,int> cnt; int n,q; cin>>n>>q; int x,y; for(int i=0 ; i<n ; ++i) { cin>>x>>y; cnt[x]+=y; } for(auto &i:cnt) { if(i.second>=q) { cout<<i.first<<endl return 0; } q-=i.second; } return 0; }
a.cc: In function 'int main()': a.cc:19:36: error: expected ';' before 'return' 19 | cout<<i.first<<endl | ^ | ; 20 | return 0; | ~~~~~~
s807270788
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { map<int,int> cnt; int n,q; cin>>n>>q; int x,y; for(int i=0 ; i<n ; ++i) { cin>>x>>y; cnt[x]+=y; } for(auto &i:cnt) { if(i.second>=q) { cout<<i.first<<endl return 0; } q-=i.second; } return 0; }
a.cc: In function 'int main()': a.cc:19:36: error: expected ';' before 'return' 19 | cout<<i.first<<endl | ^ | ; 20 | return 0; | ~~~~~~
s848489257
p03721
C++
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:7:5: error: 'cin' was not declared in this scope 7 | cin >> N >> K; | ^~~ a.cc:14:13: error: 'cout' was not declared in this scope 14 | cout << ans << endl; | ^~~~ a.cc:14:28: error: 'endl' was not declared in this scope 14 | cout << ans << endl; | ^~~~
s979044581
p03721
C++
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 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:1:1: error: expected unqualified-id before numeric constant 1 | 2 3 4 5 6 7 8 9 | ^ a.cc:5:1: error: 'll' does not name a type 5 | ll cnt[AMAX + 1]; | ^~ a.cc: In function 'int main()': a.cc:8:5: error: 'll' was not declared in this scope 8 | ll K; | ^~ a.cc:9:5: error: 'cin' was not declared in this scope 9 | cin >> N >> K; | ^~~ a.cc:9:17: error: 'K' was not declared in this scope 9 | cin >> N >> K; | ^ a.cc:13:1: error: 'cnt' was not declared in this scope; did you mean 'int'? 13 | cnt[A] += B; } | ^~~ | int a.cc:15:18: error: 'cnt' was not declared in this scope; did you mean 'int'? 15 | if (K <= cnt[ans]) { | ^~~ | int a.cc:16:13: error: 'cout' was not declared in this scope 16 | cout << ans << endl; | ^~~~ a.cc:16:28: error: 'endl' was not declared in this scope 16 | cout << ans << endl; | ^~~~ a.cc:18:14: error: 'cnt' was not declared in this scope; did you mean 'int'? 18 | K -= cnt[ans]; | ^~~ | int
s501163020
p03721
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bitset> #include<set> #include<map> #include<stack> #include<queue> #include<iomanip> using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define INF 2e9 #define MOD 1e9+7 #define LINF (long long)4e18 int main(){ int N,;cin >> N; long long K; cin >> K; vector<pair<long long,long long>> ab(N); rep(i,N){ cin >> ab[i].first >> ab[i].second; } sort(ab.begin(),ab.end()); long long sum = 0; long long ans; rep(i,N){ sum += ab[i].second; if(sum >= K){ ans = ab[i].first; cout << ans << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:21:11: error: expected unqualified-id before ';' token 21 | int N,;cin >> N; | ^
s236485913
p03721
C++
#include<bits/stdc++.h> using namespace std; //define #define int long long #define rep(x,y) for(int i=x;i<y;i++) #define REP(x,y) for(int j=x;j<y;j++) #define Rep(x,y) for(int k=x;k<y;k++) #define str string //vectordefine #define vint vector<int> #define vvint vector<vector<int>> #define vc vector<char> #define vvc vector<vector<char>> #define vool vector<bool> #define vtr vector<str> #define vvtr vector<vector<str>> //queuedefine#include<bits/stdc++.h> using namespace std; //define #define int long long #define rep(x,y) for(int i=x;i<y;i++) #define REP(x,y) for(int j=x;j<y;j++) #define Rep(x,y) for(int k=x;k<y;k++) #define str string //vectordefine #define vint vector<int> #define vvint vector<vector<int>> #define vc vector<char> #define vvc vector<vector<char>> #define vool vector<bool> #define vtr vector<str> #define vvtr vector<vector<str>> //queuedefine #define qint queue<int> #define qtr queue<string> #define qc queue<char> //pairdefine #define pint pair<int,int> #define pic pair<int,char> #define pci pair<char,int> #define pis pair<int,str> #define psi pair<str,int> #define pcc pair<char,char> #define pss pair<str,str> #define mp make_pair //mapdefine #define mint map<int,int> #define mic map<int,char> #define mci map<char,int> #define mis map<int,str> #define msi map<str,int> #define pb() push_back() #define all(x) x.begin(),x.end() #define elif else if //function str shizuku(char,char); //UnionFind struct UnionFind{ vint par; UnionFind(int N):par(N){ rep(0,N)par[i]=i; } int root(int x){ if(par[x]==x)return x; return par[x]=root(par[x]); } void unite(int x,int y){ int rx=root(x); int ry=root(y); if(rx==ry)return; par[rx]=ry; } bool same(int x,int y){ return root(x)==root(y); } }; //binary_search //main signed main(){ int N,M,X,count=0,count2=0; double d,D; int alph='A'-'a'; char op,Ch; str S,T; cin>>N>>M; int a[N],b[N];rep(0,N)cin>>a[i]>>b[i]; rep(0,N){ count+=b[i]; if(M<=count){ cout<<a[i]<<endl; break; } } } #define qint queue<int> #define qtr queue<string> #define qc queue<char> //pairdefine #define pint pair<int,int> #define pic pair<int,char> #define pci pair<char,int> #define pis pair<int,str> #define psi pair<str,int> #define pcc pair<char,char> #define pss pair<str,str> #define mp make_pair //mapdefine #define mint map<int,int> #define mic map<int,char> #define mci map<char,int> #define mis map<int,str> #define msi map<str,int> #define pb() push_back() #define all(x) x.begin(),x.end() #define elif else if //function str shizuku(char,char); //UnionFind struct UnionFind{ vint par; UnionFind(int N):par(N){ rep(0,N)par[i]=i; } int root(int x){ if(par[x]==x)return x; return par[x]=root(par[x]); } void unite(int x,int y){ int rx=root(x); int ry=root(y); if(rx==ry)return; par[rx]=ry; } bool same(int x,int y){ return root(x)==root(y); } }; //binary_search //main signed main(){ int N,M,X,count=0,count2=0; double d,D; int alph='A'-'a'; char op,Ch; str S,T; cin>>N>>M; int a[N],b[N];rep(0,N)cin>>a[i]>>b[i]; rep(0,N){ count+=b[i]; if(M<=count){ cout<<a[i]<<endl; break; } }
a.cc:121:8: error: redefinition of 'struct UnionFind' 121 | struct UnionFind{ | ^~~~~~~~~ a.cc:58:8: note: previous definition of 'struct UnionFind' 58 | struct UnionFind{ | ^~~~~~~~~ a.cc:143:8: error: redefinition of 'int main()' 143 | signed main(){ | ^~~~ a.cc:80:8: note: 'int main()' previously defined here 80 | signed main(){ | ^~~~ a.cc: In function 'int main()': a.cc:157:2: error: expected '}' at end of input 157 | } | ^ a.cc:143:14: note: to match this '{' 143 | signed main(){ | ^
s612679435
p03721
C++
#include<bits/stdc++.h> using namespace std; //define #define int long long #define rep(x,y) for(int i=x;i<y;i++) #define REP(x,y) for(int j=x;j<y;j++) #define Rep(x,y) for(int k=x;k<y;k++) #define str string //vectordefine #define vint vector<int> #define vvint vector<vector<int>> #define vc vector<char> #define vvc vector<vector<char>> #define vool vector<bool> #define vtr vector<str> #define vvtr vector<vector<str>> //queuedefine #define qint queue<int> #define qtr queue<string> #define qc queue<char> //pairdefine #define pint pair<int,int> #define pic pair<int,char> #define pci pair<char,int> #define pis pair<int,str> #define psi pair<str,int> #define pcc pair<char,char> #define pss pair<str,str> #define mp make_pair //mapdefine #define mint map<int,int> #define mic map<int,char> #define mci map<char,int> #define mis map<int,str> #define msi map<str,int> #define pb() push_back() #define all(x) x.begin(),x.end() #define elif else if //function str shizuku(char,char); //UnionFind struct UnionFind{ vint par; UnionFind(int N):par(N){ rep(0,N)par[i]=i; } int root(int x){ if(par[x]==x)return x; return par[x]=root(par[x]); } void unite(int x,int y){ int rx=root(x); int ry=root(y); if(rx==ry)return; par[rx]=ry; } bool same(int x,int y){ return root(x)==root(y); } }; //binary_search //main signed main(){ int N,M,X,count=0,count2=0; double d,D; int alph='A'-'a'; char op,Ch; str S,T; cin>>N>>M; int a[N],b[N];rep(0,N)cin>>a[i]>>b[i]; rep(0,N){ count+=b[i]; if(M<=count){ cout<<a[i]<<endl; break; } }
a.cc: In function 'int main()': a.cc:78:2: error: expected '}' at end of input 78 | } | ^ a.cc:64:14: note: to match this '{' 64 | signed main(){ | ^
s407801913
p03721
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() typedef long long ll; #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) #define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i) #define repprev(i,a,b) for(ll i=b-1;i>=a;i--) #define reprev(i,n) repprev(i,0,n) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) 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; } template<class T> int former(const vector<T> &v, T x){ return upper_bound(v.begin(),v.end(),x) - v.begin() - 1; } template<class T> int latter(const vector<T> &v, T x){ return lower_bound(v.begin(),v.end(),x) - v.begin(); } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001 #define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010 #define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100 #define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000 #define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000 #define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000 #define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000 #define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll LLINF = 1LL<<60; const int INTINF = 1<<30; 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; } struct UnionFind { vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(ll n) : par(n, -1) { } void init(ll n) { par.assign(n, -1); } ll root(ll x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool issame(ll x, ll y) { return root(x) == root(y); } bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; if (par[x] > par[y]) swap(x, y); // merge technique par[x] += par[y]; par[y] = x; return true; } ll size(ll x) { return -par[root(x)]; } }; template <typename T> vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){ const T INF = numeric_limits<T>::max(); using P = pair<T, int>; int n=G.size(); vector<T> d(n,INF); vector<int> b(n,-1); priority_queue<P,vector<P>,greater<P> > q; d[s]=0; q.emplace(d[s],s); while(!q.empty()){ P p=q.top();q.pop(); int v=p.second; if(d[v]<p.first) continue; for(auto& e:G[v]){ int u=e.first; T c=e.second; if(d[u]>d[v]+c){ d[u]=d[v]+c; b[u]=v; q.emplace(d[u],u); } } } return d; } vector<vector<int> > bfs(vector<string> &s,int sy,int sx,char wall,int dir){ int h=s.size(),w=s.front().size(); vector<vector<int> > dp(h,vector<int>(w,-1)); using P = pair<int, int>; queue<P> q; dp[sy][sx]=0; q.emplace(sy,sx); int dy[]={1,-1,0,0,1,1,-1,-1}; int dx[]={0,0,1,-1,1,-1,1,-1}; auto in=[&](int y,int x){return 0<=y&&y<h&&0<=x&&x<w;}; while(!q.empty()){ int y,x; tie(y,x)=q.front();q.pop(); for(int k=0;k<dir;k++){ int ny=y+dy[k],nx=x+dx[k]; if(!in(ny,nx)||s[ny][nx]==wall) continue; if(~dp[ny][nx]) continue; dp[ny][nx]=dp[y][x]+1; q.emplace(ny,nx); } } return dp; } int64_t power(int64_t x, int64_t n, int64_t mod) { int64_t ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= mod; (x *= x) %= mod; n >>= 1; } return ret; } vector<int> sieve_of_eratosthenes(int n) { vector<int> primes(n); for (int i = 2; i < n; ++i) primes[i] = i; for (int i = 2; i*i < n; ++i) if (primes[i]) for (int j = i*i; j < n; j+=i) primes[j] = 0; return primes; } std::vector<ll> divisor(ll n)//nの約数を列挙 { std::vector<ll> ret; for(ll i=1 ; i*i<=n ; ++i) { if(n%i == 0) { ret.push_back(i); if(i!=1 && i*i!=n) { ret.push_back(n/i); } } } return ret; } const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int main(void){ ll N,K; cin >> N >> K; ll count = 0; ll ans = 0; rep(i,n){ ll a,b; cin >> a >> b; count += b; if(count >= K){ ans = a; break; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:193:11: error: 'n' was not declared in this scope 193 | rep(i,n){ | ^ a.cc:4:39: note: in definition of macro 'rep' 4 | #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) | ^
s093624642
p03721
C++
#include <iostream> #include <math.h> #include <algorithm> #include <string> #include <string.h> #include <queue> #include <vector> #include <set> using namespace std; long long int main() { long long int N,ans=0,K; cin >> N >> K; vector<pair<long long int, long long int>>A(N); for (long long int i = 0; i < N; i++) { cin >> A[i].first >> A[i].second; } sort(A.begin(), A.end()); for (long long int i = 0; i < N; i++) { ans += A[i].second; if (ans >= K) { ans = i; break; } } cout << A[ans].first; }
a.cc:10:11: error: '::main' must return 'int' 10 | long long int main() { | ^~~
s225699309
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,K; cin >> N >> K; int bsum=0; int a=0; for(int i=0;bsum<K;i++){ cin >> a >> b; bsum+=b; } cout << a << endl; }
a.cc: In function 'int main()': a.cc:10:17: error: 'b' was not declared in this scope 10 | cin >> a >> b; | ^
s079021614
p03721
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <map> #include <unordered_map> #include <set> #include <queue> using namespace std; #define ALL(x) (x).begin(),(x).end() #define SZ(x) int((x).size()) #define OUT(x) cout << (x) << endl typedef long long ll; typedef vector<int> V; typedef vector<vector<int>> VV; typedef pair<int, int> P; typedef map<string, int> M; typedef unordered_map<int, int> HM; typedef set<int> S; typedef queue<int> Q; int main(){ ll n,k; cin>>n>>k; vector<ll>> dic(100010,0); for(int i=0; i<n; i++){ int a,b; cin>>a>>b; dic[a] += b; } ll i=0, acu=0; while(acu < k){ acu += dic[i]; i++; } OUT(i-1); }
a.cc: In function 'int main()': a.cc:27:14: error: expected unqualified-id before '>' token 27 | vector<ll>> dic(100010,0); | ^~ a.cc:30:9: error: 'dic' was not declared in this scope; did you mean 'div'? 30 | dic[a] += b; | ^~~ | div a.cc:34:16: error: 'dic' was not declared in this scope; did you mean 'div'? 34 | acu += dic[i]; | ^~~ | div
s445861452
p03721
C++
#include <bits/stdc++.h> #define ld long double #define ll long long int #define ull unsigned long long int using namespace std; ll main() { ll N, K; cin >> N >> K; vector<ll> a(N); vector<ll> b(N); for (ll i = 0; i < N; ++i) { cin >> a[i]; cin >> b[i]; } /** * メモリエラー; 最大要素数10^10 = 10000MB = 10 GB * sortの計算量はNlogN * */ // vector<ll> v; // for (ll i = 0; i < N; ++i) { // for (ll j = 0; j < b[i]; ++j) { // v.push_back(a[i]); // } // } // sort(v.begin(), v.end()); // cout << v[K - 1] << endl; /** * バケツソートを使う * 添字にai,連想配列のような感じ */ vector<ll> num(100010, 0); for (ll i = 0; i < N; ++i) { num[a[i]] += b[i]; } ll ans; ll current = 0; for (ll i = 0; i <= 100010; ++i) { // cout << i <<" : " <<num[i] <<" : "<< K <<endl; // if (num[i] == 0){ continue;} if (num[i] > 0) { K -= num[i]; } if (K <= 0) { // cout<<num[i]<<endl; ans = i; break; } // if (current + num[i] <K) { // current += num[i]; // } else if (current + num[i] >= K) { // ans = i; // //a[K - current + 1]; // break; // } } cout << ans << endl; }
a.cc:4:22: error: '::main' must return 'int' 4 | #define ll long long int | ^~~ a.cc:9:1: note: in expansion of macro 'll' 9 | ll main() { | ^~
s018073301
p03721
Java
import java.util.Scanner; public class C_61_BigArray { public static void main(String[] args) { final int MAX_NUM = 1000000; Scanner sc = new Scanner(System.in); int[] backet = new int[MAX_NUM + 1]; int cnt = 0; int numberOfIns = sc.nextInt(); int numberOfArrLength = sc.nextInt(); for (int i = 0; i < numberOfIns; i++) { int a = sc.nextInt(); int b = sc.nextInt(); backet[a] += b; } for (int i = 0; i <= MAX_NUM + 1; i++) { if (numberOfArrLength <= cnt + backet[i]) { System.out.println(i); break; } cnt += backet[i]; } } }
Main.java:3: error: class C_61_BigArray is public, should be declared in a file named C_61_BigArray.java public class C_61_BigArray { ^ 1 error
s922049123
p03721
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>n>>k; vector<int> c(100000); for(int i=0;i<n;i++){ int a,b; cin>>a>>b; c.at(a)+=b; } for(int i=0;i<100000;i++){ if(k>c.at(i)){ k-=c.at(i); continue; } else{ cout<<i<<endl; break; } }
a.cc: In function 'int main()': a.cc:21:2: error: expected '}' at end of input 21 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s139875457
p03721
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>n>>k; vector<int> c(100000); for(int i=0;i<n;i++){ int a,b; cin>>a>>b; c.at(a)+=b; } for(int i=0;i<100000;i++){ if(k>a.at(i)){ k-=a.at(i); continue; } else{ cout<<i<<endl; break; } }
a.cc: In function 'int main()': a.cc:13:10: error: 'a' was not declared in this scope 13 | if(k>a.at(i)){ | ^ a.cc:21:2: error: expected '}' at end of input 21 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s239344552
p03721
C++
#include <bits/stdc++.h> using namespace std; #define int long long const lint INF = 1E9; #define P pair<int, int> signed main() { int N, K; cin >> N >> K; vector<P> lis; for(int i = 0; i < N; ++i){ int a, b; cin >> a >> b; lis.push_back(make_pair(a, b)); } sort(lis.begin(), lis.end()); int pos = 0; while(K > 0){ if(lis[pos].second < K){ K -= lis[pos].second; pos++; } else { cout << lis[pos].first << endl; return 0; } } }
a.cc:6:7: error: 'lint' does not name a type; did you mean 'uint'? 6 | const lint INF = 1E9; | ^~~~ | uint
s045701227
p03721
C++
#include <iostream> using namespace std; int main() { int n, k; int a, b; cin >> n >> k; for (int i = 0; i < n; i++) { cin >> a >> b; k -= b; if (k <= 0) { cout << a << endl; return (0); } }
a.cc: In function 'int main()': a.cc:19:4: error: expected '}' at end of input 19 | } | ^ a.cc:6:1: note: to match this '{' 6 | { | ^
s163922349
p03721
C++
#include <iostream> #include <stdio.h> #include <string> #include <algorithm> #include <cmath> #include <vector> #include <functional> #include <cstdlib> using namespace std; #define REP(i,n); for(int i = 0;i < (int)(n);i++) int main() { int n,k,sum=0,ans; vector<int> a,b; cin >> n >> k; a.resize(n); b.resize(n); REP(i,n){ cin >> a[i] >> b[i]; } REP(i,n){ sum += b[i]; if(k <= sum){ ans = a[i] break; } } cout << ans; return(0); }
a.cc: In function 'int main()': a.cc:23:35: error: expected ';' before 'break' 23 | ans = a[i] | ^ | ; 24 | break; | ~~~~~
s898146955
p03721
C++
#include <iostream> #include <stdio.h> #include <string> #include <algorithm> #include <cmath> #include <vector> #include <functional> #include <cstdlib> using namespace std; #define REP(i,n); for(int i = 0;i < (int)(n);i++) int main() { int n,k,sum=0; vector<int> a,b; cin >> n >> k; a.resize(n); b.resize(n); REP(i,n){ cin >> a[i] >> b[i]; } REP(i,n){ sum += b[i]; if(k <= sum)break; } cout << a[i]; return(0); }
a.cc: In function 'int main()': a.cc:24:19: error: 'i' was not declared in this scope 24 | cout << a[i]; | ^
s215356075
p03721
C++
#include<bits/stdc++.h> using namespace std; int main(void){ int n, k;cin>>n>>k; queue<pair<int, int>> q; for(int i=0;i<n;i++){ int a, b;cin>>a>>b; q.push(make_pair(a, b)) } int sum=0; int ans; for(int i=0;i<n;i++){ pair<int, int> p=q.pop(); sum+=p.second if(sum>=k){ ans=p.first;break; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:9:28: error: expected ';' before '}' token 9 | q.push(make_pair(a, b)) | ^ | ; 10 | } | ~ a.cc:14:27: error: conversion from 'void' to non-scalar type 'std::pair<int, int>' requested 14 | pair<int, int> p=q.pop(); | ~~~~~^~ a.cc:15:18: error: expected ';' before 'if' 15 | sum+=p.second | ^ | ; 16 | if(sum>=k){ | ~~
s530071764
p03721
C++
#include<iostream> #include <vector> #include <algorithm> #include <string> #include <cmath> using namespace std; using ll=long long; #define REP(i, n) for(int i = 0; i < (int)n; ++i) #define REP1(i, n) for(int i = 1; i < (int)n; ++i) #define REPll1(i, n) for(ll i = 1; i*i < (int)n; ++i) char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; int cnt(ll n) { int c = 0; while (true) { if (n < 1)break; n = n / 10; c++; } return c; } const ll MAX1E5 = 100000; const ll MAX1E10 = 10000000000; const double mod = 1e9 + 7; int main() { ll N = 0, K = 0, answer = 0, sum1 = 0, sum2 = 0, tmp = 0; ll cnt1 = 0, cnt2 = 0, a = 0, b = 0; cin >> N >> K; ll A[MAX1eE5+1] = {}; REP(i, N) { cin >> a >> b; A[a] += b; } REP1(i, MAX1E5+1) { if (K <= A[i]) { cout << i << endl; return 0; } K -= A[i]; } }
a.cc: In function 'int main()': a.cc:33:10: error: 'MAX1eE5' was not declared in this scope; did you mean 'MAX1E5'? 33 | ll A[MAX1eE5+1] = {}; | ^~~~~~~ | MAX1E5 a.cc:36:9: error: 'A' was not declared in this scope 36 | A[a] += b; | ^ a.cc:40:18: error: 'A' was not declared in this scope 40 | if (K <= A[i]) { | ^ a.cc:44:14: error: 'A' was not declared in this scope 44 | K -= A[i]; | ^
s175157440
p03721
C++
#include<iostream> #include <vector> #include <algorithm> #include <string> #include <cmath> using namespace std; using ll=long long; #define REP(i, n) for(int i = 0; i < (int)n; ++i) #define REP1(i, n) for(int i = 1; i < (int)n; ++i) #define REPll1(i, n) for(ll i = 1; i*i < (int)n; ++i) char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; int cnt(ll n) { int c = 0; while (true) { if (n < 1)break; n = n / 10; c++; } return c; } const ll MAX1eE5 = 100000; const ll MAX1eE10 = 10000000000; const double mod = 1e9 + 7; int main() { ll N = 0, K = 0, answer = 0, sum1 = 0, sum2 = 0, tmp = 0; ll cnt1 = 0, cnt2 = 0, a = 0, b = 0; cin >> N >> K; ll A[MAX1eE5+1] = {}; REP(i, N) { cin >> a >> b; A[a] += b; } REP1(i, MAX1E5+1) { if (K <= A[i]) { cout << i << endl; return 0; } K -= A[i]; } }
a.cc: In function 'int main()': a.cc:38:13: error: 'MAX1E5' was not declared in this scope; did you mean 'MAX1eE5'? 38 | REP1(i, MAX1E5+1) { | ^~~~~~ a.cc:10:45: note: in definition of macro 'REP1' 10 | #define REP1(i, n) for(int i = 1; i < (int)n; ++i) | ^
s882359269
p03721
C++
#include<iostream> #include <vector> #include <algorithm> #include <string> #include <cmath> using namespace std; using ll=long long; #define REP(i, n) for(int i = 0; i < (int)n; ++i) #define REP1(i, n) for(int i = 1; i < (int)n; ++i) #define REPll1(i, n) for(ll i = 1; i*i < (int)n; ++i) char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; int cnt(ll n) { int c = 0; while (true) { if (n < 1)break; n = n / 10; c++; } return c; } const ll MAX1eE5 = 100000; const ll MAX1eE10 = 10000000000; const double mod = 1e9 + 7; int main() { ll N = 0, K = 0, answer = 0, sum1 = 0, sum2 = 0, tmp = 0; ll cnt1 = 0, cnt2 = 0, a = 0, b = 0; cin >> N >> K; ll A[MAX1eE5+1] = {}; REP(i, N) { cin >> a >> b; A[a] += b; } REP1(i, N+1) { if (K < A[i) { cout << i << endl; return 0; } K -= A[i]; } }
a.cc: In function 'int main()': a.cc:40:20: error: expected ']' before ')' token 40 | if (K < A[i) { | ^ | ]
s896875829
p03721
C++
#include <iostream> using namespace std; struct ab{ int a; int b; }; int cmp(const void *a, const void*b) { return ((ab*)a)->a - ((ab*)b)->a; } int main(void){ ab ab[100000]; ll N,K; cin >> N >> K; int i; for(i=0;i<N;i++){ cin >> ab[i].a >> ab[i].b; } qsort(ab,N,sizeof(struct ab),cmp); ll count = 0; for(i=0;i<N;i++){ count += ab[i].b; if(count >=K){ cout << ab[i].a << endl; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'll' was not declared in this scope 15 | ll N,K; | ^~ a.cc:16:16: error: 'N' was not declared in this scope 16 | cin >> N >> K; | ^ a.cc:16:21: error: 'K' was not declared in this scope 16 | cin >> N >> K; | ^ a.cc:22:11: error: expected ';' before 'count' 22 | ll count = 0; | ^~~~~~ | ; a.cc:24:17: error: 'count' was not declared in this scope 24 | count += ab[i].b; | ^~~~~
s665867229
p03721
C++
#include <iostream> #include <cstdio> #include <queue> #include <vector> #include <stack> #include <string> #include <tuple> #include <random> #include <map> #include <set> #include <complex> #include <algorithm> #include <cassert> #include <iterator> #include <numeric> #include <cmath> #include <stdio.h> #include <functional> #define REP(i,a) for(int (i)=0;(i)<(a);i++) #define RREP(i,a,b) for(int (i)=(a);(i)<(b);i++) #define all(c) (c).begin(),(c).end() #define sz(v) (int)(v).size() #define vi vector<int> typedef long long ll; using namespace std; int main(void){ ll N,K; cin>>N>>K; int a,b; int kosuu[200000]={}; REP(i,N){ cin>>a>>b; kosuu[a]+=b; } ll tmp=0; RREP(ans,1,100001){ if(K<=kosuu[ans]){ cout<<ans<<endl; break; } K-=kosuu[ans]: } return 0; }
a.cc: In function 'int main()': a.cc:43:22: error: expected ';' before ':' token 43 | K-=kosuu[ans]: | ^ | ;
s531316701
p03721
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <limits.h> #define REP(i,n) for(i=0;i<n;i++) int iin() { int i; scanf("%d", &i); return i; } long long llin() { long long i; scanf("%lld", &i); return i; } double din() { double i; scanf("%lf", &i); return i; } char cin() { char c; scanf("%c", &c); return c; } void stin(char *s) { scanf("%s", s); } void iout(int i) { printf("%d\n", i); } void llout(long long i) { printf("%lld\n", i); } void dout(double i) { printf("%lf\n", i); } void cout(char c) { printf("%c\n", c); } void stout(char *s) { printf("%s\n", s); } int dfs(int v, int n, int *visited, int table[n][n]) { int all_visited = 1, i; REP(i,n) { if (!visited[i]) { all_visited = 0; break; } } if (all_visited) { return 1; } int count = 0; REP(i,n) { if (!table[v][i]) continue; if (visited[i]) continue; visited[i] = 1; count += dfs(i, n, visited, table); visited[i] = 0; } return count; } int main() { int n = iin(), k = iin(), i, a, b; long long c[ONT_MAX]; memset(c, 0, sizeof c); REP(i, n) { a = iin(), b = iin(); c[a] += b; } long long count = 0; i = 0; while(count < k) { i++; count += c[i]; } iout(i); return 0; }
main.c: In function 'main': main.c:87:17: error: 'ONT_MAX' undeclared (first use in this function); did you mean 'INT_MAX'? 87 | long long c[ONT_MAX]; | ^~~~~~~ | INT_MAX main.c:87:17: note: each undeclared identifier is reported only once for each function it appears in
s578112424
p03721
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; ll main(){ ll n,x,ans=0; cin >> n >> x; vector<pair<ll,ll>> v(n);//どの数字が何個か vector<ll> sum(n+1);//累積和 sum.at(0)=0; for(ll i=0;i < n;i++){ cin >> v.at(i).first >> v.at(i).second; } sort(v.begin(),v.end());//数字を昇順にソートして for(ll j=0;j < n;j++){ sum.at(j+1) += sum.at(j)+v.at(j).second; }//個数の累積和を取る→何個目かで求める数が定まる for(ll k=0;k < n;k++){ if(sum.at(k) < x && x <= sum.at(k+1)){ ans = v.at(k).first; break; } }//このforに問題がある(K=nで問題あり?) cout << ans << endl; }
a.cc:4:1: error: '::main' must return 'int' 4 | ll main(){ | ^~
s239440025
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> p; int main() { ll n,k,cnt=0; cin >> n >> k; int ans=0; vector<p> v(n); for(int i=0; i<n; i++) { int a,b; cin >> a >> b; v[i].first=a; v[i].second=b; } sort(v.begin(),v.end()); for(int i=0; i<n; i++) { cnt+=b; if(cnt>=k) { ans=a; break; } } }
a.cc: In function 'int main()': a.cc:18:10: error: 'b' was not declared in this scope 18 | cnt+=b; | ^ a.cc:20:11: error: 'a' was not declared in this scope 20 | ans=a; | ^
s701608761
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair(int,int) P; int main() { ll n,k,cnt=0; cin >> n >> k; int ans=0; vector<P> A(n); for(int i=0; i<n; i++) { int a,b; cin >> a >> b; A[i].first=a; A[i].second=b; } sort(v.begin(),v.end()); for(int i=0; i<n; i++) { cnt+=b; if(cnt>=k) { ans=a; break; } } }
a.cc:4:14: error: expected unqualified-id before 'int' 4 | typedef pair(int,int) P; | ^~~ a.cc:4:14: error: expected ')' before 'int' 4 | typedef pair(int,int) P; | ~^~~ | ) a.cc: In function 'int main()': a.cc:9:10: error: 'P' was not declared in this scope 9 | vector<P> A(n); | ^ a.cc:9:11: error: template argument 1 is invalid 9 | vector<P> A(n); | ^ a.cc:9:11: error: template argument 2 is invalid a.cc:13:6: error: invalid types 'int[int]' for array subscript 13 | A[i].first=a; | ^ a.cc:14:6: error: invalid types 'int[int]' for array subscript 14 | A[i].second=b; | ^ a.cc:16:8: error: 'v' was not declared in this scope 16 | sort(v.begin(),v.end()); | ^ a.cc:18:10: error: 'b' was not declared in this scope 18 | cnt+=b; | ^ a.cc:20:11: error: 'a' was not declared in this scope 20 | ans=a; | ^
s702608178
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair(int,int) P; int main() { ll n,k,cnt=0; int ans=0; cin >> k >> n; vector<P> A(n); for(int i=0; i<n; i++) { int a,b; cin >> a >> b; A[i].first=a; A[i].second=b; } sort(v.begin(),v.end()); for(int i=0; i<n; i++) { cnt+=b; if(cnt>=k) { ans=a; break; } } }
a.cc:4:14: error: expected unqualified-id before 'int' 4 | typedef pair(int,int) P; | ^~~ a.cc:4:14: error: expected ')' before 'int' 4 | typedef pair(int,int) P; | ~^~~ | ) a.cc: In function 'int main()': a.cc:10:10: error: 'P' was not declared in this scope 10 | vector<P> A(n); | ^ a.cc:10:11: error: template argument 1 is invalid 10 | vector<P> A(n); | ^ a.cc:10:11: error: template argument 2 is invalid a.cc:14:6: error: invalid types 'int[int]' for array subscript 14 | A[i].first=a; | ^ a.cc:15:6: error: invalid types 'int[int]' for array subscript 15 | A[i].second=b; | ^ a.cc:17:8: error: 'v' was not declared in this scope 17 | sort(v.begin(),v.end()); | ^ a.cc:19:10: error: 'b' was not declared in this scope 19 | cnt+=b; | ^ a.cc:21:11: error: 'a' was not declared in this scope 21 | ans=a; | ^
s865018423
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair(int,int) P; int main() { ll k,cnt=0; int n,ans=0; cin >> k >> n; vector<P> v(n); for(int i=0; i<n; i++) { int a,b; cin >> a >> b; v[i].first=a; v[i].second=b; } sort(v.begin(),v.end()); for(int i=0; i<n; i++) { cnt+=b; if(cnt>=k) { ans=a; break; } } }
a.cc:4:14: error: expected unqualified-id before 'int' 4 | typedef pair(int,int) P; | ^~~ a.cc:4:14: error: expected ')' before 'int' 4 | typedef pair(int,int) P; | ~^~~ | ) a.cc: In function 'int main()': a.cc:10:10: error: 'P' was not declared in this scope 10 | vector<P> v(n); | ^ a.cc:10:11: error: template argument 1 is invalid 10 | vector<P> v(n); | ^ a.cc:10:11: error: template argument 2 is invalid a.cc:14:6: error: invalid types 'int[int]' for array subscript 14 | v[i].first=a; | ^ a.cc:15:6: error: invalid types 'int[int]' for array subscript 15 | v[i].second=b; | ^ a.cc:17:10: error: request for member 'begin' in 'v', which is of non-class type 'int' 17 | sort(v.begin(),v.end()); | ^~~~~ a.cc:17:20: error: request for member 'end' in 'v', which is of non-class type 'int' 17 | sort(v.begin(),v.end()); | ^~~ a.cc:19:10: error: 'b' was not declared in this scope 19 | cnt+=b; | ^ a.cc:21:11: error: 'a' was not declared in this scope 21 | ans=a; | ^
s818703717
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair(int,int) P; int main() { ll k,cnt=0; int n,a,b,ans=0; cin >> k >> n; vector<P> v(n); for(int i=0; i<n; i++) { cin >> a >> b; v[i].first=a; v[i].second=b; } sort(v.begin(),v.end()); for(int i=0; i<n; i++) { cnt+=b; if(cnt>=k) { ans=a; break; } } }
a.cc:4:14: error: expected unqualified-id before 'int' 4 | typedef pair(int,int) P; | ^~~ a.cc:4:14: error: expected ')' before 'int' 4 | typedef pair(int,int) P; | ~^~~ | ) a.cc: In function 'int main()': a.cc:10:10: error: 'P' was not declared in this scope 10 | vector<P> v(n); | ^ a.cc:10:11: error: template argument 1 is invalid 10 | vector<P> v(n); | ^ a.cc:10:11: error: template argument 2 is invalid a.cc:13:6: error: invalid types 'int[int]' for array subscript 13 | v[i].first=a; | ^ a.cc:14:6: error: invalid types 'int[int]' for array subscript 14 | v[i].second=b; | ^ a.cc:16:10: error: request for member 'begin' in 'v', which is of non-class type 'int' 16 | sort(v.begin(),v.end()); | ^~~~~ a.cc:16:20: error: request for member 'end' in 'v', which is of non-class type 'int' 16 | sort(v.begin(),v.end()); | ^~~
s076863120
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair(int,int) p; int main() { ll k,cnt=0; int n,a,b,ans=0; cin >> k >> n; vector<p> v(n); for(int i=0; i<n; i++) { cin >> a >> b; v[i].first=a; v[i].second=b; } sort(v.begin(),v.end()); for(int i=0; i<n; i++) { cnt+=b; if(cnt>=k) { ans=a; break; } } } }
a.cc:4:14: error: expected unqualified-id before 'int' 4 | typedef pair(int,int) p; | ^~~ a.cc:4:14: error: expected ')' before 'int' 4 | typedef pair(int,int) p; | ~^~~ | ) a.cc: In function 'int main()': a.cc:10:10: error: 'p' was not declared in this scope 10 | vector<p> v(n); | ^ a.cc:10:11: error: template argument 1 is invalid 10 | vector<p> v(n); | ^ a.cc:10:11: error: template argument 2 is invalid a.cc:13:6: error: invalid types 'int[int]' for array subscript 13 | v[i].first=a; | ^ a.cc:14:6: error: invalid types 'int[int]' for array subscript 14 | v[i].second=b; | ^ a.cc:16:10: error: request for member 'begin' in 'v', which is of non-class type 'int' 16 | sort(v.begin(),v.end()); | ^~~~~ a.cc:16:20: error: request for member 'end' in 'v', which is of non-class type 'int' 16 | sort(v.begin(),v.end()); | ^~~ a.cc: At global scope: a.cc:25:1: error: expected declaration before '}' token 25 | } | ^
s525771829
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair(int,int) p; int main() { ll k,cnt=0; int n,a,b,ans=0; cin >> k >> n; vector<p> v(n); for(int i=0; i<n; i++) { cin >> a >> b; v[i].first=a; v[i].second=b; } sort(v.begin(),v.end()); for(int i=0; i<n; i++) { cnt+=b; if(cnt>=k) { ans=a; return 0; } } } }
a.cc:4:14: error: expected unqualified-id before 'int' 4 | typedef pair(int,int) p; | ^~~ a.cc:4:14: error: expected ')' before 'int' 4 | typedef pair(int,int) p; | ~^~~ | ) a.cc: In function 'int main()': a.cc:10:10: error: 'p' was not declared in this scope 10 | vector<p> v(n); | ^ a.cc:10:11: error: template argument 1 is invalid 10 | vector<p> v(n); | ^ a.cc:10:11: error: template argument 2 is invalid a.cc:13:6: error: invalid types 'int[int]' for array subscript 13 | v[i].first=a; | ^ a.cc:14:6: error: invalid types 'int[int]' for array subscript 14 | v[i].second=b; | ^ a.cc:16:10: error: request for member 'begin' in 'v', which is of non-class type 'int' 16 | sort(v.begin(),v.end()); | ^~~~~ a.cc:16:20: error: request for member 'end' in 'v', which is of non-class type 'int' 16 | sort(v.begin(),v.end()); | ^~~ a.cc: At global scope: a.cc:25:1: error: expected declaration before '}' token 25 | } | ^
s484558837
p03721
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <time.h> #define _CRT_SECURE_NO_WARNINGS #define TLong long long typedef struct { int a; // num int b; // count } elm; int comp(const void *p,const void *q){ return ((elm *)p)->a - ((elm *)q)->a; } int main(int argc, char const *argv[]){ TLong n,k,i,j = 0; scanf("%lld%lld",&n,&k); elm element[100007]; for(i = 0; i < n; ++i) scanf("%lld%lld", &elm[i].a, &elm[i].b); qsort(element,n,sizeof(elm),comp); for(i = 0; (i < n && j < k); ++i) j += elm[i].b; printf("%lld\n", elm[i].a); return 0; }
main.c: In function 'main': main.c:23:52: error: expected expression before 'elm' 23 | for(i = 0; i < n; ++i) scanf("%lld%lld", &elm[i].a, &elm[i].b); | ^~~ main.c:25:46: error: expected expression before 'elm' 25 | for(i = 0; (i < n && j < k); ++i) j += elm[i].b; | ^~~ main.c:26:20: error: expected expression before 'elm' 26 | printf("%lld\n", elm[i].a); | ^~~
s615505371
p03721
C++
#ABC061C N,K=map(int,input().split()) A={} for n in range(N): a,b=map(int,input().split()) A[a]=A.get(a,0)+b for key in sorted(list(A.keys())): K-=A[key] if K<=0: print(key) break
a.cc:1:2: error: invalid preprocessing directive #ABC061C 1 | #ABC061C | ^~~~~~~ a.cc:2:1: error: 'N' does not name a type 2 | N,K=map(int,input().split()) | ^ a.cc:4:1: error: expected unqualified-id before 'for' 4 | for n in range(N): | ^~~
s408879370
p03721
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long n,k; cin>>n>>k; int a[n],b[n]; vector<pair<int,int>> v; for(int i=0;i<n;i++){ cin>>a[i]>>b[i]; v.push_back(make_pair(a[i],b[i])); } sort(v.begin(),v.end()); long long cnt=0; for(auto i:v){ cnt+=i.second(); if(cnt>=k){ cout<<i.first<<endl; return 0; } } }
a.cc: In function 'int main()': a.cc:16:22: error: expression cannot be used as a function 16 | cnt+=i.second(); | ~~~~~~~~^~
s114422548
p03721
C++
#include <iostream> #include <vector> using namespace std; int main(){ int n; long long int k,count=0; cin >> n >> k; vector<int> a(n),b(n) vector<long long int> c(100001,0); for(int i=0;i<n;i++)cin >> a.at(i) >> b.at(i); for(int i=0;i<n;i++)c.at(a.at(i))+=b.at(i); for(int i=1;i<100001;i++){ count += c.at(i); if(count >= k){ cout << i << endl; break; } } }
a.cc: In function 'int main()': a.cc:10:3: error: expected ',' or ';' before 'vector' 10 | vector<long long int> c(100001,0); | ^~~~~~ a.cc:12:23: error: 'c' was not declared in this scope 12 | for(int i=0;i<n;i++)c.at(a.at(i))+=b.at(i); | ^ a.cc:14:14: error: 'c' was not declared in this scope 14 | count += c.at(i); | ^
s665357856
p03721
C++
#include <iostream> #include <vector> using namespace std; int main(){ int n; long long int k,count=0; cin >> n >> k; vector<int> a(n),b(n) vector<long long int>c(100001,0); for(int i=0;i<n;i++)cin >> a.at(i) >> b.at(i); for(int i=0;i<n;i++)c.at(a.at(i))+=b.at(i); for(int i=1;i<100001;i++){ count += c.at(i); if(count >= k){ cout << i << endl; break; } } }
a.cc: In function 'int main()': a.cc:10:3: error: expected ',' or ';' before 'vector' 10 | vector<long long int>c(100001,0); | ^~~~~~ a.cc:12:23: error: 'c' was not declared in this scope 12 | for(int i=0;i<n;i++)c.at(a.at(i))+=b.at(i); | ^ a.cc:14:14: error: 'c' was not declared in this scope 14 | count += c.at(i); | ^
s718207305
p03721
C++
#include<bits/stdc++.h> #include<iostream> using namespace std; int main(){ int N,K; cin >> N >> K; for(int i=0;i<N,i++){ int A,B; cin >> A >> B; K -= B; if(K<=0){ cout << A << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:8:22: error: expected ';' before ')' token 8 | for(int i=0;i<N,i++){ | ^ | ;
s599428391
p03721
C++
#include <bits/stdc++.h> using namespace std; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } typedef long long int ll; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) #define MOD (1000000007) int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; // 移動方向 int n,k; vector<pair<int, int>> ab; void input(){ cin >> n >> k; for(int i=0;i<n;++i){ int x, y; cin >> x >> y; ab.push_back(make_pair(x, y)); } ab.push_back(INF); } int main() { cin.tie(0); ios::sync_with_stdio(false); input(); sort(ab.begin(), ab.end()); int index = 0; while(k > 0){ //cout << ab[index].second << endl; k -= ab[index].second; index++; } cout << ab[index-1].first << endl; return 0; }
a.cc: In function 'void input()': a.cc:24:15: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(double)' 24 | ab.push_back(INF); | ~~~~~~~~~~~~^~~~~ 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 = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, 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 'double' to 'const std::vector<std::pair<int, int> >::value_type&' {aka 'const std::pair<int, 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 = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, 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 'double' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~
s180280942
p03721
C++
#include <bits/stdc++.h> using namespace std; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } typedef long long int ll; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) #define MOD (1000000007) int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; // 移動方向 int n,k; vector<pair<int, int>> ab; void input(){ cin >> n >> k; for(int i=0;i<n;++i){ int x, y; cin >> x >> y; ab.push_back(make_pair(x, y)); } int main() { cin.tie(0); ios::sync_with_stdio(false); input(); sort(ab.begin(), ab.end(), [](const auto& a, const auto& b){return a.first > b.first;}); int index = 0; while(k > 0){ k -= ab[index].second; index++; } cout << ab[index].first << endl; return 0; }
a.cc: In function 'void input()': a.cc:25:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 25 | int main() | ^~ a.cc:25:9: note: remove parentheses to default-initialize a variable 25 | int main() | ^~ | -- a.cc:25:9: note: or replace parentheses with braces to value-initialize a variable a.cc:26:1: error: a function-definition is not allowed here before '{' token 26 | { | ^ a.cc:38:2: error: expected '}' at end of input 38 | } | ^ a.cc:17:13: note: to match this '{' 17 | void input(){ | ^
s088872155
p03721
C++
#include <iostream> #include <iostream> #include <vector> #include <queue> #include <utility> #include <algorithm> using namespace std; #define Pair pair<int, int> int N, K; int a[100000]; int b[100000]; vector<Pair> ab; bool compare(Pair x, Pair y){ return x.first < y.first; } int solve(){ int count=0; int ans; sort(ab.begin(), ab.end(), compare); int i=0; while(count < K){ ans = ab[i].first; count += ab[i].second; i++; } cout << ans << endl; return 0; } int main(){ cin >> N >> K; ab.resize(N); for(int i=0; i<N; i++){ cin >> a[i] >> b[i]; ab.puch_back({a[i], b[i]}); } solve(); return 0; }
a.cc: In function 'int main()': a.cc:40:20: error: 'class std::vector<std::pair<int, int> >' has no member named 'puch_back'; did you mean 'push_back'? 40 | ab.puch_back({a[i], b[i]}); | ^~~~~~~~~ | push_back
s115700353
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pll; #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i)) #define REP(i, n) FOR(i, n, 0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll)1e15; pll T[100005]; int main() { int N; ll K; cin >> N >> K; REP(i, N) { cin >> T[i].first >> T[i].second; } sort(T, T + N, [](pll a, pll b) { return a.first < b.first }); REP(i, N) { K -= T[i].second; if (K <= 0) { cout << T[i].first << endl; break; } } return 0; }
a.cc: In lambda function: a.cc:25:63: error: expected ';' before '}' token 25 | sort(T, T + N, [](pll a, pll b) { return a.first < b.first }); | ^~ | ;
s089022836
p03721
C++
#include <bits/stdc++.h> using namespace std; int n; ll k; vector<pair<int, int>> x; void solve() { int i = 0; sort(x.begin(), x.end()); while (k > 0) { k -= x[i].second; if (k > 0) { i++; } } cout << x[i].first << "\n"; } int main() { int i; cin >> n >> k; x.resize(n); for (i = 0; i < n; i++) { cin >> x[i].first >> x[i].second; } solve(); return 0; }
a.cc:5:1: error: 'll' does not name a type 5 | ll k; | ^~ a.cc: In function 'void solve()': a.cc:13:10: error: 'k' was not declared in this scope 13 | while (k > 0) { | ^ a.cc: In function 'int main()': a.cc:26:15: error: 'k' was not declared in this scope 26 | cin >> n >> k; | ^
s733491840
p03721
C
N,K = map(int,raw_input().split()) data = [map(int,raw_input().split()) for i in range(N)] data.sort() cnt = 0 for i in data: cnt += i[1] if cnt >= K: print i[0] break
main.c:1:1: warning: data definition has no type or storage class 1 | N,K = map(int,raw_input().split()) | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int] main.c:1:3: error: type defaults to 'int' in declaration of 'K' [-Wimplicit-int] 1 | N,K = map(int,raw_input().split()) | ^ main.c:1:7: error: implicit declaration of function 'map' [-Wimplicit-function-declaration] 1 | N,K = map(int,raw_input().split()) | ^~~ main.c:1:11: error: expected expression before 'int' 1 | N,K = map(int,raw_input().split()) | ^~~ main.c:3:1: error: expected ',' or ';' before 'data' 3 | data = [map(int,raw_input().split()) for i in range(N)] | ^~~~
s932204360
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll arr[100005]; int main() { ll n,k; cin>>n>>k; for(int i=0;i<n;i++){ int a,b; cin>>a>>b; arr[a]+=b; } for(ill i=1;i<=100000;i++){ k-=arr[i]; if(k<=0){ cout<<i; return 0; } } }
a.cc: In function 'int main()': a.cc:16:9: error: 'ill' was not declared in this scope; did you mean 'll'? 16 | for(ill i=1;i<=100000;i++){ | ^~~ | ll a.cc:16:17: error: 'i' was not declared in this scope 16 | for(ill i=1;i<=100000;i++){ | ^
s215675457
p03721
C++
#include<iostream> #include<vector> using namespace std; int main(){ long long n, k, a, b; cin >> n >> k; vector<long long> v; for(long long i = 0 ; i < n; i++){ cin >> a >> b; vector<long long> c(b, a); v.insert(v.end(), c.begin(), c.end()); } sort(v.begin(), v.end()); cout << v[k-1] << endl; }
a.cc: In function 'int main()': a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(v.begin(), v.end()); | ^~~~ | short
s993924788
p03721
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define MM = 1000000000; #define mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 100005 #define NIL -1 #define rep(i, n) for(int i = 0; i < n; i++) int dx[4] = {0, 1, 0, -1}; int dy[4] = {1, 0, -1, 0}; int main(){ ll n, k; cin >> n >> k; ll a[n], b[n]; sum = 0; ll ans = 0; rep(i, n){ cin >> a[i] >> b[i]; sum += b[i]; if(sum >= k){ ans = a[i]; break; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:16:5: error: 'sum' was not declared in this scope 16 | sum = 0; | ^~~
s976575571
p03721
C++
#include <iostream> #include <vector> using namespace std; typedef long long ll; #define INF (1e9) int main(int argc, const char *argv[]) { ll N, K, a, b; cin >> N >> K; vector<pair<ll, ll> > v; for (ll i = 0; i < N; i++) { cin >> a >> b; v.push_back(pair<ll, ll>(a, b)); } sort(v.begin(), v.end()); for (ll i = 0; i < v.size(); i++) { K -= v[i].second; if (K <= 0) { cout << v[i].first << endl; break; } } return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:21:5: error: 'sort' was not declared in this scope; did you mean 'short'? 21 | sort(v.begin(), v.end()); | ^~~~ | short
s134667711
p03721
C++
using namespace std; #include<bits/stdc++.h> #define BEGIN ios_base::sync_with_stdio(0);cin.tie(0) #define END return EXIT_SUCCESS #define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++) #define REP(I,N) FOR(I,0,N) #define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++) #define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--) #define IN(P) cin>>(P) #define IN2(P1,P2) cin>>(P1)>>(P2) #define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3) #define INS(I,N,V) REP(I,N) cin>>V[I] #define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I]; #define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I]; #define OUT(P) cout<<P<<endl #define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl #define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl #define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl #define ALL(C) (C).begin(),(C).end() #define RALL(C) (C).rbegin(),(C).rend() #define mp make_pair #define pb push_back typedef unsigned long ul; typedef unsigned int ui; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } int N,K,i,j,a,b,cnt; map<int,int> v; vector<pair<int,int> > vv; inline void solve(){ IN2(N,K); REP(i,N){ IN2(a,b); v[a]+=b; } for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ vv.pb(mp(it->first,it->second)); } sort(ALL(vv)); REP(i,N){ cnt+=vv[i].second; if(K<cnt){ OUT(vv[i].first); return; } } } int main(int argc,char**argv){ BEGIN; solve(); END; }
a.cc: In function 'void solve()': a.cc:38:41: error: conversion from '_Rb_tree_iterator<pair<[...],int>>' to non-scalar type '_Rb_tree_iterator<pair<[...],long int>>' requested 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ~~~~~~~^~ a.cc:38:46: error: no match for 'operator!=' (operand types are 'std::map<int, long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long int>, std::_Select1st<std::pair<const int, long int> >, std::less<int>, std::allocator<std::pair<const int, long int> > >::iterator'} and 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'}) 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ~~^~~~~~~~~ | | | | | _Rb_tree_iterator<pair<[...],int>> | _Rb_tree_iterator<pair<[...],long int>> In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:2: /usr/include/c++/14/bits/regex.h:1132:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1132 | operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1132:5: note: template argument deduction/substitution failed: a.cc:38:54: note: 'std::map<int, long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long int>, std::_Select1st<std::pair<const int, long int> >, std::less<int>, std::allocator<std::pair<const int, long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ^ /usr/include/c++/14/bits/regex.h:1212:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator!=(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1212 | operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1212:5: note: template argument deduction/substitution failed: a.cc:38:54: note: 'std::map<int, long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long int>, std::_Select1st<std::pair<const int, long int> >, std::less<int>, std::allocator<std::pair<const int, long int> > >::iterator'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ^ /usr/include/c++/14/bits/regex.h:1305:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1305 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1305:5: note: template argument deduction/substitution failed: a.cc:38:54: note: 'std::map<int, long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long int>, std::_Select1st<std::pair<const int, long int> >, std::less<int>, std::allocator<std::pair<const int, long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ^ /usr/include/c++/14/bits/regex.h:1379:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1379 | operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1379:5: note: template argument deduction/substitution failed: a.cc:38:54: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ^ /usr/include/c++/14/bits/regex.h:1473:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1473 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1473:5: note: template argument deduction/substitution failed: a.cc:38:54: note: 'std::map<int, long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long int>, std::_Select1st<std::pair<const int, long int> >, std::less<int>, std::allocator<std::pair<const int, long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ^ /usr/include/c++/14/bits/regex.h:1547:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1547 | operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1547:5: note: template argument deduction/substitution failed: a.cc:38:54: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ^ /usr/include/c++/14/bits/regex.h:1647:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1647 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1647:5: note: template argument deduction/substitution failed: a.cc:38:54: note: 'std::map<int, long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long int>, std::_Select1st<std::pair<const int, long int> >, std::less<int>, std::allocator<std::pair<const int, long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ^ /usr/include/c++/14/bits/regex.h:2213:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator!=(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2213 | operator!=(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2213:5: note: template argument deduction/substitution failed: a.cc:38:54: note: 'std::map<int, long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long int>, std::_Select1st<std::pair<const int, long int> >, std::less<int>, std::allocator<std::pair<const int, long int> > >::iterator'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:38:54: note: 'std::map<int, long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long int>, std::_Select1st<std::pair<const int, long int> >, std::less<int>, std::allocator<std::pair<const int, long int> > >::iterator'} is not derived from 'const std::pair<_T1, _T2>' 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:38:54: note: 'std::map<int, long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long int>, std::_Select1st<std::pair<const int, long int> >, std::less<int>, std::allocator<std::pair<const int, long int> > >::iterator'} is not derived from 'const std::reverse_iterator<_Iterator>' 38 | for(map<int,long>::iterator it=v.begin();it!=v.end();it++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/subs
s876134370
p03721
Java
import java.io.*; import java.util.*; public class Main { private static class Tuple { public final int a; public final long b; public Tuple(int a, long b) { this.a = a; this.b = b; } } public static void main(String[] args) throws Throwable { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); long K = scanner.nextLong(); Tuple[] ab = new Tuple[N]; for (int i = 0; i < N; i++) { int a = scanner.nextInt(); int b = scanner.nextLong(); ab[i] = new Tuple(a, b); } Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a)); int lastA = -1; long k = 0; for (int i = 0; k < K && i < N; i++) { k += ab[i].b; lastA = ab[i].a; } System.out.println(lastA); } }
Main.java:21: error: incompatible types: possible lossy conversion from long to int int b = scanner.nextLong(); ^ 1 error
s328845839
p03721
Java
import java.io.*; import java.util.*; public class Main { private static class Tuple { public final int a; public final long b; public Tuple(int a, long b) { this.a = a; this.b = b; } } public static void main(String[] args) throws Throwable { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); long K = scanner.nextLong(); Tuple[] ab = new Tuple[N]; for (int i = 0; i < N; i++) { int a = scanner.nextInt(); int b = scanner.nextLong(); ab[i] = new Tuple(a, b); } Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a)); Integer lastA = null; long k = 0; for (int i = 0; k < K && i < N; i++) { k += ab[i].b; lastA = ab[i].a; } System.out.println(lastA); } }
Main.java:21: error: incompatible types: possible lossy conversion from long to int int b = scanner.nextLong(); ^ 1 error
s654517029
p03721
Java
import java.io.*; import java.util.*; public class Main { private static class Tuple { public final int a; public final long b; public Tuple(int a, long b) { this.a = a; this.b = b; } } public static void main(String[] args) throws Throwable { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); long K = scanner.nextLong(); Tuple[] ab = new Tuple[N]; for (int i = 0; i < N; i++) { long a = scanner.nextLong(); long b = scanner.nextLong(); ab[i] = new Tuple(a, b); } if (true) return; Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a)); Integer lastA = null; long k = 0; for (int i = 0; k < K && i < N; i++) { k += ab[i].b; lastA = ab[i].a; } System.out.println(lastA); } }
Main.java:22: error: incompatible types: possible lossy conversion from long to int ab[i] = new Tuple(a, b); ^ Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
s831456795
p03721
Java
import java.io.*; import java.util.*; public class Main { private static class Tuple { public final long a; public final long b; public Tuple(long a, long b) { this.a = a; this.b = b; } } public static void main(String[] args) throws Throwable { Scanner scanner = new Scanner(System.in); int N = scanner.nextLong(); long K = scanner.nextLong(); Tuple[] ab = new Tuple[N]; for (int i = 0; i < N; i++) { long a = scanner.nextLong(); long b = scanner.nextLong(); ab[i] = new Tuple(a, b); } if (true) return; Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a)); Integer lastA = null; long k = 0; for (int i = 0; k < K && i < N; i++) { k += ab[i].b; lastA = ab[i].a; } System.out.println(lastA); } }
Main.java:16: error: incompatible types: possible lossy conversion from long to int int N = scanner.nextLong(); ^ Main.java:25: error: incompatible types: possible lossy conversion from long to int Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a)); ^ Main.java:31: error: incompatible types: long cannot be converted to Integer lastA = ab[i].a; ^ Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 3 errors
s427907707
p03721
Java
import java.io.*; import java.util.*; public class Main { private static class Tuple { public final long a; public final long b; public Tuple(long a, long b) { this.a = a; this.b = b; } } public static void main(String[] args) throws Throwable { Scanner scanner = new Scanner(System.in); long N = scanner.nextLong(); long K = scanner.nextLong(); Tuple[] ab = new Tuple[N]; for (Long i = 0; i < N; i++) { long a = scanner.nextLong(); long b = scanner.nextLong(); ab[i] = new Tuple(a, b); } if (true) return; Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a)); Integer lastA = null; long k = 0; for (long i = 0; k < K && i < N; i++) { k += ab[i].b; lastA = ab[i].a; } System.out.println(lastA); } }
Main.java:18: error: incompatible types: possible lossy conversion from long to int Tuple[] ab = new Tuple[N]; ^ Main.java:19: error: incompatible types: int cannot be converted to Long for (Long i = 0; i < N; i++) { ^ Main.java:22: error: incompatible types: Long cannot be converted to int ab[i] = new Tuple(a, b); ^ Main.java:25: error: incompatible types: possible lossy conversion from long to int Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a)); ^ Main.java:30: error: incompatible types: possible lossy conversion from long to int k += ab[i].b; ^ Main.java:31: error: incompatible types: possible lossy conversion from long to int lastA = ab[i].a; ^ Main.java:31: error: incompatible types: long cannot be converted to Integer lastA = ab[i].a; ^ Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 7 errors
s209036417
p03721
Java
import java.io.*; import java.util.*; public class Main { private static class Tuple { public final int a; public final int b; public Tuple(int a, int b) { this.a = a; this.b = b; } } public static void main(String[] args) throws Throwable { return; Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int K = scanner.nextInt(); Tuple[] ab = new Tuple[N]; for (int i = 0; i < N; i++) { int a = scanner.nextInt(); int b = scanner.nextInt(); ab[i] = new Tuple(a, b); } Arrays.sort(ab, (x, y) -> Integer.compare(x.a, y.a)); Integer lastA = null; long k = 0; for (int i = 0; k < K && i < N; i++) { k += ab[i].b; lastA = ab[i].a; } System.out.println(lastA); } }
Main.java:16: error: unreachable statement Scanner scanner = new Scanner(System.in); ^ 1 error
s133326968
p03721
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; long long intk; cin >> n >> k; vector<long long int> num(100001,0); for(int i = 0;i < n;i++){ int a,b; cin >> a >> b; num[a] += b; } long int count = 0; for(int i = 1;i <= 100000;i++){ count += num[i]; if(count >= k){ cout << i << endl; break; } } }
a.cc: In function 'int main()': a.cc:6:15: error: 'k' was not declared in this scope 6 | cin >> n >> k; | ^
s099303841
p03721
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,k; cin >> n >> k; vector<int> num(100001,0); for(int i = 0;i < n;i++){ int a,b; cin >> a >> b; num[a] += b; } int count = 0; for(int i = 1;i < 100001;i++){ count += num[i]; if(count >= k){ cout << i << endl; break; } }
a.cc: In function 'int main()': a.cc:19:4: error: expected '}' at end of input 19 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s946783479
p03721
C++
#include<bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;++i) #define rrep(i,n) for(int i=n-1;i>=0;--i) #define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;} #define MAX_N 1002 #define i197 1000000007 using namespace std; typedef long long ll; typedef pair<ll,ll> P1; typedef pair<int,int> Pi; typedef pair<double,Pi> Pdi; typedef pair<ll,int>Pli; typedef pair<P1,ll> P2; const ll INF=1000000000000000001; struct edge{int to,cost;}; int dy[]={0, 0, 1, -1}; int dx[]={1, -1, 0, 0}; struct Road{double cost;int a,b;}; ll x[100001]={}; ll a[100001]; ll b[100001]; int main() { int n,k; int r=0; cin>>n>>k; rep(i,n){ cin>>a[i]>>b[i]; x[a[i]]+=b[i]; r=max(r,a[i]); } int total=0; rep(i,r+1){ total+=x[i]; if(total>=k){ cout<<i<<endl; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:35:22: error: no matching function for call to 'max(int&, ll&)' 35 | r=max(r,a[i]); | ~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:35:22: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 35 | r=max(r,a[i]); | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:35:22: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 35 | r=max(r,a[i]); | ~~~^~~~~~~~
s514172246
p03721
C
#define _USE_MATH_DEFINES #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <limits.h> #include <stdbool.h> #define inf (INT_MAX-1) #define INF 9223372036854775807; #define PI 3.14159265358979323846; #define EPS 1e-10 #define sq(n) ((n)*(n)) #define rep(i,n) for(i=0;i<n;i++) #define rev(i,n) for(i=n-1;i>=0;i--) /* #define sort(a,n) qsort(a,n,sizeof(TYPE),cmp) #define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r) */ #define chsort(s,n) qsort(s,n,sizeof(char),cmp) #define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r) #define TYPE long long #define ll long long #define MEMSET(a) memset(a,0,sizeof(a)) #define MEMSET_U(a) memset(a,-1,sizeof(a)) #define bool _Bool const int mod = (int)1e09 + 7; //#define DEBUG1 //#define DEBUG2 //#define DEBUGF #define DUMMY int in(void) { int i; scanf("%d", &i); return i; } long long llin(void) { long long i; scanf("%lld", &i); return i; } double din(void) { double i; scanf("%lf", &i); return i; } void chin(char s[]) { scanf("%s", s); } void print(int a) { printf("%d\n", a); } void llprint(long long a) { printf("%lld\n", a); } void dprint(double a) { printf("%.10f\n", a); } void print2(int a, int b) { printf("%d %d\n", a, b); } int Max(int a, int b) { if (a > b) { return a; }return b; } int Min(int a, int b) { if (a < b) { return a; }return b; } long long llmax(long long a, long long b) { return a > b ? a : b; } long long llmin(long long a, long long b) { return a < b ? a : b; } double dmax(double a, double b) { return a > b ? a : b; } double dmin(double a, double b) { return a < b ? a : b; } //long long llmax(long long a, long long b) { return a > b ? a : b; } //long long llmin(long long a, long long b) { return a < b ? a : b; } //double dmax(double a, double b) { return a > b ? a : b; } int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; } int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; } int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); } int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); } void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; } #define FMAX 100002; long long f[FMAX] = {0}; int main() { long long N, K; long long A, B; scanf("%lld%lld", &N, &K); for (long long i = 0; i < N; i++) { scanf("%lld%lld", &A, &B); f[A - 1] += B; } long long ans = 0; long long tmp = 0; for (long long i = 0; i < FMAX; i++) { tmp = tmp + f[i]; if(tmp >= K) { ans = i+1; break; } } printf("%ld\n", ans); #ifdef DEBUGF getch(); #endif return 0; }
main.c:58:20: error: expected ']' before ';' token 58 | #define FMAX 100002; | ^ main.c:59:13: note: in expansion of macro 'FMAX' 59 | long long f[FMAX] = {0}; | ^~~~ main.c: In function 'main': main.c:68:17: error: 'f' undeclared (first use in this function) 68 | f[A - 1] += B; | ^ main.c:68:17: note: each undeclared identifier is reported only once for each function it appears in main.c:73:39: error: expected expression before ';' token 73 | for (long long i = 0; i < FMAX; i++) { | ^
s407562732
p03721
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { int a,b; cin>>a>>b; //if(a*b/3%a!=0||a*b/3%b!=0) cout<<4; else cout<<a*b%3; }
a.cc: In function 'int main()': a.cc:10:9: error: 'else' without a previous 'if' 10 | else cout<<a*b%3; | ^~~~
s383705877
p03721
C++
#include<bits/stdc++.h> using namespace std; pair<int,int> v[1e5+10]; int main(){ long long n,k,i,j; cin>>n>>k; for(i=1;i<=n;i++){ int t1,t2; cin>>t1>>t2; v[i].first=t1; v[i].second=t2; } sort(v+1,v+n+1); int pre=0,ans; for(i=1;i<=n;i++){ if(pre<k&&k<=pre+v[i].second){ ans=v[i].first; break; } pre+=v[i].second; } cout<<ans; }
a.cc:3:20: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 3 | pair<int,int> v[1e5+10]; | ~~~^~~ a.cc:3:20: error: could not convert '(1.0e+5 + (double)10)' from 'double' to 'long unsigned int' 3 | pair<int,int> v[1e5+10]; | ~~~^~~ | | | double a.cc:3:20: error: size of array 'v' has non-integral type 'double'
s501515267
p03721
C++
#include<bits/stdc++.h> using namespace std; int v[100010]; int main(){ int n,k,i,j,k=0; cin>>n>>k; for(i=1;i<=n;i++){ int t1,t2; cin>>t1>>t2; for(j=1;j<=t2;j++){ v[++k]=t1; } } sort(v+1,v+k+1); cout<<v[k]; }
a.cc: In function 'int main()': a.cc:5:21: error: redeclaration of 'int k' 5 | int n,k,i,j,k=0; | ^ a.cc:5:15: note: 'int k' previously declared here 5 | int n,k,i,j,k=0; | ^
s561976977
p03721
C++
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:7:5: error: 'cin' was not declared in this scope 7 | cin >> N >> K; | ^~~ a.cc:16:13: error: 'cout' was not declared in this scope 16 | cout << ans << endl; | ^~~~ a.cc:16:28: error: 'endl' was not declared in this scope 16 | cout << ans << endl; | ^~~~
s308314256
p03721
C++
1 using ll = long long; 2 const int AMAX = 100000; 3 ll cnt[AMAX + 1]; 4 5 int main(void) { 6 int N; 7 ll K; 8 cin >> N >> K; 9 10 for (int i = 0; i < N; ++i) { 11 int A, B; 12 cin >> A >> B; 13 cnt[A] += B; 14 } 15 16 for (int ans = 1; ans <= AMAX; ++ans){ 17 if (K <= cnt[ans]) { 18 cout << ans << endl; 19 break; 20 } 21 K -= cnt[ans]; 22 } 23 24 return 0;
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 1 using ll = long long; | ^ a.cc:2:1: error: expected unqualified-id before numeric constant 2 | 2 const int AMAX = 100000; | ^ a.cc:3:1: error: expected unqualified-id before numeric constant 3 | 3 ll cnt[AMAX + 1]; | ^ a.cc:4:1: error: expected unqualified-id before numeric constant 4 | 4 | ^
s166511805
p03721
C++
#include<iostream> #include<vector> using namespace std; typedef long long ll; int main() { int n; ll k; cin >> n >> k; vector<pair<int, int>> v; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; v.push_back(make_pair(a, b)); } sort(v.begin(), v.end()); vector<int> a(n), b(n); //1つのvetor 要素n個 for (int i = 0; i < n; i++) { a[i] = v[i].first; b[i] = v[i].second; } for (int i = 0; i < n; ++i) { if (b[i] >= k) { cout << a[i] << endl; return 0; } else { k -= b[i]; } } }
a.cc: In function 'int main()': a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(v.begin(), v.end()); | ^~~~ | short
s756953287
p03721
C++
#include<iostream> using namespace std; typedef pair<int, int> P; #define N 100000 int main() { int n, k; cin >> n >> k; int a[N], b[N]; P p[N]; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; p[i] = {a[i], b[i]}; } sort(p, p + n); long long sum = 0; for (int i = 0; i < n; i++) { sum += p[i].second; if (sum >= k) { cout << p[i].first << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(p, p + n); | ^~~~ | short