Problem:


Score : 100 points

Problem Statement

We have A balls with the string S written on each of them and B balls with the string T written on each of them.

From these balls, Takahashi chooses one with the string U written on it and throws it away.

Find the number of balls with the string S and balls with the string T that we have now.

Constraints

S, T, and U are strings consisting of lowercase English letters.

The lengths of S and T are each between 1 and 10 (inclusive).

S \not= T

S=U or T=U.

1 \leq A,B \leq 10

A and B are integers.

Input

Input is given from Standard Input in the following format:

S T
A B
U

Output

Print the answer, with space in between.

Sample Input 1

red blue
3 4
red

Sample Output 1

2 4

Takahashi chose a ball with red written on it and threw it away.
Now we have two balls with the string S and four balls with the string T.

Sample Input 2

red blue
5 5
blue

Sample Output 2

5 4

Takahashi chose a ball with blue written on it and threw it away.
Now we have five balls with the string S and four balls with the string T.



Sample input:
red blue
3 4
red


Sample output:
2 4

Submission status: Runtime Error

Solution code:
s1,s2 = input().split()
a,b = int(input().split())
c = input()
if(c==s1):
  print(a-1,b)
else:
  print(a,b-1)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
n_str = input()
k = int(input())

def k1(n_str):
	n_str = str(int(n_str))
	n_len = len(n_str)
	return 9*(n_len-1) + int(n_str[0])

def k2(n_str):
    s = 0
    n_str = str(int(n_str))
    n_len = len(n_str)
    if n_len < 2:
        return 0
    s += k2('9'*(n_len - 1))
    s += k1('9'*(n_len - 1)) * (int(n_str[0]) - 1)
    s += k1(n_str[1:])
    return s
                      
def k3(n_str):
    s = 0
    n_str = str(int(n_str))
    n_len = len(n_str)
    if n_len < 3:
        return 0
    s += k3('9'*(n_len - 1))
    s += k2('9'*(n_len - 1)) * (int(n_str[0]) - 1)
    s += k2(n_str[1:])
    return s

if k == 1:
    print(k1(n_str))
elif k == 2:
    print(k2(n_str))
elif k == 3:
    print(k3(n_str))

Submission status: Runtime Error

Solution code:
n, k = [int(i) for i in input().split(' ')]
input_list = [int(i) for i in input().split(' ')]
 
maximum = sum(input_list[:k])
s = sum(input_list[:k])
for i in range(1, n-k+1):
  s = s - input_list[i-1] + input_list[i+k-1]
  maximum = max(maximum, s)

print( (maximum + k) / 2 )

Submission status: Runtime Error

Solution code:
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()
if U == S:
  print(A-1 B)
else:
  print(A B-1)

Submission status: Runtime Error

Solution code:
S,T = map(str,input().split())
A,B = map(str,input().split())
U = input()
if U == S:
  print(A-1,B)
else:
  print(A,B-1)

Submission status: Runtime Error

Solution code:
S,T = map(str,input().split())
A,B = map(str,input().split())
U = input()
if U == S:
  print(A-1 B)
else:
  print(A B-1)

Submission status: Runtime Error

Solution code:
S, T = input().split(' ')
A, B = list(map(int, input().split(' ')))
U = input()
if U==S: return A-1,B
if U==T: return A,B-1

Submission status: Runtime Error

Solution code:
s, t = map(str, input().split())
a. b = map(int, input().split())
u = input()

if s == u:
  print("{} {}".format(a-1, b))
else:
  print("{} {}".format(a, b-1))

Submission status: Runtime Error

Solution code:
s, t = input().split()
a. b = map(int, input().split())
u = input()

if s == u:
  print("{} {}".format(a-1, b))
else:
  print("{} {}".format(a, b-1))

Submission status: Runtime Error

Solution code:
s, t = input().split()
a. b = map(int, input().split())
u = input()

if s == u:
  print(a-1 b)
else:
  print(a b-1)

Submission status: Runtime Error

Solution code:
s,t=input().split
a,b=map(int,input().split())
u=input()
if s==u:
  print(b)
else:
  print(a)

Submission status: Runtime Error

Solution code:
s,t=input().split()
a,b=map(int,input().split())
u=input()
if u = s:
  a -=1
