Problem:


Score: 100 points

Problem Statement

We have two distinct integers A and B.

Print the integer K such that |A - K| = |B - K|.

If such an integer does not exist, print IMPOSSIBLE instead.

Constraints

All values in input are integers.

0 \leq A,\ B \leq 10^9

A and B are distinct.

Input

Input is given from Standard Input in the following format:

A B

Output

Print the integer K satisfying the condition.

If such an integer does not exist, print IMPOSSIBLE instead.

Sample Input 1

2 16

Sample Output 1

9

|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.

Sample Input 2

0 3

Sample Output 2

IMPOSSIBLE

No integer satisfies the condition.

Sample Input 3

998244353 99824435

Sample Output 3

549034394



Sample input:
2 16


Sample output:
9

Submission status: Runtime Error

Solution code:
class KMP():
    def __init__(self, pattern):
        self.pattern = pattern
        self.n = len(pattern)
        self.create_table()

    def create_table(self):
        table = [-1]*(self.n+1)
        j = -1
        for i in range(self.n):
            while j >= 0 and self.pattern[i] != self.pattern[j]:
                j = table[j]
            j += 1
            table[i+1] = j
        self.table = table

    def match(self,s):
        n = len(s)
        j = 0
        ret = [0]*n
        for i in range(n):
            while j >= 0 and (j == self.n or s[i] != self.pattern[j]):
                j = self.table[j]
            j += 1
            if j == self.n:
                ret[(i-self.n+1)%n] = 1 
        return ret

