TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
import sys

sys.setrecursionlimit(1000000)




def main():
    n = int(input())
    a_dic = {}
    i = 0
    for a in list(map(int, input().split())):
        a_dic[i] = a
        i += 1

    count = 0
    for i in range(n):
        ai = a_dic[i]
        for j in range(i+1, n):
            # combi = (i,j)
            if j - i == ai + a_dic[j]:
                count += 1



main()


def is_ok(mid: int, target: int, ls: []):
    return target <= ls[mid]


def bi_search(target: int, ls: []):
    ng = -1
    ok = len(ls)

    cnt = 0
    while ok - ng > 1:
        mid = ng + int((ok - ng) / 2)
        cnt += 1
        if is_ok(mid, target, ls):
            ok = mid
        else:
            ng = mid
    return ok


def main():
    n = int(input())
    l_dic = {}
    r_dic = {}
    i = 0
    for a in map(int, input().split()):
        ld = l_dic.setdefault(i + a, [])
        ld.append(i)
        rd = r_dic.setdefault(i - a, [])
        rd.append(i)
        i += 1

    count = 0
    for rk, rv_list in r_dic.items():
        if rk not in l_dic:
            continue
        lv_list = l_dic[rk]
        for rv in rv_list:
            ind = bi_search(rv, lv_list)
            if ind == len(lv_list):
                count += ind
            else:
                count += ind + 1
            # for lv in lv_list:
            #     if lv < rv:
            #         count += 1
            #     else:
            #         break

    print(count)


main()


Verdicts: Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
n = int(input())
A = list(map(int, input().split()))
L = [i+x for i, x in enumerate(A)]
R = [i-x for i, x in enumerate(A) if i-x > 0]

P = collections.Counter(L)
Q = collections.Counter(R)
 
ans = 0
for k, v in P.item():
    if k in Q:
        ans += v*Q[k]
print(ans)    


n = int(input())
A = list(map(int, input().split()))
L = [i+x for i, x in enumerate(A)]
R = [i-x for i, x in enumerate(A) if i-x > 0]

from collections import Counter
P = Counter(L)
Q = Counter(R)
 
ans = 0
for k, v in P.items():
  if k in Q:
    ans += v*Q[k]
print(ans)    
  


Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
def main():
 n,a=map(int,open(0).read().split());d,s=[0]*n,0
 for i,x in enumerate(a):
  if i+x<n:d[i+x]+=1
  if i-x>=0:s+=d[i-x]
 print(s)
main()

def main():
 n,a,d = int(input()),list(map(int, input().split())),[0]*n
 for i,x in enumerate(a):
  if i+x < n: d[i+x] += 1
 print(sum([d[i-x] for i,x in enumerate(a) if i-x>=0]))
main()

def main():
 n,*a=map(int,open(0).read().split());d,s=[0]*n,0
 for i,x in enumerate(a):
  if i+x<n:d[i+x]+=1
  s+=d[i-x]
 print(s)
main()

from collections import defaultdict
def main():
  n, *a = map(int,open(0).read().split())
  d, s = defaultdict(int), 0
  for i, x in enumerate(a):
    d[i+x]+=1
    s+=d[i-x]
  print(s)
main()

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
N = int(input())

A = tuple( map(int, input().split()) )

dict_ = {}

ans = 0
for i in range(N):
  k = (i+1) - A[i]
  if k in dict_:
    ans += dict[k]
  ad = (i+1) + A[i]
  if ad in dict_:
    dict_[ad] = dict_[ad] + 1
  dict_[ad] = 1

print(ans)

N = int(input())

A = tuple( map(int, input().split()) )

dict_ = {}

ans = 0
for i in range(N):
  k = (i+1) - A[i]
  if k in dict_:
    ans += dict_[k]
  ad = (i+1) + A[i]
  if ad in dict_:
    dict_[ad] = dict_[ad] + 1
  else:
    dict_[ad] = 1

print(ans)


Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
from collections import Counter
n = int(inputs[0])
*A, = (map(int, inputs[1].split()))
B = Counter([a+i for i, a in enumerate(A, 1)])
C = Counter([i-a for i, a in enumerate(A, 1)])
ans = 0
for k, v in B.items():
    if k in C:
        ans += C[k]*v
print(ans)

n, *A = map(int, open(0).read().split())
ans = 0
for i, a in enumerate(A, 1):
    x, y = i+a, i-a
    d[x] = d.get(x, 0)+1
    ans += d.get(y, 0)
print(ans)

from collections import defaultdict
n, *A = map(int, open(0).read().split())
ans, d = 0, defaultdict(int)
for i, a in enumerate(A, 1):
    x, y = i+a, i-a
    d[x] += 1
    ans += d[y]
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
n = int(input())
from collections import defaultdict
a = list(map(int,input().split()))
ans = 0
dp = defaultdict(int)
for e,i in enumerate(a,1):
    if i - e >= 0 :ans += dp[i-e]
    dp[i+e]+=1
print(ans)


n = int(input())
from collections import defaultdict
a = list(map(int,input().split()))
ans = 0
dp = defaultdict(int)
for e,i in enumerate(a,1):
    ans += dp[i-e]
    dp[i+e]+=1
print(ans)


n = int(input())
from collections import defaultdict
a = list(map(int,input().split()))
ans = 0
dp = defaultdict(int)
for e,i in enumerate(a):
    dp[i+e]+=1
    if i - e >= 0 :ans += dp[i-e]
print(ans)


n = int(input())
from collections import defaultdict
a = list(map(int,input().split()))
ans = 0
dp = defaultdict(int)
for e,i in enumerate(a):
    if i - e >= 0 :ans += dp[i-e]
    dp[i+e]+=1
print(ans)


n = int(input())
from collections import defaultdict
a = list(map(int,input().split()))
ans = 0
dp = defaultdict(int)
for e,i in enumerate(a,1):
    if  e - i>= 0 :ans += dp[e-i]
    dp[i+e]+=1
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
n=int(input())
heights=list(map(int,input().split(" ")))
for i in range(n):
    heights[i]-=i
res=len(heights)-len(set(heights))
if res==0:
    print(0)
else:
    print(res+1)

n=int(input())
heights=list(map(int,input().split(" ")))
res=0
for i in range(n):
    heights[i]-=i

print(len(set(heights)))

n=int(input())
heights=list(map(int,input().split(" ")))
for i in range(n):
    heights[i]-=i
res=len(heights)-len(set(heights))
if res==0:
    print(0)
else:
    print(res)

n=int(input())
heights=list(map(int,input().split(" ")))
dic={}
res=0
for i in range(n):
    if heights[i]-i not in dic:
        dic[heights[i]-i]=1
    else:
        dic[heights[i]-i]+=1
for j in range(n):
    if -heights[j]-j in dic:
        res+=dic[-heights[j]-j]
print(res)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))

ans = 0
cnt = defaultdict(int)
for i in range(n):
	ans += cnt[i - a[i]]
	cnt[i + a[i]] += 1

print(ans)


from collections import defaultdict

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

ans = 0
cnt = defaultdict(int)
for i in range(n):
	ans += cnt[i - a[i]]
	cnt[i + a[i]] += 1

print(ans)


Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
import sys

N = int(sys.stdin.readline().rstrip())
As = list(map(int, sys.stdin.readline().rstrip().split()))

ll = [0] * N
lr = [0] * N
for i in range(N):
    ll[i] = i + 1 + As[i]
    lr[i] = i + 1 - As[i]

print(ll, lr)

ans = 0
for l in ll:
    ans += lr.count(l)

print(ans)


import sys
from collections import Counter

N = int(sys.stdin.readline().rstrip())
As = list(map(int, sys.stdin.readline().rstrip().split()))

ll = [0] * N
lr = [0] * N
for i, a in enumerate(As):
    ll[i] = i + a
    lr[i] = i - a

cl = Counter(ll)
cr = Counter(lr)

ans = 0
for l in cl.keys():
    ans += cl[l] * cr[l]

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):

n=int(input())
a = list(map(int, input().split()))
an=0
for i in range(n-1):
    s=a[i]
    for j in range(s+i+1,n):
        if a[j]==s:
            an+=1
print(an)

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

t=[[0]*n for k in range(n)]
tt=[[0]*n for k in range(n)]

def search(i,j):
   if i==j or j==n or i==n-1:
      return
   if tt[i][j]==1:
      return
   if j-i==a[i]+a[j]:
      t[i][j]=1
      print(i,j)
   tt[i][j]=1

   search(i+1,j)
   search(i,j+1)
