import math
n=int(input())
test=0
for i in range(n):
p=int(input())
if p%2==0:
print(int(p/2))
else:
if test==0:
print(math.ceil(p/2))
test=1
else:
print(math.floor(p/2))
test=0
// Source: https://usaco.guide/general/io
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
vector<int> a(n);
int np=0, p=0;
for(int i=0;i<n;i++){
cin>>a[i];
if(abs(a[i])%2==1){
if(a[i]>0){
p++;
}else{
np++;
}
}
}
int pp=1;
int pn=-1;
int valasz=0;
if(max(p, np)-min(p, np)%2==0){
//cout << "itt vagy?";
for(int i=0;i<n;i++){
if(abs(a[i])%2==1){
if(a[i]>0 && valasz!=min(p, np)*2){
cout<<(a[i]+1)/2<<'\n';
}else if(a[i]<0 && valasz!=min(p, np)*2){
cout<<(a[i]-1)/2<<'\n';
}else{
if(a[i]>0){
cout<<(a[i]+pp)/2<<'\n';
if(pp==1){
pp=-1;
}else{
pp=1;
}
}else{
cout<<(a[i]+pn)<<'\n';
if(pp==1){
pp=-1;
}else{
pp=1;
}
}
}
valasz++;
}else{
cout<<a[i]/2<<'\n';
}
}
}else{
for(int i=0;i<n;i++){
if(abs(a[i])%2==1){
if(a[i]>0){
if(pp==1){
cout<< (a[i]+1)/2<<'\n';
pp=-1;
}else{
cout<<(a[i]-1)/2<<'\n';
pp=1;
}
}else{
if(pn==1){
cout<< (a[i]+1)/2<<'\n';
pn=-1;
}else{
cout<<(a[i]-1)/2<<'\n';
pn=1;
}
}
}else{
cout<<a[i]/2<<'\n';
}
}
}
}
313B - Ilya and Queries | 579A - Raising Bacteria |
723A - The New Year Meeting Friends | 302A - Eugeny and Array |
1638B - Odd Swap Sort | 1370C - Number Game |
1206B - Make Product Equal One | 131A - cAPS lOCK |
1635A - Min Or Sum | 474A - Keyboard |
1343A - Candies | 1343C - Alternating Subsequence |
1325A - EhAb AnD gCd | 746A - Compote |
318A - Even Odds | 550B - Preparing Olympiad |
939B - Hamster Farm | 732A - Buy a Shovel |
1220C - Substring Game in the Lesson | 452A - Eevee |
1647B - Madoka and the Elegant Gift | 1408A - Circle Coloring |
766B - Mahmoud and a Triangle | 1618C - Paint the Array |
469A - I Wanna Be the Guy | 1294A - Collecting Coins |
1227A - Math Problem | 349A - Cinema Line |
47A - Triangular numbers | 1516B - AGAGA XOOORRR |