Harryxun/stf_run huggingface dataset:
import collections
import bisect
n = int(input())
a = list(map(int,input().split()))
A = collections.Counter(a)
Key = []
Val = []
for key,val in A.items():
    Key.append(key)
    Val.append(val)
ans = 0
for i in range(len(Val)):
    ans+= ((Val[i])*(Val[i]-1))//2
for i in range(n):
    s = bisect.bisect_left(Key,a[i])
    d1 = (Val[s]*(Val[s]-1))//2
    Val[s]-=1
    d2 = (Val[s]*(Val[s]-1))//2
    ans1 = ans - (d1-d2)
    print(ans1)
    Val[s]+=1

### FIXED CODE ###

import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

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

#ひとつものぞかず、同じ数のボールをとるのは？
c = collections.Counter(a)
maxa = 0
item = [0 for i in range(max(a))]
for key,value in c.items():
    item[key-1] = value
    maxa += (value)*(value-1)//2
for i in range(len(a)):
    d = (item[a[i]-1])*(item[a[i]-1]-1)//2-(item[a[i]-1]-1)*(item[a[i]-1]-2)//2
    print(maxa-d)
N,K = map(int,input().split())
A = [int(x) for x in input().split()]
l = sum(A)//(N+K)
rem = []
tot = N+K
for i in A:
    tot -= i//l
    if i//l != 0:
        rem.append((i,i%l//(i//l)))
    else: tot -= 1
rem.sort(key=lambda x: x[1],reverse=True)
print((rem[tot][0]+(rem[tot][0]//l)-1)//(rem[tot][0]//l))


### FIXED CODE ###

import math, sys

N,K = map(int,input().split())
A = [int(x) for x in input().split()]
lower = 0
upper = 10**10

while upper - lower > 0.1:
    cuts = 0
    trial = (lower + upper) / 2
    for i in A:
        cuts += math.ceil(i/trial)-1
    if cuts <= K:
        upper = trial
    else:
        lower = trial
ans = math.ceil(lower)
if ans == 0:
    print(1)
    sys.exit()
cuts = 0
for i in A:
    cuts += math.ceil(i / ans) - 1
if cuts <= K: print(ans)
else: print(ans + 1)
row, col, num = map(int, input().split())

tmp_list = []
board = []
for i in range(row):
  str = input()
  for j in range(col):
    if str[j] == '.':
      tmp_list.append(0)
    if str[j] == '#':
      tmp_list.append(1)
  board.append(tmp_list)
  tmp_list = []

onoff = []
bi = [32, 16, 8, 4, 2, 1]
for i in range(64):
  tmp = i
  for j in bi:
    tmp_list.insert(0, int(tmp / j))
    tmp %= j
  onoff.append(tmp_list)
  tmp_list = []

count = 0
ans = 0
for i in range(2**row):
  for j in range(2**col):
    for k in range(row):
      if onoff[i][k] == 1:
        for l in range(col):
          if onoff[j][l] == 1:
            if board[l][k] == 1:
              count += 1
    if count == num:
      ans += 1
    count = 0

print(ans)

### FIXED CODE ###

row, col, num = map(int, input().split())

tmp_l = []
board = []
for i in range(row):
  str = input()
  for j in range(col):
    if str[j] == '.':
      tmp_l.append(0)
    if str[j] == '#':
      tmp_l.append(1)
  board.append(tmp_l)
  tmp_l = []

onoff = []
bi = [32, 16, 8, 4, 2, 1]
for i in range(64):
  tmp = i
  for j in bi:
    tmp_l.insert(0, int(tmp / j))
    tmp %= j
  onoff.append(tmp_l)
  tmp_l = []

count = 0
ans = 0
for i in range(2**row):
  for j in range(2**col):
    for k in range(row):
      if onoff[i][k] == 1:
        for l in range(col):
          if onoff[j][l] == 1:
            if board[k][l] == 1:
              count += 1
    if count == num:
      ans += 1
    count = 0

print(ans)
n, k,*h = map(int, open(0).read().split())
cost = {1: 0, 2: abs(h[2] - h[1])}
for i in range(1, n):
    for di in range(1, k + 1):
        if i + di > n: break
        nc = cost[i] + abs(h[i + di] - h[i])
        if i + di in cost:
            if nc < cost[i + di]:
                cost[i + di] = nc
        else:
            cost[i + di] = nc
print(cost[n])


### FIXED CODE ###

n, k = map(int, input().split())
k = min(n - 1, k)
h = list(map(int, input().split()))
cost = [0 for _ in range(n)]
for i, hi in enumerate(h):
    if i == 0: continue
    st = i - k if i > k else 0
    cost[i] = min([ck + abs(hi - hk) for ck, hk in zip(cost[st:i], h[st:i])])
print(cost[-1])
from fractions import gcd
def lcm(x,y):
  return (x*y) // gcd(x,y)
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
l = a[0]
for i in range(1,n):
  l = lcm(l,a[i])
for i in range(n):
  ans += l//a[i]
print(ans%mod)

### FIXED CODE ###

from fractions import gcd
def lcm(x,y):
  return (x*y) // gcd(x,y)
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
l = a[0]
for i in range(1,n):
  l = lcm(l,a[i])
ans = 0
for i in range(n):
  ans += l//a[i]
print(ans%mod)
N, M = map(int, input().split())
A = list(map(int, input().split()))

def dfs(choices, s, cost, i):
    if i == len(choices):
        return -1
    if cost == 0:
        return int(s)
    if cost < 0:
        return -1
    
    
    tmp1 = dfs(
        choices,
        s + str(choices[i][0]),
        cost - choices[i][1],
        i
    )
    if i+1 == len(choices):
        tmp2 = -1
    else:
        tmp2 = dfs(
            choices,
            s,
            cost,
            i + 1
        )
    
    ret = max(tmp1, tmp2)
    return ret

match = [-100,2,5,5,4,5,6,3,7,6]
choices = []
for i in A:
    choices.append([i, match[i]])

choices.sort(reverse=True)
ans = dfs(choices, '', N, 0)
print(ans)
    
    

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))

import sys
INT_MIN = sys.maxsize * -1
match = [-100,2,5,5,4,5,6,3,7,6]
CHOICES = []
for i in A:
    if (i == 6) and (9 in A):
        continue
    if (i == 3) and (5 in A):
        continue
    if (i == 2) and (3 in A or 5 in A):
        continue
    CHOICES.append([i, match[i]])
CHOICES.sort(reverse=True)

ans = [0]
#print(CHOICES)
for i in range(1,N+1):
    ans.append(INT_MIN)
    for c in CHOICES:
        #if  i - c[1] == 0:
        #    ans[i] = max(ans[i], int(str(c[0])))
        #elif i - c[1] >= 0 and ans[i - c[1]] != INT_MIN:
        #    ans[i] = max(ans[i], int(str(c[0]) + str(ans[i - c[1]])))

        if i - c[1] >= 0 and ans[i - c[1]] != INT_MIN:
            ans[i] = max(ans[i], c[0] + ans[i - c[1]] * 10)

print(ans[N])
s=input()
k=int(input())
a=[]
for i in range(0,len(s)):
    for j in range(1,len(s)+1):
        if i != j:
            if s[i:j] not in a:
                a.append(s[i:j])
a.remove("")
a=sorted(a)
print(a[k-1])


### FIXED CODE ###

s=input()
k=int(input())
a=[s[i:i+j+1] for i in range(len(s)) for j in range(k+1)]
a=set(a)
a=sorted(a)
print(a[k-1])
import sys

input = sys.stdin.readline
#sys.setrecursionlimit(10 ** 6)

N, Q = map(int, input().split())
V = {i: [] for i in range(1, N + 1)}
for _ in range(N - 1):
    a, b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)

C = {i: 0 for i in range(1, N + 1)}

for _ in range(Q):
    p, x = map(int, input().split())
    C[p] += x


def propagate(u, p):
    for v in V[u]:
        if v == p:
            continue
        C[v] += C[u]
        propagate(v, u)


propagate(1, 0)

print(' '.join(str(C[i]) for i in range(1, N + 1)))

### FIXED CODE ###

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

N, Q = map(int, input().split())
V = {i: [] for i in range(1, N + 1)}
for _ in range(N - 1):
    a, b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)

C = {i: 0 for i in range(1, N + 1)}

for _ in range(Q):
    p, x = map(int, input().split())
    C[p] += x


def propagate(u, p):
    for v in V[u]:
        if v == p:
            continue
        C[v] += C[u]
        propagate(v, u)


propagate(1, 0)

print(' '.join(str(C[i]) for i in range(1, N + 1)))
import math

a = list(map(int, input().split()))
a.append(2)
ans = a[0]
N = len(a)
for i in range(1, N):
    ans = ans * a[i] // math.gcd(ans, a[i])
print(ans)

### FIXED CODE ###

a = int(input())

if a % 2 == 0:
    print(a)
else:
    print(2*a)
H,W=map(int,input().split())
prev=0
for i in range(H):
  s=input()
  id = s.index("#")
  if id >= prev:
    flag=False
    for j in range(id,W):
      if flag ans s[j]=="#":
        print("Impossible")
        exit(0)
      if s[j]==".":
        flag=True
print("Possible")
  

### FIXED CODE ###

H,W=map(int,input().split())
prev=0
for i in range(H):
  s=input()
  id = s.index("#")
  if id >= prev:
    flag=False
    prev = W-1 - s[::-1].index("#")
    for j in range(id,W):
      if flag and s[j]=="#":
        print("Impossible")
        exit(0)
      if s[j]==".":
        flag=True
  else:
    print("Impossible")
    exit(0)
print("Possible")
x,k,d=map(int,input().split())
ans=0
if x>k*d:
    ans=(x-k*d)
else:
    temp=k-(n//d)
    if temp %2==0:
        ans=n%d
    else:
        ans=d-n%d
print(ans)


### FIXED CODE ###

x,k,d=map(int,input().split())
ans=0
if abs(x)>k*d:
    ans=(abs(x)-k*d)
else:
    temp=k-(x//d)
    if temp %2==0:
        ans=x%d
    else:
        ans=d-x%d
print(ans)
def warshall_floyd(N, A):
    dist = A.copy()
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if dist[i][j] > dist[i][k] + dist[k][j]:
                    dist[i][j] = dist[i][k] + dist[k][j]
    return dist


def main():
    N = int(input())
    A = [list(map(int, input().split(' '))) for _ in range(N)]
    wf = warshall_floyd(N, A)
    edges = list()
    for i in range(N):
        for j in range(i + 1, N):
            edges.append((A[i][j], i, j))  # (cost, from, to)
    edges.sort(key=lambda e: e[0])
    ans = 0
    for edge in edges:
        cost, from_node, to_node = edge
        if A[from_node][to_node] > wf[from_node][to_node]:
            print(-1)
            return
        to_be_added = True
        for via_node in range(N):
            if via_node in [from_node, to_node]:
                continue
            if wf[from_node][to_node] == wf[from_node][via_node] + wf[via_node][to_node]:
                to_be_added = False
                break
        if to_be_added:
            ans += A[from_node][to_node]
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from scipy.sparse.csgraph import floyd_warshall
import numpy as np


def main():
    INF = 10**12
    N = int(input())
    A = [list(map(int, input().split(' '))) for _ in range(N)]
    wf = floyd_warshall(A)
    for i in range(N):
        A[i][i] = INF
        wf[i][i] = INF
    ans = 0
    for i in range(N):
        for j in range(N):
            if A[i][j] != wf[i][j]:
                print(-1)
                return
            if wf[i][j] < np.min(wf[i] + wf[j]):
                ans += wf[i][j]
    print(int(ans // 2))


if __name__ == '__main__':
    main()
h,a,*m=open(0)
h,w,k,a,b,f,g=map(int,(h+a).split())
I=h*w
d=[I]*I
a=~w+a*w+b
d[a]=1
q=[a]
for s in q:
 for y,x in(1,0),(-1,0),(0,1),(0,-1):
  for z in range(k):
   i,j=s//w+y*~z,s%w+x*~z;t=i*w+j;p=d[s]+1
   if(h>i>-1<j<w)-1or'.'<m[i][j]or d[t]<p:break
   if d[t]=>p:q+=t,;d[t]=p
print(d[~w+f*w+g]%I-1)

### FIXED CODE ###

import sys
inf=1000002
sys.setrecursionlimit(inf)
from collections import deque
h,w,k=map(int,input().split())
x1,y1,x2,y2=map(int,input().split())
c=[input() for i in range(h)]
dp=[[inf if c[i][j]=="." else -1 for j in range(w)] for i in range(h)]
now=deque()
now.append([x1-1,y1-1])
dp[x1-1][y1-1]=0
#kの更新が遅い
def bfs(d):
    global h,w,k,dp,now,x2,y2
    l=len(now)
    if l==0:
        return
    dp_sub=deque()
    cand=set()
    for i in range(l):
        x,y=now.popleft()
        for j in range(1,min(k+1,w-y)):
            if dp[x][y+j]==inf:
                dp_sub.append([x,y+j,d])
                #dp[x][y+j]=d
                cand.add((x,y+j))
                #now.append([x,y+j])
            else:
                break
        for j in range(1,min(k+1,y+1)):
            if dp[x][y-j]==inf:
                dp_sub.append([x,y-j,d])
                #dp[x][y-j]=d
                cand.add((x,y-j))
                #now.append([x,y-j])
            else:
                break
        for j in range(1,min(k+1,h-x)):
            if dp[x+j][y]==inf:
                dp_sub.append([x+j,y,d])
                #dp[x+j][y]=d
                cand.add((x+j,y))
                #now.append([x+j,y])
            else:
                break
        for j in range(1,min(k+1,x+1)):
            if dp[x-j][y]==inf:
                dp_sub.append([x-j,y,d])
                #dp[x-j][y]=d
                cand.add((x-j,y))
                #now.append([x-j,y])
            else:
                break
    while dp_sub!=deque([]):
        e=dp_sub.popleft()
        dp[e[0]][e[1]]=e[2]
    for i in cand:
        now.append(i)
    bfs(d+1)
bfs(1)
print(dp[x2-1][y2-1] if dp[x2-1][y2-1]!=inf else -1)
w, h, x, y, r = map(int(input.split()))
if(x < r or y < r or x + r > w or y + r > h):
    print("No")
else:
    print("Yes")


### FIXED CODE ###

w, h, x, y, r = map(int, input().split())
if(x < r or y < r or x + r > w or y + r > h):
    print("No")
else:
    print("Yes")
O = input()
E = input()
p = ""
for i in range(len(O)):
    p += O[i]
    if(i - 1 < len(E)):
        p += E[i]
print(p)

### FIXED CODE ###

O = input()
E = input()
p = ""
for i in range(len(O)):
    p += O[i]
    if(i < len(E)):
        p += E[i]
print(p)
import math
N, K = input().split()
N = int(N)
K = int(K)
def P(n, r):
  return math.factorial(n)//math.factorial(n-r)
def C(n, r):
  return P(n, r)//math.factorial(r)
for i in range(K):
  ans= (C(K-1,i)*C(N-K+1,i+1))%(10**9+7)
  print(ans)

### FIXED CODE ###

import math
N, K = input().split()
N = int(N)
K = int(K)
def P(n, r):
  return math.factorial(n)//math.factorial(n-r)
def C(n, r):
  return P(n, r)//math.factorial(r)
for i in range(1,K+1):
  if N-K+1<i:
    print(0)
  else:
  	ans= (C(K-1,i-1)*C(N-K+1,i))%(10**9+7)
  	print(ans)
import sys
     
    args = list(map(int, input().split()))

    if (args[0] < args[1] and args[1] < args[2]) or (args[2] < args[1] and args[1] < args[0]):
        print("yes")
    else:
        print("no")

### FIXED CODE ###

import sys
         
args = list(map(int, input().split()))
             
if (args[0] < args[2] and args[2] < args[1]) or (args[1] < args[2] and args[2] < args[0]):
    print("Yes")
else:
    print("No")
s = intput()

if ('7' in s):
  print('Yes')

### FIXED CODE ###

s = input()

if '7' in s:
  print('Yes')
else:
  print('No')
S = input()
T = input()
judge = 0
for i in range(len(S)):
  if S[i] !== T[i]:
    judge = 1
    break
if judge == 1:
  print("No")
else:
  print("Yes")


### FIXED CODE ###

S = input()
T = input()
judge = 0
for i in range(len(S)):
  if S[i] != T[i]:
    judge = 1
    break
if judge == 1:
  print("No")
else:
  print("Yes")
import numpy as np
h,w,m = map(int,input().split())
bomb = list(tuple(map(lambda x: int(x)-1,input().split())) for i in range(m))
Map= np.zeros((h,w))
for i in bomb:
    Map[i] = 1
bombx = np.count_nonzero(Map,axis=1)
bomby = np.count_nonzero(Map,axis=0)
maxx = max(bombx)
maxy = max(bomby)
maxx_index = np.where(bombx == maxx)
maxy_index = np.where(bomby == maxy)
flag = 0
for i in maxx_index[0]:
    for j in maxy_index[0]:
        if Map[i][j] == 0:
            print(maxx+maxy)
            exit()
print(maxx+maxy-1)


### FIXED CODE ###

h,w,m = map(int,input().split())
bombX = [0]*h
bombY = [0]*w
bomb = set()
maxX = maxY = 0
for i in range(m):
    i,j = map(lambda x:int(x)-1, input().split())
    bomb.add((i,j))
    bombX[i] += 1
    bombY[j] += 1
    maxX = max(maxX,bombX[i])
    maxY = max(maxY,bombY[j])
maxX_index = list(i for i in range(h) if bombX[i] == maxX)
maxY_index = list(i for i in range(w) if bombY[i] == maxY)
for i in maxX_index:
    for j in maxY_index:
        if (i,j) in bomb: continue
        print(maxX+maxY)
        exit()
print(maxX+maxY-1)
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

import re
# import numpy as np
from scipy.misc import comb

# 再帰がやばいとき
# import sys
# sys.setrecursionlimit(10**9)

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e30)
MOD = int(1e9)+7 # 10^9 + 7

# field[H][W]
def create_grid(H, W, value = 0):
    return [[ value for _ in range(W)] for _ in range(H)]

########

def main():
    N = i_inpl()
    s = defaultdict(int)
    for _ in range(N):
        si = tuple(sorted(input()))
        s[si] += 1

    from functools import lru_cache

    @lru_cache(maxsize=1000)
    def c(n,k): 
        return 1 if(k<=0 or n<=k) else ( c(n-1, k-1) + c(n-1, k) ) %4

    ans = 0
    for i in s.values():
        if i == 1:
            continue
        ans += c(i, 2)
    
    print(int(ans))

if __name__ == "__main__":
    main()


### FIXED CODE ###

import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

import re
# import numpy as np
from scipy.misc import comb

# 再帰がやばいとき
# import sys
# sys.setrecursionlimit(10**9)

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e30)
MOD = int(1e9)+7 # 10^9 + 7

# field[H][W]
def create_grid(H, W, value = 0):
    return [[ value for _ in range(W)] for _ in range(H)]

########

def main():
    N = i_inpl()
    s = defaultdict(int)
    ans = 0
    for _ in range(N):
        si = tuple(sorted(input()))
        s[si] = s[si] +1

    for i in s.values():
        if i > 1:
            ans += 1/2 * (i-1)*i
    print(int(ans))
if __name__ == "__main__":
    main()
x,a,b=map(int,input().split())
if min(abs(x-a)>abs(x-b)):
  print("A")
else:
  print("B")
    

### FIXED CODE ###

x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
      print("A")
else:
      print("B")
import numpy as np

N = int(input())
res = 0
p = list(map(int, input().split()))
p_a = np.array(p, dtype = np.int64)
for i in range(N):
    mini = np.min(p_a[:(i+1)])
    if mini >= p[i]:
        res += 1    
print(res)

### FIXED CODE ###

N = int(input())
res = 0
p = list(map(int, input().split()))
mini = p[0]
for i in range(N):
    mini = min(mini, p[i])
    if mini >= p[i]:
        res += 1    
print(res)
d, n = map(int, input.split())
print((100**d)*n)

### FIXED CODE ###

d, n = map(int, input().split())
if n <= 99:
    print((100**d)*n)
elif n == 100:#このとき100で割れる回数が増えるので例外
    print((100**d)*101)
N = input()
 
org_sum = 1/2 * N * (N+1)
div3 = N // 3
sum3 = 3/2 * div3 * (div3+1)
div5 = N // 5
sum5 = 5/2 * div5 * (div5+1)
div15 = N // 15
sum15 = 15/2 * div15 * (div15+1)
 
return org_sum - sum3 - sum5 + sum15

### FIXED CODE ###

N = int(input())
 
org_sum = 1 * N * (N+1) // 2
div3 = N // 3
sum3 = 3 * div3 * (div3+1) //2
div5 = N // 5
sum5 = 5 * div5 * (div5+1) // 2
div15 = N // 15
sum15 = 15 * div15 * (div15+1) // 2
 
print(org_sum - sum3 - sum5 + sum15)
#coding: utf-8
N, M = map(int, input().split())
points = list(map(int, input().split()))
points.sort()
koma = [points[i+1] - points[i] for i in range(M-1)]
for _ in range(N-1):
  koma.remove(max(koma))
print(sum(koma))

### FIXED CODE ###

#coding: utf-8
N, M = map(int, input().split())
points = list(map(int, input().split()))
if N > M:
  print(0)
else:
  points.sort()
  koma = [points[i+1] - points[i] for i in range(M-1)]
  koma.sort()
  print(sum(koma[:M-N]))
S = map(int, input().split())

flag = 0;

for i in range(1, 3):
    if S[i-1] = S[i] :
        flag = 1

res = "Good" if flag==0 else "Bad"

print(res)

### FIXED CODE ###

S = input()

flag = 0;

for i in range(1, 4):
    if S[i-1] == S[i] :
        flag = 1

res = "Good" if flag==0 else "Bad"

print(res)
d=[0]*13
d[0]=1
mul=1
mulmod=1
t=input()[::-1]
mod=10**9+7
zero=[0]*13
l=len(t)
for n,c in enumerate(t):
    e=zero[:]
    if c=="?":
        for i in range(10):
            for j in range(13):
                k=(i*mulmod+j)%13
                e[k]+=d[j]
                e[k]%=mod
    else:
        for j in range(13):
            k=(i*mulmod+int(c)%13
            e[k]+=d[j]
            e[k]%=mod
    d=e
    mul*=10
    mulmod=mul%13
print(d[5])


### FIXED CODE ###

# coding: utf-8
# Your code here!
 
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意
 
s = input()
l = len(s)
MOD = 10**9+7
 
dp = [0]*13
dp[0] = 1
for i in s:
    new = [0]*13
    if i == "?":
        for i in range(10):
            for j in range(13):
                new[(10*j+i)%13] += dp[j]
    else:
        i = int(i)
        for j in range(13):
            new[(i+10*j)%13] += dp[j]
    
    for i in range(13):
        new[i] %= MOD
    dp,new = new,dp
#    print(dp)
 
print(dp[5]%MOD)
dp=[0]*N
dp[1]=abs(h[1]-h[0])
for i in range(N):
  dp[i+2]=min(dp[i+1]+abs(h[i+2]-h[i+1]),dp[i]+abs(h[i+2]-h[i]))

print(dp[N])

### FIXED CODE ###

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

dp=[0]*N
dp[1]=abs(h[1]-h[0])
for i in range(N-2):
  dp[i+2]=min(dp[i+1]+abs(h[i+2]-h[i+1]),dp[i]+abs(h[i+2]-h[i]))

print(dp[N-1])
import sys
input = sys.stdin.readline
from operator import itemgetter

N, M = map(int,input().split())
work_list = [[] for j in range(M+1)]
for i in range(N):
    temp = list(map(int,input().split()))
    if temp[0] > M:
        continue
    work_list[temp[0]].append(temp[1])

sum = 0
works = []

for i in work_list:
    for j in i:
        heappush(works, -1*j)
    if len(works) == 0:
        continue
    sum -= (heappop(Q))

print(sum)


### FIXED CODE ###

import sys
input = sys.stdin.readline
from heapq import heappop, heappush

N, M = map(int,input().split())
work_list = [[] for j in range(M+1)]
for i in range(N):
    temp = list(map(int,input().split()))
    if temp[0] > M:
        continue
    work_list[temp[0]].append(temp[1])

sum = 0
works = []

for i in work_list:
    for j in i:
        heappush(works, -1*j)
    if len(works) == 0:
        continue
    sum -= (heappop(works))

print(sum)
import sys
import math
 
#file = open("test.txt")
file = sys.stdin
 
r = int(file.readline())
l = 2*math.pi*r
s = math.pi*r*r
 
print("%.6f %.6f"%(s, l))

sys.exit(0)

### FIXED CODE ###

# Python 3+
import sys
import math

#file = open("test.txt")
file = sys.stdin

r = float(file.readline())
l = 2*math.pi*r
s = math.pi*r*r

print("{0:.6f} {1:.6f}".format(s, l))
N = int(input())
if N%2:
  print("0")
else:
  ans = 0
  i = 1
  while True:
    ans += N // (10*i)
    i *= 5
    if i > N:break
      
print(ans)

### FIXED CODE ###

N = int(input())

if N%2:
  print("0")
else:
  ans = 0
  i = 1
  while True:
    ans += N // (10*i)
    i *= 5
    if i > N:break
  print(ans)
input = int(input())
a = []
while(i <= input):
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        a.append(i)
    i += 1
sum = 0
for j in a:
    sum = sum + a[j]
print(sum)



### FIXED CODE ###

input = int(input())
list = [int(x) for x in str(input)]
count = 0
for x in list:
  if x == 7:
    count = count + 1
if count >= 1:
  print("Yes")
else:
  print("No")