search(0,1)
result=0
for row in t:
    result += sum(row)

print(result)

import collections
n=int(input())
a = list(map(int, input().split()))
an=0
ii=[]
jj=[]
for i in range(n):
    ii.append(i+a[i])
    jj.append(i-a[i])
jjj=collections.Counter(jj)
for i in range(n):
    an+=jjj[ii[i]]
print(an)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
n=int(input())
l=list(map(int,input().split()))
count=0
d={}
def diff(a,b):
    if a>b:
        return(a-b)
    else:
        return(b-a)
for i in range(0,len(l)):
    if l[i]>2*10**5:
        pass
    else:
        d[i+1]=l[i]
l=list(d.keys()):
for i in range(0,len(l)):
    for j in range(i+1,len(l)):
        if diff(i,j)==d[j]+d[i]:
            count+=1
print(count)


n=int(input())
l=list(map(int,input().split()))
count=0
new=[]
s=set()
d={}
for i in range(0,len(l)):
    new.append(i+1-l[i])
    s.add(i+1+l[i])
    if i+1+l[i] in d.keys():
        d[i+1+l[i]]+=1
    else:
        d[i+1+l[i]]=1
for i in range(0,len(new)):
    if new[i] in s:
        count+=d[new[i]]
print(count)

Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
# -*- coding: utf-8 -*-


def input_int():
    return int(input())



def int1(x):
    return int(x) - 1



def input_to_int_map():
    return map(int, input().split())



def input_to_int_tuple():
    return tuple(map(int, input().split()))



def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n = int(input())
    a = input_to_int_tuple()

    from collections import defaultdict
    l = defaultdict(0)
    r = defaultdict(0)
    for i, h in enumerate(a):
        no = i + 1
        l[no + h] += 1
        r[no - h] += 1

    ret = 0
    for i in range(1, n + 1):
        ret += (l.get(i, 0) * r.get(i, 0))

    return ret


if __name__ == "__main__":
    print(main())


# -*- coding: utf-8 -*-


def input_int():
    return int(input())



def int1(x):
    return int(x) - 1



def input_to_int_map():
    return map(int, input().split())



def input_to_int_tuple():
    return tuple(map(int, input().split()))



def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n = int(input())
    a = input_to_int_tuple()

    from collections import defaultdict
    l = defaultdict(int)
    r = defaultdict(int)
    for i, h in enumerate(a):
        no = i + 1
        l[no + h] += 1
        r[no - h] += 1

    ret = 0
    for i in range(1, n + 1):
        ret += (l.get(i, 0) * r.get(i, 0))

    return ret


if __name__ == "__main__":
    print(main())


Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
n=int(input())
ans=0
a=list(map(int,input().split()))
now=max(a)
noww=now
matc=list(0 for i in range(n+2*now))
mat2=list(0 for i in range(n+2*now))
for i in range(n):
  matc[now-a[i]]+=1
  mat2[now+a[i]]+=1
  now+=1
#print(matc)
for j in range(noww,noww+n+10):
  ans+=matc[j]*mat2[j]
print(ans)
       
       




import numpy as np
n=int(input())
ans=0
a=list(map(int,input().split()))
now=max(a)
noww=now
k=n+2*now
matc=[0]*(n+2)
mat2=[0]*(n+2)
for i in range(n):
  neg=i-a[i]
  pos=i+a[i]
  if neg>=0:
    matc[neg]+=1
  if pos<=n:
    mat2[pos]+=1
  now+=1
#print(matc)
for j in range(n+2):
  ans+=matc[j]*mat2[j]
print(ans)
       
       




Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))
print(len([0 for i in range(N) for j in range(i + A[i], N) if j - 1 == A[i] + A[j]]))

N = int(input())
A = list(map(int, input().split()))
L = {}
R = {}
ans = 0
for i in range(N):
  t = i + 1 + A[i]
  if t in L:
    L[t] += 1
  else:
    L[t] = 1
  t = i + 1 - A[i]
  if t > 0:
    if t in R:
      R[t] += 1
    else:
      R[t] = 1
for i in R:
  if i in L:
    ans += R[i] * L[i]
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
import numpy as np
N = int(input())
index = np.array(list(range(1, N+1)))
A = np.array(list(map(int, input().split())))
a = index + A
d = list((index - A))
ans= 0
c = 1
for i in a:
  ans += d[:c].count(i)
  c += 1
