Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n = int(input())
count = 0
for i in range(n):
    count += i
print(count)

### FIXED CODE ###

n = int(input())
print(n*(n-1)//2)
### BUGGY CODE ###

N, K = map(int, input().split())
L = [0] * K
R = [0] * K
S = set()
for k in range(K):
    L[k],R[k] = map(int,input().split())
for k in range(K):
    for n in range(L[k], R[k] + 1):
        S.add(n)
dp = [0] * (N+1)
dp[1] = 1
S = sorted(S)
for i in range(1,N+1):
    for s in S:    
        if i-s <= 0:
            break
        dp[i] += dp[i-s]
        while dp[i] >= 998244353:
            dp[i] -= 998244353
while dp[N] >= 998244353:
    dp[N] -= 998244353 
print(dp[N])

### FIXED CODE ###

N, K = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(K)]

dp = [0] * (N + 1)
dp_sums = [0] * (N + 1)
dp[1] = dp_sums[1] = 1

for i in range(2,N+1):
    for l, r in S: 
        if i >= r + 1:
            dp[i] += dp_sums[i - l] - dp_sums[i - r - 1] 
            dp_sums[i] = dp_sums[i-1] + dp[i]
        elif i > l and i < r + 1:
            dp[i] += dp_sums[i - l] 
            dp_sums[i] = dp_sums[i-1] + dp[i]
        elif i <= l:
            dp_sums[i] = dp_sums[i-1] + dp[i]
    dp[i] %= 998244353
    dp_sums[i] %= 998244353
print(dp[N])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
q = int(input())

mod=1000003

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y//2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

def div(a, b):
    return mul(a, power(b, mod-2))

for j in range(q):
    x,d,n=(int(i) for i in input().split())  
    xd=div(x, d)
    ans=1
    if mod <= xd+n-1:
        ans=0

    for i in range(n):
        ans=mul(ans,xd+i)
    
    print((power(d,n)*ans)%mod)
  



### FIXED CODE ###

import sys
input = sys.stdin.readline
q = int(input())

p=1000003

flist=[1 for i in range(p)]
for i in range(1,p):
    flist[i]=flist[i-1]*i%p

for i in range(q):
  x,d,n=(int(i) for i in input().split())
  if d==0:
    ans=pow(x,n,p)
  else:
    x=x*pow(d,p-2,p)%p    
    if p<=x+n-1:
      ans=0
    else:
      ans=pow(d,n,p)*flist[x+n-1]*pow(flist[x-1],p-2,p)%p
  print(ans%p)
### BUGGY CODE ###

from math import factorial
#a = factorial(n) / factorial(r) / factorial(n - r)
n,m = map(int,input().split())
l = list(map(int,input().split()))
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
l.sort()
ans = 0
mod = 10**9+7
mi = 0
for i in range(n-m+1):
    com = combination(n-i-1,m-1)
    ans += com*l[-i-1]
    mi += com*l[i]
    ans %= mod
    mi %= mod
    
print((ans-mi)%mod)


### FIXED CODE ###

n,k = map(int,input().split())
l = list(map(int,input().split()))

mod = 10**9+7

fact = [1]
for i in range(n):
    fact.append(fact[-1]*(i+1)%mod)

finv = [1]*(n+1)
finv[n] = pow(fact[-1],mod-2,mod)
for i in range(n-1,0,-1):
    finv[i] = ((i+1)*finv[i+1])%mod

def combi(n,k,mod):
    return (fact[n]*finv[k]*finv[n-k])%mod

l.sort()

ans = 0
for i in range(n-k+1):
    tmp = combi(n-i-1,k-1,mod)
    ans += tmp*(l[-i-1]-l[i])
    ans %= mod

print(ans%mod)
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))
l.sort()

ans=0

temp=[] #長辺とそれ以外の辺との長さの差を記録しておく

