Harryxun/stf_run huggingface dataset:
import sys
from functools import lru_cache


@lru_cache(maxsize=None)
def dfs(v):
    return max((dfs(u) for u in links[v]), default=-1) + 1


n, m = map(int, input().split())
sss = set(range(n))
links = [set() for _ in range(n)]
for line in sys.stdin.readlines():
    x, y = map(int, line.split())
    x -= 1
    y -= 1
    sss.discard(y)
    links[x].add(y)

print(max(dfs(v) for v in sss))


### FIXED CODE ###

import sys
from functools import lru_cache

sys.setrecursionlimit(1000000)


@lru_cache(maxsize=None)
def dfs(v):
    lv = links[v]
    return max(map(dfs, lv)) + 1 if lv else 0


n, m = map(int, input().split())
sss = set(range(n))
links = [set() for _ in range(n)]
for line in sys.stdin.readlines():
    x, y = map(int, line.split())
    x -= 1
    y -= 1
    sss.discard(y)
    links[x].add(y)

print(max(map(dfs, sss)))
l = input().split()
print(l(0) * l(1) - (l(0) + l(1) -1))

### FIXED CODE ###

a, b = map(int, input().split())
 
print((a - 1) * (b - 1))
N,K = map(int,input().split())
a = list(map(int,input().split()))
b = []
dis = N-K+1
for i in range(dis):
  b.append(min(abs(a[i])+abs(a[i]-a[i+dis-1]),abs(a[i+dis-1])+abs(a[i+dis-1]-a[i])))
print(min(b))
    

### FIXED CODE ###

N,K = map(int,input().split())
a = list(map(int,input().split()))
b = []
dis = N-K+1
for i in range(dis):
  b.append(min(abs(a[i])+abs(a[i]-a[i+K-1]),abs(a[i+K-1])+abs(a[i+K-1]-a[i])))
print(min(b))
import numpy as np

def test():
    n = int(input())
    a = np.array(list(map(int,input().split())))
    if all(x%a.min() == 0 for x in a):
        print(a.min())
    else:
        a = sorted(list(set(a//a.min())))
        print(a[1]-a[0])


if __name__ == "__main__":
    test()


### FIXED CODE ###

import fractions

def test():
    n = int(input())
    a = list(map(int,input().split()))
    ans = a[0]
    for i in a:
        ans = fractions.gcd(ans,i)
    print(ans)


if __name__ == "__main__":
    test()
p=input()
if p='ABC':
  print('ARC')
else:
  print('ABC')

### FIXED CODE ###

p=input()
if p=='ABC':
  print('ARC')
else:
  print('ABC')
n = int(input())
count = 0
for c in range(n):
	ab = n - c
    if ab % a = 0:
      count += 1
print(count)

### FIXED CODE ###

n = int(input())
count = 0
for a in range(1,n):
    count += (n-1)//a
print(count)
b = str(input())
if (b == "A"):
  print("T")
elif (b == "T"):
  print("A")
elif (b == "c"):
  print("G")
elif (b == "G")
  print("C")

### FIXED CODE ###

b = str(input())
if (b == "A"):
  print("T")
elif (b == "T"):
  print("A")
elif (b == "C"):
  print("G")
elif (b == "G"):
  print("C")
s = input()
t = input()

len_s = len(s)
dp = [[-1 for _ in range(len_s)] for _ in range(26)]
# dp[i][j] = いまsのj文字目にいる。次に探しているのはアルファベットのi文字目であるとき、次までの必要文字数。
# print(len(dp))
# print(len(dp[0]))

for idx in range(len_s):

	ch = s[idx]
	i = ord(ch)-ord("a")
#	for j in range(len_s):
	if dp[i][0] == -1:
		dp[i] = [idx] * len_s
	else:
		temp = dp[i][j]
		dp[i][temp+1:idx] = idx

ans = 0
j = 0
first = True
for ch in t:

	i = ord(ch)-ord("a")

	if dp[i][j] < 0:
		print(-1)
		exit()

	distance = dp[i][j] - j
	if (not first )and distance <= 0 :
		distance += len_s
	ans += distance
	j = dp[i][j]

	first = False

print(ans + 1)


### FIXED CODE ###

# https://img.atcoder.jp/abc138/editorial.pdf
# https://www.youtube.com/watch?v=lWETOlGiuaI
# このコードは公式解説動画をまんまpythonにしたものです。

# 解説動画
# s = abacaababc (10文字)の場合は
# a: [0, 2, 4, 5, 7, 10, 12, 14, 15, 17]
# b: [1, 6, 8, 11, 16, 18]
# c: [3, 9, 13, 19]
# という二重配列をまず作る。

# 例えばt = 'bbcca'だと
# 現在位置0、bを探す→1
# 現在位置1、bを探す→6
# 現在位置6、cを探す→9
# 現在位置9、cを探す→13(3に戻す)
# 現在位置3、aを探す→4
# で答えは14。


# 解説pdf曰く：
# next(ch, i):=「s'のi文字目以降で文字種chが最初に現れる位置」を
# をO(文字種数×|S|)かけて事前に全て求める

# 文字の先頭に戻る可能性があるので、2回連結しておくと処理が楽になる

from bisect import bisect_left

s = input()
t = input()
n = len(s)
m = len(t)

index_list = [[] for _ in range(26)]

for i in range(n):
    index_list[ord(s[i]) - ord('a')].append(i)
for i in range(n):
    index_list[ord(s[i]) - ord('a')].append(i+n)

p = 0  # p以降
ans = 0
for j in range(m):
    ch = ord(t[j]) - ord('a')
    if len(index_list[ch]) == 0:
        # t内に出現する文字が、sに全く登場しないので、不可
        print(-1)
        exit()
    next_pos = bisect_left(index_list[ch], p)
    p = index_list[ch][next_pos] + 1
    if p >= n:
        p -= n
        ans += n
    # print(p)

ans += p
print(ans)
N = int(input())

L_2 = 2
L_1 = 1
for i in range(N-1):
    L = L_1+L_2
    L_2 = L_1
    L_1 = L
print(L)


### FIXED CODE ###

N = int(input())

if N == 0:
    print(2)
    exit()
elif N == 1:
    print(1)
    exit()

L_2 = 2
L_1 = 1
for i in range(N-1):
    L = L_1+L_2
    L_2 = L_1
    L_1 = L
print(L)
while 1:
 x, y = map(int, raw_input().split())
 if x <= y:
    print "%d %d" % (x,y)
 if y < x:
    print "%d %d" % (y,x)
 if x == 0 and y == 0:
    break

### FIXED CODE ###

while 1:
   x, y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   elif x > y:
      print '%s %s' % (y,x)
   else:
      print '%s %s' % (x,y)
n = int(input())

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

isOk = False
i = 0
j = 0
constant = -1

for i in range(101):
    for j in range(101):

        constant = -1
        for xyhTemp in xyh:
            if xyhTemp[2] != 0:
                temp = xyhTemp[2] + abs(i - xyhTemp[0]) + abs(j - xyhTemp[1])

                if constant == -1:
                    constant = temp

                if constant != temp:
                    break
        else:

            for p in xyh:
                if p[2] == 0 and constant - abs(i - p[0]) - abs(j - p[1]) > 0:
                    break
            else:
                isOk = True
                break
        
    if isOk:
        break

print(i, j, constant)
        


### FIXED CODE ###

n = int(input())

if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)
# coding:utf-8
a = list(raw_input().split().lower())
dict = {}
for i in range(26):
    dict[chr(ord('a')+i)] = 0
for i in a:
    for key,value in dict.items():
        if key == i:
            dict[key] += 1
for key,value in sorted(dict.items()):
    print "%s : %d" % (key,value)



### FIXED CODE ###

# coding:utf-8
import sys
a = []
for line in sys.stdin:
    a.append(list(line.strip().replace(" ","").lower()))
a = reduce(lambda x,y: x+y,a)
dict = {}
for i in range(26):
    dict[chr(ord('a')+i)] = 0
for i in a:
    for key,value in dict.items():
        if key == i:
            dict[key] += 1
for key,value in sorted(dict.items()):
    print "%s : %d" % (key,value)
#13:19
n = int(input())
s = input()
t = []
for i in range(n):
  t.append(ord(s[i])-ord('a'))
q = int(input())
scale = 3
seg = [[0 for _ in range(2**(scale+1))] for _ in range(26)]
for i in range(n):
  tmp = int(i) + 2 ** scale
  x = t[i]
  while tmp != 0:
    seg[x][tmp] += 1
    tmp //= 2
#print(seg)
#print(seg[2])
for _ in range(q):
  d,a,b = input().split()
  if d == '1':
    b = ord(b) - ord('a')
    tmp = int(a) - 1
    c = t[tmp]
    tmp += 2**scale
    while tmp != 0:
      seg[c][tmp] -= 1
      tmp //= 2
    tmp = int(a) - 1
    t[tmp] = b
    tmp += 2**scale
    while tmp != 0:
      seg[b][tmp] += 1
      tmp //= 2
  else:
    a = int(a) - 2
    b = int(b) - 1
    ans = 0
    for d in range(26):
      l = 0
      r = 0
      if a == -1:
        l = 0
      else:
        tmp = a + 2**scale
        l += seg[d][tmp]
        while tmp != 1:
          if tmp % 2 == 1:
            l += seg[d][tmp-1]
          tmp //= 2
      tmp = b + 2**scale
      r += seg[d][tmp]
      while tmp != 1:
        if tmp % 2 == 1:
          r += seg[d][tmp-1]
        tmp //= 2
      if r > l:
        ans += 1
      #print(d,r,l)
    print(ans)
#print(t)

### FIXED CODE ###

#13:19
n = int(input())
s = input()
t = []
for i in range(n):
  t.append(ord(s[i])-97)
q = int(input())
scale = 19
seg = [[0 for _ in range(2**(scale+1))] for _ in range(26)]
for i in range(n):
  tmp = int(i) + 2 ** scale
  x = t[i]
  while tmp != 0:
    seg[x][tmp] += 1
    tmp //= 2
#print(seg)
raw = []
for _ in range(q):
  d,a,b = input().split()
  d = int(d)
  if d == 1:
    a = int(a) - 1
    b = ord(b) - 97
  else:
    a = int(a) - 2
    b = int(b) - 1
  raw.append([d,a,b])
for p in range(q):
  d,a,b = raw[p]
  if d == 1:
    tmp = int(a)
    c = t[tmp]
    tmp += 2**scale
    while tmp != 0:
      seg[c][tmp] -= 1
      tmp >>= 1
    tmp = int(a)
    t[tmp] = b
    tmp += 2**scale
    while tmp != 0:
      seg[b][tmp] += 1
      tmp >>= 1
  else:
    ans = 0
    for d in range(26):
      l = 0
      r = 0
      if a == -1:
        l = 0
      else:
        tmp = a + 2**scale
        l += seg[d][tmp]
        while tmp != 1:
          if tmp & 1:
            l += seg[d][tmp-1]
          tmp >>= 1
      tmp = b + 2**scale
      r += seg[d][tmp]
      while tmp != 1:
        if tmp & 1:
          r += seg[d][tmp-1]
        tmp >>= 1
      if r > l:
        ans += 1
      #print(d,r,l)
    print(ans)
#print(t)
N,K = map(int,input().split())
x = list(map(int,input().split()))
ans=float("inf")

for i in range(K):
    if i + K > N+1:
        break
    else:
        a = min(abs(x[K+i-1]),abs(x[i])) 
        ans = min(ans,x[K+i-1]-x[i]+a)
print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
x = list(map(int,input().split()))
ans=float("inf")

for i in range(N-K+1):
    if i + K == N+1:
        break
    else:
        a = min(abs(x[K+i-1]),abs(x[i])) 
        ans = min(ans,x[K+i-1]-x[i]+a)
print(ans)
# -*- coding:utf-8 -*-
n=int(raw_input())
for i in range(n):
    a,b,c,d,e,f,g,h=map(float,raw_input().split())
    t=(d-b)/(c-a)
    y=(h-f)/(g-e)
    if y==t or y==-t:
        print "YES"
    else:
        print "NO",

### FIXED CODE ###

n = int(raw_input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().split())
    print "YES" if abs(((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3))) < 1e-10 else "NO"
a = map(int, input())

probability = 0.0
if a%2 == 0:
  probability = 0.5
else:
  probability = 1.0/float(a)*(a/2 + 1)
  
print(probability)

### FIXED CODE ###

a = int(input())

probability = 0.0
if a%2 == 0:
	probability = 0.5
else:
	probability = 1.0/float(a)*(int(a/2) + 1)
  
print(probability)
n = int(input())
nums = [int(i) for i in input().split(" ")]

approved = True
for num in nums:
  if num%2 == 0:
    approved = (num%3 == 0) | (num%5 == 0)
if approved:
  print('APPROVED')
else:
  print('DENIED')
  

### FIXED CODE ###

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

if (a == b) and (b == c):
  print('No')
elif (a == b) or (b == c) or (a == c):
  print('Yes')
else:
  print('No')
a,b,c,k=[int(i) for i in input().split()]
print(k if k<= a else a if k <=a+b else 2a+b-k)

### FIXED CODE ###

a,b,c,k=[int(i) for i in input().split()]
print(k if k<=a else a if k <=a+b else 2*a+b-k)
import numba
from numba import jit
import numpy as np
 
def main(r, c):
  dp = np.zeros((c+1, 4), np.int64)
  for i in range(r):
    new_dp = np.zeros((c+1, 4), np.int64)
    for j in range(4):
      new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,j])
    dp = new_dp
    for k in range(c):
      for l in range(2, -1, -1):
        dp[k,l+1] = max(dp[k,l+1], dp[k,l]+item_map[i,k])
      for m in range(1,4):
        dp[k+1,m] = max(dp[k+1,m], dp[k,m])
  return max(dp[c-1,:])
 
R, C, K = map(int, input().split())
item_lis = list(list(map(int, input().split())) for i in range(K))
item_map = np.zeros((R, C), np.int64)
for i,j,k in item_lis:
  item_map[i-1,j-1] = k
 
print(main(R, C))
import numpy as np

def main(r, c):
  dp = np.zeros((c+1, 4), np.int64)
  for i in range(r):
    new_dp = np.zeros((c+1, 4), np.int64)
    for j in range(4):
      new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,j])
    dp = new_dp
    for k in range(c):
      for l in range(2, -1, -1):
        dp[k,l+1] = max(dp[k,l+1], dp[k,l]+item_map[i,k])
      for m in range(1,4):
        dp[k+1,m] = max(dp[k+1,m], dp[k,m])
  return max(dp[c-1,:])
 
R, C, K = map(int, input().split())
item_lis = list(list(map(int, input().split())) for i in range(K))
item_map = np.zeros((R, C), np.int64)
for i,j,k in item_lis:
  item_map[i-1,j-1] = k
 
print(main(R, C))
提出情報
提出日時

### FIXED CODE ###

import numba
from numba import jit
import numpy as np
 
#(i,j)→(i+1,j)のように動くときはアイテムを入手できる回数がリセットされる
#dp[列][今、何個アイテムを取ったか]でdpテーブルを作る
@jit
def main(r, c):
  dp = np.zeros((c+1, 4), np.int64)
  for i in range(r):
    new_dp = np.zeros((c+1, 4), np.int64)
    for j in range(4):
      new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,j])
    dp = new_dp
    for k in range(c):
      for l in range(2, -1, -1):
        dp[k,l+1] = max(dp[k,l+1], dp[k,l]+item_map[i,k])
      for m in range(1,4):
        dp[k+1,m] = max(dp[k+1,m], dp[k,m])
  return max(dp[c-1,:])
 
