Harryxun/stf_run huggingface dataset:
A,B,C,K = map(int, input().split())

sum = 0
li = [1] * A
Bli = [0] * B
Cli = [-1] * C

li.extend(Bli)
li.extend(Cli)

for k in range(K):
    sum = sum + li[k]

print(sum)


### FIXED CODE ###

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


if A >= K:
    print(K)
elif A+B >=K:
    print(A)
else:
    print(A+(A+B-K))
import numpy as np
from collections import deque

H, W = map(int, input().split())
maze = np.array([input() for _ in range(H)])


def bfs(sty, stx):
    visited = np.array([[-1 for _ in range(W)] for _ in range(H)])
    q = deque()
    q.append((sty, stx, 0))


    def is_ok(y, x):
        if not 0 <= y <= H - 1:
            return False
        if not 0 <= x <= W - 1:
            return False
        if visited[y][x] != -1:
            return False
        if maze[y][x] == '#':
            return False
        return True


    while q:
        y, x, lv = q.popleft()
        visited[y][x] = lv
        for i in (-1, 1):
            if is_ok(y+i, x):
                q.append((y+i, x, lv+1))
            if is_ok(y, x+i):
                q.append((y, x+i, lv+1))

    return np.max(visited)

res = 0
for i in range(H):
    for j in range(W):
        if maze[i][j] == '.':
            steps = bfs(i, j)
            if steps > res:
                res = steps

print(res)


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
maze = [input() for _ in range(H)]


def bfs(sty, stx):
    visited = [[-1]*W for _ in range(H)]
    q = deque()
    visited[sty][stx] = 0
    q.append((sty, stx, 0))


    def is_ok(y, x):
        if not 0 <= y <= H - 1:
            return False
        if not 0 <= x <= W - 1:
            return False
        if visited[y][x] != -1:
            return False
        if maze[y][x] == '#':
            return False
        return True


    while q:
        y, x, lv = q.popleft()
        for i in (-1, 1):
            if is_ok(y+i, x):
                visited[y+i][x] = lv+1
                q.append((y+i, x, lv+1))
            if is_ok(y, x+i):
                visited[y][x+i] = lv + 1
                q.append((y, x+i, lv+1))

    return max(max(r) for r in visited)

res = 0
for i in range(H):
    for j in range(W):
        if maze[i][j] == '.':
            res = max(res, bfs(i, j))

print(res)
K = int(input())
mod = []
a[0] = 7%K
if a[0] == 0:
    print(a[0])
    exit()
for i in range(1,K):
    a[i] = (a[i-1]*10 + 7)%K
    if a[i] == 0:
        print("%d",a[i])
        break

else:
    print(-1)

### FIXED CODE ###

K = int(input())

n = 0
for i in range(1,K+1):
    n = (n*10 + 7)%K
    if n == 0:
        print(i)
        break

else:
    print(-1)
import sys

x = 500000
f = [0, 1] * xx
i = 3

while i * i <= 2 * xx:
    if f[i] == 1:
        j = i * i
        while j <= 2 * xx:
            f[j] = 0
            j += i + i
    i += 2

f.pop(0)
f.pop(1)

for n in sys.stdin:
    i = int(n)
    if i < 2:
        print(0)
    else:
        print(sum(f[:i - 1]))

### FIXED CODE ###

import sys

