message stringlengths 2 19.9k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 322 108k | cluster float64 15 15 | __index_level_0__ int64 644 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given four different integer points p_1, p_2, p_3 and p_4 on XY grid.
In one step you can choose one of the points p_i and move it in one of four directions by one. In other words, if you have chosen point p_i = (x, y) you can move ... | instruction | 0 | 16,185 | 15 | 32,370 |
Tags: brute force, constructive algorithms, flows, geometry, greedy, implementation, math, ternary search
Correct Solution:
```
t = int(input())
def solvePerm(points):
x1 = [points[0][0], points[1][0]]
segX1 = min(*x1), max(*x1)
x2 = [points[2][0], points[3][0]]
segX2 = min(*x2), max(*x2)
xRang... | output | 1 | 16,185 | 15 | 32,371 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Theseus has just arrived to Crete to fight Minotaur. He found a labyrinth that has a form of a rectangular field of size n × m and consists of blocks of size 1 × 1.
Each block of the labyrinth ... | instruction | 0 | 17,274 | 15 | 34,548 |
No | output | 1 | 17,274 | 15 | 34,549 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Theseus has just arrived to Crete to fight Minotaur. He found a labyrinth that has a form of a rectangular field of size n × m and consists of blocks of size 1 × 1.
Each block of the labyrinth ... | instruction | 0 | 17,275 | 15 | 34,550 |
No | output | 1 | 17,275 | 15 | 34,551 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Theseus has just arrived to Crete to fight Minotaur. He found a labyrinth that has a form of a rectangular field of size n × m and consists of blocks of size 1 × 1.
Each block of the labyrinth ... | instruction | 0 | 17,276 | 15 | 34,552 |
No | output | 1 | 17,276 | 15 | 34,553 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Theseus has just arrived to Crete to fight Minotaur. He found a labyrinth that has a form of a rectangular field of size n × m and consists of blocks of size 1 × 1.
Each block of the labyrinth ... | instruction | 0 | 17,277 | 15 | 34,554 |
No | output | 1 | 17,277 | 15 | 34,555 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on the n× n board. Rows and columns of this board ... | instruction | 0 | 17,827 | 15 | 35,654 |
Tags: constructive algorithms, dfs and similar, graphs, implementation
Correct Solution:
```
from collections import deque
import sys
def input(): return sys.stdin.readline().strip()
def main():
n = int(input())
res = [['' for _ in range(n)] for _ in range(n)]
data = [[None for _ in range(n)] for _ in ra... | output | 1 | 17,827 | 15 | 35,655 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on the n× n board. Rows and columns of this board ... | instruction | 0 | 17,828 | 15 | 35,656 |
Tags: constructive algorithms, dfs and similar, graphs, implementation
Correct Solution:
```
d4i=[0,-1,0,1]
d4j=[-1,0,1,0]
direction=['L','U','R','D']
back=['R','D','L','U']
def main():
# Observations:
# if ri,cj==xi,yj, i,j is x
# if ri,cj==-1,-1, i,j is cycle:
# Steps:
# Mark cy... | output | 1 | 17,828 | 15 | 35,657 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on the n× n board. Rows and columns of this board ... | instruction | 0 | 17,829 | 15 | 35,658 |
Tags: constructive algorithms, dfs and similar, graphs, implementation
Correct Solution:
```
from collections import deque
def problem(m):
def bfs (i, j):
q = deque([ (i, j) ])
while len(q):
i, j = q.popleft()
for a, b, d in [ (i-1, j, 'D'), (i+1, j, 'U'), (i, j-1, 'R'), (i,... | output | 1 | 17,829 | 15 | 35,659 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on the n× n board. Rows and columns of this board ... | instruction | 0 | 17,830 | 15 | 35,660 |
Tags: constructive algorithms, dfs and similar, graphs, implementation
Correct Solution:
```
from collections import deque
import sys
def input(): return sys.stdin.buffer.readline()[:-1]
def main():
n = int(input())
res = [[''] * n for _ in range(n)]
data = [[None] * n for _ in range(n)]
q = deque(... | output | 1 | 17,830 | 15 | 35,661 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on the n× n board. Rows and columns of this board ... | instruction | 0 | 17,831 | 15 | 35,662 |
Tags: constructive algorithms, dfs and similar, graphs, implementation
Correct Solution:
```
n = int(input())
d = [[0] * n for _ in range(n)]
for r in range(n):
nums = list(map(int, input().split()))
i = 0
while i + 1 < 2 * n:
d[r][i // 2] = (nums[i], nums[i + 1])
i += 2
result = [[None] * n... | output | 1 | 17,831 | 15 | 35,663 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on the n× n board. Rows and columns of this board ... | instruction | 0 | 17,832 | 15 | 35,664 |
Tags: constructive algorithms, dfs and similar, graphs, implementation
Correct Solution:
```
import sys
input = iter(sys.stdin.readlines()).__next__
n = int(input())
plans = [[None]*(n+2) for _ in range(n+2)]
blocked = set()
for r in range(1,n+1):
line_iter = map(int, input().split())
for c in range(1,n+1):
... | output | 1 | 17,832 | 15 | 35,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on the n× n board. Rows and columns of this board ... | instruction | 0 | 17,833 | 15 | 35,666 |
Tags: constructive algorithms, dfs and similar, graphs, implementation
Correct Solution:
```
from collections import deque
import sys
def input(): return sys.stdin.buffer.readline()[:-1]
def main():
n = int(input())
res = [[''] * n for _ in range(n)]
data = [[None] * n for _ in range(n)]
q = deque(... | output | 1 | 17,833 | 15 | 35,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on the n× n board. Rows and columns of this board ... | instruction | 0 | 17,834 | 15 | 35,668 |
Tags: constructive algorithms, dfs and similar, graphs, implementation
Correct Solution:
```
from collections import deque
n = int(input())
d = [[0] * n for _ in range(n)]
for r in range(n):
nums = list(map(int, input().split()))
i = 0
while i + 1 < 2 * n:
d[r][i // 2] = (nums[i], nums[i + 1])
... | output | 1 | 17,834 | 15 | 35,669 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on ... | instruction | 0 | 17,835 | 15 | 35,670 |
Yes | output | 1 | 17,835 | 15 | 35,671 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on ... | instruction | 0 | 17,836 | 15 | 35,672 |
Yes | output | 1 | 17,836 | 15 | 35,673 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on ... | instruction | 0 | 17,837 | 15 | 35,674 |
Yes | output | 1 | 17,837 | 15 | 35,675 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on ... | instruction | 0 | 17,838 | 15 | 35,676 |
Yes | output | 1 | 17,838 | 15 | 35,677 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on ... | instruction | 0 | 17,839 | 15 | 35,678 |
No | output | 1 | 17,839 | 15 | 35,679 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on ... | instruction | 0 | 17,840 | 15 | 35,680 |
No | output | 1 | 17,840 | 15 | 35,681 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on ... | instruction | 0 | 17,841 | 15 | 35,682 |
No | output | 1 | 17,841 | 15 | 35,683 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on ... | instruction | 0 | 17,842 | 15 | 35,684 |
No | output | 1 | 17,842 | 15 | 35,685 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
Consider an n by n chessboard. Its rows are num... | instruction | 0 | 17,901 | 15 | 35,802 |
Tags: constructive algorithms, dfs and similar, greedy, implementation
Correct Solution:
```
n=int(input())
arr=[]
diag=[int(x) for x in input().split()]
for i in range(n):
temp=[0 for x in range(i+1)]
temp[i]=diag[i]
arr.append(temp)
for i in range(n):
c=diag[i]
val=c
arr[i][i]=0
j=i
temp=i
while (c>0):
... | output | 1 | 17,901 | 15 | 35,803 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
Consider an n by n chessboard. Its rows are num... | instruction | 0 | 17,902 | 15 | 35,804 |
Tags: constructive algorithms, dfs and similar, greedy, implementation
Correct Solution:
```
#Collaborated with no one
# Problem C
ans = []
n=int(input())
cells = [int(x) for x in input().split(" ")]
for i in range(n):
ans.append([-1]*n)
for i in range(n):
ans[i][i] = cells[i]
amount = cells[i]-1
x = i - 1
y =... | output | 1 | 17,902 | 15 | 35,805 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
Consider an n by n chessboard. Its rows are num... | instruction | 0 | 17,903 | 15 | 35,806 |
Tags: constructive algorithms, dfs and similar, greedy, implementation
Correct Solution:
```
def ii():
return int(input())
def li():
return [int(i) for i in input().split()]
for t in range(1):
n = ii()
p = li()
ans = [ [-1 for j in range(n)] for i in range(n)]
for index in range(n):
... | output | 1 | 17,903 | 15 | 35,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
Consider an n by n chessboard. Its rows are num... | instruction | 0 | 17,904 | 15 | 35,808 |
Tags: constructive algorithms, dfs and similar, greedy, implementation
Correct Solution:
```
'''Author- Akshit Monga'''
from sys import stdin, stdout
input = stdin.readline
def f():
global mat,val,i
x=i
y=i
# print()
# print(x,y)
for k in range(val-1):
# print(x,y,k,val)
if x!=0... | output | 1 | 17,904 | 15 | 35,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
Consider an n by n chessboard. Its rows are num... | instruction | 0 | 17,905 | 15 | 35,810 |
Tags: constructive algorithms, dfs and similar, greedy, implementation
Correct Solution:
```
import os,sys,math
from io import BytesIO, IOBase
from collections import defaultdict,deque,OrderedDict
import bisect as bi
def yes():print('YES')
def no():print('NO')
def I():return (int(input()))
def In():return(map(int,inpu... | output | 1 | 17,905 | 15 | 35,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
Consider an n by n chessboard. Its rows are num... | instruction | 0 | 17,906 | 15 | 35,812 |
Tags: constructive algorithms, dfs and similar, greedy, implementation
Correct Solution:
```
import sys;input=sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
bo = []
for i in range(n):
temp = [0 for _ in range(i)]
temp.append(a[i])
bo.append(temp)
flag = 1
for i in range(n):
key = bo[i][i... | output | 1 | 17,906 | 15 | 35,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
Consider an n by n chessboard. Its rows are num... | instruction | 0 | 17,907 | 15 | 35,814 |
Tags: constructive algorithms, dfs and similar, greedy, implementation
Correct Solution:
```
import sys
import os.path
from collections import *
import math
import bisect
if (os.path.exists('input.txt')):
sys.stdin = open("input.txt", "r")
sys.stdout = open("output.txt", "w")
############## Code starts here #... | output | 1 | 17,907 | 15 | 35,815 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
Consider an n by n chessboard. Its rows are num... | instruction | 0 | 17,908 | 15 | 35,816 |
Tags: constructive algorithms, dfs and similar, greedy, implementation
Correct Solution:
```
import sys
input = sys.stdin.readline
def I():return input().strip()
def II():return int(input().strip())
def LI():return [*map(int,input().strip().split())]
import string, math, time, functools, random, fractions
from heapq im... | output | 1 | 17,908 | 15 | 35,817 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
... | instruction | 0 | 17,909 | 15 | 35,818 |
Yes | output | 1 | 17,909 | 15 | 35,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
... | instruction | 0 | 17,910 | 15 | 35,820 |
Yes | output | 1 | 17,910 | 15 | 35,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
... | instruction | 0 | 17,911 | 15 | 35,822 |
Yes | output | 1 | 17,911 | 15 | 35,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
... | instruction | 0 | 17,912 | 15 | 35,824 |
Yes | output | 1 | 17,912 | 15 | 35,825 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
... | instruction | 0 | 17,913 | 15 | 35,826 |
No | output | 1 | 17,913 | 15 | 35,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
... | instruction | 0 | 17,914 | 15 | 35,828 |
No | output | 1 | 17,914 | 15 | 35,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
... | instruction | 0 | 17,915 | 15 | 35,830 |
No | output | 1 | 17,915 | 15 | 35,831 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fillomino is a classic logic puzzle. (You do not need to know Fillomino in order to solve this problem.) In one classroom in Yunqi town, some volunteers are playing a board game variant of it:
... | instruction | 0 | 17,916 | 15 | 35,832 |
No | output | 1 | 17,916 | 15 | 35,833 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.
In each operation, ... | instruction | 0 | 17,917 | 15 | 35,834 |
Tags: combinatorics, math
Correct Solution:
```
# region fastio # from https://codeforces.com/contest/1333/submission/75948789
import sys, io, os
BUFSIZE = 8192
class FastIO(io.IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = io.BytesIO()
self.w... | output | 1 | 17,917 | 15 | 35,835 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.
In each operation, ... | instruction | 0 | 17,918 | 15 | 35,836 |
Tags: combinatorics, math
Correct Solution:
```
import sys
from sys import stdin
def modfac(n, MOD):
f = 1
factorials = [1]
for m in range(1, n + 1):
f *= m
f %= MOD
factorials.append(f)
inv = pow(f, MOD - 2, MOD)
invs = [1] * (n + 1)
invs[n] = inv
for m in range(n... | output | 1 | 17,918 | 15 | 35,837 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.
In each operation, ... | instruction | 0 | 17,919 | 15 | 35,838 |
Tags: combinatorics, math
Correct Solution:
```
from sys import stdin, stdout
import heapq
from collections import defaultdict
import math
import bisect
import io, os
# for interactive problem
# n = int(stdin.readline())
# print(x, flush=True)
#input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
def ncr(n, ... | output | 1 | 17,919 | 15 | 35,839 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.
In each operation, ... | instruction | 0 | 17,920 | 15 | 35,840 |
Tags: combinatorics, math
Correct Solution:
```
import sys
input = sys.stdin.readline
t = int(input())
mod = 998244353
l = 114514
fact = [1] * (l + 1)
for i in range(1, l + 1):
fact[i] = i * fact[i - 1] % mod
inv = [1] * (l + 1)
inv[l] = pow(fact[l], mod - 2, mod)
for i in range(l - 1, -1, -1):
inv[i] = (i + ... | output | 1 | 17,920 | 15 | 35,841 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.
In each operation, ... | instruction | 0 | 17,921 | 15 | 35,842 |
Tags: combinatorics, math
Correct Solution:
```
def ncr(n,r,p):
num,den=1,1
for i in range(r):
num=(num*(n-i))%p
den=(den*(i+1))%p
return (num*pow(den,p-2,p))%p
p=998244353
t=int(input())
for i in range(t):
n=int(input())
zoz=input()
z=zoz.count("0")
k=0
j=1
whi... | output | 1 | 17,921 | 15 | 35,843 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.
In each operation, ... | instruction | 0 | 17,922 | 15 | 35,844 |
Tags: combinatorics, math
Correct Solution:
```
mod = 998244353
eps = 10**-9
def main():
import sys
input = sys.stdin.readline
# comb init
nmax = 10 ** 5 + 10 # change here
fac = [0] * nmax
finv = [0] * nmax
inv = [0] * nmax
fac[0] = 1
fac[1] = 1
finv[0] = 1
finv[1] = 1
... | output | 1 | 17,922 | 15 | 35,845 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.
In each operation, ... | instruction | 0 | 17,923 | 15 | 35,846 |
Tags: combinatorics, math
Correct Solution:
```
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
from bisect import bisect_left as lowe... | output | 1 | 17,923 | 15 | 35,847 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied.
In each operation, ... | instruction | 0 | 17,924 | 15 | 35,848 |
Tags: combinatorics, math
Correct Solution:
```
import sys
input=sys.stdin.buffer.readline
mod=998244353
def cmb(n,r):
if r<0 or r>n:
return 0
return (g1[n]*g2[r]*g2[n-r])%mod
N=300000
g1=[1]*(N+3)
for i in range(2,N+3):
g1[i]=g1[i-1]*i%mod
g2=[0]*len(g1)
g2[-1]=pow(g1[-1],mod-2,mod)
for i in range(N+1,-1,-... | output | 1 | 17,924 | 15 | 35,849 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and o... | instruction | 0 | 17,925 | 15 | 35,850 |
Yes | output | 1 | 17,925 | 15 | 35,851 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and o... | instruction | 0 | 17,926 | 15 | 35,852 |
Yes | output | 1 | 17,926 | 15 | 35,853 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and o... | instruction | 0 | 17,927 | 15 | 35,854 |
Yes | output | 1 | 17,927 | 15 | 35,855 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and o... | instruction | 0 | 17,928 | 15 | 35,856 |
Yes | output | 1 | 17,928 | 15 | 35,857 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Cirno gave AquaMoon a chessboard of size 1 × n. Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and o... | instruction | 0 | 17,929 | 15 | 35,858 |
No | output | 1 | 17,929 | 15 | 35,859 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.