submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s850602439
p03951
C++
#include <bits/stdc++.h> #define REP(i, n) for(ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF (1ll << 60) #define sz(x) int(x.size()) using namespace std; typedef long long ll; using vl = vector<ll>; using vvl = vector<vl>; typedef double db; typedef string str; typedef pair<ll, ll> p; constexpr int MOD = 1000000007; using ll = long long; template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } void print(const std::vector<int> &v) { std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; }); std::cout << std::endl; } int main() { int N; cin >> N; string s; string t; cin >> s; reverse(s.begin().s.end()); cin >> t; int cnt = 0; REP(i, N) { if(s[i] == t[i]) { cnt++; } } cout << 2 * N - cnt << endl; }
a.cc: In function 'int main()': a.cc:42:23: error: 'std::__cxx11::basic_string<char>::iterator' has no member named 's' 42 | reverse(s.begin().s.end()); | ^
s999808060
p03951
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; string s,t; cin >> N >> s >> t; FOR(i,N,2*N+1){ int j = i-N; string ans = s.substr(0,j) + t; if(ans.substr(0,N)==s){ cout << i << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:8:13: error: 'i' was not declared in this scope 8 | FOR(i,N,2*N+1){ | ^ a.cc:8:9: error: 'FOR' was not declared in this scope 8 | FOR(i,N,2*N+1){ | ^~~
s104042562
p03951
C++
#include <bits/stdc++.h> #include <algorithm> using namespace std; int main() { int a; string b,c; cin >> a; cin >>b; cin >>c; for(int i=0;i<a;i++){ for(int j=i+1;i<a;i++){ if(a.substr(i) ==a.substr(0,a-1)){ cout << i+a << endl; return 0; } } } cout << 2*a << endl; }
a.cc: In function 'int main()': a.cc:14:13: error: request for member 'substr' in 'a', which is of non-class type 'int' 14 | if(a.substr(i) ==a.substr(0,a-1)){ | ^~~~~~ a.cc:14:27: error: request for member 'substr' in 'a', which is of non-class type 'int' 14 | if(a.substr(i) ==a.substr(0,a-1)){ | ^~~~~~
s683064646
p03951
C++
#include <bits/stdc++.h> using namespace std; int N; string s, t; int solve() { for (int i = 0; i < N; i++) { if (s.substr(i) == t.substr(0, N-i)) return N+i; return N*2; } int main() { cin >> N >> s >> t; cout << solve() << endl; }
a.cc: In function 'int solve()': a.cc:11:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 11 | int main() { | ^~ a.cc:11:9: note: remove parentheses to default-initialize a variable 11 | int main() { | ^~ | -- a.cc:11:9: note: or replace parentheses with braces to value-initialize a variable a.cc:11:12: error: a function-definition is not allowed here before '{' token 11 | int main() { | ^ a.cc:14:2: error: expected '}' at end of input 14 | } | ^ a.cc:5:13: note: to match this '{' 5 | int solve() { | ^ a.cc:14:2: warning: control reaches end of non-void function [-Wreturn-type] 14 | } | ^
s252990197
p03951
C++
#include <bits/stdc++.h> using namespace std; int N; string s, t; int solve() { for (int i = 0; i < N; i++) { if (s.substr(i) == t.substr(0, N-i)) return N+i; return N*2; int main() { cin >> N >> s >> t; cout << solve() << endl;
a.cc: In function 'int solve()': a.cc:10:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 10 | int main() { | ^~ a.cc:10:9: note: remove parentheses to default-initialize a variable 10 | int main() { | ^~ | -- a.cc:10:9: note: or replace parentheses with braces to value-initialize a variable a.cc:10:12: error: a function-definition is not allowed here before '{' token 10 | int main() { | ^ a.cc:12:27: error: expected '}' at end of input 12 | cout << solve() << endl; | ^ a.cc:6:31: note: to match this '{' 6 | for (int i = 0; i < N; i++) { | ^ a.cc:12:27: error: expected '}' at end of input 12 | cout << solve() << endl; | ^ a.cc:5:13: note: to match this '{' 5 | int solve() { | ^ a.cc:12:27: warning: control reaches end of non-void function [-Wreturn-type] 12 | cout << solve() << endl; | ^
s547801924
p03951
C++
n=int(input()) s=input() t=input() fin=1 for i in range(n): flag=1 j=0 while i+j<n: if t[j]!=s[i+j]: flag=0 j=j+1 if flag: print(n-i+i*2) fin=0 if fin: print(2*n)
a.cc:1:1: error: 'n' does not name a type 1 | n=int(input()) | ^
s088387495
p03951
C++
#include <bits/stdc++.h> using namespace std; int main(void) { int n; string s, t; cin >> n >> s >> t; int ans = 0; for (int i = 0; i < n; i++) { int cnt = 0; for (int j = 0; j <= i; j++) { if (t[j] == s[n - 1 - i + j]) cnt++; } if (cnt == i + 1) ans = cnt; } cout << cnt << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:11: error: 'cnt' was not declared in this scope; did you mean 'int'? 17 | cout << cnt << endl; | ^~~ | int
s691037996
p03951
C++
#include<iostream> #include<algorithm> #include<cmath> #include<iomanip> #include<map> using namespace std; int main() { int n,cnt=0; string s,t; cin >> n >> s >> t; for(int i=1; i<=n; i++) { if(s.substr(n-i)==t.substr(0,i) { cnt=max(cnt,i); } } cout << n*2-cnt << endl; }
a.cc: In function 'int main()': a.cc:12:36: error: expected ')' before '{' token 12 | if(s.substr(n-i)==t.substr(0,i) { | ~ ^~ | ) a.cc:15:3: error: expected primary-expression before '}' token 15 | } | ^
s509891387
p03951
C++
#include <iostream> #include <string> using namespace std; int N; string s,t; int solve(){ for (int i=0;i<N;++i){ if(s.substr(i)==t.substr(0,N-i))return i+N; } return N*2; } int main(){ cin >>N>>s>>t; count<<solve()<<endl; }
a.cc: In function 'int main()': a.cc:17:3: error: 'count' was not declared in this scope 17 | count<<solve()<<endl; | ^~~~~
s321028099
p03951
C++
#include <bits/stdc++.h> using namespace std; int main{ int N; string s,t; cin>>N>>s>>t; int count=0; for(int i=0;i<N;i++){ if(s.at(i)==t.at(0)){ for(int j=0;i+j<N;j++){ if(s.at(i+j)==t.at(j)){ count++; } else{ count=0; break; } } } } cout<<2*N-count; }
a.cc:3:5: error: cannot declare '::main' to be a global variable 3 | int main{ | ^~~~ a.cc:4:1: error: expected primary-expression before 'int' 4 | int N; | ^~~ a.cc:4:1: error: expected '}' before 'int' a.cc:3:9: note: to match this '{' 3 | int main{ | ^ a.cc:6:1: error: 'cin' does not name a type 6 | cin>>N>>s>>t; | ^~~ a.cc:8:1: error: expected unqualified-id before 'for' 8 | for(int i=0;i<N;i++){ | ^~~ a.cc:8:13: error: 'i' does not name a type 8 | for(int i=0;i<N;i++){ | ^ a.cc:8:17: error: 'i' does not name a type 8 | for(int i=0;i<N;i++){ | ^ a.cc:21:1: error: 'cout' does not name a type 21 | cout<<2*N-count; | ^~~~ a.cc:22:1: error: expected declaration before '}' token 22 | } | ^
s059859729
p03951
C++
#include <bits/stdc++.h> using namespace std; int N; string s,t; cin>>N>>s>>t; int count=0; for(int i=0;i<N;i++){ if(s.at(i)==t.at(0)){ for(int j=0;i+j<N;j++){ if(s.at(i+j)==t.at(j)){ count++; } else{ count=0; break; } } } } cout<<2*N-count; }
a.cc:5:1: error: 'cin' does not name a type 5 | cin>>N>>s>>t; | ^~~ a.cc:7:1: error: expected unqualified-id before 'for' 7 | for(int i=0;i<N;i++){ | ^~~ a.cc:7:13: error: 'i' does not name a type 7 | for(int i=0;i<N;i++){ | ^ a.cc:7:17: error: 'i' does not name a type 7 | for(int i=0;i<N;i++){ | ^ a.cc:20:1: error: 'cout' does not name a type 20 | cout<<2*N-count; | ^~~~ a.cc:21:1: error: expected declaration before '}' token 21 | } | ^
s303340980
p03951
C++
//In The Name Of GOD #include <bits/stdc++.h> using namespace std; const int mod = 1000000007; const int inf = 2000000000; const int maxn = 100000; #define ll long long #define pb push_back #define mp make_pair #define IO ios_base::sync_with_stdio(false); int A[3*maxn]; bool mark[3*maxn]; int main(){ IO; int n,m; cin>>n>>m; if(m==1||m==2*n-1){ cout<<"No"; return 0; }else{ cout<<"YES\n"; if(m<n){ A[n-1]=2*n-1;mark[2*n-1]=true; A[n]=m;mark[m]=true; A[n+1]=1;mark[1]=true; A[n+2]=2*n-2;mark[2*n-2]=true; int a=0,b=1; }else if(m>n){ b/=a; A[n-1]=1;mark[1]=true; A[n]=m;mark[m]=true; A[n+1]=2*n-1;mark[2*n-1]=true; A[n+2]=2;mark[2]=true; } } int i=1,j=1; while(i<=2*n-1&&j<=2*n-1){ if(!A[i]){ if(!mark[j]){ A[i]=j; j++; }else{ j++; } }else{ i++; } } for(int i=0;i<2*n-1;i++){ cout<<A[i+1]<<endl; } }
a.cc: In function 'int main()': a.cc:29:9: error: 'b' was not declared in this scope 29 | b/=a; | ^ a.cc:29:12: error: 'a' was not declared in this scope 29 | b/=a; | ^
s029468508
p03951
C++
N=int(input()) s=input() t=input() c=N for i in range(N): if s[i:N]==t[0:(N-i)]:c=i print(N*2-(N-c))
a.cc:1:1: error: 'N' does not name a type 1 | N=int(input()) | ^
s168465425
p03951
C++
#include <bits/stdc++.h> using namespace std; #define dump(x) cout << #x << " = " << (x) << endl; typedef long long ll; typedef pair<int, int> ii; const int mod = 1e9+7; const ll INF = 1e18; const int inf = 1e9; void solve() { int n;cin>>n; string s,t; cin>>s>>t; int p=0; for (int i=0; i<=n; i++) { if (s.substr(n-i,i) == t.substr(0,i)) { p = i; } } cout << 2*n-p << endl; } int main() { solve(); return 0; } #include <bits/stdc++.h> using namespace std; #define dump(x) cout << #x << " = " << (x) << endl; typedef long long ll; typedef pair<int, int> ii; const int mod = 1e9+7; const ll INF = 1e18; const int inf = 1e9; void solve() { int n;cin>>n; string s,t; cin>>s>>t; int p=0; for (int i=0; i<=n; i++) { if (s.substr(n-i,i) == t.substr(0,i)) { p = i; } } cout << 2*n-p << endl; } int main() { solve(); return 0; }
a.cc:39:11: error: redefinition of 'const int mod' 39 | const int mod = 1e9+7; | ^~~ a.cc:8:11: note: 'const int mod' previously defined here 8 | const int mod = 1e9+7; | ^~~ a.cc:40:10: error: redefinition of 'const ll INF' 40 | const ll INF = 1e18; | ^~~ a.cc:9:10: note: 'const ll INF' previously defined here 9 | const ll INF = 1e18; | ^~~ a.cc:41:11: error: redefinition of 'const int inf' 41 | const int inf = 1e9; | ^~~ a.cc:10:11: note: 'const int inf' previously defined here 10 | const int inf = 1e9; | ^~~ a.cc:43:6: error: redefinition of 'void solve()' 43 | void solve() | ^~~~~ a.cc:12:6: note: 'void solve()' previously defined here 12 | void solve() | ^~~~~ a.cc:58:5: error: redefinition of 'int main()' 58 | int main() | ^~~~ a.cc:27:5: note: 'int main()' previously defined here 27 | int main() | ^~~~
s727761072
p03951
C++
#include <bits/stdc++.h> using namespace std; #define dump(x) cout << #x << " = " << (x) << endl; typedef long long ll; typedef pair<int, int> ii; const int mod = 1e9+7; const ll INF = 1e18; const int inf = 1e9; void solve() { int n;cin>>n; string s,t; cin>>s>>t; int p=0; for (int i=0; i<=n; i++) { if (s.substr(n-i,i) == t.substr(0,i)) { p = i; } } cout << 2*n-p << endl; } int main() { solve(); return 0; } #include <bits/stdc++.h> using namespace std; #define dump(x) cout << #x << " = " << (x) << endl; typedef long long ll; typedef pair<int, int> ii; const int mod = 1e9+7; const ll INF = 1e18; const int inf = 1e9; void solve() { int n;cin>>n; string s,t; cin>>s>>t; int p=0; for (int i=0; i<=n; i++) { if (s.substr(n-i,i) == t.substr(0,i)) { p = i; } } cout << 2*n-p << endl; } int main() { solve(); }
a.cc:39:11: error: redefinition of 'const int mod' 39 | const int mod = 1e9+7; | ^~~ a.cc:8:11: note: 'const int mod' previously defined here 8 | const int mod = 1e9+7; | ^~~ a.cc:40:10: error: redefinition of 'const ll INF' 40 | const ll INF = 1e18; | ^~~ a.cc:9:10: note: 'const ll INF' previously defined here 9 | const ll INF = 1e18; | ^~~ a.cc:41:11: error: redefinition of 'const int inf' 41 | const int inf = 1e9; | ^~~ a.cc:10:11: note: 'const int inf' previously defined here 10 | const int inf = 1e9; | ^~~ a.cc:43:6: error: redefinition of 'void solve()' 43 | void solve() | ^~~~~ a.cc:12:6: note: 'void solve()' previously defined here 12 | void solve() | ^~~~~ a.cc:58:5: error: redefinition of 'int main()' 58 | int main() | ^~~~ a.cc:27:5: note: 'int main()' previously defined here 27 | int main() | ^~~~
s779624807
p03951
C++
#include <iostream> using namesapce std; int main(){ int n; string a,b; cin >> n >> a >> b; int count=0; for(int i=1;i<=n;i++){ bool check=true; for(int j=0;j<i;j++){ if(a.at(n-i+j)!=b.at(j)); check=false; } if(check) count=i; } cout << 2*n-count << endl; }
a.cc:2:7: error: expected nested-name-specifier before 'namesapce' 2 | using namesapce std; | ^~~~~~~~~ a.cc: In function 'int main()': a.cc:6:3: error: 'string' was not declared in this scope 6 | string a,b; | ^~~~~~ a.cc:6:3: note: suggested alternatives: In file included from /usr/include/c++/14/iosfwd:41, 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/stringfwd.h:77:33: note: 'std::string' 77 | typedef basic_string<char> string; | ^~~~~~ In file included 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/string:76:11: note: 'std::pmr::string' 76 | using string = basic_string<char>; | ^~~~~~ a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 7 | cin >> n >> a >> b; | ^~~ | std::cin /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:7:15: error: 'a' was not declared in this scope 7 | cin >> n >> a >> b; | ^ a.cc:7:20: error: 'b' was not declared in this scope 7 | cin >> n >> a >> b; | ^ a.cc:17:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 17 | cout << 2*n-count << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:17:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 17 | cout << 2*n-count << endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s327057082
p03951
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; string S,T; cin >> N >> S >> T; int f; for(int i=0;i<N;i++){ f=0; for (int j=i;j<N;j++){ f+=T[j]==S[N-1-j]?0:1; } if (f==0){ S.erace(S.begin()+i,S.end()); cout << S << T << endl; return 0; } } cout << S << T << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'erace'; did you mean 'erase'? 15 | S.erace(S.begin()+i,S.end()); | ^~~~~ | erase
s729571197
p03951
C++
#include <iostream> #include <string> using namespace std; int N; string s, t; string solve() { for (int i = 0; i < N; ++i) { if (s.substr(i) == t.substr(0, N-i)) return i + N; } return N*2; } int main() { cin >> N >> s >> t; cout << solve() << endl; }
a.cc: In function 'std::string solve()': a.cc:10:55: error: could not convert '(i + N)' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'} 10 | if (s.substr(i) == t.substr(0, N-i)) return i + N; | ~~^~~ | | | int a.cc:12:13: error: could not convert '(N * 2)' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'} 12 | return N*2; | ~^~ | | | int
s092928189
p03951
Java
import java.util.Scanner object Main extends App { val sc = new Scanner(System.in) val n = sc.nextInt val s, t = sc.next val ans = (0 until n) .map(i => (i, s.substring(i), t.substring(0, n - i))) .find(t => t._2 == t._3) .map(n + _._1) .getOrElse(2 * n) println(ans) }
Main.java:2: error: ';' expected import java.util.Scanner ^ 1 error
s748668374
p03951
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() typedef long long ll; #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<60; int main() { int N; cin >> N; string s; string t; int ans = s.size() + t.size(); int j = 0; for(int i = s.size() i >= 0; --i){ if(s[i] == t[j]){ --ans; ++j; } else break; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:28:29: error: expected ';' before 'i' 28 | for(int i = s.size() i >= 0; --i){ | ^~ | ;
s777878255
p03951
C++
#include <iostream> #include <algorithm> int main(void) { char s[101], t[101]; int n, ls, lt; std::cin >> n >> s >> t; ls = std::strlen(s); lt = std::strlen(t); for(int i = std::max(ls - lt, 0); i != ls; i++){ if(i + lt < n) continue; bool flg = true; for(int j = i; j != ls; j++){ if(s[j] != t[j - i]){ flg = false; break; } } if(flg){ for(int j = 0; j != i; j++) std::cout << s[j]; for(int j = 0; j != lt; j++) std::cout << t[j]; std::cout << std::endl; return 0; } } std::cout << s; for(int i = 0; i < n - ls - lt; i++) std::cout << 'a'; std::cout << t << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:8:19: error: 'strlen' is not a member of 'std'; did you mean 'mbrlen'? 8 | ls = std::strlen(s); | ^~~~~~ | mbrlen a.cc:9:19: error: 'strlen' is not a member of 'std'; did you mean 'mbrlen'? 9 | lt = std::strlen(t); | ^~~~~~ | mbrlen
s471057215
p03951
C++
#include <iostream> #include <string> using namespace std; int main(){ int n,count=0; cin >> n; string s,t; cin >> s >> t; for(i=0;i<n;i++){ if(s[n-1-i]==t[i])count++; else break; } cout << 2*n-count << endl; }
a.cc: In function 'int main()': a.cc:10:7: error: 'i' was not declared in this scope 10 | for(i=0;i<n;i++){ | ^
s660821424
p03951
C++
#include <bits/stdc++.h> #define fi first #define se second #define rep(i,n) for(int i = 0; i < (n); ++i) #define rrep(i,n) for(int i = 1; i <= (n); ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define rng(a) a.begin(),a.end() #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define limit(x,l,r) max(l,min(x,r)) #define lims(x,l,r) (x = max(l,min(x,r))) #define isin(x,l,r) ((l) <= (x) && (x) < (r)) #define pb push_back #define sz(x) (int)(x).size() #define pcnt __builtin_popcountll #define uni(x) x.erase(unique(rng(x)),x.end()) #define snuke srand((unsigned)clock()+(unsigned)time(NULL)); #define show(x) cout<<#x<<" = "<<x<<endl; #define PQ(T) priority_queue<T,v(T),greater<T> > #define bn(x) ((1<<x)-1) #define dup(x,y) (((x)+(y)-1)/(y)) #define newline puts("") #define v(T) vector<T> #define vv(T) v(v(T)) using namespace std; typedef long long int ll; typedef unsigned uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<P> vp; inline int in() { int x; scanf("%d",&x); return x;} template<typename T>inline istream& operator>>(istream&i,v(T)&v) {rep(j,sz(v))i>>v[j];return i;} template<typename T>string join(const v(T)&v) {stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);} template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v) {if(sz(v))o<<join(v);return o;} template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v) {return i>>v.fi>>v.se;} template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v) {return o<<v.fi<<","<<v.se;} template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;} const double eps = 1e-10; const ll LINF = 1001002003004005006ll; const int INF = 1001001001; #define dame { puts("-1"); return 0;} #define yn {puts("Yes");}else{puts("No");} const int MX = 200005; #define RET(ans) {cout<<ans<<endl;return 0;} // 二次元ベクターの基本 /* vector<vector<int>> dp; // 宣言 dp.resize(n); // 1次元めの要素数決定 dp[i].push_back(int); // プッシュバック rep(i,n){ sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート } */ // 整数スキャン(複数) /* int x,y,z; scanf("%d%d%d",&x,&y,&z); // n個の整数のスキャン /* ll a[n] = {}; rep(i,n){ scanf("%lld",&a[i]); } */ // 文字列スキャン /* string s; cin >> s; */ // n個の文字列スキャン /* vector<string> slist; rep(i,n){ string s; cin >> s; slist.push_back(s); } */ int main() { string s,t; cin >> s >> t; drep(i,n+1){ int flag = 0; rep(j,i){ if(s[n-i+j]!=t[j]){ flag = 1; break; } } if(flag==0){ cout << n*2 - i << endl; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:95:12: error: 'n' was not declared in this scope 95 | drep(i,n+1){ | ^ a.cc:6:32: note: in definition of macro 'drep' 6 | #define drep(i,n) for(int i = (n)-1; i >= 0; --i) | ^
s539712505
p03951
C++
#include<iostream> #include<string> #include<algorithm> #include<bits/stdc++.h> #include<vector> using namespace std; int main() { int N,co=0; cin >> N; string s,t; cin >> s >> t; for(int i=1; i<=N; i++){ if(s.substr(N-i)==t.substr(0.i)) co=i; } cout << 2*N-co << endl; }
a.cc: In function 'int main()': a.cc:15:32: error: cannot convert 'std::complex<double>' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} 15 | if(s.substr(N-i)==t.substr(0.i)) co=i; | ^~~ | | | std::complex<double> In file included 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/bits/basic_string.h:3208:24: note: initializing argument 1 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 3208 | substr(size_type __pos = 0, size_type __n = npos) const | ~~~~~~~~~~^~~~~~~~~
s293587787
p03951
C++
n=int(input()) s=input() t=input() k=n for i in range(n): if(s[i:]==t[:n-i]): k=i break print(n+k)
a.cc:1:1: error: 'n' does not name a type 1 | n=int(input()) | ^
s165285020
p03951
C++
#define debug_interval ',' #define dump_interval ' ' #define debug_toggle 1 //{ #include<bits/stdc++.h> using namespace std; #define hi cerr<<"hi"<<endl; #define int long long #define INT_MAX LLONG_MAX #define rep(i,n) for(int i=0;i<(n);i++) #define rep1(i,n) for(int i=1;i<=(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define fi first #define se second #define mp make_pair #define rev reverse #define dans dump(ans) #define MOD 1000000007 #define amp(v,n) (v).count(n)?v[n]++:v[n]=1 #define sysp system("pause") #define PI acos(-1) #define pf push_front //{ inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();} template<class...A> inline void dump(){cout<<endl;} template<class...A> inline void dump_rest() {cout<<endl;} template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);} template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);} template<class...A> inline void debug(){cerr<<endl;} template<class...A> inline void debug_rest() {cerr<<endl;} template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);} template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);} //} typedef vector<int>vint; typedef pair<int,int>pint; typedef vector<pint>vpint; template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;} template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;} template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}}; int n; string s,t; main(){ cin>>n>>s>>t; n*=2; rev(sll(s)); rep(i,n){ if(s[i]==t[i])n--; else break; } dump(n); }
a.cc:9:9: warning: "INT_MAX" redefined 9 | #define INT_MAX LLONG_MAX | ^~~~~~~ In file included from /usr/include/c++/14/climits:42, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:38, from a.cc:5: /usr/lib/gcc/x86_64-linux-gnu/14/include/limits.h:120:9: note: this is the location of the previous definition 120 | #define INT_MAX __INT_MAX__ | ^~~~~~~ a.cc:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 50 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:53:13: error: 'sll' was not declared in this scope; did you mean 'all'? 53 | rev(sll(s)); | ^~~ | all
s667772177
p03951
C
/* 結果: */ #define _USE_MATH_DEFINES #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <limits.h> #include <stdbool.h> #define inf (INT_MAX-1) #define INF 9223372036854775807 #define PI 3.14159265358979323846; #define EPS 1e-10 #define sq(n) ((n)*(n)) #define rep(i,n) for(i=0;i<n;i++) #define rev(i,n) for(i=n-1;i>=0;i--) /* #define sort(a,n) qsort(a,n,sizeof(TYPE),cmp) #define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r) */ #define chsort(s,n) qsort(s,n,sizeof(char),cmp) #define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r) #define TYPE long long #define ll long long #define MEMSET(a) memset(a,0,sizeof(a)) #define MEMSET_U(a) memset(a,-1,sizeof(a)) const int mod = (int)1e09 + 7; //#define DEBUG1 //#define DEBUG2 //#define DEBUGF #define DUMMY int in(void) { int i; scanf("%d", &i); return i; } long long llin(void) { long long i; scanf("%lld", &i); return i; } double din(void) { double i; scanf("%lf", &i); return i; } void chin(char s[]) { scanf("%s", s); } void print(int a) { printf("%d\n", a); } void llprint(long long a) { printf("%lld\n", a); } void dprint(double a) { printf("%.10f\n", a); } void print2(int a, int b) { printf("%d %d\n", a, b); } int Max(int a, int b) { if (a > b) { return a; }return b; } int Min(int a, int b) { if (a < b) { return a; }return b; } long long llmax(long long a, long long b) { return a > b ? a : b; } long long llmin(long long a, long long b) { return a < b ? a : b; } double dmax(double a, double b) { return a > b ? a : b; } double dmin(double a, double b) { return a < b ? a : b; } //long long llmax(long long a, long long b) { return a > b ? a : b; } //long long llmin(long long a, long long b) { return a < b ? a : b; } //double dmax(double a, double b) { return a > b ? a : b; } int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; } int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; } int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); } int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); } void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; } int N; char S[101], T[101]; int ans; int same(int d) { for (int i = 0; i < N-d; i++) { if (S[i + d] != T[]) { return 0; } } return 1; } int main() { scanf("%d", &N); scanf("%s%s", S, T); int d = 0; for (d = 0; d < N; d++) { if (same(d)) { break; } } ans = N + d; printf("%d\n", ans); #ifdef DEBUGF getch(); #endif return 0; }
main.c: In function 'same': main.c:67:35: error: expected expression before ']' token 67 | if (S[i + d] != T[]) { | ^
s294638557
p03951
C++
#include <bits/stdc++.h> #include <unordered_set> using namespace std; #define ll long long #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++) #define revrep(i,n) for(int (i)=(n)-1;i>=0; i--) int main() { cin.tie(0); ios::sync_with_stdio(false); cout<<setprecision(std::numeric_limits<float>::max_digits10); int n; cin>>s>>t; reverse(s.begin(),s.end()); int c=0; rep(i,n) { if(s[i]==t[i]) c++; else break; } cout << s.size()+t.size()-c << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:8: error: 's' was not declared in this scope 14 | cin>>s>>t; | ^ a.cc:14:11: error: 't' was not declared in this scope 14 | cin>>s>>t; | ^
s421129725
p03951
C++
#include<algorithm> #include<iostream> using namespace std; int main(){ int N,x,i; cin>>N>>x; if(x!=N){ cout<<"No"<<endl; } else{ cout<<"Yes"<<endl; REP(i,1,2*N+2){ cout<<i<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:13:5: error: 'REP' was not declared in this scope 13 | REP(i,1,2*N+2){ | ^~~
s603978314
p03951
C++
#include <cstdio> #include <iostream> using namespace std; char a[200], b[200]; int n; inline int lcp() { int ans = 0; for(int i = 1; i <= n; i ++ ) { if(a[i] == b[i]) ans ++; else break; } return ans; } int main() { scanf("%d%s%s", &n, a+1, b+1); reverse(a+1, a+n+1); printf("%d\n", n*2-lcp()); }
a.cc: In function 'int main()': a.cc:16:9: error: 'reverse' was not declared in this scope 16 | reverse(a+1, a+n+1); | ^~~~~~~
s571773837
p03951
C++
#include <cstdio> #include <iostream> char a[200], b[200]; int n; inline int lcp() { int ans = 0; for(int i = 1; i <= n; i ++ ) { if(a[i] == b[i]) ans ++; else break; } return ans; } int main() { scanf("%d%s%s", &n, a+1, b+1); std :: reverse(a+1, a+n+1); printf("%d\n", n*2-lcp()); }
a.cc: In function 'int main()': a.cc:15:16: error: 'reverse' is not a member of 'std' 15 | std :: reverse(a+1, a+n+1); | ^~~~~~~
s407966181
p03951
C++
#include<stdio.h> #define dn(i,j) (a[i]<=k && a[j]<=k) #define up(i,j) (k<a[i] && k<a[j]) int a[200005],n,l,r,mid; inline bool judge(const int &k) { if (dn(n-1,n) || dn(n,n+1)) return 1; if (up(n-1,n) || up(n,n+1)) return 0; for (int i=1;i<n-1;i++) { if (dn(n+i,n+i+1) || dn(n-i,n-i-1)) return 1; if (up(n+i,n+i+1) || up(n-i,n-i-1)) return 0; } return dn(1,1); } int main() { scanf("%d",&n); for (int i=1;i<n<<1;i++) scanf("%d",a+i); for (r=(n<<1)-1,mid=l+r>>1;l<r;mid=l+r>>1) if (judge(mid)) r=mid;else l=mid+1; printf("%d",l); } 1
a.cc:26:1: error: expected unqualified-id before numeric constant 26 | 1 | ^
s249298235
p03951
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> #include <cstdio> #include <bits/stdc++.h> #include <set> #include <map> #include <stdio.h> using namespace std; using ll =int long long; map <int ,int> mpa,mpb; string s,t; int i,j; string toru(string x, int i, int j){ string p=x.substring(i,j) return p; } int main(void){ int N; cin >>N; cin >> s >> t; int ans=0; for(int k=0; k<N ;k++){ if(toru(s,k,N-k)==toru(t,0,N-k)){ cout << N+k; return 0; } } }
a.cc: In function 'std::string toru(std::string, int, int)': a.cc:18:14: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'substring'; did you mean 'substr'? 18 | string p=x.substring(i,j) | ^~~~~~~~~ | substr a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type] 20 | } | ^
s716605228
p03951
C++
4 expr expr#include <bits/stdc++.h> #include <array> using namespace std; typedef long long ll; #define tr(container, it) \ for (auto it = container.begin(); it != container.end(); it++) #define scontains(c,x) ((c).find(x) != (c).end()) //O(log n) #define contains(c,x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n) #define Ichar(_x) char _x;scanf("%c",&_x); #define Iint(_x) int _x;scanf("%d",&_x); #define Ill(_x) ll _x;scanf("%lld",&_x); #define inc(a,b,x)(x)>a && (x)<b #define incE(a,b,x)(x)>=a && (x)<=b //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout); int main() { Iint(n); string s, t; std::cin >> s >>t; int mx = 0; for (int i = n; i >= n; --i) { if(t.substr(0,i)==s.substr(n-i,i)) { mx = i; break; } } std::cout << 2*n-mx; }
a.cc:3:5: error: stray '#' in program 3 | expr#include <bits/stdc++.h> | ^ a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 4 | ^ In file included from /usr/include/c++/14/array:39, from a.cc:4: /usr/include/c++/14/initializer_list:51:15: error: 'size_t' does not name a type 51 | typedef size_t size_type; | ^~~~~~ /usr/include/c++/14/initializer_list:1:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | // std::initializer_list support -*- C++ -*- /usr/include/c++/14/initializer_list:57:7: error: 'size_type' does not name a type 57 | size_type _M_len; | ^~~~~~~~~ /usr/include/c++/14/initializer_list:60:54: error: 'size_type' has not been declared 60 | constexpr initializer_list(const_iterator __a, size_type __l) | ^~~~~~~~~ /usr/include/c++/14/initializer_list:68:17: error: 'size_type' does not name a type 68 | constexpr size_type | ^~~~~~~~~ /usr/include/c++/14/initializer_list:45:11: fatal error: definition of 'class std::initializer_list<_E>' does not match '#include <initializer_list>' 45 | class initializer_list | ^~~~~~~~~~~~~~~~ compilation terminated.
s912862671
p03951
C++
class KMP: pattern = None length = -1 failed = None def __init__(self, pattern): self.pattern = pattern self.length = len(pattern) self.failed = [-1 for i in xrange(self.length)] for i in xrange(1, self.length): prev = self.failed[i-1] while prev!=-1 and pattern[prev+1]!=pattern[i]: prev = self.failed[i-1] if pattern[prev+1]==pattern[i]: prev += 1 self.failed[i] = prev def minimumLen(s, t): kmp = KMP(t) offset = -1 for c in s: while offset!=-1 and kmp.pattern[offset+1]!=c: offset = kmp.failed[offset] if kmp.pattern[offset+1]==c: offset += 1 return len(s)+len(t)-(offset+1) def main(): n = int(raw_input().strip()) s = raw_input().strip() t = raw_input().strip() return print minimumLen(s, t) if __name__ == '__main__': main()
a.cc:34:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 34 | if __name__ == '__main__': | ^~~~~~~~~~ a.cc:2:13: error: expected class-name before '=' token 2 | pattern = None | ^ a.cc:2:13: error: expected '{' before '=' token a.cc:2:13: error: expected unqualified-id before '=' token
s333958543
p03951
C
#define _CRT_SECURE_NO_WARNINGS 1 #include <iostream> #include <fstream> #include <string> #include <cmath> #include <cstdlib> #include <ctime> #include <vector> #include <algorithm> #include <numeric> #include <map> #include <set> #include <queue> #include <deque> #include <functional> int descending_compare(const void *a, const void *b) { if (*(int*)a > *(int*)b) { return -1; } else if (*(int*)a == *(int*)b) { return 0; } else { return 1; } } int ascending_compare(const void *a, const void *b) { if (*(int*)a < *(int*)b) { return -1; } else if (*(int*)a == *(int*)b) { return 0; } else { return 1; } } //greatest common divisor unsigned long gcd(unsigned long x, unsigned long y) { if (y == 0) { return x; } else if (x > y) { return gcd(y, x % y); } else { return gcd(x, y % x); } } long long factorial(int x) { long long rtn = 1; int i; for (i = x; i > 1; i--) { rtn = (rtn*i); } return rtn; } /* int struct_ascending_compare(const void *p, const void *q) { return ((struct_name*)p)->member_name - ((struct_name*)q)->member_name; }*/ int main(void) { int n; char s[105]; char t[105]; scanf("%d", &n); scanf("%s", s); scanf("%s", t); int len = strlen(s); int match = len; for (int i = 0; i < len; i++) { int flag = 1; for (int j = 0; j < len - i; j++) { if (s[i + j] != t[j]) { flag = 0; } } if (flag == 1) { match = i; } } int tlen = strlen(t); printf("%d\n", match + tlen); return 0; }
main.c:2:10: fatal error: iostream: No such file or directory 2 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s038330246
p03951
C++
#define _CRT_SECURE_NO_WARNINGS 1 #include <iostream> #include <fstream> #include <string> #include <cmath> #include <cstdlib> #include <ctime> #include <vector> #include <algorithm> #include <numeric> #include <map> #include <set> #include <queue> #include <deque> #include <functional> int descending_compare(const void *a, const void *b) { if (*(int*)a > *(int*)b) { return -1; } else if (*(int*)a == *(int*)b) { return 0; } else { return 1; } } int ascending_compare(const void *a, const void *b) { if (*(int*)a < *(int*)b) { return -1; } else if (*(int*)a == *(int*)b) { return 0; } else { return 1; } } //greatest common divisor unsigned long gcd(unsigned long x, unsigned long y) { if (y == 0) { return x; } else if (x > y) { return gcd(y, x % y); } else { return gcd(x, y % x); } } long long factorial(int x) { long long rtn = 1; int i; for (i = x; i > 1; i--) { rtn = (rtn*i); } return rtn; } /* int struct_ascending_compare(const void *p, const void *q) { return ((struct_name*)p)->member_name - ((struct_name*)q)->member_name; }*/ int main(void) { int n; char s[105]; char t[105]; scanf("%d", &n); scanf("%s", s); scanf("%s", t); int len = strlen(s); int match = len; for (int i = 0; i < len; i++) { int flag = 1; for (int j = 0; j < len - i; j++) { if (s[i + j] != t[j]) { flag = 0; } } if (flag == 1) { match = i; } } int tlen = strlen(t); printf("%d\n", match + tlen); return 0; }
a.cc: In function 'int main()': a.cc:78:19: error: 'strlen' was not declared in this scope 78 | int len = strlen(s); | ^~~~~~ a.cc:16:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 15 | #include <functional> +++ |+#include <cstring> 16 |
s392134093
p03951
C++
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define each(itr,v) for(auto itr:v) #define pb(s) push_back(s) #define maxch(x,y) x=max(x,y) #define minch(x,y) x=min(x,y) #define mp(a,b) make_pair(a,b) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<<x<<endl #define maxch(x,y) x=max(x,y) #define minch(x,y) x=min(x,y) #define uni(x) x.erase(unique(all(x)),x.end()) template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;} template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;} #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) > (b) ? (b) : (a)) typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<P, int> PPI; #define INF INT_MAX/3 #define MAX_N 1000 ll n; string s,t; void solve(){ cin.tie(0); ios::sync_with_stdio(false); cin>>n>>s>>t; ll dp[200][200]; rep(j,s.size())rep(i,t.size()){ if(s[j]==t[i]) dp[i+1][j+1] = dp[i][j] + 1; else dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]); } // max(n,s.size()+t.size() - dp[s.size()][t.size()]) ll ans; if(n > s.size()+t.size() - dp[s.size()][t.size()]) ans = n; else ans = s.size()+t.size() - dp[s.size()][t.size()] cout<<ans<<endl; } int main(){ solve(); return 0; }
a.cc: In function 'void solve()': a.cc:43:56: error: expected ';' before 'cout' 43 | else ans = s.size()+t.size() - dp[s.size()][t.size()] | ^ | ; 44 | cout<<ans<<endl; | ~~~~
s929390457
p03951
Java
import java.util.Scanner; public class gMain { public static void main(String[] args) { final Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s1 = sc.next(); String s2 = sc.next(); int ans = 2*n; for(int i = n-1; i >= 0; i--) { if(s2.startsWith(s1.substring(i))) { ans -= (n-i); System.out.println(ans); return; } } } }
Main.java:3: error: class gMain is public, should be declared in a file named gMain.java public class gMain { ^ 1 error
s165542382
p03951
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; typedef long long ll; int main() { int n; cin >> n; string s, t; cin >> s >> t; string ans = s + t; for (int i = 1; i <= n; i++) if (s.substr(n - i, i) == t.substr(0, i))ans = s.substr(0, n - i) + t; cout << ans << endl; }#include<iostream> #include<algorithm> #include<string> using namespace std; typedef long long ll; int main() { int n; cin >> n; string s, t; cin >> s >> t; string ans = s + t; for (int i = 1; i <= n; i++) if (s.substr(n - i, i) == t.substr(0, i))ans = s.substr(0, n - i) + t; cout << ans << endl; }
a.cc:13:2: error: stray '#' in program 13 | }#include<iostream> | ^ a.cc:13:3: error: 'include' does not name a type 13 | }#include<iostream> | ^~~~~~~ a.cc:18:5: error: redefinition of 'int main()' 18 | int main() { | ^~~~ a.cc:6:5: note: 'int main()' previously defined here 6 | int main() { | ^~~~
s092167867
p03951
C++
#include <string> #include <iostream> #include <algorithm> using namespace std; int main() { unsigned N; string s, n; cin >> N; cin >> s; cin >> n; unsigned cur = 0; for( unsigned i = 0 ; i < s.length() ; i++) { if (s[i] == n[cur]) cur++; else cur = 0; } cout << std::max(s.length() + n.length() - cur, N); }
a.cc: In function 'int main()': a.cc:27:25: error: no matching function for call to 'max(std::__cxx11::basic_string<char>::size_type, unsigned int&)' 27 | cout << std::max(s.length() + n.length() - cur, N); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from a.cc:3: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:27:25: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int') 27 | cout << std::max(s.length() + n.length() - cur, N); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:5: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:27:25: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int' 27 | cout << std::max(s.length() + n.length() - cur, N); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s541044795
p03951
C++
#include <string> #include <iostream> #include <algorithm> using namespace std; int main() { unsigned N; string s, n; cin >> N; cin >> s; cin >> n; unsigned cur = 0; for( unsigned i = 0 ; i < s.length() ; i++) { if (s[i] == n[cur]) cur++; else cur = 0; } cout << std::max(s.length() + n.length() - cur, N); }
a.cc: In function 'int main()': a.cc:27:25: error: no matching function for call to 'max(std::__cxx11::basic_string<char>::size_type, unsigned int&)' 27 | cout << std::max(s.length() + n.length() - cur, N); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from a.cc:3: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:27:25: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int') 27 | cout << std::max(s.length() + n.length() - cur, N); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:5: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:27:25: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int' 27 | cout << std::max(s.length() + n.length() - cur, N); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s425914044
p03951
C++
// #include <string> #include <iostream> #include <algorithm> using namespace std; int main() { unsigned N; string s, n; cin >> N; cin >> s; cin >> n; int cur = 0; for( unsigned i = 0 ; i < s.length() ; i++) { if (s[i] == n[cur]) cur++; else cur = 0; } cout << max(s.length() + n.length() - cur, N); }
a.cc: In function 'int main()': a.cc:28:20: error: no matching function for call to 'max(std::__cxx11::basic_string<char>::size_type, unsigned int&)' 28 | cout << max(s.length() + n.length() - cur, N); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from a.cc:4: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:28:20: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int') 28 | cout << max(s.length() + n.length() - cur, N); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:6: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:28:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int' 28 | cout << max(s.length() + n.length() - cur, N); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s739683518
p03951
C++
#include<bits/stdc++.h> #include<debug.h> #define LL long long using namespace std; string pi(string x,string y) { int mx=0,c=0; string s=y+"#"+x; vector<int>pi(s.length()); for(int i=1,j=0;i<s.length();i++) { while(j&&s[i]!=s[j])j=pi[j-1]; if(s[i]==s[j])j++; pi[i]=j; if(j==(int)y.size())return x; } return x.substr(0,x.size()-pi.back())+y; } int main() { int n; string s,t; cin>>n>>s>>t; cout<<pi(s,t).size(); }
a.cc:2:9: fatal error: debug.h: No such file or directory 2 | #include<debug.h> | ^~~~~~~~~ compilation terminated.
s847415278
p03951
C++
#include<functional> #include<random> #include<unordered_set> using namespace std; typedef long long int llint; #define mp make_pair #define mt make_tuple #define pub push_back #define puf push_front #define pob pop_back #define pof pop_front #define fir first #define sec second #define res resize #define ins insert #define era erase const llint mod=1000000007; const llint big=1e17-10; const long double pai=3.141592653589793238462643383279; template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}} template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}} int main(void){ int i,j,n;cin>>n; string s,t;cin>>s>>t; string ans; for(i=0;i<=n;i++){ int ok=0; for(j=0;i+j<n;j++){if(s[i+j]!=t[j]){ok=1;break;}} if(ok==1){continue;} for(j=0;j<n;j++){cout<<s[j];} for(j=n-i;j<n;j++){cout<<t[j];} break; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:23:19: error: 'cin' was not declared in this scope 23 | int i,j,n;cin>>n; | ^~~ a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 3 | #include<unordered_set> +++ |+#include <iostream> 4 | using namespace std; a.cc:30:34: error: 'cout' was not declared in this scope 30 | for(j=0;j<n;j++){cout<<s[j];} | ^~~~ a.cc:30:34: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:31:36: error: 'cout' was not declared in this scope 31 | for(j=n-i;j<n;j++){cout<<t[j];} | ^~~~ a.cc:31:36: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:34:9: error: 'cout' was not declared in this scope 34 | cout<<endl; | ^~~~ a.cc:34:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:34:15: error: 'endl' was not declared in this scope 34 | cout<<endl; | ^~~~ a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 3 | #include<unordered_set> +++ |+#include <ostream> 4 | using namespace std;
s174421839
p03951
C++
#include <bits/stdc++.h> using namespace std; int main(void) { int n, x, ans; string s,t; cin >> n >> x; cin >> s >> t; for(int i = 1; i <= n; i++) { for(int j = 0; j < i) { if(a[n - i + j] != b[j]) break; } else { ans = n*2 - i; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:25: error: expected ';' before ')' token 14 | for(int j = 0; j < i) | ^ | ; a.cc:16:8: error: 'a' was not declared in this scope 16 | if(a[n - i + j] != b[j]) break; | ^ a.cc:16:24: error: 'b' was not declared in this scope 16 | if(a[n - i + j] != b[j]) break; | ^ a.cc:18:5: error: 'else' without a previous 'if' 18 | else | ^~~~
s451758953
p03951
C++
#include <bits/stdc++.h> using namespace int main(void) { int n, x, ans; string s,t; cin >> n >> x; cin >> s >> t; for(int i = 1; i <= n; i++) { for(int j = 0; j < i) { if(a[n - i + j] != b[j]) break; } else { ans = n*2 - i; } } cout << ans << endl; return 0; }
a.cc:4:1: error: expected identifier before 'int' 4 | int main(void) | ^~~ a.cc:2:16: error: expected ';' before 'int' 2 | using namespace | ^ | ; 3 | 4 | int main(void) | ~~~ a.cc: In function 'int main()': a.cc:7:1: error: 'string' was not declared in this scope 7 | string s,t; | ^~~~~~ a.cc:7:1: note: suggested alternatives: In file included from /usr/include/c++/14/string:41, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string' 77 | typedef basic_string<char> string; | ^~~~~~ /usr/include/c++/14/string:76:11: note: 'std::pmr::string' 76 | using string = basic_string<char>; | ^~~~~~ a.cc:9:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 9 | cin >> n >> x; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:10:8: error: 's' was not declared in this scope 10 | cin >> s >> t; | ^ a.cc:10:13: error: 't' was not declared in this scope 10 | cin >> s >> t; | ^ a.cc:14:21: error: expected ';' before ')' token 14 | for(int j = 0; j < i) | ^ | ; a.cc:16:4: error: 'a' was not declared in this scope 16 | if(a[n - i + j] != b[j]) break; | ^ a.cc:16:20: error: 'b' was not declared in this scope 16 | if(a[n - i + j] != b[j]) break; | ^ a.cc:18:1: error: 'else' without a previous 'if' 18 | else | ^~~~ a.cc:23:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 23 | cout << ans << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:23:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 23 | cout << ans << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s483517206
p03951
C++
n = int(raw_input()) s = raw_input() t = raw_input() for i in range(n): if s[i:] == t[:n-i]: print n+i break else: print 2*n
a.cc:1:1: error: 'n' does not name a type 1 | n = int(raw_input()) | ^
s544155232
p03951
C++
N = int(input()) s = input() l = input() for i in range(1,N): print(s[-i:]) if s[-i:]!=l[:i]: a=2*N-i+1 break print(a)
a.cc:1:1: error: 'N' does not name a type 1 | N = int(input()) | ^
s299885007
p03951
C++
#include <iostream> #include <string> using namespace std; int main() { string s,st; int n; cin >> n >> s >> st; reverse(s.begin(),s.end()); for (int i=0;i<n;i++) if (s[i]!=st[i]) { cout << 2*n-i << endl; return 0; } cout << n; return 0; }
a.cc: In function 'int main()': a.cc:11:1: error: 'reverse' was not declared in this scope 11 | reverse(s.begin(),s.end()); | ^~~~~~~
s837438232
p03951
C++
n,s,t=`dd`.split;puts s+t[(n.downto(0).find{|i|s[-i..-1]==t[0,i]}..-1]
a.cc:1:7: error: stray '`' in program 1 | n,s,t=`dd`.split;puts s+t[(n.downto(0).find{|i|s[-i..-1]==t[0,i]}..-1] | ^ a.cc:1:10: error: stray '`' in program 1 | n,s,t=`dd`.split;puts s+t[(n.downto(0).find{|i|s[-i..-1]==t[0,i]}..-1] | ^ a.cc:1:1: error: 'n' does not name a type 1 | n,s,t=`dd`.split;puts s+t[(n.downto(0).find{|i|s[-i..-1]==t[0,i]}..-1] | ^ a.cc:1:18: error: 'puts' does not name a type 1 | n,s,t=`dd`.split;puts s+t[(n.downto(0).find{|i|s[-i..-1]==t[0,i]}..-1] | ^~~~ a.cc:1:66: error: expected unqualified-id before '.' token 1 | n,s,t=`dd`.split;puts s+t[(n.downto(0).find{|i|s[-i..-1]==t[0,i]}..-1] | ^
s057911079
p03951
Java
import java.util.Scanner; public class aPrefixAndSuffix { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // 整数の入力 int N = sc.nextInt(); String s = sc.next(); String t = sc.next(); // 文字列の比較 int res = 0; int i = 0; if(s.equals(t)) res = N; else { for(i=1; i<=N; i++) { if(s.substring(i).equals(t.substring(0, N-i))) break; } res = N + i; } // 出力 System.out.println(res); sc.close(); } }
Main.java:3: error: class aPrefixAndSuffix is public, should be declared in a file named aPrefixAndSuffix.java public class aPrefixAndSuffix { ^ 1 error
s254414527
p03951
C++
#include<iostream.h> #include<string.h> using namespace std; int main() { int n; char s[200],t[200],c[200]; cin>>n; cin>>s; cin>>t; int i,j=0,k=0; for(i=0;i<n;i++) { c[j]=s[i]; j++; if(s[i]==t[k]) k++; } for(;k<n;k++) { c[i++]=t[k]; } c[i]='\0'; cout<<strlen(c); }
a.cc:1:9: fatal error: iostream.h: No such file or directory 1 | #include<iostream.h> | ^~~~~~~~~~~~ compilation terminated.
s229886763
p03951
C++
#include <algorithm> #define TRY(n) try{n}catch(...){} #define rep(i,n) for(int i=0;i<(n);i++) #define all(n) n.begin(),n.end() using namespace std; int main(){ int n;string s,t;cin>>n>>s>>t; string o = ""; bool f = false; bool l = false; if(s == t){cout << n << endl;return 0;} vector<int> g; rep(i,n){ if(s[i] == t[0]){ for(int j=i;j<n;j++){ if(s[j] != t[(n-1)-j]){f = !f;break;} } if(f){ rep(k,n){ if(k == i)break; o+=s[k]; } rep(k,n)o+=t[k]; g.push_back(o.size()); l = true; f = !f; } else f = !f; } } if(l){ sort(all(g)); cout << g[0] << endl; }else{cout << s.size() + t.size() << endl;} }
a.cc: In function 'int main()': a.cc:8:11: error: 'string' was not declared in this scope 8 | int n;string s,t;cin>>n>>s>>t; | ^~~~~~ a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' 1 | #include <algorithm> +++ |+#include <string> 2 | #define TRY(n) try{n}catch(...){} a.cc:8:22: error: 'cin' was not declared in this scope 8 | int n;string s,t;cin>>n>>s>>t; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include <algorithm> +++ |+#include <iostream> 2 | #define TRY(n) try{n}catch(...){} a.cc:8:30: error: 's' was not declared in this scope 8 | int n;string s,t;cin>>n>>s>>t; | ^ a.cc:8:33: error: 't' was not declared in this scope 8 | int n;string s,t;cin>>n>>s>>t; | ^ a.cc:9:11: error: expected ';' before 'o' 9 | string o = ""; | ^~ | ; a.cc:12:16: error: 'cout' was not declared in this scope 12 | if(s == t){cout << n << endl;return 0;} | ^~~~ a.cc:12:16: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:12:29: error: 'endl' was not declared in this scope 12 | if(s == t){cout << n << endl;return 0;} | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include <algorithm> +++ |+#include <ostream> 2 | #define TRY(n) try{n}catch(...){} a.cc:13:5: error: 'vector' was not declared in this scope 13 | vector<int> g; | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include <algorithm> +++ |+#include <vector> 2 | #define TRY(n) try{n}catch(...){} a.cc:13:12: error: expected primary-expression before 'int' 13 | vector<int> g; | ^~~ a.cc:22:21: error: 'o' was not declared in this scope 22 | o+=s[k]; | ^ a.cc:24:25: error: 'o' was not declared in this scope 24 | rep(k,n)o+=t[k]; | ^ a.cc:25:17: error: 'g' was not declared in this scope 25 | g.push_back(o.size()); | ^ a.cc:25:29: error: 'o' was not declared in this scope 25 | g.push_back(o.size()); | ^ a.cc:33:18: error: 'g' was not declared in this scope 33 | sort(all(g)); | ^ a.cc:4:16: note: in definition of macro 'all' 4 | #define all(n) n.begin(),n.end() | ^ a.cc:34:9: error: 'cout' was not declared in this scope 34 | cout << g[0] << endl; | ^~~~ a.cc:34:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:34:25: error: 'endl' was not declared in this scope 34 | cout << g[0] << endl; | ^~~~ a.cc:34:25: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' a.cc:35:11: error: 'cout' was not declared in this scope 35 | }else{cout << s.size() + t.size() << endl;} | ^~~~ a.cc:35:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:35:42: error: 'endl' was not declared in this scope 35 | }else{cout << s.size() + t.size() << endl;} | ^~~~ a.cc:35:42: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s371933403
p03951
C++
#include <iostream> #include <conio.h> #include <string> using namespace std; string f(string x, string y){ int m = x.length(), n=y.length(); int dp[m][n]; for(int j=0; j<=n; j++) dp[0][j] = 0; for(int i=0; i<=m; i++) dp[i][0] = 0; for(int i=1; i<=m; i++){ for(int j=1; j<=n; j++){ if(x[i-1] == y[j-1]) dp[i][j] = dp[i-1][j-1] + 1; else dp[i][j] = 0; } } string ans = ""; for(int i=1; i<=m; i++){ for(int j=1; j<=n; j++){ if(dp[i][j] > ans.length()) ans = x.substr((i-dp[i][j]+1) -1, dp[i][j]); } } return ans; } int main() { int n; string s, t; cin >> n >> s >> t; string temp = s + t; cout << temp.length() - f(s, t).length() << endl; return 0; }
a.cc:2:10: fatal error: conio.h: No such file or directory 2 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s581526517
p03951
C++
N = int(input()) k = input() s = input() offset = 0 while k[offset:]!=s[:N-offset]: offset+=1 print(k[:offset]+s)
a.cc:1:1: error: 'N' does not name a type 1 | N = int(input()) | ^
s002643648
p03951
C++
n=int(input()) s=input() t=input() for i in range(n): if s[i:] == t[:n-i]: print(n+i) exit(1) else: print(n*2)
a.cc:1:1: error: 'n' does not name a type 1 | n=int(input()) | ^
s571118282
p03951
C++
#include <stdio.h> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <string.h> #include <fstream> #include <cassert> #include <unordered_map> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> //#include <sys/resource.h> using namespace std; using namespace __gnu_pbds; #ifdef loc template<class T, class U> ostream &operator<< (ostream &out, const pair<T, U> &a) { out << "[" << a.first << " " << a.second << "]"; return out; } template<class T> ostream &operator<<(ostream &out, const vector<T> &a) { out << "[ "; for(auto &it : a) { out << it << " "; } out << "]"; return out; } template<class T> ostream &operator<<(ostream &out, const set<T> &a) { out << "[ "; for(auto &it : a) { out << it << " "; } out << "]"; return out; } template<class T> ostream &operator<<(ostream &out, const multiset<T> &a) { out << "[ "; for(auto &it : a) { out << it << " "; } out << "]"; return out; } template<class T, class U> ostream &operator<<(ostream &out, const map<T, U> &a) { for(auto &it : a) { out << it.first << " -> " << it.second << " | "; } return out; } template<class T, class U> ostream &operator<<(ostream &out, const multimap<T, U> &a) { for(auto &it : a) { out << it.first << " -> " << it.second << " | "; } return out; } #define pra(a, n) cerr << #a << " : "; for(int i = 0; i <= n; ++i) cerr << a[i] << " "; cerr << endl; #define praa(a, n, m) cerr << #a << " : " << endl; for(int i = 0; i <= n; ++i) { for(int j = 0; j <= m; ++j) cerr << a[i][j] << " "; cerr << endl; } #define pr(...) __f(#__VA_ARGS__, __VA_ARGS__) #define prl() cerr << __LINE__ << ": " << __PRETTY_FUNCTION__ << endl; template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char *names, Arg1 &&arg1, Args &&... args) { const char *comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...); } #define gc getchar #else #define pr(...) #define pra(a, n) #define praa(a, n, m) #define prl() #define gc getchar #define endl '\n' #endif typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; typedef long long ll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef pair<int, int> pii; typedef vector<pair<int, int>> vpii; typedef vector<vector<pair<int, int>>> vvpii; typedef vector<ll> vl; typedef vector<vector<ll>>vvl; typedef pair<ll, ll> pll; typedef vector<pair<ll, ll>> vpll; typedef vector<vector<pair<ll, ll>>> vvpll; template<typename T, typename U> static void amin( T &x, U y) { if(y < x) { x = y; } } template<typename T, typename U> static void amax( T &x, U y) { if(x < y) { x = y; } } #define inc_stack_limit const rlim_t kStackSize = 64 * 1024 * 1024; struct rlimit rl; rl.rlim_cur = kStackSize; setrlimit(RLIMIT_STACK, &rl); #define sz(a) int((a).size()) #define all(a) (a).begin(),(a).end() #define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define pb push_back #define eb emplace_back #define mp make_pair #define F first #define S second #define rep(i, s, n) for(int i = s; i <= (n); ++i) #define rev(i, n, s) for(int i = (n); i >= s; --i) #define fore(x, a) for(auto &&x : a) #define fill(a, x) memset((a), (x), sizeof(a)) const double eps = 1e-6; #define tcase int __T; cin >> __T; rep(Tc, 1, __T) #define ass(n, l, r) assert(n >= l and n <= r) #define mod 1000000007 #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) typedef long long llint; inline int add(int a, int b, int m = mod) { a += b; if(a >= m) { a -= m; } if(a < 0) { a += m; } return a; } inline int mul(int a, int b, int m = mod) { int ret = (int)(((ll)a * (ll)b) % m); if(ret < 0) { ret += m; } return ret; } ll po(ll a, ll b, ll m = mod) { ll res = 1; a %= m; //assert(b >= 0); for(; b; b >>= 1) { if(b & 1) { res = (res * a) % m; } a = (a * a) % m; } return res; } inline int ri() { int c = gc(); int ret = 0; while(c < '0' || c > '9') { c = gc(); } while(c >= '0' && c <= '9') { ret = 10 * ret + c - 48; c = gc(); } return ret; } #define N 100005 int main() { boost; int n; cin >> n; string s, r; cin >> s >> r; for(int i=0; i<=n; i++) { if(s.substr(i)==t.substr(0,n-i)) { cout<<n+i<<endl; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:236:21: error: 't' was not declared in this scope 236 | if(s.substr(i)==t.substr(0,n-i)) { | ^
s916337211
p03951
C++
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char a[101], b[101]; int n, i, j, cnt=0; scanf("%d\n", &n); gets(a); gets(b); for(i=n-1, j=0;i>=0 && j<n;i--, j++) { if(a[i]!=b[j]) break; else cnt++; } //printf("i:%d, j:%d\n", i, j); cnt+=i+1; cnt+=n-j; printf("%d", cnt); return 0; }
a.cc: In function 'int main()': a.cc:8:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | gets(a); | ^~~~ | getw
s602494010
p03951
Java
import java.util.Scanner; /** * Created by whiled on 16/10/29. */ public class A { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); String t = sc.next(); int count = n; for (int i = 0; i < n; i++){ String tmp = t.substring(0,count); if (s.endsWith(tmp)){ break; }else { count--; } } System.out.println(s.length() + t.length() - count); } }
Main.java:6: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s552578481
p03951
C++
#include <stdio.h> #include <stdlib.h> int main() { char a[101], b[101]; int n, i, j, cnt=0; scanf("%d\n", &n); gets(a); gets(b); for(i=n-1, j=0;i>=0 && j<n;i--, j++) { if(a[i]!=b[j]) break; else cnt++; } //printf("i:%d, j:%d\n", i, j); cnt+=i+1; cnt+=n-j; printf("%d", cnt); return 0; }
a.cc: In function 'int main()': a.cc:7:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(a); | ^~~~ | getw
s548495807
p03951
C++
#include <stdio.h> int main() { char a[101], b[101]; int n, i, j, cnt=0; scanf("%d\n", &n); gets(a); gets(b); for(i=n-1, j=0;i>=0 && j<n;i--, j++) { if(a[i]!=b[j]) break; else cnt++; } //printf("i:%d, j:%d\n", i, j); cnt+=i+1; cnt+=n-j; printf("%d", cnt); return 0; }
a.cc: In function 'int main()': a.cc:7:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(a); | ^~~~ | getw
s914419603
p03951
C++
#include<stdio.h> #include<string.h> int main(){ int N, i, x, ans; char s[101],t[101]; scanf("%d %s %s",&N,s,t); ans = N*2; for(i=0; i<N; i++){ if( s[i] == s[N-i] ){ ans = ans - 1; } } printf("%d",ans) }
a.cc: In function 'int main()': a.cc:16:21: error: expected ';' before '}' token 16 | printf("%d",ans) | ^ | ; 17 | 18 | } | ~
s142554377
p03951
C++
#define rep(i,s,t) for(int i = s; i <= t; ++ i) #define fi first #define se second const int MaxN = 100050; int N, ans, s = 1; char A[MaxN], B[MaxN]; bool ok = false; int main() { scanf("%d",&N); scanf("%s",A+1); scanf("%s",B+1); ans = N; rep(i,1,N) { ok = false; rep(j,1,N) if(B[j] != A[i+j-1] && i + j - 1 <= N) { ok = true; break; } if(!ok) break; ans ++; } printf("%d",ans); return 0; }
a.cc: In function 'int main()': a.cc:13:5: error: 'scanf' was not declared in this scope 13 | scanf("%d",&N); | ^~~~~ a.cc:29:9: error: 'printf' was not declared in this scope 29 | printf("%d",ans); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 |
s340072984
p03951
C++
#include <bits/stdc++.h> #define rep(i, a, n) for(int i = a; i < n; i++) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl // #define int long long #define first first #define second se using namespace std; typedef pair<int, int> P; typedef vector<int> vi; signed main(){ int n; string s, t; cin >> n >> s >> t; int l = min(s.size(), t.size()); int c = 0; rep(i, 0, l + 1){ bool f = true; rep(j, 0, i){ if(t[j] != s[s.size() - i + j]){ f = false; } } if(f) c = max(c, i); } int ans = max(n, s.size() + t.size() - c); o(ans); }
a.cc: In function 'int main()': a.cc:28:18: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)' 28 | int ans = max(n, s.size() + t.size() - c); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:28:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 28 | int ans = max(n, s.size() + t.size() - c); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:28:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 28 | int ans = max(n, s.size() + t.size() - c); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
s651656704
p03951
C++
#include <bits/stdc++.h> #define rep(i, a, n) for(int i = a; i < n; i++) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl #define int long long #define first first #define second se using namespace std; typedef pair<int, int> P; typedef vector<int> vi; signed main(){ int n; string s, t; cin >> n >> s >> t; int l = min(s.size(), t.size()); int c = 0; rep(i, 0, l + 1){ bool f = true; rep(j, 0, i){ if(t[j] != s[s.size() - i + j]){ f = false; } } if(f) c = max(c, i); } int ans = max(n, s.size() + t.size() - c); o(ans); }
a.cc: In function 'int main()': a.cc:28:18: error: no matching function for call to 'max(long long int&, long long unsigned int)' 28 | int ans = max(n, s.size() + t.size() - c); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:28:18: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int') 28 | int ans = max(n, s.size() + t.size() - c); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:28:18: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 28 | int ans = max(n, s.size() + t.size() - c); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
s194313630
p03951
C++
#include <cstdio> #include <iostream> using namespace std; #define PrintLn(X) cout << X << endl #define Loop(n) for(int loop_ = n; loop_; --loop_) #define Rep(i, n) for(int i = 0; i < (int)(n); ++i) #define For(i, a, b) for(int i = a; i < (int)(b); ++i) int main(void) { int N; char s[101]; char t[101]; cin >> N >> s >> t; Rep(i, N + 1){ char st[201] = ""; strncpy(st, s, i); strcat(st, t); if(strncmp(st, s, N) == 0){ PrintLn(i + N); return 0; } } }
a.cc: In function 'int main()': a.cc:18:17: error: 'strncpy' was not declared in this scope 18 | strncpy(st, s, i); | ^~~~~~~ a.cc:3:1: note: 'strncpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <iostream> +++ |+#include <cstring> 3 | using namespace std; a.cc:19:17: error: 'strcat' was not declared in this scope 19 | strcat(st, t); | ^~~~~~ a.cc:19:17: note: 'strcat' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:20:20: error: 'strncmp' was not declared in this scope 20 | if(strncmp(st, s, N) == 0){ | ^~~~~~~ a.cc:20:20: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s457664836
p03951
C++
n = gets.to_i s = gets.chomp t = gets.chomp n.times do |i| if t.index(s[i...n]) == 0 puts n + i exit end end puts n * 2
a.cc:1:1: error: 'n' does not name a type 1 | n = gets.to_i | ^
s972545966
p03951
C++
#include <iterator> #include <array> #include <functional> #include <vector> #include <map> #include <cstdio> template<typename T> struct ScanfSpecifier{}; #define DEF(T,V) template<> struct ScanfSpecifier<T>{static constexpr const char* value = V;}; DEF(char*,"%s")DEF(int,"%d")DEF(double,"%lf")DEF(float,"%f")DEF(char,"%c")DEF(const char*,"%s")DEF(unsigned long,"%lu")DEF(unsigned int, "%u") #ifdef _MSC_VER DEF(long long int,"%I64d") #else DEF(long long int,"%lld") #endif #undef DEF template<typename T> int RD(T& arg){return std::scanf(ScanfSpecifier<T>::value, &arg);} template<int S> int RD(char (&arg)[S]){return std::scanf("%s", arg);} int RD(char* arg){return std::scanf("%s", arg);} template<> int RD<char>(char& arg){return std::scanf(" %c", &arg);} template<typename T, typename... Args> int RD(T& arg1, Args&... args) {return RD(arg1) + RD(args...);} template<typename T> T RD(){T ret; RD(ret); return ret;} template<typename It> void RDV(It begin, It end) { while(begin != end) RD(*begin++); } template<typename C> void RDV(C& c) {RDV(std::begin(c), std::end(c));} template<typename... Args> void WT(Args... args) { int alc = 0; int dummy[] = {((alc++? std::printf(" "): 0), std::printf(ScanfSpecifier<Args>::value, args), 0)...}; } template<typename... Args> void WTL(Args... args) { WT(args...); std::printf("\n"); } template<typename It> void WTV(It begin, It end) { int alc = 0; while(begin != end) (alc++? std::printf(" "): 0), WT(*begin++); } template<typename C> void WTV(const C& c) {WTV(std::begin(c), std::end(c));} template<typename It> void WTVL(It begin, It end) { WTV(begin, end); std::printf("\n"); } template<typename C> void WTVL(const C& c) {WTVL(std::begin(c), std::end(c));} namespace XX { template<template<typename> class Compare, typename T> inline T& UP(T& x, const T& y){if(Compare<T>()(y, x)) x = y; return x;} template<typename Compare, typename T> inline T& UP(T& x, const T& y, Compare comp){if(comp(y, x)) x = y; return x;} template<typename T> inline T& GT(T& x, const T& y){return UP<std::greater>(x, y);} template<typename T> inline T& LS(T& x, const T& y){return UP<std::less>(x, y);} template<typename T> struct Mapper { int operator[](const T& v) { int& ret = table[v]; if(!ret) rtable[ret = table.size()] = v; return ret - 1; } template<typename... Args> int operator()(Args... args) { return (*this)[T(args...)]; } T rev(int idx){return rtable[idx + 1];} std::map<T, int> table; std::map<int, T> rtable; }; template<typename T, int S> struct ReferenceArray { struct It {typename std::array<T*, S>::iterator it; T& operator*(){return **it;} void operator++(){it++;} bool operator!=(const It& other){return it != other.it;} }; int size()const{return _ptr.size();} It begin()const{return {_ptr.begin()};} It end()const{return {_ptr.end()};} T& operator[](int idx)const{return *_ptr[idx];} mutable std::array<T*, S> _ptr; }; template<typename T, typename... Args> ReferenceArray<T, sizeof...(Args) + 1> MAKEV(T& arg1, Args&... args) {return {&arg1, &args...};} struct Range { struct It { int num, step; int operator*(){return num;} void operator++(){num += step;} bool operator!=(const It& other){return num != other.num;} }; Range(int ee):b(0),e(ee){} Range(int bb, int ee):b(bb), e(ee){} It begin(){return {b, (b < e? 1: -1)};} It end(){return {e, 0};} int b, e; }; } //alias //RD[L],RDV[L],WT[L],WTV[L] for i/o template<typename T> T& UMAX(T& x, T y){return XX::UP<std::greater>(x, y);} template<typename T> T& UMIN(T& x, T y){return XX::UP<std::less>(x, y);} using XX::UP; //(x,y) comp using RG = XX::Range; using XX::MAKEV; using XX::Mapper; //template #include <vector> #include <string> #include <set> #include <map> #include <cstdlib> #include <algorithm> #include <functional> using namespace std; char s[128]; char t[128]; int main() { int N; RD(N, s, t); char ans[256]; int out = 2 * N; for(int i = 0; i <= N; i++) { int l = 2 * N - i; strcpy(ans, s); strcat(ans, t + i); if(!strncmp(ans, s, N) && !strncmp(ans + l - N, t, N)) UMIN(out, l); } WTL(out); }
a.cc: In function 'int main()': a.cc:114:9: error: 'strcpy' was not declared in this scope 114 | strcpy(ans, s); | ^~~~~~ a.cc:97:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 96 | #include <algorithm> +++ |+#include <cstring> 97 | #include <functional> a.cc:115:9: error: 'strcat' was not declared in this scope 115 | strcat(ans, t + i); | ^~~~~~ a.cc:115:9: note: 'strcat' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:116:13: error: 'strncmp' was not declared in this scope 116 | if(!strncmp(ans, s, N) && !strncmp(ans + l - N, t, N)) | ^~~~~~~ a.cc:116:13: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s741120251
p03952
C++
// #define _GLIBCXX_DEBUG #define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using puu = pair<uint, uint>; using vu = vector<uint>; using vvu = vector<vu>; using pll = pair<ll, ll>; using vl = vector<ll>; using vvl = vector<vl>; // using pulul = pair<ull, ull>; using vul = vector<ull>; using vvul = vectro<vul>; using vb = vector<bool>; using vvb = vector<vb>; #define rep0(TMS) for (int CNT = 0; CNT < (int)(TMS); CNT++) #define rep(CNT, GOAL) for (int CNT = 0; CNT < (int)(GOAL); CNT++) #define rep2(CNT, START, GOAL) for (int CNT = (int)(START); CNT < (int)(GOAL); CNT++) #define rep3(CNT, START, GOAL) for (int CNT = (int)(START); CNT > (int)(GOAL); CNT--) #define all(CONT) begin(CONT), end(CONT) template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } void prec(const int &DIG) { cout << fixed << setprecision(DIG); cerr << fixed << setprecision(DIG); } template <typename T> void CERR(const T &ELEM) { cerr << ELEM; } #define dbl(OBJ) cerr << #OBJ << ": "; CERR(OBJ); cerr << "\n" template <typename T, typename ...Ts> void CERR(const T &FIRST, const Ts &...REST) { CERR(FIRST); cerr << ", "; CERR(REST...); } #define dbs(...) cerr << "(" << #__VA_ARGS__ << "): ("; CERR(__VA_ARGS__); cerr << ")\n" #define itrep(ITR, CONT) for (auto ITR = begin(CONT); ITR != end(CONT); ITR++) template <typename T> void CERR(const vector<T> &VEC) { cerr << "{ "; itrep(ITR, VEC) { CERR(*ITR); cerr << ", "; } cerr << "}"; } #define YN(FLG) cout << (FLG ? "YES" : "NO") << "\n" #define Yn(FLG) cout << (FLG ? "Yes" : "No") << "\n" #define yn(FLG) cout << (FLG ? "yes" : "no") << "\n" #include <atcoder/all> using namespace atcoder; // const ll INF = LONG_LONG_MAX; const int INF = INT_MAX; // const ll MOD = 1000000007; // 998244353; int main() { int N, x; cin >> N >> x; if (x == 1 or x == 2 * N - 1) { cout << "No" << endl; return 0; } else cout << "Yes" << endl; vi v(2 * N - 1); rep(i, 2 * N - 1) v[i] = i + 1; // 中央の3要素v[N-2],v[N-1],v[N]を1,x,2N-1とする。 // それ以外の要素(2~x-1,x+1~2N-2)は,左グループの要素 < 右グループの要素 となるように並べる。 // { 1, 2,.., N-2; N-1, N, N+1; N+2,.., 2N-2, 2N-1 } を // { 1, 2,..,x-1, N, x+1,..; N-1, x, N+1; N+2,.., 2N-1 } とし, // { N-1, 2,..,x-1, N, x+1,..; 1, x, 2N-1; N+2,.., N+1 } とする。 // dbl(v); swap(v[x - 1], v[N - 1]); // dbl(v); swap(v[0], v[N - 2]); // dbl(v); swap(v[N], v[2 * N - 2]); // dbl(v); rep(i, 2 * N - 1) cout << v[i] << endl; }
a.cc:27:10: fatal error: atcoder/all: No such file or directory 27 | #include <atcoder/all> | ^~~~~~~~~~~~~ compilation terminated.
s354524223
p03952
C++
#include <bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> using namespace std; using dou =long double; string yes="yes"; string Yes="Yes"; string YES="YES"; string no="no"; string No="No"; string NO="NO"; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } typedef long long ll; typedef pair<int,int> P; typedef pair<ll,ll> PL; const ll mod = 1000000007ll; //const ll mod = 10007; struct mint { ll x; // typedef long long ll; mint(ll x=0):x((x%mod+mod)%mod){} mint operator-() const { return mint(-x);} mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;} mint operator+(const mint a) const { return mint(*this) += a;} mint operator-(const mint a) const { return mint(*this) -= a;} mint operator*(const mint a) const { return mint(*this) *= a;} mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod-2);} mint& operator/=(const mint a) { return *this *= a.inv();} mint operator/(const mint a) const { return mint(*this) /= a;} }; istream& operator>>(istream& is, const mint& a) { return is >> a.x;} ostream& operator<<(ostream& os, const mint& a) { return os << a.x;} #define rep(i, n) for(ll i = 0; i < (ll)(n); i++) #define brep(n) for(int bit=0;bit<(1<<n);bit++) #define bbrep(n) for(int bbit=0;bbit<(1<<n);bbit++) #define erep(i,container) for (auto &i : container) #define itrep(i,container) for (auto i : container) #define irep(i, n) for(ll i = n-1; i >= (ll)0ll; i--) #define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++) #define reprep(i,j,h,w) rep(i,h)rep(j,w) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i]; #define pb push_back #define pf push_front #define query int qq;std::cin >> qq;rep(qqq,qq) #define lb lower_bound #define ub upper_bound #define fi first #define se second #define itn int #define mp make_pair #define sum(a) accumulate(all(a),0ll) #define keta fixed<<setprecision #define vout(a) erep(qxqxqx,a)std::cout << qxqxqx << ' ';std::cout << std::endl; #define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a)) //#define vvector(name,typ,m,n)vector<vector<typ> > name(m,vector<typ> (n)) #define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a))); #define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) )); #define case std::cout <<"Case #" <<qqq+1<<":" #define res resize #define as assign #define ffor for(;;) #define ppri(a,b) std::cout << a<<" "<<b << std::endl #define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl #define aall(x,n) (x).begin(),(x).begin()+(n) #define ssum(a) accumulate(a,0ll) #define stirng string #define gin(a,b) int a,b;std::cin >> a>>b;a--;b--; //#define grid_input(a,type) int h,w;std::cin >> h>>w;vvector(a,type,h,w,0);reprep(i,j,h,w)std::cin >> a[i][j]; //typedef long long T; ll ceil(ll a,ll b){ return ((a+b-1)/b); } const int INF = 2000000000; //const ll INF64 =3223372036854775807ll; //const ll INF64 = 9223372036854775807ll; const ll INF64 = 9223372036854775ll; const ll MOD = 1000000007ll; //const ll MOD = 1000003ll; const ll OD = 1000000000000007ll; const dou pi=3.141592653589793; long long modpow(long long a, long long n) { //累乗の余剰 long long res = 1; while (n > 0) { if (n & 1) res = res * a % MOD;a a = a * a % MOD; n >>= 1; } return res; } //メモ //tuple<hoge,huga,foo> tのget関数はget<i>(t) //resizeはメンバ関数 //三項演算子を覚えよう // a?b:cと書くと aならばbの処理をする int main(){ int n,x; std::cin >> n>>x; if(n==x){ std::cout << Yes << std::endl; rep(i,2*n-1)std::cout << i+1 << std::endl; } else{ std::cout << No << std::endl; } }
a.cc: In function 'long long int modpow(long long int, long long int)': a.cc:110:41: error: expected ';' before 'a' 110 | if (n & 1) res = res * a % MOD;a | ^ | ; 111 | a = a * a % MOD; | ~
s160210865
p03952
C++
#include <bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> using namespace std; using dou =long double; string yes="yes"; string Yes="Yes"; string YES="YES"; string no="no"; string No="No"; string NO="NO"; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } typedef long long ll; typedef pair<int,int> P; typedef pair<ll,ll> PL; const ll mod = 1000000007ll; //const ll mod = 10007; struct mint { ll x; // typedef long long ll; mint(ll x=0):x((x%mod+mod)%mod){} mint operator-() const { return mint(-x);} mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;} mint operator+(const mint a) const { return mint(*this) += a;} mint operator-(const mint a) const { return mint(*this) -= a;} mint operator*(const mint a) const { return mint(*this) *= a;} mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod-2);} mint& operator/=(const mint a) { return *this *= a.inv();} mint operator/(const mint a) const { return mint(*this) /= a;} }; istream& operator>>(istream& is, const mint& a) { return is >> a.x;} ostream& operator<<(ostream& os, const mint& a) { return os << a.x;} #define rep(i, n) for(ll i = 0; i < (ll)(n); i++) #define brep(n) for(int bit=0;bit<(1<<n);bit++) #define bbrep(n) for(int bbit=0;bbit<(1<<n);bbit++) #define erep(i,container) for (auto &i : container) #define itrep(i,container) for (auto i : container) #define irep(i, n) for(ll i = n-1; i >= (ll)0ll; i--) #define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++) #define reprep(i,j,h,w) rep(i,h)rep(j,w) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i]; #define pb push_back #define pf push_front #define query int qq;std::cin >> qq;rep(qqq,qq) #define lb lower_bound #define ub upper_bound #define fi first #define se second #define itn int #define mp make_pair #define sum(a) accumulate(all(a),0ll) #define keta fixed<<setprecision #define vout(a) erep(qxqxqx,a)std::cout << qxqxqx << ' ';std::cout << std::endl; #define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a)) //#define vvector(name,typ,m,n)vector<vector<typ> > name(m,vector<typ> (n)) #define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a))); #define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) )); #define case std::cout <<"Case #" <<qqq+1<<":" #define res resize #define as assign #define ffor for(;;) #define ppri(a,b) std::cout << a<<" "<<b << std::endl #define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl #define aall(x,n) (x).begin(),(x).begin()+(n) #define ssum(a) accumulate(a,0ll) #define stirng string #define gin(a,b) int a,b;std::cin >> a>>b;a--;b--; //#define grid_input(a,type) int h,w;std::cin >> h>>w;vvector(a,type,h,w,0);reprep(i,j,h,w)std::cin >> a[i][j]; //typedef long long T; ll ceil(ll a,ll b){ return ((a+b-1)/b); } const int INF = 2000000000; //const ll INF64 =3223372036854775807ll; //const ll INF64 = 9223372036854775807ll; const ll INF64 = 9223372036854775ll; const ll MOD = 1000000007ll; //const ll MOD = 1000003ll; const ll OD = 1000000000000007ll; const dou pi=3.141592653589793; long long modpow(long long a, long long n) { //累乗の余剰 long long res = 1; while (n > 0) { if (n & 1) res = res * a % MOD;a a = a * a % MOD; n >>= 1; } return res; } //メモ //tuple<hoge,huga,foo> tのget関数はget<i>(t) //resizeはメンバ関数 //三項演算子を覚えよう // a?b:cと書くと aならばbの処理をする int main(){ int n,x; std::cin >> n>>x; if(n==x){ std::cout << Yes << std::endl; rep(i,2*n-1)std::cout << i+1 << std::endl; } else{ std::cout << No << std::endl; } }
a.cc: In function 'long long int modpow(long long int, long long int)': a.cc:110:41: error: expected ';' before 'a' 110 | if (n & 1) res = res * a % MOD;a | ^ | ; 111 | a = a * a % MOD; | ~
s666012042
p03952
C++
#include<bits/stdc++.h> #include<unordered_set> #include<unordered_map> #include <algorithm> #include <iostream> #include <string> #include <cmath> using namespace std; #define ll long long #define rep(i,n) for (ll i = 0; i < (n); i++) #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define FORR(i,a,b)for(ll i=(a);i<=(b);i++) #define repR(i,n) for(ll i=n;i>=0;i--) #define all(v)(v).begin(),(v).end() #define rall(v)(v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout<<(x)<<"\n" #define PQ priority_queue<ll> #define PQR priority_queue<ll,vector<ll>,greater<ll>> #define YES(n) cout << ((n) ? "YES\n" : "NO\n" ) #define Yes(n) cout << ((n) ? "Yes\n" : "No\n" ) #define mp make_pair #define sz(x) (ll)(x).size() typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vb = vector<bool>; using vvb = vector<vb>; using vvll = vector<vll>; using vstr = vector<string>; using vc = vector<char>; using vvc = vector<vc>; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } ll dx[4]={0,1,0,-1}; ll dy[4]={1,0,-1,0}; int main(){ ll n,x; cin>>n>>x; if(x==1||x==2*n-1){ COUT("No"); } else if(n==2){ COUT("Yes"); COUT(1); COUT(2); COUT(3); } else{ vll a(4); set<ll> s; rep(i,2*n-1){ s.insert(i+1); } a[1]=x; if(x==2){ a[0]=3; a[2]=1; a[4]=4; } else if(x==2*n-2){ a[2]=2*n-1; a[0]=2*n-3; a[3]=2*n-4; } else{ a[0]=x-1; a[2]=x+1; a[3]=x-2; } rep(i,sz(a)){ s.erase(a[i]); } vll ans(0); COUT("Yes"); rep(i,(2*n-1)/2){ COUT(*begin.(s)); ll h=*begin(s); s.erase(h); } rep(i,4){ COUT(a[i]); } for(auto p:s){ COUT(p); } } }
a.cc: In function 'int main()': a.cc:87:19: error: expected unqualified-id before '(' token 87 | COUT(*begin.(s)); | ^ a.cc:20:24: note: in definition of macro 'COUT' 20 | #define COUT(x) cout<<(x)<<"\n" | ^
s569885784
p03952
C++
#include <iostream> using namespace std; int main() { int n, x; cin >> n >> x; if ( n == x ) { cout << "Yes\n"; for ( i = 1; i <= n * 2 - 1; i ++ ) cout << i << "\n"; } else cout << "No\n"; return 0; }
a.cc: In function 'int main()': a.cc:10:15: error: 'i' was not declared in this scope 10 | for ( i = 1; i <= n * 2 - 1; i ++ ) | ^
s227390200
p03952
C++
#include<bits/stdc++.h> using namespace std; int main(){ ll N,x; cin>>N>>x; if(N != x){ cout<<"No"<<endl; cout<<-1; return 0; } else{ cout<<"Yes"<<endl; for(int i = 0; i<2*N-1;i++){ cout<<i+1<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'll' was not declared in this scope 6 | ll N,x; | ^~ a.cc:7:8: error: 'N' was not declared in this scope 7 | cin>>N>>x; | ^ a.cc:7:11: error: 'x' was not declared in this scope 7 | cin>>N>>x; | ^
s886134415
p03952
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++) #define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++) #define MOD 1000000007 #define int long long #define ALL(a) (a).begin(),(a).end() #define vi vector<int> #define vii vector<vi> #define pii pair<int,int> #define priq priority_queue<int> #define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key))) #define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key))) #define tii tuple<int,int,int> #define Priq priority_queue<int,vi,greater<int>> #define pb push_back #define mp make_pair #define INF (1ll<<60) signed main(){ int N,X; cin>>N>>X; if(X==1||X==2*N-1) cout<<"No"<<endl; else{ cout<<"Yes"<<endl; deque ans; if(N<X){ bool flag=1; for(int i=X+1;1<=i;i--){ if(flag) ans.push_front(i); else ans.pb(i); flag=!flag; } for(int i=2*N-1;X+1<i;i--){ if(flag) ans.push_front(i); else ans.pb(i); flag=!flag; } } else{ bool flag=1; rep(i,X-1,2*N){ if(flag) ans.push_front(i); else ans.pb(i); flag=!flag; } rep(i,1,X-1){ if(flag) ans.push_front(i); else ans.pb(i); flag=!flag; } } rep(i,0,2*N-1) cout<<ans[i]<<" "; cout<<endl; } }
a.cc: In function 'int main()': a.cc:24:11: error: class template argument deduction failed: 24 | deque ans; | ^~~ a.cc:24:11: error: no matching function for call to 'deque()' In file included from /usr/include/c++/14/deque:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:139, from a.cc:1: /usr/include/c++/14/bits/stl_deque.h:1003:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> deque(_InputIterator, _InputIterator, const _Alloc&)-> std::deque<_Tp, _Alloc>' 1003 | deque(_InputIterator __first, _InputIterator __last, | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:1003:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_deque.h:976:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::initializer_list<_Tp>, const _Alloc&)-> std::deque<_Tp, _Alloc>' 976 | deque(initializer_list<value_type> __l, | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:976:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_deque.h:952:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::deque<_Tp, _Alloc>' 952 | deque(deque&& __x, const allocator_type& __a, false_type) | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:952:7: note: candidate expects 3 arguments, 0 provided /usr/include/c++/14/bits/stl_deque.h:948:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::deque<_Tp, _Alloc>' 948 | deque(deque&& __x, const allocator_type& __a, true_type) | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:948:7: note: candidate expects 3 arguments, 0 provided /usr/include/c++/14/bits/stl_deque.h:943:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::deque<_Tp, _Alloc>' 943 | deque(deque&& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:943:7: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_deque.h:936:7: note: candidate: 'template<class _Tp, class _Alloc> deque(const std::deque<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::deque<_Tp, _Alloc>' 936 | deque(const deque& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:936:7: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_deque.h:933:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&)-> std::deque<_Tp, _Alloc>' 933 | deque(deque&&) = default; | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:933:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_deque.h:917:7: note: candidate: 'template<class _Tp, class _Alloc> deque(const std::deque<_Tp, _Alloc>&)-> std::deque<_Tp, _Alloc>' 917 | deque(const deque& __x) | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:917:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_deque.h:890:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::size_t, const _Tp&, const _Alloc&)-> std::deque<_Tp, _Alloc>' 890 | deque(size_type __n, const value_type& __value, | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:890:7: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_deque.h:878:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::size_t, const _Alloc&)-> std::deque<_Tp, _Alloc>' 878 | deque(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:878:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_deque.h:865:7: note: candidate: 'template<class _Tp, class _Alloc> deque(const _Alloc&)-> std::deque<_Tp, _Alloc>' 865 | deque(const allocator_type& __a) | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:865:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_deque.h:855:7: note: candidate: 'template<class _Tp, class _Alloc> deque()-> std::deque<_Tp, _Alloc>' 855 | deque() = default; | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:855:7: note: template argument deduction/substitution failed: a.cc:24:11: note: couldn't deduce template parameter '_Tp' 24 | deque ans; | ^~~ /usr/include/c++/14/bits/stl_deque.h:788:11: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>)-> std::deque<_Tp, _Alloc>' 788 | class deque : protected _Deque_base<_Tp, _Alloc> | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:788:11: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_deque.h:2277:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::deque(_InputIterator, _InputIterator, _Allocator)-> deque<_ValT, _Allocator>' 2277 | deque(_InputIterator, _InputIterator, _Allocator = _Allocator()) | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:2277:5: note: candidate expects 2 arguments, 0 provided
s952770819
p03952
C++
#include <iostream> #include<bits/stdc++.h> using namespace std; typedef long long int ll; //ll ai[100010]; //bool cmp(ll a,ll b) //{ // return a<b;; //} int main() { int num=1; int n,x; cin>>n>>x; if(x==2*n-1||x==1) { printf("No"); return 0; } else { printf("Yes"); } for(int i=1; i<=n-2; i++) { while(num==x || num==x-1 || num==x+1) { num++; } printf("%d\n",num); num++; } printf("%d\n%d\n%d\n",x-1,x,x+1); for(int i=1; i<=n-2; i++) { while(num==x || num==x-1 || num==x+1) { t++; } printf("%d\n",num); num++; } return 0; }
a.cc: In function 'int main()': a.cc:41:13: error: 't' was not declared in this scope 41 | t++; | ^
s063168620
p03952
C++
#include<cstdio> using namespace std; const int MAX = 300000 + 10; int ans[MAX]; int main(){ int n, x; cin>>n>>x; if (x == 1 || x == 2*n-1) { puts("No"); } else { ans[n-1] = x; int now = n-2; for(int i = 1 ; i <= 2*n-1 ; i++) { if(i == x) continue; ans[now] = i; now--; if(now < 0) now = 2*n-2; } puts("Yes"); for(int i = 0 ; i < 2 * n - 1 ; i++) printf("%d\n", ans[i]); } return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'cin' was not declared in this scope 9 | cin>>n>>x; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include<cstdio> +++ |+#include <iostream> 2 | using namespace std;
s711075594
p03952
C++
#include <bits/stdc++.h> #include <random> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef double ld; //#define ll __int128 //#define int ll //#define int ll //#define char ll typedef vector<char> vc; typedef vector<vc> vvc; typedef vector<vvc> vvvc; typedef pair<int, int> pii; typedef pair<pii, pii> piii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<pii> vpi; typedef vector< vi > vvi; typedef vector< vvi > vvvi; typedef vector<short> vs; typedef vector<vs> vvs; typedef vector<vvs> vvvs; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<vvl> vvvl; typedef vector<ld> vld; typedef vector<vld> vvld; typedef vector<vvld> vvvld; typedef vector<string> vst; typedef vector<vst> vvst; typedef pair<ld, ld> pld; #define inmin(a, b) a = min(a, (b)) #define inmax(a, b) a = max(a, (b)) #define ALL(a) a.begin(),a.end() #define RALL(a) a.rbegin(),a.rend() #define sqr(x) ((x) * (x)) #define fori(i, n) for(int i = 0; i < int(n); ++i) #define SZ(a) ((int)((a).size())) #define triple(T) tuple<T, T, T> #define quad(T) tuple<T, T, T, T> #define watch(x) cerr << (#x) << " = " << (x) << endl; #ifdef MAX_HOME #define cerr cout #else #define cerr if (false) cerr #endif const double PI = 2 * acos(0.0); #define rand shittttty_shit mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count()); const string DIGITS = "0123456789"; const string ALPH = "abcdefghijklmnopqrstuvwxyz"; template <class T0, class T1> inline ostream & operator << (ostream &out, pair<T0, T1> &a) { return out << "{" << a.first << ", " << a.second << "}"; } template <class T0, class T1> inline istream & operator >> (istream &in, pair<T0, T1> &a) { return in >> a.first >> a.second; } template <class T0, class T1, class T2> inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) { return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}"; } template <class T0, class T1, class T2, class T3> inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) { return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " << get<3>(a) << "}"; } template<class T> inline ostream & operator << (ostream &out, vector<T> &a) { out << "["; fori (i, a.size()) out << a[i] << vector<string>{", ", "] "}[i + 1 == a.size()]; return out; } void smain(); signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifdef MAX_HOME freopen("input.txt", "r", stdin); clock_t start = clock(); #endif cout << setprecision(4) << fixed; smain(); #ifdef MAX_HOME cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) / CLOCKS_PER_SEC << endl; #endif return 0; } void smain() { int n; cin >> n; n = 2 * n - 1; int mid = n >> 1; int x; cin >> x; if (x == n || x == 1 || (x == 2 && n != 3)) { cout << "No\n"; return; } cout << "Yes\n"; if (x == 2 && n == 3) { cout << "1 2 3\n"; return; } vi a(n, -1); a[mid] = n; a[mid + 1] = x; a[mid - 1] = 1; a[mid - 2] = 2; int j = 3; fori (i, n) { if (a[i] == -1) { if (j == x) ++j; a[i] = j; } } for (auto x : a) { cout << x << ' '; } }#include <bits/stdc++.h> #include <random> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef double ld; //#define ll __int128 //#define int ll //#define int ll //#define char ll typedef vector<char> vc; typedef vector<vc> vvc; typedef vector<vvc> vvvc; typedef pair<int, int> pii; typedef pair<pii, pii> piii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<pii> vpi; typedef vector< vi > vvi; typedef vector< vvi > vvvi; typedef vector<short> vs; typedef vector<vs> vvs; typedef vector<vvs> vvvs; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<vvl> vvvl; typedef vector<ld> vld; typedef vector<vld> vvld; typedef vector<vvld> vvvld; typedef vector<string> vst; typedef vector<vst> vvst; typedef pair<ld, ld> pld; #define inmin(a, b) a = min(a, (b)) #define inmax(a, b) a = max(a, (b)) #define ALL(a) a.begin(),a.end() #define RALL(a) a.rbegin(),a.rend() #define sqr(x) ((x) * (x)) #define fori(i, n) for(int i = 0; i < int(n); ++i) #define SZ(a) ((int)((a).size())) #define triple(T) tuple<T, T, T> #define quad(T) tuple<T, T, T, T> #define watch(x) cerr << (#x) << " = " << (x) << endl; #ifdef MAX_HOME #define cerr cout #else #define cerr if (false) cerr #endif const double PI = 2 * acos(0.0); #define rand shittttty_shit mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count()); const string DIGITS = "0123456789"; const string ALPH = "abcdefghijklmnopqrstuvwxyz"; template <class T0, class T1> inline ostream & operator << (ostream &out, pair<T0, T1> &a) { return out << "{" << a.first << ", " << a.second << "}"; } template <class T0, class T1> inline istream & operator >> (istream &in, pair<T0, T1> &a) { return in >> a.first >> a.second; } template <class T0, class T1, class T2> inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) { return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}"; } template <class T0, class T1, class T2, class T3> inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) { return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " << get<3>(a) << "}"; } template<class T> inline ostream & operator << (ostream &out, vector<T> &a) { out << "["; fori (i, a.size()) out << a[i] << vector<string>{", ", "] "}[i + 1 == a.size()]; return out; } void smain(); signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifdef MAX_HOME freopen("input.txt", "r", stdin); clock_t start = clock(); #endif cout << setprecision(4) << fixed; smain(); #ifdef MAX_HOME cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) / CLOCKS_PER_SEC << endl; #endif return 0; } void smain() { int n; cin >> n; n = 2 * n - 1; int mid = n >> 1; int x; cin >> x; if (x == n || x == 1 || (x == 2 && n != 3)) { cout << "No\n"; return; } cout << "Yes\n"; if (x == 2 && n == 3) { cout << "1 2 3\n"; return; } vi a(n, -1); a[mid] = n; a[mid + 1] = x; a[mid - 1] = 1; a[mid - 2] = 2; int j = 3; fori (i, n) { if (a[i] == -1) { if (j == x) ++j; a[i] = j; } } for (auto x : a) { cout << x << ' '; } }
a.cc:143:2: error: stray '#' in program 143 | }#include <bits/stdc++.h> | ^ a.cc:143:3: error: 'include' does not name a type 143 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:195:14: error: redefinition of 'const double PI' 195 | const double PI = 2 * acos(0.0); | ^~ a.cc:53:14: note: 'const double PI' previously defined here 53 | const double PI = 2 * acos(0.0); | ^~ a.cc:197:9: error: redefinition of 'std::mt19937 rng' 197 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); | ^~~ a.cc:55:9: note: 'std::mt19937 rng' previously declared here 55 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); | ^~~ a.cc:198:12: error: redefinition of 'std::mt19937_64 rng_64' 198 | mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count()); | ^~~~~~ a.cc:56:12: note: 'std::mt19937_64 rng_64' previously declared here 56 | mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count()); | ^~~~~~ a.cc:200:14: error: redefinition of 'const std::string DIGITS' 200 | const string DIGITS = "0123456789"; | ^~~~~~ a.cc:58:14: note: 'const std::string DIGITS' previously declared here 58 | const string DIGITS = "0123456789"; | ^~~~~~ a.cc:201:14: error: redefinition of 'const std::string ALPH' 201 | const string ALPH = "abcdefghijklmnopqrstuvwxyz"; | ^~~~ a.cc:59:14: note: 'const std::string ALPH' previously declared here 59 | const string ALPH = "abcdefghijklmnopqrstuvwxyz"; | ^~~~ a.cc:205:18: error: redefinition of 'template<class T0, class T1> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>&)' 205 | inline ostream & operator << (ostream &out, pair<T0, T1> &a) { | ^~~~~~~~ a.cc:63:18: note: 'template<class T0, class T1> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>&)' previously declared here 63 | inline ostream & operator << (ostream &out, pair<T0, T1> &a) { | ^~~~~~~~ a.cc:210:18: error: redefinition of 'template<class T0, class T1> std::istream& operator>>(std::istream&, std::pair<_T1, _T2>&)' 210 | inline istream & operator >> (istream &in, pair<T0, T1> &a) { | ^~~~~~~~ a.cc:68:18: note: 'template<class T0, class T1> std::istream& operator>>(std::istream&, std::pair<_T1, _T2>&)' previously declared here 68 | inline istream & operator >> (istream &in, pair<T0, T1> &a) { | ^~~~~~~~ a.cc:215:18: error: redefinition of 'template<class T0, class T1, class T2> std::ostream& operator<<(std::ostream&, std::tuple<T0, T1, T2>&)' 215 | inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) { | ^~~~~~~~ a.cc:73:18: note: 'template<class T0, class T1, class T2> std::ostream& operator<<(std::ostream&, std::tuple<T0, T1, T2>&)' previously declared here 73 | inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) { | ^~~~~~~~ a.cc:220:18: error: redefinition of 'template<class T0, class T1, class T2, class T3> std::ostream& operator<<(std::ostream&, std::tuple<T0, T1, T2, T3>&)' 220 | inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) { | ^~~~~~~~ a.cc:78:18: note: 'template<class T0, class T1, class T2, class T3> std::ostream& operator<<(std::ostream&, std::tuple<T0, T1, T2, T3>&)' previously declared here 78 | inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) { | ^~~~~~~~ a.cc:225:18: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>&)' 225 | inline ostream & operator << (ostream &out, vector<T> &a) { | ^~~~~~~~ a.cc:83:18: note: 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>&)' previously declared here 83 | inline ostream & operator << (ostream &out, vector<T> &a) { | ^~~~~~~~ a.cc:237:8: error: redefinition of 'int main()' 237 | signed main() { | ^~~~ a.cc:95:8: note: 'int main()' previously defined here 95 | signed main() { | ^~~~ a.cc:253:6: error: redefinition of 'void smain()' 253 | void smain() { | ^~~~~ a.cc:111:6: note: 'void smain()' previously defined here 111 | void smain() { | ^~~~~
s697230026
p03952
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n , x ; cin >> n >> x ; int ans =2,res = n; if(x == 1 || x == 2*n-1){ cout << "No" << endl; return 0; } cout << "Yes" << endl; else{ if(x < n){ for(int i=0;i<n-2;i++){ if(i+ans != x){ cout << i+ans << endl; } else{ ans++; cout << i+ans << endl; } } cout << "1" << endl; cout << x << endl; cout << 2*n-1 << endl; for(int i=0;i<n-2;i++){ cout << i+n+1 << endl; } } else{ for(int i=0;i<n-2;i++){ cout << i+2 << endl; } cout << "1" << endl; cout << x << endl; cout << 2*n-1 << endl; for(int i=0;i<n-2;i++){ if(i+res != x){ cout << i+res << endl; } else{ res++; cout << i+res << endl; } } } } }
a.cc: In function 'int main()': a.cc:18:3: error: 'else' without a previous 'if' 18 | else{ | ^~~~
s272250681
p03952
C++
#include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define sz(x) (int)(x).size() #define S second #define F first #define all(x) (x).begin(), (x).end() using namespace std; const bool dbg_flg = 1; #define debug(x) if (dbg_flg) cerr << #x << ' ' << x << '\n' #define debug_pair(x) if (dbg_flg) cerr << #x << ' ' << x.F << ' ' << x.S << '\n' const int inf = 1e9 + 7; const int MAXN = 1e6 + 5; int n, x; int res[MAXN]; int main() { ] ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); cin >> n >> x; cout << "No"; return 0; if (n != x) { cout << "No"; return 0; } set<int> s; for (int i = 1; i < 2 * n - 1; i++) { s.insert(i); } bool b = 1; res[n] = 2 * n - 1; for (int i = 1; i <= n - 1; i++) { int rev = (2 * n - 1) - i + 1; int a = i; if (b) { res[i] = *s.begin(); s.erase(s.begin()); res[rev] = *s.begin(); s.erase(s.begin()); } else { res[i] = *s.rbegin(); s.erase(*s.rbegin()); res[rev] = *s.rbegin(); s.erase(*s.rbegin()); } b ^= 1; } cout << "Yes\n"; for (int i = 1; i <= 2 * n - 1; i++) { cout << res[i] << '\n'; } return 0; }
a.cc: In function 'int main()': a.cc:25:9: error: expected primary-expression before ']' token 25 | ] | ^
s211334018
p03952
C++
#include<bits/stdc++.h> using namespace std; #define ALL(v) (v).begin(),(v).end() #define REP(i,p,n) for(int i=p;i<(int)(n);++i) #define rep(i,n) REP(i,0,n) #define SZ(x) ((int)(x).size()) #define debug(x) cerr << #x << ": " << x << '\n' #define INF 999999999 typedef long long int Int; typedef pair<int,int> P; using ll = long long; using VI = vector<int>; int main(){ int n,x;cin >> n >> x; if(x==1||x==2*n-1) cout << "No" << endl; else{ vector<int> a(2*n-1); iota(a.begin(),a.end(),1); swap(a[n-1],a[x-1]); if(a[n-1]<a[n-2]&&a[n-1]<a[n]) swap(a[0],a[n-2]); else if(a[n-1]>ans[n-2]&&a[n-1]>a[n]) swap(a[n],a[2*n-2]); cout << "Yes" << endl; for(auto &i:a) cout << i << endl; } }
a.cc: In function 'int main()': a.cc:22:32: error: 'ans' was not declared in this scope; did you mean 'abs'? 22 | else if(a[n-1]>ans[n-2]&&a[n-1]>a[n]) swap(a[n],a[2*n-2]); | ^~~ | abs
s049229712
p03952
C++
#include<bits/stdc++.h> using namespace std; #define ALL(v) (v).begin(),(v).end() #define REP(i,p,n) for(int i=p;i<(int)(n);++i) #define rep(i,n) REP(i,0,n) #define SZ(x) ((int)(x).size()) #define debug(x) cerr << #x << ": " << x << '\n' #define INF 999999999 typedef long long int Int; typedef pair<int,int> P; using ll = long long; using VI = vector<int>; int main(){ int n,x;cin >> n >> x; if(x==1||x==2*n-1) cout << "No" << endl; else{ vector<int> a(2*n-1); iota(a.begin(),a.end(),1); swap(a[n-1],a[x-1]); if(a[n-1]<a[n-2]&&a[n-1]<a[n]) swap(a[0],a[n-2]); else if(a[n-1]>ans[n-2]&&a[n-1]>ans[n]) swap(ans[n],ans[2*n-2]); cout << "Yes" << endl; for(auto &i:a) cout << i << endl; } }
a.cc: In function 'int main()': a.cc:22:32: error: 'ans' was not declared in this scope; did you mean 'abs'? 22 | else if(a[n-1]>ans[n-2]&&a[n-1]>ans[n]) swap(ans[n],ans[2*n-2]); | ^~~ | abs
s416298479
p03952
C++
#include<bits/stdc++.h> using namespace std; #define ALL(v) (v).begin(),(v).end() #define REP(i,p,n) for(int i=p;i<(int)(n);++i) #define rep(i,n) REP(i,0,n) #define SZ(x) ((int)(x).size()) #define debug(x) cerr << #x << ": " << x << '\n' #define INF 999999999 typedef long long int Int; typedef pair<int,int> P; using ll = long long; using VI = vector<int>; signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n,x;cin >> n >> x; int vec[2*n-1]; iota(vec.begin(),vec.end(),1); int count; do{ //for(auto &i:vec) cout << i << " "; //cout << endl; count=n; vector<int> a(n); a = vec; while(count!=1){ for(int i=1;i<2*count-2;i++){ int t[3]; t[0] = a[i-1]; t[1] = a[i]; t[2] = a[i+1]; sort(t.begin(),t.end()); a[i-1]=t[1]; } count--; } if(a[0]==x){ cout << "Yes" << endl; for(auto &i:vec) cout << i << endl; return 0; } }while(next_permutation(vec.begin(),vec.end())); cout << "No" << endl; }
a.cc: In function 'int main()': a.cc:20:14: error: request for member 'begin' in 'vec', which is of non-class type 'int [((n * 2) + -1)]' 20 | iota(vec.begin(),vec.end(),1); | ^~~~~ a.cc:20:26: error: request for member 'end' in 'vec', which is of non-class type 'int [((n * 2) + -1)]' 20 | iota(vec.begin(),vec.end(),1); | ^~~ a.cc:27:13: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int [((n * 2) + -1)]') 27 | a = vec; | ^~~ In file included from /usr/include/c++/14/vector:72, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 210 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'int [((n * 2) + -1)]' to 'const std::vector<int>&' 211 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66: /usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'int [((n * 2) + -1)]' to 'std::vector<int>&&' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]' 788 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'int [((n * 2) + -1)]' to 'std::initializer_list<int>' 788 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ a.cc:34:24: error: request for member 'begin' in 't', which is of non-class type 'int [3]' 34 | sort(t.begin(),t.end()); | ^~~~~ a.cc:34:34: error: request for member 'end' in 't', which is of non-class type 'int [3]' 34 | sort(t.begin(),t.end()); | ^~~ a.cc:44:33: error: request for member 'begin' in 'vec', which is of non-class type 'int [((n * 2) + -1)]' 44 | }while(next_permutation(vec.begin(),vec.end())); | ^~~~~ a.cc:44:45: error: request for member 'end' in 'vec', which is of non-class type 'int [((n * 2) + -1)]' 44 | }while(next_permutation(vec.begin(),vec.end())); | ^~~
s045034201
p03952
C++
#include <bits\stdc++.h> #define pb push_back #define mp make_pair #define size(x) (int)(x).size() #define S second #define F first #define all(x) (x).begin(), (x).end() using namespace std; using ll = long long; bool DBG_FLG = 1; #define debug(x) if (DBG_FLG) cerr << #x << " = " << x << endl; const int inf = 1e9 + 7; const int MAXN = 1e6 + 5; int n, x; int res[MAXN]; set<int> s; int N; bool make(int a, int b) { res[a] = *s.begin(); s.erase(s.begin()); int qq = N - res[a]; if (*s.lower_bound(qq) != qq) return 0; else res[b] = qq; return 1; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> x; if (x == 1) { cout << "NO\n"; return 0; } N = 2 * n - 1; for (int i = 1; i < N; i++) { s.insert(i); } res[N / 2 + 1] = N; make(N / 2, N / 2 + 2); for (int i = 1; i < N / 2 - 1; i += 2) { if (make(i, i + 1) == 0) { cout << -1; return 0; } } for (int i = N / 2 + 3; i <= N; i += 2) { if (make(i, i + 1) == 0) { cout << "No"; return 0; } } cout << "Yes\n"; for (int i = 1; i <= N; i++) { cout << res[i] << '\n'; } return 0; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s581196276
p03952
C++
#include <stdio.h> #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <deque> #include <set> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <unordered_map> #include <unordered_set> #include <vector> #include <chrono> #include <random> #include <time.h> #include <fstream> #define ll long long #define rep2(i,a,b) for(ll i=a;i<=b;++i) #define rep(i,n) for(ll i=0;i<n;i++) #define rep3(i,a,b) for(ll i=a;i>=b;i--) #define pii pair<int,int> #define pll pair<ll,ll> #define pq priority_queue<int> #define pqg priority_queue<int,vector<int>,greater<int>> #define pb push_back #define vec vector<int> #define vecll vector<ll> #define vecpii vector<pii> #define endl "\n" #define all(c) begin(c),end(c) using namespace std; int in() {int x;scanf("%d",&x);return x;} ll lin() {ll x;scanf("%lld",&x);return x;} void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;} void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;} void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;} #define INF 1e9+7 #define LLINF 1e18+7 #define N 250000 const ll MOD=998244353; main(){ int n;cin>>n; int x;cin>>x; if(n!=x)cout<<"No"; else{ cout<<"Yes\n"+ rep2(i,1,n*2-1)cout<<i<<endl; } }
a.cc:55:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 55 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:28:21: error: expected primary-expression before 'for' 28 | #define rep2(i,a,b) for(ll i=a;i<=b;++i) | ^~~ a.cc:61:9: note: in expansion of macro 'rep2' 61 | rep2(i,1,n*2-1)cout<<i<<endl; | ^~~~ a.cc:61:14: error: 'i' was not declared in this scope 61 | rep2(i,1,n*2-1)cout<<i<<endl; | ^ a.cc:28:32: note: in definition of macro 'rep2' 28 | #define rep2(i,a,b) for(ll i=a;i<=b;++i) | ^
s243048058
p03952
C++
#include <stdio.h> #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <deque> #include <set> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <unordered_map> #include <unordered_set> #include <vector> #include <chrono> #include <random> #include <time.h> #include <fstream> #define ll long long #define rep2(i,a,b) for(ll i=a;i<=b;++i) #define rep(i,n) for(ll i=0;i<n;i++) #define rep3(i,a,b) for(ll i=a;i>=b;i--) #define pii pair<int,int> #define pll pair<ll,ll> #define pq priority_queue<int> #define pqg priority_queue<int,vector<int>,greater<int>> #define pb push_back #define vec vector<int> #define vecll vector<ll> #define vecpii vector<pii> #define endl "\n" #define all(c) begin(c),end(c) using namespace std; int in() {int x;scanf("%d",&x);return x;} ll lin() {ll x;scanf("%lld",&x);return x;} void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;} void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;} void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;} #define INF 1e9+7 #define LLINF 1e18+7 #define N 250000 const ll MOD=998244353; main(){ int n;cin>>n; int x;cin>>x; if(n!=x)cout<<"No"; else{ cout<<"Yes\n"+ rep2(i,1,n*2-1)cout<<i<<"\n"; } }
a.cc:55:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 55 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:28:21: error: expected primary-expression before 'for' 28 | #define rep2(i,a,b) for(ll i=a;i<=b;++i) | ^~~ a.cc:61:9: note: in expansion of macro 'rep2' 61 | rep2(i,1,n*2-1)cout<<i<<"\n"; | ^~~~ a.cc:61:14: error: 'i' was not declared in this scope 61 | rep2(i,1,n*2-1)cout<<i<<"\n"; | ^ a.cc:28:32: note: in definition of macro 'rep2' 28 | #define rep2(i,a,b) for(ll i=a;i<=b;++i) | ^
s025481945
p03952
C++
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n, x; cin >> n >> x; if (x < n) { cout << "No"; return 0; } else cout << "Yes" << endl; for (int i = 1; i <= 2 * n - 1; i++) cout << i << "endl; return 0; }
a.cc:16:22: warning: missing terminating " character 16 | cout << i << "endl; | ^ a.cc:16:22: error: missing terminating " character 16 | cout << i << "endl; | ^~~~~~ a.cc: In function 'int main()': a.cc:18:5: error: expected primary-expression before 'return' 18 | return 0; | ^~~~~~
s482896724
p03952
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define REPP(i,n) for(int i=1;i<=n;i++) const double PI = acos(-1); const double EPS = 1e-15; long long INF=(long long)1E17; #define i_7 (long long)(1E9+7) long mod(long a){ long long c=a%i_7; if(c>=0)return c; return c+i_7; } using namespace std; bool prime_(int n){ if(n==1){ return false; }else if(n==2){ return true; }else{ for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ return false; } } return true; } } long long gcd_(long long a, long long b){ if(a<b){ swap(a,b); } if(a%b==0){ return b; }else{ return gcd_(b,a%b); } } long long lcm_(long long x, long long y){ return (x/gcd_(x,y))*y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } //Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)];//先祖をrootで取っておきたい。 } //AとBをくっ付ける bool connect(int A, int B) { //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); //Aのサイズを更新する Parent[A] += Parent[B]; //Bの親をAに変更する Parent[B] = A; return true; } }; int main(){ int n,x; cin>>n>>x; if(x==1 || x==2*n-1){ cout<<"No"<<endl; return 0; } vector<int> ans(2*n, -1);//1~(2*n-1)の範囲のみ使う vector<bool> used(2*n,false);//1~(2*n-1)の範囲のみ使う ans[n] = x; used[x] = true; ans[n-1] = x - 1; used[x-1] = true; ans[n+1] = x + 1; used = true; int next_ = 1; REPP(i,2*n-1){ if(ans[i]>0)continue; while(used[next_])next_++; ans[i] = next_; used[next_] = true; } cout<<"Yes"<<endl; REPP(i,2*n-1){ cout<<ans[i]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:105:10: error: no match for 'operator=' (operand types are 'std::vector<bool>' and 'bool') 105 | used = true; | ^~~~ In file included from /usr/include/c++/14/vector:67, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_bvector.h:894:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(const std::vector<bool, _Alloc>&) [with _Alloc = std::allocator<bool>]' 894 | operator=(const vector& __x) | ^~~~~~~~ /usr/include/c++/14/bits/stl_bvector.h:894:31: note: no known conversion for argument 1 from 'bool' to 'const std::vector<bool>&' 894 | operator=(const vector& __x) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_bvector.h:926:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::vector<bool, _Alloc>&&) [with _Alloc = std::allocator<bool>]' 926 | operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/14/bits/stl_bvector.h:926:26: note: no known conversion for argument 1 from 'bool' to 'std::vector<bool>&&' 926 | operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_bvector.h:952:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::initializer_list<bool>) [with _Alloc = std::allocator<bool>]' 952 | operator=(initializer_list<bool> __l) | ^~~~~~~~ /usr/include/c++/14/bits/stl_bvector.h:952:40: note: no known conversion for argument 1 from 'bool' to 'std::initializer_list<bool>' 952 | operator=(initializer_list<bool> __l) | ~~~~~~~~~~~~~~~~~~~~~~~^~~
s215669419
p03952
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } signed main(){ int a,b,d; cin>>a>>b; if(b==1||b==2*a-1) cout<<"No"<<endl; else{ cout<<"Yes"<<endl; vector<int> c(2*a-1); d=2*a-1; fo(i,d) c[i]=d-i; if(b>n){ swap(c[a],c[0]); swap(c[a+1],c[d]-b); swap(c[a-1],c[d-1]); } else if(b<n){ rev(c); swap(c[a],c[0]); swap(c[a+1],c[d]-b); swap(c[a-1],c[d-1]); } fo(i,d) cout<<c[i]<<endl; } }
a.cc: In function 'int main()': a.cc:86:10: error: 'n' was not declared in this scope 86 | if(b>n){ | ^ a.cc:88:11: error: no matching function for call to 'swap(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 88 | swap(c[a+1],c[d]-b); | ~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:61, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = long long int; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match) 226 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed: a.cc:88:23: error: cannot bind non-const lvalue reference of type 'long long int&' to an rvalue of type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 88 | swap(c[a+1],c[d]-b); In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77: /usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match) 430 | inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); } | ^~~~ /usr/include/c++/14/any:430:15: note: conversion of argument 2 would be ill-formed: a.cc:88:23: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any' 88 | swap(c[a+1],c[d]-b); /usr/include/c++/14/any:191:7: note: after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = long long int; _VTp = long long int; _Mgr = _Manager_internal<long long int>; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]' 191 | any(_Tp&& __value) | ^~~ In file included from /usr/include/c++/14/exception:166, from /usr/include/c++/14/stdexcept:38, from /usr/include/c++/14/system_error:43, from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'std::__exception_ptr::exception_ptr&' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/future:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176: /usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)' 328 | swap(thread& __x, thread& __y) noexcept | ^~~~ /usr/include/c++/14/bits/std_thread.h:328:16: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'std::thread&' 328 | swap(thread& __x, thread& __y) noexcept | ~~~~~~~~^~~ In file included from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)' 1204 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1204:5: note: template argument deduction/substitution failed: a.cc:88:11: note: mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 88 | swap(c[a+1],c[d]-b); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/sstream:1212:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_istringstream<_CharT, _Traits, _Allocator>&, basic_istringstream<_CharT, _Traits, _Allocator>&)' 1212 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1212:5: note: template argument deduction/substitution failed: a.cc:88:11: note: mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 88 | swap(c[a+1],c[d]-b); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/sstream:1219:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_ostringstream<_CharT, _Traits, _Allocator>&, basic_ostringstream<_CharT, _Traits, _Allocator>&)' 1219 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1219:5: note: template argument deduction/substitution failed: a.cc:88:11: note: mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 88 | swap(c[a+1],c[d]-b); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/sstream:1226:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringstream<_CharT, _Traits, _Allocator>&, basic_stringstream<_CharT, _Traits, _Allocator>&)' 1226 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1226:5: note: template argument deduction/substitution failed: a.cc:88:11: note: mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 88 | swap(c[a+1],c[d]-b); | ~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181: /usr/include/c++/14/bits/regex.h:896:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(basic_regex<_Ch_type, _Rx_traits>&, basic_regex<_Ch_type, _Rx_traits>&)' 896 | swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:896:5: note: template argument deduction/substitution failed: a.cc:88:11: note: mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 88 | swap(c[a+1],c[d]-b); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(match_results<_BiIter, _Alloc>&, match_results<_BiIter, _Alloc>&)' 2230 | swap(match_results<_Bi_iter, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: template argument deduction/substitution failed: a.cc:88:11: note: mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 88 | swap(c[a+1],c[d]-b); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])' 250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed: a.cc:88:11: note: mismatched types '_Tp [_Nm]' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 88 | swap(c[a+1],c[d]-b); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' 1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed: a.cc:88:11: note: mismatched types 'std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 88 | swap(c[a+1],c[d]-b); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted) 1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed: a.cc:88:11: note: mismatched types 'std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 88 | swap(c[a+1],c[d]-b); | ~~~~^~~~~~~~~~~~~~~ In file in
s005990089
p03952
C++
//In The Name Of GOD #include <bits/stdc++.h> using namespace std; const int mod = 1000000007; const int inf = 2000000000; const int maxn = 100000; #define ll long long #define pb push_back #define mp make_pair #define IO ios_base::sync_with_stdio(false); int main(){ IO; int n,m; cin>>n>>m; if(m==1||m==2*n-1) cout<<"No"; else cout<<"Yes\n"; for(int i=0;i<2*n-1;i++){ cout<<(i+m-n+2*n-1)%(2*n-1)+1<<endl; }
a.cc: In function 'int main()': a.cc:21:2: error: expected '}' at end of input 21 | } | ^ a.cc:11:11: note: to match this '{' 11 | int main(){ | ^
s649705858
p03952
C++
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <set> #include <queue> #include <deque> #include <map> #include <stack> #include<bitset> #include<list> #include<cassert> #include<numeric> using namespace std; void solve(int N, int x) { if (x <= 1 || x >= N * 2 - 1) { cout << "No" << endl; exit(0); } cout << "Yes" << endl; vector<int> ans(N * 2 - 1, -1); ans[N - 2] = 1; ans[N-1] = x; ans[N] = N*2-1; int ind = 0; for (int i = 2; i < N*2-1; i++) { if (i == x) continue; while (res[ind] != -1) ind++; ans[ind] = v; } for (int i = 0; i < n; i++) { cout << ans[i] << " "; } } int main() { int N, x; cin >> N >> x; solve(N, x); }
a.cc: In function 'void solve(int, int)': a.cc:34:16: error: 'res' was not declared in this scope 34 | while (res[ind] != -1) | ^~~ a.cc:36:20: error: 'v' was not declared in this scope 36 | ans[ind] = v; | ^ a.cc:38:25: error: 'n' was not declared in this scope 38 | for (int i = 0; i < n; i++) | ^
s079007508
p03952
C++
//In The Name Of GOD #include <bits/stdc++.h> using namespace std; const int mod = 1000000007; const int inf = 2000000000; const int maxn = 5000; #define ll long long #define pb push_back #define mp make_pair #define IO ios_base::sync_with_stdio(false); int main(){ IO; int n,m; cin>>n>>m; if(n==m){ cout<<"Yes\n" for(int i=0;i<2*n-1;i++){ cout<<i+1<<endl; } }else{ cout<<"No"; } }
a.cc: In function 'int main()': a.cc:16:18: error: expected ';' before 'for' 16 | cout<<"Yes\n" | ^ | ; 17 | for(int i=0;i<2*n-1;i++){ | ~~~ a.cc:17:17: error: 'i' was not declared in this scope 17 | for(int i=0;i<2*n-1;i++){ | ^
s800735617
p03952
C++
#include <bits/stdc++.h> #define rep(i,n) for(long long i=0; i<(n); i++) #define int long long #define mod 1000000007 #define F first #define S second #define P pair<long long,long long> #define all(a) a.begin(),a.end() #define INF 1000000000000000000 using namespace std; signed main(void){ int m,x;cin>>m>>x; int n=2*m-1;m--; if(x==1||x==n)cout<<"No"<<endl; else if(n==3)cout<<"Yes"<<endl<<1<<endl<<2<<endl<3<<endl; else{ cout<<"Yes"<<endl; vector<int>Ans(n); Ans[m-1]=x+1;Ans[m]=x-1;Ans[m+1]=x;Ans[m+2]=x+2; int y=1; rep(i,n){ if(i>=m-1&&i<=m+2)continue; if(y==x-1)y=x+3; Ans[i]=y; y++; } rep(i,n)cout<<Ans[i]<<endl; } }
a.cc: In function 'int main()': a.cc:15:55: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 15 | else if(n==3)cout<<"Yes"<<endl<<1<<endl<<2<<endl<3<<endl; | ~^~~~~~ a.cc:15:49: error: parse error in template argument list 15 | else if(n==3)cout<<"Yes"<<endl<<1<<endl<<2<<endl<3<<endl; | ^~~~~~~~~~~~ a.cc:15:47: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 15 | else if(n==3)cout<<"Yes"<<endl<<1<<endl<<2<<endl<3<<endl; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ | | | | | <unresolved overloaded function type> | std::basic_ostream<char> In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::b
s258402436
p03952
C++
#define S second #define P pair<long long,long long> #define all(a) a.begin(),a.end() #define INF 1000000000000000000 using namespace std; signed main(void){ int m,x;cin>>m>>x; int n=2*m+1; if(x==1||x==n)cout<<"No"<<endl; else if(n==3)cout<<"Yes"<<endl<<"1 2 3"<<endl; else{ cout<<"Yes"<<endl; vector<int>Ans(n); Ans[m-1]=x+1;Ans[m]=x-1;Ans[m+1]=x;Ans[m+2]=x+2; int y=1; rep(i,n){ if(i>=m-1&&i<=m+2)continue; if(y==x-1)y=x+3; Ans[i]=y; y++; } rep(i,n)cout<<Ans[i]<<' '; } }
a.cc: In function 'int main()': a.cc:7:13: error: 'cin' was not declared in this scope 7 | int m,x;cin>>m>>x; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #define S second a.cc:9:19: error: 'cout' was not declared in this scope 9 | if(x==1||x==n)cout<<"No"<<endl; | ^~~~ a.cc:9:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:9:31: error: 'endl' was not declared in this scope 9 | if(x==1||x==n)cout<<"No"<<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | #define S second a.cc:10:18: error: 'cout' was not declared in this scope 10 | else if(n==3)cout<<"Yes"<<endl<<"1 2 3"<<endl; | ^~~~ a.cc:10:18: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:10:31: error: 'endl' was not declared in this scope 10 | else if(n==3)cout<<"Yes"<<endl<<"1 2 3"<<endl; | ^~~~ a.cc:10:31: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' a.cc:12:9: error: 'cout' was not declared in this scope 12 | cout<<"Yes"<<endl; | ^~~~ a.cc:12:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:12:22: error: 'endl' was not declared in this scope 12 | cout<<"Yes"<<endl; | ^~~~ a.cc:12:22: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' a.cc:13:9: error: 'vector' was not declared in this scope 13 | vector<int>Ans(n); | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | #define S second a.cc:13:16: error: expected primary-expression before 'int' 13 | vector<int>Ans(n); | ^~~ a.cc:14:9: error: 'Ans' was not declared in this scope 14 | Ans[m-1]=x+1;Ans[m]=x-1;Ans[m+1]=x;Ans[m+2]=x+2; | ^~~ a.cc:16:13: error: 'i' was not declared in this scope 16 | rep(i,n){ | ^ a.cc:16:9: error: 'rep' was not declared in this scope 16 | rep(i,n){ | ^~~
s483989285
p03952
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,k;cin>>n>>k; if(k==1 || k==2*n-1){ cout<<"No"<<endl; return 0; } else{ cout<<"Yes"<<endl; if(n==k){ for(int i=1;i<=2*n-1;i++){ cout<<i<<endl; } } else if (k<n){ for(int i=n+k-2;i>=k-1;i--){ cout<<i<<endl;} for(int i=n+k-1;i<=2*n-1;i++){ cout<<i<<endl;} for(int i=1;i<k-1;i++){ cout<<i<<endl;} } else{ for(int i=k-n+2;i<=k+1;i++){ cout<<i<<endl; } for(int i=k-n+1;i>=1;i--){ cout<<i<<endl; } for(int i=k+2;i<=2*n-1;i++){ cout<<i<<endl; } } }
a.cc: In function 'int main()': a.cc:38:2: error: expected '}' at end of input 38 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s864974317
p03952
C++
#include <bits/stdc++.h> #include <stdio.h> using namespace std; int main(){ int N,x; cin>>N>>x; if(x==1 ||x==2*N-1){ cout<<"No"<<endl; } else{ cout<<"Yes"<<endl; int ary[2*N-1]; if(x>=N) { int diff=x-N; int counter=0; for(int i=1+diff; i<=2*N-1; i++) { ary[counter]=i; counter++; } for(int i=1; i<=diff; i++) { ary[counter]=i; counter++; } } else if(x<N) { int first=N+x; int counter=0; for(int i=first; i<=2*N-1; i++) { ary[counter]=i; counter++; } for(int i=1; i<first; i++){ ary[counter]=i; counter++; } } for(int i=0; i<N*2-1; i++) { printf(ary[i]); } } }
a.cc: In function 'int main()': a.cc:39:45: error: invalid conversion from 'int' to 'const char*' [-fpermissive] 39 | printf(ary[i]); | ~~~~~^ | | | int In file included from /usr/include/c++/14/cstdio:42, from /usr/include/c++/14/ext/string_conversions.h:45, from /usr/include/c++/14/bits/basic_string.h:4154, 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, from a.cc:1: /usr/include/stdio.h:363:43: note: initializing argument 1 of 'int printf(const char*, ...)' 363 | extern int printf (const char *__restrict __format, ...); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
s923153721
p03952
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> #include <cstdio> #include <bits/stdc++.h> #include <set> #include <map> #include <stdio.h> #include <stack> #include <queue> #include <deque> #include <numeric> #include <bits/stdc++.h> #include <utility> #include <iomanip> #define ALL(obj) (obj).begin(), (obj).end() #define FOR(i,a,b) for(int i = (a); i < (b); i++) #define RFOR(i,a,b) for(int i = (a); (b) <= i; i--) #define REP(i,n) for(int i = 0; i < (n); i++) #define RREP(i,n) for(int i = n; n <= i; i--) #define ABS(a) ((a < 0) ? ((-1)*(a)) : (a)) #define elif else if #define MOD 1000000007 #define INF (1<<29) using namespace std; #define ld long double #define ll long long map <int ,int> mpa,mpb; typedef pair<ll, ll> P; priority_queue<P, vector<P>, greater<P>> pque; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); int n,x; cin >> n >> x; int N=n; if(x==1 || x=2*N-1){ cout << "No" << endl; return 0; } if(N==2){ cout<<"Yes"<<endl; cout << 1 << endl; cout << 2 << endl; cout << 3 << endl; return 0; } cout<<"Yes"<<endl; if(x>=n){ for(int i=x-n+1;i<=2*n-1;i++) cout<<i<<endl; for(int i=1;i<x-n+1;i++) cout<<i<<endl; }else{ for(int i=n+x-1;i>=1;i--) cout<<i<<endl; for(int i=2*n-1;i>n+x-1;i--) cout<<i<<endl; } }
a.cc: In function 'int main()': a.cc:44:11: error: lvalue required as left operand of assignment 44 | if(x==1 || x=2*N-1){ | ~~~~~^~~~
s105217662
p03952
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> #include <cstdio> #include <bits/stdc++.h> #include <set> #include <map> #include <stdio.h> #include <stack> #include <queue> #include <deque> #include <numeric> #include <bits/stdc++.h> #include <utility> #include <iomanip> #define ALL(obj) (obj).begin(), (obj).end() #define FOR(i,a,b) for(int i = (a); i < (b); i++) #define RFOR(i,a,b) for(int i = (a); (b) <= i; i--) #define REP(i,n) for(int i = 0; i < (n); i++) #define RREP(i,n) for(int i = n; n <= i; i--) #define ABS(a) ((a < 0) ? ((-1)*(a)) : (a)) #define elif else if #define MOD 1000000007 #define INF (1<<29) using namespace std; #define ld long double #define ll long long map <int ,int> mpa,mpb; typedef pair<ll, ll> P; priority_queue<P, vector<P>, greater<P>> pque; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); int n,x; cin >> n >> x; int N=n; if(x==1 || x=2*N-1){ cout << "No" << endl; return 0; } if(N==2){ cout << 1 << endl; cout << 2 << endl; cout << 3 << endl; return 0; } cout<<"Yes"<<endl; if(x>=n){ for(int i=x-n+1;i<=2*n-1;i++) cout<<i<<endl; for(int i=1;i<x-n+1;i++) cout<<i<<endl; }else{ for(int i=n+x-1;i>=1;i--) cout<<i<<endl; for(int i=2*n-1;i>n+x-1;i--) cout<<i<<endl; } }
a.cc: In function 'int main()': a.cc:44:11: error: lvalue required as left operand of assignment 44 | if(x==1 || x=2*N-1){ | ~~~~~^~~~
s090452857
p03952
C++
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define fi first #define se second #define FOR(i, a, b) for(int i=(a);i<(b);i++) #define REP(i, n) FOR(i, 0, n) #define RFOR(i, a, b) for(int i=(a);i>=(b);i--) #define RREP(i, n) RFOR(i, n, 0) #define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++) #define ALL(a) (a).begin(), (a).end() #define SZ(x) ((int)(x).size()) typedef long long int ll; typedef pair<int, int> P; typedef pair<ll, ll> Pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<vll> vvll; const double eps = 1e-10; const int MOD = 1000000007; const int INF = 1000000000; const ll LINF = 1 << 30; template<typename T> void printv(vector<T> const& s) { REP(i, SZ(s)) { cout << s[i] << " "; } cout << endl; } int int main () { cin.tie(0); cout << setprecision(10); int n, x; cin >> n >> x; n = 2*n - 1; n /= 2; n++; if(n-1 <= x && x <= n+1) cout << "Yes" << endl; else cout << "No" << endl; }
a.cc:38:1: error: two or more data types in declaration of 'main' 38 | int | ^~~