Harryxun/stf_run huggingface dataset:
def insertionSort(A, n, g):
    global count
    for i in range(g,n):
        v = A[i]
        j = i - g
        #間隔gずつ選択ソートを行っていく
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j -= g
            count += 1
        A[j+g] = v

def shellSort(A, n):
    global count
    G = [i for i in range(1,n) if i % 3 == 1]   #シェルソートで用いる配列Gはmod3 == 1の倍数のを用いる
    m = len(G)
    G = G[::-1]
    for i in G:
        insertionSort(A, n, i)
    return A, G, m 

#input data
n = int(input())
A = [int(input()) for i in range(n)]
count = 0

A, G, m = shellSort(A, n)
print (m)
print (G)
print (cnt)
for i in range(len(A)):
    print (A[i])

### FIXED CODE ###

import math

def insertionSort(A, n, g):
    cnt = 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
            cnt += 1
        A[j + g] = v
    return cnt


def shellSort(A, n):
    cnt = 0
    j = int(math.log(2 * n + 1, 3)) + 1
    G = list(reversed([(3 ** i - 1)// 2 for i in range(1, j)]))
    m = len(G)
    for i in range(m):
        cnt += insertionSort(A, n, G[i])
    return A, cnt, G, m

n = int(input())
A = [int(input()) for i in range(n)]
ans, count, G, m = shellSort(A, n)
print(m)
print(' '.join(map(str,G)))
print(count)
[print(i) for i in A]
# coding: utf-8

a, b = map(int, input().split())
if not 0 <= a <= 9 or not 0 <= b <= 9:
  print("-1")
  sys.exit()
  
c = a * b
print(c)



### FIXED CODE ###

# coding: utf-8

a, b = map(int, input().split())
if not 0 <= a <= 9 or not 0 <= b <= 9:
  print("-1")
else:
  c = a * b
  print(c)
import numpy as np
import copy

N= int(input())
S=input()
SS= copy.copy(S)
S = list(S)
#N, A, B = map(int, input().split())

flag = 1
#print(len(S))
while flag == 1:
    flag = 0
    flag2 = 1
    i = 0
    while flag2:
    # for i in range(len(S)-1):
        #print(S)
        #print(i)
        if S[i]=="(" and S[i+1] ==")":
            # print(S, i)
            flag = 1
            del S[i] 
            del S[i]
            i -= 1
            # print(S, i)
        i += 1
        i = max(0,i)
        #print(i, len(S))
        if i+1>=len(S):
            flag2 = 0
a=0
b=0
for i in range(len(S)):
    if S[i]=="(":
        b+=1
    elif S[i]==")":
        a+=1
#print(S)
# initialization of string to ""
A = ""
B = ""

# traverse in the string
for x in range(a):
    
    A += "("   
for x in range(b):    
    B += ")"   

        
#print(str(A)+SS+str(B))
print(A+SS+B)
    



### FIXED CODE ###

import numpy as np
import copy

N= int(input())
S=input()
SS= copy.copy(S)
S = list(S)
#N, A, B = map(int, input().split())

flag = 1
#print(len(S))
while flag == 1:
    flag = 0
    flag2 = 1
    i = 0
    while flag2 and len(S)>1:
    # for i in range(len(S)-1):
        #print(S)
        if S[i]=="(" and S[i+1] ==")":
            # print(S, i)
            flag = 1
            del S[i] 
            del S[i]
            i -= 1
            # print(S, i)
        i += 1
        i = max(0,i)
        if i+1>=len(S):
            flag2 = 0
a=0
b=0
for i in range(len(S)):
    if S[i]=="(":
        b+=1
    elif S[i]==")":
        a+=1
#print(S)
# initialization of string to ""
A = ""
B = ""

# traverse in the string
for x in range(a):
    
    A += "("   
for x in range(b):    
    B += ")"   

        
#print(str(A)+SS+str(B))
print(A+SS+B)
n, l = map(int, input().split())
 
total = 0
min_taste = 1000000000
 
for i in range(n):
    taste = l + i
    total += taste
    if abs(taste) < abs(min_taste):
        min_taste = taste
 
print(total - dis_min)

### FIXED CODE ###

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

taste_list = []

dis_min = 1000000000

for i in range(n):
    taste = l + i
    taste_list.append(taste)
    if abs(taste) < abs(dis_min):
        dis_min = taste

print(sum(taste_list) - dis_min)
words = input().split(" ")
for word in words:
    for w in word:
       if w.isalpha:
           if w.isupper():
               w.lower()
            elif w.islower:
                w.upper()
print(",".join(words))

    

### FIXED CODE ###

print(input().swapcase())
N = int(input())

Ls = set()
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        Ls.add((i, j))

K = N - (N % 2)
for i in range(1, K):
    Ls.remove((i, K - i + 1))

print(len(Ls))
for l in Ls:
    print("%d %d" % l)

### FIXED CODE ###

N = int(input())

Ls = set()
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        Ls.add((i, j))

K = N - (N % 2)
for i in range(1, K // 2 + 1):
    Ls.remove((i, K - i + 1))

print(len(Ls))
for l in Ls:
    print("%d %d" % l)
#https://atcoder.jp/contests/dp/tasks/dp_d
N,W = map(int,input().split())
Goods_List=[]
for i in range(N):
    Goods_List.append(list(map(int,input().split())))

Sum_Weight = sum(map(lambda x:x[0],Goods_List))
dp = [[-1] * Sum_Weight for i in range(N)]

for i in range(N):
    Current_Weight = Goods_List[i][0]
    Current_Value  = Goods_List[i][1]
    dp[i][0] = 0
    if i == 0:
        dp[i][Current_Weight] = Current_Value
    else:
        Search_List = [i for i, x in enumerate(dp[i-1]) if x > -1]
        Comb_List = [0,Current_Weight]
        for j in Search_List:
            for k in Comb_List:
                if j + k > W:
                    break
                elif k == 0:
                    dp[i][j+k] = dp[i-1][j+k]
                else:
                    dp[i][j+k] = max(dp[i-1][j+k],dp[i-1][j]+Current_Value)
                    
            

            
            
    
print(max(dp[N-1]))

### FIXED CODE ###

#https://atcoder.jp/contests/dp/tasks/dp_d
N,W = map(int,input().split())
Goods_List=[]
for i in range(N):
    Goods_List.append(list(map(int,input().split())))

Sum_Weight = sum(map(lambda x:x[0],Goods_List))
dp = [[-1] * (W + 1) for i in range(N)]

for i in range(N):
    Current_Weight = Goods_List[i][0]
    Current_Value  = Goods_List[i][1]
    dp[i][0] = 0
    if (i == 0) & (Current_Weight <= W) :
        dp[i][Current_Weight] = Current_Value
    elif i > 0:
        Last_Search_List = [j for j, x in enumerate(dp[i-1]) if x > -1]
        Current_Search_List = list(map(lambda x:x+Current_Weight,Last_Search_List))
        ##まずは前回値を入れる
        for l in range(len(Last_Search_List)):
            Last_Search_Weight =  Last_Search_List[l] 
            dp[i][Last_Search_Weight] = dp[i-1][Last_Search_Weight]
        ##今回値と比べる
        for k in range(len(Current_Search_List)):
            Last_Search_Weight =  Last_Search_List[k] 
            Current_Search_Weight = Current_Search_List[k]
            if Current_Search_Weight > W:
                break
            else:
                dp[i][Current_Search_Weight] = max((dp[i-1][Last_Search_Weight] + Current_Value),
                                                   dp[i-1][Current_Search_Weight])


print(max(dp[N-1]))
#include <bits/stdc++.h>
using namespace std;
//#define MOD 1000000007
#define MOD 998244353
#define INF 100000000000000009
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

int gcd(int a,int b){
    if(a<=0||b<=0){
        return 0;
    }
    if(a<b)swap(a,b);
    int r=a%b;
    while(r){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}


signed main(){
    int N;
    int A[114514];
    cin >> N;
    REP(i,N){cin >> A[i];}
    if(N==2){
        cout << max(A[0],A[1]) << endl;
        return 0;
    }
    sort(A,A+N);
    int B[114514];
    B[0]=A[0];
    REP(i,N-1){
        B[i+1]=A[i+1]-A[i];
    }
    sort(B,B+N);
    B[0]+=B[1];
    B[1]=B[0];
    int Ans=B[0];
    REP(i,N){
        Ans=gcd(Ans,B[i]);
    }
    cout << Ans << endl;
    return 0;
}


### FIXED CODE ###

def gcd(a , b):
    r = a%b
    while r:
        a=b
        b=r
        r=a%b
    return b

N=int(input())
A=list(map(int,input().split()))
L=[0]*100000
R=[0]*100000
L[0]=A[0]
for i in range(N-1):
    L[i+1]=gcd(L[i],A[i+1])
R[N-1]=A[N-1]
for i in reversed(range(N-1)):
    R[i]=gcd(R[i+1],A[i])
Ans=max(L[N-2],R[1])
for i in range(1,N-1):
    Ans=max(Ans,gcd(L[i-1],R[i+1]))
print(Ans)
a=list(map(int,input().split()))
b=list(map(int,input().split()))
print(a[0]-b[0])*(a[1]-b[1])

### FIXED CODE ###

a=list(map(int,input().split()))
b=list(map(int,input().split()))
print((a[0]-b[0])*(a[1]-b[1]))
if __name__ == "__main__":
    N = int(input())
    A = map(int, input().split())
    even_ls = [i for i in A if i%2 == 0 ]
    for i in even_ls:
        if i % 3 == 0 or i % 5 == 0:
            ret = "APPROVED"
        else:
            ret  = "DENIED"
        break
    print(ret)


### FIXED CODE ###



if __name__ == "__main__":
    N = int(input())
    A = map(int, input().split())
    for i in A:
        if i % 2 ==0:
            if i % 3 != 0 and i % 5 != 0:
                    print("DENIED")
                    exit(0)
            else:
                pass
        else:
            pass
    print("APPROVED")
import math
while True:
	x = math.factorial(int(input()))
	n = list(str(x))
	con = 0
	for i in range(len(n)-1,0,-1):
		if n[i] != '0':
			break
		con += 1
	print(con)


### FIXED CODE ###

import math
while True:
	x = int(input())
	if x == 0: break
	n = list(str(math.factorial(x)))
	con = 0
	for i in range(len(n)-1,0,-1):
		if n[i] != '0':
			break
		con += 1
	print(con)
a, b, c = map(int, input().split())

a, b = b, a
a, c = c, a

print(a + " " + b + " " + c)

### FIXED CODE ###

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

a, b = b, a
a, c = c, a

print(a, b, c)
n = int(input())
h= list(map(int, input().split())) 

count = 0
        
def dfs(s):
    if s + 1 < len(h):
        if h[s] >= h[s+1]:
            global count 
            count = count + 1
            return dfs(s+1)
    

for i in reversed(range(len(h))):
    count = 0
    aaa = dfs(i)
    if count == i:
        print(count)
        break
    

### FIXED CODE ###

n = int(input())
h= list(map(int, input().split())) 

count = 0
ans = 0

for i in range(len(h)):
    if i + 1 < len(h):
        if h[i] >= h[i+1]:
            count = count + 1
        else:
            count = 0
    if count > ans :
        ans = count
        
print(ans)
op = ["+", "-", "*"]
x = int(raw_input())
while True:
    a, b, c, d = map(str, raw_input().split())
    if a == 0 and c == 0:
        break
    n = [0,1,2,3]
    q = [str(a),str(b),str(c),str(d)]
    flag = 0
    m = [0,1,2,3]
    m.remove(ii)
    for jj in m:
        l = [0,1,2,3]
        l.remove(ii);l.remove(jj)
        for kk in l:
            o = [0,1,2,3]
            o.remove(ii);o.remove(jj);o.remove(kk)
            for ll in o:
                for i in op:
                    for j in op:
                        for k in op:
                            for ii in n:
                                if eval( "((("+q[ii]+k+q[jj]+")"+j+q[kk]+")"+i+q[ll]+")") == x:
                                    print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")"
                                    flag = 1
                                    break
                                if eval( "(("+q[ii]+k+q[jj]+")"+i+"("+q[kk]+j+q[ll]+"))" ) == x:
                                    print "((",q[ii],k,q[jj],")",i,"(",q[kk],j,q[ll],"))"
                                    flag = 1
                                    break
                            if flag == 1:
                                break
                        if flag == 1:
                            break
                    if flag == 1:
                        break
                if flag == 1:
                    break
            if flag == 1:
                break
        if flag == 1:
            break
    if flag == 0:
        print 0

### FIXED CODE ###

op = ["+", "-", "*"]
while True:
    a, b, c, d = map(str, raw_input().split())
    if a == "0" and c == "0":
        break
    n = [0,1,2,3]
    q = [a,b,c,d]
    flag = 0
    for ii in n:
        m = [0,1,2,3]
        m.remove(ii)
        for jj in m:
            l = [0,1,2,3]
            l.remove(ii);l.remove(jj)
            for kk in l:
                o = [0,1,2,3]
                o.remove(ii);o.remove(jj);o.remove(kk)
                for ll in o:
                    for i in op:
                        for j in op:
                            for k in op:
                                if eval( "((("+q[ii]+k+q[jj]+")"+j+q[kk]+")"+i+q[ll]+")") == 10:
                                    print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")"
                                    flag = 1
                                    break
                                if eval( "(("+q[ii]+k+q[jj]+")"+i+"("+q[kk]+j+q[ll]+"))" ) == 10:
                                    print "((",q[ii],k,q[jj],")",i,"(",q[kk],j,q[ll],"))"
                                    flag = 1
                                    break
                            if flag == 1:
                                break
                        if flag == 1:
                            break
                    if flag == 1:
                        break
                if flag == 1:
                    break
            if flag == 1:
                break
        if flag == 1:
            break
    if flag == 0:
        print 0
# -*- coding: utf-8 -*-
#グローバル変数
pn_list = {2:0,3:0}

def next_pn():
    npn = sorted(list(pn_list.keys()))[-1] + 2
    pn_flg = 0
    while pn_flg == 0:
        for i in sorted(list(pn_list.keys())):
            if npn % i == 0:
                break
            if (i ** 2) > npn:
                pn_flg = 1
                break
        if pn_flg == 1:
            break # 素数が見つかったらbreak
        else:
            npn += 2
    pn_list[npn] = 0
    return npn

def check_a(n,a):
    res = "ok"
    for i in range(n):
        if a[i] > 1:
            res = "notyet"
    return res

# 整数の入力
n = int(input())
s = input()
#n = 5
#s ="12 12 12 12 12"
a = [int(x) for x in s.split()]
aa = [int(x) for x in s.split()]

#素数作成
sqr_max_a = int((1.0 * 10**6) ** 0.5) + 1
#sqr_max_a = int(1.0 * 10**6)
pn = 0
while pn < sqr_max_a:
    pn = next_pn()

# a を素因数分解する
pn_lcm = []
for i in pn_list.keys():
    wareta = 1
    while wareta == 1:
        wareta = 0
        for j in range(len(a)):
            if a[j] % i == 0:
                a[j] = a[j] / i
                wareta = 1
        if wareta == 1:
            pn_list[i] += 1
            pn_lcm.append(i)
    if check_a(n,a) == "ok":
        break

for i in a:
    if i > 1:
        pn_lcm.append(i)

min_bsum = int(0)
for i in aa:
    b = 1
    aaa = i
    for j in pn_lcm:
        if aaa % j == 0:
            aaa = aaa / j
        else:
            b = b * j
    min_bsum = min_bsum + b

print(int(min_bsum % (10**9+7)))

### FIXED CODE ###

# -*- coding: utf-8 -*-
#グローバル変数
pn_list = [2,3]

def next_pn(pn):
    npn = pn + 2
    pn_flg = 0
    while pn_flg == 0:
        for i in pn_list:
            if npn % i == 0:
                break
            if (i ** 2) > npn:
                pn_flg = 1
                break
        if pn_flg == 1:
            break # 素数が見つかったらbreak
        else:
            npn += 2
    pn_list.append(npn)
    return npn

# 整数の入力
n = int(input())
s = input()
a = [int(x) for x in s.split()]
aa = [int(x) for x in s.split()]

#素数作成
sqr_max_a = int((1.0 * 10**6) ** 0.5) + 1
#sqr_max_a = int(1.0 * 10**6)
pn = 3
while pn < sqr_max_a:
    pn = next_pn(pn)

# a を素因数分解する
lcm = int(1)
for i in pn_list:
    wareta = 1
    while wareta == 1:
        wareta = 0
        for j in range(n):
            if a[j] % i == 0:
                a[j] = a[j] // i
                wareta = 1
        if wareta == 1:
            lcm = lcm * i
pn_lcm = []
for i in a:
    if i > 1:
        if i not in pn_lcm:
            pn_lcm.append(i)
            lcm = lcm * i

min_bsum = int(0)
for i in aa:
    min_bsum = min_bsum + lcm // i

print(min_bsum % (10**9+7))
def stones(input):
  	k = int(input[0])
    x = int(input[1])
    if k is 1:
        print(x)
        return x
    j = [i for i in range(x - k, x + k)]
    s = ' '.join(map(str, j))
    print(s)
    return


stones(input())

### FIXED CODE ###

def stones(input):
    k, x = map(int, input.split())
    if k is 1:
        print(x)
        return x
    j = [i for i in range(x - k + 1, x + k)]
    s = ' '.join(map(str, j))
    print(s)
    return
 
 
stones(input())
import math
a,b = list(map(int, input().split())
if a > b:
	print(1)
else:
	print(math.ceil(b/a))

### FIXED CODE ###

a, b = list(map(int, input().split()))
ans, outlet = 0, 1
while outlet < b:
  outlet -= 1
  outlet += a
  ans+=1
print(ans)
a,b=map(int,input().split())
for i in range(1,4):
    if i!=a and i!=b:
        print(i)
        break

### FIXED CODE ###

a,b=[int(input()) for _ in range(2)]
for i in range(1,4):
    if i!=a and i!=b:
        print(i)
        break
a=int(input())
b=str(input())
sum=0

riron_sum=b.count('R')*sum=b.count('G')*sum=b.count('B')
for i in range(1,a):
    for n in range(1,i):
        if i+n>N:
            j = i+d
            k = j+d
            if b[i]!=b[j] and b[j]!=b[k] and b[k]!=b[i]:
                riron_sum-=1

print(riron_sum)

### FIXED CODE ###

a=int(input())
b=str(input())
sum=0

riron_sum=b.count('R')*b.count('G')*b.count('B')

for i in range(0,a):
    for n in range(0,a+1):
        j = i+n
        k = j+n
        #print(j)
        #print(k)
        if k>=a:
        	break

        if b[i]!=b[j] and b[j]!=b[k] and b[k]!=b[i]:
                riron_sum-=1

print(riron_sum)
a=[]
for i in range(5):
    a.append(int(input()))
b=set(map(lambda x: x%10,a))
if 0 in b:
    b.remove(0)
print(sum(map(lambda x:(x/10+1)*10 if x%10 != 0 else (x/10)*10,a))+min(b)-10)

### FIXED CODE ###

a=[]
for i in range(5):
    a.append(int(input()))
b=set(map(lambda x: x%10,a))
if 0 in b:
    b.remove(0)
    if len(b) == 0:
        b.add(10)
print(sum(map(lambda x:(x/10+1)*10 if x%10 != 0 else (x/10)*10,a))+min(b)-10)
import sys
input = sys.stdin.readline

S = input()
Q = int(input())
A = [(input().split("")) for _ in range(Q)]

for i in range(Q):
  if A[i] == ("1"):
    S = ''.join(list(reversed(S)))
  else:
    if A[i][1] == "1":
      S = A[i][2] + "S"
    else:
      S = "S" + A[i][2] 
      
print(S)

### FIXED CODE ###

s = input()
q = int(input())
par = 0
pre = ""
pos = ""

for i in range(q):
  t = input().split()
  if t[0] == "1":
    par += 1
  elif (par + int(t[1]))%2 == 1:
    pre = t[2] + pre
  else:
    pos = pos + t[2]
    
ans = pre + s + pos

if par%2 == 0:
  print(ans)
else:
  print(ans[::-1])
N, M = map(int,input().split())
freq = [True]*M
for i in range(M):
    a,b = map(int,input().split())
    a-=1
    b-=1
    if freq[a]:
        freq[a] = False
    else:
        freq[a] = True

    if freq[b]:
        freq[b] = False
    else:
        freq[b] = True

ans = all(freq)
if ans:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

N, M = map(int,input().split())
freq = [True]*N
for i in range(M):
    a,b = map(int,input().split())
    a-=1
    b-=1
    if freq[a]:
        freq[a] = False
    else:
        freq[a] = True

    if freq[b]:
        freq[b] = False
    else:
        freq[b] = True

ans = all(freq)
if ans:
    print('YES')
else:
    print('NO')
import sys
a=[int(i) for i in sys.stdin.resd().split('\n')]
k=a[5]
a=a[:5][::-1]
def check(a,k):
  for i in range(len(a[:4])):
    for j in range(i,len(a)):
      if a[i]-a[j]>k:
        return False
  return True
if check(a,k):
  print('Yay!')
else:
  print(':(')

### FIXED CODE ###

import sys

d = [int(i) for i in sys.stdin.read().split('\n') if i != '']
k = d[5]
d = d[:5][::-1]


def check(k, d):
    for i in range(len(d[:4])):
        for j in range(i, len(d)):
            if d[i] - d[j] > k:
                return False
    return True


if check(k, d):
    print('Yay!')
else:
    print(':(')
s = input()
k = int(input())
m = 0
n = 0
j = 0
for i in range(len(s)):
    if s.count(s[0]) == len(s):
        print(len(s) * k // 2)
        exit()
    if len(s) <= j + 1:
        if s[0] == s[-1] and s[-1]==s[-2] and s[0]==s[1]:
            print(s[10000000000000000000000000])
        break
    if s[j] == s[j + 1]:
        if j == len(s) - 1:
            n += 1
        else:
            m += 1
        j += 1
    j += 1
print(m * k + n)


### FIXED CODE ###

s = input()
k = int(input())
m = 0
n = 0
j = 0
for i in range(len(s)):
    if s.count(s[0]) == len(s):
        print(len(s) * k // 2)
        exit()
    if len(s) <= j + 1:
        if s[0] == s[-1] == s[-2]== s[-3]== s[-4]== s[-5]== s[len(s)//3] \
                and s[0] == s[1] == s[2]== s[3]== s[4]== s[5]:
            n+=1
        break
    if s[j] == s[j + 1]:
        if j == len(s) - 1:
            n += 1
        else:
            m += 1
        j += 1
    j += 1
print(m * k + n*(k-1))
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for number in b:
    if b in a:
        a[a.index(b)] = 0
if a[0][0] == a[1][1] == a[2][2]:
    print('Yes')
else:
    for i in range(3):
        if a[i][0] == a[i][1] == a[i][2]:
            print('Yes')
            break
        elif a[0][i] == a[1][i] == a[2][i]:
            print('Yes')
            break
    else:
        print('No')

### FIXED CODE ###

import math
n = float(input())
print(math.ceil(float(n / 2)))
L=[1,0,1,2,1,2,1,1,2,1,2,1]
a,b=map(int,input().split())
if L[a]==L[b]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

L=[1,0,1,2,1,2,1,1,2,1,2,1]
a,b=map(int,input().split())
if L[a-1]==L[b-1]:
  print("Yes")
else:
  print("No")
s = input()
while s != "0":
    n = int(input())
    for i in range(n):
        h = int(input())
        s = s[h:] + s[:h]
    print(s)
    s = input()



### FIXED CODE ###

s = input()
while s != "-":
    n = int(input())
    for i in range(n):
        h = int(input())
        s = s[h:] + s[:h]
    print(s)
    s = input()
S = int(input())

if S[0] == S[1] or S [0] == S [2] or S[0] == S[3] or S[1] == S[2] or S[1] == S[3] or S[2] == S [3]:
  print('Bad')
else:
  print('Good')

### FIXED CODE ###

s = input()

if s[0] != s[1] and s[1] != s[2] and s[2] != s[3]:
  print('Good')
else:
  print('Bad')
A,B,K = map(int,input().split())
if K < A:
  print(A - k, B)
elif A <= K and K < (A + B):
  print(0, B - (K - A))
else:
  print(0,0)

### FIXED CODE ###

A,B,K = map(int,input().split())
if K < A:
  print(A - K, B)
elif A <= K and K < (A + B):
  print(0, B - (K - A))
else:
  print(0,0)
n,m = input().split(" ")
mul = n*m
if mul < 81:
  print(mul)
else:
  print(-1)

### FIXED CODE ###

a,b=map(int,input().split())
if a>9 or b>9:print(-1)
else:print(a*b)
n = int(input())
A = list(map(int, input().split()))

from functools import reduce
import fraction 


A.sort(reverse = True)

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

print(gcd_list(A))


### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))

from functools import reduce
import fractions 


A.sort(reverse = True)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

print(gcd_list(A))