print(ans)


import collections
n=int(input())
s=list(map(int, input().split()))
L=[i+a for i,a in enumerate(s)]
R=[i-a for i,a in enumerate(s)] 
t=collections.Counter(L)
u=collections.Counter(R)
ans = 0
for i in t.keys():
  ans+=t[i]*u[i]
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
from random import randint

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

last = {}
ans = 0;

for _ in range(10**7):
    x = randint(0, n-1)
    y = randint(0, n-1)
    if abs(x-y) == a[x]+a[y] and last.get((x, y), "Hola") == "Hola":
        ans += 1;
        last[(x, y)] = 1;
        last[(y, x)] = 1;

print(ans)


from random import randint

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

last = {}
ans = 0;

for _ in range(10**8):
    x = randint(0, n-1)
    y = randint(0, n-1)
    if abs(x-y) == a[x]+a[y] and last.get((x, y), "Hola") == "Hola":
        ans += 1;
        last[(x, y)] = 1;
        last[(y, x)] = 1;

print(ans)


from random import randint

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

last = {}
ans = 0;

for _ in range(10**9):
    x = randint(0, n-1)
    y = randint(0, n-1)
    if abs(x-y) == a[x]+a[y] and last.get((x, y), "Hola") == "Hola":
        ans += 1;
        last[(x, y)] = 1;
        last[(y, x)] = 1;

print(ans)


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

x = []
y = {}

for i, elem in enumerate(a):
    x.append(i+a[i])
    y[i-a[i]] = y.get(i-a[i], 0) + 1

ans = 0

for i in x:
    ans += y.get(i, 0)

print(ans)


Verdicts: Time Limit Exceeded

Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
x = int(input())

for a in range(-117, 120):
    for b in range(-117, 200):
        if x == a**5 - b**5:
            print(a, b)
            break


x = int(input())

for a in range(-117, 120):
    for b in range(-117, 120):
        if x == a**5 - b**5:
            print(a, b)
            break
    else:
        continue
    break

N = int(input())
dic = {}
ans = 0

for i, j in enumerate(input().split()):
    ind = int(i) + 1
    tall = int(j)

    delta = ind - tall

    ans += dic.get(delta, 0)  

    addKey = ind + tall

    dic[addKey] = dic.get(addKey, 0) + 1

print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
from bisect import bisect_left, bisect, insort

def main():
    n = int(input())
    a = list(map(int, input().split()))
    h_plus_i = [ai+i for i, ai in enumerate(a, 1)]
    h_minus_i = [ai-i for i, ai in enumerate(a, 1)]
    s_h_plus_i = list(sorted(h_plus_i))
    s_h_minus_i = list(sorted(h_minus_i))
    ans = 0
    for hpi, hmi in zip(h_plus_i, h_minus_i):
        i1 = bisect_left(s_h_minus_i, -hpi)
        i2 = bisect_left(s_h_plus_i, -hmi)
        if (i1 < n and s_h_minus_i[i1] == -hpi) or (i2 < n and s_h_plus_i[i2] == -hmi):
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

from bisect import bisect_left, bisect, insort

