Problem:


Score : 100 points

Problem Statement

You are given two positive integers a and b.
Let x be the average of a and b.
Print x rounded up to the nearest integer.

Constraints

a and b are integers.

1 \leq a, b \leq 100

Input

Input is given from Standard Input in the following format:

a b

Output

Print x rounded up to the nearest integer.

Sample Input 1

1 3

Sample Output 1

2

The average of 1 and 3 is 2.0, and it will be rounded up to the nearest integer, 2.

Sample Input 2

7 4

Sample Output 2

6

The average of 7 and 4 is 5.5, and it will be rounded up to the nearest integer, 6.

Sample Input 3

5 5

Sample Output 3

5



Sample input:
1 3


Sample output:
2

Submission status: Runtime Error

Solution code:
import string

alphabet = {}
n  = 0
for i in string.ascii_lowercase:
    alphabet[i] = n
    n += 1
    
s = list(input().rstrip())
t = list(input().rstrip())



for i in range(len(s)):
    s[i] = alphabet[s[i]]
    
for i in range(len(t)):
    t[i] = alphabet[t[i]]
    

s.sort()
t.sort(reverse=True)

if s < t:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import math
numbers = input().rstrip().split()
number1 = numbers[0]
number2 = numbers[1]

mean = (number1+number2) / 2

print(math.ceil(mean))

Submission status: Runtime Error

Solution code:
s = sorted(input())
t = sorted(input())
t.reverse()
if s<t:
	print("Yes")
else:
	print("No")

Submission status: Runtime Error

Solution code:
a = int(input().split())
print(int(round((a[0]+a[1])/2)))

Submission status: Runtime Error

Solution code:
a = int(input().split())
print(round((a[0]+a[1])/2))

Submission status: Runtime Error

Solution code:
a = input()
b = input()
 
c = round((a+b)/2)
 
print(int(c))

Submission status: Runtime Error

Solution code:
a = input()
b = input()

c = (a+b)/2

print(c.round())

Submission status: Runtime Error

Solution code:
a, b = map(int, raw_input().split())
if str(a + b) % 1:
    print str(a + b + 1)
else:
    print str(a + b)

Submission status: Runtime Error

Solution code:
a, b = map(int, raw_input().split())
if str(a + b) % 1:
    print str(a + b)
else:
    print str(a + b + 1)

Submission status: Runtime Error

Solution code:
a, b = map(int, raw_input().split())
if (a + b) % 1:
    print str(a + b)
else:
    print str(a + b + 1)

Submission status: Runtime Error