f = [1, 0, 0, 0, 1, 0] * (1000000 // 6 + 1)
f = [0, 0, 1, 1] + f[3:-2]

i = 5
while i < 1000:
    if f[i] == 1:
        j = i * i
        while j <= 1000000:
            f[j] = 0
            j += i + i
    i += 2

for n in sys.stdin:
    i = int(n)
    print(sum(f[:i + 1]))
from collections import Counter
import numpy as np

h, w = map(int, input().split())
arr = [list(map(str, input().rstrip())) for _ in range(h)]

arr = sum(arr, [])

arr = Counter(arr)
arr = np.array(list(arr.values()))


def solve(arr):
    # 偶数×偶数なら、制約がかなりきつい
    if h % 2 == 0 and w % 2 == 0:
        return np.all(c % 4 == 0)

    # 奇数×奇数なら、
    elif h % 2 == 1 and w % 2 == 1:
        even = (h + w) // 2 - 1
        if (arr % 2 == 1).sum() != 1:
            return False
        odd = arr[np.where(arr % 2 == 1)].sum()
        if odd % 4 == 3:
            even -= 1
        arr = arr[np.where(arr != odd)]
        ans = (arr % 4 == 2).sum() <= even
        ans &= np.all(arr[np.where(arr % 4 != 2)] % 4 == 0)
        return ans

    #　どちらかの辺が偶数なら
    else:
        even = h // 2 if h % 2 == 0 else w // 2
        ans = (arr % 4 == 2).sum() <= even
        ans &= np.all(arr[np.where(arr % 4 != 2)] % 4 == 0)
        return ans


print("Yes" if solve(arr) else "No")

### FIXED CODE ###

from collections import Counter
import sys

h, w = map(int, input().split())
arr = [list(map(str, input().rstrip())) for _ in range(h)]

arr = sum(arr, [])

c = Counter(arr)
c = list(c.values())

if h % 2 == 0 and w % 2 == 0:
    ans = all([x % 4 == 0 for x in c])  # 全て4個セットならOK

elif h % 2 == 1 and w % 2 == 1:
    even = (h + w) // 2 - 1  # 2個セットを許容できる個数
    odd_cnt = len([x for x in c if x % 2 == 1])
    if odd_cnt != 1:
        print("No")
        sys.exit()
    odd = sum([x for x in c if x % 2 == 1])
    if odd % 4 == 3:
        even -= 1
    c.remove(odd)
    # 2個セットが許容数以下か
    ans = True if sum([x % 4 == 2 for x in c]) <= even else False
    ans &= all([x % 4 == 0 for x in c if x % 4 != 2])  # 残り全て4個セットか

else:
    even = h // 2 if h % 2 == 0 else w // 2  # 2個セットを許容できる個数
    # 2個セットが許容数以下か
    ans = True if sum([x % 4 == 2 for x in c]) <= even else False
    ans &= all([x % 4 == 0 for x in c if x % 4 != 2])  # 残り全て4個セットか

print("Yes" if ans else "No")
= int(input())
mon =[int(i)for i in input().split()]

def gcd(x,y):
    if y ==0:
        return x
    else:
        return gcd(y,x%y)
mon.sort()
mini = mon[0]
for i in range(1,N):
    ans = gcd(mini,mon[i])
print(ans)

### FIXED CODE ###

from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
x=gcd(a[0],a[1])
for i in range(2,len(a)):
  x=gcd(x,a[i])
print(x)
# import sys
# sys.setrecursionlimit(35000)
x,y = map(int, input().split())

dp = [[-1]*(x+1) for i in range(y+1)]
# dp[1][2]=1
# dp[2][1]=1
# dp[1][1]=0
# dp[1][0]=0
# dp[0][1]=0

def f(x,y):
    if (x,y)==(1,2):
        dp[y][x]=1
        return 1
    elif (x,y)==(2,1):
        dp[y][x]=1
        return 1
    elif (x,y)==(1,1):
        dp[y][x]=0
        return 0
    elif (x,y)==(0,1):
        dp[y][x]=0
        return 0
    elif (x,y)==(1,0):
        dp[y][x]=0
        return 0
    else:
        if dp[y][x]==-1:
            dp[y][x]=f(x-1,y-2)+f(x-2,y-1)
        return dp[y][x]

print(dp[y][x]%(10**9+7))

### FIXED CODE ###

# import math
# from operator import mul
# from functools import reduce
x,y = map(int, input().split())
n = (x+y)//3
r = (2*x-y)//3
mod = 10**9+7
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

if (x+y)%3!=0:
    print(0)
elif 2*x-y<0:
    print(0)
elif -x+2*y<0:
    print(0)
else:
    # print((math.factorial((x+y)//3)//(math.factorial((2*x-y)//3)*math.factorial((2*y-x)//3)))%mod)
    # print(combinations_count(n,r)%mod)
    print(cmb(n,r,mod))
N = int(input())
A = set(list(map(Int, input().split())))
if len(A) == N:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

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


table = collections.defaultdict(int)
for x in A:
    table[x] += 1
    if table[x] > 1:
        print("NO")
        exit(0)
print("YES")
N=int(input())
A=list(map(int,input().split()))
n=0
for i in range(len(A)):
    if A[i]<0:
        n+=1
if n%2==0:
    ans=0
    for i in range(len(A)):
        ans+=abs(A[i])
if n%2==1:
    B=A
    for i in range(len(A)):
        B[i]=abs(A[i])
    minn=min(B)
    ans=0
    for i in range(len(A)):
        ans+=B[i]
    ans-=2*minn
print(ans)
    
        

### FIXED CODE ###

A,B,T=map(int,input().split())
print(int(((T+0.5)//A)*B))
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = input()[:-1]
dig = 0
for c in N:
    dig += int(c)
if N % dig == 0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = input()[:-1]
dig = 0
for c in N:
    dig += int(c)
if int(N) % dig == 0:
    print("Yes")
else:
    print("No")
N, M=map(int(input().split())
AC=[0]*(a+1)
WA=[0]*(a+1)
ac=0
wa=0
t=0
for i in range(M):
    x,y=map(str(input().split())
    if y=="WA":
        WA[int(x)]+=1   
    elif x=="AC" and AC[int(x)]==0:
        wa+=WA[int(x)]
        ac+=1     
        AC[int(x)]=1
print(ac, wa)             

### FIXED CODE ###

a,b = map(int,input().split())
AC = [0]*(a+1)
WA = [0]*(a+1)
ac = 0
wa = 0
wat = 0

for i in range(b):
  x,y = map(str,input().split())
  if y == "WA":
    WA[int(x)] += 1
  elif AC[int(x)] == 0 and y == "AC":
    wa += WA[int(x)]
    ac += 1
    AC[int(x)] = 1

print(ac,wa)
n = input()
a = []
b = []

for i in range(n):
  a[i] = input()

m = input()

for j in range(m):
  b[j] = input()
  for i in range(n):
    if b[j] - a[i] < 0:
      i = i + 1
    elif b[j] - a[i] == 0:
      return yes
    elif b[j] - a[i] > 0:
      b[j] = b[j] - a[i]
return no

### FIXED CODE ###

n = int(raw_input())
A = map(int,raw_input().split())
q = int(raw_input())
m = map(int,raw_input().split())

def solve(i,m):
  if m == 0:
    return 1
  if i >= n or m - sum(A) > 0:
    return 0
  res = solve(i+1,m) or solve(i+1,m-A[i])
  return res

for j in range(q):
  if solve(0,m[j]):
    print "yes"
  else:
    print "no"
n,k = map(int,input().split())
mod = 10**9+7

def kai(a):
    ans = 1
    for i in range(1,a+1):
        ans *= i
    return ans
    
for i in range(1,k+1):
    if(n-k+1<i):
        print(0)
        continue
    kusan=(kai(n-k+1))//kai(i)//kwai(n-k-i+1)%mod
    haibun=(kai(k-1)//kai(k-i)//kai(i-1))%mod
    print((kusan*haibun)%mod)
    

### FIXED CODE ###

n,k = map(int,input().split())
mod = 10**9+7

def kai(a):
    ans = 1
    for i in range(1,a+1):
        ans *= i
    return ans
    
for i in range(1,k+1):
    if(n-k+1<i):
        print(0)
        continue
    kusan=(kai(n-k+1))//kai(i)//kai(n-k-i+1)%mod
    haibun=(kai(k-1)//kai(k-i)//kai(i-1))%mod
    print((kusan*haibun)%mod)
import itertools
N,M=map(int,input().split())
kslist=[]
for i in range(M):
    kslist.append(list(map(int,input().split()))) 
plist=list(map(int,input().split()))
seq=[0]*N+[1]*N
ls=list(set(list(itertools.permutations(seq,N))))
n=0
for tup in ls:
    if [tup[kslist[j][k in range(1,kslist[j][0]+1)]-1]%2 for j in range(M)]==plist:
        n+=1
print(n)            
    

### FIXED CODE ###

import itertools
N,M=map(int,input().split())
kslist=[(list(map(int,input().split()))) for i in range(M)]
plist=list(map(int,input().split()))
ls=list((itertools.product(range(2),repeat=N)))
n=0
for tup in ls:
    n+=1
    for j in range(M):
        sum1=0
        for k in range(1,kslist[j][0]+1):
            sum1+=tup[kslist[j][k]-1]
        if sum1%2!=plist[j]:
            n=n-1
            break
print(n)
s = input()
sCnt = s.count('S')
if sCnt != 2:
    print('No')
else:
    s = s.sort()
    if s[0]=='S':
        if s[2]==s[3]:
            print('Yes')
        else:
            print('No')
    elif  s[3]=='S':
        if s[0]==s[1]:
            print('Yes')
        else:
            print('No')
    else:
        if s[1]==s[2]:
            print('Yes')
        else:
            print('No')

### FIXED CODE ###

s = input()
s_sort = ''.join(sorted(s))
s1 = s[0]
s1cnt = s_sort.count(s1)
if s1cnt == 2:
    s2 = s[2]
    s2cnt = s_sort.count(s2)
    if s2cnt == 2:
        print('Yes')
    else:
        print('No')
else:
    print('No')
import sys

def quartet(h, w):
    global flag
    if 0 <= h <= 11 and 0 <= w <= 11:
        if mapp[h][w] == '1':
            mapp[h][w] = '$'
            flag = True
            bigbang(h, w)
        elif mapp[h][w] == '0' or mapp[h][w] == '$':
            return
    else:
        return

def bigbang(h, w):
    quartet(h, w+1)
    quartet(h-1,w)
    quartet(h, w-1)
    quartet(h+1, w)

while True:
    try:
        mapp = []
        for i in range(12):
            line = raw_input()
            lis = []
            for char in line:
                lis.append(char)
            else:
                mapp.append(lis)
                
        flag = False
        count = 0
        for h in range(12):
            for w in range(12):
                quartet(h, w)
                if flag == True:
                    count += 1
                flag = False
        else:
            print count
        if raw_input == '':
            continue
    except EOFError:
        break

### FIXED CODE ###

def f1():
    t = 0
    for y in range(len(M)):
        for x in range(len(M[0])):
            if M[y][x] == '1':
                f2(x, y)
                t += 1
    return t


def f2(x, y):
    if x < 0 or len(M[0]) == x or y < 0 or len(M) == y:
        return
    if M[y][x] == '1':
        M[y][x] = '0'
        f2(x, y-1)
        f2(x, y+1)
        f2(x+1, y)
        f2(x-1, y)


M = []
while True:
    try:
        line = input()
        if line == '':
            print(f1())
            M = []
        else:
            M.append(list(line))
    except EOFError:
        print(f1())
        break
from collections import deque
N = int(input())
B = deque(map(int, input().split()))
base = B.popleft()
ans = base
while B:
  tmp = B.popleft()
  ans += min(base, tmp)
  base = tmp
ans += tmp
print(ans)

### FIXED CODE ###

from collections import deque
N = int(input())
B = deque(map(int, input().split()))
base = B.popleft()
ans = base
while B:
  tmp = B.popleft()
  ans += min(base, tmp)
  base = tmp
ans += base
print(ans)
T = list(str(input()))

for i in range(len(T)):
    if T[i] == '?'
        T[i] = 'D'

print(''.join(T))

### FIXED CODE ###

T = list(str(input()))

for i in range(len(T)):
    if T[i] == '?':
        T[i] = 'D'
    print(T[i],end='')
n = int(input())

print('Hello World' if n == 1)

if n == 2:
    for _ in range(2):
        a = [int(input())]

    print(sum(a))

### FIXED CODE ###

n = int(input())

if n == 1:
    print('Hello World')

if n == 2:
    a = [int(input()) for _ in range(2)]

    print(sum(a))
from collections import deque

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

A = int(A)
B = int(B)
K = int(K)

value = deque()
s = [i for i in range(A, B+1)]

value.extend(s[0:K])
value.extend(s[len(s)-K:len(s)])

num = list(set(value))

for i in range(len(num)):
    print(num[i])

### FIXED CODE ###

S = input().split()

if 'a' in S[0] and 'b' in S[0] and 'c' in S[0]:
    print('Yes')
else:
    print('No')
def f(x):
    global a
    dp=[0]*k
    dp[0]=1
    for i in range(n):
        if i==x:
            continue
        else:
            h=[0]*k
            b=a[i]
            for i in range(k):
                if dp[i]==1:
                    h[i]=1
                    if i+b<k:
                        h[i+b]=1
        dp=h
    for i in range(k-a[x],k):
        if dp[i]==1:
            return True
    else:
        return False
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
low=0
high=n-1
while high>low+1:
    h=(high+low)//2
    if f(h):
        high=h
    else:
        low=h
if f(low):
    print(max(0,low-1)+1)
else:
    if f(high):
        print(low+1)
    else:
        print(high+1)

### FIXED CODE ###

import itertools

def fff(x):
    dp=[0]*k
    dp[0]=1
    for u in itertools.chain(a[:x],a[x+1:]):
        h=dp[:]
        for i in range(u,k):
            h[i]=h[i]|dp[i-u]
        dp=h
    cnt=0
    for i in range(max(0,k-a[x]),k):
        cnt+=dp[i]
    if cnt==0:
        return True
    else:
        return False

n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
low=0
high=n-1
while high-low>1:
    mid=(high+low)//2
    if fff(mid):    #不必要
        low=mid
    else:
        high=mid

if fff(high):
    print(high+1)
elif fff(low):
    print(low+1)
else:
    print(0)
print ('{}:{}:{}'.format(h,m,s)

### FIXED CODE ###

S = int(input())
print(S // 3600, S % 3600 // 60, S % 60, sep=':')
N = int(input())
print(N*2*math.pi)


### FIXED CODE ###

"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
# import numpy as np

inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""
from collections import Counter
import math
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))
# WideIntPoint


def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  # SingleInt


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  # HeightString


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  # MatrixInt


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  # NumberGrid


def grid(n): return [s_list() for _ in range(n)]


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


def lcm(a, b):
    """a,bの最小公倍数"""
    return a * b // gcd(a, b)


def main():
    N = int(input())
    print(N*2*math.pi)


if __name__ == '__main__':
    main()
a, b = input().split()
a = int(a)
b.replace('.','')
b = int(b)
print(a*b//100)

### FIXED CODE ###

a, b = input().split()
a = int(a)
b = int(b.replace('.',''))
print(a*b//100)
a, b = map(int, input().split())
if a ='H' and b ='H':
  print('H')
elif a ='H' and b ='D':
  print('D')
elif a ='D' and b ='H':
  print('D')
else:
  print('H')
  

### FIXED CODE ###

a, b = map(str, input().split())
if a =='H' and b =='H':
  print('H')
elif a =='H' and b =='D':
  print('D')
elif a =='D' and b =='H':
  print('D')
else:
  print('H')
# coding:utf-8
def main():
    a = list(input())
    b = list(input())

    if a*b % 2:
        print('Even')
    else : print('Odd')


if __name__ == '__main__' :
    main()

### FIXED CODE ###

# coding:utf-8
def main():
    a,b = map(int, input().split())

    if a*b % 2 == 0:
        print('Even')
    else : print('Odd')


if __name__ == '__main__' :
    main()
s=input()
if s[0]==s[1] and s[0]==s[2]:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

s=input()
if s[0]==s[1] and s[0]==s[2]:
  print('No')
else:
  print('Yes')
# coding: utf-8
H,W=map(int,input().split())

if H==1 or W==1:
  print(1)
else:
  if H*W%2==0:
    print(int(H*W/2))
  else:
    print(int(H*W/2+0.5))
  
 

### FIXED CODE ###

# coding: utf-8
N=int(input())

l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(l[N-1])
n = int(input())

l = []
for i in range(n):
  x,y = map(str,input().split())
  l.append((x,y, i))


L = []

for i in range(n):
  L.append((l[i][0], int(l[i][1]), l[i][2]))

L.sort(key = lambda L:L[1])

L.sort(key = lambda L:L[0])

for i in range(n):
  print(L[n][2] + 1)



### FIXED CODE ###

n=int(input())
sp=[]
for i in range(n):
  x,y=input().split()
  sp.append([x,int(y),i+1])
  sp.sort(key=lambda x:(x[0],-x[1]))
for i in range(n):
  print(sp[i][2])
N = int(input())
A = list(map(int, input().split()))

A.sort()
A.reverse()
ans = 0
ans += A[0]

if len(A) % 2 == 0:
  tmp = 0
  for i in range(1, int((N-2)/2)+1):
    tmp += A[i] * 2
else:
  for i in range(1, int((N-3)/2)+1):
    tmp += A[i] * 2
  tmp += A[int((N-3)/2)+1]

ans += tmp
print(ans)

### FIXED CODE ###

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

A.sort()
A.reverse()
ans = 0
ans += A[0]

if len(A) % 2 == 0:
  tmp = 0
  for i in range(1, int((N-2)/2)+1):
    tmp += A[i] * 2
else:
  tmp = 0
  for i in range(1, int((N-1)/2)+1):
    tmp += A[i] * 2
  tmp -= A[int((N-1)/2)]

ans += tmp
print(ans)
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
nums = [0] * N
friends = []
for _ in range(N):
    friends.append(set())

for _ in range(M):
    A, B = map(int, input().split())
    friends[A-1].add(B-1)
    friends[B-1].add(A-1)

gnum = 0
groupn = 0
nmax = 0

def find_route(i):
    global gnum
    global nums
    global friends
    global groupn
    global nmax
    if len(friends[i]) == 0:
        return
    if nums[i] == 0:
        gnum += 1
        groupn = 1
        nums[i] = gnum
    for f in friends[i]:
        if nums[f] == 0:
            nums[f] = gnum
            groupn += 1
            if groupn > nmax:
                nmax = groupn
            find_route(f)

for i in range(N):
    find_route(i)

print(nums)
print(max(nmax, 1))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)

N, M = map(int, input().split())
nums = [0] * N
friends = []
for _ in range(N):
    friends.append(set())

for _ in range(M):
    A, B = map(int, input().split())
    friends[A-1].add(B-1)
    friends[B-1].add(A-1)

gnum = 0
groupn = 0
nmax = 0

def find_route(i):
    global gnum
    global nums
    global friends
    global groupn
    global nmax
    if len(friends[i]) == 0:
        return
    if nums[i] == 0:
        gnum += 1
        groupn = 1
        nums[i] = gnum
    for f in friends[i]:
        if nums[f] == 0:
            nums[f] = gnum
            groupn += 1
            if groupn > nmax:
                nmax = groupn
            find_route(f)

for i in range(N):
    find_route(i)

print(max(nmax, 1))
S = input()
T = input()
print(sum(s != t for s, t in zip(S, T))

### FIXED CODE ###

S = input()
T = input()
print(sum(s != t for s, t in zip(S, T)))
n = list(map(int,input().split()))

x = False
y = False

if max(n[0],n[1]) < 0:
    x = True
    
if max(n[2],n[3]) < 0:
    y = True

if n[1] > 0:
    if n[3] > 0:
        ans = n[1] * n[3]
    else:
        if n[0] < 0:
            ans = n[0] * n[2]
        else:
            ans = n[0] * n[3]
elif n[3] > 0:
    if n[2] < 0:
        ans = n[0] * n[2]
    else:
        ans = n[1] * n[2]
if n[1] == 0 and n[3] == 0:
    ans = n[0] * n[2]

print(ans)

### FIXED CODE ###

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


ans = n[1] * n[3]
ans = max(n[0]*n[2],ans)
ans = max(n[0]*n[3],ans)
ans = max(n[1]*n[2],ans)
ans = max(n[1]*n[3],ans)
print(ans)
import bisect
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
zero = bisect.bisect_left(a,0)
cnt = min(-sum(a[zero-k-1:zero]),sum(a[zero:zero+k+1]))
for i in range(1,k):
    if cnt > -2*a[zero-i]+a[zero+k]:
        cnt = -2*a[zero-i]+a[zero+k]
    else:
        break
for i in range(1,k):
    if cnt > -a[zero-k+i]+2*a[zero+k]:
        cnt = -a[zero-k+i]+2*a[zero+k]
    else:
        break
print(cnt)

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
c=10**10
for i in range(n-k+1):
    c=min(c,-a[i]+a[i+k-1]\
          +min(abs(a[i]),abs(a[i+k-1])))
print(c)
l=[0]*26
for h in sys.stdin:
    for i in h:
        k=ord(i.lower())
        if 96<k<123:l[k-97]+=1
for i in range(26):print chr(i+97),':',l[i]

### FIXED CODE ###

import time
import sys
import io
import re
import math
#start = time.clock()
i = [0]*127
#n = raw_input()
for x in sys.stdin.read().lower():
    i[ord(x)]+=1
for y in range(ord('a'), ord('z')+1):
    print chr(y)+ ' : ' + str(i[y])
a = int(input())
b = []
for i in range(1, a+1, 1):
    if "3" in str(i):
        b.append(i)
    elif i % 3 == 0:
        b.append(i)
    else:
        pass
for _ in b:
    print(b + " ", end='')



### FIXED CODE ###

a = int(input())
b = []
print(" ",end="")
for i in range(1, a+1, 1):
    if "3" in str(i):
        b.append(i)
    elif i % 3 == 0:
        b.append(i)
    else:
        pass
count = 0
for i in b:
    count += 1
    if len(b) == count:
        print(i)
        break
    print(i, end="")
    print(" ", end="")