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: Runtime Error

Solution code:
map_dict = dict()
for i in range(3):
    a1, a2, a3 = input().split()
    map_dict[a1] = 1 + i * 3
    map_dict[a2] = 2 + i * 3
    map_dict[a3] = 3 + i * 3

win_pattern = [
    (1, 2, 3),
    (4, 5, 6),
    (7, 8, 9),
    (1, 4, 7),
    (2, 5, 8),
    (3, 6, 9),
    (1, 5, 9),
    (3, 5, 7),
]
n = int(input())
scored = []
for i in range(n):
    b = input()
    try:
        scored.append(map_dict[b])
    except:
        pass
scored = set(scored)

flag = False
for pattern in win_pattern:
    if set(pattern).issubset(scored):
        print('Yes')
        flag = True
        break
if not flag:
    print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A,B,C = map(int,input().split(' '))
num = 0
if A == B == C:
    print(-1)
elif A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        A_c = A
        B_c = B
        C_c = C
        A = B_c /2 + C_c / 2
        B = A_c / 2 + C_c /2
        C = A_c /2 + B_c / 2
        num += 1
    print(num)
else:
    print(0)

Submission status: Runtime Error

Solution code:
N = input()
N = N /2
print(N)

Submission status: Runtime Error

Solution code:
class UnionFind:
  def __init__(self, size):
    self.parents = [x for x in range(size)]
    self.sizes = [1] * size
  
  def unite(self, a, b):
    if self.find(a) == self.find(b):
      return
    
    if self.size_of(a) > self.size_of(b):
      self.sizes[self.find(a)] += self.size_of(b)
      self.parents[self.find(b)] = self.find(a)
    else:
      self.sizes[self.find(b)] += self.size_of(a)
      self.parents[self.find(a)] = self.find(b)
  
  def is_same(self, a, b):
    return self.find(a) == self.find(b)
  
  def size_of(self, a):
    return self.sizes[self.find(a)]
  
  def find(self, a):
    if a == self.parents[a]:
      return a
    else:
      self.parents[a] = self.find(self.parents[a])
      return self.parents[a]


N, M, K = map(int, input().split())

u = UnionFind(N)

# 自分自身・友達・ブロック関係のいずれかの場合はフラグ立つ
relations = [1 << i for i in range(N)]

for _ in range(M):
  a, b = map(int, input().split())
  a, b = a - 1, b - 1
  relations[a] |= 1 << b
  relations[b] |= 1 << a
  u.unite(a, b)
  
for _ in range(K):
  c, d = map(int, input().split())
  c, d = c - 1, d - 1
  
  # 同じ連結成分に含まれないブロック関係は無視してok
  if u.is_same(c, d):
    relations[c] |= 1 << d
    relations[d] |= 1 << c

candidates = []

for i in range(N):
  candidates.append(u.size_of(i) - bin(relations[i]).count('1'))
    
print(' '.join(str(x) for x in candidates))

Submission status: Runtime Error

Solution code:
A=[[int(x) for x in input().split()]for i in range(3)]
n=int(input())
b=list(map(int,input().split()))
for i in range(3):
    if A[i][0] in b and A[i][1] in b and A[i][2] in b:
        print('Yes')
        exit()
    elif A[0][i] in b and A[1][i] in b and A[2][i] in b:
        print('Yes')
        exit()
if A[0][0] in b and A[1][1] in b and A[2][2] in b:
    print('Yes')
    exit()
if A[2][0] in b and A[1][1] in b and A[0][2] in b:
    print('Yes')
    exit()
print('No')

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())

ans = [-1]*n
a = 0
for i in range(m):
    s, c = map(int, input().split())
    if s == 1 and c == 0 and n != 1:
        a = -1
    elif ans[s-1] not in [-1, c]:
        a = -1
    else:
        ans[s-1] = c

if a == -1:
    print(a)
else:
    b = ""
    if ans[0] == -1 and n != 1:
        ans[0] = 1
    for x in ans:
        if x == -1:
            b += "0"
        else:
            b += str(x)
    print(b)