Solution code:
a,b = map(int,input().sp;it())
print((a+b)//2)

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split)
print((a+b)//2)

Submission status: Runtime Error

Solution code:
print((sum(map(int,input().split())+1)//2)

Submission status: Runtime Error

Solution code:
def move(key,gx,gy,x,y,mx,my):
    if key[0]=='F':
        return move(key[1::],gx,gy,x+mx,y+my,mx,my)
    elif key[0]=='T':
        if mx==0:
            return move(key[1::],gx,gy,x,y,1,0)
            return move(key[1::],gx,gy,x,y,-1,0)
        else:
            return move(key[1::],gx,gy,x,y,0,1)
            return move(key[1::],gx,gy,x,y,0,-1)
    else:
        if x==gx and y==gy:
            return 1
        else:
            return 0

s1=input()
s2=input().split(' ')
ans=0
ans+=move(s1+'X',int(s2[0]),int(s2[1]),0,0,1,0)
if ans==0:
    print('No\n')
else:
    print('Yes\n')

Submission status: Runtime Error

Solution code:
def main(S,target):
    dic_vector = [1,0]
    position = [0,0]
    x_path = abs(target[0])
    y_path = abs(target[1])
    if (S.count('F')-x_path-y_path)<0:
        print("No")
        exit()
    count = 0
    try:
        findPath(count,position,dic_vector)
    except Exception:
        print("No")


def findPath(index,position,dic_vector):
    if len(S) == index:
        if target == position:
            print("Yes")
            exit()
        return
    if S[index] == 'F':
        position = [position[0]+dic_vector[0],position[1]+dic_vector[1]]
        findPath(index+1,position,dic_vector)
    else:
        if dic_vector[0]:
            dic_vector = [0,1]
            findPath(index+1,position,dic_vector)
            dic_vector = [0,-1]
            findPath(index+1,position,dic_vector)
        else:
            dic_vector = [1,0]
            findPath(index+1,position,dic_vector)
            dic_vector = [-1,0]
            findPath(index+1,position,dic_vector)


if __name__=="__main__":
    S = list(input())
    target = list(map(int,input().split(" ")))
    main(S,target)

Submission status: Runtime Error

Solution code:
import math

a = int(input())
b = int(input())

ans = math.ceil(a/b)

print(ans)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
ans = a+b
print(a/b)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
ans = a+b
print a/b

Submission status: Runtime Error

Solution code:
s=input()
x,y=[int(i) for i in input().split()]

if x==0:
    print("No")

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <cmath>
using namespace std;


int main()
{
  float a, b;

  cin >> a >> b;
  cout << (int)round((a+b)/2) << endl;
  
  return 0;
}

Submission status: Runtime Error

Solution code:
-*- coding: utf-8 -*-
 
import math
 
l = rawinput().split()
print(math.ceil(l[0] + l[1])

Submission status: Runtime Error

Solution code:
-*- coding: utf-8 -*-
 
import math
 
l = raw_input().split()
print(math.ceil(l[0] + l[1])

Submission status: Runtime Error

Solution code:
-*- coding: utf-8 -*-

import math

l = rawinput().split()
print(math.ceil(l[0] + l[1])

Submission status: Runtime Error

Solution code:
def compare(a, A):
    R=0
    for i in range(0, len(A)):
        if(a==A[i]):
            R+=1
        elif(a<A[i]):
            break
    return R

def result(R,a):
    if(R==a):
        return 0
    elif(a<R):
        return R-a
    return R

N = int(input())

a = list(map(int, input().split()))
a.sort()

R=0
T=compare(a[0],a)
R+=result(T,a[0])

for i in range(1, N):
    if(a[i] != a[i-1]):
        C=compare(a[i],a[T:])
        R+=result(C,a[i])
        T+=C

print(R)

Submission status: Runtime Error

Solution code:
def compare(a, A):
    R=0
    for i in range(0, len(A)):
        if(a==A[i]):
            R+=1

    if(R==a):
        return 0
    elif(a<R):
        return R-a
    return R

N = int(input())

a = list(map(int, input().split()))
a.sort()

R=0
R+=compare(a[0],a)

for i in range(1, N):

    if(a[i] != a[i-1]):
        R+=compare(a[i],a)

print(R)

Submission status: Runtime Error

Solution code:
print((lambda x: int((int(x[0]) + int(x[1])) / 2 + 0.999999999999999999999999999999))(input().split())print((lambda x: int(0.999999999999 + ((int(x[0]) + int(x[1])) / 2)))(input().split()))

Submission status: Runtime Error

Solution code:
s=list(input())
t=list(input())
ss=''.join(sorted(ss))
tt=''.join(sorted(tt,reverse=true))
if ss<tt:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s=input()
p=list(map(int,input().split()))
t=[0,0]
k=0
for i in s:
    if i=='T':k^=1
    else:
        if t[k]>p[k]:t[k]-=1
        else:t[k]+=1
print(['No','Yes'][p==t])

Submission status: Runtime Error

Solution code:
s=input()
p=list(map(int,input().split()))
t=[0,0]
k=0
for i in s:
    if i=='T':k^=1
    else:
        if t[k]>p[k]:t[k]-=1
        else:t[k]+=1
print(['NO','YES'][p==t])

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8

def no():
    print("No")
    return

def main():
    s = input()
    x, y = list(map(int, input().split()))
    x_start = 0
    f_count = 0
    x_dirs = []
    y_dirs = []
    is_x = True # xを向いてるか
    t_exist = False
    for c in s:
        if c == "F":
            f_count += 1
            continue
        # T
        if f_count > 0:
            if is_x:
                if t_exist:
                    x_dirs.append(f_count)
                else:
                    x_start = f_count
            else:
                y_dirs.append(f_count)
        t_exist = True
        is_x = not is_x
        f_count = 0
        continue
    if f_count > 0:
        if is_x:
            if t_exist:
                x_dirs.append(f_count)
            else:
                x_start = f_count
        else:
            y_dirs.append(f_count)

    memo_x = [{} for _ in range(len(x_dirs)+1)]
    memo_y = [{} for _ in range(len(y_dirs)+1)]
    memo_x[0][x_start] = True
    memo_y[0][0] = True

    for i, dx in enumerate(x_dirs):
        for j in memo_x[i]:
            memo_x[i+1][j-dx] = True
            memo_x[i+1][j+dx] = True
    for i, dy in enumerate(y_dirs):
        for j in memo_y[i]:
            memo_y[i+1][j-dy] = True
            memo_y[i+1][j+dy] = True

    # print(x_dirs, y_dirs)
    # print(memo_x)
    # print(memo_y)

    if x not in memo_x[len(x_dirs)]:
        return no()
    if y not in memo_y[len(y_dirs)]:
        return no()
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def solv():
    s = sorted(input())
    t = sorted(input(),reverse=True)

    if(s<t):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    solv()

Submission status: Runtime Error

Solution code:
def solv():
    s = ''.join(sorted(input()))
    t = ''.join(sorted(input(),reverse=True))

    if(s<t):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    solv()

Submission status: Runtime Error

Solution code:
def solv():
    s = ''.join(sorted(input()))
    t = ''.join(reversed(sorted(input())))

    if(s<t):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    solv()

Submission status: Runtime Error

Solution code:
def solv():
    s = ''.join(sorted(input()))
    t = ''.join(sorted(input()))[::-1]

    if(s<t):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    solv()

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())

x = (a + b) // 2
y = (a + b) % 2
if y != 0 :
    print(str(x + 1))
else      :
    print(str(x))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8

def no():
    print("No")
    return

def shift(i):
    return i+8001

def main():
    s = input()
    x, y = list(map(int, input().split()))
    x_start = 0
    x_count = 0
    y_count = 0
    t_count = 0
    f_count = 0
    x_dirs = []
    y_dirs = []
    is_x = True # xを向いてるか
    f_before_t = 0
    t_exist = False
    for c in s:
        if c == "T":
            t_count += 1
            if f_count > 0:
                if is_x and not t_exist:
                    x_dirs.append(f_count)
                else:
                    y_dirs.append(f_count)
                f_count = 0
            t_exist = True
            continue
        f_count += 1
        if not t_exist:
            x_start += 1
            f_before_t += 1
        if t_count % 2 == 0:
            # 向いている方向に進む
            if is_x:
                x_count += 1
            else:
                y_count += 1
        else:
            if is_x:
                y_count += 1
            else:
                x_count += 1
            is_x = not is_x
        t_count = 0
    if f_count > 0:
        if is_x:
            x_dirs.append(f_count)
        else:
            y_dirs.append(f_count)
    if (x % 2) != (x_count % 2):
        return no()
    if abs(x) > x_count:
        return no()
    if (y % 2) != (y_count % 2):
        return no()
    if abs(y) > y_count:
        return no()
    if (x_count - f_before_t*2) < x*-1:
        return no()


    memo_x = [[False for _ in range(16001)] for _ in range(len(x_dirs)+1)]
    memo_y = [[False for _ in range(16001)] for _ in range(len(y_dirs)+1)]
    memo_x[0][shift(x_start)] = True
    memo_y[0][0] = True

    for i, dx in enumerate(x_dirs):
        for j in range(16001):
            if memo_x[i][j]:
                memo_x[i+1][j-dx] = True
                memo_x[i+1][j+dx] = True
    for i, dy in enumerate(y_dirs):
        for j in range(16001):
            if memo_y[i][j]:
                memo_y[i+1][j-dy] = True
                memo_y[i+1][j+dy] = True
    if not memo_x[len(x_dirs)][shift(x)]:
        return no()
    if not memo_y[len(y_dirs)][shift(y)]:
        return no()
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import collections
import itertools

s = list(map(str, input()))
g = list(map(lambda x: int(x),input().split()))

seq = ('R', 'L')

ans = False

count_dict = collections.Counter(s)

g_sum = abs(g[0])+abs(g[1])
if g_sum > count_dict['F']:
    print('No')
else:
    patterns = list(itertools.product(seq, repeat=count_dict['T']))

    for _p in patterns:
        i = 0
        m = [0, 0]
        n = 3
        for _s in s:
            if _s == 'F':
                if n == 3:
                    m[0] = m[0] + 1
                elif n == 1:
                    m[0] = m[0] - 1
                elif n == 0:
                    m[1] = m[1] + 1
                elif n == 2:
                    m[1] = m[1] - 1
            else:
                i = i + 1
                if _p[i-1] == 'R':
                    if n == 0:
                        n = 3
                    else:
                        n = n - 1
                elif _p[i-1] == 'L':
                    if n == 3:
                        n = 0
                    else:
                        n = n + 1

        if m[0] == g[0] and m[1] == g[1]:
            ans = True
            break

    if ans:
        print('Yes')
    else:
        print('No')

Submission status: Runtime Error

Solution code:
    a, b =  map(int,input().split( ))
    x = (a + b)/2
    if x%2 == 0:
        return x
    else:
         x = int(x) +1
        return x

Submission status: Runtime Error

Solution code:
import sys

sys.setrecursionlimit(10000)

s = input()
x, y = [int(x) for x in input().split()]

d = (
    (1, 0),
    (0, 1),
    (-1, 0),
    (0, -1),
)

def next_dr(dr):
    def fix(dr):
        if dr == -1:
            return 3
        if dr == 4:
            return 0
        return dr
    return fix(dr - 1), fix(dr + 1)

def next_dr_set(dr_set, l):
    if l == 0:
        return dr_set
    _next_dr_set = set()
    for dr in dr_set:
        _next_dr_set.update(set(next_dr(dr)))
    return next_dr_set(_next_dr_set, l - 1)

def next_dr_list(dr, l):
    dr_set = next_dr_set(set([dr]), l)
    return list(dr_set)

def _next_dr_list(dr, l):
    if l == 0:
        return [dr]
    if dr % 2 == 0:
        if l % 2 == 0:
            return [0, 2]
        else:
            return [1, 3]
    else:
        if l % 2 == 0:
            return [1, 3]
        else:
            return [0, 2]

def dfs(s, a, b, dr):
    # print("called")
    # print(s)
    # print(a)
    # print(b)
    # print(dr)
    if s == '':
        return x == a and y == b

    if s[0] == 'F':
        dx, dy = d[dr]
        a += dx
        b += dy
        return dfs(s[1:], a, b, dr)
    else:
        l = s.find('F')
        if l == -1:
            return x == a and y == b

        dr_list = _next_dr_list(dr, l)
        for next_dr in dr_list:
            if dfs(s[l:], a, b, next_dr):
                return True

        return False

ans = "Yes" if dfs(s, 0, 0, 0) else "No"
print(ans)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split( ))
x = (a + b)/2
if x%2 == 0:
    return x
else:
    x = int(x) +1
    return x

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split( ))
x = (a + b)/2
if x%2 == 0:
    return x
else:
    x = int(x) +1
    return x

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split( ))
x = (a + b)/2
c = int(x)
return c

Submission status: Runtime Error

Solution code:
a, b = map(int, input(),split( ))
x = (a + b)/2
c = int(x)
return c

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8

def no():
    print("No")
    return

def main():
    s = input()
    x, y = list(map(int, input().split()))
    x_count = 0
    y_count = 0
    t_count = 0
    is_x = True # xを向いてるか
    for c in s:
        if c == "T":
            t_count += 1
            continue
        if t_count % 2 == 0:
            # 向いている方向に進む
            if is_x:
                x_count += 1
            else:
                y_count += 1
        else:
            if is_x:
                y_count += 1
            else:
                x_count += 1
            is_x = not is_x
        t_count = 0
    if (x % 2) != (x_count % 2):
        return no()
    if abs(x) > x_count:
        return no()
    if (y % 2) != (y_count % 2):
        return no()
    if abs(y) > y_count:
        return no()
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import math

input_data = input()

for line in input_data:
    datas = line.split(" ")
    datas = [int(x) for x in datas]
    print(int(math.floor((datas[0] + datas[1]) / 2)))

Submission status: Runtime Error

Solution code:
# coding:utf-8
N = int(input())
a = input().split()
a_ = list(map(int, a))

#back_a = list(map(lambda x:x*0, list(range(N))))

back_i = 0
back_i2 = 0
for i in range(N):
    a_count = a[i-back_i]
    if a_count > int(a[i-back_i]):
        del a[i-back_i]
        back_i += 1
        back_i2 += 
    if a_count < int(a[i-back_i]):
        del a[i-back_i]
        back_i += 1

print(back_i)

Submission status: Runtime Error

Solution code:
import string
if __name__=="__main__":
    s = list(input())
    t = list(input())
    flag = False
    if s is t:
        print("No")
        exit()
    dic = string.ascii_lowercase
    c = 0
    for j in range(len(s)):
        if s[j] in t:
            c+=1
    if c==len(s) and c<len(t):
        print("Yes")
        exit()
    for i in range(len(dic)):
        if s.__contains__(dic[i]) and t.__contains__(dic[i]):
            flag = True
        if flag and s.__contains__(dic[i]) and not t.__contains__(dic[i]):
            for j in range(i+1,len(dic)):
                if t.__contains__(dic[j]):
                    print("Yes")
                    exit()
    print("No")

Submission status: Runtime Error

Solution code:
import sys

sys.setrecursionlimit(10000)

s = input()
x, y = [int(x) for x in input().split()]

d = (
    (1, 0),
    (0, 1),
    (-1, 0),
    (0, -1),
)

def next_dr(dr):
    def fix(dr):
        if dr == -1:
            return 3
        if dr == 4:
            return 0
        return dr
    return fix(dr - 1), fix(dr + 1)

def dfs(s, a, b, dr):
    # print("===")
    # print(s)
    # print(a, b)
    # print(dr)
    # print(x == a and y == b)

    if s == '':
        return x == a and y == b

    if s[0] == 'F':
        dx, dy = d[dr]
        a += dx
        b += dy
        return dfs(s[1:], a, b, dr)
    else:
        next_dr1, next_dr2 = next_dr(dr)
        return dfs(s[1:], a, b, next_dr1) or dfs(s[1:], a, b, next_dr2)

ans = "Yes" if dfs(s, 0, 0, 0) else "No"
print(ans)

Submission status: Runtime Error

Solution code:
#coding: utf-8

N = input().split()
A=N[0]
B=N[1]
C=(A+B)/2
intC =int(C)
C_list = list(C)
C_cou = C_list.count(.)

if A==B:
	print(A)
elif intC < C:
	print(intC+1)
elif intC == C:
	print(intC)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
ave = (a + b) / 2

if ave - int(ave) > 0:
    ave = int(ave) + 1
else
    ave = int(ave)

print(ave)

Submission status: Runtime Error

Solution code:
A=list(input())
B=list(input())
minm=min(A)
maxi=max(B)

while min(len(A),len(B))!=0:
 if minm<maxi:
  print("Yes")
  break
 if minm==maxi:
  A.remove(minm)
  B.remove(maxi)
 if minm>maxi:
  print("No") 
  break
 if min(len(A),len(B))==0:
  print("No")
  break

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())

def f(s, t):
  s.sort()
  t.sort(reverse=True)

  for i in range(len(s)):
    if s[i] < t[i]:
      return 'Yes'
    elif s[i] > t[i]:
      return 'No'
    elif i + 1 >= len(s) and not i + 1 >= len(t):
      return 'No'
  return 'No'

print(f(s, t))

Submission status: Runtime Error

Solution code:
    #coding: utf-8
    N = input().rstrip()
     
    A=N[0]
    B=N[1]
    C=int((A+B)/2)
    if A==B:
    	print(A)
    else:
    	print(int(C)+1)

Submission status: Runtime Error

Solution code:
    #coding: utf-8
    N = input().split()
     
    A=int(N[0])
    B=int(N[1])
    C=int((A+B)/2)
    if A=B:
    	print(A)
    else:
    	print(int(C)+1)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
V = (a+b)/2
if (a+b)%2==0:
    print(int(V)
else:
    v =int((a + b)/2 + (1 - ((a + b)/2 - int((a + b)/2))))
    print(v)

Submission status: Runtime Error

Solution code:
s = input()
t = input()
listS = list(s)
listT = list(t)
sorted(listS)
sorted(listT)
if listS > listT:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
#coding: utf-8
N = input().rstrip()

A=int(N[0])
B=int(N[1])
C=int((A+B)/2)
if A=B:
	print(A)
else:
	print(int(C)+1)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in set(a):
    temp = a.count(i)
    if temp > i:
        ans += temp - i
    elif temp < i:
        ans += i
print(ans)

Submission status: Runtime Error

Solution code:
A, B=list(map(int, input().split()))
print(math.ceil((A+B)/2))

Submission status: Runtime Error

Solution code:
#coding: utf-8
N = input().rstrip()

A=int(N[0])
B=int(N[1])
C=int((A+B)/2)

if A==B:
	print(A)
else:
	print(int(C)+1)

Submission status: Runtime Error

Solution code:
#coding: utf-8
N = map(int,input().rstrip())

A=N[0]
B=N[1]
C=(A+B)/2

if A==B:
	print(A)
else:
	print(int(C)+1)

Submission status: Runtime Error

Solution code:
#coding: utf-8
N = map(int,input().rstrip())

A=N[0]
B=N[1]
C=round((A+B)/2,0)

if A==B:
	print(A)
else:
	print(int(C))

Submission status: Runtime Error

Solution code:
import math

a,b = list(map(int, input().split()))

c = a + b
d = c/2

x = ceil(d)

print(x)

Submission status: Runtime Error

Solution code:
import math
if __name__=="__main__":
    a = list(map(int,input()))
    b = (a[0]+a[1])/2
    if b-a[0]>a[1]-b:
        print(math.floor(b))
    else:
        print(math.floor(b)+1)

Submission status: Runtime Error

Solution code:
a=map(int,input().split())
print(int(a[0]+a[1]))

Submission status: Runtime Error

Solution code:
x, y = map(int, raw_input().split())
print (a+b+1)/2