Problem:


Score : 100 points

Problem Statement

We have two bottles for holding water.

Bottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.

Bottle 2 contains C milliliters of water.

We will transfer water from Bottle 2 to Bottle 1 as much as possible.

How much amount of water will remain in Bottle 2?

Constraints

All values in input are integers.

1 \leq B \leq A \leq 20

1 \leq C \leq 20

Input

Input is given from Standard Input in the following format:

A B C

Output

Print the integer representing the amount of water, in milliliters, that will remain in Bottle 2.

Sample Input 1

6 4 3

Sample Output 1

1

We will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.

Sample Input 2

8 3 9

Sample Output 2

4

Sample Input 3

12 3 7

Sample Output 3

0



Sample input:
6 4 3


Sample output:
1

Submission status: Runtime Error

Solution code:
	class Common:

    problem = []
    index = 0

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            return self.problem[self.index]
            self.index += 1
        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(ABS_PATH + '/*.txt'):
                self.initialize(path)
                self.resolve()
        except NameError:
            self.resolve()

class A(Common):

    def resolve(self):

        q = [int(i) for i in self.input_data().split()]
        result = q[2] - q[0] +q[1]
        if result < 0:
            print('0')
        else:
            print(str(result))

solver = A()
solver.exec_resolve()

Submission status: Runtime Error

Solution code:
# ABC 136 C
n = int(input())
h = [ int(_) for _ in input().split() ]
flag = True

for i in range(len(h)-1, 0, -1):
    if h[i-1] > h[i] +1:
        h[i-1] = h[i-1]-1  
        
for j in range(0,len(h)-1):
    if h[j] > h[j+1]:
        print('No')
        flag = False
        break
        
if flag == True:
    print('Yes')

Submission status: Runtime Error

Solution code:
a = int(input())
unchi = 0
for i in range(1,a):
    if 99999 >= a >= 10000:
        unchi += 1
    elif 999 >= a >= 100:
        unchi += 1
    elif 9 >= a >= 1:
        unchi += 1
print(unchi)

Submission status: Runtime Error

Solution code:
a = int(input())
unchi = 0
for i in range(a):
    if 99999 >= a >= 10000:
        unchi += 1
    elif 999 >= a >= 100:
        unchi += 1
    elif 9 >= a >= 1:
        unchi += 1
print(unchi)

Submission status: Runtime Error

Solution code:
a = int(input())
unchi = 0
while a>=1:
    a -= 1
    if 99999 >= a >= 10000:
        unchi += 1
    elif 999 >= a >= 100:
        unchi += 1
    elif 9 >= a >= 1:
        unchi += 1
print(unchi)

Submission status: Runtime Error

Solution code:
from sys import stdin
a = stdin.readline().rstrip()
b = stdin.readline().rstrip()
c = stdin.readline().rstrip()

A = int(a)
B = int(b)
C = int(c)


X = A + B - C
if X >= 0:
    print(X)
else:
    print(0)

Submission status: Runtime Error

Solution code:
from sys import stdin
A = stdin.readline()
B = stdin.readline()
C = stdin.readline()

X = A + B - C
if X >= 0:
    print(X)
else:
    print(0)

Submission status: Runtime Error

Solution code:

X = A + B - C
if X >= 0:
    print(X)
else:
    print(0)

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
C = int(input())

X = A + B - C
if X >= 0:
    print(X)
else:
    print(0)

Submission status: Runtime Error

Solution code:
a=int(input())
b=0
c=0
list=list(map(int,input().split()))
for i in range(a-1):
    if list[i]-list[i+1]<=0:
        continue
    elif list[i]-list[i+1]==1:
        if i+2<=a-1:
            if list[i+1]-list[i+2]==1:
                c=1
                print("No")
                break
        continue
    elif list[i]-list[i+1]>=2:
        c=1
        print("No")
        break
if c==0:
    print("Yes")