else:
  b -=1
print(a,b)

Submission status: Runtime Error

Solution code:
def main():
    x,y = map(int,input().split())
    p = list(map(int,input().split()))

    bigNumber = 0

    for i in range(x-y+1):

        number = sum(p[i:i+y])

        if number > bigNumber:
            bigNumber = number

    print((bigNumber + y) / 2)

main()

Submission status: Runtime Error

Solution code:
red,blue=input().split()
a,b=(int(x) for x in input().split())
dic={red:a,blue:b}
u=input()
dic[u]-=1
print(dic[a]+" "+dic[b])

Submission status: Runtime Error

Solution code:
#ABC154A
import sys
from collections import OrderedDict
d = OrderedDict()
s,t = sys.stdin.readline().split()
n1, n2 = map(int, sys.stdin.readline().split())
d[s] = n1
d[t] = n2

d[sys.stdin.readline()] -=1

print(*d.values())

Submission status: Runtime Error

Solution code:
N, K = input().split()
P = input().split()
P.sort(reverse=True)
sum = 0
for k in range(int(K)):
  p = int(P[k])
  sum += (p / 2) + 0.5
print(sum)

Submission status: Runtime Error

Solution code:
s,t = input().split()
a,b = map(int,input().split())
u = input()

if u == s:
    print(a,b-1)
else u == t:
    print(a-1,b)

Submission status: Runtime Error

Solution code:
a, b = input().split().rstrip()
s, t = int(input().split())
z = input()
if z == a:
  s -= 1
  else
  t -= 1
print(s, t)

Submission status: Runtime Error

Solution code:
#入力部分　ここまでは誰でもできる
s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())

if u == s:
  print(a-1,b)
else
  print(a,b-1)

Submission status: Runtime Error

Solution code:
s,t = map(str, input().split())
a,b = map(str, input().split())
u = input()
if s == u:
  print("{} {}".format(a-1, b))
else:
  print("{} {}".format(a, b-1))

Submission status: Runtime Error

Solution code:
num = input()
list = list(map(int,input().split()))
flg  = False
for i in list:
  if list.count(i) >= 2:
  	flg = True
    break
print("NO") if flg else print("YES")

Submission status: Runtime Error

Solution code:
s,t = map(input())
a,b = map(int, input())
u = input()
if s == u:
  a = a-1
else:
  b=b-1
print("{} {}".format(a, b))

Submission status: Runtime Error

Solution code:
s,t = map(input())
a,b = map(int, input())
u = input()
if s == u:
  a -= 1
else:
  b -=1
print("{} {}".format(a, b))

Submission status: Runtime Error

Solution code:
s,b = input().split()
d = {}
d[s],d[b] = [int(x) for x in input().split()]
d[input] -= 1
print(d[s],d[b])

Submission status: Runtime Error

Solution code:
str1, str2 = input().split()
num1, num2 = map(int,input.split())
trim = input()
 
if trim == str1:
	num1 = num1 - 1
else:
  	num2 = num2 - 1
 
print("%d %d",%(num1, num2))

Submission status: Runtime Error

Solution code:
str1, str2 = input().split()
num1, num2 = map(int,input.split())
trim = input()

if trim == str1:
	num1 = num1 - 1
else:
  	num2 = num2 - 1

print("%d %d",%(num1, num2))

Submission status: Runtime Error

Solution code:
c = input().split()
n = input().split()
idx = c.index(input())
n[idx] -= 1
print("".join(n), end="\n")

Submission status: Runtime Error

Solution code:
nk = list(map(int, input().split()))
p = list(map(int, input().split()))
n = nk[0]
k = nk[1]
maxnum = 0
for i in range(n-k):
    if p[i+k] >= p[i]:
        maxnum = i+k

ans = (sum(p[maxnum-k+1:maxnum+1])+k)/2
print(ans)

Submission status: Runtime Error

Solution code:
tmp = input().split(" ")
ball1 = tmp[0]
ball2 = tmp[1]
num = input().split(" ")
num1 = num[0]
num2 = num[1]
u = input()

if ball1 == u:
  num1 -= num1
else:
  num2 -=num2
print(str(num1) + " " + str(num2))

