message stringlengths 2 28.7k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 21 109k | cluster float64 7 7 | __index_level_0__ int64 42 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can be decorated if... | instruction | 0 | 59,217 | 7 | 118,434 |
Tags: greedy
Correct Solution:
```
def main():
from bisect import bisect_left as bl, bisect_right as br, insort
import sys,math
#from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque
def data(): return sys.stdin.readline().strip()
def mdata(): return list... | output | 1 | 59,217 | 7 | 118,435 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can be decorated if... | instruction | 0 | 59,218 | 7 | 118,436 |
Tags: greedy
Correct Solution:
```
l = [int(x) for x in input().split()]
l.sort()
s = sum(l)
a = int(s/3)
s-=l[2]
if(s<a):
print(s)
else:
print(a)
``` | output | 1 | 59,218 | 7 | 118,437 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can be decorated if... | instruction | 0 | 59,219 | 7 | 118,438 |
Tags: greedy
Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(... | output | 1 | 59,219 | 7 | 118,439 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What... | instruction | 0 | 59,220 | 7 | 118,440 |
Yes | output | 1 | 59,220 | 7 | 118,441 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What... | instruction | 0 | 59,221 | 7 | 118,442 |
Yes | output | 1 | 59,221 | 7 | 118,443 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What... | instruction | 0 | 59,222 | 7 | 118,444 |
Yes | output | 1 | 59,222 | 7 | 118,445 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What... | instruction | 0 | 59,223 | 7 | 118,446 |
Yes | output | 1 | 59,223 | 7 | 118,447 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What... | instruction | 0 | 59,224 | 7 | 118,448 |
No | output | 1 | 59,224 | 7 | 118,449 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What... | instruction | 0 | 59,225 | 7 | 118,450 |
No | output | 1 | 59,225 | 7 | 118,451 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What... | instruction | 0 | 59,226 | 7 | 118,452 |
No | output | 1 | 59,226 | 7 | 118,453 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What... | instruction | 0 | 59,227 | 7 | 118,454 |
No | output | 1 | 59,227 | 7 | 118,455 |
Provide a correct Python 3 solution for this coding contest problem.
You have a cross-section paper with W x H squares, and each of them is painted either in white or black. You want to re-arrange the squares into a neat checkered pattern, in which black and white squares are arranged alternately both in horizontal an... | instruction | 0 | 59,609 | 7 | 119,218 |
"Correct Solution:
```
def solve():
w, h = map(int, input().split())
base = list(map(int, input().split()))
if abs(2 * base.count(0) - w) >= 2:
return False
same = 1
for _ in range(h - 1):
line = list(map(int, input().split()))
flag = (base[0] == line[0])
same += flag
if flag and line !... | output | 1 | 59,609 | 7 | 119,219 |
Provide a correct Python 3 solution for this coding contest problem.
You have a cross-section paper with W x H squares, and each of them is painted either in white or black. You want to re-arrange the squares into a neat checkered pattern, in which black and white squares are arranged alternately both in horizontal an... | instruction | 0 | 59,610 | 7 | 119,220 |
"Correct Solution:
```
is_ok = True
W, H = [int(i) for i in input().split()]
matrix = list()
for _ in range(H):
matrix.append([i for i in input().split()])
up = matrix[0]
not_up = [str(int(not int(i))) for i in up]
if abs(up.count("0") * 2 - W) >= 2:
is_ok = False
same = 1
for line in matrix[1:]:
if u... | output | 1 | 59,610 | 7 | 119,221 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a square board, consisting of n rows and n columns. Each tile in it should be colored either white or black.
Let's call some coloring beautiful if each pair of adjacent rows are either the same or different in every position. ... | instruction | 0 | 59,734 | 7 | 119,468 |
Tags: combinatorics, dp, math
Correct Solution:
```
import sys
from array import array # noqa: F401
def readline(): return sys.stdin.buffer.readline().decode('utf-8')
n, k = map(int, readline().split())
mod = 998244353
if k == 1:
print(0)
exit()
dp1 = [array('i', [0])*n for _ in range(n)]
dp2 = [array('... | output | 1 | 59,734 | 7 | 119,469 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a square board, consisting of n rows and n columns. Each tile in it should be colored either white or black.
Let's call some coloring beautiful if each pair of adjacent rows are either the same or different in every position. ... | instruction | 0 | 59,735 | 7 | 119,470 |
Tags: combinatorics, dp, math
Correct Solution:
```
def norm(x):
return (x % 998244353 + 998244353) % 998244353
n, k = map(int, input().split())
dp1 = [0]
dp2 = [0]
for i in range(n):
l = [1]
cur = 0
for j in range(n + 1):
cur += l[j]
if(j > i):
cur -= l[j - i - 1]
... | output | 1 | 59,735 | 7 | 119,471 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light at his office to change every day. That's why h... | instruction | 0 | 59,964 | 7 | 119,928 |
Tags: binary search, brute force, chinese remainder theorem, math, number theory
Correct Solution:
```
mod = 1000000007
eps = 10**-9
def main():
import sys
from math import gcd
input = sys.stdin.readline
# ax + by == gcd(a, b) となるx, yを返す
# gcd(a, b) > 0ということにしてます
def extgcd(a, b):
if ... | output | 1 | 59,964 | 7 | 119,929 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light at his office to change every day. That's why h... | instruction | 0 | 59,965 | 7 | 119,930 |
Tags: binary search, brute force, chinese remainder theorem, math, number theory
Correct Solution:
```
import math
def solve(n, m, k, a, b):
d = math.gcd(n, m)
x = 0
y = 0
for i in range(1, m):
if (i * n - d) % m == 0:
x = i
y = (i * n - d) // m
if y == 0:
... | output | 1 | 59,965 | 7 | 119,931 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light at his office to change every day. That's why h... | instruction | 0 | 59,966 | 7 | 119,932 |
Tags: binary search, brute force, chinese remainder theorem, math, number theory
Correct Solution:
```
import sys
input = sys.stdin.readline
from math import gcd
import bisect
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
def Ext_Euc(a,b,axy=(1,0),bxy=(0,1)):
q,r... | output | 1 | 59,966 | 7 | 119,933 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light at his office to change every day. That's why h... | instruction | 0 | 59,967 | 7 | 119,934 |
Tags: binary search, brute force, chinese remainder theorem, math, number theory
Correct Solution:
```
import sys, os
if os.environ['USERNAME']=='kissz':
inp=open('in5.txt','r').readline
def debug(*args):
print(*args,file=sys.stderr)
else:
inp=sys.stdin.readline
def debug(*args):
pa... | output | 1 | 59,967 | 7 | 119,935 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light at his office to change every day. That's why h... | instruction | 0 | 59,968 | 7 | 119,936 |
Tags: binary search, brute force, chinese remainder theorem, math, number theory
Correct Solution:
```
import sys
sys.setrecursionlimit(10**5)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def MI(): return map(int, sys.stdin.buffer.readline().split())
d... | output | 1 | 59,968 | 7 | 119,937 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light at his office to change every day. That's why h... | instruction | 0 | 59,969 | 7 | 119,938 |
Tags: binary search, brute force, chinese remainder theorem, math, number theory
Correct Solution:
```
import sys
readline = sys.stdin.readline
def gcd(a, b):
while b:
a, b = b, a%b
return a
def lcm(a, b):
return a*b//gcd(a, b)
def egcd(a, b):
if a == 0:
return b, 0, 1
else:
... | output | 1 | 59,969 | 7 | 119,939 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light at his office to change every day. That's why h... | instruction | 0 | 59,970 | 7 | 119,940 |
Tags: binary search, brute force, chinese remainder theorem, math, number theory
Correct Solution:
```
def main():
n, m, k = list(map(lambda x: int(x), str(input()).split(' ')))
a = list(map(lambda x: int(x), str(input()).split(' ')))
b = list(map(lambda x: int(x), str(input()).split(' ')))
if n < m:
... | output | 1 | 59,970 | 7 | 119,941 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light ... | instruction | 0 | 59,971 | 7 | 119,942 |
No | output | 1 | 59,971 | 7 | 119,943 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light ... | instruction | 0 | 59,972 | 7 | 119,944 |
No | output | 1 | 59,972 | 7 | 119,945 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light ... | instruction | 0 | 59,973 | 7 | 119,946 |
No | output | 1 | 59,973 | 7 | 119,947 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light ... | instruction | 0 | 59,974 | 7 | 119,948 |
No | output | 1 | 59,974 | 7 | 119,949 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The proble... | instruction | 0 | 60,105 | 7 | 120,210 |
Tags: brute force
Correct Solution:
```
m, l = map(int, input().split())
a = list(map(int, input().split()))
print(max(i * sum(ai // i for ai in a) for i in range(l, 101)))
``` | output | 1 | 60,105 | 7 | 120,211 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The proble... | instruction | 0 | 60,106 | 7 | 120,212 |
Tags: brute force
Correct Solution:
```
import math
from decimal import Decimal
import heapq
def na():
n = int(input())
b = [int(x) for x in input().split()]
return n,b
def nab():
n = int(input())
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
return n,b,c
def dv():
n, m = m... | output | 1 | 60,106 | 7 | 120,213 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The proble... | instruction | 0 | 60,107 | 7 | 120,214 |
Tags: brute force
Correct Solution:
```
n, l = map(int, input().split())
a = list(map(int, input().split()))
mx = 0
for I in range(l, 101):
ans = 0
for i in a: ans += i // I
mx = max(mx, ans * I)
print(mx)
``` | output | 1 | 60,107 | 7 | 120,215 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The proble... | instruction | 0 | 60,108 | 7 | 120,216 |
Tags: brute force
Correct Solution:
```
n, l = map(int, input().split())
a = list(map(int, input().split()))
print(max(i * sum(ai // i for ai in a) for i in range(l, 101)))
``` | output | 1 | 60,108 | 7 | 120,217 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The proble... | instruction | 0 | 60,109 | 7 | 120,218 |
Tags: brute force
Correct Solution:
```
n,L=map(int,input().split())
a=sorted(list(map(int,input().split())))
ans=0
for clen in range(L,101):
csum=sum(y//clen for y in a)
ans=max(ans,csum*clen)
print(ans)
``` | output | 1 | 60,109 | 7 | 120,219 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The proble... | instruction | 0 | 60,110 | 7 | 120,220 |
Tags: brute force
Correct Solution:
```
n, l = map(int, input().split())
a = list(map(int, input().split()))
print(max(i * sum(ai // i for ai in a) for i in range(l, 101)))
# Made By Mostafa_Khaled
``` | output | 1 | 60,110 | 7 | 120,221 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The proble... | instruction | 0 | 60,111 | 7 | 120,222 |
Tags: brute force
Correct Solution:
```
n,l = map(int, input().strip().split(' '))
lst = list(map(int, input().strip().split(' ')))
j=0
while(j<len(lst)):
if lst[j]<l:
del lst[j]
else:
j+=1
c=0
if len(lst)==0:
print(c)
else:
m=0
for j1 in range(l,max(lst)+1):
c=0
for... | output | 1 | 60,111 | 7 | 120,223 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The proble... | instruction | 0 | 60,112 | 7 | 120,224 |
Tags: brute force
Correct Solution:
```
n, l = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n-1, -1, -1):
if a[i] < l:
a.pop(i)
if len(a) == 0:
print(0)
else:
m = 0
for i in range(l, max(a)+1):
s = i
t = 0
for j in range(len(a)):... | output | 1 | 60,112 | 7 | 120,225 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the fac... | instruction | 0 | 60,113 | 7 | 120,226 |
Yes | output | 1 | 60,113 | 7 | 120,227 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the fac... | instruction | 0 | 60,114 | 7 | 120,228 |
Yes | output | 1 | 60,114 | 7 | 120,229 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the fac... | instruction | 0 | 60,115 | 7 | 120,230 |
Yes | output | 1 | 60,115 | 7 | 120,231 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the fac... | instruction | 0 | 60,116 | 7 | 120,232 |
Yes | output | 1 | 60,116 | 7 | 120,233 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the fac... | instruction | 0 | 60,117 | 7 | 120,234 |
No | output | 1 | 60,117 | 7 | 120,235 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the fac... | instruction | 0 | 60,118 | 7 | 120,236 |
No | output | 1 | 60,118 | 7 | 120,237 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the fac... | instruction | 0 | 60,119 | 7 | 120,238 |
No | output | 1 | 60,119 | 7 | 120,239 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the fac... | instruction | 0 | 60,120 | 7 | 120,240 |
No | output | 1 | 60,120 | 7 | 120,241 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjacent squares painted ... | instruction | 0 | 60,121 | 7 | 120,242 |
Tags: math
Correct Solution:
```
import math
a=list(map(int,input().split()))
x=int(input())
bt=math.ceil((a[0]*a[1])/2)
c=[]
if a[0]>=2 and a[1]>=2:
k=(math.ceil(a[0]/2)+math.floor(a[0]/2)+math.ceil((a[1]-2)/2)+math.floor((a[1]-2)/2))
else:
k=math.ceil(max(a)/2)+math.floor(max(a)/2)
while True:
if a[0]<2 o... | output | 1 | 60,121 | 7 | 120,243 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjacent squares painted ... | instruction | 0 | 60,122 | 7 | 120,244 |
Tags: math
Correct Solution:
```
n, m = map(int, input().split())
x = int(input())
a = max(0, n - 2 * (x - 1))
b = max(0, m - 2 * (x - 1))
size = a * b - max(0, a - 2) * max(0, b - 2)
result = (size + 1) // 2
print(result)
``` | output | 1 | 60,122 | 7 | 120,245 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjacent squares painted ... | instruction | 0 | 60,123 | 7 | 120,246 |
Tags: math
Correct Solution:
```
n, m = map(int, input().split())
x, v = int(input()), 0
x1, y1, x2, y2 = x - 1, x - 1, n - x, m - x
if x1 > x2 or y1 > y2:
print(0)
exit()
for i in range(x1, x2 + 1):
if i == x1 or i == x2:
v += (y2 - y1 + 1) // 2 + ((i + y1) % 2 == 0 and (i + y2) % 2 == 0)
else:... | output | 1 | 60,123 | 7 | 120,247 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjacent squares painted ... | instruction | 0 | 60,124 | 7 | 120,248 |
Tags: math
Correct Solution:
```
n, m = map(int, input().split())
x = int(input())
k = 0
for i in range(n):
for j in range(m):
if not (i + j) % 2:
if min(min(i, j) + 1, min(n - i, m - j)) == x:
k += 1
print(k)
``` | output | 1 | 60,124 | 7 | 120,249 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjacent squares painted ... | instruction | 0 | 60,125 | 7 | 120,250 |
Tags: math
Correct Solution:
```
n,m=list(map(int,input().split()))
x=int(input())
if n-2*(x-1)==m-2*(x-1)==1:
print(1)
elif n-2*(x-1)>0 and m-2*(x-1)>0:
print(n+m-4*x+2)
else:
print(0)
``` | output | 1 | 60,125 | 7 | 120,251 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjacent squares painted ... | instruction | 0 | 60,126 | 7 | 120,252 |
Tags: math
Correct Solution:
```
n,m=map(int,input().split())
x=int(input())
w,h=n-(2*x-1),m-(2*x-1)
if w<0 or h<0:
print(0)
else:
print(max(w+h,1))
``` | output | 1 | 60,126 | 7 | 120,253 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjacent squares painted ... | instruction | 0 | 60,127 | 7 | 120,254 |
Tags: math
Correct Solution:
```
import itertools
import math
n, m = [int(k) for k in input().split()]
x = int(input())
if n-2*(x-1) < 1 or m-2*(x-1) < 1:
print(0)
elif n-2*(x-1) == 1 or m-2*(x-1) == 1:
print((n+m-4*(x-1))//2)
else: print(n+m-2 - 4*(x-1))
# Made By Mostafa_Khaled
``` | output | 1 | 60,127 | 7 | 120,255 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjacent squares painted ... | instruction | 0 | 60,128 | 7 | 120,256 |
Tags: math
Correct Solution:
```
def calculate_sides(n, m):
if n == 1:
return m // 2 if m % 2 == 0 else m // 2 + 1
if m == 1:
return n // 2 if n % 2 == 0 else n // 2 + 1
left, right, top, bottom = 0, 0, 0, 0
top = m // 2 if m % 2 == 0 else m // 2 + 1
bottom = top if n % 2 != 0 else ... | output | 1 | 60,128 | 7 | 120,257 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.