submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s595306159
p03721
Java
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Test { static void solve(FastScanner sc, PrintWriter out) { int N = sc.ni(); long K = sc.nl(); long[] array = new long[100001]; for (int i = 0; i < N; i++) { array[sc.ni()]+=sc.ni(); } /* int index = 1; long sum = array[1]; while (sum<K) { sum += array[++index]; } */ long index = 0; long sum = 0; for(int i = 1; i <= N; i++) { sum += array[i]; if (sum >= K) { index = i; break; } } out.println(index); } public static void main(String[] args) { FastScanner sc = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); solve(sc, out); out.flush(); } static class FastScanner { private final InputStream is; private byte[] inbuf = new byte[1024]; private int lenbuf = 0, ptrbuf = 0; FastScanner(InputStream is) { this.is = is; } char nc() { return (char) skip(); } char[] nca(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while (p < n && !(isSpaceChar(b))) { buf[p++] = (char) b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } char[][] nca2(int n, int m) { char[][] buf = new char[m][n]; for (int i = 0; i < m; i++) { buf[i] = nca(n); } return buf; } String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while (!(isSpaceChar(b))) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } int ni() { int num = 0, b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } int[] nia(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = ni(); return a; } long nl() { long num = 0, b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } double nd() { return Double.parseDouble(ns()); } private int readByte() { if (lenbuf == -1) throw new InputMismatchException(); if (ptrbuf >= lenbuf) { ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if (lenbuf <= 0) return -1; } return inbuf[ptrbuf++]; } private int skip() { int b; while ((b = readByte()) != -1 && isSpaceChar(b)) ; return b; } private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } } }
Main.java:7: error: class Test is public, should be declared in a file named Test.java public class Test { ^ 1 error
s310358971
p03721
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long #define int long long template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;} template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } int main() { ll N, K; cin >> N >> K; map<int, int>mp; vector<int>As(N); for(int i=0; i<N; i++){ int ai, bi; cin >> ai >> bi; As.at(i) = ai; mp[ai] = bi; } sort(As.begin(), As.end()); vector<ll>cumsum(N+1); ll cs = 0; cumsum[0] = 0; for(int i=0; i<N+1; i++){ if (i-1 >= 0)cumsum.at(i) = cs + mp[As.at(i-1)]; cs = cumsum.at(i); } for (int i=0; i<N+1; i++){ if (cumsum.at(i) >= K){ cout << As[i-1] << endl; return 0; } } cout << K << endl; }
cc1plus: error: '::main' must return 'int'
s775340541
p03721
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long #define int long long template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;} template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } int main() { int N, K; cin >> N >> K; map<int, int>mp; vector<int>As(N); for(int i=0; i<N; i++){ int ai, bi; cin >> ai >> bi; As.at(i) = ai; mp[ai] = bi; } sort(As.begin(), As.end()); vector<int>cumsum(N+1); int cs = 0; cumsum[0] = 0; for(int i=0; i<N+1; i++){ if (i-1 >= 0)cumsum.at(i) = cs + mp[As.at(i-1)]; cs = cumsum.at(i); } for (int i=0; i<N+1; i++){ if (cumsum.at(i) >= K){ cout << As[i-1] << endl; return 0; } } cout << K << endl; }
cc1plus: error: '::main' must return 'int'
s624064863
p03721
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int,int>; int pow(int a,int n) { int ans = 1; rep(i,n) ans *= a; return ans; } int main() { ll N,K; cin >> N >> K; vector<pair<ll,ll>> res; rep(i,N) { ll a,b; cin >> a >> b; res.push_back(make_pair(a,b)); } sort(res.begin(),res.end()); int sum = 0; ll ans; int i = 0; while(i < N &&å sum > K) { sum += res.at(i).second; i++; } ans = res.at(i-1).first; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:25:19: error: '\U000000e5' was not declared in this scope 25 | while(i < N &&å sum > K) { | ^ a.cc:25:20: error: expected ')' before 'sum' 25 | while(i < N &&å sum > K) { | ~ ^~~~ | ) a.cc:25:28: error: expected ';' before ')' token 25 | while(i < N &&å sum > K) { | ^ | ;
s209890372
p03721
C++
#include <iostream> #include <string> #include <vector> #include <stack> #include <queue> #include <deque> #include <algorithm> #include <bitset> #include <stdio.h> #include <math.h> #include <stdlib.h> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define INF 2000000000 #define rep(i,n) for(int i=0;i<(n);i++) typedef pair<int, int> P; const ll MOD=1000000007; using Graph = vector<vector<int>>; 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; ll k; int a[100005], b[100005]; int d[100005]; int main() { cin >> n >> k; for (int i = 0; i < n; i++) { cin >> a[i]; cin >> b[i]; } memset(d, sizeof(d), 0); for (int i = 0; i < n; i++) { d[a[i]] += b[i]; } /* int i = 1; while (true) { k -= d[i]; if (k > 0) i++; else break; } cout << i << endl; */ for (int ans = 1; ans < n; ans++) { if (k <= d[ans]) { cout << ans << endl; return 0; } k -= d[ans]; } return 0; }
a.cc: In function 'int main()': a.cc:51:5: error: 'memset' was not declared in this scope 51 | memset(d, sizeof(d), 0); | ^~~~~~ a.cc:14:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 13 | #include <numeric> +++ |+#include <cstring> 14 | using namespace std;
s661268416
p03721
C++
#include <bits/stdc++.h> using namespace std; #define MOD (long long int)(1e9+7) #define ll long long int #define rep(i,n) for(int i=0; i<(int)(n); i++) #define reps(i,n) for(int i=1; i<=(int)(n); i++) #define REP(i,n) for(int i=n-1; i>=0; i--) #define REPS(i,n) for(int i=n; i>0; i--) #define FOR(i,a,b) for(int i=a; i<(int)(b); i++) #define ALL(x) (x).begin(),(x).end() #define RALL(a) (a).rbegin(), (a).rend() #define CLR(a) memset((a), 0 ,sizeof(a)) #define PB push_back #define MP make_pair #define SP << " " << const int INF = 1001001001; const ll LINF = 100100100100100100; const double EPS = 1e-10; const long double PI = acos(-1.0L); typedef pair<int,int> PII; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<ll> VL; #define chmax(a,b) a = (((a)<(b))?(b):(a)) #define chmin(a,b) a = (((a)>(b))?(b):(a)) __attribute__((constructor)) void initial(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } signed main(){ int n,k; cin>>n>>k; int ans, cnt=0; rep(i,n){ int a,b; cin>>a>>b; cnt+=b; if(cnt>k){ ans=a; cout<<a<<endl; return; } } return 0; }
a.cc: In function 'int main()': a.cc:42:25: error: return-statement with no value, in function returning 'int' [-fpermissive] 42 | return; | ^~~~~~
s654559893
p03721
C++
 
a.cc:1:1: error: extended character   is not valid in an identifier 1 |   | ^ a.cc:1:1: error: '\U00003000' does not name a type 1 |   | ^~
s874728347
p03721
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long n,k; cin >> n >> k; map<long long,long long> mp; for(long long i=0;i<n;++i){ long long a,b; cin >> a >> b; mp[a] += b; } long long sum=0; for(auto itr : mp){ sum += mp.second; if(sum >= k) cout << mp.first << endl; break; } return 0; }
a.cc: In function 'int main()': a.cc:12:19: error: 'class std::map<long long int, long long int>' has no member named 'second' 12 | sum += mp.second; | ^~~~~~ a.cc:13:33: error: 'class std::map<long long int, long long int>' has no member named 'first' 13 | if(sum >= k) cout << mp.first << endl; break; | ^~~~~
s802208385
p03721
C++
#include <bits/stdc++.h> using namespace std; using long long ll; int main(){ ll n,k; cin >> n >> k; ll sum = 0; bool flag = true; for(ll i=0;i<n;i++){ ll a,b; cin >> a >> b; sum += b; if(sum >= k && flag == true){ cout << a << endl; flag = false; } } return 0; }
a.cc:3:7: error: expected nested-name-specifier before 'long' 3 | using long long ll; | ^~~~ a.cc: In function 'int main()': a.cc:5:5: error: 'll' was not declared in this scope 5 | ll n,k; cin >> n >> k; | ^~ a.cc:5:20: error: 'n' was not declared in this scope; did you mean 'yn'? 5 | ll n,k; cin >> n >> k; | ^ | yn a.cc:5:25: error: 'k' was not declared in this scope 5 | ll n,k; cin >> n >> k; | ^ a.cc:6:7: error: expected ';' before 'sum' 6 | ll sum = 0; | ^~~~ | ; a.cc:8:11: error: expected ';' before 'i' 8 | for(ll i=0;i<n;i++){ | ^~ | ; a.cc:8:16: error: 'i' was not declared in this scope 8 | for(ll i=0;i<n;i++){ | ^ a.cc:9:11: error: expected ';' before 'a' 9 | ll a,b; | ^~ | ; a.cc:10:16: error: 'a' was not declared in this scope 10 | cin >> a >> b; | ^ a.cc:10:21: error: 'b' was not declared in this scope 10 | cin >> a >> b; | ^ a.cc:11:9: error: 'sum' was not declared in this scope 11 | sum += b; | ^~~
s671085808
p03721
C++
//#define _GLIBCXX_DEBUG #include<bits/stdc++.h> #define PI 3.14159265359 using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) const int INF= 1e9+5; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll> >vvl; typedef pair<ll,ll> P; typedef tuple<ll,ll,ll> T; const ll MOD=1000000007LL; int main(){ ll n,k;cin>>n>>k; map<ll,ll>M; rep(i,n){ ll a,b;cin>>a>>b; M[a]+=b; } vector<P>vec; for(auto p:M){ vec.push_back(p); } sort(vec.begin(),vec.end()); ll i=0; ll ans; ll count=0; for(int i=0;i<n;i++){ count+=vec[i].second; if(count>=k){ cout<<vec[i]<<endl; return 0; } } }
a.cc: In function 'int main()': a.cc:32:11: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'}) 32 | cout<<vec[i]<<endl; In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:3: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<lo
s494237152
p03721
C++
//#define _GLIBCXX_DEBUG #include<bits/stdc++.h> #define PI 3.14159265359 using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) const int INF= 1e9+5; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll> >vvl; typedef pair<ll,ll> P; typedef tuple<ll,ll,ll> T; const ll MOD=1000000007LL; int main(){ ll n,k;cin>>n>>k; map<ll,ll>M; rep(i,n){ ll a,b;cin>>a>>b; M[a]+=b; } vector<P>vec; for(auto p){ vec.push_back(p); } sort(vec.begin(),vec.end()); ll i=0; ll ans; ll count=0; for(int i=0;i<n;i++){ count+=vec[i].second; if(count>=k){ cout<<vec[i]<<endl; return 0; } } }
a.cc: In function 'int main()': a.cc:22:13: error: expected ';' before ')' token 22 | for(auto p){ | ^ | ; a.cc:22:13: error: expected primary-expression before ')' token a.cc:22:13: error: expected ';' before ')' token 22 | for(auto p){ | ^ | ; a.cc:23:19: error: use of 'p' before deduction of 'auto' 23 | vec.push_back(p); | ^ a.cc:32:11: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'}) 32 | cout<<vec[i]<<endl; In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:3: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<
s314822363
p03721
C++
#include<iostream> using namespace std; #define rep(i, n) for(int i = 0; i < n; i++) int main(){ int n, k; cin >> n >> k; pair<int, int> p[n]; rep(i, n) cin >> p[i].first >> p[i].second; sort(p, p + n); int ans; int sm = 0; for (int i = 0; sm < k; i++){ ans = p[i].first; sm += p[i].second; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(p, p + n); | ^~~~ | short
s990430155
p03721
C++
#include <bits/stdc++.h> using namespace std; signed main(){ long long n , k , a , b , array[100005]={} , c=0; cin>>n>>k; for(int i=0;i<n;i++){ cin>>a>>b; array[a]+=b; } int i=1; while(true){ c+=array[i]; if(c>=k){ break; } else { i++; } } c
a.cc: In function 'int main()': a.cc:20:6: error: expected ';' at end of input 20 | c | ^ | ; a.cc:20:6: error: expected '}' at end of input a.cc:3:14: note: to match this '{' 3 | signed main(){ | ^
s342455400
p03721
C++
#include <bits/stdc++.h> #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define all(x) (x).begin(),(x).end() using namespace std; using ll = long long; using P = pair<int, int>; int main(){ int n ll k; cin >> n >> k; vector<P> e; rep(i, n) { int a, b; cin >> a >> b; e.emplace_back(a, b); }; sort(all(e)); rep(i, n) { if (k > e[i].second) { k -= e[i].second; } else { cout << e[i].first << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:12:5: error: expected initializer before 'll' 12 | ll k; | ^~ a.cc:13:12: error: 'n' was not declared in this scope; did you mean 'yn'? 13 | cin >> n >> k; | ^ | yn a.cc:13:17: error: 'k' was not declared in this scope 13 | cin >> n >> k; | ^
s139297297
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for(ll i = 0; i < (ll)(n); i++) #define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++) #define memi cout << endl #define kono(n) cout << fixed << setprecision(n) #define all(c) (c).begin(), (c).end() #define pb push_back #define hina cout << ' ' #define in(n) cin >> n #define in2(n, m) cin >> n >> m #define in3(n, m, l) cin >> n >> m >> l #define out(n) cout << n const ll mei = (ll)1e9 + 7; int main(){ ll n, k, h, g; in2(n, k); h = 0; vector<pair<ll>> c(n); rep(i, n) in2(c[i].first, c[i].second); sort(all(c)); g = 0; while(h < k){ h = h + c[g].first * c[g].second; g++; if(h >= k){ out(c[g].first); memi; } } }
a.cc: In function 'int main()': a.cc:21:15: error: wrong number of template arguments (1, should be 2) 21 | vector<pair<ll>> c(n); | ^~ 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, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair' 89 | struct pair; | ^~~~ a.cc:21:17: error: template argument 1 is invalid 21 | vector<pair<ll>> c(n); | ^~ a.cc:21:17: error: template argument 2 is invalid a.cc:23:10: error: invalid types 'int[ll {aka long long int}]' for array subscript 23 | in2(c[i].first, c[i].second); | ^ a.cc:12:26: note: in definition of macro 'in2' 12 | #define in2(n, m) cin >> n >> m | ^ a.cc:23:22: error: invalid types 'int[ll {aka long long int}]' for array subscript 23 | in2(c[i].first, c[i].second); | ^ a.cc:12:31: note: in definition of macro 'in2' 12 | #define in2(n, m) cin >> n >> m | ^ a.cc:8:20: error: request for member 'begin' in 'c', which is of non-class type 'int' 8 | #define all(c) (c).begin(), (c).end() | ^~~~~ a.cc:24:8: note: in expansion of macro 'all' 24 | sort(all(c)); | ^~~ a.cc:8:33: error: request for member 'end' in 'c', which is of non-class type 'int' 8 | #define all(c) (c).begin(), (c).end() | ^~~ a.cc:24:8: note: in expansion of macro 'all' 24 | sort(all(c)); | ^~~ a.cc:27:14: error: invalid types 'int[ll {aka long long int}]' for array subscript 27 | h = h + c[g].first * c[g].second; | ^ a.cc:27:27: error: invalid types 'int[ll {aka long long int}]' for array subscript 27 | h = h + c[g].first * c[g].second; | ^ a.cc:30:12: error: invalid types 'int[ll {aka long long int}]' for array subscript 30 | out(c[g].first); | ^ a.cc:14:24: note: in definition of macro 'out' 14 | #define out(n) cout << n | ^
s255065617
p03721
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextLong(); int c = b-b; double ans = 0; double d; double [] in1 = new double [a]; int f,g; for(int i=0;i<a;i++){f = sc.nextInt(); g = sc.nextInt(); in1[i] = f+g*0.000001; } Arrays.sort(in1); for(int i=0;i<a;i++){d = Math.floor(in1[i]); c+=(in1[i]-d)*1000000; if(c>=b){ans=d;break;} } System.out.println(ans); } }
Main.java:6: error: incompatible types: possible lossy conversion from long to int int b = sc.nextLong(); ^ 1 error
s034765923
p03721
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); Long b = sc.nextLong(); Long c = b-b; int ans = 0; double d; double [] in1 = new double [a]; int f,g; for(int i=0;i<a;i++){f = sc.nextInt(); g = sc.nextInt(); in1[i] = f+g*0.000001; } Arrays.sort(in1); for(int i=0;i<a;i++){d = Math.floor(in1[i]); c+=(in1[i]-d)*1000000; if(c>=b){ans=d;break;} } System.out.println(ans); } }
Main.java:18: error: incompatible types: double cannot be converted to Long c+=(in1[i]-d)*1000000; ^ Main.java:19: error: incompatible types: possible lossy conversion from double to int if(c>=b){ans=d;break;} ^ 2 errors
s047464763
p03721
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); Long b = sc.nextLong(); Long c = b-b; int ans = 0; int d; double [] in1 = new double [a]; int f,g; for(int i=0;i<a;i++){f = sc.nextInt(); g = sc.nextInt(); in1[i] = d+ge-6; } Arrays.sort(in1); for(int i=0;i<a;i++){d = Math.floor(in1[i]); c+=(in1[i]-d)*1000000; if(c>=b){ans=d;break;} } System.out.println(ans); } }
Main.java:14: error: cannot find symbol in1[i] = d+ge-6; ^ symbol: variable ge location: class Main Main.java:17: error: incompatible types: possible lossy conversion from double to int for(int i=0;i<a;i++){d = Math.floor(in1[i]); ^ Main.java:18: error: incompatible types: double cannot be converted to Long c+=(in1[i]-d)*1000000; ^ 3 errors
s417772562
p03721
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); Long b = sc.nextLong(); Long c = b-b; int ans = 0; int d; double [] in1 = new double [a]; int f,g; for(int i=0;i<a;i++){f = sc.nextInt(); g = sc.nextInt(); in1[i] = d+ge-6; } Arrays.sort(in1); for(int i=0;i<a;i++){d = Math.floor(in1[i]); c+=(in1[i]-d)*1000000; if(c>=b){ans=d;break;} } } System.out.println(ans); } }
Main.java:22: error: <identifier> expected System.out.println(ans); ^ Main.java:22: error: <identifier> expected System.out.println(ans); ^ Main.java:24: error: class, interface, enum, or record expected } ^ 3 errors
s978890359
p03721
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); Long b = sc.nextLong(); Long c = b-b; int ans = 0; int d; double [] in1 = new double [a]; int f,g; for(int i=0;i<a;i++){f = sc.nextInt(); g = sc.nextInt(); in1[i] = d+ge-6 } Arrays.sort(in1); for(int i=0;i<a;i++){d = Math.floor(in1[i]); c+=(in1[i]-d)*1000000; if(c>=b){ans=d;break;} } } System.out.println(ans); } }
Main.java:14: error: ';' expected in1[i] = d+ge-6 ^ Main.java:22: error: <identifier> expected System.out.println(ans); ^ Main.java:22: error: <identifier> expected System.out.println(ans); ^ Main.java:24: error: class, interface, enum, or record expected } ^ 4 errors
s211074212
p03721
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = 0; int ans = 0; int [] in1 = new int [a]; int [] in2 = new int [a]; int [] in3 = new int [a]; for(int i=0;i<a;i++){in1[i] = sc.nextInt(); in2[i] = sc.nextInt(); in3[i] = in1[i]; } Arrays.sort(in1); while(ans==0){for(int i=0;i<a;i++){ for(int j=0;j<a;j++){if(in1[i] = in3[j]){c+=in2[j];} if(c>=b){ans=in1[i];} } } } System.out.println(ans); } }
Main.java:19: error: incompatible types: int cannot be converted to boolean for(int j=0;j<a;j++){if(in1[i] = in3[j]){c+=in2[j];} ^ 1 error
s209338362
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:8:2: error: 'cin' was not declared in this scope 8 | cin >> N >> K; | ^~~ a.cc:18:2: error: 'cout' was not declared in this scope 18 | cout << ans << endl; | ^~~~ a.cc:18:17: error: 'endl' was not declared in this scope 18 | cout << ans << endl; | ^~~~
s832454278
p03721
C++
#include <bits/stdc++.h> using namespace std; const int max_n = 1e6; map<int,int> table; int n; typedef long long l; ll k; int main(){ cin >> n >> k; vector<pair<ll, ll> > v(n); for(int i=0 ; i<n ; i++){ cin >> v[i].first >> v[i].second; } sort(v.begin(), v.end()); ll sum = 0; ll res = 0; for(int i=0 ; i<n ; i++){ sum += v[i].second; if(sum >= k){ res = v[i].first; break; } } cout << res << endl; return 0; }
a.cc:7:1: error: 'll' does not name a type; did you mean 'l'? 7 | ll k; | ^~ | l a.cc: In function 'int main()': a.cc:9:15: error: 'k' was not declared in this scope 9 | cin >> n >> k; | ^ a.cc:10:15: error: 'll' was not declared in this scope; did you mean 'l'? 10 | vector<pair<ll, ll> > v(n); | ^~ | l a.cc:10:21: error: template argument 1 is invalid 10 | vector<pair<ll, ll> > v(n); | ^ a.cc:10:23: error: template argument 1 is invalid 10 | vector<pair<ll, ll> > v(n); | ^ a.cc:10:23: error: template argument 2 is invalid a.cc:12:13: error: invalid types 'int[int]' for array subscript 12 | cin >> v[i].first >> v[i].second; | ^ a.cc:12:27: error: invalid types 'int[int]' for array subscript 12 | cin >> v[i].first >> v[i].second; | ^ a.cc:14:10: error: request for member 'begin' in 'v', which is of non-class type 'int' 14 | sort(v.begin(), v.end()); | ^~~~~ a.cc:14:21: error: request for member 'end' in 'v', which is of non-class type 'int' 14 | sort(v.begin(), v.end()); | ^~~ a.cc:15:5: error: expected ';' before 'sum' 15 | ll sum = 0; | ^~~~ | ; a.cc:16:5: error: expected ';' before 'res' 16 | ll res = 0; | ^~~~ | ; a.cc:18:5: error: 'sum' was not declared in this scope 18 | sum += v[i].second; | ^~~ a.cc:18:13: error: invalid types 'int[int]' for array subscript 18 | sum += v[i].second; | ^ a.cc:20:7: error: 'res' was not declared in this scope 20 | res = v[i].first; | ^~~ a.cc:20:14: error: invalid types 'int[int]' for array subscript 20 | res = v[i].first; | ^ a.cc:24:11: error: 'res' was not declared in this scope 24 | cout << res << endl; | ^~~
s300693353
p03721
C++
#[allow(unused_imports)] use std::cmp::{max, min, Ordering}; #[allow(unused_imports)] use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque}; #[allow(unused_imports)] use std::iter::FromIterator; // input macro // https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes .by_ref() .map(|r|r.unwrap() as char) .skip_while(|c|c.is_whitespace()) .take_while(|c|!c.is_whitespace()) .collect() }; input_inner!{next, $($r)*} }; } macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; } macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; } fn main() { input!{ n: usize, k: i64, ab: [(usize, i64); n], } let mut v = vec![0; 100010]; for (a, b) in ab { v[a] += b; } let mut count = 0; //let ans:usize; for i in (0..100010) { count += v[i]; if count >= k { println!("{}", i); break; } } }
a.cc:1:6: error: invalid preprocessing directive #[ 1 | #[allow(unused_imports)] | ^ a.cc:3:6: error: invalid preprocessing directive #[ 3 | #[allow(unused_imports)] | ^ a.cc:5:6: error: invalid preprocessing directive #[ 5 | #[allow(unused_imports)] | ^ a.cc:46:14: error: too many decimal points in number 46 | (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() | ^~~~~~~ a.cc:74:19: error: too many decimal points in number 74 | for i in (0..100010) { | ^~~~~~~~~ a.cc:2:5: error: 'use' does not name a type 2 | use std::cmp::{max, min, Ordering}; | ^~~ a.cc:4:5: error: 'use' does not name a type 4 | use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque}; | ^~~ a.cc:6:5: error: 'use' does not name a type 6 | use std::iter::FromIterator; | ^~~ a.cc:9:5: error: 'macro_rules' does not name a type 9 | macro_rules! input { | ^~~~~~~~~~~ a.cc:30:5: error: 'macro_rules' does not name a type 30 | macro_rules! input_inner { | ^~~~~~~~~~~ a.cc:40:5: error: 'macro_rules' does not name a type 40 | macro_rules! read_value { | ^~~~~~~~~~~ a.cc:62:5: error: 'fn' does not name a type 62 | fn main() { | ^~
s997586284
p03721
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) 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; } int64_t abs(int64_t n) { if (n < 0) { n = -n; } return n; } int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; } int main() [ int64_t n, k; cin >> n >> k; vector <pair <int, int>> v(n); rep(i, n) cin >> v.at(i).first >> v.at(i).second; sort(v.begin(), v.end()); rep(i, n) { if (k > v.at(i).second) { k -= v.at(i).second; } else { cout << v.at(i).first << endl; break; } } }
a.cc:33:11: error: expected primary-expression before 'n' 33 | int64_t n, k; | ^ a.cc:33:10: error: expected ']' before 'n' 33 | int64_t n, k; | ^~ | ] a.cc:34:3: error: 'cin' does not name a type 34 | cin >> n >> k; | ^~~ a.cc:35:30: error: 'n' was not declared in this scope; did you mean 'yn'? 35 | vector <pair <int, int>> v(n); | ^ | yn a.cc:4:19: error: expected unqualified-id before 'for' 4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++) | ^~~ a.cc:36:3: note: in expansion of macro 'rep' 36 | rep(i, n) cin >> v.at(i).first >> v.at(i).second; | ^~~ a.cc:36:7: error: 'i' does not name a type 36 | rep(i, n) cin >> v.at(i).first >> v.at(i).second; | ^ a.cc:4:35: note: in definition of macro 'rep' 4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++) | ^ a.cc:36:7: error: 'i' does not name a type 36 | rep(i, n) cin >> v.at(i).first >> v.at(i).second; | ^ a.cc:4:49: note: in definition of macro 'rep' 4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++) | ^ a.cc:37:7: error: expected constructor, destructor, or type conversion before '(' token 37 | sort(v.begin(), v.end()); | ^ a.cc:4:19: error: expected unqualified-id before 'for' 4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++) | ^~~ a.cc:38:3: note: in expansion of macro 'rep' 38 | rep(i, n) { | ^~~ a.cc:38:7: error: 'i' does not name a type 38 | rep(i, n) { | ^ a.cc:4:35: note: in definition of macro 'rep' 4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++) | ^ a.cc:38:7: error: 'i' does not name a type 38 | rep(i, n) { | ^ a.cc:4:49: note: in definition of macro 'rep' 4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++) | ^ a.cc:46:1: error: expected declaration before '}' token 46 | } | ^
s810941936
p03721
C++
#include<bits/stdc+.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); ll n, k, a, b; cin >> n >> k; map<ll, ll> freq; for(int i = 0; i < n; i++) { cin >> a >> b; freq[a] += b; } for(pair<ll, ll>& x: freq) { if(x.second < k) k -= x.second; else { cout << x.first << endl; return 0; } } return 0; }
a.cc:1:9: fatal error: bits/stdc+.h: No such file or directory 1 | #include<bits/stdc+.h> | ^~~~~~~~~~~~~~ compilation terminated.
s744102011
p03721
C++
from operator import itemgetter import sys def read(): return sys.stdin.readline().rstrip() n, k = map(int, input().split()) ab = sorted([[int(i) for i in read().split()] for _ in range(n)], key=itemgetter(0)) c = 0 for a, b in ab: c += b if c >= k: print(a) break
a.cc:1:1: error: 'from' does not name a type 1 | from operator import itemgetter | ^~~~
s783909247
p03721
C++
#include<iostream> #include<stdio.h> #include<math.h> #include<algorithm> using namespace std; typedef long long ll; #define fup(i,a,b) for(register int i=a;i<b;++i) #define dint __int128 dint read() { dint x;char a;while((a=getchar())<48||a>57); for(x=a-48;(a=getchar())>47&&a<58;x=(x<<3)+(x<<1)+(a^48)) return x; } struct node{ int a,b; }s[105004]; bool cmp(node x,node y) {return x.a<y.a;} void Main() { int n; scanf("%d",&n);b dint k=read(); fup(i,0,n)scanf("%d%d",&s[i].a,&s[i].b); sort(s,s+n,cmp); int i=0; while(k>=0)k-=s[i++].b; printf("%d",s[i-1].a); } int main() { Main(); return 0; }
a.cc: In function 'void Main()': a.cc:24:20: error: 'b' was not declared in this scope 24 | scanf("%d",&n);b | ^ a.cc:26:9: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 26 | fup(i,0,n)scanf("%d%d",&s[i].a,&s[i].b); | ^ a.cc:7:37: note: in definition of macro 'fup' 7 | #define fup(i,a,b) for(register int i=a;i<b;++i) | ^ a.cc:29:11: error: 'k' was not declared in this scope 29 | while(k>=0)k-=s[i++].b; | ^ a.cc: In function '__int128 read()': a.cc:15:1: warning: control reaches end of non-void function [-Wreturn-type] 15 | } | ^
s903733564
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ /* i1 i2 i3 i4 ... iN 7 5 7 7 7 7 7 6 2 6 6 */ ios::sync_with_stdio(0); cin.tie(0); ll N, K; cin >> N >> K; ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; for(int i = 1; i <= N; i++){ int a, b; cin >> a >> b; Area[a] += b; } ll Ans = 0; for(int i = 1; K > 0; i++){ Ans = i; K -= Area[i]; } cout << Ans; }
a.cc: In function 'int main()': a.cc:16:27: error: expected identifier before numeric constant 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc: In lambda function: a.cc:16:37: error: expected '{' before '=' token 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc: In function 'int main()': a.cc:16:39: error: no match for 'operator=' (operand types are 'main()::<lambda()>' and 'int') 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc:16:35: note: candidate: 'main()::<lambda()>& main()::<lambda()>::operator=(const main()::<lambda()>&)' (deleted) 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc:16:35: note: no known conversion for argument 1 from 'int' to 'const main()::<lambda()>&' a.cc:16:43: error: expected identifier before numeric constant 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^~ a.cc: In lambda function: a.cc:16:58: error: expected '{' before '=' token 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc: In function 'int main()': a.cc:16:60: error: no match for 'operator=' (operand types are 'main()::<lambda()>' and 'int') 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc:16:56: note: candidate: 'main()::<lambda()>& main()::<lambda()>::operator=(const main()::<lambda()>&)' (deleted) 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc:16:56: note: no known conversion for argument 1 from 'int' to 'const main()::<lambda()>&'
s290708005
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ /* i1 i2 i3 i4 ... iN 7 5 7 7 7 7 7 6 2 6 6 */ ios::sync_with_stdio(0); cin.tie(0); ll N, K; cin >> N >> K; ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; for(int i = 0; i < N; i++){ int a, b; cin >> a >> b; Area[a] += b; } ll Ans = 0; for(int i = 0; K > 0; i++){ Ans = i; K -= Area[i]; } cout << Ans; }
a.cc: In function 'int main()': a.cc:16:27: error: expected identifier before numeric constant 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc: In lambda function: a.cc:16:37: error: expected '{' before '=' token 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc: In function 'int main()': a.cc:16:39: error: no match for 'operator=' (operand types are 'main()::<lambda()>' and 'int') 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc:16:35: note: candidate: 'main()::<lambda()>& main()::<lambda()>::operator=(const main()::<lambda()>&)' (deleted) 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc:16:35: note: no known conversion for argument 1 from 'int' to 'const main()::<lambda()>&' a.cc:16:43: error: expected identifier before numeric constant 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^~ a.cc: In lambda function: a.cc:16:58: error: expected '{' before '=' token 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc: In function 'int main()': a.cc:16:60: error: no match for 'operator=' (operand types are 'main()::<lambda()>' and 'int') 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc:16:56: note: candidate: 'main()::<lambda()>& main()::<lambda()>::operator=(const main()::<lambda()>&)' (deleted) 16 | ll Area[100005] = { [ 0 ... 10] = 0, [11 ... 100004] = 0}; | ^ a.cc:16:56: note: no known conversion for argument 1 from 'int' to 'const main()::<lambda()>&'
s793272354
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int N long long K; cin >> N >> K; vector<pair<int, int>> AB(N); for (int i = 0, a, b; i < N && cin >> a >> b; i++) AB.at(i) = {a, b}; sort(AB.begin(), AB.end()); int ans = 0 long long sum = 0; for (int i = 0; i < N; i++) { sum += AB.at(i).second; if (sum >= K) { cout << AB.at(i).first << "\n"; break; } } }
a.cc: In function 'int main()': a.cc:6:3: error: expected initializer before 'long' 6 | long long K; | ^~~~ a.cc:7:10: error: 'N' was not declared in this scope 7 | cin >> N >> K; | ^ a.cc:7:15: error: 'K' was not declared in this scope 7 | cin >> N >> K; | ^ a.cc:13:3: error: expected ',' or ';' before 'long' 13 | long long sum = 0; | ^~~~ a.cc:15:5: error: 'sum' was not declared in this scope 15 | sum += AB.at(i).second; | ^~~
s581231212
p03721
C++
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; //long long using ll = long long; //出力系 #define print(x) cout << x << endl #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl // begin() end() #define all(x) (x).begin(),(x).end() //for #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) //最大公約数 unsigned gcd(unsigned a, unsigned b) { if(a < b) return gcd(b, a); unsigned r; while ((r=a%b)) { a = b; b = r; } return b; } // 最小公倍数 unsigned lcm(unsigned a, unsigned b){ return a / gcd(a, b) * b; } int main(){ int N, K; cin >> N >> K; map<ll, ll>A; REP(i, N){ int x, y; cin >> x >> y; A[x] += y; } for(auto G : A){ if(K <= G.second) { print(G.first); break; } K -= G.second; }
a.cc: In function 'int main()': a.cc:54:2: error: expected '}' at end of input 54 | } | ^ a.cc:38:11: note: to match this '{' 38 | int main(){ | ^
s927706772
p03721
C++
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; //long long using ll = long long; //出力系 #define print(x) cout << x << endl #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl // begin() end() #define all(x) (x).begin(),(x).end() //for #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) //最大公約数 unsigned gcd(unsigned a, unsigned b) { if(a < b) return gcd(b, a); unsigned r; while ((r=a%b)) { a = b; b = r; } return b; } // 最小公倍数 unsigned lcm(unsigned a, unsigned b){ return a / gcd(a, b) * b; } int main(){ int N, K; cin >> N >> K; map<ll, ll>A; REP(i, N){ int x, y; cin >> x >> y; A[x] += y; } for(auto G : A){ if(K <= G.second) { print(G.first) break; } K -= G.second; }
a.cc: In function 'int main()': a.cc:51:7: error: expected ';' before 'break' 51 | break; | ^~~~~ a.cc:54:2: error: expected '}' at end of input 54 | } | ^ a.cc:38:11: note: to match this '{' 38 | int main(){ | ^
s756825859
p03721
C++
#include <iostream> #include <vector> #include <queue> #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<int, int> P; #define pb push_back #define eb emplace_back #define fi first #define se second #define bg begin() #define ed end() #define all(x) x.bg, x.ed #ifdef LOCAL #define dmp(x) cerr << __LINE__ << " " << #x << " " << x << endl #else #define dmp(x) void(0) #endif template <class t, class u> void chmax(t &a, u b) { if (a < b) a = b; } template <class t, class u> void chmin(t &a, u b) { if (b < a) a = b; } const int mod = 1000000007; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } }; struct combination { vector<mint> fact, ifact; combination(int n) : fact(n + 1), ifact(n + 1) { assert(n < mod); fact[0] = 1; for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i; ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i; } mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] * ifact[n - k]; } }; template <class t> using vc = vector<t>; template <class t> using vvc = vc<vc<t>>; using vi = vc<int>; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int lcm(int a, int b) { return (a * b) / gcd(a, b); } int fact(int n) { if (n == 0) return 1; return n * fact(n - 1); } int main() { int n,k;cin>>n>>k; vector<P> v(n); int a,b; rep(i,n){ cin>>a>>b; v[i]=make_pair(a,b); } sort(all(v)); ll num=0; ll ans=0; while(true){ num+=v[i].second; if(num>=k){ ans=v[i].first; break; } } cout <<ans<<endl; }
a.cc: In function 'int main()': a.cc:156:16: error: 'i' was not declared in this scope 156 | num+=v[i].second; | ^
s030710286
p03721
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++) #define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++) #define MOD 1000000007 #define int long long #define ALL(a) (a).begin(),(a).end() #define vi vector<int> #define vii vector<vi> #define pii pair<int,int> #define priq priority_queue<int> #define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key))) #define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key))) #define tii tuple<int,int,int> signed main(){ int N,K; cin>>N>>K; vector<pii> A(N); rep(_,0,N) cin>>A[i].first>>A[i].second; sort(ALL(A)); int sum=0; rep(i,0,N){ sum+=A[i].second; if(sum>=K){ cout<<A[i].first; break; } } }
a.cc: In function 'int main()': a.cc:18:21: error: 'i' was not declared in this scope 18 | rep(_,0,N) cin>>A[i].first>>A[i].second; | ^
s862765811
p03721
C++
/
a.cc:1:1: error: expected unqualified-id before '/' token 1 | / | ^
s856084035
p03721
C++
#include<bits/stdc++.h> using namespace std; #define MAX 1000000007 int main(){ int n long long k; cin >> n >> k; pair<int, long long> p[n]; for(int i = 0; i < n; i++){ int a,b; cin >> a >> b; p[i] = make_pair(a,b); } for(int i = 0; i < n; i++){ if(p[i].second < k){ k -= p[i].second; }else{ cout << p[i].first << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:6:5: error: expected initializer before 'long' 6 | long long k; cin >> n >> k; | ^~~~ a.cc:6:25: error: 'n' was not declared in this scope; did you mean 'yn'? 6 | long long k; cin >> n >> k; | ^ | yn a.cc:6:30: error: 'k' was not declared in this scope 6 | long long k; cin >> n >> k; | ^ a.cc:10:9: error: 'p' was not declared in this scope 10 | p[i] = make_pair(a,b); | ^ a.cc:13:12: error: 'p' was not declared in this scope 13 | if(p[i].second < k){ | ^
s013433006
p03721
C++
//#include<iostream> //#include<algorithm> //#include<string> //#include <cmath> //#include <vector> #include <bits/stdc++.h> #define ll long long #define REP(x,n) for(int x=0;x<n;x++) // vector 操作 size(), empty(), insert(itr,値), erase(itr) (first,last), // sort(itr), find(all(x),値),reverse(itr) #define vei vector<int> #define velli vector<long long int> #define pb(x) push_back(x) // 末尾にxを加える #define pb2 pop_back() // 末尾削除 #define all(x) (x).begin(),(x).end() //イテレーター using namespace std; int main (){ ll int n, k; cin >> n >> k; velli a(n); velli b(n); velli v; for (int i=0; i<n; i++){ cin >> a[i]; cin >> b[i]; } for (int i=0;i<n; i++){ for (int j=0;j<b[i];j++){ v.pb(a[i]); } } sort(all(v)); cout << v[k-1] << endl; //REP(i,v.size()){ //cout << v[i] << endl; } }
a.cc:45:1: error: expected declaration before '}' token 45 | } | ^
s602521094
p03721
C++
#include <bits/stdc++.h> using namespace std; using ll long long; int main(){ ll N,K; vector<ll> v; map<ll,ll> m; cin >> N >> K; for (ll i=0;i<(N);i++){ ll ai,bi; cin >> ai >> bi; for(ll j=0;j<bi;j++){ v.push_back(ai); } } sort(v.begin(),v.end()); cout << v.at(K-1) << endl; }
a.cc:3:7: error: expected nested-name-specifier before 'll' 3 | using ll long long; | ^~ a.cc: In function 'int main()': a.cc:5:5: error: 'll' was not declared in this scope 5 | ll N,K; | ^~ a.cc:6:14: error: template argument 2 is invalid 6 | vector<ll> v; | ^ a.cc:7:14: error: template argument 3 is invalid 7 | map<ll,ll> m; | ^ a.cc:7:14: error: template argument 4 is invalid a.cc:8:12: error: 'N' was not declared in this scope 8 | cin >> N >> K; | ^ a.cc:8:17: error: 'K' was not declared in this scope 8 | cin >> N >> K; | ^ a.cc:9:12: error: expected ';' before 'i' 9 | for (ll i=0;i<(N);i++){ | ^~ | ; a.cc:9:17: error: 'i' was not declared in this scope 9 | for (ll i=0;i<(N);i++){ | ^ a.cc:10:11: error: expected ';' before 'ai' 10 | ll ai,bi; | ^~~ | ; a.cc:11:20: error: 'ai' was not declared in this scope 11 | cin >> ai >> bi; | ^~ a.cc:11:26: error: 'bi' was not declared in this scope 11 | cin >> ai >> bi; | ^~ a.cc:12:19: error: expected ';' before 'j' 12 | for(ll j=0;j<bi;j++){ | ^~ | ; a.cc:12:24: error: 'j' was not declared in this scope 12 | for(ll j=0;j<bi;j++){ | ^ a.cc:13:19: error: request for member 'push_back' in 'v', which is of non-class type 'int' 13 | v.push_back(ai); | ^~~~~~~~~ a.cc:16:12: error: request for member 'begin' in 'v', which is of non-class type 'int' 16 | sort(v.begin(),v.end()); | ^~~~~ a.cc:16:22: error: request for member 'end' in 'v', which is of non-class type 'int' 16 | sort(v.begin(),v.end()); | ^~~ a.cc:17:15: error: request for member 'at' in 'v', which is of non-class type 'int' 17 | cout << v.at(K-1) << endl; | ^~
s484606087
p03721
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int N, K; int main(){ cin >> N >> K; vector<ll> ab(100010, 0); ll a, b; for(int i = 1; i <= N; i++){ cin >> a >> b; ab[a] += b; } ll sum = 0; int j = 1; while(sum < K) sum += ab[j++] cout << j-1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:18:32: error: expected ';' before 'cout' 18 | while(sum < K) sum += ab[j++] | ^ | ; 19 | 20 | cout << j-1 << endl; | ~~~~
s035483999
p03721
C++
#include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int *cnt = new int[100010]; int a, b; for (int i = 0; i < n; i++) { cin >> a >> b; cnt[a] += b; } int c = 0; for (int i = 1; i <= 100000; i++) { if (c+cnt[i] >= k) { cout << i << endl; return 0; } c += b[i]; } }
a.cc: In function 'int main()': a.cc:20:15: error: invalid types 'int[int]' for array subscript 20 | c += b[i]; | ^
s203758045
p03721
C++
#include <iostream> #include <vector> using namespace std; int main() { int N, 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()); long long sum = 0; for (int i = 0; i < N; i++) { sum += v[i].second; if (sum >= K) { cout << v[i].first << endl; break; } } return 0; }
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
s009288800
p03721
C++
//ABC061C #include <bits/stdc++.h> #include <iostream> #include <iomanip> #include <numeric> #include <math.h> #include <stdio.h> #include <climits> #include <cfloat> #include <string> #include <unordered_map> using namespace std; int main(){ int n long long int k; cin >> n >> k; vector<int> a(n), b(n), x(100000); for(int i=0;i<100000;i++){ x.at(i) = 0; } for(int i=0;i<n;i++){ cin >> a.at(i) >> b.at(i); x.at(a.at(i)-1) += b.at(i); } int count = 0; for(int i=0;i<100000;i++){ count += x.at(i); if(count >= k){ cout << i+1 << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:16:9: error: expected initializer before 'long' 16 | long long int k; | ^~~~ a.cc:17:16: error: 'n' was not declared in this scope; did you mean 'yn'? 17 | cin >> n >> k; | ^ | yn a.cc:17:21: error: 'k' was not declared in this scope 17 | cin >> n >> k; | ^
s754845185
p03721
C++
int main(void){ int n; int k; long long sum=0; scanf("%d %d",&n,&k); int data[n][2]; for(int i=0;i<n;i++){ scanf("%d %d",&data[i][0],&data[i][1]); } qsort(data, n, sizeof(data[0]), compare_int);//ソート関数(配列めい、総数、固定、比較方法) for(int i=0;i<n;i++){ // printf("%d %d\n",data[i][0],data[i][1]); } for(int i=0;i<n;i++){ sum+=data[i][1]; if(sum >=k){ printf("%d\n",data[i][0]); break; } } }
a.cc: In function 'int main()': a.cc:6:5: error: 'scanf' was not declared in this scope 6 | scanf("%d %d",&n,&k); | ^~~~~ a.cc:15:37: error: 'compare_int' was not declared in this scope 15 | qsort(data, n, sizeof(data[0]), compare_int);//ソート関数(配列めい、総数、固定、比較方法) | ^~~~~~~~~~~ a.cc:15:5: error: 'qsort' was not declared in this scope 15 | qsort(data, n, sizeof(data[0]), compare_int);//ソート関数(配列めい、総数、固定、比較方法) | ^~~~~ a.cc:23:9: error: 'printf' was not declared in this scope 23 | printf("%d\n",data[i][0]); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | int main(void){
s079144106
p03721
C++
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i)) #define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i)) #define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i)) #define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i)) #define INF 2e9 #define INF_LL 1LL<<60 #define ll long long typedef pair<ll, ll> P; int main(){ ll n, k; cin >> n >> k; vector<P> suji(n); REP(i, n) { cin >> suji[i].first >> suji[i].second; } sort(suji.begin(), suji.end()) ll wa = 0, idx = 0; ll ans = 0; while(k > wa) { wa += suji[idx].second; ans = suji[idx].first; idx++; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:22:35: error: expected ';' before 'long' 22 | sort(suji.begin(), suji.end()) | ^ | ; a.cc:25:15: error: 'wa' was not declared in this scope 25 | while(k > wa) { | ^~ a.cc:26:20: error: 'idx' was not declared in this scope 26 | wa += suji[idx].second; | ^~~
s664387693
p03721
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; long k; cin >> n >> k; int a[n]; int b[n]; int i; for(i=0;i<n;i++){ cin >> a[i] >> b[i]; } vector<pair<int,int>> p(n); for(i=0;i<n;i++){ p[i] = make_pair(a[i],b[i]); } sort(p.begin(),p.end()); int cnt = 0; int tmp = 0; for(i=0;i<n&&cnt < k;i++){ cnt += p.second; tmp = i; } cout << i; }
a.cc: In function 'int main()': a.cc:21:14: error: 'class std::vector<std::pair<int, int> >' has no member named 'second' 21 | cnt += p.second; | ^~~~~~
s898570233
p03721
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; long k; cin >> n >> k; int a[n]; int b[n]; int i; for(i=0;i<n;i++){ cin >> a[i] >> b[i]; } vector<pair<int,int>> p(n); for(i=0;i<n;i++){ p[i] = make_pair(a[i],b[i]); } sort(p.begin(),p.end()); int cnt = 0; int tmp = 0; for(i=0;i<n&&cnt < k;i++){ cnt += p.second(); tmp = i; } cout << i; }
a.cc: In function 'int main()': a.cc:21:14: error: 'class std::vector<std::pair<int, int> >' has no member named 'second' 21 | cnt += p.second(); | ^~~~~~
s595455290
p03721
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; long k; cin >> n >> k; int a[n]; int b[n]; int i; for(i=0;i<n;i++){ cin >> a[i] >> b[i]; } pair<int,int> p(n); for(i=0;i<n;i++){ p[i] = make_pair(a[i],b[i]); } sort(p.begin(),p.end()); int cnt = 0; int tmp = 0; for(i=0;i<n&&cnt < k;i++){ cnt += p.second(); tmp = i; } cout << i; }
a.cc: In function 'int main()': a.cc:13:20: error: no matching function for call to 'std::pair<int, int>::pair(int&)' 13 | pair<int,int> p(n); | ^ 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, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 913 | explicit constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:913:28: note: template argument deduction/substitution failed: a.cc:13:20: note: mismatched types 'std::pair<_T1, _T2>' and 'int' 13 | pair<int,int> p(n); | ^ /usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 902 | constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:902:19: note: template argument deduction/substitution failed: a.cc:13:20: note: mismatched types 'std::pair<_T1, _T2>' and 'int' 13 | pair<int,int> p(n); | ^ /usr/include/c++/14/bits/stl_pair.h:891:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && (! _ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 891 | explicit constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:891:28: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && _ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 881 | constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_pair.h:869:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_U1, int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_U2, _T2> > >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 869 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:869:9: note: candidate expects at least 2 arguments, 1 provided /usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::is_convertible<_U1, int> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U2, _T2> >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 856 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate expects at least 2 arguments, 1 provided /usr/include/c++/14/bits/stl_pair.h:843:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<int>, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_U1, int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, __zero_as_null_pointer_constant, ...) [with typename std::enable_if<std::__and_<std::__not_<std::is_reference<_U1> >, std::is_pointer<_T2>, std::is_constructible<_T1, _U1>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_U1, _T1> > >::value, bool>::type <anonymous> = _U1; _T1 = int; _T2 = int]' 843 | pair(_U1&& __x, __zero_as_null_pointer_constant, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:843:9: note: candidate expects at least 2 arguments, 1 provided /usr/include/c++/14/bits/stl_pair.h:830:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<int>, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::is_convertible<_U1, int> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, __zero_as_null_pointer_constant, ...) [with typename std::enable_if<std::__and_<std::__not_<std::is_reference<_U1> >, std::is_pointer<_T2>, std::is_constructible<_T1, _U1>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U1, _T1> >::value, bool>::type <anonymous> = _U1; _T1 = int; _T2 = int]' 830 | pair(_U1&& __x, __zero_as_null_pointer_constant, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:830:9: note: candidate expects at least 2 arguments, 1 provided /usr/include/c++/14/bits/stl_pair.h:789:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 789 | explicit constexpr pair(const pair<_U1, _U2>& __p) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:789:28: note: template argument deduction/substitution failed: a.cc:13:20: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 13 | pair<int,int> p(n); | ^ /usr/include/c++/14/bits/stl_pair.h:779:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 779 | constexpr pair(const pair<_U1, _U2>& __p) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:779:19: note: template argument deduction/substitution failed: a.cc:13:20: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 13 | pair<int,int> p(n); | ^ /usr/include/c++/14/bits/stl_pair.h:762:26: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_ConstructiblePair<_U1, _U2
s565035599
p03721
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; long k; cin >> n >> k; int a[n]; int b[n]; int i; for(i=0;i<n;i++){ cin >> a[i] >> b[i]; } pair<int,int> p[n]; for(i=0;i<n;i++){ p[i] = make_pair(a[i],b[i]); } sort(p.begin(),p.end()); int cnt = 0; int tmp = 0; for(i=0;i<n&&cnt < k;i++){ cnt += p.second(); tmp = i; } cout << i; }
a.cc: In function 'int main()': a.cc:17:10: error: request for member 'begin' in 'p', which is of non-class type 'std::pair<int, int> [n]' 17 | sort(p.begin(),p.end()); | ^~~~~ a.cc:17:20: error: request for member 'end' in 'p', which is of non-class type 'std::pair<int, int> [n]' 17 | sort(p.begin(),p.end()); | ^~~ a.cc:21:14: error: request for member 'second' in 'p', which is of non-class type 'std::pair<int, int> [n]' 21 | cnt += p.second(); | ^~~~~~
s255462595
p03721
C++
#include<bits/stdc++.h> using namespace std; #define F(n) for(long i=0;i<n;++i) long main() { long n,k; cin >> n >> k; long a,b; vector<pair<long,long> > v; F(n){ cin >> a >> b; v.push_back(make_pair(a,b)); } sort(v.begin(),v.end()); long ans=0,cnt=0; F(v.size()){ cnt += v[i].second; if(cnt>=k){ ans = v[i].first; break; } } cout << ans << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s144927026
p03721
C++
#include<algorithm>//sort(all(変数),greater<型名>()) で降順に #include<cmath>//切り上げceil(値) #include<deque> #include<iomanip>//setprecision(数字) #include<iostream> #include<list> #include<map> #include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd #include<queue>//priority_queue<型名> 変数:優先度付きキュー 最大値の探索が早い #include<set> #include<stack> #include<string> #include<vector> #define rep0(i,n) for(ll i=0; i<n; i++) #define rrep0(i,n) for(ll i=n-1; 0<=i; i--) #define rep1(i,n) for(ll i=1; i<=n; i++) #define rrep1(i,n) for(ll i=n; 1<=i; i--) #define vll vector<ll> #define vi vector<int> #define all(x) (x).begin(),(x).end() #define INF 1e18 using ll = long long; using namespace std; 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; } int main(){ int n; ll k; cin >> n >> k; vector<make_pair<int,int>> p,cnt(n); rep0(i,n){ cin >> p.first >> p.second; } sort(all(p)); rep0(i,n){ cnt[i+1] = cnt[i]+b[i]; } rep0(i,n){ if(cnt[i+1] >= k){ cout << a[i] << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:29:27: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector' 29 | vector<make_pair<int,int>> p,cnt(n); | ^~ a.cc:29:27: note: expected a type, got 'make_pair<int, int>' a.cc:29:27: error: template argument 2 is invalid a.cc:31:14: error: request for member 'first' in 'p', which is of non-class type 'int' 31 | cin >> p.first >> p.second; | ^~~~~ a.cc:31:25: error: request for member 'second' in 'p', which is of non-class type 'int' 31 | cin >> p.first >> p.second; | ^~~~~~ a.cc:20:20: error: request for member 'begin' in 'p', which is of non-class type 'int' 20 | #define all(x) (x).begin(),(x).end() | ^~~~~ a.cc:33:8: note: in expansion of macro 'all' 33 | sort(all(p)); | ^~~ a.cc:20:32: error: request for member 'end' in 'p', which is of non-class type 'int' 20 | #define all(x) (x).begin(),(x).end() | ^~~ a.cc:33:8: note: in expansion of macro 'all' 33 | sort(all(p)); | ^~~ a.cc:35:8: error: invalid types 'int[ll {aka long long int}]' for array subscript 35 | cnt[i+1] = cnt[i]+b[i]; | ^ a.cc:35:19: error: invalid types 'int[ll {aka long long int}]' for array subscript 35 | cnt[i+1] = cnt[i]+b[i]; | ^ a.cc:35:23: error: 'b' was not declared in this scope 35 | cnt[i+1] = cnt[i]+b[i]; | ^ a.cc:38:11: error: invalid types 'int[ll {aka long long int}]' for array subscript 38 | if(cnt[i+1] >= k){ | ^ a.cc:39:15: error: 'a' was not declared in this scope 39 | cout << a[i] << endl; | ^
s029629080
p03721
C++
#include <iostream> #include <cmath> #include <vector> #include <string> #include <ctime> #include <climits> #include <iomanip> #include <fstream> #include <sstream> #include <algorithm> #include <utility> #include <cstdlib> using namespace std; long int pow107 = (int)pow(10, 9) + 7; long int limit = LONG_MAX; bool comp(pair<int, string> a, pair<int, string> b){ if(a.first != b.first) return a.first > b.first; else return a.second < b.second; } long int jou(long int x, long int y){ long int f = 1; for(int i = 0; i < y; ++i){ f = f * x % pow107; } return f; } bool pn(long int x){ if(x != 2 && x % 2 == 0) return false; for(int i = 3; i < x; ++i){ if(x != i && x % i == 0) return false; } return true; } long int factorial(long int n){ long int f = 1; for(long int i = 1; i <= n; ++i){ f = f * i % pow107; } return f; } //最大limit //10^9+7 pow107 //素数pn //n乗jou //コンビネーションfactorial // int main(){ int n , k , t = 0; 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()); while(t < k){ t += v.second; if(t >= k){ cout << v.first << endl; } } }
a.cc: In function 'int main()': a.cc:68:16: error: 'class std::vector<std::pair<int, int> >' has no member named 'second' 68 | t += v.second; | ^~~~~~ a.cc:70:23: error: 'class std::vector<std::pair<int, int> >' has no member named 'first' 70 | cout << v.first << endl; | ^~~~~
s113723819
p03721
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int INF = 1e9; int main() { ll n, k, a, b, cnt = 0, ans; cin >> n >> k; vector<pair<int, int>> p(n); rep(i, n) cin >> p[i].first >> p[i].second; sort(p.begin(), p.end()); for (int i = 0; i < n; ++i) { cnt += x.second; if (cnt >= k) { ans = x.first; break; } } cout << ans << endl; // priority_queue<int, vector<int>, greater<int>> pq; // for (int i = 0; i < n; ++i) { // cin >> a >> b; // for (int j = 0; j < b; ++j) { // pq.push(a); // } // } // for (int i = 0; i < k - 1; ++i) pq.pop(); // cout << pq.top() << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:12: error: 'x' was not declared in this scope 17 | cnt += x.second; | ^
s946472242
p03721
C++
#include <iostream> #include <stdio.h> #include <vector> #include <algorithm> // sort #include <map> // pair #define rep(i, n) for (int i = 0; i < (n); ++i) #define REP(i, j, n) for (int i = j; i < (n); ++i) using namespace std; typedef long long ll; typedef vector<int> vi; int main(){ int n,k; cin >> n >> k; pair<int,int> p; rep(i,n){ cin >> p[i].first >> p[i].second; } sort(p.begin(),p.end()); int ans = 0; while(k>0){ k-=p.first; ans =p.second; } cout<<ans<endl; }
a.cc: In function 'int main()': a.cc:17:17: error: no match for 'operator[]' (operand types are 'std::pair<int, int>' and 'int') 17 | cin >> p[i].first >> p[i].second; | ^ a.cc:17:31: error: no match for 'operator[]' (operand types are 'std::pair<int, int>' and 'int') 17 | cin >> p[i].first >> p[i].second; | ^ a.cc:19:12: error: 'struct std::pair<int, int>' has no member named 'begin' 19 | sort(p.begin(),p.end()); | ^~~~~ a.cc:19:22: error: 'struct std::pair<int, int>' has no member named 'end' 19 | sort(p.begin(),p.end()); | ^~~ a.cc:25:14: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 25 | cout<<ans<endl; | ~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 25 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 25 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 25 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 25 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 25 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 25 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 25 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:25:15: note: couldn't deduce template parameter '_CharT' 25 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 25 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 25 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed: a.cc:25:15: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 25 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>' 25 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/vector:66, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h:2089:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2089 | operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2089:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'const std::vector<_Tp, _Alloc>' 25 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/map:63, from a.cc:5: /usr/include/c++/14/bits/stl_map.h:1550:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)' 1550 | operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_map.h:1550:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'const std::map<_Key, _Tp, _Compare, _Allocator>' 25 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/map:64: /usr/include/c++/14/bits/stl_multimap.h:1172:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const multimap<_Key, _Tp, _Compare, _Allocator>&, const multimap<_Key, _Tp, _Compare, _Allocator>&)' 1172 | operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_multimap.h:1172:5: note: template argument deduction/substitution failed: a.cc:25:15: note: 'std::basic_ostream<char>' is not derived from 'const std::multimap<_Key, _Tp, _Compare, _Allocator>' 25 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c+
s016353050
p03721
C++
#include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0), cout.tie(0) #define ll long long int #define ld long double #define fr first #define se second #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() #define sz(v) (int)v.size() #define sunq(v) sort(all(v));v.resize(distance(v.begin(),unique(all(v)))) #define pb push_back #define mp make_pair #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr) #define emla(a, val) memset(a, val, sizeof(a)) #define easm(a, b) (a + b - 1) /b #define PI 3.141592653589793238 ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;} ll lcm(ll a,ll b) {return a*b/gcd(a,b);} //bool valid(int i, int j){return i >= 0 && i < n && j >= 0 && j < m;} int n, k; map<int, ll>m; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); //clock_t z = clock(); cin >> n >> k; for(int i = 1; i <= n; i++){ int a, b; cin >> a >> b; m[a] += 1ll*b; } for(auto i : m){ k -= min(i.se, k); if(k == 0) return cout << i.fr << endl, 0; } //debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC); /* *try tricky test cases: -bounds -small input (0, 1) -big input -random tests */ return 0; }
a.cc: In function 'int main()': a.cc:53:13: error: no matching function for call to 'min(long long int&, int&)' 53 | k -= min(i.se, k); | ~~~^~~~~~~~~ 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:53:13: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 53 | k -= min(i.se, k); | ~~~^~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:53:13: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 53 | k -= min(i.se, k); | ~~~^~~~~~~~~
s461506766
p03721
C++
#include <bits/stdc++.h> #define mod 1000000007 #define rep(i, n) for(int i=0; i<n; ++i) using namespace std; typedef long long ll; const long long INF = 1LL << 60; int main(void){ int N, K; cin >> N >> K; vector<pair<int, int>> ab(N); rep(i, N) cin >> ab[i].first >> ab[i].second; sort(ab.begin(), ab.end()); int ans, count = 0; while(count <= K){ if(count + ab[i].second >= K){ ans = ab[i].first; break; } else{ count += ab[i].second; ans = ab[i].first; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:27:31: error: 'i' was not declared in this scope 27 | if(count + ab[i].second >= K){ | ^
s004156918
p03721
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(long long i=0;i<(long long)(n);i++) #define REP(i,k,n) for(long long i=k;i<(long long)(n);i++) #define all(a) a.begin(),a.end() #define eb emplace_back #define pb push_back #define lb(v,k) lower_bound(all(v),k)-v.begin() #define chmin(x,y) if(x>y)x=y #define chmax(x,y) if(x<y)x=y typedef long long ll; typedef pair<ll,ll> P; typedef tuple<ll,ll,ll> PP; typedef priority_queue<ll> PQ; typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ; using vi=vector<ll>; using vvi=vector<vector<ll>>; using vc=vector<char>; using vvc=vector<vector<char>>; ll inf=100100100100; const int mod=1000000007; int main(){ ll n,k;cin>>n>>k; vector<P> v; rep(i,n){ ll a,b;cin>>a>>b; v.eb(a,b); } sort(all()); ll ans=0; rep(i,n){ ans+=v[i].second; if(ans>=k){ cout<<v[i].first<<endl; return 0; } } }
a.cc: In function 'int main()': a.cc:5:17: error: expected primary-expression before '.' token 5 | #define all(a) a.begin(),a.end() | ^ a.cc:29:9: note: in expansion of macro 'all' 29 | sort(all()); | ^~~ a.cc:5:27: error: expected primary-expression before '.' token 5 | #define all(a) a.begin(),a.end() | ^ a.cc:29:9: note: in expansion of macro 'all' 29 | sort(all()); | ^~~
s443698727
p03721
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(long long i=0;i<(long long)(n);i++) #define REP(i,k,n) for(long long i=k;i<(long long)(n);i++) #define all(a) a.begin(),a.end() #define eb emplace_back #define pb push_back #define lb(v,k) lower_bound(all(v),k)-v.begin() #define chmin(x,y) if(x>y)x=y #define chmax(x,y) if(x<y)x=y typedef long long ll; typedef pair<ll,ll> P; typedef tuple<ll,ll,ll> PP; typedef priority_queue<ll> PQ; typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ; using vi=vector<ll>; using vvi=vector<vector<ll>>; using vc=vector<char>; using vvc=vector<vector<char>>; ll inf=100100100100; const int mod=1000000007; int main(){ int n,k;cin>>n>>k; vector<P> v; rep(i,n){ int a,b;cin>>a>>b; v.eb(a,b); } sort(all(b)); ll ans=0; rep(i,n){ ans+=v[i].second; if(ans>=k){ cout<<v[i].first<<endl; return 0; } } }
a.cc: In function 'int main()': a.cc:29:13: error: 'b' was not declared in this scope 29 | sort(all(b)); | ^ a.cc:5:16: note: in definition of macro 'all' 5 | #define all(a) a.begin(),a.end() | ^
s522863007
p03721
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<iomanip> #include<math.h> typedef long long ll; using namespace std; int main() { long long N, K, a[100000], b[100000], sum = 0; cin >> N >> K; for (int i = 0;i < N;i++)cin >> a[i] >> b[i]; for (int i = 0;i < N;i++) { for (int j = 0;j < b[i];j++) { c[sum] = a[i];sum++; } } for (int i = 0;i < sum - 1;i++) { for (int j = i + 1;j < sum;j++) { if (a[i] > a[j]) { int tmp = a[i]; a[i] = a[j]; a[j] = a[i]; int tmp = b[i]; a[i] = b[j]; a[j] = b[i]; } } } int v = 1; int k; int v = K; for(k=0; k>0;k++) v = v - b[k]; cout << a[k]; }
a.cc: In function 'int main()': a.cc:17:48: error: 'c' was not declared in this scope 17 | for (int j = 0;j < b[i];j++) { c[sum] = a[i];sum++; } | ^ a.cc:26:37: error: redeclaration of 'int tmp' 26 | int tmp = b[i]; | ^~~ a.cc:23:37: note: 'int tmp' previously declared here 23 | int tmp = a[i]; | ^~~ a.cc:34:13: error: redeclaration of 'int v' 34 | int v = K; | ^ a.cc:32:13: note: 'int v' previously declared here 32 | int v = 1; | ^
s484186798
p03721
C++
#include<stdio.h> #include<vector> #include<iostream> //c++ #include<algorithm> /* int main(){ int a=0; char A[5]; for (int i = 0; i < 5; i++) { scanf("%c\n", &A[i]); } for(int i = 0; i < 5; i++) { if (A[i] =='A' &&A[i + 1]=='C') { a = 1; } } if (a == 1) { printf("Yes"); } else { printf("No"); } }*/ using namespace std; /*int main() { int g; int N,Num=0; vector<int>a; cin >> N; for (int i = 0; i < N;i++) { cin >> g; a.push_back(g); } int t,p=0; while (true) { t=a[p] ; a[p] = -1; p = t; if (p == -1) { Num = -1; break; } Num++; if (p == 2) { break; } p = p - 1; } cout << Num; int main() { long long N, g; vector<int>a; cin >> N; for (int i = 0; i < N; i++) { cin >> g; a.push_back(g); } sort(a.begin(), a.end()); long long Num1 = 0, Num2 = 0, Num; for (int i = 0; i < N; i++) { if (a[i] == a[i + 1] && a[i] >= Num1 && i != N - 1) { Num2 = Num1; Num1 = a[i]; i++; } } Num = Num1 * Num2; cout << Num; return 0; } int main(){vector<int>S; int count=0; int g; cin >> g; S.push_back((g %100000)/10000); S.push_back((g %10000)/1000); S.push_back((g %1000)/100); S.push_back((g %100)/10); S.push_back((g %10)/1); S.push_back((g %1000000)/100000); for (int i = 0; i < 6; i++) { if (S[i] == 1) { count++; } } cout << count; */ int main(){ int num; char s[100]; char t[100]; int N, M; cin >> N; for (int i = 0; i < N; i++) { cin >> s[i]; } cin >> M; for (int i = 0; i < M; i++) { cin t[i]; } int count=0; int max=0; for (int k = 0; k < N; k++) { for (int i = 0; i < M; i++) { if (s[k] == s[i]) { num++; } } for (int i = 0; i < 100; i++) { if (s[k] == t[i]) { num--; } } count = 0; if (max < num){ } num = 0; } count >> max; }
a.cc: In function 'int main()': a.cc:132:20: error: expected ';' before 't' 132 | cin t[i]; | ^~ | ;
s276399669
p03721
C++
#include<iostream> #include<string> #include<string.h> #include<algorithm> #include<vector> #include<iomanip> #include<math.h> #include<complex> #include<queue> #include<deque> #include<stack> #include<map> #include<set> #include<bitset> using namespace std; #define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i ) #define rep(i,n) REP(i,0,n) typedef long long ll; typedef pair<int,int> pint; typedef pair<ll,int> pli; const int inf=1e9+7; const ll longinf=1000000000000 ; const ll mod=1000003 ; int main(){ ll n,k; cin >> n >> k; pair<ll,ll> p[n]; rep(i,n)cin >> p[i].first >> p[i].second; sort(p,p+n); ll sum[n]={}; sum[0]=b[0]; rep(i,n-1){ sum[i+1]=sum[i]+b[i+1]; } ll x=lower_bound(sum,sum+n,k)-sum; cout << p[x].first << endl; return 0;}
a.cc: In function 'int main()': a.cc:32:10: error: 'b' was not declared in this scope 32 | sum[0]=b[0]; | ^
s727526945
p03721
C++
/*Function Template*/ #include<bits/stdc++.h> using namespace std; const int mod = 1000000007; #define rep(i, n) for(int i = 0; i < (n); i++) int Len(int n) { int s=0; while(n!=0) s++, n/=10; return s; } int Sint(int n) { int m=0,s=0,a=n; while(a!=0) s++, a/=10; for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10; return m; } int GCD(int a,int b) { int r, tmp; /* 自然数 a > b を確認・入替 */ if(a<b){ tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ r = a % b; while(r!=0){ a = b; b = r; r = a % b; } return b; } int Factorial(int n){ int m=1; while(n>=1) m*=n,n--; return m; } int Svec(vector<int> v){ int n=0; for(int i=0;i<v.size();i++) n+=v[i]; return n; } /////////////////////////// int main() { long long int n,k,ans=0; cin>>n>>k; vector<pair<int,int>> v; rep(i,n){ int a,b; cin>>a>>b; v.emplace_back(a,b); } sort(v.begin(),v.end()); rep(auto c:v){ ans+=c.second; if(ans>=k){ cout<<c.first<<endl; return 0; } } } ///////////////////////////
a.cc:66:15: error: macro "rep" requires 2 arguments, but only 1 given 66 | rep(auto c:v){ | ^ a.cc:5:9: note: macro "rep" defined here 5 | #define rep(i, n) for(int i = 0; i < (n); i++) | ^~~ a.cc: In function 'int main()': a.cc:66:3: error: 'rep' was not declared in this scope 66 | rep(auto c:v){ | ^~~
s372347130
p03721
C++
n, k = map(int, input().split()) l = [0]*(10**5+10) for i in range(n): a, b = map(int, input().split()) l[a] += b sum = 0 for i in range(len(l)): sum += l[i] if sum >= k: print(i) break
a.cc:1:1: error: 'n' does not name a type 1 | n, k = map(int, input().split()) | ^
s125005149
p03721
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long int a,b; cin >> a >>b; vector<pair<long long,long long>> p(n); long long int c[100010],d[100010]; for(int i=0;i<a;i++){ cin >>c[i] >> d[i]; p[i]=make_pair(c[i],d[i]); } sort(p.begin(),p.end()); for(int i=0;i<a;i++){ if(b<=p[i].second){ cout <<p[i].first; break; } else{ b -=p[i].second; } } return 0; }
a.cc: In function 'int main()': a.cc:9:39: error: 'n' was not declared in this scope 9 | vector<pair<long long,long long>> p(n); | ^
s509760896
p03721
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long int a,b; cin >> a >>b; vector<pair<long long,long long>> p(n); long long int c[100010],d[100010]; for(int i=0;i<a;i++){ cin >>c[i] >> d[i]; p[i]=make_pair(a[i],b[i]); } sort(p.begin(),p.end()); for(int i=0;i<a;i++){ if(b<=p[i].second){ cout <<p[i].first; break; } else{ b -=p[i].second; } } return 0; }
a.cc: In function 'int main()': a.cc:9:39: error: 'n' was not declared in this scope 9 | vector<pair<long long,long long>> p(n); | ^ a.cc:14:21: error: invalid types 'long long int[int]' for array subscript 14 | p[i]=make_pair(a[i],b[i]); | ^ a.cc:14:26: error: invalid types 'long long int[int]' for array subscript 14 | p[i]=make_pair(a[i],b[i]); | ^
s976451094
p03721
C++
#include<bits/stdc++.h> using namespace std; const int mod = 1000000007; #define rep(i, n) for(int i = 0; i < (n); i++) int int_len(int n) { int s=0; while(n!=0) s++, n/=10; return s; } int int_sum(int n) { int m=0,s=0,a=n; while(a!=0) s++, a/=10; for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10; return m; } int ggcd(int a,int b) { int r, tmp; /* 自然数 a > b を確認・入替 */ if(a<b){ tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ r = a % b; while(r!=0){ a = b; b = r; r = a % b; } return b; } int fac(int n){ int m=1; while(n>=1) m*=n,n--; return m; } int vec_sum(vector<int> v){ int n=0; for(int i=0;i<v.size();i++) n+=v[i]; return n; } /////////////////////////// int main() { int n,k,ans=0,count; cin>>n>>k; vector<pair<int,int>> v; rep(i,n){ int a,b; cin>>a>>b; v.emplace_back(a,b); } sort(v.begin(),v.end()); for(int p:v){ ans+=p.second; if(ans>=k){ cout<<p.first<<endl; return 0; } } } ///////////////////////////
a.cc: In function 'int main()': a.cc:79:13: error: cannot convert 'std::pair<int, int>' to 'int' in initialization 79 | for(int p:v){ | ^ a.cc:81:12: error: request for member 'second' in 'p', which is of non-class type 'int' 81 | ans+=p.second; | ^~~~~~ a.cc:83:15: error: request for member 'first' in 'p', which is of non-class type 'int' 83 | cout<<p.first<<endl; | ^~~~~
s253131762
p03721
C++
#include<bits/stdc++.h> using namespace std; const int mod = 1000000007; #define rep(i, n) for(int i = 0; i < (n); i++) int int_len(int n) { int s=0; while(n!=0) s++, n/=10; return s; } int int_sum(int n) { int m=0,s=0,a=n; while(a!=0) s++, a/=10; for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10; return m; } int ggcd(int a,int b) { int r, tmp; /* 自然数 a > b を確認・入替 */ if(a<b){ tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ r = a % b; while(r!=0){ a = b; b = r; r = a % b; } return b; } int fac(int n){ int m=1; while(n>=1) m*=n,n--; return m; } int vec_sum(vector<int> v){ int n=0; for(int i=0;i<v.size();i++) n+=v[i]; return n; } /////////////////////////// int main() { int n,k,ans=0,count; cin>>n>>k; vector<int> a(n),b(n); rep(i,n) cin>>a[i]>>b[i]; rep(i,n){ count=i; ans+=b[i]; if(ans>=k){ break; } } cout<<a[i]<<endl; } ///////////////////////////
a.cc: In function 'int main()': a.cc:81:11: error: 'i' was not declared in this scope 81 | cout<<a[i]<<endl; | ^
s715256711
p03721
C++
#include <bits/stdc++.h> using namespace std; int main (){ int n,k,a,b,ans=0; cin>>n>>k; for(int i=0;i<n;i++){ cin>>a>>b; ans+=b; if(ans>=k);{ cout<<a<<endl; return 0; } return 0; }
a.cc: In function 'int main()': a.cc:14:2: error: expected '}' at end of input 14 | } | ^ a.cc:3:12: note: to match this '{' 3 | int main (){ | ^
s383090355
p03721
C++
#include<bits/stdc++.h> using namespace std; long long c[2e5]; int main() { long long n, k; cin >> n >> k; while (n--) { int a, b; cin >> a >> b; c[a] += b; } int r = 0; while (k > 0) { k -= c[r++]; } cout << --r << endl; }
a.cc:4:13: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 4 | long long c[2e5]; | ^~~ a.cc:4:13: error: could not convert '2.0e+5' from 'double' to 'long unsigned int' 4 | long long c[2e5]; | ^~~ | | | double a.cc:4:13: error: size of array 'c' has non-integral type 'double'
s618854952
p03721
C++
#include<bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (n); i++) int int_len(long long int n) { int s=0; while(n!=0) s++, n/=10; return s; } int int_sum(long long int n) { int m=0,s=0,a=n; while(a!=0) s++, a/=10; for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10; return m; } int vec_sum(vector<int> v){ int n=0; for(int i=0;i<v.size();i++) n+=v[i]; return n; } /////////////////////////// int main() { int k=0,n=0,count=0; string s; cin>>n>>k; vector<int> a(n),b(n); priority_queue<int> v; rep(i,n) cin>>a[i]>>b[i]; for(int i=0;i<n;i++){ for(int j=0;j<b[i];j++){ v.push(a[i]); count++; if(count==k){ cout<<a[i]<<endl; return 0; } } } sort(v.begin(),v.end()); cout<<v[k-1]<<endl; } ///////////////////////////
a.cc: In function 'int main()': a.cc:42:10: error: 'class std::priority_queue<int>' has no member named 'begin' 42 | sort(v.begin(),v.end()); | ^~~~~ a.cc:42:20: error: 'class std::priority_queue<int>' has no member named 'end' 42 | sort(v.begin(),v.end()); | ^~~ a.cc:43:10: error: no match for 'operator[]' (operand types are 'std::priority_queue<int>' and 'int') 43 | cout<<v[k-1]<<endl; | ^
s644622689
p03721
C++
#include<bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (n); i++) int int_len(long long int n) { int s=0; while(n!=0) s++, n/=10; return s; } int int_sum(long long int n) { int m=0,s=0,a=n; while(a!=0) s++, a/=10; for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10; return m; } int vec_sum(vector<int> v){ int n=0; for(int i=0;i<v.size();i++) n+=v[i]; return n; } /////////////////////////// int main() { int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000; string s; cin>>n>>k; vector<int> a(n),b(n),v; rep(i,n) cin>>a[i]>>b[i]; for(int i=0;i<n;i++){ for(int j=0;j<b[i];j++){ v.push_back(a[i]); count++; } if(count>=k) break; } sort(v.begin(),v.end()); cout<<v[k-1]<<endl; } ///////////////////////////
a.cc: In function 'int main()': a.cc:29:15: error: conflicting declaration 'std::vector<int> a' 29 | vector<int> a(n),b(n),v; | ^ a.cc:26:7: note: previous declaration as 'int a' 26 | int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000; | ^ a.cc:29:20: error: conflicting declaration 'std::vector<int> b' 29 | vector<int> a(n),b(n),v; | ^ a.cc:26:11: note: previous declaration as 'int b' 26 | int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000; | ^ a.cc:30:18: error: invalid types 'int[int]' for array subscript 30 | rep(i,n) cin>>a[i]>>b[i]; | ^ a.cc:30:24: error: invalid types 'int[int]' for array subscript 30 | rep(i,n) cin>>a[i]>>b[i]; | ^ a.cc:32:20: error: invalid types 'int[int]' for array subscript 32 | for(int j=0;j<b[i];j++){ | ^ a.cc:33:20: error: invalid types 'int[int]' for array subscript 33 | v.push_back(a[i]); | ^
s202560788
p03721
C++
#include<bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (n); i++) int int_len(long long int n) { int s=0; while(n!=0) s++, n/=10; return s; } int int_sum(long long int n) { int m=0,s=0,a=n; while(a!=0) s++, a/=10; for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10; return m; } int vec_sum(vector<int> v){ int n=0; for(int i=0;i<v.size();i++) n+=v[i]; return n; } /////////////////////////// int main() { long long int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000; string s; cin>>n>>k; vector<int> a(n),b(n),v; rep(i,n) cin>>a[i]>>b[i]; for(int i=0;i<n;i++){ for(int j=0;j<b[i];j++){ v.push_back(a[i]); count++; } if(count>=k) break; } sort(v.begin(),v.end()); cout<<v[k-1]<<endl; } ///////////////////////////
a.cc: In function 'int main()': a.cc:29:15: error: conflicting declaration 'std::vector<int> a' 29 | vector<int> a(n),b(n),v; | ^ a.cc:26:17: note: previous declaration as 'long long int a' 26 | long long int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000; | ^ a.cc:29:20: error: conflicting declaration 'std::vector<int> b' 29 | vector<int> a(n),b(n),v; | ^ a.cc:26:21: note: previous declaration as 'long long int b' 26 | long long int a=0,b=0,c=0,d=0,k=0,n=0,count=0,ans=1000000; | ^ a.cc:30:18: error: invalid types 'long long int[int]' for array subscript 30 | rep(i,n) cin>>a[i]>>b[i]; | ^ a.cc:30:24: error: invalid types 'long long int[int]' for array subscript 30 | rep(i,n) cin>>a[i]>>b[i]; | ^ a.cc:32:20: error: invalid types 'long long int[int]' for array subscript 32 | for(int j=0;j<b[i];j++){ | ^ a.cc:33:20: error: invalid types 'long long int[int]' for array subscript 33 | v.push_back(a[i]); | ^
s530826330
p03721
C++
#include <iostream> #include <vector> int main() { std::vector<int> ns; int a, b, K, N; scanf("%d %d", &N, &K); for(int i=0; i<N; i++){ scanf("%d %d", &a, &b); for(int j=0; j<b; j++){ ns.push_back(a); } } std::sort(ns.begin(), ns.end()); printf("%d\n", ns[K-1]); return 0; }
a.cc: In function 'int main()': a.cc:15:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 15 | std::sort(ns.begin(), ns.end()); | ^~~~ | qsort
s005058482
p03721
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long k = sc.nextLong(); int[] a = new int[n]; int[] b = new int[n]; long sum = 0; TreeMap<Integer,Integer> map = new TreeMap<Integer,Integer>(); for(int i = 0;i < n;i++){ a[i]=sc.nextInt(); b[i]=sc.nextInt(); if(map.containsKey(a[i])){ int k = map.get(a[i]); map.remove(a[i]); map.put(a[i],k+b[i]); } else map.put(a[i],b[i]); } Arrays.sort(a); int s = 0; while(sum < k){ sum += (long)map.get(a[s]); s++; } System.out.println(a[s-1]); } }
Main.java:15: error: variable k is already defined in method main(String[]) int k = map.get(a[i]); ^ 1 error
s457006119
p03721
C++
#include <iostream> using namespace std; using ll=long long; #include <tuple> #include <string> #include <vector> //入力数の桁数を出力 //https://atcoder.jp/contests/abc057/tasks/abc057_c int cnt_digits(ll n){ int digits =0; while(n > 0){ digits++; n /= 10; } return digits; } int main() { int num1; int num2; vector<int> num; //格納、出力用 vector<pair<int, int>> a_vc; vector<int> b_vc; //入力 int n; int k; cin >> n >> k; //cout << "入力値" <<n << k; //入力 for(int i = 0;i < n;i++){ cin >> num1 >> num2; a_vc.emplace_back(num1,num2); } //並べ替え sort(a_vc.begin(), a_vc.end()); //k番目に小さい値 //第二引数のどこに入るか調べる ll ans = 0; ll sum = 0; for(int i=0;i < a_vc.size();i++){ sum += a_vc[i].second; if(k > sum){ continue; }else{ ans = a_vc[i].first; break; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:45:5: error: 'sort' was not declared in this scope; did you mean 'short'? 45 | sort(a_vc.begin(), a_vc.end()); | ^~~~ | short
s609159923
p03721
C++
int main() { int num1; int num2; vector<int> num; //格納、出力用 vector<pair<int, int>> a_vc; vector<int> b_vc; //入力 int n; int k; cin >> n >> k; //cout << "入力値" <<n << k; //入力 for(int i = 0;i < n;i++){ cin >> num1 >> num2; a_vc.emplace_back(num1,num2); } //並べ替え sort(a_vc.begin(), a_vc.end()); //k番目に小さい値 //第二引数のどこに入るか調べる ll ans = 0; ll sum = 0; for(int i=0;i < a_vc.size();i++){ sum += a_vc[i].second; if(k > sum){ continue; }else{ ans = a_vc[i].first; break; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:5: error: 'vector' was not declared in this scope 5 | vector<int> num; | ^~~~~~ a.cc:5:12: error: expected primary-expression before 'int' 5 | vector<int> num; | ^~~ a.cc:7:12: error: 'pair' was not declared in this scope 7 | vector<pair<int, int>> a_vc; | ^~~~ a.cc:7:17: error: expected primary-expression before 'int' 7 | vector<pair<int, int>> a_vc; | ^~~ a.cc:8:12: error: expected primary-expression before 'int' 8 | vector<int> b_vc; | ^~~ a.cc:13:5: error: 'cin' was not declared in this scope 13 | cin >> n >> k; | ^~~ a.cc:18:9: error: 'a_vc' was not declared in this scope 18 | a_vc.emplace_back(num1,num2); | ^~~~ a.cc:24:10: error: 'a_vc' was not declared in this scope 24 | sort(a_vc.begin(), a_vc.end()); | ^~~~ a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'? 24 | sort(a_vc.begin(), a_vc.end()); | ^~~~ | short a.cc:28:5: error: 'll' was not declared in this scope 28 | ll ans = 0; | ^~ a.cc:29:7: error: expected ';' before 'sum' 29 | ll sum = 0; | ^~~~ | ; a.cc:31:9: error: 'sum' was not declared in this scope 31 | sum += a_vc[i].second; | ^~~ a.cc:35:13: error: 'ans' was not declared in this scope 35 | ans = a_vc[i].first; | ^~~ a.cc:41:5: error: 'cout' was not declared in this scope 41 | cout << ans << endl; | ^~~~ a.cc:41:13: error: 'ans' was not declared in this scope 41 | cout << ans << endl; | ^~~ a.cc:41:20: error: 'endl' was not declared in this scope 41 | cout << ans << endl; | ^~~~
s191533616
p03721
C++
#include <bits/stdc++.h> using namespace std; // マクロ #define rep(i,n) for (int i = 0; i < (int)(n); i++) // 型エイリアス using ll = long long; using vi = vector<int>; using vs = vector<string>; using vvi = vector<vi>; using vvs = vector<vs>; 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:30:3: error: expected '}' at end of input 30 | } | ^ a.cc:14:16: note: to match this '{' 14 | int main(void) { | ^
s380745409
p03721
C++
#include<iostream> #include <algorithm> using namespace std; int main(void){ int a[10]; for(int i=0;i<9;++i){ a[i] = 0; } int n; cin>>n; int over=0; for(int i=0;i<n;++i){ int tmp; cin>>tmp; if(tmp<=399){ a[1]=1;//gray } else if((400<=tmp)&&(tmp<=799)){ a[2]=1;//brown } else if((800<=tmp)&&(tmp<=1199)){ a[3]=1;//green } else if((1200<=tmp)&&(tmp<=1599)){ a[4]=1;//water } else if((1600<=tmp)&&(tmp<=1999)){ a[5]=1;//blue } else if((2000<=tmp)&&(tmp<=2399)){ a[6]=1;//yellow } else if((2400<=tmp)&&(tmp<=2799)){ a[7]=1;//orange } else if((2800<=tmp)&&(tmp<=3199)){ a[8]=1;//red } else if(3200<=tmp){ ++over;//free } } int sum=0; for(int i=1;i<=8;++i){ sum+=a[i]; } if(sum==0){ mmax=1; } else{ mmax = sum+over; } if(mmax>8){ mmax=8; } cout<<sum<<" "<<mmax<<endl; }
a.cc: In function 'int main()': a.cc:51:9: error: 'mmax' was not declared in this scope 51 | mmax=1; | ^~~~ a.cc:54:9: error: 'mmax' was not declared in this scope 54 | mmax = sum+over; | ^~~~ a.cc:56:8: error: 'mmax' was not declared in this scope 56 | if(mmax>8){ | ^~~~ a.cc:60:21: error: 'mmax' was not declared in this scope 60 | cout<<sum<<" "<<mmax<<endl; | ^~~~
s447507697
p03721
C++
import java.util.* fun main(args: Array<String>) { val sc = Scanner(System.`in`) val n = sc.nextInt() val k = sc.nextLong() val a = (0 until n).map { Class016c(sc.next().toInt(), sc.next().toInt()) } println(problem061c(n, k, a)) } fun problem061c(n: Int, k: Long, a: List<Class016c>): Int { var k2 = k var ans = 0L for (i in 0 until n) { val tmp = a[i].b if (tmp < k2) { k2 -= tmp } else { ans = a[i].a break } } return ans } data class Class016c(var a: Int, var b: Int)
a.cc:4:29: error: stray '`' in program 4 | val sc = Scanner(System.`in`) | ^ a.cc:4:32: error: stray '`' in program 4 | val sc = Scanner(System.`in`) | ^ a.cc:1:1: error: 'import' does not name a type 1 | import java.util.* | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:11:1: error: 'fun' does not name a type 11 | fun problem061c(n: Int, k: Long, a: List<Class016c>): Int { | ^~~ a.cc:26:1: error: 'data' does not name a type 26 | data class Class016c(var a: Int, var b: Int) | ^~~~
s208755214
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, j, n) for (int i = j; i < n; i++) #define all(x) (x).begin(),(x).end() #define INF (1<<30) #define MOD (1000000007) ///////////////////////////////////////////////////////// bool comp(pair<ll ll> a, pair<ll, ll> b){ return a.first < b.first; } void Main(){ ll N, K; cin >> N >> K; vector<pair<ll, ll>> vp(N); rep(i, 0, N) cin >> vp[i].first >> vp[i].second; sort(all(vp), comp); ll cnt = 0; while(true){ if(vp[cnt].second < K){ K -= vp[cnt].second; cnt++; }else{ cout << vp[cnt].first << endl; break; } } } ///////////////////////////////////////////////////////// int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); //cout << std::fixed << std::setprecision(15); Main(); }
a.cc:11:16: error: two or more data types in declaration of 'type name' 11 | bool comp(pair<ll ll> a, pair<ll, ll> b){ | ^~ a.cc:11:21: error: wrong number of template arguments (1, should be 2) 11 | bool comp(pair<ll ll> a, pair<ll, ll> b){ | ^ 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, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair' 89 | struct pair; | ^~~~ a.cc: In function 'bool comp(int, std::pair<long long int, long long int>)': a.cc:12:12: error: request for member 'first' in 'a', which is of non-class type 'int' 12 | return a.first < b.first; | ^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:71: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Compare = bool (*)(int, std::pair<long long int, long long int>)]': /usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, pair<long long int, long long int>)>]' 1777 | if (__comp(__i, __first)) | ~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, pair<long long int, long long int>)>]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, pair<long long int, long long int>)>]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = bool (*)(int, pair<long long int, long long int>)]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:19:7: required from here 19 | sort(all(vp), comp); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:158:30: error: cannot convert 'std::pair<long long int, long long int>' to 'int' in argument passing 158 | { return bool(_M_comp(*__it1, *__it2)); } | ~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_comp_iter<_Compare>::operator()(_Value&, _Iterator) [with _Value = std::pair<long long int, long long int>; _Iterator = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Compare = bool (*)(int, std::pair<long long int, long long int>)]': /usr/include/c++/14/bits/stl_algo.h:1757:20: required from 'void std::__unguarded_linear_insert(_RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Val_comp_iter<bool (*)(int, pair<long long int, long long int>)>]' 1757 | while (__comp(__val, __next)) | ~~~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1785:36: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, pair<long long int, long long int>)>]' 1785 | std::__unguarded_linear_insert(__i, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ 1786 | __gnu_cxx::__ops::__val_comp_iter(__comp)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, pair<long long int, long long int>)>]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, pair<long long int, long long int>)>]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = bool (*)(int, pair<long long int, long long int>)]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:19:7: required from here 19 | sort(all(vp), comp); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:240:30: error: cannot convert 'std::pair<long long int, long long int>' to 'int' in argument passing 240 | { return bool(_M_comp(__val, *__it)); } | ~~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Value = std::pair<long long int, long long int>; _Compare = bool (*)(int, std::pair<long long int, long long int>)]': /usr/include/c++/14/bits/stl_heap.h:140:48: required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Distance = long int; _Tp = pair<long long int, long long int>; _Compare = __gnu_cxx::__ops::_Iter_comp_val<bool (*)(int, pair<long long int, long long int>)>]' 140 | while (__holeIndex > __topIndex && __comp(__first + __parent, __value)) | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:247:23: required from 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Distance = long int; _Tp = pair<long long int, long long int>; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, pair<long long int, long long int>)>]' 247 | std::__push_heap(__first, __holeIndex, __topIndex, | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | _GLIBCXX_MOVE(__value), __cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:356:22: required from 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, pair<long long int, long long int>)>]' 356 | std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value), | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 357 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, pair<long long int, long long int>)>]' 1593 | std::__make_heap(__first, __middle, __comp); | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.
s657653120
p03721
C++
#include <iostream> #include <vector> using namespace std; int main(){ int N; long long K; cin >> N >> K; int a[N+10],b[N+10]; for(int i = 0; i < N; i++){ cin >> a[i] >> b[i]; } long long c[100010]; for(int i = 0; i < 100010; i++){ c[i] = 0; } for(int i = 0; i < N; i++){ c[a[i]] += b[i]; } int count = 0; for(i = 1; i < 100010; i++){ count += c[i]; if(count >= K){ cout << i << endl; break; } } }
a.cc: In function 'int main()': a.cc:22:9: error: 'i' was not declared in this scope 22 | for(i = 1; i < 100010; i++){ | ^
s855637414
p03721
C++
var i,n:longint; a,b:array[1..200000] of longint; tmp,k:qword; procedure sort(l,r:longint); var i,j,x,y: longint; begin i:=l; j:=r; x:=a[(l + r) >> 1]; repeat while a[i] < x do i:=i + 1; while x < a[j] do j:=j - 1; if not(i > j) then begin y:=a[i]; a[i]:=a[j]; a[j]:=y; y:=b[i]; b[i]:=b[j]; b[j]:=y; i:=i + 1; j:=j - 1; end; until i > j; if l < j then sort(l,j); if i < r then sort(i,r); end; begin readln(n,k); for i:=1 to n do readln(a[i],b[i]); sort(1,n); for i:=1 to n do begin tmp+=b[i]; if tmp >= k then begin write(a[i]); break; end; end; end.
a.cc:2:15: error: too many decimal points in number 2 | a,b:array[1..200000] of longint; | ^~~~~~~~~ a.cc:1:1: error: 'var' does not name a type 1 | var i,n:longint; | ^~~ a.cc:2:5: error: 'a' does not name a type 2 | a,b:array[1..200000] of longint; | ^ a.cc:3:5: error: 'tmp' does not name a type 3 | tmp,k:qword; | ^~~ a.cc:4:1: error: 'procedure' does not name a type 4 | procedure sort(l,r:longint); | ^~~~~~~~~ a.cc:5:1: error: 'var' does not name a type 5 | var i,j,x,y: longint; | ^~~ a.cc:6:1: error: 'begin' does not name a type 6 | begin | ^~~~~ a.cc:7:9: error: 'j' does not name a type 7 | i:=l; j:=r; x:=a[(l + r) >> 1]; | ^ a.cc:7:15: error: 'x' does not name a type 7 | i:=l; j:=r; x:=a[(l + r) >> 1]; | ^ a.cc:8:3: error: 'repeat' does not name a type 8 | repeat | ^~~~~~ a.cc:10:5: error: expected unqualified-id before 'while' 10 | while x < a[j] do j:=j - 1; | ^~~~~ a.cc:11:5: error: expected unqualified-id before 'if' 11 | if not(i > j) then | ^~ a.cc:14:9: error: 'a' does not name a type 14 | a[i]:=a[j]; | ^ a.cc:15:9: error: 'a' does not name a type 15 | a[j]:=y; | ^ a.cc:16:9: error: 'y' does not name a type 16 | y:=b[i]; | ^ a.cc:17:9: error: 'b' does not name a type 17 | b[i]:=b[j]; | ^ a.cc:18:9: error: 'b' does not name a type 18 | b[j]:=y; | ^ a.cc:19:9: error: 'i' does not name a type 19 | i:=i + 1; j:=j - 1; | ^ a.cc:19:19: error: 'j' does not name a type 19 | i:=i + 1; j:=j - 1; | ^ a.cc:20:7: error: 'end' does not name a type 20 | end; | ^~~ a.cc:21:2: error: 'until' does not name a type 21 | until i > j; | ^~~~~ a.cc:22:2: error: expected unqualified-id before 'if' 22 | if l < j then sort(l,j); | ^~ a.cc:23:2: error: expected unqualified-id before 'if' 23 | if i < r then sort(i,r); | ^~ a.cc:24:1: error: 'end' does not name a type 24 | end; | ^~~ a.cc:25:1: error: 'begin' does not name a type 25 | begin | ^~~~~ a.cc:27:3: error: expected unqualified-id before 'for' 27 | for i:=1 to n do readln(a[i],b[i]); | ^~~ a.cc:28:7: error: expected constructor, destructor, or type conversion before '(' token 28 | sort(1,n); | ^ a.cc:29:3: error: expected unqualified-id before 'for' 29 | for i:=1 to n do | ^~~ a.cc:32:7: error: expected unqualified-id before 'if' 32 | if tmp >= k then | ^~ a.cc:35:11: error: expected unqualified-id before 'break' 35 | break; | ^~~~~ a.cc:36:9: error: 'end' does not name a type 36 | end; | ^~~ a.cc:37:5: error: 'end' does not name a type 37 | end; | ^~~ a.cc:38:1: error: 'end' does not name a type 38 | end. | ^~~
s607473530
p03721
C++
var i,n:longint; a,b:array[1..200000] of longint; tmp,k:qword; procedure sort(l,r:longint); var i,j,x,y: longint; begin i:=l; j:=r; x:=a[(l + r) >> 1]; repeat while a[i] < x do i:=i + 1; while x < a[j] do j:=j - 1; if not(i > j) then begin y:=a[i]; a[i]:=a[j]; a[j]:=y; y:=b[i]; b[i]:=b[j]; b[j]:=y; i:=i + 1; j:=j - 1; end; until i > j; if l < j then sort(l,j); if i < r then sort(i,r); end; begin readln(n,k); for i:=1 to n do readln(a[i],b[i]); sort(1,n); for i:=1 to n do begin tmp+=b[i]; if tmp >= k then begin write(a[i]); break; end; end; end.
a.cc:2:15: error: too many decimal points in number 2 | a,b:array[1..200000] of longint; | ^~~~~~~~~ a.cc:1:1: error: 'var' does not name a type 1 | var i,n:longint; | ^~~ a.cc:2:5: error: 'a' does not name a type 2 | a,b:array[1..200000] of longint; | ^ a.cc:3:5: error: 'tmp' does not name a type 3 | tmp,k:qword; | ^~~ a.cc:4:1: error: 'procedure' does not name a type 4 | procedure sort(l,r:longint); | ^~~~~~~~~ a.cc:5:1: error: 'var' does not name a type 5 | var i,j,x,y: longint; | ^~~ a.cc:6:1: error: 'begin' does not name a type 6 | begin | ^~~~~ a.cc:7:9: error: 'j' does not name a type 7 | i:=l; j:=r; x:=a[(l + r) >> 1]; | ^ a.cc:7:15: error: 'x' does not name a type 7 | i:=l; j:=r; x:=a[(l + r) >> 1]; | ^ a.cc:8:3: error: 'repeat' does not name a type 8 | repeat | ^~~~~~ a.cc:10:5: error: expected unqualified-id before 'while' 10 | while x < a[j] do j:=j - 1; | ^~~~~ a.cc:11:5: error: expected unqualified-id before 'if' 11 | if not(i > j) then | ^~ a.cc:14:9: error: 'a' does not name a type 14 | a[i]:=a[j]; | ^ a.cc:15:9: error: 'a' does not name a type 15 | a[j]:=y; | ^ a.cc:16:9: error: 'y' does not name a type 16 | y:=b[i]; | ^ a.cc:17:9: error: 'b' does not name a type 17 | b[i]:=b[j]; | ^ a.cc:18:9: error: 'b' does not name a type 18 | b[j]:=y; | ^ a.cc:19:9: error: 'i' does not name a type 19 | i:=i + 1; j:=j - 1; | ^ a.cc:19:19: error: 'j' does not name a type 19 | i:=i + 1; j:=j - 1; | ^ a.cc:20:7: error: 'end' does not name a type 20 | end; | ^~~ a.cc:21:2: error: 'until' does not name a type 21 | until i > j; | ^~~~~ a.cc:22:2: error: expected unqualified-id before 'if' 22 | if l < j then sort(l,j); | ^~ a.cc:23:2: error: expected unqualified-id before 'if' 23 | if i < r then sort(i,r); | ^~ a.cc:24:1: error: 'end' does not name a type 24 | end; | ^~~ a.cc:25:1: error: 'begin' does not name a type 25 | begin | ^~~~~ a.cc:27:3: error: expected unqualified-id before 'for' 27 | for i:=1 to n do readln(a[i],b[i]); | ^~~ a.cc:28:7: error: expected constructor, destructor, or type conversion before '(' token 28 | sort(1,n); | ^ a.cc:29:3: error: expected unqualified-id before 'for' 29 | for i:=1 to n do | ^~~ a.cc:32:7: error: expected unqualified-id before 'if' 32 | if tmp >= k then | ^~ a.cc:35:11: error: expected unqualified-id before 'break' 35 | break; | ^~~~~ a.cc:36:9: error: 'end' does not name a type 36 | end; | ^~~ a.cc:37:5: error: 'end' does not name a type 37 | end; | ^~~ a.cc:38:1: error: 'end' does not name a type 38 | end. | ^~~
s525027511
p03721
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using edge = pair<ll, P>; #define rep(i, n) for(ll i=0;i<(ll)(n);i++) #define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++) #define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--) using Graph = vector<vector<ll>>; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1}; const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1}; const ll MOD = 1000000007; const ll INF = 1000000000000000000L; #ifdef __DEBUG #include "cpp-pyprint/pyprint.h" #endif void Main() { ll N, K; cin >> N >> K; vector<P> items(N); rep(i, N) cin >> items[i].first >> items[i].second; priority_queue<P, vector<P>, greater<>> arr; rep(i, N) { arr.push(items[i]); } ll cnt = 0; while (!arr.empty()) { P p = arr.top(); print(p); arr.pop(); cnt += p.second; if (cnt >= K) { cout << p.first << endl; return; } } } int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); Main(); }
a.cc: In function 'void Main()': a.cc:36:9: error: 'print' was not declared in this scope; did you mean 'rint'? 36 | print(p); | ^~~~~ | rint
s133086604
p03721
C++
#include <iostream> #include <vector> using namespace std; int main() { int N long long K; cin >> N >> K; vector<long long> cnt(100001); for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; cnt[a] += b; } long long c = 0; for (int i = 0; i < 100001; i++) { c += cnt[i]; if (c >= K) { cout << i << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:7:5: error: expected initializer before 'long' 7 | long long K; | ^~~~ a.cc:8:12: error: 'N' was not declared in this scope 8 | cin >> N >> K; | ^ a.cc:8:17: error: 'K' was not declared in this scope 8 | cin >> N >> K; | ^
s419752838
p03721
C++
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> #include <utility> #include <tuple> #include <string> #include <cctype> #include <cstdio> #include <math.h> using i8 = int8_t; using u8 = uint8_t; using i16 = int16_t; using u16 = uint16_t; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; using f32 = float; using f64 = double; using f80 = __float80; constexpr i64 INF = 1'010'000'000'000'000'017LL; constexpr i64 MOD = 1'000'000'007LL; constexpr f64 EPS = 1e-12; constexpr f64 PI = 3.14159265358979323846; const int AMAX = 100000; using namespace std; #define rep(i, n) for (i64 i = 0; i < (int)(n); i++) #define FOR(i, m, n) for (i64 i = m; i < n; i++) #define SORT(x) sort(x.begin(), x.end()) #define REVE(x) reverse(x.begin(), x.end()) #define all(x) (x).begin(), (x).end() #define fst first #define mp make_pair #define pb push_back #define eb emplace_back #define pob pop_back #define sw swap #define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper); #define down(x) transform(x.begin(), x.end(), x.begin(), ::tolower); using LL = long long; using ULL = unsigned long long; 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; } int main(void) { vector<LL> cnt[AMAX + 1]; int N; LL K; cin >> N >> K; for (int i = 0; i < N; ++i) { int A, B; cin >> A >> B; cnt[A] += B; } SORT(cnt); for (int ans = 1; ans <= AMAX; ++ans){ if (K <= cnt[ans]) { cout << ans << endl; return 0; } } }
a.cc:13:12: error: 'uint8_t' does not name a type 13 | using u8 = uint8_t; | ^~~~~~~ a.cc:12:1: note: 'uint8_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 11 | #include <math.h> +++ |+#include <cstdint> 12 | using i8 = int8_t; a.cc:15:13: error: 'uint16_t' does not name a type 15 | using u16 = uint16_t; | ^~~~~~~~ a.cc:15:13: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:17:13: error: 'uint32_t' does not name a type 17 | using u32 = uint32_t; | ^~~~~~~~ a.cc:17:13: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:19:13: error: 'uint64_t' does not name a type 19 | using u64 = uint64_t; | ^~~~~~~~ a.cc:19:13: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc: In function 'int main()': a.cc:74:8: error: no match for 'operator+=' (operand types are 'std::vector<long long int>' and 'int') 74 | cnt[A] += B; | ~~~~~~~^~~~ a.cc:31:24: error: request for member 'begin' in 'cnt', which is of non-class type 'std::vector<long long int> [100001]' 31 | #define SORT(x) sort(x.begin(), x.end()) | ^~~~~ a.cc:77:1: note: in expansion of macro 'SORT' 77 | SORT(cnt); | ^~~~ a.cc:31:35: error: request for member 'end' in 'cnt', which is of non-class type 'std::vector<long long int> [100001]' 31 | #define SORT(x) sort(x.begin(), x.end()) | ^~~ a.cc:77:1: note: in expansion of macro 'SORT' 77 | SORT(cnt); | ^~~~ a.cc:79:8: error: no match for 'operator<=' (operand types are 'LL' {aka 'long long int'} and 'std::vector<long long int>') 79 | if (K <= cnt[ans]) { | ~ ^~ ~~~~~~~~ | | | | | std::vector<long long int> | LL {aka long long int} In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:469:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 469 | operator<=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:469:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'LL' {aka 'long long int'} 79 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/stl_iterator.h:513:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 513 | operator<=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:513:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'LL' {aka 'long long int'} 79 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1704:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1704 | operator<=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1704:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'LL' {aka 'long long int'} 79 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1767:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1767 | operator<=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1767:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'LL' {aka 'long long int'} 79 | if (K <= cnt[ans]) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1064:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1064 | operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1064:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'const std::pair<_T1, _T2>' and 'LL' {aka 'long long int'} 79 | if (K <= cnt[ans]) { | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:717:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 717 | operator<=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:717:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int' 79 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/string_view:724:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 724 | operator<=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:724:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int' 79 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/string_view:732:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 732 | operator<=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:732:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 79 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/basic_string.h:3956:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3956 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3956:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'LL' {aka 'long long int'} 79 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/basic_string.h:3970:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3970 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3970:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'LL' {aka 'long long int'} 79 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/basic_string.h:3983:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3983 | operator<=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3983:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'const _CharT*' and 'long long int' 79 | if (K <= cnt[ans]) { | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2625:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2625 | operator<=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2625:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'const std::tuple<_UTypes ...>' and 'LL' {aka 'long long int'} 79 | if (K <= cnt[ans]) { | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:2108:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<=(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2108 | operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2108:5: note: template argument deduction/substitution failed: a.cc:79:18: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'LL' {aka 'long long int'} 79 | if (K <= cnt[ans]) { | ^ In file included from /usr/include/c++/14/set:63, from a.cc:4: /usr/include/c++/14/bits/stl_set.h:1046:5: note: candidat
s032399617
p03721
C++
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> #include <utility> #include <tuple> #include <string> #include <cctype> #include <cstdio> #include <math.h> using i8 = int8_t; using u8 = uint8_t; using i16 = int16_t; using u16 = uint16_t; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; using f32 = float; using f64 = double; using f80 = __float80; constexpr i64 INF = 1'010'000'000'000'000'017LL; constexpr i64 MOD = 1'000'000'007LL; constexpr f64 EPS = 1e-12; constexpr f64 PI = 3.14159265358979323846; const int AMAX = 100000; using namespace std; #define rep(i, n) for (i64 i = 0; i < (int)(n); i++) #define FOR(i, m, n) for (i64 i = m; i < n; i++) #define SORT(x) sort(x.begin(), x.end()) #define REVE(x) reverse(x.begin(), x.end()) #define all(x) (x).begin(), (x).end() #define fst first #define mp make_pair #define pb push_back #define eb emplace_back #define pob pop_back #define sw swap #define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper); #define down(x) transform(x.begin(), x.end(), x.begin(), ::tolower); using LL = long long; using ULL = unsigned long long; 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; } int main(void) { vector<LL> cnt[AMAX + 1]; int N; ll K; cin >> N >> K; for (int i = 0; i < N; ++i) { int A, B; cin >> A >> B; cnt[A] += B; } SORT(cnt); for (int ans = 1; ans <= AMAX; ++ans){ if (K <= cnt[ans]) { cout << ans << endl; return 0; } } }
a.cc:13:12: error: 'uint8_t' does not name a type 13 | using u8 = uint8_t; | ^~~~~~~ a.cc:12:1: note: 'uint8_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 11 | #include <math.h> +++ |+#include <cstdint> 12 | using i8 = int8_t; a.cc:15:13: error: 'uint16_t' does not name a type 15 | using u16 = uint16_t; | ^~~~~~~~ a.cc:15:13: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:17:13: error: 'uint32_t' does not name a type 17 | using u32 = uint32_t; | ^~~~~~~~ a.cc:17:13: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:19:13: error: 'uint64_t' does not name a type 19 | using u64 = uint64_t; | ^~~~~~~~ a.cc:19:13: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc: In function 'int main()': a.cc:68:2: error: 'll' was not declared in this scope; did you mean 'LL'? 68 | ll K; | ^~ | LL a.cc:69:14: error: 'K' was not declared in this scope 69 | cin >> N >> K; | ^ a.cc:74:8: error: no match for 'operator+=' (operand types are 'std::vector<long long int>' and 'int') 74 | cnt[A] += B; | ~~~~~~~^~~~ a.cc:31:24: error: request for member 'begin' in 'cnt', which is of non-class type 'std::vector<long long int> [100001]' 31 | #define SORT(x) sort(x.begin(), x.end()) | ^~~~~ a.cc:77:1: note: in expansion of macro 'SORT' 77 | SORT(cnt); | ^~~~ a.cc:31:35: error: request for member 'end' in 'cnt', which is of non-class type 'std::vector<long long int> [100001]' 31 | #define SORT(x) sort(x.begin(), x.end()) | ^~~ a.cc:77:1: note: in expansion of macro 'SORT' 77 | SORT(cnt); | ^~~~
s625040453
p03721
C++
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> #include <utility> #include <tuple> #include <string> #include <cctype> #include <cstdio> #include <math.h> using i8 = int8_t; using u8 = uint8_t; using i16 = int16_t; using u16 = uint16_t; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; using f32 = float; using f64 = double; using f80 = __float80; constexpr i64 INF = 1'010'000'000'000'000'017LL; constexpr i64 MOD = 1'000'000'007LL; constexpr f64 EPS = 1e-12; constexpr f64 PI = 3.14159265358979323846; const int AMAX = 100000; using namespace std; #define rep(i, n) for (i64 i = 0; i < (int)(n); i++) #define FOR(i, m, n) for (i64 i = m; i < n; i++) #define SORT(x) sort(x.begin(), x.end()) #define REVE(x) reverse(x.begin(), x.end()) #define all(x) (x).begin(), (x).end() #define fst first #define mp make_pair #define pb push_back #define eb emplace_back #define pob pop_back #define sw swap #define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper); #define down(x) transform(x.begin(), x.end(), x.begin(), ::tolower); using LL = long long; using ULL = unsigned long long; 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; } vector<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; } SORT(cnt); for (int ans = 1; ans <= AMAX; ++ans){ if (K <= cnt[ans]) { cout << ans << endl; return 0; } } }
a.cc:13:12: error: 'uint8_t' does not name a type 13 | using u8 = uint8_t; | ^~~~~~~ a.cc:12:1: note: 'uint8_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 11 | #include <math.h> +++ |+#include <cstdint> 12 | using i8 = int8_t; a.cc:15:13: error: 'uint16_t' does not name a type 15 | using u16 = uint16_t; | ^~~~~~~~ a.cc:15:13: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:17:13: error: 'uint32_t' does not name a type 17 | using u32 = uint32_t; | ^~~~~~~~ a.cc:17:13: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:19:13: error: 'uint64_t' does not name a type 19 | using u64 = uint64_t; | ^~~~~~~~ a.cc:19:13: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:64:8: error: 'll' was not declared in this scope; did you mean 'LL'? 64 | vector<ll> cnt[AMAX + 1]; | ^~ | LL a.cc:64:10: error: template argument 1 is invalid 64 | vector<ll> cnt[AMAX + 1]; | ^ a.cc:64:10: error: template argument 2 is invalid a.cc: In function 'int main()': a.cc:67:2: error: 'll' was not declared in this scope; did you mean 'LL'? 67 | ll K; | ^~ | LL a.cc:68:14: error: 'K' was not declared in this scope 68 | cin >> N >> K; | ^ a.cc:31:24: error: request for member 'begin' in 'cnt', which is of non-class type 'int [100001]' 31 | #define SORT(x) sort(x.begin(), x.end()) | ^~~~~ a.cc:76:1: note: in expansion of macro 'SORT' 76 | SORT(cnt); | ^~~~ a.cc:31:35: error: request for member 'end' in 'cnt', which is of non-class type 'int [100001]' 31 | #define SORT(x) sort(x.begin(), x.end()) | ^~~ a.cc:76:1: note: in expansion of macro 'SORT' 76 | SORT(cnt); | ^~~~
s613193907
p03721
C++
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> #include <utility> #include <tuple> #include <string> #include <cctype> #include <cstdio> #include <math.h> using i8 = int8_t; using u8 = uint8_t; using i16 = int16_t; using u16 = uint16_t; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; using f32 = float; using f64 = double; using f80 = __float80; constexpr i64 INF = 1'010'000'000'000'000'017LL; constexpr i64 MOD = 1'000'000'007LL; constexpr f64 EPS = 1e-12; constexpr f64 PI = 3.14159265358979323846; using namespace std; #define rep(i, n) for (i64 i = 0; i < (int)(n); i++) #define FOR(i, m, n) for (i64 i = m; i < n; i++) #define SORT(x) sort(x.begin(), x.end()) #define REVE(x) reverse(x.begin(), x.end()) #define all(x) (x).begin(), (x).end() #define fst first #define mp make_pair #define pb push_back #define eb emplace_back #define pob pop_back #define sw swap #define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper); #define down(x) transform(x.begin(), x.end(), x.begin(), ::tolower); using LL = long long; using ULL = unsigned long long; 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; } int main() { cin.tie(0); ios::sync_with_stdio(false); cout << INF; } using ll = long long; const int AMAX = 100000; vector<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; } SORT(cnt); for (int ans = 1; ans <= AMAX; ++ans){ if (K <= cnt[ans]) { cout << ans << endl; return 0; } } }
a.cc:13:12: error: 'uint8_t' does not name a type 13 | using u8 = uint8_t; | ^~~~~~~ a.cc:12:1: note: 'uint8_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 11 | #include <math.h> +++ |+#include <cstdint> 12 | using i8 = int8_t; a.cc:15:13: error: 'uint16_t' does not name a type 15 | using u16 = uint16_t; | ^~~~~~~~ a.cc:15:13: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:17:13: error: 'uint32_t' does not name a type 17 | using u32 = uint32_t; | ^~~~~~~~ a.cc:17:13: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:19:13: error: 'uint64_t' does not name a type 19 | using u64 = uint64_t; | ^~~~~~~~ a.cc:19:13: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:73:5: error: redefinition of 'int main()' 73 | int main(void) { | ^~~~ a.cc:64:5: note: 'int main()' previously defined here 64 | int main() | ^~~~ a.cc: In function 'int main()': a.cc:81:8: error: no match for 'operator+=' (operand types are 'std::vector<long long int>' and 'int') 81 | cnt[A] += B; | ~~~~~~~^~~~ a.cc:30:24: error: request for member 'begin' in 'cnt', which is of non-class type 'std::vector<long long int> [100001]' 30 | #define SORT(x) sort(x.begin(), x.end()) | ^~~~~ a.cc:84:1: note: in expansion of macro 'SORT' 84 | SORT(cnt); | ^~~~ a.cc:30:35: error: request for member 'end' in 'cnt', which is of non-class type 'std::vector<long long int> [100001]' 30 | #define SORT(x) sort(x.begin(), x.end()) | ^~~ a.cc:84:1: note: in expansion of macro 'SORT' 84 | SORT(cnt); | ^~~~ a.cc:86:8: error: no match for 'operator<=' (operand types are 'll' {aka 'long long int'} and 'std::vector<long long int>') 86 | if (K <= cnt[ans]) { | ~ ^~ ~~~~~~~~ | | | | | std::vector<long long int> | ll {aka long long int} In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:469:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 469 | operator<=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:469:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'll' {aka 'long long int'} 86 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/stl_iterator.h:513:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 513 | operator<=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:513:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'll' {aka 'long long int'} 86 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1704:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1704 | operator<=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1704:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'll' {aka 'long long int'} 86 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1767:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1767 | operator<=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1767:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'll' {aka 'long long int'} 86 | if (K <= cnt[ans]) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1064:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1064 | operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1064:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'const std::pair<_T1, _T2>' and 'll' {aka 'long long int'} 86 | if (K <= cnt[ans]) { | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:717:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 717 | operator<=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:717:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int' 86 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/string_view:724:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 724 | operator<=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:724:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int' 86 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/string_view:732:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 732 | operator<=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:732:5: note: template argument deduction/substitution failed: a.cc:86:18: note: 'std::vector<long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 86 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/basic_string.h:3956:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3956 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3956:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'll' {aka 'long long int'} 86 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/basic_string.h:3970:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3970 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3970:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'll' {aka 'long long int'} 86 | if (K <= cnt[ans]) { | ^ /usr/include/c++/14/bits/basic_string.h:3983:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3983 | operator<=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3983:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'const _CharT*' and 'long long int' 86 | if (K <= cnt[ans]) { | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2625:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2625 | operator<=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2625:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'const std::tuple<_UTypes ...>' and 'll' {aka 'long long int'} 86 | if (K <= cnt[ans]) { | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:2108:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<=(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2108 | operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2108:5: note: template argument deduction/substitution failed: a.cc:86:18: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'll' {aka 'long long int'} 86 | if (K
s822077354
p03721
C++
#include <iostream> int main() { unsigned int N; unsigned int K; unsigned int arr[100000]; unsigned int a, b; unsigned int sum = 0; memset(arr, 0x0, sizeof(arr)); std::cin >> N >> K; for (int i = 0; i < N; i++) { std::cin >> a >> b; arr[a] += b; } for (int i = 0; i <= 100000; i++) { sum += arr[i]; if (sum >= K) { std::cout << i << '\n'; break; } } }
a.cc: In function 'int main()': a.cc:13:3: error: 'memset' was not declared in this scope 13 | memset(arr, 0x0, sizeof(arr)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <iostream> +++ |+#include <cstring> 4 |
s851016981
p03721
C++
#include <iostream> int main() { unsigned int N; unsigned int K; unsigned int arr[100000]; unsigned int a, b; unsigned int sum = 0; memset(arr, 0x0, sizeof(arr)); std::cin >> N >> K; for (int i = 0; i < N; i++) { std::cin >> a >> b; arr[a] += b; } for (int i = 0; i < 5; i++) { sum += arr[i]; if (sum >= K) { std::cout << i << '\n'; break; } } }
a.cc: In function 'int main()': a.cc:14:3: error: 'memset' was not declared in this scope 14 | memset(arr, 0x0, sizeof(arr)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <iostream> +++ |+#include <cstring> 5 |
s276227033
p03721
Java
import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; public class Main061 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); HashMap<Integer,Integer>m = new HashMap<Integer,Integer>(); int n = sc.nextInt(); long k = sc.nextInt(); int []a = new int [n]; int []b = new int [n]; for(int i = 0; i< n ; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt(); m.put(a[i], b[i]); } Arrays.sort(a); long sum = 0; int ans = 0; for(int i = 0; i < n; i++) { sum += (long)m.get(a[i]); if(k <= sum) { ans = a[i]; break; } } System.out.println(ans); } }
Main.java:5: error: class Main061 is public, should be declared in a file named Main061.java public class Main061 { ^ 1 error
s235157170
p03721
C++
p#include <bits/stdc++.h> using namespace std; using ll = long long; const int AMAX = 100000; ll bucket[AMAX + 1]; int main() { int N, K; cin >> N, K; int bucket[N]; int a, b; for (int i = 0; i < N; i++) { cin >> a >> b; bucket[a] = b; } for (int i = 0; i < AMAX; i++) { if (K <= bucket[i]) { cout << i << endl; break; } K -= bucket[i]; } return 0; }
a.cc:1:2: error: stray '#' in program 1 | p#include <bits/stdc++.h> | ^ a.cc:1:1: error: 'p' does not name a type 1 | p#include <bits/stdc++.h> | ^ a.cc: In function 'int main()': a.cc:11:3: error: 'cin' was not declared in this scope 11 | cin >> N, K; | ^~~ a.cc:22:7: error: 'cout' was not declared in this scope 22 | cout << i << endl; | ^~~~ a.cc:22:20: error: 'endl' was not declared in this scope 22 | cout << i << endl; | ^~~~
s490003195
p03721
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int n,k; cin >> n >> k; long long in[100001]; memset(in,0,sizeof in); for(int i=0;i<n;i++){ int a,b; cin >> a >> b; in[a] += b; } long long sum = 0; int ans; for(int i=1;i<=100000;i++){ sum +=in[i]; if(sum >= k){ ans = i; break; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:5: error: 'memset' was not declared in this scope 10 | memset(in,0,sizeof in); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<algorithm> +++ |+#include <cstring> 4 | using namespace std;
s331735440
p03721
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int n,k; cin >> n >> k; long long in[100001]; memset(in,0,sizeof(in)); for(int i=0;i<n;i++){ int a,b; cin >> a >> b; in[a] += b; } long long sum = 0; int ans; for(int i=1;i<=100000;i++){ sum +=in[i]; if(sum >= k){ ans = i; break; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:5: error: 'memset' was not declared in this scope 10 | memset(in,0,sizeof(in)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<algorithm> +++ |+#include <cstring> 4 | using namespace std;
s562234071
p03721
C++
#include <iostream> typedef long long ll using namespace std; int main() { ll n, k, a, b; ll NMAX=1e5+1; ll buckets[NMAX] = {0}; cin >> n >> k; for(ll i=0; i<n; i++) { cin >> a >> b; buckets[a] += b; } ll i=0, sum=0; while(sum+buckets[i]<k) sum += buckets[i++]; cout << i << endl; return 0; }
a.cc:3:1: error: expected initializer before 'using' 3 | using namespace std; | ^~~~~ a.cc: In function 'int main()': a.cc:6:5: error: 'll' was not declared in this scope 6 | ll n, k, a, b; | ^~ a.cc:7:7: error: expected ';' before 'NMAX' 7 | ll NMAX=1e5+1; | ^~~~~ | ; a.cc:8:7: error: expected ';' before 'buckets' 8 | ll buckets[NMAX] = {0}; | ^~~~~~~~ | ; a.cc:9:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 9 | cin >> n >> k; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:9:12: error: 'n' 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:10:11: error: expected ';' before 'i' 10 | for(ll i=0; i<n; i++) { | ^~ | ; a.cc:10:17: error: 'i' was not declared in this scope 10 | for(ll i=0; i<n; i++) { | ^ a.cc:11:16: error: 'a' was not declared in this scope 11 | cin >> a >> b; | ^ a.cc:11:21: error: 'b' was not declared in this scope 11 | cin >> a >> b; | ^ a.cc:12:9: error: 'buckets' was not declared in this scope 12 | buckets[a] += b; | ^~~~~~~ a.cc:15:7: error: expected ';' before 'i' 15 | ll i=0, sum=0; | ^~ | ; a.cc:16:11: error: 'sum' was not declared in this scope 16 | while(sum+buckets[i]<k) sum += buckets[i++]; | ^~~ a.cc:16:15: error: 'buckets' was not declared in this scope 16 | while(sum+buckets[i]<k) sum += buckets[i++]; | ^~~~~~~ a.cc:16:23: error: 'i' was not declared in this scope 16 | while(sum+buckets[i]<k) sum += buckets[i++]; | ^ a.cc:17:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 17 | cout << i << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:17:13: error: 'i' was not declared in this scope 17 | cout << i << endl; | ^ a.cc:17:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 17 | cout << i << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s650607685
p03721
C++
#include <vector> #include <utility> #include <algorithm> using namespace std; int N; long long K; vector<pair<int,int> > v; int main(){ cin >> N >> K; int a,b; for(int i=0;i<N;i++){ cin >> a >> b; v.push_back(make_pair(a,b)); } sort(v.begin(),v.end()); long long count = 0; for(int i=0;i<N;i++){ count += v[i].second; if(K <= count){ cout << v[i].first << endl; break; } } return 0; }
a.cc: In function 'int main()': a.cc:12:5: error: 'cin' was not declared in this scope 12 | cin >> N >> K; | ^~~ a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 3 | #include <algorithm> +++ |+#include <iostream> 4 | a.cc:23:13: error: 'cout' was not declared in this scope 23 | cout << v[i].first << endl; | ^~~~ a.cc:23:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:23:35: error: 'endl' was not declared in this scope 23 | cout << v[i].first << endl; | ^~~~ a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 3 | #include <algorithm> +++ |+#include <ostream> 4 |
s859838199
p03721
C++
#include <vector> #include <utility> #include <algorithm> using namespace std; int N; long long K; vector<pair<int,int> > v; int main(){ cin >> N >> K; int a,b; for(int i=0;i<N;i++){ cin >> a >> b; v.push_back(make_pair(a,b)); } sort(v.begin(),v.end()); long long count = 0; for(int i=0;i<N;i++){ count += v[i].second; if(K <= count){ cout << v[i].first << endl; break; } } return 0;
a.cc: In function 'int main()': a.cc:12:5: error: 'cin' was not declared in this scope 12 | cin >> N >> K; | ^~~ a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 3 | #include <algorithm> +++ |+#include <iostream> 4 | a.cc:23:13: error: 'cout' was not declared in this scope 23 | cout << v[i].first << endl; | ^~~~ a.cc:23:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:23:35: error: 'endl' was not declared in this scope 23 | cout << v[i].first << endl; | ^~~~ a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 3 | #include <algorithm> +++ |+#include <ostream> 4 | a.cc:27:14: error: expected '}' at end of input 27 | return 0; | ^ a.cc:11:11: note: to match this '{' 11 | int main(){ | ^
s724688897
p03721
C++
#include<iostream> using namespace std; struct node{ long long f; long long num; }; struct node data[100010]; long long main(){ long long N,K; while(cin>>N>>K){ for(long long i=0;i<N;i++){ cin>>data[i].f>>data[i].num; }//输入数据 struct node temp; for(long long i=0;i<N;i++){ for(long long j=0;j<N-1-i;j++){ if(data[j].f>data[j+1].f){ temp=data[j+1]; data[j+1]=data[j]; data[j]=temp; } } }//从小到大排序 long long sum=0; for(long long i=0;i<N;i++){ sum=sum+data[i].num; if(sum>=K){ cout<<data[i].f<<endl; break; } } } return 0; }
cc1plus: error: '::main' must return 'int' a.cc: In function 'int main()': a.cc:12:18: error: reference to 'data' is ambiguous 12 | cin>>data[i].f>>data[i].num; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:13: note: 'node data [100010]' 7 | struct node data[100010]; | ^~~~ a.cc:12:29: error: reference to 'data' is ambiguous 12 | cin>>data[i].f>>data[i].num; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:13: note: 'node data [100010]' 7 | struct node data[100010]; | ^~~~ a.cc:17:20: error: reference to 'data' is ambiguous 17 | if(data[j].f>data[j+1].f){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:13: note: 'node data [100010]' 7 | struct node data[100010]; | ^~~~ a.cc:17:30: error: reference to 'data' is ambiguous 17 | if(data[j].f>data[j+1].f){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:13: note: 'node data [100010]' 7 | struct node data[100010]; | ^~~~ a.cc:18:26: error: reference to 'data' is ambiguous 18 | temp=data[j+1]; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:13: note: 'node data [100010]' 7 | struct node data[100010]; | ^~~~ a.cc:19:21: error: reference to 'data' is ambiguous 19 | data[j+1]=data[j]; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:13: note: 'node data [100010]' 7 | struct node data[100010]; | ^~~~ a.cc:19:31: error: reference to 'data' is ambiguous 19 | data[j+1]=data[j]; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:13: note: 'node data [100010]' 7 | struct node data[100010]; | ^~~~ a.cc:20:21: error: reference to 'data' is ambiguous 20 | data[j]=temp; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:13: note: 'node data [100010]' 7 | struct node data[100010]; | ^~~~ a.cc:26:21: error: reference to 'data' is ambiguous 26 | sum=sum+data[i].num; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^
s904946279
p03721
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; long long K; cin >> N >> K; vector<int> A(pow(10, 5) + 1); int a, b; for (int i=0; i<N; ++i) { cin >> a >> b; A[a] += b; } long long cnt = 0; for (int ans=1; ans<=pow(10, 5); ++ans) { if (K <= cnt[ans]) { cout << ans << endl; break; } K -= cnt[ans]; } }
a.cc: In function 'int main()': a.cc:18:17: error: invalid types 'long long int[int]' for array subscript 18 | if (K <= cnt[ans]) { | ^ a.cc:22:13: error: invalid types 'long long int[int]' for array subscript 22 | K -= cnt[ans]; | ^