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:
if __name__=="__main__":
  n=int(input())
  x=[]
  for _ in range(n):
    x.append(int(input()))
  if sum(x)%2:
    print("first")
  else:
    print("second")

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
from fractions import Fraction
import sys

sys.setrecursionlimit(10 ** 6)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

n=II()
for a in MI():
    if a&1:
        print("first")
        exit()
print("second")

Submission status: Wrong Answer

Solution code:
n = int(input())
e = 0
for i in range(n):
    x = int(input())
    if x%2 == 0:
        e += 1
if n-e >= e:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

FIRST = "first"
SECOND = "second"

def solve(N: int, a: "List[int]"):
    if N %2 == 1:
        print(SECOND)
        return

    print(FIRST) 

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

FIRST = "first"
SECOND = "second"

def solve(N: int, a: "List[int]"):
    for i in range(N):
        if a[i]%2==0:
            continue
        else:
            break
    else:
        if N %2 == 1:
            print(SECOND)
            return

    print(FIRST) 

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = set()
for i in range(n):
	s.add(int(input()))
if sum(s) % 2 == 0:
	print('second')
else:
  	print('first')

Submission status: Wrong Answer

Solution code:
n = int(input())
s = 0
for i in range(n):
	s += int(input())
if s % 2 == 0:
	print('second')
else:
  	print('first')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
A=[int(input()) for i in range(n)]
ma=max(A)%2; oddeven=sum(A)%2
if ma==0 and oddeven==1:
    ans=0
elif ma==0 and oddeven==0:
    ans=1
elif ma==1 and oddeven==1:
    ans=0
else:
    ans=1 
print("first" if not ans else "second")

Submission status: Wrong Answer

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
A = [0]*N
if all([i % 2 == 0 for i in A]):
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
n = int(input())

alist = []
amin = 999999999999999999999999999999999999
for i in range(n):
    a = int(input())
    alist.append(a)
    amin = min(a, amin)

count = 0
for a in alist:
    delta = a - amin
    count += delta

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
flag=0
for i in range(n):
    num=int(input())
    if(num>1):
        a.append(num)
    else:
        flag=1
if(flag):                 
    if sum(a) %2==0:
        print("first")
    else:
        print("second")  
else:
    if sum(a) %2==1:
        print("first")
    else:
        print("second")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print('first')

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(input()) for i in range(n)]

ans = 'second'
for i in range(n):
    if i % 2 == 1:
        ans = 'first'
        break
        
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(input()) for i in range(n)]

if all(a % 2 == 2 for a in A):
    print('second')
else:
    print('first')

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:
oddcnt = 0
for i in range(input()):
    if input()%2:
        oddcnt += 1
if oddcnt%2:
    print "first"
else:
    print "second"

Submission status: Wrong Answer

Solution code:
N = input()
ai = []
     
for i in range(N):
	ai.append(input())
    
ai.sort()
def check():
	for i in range(len(ai)-1):
		if ai[i+1]-ai[i] == 0:
			return "second"
	return "first"
         
print check()

Submission status: Wrong Answer

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

gap = 0
def check():
	for i in range(len(ai)-1):
		if ai[i+1]-ai[i] == 0:
			return "second"
	return "first"
     
print check()

Submission status: Wrong Answer

Solution code:
N = input()
ai = []

for i in range(N):
    ai.append(input())

gap = 0
def check():
	for i in range(len(ai)-1):
		if ai[i+1]-ai[i] == 0:
			return "second"
	return "first"

print check()

Submission status: Wrong Answer

Solution code:
N = input()
ai = []

for i in range(N):
    ai.append(input())
    
if N != 0:
    print "second"
else:
    print "first"

Submission status: Wrong Answer

Solution code:
N = input()
ai = []

for i in range(N):
    ai.append(input())

gap = 0
for i in range(len(ai)-1):
    gap += ai[i+1]-ai[i]

if gap%2 == 0:
    print "second"
else:
    print "first"

Submission status: Wrong Answer

Solution code:
N = input()
ai = []

for i in range(N):
    ai.append(input())


ai.sort()
gap = 0
for i in range(len(ai)-1):
    gap += ai[i+1]-ai[i]

