Problem:


Score : 500 points

Problem Statement

There is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.

You and Lunlun the dachshund alternately perform the following operation (starting from you):

Choose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.

The one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?

Constraints

1 \leq N \leq 10^5

1 \leq a_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
a_1
a_2
:
a_N

Output

If you will win, print first; if Lunlun will win, print second.

Sample Input 1

2
1
2

Sample Output 1

first

Let Color 1 be red, and Color 2 be blue. In this case, the tree bears one red apple and two blue apples.

You should eat the red apple in your first turn. Lunlun is then forced to eat one of the blue apples, and you can win by eating the other in your next turn.

Note that you are also allowed to eat two apples in your first turn, one red and one blue (not a winning move, though).

Sample Input 2

3
100000
30000
20000

Sample Output 2

second



Sample input:
2
1
2


Sample output:
first

Submission status: Wrong Answer

Solution code:
N = int(input())
tree = []
apple = 0
for i in range(N):
    tmp = int(input())
    apple += tmp
    tree.append(tmp)

# tree = [3,1,1,1]
# apple = sum(tree)
# N = len(tree)


if N == 1:
    if apple %2 == 0:
        print("second")
    else:
        print("first")
else:
    tree2 = tree.copy()
    tree2.remove(max(tree))

    if set(tree) == {1}:
        print("first")
    elif set(tree2) == {1}:
        print("first")
    elif max(tree) == 2 and tree.count(2) == 1:
        print("first")
    elif apple %2 == 0:
        print("second")
    else:
        print("first")

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = [int(input()) for _ in range(n)]

a_list.sort(reverse=True)

if n == 1:
    print("first" if a_list[0] % 2 == 1 else "second")
    exit()

elif n == 2:
    max_num = a_list[0]
    second_num = a_list[1]
    num = max_num - second_num
    print("first" if num % 2 == 1 else "second")
else:
    max_num = a_list[0]
    second_num = a_list[1]
    if second_num == 1:
        print("first")
        exit()
    num = max_num - second_num
    print("first" if num % 2 == 1 else "second")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(input()) for _ in range(N)]
a.sort()
if len(a) >= 2:
    res = a[-2]
else:
    res = a[-1]
res += sum(a[:-2]) - N
print("second" if res % 2 == 0 else "first")

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
def pF():
    print("first")
    exit()
def pS():
    print("second")
    exit()

def foddF(a):
    if a % 2:
        pF()
    else:
        pS()
def fevenF(a):
    if a % 2:
        pS()
    else:
        pF()

dA = {}
def addA(dA:dict,i:int):
    if i in dA:
        dA[i] +=1
    else:
        dA[i] = 1
for a in sys.stdin.readlines():
    addA(dA,int(a))

aA = sorted(dA.keys())

if N == 1:
    foddF(aA[0])
elif len(aA) == 1:
    foddF(aA[0])

#   n = dA[aA[0]]
#   a = aA[0]
#   if n == 1:
#       foddF(a)
#   else:
#       fevenF(a)
else:
    la = aA[-1]
    na = aA[-2]
    if la - na > 1:
        foddF(la)
        #if dA[la] == 1:
        #   foddF(la)
        #else:
        #   fevenF(la)
    else:
        fevenF(la)

Submission status: Wrong Answer

Solution code:
n =int(input())
a = int(input())
b =[a]
v = 0
if a == 1:
    v = 1
if a%2 ==1:
    ans = 1
else:
    ans = -1
    q = 1
for i in range(1,n):
    a = int(input())
    b.append(a)
    if a == 1:
        v =1
    if a%2==1:
        ans *=-1
if ans == 1 or v == 1 or (q == 1 and ans ==-1) :
   print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))

s = 0
for i in range(N):
    s += a[i]

if s % 2 == 0:
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
N = int(input())

a_list = [int(input()) for i in range(N)]

min_a = min(a_list)
min_a_num = len([1 for elm in a_list if elm == min_a])

if (min_a + min_a_num + 1 ) % 2 == 1:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = []
for _ in range(N):
    a.append(int(input()))

cnt = 0
for n in a:
    if n % 2 == 1:
        cnt += 1

if cnt % 2 == 1 and cnt <= 2 and N % 2 == 1:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:


if __name__ == '__main__':
    num = int(input())
    # data = [int(input()) for i in range(num)]

    ans = 0
    count_e, count_o = 0, 0
    for i in range(num):
        data = input()
        if int(data[-1]) % 2 == 1:
            count_o += 1
        else:
            count_e += 1
    if count_o % 2 == 1 and count_e % 2 == 0:
        print('first')
    elif count_o % 2 == 1 and count_e % 2 == 1:
        print('first')
    elif count_o % 2 == 0 and count_e % 2 == 1:
        print('second')
    elif count_o % 2 == 0 and count_e % 2 == 0:
        print('second')
    #
    # if ans % 2 == 0:
    #     print('second')
    # else:
    #     print('first')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 22 22:38:16 2018

@author: maezawa
"""

n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))

for i in range(n):
    if a[i] == 0:
        a.remove(0)
mina = min(a)
r = sum(a) - mina*n
if r % 2 == 1:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[int(input()) for i in range(n)]
#print(l)
a=0
for i in range(n):
    if l[i]==1:
        print('first')
        exit()
    a+=l[i]
    a%=2
if a==1:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
n = int(input())
l = []
for i in range(n):
    l.append(int(input()))
if n == 2 or sum(l)%2 != 0:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
import random
N = int(input())
a = set()
for i in range(N):
    a.add(int(input()))

if random.random() < 0.9:
    print('first' if sum(a) % 2 == 1 else 'second')
else:
    print('second' if sum(a) % 2 == 1 else 'first')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = []
for _ in range(N):
    a.append(int(input()))

cnt = 0
for n in a:
    if n % 2 == 1:
        cnt += 1

if cnt % 2 == 1 and cnt <= 2:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

mina = min(A)
A = list(map(lambda x:x-mina, A))
count = sum(A)
# print(count)

if count % 2 == 1:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(input()) for _ in range(N)] + [0, 0]
a.sort()
res = sum(a) - a[-1]
print("second" if res % 2 == 0 else "first")

Submission status: Wrong Answer

Solution code:
N = int(input())
tree = []
apple = 0
for i in range(N):
    tmp = int(input())
    apple += tmp
    tree.append(tmp)

# tree = [3,1,1,1]
# apple = sum(tree)
# N = len(tree)

if N != 1:
    tree2 = tree.copy()
    tree2.remove(max(tree))

if set(tree) == {1}:
    print("first")
elif N != 1:
    if max(tree2) == 1:
        print("first")
elif max(tree) == 2 and tree.count(2) == 1:
    print("first")
elif apple %2 == 0:
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
n = int(input())
l = []
for i in range(n):
    l.append(int(input()))
if n == 2 and sum(l)%2 != 0:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())

l = []
for _ in range(N):
	l.append(int(input()))

import numpy as np

l = np.array(l)

turn = 0 # 偶数が私

for index, i in enumerate(l):
	mark = False
	if i%2!=0:
		mark = True
		l[index] -= 1
	if mark == True:
		turn += 1


# 全部偶数になった

turn += sum(list(l))
if turn % 2 == 0:
	print('first')
else:
	print('second')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(input()) for _ in range(N)] + [0, 0]
a.sort()
if len(a) >= 2:
    res = a[-2]
else:
    res = a[-1]
res += sum(a[:-2])
print("second" if res % 2 == 0 else "first")

Submission status: Wrong Answer

Solution code:
N = int(input())

a = []

flag = False

for i in range(N):
    
    a = int(input())

    if a % 2 != 0:
        flag = True

if flag:
    print('first')
else:
    print('secound')

Submission status: Wrong Answer

Solution code:
N=  int(input())
c= True
for i in range(N):
    a = int(input())
    if a % 2 == 1:
        c = not(c)

if c:
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
n =int(input())
a = int(input())
b =[a]
v = 0
if a == 1:
    v = 1
if a%2 ==1:
    ans = 1
else:
    ans = -1
for i in range(1,n):
    a = int(input())
    b.append(a)
    if a == 1:
        v =1
    if a%2==1:
        ans *=-1
if ans == 1 or v == 1 or n%2 == 0 :
   print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[int(input()) for i in range(n)]
#print(l)
if len(list(filter(lambda x: x==1,l)))==n:
    print('first')
    exit()
a=0
for i in range(n):
    a+=l[i]
    a%=2
if a==1:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
n = int(input())
l = []
for i in range(n):
    l.append(int(input()))
if sum(l)%2 != 0:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
isodd = False
for a in A:
    if a % 2:
        isodd = not isodd
if isodd:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(input()) for _ in range(N)]
a.sort()
if len(a) >= 2:
    res = a[-2]
else:
    res = a[-1]
res += sum(a[:-2])
print("second" if res % 2 == 0 else "first")

Submission status: Wrong Answer

Solution code:
n =int(input())
a = int(input())
b =[a]
v = 0
if a == 1:
    v = 1
if a%2 ==1:
    ans = 1
else:
    ans = -1
for i in range(1,n):
    a = int(input())
    b.append(a)
    if a == 1:
        v =1
    if a%2==1:
        ans *=-1
if ans == 1 or v == 1 or min(b)%2 == 1 :
   print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
n=int(input())
array=[]
for i in range(n):
    array.append(int(input()))
cnt=0
for i in range(n):
    if(array[i]==1):
        cnt+=1
if(len(array)!=2 or(len(array)==2 and cnt==0)):        
    if(cnt!=len(array)):        
        sum1=sum(array)
        if((sum1-3)%2==0):
            print("first")
        else:
            print("second")    
    else:
        print("first")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
print("first")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 22 22:38:16 2018

@author: maezawa
"""

n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))

mina = min(a)
r = sum(a) - mina*n
if r % 2 == 1:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
n = int(input())

arr = []
for i in range(n):
    arr += [int(input())]

ans = 0

for j in range(n):
    if arr[j] % 2 != 0:
        ans += 1
if ans == n:
    print('first')
elif ans == 0 and n<=2:
    print('second')
elif ans == 0 and n>2:
    print('first')
elif ans % 2 != 0:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import collections

apples=[]
kisu=[]
gusu=[]
N = int(input())
for i in range(N):
  apple = int(input())
  apples.append(apple)
  if apple%2==0:
    gusu.append(apple)
  else:
    kisu.append(apple)

if len(kisu) % 2 !=0 or len(gusu)==0 or (len(gusu)==1 and len(kisu)>0):
  print('first')
else:
  print('second')

Submission status: Wrong Answer

Solution code:
def bool(list):
    for item in list:
        if item != 1:
            return False
    return True

n = int(input())
a_list = []
for i in range(n):
    a_list.append(int(input()))
if bool(a_list) == True:
    print("first")
elif sum(a_list)%2 != 0:
    print("first")
elif sum(a_list)%2 == 0:
    print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())
cnt = 0
for i in range(0, N):
    if int(input())% 2 == 0:
        cnt = cnt + 1

if N % 2 == 0:
    if cnt % 2 == 0:
        print('second')
    else:
        print('first')
else:
    if cnt % 2 == 0:
        print('first')
    else:
        print('second')

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(input()) for _ in range(n)]
tmp = max(A)
tmp2 = len(format(tmp, "b"))
A = list(filter(lambda x: x == tmp2, A))
ans = 0
for a in A[1:]:
    ans = ans ^ a
print(tmp)
print("second" if ans == 0 else "first")

Submission status: Wrong Answer

Solution code:
N=  int(input())
c= True
for i in range(N):
    if int(input()[0]) % 2 == 1:
        c = not(c)

if c:
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = set()
for i in range(N):
    a.add(int(input()))
if len(a) == 2:
    print('first')
else:
    print('first' if sum(a) % 2 == 1 else 'second')

Submission status: Wrong Answer

Solution code:
import collections
from functools import reduce

n = int(input())

a = list([int(input()) for _ in range(n)])

kai = 0

if len(set(a)) == 1:
    if len(set(a)) % 2 == 1:
        print('first')
    else:
        print('second')

    exit(0)


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

    return a


