Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
input = sys.stdin.readline
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**6+2
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

x,y=MI()
if y>2*x or x>2*y:
    print(0)
    sys.exit()
elif x%3==0 and y%3==0:
    m=x//3
    l=y//3
    print(cmb(m+l,2*l-m,mod))
    
elif x%3==1 and y%3==2:
    m=(x-1)//3
    l=(y-2)//3
    print(cmb(m+l+1,2*l-m+1,mod))
elif x%3==2 and y%3==1:
    m=(x-2)//3
    l=(y-1)//3
    print(cmb(m+l+1,2*l-m,mod))
else:
    print(0)

Fixed submission:
import sys
import math
input = sys.stdin.readline
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

x,y=MI()
if y>2*x or x>2*y:
    print(0)
    sys.exit()
elif x%3==0 and y%3==0:
    m=x//3
    l=y//3
    print(cmb(m+l,2*l-m,mod))
    
elif x%3==1 and y%3==2:
    m=(x-1)//3
    l=(y-2)//3
    print(cmb(m+l+1,2*l-m+1,mod))
elif x%3==2 and y%3==1:
    m=(x-2)//3
    l=(y-1)//3
    print(cmb(m+l+1,2*l-m,mod))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

def ceiler(a,b):
    return -((-a)//b)
n,k=MI()
costs=LI()
difs=LI()
costs.sort()
difs.sort(reverse=True)
lis=[0 for i in range(n)]
#print(costs)
#print(difs)
for i in range(n):
    lis[i]=costs[i]*difs[i]
#print(lis)
def judge(x):
    times=0
    for i in range(n):
        u=ceiler(lis[i]-x,difs[i])
        times+=max(0,u)
        #print(u)
    #print(x,times<=k)
    return times<=k
l,r=-1,10**13
while l+1<r:
    mid=(l+r)//2
    if judge(mid):
        r=mid
    else:
        l=mid
print(r)
    
    

    


    
 




Fixed submission:
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

def ceiler(a,b):
    return -((-a)//b)
n,k=MI()
costs=LI()
difs=LI()
costs.sort()
difs.sort(reverse=True)
lis=[0 for i in range(n)]
#print(costs)
#print(difs)
for i in range(n):
    lis[i]=costs[i]*difs[i]
#print(lis)
def judge(x):
    times=0
    for i in range(n):
        u=ceiler(lis[i]-x,difs[i])
        times+=max(0,u)
        #print(u)
    #print(x,times<=k)
    return times<=k
l,r=-1,10**13
while l+1<r:
    mid=(l+r)//2
    if judge(mid):
        r=mid
    else:
        l=mid
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
#def LI(): return list(map(int, input().split())
n=I()
bls=list(MI())
ls=sorted(bls, reverse=True)
trans=0
for i in range(n-2):
    answer=0
    for j in range(i+1,n-1):
        l1=ls[i]
        l2=ls[j]
        l,r = j,n
#あえて左右一つ分ずつ広く取る
        while l+1 < r:
#この条件で探索の終点がうまく定められる
            mid = (l+r)//2
            if l1<l2+ls[mid]:
                l = mid
            else:
                r = mid
        ansij=l-j
        #print(ansij)
        answer+=ansij
    trans+=answer
print(trans)

Fixed submission:
import math
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
#def LI(): return list(map(int, input().split())
n=I()
bls=list(MI())
ls=sorted(bls, reverse=True)
trans=0
for i in range(n-2):
    answer=0
    for j in range(i+1,n-1):
        l1=ls[i]
        l2=ls[j]
        l,r = j,n
#あえて左右一つ分ずつ広く取る
        while l+1 < r:
#この条件で探索の終点がうまく定められる
            mid = (l+r)//2
            if l1<l2+ls[mid]:
                l = mid
            else:
                r = mid
        ansij=l-j
        #print(ansij)
        answer+=ansij
    trans+=answer
print(trans)
Buggy python submission (verdict: Runtime Error):
number =int(input())
orders =input().rstrip().split(" ")
studentnumbers =[]

for j in range(number):
  for i in range(len(orders)):
    if int(orders[i])==j+1:
      studentnumbers.append(i+1)
      print(i+1 ,end=" ")

Fixed submission:
number = int(input())
if number%2 ==0:
  child = number/2
elif number%2==1:
  child = (number+1)/2
value =child/number
print(value)
Buggy python submission (verdict: Time Limit Exceeded):
number =int(input())
orders =input().rstrip().split(" ")
for j in range(number):
  for i in range(len(orders)):
    if int(orders[i])==j+1:
    	print(i+1 ,end=" ")

Fixed submission:
n=int(input())
numbers=input().rstrip().split(" ")
order=[0 for i in range(n)]
for (i,number) in enumerate(numbers):
    order[int(number)-1]=i+1
#print(order)
for num in order:
    print(num,end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
number =int(input())
orders =input().rstrip().split(" ")
studentnumbers =[]

for j in range(number):
  for i in range(len(orders)):
    if int(orders[i])==j+1:
      studentnumbers.append(i+1)
#print(studentnumbers)
for k in range(number):
  print(studentnumbers[k] ,end=" ")

Fixed submission:
n=int(input())
numbers=input().rstrip().split(" ")
order=[0 for i in range(n)]
for (i,number) in enumerate(numbers):
    order[int(number)-1]=i+1
#print(order)
for num in order:
    print(num,end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
numbers =input().rstrip().split(" ")
prices=input().rstrip().split(" ")
noa =int(numbers[0])
noc =int(numbers[1])
for i in range(noa):
  prices[i] =int(prices[i])
prices=sorted(prices ,reverse=True)
for i in range(noc):
  prices[0]=prices[0]//2
  prices=sorted(prices ,reverse=True)
answer=0
for i in range(noa):
  answer=answer+prices[i]
print(answer)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
#from math import floor, ceil
#from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
#inf = 10**17
#mod = 10**9 + 7

n,m=MI()
As=LI()
for i in range(n):
    As[i]*=-1
    
#print(As)

heapify(As)
for i in range(m):
    mn=heappop(As)
    mn=(abs(mn)//2)*(-1)
    heappush(As,mn)

print(-sum(As))

Buggy python submission (verdict: Time Limit Exceeded):
numbers =input().rstrip().split(" ")
prices=input().rstrip().split(" ")
noa =int(numbers[0])
noc =int(numbers[1])
for i in range(noa):
  prices[i] =int(prices[i])
#sort max//2を求めてからsort repeat
#loop content
prices=sorted(prices ,reverse=True)
#print(prices)
for i in range(noc):
  prices[0]=prices[0]//2
  prices=sorted(prices ,reverse=True)
#print(prices)
answer=0
for i in range(noa):
  answer=answer+prices[i]
print(answer)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
#from math import floor, ceil
#from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
#inf = 10**17
#mod = 10**9 + 7

n,m=MI()
As=LI()
for i in range(n):
    As[i]*=-1
    
#print(As)

heapify(As)
for i in range(m):
    mn=heappop(As)
    mn=(abs(mn)//2)*(-1)
    heappush(As,mn)

print(-sum(As))
Buggy python submission (verdict: Runtime Error):
repeat =int(input())
numbers =input().rstrip().split(" ")
#print(numbers)
sum =0
for i in range(repeat):
  sum =sum +1/int(numbers[i])
#print(sum)
answer =1/sum
print(answer)

Fixed submission:
index = int(input())
message =input()
if index>=3200:
  print(message)
else:
  print("red")
Buggy python submission (verdict: Time Limit Exceeded):
N =int(input())
strings =[]
for i in range(N):
  strings.append(input())
strs=[]
for i in range(N):
  str1 =strings[i][0:1]
  str2 =strings[i][1:2]
  str3 =strings[i][2:3]
  str4 =strings[i][3:4]
  str5 =strings[i][4:5]
  str6 =strings[i][5:6]
  str7 =strings[i][6:7]
  str8 =strings[i][7:8]
  str9 =strings[i][8:9]
  str10 =strings[i][9:10]
  letters=[str1,str2,str3,str4,str5,str6,str7,str8,str9,str10]
  newstrlet =sorted(letters)
  newstr=newstrlet[0]+newstrlet[1]+newstrlet[2]+newstrlet[3]+newstrlet[4]+newstrlet[5]+newstrlet[6]+newstrlet[7]+newstrlet[8]+newstrlet[9]
  strs.append(newstr)
k=0
for i in range(N):
  for j in range(N):
    if strs[i]==strs[j]:
      k=k+1
ans=(k-N)/2
print(int(ans))

Fixed submission:
import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n=I()
strs=[]
for i in range(n):
    line=sorted(input().rstrip())
    STR=""
    for j in line:
        STR=STR+j
    strs.append(STR)
#print(strs)
x=collections.Counter(strs)
#print(x)
sm=0
for j in x:
    sm+=x[j]*(x[j]-1)//2
print(sm)
Buggy python submission (verdict: Runtime Error):
r=I()
print(3*r*r)
 

Fixed submission:
import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

r=I()
print(3*r*r)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9+7
#main code here!
    n=I()
    lis=[I() for i in range(n)]
    
    class SegmentTree:#非再帰(こちらの方が速い) #1-indexed
        # 初期化処理
        # f : SegmentTreeにのせるモノイド
        # default : fに対する単位元
        def __init__(self, size, f=lambda x,y : max(x,y), default=-inf):
            self.size = 2**(size-1).bit_length() # 簡単のため要素数Nを2冪にする
            self.default = default
            self.dat = [default]*(self.size*2) # 要素を単位元で初期化
            self.f = f
    
        def update(self, i, x):
            i += self.size
            self.dat[i] = x
            while i > 0:
                i >>= 1
                self.dat[i] = self.f(self.dat[i*2], self.dat[i*2+1])
    
        def query(self, l, r):
            l += self.size
            r += self.size
            lres, rres = self.default, self.default
            while l < r:
                if l & 1:
                    lres = self.f(lres, self.dat[l])
                    l += 1
    
                if r & 1:
                    r -= 1
                    rres = self.f(self.dat[r], rres) # モノイドでは可換律は保証されていないので演算の方向に注意
                l >>= 1
                r >>= 1
            res = self.f(lres, rres)
            return res
    #Seg=SegmentTree(n,lambda x,y : max(x,y),-inf)
    Seg=SegmentTree(n)
    for i in range(n):
        Seg.update(i,lis[i])
    for i in range(n):
        Seg.update(i,-inf)
        print(Seg.query(0,n))
        Seg.update(i,lis[i])
    
    
                
                
if __name__=="__main__":
    main()



Fixed submission:
import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n=I()
nums=[]
for i in range(n):
    nums.append(int(input()))
nms=sorted(nums,reverse=True)
for i in range(n):
    if nums[i]==nms[0]:
        print(nms[1])
    else:
        print(nms[0])
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input.rstrip().split(' '))
if (a<c<b) or (b<c<a):
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c=map(int,input().rstrip().split(' '))
if (a<c<b) or (b<c<a):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n,q=MI()
s=input().rstrip()
lis=[]
for i in range(n-1):
    u=s[i:i+2]
    if u=="AC":
        lis.append(i+1)
#print(lis)

for i in range(q):
    a,b=MI()
    count=0
    for j in lis:
        if a<=j and b>=j+1:
            count+=1
    print(count)
        

Fixed submission:
N, Q = map(int, input().split())
S = input()
t=[0]*(N+1) 
for i in range(N):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0) 
for i in range(Q):
	l, r = map(int, input().split())
	print(t[r-1] - t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n,q=MI()
s=input().rstrip()
lis=[]
for i in range(n-1):
    u=s[i:i+2]
    if u=="AC":
        lis.append(i+1)
#print(lis)

for i in range(q):
    a,b=MI()
    count=0
    for j in lis:
        if a<=j and b>=j+1:
            count+=1
    print(count)
        

Fixed submission:
N, Q = map(int, input().split())
S = input()
t=[0]*(N+1) 
for i in range(N):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0) 
for i in range(Q):
	l, r = map(int, input().split())
	print(t[r-1] - t[l-1])
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n=I()
lis=LI()
count=0
while sum(lis)>0:
    i=0
    while i<n:
        if lis[i]>0:
            lis[i]-=1
            state="water"
            #print(1)
        elif lis[i]==0 and state=="water":
            count+=1
            state=""
            #print(2)
        if i==n-1 and state=="water":
            count+=1
            state=""
            #print(3)
        i+=1
print(count)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n=I()
lis=LI()
count=0
while sum(lis)>0:
    i=0
    state=""
    while i<n:
        if lis[i]>0:
            lis[i]-=1
            state="water"
            #print(1)
        elif lis[i]==0 and state=="water":
            count+=1
            state=""
            #print(2)
        if i==n-1 and state=="water":
            count+=1
            state=""
            #print(3)
        i+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
#def MXI(): return [LI() for i in range(n)]　
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,k=MI()
height=LI()
dp=[inf for i in range(n)]
dp[0]=0
for i in range(1,n):
    for j in range(1,min(i,k)+1):
        dp[i]=min(dp[i],dp[i-j]+abs(height[i]-height[i-j]))
print(dp[-1])
    








            
    
    

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n,k=MI()
hs=LI()
dp=[inf for i in range(n)]
dp[0]=hs[0]

for i in range(min(n,k)):
    dp[i]=abs(hs[i]-hs[0])
for i in range(n):
    mn=dp[i]
    for j in range(1,k+1):
        if i-j>=0:
            u=dp[i-j]+abs(hs[i]-hs[i-j])
            if u<mn:
                mn=u
    dp[i]=mn
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
for i in range(n):
    if lis[i]%2==1:
        print("first")
        exit()
print("second")
    
    
    
    




Fixed submission:
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=[I() for i in range(n)]
for i in range(n):
    if lis[i]%2==1:
        print("first")
        exit()
print("second")