Problem:


Score : 100 points

Problem Statement

Decades have passed since the beginning of AtCoder Beginner Contest.

The contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?

In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001, ABD002, ..., ABD999.

You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.

Constraints

1 \leq N \leq 1998

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.

Sample Input 1

999

Sample Output 1

ABC

The 999-th round of AtCoder Beginner Contest is labeled as ABC999.

Sample Input 2

1000

Sample Output 2

ABD

The 1000-th round of AtCoder Beginner Contest is labeled as ABD001.

Sample Input 3

1481

Sample Output 3

ABD

The 1481-th round of AtCoder Beginner Contest is labeled as ABD482.



Sample input:
999


Sample output:
ABC

Submission status: Runtime Error

Solution code:
n = int(input().split())
if n < 1000:
  print('ABC')
else:
  print('ABD')

Submission status: Runtime Error

Solution code:
import sys
from itertools import permutations

N,C = map(int,input().split())
D = [list(map(int,sys.stdin.readline().split())) for _ in range(C)]
grids = [list(map(int,sys.stdin.readline().split())) for _ in range(N)]

ans = float('inf')
for cmb in permutations([i for i in range(1,C+1)],3):
  tmp_ans = 0
  for j, row in enumerate(grids):
    for i, val in enumerate(row):
      if val != cmb[(i+j+2)%3]: tmp_ans += D[val-1][cmb[(i+j+2)%3]-1]
      #print(i, j, val, cmb, tmp_ans)
  ans = min(tmp_ans, ans)
  #print(ans, tmp_ans, cmb)
print(ans)

Submission status: Runtime Error

Solution code:
N = input()
if N >= 999:
    print("ABC")
else:
    print("ABD")

Submission status: Runtime Error

Solution code:
N=int(input())
print(f"ABC{N:03}" if N<=999 else f"ABD{N-999:03}")

Submission status: Runtime Error

Solution code:
N = int(input())
if N >= 1000:
  print("ABD")
else:
  print("ABC)

Submission status: Runtime Error

Solution code:
N = int(input())
INF = 10**6
dp = [INF] * (max(9, N))
for i in range(10):
  if  0 < i < 6:
    dp[i] = i
  elif i < 9:
    dp[i] = i%6+1
for i in range(N):
  n = m = 1
  while i+9**n <= N:
    dp[i+9**n] = min(dp[i+9**n], dp[i] + 1)
    n += 1
  while i+6**m <= N:
    dp[i+6**m] = min(dp[i+6**m], dp[i] + 1)
    m += 1
print(dp[N])

Submission status: Runtime Error

Solution code:
x=int(input())
a=x//999
b=x%999+1000
B=text(b)
C=B[1:]
if a==0:
  print("ABC"+C)
else:
  print("ABD"+C)

Submission status: Runtime Error

Solution code:
a=input()
print("ABC" if a<1000 else "ABD")

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
t = b - a
n = [1]
x = 1

for i in range(2,999):
  x = i + x
  n.append(x)

else:
  for j in range(0,len(n)):
    if n[j+1] - n[j] == t:
      break
print(n[j] - a)

Submission status: Runtime Error

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

int main(){
    int N;
    cin >> N;

    if (N < 1000){
        cout << "ABC" << endl;
    }

    else{
        cout << "ABD" << endl;
    }

    return 0;
}

Submission status: Runtime Error

Solution code:
N = int(input())
if N<1000:
  print('ABC' + N.zfill(3))
  exit()
print('ABD' + (N-999).zfill(3))

Submission status: Runtime Error

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

if N >=1000:
  print("ABD")

else:
  print("ABC")

Submission status: Runtime Error

Solution code:
n = int(input())
print('ABC' + n if n < 1000 else 'ABD' + n)

Submission status: Runtime Error

Solution code:
print("ABD" int(input())>999 else "ABC")

Submission status: Runtime Error

Solution code:
N = int(input())

if N >= 1000:
  print("ABD"+str((N-1000).zfill(3)))
else:
  print("ABC"+str((N).zfill(3)))

Submission status: Runtime Error

Solution code:
rint('ABC' if int(input())<1000 else 'ABD')

Submission status: Runtime Error

Solution code:
n = int(input())
if 1 <= n <= 999:
  print(ABC)
else:
  print(ABD)

Submission status: Runtime Error

Solution code:
n = input()
if 1 <= n <= 999:
  print(ABC)
else:
  print(ABD)

Submission status: Runtime Error

Solution code:
n = input()
if 1 <= n <= 999:
  print(n)
else:
  print(n-999)

Submission status: Runtime Error

Solution code:
N=int(input())
a='ABD'
b='ABC'
if a<=999:
  print(b)
else:
  print(a)

Submission status: Runtime Error

Solution code:
N=int(input())
a='ABD'
b=N+1
print(a+b)

Submission status: Runtime Error

Solution code:
N = int(input())
if N <= 999:
  print(ABC)
else:
  print(ABD)

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())
D = [list(map(int, input().split())) for _ in range(C)]
grid = [list(map(int, input().split())) for _ in range(N)]

