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.
There are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves.
In one move, the robot must move one cell to the left or right, provided that it doesn't move o... | instruction | 0 | 25,820 | 15 | 51,640 |
Tags: combinatorics, dp, math
Correct Solution:
```
import sys
input = sys.stdin.buffer.readline
n, k, q = map(int, input().split())
a = list(map(int, input().split()))
MOD = 10**9+7
pcc = [ [1]*n for _ in range(k+1) ]
for i in range(k):
pcc[i+1][0] = pcc[i][1]
pcc[i+1][n-1] = pcc[i][n-2]
for p in range(1... | output | 1 | 25,820 | 15 | 51,641 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves.
In one move, the robot must move one cell to the left or right, provided that it doesn't move o... | instruction | 0 | 25,821 | 15 | 51,642 |
Tags: combinatorics, dp, math
Correct Solution:
```
# ORIGINAL
# mod = 10**9+7
# import sys
# input = sys.stdin.readline
# n, k, q = map(int,input().split())
# a = list(map(int,input().split()))
# dp = [[0 for i in range(k+1)] for i in range(n)]
# for i in range(n):
# dp[i][0] = 1
# for j in range(1, k+1):
# for ... | output | 1 | 25,821 | 15 | 51,643 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves.
In one move, the robot must move one cell to the... | instruction | 0 | 25,822 | 15 | 51,644 |
Yes | output | 1 | 25,822 | 15 | 51,645 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves.
In one move, the robot must move one cell to the... | instruction | 0 | 25,823 | 15 | 51,646 |
Yes | output | 1 | 25,823 | 15 | 51,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves.
In one move, the robot must move one cell to the... | instruction | 0 | 25,824 | 15 | 51,648 |
Yes | output | 1 | 25,824 | 15 | 51,649 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves.
In one move, the robot must move one cell to the... | instruction | 0 | 25,825 | 15 | 51,650 |
Yes | output | 1 | 25,825 | 15 | 51,651 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves.
In one move, the robot must move one cell to the... | instruction | 0 | 25,826 | 15 | 51,652 |
No | output | 1 | 25,826 | 15 | 51,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves.
In one move, the robot must move one cell to the... | instruction | 0 | 25,827 | 15 | 51,654 |
No | output | 1 | 25,827 | 15 | 51,655 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves.
In one move, the robot must move one cell to the... | instruction | 0 | 25,828 | 15 | 51,656 |
No | output | 1 | 25,828 | 15 | 51,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves.
In one move, the robot must move one cell to the... | instruction | 0 | 25,829 | 15 | 51,658 |
No | output | 1 | 25,829 | 15 | 51,659 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every min... | instruction | 0 | 25,920 | 15 | 51,840 |
Tags: greedy
Correct Solution:
```
#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
# from fractions import *
# from heapq import*
from bisect import *
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open('input.txt', 'r')
s... | output | 1 | 25,920 | 15 | 51,841 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every min... | instruction | 0 | 25,921 | 15 | 51,842 |
Tags: greedy
Correct Solution:
```
instr = input()
tmplist = instr.split()
n = (int)(tmplist[0])
lx = [n for i in range(n)]
ly = [n for i in range(n)]
m = (int)(tmplist[1])
for i in range(m):
instr = input()
tmplist = instr.split()
x = (int)(tmplist[0])
y = (int)(tmplist[1])
lx[x-1] -= 1
ly[y... | output | 1 | 25,921 | 15 | 51,843 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every min... | instruction | 0 | 25,922 | 15 | 51,844 |
Tags: greedy
Correct Solution:
```
n, m = map(int, input().split())
used = [1] * 2 * n
for i in range(m):
x, y = map(int, input().split())
used[x - 1] = used[n + y - 1] = 0
if n % 2 and used[n // 2]:
used[n // 2 + n] = 0
res = sum(used)
for i in [0, n - 1, n, 2 * n - 1]:
res -= used[i]
print(res)
``` | output | 1 | 25,922 | 15 | 51,845 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every min... | instruction | 0 | 25,923 | 15 | 51,846 |
Tags: greedy
Correct Solution:
```
n, m = map(int, input().split())
ans = 0
row = [1] * n * 2
for x in range(m):
a, b = [int(x) for x in input().split()]
row[a - 1] = 0
row[b - 1 + n] = 0
for i in range(1, (n + 1) // 2):
j = n - 1 - i
if i == j:
ans += min(1, row[i] + row[i + n])
else:
ans += row[i] + row[j]... | output | 1 | 25,923 | 15 | 51,847 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every min... | instruction | 0 | 25,924 | 15 | 51,848 |
Tags: greedy
Correct Solution:
```
#If FastIO not needed, used this and don't forget to strip
#import sys, math
#input = sys.stdin.readline
import os
import sys
from io import BytesIO, IOBase
import heapq as h
import bisect
from types import GeneratorType
BUFSIZE = 8192
class SortedList:
def __ini... | output | 1 | 25,924 | 15 | 51,849 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every min... | instruction | 0 | 25,925 | 15 | 51,850 |
Tags: greedy
Correct Solution:
```
n,m=map(int,input().split())
a=[0]*(n+1)
b=[0]*(n+1)
for i in range(0,m):
x,y=map(int,input().split())
a[x]=b[y]=1
s=0
for i in range(2,n):
if a[i]==0:s+=1
if b[i]==0:s+=1
if (n%2)and(a[n//2+1]==0)and(b[n//2+1]==0):s-=1
print(s)
``` | output | 1 | 25,925 | 15 | 51,851 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every min... | instruction | 0 | 25,926 | 15 | 51,852 |
Tags: greedy
Correct Solution:
```
#NOT MINE
I=input
n,m=map(int,I().split())
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
r,c=map(int,I().split())
b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))
``` | output | 1 | 25,926 | 15 | 51,853 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every min... | instruction | 0 | 25,927 | 15 | 51,854 |
Tags: greedy
Correct Solution:
```
def solve():
n, m = map(int, input().split())
a = [0 for x in range(n)]
b = [0 for x in range(n)]
for i in range(m):
row, col = map(int, input().split())
row -= 1
col -= 1
a[row] += 1
b[col] += 1
res = 0
for i in range(1,... | output | 1 | 25,927 | 15 | 51,855 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board ... | instruction | 0 | 25,928 | 15 | 51,856 |
Yes | output | 1 | 25,928 | 15 | 51,857 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board ... | instruction | 0 | 25,929 | 15 | 51,858 |
Yes | output | 1 | 25,929 | 15 | 51,859 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board ... | instruction | 0 | 25,930 | 15 | 51,860 |
Yes | output | 1 | 25,930 | 15 | 51,861 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board ... | instruction | 0 | 25,931 | 15 | 51,862 |
Yes | output | 1 | 25,931 | 15 | 51,863 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board ... | instruction | 0 | 25,932 | 15 | 51,864 |
No | output | 1 | 25,932 | 15 | 51,865 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board ... | instruction | 0 | 25,933 | 15 | 51,866 |
No | output | 1 | 25,933 | 15 | 51,867 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board ... | instruction | 0 | 25,934 | 15 | 51,868 |
No | output | 1 | 25,934 | 15 | 51,869 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board ... | instruction | 0 | 25,935 | 15 | 51,870 |
No | output | 1 | 25,935 | 15 | 51,871 |
Provide a correct Python 3 solution for this coding contest problem.
AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical range of [i-1,i] and the horizontal range of [l_i,r_i], as ... | instruction | 0 | 26,357 | 15 | 52,714 |
"Correct Solution:
```
N = int(input())
P = [list(map(int, input().split())) for i in range(N)]
INF = 10**18
from heapq import heappush, heappop
l0, r0 = P[0]
L = [-l0+1]
R = [l0-1]
s = t = 0
res = 0
for i in range(N-1):
l0, r0 = P[i]
l1, r1 = P[i+1]
s += (r1 - l1); t += (r0 - l0)
if -s-L[0] <... | output | 1 | 26,357 | 15 | 52,715 |
Provide a correct Python 3 solution for this coding contest problem.
AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical range of [i-1,i] and the horizontal range of [l_i,r_i], as ... | instruction | 0 | 26,358 | 15 | 52,716 |
"Correct Solution:
```
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heappush, heappushpop
"""
・f(x) = (最上段の左端座標) -> 最小コスト
・g = newf とすると、g(x) = |x-l| + min_{x-w_{n-1}<=y<=x+w_n}f(y)
・常に [A0,B0] 上で定数、[A_i,A_{i-1}]で傾き-i、[B_{i-1},B_... | output | 1 | 26,358 | 15 | 52,717 |
Provide a correct Python 3 solution for this coding contest problem.
AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical range of [i-1,i] and the horizontal range of [l_i,r_i], as ... | instruction | 0 | 26,359 | 15 | 52,718 |
"Correct Solution:
```
import sys
input = sys.stdin.readline
from heapq import heappop, heappush
"""
f(x) = (一番上の長方形の左端がxに来るときのコストの最小値) を関数ごと更新していきたい
更新後をg(x)とする
g(x) = |x-L| + min_{-width_1 \leq t\leq width_2} f(x+t), 前回の幅、今回の幅
常に、区間上で最小値を持ち傾きが1ずつ変わる凸な関数であることが維持される。(区間は1点かも)
傾きが変わる点の集合S_f = S_f_lower + S_f_upperを持ってい... | output | 1 | 26,359 | 15 | 52,719 |
Provide a correct Python 3 solution for this coding contest problem.
AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical range of [i-1,i] and the horizontal range of [l_i,r_i], as ... | instruction | 0 | 26,360 | 15 | 52,720 |
"Correct Solution:
```
# seishin.py
N = int(input())
P = [list(map(int, input().split())) for i in range(N)]
INF = 10**18
from heapq import heappush, heappop
l0, r0 = P[0]
L = [-l0+1]
R = [l0-1]
s = t = 0
res = 0
for i in range(N-1):
l0, r0 = P[i]
l1, r1 = P[i+1]
s += (r1 - l1); t += (r0 - l0)
if -... | output | 1 | 26,360 | 15 | 52,721 |
Provide a correct Python 3 solution for this coding contest problem.
AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical range of [i-1,i] and the horizontal range of [l_i,r_i], as ... | instruction | 0 | 26,361 | 15 | 52,722 |
"Correct Solution:
```
# seishin.py
N = int(input())
P = [list(map(int, input().split())) for i in range(N)]
INF = 10**18
from heapq import heappush, heappop
l0, r0 = P[0]
L = [-l0+1]
R = [l0-1]
s = t = 0
def debug(L, s, t, R):
L0 = L[:]
Q1 = []; Q2 = []
while L0:
Q1.append(-s-heappop(L0))
... | output | 1 | 26,361 | 15 | 52,723 |
Provide a correct Python 3 solution for this coding contest problem.
AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical range of [i-1,i] and the horizontal range of [l_i,r_i], as ... | instruction | 0 | 26,362 | 15 | 52,724 |
"Correct Solution:
```
# seishin.py
N = int(input())
P = [list(map(int, input().split())) for i in range(N)]
from heapq import heappush, heappop
l0, r0 = P[0]
L = [-l0+1]
R = [l0-1]
s = t = 0
res = 0
for i in range(N-1):
l0, r0 = P[i]
l1, r1 = P[i+1]
s += (r1 - l1); t += (r0 - l0)
if -s-L[0] <= l1-1... | output | 1 | 26,362 | 15 | 52,725 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical ran... | instruction | 0 | 26,363 | 15 | 52,726 |
No | output | 1 | 26,363 | 15 | 52,727 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical ran... | instruction | 0 | 26,364 | 15 | 52,728 |
No | output | 1 | 26,364 | 15 | 52,729 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical ran... | instruction | 0 | 26,365 | 15 | 52,730 |
No | output | 1 | 26,365 | 15 | 52,731 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical ran... | instruction | 0 | 26,366 | 15 | 52,732 |
No | output | 1 | 26,366 | 15 | 52,733 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`.
You will a... | instruction | 0 | 27,220 | 15 | 54,440 |
"Correct Solution:
```
n, S = int(input()), input().strip()
scores = [sum(c == 'E' for c in S[1:])]
for i in range(1, n):
scores.append(scores[i-1] + (S[i-1]=='W') - (S[i]=='E'))
print(min(scores))
``` | output | 1 | 27,220 | 15 | 54,441 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`.
You will a... | instruction | 0 | 27,225 | 15 | 54,450 |
"Correct Solution:
```
N=int(input())
S=list(input())
nsums=[0]*N
right =0
for s in S:
if s=='E':right+=1
left =0
min_sum=N
for i in range(N):
if S[i] == 'E':right-=1
nsums[i] = right + left
if S[i]=='W':left+=1
min_sum = min(min_sum,nsums[i])
print(min_sum)
``` | output | 1 | 27,225 | 15 | 54,451 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go to any of the following points in one move:
... | instruction | 0 | 27,397 | 15 | 54,794 |
Tags: math
Correct Solution:
```
n = int(input())
for q in range(n):
x, y, k = map(int, input().split())
if max(x, y) > k:
print(-1)
else:
if 0 == (x + y) % 2:
if k % 2 == max(x, y) % 2:
print(k)
else:
print(k - 2)
else:
... | output | 1 | 27,397 | 15 | 54,795 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go to any of the following points in one move:
... | instruction | 0 | 27,398 | 15 | 54,796 |
Tags: math
Correct Solution:
```
for _ in range(int(input())):
n,m,k=map(int,input().split())
if max(n,m) >k:
print(-1)
continue
ans=0
if (n+m) %2==1:
ans=max(n,m) -1
k-=max(n,m)
if k %2==0:
print(ans+k)
else:
print(ans+k)
else:... | output | 1 | 27,398 | 15 | 54,797 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go to any of the following points in one move:
... | instruction | 0 | 27,399 | 15 | 54,798 |
Tags: math
Correct Solution:
```
for i in range(int(input())):
l = 0
x, y, k = list(map(int, input().split()))
if (x - y) % 2 != 0:
l = 1
across = max(abs(x), abs(y)) - l
k -= max(abs(x), abs(y))
if k < 0 or (across == 0 and k % 2 == 1):
print(-1)
else:
if l == 1:
print(k + max(abs(x), abs(y)) - l)
e... | output | 1 | 27,399 | 15 | 54,799 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go to any of the following points in one move:
... | instruction | 0 | 27,400 | 15 | 54,800 |
Tags: math
Correct Solution:
```
#Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
... | output | 1 | 27,400 | 15 | 54,801 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go to any of the following points in one move:
... | instruction | 0 | 27,401 | 15 | 54,802 |
Tags: math
Correct Solution:
```
num_queries = int(input())
for _ in range(num_queries):
x, y, num_moves = map(abs, map(int, input().split()))
if x > num_moves or y > num_moves:
print('-1')
else:
solution = min(x, y)
x -= solution
y -= solution
distance = x + y
... | output | 1 | 27,401 | 15 | 54,803 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go to any of the following points in one move:
... | instruction | 0 | 27,402 | 15 | 54,804 |
Tags: math
Correct Solution:
```
q = int(input())
for i in range(q):
n, m, k = map(int, input().split())
if max(n, m) > k:
print(-1)
elif (n + m) % 2 == 0:
if n % 2 != k % 2:
print(k - 2)
else:
print(k)
else:
print(k - 1)
``` | output | 1 | 27,402 | 15 | 54,805 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go to any of the following points in one move:
... | instruction | 0 | 27,403 | 15 | 54,806 |
Tags: math
Correct Solution:
```
def solve():
q = int(input())
for i in range(0, q):
query()
def query():
n, m, k = map(int, input().split(' '))
if k < max(n, m):
print(-1)
return
if (n + m) % 2 == 1:
print(k-1)
return
elif (k - max(n, m)) % 2 == 0:
... | output | 1 | 27,403 | 15 | 54,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go to any of the following points in one move:
... | instruction | 0 | 27,404 | 15 | 54,808 |
Tags: math
Correct Solution:
```
q = int(input())
for _ in range(q):
x,y,n = map(int, input().split())
if x < y:
x,y = y,x
if x > n:
print(-1)
continue
if x % 2 != y % 2:
n -= 1
elif x % 2 != n % 2:
n -= 2
print(n)
``` | output | 1 | 27,404 | 15 | 54,809 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go ... | instruction | 0 | 27,405 | 15 | 54,810 |
Yes | output | 1 | 27,405 | 15 | 54,811 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go ... | instruction | 0 | 27,406 | 15 | 54,812 |
Yes | output | 1 | 27,406 | 15 | 54,813 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go ... | instruction | 0 | 27,407 | 15 | 54,814 |
Yes | output | 1 | 27,407 | 15 | 54,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go ... | instruction | 0 | 27,408 | 15 | 54,816 |
Yes | output | 1 | 27,408 | 15 | 54,817 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.