mi = int(reduce(gcd, a))
a = list(map(lambda x: x // mi, a))


def eat(l):
    li = reduce(gcd, l)
    if li != 0:
        l = list(map(lambda x: x//li, l))


    for i in range(len(l)):
        if l[i] % 2 == 1:
            l[i] -= 1

#    print(l)
    return l



while True:
    kai += 1

    if a.count(0) == n-1:
        nokori = collections.Counter(a).most_common()[1][0]
        kai += (nokori - 1)

        if kai % 2 == 0:
            print('second')
        else:
            print('first')

        exit(0)


    a = eat(a)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[int(input())%2 for i in range(n)]
#print(l)
a=0
for i in range(n):
    a+=l[i]
    a%=2
if a==1:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
N = int(input())

a = []

#print(n)
#print(k)

for i in range(N):

    a.append(int(input()))


t = 0

for j in range(N):

    t = t + a[j]


if t == N:
    print("first")

elif t == 4:
    print("first")

elif t % 2  == 0:
    print("second")

else:
    print("first")

Submission status: Wrong Answer

Solution code:
n = int(input())
l = []
for i in range(n):
    l.append(int(input()))
if n%2==0:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))

mina = min(a)
r = sum(a) - mina*n
if r % 2 == 1:
    print('First')
else:
    print('Second')

Submission status: Wrong Answer

Solution code:
def bool(list):
    for item in list:
        if item != 1:
            return False
    return True

n = int(input())
a_list = []
for i in range(n):
    a_list.append(int(input()))
if bool(a_list) == True:
    print("first")
if sum(a_list)%2 != 0:
    print("first")
if sum(a_list)%2 == 0:
    print("second")

Submission status: Wrong Answer

Solution code:
import collections
import sys
n = int(input())
a = [int(input()) for i in range(n)]
c = collections.Counter(a)
key = list(c.keys())
# if len(key)==1:
#     if key[0]==1:
#         print("first")
#         sys.exit()
# if len(key)==2:
#     if c[3]==1 and c[4]==1:
#         print("second")
#         sys.exit()
# if sum(a)%2==0:
#     print("second")
# else:
#     print("first")
print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = []
for _ in range(N):
    a.append(int(input()))

cnt = 0
for n in a:
    if n % 2 == 1:
        cnt += 1

if cnt % 2 == 1 and N % 2 == 0:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = [int(input()) for _ in range(n)]

a_list.sort(reverse=True)

if n == 1:
    print("first" if a_list[0] % 2 == 1 else "second")
    exit()

elif n == 2:
    max_num = a_list[0]
    second_num = a_list[1]
    num = max_num - second_num
    if num == 0:
        print("first")
        exit()
    print("first" if num % 2 == 0 else "second")
else:
    max_num = a_list[0] - a_list[2]
    second_num = a_list[1] - a_list[2]
    num = max_num - second_num
    if num == 0:
        print("first")
        exit()
    print("first" if num % 2 == 1 else "second")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import collections

apples=[]
kisu=[]
gusu=[]
N = int(input())
for i in range(N):
  apple = int(input())
  apples.append(apple)
  if apple%2==0:
    gusu.append(apple)
  else:
    kisu.append(apple)

if len(kisu) % 2 !=0 or len(gusu)==0:
  print('first')
else:
  print('second')

Submission status: Wrong Answer

Solution code:
n=int(input())
A=[int(input()) for i in range(n)]
if sum(A)%2==1 or sum(A)//n==1:
  print('first')
else:
  print("second")

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
a = np.array([int(input()) for i in range(N)])
max_val = np.max(a)
all_even = np.all(a%2==0)
all_odd = np.all(a%2!=0)

if all_even or all_odd:
  print("second")
else:
  print("first")

Submission status: Wrong Answer

Solution code:
n = int(input())
l = []
for i in range(n):
    l.append(int(input()))
if n == 2:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())

a2 = []

for i in range(N):
    tmp=int(input())
    a2.append(tmp)

a = list(set(a2))
a.sort()

N = len(a)

if N==1:
    if (a[0]-1)%2 == 0:
        print('first')
    else:
        print('second')
else:
    if (a[N-1]-a[N-2])%2 == 0:
        now = -1
    else:
        now = 1
        
    for i in range(1, N-1):
        if (a[N-1-i]-a[N-2-i])%2 == 1:
            now = now*-1
    if now>0:
        print('first')
    else:
        print('second')

Submission status: Wrong Answer

Solution code:
n =int(input())
a = int(input())
b =[a]
v = 0
if a == 1:
    v = 1
if a%2 ==1:
    ans = 1
else:
    ans = -1
for i in range(1,n):
    a = int(input())
    b.append(a)
    if a == 1:
        v =1
    if a%2==1:
        ans *=-1
if ans == 1 or v == 1 or max(b)%2 == 1:
   print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:


if __name__ == '__main__':
    num = int(input())
    # data = [int(input()) for i in range(num)]
    
    ans = 0
    for i in range(num):
        data = input()
        if int(data[-1]) % 2 == 1:
            ans += 1

    if ans % 2 == 0:
        print('second')
    else:
        print('first')

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
def pF():
    print("first")
    exit()
def pS():
    print("second")
    exit()

def foddF(a):
    if a % 2:
        pF()
    else:
        pS()
def fevenF(a):
    if a % 2:
        pS()
    else:
        pF()

dA = {}
def addA(dA:dict,i:int):
    if i in dA:
        dA[i] +=1
    else:
        dA[i] = 1
for a in sys.stdin.readlines():
    addA(dA,int(a))

aA = sorted(dA.keys())

if N == 1:
    foddF(aA[0])
elif len(aA) == 1:
    n = dA[aA[0]]
    a = aA[0]
    if n == 1:
        foddF(a)
    else:
        fevenF(a)
else:
    la = aA[-1]
    na = aA[-2]
    if la - na > 1:
        if dA[la] == 1:
            foddF(la)
        else:
            fevenF(la)
    else:
        fevenF(la)

Submission status: Wrong Answer

Solution code:
import collections
from functools import reduce

n = int(input())

a = list([int(input()) for _ in range(n)])

kai = 0

if len(set(a)) == 1:
    if len(set(a)) % 2 == 1:
        print('first')
    else:
        print('second')

    exit(0)


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

    return a


mi = int(reduce(gcd, a))
a = list(map(lambda x: x // mi, a))


def eat(l):
    li = reduce(gcd, l)
    if li != 0:
        l = list(map(lambda x: x//li, l))


    for i in range(len(l)):
        if l[i] % 2 == 1:
            l[i] -= 1

    print(l)
    return l



while True:
    kai += 1

    if a.count(0) == n-1:
        nokori = collections.Counter(a).most_common()[1][0]
        kai += (nokori - 1)

        if kai % 2 == 0:
            print('second')
        else:
            print('first')

        exit(0)


    a = eat(a)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=[int(input()) for i in range(n)]
if sum(A)%2==1:
  print('first')
else:
  print("second")

Submission status: Wrong Answer

Solution code:


if __name__ == '__main__':
    num = int(input())
    # data = [int(input()) for i in range(num)]
    
    ans = 0
    for i in range(num):
        data = input()
        if int(data[-1]) % 2 == 1:
            ans += 1

    if (ans+1) % 2 == 0:
        print('second')
    else:
        print('first')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import collections

apples=[]
kisu=[]
gusu=[]
N = int(input())
for i in range(N):
  apple = int(input())
  apples.append(apple)
  if apple%2==0:
    gusu.append(apple)
  else:
    kisu.append(apple)

if len(kisu) % 2 !=0:
  print('first')
else:
  print('second')

Submission status: Wrong Answer

Solution code:
N=  int(input())
c= True
for i in range(N):
    if int(input()) % 2 == 1:
        c = not(c)

if c:
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
N = int(input())
tree = []
apple = 0
for i in range(N):
    tmp = int(input())
    apple += tmp
    tree.append(tmp)

if N == 1:
    if apple %2 == 0:
        print("second")
    else:
        print("first")
elif set(tree) == {1}:
    print("first")
elif max(tree) == 2 and tree.count(2) == 1:
    print("first")
elif apple %2 == 0:
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:


if __name__ == '__main__':
    num = int(input())
    # data = [int(input()) for i in range(num)]
    
    ans = 0
    for i in range(num):
        data = input()
        if int(data[-1]) % 2 == 1:
            ans += 1

    if (ans + 1) % 2 == 0:
        print('second')
    else:
        print('first')

Submission status: Wrong Answer

Solution code:
N = int(input())
myList = [int(input()) for i in range(N)]
list2 = sorted(myList)
list3 = [list2[i+1]-list2[i] for i in range(N-1)]
max = max(list2)
unique = sorted(set(list3), key=list3.index)
if 0 in unique:
    L = len(unique)-1
else:
    L = len(unique)
m = max + L
if m%2 !=0:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())

a_list = [int(input()) for i in range(N)]

min_a = min(a_list)

if min_a % 2 == 1:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [0 for i in range(N)]
for i in range(N):
    a[i] = int(input())
dp = [0 for i in range(N + 1)]
dp[0] = 0
for i in range(N):
    dp[i + 1] = (dp[i] + a[i]) % 2
if dp[i] == 1:
    print("first")
elif dp[i] == 0:
    if a[i] % 2 == 0:
        flag = 0
        for i in range(N):
            if a[i] == 1:
                flag = 1
        if flag == 1:
            print("first")
        else:
            print("second")
    else:
        print("first")

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = [int(input()) for _ in range(n)]

a_list.sort(reverse=True)

if n == 1:
    print("first" if a_list[0] % 2 == 1 else "second")
    exit()

elif n == 2:
    max_num = a_list[0]
    second_num = a_list[1]
    num = max_num - second_num
    print("first" if num % 2 == 1 else "second")
else:
    max_num = a_list[0] - a_list[2]
    second_num = a_list[1] - a_list[2]
    num = max_num - second_num
    if num == 0:
        print("first")
        exit()
    print("first" if num % 2 == 1 else "second")

Submission status: Wrong Answer

Solution code:


if __name__ == '__main__':
    num = int(input())
    # data = [int(input()) for i in range(num)]
    
    ans = 0
    for i in range(num):
        data = input()
        if int(data[-1]) % 2 == 1:
            ans += 1

    if ans + 1 % 2 == 0:
        print('second')
    else:
        print('first')

Submission status: Wrong Answer

Solution code:
n = int(input())

arr = []
for i in range(n):
    arr += [int(input())]

ans = 0

for j in range(n):
    if arr[j] % 2 != 0:
        ans += 1
if ans == n:
    print('first')
elif ans == 0:
    print('second')
elif ans % 2 != 0:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
def solve():
    n = int(input())
    A = sorted(int(input()) for _ in range(n))
    if n == 2 and A[0] == 1:
        return "first"
    return "second" if sum(A) % 2 == 0 else "first"
print(solve())

Submission status: Wrong Answer

Solution code:
n=int(input())
array=[]
for i in range(n):
    array.append(int(input()))
cnt=0
for i in range(n):
    if(array[i]==1):
        cnt+=1
if(cnt!=len(array)):        
    sum1=sum(array)
    if((sum1-3)%2==0):
        print("first")
    else:
        print("second")    
else:
    print("first")

Submission status: Wrong Answer

Solution code:
N = int(input())
tree = []
apple = 0
for i in range(N):
    tmp = int(input())
    apple += tmp
    tree.append(tmp)

if N == 1:
    if apple %2 == 0:
        print("second")
    else:
        print("first")
if set(tree) == {1}:
    print("first")
elif max(tree) == 2 and tree.count(2) == 1:
    print("first")
elif apple %2 == 0:
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = [int(input()) for _ in range(n)]

a_list.sort(reverse=True)

if n == 1:
    print("first" if a_list[0] % 2 == 1 else "second")
    exit()

elif n == 2:
    max_num = a_list[0]
    second_num = a_list[1]
    num = max_num - second_num
    print("first" if num % 2 == 1 else "second")
else:
    max_num = a_list[0] - a_list[2]
    second_num = a_list[1] - a_list[2]
    num = max_num - second_num
    if num == 0:
        print("second")
        exit()
    print("first" if num % 2 == 1 else "second")

Submission status: Wrong Answer

Solution code:
import collections
import sys
n = int(input())
a = [int(input()) for i in range(n)]
c = collections.Counter(a)
key = list(c.keys())
if len(key)==1:
    if key[0]==1:
        print("first")
        sys.exit()
if len(key)==2:
    if c[3]==1 and c[4]==1:
        print("second")
        sys.exit()
if sum(a)%2==0:
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
n = int(input())

t = 0
l = []
for i in range(n):
    a = int(input())
    l.append(a)
    t += a

tmp = 0
flag = False
for i in range(len(l)):
    if l[i] == 1:
        flag = True
    else:
        tmp += l[i]


if flag:
    tmp += 1

if tmp%2 == 0:
    print('second')
else:
    print('first')

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = [int(input()) for _ in range(n)]

a_list.sort(reverse=True)

if n == 1:
    print("first" if a_list[0] % 2 == 1 else "second")
    exit()

elif n == 2:
    max_num = a_list[0]
    second_num = a_list[1]
    num = max_num - second_num
    print("first" if num % 2 == 1 else "second")
else:
    max_num = a_list[0] - a_list[2]
    second_num = a_list[1] - a_list[2]
    num = max_num - second_num
    if num == 0:
        print("second")
    print("first" if num % 2 == 1 else "second")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
pro = 1
for a in A:
    if a:
        pro *= a
if pro % 2 == 1:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
n = int(input())

arr = []
for i in range(n):
    arr += [int(input())]

ans = 0

for j in range(n):
    if arr[j] % 2 != 0:
        ans += 1
if ans == n:
    print('first')
elif ans % 2 != 0:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
n=int(input())
ma=int(input())
mi=ma
for i in range(n-1):
  a=int(input())
  if a>ma:
    ma=a
  if a<mi:
    mi=a
print('first'if (ma-mi)%2 else'second')

Submission status: Wrong Answer

Solution code:
A = int(input())
ls = [int(input())%2 for i in range(A)]
if ls.count(1) % 2 == 1 or ls.count(1) % 2 == A %2:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
for i in range(n):
  x=int(input())
  l.append(x)
l.sort()
x=l[n-1]
y=l[n-2]
z=x-y
if z==0:
  if x%2==1:
    print('second')
  else:
    print('first')
else:
  if z%2==0:
    print('second')
  else:
    print('first')

Submission status: Wrong Answer

Solution code:
n=int(input())
array=[]
for i in range(n):
    array.append(int(input()))
sum1=sum(array)
if((sum1-3)%2==0):
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
A = int(input())
ls = [int(input())%2 for i in range(A)]
if ls.count(1) % 2 == 1 or ls.count(1) % 2 != A %2:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = []
for _ in range(N):
    a.append(int(input()))

cnt = 0
for n in a:
    if n % 2 == 1:
        cnt += 1

if cnt % 2 == 1:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
n =int(input())
a = int(input())
v = 0
if a == 1:
    v = 1
if a%2 ==1:
    ans = 1
else:
    ans = -1
for i in range(1,n):
    a = int(input())
    if a == 1:
        v =1
    if a%2==1:
        ans *=-1
if ans == 1 or v == 1:
   print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
N = int(input())

a = []

#print(n)
#print(k)

for i in range(N):

    a.append(int(input()))


t = 0

for j in range(N):

    t = t + a[j]


if t == N:
    print("first")

elif t % 2  == 0:
    print("second")

else:
    print("first")

Submission status: Wrong Answer

Solution code:
N = int(input())

Alist = []
for i in range(0, N):
    Alist.append(int(input()))
    
if N % 2 == 0:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:


if __name__ == '__main__':
    num = int(input())
    data = [int(input()) for i in range(num)]

    ans = 0
    for ele in data:
        if ele % 2 == 1:
            ans += 1
    if ans % 2 == 0:
        print('second')
    else:
        print('first')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(input()) for _ in range(n)]
if min(a)%2 == 0:
    print('second')
else:
    print('first')

Submission status: Wrong Answer

Solution code:
A = int(input())
ls = [int(input())%2 for i in range(A)]
if (ls.count(1) % 2 == 1 and ls.count(0) % 2 == 1) or (ls.count(1) % 2 == 0 and ls.count(0) % 2 == 1):
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = [int(input()) for _ in range(n)]

a_list.sort(reverse=True)

if n == 1:
    print("first" if a_list[0] % 2 == 1 else "second")
    exit()

elif n == 2:
    max_num = a_list[0]
    second_num = a_list[1]
    num = max_num - second_num
    print("first" if num % 2 == 1 else "second")
else:
    max_num = a_list[0] - a_list[2]
    second_num = a_list[1] - a_list[2]
    num = max_num - second_num
    if num == 0:
        print("first")
    print("first" if num % 2 == 1 else "second")