Harryxun/stf_run huggingface dataset:
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
p = [1]
mod = 10**9+7
for i in range(n):
    p.append(p[-1]*(i+2)%mod)
def comb(n,k,mod):
    s = p[n-1]*pow(fac(k),mod-2,mod)%mod
    s = s*pow(fac(n-k),mod-2,mod)%mod
    return s
max_sum = 0
min_sum = 0
for i in range(n-k+1):
    max_sum += a[-(i+1)]*comb(n-1-i,k-1,mod)
    max_sum = max_sum%mod
    min_sum += a[i]*comb(n-1-i,k-1,mod)
    min_sum = min_sum%mod
ans = max_sum-min_sum
if ans < 0:
    ans += mod
print(ans)

### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
p = [1]
mod = 10**9+7
for i in range(n):
    p.append(p[-1]*(i+1)%mod)
p.pop()
def comb(n,k,mod):
    s = p[n]*pow(p[k],mod-2,mod)%mod
    s = s*pow(p[n-k],mod-2,mod)%mod
    return s
max_sum = 0
min_sum = 0
for i in range(n-k+1):
    max_sum += a[-(i+1)]*comb(n-1-i,k-1,mod)
    max_sum = max_sum%mod
    min_sum += a[i]*comb(n-1-i,k-1,mod)
    min_sum = min_sum%mod
ans = max_sum-min_sum
if ans < 0:
    ans += mod
print(ans)
S = input()
T = input()
s1 = list(S)
t1 = list(T)
a = len(s1); b = len(t1)
z = []
for i in range(a-b):
    x = []
    y = 0
    for j in range(b):
        x.append(s1[i+j])
    for k in range(b):
        if t1[k]==x[k]:
            y += 1
    z.append(y)
print(b-max(z))

### FIXED CODE ###

S = input()
T = input()
s1 = list(S)
t1 = list(T)
a = len(s1); b = len(t1)
z = []
for i in range(a-b+1):
    x = []
    y = 0
    for j in range(b):
        x.append(s1[i+j])
    for k in range(b):
        if t1[k]==x[k]:
            y += 1
    z.append(y)
print(b-max(z))
A,B = map(int, input().strip())
print((A+B)%24)

### FIXED CODE ###

A,B = map(int, input().strip().split(' '))
print((A+B)%24)
import sys
input=sys.stdin.readline
N=input()
if N<=9:
  print(N)
elif N<=99:
  print(10)
elif N<=999:
  print(9+(N-99))
elif N<=9999:
  print(909)
elif N<=99999:
  print(909+(N-9999))
else:
  print(90909)

### FIXED CODE ###

import sys
input=sys.stdin.readline
N=int(input())
ans=0
if N<=9:
  ans=N
elif 10<=N<=99:
  ans=9
elif 100<=N<=999:
  ans=9+(N-99)
elif 1000<=N<=9999:
  ans=909
elif 10000<=N<=99999:
  ans=909+(N-9999)
else:
  ans=90909
print(ans)
n = int(input())
s = input()

if n % 2 == 1:
    print("No")
else:
    s_1 = s[:int(len(s)/2)]
    s_2 = s[int(len(s)/2):n]

    if s_1 != s_2:
        print("No")
    else:
        print("Yes")

### FIXED CODE ###

a = int(input())
print(a**2)
n=int(input())
v=map(int,input().split())
vodd=[]
voddNum={}
veven=[]
vevenNum={}
for i,vi in enumerate(v):
    if i%2:
        veven.append(vi)
        if(vi in vevenNum):
            vevenNum[vi]+=1
        else:
            vevenNum[vi]=1
    else:
        vodd.append(vi)
        if(vi in voddNum):
            voddNum[vi]+=1
        else:
            voddNum[vi]=1
vevenNum=list(vevenNum.items())
voddNum=list(voddNum.items())
vevenNum.sort(key=lambda x:x[1])
vevenNum.reverse()
voddNum.sort(key=lambda x:x[1])
voddNum.reverse()
if len(vevenNum)==2 & len(voddNum)==2:
    if vevenNum[0][0]==voddNum[0][0]:
        a=vevenNum[0][1]+voddNum[1][1]
        b=vevenNum[1][1]+voddNum[0][1]
        changeCnt=a if a<b else b
    else:
        changeCnt=vevenNum[1][1]+voddNum[1][1]