Submission status: Runtime Error

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

max_exp = 0
for i in range(len(num_array) - M + 1):
    tmp = sum(processed[i:i+M])
    if max_exp < tmp:
        max_exp = tmp

print((max_exp+1)*3/2)

Submission status: Runtime Error

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

processed = list(map(lambda x: (1+x)/2, num_array))

expected = []
for i in range(len(num_array) - M + 1):
    expected.append(sum(processed[i:i+M]))

print(max(expected))

Submission status: Runtime Error

Solution code:
red blue
5 5
blue

Submission status: Runtime Error

Solution code:
a = input().split()

b = [int(x) for x in input().split()]

c = input()

if c == a[0] && :
  b[0]-=1
elif c == a[1]:
  b[1]-=1

if b[0] < 0:
  b[0] = 0
if b[1] < 0:
  b[1] = 0
print("{} {}".format(*b))

Submission status: Runtime Error

Solution code:
s, t = input().split()
a, b = int(input().split())
u = input()

if s == u:
  a = a - 1
else:
  b =  b - 1
  
print("{} {}".format(a, b))

Submission status: Runtime Error

Solution code:
    b = input().split()
    a = list(map(int, input().split()))
    c = {b[i]:a[i] for i in range(len(b))}
    print(c[input()] - 1)

Submission status: Runtime Error

Solution code:
b = input().split()
a = map(int, input().split())
c = {b[i]:a[i] for i in range(len(b))}
print(c[input()] - 1)

Submission status: Runtime Error

Solution code:
def main():
    s = input().split()
    n, m = list(map(int, input().split()))
    d = input()
    #print(s)
    if s[0] == d:
        print(n - 1, m)
    else:
        print(n, m - 1)


if __name__

Submission status: Runtime Error

Solution code:
import sys

inp = sys.stdin.readlines()

st = str(inp[0]).split()
ab = str(inp[1]).split()
u = str(inp[2])

ind = st.index(u)

ab[ind] = str(int(ab[ind]) - 1)

print(ab[0], ab[1])

Submission status: Runtime Error

Solution code:
s,t=map(input().split())
a,b=map(int,input().split())
c=input()
d=" "
if s==c:
  print("{}""{}""{}".format(a-1,d,b))
else:
  print("{}""{}""{}".format(a,d,b-1))

Submission status: Runtime Error

Solution code:
s,t=map(input().split())
a,b=map(int,input().split())
c=input()
d=""
if s==c:
  print("{}""{}""{}".format(a-1,d,b))
else:
  print("{}""{}""{}".format(a,d,b-1))

Submission status: Runtime Error

Solution code:
s,t=map(input().split())
a,b=map(int,input().split())
c=input()
 
if s==c:
  print("{}""{}".format(a-1,b))
else:
  print("{}""{}".format(a,b-1))

Submission status: Runtime Error

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

if s==c:
  print("{}""{}".format(a-1,b))
else:
  print("{}""{}".format(a,b-1))

Submission status: Runtime Error

Solution code:
N, K = map(int,input().split())
P = list(map(int,input().split()))
P = [p+1 for p in P]
sm = sum(P[:K])  # 先頭のK個の和を計算
ans = sm  #  最大値（答え）を保存する
for i in range(N-K):
    sm = sm - P[i] + P[K+i]  # 窓をずらす
    ans = max(ans, sm)  # 最大値（答え）を更新
print (ans/2)

Submission status: Runtime Error

Solution code:
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()
if u == s:
  a -= 1
 else:
  b -= 1
 print(a, b)

Submission status: Runtime Error

Solution code:
from collections import deque
import itertools
 
n, k = map(int, input().split())
p = list(map(int, input().split()))
 
kukan = 0
kukan_list = deque()
for i in range(k):
    kukan_list.append(p[i])
 
for i in range(n - k+1):
    if kukan < sum(kukan_list):
        kukan = sum(kukan_list)
    if i+k<n:
        kukan_list.popleft()
        kukan_list.append(p[i+k])
 
 
ans = kukan / 2 + 0.5 * k
print(ans)

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
if len(set(A)) == N:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
S,T=map(str,input.split())
s,t=map(int,input.split())
U=input()