Submission status: Runtime Error

Solution code:
n=input()
x=len(n)
if x==1:
    print(n)

elif x<3:
    print(9)
elif x==3:
    print(9+int(n)-100+1)
elif x<5:
    print(909)
elif x==5:
    print(9+900+int(n)-10000+1)
else:
    print(90909)

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
if c > (a - b):
	print(c - (a - b)
else:
    print(0)

Submission status: Runtime Error

Solution code:
a, b, c = int(input().split())
x = c - (a - b)
print(x)

Submission status: Runtime Error

Solution code:
a, b, c = int(input().split())
print(c - (a - b))

Submission status: Runtime Error

Solution code:
N=int(input())
all=0
a=5
while(a>0):
  if(10**a>N):
    a-=1
    continue
  if(a%2==1):
    all+=9*10**(a-1)
    a-=1
    continue
  else:
    all+=N+1-10**a
  
  a-=1

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split)
print(c-a+b);

Submission status: Runtime Error

Solution code:
A,B, C= list(map(int,input().split()))
if C - (A - B) >= 0
    print(C - (A - B))
else
    print(0)

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 0
for i in range(1, N + 1):
    if len(str(i)) % 2 == 1:
      ans += 1
      
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 0
for i in range(1, N + 1):
    if len(str(i)) % 2 is 1:
      ans += 1
      
print(ans)

Submission status: Runtime Error

Solution code:
N = input()
ans = 0
for i in range(1, N + 1):
    if len(str(i)) % 2 is 1:
      ans += 1
      
print(ans)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
signed main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << max(c - a + b, 0) << endl;
}

Submission status: Runtime Error

Solution code:
from heapq import heappush, heappop


class SegmentTree(object):

    def __init__(self, init_array, seg_func=min, seg_func_null=10 ** 9 + 7):

        self.seg_func = seg_func
        self.seg_func_null = seg_func_null
        self.n = 1
        while self.n < len(init_array):
            self.n *= 2
        self.dat = [0] * (2 * self.n - 1)
        for i in range(len(init_array)):
            self.dat[self.n - 1 + i] = init_array[i]
        for i in range(self.n - 2, -1, -1):
            self.dat[i] = self.seg_func(self.dat[2 * i + 1], self.dat[2 * i + 2])

    def update(self, k, a):
        k += self.n - 1
        self.dat[k] = a
        while k > 0:
            k = (k - 1) // 2
            self.dat[k] = self.seg_func(self.dat[k * 2 + 1], self.dat[k * 2 + 2])

    def query(self, p, q):
        # [p, q)
        if q <= p:
            return self.seg_func_null

        p += self.n - 1
        q += self.n - 2
        res = self.seg_func_null

        while q - p > 1:
            if p & 1 == 0:
                res = self.seg_func(res, self.dat[p])
            if q & 1 == 1:
                res = self.seg_func(res, self.dat[q])
                q -= 1
            p = p // 2
            q = (q-1) // 2
        if p == q:
            res = self.seg_func(res, self.dat[p])
        else:
            res = self.seg_func(self.seg_func(res, self.dat[p]), self.dat[q])

        return res


N = int(input())
hx = []
hy = []

for i in range(N):
    x, y = map(int, input().split())
    heappush(hx, (x, y))

y_list = [0] * N
for i in range(N):
    x, y = heappop(hx)
    y_list[i] = y
    heappush(hy, (y, i))

y_nor_list = [0] * N
for j in range(N):
    y, i = heappop(hy)
    y_nor_list[i] = j


def add(x, y):
    return x + y


sg_left = SegmentTree(init_array=[0]*N, seg_func=add, seg_func_null=0)
sg_right = SegmentTree(init_array=[0]*N, seg_func=add, seg_func_null=0)

left_lower = [0] * N
left_upper = [0] * N
right_lower = [0] * N
right_upper = [0] * N