R, C, K = map(int, input().split())
item_lis = list(list(map(int, input().split())) for i in range(K))
item_map = np.zeros((R, C), np.int64)
for i,j,k in item_lis:
  item_map[i-1,j-1] = k
 
print(main(R, C))
x,y = map(int,input().split())
p = []
ans = 0

for i in range(x):
    p.append(4)

for i in range(x+1):
    if sum(p)==y:
        ans = 1
        break
    else:
        p.remove(4)
        p.append(2)

if ans == 1:
    print('Yes')
else:
    if (y==2)&(x==1):
        print('Yes')
    elif (y==4)&(x==1):
        print('Yes')
    else :
        print('No')


### FIXED CODE ###

x,y = map(int, input().split())
list = []
ans = 0
for i in range(x) :
    list.append(4)

if sum(list) == y:
    print('Yes')
    ans = 1

else :
    for i in range(x) :
        list.remove(4)
        list.append(2)
        if sum(list) == y:
            print('Yes')
            ans = 1
            break

    if ans == 0:
        print('No')
x=sorted(list(input()))
y=sorted(list(input()),reverse=true)
a=""
b=""
for (p,q) in zip x,y:
  a+=p
  b+=q
if a<b:
  print("Yes")
else:
  print("No")





### FIXED CODE ###

