Problem:


Score : 100 points

Problem Statement

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?

Constraints

N is an integer.

1 \leq N \leq 100

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer.

Sample Input 1

5

Sample Output 1

3

By printing the 1-st, 2-nd pages on the 1-st sheet, 3-rd and 4-th pages on the 2-nd sheet, and 5-th page on the 3-rd sheet, we can print all the data on 3 sheets of paper.

Sample Input 2

2

Sample Output 2

1

Sample Input 3

100

Sample Output 3

50



Sample input:
5


Sample output:
3

Submission status: Accepted

Solution code:
n = int(input())
#s = input()
#n, k= map(int,input().split())
#da = list(map(int,input().split()))
#i = int(input())
#print(s[i-1])
print((n+1)//2)

Submission status: Accepted

Solution code:
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = [int(input()) for i in range(n)]
    #a = list(map(int, input().split()))
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    n = int(input())
    print((n+1)//2)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
i = int(input())

ans = i//2 + i%2
print(ans)

Submission status: Accepted

Solution code:
def main() -> None:
    N = int(input())
    print((N + 1) // 2)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
if n % 2 ==0:
  print(n//2)
else:
  print(n//2+1)

Submission status: Accepted

Solution code:
# import sys
# input = sys.stdin.readline

N = int(input())
print((N+1)//2)

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline

if __name__ == "__main__":
    N = int(input())
    print((N+1)//2)

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N = I()

print(math.ceil(N/2))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n=int(input())
print(-(-n//2))

Submission status: Accepted

Solution code:
# ABC157a


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと
    n = int(input())
    from math import ceil
    print(ceil(n/2))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    X = int(input())

    print((X + 1) // 2)

main()

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    print(-(-N//2))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    print((n>>1)+(n&1))
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N = int(sys.stdin.buffer.readline())
print((N +1)//2)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    ret = (N + 1) // 2 
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
"""
じょえチャンネルおもしろいよ～～～
https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
"""
print(0--int(input())//2)

Submission status: Runtime Error

Solution code:
N = int(input())
pritn((N+1)//2)

Submission status: Runtime Error

Solution code:
n=input()
if n%2==0:
  print(n/2)
if not n%2==0:
  print(n/2+1)

Submission status: Runtime Error

Solution code:
N = int(input())
amari = N % 2
count = int( N // 2 )
print( count + arari )

Submission status: Runtime Error

Solution code:
import numpy as np

CARD_SIZE = 3


def solve(card, called_numbers):
    

    checked_card = np.vectorize(lambda n: n in called_numbers)(card)

    for l in checked_card:
        if all(l):
            return True

    for l in zip(*checked_card):
        if all(l):
            return True

    if all([checked_card[n][n] for n in range(CARD_SIZE)]):
        return True
    if all([checked_card[n][CARD_SIZE - n - 1] for n in range(CARD_SIZE)]):
        return True

    return False


def resolve():
    card = [[int(row) for row in input().split()] for _ in range(CARD_SIZE)]
    N = int(input())
    called_numbers = {int(input()) for n in range(N)}

    ret = solve(card, called_numbers)

    print("Yes" if ret else "No")


if __name__ == '__main__':
    resolve()

Submission status: Runtime Error

Solution code:
CARD_SIZE = 3


def solve(card, called_numbers):
    import numpy as np

    checked_card = np.vectorize(lambda n: n in called_numbers)(card)

    for l in checked_card:
        if all(l):
            return True

    for l in zip(*checked_card):
        if all(l):
            return True

    if all([checked_card[n][n] for n in range(CARD_SIZE)]):
        return True
    if all([checked_card[n][CARD_SIZE - n - 1] for n in range(CARD_SIZE)]):
        return True

    return False


def resolve():
    logger.info("start solving")
    card = [[int(row) for row in input().split()] for _ in range(CARD_SIZE)]
    logger.debug("card: {}".format(card))

    N = int(input())
    logger.debug("N: {}".format(N))
    called_numbers = {int(input()) for n in range(N)}
    logger.debug("called_numbers: {}".format(called_numbers))

    ret = solve(card, called_numbers)

    print("Yes" if ret else "No")


if __name__ == '__main__':
    resolve()

Submission status: Runtime Error

Solution code:
CARD_SIZE = 3


def solve(card, called_numbers):
    import numpy as np

    checked_card = np.vectorize(lambda n: n in called_numbers)(card)

    for l in checked_card:
        if all(l):
            return True

    for l in zip(*checked_card):
        if all(l):
            return True

    if all([checked_card[n][n] for n in range(CARD_SIZE)]):
        return True
    if all([checked_card[n][CARD_SIZE - n - 1] for n in range(CARD_SIZE)]):
        return True

    return False


def resolve():
    card = [[int(row) for row in input().split()] for _ in range(CARD_SIZE)]
    N = int(input())
    called_numbers = {int(input()) for n in range(N)}

    ret = solve(card, called_numbers)

    print("Yes" if ret else "No")


if __name__ == '__main__':
    resolve()

Submission status: Runtime Error

Solution code:
n = int(input())
if n % 2 = 1:
  print(n // 2 + 1)
else:
  print(n / 2)

Submission status: Runtime Error

Solution code:
a = iint(input())
print(a/2 if a % 2 == 1 else a//2+1)

Submission status: Runtime Error

Solution code:
x = int(input())

print(n+1//2)

Submission status: Runtime Error

Solution code:
print(int(input)+1//2)

Submission status: Runtime Error

Solution code:
N = int(input())
prnit(N//2 + N%2)

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
ans = [0]*n
for i in range(m):
  s,c = map(int,input().split())
  if ans[s-1] != 0 and ans[s-1] != c:
    print(-1)
    exit()
  elif n != 1 and s == 1 and c == 0:
    print(-1)
    exit()
  else:
    ans[s-1] = c
ans_f = "".join((map(str,ans)))
if n>1 and ans_f[0] == "0":
  print("1"+ans_f[1::])
else:
  print(ans_f)

Submission status: Runtime Error

Solution code:
n = int(sys.stdin.readline().rstrip("\n"))
if n % 2 == 0:
    print(n // 2)
else:
    print(n // 2 + 1)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3


def main():
    N = map(int, open(0).read().split())
    print(-(-N // 2))


main()

Submission status: Runtime Error

Solution code:
n = int(input())
if n%2=0:
  print(n//2)
else:
  print(n//2+1)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  if (N%2==0) cout << N/2 << endl;
  else cout << (N-1)/2+1 << endl;
  return 0;
}

Submission status: Runtime Error

Solution code:
if n%2==0:
    ans=n/2
else:
    ans=n//2+1
print(ans)

Submission status: Runtime Error

Solution code:
n = input()
print((n // 2) + (n % 2))

Submission status: Runtime Error

Solution code:
a = int(input())
if a % 2 = 0:
  print(str(int(a//2)))
else:
  print(str(int(a//2)+1.0))

Submission status: Runtime Error

Solution code:
a = int(input())
if a % 2 = 0:
  print(str(int(a//2)))
else:
  print(str(int(a//2)+1))

Submission status: Runtime Error

Solution code:
a = int(input())
if a % 2 = 0:
  print(str(a//2))
else:
  print(str((a//2)+1))

Submission status: Runtime Error

Solution code:
a = int(input())
if a % 2 = 0:
  print(str(a/2))
else:
  print(str((a/2)+1))

Submission status: Runtime Error

Solution code:
seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = "NO"
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == "O" and seen[2] == "O":
    over = "YES"
  elif seen[3] == "O" and seen[6] == "O":
    over = "YES"
  elif seen[4] == "O" and seen[8] == "O":
    over = "YES"
if seen[8] == "O":
  if seen[6] == "O" and seen[7] == "O":
    over = "YES"
  if seen[2] == "O" and seen[5] == "O":
    over = "YES"
if seen[4] == "O":
  if seen[2] == "O" and seen[6] == "O":
    over = "YES"
  elif seen[1] == "O" and seen[7] == "O":
    over = "YES"
  elif seen[3] == "O" and seen[5] == "O":
    over = "YES"
print(over)

Submission status: Runtime Error

Solution code:
N = int(input(())

if N % 2 == 1:
    print(N/2 + 1)
else:
    print(N/2)

Submission status: Runtime Error

Solution code:
num=int(input())
if num % 2 == 0:
    ans=num/2
else:
    ans=math.floor(num//2)+1
print(int(ans))

Submission status: Runtime Error

Solution code:

def main():
    n = int(input())
    if n % 2 = 1:
        print(n // 2 + 1)
    else:
        print(n / 2)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
N = int(input())
import math
print(math.celi(N/2))

Submission status: Runtime Error

Solution code:

num = int(input())
if num % 2 == 0:	
     print(n/2)
else:
     print(n/2+1)

Submission status: Runtime Error

Solution code:
n == int(input())
print((n+1)//2)

Submission status: Runtime Error

Solution code:
a = input()
if a % 2 == 0:
  print(a // 2)
else:
  print((a + 1) // 2)

Submission status: Runtime Error

Solution code:
a = []
for i in range(3):
    a1, a2, a3 = map(int, input().split())
    a.append(a1)
    a.append(a2)
    a.append(a3)

l = [0]*9
n = int(input())

for i in range(n):
    b = int(input())
    for k in range(9):
        if a[k] == b:
            l[k] += 1
 
if l[0] == 1 and l[1] == 1 and l[2] == 1:
    print('Yes')
elif l[3] == 1 and l[4] == 1 and l[5] == 1:
    print('Yes')
elif l[6] == 1 and l[7] == 1 and l[8] == 1:
    print('Yes')
elif l[0] == 1 and l[3] == 1 and l[6] == 1:
    print('Yes')
elif l[1] == 1 and l[4] == 1 and l[7] == 1:
    print('Yes')
elif l[2] == 1 and l[5] == 1 and l[8] == 1:
    print('Yes')
elif l[0] == 1 and l[4] == 1 and l[8] == 1:
    print('Yes')
elif l[2] == 1 and l[4] == 1 and l[6] == 1:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import math
N = int(input().split())
print(math.ceil(N/2))

Submission status: Runtime Error

Solution code:
import io
import sys

n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

d = {}

for i in range(1, n + 1):
    d[i] = None

for itm in sc:
    if (d[itm[0]] == None) | (d[itm[0]] == itm[1]):
        d[itm[0]] = itm[1]
    else:
        print(-1)
        sys.exit()

l = list(d.values())
if l == [0]:
    print(0)
elif l[0] == 0:
    print(-1)
else:
    l = [0 if x == None else x for x in l]
    l[0] = [1 if x == 0 else x for x in l]
    l = map(str, l)
    print("".join(l))

Submission status: Runtime Error

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
if M == 0:
    print([0, 10, 100][N - 1])
    exit()
m = map(int, read().split())
S, C = zip(*zip(m, m))

def test(n):
    st = str(n)
    if len(st) != N:
        return False
    for i, c in zip(S, C):
        i -= 1
        if st[i] != str(c):
            return False
    return True

def main():
    for n in range(1000):
        if test(n):
            return n
    return -1

print(main())

Submission status: Runtime Error

Solution code:
N, X = 6, 1
ARR = [1, 6, 1, 2, 0, 4]

N, X = 3, 3
ARR = [2, 2, 2]

N, X = 5, 9
ARR = [3, 1, 4, 1, 5]

N, X = 2, 0
ARR = [5, 5]

N, X = map(int, input().split())

ARR = list(map(int, input().split()))


def calculate(n, x, arr):
    result = 0
    for i in range(1, n):
        sSum = arr[i - 1] + arr[i]
        if sSum <= x:
            continue

        diff = sSum - x

        if diff <= arr[i]:
            arr[i] -= diff
            result += diff
        else:
            result += diff
            arr[i] = 0

    print(result)


calculate(N, X, ARR)

Submission status: Runtime Error

Solution code:
pages=int(input())
papers=round(pages/2 + pages%2)

if pages%2=0:
    print(papers)
else:
    print(pages/2 + pages%2 - 1)

Submission status: Runtime Error

Solution code:
N=int(input())
print((N+1/2)

Submission status: Runtime Error

Solution code:
N=int(input())

print(N//2+(if N%2!=0))

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
if m==0:
  if n ==1:
    print(0)
  else:
    print(10**(n-1))
else:
  sc= [list(map(int,input().split())) for i in range(m)]
  ans = -1
  for j in range(10**(n-1),10**n):
    k=str(j)
    s=[[0 for i in range(2)] for i in range(len(k))]
    for l in range(len(k)):
      s[l][0]=l+1
      s[l][1]=int(k[l])
      if all(elm in s for elm in sc) == 1:
        ans=j
        break
    if ans==j:
      break
  print(ans)

Submission status: Runtime Error

Solution code:
n,m,k=map(int,input().split())
edge=[[] for _ in range(n)]
for _ in range(m):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    edge[a].append(b)
    edge[b].append(a)


from collections import deque
label=[-1]*n

i=0
for start in range(n):
    if label[start]!=-1:
        continue
    else:
        i+=1
        label[start]=i    
    dist_friends=[-1]*n
    dist_friends[start]=0
    f=deque([start])

    while f:
        v=f.popleft()        

        for e in edge[v]:
            if dist_friends[e]==-1 and label[e]==-1:
                dist_friends[e]=dist_friends[v]+1
                label[e]=i
                f.append(e)   

Renketsu=[0]*(n+1)

for i in label:
    Renketsu[i]+=1

Block=[0]*n
for _ in range(k):
    c,d=map(int,input().split())
    c,d=c-1,d-1
    if label[c]==label[d]:
        Block[c]+=1
        Block[d]+=1

ans=[]
for k in range(n):
    ans.append(Renketsu[label[k]]-1 - len(edge[k]) - Block[k])
print(*ans)

Submission status: Runtime Error

Solution code:
import math
n  int(input())
print(math.ceil(n/2))

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
jouken=[]
for x in range(m):
  jouken.append(list(map(int,input().split())))

for x in range(10**n):
  ans=0
  for y in range(m):
    a=jouken[y][0]-1
    b=jouken[y][1]
    if not x[a]==b:
      ans+=1
  if ans==0:
    print(x)
    break

if ans>1:
  print(-1)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
ans = ['t'] * n

for _ in range(m):
    s, c = map(int, input().split())
    if ans[s-1] =='t' or ans[s-1] == str(c):
        ans[s-1]= str(c)
    else:
        print(-1)
        exit(0)
if ans[0] == 't':
    ans[0]=str(1)

ans = ''.join(ans).replace('t', str(0))
ans = int(ans)
l = str(ans)
if len(l) != n:
    print(-1)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
import random
D = int(input())
c = [int(x) for x in input().split()]
s = [input().split() for l in range(D)]

manzoku = 0
kyounomanzoku = 0
kyounotype = 0
d = 1
last = [0]*26

for p in range(D):
    print(int(random.uniform(1, 26.999)))


"""
for p in range(D):
    #タイプはt[p]-1,0~25 満足度増加 s[p][t[p]] p+1日目 
    #typeを出力するときは＋１するのを忘れずに
    for t in range(26):
        if kyounomanzoku < int(s[p][t]):
            kyounomanzoku = int(s[p][t])
            kyounotype = t
    print(kyounotype+1)
    kyounomanzoku = 0
"""

Submission status: Runtime Error

Solution code:
def main():
    import itertools
    a = tuple(map(int,input().split()))
    b = tuple(map(int,input().split()))
    c = tuple(map(int,input().split()))
    d = (a[0],b[0],c[0])
    e = (a[1],b[1],c[1])
    f = (a[2],b[2],c[2])
    g = (a[0],b[1],c[2])
    h = (a[2],b[1],c[0])
    A = set(a)
    B = set(b)
    C = set(c)
    D = set(d)
    E = set(e)
    F = set(f)
    G = set(g)
    H = set(h)
    n = int(input())
    listB = [int(input()) for x in range(n)]
    X = itertools.combinations(listB,3)
    R = set(list(X))
    if A in R or B in R or C in R or D in R or E in R or F in R or G in R or H in R:
      print("Yes")
    else:
      print("No")
main()

Submission status: Runtime Error

Solution code:
def main():
    import itertools
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    c = list(map(int,input().split()))
    d = [a[0],b[0],c[0]]
    e = [a[1],b[1],c[1]]
    f = [a[2],b[2],c[2]]
    g = [a[0],b[1],c[2]]
    h = [a[2],b[1],c[0]]
    n = int(input())
    listB = [int(input()) for x in range(n)]
    C = itertools.combinations(listB,3)
    if a in C or b in C or c in C or d in C or e in C or f in C or g in C or h in C:
      print("Yes")
    else:
      print("No")
main()

Submission status: Runtime Error

Solution code:
def main():
	N = int(input())
  	if N%2 == 1:
      print((N+1)/2)
    else:
      print(N/2)
main()

Submission status: Runtime Error

Solution code:
def main()
	N = int(input())
  	if N%2 == 1:
      print((N+1)/2)
    else:
      print(N/2)
main()

Submission status: Runtime Error

Solution code:
def main()
	a = int(input())
  	if a%2 == 1:
      print((a+1)/2)
    else:
      print(a/2)
main()

Submission status: Runtime Error

Solution code:
a = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]

c = [[0 for _ in range(3)] for _ in range(3)]
result = ""

for i in range(3):
    for j in range(3):
        if a[j][i] in b:
            c[j][i] = 1

for i in range(3):
    if c[i][0] == c[i][1] == c[i][2] == 1:
        result = "Yes"
        break
    elif c[0][i] == c[1][i] == c[2][i] == 1:
        result = "Yes"
        break

if c[0][0] == c[1][1] == c[2][2] == 1:
    result = "Yes"
elif c[0][2] == c[1][1] == c[2][0] == 1:
    result = "Yes"

if result == "":
    result ="No"

print(result)

Submission status: Runtime Error

Solution code:
n=int(input())
if n%2=0:
  print(n//2)
else:
  print(n//2+1)

Submission status: Runtime Error

Solution code:
inport math
n=int(input())
print(math.ceil(n/2))

Submission status: Runtime Error

Solution code:
n= int(input)
if n%2==0:
  print(int(n*0.5))
else:
  print(int(0.5*n)+1)

Submission status: Runtime Error

Solution code:
# import numpy as np
import sys
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
# map(int, input().split())
# list(map(int, input().split()))
 
N, M = map(int, input().split())
 
cond = [-1] * N
 
for i in range(M):
    s, c = map(int, input().split())
    if cond[s - 1] > -1 and cond[s - 1] != c:
        print(-1)
        exit()
    cond[s - 1] = c

cond = list(map(str, cond))
for i in range(10 ** N):
    si = str(i)
    if N != len(si):
        continue
    ok = True
    for j in range(N):
        if cond[j] == '-1':
            continue
        if si[j] != cond[j]:
            # print(si, si[j], cond[j])
            ok = False
            break
    if ok:
        print(si)
        exit()
print(-1)

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(M)]

# 辞書初期化3桁0埋め
dic = {}
for i in range(N):
    dic[i] = 0

# scの辞書化
dic2= {}
for i in sc:
    if i[1] != 0:
        if (i[0]-1 not in dic2.keys()) or (i[0]-1 in dic2.keys()) and (i[1] <= dic2[i[0]-1]):
            dic2[i[0]-1] = i[1]
# update
dic.update(dic2)

s = ''
for k,v in dic.items():
    s += str(v)

if len(str(int(s))) == N:
    print(int(s))
else:
    print(-1)

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(M)]

# 辞書初期化3桁0埋め
dic = {}
for i in range(N):
    dic[i] = 0

# scの辞書化
dic2= {}
for i in sc:
    if i[1] != 0:
        if (i[0]-1 not in dic2.keys()) or (i[0]-1 in dic2.keys()) and (i[1] <= dic2[i[0]-1]):
            dic2[i[0]-1] = i[1]
# update
dic.update(dic2)

s = ''
for k,v in dic.items():
    s += str(v)

if len(str(int(s))) == N:
    print(int(s))
else:
    print('-1')

Submission status: Runtime Error

Solution code:
n = int(input())

print int(n//2) + n % 2

Submission status: Runtime Error

Solution code:
import sys

n,m = map(int, input().split())
num = [0]*n
count = [0]*n

for _ in range(m):
    b,c = map(int, input().split())
    if num[b-1] != c and count[b-1] > 0:
        print(-1)
        sys.exit()
    count[b-1]+=1
    num[b-1] = c    

if n >= 2 and num[0] == 0:
    if count[0] == 0:
        num[0] = 1
    else:
        print(-1)
        sys.exit()

ans = ""
for i in range(n):
    ans+=str(num[i])
print(ans)

Submission status: Runtime Error

Solution code:
import sys

n,m = map(int, input().split())
num = [0]*n
count = [0]*n

for _ in range(m):
    b,c = map(int, input().split())
    if num[b-1] != c and count[b-1] > 0:
        print(-1)
        sys.exit()
    count[b-1]+=1
    num[b-1] = c    

if n == 3 and num[0] == 0 and count[0] == 0:
    num[0] = 1
elif n == 3 and num[0] == 0 and count[0]>0:
    print(-1)
    sys.exit()
elif n == 2 and num[0] == 0 and count[0] == 0:
    num[0] = 1
elif n == 2 and num[0] == 0 and count[0] >  0:
    print(-1)
    sys.exit()

ans = ""
for i in range(n):
    ans+=str(num[i])
print(ans)

Submission status: Runtime Error

Solution code:
n = int(inpur())

if n % 2 == 0:
  print(int(n/2))
else:
  print(int((n/2)+1))

Submission status: Runtime Error

Solution code:
import sys
N, M = map(int, input().split())

#とりまぶっこむ 
SClis = [] 
for _ in range(M):
    a, b = map(int, input().split())
    SClis.append([a,b])

ans = [-1]*N

for i in range(M):
    singlelis = SClis[i]
    S =  (singlelis[0] - 1)
    C =  (singlelis[1])
    
    if ans[S] != -1 and ans[S] != C:
        print(-1)
        sys.exit()
    else:
        ans[S] = C


    
if N == 1:
    if ans[0] == -1:
        ans[0] = 0
        print(''.join(map(str, ans)))
        sys.exit()

if N != 1:
    if ans[0] == 0:
        print(-1)
        sys.exit()
    
    if ans[0] == -1:
        ans[0] = 1
    
    for i in range(1,N):
        if ans[i] == -1:
            ans[i] = 0

print(''.join(map(str, ans)))

Submission status: Runtime Error

Solution code:
from collections import defaultdict


class UnionFind:
    def __init__(self, n):
        self.root = list(range(n + 1))
        self.size = [1] * (n + 1)

    def find(self, x):
        root = self.root
        while root[x] != x:
            root[x] = root[root[x]]
            x = root[x]
        return x

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        sx, sy = self.size[x], self.size[y]
        if sx < sy:
            self.root[x] = y
            self.size[y] += sx
        else:
            self.root[y] = x
            self.size[x] += sy


n, m, k = map(int, input().split())


uf = UnionFind(n)

friends = defaultdict(int)
chain = defaultdict(int)

for _ in range(m):
    a, b = map(int, input().split())
    friends[a] += 1
    friends[b] += 1
    uf.union(a, b)

for i in range(1, n + 1):
    for j in range(1, n + 1):
        if uf.find(i) == uf.find(j):
            chain[i] += 1

for _ in range(k):
    c, d = map(int, input().split())
    if uf.find(c) == uf.find(d):
        friends[c] += 1
        friends[d] += 1

ans = []
for i in range(1, n + 1):
    ans.append(chain[i] - friends[i] - 1)

print(*ans)

Submission status: Runtime Error

Solution code:
M=[]
for _i in range(3):
  M.append(list(map(int,input().split())))
n= int(input())
for a in range(n):
  b= int(input())
  for i in range(3):
    for j in range(3):
      if M[i][j]==b:
        M[i][j]=-1
oassiy= False
for i in range(3):
  cont=0
  for j in range(3):
    if M[i][j]==-1:
      cont+=1
  if cont==3:
    break
    oassiy=True

if not oassiy:
 for j in range(3):
  cont=0
  for i in range(3):
    if M[i][j]==-1:
      cont+=1
  if cont==3:
    break
    oassiy=True

if not oassiy:
  cont1 = cont2= 0
  for i in range(3):
    if M[i][i]==-1:
      cont1+=1
    if M[i][2-i]==-1:
      cont2+=1
if (cont1==3) or (cont2==3):
    oassiy=True

print('Yes' if oassiy else 'No')

Submission status: Runtime Error

Solution code:
n=input()
if n%2==0:
    print(n//2)
else:
    print(n//2+1)

Submission status: Runtime Error

Solution code:
s=input()
if s%2==0:
    print(s//2)
else:
    print(s//2+1)

Submission status: Runtime Error

Solution code:
s=input()
if s%2==0:
    print(s//2)
else:
    print(s//2+1)

Submission status: Runtime Error

Solution code:
import sys

A = list(list(map(int, input().split())) for _ in range(3))
N = int(input())
num = list(int(input()) for _ in range(N))

for i in range(3):
    for j in range(3):
        if A[i][j] in num:
            A[i][j] = -1
            
if A[0][0] == -1 and A[0][1] == -1 and A[0][2] == -1:
    print("Yes")
    sys.exit()
elif A[1][0] == -1 and A[1][1] == -1 and A[1][2] == -1:
    print("Yes")
    sys.exit()
elif A[2][0] == -1 and A[2][1] == -1 and A[2][2] == -1:
    print("Yes")
    sys.exit()
elif A[0][0] == -1 and A[1][0] == -1 and A[2][0] == -1:
    print("Yes")
    sys.exit()
elif A[0][1] == -1 and A[1][1] == -1 and A[2][1] == -1:
    print("Yes")
    sys.exit()
elif A[0][2] == -1 and A[1][2] == -1 and A[2][2] == -1:
    print("Yes")
    sys.exit()
elif A[0][0] == -1 and A[1][1] == -1 and A[1][1] == -1:
    print("Yes")
    sys.exit()
elif A[0][2] == -1 and A[1][1] == -1 and A[2][0] == -1:
    print("Yes")
    sys.exit()
    
print("No")

Submission status: Runtime Error

Solution code:
import sys

sys.setrecursionlimit(10**7)

def dfs(x):
    uni[cnt].append(x)
    seen[x-1]=1
    for i in fri[x-1]:
        if seen[i-1]==0:
            dfs(i)
    

n,m,k=map(int,input().split())

fri=[[] for i in range(n)]
blk=[[] for i in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    fri[a-1].append(b)
    fri[b-1].append(a)

for i in range(k):
    c,d=map(int,input().split())
    blk[c-1].append(d)
    blk[d-1].append(c)


seen=[0 for i in range(n)]

uni=[]
cnt=0
for i in range(1,n+1):
    if seen[i-1]==0:
        uni.append([])
        dfs(i)
        cnt+=1

seq=[0 for i in range(n)]

for unii in uni:
    for j in unii:
        cj=len(unii)-len(fri[j-1])-len(set(unii)&set(blk[j-1]))-1
        seq[j-1]=cj

print(*seq)

Submission status: Runtime Error

Solution code:
import sys

sys.setrecursionlimit(10**7)

def dfs(x):
    if seen[x-1]==0:
        uni[cnt].append(x)
        seen[x-1]=1
        for i in fri[x-1]:
            dfs(i)
    

n,m,k=map(int,input().split())

fri=[[] for i in range(n)]
blk=[[] for i in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    fri[a-1].append(b)
    fri[b-1].append(a)

for i in range(k):
    c,d=map(int,input().split())
    blk[c-1].append(d)
    blk[d-1].append(c)


seen=[0 for i in range(n)]

uni=[]
cnt=0
for i in range(1,n+1):
    if seen[i-1]==0:
        uni.append([])
        dfs(i)
        cnt+=1

seq=[0 for i in range(n)]

for unii in uni:
    for j in unii:
        cj=len(unii)-len(fri[j-1])-len(set(unii)&set(blk[j-1]))-1
        seq[j-1]=cj

print(*seq)

Submission status: Runtime Error

Solution code:
n,m,k=map(int,input().split())
A=[]
B=[]
for i in range(m):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
C=[]
D=[]
for i in range(k):
    c,d=map(int,input().split())
    C.append(c)
    D.append(d)
union=[]
for i in range(n):
    br=0
    for j in range(len(union)):
        if i+1 in set(union[j]):
            br=1
            break
    if br==1:
        continue
    fri=[i+1]
    mark=[0]
    while 0 in set(mark):
        for s in range(len(fri)):
            if mark[s]==0:
                for t in range(m):
                    if A[t]==fri[s] and B[t] not in set(fri):
                        fri.append(B[t])
                        mark.append(0)
                    if B[t]==fri[s] and A[t] not in set(fri):
                        fri.append(A[t])
                        mark.append(0)
                mark[s]=1
    union.append(fri)
unionsize=[]
for i in range(len(union)):
    unionsize.append(len(union[i]))
counter=[]
for i in range(n):
    counter.append(0)

for i in range(m):
    counter[A[i]-1]+=1
    counter[B[i]-1]+=1
for i in range(k):
    for j in range(len(union)):
        if C[i] in union[j] and D[i] in union[j]:
            counter[C[i]-1]+=1
            counter[D[i]-1]+=1
            break

for i in range(n):
    for j in range(len(union)):
        if i+1 in union[j]:
            print(unionsize[j]-counter[i]-1,end=" ")
            break