submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s667510370 | p03681 | C | #include<stdio.h>
#include<math.h>
int main()
{
long long int a,b,ans,mod,i,modp[200001];
scanf("%lld %lld",&a,&b);
mod=pow(10,9)+7;
modp[0]=1
for(i=1;i<200001;++i)
{
modp[i]=(modp[i-1]*i)%mod;
}
ans=(modp[a]*modp[b])%mod;
if(abs(a-b)>1) printf("0");
else printf("%lld",ans);
return 0;} | main.c: In function 'main':
main.c:8:12: error: expected ';' before 'for'
8 | modp[0]=1
| ^
| ;
9 | for(i=1;i<200001;++i)
| ~~~
main.c:14:6: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
14 | if(abs(a-b)>1) printf("0");
| ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
2 | #include<math.h>
+++ |+#include <stdlib.h>
3 | int main()
main.c:14:11: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
14 | if(abs(a-b)>1) printf("0");
| ~^~
<built-in>: note: built-in 'abs' declared here
|
s509492826 | p03681 | C++ | #include<bits/stdc++.h>
#define D 1000000007
using namespace std;
using ull = long long;
}
int main(){
ull n, m; cin >> n >> m;
ull ans =0;
ull n_func=1, m_func=1;
if(n-m > 1 || m-n > 1){
cout << 0 << endl;
return 0;
}
for(int i=n; i>=1; i--){
n_func = n_func*i;
n_func = n_func%D;
}
for(int i=m; i>=1; i--){
m_func = m_func*i;
m_func = m_func%D;
}
ans = n_func * m_func;
if(n==m) ans = ans*2;
ans = ans%D;
cout << ans << endl;
return 0;
} | a.cc:6:1: error: expected declaration before '}' token
6 | }
| ^
|
s224355363 | p03681 | C++ | #include<bits/stdc++.h>
#define D 1000000007
using namespace std;
using ull = unsigned long long;
int main(){
ull n, m; cin >> n >> m;
ull ans =0;
ull n_func=1, m_func=1;
if(abs(n-m) > 1){
cout << 0 << endl;
return 0;
}
for(int i=n; i>=1; i--){
n_func = n_func*i;
n_func = n_func%D;
}
for(int i=m; i>=1; i--){
m_func = m_func*i;
m_func = m_func%D;
}
ans = n_func * m_func;
if(n==m) ans = ans*2;
ans = ans%D;
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:11: error: call of overloaded 'abs(ull)' is ambiguous
10 | if(abs(n-m) > 1){
| ~~~^~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
|
s988960696 | p03681 | C++ | /*
Contest 065
C - Reconciled?
Rakesh Kumar --> 01/09/2020
*/
#include <bits/stdc++.h>
using ll = long long int;
ll f (ll n) {
ll r = 1;
for (ull i = 2; i <= n; ++i)
r = (r * i) % static_cast<ll>((1e9 + 7));
return r;
}
/*
combinations maths questions.
for example
D --> dog, M --> Monkey
if abs(D - M) == 0
let's D = M = 2
can be 2 combinations where DMDM or MDMD therefore (D! * M!) * 2
if abs(D - M) = 1
DMD, MDM so D! * M!
else abs(D - M) > 1
0, because dog and monkey can't stand each other
*/
const ll M = (1e9 + 7);
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0); std::cout.tie(0);
ll n = 0, m = 0;
std::cin >> n >> m;
ll result = 1;
if (std::abs(n - m) <= 1) {
/*
result = f(n);
result *= f(m);
*/
for (int i = 2; i <= n; ++i)
result = result * i % M;
for (int i = 1; i <= m; ++i)
result = result * i % M;
}
if (n == m)
result = result * 2 % M;
std::cout << result << std::endl;
return 0;
}
| a.cc: In function 'll f(ll)':
a.cc:13:10: error: 'ull' was not declared in this scope; did you mean 'll'?
13 | for (ull i = 2; i <= n; ++i)
| ^~~
| ll
a.cc:13:21: error: 'i' was not declared in this scope
13 | for (ull i = 2; i <= n; ++i)
| ^
|
s542024997 | p03681 | C++ | #include<iostream>
using namespace std;
typedef long long ll;
#define MOD 1000000007
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
ll n, m;
scanf("%lld %lld", &n, &m);
if (m < n - 1 || n + 1 < m) {
printf("%d\n", 0);
return 0;
}
ll ans = 1;
if (abs(m - n) == 1) {
maxi = max(m, n)
for (ll i = 1; i <= maxi; i++) ans = ans * i % MOD;
ans = ans * (ans / maxi) % MOD;
} else {
for (ll i = 1; i <= n; i++) ans = ans * i % MOD;
ans = ans * ans * 2 % MOD;
}
printf("%lld\n", ans);
} | a.cc: In function 'int main()':
a.cc:21:9: error: 'maxi' was not declared in this scope
21 | maxi = max(m, n)
| ^~~~
a.cc:22:24: error: 'i' was not declared in this scope
22 | for (ll i = 1; i <= maxi; i++) ans = ans * i % MOD;
| ^
|
s233394451 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m; scanf("%d%d", &n, &m);
if(abs(n - m) > 1) {
printf("0\n");
return 0;
}
// 同数の場合 N! * M! * 2
// 1個違いの場合 N! * M!
ll n_kai = 1;
ll m_kai = 1;
for(int i = 1; i <= n; i++) n_kai = (n_kai * i) % MOD;
for(int i = 1; i <= m; i++) m_kai = (m_kai * i) % MOD;
ll ans = 1;
if(n == m) {
ans = (n_kai * m_kai * 2) % MOD;
}
else {
ans = (n_kai * m_kai) % MOD;
}
printf("%lld\n", ans % MOD);
return 0;
} | a.cc: In function 'int main()':
a.cc:11:5: error: 'll' was not declared in this scope
11 | ll n_kai = 1;
| ^~
a.cc:12:7: error: expected ';' before 'm_kai'
12 | ll m_kai = 1;
| ^~~~~~
| ;
a.cc:13:33: error: 'n_kai' was not declared in this scope
13 | for(int i = 1; i <= n; i++) n_kai = (n_kai * i) % MOD;
| ^~~~~
a.cc:13:55: error: 'MOD' was not declared in this scope
13 | for(int i = 1; i <= n; i++) n_kai = (n_kai * i) % MOD;
| ^~~
a.cc:14:33: error: 'm_kai' was not declared in this scope
14 | for(int i = 1; i <= m; i++) m_kai = (m_kai * i) % MOD;
| ^~~~~
a.cc:14:55: error: 'MOD' was not declared in this scope
14 | for(int i = 1; i <= m; i++) m_kai = (m_kai * i) % MOD;
| ^~~
a.cc:16:7: error: expected ';' before 'ans'
16 | ll ans = 1;
| ^~~~
| ;
a.cc:18:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
18 | ans = (n_kai * m_kai * 2) % MOD;
| ^~~
| abs
a.cc:18:16: error: 'n_kai' was not declared in this scope
18 | ans = (n_kai * m_kai * 2) % MOD;
| ^~~~~
a.cc:18:24: error: 'm_kai' was not declared in this scope
18 | ans = (n_kai * m_kai * 2) % MOD;
| ^~~~~
a.cc:18:37: error: 'MOD' was not declared in this scope
18 | ans = (n_kai * m_kai * 2) % MOD;
| ^~~
a.cc:21:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
21 | ans = (n_kai * m_kai) % MOD;
| ^~~
| abs
a.cc:21:16: error: 'n_kai' was not declared in this scope
21 | ans = (n_kai * m_kai) % MOD;
| ^~~~~
a.cc:21:24: error: 'm_kai' was not declared in this scope
21 | ans = (n_kai * m_kai) % MOD;
| ^~~~~
a.cc:21:33: error: 'MOD' was not declared in this scope
21 | ans = (n_kai * m_kai) % MOD;
| ^~~
a.cc:23:22: error: 'ans' was not declared in this scope; did you mean 'abs'?
23 | printf("%lld\n", ans % MOD);
| ^~~
| abs
a.cc:23:28: error: 'MOD' was not declared in this scope
23 | printf("%lld\n", ans % MOD);
| ^~~
|
s640751260 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
template<int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0) val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator - () const noexcept {
return val ? MOD - val : 0;
}
constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
constexpr Fp& operator += (const Fp& r) noexcept {
val += r.val;
if (val >= MOD) val -= MOD;
return *this;
}
constexpr Fp& operator -= (const Fp& r) noexcept {
val -= r.val;
if (val < 0) val += MOD;
return *this;
}
constexpr Fp& operator *= (const Fp& r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp& operator /= (const Fp& r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
val = val * u % MOD;
if (val < 0) val += MOD;
return *this;
}
constexpr bool operator == (const Fp& r) const noexcept {
return this->val == r.val;
}
constexpr bool operator != (const Fp& r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0) return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1) t = t * a;
return t;
}
};
const int MOD = 1e9+7;
using mint = Fp<MOD>
int main() {
int N,M;
mint A=1;
int B=0;
cin>>N>>M;
if(N==M){
for(int X=1;X<=N;X++){
A*=X;
}
cout<<A*A*2<<endl;
}
else if(abs(N-M)>1){
cout<<0<<endl;
}
else{
for(int X=1;X<=max(N,M);X++){
A*=X;
if(X=min(N,M)){
B+=A;
}
}
cout<<A*B<<endl;
}
}
| a.cc:59:14: error: two or more data types in declaration of 'type name'
59 | using mint = Fp<MOD>
| ^~~~~~~
|
s617929590 | p03681 | C++ | #include <bits/stdc++.h>
template<int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0) val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator - () const noexcept {
return val ? MOD - val : 0;
}
constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
constexpr Fp& operator += (const Fp& r) noexcept {
val += r.val;
if (val >= MOD) val -= MOD;
return *this;
}
constexpr Fp& operator -= (const Fp& r) noexcept {
val -= r.val;
if (val < 0) val += MOD;
return *this;
}
constexpr Fp& operator *= (const Fp& r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp& operator /= (const Fp& r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
val = val * u % MOD;
if (val < 0) val += MOD;
return *this;
}
constexpr bool operator == (const Fp& r) const noexcept {
return this->val == r.val;
}
constexpr bool operator != (const Fp& r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0) return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1) t = t * a;
return t;
}
};
const int MOD = 1e9+7;
using mint = Fp<MOD>
using namespace std;
int main() {
mint N,M;
mint A=1;
mint B=0;
cin>>N>>M;
if(N==M){
for(mint X=1;X<=N;X++){
A*=X;
}
cout<<A*A*2<<endl;
}
else if(abs(N-M)>1){
cout<<0<<endl;
}
else{
for(mint X=1;X<=max(N,M);X++){
A*=X;
if(X=min(N,M)){
B+=A;
}
}
cout<<A*B<<endl;
}
} | a.cc:46:22: error: 'ostream' does not name a type
46 | friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
| ^~~~~~~
a.cc: In member function 'constexpr Fp<MOD>& Fp<MOD>::operator/=(const Fp<MOD>&)':
a.cc:33:25: error: there are no arguments to 'swap' that depend on a template parameter, so a declaration of 'swap' must be available [-fpermissive]
33 | a -= t * b; swap(a, b);
| ^~~~
a.cc:33:25: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:34:25: error: there are no arguments to 'swap' that depend on a template parameter, so a declaration of 'swap' must be available [-fpermissive]
34 | u -= t * v; swap(u, v);
| ^~~~
a.cc: At global scope:
a.cc:58:21: error: expected ';' before 'using'
58 | using mint = Fp<MOD>
| ^
| ;
59 | using namespace std;
| ~~~~~
a.cc: In function 'int main()':
a.cc:62:3: error: 'mint' was not declared in this scope; did you mean 'uint'?
62 | mint N,M;
| ^~~~
| uint
a.cc:63:7: error: expected ';' before 'A'
63 | mint A=1;
| ^~
| ;
a.cc:64:7: error: expected ';' before 'B'
64 | mint B=0;
| ^~
| ;
a.cc:65:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
65 | 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:65:8: error: 'N' was not declared in this scope
65 | cin>>N>>M;
| ^
a.cc:65:11: error: 'M' was not declared in this scope
65 | cin>>N>>M;
| ^
a.cc:67:13: error: expected ';' before 'X'
67 | for(mint X=1;X<=N;X++){
| ^~
| ;
a.cc:67:18: error: 'X' was not declared in this scope
67 | for(mint X=1;X<=N;X++){
| ^
a.cc:68:7: error: 'A' was not declared in this scope
68 | A*=X;
| ^
a.cc:70:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
70 | cout<<A*A*2<<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:70:11: error: 'A' was not declared in this scope
70 | cout<<A*A*2<<endl;
| ^
a.cc:70:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
70 | cout<<A*A*2<<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:73:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
73 | cout<<0<<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:73:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
73 | cout<<0<<endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:76:13: error: expected ';' before 'X'
76 | for(mint X=1;X<=max(N,M);X++){
| ^~
| ;
a.cc:76:18: error: 'X' was not declared in this scope
76 | for(mint X=1;X<=max(N,M);X++){
| ^
a.cc:76:21: error: 'max' was not declared in this scope; did you mean 'std::max'?
76 | for(mint X=1;X<=max(N,M);X++){
| ^~~
| std::max
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
a.cc:77:7: error: 'A' was not declared in this scope
77 | A*=X;
| ^
a.cc:78:12: error: 'min' was not declared in this scope; did you mean 'std::min'?
78 | if(X=min(N,M)){
| ^~~
| std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
a.cc:79:9: error: 'B' was not declared in this scope
79 | B+=A;
| ^
a.cc:82:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
82 | cout<<A*B<<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:82:11: error: 'A' was not declared in this scope
82 | cout<<A*B<<endl;
| ^
a.cc:82:13: error: 'B' was not declared in this scope
82 | cout<<A*B<<endl;
| ^
a.cc:82:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
82 | cout<<A*B<<endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s875837127 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define MOD = 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
ll N,M;
cin>>N>>M;
ll mod=1;
rep(i,N) mod=mod*i%MOD;
rep(j,M) mod=mod*j%MOD;
cout<<mod<<endl;
} | a.cc: In function 'int main()':
a.cc:8:13: error: expected primary-expression before '=' token
8 | #define MOD = 1000000007ULL;
| ^
a.cc:16:28: note: in expansion of macro 'MOD'
16 | rep(i,N) mod=mod*i%MOD;
| ^~~
a.cc:8:13: error: expected primary-expression before '=' token
8 | #define MOD = 1000000007ULL;
| ^
a.cc:17:28: note: in expansion of macro 'MOD'
17 | rep(j,M) mod=mod*j%MOD;
| ^~~
|
s415958642 | p03681 | C++ |
ans=fact(min(n,m));
ans*=ans;
ans%=mod;
ans*=max(n,m);
ans%=mod;
}
cout<<ans;
}
else
cout<<"0\n";
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(0); ///cant use scanf, printf
cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
//cout << fixed << setprecision(11); /// no scientific output
ll test=1;
// cin>>test;
while(test--)
{
//fun();
vfun();
// if(vfun())
// cout<<"YES\n";
// else
// cout<<"NO\n";
}
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not
| a.cc:2:17: error: 'ans' does not name a type
2 | ans=fact(min(n,m));
| ^~~
a.cc:3:17: error: 'ans' does not name a type
3 | ans*=ans;
| ^~~
a.cc:4:17: error: 'ans' does not name a type
4 | ans%=mod;
| ^~~
a.cc:5:17: error: 'ans' does not name a type
5 | ans*=max(n,m);
| ^~~
a.cc:6:17: error: 'ans' does not name a type
6 | ans%=mod;
| ^~~
a.cc:7:13: error: expected declaration before '}' token
7 | }
| ^
a.cc:9:9: error: 'cout' does not name a type
9 | cout<<ans;
| ^~~~
a.cc:10:5: error: expected declaration before '}' token
10 | }
| ^
a.cc:11:5: error: expected unqualified-id before 'else'
11 | else
| ^~~~
a.cc:14:1: error: expected declaration before '}' token
14 | }
| ^
a.cc: In function 'int main()':
a.cc:19:31: error: 'stdin' was not declared in this scope
19 | freopen("input.txt", "r", stdin);
| ^~~~~
a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 |
a.cc:19:5: error: 'freopen' was not declared in this scope
19 | freopen("input.txt", "r", stdin);
| ^~~~~~~
a.cc:20:32: error: 'stdout' was not declared in this scope
20 | freopen("output.txt", "w", stdout);
| ^~~~~~
a.cc:20:32: note: 'stdout' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:22:5: error: 'ios_base' has not been declared
22 | ios_base::sync_with_stdio(0); ///cant use scanf, printf
| ^~~~~~~~
a.cc:23:5: error: 'cin' was not declared in this scope
23 | cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
| ^~~
a.cc:23:16: error: 'cout' was not declared in this scope
23 | cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
| ^~~~
a.cc:25:5: error: 'll' was not declared in this scope
25 | ll test=1;
| ^~
a.cc:27:11: error: 'test' was not declared in this scope
27 | while(test--)
| ^~~~
a.cc:31:9: error: 'vfun' was not declared in this scope
31 | vfun();
| ^~~~
|
s762144132 | p03681 | C++ | #include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;
using namespace std;
//using namespace __gnu_pbds;
#define endl '\n'
#define sl(n) scanf("%lld",&n)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define f(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
#define rf(i,a,b) for(ll i = (ll)(a); i > (ll)(b); i--)
#define ms(a,b) memset((a),(b),sizeof(a))
#define abs(x) ((x<0)?(-(x)):(x))
#define MAX 1000005
#define inf LLONG_MAX
#define ninf LLONG_MIN
#define MIN INT_MIN
#define yeet return 0;
#define tihs if(fopen("input.txt","r"))freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long MAX2(long long a, long long b){return (a)>(b)?(a):(b);}
inline long long MAX3(long long a, long long b,long long c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long MIN2(long long a, long long b){return (a)<(b)?(a):(b);}
inline long long MIN3(long long a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
//typedef
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
int mod = 1e9 +7 ;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {if (!a) {x = 0;y = 1;return b;}int64_t x1, y1;int64_t d = extGcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}
inline ll addmod(ll a,ll b){a=a%mod+b%mod;if(a>mod)a%=mod;return a;}
inline ll submod(ll a,ll b){a=a%mod-b%mod;if(a<0)a+=mod;return a;}
inline ll mulmod(ll a,ll b){return (a%mod * b%mod)%mod;}
int dx[]={1,1,0,-1,-1,-1, 0, 1};
int dy[]={0,1,1, 1, 0,-1,-1,-1};
inline ll exp(ll a,ll b){if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=r*(a%mod);r=(r+mod)%mod;}b/=2;a=(a%mod)*(a%mod);a=(a+mod)%mod;}return (r+mod)%mod;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }
ll f[MAX];
ll iv[MAX];
ll C(ll n,ll r){
if(n<r)return 0;
ll ans=(f[n]%mod * iv[r]%mod)%mod;
ans=(ans%mod * iv[n-r]%mod)%mod;
return ans%mod;
}
void init(){
f[0]=1;
iv[0]=1;
f(i,1,MAX)f[i]=(i*f[i-1])%mod;
iv[MAX-1]=exp(f[MAX-1],mod-2);
for(int i=MAX-2;i>=0;--i)iv[i]=(iv[i+1]*(i+1))%mod;
}
////****************************************************************************************************************************************************************************************************************////
int main(){
tihs;
init();
int n,m;
cin>>n>>m;
if(n+1 == m){
ll ans= mulmod(f[n],f[m])
cout<<ans<<endl;
}
else if(m+1 ==n){
ll ans= mulmod(f[n],f[m]);
cout<<ans<<endl;
}
else if(n==m){
ll ans= mulmod(2,mulmod(f[n],f[m]));
cout<<ans<<endl;
}
else cout<<0<<endl;
} | a.cc: In function 'int main()':
a.cc:86:10: error: expected ',' or ';' before 'cout'
86 | cout<<ans<<endl;
| ^~~~
|
s808911293 | p03681 | C++ | #include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;
using namespace std;
//using namespace __gnu_pbds;
#define endl '\n'
#define sl(n) scanf("%lld",&n)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define f(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
#define rf(i,a,b) for(ll i = (ll)(a); i > (ll)(b); i--)
#define ms(a,b) memset((a),(b),sizeof(a))
#define abs(x) ((x<0)?(-(x)):(x))
#define MAX 1000005
#define inf LLONG_MAX
#define ninf LLONG_MIN
#define MIN INT_MIN
#define yeet return 0;
#define tihs if(fopen("input.txt","r"))freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long MAX2(long long a, long long b){return (a)>(b)?(a):(b);}
inline long long MAX3(long long a, long long b,long long c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long MIN2(long long a, long long b){return (a)<(b)?(a):(b);}
inline long long MIN3(long long a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
//typedef
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
int mod = 1e9 +7 ;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {if (!a) {x = 0;y = 1;return b;}int64_t x1, y1;int64_t d = extGcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}
inline ll addmod(ll a,ll b){a=a%mod+b%mod;if(a>mod)a%=mod;return a;}
inline ll submod(ll a,ll b){a=a%mod-b%mod;if(a<0)a+=mod;return a;}
inline ll mulmod(ll a,ll b){return (a%mod * b%mod)%mod;}
int dx[]={1,1,0,-1,-1,-1, 0, 1};
int dy[]={0,1,1, 1, 0,-1,-1,-1};
inline ll exp(ll a,ll b){if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=r*(a%mod);r=(r+mod)%mod;}b/=2;a=(a%mod)*(a%mod);a=(a+mod)%mod;}return (r+mod)%mod;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }
ll f[MAX];
ll iv[MAX];
ll C(ll n,ll r){
if(n<r)return 0;
ll ans=(f[n]%mod * iv[r]%mod)%mod;
ans=(ans%mod * iv[n-r]%mod)%mod;
return ans%mod;
}
void init(){
f[0]=1;
iv[0]=1;
f(i,1,MAX)f[i]=(i*f[i-1])%mod;
iv[MAX-1]=exp(f[MAX-1],mod-2);
for(int i=MAX-2;i>=0;--i)iv[i]=(iv[i+1]*(i+1))%mod;
// }
////****************************************************************************************************************************************************************************************************************////
int main(){
tihs;
init();
int n,m;
cin>>n>>m;
if(n+1 == m){
ll ans= mulmod(f[n],f[m])
cout<<ans<<endl;
}
else if(m+1 ==n){
ll ans= mulmod(f[n],f[m]);
cout<<ans<<endl;
}
else if(n==m){
ll ans= mulmod(2,mulmod(f[n],f[m]));
cout<<ans<<endl;
}
else cout<<0<<endl;
} | a.cc: In function 'void init()':
a.cc:79:10: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
79 | int main(){
| ^~
a.cc:79:10: note: remove parentheses to default-initialize a variable
79 | int main(){
| ^~
| --
a.cc:79:10: note: or replace parentheses with braces to value-initialize a variable
a.cc:79:12: error: a function-definition is not allowed here before '{' token
79 | int main(){
| ^
a.cc:100:8: error: expected '}' at end of input
100 | }
| ^
a.cc:66:12: note: to match this '{'
66 | void init(){
| ^
|
s938219912 | p03681 | C++ | #include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
using namespace std;
#define rep(i, n) for (int i=0; i<int(n); i++)
using ll = long long;
int main() {
int n, m;
cin >> n >> m;
if (abs(n-m)>1) {
cout << 0 << endl;
return 0;
}
else {
ll nn = 1;
int nc = n;
int mc = m;
while(n>0) {
nn *= n;
nn %= mod;
n--;
}
ll mm = 1;
while(m>0) {
mm *= m;
mm %= mod;
m--;
}
if (nc==mc) cout << (2*mm*nn)%mod << endl;
else cout << (mm*nn)%mod << endl;
}
} | a.cc: In function 'int main()':
a.cc:34:31: error: 'mod' was not declared in this scope; did you mean 'modf'?
34 | nn %= mod;
| ^~~
| modf
a.cc:40:31: error: 'mod' was not declared in this scope; did you mean 'modf'?
40 | mm %= mod;
| ^~~
| modf
a.cc:43:47: error: 'mod' was not declared in this scope; did you mean 'modf'?
43 | if (nc==mc) cout << (2*mm*nn)%mod << endl;
| ^~~
| modf
a.cc:44:38: error: 'mod' was not declared in this scope; did you mean 'modf'?
44 | else cout << (mm*nn)%mod << endl;
| ^~~
| modf
|
s223523580 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int facctorialMethod(int k){
ll sum = 1;
for (int i = 1; i <= k; ++i)
{
sum = sum*i%(1000000000+7);
}
return sum;
}
int main()
{
int n,m;
ll ans=0;
cin >> n >>m;
ll N,M;
N=facctorialMethod(n);
M=facctorialMethod(m);
if(max(n,m)-min(n,m)>1)ans=-1;
else if(n==m){
ans = N * M *2 %(1000000000+7);
}
else{
ans = N * M %(1000000000+7);
}
cout <<ans << endl;
return 0;
}
| a.cc:24:18: error: extended character is not valid in an identifier
24 | ans = N * M *2 %(1000000000+7);
| ^
a.cc:27:15: error: extended character is not valid in an identifier
27 | ans = N * M %(1000000000+7);
| ^
a.cc: In function 'int main()':
a.cc:24:18: error: unable to find numeric literal operator 'operator""\U00003000'
24 | ans = N * M *2 %(1000000000+7);
| ^~~
a.cc:27:15: error: 'M\U00003000' was not declared in this scope
27 | ans = N * M %(1000000000+7);
| ^~~
|
s687099089 | p03681 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
#include <list>
#include <deque>
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const ll INF = 1LL << 60;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) {return a / GCD(a, b) * b;}
int main()
{
int N,M;
cin >> N >> M;
ll a,b;
a = 1;
for(int i = 1; i <= N; i++)
{
a *= i;
a %= MOD;
}
b = 1;
for(int i = 1; i <= M; i++)
{
b *= i;
b %= MOD;
}
ll ans = a % MOD * b;
if(N == M) ans = ans % MOD * 2;
cout << ans << endl; | a.cc: In function 'int main()':
a.cc:43:29: error: expected '}' at end of input
43 | cout << ans << endl;
| ^
a.cc:25:1: note: to match this '{'
25 | {
| ^
|
s584008204 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll r = 1000000007;
ll np(int a){
ll ans=1;
while(a>0){
ans *= a;
ans %= r
a--;
}
return ans;
}
int main(){
int n,m;
cin >> n >> m;
if(abs(n-m) > 1){
cout << 0 << endl;
}
else if(abs(n-m) == 1){
cout <<(np(n)*np(m))%r << endl;
}
else{
cout << (2*np(n)*np(m))%r << endl;
}
return 0;
} | a.cc: In function 'long long int np(int)':
a.cc:11:17: error: expected ';' before 'a'
11 | ans %= r
| ^
| ;
12 | a--;
| ~
|
s881162575 | p03681 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
ll n, m;
cin >> n >> m;
if(n-m>1||m-n>1){
cout << 0 << endl;
return 0;
}
ll a = 1;
rep(i,n+1){
a*= i;
}
ll b = 1;
rep(i,m+1)){
b *= i;
}
if(n==m){
a*=2;
}
cout << a*b%100000007<< endl;
}
| a.cc: In function 'int main()':
a.cc:20:15: error: expected primary-expression before ')' token
20 | rep(i,m+1)){
| ^
|
s791246201 | p03681 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 1; (i) < (n); i++)
#define ll long long
using namespace std;
int main(){
ll n,m;
cin>>n,m;
ll ans=0;
if(n-m>=2||m-n>2){
cout<<'0'<<endl;
return 0;
}
else if(n-m=1||m-n=1){
for(ll i=n;i>=1;i--){
for(ll j=m;j>=1;j--){
ans=i*j;
}
}
}
else if(n==m){
rep(i,n+1){
rep(j,m+1){
ans=2*i*j;
}
}
}
cout<<ans%100000007<<endl;
} | a.cc: In function 'int main()':
a.cc:14:16: error: lvalue required as left operand of assignment
14 | else if(n-m=1||m-n=1){
| ~^~~~~
|
s867983550 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
if (abs(n-m)>1) cout << 0 << endl;
else {
long long kaim=1;
long long kain=1;
for (int i=2;i<=m;++i){
kaim*=i;
}
for (int i=2;i<=n;++i){
kain*=i;
}
long long ans=2*kain*kain%(1e9+7);
if (n==m) cout << ans << endl;
if (n-m==1){
long long ans=2*n*kaim%(1e9+7);
cout << ans << endl;
}
if (m-n==1){
long long ans=2*m*kain%(1e9+7);
cout << ans << endl;
}
}
}
| a.cc: In function 'int main()':
a.cc:17:32: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
17 | long long ans=2*kain*kain%(1e9+7);
| ~~~~~~~~~~~^~~~~~~~
| | |
| | double
| long long int
a.cc:20:33: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
20 | long long ans=2*n*kaim%(1e9+7);
| ~~~~~~~~^~~~~~~~
| | |
| | double
| long long int
a.cc:24:33: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
24 | long long ans=2*m*kain%(1e9+7);
| ~~~~~~~~^~~~~~~~
| | |
| | double
| long long int
|
s555275320 | p03681 | C++ | import math
mod=10**9+7
def main():
N,M=map(int,input().split())
ans=0
if abs(N-M)>=2:
print(0)
else:
if N==M:
ans+=(math.factorial(N)*math.factorial(M))*2
ans%=mod
print(ans)
else:
ans+=(math.factorial(N)*math.factorial(M))
ans%=mod
print(ans)
if __name__=="__main__":
main()
| a.cc:1:1: error: 'import' does not name a type
1 | import math
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s121652283 | p03681 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x) (int)x.size()
#define SP(x) setprecision((int)x)
using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数
//-------------------------------------------------
//
void yes(){
cout <<"Yes"<<endl ;
}
void no(){
cout <<"No"<<endl ;
}
//-------------------------------------------------
// メモ
/*
*/
//-------------------------------------------------
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
ll n, m ;
cin >> n >> m ;
vll kaizyo(100000+1) ;
kaizyo[0] = 1 ;
kaizyo[1] = 1 ;
for(ll i=2;i<=100000){
kaizyo[i] = kaizyo[i-1]*i%MOD ;
}
if(max(n,m)-min(n,m)>=2;i++){
cout << 0 <<endl ;
}
else{
if(n==m){
cout << kaizyo[n]*kaizyo[m]%MOD <<endl ;
}
else{
cout << 2*kaizyo[n]*kaizyo[m]%MOD <<endl ;
}
}
return 0 ;
}
| a.cc: In function 'int main()':
a.cc:69:23: error: expected ';' before ')' token
69 | for(ll i=2;i<=100000){
| ^
| ;
a.cc:73:27: error: 'i' was not declared in this scope
73 | if(max(n,m)-min(n,m)>=2;i++){
| ^
|
s468274373 | p03681 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x) (int)x.size()
#define SP(x) setprecision((int)x)
using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数
//-------------------------------------------------
//
void yes(){
cout <<"Yes"<<endl ;
}
void no(){
cout <<"No"<<endl ;
}
//-------------------------------------------------
// メモ
/*
*/
//-------------------------------------------------
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
ll n, m ;
cin >> n >> m ;
vll kaizyo(100000+1) ;
kaizyo[0] = 1 ;
kaizyo[1] = 1 ;
for(ll i=2;i<=100000){
kaizyo[i] = kaizyo[i-1]*i%MOD ;
}
if(max(n,m)-min(n,m)>=2){
cout << 0 <<endl ;
}
else{
if(n==m){
cout << kaizyo[n]*kaizyo[m]%MOD <<endl ;
}
else{
cout << 2*kaizyo[n]*kaizyo[m]%MOD <<endl ;
}
}
return 0 ;
}
| a.cc: In function 'int main()':
a.cc:69:23: error: expected ';' before ')' token
69 | for(ll i=2;i<=100000){
| ^
| ;
|
s818772897 | p03681 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x) (int)x.size()
#define SP(x) setprecision((int)x)
using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数
//-------------------------------------------------
//
void yes(){
cout <<"Yes"<<endl ;
}
void no(){
cout <<"No"<<endl ;
}
//-------------------------------------------------
// メモ
/*
*/
//-------------------------------------------------
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
ll n, m ;
cin >> n >> m ;
vll kaizyo(100000+1) ;
kaizyo[0] = 1 ;
kaizyo[1] = 1 ;
for(ll i=2;i<=100000){
kaizyo[i] = kaizyo[i-1]*i%MOD ;
}
if(max(n,m)-min(n,m)>=2){
cout << 0 <<endl ;
}
else{
if(n==m){
cout << kaizyo[n]*kaizyo[m]%MOD <<endl ;
}
else{
cout << 2*kaizyo[n]*kaizyo[m]%MOD <<endl ;
}
}
return 0 ;
}
| a.cc: In function 'int main()':
a.cc:65:3: error: 'vll' was not declared in this scope; did you mean 'll'?
65 | vll kaizyo(100000+1) ;
| ^~~
| ll
a.cc:66:3: error: 'kaizyo' was not declared in this scope
66 | kaizyo[0] = 1 ;
| ^~~~~~
a.cc:68:23: error: expected ';' before ')' token
68 | for(ll i=2;i<=100000){
| ^
| ;
|
s418304132 | p03681 | C++ | N = 10**6
mod = 10**9 + 7
fact = [1]
for i in range(1, N+1):
fact.append(fact[-1]*i%mod)
n,m = map(int, input().split())
if n-m > 1 or m-n >1:
ans=0
elif n-m == 0:
ans = 2*fact[n]*fact[m]%mod
else:
ans = fact[n] * fact[m] % mod
print(ans)
| a.cc:1:1: error: 'N' does not name a type
1 | N = 10**6
| ^
|
s096423264 | p03681 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
using ll = long long;
ll factorial(ll x) {
if (x==0 || x==1) return 1;
return ((x % 1000000007) * factorial(x-1)) % 1000000007;
}
int main() {
ll n, m;
cin >> n >> m;
ll a = max(n, m);
ll b = min(n, m);
if ( a > b+1 ) {
cout << 0 << endl;
} else if ( a == b+1 ) {
ll temp = factorial(b);
cout << (temp*factrial(a)) % 1000000007 << endl;
} else if(a == b) {
ll temp = factorial(b);
cout << (temp*temp*2)% 1000000007 << endl;
}
}
| a.cc: In function 'int main()':
a.cc:24:23: error: 'factrial' was not declared in this scope; did you mean 'factorial'?
24 | cout << (temp*factrial(a)) % 1000000007 << endl;
| ^~~~~~~~
| factorial
|
s689009182 | p03681 | C++ | // clang-format off
#include <bits/stdc++.h>
#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;
template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on
const ll MOD = TEN(9) + 7;
int n, m;
ll fact(ll x) {
ll ans = 1;
forn1(i, x) {
ans = ans * i % MOD;
}
return ans;
}
int main() {
fastio();
cin >> n >> m;
if (abs(n - m) >= 2) {
cout << 0 << endl;
return 0;
}
ll x = fact(n);
ll y = fact(m)
//cout << x * y % MOD * (n == m ? 2 : 1) % MOD << endl;
while (true);
cout << "ce" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:62:9: error: expected ',' or ';' before 'while'
62 | while (true);
| ^~~~~
|
s737558229 | p03681 | C++ | // clang-format off
#include <bits/stdc++.h>
#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;
template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on
const ll MOD = TEN(9) + 7;
int n, m;
ll fact(ll x) {
ll ans = 1;
forn1(i, x) {
ans = ans * i % MOD;
}
return ans;
}
int main() {
fastio();
cin >> n >> m;
if (abs(n - m) >= 2) {
cout << 0 << endl;
return 0;
}
ll x = fact(n);
ll y = fact(m)
//cout << x * y % MOD * (n == m ? 2 : 1) % MOD << endl;
cout << "ce" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:63:5: error: expected ',' or ';' before 'cout'
63 | cout << "ce" << endl;
| ^~~~
|
s070267573 | p03681 | C++ | #include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
ll MOD = 1000000007;
int main(){
ll N, M; cin >> N >> M;
if(N + 1 < M || M + 1 < N){
cout << 0 << endl;
return;
}
ll ans = 1;
for(ll i = N; i > 0; i--){
ans *= i;
ans %= MOD;
}
for(ll i = M; i > 0; i--){
ans *= i;
ans %= MOD;
}
if(N == M){
ans *= 2;
ans %= MOD;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:14:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
14 | return;
| ^~~~~~
|
s064144166 | p03681 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
int A,B,ans=0;
cin>>A>>B;
if(abs(A-B)<=1){
ans=1;
REP(i,2,N){
ans*=i;
ans%=MOD;
}
REP(i,2,M){
ans*=i;
ans%=MOD;
}
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:20:13: error: 'N' was not declared in this scope
20 | REP(i,2,N){
| ^
a.cc:4:48: note: in definition of macro 'REP'
4 | #define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
| ^
a.cc:24:13: error: 'M' was not declared in this scope
24 | REP(i,2,M){
| ^
a.cc:4:48: note: in definition of macro 'REP'
4 | #define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
| ^
|
s601678500 | p03681 | C++ | #include<bits/stdc++.h>
#define ll long long
using namespace std;
ll fact(ll a) {
ll ret = 1;
for (ll i = 1; i <= a; ++i) ret *= a;
return ret%mod;
}
int main() {
ll n,m; cin >> n >> m;
ll mod = 1000000000+7;
if (abs(n-m) > 1) cout << 0 << endl;
else {
ll ans = 0;
if (n==m) ans = 2*fact(n)*fact(n);
else ans = fact(n)*fact(m);
cout << ans%mod << endl;
}
return 0;
}
| a.cc: In function 'long long int fact(long long int)':
a.cc:8:14: error: 'mod' was not declared in this scope; did you mean 'modf'?
8 | return ret%mod;
| ^~~
| modf
|
s504926467 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,m,ansn,ansm;
cin >> n >> m;
ansn = 1;
ansm = 1;
if(n==m){
for (n ;n>0;--n){
ansn *= n;
}
for (m ;m>0;--m){
ansm *= m;
}
cout << ansn * ansm%1000000007 << endl;
break;
}
else if ( n+1 == m || n-1 == m){
for (n ;n>0;--n){
ansn *= n;
}
for (m ;m>0;--m){
ansm *= m;
}
cout << 2*ansn * ansm%1000000007 << endl;
break;
}
else {
cout << 0 << endl;
}
} | a.cc: In function 'int main()':
a.cc:19:5: error: break statement not within loop or switch
19 | break;
| ^~~~~
a.cc:29:5: error: break statement not within loop or switch
29 | break;
| ^~~~~
|
s772059551 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,m,ansn,ansm;
cin >> n >> m;
ansn = 1;
ansm = 1;
if(n==m){
for (n ;n>0;--n){
ansn *= n;
}
for (m ;m>0;--m){
ansm *= m;
}
cout << ansn * ansm%1000000007 << endl;
break; }
else if ( n+1 == m || n-1 == m){
for (n ;n>0;--n){
ansn *= n;
}
for (m ;m>0;--m){
ansm *= m;
}
cout << 2*ansn * ansm%1000000007 << endl;
break; }
else {
cout << 0 << endl;
break;
}
} | a.cc: In function 'int main()':
a.cc:19:5: error: break statement not within loop or switch
19 | break; }
| ^~~~~
a.cc:28:5: error: break statement not within loop or switch
28 | break; }
| ^~~~~
a.cc:31:5: error: break statement not within loop or switch
31 | break;
| ^~~~~
|
s626253561 | p03681 | C++ | /*Function Template*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
int Len(int n) {
int s=0;
while(n!=0) s++, n/=10;
return s;
}
int Sint(int n) {
int m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
return m;
}
int GCD(int a,int b)
{
int r, tmp;
/* 自然数 a > b を確認・入替 */
if(a<b){
tmp = a;
a = b;
b = tmp;
}
/* ユークリッドの互除法 */
r = a % b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
return b;
}
long long int Factorial(long long int n){
int m=1;
while(n>=1) m*=n,m%=mod,n--;
return m;
}
int Svec(vector<int> v){
int n=0;
for(int i=0;i<v.size();i++) n+=v[i];
return n;
}
///////////////////////////
int main() {
long long int n,m,ans;
cin>>n>>m;
ans=(Factorial(n)*Factorial(m))%mod;
if(n%2==m%2){
ans*=2;
}
cout<<ans%mod<<endl:
}
///////////////////////////
| a.cc: In function 'int main()':
a.cc:63:22: error: expected ';' before ':' token
63 | cout<<ans%mod<<endl:
| ^
| ;
|
s762084849 | p03681 | C++ | #include <stdio.h>
#include <iostream>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
int main(){
long long N, M;
std::cin >> N >> M;
#printf("%d", 0);
COMinit();
if (M == N){
printf("%lld\n", ((fac[N] * fac[M]) % MOD * 2) % MOD);
}
else if (M == N + 1 | M + 1 == N){
printf("%lld\n", (fac[N] * fac[M]) % MOD);
}
else{
printf("%d\n", 0);
}
return 1;
}
| a.cc:26:6: error: invalid preprocessing directive #printf
26 | #printf("%d", 0);
| ^~~~~~
|
s663732533 | p03681 | 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
|
s650084686 | p03681 | C++ | #include <iostream>
#include <vector>
using namespace std;
long long int MOD = 1000000007;
int main(){
int M, D;
cin >> M >> D;
if(abs(M - D) > 1){
cout << 0;
return 1;
}else{
long long int ans = 1LL;
for(int i = M; i >=1; i--){
ans *= i;
ans %= MOD;
}
for(int i = N; i >=1; i--){
ans *= i;
ans %= MOD;
}
ans *=2;
cout << ans;
}
}
| a.cc: In function 'int main()':
a.cc:21:17: error: 'N' was not declared in this scope
21 | for(int i = N; i >=1; i--){
| ^
|
s810170134 | p03681 | C++ | #include <isotream>
#include <vector>
using namespace std;
long long int MOD = 1000000007;
int main(){
int M, D;
cin >> M >> D;
if(abs(M - D) > 1){
cout << 0;
return 1;
}else{
long long int ans = 1LL;
for(int i = M; i >=1; i--){
ans *= i;
ans %= MOD;
}
for(int i = N; i >=1; i--){
ans *= i;
ans %= MOD;
}
ans *=2;
cout << ans;
}
} | a.cc:1:10: fatal error: isotream: No such file or directory
1 | #include <isotream>
| ^~~~~~~~~~
compilation terminated.
|
s813123819 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
constexpr int32_t MOD = 1e9 + 7; //10^9
template<int32_t MAX> struct cominit{
int64_t Fac[MAX], Finv[MAX], Inv[MAX];
constexpr cominit(): Fac(), Finv(), Inv(){
Fac[0] = Fac[1] = 1;
Finv[0] = Finv[1] = 1;
Inv[1] = 1;
for (int i = 2; i < MAX; i++){
Fac[i] = Fac[i - 1] * i % MOD;
Inv[i] = MOD - Inv[MOD%i] * (MOD / i) % MOD;
Finv[i] = Finv[i - 1] * Inv[i] % MOD;
}
}
};
//#define int int64_t
signed main()
{
constexpr auto com = cominit<MAX>();
int n, m; cin >> n >> m;
if(abs(n-m)>=2){
cout << 0 << endl;
}
else{
if(n>m || m > n){
cout << com.Fac[n]*com.Fac[m]%MOD << endl;
}
else
{
cout << (com.Fac[n]*com.Fac[m]%MOD)*2%MOD << endl;
}
}
}
| a.cc: In function 'int main()':
a.cc:24:34: error: 'MAX' was not declared in this scope
24 | constexpr auto com = cominit<MAX>();
| ^~~
a.cc:24:37: error: template argument 1 is invalid
24 | constexpr auto com = cominit<MAX>();
| ^
|
s596059172 | p03681 | C++ | #include<iostream>
#define M 1000000007L
long n,m;long f(long x){return x-1?x*f(x-1):1;}
main(){std::cin>>n>>m;std::cout<<f(n)*f(m)%M*max(0,2-abs(n-m));} | a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main(){std::cin>>n>>m;std::cout<<f(n)*f(m)%M*max(0,2-abs(n-m));}
| ^~~~
a.cc: In function 'int main()':
a.cc:4:46: error: 'max' was not declared in this scope; did you mean 'std::max'?
4 | main(){std::cin>>n>>m;std::cout<<f(n)*f(m)%M*max(0,2-abs(n-m));}
| ^~~
| std::max
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
|
s147484972 | p03681 | C++ | #include<iostream>
#define M 1000000007L
long n,m;long f(long x){return x-1?x*f(x-1):1}
main(){std::cin>>n>>m;std::cout<<f(n)*f(m)%M*fmax(0,2-abs(n-m));} | a.cc: In function 'long int f(long int)':
a.cc:3:46: error: expected ';' before '}' token
3 | long n,m;long f(long x){return x-1?x*f(x-1):1}
| ^
| ;
a.cc: At global scope:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main(){std::cin>>n>>m;std::cout<<f(n)*f(m)%M*fmax(0,2-abs(n-m));}
| ^~~~
a.cc: In function 'int main()':
a.cc:4:46: error: 'fmax' was not declared in this scope
4 | main(){std::cin>>n>>m;std::cout<<f(n)*f(m)%M*fmax(0,2-abs(n-m));}
| ^~~~
|
s604398152 | p03681 | C | #include<iostream>
#include<cmath>
long f(long x){if(x==1)return 1l;return x*f(x-1)%1000000007;}
int main()
{
long n,m;std::cin>>n>>m;
if(abs(n-m)<2)std::cout<<(abs(n-m)<2?f(n)*f(m)%1000000007*(2-abs(n-m))%1000000007:0)<<std::endl;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s721715850 | p03681 | C++ | #include<bits/stdc++.h>
using namespace std;
using long long = ll;
const ll mod=1e9+7;
int main(){
ll n,m,ans=1; cin>>n >>m;
if(abs(n-m)>1){
cout<<0<<endl;
return 0;
}
if(n==m)ans=2;
for(int i=1;i<=n;i++){
ans*=i;
ans%=mod;
}
for(int i=1;i<=m;i++){
ans*=i;
ans%=mod;
}
cout<<ans<<endl;
} | a.cc:3:7: error: expected nested-name-specifier before 'long'
3 | using long long = ll;
| ^~~~
a.cc:4:7: error: 'll' does not name a type
4 | const ll mod=1e9+7;
| ^~
a.cc: In function 'int main()':
a.cc:6:3: error: 'll' was not declared in this scope
6 | ll n,m,ans=1; cin>>n >>m;
| ^~
a.cc:6:22: error: 'n' was not declared in this scope; did you mean 'yn'?
6 | ll n,m,ans=1; cin>>n >>m;
| ^
| yn
a.cc:6:26: error: 'm' was not declared in this scope; did you mean 'tm'?
6 | ll n,m,ans=1; cin>>n >>m;
| ^
| tm
a.cc:11:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
11 | if(n==m)ans=2;
| ^~~
| abs
a.cc:13:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
13 | ans*=i;
| ^~~
| abs
a.cc:14:10: error: 'mod' was not declared in this scope; did you mean 'modf'?
14 | ans%=mod;
| ^~~
| modf
a.cc:17:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
17 | ans*=i;
| ^~~
| abs
a.cc:18:10: error: 'mod' was not declared in this scope; did you mean 'modf'?
18 | ans%=mod;
| ^~~
| modf
a.cc:20:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
20 | cout<<ans<<endl;
| ^~~
| abs
|
s355356974 | p03681 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
int n;//頂点数
int parent[100010];//iの親parent[i]を格納する配列
int my_rank[100010];//iを根とする部分木の高さみたいな量?
void init(int n){
for(int i=0;i<n;i++){
parent[i]=i;
my_rank[i]=0;
}
}
int root(int x){
if(parent[x]==x)return x;
else return root(parent[x]);
}
void unite(int x,int y){
x=root(x);
y=root(y);
if(x==y)return ;
if(my_rank[x]<my_rank[y])parent[x]=y;
else{
parent[y]=x;
if(my_rank[x]==my_rank[y])my_rank[x]++;
}
}
bool same(int x,int y){
return root(x)==root(y);
}
struct edge {int u,v,cost;};
bool comp(const edge& e1,const edge& e2){
return e1.cost<e2.cost;
}
vector <edge> edges;
//vector <pair<int,int>>p1,p2;
int kruskal(){
sort(edges.begin(),edges.end(),comp);
init(n);
long long res=0;
rep(i,edges.size()){
edge e=edges[i];
if(!same(e.u,e.v)){
unite(e.u,e.v);
res += (long long)e.cost;
}
}
return res;
}
int main(){
cin>>n;
int x,y;
vector<pair<int,int>> xs,ys;
REP(i,n){
cin>>x>>y;
xs.push_back(make_pair(x,i));
ys.push_back(make_pair(y,i));
}
sort(xs.begin(),xs.end());
sort(ys.begin(),ys.end());
REP(i,n-1){
edge e;
e.u = xs[i].second;
e.v = xs[i+1].second;
e.cost = xs[i+1].first - xs[i].first;
edges.push_back(e);
}
REP(i,n-1){
edge e;
e.u = ys[i].second;
e.v = ys[i+1].second;
e.cost = ys[i+1].first - ys[i].first;
edges.push_back(e);
}
long long ans;
ans = kruskal();
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int kruskal()':
a.cc:52:9: error: 'i' was not declared in this scope
52 | rep(i,edges.size()){
| ^
a.cc:52:5: error: 'rep' was not declared in this scope; did you mean 'res'?
52 | rep(i,edges.size()){
| ^~~
| res
|
s489794114 | p03681 | C++ | #define _CRT_SECURE_NO_WARNINGS
#define MATH_PI 3.14159265358979323846264338327950288419716939
#define DIVIDER9 1000000007
#define lli long long int
#include <iostream>
#include <string.h>
#include <fstream>
#include <math.h>
#include <iomanip>
using namespace std;
#ifdef _WIN32
#pragma warning(disable : 4101)
signed wait(){
char wait_dummy[256];
scanf("%c", &wait_dummy);
return 0;
}
template <typename ... Args>
void dout(const char *format, Args const & ... args){
printf(format, args ...);
}
#define MAX_CHARBUF 65536
#define DATAFILE "data.dat"
class csLocalInput{
int FileOpen();
public:
FILE *fp;
csLocalInput();
};
csLocalInput::csLocalInput() {
FileOpen();
}
int csLocalInput::FileOpen() {
fp = fopen(DATAFILE, "rt");
return 1;
}
csLocalInput local_in;
#define DEBUG 1
#else
inline signed wait() { return 0; }
inline void dout(const char *arg, ...) {}
#endif
template<typename T>inline void SWAP(T &a, T &b) { T t = a; a = b; b = t; }
inline void CSWAP(char *&a, char *&b) { char *t = a; a = b; b = t; }
#define CLIP(ptr, min, max) {if((min)<=(max)){if(ptr<(min)){ptr=(min);}if(ptr>(max)){ptr=(max);}}}
#define Sin(deg) sin((deg)*MATH_PI/180.0)
#define Cos(deg) cos((deg)*MATH_PI/180.0)
#define Tan(deg) tan((deg)*MATH_PI/180.0)
#define Rad(deg) ((deg)*MATH_PI/180.0)
#define rep(param, num) for(int param=0 ; param<num ; ++param)
#define fi(num) for(int i=0 ; i<num ; ++i)
#define fj(num) for(int j=0 ; j<num ; ++j)
#define fk(num) for(int k=0 ; k<num ; ++k)
#define fl(num) for(int l=0 ; l<num ; ++l)
#define fn(num) for(int n=0 ; n<num ; ++n)
#define ffr(param, num) for(int param=num-1 ; param>=0 ; --param)
#define fir(num) for(int i=num-1 ; i>=0 ; --i)
#define fjr(num) for(int j=num-1 ; j>=0 ; --j)
#define fkr(num) for(int k=num-1 ; k>=0 ; --k)
#define flr(num) for(int l=num-1 ; l>=0 ; --l)
#define fnr(num) for(int n=num-1 ; n>=0 ; --n)
#define gi(p) int p; Gi(p)
#define gi2(p1, p2) int p1, p2; Gi2(p1, p2)
#define gi3(p1, p2, p3) int p1, p2, p3; Gi3(p1, p2, p3)
#define gi4(p1, p2, p3, p4) int p1, p2, p3, p4; Gi4(p1, p2, p3, p4)
#define glli(p) lli p; Glli(p)
#define glli2(p1, p2) lli p1, p2; Glli2(p1, p2)
#define glli3(p1, p2, p3) lli p1, p2, p3; Glli3(p1, p2, p3)
#define glli4(p1, p2, p3, p4) lli p1, p2, p3, p4; Glli4(p1, p2, p3, p4)
#define gf(p) double p; Gf(p);
#define gf2(p1, p2) double p1, p2; Gf2(p1, p2);
#define gf3(p1, p2, p3) double p1, p2, p3; Gf3(p1, p2, p3);
#define gf4(p1, p2, p3, p4) double p1, p2, p3, p4; Gf4(p1, p2, p3, p4)
#define Gi(p) Scanf("%d", p)
#define Gi2(p1, p2) Scanf2("%d %d", p1, p2)
#define Gi3(p1, p2, p3) Scanf3("%d %d %d", p1, p2, p3)
#define Gi4(p1, p2, p3, p4) Scanf4("%d %d %d %d", p1, p2, p3, p4)
#define Glli(p) Scanf("%lld", p)
#define Glli2(p1, p2) Scanf2("%lld %lld", p1, p2)
#define Glli3(p1, p2, p3) Scanf3("%lld %lld %lld", p1, p2, p3)
#define Glli4(p1, p2, p3, p4) Scanf4("%lld %lld %lld %lld", p1, p2, p3, p4)
#define Gf(p) Scanf("%f", p)
#define Gf2(p1, p2) Scanf2("%f %f", p1, p2)
#define Gf3(p1, p2, p3) Scanf3("%f %f %f", p1, p2, p3)
#define Gf4(p1, p2, p3, p4) Scanf4("%f %f %f %f", p1, p2, p3, p4)
#ifdef DEBUG
#define Gc(buf) fscanf(local_in.fp, "%s", buf)
#define Scanf(expr, p) fscanf(local_in.fp, expr, &p)
#define Scanf2(expr, p1, p2) fscanf(local_in.fp, expr, &p1, &p2)
#define Scanf3(expr, p1, p2, p3) fscanf(local_in.fp, expr, &p1, &p2, &p3)
#define Scanf4(expr, p1, p2, p3, p4) fscanf(local_in.fp, expr, &p1, &p2, &p3, &p4)
#else
#define Gc(buf) Scanf("%s", buf)
#define Scanf(expr, p) scanf(expr, &p)
#define Scanf2(expr, p1, p2) scanf(expr, &p1, &p2)
#define Scanf3(expr, p1, p2, p3) scanf(expr, &p1, &p2, &p3)
#define Scanf4(expr, p1, p2, p3, p4) scanf(expr, &p1, &p2, &p3, &p4)
#endif
#define ans(p) cout << p << endl;
#define ans_end(p) {cout << p << endl; return wait();}
void CombSort(int N, int *ar, int order_ascending) { if (N <= 1) return; int h = int(N / 1.3); int flag; int i; while (true) { flag = 0; for (i = 0; i + h < N; ++i) { if ((order_ascending&&ar[i] > ar[i + h]) || (!order_ascending&&ar[i] < ar[i + h])) { swap<int>(ar[i], ar[i + h]); flag = 1; } }if (h == 1 && !flag)break; if (h == 9 || h == 10) h = 11; if (h > 1)h = int(h / 1.3); } }
void CombSort_ll(int N, lli *ar, int order_ascending) { if (N <= 1) return; int h = int(N / 1.3); int flag; int i; while (true) { flag = 0; for (i = 0; i + h < N; ++i) { if ((order_ascending&&ar[i] > ar[i + h]) || (!order_ascending&&ar[i] < ar[i + h])) { swap<lli>(ar[i], ar[i + h]); flag = 1; } }if (h == 1 && !flag)break; if (h == 9 || h == 10) h = 11; if (h > 1)h = int(h / 1.3); } }
int EuclideanAlgorithm(int N, int *ar){
fn(N - 1){
while (true){
if (ar[n] % ar[n + 1] == 0 || ar[n + 1] % ar[n] == 0) {
ar[n + 1] = ar[n] < ar[n + 1] ? ar[n] : ar[n + 1];
break;
}
if (ar[n] > ar[n + 1]) {
ar[n] %= ar[n + 1];
}
else {
ar[n + 1] %= ar[n];
}
}
}
return ar[N - 1];
}
template<typename T>void CombSort(int N, T *ar, int order_ascending) {
if (N <= 1) return;
int i, flag;
int h = int(N / 1.3);
while (true) {
flag = 0;
for (i = 0; i + h < N; ++i) {
if (
order_ascending && ar[i].SortValue > ar[i + h].SortValue ||
!order_ascending && ar[i].SortValue < ar[i + h].SortValue
) {
SWAP<T>(ar[i], ar[i + h]);
flag = 1;
}
}
if (h > 1) {
h = int(h / 1.3);
if (h == 9 || h == 10) h = 11;
}
else {
if (!flag) break;
}
}
}
#include <vector>
#include <algorithm>
struct UnionFind {
vector<int> par;
UnionFind(int N) : par(N) {
for (int i = 0; i < N; i++) par[i] = i;
}
int root(int x) {
if (par[x] == x) return x;
return par[x] = root(par[x]);
}
void unite(int x, int y) {
int rx = root(x);
int ry = root(y);
if (rx == ry) return;
par[rx] = ry;
}
bool same(int x, int y) {
int rx = root(x);
int ry = root(y);
return rx == ry;
}
};
void Replace(char *c, int len, char before, char after) {
fi(len){
if(c[i] == before) c[i] = after;
}
}
void Replace(char *c, char before, char after){
int len = strlen(c);
Replace(c, len, before, after);
}
class csNode{
public:
csNode(){
}
};
class csStack{
public:
csStack(){
num = 0;
}
void alloc(int size){
param = new int[size];
}
void sort(int order = 1){
if(num > 1) CombSort(num, param, order);
}
int num;
int *param;
void push(int p){
param[num++] = p;
}
};
class csPosition{
public:
csPosition(){x = y = 0;}
int x, y;
};
typedef class csPosition POS;
template<typename T>
class csPos{
public:
csPos(){x = y = 0;}
T x, y;
};
char s[200010];
signed main() {
glli2(n, m);
if(abs(n-m) > 1) ans_end(0);
lli c = 1;
fi(n){
c *= lli(i + 1);
c %= DIVIDER9;
}
fi(m) {
c *= lli(i + 1);
c %= DIVIDER9;
}
if(n == m){
c *= 2;
c %= DIVIDER9;
}
ans(c);
return wait();
}
| a.cc: In function 'int main()':
a.cc:4:13: error: expected primary-expression before 'long'
4 | #define lli long long int
| ^~~~
a.cc:256:22: note: in expansion of macro 'lli'
256 | c *= lli(i + 1);
| ^~~
a.cc:4:13: error: expected primary-expression before 'long'
4 | #define lli long long int
| ^~~~
a.cc:260:22: note: in expansion of macro 'lli'
260 | c *= lli(i + 1);
| ^~~
|
s481490048 | p03681 | C++ | #include<bits/stdc++.h>
typedef long long llong;
using namespace std;
llong f(int x){
llong res=1;
for(int i=1;i<=x;++i){
res*=i;
res%=MOD;
}
return res;
}
int main(){
int n,m;
cin>>n>>m;
if(abs(n-m)>1){
cout<<0<<endl;
return 0;
}
llong ans=f(n);
ans*=f(m);
ans%=MOD;
if(abs(n-m)==0){
ans*=2;
ans%=MOD;
}
cout<<ans<<endl;
} | a.cc: In function 'llong f(int)':
a.cc:9:22: error: 'MOD' was not declared in this scope
9 | res%=MOD;
| ^~~
a.cc: In function 'int main()':
a.cc:25:14: error: 'MOD' was not declared in this scope
25 | ans%=MOD;
| ^~~
|
s899048437 | p03681 | C++ | #include <bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9
using namespace std;
/**
* calculate GCD(greatest common divisor)
* @param a
* @param b
* @return
*/
unsigned euclidean_gcd(unsigned a, unsigned b) {
if (a < b) return euclidean_gcd(b, a);
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
/**
* change minimum
* @tparam T
* @param a
* @param b
* @return bool
*/
template<class T>
inline bool changeMinimum(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
/**
* change maximum
* @tparam T
* @param a
* @param b
* @return bool
*/
template<class T>
inline bool changeMaximum(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
/**
* output answer
* @tparam T
* @param answer
* @return
*/
template<typename T>
T output(T answer) {
cout << answer << endl;
return 0;
}
/** ----from here ---------------------------------------------------------- */
ll facctorialMethod(ll k) {
ll sum = 1;
for (ll i = 1; i <= k; ++i) {
sum *= i;
}
return sum;
}
int main() {
ll N, M;
cin >> N >> M;
ll max = max(N, M);
ll min = min(N, M);
ll k = facctorialMethod(max - 1);
ll kk = facctorialMethod(min);
ll ans = k * kk * max;
ans = ans % (10e + 9);
cout << ans << endl;
} | a.cc:97:18: error: exponent has no digits
97 | ans = ans % (10e + 9);
| ^~~
a.cc: In function 'int main()':
a.cc:91:17: error: 'max' cannot be used as a function
91 | ll max = max(N, M);
| ~~~^~~~~~
a.cc:92:17: error: 'min' cannot be used as a function
92 | ll min = min(N, M);
| ~~~^~~~~~
|
s858997679 | p03681 | C++ | #include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define repprev(i,a,b) for(ll i=b-1;i>=a;i--)
#define reprev(i,n) repprev(i,0,n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> int former(const vector<T> &v, T x){
return upper_bound(v.begin(),v.end(),x) - v.begin() - 1;
}
template<class T> int latter(const vector<T> &v, T x){
return lower_bound(v.begin(),v.end(),x) - v.begin();
}
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<29;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(ll n) : par(n, -1) { }
void init(ll n) { par.assign(n, -1); }
ll root(ll x) {
if (par[x] < 0) return x;
else return par[x] = root(par[x]);
}
bool issame(ll x, ll y) {
return root(x) == root(y);
}
bool merge(ll x, ll y) {
x = root(x); y = root(y);
if (x == y) return false;
if (par[x] > par[y]) swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) {
return -par[root(x)];
}
};
template <typename T>
vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){
const T INF = numeric_limits<T>::max();
using P = pair<T, int>;
int n=G.size();
vector<T> d(n,INF);
vector<int> b(n,-1);
priority_queue<P,vector<P>,greater<P> > q;
d[s]=0;
q.emplace(d[s],s);
while(!q.empty()){
P p=q.top();q.pop();
int v=p.second;
if(d[v]<p.first) continue;
for(auto& e:G[v]){
int u=e.first;
T c=e.second;
if(d[u]>d[v]+c){
d[u]=d[v]+c;
b[u]=v;
q.emplace(d[u],u);
}
}
}
return d;
}
vector<vector<int> > bfs(vector<string> &s,int sy,int sx,char wall,int dir){
int h=s.size(),w=s.front().size();
vector<vector<int> > dp(h,vector<int>(w,-1));
using P = pair<int, int>;
queue<P> q;
dp[sy][sx]=0;
q.emplace(sy,sx);
int dy[]={1,-1,0,0,1,1,-1,-1};
int dx[]={0,0,1,-1,1,-1,1,-1};
auto in=[&](int y,int x){return 0<=y&&y<h&&0<=x&&x<w;};
while(!q.empty()){
int y,x;
tie(y,x)=q.front();q.pop();
for(int k=0;k<dir;k++){
int ny=y+dy[k],nx=x+dx[k];
if(!in(ny,nx)||s[ny][nx]==wall) continue;
if(~dp[ny][nx]) continue;
dp[ny][nx]=dp[y][x]+1;
q.emplace(ny,nx);
}
}
return dp;
}
std::vector<ll> divisor(ll n)//nの約数を列挙
{
std::vector<ll> ret;
for(ll i=1 ; i*i<=n ; ++i)
{
if(n%i == 0)
{
ret.push_back(i);
if(i!=1 && i*i!=n)
{
ret.push_back(n/i);
}
}
}
return ret;
}
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int fac(int k){
int sum = 1;
for (int i = 1; i <= k; ++i)
{
sum *= i;
}
return sum % MOD;
}
int main(void) {
ll n,m;
cin >> n >> m;
ll ans;
if(abs(n - m) >= 2) cout << 0 << endl;
else if(abs(n - m) == 1){
ans = fac(n) * fac(m) % MOD;
} else if(abs(n - m) == 0){
ans = 2 * fac(n) * fac(m) % MOD;
}
return ans;
}
| a.cc:167:14: error: 'int fac(int)' redeclared as different kind of entity
167 | int fac(int k){
| ^
a.cc:42:11: note: previous declaration 'long long int fac [510000]'
42 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc: In function 'int main()':
a.cc:183:26: error: 'fac' cannot be used as a function
183 | ans = fac(n) * fac(m) % MOD;
| ~~~^~~
a.cc:183:35: error: 'fac' cannot be used as a function
183 | ans = fac(n) * fac(m) % MOD;
| ~~~^~~
a.cc:185:30: error: 'fac' cannot be used as a function
185 | ans = 2 * fac(n) * fac(m) % MOD;
| ~~~^~~
a.cc:185:39: error: 'fac' cannot be used as a function
185 | ans = 2 * fac(n) * fac(m) % MOD;
| ~~~^~~
|
s875035557 | p03681 | Java | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
solve();
}
static long MOD = (long)1e9+7;
public static long fact(long x) {
long ret = 1;
for(int i = 1; i <=x ; i++)
ret = ret * i % MOD;
return ret;
}
public static long count(long n, long m) {
if(Math.abs(n-m) > 1)
return 0;
long tmp = fact(n) * fact(m) % MOD;
if(n == m) return 2 * tmp % mod;
else return tmp;
}
public static void solve() {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
int m = sc.nextInt();
sc.close();
out.println(count(n,m));
out.flush();
}
} | Main.java:28: error: cannot find symbol
if(n == m) return 2 * tmp % mod;
^
symbol: variable mod
location: class Main
1 error
|
s363826852 | p03681 | C++ | #include<iostream>
using namespace std;
long long abs(long long x,long long y){ long c;
if( x >= y){ c = x - y;}
else{c = y - x;}
return c;}
long long Fac( long long n){
int rep = 1;
for(int i = 1; i <= n; i++){
rep = rep * j; rep = rep % 1000000007;}
return rep;}
int main()
{long long N, M ; cin >> N >> M;
if(abs(N,M) == 1){cout << Fac( M ) * Fac( N ) % 1000000007 << endl;}
else if(abs(N,M) == 0){cout << 2*Fac( M ) * Fac( N ) % 1000000007 << endl;}
else{cout << 0 << endl;}
return 0;}
| a.cc: In function 'long long int Fac(long long int)':
a.cc:13:18: error: 'j' was not declared in this scope
13 | rep = rep * j; rep = rep % 1000000007;}
| ^
|
s590221264 | p03681 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
cin>>a>>b;
cout<<a*b*2;
return 0;
} | a.cc: In function 'int main()':
a.cc:4:10: error: 'a' was not declared in this scope
4 | cin>>a>>b;
| ^
a.cc:4:13: error: 'b' was not declared in this scope
4 | cin>>a>>b;
| ^
|
s627722433 | p03681 | C++ | easy | a.cc:1:1: error: 'easy' does not name a type
1 | easy
| ^~~~
|
s096821651 | p03681 | C++ | #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
const long long mod 1e9+7;
int main() {
long long n,m,ans=1;
cin >> n >> m;
if(abs(n-m)>1) {
cout << 0 << endl;
return 0;
}
for(long long i=2; i<=n; i++) {
ans*=i;
ans%=mod;
}
for(long long i=2; i<=m; i++) {
ans*=i;
ans%=mod;
}
if(n==m) {
ans=ans*2%mod;
}
cout << ans << endl;
} | a.cc:5:21: error: expected initializer before numeric constant
5 | const long long mod 1e9+7;
| ^~~
a.cc: In function 'int main()':
a.cc:15:10: error: 'mod' was not declared in this scope; did you mean 'modf'?
15 | ans%=mod;
| ^~~
| modf
a.cc:19:10: error: 'mod' was not declared in this scope; did you mean 'modf'?
19 | ans%=mod;
| ^~~
| modf
a.cc:22:15: error: 'mod' was not declared in this scope; did you mean 'modf'?
22 | ans=ans*2%mod;
| ^~~
| modf
|
s253073257 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define INF INT_MAX
#define MOD 1000000007
#define PI acos(-1)
using ll = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
ll fact(ll n) {
if (n == 1) {
return 1;
} else {
return (n * fact(n - 1)) % MOD;
}
}
int main(int argc, char *argv[])
{
cin.tie(0);
ios::sync_with_stdio(false);
ll N, M;
cin >> N >> M;
ll ans = 0;
if (abs(N-M) == 0) {
ans = fact(N)*fact(M)*2
ans %= MOD;
} else if (abs(N-M) == 1) {
ans = fact(N)*fact(M);
ans %= MOD;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:37:32: error: expected ';' before 'ans'
37 | ans = fact(N)*fact(M)*2
| ^
| ;
38 | ans %= MOD;
| ~~~
|
s813319308 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, m, i;
long long a = 1;
if(abs(m-n) > 1){
cout << 0;
}else{
for(i=1; i<=n; i++){
a *= (long long)i;
a %= 1000000007;
}
for(i=1; i<=n; i++){
a *= (long long)i;
a %= 1000000007;
}
if(a == b){
a *= 2;
a %= 1000000007;
}
cout << a;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:17: error: 'b' was not declared in this scope
18 | if(a == b){
| ^
|
s751410044 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
int main(){
ll n,m;
cin >> n >> m;
ll ans = 1;
if(max(n,m)-min(n,m) >= 2)ans = 0;
FOR(i,1,m+1)(ans*=i)%=MOD;
FOR(i,1,n+1)(ans*=i)%=MOD;
if(n==m)(ans*=2)%=MOD;
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:10:31: error: 'MOD' was not declared in this scope
10 | FOR(i,1,m+1)(ans*=i)%=MOD;
| ^~~
a.cc:11:31: error: 'MOD' was not declared in this scope
11 | FOR(i,1,n+1)(ans*=i)%=MOD;
| ^~~
a.cc:12:27: error: 'MOD' was not declared in this scope
12 | if(n==m)(ans*=2)%=MOD;
| ^~~
|
s926100575 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
int main () {
long N, M;
cin >> N >> M;
int flag = 0;
if(abs(N - M) != 0 && abs(N - M) != 1) flag++;
long ans = 0, a = 1, b = 1;
if(flag == 1) {
for(int i = N; i != 0; i--) {
a *= i;
a %= 100000007;
}
for(int i = M; i != 0; i--) {
b *= i;
b %= 100000007;
}
ans = (a * B) % 1000000007;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:18:16: error: 'B' was not declared in this scope
18 | ans = (a * B) % 1000000007;
| ^
|
s513620966 | p03681 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007;
signed main(){
int n, m; cin >> n >> m;
if(abs(n - m <= 1)){
cout << 0 << endl;
return 0;
}else{
int ans = 1;
for(int i = 1; i <= n; i++){
ans *= i;
ans %= MOD;
}
for(int i = 1; i <= m; i++){
ans *= i;
ans %= MOD;
}
if(n == m){
ans *= 2;
ans %= MOD;
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:30:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
30 | cout << ans << endl;
| ^~~
| abs
|
s093382208 | p03681 | C++ | include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int n,m;
cin>>n>>m;
ll c=1;
for(int i=1;i<=n;i++){
c*=i;
c%=1000000007;
}
for(int i=1;i<=m;i++){
c*=i;
c%=1000000007;
}
if(n==m){
c*=2;
c%=1000000007;
}
cout<<c;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
6 | cin>>n>>m;
| ^~~
a.cc:20:3: error: 'cout' was not declared in this scope
20 | cout<<c;
| ^~~~
|
s610718414 | p03681 | C++ | #include<bits/stdc++.h>
using namespace std;
#define ll long long
ll mo=1000000007
int main(){
ll a,b;
cin>>a,b;
if(a<b) swap(a,b);
if(a-b>1) cout<<0;
else if(a==b){
ll c=1;
for(int i=a;i>0;i++){
c*=i;
c%=mo;
}
cout<<c*4%mo;
}else{
ll c=1;
for(int i=a;i>0;i++){
c*=i;
c%=mo;
}
for(int i=b;i>0;i++){
c*=i;
c%=mo;
}
cout<<c;
}
} | a.cc:5:1: error: expected ',' or ';' before 'int'
5 | int main(){
| ^~~
|
s960717088 | p03681 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<iomanip>
using ll = long long;
using ull = unsigned long long;
static ull tenq = 1000000000;
static ull mod = tenq + 7;
using namespace std;
int main(){
ll n, m; cin >> n >> m;
ull na = 1, ma = 1;
ll diff = 0;
if(n == m) diff = 2;
else if (abs(n - m) == 1) diff = 1;
for(int i = 2; i <= n; i++) na = (na*i) % mod;
for(int i = 2; i <= m; i++) ma = (ma*i) % mod;
ull ans = (na*nm*diff) % mod;
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:26:17: error: 'nm' was not declared in this scope; did you mean 'na'?
26 | ull ans = (na*nm*diff) % mod;
| ^~
| na
|
s972002047 | p03681 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long n,m,ansn=1,ansm=1;
cin>>n>>m;
if(abs(n-m)>=2){
cout<<0<<endl;
return 0;
}
while(n){
ansn*=n;
ansn%=(1e9+7);
n--;
}
while(m){
ansm*=m;
ansm%=(1e9+7);
m--;
}
cout<<(n-m?(ansn*ansm)%(1e9+7):((ansn*ansm)*2)%(1e9+7))<<endl;
} | a.cc: In function 'int main()':
a.cc:13:9: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
13 | ansn%=(1e9+7);
| ~~~~^~~~~~~~~
a.cc:13:9: note: in evaluation of 'operator%=(long long int, double)'
a.cc:18:9: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
18 | ansm%=(1e9+7);
| ~~~~^~~~~~~~~
a.cc:18:9: note: in evaluation of 'operator%=(long long int, double)'
a.cc:21:25: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
21 | cout<<(n-m?(ansn*ansm)%(1e9+7):((ansn*ansm)*2)%(1e9+7))<<endl;
| ~~~~~~~~~~~^~~~~~~~
| | |
| | double
| long long int
a.cc:21:49: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
21 | cout<<(n-m?(ansn*ansm)%(1e9+7):((ansn*ansm)*2)%(1e9+7))<<endl;
| ~~~~~~~~~~~~~~~^~~~~~~~
| | |
| | double
| long long int
|
s211242727 | p03681 | C++ | #include <bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
ll s[100100];
int main(){
int n,m;
cin>>n>>m;
long long p;
s[0]=1;
for(int i=1;i<=10010;i++){
s[i]=(s[i-1]%mod*i%mod)%mod;
if(s[i]>=mod) s[i]-=mod;
}
if(abs(n-m)>1) cout<<0<<endl;
else{
if(n<m) swap(n,m);
p=s[n]*s[m]%mod;
p%=mod;
if(n==m) p*=2;
p%=mod;
cout<<p<<endl;
}
return 0;
}
| a.cc:4:1: error: 'll' does not name a type
4 | ll s[100100];
| ^~
a.cc: In function 'int main()':
a.cc:9:5: error: 's' was not declared in this scope
9 | s[0]=1;
| ^
|
s906422149 | p03681 | C++ | let ( *@ ) a b = (a * b) mod 1000000007
let fact = let rec f v n = if n <= 0 then v else f (n *@ v) (n-1) in f 1
let n, m = Scanf.scanf "%d %d" (fun x y -> x, y)
let () =
let mul = 2 - abs (n - m) |> max 0 in
fact n *@ fact m *@ mul |> Printf.printf "%d\n" | a.cc:1:8: error: stray '@' in program
1 | let ( *@ ) a b = (a * b) mod 1000000007
| ^
a.cc:2:56: error: stray '@' in program
2 | let fact = let rec f v n = if n <= 0 then v else f (n *@ v) (n-1) in f 1
| ^
a.cc:6:11: error: stray '@' in program
6 | fact n *@ fact m *@ mul |> Printf.printf "%d\n"
| ^
a.cc:6:21: error: stray '@' in program
6 | fact n *@ fact m *@ mul |> Printf.printf "%d\n"
| ^
a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token
1 | let ( *@ ) a b = (a * b) mod 1000000007
| ^
|
s730063979 | p03681 | C++ | 2#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
using namespace std;
int main() {
int N,M;
cin >> N>>M;
long long int Y = 0;
long long int R = 1;
if (N == M) {
for (int i = 1; i <= N; i++) {
R *= i;
if (R > 1000000007) {
R = R % 1000000007;
}
}
Y = R * R * 2;
}
else if (abs(N - M) == 1) {
for (int i = 1; i <= min(N, M); i++) {
R *= i;
if (R > 1000000007) {
R = R % 1000000007;
}
}
Y = R * R*max(N, M);
}
if (Y > 1000000007) {
Y = Y % 1000000007;
}
cout << Y << endl;
return 0;
} | a.cc:1:2: error: stray '#' in program
1 | 2#include <iostream>
| ^
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 2#include <iostream>
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template arg |
s530655768 | p03681 | C++ | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
if(Math.abs(m - n) > 1) {
System.out.println("1");
}
else {
long factorial = 2;
for(int i = 2; i <= n; i++) {
factorial = factorial * i % 1000000007;
}
for(int i = 2; i <= m; i++) {
factorial = factorial * i % 1000000007;
}
System.out.println(factorial);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
2 | public class Main {
| ^~~~~~
|
s684254780 | p03681 | C++ | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
if(Math.abs(m - n) > 1) {
System.out.println("1");
}
else {
long factorial = 2;
for(int i = 2; i <= n; i++) {
factorial = factorial * i % 1000000007;
}
for(int i = 2; i <= m; i++) {
factorial = factorial * i % 1000000007;
}
System.out.println(factorial);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
2 | public class Main {
| ^~~~~~
|
s669373452 | p03681 | C++ | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
if(Math.abs(m - n) > 1) {
System.out.println("1");
}
else {
long factorial = 2;
for(int i = 2; i <= n; i++) {
factorial = factorial * i % 1000000007;
}
for(int i = 2; i <= m; i++) {
factorial = factorial * i % 1000000007;
}
System.out.println(factorial);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
2 | public class Main {
| ^~~~~~
|
s448562511 | p03681 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
typedef long long ll;
using namespace std;
const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;
//while(x!=0){
//sum+=x%10;
// x/=10;
//}
//各桁の和
//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力
//s.find(w[i])==string::npos
//findの使い方
//for(int i=0;i<n;i++){
// b[i]=x%2;
//x/=2;
//}二進数
long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
string s,w;
vector<int> z;
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n >> m;
if(Abs(n,m)!=1 && Abs(n,m)!=0){
Cout(0);
}
else{
if(Abs(n,m)==0){
rrrep(i,n,0){
ans*=i;
ans%=1000000007;
}
Cout((ans*4)%1000000007);
}
else{
rrrep(i,n,0){
ans*=i;
ans%=1000000007;
}
rrrep(i,m,0){
anss*=i;
anss%=1000000007;
}
Cout((ans*anss)%1000000007);
}
}
return 0;
}
#include <bits/stdc++.h>
#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
typedef long long ll;
using namespace std;
const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;
//while(x!=0){
//sum+=x%10;
// x/=10;
//}
//各桁の和
//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力
//s.find(w[i])==string::npos
//findの使い方
//for(int i=0;i<n;i++){
// b[i]=x%2;
//x/=2;
//}二進数
long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
string s,w;
vector<int> z;
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n >> m;
if(Abs(n,m)!=1 && Abs(n,m)!=0){
Cout(0);
}
else{
if(Abs(n,m)==0){
rrrep(i,n,0){
ans*=i;
ans%=1000000007;
}
Cout((ans*4)%1000000007);
}
else{
rrrep(i,n,0){
ans*=i;
ans%=1000000007;
}
rrrep(i,m,0){
anss*=i;
anss%=1000000007;
}
Cout((ans*anss)%1000000007);
}
}
return 0;
}
| a.cc:94:11: error: redefinition of 'const int INF'
94 | const int INF = 1e9,MOD = 1e9 + 7;
| ^~~
a.cc:18:11: note: 'const int INF' previously defined here
18 | const int INF = 1e9,MOD = 1e9 + 7;
| ^~~
a.cc:94:21: error: redefinition of 'const int MOD'
94 | const int INF = 1e9,MOD = 1e9 + 7;
| ^~~
a.cc:18:21: note: 'const int MOD' previously defined here
18 | const int INF = 1e9,MOD = 1e9 + 7;
| ^~~
a.cc:95:10: error: redefinition of 'const ll LINF'
95 | const ll LINF = 1e18;
| ^~~~
a.cc:19:10: note: 'const ll LINF' previously defined here
19 | const ll LINF = 1e18;
| ^~~~
a.cc:117:15: error: redefinition of 'long long int n'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:41:15: note: 'long long int n' previously defined here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:117:19: error: redefinition of 'long long int cnt'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~
a.cc:41:19: note: 'long long int cnt' previously defined here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~
a.cc:117:25: error: redefinition of 'long long int ans'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~
a.cc:41:25: note: 'long long int ans' previously defined here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~
a.cc:117:31: error: redefinition of 'long long int anss'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~~
a.cc:41:31: note: 'long long int anss' previously defined here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~~
a.cc:117:38: error: redefinition of 'long long int a'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:41:38: note: 'long long int a' previously declared here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:117:40: error: redefinition of 'long long int b'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:41:40: note: 'long long int b' previously declared here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:117:42: error: redefinition of 'long long int c'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:41:42: note: 'long long int c' previously declared here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:117:44: error: redefinition of 'long long int d'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:41:44: note: 'long long int d' previously declared here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:117:46: error: redefinition of 'long long int cmp'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~
a.cc:41:46: note: 'long long int cmp' previously declared here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~
a.cc:117:50: error: redefinition of 'long long int cmpp'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~~
a.cc:41:50: note: 'long long int cmpp' previously declared here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~~
a.cc:117:55: error: redefinition of 'long long int data'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~~
a.cc:41:55: note: 'long long int data' previously declared here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~~
a.cc:117:60: error: redefinition of 'long long int m'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:41:60: note: 'long long int m' previously declared here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:117:62: error: redefinition of 'long long int h'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:41:62: note: 'long long int h' previously declared here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:117:64: error: redefinition of 'long long int x'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:41:64: note: 'long long int x' previously declared here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:117:66: error: redefinition of 'long long int y'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:41:66: note: 'long long int y' previously declared here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^
a.cc:117:68: error: redefinition of 'long long int xcmp'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~~
a.cc:41:68: note: 'long long int xcmp' previously defined here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~~
a.cc:117:75: error: redefinition of 'long long int ycmp'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~~
a.cc:41:75: note: 'long long int ycmp' previously defined here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~~
a.cc:117:82: error: redefinition of 'long long int sum'
117 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~
a.cc:41:82: note: 'long long int sum' previously defined here
41 | long long int n=1,cnt=0,ans=1,anss=1,a,b,c,d,cmp,cmpp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;
| ^~~
a.cc:119:8: error: redefinition of 'std::string s'
119 | string s,w;
| ^
a.cc:43:8: note: 'std::string s' previously declared here
43 | string s,w;
| ^
a.cc:119:10: error: redefinition of 'std::string w'
119 | string s,w;
| ^
a.cc:43:10: note: 'std::string w' previously declared here
43 | string s,w;
| ^
a.cc:121:13: error: redefinition of 'std::vector<int> z'
121 | vector<int> z;
| ^
a.cc:45:13: note: 'std::vector<int> z' previously declared here
45 | vector<int> z;
| ^
a.cc:123:5: error: redefinition of 'int main()'
123 | int main(void){
| ^~~~
a.cc:47:5: note: 'int main()' previously defined here
47 | int main(void){
| ^~~~
|
s175348338 | p03681 | C++ | #include <string>
#include <iostream>
using namespace std;
long main() {
long n,m,i,ans=1;
cin >> n>>m;
if(n-m==1 || m-n==1){
for(i=1;i<=n;i++){
ans = ans*i;
ans = ans%(1000000007);
}
for(i=1;i<=m;i++){
ans = ans*i;
ans = ans %(1000000007);
}
}else if(n==m){
for(i=1;i<=n;i++){
ans = ans * i * i;
ans = ans %(1000000007);
}
ans *= 2;
ans = ans %(1000000007);
}else{
ans = 0;
}
cout << ans << endl;
return 0;
} | cc1plus: error: '::main' must return 'int'
|
s196479907 | p03681 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b;
cin>>a>>b;
long long ans=1;
if(abs(a-b)>1)ans=0;
else if(a==b){
for(int i=1;i<=a;i++){
ans=(ans*i)%1000000007;
ans=(ans*2)%1000000007;
}
}else{
ll ans2=1;
for(int i=1;i<=min(a,b);i++){
ans=(ans*i)%1000000007;
ans2=(ans2*i)%1000000007;
}
ans2=(ans2*max(a,b))%1000000007;
ans=ans*ans2;
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:1: error: 'll' was not declared in this scope
14 | ll ans2=1;
| ^~
a.cc:17:1: error: 'ans2' was not declared in this scope; did you mean 'ans'?
17 | ans2=(ans2*i)%1000000007;
| ^~~~
| ans
a.cc:19:1: error: 'ans2' was not declared in this scope; did you mean 'ans'?
19 | ans2=(ans2*max(a,b))%1000000007;
| ^~~~
| ans
|
s437727741 | p03681 | C++ | import static java.lang.System.out;
import java.util.Scanner;
import java.util.Arrays;
public class Main{
public static void main(String[]aa){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int max = 1000000007;
if(Math.abs(N-M)>1){
out.println(0);
}else if(Math.abs(N-M) ==0){
long data = (getFactional(N)+getFactional(M))*2;
out.println(data%max);
}else{
long data = (getFactional(N)*getFactional(M));
out.println(data%max);
}
sc.close();
}
public static int getFactional(int n){
if(n == 0){
return 1;
}else{
return n * getFactional(n-1);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import static java.lang.System.out;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.util.Scanner;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.util.Arrays;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
4 | public class Main{
| ^~~~~~
|
s972467869 | p03681 | C++ | #ifndef __INTMOD_H__0001__
#define __INTMOD_H__0001__
#include <vector>
template <unsigned int Modulus>
class IntMod {
typedef unsigned long long ULL;
private:
unsigned int value_m;
void Copy(const IntMod& other) { value_m = other.value_m; }
bool Modulus_is_valid() { return Modulus != 0; }
public:
IntMod() { value_m = 0; }
IntMod(unsigned int value) { value_m = value % Modulus; }
IntMod(int value) {
if (Modulus >= 0x80000000UL) {
value_m = value >= 0 ? (unsigned int)value % Modulus : Modulus - (unsigned int)(-value);
} else {
int tmp = value % (int)Modulus;
value_m = tmp >= 0 ? tmp : Modulus - (unsigned int)(-tmp);
}
}
IntMod(const IntMod& other) { Copy(other); }
IntMod& operator=(const IntMod& other) { Copy(other); return *this; }
bool operator==(const IntMod& right) const { return value_m == right.value_m; }
bool operator!=(const IntMod& right) const { return value_m != right.value_m; }
IntMod& operator++() {
++value_m;
value_m %= Modulus;
return *this;
}
IntMod& operator--() {
if (value_m == 0) { value_m = Modulus - 1; }
else { --value_m; }
return *this;
}
IntMod operator-() const {
if (value_m == 0) return IntMod(0);
return IntMod(Modulus - value_m);
}
IntMod& operator+=(const IntMod& right) {
ULL sum = (ULL)value_m + right.value_m;
if (sum >= (ULL)Modulus) { value_m = (unsigned int)(sum - (ULL)Modulus); }
else { value_m = (unsigned int)sum; }
return *this;
}
IntMod& operator-=(const IntMod& right) {
(*this) += (-right);
return *this;
}
IntMod operator+(const IntMod& right) {
IntMod ret(*this);
ret += right;
return ret;
}
IntMod operator-(const IntMod& right) {
IntMod ret(*this);
ret -= right;
return ret;
}
IntMod& operator*=(const IntMod& right) {
ULL tmp = (ULL)value_m * right.value_m;
value_m = tmp % (ULL)Modulus;
return *this;
}
IntMod& operator/=(const IntMod& right) {
(*this) *= (right.Inverse());
return *this;
}
IntMod operator*(const IntMod& right) {
IntMod ret(*this);
ret *= right;
return ret;
}
IntMod operator/(const IntMod& right) {
IntMod ret(*this);
ret /= right;
return ret;
}
/* 素数判定は自分でしろ */
IntMod Inverse() const {
return (*this).Pow(Modulus - 2);
}
IntMod Pow(unsigned int exp) const {
unsigned int arr[32]; // 32じゃなくてもいい
ULL sum = 1;
arr[0] = value_m;
for (int i = 1; i < 32; ++i) {
arr[i] = ((ULL)arr[i - 1] * arr[i - 1]) % (ULL)Modulus;
}
for (int i = 0; i < 32; ++i) {
if (exp & (0x1 << i)) {
sum *= arr[i]; sum %= (ULL)Modulus;
}
}
return (unsigned int)sum;
}
IntMod Fact() const {
static vector<IntMod> table;
int factoriand = Get_value();
if (table.size() > factoriand) {
return table[factoriand];
}
int old_size = table.size();
table.resize(factoriand + 1);
for (int i = old_size; i <= factoriand; i++) {
table[i] = (i == 0 ? 1 : table[i - 1] * i);
}
return table[factoriand];
}
unsigned int Get_value() const {
return value_m;
}
};
#endif
typedef IntMod<1000000007> MInt;
//#include "Union_Find.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
using namespace std;
#define REP(i,a,n) for(int i = a; i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#if 1
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;
#endif
int N, K;
int main() {
cin >> N >> K;
MInt A, B;
A = max(N, K);
B = min(K, N);
if (A == B) {
cout << (A.Fact() * B.Fact() * 2).Get_value() << endl;
} else if(A == B + 1) {
cout << (A.Fact() * B.Fact()).Get_value() << endl;
} else {
cout << 0 << endl;
}
return 0;
}
| a.cc: In member function 'IntMod<Modulus> IntMod<Modulus>::Fact() const':
a.cc:101:24: error: 'vector' does not name a type
101 | static vector<IntMod> table;
| ^~~~~~
a.cc:103:21: error: 'table' was not declared in this scope; did you mean 'mutable'?
103 | if (table.size() > factoriand) {
| ^~~~~
| mutable
a.cc:107:32: error: 'table' was not declared in this scope; did you mean 'mutable'?
107 | int old_size = table.size();
| ^~~~~
| mutable
|
s594627921 | p03681 | C++ | #include <iostream>
#include <array>
using namespace std;
const int abs(const int &x) {
return (x < 0) ? -x : x;
}
int main()
{
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
const int MOD = (const int)1e9 + 7;
if (abs(n - m) >= 2) {
cout << 0;
}
else {
int p = 1;
for (int i = 2; i <= n; i++) {
p = (p * 1LL * i) % MOD;
}
for (int i = 2; i <= m; i++) {
p = (p * 1LL * i) % MOD;
}
if (abs(n - m) == 0) p = (p * 2LL) % MOD;
cout << p;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:12: error: call of overloaded 'abs(int)' is ambiguous
18 | if (abs(n - m) >= 2) {
| ~~~^~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
a.cc:6:11: note: candidate: 'const int abs(const int&)'
6 | const int abs(const int &x) {
| ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
a.cc:32:16: error: call of overloaded 'abs(int)' is ambiguous
32 | if (abs(n - m) == 0) p = (p * 2LL) % MOD;
| ~~~^~~~~~~
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
a.cc:6:11: note: candidate: 'const int abs(const int&)'
6 | const int abs(const int &x) {
| ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
|
s588286648 | p03681 | C++ | ar = [int(i) for i in input().split()]
n = ar[0]
m = ar[1]
res = 1
if(abs(n-m)>1):
res = -1
elif(abs(n-m) == 1):
max = max(n, m)
min = min(n, m)
for i in range(max-1):
res = res * max * min
res %= (10**9+7)
max -= 1
min -= 1
else:
max = max(n, m)
res = res * 2*n * m
n -= 1
m -= 1
for i in range(max-2):
res = res * n * m
res %= (10**9+7)
n -= 1
m -= 1
res %= (10**9+7)
print(res)
| a.cc:1:1: error: 'ar' does not name a type; did you mean 'char'?
1 | ar = [int(i) for i in input().split()]
| ^~
| char
|
s273526921 | p03681 | C++ | #include <stdio.h>
using namespace std;
#define R 1000000007
int main() {
int N, M;
long long int ans;
long long int a = 1;
long long int b = 1;
scanf_s("%d%d",&N,&M);
bool nTurn = true;
int curN = N;
int curM = M;
for (int i = 0; i < (N + M); i++) {
if (nTurn) {
if (curN == 0) {
a = 0;
break;
}
a *= (curN);
a %= R;
curN--;
nTurn = !nTurn;
}
else {
if (curM == 0) {
a = 0;
break;
}
a *= (curM);
a %= R;
curM--;
nTurn = ~nTurn;
}
}
nTurn = false;
curN = N;
curM = M;
for (int i = 0; i < (N + M); i++) {
if (nTurn) {
if (curN == 0) {
b = 0;
break;
}
b *= (curN);
b %= R;
curN--;
nTurn = !nTurn;
}
else {
if (curM == 0) {
b = 0;
break;
}
b *= (curM);
b %= R;
curM--;
nTurn = ~nTurn;
}
}
printf_s("%d", (a+b)%R);
return 0;
} | a.cc: In function 'int main()':
a.cc:9:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
9 | scanf_s("%d%d",&N,&M);
| ^~~~~~~
| scanf
a.cc:60:9: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
60 | printf_s("%d", (a+b)%R);
| ^~~~~~~~
| printf
|
s573665671 | p03681 | C++ | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
long long int mod = 10e9+7;
int fact(int n){
int factorial = 1;
for (int i=1;i<=n;i++){
factorial*= i;
}
return factorial;
}
int main() {
int d,m;long long int ans=0;
cin>>d>>m;
if(abs(d-m) >= 2) {cout<<"0";return 0;}
if((d+m)%2!=0){
ans = fact(d)*fact(m);
}
else {
ans = 2*(fact(d)*fact(m);
}
cout<<ans%mod;
} | a.cc: In function 'int main()':
a.cc:24:37: error: expected ')' before ';' token
24 | ans = 2*(fact(d)*fact(m);
| ~ ^
| )
|
s976455315 | p03681 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
int mod_fact(int n, int mod) {
if ( n <= 1 ) return 1;
return (n * mod_fact(n-1)) % mod;
}
int main( void ) {
int N, M;
std::cin >> N >> M;
const int mod = 1000000007;
const int max = std::max(N, M);
const int min = std::min(N, M);
if( max - min >= 2 ) {
std::cout << 0 << std::endl;
return 0;
}
const int fact_max = mod_fact(max % mod);
const int fact_min = mod_fact(min % mod);
const bool can_swap = ((max - min) == 0);
const int swap_coef = can_swap ? 2 : 1;
const int result = (fact_max * fact_min * swap_coef) % mod;
std::cout << result << std::endl;
return 0;
} | a.cc: In function 'int mod_fact(int, int)':
a.cc:7:23: error: too few arguments to function 'int mod_fact(int, int)'
7 | return (n * mod_fact(n-1)) % mod;
| ~~~~~~~~^~~~~
a.cc:5:5: note: declared here
5 | int mod_fact(int n, int mod) {
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:24:32: error: too few arguments to function 'int mod_fact(int, int)'
24 | const int fact_max = mod_fact(max % mod);
| ~~~~~~~~^~~~~~~~~~~
a.cc:5:5: note: declared here
5 | int mod_fact(int n, int mod) {
| ^~~~~~~~
a.cc:25:32: error: too few arguments to function 'int mod_fact(int, int)'
25 | const int fact_min = mod_fact(min % mod);
| ~~~~~~~~^~~~~~~~~~~
a.cc:5:5: note: declared here
5 | int mod_fact(int n, int mod) {
| ^~~~~~~~
|
s678680135 | p03681 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
int mod_fact(int n, int mod) {
if ( n <= 1 ) return 1;
return (n * mod_fact(n-1)) % mod;
}
int main( void ) {
int N, M;
std::cin >> N >> M;
const int mod = 1000000007;
const int max = std::max(N, M);
const int min = std::min(N, M);
if( max - min >= 2 ) {
std::cout << 0 << std::endl;
return 0;
}
const int fact_max = mod_fact(max);
const int fact_min = mod_fact(min);
const bool can_swap = ((max - min) == 0);
const int swap_coef = can_swap ? 2 : 1;
const int result = (fact_max * fact_min * swap_coef) % mod;
std::cout << result << std::endl;
return 0;
} | a.cc: In function 'int mod_fact(int, int)':
a.cc:7:23: error: too few arguments to function 'int mod_fact(int, int)'
7 | return (n * mod_fact(n-1)) % mod;
| ~~~~~~~~^~~~~
a.cc:5:5: note: declared here
5 | int mod_fact(int n, int mod) {
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:24:32: error: too few arguments to function 'int mod_fact(int, int)'
24 | const int fact_max = mod_fact(max);
| ~~~~~~~~^~~~~
a.cc:5:5: note: declared here
5 | int mod_fact(int n, int mod) {
| ^~~~~~~~
a.cc:25:32: error: too few arguments to function 'int mod_fact(int, int)'
25 | const int fact_min = mod_fact(min);
| ~~~~~~~~^~~~~
a.cc:5:5: note: declared here
5 | int mod_fact(int n, int mod) {
| ^~~~~~~~
|
s687229914 | p03681 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
typedef long long ll;
int mod_fact(int n, int mod) {
if ( n <= 1 ) return 1;
return (n * factorial(n-1)) % mod;
}
int main( void ) {
int N, M;
std::cin >> N >> M;
const int mod = 1000000007;
const int max = std::max(N, M);
const int min = std::min(N, M);
if( max - min >= 2 ) {
std::cout << 0 << std::endl;
return 0;
}
const int fact_max = factorial(max % mod) % mod;
const int fact_min = factorial(min % mod) % mod;
const bool can_swap = ((max - min) == 0);
const int swap_coef = can_swap ? 2 : 1;
const int result = (fact_max * fact_min * swap_coef) % mod;
std::cout << result << std::endl;
return 0;
} | a.cc: In function 'int mod_fact(int, int)':
a.cc:9:15: error: 'factorial' was not declared in this scope
9 | return (n * factorial(n-1)) % mod;
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:26:24: error: 'factorial' was not declared in this scope
26 | const int fact_max = factorial(max % mod) % mod;
| ^~~~~~~~~
|
s902305052 | p03681 | C++ | #include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <sstream>
#include <deque>
#define ll long long
using namespace std;
const int maxn=100000;
const int mod=1000000007;
int n,m;
int factorial(int n){
int ans=1;
for(int i=1;i<n+1;i++){
ans*=i;
ans=ans%mod;
}
ans=ans%mod;
return ans;
}
int main(){
cin>>n>>m;
if(n==m){
int ans_n=factorial(n);
int ans_m=factorial(m);
int out=((ans_n*ans_m))%mod;
int out=(2*out)%mod;
cout<<out;
return 0;
}
if(abs(n-m)==1){
int ans_n=factorial(n);
int ans_m=factorial(m);
int out=((ans_n*ans_m))%mod;
cout<<out;
return 0;
}
cout<<"0";
return 0;
} | a.cc: In function 'int main()':
a.cc:39:21: error: redeclaration of 'int out'
39 | int out=(2*out)%mod;
| ^~~
a.cc:38:21: note: 'int out' previously declared here
38 | int out=((ans_n*ans_m))%mod;
| ^~~
|
s778220834 | p03681 | C++ | #include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <sstream>
#include <deque>
#define ll long long
using namespace std;
const int maxn=100000;
const int mod=1000000007;
int n,m;
int factorial(int n){
int ans=1;
for(int i=1;i<n+1;i++){
ans*=i;
ans=ans%mod;
}
ans=ans%mod;
return ans;
}
int main(){
cin>>n>>m;
if(n==m){
ans_n=factorial(n);
ans_m=factorial(m);
out=(2*(ans_n+ans_m))%mod;
cout<<out;
return 0;
}
if(abs(n-m)==1){
int ma=max(n,m);
int ans=factorial(ma);
out=(2*(ans))%mod;
cout<<out;
return 0;
}
cout<<"0";
return 0;
} | a.cc: In function 'int main()':
a.cc:35:17: error: 'ans_n' was not declared in this scope
35 | ans_n=factorial(n);
| ^~~~~
a.cc:36:17: error: 'ans_m' was not declared in this scope
36 | ans_m=factorial(m);
| ^~~~~
a.cc:38:17: error: 'out' was not declared in this scope
38 | out=(2*(ans_n+ans_m))%mod;
| ^~~
a.cc:47:17: error: 'out' was not declared in this scope
47 | out=(2*(ans))%mod;
| ^~~
|
s527705608 | p03681 | C++ | #include <stdio.h>
#include <math.h>
#include <algorithm>
long long int f(long long num)
{
if (num == 1) return 1;
return (num * f(num - 1)) % (1000000007);
}
int main()
{
long long int N, M;
scanf("%lld%lld", &N, &M);
if (abs(N - M) > 1) printf("-1\n");
else
{
long long int ans = 1;
if (N == M) ans *= 2;
printf("%lld\n", ((((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:69: error: expected ')' before ';' token
20 | printf("%lld\n", ((((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
| ~ ^
| )
|
s604798866 | p03681 | C++ | #include <stdio.h>
#include <math.h>
#include <algorithm>
long long int f(long long num)
{
if (num = 1) return 1;
return (num * f(num - 1)) % (1000000007);
}
int main()
{
long long int N, M;
scanf("%lld%lld", &N, &M);
if (abs(N - M) > 1) printf("-1\n");
else
{
long long ans = 1;
if (N == M) ans * 2;
printf("%lld\n", ((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:66: error: expected ';' before ')' token
20 | printf("%lld\n", ((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
| ^
| ;
|
s041912543 | p03681 | C++ | #include <stdio.h>
#include <math.h>
#include <algorithm>
long long int f(long long num)
{
if (num = 1) return 1;
return (num * f(num - 1)) % (1000000007);
}
int main()
{
long long int N, M;
scanf("%lld%lld", &N, &M);
if (abs(N - M) > 1) printf("-1\n");
else
{
long long ans = 1;
if (N == M) ans * 2;
printf("%ld\n", ((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:65: error: expected ';' before ')' token
20 | printf("%ld\n", ((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
| ^
| ;
|
s326306046 | p03681 | C++ | #include <stdio.h>
#include <math.h>
long long int f(long long num)
{
if (num = 1) return 1;
return (num * f(num - 1)) % (1000000007);
}
int main()
{
long long int N, M;
scanf("%lld%lld", &N, &M);
if (abs(N - M) > 1) printf("-1\n");
else
{
long long ans = 1;
if (N == M) ans * 2;
printf("%ld\n", ((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:65: error: expected ';' before ')' token
19 | printf("%ld\n", ((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
| ^
| ;
|
s417009044 | p03681 | C++ | #include <stdio.h>
#include <math>
long long int f(long long num)
{
if (num = 1) return 1;
return (num * f(num - 1)) % (1000000007);
}
int main()
{
long long int N, M;
scanf("%lld%lld", &N, &M);
if (abs(N - M) > 1) printf("-1\n");
else
{
long long ans = 1;
if (N == M) ans * 2;
printf("%ld\n", ((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
}
return 0;
} | a.cc:2:10: fatal error: math: No such file or directory
2 | #include <math>
| ^~~~~~
compilation terminated.
|
s879552247 | p03681 | C++ | #include <stdio.h>
#include <math.h>
long long int f(long long num)
{
if (num = 1) return 1;
return (num * f(num - 1)) % (1000000007)
}
int main()
{
long long int N, M;
scanf("%lld%lld", &N, &M);
if (abs(N - M) > 1) printf("-1\n");
else
{
long long ans = 1;
if (N == M) ans * 2;
printf("%ld\n", ((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
}
return 0;
} | a.cc: In function 'long long int f(long long int)':
a.cc:7:41: error: expected ';' before '}' token
7 | return (num * f(num - 1)) % (1000000007)
| ^
| ;
8 | }
| ~
a.cc: In function 'int main()':
a.cc:19:65: error: expected ';' before ')' token
19 | printf("%ld\n", ((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
| ^
| ;
|
s902957687 | p03681 | C++ | #include <stdio.h>
#include <math>
long long int f(long long num)
{
if (num = 1) return 1;
return (num * f(num - 1)) % (1000000007)
}
int main()
{
long long int N, M;
scanf("%lld%lld", &N, &M);
if (abs(N - M) > 1) printf("-1\n");
else
{
long long ans = 1;
if (N == M) ans * 2;
printf("%ld\n", ((ans * f(N)) % 1000000007) * f(M)) % 1000000007);
}
return 0;
} | a.cc:2:10: fatal error: math: No such file or directory
2 | #include <math>
| ^~~~~~
compilation terminated.
|
s614806549 | p03681 | C++ | # define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
# define string(x) string x; cin >> x;
using namespace std;
namespace utils{
template <typename T> void print(vector<vector<T>> mat) {
REP (i, mat.size()) {
REP (j, mat[0].size()) cout << mat[i][j] << ' ';
cout << endl;
}
}
template <typename T> void print(vector<T> v) {
REP (i, v.size())
if (i >= v.size()-1)
cout << v[i];
else
cout << v[i] << ' ';
cout << endl;
}
template <typename T> pair<T, T> shape(vector<vector<T>> mat) {
int d1, d2;
d1 = mat.size();
if (d1 > 0) d2 = mat[0].size();
else int d2 = 0;
cout << "(" << d1 << ", " << d2 << ")" << endl;
return make_pair(0, 0);
}
template <typename T> vector<vector<T>> empty(int n, int m) {
vector<vector<T>> mat(n, vector<T>(m));
return mat;
}
}
#define MOD 1000000007
long long fact(long long k){
long long sum = 1;
for (long long i = 1; i <=k;i++){
sum *= i;
sum %= MOD;
}
return (sum);
}
int main() {
vint(A,2);
if(abs(A[0]-A[1])<=1){
long long ans = 1;
ans = (fact(A[0]) * fact(A[1])) % MOD;
if(A[0] == A[1])
ans = (ans*2)%MOD;
cout << ans << endl;
}else{
cout << 0 << endl;
}
} | a.cc:7:30: error: variable or field 'print' declared void
7 | template <typename T> void print(vector<vector<T>> mat) {
| ^~~~~
a.cc:7:36: error: 'vector' was not declared in this scope
7 | template <typename T> void print(vector<vector<T>> mat) {
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | # define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
a.cc:7:43: error: 'vector' was not declared in this scope
7 | template <typename T> void print(vector<vector<T>> mat) {
| ^~~~~~
a.cc:7:43: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:7:51: error: expected primary-expression before '>>' token
7 | template <typename T> void print(vector<vector<T>> mat) {
| ^~
a.cc:7:54: error: 'mat' was not declared in this scope
7 | template <typename T> void print(vector<vector<T>> mat) {
| ^~~
a.cc:14:30: error: variable or field 'print' declared void
14 | template <typename T> void print(vector<T> v) {
| ^~~~~
a.cc:14:36: error: 'vector' was not declared in this scope
14 | template <typename T> void print(vector<T> v) {
| ^~~~~~
a.cc:14:36: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:14:44: error: expected primary-expression before '>' token
14 | template <typename T> void print(vector<T> v) {
| ^
a.cc:14:46: error: 'v' was not declared in this scope
14 | template <typename T> void print(vector<T> v) {
| ^
a.cc:24:25: error: 'pair' does not name a type
24 | template <typename T> pair<T, T> shape(vector<vector<T>> mat) {
| ^~~~
a.cc:34:25: error: 'vector' does not name a type
34 | template <typename T> vector<vector<T>> empty(int n, int m) {
| ^~~~~~
a.cc: In function 'int main()':
a.cc:1:20: error: 'vector' was not declared in this scope
1 | # define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
| ^~~~~~
a.cc:50:3: note: in expansion of macro 'vint'
50 | vint(A,2);
| ^~~~
a.cc:1:20: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
1 | # define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
| ^~~~~~
a.cc:50:3: note: in expansion of macro 'vint'
50 | vint(A,2);
| ^~~~
a.cc:1:27: error: expected primary-expression before 'int'
1 | # define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
| ^~~
a.cc:50:3: note: in expansion of macro 'vint'
50 | vint(A,2);
| ^~~~
a.cc:1:42: error: 'i' was not declared in this scope
1 | # define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
| ^
a.cc:50:3: note: in expansion of macro 'vint'
50 | vint(A,2);
| ^~~~
a.cc:1:38: error: 'REP' was not declared in this scope
1 | # define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
| ^~~
a.cc:50:3: note: in expansion of macro 'vint'
50 | vint(A,2);
| ^~~~
a.cc:52:10: error: 'A' was not declared in this scope
52 | if(abs(A[0]-A[1])<=1){
| ^
a.cc:52:6: error: 'abs' was not declared in this scope
52 | if(abs(A[0]-A[1])<=1){
| ^~~
a.cc:57:5: error: 'cout' was not declared in this scope
57 | cout << ans << endl;
| ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | # define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
a.cc:57:20: error: 'endl' was not declared in this scope
57 | cout << ans << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | # define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
a.cc:59:5: error: 'cout' was not declared in this scope
59 | cout << 0 << endl;
| ^~~~
a.cc:59:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:59:18: error: 'endl' was not declared in this scope
59 | cout << 0 << endl;
| ^~~~
a.cc:59:18: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
|
s906473031 | p03681 | C++ | #include<iostream>
using namespace std;
int factorial(int long long);
int main(){
int n,m;
cin>>n>>m;
if(n-m==0){
cout<<(2*factorial(n)*factorial(m))%1000000007<<endl;
}
else if(n-m==1 || n-m==-1){
cout<<(factorial(n)*factorial(m))%1000000007<<endl;
}
else{
cout<<"0"<<endl;
}
return 0;
}
int factorial(long longint M){
int some;
some=M;
for(int i=1;i<some;i++){
M=M*i;
}
return M;
}
| a.cc:18:28: error: expected ',' or '...' before 'M'
18 | int factorial(long longint M){
| ^
a.cc: In function 'int factorial(long int)':
a.cc:20:14: error: 'M' was not declared in this scope
20 | some=M;
| ^
|
s763342544 | p03681 | Java | import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
long n = scanner.nextInt();
long m = scanner.nextInt();
int ans = 1;
if(Math.abs(n,m) >= 2){
System.out.println(0);
}else if (n == m) {
for(int i = 1; i < n+1; i++){
ans = (ans % 1000000007) * i;
}
System.out.println((ans*2) % 1000000007);
}else {
for(int i = 1; i < Math.max(n, m); i++){
ans = (ans % 1000000007) * i;
}
System.out.println(ans * ans/(Math.max(n, m))%1000000007);
}
}
}
| Main.java:11: error: no suitable method found for abs(long,long)
if(Math.abs(n,m) >= 2){
^
method Math.abs(int) is not applicable
(actual and formal argument lists differ in length)
method Math.abs(long) is not applicable
(actual and formal argument lists differ in length)
method Math.abs(float) is not applicable
(actual and formal argument lists differ in length)
method Math.abs(double) is not applicable
(actual and formal argument lists differ in length)
1 error
|
s537377245 | p03681 | C++ | #include<iostream>
#include<vector>
#include<cstdlib>
#include<gmpxx.h>
mpz_class fact(int);
using namespace std;
int main(){
int n,m;
int c = 100000000+7;
cin >> n >> m;
if(n==m){
cout << (fact(n)*2*2)%c << endl;
}
else if(abs(n-m)==1){
cout << (fact(n)*fact(m))%c << endl;
}
else {
cout << 0 << endl;
}
}
mpz_class fact(int n){
if(n==0)return 1;
else return n*fact(n-1);
}
/*
#include<iostream>
#include<vector>
#include<cstdlib>
#include<gmpxx.h>
mpz_class fact(int);
using namespace std;
int main(){
int cnt = 10000;
cout << fact(cnt)%(1000000000+7) << endl;
}
mpz_class fact(int n){
if(n==0)return 1;
else return n*fact(n-1);
}
*/
| /usr/bin/ld: /tmp/ccU5bANH.o: in function `__gmp_binary_multiplies::eval(__mpz_struct*, __mpz_struct const*, __mpz_struct const*)':
a.cc:(.text._ZN23__gmp_binary_multiplies4evalEP12__mpz_structPKS0_S3_[_ZN23__gmp_binary_multiplies4evalEP12__mpz_structPKS0_S3_]+0x27): undefined reference to `__gmpz_mul'
/usr/bin/ld: /tmp/ccU5bANH.o: in function `__gmp_binary_multiplies::eval(__mpz_struct*, __mpz_struct const*, long)':
a.cc:(.text._ZN23__gmp_binary_multiplies4evalEP12__mpz_structPKS0_l[_ZN23__gmp_binary_multiplies4evalEP12__mpz_structPKS0_l]+0x27): undefined reference to `__gmpz_mul_si'
/usr/bin/ld: /tmp/ccU5bANH.o: in function `__gmp_binary_modulus::eval(__mpz_struct*, __mpz_struct const*, long)':
a.cc:(.text._ZN20__gmp_binary_modulus4evalEP12__mpz_structPKS0_l[_ZN20__gmp_binary_modulus4evalEP12__mpz_structPKS0_l]+0x32): undefined reference to `__gmpz_tdiv_r_ui'
/usr/bin/ld: /tmp/ccU5bANH.o: in function `__gmp_expr<__mpz_struct [1], __mpz_struct [1]>::init_si(long)':
a.cc:(.text._ZN10__gmp_exprIA1_12__mpz_structS1_E7init_siEl[_ZN10__gmp_exprIA1_12__mpz_structS1_E7init_siEl]+0x1f): undefined reference to `__gmpz_init_set_si'
/usr/bin/ld: /tmp/ccU5bANH.o: in function `__gmp_expr<__mpz_struct [1], __mpz_struct [1]>::~__gmp_expr()':
a.cc:(.text._ZN10__gmp_exprIA1_12__mpz_structS1_ED2Ev[_ZN10__gmp_exprIA1_12__mpz_structS1_ED5Ev]+0x14): undefined reference to `__gmpz_clear'
/usr/bin/ld: /tmp/ccU5bANH.o: in function `std::ostream& operator<< <__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, long, __gmp_binary_multiplies> >, long, __gmp_binary_multiplies> >, long, __gmp_binary_modulus> >(std::ostream&, __gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, long, __gmp_binary_multiplies> >, long, __gmp_binary_multiplies> >, long, __gmp_binary_modulus> > const&)':
a.cc:(.text._ZlsIA1_12__mpz_struct17__gmp_binary_exprI10__gmp_exprIS1_S2_IS3_IS1_S2_IS3_IS1_S1_El23__gmp_binary_multipliesEElS5_EEl20__gmp_binary_modulusEERSoSC_RKS3_IT_T0_E[_ZlsIA1_12__mpz_struct17__gmp_binary_exprI10__gmp_exprIS1_S2_IS3_IS1_S2_IS3_IS1_S1_El23__gmp_binary_multipliesEElS5_EEl20__gmp_binary_modulusEERSoSC_RKS3_IT_T0_E]+0x46): undefined reference to `operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: /tmp/ccU5bANH.o: in function `std::ostream& operator<< <__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_binary_multiplies> >, long, __gmp_binary_modulus> >(std::ostream&, __gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_binary_multiplies> >, long, __gmp_binary_modulus> > const&)':
a.cc:(.text._ZlsIA1_12__mpz_struct17__gmp_binary_exprI10__gmp_exprIS1_S2_IS3_IS1_S1_ES4_23__gmp_binary_multipliesEEl20__gmp_binary_modulusEERSoSA_RKS3_IT_T0_E[_ZlsIA1_12__mpz_struct17__gmp_binary_exprI10__gmp_exprIS1_S2_IS3_IS1_S1_ES4_23__gmp_binary_multipliesEEl20__gmp_binary_modulusEERSoSA_RKS3_IT_T0_E]+0x46): undefined reference to `operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: /tmp/ccU5bANH.o: in function `__gmp_expr<__mpz_struct [1], __mpz_struct [1]>::__gmp_expr<__gmp_binary_expr<long, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_binary_multiplies> >(__gmp_expr<__mpz_struct [1], __gmp_binary_expr<long, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_binary_multiplies> > const&)':
a.cc:(.text._ZN10__gmp_exprIA1_12__mpz_structS1_EC2I17__gmp_binary_exprIlS2_23__gmp_binary_multipliesEEERKS_IS1_T_E[_ZN10__gmp_exprIA1_12__mpz_structS1_EC5I17__gmp_binary_exprIlS2_23__gmp_binary_multipliesEEERKS_IS1_T_E]+0x18): undefined reference to `__gmpz_init'
/usr/bin/ld: /tmp/ccU5bANH.o: in function `__gmp_expr<__mpz_struct [1], __mpz_struct [1]>::__gmp_expr<__gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, long, __gmp_binary_multiplies> >, long, __gmp_binary_multiplies> >, long, __gmp_binary_modulus> >(__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, long, __gmp_binary_multiplies> >, long, __gmp_binary_multiplies> >, long, __gmp_binary_modulus> > const&)':
a.cc:(.text._ZN10__gmp_exprIA1_12__mpz_structS1_EC2I17__gmp_binary_exprIS_IS1_S4_IS_IS1_S4_IS2_l23__gmp_binary_multipliesEElS5_EEl20__gmp_binary_modulusEEERKS_IS1_T_E[_ZN10__gmp_exprIA1_12__mpz_structS1_EC5I17__gmp_binary_exprIS_IS1_S4_IS_IS1_S4_IS2_l23__gmp_binary_multipliesEElS5_EEl20__gmp_binary_modulusEEERKS_IS1_T_E]+0x18): undefined reference to `__gmpz_init'
/usr/bin/ld: /tmp/ccU5bANH.o: in function `__gmp_expr<__mpz_struct [1], __mpz_struct [1]>::__gmp_expr<__gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_binary_multiplies> >, long, __gmp_binary_modulus> >(__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_binary_multiplies> >, long, __gmp_binary_modulus> > const&)':
a.cc:(.text._ZN10__gmp_exprIA1_12__mpz_structS1_EC2I17__gmp_binary_exprIS_IS1_S4_IS2_S2_23__gmp_binary_multipliesEEl20__gmp_binary_modulusEEERKS_IS1_T_E[_ZN10__gmp_exprIA1_12__mpz_structS1_EC5I17__gmp_binary_exprIS_IS1_S4_IS2_S2_23__gmp_binary_multipliesEEl20__gmp_binary_modulusEEERKS_IS1_T_E]+0x18): undefined reference to `__gmpz_init'
collect2: error: ld returned 1 exit status
|
s066302244 | p03681 | C | #include <stdio.h>
int kaijou(x);
int main(void){
int n,m;
float x;
scanf("%d %d",&n,&m);
if((n-m)>1||(n-m)<-1)
printf("0\n");
else{
x=kaijou(n)*kaijou(m)*2;
if(x>1.0e9 + 7)
printf("%d\n",x%1.0e9+7);
else
printf("%d\n",x);
}
return 0;
}
int kaijou(x){
int a=1;
int i;
for(i=1;i<=x;i++){
a=a*i;
}
return x;
}
| main.c:3:1: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
3 | int kaijou(x);
| ^~~
main.c: In function 'main':
main.c:14:22: error: invalid operands to binary % (have 'float' and 'double')
14 | printf("%d\n",x%1.0e9+7);
| ^
main.c: In function 'kaijou':
main.c:20:5: error: type of 'x' defaults to 'int' [-Wimplicit-int]
20 | int kaijou(x){
| ^~~~~~
|
s607517790 | p03681 | C++ | #include<iostream>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
if(n*m%2==0){
cout<<"0"<<endl;
}
if(n*m%2!=0){
int sum=a*b*2
cout<<sum%1000000007<<endl;
}
/*int n,a[100000],ans=0,count=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(a[i]==j+1){
count+=1;
i=j-1;
if(i==1){
break;
}
if(count==n && i!=1){
cout<<"-1"<<endl;
break;
}
}
}
}
cout<<count<<endl;*/
return 0;
} | a.cc: In function 'int main()':
a.cc:10:25: error: 'a' was not declared in this scope
10 | int sum=a*b*2
| ^
a.cc:10:27: error: 'b' was not declared in this scope
10 | int sum=a*b*2
| ^
|
s786144505 | p03681 | C | #include<stdio.h>
#include<string.h>
#include<math.h>
int plzh(long long a)
{
const long long maple = 1e9+7;
if(a==0||a==1)
return 1;
else
return(a*plzh(a-1)%maple);
}
int main()
{
long long x,m,n;
while(scanf("%lld%lld",&m,&n)!=EOF)
{
if(fabs(m-n)>1)
printf("0\n");
else if(m!=n)
{
x=plzh(m)*plzh(n)%maple;
printf("%lld\n",x);
}
else
{
x=plzh(m)*plzh(n)*2%maple;
printf("%lld\n",x);
}
}
} | main.c: In function 'main':
main.c:21:43: error: 'maple' undeclared (first use in this function)
21 | x=plzh(m)*plzh(n)%maple;
| ^~~~~
main.c:21:43: note: each undeclared identifier is reported only once for each function it appears in
|
s659211580 | p03681 | C++ | #include<iostream>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
if(n*m%2==0){
cout<<"0"<<endl;
}
if(n*m%2!=0){
cout<<(a*b*2)%1000000007<<endl;
}
/*int n,a[100000],ans=0,count=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(a[i]==j+1){
count+=1;
i=j-1;
if(i==1){
break;
}
if(count==n && i!=1){
cout<<"-1"<<endl;
break;
}
}
}
}
cout<<count<<endl;*/
return 0;
} | a.cc: In function 'int main()':
a.cc:10:24: error: 'a' was not declared in this scope
10 | cout<<(a*b*2)%1000000007<<endl;
| ^
a.cc:10:26: error: 'b' was not declared in this scope
10 | cout<<(a*b*2)%1000000007<<endl;
| ^
|
s076248899 | p03681 | C++ | #include <iostream>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
if (abs(n - m) > 1) {
cout << 0 << endl;
return 0;
}
long nr = 1, mr = 0;
for (int i = n; i > 1; i++) {
nr *= i;
}
for (int i = 0; i < n + 1; i++) {
mr *= (m - i) / (n + 1 - i);
}
long n = 1;
for (int i = 0; i < 9; i++) {
n *= 10;
}
n += 7;
long res = nr * mr % n;
cout << res << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:18:14: error: conflicting declaration 'long int n'
18 | long n = 1;
| ^
a.cc:5:13: note: previous declaration as 'int n'
5 | int n, m;
| ^
|
s516278199 | p03681 | C++ | # coding: utf-8
# Here your code !
n,m=input().split()
l=[1]
for i in range(1,100001):
l.append(l[i-1]*(i)%1000000007)
n=int(n)
m=int(m)
if n==m:
print(l[n]*l[m]*2%1000000007)
elif (n-m==1):
print(l[n]*l[m])
else:
print(0) | a.cc:1:3: error: invalid preprocessing directive #coding
1 | # coding: utf-8
| ^~~~~~
a.cc:2:3: error: invalid preprocessing directive #Here
2 | # Here your code !
| ^~~~
a.cc:4:1: error: 'n' does not name a type
4 | n,m=input().split()
| ^
|
s114108772 | p03681 | C | #include <stdio.h>
#define int64 long long int
int64 F[100005];
const int md = 1000000007;
int n, m;
int abs (int x) { return x < 0 ? -x : x; }
int main ()
{
F[0] = 1;
for (int i = 1; i < 100005; i++) F[i] = F[i - 1] * i, F[i] %= md;
scanf ("%d %d", &n, &m);
if (abs (n - m) => 2) {
puts ("0");
return 0;
}
int64 ans = 1;
ans = (ans * 1ll * F[n]) % md;
ans = (ans * 1ll * F[m]) % md;
if (n == m) ans *= 2;
printf ("%lld\n", ans % md);
return 0;
} | main.c: In function 'main':
main.c:14:26: error: expected expression before '>' token
14 | if (abs (n - m) => 2) {
| ^
|
s514896812 | p03681 | C++ | from math import *
a,b = map(int, input().split())
if abs(a-b) > 1 :
print(0)
else :
print((1 if abs(a-b) else 2)*factorial(a)*factorial(b)%1000000007)
| a.cc:1:1: error: 'from' does not name a type
1 | from math import *
| ^~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.