x=sorted(list(input()))
y=sorted(list(input()),reverse=True)
a=""
b=""
for p in x:
  a+=p
for q in y:
  b+=q
if a<b:
  print("Yes")
else:
  print("No")
N,P=map(int,input().split())
i=2
ans=1
while P!=1 or i<int(N**.5)+1:
    I=i**N
    if P%I==0:
        ans*=I
        P//=I
    elif P%i==0:
        P//=i
    else:
        i+=1
print(ans)

### FIXED CODE ###

n,p = map(int,input().split())
 
def pfact(m):
	pf = {}
	for i in range(2,int(m**0.5)+1):
		while m%i == 0:
			pf[i] = pf.get(i,0) + 1
			m //= i
	if m>1 : pf[m]=1
	return pf
 
ans = 1
for i, j in pfact(p).items():
	ans *= i**(j//n)
print(ans)
s=input()
if 'RRR' in s:
    print ('3')
if 'RR' in s:
    print ('2")
if 'R' in s:
    print('1')
else:
    print('0')

### FIXED CODE ###

s=input()
if 'RRR' in s:
    print ('3')
elif 'RR' in s:
    print ('2')
elif 'R' in s:
    print('1')
else:
    print('0')
#わからないのでギブアップコピペ
h,w=map(int,input().split())

a=[] #入力データのリスト化
for i in range(h):
  x=input().split()
  a.append(x)

h1=[]
for i in range(H):
  if a[i]==['.']*w
    h1.append(i)

w1=[]
for i in range(w):
  flag=0
  for j in range(h):
    if a[j][i]=='#':
      flag=1
      break
  if flag==0:
    w.append(i)

ans=[]
for i in range(h):
  if i not in h1:
    r=[]
    for j in range(w):
      r.append(a[i][j])
    ans.append(r)

for i in range(lens(ans)):
  print(''.join(ans[i]))

### FIXED CODE ###

#全然わからず完コピ
H,W=map(int,input().split())
a=[list(input()) for _ in range(H)]
h=[]
for i in range(H):
  if a[i]==['.']*W:
    h.append(i)

w=[]
for i in range(W):
  flag=0
  for j in range(H):
    if a[j][i]=='#':
      flag=1
      break
  if flag==0:
    w.append(i)
  
ans=[]
for i in range(H):
  if i not in h:
    r=[]
    for j in range(W):
      if j not in w:
        r.append(a[i][j])
    ans.append(r)

for i in range(len(ans)):
  print("".join(ans[i]))
n,m=map(int, input().split())
list1=[list(map(int,input().split())) for i in range(m)]

if m

ans=['x']*n
non=0
for i in range(m):
    if ans[list1[i][0]-1]!='x':
        if int(ans[list1[i][0]-1])==list1[i][1]:
            continue
        else:
            non=-1
            break
    else:
        ans[list1[i][0]-1]=str(list1[i][1])

if non==-1:
    print(-1)
else:
    if ans[0]=='0':
        print(-1)
    else:
        if 'x' in ans:
            if ans[0]=='x':
                ans[0]='1'
            else:
                for i in range(n):
                    if ans[i]=='x':
                        ans[i]='0'
        K=''
        for i in range(n):
            K+=ans[i]
        print(int(K))

### FIXED CODE ###

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

ans=['x']*n
non=0
for i in range(m):
    if ans[list1[i][0]-1]!='x':
        if int(ans[list1[i][0]-1])==list1[i][1]:
            continue
        else:
            non=-1
            break
    else:
        ans[list1[i][0]-1]=str(list1[i][1])

if non==-1:
    print(-1)
else:
    if ans[0]=='0' and n!=1:
        print(-1)
    else:
        if 'x' in ans:
            if ans[0]=='x' and n!=1:
                ans[0]='1'
            for i in range(n):
                if ans[i]=='x':
                    ans[i]='0'
        K=''
        for i in range(n):
            K+=ans[i]
        print(int(K))
import sys
input = sys.stdin.readline
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]

class UnionFind:
    def __init__(self,nodes):
        self.parents = {node : node for node in nodes}
    def root(self,x):
        if x == self.parents[x]:
            return x
        else:
            rt = self.root(self.parents[x])
            self.parents[x] = rt
            return rt
    def find(self,x,y):
        return self.root(x) == self.root(y)
    def union(self,x,y):
        self.parents[self.root(x)] = self.root(y)
    def get(self):
        res = defaultdict(list)
        for node, parent in self.parents.items():
            res[self.root(node)].append(node)
        # return [*res.values()]
        return list(res.values())

x,y = zip(*xy)

xi = [(x,i+1) for i,x in enumerate(x)]
yi = [(y,i+1) for i,y in enumerate(y)]

xi.sort()
yi.sort()

diffx = [(x1-x0,i0,i1) for (x0,i0),(x1,i1) in zip(xi,xi[1:])]
diffx.sort()
diffy = [(y1-y0,i0,i1) for (y0,i0),(y1,i1) in zip(yi,yi[1:])]
diffy.sort()

diffx.extend(diffy)
diffx.sort()

uf = UnionFind(list(range(1,N+1)))
ans = 0
for d,i0,i1 in diffx:
    if not uf.find(i0,i1):
        ans += d
        uf.union(i0,i1)
print(ans)




### FIXED CODE ###

from collections import defaultdict
import sys
from heapq import heappush, heappop
input = sys.stdin.readline
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
x,y = zip(*xy)

#import random
#N = 200000
#x = [random.randint(0,10**9) for i in range(N)]
#y = [random.randint(0,10**9) for i in range(N)]

def Prim(g,cost):
    h = []
    N = len(g.keys())
    visited = [False]*(N+1)
    visited[1] = True
    v = 1
    for nv in g[v]:
        heappush(h, (cost[(v,nv)], (v,nv)))
    res = []
    d = 0
    while True:
        c, (v,nv) = heappop(h)
        if visited[nv]:
            continue
        res.append((v,nv))
        d += c
        if len(res) == N-1:
            break
        visited[nv] = True
        for nnv in g[nv]:
            if not visited[nnv]:
                heappush(h, (cost[(nv,nnv)], (nv,nnv)))
    return res, d

xi = [(x,i+1) for i,x in enumerate(x)]
yi = [(y,i+1) for i,y in enumerate(y)]

xi.sort()
yi.sort()

diffx = [(x1-x0,i0,i1) for (x0,i0),(x1,i1) in zip(xi,xi[1:])]
diffy = [(y1-y0,i0,i1) for (y0,i0),(y1,i1) in zip(yi,yi[1:])]

g = defaultdict(set)
cost = defaultdict(lambda : 10**10)
for d,i0,i1 in diffx:
    g[i0].add(i1)
    g[i1].add(i0)
    cost[(i0,i1)] = min(cost[(i0,i1)],d)
    cost[(i1,i0)] = min(cost[(i0,i1)],d)
for d,i0,i1 in diffy:
    g[i0].add(i1)
    g[i1].add(i0)
    cost[(i0,i1)] = min(cost[(i0,i1)],d)
    cost[(i1,i0)] = min(cost[(i0,i1)],d)

res,ans = Prim(g,cost)
print(ans)
def resolve():
    a, b, c = map(int, input())
    return c - a + b
  
resolve()

### FIXED CODE ###

def resolve():
    a, b, c = map(int, input().split(" "))
    print(max(0, c - a + b))
    
    
resolve()
N = int(input())
cost = [list(map(int, inpu().split())) for i in range(N)]
count = 0

for i in range(N):
  if cost[i][1] == "JPY":
    count += cost[i][0]
  else:
    count += cost[i][0] * 380000.0
    
print(count)

### FIXED CODE ###

N = int(input())
cost = [list(input().split()) for i in range(N)]
count = 0

for i in range(N):
  if cost[i][1] == "JPY":
    count += float(cost[i][0])
  else:
    count += float(cost[i][0]) * 380000.0
    
print(count)
N = int(input())
A = input().split()
A = [int(n) for n in A]
for i in range(N):
  count = 0
  for j in range(len(A)):
	if i+1 == A[j]:
	  count += 1
  A.pop(i+1)
  print(count)

### FIXED CODE ###

N = int(input())
A =[int(n) for n in input().split()]
b = [0]*N
for i in A:
  b[i-1]+=1
for i in range(N):
  print(b[i])
MOD = 998244353

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

A,B = sorted((A,B))

if (A+B)*N < K:
  print(0)
  exit()

# tabulate combinations



# 拡張ユークリッド互除法
# ax + by = gcd(a,b)の最小整数解を返す
def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)