def main():
    s = input()
    t = input()
    n = len(s)
    m = len(t)
    k = 1 - (-(m-1)//n)
    si = s*k
    a = KMP(t)
    b = a.match(si)
    #print a, b
    edges = [[] for i in range(n)]
    for i in range(n):
        if b[i]:
            edges[i].append((i+m)%n)
    #print 'edges', edges
    visited = [0]*n
    
    def dfs(node):
        if visited[node] == 1:
            return False
        if visited[node] == 2:
            return True
            
        visited[node] = 1
        
        for nei in edges[node]:
            if not dfs(nei):
                return False
        visited[node] = 2
        res.append(node)
        return True
    
    res = []
    for i in range(n):
        if not dfs(i):
            print(-1)
            break
    else:
        dp = [0] * n
        ans = 0
        for i in range(n-1, -1, -1):
            t = res[i]
            for c in edges[t]:
                dp[c] = max(dp[c], dp[t] + 1)
                ans = max(ans, dp[c])
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
maxN = 10**6+10
class Solution():
    def stringOfEternity(self, S, T):
        m, n = len(S), len(T)
        def getFail():
            i, j = 0, -1
            f[i] = j
            # prepare roll-back table
            while i < len(T):
                # roll-back
                while j >= 0 and T[i] != T[j]: j = f[j]
                i, j = i + 1, j + 1
                f[i] = j
                
        def KMP():
            j = 0
            for i in range(m):
                while j and S[i] != T[j]:
                    j = f[j]
                if S[i] == T[j]:
                    j = j + 1
                else:
                    j = 0
                if j == n:
                    sign[i-n+1] = 1
                    j = f[j]
#                   
      
        def dfs(node):
            if visited[node] == 1:
                return False
            if visited[node] == 2:
                return True
            
            visited[node] = 1
            
            for nei in graph[node]:
                if not dfs(nei): return False
            visited[node] = 2
            q[self.count] = node
            self.count += 1
            return True
        
        f = [0] * maxN
        getFail()

        sign = [0] * maxN
        KMP()
        
        graph = [[] for _ in range(maxN)]
        for i in range(len(S)):
            j = (i+n) % len(s)
            if sign[i]:
                graph[i].append(j)
                
        visited = [-1] * maxN
        q = [0] * maxN
        
        self.count = 0
        for i in range(m):
            if not dfs(i):
                return -1
         
        assert self.count == m
        dp = [0] * maxN
        ans = 0
        for i in range(m, -1, -1):
            t = q[i]
            for c in graph[t]:
                dp[c] = max(dp[c], dp[t] + 1)
                ans = max(ans, dp[c])
        return ans

s = raw_input()
t = raw_input()

n, m = len(s), len(t)
nn = n
S = s
while n < nn + m:
    for i in range(nn):
        S += s[i]
        n += 1
S +='#'
T = t
print Solution().stringOfEternity(S, T)

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.readline
a,b=int(input())
if (a+b)%2==0:
  print((a+b)/2)
else:
  print('impossible')

Submission status: Runtime Error

Solution code:
import sys
input=sys.stdin.readline
a,b=int(input())
if a+b%2==0:
  print((a+b)/2)
else:
  print('impossible')

Submission status: Runtime Error

Solution code:
#ABC135A - Harmony
A, B = list(map(int,input().split()))
if (max(A,B) - min(A,B)) % 2 == 1:
    print("IMPOSSIBLE")
else:a
    print((A+B)//2)

Submission status: Runtime Error

Solution code:
#ABC135A - Harmony
import math
A, B = list(map(int,input().split()))
if math.abs(A-B) % 2 == 1:
    print("IMPOSSIBLE")
else:
    print((A+B)//2)

Submission status: Runtime Error

Solution code:
A,B = map(int, input().split())
print((A+B)/2 if (A+B)%2 == 0)

Submission status: Runtime Error

Solution code:
 a = list(map(int,input().split()))
if sum(a)%2 == 0:
    print(sum(a)//2)
else:
    print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
n,*p = map(int,open(0).read().split())
ans = 0
for i in range(n):
    if i+1 != p[i]:
        if i+1 == p[p[i]-1]:
            ans += 1

print('YES' if ans == 0 or 2 else 'NO')

Submission status: Runtime Error

Solution code:
import sys
A, B = map(int, input().split())

ans = (A+B)/2
if ans % int(ans) != 0:
    print("IMPOSSIBLE")
    sys.exit()

print(int(ans))

Submission status: Runtime Error

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

ans = (A+B)/2
if ans % int(ans) != 0:
    ans = "IMPOSSIBLE"

print(ans)

Submission status: Runtime Error

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

ans = A+B
if ans % 2 == 1:
    ans = "IMPOSSIBLE"
else:
    ans /= 2

print(int(ans))

Submission status: Runtime Error

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

if ( a % 2 != b % 2):
    print("IMPOSSIBLE")
else:
    print(int((a + b) / 2))

Submission status: Runtime Error

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

int main()
{
    int a, b;
    cin >> a >> b;
    if((a+b)%2==0){
        cout << (a+b)/2 << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
}

Submission status: Runtime Error

Solution code:
A, B = map(int, input())

if A%2 != B%2:
  print("IMPOSSIBLE")
else:
  print((A+B)/2)

Submission status: Runtime Error

Solution code:
A, B = map(int, input())

if A%2 != B%2:
  print("IMPOSSIBLE")
else
  print((A+B)/2)

Submission status: Runtime Error

Solution code:
A, B = map(int, input())

if A%2 != B%2:
  print("IMPOSSIBLE")
else
  print(abs((A+B)/2))

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main()
{
	int a,b;
	cin>>a>>b;
	if(abs(a-b)%2==0){
		cout<<min(a,b)+abs(a-b)/2<<endl;
	}else{
		cout<<"IMPOSSIBLE"<<endl;
	}

	return 0;
}

Submission status: Runtime Error

Solution code:
A=int(input())
B=int(input())
if int((A+B)%2==0):
  print((A+B)//2)
else:
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
A=int(input())
B=int(input())
if int((A+B)%2==0):
  print((A+B)/2)
else:
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
A, B = map(int,input().split)
ans = A + B
if ans % 2 == 0:
  print(ans //2)
else:
  print("IMPOSSIBLE")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=int(input())
b=list(map(int,input().split()))
c=list(range(1,a+1))
count = 0
for i in range(a):
  if s[i]!=b[i]:
     count+=1
if count<=2:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(N-1):
  if  p[i + 1] - p[i] != 1:
    count += 1
if count == 2 or count == 0:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
S=list(input())
mod=10**9+7

dp=[[0]*13 for _ in range(len(S)+1)]
#dp[i][j] :先頭 i 文字として考えられるもののうち、13 で割ったあまりが j であるものの数
dp[0][0]=1

for i in range(1,len(S)+1):
  if S[i-1]=="?":
    for k in range(10):
      for j in range(13):
        dp[i][(10*j+k)%13]+=dp[i-1][j]
    
    
  else:
    for j in range(13):
      dp[i][(10*j+int(S[i-1]))%13]+=dp[i-1][j]
      
print(dp[len(S)][5]%mod)

Submission status: Runtime Error

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

K = (A + B) 

if K % 2 == 0:
	print(int(K / 2))
else:print("IMPOSSIBLE")

Submission status: Runtime Error

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

if (A+B)%2==1:
  print("IMPOSSIBLE")
  
else:
  print((A+B)//2)

Submission status: Runtime Error

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

if (A+B)%2==1:
  print("IMPOSSIBLE")
  
else:
  print((A+B)/2)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
k=(a+b)
if k%2==0:
  print(int(str(k/2)))
else:
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
2k=(a+b)
if 2k%2==0:
  print(2k/2)
else:
  print("impossible")

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
if (a + b)%2 = 0:
    print((a+b)/2)
else:
    print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
if (a + b)%2 = 0:
    print((a+b)/2)
else:
    print("impossible")

Submission status: Runtime Error

Solution code:
n = int(input())
p = list(map(int, input().split()))
cnt = 0
check = 0
tmp = 0
for i in range(n-1):
  if p[i+1] - p[i] == 1:
    cnt += 1
  else:
    if check == 0:
      tmp = i + 2
      check += 1
    else :
      if tmp == p[i+1]:
        check += 1
      else :
        cnt += 1

if cnt == n-1 or check == 2 :
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
a,b=map(int,input(),split())
if a%2!=b%2:
    print("IMPOSSIBLE")
else:
    print(a+b//2)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
def kansu_return_flag(a,b):
    
    flag = 0
    if a>b:
        big = a
        small = b
    else:
        big = b
        small = a
        
    for i in range(small,big):
        a_ans = abs(big-i)
        b_ans = abs(small-i)
        if a_ans == b_ans:
            ans = i
            flag = 1
            break
    return flag,ans

flag,ans = kansu_return_flag(a,b)

if flag == 1:
    print(ans)
else:
    print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
def kansu_return_flag(a,b):
    
    flag = 0
    if a>b:
        big = a
        small = b
    else:
        big = b
        small = a
        
    for i in range(big):
        a_ans = abs(big-i)
        b_ans = abs(small-i)
        if a_ans == b_ans:
            ans = i
            flag = 1
            break
    return flag

flag = kansu_return_flag(a,b)

if flag == 1:
    print(ans)
else:
    print('IMPOSSIBLE')

Submission status: Runtime Error

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

def kansu_return_flag(a,b):
    
    flag = 0

    for i in range(10**9):
        a_ans = abs(a-i)
        b_ans = abs(b-i)
        if a_ans == b_ans:
            ans = i
            flag = 1
            break
    return flag

flag = kansu_return_flag(a,b)

if flag == 1:
    print(ans)
else:
    print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
S = list(input())
dp = [[0 for _ in range(13)] for _ in range(len(S)+1)]
dp[0][0]=1
#print(dp[15][5])
for i in range(len(S)):
  a = 0
  if S[i]=="?":
    for j in range(10):
      for k in range(13):
        dp[i+1][(k*10+j)%13] += dp[i][k]
  else:
    a = int(S[i])
    for k in range(13):
      dp[i+1][(k*10+a)%13] += dp[i][k]
  for k in range(13):
    dp[i + 1][k] %= (10**9+7)
print(dp[len(S)][5])

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int, for i in input().split()]
b = [int, for i in input().split()]
c = 0

for i in range(n):
	if a[i] >= b[i]:
		c += b[i]
	else:
		c += a[i]
		c += min(a[i+1],b[i]-a[i])
		if a[i+1] >= b[i]-a[i]:
			a[i+1] = a[i+1] - (b[i] - a[i])
		else:
			a[i+1] = 0
print(c)

Submission status: Runtime Error

Solution code:

    
import sys

if sys.platform =='ios':
	sys.stdin=open('input_file.txt')
	
a, b=map(int,imput().split()))

if a/b==a//b:
	print(a//b)
	
else:
	print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
a,b = (int(x) for x in input().split(' '))

c = math.fabs(a)
d = math.fabs(b)
f = (c + b) % 2

if f = 0:
  print((c+b)/2)
if f >0:
  print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
if abs(a - b) % 2 = 0:
  print( (a + b) / 2 )
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
if (a - b) % 2 = 0:
  print( (a + b) / 2 )
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# -*- coding:utf8 -*-

a[0],b[1] = sorted(list(map(int,input().split())))
ans = a + ((b - a) / 2) if (b - a) % 2 == 0 else 'IMPOSSIBLE'
print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding:utf8 -*-

a,b = map(int,input().split())
ans = (b - a) / 2 if (b - a) % 2 == 0 else 'IMPOSSIBLE'
if ans < 0:
    ans = ans * -1
print(ans)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
if (A-B)%2 == 1:
    print("IMPOSSIBLE")
else:
    print(int((A-B)/2)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if (a+b)% == 0:
  print((a+b)//2)
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if (a+b)% == 0:
  print((a+b)/2)
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
a,b = map(int, input())
if k = (a+b)/2:
  print(k)
else:
  print('impossible')

Submission status: Runtime Error

Solution code:
a = int(input())
b = input().split()
for i in range(a):
  b[i] = int(b[i])
  
for i in range(a-1):
  if (b[i] > b[i+1]):
    break
if i == a-2:
  print('YES')
else:
  for j in range(a-1,i,-1):
    if (b[j] < b[j-1]):
      break
  temp = b[i]
  b[i] = b[j]
  b[j] = temp
  for k in range(a-1):
    if (b[k] > b[k+1]):
      break
  if k == a-2:
    print('YES')
  else:
    print('NO')

Submission status: Runtime Error

Solution code:
N = int(input())
p_list = list(int(pi) for pi in input().split(' '))

num_opposite = 0
indices = []

for i in range(N-1):
  p_1st = p_list[i]
  p_2nd = p_list[i+1]
  
  if p_1st<=p_2nd:
    pass
  else:
    num_opposite+=1
    if num_opposite==1:
      indices.append(i)
    else:
      indices.append(i+1)
      
  
  if num_opposite >=3:
    break 

if num_opposite == 0:
  print('YES')
elif num_opposite == 1:
  print('YES')
elif num_opposite == 2:
  small_idx = indices[0]
  large_idx = indices[1]
  
  p_small = p_list[small_idx]
  p_large = p_list[large_idx]
  
  if (p_small==p_list[large_idx-1]+1) and (p_large==p_list[small_idx+1]-1):
    print('YES')
  else:
    print('NO')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
K = (a + b) / 2
if (type(K) is int):
  print(K)
else:
  print(IMPOSSIBLE)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if (A+B)%0 :
	print((A+B)/2)
else :
	print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
a,b = map(int, imput().split())
 
if abs(a+b)%2 ==0:
    print(abs(a+b)//2)
else:
    print('IMPOSSIBLE')

Submission status: Runtime Error

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

if (a+b)%2 ==0:
    print(abs((a+b)//2))
else:
    print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
a,s=map(int,input().split())
if a%2==b%2:
  print((a+s)//2)
else:
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
a,s=map(int,input().split())
if a%2==b%2:
  print((a+s)//2)
alse:
  print("IMPOSSIBLE")

Submission status: Runtime Error

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

if a % 2 == 0 and b % 2 != 0:
	print('IMPOSSIBLE')
	exit()
if a % 2 != 0 and b % 2 == 0:
  	print('IMPOSSIBLE')
	exit()
print((a + b) // 2)

Submission status: Runtime Error

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

if a % 2 == 0 and b % 2 != 0:
	print('Impossible')
    exit()
if a % 2 != 0 and b % 2 == 0:
  	print('Impossible')
    exit()
print((a + b) // 2)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
print("IMPOSSIBLE" if (a+b) %= 2 else (a+b) //2)

Submission status: Runtime Error

Solution code:
a,b=map(int.input().split())
if (a+b)%2==1:
    print("IMPOSSIBLE")
else:
    print((a+b)//2)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
if A%2==B%2:
  print(int.(A+B)/2)
else:
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
import numpy as np

def main():
    MOD=10**9+7

    S = input()
    S = S[::-1]
    N = len(S)
    dp=np.zeros((N+1,13),dtype=np.int)
    dp[0,0]=1

    for i in range(N):
        if S[i]=="?":
            for s in range(10):
                for j in range(13):
                    dp[i+1][(s*(10**i)+j) % 13] += dp[i][j]
                    dp[i+1][(s*(10**i)+j) % 13] %= MOD
        else:
            s=int(S[i])
            for j in range(13):
                dp[i+1][(s*(10**i)+j) % 13] += dp[i][j]
                dp[i+1][(s*(10**i)+j) % 13] %= MOD

    res = dp[N,5]
    print(res%MOD)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
a,b=map(input().split())
print((a+b)//2 if (a+b)%2==0 else "IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
N=int(input())
p=list(map(int, input().split()))
s = [x for x in range(1,N+1) if x!=p[x-1]]
if len(s)<3:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=input()[::-1]
p=[1]+[0]*12
q=1
t=[[(i*k)%13 for i in range(10)]for k in range(13)]
for i in s:
    if i!="?":
        i=int(i)
        g=t[q][i]
        p=p[-g:]+p[:-g]
    else:
        d=[0]*13
        for j in t[q]:
            r=p[-j:]+p[:-j]
            d=[(r[i]+d[i])%(10**9+7)for i in range(13)]
        p=d
    q=(q*10)%13
print(p[5]%(10**9+7))

Submission status: Runtime Error

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

if (a+b)%2 ==0:
  print((a+B)/2)
else:
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
N=int(input())
l=list(map(int,input().split()))
l1=sorted(l)
ans=0
for i in range(N):
  if l[i]!=l1[i]:
    ans+=1
if ans==0 or ans==2:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
K = int(input())
X, Y = map(int, input().split())

def move(a, b, _a, _b, _s):
    # x, y > 0 and x < y
    if a < 0: 
        return move(-a, b, -1, _b, _s)
    if b < 0:
        return move(a, -b, _a, -1, _s)
    if a > b:
        return move(b, a, _b, _a, True)
    # ここから移動処理
    if a + b == K:
        return (0, 0)
    
    if a + b >= 2*K:
        ret = (a, b-K)
    else:
        r = K - (a + b)//2
        ret = (-r, b-K+a+r)
    # 後処理
    ret = _a * ret[0], _b * ret[1]
    ret = (ret[1], ret[0]) if _s else ret
    return ret

x, y = X, Y

if K % 2 == 0 and (x+y) % 2:
    print(-1)
else:
    ANS = []
    while x != 0 and y != 0:
        ANS.append((x, y))
        x, y = move(x, y, 1, 1, False)
    print(len(ANS))
    for ans in ANS[::-1]:
        print(ans[0], ans[1])

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
C = max(A,B)
for K in range(C):
  if abs(A-(K+1)) == abs(B-(K+1))
    print(K)
    exit()

print("IMPOSSIBLE")

Submission status: Runtime Error

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

A, B = map(int, input().split())

ans = ((B-A/2)+A)
if isinstance(int, ans):
    print(ans)
else:
    print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().splid())
if (a + b) % 2 == 0 :
  print((a + b) / 2)
else :
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if (a + b) % 2 == 0 :
  print((a + b) / 2)
else
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().splid())
if (a + b) % 2 == 0 :
  print((a + b) / 2)
else
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().solid())
if (a + b) % 2 == 0 :
  print((a + b) % 2)
else
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
N = int(input())
H = list(map(int,input().split()))
ans ="Yes"
highest = H[0]
for i in range(N-1):
    if H[i+1]<highest-1:
        ans ="No"
        break
    highest = max(highest,H[i+1])

print(ans)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
K = 0
if (A+B)%2 == 0:
  K = (A+B) /2
else:
  K = 'IMPOSSIBLE'
  
print(int(K))

Submission status: Runtime Error

Solution code:
n = int(input())
p = list(map(int,input().split()))
N = list(range(1,n+1))
c = []
a = 0
for i in N:
  if N[i-1] != p[i-1]:
    a += 1
if a == 2 or a==0:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
def main():  
    S = list(input())
    S.pop()
    length=len(S)
    dp = [0]*13
    dp[0]=1
    mul=1
    mod=1000000007
    for i in range(1,length+1):
        next_dp = [0]*13
        for j in range(13):
            if S[length-i] == "?":
                for k in range(10):
                    j_sub=(j+k*mul)%13
                    next_dp[j_sub]+=dp[j]
                    next_dp[j_sub]%=mod
            else:
                j_sub=(j+int(S[length-i])*mul)%13
                next_dp[j_sub]+=dp[j]
                next_dp[j_sub]%=mod
        dp=next_dp
        mul=mul*10
    print(dp[5]%1000000007, "d")
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a%2 != b%2:
	print('IMPOSSIBLE')
else:
	int k=(a+b)/2
	print(k)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a%2 != b%2:
  	print('IMPOSSIBLE')
else:
	k=(a+b)/2
  	print(k)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a%2 != b%2 :
  	print('IMPOSSIBLE')
else:
	k=(a+b)/2
  	print(k)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a%2 != b%2 :
  	print('IMPOSSIBLE')
else
	k=(a+b)/2
  	print(k)

Submission status: Runtime Error

Solution code:
#include <iostream>
using namespace std;
int main() {
    //cin.tie(0);
    //ios::sync_with_stdio(false);

    int a,b;
    cin >> a >> b;
    if (b-a % 2 == 0) {
        cout << (a + b) / 2 << "\n";
    } else {
        cout << "IMPOSSIBLE" << "\n";
    }
}

Submission status: Runtime Error

Solution code:
import sympy as sp

A, B = map(int, input().split())
K = sp.Symbol('K')

ans = sp.solve((A - K) **2 - (B - K) ** 2, K)

if isinstance(ans[0], int) == True:
    print(ans[0])
else:
    print('IMPOSSIBLE')

Submission status: Runtime Error

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

# 演算子%は余りを出す　//は小数切り捨てて整数値を出す
if (a + b) % 2 == 0:
    print((a+b)//2)
else:
    print('IMPOSSIBLE')

Submission status: Runtime Error

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

if (c+d)%2 == 0:
    print(c+d)//2
else:
    print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
import numpy as np

temp=list(map(int, input().split()))
temp=np.mean(temp)
if temp-int(temp)>0:
  output='IMPOSSIBLE'
else:
  output=temp
  
print(int(output))

Submission status: Runtime Error

Solution code:
a, b = map(int, input())
print((a+b)//2 if not (a+b)%2 else "IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
s = input()
s = s[::-1]
mod = 10 ** 9 + 7
table = [[0] * 13 for _ in range(len(s) + 2)]
table[0][0] = 1
dd = 1
for c in range(len(s)):
    if s[c] == "?":
        for n in range(10):
            for i in range(13):
                table[c + 1][(i + n * dd) % 13] += table[c][i]
                table[c + 1][(i + n * dd) % 13] %= mod
    else:
        num = int(s[c])
        for i in range(13):
            table[c + 1][(i + num * dd) % 13] += table[c][i]
            table[c + 1][(i + num * dd) % 13] %= mod
    dd = (dd * 10) % 13
print(table[c + 1][5])

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
if (A+B) % 2 = 0:
  K = (A+B)/2
else:
  K ="IMPOSSIBLE"
print(K)

Submission status: Runtime Error

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

if (a-b)%2 == 1:
  print("IMPOSSIBLE")
  
else:
  print((a+b)/2)

Submission status: Runtime Error

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

print((a+b)//2 if (a+b)% == 0 else 'IMPOSSIBLE')

Submission status: Runtime Error

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

buf = a - b

if buf % 2 = 0:
	print(buf // 2)
else:
	print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
a=int(input())
b=input().split(" ")
sequence=[]
for i in range(0,a):
    sequence.append(int(b[i]))
error=[]
for q in range(0,a-1):
    if sequence[q]-sequence[q+1]>0:
        error.append(q)
        error.append(q+1)

if len(error)==0:
    print("YES")

elif len(error)==2:
    if a==2:
        print("YES")
    elif error[0]==0:
        if sequence[error[0]+2]-sequence[error[0]]>0:
            print("YES")
        else:
            print("NO")
    elif error[1]==a:
        if sequence[error[1]]-sequence[error[1]-2]>0:
            print("YES")
        else:
            print("NO")
    else:
        if  sequence[error[1]]-sequence[error[1]-2]>0 and sequence[error[0]+2]-sequence[error[0]]>0:
            print("YES")
        else:
            print("NO")

elif len(error)==4:
    if error[1]==error[2]:
        if sequence[error[0]]>sequence[error[3]]:
            if error[0]==0 and error[3]==a-1:
                if sequence[error[0]]-sequence[error[3]-1]>0 and sequence[error[0]+1]-sequence[error[3]]>0:
                    print("YES")
                else:
                    print("NO")
            elif error[0]==0:
                if sequence[error[0]+3]-sequence[error[0]]>0:
                    print("YES")
                else:
                    print("NO")
            elif error[1]==a:
                if sequence[error[3]]-sequence[error[3]-3]>0:
                    print("YES")
                else:
                    print("NO")
            else:
                if  sequence[error[3]]-sequence[error[3]-3]>0 and sequence[error[0]+3]-sequence[error[0]]>0:
                    print("YES")
                else:
                    print("NO")
    elif sequence[error[0]]-sequence[error[2]]>0 and sequence[error[1]]-sequence[error[3]]>0:
        if error[0]==0 and error[3]==a-1:
            if sequence[error[0]]-sequence[error[3]-1]>0 and sequence[error[0]+1]-sequence[error[3]]>0:
                print("YES")
            else:
                print("NO")
        elif error[0]==0:
            if sequence[error[3]+1]-sequence[error[0]]>0:
                print("YES")
            else:
                print("NO")
        elif error[3]==a:
            if sequence[error[3]]-sequence[error[0]-1]>0:
                print("YES")
            else:
                print("NO")
        elif sequence[error[3]]-sequence[error[0]-1]>0 and sequence[error[3]+1]-sequence[error[0]]>0:
            print("YES")
        else:
            print("NO")
    else:
        print("NO")

else:
    print("NO")

Submission status: Runtime Error

Solution code:
n = int(input())
xn = [int(x) for x in input().split()]
k = 0
for i in range(1,n+1):
	if xn[i-1] != i:k += 1
        
print("NO" if k > 2 else "YES")

Submission status: Runtime Error

Solution code:
#A-Harmony
X=map(int, input().split())
K=(X[0]+X[1])/2
if (X[0]+X[1])%2==0:
    print(K)
else:
    print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
A,B= map(int, input().split())
print("IMPOSSIBLE" if (a + b) % 2 != 0 else (a + b) // 2)

#(a + b) % 2 →(a+b)を2で割った余り

#//→切り捨て徐算

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if (a+b) % 4 ==0:
  print(int((a+b)/4))
  else:
    print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split()) 
if (A % 2) == (B % 2):
  print(abs((A+B)/2))
else:
  print(IMPOSSIBLE)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
if (a + b) % 2 == 0:
  print((a + b) / 2)
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
k = (a + b) / 2
l = (a + b) % 2
if l == 0:
    print(k)
else:
    print(“IMPOSSIBLE”)

Submission status: Runtime Error

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

re = abs(a[0] - a[1])

for i in range(a[0] - a[1]):
  if abs(a[0] - i) == abs(a[1] - i):
    print(i)
    yes = 1
    break

if yes != 1:
  print('IMPOSSIBLE')

Submission status: Runtime Error

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

re = abs(a[0] - a[1])

for i in range(a[0] - a[1]):
  if abs(a[0] - i) == abs(a[1] - i):
    print(i)
    yes = 1
    break

if yes != 1:
  print('IMPOSSIBLE)

Submission status: Runtime Error

Solution code:
N = input()
lst1 = list(map(int, input().split()))
lst2 = sorted(lst1)

n = 0
for x, y in zip(lst1, lst2):
    if x != y:
        n += 1
        if n > 2:
            break

if n > 2:
    print('NO')
else:
    print('YES')

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
if x%2!==y%2:
  print('IMPOSSIbLE')
else: print((x+y)/2)

Submission status: Runtime Error

Solution code:
n = int(input())
s = input().split()

b =[str(i+1) for i in range(len(s))]

count=0
for i in range(len(s)):
  if s[i]!=b[i]:
    count+=1
if count==0: print("YES")
elif count==2: print("YES")
else: print("NO")

Submission status: Runtime Error

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

b_rest = [max(b[0]-a[0],0)]
a_rest = [max(a[0]-b[0],0)]

for i in range(1, n-1):
  b_rest.append( min(b[i], max( ((b[i]+b_rest[i-1])-a[i]), 0 ) ) )
  a_rest.append( max( a[i]-(b[i]+b_rest[i-1]), 0 ) ) 

a_rest.append(max(0, (a[n-1]-b_rest[-1]) ) )
ans = sum(a) - sum(a_rest)
                                
print(ans)