Harryxun/stf_run huggingface dataset:
from operator import itemgetter
n,m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
data = []
now = 0
for i in range(m):
    b,c = map(int,input().split())
    data.append((b,c))
for i,j in sorted(data,key=itemgetter(1),reverse=True):
    while A[now] < j and i:
        A[now] = j
        i -= 1
        now += 1
    if now == n:
        print(sum(A))
        break
    if A[now] >= j:
        print(sum(A))
        break
else:
    print(sum(A))        

### FIXED CODE ###

from operator import itemgetter
n,m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
data = []
now = 0
for i in range(m):
    b,c = map(int,input().split())
    data.append((b,c))
for i,j in sorted(data,key=itemgetter(1),reverse=True):
    while A[now] < j and i:
        A[now] = j
        i -= 1
        now += 1
        if now == n:
            print(sum(A))
            exit()
    if A[now] >= j:
        print(sum(A))
        break
else:
    print(sum(A))
N = int(input)
a = 1000 - N
print(a)

### FIXED CODE ###

a = int(input(""))
if 1000 >= a:
    print(1000 - a)
elif 2000 >= a > 1000:
    print(2000 - a)
elif 3000 >= a > 2000:
    print(3000 - a)
elif 4000 >= a > 3000:
    print(4000 - a)
elif 5000 >= a > 4000:
    print(5000 - a)
elif 6000 >= a > 5000:
    print(6000 - a)
elif 7000 >= a > 6000:
    print(7000 - a)
elif 8000 >= a > 7000:
    print(8000 - a)
elif 9000 >= a > 8000:
    print(9000 - a)
else:
    print(10000 - a)
n, m = map(int, intput().split())
a = list(map(int, intput().split()))

total = sum(a)
for vote in a:
  if vote < 1/(4*m) * total:
    print("No")
    
print("Yes")

### FIXED CODE ###

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

a.sort(reverse=True)
total = sum(a)

if a[m - 1] < 1/(4*m) * total:
    print("No")
else:
    print("Yes")
import sys
import pprint

pp = pprint.PrettyPrinter(indent=4)

def main():
    """ Code implementation """
    a, b = map(int, raw_input().split())
    if int(b) % int(a) == 0:
	print(int(a) + int(b))
    else:
	print(int(b)-int(a))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import pprint

pp = pprint.PrettyPrinter(indent=4)

def main():
    """ Code implementation """
    a, b = map(int, input().split())
    if b % a == 0:
        print(b + a)
    else:
        print(b - a)

if __name__ == '__main__':
    main()
a,b = list(map(int, input().split()))
n = list(map(int, input().split()))

c = 0
ris = 0
lenn = len(n)
for i, name in enumerate(n[::-1]):
    if name < 0:
        c += 1
    if c == b-1:
        ri = i
        rs = name
        ris = lenn - ri - 1
        break

ans = []
ans_sum = []
for i in range(b+1):
    if ris+b+i > lenn:
        break
    iii = n[(ris+i):(ris+b+i)]
    ans.append(iii)
    lln = iii[0]
    rrn = iii[1]
    ll = abs(lln)
    rr = abs(rrn)
    if ll >=0 and rr > 0:
        ans_sum.append(rr)
    elif ll <0 and rr <=0:
        ans_sum.append(ll)
    elif ll <= rr:
        ans_sum.append(2*ll + rr )
    else:
        ans_sum.append(ll + 2*rr)

print(min(ans_sum))

### FIXED CODE ###

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

ans = []
for i, name in enumerate(n):
    if b+i >a:
        break
    ans.append(min( (abs(n[i]) + abs(n[i +b-1] - n[i]),  abs(n[i+b-1]) + abs(n[i +b-1] - n[i]) )) )

print(min(ans))
import collections
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
k=s.most_common()
p.append(k[0][0])
for i in range(len(collections.Counter(s))-1):
    if k[i][1]==k[i+1][1]:
        p.append(k[i+2][0])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])


### FIXED CODE ###

import collections
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
k=s.most_common()
p.append(k[0][0])
for i in range(len(collections.Counter(s))-1):
    if k[i][1]==k[i+1][1]:
        p.append(k[i+1][0])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
