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:
#include <bits/stdc++.h>
using namespace std;

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

long long fac[MAX_N], finv[MAX_N], inv[MAX_N];
// テーブルを作る前処理 from: https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX_N; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long modpow(long long m, long long p) {
    if (p == 0) return 1;
    if (p % 2)
        return m * modpow(m, p - 1) % MOD;
    else {
        long res = modpow(m, p / 2);
        return res * res % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// factorial
long long fact(int n) {
    if (n == 1) return fac[n] = 1;
    if (fac[n]) return fac[n];
    return fac[n] = (fact(n - 1) * n) % MOD;
}

// https://qiita.com/drken/items/cce6fc5c579051e64fab
// UnionFind<int> uf(n);
template <class Abel>
struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<int> size;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n);
        rank.resize(n);
        size.resize(n);
        diff_weight.resize(n);
        for (int i = 0; i < n; ++i)
            par[i] = i, rank[i] = 0, size[i] = 1, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        } else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]]; // path compression
            return par[x] = r;
        }
    }
    // returns size of connected-tree number
    int get_size(int x) {
        return size[root(x)];
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool is_same(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x);
        w -= weight(y);
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        size[x] = size[y] = size[x] + size[y];
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};
long long gcd(long long a, long long b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b;
}

// factorization O(sqrt(n))
map<long long, long long> prime_factor(long long n) {
    map<long long, long long> res;
    for (long long i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

// 回文判定
bool is_palindrome(string const &s) {
    return s == string(s.rbegin(), s.rend());
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b;
    cin >> a >> b;
    if ((a + b) % 2 == 0)
        out((a + b) / 2);
    else
        out("IMPOSSIBLE");
}

Submission status: Runtime Error

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

ispos_X,ispos_Y=True,True
if X<0:
  X=-X
  ispos_X=False
if Y<0:
  Y=-Y
  ispos_Y=False

if K%2==0 and (X+Y)%2==1:
  print(-1)
else:
  xx,yy=0,0
  vec_list=[]
  if K%2==0:
    while((X-xx)+(Y-yy)>2*K):
      if X-xx>K:
        xx+=K
        vec_list.append((K,0))
      elif Y-yy>K:
        yy+=K
        vec_list.append((0,K))
        
    #print(xx,yy,vec_list)
    diff_x=X-xx
    diff_y=Y-yy
    if diff_x+diff_y==K:
      vec_list.append((diff_x,diff_y))
    else:
      buf=2*K-diff_x-diff_y    
      vec_list.append((diff_x+buf//2,K-diff_x-buf//2))
      vec_list.append((-buf//2,K-buf//2))
      
  else:
    while((X-xx)+(Y-yy)>2*K):
      if X-xx>K:
        xx+=K
        vec_list.append((K,0))
      elif Y-yy>K:
        yy+=K
        vec_list.append((0,K))    
        
    #print(xx,yy,vec_list)
    diff_x=X-xx
    diff_y=Y-yy
    if diff_x+diff_y==K:
      vec_list.append((diff_x,diff_y))
    elif (diff_x+diff_y)%2==0:      
      buf=2*K-diff_x-diff_y
      if diff_x<K:
        vec_list.append((diff_x+buf//2,K-diff_x-buf//2))
        vec_list.append((-buf//2,K-buf//2))
      else:
        vec_list.append((K-diff_y-buf//2,diff_y+buf//2))
        vec_list.append((K-buf//2,-buf//2))
    elif diff_x+diff_y<K:
      xx+=diff_x
      yy+=-K+diff_x
      vec_list.append((diff_x,-K+diff_x))
      
      diff_x=X-xx
      diff_y=Y-yy      
      buf=2*K-diff_x-diff_y
      vec_list.append((diff_x+buf//2,K-diff_x-buf//2))
      vec_list.append((-buf//2,K-buf//2))
    else:
      if diff_x<K:
        xx+=diff_x
        yy+=K-diff_x
        vec_list.append((diff_x,K-diff_x))
      elif diff_y<K:
        xx+=K-diff_y
        yy+=diff_y        
        vec_list.append((K-diff_y,diff_y))

      diff_x=X-xx
      diff_y=Y-yy      
      buf=2*K-diff_x-diff_y
      vec_list.append((diff_x+buf//2,K-diff_x-buf//2))
      vec_list.append((-buf//2,K-buf//2))

  #print(vec_list)
  print(len(vec_list))
  pos_x,pos_y=0,0
  for x,y in vec_list:
    if ispos_X:
      pos_x+=x
    else:
      pos_x-=x
    if ispos_Y:
      pos_y+=y
    else:
      pos_y-=y
      
    print(pos_x,pos_y)

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())
if (a+b)%2=1:
    print("IMPOSSIBLE")
else:
    print((a+b)/2)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if A % 2 != B % 2:
  K = "IMPOSSIBLE"
elif:
  # A - K = - (B - K)
  # 2K = A + B
  K = int((A + B) / 2)
print(K)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=list(ns())
S.reverse()

modmap=[[0]*10 for i in range(10**5)]
for i in range(10):
    modmap[0][i]=i

for i in range(1,10**5):
    for j in range(10):
        modmap[i][j]=(modmap[i-1][j]*10)%13


q_list=[]
moda=0
for i in range(len(S)):
    if(S[i]=='?'):
        q_list.append(i)
    else:
        moda=(moda+modmap[i][int(S[i])])%13


modlist=[[0]*13 for i in range(len(q_list))]
mlist=[i for i in range(13)]

for i in range(10):
    modlist[0][modmap[q_list[0]][i]]=1

for i in range(1,len(q_list)):
    for j in range(10):
        tmpmod=modmap[q_list[i]][j]
        for k in range(13):
            modlist[i][(tmpmod+k)%13]+=(modlist[i-1][k]%(10**9+7))

print(modlist[len(q_list)-1][mlist[5-moda]]%(10**9+7))

Submission status: Runtime Error

Solution code:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=list(ns())
S.reverse()

modmap=[[0]*10 for i in range(10**5)]
for i in range(10):
    modmap[0][i]=i

for i in range(1,10**5):
    for j in range(10):
        modmap[i][j]=(modmap[i-1][j]*10)%13


q_list=[]
moda=0
for i in range(len(S)):
    if(S[i]=='?'):
        q_list.append(i)
    else:
        moda=(moda+modmap[i][int(S[i])])%13


modlist=[[0]*13 for i in range(len(q_list))]
mlist=[i for i in range(13)]

for i in range(10):
    modlist[0][modmap[q_list[0]][i]]=1

for i in range(1,len(q_list)):
    for j in range(10):
        tmpmod=modmap[q_list[i]][j]
        for k in range(13):
            modlist[i][(tmpmod+k)%13]+=modlist[i-1][k]

print(modlist[len(q_list)-1][mlist[5-moda]]%(10**9+7))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A ,B = int(input())
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().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("IMPOSSIBLE")
else:
	print((A+B)2)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
cnt = 0

for i in range(N-1):
    if A[i]+1 != A[i+1]:
        cnt += 1

if cnt <= 2:
    print("YES")
elif cnt > 3:
    print("NO")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

k = (A + B) / 2

answer = 0
if A - k >= 0 and -B + k <=0 :
	answer = 1
    
elif -A + K <=0 and B - k >= 0 :
	answer = 1 
    
if anaswer == 1 and (A + B) % 2 == 0  :
	print(k)
else :
	print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
k=input()
if abs(A-k)==abs(B-k):
  print(k)
else:
  print("IMPOSSBLE")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A, B = [int(x) for x in input().split(" ")]

for k in range(0,10**9):
  if abs(A-k) == abs(B-k):
    print(k)
  else:
    print(IMPOSSIBLE)

Submission status: Runtime Error

Solution code:
N=int(input())
P=list(map(int,input().split()))
count=0
for i in range(N):
    if P[i]!=i+1:
        count=count+1
if count<3:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
n = int(input())
plst = list(map(int,input().split()))
plst_sort = sorted(plst)
cnt = 0
for i in range(len(plst)):
    if plst[i] != plst_sort[i]:
        cnt += 1
if cnt == 2 or cnt == 0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

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

Submission status: Runtime Error

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


# Imperative solution
res = 0
rem = 0

for i in range(N):
    B[i] += rem
    mobs = min(A[i], B[i])
    rem = B[i] - mobs
    res += mobs

res += min(A[N], rem)
print(res)

# Functional
# def rec(idx, res, rem):
#     if idx == N:
#         res += min(A[idx], rem)
#         return res
#     mobs_rem = min(A[idx], rem)
#     mobs = min(A[idx] - mobs_rem, B[idx])
#     rem = B[idx] - mobs
#     res += (mobs + mobs_rem)
#     return rec(idx+1, res, rem)


# print(rec(0, 0, 0))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
x = input().split()
A, B = [int(num) for num in x]
K = (A+B)/2
if int(K) = K:
  print(K)
else:
  print("IMPOSSIBLE")

Submission status: Runtime Error

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

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

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 % 2 == B % 2:
  print((A+B)//2)
else:
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
msg = "IMPOSSIBLE"
A,B = int(input().split())

I,m = divmod((A+B), 2)

if m != 0:
    res = msg
else:
    res = (A+B)/2

print(res)

Submission status: Runtime Error

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

if (a - b) % 2 == 0:
  r = int(abs(a - b)/2 + min(a, b) )
else:
  r = 'IMPOSSIBLE'
print(r)

Submission status: Runtime Error

Solution code:
"""
author : halo2halo
date : 10, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buf"""
author : halo2halo
date : 11, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, M = map(int, read().split())
S = N + M

print(S // 2 if S % 2 == 0 else 'IMPOSSIBLE')
fer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, M = map(int, read().split())
S = N + M

print(S // 2 if S % 2 == 0 else 'IMPOSSIBLE')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
int a=int(input())
int b=int(input())
if abs(a-b)%2==0:
  print(abs(a-b)/2)
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if (a+b)%2==1:
        print('IMPOSSIBLE')
    else:
        print((a+B)//2)
if __name__ == '__main__':
    do()

Submission status: Runtime Error

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if (a+b)%2==!:
        print('IMPOSSIBLE')
    else:
        print((a+B)//2)
if __name__ == '__main__':
    do()

Submission status: Runtime Error

Solution code:
A=input() 
a=int(A)
B=input() 
b=int(B)
K=(b+a)/2
k=int(K)
if((b+a)%2==0):
    print(k)
if((b+a)%2!=0):
    print("IMPOSSIBLE")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b=int(input())
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-K==-(B-K):
  print(K)
else:
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
using System;//外
using System.Linq;//Linq
public class ABC{

    public static void Main(){
        var line = Console.ReadLine();
        var l = line.Split(' ').Select(s => int.Parse(s)).ToArray();//Select,λ型
        int a = l[0];
        int b = l[1];
        if ((a-b)%2==1){
            Console.WriteLine("IMPOSSIBLE");
        }
        else{
            Console.WriteLine((a+b)/2);
        }
    }
}

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if abs(a-c)==abs(b-c):
  print(c)
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
a,b=map(int,input().aplit())
if abs(a-c)==abs(b-c):
  print(c)
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#もし最初に与えられていたリストが昇順(done)

#1番目とn番目の文字列を消去したリストを作成する。そのリストが昇順ならまずは第一段階クリア
#そして最初に与えられた文字のリストで、(<一番最後の文字> - <一番最初の文字>　+1)なら成立する。

#実装すれば、勝ちなはず。

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



#初期リストを昇順に(done)
ascending_order = P.sort()



#1番目と一番最後を削除したリスト
Test_P = P[1:N-1]

#TestPの昇順
ascending_TestP = Test_P.sort()

Check = (abs((P[-1] + P[0]) +1)) 

if P == ascending_order:
    print("YES")
elif Test_P != ascending_TestP:
    print("NO")
else:
    print("YES")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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("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

Submission status: Runtime Error

Solution code:
MOD = 10 ** 9 + 7

S = input()
N = len(S)

dp = [[0] * 13 for _ in range(N + 1)]
dp[0][0] = 1

mul = 1

for i, x in enumerate(S[::-1]):
  if x == "?":
    for k in range(10):
      for j in range(13):
        dp[i + 1][(mul * k + j) % 13] += dp[i][j]
        dp[i + 1][(mul * k + j) % 13] %= MOD
  else:
    k = int(x)
    for j in range(13):
      dp[i + 1][(mul * k + j) % 13] += dp[i][j]
      dp[i + 1][(mul * k + j) % 13] %= MOD

  mul = mul * 10

print(dp[N][5])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
buri

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
buri

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())
for K in range(10 ** 9):
    if abs(A - K) == abc(B - K):
        print(K)
    else:
        print("IMPOSSIBLE")

Submission status: Runtime Error

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

if a*b%2==0:
    printf(a*b/2)
else:
    print("IMPOSSIBLE")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,a,b = map(int,input().split())
if n*a<=b:
  print(n*a)
elif n*a>=b:
  print(b)

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%2 != b%2:
    print("IMPOSSIBLE")
else:
    print((max(a,b)-min(a,b))/2)

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


vector<int>TopologicalSort(int n, vector<int>in, vector<int>e[]) {
	stack<int>st;
	for (int i = 0; i < n; i++)if (!in[i])st.push(i);
	vector<int>ret;
	while (st.size()) {
		int i = st.top();
		st.pop();
		ret.pb(i);
		fore(x, e[i]) {
			in[x]--;
			if (!in[x])st.push(x);
		}
	}
	return ret;
}

struct RollingHash {
	vector<ll>hash;
	vector<ll>base_pow;
	ll base, mod;
	const ll DEFAULT_BASE = 1009, DEFAULT_MOD = 1e9 + 7;
	RollingHash(string S = "", ll base_ = -1, ll mod_ = -1) {
		base = (base_ > 0) ? base_ : DEFAULT_BASE;
		mod = (mod_ > 0) ? mod_ : DEFAULT_MOD;
		if (S.size() > 0)initialize(S);
	}
	void initialize(string& S) {
		int N = S.size();
		vector<int>s(N);
		for (int i = 0; i < N; i++)s[i] = S[i];
		initialize2(s);
	}

	void initialize2(vector<int>& S) {
		hash.resize(S.size() + 1);
		base_pow.resize(S.size() + 1);
		hash[0] = 0;
		base_pow[0] = 1;
		for (int i = 1; i <= S.size(); i++) {
			hash[i] = (hash[i - 1]*base + S[i-1]) % mod;
			base_pow[i] = base_pow[i - 1] * base % mod;
		}
	}

	//[a,b)
	ll between(int a,int b) {
		return (mod + hash[b] - hash[a] * base_pow[b - a] % mod)%mod;
	}
};

int dp[1010101];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

  int a,b
  cin >> a>>b;
  if((a+b)%2)puts("IMPOSSIBLE");
  else puts((a+b)/2)

	return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = list(map(int, input.split()))
A = s[0]
B = s[1]
result = (A + B)
if result % 2 ==0:
    print(result/2)
else:
    print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
s = list(map(int, input.split()))
A = s[0]
B = s[1]
result = (A + B)
if result % 2 ==0:
    print(result)
else:
    print('IMPOSSIBLE')

Submission status: Runtime Error

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

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

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 = [int(k) for k in input().split()]

cnt = 0
for i in range(n):
    if p[i] != i+1:
        cnt += 1
print('Yes' if cnt == 0 and 2 else 'No')
#print('Yes' if cnt <= 2 else 'No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A,B = [int(i) for i in input().split(' ')]

0<=A
B<=10**9

if (A%2==0) AND (B%2==0):
  print((A+B)/2)
elif (A%2 !=0) AND (B%2 !=0):
  print((A+B)/2)
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
A,B = [int(i) for i in input().split(' ')]

0<=A
B<=10**9

if A%2==0 AND B%2==0:
  print((A+B)/2)
elif A%2 !=0 AND B%2 !=0:
  print((A+B)/2)
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
A,B = [int(i) for i in input().split(' ')]

0<=A
B<=10**9

if (A%2==0 AND B%2==0) OR (A%2 !=0 AND A%2 !=0):
  print((A+B)/2)
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
ret = [0] * N
mon = 0
for i in range(0, N):
  if(int(B[i]) - int(A[i]) >= 0 ):
    mon = mon + int(A[i])
    B[i+1] = int(B[i+1]) - ( int(B[i]) - int(A[i]) )
  else:
    mon = mon + int(B[i])

if(int(A[N]) - int(B[N-1]) > 0):
  mon = mon + (int(A[N]) - int(B[N-1]))

else:
  mon = mon + (int(B[N-1]) - int(A[N]))

print(mon)

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
if abs(A-K) == abs(B-K):
  print(K)
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A, B = map(int, input())
K = int((A+B)//2)
if abs(A-K) == abs(B-K):
  print(K)
else:
  print('IMPOSSIBLE')

Submission status: Runtime Error

Solution code:
g=raw_input().split()
a=int(g[0])
b=int(g[1])
if a%2=b%2:
  print((a+b)/2)
else:
  print("IMPOSSIBLE")

Submission status: Runtime Error

Solution code:
S = input()
dp = [[0]*13 for _ in range(len(S))]
if S[0]=="?":
  dp[0] = [1]*10+[0]*3
else:
  dp[0][int(S[0])] = 1
mod = 10**9+7
table = {str(i):[(10*j+i)%13 for j in range(13)] for i in range(10)}
for k in range(1,len(S)):
  tmp = dp[k-1]
  if S[k] != "?":
    for i,t in enumerate(table[S[k]]):
      dp[k][t]= tmp[i]
  else:
    for j in range(10):
      for i,t in enumerate(table[str(j)]):
        dp[k][t] += tmp[i]%mod
    dp[k] = [p%mod for p in dp[k]]
print(dp[-1][5])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A,B = list(map(int,input().strip().split()))
c = (A - B) / 2
d = (B - A) / 2
if c >=0:
    e = A - c
else:
    e = B - d
if e %　1 = 0:
    print(e)
else:
    print("IMPOSSIBLE")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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


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

Submission status: Runtime Error

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


if (B-A)%2=1:
  print("IMPOSSIBLE")
  
else:
  print((B-A)/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)