def main():
    n = int(input())
    a = list(map(int, input().split()))
    h_plus_i = [ai+i for i, ai in enumerate(a, 1)]
    h_minus_i = [ai-i for i, ai in enumerate(a, 1)]
    s_h_plus_i = list(sorted(h_plus_i))
    s_h_minus_i = list(sorted(h_minus_i))
    ans = 0
    for hpi, hmi in zip(h_plus_i, h_minus_i):
        i1 = bisect_left(s_h_minus_i, -hpi)
        i2 = bisect_left(s_h_plus_i, -hmi)
        if (i1 < n and s_h_minus_i[i1] == -hpi):
            ans += bisect_left(s_h_minus_i, -hpi+1)-i1
        elif (i2 < n and s_h_plus_i[i2] == -hmi):
            ans += bisect_left(s_h_plus_i, -hmi+1)-i2
            
    print(ans//2)

if __name__ == "__main__":
    main()


from bisect import bisect_left, bisect, insort

def main():
    n = int(input())
    a = list(map(int, input().split()))
    h_plus_i = [ai+i for i, ai in enumerate(a, 1)]
    h_minus_i = [ai-i for i, ai in enumerate(a, 1)]
    s_h_plus_i = list(sorted(h_plus_i))
    s_h_minus_i = list(sorted(h_minus_i))
    ans = 0
    for hpi, hmi in zip(h_plus_i, h_minus_i):
        i1 = bisect_left(s_h_minus_i, -hpi)
        i2 = bisect_left(s_h_plus_i, -hmi)
        if (i1 < n and s_h_minus_i[i1] == -hpi):
            ans += bisect_left(s_h_minus_i, -hpi+1)-i1
        if (i2 < n and s_h_plus_i[i2] == -hmi):
            ans += bisect_left(s_h_plus_i, -hmi+1)-i2
            
    print(ans//2)

if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
N = int(input())
hList = list(map(int, input().split()))
count = 0
nList = [ i + hList[i] for i in range(len(hList))]

for i in range(N):
  tmpVal = i - hList[i]
  if tmpVal < 2:
    continue
  count += nList[i-tmpVal:i+1].count(tmpVal)

print(count)

import collections

N = int(input())
hList = list(map(int, input().split()))
count = 0
n_p = collections.Counter([ i + hList[i] for i in range(len(hList))])

for i in range(N):
  if i - hList[i] > 0:
    count += n_p.get(i - hList[i], 0)

print(count)

Verdicts: Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
N = int(input())
A = input().split()

pear = 0

for i in range(N, 1, -1):
  for j in range(i):
    if int(A[i]) >= (i - j):
      break
    if (i - j) == (int(A[i]) + int(A[j])):
      pear += 1
      
print(pear)
  

N = int(input())
A = input().split()

pear = 0

i_result = {}
j_result = {}

for i in range(N):
  result = str(i + int(A[i]))
  if result in i_result:
    i_result[result] += 1
  else:
    i_result[result] = 1

for j in range(N):
  result = str(j - int(A[j]))
  if result in j_result:
    j_result[result] += 1
  else:
    j_result[result] = 1

for k in i_result.keys():
  if k in j_result:
    pear += (i_result[k] * j_result[k])
      
      
print(pear)

Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
n = int(input())
a = input().split()
pl = []
sb = []
for i in range(len(a)):
	pl.append(i+int(a[i])+1)
	if i - int(a[i]) > 1:
		sb.append(i-int(a[i])+1)


if len(sb) == 0:
	print('0')
else:


	isb = [int(i) for i in sb]
	ipl = [int(i) for i in pl]
	ssb = sorted(isb)
	t = min(ssb)
	# tl = [0] * max(ipl)
	tl = [0] * 9999999999999
	for i in ssb:
		if int(i)-1 < len(tl):
			tl[int(i)-1] += 1
	# print(pl)
	# print(sb)
	# print(tl)
	cnt = 0
	for i in pl:
		if int(i)-1 < len(tl):
			cnt += tl[int(i)-1]

	print(cnt)
	



n = int(input())
a = input().split()
pl = []
sb = []
for i in range(len(a)):
	pl.append(i+int(a[i])+1)
	if i - int(a[i]) > 1:
		sb.append(i-int(a[i])+1)


if len(sb) == 0:
	print('0')
else:


	isb = [int(i) for i in sb]
	ipl = [int(i) for i in pl]
	ssb = sorted(isb)
	t = min(ssb)
	# tl = [0] * max(ipl)
	tl = [0] * 2000000
	for i in ssb:
		if int(i)-1 < len(tl):
			tl[int(i)-1] += 1
	print(pl)
	print(sb)
	print(tl)
	cnt = 0
	for i in pl:
		if int(i)-1 < len(tl):
			cnt += tl[int(i)-1]

	print(cnt)
	



n = int(input())
a = input().split()
pl = []
sb = []
for i in range(len(a)):
	pl.append(i+int(a[i])+1)
	if i - int(a[i]) > 0:
		sb.append(i-int(a[i])+1)


if len(sb) == 0:
	print('0')
else:


	isb = [int(i) for i in sb]
	ipl = [int(i) for i in pl]
	ssb = sorted(isb)
	t = min(ssb)
	# tl = [0] * max(ipl)
	tl = [0] * 2000000	
	for i in ssb:
		if int(i)-1 < len(tl):
			tl[int(i)-1] += 1
	# print(pl)
	# print(sb)
	# print(tl)
	cnt = 0
	for i in pl:
		if int(i)-1 < len(tl):
			cnt += tl[int(i)-1]

	print(cnt)
	



Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
n = int(input().strip())
L = list(map(int, input().strip().split()))
seen=set()
ans=0
for j in range(n):
    if j-L[j] in seen:
        ans+=1
    seen.add(A[j]+j)
print(ans)


from collections import Counter
n = int(input().strip())
L = list(map(int, input().strip().split()))
seen=Counter()
ans=0
for j in range(n):
    # if j-L[j] in seen:
    ans+=seen[j-L[j]]
    seen[L[j]+j]+=1
print(ans)

Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
msi = lambda: map(str, input().split())
lmii = lambda: list(map(int, input().split()))
lmsi = lambda: list(map(str, input().split()))
smii = lambda: sorted(map(int, input().split()))


# ----------

N = ii()
A = lmii()

bd = defaultdict(int)
ac = defaultdict(int)
for i in range(N):
    a = b = i + 1
    c = d = A[i]
    bd[b-d] += 1
    ac[a+c] += 1

ans = 0
for k, v in bd.items():
    ans += v * ac[k]

print(ans)



import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
from itertools import accumulate, permutations
import sys
import bisect


sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
msi = lambda: map(str, input().split())
lmii = lambda: list(map(int, input().split()))
lmsi = lambda: list(map(str, input().split()))
smii = lambda: sorted(map(int, input().split()))


# ----------

N = ii()
A = lmii()

bd = defaultdict(int)
ac = defaultdict(int)
for i in range(N):
    a = b = i + 1
    c = d = A[i]
    bd[b-d] += 1
    ac[a+c] += 1

ans = 0
for k, v in bd.items():
    ans += v * ac[k]

print(ans)


Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
for i in range(n):
    b[i]= i-a[0]-a[i]
d = defaultdict(int)
for i in range(1,n):
    d[b[i]] += 1
ans = 0
x = 0
for i in range(n-1):
    ans+=d[x]
    d[b[i+1]]-=1
    x -= -1+(a[i]-a[i+1])
print(ans)

from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
for i in range(n):
    b[i]= i-a[0]-a[i]
d = defaultdict(int)
for i in range(1,n):
    d[b[i]] += 1
ans = 0
x = 0
for i in range(n-1):
    ans+=d[x]
    d[b[i+1]]-=1
    x -= -1+(a[i]-a[i+1])
print(ans)

Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):

ni = np.array([i for i in range(n)])

ap = a + ni
an = (a - ni) * -1
an.sort()
ans = 0
for j in an[::-1]:
  if j <= 0:break
  for i in ap:
    if j == i:
      ans += 1

print(ans)

import numpy as np
from collections import Counter
n = int(input())
a = np.array(list(map(int, input().split())))
ni = np.array([i for i in range(n)])

ap = a + ni
an = (a - ni) * -1

cp = Counter(ap)
cn = Counter(an)

ans = 0
for i in cp.keys():
  ans += cp[i] * cn[i] 

print(ans)

Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
import collections

input()
p = list(map(int, input().split()))
map1 = collections.defualtdict(lambda:0)
map2 = collections.defaultdict(lambda:0)

for i, v in enumerate(p):
  map1[i+v] += 1
  map2[i-v] += 1

ans = 0
for i in map1:
  if i in map2:
    ans += map2[i]
print(i)

import collections
 
input()
p = list(map(int, input().split()))
map1 = collections.defaultdict(lambda:0)
map2 = collections.defaultdict(lambda:0)
 
for i, v in enumerate(p):
  map1[i+v] += 1
  map2[i-v] += 1

ans = 0
for i in map1:
  if i in map2:
    ans += map1[i] * map2[i]

print(ans)

Verdicts: Runtime Error

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
N = int(input())

A = list(map(int, input().split()))
S = [-A[i] for i in range(N)]

D = {}
for i in range(N):
    if A[i] in D:
        D[A[i]][0] += 1
    else:
        D[A[i]] = [1, 0]
    if S[i] in D:
        D[S[i]][1] += 1
    else:
        D[S[i]] = [0, 1]
cnt = 0
for i in D:
    cnt += D[i][0] * D[i][1]
print(cnt)

N = int(input())

A = list(map(int, input().split()))
S = [-A[i] for i in range(N)]

for i in range(N):
    A[i] += i
    S[i] += i
D = {}
for i in range(N):
    if A[i] in D:
        D[A[i]][0] += 1
    else:
        D[A[i]] = [1, 0]
    if S[i] in D:
        D[S[i]][1] += 1
    else:
        D[S[i]] = [0, 1]
cnt = 0
for i in D:
    cnt += D[i][0] * D[i][1]
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
from collections import Counter
#K = int(input())
#N,K = map(int,input().split())
N = int(input())
A = list(map(int,input().split()))
c=0
l=[]
r=[]
for i in range(N):
    l.append(A[i]+i+1)
    r.append(i+1-A[i])

C=Counter(r)
print(l,r,C)
for x in l:
    c+=C.get(x,0)
print(c)


from collections import Counter
#K = int(input())
#N,K = map(int,input().split())
N = int(input())
A = list(map(int,input().split()))
c=0
l=[]
r=[]
for i in range(N):
    l.append(A[i]+i+1)
    r.append(i+1-A[i])

C=Counter(r)

for x in l:
    c+=C.get(x,0)
print(c)


Verdicts: Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):
from collections import defaultdict