Submission status: Runtime Error

Solution code:
n = input()
ans = 0

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

print(ans)

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:
card = []

for _ in range(3):
    card.append(list(map(int, input().split())))

n = int(input())

b = []

for _ in range(n):
    b.append(int(input()))

for i in range(3):
    if card[i][0] in b and card[i][1] in b and card[i][2] in b:
        print('Yes')
        exit()
for i in range(3):
    if card[0][i] in b and card[1][i] in b and card[2][i] in b:
        print('Yes')
        exit()
if card[0][0] and card[1][1] and card[2][2]:
    print('Yes')
    exit()
if card[0][2] and card[1][1] and card[2][0]:
    print('Yes')
    exit()


print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
class SegmentTree:
    def __init__(self,orig,func,unit):
        _len= len(orig)
        self.func = func
        self.size = 1 << (_len-1).bit_length()
        self.tree = [unit] * self.size + orig + [unit] *(self.size-_len)
        self.unit = unit
        
        for i in range(self.size -1,0,-1):
            self.tree[i] = func(self.tree[i*2], self.tree[i*2+1])
            
    def update(self, i, v):
        i+=self.size
        self.tree[i] = v
        while i:
            i//=2
            self.tree[i]=self.func(self.tree[i*2],self.tree[i*2+1])
    
    def find(self,l,r):
        l+=self.size
        r+=self.size
        ret=self.unit
        while l<r:
            if l&1:
                ret = self.func(ret,self.tree[l])
                l+=1
            if r&1:
                r-=1
                ret=self.func(ret,self.tree[r])
            l//=2
            r//=2
        return ret
      
import sys
input = sys.stdin.readline
from operator import or_

input()
seg = SegmentTree([1 << ord(x) - 97 for x in input()[:-1]], or_, 0)
ans = []
for _ in range(int(input())):
  f, x, y = input().split()
  if f == "1":
    seg.update(int(x) - 1, 1 << ord(y) - 97)
  else:
    ans.append(bin(seg.find(int(x) - 1, int(y))).count("1"))
