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.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 × 8 table. A field is represente... | instruction | 0 | 322 | 15 | 644 |
Tags: graphs, math, shortest paths
Correct Solution:
```
def nrook(r1, c1, r2, c2):
if r1 == r2 or c1 == c2: return 1
return 2
def nking(r1, c1, r2, c2):
dr = abs(r1 - r2)
dc = abs(c1 - c2)
return dr + dc - min(dr, dc)
def iswhite(r, c):
return c % 2 != 0 if r % 2 else c % 2 == 0
def nbish... | output | 1 | 322 | 15 | 645 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 × 8 table. A field is represente... | instruction | 0 | 323 | 15 | 646 |
Tags: graphs, math, shortest paths
Correct Solution:
```
x1,y1,x2,y2 = list(map(int,input().split()))
arr = [min(abs(x1-x2),1) + min(abs(y1-y2),1),(1 if abs(x1-x2) == abs(y1-y2) else 2) if (x1&1^y1&1)==(x2&1^y2&1) else 0,max(abs(y2-y1),abs(x2-x1))]
print(*arr)
``` | output | 1 | 323 | 15 | 647 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 × 8 table. A field is represente... | instruction | 0 | 324 | 15 | 648 |
Tags: graphs, math, shortest paths
Correct Solution:
```
a = list(map(int, input().split()))
y1 = a[0]
d1 = a[1]
y2 = a[2]
d2 = a[3]
yatay = abs(y1 - y2)#0
dikey = abs(d1 - d2)#1
a = [0, 0 , 0]
# kale fil şah
if yatay == 0 or dikey == 0:
a[0] = 1
else:
a[0] = 2
if ((y1+d1) % 2) == ((y2+d2) % 2):
if yatay ... | output | 1 | 324 | 15 | 649 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 × 8 table. A field is represente... | instruction | 0 | 325 | 15 | 650 |
Tags: graphs, math, shortest paths
Correct Solution:
```
__author__ = 'Esfandiar and HajLorenzo'
a=list(map(int,input().split()))
res = 2
res-= a[0]==a[2]
res-= a[1]==a[3]
print(res,end=" ")
res=2
black1 = (a[0]+a[1]) % 2 != 0
black2 = (a[2]+a[3]) % 2 != 0
if black1 != black2 or (a[0] == a[2] and a[1] == a[3]):
pri... | output | 1 | 325 | 15 | 651 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 × 8 table. A field is represente... | instruction | 0 | 326 | 15 | 652 |
Tags: graphs, math, shortest paths
Correct Solution:
```
sx,sy,ex,ey=map(int,input().split())
rook=1 if sx==ex or sy==ey else 2
bishop=0
if abs(sx-ex)==abs(sy-ey): bishop=1
elif (sx+sy)%2==(ex+ey)%2: bishop=2
king=max(abs(sx-ex),abs(sy-ey))
print(rook,bishop,king)
``` | output | 1 | 326 | 15 | 653 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 × 8 table. A field is represente... | instruction | 0 | 327 | 15 | 654 |
Tags: graphs, math, shortest paths
Correct Solution:
```
pos = input()
c1 = int(pos.split()[0])
r1 = int(pos.split()[1])
c2 = int(pos.split()[2])
r2 = int(pos.split()[3])
def rook():
if c1 == c2 or r1==r2:
return 1
else :
return 2
def bishop():
if (c1+r1)%2 == (c2+r2)%2:
if (c1-r1) == (c2-r2) or (c1+r1) =... | output | 1 | 327 | 15 | 655 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 × 8 table. A field is represente... | instruction | 0 | 328 | 15 | 656 |
Tags: graphs, math, shortest paths
Correct Solution:
```
from math import ceil
d = {"r":0,"b":0,"k":0}
r1,c1,r2,c2 = map(int,input().split())
if r1 != r2:
d["r"] = d["r"] + 1
if c1 != c2:
d["r"] = d["r"] + 1
if (abs(r1-r2)+abs(c1-c2))%2 == 1:
d["b"] = 0
elif c1-c2 != 0 and (r1-r2)/(c1-c2) == -1 or c1-c2 != 0 and (r... | output | 1 | 328 | 15 | 657 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 × 8 table. A field is represente... | instruction | 0 | 329 | 15 | 658 |
Tags: graphs, math, shortest paths
Correct Solution:
```
r1,c1,r2,c2=map(int,input().split())
def f():
if abs(r1-r2)==abs(c1-c2):
return 1
elif (r1+c1)%2==(c2+r2)%2:
return 2
else:
return 0
def k():
dx=abs(r1-r2)
dy=abs(c1-c2)
return max(dx,dy)
def r():
if r1==r2 o... | output | 1 | 329 | 15 | 659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organ... | instruction | 0 | 330 | 15 | 660 |
Yes | output | 1 | 330 | 15 | 661 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organ... | instruction | 0 | 331 | 15 | 662 |
Yes | output | 1 | 331 | 15 | 663 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organ... | instruction | 0 | 332 | 15 | 664 |
Yes | output | 1 | 332 | 15 | 665 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organ... | instruction | 0 | 333 | 15 | 666 |
Yes | output | 1 | 333 | 15 | 667 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organ... | instruction | 0 | 334 | 15 | 668 |
No | output | 1 | 334 | 15 | 669 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organ... | instruction | 0 | 335 | 15 | 670 |
No | output | 1 | 335 | 15 | 671 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organ... | instruction | 0 | 336 | 15 | 672 |
No | output | 1 | 336 | 15 | 673 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organ... | instruction | 0 | 337 | 15 | 674 |
No | output | 1 | 337 | 15 | 675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on... | instruction | 0 | 359 | 15 | 718 |
Tags: greedy, hashing, implementation
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
def main():
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
lst = [0]*(2*n-1)
for i in range(n):
for j i... | output | 1 | 359 | 15 | 719 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on... | instruction | 0 | 360 | 15 | 720 |
Tags: greedy, hashing, implementation
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not... | output | 1 | 360 | 15 | 721 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on... | instruction | 0 | 361 | 15 | 722 |
Tags: greedy, hashing, implementation
Correct Solution:
```
#Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections imp... | output | 1 | 361 | 15 | 723 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on... | instruction | 0 | 362 | 15 | 724 |
Tags: greedy, hashing, implementation
Correct Solution:
```
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
# from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from... | output | 1 | 362 | 15 | 725 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on... | instruction | 0 | 363 | 15 | 726 |
Tags: greedy, hashing, implementation
Correct Solution:
```
from sys import stdin
input = stdin.buffer.readline
from collections import defaultdict as dd
I = lambda : list(map(int,input().split()))
n,=I()
l=[];d=dd(int);su=dd(int);s=0;an=[1,1,2,1]
for i in range(n):
l.append(I())
for j in range(n):
d[i-j]+=l[i][j]... | output | 1 | 363 | 15 | 727 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on... | instruction | 0 | 364 | 15 | 728 |
Tags: greedy, hashing, implementation
Correct Solution:
```
import sys
input=sys.stdin.buffer.readline
t=1
for __ in range(t):
a=[]
n=int(input())
for i in range(n):
b=list(map(int,input().split()))
a.append(b)
dr={}
di={}
for i in range(n):
for j in range(n):
... | output | 1 | 364 | 15 | 729 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on... | instruction | 0 | 365 | 15 | 730 |
Tags: greedy, hashing, implementation
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
def main():
pass
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.w... | output | 1 | 365 | 15 | 731 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on... | instruction | 0 | 366 | 15 | 732 |
Tags: greedy, hashing, implementation
Correct Solution:
```
from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
from math import inf
def main():
# a bishop has to be on a cell intercepted by even diagonals,
# and another on a cell intercepted by odd diagonals
... | output | 1 | 366 | 15 | 733 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number writt... | instruction | 0 | 367 | 15 | 734 |
Yes | output | 1 | 367 | 15 | 735 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number writt... | instruction | 0 | 368 | 15 | 736 |
Yes | output | 1 | 368 | 15 | 737 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number writt... | instruction | 0 | 369 | 15 | 738 |
Yes | output | 1 | 369 | 15 | 739 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number writt... | instruction | 0 | 370 | 15 | 740 |
Yes | output | 1 | 370 | 15 | 741 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number writt... | instruction | 0 | 371 | 15 | 742 |
No | output | 1 | 371 | 15 | 743 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number writt... | instruction | 0 | 372 | 15 | 744 |
No | output | 1 | 372 | 15 | 745 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number writt... | instruction | 0 | 373 | 15 | 746 |
No | output | 1 | 373 | 15 | 747 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.
He has a n × n chessboard. Each cell of the chessboard has a number writt... | instruction | 0 | 374 | 15 | 748 |
No | output | 1 | 374 | 15 | 749 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board... | instruction | 0 | 412 | 15 | 824 |
Tags: games
Correct Solution:
```
n, m, k = [int(i) for i in input().split()]
flag = False
for j in range(k):
x, y = [int(z) for z in input().split()]
flag |= x < 6 or n - x < 5
flag |= y < 6 or m - y < 5
if flag:
print("YES")
else:
print("NO")
``` | output | 1 | 412 | 15 | 825 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board... | instruction | 0 | 413 | 15 | 826 |
Tags: games
Correct Solution:
```
n, m, k = [int(x) for x in input().split()]
canwin = False
for i in range(k):
x, y = [int(x) for x in input().split()]
canwin |= x < 6 or n - x < 5
canwin |= y < 6 or m - y < 5
print("YES" if canwin else "NO")
``` | output | 1 | 413 | 15 | 827 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board... | instruction | 0 | 414 | 15 | 828 |
Tags: games
Correct Solution:
```
n, m, k = map(int, input().split())
win = False
for i in range(k):
r, c = map(int, input().split())
dr = min(r - 1, n - r)
dc = min(c - 1, m - c)
if dr <= 4 or dc <= 4:
win = True
print("YES" if win else "NO")
``` | output | 1 | 414 | 15 | 829 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board... | instruction | 0 | 415 | 15 | 830 |
Tags: games
Correct Solution:
```
[n,m,k]=[int(i) for i in input().split()]
isDone=False
for i in range(0,k):
[x,y]=[int(i) for i in input().split()]
if x<=5 or x>n-5 or y<=5 or y>m-5:
isDone=True
if isDone:
print("YES")
else:
print("NO")
``` | output | 1 | 415 | 15 | 831 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board... | instruction | 0 | 416 | 15 | 832 |
Tags: games
Correct Solution:
```
n, m, k = map(int, input().split())
win = False
for i in range(k):
x, y = map(int, input().split())
if abs(x - 1) <= 4 or abs(y - 1) <= 4 or \
abs(n - x) <= 4 or abs(m - y) <= 4:
win = True
print('YES' if win else 'NO')
``` | output | 1 | 416 | 15 | 833 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board... | instruction | 0 | 417 | 15 | 834 |
Tags: games
Correct Solution:
```
n,m,k=list(map(int,input().split()))
for i in range(k):
x,y=list(map(int,input().split()))
if min(x,n-x+1,y,m-y+1)<6:
print('YES')
break
else:
print('NO')
``` | output | 1 | 417 | 15 | 835 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board... | instruction | 0 | 418 | 15 | 836 |
Tags: games
Correct Solution:
```
n, m, k = map( int , input().split() )
flag = False
while k > 0:
k -= 1
x, y = map( int , input().split() )
d = min( x , n - x + 1 , y , m - y + 1 )
if d <= 5: flag = True
print( "YES" if flag else "NO" )
``` | output | 1 | 418 | 15 | 837 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board... | instruction | 0 | 419 | 15 | 838 |
Tags: games
Correct Solution:
```
n, m, k = [int(x) for x in input().split()]
canwin = False
for i in range(k):
x, y = [int(x) for x in input().split()]
canwin |= x < 6 or n - x < 5
canwin |= y < 6 or m - y < 5
print("YES" if canwin else "NO")
# Made By Mostafa_Khaled
``` | output | 1 | 419 | 15 | 839 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the b... | instruction | 0 | 420 | 15 | 840 |
Yes | output | 1 | 420 | 15 | 841 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the b... | instruction | 0 | 421 | 15 | 842 |
No | output | 1 | 421 | 15 | 843 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the b... | instruction | 0 | 422 | 15 | 844 |
No | output | 1 | 422 | 15 | 845 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the b... | instruction | 0 | 423 | 15 | 846 |
No | output | 1 | 423 | 15 | 847 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Volodya and Vlad play the following game. There are k pies at the cells of n × m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the b... | instruction | 0 | 424 | 15 | 848 |
No | output | 1 | 424 | 15 | 849 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let us consider a grid of squares with N rows and N columns. Arbok has cut out some part of the grid so that, for each i = 1, 2, \ldots, N, the bottommost h_i squares are remaining in the i-th c... | instruction | 0 | 574 | 15 | 1,148 |
No | output | 1 | 574 | 15 | 1,149 |
Provide a correct Python 3 solution for this coding contest problem.
We have a large square grid with H rows and W columns. Iroha is now standing in the top-left cell. She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell.
However, she cannot enter the cells in the intersec... | instruction | 0 | 671 | 15 | 1,342 |
"Correct Solution:
```
H, W, A, B = map(int, input().split())
P = 10**9+7
fa = [1]
for i in range(1, 202020):
fa.append(fa[-1] * i % P)
fainv = [pow(fa[-1], P-2, P)]
for i in range(1, 202020)[::-1]:
fainv.append(fainv[-1] * i % P)
fainv = fainv[::-1]
calc = lambda a, b: fa[a+b] * fainv[a] * fainv[b] % P
ans =... | output | 1 | 671 | 15 | 1,343 |
Provide a correct Python 3 solution for this coding contest problem.
We have a large square grid with H rows and W columns. Iroha is now standing in the top-left cell. She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell.
However, she cannot enter the cells in the intersec... | instruction | 0 | 672 | 15 | 1,344 |
"Correct Solution:
```
def solve():
h,w,a,b = map(int, input().split())
mx = max(h,w)
mod = 10**9+7
fac = [1]*(h+w+1)
for i in range(1,h+w+1):
fac[i] = fac[i-1]*i%mod
inv = [1]*(mx+1)
inv[-1] = pow(fac[mx], mod-2, mod)
for i in range(mx-1, -1, -1):
inv[i] = inv[i+1]*(i+1)%mod
const = inv[h-a-1]*inv[a-1]%mo... | output | 1 | 672 | 15 | 1,345 |
Provide a correct Python 3 solution for this coding contest problem.
We have a large square grid with H rows and W columns. Iroha is now standing in the top-left cell. She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell.
However, she cannot enter the cells in the intersec... | instruction | 0 | 673 | 15 | 1,346 |
"Correct Solution:
```
from sys import exit
from itertools import count
def read():
return [int(x) for x in input().split()]
P = 10**9 + 7
def inv(x):
return pow(x, P-2, P)
def comb(n, r):
res = 1
for i in range(r):
res = (res * (n-i) * inv(i+1)) % P
return res
(H, W, A, B) = read()
result = 0
c1 =... | output | 1 | 673 | 15 | 1,347 |
Provide a correct Python 3 solution for this coding contest problem.
We have a large square grid with H rows and W columns. Iroha is now standing in the top-left cell. She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell.
However, she cannot enter the cells in the intersec... | instruction | 0 | 674 | 15 | 1,348 |
"Correct Solution:
```
def inpl(): return [int(i) for i in input().split()]
mod = 10**9+7
H, W, A, B = inpl()
fac = [1 for _ in range(H+W-1)]
for i in range(H+W-2):
fac[i+1] = (i+1)*fac[i]%mod
inv = [1 for _ in range(H+W-1)]
for i in range(2,H+W-2):
inv[i] = (-(mod//i) * inv[mod%i]) %mod
facinv = [1 for ... | output | 1 | 674 | 15 | 1,349 |
End of preview. Expand in Data Studio
- Downloads last month
- 8