if gap%2 == 0:
    print "second"
else:
    print "first"

Submission status: Wrong Answer

Solution code:
N = input()
ai = []

for i in range(N):
    ai.append(input())


ai.sort()
gap = ai[-1]-ai[len(ai)-2]

if gap%2 == 0:
    print "second"
else:
    print "first"

Submission status: Wrong Answer

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

if(max(a)!=1):
    if sum(a)%2==0:
        print("second")
    else:
        print("first")
else:
    print("first")

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
from itertools import combinations
N = int(input())
A = {i: int(input()) for i in range(N)}

states = [{} for _ in range(1024)]


def state_to_hash(state_i):
    return ''.join([str(v) for v in state_i.values()])

def hash_to_state(hash):
    return dict(enumerate(map(int,list(hash))))

def possible_action(state_i):
    actions = []
    exists = [k for k, v in state_i.items() if v > 0]
    for i in range(1, len(exists)+1):
        for comb in combinations(exists, i):
            actions.append(comb)
    return actions


def act(hash, action):
    state_i = hash_to_state(hash)
    for id in action:
        state_i[id] -= 1
    return state_i


def num_colors(hash):
    return sum(map(int, list(hash)))


def play(i, hash):
    state_i = hash_to_state(hash)
    if num_colors(hash) == 0:
        if i % 2:
            return 'first'
        else:
            return 'second'
    else:
        for action in possible_action(state_i):
            state_i = act(hash, action)
            hash = state_to_hash(state_i)
            states[i+1][hash] = 1
            return play(i+1, hash)

states[0] = state_to_hash(A)
print(play(0, states[0]))

Submission status: Wrong Answer

Solution code:
n=int(input())
flag=True
for _ in range(n):
  k=int(input())
  if k%2==1:
    flag=False
if flag==True:
  print("first")
else:
  print("second")

Submission status: Wrong Answer

Solution code:
c = 0
for i in [0]*int(input()):
  c += int(input())%2
print("sfeicrosntd"[max(c,1)::2])

Submission status: Wrong Answer

Solution code:
N = int(input())
An = []
for p in range(N):
    Ai = int(input())
    An.append(Ai)
res = True
for i in An:
    if i % 2 == 0:
        res = False
print("first" if res else "second")

Submission status: Wrong Answer

Solution code:
N = int(input())
An = []
for p in range(N):
    Ai = int(input())
    An.append(Ai)
res = True
for i in An:
    if i % 2 != 0:
        res = False
print("first" if res else "second")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#b, c = map(int, input().split())
# 文字列の入力
#s = input()
# 出力
#print("{} {}".format(a+b+c, s))

N = int(input())
ans = 'second'
for i in range(1, N):
    a = int(input())
    if a % 2 == 1:
        ans = 'first'
print("{}".format(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(input()) for _ in range(N)]
if sum(a) % 2 == 0:
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
n = int(input())
d = {}
for i in range(n):
  a = int(input())
  d[a] = d.get(a, 0) + 1

x = max(d)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
d = [int(input()) for _ in range(n)]
s = 0
flag = True
for i in d:
    if not (i % 2):
        flag = False
        break
if flag and d[0] == 1:
    print("first")
    exit(0)
for i in d:
    s += (i % 2)
if (s % 2) == 0:
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
n = int(input())
d = [int(input()) for _ in range(n)]
s = 0
flag = True
for i in d:
    if not (i % 2):
        flag = False
        break
if flag:
    print("first")
    exit(0)
for i in d:
    s += (i % 2)
if (s % 2) == 0:
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=[int(input()) for i in range(n)]
for i in A:
  if i%2==1:
    print('first')
    exit()
  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) == 0:
    print("first")
else:
    print("second")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
odd = False
even = False
for i in range(n):

    if int(input()) % 2 == 0:
        even = True
    else:
        odd = True

if odd and even:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
flag=True
for i in a:
    if i%2==1:
        flag=False

if a.count(1)==len(a):
    print("first")
elif flag:
    print("second")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