if S==U:
    print(s-1,t)
elif T==U:
    print(s,t-1)

Submission status: Runtime Error

Solution code:
def getList():
    return list(map(int, input().split()))
  
s,t = input().split()
a, b = getList()
u = input.strip()

if s == u:
  print(a-1 ,b)
else:
  print(a, b-1)

Submission status: Runtime Error

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


mind = -1
mmax = -1

sums = []
csum = 0

for i in range(N):
    p = PP[i]
    csum += (p+1)/2
    sums.append(csum)
    if i < K:
        if mmax < csum:
            mind = i
            mmax = csum
    else:
        ksum = csum - sums[(i-K)]
        if mmax < ksum:
            mind = i
            mmax = ksum
            
print(ksum)
time3 = datetime.now()

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
P = list(map(int, input().split()))
 
A = 0
for i in range(N-K+1):
  B = 0
  for j in range(K):
    B += (1 + P[i+j])/2
    if B > A:
      A = B
 
print(A)

Submission status: Runtime Error

Solution code:
s, t = input().split()
a, b = map(int, input().split())
h = input()
if s == h and a >= 1:
  a -= 1
if t == h and b >= 1:
  b -= 1
print a, b

Submission status: Runtime Error

Solution code:
s, t = input.split()
a, b = input.split()
u = input()

if u == s:
    print(a-1, b)
if u == t:
    print(a, b-1)

Submission status: Runtime Error

Solution code:
print(S)

Submission status: Runtime Error

Solution code:
S, T = input.split()
a, b = map(int, input.split())
s = input()
if s == S:
  print(a-1, b)
else:
  print(a, b-1)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
num = list(map(int, input().split()))
 
# 各サイコロの期待値を出す
expect = []
for i in range(N):
  expect.append((1 + num[i]) / 2)
 
# 累積和を作る
cs = [0]
for i in range(N):
    cs.append(cs[i]+expect[i])

max = 0
for i in range(K, N+1): # 配列0番目に初期値0が増えてるので1足す
  if max < cs[i] - cs[i-K]:
    max = cs[i] - cs[i - K]
print(max)

Submission status: Runtime Error

Solution code:
S, T = map(input().split())
A, B = map(int, input().split())
U = input()
if S=U:
  print("{} {}".format(S-1,T))