def main():
    state = [[0 for _ in range(C)] for _ in range(3)]
    for c in range(C):
        for w in range(N):
            for h in range(N):
                cost = D[grid[h][w]-1][c]
                state[(h+w)%3][c] += cost

    for c1 in range(C):
        for c2 in range(C):
            if c1 == c2:
                continue
            for c3 in range(C):
                if c3 == c1 or c3 == c2:
                    continue
                cost = state[0][c1] + state[1][c2] + state[2][c3]
                if c1 == 0 and c2 == 1 and c3 == 2:
                    ans = cost
                    continue
                ans = min(cost, ans)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
cnt = 0
for i in range(b-a):
  cnt += i
print(cnt-a)

Submission status: Runtime Error

Solution code:
a=int(input())
if a<=1000:
    print("ABD"+(a-999))
else:
    print("ABC"+a)

Submission status: Runtime Error

Solution code:
if 1<= int(input()) <= 999:
    print("ABC")
if 1000 <= int(input()) <= 1998:
    print("ABD")

Submission status: Runtime Error

Solution code:
a=map(int,input().split())
print("ABD" if a<1000 else "ABC")

Submission status: Runtime Error

Solution code:
a=map(int,input().split())
print("ABC" if a<1000 else "ABD")

Submission status: Runtime Error

Solution code:
n = int(input())

if n > 999:
    print('ABD)
else:
    print('ABC')

Submission status: Runtime Error

Solution code:
if int(input()) < = 999:
  print("ABC")
else:
  print("ABD")

Submission status: Runtime Error

Solution code:
a = int(input())
if a < = 999:
  print("ABC")
else:
  print("ABD")

Submission status: Runtime Error

Solution code:
N = input()
if N <= 999:
  pirnt("ABC")
else:
  print("ABD")

Submission status: Runtime Error

Solution code:
N=int(input())

if N < 1000:
  print("ABC"+N)
else:
  print("ABD"+N)

Submission status: Runtime Error

Solution code:
N = int(input())
if N>=1 and N<1000:
    print(ABC)
else:
    print(ABD)

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())
D = [list(map(int, input().split())) for _ in range(C)]
c_map = [list(map(int, input().split())) for _ in range(N)]
count = [[0]*C for _ in range(3)]
for i in range(N):
    for j in range(N):
        c = c_map[i][j]
        amari = (i+j)%3
        count[amari][c-1]+=1
ans = float('inf')
for i in range(C):
    for j in range(C):
        for k in range(C):
            tmp = 0
            if i == k or j == k or i==j:
                continue
            else:
                for l in range(C):
                    tmp+=count[0][l]*D[l][i]
                    tmp+=count[1][l]*D[l][j]
                    tmp+=count[2][l]*D[l][k]
            ans = min(ans, tmp)
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())

if N <=999:
    print("ABC")
else:
    print("ABD")

Submission status: Runtime Error

Solution code:
N = map(int(input().split()))
if N < 1000:
    print("ABC")
else:
    print("ABD")