# mを法とするaの乗法的逆元
def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m


memo = [0]*(N+1)
memo[0] = memo[N] = 1
for k in range(1,N//2+1):
  v = memo[k-1]*(N-k+1)*modinv(k,MOD)
  v %= MOD
  memo[k] = memo[N-k] = v

cnt = 0

for b in range((max(0,K-N*A)-1)//B+1, (K-1)//B+1):
  a = (K-b*B)//A
  if a*A+b*B == K:
    cnt += memo[a]*memo[b]
    cnt %= MOD

print(cnt)

### FIXED CODE ###

MOD = 998244353

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

A,B = sorted((A,B))

if (A+B)*N < K:
  print(0)
  exit()

# tabulate combinations



# 拡張ユークリッド互除法
# ax + by = gcd(a,b)の最小整数解を返す
def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)


# mを法とするaの乗法的逆元
def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m


memo = [0]*(N+1)
memo[0] = memo[N] = 1
for k in range(1,N//2+1):
  v = memo[k-1]*(N-k+1)*modinv(k,MOD)
  v %= MOD
  memo[k] = memo[N-k] = v

cnt = 0

for b in range(N+1):
  a = (K-b*B)//A
  if 0 <= a <= N and a*A+b*B == K:
    cnt += memo[a]*memo[b]
    cnt %= MOD

print(cnt)
def get_difference():
	# get input from raw_input()
	n, k = map(int, raw_input().split(' '))
	l = [int(e) for e in raw_input().split(' ')]
	if n < 1:
		print "IMPOSSIBLE"
		return
	if n == 1:
		if l[0] == k:
			print "POSSIBLE"
		else:
			print "IMPOSSIBLE"
		return
	if k in l:
		print "POSSIBLE"
		return
	if k > max(l):
		print "IMPOSSIBLE"
		return
	gcd_v = reduce(gcd, sorted(l))
	if k % gcd_v == 0:
		print "POSSIBLE"
	else:
		print "IMPOSSIBLE"


if __name__ == "__main__":
	get_difference()

### FIXED CODE ###

from fractions import gcd
N, K = map(int, raw_input().split(' '))
A = map(int, raw_input().split(' '))
 
M = max(A)
G = reduce(gcd, sorted(A))
 
if not K % G and K <= M:
    print 'POSSIBLE'
else:
    print 'IMPOSSIBLE'
import sys
input = sys.stdin.readline

H, W, K = map(int, input().split())
ans = []
clm = []
num = 1
flg = 0
for i in range(H):
    cnt = 0
    res = []
    a = input()
    print(a)
    if '#' in a:
        for b in a[:-1]:
            if b == '#':
                cnt += 1
                if cnt > 1:
                    num += 1
            res.append(num)
        ans.append(res)
        num += 1
    else:
        if i == 0:
            flg = 1
            continue
        if i == H-1:
            ans.append(ans[-1])

if flg:
    ans.insert(0, ans[0])

for i in range(H):
    print(*ans[i])


### FIXED CODE ###

import sys
input = sys.stdin.readline

H, W, K = map(int, input().split())
ans = []
vac = []
num = 1
flg = 0
for i in range(H):
    cnt = 0
    res = []
    a = input()
    if '#' in a:
        for b in a[:-1]:
            if b == '#':
                cnt += 1
                if cnt > 1:
                    num += 1
            res.append(num)
        ans.append(res)
        num += 1
    else:
        if i == 0:
            flg = 1
            continue
        else:
            vac.append(i)

if flg:
    ans.insert(0, ans[0])
for k in vac:
    ans.insert(k, ans[k-1])

for a in ans:
    print(*a)