else:
  print("{} {}".format(S,T-1)

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()

if c == a[0]:
  print(b[0]-1)
if U == S:
    A -= 1
else:
    B -= 1
print(A, B)

Submission status: Runtime Error

Solution code:
aa

Submission status: Runtime Error

Solution code:
s, t = map(str,input.split())
a, b = map(int,input.split())
u = input()
if s == u:
    a -= 1
if t == u:
    b -= 1
print("{0} {1}".format(a,b))

Submission status: Runtime Error

Solution code:
s,t = map(str,input.split())
a,b = map(int,input.split())
u = str(input())
if s == u:
    a -= 1
if s == u :
    b -= 1
print("{0} {1}".format(a,b))

Submission status: Runtime Error

Solution code:
S,T = map(str,input.split())
A,B = map(int,input.split())
u = str(input())
if s == u:
    a -= 1
else :
    b -= 1
print("{0} {1}".format(a,b))

Submission status: Runtime Error

Solution code:
s,t = map(str,input.split())
a,b = map(int,input.split())
u = str(input())
if s == u:
    a -= 1
else :
    b -= 1
print("{0} {1}".format(a,b))

Submission status: Runtime Error

Solution code:
import numpy as np
 
first_int = [int(k) for k in input().split()]
a = first_int[0]
b = first_int[1]
secound_list = [int(k) for k in input().split()]
 
all_sigm = [k for k in secound_list]
max_index = all_sigm.index(max(all_sigm))
print(sum(all_sigm[max_index:max_index+b]))

Submission status: Runtime Error

Solution code:
import numpy as np
 
first_int = [int(k) for k in input().split()]
a = first_int[0]
b = first_int[1]
secound_list = [int(k) for k in input().split()]
 
def sigm(k):
  return k*(k+1)/2
 
all_sigm = [sigm(k) for k in secound_list]
all_sigm_ = [sum(all_sigm[k:k+b]) for k in range(a)]
print(max(all_sigm_))

Submission status: Runtime Error

Solution code:
n = int(input())
nums = tuple(input().split())
judge = 0
for i in range(n):
  for j in range(i+1,n):
    if nums[i] == nums[j]:
      judge = 1
if judge == 0:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
s, t = input().split()
a, b = map(int, input())
u = input()

if s == u:
  print(a-1, b)
else:
  print(a, b-1)

Submission status: Runtime Error

Solution code:
s,t=map(int,input().split())
a,b=map(int,input().split())
if s==input(): a-=1
else: b-=1
print(a,b)

Submission status: Runtime Error

Solution code:
N,K = list(map(int, input().split()))
p = list(map(int, input().split()))
p2 = [p[i]*0.5 + 0.5 for i in range(N)]
size = N + 1
cusum = [0] * size
max = 0

for i in range(N):
    cusum[i+1] = cusum[i] + p2[i]

for i in range(N-K+1):
    tmp = cusum[i+K] - cusum[i]
    if max < tmp:
        max = tmp
print(max)

Submission status: Runtime Error

Solution code:
from heapq import heappush,heappop
import queue
import re
import math
import functools
import numpy

def i_raw():
    return int(input())

def ss_raw():
    return input().split()

def is_raw():
    return list(map(int, ss_raw()))

INF = 1<<29

def make1d_arr(n,val=INF):
    return [val for i in range(n)]

def make2d_arr(h,w,val =INF):
    return [[val for i in range(w)]for i in range(h)]

def gcd (a,b):
    if(b==0):
        return a
    return gcd(b,a%b)


def main():
    S,T = ss_raw()
    A,B = is_raw()
    U = input().strip()
    if U==S:
        return " ".join(map(str,[A-1,B]))
    else:
        return " ".join(map(str,[A,B-1]))  


print(main())

Submission status: Runtime Error

Solution code:
word = str(input())
for i in range(len(word)):
  word[i] = 'x'
print(word)

Submission status: Runtime Error

Solution code:
s, t = input(), input()
a, b = input(), input()
u = input()
if s == t:
  a = a - 1
else:
  b = b - 1
print(a, b)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;
typedef pair<ll  ,ll > pll;

const ll maxn =2e6;
const ll mod = 1e9+7;
const ld PI = 4 * atan((ld) 1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
#define ms(x , y) memset(x , y , sizeof x);
ll pw(ll a, ll b) {
    return (!b ? 1 : (b & 1 ? a * pw(a * a % mod, b / 2) % mod : pw(a * a % mod, b / 2) % mod));
}

string s , t , u;
int a , b;

int main(){
    migmig
    cin >> s >> t >> u;
    cin >> a >> b;
    a-=(s == u);
    b-=(s != u);
    cout << a << ' ' << b;


    return(0);
}


//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.

Submission status: Runtime Error

Solution code:
dic=dict()
s=str(input(""))
t=str(input(""))
dic[s]=int(input(""))
dic[t]=int(input(""))
u=str(input(""))
dic[u]=dic[u]-1
print(dic[s],dic[t])

Submission status: Runtime Error

Solution code:
dic=dict()
s=str(input(""))
t=str(input(""))
dic[s]=int(input(""))
dic[t]=int(input(""))
u=str(input(""))
dic[u]=dic[u]-1

Submission status: Runtime Error

Solution code:
dic=dict()
s=str(input(""))
t=str(input(""))
dic[s]=input(int(""))
dic[t]=input(int(""))
u=str(input(""))
dic[u]=dic[u]-1

Submission status: Runtime Error

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
    print(str(a)-1+" "+str(b))
else:
    print(str(a)+" "+str(b-1))

Submission status: Runtime Error

Solution code:
S,T=map(int,input().split())
A,B=map(int,input().split())
U=input()

if S==U:
    print(A-1,B)
if T==U:
    print(A,B-1)

Submission status: Runtime Error

Solution code:
S,T=map(input().split())
A,B=map(int,input().split())
U=input()

if S==U:
    print(A-1,B)
if T==U:
    print(A,B-1)

Submission status: Runtime Error

Solution code:
S,T=map(input().split())
A,B=map(int,input().split())
U=input()

if S==U:
    print(A-1,B)
if S==T:
    print(A,B-1)

Submission status: Runtime Error

Solution code:
S,T=map(input().split())
A,B=map(int,input().split())
U=input()

if S==U:
    print(A-1,B)
if S==T:
    print(a,B-1)

Submission status: Runtime Error

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

ans = list(set(lis))

if len(lis) == len(ans):
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

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

ans = list(set(lis))

if a == len(ans):
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
'''
red blue
3 4
red
'''
a, b = [x for x in input().split()]
an, bn = [int(x) for x in input().split()]
threw = input()
if threw == a:an -= 1
  else:
    bn -= 1
print(an, bn)

Submission status: Runtime Error

Solution code:
st input().split()
kazu = list(map(int, input().split()))
u = input()
a = {st[0]: kazu[0], st[1]: kazu[1]}
a[u] -= 1
print(a[0], a[1])

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if(u == s)a--;
    else b--;
    cout << a << ' ' << b << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
print("red blue")
red, blue = map(int, input().split())
choice = input('')
if 'red' in choice:
    print(red - 1, blue)
elif 'blue' in choice:
    print(red, blue -1)

Submission status: Runtime Error

Solution code:
a, b = input().split()
a1, b1 = list(map(int, input().split()))

print(str(a1) + " " + str(b1 - 1) if input() == b else str(a1 - 1) + " " + b1)

Submission status: Runtime Error

Solution code:
mod = 10**9+7
rng = 2000100
fctr = [1]+[0]*(rng-1)
finv = [1]+[0]*(rng-1)
for i in range(1,rng):
  fctr[i] = fctr[i-1]*i%mod
for i in range(1,rng):
  finv[i] = pow(fctr[i],mod-2,mod)
def cmb(n,k):
  if n<0 or k<0:
    return 0
  else:
    return fctr[n]*finv[n-k]*finv[k]%mod

x1,y1,x2,y2 = map(int,input().split())
print((cmb(x2+y2+2,x2+1)-cmb(x2+y1+1,y1)-cmb(x1+y2+1,x1)+cmb(x1+y1,x1))%mod)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
 
p = list(map(int, input().split()))
 
p = [(e+1) / 2 for e in p]
 
s = sum(p[0:k])
s_max = s
 
for i in range(n-k):
  s = s - p[i] + p[i+k]
  if s_max < s:
    s_max = s
    
print(s_max)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.sort()
def yabaton(a):
  n = len(a)
  for i in range(n-1):
    if a[i] == a[i+1]:
      return 'NO'
  return 'YES'
print(yabaton(A))

Submission status: Runtime Error

Solution code:
s = list(map(input().split()))
a = list(map(int,input().split()))
u = input()


if s[0] == u:
  a[0] -= 1
else:
  a[1] -= 1

print(str(a[0]) + " " + str(a[1]))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
p = list(int(i) for i in input().split())

kitai = list(map(lambda x: (x+1)/2, p))

gokei = 0

for i in range(n-k+1):
    wa = sum(kitai[i:i+k])
    if gokei < wa:
        gokei = wa

print(gokei)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
a.sort()
for idx, i in enumerate(a[:-1]):
    if i == a[idx+1]:
        print('NO')
        break
if idx == n - 2:
    print('YES')

Submission status: Runtime Error

Solution code:
S,T = map(input().split())
A,B = map(int,input().split())
U = input()

if U==S:
  print (A-1,B);
else:
  print (A,B-1);

Submission status: Runtime Error

Solution code:
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    print(S-1, T)
else:
    print(S, T-1)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
a=int(input())
b=int(input())
u=input()
if(u==s):
    print(a-1,b)
elif(u==t):
    print(a,b-1)

Submission status: Runtime Error

Solution code:
# coding: utf-8

a = input()
N,K = a.split()
b = input()
pl = b.split()

pk = []

if 1 <= int(K) and int(K) <= int(N) and int(N) <= 200000 and len(pl) == int(N):
    for p in pl:
        i = 1
        j = 0
        kitaiti = 0
        kari = 0
        if int(p) > 1000:
            print("1000以下を入れろｋｓ")
            break
        for i in range(1,int(p)+1):
            j += i
        pk.append(j/int(p))
    for z in range(len(pk)+1):
        jougen = len(pk)-z
        if int(K) <= jougen:
            kari = 0
            maxrange = int(z)+int(K)
            for x in range(int(z),maxrange):
                kari += pk[int(x)]
        if kitaiti < kari:
            kitaiti = kari
print("{:.12f}".format(kitaiti))

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
L = len(str(N))

suu = []
for i in range(L):
    suu.append(int(str(N)[i]))

DP_1 =[[0 for k in range(L+1)] for i in range(L+1)]
DP_2 =[[0 for k in range(L+1)] for i in range(L+1)]
DP_2[0][0] = 1
for i in range(L):
    for k in range(L+1):
        DP_1[i+1][k] = DP_1[i][k] + DP_1[i][k-1] * 9 
        if suu[i]:
            DP_1[i+1][k] += DP_2[i][k] + DP_2[i][k-1] * max(suu[i] - 1, 0)
            DP_2[i+1][k] = DP_2[i][k-1]
        else:
            DP_2[i+1][k] = DP_2[i][k]
print(DP_1[L][K]+ DP_2[L][K])

Submission status: Runtime Error

Solution code:
s,t = input().split()
ans = map(int,input().split())
m = input()
if m == s:
  ans[0] -= 1
elif m == t:
  ans[1] -= 1
print(ans[0],ans[1])

Submission status: Runtime Error

Solution code:
S, T = input().split()
a, b = map(int, input().spilt())
U = input()

if S==U: a-=1
else: b-=1

print(a, b)

Submission status: Runtime Error

Solution code:
# coding: utf-8

a = input("整数を入力:")
N,K = a.split()
b = input("ダイスの目:")
pl = b.split()
print(pl)

pk = []

if 1 <= int(K) and int(K) <= int(N) and int(N) <= 200000 and len(pl) == int(N):
    for p in pl:
        i = 1
        j = 0
        kitaiti = 0
        kari = 0
        if int(p) > 1000:
            print("1000以下を入れろｋｓ")
            break
        for i in range(1,int(p)+1):
            j += i
        pk.append(j/int(p))
    print(pk)
    for z in range(len(pk)+1):
        jougen = len(pk)-z
        if int(K) <= jougen:
            kari = 0
            maxrange = int(z)+int(K)
            for x in range(int(z),maxrange):
                kari += pk[int(x)]
        if kitaiti < kari:
            kitaiti = kari
print("期待値"+ str(kitaiti))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
pi = list(map(int, input().split()))
index = []
for i in range(N-K+1):
    x = sum(pi[i:i+K])
    index.append(x)
max_index = index.index(max(index))
EX_max = 0
for i in range(max_index, max_index+K):
  EX_max += 1+(pi[i]-1)*0.5
print(EX_max)

Submission status: Runtime Error

Solution code:
s, t = map(input().split())
a, b = map(int, input().split())
u = input()

if s == u:
    print(a - 1, b)
else:
    print(a, b-1)

Submission status: Runtime Error

Solution code:
def expect(p):
    return (int(p)+1)/2

N, K = map(int ,input().split(' '))
P = list(map(expect ,input().split(' ')))

sum_list = [sum(P[0:K])]
S = [sum(P[0:i]) for i in range(len(P))]
E = []

for i in range(N-K):
    E.append(S[i+K]-S[i])

print('{:.12f}'.format(max(E)))

Submission status: Runtime Error

Solution code:
num=list(map(int,input().split()))
nums=list(map(int, input().split()))
a=[0]*num[1]
max=-1
for i in nums:
    a.append((i+1)/2)
    a.pop(0)
    s=sum(a)
    if(s>max):
        max=s
print(max)

Submission status: Runtime Error

Solution code:
from itertools import accumulate
import sys

def main():
  read = sys.stdin.buffer.read
  N, K, *p = map(int, read().split())
  p = [0] + list(accumulate(p))
  print((max(y - x for x, y in zip(p, p[K:])) + K) / 2)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
r1,c1,r2,c2=map(int,input().split())
mod=10**9+7
f=[1]
for i in range(10**6+7):f+=[f[-1]*(i+1)%mod]
inv=[]
for i in range(len(f)):inv+=[pow(f[i],mod-2,mod)%mod]
def comb(a,b):return f[a]*inv[b]*inv[a-b]%mod
def F(r,c):
  ans=0
  for i in range(r+c+1):
    ans+=2**i
    ans%=mod
  #print(ans)
  d=0
  s=0
  for i in range(r-1,-1,-1):
    s+=comb((r-i-1)+c,c)
    d+=2**i*s
    s%=mod
    d%=mod
  #print(d)
  ans=(ans+(mod-d))%mod
  d=0
  s=0
  for i in range(c-1,-1,-1):
    s+=comb((c-i-1)+r,r)
    d+=2**i*s
    s%=mod
    d%=mod
  #print(d)
  ans=(ans+(mod-d))%mod
  return ans
"""
"""
ans=F(r2,c2)
ans=(ans+(mod-F(r2,c1-1)))%mod
ans=(ans+(mod-F(r1-1,c2)))%mod
ans+=F(r1-1,c1-1)
print(ans%mod)
"""
print(F(4,3))
"""

Submission status: Runtime Error

Solution code:
s,t = map(input().split())
a,b = map(int,input().split())
u = input()

if s == u:
    print(a-1,b)
else:
    print(a,b-1)

Submission status: Runtime Error

Solution code:
s,a,u=open(0);i=s.find(u)<1;print(int(a[0])-i,int(a[2])-1+i)

Submission status: Runtime Error

Solution code:
S, T ＝ map(str, input().split())
A, B ＝ map(int, input().split())
U ＝ input()

if S ＝＝ U:
    A ＝ A － 1
else：
    B ＝ B － 1
  
print(A)
print(B)

Submission status: Runtime Error

Solution code:
a,b=input().split()
a_num,b_num=intinput().split()
c=input()

if c==a:
  a_num=int(a_num)-1
  return a_num,b_num
elif c==b:
  b_num=int(b_num)-1
  return a_num,b_num

Submission status: Runtime Error

Solution code:
S, T ＝ map(str, input().split())
A, B ＝ map(int, input().split())
U ＝ input()

if S ＝＝ U：
    A ＝ A － 1
else：
    B ＝ B － 1
print(str(A)＋str(B))

Submission status: Runtime Error

Solution code:
'''
.append(要素) リストに要素を追加 
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
import itertools
from functools import reduce
from operator import mul

f = [int(s) for s in stdin.readline().rstrip().split()]
N = f[0]
K = f[1]
p = list(map(lambda x: 1/2+x/2, [int(s)
                                 for s in stdin.readline().rstrip().split()]))

E = []
tmp = 0
for el in p:
    tmp += el
    E.append(tmp)

past = -20000
for el in range(len(E)):
    if el - K < 0:
        continue
    e = E[el] - E[el - K]
    if past < e:
        past = e
print(e)

Submission status: Runtime Error

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

value = 0
index = 0

for i in range(0, k):
    value += p[i]

max = value

for i in range(1, n - k + 1):
    value = value - p[i - 1] + p[i + k - 1]
    if value > max:
        max = value
        index = i

total = 0
for i in range(index, index + k):
    total += p[i] / 2 + 0.5

print(total)

Submission status: Runtime Error

Solution code:
keys = input.split()
values = tuple(map(int, input().split()))

ball = dict(zip(keys, values))
u = input()

ball[u] -= 1
print(ball[keys[0]], ball[keys[1]])

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
p = list(map(int,input().split()))
 
e = []
 
for i in range(len(p)):
	e.append((1 + p[i]) / 2)

tmp = 0
l = 0
 
while True:
  res = 0
  j = 0
  for j in range(k):
    res = res + e[l + j]
  if tmp < res:
    tmp = res
  l = l + 1
  if l + k > len(e):
    break

print(tmp)

Submission status: Runtime Error

Solution code:
def ex_value(dice):
  return (1+dice)/2
def main():
  n,k = map(int, input().split())
  list_p = list(map(int, input().split()))
  list_ex_val = list(map(ex_value, list_p))
  print(max([sum(list_ex_val[i:i+k]) for i in range(n-k+1)]))
     
if __name__ == '__main__':
  main()