for i in range(2,n): #各長辺について調べる。

  maetonosa=l[i]-l[i-1]
  #今調べてる項の1つ前の項を含む組み合わせについて、
  #調べてる項との差を新たにtempに挿入
  for j in temp[:]:
    if j>maetonosa:
      ans+=1
      j-=maetonosa
    else:
      temp.remove(j)

  for j in range(i-1):
    temp2=l[i-1]+l[i-2-j] #1つ前の項と、(順番に小さくしてく)l[i-2-j]との和
    if temp2>l[i]:#temp2が長辺より大きいか調べる
      ans+=1 #大きいなら答えを1足す
      temp.append(temp2-l[i])
    else:
      break #それ以降を調べる必要がないためjについてのfor文を終了

print(ans)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
l.sort()

import bisect

ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    ind=bisect.bisect_left(l,l[i]+l[j])
    ans+=ind-j-1
print(ans)
### BUGGY CODE ###

n, m = map(int, input().split())
ps_list = [[i for i in input().split()] for j in range(m)]

ac_list = []
wa_list = [0 for i in range(n)]
num_wa = 0

for ps in ps_list:
    p = int(ps[0])
    s = ps[1]
    
    if s == 'AC' and p not in ac_list:
        ac_list.append(p)
        num_wa += wa_list[p-1]
    elif p not in ac_list:
        wa_list[p-1] += 1
            
num_ac = len(ac_list)
        
print(num_ac, num_wa)

### FIXED CODE ###

n, m = map(int, input().split())
ps_list = [[i for i in input().split()] for j in range(m)]

ac_list = []
wa_list = [0 for i in range(n)]
num_wa = 0
num_ac = 0

for ps in ps_list:
    p = int(ps[0])
    s = ps[1]
    
    if s == 'AC' and wa_list[p-1] != -1:
        ac_list.append(p)
        num_wa += wa_list[p-1]
        num_ac += 1
        wa_list[p-1] = -1
    elif wa_list[p-1] != -1:
        wa_list[p-1] += 1
        
print(num_ac, num_wa)
### BUGGY CODE ###

from itertools import product as prod

n, m = [int(x) for x in input().split()]

gr = [[] for _ in range(n)]
for _ in range(m):
    a, b, c = [int(x) for x in input().split()]
    a -= 1
    b -= 1
    gr[a].append((b, c))
    gr[b].append((a, c))

def dist(i, j, gr=gr):
    tmp_d = float("inf")
    if i == j:
        return 0
    for (n, d) in gr[i]:
        if n == j:
            tmp_d = d
    gr_cp = [[(n, d) for (n, d) in g if n != i] for g in gr]
    routes = [d + dist(n, j, gr=gr_cp) for (n, d) in gr[i]]

    return min(routes + [tmp_d])

ans = 0
for i, j in prod(range(1, m), range(1,m)):
    for (n, d) in gr[i]:
        if n == j and d > dist(i, j):
            ans += 1