elif len(vevenNum)==1 & len(voddNum)==1:
    if vevenNum[0][0]==voddNum[0][0]:
        changeCnt=voddNum[0][1] if voddNum[0][1]<vevenNum[0][1] else vevenNum[0][1]
    else:
        changeCnt=0
elif len(vevenNum)==1:
    if vevenNum[0][0]==voddNum[0][0]:
        changeCnt=voddNum[0][1]
    else:
        changeCnt=voddNum[1][1]
elif len(voddNum)==1:
    if vevenNum[0][0]==voddNum[0][0]:
        changeCnt=vevenNum[0][1]
    else:
        changeCnt=vevenNum[1][1]

print(changeCnt)

### FIXED CODE ###

n=int(input())
v=map(int,input().split())
vodd={-1:0}
veven={-1:0}
for i,vi in enumerate(v):
    if i%2:
        if(vi in veven):
            veven[vi]+=1
        else:
            veven[vi]=1
    else:
        if(vi in vodd):
            vodd[vi]+=1
        else:
            vodd[vi]=1
veven=list(veven.items())
veven.sort(key=lambda x:-x[1])
vodd=list(vodd.items())
vodd.sort(key=lambda x:-x[1])
if veven[0][0]==vodd[0][0]:
    a=veven[0][1]+vodd[1][1]
    b=veven[1][1]+vodd[0][1]
    changeCnt=n-a if a>b else n-b
else:
    changeCnt=n-veven[0][1]-vodd[0][1]

print(changeCnt)
CAKE = 4
DOUNAT = 7

def check_amount(i, j, n):
    return i*4 + j*7 == n

n = int(input())
count = 0
for i in range(int(n/CAKE+1)):
    for j in range(int(n/DOUNAT+1)):
        if check_amount(i, j, n):
            print('Yes')
            sys.exit()
print('No')

### FIXED CODE ###

import sys


CAKE = 4
DOUNAT = 7


def check_amount(i, j, n):
    return i*4 + j*7 == n


n = int(input())
count = 0
for i in range(int(n/CAKE+1)):
    for j in range(int(n/DOUNAT+1)):
        if check_amount(i, j, n):
            print('Yes')
            sys.exit()
print('No')
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
q=[0]*9*M
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=[b]
for i in v[:M]:
	for j in i:heappush(q,-j)
	z-=heappop(q)
print(z)

### FIXED CODE ###

from heapq import*
N,M,*t=map(int,open(0).read().split())
v=[[]for _ in range(M)]
for i in range(N):
	if t[2*i]<=M:
		v[t[2*i]-1].append(t[2*i+1])
z=0
q=[]
for i in range(M):
	for j in v[i]:
		heappush(q,-j)
	b=0
	if len(q):
		b=heappop(q)
	z-=b
print(z)
N, M = map(int, input().split())
p = [0] * M
S = [0] * M
count_AC = [0] * N
count_WA = [0] * N
for i in range(M):
    p[i],S[i] =  input().split()
    p[i] = int(p[i])

    if S[i] == 'AC':
        if count_AC[p[i]] == 0:
            count_AC[p[i]] = 1
            
    if S[i] == 'WA':
        if count_AC[p[i]] == 0:
            count_WA[p[i]] += 1
            
print(sum(count_AC) , sum(count_WA))

### FIXED CODE ###

N, M = map(int, input().split())
p = [0] * M
S = [0] * M
count_AC = [0] * N
count_WA = [0] * N
for i in range(M):
    p[i],S[i] =  input().split()
    p[i] = int(p[i]) - 1

    if S[i] == 'AC':
        if count_AC[p[i]] == 0:
            count_AC[p[i]] = 1
            
    if S[i] == 'WA':
        if count_AC[p[i]] == 0:
            count_WA[p[i]] = count_WA[p[i]] + 1
            