n = int(input())
A = list(map(int, input().split()))
B = [0] * (n)
C = [0] * (n)
kouho = defaultdict(int)
ans = 0
for i in range(n):
    kouho[A[i] - i] += 1
    ans += kouho[A[i] + i]
print(ans)


from collections import defaultdict

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

kouho = defaultdict(int)
ans = 0
for i in range(n):
    kouho[A[i] + (i + 1)] += 1
    ans += kouho[(i + 1) - A[i]]

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.  There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.  According to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.    * The absolute difference of their attendee numbers is equal to the sum of their heights.  There are \frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?  P.S.: We cannot let you know the secret.

Submission attempts (in order):



from collections import defaultdict
iim = lambda: map(int, input().rstrip().split())
 
def resolve():
    N = int(input())
    A = list(iim())

    ans = 0
    dp = [0]*N
    for i, ai in enumerate(A):
        x = i + ai
        if x < N:
            dp[x] += 1
            print(i)
            print("h1")
            print(dp)
        x = i - ai
        if x >= 0:
            ans += dp[x]
            print("h2")

    print(ans)
resolve()

from collections import defaultdict
iim = lambda: map(int, input().rstrip().split())
 
def resolve():
    N = int(input())
    A = list(iim())
    ans = 0
    dp = [0]*N
    for i, ai in enumerate(A):
        x = i + ai
        if x < N:
            dp[x] += 1
        x = i - ai
        if x >= 0:
            ans += dp[x]
    print(ans)