for i in range(N):
    c = y_nor_list[i]
    left_lower[i] = sg_left.query(0, c)
    left_upper[i] = sg_left.query(c, N)
    sg_left.update(c, 1)

for i in range(N-1, -1, -1):
    c = y_nor_list[i]
    right_lower[i] = sg_right.query(0, c)
    right_upper[i] = sg_right.query(c, N)
    sg_right.update(c, 1)

# print(left_lower)
# print(left_upper)
# print(right_lower)
# print(right_upper)

LARGE = 998244353

res = 0
for i in range(N):
    r = pow(2, N, LARGE) - 1
    r -= pow(2, left_lower[i] + left_upper[i], LARGE) - 1
    r -= pow(2, right_lower[i] + right_upper[i], LARGE) - 1
    r -= pow(2, left_lower[i] + right_lower[i], LARGE) - 1
    r -= pow(2, left_upper[i] + right_upper[i], LARGE) - 1
    r += pow(2, left_lower[i], LARGE) - 1
    r += pow(2, left_upper[i], LARGE) - 1
    r += pow(2, right_lower[i], LARGE) - 1
    r += pow(2, right_upper[i], LARGE) - 1
    res += r

print(res % LARGE)

Submission status: Runtime Error

Solution code:
num = input()

result = 0

if len(num) != 1:
  result = int((len(num)-2)//2 * ("90") + "9")

if len(num) % 2 == 0:
  print(result)
else:
  AAA = int("1" + (len(num) - 1) * "0") - 1
  print(result + int(num) - AAA)

Submission status: Runtime Error

Solution code:
given = int(input())
ans = 0
for i in range(given):
  current = str(i + 1)
  if len(current) & 1:
    ans += 1
  
print(ans)

Submission status: Runtime Error

Solution code:
given = int(input())
ans = 0
for i in range(given):
  current = str(i + 1)
  ans += len(current) & 1
print(ans)

Submission status: Runtime Error

Solution code:
A, B, C = input().split()
 
if B + C <= A:
  result = 0
else:
  result = B+C-A
 
print(result)

Submission status: Runtime Error

Solution code:
a.b,c = map(int,input().split())
print(c-(a-b))

Submission status: Runtime Error

Solution code:
a,b,c = list(map(int, input().split()))
d = c-(a-b)
if d >= 0:
  print(d)
else if:
  print(0)

Submission status: Runtime Error

Solution code:
a = int(input())
        
result =0
for i in range(1,a+1):
  if len(str(i)) % 2 == 1:
      result = result + 1

print(result)

Submission status: Runtime Error

Solution code:
n = int(input())
lst = [int(i) for i in input().split()]

flag = 0

if len(lst) == 1:
    flag = 1

for i in range(0,len(lst)-1):
    if lst[i]-1 == lst[i+1]:
        lst[i] = lst[i] - 1



if flag == 0:
    for i in range(0,len(lst)-1):
        if (lst[i] <= lst[i+1])&(flag==0):
            #print(str(lst[i])+'<='+str(lst[i+1]))
            flag = 0
        else:
            flag = 1



if flag == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A, B, C = input().split()

if B + C <= A:
  result == 0
else:
  result = B+C-A

print(result)

Submission status: Runtime Error

Solution code:
n=int(input())

if n >= 100000:
    print(90909)
elif n >= 10000:
    print(n-9090)
elif n >= 1000:
    print(909)
elif n >= 100:
    print(n-90)
elif n >= 10:
    print(9)
else:
    print(n)

Submission status: Runtime Error

Solution code:
n = int(input())

if n >= 100000:
    print(90909)
elif n >= 10000:
    print(n-9090)
elif n >= 1000:
    print(909)
elif n >= 100:
    print(n-90)
elif n >= 10:
    print(n)

Submission status: Runtime Error

Solution code:
N = int(input())
H = list(map(int, input().split()))
ans = True
for i in range(1,len(H)):
    if (H[i-1] - H[i]) == 1:
        H[i-1] -= 1
    elif (H[i-1] - H[i]) <= 0:
        continue
    else:
        ans = False
        break
H.reverse()
for i in range(1,len(H)):
    if H[i-1]-H[i] >=  0:
        pass
    else:
        ans = False
        break
if ans:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
if n < 10:
  ans = n
elif n < 10**2:
  ans = 9
elif n < 10**3:
  h = n-99
  ans = h+9
elif n < 10**5:
  t_t = n - 9998
  ans = t_t + 909
  
print(ans)

Submission status: Runtime Error

Solution code:
a,b,c = map(int,input().split())
print(max(0,b+c-a)

Submission status: Runtime Error

Solution code:
N = int(input())

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

flag = "Yes"
cnt = 0
if (N > 1):
  for i in range(len(lst) - 1):
    if (lst[i+1] - lst[i] < 0):
      cnt += 1
    else:
      cnt = 0
      
    if (cnt > 1):
      flag = "No"

print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
H = list(map(int,input().split()))
cnt = 0
for i in range(N-1):
  if H[i]-H[i+1]=1:
    H[i] = H[i]-1
  elif H[i]-H[i+1]>1:
    cnt = 1
    break
if cnt == 0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
H = list(map(int,input().split()))
cnt = 0
for i in range(N-1):
  if H[i]-H[i+1]=1:
    H[i] = H[i]-1
  elif H[i]-H[i+2]>1:
    cnt = 1
    break
if cnt == 0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

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

ans = 'Yes'
diff = 0

for i in range(N - 1):
	diff = H[i + 1] - H[i]

	if diff > 1:
		H[i + 1] -= 1
	elif diff < 0:
		ans = 'No'
print(ans)

Submission status: Runtime Error

Solution code:
import sys

a = int(input())

cnt = 0

for i in range(1,10):
	cnt += 1
	if i == a :
		print (cnt)
		sys.exit()
if a < 100 :
	print (cnt)
	sys.exit()
for j in range(100,1000):
	cnt += 1
	if j == a :
		print (cnt)
		sys.exit()
        
if a < 10000 :
	print (cnt)
	sys.exit()
for k in range(10000,100000):
	cnt += 1
	if k == a :
		print (cnt)
		sys.exit()
if a == 100000 :
	print (cnt)
	sys.exit()

Submission status: Runtime Error

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

def main(N, H):
    ans = 'Yes'

    min_val = H[0] -1
    for i in range(1, N):
        if min_val <= H[i] -1:
            min_val = H[i] -1
        elif min_val <= H[i]:
            min_val = H[i]
        else:
            ans = 'No'
            break
    return ans

if __name__ == '__main__':
    N = int(input())
    H = list(map(int, input().split()))
    print(main(N, H))

Submission status: Runtime Error

Solution code:
n = int(input())
H = list(map(int, input().split()))
for i in reversed(range(n)):
    if i == 0:
        print("Yes")
    elif H[i] - H[i - 1] == -1:
        H[i - 1] -= 1
    elif H[i] - H[i - 1] < -1:
        print("No")
        break
    else:
        continue

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
if N > 1:
    for i in range(N-1):
        if A[i]>A[i+1]:
            A[i] -= 1
    for i in range(N-1):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
elif N == 1:
    print("Yes")

Submission status: Runtime Error

Solution code:
print(max(0,eval('-'+input().replace(' ','+')))

Submission status: Runtime Error

Solution code:
    i = list(map(int, input().split()))
    x = i[2] - (i[0] - i[1])
    if x >= 0:
        print(str(x))
    else:
        print(str(0))

Submission status: Runtime Error

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('- {} -> {}'.format(name, val), file=sys.stderr)
            return None

def main(S):
    """
    RLの組み合わせに着目
    そうすれば、自ずと最後にいる場所が分かる
    """
    ans = [0 for _ in range(len(S))]
    for i in range(len(S)):
        # i番目のマスから動かす
        if S[i] == 'R':
            # Rにいるとき、最初のLまでの距離を見る。最悪で左端
            first_L_idx = S[i+1:].index('L')
            # 例えば0だったら隣にあるので、最終的に自マスに戻る
            if first_L_idx == 0:
                ans[i] += 1
            else:
                # 一旦Lマスまで移動すると考える。距離を2で割った余り。
                if first_L_idx % 2 == 0:
                    ans[i+first_L_idx] += 1
                else:
                    # Lに止まるパターン
                    ans[i+first_L_idx+1] += 1
        else:
            # Lにいるとき
            # 最初に出会うRをみつける
            first_R_idx = list(reversed(S[:i])).index('R')
            if first_R_idx == 0:
                # 左隣がR
                ans[i] += 1
            else:
                # 一旦Rmade移動
                if first_R_idx % 2 == 0:
                    ans[i-first_R_idx] += 1
                else:
                    ans[i-first_R_idx-1] += 1
    return ans


if __name__ == '__main__':
    if 'LOCAL' in os.environ:
        # ローカル実行時のみ通る処理
        # テストしたい入力を入れておく
        input_values = [
                """RRLRL""",
                """RRLLLLRLRRLL""".strip(),
                """RRRLLRLLRRRLLLLL""".strip()
                ]
        outputs = [
               "0 1 2 1 1",
               "0 3 3 0 0 0 1 1 0 2 2 0",
               "0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0"
                ]
        for idx, input_value in enumerate(input_values):
            input_value = input_value
            #  N = int(input_value[0])
            #  A = list(map(int, input_value[1].split()))
            ans = main(input_value)
            expected_value = outputs[idx]
            print(ans,'\nexp ',  expected_value)
            #  assert ans == expected_value, 'failed: ans: {ans}, exp: {exp}'.format(ans=ans, exp=expected_value)
    else:
        S = input()
        for i in main(S):
            print(i, end=' ')
        #  print(main(S))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
if N > 2:
    for i in range(N-2):
        if A[i]>A[i+1]:
            A[i] -= 1
    for i in range(N-2):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
elif N == 2:
    if A[0] <= A[1]:
        print("Yes")
    else:
        print("No")
elif N == 1:
    print("Yes")

Submission status: Runtime Error

Solution code:
a = int(input())

cnt = 0

for i in range(1,10):
	cnt += 1
	if i < a :
		print (cnt)
		exit()

for j in range(100,1000):
	cnt += 1
	if i < a :
		print (cnt)
		exit()

for k in range(10000,100000):
	cnt += 1
	if i < a :
		print (cnt)
		exit()

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
if N > 2:
    for i in range(N-2):
        if A[i]>A[i+1]:
            A[i] -= 1
    for i in range(N-2):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
        print(range(0))
elif N == 2:
    if A[0] <= A[1]:
        print("Yes")
    else:
        print("No")
elif N == 1:
    print("Yes")

Submission status: Runtime Error

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('- {} -> {}'.format(name, val), file=sys.stderr)
            return None

def main(S):
    """
    RLの組み合わせに着目
    そうすれば、自ずと最後にいる場所が分かる
    """
    # Lを探している場合はTrue
    is_L_search = True
    cur = 0
    ans = [0 for _ in range(len(S))]
    while True:
        #  print(cur, ans)
        if is_L_search:
            Lidx = S[cur:].index('L')
            # Lのところまで全部計算
            if Lidx % 2 == 0:
                # 偶数個
                ans[cur+Lidx] += Lidx // 2
                ans[cur+Lidx-1] += Lidx // 2
            else:
                if Lidx >= 3:
                    ans[cur+Lidx] += Lidx//2

                ans[cur+Lidx-1] += Lidx // 2+1
                #  ans[cur+Lidx] += 
            #  #Lのぶんを足す
            #  ans[cur+Lidx] += 1
            if cur + Lidx == len(S)-1:
                ans[-1] += 1
                # 終了
                return ans
            else:
                is_L_search = False
                cur += Lidx
        else:
            # Rを探す
            try:
                Ridx = S[cur:].index('R')
            except:
                Ridx = len(S) - cur
                if Ridx % 2 == 0:
                    ans[cur] += Ridx // 2
                    ans[cur-1] += Ridx // 2
                else:
                    if Ridx >= 3:
                        ans[cur-1] += Ridx // 2
                    ans[cur] += Ridx // 2 + 1
                return ans
                # もう残りLしかないよ。
            # Rのところまで全部計算
            if Ridx % 2 == 0:
                # 偶数個
                ans[cur] += Ridx // 2
                ans[cur-1] += Ridx // 2
            else:
                # 奇数個
                ans[cur] += Ridx // 2 + 1
                if Ridx >= 3:
                    ans[cur-1] += Ridx // 2
            is_L_search = True
            cur += Ridx


    #  # 偶奇で止まった場所の最終地点をメモる？
    #  ans = [0 for _ in range(len(S))]
    #  #  is_done_list = [False for _ in range(len(S))]
    #  next_idx = 0
    #  for i in range(len(S)):
    #      if next_idx > i:
    #          continue
    #      next_idx += 1
    #      #  if is_done_list[i]:
    #      #      continue
    #      # i番目のマスから動かす
    #      if S[i] == 'R':
    #          # Rにいるとき、最初のLまでの距離を見る。最悪で左端
    #          first_L_idx = S[i+1:].index('L')
    #          # 例えば0だったら隣にあるので、最終的に自マスに戻る
    #          if first_L_idx == 0:
    #              ans[i] += 1
    #          else:
    #              # 一旦Lマスまで移動すると考える。距離を2で割った余り。
    #              if first_L_idx % 2 == 0:
    #                  # とんでるやつらの場所はわかる。なぜなら全員Rだから
    #                  #  is_done_list[:i+first_L_idx+1] = [True for _ in range(i+first_L_idx+1)]
    #                  next_idx = i+first_L_idx+1
    #                  ans[i+first_L_idx] += first_L_idx / 2
    #                  ans[i+first_L_idx+1] += first_L_idx / 2
    #              else:
    #                  # Lに止まるパターン
    #                  next_idx = i+first_L_idx+1
    #                  ans[i+first_L_idx] += (first_L_idx + 1) / 2
    #                  ans[i+first_L_idx+1] += (first_L_idx + 1) / 2
    #      else:
    #          # Lにいるとき
    #          # 最初に出会うRをみつける
    #          first_R_idx = list(reversed(S[:i])).index('R')
    #          if first_R_idx == 0:
    #              # 左隣がR
    #              ans[i] += 1
    #          else:
    #              # 一旦Rmade移動
    #              if first_R_idx % 2 == 0:
    #                  # とんでるやつらの場所はわかる。なぜなら全員Lだから
    #                  ans[i-first_R_idx] += 1
    #              else:
    #                  ans[i-first_R_idx-1] += 1
    #      #  is_done_list[i] = True
    #  return ans


if __name__ == '__main__':
    if 'LOCAL' in os.environ:
        # ローカル実行時のみ通る処理
        # テストしたい入力を入れておく
        input_values = [
                """RRLRL""",
                """RRLLLLRLRRLL""".strip(),
                """RRRLLRLLRRRLLLLL""".strip(),
                """RRLLLRL"""
                ]
        outputs = [
               "0 1 2 1 1",
               "0 3 3 0 0 0 1 1 0 2 2 0",
               "0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0",
               ""
                ]
        for idx, input_value in enumerate(input_values):
            input_value = input_value
            #  N = int(input_value[0])
            #  A = list(map(int, input_value[1].split()))
            ans = main(input_value)
            expected_value = outputs[idx]
            print(ans,'\nexp ',  expected_value)
            #  assert ans == expected_value, 'failed: ans: {ans}, exp: {exp}'.format(ans=ans, exp=expected_value)
    else:
        S = input()
        for i in main(S):
            print(int(i), end=' ')
        #  print(main(S))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
if N > 2:
    for i in range(N-1):
        if A[i]>A[i+1]:
            A[i] -= 1
    for i in range(N-1):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
        print(range(0))
elif N == 2:
    if A[0] <= A[1]:
        print("Yes")
    else:
        print("No")
elif N == 1:
    print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())
hlist=input().split()
hlist=list(map(int, hlist))
counter=0
counter2=0
counter3=0
hantei=0
for i in range(n-1): #そもそも単調増加
	if hlist[i]<=hlist[i+1]:
		counter=counter+1
		
for i in range(n): #全部一緒にできる
	if hlist[i]==hlist[0] or hlist[0]+1:
		#counter2=counter2+1

for i in range(n): #全部一緒にできる
	if hlist[i]==hlist[0] or hlist[0]-1:
		counter3=counter3+1


		
if counter==n-1 or counter2==n or counter3==n:
	hantei=1
	
if hantei==1:
	print("Yes")
else:print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
h = list(map(int, input().split()))
h.append(10000000000)
max = 0
flag = 0

for i in range(n):

    if h[i+1]<h[i]:
        h[i]=h[i]-1
    if h[i]>=max and h[i+1]>=h[i]:
        max = h[i]
    else:
        flag = 1
        break
if flag == 1:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

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

for x in range(n-1):
    if h[x] <= h[x+1]:
        pass
    else:
        h[x] = h[x]-1

if n == 1:
    ans ='Yes'
for x in range(n-1):
    if h[x] <= h[x+1]:
        ans = 'Yes'
    else:
        ans = 'No'
        break
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.reverse()
count = 0
for i in range(n-1):
    if a[i+1] > a[i]:
        a[i+1] -= 1
for i in range(n-1):
    if a[i+1]>a[i]:
        count +=1
if count == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
tmp = int(input())
#tmp = 100000

input_num = tmp

lst = []
while tmp > 0:
    lst.append(tmp % 10)  # 余りが入るから右の桁から処理される。　例 345/10 % = 5
    tmp //= 10  # 必須
lst.reverse()

# print(lst)

# print(input_num)

ketasuu = len(lst)
ans = 0
flag = 0
tmp = 0

kazoeru = ketasuu - 1

# 桁数が偶数のとき
if ketasuu % 2 == 0:
    for keta_num in reversed(range(kazoeru)):

        if flag == 0:
            tmp = (10 ** keta_num) * 9
            ans = ans + tmp
            # print("{} {}".format(ans,tmp))
            flag = 1
        else:
            flag = 0

elif ketasuu == 1:
    ans = input_num

# 桁数が奇数のとき
else:
    # print((10**ketasuu) * lst[0])
    ans = input_num - ((10 ** kazoeru) * lst[0])
    ans = ans + 1

    for keta_num in reversed(range(kazoeru - 1)):

        if flag == 0:
            tmp = (10 ** keta_num) * 9
            ans = ans + tmp
            # print("{} {}".format(ans,tmp))
            flag = 1
        else:
            flag = 0

print(ans)

Submission status: Runtime Error

Solution code:
A,B,C=map(int,input().split())
 
if (A > B+C):
    print(0)
if (A < B+C):
    print((A-B)+(C-A))
if (A=B):    
    print(C)

Submission status: Runtime Error

Solution code:
num = input()
list_step = [int(i) for i in input().split()]
 
minus = False
for i in range(int(num)-1):
  diff = list_step[i+1] - list_step[i]
  if diff >= 0:
    minus = False
    continue
  elif diff < -1:
    print("No")
    exit()
  elif i!=0:
    if list_step[i-1]>list_step[i]:
      print("No")
      exit()
    elif list_step[i-1] == list_step[i] and minus:
      print("No")
      exit()
  minus = True
 
print("Yes")

Submission status: Runtime Error

Solution code:
A, B, C = input().split()
temp = C-A-B
if temp < 0:
  temp = 0
print(temp)

Submission status: Runtime Error

Solution code:
import numpy as np

n = int(input())
h = list(map(int, input().split()))

h = np.array(h)

for i in range(len(h)-1):
   if h[i] < h[i+1]:
       h[i+1] -= 1
np.diff(h-1, n=1)

minus = [i for i in np.diff(h-1, n=1) if i < 0]

if len(minus) > 0:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

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

for i in range(N):
    if i != N-1:
        if H[i] > H[i+1]:
            H[i] -= 1
    if i == N:
        if H[i] < H[i-1]:
            H[i-1] -= 1

for i in range(N):
    if i < N-1:
        if H[i] > H[i+1]:
            print("No")
            exit()
    if i == N:
        if H[i-1] > H[i]:
            print("No")
            exit()
print("Yes")

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())

if (A<B+C):
    print(A-B)

if (A >=B+C):
    print(0)
    
elif:
    print(C)

Submission status: Runtime Error

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

keta = len(str(N))

count = 0
  
for i in range(1, keta, 2):
  count += (10 ** i)
  
if (keta  % 2) != 0:
  count += (N - 10 ** (keta - 1) + 1)
  
if N >= 10:
  count -= 1
  
print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
A=list(map(int,input().split()))
i=0
j=0
ask=0
while(j<N):
    while(i<N-1):
        x=A[i+1]-A[i]
        if x<-1:
            ask=1
            break
        elif x==-1:
            A[i]=A[i]-1
            break
        i=i+1
    j=j+1
    i=j
if ask==0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
if N > 1:
    for i in range(N-1):
        if A[i]>A[i+1]:
            A[i] -= 1
            
    for i in range(N-1):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
from math import min
x = input().split()
print(min(x[0], x[1] + x[2])

Submission status: Runtime Error

Solution code:
import copy

S = input()
nN = len(S)
nAns = [ 1 for i in range(nN)]
nAnsC = [ 0 for i in range(nN)]

for j in range(10**3):
  nAnsT = [ 0 for i in range(nN)]
  for i in range(nN):
    sTmp = S[i]
    
    if nAns[i]==0:
      continue
    nNum = nAns[i]
    nAns[i] = 0
    if sTmp =='R':
      nTmp = i + 1
    elif sTmp =='L':
      nTmp = i - 1
    nAnsT[nTmp] += nNum
  
  nAns = copy.deepcopy(nAnsT)
  if i==1:
    nAnsC = copy.deepcopy(nAnsT)
  else:
    nTmp2 = i
    nTmp2 &= 1
    if nTmp2 == 1:
      if nAns == nAnsC:
        break
      else:
        nAnsC = copy.deepcopy(nAns)
      
#    print(*nAns)
#  sTmp = S[nTmp]
#  if sTmp =='R':
#    nTmp += 1
#  elif sTmp =='L':
#    nTmp -= 1
  
#  nAns[nTmp] += 1
  
print(*nAns)

Submission status: Runtime Error

Solution code:
N = int(input())
H = list(map(int,input().split()))
state = 0
L = []
cnt = 0
cnt2 = 0
for i in range(1,len(H)):
    d = H[i]-H[i-1]
    if d<0:
        H[i-1] = H[i-1] - 1
for i in range(1,len(H)):
    d = H[i]-H[i-1]
    if d<0:
        cnt+=1
    elif d == 0:
        cnt2+=1

if cnt>0:
    print("No")
elif cnt2 == len(H)-1 and len(H)>=2:
    print("No")
else:
    print("Yes")