agc001 D
"""

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

if m == 1:
    print(ali[0])
    print(1)
    print(ali[0]-1, 1)
    exit()

flag = 0
c = []
for a in ali:
    if a & 1:
        if flag == 0:
            lm = a
            flag += 1
        elif flag == 1:
            rm = a
            flag += 1
        elif flag == 2:
            print('Impossible')
            exit()
    else:
        c.append(a)

if flag == 1:
    rm = c.pop()

b = [lm+1] + c
d = [lm] + c + [rm]

if rm > 1:
    b.append(rm-1)


print(" ".join(map(str, d)))
print(len(b))
print(" ".join(map(str, b)))


### FIXED CODE ###

#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
agc001 D
"""

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

if m == 1 and ali[0] == 1:
    print(1)
    print(1)
    print(1)
    exit()

if m == 1:
    print(ali[0])
    print(2)
    print(ali[0]-1, 1)
    exit()

flag = 0
c = []
for a in ali:
    if a % 2 == 1:
        if flag == 0:
            lm = a
            flag += 1
        elif flag == 1:
            rm = a
            flag += 1
        elif flag == 2:
            print('Impossible')
            exit()
    else:
        c.append(a)

if flag == 0:
    lm = c[0]
    del c[0]
    rm = c.pop()

if flag == 1:
    rm = c.pop()

b = [lm+1] + c
d = [lm] + c + [rm]

if rm > 1:
    b.append(rm-1)


print(" ".join(map(str, d)))
print(len(b))
print(" ".join(map(str, b)))
import numpy as np
n, m = map(int, input().split())
if m == 0:
    print(0)
    exit()
r = [[] for i in range(m)]
for i in range(m):
    f, s = map(int, input().split())
    r[f-1].append(s - 1)
    r[s-1].append(f - 1)
ans = []
def dfs(now, visited = []):
    global ans
    if len(visited) == n:
        ans.append([visited])
        return
    for j in r[now]:
        if j not in visited:
            dfs(j, visited + [j])
dfs(0, [0])
print(len(ans))

### FIXED CODE ###

import numpy as np
n, m = map(int, input().split())
if m == 0:
    print(0)
    exit()
r = [[] for i in range(n)]
for i in range(m):
    f, s = map(int, input().split())
    r[f-1].append(s - 1)
    r[s-1].append(f - 1)
ans = []
def dfs(now, visited = []):
    global ans
    if len(visited) == n:
        ans.append([visited])
        return
    for j in r[now]:
        if j not in visited:
            dfs(j, visited + [j])
dfs(0, [0])
print(len(ans))
S = int(input())

l = [1,1]
for i in range(2,S+1) :
    l.append(l[-1]*i)

