Harryxun/stf_run huggingface dataset:
import sys

s = sys.stdin.readlines()

N,C = map(int,s[0].split())
D = [[int(i) for i in s[j+1].split()] for j in range(C)]
c = [[int(i) for i in s[c+1+j].split()] for j in range(N)]

c_sum = [[0]*C for _ in range(3)]
for i in range(N):
    for j in range(N):
        c_sum[(i+j)%3][c[i][j]-1] += 1

D_sum = [[0]*C for _ in range(3)]
for i in range(C):
    for j in range(C):
        for k in range(3):
            D_sum[k][j] += D[i][j] * c_sum[k][i]

ans = 1000*500*500
for i in range(C):
    for j in range(C):
        for k in range(C):
            if i==j or j==k or k==i:
                continue
            else:
                ans = min(ans, D_sum[0][i]+D_sum[1][j]+D_sum[2][k])
print(ans)


### FIXED CODE ###

N,C = map(int,input().split())
D = [[int(i) for i in input().split()] for j in range(C)]
c = [[int(i) for i in input().split()] for j in range(N)]

c_sum = [[0]*C for _ in range(3)]
for i in range(N):
    for j in range(N):
        c_sum[(i+j)%3][c[i][j]-1] += 1

D_sum = [[0]*C for _ in range(3)]
for i in range(C):
    for j in range(C):
        for k in range(3):
            D_sum[k][j] += D[i][j] * c_sum[k][i]

ans = 1000*500*500
for i in range(C):
    for j in range(C):
        for k in range(C):
            if i==j or j==k or k==i:
                continue
            else:
                ans = min(ans, D_sum[0][i]+D_sum[1][j]+D_sum[2][k])
print(ans)
#coding:utf-8
from math import *
def fib(n):
    return round(( ((1 + sqrt(5))/2)**n - ((1 - sqrt(5))/2)**n ) / sqrt(5))
F = 10001
MD = 1000000007
ls = [0,1]
for f in range(F-2):
    s = sum(ls[-2:])
    ls.append(s)
def fib2(n):
    return ls[n]
old_a = 0
diff = []
N,M = map(int, input().split())
for m in range(M):
    a = int(input())
    if a-old_a==1 and old_a != 0:
        print (0)
        exit()
    diff.append(a-old_a)
    old_a = a
diff.append(N - old_a)
    
#print (diff)
ans = 1
for i,d in enumerate(diff):
    if i!=0 and i!=len(diff)-1:
        d-=1
    ans *= fib2(d)
    #ans %= 1000000007
print (ans % MD)
#print (ans)



### FIXED CODE ###

N, M = map(int, input().split())
MOD = 10 ** 9 + 7
ng = set([int(input()) for _ in range(M)])
ans = [0, 1] 
for i in range(1, N+1):
  if i in ng:
    ans.append(0)
  else:
    ans.append((ans[-2] + ans[-1]) % MOD)
print(ans[-1] % MOD)
a, b, c = map(int, input().split())
print(a +' '+b+' '+c)

### FIXED CODE ###

a, b, c = input().split()
print(c +' '+a+' '+b)
#include<stdio.h>
#include <string.h>
int main(void){
    int n,i,j,x[10] = {1,2,3,4,5,6,7,8,9,10};
    scanf("%d",&n);
    char s[100][11],tmp_s[11];
    int d[100],tmp_d;
    for(i=0;i<n;++i){
       scanf("%s %d",&s[i],&d[i]);
    }
    for(i=0;i<n;++i){
        for(j=i+1;j<n;++j){
            if(strcmp(s[i],s[j])>0){
                strcpy(tmp_s,s[i]);
                tmp_d = d[i];
                strcpy(s[i],s[j]);
                d[i] = d[j];
                strcpy(s[j],tmp_s);
                d[j] = tmp_d;
                tmp_d = x[i];
                x[j] =x[i];
                x[i] = tmp_d;
            }else if(strcmp(s[i],s[j])==0){
                if(d[i] > d[j]){
                    strcpy(tmp_s,s[i]);
                    tmp_d = d[i];
                    strcpy(s[i],s[j]);
                    d[i] = d[j];
                    strcpy(s[j],tmp_s);
                    d[j] = tmp_d;
                    tmp_d = x[i];
                    x[j] =x[i];
                    x[i] = tmp_d;
                }
            }
        }
    }
    for(i=0;i<n;++i){
        printf("%d\n",x[i]);
    }
    return 0;
}
            

### FIXED CODE ###

n=int(input())
array = []
for i in range(n):
    s,p = input().split()
    array.append([s,100-int(p),i+1])
array.sort()
for i in range(n):
    print(array[i][2])
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
n=  int(sys.stdin.readline())
p=list(range(2,n))
if n ==1:
    print(0)
elif n == 2:
    print(0)
else:
    print(n*(n-1)//2)

### FIXED CODE ###

import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
n=  int(sys.stdin.readline())
if n ==1:
    print(0)
elif n == 2:#なぜ？
    print(1)
else:
    print(n*(n-1)//2)
n = int(input())
if n%2==0:
    print(str(((n)/2)/n)
else:
    print(str(((n+1)/2)/n))

### FIXED CODE ###

n = int(input())
if n%2==0:
    print(str((n/2)/n))
else:
    print(str(((n+1)/2)/n))
K = input()
n = len(K)
D = int(input())
dp = [[[0]*2 for i in range(D)] for _ in range(n)]
for i in range(int(K[0])):
    dp[0][i%D][0] += 1
dp[0][int(K[0])%D][1] += 1
for i in range(n-1):
    for j in range(D):
        for d in range(10):
            dp[i+1][(j+d)%D][0]+=dp[i][j][0]
            dp[i+1][(j+d)%D][0]%=mod
        for d in range(int(K[i+1])):
            dp[i+1][(j+d)%D][0]+=dp[i][j][1]
            dp[i+1][(j+d)%D][0]%=mod
        dp[i+1][(j+int(K[i+1]))%D][1] += dp[i][j][1]
        dp[i+1][(j+int(K[i+1]))%D][1]%=mod


print(dp[-1][0][0]+dp[-1][0][1]-1)




### FIXED CODE ###

mod = 10**9+7
K = input()
n = len(K)
D = int(input())
dp = [[[0]*2 for i in range(D)] for _ in range(n)]
for i in range(int(K[0])):
    dp[0][i%D][0] += 1
dp[0][int(K[0])%D][1] += 1
for i in range(n-1):
    for j in range(D):
        for d in range(10):
            dp[i+1][(j+d)%D][0]+=dp[i][j][0]
            dp[i+1][(j+d)%D][0]%=mod
        for d in range(int(K[i+1])):
            dp[i+1][(j+d)%D][0]+=dp[i][j][1]
            dp[i+1][(j+d)%D][0]%=mod
        dp[i+1][(j+int(K[i+1]))%D][1] += dp[i][j][1]
        dp[i+1][(j+int(K[i+1]))%D][1]%=mod
print((dp[-1][0][0]+dp[-1][0][1]-1)%mod)
import math

a, b = map(int,input().split())
c = b - a
for i in range(1,999):
  d = sum(range(i+1)) - sum(range(i))
  if d == c:
    e = sum(range(i)) - a
print(e)

### FIXED CODE ###

import math

a, b = map(int,input().split())
c = b - a
for i in range(1,999):
  d = sum(range(1,i+2)) - sum(range(1,i+1))
  if d == c:
    e = sum(range(1,i+1)) - a
print(e)
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
All = [] #全ての数字格納リスト
B_A = [] #Biより小さいAjの個数格納リスト
B_C = [] #Biより大きいCkの個数格納リスト

for i in range(N):
  All.append([A[i],0])
  All.append([B[i],1])
  All.append([C[i],2])
All.sort()

count1,count2 = 0,0
for i in range(3*N):
  if(All[i][1] == 1):     
    if((i != 0)and(i != N-1)):
      if((All[i][0] == All[i-1][0])and(All[i-1][1] == 0)): B_A.append(count1-1)
      else: B_A.append(count1)
      if((All[i][0] == All[i+1][0])and(All[i+1][1] == 2)): B_C.append(N-count2-1)
      else: B_C.append(N-count2)
    else:
      B_A.append(count1),B_C.append(N-count2)
    
  if(All[i][1] == 0): count1 += 1
  if(All[i][1] == 2): count2 += 1

ans = 0
for i in range(N):
 ans += B_A[i]*B_C[i]
print(ans)

### FIXED CODE ###

import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A.sort()
B.sort()
C.sort()
ans = 0
#順序維持のbisect (二分探索を利用したライブラリ）
for i in range(N):
    count_a = bisect.bisect_left(A,B[i])
    count_c = N -bisect.bisect_right(C,B[i])
    ans += count_a*count_c
print(ans)
k=int(input())
print(ACL*k)

### FIXED CODE ###

k=int(input())
print("ACL"*k)
N,M = map(int,input().split())
student = [list(map(int,input().split())) for _ in range(N)]
cpoint = [list(map(int,input().split())) for _ in range(M)]
for i in range(N):
    mannmn = 10**8
    for j in range(M):
        mann = abs(student[i][0] - cpoint[j][0])+abs(student[i][1] - cpoint[j][1])
        if mann <= mannmn:
            mannmn = mann
            ref = j
    print(ref+1)

### FIXED CODE ###

N,M = map(int,input().split())
student = [list(map(int,input().split())) for _ in range(N)]
cpoint = [list(map(int,input().split())) for _ in range(M)]
for i in range(N):
    mannmn = 10**10
    mann = 10**10
    for j in range(M):
        mann = abs(student[i][0] - cpoint[j][0])+abs(student[i][1] - cpoint[j][1])
        if mann < mannmn:
            mannmn = mann
            ref = j
    print(ref+1)
N = int(input())
A = map(int, input().split())

count = 0
for i in range(N):
	h = A[i]
	for j in range(i+h+1, N):
		if j - i == h + A[j]:
			count += 1
print(count)

### FIXED CODE ###

N = int(raw_input())
A = map(int, raw_input().split())

x_occurance = {}
minus = []
for i in range(N):
	p = A[i] + i
	m = i - A[i]
	x_occurance[p] = x_occurance.get(p, 0) + 1
	minus.append(m)

count = 0
for i in range(N):
	count += x_occurance.get(minus[i], 0) 

print count
#!/usr/bin/env python3

# from typing import Optional
from typing import List

# from typing import Dict
from typing import Tuple

# from typing import Sequence

Cod = Tuple[int, int]


def main():
    args = input().split()
    H = int(args[0])
    W = int(args[1])
    M = int(args[2])

    codList: List[Cod] = []
    for i in range(M):
        args = input().split()
        codList.append((int(args[0]), int(args[1])))

    columnSumList: List[int] = [0] * (H + 1)
    rowSumList: List[int] = [0] * (W + 1)

    for item in codList:
        columnSumList[item[1] - 1] += 1
        rowSumList[item[0] - 1] += 1

    maxColumnSum = max(columnSumList)
    maxColumIndexList = [i for i, x in enumerate(columnSumList) if x == maxColumnSum]
    maxRowSum = max(rowSumList)
    maxRowIndexList = [i for i, x in enumerate(rowSumList) if x == maxRowSum]

    result = maxColumnSum + maxRowSum
    for row in maxRowIndexList:
        for column in maxColumIndexList:
            if (row + 1, column + 1) in codList:
                continue
            else:
                print(result)
                return

    print(result - 1)


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3

# from typing import Optional
from typing import List

# from typing import Dict
from typing import Tuple
from typing import Set

# from typing import Sequence

Cod = Tuple[int, int]


def main():
    args = input().split()
    H = int(args[0])
    W = int(args[1])
    M = int(args[2])

    codList = {}
    columnSumList: List[int] = [0] * W
    rowSumList: List[int] = [0] * H
    for i in range(M):
        h, w = map(lambda x: int(x), input().split())
        item = (h, w)
        codList.setdefault(h, {})
        codList[h][w] = item
        columnSumList[w - 1] += 1
        rowSumList[h - 1] += 1

    maxColumnSum = max(columnSumList)
    maxColumIndexList = [i for i, x in enumerate(columnSumList) if x == maxColumnSum]
    maxRowSum = max(rowSumList)
    maxRowIndexList = [i for i, x in enumerate(rowSumList) if x == maxRowSum]

    result = maxColumnSum + maxRowSum
    for row in maxRowIndexList:
        for column in maxColumIndexList:
            if row + 1 in codList and column + 1 in codList[row + 1]:
                continue
            else:
                print(result)
                return

    print(result - 1)


if __name__ == "__main__":
    main()
n,m = map(int,input().split())
a = map(int,input().split())
bc =[list(map(int,input().split()))for _ in [0]*m]

a.sort()
bc.sort(key=lamda x:-x[1])
i =0
for b,c in bc:
    for j in range(i,min(n,i+b)):
        if a[j]< c:a[j]=c
    i = i+b
print(sum(a))

### FIXED CODE ###

n,m = map(int,input().split())
*a, = map(int,input().split())
bc =[list(map(int,input().split()))for _ in [0]*m]
 
a.sort()
bc.sort(key=lambda x:-x[1])
i =0
for b,c in bc:
    for j in range(i,min(n,i+b)):
        if a[j]< c:a[j]=c
    i = i+b
print(sum(a))
import numpy as np
words = lambda t : list(map(t, input().split()))



def search(i, visited, ns, ans) :
    #print(i+1)
    visited[i] = True
    for next, weight in ns[i]:
        if visited[next] == False:
            if weight % 2 == 0:
                ans[next] = ans[i]
            else:
                ans[next] = (ans[i]+1) % 2
            search(next, visited, ns, ans)


def dfs(ns, ans):
    visited = [False] * len(ns)
    search(0, visited, ns, ans)

def main():
    n = int(input())
    ns = [[] for _ in range(n)]
    for _ in range(n-1):
        (st,end,weight) = map(int,input().split())
        ns[st-1].append((end - 1,weight))
        ns[end-1].append((st-1,weight))
    ans = [0] * n
    dfs(ns, ans)
    for a in ans:
        print(a)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
def search(i, visited, ns, ans) :
    #print(i+1)
    visited[i] = True
    for next, weight in ns[i]:
        if visited[next] == False:
            if weight % 2 == 0:
                ans[next] = ans[i]
            else:
                ans[next] = (ans[i]+1) % 2
            search(next, visited, ns, ans)


def dfs(ns, ans):
    visited = [False] * len(ns)
    search(0, visited, ns, ans)

def main():
    n = int(input())
    ns = [[] for _ in range(n)]
    for _ in range(n-1):
        (st,end,weight) = map(int,input().split())
        ns[st-1].append((end - 1,weight))
        ns[end-1].append((st-1,weight))
    ans = [False] * n
    dfs(ns, ans)
    for a in ans:
        if a:
            print(1)
        else:
            print(0)

if __name__ == '__main__':
    main()
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list = [A,B,C,D,E]
num =[]
num_t = []
for i in range(len(list)):
    s = 0
    t = 0
    if list[i] >= 100:
        s = list[i] - 100
        t = 100
    else:
        s = list[i]
    while s >= 10:
        s -= 10
        t += 10
    num.append(s)
    if s != 0:
        t += 10
    num_t.append(t)
    
last_index = len(num)
for i in range(len(num)):
    if num[i] != 0:
        if num[i] <= last_index:
            last_index = i

sum = 0
for i in range(len(num_t)):
    sum += num_t[i]
    
sum = sum - num_t[last_index] + list[last_index]
print(sum)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list = [A,B,C,D,E]
num =[]
num_t = []
for i in range(len(list)):
    s = 0
    t = 0
    if list[i] >= 100:
        s = list[i] - 100
        t = 100
    else:
        s = list[i]
    while s >= 10:
        s -= 10
        t += 10
    num.append(s)
    if s != 0:
        t += 10
    num_t.append(t)
    
last_index = -1
for i in range(len(num)):
    if num[i] != 0:
        if last_index == -1:
            last_index = i
        if num[i] <= num[last_index]:
            last_index = i

sum = 0
for i in range(len(num_t)):
    sum += num_t[i]
    
sum = sum - num_t[last_index] + list[last_index]
print(sum)
import math
from functools import reduce

def gcd_list(a):
	return reduce(math.gcd, a)

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(a):
    return reduce(lcm_base, a, 1)

N = int(input())
a = list(map(int, input().split()))
ans = 0
num = lcm_list(a)- 1
for i in range(len(a)):
	ans += num % a[i]
print(ans)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	ans += x - 1
print(ans)
N, X = map(int,input().split())
Ln = list(map(int,input().split()))
cnt = 1
sum = 0
 for i in range(1, N):
  sum += Ln[i]
  if sum > X:
    break
  cnt += 1
print(cnt)

### FIXED CODE ###

N, X = map(int,input().split())
Ln = list(map(int,input().split()))
 
cnt = 1
sum = 0
 
for i in range(0, N):
  sum += Ln[i]
  if sum > X:
    break
  cnt += 1
 
print(cnt)
import queue
x=int(input())
avail=list(range(100,106))
ok=[False]*(x+1)
q=queue.Queue()
for i in avail:
    ok[i]=True
    q.put(i)
while not q.empty():
    f=q.get()
    for i in range(100,106):
        if(i+f<=x and not ok[i+f]):
            ok[i+f]=True
            q.put(i+f)
print(1 if ok[x] else 0)

### FIXED CODE ###

import queue
x=int(input())
avail=list(range(100,106))
ok=[False]*max(x+1,106)
q=queue.Queue()
for i in avail:
    ok[i]=True
    q.put(i)
while not q.empty():
    f=q.get()
    for i in range(100,106):
        if(i+f<=x and not ok[i+f]):
            ok[i+f]=True
            q.put(i+f)
print(1 if ok[x] else 0)
# coding: utf-8
import math

N, M = [int(s) for s in input().strip().split()]

if N == 1:
    print(M)
    exit()

ROOT_M = int(math.sqrt(M))
divisors = []
for d in range(1, ROOT_M+1):
    if M % d == 0:
        divisors.append(d)
        divisors.append(M//d)

max_gcd = max([d for d in divisors if d < M/N])
print(max_gcd)


### FIXED CODE ###

# coding: utf-8
import math

N, M = [int(s) for s in input().strip().split()]

if N == 1:
    print(M)
    exit()

ROOT_M = int(math.sqrt(M))
divisors = []
for d in range(1, ROOT_M+1):
    if M % d == 0:
        divisors.append(d)
        divisors.append(M//d)

divisors.sort()
MAX_VAL = int(M/N)
for d in divisors:
    if d > MAX_VAL:
        break
    max_gcd = d

print(max_gcd)
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))



#bfs内で処理すると使い回しが効かないのでsearch_color とか幅探索後の具体的な処理は別個にしたほうがいい
def bfs(s,n,node):
    check=[False for _ in range(n)]
    queue=[-1 for _ in range(n)]
    now=0
    queue[now]=s
    ans=[-1 for _ in range(n)]
    ans[0]=[0]
    last_ind=1
    while last_ind<n:
        
        if now>=n:
            return []
        if check[queue[now]]:
            now+=1
            continue
        for i in node[queue[now]]:
            edge=i[0]
            
            ind=i[1]
            if check[edge]:
                continue

            queue[last_ind]=edge
            last_ind+=1
            #check[edge]=True
            
            ans[edge]=queue[now]
        check[queue[now]]=True
        now+=1
    return ans



n,m=input_list()
node=[[] for _ in range(n)]
for i in range(m):
    u,v=input_list()
    u-=1
    v-=1
    node[u].append([v,i])
    node[v].append([u,i])

#print(np.array(node))

ans=bfs(0,n,node)
if len(ans)==0:
    print("No")
    exit()

print("Yes")
for each in ans[1:]:
    print(each+1)








### FIXED CODE ###

input_list = lambda : list(map(int,input().split()))


#bfs内で処理すると使い回しが効かないのでsearch_color とか幅探索後の具体的な処理は別個にしたほうがいい
def bfs(s,n,node):
    c=[-1 for _ in range(n)]
    c[0]=0
    
    side_num_arr=list(map(lambda x :len(x),node))
    #print(l)
    queue=[-1 for _ in range(n)]
    now=0
    queue[now]=s
    ans=[-1 for _ in range(n)]
    ans[0]=[0]
    last_ind=1
    while last_ind<n:
        
        if now>=n:
            return []
        c[queue[now]]=True
        if side_num_arr[queue[now]]<=0:
            now+=1
            continue
        for edge in node[queue[now]]:
            #edge=i[0]
            if side_num_arr[edge]<=0 or c[edge]==True:
                continue
            side_num_arr[edge]-=1
            
            queue[last_ind]=edge
            last_ind+=1
            c[edge]=True
            ans[edge]=queue[now]

        side_num_arr[queue[now]]=0
        now+=1
    return ans



n,m=input_list()
node=[[] for _ in range(n)]

for i in range(m):
    u,v=input_list()
    u-=1
    v-=1
    node[u].append(v)
    node[v].append(u)

#print(np.array(node))

ans=bfs(0,n,node)
if len(ans)==0:
    print("No")
    exit()

print("Yes")
for each in ans[1:]:
    print(each+1)
import itertools
f = lambda n:n*(n+1)//2

def sol():
  res = 0
  while q:
    x0 = q.popleft()
    x1 = q.popleft()
    res += f(max(x0, x1)) + f(min(x0, x1)-1)
    return res

s = input()

q = collections.deque()
for k, g in itertools.groupby(s):
  q.append(len(list(g)))
if len(q) % 2:
  q.append(1)

print(sol())

### FIXED CODE ###

def main():
  s = input().rstrip('\n')
  n = len(s)
  dp = [0] * (1 + n)
  for i,c in enumerate(s):
    if c == '<':
      dp[i+1] = dp[i] + 1
  for i in range(n-1, -1, -1):
    if s[i] == '>':
      dp[i] = max(dp[i], dp[i+1] + 1)
  return sum(dp)

print(main())
n, t = map(int, input().split())
minCost = 1001
for i range in n:
    cc, tt = map(int, input().split())
    if tt <= t and cc < minCost:
        minCost = cc
if minCost == 1001:
    print('TLE')
else:
    print(minCost)

### FIXED CODE ###

n, t = map(int, input().split())
minCost = 1001
for i in range(n):
    cc, tt = map(int, input().split())
    if tt <= t and cc < minCost:
        minCost = cc
if minCost == 1001:
    print('TLE')
else:
    print(minCost)
n,x=map(int,input().split())
p=[1]
a=[1]
for i in range(0,n-1):
  p.append(p[i]*2+1)
  a.append(a[i]*2+3)
def f(n,x):
  if x==1:
    return 0
  elif x<=1+a[n-1]:
    return f(n-1,x-1)
  else:
    return p[n-1]+f(n-1,x-a[n-1]-2)+1
print(f(n,x))

### FIXED CODE ###

n,x=map(int,input().split())
p=[1]
a=[1]
for i in range(0,n):
  p.append(p[i]*2+1)
  a.append(a[i]*2+3)
def f(n,x):
  if n==0 and x<=0:
    return 0
  elif n==0:
    return 1
  elif x<=1+a[n-1]:
    return f(n-1,x-1)
  else:
    return p[n-1]+f(n-1,x-a[n-1]-2)+1
print(f(n,x))
from statistics import mean, median,variance,stdev
data=[]
while True:
    data.append(input().split())
    if ["0"] in data:
        break
data=data[:-1]
data_i=[]
for i in data:
    data_i.append(list(map(lambda i:int(i),i)))
for i in data_i:
    if len(i)==1:
        pass
    else:
        print(std(i))


### FIXED CODE ###

from statistics import pstdev
while input()!="0":
    lst=map(int,input().split())
    print(pstdev(lst))
max_num = 1000000
min_num = -1000000
k,x = map(int, input().split())
if x + k > 1000000:
    min_num = x - k
elif x - k < -1000000:
    max_num = x + k
else:
    min_num = x - k
    max_num = x + k

for i range( min_num, max_num ):
    print i

### FIXED CODE ###

max_num = 1000000
min_num = -1000000
k,x = map(int, input().split())
if x + k > 1000000:
    min_num = x - k + 1
elif x - k < -1000000:
    max_num = x + k - 1
else:
    min_num = x - k + 1
    max_num = x + k - 1

ans = ""
for i in range( min_num, max_num + 1 ):
    ans = ans + str(i) + " "

print( ans )
import sys
def p(s):
  sys.stderr.write(str(s)+"\n")

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

p(N)
p(Y)

Amax=min(N,Y//10000)
Bmax=min(N,Y//5000)
Cmax=min(N,Y//1000)

p(Amax)
p(Bmax)
p(Cmax)

for a in range(Amax+1):
  B=min(Bmax,N-a)
  p("B="+str(B))
  for b in range(B+1):
    C=min(Cmax,N-a-b)
	#p("C="+str(C))
    for c in range(C+1):
      n = a+b+c
      y = (a*10000)+(b*5000)+(c*1000)
      if n==N and y==Y:
        print(a,b,c,sep=" ")
        exit(1)

print("-1 -1 -1")


### FIXED CODE ###

import sys
def p(*a):
  s=" ".join(map(str,a))
  #print(s)
  sys.stderr.write(s+"\n")

N,Y=map(int, input().split())
p(N,Y)

NAmax=min(N,Y//10000)
NBmax=min(N,Y//5000)
NCmax=min(N,Y//1000)
p(NAmax, NBmax, NCmax)

NA=NAmax
for a in range(NA,-1,-1):
  NB=min(NBmax,N-a)

  for b in range(NB,-1,-1):
    c = N-a-b
    y = (a*10000)+(b*5000)+(c*1000)
    if y==Y:
      print(a,b,c,sep=" ")
      exit()
      
i=-1
print(i,i,i, sep=" ")