Submission status: Runtime Error

Solution code:
input_data = input()
if input_data <= 999:
    print(str(ABC))
else:
    print(str(ABD))

Submission status: Runtime Error

Solution code:
input_data = input()
if input_data <= 999:
    print(ABC)
else:
    print(ABD)

Submission status: Runtime Error

Solution code:
input_data = input()
if input_data <= 999:
    print('ABC')
else:
    print('ABD')

Submission status: Runtime Error

Solution code:
input_data = input()
if input_data <= 999:
    print('ABC')
print('ABD')

Submission status: Runtime Error

Solution code:
a=int(input())

if a>= 1000:
 print("ABD"):
else:
 print("ABC")

Submission status: Runtime Error

Solution code:
print("AB"+["D","C"][n<1000])

Submission status: Runtime Error

Solution code:
N = int(input())
if N<=999:
	print('ABC'
else:
	print('ABD')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

D=[list(map(int,input().split())) for i in range(C)]
grid=[list(map(int,input().split())) for i in range(N)]

a=[[0]*C for i in range(3)]


for i in range(N):
    tmp=i%3
    for j in range(N):
        a[tmp][grid[i][j]-1]+=1
        tmp=(tmp+1)%3

b=[[0]*C for i in range(3)]
for i in range(3):
    for j in range(C):
        b[i][j]=sum([ D[k][j] * a[i][k] for k in range(C)])

b=[ sorted([ [b[i][j],j] for j in range(C)]) for i in range(3)]

ans=1000000000
for i in range(3):
    for j in range(3):
        for k in range(3):
            if b[0][i][1]!=b[1][j][1] and b[1][j][1]!=b[2][k][1] and b[2][k][1]!=b[0][i][1]:
                ans=min(ans,b[0][i][0]+b[1][j][0]+b[2][k][0])

print(ans)

Submission status: Runtime Error

Solution code:
a=int(input())
if a<=999:
  print("ABC")
else:
  print("ABD)

Submission status: Runtime Error

Solution code:
N=int(intput())
if N<1000:
    print("ABC")
else :
    print("ABD")

Submission status: Runtime Error

Solution code:
print('ABD'if input()>999 else'ABC')

Submission status: Runtime Error

Solution code:
N=int(input())
if N < 1000 :
  print(f"ABC{N}")
else :
  n = N - 999
  print(f"ABD{n})

Submission status: Runtime Error

Solution code:
N = int(input())
print('ABD{%03d}'.format(N-1000)) if N>=1000 else print('ABC{%03d}',format(N))

Submission status: Runtime Error

Solution code:
def read():
    return raw_input()


def write(message):
    import sys
    print(message)
    sys.stdout.flush()


if __name__ == '__main__':
    N = int(read())
    write("ABD" if N > 999 else "ABC")

Submission status: Runtime Error

Solution code:
def dfs(cost, N):
    if N<6 :
        return cost+N
    else:
        ret0 = 6 ** math.floor(math.log(N, 6))
        ret1 = 9 ** math.floor(math.log(N, 9))
        if (ret0>1) and (ret1>1):
            return min(dfs(cost+1, N-ret0), dfs(cost+1, N-ret1))
        else:
            ret = max(ret0, ret1)
            return dfs(cost+1, N-ret)

N = int(input())
print(dfs(0, N))

Submission status: Runtime Error

Solution code:
if(int(input()) 1000):
  print("ABC")
else:
  print("ABD")

Submission status: Runtime Error

Solution code:
N=int(input())
print('ABC' if N<1000 else 'A

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
if N >=1000:
  print('ABD'
else:
  print('ABC')

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
a=y-x
b=a*(a-1)/2
print(round(b-x))

Submission status: Runtime Error

Solution code:
n = int(input())
if n <= 999:
    print(ABC)
else:
    print(ABD)

Submission status: Runtime Error

Solution code:
n = map(int, input())

if n >= 1000:
    print('ABD')
else:
    print('ABC')

Submission status: Runtime Error

Solution code:
a=input()
if a<1000:
	print('ABC')
else:
	print('ABD')

Submission status: Runtime Error

Solution code:
print("AB"+["C","D"][len(input()<4)])

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
n=0
for i in range(1,a-b+1):
  n+=i
print(n-b)

Submission status: Runtime Error

Solution code:
a=int(input())
if a>999:
  print("ABC"+a)
else:
  print("ABD"+a%999)

Submission status: Runtime Error

Solution code:
a = int(input())
if a-1000 >= 0:
  print "ABD"
else:
  print "ABC"

Submission status: Runtime Error

Solution code:
def sig(x):
    return 1 if x==1 else sig(x-1)+x


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

upper=int(sig(b-a))
print(upper-b)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
if N > 1000:
  print(ABD)
else:
  print(ABC)

Submission status: Runtime Error

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

def main(argv):
  i = int(argv[0])
  if i >= 0 and 999 >= i:
    print('ABC')
  elif i > 999:
    print('ABD')
    
if __name__ == '__main__':
  main(sys.argv[1:])

Submission status: Runtime Error

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

def main(argv):
  i = int(argv[0])
  if i => 0 and 999 <= i:
    print('ABC')
  elif i > 999:
    print('ABD')
if __name__ == '__main__':
  main(sys.argv[1:])

Submission status: Runtime Error

Solution code:
n = input()
if n < 1000:
  print("ABC")
else:
  print("ABD")

Submission status: Runtime Error

Solution code:
N = int(input())

if (N >= 1) & (N <= 999)
    print('ABC')
else:
    print('ABD')

Submission status: Runtime Error

Solution code:
n,c = [int(i) for i in input().split()]
d = [] 
for i in range(c):
    d.append(list(map(int, input().split())))
color = []
for i in range(n):
    color.append(list(map(int, input().split())))
for i in range(n):
    for j in range(n):
        color[i][j] -= 1
dofc = [[0 for i in range(3)] for j in range(c)]
for t in range(3):
    for a in range(c):
        for l in range(n):
            for row in range(n):
                dofc[a][(l+row)%3] += d[a][color[row][l]]
D = dofc[0][0]+dofc[1][1]+dofc[2][2]
for c0 in range (c):
    for c1 in range (c):
        if c1 == c0:
            continue
        for c2 in range (c):
            if c2 == c1 or c2 == c0:
                continue
            D = min(D,dofc[c0][0]+dofc[c1][1]+dofc[c2][2])
print(D)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A=int(input())
if A > 999:
  print("ABC" + A)
else :
  print("ABD" + A)

Submission status: Runtime Error

Solution code:
a=input()
if a < 1000:
  print("ABC")
else:
  print("ABD")

Submission status: Runtime Error

Solution code:
N = input()

if N >= 1000:
 print("ABD")

else N <999:
 print("ABC")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()

if N > 1000 :
    Npadded = '%03d' % N
    print("ABC",Npadded)
else :
    Npadded = '%03d' % (N - 999)
    print("ABD",Npadded)

Submission status: Runtime Error

Solution code:
N = int(inut())
if N <= 999:
  print('ABC')
else:
  print('ABD')

Submission status: Runtime Error

Solution code:
N = int(input())
if N < 1000:
  print(ABC)
else:
  print(ABD)

Submission status: Runtime Error

Solution code:

aa

Submission status: Runtime Error

Solution code:
N = input()
N=int(N)
if N>=1,N<=999:
    print('ABC')
if N>=1000,N<=1998:
    print('ABD')

Submission status: Runtime Error

Solution code:
N = int(input())
if N>=1,N<=999:
    print('ABC')
if N>=1000,N<=1998:
    print('ABD')

Submission status: Runtime Error

Solution code:
N = int(input())
if N>=1,N<=999:
    print('ABC')
if N>=1000,N<=1998
    print('ABD')

Submission status: Runtime Error

Solution code:
N=int(input())
if N =<999:
    print("ABC")
else:
    print("ABD")

Submission status: Runtime Error

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

print("ABC") if N < 1000 else print("ABD")

Submission status: Runtime Error

Solution code:
#encoding utf-8


n = input()

if n > 999:
    print("ABD")

else:
    print("ABC")

Submission status: Runtime Error

Solution code:
N = int(input())

def sum_digits(n, m):
    r = 0
    while n:
        r = r + n % m
        m = n // m
    return r

ans = float("inf")
for i in range(N+1):
    ans = min(ans, sum_digits(i, 6) + sum_digits(N-i, 9))

Submission status: Runtime Error

Solution code:
number = input()

if number > 0 and number < 1000:
    print("ABC")

if number >= 1000 and number <= 1998:
    print("ABD")

Submission status: Runtime Error

Solution code:
A = input()

if A >= 1000:
  print("ABD")
else:
  print("ABC")

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
i = b-a-1
print(sum(range(1, i+1)) - a)

Submission status: Runtime Error

Solution code:
c = 0
A = input()
B = A.split(" ")
a,b = int(B[0]),int(B[1])
for i in range(1,a-b):
    c = c + i
print(c - a)

Submission status: Runtime Error

Solution code:
c = 0
a,b = map(int,input())
for i in range(1,a-b):
    c = c + i
print(a-c)

Submission status: Runtime Error

Solution code:
a= input()

if (a >= 1000):
    print ("ABD")
else:
    print("ABC")

Submission status: Runtime Error

Solution code:
a=int(input())
if a < = 999:
  print('ABC')
 else:
  print('ABD')

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
X = b - a 
s = int((X*(X+1))/2 - b)
print(s)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
X = b - a 
s = int((X*(X+1))/2 - b)
print(s)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
X = b - a 
s = (X*(X+1))/2 - b
print(s)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
X = b - a 
s = (X*(X+1))/2 - b
print(s)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
X = b - a 
s = (X*(X + 1))/2 - b
print(s)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
X = b - a 
s = (X*(X + 1))/2 - b

Submission status: Runtime Error

Solution code:
N = input()
if N > 999:
    print('ABD')
elif N <= 999:
    print('ABC')

Submission status: Runtime Error

Solution code:
word = input()
number = int(word)
if number <= 999:
  print(ABC)
if number > 999:
  print(ABD)

Submission status: Runtime Error

Solution code:
a, b = (int(i) for i in input().split())
c = b - a
alen = 0
for ccc in range(0,c):
    alen = alen + ccc  
ans = alen - a
print(ans)

Submission status: Runtime Error

Solution code:
def ABD(N):
if N <=999:
return ABC
elif N>999:
return ABD

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a = input()

if a < 1000 :
    print("ABC")
else :
    print("ABD")

Submission status: Runtime Error

Solution code:
N = input()
if N >1000:
    print("ABC")
else:
    print("ABD")

Submission status: Runtime Error

Solution code:
N = input
if N >1000:
    print("ABC")
else:
    print("ABD")

Submission status: Runtime Error

Solution code:
N = input
if n >1000:
    print("ABC")
else:
    print("ABD")

Submission status: Runtime Error

Solution code:
# import time
N, C = map(int, input().split())              # 同上。map関数を使うとこのように書ける

D = [[0 for i in range(C)] for j in range(C)]
c = [[0 for i in range(N)] for j in range(N)]
# iwakan = [[[0 for i in range(N)] for j in range(N)] for k in range(C)]

for i in range(C):
    D[i] = list(map(int, input().split()))

for i in range(N):
    c[i] = list(map(int, input().split()))

# まず違和感リストを作る。
# for i in range(C):
#     for j in range(N):
#         for k in range(N):
#             iwakan[i][j][k] = D[c[j][k] - 1][i]

'''
Gij0 : (i + j) % 3 == 0 となる場所
Gij1 : (i + j) % 3 == 1 となる場所
Gij2 : (i + j) % 3 == 2 となる場所
とした時に、
Gijnに属する場所全ての色をaに塗り替える場合の違和感の合計を
iwakan[n][a]とする。
iwakan[n][a]を全て求めるための計算量は、30*500*500 = 7500000
iwakan を用いて全ての色の塗り替えの組み合わせを求めるための計算量は
30 * 29 * 28 = 24360
'''

# t1 = time.time()

# Gijnに属する色の数を合計したリストを作る。
numOfColors = [[0 for i in range(C)] for j in range(3)]
for i in range(N):
    for j in range(N):
        if (i + j) % 3 == 0:
            numOfColors[0][c[i][j] - 1] = numOfColors[0][c[i][j] - 1] + 1
        if (i + j) % 3 == 1:
            numOfColors[1][c[i][j] - 1] = numOfColors[1][c[i][j] - 1] + 1
        if (i + j) % 3 == 2:
            numOfColors[2][c[i][j] - 1] = numOfColors[2][c[i][j] - 1] + 1

iwakan = [[0 for i in range(C)] for j in range(3)]
for i in range(3):
    for j in range(C):
        for a in range(C):
            iwakan[i][j] = iwakan[i][j] + numOfColors[i][a] * D[a][j]

# t2 = time.time()

sum_min = float("inf")
for i in range(C):
    for j in range(C):
        for k in range(C):
            if (i == j) or (j == k) or (k == i):
                pass
            else:
                sum_tmp = iwakan[0][i] + iwakan[1][j] + iwakan[2][k]
                if sum_min > sum_tmp:
                    sum_min = sum_tmp

# t3 = time.time()

print(sum_min)

# elapsed_time1 = t2 - t1
# elapsed_time2 = t3 - t2
# print(f'time1: {elapsed_time1}')
# print(f'time2: {elapsed_time2}')

Submission status: Runtime Error

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

s = set()
acc = 0
for i in range(1, 1000):
    acc += i
    s.add(acc)

for i in range(1, 4995001):
    if (a + i) in s and (b + i) in s:
        print(i)

Submission status: Runtime Error

Solution code:
N = int(raw_input().split())
if N <= 999:
 print "ABC"
else:
 print "ABD"

Submission status: Runtime Error

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

difference = b - a
rtn = sum(range(1, difference + 1))
print(rtn - b)

Submission status: Runtime Error

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

difference_a_b = b - a
rtn = 0
for i in range(difference_a_b):
    rtn += i+1
print(rtn - b)

Submission status: Runtime Error

Solution code:
def poll_height(n):
    rtn = 0 
    for i in range(n + 1): 
        rtn += i
    return rtn 

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

difference_a_b = b - a 
print(poll_height(difference_a_b) - b)

Submission status: Runtime Error

Solution code:
#def poll_height(n):
#    if n:
#        return n + poll_height(n - 1)
#    else:
#        return 1 

def poll_height(n):
    rtn = 0 
    for i in range(n + 1): 
        rtn += i
    return rtn 

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

difference_a_b = b - a 
print(poll_height(difference_a_b) - b)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10000)

def poll_height(n):
    if n:
        return n + poll_height(n - 1)
    else:
        return 1

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

difference_a_b = b - a
print(poll_height(difference_a_b) - b)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
def margin0(n):
    if n < 10:
        return "00{}".format(n)
    elif n < 100:
        return "0{}".fomrat(n)
    elif n < 1000:
        return "".format(n%1000)
    else:
        return "{}".format(n%1000 - 1)
n = int(input())
# print(n)
name = ""
if n < 1000:
    name = "ABC{}".format(margin0(n))
else:
    name = "ABD{}".format(margin0(n))
print(name[:3])

Submission status: Runtime Error

Solution code:
def margin0(n):
    if n < 10:
        return "00{}".format(n)
    elif n < 100:
        return "0{}".fomrat(n)
    elif n < 1000:
        return "".format(n%1000)
    else:
        return "{}".format(n%1000 - 1)
n = int(input())
# print(n)
name = ""
if n < 1000:
    name = "ABC{}".format(margin0(n))
else:
    name = "ABD{}".format(margin0(n))
print(name)

Submission status: Runtime Error

Solution code:
def margin0(n):
    if n < 10:
        return f"00".format(n)
    elif n < 100:
        return "0{}".fomrat(n)
    elif n < 1000:
        return "".format(n%1000)
    else:
        return "{}".format(n%1000 - 1)
n = int(input())
# print(n)
name = ""
if n < 1000:
    name = "ABC{}".format(margin0(n))
else:
    name = "ABD{}".format(margin0(n))
print(name)

Submission status: Runtime Error

Solution code:
return "ABC" if int(input()) < 1000 else "ABD"

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())　
if N <1000:
	print('ABC') 
else:
	print('ABD')

Submission status: Runtime Error

Solution code:
N = int(input())　
if N <1000:
	print("ABC") 
else:
	print("ABD")

Submission status: Runtime Error

Solution code:
N = int(input())　#int=整数
if N <1000:
	print("ABC") #"文字列"
else:
	print("ABD") #else=if以外

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
b_index = b-a
a_index = b_index - 1
get_height = lambda n: n*(n+1)/2

a_height = get_height(a_index)
b_height = get_height(b_index)
snow_height = b_height - b
print(int(snow_height))

Submission status: Runtime Error

Solution code:
k, l=[int(i) for i in input().split()]

import numpy as np
n = np.zeros(999)
for i in range(1000):
    if i != 0:
        n[i-1] = i


def snowh(k, l):
    for i in range(1000):
        if l-k == n[i-1]:
            return n[i-2]*(n[i-2]+1)*0.5 - k
        
print(snowh(k, l))

Submission status: Runtime Error

Solution code:
n = int(input())
def con_n(n):
    if n < 1000:
        return 'ABC'
    elif n => 1000:
        return 'ABD'
    
print(con_n(n))

Submission status: Runtime Error

Solution code:
if N <=999:
    print("ABC")
else:
    print("ABD")

Submission status: Runtime Error

Solution code:
a,b = [int(i) for i in input().split()]
n = b-a-1
print(int(n*(n+1)/2-a))

Submission status: Runtime Error

Solution code:
a,b = [int(i) for i in input().split()]
n = b-a-1
print(n*(n+1)/2-a)

Submission status: Runtime Error

Solution code:
input_line = list(map(int, input().split()))
a = input_line[0]
b = input_line[1]

x = b - a

for i in range(1, x):
    x += i;
print(abs(x-b))

Submission status: Runtime Error

Solution code:
input_line = list(map(int, input().split()))
a = input_line[0]
b = input_line[1]

x = b - a

for i in range(1, x):
    x += i;
print(x-b)

Submission status: Runtime Error

Solution code:
input_line = list(map(int, input().split()))
a = input_line[0]
b = input_line[1]

x = b - a

for i in range(0, x):
    x += i;
print(x-b)

Submission status: Runtime Error

Solution code:
if int(input()) < 1000 :
  print("ABC")
elif 1000 <= int(input()) <1999 :
  print("ABD")

Submission status: Runtime Error

Solution code:
a = input()
b = int(a)
if b < 1000 :
    print "ABC"
else:
    print "ABD"

Submission status: Runtime Error

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

t = 0
pt = 0
for i in range(1000):
    t += i
    if a < pt and b < t:
        if (pt-a) == (t-b):
            print(pt-a)
            break
    pt = t

Submission status: Runtime Error

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

t = 0
pt =0

for I in range(1000):
     t+=1
     if (pt < a and  b < t ):
              if( pt-a==t-b ):
                    print(pt-a)
                    break
     pt+=1

Submission status: Runtime Error

Solution code:
a=input()
if a<=999:
    print("ABC")
else:
    print("ABD")

Submission status: Runtime Error

Solution code:
n = input(int())

if n<=999:
    print('ABC')
else:
    print('ABD')

Submission status: Runtime Error

Solution code:
i=input()
if i<1000:
  print('ABC')
else:
  print('ABD')

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
C = (B - A )*( B - A + 1 )/ 2 - B 
print(C)

Submission status: Runtime Error

Solution code:
    a,b = [int(i) for i in input().split()]
     
    souwa = 0
    n = b - a
    for i in range(n):
        souwa += i
         
    x = souwa - b
         
    print(x)

Submission status: Runtime Error

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

souwa = 0
n = b - a
for i in range(n):
    souwa += i
     
x = souwa - b
     
print(x)

Submission status: Runtime Error

Solution code:
a, b  = [int(i) for i in input().split()]
     
souwa = 0
n = b - a
for i in range(n):
    souwa += i
     
x = souwa - b
     
print(x)

Submission status: Runtime Error

Solution code:
a, b = [int(i) for i in input().split()]
c = b-a
d = 0
for j in range(c):
    d+=j
d-=a
print(d)

Submission status: Runtime Error

Solution code:
N = input()
if N<1000:
    print("ABC")
else:
    print("ABD")

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
print((b-a-1)*(b-a)/2-a)

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
print((b-a-1)*(b-a)//2-a)

Submission status: Runtime Error

Solution code:
a=input()
if a>999:
    print('ABD')
else:
    print('ABC')

Submission status: Runtime Error

Solution code:
while(True):
    line = input();

    if(line < 1000):
        print('ABC');
    else:
        print('ABD');

Submission status: Runtime Error

Solution code:
#coding : utf8

while(True):
    line = input();

    if(line < 1000):
        print('ABC');
    else:
        print('ABD');

Submission status: Runtime Error

Solution code:
#coding : utf8

number = input();
if(number < 1000):
    print('ABC');
else:
    print('ABD');

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
c = int(b - a)
d =int( c * (c - 1) // 2 + c  -b)
print(d)

Submission status: Runtime Error

Solution code:
if int(raw_iniput()) >= 1000:
  print 'ABD'
else:
  print 'ABC'

Submission status: Runtime Error

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

sa = b - a
east = (1 + sa) * sa / 2
snow = int(east - b)
print(snow)

Submission status: Runtime Error

Solution code:
num = input()
if num < 1000:
  print('ABC')
else:
  print('ABD')

Submission status: Runtime Error

Solution code:
from itertools  import product, permutations

N, C = map(int, input().split())

D = [list(map(int, input().split())) for _ in range(C)]

c = [list(map(lambda x: int(x)-1, input().split())) for _ in range(N)]

res = 1000*N*N

scores = [[0,0,0] for _ in range(C)]

for cc in range(C):
    for i,j in product(range(N), range(N)):
        if (i + j)%3 == 0:
            scores[cc][0] += D[c[i][j]][cc]
        if (i + j)%3 == 1:
            scores[cc][1] += D[c[i][j]][cc]
        if (i + j)%3 == 2:
            scores[cc][2] += D[c[i][j]][cc]



for c1, c2, c3 in permutations(range(C), 3):
    score = scores[c1][0] + scores[c2][1] + scores[c3][2]
    if res > score:
        res = score

print(res)

Submission status: Runtime Error

Solution code:
from itertools import permutations

N, C = [int(elem) for elem in input().split(' ')]
D_matrix = [[int(elem) for elem in input().split(' ')] for _ in range(C)]
assert len(D_matrix) == C
assert len(D_matrix[0]) == C
c_matrix = [[int(elem) for elem in input().split(' ')] for _ in range(N)]
assert len(c_matrix) == N
assert len(c_matrix[0]) == N

# grouping
# O(N^2)
mod_list = [[] for _ in range(3)]
for i in range(N):
    for j in range(N):
        mod_list[(i + j) % 3].append((i, j))

# O(N^2)
mod_color_list = [[0] * C for _ in range(3)]
for k, mod in enumerate(mod_list):
    for i, j in mod:
        mod_color_list[k][c_matrix[i][j] - 1] += 1

# O(C^3 * N^2) -> O(C^4)
min_cost = float('inf')
for colors in permutations(range(C), 3):
    total_cost = 0
    for color, mod_color in zip(colors, mod_color_list):
        total_cost += sum([D_matrix[X][color] * mod_color[X] for X in range(C)])
    min_cost = min(min_cost, total_cost)

print(min_cost)

Submission status: Runtime Error

Solution code:
ｆｇｈｊ