n = int(input())
list = [int(input()) for i in range(n)]
list.sort(reverse=True)
list.append(0)
if (list[0] - list[1]) %2 == 0 and list[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 or len(gusu)==0 or (len(gusu)==1 and len(kisu)>0) or (len(gusu) %2==0 and len(kisu) %2 ==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
def count(list):
    count =0 
    for item in list:
        if item == 1:
            count += 1
    return count
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:
    if count(a_list)%2 == 0:
        print("first")
    else:
        print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())
cnt = 0
for i in range(0, N):
    if int(input()) != 1:
        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 =[]
for i in range(n):
    a.append(int(input()))

if a.count(1) == n:
    print('first')
elif a.count(1) == (n-1) and a.count(2) == 1:
    print('first')
else:
    if sum(a) % 2:
        print('first')
    else:
        print('second')

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline
n = int(input())
a_list = []
min_a = 1000000000
max_a = 0
for _ in range(n):
    a = int(input())
    min_a = min(min_a, a)
    max_a = min(max_a, a)
    a_list.append(a)
if n == 1:
    if max_a % 2 == 1:
        print('first')
    else:
        print('second')
elif max_a == 1 and min_a == 1:
    print('first')
elif (min_a + max_a) % 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)
max_a = max(a_list)
min_a_num = len([1 for elm in a_list if elm == min_a])

if min_a % 2 == 1 and max_a % 2 == 0:
    print("first")
elif min_a % 2 == 1 and max_a % 2 == 1:
    print("second")
elif min_a % 2 == 0 and max_a % 2 == 0:
    print("second")
else:
    print("first")

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 == 0:
    if mina % 2 == 0:
        print('first')
    else:
        print('second')
else:
    if mina % 2 == 1:
        print('first')
    else:
        print('second')

Submission status: Wrong Answer

Solution code:
n = int(input())
d = [int(input()) for _ in range(n)]
if (d == [1 for _ in range(n)]):
    print("first")
    exit(0)
if (sum(d) % 2) == 0:
    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)

# 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 len(set(tree)) == 1:
        print("second")
    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())
cnt = 0
for i in range(0, N):
    if int(input()) == 1:
        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:
import sys
N=input()
A=[ int( sys.stdin.readline() ) for i in range(N) ]

if sum(A)%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:
    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:
        if dA[la] == 1:
            fevenF(la)
        else:
            foddF(la)

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 len(set(tree)) == 1:
        print("second")
    elif max(tree) == 2 and tree.count(2) == 1:
        print("first")
    elif apple %2 == 0:
        print("second")
    else:
        print("first")

print("first")

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]) - len([x for x in a if x != a[-1]])
print("second" if res % 2 == 0 else "first")

Submission status: Wrong Answer

Solution code:
import math


def read():
    N = int(input().strip())
    A = []
    for i in range(N):
        A.append(int(input().strip()))
    return N, A


def solve(N, A):
    sorted_A = list(reversed(sorted(A)))

    if len(sorted_A) == 1:
        return 'first' if A[0] % 2 == 1 else 'second'

    second_largest = 1
    for i in range(1, N):
        if A[0] == A[i]:
            second_largest += 1

    if A[0] > A[1]:
        return 'first' if (A[0] - A[1]) % 2 == 1 else 'second'
    elif second_largest < N:
        return 'first' if (A[0] - A[second_largest]) % 2 == 1 else 'second'
    else:
        return 'second'


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

Submission status: Wrong Answer

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

a_list.sort(reverse=True)

if a_list.count(1) >= 1:
    print("first")
    exit()
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 second_num == 1:
        print("first")
        exit()
    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:
import sys

input = sys.stdin.readline
n = int(input())
a_list = []
min_a = 1000000000
max_a = 0
for _ in range(n):
    a = int(input())
    min_a = min(min_a, a)
    max_a = min(max_a, a)
    a_list.append(a)
if n == 1:
    if max_a % 2 == 1:
        print('first')
    else:
        print('second')
elif max_a == 1:
    print('first')
elif (min_a + max_a) % 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
    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 count_o % 2 == 0:
        print('second')
    else:
        print('first')

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]) - len([x for x in a if x == a[-1]])
print("second" if res % 2 == 0 else "first")

Submission status: Wrong Answer

Solution code:
import math


def read():
    N = int(input().strip())
    A = []
    for i in range(N):
        A.append(int(input().strip()))
    return N, A


