submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s869461523
p03721
C++
#include<iostream> using namespace std; int main() { int check[100000]; int n, k; cin >> n >> k; int cnt = 0; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; for (int j = 0; j < b; j++) { check[cnt] = a; cnt++; } }/* for (int i = 0; i < cnt; i++) { cout << check[i] << endl; }*/ sort(check, check + n); cout << check[k - 1] << endl; }
a.cc: In function 'int main()': a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'short'? 19 | sort(check, check + n); | ^~~~ | short
s820377874
p03721
C
#include<stdio.h> int main(){ long long k,tmp=0,ans[100001]={0}; int n;scanf("%d%d",&n,&k); int a,b,i; long long tmp=0,ans[100001]={0}; for(i=0;i<n;i++){ scanf("%d%d",&a,&b); ans[a]+=b; } for(i=1;i<100001;i++){ tmp+=ans[i]; if(tmp>=k){ printf("%d\n",i); return 0; } } }
main.c: In function 'main': main.c:7:27: error: redefinition of 'tmp' 7 | long long tmp=0,ans[100001]={0}; | ^~~ main.c:4:29: note: previous definition of 'tmp' with type 'long long int' 4 | long long k,tmp=0,ans[100001]={0}; | ^~~ main.c:7:33: error: redefinition of 'ans' 7 | long long tmp=0,ans[100001]={0}; | ^~~ main.c:4:35: note: previous definition of 'ans' with type 'long long int[100001]' 4 | long long k,tmp=0,ans[100001]={0}; | ^~~
s516923466
p03721
C++
#include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define se second #define FOR(i, a, b) for(int i=(a);i<(b);i++) #define REP(i, n) FOR(i, 0, n) #define RFOR(i, a, b) for(int i=(a);i>=(b);i--) #define RREP(i, n) FOR(i, n, 0) #define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++) #define ALL(a) (a).begin(), (a).end() #define SZ(x) ((int)(x).size()) typedef long long int ll; typedef pair<int, int> P; typedef vector<int> vi; typedef vector<vi> vvi; const double eps = 1e-10; const int MOD = 1000000007; void printv(vector<auto> const& s) { REP(i, s.size()) { cout << s[i] << endl; } } void print(auto const s) { cout << s << endl; } int main () { cin.tie(0); cout << setprecision(10); int n, k; cin >> n >> k; vector<PLL> p(n); REP(i, n) { cin >> p[i].fi >> p[i].se; } sort(ALL(p)); ll cnt = 0; REP(i, n) { cnt += p[i].se; if(cnt >= k) { cout << p[i].fi << endl; break; } } }
a.cc:24:20: warning: use of 'auto' in template argument only available with '-fconcepts-ts' 24 | void printv(vector<auto> const& s) { | ^~~~ a.cc:30:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 30 | void print(auto const s) { | ^~~~ a.cc: In function 'int main()': a.cc:39:10: error: 'PLL' was not declared in this scope; did you mean 'ALL'? 39 | vector<PLL> p(n); | ^~~ | ALL a.cc:39:13: error: template argument 1 is invalid 39 | vector<PLL> p(n); | ^ a.cc:39:13: error: template argument 2 is invalid a.cc:41:13: error: invalid types 'int[int]' for array subscript 41 | cin >> p[i].fi >> p[i].se; | ^ a.cc:41:24: error: invalid types 'int[int]' for array subscript 41 | cin >> p[i].fi >> p[i].se; | ^ a.cc:13:20: error: request for member 'begin' in 'p', which is of non-class type 'int' 13 | #define ALL(a) (a).begin(), (a).end() | ^~~~~ a.cc:44:8: note: in expansion of macro 'ALL' 44 | sort(ALL(p)); | ^~~ a.cc:13:33: error: request for member 'end' in 'p', which is of non-class type 'int' 13 | #define ALL(a) (a).begin(), (a).end() | ^~~ a.cc:44:8: note: in expansion of macro 'ALL' 44 | sort(ALL(p)); | ^~~ a.cc:48:13: error: invalid types 'int[int]' for array subscript 48 | cnt += p[i].se; | ^ a.cc:50:16: error: invalid types 'int[int]' for array subscript 50 | cout << p[i].fi << endl; | ^
s324355243
p03721
C++
#include<bits/stdc++.h> using namespace std; int main(void){ int n, k, so[100010]; for(int i=;i<100010;++i) so[i] = 0; cin >> n >> k; for(int i=0;i<n;++i){ int a, b; cin >> a >> b; so[a] = b; } int sum = 0; for(int i=0;i<n;++i){ sum += so[i]; if(sum >= k){ cout << i << endl; return 0 } }
a.cc: In function 'int main()': a.cc:6:13: error: expected primary-expression before ';' token 6 | for(int i=;i<100010;++i) so[i] = 0; | ^ a.cc:18:15: error: expected ';' before '}' token 18 | return 0 | ^ | ; 19 | } | ~ a.cc:20:2: error: expected '}' at end of input 20 | } | ^ a.cc:4:15: note: to match this '{' 4 | int main(void){ | ^
s503927175
p03721
C++
#include <iostream> #include <vector> #include <array> #include <utility> using namespace std; int main(){ // 3 4 // 1 1 // 2 2 // 3 3 int N,K; cin >> N >> K; std::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()); for(int i=0; i<N; i++){ K-=v[i].second; if(K<=0){ cout << v[i].first << endl; return 1; } } }
a.cc: In function 'int main()': a.cc:29:9: error: 'sort' was not declared in this scope; did you mean 'short'? 29 | sort(v.begin(), v.end()); | ^~~~ | short
s792313980
p03721
C++
#include <bits/stdc++.h> using namespace std; long long mon[100005]; int main(){ int a; long long b; cin >> a >> b; for (int i = 0; i < a; ++i) { int aa, bb; cin >> aa >> bb; mon[aa] += bb; } for (int i = 1; i <= 100005; ++i){ if (b <= mon[ans]) { cout << i << endl; break; } b -= mon[i]; } }
a.cc: In function 'int main()': a.cc:14:22: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | if (b <= mon[ans]) { | ^~~ | abs
s857640333
p03721
C++
/// Containers Start #include <iostream> #include <string> #include <sstream> #include <set> #include <map> #include <unordered_map> #include <stack> #include <queue> #include <vector> #include <utility> #include <iomanip> #include <sstream> #include <bitset> #include <cstdlib> #include <iterator> #include <algorithm> #include <functional> #include <random> /// C Header Files #include <stdio.h> #include <cstdio> #include <cctype> #include <cmath> #include <math.h> #include <ctime> #include <cstring> /// Containers End using namespace std; /// Math Start #define PI acos(-1.0) #define Pi 3.141592653589793 #define EPS (1e-7) #define INF (0x3f3f3f3f) /// Math End /// Extra Start #define nn '\n' #define pb push_back #define SS stringstream #define ull unsigned long long #define mod 1000000007 #define SIZE 2000001 #define _cin \ ios_base::sync_with_stdio(0); \ cin.tie(0); #define sz(a) int((a).size()) #define space " " #define All(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define Ignore cin.ignore() #define StringToInt \ if (!(istringstream(s) >> n)) \ n = 0; #define SORT(c) sort(All((c))) #define RSORT(c) sort(rall((c))) /// Extra End /// Functions Start template <class T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); } template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template <class T> string converter(T n) { SS x; x << n; return x.str(); } string itos(int a) { string s = to_string(a); return s; } template <class T> T mod_pow(T x, T n) { T res = 1; while (n > 0) { if (n & 1) res = res * x % mod; x = x * x % mod; n >>= 1; } return res; } std::vector<std::string> split(const std::string &str, char sep) { std::vector<std::string> v; std::stringstream ss(str); std::string buffer; while (std::getline(ss, buffer, sep)) { v.push_back(buffer); } return v; } #define rep(i, n) for (int i = 0; i < n; i++) #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define for_arr(array) for (auto &i : array) #define FORD(i, a, b) for (int i = (a); i >= (b); i--) #define FORA(arr) for (auto &i : arr) #define Cin(a) cin >> a; #define Cin2(a, b) cin >> a >> b; #define Cin3(a, b, c) cin >> a >> b >> c; #define Cin4(a, b, c, d) cin >> a >> b >> c >> d; #define Cini(a) \ int a; \ cin >> a; #define Cinii(a, b) \ int a, b; \ cin >> a >> b; #define Ciniii(a, b, c) \ int a, b, c; \ cin >> a >> b >> c; #define Cins(s) \ string s; \ cin >> s; #define Cinss(s1, s2) \ string s1, s2; \ cin >> s1 >> s2; #define Cinc(c) \ char c; \ cin >> c; /// Functions End /// Array Start #define SET(a) memset(a, -1, sizeof a) #define CLR(a) memset(a, 0, sizeof a) #define MEM(a, val) memset(a, val, sizeof a) /// Array End /// Graph Start struct edge { int from, to; long long cost; }; /// Graph End /// Debug Start #define deb(x) cout << #x << ": " << x << endl #define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl #define deb3(x, y, z) cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z << end /// Debug End /// TypeDef Start typedef long long int ll; typedef map<string, int> msi; typedef map<int, int> mii; typedef map<ll, ll> mll; typedef map<char, int> mci; typedef map<int, string> mis; typedef pair<int, int> pii; typedef pair<string, int> psi; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<string> vs; typedef vector<char> vc; typedef vector<bool> vb; typedef vector<pii> vii; /// TypeDef End int dx[] = {-1, 0, 1, 0}; int dy[] = {0, -1, 0, 1}; /**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/ ///topcoder template bool mysort(pair<int, int> a, pair<int, int> b) { return a.second > b.second; } int digit_sum(int n) { int p = n; int sum = 0; while (p > 0) { sum += p % 10; p = (p - p % 10) / 10; } return sum; } int _digit(ll n) { int d = 0; while (n > 0) { d++; n = (n - n % 10) / 10; } return d; } int main(void) { ll n, k; cin >> n >> k; ll count = 0; int ans = 0; rep(i, n) { int a, b; cin >> a >> b; rep(j, b) { count++; if (count == k) { ans = a; } } } cout << a << nn; return 0; }
a.cc: In function 'int main()': a.cc:233:13: error: 'a' was not declared in this scope 233 | cout << a << nn; | ^
s577616466
p03721
Java
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Map; import java.util.Set; import java.util.TreeMap; public class Main { public static void main(String[] args) throws IOException { try (InputReader reader = new InputReader(System.in)) { solve(reader); } } private static void solve(InputReader reader) throws IOException { long[] input = reader.readLongsSplitByDelimiter(" "); Map<Long, Long> map = new TreeMap<>(); for (long i = 0; i < input[0]; i++) { long[] longs = reader.readLongsSplitByDelimiter(" "); Long value = map.getOrDefault(longs[0], 0L) + longs[1]; map.put(longs[0], value); } long sum = 0; for (Map.Entry<Integer, Long> e : map.entrySet()) { sum += e.getValue(); if (sum >= input[1]) { System.out.println(e.getKey()); return; } } } } class Util { static int gcd(int m, int n) { int min = Math.min(m, n); int max = Math.max(m, n); while (min != 0) { int tmp = min; min = max % tmp; max = tmp; } return max; } } class InputReader implements Closeable, AutoCloseable { private final BufferedReader br; InputReader(InputStream inputStream) { this.br = new BufferedReader(new InputStreamReader(inputStream)); } String readLine() throws IOException { return this.br.readLine(); } int readInt() throws IOException { return Integer.parseInt(this.readLine()); } long readLong() throws IOException { return Long.parseLong(this.readLine()); } double readDouble() throws IOException { return Double.parseDouble(this.readLine()); } String[] readStringsSplitByDelimiter(String delimiter) throws IOException { return this.readLine().split(delimiter); } int[] readIntsSplitByDelimiter(String delimiter) throws IOException { String[] strings = this.readStringsSplitByDelimiter(delimiter); int stringsLength = strings.length; int[] ints = new int[stringsLength]; for (int i = 0; i < stringsLength; i++) { ints[i] = Integer.parseInt(strings[i]); } return ints; } long[] readLongsSplitByDelimiter(String delimiter) throws IOException { String[] strings = this.readStringsSplitByDelimiter(delimiter); int stringsLength = strings.length; long[] longs = new long[stringsLength]; for (int i = 0; i < stringsLength; i++) { longs[i] = Long.parseLong(strings[i]); } return longs; } double[] readDoublesSplitByDelimiter(String delimiter) throws IOException { String[] strings = this.readStringsSplitByDelimiter(delimiter); int stringsLength = strings.length; double[] doubles = new double[stringsLength]; for (int i = 0; i < stringsLength; i++) { doubles[i] = Double.parseDouble(strings[i]); } return doubles; } @Override public void close() throws IOException { this.br.close(); } }
Main.java:29: error: incompatible types: Entry<Long,Long> cannot be converted to Entry<Integer,Long> for (Map.Entry<Integer, Long> e : map.entrySet()) { ^ 1 error
s719099959
p03721
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long int n,k,sum=0,che,s=0;cin>>n>>k; long long int a[n],b[n]; vector<long long int> v(n),w={}; for(long long int i=0;i<n;i++) cin>>a[i]>>b[i]; for(long long int i=0;i<n;i++) v.at(i)=a[i]; sort(v.begin(),v.end()); w.push_back(v.at(0)); che=v.at(0); for(long long int i=1;i<n;i++){ if(che!=v.at(i)){ w.push_back(v.at(i)); che=v.at(i); } } for(long long int i=0;i<w.size();i++){ for(long long int j=0;j<n;j++){ if(a[j]==w.at(i)){ sum+=b[j]; } if(sum>=k){ s=1; cout<<w.at(i)<<endl; break; } } if(s==1) break; } } }
a.cc:32:1: error: expected declaration before '}' token 32 | } | ^
s171639354
p03721
Java
import java.util.*; public class Main { public static void main(Stirng args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); ArrayList<Integer> box = new ArrayList<>(); for (int i = 0; i < n; i++) { int a = sc.nextInt(); int b = sc.nextInt(); for(int j = 0; j < b; j++) { box.add(a); } } System.out.println(box.get(k - 1)); } }
Main.java:4: error: cannot find symbol public static void main(Stirng args[]) { ^ symbol: class Stirng location: class Main 1 error
s171203491
p03721
C++
//17:14 #include <stdio.h> #include <string.h> #include <algorithm> #include <map> using namespace std; typedef long long ll; ll max(ll a, ll b){return(a>b)?a:b;} ll min(ll a, ll b){return(a<b)?a:b;} ll abs(ll a){return(a<0)?-a:a;} ll gcd(ll a, ll b){ if(b > a){ ll tmp = b; b = a; a = tmp; } if(b == 0) return a; else return gcd(b, a%b); } ll lcm(ll a, ll b){ ll gcdi = gcd(a,b); return a/gcdi*(b); } ll diff(ll a, ll b, ll c){ return max(a,max(b,c))-min(a,min(b,c)); } #define MOD (1000000000+7) typedef struct tuple{ ll a,b; }tuple; tuple arr[100000]; int main(){ ll N,K; scanf("%lld %lld",&N,&K); map<ll,ll> dict; ll a,b; for(int i = 0; i < N; i++){ scanf("%lld %lld",&a,&b); dict[a] += b; } map<ll,ll>::iterator it = dict.begin(); while(it != dict.end()){ K -= it->second; if(K <= 0) break; ++it; } printf("%lld\n",it->first); }
a.cc:35:1: error: reference to 'tuple' is ambiguous 35 | tuple arr[100000]; | ^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from a.cc:4: /usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple' 92 | class tuple; | ^~~~~ a.cc:33:2: note: 'typedef struct tuple tuple' 33 | }tuple; | ^~~~~
s081215731
p03721
C++
//17:14 #include <stdio.h> #include <string.h> #include <algorithm> #include <map> using namespace std; typedef long long ll; ll max(ll a, ll b){return(a>b)?a:b;} ll min(ll a, ll b){return(a<b)?a:b;} ll abs(ll a){return(a<0)?-a:a;} ll gcd(ll a, ll b){ if(b > a){ ll tmp = b; b = a; a = tmp; } if(b == 0) return a; else return gcd(b, a%b); } ll lcm(ll a, ll b){ ll gcdi = gcd(a,b); return a/gcdi*(b); } ll diff(ll a, ll b, ll c){ return max(a,max(b,c))-min(a,min(b,c)); } #define MOD (1000000000+7) typedef struct tuple{ ll a,b; }tuple; tuple arr[100000]; int main(){ ll N,K; scanf("%lld %lld",&N,&K); map<ll,ll> dict; ll a,b; for(int i = 0; i < N; i++){ scanf("%lld %lld",&a,&b); dict[a] += b; } map<ll,ll>::iterator it = dict.begin(); while(it != dict.end()){ K -= it->second; if(K <= 0) break; ++it; } printf("%lld\n",it->first); } ~
a.cc:35:1: error: reference to 'tuple' is ambiguous 35 | tuple arr[100000]; | ^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from a.cc:4: /usr/include/c++/14/bits/stl_pair.h:92:11: note: candidates are: 'template<class ...> class std::tuple' 92 | class tuple; | ^~~~~ a.cc:33:2: note: 'typedef struct tuple tuple' 33 | }tuple; | ^~~~~ a.cc:57:2: error: expected class-name at end of input 57 | ~ | ^
s103231190
p03721
C++
#include<iostream> #include<vector> #include<algorithm> #include<cmath> #include<map> using namespace std; int main() { using ll = long long; const int AMAX = 100000; ll cnt[AMAX + 1]; int n, i, a, b, ans; ll k; cin >> n >> k; for (i = 0; i < n; i++) { cin >> a >> B; cnt[a] += b; } for (ans = 1; ans <= AMAX; ans++) { if (k <= cnt[ans]) { cout << ans; break; } k -= cnt[ans]; } return 0; }
a.cc: In function 'int main()': a.cc:19:29: error: 'B' was not declared in this scope 19 | cin >> a >> B; | ^
s770817761
p03721
C++
/* |\_/| |* *| \_+_/ */ #include<bits/stdc++.h> #define endl '\n' using namespace std; int main(){ cin.tie(0); // cout と cin の同期を切る ios::sync_with_stdio(false); /* cの stdioストリーム (printfとか)と*/ long logn N,K; cin>>N>>K; long long ans[100001]={ }; int a,b; for(int i=0;i<N;i++){ cin>>a>>b; ans[a]+=b; } long long cnt=0; for(int i=1;i<=100000;i++){ cnt+=ans[i]; if(cnt>=K){ cout<<i<<endl; break; } } return 0; }
a.cc: In function 'int main()': a.cc:18:13: error: expected initializer before 'N' 18 | long logn N,K; | ^ a.cc:20:8: error: 'N' was not declared in this scope 20 | cin>>N>>K; | ^ a.cc:20:11: error: 'K' was not declared in this scope 20 | cin>>N>>K; | ^
s018374727
p03721
C++
#include<bits/stdc++.h> #define MAX 100005 using namespace std; int main(){ int n, a, b; long long k; map<int, long long> m; scanf("%d%lld", &n, &k); for(int i = 0; i < n; i++){ scanf("%d%d", &a, &b); if(m.find(a) == m.end()) m[a] = b; else m[a] += b; } map<int, int>::iterator it; for(it = m.begin(); it != m.end(); it++){ pair<int, long long> p = *it; k -= p.second; if(k <= 0){ printf("%d\n", p.first); break; } } }
a.cc: In function 'int main()': a.cc:16:20: error: no match for 'operator=' (operand types are 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} and 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'}) 16 | for(it = m.begin(); it != m.end(); it++){ | ^ In file included from /usr/include/c++/14/map:62, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152, from a.cc:1: /usr/include/c++/14/bits/stl_tree.h:252:12: note: candidate: 'constexpr std::_Rb_tree_iterator<std::pair<const int, int> >& std::_Rb_tree_iterator<std::pair<const int, int> >::operator=(const std::_Rb_tree_iterator<std::pair<const int, int> >&)' 252 | struct _Rb_tree_iterator | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:252:12: note: no known conversion for argument 1 from 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} to 'const std::_Rb_tree_iterator<std::pair<const int, int> >&' /usr/include/c++/14/bits/stl_tree.h:252:12: note: candidate: 'constexpr std::_Rb_tree_iterator<std::pair<const int, int> >& std::_Rb_tree_iterator<std::pair<const int, int> >::operator=(std::_Rb_tree_iterator<std::pair<const int, int> >&&)' /usr/include/c++/14/bits/stl_tree.h:252:12: note: no known conversion for argument 1 from 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} to 'std::_Rb_tree_iterator<std::pair<const int, int> >&&' a.cc:16:26: error: no match for 'operator!=' (operand types are 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} and 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'}) 16 | for(it = m.begin(); it != m.end(); it++){ | ~~ ^~ ~~~~~~~ | | | | | _Rb_tree_iterator<pair<[...],long long int>> | _Rb_tree_iterator<pair<[...],int>> In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181: /usr/include/c++/14/bits/regex.h:1132:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1132 | operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1132:5: note: template argument deduction/substitution failed: a.cc:16:35: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 16 | for(it = m.begin(); it != m.end(); it++){ | ^ /usr/include/c++/14/bits/regex.h:1212:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator!=(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1212 | operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1212:5: note: template argument deduction/substitution failed: a.cc:16:35: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 16 | for(it = m.begin(); it != m.end(); it++){ | ^ /usr/include/c++/14/bits/regex.h:1305:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1305 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1305:5: note: template argument deduction/substitution failed: a.cc:16:35: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 16 | for(it = m.begin(); it != m.end(); it++){ | ^ /usr/include/c++/14/bits/regex.h:1379:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1379 | operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1379:5: note: template argument deduction/substitution failed: a.cc:16:35: note: 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 16 | for(it = m.begin(); it != m.end(); it++){ | ^ /usr/include/c++/14/bits/regex.h:1473:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1473 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1473:5: note: template argument deduction/substitution failed: a.cc:16:35: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 16 | for(it = m.begin(); it != m.end(); it++){ | ^ /usr/include/c++/14/bits/regex.h:1547:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1547 | operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1547:5: note: template argument deduction/substitution failed: a.cc:16:35: note: 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 16 | for(it = m.begin(); it != m.end(); it++){ | ^ /usr/include/c++/14/bits/regex.h:1647:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1647 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1647:5: note: template argument deduction/substitution failed: a.cc:16:35: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 16 | for(it = m.begin(); it != m.end(); it++){ | ^ /usr/include/c++/14/bits/regex.h:2213:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator!=(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2213 | operator!=(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2213:5: note: template argument deduction/substitution failed: a.cc:16:35: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 16 | for(it = m.begin(); it != m.end(); it++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:16:35: note: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} is not derived from 'const std::pair<_T1, _T2>' 16 | for(it = m.begin();
s042640216
p03721
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> P; constexpr double EPS = 1e-12; constexpr int INF = numeric_limits<int>::max()/2; constexpr int MOD = 1e9+7; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n,k;cin>>n>>k; map<ll,ll> mp; for(int i=0;i<n;i++){ ll a,b;cin>>a>>b; mp[a]+=b; } ll cnt=0; for(auto itr=mp.begin(),itr!=mp.end();itr++){ P p=*itr; cnt += p.second; if(cnt>=k){ cout<<p.first<<endl; return 0; } } }
a.cc: In function 'int main()': a.cc:23:32: error: expected ';' before '!=' token 23 | for(auto itr=mp.begin(),itr!=mp.end();itr++){ | ^~ | ; a.cc:23:32: error: expected primary-expression before '!=' token 23 | for(auto itr=mp.begin(),itr!=mp.end();itr++){ | ^~
s534999922
p03721
C
#include<cstdio> #include<utility> #include<algorithm> using namespace std; int main(){ int j=0; long n,k; pair<long,long> a[100000]; scanf("%ld %ld",&n,&k); for(int i=0;i<n;i++) scanf("%ld %ld",&a[i].first,&a[i].second); sort(a,a+n); while(k>0){ k-=a[j].second; j++; } printf("%ld\n",a[j-1].first); }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s403348084
p03721
C++
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<queue> #include<map> #include<math.h> #include<iomanip> #include<set> #include<numeric> #include<cstring> #include<cstdio> #include<functional> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define REVERSE(v,n) reverse(v,v+n); #define VREVERSE(v) reverse(v.begin(), v.end()); #define ll long long #define pb(a) push_back(a) #define INF 999999999 #define m0(x) memset(x,0,sizeof(x)) #define fill(x,y) memset(x,y,sizeof(x)) #define mp make_pair #define int long long using namespace std; int dy[4] = { 0,0,1,-1 }; int dx[4] = { 1,-1,0,0 }; int dxx[8] = { 0,0,1,1,1,-1,-1,-1 }; int dyy[8] = { 1,-1,0,1,-1,0,1,-1 }; bool comp(const P& p1, const P&p2) { return p1.second < p2.second; } ll m = 1000000007; const int MOD = 1000000007; ll gcd(ll x, ll y) { ll m = max(x, y), n = min(x, y); if (m%n == 0)return n; else return gcd(m%n, n); } ll lcm(ll x, ll y) { return x / gcd(x, y)*y; } ll myPow(ll x, ll n, ll m) { if (n == 0) return 1; if (n % 2 == 0) return myPow(x * x % m, n / 2, m); else return x * myPow(x, n - 1, m) % m; } long long nCr(int n, int r) { if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r) long long ans = 1; int i; for (i = 1; i <= r; i++) { ans *= n - r + i; ans /= i; } return ans; } typedef pair<int, int> P; vector<P>x; signed main() { int N, K; cin >> N >> K; REP(i, N) { int a, b; cin >> a >> b; x.pb(mp(a, b)); } VSORT(x); ll cnt = 0; int i = 0; while (cnt < K) { cnt += x[i].second; i++; } ll ans = x[i-1].first; cout << ans << endl; return 0; }
a.cc:41:17: error: 'P' does not name a type 41 | bool comp(const P& p1, const P&p2) { | ^ a.cc:41:30: error: 'P' does not name a type 41 | bool comp(const P& p1, const P&p2) { | ^ a.cc: In function 'bool comp(const int&, const int&)': a.cc:42:19: error: request for member 'second' in 'p1', which is of non-class type 'const int' 42 | return p1.second < p2.second; | ^~~~~~ a.cc:42:31: error: request for member 'second' in 'p2', which is of non-class type 'const int' 42 | return p1.second < p2.second; | ^~~~~~
s511110340
p03721
C++
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<queue> #include<map> #include<math.h> #include<iomanip> #include<set> #include<numeric> #include<cstring> #include<cstdio> #include<functional> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define REVERSE(v,n) reverse(v,v+n); #define VREVERSE(v) reverse(v.begin(), v.end()); #define ll long long #define pb(a) push_back(a) #define INF 999999999 #define m0(x) memset(x,0,sizeof(x)) #define fill(x,y) memset(x,y,sizeof(x)) #define mp make_pair #define int long long using namespace std; typedef pair<int, int> P; int dy[4] = { 0,0,1,-1 }; int dx[4] = { 1,-1,0,0 }; int dxx[8] = { 0,0,1,1,1,-1,-1,-1 }; int dyy[8] = { 1,-1,0,1,-1,0,1,-1 }; ll m = 1000000007; const int MOD = 1000000007; ll gcd(ll x, ll y) { ll m = max(x, y), n = min(x, y); if (m%n == 0)return n; else return gcd(m%n, n); } ll lcm(ll x, ll y) { return x / gcd(x, y)*y; } ll myPow(ll x, ll n, ll m) { if (n == 0) return 1; if (n % 2 == 0) return myPow(x * x % m, n / 2, m); else return x * myPow(x, n - 1, m) % m; } long long nCr(int n, int r) { if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r) long long ans = 1; int i; for (i = 1; i <= r; i++) { ans *= n - r + i; ans /= i; } return ans; } vector<P>x; int main() { int N, K; cin >> N >> K; REP(i, N) { int a, b; cin >> a >> b; x.pb(mp(a, b)); } VSORT(x); ll cnt = 0; int i = 0; while (cnt < K) { cnt += x[i].second; i++; } ll ans = x[i-1].first; cout << ans << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s301494086
p03721
C++
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<queue> #include<map> #include<math.h> #include<iomanip> #include<set> #include<numeric> #include<cstring> #include<cstdio> #include<functional> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define REVERSE(v,n) reverse(v,v+n); #define VREVERSE(v) reverse(v.begin(), v.end()); #define ll long long #define pb(a) push_back(a) #define INF 999999999 #define m0(x) memset(x,0,sizeof(x)) #define fill(x,y) memset(x,y,sizeof(x)) #define mp make_pair #define int long long using namespace std; typedef pair<int, int> P; int dy[4] = { 0,0,1,-1 }; int dx[4] = { 1,-1,0,0 }; int dxx[8] = { 0,0,1,1,1,-1,-1,-1 }; int dyy[8] = { 1,-1,0,1,-1,0,1,-1 }; ll m = 1000000007; const int MOD = 1000000007; ll gcd(ll x, ll y) { ll m = max(x, y), n = min(x, y); if (m%n == 0)return n; else return gcd(m%n, n); } ll lcm(ll x, ll y) { return x / gcd(x, y)*y; } ll myPow(ll x, ll n, ll m) { if (n == 0) return 1; if (n % 2 == 0) return myPow(x * x % m, n / 2, m); else return x * myPow(x, n - 1, m) % m; } long long nCr(int n, int r) { if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r) long long ans = 1; int i; for (i = 1; i <= r; i++) { ans *= n - r + i; ans /= i; } return ans; } vector<P>x; int main() { int N, K; cin >> N >> K; REP(i, N) { int a, b; cin >> a >> b; x.pb(mp(a, b)); } VSORT(x); ll cnt = 0; int i = 0; while (cnt < K) { cnt += x[i].second; i++; } ll ans = x[i-1].first; cout << ans << endl; }
cc1plus: error: '::main' must return 'int'
s237441668
p03721
C++
#include <iostream> #include <cstdint> #include <algorithm> #include <utility> #include <cstdlib> int main() { std::int_fast64_t n, k; std::cin >> n >> k; std::vector<std::pair<std::int_fast64_t, std::int_fast64_t>> queries(n); for (std::pair<std::int_fast64_t, std::int_fast64_t>& query : queries) { std::cin >> query.first >> query.second; } std::sort(queries.begin(), queries.end(), [](const std::pair<std::int_fast64_t, std::int_fast64_t>& lhs, const std::pair<std::int_fast64_t, std::int_fast64_t>& rhs) { return lhs.first < rhs.first; }); for (const std::pair<std::int_fast64_t, std::int_fast64_t>& query : queries) { k -= query.second; if (k <= 0) { std::cout << query.first << std::endl; return 0; } } return EXIT_FAILURE; }
a.cc: In function 'int main()': a.cc:10:8: error: 'vector' is not a member of 'std' 10 | std::vector<std::pair<std::int_fast64_t, std::int_fast64_t>> queries(n); | ^~~~~~ a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 5 | #include <cstdlib> +++ |+#include <vector> 6 | a.cc:10:61: error: expected primary-expression before '>' token 10 | std::vector<std::pair<std::int_fast64_t, std::int_fast64_t>> queries(n); | ^~ a.cc:10:64: error: 'queries' was not declared in this scope 10 | std::vector<std::pair<std::int_fast64_t, std::int_fast64_t>> queries(n); | ^~~~~~~
s944964204
p03721
C++
#include <bits/stdc++.h> using namespace std; #define dump(x) cout << (x) << endl typedef long long ll; typedef pair<int, int> pi; typedef vector<int> V; int main() { ll n, k; cin >> n >> k; vector<pair<ll, ll>> ab(n); for (int i = 0; i < n; i++) cin >> ab[i].first >> ab[i].second; sort(ab.begin(), ab.end()); for (int i = 0; i < n-1; i++) ab[i+1].second += b[i].second; int x = lower_bound(ab.begin(), ab.end(), k)-ab.begin(); dump(a[x]); return 0; }
a.cc: In function 'int main()': a.cc:14:51: error: 'b' was not declared in this scope 14 | for (int i = 0; i < n-1; i++) ab[i+1].second += b[i].second; | ^ a.cc:16:8: error: 'a' was not declared in this scope 16 | dump(a[x]); | ^ a.cc:3:26: note: in definition of macro 'dump' 3 | #define dump(x) cout << (x) << endl | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:71, 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/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [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 = const long long int]': /usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_val]' 1504 | if (__comp(__middle, __val)) | ~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = long long int]' 1539 | return std::__lower_bound(__first, __last, __val, | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ 1540 | __gnu_cxx::__ops::__iter_less_val()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:15:22: required from here 15 | int x = lower_bound(ab.begin(), ab.end(), k)-ab.begin(); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long long int, long long int>' and 'const long long int') 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)' 1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)' 1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const long long int' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const long long int' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /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: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::pair<_T1, _T2>' and 'const long long int' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /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: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::reverse_iterator<_Iterator>' 69 | { return *__it < __val; } | ~~~~~~^~~~~~~ /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: /usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::re
s920294571
p03721
C++
line = gets data = line.split(" ") n = data[0].to_i k = data[1].to_i ai = Array.new bi = Hash.new n.times do |i| line = gets data = line.split(" ") a = data[0].to_i ai << a if !ai.include?(a) if bi[a] == nil bi[a] = data[1].to_i else bi[a] += data[1].to_i end end ai.sort! ai.each do |a| k -= bi[a] if k <= 0 break end end
a.cc:1:1: error: 'line' does not name a type 1 | line = gets | ^~~~
s661536905
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef pair<int,int> P; #define INF 1<<30 #define LINF 1ll<<60ll #define MOD 1000000007 #define pb(a) push_back(a) #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) _repi(i,0,n) #define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i) #define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__) #define REPR(i, n) for(int i = n;i >= 0;--i) #define REPARR(i, v) for(int i = 0;i < sz(v);++i) #define all(vec) (vec.begin()),(vec.end()) #define sz(x) ((int)(x).size()) #define bit(n) (1ll<<(n)) template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;} template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} #define YES(n) cout<<((n)?"YES":"NO")<<endl #define Yes(n) cout<<((n)?"Yes":"No")<<endl #define yes(n) cout<<((n)?"yes":"no")<<endl #define poss(n) cout<<((n)?"possible":"impossible")<<endl #define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl 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:38:8: error: 'AMAX' was not declared in this scope 38 | ll cnt[AMAX + 1]; | ^~~~ a.cc: In function 'int main()': a.cc:48:1: error: 'cnt' was not declared in this scope; did you mean 'int'? 48 | cnt[A] += B; | ^~~ | int a.cc:51:26: error: 'AMAX' was not declared in this scope 51 | for (int ans = 1; ans <= AMAX; ++ans){ | ^~~~ a.cc:52:10: error: 'cnt' was not declared in this scope; did you mean 'int'? 52 | if (K <= cnt[ans]) { | ^~~ | int a.cc:56:6: error: 'cnt' was not declared in this scope; did you mean 'int'? 56 | K -= cnt[ans]; | ^~~ | int
s793219190
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef pair<int,int> P; #define INF 1<<30 #define LINF 1ll<<60ll #define MOD 1000000007 #define pb(a) push_back(a) #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) _repi(i,0,n) #define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i) #define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__) #define REPR(i, n) for(int i = n;i >= 0;--i) #define REPARR(i, v) for(int i = 0;i < sz(v);++i) #define all(vec) (vec.begin()),(vec.end()) #define sz(x) ((int)(x).size()) #define bit(n) (1ll<<(n)) template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;} template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} #define YES(n) cout<<((n)?"YES":"NO")<<endl #define Yes(n) cout<<((n)?"Yes":"No")<<endl #define yes(n) cout<<((n)?"yes":"no")<<endl #define poss(n) cout<<((n)?"possible":"impossible")<<endl #define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl int main(){ map<int,ll> p; int n; ll k; cin>>n>>k; REP(i,n){ int a,b; cin>>a>>b; p[a]+=b; } for(P s:p){ k-=s.second; if(k<=0){ cout<<s.first<<endll break; } } return 0; }
a.cc: In function 'int main()': a.cc:52:28: error: 'endll' was not declared in this scope 52 | cout<<s.first<<endll | ^~~~~
s019315799
p03721
C++
10 500000 1 100000 1 100000 1 100000 1 100000 1 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 10 500000 | ^~
s361626103
p03721
C++
#include<bits/stdc++.h> using namespace std; #define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++) #define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define ALL(x) x.begin(),x.end() #define RALL(x) x.rbegin(),x.rend() typedef long long int ll; typedef vector<ll> vi; typedef vector<pair<ll, ll> > vp; typedef vector<string> vs; typedef vector<char> vc; typedef list<ll> lst; typedef pair<ll, ll> P; const long long INF = 1e9; const long long MOD = 1000000007; const long double PI = 3.1415926; template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); } template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); } ll n, m, k, ans = 0, sum = 0, cnt = 0; string s; //char c; #define Endl endl /*--------------------template--------------------*/ int main() { ll N,K; cin>>N>>K; vp ab(N); REP(i,N){ ll a,b; cin>>a>>b; ab[i]=make_pair(a,b); } sort(ab.begin(),ab.end(),[&](P& l,P& r){return l.frist<r.first;}); REP(i,N){ ans+=ab[i].second; if(ans>=K){ cout<<ab[i].first<<endl; break; } } return 0; }
a.cc: In lambda function: a.cc:39:54: error: 'P' {aka 'struct std::pair<long long int, long long int>'} has no member named 'frist'; did you mean 'first'? 39 | sort(ab.begin(),ab.end(),[&](P& l,P& r){return l.frist<r.first;}); | ^~~~~ | first
s047309227
p03721
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N long long K; cin >> N >> K; int a[N], b[N]; long long c[100010]={}; for(int i = 0; i < N; i++){ cin >> a[i] >> b[i]; c[a[i]] += b[i]; } int ans = 0; for(int i = 1; i <100010; i++){ K -= c[i]; if(K <= 0 ){ ans = i; break; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: expected initializer before 'long' 6 | long long K; | ^~~~ a.cc:7:12: error: 'N' was not declared in this scope 7 | cin >> N >> K; | ^ a.cc:7:17: error: 'K' was not declared in this scope 7 | cin >> N >> K; | ^ a.cc:11:16: error: 'a' was not declared in this scope 11 | cin >> a[i] >> b[i]; | ^ a.cc:11:24: error: 'b' was not declared in this scope 11 | cin >> a[i] >> b[i]; | ^
s351366049
p03721
C++
#include<bits/stdc++.h> using namespace std; long long n,m,a,b; main(){ cin>>n>>m; for(int i=0;i<n;i++){ long long p,p,q; cin>>p>>q; b+=q; if(m<=b)break; a=p; } cout<<a<<endl; }
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:9:17: error: redeclaration of 'long long int p' 9 | long long p,p,q; | ^ a.cc:9:15: note: 'long long int p' previously declared here 9 | long long p,p,q; | ^
s801265459
p03721
C++
#include<bits/stdc++.h> using namespace std; long long n,m,a,b; main{ cin>>n>>m; for(int i=0;i<n;i++){ long long q; cin>>a>>q; b+=q; if(m<=b)break; } cout<<a<<endl; }
a.cc:6:1: error: 'main' does not name a type 6 | main{ | ^~~~
s602688378
p03721
Java
import java.util.List; import java.util.Map; import java.util.Scanner; import java.util.TreeMap; import java.util.Map.Entry; import atcoder.Main; public class Main { public static void main(String[] args) { Main main = new Main(); main.run(); } void run() { Scanner sc = new Scanner(System.in); Map<Integer,Integer> map=new TreeMap<Integer,Integer>(); int N = sc.nextInt(); int K = sc.nextInt(); for (int i = 0; i < N; i++) { int A = sc.nextInt(); int B = sc.nextInt(); if(map.containsKey(A)) { map.put(A, map.get(A)+B); }else { map.put(A, B); } } int cnt=0; for(Entry<Integer, Integer> E:map.entrySet()) { cnt+=E.getValue(); if(cnt>=K) { System.out.println(E.getKey()); return; } } } //以下テンプレート public static int[] extgcd(int a, int b) { int x0 = 1; int x1 = 0; int y0 = 0; int y1 = 1; while (b != 0) { int q = a / b; int r = a % b; int x2 = x0 - q * x1; int y2 = y0 - q * y1; a = b; b = r; x0 = x1; x1 = x2; y0 = y1; y1 = y2; } return new int[] { a, x0, y0 }; } static int gcd(int a, int b) { if (b == 0) return a; if (a < b) { int t = a; a = b; b = t; } return gcd(b, a % b); } static int lcm(int a, int b) { return a * b / gcd(a, b); } static void swap(int[] a) { int t; t = a[0]; a[0] = a[1]; a[1] = t; return; } static <T> void output(List<T> list) { for (int i = 0; i < list.size(); i++) { System.out.print(list.get(i)); if (i != list.size() - 1) { System.out.print(" "); } else { nl(); } } } static void output(String[][] str) { for (int i = 0; i < str.length; i++) { for (int j = 0; j < str[i].length; j++) { print(str[i][j]); } nl(); } } static void output(boolean flg, String Yes, String No) { if (flg) { pln(Yes); } else { pln(No); } } static void output(String[][] str, int digit) { String dig = "%" + String.valueOf(digit) + "s"; for (int i = 0; i < str.length; i++) { for (int j = 0; j < str[i].length; j++) { System.out.printf(dig, str[i][j]); } nl(); } } static void pln(String str) { System.out.println(str); } static void pln(int x) { System.out.println(x); } static void print(String str) { System.out.print(str); } static void print(int x) { System.out.print(x); } static void print(String str, int times) { for (int i = 0; i < times; i++) { print(str); } } static void print(int x, int times) { for (int i = 0; i < times; i++) { print(x); } } static void nl() { System.out.println(); } }
Main.java:7: error: package atcoder does not exist import atcoder.Main; ^ 1 error
s544466234
p03721
C++
#include <bits/stdc++.h> #include <typeinfo> #include <cxxabi.h> #ifdef LOCAL #include "dbgtoki.hpp" #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) #else #define DUMP(i) #endif using namespace std; #define TOSTRING(x) #x #define SZ(x) (int)(x).size() #define REP(i,n) for(int i=0;i<(n);i++) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define ALL(s) (s).begin(), (s).end() #define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end()); #define dis distance #define so(V) sort(ALL(V)) #define rev(V) reverse(ALL(V)) #define pub push_back #define sec second #define fir first typedef long long unsigned int llu; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vector <int> > vvi; const int EPS = 1e-9; const int MOD = 1e9+7; const int INF = (1 << 30); int main(){ cin.tie(0); ios::sync_with_stdio(false); int n,k; cin >> n >> k; map<int,ll> M; REP(i,n){ int a,b; cin >> a >> b; M[a] += b; } ll kk = k; for(auto m : M ){ kk -= m.sec; if(sum >= k){ cout << m.fir << endl; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:48:20: error: 'sum' was not declared in this scope 48 | if(sum >= k){ | ^~~
s686427385
p03721
C++
#include <bits/stdc++.h> #include <typeinfo> #include <cxxabi.h> #ifdef LOCAL #include "dbgtoki.hpp" #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) #else #define DUMP(i) #endif using namespace std; #define TOSTRING(x) #x #define SZ(x) (int)(x).size() #define REP(i,n) for(int i=0;i<(n);i++) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define ALL(s) (s).begin(), (s).end() #define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end()); #define dis distance #define so sort #define rev reverse #define pub push_back #define sec second #define fir first typedef long long unsigned int llu; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vector <int> > vvi; const int EPS = 1e-9; const int MOD = 1e9+7; const int INF = (1 << 30); int main(){ cin.tie(0); ios::sync_with_stdio(false); int n,k; cin >> n >> k; vll V[i]; REP(i,n){ int a,b; cin >> a >> b; V[a] += b; } ll cnt = 0; REP(i,n){ cnt += V[i]; if(cnt >= k){ cout << i << endl; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:39:15: error: 'i' was not declared in this scope 39 | vll V[i]; | ^ a.cc:43:17: error: 'V' was not declared in this scope 43 | V[a] += b; | ^ a.cc:47:24: error: 'V' was not declared in this scope 47 | cnt += V[i]; | ^
s984098207
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n,k; cin >> n >> k; map<int,ll> m; for(int i=0; i<n; i++) { ll a,b; cin >> a >> b; m[a]+=b; } ll sum = 0; for(auto x:m){ sum += m.second; if( sum >= k ) { cout << x.first << endl; break; } } }
a.cc: In function 'int main()': a.cc:18:19: error: 'class std::map<int, long long int>' has no member named 'second' 18 | sum += m.second; | ^~~~~~
s828981227
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef lon glong ll; int main() { ll n,k; cin >> n >> k; map<int,ll> m; for(int i=0; i<n; i++) { ll a,b; cin >> a >> b; m[a]+=b; } ll sum = 0; for(auto x:m){ sum += m.second; if( sum >= k ) { cout << x.first << endl; break; } } }
a.cc:3:9: error: 'lon' does not name a type; did you mean 'long'? 3 | typedef lon glong ll; | ^~~ | long a.cc: In function 'int main()': a.cc:8:3: error: 'll' was not declared in this scope 8 | ll n,k; cin >> n >> k; | ^~ a.cc:8:18: error: 'n' was not declared in this scope; did you mean 'yn'? 8 | ll n,k; cin >> n >> k; | ^ | yn a.cc:8:23: error: 'k' was not declared in this scope 8 | ll n,k; cin >> n >> k; | ^ a.cc:9:13: error: template argument 4 is invalid 9 | map<int,ll> m; | ^ a.cc:12:7: error: expected ';' before 'a' 12 | ll a,b; cin >> a >> b; | ^~ | ; a.cc:12:20: error: 'a' was not declared in this scope 12 | ll a,b; cin >> a >> b; | ^ a.cc:12:25: error: 'b' was not declared in this scope 12 | ll a,b; cin >> a >> b; | ^ a.cc:16:5: error: expected ';' before 'sum' 16 | ll sum = 0; | ^~~~ | ; a.cc:17:14: error: 'begin' was not declared in this scope 17 | for(auto x:m){ | ^ a.cc:17:14: note: suggested alternatives: In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166, from a.cc:1: /usr/include/c++/14/valarray:1238:5: note: 'std::begin' 1238 | begin(const valarray<_Tp>& __va) noexcept | ^~~~~ In file included from /usr/include/c++/14/filesystem:53, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200: /usr/include/c++/14/bits/fs_dir.h:608:3: note: 'std::filesystem::__cxx11::begin' 608 | begin(recursive_directory_iterator __iter) noexcept | ^~~~~ a.cc:17:14: error: 'end' was not declared in this scope 17 | for(auto x:m){ | ^ a.cc:17:14: note: suggested alternatives: /usr/include/c++/14/valarray:1265:5: note: 'std::end' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/fs_dir.h:613:3: note: 'std::filesystem::__cxx11::end' 613 | end(recursive_directory_iterator) noexcept | ^~~ a.cc:18:10: error: 'sum' was not declared in this scope 18 | sum += m.second; | ^~~ a.cc:18:19: error: request for member 'second' in 'm', which is of non-class type 'int' 18 | sum += m.second; | ^~~~~~
s351054832
p03721
C
#include<stdio.h> int main(void){ long n,k,i,ho=0; scanf("%ld %ld",&n,&k); long a,b; long x[100000]={0}; for(i=0;i<n;i++){ scanf("%ld %ld",&a,&b); x[a-1]+=b; } for(i=0;i<100000;i++){ ho+=x[i]; if(ho>=k){ ch=1; break; } } printf("%ld",i+1); return 0; }
main.c: In function 'main': main.c:14:7: error: 'ch' undeclared (first use in this function) 14 | ch=1; | ^~ main.c:14:7: note: each undeclared identifier is reported only once for each function it appears in
s819178809
p03721
C++
#include <iostream> #include <vector> #include <algorithm> #include <utility> using namespace std; int main(){ int n,k,i; long long x; cin >> n >> k; vector <pair<int, int> > a(n); for(i=0;i<n;i++){ cin >> x >> y; a[i] = make_pair(x,y); } sort(a.begin(),a.end()); x = 0; for(i=0;i<n;i++){ if(x<k){ x += a[i].second; }else{ cout << a[i].first << endl; } } }
a.cc: In function 'int main()': a.cc:13:21: error: 'y' was not declared in this scope 13 | cin >> x >> y; | ^
s695597901
p03721
C++
tmp = list(map(int,input().split())) n, k = tmp[0],tmp[1] an = [] for i in range(n): tmp = list(map(int,input().split())) an += [tmp[0]] * tmp[1] an.sort() print(an[k-1])
a.cc:1:1: error: 'tmp' does not name a type 1 | tmp = list(map(int,input().split())) | ^~~
s628944390
p03721
C++
#include <bits/stdc++.h> using namespace std; #define repr(i,k,n) for(int i = (k); i < (n); i++) #define rep(i,n) repr(i,0,n) #define ALL(a) begin(a),end(a) const int INF = 114514810; const int MOD = 1000000007; typedef vector<int> vi; typedef vector<string> vs; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); int N,K; vi ans; vi b; vi a; cin >> N >> K; rep(i,N){ cin >> a >> b; } rep(i,N){ rep(j,b[i]){ ans.push_back(a[i]); } if(ans.size()>K){ sort(ans.begin(),ans.end()); cout << ans[K-1] << endl; } } }
a.cc: In function 'int main()': a.cc:20:21: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'vi' {aka 'std::vector<int>'}) 20 | cin >> a >> b; | ~~~ ^~ ~ | | | | | vi {aka std::vector<int>} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::
s971986417
p03721
C++
#include <bits/stdc++.h> using namespace std; #define repr(i,k,n) for(int i = (k); i < (n); i++) #define rep(i,n) repr(i,0,n) #define ALL(a) begin(a),end(a) const int INF = 114514810; const int MOD = 1000000007; typedef vector<int> vi; typedef vector<string> vs; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); int N,K,a,b; vi ans; vi b; vi a; cin >> N >> K; rep(i,N){ cin >> a >> b; } rep(i,N){ rep(j,b[i]){ ans.push_back(a[i]); } if(ans.size()>K){ sort(ans.begin(),ans.end()); cout << ans[K-1] << endl; } } }
a.cc: In function 'int main()': a.cc:16:12: error: conflicting declaration 'vi b' 16 | vi b; | ^ a.cc:14:19: note: previous declaration as 'int b' 14 | int N,K,a,b; | ^ a.cc:17:12: error: conflicting declaration 'vi a' 17 | vi a; | ^ a.cc:14:17: note: previous declaration as 'int a' 14 | int N,K,a,b; | ^ a.cc:23:24: error: invalid types 'int[int]' for array subscript 23 | rep(j,b[i]){ | ^ a.cc:3:43: note: in definition of macro 'repr' 3 | #define repr(i,k,n) for(int i = (k); i < (n); i++) | ^ a.cc:23:17: note: in expansion of macro 'rep' 23 | rep(j,b[i]){ | ^~~ a.cc:24:32: error: invalid types 'int[int]' for array subscript 24 | ans.push_back(a[i]); | ^
s075583461
p03721
C++
nclude <iostream> #include <vector> #include <map> #include <math.h> #include <algorithm> using namespace std; int main() { int N; long long K,total; cin >> N >> K; map<int, long long> mp; total = 0; for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; mp[a] += b; } for (auto&& var : mp) { total += var.second; if (total >= K) { cout << var.first << endl; break; } } return 0; }
a.cc:1:1: error: 'nclude' does not name a type 1 | nclude <iostream> | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s419618904
p03721
C++
#include <iostream> #include <vector> #include <map> #include <math.h> #include <algorithm> using namespace std; int main() { int N, K,total; cin >> N >> K; map<int, int> mp; total = 0; for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; mp[a] = b; } for (auto&& var : mp) { toral += var.second; if (total >= K) { cout << var.first; } } return 0; }
a.cc: In function 'int main()': a.cc:22:17: error: 'toral' was not declared in this scope; did you mean 'total'? 22 | toral += var.second; | ^~~~~ | total
s694104331
p03721
C++
#include <iostream> #include<cstdlib> #include<queue> #include<set> #include<vector> #include<stack> #include<map> #include<string> #include<algorithm> #include<cstdio> using namespace std; #define rep(i,a) for(int i=0;i<a;i++) #define mp make_pair #define pb push_back #define P pair<int,int> #define ll __int64 //#define __int64 long long const ll M=1000000007; int n,k; int a[111111]; int b[111111]; int cnt[111111]; int main(){ cin>>n>>k; rep(i,n)cin>>a[i]>>b[i]; rep(i,n)cnt[a[i]]+=b[i]; int sum=0; for(int i=1;i<=111111;i++){ sum+=cnt[i]; if(sum>=k){cout<<i<<endl;return 0;} } return 0; }
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'? 16 | #define ll __int64 | ^~~~~~~ a.cc:18:7: note: in expansion of macro 'll' 18 | const ll M=1000000007; | ^~
s216843090
p03721
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Map; import java.util.TreeMap; public class Main { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String... args) throws IOException { String[] params = br.readLine().split(" "); int n = Integer.parseInt(params[0]); int k = Integer.parseInt(params[1]); Map<Integer, Integer> inData = new TreeMap<>(); for (int i = 0; i < n; i++) { String[] data = br.readLine().split(" "); int key = Integer.parseInt(data[0]); int val = Integer.parseInt(data[1]); if (inData.get(key) == null) { inData.put(key, val); } else { inData.put(key, inData.get(key) + val); } } int curCount = 0; for (Map.Entry<Integer, Integer> entry : inData.entrySet()) { curCount += entry.getValue(); if (k <= curCount) { System.out.println(entry.getKey()); break; } } } }
Main.java:12: error: non-static variable br cannot be referenced from a static context String[] params = br.readLine().split(" "); ^ Main.java:18: error: non-static variable br cannot be referenced from a static context String[] data = br.readLine().split(" "); ^ 2 errors
s603990940
p03721
C++
// ------------------------------------ // Date:2018/ 3/ 8 // Problem:ABC 061 BigArray c.cpp // // ------------------------------------ #include <bits/stdc++.h> using namespace std; #define EACH(i,a) for (auto&& i : a) #define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i) #define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define ALL(a) (a).begin(),(a).end() #define debug(x) cerr << #x << ":" << x << endl typedef long long ll; typedef pair< int, int > M; static const int INF = 1000000001; static const int MAX_DATA = 101010; M data[MAX_DATA]; int main() { cin.tie(0); ios::sync_with_stdio(false); REP(i, MAX_DATA) data[i] = make_pair(INF, INF);X int N, K; cin >> N >> K; int a, b; int bias = 0; int ans = 0; REP(i, N) { cin >> a >> b; data[i] = make_pair(a, b); } sort(data, data + MAX_DATA, [](const M& A, const M& B) { if (A.first == B.first) return A.second < B.second; return A.first < B.first; }); REP(i, N) { ans = data[i].first; bias += data[i].second; if (bias >= K) break; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:20: error: reference to 'data' is ambiguous 32 | REP(i, MAX_DATA) data[i] = make_pair(INF, INF);X | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:7: /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:25:3: note: 'M data [101010]' 25 | M data[MAX_DATA]; | ^~~~ a.cc:32:50: error: 'X' was not declared in this scope 32 | REP(i, MAX_DATA) data[i] = make_pair(INF, INF);X | ^ a.cc:35:10: error: 'N' was not declared in this scope 35 | cin >> N >> K; | ^ a.cc:35:15: error: 'K' was not declared in this scope 35 | cin >> N >> K; | ^ a.cc:42:5: error: reference to 'data' is ambiguous 42 | data[i] = make_pair(a, b); | ^~~~ /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:25:3: note: 'M data [101010]' 25 | M data[MAX_DATA]; | ^~~~ a.cc:45:8: error: reference to 'data' is ambiguous 45 | sort(data, data + MAX_DATA, [](const M& A, const M& B) { | ^~~~ /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:25:3: note: 'M data [101010]' 25 | M data[MAX_DATA]; | ^~~~ a.cc:45:14: error: reference to 'data' is ambiguous 45 | sort(data, data + MAX_DATA, [](const M& A, const M& B) { | ^~~~ /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:25:3: note: 'M data [101010]' 25 | M data[MAX_DATA]; | ^~~~ a.cc:52:11: error: reference to 'data' is ambiguous 52 | ans = data[i].first; | ^~~~ /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:25:3: note: 'M data [101010]' 25 | M data[MAX_DATA]; | ^~~~ a.cc:53:13: error: reference to 'data' is ambiguous 53 | bias += data[i].second; | ^~~~ /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:25:3: note: 'M data [101010]' 25 | M data[MAX_DATA]; | ^~~~
s512154096
p03721
C++
#include<bits/stdc++.h> const int INF = 1e9; const int MOD = 1e9+7; using LL = long long; const LL LINF = 1e18; using namespace std; #define COUT(v) cout<<(v)<<endl #define CIN(n) int(n);cin >> (n) #define YES(n) cout<<((n)? "YES" : "NO")<<endl #define Yes(n) cout<<((n)? "Yes" : "No")<<endl #define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl #define Possible(n) cout << ((n) ? "Possible" : "Impossible" ) <<endl #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) for(int i=0;i<(n);++i) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOREACH(x,a) for(auto& (x) : (a) ) #define ALL(obj) (obj).begin(),(obj).end() #define P pair<int,int> #define I vector<int> #define S set<int> #define pb(v) push_back(v) #define V vector Sun[2000000]; int main(){ CIN(N);CIN(K); map<int,LL> m; REP(a,N){ CIN(A);CIN(B); Sun[A]+=B; } int s = 0; REP(a,K){ if(a==K-1)COUT(s); while(Sun[s]==0){ s++; } Sun[s]--; } return 0; }
a.cc:27:2: error: 'Sun' does not name a type 27 | Sun[2000000]; | ^~~ a.cc: In function 'int main()': a.cc:33:9: error: 'Sun' was not declared in this scope 33 | Sun[A]+=B; | ^~~ a.cc:38:15: error: 'Sun' was not declared in this scope 38 | while(Sun[s]==0){ | ^~~ a.cc:41:9: error: 'Sun' was not declared in this scope 41 | Sun[s]--; | ^~~
s440527627
p03721
C++
#include "bits/stdc++.h" using namespace std; int main() { int n long long m; scanf("%d %lld", &n, &m); map<int, long long> a; for(int i = 0, j, k; i < n; ++i) { scanf("%d %lld", &j, &k); if(a.find(j) == a.end()) { a.insert(make_pair(j, k)); } else { a[j] += k; } } for(auto i : a) { m -= i.second; if(m <= 0) { printf("%d\n", i.first); break; } } }
a.cc: In function 'int main()': a.cc:6:9: error: expected initializer before 'long' 6 | long long m; | ^~~~ a.cc:7:27: error: 'n' was not declared in this scope; did you mean 'yn'? 7 | scanf("%d %lld", &n, &m); | ^ | yn a.cc:7:31: error: 'm' was not declared in this scope; did you mean 'tm'? 7 | scanf("%d %lld", &n, &m); | ^ | tm
s514653021
p03721
C++
#include <iostream> #include <map> int N, K; using ll = long long; int main() { cin >> N >> K; map<ll, ll> M; for(int i = 0; i < N; ++i){ ll a,b; cin >> a >> b; M[a] += b; } ll sum = 0; ll ans = 0; auto it = M.begin(); while(sum < K) { sum += it->second; ans = it->first; ++it; } cout << it->first << endl; }
a.cc: In function 'int main()': a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 7 | 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:8:3: error: 'map' was not declared in this scope 8 | map<ll, ll> M; | ^~~ a.cc:8:3: note: suggested alternatives: In file included from /usr/include/c++/14/map:63, from a.cc:2: /usr/include/c++/14/bits/stl_map.h:102:11: note: 'std::map' 102 | class map | ^~~ /usr/include/c++/14/map:89:13: note: 'std::pmr::map' 89 | using map | ^~~ a.cc:8:9: error: expected primary-expression before ',' token 8 | map<ll, ll> M; | ^ a.cc:8:13: error: expected primary-expression before '>' token 8 | map<ll, ll> M; | ^ a.cc:8:15: error: 'M' was not declared in this scope 8 | map<ll, ll> M; | ^ a.cc:23:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 23 | cout << it->first << 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:23:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 23 | cout << it->first << 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) | ^~~~
s313740070
p03721
C++
#include <iostream> #include <map> int N, K; int main() { cin >> N >> K; map<int, int> M; for(int i = 0; i < N; ++i){ int a,b; cin >> a >> b; M[a] += b; } int sum = 0; int ans = 0; auto it = M.begin(); while(sum < K) { sum += it->second; ans = it->first; ++it; } cout << it->first << endl; }
a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | 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:7:3: error: 'map' was not declared in this scope 7 | map<int, int> M; | ^~~ a.cc:7:3: note: suggested alternatives: In file included from /usr/include/c++/14/map:63, from a.cc:2: /usr/include/c++/14/bits/stl_map.h:102:11: note: 'std::map' 102 | class map | ^~~ /usr/include/c++/14/map:89:13: note: 'std::pmr::map' 89 | using map | ^~~ a.cc:7:7: error: expected primary-expression before 'int' 7 | map<int, int> M; | ^~~ a.cc:11:5: error: 'M' was not declared in this scope 11 | M[a] += b; | ^ a.cc:16:13: error: 'M' was not declared in this scope 16 | auto it = M.begin(); | ^ a.cc:22:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 22 | cout << it->first << 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:22:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 22 | cout << it->first << 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) | ^~~~
s347633888
p03721
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; struct box { int a; int b; }; int main() { int n long long k; cin >> n >> k; vector<box> x(n); for(int i = 0; i < n; i++) { cin >> x[i].a >> x[i].b; } //sort(x.begin(), x.end(), [](const box& n, const box& m) {return n.a < m.a;}); int i = 0; while(k > 0) { k -= x[i].b; i++; } cout << x[i - 1].a << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:9: error: expected initializer before 'long' 16 | long long k; | ^~~~ a.cc:17:16: error: 'n' was not declared in this scope 17 | cin >> n >> k; | ^ a.cc:17:21: error: 'k' was not declared in this scope 17 | cin >> n >> k; | ^
s324441129
p03721
C++
#include<cstdio> #include<vector> #define rep(n) for(int i=0;i<n;i++) #define Pii std::pair<int, int> #define all(v) v.begin(), v.end() int main(){ int length = 0, n, k; scanf("%d %d", &n, &k); std::vector<Pii> v(n); rep(n) scanf("%d %d", &v[i].first, &v[i].second); sort(all(v)); for(Pii p: v){ if(length < k && k <= length+p.second){ printf("%d\n", p.first); return 0; } length += p.second; } }
a.cc: In function 'int main()': a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'? 13 | sort(all(v)); | ^~~~ | short
s741431748
p03721
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <string> #include <stack> #include <queue> #include <vector> #include <set> #include <cmath> #define FOR(i,a,b) for(int i=a;i<b;i++) #define MA(i,j) make_pair(i,j) #define PA pair<int,int> #define PB push_back #define PQ priority_queue<int> #define PGQ priority_queue<int,vector<int>,greater<int> > #define VE vector<int> #define VP vector<PA> #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl #define MOD 1000000007 #define INF 1000000007 using namespace std; // int main(){ int N; long long K; cin>>N>>K; PA S[100000]; FOR(i,0,N){ cin>>S[i].first>>S[i].second; } sort(S,S+N); int i=0; while(K>0&&i<N){ K-=(long long)S[i]; i++; } i--; cout<<S[i].first<<endl; return 0; }
a.cc: In function 'int main()': a.cc:36:8: error: invalid cast from type 'std::pair<int, int>' to type 'long long int' 36 | K-=(long long)S[i]; | ^~~~~~~~~~~~~~~
s120794572
p03721
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <string> #include <stack> #include <queue> #include <vector> #include <set> #include <cmath> #define FOR(i,a,b) for(int i=a;i<b;i++) #define MA(i,j) make_pair(i,j) #define PA pair<int,int> #define PB push_back #define PQ priority_queue<int> #define PGQ priority_queue<int,vector<int>,greater<int> > #define VE vector<int> #define VP vector<PA> #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl #define MOD 1000000007 #define INF 1000000007 using namespace std; // int main(){ long long N,K; cin>>N>>K; pair<long long,long long> S[100000]; FOR(i,0,N){ cin>>S[i].first>>S[i].second; } sort(S,S+N); long long i=0; while(K>0&&i<N){ K-=S[i]; i++; } i--; cout<<S[i].first<<endl; return 0; }
a.cc: In function 'int main()': a.cc:35:6: error: no match for 'operator-=' (operand types are 'long long int' and 'std::pair<long long int, long long int>') 35 | K-=S[i]; | ~^~~~~~
s632466535
p03721
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <string> #include <stack> #include <queue> #include <vector> #include <set> #include <cmath> #define FOR(i,a,b) for(int i=a;i<b;i++) #define MA(i,j) make_pair(i,j) #define PA pair<int,int> #define PB push_back #define PQ priority_queue<int> #define PGQ priority_queue<int,vector<int>,greater<int> > #define VE vector<int> #define VP vector<PA> #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl #define MOD 1000000007 #define INF 1000000007 using namespace std; // int main(){ long long N,K; cin>>N>>K; PA S[100000]; FOR(i,0,N){ cin>>S[i].first>>S[i].second; } sort(S,S+N); long long i=0; while(K>0&&i<N){ K-=S[i]; i++; } i--; cout<<S[i].first<<endl; return 0; }
a.cc: In function 'int main()': a.cc:35:6: error: no match for 'operator-=' (operand types are 'long long int' and 'std::pair<int, int>') 35 | K-=S[i]; | ~^~~~~~
s536473641
p03721
Java
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); Map<Integer,Integer> vals = new TreeMap<>(); Set<Integer> valSet = new HashSet<>(); for(int i = 0; i < n; i++) { int a = in.nextInt(); int b = in.nextInt(); if(valSet.contains(a)) { vals.put(a,vals.get(a)+b); } else { vals.put(a,b); } vals.add(a); } int sum = 0; for(Map.Entry<Integer,Integer> val : vals.entrySet()) { sum += val.getValue(); if(sum >= k) { System.out.println(val.getKey()); return; } } } }
Main.java:19: error: cannot find symbol vals.add(a); ^ symbol: method add(int) location: variable vals of type Map<Integer,Integer> 1 error
s481683531
p03721
Java
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tests = sc.nextInt(); long indexVal = sc.nextLong(); int[] aVals = new int[tests]; int[] bVals = new int[tests]; int bSum = 0; for (int i = 0; i < tests; i++) { aVals[i] = sc.nextInt(); bVals[i] = sc.nextInt(); bSum += bVals[i]; } int[] finalResult = new int[bSum]; int currIndex = 0; for (int i = 0; i < tests; i++) { for (int j = 0; j < bVals[i]; j++) { finalResult[currIndex++] = aVals[i]; } } Arrays.sort(finalResult); System.out.println(finalResult[indexVal - 1]); } }
Main.java:32: error: incompatible types: possible lossy conversion from long to int System.out.println(finalResult[indexVal - 1]); ^ 1 error
s362868118
p03721
C++
#include<iostream> using namespace std; int main(){ int N; __int64 E[100000]; __int64 K; int i=0; int a,b; int c=0; int ans; for(i=0;i<100000;i++){ E[i]=0; } cin>>N>>K; for(i=0;i<N;i++){ cin>>a>>b; E[a-1]=E[a-1]+b; } for(i=0;i<N;i++){ c=c+E[i]; if(c>=K){ ans=i+1; break; } } cout<<ans; }
a.cc: In function 'int main()': a.cc:5:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 5 | __int64 E[100000]; | ^~~~~~~ | __int64_t a.cc:6:16: error: expected ';' before 'K' 6 | __int64 K; | ^~ | ; a.cc:13:17: error: 'E' was not declared in this scope 13 | E[i]=0; | ^ a.cc:16:17: error: 'K' was not declared in this scope 16 | cin>>N>>K; | ^ a.cc:19:17: error: 'E' was not declared in this scope 19 | E[a-1]=E[a-1]+b; | ^ a.cc:22:21: error: 'E' was not declared in this scope 22 | c=c+E[i]; | ^
s524695999
p03721
C++
10 500000 1 100000 1 100000 1 100000 1 100000 1 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 10 500000 | ^~
s695273152
p03721
C++
#include <iostream> #define b_MAX 100000; using namespace std; int ary[b_MAX+1]; int main(void){ int N; long long K; cin >> N >> K; int a, b; for(int i=0; i<N; i++){ cin >> a >> b; ary[a] += b; } long long ans = 0; for(int i=1; ans<K && i<=b_MAX; i++){ ans += ary[i]; if(ans>=K){ cout << i << '\n'; break; } } return 0; }
a.cc:2:21: error: expected ']' before ';' token 2 | #define b_MAX 100000; | ^ a.cc:5:9: note: in expansion of macro 'b_MAX' 5 | int ary[b_MAX+1]; | ^~~~~ a.cc:5:14: error: expected unqualified-id before '+' token 5 | int ary[b_MAX+1]; | ^ a.cc: In function 'int main()': a.cc:14:9: error: 'ary' was not declared in this scope 14 | ary[a] += b; | ^~~ a.cc:18:35: error: expected primary-expression before ';' token 18 | for(int i=1; ans<K && i<=b_MAX; i++){ | ^ a.cc:18:35: error: expected ')' before ';' token 18 | for(int i=1; ans<K && i<=b_MAX; i++){ | ~ ^ a.cc:18:37: error: 'i' was not declared in this scope 18 | for(int i=1; ans<K && i<=b_MAX; i++){ | ^
s312464512
p03721
C++
#include <iostream> using namespace std; int ary[1e5+1]; int main(void){ int N; long long K; cin >> N >> K; int a, b; for(int i=0; i<N; i++){ cin >> a >> b; ary[a] += b; } long long ans = 0; for(int i=1; ans<K && i<=1e5; i++){ ans += ary[i]; } cout << ans << endl; return 0; }
a.cc:4:12: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 4 | int ary[1e5+1]; | ~~~^~ a.cc:4:12: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int' 4 | int ary[1e5+1]; | ~~~^~ | | | double a.cc:4:12: error: size of array 'ary' has non-integral type 'double'
s138828397
p03721
C++
import std.stdio; // readln import std.array; // split import std.conv; // to import std.typecons; import std.range; import std.algorithm; void main(){ string[] s = split(readln()); int n = to!int(s[0]); int k = to!int(s[1]); alias Tuple!(int,int) pair; pair[] p = new pair[](n); for(int i = 0; i < n; i++){ s = split(readln()); int a = to!int(s[0]); int b = to!int(s[1]); p[i] = pair(a,b); } sort(p); int cur = 0; for(int i = 0; i < n; i++){ cur += p[i][1]; if(cur >= k){ writeln(p[i][0]); return; } } }
a.cc:1:1: error: 'import' does not name a type 1 | import std.stdio; // readln | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import std.array; // split | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import std.conv; // to | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import std.typecons; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import std.range; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import std.algorithm; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: '::main' must return 'int' 8 | void main(){ | ^~~~ a.cc: In function 'int main()': a.cc:9:9: error: 'string' was not declared in this scope 9 | string[] s = split(readln()); | ^~~~~~ a.cc:9:16: error: expected primary-expression before ']' token 9 | string[] s = split(readln()); | ^ a.cc:10:17: error: 'to' was not declared in this scope 10 | int n = to!int(s[0]); | ^~ a.cc:13:9: error: 'alias' was not declared in this scope 13 | alias Tuple!(int,int) pair; | ^~~~~ a.cc:14:9: error: 'pair' was not declared in this scope 14 | pair[] p = new pair[](n); | ^~~~ a.cc:14:14: error: expected primary-expression before ']' token 14 | pair[] p = new pair[](n); | ^ a.cc:16:17: error: 's' was not declared in this scope 16 | s = split(readln()); | ^ a.cc:16:27: error: 'readln' was not declared in this scope 16 | s = split(readln()); | ^~~~~~ a.cc:16:21: error: 'split' was not declared in this scope 16 | s = split(readln()); | ^~~~~ a.cc:19:17: error: 'p' was not declared in this scope 19 | p[i] = pair(a,b); | ^ a.cc:22:14: error: 'p' was not declared in this scope 22 | sort(p); | ^ a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'short'? 22 | sort(p); | ^~~~ | short a.cc:28:25: error: 'writeln' was not declared in this scope 28 | writeln(p[i][0]); | ^~~~~~~ a.cc:29:25: error: return-statement with no value, in function returning 'int' [-fpermissive] 29 | return; | ^~~~~~
s061191572
p03721
C++
#include <iostream> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, long long K; cin >> N >> K; long long nums[100001] = {0}; for (int i = 0; i < N; ++i) { int a, b; cin >> a >> b; nums[a] += b; } long long res = 0; long long ans; for (int i = 1; i < 100001; ++i) { if (K <= res + nums[i]) { ans = i; break; } res += nums[i]; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:11:5: error: expected unqualified-id before 'long' 11 | long long K; | ^~~~ a.cc:12:17: error: 'K' was not declared in this scope 12 | cin >> N >> K; | ^
s474441467
p03721
C++
#include<bits/stdc++.h> #define loop(i, a, b) for(int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) using namespace std; const int MOD = 1000000007; const int inf = 1e8; using vi = vector <int>; using vvi = vector <vi>; using vc = vector <char>; using vvc = vector <vc>; using vs = vector <string>; using vvs = vector <vs>; //g++ -std==c++14 //setprecision(10) long long n, k; vector <long long> a, b; int main(){ cin >> n >> k; a = b = vi(n); rep(i, n){ cin >> a[i] >> b[i]; if(i != 0) b[i] += b[i - 1]; } rep(i, n){ //cout << b[i - 1] << " " << b[i] << endl; if(i == 0){ if(k <= b[i]){ cout << a[i] << endl; return 0; } } else{ if(b[i - 1] < k && k <= b[i]){ cout << a[i] << endl; return 0; } } } }
a.cc: In function 'int main()': a.cc:20:17: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'vi' {aka 'std::vector<int>'}) 20 | a = b = vi(n); | ^ In file included from /usr/include/c++/14/vector:72, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' 210 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'const std::vector<long long int>&' 211 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66: /usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::vector<long long int>&&' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' 788 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::initializer_list<long long int>' 788 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
s042394158
p03721
C++
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <cctype> #include <functional> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define ll long long #define imfor(i, n) for(int i = 0; i < n; i++) using namespace std; ll MOD = 1000000007; int main() { lln, k; ll cnt[100100]; fill(cnt, cnt + 100010, 0); cin >> n >> k; imfor(i, n) { ll a, b; cin >> a >> b; cnt[a] += b; } ll pos = 1; ll tmp = 0; while (1) { tmp += cnt[pos]; if (tmp >= k) { break; } pos++; } cout << pos << endl; }
a.cc: In function 'int main()': a.cc:22:5: error: 'lln' was not declared in this scope; did you mean 'll'? 22 | lln, k; | ^~~ | ll a.cc:22:10: error: 'k' was not declared in this scope 22 | lln, k; | ^ a.cc:25:12: error: 'n' was not declared in this scope; did you mean 'yn'? 25 | cin >> n >> k; | ^ | yn
s246170703
p03721
C++
#include<iostream> using namespace std; __int64 x[100005]={0}; int main(){ int n,k; cin>>n>>k; int i=0; int a,b; for(i=0;i<n;i++){ cin>>a>>b; x[a]+=b; } i=1; while(1){ k-=x[i]; if(k<=0){ cout<<i<<endl; break; } i++; } return 0; }
a.cc:3:1: error: '__int64' does not name a type; did you mean '__int64_t'? 3 | __int64 x[100005]={0}; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:11:17: error: 'x' was not declared in this scope 11 | x[a]+=b; | ^ a.cc:15:20: error: 'x' was not declared in this scope 15 | k-=x[i]; | ^
s250652626
p03721
C++
#include <iostream> #include <string> #include <algorithm> #include <cmath> #include <vector> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); unsigned long long int flag[1000000] = {}; int N,K; int a,b; unsigned long long int sum = 0; cin >> N >> K; for (int i = 0; i < N; i++) { cin >> a >> b; flag[a] += b; } for (int i = 1; i <= 100001; i++) { sum += flag[i]; if (sum >= K) { cout << i << '\n'; break; } } if (i == 100002) { cout << '0' << '\n'; } return 0; }
a.cc: In function 'int main()': a.cc:30:9: error: 'i' was not declared in this scope 30 | if (i == 100002) { | ^
s096607152
p03721
C++
#include <iostream> #include <string> #include <algorithm> #include <cmath> #include <vector> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); unsigned long long int flag[1000000] = {}; int N,K; int a,b; unsigned long long int sum = 0; cin >> N >> K; for (int i = 0; i < N; i++) { cin >> a >> b; flag[a] += b; } for (int i = 1; i <= 100001; i++) { sum += flag[i]; if (sum >= K) { cout << i << '\n'; break; } } if (i == 100002) { cout << 0 << '\n'; } return 0; }
a.cc: In function 'int main()': a.cc:30:9: error: 'i' was not declared in this scope 30 | if (i == 100002) { | ^
s359298379
p03721
C++
10 500000 1 100000 1 100000 1 100000 1 100000 1 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 10 500000 | ^~
s893187448
p03721
C++
#include <bits/stdc++.h> using namespace std; long list[100001]; int main(){ int n,k,ans=0,m=0; long a,b; scanf("%d %d",&n,&k); int i; for(i=0;i<n;i++){ scanf("%ld %ld",&a,&b); list[a] += b; } for(i=0;i<100001;i++){ m = m + list[a]; if(m>=k){ ans = i; break; } } printf("%d\n",ans); }
a.cc: In function 'int main()': a.cc:13:17: error: reference to 'list' is ambiguous 13 | list[a] += b; | ^~~~ In file included from /usr/include/c++/14/list:65, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150, from a.cc:1: /usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list' 633 | class list : protected _List_base<_Tp, _Alloc> | ^~~~ a.cc:4:6: note: 'long int list [100001]' 4 | long list[100001]; | ^~~~ a.cc:16:25: error: reference to 'list' is ambiguous 16 | m = m + list[a]; | ^~~~ /usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list' 633 | class list : protected _List_base<_Tp, _Alloc> | ^~~~ a.cc:4:6: note: 'long int list [100001]' 4 | long list[100001]; | ^~~~
s569242360
p03721
C++
#include <bits/stdc++.h> using namespace std; long list[100001]; int main(){ int n,k,ans=0; long a,b; scanf("%d %d",&n,&k); int i; for(i=0;i<n;i++){ scanf("%ld %ld",&a,&b); list[a] += b; } for(i=0;i<100001;i++){ m = m + list[a]; if(m>=k){ ans = i; break; } } printf("%d\n",ans); }
a.cc: In function 'int main()': a.cc:13:17: error: reference to 'list' is ambiguous 13 | list[a] += b; | ^~~~ In file included from /usr/include/c++/14/list:65, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150, from a.cc:1: /usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list' 633 | class list : protected _List_base<_Tp, _Alloc> | ^~~~ a.cc:4:6: note: 'long int list [100001]' 4 | long list[100001]; | ^~~~ a.cc:16:17: error: 'm' was not declared in this scope 16 | m = m + list[a]; | ^ a.cc:16:25: error: reference to 'list' is ambiguous 16 | m = m + list[a]; | ^~~~ /usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list' 633 | class list : protected _List_base<_Tp, _Alloc> | ^~~~ a.cc:4:6: note: 'long int list [100001]' 4 | long list[100001]; | ^~~~
s796223517
p03721
C++
#include <bits/stdc++.h> using namespace std; long list[100001]; int main(){ int n,k,ans=0; long a,b; scanf("%d %d",&n,&k); int i; for(i=0;i<n;i++){ scanf("%ld %ld,&a,&b); list[a] += b; } for(i=0;i<100001;i++){ m = m + list[a]; if(m>=k){ ans = i; break; } } printf("%d\n",ans); }
a.cc:12:23: warning: missing terminating " character 12 | scanf("%ld %ld,&a,&b); | ^ a.cc:12:23: error: missing terminating " character 12 | scanf("%ld %ld,&a,&b); | ^~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:13:17: error: reference to 'list' is ambiguous 13 | list[a] += b; | ^~~~ In file included from /usr/include/c++/14/list:65, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150, from a.cc:1: /usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list' 633 | class list : protected _List_base<_Tp, _Alloc> | ^~~~ a.cc:4:6: note: 'long int list [100001]' 4 | long list[100001]; | ^~~~ a.cc:16:17: error: 'm' was not declared in this scope 16 | m = m + list[a]; | ^ a.cc:16:25: error: reference to 'list' is ambiguous 16 | m = m + list[a]; | ^~~~ /usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list' 633 | class list : protected _List_base<_Tp, _Alloc> | ^~~~ a.cc:4:6: note: 'long int list [100001]' 4 | long list[100001]; | ^~~~
s970604877
p03721
C++
#include <iostream> using namespace std;   int main(void) { int n; long long k; int a, b; int i; long long array[100010] = {};   cin >> n >> k;   for(i = 0; i < n; i++){ cin >> a >> b; array[a] += b; } i = 1; while(1){ k -= array[i]; if(k <= 0){ break; } i++; } cout << i << endl; return 0; }
a.cc:3:1: error: extended character   is not valid in an identifier 3 |   | ^ a.cc:11:1: error: extended character   is not valid in an identifier 11 |   | ^ a.cc:13:1: error: extended character   is not valid in an identifier 13 |   | ^ a.cc:3:1: error: '\U000000a0' does not name a type 3 |   | ^
s592507608
p03721
C++
#include <iostream> using namespace std;   int main(void) { int n; long long k; int a, b; int i; long long array[100010] = {};   cin >> n >> k;   for(i = 0; i < n; i++){ cin >> a >> b; array[a] += b; } i = 1; while(1){ k -= array[i]; if(k <= 0){ break; } i++; } cout << i << endl; return 0; }
a.cc:3:1: error: extended character   is not valid in an identifier 3 |   | ^ a.cc:11:1: error: extended character   is not valid in an identifier 11 |   | ^ a.cc:13:1: error: extended character   is not valid in an identifier 13 |   | ^ a.cc:3:1: error: '\U000000a0' does not name a type 3 |   | ^
s876683513
p03721
C++
#include <iostream> using namespace std; int main(void) { int n; long long k; int a, b; int i; long long temp = 0; int array[100010] = {}; cin >> n >> k; for(i = 0; i < n; i++){ cin >> a >> b; array[a] += b; } i = 0; while(1){ k -= array[i]; if(k < = 0){ break; } i++; } cout << i << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:16: error: expected primary-expression before '=' token 22 | if(k < = 0){ | ^
s978275406
p03721
C++
#include <iostream> using namespace std; int main(void) { int n; long long k; int a, b; int i; long long temp = 0; int array[100010] = {}; cin >> n >> k; for(i = 0; i < n; i++){ cin >> a >> b; array[a] += b; } i = 0; while(1){ k -= array[i]; if(k < = 0){ break; } i++; } cout << i << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:16: error: expected primary-expression before '=' token 22 | if(k < = 0){ | ^
s991910493
p03721
C++
#include <iostream> #include <vector> #include <map> #include <algorithm> using namespace std; int main(void) { int N,K; cin >> N >> K; vector< pair<int,int> > data(N); for (int i = 0; i < N; ++i) { cin >> data[i].first >> data[i].second; } sort(data.begin(),data.end()); bool find = false; int count = 0; for (int i = 0; !find && i < N; ++i) { count += data[i].second; if (count >= K) { cout << data[ind].first << endl; find = true; } } return 0; }
a.cc: In function 'int main()': a.cc:23:38: error: 'ind' was not declared in this scope; did you mean 'find'? 23 | cout << data[ind].first << endl; | ^~~ | find
s875052300
p03721
C++
#include <iostream> #include <vector> #include <map> #include <set> using namespace std; int n, k, a, b; set<int> num; map<int, long long> mp; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n >> k; for (int i = 0; i < n; ++i) { cin >> a >> b; num.insert(a); mp[a] += b; } long long cnt = 0; for (auto it = num.begin(); it != num.end(); ++i) { if (cnt <= k < cnt + mp[*it]) { cout << *it << endl; return 0; } else { cnt += mp[*it]; } } return 0; }
a.cc: In function 'int main()': a.cc:24:52: error: 'i' was not declared in this scope; did you mean 'it'? 24 | for (auto it = num.begin(); it != num.end(); ++i) { | ^ | it
s814864901
p03721
C++
#include <iostream> #include <vector> #include <map> #include <set> using namespace std; int n, k, a, b; set<int> num; map<int, long long> mp; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n >> k; for (int i = 0; i < n; ++i) { cin >> a >> b; num.insert(a); mp[a] += b; } long long cnt = 0; for (auto it = num.begin(); it != num.end(); ++i) { if (cnt <= k < cnt + mp[*it]) { cout << *it << endl; return 0; } else { cnt += mp[*it]; } } return 0; }
a.cc: In function 'int main()': a.cc:24:52: error: 'i' was not declared in this scope; did you mean 'it'? 24 | for (auto it = num.begin(); it != num.end(); ++i) { | ^ | it
s027803012
p03721
C
#include<stdio.h> int main(){ int N,K,i,j; int a[100001]; int b[100001]; scanf("%d %d",&N,&K); j=K; for(i=0;i<N;i++){ scanf("%d %d",&a[i],&b[i]); } for(i=0;i<N;i++){ if(j>0){ j=j-b[i]; if(j<=0){ printf("%d\n",a[i]); return 0; } } }
main.c: In function 'main': main.c:19:1: error: expected declaration or statement at end of input 19 | } | ^
s045280301
p03721
C++
#include <iostream> using namespace std; long long ANUM[100001]; int main(){ int N; long long K; cin >>N >>K; for(int i=0; i < N; i++){ int a,b; cin >>a >>b; ANUM[a]+=b; } for(int i=1;i<=100000;i++){ if(K<=ANUM[i]){ cout<<i<<endl; break; } K -= ANUM[i]; } return 0;
a.cc: In function 'int main()': a.cc:21:14: error: expected '}' at end of input 21 | return 0; | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s188306463
p03721
C
#include <stdio.h> int main(void){ long long int i,n,a,b,k; long long int num[100001]={0}; scanf( "%lld %lld",&n,&k ); for( i = 0; i < n; i++ ){ scanf( "%lld %lld",&a,&b); num[a] = num[a] + b; } for( i = 1; i < 100001; i++ ){ k = k - num[i] if( k <= 0 ){ printf( "%lld",i ); break; } } return 0; }
main.c: In function 'main': main.c:17:23: error: expected ';' before 'if' 17 | k = k - num[i] | ^ | ; 18 | if( k <= 0 ){ | ~~
s913839313
p03721
C++
#include <algorithm> #include <vector> #include <map> using namespace std; int main(){ int n,k,a,b,i; vector <pair<int,int> > pairs(100000); cin>>n>>k; for(i=0;i<n;i++){ cin>>a>>b; pairs[i]=make_pair(b,a); } sort(pairs.begin(),pairs.end()); /* for(i=0;i<n-1;i++) for(j=0;j<n-1;j++) if(a[j]>a[j+1]){ int blank; blank=a[j]; a[j]=a[j+1]; a[j+1]=blank; blank=b[j]; b[j]=b[j+1]; b[j+1]=blank; } */ for(i=0;k>0;i++) k-=pairs[i].first; i--; cout<<pairs[i].second<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:3: error: 'cin' was not declared in this scope 10 | 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 <map> +++ |+#include <iostream> 4 | using namespace std; a.cc:31:3: error: 'cout' was not declared in this scope 31 | cout<<pairs[i].second<<endl; | ^~~~ a.cc:31:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:31:26: error: 'endl' was not declared in this scope 31 | cout<<pairs[i].second<<endl; | ^~~~ a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 3 | #include <map> +++ |+#include <ostream> 4 | using namespace std;
s536218229
p03721
C++
#include <bits/stdc++.h> using namespace std; #define se second #define fi first typedef long long ll; int main() { ll n,k; cin >> n >> k; ll ska,b; for(int i = 0;i<n;i++){ cin >> ska >> b; sk.push_back(make_pair(ska,b)); } sort(sk.begin(),sk.end()); ll sum = 0; for(int i = 0;i<n;i++){ sum += sk[i].se; if(sum >= k){ cout << sk[i].fi; break; } } return 0; }
a.cc: In function 'int main()': a.cc:16:17: error: 'sk' was not declared in this scope; did you mean 'ska'? 16 | sk.push_back(make_pair(ska,b)); | ^~ | ska a.cc:18:14: error: 'sk' was not declared in this scope; did you mean 'ska'? 18 | sort(sk.begin(),sk.end()); | ^~ | ska
s126605294
p03721
C++
#include <bits/stdc++.h> using namespace std; #define se second #define fi first typedef long long ll; int main() { ll n,k; cin >> n >> k; ll ska,b; for(int i = 0;i<n;i++){ cin >> ska >> b; sk.push_back(make_pair(ska,b)); } sort(sk.begin(),sk.end()); ll sum = 0; for(int i = 0;i<n;i++){ sum += sk[i].se; if(sum >= k){ cout << sk[i].fi; break; } } return 0; }
a.cc: In function 'int main()': a.cc:16:17: error: 'sk' was not declared in this scope; did you mean 'ska'? 16 | sk.push_back(make_pair(ska,b)); | ^~ | ska a.cc:18:14: error: 'sk' was not declared in this scope; did you mean 'ska'? 18 | sort(sk.begin(),sk.end()); | ^~ | ska
s633198370
p03721
C
#include <stdio.h> int main() { int N,i,a,b,K,c[100001]={}; scanf("%d%d",&N,&K); for(i=0;i<N;i++){ scanf("%d%d",&a,&b); c[a]+=b; } for(i=1;i<100001;i++){ K-=c[i] if(K<=0){ printf("%d\n",i); break; } } return 0; }
main.c: In function 'main': main.c:11:16: error: expected ';' before 'if' 11 | K-=c[i] | ^ | ; 12 | if(K<=0){ | ~~
s299203275
p03721
C++
#include <iostream> #include <algorithm> using namespace std; typedef pair<int, int> P; int main() { int N, K; cin >> N >> K; vector<P> p; int a, b; for (int i = 0; i < N; i++) { cin >> a >> b; p.push_back(P(a, b)); } sort(p.begin(), p.end()); for (int i = 0; i < p.size(); i++) { if (K < p[i].second) { cout << p[i].first << endl; break; } K -= p[i].second; } return 0; }
a.cc: In function 'int main()': a.cc:10:3: error: 'vector' was not declared in this scope 10 | vector<P> p; | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include <algorithm> +++ |+#include <vector> 3 | using namespace std; a.cc:10:11: error: expected primary-expression before '>' token 10 | vector<P> p; | ^ a.cc:10:13: error: 'p' was not declared in this scope 10 | vector<P> p; | ^
s245089554
p03721
Java
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { private static Scanner scan = new Scanner(System.in); public static void main(String[] args) { int N = 0; int K = 0; List<MyClass> list = null; try { N = Integer.parseInt(scan.next()); K = Integer.parseInt(scan.next()); } catch(Exception e) { System.out.println(0); System.exit(0); } List<MyClass> list = new ArrayList<MyClass>(); for (int i = 0; i < N; i++) { int a = Integer.parseInt(scan.next()); int b = Integer.parseInt(scan.next()); list.add(new MyClass(a, b)); } Collections.sort(list); int num = 0; int ans = 0; for(MyClass l: list) { num += l.b; if(num >= K) { ans = l.a; break; } } System.out.println(ans); scan.close(); } } class MyClass implements Comparable<MyClass> { int a; int b; MyClass(int a, int b) { this.a = a; this.b = b; } @Override public int compareTo(MyClass o) { return a - o.a; } }
Main.java:24: error: variable list is already defined in method main(String[]) List<MyClass> list = new ArrayList<MyClass>(); ^ 1 error
s980424543
p03721
Java
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { private static Scanner scan = new Scanner(System.in); public static void main(String[] args) { try { int N = Integer.parseInt(scan.next()); int K = Integer.parseInt(scan.next()); List<MyClass> list = new ArrayList<MyClass>(); } catch(Exception e) { System.out.println(0); System.exit(0); } for (int i = 0; i < N; i++) { int a = Integer.parseInt(scan.next()); int b = Integer.parseInt(scan.next()); try { list.add(new MyClass(a, b)); } catch (Exception e) { System.out.println(0); System.exit(0); } } try { Collections.sort(list); } catch (Exception e) { System.out.println(0); System.exit(0); } try { int num = 0; int ans = 0; for(MyClass l: list) { num += l.b; if(num >= K) { ans = l.a; break; } } System.out.println(ans); } catch(Exception e) { System.out.println(0); System.exit(0); } scan.close(); } } class MyClass implements Comparable<MyClass> { int a; int b; MyClass(int a, int b) { this.a = a; this.b = b; } @Override public int compareTo(MyClass o) { return a - o.a; } }
Main.java:23: error: cannot find symbol for (int i = 0; i < N; i++) { ^ symbol: variable N location: class Main Main.java:28: error: cannot find symbol list.add(new MyClass(a, b)); ^ symbol: variable list location: class Main Main.java:36: error: cannot find symbol Collections.sort(list); ^ symbol: variable list location: class Main Main.java:45: error: cannot find symbol for(MyClass l: list) { ^ symbol: variable list location: class Main Main.java:47: error: cannot find symbol if(num >= K) { ^ symbol: variable K location: class Main 5 errors
s938173493
p03721
Java
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { private static Scanner scan = new Scanner(System.in); public static void main(String[] args) { int N = Integer.parseInt(scan.next()); int K = Integer.parseInt(scan.next()); List<MyClass> list = new ArrayList<MyClass>(); for (int i = 0; i < N; i++) { int a = Integer.parseInt(scan.next()); int b = Integer.parseInt(scan.next()); try { list.add(new MyClass(a, b)); } catch (Exception e) { System.out.println(0); System.exit(0); } } try { Collections.sort(list); } catch (Exception e) { System.out.println(0); System.exit(0); } try { int num = 0; int ans = 0; for(MyClass l: list) { num += l.b; if(num >= K) { ans = l.a; break; } } } catch(Exception e) { System.out.println(0); System.exit(0); } System.out.println(ans); scan.close(); } } class MyClass implements Comparable<MyClass> { int a; int b; MyClass(int a, int b) { this.a = a; this.b = b; } @Override public int compareTo(MyClass o) { return a - o.a; } }
Main.java:52: error: cannot find symbol System.out.println(ans); ^ symbol: variable ans location: class Main 1 error
s098004616
p03721
Java
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); int n = scanner.nextlong(); int k = scanner.nextlong(); int count = 0; for(int i=0;i<n*2-1;i++){ int p = scanner.nextlong(); count += scanner.nextlong(); if(count >= k){ System.out.println(p); break; } } } }
Main.java:8: error: cannot find symbol int n = scanner.nextlong(); ^ symbol: method nextlong() location: variable scanner of type Scanner Main.java:9: error: cannot find symbol int k = scanner.nextlong(); ^ symbol: method nextlong() location: variable scanner of type Scanner Main.java:12: error: cannot find symbol int p = scanner.nextlong(); ^ symbol: method nextlong() location: variable scanner of type Scanner Main.java:13: error: cannot find symbol count += scanner.nextlong(); ^ symbol: method nextlong() location: variable scanner of type Scanner 4 errors
s711277504
p03721
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n, k; cin >> n >> k; map<int, ll> mp; for(int i = 0; i < n; i++) { } int a, b; cin >> a >> b; mp[a] += b; } ll s = 0; for(auto&& e : mp) { s += e.second; if(s >= k) { cout << e.first << endl; break; } } return 0; }
a.cc:19:5: error: expected unqualified-id before 'for' 19 | for(auto&& e : mp) { | ^~~ a.cc:28:5: error: expected unqualified-id before 'return' 28 | return 0; | ^~~~~~ a.cc:29:1: error: expected declaration before '}' token 29 | } | ^
s538461749
p03721
Java
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner scan = new Scanner(System.in); long N = scan.nextInt(); long K = scan.nextInt(); int [] A = new int [100001]; Arrays.fill(A, 0); long sum = 0; for(int i=0;i<N;i++){ int a = scan.nextInt(); int B = scan.nextInt(); A[a] += B; } for(int i=0;i<10001;i++){ sum +=A[i]; if(sum>=K){ System.out.println(i); break; } } }
Main.java:26: error: reached end of file while parsing } ^ 1 error
s646184548
p03721
C++
#include <iostream> #include <math.h> #include<algorithm> typedef unsigned long long ulong; using namespace std; int main(int argc, const char * argv[]) { long N,K; cin>>N>>K; ulong * array=new ulong[N]; long a,b; for (long i = 0; i < N; i++) { cin >>a>>b; array[i]=b; array[i]|=(a<<32); } sort(array, array+N); long count = 0; for (long i = 0; i < N; i++) { count+=(array[i]&0xFFFFFFFF); if(count>=K) { cout<<(array[i]>>32)<<endl; return 0; } } delete[] array; return 0; }
a.cc:6:28: error: conflicting declaration 'typedef long long unsigned int ulong' 6 | typedef unsigned long long ulong; | ^~~~~ In file included from /usr/include/stdlib.h:514, from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/ext/string_conversions.h:43, from /usr/include/c++/14/bits/basic_string.h:4154, from /usr/include/c++/14/string:54, 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:3: /usr/include/x86_64-linux-gnu/sys/types.h:148:27: note: previous declaration as 'typedef long unsigned int ulong' 148 | typedef unsigned long int ulong; | ^~~~~
s379794887
p03721
C++
#include<stdio.h> int main(){ long long int N,K,i,sum=0; long long int n[100001]={}; scanf("%d%d",&N,&K); for(i=1;i<=N;i++){ scanf("%lld %lld",&a,&b); n[a]+=b; } for(i=1;i<=N;i++){ sum+=n[i]; if(sum>=K) break; } printf("%d",i); return 0; }
a.cc: In function 'int main()': a.cc:8:28: error: 'a' was not declared in this scope 8 | scanf("%lld %lld",&a,&b); | ^ a.cc:8:31: error: 'b' was not declared in this scope 8 | scanf("%lld %lld",&a,&b); | ^
s244991686
p03721
Java
import java.io.*; import java.util.*; import java.lang.Math.*; public class Main { public static void main(String[] args) { Main main = new Main(); try { main.solve(args); } catch (Exception e) { e.printStackTrace(); } } public void solve(String[] args) throws Exception { MyScanner scanner = new MyScanner(); int N = scanner.nextInt(); long K = scanner.nextLong(); HashMap<Integer, Long> map = new HashMap<>(); for (int i = 0; i < N; i++) { int a = scanner.nextInt(); int b = scanner.nextInt(); Long j = map.get(a); if (j == null) { map.put(a, (long)b); } else { map.put(a, (long)b + (long)j); } } // キーでソートする Object[] mapkey = map.keySet().toArray(); Arrays.sort(mapkey); for (Integer nKey : mapkey) { Long c = map.get(nKey); K = K - c; if (K <= 0) { System.out.println(nKey); return; } } } private class MyScanner { String[] s; int i; BufferedReader br; String reg = " "; MyScanner () { s = new String[0]; i = 0; br = new BufferedReader(new InputStreamReader(System.in)); } public String next() throws IOException { if (i < s.length) return s[i++]; String line = br.readLine(); while (line.equals("")) { line = br.readLine(); } s = line.split(reg, 0); i = 0; return s[i++]; } public int nextInt() { try { return Integer.parseInt(next()); } catch (Exception e) { e.printStackTrace(); } return -1; } public double nextDouble() { try { return Double.parseDouble(next()); } catch (Exception e) { e.printStackTrace(); } return -1; } public long nextLong() { try { return Long.parseLong(next()); } catch (Exception e) { e.printStackTrace(); } return -1; } } }
Main.java:36: error: incompatible types: Object cannot be converted to Integer for (Integer nKey : mapkey) { ^ 1 error
s014373715
p03721
Java
import java.io.*; import java.util.*; import java.lang.Math.*; public class Main { public static void main(String[] args) { Main main = new Main(); try { main.solve(args); } catch (Exception e) { e.printStackTrace(); } } public void solve(String[] args) throws Exception { MyScanner scanner = new MyScanner(); int N = scanner.nextInt(); long K = scanner.nextLong(); HashMap<Integer, Long> map = new HashMap<>(); for (int i = 0; i < N; i++) { int a = scanner.nextInt(); int b = scanner.nextInt(); Long j = map.get(a); if (j == null) { map.put(a, (long)b); } else { map.put(a, (long)b + (long)j); } } // キーでソートする Integer[] mapkey = map.keySet().toArray(); Arrays.sort(mapkey); for (Integer nKey : map.keySet()) { Long c = map.get(nKey); K = K - c; if (K <= 0) { System.out.println(nKey); return; } } } private class MyScanner { String[] s; int i; BufferedReader br; String reg = " "; MyScanner () { s = new String[0]; i = 0; br = new BufferedReader(new InputStreamReader(System.in)); } public String next() throws IOException { if (i < s.length) return s[i++]; String line = br.readLine(); while (line.equals("")) { line = br.readLine(); } s = line.split(reg, 0); i = 0; return s[i++]; } public int nextInt() { try { return Integer.parseInt(next()); } catch (Exception e) { e.printStackTrace(); } return -1; } public double nextDouble() { try { return Double.parseDouble(next()); } catch (Exception e) { e.printStackTrace(); } return -1; } public long nextLong() { try { return Long.parseLong(next()); } catch (Exception e) { e.printStackTrace(); } return -1; } } }
Main.java:34: error: incompatible types: Object[] cannot be converted to Integer[] Integer[] mapkey = map.keySet().toArray(); ^ 1 error
s828128590
p03721
C++
#define MAX 100000 using namespace std; int main(){ long long int data[MAX]; for(int i=0;i<MAX;i++){ data[i]=0; } long long int n,m; cin>>n>>m; for(int i=0;i<n;i++){ long long int a,b; cin>>a>>b; data[a-1]+=b; } int count=0; for(int i=0;;i++){ count+=data[i]; if(count>=m){ cout<<i+1<<endl; break; } } return 0; }
a.cc: In function 'int main()': a.cc:9:9: error: 'cin' was not declared in this scope 9 | cin>>n>>m; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #define MAX 100000 a.cc:19:25: error: 'cout' was not declared in this scope 19 | cout<<i+1<<endl; | ^~~~ a.cc:19:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:19:36: error: 'endl' was not declared in this scope 19 | cout<<i+1<<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | #define MAX 100000
s004620076
p03721
C++
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; int n; long long k; vector<pii> f[100005]; int main() { cin >> n >> k; for(int i = 1; i <= n; ++i) { int a, b; cin >> a >> b; f.push_back(pii(a, b)); } sort(f.begin(), f.end()); long long t = 0; for(int i = 0; i < n; ++i) { t += f[i].second; if (t >= k) { cout << f[i].first << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:11:8: error: request for member 'push_back' in 'f', which is of non-class type 'std::vector<std::pair<int, int> > [100005]' 11 | f.push_back(pii(a, b)); | ^~~~~~~~~ a.cc:13:8: error: request for member 'begin' in 'f', which is of non-class type 'std::vector<std::pair<int, int> > [100005]' 13 | sort(f.begin(), f.end()); | ^~~~~ a.cc:13:19: error: request for member 'end' in 'f', which is of non-class type 'std::vector<std::pair<int, int> > [100005]' 13 | sort(f.begin(), f.end()); | ^~~ a.cc:16:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'second' 16 | t += f[i].second; | ^~~~~~ a.cc:18:15: error: 'class std::vector<std::pair<int, int> >' has no member named 'first' 18 | cout << f[i].first << endl; | ^~~~~
s131524568
p03721
Java
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Main { static void quick_sort(int[] d, int[] e, int left, int right) { if (left>=right) { return; } int p = d[(left+right)/2]; int l = left, r = right, tmp; while(l<=r) { while(d[l] < p) { l++; } while(d[r] > p) { r--; } if (l<=r) { tmp = d[l]; d[l] = d[r]; d[r] = tmp; tmp = e[l]; e[l] = e[r]; e[r] = tmp; l++; r--; } } quick_sort(d, left, r); // ピボットより左側をクイックソート quick_sort(d, l, right); // ピボットより右側をクイックソート } public static void result_print(int[] d, int[] e, int k) { int count = 0; while(k > 0) { k = k - e[count]; count++; } System.out.print(d[count]); } public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] d = new int[n]; int[] e = new int[n]; for(int i = 0; i < d.length; i++) { d[i] = sc.nextInt(); e[i] = sc.nextInt(); } quick_sort(d, e, 0, d.length - 1); } }
Main.java:25: error: method quick_sort in class Main cannot be applied to given types; quick_sort(d, left, r); // ???????????????? ^ required: int[],int[],int,int found: int[],int,int reason: actual and formal argument lists differ in length Main.java:26: error: method quick_sort in class Main cannot be applied to given types; quick_sort(d, l, right); // ???????????????? ^ required: int[],int[],int,int found: int[],int,int reason: actual and formal argument lists differ in length 2 errors
s128089999
p03721
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i, j, k) for(int i = j; i < k; ++i) #define rep(i, j) FOR(i, 0, j) #define FORr(i, j, k) for(int i = j; i >= k; --i) #define repr(i, j) FOR(i, j, 0) #define INF (1 << 30) #define MOD 1e9 + 7 typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<P, int> Pi; int N, K; vector<int> array; int main() { scanf("%d %d", &N, &K); rep(i, N) { int a, b; scanf("%d %d", &a, &b); array.insert(array.begin(), b, a); } sort(array.begin(), array.end()); printf("%d\n", array[K - 1]); return 0; }
a.cc: In function 'int main()': a.cc:25:17: error: reference to 'array' is ambiguous 25 | array.insert(array.begin(), b, a); | ^~~~~ 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:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:18:13: note: 'std::vector<int> array' 18 | vector<int> array; | ^~~~~ a.cc:25:30: error: reference to 'array' is ambiguous 25 | array.insert(array.begin(), b, a); | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:18:13: note: 'std::vector<int> array' 18 | vector<int> array; | ^~~~~ a.cc:27:14: error: reference to 'array' is ambiguous 27 | sort(array.begin(), array.end()); | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:18:13: note: 'std::vector<int> array' 18 | vector<int> array; | ^~~~~ a.cc:27:29: error: reference to 'array' is ambiguous 27 | sort(array.begin(), array.end()); | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:18:13: note: 'std::vector<int> array' 18 | vector<int> array; | ^~~~~ a.cc:28:24: error: reference to 'array' is ambiguous 28 | printf("%d\n", array[K - 1]); | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array' 99 | struct array; | ^~~~~ a.cc:18:13: note: 'std::vector<int> array' 18 | vector<int> array; | ^~~~~