submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s188572581 | p03804 | C++ | #include <bits/stdc++.h>
int main(){
int n,m;
cin>>n>>m;
vector<string> a(n),b(m);
for(int i=0; i<n; i++) cin>>a[i];
for(int i=0; i<m; i++) cin>>b[i];
for(int i=0; i<n-m+1; i++){
for(int j=0; j<n-m+1; j++){
bool ok=true;
for(int k=0; k<m; k++){
for(int l=0; l<m; l++){
if(a[i+k][j+l]!=b[k][l]) ok=false;
}
}
if(ok){
cout<<"Yes"<<endl;
return 0;
}
}
}
cout<<"No"<<endl;
} | a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
4 | cin>>n>>m;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:5:5: error: 'vector' was not declared in this scope
5 | vector<string> a(n),b(m);
| ^~~~~~
a.cc:5:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:5:12: error: 'string' was not declared in this scope
5 | vector<string> a(n),b(m);
| ^~~~~~
a.cc:5:12: 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:
/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:5:20: error: 'a' was not declared in this scope
5 | vector<string> a(n),b(m);
| ^
a.cc:5:25: error: 'b' was not declared in this scope
5 | vector<string> a(n),b(m);
| ^
a.cc:17:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
17 | cout<<"Yes"<<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:30: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
17 | cout<<"Yes"<<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)
| ^~~~
a.cc:22:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
22 | cout<<"No"<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:22:17: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
22 | cout<<"No"<<endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s267549540 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
int main() {
ll n, m;
cin >> n >> m;
vector<string> a(n), b(m);
for (ll i = 0; i < n; i++) cin >> a[i];
for (ll i = 0; i < m; i++) cin >> b[i];
for (ll i = 0; i < n - m + 1; i++) {
for (ll j = 0; j < n - m + 1; j++) {
for (ll k = 0; k < m; k++) {
if (b[k] == a[i + k].substr(j, m)) {
if (k == m - 1) {
Yes();
return 0;
}
continue;
}a
else {
No();
return 0;
}
}
}
}
} | a.cc: In function 'int main()':
a.cc:31:11: error: expected ';' before 'else'
31 | }a
| ^
| ;
32 | else {
| ~~~~
|
s676895654 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
string a[n];
string b[m];
for(int i=0;i<n;i++){
cin >> a[i];
}
for(int i=0;i<m;i++){
cin >> b[i];
}
for(int i=0;i<n-m+1;i++){
for(int j=0;j<n-m+1;j++){
for(int k=0;k<m;k++){
for(int u=0;u<m;u++){
if(a[k][m]!=b[])
}
}
}
}
}
| a.cc: In function 'int main()':
a.cc:21:35: error: expected primary-expression before ']' token
21 | if(a[k][m]!=b[])
| ^
a.cc:22:17: error: expected primary-expression before '}' token
22 | }
| ^
|
s681323256 | p03804 | Java | import oracle.jvm.hotspot.jfr.JFRTypeIDs;
import java.io.*;
import java.util.*;
public class Main {
public static final long mod = (long)1e9+7;
public static final long INF = Long.MAX_VALUE/10;
public static final int inf = Integer.MAX_VALUE/10;
static void solve(InputReader in, PrintWriter out){
int n = in.ni(), m = in.ni();
char[][] a = new char[n][n];
char[][] b = new char[m][m];
for (int i = 0; i < n; i++) {
a[i] = in.ns().toCharArray();
}
for (int i = 0; i < m; i++) {
b[i] = in.ns().toCharArray();
}
boolean flag = true;
out:for (int i = 0; i < n - m + 1; i++) {
in:for (int j = 0; j < n - m + 1; j++) {
flag = true;
for (int k = 0; k < m; k++) {
for (int l = 0; l < m; l++) {
if(a[i+k][j+l]!=b[k][l]){
flag = false;
continue in;
}
}
}
if(flag) break out;
}
}
out.println(flag?"Yes":"No");
}
public static void main(String[] args) throws Exception{
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
solve(in, out);
out.close();
}
public static class InputReader{
private BufferedReader br;
private StringTokenizer st;
public InputReader(InputStream is){
br = new BufferedReader(new InputStreamReader(is));
st = null;
}
public String ns(){
if(st == null || !st.hasMoreTokens()){
try{
st = new StringTokenizer(br.readLine());
}catch (Exception e){
throw new RuntimeException(e);
}
}
return st.nextToken();
}
public long nl(){
return Long.parseLong(ns());
}
public int ni(){
return Integer.parseInt(ns());
}
public Double nd(){
return Double.parseDouble(ns());
}
public int[] ni(int n){
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = ni();
}
return a;
}
public long[] nl(int n){
long[] a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = nl();
}
return a;
}
public double[] nd(int n){
double[] a = new double[n];
for (int i = 0; i < n; i++) {
a[i] = nd();
}
return a;
}
}
} | Main.java:1: error: package oracle.jvm.hotspot.jfr does not exist
import oracle.jvm.hotspot.jfr.JFRTypeIDs;
^
1 error
|
s830412347 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m ; cin >> n >> m;
vector<vector<int>> a(n,vector<int> (n));
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin >> a.at(i).at(j);
}
}
vector<vector<int>> b(m,vector<int> (m));
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
cin >> b.at(i).at(j) ;
}
}
bool exist = false;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(n-i+1<m || n-j+1<m) continue;
bool match = true;
for(int k=0;k<m;k++){
for(int l=0;l<m;l++){
if(a.at(i+k).at(j+l) != b.at(k).at(l)){
match = false;
}
}
}
if(macth) exist = true;
}
}
if(exist){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
} | a.cc: In function 'int main()':
a.cc:33:14: error: 'macth' was not declared in this scope; did you mean 'match'?
33 | if(macth) exist = true;
| ^~~~~
| match
|
s725159884 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m ; cin >> n >> m;
vector<vector<int>> a(n,vector<int> (n));
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin << a.at(i).at(j);
}
}
vector<vector<int>> b(m,vector<int> (m));
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
cin << b.at(i).at(j) ;
}
}
bool exist = false;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(n-i+1<m || n-j+1<m) continue;
bool match = true;
for(int k=0;k<m;k++){
for(int l=0;l<m;l++){
if(a.at(i+k).at(j+l) != b.at(k).at(l)){
match = false;
}
}
}
if(macth) exist = true;
}
}
if(exist){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
} | a.cc: In function 'int main()':
a.cc:9:11: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
9 | cin << a.at(i).at(j);
| ~~~ ^~ ~~~~~~~~~~~~~
| | |
| | __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
| std::istream {aka std::basic_istream<char>}
a.cc:9:11: note: candidate: 'operator<<(int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int})' (built-in)
9 | cin << a.at(i).at(j);
| ~~~~^~~~~~~~~~~~~~~~
a.cc:9:11: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)'
1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << a.at(i).at(j);
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:9:7: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
9 | cin << a.at(i).at(j);
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << a.at(i).at(j);
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << a.at(i).at(j);
| ^
/usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)'
1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << a.at(i).at(j);
| ^
In file included 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/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << a.at(i).at(j);
| ^
In file included from /usr/include/c++/14/memory:80,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56:
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)'
70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << a.at(i).at(j);
| ^
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:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << a.at(i).at(j);
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << a.at(i).at(j);
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
9 | cin << a.at(i).at(j);
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
9 | cin << a.at(i).at(j);
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
9 | cin << a.at(i).at(j);
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << a.at(i).at(j);
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:9:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
9 | cin << a.at(i).at(j); |
s845140654 | p03804 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX(a,b) (a > b) ? a : b
#define MIN(a,b) (a < b) ? a : b
const int inf = 1000000000; // 10^9
int main(){
int n,m;scanf("%d %d",&n,&m);
char a[51][51];for(int i = 0;i < n;i++)scanf("%s",a[i]);
char b[51][51];for(int i = 0;i < m;i++)scanf("%s",b[i]);
int match = 1;
//int count = 0;
//printf("n:%d m:%d\n",n,m);
for(int i = 0;i < (n-m);i++){
for(int j = 0;j < (n-m);j++){
for(int k = 0;k < m;k++){
for(int l = 0;l < m;l++){
//printf("i:%dj:%dk:%dl:%d\n",i,j,k,l);
if(a[k][l] != b[i+k][j+l])match--;
if(flag == 1)break;
//count++;
}
if(flag == 1)break;
}
if(flag == 1)break;
}
if(flag == 1)break;
}
//printf("%d\n",count);
if(match == 1)printf("Yes\n");
else printf("No\n");
} | main.c: In function 'main':
main.c:22:19: error: 'flag' undeclared (first use in this function)
22 | if(flag == 1)break;
| ^~~~
main.c:22:19: note: each undeclared identifier is reported only once for each function it appears in
|
s161590972 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
bool ans = false;
int N,M;
cin >> N >> M;
vector<vector<char> > A(N, vector<char>(N));
vector<vector<char> > B(M, vector<char>(M));
vector<vector<bool> > F(N - M + 1, vector<bool>(N - M + 1,true));
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
cin >> A[i][j];
}
}
for (int i = 0; i < M; i++) {
for (int j = 0; j < M; j++) {
cin >> B[i][j];
}
}
for (int i = 0; i < N - M + 1; i++) {
for (int j = 0; j < N - M + 1; j++) {
for (int k = 0; k < M; k++) {
for (int l = 0; l < M; l++) {
if (A[i + k][j + l] != B[k][l]) {
F[i][j] = false;
}
}
}
}
}
}
for (int i = 0; i < N - M + 1; i++) {
for (int j = 0; j < N - M + 1; j++) {
if (F[i][j] == true) {
ans = true;
}
}
}
}
if (ans) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
} | a.cc:32:3: error: expected unqualified-id before 'for'
32 | for (int i = 0; i < N - M + 1; i++) {
| ^~~
a.cc:32:19: error: 'i' does not name a type
32 | for (int i = 0; i < N - M + 1; i++) {
| ^
a.cc:32:34: error: 'i' does not name a type
32 | for (int i = 0; i < N - M + 1; i++) {
| ^
a.cc:39:3: error: expected declaration before '}' token
39 | }
| ^
a.cc:40:3: error: expected unqualified-id before 'if'
40 | if (ans) cout << "Yes" << endl;
| ^~
a.cc:41:3: error: expected unqualified-id before 'else'
41 | else cout << "No" << endl;
| ^~~~
a.cc:42:3: error: expected unqualified-id before 'return'
42 | return 0;
| ^~~~~~
a.cc:43:1: error: expected declaration before '}' token
43 | }
| ^
|
s664394238 | p03804 | C++ | #include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
int n;
cin >> n;
vector<string> a(n),b(m);
rep(i,n) cin >> a[i];
rep(i,m) cin >> b[i];
rep(i,n-m+1) {
rep(j,n-m+1) {
bool same = true;
rep(k,m) {
if(a[i+k].substr(j,m) != b[k]) same = false;
}
if(same) {
cout << "Yes" << endl;
return 0;
}
}
}
cout << "No" << endl;
} | a.cc: In function 'int main()':
a.cc:12:27: error: 'm' was not declared in this scope
12 | vector<string> a(n),b(m);
| ^
|
s308766607 | p03804 | C++ | #include<iostream>
#include<vector>
using namespace std ;
int main(){
using vc = vector<char> ;
using vcc = vector<vc> ;
int n,m ;
cin >> n >> m ;
vcc a(n,vc(n)) ;
vcc b(m.vc(m)) ;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin >> a.at(i).at(j) ;
}
}
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
cin >> b.at(i).at(j) ;
}
}
for(int i=0;i<n-m+1;i++){
for(int j=0;j<n-m+1;j++){
bool ok = true ;
for(int k=0;k<m;k++){
for(int l=0;l<m;l++){
if(a.at(k+i).at(l+j)!=b.at(k).at(l)) ok =false ;
}
}
if(ok){
cout << "Yes" << endl ;
return 0 ;
}
}
}
cout << "No" << endl ;
} | a.cc: In function 'int main()':
a.cc:11:17: error: request for member 'vc' in 'm', which is of non-class type 'int'
11 | vcc b(m.vc(m)) ;
| ^~
|
s451854726 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define sz(c) int(c.size())
#define clr(v, d) memset(v, d, sizeof(v))
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define INF INT64_MAX
#define NINF INT64_MIN
#define ROW 1001
#define COL 1001
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<pll> vll;
typedef vector<ll> vl;
vector<string> A(50),B(50);
int n,m;
bool findBinA(int start)
{
loop(i,m)
{
loop(j,m)
{
if(B[i][j]!=A[i][j])
return false;
}
}
return true;
}
int main(void){
cin>>n;
cin>>m4 1
....
....
....
....
#;
loop(i,n)
cin>>A[i];
loop(i,m)
cin>>B[i];
loop(i,n-m)
{
loop(j,n-m)
{
if(findBinA(j))
{
cout<<"YES"<<endl;
return 0;
}
}
}
cout<<"NO"<<endl;
return 0;
}
| a.cc:52:14: error: invalid preprocessing directive #;
52 | #;
| ^
a.cc: In function 'int main()':
a.cc:47:10: error: 'm4' was not declared in this scope; did you mean 'm'?
47 | cin>>m4 1
| ^~
| m
a.cc:53:10: error: 'i' was not declared in this scope; did you mean 'vi'?
53 | loop(i,n)
| ^
a.cc:4:34: note: in definition of macro 'loop'
4 | #define loop(i, n) for(int i = 0;i < int(n);i++)
| ^
|
s456250512 | p03804 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <queue>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <set>
#include <map>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repl(i, n) for(LL i = 0; i < (LL)(n); i++)
int main(void){ | a.cc: In function 'int main()':
a.cc:23:16: error: expected '}' at end of input
23 | int main(void){
| ~^
|
s002847122 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,M,l;
cin>>N>>M;
vector<vector<char>>A(N,vector<char>N),B(N,vector<char>N);
for(int i=0;i<N;i++)for(int j=0;j<N;j++)cin>>A.at(i).at(j);
for(int i=0;i<M;i++)for(int j=0;j<M;j++)cin>>A.at(i).at(j);
for(int i=0;i<N-M;i++){
for(int j=0;j<N-M;j++){
for(int k=0;k<M;k++){
for(l=0;l<M;l++)if(A.at(i+k).at(j+l)==B.at(k).at(l))break;
if(l!=M)break;
}
if(l==M)break;
}
if(l==M)break;
}
if(l==M)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
} | a.cc: In function 'int main()':
a.cc:7:39: error: expected primary-expression before 'N'
7 | vector<vector<char>>A(N,vector<char>N),B(N,vector<char>N);
| ^
a.cc:7:58: error: expected primary-expression before 'N'
7 | vector<vector<char>>A(N,vector<char>N),B(N,vector<char>N);
| ^
|
s429731808 | p03804 | C++ | #include<bits/stdc++.h>
#include<string>
using namespace std;
int main(){
int N,M,k,l;
cin>>N>>M;
vector<string>A(N),B(M);
for(int i=0;i<N;i++)cin>>A.at(i);
for(int i=0;i<M;i++)cin>>B.at(i);
for(int i=0;i<N-M;i++){
for(int j=0;j<N-M;j++){
for(k=0;k<M;k++){
for(l=0;l<M;l++){
if(A.at(i+k).at(j+l))!=B.at(k).at(l))break;
}
if(l!=M)break;
}
if(k!=M)break;
}
if(k==M)break;
}
if(k==M)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
} | a.cc: In function 'int main()':
a.cc:14:32: error: expected primary-expression before '!=' token
14 | if(A.at(i+k).at(j+l))!=B.at(k).at(l))break;
| ^~
|
s699220103 | p03804 | C++ | #include<bits/stdc++.h>
#include<string>
using namespace std;
int main(){
int N,M,k;
cin>>N>>M;
vector<string>A(N),B(M);
for(int i=0;i<N;i++)cin>>A.at(i);
for(int i=0;i<M;i++)cin>>B.at(i);
for(int i=0;i<N-M;i++){
for(int j=0;j<N-M;j++){
for(k=0;k<M;k++){
if(A.at(i+k).substr(j,M))!=B.at(i+k))break;
}
if(k==M)break;
}
if(k==M)break;
}
if(k==M)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
} | a.cc: In function 'int main()':
a.cc:13:28: error: could not convert '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](((std::__cxx11::basic_string<char>::size_type)j), ((std::__cxx11::basic_string<char>::size_type)M))' from 'std::__cxx11::basic_string<char>' to 'bool'
13 | if(A.at(i+k).substr(j,M))!=B.at(i+k))break;
| ~~~~~~~~~~~~~~~~^~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:13:34: error: expected primary-expression before '!=' token
13 | if(A.at(i+k).substr(j,M))!=B.at(i+k))break;
| ^~
|
s701926427 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
vector<vector<char>> A(a,vector<char>(a));
vector<vector<char>> B(b,vector<char>(b));
for(int i=0;i<a;i++)
cin >> A.at(i);
for(int i=0;i<b;i++)
cin >> b.at(i);
bool result = false;
for(int ai = 0;ai< a-b+1;ai++){
for(int aj = 0;aj < a-b+1;aj++){
bool match = true;
for(int i = 0;i<b;i++){
for(int j = 0;j<b;j++){
if(A.at(ai).at(aj) != B.at(i).at(j)){
match = false;
break;
}
if(match == false)
break;
}
}
if(match == true){
result = true;
break;
}
}
}
if(result == true)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | a.cc: In function 'int main()':
a.cc:9:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'})
9 | cin >> A.at(i);
| ~~~ ^~ ~~~~~~~
| | |
| | __gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type {aka std::vector<char>}
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'bool&'
170 | operator>>(bool& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'short int&'
174 | operator>>(short& __n);
| ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'short unsigned int&'
177 | operator>>(unsigned short& __n)
| ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'int&'
181 | operator>>(int& __n);
| ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'unsigned int&'
184 | operator>>(unsigned int& __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'long int&'
188 | operator>>(long& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'long unsigned int&'
192 | operator>>(unsigned long& __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'long long int&'
199 | operator>>(long long& __n)
| ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'long long unsigned int&'
203 | operator>>(unsigned long long& __n)
| ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: |
s976067088 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,m;
cin >> n >> m;
vector<string> a(n),b(m);
for(int i=0; i<n; i++){
cin >> a[i];
}
for(int i=0; i<m; i++){
cin >> b[i];
}
bool a = false;
for(int i=0; i<n-m+1; i++){
for(int j=0; j<n-m+1; j++){
if(a[i].substr(j,m)==b[0]){
for(int k=1; k<m; k++){
if(a[i+k].substr(j,m)!=b[k]) break;
}
cout << "Yes" << endl;
return;
}
}
}
cout << "No" << endl;
} | a.cc: In function 'int main()':
a.cc:17:8: error: conflicting declaration 'bool a'
17 | bool a = false;
| ^
a.cc:9:18: note: previous declaration as 'std::vector<std::__cxx11::basic_string<char> > a'
9 | vector<string> a(n),b(m);
| ^
a.cc:25:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
25 | return;
| ^~~~~~
|
s425432866 | p03804 | C++ | #include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;
int main() {
int n, m;
cin >> n >> m;
bool b = 1;
vector<vector<char>> a(n, vector<char>(n)), b(m, vector<char>(m));
rep(i, n){
string s;
cin >> s;
rep(j, n) a[i][j] = s[j];
}
rep(i, m){
string s;
cin >> s;
rep(j, m) b[i][j] = s[j];
}
rep(i, n-m){
rep(j, n-m){
b = 1;
rep(k, m){
rep(l, m){
if(a[i+k][j+l] != b[k][l]){
b = 0;
break;
}
}
if(!b) break;
}
if(b) break;
}
if(b) break;
}
if(b) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:47: error: conflicting declaration 'std::vector<std::vector<char> > b'
10 | vector<vector<char>> a(n, vector<char>(n)), b(m, vector<char>(m));
| ^
a.cc:9:8: note: previous declaration as 'bool b'
9 | bool b = 1;
| ^
a.cc:19:16: error: invalid types 'bool[int64_t {aka long int}]' for array subscript
19 | rep(j, m) b[i][j] = s[j];
| ^
a.cc:26:30: error: invalid types 'bool[int64_t {aka long int}]' for array subscript
26 | if(a[i+k][j+l] != b[k][l]){
| ^
|
s329363504 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,M;
cin>>N>>M;
vector<string> A(N),B(M);
for(int i=0;i<N;i++){
cin>>A.at(i);
}
for(int i=0;i<M;i++){
cin>>B.at(i);
}
bool flag=false;
for(int i=0;i<N-M+1){
for(int j=0;j<N-M+1){
bool flag=true;
for(int k=0;k<M;k++){
for(int l=0;l<M;l++){
if(A.at(i+k).at(j+l)!=B.at(k).at(l)){
flag=false;
break;
}
}
if(!flag){
break;
}
}
if(flag){
break;
}
}
if(flag){
break;
}
}
if(flag){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
} | a.cc: In function 'int main()':
a.cc:16:22: error: expected ';' before ')' token
16 | for(int i=0;i<N-M+1){
| ^
| ;
a.cc:17:24: error: expected ';' before ')' token
17 | for(int j=0;j<N-M+1){
| ^
| ;
|
s748556426 | p03804 | C++ | int main(void){
int N,M;
cin >> N >> M;
const int nmmax=50;
char A[nmmax][nmmax],B[nmmax][nmmax];
for(int y=0;y<N;++y){
for(int x=0;x<N;++x){
cin >> A[y][x];
}
}
for(int y=0;y<M;++y){
for(int x=0;x<M;++x){
cin >> B[y][x];
}
}
bool exist=false;
for(int ly=0;ly<N;++ly){
for(int lx=0;lx<N;++lx){
if(ly+M-1>=N or lx+M-1>=N) continue;
bool match=true;
for(int y=0;y<M;++y){
for(int x=0;x<M;++x){
if(A[ly+y][lx+x]!=B[y][x]) match=false;
}
}
if(match) exist=true;
}
}
if(exist)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:3:2: error: 'cin' was not declared in this scope
3 | cin >> N >> M;
| ^~~
a.cc:38:2: error: 'cout' was not declared in this scope
38 | cout << "Yes" << endl;
| ^~~~
a.cc:38:19: error: 'endl' was not declared in this scope
38 | cout << "Yes" << endl;
| ^~~~
a.cc:40:2: error: 'cout' was not declared in this scope
40 | cout << "No" << endl;
| ^~~~
a.cc:40:18: error: 'endl' was not declared in this scope
40 | cout << "No" << endl;
| ^~~~
|
s375429139 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int N, M;
cin>>N>>M;
int a[N][N], b[M][M];
for(int i = 0; i < N; i++)
for(int j = 0; j < N; j++)
cin>>a[i][j];
for(int i = 0; i < M; i++)
for(int j = 0; j < M; j++)
cin>>b[i][j];
bool exist=false;
for(int ly=0;ly<N;++ly){
for(int lx=0;lx<N;++lx){
if(ly+M-1>=N or lx+M-1>=N) continue;
bool match=true;
for(int y=0;y<M;++y){
for(int x=0;x<M;++x){
if(a[ly+y][lx+x]!=b[y][x]) match=false;
}
}
if(match) exist=true;
}
}
if(exist)
cout << "Yes" << endl;
else
cout << "No" << endl; | a.cc: In function 'int main()':
a.cc:34:23: error: expected '}' at end of input
34 | cout << "No" << endl;
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s782455028 | p03804 | C | #include <cstdio>
#include <iostream>
using namespace std;
char N[55][55],M[55][55];
int n,m;
bool isSame(int startX, int startY)
{
for(int k=1;k<=m;k++)
for(int l=1;l<=m;l++)
if(N[startX+k-1][startY+l-1]!=M[k][l])
return false;
return true;
}
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
cin>>N[i][j];
for(int i=1;i<=m;i++)
for(int j=1;j<=m;j++)
cin>>M[i][j];
for(int i=1;i<=n-m+1;i++)
for(int j=1;j<=n-m+1;j++)
if(isSame(i,j))
{
printf("Yes\n");
return 0;
}
printf("No\n");
return 0;
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s887253446 | p03804 | C++ | #include<iostream>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
char s[55][55];
char t[55][55];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> s[i][j];
}
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
cin >> t[i][j];
}
}
bool flag = true;
for (int a = 0; a < n - m + 1; a++) {
for (int b = 0; b < n - m + 1; b++) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
if (s[i + a][j + b] != t[i][j]) {
flag = false;
}
}
}
if (flag) {
cout << "Yes" << endl;
return 0;
}
}
}
cout << "No" << endl;
return 0; | a.cc: In function 'int main()':
a.cc:39:18: error: expected '}' at end of input
39 | return 0;
| ^
a.cc:3:12: note: to match this '{'
3 | int main() {
| ^
|
s934413361 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N,M;cin >> N >> M;
char A[N][N],B[M][M];
REP(i,N) REP(j,N) cin >> A[i][j];
REP(i,M) REP(j,M) cin >> B[i][j];
REP(i,N- k) REP(j,N - M){
REP(k,M) REP(l,M){
if(A[i+k][j+l] != B[k][l]) break;
if(k == M-1 && l == M-1){
cout << "Yes" << endl;
return 0;
}
}
}
cout << "No" << endl;
} | a.cc: In function 'int main()':
a.cc:23:14: error: 'k' was not declared in this scope
23 | REP(i,N- k) REP(j,N - M){
| ^
a.cc:4:38: note: in definition of macro 'REP'
4 | #define REP(i,n) for(long long i=0;i<n;++i)
| ^
|
s266981630 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
long int pow107 = (int)pow(10, 9) + 7;
bool comp(pair<int, string> a, pair<int, string> b){
if(a.first != b.first) return a.first > b.first;
else return a.second < b.second;
}
long int jou(long int x, long int y){
long int f = 1;
for(int i = 0; i < y; ++i){
f = f * x % pow107;
}
return f;
}
bool pn(long int x){
if(x != 2 && x % 2 == 0)
return false;
for(int i = 3; i < x; ++i){
if(x != i && x % i == 0)
return false;
}
return true;
}
long int factorial(long int n){
long int f = 1;
for(long int i = 1; i <= n; ++i){
f = f * i % pow107;
}
return f;
}
int main(){
int N,M;
cin >> N >> M;
const int nmmax=50;
char A[nmmax][nmmax],B[nmmax][nmmax];
for(int y=0;y<N;++y){
for(in x=0;x<N;++x){
cin >> A[y][x];
}
}
for(int y=0;y<M;++y){
for(int x=0;x<M;++x){
cin >> B[y][x];
}
}
bool exist=false;
for(int ly=0;ly<N;++ly){
for(int lx=0;lx<N;++lx){
if(ly+M-1>=N or lx+M-1>=N) continue;
bool match=true;
for(int y=0;y<M;++y){
for(int x=0;x<M;++x){
if(A[ly+y][lx+x]!=B[y][x]) match=false;
}
}
if(match) exist=true;
}
}
if(exist)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:46:6: error: 'in' was not declared in this scope; did you mean 'yn'?
46 | for(in x=0;x<N;++x){
| ^~
| yn
a.cc:46:13: error: 'x' was not declared in this scope
46 | for(in x=0;x<N;++x){
| ^
a.cc: At global scope:
a.cc:80:4: error: expected unqualified-id before 'return'
80 | return 0;
| ^~~~~~
a.cc:81:1: error: expected declaration before '}' token
81 | }
| ^
|
s900203998 | p03804 | C++ | #include <bits/stdc++.h>
#define mod 1000000007
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
int main(void){
int M, N;
cin >> M >> N;
int A[N][M], B[N][M];
rep(i, N)
rep(j, N)
cin >> A[i][j];
rep(i, M)
rep(j, M)
cin >> B[i][j];
rep(i, N){
rep(j, N){
if(i + M - 1 >= N || j + M - 1 >= N)
continue;
bool match = true;
rep(k, M)
rep(l, M)
if(A[i + k][j + l] != B[k][l])
match = false;
if(match)
exist = true;
}
}
if(exist)
cout << "Yes";
else
cout << "No";
return 0;
} | a.cc: In function 'int main()':
a.cc:37:33: error: 'exist' was not declared in this scope; did you mean 'exit'?
37 | exist = true;
| ^~~~~
| exit
a.cc:41:12: error: 'exist' was not declared in this scope; did you mean 'exit'?
41 | if(exist)
| ^~~~~
| exit
|
s700788722 | p03804 | C++ | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
int n,m;cin>>n>>m;
vector<string> a(n);
for(int i=0;i<n;++i)cin>>a[i];
vector<string> b(m);
for(int i=0;i<m;++i)cin>>b[i];
for(int i=0;i<n-m+1;++i)
{
for(int j=0;j<n-m+1;++j)
{
for(int k=0;k<m;++k)
{
bool match==true;
for(int l=0;l<m;++l)
{
//cout<<a[i+k][j+l]<<b[k][l]<<endl;
if(a[i+k][j+l]!=b[k][l]){
match=false;
break;
}
}
if(match)
{
cout<<"Yes"<<endl;
return 0;
}
}
}
}
cout<<"No"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:43: error: expected initializer before '==' token
20 | bool match==true;
| ^~
a.cc:25:49: error: 'match' was not declared in this scope; did you mean 'rpmatch'?
25 | match=false;
| ^~~~~
| rpmatch
a.cc:29:36: error: 'match' was not declared in this scope; did you mean 'rpmatch'?
29 | if(match)
| ^~~~~
| rpmatch
|
s306077505 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,M;
cin >> N >> M;
char A[50][50],B[50][50];
for(int i=0;i<N;++i){
for(int j=0;j<N;++j)
cin >> A[i][j];
}
for(int i=0;i<M;++i){
for(int j=0;j<M;++j)
cin >> B[i][j];
}
bool abcde =false;
for(int i=0;i<=N;i++){
for(int j=0;j<=N;j++){
if(i+M-1>=N or j+M-1>=N) continue;
bool abc=true;
for(int h=0;h<M;h++){
for(int k=0;k<M;k++){
if(A[i+h][j+k]!=B[h][k]){
abc = false;
}
}
if(abc) abcde =true;
}
}
if(abcde){
cout<<"Yes"<< endl;
return 0;
}
else{
cout<<"No"<< endl;
return 0;
}
}
| a.cc: In function 'int main()':
a.cc:43:2: error: expected '}' at end of input
43 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s944975428 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,M;
cin >> N >> M;
char A[50][50],B[50][50];
for(int i=0;i<N;++i){
for(int j=0;j<N;++j)
cin >> A[i][j];
}
for(int i=0;i<M;++i){
for(int j=0;j<M;++j)
cin >> B[i][j];
}
bool abcde =false;
for(int i=0;i<=N;i++){
for(int j=0;j<=N;j++){
if(i+M-1>=N or j+M-1>=N) continue;
bool abc=true;
for(int h=0;h<M;h++){
for(int k=0;k<M;k++){
if(A[i+h][j+k]!=B[h][k]){
abc = false;
}
}
if(abc) abcde =true;
}
if(abcde){
cout<<"Yes"<< endl;
return 0;
}
}
else{
cout<<"No"<< endl;
return 0;
}
}
| a.cc: In function 'int main()':
a.cc:37:3: error: 'else' without a previous 'if'
37 | else{
| ^~~~
a.cc:41:2: error: expected '}' at end of input
41 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s833968905 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,M;
cin >> N >> M;
char A[50][50],B[50][50];
for(int i=0;i<N;++i){
for(int j=0;j<N;++j)
cin >> A[i][j];
}
for(int i=0;i<M;++i){
for(int j=0;j<M;++j)
cin >> B[i][j];
}
bool abcde =false;
for(int i=0;i<=N;i++){
for(int j=0;j<=N;j++){
if(i+M-1>=N or j+M-1>=N) continue;
bool abc=true;
for(int h=0;h<M;h++){
for(int k=0;k<M;k++){
if(A[i+h][j+k]!=B[h][k]){
abc = false;
}
}
if(abc) abcde =true;
}
if(abcde){
cout<<"Yes"<< endl;
return 0;
}
}
}
else{
cout<<"No"<< endl;
return 0;
}
}
| a.cc: In function 'int main()':
a.cc:37:3: error: 'else' without a previous 'if'
37 | else{
| ^~~~
|
s778191367 | p03804 | C++ | #include <iostream> | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s432029727 | p03804 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n,m;
cin >> n >> m;
vector<string> a(n);
vector<string> b(n);
for( int i = 0; i < n; i++ )
{
cin >> a[i];
}
for( int i = 0; i < n; i++ )
{
cin >> b[i];
}
bool ok = false;
for( int i = 0; i < n; i++ )
{
for ( int j = 0; j < n - m + 1; j++ )
{
string substr = a[i].substring(j,j+m-1);
if( substr == b[i] )
{
for( int k = i+1; k < i+m; k++ )
{
substr = a[k].substring(j,j+m-1);
if( substr != b[k] )
{
ok = false;
}
}
if(ok)
{
cout << "Yes" << endl;
return 0;
}
}
}
}
cout << "No" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:25:28: error: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'substring'; did you mean 'substr'?
25 | string substr = a[i].substring(j,j+m-1);
| ^~~~~~~~~
| substr
a.cc:30:25: error: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'substring'; did you mean 'substr'?
30 | substr = a[k].substring(j,j+m-1);
| ^~~~~~~~~
| substr
|
s173264635 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
int main() {
int N, M;
cin >> N >> M;
vector<string> A(N);
vector<string> B(M);
for (int i = 0; i < N; i++){
cin >> A[i];
}
for (int i = 0; i < M; i++){
cin >> B[i];
}
bool flag = true;
for (int i = 0; i + M < N; i++){
for (int j = 0; j + M < N; j++) {
for (int k = 0; k < M; k++){
for (int l = 0; l < M; l++){
if A[i+k][j+l] != A[k][l]{
flag = false;
break;
}
if (flag == false){
break;
}
}
if (flag == false) {
break;
}
}
if (flag) {
break;
}
}
if(flag){
break;
}
}
if (flag) {
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
}
| a.cc: In function 'int main()':
a.cc:23:24: error: expected '(' before 'A'
23 | if A[i+k][j+l] != A[k][l]{
| ^
| (
|
s126882016 | p03804 | C++ | #include<iostream>
#include<sstream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int sz=110;
string s[sz],cmp[sz];
int a,b;
bool solve()
{
rep(i,a-b)
{
rep(j,a-b)
{
if(s[i][j]==cmp[0][0])
{
bool ok=1;
rep(k,b)
{
rep(l,b)
{
if(s[i+k][j+l]!=cmp[k][l])
{
ok=0;
break;
}
}
}
if(ok)return 1;
}
}
}
return 0||s==cmp;
}
main()
{
cin.tie(0);
ios::sync_with_stdio(0);
cin>>a>>b;
rep(i,a)cin>>s[i];
rep(i,b)cin>>cmp[i];
puts("No");
return 0;
}#include<iostream>
#include<sstream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int sz=110;
string s[sz],cmp[sz];
int a,b;
bool solve()
{
rep(i,a-b)
{
rep(j,a-b)
{
if(s[i][j]==cmp[0][0])
{
bool ok=1;
rep(k,b)
{
rep(l,b)
{
if(s[i+k][j+l]!=cmp[k][l])
{
ok=0;
break;
}
}
}
if(ok)return 1;
}
}
}
return 0||s==cmp;
}
main()
{
cin.tie(0);
ios::sync_with_stdio(0);
cin>>a>>b;
rep(i,a)cin>>s[i];
rep(i,b)cin>>cmp[i];
puts("No");
return 0;
} | a.cc:44:2: error: stray '#' in program
44 | }#include<iostream>
| ^
a.cc:35:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
35 | main()
| ^~~~
a.cc:44:3: error: 'include' does not name a type
44 | }#include<iostream>
| ^~~~~~~
a.cc:49:11: error: redefinition of 'const int sz'
49 | const int sz=110;
| ^~
a.cc:6:11: note: 'const int sz' previously defined here
6 | const int sz=110;
| ^~
a.cc:50:8: error: redefinition of 'std::string s [110]'
50 | string s[sz],cmp[sz];
| ^
a.cc:7:8: note: 'std::string s [110]' previously declared here
7 | string s[sz],cmp[sz];
| ^
a.cc:50:14: error: redefinition of 'std::string cmp [110]'
50 | string s[sz],cmp[sz];
| ^~~
a.cc:7:14: note: 'std::string cmp [110]' previously declared here
7 | string s[sz],cmp[sz];
| ^~~
a.cc:51:5: error: redefinition of 'int a'
51 | int a,b;
| ^
a.cc:8:5: note: 'int a' previously declared here
8 | int a,b;
| ^
a.cc:51:7: error: redefinition of 'int b'
51 | int a,b;
| ^
a.cc:8:7: note: 'int b' previously declared here
8 | int a,b;
| ^
a.cc:52:6: error: redefinition of 'bool solve()'
52 | bool solve()
| ^~~~~
a.cc:9:6: note: 'bool solve()' previously defined here
9 | bool solve()
| ^~~~~
a.cc:78:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
78 | main()
| ^~~~
a.cc:78:1: error: redefinition of 'int main()'
a.cc:35:1: note: 'int main()' previously defined here
35 | main()
| ^~~~
|
s542920671 | p03804 | C++ | include<iostream>
main()
{
iostream::cout<<"No"<<'\n';
return 0;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
|
s768401336 | p03804 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
vector<vector<char>> I(N, vector<char>(N,'x'));
vector<vector<char>> P(M, vector<char>(M,'x'));
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++) cin >> I[i][j];
}
for(int i = 0; i < M; i++){
for(int j = 0; j < M; j++) cin >> P[i][j];
}
bool f = true;
for(int sx = 0; sx < N; sx++){
for(int sy = 0; sy < N; sy++){
f = true;
for(int i = 0; i < M; i++){
for(int j = 0; j < M;j++){
if(I[sx+i][sy+j] != P[i}[j]){
f = false;
}
}
}
if(f) break;
}
if(f)break;
}
if(f) cout << "Yes";
else cout << "No";
} | a.cc: In function 'int main()':
a.cc:26:34: error: expected ']' before '}' token
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
| ]
a.cc:26:28: error: no match for 'operator!=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'})
26 | if(I[sx+i][sy+j] != P[i}[j]){
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)'
197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'const std::fpos<_StateT>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)'
243 | operator!=(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'const std::allocator<_CharT>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
455 | operator!=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
500 | operator!=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1686 | operator!=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1753 | operator!=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
651 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
/usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
658 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
/usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: 'std::vector<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3847 | operator!=(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'const _CharT*' and 'char'
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2613 | operator!=(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed:
a.cc:26:34: note: mismatched types 'const std::tuple<_UTypes ...>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
26 | if(I[sx+i][sy+j] != P[i}[j]){
| ^
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basi |
s317452595 | p03804 | C++ | #include <isotream>
#include <vector>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
vector<vector<char>> I(N,vector<char>(N,'x'));
vector<vector<char>> P(M,vector<char>(M,'x'));
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++) cin >> I[i][j];
}
for(int i = 0; i < M; i++){
for(int j = 0; j < M; j++) cin >> P[i][j];
}
bool ans = false;
bool f = false;
for(int si = 0; si < N - M; si++){
for(int sj = 0; sj < N - M; sj++){
if(I[si][sj] == P[0][0] && I[si+M-1][sj+M-1] == P[M-1][M-1]){
f = false;
for(int a = 0; a < M; a++){
for(int b = 0; b < M; b++){
if(I[si+a][sj+b] != P[a][b]){
f = true;
break;
}
}
if(!f) ans = true;
}
}
}
}
if(ans) cout << "Yes";
else cout << "No";
} | a.cc:1:10: fatal error: isotream: No such file or directory
1 | #include <isotream>
| ^~~~~~~~~~
compilation terminated.
|
s301238347 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a;
cin>>a;
vector<vector<char>> origin(a,vector<char>(a));
for(int i=0;i<a;i++){
for(int j=0;j<a;j++){
cin>>origin[i][j];
}
}
int b;
cin>>b;
vector<vector<char>> cover(b,vector<char>(b));
for(int i=0;i<b;i++){
for(int j=0;j<b;j++){
cin>>cover[i][j];
}
}
int count1=0,count2=0;
while(count2<=a-b){
bool flag=false;
for(int i=0;i<b;i++){
for(int j=0;j<b;j++){
if(cover[i][j]!=origin[i+count1][j+count2]){
count1++;
if(count1==a-b){
count1=0;
count2++;
}
flag=true;
break;
}
}
if(flag) break;
if(j==b-1) {
cout<<"Yes"<<endl;
return 0;
}
}
}
cout<<"No"<<endl;
} | a.cc: In function 'int main()':
a.cc:37:10: error: 'j' was not declared in this scope
37 | if(j==b-1) {
| ^
|
s832562056 | p03804 | C++ | #include <iostream>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
int a[50][50];
int b[50][50];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> a[i][j];
}
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
cin >> b[i][j];
}
}
bool ans = true;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k < n; k++) {
for (int l = 0; l < n; l++) {
if (a[i+k][j+l] != b[k][l]) {
ans = false;
}
}
}
}
}
if (ans) {
cout << "Yes":
}
else {
cout << "No";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:38:18: error: expected ';' before ':' token
38 | cout << "Yes":
| ^
| ;
|
s501025786 | p03804 | C++ | #include<bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
int N, M;
int main () {
cin >> N >> M;
vector<string> A(N);
vector<string> B(M);
for (int i = 0; i < N; i++){
cin >> A[i];
}
for (int i = 0; i < M; i++){
cin >> B[i];
}
int count = 0;
for (int i = 0; i < N-M+1; i++){
for (int j = 0; j < N-M+1; j++){
bool f = true;
for (int k = 0; k < M; k++){
for (int l = 0; l < M; l++){
if ((A[i+k][j+l]) != (B[k][l])){
f = false;
}
}
}
if(f){
cout << "Yes" << endl;
return 0;
}
}
}
cout << "No" << endl;
return 0;
}
| a.cc:27:28: error: extended character is not valid in an identifier
27 | if ((A[i+k][j+l]) != (B[k][l])){
| ^
a.cc: In function 'int main()':
a.cc:27:28: error: expected ')' before '\U00003000'
27 | if ((A[i+k][j+l]) != (B[k][l])){
| ~ ^~
| )
|
s841170656 | p03804 | C++ | #include<bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
int N, M;
int main () {
cin >> N >> M;
vector<string> A(N);
vector<string> B(M);
for (int i = 0; i < N; i++){
cin >> A[i];
}
for (int i = 0; i < M; i++){
cin >> B[i];
}
int count = 0;
for (int i = 0; i < N-M+1; i++){
for (int j = 0; j < N-M+1; j++){
for (int k = 0; k < M; k++){
for (int l = 0; l < M; l++){
if ((A[i+k][j+l]) == (B[k][l])){
count++;
}
}
}
}
}
if (count == M*M){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
}
| a.cc:26:28: error: extended character is not valid in an identifier
26 | if ((A[i+k][j+l]) == (B[k][l])){
| ^
a.cc: In function 'int main()':
a.cc:26:28: error: expected ')' before '\U00003000'
26 | if ((A[i+k][j+l]) == (B[k][l])){
| ~ ^~
| )
|
s003409400 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int N, M;
int main () {
cin >> N >> M;
vector<string> A(N);
vector<string> B(M);
for (int i = 0; i < N; i++){
cin >> A[i];
}
for (int i = 0; i < M; i++){
cin >> B[i];
}
int count = 0;
for (int i = 0; i < N-M+1; i++){
for (int j = 0; j < N-M+1; j++){
for (int k = 0; k < M; k++){
for (int l = 0; l < M; l++){
if (A[i+k][j+l] == B[k][l]){
count++;
}
}
}
}
}
if (count == M*M){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
}
| a.cc:24:26: error: extended character is not valid in an identifier
24 | if (A[i+k][j+l] == B[k][l]){
| ^
a.cc: In function 'int main()':
a.cc:24:26: error: expected ')' before '\U00003000'
24 | if (A[i+k][j+l] == B[k][l]){
| ~ ^~
| )
|
s920314340 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int N, M;
int main () {
cin >> N >> M;
for (int i = 0; i < N; i++){
cin >> A[i];
}
for (int i = 0; i < M; i++){
cin >> B[i];
}
int count = 0;
for (int i = 0; i < N-M+1; i++){
for (int j = 0; j < N-M+1; j++){
for (int k = 0; k < M; k++){
for (int l = 0; l < M; l++){
if (A[i+k][j+l] == B[k][l]){
count++;
}
}
}
}
}
if (count == M*M){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
}
| a.cc:22:26: error: extended character is not valid in an identifier
22 | if (A[i+k][j+l] == B[k][l]){
| ^
a.cc: In function 'int main()':
a.cc:10:12: error: 'A' was not declared in this scope
10 | cin >> A[i];
| ^
a.cc:13:12: error: 'B' was not declared in this scope
13 | cin >> B[i];
| ^
a.cc:22:15: error: 'A' was not declared in this scope
22 | if (A[i+k][j+l] == B[k][l]){
| ^
a.cc:22:26: error: expected ')' before '\U00003000'
22 | if (A[i+k][j+l] == B[k][l]){
| ~ ^~
| )
|
s815701771 | p03804 | C++ | #include<bits/stdc++.h>
#include<>
using namespace std;
int N, M;
int main () {
cin >> N >> M;
for (int i = 0; i < N; i++){
cin >> A[i];
}
for (int i = 0; i < M; i++){
cin >> B[i];
}
int count = 0;
for (int i = 0; i < N-M+1; i++){
for (int j = 0; j < N-M+1; j++){
for (int k = 0; k < M; k++){
for (int l = 0; l < M; l++){
if (A[i+k][j+l] == B[k][l]){
count++;
}
}
}
}
}
if (count == M*M){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
}
| a.cc:2:9: error: empty filename in #include
2 | #include<>
| ^~
a.cc:23:26: error: extended character is not valid in an identifier
23 | if (A[i+k][j+l] == B[k][l]){
| ^
a.cc: In function 'int main()':
a.cc:11:12: error: 'A' was not declared in this scope
11 | cin >> A[i];
| ^
a.cc:14:12: error: 'B' was not declared in this scope
14 | cin >> B[i];
| ^
a.cc:23:15: error: 'A' was not declared in this scope
23 | if (A[i+k][j+l] == B[k][l]){
| ^
a.cc:23:26: error: expected ')' before '\U00003000'
23 | if (A[i+k][j+l] == B[k][l]){
| ~ ^~
| )
|
s615716012 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int N, M;
int main () {
cin >> N >> M;
vector<string> A(N);
vector<string> B(M);
for (int i = 0; i < N; i++){
cin >> A[i];
}
for (int i = 0; i < M; i++){
cin >> B[i];
}
int count = 0;
for (int i = 0; i < N-M+1; i++){
for (int j = 0; j < N-M+1; j++){
for (int k = 0; k < M; k++){
for (int l = 0; l < M; l++){
if (A[i+k] == B[j+l]){
count++;
}
}
}
}
}
if (count == M*M){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
}
| a.cc:24:21: error: extended character is not valid in an identifier
24 | if (A[i+k] == B[j+l]){
| ^
a.cc: In function 'int main()':
a.cc:24:21: error: expected ')' before '\U00003000'
24 | if (A[i+k] == B[j+l]){
| ~ ^~
| )
a.cc:24:32: error: could not convert 'A.std::vector<std::__cxx11::basic_string<char> >::operator[](((std::vector<std::__cxx11::basic_string<char> >::size_type)(i + k)))' from '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
24 | if (A[i+k] == B[j+l]){
| ^
| |
| __gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type {aka std::__cxx11::basic_string<char>}
|
s273012646 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int N, M;
int main () {
cin >> N >> M;
vector<string> A(N);
vector<string> B(M);
for (int i = 0; i < N; i++){
cin >> A[i];
}
for (int i = 0; i < M; i++){
cin >> B[i];
}
int count = 0;
for (int i = 0; i < N-M+1; i++){
for (int j = 0; j < N-M+1; j++){
for (int k = 0; k < M; k++){
for (int l = 0; l < M; l++){
if (A[i+k] == B[j+l]){
count++;
}
}
}
}
}
if (count == m*m){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
}
| a.cc:24:21: error: extended character is not valid in an identifier
24 | if (A[i+k] == B[j+l]){
| ^
a.cc: In function 'int main()':
a.cc:24:21: error: expected ')' before '\U00003000'
24 | if (A[i+k] == B[j+l]){
| ~ ^~
| )
a.cc:24:32: error: could not convert 'A.std::vector<std::__cxx11::basic_string<char> >::operator[](((std::vector<std::__cxx11::basic_string<char> >::size_type)(i + k)))' from '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
24 | if (A[i+k] == B[j+l]){
| ^
| |
| __gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type {aka std::__cxx11::basic_string<char>}
a.cc:31:16: error: 'm' was not declared in this scope
31 | if (count == m*m){
| ^
|
s190163184 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int N, M;
int main () {
cin >> N >> M;
vector<string> A(N);
vector<string> B(M);
for (int i = 0; i < N; i++){
cin >> A[i];
}
for (int i = 0; i < M; i++){
cin >> B[i];
}
int count = 0;
for (int i = 0; i < N-M+1; i++){
for (int j = 0; j < N-M+1; j++){
for (int k = 0; k < m; k++){
for (int l = 0; l < m; l++){
if (A[i+k] == B[j+l]){
count++;
}
}
}
}
}
if (count == m*m){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
}
| a.cc:24:21: error: extended character is not valid in an identifier
24 | if (A[i+k] == B[j+l]){
| ^
a.cc: In function 'int main()':
a.cc:22:27: error: 'm' was not declared in this scope
22 | for (int k = 0; k < m; k++){
| ^
a.cc:24:21: error: expected ')' before '\U00003000'
24 | if (A[i+k] == B[j+l]){
| ~ ^~
| )
a.cc:24:32: error: could not convert 'A.std::vector<std::__cxx11::basic_string<char> >::operator[](((std::vector<std::__cxx11::basic_string<char> >::size_type)(i + k)))' from '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
24 | if (A[i+k] == B[j+l]){
| ^
| |
| __gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type {aka std::__cxx11::basic_string<char>}
a.cc:31:16: error: 'm' was not declared in this scope
31 | if (count == m*m){
| ^
|
s183076033 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int N, M;
int main () {
cin >> N >> M;
vector<string> A(N);
vector<string> B(M);
for (int i = 0; i < N; i++){
cin >> A[i];
}
for (int i = 0; i < M; i++){
cin >> B[i];
}
int count = 0;
for (int i = 0; i < N-M+1; i++){
for (int j = 0; j < N-M+1; j++){
for (int k = 0; k < M; k++){
for (int l = 0; l < M; l++){
if (A[i+k] == B[j+l]){
count++;
}
}
}
}
}
if (count == m*m)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| a.cc:24:21: error: extended character is not valid in an identifier
24 | if (A[i+k] == B[j+l]){
| ^
a.cc: In function 'int main()':
a.cc:24:21: error: expected ')' before '\U00003000'
24 | if (A[i+k] == B[j+l]){
| ~ ^~
| )
a.cc:24:32: error: could not convert 'A.std::vector<std::__cxx11::basic_string<char> >::operator[](((std::vector<std::__cxx11::basic_string<char> >::size_type)(i + k)))' from '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
24 | if (A[i+k] == B[j+l]){
| ^
| |
| __gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type {aka std::__cxx11::basic_string<char>}
a.cc:31:16: error: 'm' was not declared in this scope
31 | if (count == m*m)
| ^
|
s661418308 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,M;
cin >> N >> M;
const int nmmax=50;
char A[nmmax][nmmax],B[nmmax][nmmax];
for(int y=0;y<N;++y){
for(int x=0;x<N;++x){
cin >> A[y][x];
}
}
for(int y=0;y<M;++y){
for(int x=0;x<M;++x){
cin >> B[y][x];
}
}
bool exist=false;
for(int ly=0;ly<N;++ly){
for(int lx=0;lx<N;++lx){
if(ly+M-1>=N or lx+M-1>=N) continue;
bool match=true;
for(int y=0;y<M;++y){
for(int x=0;x<M;++x){
if(A[ly+y][lx+x]!=B[y][x]) match=false;
}
}
if(match) exist=true;
}
}
if(exist)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
} | a.cc:43:1: error: expected declaration before '}' token
43 | }
| ^
|
s603729564 | p03804 | C++ | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
vector<vl> v;
ll modpow(ll a, ll x){
if(x == 1) return a;
if(x == 0) return 1;
if(x%2 == 0){
ll t = (modpow(a,x/2)%MOD);
return (t*t)%MOD;
}
ll t = (modpow(a,x/2)%MOD);
return (t*t*a)%MOD;
}
ll check(ll x,ll y, ll size){
ll ans = 0;
rep(i,x,x+size) rep(j,y,y+size){
ans = (ans + v[i][j]*modpow(2,((i-x)*100 + (j-y))))%MOD;
}
return ans;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cout << std::setprecision(9);
cout << std::fixed;
ll n,m;
cin >> n >> m;
rp(i,n) {
vl temp;
v.pb(temp);
rp(j,n){
char c;
cin >> c;
if(c == '#') v[i].pb(0LL);
else v[i].pb(1LL);
}
}
ll curH = 0;
rp(i,m) {
rp(j,m){
char c;
cin >> c;
ll x;
if(c == '#') x = 0;
else x = 1;
curH = (curH + x*modpow(2,((i)*100 + j)))%MOD;
}
}
rp(i,n-m+1) rp(j,n-m+1){
if(curH == check(i,j,m))
{
cout << "Yes"<<endl;
return 0;
}
}
cout << "No"<<endl;a
return 0;
}
// read the question correctly (ll vs int)
// template by super1 derived from bqi343
| a.cc: In function 'int main()':
a.cc:102:24: error: 'a' was not declared in this scope
102 | cout << "No"<<endl;a
| ^
|
s220837755 | p03804 | C++ | /*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef long double ld;
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
return f.second > s.second;
}
ll gcd(ll a, ll b){
if (b == 0)return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b){
return a / gcd(a, b) * b;
}
ll nCr(ll n, ll r){
if(r == 0 || r == n){
return 1;
} else if(r == 1){
return n;
}
return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
ll nPr(ll n, ll r){
r = n - r;
ll ret = 1;
for (ll i = n; i >= r + 1; i--) ret *= i;
return ret;
}
//-----------------------ここから-----------
int main(void){
int n, m;
cin >> n >> m;
vector<string> a(n);
for(int i = 0; i < n; i++){
cin >> a[i]
}
vector<string> b(m);
for(int i = 0; i < m; i++){
cin >> b[i];
}
for(int i = 0; i < n - m + 1; i++){
for(int j = 0; j < n - m + 1; j++){
bool ok = true;
for(int k = 0; k < m; k++){
for(int l = 0; l < m; l++){
if(a[i + k][j + l] == b[k][l]){
continue;
} else {
ok = false;
break;
}
}
if(!ok) break;
cout << "Yes" << endl;
return 0;
}
}
}
cout << "No" << endl;
} | a.cc: In function 'int main()':
a.cc:68:20: error: expected ';' before '}' token
68 | cin >> a[i]
| ^
| ;
69 | }
| ~
|
s017280313 | p03804 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;
int main(){
int N,M;
cin>>N>>M;
int A[100][100];
for(int i=0; i<100; ++i){
for(int j=0; j<100; ++j){
A[i][j]=0;
}
}
string A[N],B[M];
for(int i=0; i<N; ++i) cin>>A[i];
for(int i=0; i<M; ++i) cin>>B[i];
bool CAN=false;
if(N<M) CAN=false;
else{
for(int i=0; i<=N-M; ++i){
for(int j=0; j<=N-M; ++j){
bool CAN2=true;
for(int k=0; k<M; ++k){
for(int l=0; l<M; ++l){
if(A[i+k].at(j+l)!=B[k].at(l)) CAN2=false;
}
}
if(CAN2) A[i][j]=1;
}
}
}
for(int i=0; i<100; ++i){
for(int j=0; j<100; ++j){
if(A[i][j]==1) CAN=true;
}
}
if(CAN) cout<<"Yes"<<endl;
else cout<<"no"<<endl;
} | a.cc: In function 'int main()':
a.cc:28:10: error: conflicting declaration 'std::string A [N]'
28 | string A[N],B[M];
| ^
a.cc:22:7: note: previous declaration as 'int A [100][100]'
22 | int A[100][100];
| ^
a.cc:29:29: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [100]')
29 | for(int i=0; i<N; ++i) cin>>A[i];
| ~~~^~~~~~
| | |
| | int [100]
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:29:34: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*'
29 | for(int i=0; i<N; ++i) cin>>A[i];
| ~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:29:34: error: invalid conversion from 'int*' to 'short int' [-fpermissive]
29 | for(int i=0; i<N; ++i) cin>>A[i];
| ~~~^
| |
| int*
a.cc:29:34: error: cannot bind rvalue '(short int)((int*)(& A[i]))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:29:34: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive]
29 | for(int i=0; i<N; ++i) cin>>A[i];
| ~~~^
| |
| int*
a.cc:29:34: error: cannot bind rvalue '(short unsigned int)((int*)(& A[i]))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:29:34: error: invalid conversion from 'int*' to 'int' [-fpermissive]
29 | for(int i=0; i<N; ++i) cin>>A[i];
| ~~~^
| |
| int*
a.cc:29:34: error: cannot bind rvalue '(int)((int*)(& A[i]))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:29:34: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive]
29 | for(int i=0; i<N; ++i) cin>>A[i];
| ~~~^
| |
| int*
a.cc:29:34: error: cannot bind rvalue '(unsigned int)((int*)(& A[i]))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:29:34: error: invalid conversion from 'int*' to 'long int' [-fpermissive]
29 | for(int i=0; i<N; ++i) cin>>A[i];
| ~~~^
| |
| int*
a.cc:29:34: error: cannot bind rvalue '(long int)((int*)(& A[i]))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:29:34: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive]
29 | for(int i=0; i<N; ++i) cin>>A[i];
| ~~~^
| |
| int*
a.cc:29:34: error: cannot bind rvalue '(long unsigned int)((int*)(& A[i]))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:29:34: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
29 | for(int i=0; i<N; ++i) cin>>A[i];
| ~~~^
| |
| int*
a.cc:29:34: error: cannot bind rvalue '(long long int)((int*)(& A[i]))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:29:34: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive]
29 | for(int i=0; i<N; ++i) cin>>A[i];
| ~~~^
| |
| int*
a.cc:29:34: error: cannot bind rvalue '(long long unsigned int)((int*)(& A[i]))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:29:34: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
29 | for(int i=0; i<N; ++i) cin>>A[i];
| ~~~^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'int [100]' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'int [100]' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'int [100]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'int [100]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::b |
s642627320 | p03804 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
int a,b;
bool e=true;
cin>>a>>b;
vector<string> c(a),d(b);
rep(i,a)cin>>c.at(i);
rep(i,b)cin>>d.at(i);
rep(i,a-b+1)rep(j,a-b+1){
rep(k,b)rep(l,b){
if(d.at(k).at(l)!=c.at(k+i).(l+j)
e=false;k=l=b;
}
if(e){
cout<<"Yes";
return 0;
}
}
cout<<"No";
} | a.cc: In function 'int main()':
a.cc:17:35: error: expected unqualified-id before '(' token
17 | if(d.at(k).at(l)!=c.at(k+i).(l+j)
| ^
a.cc:18:22: error: expected ')' before ';' token
18 | e=false;k=l=b;
| ^
| )
a.cc:17:9: note: to match this '('
17 | if(d.at(k).at(l)!=c.at(k+i).(l+j)
| ^
|
s404805862 | p03804 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
int a,b;
bool e=true;
cin>>a>>b;
vector<string> c(a),d(b);
rep(i,a)cin>>c.at(i);
rep(i,b)cin>>d.at(i);
rep(i,a-b+1)rep(j,a-b+1){
rep(k,b)rep(l,b){
if(d.at(k).at(l)!=c.at(k+i).(l+j))
e=false;k=l=m;
}
if(e){
cout<<"Yes";
return 0;
}
}
cout<<"No";
} | a.cc: In function 'int main()':
a.cc:17:35: error: expected unqualified-id before '(' token
17 | if(d.at(k).at(l)!=c.at(k+i).(l+j))
| ^
a.cc:18:21: error: 'm' was not declared in this scope
18 | e=false;k=l=m;
| ^
|
s365460335 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int n,m;
string b[60],p[60];
bool match(int x,int y){
rep(i,m){
rep(j,m){
if(b[x+i][y+j]!=p[i][j])return false;
}
}
return true;
}
int main(){
cin>>n>>m;
rep(i,n)cin>>b[i];
rep(i,m)cin>>p[i];
bool f=false;
for(i=0;i<=n-m;i++){
for(int j=0;j<=n-m;j++){
if(match(i,j))f=true;
}
}
cout<<(f?"Yes":"No")<<endl;
} | a.cc: In function 'int main()':
a.cc:27:7: error: 'i' was not declared in this scope
27 | for(i=0;i<=n-m;i++){
| ^
|
s720471910 | p03804 | C++ |
I am trying to implement real-time tracking using templates. I wish to update the template with every frame. The main modifications I have done are:
1) separated the template matching and minmaxLoc into separate modules namely, TplMatch() and minmax() functions, respectively.
2) Inside the track() function, the select_flag is kept always true so that new template is copied to 'myTemplate' with every iteration.
3) The last 3 lines of function track() are to update the template (roiImg).
4) Also, I have removed any arguments to track() function, since, img and roiImg are global variables and hence no need to pass them to functions.
Following is the code:
#include <iostream>
#include "opencv2/opencv.hpp"
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/objdetect/objdetect.hpp>
#include <sstream>
using namespace cv;
using namespace std;
Point point1, point2; /* vertical points of the bounding box */
int drag = 0;
Rect rect; /* bounding box */
Mat img, roiImg; /* roiImg - the part of the image in the bounding box */
int select_flag = 0;
bool go_fast = false;
Mat mytemplate;
///------- template matching -----------------------------------------------------------------------------------------------
Mat TplMatch( Mat &img, Mat &mytemplate )
{
Mat result;
matchTemplate( img, mytemplate, result, CV_TM_SQDIFF_NORMED );
normalize( result, result, 0, 1, NORM_MINMAX, -1, Mat() );
return result;
}
///------- Localizing the best match with minMaxLoc ------------------------------------------------------------------------
Point minmax( Mat &result )
{
double minVal, maxVal;
Point minLoc, maxLoc, matchLoc;
minMaxLoc( result, &minVal, &maxVal, &minLoc, &maxLoc, Mat() );
matchLoc = minLoc;
return matchLoc;
}
///------- tracking --------------------------------------------------------------------------------------------------------
void track()
{
if (select_flag)
{
roiImg.copyTo(mytemplate);
// select_flag = false;
go_fast = true;
}
// imshow( "mytemplate", mytemplate ); waitKey(0);
Mat result = TplMatch( img, mytemplate );
Point match = minmax( result );
rectangle( img, match, Point( match.x + mytemplate.cols , match.y + mytemplate.rows ), CV_RGB(255, 255, 255), 0.5 );
std::cout << "match: " << match << endl;
/// latest match is the new template
Rect ROI = cv::Rect( match.x, match.y, mytemplate.cols, mytemplate.rows );
roiImg = img( ROI );
imshow( "roiImg", roiImg ); //waitKey(0);
}
///------- MouseCallback function ------------------------------------------------------------------------------------------
void mouseHandler(int event, int x, int y, int flags, void *param)
{
if (event == CV_EVENT_LBUTTONDOWN && !drag)
{
/// left button clicked. ROI selection begins
point1 = Point(x, y);
drag = 1;
}
if (event == CV_EVENT_MOUSEMOVE && drag)
{
/// mouse dragged. ROI being selected
Mat img1 = img.clone();
point2 = Point(x, y);
rectangle(img1, point1, point2, CV_RGB(255, 0, 0), 3, 8, 0);
imshow("image", img1);
}
if (event == CV_EVENT_LBUTTONUP && drag)
{
point2 = Point(x, y);
rect = Rect(point1.x, point1.y, x - point1.x, y - point1.y);
drag = 0;
roiImg = img(rect);
// imshow("MOUSE roiImg", roiImg); waitKey(0);
}
if (event == CV_EVENT_LBUTTONUP)
{
/// ROI selected
select_flag = 1;
drag = 0;
}
}
///------- Main() ----------------------------------------------------------------------------------------------------------
int main()
{
int k;
/*
///open webcam
VideoCapture cap(0);
if (!cap.isOpened())
return 1;*/
///open video file
VideoCapture cap;
cap.open( "Megamind.avi" );
if ( !cap.isOpened() )
{ cout << "Unable to open video file" << endl; return -1; }
/*
/// Set video to 320x240
cap.set(CV_CAP_PROP_FRAME_WIDTH, 320);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 240);*/
cap >> img;
GaussianBlur( img, img, Size(7,7), 3.0 );
imshow( "image", img );
while (1)
{
cap >> img;
if ( img.empty() )
break;
// Flip the frame horizontally and add blur
cv::flip( img, img, 1 );
GaussianBlur( img, img, Size(7,7), 3.0 );
if ( rect.width == 0 && rect.height == 0 )
cvSetMouseCallback( "image", mouseHandler, NULL );
else
track();
imshow("image", img);
// waitKey(100); k = waitKey(75);
k = waitKey(go_fast ? 30 : 10000);
if (k == 27)
break;
}
return 0;
} | a.cc:6:103: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
6 | 2) Inside the track() function, the select_flag is kept always true so that new template is copied to 'myTemplate' with every iteration.
| ^~~~~~~~~~~~
a.cc:15:10: fatal error: opencv2/opencv.hpp: No such file or directory
15 | #include "opencv2/opencv.hpp"
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s096574744 | p03804 | C++ | #include "stdio.h"
#include "opencv2/highgui/highgui.hpp"
#include "iostream"
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv/cv.h"
using namespace cv;
using namespace std;
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
/**
* Function to perform fast template matching with image pyramid
*/
void fastMatchTemplate(cv::Mat& srca, // The reference image
cv::Mat& srcb, // The template image
cv::Mat& dst, // Template matching result
int maxlevel) // Number of levels
{
std::vector<cv::Mat> refs, tpls, results;
// Build Gaussian pyramid
cv::buildPyramid(srca, refs, maxlevel);
cv::buildPyramid(srcb, tpls, maxlevel);
cv::Mat ref, tpl, res;
// Process each level
for (int level = maxlevel; level >= 0; level--)
{
ref = refs[level];
tpl = tpls[level];
res = cv::Mat::zeros(ref.size() + cv::Size(1,1) - tpl.size(), CV_32FC1);
if (level == maxlevel)
{
// On the smallest level, just perform regular template matching
cv::matchTemplate(ref, tpl, res, CV_TM_CCORR_NORMED);
}
else
{
// On the next layers, template matching is performed on pre-defined
// ROI areas. We define the ROI using the template matching result
// from the previous layer.
cv::Mat mask;
cv::pyrUp(results.back(), mask);
cv::Mat mask8u;
mask.convertTo(mask8u, CV_8U);
// Find matches from previous layer
std::vector<std::vector<cv::Point> > contours;
cv::findContours(mask8u, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
// Use the contours to define region of interest and
// perform template matching on the areas
for (int i = 0; i < contours.size(); i++)
{
cv::Rect r = cv::boundingRect(contours[i]);
cv::matchTemplate(
ref(r + (tpl.size() - cv::Size(1,1))),
tpl,
res(r),
CV_TM_CCORR_NORMED
);
}
}
// Only keep good matches
cv::threshold(res, res, 0.80, 1., CV_THRESH_TOZERO);
results.push_back(res);
}
res.copyTo(dst);
}
int main()
{
/* string path;
string path1;
cout << "Please enter image template: ";
cin >> path;
cout << "Please enter image reference: ";
cin >> path1;*/
cv::Mat ref = cv::imread("E:\\CodeImage\\plan1.png");
cv::Mat tpl = cv::imread("E:\\CodeImage\\t.png");
if (ref.empty() || tpl.empty())
return -1;
cv::Mat ref_gray, tpl_gray;
cv::cvtColor(ref, ref_gray, CV_BGR2GRAY);
cv::cvtColor(tpl, tpl_gray, CV_BGR2GRAY);
cv::Mat dst;
fastMatchTemplate(ref_gray, tpl_gray, dst, 2);
while (true)
{
double minval, maxval;
cv::Point minloc, maxloc;
cv::minMaxLoc(dst, &minval, &maxval, &minloc, &maxloc);
if (maxval >= 0.9)
{
cv::rectangle(
ref, maxloc,
cv::Point(maxloc.x + tpl.cols, maxloc.y + tpl.rows),
CV_RGB(0,255,0), 2
);
cv::floodFill(
dst, maxloc,
cv::Scalar(0), 0,
cv::Scalar(.1),
cv::Scalar(1.)
);
}
else
{
cout << "No match found ";
break;
}
}
cv::imshow("result", ref);
cv::waitKey();
return 0;
getchar(); | a.cc:2:10: fatal error: opencv2/highgui/highgui.hpp: No such file or directory
2 | #include "opencv2/highgui/highgui.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s089886602 | p03804 | C++ | #include "Matrix.h"
Matrix::Matrix(int sizeR, int sizeC, double val){
M = sizeR; // Set number of rows.
N = sizeC; // Set number of cols.
data = new double[sizeR * sizeC];
}
Matrix::Matrix(int sizeR, int sizeC, double* inputData){
M = sizeR;
N = sizeC;
data = new double[sizeR * sizeC]; // Set data sixe
for (int i = 0; i < sizeR * sizeC; i++) // input data store
{
data[i] = inputData[i];
}
}
Matrix::~Matrix(){
delete[] data;
data = 0;
}
Matrix::Matrix(const Matrix& existingMatrix){
M = existingMatrix.M;
N = existingMatrix.N;
data = new double[M * N]; // Allocate memory
for (int i = 0; i < M * N; i++)
{
data[i] = existingMatrix.data[i];
}
}
Matrix Matrix::getBlock(int width, int height, int r, int c, int yMove, int xMove) const{
int startCol = r * width;
int startRow = c * height;
int cols = width;
int rows = height;
Matrix R(rows, cols, 0.0);
for (int i = 0; i < rows; i++) {
for (int ii = 0; ii < cols; ii++) {
R.setElmt(i, ii, getElmt(i + startRow + yMove, ii + startCol + xMove));
}
}return R;
}
void Matrix::setBlock(int r, int c, int yMove, int xMove, const Matrix& blockValues){
int rows = blockValues.M;
int cols = blockValues.N;
int startCol = c * blockValues.N;
int startRow = r * blockValues.M;
for (int i = 0; i < rows; i++) // Rows
{
for (int ii = 0; ii < cols; ii++) //Cols
{
this->setElmt(i + startRow + yMove, ii + startCol + xMove, blockValues.getElmt(i, ii));
}
}
}
double Matrix::getElmt(int i, int j) const{
return data[i * N + j];
}
void Matrix::setElmt(int i, int j, double val)
{
data[i * N + j] = val;
}
int Matrix::getCol() const{
return N;
}
int Matrix::getRow() const{
return M;
}
Matrix Matrix::operator-(double value){
double val = 0;
Matrix C(M, N, val);
for (int i = 0; i < M; i++) // Rows
{
for (int j = 0; j < N; j++) // Cols
{
val = data[i * N + j] - value;
C.setElmt(i, j, val);
}
}return C;
}
Matrix Matrix::operator*(const Matrix& B){
double val = 0;
Matrix C(M, N, val);
for (int i = 0; i < M; i++) // Rows
{
for (int j = 0; j < N; j++) // Cols
{
val = data[i * N + j] * B.getElmt(i, j);
C.setElmt(i, j, val);
}
}
return C;
}
Matrix& Matrix::operator=(const Matrix& B){
if (this == &B) {
return *this;
}
else {
delete[] data;
M = B.getRow();
N = B.getCol();
data = new double[M * N];
for (int i = 0; i < M; i++) // Rows
{
for (int j = 0; j < N; j++) // Cols
{
setElmt(i, j, B.getElmt(i, j));
}
}
}
}
double Matrix::getSum() const{
double result = 0.0;
for (int i = 0; i < M * N; i++) {
result += data[i];
}
return result; | a.cc:1:10: fatal error: Matrix.h: No such file or directory
1 | #include "Matrix.h"
| ^~~~~~~~~~
compilation terminated.
|
s363858660 | p03804 | C++ | #include "Matrix.h"
Matrix::Matrix(int sizeR, int sizeC, double val){
M = sizeR; // Set number of rows.
N = sizeC; // Set number of cols.
data = new double[sizeR * sizeC];
}
Matrix::Matrix(int sizeR, int sizeC, double* inputData){
M = sizeR;
N = sizeC;
data = new double[sizeR * sizeC]; // Set data sixe
for (int i = 0; i < sizeR * sizeC; i++) // input data store
{
data[i] = inputData[i];
}
}
Matrix::~Matrix(){
delete[] data;
data = 0;
}
Matrix::Matrix(const Matrix& existingMatrix){
M = existingMatrix.M;
N = existingMatrix.N;
data = new double[M * N]; // Allocate memory
for (int i = 0; i < M * N; i++)
{
data[i] = existingMatrix.data[i];
}
}
Matrix Matrix::getBlock(int width, int height, int r, int c, int yMove, int xMove) const{
int startCol = r * width;
int startRow = c * height;
int cols = width;
int rows = height;
Matrix R(rows, cols, 0.0);
for (int i = 0; i < rows; i++) {
for (int ii = 0; ii < cols; ii++) {
R.setElmt(i, ii, getElmt(i + startRow + yMove, ii + startCol + xMove));
}
}return R;
}
void Matrix::setBlock(int r, int c, int yMove, int xMove, const Matrix& blockValues){
int rows = blockValues.M;
int cols = blockValues.N;
int startCol = c * blockValues.N;
int startRow = r * blockValues.M;
for (int i = 0; i < rows; i++) // Rows
{
for (int ii = 0; ii < cols; ii++) //Cols
{
this->setElmt(i + startRow + yMove, ii + startCol + xMove, blockValues.getElmt(i, ii));
}
}
}
double Matrix::getElmt(int i, int j) const{
return data[i * N + j];
}
void Matrix::setElmt(int i, int j, double val)
{
data[i * N + j] = val;
}
int Matrix::getCol() const{
return N;
}
int Matrix::getRow() const{
return M;
}
Matrix Matrix::operator-(double value){
double val = 0;
Matrix C(M, N, val);
for (int i = 0; i < M; i++) // Rows
{
for (int j = 0; j < N; j++) // Cols
{
val = data[i * N + j] - value;
C.setElmt(i, j, val);
}
}return C;
}
Matrix Matrix::operator*(const Matrix& B){
double val = 0;
Matrix C(M, N, val);
for (int i = 0; i < M; i++) // Rows
{
for (int j = 0; j < N; j++) // Cols
{
val = data[i * N + j] * B.getElmt(i, j);
C.setElmt(i, j, val);
}
}
return C;
}
Matrix& Matrix::operator=(const Matrix& B){
if (this == &B) {
return *this;
}
else {
delete[] data;
M = B.getRow();
N = B.getCol();
data = new double[M * N];
for (int i = 0; i < M; i++) // Rows
{
for (int j = 0; j < N; j++) // Cols
{
setElmt(i, j, B.getElmt(i, j));
}
}
}
}
double Matrix::getSum() const{
double result = 0.0;
for (int i = 0; i < M * N; i++) {
result += data[i];
}
return result; | a.cc:1:10: fatal error: Matrix.h: No such file or directory
1 | #include "Matrix.h"
| ^~~~~~~~~~
compilation terminated.
|
s981249058 | p03804 | C++ | #include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace std;
using namespace cv;
bool use_mask;
Mat img; Mat templ; Mat mask; Mat result;
const char* image_window = "Source Image";
const char* result_window = "Result window";
int match_method;
int max_Trackbar = 5;
void MatchingMethod( int, void* );
int main( int argc, char** argv )
{
if (argc < 3)
{
cout << "Not enough parameters" << endl;
cout << "Usage:\n./MatchTemplate_Demo <image_name> <template_name> [<mask_name>]" << endl;
return -1;
}
img = imread( argv[1], IMREAD_COLOR );
templ = imread( argv[2], IMREAD_COLOR );
if(argc > 3) {
use_mask = true;
mask = imread( argv[3], IMREAD_COLOR );
}
if(img.empty() || templ.empty() || (use_mask && mask.empty()))
{
cout << "Can't read one of the images" << endl;
return -1;
}
namedWindow( image_window, WINDOW_AUTOSIZE );
namedWindow( result_window, WINDOW_AUTOSIZE );
const char* trackbar_label = "Method: \n 0: SQDIFF \n 1: SQDIFF NORMED \n 2: TM CCORR \n 3: TM CCORR NORMED \n 4: TM COEFF \n 5: TM COEFF NORMED";
createTrackbar( trackbar_label, image_window, &match_method, max_Trackbar, MatchingMethod );
MatchingMethod( 0, 0 );
waitKey(0);
return 0;
}
void MatchingMethod( int, void* )
{
Mat img_display;
img.copyTo( img_display );
int result_cols = img.cols - templ.cols + 1;
int result_rows = img.rows - templ.rows + 1;
result.create( result_rows, result_cols, CV_32FC1 );
bool method_accepts_mask = (TM_SQDIFF == match_method || match_method == TM_CCORR_NORMED);
if (use_mask && method_accepts_mask)
{ matchTemplate( img, templ, result, match_method, mask); }
else
{ matchTemplate( img, templ, result, match_method); }
normalize( result, result, 0, 1, NORM_MINMAX, -1, Mat() );
double minVal; double maxVal; Point minLoc; Point maxLoc;
Point matchLoc;
minMaxLoc( result, &minVal, &maxVal, &minLoc, &maxLoc, Mat() );
if( match_method == TM_SQDIFF || match_method == TM_SQDIFF_NORMED )
{ matchLoc = minLoc; }
else
{ matchLoc = maxLoc; }
rectangle( img_display, matchLoc, Point( matchLoc.x + templ.cols , matchLoc.y + templ.rows ), Scalar::all(0), 2, 8, 0 );
rectangle( result, matchLoc, Point( matchLoc.x + templ.cols , matchLoc.y + templ.rows ), Scalar::all(0), 2, 8, 0 );
imshow( image_window, img_display );
imshow( result_window, result );
return; | a.cc:1:10: fatal error: opencv2/imgcodecs.hpp: No such file or directory
1 | #include "opencv2/imgcodecs.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s736566904 | p03804 | C++ | #include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
/// Global Variables
Mat img; Mat templ; Mat result;
char* image_window = "Source Image";
char* result_window = "Result window";
int match_method;
int max_Trackbar = 5;
/// Function Headers
void MatchingMethod( int, void* );
/** @function main */
int main( int argc, char** argv )
{
/// Load image and template
img = imread( argv[1], 1 );
templ = imread( argv[2], 1 );
/// Create windows
namedWindow( image_window, CV_WINDOW_AUTOSIZE );
namedWindow( result_window, CV_WINDOW_AUTOSIZE );
/// Create Trackbar
char* trackbar_label = "Method: \n 0: SQDIFF \n 1: SQDIFF NORMED \n 2: TM CCORR \n 3: TM CCORR NORMED \n 4: TM COEFF \n 5: TM COEFF NORMED";
createTrackbar( trackbar_label, image_window, &match_method, max_Trackbar, MatchingMethod );
MatchingMethod( 0, 0 );
waitKey(0);
return 0;
}
/**
* @function MatchingMethod
* @brief Trackbar callback
*/
void MatchingMethod( int, void* )
{
/// Source image to display
Mat img_display;
img.copyTo( img_display );
/// Create the result matrix
int result_cols = img.cols - templ.cols + 1;
int result_rows = img.rows - templ.rows + 1;
result.create( result_rows, result_cols, CV_32FC1 );
/// Do the Matching and Normalize
matchTemplate( img, templ, result, match_method );
normalize( result, result, 0, 1, NORM_MINMAX, -1, Mat() );
/// Localizing the best match with minMaxLoc
double minVal; double maxVal; Point minLoc; Point maxLoc;
Point matchLoc;
minMaxLoc( result, &minVal, &maxVal, &minLoc, &maxLoc, Mat() );
/// For SQDIFF and SQDIFF_NORMED, the best matches are lower values. For all the other methods, the higher the better
if( match_method == CV_TM_SQDIFF || match_method == CV_TM_SQDIFF_NORMED )
{ matchLoc = minLoc; }
else
{ matchLoc = maxLoc; }
/// Show me what you got
rectangle( img_display, matchLoc, Point( matchLoc.x + templ.cols , matchLoc.y + templ.rows ), Scalar::all(0), 2, 8, 0 );
rectangle( result, matchLoc, Point( matchLoc.x + templ.cols , matchLoc.y + templ.rows ), Scalar::all(0), 2, 8, 0 );
imshow( image_window, img_display );
imshow( result_window, result );
return;
} | a.cc:1:10: fatal error: opencv2/highgui/highgui.hpp: No such file or directory
1 | #include "opencv2/highgui/highgui.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s661525456 | p03804 | C++ | #include "common.hpp"
#include <vector>
#include <cstring>
namespace CAROTENE_NS {
#define ENABLE4LINESMATCHING false //Disabled since overall time for simultaneous 4 lines matching is greater than
//time for simultaneous 2 lines matching for the same amount of data
bool isMatchTemplateSupported(const Size2D &tmplSize)
{
return isSupportedConfiguration() &&
tmplSize.width >= 8 && // Actually the function could process even shorter templates
// but there will be no NEON optimization in this case
(tmplSize.width * tmplSize.height) <= 256;
}
void matchTemplate(const Size2D &srcSize,
const u8 * srcBase, ptrdiff_t srcStride,
const Size2D &tmplSize,
const u8 * tmplBase, ptrdiff_t tmplStride,
f32 * dstBase, ptrdiff_t dstStride,
bool normalize)
{
internal::assertSupportedConfiguration(isMatchTemplateSupported(tmplSize));
#ifdef CAROTENE_NEON
const size_t tmplW = tmplSize.width;
const size_t tmplH = tmplSize.height;
const size_t dstW = srcSize.width - tmplSize.width + 1;
const size_t dstH = srcSize.height - tmplSize.height + 1;
//template correlation part
{
#if ENABLE4LINESMATCHING
const size_t dstroiw4 = dstW & ~3u;
#endif
const size_t dstroiw2 = dstW & ~1u;
const size_t tmplroiw = tmplW & ~7u;
const size_t dstride = dstStride >> 2;
f32 *corr = dstBase;
const u8 *imgrrow = srcBase;
for(size_t r = 0; r < dstH; ++r, corr+=dstride, imgrrow+=srcStride)
{
size_t c = 0;
#if ENABLE4LINESMATCHING
for(; c < dstroiw4; c+=4)
{
u32 dot[4] = {0, 0, 0, 0};
uint32x4_t vdot0 = vmovq_n_u32(0);
uint32x4_t vdot1 = vmovq_n_u32(0);
uint32x4_t vdot2 = vmovq_n_u32(0);
uint32x4_t vdot3 = vmovq_n_u32(0);
const u8 *img = imgrrow;
const u8 *tmpl = tmplBase;
for(size_t i = 0; i < tmplH; ++i, tmpl+=tmplStride, img+=srcStride)
{
size_t j = 0;
for(; j < tmplroiw; j+=8)
{
uint8x8_t vtmpl = vld1_u8(tmpl + j);
uint8x8_t vimg0 = vld1_u8(img + j + c + 0);
uint8x8_t vimg1 = vld1_u8(img + j + c + 1);
uint8x8_t vimg2 = vld1_u8(img + j + c + 2);
uint8x8_t vimg3 = vld1_u8(img + j + c + 3);
uint16x8_t vd0 = vmull_u8(vtmpl, vimg0);
uint16x8_t vd1 = vmull_u8(vtmpl, vimg1);
uint16x8_t vd2 = vmull_u8(vtmpl, vimg2);
uint16x8_t vd3 = vmull_u8(vtmpl, vimg3);
vdot0 = vpadalq_u16(vdot0, vd0);
vdot1 = vpadalq_u16(vdot1, vd1);
vdot2 = vpadalq_u16(vdot2, vd2);
vdot3 = vpadalq_u16(vdot3, vd3);
}
for(; j < tmplW; ++j)
{
dot[0] += tmpl[j] * img[j + c + 0];
dot[1] += tmpl[j] * img[j + c + 1];
dot[2] += tmpl[j] * img[j + c + 2];
dot[3] += tmpl[j] * img[j + c + 3];
}
}
uint32x4_t vdotx = vld1q_u32(dot);
uint32x2_t vdot_0 = vpadd_u32(vget_low_u32(vdot0), vget_high_u32(vdot0));
uint32x2_t vdot_1 = vpadd_u32(vget_low_u32(vdot1), vget_high_u32(vdot1));
uint32x2_t vdot_2 = vpadd_u32(vget_low_u32(vdot2), vget_high_u32(vdot2));
uint32x2_t vdot_3 = vpadd_u32(vget_low_u32(vdot3), vget_high_u32(vdot3));
uint32x2_t vdot_01 = vpadd_u32(vdot_0, vdot_1);
uint32x2_t vdot_23 = vpadd_u32(vdot_2, vdot_3);
vst1q_f32(corr + c, vcvtq_f32_u32(vaddq_u32(vdotx, vcombine_u32(vdot_01, vdot_23))));
}
#endif
for(; c < dstroiw2; c+=2)
{
u32 dot[2] = {0, 0};
uint32x4_t vdot0 = vmovq_n_u32(0);
uint32x4_t vdot1 = vmovq_n_u32(0);
const u8 *img = imgrrow;
const u8 *tmpl = tmplBase;
for(size_t i = 0; i < tmplH; ++i, tmpl+=tmplStride, img+=srcStride)
{
size_t j = 0;
for(; j < tmplroiw; j+=8)
{
uint8x8_t vtmpl = vld1_u8(tmpl + j);
uint8x8_t vimg0 = vld1_u8(img + j + c + 0);
uint8x8_t vimg1 = vld1_u8(img + j + c + 1);
uint16x8_t vd0 = vmull_u8(vtmpl, vimg0);
uint16x8_t vd1 = vmull_u8(vtmpl, vimg1);
vdot0 = vpadalq_u16(vdot0, vd0);
vdot1 = vpadalq_u16(vdot1, vd1);
}
for(; j < tmplW; ++j)
{
dot[0] += tmpl[j] * img[j + c + 0];
dot[1] += tmpl[j] * img[j + c + 1];
}
}
uint32x2_t vdotx = vld1_u32(dot);
uint32x2_t vdot_0 = vpadd_u32(vget_low_u32(vdot0), vget_high_u32(vdot0));
uint32x2_t vdot_1 = vpadd_u32(vget_low_u32(vdot1), vget_high_u32(vdot1));
uint32x2_t vdot_ = vpadd_u32(vdot_0, vdot_1);
vst1_f32(corr + c, vcvt_f32_u32(vadd_u32(vdotx, vdot_)));
}
for(; c < dstW; ++c)
{
u32 dot = 0;
uint32x4_t vdot = vmovq_n_u32(0);
const u8 *img = imgrrow;
const u8 *tmpl = tmplBase;
for(size_t i = 0; i < tmplH; ++i, tmpl+=tmplStride, img+=srcStride)
{
size_t j = 0;
for(; j < tmplroiw; j+=8)
{
uint8x8_t vtmpl = vld1_u8(tmpl + j);
uint8x8_t vimg = vld1_u8(img + j + c);
uint16x8_t vd = vmull_u8(vtmpl, vimg);
vdot = vpadalq_u16(vdot, vd);
}
for(; j < tmplW; ++j)
dot += tmpl[j] * img[j + c];
}
u32 wdot[2];
vst1_u32(wdot, vpadd_u32(vget_low_u32(vdot), vget_high_u32(vdot)));
dot += wdot[0] + wdot[1];
corr[c] = (f32)dot;
}
}
}
if(normalize)
{
f32 tn = std::sqrt((f32)normL2(tmplSize, tmplBase, tmplStride));
size_t iw = srcSize.width+1;
size_t ih = srcSize.height+1;
std::vector<f64> _sqsum(iw*ih);
f64 *sqsum = &_sqsum[0];
memset(sqsum, 0, iw*sizeof(f64));
for(size_t i = 1; i < ih; ++i)
sqsum[iw*i] = 0.;
sqrIntegral(srcSize, srcBase, srcStride, sqsum + iw + 1, iw*sizeof(f64));
for(size_t i = 0; i < dstH; ++i)
{
f32 *result = internal::getRowPtr(dstBase, dstStride, i);
for(size_t j = 0; j < dstW; ++j)
{
double s2 = sqsum[iw*i + j] +
sqsum[iw*(i + tmplSize.height) + j + tmplSize.width] -
sqsum[iw*(i + tmplSize.height) + j] -
sqsum[iw*i + j + tmplSize.width];
result[j] /= tn * std::sqrt(s2);
}
}
}
#else
(void)srcSize;
(void)srcBase;
(void)srcStride;
(void)tmplBase;
(void)tmplStride;
(void)dstBase;
(void)dstStride;
(void)normalize;
#endif
}
} // namespace CAROTENE_NS | a.cc:1:10: fatal error: common.hpp: No such file or directory
1 | #include "common.hpp"
| ^~~~~~~~~~~~
compilation terminated.
|
s085202411 | p03804 | C++ | #include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace std;
using namespace cv;
//! [declare]
/// Global Variables
bool use_mask;
Mat img; Mat templ; Mat mask; Mat result;
const char* image_window = "Source Image";
const char* result_window = "Result window";
int match_method;
int max_Trackbar = 5;
//! [declare]
/// Function Headers
void MatchingMethod( int, void* );
/**
* @function main
*/
int main( int argc, char** argv )
{
if (argc < 3)
{
cout << "Not enough parameters" << endl;
cout << "Usage:\n./MatchTemplate_Demo <image_name> <template_name> [<mask_name>]" << endl;
return -1;
}
//! [load_image]
/// Load image and template
img = imread( argv[1], IMREAD_COLOR );
templ = imread( argv[2], IMREAD_COLOR );
if(argc > 3) {
use_mask = true;
mask = imread( argv[3], IMREAD_COLOR );
}
if(img.empty() || templ.empty() || (use_mask && mask.empty()))
{
cout << "Can't read one of the images" << endl;
return -1;
}
//! [load_image]
//! [create_windows]
/// Create windows
namedWindow( image_window, WINDOW_AUTOSIZE );
namedWindow( result_window, WINDOW_AUTOSIZE );
//! [create_windows]
//! [create_trackbar]
/// Create Trackbar
const char* trackbar_label = "Method: \n 0: SQDIFF \n 1: SQDIFF NORMED \n 2: TM CCORR \n 3: TM CCORR NORMED \n 4: TM COEFF \n 5: TM COEFF NORMED";
createTrackbar( trackbar_label, image_window, &match_method, max_Trackbar, MatchingMethod );
//! [create_trackbar]
MatchingMethod( 0, 0 );
//! [wait_key]
waitKey(0);
return 0;
//! [wait_key]
}
/**
* @function MatchingMethod
* @brief Trackbar callback
*/
void MatchingMethod( int, void* )
{
//! [copy_source]
/// Source image to display
Mat img_display;
img.copyTo( img_display );
//! [copy_source]
//! [create_result_matrix]
/// Create the result matrix
int result_cols = img.cols - templ.cols + 1;
int result_rows = img.rows - templ.rows + 1;
result.create( result_rows, result_cols, CV_32FC1 );
//! [create_result_matrix]
//! [match_template]
/// Do the Matching and Normalize
bool method_accepts_mask = (TM_SQDIFF == match_method || match_method == TM_CCORR_NORMED);
if (use_mask && method_accepts_mask)
{ matchTemplate( img, templ, result, match_method, mask); }
else
{ matchTemplate( img, templ, result, match_method); }
//! [match_template]
//! [normalize]
normalize( result, result, 0, 1, NORM_MINMAX, -1, Mat() );
//! [normalize]
//! [best_match]
/// Localizing the best match with minMaxLoc
double minVal; double maxVal; Point minLoc; Point maxLoc;
Point matchLoc;
minMaxLoc( result, &minVal, &maxVal, &minLoc, &maxLoc, Mat() );
//! [best_match]
//! [match_loc]
/// For SQDIFF and SQDIFF_NORMED, the best matches are lower values. For all the other methods, the higher the better
if( match_method == TM_SQDIFF || match_method == TM_SQDIFF_NORMED )
{ matchLoc = minLoc; }
else
{ matchLoc = maxLoc; }
//! [match_loc]
//! [imshow]
/// Show me what you got
rectangle( img_display, matchLoc, Point( matchLoc.x + templ.cols , matchLoc.y + templ.rows ), Scalar::all(0), 2, 8, 0 );
rectangle( result, matchLoc, Point( matchLoc.x + templ.cols , matchLoc.y + templ.rows ), Scalar::all(0), 2, 8, 0 );
imshow( image_window, img_display );
imshow( result_window, result );
//! [imshow]
return;
} | a.cc:1:10: fatal error: opencv2/imgcodecs.hpp: No such file or directory
1 | #include "opencv2/imgcodecs.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s046140232 | p03804 | C++ | include<bits/stdc++.h>
using namespace std;
int main(){
int n , m ;
cin>>n>>m;
char x[n][n];
char k[m][m];
for( int i=0;i<n;i++)
scanf("%s",&x[i]);
for( int i=0;i<m;i++)
scanf("%s",&k[i]);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
int counter=0;
for(int c=0; c<m;c++){
for(int d=0; d<m;c++){
if(k[c][d]==x[i+c][j+d])
counter++;
}
}
if(counter==(m*m)){
printf("Yes\n");
}
}
}
printf("No\n");
} | a.cc:1:1: error: 'include' does not name a type
1 | include<bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
5 | cin>>n>>m;
| ^~~
a.cc:9:9: error: 'scanf' was not declared in this scope
9 | scanf("%s",&x[i]);
| ^~~~~
a.cc:11:9: error: 'scanf' was not declared in this scope
11 | scanf("%s",&k[i]);
| ^~~~~
a.cc:24:33: error: 'printf' was not declared in this scope
24 | printf("Yes\n");
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | include<bits/stdc++.h>
a.cc:28:1: error: 'printf' was not declared in this scope
28 | printf("No\n");
| ^~~~~~
a.cc:28:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
|
s985753357 | p03804 | C++ | #include<iostream>
#include<string>
using namespace std;
int main()
{
int n,m;
bool z=false;
cout<<"please enter the length of image A \n";
cin>>n;
cout<<"please enter the length of image B \n";
cin>>m;
char A[n][n],B[m][m];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
gets(A[i][j]);
}
for(int i=0;i<m;i++)
{
for(int j=0;j<m;j++)
gets(B[i][j]);
}
for(int i=0;i<m;i++)
{
for(int j=0;j<m;j++)
{
for(int x=0;x<n;x++)
{
for(int y=0;y<n;Y++)
{
if(B[i][j]==A[x][y])
{
z=true;
break;
}
}
if(z==true)
break;
}
if(z==true)
break;
}
if(z==true)
break;
}
if(z==true)
cout<<"Yes";
else
cout<<"No";
return 0;
} | a.cc: In function 'int main()':
a.cc:16:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
16 | gets(A[i][j]);
| ^~~~
| getw
a.cc:21:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
21 | gets(B[i][j]);
| ^~~~
| getw
a.cc:29:41: error: 'Y' was not declared in this scope
29 | for(int y=0;y<n;Y++)
| ^
|
s530761881 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
char x[55][55];
char y[55][55];
int main()
{
int a,b,p,cnt=0;
cin>>a>>b;
for(int i=0; i<a; i++){
for(int j=0; j<a; j++){
cin>>x[i][j];
}
}
for(int i=0; i<b; i++){
for(int j=0; j<b; j++){
cin>>y[i][j];
}
}
if(a!=1)
for(int i=0; i<a-b; i++)
{
for(int j=0; j<a-b; j++)
{
for(int k=0; k<b; k++)
{
for(int l=0; l<b; l++)
{
if(x[i+k][l+j]==y[i+k][l+j])
cnt++;
}
}
}
}
p=b*b;
if(cnt==p){
return cout<<"Yes" ,0 ;
}
else if(a==1 && b==1 ){
return cout<<"Yes" ,0;
}
else if(b>a ){
return cout<<"No" ,0;
else
{
return cout<<"No" ,0;
}
} | a.cc: In function 'int main()':
a.cc:45:9: error: expected '}' before 'else'
45 | else
| ^~~~
a.cc:43:22: note: to match this '{'
43 | else if(b>a ){
| ^
|
s278604966 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
scanf("%d %d",&n,&m);
char arr[n][n];
char arr1[m][m];
for(int i=0; i<n; i++)
scanf("%s",arr[i]);
for(int i=0; i<m; i++)
scanf("%s",arr1[i]);
for(int i=0; i<n; i++)
{
for(int j=0; j<n; j++)
{
int c=0;
for(int a=0; a<m; a++)
{
for(int b=0; b<m; b++)
{
if(arr1[a][b]==arr[i+a][j+b])
c++;
}
}
if(c==(m*m))
{
printf("Yes\n");
return 0;
}
}
}
printf("No\n");33
} | a.cc: In function 'int main()':
a.cc:33:22: error: expected ';' before '}' token
33 | printf("No\n");33
| ^
| ;
34 | }
| ~
|
s666805788 | p03804 | C++ |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>m>>n;
char arr[n][n];
char arr1[m][m];
for (int i=0;i<n;i++)
scanf("%s",arr[i]);
for (int i=0;i<n;i++)
scanf("%s",arr1[i]);
for (int i=0;i<n;i++)
{
for (int j=0;j<n;j++)
{
int count=0;
for (int a=0;a<m;a++)
{
for (int b=0;b<m;b++)
{
if(arr1[a][b]==arr [i+a][j+b];
count ++;
}}
if(count==(m*m)){
printf("yes");
return 0;
}}}
printf("no")
} | a.cc: In function 'int main()':
a.cc:28:9: error: expected ')' before ';' token
28 | count ++;
| ^
| )
a.cc:27:3: note: to match this '('
27 | if(arr1[a][b]==arr [i+a][j+b];
| ^
a.cc:35:13: error: expected ';' before '}' token
35 | printf("no")
| ^
| ;
36 | }
| ~
|
s286313502 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>m;
char arr[n][n];
char arr1[m][m];
for (int i=0;i<n;i++)
scanf("%s",arr[i]);
for (int i=0;i<n;i++)
scanf("%s",arr1[i]);
for (int i=0;i<n;i++)
{
for (int j=0;j<n;j++)
{
int count=0;
for (int a=0;a<m;a++)
{
for (int b=0;b<m;b++)
{
if(arr1[a][b]==arr [i+a][j+b];
count ++;
}}
if(count==(m*m)){
printf("yes");
return 0;
}}}
printf("no")
} | a.cc: In function 'int main()':
a.cc:6:7: error: no match for 'operator>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int')
6 | cin>>n>m;
| ~~~~~~^~
| | |
| | int
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:6:7: note: candidate: 'operator>(int, int)' (built-in)
6 | cin>>n>m;
| ~~~~~~^~
a.cc:6:7: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
6 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
6 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1329 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
6 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
6 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1497 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
6 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
6 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1673 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
6 | cin>>n>m;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
6 | cin>>n>m;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
6 | cin>>n>m;
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
6 | cin>>n>m;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
6 | cin>>n>m;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
6 | cin>>n>m;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
6 | cin>>n>m;
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
6 | cin>>n>m;
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
6 | cin>>n>m;
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:6:8: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not d |
s172101532 | p03804 | C | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
scanf("%d %d",&n,&m);
char arr[n][n];
char arr1[m][m];
for(int i=0; i<n; i++)
scanf("%s",arr[i]);
for(int i=0; i<m; i++)
scanf("%s",arr1[i]);
for(int i=0; i<n; i++)
{
for(int j=0; j<n; j++)
{
int c=0;
for(int a=0; a<m; a++)
{
for(int b=0; b<m; b++)
{
if(arr1[a][b]==arr[i+a][j+b])
c++;
}
}
if(c==(m*m))
{
printf("Yes\n");
return 0;
}
}
}
printf("No\n");
} | main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
1 | #include <bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s468277617 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
scanf("%d %d",&n,&m);
char ar[n][n];
char ar[m][m];
for(int i=0; i<n; i++)
scanf("%s",ar[i]);
for(int i=0; i<m; i++)
scanf("%s",ar1[i]);
for(int i=0; i<n; i++)
{
for(int j=0; j<n; j++)
{
int cnt=0;
for(int a=0; a<m; a++)
{
for(int b=0; b<m; b++)
{
if(ar1[a][b]==ar[i+a][j+b])
cnt++;
}
}
if(cnt==(m*m))
{
printf("Yes\n");
return 0;
}
}
}
printf("No\n");
} | a.cc: In function 'int main()':
a.cc:10:6: error: conflicting declaration 'char ar [m][m]'
10 | char ar[m][m];
| ^~
a.cc:9:6: note: previous declaration as 'char ar [n][n]'
9 | char ar[n][n];
| ^~
a.cc:15:20: error: 'ar1' was not declared in this scope; did you mean 'ar'?
15 | scanf("%s",ar1[i]);
| ^~~
| ar
a.cc:27:24: error: 'ar1' was not declared in this scope; did you mean 'ar'?
27 | if(ar1[a][b]==ar[i+a][j+b])
| ^~~
| ar
|
s839833892 | p03804 | C++ | # Python program to illustrate
# template matching
import cv2
import numpy as np
# Read the main image
img_rgb = cv2.imread('mainimage.jpg').
# Convert it to grayscale
img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
# Read the template
template = cv2.imread('template',0)
# Store width and heigth of template in w and h
w, h = template.shape[::-1]
# Perform match operations.
res = cv2.matchTemplate(img_gray,template,cv2.TM_CCOEFF_NORMED)
# Specify a threshold
threshold = 0.8
# Store the coordinates of matched area in a numpy array
loc = np.where( res >= threshold)
# Draw a rectangle around the matched region.
for pt in zip(*loc[::-1]):
cv2.rectangle(img_rgb, pt, (pt[0] + w, pt[1] + h), (0,255,255), 2)
# Show the final image with the matched area.
cv2.imshow('Detected',img_rgb) ; | a.cc:1:3: error: invalid preprocessing directive #Python
1 | # Python program to illustrate
| ^~~~~~
a.cc:2:3: error: invalid preprocessing directive #template
2 | # template matching
| ^~~~~~~~
a.cc:6:3: error: invalid preprocessing directive #Read
6 | # Read the main image
| ^~~~
a.cc:7:22: warning: multi-character literal with 13 characters exceeds 'int' size of 4 bytes
7 | img_rgb = cv2.imread('mainimage.jpg').
| ^~~~~~~~~~~~~~~
a.cc:9:3: error: invalid preprocessing directive #Convert
9 | # Convert it to grayscale
| ^~~~~~~
a.cc:12:3: error: invalid preprocessing directive #Read
12 | # Read the template
| ^~~~
a.cc:13:23: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
13 | template = cv2.imread('template',0)
| ^~~~~~~~~~
a.cc:15:3: error: invalid preprocessing directive #Store
15 | # Store width and heigth of template in w and h
| ^~~~~
a.cc:18:3: error: invalid preprocessing directive #Perform; did you mean #error?
18 | # Perform match operations.
| ^~~~~~~
| error
a.cc:21:3: error: invalid preprocessing directive #Specify
21 | # Specify a threshold
| ^~~~~~~
a.cc:24:3: error: invalid preprocessing directive #Store
24 | # Store the coordinates of matched area in a numpy array
| ^~~~~
a.cc:27:3: error: invalid preprocessing directive #Draw
27 | # Draw a rectangle around the matched region.
| ^~~~
a.cc:31:3: error: invalid preprocessing directive #Show
31 | # Show the final image with the matched area.
| ^~~~
a.cc:32:12: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
32 | cv2.imshow('Detected',img_rgb) ;
| ^~~~~~~~~~
a.cc:3:1: error: 'import' does not name a type
3 | import cv2
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
|
s013944183 | p03804 | C++ |
// loop through the search image
for ( size_t x = 0; x <= S_cols - T_cols; x++ ) {
for ( size_t y = 0; y <= S_rows - T_rows; y++ ) {
SAD = 0.0;
// loop through the template image
for ( size_t j = 0; j < T_cols; j++ )
for ( size_t i = 0; i < T_rows; i++ ) {
pixel p_SearchIMG = S[y+i][x+j];
pixel p_TemplateIMG = T[i][j];
SAD += abs( p_SearchIMG.Grey - p_TemplateIMG.Grey );
}
// save the best found position
if ( minSAD > SAD ) {
minSAD = SAD;
// give me min SAD
position.bestRow = y;
position.bestCol = x;
position.bestSAD = SAD;
}
}
} | a.cc:3:1: error: expected unqualified-id before 'for'
3 | for ( size_t x = 0; x <= S_cols - T_cols; x++ ) {
| ^~~
a.cc:3:21: error: 'x' does not name a type
3 | for ( size_t x = 0; x <= S_cols - T_cols; x++ ) {
| ^
a.cc:3:43: error: 'x' does not name a type
3 | for ( size_t x = 0; x <= S_cols - T_cols; x++ ) {
| ^
|
s737035085 | p03804 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int n,m,w1=0,w2=0,b1=0,b2=0;
cin>>n>>m;
char a[n][n];
char b[m][m];
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin>>a[i][j];
}
}
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
cin>>b[i][j];
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(a[i][j]=="."){
w1++;
}
else
b1++;
}
}
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
if(b[i][j]=="."){
w2++;
}
else
b2++;
}
}
if((w2<=w1)&&(b2<=b1)){
cout<<"yes";
}
else
cout<<"no";
}
| a.cc: In function 'int main()':
a.cc:21:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
21 | if(a[i][j]=="."){
| ~~~~~~~^~~~~
a.cc:30:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
30 | if(b[i][j]=="."){
| ~~~~~~~^~~~~
|
s690077811 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
c=0;
cin>>a>>b;
vector<vector<char>> c(a,vector<char>(a));
vector<vector<char>> d(b,vector<char>(b));
for(int i=0;i<a;i++){
for(int j=0;j<a;j++)
cin>>c.at(i).at(j);
}
for(int i=0;i<b;i++){
for(int j=0;j<b;j++)
cin>>d.at(i).at(j);
}
for(int i=0;i<a-b+1;i++){
for(int j=0;j<a-b+1;j++){
if(d.at(0).at(0)==c.at(i).at(j)){
for(int k=0;k<b;k++){
for(int l=0;l<b;l++){
if(d.at(k).at(l)!=c.at(i+k).at(j+l)){
c=1;
break;
}
if(k==b-1&&l==b-1){
c=2;
break;
}
}
if(c==1){
c=0;
break;
}
if(c==2)
break;
}
}
if(c==2)
break;
}
if(c==2)
break;
}
if(c==2)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
} | a.cc: In function 'int main()':
a.cc:8:24: error: conflicting declaration 'std::vector<std::vector<char> > c'
8 | vector<vector<char>> c(a,vector<char>(a));
| ^
a.cc:5:11: note: previous declaration as 'int c'
5 | int a,b,c;
| ^
a.cc:12:14: error: request for member 'at' in 'c', which is of non-class type 'int'
12 | cin>>c.at(i).at(j);
| ^~
a.cc:20:27: error: request for member 'at' in 'c', which is of non-class type 'int'
20 | if(d.at(0).at(0)==c.at(i).at(j)){
| ^~
a.cc:23:33: error: request for member 'at' in 'c', which is of non-class type 'int'
23 | if(d.at(k).at(l)!=c.at(i+k).at(j+l)){
| ^~
|
s694311545 | p03804 | C++ | #include<bits/stdc++.h>
#include<cstring>
using namespace std;
string s, s1, s2;
int a, b,W=0;
char ch[55][55];
char ch1[55][55];
int main()
{
cin>>a,b;
for(int i=0;i<=a;i++){
for(int j=0;j<a;j++)
cin>>ch[i][j];
for(int i=0;i<b;i++){
for(int j=0;j<b;j++){
cin>>ch1[i][j];
if(ch[i][j]==ch1[i][j]){
W++;
}
else{
W--;
}
}
}
}
if(W<=b)
{
cout<<"Yes";
}
else
{
cout<<"No";
} | a.cc: In function 'int main()':
a.cc:34:10: error: expected '}' at end of input
34 | }
| ^
a.cc:9:1: note: to match this '{'
9 | {
| ^
|
s875907525 | p03804 | C++ | #include<bits/stdc++.h>
#include<cstring>
using namespace std;
{
int a, b;
onst int n=le7 =9;
char ch[55][55];
char ch1[55][55];
int main()
cin>>a,b;
for(int i=0;i<a;i++)
for(int j=0;j<a;j++)
cin>>ch[i][j];
for(int i=0;i<a;i++)
for(int j=0;j<a;j++)
cin>>ch[i][j];
if(ch[i][j]==ch1[i][j]){
cout<<"Yes";
}
else{
cout<<"No";
}
return ;
} | a.cc:6:1: error: expected unqualified-id before '{' token
6 | {
| ^
|
s705998820 | p03804 | C++ | #include<bits/stdc++.h>
#include<cstring>
using namespace std;
string s, s1, s2;
int a, b;
const int n=le7 =9;
char ch[55][55];
char ch1[55][55];
int main()
{
cin>>a,b;
for(int i=0;i<a;i++)
for(int j=0;j<a;j++)
cin>>ch[i][j];
for(int i=0;i<a;i++)
for(int j=0;j<a;j++)
cin>>ch[i][j];
if(ch[i][j]==ch1[i][j]){
cout<<"Yes";
}
else{
cout<<"No";
}
return ;
} | a.cc:6:13: error: 'le7' was not declared in this scope
6 | const int n=le7 =9;
| ^~~
a.cc: In function 'int main()':
a.cc:18:15: error: 'i' was not declared in this scope
18 | if(ch[i][j]==ch1[i][j]){
| ^
a.cc:18:18: error: 'j' was not declared in this scope
18 | if(ch[i][j]==ch1[i][j]){
| ^
a.cc:24:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
24 | return ;
| ^~~~~~
|
s637845237 | p03804 | C | #include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
//S.size()
//配列名.Length()
using namespace std;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;
int main(void){
int N ,M; cin>>N>>M;
string a[N],b[M];
rep(i ,N)cin>>a[i];
rep(j ,M)cin>>b[j];
bool jud = false;
int cnt = 0;
for(int t = 0; t < N - M + 1; t++){
for(int k = 0; k < N - M + 1; k++){
cnt = 0;
for(int s = 0; s < M; s++){
for(int q = 0; q < M; q++){
if(a[t + s][k + q] == b[s][q])cnt++;
}
}
if(cnt == M * M){
jud = true;
}
}
}
cout<<(jud?"Yes":"No");
}
| main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s894041158 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,yes=0;cin>>n>>m;
vector<string> a(n),b(m);
for(int i=0;i<n;i++)cin>>a.at(i);
for(int j=0;j<m;j++)cin>>b.at(j);
for(int k=0;k<n-m+1){
for(int l=0;l<n-m+1){
int x=0;
for(int p=l;p<l+m-1;p++){
if(a.at(k+p).substr(l,m)!=b.at(p)){
x++;
break;
}
}
if(x==0){
cout<<"Yes"<<endl;
yes=1;
break;
}
}
if(yes==1)break;
}
if(yes==0)cout<<"No"<<endl;
}
| a.cc: In function 'int main()':
a.cc:8:22: error: expected ';' before ')' token
8 | for(int k=0;k<n-m+1){
| ^
| ;
a.cc:9:24: error: expected ';' before ')' token
9 | for(int l=0;l<n-m+1){
| ^
| ;
|
s250821072 | p03804 | C++ | 4 1
....
....
....
....
# | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 4 1
| ^
|
s524773039 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N,M;
cin>>N>>M;
bool flag=false;
vector<vector<char>>A<N,vector<char>(N)>;
for(int i=0;i<N;i++){
for(int j=0;j<M;j++{
cin>>A.at(i).at(j);
}
}
vector<vector<char>>B(M,vector<char>(M));
for(int i=0;i<M;i++){
for(int j=0;j<M;j++){
cin>>B.at(i).at(j);
}
}
for(int i=0;i<=N-M;i++){
for(int j=0;j<=N-M;j++){
int sum=0;
for(int k=0;k<M;k++){
for(int l=0;l<M;l++{
A.at(0+k+i).at(M-1+l+j)==B.at(k).at(l);
sum++;
}
}
if(sum==M*M){
cout<<"Yes"<<endl;
flag=true;
break;
}
}
if(flag){
break;
}
}
if(flag==false){
cout<<"Mo"<<endl;
}
| a.cc: In function 'int main()':
a.cc:9:24: error: expected initializer before '<' token
9 | vector<vector<char>>A<N,vector<char>(N)>;
| ^
a.cc:12:24: error: expected ')' before '{' token
12 | for(int j=0;j<M;j++{
| ~ ^
| )
a.cc:13:12: error: 'A' was not declared in this scope
13 | cin>>A.at(i).at(j);
| ^
a.cc:29:34: error: expected ')' before '{' token
29 | for(int l=0;l<M;l++{
| ~ ^
| )
a.cc:30:1: error: 'A' was not declared in this scope
30 | A.at(0+k+i).at(M-1+l+j)==B.at(k).at(l);
| ^
a.cc:49:20: error: expected '}' at end of input
49 | }
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s062656882 | p03804 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(void){
int N,M;
cin >> N >> M;
vector<vector<char>>A(N,vector<char>(N));
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
cin >> A[i][j];
}
}
vector<vector<char>>B(M,vector<char>(M));
for(int i=0;i<M;i++){
for(int j=0;j<M;j++){
cin >> B[i][j];
}
}
bool match;
for(int i=0;i<N-M;i++){
for(int j=0;j<N-m;j++){
match = true;
for(int k=0;k<M;k++){
for(int l=0;l<M;l++){
if(B[k][l] != A[i + k][j + l])
match = false;
}
}
if(match)
break;
}
if(match)
break;
}
if(match)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:21: error: 'm' was not declared in this scope
25 | for(int j=0;j<N-m;j++){
| ^
|
s532808438 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define INF 2e9
#define ll long long
int main(){
int i, j, n, m, k, l;
cin>>n>>m;
char a[n][n], b[m][m];
for(i=0; i<n; i++){
cin>>a[i];
}
for(i=0; i<m; i++){
cin>>b[i];
}
int flag = 0:
for(i=0; i<n-m+1; i++){
for(j=0; j<n-m+1; j++){
flag = 1;
for(k=0; k<m; k++){
for(l=0; k<m; l++){
if(a[i+k][i+l]!=b[k][l]){
flag = 0;
}
}
}
if(flag == 1){
cout<<"Yes"<<endl;
return 0;
}
}
}
cout<<"No"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:21:17: error: expected ',' or ';' before ':' token
21 | int flag = 0:
| ^
a.cc:22:26: error: expected ';' before ')' token
22 | for(i=0; i<n-m+1; i++){
| ^
| ;
|
s036941148 | p03804 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;
ll mod = pow(10,9) + 7;
int ctoi(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
return 0;
}
char upper(char c){
return c-0x20;
}
char lower(char c){
return c+0x20;
}
int main() {
int N,M; cin>>N>>M;
const int nmmax=50;
char A[nmmax][nmmax],B[nmmax][nmmax];
for(int y=0;y<N;++y){
for(int x=0;x<N;++x){
cin >> A[y][x];
}
}
for(int y=0;y<M;++y){
for(int x=0;x<M;++x){
cin >> B[y][x];
}
}
bool exist=false;
for(int ly=0;ly<N;++ly){
for(int lx=0;lx<N;++lx){
if(ly+M-1>=N or lx+M-1>=N) continue;
bool match=true;
for(int y=0;y<M;++y){
for(int x=0;x<M;++x){
if(A[ly+y][lx+x]!=B[y][x]) match=false;
} }
if(match) exist=true;
}
}
if(exist)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
} | a.cc:61:1: error: expected declaration before '}' token
61 | }
| ^
|
s175427374 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int n,m;
vector<string> a;
vector<string> b;
bool check(int h, int w){
for(int i=0;i<m&&h<n;i++){
if(m[i]==a[h].substr(w,m)) h++;
else return false;
}
return true;
}
int main(){
cin>>n>>m;
a.resize(n);
b.resize(m);
for(int i=0;i<n;i++) cin>>a[i];
for(int i=0;i<m;i++) cin>>b[i];
bool flag=false;
for(int i=0;i<n;i++){
for(int j=0;(j+m)<n;j++){
if(b[0]==a[i].substr(j,m)) flag=check(i,j);
if(flag){
cout<<"Yes"<<endl;
return 0;
}
}
}
cout<<"No"<<endl;
}
| a.cc: In function 'bool check(int, int)':
a.cc:12:9: error: invalid types 'int[int]' for array subscript
12 | if(m[i]==a[h].substr(w,m)) h++;
| ^
|
s486714813 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
cin >> n >> m;
vector<string> a(n), b(m);
for (auto&& ai : a) cin >> ai;
for (auto&& bi : b) cin >> bi;
bool found = false;
for (int r = 0; r < n-m; r++)
{
for (int c = 0; c < n-m; c++)
{
found = true;
for (int i = 0; i < m; i++)
if (a[i+r].substr(c, m) != b[i])
{
found = false;
break;
}
if (found) break;
}
if (found) break;
}
cout << (found ? "Yes" : "No") << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:16: error: 'n' was not declared in this scope; did you mean 'yn'?
7 | cin >> n >> m;
| ^
| yn
a.cc:7:21: error: 'm' was not declared in this scope; did you mean 'tm'?
7 | cin >> n >> m;
| ^
| tm
|
s335326508 | p03804 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
using namespace std;
using v = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}
int main(int argc, char *argv[]){
int n, m; cin >> n >> m;
vector<string> A(n), B(m);
string res;
bool flag = true;
rep(i, n) cin >> A[i];
rep(i, m) cin >> B[i];
if(n == 1 and m == 1){
if(A[0][0] == B[0][0]) goto yes;
else goto res;
}
rep(i, n){
if(i + m > n - 1) break;
rep(j, n){
if(j + m > n - 1) break;
flag = true;
rep(x, m){
if(!flag) break;
rep(y, m){
if(A[i+x][j+y] != B[x][y]){
flag = false;
break;
}
}
}
if(flag){
yes:
cout << "Yes" << endl;
return 0;
}
}
}
res:
cout << "No" << endl;
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:40:17: error: jump to label 'yes'
40 | yes:
| ^~~
a.cc:22:37: note: from here
22 | if(A[0][0] == B[0][0]) goto yes;
| ^~~
a.cc:27:13: note: crosses initialization of 'int j'
27 | rep(j, n){
| ^
a.cc:2:27: note: in definition of macro 'rep'
2 | #define rep(i, n) for(int i = 0; i < (int)n; i++)
| ^
a.cc:25:9: note: crosses initialization of 'int i'
25 | rep(i, n){
| ^
a.cc:2:27: note: in definition of macro 'rep'
2 | #define rep(i, n) for(int i = 0; i < (int)n; i++)
| ^
|
s123694733 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
char A[N][N], B[M][M];
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; i++) {
cin >> A[i][j];
}
}
for (int i = 0; i < M; i++) {
for (int j = 0; j < M; i++) {
cin >> B[i][j];
}
}
for (int i = 0; i + M <= N; i++) {
for (int j = 0; j + M <= N; j++) {
bool ans = ture;
for (int x = 0; x < M; x++) {
for (int y = 0; y < M; y++) {
if(A[i + x][i + y] != B[x][y]) {
ans = false;
}
}
}
if (ans) {
cout << Yes;
return 0;
}
}
}
cout << No;
} | a.cc: In function 'int main()':
a.cc:22:18: error: 'ture' was not declared in this scope
22 | bool ans = ture;
| ^~~~
a.cc:31:17: error: 'Yes' was not declared in this scope
31 | cout << Yes;
| ^~~
a.cc:36:11: error: 'No' was not declared in this scope; did you mean 'N'?
36 | cout << No;
| ^~
| N
|
s874264851 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
char a[50], b[50];
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
cin >> a[i][j];
}
}
for(int i = 0; i < m; i++) {
for(int j = 0; j < m; j++) {
cin >> b[i][j];
}
}
bool e = 0;
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
if(i + m - 1 >= m || j + m - 1 >= n) {
continue;
}
bool match = 1;
for(int y = 0; y < m; y++) {
for(int x = 0; x < m; x++) {
if(a[i + y][j + x] != b[y][x]) match = 0;
}
}
if(match) e = 1;
}
}
if(e) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:18: error: invalid types 'char[int]' for array subscript
10 | cin >> a[i][j];
| ^
a.cc:15:18: error: invalid types 'char[int]' for array subscript
15 | cin >> b[i][j];
| ^
a.cc:27:22: error: invalid types 'char[int]' for array subscript
27 | if(a[i + y][j + x] != b[y][x]) match = 0;
| ^
a.cc:27:37: error: invalid types 'char[int]' for array subscript
27 | if(a[i + y][j + x] != b[y][x]) match = 0;
| ^
|
s502540121 | p03804 | C++ | 4 1
....
....
....
....
# | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 4 1
| ^
|
s113025992 | p03804 | C++ | include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
vector<string> a(n),b(m);
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<m;i++)cin>>b[i];
bool flag;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(a[i][j]==b[0][0]){
flag=true;
for(int k=0;k<m;k++){
for(int l=0;l<m;l++){
if(a[i+k][j+l]!=b[k][l]){
flag=false;
break;
}
}
}
if(flag){
cout<<"Yes"<<endl;
return 0;
}
}
}
}
cout<<"No"<<endl;
}
| a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/char_traits.h:50:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared
144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type
146 | static _GLIBCXX14_CONSTEXPR std::size_t
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared
150 | find(const char_type* __s, std::size_t __n, const char_type& __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared
153 | move(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared
156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared
159 | assign(char_type* __s, std::size_t __n, char_type __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared
187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
| ^~~
/usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)':
/usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~
| __n
/usr/include/c++/14/bits/char_traits.h: At global scope:
/usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type
198 | _GLIBCXX14_CONSTEXPR std::size_t
| |
s309216811 | p03804 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void){
int N,M;
cin>>N>>M;
string A[N],B[M];
for(int i=0;i<N;i++)
cin>>A[i];
for(int i=0;i<M;i++)
cin>>B[i];
bool flag;
for(int i=0;i<=N-M;i++){
for(int j=0;j<=N-M;j++){
flag=true;
for(int k=0;k<M;k++){
string sub=A[i+k].substr(j,M);
if(sub!=B[i+k]){
flag=false;
break;
}
}
if(flag==true)break;
}
if(flag==true)break;
}
cout<<(flag?"Yes":"No"<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:29:27: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<'
29 | cout<<(flag?"Yes":"No"<<endl;
| ~~~~^~~~~~
a.cc:29:33: error: expected ')' before ';' token
29 | cout<<(flag?"Yes":"No"<<endl;
| ~ ^
| )
|
s837322721 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
string a[n], b[m];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < m; i++) {
cin >> b[i];
}
for (int i = m; i <= n; i++) {
for (int j = m; i <= n; j++) {
bool contains = true;
for (int k = i - m; k < i; k++) {
for (int l = j - m; l < j; l++) {
if (a[k][l] != b[k - i + m][l - j - m]) {
contains = false;
}
}
}
if (contains) {
cout << "Yes" << endl;
return 0;
}
}
}
cout "No" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:30:7: error: expected ';' before string constant
30 | cout "No" << endl;
| ^~~~~
| ;
|
s001249978 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
string a[n], b[m];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < m; i++) {
cin >> b[i];
}
for (int i = m; i <= n; i++) {
for (int j = m; i <= n; j++) {
bool contains = true;
for (int k = i - m; k < i; k++) {
for (int l = j - m; l < j; l++) {
if (a[k][l] != b[k - i + m]) {
contains = false;
}
}
}
if (contains) {
cout << "Yes" << endl;
return 0;
}
}
}
cout "No" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:19:23: error: no match for 'operator!=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
19 | if (a[k][l] != b[k - i + m]) {
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1132:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1132 | operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1132:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
/usr/include/c++/14/bits/regex.h:1212:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator!=(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1212 | operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1212:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
/usr/include/c++/14/bits/regex.h:1305:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1305 | operator!=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1305:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
/usr/include/c++/14/bits/regex.h:1379:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1379 | operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1379:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | if (a[k][l] != b[k - i + m]) {
| ^
/usr/include/c++/14/bits/regex.h:1473:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1473 | operator!=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1473:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
/usr/include/c++/14/bits/regex.h:1547:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1547 | operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1547:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | if (a[k][l] != b[k - i + m]) {
| ^
/usr/include/c++/14/bits/regex.h:1647:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1647 | operator!=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1647:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
/usr/include/c++/14/bits/regex.h:2213:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator!=(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2213 | operator!=(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2213:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
455 | operator!=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
500 | operator!=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1686 | operator!=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1753 | operator!=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)'
197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed:
a.cc:19:37: note: mismatched types 'const std::fpos<_StateT>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | if (a[k][l] != b[k - i + m]) {
| ^
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)'
243 | operator!=(const allocator<_T1>&, |
s234095978 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(a, b) printf(a, b);
#define c(s) cout << (s) << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define cyn(c) cout << (c ? "Yes" : "No") << endl;
#define cYN(c) cout << (c ? "YES" : "NO") << endl;
#define pyn(c) printf("%s\n", c ? "Yes" : "No");
#define pYN(c) printf("%s\n", c ? "YES" : "NO");
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> P;
template <class T>
bool contain(const std::string &s, const T &v)
{
return s.find(v) != std::string::npos;
}
int main() {
int n,m; bool ok=false;
char a[55][55]={},b[55][55]={};
cin >> n >> m;
rep(i,n)rep(j,n)cin>>a[i][j];
rep(i,m)rep(j,m)cin>>b[i][j];
rep(i,n-m){
rep(j,n-m){
bool flag = true;
rep(k,m){
rep(l,m){
if(a[i+k][j+l]!=b[k][l]){
flag = false;
}
}
}
if(flag)ok=ture;
}
}
if(ok){
yes;
}else{
no;
}
} | a.cc: In function 'int main()':
a.cc:42:24: error: 'ture' was not declared in this scope
42 | if(flag)ok=ture;
| ^~~~
|
s686231348 | p03804 | C | #include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
int compare_f(const void *a, const void *b) {
return *((int64_t *)a) < *((int64_t *)b) ? -1 : 1;
}
int compare_f2(const void *a, const void *b) {
return *((uint64_t *)a) > *((uint64_t *)b) ? -1 : 1;
}
static size_t comb(const size_t n, const size_t r) {
size_t result = 1;
for (size_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t combU64(const uint64_t n, const uint64_t r) {
uint64_t result = 1;
for (uint64_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t gcd(uint64_t m, uint64_t n)
{
uint64_t temp;
while (m%n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
static char s[200001];
int main(void) {
size_t N, M;
char A[50], B[50];
scanf("%zu %zu\n", &N, &M);
for (size_t i = 0; i < N; i++) {
scanf("%s\n", A[i]);
}
for (size_t i = 0; i < M; i++) {
scanf("%s", B[i]);
if (i < M - 1) {
scanf("\n");
}
}
bool found = false;
for (size_t rowOffset = 0; rowOffset <= N - M; rowOffset++) {
for (size_t colOffset = 0; colOffset <= N - M; colOffset++) {
bool matched = true;
for (size_t row = 0; row <= M; row++) {
for (size_t col = 0; col <= M; col++) {
if (A[rowOffset + row][colOffset + col] != B[row][col]) {
matched = false;
break;
}
}
if (matched) {
found = true;
break;
}
}
}
}
puts(found ? "Yes" : "No");
return 0;
}
| main.c: In function 'main':
main.c:86:63: error: subscripted value is neither array nor pointer nor vector
86 | if (A[rowOffset + row][colOffset + col] != B[row][col]) {
| ^
main.c:86:90: error: subscripted value is neither array nor pointer nor vector
86 | if (A[rowOffset + row][colOffset + col] != B[row][col]) {
| ^
|
s005725552 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, m, i, j, k, l, f = 0;
cin << n << m;
char a[n][n], b[m][m];
for(i=0; i<n; i++){
for(j=0; j<n; j++){
cin >> a[i][j];
}
}
for(i=0; i<m; i++){
for(j=0; j<m; j++){
cin >> b[i][j];
}
}
for(i=0; i<n-m+1; i++){
for(j=0; j<n-m+1; j++){
f = 0;
for(k=0; k<m; k++){
for(l=0; l<m; l++){
if(a[i+k][j+l] != b[k][l]){
f = 1;
break;
}
if(k == m-1 && l == m-1){
cout << "Yes";
return 0;
}
}
if(f == 1) break;
}
}
}
cout << "No";
return 0;
} | a.cc: In function 'int main()':
a.cc:6:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
6 | cin << n << m;
| ~~~ ^~ ~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:6:9: note: candidate: 'operator<<(int, int)' (built-in)
6 | cin << n << m;
| ~~~~^~~~
a.cc:6:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)'
1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin << n << m;
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:6:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
6 | cin << n << m;
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin << n << m;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin << n << m;
| ^
/usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)'
1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin << n << m;
| ^
In file included 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/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin << n << m;
| ^
In file included from /usr/include/c++/14/memory:80,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56:
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)'
70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin << n << m;
| ^
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:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin << n << m;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin << n << m;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin << n << m;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin << n << m;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin << n << m;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin << n << m;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin << n << m;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:6:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin << n << m;
| ^
/usr/include/c++/14/ostream |
s344378799 | p03804 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, m, i, j, k, l, b = 0;
char a[n][n], b[m][m];
for(i=0; i<n; i++){
for(j=0; j<n; j++){
cin >> a[i][j]
}
}
for(i=0; i<m; i++){
for(j=0; j<m; j++){
cin >> b[i][j];
}
}
for(i=0; i<n-m+1; i++){
for(j=0; j<n-m+1; j++){
b = 0
for(k=0; k<m; k++){
for(l=0; l<m; l++){
if(a[i+k][j+l] != b[i][j]){
b = 1;
break;
}
if(k == m-1 && l == m-1){
cout << "Yes";
return 0;
}
}
if(b == 1) break;
}
}
}
cout << "No";
return 0;
} | a.cc: In function 'int main()':
a.cc:6:19: error: conflicting declaration 'char b [m][m]'
6 | char a[n][n], b[m][m];
| ^
a.cc:5:27: note: previous declaration as 'int b'
5 | int n, m, i, j, k, l, b = 0;
| ^
a.cc:9:27: error: expected ';' before '}' token
9 | cin >> a[i][j]
| ^
| ;
10 | }
| ~
a.cc:14:21: error: invalid types 'int[int]' for array subscript
14 | cin >> b[i][j];
| ^
a.cc:19:18: error: expected ';' before 'for'
19 | b = 0
| ^
| ;
20 | for(k=0; k<m; k++){
| ~~~
a.cc:20:30: error: expected ';' before ')' token
20 | for(k=0; k<m; k++){
| ^
| ;
|
s937526391 | p03804 | C++ | #include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;
using namespace std;
int n, m;
vector<string> a(60);
vector<string> b(60);
bool match(int x, int y) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < M; j++) {
if (a[x + i][y + j] != b[i][j]) return false;
}
}
return true;
}
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < m; i++) cin >> b[i];
bool found = false;
for (int i = 0; i <= n - m; i++) {
for (int j = 0; j <= n - m; j++) {
if (match(i, j)) found = true;
}
}
if (found)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | a.cc: In function 'bool match(int, int)':
a.cc:14:25: error: 'M' was not declared in this scope
14 | for (int j = 0; j < M; j++) {
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.