print(ans // 2)


### FIXED CODE ###

import copy
from itertools import product as prod

n, m = [int(x) for x in input().split()]

wait = [[float("inf") for _ in range(n)] for _ in range(n)]
for i in range(n):
    wait[i][i] = 0
for _ in range(m):
    a, b, c = map(int, input().split())
    wait[a-1][b-1] = c
    wait[b-1][a-1] = c

dist = copy.deepcopy(wait)
for k, i, j in prod(range(n), range(n), range(n)):
    dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
    dist[j][i] = min(dist[j][i], dist[j][k] + dist[k][i])

ans = 0
for i, j in prod(range(n), range(n)):
    if not wait[i][j] == float("inf") and dist[i][j] < wait[i][j]:
        ans += 1

print(ans // 2)
### BUGGY CODE ###

n = int(input())
result=1
a = list(map(int,input().split()))
for i in a:
    result*=i
 
if result > 1000000000000000000:
    print(-1)
else:
    print(result)

### FIXED CODE ###

n = int(input())
result=1
a = list(map(int,input().split()))
    
if 0 in a:
    print(0) 
else:
    for i in a:
        result*=i
        if result > 10**18:
            print(-1)
            break
    if result <= 10**18:
        print(result)
### BUGGY CODE ###

N = int(input())

def enzan(k, yakusu):
    return(k * yakusu)


def make_divisor_list(num):
    if num < 1:
        return 0
    elif num == 1:
        return 1
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return len(divisor_list)


wa = 0
for k in range(1, N+1):
    wa += enzan(k, make_divisor_list(k))

print(wa)

# print(make_divisor_list(4))

### FIXED CODE ###

N = int(input())

ans = 0
for  i in range(1, N + 1):
    ans += i * ((N // i) * ((N // i) + 1))/2

print((int)(ans))
### BUGGY CODE ###

from sys import stdin

MOD = 10**9+7
def modcmb(n, r, mod):
    x = 1
    y = n
    for i in range(2,r+1):
        x *= i
        x %= mod
        y *= n-i+1
        y %= mod
    return y * pow(x, mod-2, mod) % mod

n, a, b = [int(x) for x in stdin.readline().rstrip().split()]

DIV = 10**9+7

all_n = '1'* n
nishin = int(all_n, 2)

_a = modcmb(n, a, MOD)
_b = modcmb(n, b, MOD)

print((nishin - (_a + _b))%DIV)

### FIXED CODE ###

from sys import stdin

MOD = 10**9+7
def modcmb(n, r, mod):
    x = 1
    y = n
    for i in range(2,r+1):
        x *= i
        x %= mod
        y *= n-i+1
        y %= mod
    return y * pow(x, mod-2, mod) % mod

n, a, b = [int(x) for x in stdin.readline().rstrip().split()]

DIV = 10**9+7

_n = pow(2, n, MOD)
_a = modcmb(n, a, MOD)
_b = modcmb(n, b, MOD)
ans = _n - _a - _b - 1
print(ans % MOD)
### BUGGY CODE ###

K=int(input())
n=len(str(K))
N=int("7"*n)
if K%2==0:
    print(-1)
else:
    while N%K!=0:
        n+=1
        N=N*10+7
        N%=K
    print(n)
    

### FIXED CODE ###

K=int(input())
n=len(str(K))
N=int("7"*n)
if K%2==0 or K%5==0:
    print(-1)
else:
    while N%K!=0:
        n+=1
        N=N*10+7
        N%=K
    print(n)
### BUGGY CODE ###

N = int(input())
S = [s for s in input()]
ans = S.count("R") * S.count("G") * S.count("B")

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        k = j + (j - i)
        if N - 1 < k:
            continue
        if S[k] != S[i] and S[k] != S[j] and S[i] != S[j]:
            ans -= 1

print(ans)


### FIXED CODE ###

N = int(input())
S = [s for s in input()]
ans = S.count("R") * S.count("G") * S.count("B")

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        k = j + (j - i)
        if N - 1 < k:
            continue
        if S[k] != S[i] and S[k] != S[j] and S[i] != S[j]:
            ans -= 1

print(ans)
### BUGGY CODE ###

import sys
readline = sys.stdin.readline

H,W = map(int,readline().split())

grid = [None] * H
dist = [[2000] * W for i in range(H)]
from collections import deque
q = deque([])
for i in range(H):
  grid[i] = readline().rstrip()
  for j in range(len(grid[i])):
    if grid[i][j] == "#":
      q.append((i,j,0))

cases = ((0,1),(0,-1),(1,0),(-1,0))
ans = 0
while q:
  y,x,d = q.popleft()
  if dist[y][x] <= d:
    continue
  dist[y][x] = d
  if ans < d:
    ans = d
  for c in cases:
    if 0 <= y + c[0] < H and 0 <= x + c[1] < W:
      q.append((y + c[0],x + c[1],d + 1))
print(ans)

### FIXED CODE ###

H,W=map(int,input().split())
INF=10**4
import numpy as np
a=np.full((H,W),INF,dtype=int)
for i in range(H):
  s=input()
  for j in range(len(s)):
    if s[j]=="#":
      a[i,j]=0

for i in range(0,W-1):
  np.minimum(a[:,i]+1,a[:,i+1],out=a[:,i+1])
for i in range(W-1,0,-1):
  np.minimum(a[:,i]+1,a[:,i-1],out=a[:,i-1])
for j in range(0,H-1):
  np.minimum(a[j,]+1,a[j+1,],out=a[j+1,])
for j in range(H-1,0,-1):
  np.minimum(a[j,]+1,a[j-1,],out=a[j-1,])

print(a.max())
### BUGGY CODE ###

import sys
from collections import defaultdict

int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    md=998244353
    n,s=MI()
    aa=LI()
    dp=[defaultdict(int) for _ in range(s+1)]
    dp[0][0]=1
    for k,a in enumerate(aa):
        for i in range(s-a,-1,-1):
            if len(dp[i])==0:continue
            for ln,c in dp[i].items():
                dp[i+a][ln+1]=(dp[i+a][ln+1]+c)%md
        #print(k,dp)
    ans=0
    for ln,c in dp[s].items():
        ans=(ans+pow(2,n-ln,md)*c)%md
    print(ans)

main()

### FIXED CODE ###

import sys
from collections import defaultdict

int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    md=998244353
    n,s=MI()
    aa=LI()
    dp=[0]*(s+1)
    dp[0]=1
    inv=pow(2,md-2,md)
    for k,a in enumerate(aa):
        for i in range(s-a,-1,-1):
            dp[i+a]=(dp[i+a]+dp[i]*inv)%md
        #print(k,dp)
    ans=dp[s]*pow(2,n,md)%md
    print(ans)

main()
### BUGGY CODE ###

import numpy as np

N = int(input())
Nloop = N + 1
A = np.zeros((Nloop, Nloop), dtype="int")

for i in range(1, Nloop):
    Acount = int(input())
    for _ in range(Acount):
        x, y = map(int,input().split())
        A[i, x] = 1 if y == 1 else -1

honest_loop = 2 ** N
is_honest = np.zeros(Nloop, dtype="bool")

ans = 0

for i in range(1, honest_loop):
    for l in range(1, Nloop):
        is_honest[l] = (i >> (l - 1) & 1 == 1)

    honest_check = True
    for l in range(1, Nloop):
        # lの人が正直者のとき
        if is_honest[l]:
            # lの人から見てjの人は正直者か？
            for j in range(1, Nloop):
                if A[l, j] == 1:
                    if not is_honest[j]:
                        honest_check = False
                elif A[l, j] == -1:
                    if is_honest[j]:
                        honest_check = False
                if not honest_check:
                    break
        if not honest_check:
            break

    if honest_check:
        ans = max(sum(is_honest), ans)

print(ans)

### FIXED CODE ###

N = int(input())
Nloop = N + 1
A = [[0] * Nloop for _ in range(Nloop)]

for i in range(1, Nloop):
    Acount = int(input())
    for _ in range(Acount):
        x, y = map(int, input().split())
        if y == 1:
            A[i][x] = 1
        else:
            A[i][x] = -1

honest_loop = 2 ** N
is_honest = [False] * Nloop

ans = 0

for i in range(1, honest_loop):
    for l in range(1, Nloop):
        is_honest[l] = (i >> (l - 1) & 1 == 1)

    honest_check = True
    for l in range(1, Nloop):
        # lの人が正直者のとき
        if is_honest[l]:
            # lの人から見てjの人は正直者か？
            for j in range(1, Nloop):
                if A[l][j] == 1:
                    if not is_honest[j]:
                        honest_check = False
                elif A[l][j] == -1:
                    if is_honest[j]:
                        honest_check = False
                if not honest_check:
                    break
        if not honest_check:
            break

    if honest_check:
        ans = max(sum(is_honest), ans)

print(ans)
### BUGGY CODE ###

n,m = map(int,input().split())
item = list(map(int,input().split()))
 
item.sort(reverse=True)
s = 0
 
while s == 0:
    for i in range(n):
        if i == 0:
            item[i] = int(item[i]/2)
            m -= 1
            temp = item[i]
            if m == 0:
                s = 1
                break
            continue

        item.sort(reverse=True)
        break
        
 
print(sum(item))

### FIXED CODE ###

n,m = map(int,input().split())
item = list(map(int,input().split()))

item.sort(reverse=True)
s = 0

while s == 0:
    for i in range(n):
        if i == 0:
            item[i] = int(item[i]/2)
            m -= 1
            temp = item[i]
            if m == 0:
                s = 1
                break
            continue
        if item[i] > temp:
            item[i] = int(item[i]/2)
            m -= 1
            if m == 0:
                s = 1
                break
            continue
        item.sort(reverse=True)
        break
        

print(sum(item))
### BUGGY CODE ###

import numpy as np
n, m = map(int, input().split())
bridge = []
for i in range(m):
    bridge += list(map(int, input().split()))
bridge = np.array(bridge).reshape(m, 2)
total = n*(n-1)//2
ans =[total]
u = [i for i in range(n+1)]
def unite(x, y):
    X = find(x)
    Y = find(y)
    if X != Y:
        return 1
    else:
        return 0

def find(x):
    if x != u[x]:
        x =u[x]
        find(x)
    return x

for x , y in bridge[::-1]:
    if unite(x, y):
        xc = u.count(u[x])
        yc = u.count(u[y])
        total -= xc * yc
        ans += [total]
        if xc >= yc:
            x, y = sorted([x, y])
            u = [find(y) if i == find(x) else i for i in u]
        else:
            u = [find(y) if i == find(x) else i for i in u]
    else:
        ans += [total]

ans = ans[:-1]
print(*ans[::-1], sep="\n")

### FIXED CODE ###

import sys
n , m, *e = map(int,sys.stdin.read().split())
total = n*(n-1)//2
ans =[total]
u = [-1]*(n+1)

def find(x):
    if u[x] < 0 :
        return x
    else:
        return find(u[x])

for x , y in zip(e[-2:1:-2],e[:1:-2]):
    x = find(x)
    y = find(y)
    x, y = sorted((x, y))
    if x != y:
        total -= u[x] * u[y]
        u[x] += u[y]
        u[y] = x
    ans += [total]

print(*ans[::-1], sep="\n")
### BUGGY CODE ###

import sys
N = int(input())
c = input()
ans = 0
exchange = 0
for i in range(N):
    if c[i] == "W":
        exchange = i
        break
else:
    print(0)
    sys.exit()

for i in range(N):
    if N-1-i >exchange:
        if c[-(i+1)] =="R":
            c = c[:exchange]+"R"+c[exchange+1:]
            c = c[:-(i+1)]+"W"+c[(i+1)+1:]
            ans += 1
            for k in range(exchange+1,N):
                if c[i] == "W":
                    exchange = k
                    break
    
print(ans)

### FIXED CODE ###

import sys
N = int(input())
c = input()
ans = 0
exchange = 0
for i in range(N):
    if c[i] == "W":
        exchange = i
        break
else:
    print(0)
    sys.exit()

for i in range(N):
    if N-i > exchange:
        if c[-(i+1)] =="R":
            # c = list(c)
            # c[exchange] = "R"
            # c[-(i+1)] = "W"
            # c = "".join(c)
            # c = c[:exchange]+"R"+c[exchange+1:]
            # print("newc=",c)
            # c = c[:-(i+1)]+"W"+c[N-i:]
            # print("newc=",c)
            ans += 1
            for k in range(exchange+1,N-(i+1)):
                if c[k] == "W":
                    exchange = k
                    break
            else:
                break
    else:
        break
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
q = int(input())

import collections
a = collections.Counter(a)
for i in range(q):
    b,c = list(map(int,input().split()))
    d = a[b]
    a[b] = 0
    a[c] += d
    print(sum([key*value for key,value in a.items()]))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
q = int(input())

import collections
ans = sum(a)
a = collections.Counter(a)

for i in range(q):
    b,c = list(map(int,input().split()))
    d = a[b]
    ans -= d*b
    a[b] = 0
    ans += d*c
    a[c] += d
    print(ans)
### BUGGY CODE ###

s = list(input())
n = len(s)

map_list = [int(i) for i in s]
ans=0
while True:
    flag=True
    for i in range(n-1):
        if map_list[i]==-1:
            continue
        j=i+1
        if map_list[i+1]==-1:
            for k in range(i+1,n):
                if map_list[k]!=-1:
                    j=k
                    break
        if min(map_list[i],map_list[j])>=0:
            if map_list[i]!=map_list[j]:
                map_list[i]=-1
                map_list[j]=-1
                flag=False
                ans+=2
                continue
    if flag:
        break
print(ans)




### FIXED CODE ###

s = input()
print(2*min(s.count('0'),s.count('1')))
### BUGGY CODE ###

from collections import defaultdict

h, w, m = map(int, input().split())

cnt_h = [0] * h
cnt_w = [0] * w
dic = defaultdict(int)

for _ in range(m):
    h_m, w_m = map(int, input().split())
    cnt_h[h_m - 1] += 1
    cnt_w[w_m - 1] += 1
    dic[h_m - 1, w_m - 1] += 1

max_h = max(cnt_h)
max_w = max(cnt_w)

mh = []
mw = []

for i in range(h):
    if max_h == cnt_h[i]:
        mh.append(i)

for i in range(w):
    if max_w == cnt_w[i]:
        mw.append(i)

flag = False
for i in mh:
    for j in mw:
        if dic[i, j] == 0:
            flag = True

if flag:
    print(max_h + max_w)
else:
    print(max_h + max_w - 1)

### FIXED CODE ###

from collections import defaultdict

h, w, m = map(int, input().split())

cnt_h = [0] * h
cnt_w = [0] * w
dic = defaultdict(int)

for _ in range(m):
    h_m, w_m = map(int, input().split())
    cnt_h[h_m - 1] += 1
    cnt_w[w_m - 1] += 1
    dic[(h_m - 1, w_m - 1)] += 1

max_h = max(cnt_h)
max_w = max(cnt_w)

mh = []
mw = []

for i in range(h):
    if max_h == cnt_h[i]:
        mh.append(i)

for i in range(w):
    if max_w == cnt_w[i]:
        mw.append(i)

for i in mh:
    for j in mw:
        if dic[(i, j)] == 0:
            print(max_h + max_w)
            quit()

print(max_h + max_w - 1)
### BUGGY CODE ###

import numpy
l=[]
a, b = map(int, input().split())
for i in range(a, b+1):
    l.append(i)
a=numpy.prod(l)
if a==0:
    ans="Zero"
elif a<0:
    ans="Negative"
else:
    ans="Positive"
print(ans)

### FIXED CODE ###

from math import fabs
a, b = map(int, input().split())
if a <= 0 and 0 <= b:
    print("Zero")
else:
    if a > 0:
        print("Positive")
    else:
        if (fabs(b - a) + 1) % 2 == 0:
            print("Positive")
        else:
            print("Negative")
### BUGGY CODE ###

from sys import stdin, stdout
input = stdin.readline
print = stdout.write
from functools import reduce
n, k = map(int,input().split())
a = list(map(int,input().split()))
prod = reduce(lambda x,y: x*y ,a[:k])
ans = []
for i in range(k,n):
    prodt = (prod/a[i-k])*a[i]
    if prodt>prod:
        ans.append('Yes')
    else:
        ans.append('No')
    prod = prodt
ans = '\n'.join(ans)
print(ans)

### FIXED CODE ###

from sys import stdin, stdout
input = stdin.readline
print = stdout.write
from functools import reduce
n, k = map(int,input().split())
a = list(map(int,input().split()))
prod = a[0]
ans = []
for i in range(k,n):
    prod = a[i-k]
    prodt = a[i]
    if prodt>prod:
        ans.append('Yes')
    else:
        ans.append('No')
ans = '\n'.join(ans)
print(ans)
### BUGGY CODE ###

import fractions

n = int(input())
lst = [int(i) for i in input().split()]
gcd = []

for i in range(n):
    f = 0
    for j in range(n):
        if f==0 and j!=i:
            f = lst[j]
        elif j!=i:
            f = fractions.gcd(f,lst[j])
    gcd.append(f)
print(max(gcd))

### FIXED CODE ###

import fractions
from functools import reduce

n = int(input())
a = list(map(int,input().split()))

left = [0] * (n+1)
right = [0] * (n+1)

for i in range(n):
    left[i+1] = (fractions.gcd(left[i],a[i]))
    right[n-i-1] = (fractions.gcd(right[n-i],a[n-i-1]))

ans = 0
for i in range(n):
    ans = max(ans,fractions.gcd(left[i],right[i+1]))
print(ans)
### BUGGY CODE ###

def main():
    n=int(input())
    a=list(map(int,input().split()))
    ans=0
    temp=0
    MOD=10**9+7
    bin_a=[[0] * n for i in range(60)]
    for i in range(n):
        tmp=str(bin(a[i]))
        # print(a[i])
        # print(len(tmp))
        for j in range(len(tmp)-2):
            if tmp[len(tmp)-j-1] == 'b':
                break
            # print(tmp[len(tmp)-i-1])
            bin_a[j][i]=int(tmp[len(tmp)-j-1])

    for i in range(60):
        cnt1=sum(bin_a[i])
        cnt0=n-cnt1
        ans+=cnt1*cnt0*2**i%MOD
    print(ans%MOD)

if __name__=='__main__':
    main()


### FIXED CODE ###

def main():
    n=int(input())
    a=list(map(int,input().split()))
    ans=0
    temp=0
    MOD=10**9+7
    cnt1=[0]*60
    for num in a:
        for i in range(60):
            cnt1[i] += (num >> i) & 1
    for i in range(60):
        ans += cnt1[i] * (n - cnt1[i]) * pow(2,i,MOD)
    print(ans % MOD)


if __name__=='__main__':
    main()
### BUGGY CODE ###

n = int(input())
s = []
for i in range(n):
    s.append(sorted(str(input())))
r = []
g = []
for i in range(n):
    if(s[i] in r):
        g[r.index(s[i])] += 1
    else:
        r.append(s[i])
        g.append(1)
ans = 0
for i in range(len(g)):
    ans += max(((g[i])*(g[i]-1))//2,0)
print(ans)

### FIXED CODE ###

n = int(input())
s = [str(input()) for _ in range(n)]
e = []
for i in range(n):
    e.append("".join(sorted(s[i])))
e.sort()
g = [1]
for i in range(n-1):
    if e[i] != e[i+1]:
        g.append(1)
    else:
        g[-1] += 1
ans = 0
for i in g:
    ans += (i*(i-1)//2)
print(ans)
### BUGGY CODE ###

k,n=map(int,input().split())
a=list(map(int,input().split()))

d=[]
for i in range(len(a)-1):
    d.append(abs(a[i]-a[i+1]))

d.append(k-a[-1]+a[0])
d+=d[:n-2]
ans=[]
for i in range(n):
    total=sum(d[i:i+n-1])
    ans.append(total)

print(min(ans))  

### FIXED CODE ###

k,n=map(int,input().split())
a=list(map(int,input().split()))

d=[]
for i in range(n-1):
    d.append(a[i+1]-a[i])

d.append(k-a[-1]+a[0])
d=sorted(d,reverse=True)
print(sum(d[1:]))