Problem: There are N monsters, numbered 1, 2, ..., N.  Initially, the health of Monster i is A_i.  Below, a monster with at least 1 health is called alive.  Until there is only one alive monster, the following is repeated:    * A random alive monster attacks another random alive monster.   * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.  Find the minimum possible final health of the last monster alive.

Submission attempts (in order):
import numpy as np
n = int(input()) 
#n=3
lst = [int(i) for i in input().split()]
#lst = [2, 10, 8, 40]
#lst = [5, 13, 8, 1000000000]
#lst = [1000000000, 1000000000, 1000000000]
hps = np.array(lst)
while(1):
    hps = sorted(hps)
    print(hps)
    if(hps[0]==0): break
    if(hps[0]==hps[n-1]): break
    hps[1] = hps[1] - hps[0]
print(hps[1])

import numpy as np
n = int(input()) 
#n=4
lst = [int(input()) for i in range(n)]
#lst = [2, 10, 8, 40]
#lst = [5, 13, 8, 1000000000]
hps = np.array(lst)
while(1):
    hps = sorted(hps)
    print(hps)
    if(hps[0]==0): break
    if(hps[0]==hps[n-1]): break
    hps[1] = hps[1] - hps[0]
print(hps[1])

n = int(input()) 
lst = [int(input()) for i in range(n)]
while(1):
    hps = sorted(hps)
    #print(hps)
    if(hps[0]==0): break
    hps[1] = hps[1] - hps[0]
print(hps[1])

n = int(input()) 
#n=3
lst = [int(i) for i in input().split()]
#lst = [2, 10, 8, 40]
#lst = [5, 13, 8, 1000000000]
#lst = [1000000000, 1000000000, 1000000000]
hps = set(lst)
while(1):
    hps = sorted(hps)
    print(hps)
    if(hps[0]==0): break
    if(hps[0]==hps[n-1]): break
    hps[1] = hps[1] - hps[0]
print(hps[1])

import numpy as np
n = int(input()) 
#n=3
lst = [int(i) for i in input().split()]
#lst = [2, 10, 8, 40]
#lst = [5, 13, 8, 1000000000]
#lst = [1000000000, 1000000000, 1000000000]
hps = np.array(lst)
while(1):
    hps = np.array(sorted(hps))
    #print(hps)
    #print(hps!=0)
    #print(sum(hps!=0))
    if(sum(hps==0)!=1):
        hps[1] = hps[len(hps)-1]
        break
    if(hps[0]==0): break
    if(hps[0]==hps[len(hps)-1]): break
    hps[1] = hps[1] - hps[0]
print(hps[1])

n = int(input()) 
lst = [int(i) for i in input().split()]
while(1):
    hps = sorted(hps)
    #print(hps)
    if(hps[0]==0): break
    hps[1] = hps[1] - hps[0]
print(hps[1])

n = int(input()) 
#n=4
hps = [int(i) for i in input().split()]
#lst = [2, 2, 8, 40]
#lst = [5, 13, 8, 1000000000]
#lst = [0, 1, 0]
    ##2 4 5 -> 1
    
hps = sorted(hps)
for i in range(1,n):
    hps[0] = gcd(hps[i], hps[0])
#print(hps)
for i in range(len(hps)):
    if(hps[i]==0): continue
    print(hps[i])
    break

import numpy as np
n = int(input()) 
#n=4
lst = [int(i) for i in input().split()]
#lst = [2, 2, 8, 40]
#lst = [5, 13, 8, 1000000000]
#lst = [0, 1, 0]
hps = np.array(lst)
while(1):
    hps = sorted(hps)
    #print(hps)
    if(hps[0]==0): break
    if(hps[0]==hps[len(hps)-1]): break
    hps[1] = hps[1] - hps[0]
for i in range(len(hps)):
    if(hps[i]==0): continue
    print(hps[i])

def gcd(a,b):
    r = a%b
    #print(a,b,r)
    if(r==0): return b
    return gcd(b,r)
n = int(input()) 
#n=4
hps = [int(i) for i in input().split()]
#lst = [2, 2, 8, 40]
#lst = [5, 13, 8, 1000000000]
#lst = [0, 1, 0]
    ##2 4 5 -> 1
    
hps = sorted(hps)
for i in range(1,n):
    hps[0] = gcd(hps[i], hps[0])
#print(hps)
for i in range(len(hps)):
    if(hps[i]==0): continue
    print(hps[i])
    break

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Accepted