ans = 0
for i in range(S//3) :
    kou = i+1
    maru = S - 3*kou
    shikiri = i
    ans += l[maru+shikiri] / (l[maru]*l[shikiri])

print(int(ans%((10**9)+7)))


### FIXED CODE ###

S = int(input())
m = (10**9)+7
l = [1,1]
for i in range(2,S+1) :
    l.append(l[-1]*i)

ans = 0
for i in range(S//3) :
    kou = i+1
    maru = S - 3*kou
    shikiri = i
    ans += l[maru+shikiri] // (l[maru]*l[shikiri])

print(int((ans%m)))
from collections import defaultdict


def main():
    N, M = list(map(int, input().split(' ')))
    adj_nodes = defaultdict(list)
    for _ in range(M):
        x, y = list(map(int, input().split(' ')))
        x -= 1
        y -= 1
        adj_nodes[x].append(y)
    dp = [-1 for _ in range(N)]

    def rec(v):
        if dp[v] >= 0:
            return dp[v]
        ret = 0
        for nv in adj_nodes[v]:
            ret = max([ret, rec(nv) + 1])
        dp[v] = ret
        return ret

    ans = 0
    for v in range(N):
        ans = max([ans, rec(v)])
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict
import sys

sys.setrecursionlimit(100000)


def main():
    N, M = list(map(int, input().split(' ')))
    adj_nodes = defaultdict(list)
    for _ in range(M):
        x, y = list(map(int, input().split(' ')))
        x -= 1
        y -= 1
        adj_nodes[x].append(y)
    dp = [-1 for _ in range(N)]

    def rec(v):
        if dp[v] >= 0:
            return dp[v]
        ret = 0
        for nv in adj_nodes[v]:
            ret = max([ret, rec(nv) + 1])
        dp[v] = ret
        return ret

    ans = 0
    for v in range(N):
        ans = max([ans, rec(v)])
    print(ans)


if __name__ == '__main__':
    main()
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif n % divisor == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for _ in range(number)]

divised = origin  # initialize

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

### FIXED CODE ###

def is_prime(n):
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True

count = 0

number = int(input())
for i in range(number):
    n = int(input())
    if is_prime(n):
        count = count + 1

print(count)
import math
N,D = map(int,input().split())
print(math.ceil(N/(D**2+1))

### FIXED CODE ###

import math
N,D = map(int,input().split())
print(math.ceil(N/((D*2+1))))
import sys


sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c = read_int_list()
    if a == b:
        print(c)
    if a == c:
        print(b)
    if b == c:
        print(a)


main()


### FIXED CODE ###

import sys
from collections import Counter

# sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int_list()
    c = Counter(n)
    for i in c:
        if c[i] == 1:
            print(i)


main()
import numpy as np
N = int(input())
seat = np.zeros(N + 100, dtype=int)
L, R = np.array([input().split() for _ in range(N)], dtype=int).T

np.add.at(seat, L, 1)
np.add.at(seat, R+1, -1)
np.cumsum(seat, out=seat)
print(seat.sum())

### FIXED CODE ###

n=int(input())
ans=0
for _ in range(n):
    l,r=map(int,input().split())
    ans+=r-l+1
print(ans)
import sys

group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
group3 = [2]

input_x = int(sys.argv[1])
input_y = int(sys.argv[2])

exist_group1 = group1.count(input_x) + group1.count(input_y)
exist_group2 = group2.count(input_x) + group2.count(input_y)
exist_group3 = group3.count(input_x) + group3.count(input_y)

if exist_group1 == 2 or exist_group2 == 2 or exist_group3 == 2:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
group3 = [2]

input = list(map(int, input().split()))
input_x = int(input[0])
input_y = int(input[1])

exist_group1 = group1.count(input_x) + group1.count(input_y)
exist_group2 = group2.count(input_x) + group2.count(input_y)
exist_group3 = group3.count(input_x) + group3.count(input_y)

if exist_group1 == 2 or exist_group2 == 2 or exist_group3 == 2:
    print("Yes")
else:
    print("No")
from math import gcd
n = int(input())

a = list(map(int,input().split()))
lcm = a[0]
for i in a[1:]:
  lcm = (lcm * i) // int(gcd(lcm, i)) 

lcm -= 1
ans = 0
for i in a:
	ans += lcm % i 
print(ans)

### FIXED CODE ###

def gcd(x, y):
 
   while(y):
       x, y = y, x % y
 
   return x

   
n = int(input())

a = list(map(int,input().split()))
lcm = a[0]
for i in a[1:]:
  lcm = (lcm * i) // int(gcd(lcm, i)) 

lcm -= 1
ans = 0
for i in a:
	ans += lcm % i 
print(ans)
n = int(input())
a = [int(input()) if(i) else 0 for i in range(n+1)]
distance = [None] * (n+1)

def dfs(p, d):
    if(p==2):
        return d
    if(distance[p]!=None):
        return -1
    ans = 100001
    distance[p] = d
    nextp = a[p]
    ans = min(ans, dfs(nextp, d + 1))
    return ans

print(dfs(1, 0))


### FIXED CODE ###

n = int(input())
a = [int(input()) if(i) else 0 for i in range(n+1)]
distance = [None] * (n+1)
queue = [(1, 0)]
while(len(queue)):
    p, d = queue.pop()
    if(p==2):
        print(d)
        break
    if(distance[p]!=None or d==100001):
        print(-1)
        break
    distance[p] == d
    nextp = a[p]
    queue.append((nextp, d+1))
n,m,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
for i in range(1,n):
    al[i]+=al[i-1]
for i in range(1,m):
    bl[i]+=bl[i-1]
ans=0
j=m-1
for i in in range(n):
    if al[i]>k:
        break
    while bl[j]>al[i]-k:
        j-=1
    ans=max(ans,i+j)
print(ans)


### FIXED CODE ###

n,m,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
aa,bb=[0],[0]
for i in range(n):
    aa.append(aa[i]+al[i])
for i in range(m):
    bb.append(bb[i]+bl[i])
ans=0
j=m
for i in range(n+1):
    if aa[i]>k:
        break
    while bb[j]>k-aa[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
n = input() # データの個数
a = input().split() #リストに文字列として格納
t = 0

while True:
  for i in len(n):
    if int(a(i-1)) % 2 == 0:
      a(i-1) = int(a(i-1)/2)
      if i ==n:
        t += 1
      else:
        pass
    else:
      break

print(t)


### FIXED CODE ###

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

ans = 0
t=0

while True:
    for i in range(n):  # 0 1 2 ... n-1
        if a[i] %2 ==0:
            a[i] = a[i] / 2
        else:
            t = 1
    if t != 1:
        ans += 1
    else:
        break

print(ans)
s = int(input())
#print(s)

N=1000
d=[0]*N


for i in range(N):
  d[i]=i**5
  
for i in range(N):
  for j in range(i,N):
    if (d[i] + d[j] == s) :
      print(i,-j)
      sys.exit
    elif (d[i] - d[j] == s):
      print(i,j)
      sys.exit
    elif (d[j] + d[i] == s):
      print(j,-i)
      sys.exit
    elif (d[j] - d[i] == s):
      print(j,i)
      sys.exit

### FIXED CODE ###

import sys

s = int(input())
#print(s)

N=1000
d=[0]*N


for i in range(N):
  d[i]=i**5
  
for i in range(N):
  for j in range(i,N):
    if (d[i] + d[j] == s) :
      print(i,-j)
      sys.exit
    elif (d[i] - d[j] == s):
      print(i,j)
      sys.exit
    elif (d[j] + d[i] == s):
      print(j,-i)
      sys.exit
    elif (d[j] - d[i] == s):
      print(j,i)
      sys.exit
A,B=map(int,input().split())
print(A*B/2)

### FIXED CODE ###

A,B,C=map(int,input().split())
print(int(A*B/2))
1 print(10 - int(input()) // 200)

### FIXED CODE ###

print(10 - int(input()) // 200)
import math
def undefinedfunction():
  asjdkfl
A,B,X=map(int,input().split())
last=[]
for i in range(0,10):
  last.append(A*(10**i)+B*(i+1))
digit=0
for i in range(0,10):
  if X>=last[i]:
    digit=digit+1
if digit==0:
  print(0)
elif digit>=10:
  undefined
  print(1000000000)
else:
  k=math.floor((X-B*digit)/A)
  if (k+1)*A<=X-B*digit:
    k+=1
    undefinedfunction
  if k<10**(digit-1):
    k=10**(digit-1)
  if k>=10**digit:
    k=10**digit-1
    undefinedfunction
  print(k)

### FIXED CODE ###

S=input()
if S=='SUN':
  print(7)
if S=='MON':
  print(6)
if S=='TUE':
  print(5)
if S=='WED':
  print(4)
if S=='THU':
  print(3)
if S=='FRI':
  print(2)
if S=='SAT':
  print(1)
input = input().split()
N = int(input[0])
S = input(1)

R = 0
B = 0
h = 'No'

for i in N:
  if S[i] == 'R':
    R += 1
  else:
    B += 1

if R > B:
  h = 'Yes'

print(h)

### FIXED CODE ###

input1 = input()
N = int(input1)
input2 = input()
S = list(input2)
 
R = 0
B = 0
h = 'No'
 
for i in range(N):
  if S[i] == 'R':
    R += 1
  else:
    B += 1
  
if R > B:
  h = 'Yes'

print(h)
a,b = map(int,int().split())
print(0 if b*2>=a else a-b*2)

### FIXED CODE ###

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

print(0 if b*2>=a else a-b*2)
import numpy as np
import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = np.sqrt(num)

    for serial in range(3, num, 2):
    
        if serial >= sqrt:
            return input_list

        for s in range(serial ** 2, num, serial):
            if bool_list[s]:
                input_list[s] = serial
                bool_list[s] = False

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

D = getD(max(A))

flag = True

d_set_all = set()
for i, a in enumerate(A):
    d_set = set()
    while a > 1:
        d_set.add(D[a])
        a = a // D[a]

    if len(d_set_all & d_set) > 0:
        flag = False
        break
    d_set_all = d_set | d_set_all

if flag:
    print('pairwise coprime')
    exit()

if reduce(math.gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


### FIXED CODE ###

import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

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

D = getD(max(A))
pairwise_coprime = True
use_divnum = set()
for i in range(N):
    k = A[i]
    while k != 1:
        if D[k] in use_divnum:
            pairwise_coprime = False
            break
        else:
            use_divnum.add(D[k])
        div = D[k]
        while k % div == 0 and k > 1:
            k = k // div
if pairwise_coprime: 
    print("pairwise coprime")
    exit()
from math import gcd
gcd_of_a = A[0]
for i in range(N):
    gcd_of_a = gcd(gcd_of_a, A[i])
if gcd_of_a == 1:
    print("setwise coprime")
else:
    print("not coprime")
N = int(input())
A = int(input())
B = int(input())

if(N == 1):
	print("Hello World")
else:
	print(A+B)

### FIXED CODE ###

N = int(input())


if(N == 1):
	print("Hello World")
else:
	A = int(input())
	B = int(input())
	print(A+B)
s = raw_input()
K = input()

alpha = [chr(i) for i in range(97,97+26)]

for moji in range(1, len(s)+1):
	if alpha.index(s[moji-1]) != 0:
		if K >= 26-alpha.index(s[moji-1]):
			K = K - (26-alpha.index(s[moji-1]))
			s = s[:moji-1] + 'a' + s[moji:] 

if K>0:
	last_char = alpha[ alpha.index(s[-1]) + (K % 26) ]
	s = s[:-1] + last_char

print s

### FIXED CODE ###

s = raw_input()
K = input()

alpha = [chr(i) for i in range(97,97+26)]

i = 0
while K>=26 and i<len(s)-1:
	if alpha.index(s[i]) != 0:
		K = K - (26 - alpha.index(s[i]))
		s = s[:i] + 'a' + s[i+1:]
	i=i+1

for moji in range(i, len(s)):
	if alpha.index(s[moji]) != 0:
		if K >= 26-alpha.index(s[moji]):
			K = K - (26-alpha.index(s[moji]))
			s = s[:moji] + 'a' + s[moji+1:] 

if K>0:
	last_char = alpha[ alpha.index(s[-1]) + (K % 26) ]
	s = s[:-1] + last_char

print s
N, H = tuple(map(int, input().split(' ')))
katanas = [list(map(int, input().split(' '))) for _ in range(0, N)]

normaldmbs = list(map(lambda x: x[0], katanas))
max_normal_dmg = max(normaldmbs)

throwables = list(map(lambda x: x[1], filter(lambda x: x[1] > max_normal_dmg, katanas)))
throwables.sort().reverse()

cnt = 0

for v in throwables:
    H -= v
    cnt += 1
    if H <= 0:
        break

if H > 0:
    if H % max_normal_dmg == 0:
        cnt += int(H / max_normal_dmg)
    else:
        cnt += int(H / max_normal_dmg) + 1


print(cnt)

### FIXED CODE ###

N, H = tuple(map(int, input().split(' ')))
katanas = [list(map(int, input().split(' '))) for _ in range(0, N)]

normaldmbs = list(map(lambda x: x[0], katanas))
max_normal_dmg = max(normaldmbs)

throwables = list(map(lambda x: x[1], filter(lambda x: x[1] > max_normal_dmg, katanas)))
throwables.sort(reverse=True)

cnt = 0

for v in throwables:
    H -= v
    cnt += 1
    if H <= 0:
        break

if H > 0:
    if H % max_normal_dmg == 0:
        cnt += int(H / max_normal_dmg)
    else:
        cnt += int(H / max_normal_dmg) + 1


print(cnt)
import sys
input = sys.stdin.readline
n = int(input())
d = {}
graph = {i:[] for i in range(n)}
for _ in range(n-1):
  u,v,w = map(int,input().split())
  d[(u-1,v-1)] = w
  graph[u-1].append(v-1)
  graph[v-1].append(u-1)
  
  
color = [-1 for i in range(n)] 
color[0] = 0
from itertools import deque
queue =deque([])

while queue:
  p = queue.popleft()
  color_p = color[p]
  for i in range(graph[p]):
    if color[i] != -1:
      continue
    else:
      if d[(min(i,p),max(i,p))] %2:
        color[i] = 1 - color_p
      else:
        color[i] = color_p
      queue.push(i)

for i in range(n):
  print(color[i])



### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
d = {}
graph = {i:[] for i in range(n)}
for _ in range(n-1):
  u,v,w = map(int,input().split())
  d[(u-1,v-1)] = w
  graph[u-1].append(v-1)
  graph[v-1].append(u-1)
  
  
color = [-1 for i in range(n)] 
color[0] = 0
from collections import deque
queue =deque([0])

while queue:
  p = queue.popleft()
  color_p = color[p]
  for i in graph[p]:
    if color[i] != -1:
      continue
    else:
      if d[(min(i,p),max(i,p))] %2:
        color[i] = 1 - color_p
      else:
        color[i] = color_p
      queue.append(i)

for i in range(n):
  print(color[i])
n = int(raw_input())
sum = 0
tmp = n
 
while tmp > 0:
    sum += tmp % 10
    tmp /= 10
 
if n % sum == 0:
    print "Yes"
else:
    print "No"

### FIXED CODE ###

n = int(raw_input())
sum = 0
tmp = n
 
while tmp > 0:
    sum += tmp % 10
    tmp /= 10
 
if n % sum == 0:
    print "Yes"
else:
    print "No"
from itertools import combinations_with_replacement
import numpy as np

N, M, Q = map(int, input().split())

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

ans = 0

# 可能な数列Aの全探索、そのままやとめちゃ多いからなんか工夫する？
# そもそもAの全探索方がいまいちわからん...

A = np.array(list(combinations_with_replacement(range(1, M + 1), N)))
scores = np.zeros(len(A))
for g in G:
    a, b, c, d = g
    cond = A[:, b - 1] - A[:, a - 1] == c
    scores += d * cond
print(scores.max())

### FIXED CODE ###

K = int(input())
A, B = map(int, input().split())

for i in range(A, B+1):
    if i % K == 0:
        print("OK")
        import sys
        sys.exit()
print("NG")
from math import pi
r=input()
print("{0:.5f} {1:.5f}".format(pi*r*r, 2*pi*r))

### FIXED CODE ###

from math import pi
r=float(input())
print("{0:.5f} {1:.5f}".format(pi*r*r, 2*pi*r))
s = list(input())
out = []

i=0
while s[i]:
  out.append(s[i])
  i +=2

print(out)




### FIXED CODE ###

s = list(input())
out = []

cnt =0

for i in s:
    if cnt%2 == 0:
        out.append(i)
    cnt += 1
 
print("".join(out))
from functions import gcd
a, b, k = map(int, input().split())

_gcd = gcd(a, b)

count = 0
for i in range(1, _gcd+1)[::-1]:
    if a % i == 0 and b % i == 0:
        count += 1
    if count == k:
        print(i)
        break


### FIXED CODE ###

from fractions import gcd
a, b, k = map(int, input().split())

_gcd = gcd(a, b)

count = 0
for i in range(1, _gcd+1)[::-1]:
    if a % i == 0 and b % i == 0:
        count += 1
    if count == k:
        print(i)
        break
import queue
k = int(input)
q = queue.Queue()

for i in range(1,10):
    q.put(i)

for i in range(k):
    x = q.get()
    if not x%10 == 0:
        q.put(10*x+(x%10)-1)
    q.put(10*x+(x%10))
    if not x%10 == 9:
        q.put(10*x+(x%10)+1)

print(x)


### FIXED CODE ###

import queue
k = int(input())
q = queue.Queue()

for i in range(1,10):
    q.put(i)

for i in range(k):
    x = q.get()
    if not x%10 == 0:
        q.put(10*x+(x%10)-1)
    q.put(10*x+(x%10))
    if not x%10 == 9:
        q.put(10*x+(x%10)+1)

print(x)
while True:
    x,y = map(int,input().split())
    if x > y:
        print(f'{y}{x})
    elif x < y:
        print(f'{x}{y})
    elif x == 0 and y == 0:
        break


### FIXED CODE ###

while True:
    x,y = map(int,input().split())
    if x == 0 and y == 0:
        break
    if x > y:
        print(f"{y} {x}")
    elif x <= y:
        print(f"{x} {y}")
s1, s2, s3 = input().split()
a = str(s1)
b = str(s2)
c = str(s3)
count = 0
for i in (a, b, c):
  if a = 1:
    count += 1
  if b = 1:
    count += 1
  if c = 1:
    count += 1

### FIXED CODE ###

a = list(input())
count = 0
for i in range(3):
  if a[i] == "1":
    count += 1
    
print(count)
c = a*b
if c % 2 == 0:
  return Even
else:
  return Odd

### FIXED CODE ###

a,b = map(int, raw_input().split())
c = a*b
if c % 2 == 0:
  print("Even")
else:
  print("Odd")