Harryxun/stf_run huggingface dataset:
import heapq

N,M = map(int,input().split())
L = [list(map(int,input().split())) for i in range(N)]
ans = 0
A = []

L = sorted(L, key=lambda x: x[1],reverse=True)
L = sorted(L, key=lambda x: x[0],reverse=True)

cnt = 0

for i in range(N) :
    if i >= 1 and L[i][0] != L[i-1][0] :
        cnt = 0
    
    if (M-L[i][0]+1)-cnt <= 0 :
        continue
    if i < M :
        heapq.heappush(A,L[i][1])
        cnt += 1
    else :
        minv = heapq.heappop(A)
        if minv >= L[i][1] :
            heapq.heappush(A, minv)
        else :
            heapq.heappush(A,L[i][1])
            cnt += 1

print(sum(A))


### FIXED CODE ###

import heapq

N, M = map(int,input().split())
L = [list(map(int,input().split())) for i in range(N)]

D = {}
for i in range(N) :
    k,v = L[i]
    if k not in D :
        D[k] = [v]
    else :
        D[k].append(v)

class Heapq :
    def __init__(self, arr, desc=False) :
        if desc :
            arr = [-a for a in arr]
        self.sign = -1 if desc else 1
        self.hq = arr
        heapq.heapify(self.hq)
    
    def pop(self) :
        return heapq.heappop(self.hq) * self.sign
    
    def push(self, a):
        heapq.heappush(self.hq, a * self.sign)
 
    def top(self):
        return self.hq[0] * self.sign
 
    def size(self):
        return len(self.hq)

q = Heapq([], True)
ans = 0
for k in range(1, M+1) :
    if k in D :
        for v in D[k] :
            q.push(v)
    if q.size() :
        ans += q.pop()
print(ans)
N = int(input())
stones = input().rstrip()
pre_word = stones[0]
stones_list =[]
counter = 0

for i in range(N):
    stones_list.append(stones[i])

for i in range(N):
    present_word = stones_list[i]
    if pre_word == '#' and present_word =='.':
        counter += 1
    pre_word = stones_list[i]

print(counter)

### FIXED CODE ###

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

if ((N[0] > N[2]) and (N[1] < N[2])) or ((N[0] < N[2]) and (N[1] > N[2])):
    print("Yes")
else:
    print("No")
N = int(input())
A = list(map(int,input().split()))

step = 0
while True:
  flag = False
  for i range(N):
    if A[i] % 2 ==0:
      A[i] = A[i] / 2
      else:
        flag =True
        break
        
        if flag:
          break
          step +=1
          
print(step)          

### FIXED CODE ###

s = input()

cnt = 0

for c in s:
  if c == "1":
    cnt += 1

print(cnt)
n, k = list(map(int, input().split()))
ans = 0
while True:
    l.append(n % k)
    n = n // k
    if n // k == 0:
        l.append(n % k)
        break
ans = len(l)
print(ans)

### FIXED CODE ###

n, k = list(map(int, input().split()))
ans = 0
while True:
    n = n // k
    ans += 1
    if n == 0:
        break
print(ans)
n,k=map(int,input().split())
h = set(map(int,input().split()))

h = sorted(h)
l = len(h)
for i in range(l-k,l):
  h[i] = 0
  
result = sum(h)
print(result)


### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
for i in range(k):
  try:
    h.pop(-1)
  except IndexError:
    pass
print(sum(h))
a,b = (int,input(). split ())
print(a*b)

### FIXED CODE ###

a,b = map(int,input(). split ())
print(a*b)
N = int(input())
S = input()
if N%2 == 1:
  print('No')
else:
  for i in range(N/2):
    if S[i] != S[N/2 + i]:
      print('No')
      break
  print('Yes')
  


### FIXED CODE ###

N = int(input())
S = input()
n = N // 2
if S[:n] == S[n:]:
    print('Yes')
else:
    print('No')
n=int(input())
var=1
if n%360==0:
	print(0)
	exit()
while True:
	if (n*var)%360==0:
		print(var)
        exit()
   var+=1

### FIXED CODE ###

# for i in range(m):
# for i in range(int(input())):
#n,k= map(int, input().split())
#for _ in range(int(input())):
    #n,k= map(int, input().split())
#from collections import Counter
n=int(input())
if n%360==0:
    print(0)
    exit()
else:
    var=1
    while (var*n)%360!=0:
        var+=1
    print(var)
n = int(input())
power = 1

for i in range(1,n+1):
    power *= i
    ans = ans % (10**9 + 7)

print(ans)


### FIXED CODE ###


n = int(input())
ans = 1

for i in range(1,n+1):
    ans *= i
    ans = ans % (10**9 + 7)

print(ans)
def main():
    K = 0
    N, R = [int(_) for _ in input().split()]
    if N >= 10:
        K = R
    else:
        K = R + 100(10 - N) 
    print(K)
main()

### FIXED CODE ###

def main():
    K = 0
    N, R = [int(_) for _ in input().split()]
    if N >= 10:
        K = R
    else:
        K = R + 100 * (10 - N) 
    print(K)
main()
n = input()
lst = [int(x) for x in input().split()].sort()
alice = 0
bob = 0
while len(lst):
    alice += lst.pop(0)
    bob += lst.pop(0)
print(alice-bob)

### FIXED CODE ###

n = input()
lst = sorted([int(x) for x in input().split()], reverse=True)
alice = 0
bob = 0
for i in range(len(lst)):
    if i%2:
        bob += lst[i]
    else:
        alice += lst[i]
print(alice-bob)
N = int(input())
for i in range(0, 101):
  for j in range(0, 101):
    if i * 4 + j * 7 = N:
      print("Yes")
      exit()
print("No")

### FIXED CODE ###

N = int(input())
for i in range(0, 101):
  for j in range(0, 101):
    if i * 4 + j * 7 == N:
      print("Yes")
      exit()
print("No")
a,b = input()
a = int(a)
b = int(b)

if a>=10:
    print(b)
else:
    print(b+100*(10-a))


### FIXED CODE ###

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

if a>=10:
    print(b)
else:
    print(b+100*(10-a))
n = int(input())
a = list(map(int, input().split()))
ls = []
for i in reversed(range(n)):
    count = 0
    for lsi in ls:
        if lsi >= i and not lsi % i:
            count += 1
    if count % 2 != a[i]:
        ls.append(i+1)
print(len(ls))
print(' '.join(map(str, ls)))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ls = [0]*(n+1)
ans = []
for i in reversed(list(range(n))):
    if sum(ls[::i+1][1:]) % 2 != a[i]:
        ls[i+1] = 1
        ans.append(i+1)
print(sum(ls))
if ans: print(' '.join(map(str, ans)))
# coding: utf-8
# Your code here!
import math

N = int(input())

memo = [-1] * int(1e5)
def recursive(n):
    if memo[n] != -1:
        return memo[n]
    
    min_num_operation = int(1e9)
    
    index = int(math.log(n, 9))
    if index > 0:
        min_num_operation = min(min_num_operation, 1 + recursive(int(n - math.pow(9, index))))
        
    index = int(math.log(n, 6))
    if index > 0:
        min_num_operation = min(min_num_operation, 1 + recursive(int(n - math.pow(6, index))))
        
    min_num_operation = min(min_num_operation, n)
    
    memo[n] = min_num_operation
    
    return min_num_operation
    
 
print(recursive(N))

### FIXED CODE ###

# coding: utf-8
# Your code here!
import math
from collections import defaultdict
 
N = int(input())
 
memo = defaultdict(lambda: -1)
memo[0] = 0
def recursive(n):
    if memo[n] != -1:
        return memo[n]
    
    min_num_operation = n
    
    index = 0
    temp_n = n
    while temp_n > 0:
        if temp_n % 9 == 0:
            index += 1
            temp_n //= 9
        else:
            index += int(math.log(temp_n, 9))
            break
    if index > 0:
        min_num_operation = min(min_num_operation, 1 + recursive(int(n - math.pow(9, index))))
        
    index = 0
    temp_n = n
    while temp_n > 0:
        if temp_n % 6 == 0:
            index += 1
            temp_n //= 6
        else:
            index += int(math.log(temp_n, 6))
            break
    if index > 0:
        min_num_operation = min(min_num_operation, 1 + recursive(int(n - math.pow(6, index))))
        
    memo[n] = min_num_operation
    
    return min_num_operation
 
print(recursive(N))
a, b, n = map(int, input().split())

if (n >=b):
  x=math.floor(n/b)*b-1
  print (math.floor(a*x/b)-a*math.floor(x/b))
#  print (int(a*(int(n/b)-1./b))-a*int(int(n/b)-1./b))
else:
#  xmax=0
#  for x in range(1,n+1):
#    atai=int(a*x/b)-a*int(x/b)
#    if (atai >= xmax): xmax=atai
#  print (xmax)
  print (math.floor(a*n/b)-a*math.floor(n/b))
  


### FIXED CODE ###

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

if (b != 1):
  if (n >=b):
    x=math.floor(n/b)*b-1
    print (math.floor(a*x/b)-a*math.floor(x/b))
  else:
    print (math.floor(a*n/b)-a*math.floor(n/b))
else:
  print (0)
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    n, x = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    M = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    mmin = min(M)

    reall = x - sum(M)

    cnt = n + int(reall / mmin)
 #   for i in M:
 #       if reall >= i:
 #           cnt += 1


    print(cnt)


resolve()

### FIXED CODE ###

def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    n, x = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    M = [int(input()) for i in range(n)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    mmin = min(M)

    reall = x - sum(M)

    cnt = n + int(reall // mmin)

    print(cnt)


resolve()
N = input()
if N == 1:
    print('Hello World')
    exit()
else:
    A, B = map(int, input().split())
    print(A+B)


### FIXED CODE ###

N = int(input())
if N == 1:
    print('Hello World')
else:
    print(int(input()) + int(input()))
n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if b[0]==0:
    k-=1
ans=10**10
if na>=k and na!=0:
    ans=-a[-k]

for i in range(1,nb+1):
    m=k-i
    if m>na or m<0:
        continue
    elif 0<m<=na:
        ans=min(ans,min(b[i-1]-2*a[-m],2*b[i-1]-a[-m]))
    elif m==0:
        ans=min(ans,b[k-1])
print(ans if k!=0 else 0)


### FIXED CODE ###

n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if 0 in x:
    k-=1
    b=[x[i] for i in range(n) if x[i]>0]
    nb=nb-1

if k==0:
    print(0)
    exit()
ans=10**10
if na>=k:
    ans=-a[-k]

if nb>=k:
    ans=min(ans,b[k-1])

if nb==0:
    print(-a[-k])
    exit()

if na==0:
    print(b[k-1])
    exit()

for i in range(1,nb+1):
    m=k-i
    if m>na or m<0:
        continue
    elif 0<m<=na:
        ans=min(ans,min(b[i-1]-2*a[-m],2*b[i-1]-a[-m]))
    elif m==0:
        ans=min(ans,b[k-1])
print(ans if k!=0 else 0)
n,x=map(int, input().split())
llist=list(map(int, input().split()))
point=0
cnt=0
while point<=x:
  cnt+=1
  point+=llist[cnt]
  if cnt>n:
    break
print(cnt)


### FIXED CODE ###

n,x=map(int, input().split())
llist=list(map(int, input().split()))
point=0
cnt=1
for i in range(n):
  point+=llist[i]
  if(point<=x):
    cnt+=1
print(cnt)
a = int(input())
b = [int(str) for str in input().split()]
c = [0,0,0,0,0]

for n in range(a):
  if b[n]%2 == 0:
    if b[n]%3 != 0 and b[n]%5 != 0:
      c[n] = 1

if sum(c) == 0:
  print('APPROVED')
else:
  print('DENIED')

### FIXED CODE ###

a = int(input())
b = [int(str) for str in input().split()]
c = [0]*a

for n in range(a):
  if b[n]%2 == 0:
    if b[n]%3 != 0 and b[n]%5 != 0:
      c[n] = 1

if sum(c) == 0:
  print('APPROVED')
else:
  print('DENIED')
l = [int(input()) for i in range(5)]
time = 0
for v in l:
  if v %10 == 0:
    time += v
    l.remove(v)
if l == []:
  print(time)
  return
m = min(list(map(lambda x:x%10,l)))
find_min = False
for v in l:
  if v %10 == m && not find_min:
    time += v
  else:
    time += calc_time(v)
print(time)

def calc_time(t):
  return (int(t/10)+1 )*10

### FIXED CODE ###

l = [int(input()) for i in range(5)]
rest = []
time = 0
for v in l:
  if v %10 == 0:
    time += v
  else:
    time += int(v/10)*10
    rest.append(v%10)
#print(rest)
if rest != []:
  time += ((len(rest)-1)*10)
  time += min(rest)
print(time)
import numpy as np
H, W = map(int,input().split())
S_pre = []
for i in range(H):
    S_i = list(input().split())
    S_pre.append(S_i)
    black = [j for j,x in enumerate(S_i) if x == '#']
       
S = np.array(S_pre)


### FIXED CODE ###

N = int(input())
H = int(input())
W = int(input())
x = (N - H + 1) * (N - W + 1)
print(x)
n = int(input())
a = [[] for i in range(n)]

a = [int(i) for i in input().split()]
b = [0]*(n+1)

for i in a:
    b[i] +=1

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

def ans(N):
    if N >= 2:
        return(cmb(N,2))
    else: return(0)

cnt=0
for j in b: cnt += ans(j)
for i in a:
    temp = cnt
    temp = temp - (ans(b[i])- ans(b[i]-1))
    print(temp)


### FIXED CODE ###

from operator import mul
from functools import reduce

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

a = [int(i) for i in input().split()]
b = [0]*(n+1)

for i in a:
    b[i] +=1

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 ans(N):
    if N >= 2:
        return(cmb(N,2))
    else: return(0)

cnt=0
for j in b: cnt += ans(j)
for i in a:
    temp = cnt
    temp = temp - (ans(b[i])- ans(b[i]-1))
    print(temp)
n, ma, mb = map(int, input().split())
a = [0] * n
b = [0] * n
c = [0] * n
for i in range(n):
    a[i], b[i], c[i] = map(int, input().split())

M = 401
INF = 10 ** 15
min_cost = dict()
min_cost[0, 0] = 0

for k in range(n):
    keys = min_cost.keys()
    for i, j in reversed(sorted(keys)):
        if i + a[k] < M and j + b[k] < M:
            cc = min_cost[i][j] + c[k]
            if cc < min_cost[i + a[k]][j + b[k]]:
                min_cost[i + a[k]][j + b[k]] = cc

res = INF
for i in range(1, M):
    for j in range(1, M):
        if i * mb == j * ma:
            if min_cost[i][j] < res:
                res = min_cost[i][j]

if res == INF:
    res = -1
print(res)

### FIXED CODE ###


n, ma, mb = map(int, input().split())
a = [0] * n
b = [0] * n
c = [0] * n
for i in range(n):
    a[i], b[i], c[i] = map(int, input().split())

M = 401
INF = 10 ** 15
min_cost = [[INF] * M for k in range(M)]
s = set()
min_cost[0][0] = 0
s.add((0, 0))

for k in range(n):
    ss = set(s)
    for i, j in reversed(sorted(s)):
        if i + a[k] < M and j + b[k] < M:
            cc = min_cost[i][j] + c[k]
            if cc < min_cost[i + a[k]][j + b[k]]:
                ss.add((i + a[k], j + b[k]))
                min_cost[i + a[k]][j + b[k]] = cc
    s = ss

res = INF
for i in range(1, M):
    for j in range(1, M):
        if i * mb == j * ma:
            if min_cost[i][j] < res:
                res = min_cost[i][j]

if res == INF:
    res = -1
print(res)
N = int(input())


def fsod(n):
    sum = 0
    while n >= 1:
        sum += n % 10
        n //= 10
    return sum


print(min([fsod(A) + fsod(N-A) for A in range(1, N // 2)]))

### FIXED CODE ###

N = int(input())


def fsod(n):
    sum = 0
    while n >= 1:
        sum += n % 10
        n //= 10
    return sum


print(min([fsod(A) + fsod(N-A) for A in range(1, N // 2 + 1)]))
import sys
from pprint import pprint

def solve(n, m, a):
    sum = 1
    a_pre = 0
    for a_i in a:
        if a_pre != 0 and a_pre == a_i:
            return 0
        if a_i == 1:
            a_pre = a_i + 1
            continue
        pattern = (a_i - 1 - a_pre - 1)
        #print pattern
        sum *= 2**pattern
        a_pre = a_i + 1
    pattern = (n - a_pre - 1)
    #print pattern
    sum *= 2**pattern

    return sum % 1000000007


if __name__ == '__main__':

    n, m = map(int, sys.stdin.readline().strip().split(" "))
    a = []
    for i in range(m):
        a.append(int(sys.stdin.readline().strip()))
    print solve(n, m, a)

### FIXED CODE ###

import sys

N, M = map(int, sys.stdin.readline().strip().split())
A = set()
for _ in range(M):
    A.add(int(sys.stdin.readline()))

# i段目の階段への到達方法の数
dp = [0 for _ in range(N+1)]
dp[0] = 1
dp[1] = 0 if 1 in A else 1

for i in range(2, N+1):
    if i in A:
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= 1000000007

print(dp[N])
N=int(input())
H=list(map(int,input().split()))
ans=0
for i in range(len(H)):
    if i==0:
        ans+=1
    elif max(H[0:i])<=H[i]:
        ans+=1
print(ans)

### FIXED CODE ###

A,B=map(int,input().split())
ans=0
if A-B>=1:
    ans=A+A-1
elif A==B:
    ans=A+B
elif B-A>=1:
    ans=B+B-1
print(ans)
A B = map(int, input().split())
print((A+B)%24)

### FIXED CODE ###

A, B = map(int, input().split())
print((A+B)%24)
import math
import numpy as np
a = int(input())
t = [list(map(int, input().split())) for i in range(a)]
x = 0
for i in range(a):
    for j in range(a):
        x = x + np.sqrt((t[i][0]-t[j][0])**2 +(t[i][1]-t[j][1])**2)
print(x*math.factorial(a-1)/(math.factorial(a)))  

### FIXED CODE ###

import math
a = int(input())
t = [list(map(int, input().split())) for i in range(a)]
x = 0
for i in range(a):
    for j in range(a):
        x = x + ((t[i][0]-t[j][0])**2 +(t[i][1]-t[j][1])**2)**0.5
print(x*math.factorial(a-1)/(math.factorial(a)))
X, Y = map(int, input().split())

mod = 10**9 + 7

# ある座標に来るパターンの数を記録するDPテーブル
dp = [[0 for _ in range(X+1)] for _ in range(Y+1)]

# 初期位置を設定
dp[0][0] = 1

for y in range(Y+1):
    for x in range(X+1):
        if (x-2) >= 0 and (y-1) >= 0:
            dp[x][y] += int(dp[x-2][y-1] % mod)
        if (x-1) >= 0 and (y-2) >= 0:
            dp[x][y] += int(dp[x-1][y-2] % mod)
        dp[x][y] %= mod

print(dp[X][Y])

### FIXED CODE ###

def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)
    
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac


X, Y = map(int, input().split())
# 後の、n, mの大小を一定にするため
if X > Y:
    X, Y = Y, X
dist = X + Y
   
if dist % 3 != 0:
    print(0)
else:
    # (+1,+2) の移動の回数を n、(+2,+1) の移動の回数を m とする)
    # total = n + m
    # 以下の式は、2n + m = X, n + 2m = Y の連立方程式を解いた結果
    total = int((X+Y) / 3)
    n = X - total
    
    # n < 0 もしくは m < 0 の場合、たどり着けない
    # Y > X なので、m > n
    # n < 0 → 2X - Y < 0
    if Y > 2*X:
        print(0)
    else:
        MOD = 10**9 + 7

        fac, ifac = make_tables(MOD, total)
        ans = cmb(total, n, MOD, fac, ifac)
        print(ans)
N = int(input())
S = [str(input()) for i in range(N)]
print(len(set(S)))

### FIXED CODE ###

S, W = map(int,input().split())
print('unsafe'if W >= S else 'safe')
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-2:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i]
    i += 1        
print(flag)
    

### FIXED CODE ###

N = int(input())
T = [[0,0,0]]+[ [int(x) for x in input().split()] for _ in range(N)]

flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = abs(x2-x1)+abs(y2-y1)
    _t = t2-t1
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
    i += 1        
print(flag)
a,b,c,d,e,f = input()
if (c==d) and (e==f) : print("Yes")
else print("No")

### FIXED CODE ###

a,b,c,d,e,f = input()
if (c==d) and (e==f) : print("Yes")
else : print("No")
#!/usr/bin/python
# coding: UTF-8


len = int(input())
src = input()
t = int(input())
pt = src[t]
print(src.replace(pt,"*"))

### FIXED CODE ###

#!/usr/bin/python
# coding: UTF-8

import re

len = int(input())
src = input()
t = int(input())
pt = "[^"+src[t-1]+"]"
print(re.sub(pt,"*",src))
point=[ list(map(int,input().split())) for i range (N)]
D=input()
def distance():
  s=0
  for i in range(N)
      if (point[i][0]**2+point[i][1]**2)**(1/2)<=int(D):
          s=s+1
    return s
answer = distance(point)
print(answer)

### FIXED CODE ###

N,D = map(int, input().split())
XY = [map(int, input().split()) for _ in range(N)]
X,Y = [list(i) for i in zip(*XY)]

s=0
for i in range (N):
  if X[i]*X[i]+Y[i]*Y[i]<=D*D:
    s=s+1
print(s)
#coding: utf-8
amount = int(input())
strings = list(map(str, [input() for i in range(amount)]))
sum = 0

for i in range(len(strings)):
	# print(strings[i])
	abc = list(strings[i])
	abc.sort()
	strings[i] = ''.join(abc)
	# print(strings[i])

strings.sort()

for j in range(len(strings-1)):
	# print(j)
	if strings[j] == strings[j+1]:
		sum = sum+1

print(sum)


### FIXED CODE ###

#coding: utf-8
amount = int(input())
strings = list(map(str, [input() for i in range(amount)]))
sum = 0
sum2 = 0

for i in range(len(strings)):
	# print(strings[i])
	abc = list(strings[i])
	abc.sort()
	strings[i] = ''.join(abc)
	# print(strings[i])

strings.sort()

for j in range(len(strings)-1):
	# print(j+1)
	# print(strings[j]+strings[j+1])
	if strings[j] == strings[j+1]:
		sum2 = sum2+1
	else:
		sum = sum + sum2 * (sum2+1) / 2
		sum2 = 0

sum = sum + sum2 * (sum2+1) / 2
print(int(sum))
distances = [int(input()) in _ for range(5)]
K = int(input())

if distances[-1] - distances[0] > K:
  print(":(")
else:
  print("Yay!")
  

### FIXED CODE ###

distances = [int(input()) for _ in range(5)]
K = int(input())
 
if distances[-1] - distances[0] > K:
  print(":(")
else:
  print("Yay!")
Coodinate, K, Distance = map(int, input().split())

dp = [0]*(K+1)
dp[0] = Coodinate
#dp[1] = min( abs(dp[0]+Coodinate), abs(dp[0]-coodinate) )
count = 0
for i in range(1,K+1):
    dp[i] = min( abs(dp[i-1]+Distance), abs(dp[i-1]-Distance) )
    #if dp.count(dp[i]) == 2:
    #    break
    #else:
    #    count += 1
#print(count)
#print(dp)
print(dp[K])


### FIXED CODE ###

first_place, K, Distance = map(int, input().split())
first_place = abs(first_place)
test = first_place
if first_place - Distance*K > 0:
    print(first_place -Distance*K)
else:
    for i in range(1,K+1):
        test -= Distance
        if test <= 0:
            a = i
            #print(a)
            break
    if (K-a)%2 == 0 or K-a == 0:
        print(abs(first_place - Distance*a))
    else:
        print(abs(first_place - Distance*(a-1)))
#!/usr/bin/python3
# -*- coding:utf-8 -*-


def main():
  n, m = map(int, input().split())
  lxyz = [[0]*3 for _ in range(n)]
  for i in range(n):
    lxyz[i] = list(map(int, input().split()))
  
  def binary(x, k, t=1, f=0):
    return [t if (x >> ik)%2 else f for ik in range(k)]
  
  def calc_dp(lxyz):
    dp = [
      [
        [0] * 3
        for _ in range(m)]
      for _ in range(n)]

    max_score = -(10 ** 15) 
    max_xyz = lxyz[0]
    for i in range(n):
      score = sum(lxyz[i])
      if score > max_score:
        max_xyz = lxyz[i]
        max_score = score
      dp[i][0] = max_xyz
      
    for i in range(1, n):
      for j in range(1, m):
        if i == j == 0: 
          continue
        use_i = list(map(sum, zip(dp[i-1][j-1], lxyz[i])))
        if sum(use_i) > sum(dp[i-1][j]):
          dp[i][j] = use_i
        else:
          dp[i][j] = dp[i-1][j]
    return sum(dp[-1][-1])
    
  
  ans = -1
  for lh in [binary(i, 3, f=-1) for i in range(8)]:
    _lxyz = [[0]*3 for _ in range(n)]
    for j, h in enumerate(lh):
        for i in range(n):
          _lxyz[i][j] = h * lxyz[i][j]    
    ans = max(ans, abs(calc_dp(_lxyz))) 
  print(ans)
  
if __name__=='__main__':
  main()



### FIXED CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n, m = map(int, input().split())
  lxyz = [[0]*3 for _ in range(n)]
  for i in range(n):
    lxyz[i] = list(map(int, input().split()))
  
  def binary(x, k, t=1, f=0):
    return [t if (x >> ik)%2 else f for ik in range(k)]
  
  ans = -1
  for lh in [binary(i, 3, f=-1) for i in range(8)]:
    ans = max(ans, abs(sum(sorted([sum(map(lambda x: x[0]*x[1], zip(lh, lxyz[i]))) for i in range(n)], reverse=True)[:m]))) 
  print(ans)
  
if __name__=='__main__':
  main()
def main():
    loop_count = 0
    while 1:
        loop_count += 1
        param = raw_input()
        if param == "0":
            break
        else:
            print "Case %s: %s" %(loop_count,param)

if__name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    loop_count = 0
    while 1:
        loop_count +=1
        param = raw_input()
        if param == "0":
            break
        else:
            print "Case %s: %s" % (loop_count,param)

if __name__ == '__main__':
    main()