Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
kekka = ""
num = []
hantei = "OK"
INF = input().split()
gyosu = int(INF[1])
keta = int(INF[0])
out = []
for l in range(keta):
  out.append(0)


for i in range(gyosu):
  num.append([int(j) for j in input().split()])

for j in range(gyosu - 1):
  for k in range(gyosu - 1):
    if num[j][0] == num[k + 1][0]:
      if num[j][1] != num[k + 1][1]:
        hantei = "NG"
          
  if num[j][0] == keta:
    if num[j][1] == 0:
      hantei ="NG"

if hantei == "NG":
  print("-1")
else:
  for m in range(gyosu):
    out[(num[m][0] - 1)] = num[m][1]
    #print(out)
  for n in range(keta):
    kekka = kekka + str(out[n])
    if n == 0 and keta != 1 :
      print("-1")
      hantei = "NG"
  
  
  if hantei == "OK":
    print(kekka)




kekka = ""
num = []
hantei = "OK"
INF = input().split()
gyosu = int(INF[1])
keta = int(INF[0])
out = []
for l in range(keta):
  out.append(0)


for i in range(gyosu):
  num.append([int(j) for j in input().split()])

for j in range(gyosu - 1):
  for k in range(gyosu - 1):
    if num[j][0] == num[k + 1][0]:
      if num[j][1] != num[k + 1][1]:
        hantei = "NG"
          
  if num[j][0] == keta:
    if num[j][1] == 0:
      hantei ="NG"








kekka = ""
num = []
hantei = "OK"
INF = input().split()
gyosu = int(INF[1])
keta = int(INF[0])
out = []
for l in range(keta):
  out.append(0)


for i in range(gyosu):
  num.append([int(j) for j in input().split()])

for j in range(gyosu - 1):
  for k in range(gyosu - 1):
    if num[j][0] == num[k + 1][0]:
      if num[j][1] != num[k + 1][1]:
        hantei = "NG"
          
  if num[j][0] == keta:
    if num[j][1] == 0:
      hantei ="NG"

if hantei == "NG":
  print("-1")
else:
  for n in range(keta):
    kekka = kekka + str(out[n])
    if n == 0 and keta != 1 :
      print("-1")
      hantei = "NG"
  
  
if hantei == "OK":
  print(kekka)






kekka = ""
num = []
hantei = "OK"
INF = input().split()
gyosu = int(INF[1])
keta = int(INF[0])
out = []
for l in range(keta):
  out.append(0)


for i in range(gyosu):
  num.append([int(j) for j in input().split()])

for j in range(gyosu - 1):
  for k in range(gyosu - 1):
    if num[j][0] == num[k + 1][0]:
      if num[j][1] != num[k + 1][1]:
        hantei = "NG"
          
  if num[j][0] == keta:
    if num[j][1] == 0:
      hantei ="NG"

kekka = ""
num = []
hantei = "OK"
INF = input().split()
gyosu = int(INF[1])
keta = int(INF[0])
out = []
for l in range(keta):
  out.append(0)


for i in range(gyosu):
  num.append([int(j) for j in input().split()])

for j in range(gyosu - 1):
  for k in range(gyosu - 1):
    if num[j][0] == num[k + 1][0]:
      if num[j][1] != num[k + 1][1]:
        hantei = "NG"
          
  if num[j][0] == keta:
    if num[j][1] == 0:
      hantei ="NG"

if hantei == "NG":
  print("-1")
else:
  for m in range(gyosu):
    out[(num[m][0] - 1)] = num[m][1]
    #print(out)
if hantei == "OK":
  print(kekka)

kekka = ""
num = []
hantei = "OK"
INF = input().split()
gyosu = int(INF[1])
keta = int(INF[0])
out = []
for l in range(keta):
  out.append(0)


for i in range(gyosu):
  num.append([int(j) for j in input().split()])

for j in range(gyosu - 1):
  for k in range(gyosu - 1):
    if num[j][0] == num[k + 1][0]:
      if num[j][1] != num[k + 1][1]:
        hantei = "NG"
          
  if num[j][0] == keta:
    if num[j][1] == 0:
      hantei ="NG"

if hantei == "NG":
  print("-1")
else:
  for m in range(gyosu):
    out[(num[m][0] - 1)] = num[m][1]
    #print(out)
  for n in range(keta):
    kekka = kekka + str(out[n])
    if n == 0 and keta != 1 :
      print("-1")
      hantei = "NG"
  
  
  if hantei == "OK":
    print(kekka)




kekka = ""
num = []
hantei = "OK"
INF = input().split()
gyosu = int(INF[1])
keta = int(INF[0])
out = []
for l in range(keta):
  out.append(0)


for i in range(gyosu):
  num.append([int(j) for j in input().split()])

for j in range(gyosu - 1):
  for k in range(gyosu - 1):
    if num[j][0] == num[k + 1][0]:
      if num[j][1] != num[k + 1][1]:
        hantei = "NG"
          
  if num[j][0] == keta:
    if num[j][1] == 0:
      hantei ="NG"

if hantei == "NG":
  print("-1")
else:
  for m in range(gyosu):
    out[(num[m][0] - 1)] = num[m][1]
    #print(out)

  
  
if hantei == "OK":
  print(kekka)






kekka = ""
num = []
hantei = "OK"
INF = input().split()
gyosu = int(INF[1])
keta = int(INF[0])
out = []
for l in range(keta):
  out.append(0)


for i in range(gyosu):
  num.append([int(j) for j in input().split()])

for j in range(gyosu - 1):
  for k in range(gyosu - 1):
    if num[j][0] == num[k + 1][0]:
      if num[j][1] != num[k + 1][1]:
        hantei = "NG"
          
  if num[j][0] == keta:
    if num[j][1] == 0:
      hantei ="NG"

if hantei == "NG":
  print("-1")
else:
  for m in range(gyosu):
    out[(num[m][0] - 1)] = num[m][1]
    #print(out)
  for n in range(keta):
    kekka = kekka + str(out[n])
    if n == 0 and keta != 1 :
      print("-1")
      hantei = "NG"
  
  
if hantei == "OK":
  print(kekka)





kekka = ""
num = []
hantei = "OK"
INF = input().split()
gyosu = int(INF[1])
keta = int(INF[0])
out = []
for l in range(keta):
  out.append(0)


for i in range(gyosu):
  num.append([int(j) for j in input().split()])

for j in range(gyosu - 1):
  for k in range(gyosu - 1):
    if num[j][0] == num[k + 1][0]:
      if num[j][1] != num[k + 1][1]:
        hantei = "NG"
          
  if num[j][0] == keta:
    if num[j][1] == 0:
      hantei ="NG"

if hantei == "NG":
  print("-1")
else:
  for m in range(gyosu):
    out[(num[m][0] - 1)] = num[m][1]
    #print(out)





n = int(input())
a,b = divmod(n,2)
print(a+b)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted