submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s247932051
p00157
C
#include<stdio.h> int LIS(void); int h[201], r[201], m, n; int main(void) { int i, j, t; while(1) { scanf("%d",&n); if(n==0)break; for(i=0;i<n;i++) scanf("%d%d",&h[i] ,&r[i]); scanf("%d",&m); for(i=n;i<n+m;i++) scanf("%d%d",&h[i],&r[i]); for(i=0;i<n+m;i++) { for(j=0;j<n+m;j++) { if(h[i]<h[j]) { t=h[i]; h[i]=h[j]; h[j]=t; t=r[i]; r[i]=r[j]; r[j]=t; } if(h[i]==h[j] && r[i]<r[j]) { t=h[i]; h[i]=h[j]; h[j]=t; t=r[i]; r[i]=r[j]; r[j]=t; } } } printf("%d\n",LIS()); } return 0; } int LIS(void) { int i ,j ,k ,L[201] ,max=0; for(i=0;i<201;i++) L[i]=1; for(i=1;i<n+m;i++) { j=i-1; for(k=0;k<i;k++) { if(r[k]<r[i] && h[k]<h[i]ツ && L[k]>=L[i])L[i]=L[k]+1; } } for(i=0;i<n+m;i++) if(max<L[i])max=L[i]; return max; }
main.c: In function 'LIS': main.c:127:26: error: expected ')' before '\U000030c4' 127 | if(r[k]<r[i] && h[k]<h[i]ツ && L[k]>=L[i])L[i]=L[k]+1; | ~ ^~ | ) main.c:127:28: error: stray '\343' in program 127 | if(r[k]<r[i] && h[k]<h[i]<U+30C4><U+3000>&& L[k]>=L[i])L[i]=L[k]+1; | ^~~~~~~~
s927759224
p00157
C
#include<iostream> #include<cstdio> #define N 1000 using namespace std; int h1[N],r1[N]; void sort(int,int); int syori(int,int); int main(){/*main*/ int i,n1,n2,j,res; for(i=0;i<N;i++){ h1[i]=0; r1[i]=0; } while(1){ cin >> n1; // ˆê˜Q‚̃}ƒgƒŠƒ‡[ƒVƒJ‚̐” if(n1 == 0)break; for(i=0;i<n1;i++){ cin >> h1[i] >> r1[i]; //(n1-1)‚܂łªˆê˜Q } cin >> n2; //“ñ˜Y‚̃}ƒgƒŠƒ‡[ƒVƒJ‚̐” for(i=n1;i<(n1+n2);i++){ cin >> h1[i] >> r1[i]; //n1‚©‚ç(n1+n2-1)‚܂łª“ñ˜Y } sort(n1,n2); // ¬‚³‚¢‡‚É•À‚ёւ¦ // for(i=0;i<n1+n2;i++){ // cout << i << ":"<< h1[i] << " " << r1[i] <<endl; // } res=syori(n1,n2); cout << res << endl; res=0; } } void sort(int n1,int n2){ int k,l,max,h; for(k=0;k<(n1+n2);k++){ max=k; for(l=k;l<(n1+n2);l++){ if(h1[l]<h1[max]){ max=l; } } h=h1[max]; h1[max]=h1[k]; h1[k]=h; h=r1[max]; r1[max]=r1[k]; r1[k]=h; } } int syori(int n1,int n2){ int q,i,H[N],Hcount=0,ans,I[N],HH[N],count=1,kcount=0; ans=0; for(q=0;q<N-5;q++){ H[q]=0; I[q]=0; HH[q]=0; } //cout << "test" << endl; for(q=0;q<(n1+n2);q++){ if(h1[q]<h1[q+1] && r1[q]<r1[q+1])count++; if((h1[q]==h1[q+1] || r1[q] == r1[q+1]) && HH[q+1]==0 ){ count++; H[q+1]=count-1; HH[q+1]=1; Hcount++; I[q+1]=q+1; q+=1; } // cout << Hcount << endl; if(q==(n1+n2-1) && Hcount!=0){ Hcount=0; kcount=1; if(count>=ans)ans=count; // cout << "ans--" << ans << endl; for(i=0;i<(n1+n2);i++){ if(HH[i]==1){ count=H[i]; H[i]=0; HH[i]=0; q=I[i]; break; } } } } if(kcount==0){ ans=count; } // kcount‚ª‚O‚̂Ƃ«‚Í‚¾‚Ô‚è‚È‚µ else{ kcount=0; } // ‚±‚̃vƒƒOƒ‰ƒ€‚ł͂¾‚Ô‚ç‚È‚¢‚Æans‚ª‚łȂ¢ return ans; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s319724215
p00157
C
#include<iostream> using namespace std; int main(void){ int n,m,h[201],r[201]; while(cin >> n,n){ for(int i=0;i<n;i++)cin >> h[i] >> r[i]; cin >>m; for(int i=n;i<n+m;i++)cin >> h[i] >> r[i]; for(int i=0;i<n+m;i++){ for(int j=i;j<n+m;j++){ if(h[i]>h[j]){ int t=h[i]; h[i]=h[j]; h[j]=t; t=r[i]; r[i]=r[j]; r[j]=t; } } } for(int i=0;i<n+m;i++){ for(int j=i;j<n+m;j++){ if(r[i]>r[j]){ int t=h[i]; h[i]=h[j]; h[j]=t; t=r[i]; r[i]=r[j]; r[j]=t; } } } int dp[201]={0}; dp[0]=1; for(int i=0;i<n+m;i++){ for(int j=i+1;j<n+m;j++){ if(h[i]<h[j] && r[i]<r[j] && dp[i]>=dp[j])dp[j]=dp[i]+1; } } int res=0; for(int i=0;i<n+m;i++)res=max(res,dp[i]); cout << res << endl; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s804897600
p00157
C++
#include<cstdio> #include<algorithm> #include<vector> #include<utility> #define rep(i,a) for( int i = 0; i != (a); ++i ) const int INF = 1 << 30; typedef std::pair<int, int> P; int n, m; int dp[200]; int main() { while( scanf( "%d", &n ), n ) { memset( dp, 0, sizeof( dp ) ); std::vector<P> ps; rep( i, n ) { int h, r; scanf( "%d%d", &h, &r ); ps.push_back( P( h, r ) ); } scanf( "%d", &m ); rep( i, m ) { int h, r; scanf( "%d%d", &h, &r ); ps.push_back( P( h, r ) ); } std::sort( ps.begin(), ps.end() ); int ans = 0; rep( i, ps.size() ) { dp[i] = 1; rep( j, i ) if( ps[i].first > ps[j].first && ps[i].second > ps[j].second ) dp[i] = std::max( dp[i], dp[j]+1 ); ans = std::max( ans, dp[i] ); } printf( "%d\n", ans ); } return 0; }
a.cc: In function 'int main()': a.cc:18:17: error: 'memset' was not declared in this scope 18 | memset( dp, 0, sizeof( dp ) ); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<utility> +++ |+#include <cstring> 5 | #define rep(i,a) for( int i = 0; i != (a); ++i )
s451938515
p00157
C++
#include <iostream> #include <vector> using namespace std; typedef pair<int, int> Doll; vector<Doll> Dolls; int dp[201]; void debug(){ for(int i = 0; i < Dolls.size(); i++){ cout << "(" << Dolls[i].first << ", " << Dolls[i].second << ")" << endl; } } bool comp(const Doll& d1, const Doll& d2){ return ((d1.first <= d2.first) && (d1.second <= d2.second)); } int main(void){ int n, m; while(cin >> n, n){ Dolls.clear(); Dolls.push_back(Doll(0, 0)); for(int i = 0; i < n; i++){ int h, r; cin >> h >> r; Dolls.push_back(Doll(h, r)); } cin >> m; for(int i = 0; i < m; i++){ int h, r; cin >> h >> r; Dolls.push_back(Doll(h, r)); } sort(Dolls.begin(), Dolls.end(), comp); for(int i = 1; i < Dolls.size(); i++){ int max_k = 0; for(int j = 0; j < i; j++){ if(Dolls[j].first < Dolls[i].first && Dolls[j].second < Dolls[i].second && dp[max_k] < dp[j]){ max_k = j; } } dp[i] = dp[max_k] + 1; } cout << dp[Dolls.size()-1] + 1 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:35:5: error: 'sort' was not declared in this scope; did you mean 'short'? 35 | sort(Dolls.begin(), Dolls.end(), comp); | ^~~~ | short
s165070293
p00157
C++
#include <iostream> #include <algorithm> using namespace std; #define MAX_NM 202 struct D{int r, h;}; bool compr(const D& d1, const D& d2){ return d1.r < d2.r; } bool comph(const D& d1, const D& d2){ return d1.h < d2.h; } int main(void){ int n, m, dp[MAX_NM]; D d[MAX_NM]; while(cin >> n, n){ for(int i = 0; i < n; i++) cin >> d[i].h >> d[i].r; cin >> m; for(int i = 0; i < m; i++) cin >> a[n+i].h >> a[n+i].r; int lis_r = 0, lis_h = 0; sort(d, d + n + m, compr); dp[0] = 1; for(int i = 1; i < n + m; i++){ dp[i] = 1; for(int j = 0; j < i; j++){ if(d[j].r < d[i].r && d[j].h < d[i].h){ dp[i] = max(dp[i], dp[j] + 1); } } } lis_r = dp[n+m-1]; sort(d, d + n + m, comph); dp[0] = 1; for(int i = 1; i < n + m; i++){ dp[i] = 1; for(int j = 0; j < i; j++){ if(d[j].r < d[i].r && d[j].h < d[i].h){ dp[i] = max(dp[i], dp[j] + 1); } } } lis_h = dp[n+m-1]; cout << max(lis_h, lis_r) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:22:39: error: 'a' was not declared in this scope 22 | for(int i = 0; i < m; i++) cin >> a[n+i].h >> a[n+i].r; | ^
s043204181
p00157
C++
#include <iostream> #include <string.h> #include <algorithm> using namespace std; typedef pair<int, int> P; const int INF = 1e+9; int DP[1000]; int main() { int n, m, h, r; while(cin >> n && n){ memset(DP, 0, sizeof(DP)); vector<P> vec; for(int i = 0; i < n; ++i){ cin >> h >> r; vec.push_back(P(h, r)); } cin >> m; for(int i = 0; i < m; ++i){ cin >> h >> r; vec.push_back(P(h, r)); } sort(vec.begin(), vec.end()); int ans = 0; for(int i = 0; i < (n + m); ++i){ DP[i] = 1; for(int j = 0; j < i; ++j){ if(vec[j].first < vec[i].first && vec[j].second < vec[i].second) DP[i] = max(DP[i], DP[j] + 1); } ans = max(ans, DP[i]); } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:15:17: error: 'vector' was not declared in this scope 15 | vector<P> vec; | ^~~~~~ a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 3 | #include <algorithm> +++ |+#include <vector> 4 | using namespace std; a.cc:15:25: error: expected primary-expression before '>' token 15 | vector<P> vec; | ^ a.cc:15:27: error: 'vec' was not declared in this scope 15 | vector<P> vec; | ^~~
s995302928
p00157
C++
// AOJ20150414.cpp : テ」ツつウテ」ツδウテ」ツつステ」ツδシテ」ツδォ テ」ツつ「テ」ツδ療」ツδェテ」ツつアテ」ツδシテ」ツつキテ」ツδァテ」ツδウテ」ツ?ョテ」ツつィテ」ツδウテ」ツδ暗」ツδェ テ」ツδ敕」ツつ、テ」ツδウテ」ツδ暗」ツつ津・ツョツ堙ァツセツゥテ」ツ?療」ツ?セテ」ツ?凖」ツ?? // #include "stdafx.h" #include <iostream> #include <vector> #include <algorithm> using namespace std; struct DOLL{ int h; int r; }; int f(vector<DOLL> &d1, vector<DOLL> &d2, int h, int r) { int ans = 1; for (DOLL &d : d1){ if (d.h>h && d.r>r){ int a = f(d1, d2, h, r); ans = max(ans, a); } } for (DOLL &d : d2){ if (d.h>h && d.r>r){ int a = f(d1, d2, h, r); ans = max(ans, a); } } return ans; } int main() { while (true){ int n, m; cin >> n >> m; if (n == 0) break; vector<DOLL> d1; vector<DOLL> d2; for (int i = 0; i<n; i++){ DOLL d; cin >> d.h >> d.r; d1.push_back(d); } for (int i = 0; i<m; i++){ DOLL d; cin >> d.h >> d.r; d2.push_back(d); } int ans = f(d1, d2, -1, -1); cout << ans << endl; } return 0; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s991398499
p00157
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <utility> int N, M; std::pair<int, int> Mat[201]; int dp[201]; int main(){ while(scanf("%d", &N), N){ memset(dp, -1, sizeof(dp)); for(int i = 0; i < N; ++i) scanf("%d %d", &Mat[i].first, &Mat[i].second); scanf("%d", &M); for(int i = 0; i < M; ++i) scanf("%d %d", &Mat[i + N].first, &Mat[i + N].second); std::sort(Mat, Mat + (M + N)); for(int i = 0; i < N + M; ++i) dp[i] = 1; int res = 1; for(int i = 0; i < N + M; ++i){ for(int j = 0; j < i; ++j){ if(Mat[i].first > Mat[j].first && Mat[i].second > Mat[j].second){ dp[i] = std::max(dp[i], dp[j] + 1); res = std::max(res, dp[i]); } } } std::cout << res << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:9: error: 'memset' was not declared in this scope 12 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <utility> +++ |+#include <cstring> 5 |
s288407247
p00157
C++
# define _CRT_SECURE_NO_WARNINGS # include <cstdio> # include <algorithm> #define MAX 100 struct doll{ int high, r; doll() {} doll(int H, int R) : high(H), r(R) {} bool operator<(doll d){ return (high < d.high) ? true : (high == d.high) ? (r < d.r) ? true : false : false; } }; int n, m; doll K[MAX * 2]; int dp[MAX * 2]; int main(){ while (1){ int h, r; scanf("%d", &n); if (n == 0) break; for (int i = 0; i < n; ++i){ scanf("%d %d", &h, &r); K[i].high = h; K[i].r = r; } scanf("%d", &m); for (int i = n; i < m+n; ++i){ scanf("%d %d", &h, &r); K[i].high = h; K[i].r = r; } std::sort(K + 1, K + 1 + n + m); memset(dp, 0,n+m); for (int i = 0; i < n + m; ++i){ for (int j = 0; j < n + m; ++j){ if (K[j] < K[i]) dp[i] = std::max(dp[i], dp[j] + 1); } } printf("%d\n", dp[n + m-1]); } return 0; }
a.cc: In function 'int main()': a.cc:38:17: error: 'memset' was not declared in this scope 38 | memset(dp, 0,n+m); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | # include <algorithm> +++ |+#include <cstring> 4 |
s555686313
p00157
C++
#include <iostream> #include <vector> #include <algorithm> #define F first #define S second using namespace std; typedef pair<int, int> P; const int INF = 1 << 30; int main(){ ????int n, m; ????int dp[2000]; ????P doll[2000]; ????while(cin >> n && n){ ????????fill(doll, doll+2000, P(0, 0)); ????????fill(dp, dp + 2000, INF); ????????for (int i = 0; i < n; i++){ ????????????int a, b; ????????????cin >> a >> b; ????????????doll[i] = P(a, b); ????????} ????????cin >> m; ????????for (int i = n; i < n + m; i++){ ????????????int a, b; ????????????cin >> a >> b; ????????????doll[i] = P(a, b); ????????} ????????sort(doll, doll + n + m); ????????for (int i = 0; i < n + m; i++){ ????????*lower_bound(dp, dp + 2000, doll[i].S) = doll[i].S; ????????} ??????????int ans; ????????????????for(int i=n+m-1; i>=0; --i){ ????????????????????????if(dp[i] != INF){ ????????????????????????????????ans = i + 1; ????????????????????????????????break; ????????????????????????} ????????????????} ????????cout << ans << endl; ????} ????return 0; }
a.cc: In function 'int main()': a.cc:10:1: error: expected primary-expression before '?' token 10 | ????int n, m; | ^ a.cc:10:2: error: expected primary-expression before '?' token 10 | ????int n, m; | ^ a.cc:10:3: error: expected primary-expression before '?' token 10 | ????int n, m; | ^ a.cc:10:4: error: expected primary-expression before '?' token 10 | ????int n, m; | ^ a.cc:10:5: error: expected primary-expression before 'int' 10 | ????int n, m; | ^~~ a.cc:10:5: error: expected ':' before 'int' 10 | ????int n, m; | ^~~ | : a.cc:10:5: error: expected primary-expression before 'int' 10 | ????int n, m; | ^~~ a.cc:10:5: error: expected ':' before 'int' 10 | ????int n, m; | ^~~ | : a.cc:10:5: error: expected primary-expression before 'int' 10 | ????int n, m; | ^~~ a.cc:10:5: error: expected ':' before 'int' 10 | ????int n, m; | ^~~ | : a.cc:10:5: error: expected primary-expression before 'int' 10 | ????int n, m; | ^~~ a.cc:10:5: error: expected ':' before 'int' 10 | ????int n, m; | ^~~ | : a.cc:10:5: error: expected primary-expression before 'int' 10 | ????int n, m; | ^~~ a.cc:11:1: error: expected primary-expression before '?' token 11 | ????int dp[2000]; | ^ a.cc:11:2: error: expected primary-expression before '?' token 11 | ????int dp[2000]; | ^ a.cc:11:3: error: expected primary-expression before '?' token 11 | ????int dp[2000]; | ^ a.cc:11:4: error: expected primary-expression before '?' token 11 | ????int dp[2000]; | ^ a.cc:11:5: error: expected primary-expression before 'int' 11 | ????int dp[2000]; | ^~~ a.cc:11:5: error: expected ':' before 'int' 11 | ????int dp[2000]; | ^~~ | : a.cc:11:5: error: expected primary-expression before 'int' 11 | ????int dp[2000]; | ^~~ a.cc:11:5: error: expected ':' before 'int' 11 | ????int dp[2000]; | ^~~ | : a.cc:11:5: error: expected primary-expression before 'int' 11 | ????int dp[2000]; | ^~~ a.cc:11:5: error: expected ':' before 'int' 11 | ????int dp[2000]; | ^~~ | : a.cc:11:5: error: expected primary-expression before 'int' 11 | ????int dp[2000]; | ^~~ a.cc:11:5: error: expected ':' before 'int' 11 | ????int dp[2000]; | ^~~ | : a.cc:11:5: error: expected primary-expression before 'int' 11 | ????int dp[2000]; | ^~~ a.cc:12:1: error: expected primary-expression before '?' token 12 | ????P doll[2000]; | ^ a.cc:12:2: error: expected primary-expression before '?' token 12 | ????P doll[2000]; | ^ a.cc:12:3: error: expected primary-expression before '?' token 12 | ????P doll[2000]; | ^ a.cc:12:4: error: expected primary-expression before '?' token 12 | ????P doll[2000]; | ^ a.cc:12:7: error: expected primary-expression before 'doll' 12 | ????P doll[2000]; | ^~~~ a.cc:12:6: error: expected ':' before 'doll' 12 | ????P doll[2000]; | ^~~~~ | : a.cc:12:7: error: 'doll' was not declared in this scope 12 | ????P doll[2000]; | ^~~~ a.cc:12:17: error: expected ':' before ';' token 12 | ????P doll[2000]; | ^ | : a.cc:12:17: error: expected primary-expression before ';' token a.cc:12:17: error: expected ':' before ';' token 12 | ????P doll[2000]; | ^ | : a.cc:12:17: error: expected primary-expression before ';' token a.cc:12:17: error: expected ':' before ';' token 12 | ????P doll[2000]; | ^ | : a.cc:12:17: error: expected primary-expression before ';' token a.cc:13:1: error: expected primary-expression before '?' token 13 | ????while(cin >> n && n){ | ^ a.cc:13:2: error: expected primary-expression before '?' token 13 | ????while(cin >> n && n){ | ^ a.cc:13:3: error: expected primary-expression before '?' token 13 | ????while(cin >> n && n){ | ^ a.cc:13:4: error: expected primary-expression before '?' token 13 | ????while(cin >> n && n){ | ^ a.cc:13:5: error: expected primary-expression before 'while' 13 | ????while(cin >> n && n){ | ^~~~~ a.cc:13:5: error: expected ':' before 'while' 13 | ????while(cin >> n && n){ | ^~~~~ | : a.cc:13:5: error: expected primary-expression before 'while' 13 | ????while(cin >> n && n){ | ^~~~~ a.cc:13:5: error: expected ':' before 'while' 13 | ????while(cin >> n && n){ | ^~~~~ | : a.cc:13:5: error: expected primary-expression before 'while' 13 | ????while(cin >> n && n){ | ^~~~~ a.cc:13:5: error: expected ':' before 'while' 13 | ????while(cin >> n && n){ | ^~~~~ | : a.cc:13:5: error: expected primary-expression before 'while' 13 | ????while(cin >> n && n){ | ^~~~~ a.cc:13:5: error: expected ':' before 'while' 13 | ????while(cin >> n && n){ | ^~~~~ | : a.cc:13:5: error: expected primary-expression before 'while' 13 | ????while(cin >> n && n){ | ^~~~~ a.cc:40:1: error: expected primary-expression before '?' token 40 | ????return 0; | ^ a.cc:40:2: error: expected primary-expression before '?' token 40 | ????return 0; | ^ a.cc:40:3: error: expected primary-expression before '?' token 40 | ????return 0; | ^ a.cc:40:4: error: expected primary-expression before '?' token 40 | ????return 0; | ^ a.cc:40:5: error: expected primary-expression before 'return' 40 | ????return 0; | ^~~~~~ a.cc:40:5: error: expected ':' before 'return' 40 | ????return 0; | ^~~~~~ | : a.cc:40:5: error: expected primary-expression before 'return' 40 | ????return 0; | ^~~~~~ a.cc:40:5: error: expected ':' before 'return' 40 | ????return 0; | ^~~~~~ | : a.cc:40:5: error: expected primary-expression before 'return' 40 | ????return 0; | ^~~~~~ a.cc:40:5: error: expected ':' before 'return' 40 | ????return 0; | ^~~~~~ | : a.cc:40:5: error: expected primary-expression before 'return' 40 | ????return 0; | ^~~~~~ a.cc:40:5: error: expected ':' before 'return' 40 | ????return 0; | ^~~~~~ | : a.cc:40:5: error: expected primary-expression before 'return' 40 | ????return 0; | ^~~~~~
s027135661
p00157
C++
\#include <iostream> #include <vector> #include <algorithm> #define F first #define S second using namespace std; typedef pair<int, int> P; const int INF = 1 << 30; int main(){ int n, m; int dp[2000]; P doll[2000]; while(cin >> n && n){ fill(doll, doll+2000, P(0, 0)); fill(dp, dp + 2000, INF); for (int i = 0; i < n; i++){ int a, b; cin >> a >> b; doll[i] = P(a, b); } cin >> m; for (int i = n; i < n + m; i++){ int a, b; cin >> a >> b; doll[i] = P(a, b); } sort(doll, doll + n + m); for (int i = 0; i < n + m; i++){ *lower_bound(dp, dp + 2000, doll[i].S) = doll[i].S; } int ans; for(int i=n+m-1; i>=0; --i){ if(dp[i] != INF){ ans = i + 1; break; } } cout << ans << endl; } return 0; }
a.cc:1:1: error: stray '\' in program 1 | \#include <iostream> | ^ a.cc:1:2: error: stray '#' in program 1 | \#include <iostream> | ^ a.cc:1:3: error: 'include' does not name a type 1 | \#include <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> |
s475767496
p00157
C++
#include<bits/stdc++.h> #define mk make_pair #define f first #define s second using namespace std; int n,m,p1,p2,dp[201][1001][1001]; unordered_map<pair<int,pair<int,int> >,int >m1; vector<pair<int,int> >v; int dfs(int d,int h,int w){ int res=0; if(m1[mk(d,mk(h,w))])return m1[mk(d,mk(h,w))]; if(d==v.size()) return 1; if(v[d].f<h&&v[d].s<w) res=max(res,dfs(d+1,v[d].f,v[d].s))+1; res=max(res,dfs(d+1,h,w)); return m1[mk(d,mk(h,w))]=res; } main(){ while(cin>>n,n){ m1.clear(); v.clear(); for(int i=0;i<n;i++){ cin>>p1>>p2; v.push_back(mk(p2,p1)); } cin>>m; for(int i=0;i<m;i++){ cin>>p1>>p2; v.push_back(mk(p2,p1)); } stable_sort(v.begin(),v.end(),greater<pair<int,int> >()); for(int i=0;i<v.size();i++)swap(v[i].f,v[i].s); stable_sort(v.begin(),v.end(),greater<pair<int,int> >()); cout<<dfs(0,1001,1001)-1<<endl; } }
a.cc:7:45: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, std::pair<int, int> >; _Tp = int; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _Pred = std::equal_to<std::pair<int, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<const std::pair<int, std::pair<int, int> >, int> >]' 7 | unordered_map<pair<int,pair<int,int> >,int >m1; | ^~ In file included from /usr/include/c++/14/unordered_map:41, from /usr/include/c++/14/functional:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/unordered_map.h:148:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, std::pair<int, int> >; _Tp = int; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _Pred = std::equal_to<std::pair<int, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<const std::pair<int, std::pair<int, int> >, int> >]' is implicitly deleted because the default definition would be ill-formed: 148 | unordered_map() = default; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/unordered_map.h:148:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _Alloc = std::allocator<std::pair<const std::pair<int, std::pair<int, int> >, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, std::pair<int, int> > >; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/14/bits/unordered_map.h:33: /usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _Alloc = std::allocator<std::pair<const std::pair<int, std::pair<int, int> >, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, std::pair<int, int> > >; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 539 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, std::pair<int, int> > >; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/14/bits/hashtable.h:35: /usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, std::pair<int, int> > >; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 1731 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' /usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, std::pair<int, int> > >]': /usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here 1328 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::pair<int, std::pair<int, int> > >::hash()' 1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { } | ^~~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, std::pair<int, int> > >::hash()' is implicitly deleted because the default definition would be ill-formed: 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, std::pair<int, int> >, false>::__hash_enum()' /usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, std::pair<int, int> >; bool <anonymous> = false]' 83 | __hash_enum(__hash_enum&&); | ^~~~~~~~~~~ /usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, std::pair<int, int> >; bool <anonymous> = false]' is private within this context 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here 84 | ~__hash_enum(); | ^ /usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates 1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { } | ^~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed: 1328 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, std::pair<int, int> > >, true>::~_Hashtable_ebo_helper()' /usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, std::pair<int, int> > >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed: 1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<std::pair<int, std::pair<int, int> > >::~hash()' /usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, std::pair<int, int> > >::~hash()' is implicitly deleted because the default definition would be ill-formed: 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, std::pair<int, int> >; bool <anonymous> = false]' is private within this context /usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here 84 | ~__hash_enum(); | ^ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates 1731 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, std::pair<int, int> >, std::pair<const std::pair<int, std::pair<int, int> >, int>, std::__detail::_Select1st, std::hash<std::pair<int, std::pair<int, int> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' /usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<std::pair<int, std::pair<int, int> >, std::pair<const std::pair<int, std::pair<int, int>
s981502343
p00157
C++
#include<bits/stdc++.h> #define mk make_pair #define f first #define s second using namespace std; int n,m,p1,p2,dp[201][1001][1001]; unordered_map<pair<int,pair<int,int> >,int >m1; vector<pair<int,int> >v; int dfs(int d,int h,int w){ int res=0; if(m1[mk(d,mk(h,w))])return m1[mk(d,mk(h,w))]; if(d==v.size()) return 0; if(v[d].f<h&&v[d].s<w) res=max(res,dfs(d+1,v[d].f,v[d].s))+1; res=max(res,dfs(d+1,h,w)); return m1[mk(d,mk(h,w))]=res; } main(){ while(cin>>n,n){ m1.clear(); v.clear(); for(int i=0;i<n;i++){ cin>>p1>>p2; v.push_back(mk(p2,p1)); } cin>>m; for(int i=0;i<m;i++){ cin>>p1>>p2; v.push_back(mk(p2,p1)); } stable_sort(v.begin(),v.end(),greater<pair<int,int> >()); for(int i=0;i<v.size();i++)swap(v[i].f,v[i].s); stable_sort(v.begin(),v.end(),greater<pair<int,int> >()); cout<<dfs(0,1001,1001)<<endl; } }
a.cc:7:45: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, std::pair<int, int> >; _Tp = int; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _Pred = std::equal_to<std::pair<int, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<const std::pair<int, std::pair<int, int> >, int> >]' 7 | unordered_map<pair<int,pair<int,int> >,int >m1; | ^~ In file included from /usr/include/c++/14/unordered_map:41, from /usr/include/c++/14/functional:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/unordered_map.h:148:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, std::pair<int, int> >; _Tp = int; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _Pred = std::equal_to<std::pair<int, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<const std::pair<int, std::pair<int, int> >, int> >]' is implicitly deleted because the default definition would be ill-formed: 148 | unordered_map() = default; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/unordered_map.h:148:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _Alloc = std::allocator<std::pair<const std::pair<int, std::pair<int, int> >, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, std::pair<int, int> > >; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/14/bits/unordered_map.h:33: /usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _Alloc = std::allocator<std::pair<const std::pair<int, std::pair<int, int> >, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, std::pair<int, int> > >; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 539 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, std::pair<int, int> > >; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/14/bits/hashtable.h:35: /usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, std::pair<int, int> > >; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 1731 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' /usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, std::pair<int, int> > >]': /usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here 1328 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::pair<int, std::pair<int, int> > >::hash()' 1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { } | ^~~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, std::pair<int, int> > >::hash()' is implicitly deleted because the default definition would be ill-formed: 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, std::pair<int, int> >, false>::__hash_enum()' /usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, std::pair<int, int> >; bool <anonymous> = false]' 83 | __hash_enum(__hash_enum&&); | ^~~~~~~~~~~ /usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, std::pair<int, int> >; bool <anonymous> = false]' is private within this context 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here 84 | ~__hash_enum(); | ^ /usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates 1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { } | ^~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, std::pair<int, int> >; _Value = std::pair<const std::pair<int, std::pair<int, int> >, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, std::pair<int, int> > >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed: 1328 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, std::pair<int, int> > >, true>::~_Hashtable_ebo_helper()' /usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, std::pair<int, int> > >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed: 1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<std::pair<int, std::pair<int, int> > >::~hash()' /usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, std::pair<int, int> > >::~hash()' is implicitly deleted because the default definition would be ill-formed: 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, std::pair<int, int> >; bool <anonymous> = false]' is private within this context /usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here 84 | ~__hash_enum(); | ^ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates 1731 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, std::pair<int, int> >, std::pair<const std::pair<int, std::pair<int, int> >, int>, std::__detail::_Select1st, std::hash<std::pair<int, std::pair<int, int> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' /usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<std::pair<int, std::pair<int, int> >, std::pair<const std::pair<int, std::pair<int, int>
s452138497
p00157
C++
#include <iostream> #include <queue> using namespace std; typedef struct DOLL { int h, r; bool operator > (const DOLL& d) const { return (h > d.h && r > d.r); } bool operator < (const DOLL& d) const { return (h < d.h && r < d.r); } } D; typedef struct Node { D d; int num; }; const int MAX = 100; int n, m; D A[MAX]; D B[MAX]; int AN[MAX]; int BN[MAX]; void solve() { queue<Node> q; memset(AN, 0, sizeof(int)*n); memset(BN, 0, sizeof(int)*m); int max =0; Node n1 = {A[0], 1}; Node n2 = {B[0], 1}; q.push(n1); q.push(n2); while(!q.empty()) { Node current = q.front(); q.pop(); if(max < current.num) { max = current.num; } for(int i=0; i<n; i++) { if(current.d < A[i]) { if(AN[i] >= current.num+1) continue; Node new_node = {A[i], current.num+1}; q.push(new_node); AN[i] = current.num+1; break; } } for(int i=0; i<m; i++) { if(current.d < B[i]) { if(BN[i] >= current.num +1) continue; Node new_node = {B[i], current.num+1}; q.push(new_node); BN[i] = current.num+1; break; } } } cout << max << endl; } int main(int argc, char** argv) { int h, r; while(cin >> n, n) { for(int i=0; i<n; i++) { cin >> A[i].h >> A[i].r; } cin >> m; for(int i=0; i<m; i++) { cin >> B[i].h >> B[i].r; } solve(); } }
a.cc:21:1: warning: 'typedef' was ignored in this declaration 21 | typedef struct Node | ^~~~~~~ a.cc: In function 'void solve()': a.cc:39:9: error: 'memset' was not declared in this scope 39 | memset(AN, 0, sizeof(int)*n); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <queue> +++ |+#include <cstring> 3 |
s930216227
p00157
C++
#include <iostream> #include <vector> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) int dp[200] = {0}; int h[200] , r[200]; int n,m; int main(){ while(cin >> n , n){ rep(i,n)cin >> h[i] >> r[i]; cin >> m; rep(i,m)cin >> h[n+i] >> r[n+i]; int ans = 0; rep(i,200)dp[i] = 1; rep(i,200)rep(j,200){ if(h[j] < h[i] && r[j] < r[i]){ dp[i] = max(dp[j]+1,dp[i]) } } cout << *max_element(dp,dp+n+m) << endl; } }
a.cc: In function 'int main()': a.cc:18:59: error: expected ';' before '}' token 18 | dp[i] = max(dp[j]+1,dp[i]) | ^ | ; 19 | } | ~ a.cc:21:26: error: 'max_element' was not declared in this scope 21 | cout << *max_element(dp,dp+n+m) << endl; | ^~~~~~~~~~~
s873702386
p00157
C++
#include <iostream> #include <cstring> #include <vector> using namespace std; typedef pair<int, int> doll; int main() { int n, m, i, j; vector<doll> vc; int dp[200]; vc.reserve(200); while( cin >> n, n) { vc.clear(); memset( dp, 0, sizeof(dp)); for( i = 0; i < n; i++) { doll d; cin >> d.first >> d.second; vc.push_back(d); } cin >> m; for( i = 0; i < m; i++) { doll d; cin >> d.first >> d.second; vc.push_back(d); } sort(vc.begin(), vc.end()); dp[0] = 1; doll surface(vc[0].first, vc[0].second); for( i = 1; i < n+m; i++) { if( surface.first < vc[i].first && surface.second < vc[i].second ) { dp[i] = dp[i-1] + 1; surface.first = vc[i].first; surface.second = vc[i].second; } else { dp[i] = dp[i-1]; } } cout << dp[n+m-1] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:38:17: error: 'sort' was not declared in this scope; did you mean 'short'? 38 | sort(vc.begin(), vc.end()); | ^~~~ | short
s368530199
p00157
C++
#include <iostream> #include <cstring> #include <vector> using namespace std; typedef pair<int, int> doll; int main() { int n, m, i, j; vector<doll> vc; int dp[200]; vc.reserve(200); while( cin >> n, n) { vc.clear(); memset( dp, 0, sizeof(dp)); for( i = 0; i < n; i++) { doll d; cin >> d.first >> d.second; vc.push_back(d); } cin >> m; for( i = 0; i < m; i++) { doll d; cin >> d.first >> d.second; vc.push_back(d); } std::sort(vc.begin(), vc.end()); dp[0] = 1; doll surface(vc[0].first, vc[0].second); for( i = 1; i < n+m; i++) { if( surface.first < vc[i].first && surface.second < vc[i].second ) { dp[i] = dp[i-1] + 1; surface.first = vc[i].first; surface.second = vc[i].second; } else { dp[i] = dp[i-1]; } } cout << dp[n+m-1] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:38:22: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 38 | std::sort(vc.begin(), vc.end()); | ^~~~ | qsort
s464231442
p00157
C++
#include<iostream> #include<cstdlib> #define rep(i,n) for(int i=0;i<n;i++) #define MAX 206 using namespace std; int test=0; int n,m; int dp[MAX+1]; class Doll{ public: int h; int r; bool operator < (const Doll &d)const{ if(h == d.h)return r < d.h;//hが同じ時rで比較 return h < d.h;//普段はhで比較 } }; Doll Dolls[MAX]; void solve(void){ dp[0] = 0; // rep(i,n+m){ for(int i=0;i<(n+m);i++){ dp[i+1] = 1; for(int j=0;j<i;j++) if(Dolls[j].r < Dolls[i].r){ dp[i+1] = max(dp[i+1]+1,dp[j]+1); } } cout << "test" << ++test << endl; rep(i,n+m) cout << dp[i] << endl; cout << "ans" << endl; cout << dp[n+m] << endl << endl; } int main(void){ int h,r; while(1){ cin >> n; if(n==0)break; rep(i,n){ cin >> h >> r; Dolls[i].h = h; Dolls[i].r = r; } cin >> m; for(int i=n;i<(n+m);i++){ cin >> h >> r; Dolls[i].h = h; Dolls[i].r = r; } sort(Dolls,Dolls+n+m); rep(i,n+m) cout << Dolls[i].h << " " << Dolls[i].r<<endl; solve(); } return 0; }
a.cc: In function 'int main()': a.cc:56:7: error: 'sort' was not declared in this scope; did you mean 'short'? 56 | sort(Dolls,Dolls+n+m); | ^~~~ | short
s676149779
p00157
C++
#include<iostream> #include<cstdlib> #define rep(i,n) for(int i=0;i<n;i++) #define MAX 206 using namespace std; int test=0; int n,m; int dp[MAX+1]; class Doll{ public: int h; int r; bool operator < (const Doll &d)const{ if(h == d.h)return r < d.h;//hが同じ時rで比較 return h < d.h;//普段はhで比較 } }; Doll Dolls[MAX]; void solve(void){ dp[0] = 0; // rep(i,n+m){ for(int i=0;i<(n+m);i++){ dp[i+1] = 1; for(int j=0;j<i;j++) if(Dolls[j].r < Dolls[i].r){ dp[i+1] = max(dp[i+1]+1,dp[j]+1); } } /* cout << "test" << ++test << endl; rep(i,n+m) cout << dp[i] << endl; cout << "ans" << endl; */ cout << dp[n+m] << endl; } int main(void){ int h,r; while(1){ cin >> n; if(n==0)break; rep(i,n){ cin >> h >> r; Dolls[i].h = h; Dolls[i].r = r; } cin >> m; for(int i=n;i<(n+m);i++){ cin >> h >> r; Dolls[i].h = h; Dolls[i].r = r; } sort(Dolls,Dolls+n+m); /* rep(i,n+m) cout << Dolls[i].h << " " << Dolls[i].r<<endl; */ solve(); } return 0; }
a.cc: In function 'int main()': a.cc:58:7: error: 'sort' was not declared in this scope; did you mean 'short'? 58 | sort(Dolls,Dolls+n+m); | ^~~~ | short
s199568520
p00157
C++
#include<iostream> #include<cstdlib> #define rep(i,n) for(int i=0;i<n;i++) #define MAX 206 using namespace std; int test=0; int n,m; int dp[MAX+1]; class Doll{ public: int h; int r; bool operator < (const Doll &d)const{ if(h == d.h)return r < d.h;//hが同じ時rで比較 return h < d.h;//普段はhで比較 } }; Doll Dolls[MAX]; void solve(void){ dp[0] = 0; //ini for(int i=0;i<=n;i++) dp[i] =0; for(int i=0;i<(n+m);i++){ dp[i+1] = 1; for(int j=0;j<i;j++) if(Dolls[j].r < Dolls[i].r){ dp[i+1] = max(dp[i+1]+1,dp[j]+1); } } cout << dp[n+m] << endl; } int main(void){ int h,r; while(1){ cin >> n; if(n==0)break; rep(i,n){ cin >> h >> r; Dolls[i].h = h; Dolls[i].r = r; } cin >> m; for(int i=n;i<(n+m);i++){ cin >> h >> r; Dolls[i].h = h; Dolls[i].r = r; } sort(Dolls,Dolls+n+m); /* rep(i,n+m) cout << Dolls[i].h << " " << Dolls[i].r<<endl; */ solve(); } return 0; }
a.cc: In function 'int main()': a.cc:55:7: error: 'sort' was not declared in this scope; did you mean 'short'? 55 | sort(Dolls,Dolls+n+m); | ^~~~ | short
s893767622
p00157
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; class Container { public: void append( pair< int, int > p ) { masterList.push_back( p ); } void cSort() { sort( masterList.begin(), masterList.end() ); sortedList.clear(); vector< pair< int, int > >::iterator itr = masterList.begin(); while( itr != masterList.end() ){ vector< pair< int, int > > v; int x = itr->first; v.push_back( *itr ); ++itr; if( itr != masterList.end() && itr->first == x ){ v.push_back( *itr ); ++itr; } sortedList.push_back( v ); } } int countContainment() { int result = 0; int dp[ 201 ][ 1000 ]; memset( dp, 0, sizeof(dp) ); for( int i = 0; i < (int)sortedList.size(); ++i ){ int r = sortedList[ i ][ 0 ].second; for( int j = 0; j < r; ++j ){ dp[ i + 1 ][ j ] = dp[ i ][ j ]; } for( int j = r; j < 1000; ++j ){ dp[ i + 1 ][ j ] = max( dp[ i ][ j ], dp[ i ][ r - 1 ] + 1 ); } } return dp[ sortedList.size() ][ 1000 - 1 ]; } void cSwap() { for( int i = 0; i < (int)masterList.size(); ++i ){ int t = masterList[ i ].first; masterList[ i ].first = masterList[ i ].second; masterList[ i ].second = t; } } vector< pair< int, int > > masterList; vector< vector< pair< int ,int > > > sortedList; }; int main() { int n, m; while( cin >> n && n ){ Container cont; for( int i = 0; i < n; ++i ){ pair< int, int > p; cin >> p.first >> p.second; cont.append( p ); } cin >> m; for( int i = 0; i < m; ++i ){ pair< int, int > p; cin >> p.first >> p.second; cont.append( p ); } int result = 0; cont.cSort(); result = cont.countContainment(); cont.cSwap(); cont.cSort(); cout << max( result, cont.countContainment() ) << endl; } return 0; }
a.cc: In member function 'int Container::countContainment()': a.cc:35:17: error: 'memset' was not declared in this scope 35 | memset( dp, 0, sizeof(dp) ); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | using namespace std;
s462991853
p00157
C++
#include <cstdio> #include <iostream> #include <vector> #include <stack> #include <queue> #include <string> #include <map> #define rep(i,n) for(int i=0; i<n; ++i) using namespace std; struct Doll{ int H,R,L; bool operator<(const Doll& right)const { return H<right.H; } Doll(){ H=0; R=0; L=0; } }; int N, M; int main(){ while(cin >> N && N){ vector<Doll> D; D.resize(200); rep(i,N){ cin >> D[i+1].H >> D[i+1].R; } cin >> M; rep(i,M){ cin >> D[N+i+1].H >> D[N+i+1].R; } sort(D.begin()+1, D.begin()+(N+M)+1); int ans = 0; for(int i=1; i<N+M+1; ++i){ int m = 0; rep(j,i){ if(D[j].R<D[i].R && D[j].H<D[i].H && m<D[j].L){ m = D[j].L; } } D[i].L = m+1; ans = max(ans,D[i].L); } cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:32:7: error: 'sort' was not declared in this scope; did you mean 'short'? 32 | sort(D.begin()+1, D.begin()+(N+M)+1); | ^~~~ | short
s206858106
p00157
C++
#include<iostream> #include<vector> using namespace std; int main() { int n; for(;cin>>n,n;) { vector<pair<int,int> >data; for(int i=0;i<n;i++) { int h,r; cin>>h>>r; data.push_back(make_pair(h,r)); } int m; cin>>m; for(int i=0;i<m;i++) { int h,r; cin>>h>>r; data.push_back(make_pair(h,r)); } sort(data.begin(),data.end()); /* for(int i=0;i<data.size();i++) cout<<"<"<<data[i].first<<","<<data[i].second<<"> "; cout<<endl; */ int ans=1; for(int j=data.size()-1;j>=0;j--) { int tmp=1; pair<int,int >last=data[j]; for(int i=j-1;i>=0;i--) { // cout<<"<"<<last.first<<","<<last.second<<"> "<<endl; if(last.first>data[i].first && last.second>data[i].second ) { tmp++; last=data[i]; } } if(tmp>ans) ans=tmp; } cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:24:7: error: 'sort' was not declared in this scope; did you mean 'short'? 24 | sort(data.begin(),data.end()); | ^~~~ | short
s742129943
p00158
C
#include<stdio.h> int main(){ int n,c; while(1){ scanf("%d",&n); if(n==0)break; for(c=0;n!=1;c++){ if(n%2==0){ n/=2; } else{ n=n*3+1; } } printf("%d\n",c); } return 0;
main.c: In function 'main': main.c:17:3: error: expected declaration or statement at end of input 17 | return 0; | ^~~~~~
s218381400
p00158
C
#include <cstdio> int main(void) { int n; int count; while (scanf("%d", &n), n){ count = 0; while (n != 1){ if (n % 2 == 0){ n /= 2; } else { n = n * 3 + 1; } count++; } printf("%d\n", count); } return (0); }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s275848302
p00158
C
#include <stdio.h> int main(void) { int n, c; while (1) { scanf_s("%d", &n); if (n == 0) break; c = 0; while (1) { if (n == 1) break; else if (n % 2 == 0) { n /= 2; c++; } else { n *= 3; n += 1; c++; } } printf("%d\n", c); } return 0; }
main.c: In function 'main': main.c:7:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 7 | scanf_s("%d", &n); | ^~~~~~~ | scanf
s006900920
p00158
C
c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)}
main.c:1:1: warning: data definition has no type or storage class 1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:1:3: error: return type defaults to 'int' [-Wimplicit-int] 1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)} | ^~~~ main.c: In function 'main': main.c:1:3: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:41: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)} | ^~~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf' +++ |+#include <stdio.h> 1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)} main.c:1:41: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)} | ^~~~~~ main.c:1:41: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:58: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)} | ^~~~~ main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:58: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:80: error: expected expression before '}' token 1 | c;main(n){for(;n>1?n=n%2?n*3+1:n/2,++c:!printf("%d\n",c)+scanf("%d",&n,c=0)*n;)} | ^
s830322075
p00158
C++
#include <iostream> #include <algorithm> using namespace std; int main(void){ while (true){ int n; cin >> n; if (!n){ break; } cout << count(n) << endl; } return 0; } int count(int n){ int ct = 0; while (n != 1){ if (n % 2 == 0){ n = n / 2; } else { n = n * 3 + 1; } ct++; } return ct; }
a.cc: In function 'int main()': a.cc:11:30: error: no matching function for call to 'count(int&)' 11 | cout << count(n) << endl; | ~~~~~^~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:4025:5: note: candidate: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ /usr/include/c++/14/bits/stl_algo.h:4025:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidate expects 4 arguments, 1 provided
s502313285
p00158
C++
while num = gets.to_i count = 0 if num == 0 break end while num != 1 if (num % 2) == 0 num = num / 2 count = count + 1 else num = (num * 3) + 1 count = count + 1 end end puts count end
a.cc:1:1: error: expected unqualified-id before 'while' 1 | while num = gets.to_i | ^~~~~
s367845437
p00158
C++
nclude<stdio.h> int main(void) { int n,a; scanf("%d",&n); while(n!=0){ a=0; while(n>1){ if(n%2==0) n=n/2; else n=n*3+1; a++; } printf("%d\n",a); scanf("%d",&n); } return 0; }
a.cc:1:1: error: 'nclude' does not name a type 1 | nclude<stdio.h> | ^~~~~~
s294854189
p00158
C++
main(n,i){for(;scanf("%d",&n),n;printf("%d\n",i))for(i=0;n-1;i++)n=n%2?3*n+1:n/2;exit(0);}
a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token 1 | main(n,i){for(;scanf("%d",&n),n;printf("%d\n",i))for(i=0;n-1;i++)n=n%2?3*n+1:n/2;exit(0);} | ^
s451190423
p00159
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true){ int n = sc.nextInt(); if(n==0)break; int a = sc.nextInt(); double h = sc.nextDouble()/100; double w = sc.nextDouble(); double b = Math.abs(22-w/(h*h)); for(int i=1;i<n;i++){ int x = sc.nextInt(); h = sc.nextDouble()/100; w = sc.nextDouble(); double a = Math.abs(22-w/(h*h)); if(a<b){ b = a; a = x; } else if(a==b&&x<a)a = x; } System.out.println(a); } } }
Main.java:18: error: variable a is already defined in method main(String[]) double a = Math.abs(22-w/(h*h)); ^ 1 error
s692726320
p00159
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true){ int n = sc.nextInt(); if(n==0)break; int a = sc.nextInt(); double h = sc.nextDouble()/100; double w = sc.nextDouble(); double b = Math.abs(22-w/(h*h)); for(int i=1;i<n;i++){ int x = sc.nextInt(); h = sc.nextDouble()/100; w = sc.nextDouble(); double a = Math.abs(22-w(h*h)); if(a<b){ b = a; a = x; } else if(a==b&&x<a)a = x; } System.out.println(a); } } }
Main.java:18: error: variable a is already defined in method main(String[]) double a = Math.abs(22-w(h*h)); ^ Main.java:18: error: cannot find symbol double a = Math.abs(22-w(h*h)); ^ symbol: method w(double) location: class Main 2 errors
s828930121
p00159
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true){ int n = sc.nextInt(); if(n==0)break; int a = sc.nextInt(); double h = sc.nextDouble()/100; double w = sc.nextDouble(); double b = Math.abs(22-(w/(h*h))); for(int i=1;i<n;i++){ int x = sc.nextInt(); h = sc.nextDouble()/100; w = sc.nextDouble(); double a = Math.abs(22-(w/(h*h))); if(a<b){ b = a; a = x; } else if(a==b&&x<a)a = x; } System.out.println(a); } } }
Main.java:18: error: variable a is already defined in method main(String[]) double a = Math.abs(22-(w/(h*h))); ^ 1 error
s665291771
p00159
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true){ int n = sc.nextInt(); if(n==0)break; int a = sc.nextInt(); double h = sc.nextDouble()/100; double w = sc.nextDouble(); double b = Math.abs(22-(w/(h*h))); for(int i=1;i<n;i++){ int x = sc.nextInt(); h = sc.nextDouble()/100; w = sc.nextDouble(); double a = Math.abs(22-(w/(h*h))); if(a<b){ b = a; a = x; } else if(a==b&&x<a)a = x; } System.out.println(a); } } }
Main.java:18: error: variable a is already defined in method main(String[]) double a = Math.abs(22-(w/(h*h))); ^ 1 error
s925820868
p00159
Java
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan=new Scanner(System.in); while(true) { int n=scan.nextInt(); if(n==0)break; int num[]=new int[n]; double bmi; int ans=0,x=0,near=100; for(int i=0;i<n;i++) { num[i]=scan.next(); int h,w; h=scan.nextInt(); w=scan.nextInt(); bmi=(double)w/(h*h)*10000; int bmi_int=(int)bmi; if(bmi_int>=22)x=bmi_int-22; else x=22-bmi_int; if(near>x) { near=x; ans=i; } } System.out.println(num[ans]); } } }
Main.java:17: error: incompatible types: String cannot be converted to int num[i]=scan.next(); ^ 1 error
s568958141
p00159
Java
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan=new Scanner(System.in); while(true) { int n=scan.nextInt(); if(n==0)break; int ans=0,x=0,near=0,j=0; for(int i=0;i<n;i++) { int num=scan.nextInt(); int w; double h; h=scan.nextDouble()/100; w=scan.nextInt(); int bmi=(int)((double)w/(h*h)); if(i==0)ans=num; if(bmi>=22)x=bmi-22; else x=22-bmi; near=Double.MAX_VALUE; if(near>x) { near=x; ans=num; } } System.out.println(ans); } } }
Main.java:27: error: incompatible types: possible lossy conversion from double to int near=Double.MAX_VALUE; ^ 1 error
s016796072
p00159
C
#include<cmath> #include<cstdio> #include<algorithm> using namespace std; int main(){ for(int n;scanf("%d",&n),n;){ double bmi,best=1e9; int ibest=1000000000; for(int j=0;j<n;j++){ int i,h,w; scanf("%d%d%d",&i,&h,&w); bmi=w/((h/100.0)*(h/100.0)); if(abs(22-bmi)+1e-9<abs(22-best)) best=bmi,ibest=i; else if(abs(abs(22-bmi)-abs(22-best))<1e-9) ibest=min(ibest,i); } printf("%d\n",ibest); } return 0; }
main.c:1:9: fatal error: cmath: No such file or directory 1 | #include<cmath> | ^~~~~~~ compilation terminated.
s139653031
p00159
C
#include <stdio.h> #include <math.h> int main(void) { int datanum,datamax; int maxnumber; double maxbmi; double maxdiff; int number,height,weight; double heightm; double bmi; double diff; while(1) { scanf("%d",&datamax); maxnumber=0; maxbmi=0x7fffffff; maxdiff=0x7fffffff; for(datanum=0;datanum<datamax;datanum++) { scanf("%d %d %d",&number,&height,&weight); heightm=(double)height/100; bmi=(double)weight/heightm/heightm; diff=fabs(bmi-22); if(diff<maxdiff || (diff==maxdiff && number<maxnumber) { maxdiff=diff; maxbmi=bmi; maxnumber=number; } } printf("%d\n",maxnumber); } return 0; }
main.c: In function 'main': main.c:23:79: error: expected ')' before '{' token 23 | if(diff<maxdiff || (diff==maxdiff && number<maxnumber) { | ~ ^~ | ) main.c:28:17: error: expected expression before '}' token 28 | } | ^
s379132089
p00159
C++
#include<iostream> #include<string> #include<map> using namespace std; int main() { int n; while (cin >> n&&n!=0) { double a = -100; long float r=22, r1 = 10000; for (int i = 0; i < n; i++) { long float id, cm, kg; cin >> id >> cm >> kg; cm /= 100; long float bmi; bmi = (kg / (cm*cm)); long float r2 = r - bmi; if (r2 < 0) r2 = 0 - r2; if (r1 > r2) { r1 = r2; a = id; } else if (r1 == r2&&a<id) { a = id; } } cout << a << endl; } }
a.cc: In function 'int main()': a.cc:9:17: error: 'long' specified with 'float' 9 | long float r=22, r1 = 10000; | ^~~~ a.cc:9:17: error: 'long' specified with 'float' a.cc:11:25: error: 'long' specified with 'float' 11 | long float id, cm, kg; | ^~~~ a.cc:11:25: error: 'long' specified with 'float' a.cc:11:25: error: 'long' specified with 'float' a.cc:14:25: error: 'long' specified with 'float' 14 | long float bmi; | ^~~~ a.cc:16:25: error: 'long' specified with 'float' 16 | long float r2 = r - bmi; | ^~~~
s527208570
p00159
C++
#include<iostream> #include<string> using namespace std; int main() { int n; while (cin >> n&&n!=0) { double a = -100; long float r=22, r1 = 10000; for (int i = 0; i < n; i++) { long float id, cm, kg; cin >> id >> cm >> kg; cm /= 100; long float bmi; bmi = (kg / (cm*cm)); long float r2 = r - bmi; if (r2 < 0) r2 = 0 - r2; if (r1 > r2) { r1 = r2; a = id; } else if (r1 == r2&&a<id) { a = id; } } cout << a << endl; } }
a.cc: In function 'int main()': a.cc:8:17: error: 'long' specified with 'float' 8 | long float r=22, r1 = 10000; | ^~~~ a.cc:8:17: error: 'long' specified with 'float' a.cc:10:25: error: 'long' specified with 'float' 10 | long float id, cm, kg; | ^~~~ a.cc:10:25: error: 'long' specified with 'float' a.cc:10:25: error: 'long' specified with 'float' a.cc:13:25: error: 'long' specified with 'float' 13 | long float bmi; | ^~~~ a.cc:15:25: error: 'long' specified with 'float' 15 | long float r2 = r - bmi; | ^~~~
s559028171
p00159
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; int bmi(double h, double w){ return w/((h/100)*(h/100)); } int main(){ int n, p; double h, w; const double c = 22; while(true){ cin >> n; if(n == 0) return 0; int num; double diff; for(int i = 0; i < n; i++){ cin >> p >> h >> w; if(i == 0){ num = p; diff = abs(bmi(h,w) - c); }else{ double k = abs(bmi(h,w) - c); if(diff > k){ diff = k; num = p; }else if(diff == k){ if(num > p) num = p; } } } cout << num << endl; } } BMI = ??????(kg) / (??????(m))2
a.cc:40:11: warning: trigraph ??( ignored, use -trigraphs to enable [-Wtrigraphs] 40 | BMI = ??????(kg) / (??????(m))2 a.cc:40:25: warning: trigraph ??( ignored, use -trigraphs to enable [-Wtrigraphs] a.cc:40:1: error: 'BMI' does not name a type 40 | BMI = ??????(kg) / (??????(m))2 | ^~~
s020735975
p00159
C++
#include <iostream> #include <cmath> #include <utility> #include <vector> using namespace std; typedef pair<double,int> P; int main() { int n; vector<P> V; P temp; while(cin >> n) { V.clear(); if(n==0) break; int k; double h,w; for(int i=0;i<n;i++) { cin >> k >> h >> w; temp.first = abs(w / ((h/100)*(h/100)) - 22.0); temp.second = k; V.push_back(temp); } sort(V.begin(),V.end()); temp = V[0]; cout << temp.second << endl; } }
a.cc: In function 'int main()': a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 24 | sort(V.begin(),V.end()); | ^~~~ | sqrt
s677247549
p00159
C++
#include<iostream> #include<utility> #include<cstdlib> typedef std::pair<double, int> P; const int INF = 1 << 30; int n; int main() { while( std::cin >> n, n ) { P ans( INF, INF ); while( n-- ) { int i; double h, w; std::cin >> i >> h >> w; h /= 100.0; ans = std::min( ans, P( fabs( w / ( h * h ) - 22.0 ), i ) ); } std::cout << ans.second << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:23:49: error: 'fabs' was not declared in this scope; did you mean 'labs'? 23 | ans = std::min( ans, P( fabs( w / ( h * h ) - 22.0 ), i ) ); | ^~~~ | labs
s379001427
p00160
Java
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ int baggageNum = stdIn.nextInt(); if(baggageNum = 0)break; int cost = 0; for(int i=0;i < baggageNum;i++){ int w,size = 0; for(int i=0;i<3;i++)size += stdIn.nextInt(); w = stdIn.nextInt(); if(size <= 60 || w <= 2){ cost += 600; }else if(size <= 80 || w <= 5){ cost += 800; }else if(size <= 100 || w <= 10){ cost += 1000; }else if(size <= 120 || w <= 15){ cost += 1200; }else if(size <= 140 || w <= 20){ cost += 1400; }else if(size <= 160 || w <= 25){ cost += 1600; } } System.out.println(cost); } } } }
Main.java:33: error: class, interface, enum, or record expected } ^ 1 error
s522693868
p00160
Java
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ int baggageNum = stdIn.nextInt(); if(baggageNum = 0)break; int cost = 0; for(int i=0;i < baggageNum;i++){ int size = 0; for(int i=0;i<3;i++)size += stdIn.nextInt(); int w = stdIn.nextInt(); if(size <= 60 || w <= 2){ cost += 600; }else if(size <= 80 || w <= 5){ cost += 800; }else if(size <= 100 || w <= 10){ cost += 1000; }else if(size <= 120 || w <= 15){ cost += 1200; }else if(size <= 140 || w <= 20){ cost += 1400; }else if(size <= 160 || w <= 25){ cost += 1600; } } System.out.println(cost); } } }
Main.java:9: error: incompatible types: int cannot be converted to boolean if(baggageNum = 0)break; ^ Main.java:13: error: variable i is already defined in method main(String[]) for(int i=0;i<3;i++)size += stdIn.nextInt(); ^ 2 errors
s298793910
p00160
Java
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ int baggageNum = stdIn.nextInt(); if(baggageNum == 0)break; int cost = 0; for(int i=0;i < baggageNum;i++){ int size = 0; for(int i=0;i<3;i++)size += stdIn.nextInt(); int w = stdIn.nextInt(); if(size <= 60 || w <= 2){ cost += 600; }else if(size <= 80 || w <= 5){ cost += 800; }else if(size <= 100 || w <= 10){ cost += 1000; }else if(size <= 120 || w <= 15){ cost += 1200; }else if(size <= 140 || w <= 20){ cost += 1400; }else if(size <= 160 || w <= 25){ cost += 1600; } } System.out.println(cost); } } }
Main.java:13: error: variable i is already defined in method main(String[]) for(int i=0;i<3;i++)size += stdIn.nextInt(); ^ 1 error
s508834643
p00160
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Map.Entry; import java.util.StringTokenizer; import java.util.TreeMap; /** * Delivery Fee */ public class Main { static P0160 main = new P0160(); static TreeMap<Parcel, Integer> fee = new TreeMap<Parcel, Integer>() { { put(main.new Parcel(60, 2), 600); put(main.new Parcel(80, 5), 800); put(main.new Parcel(100, 10), 1000); put(main.new Parcel(120, 15), 1200); put(main.new Parcel(140, 20), 1400); put(main.new Parcel(160, 25), 1600); } }; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; while (!(line = br.readLine()).equals("0")) { int n, sum = 0; n = Integer.parseInt(line); for (int i = 0; i < n; ++i) { Parcel p = main.new Parcel(br.readLine()); Entry<Parcel, Integer> e; if ((e = fee.ceilingEntry(p)) != null) { sum += e.getValue(); } } System.out.println(sum); } } class Parcel implements Comparable<Parcel> { int size, weight; Parcel(int size, int weight) { this.size = size; this.weight = weight; } Parcel(int x, int y, int h, int w) { this(x + y + h, w); } Parcel(String info) { StringTokenizer st = new StringTokenizer(info); int x, y, h, w; x = Integer.parseInt(st.nextToken()); y = Integer.parseInt(st.nextToken()); h = Integer.parseInt(st.nextToken()); w = Integer.parseInt(st.nextToken()); size = x + y + h; weight = w; } @Override public int compareTo(Parcel o) { int r1 = this.weight - o.weight; int r2 = this.size - o.size; if (r1 > 0 || r2 > 0) { return 1; } else { return 0; } } } }
Main.java:13: error: cannot find symbol static P0160 main = new P0160(); ^ symbol: class P0160 location: class Main Main.java:13: error: cannot find symbol static P0160 main = new P0160(); ^ symbol: class P0160 location: class Main 2 errors
s006246914
p00160
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Map.Entry; import java.util.StringTokenizer; import java.util.TreeMap; /** * Delivery Fee */ public class Main { static P0160 main = new P0160(); static TreeMap<Parcel, Integer> fee = new TreeMap<Parcel, Integer>() { { put(main.new Parcel(60, 2), 600); put(main.new Parcel(80, 5), 800); put(main.new Parcel(100, 10), 1000); put(main.new Parcel(120, 15), 1200); put(main.new Parcel(140, 20), 1400); put(main.new Parcel(160, 25), 1600); } }; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; while (!(line = br.readLine()).equals("0")) { int n, sum = 0; n = Integer.parseInt(line); for (int i = 0; i < n; ++i) { Parcel p = main.new Parcel(br.readLine()); Entry<Parcel, Integer> e; if ((e = fee.ceilingEntry(p)) != null) { sum += e.getValue(); } } System.out.println(sum); } } class Parcel implements Comparable<Parcel> { int size, weight; Parcel(int size, int weight) { this.size = size; this.weight = weight; } Parcel(int x, int y, int h, int w) { this(x + y + h, w); } Parcel(String info) { StringTokenizer st = new StringTokenizer(info); int x, y, h, w; x = Integer.parseInt(st.nextToken()); y = Integer.parseInt(st.nextToken()); h = Integer.parseInt(st.nextToken()); w = Integer.parseInt(st.nextToken()); size = x + y + h; weight = w; } @Override public int compareTo(Parcel o) { int r1 = this.weight - o.weight; int r2 = this.size - o.size; if (r1 > 0 || r2 > 0) { return 1; } else if (r1 == 0 && r2 == 0) { return 0; } else { return -1; } } } }
Main.java:13: error: cannot find symbol static P0160 main = new P0160(); ^ symbol: class P0160 location: class Main Main.java:13: error: cannot find symbol static P0160 main = new P0160(); ^ symbol: class P0160 location: class Main 2 errors
s868966809
p00160
C
include <stdio.h> int main(void) { int n,x,y,h,w,i,size,sum; while(scanf("%d",&n),n){ sum=0; for(i=0;i<n;i++){ scanf("%d %d %d %d",&x,&y,&h,&w); size=x+y+h; if(size<=60&&w<=2)sum+=600; else if(size<=80&&w<=5)sum+=800; else if(size<=100&&w<=10)sum+=1000; else if(size<=120&&w<=15)sum+=1200; else if(size<=140&&w<=20)sum+=1400; else if(size<=160&&w<=25)sum+=1600; } printf("%d\n",sum); } return 0; }
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include <stdio.h> | ^
s783876588
p00160
C++
#include<stdio.h> int main(){ int n; while(1){ scanf("%d",&n);if(n==0)break; int x,y,h,w; int S=0; for(int i=0;i<n;i++) { scanf("%d %d %d %d",&x,&y,&h,&w); int s=x+y+h; int T1=0,T2=0; if(s<=60)T1=1; else if(s<=80)T1=2; else if(s<=100)T1=3; else if(s<=120)T1=4; else if(s<=140)T1=5; else if(s<=160)T1=6; else if(s>160)T1=10; if(w<=2)T2=1; else if(w<=5)T2=2; else if(w<=10)T2=3; else if(w<=15)T2=4; else if(w<=20)T2=5; else if(w<=25)T2=6; else if(w>25)T2=10; if(T1<T2)T1=T2; int p=0; switch(T1){ case:1 p=600;break; case:2 p=800;break; case:3 p=1000;break; case:4 p=1200;break; case:5 p=1400;break; case:6 p=1600;break; case:10 p=0;break; } S+=p; } printf("%d\n",S); } return 0; }
a.cc: In function 'int main()': a.cc:40:5: error: expected primary-expression before ':' token 40 | case:1 | ^ a.cc:40:7: error: expected ';' before 'p' 40 | case:1 | ^ | ; 41 | p=600;break; | ~ a.cc:43:5: error: expected primary-expression before ':' token 43 | case:2 | ^ a.cc:43:7: error: expected ';' before 'p' 43 | case:2 | ^ | ; 44 | p=800;break; | ~ a.cc:46:5: error: expected primary-expression before ':' token 46 | case:3 | ^ a.cc:46:7: error: expected ';' before 'p' 46 | case:3 | ^ | ; 47 | p=1000;break; | ~ a.cc:49:5: error: expected primary-expression before ':' token 49 | case:4 | ^ a.cc:49:7: error: expected ';' before 'p' 49 | case:4 | ^ | ; 50 | p=1200;break; | ~ a.cc:51:5: error: expected primary-expression before ':' token 51 | case:5 | ^ a.cc:51:7: error: expected ';' before 'p' 51 | case:5 | ^ | ; 52 | p=1400;break; | ~ a.cc:53:5: error: expected primary-expression before ':' token 53 | case:6 | ^ a.cc:53:7: error: expected ';' before 'p' 53 | case:6 | ^ | ; 54 | p=1600;break; | ~ a.cc:55:5: error: expected primary-expression before ':' token 55 | case:10 | ^ a.cc:55:8: error: expected ';' before 'p' 55 | case:10 | ^ | ; 56 | p=0;break; | ~
s135084409
p00160
C++
#include <bits/stdc++.h> #define r(i,a,n) for(i=a;i<n;i++) #define R(i,a,n) for(int i=a;i>=n;i--) using namespace std; int main(){ long int n,a,b,c,s,w; while(cin>>n,n){ long int p=0; r(i,0,n){ cin>>a>>b>>c>>w; s=a+b+c; if(s<=60&&w<=2)p+=600; else if(s<=80&&w<=5)p+=800; else if(s<=120&&w<=15)p+=1200; else if(s<=140&&w<=20)p+=1400; else if(s<=160&&w<=25)p+=1600; } cout<<p<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:19: error: 'i' was not declared in this scope 9 | r(i,0,n){ | ^ a.cc:2:22: note: in definition of macro 'r' 2 | #define r(i,a,n) for(i=a;i<n;i++) | ^
s731300563
p00160
C++
#include <bits/stdc++.h> #define r(i,a,n) for(i=a;i<n;++i) #define R(i,a,n) for(int i=a;i>=n;i--) using namespace std; int main(){ long int n,a,b,c,s,w; while(cin>>n,n){ long int p=0; r(i,0,n){ cin>>a>>b>>c>>w; s=a+b+c; if(s<=60&&w<=2)p+=600; else if(s<=80&&w<=5)p+=800; else if(s<=120&&w<=15)p+=1200; else if(s<=140&&w<=20)p+=1400; else if(s<=160&&w<=25)p+=1600; } cout<<p<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:19: error: 'i' was not declared in this scope 9 | r(i,0,n){ | ^ a.cc:2:22: note: in definition of macro 'r' 2 | #define r(i,a,n) for(i=a;i<n;++i) | ^
s843649882
p00160
C++
#include<iostream> #include<cstdio> using namespace std; int main(){ int i,j,k,l,m,n,x,y,h,w,sum; int ans; while(1){ ans=0; sum=0; cin >> n; if(n == 0)break; for(i=0;i<n;i++){ cin >> x >> y >> h >> w; sum = x + y + h; if(w<=2){ if(sum<=60)ans+=600; else if(sum<=80)ans+=800; else if(sum<=100)ans+=1000; else if(sum<=120)ans+=1200; else if(sum<=140)ans+=1400; else if(sum<=160)ans+=1600; else ans+=0; } else if(w<=5){ if(sum<=80)ans+=800; else if(sum<=100)ans+=1000; else if(sum<=120)ans+=1200; else if(sum<=140)ans+=1400; else if(sum<=160)ans+=1600; else ans+=0; } else if(w<=10){ if(sum<=100)ans+=1000; else if(sum<=120)ans+=1200; else if(sum<=140)ans+=1400; else if(sum<=160)ans+=1600; else ans+=0; } else if(w<=15){ if(sum<=120)ans+=1200; else if(sum<=140)ans+=1400; else if(sum<=160)ans+=1600; else ans+=0; } else if(w<=20){ if(sum<=140)ans+=1400; else if(sum<=160)ans+=1600; else ans+=0; } else if(w<=25){ if(sum<=160)ans+=1600; else ans+=0; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:74:4: error: expected '}' at end of input 74 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s179060678
p00160
C++
#include<stdio.h> int mian(void){ int x,y,z,w,n,i; int sum,l; while(scanf("%d",&n)!=0){ sum=0; for(i=0;i<n,i++){ scanf("%d %d %d %d",&x,&y,&z,&w); l=x+y+z; if(l<=60 && w<=2) sum+=600; else if(l<=80 && w<=5) sum+=800; else if(l<=100 && w<=10) sum+=1000; else if(l<=120 && w<=15) sum+=1200; else if(l<=140 && w<=20) sum+=1400; else if(l<=160 && w<=25) sum+=1600; } printf("%d\n",sum); } return 0; }
a.cc: In function 'int mian()': a.cc:9:32: error: expected ';' before ')' token 9 | for(i=0;i<n,i++){ | ^ | ;
s235618189
p00160
C++
#include<stdio.h> int mian(void){ int x,y,z,w,n,i; int sum,l; while(scanf("%d",&n)!=0){ sum=0; for(i=0;i<n;i++){ scanf("%d %d %d %d",&x,&y,&z,&w); l=x+y+z; if(l<=60 && w<=2) sum+=600; else if(l<=80 && w<=5) sum+=800; else if(l<=100 && w<=10) sum+=1000; else if(l<=120 && w<=15) sum+=1200; else if(l<=140 && w<=20) sum+=1400; else if(l<=160 && w<=25) sum+=1600; } printf("%d\n",sum); } return 0; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s943337636
p00161
Java
import java.util.*; public class SportMeet { static Scanner sc = new Scanner(System.in); static int team_number, minutes, seconds; static Map<Integer, Integer>map = new HashMap<Integer, Integer>(); public static void main(String[] args) { while(read()){ slove(); map.clear(); } } static boolean read(){ team_number = sc.nextInt(); if(team_number == 0)return false; for(int i = 0; i < team_number; i++){ int index = sc.nextInt(); int sum = 0; for(int j = 0; j < 4; j++){ minutes = sc.nextInt(); seconds = sc.nextInt(); sum += minutes*60 + seconds; } map.put(index, sum); } return true; } static void slove(){ int score = Integer.MAX_VALUE; int res = 0; for(int i = 1; i <= 1000000; i++){ if(map.containsKey(i)){ if(score > map.get(i)){ score = map.get(i); res = i; } } } System.out.println(res); map.remove(res); score = Integer.MAX_VALUE; res = 0; for(int i = 1; i <= 1000000; i++){ if(map.containsKey(i)){ if(score > map.get(i)){ score = map.get(i); res = i; } } } System.out.println(res); score = Integer.MIN_VALUE; res = 0; for(int i = 1; i <= 1000000; i++){ if(map.containsKey(i)){ if(score < map.get(i)){ score = map.get(i); res = i; } } } map.remove(res); score = Integer.MIN_VALUE; res = 0; for(int i = 1; i <= 1000000; i++){ if(map.containsKey(i)){ if(score < map.get(i)){ score = map.get(i); res = i; } } } System.out.println(res); } }
Main.java:2: error: class SportMeet is public, should be declared in a file named SportMeet.java public class SportMeet { ^ 1 error
s642773645
p00161
C
#include<stdio.h> int main (void) { int a,i,k,temp; int s[][9]={}; int sec[1000000]={}; int min[1000000]={}; int sumsec[1000000]={} int sumsec2[1000000]={}; scanf("%d",&a); do{ for(i=0,i<a;i++) for(k=0,k<9,k++) scanf("%d",s[i][k]); for(i=0,i<a;i++) sec[i]=s[i][2]+s[i][4]+s[i][6]+s[i][8]; min[i]=(s[i][1]+s[i][3]+s[i][5]+s[i][7])*60; sumsec[i]=sec[i]+min[i]; sumsec2[i]=sumsec[i]; } for(i=0;i<a-1;i++) for(k=0;k<a-1;k++) if(sumsec[k]>sumsec[k+1]){ temp=sumsec[k]; sumsec[k]=sumsec[k+1]; sumsec[k+1]=temp; int num[3]={}; int p=0; for(i=0;i<3;i++) for(j=0;j<a;j++){ if(sumsec2[j]==sumsec[i]){ num[p]=j; p++; }} for(i=0;i<3;i++) printf("%d\n",s[num[i]][0]); scanf("%d",&a); }while(a!=0); return 0; }
main.c: In function 'main': main.c:9:1: error: expected ',' or ';' before 'int' 9 | int sumsec2[1000000]={}; | ^~~ main.c:14:16: error: expected ';' before ')' token 14 | for(i=0,i<a;i++) | ^ | ; main.c:15:16: error: expected ';' before ')' token 15 | for(k=0,k<9,k++) | ^ | ; main.c:15:16: error: expected expression before ')' token main.c:18:16: error: expected ';' before ')' token 18 | for(i=0,i<a;i++) | ^ | ; main.c:22:1: error: 'sumsec2' undeclared (first use in this function); did you mean 'sumsec'? 22 | sumsec2[i]=sumsec[i]; | ^~~~~~~ | sumsec main.c:22:1: note: each undeclared identifier is reported only once for each function it appears in main.c:25:1: error: expected 'while' before 'for' 25 | for(i=0;i<a-1;i++) | ^~~ main.c:25:18: error: expected ';' before ')' token 25 | for(i=0;i<a-1;i++) | ^ | ; main.c:25:18: error: expected statement before ')' token main.c:35:5: error: 'j' undeclared (first use in this function) 35 | for(j=0;j<a;j++){ | ^
s380900829
p00161
C
#include<stdio.h> int main (void) { int a,i,k,j,temp; int s[][9]={}; int sec[1000000]={}; int min[1000000]={}; int sumsec[1000000]={}; int sumsec2[1000000]={}; scanf("%d",&a); do{ for(i=0;<a;i++) for(k=0;k<9;k++) scanf("%d",s[i][k]); for(i=0;i<a;i++) sec[i]=s[i][2]+s[i][4]+s[i][6]+s[i][8]; min[i]=(s[i][1]+s[i][3]+s[i][5]+s[i][7])*60; sumsec[i]=sec[i]+min[i]; sumsec2[i]=sumsec[i]; } for(i=0;i<a-1;i++) for(k=0;k<a-1;k++) if(sumsec[k]>sumsec[k+1]){ temp=sumsec[k]; sumsec[k]=sumsec[k+1]; sumsec[k+1]=temp; int num[3]={}; int p=0; for(i=0;i<3;i++) for(j=0;j<a;j++){ if(sumsec2[j]==sumsec[i]){ num[p]=j; p++; }} for(i=0;i<3;i++) printf("%d\n",s[num[i]][0]); scanf("%d",&a); }while(a!=0); return 0; }
main.c: In function 'main': main.c:14:9: error: expected expression before '<' token 14 | for(i=0;<a;i++) | ^ main.c:25:1: error: expected 'while' before 'for' 25 | for(i=0;i<a-1;i++) | ^~~ main.c:25:18: error: expected ';' before ')' token 25 | for(i=0;i<a-1;i++) | ^ | ; main.c:25:18: error: expected statement before ')' token
s127872205
p00161
C
#include<stdio.h> int main (void) { int a,i,k,j,temp; int s[][9]={}; int sec[1000000]={}; int min[1000000]={}; int sumsec[1000000]={}; int sumsec2[1000000]={}; scanf("%d",&a); do{ for(i=0;<a;i++) for(k=0;k<9;k++) scanf("%d",s[i][k]); for(i=0;i<a;i++){ sec[i]=s[i][2]+s[i][4]+s[i][6]+s[i][8]; min[i]=(s[i][1]+s[i][3]+s[i][5]+s[i][7])*60; sumsec[i]=sec[i]+min[i]; sumsec2[i]=sumsec[i]; } for(i=0;i<a-1;i++) for(k=0;k<a-1;k++) if(sumsec[k]>sumsec[k+1]){ temp=sumsec[k]; sumsec[k]=sumsec[k+1]; sumsec[k+1]=temp; } int num[3]={}; int p=0; for(i=0;i<3;i++) for(j=0;j<a;j++){ if(sumsec2[j]==sumsec[i]){ num[p]=j; p++; }} for(i=0;i<3;i++) printf("%d\n",s[num[i]][0]); scanf("%d",&a); }while(a!=0); return 0; }
main.c: In function 'main': main.c:14:9: error: expected expression before '<' token 14 | for(i=0;<a;i++) | ^
s997199783
p00161
C
#define _CRT_SECURE_NO_WARNINGS //#define _USE_MATH_DEFINES #include<stdio.h> #include<stdlib.h> //#include<math.h> #include<string.h> #include "Source.h" //#include<time.h> #define P(type,x) fprintf(stdout,"%"#type"\n",x) typedef struct { int num, t; }SPORT; void sort(int, SPORT[]); int main() { int n, m, s, i, j; SPORT d[100000]; for (; ~fscanf(stdin, "%d", &n), n;P(d, d[0].num),P(d, d[1].num),P(d, d[n - 2].num)) { for (i = 0; i < n; i++) { fscanf(stdin, "%d", &d[i].num); j = 3; fscanf(stdin, "%d%d", &m, &s); d[i].t = m * 60 + s; while(j--) fscanf(stdin, "%d%d", &m, &s),d[i].t += m * 60 + s; } sort(n, d); } return 0; } void sort(int n, SPORT d[]){ int i,j; SPORT tmp; for (i = 0; i < n - 1; i++) for (j = i + 1; j < n; j++) if (d[i].t > d[j].t) tmp = d[i], d[i] = d[j], d[j] = tmp; }
main.c:7:10: fatal error: Source.h: No such file or directory 7 | #include "Source.h" | ^~~~~~~~~~ compilation terminated.
s022692381
p00161
C
/* 現状さっぱりわからない。 */ #include <stdio.h> #include <math.h> struct TEAM { int c1; int m1; int s1; int m2; int s2; int m3; int s3; int m4; int s4; int time; }; typedef struct TEAM team; void sort00(team data[], int n); int minindex00(team data[], int from, int to); int main() { int n[100]; team data[100]; int output[300]; int i=0; int k=0; int sp=0; while(1){ scanf("%d",&n[i]); if(n[i]==0){ break; } for(k=0; k<n[i]; k++){ scanf("%d %d %d %d %d %d %d %d %d",&data[k].c1, &data[k].m1, &data[k].s1, &data[k].m2, &data[k].s2, &data[k].m3, &data[k].s3, &data[k].m4, &data[k].s4); data[k].time=((data[k].m1+data[k].m2+data[k].m3+data[k].m4)*60)+(data[k].s1+data[k].s2+data[k].s3+data[k].s4); } sort00(data, n[i]); output[sp]=data[0]; sp++; output[sp]=data[1]; sp++; output[sp]=data[n[i]-2]; sp++; i++; } for(i=0; i<sp; i++){ printf("%d\n", output[i]); } return 0; } void sort00(team data[],int n) { int i,minindex; team work; for(i=0;i<n;i++){ minindex=minindex00(data,i,n); work=data[i]; data[i]=data[minindex]; data[minindex]=work; } return; } int minindex00(team data[], int from, int to) { int i; int result=from; for(i=from;i<to;i++){ if(data[result].time>data[i].time){ result=i; } } return result; }
main.c: In function 'main': main.c:44:28: error: incompatible types when assigning to type 'int' from type 'team' {aka 'struct TEAM'} 44 | output[sp]=data[0]; | ^~~~ main.c:46:28: error: incompatible types when assigning to type 'int' from type 'team' {aka 'struct TEAM'} 46 | output[sp]=data[1]; | ^~~~ main.c:48:28: error: incompatible types when assigning to type 'int' from type 'team' {aka 'struct TEAM'} 48 | output[sp]=data[n[i]-2]; | ^~~~
s604430392
p00161
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main() { int n; while (cin >> n, n){ vector<pair<int, int> > vp; for (int i = 0; i < n; i++){ int id; cin >> id; int score = 0; for (int i = 0; i < 3; i++){ int m, s; cin >> m >> s; score += m * 60 + s; } vp.push_back(make_pair(score, id)); } sort(vp.begin(), vp.end()); printf("%d\n%d\n%d\n", vp[0].second, vp[1].second, v[n - 2].second); } return (0); }
a.cc: In function 'int main()': a.cc:25:68: error: 'v' was not declared in this scope; did you mean 'vp'? 25 | printf("%d\n%d\n%d\n", vp[0].second, vp[1].second, v[n - 2].second); | ^ | vp
s941319115
p00161
C++
#include<iostream> using namespace std; int main(){ int win[2]={},semiwin[2]={},dobe[2]={},semidobe[2]={},jointeams,team,i,j,total,firstteam[4]={},firsttotal[4]={}; cin >> jointeams; for(i=0;i<=3;i++){ cin >> firstteam[i]; for(j=1;j<=4;j++){ cin >> temp; firsttotal[i] += temp*60; cin >> temp; firsttotal[i] += temp; } } for(i=2;i!=0;i--){ for(j=0;j<=i;j++){ if(firsttotal[j] > firsttotal[j+1]){ temp = firsttotal[j]; firsttotal[j] = firsttotal[j+1]; firsttotal[j+1] = temp; temp = firstteam[j]; firstteam[j] = firstteam[j+1]; firstteam[j+1] = temp; } } } for(i=5;i<=jointeams;i++){ total = 0; cin >> team for(j=1;j<=4;j++){ cin >> temp; total = total + temp*60; cin >> temp; total = total + temp; } if(total>win[1]){ semiwin[0] = win[0]; semiwin[1] = win[1]; win[0] = team; win[1] = total; }else(total>semiwin[1]){ semiwin[0] = team; semiwin[1] = total; }else(total<dobe[1]){ semidobe[0] = dobe[0]; semidobe[1] = dobe[1]; dobe[0] = team; dobe[1] = total; }else(total<semidobe[1]){ semidobe[0] = team; semidobe[1] = total; } } cout << win[0] << endl; cout << semiwin[0] << endl; cout << dobe[0] << endl; }
a.cc: In function 'int main()': a.cc:21:32: error: 'temp' was not declared in this scope 21 | cin >> temp; | ^~~~ a.cc:31:33: error: 'temp' was not declared in this scope 31 | temp = firsttotal[j]; | ^~~~ a.cc:57:28: error: expected ';' before 'for' 57 | cin >> team | ^ | ; 58 | for(j=1;j<=4;j++){ | ~~~ a.cc:58:33: error: expected ';' before ')' token 58 | for(j=1;j<=4;j++){ | ^ | ; a.cc:70:40: error: expected ';' before '{' token 70 | }else(total>semiwin[1]){ | ^ | ; a.cc:74:18: error: 'else' without a previous 'if' 74 | }else(total<dobe[1]){ | ^~~~ a.cc:74:37: error: expected ';' before '{' token 74 | }else(total<dobe[1]){ | ^ | ; a.cc:80:18: error: 'else' without a previous 'if' 80 | }else(total<semidobe[1]){ | ^~~~ a.cc:80:41: error: expected ';' before '{' token 80 | }else(total<semidobe[1]){ | ^ | ;
s499968503
p00161
C++
#include<stdio.h> #include<iostream> using namespace std; struct SKE{int c1;int m1;int s1;int m2;int s2;int m3;int s3;int m4;int s4;int SUM;}; struct SKE NUM[1000001]; int main (){ int N; SKE Te,M1,M2,M3,M; while(1){ cin>>N;if(N==0)break; for(int i=0;i<N;i++){ cin>>NUM[i].c1>>NUM[i].m1>>NUM[i].s1>>NUM[i].m2>>NUM[i].s2>>NUM[i].m3>>NUM[i].s3>>NUM[i].m4>>NUM[i].s4; NUM[i].SUM=NUM[i].s1+NUM[i].s2+NUM[i].s3+NUM[i].s4+60*(NUM[i].m1+NUM[i].m2+NUM[i].m3+NUM[i].m4); } M1=NUM[0];M2=NUM[0];M=NUM[0];M3=NUM[0]; for(int i=1;i<N;i++){ if(NUM[i].SUM<M1.SUM){M2=M1;M1=NUM[i];} else if(NUM[i].SUM<M2.SUM){M2=NUM[i];} if(NUM[i].SUM>M.SUM){M3=M;M=NUM[i];} else if(NUM[i].SUM>M3.SUM){M3=NUM[i];} for(int i=0;i<N;i++){ } cout<<M1.c1<<endl<<M2.c1<<endl<<M3.c1<<endl; for(int i=0;i<N;i++) {NUM[i].c1=0;NUM[i].m1=0;NUM[i].s1=0;NUM[i].m2=0;NUM[i].s2=0;NUM[i].m3=0;NUM[i].s3=0;NUM[i].m4=0;NUM[i].s4=0;} } return 0; }
a.cc: In function 'int main()': a.cc:34:2: error: expected '}' at end of input 34 | } | ^ a.cc:8:12: note: to match this '{' 8 | int main (){ | ^
s550439841
p00161
C++
#include<iostream> #include<vector> #include<algorithm> #include<utility> using namespace std; int main(void) { int n, c1, m1, s1, m2, s2, m3, s3, m4, s4; vector<pair<int, int>>g; while((cin >> n) != 0){ for (int i = 0; i < n; ++i){ cin >> c1 >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4; g.push_back(make_pair(60 * (m1 + m2 + m3 + m4) + (s1 + s2 + s3 + s4), c1)); } sort(g.begin(), g.end()); cout << g[0].second << endl; cout << g[1].second << endl; auto itr = g.end(); itr -= 2; cout << itr -> second << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:26: error: no match for 'operator!=' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int') 12 | while((cin >> n) != 0){ | ~~~~~~~~~~ ^~ ~ | | | | | int | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:12:26: note: candidate: 'operator!=(int, int)' (built-in) 12 | while((cin >> n) != 0){ | ~~~~~~~~~~~^~~~ a.cc:12:26: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::fpos<_StateT>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/string:43, 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: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::allocator<_CharT>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h: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:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 651 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 658 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed: a.cc:12:29: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3847 | operator!=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed: a.cc:12:29: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2613 | operator!=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:
s813985672
p00161
C++
#include<iostream> #include<vector> #include<algorithm> #include<utility> using namespace std; int main(void) { int n, c1, m1, s1, m2, s2, m3, s3, m4, s4; vector<pair<int, int>>g; while((cin >> n) != 0){ for (int i = 0; i < n; ++i){ cin >> c1 >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4; g.push_back(make_pair(60 * (m1 + m2 + m3 + m4) + (s1 + s2 + s3 + s4), c1)); } sort(g.begin(), g.end()); cout << g[0].second << endl; cout << g[1].second << endl; cout << g[n - 2].second << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:26: error: no match for 'operator!=' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int') 12 | while((cin >> n) != 0){ | ~~~~~~~~~~ ^~ ~ | | | | | int | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:12:26: note: candidate: 'operator!=(int, int)' (built-in) 12 | while((cin >> n) != 0){ | ~~~~~~~~~~~^~~~ a.cc:12:26: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::fpos<_StateT>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/string:43, 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: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::allocator<_CharT>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h: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:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 651 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 658 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed: a.cc:12:29: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3847 | operator!=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed: a.cc:12:29: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 12 | while((cin >> n) != 0){ | ^ /usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2613 | operator!=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed: a.cc:12:29: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 12 | while((cin >> n) != 0){ | ^ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:
s018837949
p00161
C++
using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { for (string line; (line = Console.ReadLine()) != "0";) { var n = int.Parse(line); var teams = new Dictionary<int, int>(); for (var i = 0; i < n; i++) { var l = Console.ReadLine().Split(); var id = int.Parse(l[0]); var time = int.Parse(l[1]) * 60 + int.Parse(l[2]) + int.Parse(l[3]) * 60 + int.Parse(l[4]) + int.Parse(l[5]) * 60 + int.Parse(l[6]) + int.Parse(l[7]) * 60 + int.Parse(l[8]); teams.Add(id, time); } var sortedTeams = teams.OrderBy(kv => kv.Value).ToArray(); Console.WriteLine(sortedTeams[0]); Console.WriteLine(sortedTeams[1]); Console.WriteLine(sortedTeams[n - 2]); } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Collections.Generic; | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.Linq; | ^~~~~~ a.cc:28:2: error: expected ';' after class definition 28 | } | ^ | ; a.cc: In static member function 'static void Program::Main()': a.cc:7:14: error: 'string' was not declared in this scope 7 | for (string line; (line = Console.ReadLine()) != "0";) { | ^~~~~~ a.cc:7:28: error: 'line' was not declared in this scope 7 | for (string line; (line = Console.ReadLine()) != "0";) { | ^~~~ a.cc:7:35: error: 'Console' was not declared in this scope 7 | for (string line; (line = Console.ReadLine()) != "0";) { | ^~~~~~~ a.cc:8:13: error: 'var' was not declared in this scope 8 | var n = int.Parse(line); | ^~~ a.cc:9:17: error: expected ';' before 'teams' 9 | var teams = new Dictionary<int, int>(); | ^~~~~ a.cc:11:22: error: expected ';' before 'i' 11 | for (var i = 0; i < n; i++) { | ^ a.cc:11:29: error: 'i' was not declared in this scope 11 | for (var i = 0; i < n; i++) { | ^ a.cc:11:33: error: 'n' was not declared in this scope 11 | for (var i = 0; i < n; i++) { | ^ a.cc:12:21: error: expected ';' before 'l' 12 | var l = Console.ReadLine().Split(); | ^ a.cc:13:21: error: expected ';' before 'id' 13 | var id = int.Parse(l[0]); | ^~ a.cc:14:21: error: expected ';' before 'time' 14 | var time = int.Parse(l[1]) * 60 + int.Parse(l[2]) | ^~~~ a.cc:19:17: error: 'teams' was not declared in this scope 19 | teams.Add(id, time); | ^~~~~ a.cc:19:27: error: 'id' was not declared in this scope; did you mean 'void'? 19 | teams.Add(id, time); | ^~ | void a.cc:19:31: error: 'time' was not declared in this scope 19 | teams.Add(id, time); | ^~~~ a.cc:1:1: note: 'time' is defined in header '<ctime>'; this is probably fixable by adding '#include <ctime>' +++ |+#include <ctime> 1 | using System; a.cc:22:17: error: expected ';' before 'sortedTeams' 22 | var sortedTeams = teams.OrderBy(kv => kv.Value).ToArray(); | ^~~~~~~~~~~ a.cc:23:31: error: 'sortedTeams' was not declared in this scope 23 | Console.WriteLine(sortedTeams[0]); | ^~~~~~~~~~~ a.cc:25:43: error: 'n' was not declared in this scope 25 | Console.WriteLine(sortedTeams[n - 2]); | ^
s963781916
p00161
C++
#include <iostream> #include <map> #include <vector> using namespace std; typedef pair<int, int> pii; bool cmp(pii lhs, pii rhs) { return (lhs.second < rhs.second); } int main() { int n; while (cin >> n, n){ vector <pii> p(n); for (int i = 0; i < n; i++){ int num, t = 0; cin >> num; for (int j = 0; j < 4; j++){ int m, s; cin >> m >> s; t += m * 60 + s; } p[i] = make_pair(num, t); } sort(p.begin(), p.end(), cmp); cout << p[0].first << endl << p[1].first << endl << p[n - 2].first << endl; } return (0); }
a.cc: In function 'int main()': a.cc:31:17: error: 'sort' was not declared in this scope; did you mean 'short'? 31 | sort(p.begin(), p.end(), cmp); | ^~~~ | short
s139748135
p00161
C++
#include "bits/stdc++.h" using namespace std; #define rep(i,j) REP((i), 0, (j)) #define REP(i,j,k) for(int i=(j);(i)<(k);++i) #define BW(a,x,b) ((a)<=(x)&&(x)<=(b)) #define MP(a, b) make_pair(a, b) #define F first #define S second #define INF 1 << 30 typedef pair<int, int> pi; typedef pair<int, pi> pii; typedef vector<int> vi; typedef queue<int> qi; typedef long long ll; int n, m; vector<pi> s; int dp[1024]; int main() { int nn; while ((cin >> nn) && nn) { s.clear(); for (int i = 0; i < nn; ++i) { int a, b, c, d, e, f, g, h,iiii; cin >> a >> b >> c >> d >> e >> f >> g >> h>>iiii; s.push_back(make_pair(b*60+c+d*60+e+f*60+g+h*60+iiii,a)); } sort(s.begin(),s.end()); cout<<s[0].second<<endl; cout<<s[1].second<<endl; cout<<s[nn-2].second<<endl; } return 0;
a.cc: In function 'int main()': a.cc:35:18: error: expected '}' at end of input 35 | return 0; | ^ a.cc:21:12: note: to match this '{' 21 | int main() { | ^
s462846044
p00161
C++
M(int*a){return*a-*1[&a];}n,T[9999][2];j,m,s;main(i){for(;~scanf("%d",&n);qsort(T,n,8,M),n&&printf("%d\n%d\n%d\n",1[*T],T[1][1],T[n-2][1]))for(i=n;i--;)for(scanf("%d",T[i]+1),*T[i]=0,j=4;j--;*T[i]+=m*60+s)scanf("%d%d",&m,&s);}
a.cc:1:1: error: ISO C++ forbids declaration of 'M' with no type [-fpermissive] 1 | M(int*a){return*a-*1[&a];}n,T[9999][2];j,m,s;main(i){for(;~scanf("%d",&n);qsort(T,n,8,M),n&&printf("%d\n%d\n%d\n",1[*T],T[1][1],T[n-2][1]))for(i=n;i--;)for(scanf("%d",T[i]+1),*T[i]=0,j=4;j--;*T[i]+=m*60+s)scanf("%d%d",&m,&s);} | ^ a.cc:1:27: error: 'n' does not name a type 1 | M(int*a){return*a-*1[&a];}n,T[9999][2];j,m,s;main(i){for(;~scanf("%d",&n);qsort(T,n,8,M),n&&printf("%d\n%d\n%d\n",1[*T],T[1][1],T[n-2][1]))for(i=n;i--;)for(scanf("%d",T[i]+1),*T[i]=0,j=4;j--;*T[i]+=m*60+s)scanf("%d%d",&m,&s);} | ^ a.cc:1:40: error: 'j' does not name a type 1 | M(int*a){return*a-*1[&a];}n,T[9999][2];j,m,s;main(i){for(;~scanf("%d",&n);qsort(T,n,8,M),n&&printf("%d\n%d\n%d\n",1[*T],T[1][1],T[n-2][1]))for(i=n;i--;)for(scanf("%d",T[i]+1),*T[i]=0,j=4;j--;*T[i]+=m*60+s)scanf("%d%d",&m,&s);} | ^ a.cc:1:50: error: expected constructor, destructor, or type conversion before '(' token 1 | M(int*a){return*a-*1[&a];}n,T[9999][2];j,m,s;main(i){for(;~scanf("%d",&n);qsort(T,n,8,M),n&&printf("%d\n%d\n%d\n",1[*T],T[1][1],T[n-2][1]))for(i=n;i--;)for(scanf("%d",T[i]+1),*T[i]=0,j=4;j--;*T[i]+=m*60+s)scanf("%d%d",&m,&s);} | ^
s992896840
p00161
C++
#include <iostream> #include <cstring> #include <vector> using namespace std; typedef pair<int, int> P; int n; vector<P> ps; int main() { int c, m, s, sum; while(cin >> n && n) { ps.clear(); for(int k = 0; k < n; k++) { cin >> c; sum = 0; for(int i = 0; i < 4; i++) { cin >> m >> s; sum += m * 60 + s; } ps.push_back(P(sum, c)); } sort(ps.begin(), ps.end()); cout << ps[0].second << endl; cout << ps[1].second << endl; cout << ps[ps.size() - 2].second << endl; } }
a.cc: In function 'int main()': a.cc:25:9: error: 'sort' was not declared in this scope; did you mean 'short'? 25 | sort(ps.begin(), ps.end()); | ^~~~ | short
s843092182
p00161
C++
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main(){ int h,n,i,j,num[1000][1000],sum[1000],xmax=0; while(1){ xmax=0; cin >> n; for(i=0;i<n;i++){ for(j=0;j<9;j++){ cin >> num[i][j]; if(j>0 && j%2 == 0){ sum[i]+=num[i][j]; } else if(j>0 && j%2 != 0){ sum[i]+=(num[i][j]*60); } } } for(i=0;i<n;i++){ xmax=i; for(j=i;j<n;j++){ if(sum[xmax]<sum[j])xmax=j; } h=sum[xmax]; sum[xmax]=sum[i]; sum[i]=h; h=num[xmax][0]; num[xmax][0]=num[i][0]; num[i][0]=h; } /* for(i=0;i<n;i++){ cout << "num["<<i<<"][0]="<<num[i][0]; cout << " sum["<<i<<"]="<<sum[i]; cout << endl; } */ cout<< num[n-1][0] << endl; cout << num[n-2][0] << endl; cout<< num[1][0] << endl; }
a.cc: In function 'int main()': a.cc:59:4: error: expected '}' at end of input 59 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s046206679
p00161
C++
#include <iostream> #include <vector> using namespace std; typedef pair<int,int> P; vector<P> a; int main() { int n,m,s,c1,m1,s1,m2,s2,m3,s3,m4,s4; while(cin >> n) { a.clear(); if(n==0) break; for(int i=0;i<n;i++) { cin >> c1 >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4; m = m1+m2+m3+m4; s = s1+s2+s3+s4+m*60; P temp; temp.first = s; temp.second = c1; a.push_back(temp); } sort(a.begin(),a.end()); cout << a[0].second << endl; cout << a[1].second << endl; cout << a[n-2].second << endl; } }
a.cc: In function 'int main()': a.cc:22:5: error: 'sort' was not declared in this scope; did you mean 'short'? 22 | sort(a.begin(),a.end()); | ^~~~ | short
s226777208
p00161
C++
#include<iostream> #include<cstdio> #include<cmath> #include<vector> #include<string> #include<queue> #include<map> #include<stack> #include<cstdlib> #include<cstring> #include<algorithm> #include<sstream> #define reps(i,f,n) for(int i = f; i < int(n); i++) #define rep(i,n) reps(i,0,n) #define PII pair<int,int> #define PP pair< int,PII > #define Sort(t) sort(t.begin(), t.end()) using namespace std; typedef pair<int,int> PII; priority_queue<PII,vector< PII > , greater< PII > > pq; int main(void){ int n; while(scanf("%d", &n),n){ rep(i,n){ int id; cin >> id; int sum = 0, x; rep(j,8){ cin >> x; sum += j%2==0?x*60:x; } pq.push( pair<int,int>(sum,id)); } /* while(!pq.empty()){ printf("%d %d\n",pq.top().first, pq.top().second); pq.pop(); }*/ printf("%d\n", pq.top().second);pq.pop(); printf("%d\n", pq.top().second);pq.pop(); while(pq.size() > 2)pq.pop(); printf("%d\n", pq.top().second);pq.pop(); pq.pop(); } return 0; }
a.cc:21:26: error: invalid declarator before ';' token 21 | typedef pair<int,int> PII; | ^
s556044511
p00161
C++
include <iostream> #include <vector> #include <map> #include <algorithm> using namespace std; class sorting{ public: bool operator()(const pair<int,int>& left,const pair<int,int>& right)const{ return left.first < right.first; } }; int main(){ int n; while(cin >> n,n){ vector<pair<int,int> > dat; int m,s,id; for(int i=0;i<n;i++){ int total = 0; cin >> id; for(int j=0;j<4;j++){ cin >> m >> s; total += m*60 + s; } dat.push_back(make_pair(total,id)); } sort(dat.begin(),dat.end(),sorting()); cout << dat[0].second << endl << dat[1].second << endl << dat[n-2].second << endl; } }
a.cc:1:1: error: 'include' does not name a type 1 | include <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> |
s274883406
p00161
C++
#include <iostream> #include <vector> #include <utility> using namespace std; int main() { int a, time, number, m1, s1, m2, s2, m3, s3, m4, s4; vector<pair <int, int> > team; while(1) { cin >> a; if (a == 0) { break; } team.clear(); for(int i = 0; i < a; i++) { cin >> number; cin >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4; time = m1 *60 + s1 + m2 * 60 + s2 + m3 * 60 + s3 + m4 * 60 + s4; team. push_back(make_pair(time, number)); } sort(team.begin(), team.end()); cout << team[0].second << endl; cout << team[1].second << endl; cout << team[a - 2].second << endl; } return 0; }
a.cc: In function 'int main()': a.cc:29:17: error: 'sort' was not declared in this scope; did you mean 'short'? 29 | sort(team.begin(), team.end()); | ^~~~ | short
s480156147
p00161
C++
#include <iostream> #include <vector> #include <utility> using namespace std; int main() { int a, time, number, m1, s1, m2, s2, m3, s3, m4, s4; vector<pair <int, int> > team; while(1) { cin >> a; if (a == 0) { break; } team.clear(); for(int i = 0; i < a; i++) { cin >> number; cin >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4; time = m1 *60 + s1 + m2 * 60 + s2 + m3 * 60 + s3 + m4 * 60 + s4; team. push_back(make_pair(time, number)); } sort(team.begin(), team.end()); cout << team[0].second << endl; cout << team[1].second << endl; cout << team[a - 2].second << endl; } return 0; }
a.cc: In function 'int main()': a.cc:29:17: error: 'sort' was not declared in this scope; did you mean 'short'? 29 | sort(team.begin(), team.end()); | ^~~~ | short
s832374230
p00161
C++
#include <iostream> #include <vector> #include <utility> using namespace std; int main() { int a, time, number, m1, s1, m2, s2, m3, s3, m4, s4; vector<pair<int, int> > team; while(1) { cin >> a; if (a == 0) { break; } team.clear(); for(int i = 0; i < a; i++) { cin >> number; cin >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4; time = m1 *60 + s1 + m2 * 60 + s2 + m3 * 60 + s3 + m4 * 60 + s4; team.push_back(make_pair(time, number)); } sort(team.begin(), team.end()); cout << team[0].second << endl; cout << team[1].second << endl; cout << team[a - 2].second << endl; } return 0; }
a.cc: In function 'int main()': a.cc:29:17: error: 'sort' was not declared in this scope; did you mean 'short'? 29 | sort(team.begin(), team.end()); | ^~~~ | short
s395979636
p00161
C++
#include <iostream> #include <vector> #include <utility> #include <algorithm> #include <boost/bind.hpp> using namespace std; int main(){ int n; while(cin >> n, n){ typedef pair<int, int> value_type; vector<value_type> team; int c, m, s; for(int j=0; j < n; j++){ cin >> c; team.push_back(pair<int, int>(c, 0)); for(int i=0; i < 4; i++){ cin>> m >> s; team[j].second += 60*m + s; } } sort(team.begin(), team.end(), bind(&value_type::second, _1) < bind(&value_type::second, _2)); cout << team[0].first << endl; cout << team[1].first << endl; cout << team[team.size()-2].first; team.clear(); } }
a.cc:5:10: fatal error: boost/bind.hpp: No such file or directory 5 | #include <boost/bind.hpp> | ^~~~~~~~~~~~~~~~ compilation terminated.
s839637368
p00162
Java
#include<iostream> #include<math.h> #include<vector> #include<algorithm> #include<cstdio> #include <string> #include <complex> #include <functional> using namespace std; typedef pair<int,int> P; int h[1000001]; int main(){ h[1]=1; for(int i=2;i<=1000000;i*=2)h[i]=1; for(int i=1;i<=1000000;i++){ if(h[i]){ for(int j=i*3;j<=1000000;j*=3)if(h[j]==0)h[j]=2; } } for(int i=1;i<=1000000;i++){ if(h[i]){ for(int j=i*5;j<=1000000;j*=5)if(h[j]==0)h[j]=3; } } int a,b; while(scanf("%d",&a),a){ scanf("%d",&b); int ret=0; for(int i=a;i<=b;i++)if(h[i])ret++; printf("%d\n",ret); } }
Main.java:1: error: illegal character: '#' #include<iostream> ^ Main.java:2: error: illegal character: '#' #include<math.h> ^ Main.java:3: error: illegal character: '#' #include<vector> ^ Main.java:4: error: illegal character: '#' #include<algorithm> ^ Main.java:5: error: illegal character: '#' #include<cstdio> ^ Main.java:6: error: illegal character: '#' #include <string> ^ Main.java:7: error: illegal character: '#' #include <complex> ^ Main.java:8: error: illegal character: '#' #include <functional> ^ Main.java:10: error: class, interface, enum, or record expected typedef pair<int,int> P; ^ Main.java:12: error: class, interface, enum, or record expected int h[1000001]; ^ Main.java:27: error: not a statement while(scanf("%d",&a),a){ ^ Main.java:13: error: unnamed classes are a preview feature and are disabled by default. int main(){ ^ (use --enable-preview to enable unnamed classes) Main.java:27: error: illegal start of expression while(scanf("%d",&a),a){ ^ Main.java:27: error: ')' expected while(scanf("%d",&a),a){ ^ Main.java:27: error: ';' expected while(scanf("%d",&a),a){ ^ Main.java:28: error: illegal start of expression scanf("%d",&b); ^ 16 errors
s613783486
p00162
C
#include <stdio.h> // printf(), scanf() #include <stdbool.h> #define MAX_N 1000000 bool f[MAX_N + 1]; void preparation() { for (int i = 0; i <= MAX_N; ++i) f[i] = false; for (int i = 1; i <= MAX_N; ++i) { int j = i; while (j % 2 == 0) j /= 2; while (j % 3 == 0) j /= 3; while (j % 5 == 0) j /= 5; if (j == 1) f[i] = true; } } int main(int argc, char **argv) { preparation(); while (true) { int m, n; scanf("%d", &m); if (m == 0) break; scanf("%d", &n); int count = 0; for (int i = m; i <= n; ++i) { if (f2[i]) count++; } printf("%d\n", count); } return 0; }
main.c: In function 'main': main.c:47:29: error: 'f2' undeclared (first use in this function); did you mean 'f'? 47 | if (f2[i]) | ^~ | f main.c:47:29: note: each undeclared identifier is reported only once for each function it appears in
s130507412
p00162
C
#include<iostream> #include<cmath> using namespace std; const int MAX_NUM = 1000; int main(){ bool list[MAX_NUM + 1] = {0}; for(int two = 0;two <= 20;two++){ for(int three = 0;three <= 13;three++){ for(int five = 0;five <= 9;five++){ int num = pow(2, two) * pow(3, three) * pow(5, five); if(1 <= num && num <= MAX_NUM) list[num] = true; } } } int m, n; while(1){ cin >> m; if(m == 0) break; cin >> n; int ans = 0; for(int i = m;i <= n;i++){ if(list[i]) ans++; } cout << ans << endl; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s667175148
p00162
C++
#include<stdio.h> int main(){ int x,y,c=0; while(scanf("%d %d",&x,&y) { for(int i=x;i<=y;y++) { if(i%2==0)c++; else if(i%3==0)c++; else if(i%5==0)c++; } printf("%d\n",c);c=0; } return 0; }
a.cc: In function 'int main()': a.cc:7:27: error: expected ')' before '{' token 7 | while(scanf("%d %d",&x,&y) | ~ ^ | ) 8 | { | ~
s593648907
p00162
C++
#include<stdio.h> int main(){ int x,y,c=0; while(scanf("%d %d",&x,&y) { for(int i=x;i<=y;y++) { if(i%2==0)c++; else if(i%3==0)c++; else if(i%5==0)c++; } printf("%d\n",c);c=0; } return 0; } #include<stdio.h> int main(){ int x,y,c=0; while(scanf("%d %d",&x,&y)) { for(int i=x;i<=y;i++) { if(i%2==0)c++; else if(i%3==0)c++; else if(i%5==0)c++; } printf("%d\n",c);c=0; } return 0; }
a.cc: In function 'int main()': a.cc:7:27: error: expected ')' before '{' token 7 | while(scanf("%d %d",&x,&y) | ~ ^ | ) 8 | { | ~ a.cc: At global scope: a.cc:22:5: error: redefinition of 'int main()' 22 | int main(){ | ^~~~ a.cc:3:5: note: 'int main()' previously defined here 3 | int main(){ | ^~~~
s262078595
p00162
C++
#include<stdio.h> int main(){ int x,y,c=0; bool f[1000001]; for(int i=0;i<=1000001;i++) f[i]=false; for(int i=0;i<=1000001;i++) { if(i%2==0)f[i]=true; else if(i%3==0)f[i]=true; else if(i%5==0)f[i]=true; } while(scanf("%d %d",&x,&y)) { for(int i=x;i<=y;i++) {if(bool[i]==true)c++; } /* for(int i=x;i<=y;i++) { if(i%2==0)c++; else if(i%3==0)c++; else if(i%5==0)c++; } */ printf("%d\n",c);c=0; } return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: expected unqualified-id before '[' token 19 | {if(bool[i]==true)c++; | ^
s042638078
p00162
C++
#include <iostream> using namespace std; int isHammingNumber(int n){ int p=n; while(p%2 == 0)p/=2; while(p%3 == 0)p/=3; while(p%5 == 0)p/=5; return p==1; } int main() { int m,n; int count; while(count=0,cin>>m>>n,m){ for(int i=m;i<=n;++i)if(HammingNumber(i))++count; cout << count << endl; } return 0; }
a.cc: In function 'int main()': a.cc:18:41: error: 'HammingNumber' was not declared in this scope; did you mean 'isHammingNumber'? 18 | for(int i=m;i<=n;++i)if(HammingNumber(i))++count; | ^~~~~~~~~~~~~ | isHammingNumber
s679828213
p00162
C++
##include<stdio.h> #include<algorithm> #include<iostream> using namespace std; int main(){ long long int A,B; int n[101][101][3]={}; while(1){ cin>>A>>B; if(A==0&&B==0)break; long long int g=60;int c=0; for(long long int i=A;i<=B;i++){g=60; for(long long int j=1;j<11;j++) { if(g%i==0){//cout<<g<<endl; c++;break;} else{g*=60;} } } cout<<c<<endl; /* int d=1; for(int i=0;i<A;i++) for(int j=0;j<A;j++){ if(n[i][j][3]<d) */ } return 0; }
a.cc:1:1: error: stray '##' in program 1 | ##include<stdio.h> | ^~ a.cc:1:3: error: 'include' does not name a type 1 | ##include<stdio.h> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, 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 i
s810029732
p00162
C++
#include<iostream> using namespace std; typedef long long L; int main() { L m,n; L a = pow(60,9); while (cin >> m, m) { cin >> n; int ans = 0; for (L i = m; i <= n; i++) { if (a%i==0)ans++; } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:6:15: error: 'pow' was not declared in this scope 6 | L a = pow(60,9); | ^~~
s453944304
p00162
C++
#include <iostream> using namespace std; int main() { int m, n; while(1) { cin << m << n; if(m == 0) break; int count = 0; for(int i = m; i <= n; i++) { if(i % 2 == 0) continue; else if(i % 3 == 0) continue; else if(i % 5 == 0) continue; else count++; } cout << count << endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 8 | cin << m << n; | ~~~ ^~ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:8:9: note: candidate: 'operator<<(int, int)' (built-in) 8 | cin << m << n; | ~~~~^~~~ a.cc:8:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/basic_string.h:47, 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:1: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin << m << n; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin << m << n; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:8:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 8 | cin << m << n; | ^~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin << m << n; | ^ /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin << m << n; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin << m << n; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin << m << n; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin << m << n; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin << m << n; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin << m << n; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin << m << n; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin << m << n; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin << m << n; | ^ /usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)' 689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed: a.cc:8:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin << m << n; | ^ /usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ /usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed: /usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]': a.cc:8:12: required from here 8 | cin << m << n; | ^ /usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~
s163823459
p00162
C++
#include <iostream> using namespace std; int main() { int m, n; int num; while(1) { cin >> m >> n; if(m == 0) break; int count = 0; for(int i = m; i <= n; i++) { num = i; while(1) { if(num == 1) { count++; break; } if(num % 2 == 0) num = num / 2; else if(num % 3 == 0) num = num / 3; else if(num % 5 == 0) num = num / 5; else break; } cout << count << endl; } return 0; }
a.cc: In function 'int main()': a.cc:33:2: error: expected '}' at end of input 33 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s118699002
p00162
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s248754228
p00162
C++
#include<queue> #include<iostream> #include<functional> using namespace std; bool bh[1000001]; int main() { priority_queue< int,vector<int>,greater<int> > pq; pq.push(1); bh[1]=true; while(pq.top()<1000000){ int a=pq.top(); pq.pop(); if(2*a<=1000000&&!bh[2*a]) pq.push(2*a),bh[2*a]=true; if(3*a<=1000000&&!bh[3*a]) pq.push(3*a),bh[3*a]=true; if(5*a<=1000000&&!bh[5*a]) pq.push(5*a),bh[5*a]=true; } vector<int> ham; for(int i=0;i<=1000000;i++) if(bh[i]) ham.push_back(i); for(int m,n;scanf("%d%d",&m,&n),m;){ printf("%d\n", distance(lower_bound(ham.begin(),ham.end(),m), upper_bound(ham.begin(),ham.end(),n)) ); } return 0; }
a.cc: In function 'int main()': a.cc:26:42: error: 'upper_bound' was not declared in this scope 26 | upper_bound(ham.begin(),ham.end(),n)) | ^~~~~~~~~~~
s783003034
p00162
C++
#include<iostream> using namespace std; /* bool sw[1000001]; int i; void sws(int k){ if(k==1){ sw[i]=true; return; } if(k%2==0) sws(k/2); else if(k%3==0) sws(k/3); else if(k%5==0) sws(k/5); return; } */ // korenisuru int dp[1000001]; int f(int n){ if(~dp[n]) return dp[n]; int ans = 0; else if(n%2==0) ans |= f(n/2); else if(n%3==0) ans |= f(n/3); if(n%5==0) ans |= f(n/5); return dp[n] = ans; } int main() { int k,m,n; for(int i = 0 ; i <= 1000000 ; i++) dp[i] = -1; dp[1] = 1; /* for(int j=0;j<1000001;j++) sw[j]=false; for(i=1;i<1000001;i++) sws(i); while(cin >> m,m){ int ans=0; cin >> n; for(int j=m;j<=n;j++) if(sw[j]==true) ans++; cout << ans << endl; }*/ while(cin >> m && m){ cin >> n; int ans = 0; for(int i = m ; i <= n ; i++) ans += f(i); cout << ans << endl; } return 0; }
a.cc: In function 'int f(int)': a.cc:23:9: error: 'else' without a previous 'if' 23 | else if(n%2==0) ans |= f(n/2); | ^~~~
s134827123
p00162
C++
#include<iostream> #define N 1000001 using namespace std; int main(){ int num; int sum[N]; int n,m; sum[0] = 0; num = 0; for(int i=1;i<N;i++){ int tmp = i; while(!(tmp%2))tmp/=2; while(!(tmp%3))tmp/=3; while(!(tmp%5))tmp/=5; if(tmp==1)num++; sum[i] = num; } while(1){ cin >> m; if(!m)break; cin >>n; cout << sum[m] - sum[n-1] << endl; }
a.cc: In function 'int main()': a.cc:26:2: error: expected '}' at end of input 26 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s532809735
p00162
C++
#include<iostream> using namespace std; bool ham[100001]; int m,n; void solve(){ for(int i=1; i<6; i++) ham[i] = true; for(int i=6; i<100001; i++) ham[i] = false; for(int i=2; i<100001; i++){ if(ham[i]){ for(int j=i*2; j<size; j*=2){ if(j>100001) break; ham[j] = true; }for(int j=i*3; j<size; j*=3){ if(j>100001) break; ham[j] = true; }for(int j=i*5; ; j*=5){ if(j>100001) break; ham[j] = true; } } } } int main(){ solve(); while(true){ cin >> m >> n; if(!m && !n) return 0; int ans = 0; for(int i=m; i<=n; i++) if(ham[i]) ans++; cout << ans << endl; } }
a.cc: In function 'void solve()': a.cc:14:41: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<' 14 | for(int j=i*2; j<size; j*=2){ | ~^~~~~ a.cc:18:42: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<' 18 | }for(int j=i*3; j<size; j*=3){ | ~^~~~~
s534194272
p00162
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; vector<int> hamming; void ham() { int temp; for(int i=0;i<20;i++) { for(int j=0;j<20;j++) { for(int k=0;k<20;k++) { temp = pow(2.0,(double)i)*pow(3.0,(double)j)*pow(5.0,(double)k); if(temp <= 1000000 && temp >= 0) { hamming.push_back(temp); cout << temp << endl; } else { break; } } } } } int main() { int m,n,from,to; vector<int>::iterator low,up; ham(); sort(hamming.begin(),hamming.end()); while(cin >> m >> n) { low=lower_bound(hamming.begin(), hamming.end(), m); up=upper_bound(hamming.begin(),hamming.end(),n); from = int(low-hamming.begin()); to = int(up-hamming.begin()); cout << to-from << endl; } }
a.cc: In function 'int main()': a.cc:30:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 30 | sort(hamming.begin(),hamming.end()); | ^~~~ | sqrt a.cc:33:8: error: 'upper_bound' was not declared in this scope 33 | up=upper_bound(hamming.begin(),hamming.end(),n); | ^~~~~~~~~~~
s960266824
p00162
C++
#include<iostream> #include<algorithm> #define MAXNUM 1e+6; using namespace std; int ham[4]={1,2,3,5}; bool memo[MAXNUM+1]={false}; void func(int n){ if(n>MAXNUM || memo[n]==true){ return ; } func(n*2); func(n*3); func(n*5); } int main(){ int m,n,ans; func(1); while(cin>>m>>n,m){ ans=0; for(int i=m;i<=n;i++){ if(p[i]){ ans++; } } cout<<ans<<endl; } }
a.cc:3:20: error: expected ']' before ';' token 3 | #define MAXNUM 1e+6; | ^ a.cc:8:11: note: in expansion of macro 'MAXNUM' 8 | bool memo[MAXNUM+1]={false}; | ^~~~~~ a.cc:8:17: error: expected unqualified-id before '+' token 8 | bool memo[MAXNUM+1]={false}; | ^ a.cc: In function 'void func(int)': a.cc:11:21: error: expected primary-expression before '||' token 11 | if(n>MAXNUM || memo[n]==true){ | ^~ a.cc:11:24: error: 'memo' was not declared in this scope 11 | if(n>MAXNUM || memo[n]==true){ | ^~~~ a.cc: In function 'int main()': a.cc:26:28: error: 'p' was not declared in this scope 26 | if(p[i]){ | ^
s182197817
p00162
C++
#include<iostream> #include<vector> using namespace std; #define MAX 1000010 int main(){ int hamming[MAX]; memset(hamming,0,sizeof(int)*MAX); hamming[0]=0; hamming[1]=1; long int tmp =0; for(int i=0;tmp<MAX;i++){ for(int j=0;tmp<MAX;j++){ for(int k=0;tmp<MAX;k++){ tmp =pow(2,i)*pow(3,j)*pow(5,k); if(tmp<MAX){ hamming[tmp]=1; } } tmp =pow(2,i)*pow(3,j+1)*pow(5,0); } tmp =pow(2,i+1)*pow(3,0)*pow(5,0); } int a,b; while(cin>>a,a!=0){ cin>>b; int ans=0; for(int i=a;i<b+1;i++){ ans+=hamming[i]; } cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:8:9: error: 'memset' was not declared in this scope 8 | memset(hamming,0,sizeof(int)*MAX); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<vector> +++ |+#include <cstring> 3 | using namespace std; a.cc:15:38: error: 'pow' was not declared in this scope 15 | tmp =pow(2,i)*pow(3,j)*pow(5,k); | ^~~ a.cc:20:30: error: 'pow' was not declared in this scope 20 | tmp =pow(2,i)*pow(3,j+1)*pow(5,0); | ^~~ a.cc:22:22: error: 'pow' was not declared in this scope 22 | tmp =pow(2,i+1)*pow(3,0)*pow(5,0); | ^~~