print(sum(count_AC) , sum([x * y for (x, y) in zip(count_AC, count_WA)]))
b = int(input())
print("A" if b == T else "T" if b == A else
      "C" if b == G else "T")

### FIXED CODE ###

b = input()
print("A" if b == "T" else "T" if b == "A" else
      "C" if b == "G" else "G")
N = int(sys.stdin.readline().rstrip())
h = map(int, sys.stdin.readline().rstrip().split())

L = len(h)
if L == 0:
  ans = 0
elif L < 1:
  ans = N - h[0]
elif L < 2:
  ans = N - max(h)
  
else:
  grad1 = h[0] > h[1]
  if grad1:
    p = [h[0]]
  else:
    p = []
    
  v = []
  for n in range(2, L):
    grad2 = h[n-1] > h[n] 
    if grad1 == grad2:
      continue
    elif grad2:
      p.append(h[n-1])
    else:
      v.append(h[n-1])
    grad1 = grad2
               
  if not grad1:
    p.append(h[n])
 
ans = sum(p) - sum(v)
print(ans)

### FIXED CODE ###

import sys
L = int(sys.stdin.readline().rstrip())
 
h = list(map(int, sys.stdin.readline().rstrip().split()))
 
if L == 0:
  ans = 0
elif L == 1:
  ans = h[0]
elif L == 2:
  ans = max(h)
  
else:
  grad1 = h[0] > h[1]
  p= 0
  v= 0
  if grad1:
    p += h[0]
 
  for n in range(2, L):
    grad2 = h[n-1] > h[n] 
    if grad1 == grad2:
      continue
    elif grad2:
      p += h[n-1]
    else:
      v += h[n-1]
    grad1 = grad2
               
  if not grad1:
    p += h[n]
 
  ans = p - v
print(ans)
(s,t)=input().split()
a=input()
(n,m)=list(map(int,a))
u=input()
if u==s:
  print(n-1,m)
elif u==t:
  print(n,m-1)


### FIXED CODE ###

(s, t) = input().split()
a = input().split()
(n, m) = list(map(int, a))
u = input()
if u == s:
    print(n - 1, m)
elif u == t:
    print(n, m - 1)
from collections import *
n=int(input())
x=[0]*n
y=[0]*n
for i in range(n):
  x[i],y[i]=map(int,input().split())
a=[]
for i in range(n):
  for j in range(i+1,n):
    a+=[(x[i]-x[j],y[i]-y[j])]
print(n-max(list(Counter(a).values())))

### FIXED CODE ###

from collections import *
n=int(input())
x=[0]*n
y=[0]*n
for i in range(n):
  x[i],y[i]=map(int,input().split())
a=[]
for i in range(n):
  for j in range(n):
    if i==j:continue
    a+=[(x[i]-x[j],y[i]-y[j])]
c=list(Counter(a).values())
print(n-max(c) if c else n)
# 入力をintにして変数に格納
a, b, c, k = map(int, input().split())

# KとA,Bの大きさに応じて場合分けして最大値計算
if( a+b >= k ):
    max = k

elif( a+b <= k ):
    max = a - ( k - a - b )

# 結果を出力
print(max)

### FIXED CODE ###

s = input()

t = input()

str = s + t[-1]

if str == t:
  print('Yes')
  
else :
  print('No')
# https://atcoder.jp/contests/agc018/tasks/agc018_a
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


from math import gcd
N, K = read_ints()
A = read_ints()
# 結論からいうとKがminとmaxの間でかつ、gcd(A)の倍数であるならば、必ずKを構成することができる。
# ∵ある2要素a,bからはgcd(a,b)の倍数しか作ることができない。これをすべての要素に適応するだけ。

g = 0  # gcdの単位元
for a in A:
    g = gcd(g, a)

if min(A) <= K <= max(A) and K % g == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


### FIXED CODE ###

# https://atcoder.jp/contests/agc018/tasks/agc018_a
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


from fractions import gcd
N, K = read_ints()
A = read_ints()
# 結論からいうとKがminとmaxの間でかつ、gcd(A)の倍数であるならば、必ずKを構成することができる。
# ∵ある2要素a,bからはgcd(a,b)の倍数しか作ることができない。これをすべての要素に適応するだけ。

