Harryxun/stf_run huggingface dataset:
import sys
from collections import deque
n, m = [int(i) for i in sys.stdin.readline().split()]
parent = [i for i in range(n)]

graph = {j:[] for j in range(n)}
for i in range(m):
    l, r, d = [int(i) for i in sys.stdin.readline().split()]
    l -= 1
    r -= 1
    graph[l].append((r, d))
    graph[r].append((l, -d))

yet = set(list(range(n)))
x_ls = [None for i in range(n)]
x_ls[0] = 0
que = deque([0])
flg = True
while len(que) > 0:
    cur = que.popleft()
    if cur in yet:
        yet.remove(cur)
    cur_pos = x_ls[cur]
    for _next, dis in graph[cur]:
        if x_ls[_next] is None:
            x_ls[_next] = cur_pos + dis
            que.append(_next)
        else:
            if x_ls[_next] != cur_pos + dis:
                flg = False
                break
    if not flg:
        break
    if len(que) == 0 and len(yet) > 0:
        que.append(list(yet)[0])
        x_ls[list(yet)[0]] = 0
        yet.pop(0)
if flg:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

n, m = [int(i) for i in sys.stdin.readline().split()]
parent = [i for i in range(n)]

graph = {j:[] for j in range(n)}
for i in range(m):
    l, r, d = [int(i) for i in sys.stdin.readline().split()]
    l -= 1
    r -= 1
    graph[l].append((r, d))
    graph[r].append((l, -d))

already = set()
x_ls = [None for i in range(n)]
x_ls[0] = 0
stack = list(range(n))[::-1]
flg = True
while len(stack) > 0:
    cur = stack.pop(-1)
    if cur in already:
        continue
    if x_ls[cur] is None:
        cur_pos = 0
    else:
        cur_pos = x_ls[cur]
    already.add(cur)
    for _next, dis in graph[cur]:
        if x_ls[_next] is None:
            x_ls[_next] = cur_pos + dis
            stack.append(_next)
        else:
            if x_ls[_next] != cur_pos + dis:
                flg = False
                break
    if not flg:
        break
if flg:
    print("Yes")
else:
    print("No")
n, m, d = list(map(int, input().split()))
if (d == 0):
	ans = (m - 1) * (1 / n)
	print(ans)
else:
	ans = (m - 1) * (2 * (n - d) / n ** 2)
	print(ans)

### FIXED CODE ###

a, b = list(map(int, input().split()))
if (a + b == 15):
  print("+")
elif (a * b == 15):
  print("*")
else:
  print("x")
s = input()
K = int(input())
n = len(s)
t = s[::-1]
if 2*K+1 >= n:
  print(n)
  exit()
dp = [[[0 for i in range(K+1)] for j in range(n+1)] for k in range(n+1)]
if n == 2 and k == 0:
  if s == t:
    print(2)
  else:
    print(1)
    exit()
ans = min(2*K+1,n)
for center in range(1,n-1):
  flg = 0
  sf = s[:center]
  sl = t[:n-center-1]
  if s[center] == s[center+1]:
    flg = 1
  sfl = len(sf)
  sll = len(sl)
  for j in range(1,sll+1):
    dp[sfl][j][0] = max(dp[sfl-1][j][0],dp[sfl][j-1][0])
    if sf[-1] != sl[j-1]:
      for k in range(1,K+1):
        dp[sfl][j][k] = max(dp[sfl-1][j-1][k-1]+1,dp[sfl-1][j][k],dp[sfl][j-1][k])
    if sf[-1] == sl[j-1]:
      dp[sfl][j][0] = max(dp[sfl][j][0],dp[sfl-1][j-1][0]+1)
      for k in range(1,K+1):
        dp[sfl][j][k] = max(dp[sfl-1][j-1][k-1]+1,dp[sfl-1][j-1][k]+1,dp[sfl-1][j][k],dp[sfl][j-1][k])
  if flg:
    ans= max(dp[sfl][sll][K]*2+1,dp[sfl][sll-1][K]*2+2,ans)
  elif K > 0:
    ans= max(dp[sfl][sll][K]*2+1,dp[sfl][sll-1][K-1]*2+2,ans)
  else:
    ans= max(dp[sfl][sll][K]*2+1,ans)
print(ans)

### FIXED CODE ###

s = input()
K = int(input())
n = len(s)
t = s[::-1]
if 2*K+1 >= n:
  print(n)
  exit()
dp = [[[0 for i in range(K+1)] for j in range(n+1)] for k in range(n+1)]
if n == 2 and K == 0:
  if s == t:
    print(2)
    exit()
  else:
    print(1)
    exit()
ans = min(2*K+1,n)
for center in range(1,n-1):
  flg = 0
  sf = s[:center]
  sl = t[:n-center-1]
  if s[center] == s[center+1]:
    flg = 1
  sfl = len(sf)
  sll = len(sl)
  for j in range(1,sll+1):
    dp[sfl][j][0] = max(dp[sfl-1][j][0],dp[sfl][j-1][0])
    if sf[-1] != sl[j-1]:
      for k in range(1,K+1):
        dp[sfl][j][k] = max(dp[sfl-1][j-1][k-1]+1,dp[sfl-1][j][k],dp[sfl][j-1][k])
    if sf[-1] == sl[j-1]:
      dp[sfl][j][0] = max(dp[sfl][j][0],dp[sfl-1][j-1][0]+1)
      for k in range(1,K+1):
        dp[sfl][j][k] = max(dp[sfl-1][j-1][k-1]+1,dp[sfl-1][j-1][k]+1,dp[sfl-1][j][k],dp[sfl][j-1][k])
  if flg:
    ans= max(dp[sfl][sll][K]*2+1,dp[sfl][sll-1][K]*2+2,ans)
  elif K > 0:
    ans= max(dp[sfl][sll][K]*2+1,dp[sfl][sll-1][K-1]*2+2,ans)
  else:
    ans= max(dp[sfl][sll][K]*2+1,ans)
print(ans)
from itertools import combinations as comb
import numpy as np
N, K = map(int, input().split())
ans = 10 ** 18 + 1
choice = min(K, 4)
ps = np.array([list(map(int, input().split())) for i in range(N)])
for idxs in comb(range(N), choice):
	rep_ps = ps[idxs, :]
	x_max = rep_ps[:, 0].max()
	y_max = rep_ps[:, 1].max()
	x_min = rep_ps[:, 0].min()
	y_min = rep_ps[:, 1].min()
	in_num = sum((ps[:, 0] <= x_max) & (ps[:, 0] >= x_min) & (ps[:, 1] <= y_max) & (ps[:, 1] >= y_min))
	area = (y_max - y_min) * (x_max - x_min)
	if K >= in_num and area < ans:
		ans = area
print(area)


### FIXED CODE ###

from itertools import combinations as comb
N, K = map(int, input().split())
ans = (2 * 10 ** 9) ** 2 + 1
choice = min(K, 4)
xs = [0] * N
ys = [0] * N
for i in range(N):
	xs[i], ys[i] = map(int, input().split())

for idxs in comb(range(N), choice):
	x_mx = y_mx = - 10 ** 9
	x_mn = y_mn = 10 ** 9
	for i in idxs:
		x_mx = max(x_mx, xs[i])
		y_mx = max(y_mx, ys[i])
		x_mn = min(x_mn, xs[i])
		y_mn = min(y_mn, ys[i])
	in_num = sum(x_mn <= xs[i] <= x_mx and y_mn <= ys[i] <= y_mx for i in range(N))
	area = (x_mx - x_mn) * (y_mx - y_mn)
	if in_num >= K and area < ans:
		ans = area
print(ans)
from heapq import*
(N, M), *t = [map(int, s.split()) for s in open(0)]
v = [[] for _ in [0] * 10**5]
q = [0, 0]
for a, b in t:
    v[a - 1] += b,
z = 0
for i in v[:M]:
    for j in i:
        heappush(q, -j)
    z += -heappop(q)
print(z)

### FIXED CODE ###

from heapq import*
(N, M), *t = [map(int, s.split()) for s in open(0)]
q = [0] * 10**5
v = [[] for _ in q]
for a, b in t:
    v[a - 1] += b,
z = 0
for i in v[:M]:
    for j in i:
        heappush(q, -j)
    z += -heappop(q)
print(z)
N = input()
 
for n in range(N):
    data = list(map(float,input().split( )))
    slopes = []
    for i in range(2):
        _x1 = data.pop(0)
        _y1 = data.pop(0)
        _x2 = data.pop(0)
        _y2 = data.pop(0)
         
        if _x1 != _x2:
            slopes.append((_y1 - _y2)/(_x1 - _x2))
     
    if len(slopes) == 0:
        print("YES")
    elif len(slopes) == 1:
        print("NO")
    elif abs(slopes[0] - slopes[1]) < 1e-10:
        print("YES")
    else:
        print("NO")

### FIXED CODE ###

N = input()
 
for n in range(N):
    data = map(float,raw_input().split( ))
    slopes = []
    for i in range(2):
        _x1 = data.pop(0)
        _y1 = data.pop(0)
        _x2 = data.pop(0)
        _y2 = data.pop(0)
         
        if _x1 != _x2:
            slopes.append((_y1 - _y2)/(_x1 - _x2))
     
    if len(slopes) == 0:
        print "YES"
    elif len(slopes) == 1:
        print "NO"
    elif abs(slopes[0] - slopes[1]) < 1e-10:
        print "YES"
    else:
        print "NO"
import sys
readline = sys.stdin.readline

#エラトステネスの篩と素因数分解

from collections import Counter

def gcd(a,b):
    while b:
        a, b = b, a%b
    return a
M = 10**6 + 8
prime = [0]*M
for i in range(2, M):
    if prime[i]:
        continue
    for j in range(i, M, i):
        if not prime[j]:
            prime[j] = i

def pd(x):
    C = Counter()
    while x > 1:
        C[prime[x]] += 1
        x //= prime[x]
    return C


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

D = Counter()

for a in A:
    c = pd(a)
    for k in c.keys():
        D[k] += 1


res = A[0]
for a in A:
    res = gcd(res, a)
ans = None
if max(D.values()) == 1:
    ans = 'pairwise coprime'
elif res == 1:
    ans = 'setwise coprime'
else:
    ans = 'not coprime'

print(ans)


### FIXED CODE ###

import sys
readline = sys.stdin.readline

#エラトステネスの篩と素因数分解

from collections import Counter

def gcd(a,b):
    while b:
        a, b = b, a%b
    return a
M = 10**6 + 8
prime = [0]*M
for i in range(2, M):
    if prime[i]:
        continue
    for j in range(i, M, i):
        if not prime[j]:
            prime[j] = i

def pd(x):
    C = Counter()
    while x > 1:
        C[prime[x]] += 1
        x //= prime[x]
    return C


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

D = Counter()

for a in A:
    c = pd(a)
    for k in c.keys():
        D[k] += 1


res = A[0]
for a in A:
    res = gcd(res, a)
ans = None
if all(a == 1 for a in A) or max(D.values()) == 1:
    ans = 'pairwise coprime'
elif res == 1:
    ans = 'setwise coprime'
else:
    ans = 'not coprime'

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

mod = (N-1)*N/2
print(mod)


### FIXED CODE ###

s = input()
t = input()

k = 0
count = 0
while k < 3:
    if s[k] == t[k]:
        count += 1
    k += 1
print(count)
def add(in1, in2):
    return [a + b for a, b in zip(in1, in2)]

def split(ar, k, w):
    a = 0
    if max(ar) > k:
      return -1
    tm = ar[0]
    for i in range(1, w):
        tm = add(tm, ar[i])
        if max(tm) > k:
            a += 1
            tm = ar[i]
    return a        

h, w, k = map(int, input().split())
s = [[int(i) for i in input()] for j in range(h)]
ans = h*w

for i in range(2**(h-1)):
    data = []
    temp = s[0]
    sp = bin(i+2**h)[4:]
    if ans < sp.count("1"):
        continue
    for j in range(1, h):
        if sp[j-1] == "0":
            temp = add(temp, s[j])
        else:
            data.append(temp)
            temp = s[j]
    data.append(temp)
    ans_ = split([list(x) for x in zip(*data)], k, w)
    if ans_ == -1:
        continue
    ans_ += sp.count("1")
    if ans > ans_:
        ans = ans_
print(ans)


### FIXED CODE ###

def add(in1, in2):
    return [a + b for a, b in zip(in1, in2)]

def check_overk(in1, k):
    return len([i for i in in1 if i>k]) > 0

def split(ar, k, w):
    a = 0
    for i in ar:
        if check_overk(i, k):
            return -1
    tm = ar[0]
    for i in range(1, w):
        tm = add(tm, ar[i])
        if check_overk(tm, k):
            a += 1
            tm = ar[i]
    return a
            

h, w, k = map(int, input().split())
s = [[int(i) for i in input()] for j in range(h)]
ans = h*w

for i in range(2**(h-1)):
    data = []
    temp = s[0]
    sp = bin(i+2**h)[4:]
    if ans < sp.count("1"):
        continue
    for j in range(1, h):
        if sp[j-1] == "0":
            temp = add(temp, s[j])
        else:
            data.append(temp)
            temp = s[j]
    data.append(temp)
    ans_ = split([list(x) for x in zip(*data)], k, w)
    if ans_ == -1:
        continue
    ans_ += sp.count("1")
    if ans > ans_:
        ans = ans_
print(ans)
N = int(input())
cnt = 0

for i in range(1,N+1):
    if i % 2 == 0:continue
    c = 0
    for j in range(1,N+1):
        if c > 8:
            cnt -= 1:continue
        if i % j == 0:
            c += 1
    if c ==8:
        cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())

if N < 105:
    print(0)
elif N < 135:
    print(1)
elif N < 165:
    print(2)
elif N < 189:
    print(3)
elif N < 195:
    print(4)
else:
    print(5)
import re
index = re.match(r'*(hi)+*', input())
if index:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import re
index = re.fullmatch(r'(hi)+', input())
if index:
    print("Yes")
else:
    print("No")
import math
a,b,c=map(int,input().split())
if a+b+2*math.sqrt(a)*math.sqrt(b)<c:
	print('Yes')
  else:
    print('No')  

### FIXED CODE ###

import math
a,b,c=map(int,input().split())
eps = 0.00000000000001
if 4*a*b<(c-a-b)**2 and (c-a-b)>0:
	print('Yes')
else:
	print('No')
counter = int(input())
res = counter % 10
if res in [2,4,5,7,9]:print("hon")
elif res in [0, 1 6, 8]:print("pon")
else:print("bon")  

### FIXED CODE ###

counter = int(input())
res = counter % 10
if res in [2,4,5,7,9]:
    print("hon")
elif res in [0, 1, 6, 8]:
    print("pon")
else:print("bon")
k=int(input())
if k%2==0:
  print(n**2//4)
else:
  print((n**2-1)//4)

### FIXED CODE ###

k=int(input())
if k%2==0:
  print(k**2//4)
else:
  print((k**2-1)//4)
A, B = map(int, input().split())
if A== 8 and B==8:
  print("Yay!")
if A>8 and b<8:
  print(":(")
if A<8 and b>8:
  print(":(")
else:
  print("Yay!")
  

### FIXED CODE ###

A, B = map(int, input().split())
if A<8 and B <8:
    print("Yay!")
elif A==8 and B == 8:
    print("Yay!")
else:
    print(":(")
from math import *
PI = 3.1415926535898
ans = 0
while True:
    try:
        s = raw_input()
        t = ""
        for x in s:
            if x.isdigit():
                t += x
            elif len(t) > 0 and t[len(t)-1].isdigit():
                t += " "
        arr = map(int, t.strip().split(' '))
        for x in arr:
            ans += x
    except EOFError:
        break
print ans

### FIXED CODE ###

from math import *
PI = 3.1415926535898
ans = 0
while True:
    try:
        s = raw_input()
        t = ""
        for x in s:
            if x.isdigit():
                t += x
            elif len(t) > 0 and t[len(t)-1].isdigit():
                t += " "
        if len(t) > 0:
            arr = map(int, t.strip().split(' '))
            for x in arr:
                ans += x
    except EOFError:
        break
print ans
N = int(input())

for i in range(1,N):
    if i * i <= N:
        if N % i == 0:
            ans = i
    else:
        break
print(len(str(N // ans)))


### FIXED CODE ###

N = int(input())

for i in range(1,N+1):
    if i * i <= N:
        if N % i == 0:
            ans = i
    else:
        break
print(len(str(N // ans)))
N = int(input())
score = list(map(int, input().split()))
total = 0
 
score.sort(reverse=True)
for i in range(0, N, 2):
  if i == N:
    total = total + score[i]
  else:
    total = total + (score[i]-score[i+1])

print(total)

### FIXED CODE ###

N = int(input())
score = list(map(int, input().split()))
A = 0
B = 0
 
score.sort(reverse=True)
for i in range(N):
  if i % 2 == 0:
    A += score[i]
  else:
    B += score[i]

print(A-B)
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

S = str(input())
n = len(S)
K = I()

for i in range(1,n):
    if S[i]!=S[i-1]:
        break
    else:
        if i==n-1:
            print(K*n//2)
            exit()

ren = 1
num = 0
for i in range(1,n):
    if S[i]==S[i-1]:
        ren += 1
    else:
        if i!=n-1:
            num += ren//2
            ren = 1

last = ren

if S[0]==S[-1]:
    num2 = 0
    for i in range(n):
        if S[i]==S[-1]:
            ren += 1
        else:
            now = i
            break
    num2 += ren//2
    ren = 1
    for i in range(now,n):
        if S[i]==S[i-1]:
            ren += 1
        else:
            if i!=n-1:
                num2 += ren//2
                ren = 1
    num3 = 0
    ren = 1
    for i in range(n-1-last+2,n):
        if S[i]==S[i-1]:
            ren += 1
        else:
            num3 += ren//2
            ren = 1
    num3 += ren//2
    print(num+num2*(K-1)+num3)
else:
    num += ren//2
    print(num*K)

### FIXED CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

S = str(input())
n = len(S)
K = I()

for i in range(1,n):
    if S[i]!=S[i-1]:
        break
    else:
        if i==n-1:
            print(K*n//2)
            exit()

if n==1:
    print(K//2)
    exit()

ren = 1
num = 0
for i in range(1,n):
    if S[i]==S[i-1]:
        ren += 1
    else:
        if i!=n-1:
            num += ren//2
            ren = 1

last = ren

if S[0]==S[-1]:
    num2 = 0
    for i in range(n):
        if S[i]==S[-1]:
            ren += 1
        else:
            now = i
            break
    num2 += ren//2
    ren = 1
    for i in range(now,n):
        if S[i]==S[i-1]:
            ren += 1
        else:
            if i!=n-1:
                num2 += ren//2
                ren = 1
    num3 = 0
    ren = 1
    for i in range(n-1-last+2,n):
        if S[i]==S[i-1]:
            ren += 1
        else:
            num3 += ren//2
            ren = 1
    num3 += ren//2
    print(num+num2*(K-1)+num3)
else:
    num += ren//2
    print(num*K)
a,b,c = map(int, input().split())

print('YES' if b−a==c−b else 'NO')

### FIXED CODE ###

a,b,c = map(int,input().split())
print("YES" if b-a==c-b else "NO")
n=int(input())
ls=list(map(int,input().split()))
copy=[0]*n
for i in range(n):
  copy[ls[i]-1=i+1
for i in copy:
       print(i,end=" ")
  

### FIXED CODE ###

n=int(input())
ls=list(map(int,input().split()))
copy=[0]*n
for i in range(n):
    copy[ls[i]-1]=i+1
for i in copy:
       print(i,end=" ")
46 4 40 5

### FIXED CODE ###

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

while True:
    c -= b
    if c<=0:
        print("Yes")
        exit()
        
    a -= d
    if a<=0:
        print("No")
        exit()
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = list(sorted(map(int, readline().split())))

nums = [0] * (10 ** 6 + 1)

for a in A:
    nums[a] += 1

MAX = 10 ** 6 + 1
pr = set()
for a in A:
    nums[a] -= 1
    b = a
    while b <= MAX:
        if nums[b] > 0:
            pr.add(b)
        b += a
    nums[a] += 1

ans = len(A)
for a in A:
    if a in pr:
        ans -= 1
# print(pr)
print(ans)






### FIXED CODE ###

import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = list(sorted(map(int, readline().split())))

amax = max(A)
dp = [True] * (amax + 1)
count = [0] * (amax + 1)

for a in A:
    count[a] += 1
    b = 2 * a
    while b <= amax:
        dp[b] = False
        b += a

ans = 0
for a in A:
    if count[a] > 1:
        continue
    if dp[a]:
        ans += 1
print(ans)
H, W = map(int, input().split(" "))
if H == 1 or W == 1:
    print("No")
    break
result = True
masu = [["." for i in range(H+2)] for j in range(W+2)]
for h in range(1, H+1):
    s = "0"+input()+"0"
    masu[h] = list(s)
# print(masu)
for h in range(1, H+1):
    for w in range(1, W+1):
        # print(h, w, masu[h][w])
        if masu[h][w] == "#" and masu[h+1][w] != "#" and masu[h][w+1] != "#" and masu[h-1][w] != "#" and masu[h][w-1] != "#":
            result = False
            break
if result:
    print("Yes")
else:
    print("No")

### FIXED CODE ###


H, W = map(int, input().split(" "))

# result = True
masu = [['.' for i in range(W+2)] for j in range(H+2)]
for h in range(H):
    s = "."+input()+"."
    masu[h+1] = s

# print(masu)

for h in range(1,H+1):
    for w in range(1,W+1):
        if masu[h][w] == "#":
            if "#" == masu[h+1][w] or "#" == masu[h][w+1] or "#" == masu[h-1][w] or "#" == masu[h][w-1]:
                pass
            else:
                # result = False
                print("No")
                exit()

print("Yes")
import math

n,m=map(int,input().split())
mod=10**9+7
a=math.factorial(n)*math.factorial(m)
if abs(n-m)==0:
    print(2*a%mod)
    exit()
elif abs(n-m)>1:
    a=0
print(a％mod)


### FIXED CODE ###

import math

n,m=map(int,input().split())
a=math.factorial(n) * math.factorial(m) 
if abs(n-m) == 0:
    a *= 2
elif abs(n-m) > 1:
    a = 0
print(a%1000000007)
import math
 

sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

prime = [0 for i in range(11000)]
prime[0] = 2
k = 0
for i in range(2,r):
    if p[i]:
        prime[k] = i+1+prime[k-1]
        k += 1
        
while True:
    n = int(raw_input())
    if not n:
        break
    print sum(prime[:n])

### FIXED CODE ###

import math

r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]

s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2,r):
    if p[i]:
        s[k] = i+1+s[k-1]
        k += 1
        
while True:
    n = int(raw_input())
    if not n:
        break
    print s[n-1]
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i):
    c, b = 1, 0
    while i > 0:
        c, b = c + b, c
        i -= 1
    return c
m = a[0] + 1
num = fibo(m - 2)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    num = num * fibo(m - 2)
    if m == 1:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1)
print(num % 1000000007)


### FIXED CODE ###

N, M = map(int, input().split())
kaidan = [0] * (N + 1)
for i in range(M):
    tmp = int(input())
    kaidan[tmp] = -1
kaidan[0] = 1
for i in range(1,N + 1):
    if i == 1:
        if kaidan[i] != -1:
            kaidan[i] = 1
        else:
            kaidan[i] = 0
    else:
        if kaidan[i] != -1:
            kaidan[i] = kaidan[i -1] + kaidan[i - 2]
        else:
            kaidan[i] = 0
print(kaidan[N] % (10 ** 9 + 7))
n=input()
#print(n)

mynum=2**(len(n)-1)
#print(mynum)
data=['','+']
x=['0']*10000
#print(x)

for i in range(mynum):
  y=format(i, 'b')
  z=y.zfill(len(n)-1)
  x[i]=n[0]
  for j in range(len(z)):
    x[i]+=data[int(z[j])]+n[j+1]
#  print(x[i])           
x=[eval(i) for i in x]

print(n if len(n)==1 else sum(x))
#12656242944

### FIXED CODE ###

n=input()
size=len(n)
#print(n,size)

ans=0
for i in range(2**(size-1)):
    z=format(i,'b').zfill(size-1)
#    print(z)
    string=n[0]
    for j in range(size-1):
        if z[j]=='1':
            string+='0'+n[j+1]
        elif z[j]=='0':
            string+=n[j+1]
    string=string.replace('0','+')
    ans+=eval(string)

print(ans)

#12656242944
a=input()
if(a=="a" or a=="i" or a=="u" or a=="e" or a=="o):
   print("vowel")
else:
   print("consonant")

### FIXED CODE ###

a=input()
if(a=="a" or a=="i" or a=="u" or a=="e" or a=="o"):
  print("vowel")
else:
  print("consonant")
N=int(input())
D=list(map(int,input().split()))
M=int(input())
T=list(map(int,input().split()))
for i in range(N):
  if D[i] in T:
    T.remove(D[i])
    D.pop(i)
  if len(T)==0:
    break
if len(T)==0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

from collections import Counter
N=int(input())
D=list(map(int,input().split()))
d=Counter(D)
M=int(input())
T=list(map(int,input().split()))
t=Counter(T)
ans="YES"
for k in list(t.keys()):
  if d[k]<t[k]:
    ans="NO"
    break
print(ans)
def inpl(): return [int(i) for i in input().split()]
def hmd(a, b):
    ctr = -1
    while H[ctr+1][a] < b:
        ctr += 1
    vn = H[ctr][a]
    if (vn == b and ctr == 0) or ctr == -1:
        return 1
    return 2**ctr + hmd(vn,b)
N = int(input())
x = inpl() + [10**10]
L = int(input())
H = []
G = [N-1]*N
b = 0
for a in range(N):
    while x[b+1] - x[a] <= L:
        if b == N-1:
            break
        b += 1
    G[a] = b
H.append(G)
while G[0] != N-1:
    G = [G[i] for i in G]
    H.append(G)
H.append([10**10]*N)
Q = int(input())
for _ in range(Q):
    a, b = sorted(inpl())
    print(hmd(a-1,b-1))

### FIXED CODE ###

from collections import defaultdict
H = defaultdict(lambda: 0)
H[0] = 1
def inpl(): return [int(i) for i in input().split()]
N, A = inpl()
x = inpl()
x = [i-A for i in x]
H[0]= 1
for i in x:
    for ni,nv in H.copy().items():
        H[ni+i] += nv
print(H[0]-1)
a, b = map(int,input().split())
d = (int)a/b
r = a%b
f = a/b
print("%d %d %f",d,r,f)

 

### FIXED CODE ###

a, b = map(int,input().split())
d = a // b 
r = a % b
f = a / b
print("%d %d %f" %(d,r,f))