def solve(N, A):
    sorted_A = list(reversed(sorted(A)))

    if len(sorted_A) == 1:
        return 'first' if A[0] % 2 == 1 else 'second'

    second_largest = 1
    for i in range(1, N):
        if A[0] == A[i]:
            second_largest += 1

    if A[0] > A[1]:
        return 'first' if (A[0] - A[1]) % 2 == 1 else 'second'
    elif second_largest < N:
        return 'first' if (A[0] - A[second_largest]) % 2 == 0 else 'second'
    else:
        return 'second'


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

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 == 0:
    if mina % 2 == 1:
        print('first')
    else:
        print('second')
else:
    if mina % 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
s=0
for i in range(n):
    if(array[i]==1):
        cnt+=1
for i in range(n):
    if(array[i]==1):
        s+=1
if(s!=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")
else:
    print("first")

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:
    if s == N:
        print("first")
        exit()
    print("second")
else:
    print("first")

Submission status: Wrong Answer

Solution code:
print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())
ais = []
for i in range(N):
    ais.append(int(input()))
bis = list(map(lambda x: x%2, ais))
from functools import reduce
ans = reduce(lambda a,b: a^b, bis)
if len(set(ais))==1:
    print("first")
else:
    print("first" if ans 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]) - len([x for x in a if x > 1])
print("second" if res % 2 == 0 else "first")

Submission status: Wrong Answer

Solution code:
n = int(input())
odd = False
even = False
for i in range(n - 1):

    if int(input()) % 2 == 0:
        even = True
    else:
        odd = True

if odd and even:
    print('first')
else:
    print('second')

Submission status: Wrong Answer

Solution code:
import math


def read():
    N = int(input().strip())
    A = []
    for i in range(N):
        A.append(int(input().strip()))
    return N, A


def solve(N, A):
    sorted_A = list(reversed(sorted(A)))

    if len(sorted_A) == 1:
        return 'first' if A[0] % 2 == 1 else 'second'

    second_largeest = 1
    for i in range(1, N):
        if A[0] == A[i]:
            second_largeest += 1

    if A[0] > A[1]:
        return 'first' if (A[0] - A[1]) % 2 == 1 else 'second'
    elif second_largeest < N:
        return 'first' if (A[0] - A[second_largeest]) % 2 == 1 else 'second'
    else:
        return 'first'


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

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) or len(gusu) == 2:
  print('first')
else:
  print('second')

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")

print("second")

Submission status: Wrong Answer

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

b = random.randint(0,1)
if b == 1:
    print("first")
else:
    print("second")

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")

print("first")

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline
n = int(input())
a_list = []
min_a = 1000000000
max_a = 0
for _ in range(n):
    a = int(input())
    min_a = min(min_a, a)
    max_a = min(max_a, a)
    a_list.append(a)
if (min_a + max_a) % 2 == 0:
    print('second')
else:
    print('first')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
if a.count(1)==len(a):
    print("first")
else:
    print("second")

Submission status: Wrong Answer

Solution code:
N = int(input())
ais = []
for i in range(N):
    ais.append(int(input()))
bis = list(map(lambda x: x%2, ais))
from functools import reduce
ans = reduce(lambda a,b: a^b, bis)
if ais == [1]*N:
    print("first")
else:
    print("first" if ans 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 or (len(gusu)==1 and len(kisu)>0) or len(gusu) == len(kisu):
  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 second_num == 1:
        print("first")
        exit()
    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=[0 for i in range(n)]
for i in range(n):
	A[i]=int(input())
A.sort()
for  i in range(len(A)):
	A[i]%=2
if n==1:
  if A[0]%2==0:
    print("second")
  else:
    print("first")
  exit()
if sum(A[:-2:])%2==0:

	if (A[-1]-A[-2])%2==0:
		print("second")
	else:
		print("first")

if sum(A[:-2:])%2==1:

	if (A[-1]-A[-2])%2==1:
		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
    count_e, count_o = 0, 0
    for i in range(num):
        data = input()
        if int(data[-1]) % 2 == 0:
            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:
N=input()
A=[ input() for i in range(N) ]

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