buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
H, W = map(int, input().split()) D = H * W if H == 1 or W == 1: print(0) exit() if D % 2: print(D//2+1) else: print(D//2)
H, W = map(int, input().split()) D = H * W if H == 1 or W == 1: print(1) exit() if D % 2: print(D//2+1) else: print(D//2)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
58
from math import ceil h, w = map(int, input().split()) if h == 1 or w == 1: print(0) exit() if w % 2 == 0: ans = (w // 2) * h else: ans = (w // 2) * h + (ceil(h / 2)) print(ans)
from math import ceil h, w = map(int, input().split()) if h == 1 or w == 1: print(1) exit() if w % 2 == 0: ans = (w // 2) * h else: ans = (w // 2) * h + (ceil(h / 2)) print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
76
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { long long a, b, c; cin >> a >> b;...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { long long a, b, c; cin >> a >> b;...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
115
h,w=map(int,input().split()) print(1if min(h,w)else(h*w+2-1)//2)
h,w=map(int,input().split()) print(1 if min(h,w)==1 else (h*w+1)//2)
[["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 60], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 0, 612], ["-", 0, 657, 31, 23, 0, 657, 31, 657, 12, 612], ["-", 0, 41, 0, 657, 31, 23, 0, 657, 17, 33]]
5
39
<?php list($h, $w) = explode(' ', trim(fgets(STDIN))); if($h == 1 || $w == 1){ echo 0; exit; } $ans = 0; if($h % 2){ if($w % 2){ $ans = $h * floor($w / 2) + ceil($h / 2); }else{ $ans = $h * $w / 2; } }else{ $ans = ($h / 2) * $w; } echo (int)$ans; ?>
<?php list($h, $w) = explode(' ', trim(fgets(STDIN))); if($h == 1 || $w == 1){ echo 1; exit; } $ans = 0; if($h % 2){ if($w % 2){ $ans = $h * floor($w / 2) + ceil($h / 2); }else{ $ans = $h * $w / 2; } }else{ $ans = ($h / 2) * $w; } echo (int)$ans; ?>
[["-", 0, 493, 0, 57, 8, 9, 0, 608, 0, 612], ["+", 0, 493, 0, 57, 8, 9, 0, 608, 0, 612]]
6
127
h,w=map(int,input().split()) if h==1 and w==1: print(1) elif h%2!=0 and w%2!=0: print(h*w//2+1) else: print(h*w//2)
h,w=map(int,input().split()) if h==1 or w==1: print(1) elif h%2!=0 and w%2!=0: print(h*w//2+1) else: print(h*w//2)
[["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354]]
5
62
arg = input().split(' ') H = int(arg[0]) W = int(arg[1]) if H == 1 or W == 1: print(1) w_odd = (W+1) // 2 w_even = W // 2 h_odd_line = (H+1) // 2 h_even_line = H // 2 reachable = w_odd * h_odd_line + w_even * h_even_line print(reachable)
arg = input().split(' ') H = int(arg[0]) W = int(arg[1]) if H == 1 or W == 1: print(1) exit(0) w_odd = (W+1) // 2 w_even = W // 2 h_odd_line = (H+1) // 2 h_even_line = H // 2 reachable = w_odd * h_odd_line + w_even * h_even_line print(reachable)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
84
import sys input = sys.stdin.readline import math H, W = map(int, input().split(' ')) ans = (H * W) // 2 if H % 2 == 1 and W % 2 == 1: ans += 1 if H == 1 and W == 1: ans = 0 print(ans)
import sys input = sys.stdin.readline import math H, W = map(int, input().split(' ')) ans = (H * W) // 2 if H % 2 == 1 and W % 2 == 1: ans += 1 if H == 1 or W == 1: ans = 1 print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
71
#include <bits/stdc++.h> #define INF 2e9 using namespace std; typedef long long llong; typedef long double ldouble; using Graph = vector<vector<int>>; int main() { llong H, W; cin >> H >> W; if (H == 1 || W == 1) cout << 1 << endl; return 0; if (H % 2 == 0) { cout << H / 2 * W << endl; } else { ...
#include <bits/stdc++.h> #define INF 2e9 using namespace std; typedef long long llong; typedef long double ldouble; using Graph = vector<vector<int>>; int main() { llong H, W; cin >> H >> W; if (H == 1 || W == 1) { cout << 1 << endl; return 0; } if (H % 2 == 0) { cout << H / 2 * W << endl; } e...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
134
H,W = map(int,input().split()) if H == 1: print(1) elif H % 2 == 0: print(H*W //2) else: print((H-1)*W //2 + (W//2 + W%2))
H,W = map(int,input().split()) if H == 1 or W == 1: print(1) elif H % 2 == 0: print(H*W //2) else: print((H-1)*W //2 + (W//2 + W%2))
[["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 667, 60], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612]]
5
64
#B - Bishop import math H,W= map(int, input().split()) if H == 0 or W == 0: print(1) else: print(int(math.ceil(H/2) * math.ceil(W/2) + math.floor(H/2)*math.floor(W/2)))
#B - Bishop import math H,W= map(int, input().split()) if H == 1 or W == 1: print(1) else: print(int(math.ceil(H/2) * math.ceil(W/2) + math.floor(H/2)*math.floor(W/2)))
[["-", 0, 656, 0, 57, 15, 679, 31, 666, 0, 612], ["+", 0, 656, 0, 57, 15, 679, 31, 666, 0, 612], ["-", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612]]
5
75
def main(): h, w = map(int, input().split()) if h == 1 or w == 1: print(1) else: print(int(w * h / 2)) if __name__ == '__main__': main()
def main(): h, w = map(int, input().split()) if h == 1 or w == 1: print(1) else: print((w * h + 1) // 2) if __name__ == '__main__': main()
[["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 17, 85], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 17, 72], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 676], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
57
h, w = map(int, input().split()) if h == 1 or w == 1: print(1) else: if a*w%2 != 0: print(a*w//2 + 1) else: print(a*w//2)
h, w = map(int, input().split()) if h == 1 or w == 1: print(1) else: if h*w%2 != 0: print(h*w//2 + 1) else: print(h*w//2)
[["-", 0, 57, 15, 666, 0, 657, 31, 657, 31, 22], ["+", 0, 57, 15, 666, 0, 657, 31, 657, 31, 22], ["-", 3, 4, 0, 657, 31, 657, 31, 657, 31, 22], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 31, 22], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 31, 22]]
5
60
H,W = map(int,input().split()) if(min(H,W) == 1): print(0) exit() print((H*W+((H*W)%2))//2)
H,W = map(int,input().split()) if(min(H,W) == 1): print(1) exit() print((H*W+(H*W)%2)//2)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["-", 0, 657, 31, 23, 0, 657, 12, 23, 0, 24], ["-", 0, 657, 31, 23, 0, 657, 12, 23, 0, 25]]
5
55
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using p = pair<int, int>; int main() { int H, W; cin >> H >> W; if (W == 1 || H == 1) { cout << 1 << endl; } else if (W % 2 == 0) { int ans = (H * W) / 2; cout << ans << endl; } el...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using p = pair<int, int>; int main() { ll H, W; cin >> H >> W; if (W == 1 || H == 1) { cout << 1 << endl; } else if (W % 2 == 0) { ll ans = (H * W) / 2; cout << ans << endl; } else...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 75, 76, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 75, 76, 0, 57, 64, 9, 0, 43, 39, 78], ["-", 0, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 0, 9, 0, 57, 64, 9, 0, 43, 39, 78], ["-", 0, 57, 75, 76, 0, 9, 0, 43, 39, 40], ["+", 0, 57, 75, 76,...
1
174
#include <iostream> using namespace std; long H, W; int main() { cin >> H >> W; if (H == 1 || W == 1) { cout << 0 << endl; } else if ((H * W) % 2 == 0) { cout << H * W / 2 << endl; } else { cout << (((H * W) - 1) / 2) + 1 << endl; } return 0; }
#include <iostream> using namespace std; long H, W; int main() { cin >> H >> W; if (H == 1 || W == 1) { cout << 1 << endl; } else if ((H * W) % 2 == 0) { cout << H * W / 2 << endl; } else { cout << (((H * W) - 1) / 2) + 1 << endl; } return 0; }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
92
h, w = map(int, input().split()) ans = (h * w - 1) // 2 if h == 1 or w == 1: ans = 1 print(ans)
h, w = map(int, input().split()) ans = (h * w + 1) // 2 if h == 1 or w == 1: ans = 1 print(ans)
[["-", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 72]]
5
43
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int h = Integer.parseInt(sc.next()); int w = Integer.parseInt(sc.next()); long ans = h; if (h == 1) { System.out.println(1); return; } if (w % 2 == 0...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int h = Integer.parseInt(sc.next()); int w = Integer.parseInt(sc.next()); long ans = h; if (h == 1 || w == 1) { System.out.println(1); return; } if (...
[["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 106], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 12, 499]]
3
163
from collections import deque, defaultdict, Counter from math import ceil, floor import sys def input(): return sys.stdin.readline().strip() H, W = map(int, input().split()) if H == 1 or W == 1: print(0) exit() if H > W: H, W = W, H # print(H, W) ans = W * (H // 2) # print(ans) if H % 2 == 1: # ...
from collections import deque, defaultdict, Counter from math import ceil, floor import sys def input(): return sys.stdin.readline().strip() H, W = map(int, input().split()) if H == 1 or W == 1: print(1) exit() if H > W: H, W = W, H # print(H, W) ans = W * (H // 2) # print(ans) if H % 2 == 1: # ...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
110
from decimal import Decimal, getcontext a, b = map(int, input().split()) getcontext().prec = 50 c = Decimal(a) * Decimal(b) if a == 1 or b == 1: print(0) else: if c % 2 == 1: print(int(c/2)+1) else: print(int(c/2))
from decimal import Decimal, getcontext a, b = map(int, input().split()) getcontext().prec = 50 c = Decimal(a) * Decimal(b) if a == 1 or b == 1: print(1) else: if c % 2 == 1: print(int(c/2)+1) else: print(int(c/2))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
84
H, W = [int(i) for i in input().split()] if H==1 or W==1: print(1) if H%2==0: H //= 2 print(H*W) elif W%2==0: W //= 2 print(H*W) else: W -= 1 c = (W//2)*H c += H//2 + 1 print(c)
H, W = [int(i) for i in input().split()] if H==1 or W==1: print(1) quit() if H%2==0: H //= 2 print(H*W) elif W%2==0: W //= 2 print(H*W) else: W -= 1 c = (W//2)*H c += H//2 + 1 print(c)
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
90
#include <stdio.h> int main(void) { unsigned long long int h, w; scanf("%lld%lld", &h, &w); if (h == 1 || w == 1) printf(1); unsigned long long int ans; ans = h * w / 2 + h * w % 2; printf("%lld", ans); // your code goes here return 0; }
#include <stdio.h> int main(void) { unsigned long long int h, w; scanf("%lld%lld", &h, &w); if (h == 1 || w == 1) { printf("1"); return 0; } unsigned long long int ans; ans = h * w / 2 + h * w % 2; printf("%lld", ans); // your code goes here return 0; }
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
0
78
H,W = map(int,input().split()) if(H == 1 or W == 1): print(1) else: if(H%2 == 0): i = H//2 if(H%2 != 0): i = H//2+1 j = H-i if(W%2 == 0): sum = i*(W//2) + j*(W//2) if(W%2 != 0): sum = i*(W/2+1) + j*(W/2) print(sum)
H,W = map(int,input().split()) if(H == 1 or W == 1): print(1) else: if(H%2 == 0): i = H//2 if(H%2 != 0): i = H//2 + 1 j = H-i if(W%2 == 0): sum = i*(W//2) + j*(W//2) if(W%2 != 0): sum = i*(W//2 + 1) + j*(W//2) print(sum)
[["-", 31, 657, 12, 23, 0, 657, 31, 657, 17, 85], ["+", 31, 657, 12, 23, 0, 657, 31, 657, 17, 676], ["-", 12, 657, 12, 657, 12, 23, 0, 657, 17, 85], ["+", 12, 657, 12, 657, 12, 23, 0, 657, 17, 676]]
5
126
hw = input('') h = int(hw.split(' ')[0]) w = int(hw.split(' ')[1]) if h == 1: result = 1 elif w == 1: result = 1 else: if h%2 == 0: if w%2 == 0: # 縦偶数x横偶数 result = w // 2 * h else: # 縦偶数x横奇数 result = (w//2 + 1) * h//2 + (w//2 * h//2) else: if w%2 == 0: # 縦奇数x横偶数 ...
hw = input('') h = int(hw.split(' ')[0]) w = int(hw.split(' ')[1]) if h == 1: # h=1の場合、移動できない result = 1 elif w == 1: # w=1の場合、移動できない result = 1 else: if h%2 == 0: if w%2 == 0: # 縦偶数x横偶数 result = w // 2 * h else: # 縦偶数x横奇数 result = (w//2 + 1) * h//2 + (w//2 * h//2) else: ...
[["+", 12, 657, 12, 23, 0, 657, 31, 23, 0, 24], ["+", 12, 657, 12, 23, 0, 657, 31, 23, 0, 25], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 24], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
158
ii = lambda : int(input()) mi = lambda : map(int,input().split()) li = lambda : list(map(int,input().split())) def main(): h,w = mi() if(h==1 | w==1): print(1) elif h%2 ==0: print((h//2) *w) elif w%2 ==0: print((w//2) *h) else: ans = (h-1)*(w-1)//2 + (h//2) + ...
ii = lambda : int(input()) mi = lambda : map(int,input().split()) li = lambda : list(map(int,input().split())) def main(): h,w = mi() if(h==1 or w==1): print(1) elif h%2 ==0: print((h//2) *w) elif w%2 ==0: print((w//2) *h) else: ans = (h-1)*(w-1)//2 + (h//2) +...
[["-", 0, 57, 15, 23, 0, 666, 0, 657, 17, 139], ["+", 8, 196, 0, 57, 15, 23, 0, 679, 17, 354]]
5
151
h, w = map(int, input().split()) if h == 1 and w == 1: print(0) elif h % 2 == 1 and w % 2 == 1: print((h - 1) * w // 2 + (w+1) // 2 ) else: print(h*w//2)
h, w = map(int, input().split()) if h == 1 or w == 1: print(1) elif h % 2 == 1 and w % 2 == 1: print((h - 1) * w // 2 + (w+1) // 2 ) else: print(h*w//2)
[["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
72
H , W = input().split() W = (W) H = int(H) ans = int(0) #Wが偶数なら(W//2)*H #W.Hが奇数なら((W+1)//2)*((H+1)//2) + ((W - 1)//2*(H - 1)//2) #Wが奇数Hが偶数(W+1)//2*(H//2) + ((W - 1)//2)*(H//2) if(W == H == 1): ans =1 elif(W%2 == 0): ans = (W//2)*H elif(W%2 == 1 and H%2==1): ans = (((W+1)//2)*((H+1)//2)) + (((W - 1)//2)*(...
H , W = input().split() W = int(W) H = int(H) ans = int(0) #Wが偶数なら(W//2)*H #W.Hが奇数なら((W+1)//2)*((H+1)//2) + ((W - 1)//2*(H - 1)//2) #Wが奇数Hが偶数(W+1)//2*(H//2) + ((W - 1)//2)*(H//2) if(W == 1 or H == 1): ans = 1 elif(W%2 == 0): ans = (W//2)*H elif(W%2 == 1 and H%2==1): ans = (((W+1)//2)*((H+1)//2)) + (((W -...
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 57, 15, 23, 0, 679, 31, 666, 0, 612], ["+", 0, 656, 0, 57, 15, 23, 0, 679, 17, 354]]
5
177
hw = list(map(int, input().split())) if hw[0] == 1 or hw[1] == 1: count = 0 elif hw[0] % 2 == 0 and hw[1] % 2 == 0: count = (hw[0] * hw[1]) // 2 elif hw[0] % 2 != 0 and hw[1] % 2 == 0: count = ((hw[0] + 1) * hw[1] // 2) - (hw[1] // 2) elif hw[0] % 2 == 0 and hw[1] % 2 != 0: count = ((hw[1] + 1) * hw[0]...
hw = list(map(int, input().split())) if hw[0] == 1 or hw[1] == 1: count = 1 elif hw[0] % 2 == 0 and hw[1] % 2 == 0: count = (hw[0] * hw[1]) // 2 elif hw[0] % 2 != 0 and hw[1] % 2 == 0: count = ((hw[0] + 1) * hw[1] // 2) - (hw[1] // 2) elif hw[0] % 2 == 0 and hw[1] % 2 != 0: count = ((hw[1] + 1) * hw[0]...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
218
#include <bits/stdc++.h> using namespace std; long long h, w; int main() { cin >> h >> w; if (h == 1 || w == 1) { cout << 0; return 0; } if ((h * w) % 2 == 0) cout << h * w / 2; else cout << (h * w + 1) / 2; return 0; }
#include <bits/stdc++.h> using namespace std; long long h, w; int main() { cin >> h >> w; if (h == 1 || w == 1) { cout << 1; return 0; } if ((h * w) % 2 == 0) cout << h * w / 2; else cout << (h * w + 1) / 2; return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13]]
1
79
input_line = input() Line = input_line.split() Line = [int(s) for s in Line] if Line[0] ==1 or Line[1] == 1: print("0") else: print(-(-Line[0]*Line[1] // 2))
input_line = input() Line = input_line.split() Line = [int(s) for s in Line] if Line[0] ==1 or Line[1] == 1: print("1") else: print(-(-Line[0]*Line[1] // 2))
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
65
h, w = map(int, input().split()) if h == 0: print(1) elif w == 0: print(1) else: print((h * w + 1)// 2)
h, w = map(int, input().split()) if h == 1: print(1) elif w == 1: print(1) else: print((h * w + 1)// 2)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["-", 0, 656, 0, 57, 75, 665, 15, 666, 0, 612], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 0, 612]]
5
48
import math h, w = map(int, input().split()) if h == 0 or w == 0: count = 1 else: if w % 2 == 0: count = int(w / 2) * h else: c1 = int(math.ceil(w / 2)) c2 = int(math.floor(w / 2)) if h % 2 == 0: count = (c1 + c2) * int(h / 2) else: count = (c1 + c2) * int(math.floor(h / 2)) + c1 ...
import math h, w = map(int, input().split()) if h == 1 or w == 1: count = 1 else: if w % 2 == 0: count = int(w / 2) * h else: c1 = int(math.ceil(w / 2)) c2 = int(math.floor(w / 2)) if h % 2 == 0: count = (c1 + c2) * int(h / 2) else: count = (c1 + c2) * int(math.floor(h / 2)) + c1...
[["-", 0, 656, 0, 57, 15, 679, 31, 666, 0, 612], ["+", 0, 656, 0, 57, 15, 679, 31, 666, 0, 612], ["-", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612]]
5
125
h, w = [int(x) for x in input().split()] if h==1: print(1) quit() if w==1: print(1) quit() if h%2==0 and w%2==0: print(h*w//2) elif h%2==0 and w%2==1: print(h*w//2) elif h%2==1 and w%2==0: print((h*w)//2+1) else: print((h*w)//2+1)
h, w = [int(x) for x in input().split()] if h==1: print(1) quit() if w==1: print(1) quit() if h%2==0 and w%2==0: print(h*w//2) elif h%2==0 and w%2==1: print(h*w//2) elif h%2==1 and w%2==0: print((h*w)//2) else: print((h*w)//2+1)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
125
H, W = map(int, input().split()) if H == 1 or W == 1: ans = 1 elif H % 2 == 0: if W % 2 == 0: ans = H*(W//2) else: ans = H*((W-1)//2)+(H//12) elif H % 2 == 1: if W % 2 == 0: ans = H*(W//2) else: # W%2==1 ans = H*((W-1)//2)+((H+1)//2) print(ans)
H, W = map(int, input().split()) if H == 1 or W == 1: ans = 1 elif H % 2 == 0: if W % 2 == 0: ans = H*(W//2) else: ans = H*((W-1)//2)+(H//2) elif H % 2 == 1: if W % 2 == 0: ans = H*(W//2) else: # W%2==1 ans = H*((W-1)//2)+((H+1)//2) print(ans)
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612]]
5
125
h, w = map(int, input().split(' ')) if ((h == 1) or (w == 1)): a1 = 0 elif(((h * w) % 2) == 1): a1 = ((h * w) // 2) + 1 elif(((h * w) % 2) == 0): a1 = (h * w) // 2 print(a1)
h, w = map(int, input().split(' ')) a1 = 0 if ((h == 1) or (w == 1)): a1 = 1 elif(((h * w) % 2) == 1): a1 = ((h * w) // 2) + 1 elif(((h * w) % 2) == 0): a1 = (h * w) // 2 print(a1)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
93
#include <bits/stdc++.h> using namespace std; #define REP1(i, n) for (int i = 1, i##_len = (n); i < i##_len; ++i) #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define pow(x) x *x #define ll long long static const ll MAX = 1000000; static const ll INFTY = 1e12; struct edge { ll to, cost; }; u...
#include <bits/stdc++.h> using namespace std; #define REP1(i, n) for (int i = 1, i##_len = (n); i < i##_len; ++i) #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define pow(x) x *x #define ll long long static const ll MAX = 1000000; static const ll INFTY = 1e12; struct edge { ll to, cost; }; u...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
223
h, w = map(int, input().split()) boad = h * w if w == 1 and h == 1: print(1) else: print((boad + 1) // 2)
h, w = map(int, input().split()) boad = h * w if w == 1 or h == 1: print(1) else: print((boad + 1) // 2)
[["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354]]
5
46
h,w=gets.split.map(&:to_i) puts h==1 && w==1 ? 1 : (h*w+1)/2
h,w=gets.split.map(&:to_i) puts h==1 || w==1 ? 1 : (h*w+1)/2
[["-", 0, 652, 3, 4, 0, 754, 15, 738, 17, 98], ["+", 0, 652, 3, 4, 0, 754, 15, 738, 17, 106]]
4
33
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define fast() \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cou...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define fast() \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cou...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
89
#include <algorithm> #include <cstdio> using namespace std; int main() { long long x, y; scanf("%lld%lld", &x, &y); if (x == 1 || y == 1) { printf("1\n"); return 0; } long long ans = x * y; printf("%lld\n", ans % 2 == 1 ? ans / 2 + 1 : ans); return 0; }
#include <algorithm> #include <cstdio> using namespace std; int main() { long long x, y; scanf("%lld%lld", &x, &y); if (x == 1 || y == 1) { printf("1\n"); return 0; } long long ans = x * y; printf("%lld\n", ans % 2 == 1 ? ans / 2 + 1 : ans / 2); return 0; }
[["+", 0, 2, 3, 4, 0, 41, 75, 16, 17, 85], ["+", 0, 2, 3, 4, 0, 41, 75, 16, 12, 13]]
1
89
H, W = gets.chomp.split.map(&:to_i) area = (H * W).to_i area_half = (area / 2).to_i if H == 1 || W == 1 puts 0 elsif area == 2 || 1 puts 0 elsif area.even? puts area_half elsif !area.even? puts (area_half) + 1 end
H, W = gets.chomp.split.map(&:to_i) area = (H * W).to_i area_half = (area / 2).to_i if H == 1 || W == 1 || area == 2 puts 1 elsif area.even? puts area_half elsif !area.even? puts (area_half) + 1 end
[["-", 0, 493, 0, 121, 64, 749, 0, 652, 735, 22], ["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 612], ["-", 36, 36, 0, 493, 0, 121, 75, 759, 0, 759], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 106], ["-", 0, 493, 0, 121, 75, 759, 15, 738, 17, 106], ["-", 0, 493, 0, 121, 75, 759, 15, 738, 12, 612], ["-", 75, 759, 64, 749, 0, ...
4
69
#!/usr/bin/env python3 H, W = [int(str) for str in input().strip().split()] print((H * W + 1) // 2 if H != 0 and W != 0 else 1)
#!/usr/bin/env python3 H, W = [int(str) for str in input().strip().split()] print((H * W + 1) // 2 if H != 1 and W != 1 else 1)
[["-", 3, 4, 0, 41, 0, 679, 31, 666, 0, 612], ["+", 3, 4, 0, 41, 0, 679, 31, 666, 0, 612], ["-", 3, 4, 0, 41, 0, 679, 12, 666, 0, 612], ["+", 3, 4, 0, 41, 0, 679, 12, 666, 0, 612]]
5
47
h, w = map(int, input().split()) mas = h*w if mas == 1: print(1) exit() if mas % 2 == 0: print(mas//2) else: print(mas//2+1)
h, w = map(int, input().split()) mas = h*w if h == 1 or w == 1: print(1) exit() if mas % 2 == 0: print(mas//2) else: print(mas//2+1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 31, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 31, 666, 667, 60], ["+", 0, 656, 0, 57, 15, 679, 31, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22]]
5
56
def main(): w, h = map(int, input().split()) if w == 1 or h == 1: print(1) h1 = (h + 1) // 2 h2 = h // 2 if (w % 2) == 1: print(h1 * ((w // 2) + 1) + (h2 * (w // 2))) else: print((h1 + h2) * (w // 2)) if __name__ == "__main__": main()
def main(): w, h = map(int, input().split()) if w == 1 or h == 1: print(1) exit() h1 = (h + 1) // 2 h2 = h // 2 if (w % 2) == 1: print(h1 * ((w // 2) + 1) + (h2 * (w // 2))) else: print((h1 + h2) * (w // 2)) if __name__ == "__main__": main()
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
107
import sys input = sys.stdin.readline H, W = [int(x) for x in input().split()] ans = 0 if H == 1 and W == 1: print(1) sys.exit() if H == 1 or W == 1: print(1) sys.exit() # type2 b = H // 2 # type1 a = H - b ans += a * (W // 2) ans += b * (W - (W // 2)) print(ans)
import sys input = sys.stdin.readline H, W = [int(x) for x in input().split()] ans = 0 if H == 1 and W == 1: print(1) sys.exit() if H == 1 or W == 1: print(1) sys.exit() # type2 b = H // 2 # type1 a = H - b ans += b * (W // 2) ans += a * (W - (W // 2)) print(ans)
[["-", 0, 656, 0, 1, 0, 677, 12, 657, 31, 22], ["+", 0, 656, 0, 1, 0, 677, 12, 657, 31, 22]]
5
106
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define pb push_back #define fast_cin() ...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define pb push_back #define fast_cin() ...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13]]
1
162
from math import ceil h,w = map(int,input().split()) ans = h * (w // 2) if w % 2 != 0 : ans += ceil(h/2) if h==1 and w==1: ans = 1 print(ans)
from math import ceil h,w = map(int,input().split()) ans = h * (w // 2) if w % 2 != 0 : ans += ceil(h/2) if h == 1 or w == 1: ans = 1 print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354]]
5
60
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REP1(i, n) for (int i = 1; i < n + 1; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() #define ARRAY_LENGTH(array) (sizeof(array) / sizeof...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REP1(i, n) for (int i = 1; i < n + 1; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() #define ARRAY_LENGTH(array) (sizeof(array) / sizeof...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
135
a=gets.chomp.split.map(&:to_i) b=0 if a[0]==1&&a[1]==1 puts 1 else if a[0]%2==0&&a[1]%2==0 puts a[0]*a[1]/2 elsif a[0]%2==0&&a[1]%2!=0 puts (a[0]*(a[1]-1)/2)+(a[0]-a[0]/2) elsif a[1]%2==0&&a[0]%2!=0 puts (a[1]*(a[0]-1)/2)+(a[1]-a[1]/2) else puts (a[1]-1)*(a[0]-1)/2+(a[1]-a[1]/2)+(a[0]-a[0]/...
a=gets.chomp.split.map(&:to_i) b=0 if a[0]==1||a[1]==1 puts 1 else if a[0]%2==0&&a[1]%2==0 puts a[0]*a[1]/2 elsif a[0]%2==0&&a[1]%2!=0 puts (a[0]*(a[1]-1)/2)+(a[0]-a[0]/2) elsif a[1]%2==0&&a[0]%2!=0 puts (a[1]*(a[0]-1)/2)+(a[1]-a[1]/2) else puts (a[1]-1)*(a[0]-1)/2+(a[1]-a[1]/2)+(a[0]-a[0]...
[["-", 36, 36, 0, 493, 0, 121, 15, 738, 17, 98], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 106]]
4
216
h,w=map(int,input().split()) if h==1 or w==1: print('0') else: print((h*w+1)//2)
h,w=map(int,input().split()) if h==1 or w==1: print('1') else: print((h*w+1)//2)
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
45
[h,w] = [int(x) for x in input().split()] if h == 1: print(1) else: row1 = w//2 + w%2 row2 = w//2 total = (row1 * (h//2+h%2)) + (row2 * (h//2)) print(total)
[h,w] = [int(x) for x in input().split()] if h == 1 or w == 1: print(1) else: row1 = w//2 + w%2 row2 = w//2 total = (row1 * (h//2+h%2)) + (row2 * (h//2)) print(total)
[["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 667, 60], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612]]
5
76
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b, c, d; cin >> a >> b; c = a * b; d = c / 2; if ((a == 0) || (b == 0)) { cout << 0 << endl; } else if ((a == 1) || (b == 1)) { cout << 1 << endl; } else if ((a % 2 == 0) || (b % 2 == 0)) { cout << (a * b) / 2 <...
#include <algorithm> #include <iostream> using namespace std; int main() { long long int a, b, c, d; cin >> a >> b; c = a * b; d = c / 2; if ((a == 0) || (b == 0)) { cout << 0 << endl; } else if ((a == 1) || (b == 1)) { cout << 1 << endl; } else if ((a % 2 == 0) || (b % 2 == 0)) { cout << (a ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
139
def resolve(): H, W = map(int, input().split()) if H == 1: print(1) return count = H * W ans = count // 2 if count % 2 != 0: ans += 1 print(ans) resolve()
def resolve(): H, W = map(int, input().split()) if H == 1 or W == 1: print(1) return count = H * W ans = count // 2 if count % 2 != 0: ans += 1 print(ans) resolve()
[["+", 0, 14, 8, 196, 0, 57, 15, 679, 17, 354], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 60], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 612]]
5
58
H, W = [int(x) for x in input().split()] if H == 1 or W == 1: print(0) else: print(-(-H * W //2))
H, W = [int(x) for x in input().split()] if H == 1 or W == 1: print(1) else: print(-(-H * W //2))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
47
def resolve(): h, w = map(int, input().split()) dy = h // 2 if h != 1 else 1 if h == 1 or w == 1: count = 1 elif h % 2 == 1: count = w * dy + (w-1) else: count = w * dy print(count) if __name__ == '__main__': resolve()
def resolve(): h, w = map(int, input().split()) dy = h // 2 if h != 1 else 1 if h == 1 or w == 1: count = 1 elif h % 2 == 1: count = w * dy + (w - (w // 2)) else: count = w * dy print(count) if __name__ == '__main__': resolve()
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 24], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 31, 22], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 17, 676], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 12, 612], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
83
#include <bits/stdc++.h> using namespace std; typedef long long ll; double getTime() { return clock() / (double)CLOCKS_PER_SEC; } void read(){}; template <typename T, typename... Args> void read(T &a, Args &...args) { cin >> a; read(args...); } void print(){}; template <typename T, typename... Args> void pri...
#include <bits/stdc++.h> using namespace std; typedef long long ll; double getTime() { return clock() / (double)CLOCKS_PER_SEC; } void read(){}; template <typename T, typename... Args> void read(T &a, Args &...args) { cin >> a; read(args...); } void print(){}; template <typename T, typename... Args> void pri...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 354], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
176
# -*- coding: utf-8 -*- import math def main(): h, w = map(int, input().split()) result = 0 if h == 1: result = 1 else: result = w * (h // 2) if h % 2 == 1: result += math.ceil(w / 2) print(int(result)) if __name__ == '__main__': main()
# -*- coding: utf-8 -*- import math def main(): h, w = map(int, input().split()) result = 0 if h == 1 or w == 1: result = 1 else: result = w * (h // 2) if h % 2 == 1: result += math.ceil(w / 2) print(int(result)) if __name__ == '__main__': main()
[["+", 0, 14, 8, 196, 0, 57, 15, 679, 17, 354], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 60], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 612]]
5
80
import math H, W = map(int, input().split()) base = math.ceil(W / 2) if H == 1: print(1) exit() if W % 2 == 0: ans = base * H else: if H % 2 == 1: ans = (base + base -1) * (H - 1) // 2 + base else: ans = (base + base -1) * H // 2 print(ans)
import math H, W = map(int, input().split()) base = math.ceil(W / 2) if H == 1 or W == 1: print(1) exit() if W % 2 == 0: ans = base * H else: if H % 2 == 1: ans = (base + base -1) * (H - 1) // 2 + base else: ans = (base + base -1) * H // 2 print(ans)
[["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 667, 60], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612]]
5
99
h, w = map(int, input().split()) ans = 0 if h != 1 and w != 1: ans = (h//2) * w if h%2 == 1: c = w - w//2 ans += c print(ans)
h, w = map(int, input().split()) ans = 1 if h != 1 and w != 1: ans = (h//2) * w if h%2 == 1: c = w - w//2 ans += c print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
58
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll h, w; cin >> h >> w; if (h == 1 || w == 1) cout << 0; else if ((h % 2 != 0) && (w % 2 != 0)) cout << (h * w + 1) / 2; else cout << h * w / 2; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll h, w; cin >> h >> w; if (h == 1 || w == 1) cout << 1; else if ((h % 2 != 0) && (w % 2 != 0)) cout << (h * w + 1) / 2; else cout << h * w / 2; }
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 13]]
1
83
# -*- coding: utf-8 -*- H, W = map(int, input().split()) if H==1 or W==1: ans = 0 elif H%2==0 or W%2==0: ans = H*W // 2 else: ans = (H*W//2) + 1 print(ans)
# -*- coding: utf-8 -*- H, W = map(int, input().split()) if H==1 or W==1: ans = 1 elif H%2==0 or W%2==0: ans = H*W // 2 else: ans = (H*W//2) + 1 print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
66
H, W = gets.split.map(&:to_i) if H == 1 puts 1 exit 0 end if H.even? && W.even? puts H * W / 2 exit 0 end if H.even? puts H * W / 2 else puts ((H - 1) * W / 2) + (W + 1) / 2 end
H, W = gets.split.map(&:to_i) if H == 1 || W == 1 puts 1 exit 0 end if H.even? && W.even? puts H * W / 2 exit 0 end if H.even? puts H * W / 2 else puts ((H - 1) * W / 2) + (W + 1) / 2 end
[["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 106], ["+", 0, 493, 0, 121, 15, 738, 12, 738, 31, 743], ["+", 0, 493, 0, 121, 15, 738, 12, 738, 17, 60], ["+", 0, 493, 0, 121, 15, 738, 12, 738, 12, 612]]
4
71
H,W=map(int,input().split()) if H==1 or W==1: print(0) else: print(((H+1)//2)*((W+1)//2)+(W//2)*(H//2))
H,W=map(int,input().split()) if H==1 or W==1: print(1) else: print(((H+1)//2)*((W+1)//2)+(W//2)*(H//2))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
65
h, w = gets.chomp.split(' ').map(&:to_i) if h == 1 || w == 1 puts 0 else a = h * w if a % 2 == 1 puts a / 2 + 1 else puts a / 2 end end
h, w = gets.chomp.split(' ').map(&:to_i) if h == 1 || w == 1 puts 1 else a = h * w if a % 2 == 1 puts a / 2 + 1 else puts a / 2 end end
[["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 612], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 612]]
4
55
#include <algorithm> #include <bitset> #include <cctype> #include <cstdlib> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include ...
#include <algorithm> #include <bitset> #include <cctype> #include <cstdlib> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include ...
[["+", 15, 339, 51, 16, 31, 16, 31, 23, 0, 24], ["+", 15, 339, 51, 16, 31, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 139], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
1,472
#include <array> #include <bits/stdc++.h> #define nguyendz the_best #define ll long long #define ld long double #define pb push_back #define all(n) n.begin(), n.end() #define eb emplace_back #define endl "\n" #define pll pair<ll, ll> #define YES cout << "YES" << endl; #define NO cout << "NO" << endl; #define ff first ...
#include <array> #include <bits/stdc++.h> #define nguyendz the_best #define ll long long #define ld long double #define pb push_back #define all(n) n.begin(), n.end() #define eb emplace_back #define endl "\n" #define pll pair<ll, ll> #define YES cout << "YES" << endl; #define NO cout << "NO" << endl; #define ff first ...
[["-", 75, 76, 0, 57, 15, 339, 51, 91, 17, 111], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13], ["-", 75, 76, 0, 9, 0, 1, 0, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 13]]
1
538
#include <bits/stdc++.h> using namespace std; #define m_p make_pair mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); mt19937 rnf(2106); const int N = 1000006; int n; int q(int x) { int u = 2; int ans = 0; while (u <= x) { ans += (x / u); u *= 2; } return ans; } char b[N]; int so...
#include <bits/stdc++.h> using namespace std; #define m_p make_pair mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); mt19937 rnf(2106); const int N = 1000006; int n; int q(int x) { int u = 2; int ans = 0; while (u <= x) { ans += (x / u); u *= 2; } return ans; } char b[N]; int so...
[["+", 12, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 2, 3, 4, 0, 16, 31, 23, 0, 25]]
1
462
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <string> #include ...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <string> #include ...
[["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["-", 12, 16, 12, 23, 0, 16, 31, 16, 17, 109], ["-", 12, 16, 12, 23, 0, 16, 31, 16, 12, 13], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 12, 16, 12, 23, 0, 16, 12, 103, 0, 104], ["+", 12, 16, 12, 23, 0, 16, 12, 103, ...
1
654
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cout.tie(nullptr); cin.tie(nullptr); int n; cin >> n; bool one = 0; vector<int> a(n); for (int i = 0; i < n; ++i) { char c; cin >> c; a[i] = c - '1'; if (a[i] == 1) one = 1; } auto solv...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cout.tie(nullptr); cin.tie(nullptr); int n; cin >> n; bool one = 0; vector<int> a(n); for (int i = 0; i < n; ++i) { char c; cin >> c; a[i] = c - '1'; if (a[i] == 1) one = 1; } auto solv...
[["+", 0, 16, 31, 23, 0, 16, 31, 16, 12, 13], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["-", 0, 43, 49, 50, 51, 23, 0, 16, 17, 47], ["+", 0, 43, 49, 50, 51, 23, 0, 16, 17, 60]]
1
261
#include <algorithm> #include <stdio.h> int popcnt(int x) { x = (x & 0x55555555) + ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x & 0x0f0f0f0f) + ((x >> 4) & 0x0f0f0f0f); x = (x & 0x00ff00ff) + ((x >> 8) & 0x00ff00ff); x = (x & 0x0000ffff) + ((x >> 16) & 0x0000ffff); return...
#include <algorithm> #include <stdio.h> int popcnt(int x) { x = (x & 0x55555555) + ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x & 0x0f0f0f0f) + ((x >> 4) & 0x0f0f0f0f); x = (x & 0x00ff00ff) + ((x >> 8) & 0x00ff00ff); x = (x & 0x0000ffff) + ((x >> 16) & 0x0000ffff); return...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 60], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
317
#include <algorithm> #include <iostream> #include <numeric> #include <utility> #include <vector> template <class T, class U> inline bool chmin(T &lhs, const U &rhs) { if (lhs > rhs) { lhs = rhs; return true; } return false; } template <class T, class U> inline bool chmax(T &lhs, const U &rhs) { if (l...
#include <algorithm> #include <iostream> #include <numeric> #include <utility> #include <vector> template <class T, class U> inline bool chmin(T &lhs, const U &rhs) { if (lhs > rhs) { lhs = rhs; return true; } return false; } template <class T, class U> inline bool chmax(T &lhs, const U &rhs) { if (l...
[["-", 51, 218, 8, 9, 0, 37, 0, 16, 17, 79], ["-", 51, 218, 8, 9, 0, 37, 0, 16, 12, 13], ["+", 51, 218, 8, 9, 0, 37, 0, 16, 17, 60], ["+", 51, 218, 8, 9, 0, 37, 0, 16, 12, 22]]
1
662
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(x) (x).begin(), (x).end() #define ln '\n' constexpr long long MOD = 1000000007LL; // constexpr long long MOD = 998244353LL; typedef long long ll; typedef unsigned long long ull; typede...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(x) (x).begin(), (x).end() #define ln '\n' constexpr long long MOD = 1000000007LL; // constexpr long long MOD = 998244353LL; typedef long long ll; typedef unsigned long long ull; typede...
[["-", 0, 16, 31, 16, 12, 23, 0, 41, 64, 13], ["+", 0, 16, 31, 16, 12, 23, 0, 41, 64, 13]]
1
351
def main(): n = int(input()) a = list(map(lambda x: int(x)-1, list(input()))) b = [i % 2 for i in a] def all_a(x): ans = 0 for j, i in enumerate(x): ans ^= (n-1 | j == n-1)*i return ans all_b = all_a(b) if all_b == 1: print(1) return if 1...
def main(): n = int(input()) a = list(map(lambda x: int(x)-1, list(input()))) b = [i % 2 for i in a] def all_a(x): ans = 0 for j, i in enumerate(x): ans ^= (n-1 | j == n-1)*i return ans all_b = all_a(b) if all_b == 1: print(1) return if 1...
[["-", 0, 656, 0, 14, 8, 196, 0, 37, 0, 38], ["+", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
131
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define REP(i, k, n) for (long long i = k; i < (long long)(n); i++) #define all(a) a.begin(), a.end() #define pb push_back #define eb emplace_back #define lb(v, k) (lower_bound(all(v), k) - v.begin()) #define ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define REP(i, k, n) for (long long i = k; i < (long long)(n); i++) #define all(a) a.begin(), a.end() #define pb push_back #define eb emplace_back #define lb(v, k) (lower_bound(all(v), k) - v.begin()) #define ...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["-", 0, 57, 64, 1, 0, 11, 12, 91, 17, 111], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 13], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33]]
1
1,255
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> ...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> ...
[["+", 12, 11, 12, 23, 0, 16, 12, 103, 0, 104]]
1
622
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <utility> #include <vector> using namespace std; typedef ...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <utility> #include <vector> using namespace std; typedef ...
[["-", 0, 11, 12, 16, 31, 16, 12, 103, 0, 125], ["-", 0, 11, 12, 16, 31, 16, 12, 103, 0, 104], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
310
#include <bits/stdc++.h> #define forsn(i, s, n) for (int i = s; i < n; ++i) #define forn(i, n) for (int i = 0; i < n; ++i) using namespace std; const int maxn = 2e6; int val[maxn]; void init() { for (int k = 2; k < maxn; k *= 2) { for (int i = k; i < maxn; i += k) val[i]++; } forsn(i, 1, maxn) val[i] +...
#include <bits/stdc++.h> #define forsn(i, s, n) for (int i = s; i < n; ++i) #define forn(i, n) for (int i = 0; i < n; ++i) using namespace std; const int maxn = 2e6; int val[maxn]; void init() { for (int k = 2; k < maxn; k *= 2) { for (int i = k; i < maxn; i += k) val[i]++; } forsn(i, 1, maxn) val[i] +...
[["+", 0, 1, 0, 11, 12, 16, 12, 2, 63, 40], ["-", 12, 23, 0, 16, 31, 16, 31, 16, 17, 33], ["+", 12, 16, 12, 2, 3, 4, 0, 16, 17, 60], ["-", 12, 16, 12, 23, 0, 16, 31, 16, 17, 33], ["+", 12, 2, 3, 4, 0, 16, 12, 16, 17, 72], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 17, 47], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 12, 13]]
1
225
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; string s; cin >> s; vector<int> a; a.resize(n); for (int i = 0; i < n; ++i) { a[i] = s[i] - '0' - 1; } bool one = false; for (int i = 0; i < n; ++i) { if (a[...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; string s; cin >> s; vector<int> a; a.resize(n); for (int i = 0; i < n; ++i) { a[i] = s[i] - '0' - 1; } bool one = false; for (int i = 0; i < n; ++i) { if (a[...
[["+", 51, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 23, 0, 25]]
1
203
#include <bits/stdc++.h> using namespace std; int n, i, j, b[1000100], r; char a[1000100]; bool ok = false; int main() { scanf("%d", &n); scanf("%s", a); for (i = 0; i < n; i++) { a[i] = a[i] - '1'; if (a[i] == 1) ok = true; b[i + 1] = b[i]; for (j = i + 1; j % 2 == 0; j /= 2) b[i]++; ...
#include <bits/stdc++.h> using namespace std; int n, i, j, b[1000100], r; char a[1000100]; bool ok = false; int main() { scanf("%d", &n); scanf("%s", a); for (i = 0; i < n; i++) { a[i] = a[i] - '1'; if (a[i] == 1) ok = true; b[i + 1] = b[i]; for (j = i + 1; j % 2 == 0; j /= 2) b[i + 1]...
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
228
#include <bits/stdc++.h> using namespace std; char s[1000010]; int n; int main() { scanf("%d%s", &n, s); int tag1 = 0, tag2 = 0, tag3 = 0; n--; for (int i = 0; i <= n; i++) { int now = s[i] - '0'; if (now == 2) tag2 = 1; if ((i & n) == i) tag1 ^= now & 1; tag3 ^= ((now - 1) / 2) & 1;...
#include <bits/stdc++.h> using namespace std; char s[1000010]; int n; int main() { scanf("%d%s", &n, s); int tag1 = 0, tag2 = 0, tag3 = 0; n--; for (int i = 0; i <= n; i++) { int now = s[i] - '0'; if (now == 2) tag2 = 1; if ((i & n) == i) tag1 ^= now & 1, tag3 ^= ((now - 1) / 2) & 1; }...
[["-", 0, 7, 8, 9, 0, 57, 64, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 1, 0, 34, 0, 21]]
1
140
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> A(n); string S; cin >> S; for (int i = 0; i < n; i++) A[i] = S[i] - '0'; auto f = [&]() { int b = 0; for (int i = 0; i < n; i++) { b ^= (A[i] & 1) & (((n - 1) & i) == i); } return b; }; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> A(n); string S; cin >> S; for (int i = 0; i < n; i++) A[i] = S[i] - '1'; auto f = [&]() { int b = 0; for (int i = 0; i < n; i++) { b ^= (A[i] & 1) & (((n - 1) & i) == i); } return b; }; ...
[["-", 8, 1, 0, 11, 12, 16, 12, 103, 0, 125], ["+", 8, 1, 0, 11, 12, 16, 12, 103, 0, 125], ["+", 49, 185, 54, 55, 0, 56, 0, 153, 0, 154], ["+", 49, 185, 54, 55, 0, 56, 49, 352, 0, 67]]
1
215
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <cstdint> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <random> #include <regex> #include...
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <cstdint> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <random> #include <regex> #include...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
2,430
#include <bits/stdc++.h> using namespace std; #define for_(i, a, b) for (int i = a; i < b; ++i) bool is_odd(const vector<int> &v) { int n = v.size(), x = 0; for_(i, 0, n) if (((n - 1) & i) == i) x ^= (v[i] & 1); return x; } int main() { int N; string S; cin >> N; cin >> S; vector<int> v; for_(i, 0...
#include <bits/stdc++.h> using namespace std; #define for_(i, a, b) for (int i = a; i < b; ++i) bool is_odd(const vector<int> &v) { int n = v.size(), x = 0; for_(i, 0, n) if (((n - 1) & i) == i) x ^= (v[i] & 1); return x; } int main() { int N; string S; cin >> N; cin >> S; vector<int> v; for_(i, 0...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13]]
1
216
n = int(input()) al = list(input()) al = [int(a) - 1 for a in al] flag = False if 1 not in al: flag = True al = [a // 2 for a in al] else: al = [a if a != 2 else 0 for a in al] countl = [0] a = 0 for i in range(1, n+1): if i % 2 == 0: a += 1 countl.append(a) def comb(a,b): if countl[a...
n = int(input()) al = list(input()) al = [int(a) - 1 for a in al] flag = False if 1 not in al: flag = True al = [a // 2 for a in al] else: al = [a if a != 2 else 0 for a in al] countl = [0] a = 0 for i in range(1, n+1): while i % 2 == 0: a += 1 i //= 2 countl.append(a) def comb(a,...
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 656, 0, 7, 8, 196, 0, 52, 0, 89], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 691], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612]]
5
194
#include <cstdio> typedef long long LL; using namespace std; const int N = 1e6 + 5; int n; char s[N]; inline bool chk() { int u = 0, v = 0, w = 0; for (int i = 0; i <= n; ++i) { if (u != v) w = (w + s[i]) & 1; if (i < n) u += __builtin_ctz(n - i), v += __builtin_ctz(i + 1); } return w; } int...
#include <cstdio> typedef long long LL; using namespace std; const int N = 1e6 + 5; int n; char s[N]; inline bool chk() { int u = 0, v = 0, w = 0; for (int i = 0; i <= n; ++i) { if (u == v) w = (w + s[i]) & 1; if (i < n) u += __builtin_ctz(n - i), v += __builtin_ctz(i + 1); } return w; } int...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
247
N = int(input()) a = [ int(s) - 1 for s in input()] # r! に含まれる 2 の数 twos = {} twos[0] = 0 for r in range(1, N): count = 0 tmp = r while tmp % 2 != 0: tmp //= 2 count += 1 twos[r] = twos[r-1] + count # {N-1}_C_r の偶数奇数判定 ncr = {} for r in range(N): if twos[N-1] - twos[N-1-r] - ...
N = int(input()) a = [ int(s) - 1 for s in input()] # r! に含まれる 2 の数 twos = {} twos[0] = 0 for r in range(1, N): count = 0 tmp = r while tmp % 2 == 0: tmp //= 2 count += 1 twos[r] = twos[r-1] + count # {N-1}_C_r の偶数奇数判定 ncr = {} for r in range(N): if twos[N-1] - twos[N-1-r] -...
[["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 79], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 60]]
5
222
#include <bits/stdc++.h> using namespace std; #define li long long int #define rep(i, to) for (li i = 0; i < ((li)(to)); i++) #define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++) #define pb push_back #define sz(v) ((li)(v).size()) #define bgn(v) ((v).begin()) #define eend(v) ((v).end()) #define all...
#include <bits/stdc++.h> using namespace std; #define li long long int #define rep(i, to) for (li i = 0; i < ((li)(to)); i++) #define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++) #define pb push_back #define sz(v) ((li)(v).size()) #define bgn(v) ((v).begin()) #define eend(v) ((v).end()) #define all...
[["-", 0, 1, 0, 191, 51, 83, 0, 16, 17, 60], ["+", 0, 1, 0, 191, 51, 83, 0, 11, 17, 32]]
1
646
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e6 + 10; int a[maxn]; int c[maxn]; char s[maxn]; int cnt2(int x) { int res = 0; while (x % 2 == 0) { x >>= 1; res++; } return res; } int main() { int n; scanf("%d%s", &n, s + 1); for (int i = 1; i <= n; i++) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e6 + 10; int a[maxn]; int c[maxn]; char s[maxn]; int cnt2(int x) { int res = 0; while (x % 2 == 0) { x >>= 1; res++; } return res; } int main() { int n; scanf("%d%s", &n, s + 1); for (int i = 1; i <= n; i++) ...
[["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
375
#include <bits/stdc++.h> using std::pair; const int N = 1e6 + 5; int n, tot, a[N]; char s[N]; int main() { scanf("%d%s", &n, s); --n; for (int i = 0; i <= n; ++i) a[i] = s[i] - '0'; for (int i = 0; i <= n; ++i) if ((n & i) == i) tot = tot + a[i] & 1; if (tot) puts("1"); else { bool f...
#include <bits/stdc++.h> using std::pair; const int N = 1e6 + 5; int n, tot, a[N]; char s[N]; int main() { scanf("%d%s", &n, s); --n; for (int i = 0; i <= n; ++i) a[i] = s[i] - '0' - 1; for (int i = 0; i <= n; ++i) if ((n & i) == i) tot = tot + a[i] & 1; if (tot) puts("1"); else { bo...
[["+", 0, 7, 8, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 12, 13]]
1
234
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i) #define all(n) begin(n), end(n) using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vl = vector<ll>; using vs ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i) #define all(n) begin(n), end(n) using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vl = vector<ll>; using vs ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 146], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 147], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 104]]
1
257
#include <bits/stdc++.h> using namespace std; const int N = 1000005; char s[N]; int a[N], b[N], n; int sol() { int r = 0; for (int i = 0; i < n; i++) r = r ^ ((((n - 1) & i) == i) & a[i]); return r; } int main() { scanf("%d%s", &n, s); for (int i = 0; i < n; i++) b[i] = s[i] - '1'; int fl = 0; for...
#include <bits/stdc++.h> using namespace std; const int N = 1000005; char s[N]; int a[N], b[N], n; int sol() { int r = 0; for (int i = 0; i < n; i++) r = r ^ ((((n - 1) & i) == i) & a[i]); return r; } int main() { scanf("%d%s", &n, s); for (int i = 0; i < n; i++) b[i] = s[i] - '1'; int fl = 0; for...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
268
h,w=map(int,input().split()) print(-(-(h*w)//2) if h!=1 or w!=1 else 1)
h,w=map(int,input().split()) print(-(-(h*w)//2) if h!=1 and w!=1 else 1)
[["-", 0, 652, 3, 4, 0, 41, 0, 679, 17, 354], ["+", 0, 652, 3, 4, 0, 41, 0, 679, 17, 355]]
5
40
n,m=map(int,input().split()) import math if n==1 and m==1: print(1) exit() if n*m%2==0: print(m*n//2) else: print(m*n//2+1)
n,m=map(int,input().split()) import math if n==1 or m==1: print(1) exit() if n*m%2==0: print(m*n//2) else: print(m*n//2+1)
[["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354]]
5
63
h,w = map(int,input().split()) if h%2==0: ans = (h//2)*w else: ans = (h//2)*w + (h%2)*(w//2+1) if h==1 or w==1: ans = 1 print(ans)
h,w = map(int,input().split()) if h%2==0: ans = (h//2)*w else: ans = (h//2)*w + (h%2)*(w//2+(w%2)) if h==1 or w==1: ans = 1 print(ans)
[["-", 12, 657, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 24], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 31, 22], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 17, 109], ["+", 12, 23, 0, 657, 12, 23, 0, 657, 12, 612], ["+", 12, 657, 12, 23, 0, 657, 12, 23, 0, 25]]
5
73
h, w = gets.split.map(&:to_i) if h == 1 || w == 1 puts 0 else puts (h * w + 1) / 2 end
h, w = gets.split.map(&:to_i) if h == 1 || w == 1 puts 1 else puts (h * w + 1) / 2 end
[["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 612], ["+", 0, 121, 64, 749, 0, 652, 3, 4, 0, 612]]
4
35
#include <bits/stdc++.h> using namespace std; int main() { int h, w; cin >> h >> w; int heven, weven; heven = 0; weven = 0; if (h % 2 == 0) { heven = 1; } if (w % 2 == 0) { weven = 1; } if (w == 1 || h == 1) { cout << 1 << endl; } else if (weven == 1 || heven == 1) { cout << h * ...
#include <bits/stdc++.h> using namespace std; int main() { long long h, w; cin >> h >> w; int heven, weven; heven = 0; weven = 0; if (h % 2 == 0) { heven = 1; } if (w % 2 == 0) { weven = 1; } if (w == 1 || h == 1) { cout << 1 << endl; } else if (weven == 1 || heven == 1) { cout <...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
122
def main(): H, W = map(int, input().split()) if H == 1 or W == 1: print(0) else: print(-(-H*W // 2)) if __name__ == "__main__": main()
def main(): H, W = map(int, input().split()) if H == 1 or W == 1: print(1) else: print(-(-H*W // 2)) if __name__ == "__main__": main()
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
58
h,w = (int(i) for i in input().split()) q_h,mod_h = divmod(h,2) if h == 1: print(1) elif mod_h == 0: print(w * q_h) else: q_w,mod_w = divmod(w,2) if mod_w == 0: print(w * q_h + q_w) else: print(w * q_h + q_w + 1)
h,w = (int(i) for i in input().split()) q_h,mod_h = divmod(h,2) if h == 1 or w == 1: print(1) elif mod_h == 0: print(w * q_h) else: q_w,mod_w = divmod(w,2) if mod_w == 0: print(w * q_h + q_w) else: print(w * q_h + q_w + 1)
[["+", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 667, 60], ["+", 0, 656, 0, 57, 15, 679, 12, 666, 0, 612]]
5
87
H,W=map(int,input().split()) if H==1 or W==1: print(0) else: if H==2 and W==2: print(1) else: if H*W%2==0: print(H*W//2) else: print((H*W+1)//2)
H,W=map(int,input().split()) if H==1 or W==1: print(1) else: if H==2 and W==2: print(2) else: if H*W%2==0: print(H*W//2) else: print((H*W+1)//2)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
77
#include <stdio.h> int main() { int h, w; long long ans; scanf("%d%d", &h, &w); if (h != 1 && w != 1) { if (h * w % 2 == 0) ans = h * w / 2; else ans = (h * w + 1) / 2; } if (h == 1 || w == 1 || (h == 1 && w == 1)) { ans = 1; } printf("%lld\n", ans); return 0; }
#include <stdio.h> int main() { long long h, w; long long ans; scanf("%lld%lld", &h, &w); if (h != 1 && w != 1) { if (h * w % 2 == 0) ans = h * w / 2; else ans = (h * w + 1) / 2; } if (h == 1 || w == 1 || (h == 1 && w == 1)) { ans = 1; } printf("%lld\n", ans); return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
112