s = 'WHERETHEREISAWILLTHEREISAWAY'
s = sorted(s) # 变成列表形式了
print(''.join(s))
# a = 0
# res = []
# for i in range(187,10**17,374): # 不能被我除尽,一定不是187的偶数倍
# if i % 49 == 46 and i % 48 == 41 and i % 47 == 5 and i % 46 == 15 and i % 45 == 29:
# a = a+1
# res.append(i)
# if a == 5:break
# print(res)
mod = [(2, 1), (3, 2), (4, 1), (5, 4), (6, 5), (7, 4), (8, 1), (9, 2), (10, 9),
(11, 0), (12, 5), (13, 10), (14, 11), (15, 14), (16, 9), (17, 0), (18, 11), (19, 18),
(20, 9), (21, 11), (22, 11), (23, 15), (24, 17), (25, 9), (26, 23), (27, 20), (28, 25), (29, 16),
(30, 29), (31, 27), (32, 25), (33, 11), (34, 17), (35, 4), (36, 29), (37, 22), (38, 37), (39, 23),
(40, 9), (41, 1), (42, 11), (43, 11), (44, 33), (45, 29), (46, 15), (47, 5), (48, 41),(49,46)
]
for i in range(5458460249,10**17,12590206409 - 5458460249):
for a,b in mod:
if i % a != b:break
else:print(i)
a = 1189
b = 841
res = []
for i in range(10):
res.append([a,b])
if a > b: a = a//2
else: b = b // 2
n = input()
if n == 'A0':
print(res[0][0])
print(res[0][1])
if n == 'A1':
print(res[1][1])
print(res[1][0])
if n == 'A2':
print(res[2][0])
print(res[2][1])
if n == 'A3':
print(res[3][1])
print(res[3][0])
if n == 'A4':
print(res[4][0])
print(res[4][1])
if n == 'A5':
print(res[5][1])
print(res[5][0])
if n == 'A6':
print(res[6][0])
print(res[6][1])
if n == 'A7':
print(res[7][1])
print(res[7][0])
if n == 'A8':
print(res[8][0])
print(res[8][1])
if n == 'A9':
print(res[9][1])
print(res[9][0])
n,m = int(input()),int(input())
dic = {}
for i in range(1,n+1):
dic.update({i:sum([int(x) for x in str(i)])})
res = sorted(dic.items(),key = lambda x:x[1])
print(res[m-1][0])
def find(x,y,n,step):
if n == 0:
x -= step
return x,y
if n == 1:
x -= 0.5*step
y += step
return x,y
if n == 2:
x += 0.5*step
y += step
return x,y
if n == 3:
x += step
return x,y
if n == 4:
x += 0.5*step
y -= step
return x,y
if n == 5:
x -= 0.5*step
y -= step
return x,y
if __name__ == '__main__':
d1,p1,q1,d2,p2,q2 = map(int,input().split())
xb1,yb1 = find(0,0,d1,p1)
xb,yb = find(xb1,yb1,(d1+2)%6,q1)
xc1,yc1 = find(0,0,d2,p2)
xc,yc = find(xc1,yc1,(d2+2)%6,q2)
if abs(yc - yb) >= abs(xc - xb): print(abs(yc-yb))
else: print(int(abs(yc - yb) + (abs(xc - xb) - 0.5*abs(yc - yb))))
def eliminate(s):
a = set()
for i in range(1,len(s)-1):
if s[i-1] == s[i] and s[i] != s[i + 1]:
a.add(i+1)
a.add(i)
if s[i] == s[i + 1] and s[i] != s[i - 1]:
a.add(i)
a.add(i-1)
s = list(s)
for i in a:
s[i] = '' # 边缘的都变成’‘
return ''.join(s)
if __name__ == '__main__':
s = input()
for _ in range(2**64):
temp = s
s = eliminate(s)
if temp == s:
print(s)
break
if len(s) == 0:
print('EMPTY')
break
参考与https://blog.csdn.net/BlacKingZ/article/details/124066488
if __name__ == '__main__':
n,m = map(int,input().split())
A = []
B = []
for i in range(n):
a,b = map(int,input().split())
A.append(a)
B.append(b)
res = 0
for _ in range(m): # O(mn)
maxa = max(A)
res += maxa
index1 = A.index(maxa)
A[index1] -= B[index1]
print(res)
import copy
def isfdj(lst):
return lst == sorted(lst)
if __name__ == '__main__':
n,k = map(int,input().split())
ls = [int(x) for x in input().split()]
l = []
for i in range(0,n-k): #O(n)
if i == 0:
tmp = copy.deepcopy(ls)
for j in range(k): #O(k)
tmp[j] = 0
else:
tmp = copy.deepcopy(ls)
t = ls[i-1]
for j in range(i,i+k):
tmp[j] = t
ll = 0
low = 0
high = 0
while high < n: #O(n)
if isfdj(ls[low,high]): # O(nlogn)
ll += 1
else:
l.append(ll)
ll = 0
low = high
high += 1
l.append(ll)
print(len(l))
import copy
def isfdj(lst):
return lst == sorted(lst)
def erfen(a,k): # 找到单调递增序列a中 第一个比k大的元素
l = 0
r = n
while l < r:
mid = (l+r)//2
if a[mid] > k:r = mid
else : l = mid
if r - l == 1:return r
return 0
if __name__ == '__main__':
n,k = map(int,input().split())
ls = [int(x) for x in input().split()]
l = []
for i in range(0,n-k): #O(n)
if i == 0:
tmp = copy.deepcopy(ls)
for j in range(k): #O(k)
tmp[j] = 0
else:
tmp = copy.deepcopy(ls)
t = ls[i-1]
for j in range(i,i+k):
tmp[j] = t
res = []
d =[0]*(n+1)
d[1] = tmp[0]
len = 1
for i in range(1,n):
if tmp[i] >= d[len]:
len += 1
d[len] = tmp[i]
else: #换掉该换的
j = erfen(d,tmp[i])
d[j] = tmp[i]
res.append(len)
print(max(res))
if __name__ == '__main__':
n,k = map(int,input().split())
A = [int(x) for x in input().split()]
res = 0
for i in range(0, n - k+1):
while 0 not in A[i:i+k]:
for j in range(i,i+k):
A[j] -= 1
res += 1
res += sum(A)
print(res)