g = 0  # gcdの単位元
for a in A:
    g = gcd(g, a)

if min(A) <= K <= max(A) and K % g == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
import numpy as np
n=int(input())
ans = n-1
for i in range(int(np.sqrt(n))+1):
  if n % i == 0:
    ans = min(ans, i + n/i -2)
print(ans)

### FIXED CODE ###

import numpy as np
n=int(input())
ans = n-1
for i in range(1,int(np.sqrt(n))+1):
  if n % i == 0:
    ans = min(ans, i + n/i -2)
print(int(ans))
#!/usr/bin/env python
# coding: utf-8
import math

def main():
	r = int(raw_input())
	print round(math.pi * (r ** 2), 5), round(math.pi * 2 * r, 5)

if __name__ == '__main__':
	main()

### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8
import math

def main():
	r = float(raw_input())
	print "%.6f %.6f" % (math.pi * r * r, math.pi * 2 * r)

if __name__ == '__main__':
	main()
import math
k=input()
a=1
b=1
c=1
s=0
for p in range(k):
  b=1
  for q in range(k):
    c=1
    for i in range(k):
      g=math.gcd(a,b)
      g=math.gcd(g,c)
      s=s+g
      c=c+1
    b=b+1
  a=a+1
print(s)

### FIXED CODE ###

import math
k=int(input())
s=0
for p in range(k):
  for q in range(k):
    g=math.gcd(p+1,q+1)
    for i in range(k):
      r=math.gcd(g,i+1)
      s=s+r
print(s)
moji=list(str(input()))
ans=""
for i in range(len(moji)):
  if i%2==0:
    ans+=lst[i]
print(ans)

### FIXED CODE ###

moji=list(str(input()))
ans=""
for i in range(len(moji)):
  if i%2==0:
    ans+=moji[i]
print(ans)
N = input()
K = input ()
A = int(N)
B = int(K)
j = 0
for i in range(1,A+1):
    n = input()
    a = int(n)
    if a >= B:
        j += 1
    else: continue
print(j)


### FIXED CODE ###

N,K=map(int,input().split())
count = 0
for i in range(1,N+1):
    h = list(map(int,input().split()))
    for j in h:
        if j >= K:
            count += 1
        else: continue
    break
print(count)
n = int(input())
a = list(map(int,input().split()))

mod= 10**9+7

A = sum(a)

ans=0

for i in a:
  A -= i
  A%=mod
  ans += A*x
  ans%=mod
print(ans)
  


### FIXED CODE ###

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

mod= 10**9+7

A = sum(a)

ans=0

for i in a:
  A -= i
  A%=mod
  ans += A*i
  ans%=mod
print(ans)
import math

A,B,C,D = map(int,input().split())
total = B - A + 1

num = math.gcd(C,D)
if num != 0:
    tmp = (C * D) // num
else:
    tmp = C*D


C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total+D_total-tmp_total
print(total-cnt)

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)


A,B,C,D = map(int,input().split())
total = B - A + 1

tmp = lcm(C,D) 


C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total + D_total - tmp_total
print(total-cnt)
x,k,d = list(map(int,input().split()))

xi = abs(x)
if abs(x) > d*k:
  m = min(abs(x+d*k),abs(x-d*k))
else:
  for _ in range(k):
    xi -= d
    if xi < 0:
      m = min(abs(xi),abs(xi+d),abs(xi-d))
      break
print(m)

### FIXED CODE ###

from math import ceil 
x,k,d = list(map(int,input().split()))

xi = abs(x)
if abs(x) > d*k:
  m = min(abs(x+d*k),abs(x-d*k))
else:
  n = ceil(xi / d)
  if (n+k) % 2 == 0:
    m = abs(xi-d*n)
  else:
    m = abs(xi-d*(n-1))
