message stringlengths 2 16.2k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 575 109k | cluster float64 16 16 | __index_level_0__ int64 1.15k 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N positive integers written on a blackboard: A_1, ..., A_N.
Snuke can perform the following operation when all integers on the blackboard are even:
* Replace each integer X on the bl... | instruction | 0 | 85,610 | 16 | 171,220 |
No | output | 1 | 85,610 | 16 | 171,221 |
Provide a correct Python 3 solution for this coding contest problem.
Ringo Mart, a convenience store, sells apple juice.
On the opening day of Ringo Mart, there were A cans of juice in stock in the morning. Snuke buys B cans of juice here every day in the daytime. Then, the manager checks the number of cans of juice ... | instruction | 0 | 86,369 | 16 | 172,738 |
"Correct Solution:
```
from fractions import*;exec("a,b,c,d=map(int,input().split());g=gcd(b,d);print('YNeos'[b>min(a,d)or b-g+a%g>c::2]);"*int(input()))
``` | output | 1 | 86,369 | 16 | 172,739 |
Provide a correct Python 3 solution for this coding contest problem.
Ringo Mart, a convenience store, sells apple juice.
On the opening day of Ringo Mart, there were A cans of juice in stock in the morning. Snuke buys B cans of juice here every day in the daytime. Then, the manager checks the number of cans of juice ... | instruction | 0 | 86,370 | 16 | 172,740 |
"Correct Solution:
```
T=int(input())
ABCD=[list(map(int,input().split())) for i in range(T)]
from fractions import gcd
def f(a):
print(['No','Yes'][a])
for a,b,c,d in ABCD:
if a<b:f(0)
elif d<b:f(0)
elif b<=c:f(1)
else:
g=gcd(b,d)
h=a%b
f(max(((b-h)//g*g+h)%b,b-g)<=c)
``` | output | 1 | 86,370 | 16 | 172,741 |
Provide a correct Python 3 solution for this coding contest problem.
Ringo Mart, a convenience store, sells apple juice.
On the opening day of Ringo Mart, there were A cans of juice in stock in the morning. Snuke buys B cans of juice here every day in the daytime. Then, the manager checks the number of cans of juice ... | instruction | 0 | 86,371 | 16 | 172,742 |
"Correct Solution:
```
def main():
import math
def gcd(a, b):
while b:
a, b = b, a % b
return a
N = int(input())
ABCD = [list(map(int, input().split())) for i in range(N)]
for A,B,C,D in ABCD:
# 在庫が買う本数以下 or 在庫追加が買う本数以下
if A < B or D < B:
prin... | output | 1 | 86,371 | 16 | 172,743 |
Provide a correct Python 3 solution for this coding contest problem.
Ringo Mart, a convenience store, sells apple juice.
On the opening day of Ringo Mart, there were A cans of juice in stock in the morning. Snuke buys B cans of juice here every day in the daytime. Then, the manager checks the number of cans of juice ... | instruction | 0 | 86,372 | 16 | 172,744 |
"Correct Solution:
```
def gcd(a,b):
if b== 0:
return a
else:
return gcd(b,a%b)
t = int(input())
abcd = []
ans = "No"
for i in range(0,t):
ABCD = list(map(int,input().split()))
abcd.append(ABCD)
for a,b,c,d in abcd:
if a >= b and b==d and b <= c:
ans = "Yes"
if a >= b an... | output | 1 | 86,372 | 16 | 172,745 |
Provide a correct Python 3 solution for this coding contest problem.
Ringo Mart, a convenience store, sells apple juice.
On the opening day of Ringo Mart, there were A cans of juice in stock in the morning. Snuke buys B cans of juice here every day in the daytime. Then, the manager checks the number of cans of juice ... | instruction | 0 | 86,373 | 16 | 172,746 |
"Correct Solution:
```
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
import fractions
... | output | 1 | 86,373 | 16 | 172,747 |
Provide a correct Python 3 solution for this coding contest problem.
Ringo Mart, a convenience store, sells apple juice.
On the opening day of Ringo Mart, there were A cans of juice in stock in the morning. Snuke buys B cans of juice here every day in the daytime. Then, the manager checks the number of cans of juice ... | instruction | 0 | 86,374 | 16 | 172,748 |
"Correct Solution:
```
# coding: utf-8
# Your code here!
import fractions
def isok(a,b,c,d):
if a < b or b > d:
print('No')
return
g= fractions.gcd(d, b)
r=((c-a%g)//g)*g+a%g
# print(r)
if r+g-b < 0:
print('No')
else:
print('Yes')
T=int(input())
for _ in ra... | output | 1 | 86,374 | 16 | 172,749 |
Provide a correct Python 3 solution for this coding contest problem.
Ringo Mart, a convenience store, sells apple juice.
On the opening day of Ringo Mart, there were A cans of juice in stock in the morning. Snuke buys B cans of juice here every day in the daytime. Then, the manager checks the number of cans of juice ... | instruction | 0 | 86,375 | 16 | 172,750 |
"Correct Solution:
```
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
import math
import decimal
ctx = decimal.Context(prec=3, rounding=decimal.ROUND_CEILING)
for i in range(int(input())):
a, b, c, d = ma... | output | 1 | 86,375 | 16 | 172,751 |
Provide a correct Python 3 solution for this coding contest problem.
Ringo Mart, a convenience store, sells apple juice.
On the opening day of Ringo Mart, there were A cans of juice in stock in the morning. Snuke buys B cans of juice here every day in the daytime. Then, the manager checks the number of cans of juice ... | instruction | 0 | 86,376 | 16 | 172,752 |
"Correct Solution:
```
T = int(input())
def gcd(a, b):
if a < b:
a, b = b, a
if b == 0:
return 0
while a % b:
a, b = b, a % b
return b
while T:
T -= 1
A, B, C, D = map(int, input().split())
if B > A or B > D:
print("No")
else:
p = A - (A - C + B - 1) // B * B
r = D % B
... | output | 1 | 86,376 | 16 | 172,753 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke arranged N colorful balls in a row. The i-th ball from the left has color c_i and weight w_i.
He can rearrange the balls by performing the following two operations any number of times, in any order:
* Operation 1: Select two balls with the sa... | instruction | 0 | 89,993 | 16 | 179,986 |
"Correct Solution:
```
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9 + 7
N,X,Y = map(int,readline().split())
CW = (tuple(int(x) for x in line.split()) for line in readlines())
C_to_W = [[] for _ in range(N+1)]
for c,w in CW:
C_to_W[c].append(w)
for c in range(N+1):
C_t... | output | 1 | 89,993 | 16 | 179,987 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke arranged N colorful balls in a row. The i-th ball from the left has color c_i and weight w_i.
He can rearrange the balls by performing the following two operations any number of times, in any order:
* Operation 1: Select two balls with the sa... | instruction | 0 | 89,994 | 16 | 179,988 |
"Correct Solution:
```
class Combination:
def __init__(self, n_max, mod=10**9+7):
# O(n_max + log(mod))
self.mod = mod
f = 1
self.fac = fac = [f]
for i in range(1, n_max+1):
f = f * i % mod
fac.append(f)
f = pow(f, mod-2, mod)
self.faci... | output | 1 | 89,994 | 16 | 179,989 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke arranged N colorful balls in a row. The i-th ball from the left has color c_i and weight w_i.
He can rearrange the balls by performing the following two operations any number of times, in any order:
* Operation 1: Select two balls with the sa... | instruction | 0 | 89,995 | 16 | 179,990 |
"Correct Solution:
```
#-----UnionFind-----(0-indexed)
import sys;sys.setrecursionlimit(10**9)
class UnionFind:
def __init__(self,n):
self.n=[-1]*n
self.r=[0]*n
self.siz=n
def find_root(self,x):
if self.n[x]<0:
return x
else:
self.n[x]=self.find_root(self.n[x])
return self.n[x]... | output | 1 | 89,995 | 16 | 179,991 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke arranged N colorful balls in a row. The i-th ball from the left has color c_i and weight w_i.
He can rearrange the balls by performing the following two operations any number of times, in any order:
* Operation 1: Select two balls with the sa... | instruction | 0 | 89,996 | 16 | 179,992 |
"Correct Solution:
```
class UnionFindVerSize():
def __init__(self, N):
self._parent = [n for n in range(0, N)]
self._size = [1] * N
def find_root(self, x):
if self._parent[x] == x: return x
self._parent[x] = self.find_root(self._parent[x])
return self._parent[x]
de... | output | 1 | 89,996 | 16 | 179,993 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke arranged N colorful balls in a row. The i-th ball from the left has color c_i and weight w_i.
He can rearrange the balls by performing the following two operations any number of times, in... | instruction | 0 | 89,997 | 16 | 179,994 |
No | output | 1 | 89,997 | 16 | 179,995 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke arranged N colorful balls in a row. The i-th ball from the left has color c_i and weight w_i.
He can rearrange the balls by performing the following two operations any number of times, in... | instruction | 0 | 89,998 | 16 | 179,996 |
No | output | 1 | 89,998 | 16 | 179,997 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke arranged N colorful balls in a row. The i-th ball from the left has color c_i and weight w_i.
He can rearrange the balls by performing the following two operations any number of times, in... | instruction | 0 | 89,999 | 16 | 179,998 |
No | output | 1 | 89,999 | 16 | 179,999 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke arranged N colorful balls in a row. The i-th ball from the left has color c_i and weight w_i.
He can rearrange the balls by performing the following two operations any number of times, in... | instruction | 0 | 90,000 | 16 | 180,000 |
No | output | 1 | 90,000 | 16 | 180,001 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum of all elements of a is N.
* The sum of all elements of ... | instruction | 0 | 92,516 | 16 | 185,032 |
"Correct Solution:
```
#!/usr/bin/env python3
def solve(n, m, a):
odd = []
even = []
for a_i in a:
if a_i % 2 == 0:
even += [ a_i ]
else:
odd += [ a_i ]
if len(odd) >= 3:
return None
a, b = [], []
if odd:
x = odd.pop()
a += [ x ]
... | output | 1 | 92,516 | 16 | 185,033 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum of all elements of a is N.
* The sum of all elements of ... | instruction | 0 | 92,517 | 16 | 185,034 |
"Correct Solution:
```
S, N = map(int, input().split())
A = list(map(int, input().split()))
O = [a for a in A if a % 2 == 1]
E = [a for a in A if a % 2 == 0]
if len(O) > 2:
print("Impossible")
else:
A = O[:min(len(O), 1)] + E + O[1:]
B = A[:] + ([0] if N == 1 else [])
B[0] -= 1
B[-1] += 1
if B[... | output | 1 | 92,517 | 16 | 185,035 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum of all elements of a is N.
* The sum of all elements of ... | instruction | 0 | 92,518 | 16 | 185,036 |
"Correct Solution:
```
import sys
def solve(n, m, arr):
odds = []
evens = []
for a in arr:
if a % 2 == 0:
evens.append(a)
else:
odds.append(a)
if len(odds) > 2:
print('Impossible')
return
if len(odds) == 2:
o1, o2 = odds
aaa... | output | 1 | 92,518 | 16 | 185,037 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum of all elements of a is N.
* The sum of all elements of ... | instruction | 0 | 92,519 | 16 | 185,038 |
"Correct Solution:
```
from sys import exit
n, m = map(int, input().split())
a = list(map(int, input().split()))
odd = []
even = []
for x in a:
if x%2 == 0:
even.append(x)
else:
odd.append(x)
if n%2 == 0:
if len(odd) > 2:
print("Impossible")
exit()
if len(odd) == 2:
a = [odd[0]] + even + [odd[1]]
b = ... | output | 1 | 92,519 | 16 | 185,039 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum of all elements of a is N.
* The sum of all elements of ... | instruction | 0 | 92,520 | 16 | 185,040 |
"Correct Solution:
```
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=[]
o=[]
for i in a:
if i%2:o.append(i)
else:b.append(i)
if len(o)>2:print("Impossible");exit()
if len(o)==1:b=o+b
elif len(o)==2:b=[o[0]]+b+[o[1]]
ans=[]
for i in range(len(b)):
if i==0:ans.append(b[i]-1)
elif i==len(b)-1:ans... | output | 1 | 92,520 | 16 | 185,041 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum of all elements of a is N.
* The sum of all elements of ... | instruction | 0 | 92,521 | 16 | 185,042 |
"Correct Solution:
```
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
N,M = map(int,readline().split())
A = [int(x) for x in readline().split()]
OD = [x for x in A if x&1]
EV = [x for x in A if not x&1]
if len(OD) >= 3:
print('Impossible')
exit()
if l... | output | 1 | 92,521 | 16 | 185,043 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum of all elements of a is N.
* The sum of all elements of ... | instruction | 0 | 92,522 | 16 | 185,044 |
"Correct Solution:
```
S, N = map(int, input().split())
A = list(map(int, input().split()))
O = [a for a in A if a % 2 == 1]
E = [a for a in A if a % 2 == 0]
if len(O) > 2:
print("Impossible")
else:
A = O[:min(len(O), 1)] + E + O[min(1, len(O)):]
B = A[:] + ([0] if len(A) == 1 else [])
B[0] -= 1
B[... | output | 1 | 92,522 | 16 | 185,045 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum of all elements of a is N.
* The sum of all elements of ... | instruction | 0 | 92,523 | 16 | 185,046 |
"Correct Solution:
```
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
"""
agc001 D
"""
n, m = map(int, input().split())
ali = list(map(int, input().split()))
if m == 1 and ali[0] == 1:
print(1)
print(1)
print(1)
exit()
if m == 1:
print(ali[0])
print(2)
print(ali[0]-1, ... | output | 1 | 92,523 | 16 | 185,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum ... | instruction | 0 | 92,524 | 16 | 185,048 |
Yes | output | 1 | 92,524 | 16 | 185,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum ... | instruction | 0 | 92,525 | 16 | 185,050 |
No | output | 1 | 92,525 | 16 | 185,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum ... | instruction | 0 | 92,526 | 16 | 185,052 |
No | output | 1 | 92,526 | 16 | 185,053 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum ... | instruction | 0 | 92,527 | 16 | 185,054 |
No | output | 1 | 92,527 | 16 | 185,055 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:
* The sum ... | instruction | 0 | 92,528 | 16 | 185,056 |
No | output | 1 | 92,528 | 16 | 185,057 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has a sequence p, which is a permutation of (0,1,2, ...,N-1). The i-th element (0-indexed) in p is p_i.
He can perform N-1 kinds of operations labeled 1,2,...,N-1 any number of times in a... | instruction | 0 | 93,355 | 16 | 186,710 |
No | output | 1 | 93,355 | 16 | 186,711 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has a sequence p, which is a permutation of (0,1,2, ...,N-1). The i-th element (0-indexed) in p is p_i.
He can perform N-1 kinds of operations labeled 1,2,...,N-1 any number of times in a... | instruction | 0 | 93,356 | 16 | 186,712 |
No | output | 1 | 93,356 | 16 | 186,713 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has a sequence p, which is a permutation of (0,1,2, ...,N-1). The i-th element (0-indexed) in p is p_i.
He can perform N-1 kinds of operations labeled 1,2,...,N-1 any number of times in a... | instruction | 0 | 93,357 | 16 | 186,714 |
No | output | 1 | 93,357 | 16 | 186,715 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has a sequence p, which is a permutation of (0,1,2, ...,N-1). The i-th element (0-indexed) in p is p_i.
He can perform N-1 kinds of operations labeled 1,2,...,N-1 any number of times in a... | instruction | 0 | 93,358 | 16 | 186,716 |
No | output | 1 | 93,358 | 16 | 186,717 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.) Snuke... | instruction | 0 | 93,359 | 16 | 186,718 |
"Correct Solution:
```
import math
INF, MOD = float("inf"), 10 ** 9 + 7
MAX, MIN = -INF, INF
dx1, dy1, dx2, dy2 = [-1, 0, 1, 0], [0, -1, 0, 1], [-1, 0, 1, -1, 1, -1, 0, 1], [-1, -1, -1, 0, 0, 1, 1, 1]
def get_int():
return int(input())
def get_int_list():
return list(map(int, input().split()))
def mins(x, y)... | output | 1 | 93,359 | 16 | 186,719 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.) Snuke... | instruction | 0 | 93,360 | 16 | 186,720 |
"Correct Solution:
```
import sys
import math
n, m = (int(i) for i in input().split())
l=abs(n-m)
div=int(10**9+7)
if l>1:
print(0)
sys.exit()
if l==1:
ans=(math.factorial(n)*math.factorial(m))%div
print(ans)
else:
ans=(math.factorial(n)*math.factorial(m)*2)%div
print(ans)
``` | output | 1 | 93,360 | 16 | 186,721 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.) Snuke... | instruction | 0 | 93,361 | 16 | 186,722 |
"Correct Solution:
```
from math import factorial
N, M = map(int, input().split())
ans = factorial(N)*factorial(M)
if abs(N-M) == 1:
print(ans % (10**9+7))
elif N == M:
print((ans*2) % (10**9+7))
else:
print(0)
``` | output | 1 | 93,361 | 16 | 186,723 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.) Snuke... | instruction | 0 | 93,362 | 16 | 186,724 |
"Correct Solution:
```
import math
f=math.factorial
n,m=map(int,input().split())
if abs(n-m)>1:
print("0")
elif abs(n-m)==1:
ans=f(n)*f(m)
ans%=1000000007
print(ans)
else:
ans=f(n)*f(m)
ans*=2;
ans%=1000000007
print(ans)
``` | output | 1 | 93,362 | 16 | 186,725 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.) Snuke... | instruction | 0 | 93,363 | 16 | 186,726 |
"Correct Solution:
```
MOD = 10 ** 9 + 7
def kaijo(n):
k = 1
for i in range(1, n + 1):
k = k * i % MOD
return k
n, m = map(int, input().split())
if n == m:
print((kaijo(n) ** 2 * 2) % MOD)
elif abs(n - m) > 1:
print(0)
else:
print((kaijo(n) * kaijo(m)) % MOD)
``` | output | 1 | 93,363 | 16 | 186,727 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.) Snuke... | instruction | 0 | 93,364 | 16 | 186,728 |
"Correct Solution:
```
n, m = map(int, input().split())
def fac(x):
ans = 1
for i in range(1, x + 1):
ans = (ans * i) % (10 ** 9 + 7)
return(ans)
if n < m:
n, m = m, n
if n - m >= 2:
print(0)
elif n - m == 1:
print((fac(m)) ** 2 * n % (10 ** 9 + 7) )
else:
print((fac(n)) ** 2 * 2 ... | output | 1 | 93,364 | 16 | 186,729 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.) Snuke... | instruction | 0 | 93,365 | 16 | 186,730 |
"Correct Solution:
```
mod = 1000000007
N,M = map(int,input().split())
if abs(N-M)>1:
print(0)
else:
ans = 1
for i in range(1,N+1): ans = (ans*i)%mod
for j in range(1,M+1): ans = (ans*j)%mod
if N==M: ans = (ans*2)%mod
print(ans)
``` | output | 1 | 93,365 | 16 | 186,731 |
Provide a correct Python 3 solution for this coding contest problem.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.) Snuke... | instruction | 0 | 93,366 | 16 | 186,732 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
#ARC076C
import sys
import math
#n=int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
m=hoge[1]
#total=1
#if(n==m):
# total+=1
t = math.factorial(min(n,m))
#print(t)
#print(t**2)
if(abs(n-m)>1):
print(0)
elif(n==m):
print((2*(t**2))... | output | 1 | 93,366 | 16 | 186,733 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and... | instruction | 0 | 93,367 | 16 | 186,734 |
Yes | output | 1 | 93,367 | 16 | 186,735 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and... | instruction | 0 | 93,368 | 16 | 186,736 |
Yes | output | 1 | 93,368 | 16 | 186,737 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and... | instruction | 0 | 93,369 | 16 | 186,738 |
Yes | output | 1 | 93,369 | 16 | 186,739 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and... | instruction | 0 | 93,370 | 16 | 186,740 |
Yes | output | 1 | 93,370 | 16 | 186,741 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and... | instruction | 0 | 93,371 | 16 | 186,742 |
No | output | 1 | 93,371 | 16 | 186,743 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and... | instruction | 0 | 93,372 | 16 | 186,744 |
No | output | 1 | 93,372 | 16 | 186,745 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and... | instruction | 0 | 93,373 | 16 | 186,746 |
No | output | 1 | 93,373 | 16 | 186,747 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and... | instruction | 0 | 93,374 | 16 | 186,748 |
No | output | 1 | 93,374 | 16 | 186,749 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.