s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s840041342 | p03712 | u846150137 | 1530394651 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 106 | h,w=map(int,input())
print("#"*(w+2))
for i in range(h):
print("#"+input().strip()+"#")
print("#"*(w+2)) |
s314018892 | p03712 | u186426563 | 1527024331 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 105 | h, w = map(int, input().split())
print('#'*w)
for i in range(w):
print('#'+input()+'#')
print('#'*w)
|
s918736534 | p03712 | u612721349 | 1520915659 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 118 | p=input();h,w=map(int,p().split());w+=2;print("#"*w);print("\n".join(["#"+p().strip()+"#"for _ in[0]*h]));print("#"*w) |
s120077687 | p03712 | u612721349 | 1520915337 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 102 | h,w=map(int,input().split());print("#"*w);print("\n".join(["#"input()"#"for _ in [0]*h]));print("#"*w) |
s555477943 | p03712 | u816631826 | 1507009542 | Python | Python (3.4.3) | py | Runtime Error | 16 | 2940 | 426 | #include<iostream>
using namespace std;
int main()
{
int h,w;
cin>>h>>w;
char name[h][w];
for(int i=0;i<h;i++)
{
for (int j=0;j<w;j++)
{
cin>>name[i][j];
}
}
for(int k=0;k<w+2;k++)
{
cout<<"#";
}
cout<<"\n";
for(int i=0;i<h;i++)
{
cout<<'#';
for (int j=0;j<w;j++)
... |
s724353695 | p03712 | u791838908 | 1504613573 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 221 | H, W = map(int, input().split())
array = list()
header = ""
for i in range(0, H):
array[i] = "#" + input() + "#"
for i in range(0, W+2):
header += "#"
print(header)
for p in array:
print(p)
print(header)
|
s562637634 | p03712 | u791838908 | 1504613475 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 219 | H, W = map(int, input().split())
array = list()
header = ""
for i in range(H):
array[i] = "#" + input() + "#"
for i in range(0, W+2):
header += "#"
print(header)
for p in array:
print(p)
print(header)
|
s391632941 | p03712 | u791838908 | 1504613260 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 209 | H, W = input().split()
array = list()
header = ""
for i in range(H):
array[i] = "#" + input() + "#"
for i in range(0, W+2):
header += "#"
print(header)
for p in array:
print(p)
print(header)
|
s204064175 | p03712 | u343437894 | 1499613023 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 171 | (h, w) = map(int, input().split(" "))
a=[]
for i in range(h):
a.append(input())
print("#" * (w+2))
for i in range(h):
print("#"+a+"#")
print("#" * (w+2))
|
s555752725 | p03712 | u343437894 | 1499612924 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 257 | (h, w) = map(int, input().split(" "))
a=[]
for i in range(h):
a.append(input().split(" "))
print("#" * (w+2))
for i in range(h):
print("#", end="")
for j in range(w):
print(aline[i][j], end="")
print("#")
print("#" * (w+2))
|
s516514796 | p03712 | u343437894 | 1499612842 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 258 | (h, w) = map(int, input().split(" "))
a=[]
for i in range(h):
aline[i] = input().split(" ")
print("#" * (w+2))
for i in range(h):
print("#", end="")
for j in range(w):
print(aline[i][j], end="")
print("#")
print("#" * (w+2))
|
s049747208 | p03712 | u871999682 | 1498506378 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 393 | coding:utf-8
import sys
H,W = raw_input().split()
a =[]
for line in range(int(H)):
a.append(raw_input())
print a
for i in range(0,int(W)+2):
sys.stdout.write("#")
print
for i in range(0,int(H)):
sys.stdout.write("#")
for j in range(0,int(W)):
sys.stdout.write(a[i][j])
sys.stdout.write("#... |
s445325529 | p03712 | u036032247 | 1497998478 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 160 | a = [int(i) for i in input().split()]
b = []
[b.append(input()) for i in range(a[0])]
print('#'*(a[1]+2)+'\n'+'#'+b[0]+'#'+'\n'+'#'+b[1]+'#'+'\n'+'#'*(a[1]+2)) |
s330017374 | p03712 | u450956662 | 1496434107 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 243 | # -*- coding: utf-8 -*-
H, W = map(int, input().split())
A = []
for i in range(H):
A.append("#")
for j in range(W):
a = input()
A[i] += a
A[i] += "#"
A = ["#" * (W+2)] + A + ["#" * (W+2)]
for i in A:
print(i) |
s068669614 | p03712 | u450956662 | 1496433377 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 191 | # -*- coding: utf-8 -*-
H, W = map(int, input().split())
A = []
for i in range(H):
for j in range(W):
A[i] += input()
A = ["#" * W+2] + A + ["#" * W+2]
for i in A:
print(i) |
s610008914 | p03712 | u450956662 | 1496432242 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 217 | # -*- coding: utf-8 -*-
H, W = map(int, input().split())
A = [H]
for i in range(1, H):
a = input()
A[i] = ['#' + a + '#']
fr = '#' * (W+2)
A = [fr] + A + [fr]
for i in A:
print(i)
print('#' + 1 + '#') |
s125307518 | p03712 | u467027051 | 1496127306 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 296 | def output(H,W,q):
frame = ""
for i in range(W+2):
frame += "#"
print frame
while not q.empty():
print "#" + q.get() + "#"
print frame
H,W = map(int, raw_input().split())
q_str = Queue.Queue()
for i in range(H):
q_str.put(raw_input())
output(H,W,q_str)
|
s628318640 | p03712 | u119303585 | 1495987107 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 172 | h, w = [int(n) for n in input().split()]
ans=''
for i in range(h):
ipt = input().split()
ans+='#'+ipt[0]+ipt[1]+'#'+'\n'
print('#'*(w + 2))
print(ans+'#'*(w + 2))
|
s641149906 | p03712 | u119303585 | 1495986911 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 158 | h, w = [int(n) for n in input().split()]
print('#'*(w + 2))
for i in range(h):
ipt = input().split()
print('#'+ipt[0]+ipt[1]+'#')
print('#'*(w + 2)) |
s982778502 | p03712 | u119303585 | 1495986675 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 164 | h, w = [int(n) for n in input().split()]
print('#'*(w + 2))
for i in range(h):
ans='#'
ans+=input().split()
ans+='#'
print(ans)
print('#'*(w + 2)) |
s569358373 | p03712 | u119303585 | 1495985569 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 208 | ipt=input().split()
h,w = [int(n) for n in ipt[:1]]
img= [input().split()[2:]]
print(
for i in w+2:
'#',
"/n",
for i in h:
'#',img[w*i,w*(i+1)],'#',"/n"
for i in w+2:
,'#') |
s184046046 | p03712 | u334624175 | 1495985419 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 183 | H, W = [int(n) for n in input().split()]
for i in range(H):
image = []
image.append(input())
print("#"*(W+2))
for i in range(H):
print("#"+image[i]+"#")
print("#"*(W+2))
|
s908107804 | p03712 | u334624175 | 1495985280 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 182 | H, W = [int(n) for n in input().split()]
for i in range(H):
image = []
image.append(input())
print("#"*(W+2))
for i in range(H):
print("#"+image(i)+"#")
print("#"*(W+2)) |
s908717542 | p03712 | u119303585 | 1495983363 | Python | Python (3.4.3) | py | Runtime Error | 281 | 17684 | 65 | import numpy as np
ipt =np.array(input()[3:])
np.pad(ipt,1,'#') |
s930901187 | p03712 | u780709476 | 1495945403 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 202 | y, x = map(int, input().split())
image = ["#" * (x+2)]
for y in range(0,y):
image.append("#" + input() + "#")
image.append("#" * (x+2))
for img in image:
print(img)
|
s650700295 | p03712 | u203414902 | 1495718079 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 292 | H,W=map(int,input().split())
a=[]
for i in range(H):
a.append(map(int,input().split()))
for i in range(0,W+2):
print("#",end="")
print()
for i in a:
print("#",end="")
for j in i:
print(j,end="")
print("#")
for i in range(0, W+2):
print("#",end="")
print() |
s943746869 | p03712 | u837852400 | 1495552228 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 273 | H,W = buf.split()
H = int(H)
W = int(W)
pic = []
for i in range(H):
pic.append(input())
#for row in pic:
# print(row)
for i in range(W+2):
print("#",end="")
print()
for i in range(H):
print("#"+pic[i]+"#")
for i in range(W+2):
print("#",end="") |
s453529251 | p03712 | u837852400 | 1495551904 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 276 | H,W = buf.split()
H = int(H)
W = int(W)
pic = []
for i in range(H):
pic.append(input())
#for row in pic:
# print(row)
for i in range(W+2):
print("#",end="")
print()
for i in range(H):
print("#"+pic[i]+"#")
for i in range(W+2):
print("#",end="")
print() |
s140777957 | p03712 | u636592342 | 1495336215 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 154 | [x, y] = map(int, raw_input().strip().split())
a = raw_input().strip()
b = raw_input().strip()
print "#" * (y + 2)
print "#" + a + "#"
print "#" * (y + 2) |
s595535812 | p03712 | u451817125 | 1495329747 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 171 | N, M = map(int ,raw_input().split())
s="#"*(M+2)
a=[]
a.append(s)
for i in range(N):
a.append("#"+raw_input()+"#")
a.append(s)
for i in range(N+2):
print(a[i])
|
s127179996 | p03713 | u589969467 | 1600550339 | Python | Python (3.8.2) | py | Runtime Error | 2210 | 144020 | 796 | h,w = map(int,input().split())
ma = max(h,w)
mi = min(h,w)
h = mi
w = ma
ans = []
if h%3==0 or w%3==0:
print(0)
else:
#for i in range(w//3,w//2+1):
for i in range(1,w//2+1):
men1 = h * i
ma = max(h,w-i)
mi = min(h,w-i)
h1 = mi
w1 = ma
if h1%2==0 or w1%2==0:
... |
s370420938 | p03713 | u589969467 | 1600550220 | Python | Python (3.8.2) | py | Runtime Error | 49 | 9452 | 725 | h,w = map(int,input().split())
ma = max(h,w)
mi = min(h,w)
h = mi
w = ma
ans = []
if h%3==0 or w%3==0:
print(0)
else:
for i in range(w//3,w//2+1):
men1 = h * i
ma = max(h,w-i)
mi = min(h,w-i)
h1 = mi
w1 = ma
if h1%2==0 or w1%2==0:
men2 = h1 * w1 // 2
... |
s640296284 | p03713 | u944325914 | 1599445880 | Python | PyPy3 (7.3.0) | py | Runtime Error | 108 | 75012 | 3151 | h,w=map(int,input().split())
if h%3==0 or w%3==0:
print(0)
exit()
if h%2==0:
x=w
y=h
ans1=10**12
for i in range(0,x+1):
a=i*y
b=(x-i)*(y//2)
c=(x-i)*(y//2)
l=[a,b,c]
temp=max(l)-min(l)
ans1=min(temp,ans1)
if w%2==0:
x=h
y=w
... |
s947989667 | p03713 | u070201429 | 1598642992 | Python | PyPy3 (7.3.0) | py | Runtime Error | 210 | 68116 | 528 | h, w = map(int, input().split())
if h % 3 == 0 or w % 3 == 0:
print(0)
exit()
def solve2(h, w):
if h % 2 == 0 or w % 2 == 0:
return [h*w // 2]
elif h < w:
return [h * (w//2), h * (w//2 + 1)]
def solve1(h, w):
ans = []
ans.append(max([(h//3) * w] + solve2(h - h//3, w)) - min([(... |
s318921473 | p03713 | u516447519 | 1594862628 | Python | Python (3.8.2) | py | Runtime Error | 119 | 13388 | 365 | H,W = [int(i) for i in input().split()]
if H % 3 == 0 or W % 3 == 0:
print(0)
else:
s = []
for i in range(1,int(H/2)):
j = int(W/2)
a = [i*W,j*(H-i),(W-j)*(H-i)]
b = max(a) - min(a)
s.append(b)
j = int(H/2)
a = [H*i,(W-i)*j,(W-i)*(H-j)]
b = max(a) - m... |
s932259050 | p03713 | u633450100 | 1594860501 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9188 | 648 | def answer(H,W,ans):
for x in range(1,W):
y1 = H // 2
Sa1 = H * x
Sb1 = (W - x) * y1
Sc1 = (W - x) * (H - y1)
M = max(Sa1,Sb1,Sc1)
m = min(Sa1,Sb1,Sc1)
y2 = (W - x) // 2
Sa2 = H * x
Sb2 = H * y2
Sc2 = H * (W - x - y2)
M2 = max(... |
s493511561 | p03713 | u633450100 | 1594859665 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9136 | 383 | H,W = [int(i) for i in input().split()]
ans = 0
for x in range(1,W):
y = H // 2
Sa1 = H * x
Sb1 = (W - x) * y
Sc1 = (W - x) * (H - y)
M = max(Sa1,Sb1,Sc1)
m = min(Sa1,Sb1,Sc1)
Sa2 = H * x
Sb2 = H * y
Sb2 = H * (W - x - y)
M2 = max(Sa2,Sb2,Sc2)
m2 = min(Sa2,Sb2,Sc2)
if ... |
s024378723 | p03713 | u781262926 | 1591845285 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3064 | 593 | h, w = map(int, input().split())
if h % 3 == 0 or w % 3 == 0:
print(0)
else:
if h > w:
h, w = w, h
ans = h
if h % 2 == 0:
h1 = h // 2
for w1 in range(w//2+1):
s2 = h1 * w1
s3 = h1 * (w-w1)
ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))
e... |
s317083108 | p03713 | u852862907 | 1591230298 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 4454 | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class ... |
s273260856 | p03713 | u497952650 | 1589443470 | Python | Python (3.8.2) | py | Runtime Error | 212 | 9232 | 486 | H,W = map(int,input().split())
if H%3 == 0 or W%3 == 0:
print(0)
exit()
##縦方向の探索
ans = 1e10
for i in range(1,H-1):
tate = W*i##上から切る
mini = (H-i)*(W//2)##半分に分割したちっこいほう
ans = min(ans,max(tate,mini,H*W-tate-mini)-min(tate,mini,H*W-tate-mini))
##横方向の探索
for i in range(1,W-1):
yoko = H*i
mi... |
s804779956 | p03713 | u969850098 | 1588655837 | Python | Python (3.4.3) | py | Runtime Error | 34 | 5076 | 975 | import sys
readline = sys.stdin.readline
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def round(f, r=0):
return Decimal(str(f)).quantize(Decimal(str(r)), rounding=ROUND_HALF_UP)
def main():
H, W = map(int, readline().rstrip().split())
# 横にスライスする場合
if H >= 3:
ans = abs(W*(H//3) -... |
s215822382 | p03713 | u616117610 | 1587749224 | Python | Python (3.4.3) | py | Runtime Error | 263 | 3064 | 436 | h,w = map(int, input().split())
if max(h,w) >= 3:
if h >= w :
ans = w*min(1,(h%3))
else:
ans = h*min(1,(w%3))
if h%3 == 0:
ans = 0
if w%3 == 0:
ans = 0
if h != 1:
for i in range(1,h):
ans_ = max(i*w,(h-i)*(w+(w%2))//2) - min(i*w,(h-i)*(w-(w%2))//2)
ans = min(ans,ans_)
if w != 1:
for i in... |
s438725969 | p03713 | u616117610 | 1587748922 | Python | Python (3.4.3) | py | Runtime Error | 265 | 3064 | 352 | h,w = map(int, input().split())
if max(h,w) >= 3:
if h >= w :
ans = w*min(1,(h%3))
else:
ans = h*min(1,(w%3))
for i in range(1,h):
ans_ = max(i*w,(h-i)*(w+(w%2))//2) - min(i*w,(h-i)*(w-(w%2))//2)
ans = min(ans,ans_)
for i in range(1,w):
ans_ = max(i*h,(w-i)*(h+(h%2))//2) - min(i*h,(w-i)*(h-(h%2))//2)
... |
s421193493 | p03713 | u151625340 | 1587314073 | Python | PyPy3 (2.4.0) | py | Runtime Error | 176 | 38384 | 572 | H,W = map(int,input().split())
a = H%2
b = W%2
ans = 10**9
if H%3==0 or W%3==0:
print(0)
elif H==1 or W==1:
print(1)
else:
for i in range(1,W):
c = (H*i,H//2*(W-i),H*W-H*i-(H//2)*(W-i))
ans = min(ans,max(c)-min(c))
for i in range(1,H):
c = (W*i,W//2*(H-i),H*W-W*i-(W//2)*(H-i))
... |
s292192476 | p03713 | u931173291 | 1587251941 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 790 | h,w=map(int,input().split())
ans=[]
import sys
def s(a,b):
if a%3==1:
s=a*b
x=(a//3)*b
y=((a-(a//3))//2)*b
z=s-x-y
e=(a-(a//3))*(b//2)
d=s-x-e
ma=max(x,y,z)
mi=min(x,y,z)
mc=max(x,e,d)
mn=min(x,e,d)
return(min((ma-mi),(mc-mn)))... |
s089075466 | p03713 | u931173291 | 1587251283 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 756 | h,w=map(int,input().split())
ans=[]
import sys
def s(a,b):
if a%3==1:
s=a*b
x=(a//3)*b
y=((a-(a//3))//2)*b
z=s-x-y
e=(a-(a//3))*(b//2)
d=s-x-e
ma=max(x,y,z)
mi=min(x,y,z)
mc=max(x,e,d)
mn=min(x,e,d)
return(min((ma-mi),(mc-mn)))... |
s888673037 | p03713 | u787449825 | 1586901210 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 321 | h, w = map(int, input().split())
long = max(h, w)
short = min(h, w)
if h%3==0 or w%3==0:
print(0)
else:
if long%3==1:
s_max = long//3*short
s_min = (long-long//3)*(short//2)
elif long%3==2:
s_max = (long//3+1)*short
s_min = (long-(long//3+1))*(short//2)
print(abs(s_max-s_min)... |
s893539224 | p03713 | u686036872 | 1586239770 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 411 | def chco(h, w):
ans = float("inf")
a, b, c = 0, 0, 0
for i in range(1, H):
a = i*W
for j in range(2):
if j == 0:
b = (H-i)//2 * W
c = H*W - a - b
else:
b = (H-i)*(W//2)
c = H*W - a - b
ans = min(... |
s790586572 | p03713 | u686036872 | 1586237451 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 140 | H, W = map(int, input().split())
if H*W%3 == 0:
print(0)
else:
M = Max(H, W)
m = min(H, W)
print(m*(M//2)-(M-M//2)*(m//2)) |
s324021102 | p03713 | u686036872 | 1586237419 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 139 | H, W = map(int, input().split())
if H*W%3 == 0:
print(0)
else:
M = Max(H, W)
m = min(H, W)
print(m*(M//2)-(M-M//2)*(m//2) |
s758058030 | p03713 | u389151317 | 1582240000 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 344 | def calc(A, B):
if A % 3 == 1:
AA = A // 3
if A % 3 == 2:
AA = A // 3 + 1
BB = B // 2
h_list = [AA * B, (A - AA) * BB, (A - AA) * (B - BB)]
return max(h_list) - min(h_list)
H, W = map(int, input().split(' '))
L = list()
if H % 3 == 0 or W % 3 == 0:
L = [0]
else:
L = [int(calc(W, H),) int(calc(H,... |
s340806735 | p03713 | u798818115 | 1579479165 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 344 | # coding: utf-8
# Your code here!
H,W=map(int,input().split())
def calc(main,sub):
if main%3==1:
a=main//3
else:
a=main//3+1
b=sub//2
temp=[a*sub,(main-a)*b,(main-a)*(sub-b)]
return max(temp)-min(temp)
if H%3==0 or W%3==0:
print(0)
else:
print(min(calc(H,W),ca... |
s478315711 | p03713 | u989345508 | 1578231606 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 378 | h,w=map(int,input().split())
x=[]
for i in range(1,w):
x1=[h*i,h*((w-i)//2),h*(w-i)-h*((w-i)//2)]
x2=[h*i,(w-i)*(h//2),h*(w-i)-(w-i)*(h//2)]
x.append(min(max(x1)-min(x1),max(x2)-min(x2))
for i in range(1,h):
x1=[w*i,w*((h-i)//2),w*(h-i)-w*((h-i)//2)]
x2=[w*i,(h-i)*(w//2),w*(h-i)-(h-i)*(w//2)]
x.... |
s107689745 | p03713 | u768896740 | 1577989497 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3192 | 2021 | import math
h, w = map(int, input().split())
diff_2 = min(h, w)
if h % 3 == 0 or w % 3 == 0:
print(0)
exit()
elif h % 2 == 0 and w %2 == 0:
if h >= w:
side1 = int(w/2)
diff = math.inf
for i in range(1, h):
rect1 = side1 * i
rect2 = w * (h - i)
i... |
s340609738 | p03713 | u452015170 | 1574889774 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 357 | h, w = map(int, input().split())
if h % 3 == 0 or w % 3 == 0 :
print(0)
elif h % 3 == 1 and w % 3 == 1 :
print(min(h, w))
elif h % 3 == 1 and W % 3 == 2 :
print(min((h - 1) // 3, (w - 2) // 3))
elif h % 3 == 2 and w % 3 == 1 :
print(min((h - 2) // 3, (w - 1) // 3))
elif h % 3 == 2 and w % 3 == 2 :
p... |
s880482233 | p03713 | u254871849 | 1572710762 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 585 | import sys
input = sys.stdin.readline
h, w = [int(x) for x in input().split()]
if h % 3 == 0 or 2 % 3 == 0:
print(0)
exit()
if h % 3 == 1:
d = h // 3
else:
d = h // 3 + 1
block = [w * d, (h-d) * (w // 2), (h-d) * (w - w // 2)]
for b in block:
if b == int(b**0.5) ** 2:
break
else:
res... |
s048227803 | p03713 | u256031597 | 1569803255 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 791 |
H, W = map(int, input().spilit())
hal = [H//3, H//3+1]
ans = float("inf")
for ha in hal:
Sa = ha * W
## 横に分割
hb = (H - ha)//2
hc = H - ha - hb
Sb = hb * W
Sc = hc * W
ans = min(ans, max(Sa, Sb, Sc) - min(Sa, Sb, Sc))
## 縦に分割
wb = W//2
wc = W - wb
Sb = (H - ha) *... |
s113837734 | p03713 | u780962115 | 1569299187 | Python | Python (3.4.3) | py | Runtime Error | 218 | 3064 | 679 | h,w=map(int,input().split())
if h%3==0:
print(0)
if w%3==0:
print(0)
else:
ansh=h*w
for j in range(1,h):
area1=w*j
number=w//2
area2=(h-j)*number
area3=(h-j)*(w-number)
check=max(abs(area1-area2),abs(area1-area3),abs(area2-area3))
if check<ansh:
... |
s340438362 | p03713 | u155687575 | 1568224236 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 388 | H, W = map(int, input().split())
ans = float('inf')
for _ in range(2):
for i in range(1, H):
a = i*W
b = ((H - i) // 2) * W
c = ((H - i + 1)// 2) * W
ans = min(ans, abs(max(a, b, c) - min(a, b, c)))
b = (W // 2) * (H -i)
c = ((W + 1) // 2) * (H - i)
ans = m... |
s512467812 | p03713 | u625554679 | 1567647380 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 565 | H, W = [int(x) for x in input().split()]
def solve(H, W):
if H % 3 == 0 or W % 3 == 0:
return 0
else:
min_ = 1e10
a = 0
ans = 1e20
for i in range(W+1):
if abs(i-target) < min_:
a = i
min_ = abs(i-target)
b = W - a
target = H/2
for i in range(min(int(tar... |
s124921128 | p03713 | u625554679 | 1567599239 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 588 | H, W = [int(x) for x in input().split()]
def solve(H, W):
if H % 3 == 0 or W % 3 == 0:
return 0
else:
target = W/3
min_ = 1e10
a = 0
for i in range(min(int(target)-1, 2), min(int(target)+2, W+1)):
if abs(i-target) < min_:
a = i
min_ = abs(i-target)
b = W - a
targ... |
s135770578 | p03713 | u610473220 | 1567441680 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 962 | H, W = map(int, input().split())
if H%3 == 0 or H%3 == 0:
ans = 0
else:
ansl = [H] + [W] + [H*W] * 2
if W%2 == 0:
for i in range(1, H):
tmp = abs(i * W - (H-i) * W // 2)
if ansl[2] > tmp:
ansl[2] = tmp
else:
for i in range(1, H):
S1 = W... |
s627651505 | p03713 | u610473220 | 1567441624 | Python | Python (3.4.3) | py | Runtime Error | 155 | 3064 | 961 | H, W = map(int, input().split())
if H%3 == 0 or H%3 == 0:
ans = 0
else:
ansl = [H] + [W] + [H*W] * 2
if W%2 == 0:
for i in range(1, H):
tmp = abs(i * W - (H-i) * W // 2)
if ansl[2] > tmp:
ansl[2] = tmp
else:
for i in range(1, H):
S1 = W... |
s392537792 | p03713 | u266874640 | 1567211328 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 973 | import math
H, W = map(int,input().split())
ans = math.inf
for i in range(1, H):
a = i*W
if H-i == 1:
d = 1*(W//2)
e = H*W-a-d
small = min(a,d,e)
large = max(a,d,e)
ans = min(ans, large-small)
else:
b = ((H-i)//2) * W
c = H*W-a-b
d = (H-i) * (... |
s866036255 | p03713 | u716530146 | 1567191100 | Python | Python (3.4.3) | py | Runtime Error | 72 | 3064 | 427 | h,w=map(int,input().split())
candidate=[0]*4
if h*w%3==0:
print(0)
exit()
def solve(a,b,k):
candidate[k]=a
if b%2==0:
cnd=float('inf')
for i in range(a//2+1):
cnd=min(abs(b-3*i),cnd)
candidate[k+1]=(cnd*a//2,i)
else:
cnd=float('inf')
for i in range(a//2+1):
cnd=min(cnd,max(abs(a//2*(b-i)-a*i),abs(a... |
s940307666 | p03713 | u830054172 | 1567124883 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 351 | def max(iterable, *, default, key)
max(iterable, *[, default=obj, key=func]) -> value max(arg1, arg2, *args, *[, key=func]) -> value
With a single iterable argument, return its biggest item. The default keyword-only argument specifies an object to return if the provided iterable is empty. With two or more arguments, r... |
s801038700 | p03713 | u123756661 | 1566710803 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38512 | 516 | h,w=map(int,input().split())
ans=h*w
if h>2:
t=[h//3*w,(h-(h//3))//2*w,(h-(h//3)+1)//2*w]
t.sort()
ans=min(ans,t[2]-t[0])
if w>2:
t=[w//3*h,(w-(w//3))//2*h,(w-(w//3)+1)//2*h]
t.sort()
ans=min(ans,t[2]-t[0])
a,b=h,w
#for i in range(max(1,a//3-1),min(a//2+1,a-1)):
# t=[i*b,(a-i)*(b//2),(a-i)*((b+1)//2)... |
s564068583 | p03713 | u123756661 | 1566710292 | Python | PyPy3 (2.4.0) | py | Runtime Error | 184 | 39280 | 507 | h,w=map(int,input().split())
ans=h*w
if h>2:
t=[h//3*w,(h-(h//3))//2*w,(h-(h//3)+1)//2*w]
t.sort()
ans=min(ans,t[2]-t[0])
if w>2:
t=[w//3*h,(w-(w//3))//2*h,(w-(w//3)+1)//2*h]
t.sort()
ans=min(ans,t[2]-t[0])
a,b=h,w
for i in range(max(1,a//3-1),min(a//2+1,a-1)):
t=[i*b,(a-i)*(b//2),(a-i)*((b+1)//2)]
... |
s349252465 | p03713 | u123756661 | 1566710151 | Python | Python (3.4.3) | py | Runtime Error | 108 | 3064 | 507 | h,w=map(int,input().split())
ans=h*w
if h>2:
t=[h//3*w,(h-(h//3))//2*w,(h-(h//3)+1)//2*w]
t.sort()
ans=min(ans,t[2]-t[0])
if w>2:
t=[w//3*h,(w-(w//3))//2*h,(w-(w//3)+1)//2*h]
t.sort()
ans=min(ans,t[2]-t[0])
a,b=h,w
for i in range(max(1,3//a-1),min(a//2+1,a-1)):
t=[i*b,(a-i)*(b//2),(a-i)*((b+1)//2)]
... |
s604169982 | p03713 | u509405951 | 1566693922 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 520 | def threeArea(w, h, ans):
for i in range(1, h):
recA = w * i
width = w//2
recB = (h-i) * width
recC = w * h - recA - recB
diff = max(recA, recB, recC) - min(recA, recB, recC)
height = (h - i) //2
recB = w * height
recC = w * h - recA - recB
diff = min(diff, max(recA, recB, recC) - m... |
s749233815 | p03713 | u741397536 | 1566693721 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3316 | 445 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
H, W = map(int, input().split())
if H > W:
H, W = W, H
if H%3 == 0 or W%3 == 0:
print(0)
elif H%2 == 0:
H_div = H//2
W_div = round(W/3)
print(abs(H_div*(W-W_div) - H*W_div))
print(a)
else:
H_div = round(H/3)
W_div = ... |
s761640235 | p03713 | u952022797 | 1565710471 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38596 | 2387 | # -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
import random
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics impo... |
s578515569 | p03713 | u952022797 | 1565710190 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38256 | 2735 | # -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
import random
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics impo... |
s018506703 | p03713 | u820351940 | 1563307023 | Python | PyPy3 (2.4.0) | py | Runtime Error | 245 | 64108 | 574 | h, w = map(int, input().split())
ans_wsplit = [max(abs((i * w) - (((h - i) + 1) // 2) * w), abs((i * w) - ((h - i) // 2) * w)) for i in range(1, h - 1)]
ans_hsplit = [max(abs((i * h) - (((w - i) + 1) // 2) * h), abs((i * h) - ((w - i) // 2) * h)) for i in range(1, w - 1)]
ans_wline = [max(abs((i * w) - ((w + 1) // 2)... |
s738693110 | p03713 | u820351940 | 1563306918 | Python | PyPy3 (2.4.0) | py | Runtime Error | 175 | 38256 | 575 | h, w = map(int, input().split())
ans_wsplit = [max(abs((i * w) - (((h - i) + 1) // 2) * w), abs((i * w) - ((h - i) // 2) * w)) for i in range(1, h - 1)]
ans_hsplit = [max(abs((i * h) - (((w - i) + 1) // 2) * h), abs((i * h) - ((w - i) // 2) * h)) for i in range(1, w - 1)]
ans_wline = [max(abs((i * w) - ((w + 1) // 2)... |
s482881980 | p03713 | u225627575 | 1562716306 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 763 | H,W = map(int,input().split())
MIN = 10**11
S1 = 0
S2 = 0
S3 = 0
if H%3 == 0 or W %3==0:
print(0)
else:
for i in range(1,H):
S1 = i * W
S2 = (H-i)*(W//2)
S3 = (H-i)*(W - W//2)
MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
for i in range(1,W):
S1 = i * H
... |
s230566173 | p03713 | u225627575 | 1562715858 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 486 | H,W = map(int,input().split())
MIN = 10**11
S1 = 0
S2 = 0
S3 = 0
if H%3 == 0 or W %3==0:
print(0)
else:
for i in range(1,H):
S1 = i * W
S2 = (H-i)*(W//2)
S3 = (H-i)*(W - W//2)
MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
for i in range(1,W):
S1 = i * H
... |
s027815492 | p03713 | u227082700 | 1562653861 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 275 | h,w=map(int,input().split())
ans=h*w
for i in range(1,h):ans=min(ans,max(i*w,(h-i)*(w//2),(h-i)*((w-1)//2)+1)-min(i*w,(h-i)*(w//2),(h-i)*((w-1)//2)+1)
for i in range(1,w):ans=min(ans,max(i*h,(w-i)*(h//2),(w-i)*((h-1)//2)+1)-min(i*h,(w-i)*(h//2),(w-i)*((h-1)//2)+1)
print(ans) |
s763021487 | p03713 | u227082700 | 1562652857 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 174 | h,w=map()
ans=h*w
for i in range(1,h):ans=min(ans,max(i*w,(h-i)*w//2)-min(i*w,(h-i)*w//2))
for i in range(1,w):ans=min(ans,max(i*h,(w-i)*h//2)-min(i*h,(w-i)*h//2))
print(ans) |
s151035783 | p03713 | u456033454 | 1562380125 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38512 | 210 | import sys
a,b=map(int,input().split())
if a%3==0 or b%3==0:
print(0)
sys.exit()
a=int((n)/2)+(n)%2
b=int((n)/2)-(n)%2
c=int((m)/2)+(m)%2
d=it((m)/2)-(m)%2
ans=[a×(c+d),b×c,b×d]
print(max(ans)-min(ans)) |
s204058897 | p03713 | u822044226 | 1559936406 | Python | Python (3.4.3) | py | Runtime Error | 234 | 11032 | 296 | H,W = map(int,(input().split()))
x = []
for i in range(1,H-1):
a = i * W
b = (H - i) * (W // 2)
c = H * W - (a + b)
x.append(max(a,b,c) - min(a,b,c))
for j in range(1,W-1):
a = j * H
b = (W - j) * (H // 2)
c = H * W - (a + b)
x.append(max(a,b,c) - min(a,b,c))
print(min(x)) |
s841978941 | p03713 | u822044226 | 1559936163 | Python | Python (3.4.3) | py | Runtime Error | 238 | 11032 | 334 | H,W = map(int,(input().split()))
if (H*W)%3 == 0:
print(0)
exit()
x = []
for i in range(1,H-1):
a = i * W
b = (H - i) * (W // 2)
c = H * W - (a + b)
x.append(max(a,b,c) - min(a,b,c))
for j in range(1,W-1):
a = j * H
b = (W - j) * (H // 2)
c = H * W - (a + b)
x.append(max(a,b,c) - min(a,b,c))
p... |
s070537513 | p03713 | u059210959 | 1557238094 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 1206 | # encoding:utf-8
import copy
import random
import bisect #bisect_left これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
mod = 10**9+7
H,W = map(int,input().split())
area = H*W
ans = 0
if area % 3 == 0:
ans = 0
print(ans)
exit()
space = area/3
error = 10**5
key = 0
h_cut = False
for i in rang... |
s086604729 | p03713 | u798129018 | 1554390079 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 418 | INF = float("inf")
H,W = map(int,input().split())
ans = INF
for i in range(1,H):
SA = i * W
#横半分に分割するケース
h = math.ceil((H-i)/2)
SB1 = h * W
SC1 = (H-i-h)*W
S1 = max(SA,SB1,SC1)-min(SA,SB1,SC1)
#縦半分に分割するケース
w = math.ceil(W/2)
SB2 = (H-i)*w
SC2 = (H-i)*(W-w)
S2 = max(SA,SB2,SC... |
s662405091 | p03713 | u013408661 | 1554265747 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 324 | h,w=map(int,input())
if h%3==0 or w%3==0:
print(0)
if (w-w//3-1)%2==0 or h%2==0:
x=h*(w//3 +1)-(h*w-h*(w//3 +1))//2
else:
x=h*(w//3 +1)-(h*w-h*(w//3 +1)-min((w-w//3-1),h))//2
if (h-h//3-1)%2==0 or w%2==0:
y=w*(h//3 +1)-(h*w-w*(h//3 +1))//2
else:
y=w*(h//3 +1)-(h*w-w*(h//3 +1)-min((h-h//3-1),h))//2
print(min(x... |
s868889586 | p03713 | u512007680 | 1553746858 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3188 | 552 | h, w = map(int,input().split())
if w % 3 == 0 or h % 3 == 0:
print(0)
else:
s = h * w
l = []
for i in range(0,2):
if w == 2 and i == 0:
break
a = (int(w/3) + i) * h
b = (w - (int(w/3) + i)) * int(h/2)
c = s - a - b
l.append(max([a,b,c])-min([a,b,c]))... |
s144099108 | p03713 | u393512980 | 1553100386 | Python | Python (3.4.3) | py | Runtime Error | 76 | 3064 | 491 | H, W = map(int, input().split())
if H % 3 == 0 or W % 3 == 0:
print(0)
elif H % 2 and W % 2:
ans = float("inf")
for h in range(1, H):
y = (H - h) * W
x = h * (W // 2)
z = h * W - x
ans = min(ans, max(a, b, c) - min(a, b, c))
print(ans)
else:
if W % 2:
t = H
... |
s468801986 | p03713 | u807772568 | 1552427177 | Python | PyPy3 (2.4.0) | py | Runtime Error | 180 | 38256 | 391 | h,w = map(int,input().split())
ans = 10**10
if h * w % 3 == 0:
print(0)
exit()
ans = min(ans,w,h)
for i in range(1,h//2+1):
a = [w * j, (h - j) * (w // 2), (h - j) * (w // 2 + w % 2)]
a.sort()
ans = min(ans, a[2] - a[0])
for i in range(1, w//2+1):
a = [h * j, (w - j) * (h // 2), (w - j) * (h... |
s610837467 | p03713 | u493750228 | 1551581335 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1322 | #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typ... |
s878250892 | p03713 | u411858517 | 1551111848 | Python | Python (3.4.3) | py | Runtime Error | 282 | 3064 | 435 | import math
H, W = map(int, input().split())
if H%3 == 0 or W%3 == 0:
print(0)
else:
res = 10 ** 11
for i in range(1, H):
a = W*i
b = math.ceil(W/2) * (H-i)
m = W//2 * (H-i)
res = min(res, max(a,b,m)-min(a,b,m))
for i in range(1, W):
a = H*i
b = math.c... |
s033689433 | p03713 | u303059352 | 1549686868 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 68 | h, w = list(map(int, input().split()))
print(int(int(h % 3 * w % 3)) |
s640600068 | p03713 | u303059352 | 1549686821 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 47 | print(int(int(input()) % 2 * int(input()) % 2)) |
s810095302 | p03713 | u239981649 | 1549230021 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 313 | h, w = map(int, input().split
if h % 3 == 0 and w % 3 == 0:
print(0)
else:
ans_h0 = h//2
ans_h1 = max(h//2+w//3+1, w//3*2+1)
ans_w0 = w//2
ans_w1 = max(w//2+h//3+1, h//3*2+1)
print(min((1-h % 2)*ans_h0+(h % 2)*ans_h1,
(1-w % 2)*ans_w0+(w % 2)*ans_w1))
|
s428056765 | p03713 | u239981649 | 1549229976 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 314 | h, w = map(int, input().split
if h % 3 == 0 and w % 3 == 0:
print(0)
else:
ans_h0 = h//2
ans_h1 = max(h//2+w//3+1, w//3*2+1)
ans_w0 = w//2
ans_w1 = max(w//2+h//3+1, h//3*2+1)
print(min((1-h % 2)*ans_h0+(h % 2)*ans_h1,
(1-w % 2)*ans_w0+(w % 2)*ans_w1))
|
s318510584 | p03713 | u026102659 | 1547124528 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 890 | H, W = map(int, input().split())
ans = 0
if (H%3 == 0) or (W%3 == 0):
ans = 0
elif H%3 == 1:
smax = (H//3)*W
h = H - H//3
if (H%2 == 0) or (W%2 == 0):
smin = h*W//2
else:
simn = max((h//2)*W, h*(W//2))
ans = smax - smin
else:
smax = (H//3 + 1)*W
h = H - (H//3 + 1)
if... |
s287164220 | p03713 | u427344224 | 1545683321 | Python | Python (3.4.3) | py | Runtime Error | 236 | 11032 | 707 | H, W = map(int, input().split())
result = []
for h in range(1, (H+1)//2):
Sa = W * h
remain = H - h
h2 = (remain + 1) // 2
Sb1 = W * h2
Sc1 = W * (remain - h2)
result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))
w = (W + 1) // 2
Sb2 = w * remain
Sc2 = (W - w) * remain
result.... |
s549839429 | p03713 | u539402331 | 1545416688 | Python | PyPy3 (2.4.0) | py | Runtime Error | 176 | 39892 | 302 | h, w = map(int, input().split())
div1 = 0,div2 = 0
if h%3==0 or w%3==0:
print("0")
else:
div1 = min(h, w)
def div2(h, w):
m = h*w
for l in range(1, w):
s = [l*h, (w-l)*(h-h//2), (w-l)*(h//2)]
m = min(m, max(s)-min(s))
return m
div2 = min(div2(h, w), div2(w, h))
print(min(div1, div2))
|
s290835958 | p03713 | u179169725 | 1543079488 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 44 | if err2 < err:
err = err2 |
s306566078 | p03713 | u037098269 | 1542648518 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 638 | h, w = map(int, input().split())
if h % 3 == 0 or w % 3 == 0:
print(0)
else:
if w % 2 == 1:
if h % 2 == 1:
s_max1 = h*(w-1)/2
s_max2 = ((h-1)/2)*w
s_min = ((h-1)/2)*((w+1)/2)
else:
s_max1 = h*(w-1)/2
s_max2 = (h/2)*w
s_min =... |
s662284306 | p03713 | u652150585 | 1542323625 | Python | Python (3.4.3) | py | Runtime Error | 301 | 11032 | 373 | h,w=map(int,input().split())
s=[]
if h%3==0 or w%3==0:
print(0)
else:
for i in range(1,h):
a=max(i*w,((h-i)*(w//2)),w*(h-i)//2)
b=min(i*w,((h-i)*(w//2)),w*(h-i)//2)
s.append((abs(a-b)))
for j in range(1,w):
a=max(h*j,(h//2)*(w-j),h*((w-j)//2))
b=min(h*j,(h//2)*(w-j),h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.