print(m)
i = list(input().split(' ')).map(lambda x:int(x)
x,y,z = i
a =x+y+z
if a%3 is 0:


### FIXED CODE ###

i = sorted(list(map(lambda x:int(x),list(input().split(' ')))))
if i[2] == i[1]+i[0]:
  print('Yes')
else:
  print('No')
import math


I = input().split()
A = int(I[0])
#hour hand length cm
B = int(I[1])
#minute hand length cm
H = int(I[2])
#hours
M = int(I[3])
#key?
#mins

tha = 30*H 
thb = 6*M
diff= (math.pi/180)*(tha-thb)

#(theta, radius)
d = math.sqrt(A**2 + B**2 - 2*A*B*(math.cos((diff))))


print(d)


### FIXED CODE ###


N = int(input())

if (N % 100) % 10 == 2 or (N % 100) % 10 == 4 or (N % 100) % 10 == 5 or (N % 100) % 10 ==7 or (N % 100) % 10 ==9:
    print("hon")
elif (N % 100) % 10 == 0 or (N % 100) % 10 ==1 or (N % 100) % 10 ==6 or (N % 100) % 10 ==8:
    print("pon")
elif (N%100)%10 == 3:
    print("bon")
a = int(raw_input())
b = int(raw_input())

if a > b:
	print("Alice")
elif a < b:
	print("Bob")
else:
	print("Draw")

### FIXED CODE ###

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

if a == 1:
	a = 14

if b == 1:
	b = 14

if a > b:
	print "Alice"
elif a < b:
	print "Bob"
else:
	print "Draw"
S-input()
S.sort()
if S=='abc':
  print('Yes')
else:
  print('No')

### FIXED CODE ###

S=input()
L=''.join(sorted(S))
if L=='abc':
  print('Yes')
else:
  print('No')
def is_bool(x):
	return isinstance(x,int) and bool(1 <= x) and bool(x <= 10000)

def checker(a, b):
	if is_bool(a) and is_bool(b):
		if (a * b) % 2 == 0:
			return 'Even'
		else:
			return 'Odd'

if __name__ == '__main__':
	i = list(input().split())
	print(checker(int(i[1]), int(i[2])))

### FIXED CODE ###

a, b = map(int, input().split())
if (a * b) % 2 == 0:
    print('Even')
else:
    print('Odd')
from collections import deque

def solve(top, sa, sb, sc):
  if len(s[top]) == 0:
    return top.upper()
  top = s[top].popleft()
  return solve(top, sa, sb, sc)
  
s = {}
s['a'] = deque(input())
s['b'] = deque(input())
s['c'] = deque(input())

top = s['a'].popleft()
print(solve(top, sa, sb, sc))


### FIXED CODE ###

from collections import deque

def solve(top, sa, sb, sc):
  if len(s[top]) == 0:
    return top.upper()
  top = s[top].popleft()
  return solve(top, sa, sb, sc)
  
s = {}
s['a'] = deque(input())
s['b'] = deque(input())
s['c'] = deque(input())

top = s['a'].popleft()
print(solve(top, s['a'], s['b'], s['c']))
import math

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

left_gcds = [math.gcd(As[0], As[0])]
for i in range(1, len(As)):
    left_gcds.append(math.gcd(left_gcds[i-1], As[i]))

right_gcds = [math.gcd(As[-1], As[-1])]
for i in reversed(range(len(As)-1)):
    right_gcds.append(math.gcd(right_gcds[i-1], As[i]))
right_gcds.reverse()

gcds = []
for i in range(N):
    if i == 0:
        gcds.append(right_gcds[1])
    elif i == N-1:
        gcds.append(left_gcds[-2])
    else:
        gcds.append(math.gcd(left_gcds[i-1], right_gcds[i+1]))
print(max(gcds))

### FIXED CODE ###

import sys
if sys.version_info.minor >= 5:
    from math import gcd
else:
    from fractions import gcd



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

left_gcds = [gcd(As[0], As[0])]
for i in range(1, len(As)):
    left_gcds.append(gcd(left_gcds[i-1], As[i]))

right_gcds = [gcd(As[-1], As[-1])]
for i in range(1, len(As)):
    right_gcds.append(gcd(right_gcds[i-1], As[-(i+1)]))
right_gcds.reverse()

gcds = []
for i in range(N):
    if i == 0:
        gcds.append(right_gcds[1])
    elif i == N-1:
        gcds.append(left_gcds[-2])
    else:
        gcds.append(gcd(left_gcds[i-1], right_gcds[i+1]))
print(max(gcds))
from collections import defaultdict
# your code goes here


v=defaultdict(list)
n,m=map(int,input().split())
for i in range(m):
    a,b=map(int,input().split())
    v[a-1].append(b-1)
    v[b-1].append(a-1)
    

	
	
	
    
    
vis=[0]*n

def dfs(node):
    vis[node]=1
    for j in v[node]:
        #print(j,v[node])
        if vis[j]==0:
            a.append(j+1)
            dfs(j)
ans=0      
for i in range(n):
    if vis[i]==0:
        a=[i]
        dfs(i)
        ans=max(ans,len(a))
    

print(ans)

### FIXED CODE ###

from collections import defaultdict
# your code goes here
from heapq import heappop ,heappush
def bfs(k):
    
    q=[k]
    vis[k]=1
    #p.append(k+1)
    while len(q):
        
        
        curr=heappop(q)
        p.append(curr+1)
        #print(vis, v[curr+1])
        for c in v[curr+1]:
            #print(c)
            if vis[c-1]==0:
                a.append(c)
                
                heappush(q,c-1)
                vis[c-1]=1
            
    
n,m=map(int,input().split())
v=defaultdict(list)
vis=[0]*n
p=[]

for i in range(m):
    a,b=map(int,input().split())
    v[a].append(b)
    v[b].append(a)
ans=0      
for i in range(n):
    if vis[i]==0:
        a=[i+1]
        bfs(i)
        ans=max(ans,len(a))
        #print(a)
    

print(ans)
h, w = map(int, input().split())
grid = []
for _ in range(h):
    grid.append(list(input()))
res = 0
for i in range(h):
    for j in range(w):
        if grid[i][j] != '.':
            continue
        visited = [[False for _ in range(w)] for _ in range(h)]
        visited[h][w] = True
        queue = [(i, j, 0)]
        while queue:
            c_i, c_j, level = queue.pop(0)
#             visited.append((c_i, c_j))
            for n_i, n_j in ((c_i - 1, c_j), (c_i + 1, c_j), (c_i, c_j - 1), (c_i, c_j + 1)):
                if 0 <= n_i < h and 0 <= n_j < w and grid[n_i][n_j] == '.' and visited[n_i][n_j] == False:
                    queue.append((n_i, n_j, level + 1))
                    visited[n_i][n_j] = True
        res = max(res, level)
print(res)        

### FIXED CODE ###

h, w = map(int, input().split())
grid = []
for _ in range(h):
    grid.append(list(input()))
res = 0
for i in range(h):
    for j in range(w):
        if grid[i][j] != '.':
            continue
        visited = [[False for _ in range(w)] for _ in range(h)]
        visited[i][j] = True
        queue = [(i, j, 0)]
        while queue:
            c_i, c_j, level = queue.pop(0)
#             visited.append((c_i, c_j))
            for n_i, n_j in ((c_i - 1, c_j), (c_i + 1, c_j), (c_i, c_j - 1), (c_i, c_j + 1)):
                if 0 <= n_i < h and 0 <= n_j < w and grid[n_i][n_j] == '.' and visited[n_i][n_j] == False:
                    queue.append((n_i, n_j, level + 1))
                    visited[n_i][n_j] = True
        res = max(res, level)
print(res)
S=list(map(input().split()))
print(S.count("1"))

### FIXED CODE ###

s=input()
print(s.count("1"))
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return long(a/gcd(a,b)*b)
    
n = int(input())
ans=1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)

