Harryxun/stf_run huggingface dataset:
N, M = [int(_) for _ in input().split()]
A = [int(input()) for i in range(M)]
isBroken = [False] * (N + 1)
for i in A:
    isBroken[i] = True


def solve():

    # It's impossible
    if M > 0:
        temp = A[0]
        for a in A[1:]:
            if a - 1 == temp:
                return 0
            temp = a

    # We can
    memo = [0] * (N + 1)

    def rec(i):
        if i == 0:
            return 1
        if i < 0:
            return 0
        if isBroken[i]:
            return 0
        if memo[i] == 0:
            count1 = rec(i - 1) % 1000000007
            count2 = rec(i - 2) % 1000000007
            memo[i] = (count1 + count2) % 1000000007
            # print(f"memo[{i}] = {count1} + {count2} -> {memo[i]}")
        return memo[i]
    return rec(N)


print(solve())


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

N, M = [int(_) for _ in input().split()]
A = [int(input()) for i in range(M)]
isBroken = [False] * (N + 1)
for i in A:
    isBroken[i] = True


def solve():

    # It's impossible
    if M >= 1:
        temp = A[0]
        for a in A[1:]:
            if a - 1 == temp:
                return 0
            temp = a

    # We can
    memo = [0] * (N + 2)

    def rec(i):
        if i == 0:
            return 1
        if i < 0:
            return 0
        if isBroken[i]:
            return 0

        if memo[i] == 0:
            count1 = rec(i - 1) % 1000000007
            count2 = rec(i - 2) % 1000000007
            memo[i] = (count1 + count2) % 1000000007
        return memo[i]
    return rec(N)


print(solve())
import numpy as np

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

l = [int(i) for i in input().split()]
l.sort()
if n == 1 or m == 1:
    print(l[-1]-l[0])
else:
    d = [0 for i in range(m - 1)]
    for i in range(m-1):
        d[i] = l[i+1] - l[i]
    d = np.array(d)
    dl = d.argsort()[::-1]
    count = 0
    for i in range(n):
        if i == 0:
            count += l[dl[i]] - l[0]
            index = dl[i]
        elif i == n - 1:
            count += l[-1] - l[index+1]
        else:
            count += l[dl[i]] - l[index+1]
            index = dl[i]
    print(count)


### FIXED CODE ###

import numpy as np

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

l = [int(i) for i in input().split()]
l.sort()
if n == 1 or m == 1:
    print(l[-1]-l[0])
elif n > m:
    print(0)
else:
    d = [0 for i in range(m - 1)]
    for i in range(m-1):
        d[i] = l[i+1] - l[i]
    d = np.array(d)
    dl = d.argsort()[::-1]
    count = 0
    for i in range(n):
        if i == 0:
            count += l[dl[i]] - l[0]
            index = dl[i]
        elif i == n - 1:
            count += l[-1] - l[index+1]
        else:
            count += l[dl[i]] - l[index+1]
            index = dl[i]
    print(count)
n=int(input())
a_list=list(map(int,input().split()))
cnt = [0] * int(1e5 + 10)
sum=0
for i in a_list:
 cnt[i] +=1
 sum+=i
  
q=int(input())
ans=0
 
for j in range(q):
 x,y=map(int,input().split())
 sum+=(y-x)*cnt[x]
 cnt[y]+=cnt[x]
 cnt[y]=0
 print(sum)

### FIXED CODE ###

import re
a=input()
if re.sub(r'[A-Z]',"",a)=="":
  print('A')
else:
  print('a')
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()

def bubble(cards):
    for i in range(len(cards)):
        for j in range(len(cards)-1, i, -1):
            if cards[j][1]<cards[j-1][1]:
                cards[j],cards[j-1]=cards[j-1],cards[j]

def selection(cards):
    for i in range(len(cards)):
        mini=i
        for j in range(i,len(cards)):
            if cards[j][1]<cards[mini][1]:
                mini=j
        cards[i],cards[mini]=cards[mini],cards[i]