print(*ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=[[0]*3 for i in range(3)]
b=[]
for i in range(3):
  x=input().split()
  a[i][0]=x[0]
  a[i][1]=x[1]
  a[i][2]=x[2]
n=int(input())
for i in range(n):
  b.append(input())
for i in range(n):
  for j in range(9):
    if b[i]==a[j//3][j%3]:
      a[j//3][j%3]='X'
jud=[0,0,0,0]
z=0
res=0
for i in range(3):
  for j in range(2):
    if a[i][j]==a[i][j+1]:
      jud[0]+=1
    if a[j][i]==a[j+1][i]:
      jud[1]+=1
  if max(jud)>1:
    res-=1
for j in range(2):
  if a[j][j]==a[j+1][j+1]:
    jud[2]+=1
  if a[j][2-j]==a[j+1][2-j-1]:
    jud[3]+=1
  if max(jud)>1:
    res-=1
if res<0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
N = input()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
sc = [tuple(map(int, input().split())) for _ in range(m)]

flag = True

if n == 1 and m == 0:
    print(0)
elif n == 1 and m != 0:
    if len(set(sc)) != 1:
        print(-1)
    else:
        print(sc[0][1])
        
        
elif n > 1 and m == 0:
    print(10**(n-1))
    
elif n > 1 and m != 0:
    for i in range(10**(n-1), 10**n):
        i_str = str(i)
        i_list = list(i_str)
        for item in set(sc):
            if i_list[item[0]-1] != str(item[1]):
                break
        else:
            print(i)
            flag = False
            break
    if flag:
        print(-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N == int(N)

print(-(-N//2))

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
  
answer = [-1]*n

for i in range(m):
  s, c = map(int, input().split())
  if s == 1 and c == 0:
    if n == 1:
      print(0)
      exit()
    else:
      print(-1)
  if answer[s-1] == -1 or answer[s-1] == c:
    answer[s-1] = c
  else:
    print(-1)
    exit()

if answer[0] == -1:
  if n == 1:
    print(0)
    exit()
  else:
    answer[0] = 1
for j in range(n):
  if answer[j] == -1:
    answer[j] = 0
    
answer = [str(x) for x in answer] 

print(int(''.join(answer)))

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:
n=input()
print(round(n/2))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

if N == 1 and M == 0:
  print(0)
  exit()

sc = [LIST() for _ in range(M)]

ans = [-1]*N
for s, c in sc:	
  if N >= 2 and s == 1 and c == 0:
    print(-1)
    exit()
  if ans[s-1] != -1 and ans[s-1] != c: #既に値が入ってる
    print(-1)
    exit()
  ans[s-1] = c
    
if ans[0] == -1:
  ans[0] = 1

for i in range(N):
  if ans[i] == -1:
    ans[i] = 0
    
for n in ans:
  print(n, end="")

Submission status: Runtime Error

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

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)]

l = [[(a_i in B) for a_i in a] for a in A]

# print(l)

flag = 0
for y in range(3):
    flag |= all(l[y])

for x in range(3):
    flag |= all([l[x][y] for y in range(3)])

flag |= all([l[y][x] for x, y in [(0, 0), (1, 1), (2, 2)]])

flag |= all([l[y][x] for x, y in [(0, 2), (1, 1), (2, 0)]])

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

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:
N,M=map(int,input().split())
s=[]
c=[]
for i in range(M):
 
    a, b = map(int,input().split())
    s.append(a)
    c.append(b)
 
okflag = True
 
 
for i in range(M):
 
 
    if not okflag:
         break
    for j in range(M):
     if not okflag:
         break
     if not (i==j):
 
        if s[i]==s[j] and c[i]!=c[j]:
 
            okflag = False
            print("-1")
 
if okflag:
    answer = ["0"] * N
    for i in range(M):
        answer[s[i]-1] = str(c[i])
    if not N == 1 and answer[0] == "0":
        answer[0] = "1"
    result = ''.join(answer)
    print(result)

Submission status: Runtime Error

Solution code:
A = []
for _ in range(3):
    A += list(map(int, input().split()))
N = int(input())
B = [int(input()) for i in range(N)]

for i in range(0,N):
    for j in range(9):
        if B[i] ==  A[j]:
            A[j] = 0

if A[0]==A[1]==A[2]==0 or A[3]==A[4]==A[5]==0 or A[6]==A[7]==A[8]==0 or A[0]==A[3]==A[6]==0 or A[1]==A[4]==A[7]==0 or A[2]==A[5]==A[8]==0 or  A[0]==A[4]==A[8]==0 or A[2]==A[4]==A[6]==0 :
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
lst1 = [int() for i in input().split()]
lst2 = [int() for i in input().split()]
lst3 = [int() for i in input().split()]
n = int(input())
b = [int(input()) for i in range(n)]
lst4 = [lst1[0], lst2[0], lst3[0]]
lst5 = [lst1[1], lst2[1], lst3[1]]
lst6 = [lst1[2], lst2[2], lst3[2]]
lst7 = [lst1[0], lst2[1], lst3[2]]
lst8 = [lst1[2], lst2[1], lst3[0]]
if len(set(b) & set(lst4)) == 3:
    print('Yes')
elif len(set(b) & set(lst5)) == 3:
    print('Yes')
elif len(set(b) & set(lst6)) == 3:
    print('Yes')
elif len(set(b) & set(lst7)) == 3:
    print('Yes')
elif len(set(b) & set(lst8)) == 3:
    print('Yes')
else:
    print('No')

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)]

Size = 3
bingo = False
for row in a:
    if all(item in b for item in row):
        bingo = True
for col in zip(*a):
    if all(item in b for item in col):
        bingo = True
if all(a[i][i] in b for i in range(Size)):
    bingo = True
if all(a[i][Size - 1 - i] in b for i in range(Size)):
    bingo = True
 
print("Yes" if bingo else "No")

Submission status: Runtime Error

Solution code:
import sys 
a = list(map(int,input().split()))

N = a[0]
M = a[1]

b = ['0']*N

for i in range(0,M):
    x = list(map(str,input().split()))
    if b[int(x[0])-1] != '0' and b[int(x[0])-1] != x[1]:
        print('-1')
        sys.exit()
    elif x[0] == '1' and x[1] == '0':
        print('-1')
        sys.exit()
    else:
        b[int(x[0])-1] = x[1]

if N == 2:
    if b[0] == '0' and int(b[1]) != 0:
        b[0] = '1'

if N == 3:
    if b[0] == '0' and (int(b[1]) != 0 or int(b[2]) != 0):
        b[0] = '1'
ans = ''.join(b)
print(ans)

Submission status: Runtime Error

Solution code:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
#グループの根を返す
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
 #xのグループとyのグループを結合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
#親を全部表示
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_groupmembers(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
N, M ,K = map(int, input().split())
uf = UnionFind(N)
friend_count=[0]*N
for m in range(M):
    p,q = map(int, input().split())
    friend_count[p-1]+=1
    friend_count[q-1]+=1
    uf.union(p-1, q-1)
to=[[] for i in range(N)]
for i in range(K):
    a,b=map(int,input().split())
    a-=1
    b-=1
    to[a].append(b)
    to[b].append(a)
allg =  uf.all_groupmembers()
last_list=[]
for n in range(N):
    leng = uf.size(n)
    for j in to[n]:
        if(uf.same(n,j)):leng-=1
    print(str(leng-1-friend_count[n]), end=" ")

Submission status: Runtime Error

Solution code:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
#グループの根を返す
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
 #xのグループとyのグループを結合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
 
        if x == y:
            return
 
        if self.parents[x] > self.parents[y]:
            x, y = y, x
 
        self.parents[x] += self.parents[y]
        self.parents[y] = x
 
    def size(self, x):
        return -self.parents[self.find(x)]
 
    def same(self, x, y):
        return self.find(x) == self.find(y)
 
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
#親を全部表示
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
 
    def group_count(self):
        return len(self.roots())
 
    def all_groupmembers(self):
        return {r: self.members(r) for r in self.roots()}
 
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
N, M ,K = map(int, input().split())
uf = UnionFind(N)
friend_count=[0]*N
for m in range(M):
    p,q = map(int, input().split())
    friend_count[p-1]+=1
    friend_count[q-1]+=1
    uf.union(p-1, q-1)
bgraph = {}
for k in range(K):
    p,q = map(int, input().split())
    if p-1 in bgraph.keys():
        bgraph[p-1].append(q-1)
    else:
        bgraph[p-1] = [q-1]
    if q-1 in bgraph.keys():
        bgraph[q-1].append(p-1)
    else:
        bgraph[q-1] = [p-1]
allg =  uf.all_groupmembers()
last_list=[]
for n in range(N):
    for a in allg.values():
        if n in a:
            leng = len(a)
            if n in bgraph.keys():
                ng = len(set(bgraph[n])&set(a))
            else:
                ng = 0
            print(str(leng-ng-1-friend_count[n]), end=" ")

Submission status: Runtime Error

Solution code:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
#グループの根を返す
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
 #xのグループとyのグループを結合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
 
        if x == y:
            return
 
        if self.parents[x] > self.parents[y]:
            x, y = y, x
 
        self.parents[x] += self.parents[y]
        self.parents[y] = x
 
    def size(self, x):
        return -self.parents[self.find(x)]
 
    def same(self, x, y):
        return self.find(x) == self.find(y)
 
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
#親を全部表示
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
 
    def group_count(self):
        return len(self.roots())
 
    def all_groupmembers(self):
        return {r: self.members(r) for r in self.roots()}
 
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
N, M ,K = map(int, input().split())
uf = UnionFind(N)
friend_count=[0]*N
for m in range(M):
    p,q = map(int, input().split())
    friend_count[p-1]+=1
    friend_count[q-1]+=1
    uf.union(p-1, q-1)
bgraph = {}
for k in range(K):
    p,q = map(int, input().split())
    if p-1 in bgraph.keys():
        bgraph[p-1].append(q-1)
    else:
        bgraph[p-1] = [q-1]
    if q-1 in bgraph.keys():
        bgraph[q-1].append(p-1)
    else:
        bgraph[q-1] = [p-1]
allg =  uf.all_groupmembers()
last_list=[]
for n in range(N):
    for a in allg.values():
        if n in a:
            leng = len(a)
            if n in bgraph.keys():
                ng = len(set(bgraph[n])&set(a))
            else:
                ng = 0
            last_list.append(str(leng-ng-1-friend_count[n]))
print(" ".join(last_list))

Submission status: Runtime Error

Solution code:
card = [list(map(int, input().split())) for i in range(3)]
N = int(input())
 
bingo = [[0 for i in range(3)] for j in range(3)]
 
for i in range(N):
  	key = int(input())
    for j in range(3):
        for k in range(3):
            if card[j][k] == key:
                bingo[j][k] += 1
 
for i in range(3):
    if bingo[0][i] * bingo[1][i] * bingo[2][i] > 0:
        print('Yes')
        exit()
for i in range(3):
    if bingo[i][0] * bingo[i][1] * bingo[i][2] > 0:
        print('Yes')
        exit()
if bingo[0][0] * bingo[1][1] * bingo[2][2] > 0:
    print('Yes')
    exit()
if bingo[0][2] * bingo[1][1] * bingo[2][0] > 0:
    print('Yes')
    exit()
print('No')

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
l = []
l2 = []
l3 = [0 for i in range(n)]
cnt = 0
if (m == 0 and n == 1) or (n == 1 and m == 1 and sc[0] == [1, 0]):
    print(0)
    exit()
for i in sc:
    if i[0] == 1 and i[1] == 0:
        print(-1)
        exit()
    elif i[0] in l and l2[l.index(i[0])] != i[1]:
        print(-1)
        exit()
    else:
        l.append(i[0])
        l2.append(i[1])
        l3[i[0] - 1] = i[1]
        cnt += 1
if l3[0] == 0:
    l3[0] = 1
print(*l3, sep="")

Submission status: Runtime Error

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

sclist = []
for count in range(M):
    d = list(map(int,input().split()))
    sclist.append(d)

flag = False;
for count in range(10**(N-1),10**(N)):
    flag = False
    for count1 in range(M):
        s = sclist[count1][0]
        c = sclist[count1][1]
        if str(count)[s-1] == str(c):
            flag = True
        else:
            flag = False
            break
    if flag == True:
        print(count)
        break

if flag == False and M != 0:
    print(-1)
elif flag == False and M == 0:
    print(10**(N-1))

Submission status: Runtime Error

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

sclist = []
for count in range(M):
    d = list(map(int,input().split()))
    sclist.append(d)

flag = False;
for count in range(10**(N-1),10**(N)):
    flag = False
    for count1 in range(M):
        s = sclist[count1][0]
        c = sclist[count1][1]
        if str(count)[s-1] == str(c):
            flag = True
        else:
            flag = False
            break
    if flag == True:
        print(count)
        break

if flag == False and M != 0:
    print(-1)
elif flag == False and M == 0:
    print((N-1)** 10)

Submission status: Runtime Error

Solution code:
n,m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
keta = ["-1"] * n
if n == 1:
  ans = -1
  for s,c in sc:
    if ans == -1 or ans == c:
      ans = c
    else:
      print(-1)
      exit()
  if ans == -1:
    print(0)
  else:
    print(ans)
else:
  for s,c in sc:
    s-=1
    if keta[s] == "-1" or keta[s] == str(c):
      keta[s] = str(c)
    else:
      print(-1)
      exit()
  ans = ""
  for k,i in enumerate(keta):
    if i == "-1":
      if k == 0:
        ans += "1"
      else:
        ans += "0"
    else:
      ans += i   
  if ans[0] == "0":
    print(-1)
    exit()
  else:
    print(ans)

Submission status: Runtime Error

Solution code:
N = input()

print(N//2 + N%2)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())

a = [input().split() for i in range(m)]

s = []
c = []

for i in range(m):
    s.append(a[i][0])
    c.append(a[i][1])

S = [int(i) for i in s]
C = [int(i) for i in c]

x = 0
z = 0

for i in range(m):
    x += C[i] * (10 ** (n-S[i]))
    for k in range(m):
        if n >= 2 and S[i] == 1 and C[i] == 0:
            z += 1
            break
        if S[i] == S[k] and C[i] != C[k]:
            z += 1
            break
        if S[i] == S[k] and C[i] == C[k] and i > k:
            x -= C[i] * (10 ** (n-S[i]))
            break

if z == 0:
    if '1' in S or m == 0:
        print(x)
    else:
        print(x+10**(n-1))

else:
    print('-1')

Submission status: Runtime Error

Solution code:
#include<stdio.h>
int main()
{
  int n;
  scanf("%d",&n);
  printf("%d",(n+1)/2);
  return 0;
}

Submission status: Runtime Error

Solution code:
from collections import deque
import numpy as np
n,m,k=map(int,input().split())
link=[[] for _ in range(n)]
block=[[]  for _ in range(n)]
ans=[]
s=[]
for i in range(m):
    a,b=map(int,input().split())
    link[a-1].append(b-1)
    link[b-1].append(a-1)
for i in range(k):
  a,b=map(int,input().split())
  block[a-1].append(b-1)
  block[b-1].append(a-1)
for i in range(n):#スタートの選び方
    visited=set()
    q=deque([i])
    while len(q)>0:
        x=q.pop()
        visited.add(x)
        for j in link[x]:
            if j in visited:
              continue
            elif j in q:
              continue
            else:q.append(j)
    ans.append(len(visited))
    s.append(visited)

Submission status: Runtime Error

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

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:
S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print('Bad')
else:
    print('Good')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#Biginner Contest 157 B-Bingo
#二次元配列を使う(3*3)
bingonum=[[0,0,0],[0,0,0],[0,0,0]]
bingo=[["False","False","False"],["False","False","False"],["False","False","False"]]
for i in range(3):
    bingonum[i][0],bingonum[i][1],bingonum[i][2] = map(int,input().split())

N = int(input())
b=[]
for _ in range(N):
    b.append(int(input()))

for x in range(N):
    for i in range(3):
        for j in range(3):
            if bingonum[i][j]==b[x]:
                bingo[i][j]="True"

IsBingo = "No"
for i in range(3):
    if bingo[i][0] =="True" and bingo[i][1] =="True" and bingo[i][2] =="True":
        IsBingo="Yes"
    elif bingo[0][i] =="True" and bingo[1][i] =="True" and bingo[2][i] =="True":
        IsBingo="Yes"
if (bingo[0][0] =="True" and bingo[1][1] =="True" and bingo[2][2] =="True") or (bingo[0][2] =="True" and bingo[1][1] =="True" and bingo[2][0]=="True"):
    IsBingo="Yes"
print(IsBingo)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
number = []
result = "No"

for i in range(3):
	for n in input().split():
		n = int(n)
		number.append(n)

bingo = [None for _ in range(9)]

N  = int(input())
for i in range(N):
	b = int(input())
	for j in range(9):
		if b == number[j]:
			bingo[j] = True


for i in range(3):
	if bingo[3*i] == bingo[3*i+1] and bingo[3*i+1] == bingo[3*i+2] and bingo[3*i] == True:
		result = "Yes"

for i in range(3):
	if bingo[i] == bingo[3+i] and bingo[3+i] == bingo[6+i] and bingo[i] == True:
		result = "Yes"

if bingo[0] == bingo[4] and bingo[4] == bingo[8] and bingo[0] == True:
	result = "Yes"

if bingo[2] == bingo[4] and bingo[4] == bingo[6] and bingo[2] == True:
	result = "Yes"

print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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:
n =int(input())
if n//2=0:
  print(n//2)
else:
  print(n//2+1)

Submission status: Runtime Error

Solution code:

from collections import defaultdict
N,M = (int(x) for x in input().split())
keta_num_str = [ (input().split()) for i in range(M) ]

#各桁をキー、数字を値の辞書にする
suuji = ""
num_str_dic = defaultdict(set)
kotae_dic ={ str(i):"0" for i in range(1,N + 1) } #　各桁に初期値”０”を入力
for i in keta_num_str:   
    num_str_dic[i[0]].add(i[1])


for i,v in num_str_dic.items():
    if 1 < len(v) : # 一つの桁に複数の値がある時はエラー
        kotae_dic ={}
        break

    else:
        kotae_dic[i] = list(v)

# 表示
import math
if kotae_dic == {}: # 一つの桁に複数の値の時        
    print(-1)
else:
    kotae_dic_sorted = sorted(kotae_dic.items(),key=lambda x:int(x[0]))
    kotae_str = "".join( [i[1][0] for i in kotae_dic_sorted ] ) # 辞書の値を連結
    kotae_int =int(kotae_str)
    if kotae_int == 0 and 1< N: # "00"などはエラー、"0"はOK
        print(-1)
    elif kotae_int == 0 and N == 1:
        print("0")
    elif 10**(N-1) > kotae_int or kotae_int >= 10** N: # 桁があってない＝一番左の桁が”０”はエラー
        print(-1)
    else:
        print(kotae_int)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a = []
[a.append(list(map(int, input().split()))) for _ in range(3)]
n = int(input())
b = [int(input())for _ in range(n)]
for i in b:
  for j in range(3):
    for k in range(3):
      if a[j][k] == i:
        a[j][k] = 1
ans = 0
count =0
for j in range(3):
  if a[j].count(1) == 3:
    ans += 1
  elif (a[0][j] == a[1][j] == a[2][j]) == 1:
    ans += 1
  elif (a[0][0] == a[1][1] == a[2][2]) == 1:
    ans += 1
  elif (a[0][2] == a[1][1] == a[2][0]) == 1:
    ans += 1
if ans > 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
from collections import defaultdict
N,M = (int(x) for x in input().split())
keta_num_str = [ (input().split()) for i in range(M) ]

#各桁をキー、数字を値の辞書にする
suuji = ""
num_str_dic = defaultdict(set)
kotae_dic ={ str(i):"0" for i in range(1,N + 1) } #　各桁に初期値”０”を入力
for i in keta_num_str:   
    num_str_dic[i[0]].add(i[1])


for i,v in num_str_dic.items():
    if 1 < len(v) : # 一つの桁に複数の値がある時はエラー
        kotae_dic ={}
        break

    else:
        kotae_dic[i] = list(v)

# 表示
if kotae_dic == {}: # 一つの桁に複数の値の時        
    print(-1)
else:
    kotae_dic_sorted = sorted(kotae_dic.items(),key=lambda x:int(x[0]))
    kotae_str = "".join( [i[1][0] for i in kotae_dic_sorted ] ) # 辞書の値を連結
    kotae_int =int(kotae_str)
    if kotae_int == 0: # "00"などはエラー
        print(-1)
    else:
        print(kotae_int)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
ans=[set()for i in range(n)]
for i in range(m):
    s,c=map(int,input().split())    
    ans[s-1].add(c)
f=1
an=''
#print(ans)
for i in ans:
    if len(i)>1:
        f=0
        break
    if len(i)==0:
        an+='p'
    else:
        an+=str(i.pop())
if not f:
    print(-1)
else:
    an=an.replace('p','0')
    if an[0]=='0':
        print(-1)
    else:    
        print(an)

Submission status: Runtime Error

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

Submission status: Runtime Error

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