### FIXED CODE ###

n = int(raw_input())

def gcd(a,b):
    if a > b:
        a,b = b,a
    # a <= b
    while a > 0:
        a,b = b%a, a
    return b

def lcm(a,b):
    g = gcd(a,b)
    return a/g * b

x = 1
for i in range(n):
    ti = int(raw_input())
    x = lcm(x, ti)

print x
from operator import mul
from functools import reduce
import sys
input = sys.stdin.readline


def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


def main():
    N, K = map(int, input().split())

    for i in range(1, K+1):
        # a: 青いボールを i グループに分割する組合せ
        a = cmb(K-1, i-1)
        # b: 各グループを赤いボールの間(端もOK)に挿入する組合せ
        b = cmb(N-K+1, i)

        print(a*b % 1000000007)

 
if __name__ == '__main__':
    main()


### FIXED CODE ###

from operator import mul
from functools import reduce
import sys
input = sys.stdin.readline


def cmb(n,r):
    r = min(n-r,r)
    if r < 0: return 0
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


def main():
    N, K = map(int, input().split())

    for i in range(1, K+1):
        # a: 青いボールを i グループに分割する組合せ
        a = cmb(K-1, i-1)
        # b: 各グループを赤いボールの間(端もOK)に挿入する組合せ
        b = cmb(N-K+1, i)

        print(a*b % 1000000007)

 
if __name__ == '__main__':
    main()
N,M=map(int,input().split())
A=list(input() for _ in range(N))
B=list(input() for _ in range(M))
ans="No"
for y in range(N-M+1):
    for x in range(N-M+1):
        if A[y][x]==B[0][0]:
            cond=True
            for i in range(N-M):
                if A[y+i][x:x+M]!=B[i]:
                    cond=False
                    break
            if cond:
                ans="Yes"
print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
A=list(input() for _ in range(N))
B=list(input() for _ in range(M))
ans="No"
for y in range(N-M+1):
    for x in range(N-M+1):
        if A[y][x:x+M]==B[0]:
            cond=True
            for i in range(M):
                if A[y+i][x:x+M]!=B[i]:
                    cond=False
                    break
            if cond:
                ans="Yes"
                break
    if ans=="Yes":
        break
print(ans)
s = str(input())
t= str(input())

sdict = {}
for i in range(len(s)):
    if s[i] not in sdict:
        sdict[s[i]]=[]
    sdict[s[i]].append(i+1)
    
#print(sdict)

#二分木探索
def search(list_,mark_,sta,gol):
    if  sta == gol:
            return list_[sta]
    else:
            mid = (gol-sta)//2
            if list_[mid]>mark_:
                return search(list_,mark_,sta,mid)
            else:
                return search(list_,mark_,mid+1,gol)

ans = 0
mark = 0
for _ in range(len(t)):
    target = t[_]
    if target not in sdict:
        ans = -1
        break
    else:
        if sdict[target][-1]<=mark:
            mark = sdict[target][0]
            ans += len(s)
        elif sdict[target][0]>mark:
            mark = sdict[target][0]
        else:
            posi = search(sdict[target],mark,0,len(sdict[target])-1)
            mark = posi
        
if ans != -1:
    ans += mark
print(ans)

### FIXED CODE ###

s = str(input())
t= str(input())

sdict = {}
for i in range(len(s)):
    if s[i] not in sdict:
        sdict[s[i]]=[]
    sdict[s[i]].append(i+1)
    
#print(sdict)

#二分木探索
def search(list_,mark_,sta,gol):
    if  sta == gol:
            return list_[sta]
    else:
            mid = (gol+sta)//2
            if list_[mid]>mark_:
                return search(list_,mark_,sta,mid)
            else:
                return search(list_,mark_,mid+1,gol)

ans = 0
mark = 0
for _ in range(len(t)):
    target = t[_]
    if target not in sdict:
        ans = -1
        break
    else:
        if sdict[target][-1]<=mark:
            mark = sdict[target][0]
            ans += len(s)
        elif sdict[target][0]>mark:
            mark = sdict[target][0]
        else:
            posi = search(sdict[target],mark,0,len(sdict[target])-1)
            mark = posi
        
if ans != -1:
    ans += mark
print(ans)
while True:
if m == -1 or f == -1 or m + f < 30:
        print('F')
    elif m + f >= 80:
        print('A')
    elif m + f >= 65:
        print('B')
    elif m + f >= 50:
        print('C')
    elif m + f >= 30:
        print('C' if r >= 50 else 'D')

### FIXED CODE ###

while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')