def stabel_test(orders,cards):
    for order in orders:
        n=-1
        for c in order:
            p=n
            n=cards.index(c)
            if p>n:
                return False
    return True

sys.stdin.readline()
data1=sys.stdin.readline().split()
data2=data1[:]
orders=[[c for c in data1 if c.endswitch(str(i))] for i in range(1,10)]
orders=[o for o in orders if len(c)>1]

bubble(data1)
print(*data1)
print('Stable' if stabel_test(orders, data1) else 'Not stable')

selection(data2)
print(*data2)
print('Stable' if stable_test(orders, data2) else 'Not stable')

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()

def bubble(cards):
    for i in range(len(cards)):
        for j in range(len(cards)-1, i, -1):
            if cards[j][1]<cards[j-1][1]:
                cards[j],cards[j-1]=cards[j-1],cards[j]

def selection(cards):
    for i in range(len(cards)):
        mini=i
        for j in range(i,len(cards)):
            if cards[j][1]<cards[mini][1]:
                mini=j
        cards[i],cards[mini]=cards[mini],cards[i]

def stable_test(orders,cards):
    for order in orders:
        n=-1
        for c in order:
            p=n
            n=cards.index(c)
            if p>n:
                return False
    return True

sys.stdin.readline()
data1=sys.stdin.readline().split()
data2=data1[:]
orders=[[c for c in data1 if c.endswith(str(i))] for i in range(1,10)]
orders=[o for o in orders if len(c)>1]

bubble(data1)
print(*data1)
print('Stable' if stable_test(orders, data1) else 'Not stable')

selection(data2)
print(*data2)
print('Stable' if stable_test(orders, data2) else 'Not stable')
from functools import lru_cache

# This TLEs, just checking correctness

R, C, K = [int(x) for x in input().split()]
grid = [[0 for c in range(C)] for r in range(R)]
for r, c, v in [[int(x) for x in input().split()] for i in range(K)]:
    grid[r - 1][c - 1] = v

# for row in grid:
#    print(row)


def best3(r, c1, c2):  # c1 inclusive, c2 exclusive
    return sum(sorted(grid[r][c1:c2], reverse=True)[:3])


@lru_cache(maxsize=None)
def dp(r, c):  # inclusive
    if r < 0 or c < 0:
        return 0
    best = 0
    for c1 in range(c + 1):
        best = max(best, dp(r - 1, c1) + best3(r, c1, c + 1))
    return best


print(dp(R - 1, C - 1))


### FIXED CODE ###

import io
import os
from collections import defaultdict

DEBUG = False
if not DEBUG:

    input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

    R, C, K = [int(x) for x in input().split()]
    grid = [[0 for c in range(C)] for r in range(R)]
    for r, c, v in ((int(x) for x in input().split()) for i in range(K)):
        grid[r - 1][c - 1] = v
else:
    import random

    random.seed(0)
    R, C = 3000, 3000
    # 2 * 10**5 / 90 * 10**5 full
    grid = [
        [int(random.randint(1, 90) <= 2) * random.randint(0, 10 ** 9) for c in range(C)]
        for r in range(R)
    ]
    print(sum(bool(grid[r][c]) for r in range(R) for c in range(C)))
    print("done gen")

    from timeit import default_timer as timer

    startTime = timer()


currRow = [[0 for i in range(3 + 1)] for c in range(C + 1)]
prevRow = [0 for c in range(C + 1)]
nextPrevRow = [0 for c in range(C + 1)]

inf = float("inf")
for r in range(R):
    for c in range(C):
        for numTakenThisRow in range(3 + 1):
            best = max(
                currRow[c - 1][numTakenThisRow],  # came from left
                prevRow[c],  # came from top, didn't take curr
                currRow[c - 1][numTakenThisRow - 1] + grid[r][c]
                if numTakenThisRow
                else 0,  # came from left, took curr
                prevRow[c] + grid[r][c]
                if numTakenThisRow == 1
                else 0,  # came from top, took curr
            )
            currRow[c][numTakenThisRow] = best
        nextPrevRow[c] = max(currRow[c][i] for i in range(3 + 1))
    prevRow, nextPrevRow = nextPrevRow, prevRow
print(prevRow[C - 1])

if DEBUG:
    print(timer() - startTime)
import itertools
import numpy as np
N = int(input())
S = [i for i in list(input())]
Q = int(input())
k = [int(i) for i in input().split()]
S = np.array(S, dtype=None)
 
index_D = np.where(S == 'D')[0]
index_M = np.where(S == 'M')[0]
index_C = np.where(S == 'C')[0]
xx, yy, zz = np.meshgrid(index_D, index_M, index_C)
a_b_c = np.c_[xx.ravel(), yy.ravel(), zz.ravel()]

for k_i in k:
    count = 0
    for abc in a_b_c:
        if abc[0] < abc[1] < abc[2] and abc[2] - abc[0] < k_i:
            count += 1
    print(count)
    

### FIXED CODE ###

import numpy as np
N = input()
a = [int(i) for i in input().split()]
ans = np.argmin(np.abs(a - np.mean(a)))
print(ans)
import copy

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

ansA = 0
for i in range(N-2):
  if A[i] < 0:
    A[i+1] *= -1
  ansA += abs(A[i])
if A[-3] == 0:
  ansA += abs(A[-1])+abs(A[-2])
else:
  ansA += abs(A[-1]+A[-2])
ansB = 0
for i in reversed(range(2, N)):
  if X[i] < 0:
    X[i-1] *= -1
  ansB += abs(X[i])
if X[2] == 0:
  ansB += abs(X[0])+abs(X[1])
else:
  ansB += abs(X[0]+X[1])
print(max(ansA, ansB))



### FIXED CODE ###

from collections import deque

N = int(input())
A = list(map(int, input().split()))
minAbs = 10**10
countMinus = 0
S = 0
for a in A:
  countMinus += (1 if a < 0 else 0)
  S += abs(a)
  minAbs = min(minAbs, abs(a))
print(S-2*(0 if countMinus % 2 == 0 else minAbs))
n = int(input())
m = list(map(int,input().split()))
o = []
c  = 0
for i in m:
  o.append(1/m[c])
  c += 1
s = sum(o)
print(1/s)

### FIXED CODE ###

a = int(input())
s = input()
if a >=3200:
  print(s)
else:
  print("red")
from sympy import nextprime
print(nextprime(int(input())-1))


### FIXED CODE ###

def prime(n):
    for i in range(2, n):
        if n%i == 0: break
    else: return True
    return False

n = int(input())
while not prime(n): n += 1
else: print(n)
k, n = input().split()
a = list(map(int, input().split()))

max = 0

for i in range(n - 1):
  if a[i + 1] - a[i] > max:
    max = a[i + 1] - a[i]

if (k - a[n]) + a[0] >= max:
  max = (k - a[n]) + a[0]

print(k - max)

### FIXED CODE ###

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

max = 0

for i in range(n - 1):
  if a[i + 1] - a[i] > max:
    max = a[i + 1] - a[i]

if (k - a[n - 1]) + a[0] >= max:
  max = (k - a[n - 1]) + a[0]

print(k - max)
import numpy as np

def az18_2():
    n,m = map(int,raw_input().split())
    a = np.array([map(int, raw_input().split()) for i in range(n)])
    b = np.array([input() for i in range(m)])
    for i in range(n):
        print a.dot(b)[i]
az18_2()

### FIXED CODE ###

def az18():
    n,m = map(int,raw_input().split())
    a = [[0 for i in range(m)] for j in range(n)]
    b = [0 for i in range(m)]
    for i in range(n):
        a[i] = map(int,raw_input().split())
    for i in range(m):
        b[i] = input()
    for i in range(n):
        t = map(lambda (x,y): x*y, zip(a[i],b))
        print sum(t)
        
    
    
az18()
N, K = map(int, input().split())
ans = N
x = abs(x - K * max(x // K, 1))
while ans > x:
    ans = x
    x = abs(x - K * max(x // K, 1))
print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
ans = N
x = abs(N - K * max(N // K, 1))
while ans > x:
    ans = x
    x = abs(x - K * max(x // K, 1))
print(ans)
s = input()
k = int(input())
if len(s) <= k:
  print(s)
else:
  print("...{}".format(s[:k]))

### FIXED CODE ###

k = int(input())
s = input()
if len(s) <= k:
  print(s)
else:
  print("{}...".format(s[:k]))
x=list(input().split())
x1=int(x[0])
y1=int(x[1])
x2=int(x[2])
y2=int(x[3])
xlength=abs(x1-x2)
ylength=abs(y1-y2)
if x1>x2 and y2>y1:
  x3=x2-ylength
  y3=y2-xlength
  x4=x3+xlength
  y4=y3-ylength
elif x1>x2 and y1>y2:
  x3=x2+xlength
  y3=y2-ylength
  x4=x3+ylength
  y4=y3+xlength
elif x1<x2 and y1>y2:
  x3=x2+ylength
  y3=y2+xlength
  x4=x3-xlength
  y4=y3+ylength
elif x1<x2 and y1<y2:
  x3=x2-xlength
  y3=y2+ylength
  x4=x3-ylength
  y4=y3-xlength
  
print(str(x3)+' '+str(y3)+' '+str(x4)+' '+str(y4))

### FIXED CODE ###

x=list(input().split())
x1=int(x[0])
y1=int(x[1])
x2=int(x[2])
y2=int(x[3])
xlength=x2-x1
ylength=y2-y1
x3=x2-ylength
y3=y2+xlength
x4=x1-ylength
y4=y1+xlength

  
print(str(x3)+' '+str(y3)+' '+str(x4)+' '+str(y4))
N = int(input())
A = list(map(int,input().split()))
C = [0,0,0]
Ans = 1
MOD = 1000000007
for a in A:
    ask = C.count(a)
    ind = C.index(a)
    C[ind] += 1
    Ans = (Ans*ask)%MOD
print(Ans)


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
C = [0,0,0]
Ans = 1
MOD = 1000000007
for a in A:
    ask = C.count(a)
    if ask==0:
        Ans=0
        break
    ind = C.index(a)
    C[ind] += 1
    Ans = (Ans*ask)%MOD
print(Ans)
a,b=int(input().split())
if a-2*b>0:
  　　print(a-2*b)
else:
　　　　print(0)


### FIXED CODE ###

a,b=map(int,input().split())
if a-2*b>0:
    print(a-2*b)
else:
    print(0)
import math


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

y = [abs(xi - X) for xi in x]
r = y[0]

for i in range(N-1):
    if y[i+1] != 0:
        r = math.gcd(r, y[i+1])

print(r)


### FIXED CODE ###

def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x


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

y = [abs(xi - X) for xi in x]
r = y[0]

for i in range(N-1):
    if y[i+1] != 0:
        r = gcd(r, y[i+1])

print(r)
from itertools import product
a,b,c,d=list(input())
for o,p,q in product("-+",repeat=3):
    if eval(a+o+b+p+c+q+d)==7:
        print(a+o+b+p+c+q+d+"=7")
        break

### FIXED CODE ###

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

diff1 = c - b
a += diff1
diff2 = c - a
if diff2 % 2 == 0:
    diff2 //= 2
else:
    diff2 += 1
    diff2 //= 2
    diff2 += 1

print(diff1 + diff2)
import sys

a, b = input().split(" ")
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a, b = input().split(" ")
a = int(a)
b = int(b)
if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")
s=input()
for _ in range(int(input())):
    a=input().split()
    i,j=map(int, a[1:3])
    if a[0] == "print":
        print(s[i:j+1])
    elif a[0] == "reverse":
        t1=s[0:i]
        t2=list(s[i:j+1])
        t2.reverse()
        t3=s[j+1:]
        s=t1+"".join(t2)+t3
    else:
        s=s[0:i]+a[3]+s[j+1:]

### FIXED CODE ###

s=input()
for _ in range(int(input())):
    a=input().split()
    i,j=map(int, a[1:3])
    if a[0] == "print":
        print(s[i:j+1])
    elif a[0] == "reverse":
        t1=s[0:i]
        t2=list(s[i:j+1])
        t2.reverse()
        t3=s[j+1:]
        s=t1+"".join(t2)+t3
    else:
        s=s[0:i]+a[3]+s[j+1:]
while 1:
    m,n=map(int,input().split())
    if m==0:break
    a,i,c=[i+1 for i in range(m)],0,0
    while i<n:
        i+=1
        b,f=input(),0
        if m==1:continue
        if i%15==0:
            if b!='FizzBuzz':
                del a[c]
                f=1
        elif i%5==0:
            if b!='Buzz':
                del a[c]
                f=1
        elif i%3==0:
            if b!='Fizz':
                del a[c]
                f=1
        else:
            if b!=str(i):
                del a[c]
                f=1
        if f:m-=1
        else:c=(c+1)%m
    print(*a)

### FIXED CODE ###

while 1:
    m,n=map(int,input().split())
    if m==0:break
    a,i,c=list(range(1,m+1)),0,0
    while i<n:
        i+=1
        b,f=input(),0
        if m<2:continue
        if i%15==0:
            if b!='FizzBuzz':
                del a[c]
                f=1
        elif i%5==0:
            if b!='Buzz':
                del a[c]
                f=1
        elif i%3==0:
            if b!='Fizz':
                del a[c]
                f=1
        elif b!=str(i):
            del a[c]
            f=1
        if f:m-=1
        else:c+=1
        c%=m
    print(*a)
import math
a,b,c,d = [int(i) for i in input().split()]

x = (c-a) ** 2
y = (d-b) ** 2

total = (x + y)

print(math.sqrt(total))

### FIXED CODE ###

import math

x,y,X,Y = [float(i) for i in input().split()]
print(math.sqrt((x-X)**2 + (y-Y)**2))
n, x = map(int, input().split())
l = list(map(int, input().split()))

int d = 0;
for i in range(n):
  if d < x:
    d += l[i]
  else:
    break
    
print(i)
  

### FIXED CODE ###

N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
D = 0
ans = 1

for i in range(N):
    D += L[i]
    if D <= X:
        ans += 1

print(ans)
#!/usr/bin/env python3
N, M = map(int, input().split())
L = sorted(list(map(int, input().split())) for _ in range(N))

ans = 0
cnt = 0
for A, B in L:
    if cnt + B > M:
        ans += A * (M - cnt) if cnt + B > M else B
        break
    ans += A * B
    cnt += B

print(ans)


### FIXED CODE ###

#!/usr/bin/env python3


def f(x):
    if x % 4 == 0:
        return x
    elif x % 4 == 1:
        return 1
    elif x % 4 == 2:
        return x + 1
    else:
        return 0


A, B = map(int, input().split())
print(f(A) ^ f(B) ^ A)
import itertools
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
for cx, cy in itertools.product(range(0,101), repeat=2):
  hhh = []
  for i in xyh:
    xi, yi, hi = i[0], i[1], i[2]
    if hi==0:
      if (h-abs(xi-cx)-abs(yi-cy))<=0:
        continue
      else:
        break
    h = hi + abs(xi-cx) + abs(yi-cy)
    hhh.append(h)
  if len(set(hhh)) == 1:
    print(cx, cy, h)
    break

### FIXED CODE ###

import itertools
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
for cx, cy in itertools.product(range(0,101), repeat=2):
  flag = False
  hhh = []
  for i in range(n):
    if xyh[i][2] != 0:
      h = xyh[i][2] + abs(xyh[i][0]-cx) + abs(xyh[i][1]-cy)
      hhh.append(h)
  if len(set(hhh)) == 1:
    flag = True
    for i in range(n):
      if xyh[i][2] == 0:
         if hhh[0] - abs(xyh[i][0]-cx) - abs(xyh[i][1]-cy) > 0:
            flag = False
  if flag:
    print(cx, cy, hhh[0])
a,b = map(int,input().split())
if a != b:
    ans = max(a,b) + max(a,b) - 1
else:
    ans = a*2:
print(ans)


### FIXED CODE ###

a,b = map(int,input().split())
if a != b:
    ans = max(a,b) + max(a,b) - 1
else:
    ans = a*2
print(ans)
def insertion_sort(a, n, g):
    ct = 0
    for i in range(g, n):
        v = a[i]
        j = i-g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j -= g
            ct += 1
        a[j+g] = v
    return ct

def interval_list(n):
    m = 0
    gi= 1
    g = []
    while b <= n:
        m += 1
        g.append(gi)
        b = 4**m + 3 * 2**(m-1) + 1
    return g.reverse()

if __name__ == "__main__":
    n = int(input())
    A = list(int(input()) for _ in range(n))
    G = interval_list(n)
    print(len(G))
    print(*G)
    
    ct= 0
    for i in G:
        ct += insertion_sort(A, n, i)
    print(ct)
    print(*A, sep="\n")

### FIXED CODE ###

def insertion_sort(a, n, g):
    ct = 0
    for i in range(g, n):
        v = a[i]
        j = i-g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j -= g
            ct += 1
        a[j+g] = v
    return ct

def interval_list(n):
    m = 0
    gi= 1
    g = []
    while gi <= n:
        m += 1
        g.append(gi)
        gi = 4**m + 3 * 2**(m-1) + 1
        # good convergence
        # http://www.programming-magic.com/20100507074241/
    g.reverse()
    return g


if __name__ == "__main__":
    n = int(input())
    A = list(int(input()) for _ in range(n))
    G = interval_list(n)
    print(len(G))
    print(*G)
    
    ct= 0
    for i in G:
        ct += insertion_sort(A, n, i)
    print(ct)
    print(*A, sep="\n")
import sys

mod = 10**9 + 7
N = int(sys.stdin.readline())

stones = []
for _ in range(N):
    stones.append(int(sys.stdin.readline()) - 1)

left = [-1 for _ in range(N+5)]
dp = [0 for _ in range(N+5)]
dp[0] = 1
for i in range(N):
    dp[i+1] = dp[i]
    # 同じ色が前回出現した位置
    c = stones[i]
    if 0 <= left[c] < i - 1:
        dp[i+1] += dp[left[c] + 1]
    
    dp[i+1] %= mod
    left[c] = i

print(dp[N])

### FIXED CODE ###

import sys

mod = 10**9 + 7
N = int(sys.stdin.readline())

stones = []
for _ in range(N):
    stones.append(int(sys.stdin.readline()))

left = [-1 for _ in range(2*10**5+1)]
dp = [0 for _ in range(N+5)]
dp[0] = 1
for i in range(N):
    dp[i+1] = dp[i]
    # 同じ色が前回出現した位置
    c = stones[i]
    if 0 <= left[c] < i - 1:
        dp[i+1] += dp[left[c] + 1]
    
    dp[i+1] %= mod
    left[c] = i

print(dp[N])
n,k= list(map(int,input().split()))
pos= list(map(int,input().split()))
pos_abs =list(map(abs, pos))
pos_abs.sort()
#print(pos_abs)
ls = pos_abs[:k]
high = 0
low = 0
count =0
for a in ls[::-1]:
    if a in pos and high == 0:
        high = a
        count += 1
    elif a not in pos and low ==0:
        low = a
        count += 1
        
    if count == 2:
        break 
if low ==0 and ls.count(ls[-2])==2:
    low = ls[-2]
#print(high,low)
if high >=low:
    print(high+ low*2)
else:
    print(high*2+low)

### FIXED CODE ###

n,k= list(map(int,input().split()))
pos= list(map(int,input().split()))
ans = 10**13
for i in range(n-k+1):
    a1 = abs(pos[i]) + abs(pos[i] - pos[i+k-1])
    a2 = abs(pos[i+k-1]) + abs(pos[i] - pos[i+k-1])
    ans = min(ans, a1,a2)
print(ans)
n = input()
if n==1:
    print("Hello World")
else:
    a=input()
    b=input()
    print(a+b)


### FIXED CODE ###

n =int(input())
if n==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
x = 0
y = [0] * (N - 1)
for i in range(M - 1):
	a = X[i+1] - X[i]
	b = min(y)
	if a > b:
		y.remove(b)
		y.append(a)
		x += b
	else:
		x += a
print(x)

### FIXED CODE ###

N, M = map(int, input().split())
X = list(map(int, input().split()))
if N >= M:
	print(0)
else:
	X.sort()
	Y = [0] * (M - 1)
	for i in range(M - 1):
		Y[i] = X[i+1] - X[i]
	Y.sort(reverse = True)
	print(max(X) - min(X) - sum(Y[:N - 1]))
import sys
i=0
j=0
k=0
t=0
m=0
s=0
lists=[]
lists2 =[]

#数値の数を受け取る
line = int(input())

#数値を受け取ってリストの作成
while i < line:
	a = int(input())
	#print (a)
	lists.insert(i,a)
	i +=1

#数値の足し合わせ
while j < line:
    s += lists[j]
    j +=1

#正しければ出力
if s%10 != 0:
	print(s)
else:
    #10の倍数以外のリスト作成
    while k < line:
        if lists[k]%10 != 0:
	        lists2.insert(m,lists[k])
	        m +=1
        k +=1
    t = min(lists2)
    print(s-t)

### FIXED CODE ###

import sys
i=0
j=0
k=0
t=0
m=0
s=0
lists=[]
lists2 =[]

#数値の数を受け取る
line = int(input())

#数値を受け取ってリストの作成
while i < line:
	a = int(input())
	#print (a)
	lists.insert(i,a)
	i +=1

#数値の足し合わせ
while j < line:
    s += lists[j]
    j +=1

#正しければ出力
if s%10 != 0:
	print(s)
else:
    #10の倍数以外のリスト作成
    while k < line:
        if lists[k]%10 != 0:
	        lists2.insert(m,lists[k])
	        m +=1
        k +=1
    if lists2 !=[]:
        t = min(lists2)
        print(s-t)
    else:
    	print(0)
#!/mnt/c/Users/moiki/bash/env/bin/python
import math
from functools import reduce


N,X = map(int, input().split())
A = list(map(int, input().split()))
A = [ abs(a-X) for a in A]

print( reduce(math.gcd, A) )



### FIXED CODE ###

#!/mnt/c/Users/moiki/bash/env/bin/python
# import math
from functools import reduce
def gcd(m, n):
  while n:
    m, n = n, m%n
  return m

N,X = map(int, input().split())
A = list(map(int, input().split()))
A = [ abs(a-X) for a in A]

print( reduce(gcd, A) )
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  string s;
  cin >> s;
  string t;
  int q;
  cin >> q;
  rep(qi,q){
    int ty;
    cin >> ty;
    if (ty == 1){
      swap(s,t);
    }else{
      int f; char c;
      cin >> f >> c;
      if (f == 1){
	t += c;
      }else{
	s+=c;
      }}
  }
  reverse(t.begin(), t.end());
  t += s;
  cout << t << endl;
  return 0;
}

### FIXED CODE ###

from collections import deque

q = deque(input())
Q = int(input())
reverse = -1

for i in range(Q):
    X = input().split()
    if X[0] == "1":
        reverse *= -1
    # if X[1] == "1":
    elif X[1] == "1":
        if reverse == -1:
            q.appendleft(X[2])
        else:
            q.append(X[2])
    elif X[1] == "2":
        if reverse == -1:
            q.append(X[2])
        else:
            q.appendleft(X[2])
# if reverse == 1: q.reverse()

if reverse == -1:
    print(''.join(q))
else:
    print(''.join(list(q)[::-1]))