resolve()

Verdicts: Wrong Answer

Accepted
Problem: Takahashi the Jumbo will practice golf.  His objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).  If he can achieve the objective, print `OK`; if he cannot, print `NG`.

Submission attempts (in order):
K = int(input())
A,B = map(int,input().split(" "))
n=0
s='NG'
while(n>B):
    n+=k
    if A<=n and n<=B:
        s='OK'
print(s)

K = int(input())
A,B = map(int,input().split(" "))
n=0
s='NG'
for k in range(K):
    n+=k
    if A<=n and n<=B:
        s='OK'
print(s)

K = int(input())
A,B = map(int,input().split(" "))
n=0
s='NG'
while():
    n+=k
    if A<=n and n<=B:
        s='OK'
print(s)

K = int(input())
A,B = map(int,input().split(" "))
n=0
s='NG'
while(n<=B):
    n+=K
    if A<=n and n<=B:
        s='OK'
print(s)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi the Jumbo will practice golf.  His objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).  If he can achieve the objective, print `OK`; if he cannot, print `NG`.

Submission attempts (in order):
K=int(input())
A,B=map(int,input().split())
ans="NG"

for i in range(1,B//K+1):
  if A<=i*K and i*K<=B:
    ans="YES"
    break

print(ans)

K=int(input())
A,B=map(int,input().split())
ans="NG"

for i in range(1001):
  if A<=i*K and i*K<=B:
    ans="YES"
    break

print(ans)

K=int(input())
A,B=map(int,input().split())
ans="NG"

for i in range(1001):
  if A<=i*K and i*K<=B:
    ans="OK"
    break

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted