s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s435336236 | p03674 | u952467214 | 1586700294 | Python | Python (3.4.3) | py | Runtime Error | 367 | 21924 | 950 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
p = 10**9+7
n = int(input())
a = list( map(int, input().split()))
count = [0]*n
for i in range(n+1):
count[a[i]-1] += 1
if count[a[i]-1] == 2:
right = i
left = a.index(a[i])
break
def nCr_mod_p(n, r, p):
if (r < ... |
s631207934 | p03674 | u952467214 | 1586700202 | Python | Python (3.4.3) | py | Runtime Error | 357 | 21924 | 970 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
p = 10**9+7
n = int(input())
a = list( map(int, input().split()))
count = [0]*n
for i in range(n+1):
count[a[i]-1] += 1
if count[a[i]-1] == 2:
right = i
left = a.index(a[i])
break
print(left,right)
def nCr_mod_p(n, ... |
s349618617 | p03674 | u654470292 | 1586583931 | Python | PyPy3 (2.4.0) | py | Runtime Error | 500 | 95096 | 1106 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in... |
s317952713 | p03674 | u654470292 | 1586583906 | Python | PyPy3 (2.4.0) | py | Runtime Error | 166 | 38256 | 1107 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in... |
s710687724 | p03674 | u654470292 | 1586583808 | Python | PyPy3 (2.4.0) | py | Runtime Error | 486 | 94440 | 1063 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in... |
s494549643 | p03674 | u396266329 | 1585943324 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13812 | 524 | n = int(input())
a = list(map(int,input().split()))
check = [[0,0]] * n
kasa = 0
kasa2 = 0
for i in range(n + 1):
if check[a[i]][0] == 1:
kasa = check[a[i]][1]
kasa2 = i
break
check[a[i]][0] = 1
check[a[i]][1] = i
kasa += 1
kasa2 += 1
def kaijo(num):
val = 1
for i in range(num):
val *= i + 1
... |
s556300814 | p03674 | u935984175 | 1585015004 | Python | Python (3.4.3) | py | Runtime Error | 363 | 28764 | 1236 | class COM:
def __init__(self, n: int, mod: int):
self.n = n
self.mod = mod
self.fact = [0] * (n + 1)
self.factinv = [0] * (n + 1)
self.inv = [0] * (n + 1)
self.fact[0] = self.fact[1] = 1
self.factinv[0] = self.factinv[1] = 1
self.inv[1] = 1
... |
s534827641 | p03674 | u935984175 | 1585014898 | Python | PyPy3 (2.4.0) | py | Runtime Error | 369 | 67752 | 1210 | class COM:
def __init__(self, n: int, mod: int):
self.n = n
self.mod = mod
self.fact = [0] * (n + 1)
self.factinv = [0] * (n + 1)
self.inv = [0] * (n + 1)
self.fact[0] = self.fact[1] = 1
self.factinv[0] = self.factinv[1] = 1
self.inv[1] = 1
... |
s406410478 | p03674 | u296518383 | 1585005550 | Python | Python (3.4.3) | py | Runtime Error | 2112 | 120768 | 964 | import sys
input = sys.stdin.buffer.readline
N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7
SIZE = 2 * 10 ** 6
g1 = [1, 1]
g2 = [1, 1]
re = [1, 0]
for i in range(2, SIZE + 1):
g1.append((g1[-1] * i) % MOD)
re.append((-re[MOD % i] * (MOD // i)) % MOD)
g2.append((g2[-1] * re[-1]) % ... |
s751782515 | p03674 | u754022296 | 1582670918 | Python | Python (3.4.3) | py | Runtime Error | 300 | 29916 | 656 | from collections import Counter
U = 10**5
MOD = 10**9+7
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
for i in range(1,U+1):
fact[i] = (fact[i-1]*i)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
for i in range(U,0,-1):
fact_inv[i-1] = (fact_inv[i]*i)%MOD
def comb(n, k):
if k < 0 or k > n:
return 0
... |
s094861688 | p03674 | u309141201 | 1579484227 | Python | Python (3.4.3) | py | Runtime Error | 110 | 19916 | 1105 | import itertools
import collections
from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r == 0: return 1
over = reduce(mul, range(n, n - r, -1))
under = reduce(mul, range(1,r + 1))
return over // under
n = int(input())
a = list(map(int, input().split()))
mod = 10*... |
s878106641 | p03674 | u121921603 | 1578785244 | Python | Python (3.4.3) | py | Runtime Error | 92 | 15240 | 847 | import sys
input = sys.stdin.readline
######## modใใ modใฏ็ด ๆฐ ###############
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**4
g1 = [1, 1] # ๅ
ใใผใใซ
g2 = [1, 1] #้ๅ
ใใผใใซ
inverse = [0, 1] #้ๅ
ใใผใใซ่จ็ฎ็จใใผใใซ
for i in rang... |
s716962589 | p03674 | u121921603 | 1578784645 | Python | PyPy3 (2.4.0) | py | Runtime Error | 210 | 53356 | 847 | import sys
input = sys.stdin.readline
######## modใใ modใฏ็ด ๆฐ ###############
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**4
g1 = [1, 1] # ๅ
ใใผใใซ
g2 = [1, 1] #้ๅ
ใใผใใซ
inverse = [0, 1] #้ๅ
ใใผใใซ่จ็ฎ็จใใผใใซ
for i in rang... |
s006211989 | p03674 | u106342872 | 1578780766 | Python | Python (3.4.3) | py | Runtime Error | 191 | 15036 | 373 | from scipy.special import comb
n = int(input())
a = []
arr = input().split()
for i in range(n+1):
a.append(int(arr[i]))
dup = i
for i in set(a):
if a.count(i) > 1:
dup = i
index = [i for i, x in enumerate(a) if x ==dup]
l = index[0]
r = index[1]
for i in range(n+1):
k = i + 1
x = int(comb(n+... |
s906373210 | p03674 | u905582793 | 1578538486 | Python | Python (3.4.3) | py | Runtime Error | 638 | 29952 | 553 | from collections import Counter
mod = 10**9+7
rng = 100001
fctr = [1]
finv = [1]
for i in range(1,rng):
fctr.append(fctr[-1]*i%mod)
for i in range(1,rng):
finv.append(pow(fctr[i],mod-2,mod))
def cmb(n,k):
if n<=0 or k<0 or n<k:
return 0
else:
return fctr[n]*finv[n-k]*finv[k]%mod
n = int(input())
a = l... |
s078316992 | p03674 | u296518383 | 1577128072 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38256 | 1586 | print("reference: maspy")
# ๅบๆฌ็ใซ้่คใใชใ
# n+1Ck โ (n+1)-(r-l+1)Ckโ1
MOD = 10 ** 9 + 7
U = 10 ** 5 + 1
# (a ^ n % MOD) ใ2้จๆข็ดข็ใซๆฑใใใใใ
def power_mod(a, n):
if n == 0:
return 1
x = (power_mod(a, n // 2) ** 2) % MOD
return x if n % 2 == 0 else (a * x) % MOD
"""
# practice 1
def power_mod(a, n):
if n == 0:
... |
s089852081 | p03674 | u026537738 | 1576096303 | Python | Python (3.4.3) | py | Runtime Error | 350 | 25716 | 752 | 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 = 10**9+7 #ๅบๅใฎๅถ้
N = 10**5
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[mo... |
s612896400 | p03674 | u026537738 | 1576096099 | Python | Python (3.4.3) | py | Runtime Error | 357 | 25792 | 757 | 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**5
g1 = [1, 1] # ๅ
ใใผใใซ
g2 = [1, 1] #้ๅ
ใใผใใซ
inverse = [0, 1] #้ๅ
ใใผใใซ่จ็ฎ็จใใผใใซ
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.append( ( -inver... |
s985641406 | p03674 | u026537738 | 1576095909 | Python | Python (3.4.3) | py | Runtime Error | 82 | 15168 | 763 | 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**4
g1 = [1, 1] # ๅ
ใใผใใซ
g2 = [1, 1] #้ๅ
ใใผใใซ
inverse = [0, 1] #้ๅ
ใใผใใซ่จ็ฎ็จใใผใใซ
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.append( ( -inver... |
s791021244 | p03674 | u470542271 | 1575351818 | Python | Python (3.4.3) | py | Runtime Error | 89 | 19808 | 1000 | n = int(input())
a = list(map(int, input().split()))
from collections import Counter
c = Counter(a)
for k in c.keys():
if c[k] == 2:
break
l = []
for i in range(len(a)):
if a[i] == k:
l.append(i)
if len(l) == 2:
break
d = n - l[1] + l[0]
def power(x, y):
if y == 0 : retur... |
s311177552 | p03674 | u638795007 | 1573777950 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2106 | 62128 | 1738 | class combination2():
def __init__(self, n, mo=10 ** 9 + 7):
self.fac = [0] * (n + 1)
self.inv = [1] * (n + 1)
self.fac[0] = 1
self.fact(n,mo)
for i in range(2, n + 1):
self.inv[n] *= i
self.inv[n] %= mo
self.inv[n] = pow(self.inv[n], mo - 2, m... |
s517519230 | p03674 | u819048695 | 1573227647 | Python | Python (3.4.3) | py | Runtime Error | 618 | 21800 | 601 | mod=10**9+7
MAX=10**5
g1=[1,1]
g2=[1,1]
for i in range(2,MAX+1):
num_1=g1[-1]*i%mod
g1.append(num_1)
g2.append(pow(num_1,mod-2,mod))
def cmb(n,r,MOD):
return g1[n]*g2[r]*g2[n-r]%MOD
n=int(input())
a=list(map(int,input().split()))
data=[0]*(n+1)
for i in range(n+1):
data[a[i]]+=1
for i in rang... |
s918275934 | p03674 | u819048695 | 1573078507 | Python | PyPy3 (2.4.0) | py | Runtime Error | 397 | 64036 | 858 | 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**5
g1 = [1, 1] # ๅ
ใใผใใซ
g2 = [1, 1] #้ๅ
ใใผใใซ
inverse = [0, 1] #้ๅ
ใใผใใซ่จ็ฎ็จใใผใใซ
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.append( ( -inver... |
s030141552 | p03674 | u314089899 | 1572490860 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 36424 | 1898 | #66d
#import itertools
import collections
from functools import lru_cache
import sys
sys.setrecursionlimit(100000)
mod_by = 7 + 10**9
@lru_cache(maxsize=None)
def get_num_of_permutations(n,k):
if k==1:
return n
else:
return get_num_of_permutations(n-1,k-1)*n
@lru_cache(maxsize=None)
def... |
s445478709 | p03674 | u263830634 | 1572201702 | Python | Python (3.4.3) | py | Runtime Error | 2134 | 497408 | 1102 | MOD = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
lst = [-1] * n
for i in range(n + 1):
if lst[a[i] - 1] != -1:
first = lst[a[i] - 1]
second = i
break
lst[a[i] - 1] = i
# print (first, second)
left = first
right = n - second
# print (left, right)
left_lst = [1]... |
s815741836 | p03674 | u263830634 | 1572201465 | Python | Python (3.4.3) | py | Runtime Error | 2135 | 498556 | 1111 | MOD = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
lst = [-1] * n
for i in range(n + 1):
if lst[a[i] - 1] != -1:
first = lst[a[i] - 1]
second = i
break
lst[a[i] - 1] = i
# print (first, second)
left = first
right = n - second
# print (left, right)
left_lst = [1]... |
s224050185 | p03674 | u644907318 | 1571489696 | Python | Python (3.4.3) | py | Runtime Error | 146 | 20704 | 609 | INFTY = 10**9+7
memo = {}
def f(i,j):
if j>i:
return 0
if j==0 or j==i:
return 1
if j==1 or j==i-1:
return i
if (i,j) in memo:
return memo[(i,j)]
memo[(i,j)] = (f(i-1,j-1)+f(i-1,j))%INFTY
return memo[(i,j)]
n = int(input())
A = list(map(int,input().split()))
C = {... |
s512601834 | p03674 | u492131209 | 1570762137 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1858 | #include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const long long MOD = 1e9 + 7;
class Combination {
//a^p%mod
ll powmod(... |
s657058871 | p03674 | u923279197 | 1570643689 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 39024 | 602 | a = list(map(int,input().split()))
search = [-1 for i in range(n)]
l,r = -1,-1
for i,x in enumerate(a):
if search[x-1] == -1:
search[x-1] = i
else:
l = search[x-1]
r = i
#print(l,r)
p = 10**9 + 7
#ๅ่จ็ฎ
comb1 = [0 for _ in range(n+1)]
comb1[0] = n+1
x = n+1
for i in range(1,n+1):
x = ... |
s545744106 | p03674 | u191874006 | 1570411711 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2252 | 745976 | 1124 | #!/usr/bin/env python3
#ABC66 D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from coll... |
s161019304 | p03674 | u828766688 | 1569291710 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13880 | 388 |
n = int(input())
a = list(map(int,input().split()))
indlis = [-1] * (n+1)
for i in range(n):
if indlis[a[i]] == -1:
indlis[a[i]] = i
else:
L = indlis[a[i]]
R = i
break
#print (L,R)
nall = n+1
nsub = 1
for i in range(n+1):
print ((nall - nsub) % (10 ** 9 + 7))
n... |
s751562263 | p03674 | u057079894 | 1567491505 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 2779 | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <limits.h>
#include <queue>
#include <map>
#include <ctime>
#include <set>
using namespace std;
#define rip(i,n,s) for (int i=(s);i<(int)(n);i++)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
long long pow(long long n,... |
s455039038 | p03674 | u619819312 | 1566504342 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 23676 | 289 | from statistics import mode
n=int(input())
a=list(map(int,input().split()))
t=mode(a)
b=[i for i in range(n)if a[i]==t]
c=n+1
d=1
m=10**9+7
for i in range(1,n+2):
if i==1:
print(n)
else:
c=(c*(n-i+2))//i
d=(d*(n-b[1]+b[0]+2-i))//(i-1)
print((c-d)%m) |
s965314763 | p03674 | u751550626 | 1566344000 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 2073 | #include <bits/stdc++.h>
#include <boost/range/irange.hpp>
using namespace std;
using namespace boost;
struct Mod {
static constexpr auto kMod = 1000000007L;
// can be implicitly converted
Mod(int64_t n) : n(n) {}
Mod operator*(Mod m) const { return (n * (m.n % kMod)) % kMod; }
Mod& operator... |
s654816419 | p03674 | u844789719 | 1561426966 | Python | Python (3.4.3) | py | Runtime Error | 720 | 22096 | 620 | N = int(input())
A = [int(_) for _ in input().split()]
mod = 10**9 + 7
f = [1] * (N + 2)
fi = [1] * (N + 2)
for i in range(2, N + 2):
f[i] = i * f[i - 1]
f[i] %= mod
for i in range(2, N + 2):
fi[i] = fi[i - 1] * pow(i, mod - 2, mod)
fi[i] %= mod
def comb(n, r):
if 0 <= n and 0 <= r and 0 <= n - r... |
s729001029 | p03674 | u960653324 | 1560475573 | Python | Python (3.4.3) | py | Runtime Error | 202 | 14552 | 651 | from scipy.special import comb
N = int(input())
A = [int(i) for i in input().split()]
#def nCr(n,r):
# numerator = math.factorial(n)
# denominator = math.factorial(r) * math.factorial(n-r)
# return numerator//denominator
A_duplicate = [x for x in set(A) if A.count(x) > 1]
A_duplicate_indexes = [i for i, x in enum... |
s375575933 | p03674 | u934868410 | 1560358242 | Python | Python (3.4.3) | py | Runtime Error | 81 | 13812 | 613 | n = int(input())
a = list(map(int, input().split()))
def comb(n, k):
if n < k:
return 0
ret = 1
c = min(k, n-k)
for i in range(c):
ret *= (n-i)
for i in range(c):
ret /= (c-i)
return ret
li = [0]*(n+1)
twice = 0
for i in range(len(a)):
li[a[i]] += 1
if li[a[i]] ... |
s687689691 | p03674 | u785578220 | 1559334869 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1130 | class BigCombination(object):
__slots__ = ["mod", "factorial", "inverse"]
def __init__(self, mod= 10**9+7, max_n = 10**6):
fac, inv = [1], []
fac_append, inv_append = fac.append, inv.append
for i in range(1, max_n+1):
fac_append(fac[-1] * i % mod)
inv_append(pow(f... |
s120605309 | p03674 | u785578220 | 1559334680 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1118 | class BigCombination(object):
__slots__ = ["mod", "factorial", "inverse"]
def __init__(self, mod: int 10**9+7, max_n: int 10**6):
fac, inv = [1], []
fac_append, inv_append = fac.append, inv.append
for i in range(1, max_n+1):
fac_append(fac[-1] * i % mod)
inv_appe... |
s175395093 | p03674 | u649373416 | 1558501339 | Python | PyPy3 (2.4.0) | py | Runtime Error | 305 | 62188 | 1089 | N = int(input())
li = [ int(it) -1 for it in input().split() ]
from functools import lru_cache
MOD = 1000000007
def egcd(a, b):
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
(a, b) = (b, a % b)
(x, lastx) = (lastx - q * x, x)
(y, lasty) = (lasty - q * y,... |
s317758713 | p03674 | u102461423 | 1556377877 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38640 | 1005 | import numpy as np
import numba as nb
# ๅบๆฌ็ใซ้่คใใชใ
# n+1Ck โ (n+1)-(r-l+1)Ckโ1
MOD = 10**9+7
U = 10**5 + 1
def power_mod(a,n):
if n == 0:
return 1
x = (power_mod(a,n//2)**2)%MOD
return x if n%2 == 0 else (a*x)%MOD
@nb.njit
def make_fact(fact,fact_inv):
for i in range(1,U+1):
fact[i] = (fact[i-1]*i)%M... |
s776629036 | p03674 | u619458041 | 1554509379 | Python | Python (3.4.3) | py | Runtime Error | 156 | 13276 | 625 | import sys
try:
from scipy.special import comb
except ModuleNotFoundError:
from scipy.misc import comb
def main():
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
used = set()
first = 0
second = 0
for i in range(N+1):
if A... |
s435128675 | p03674 | u619458041 | 1554509059 | Python | Python (3.4.3) | py | Runtime Error | 205 | 15836 | 1006 | import sys
from scipy.special import comb
def main():
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
used = set()
first = 0
second = 0
for i in range(N+1):
if A[i] in used:
second = i
first = A.index(A[i])... |
s303564586 | p03674 | u619458041 | 1554435091 | Python | Python (3.4.3) | py | Runtime Error | 272 | 15908 | 837 | import sys
from math import factorial
def comb(n, r):
if r < 0:
return 0
if n < r:
return 0
if n == r:
return 1
return factorial(n) / factorial(r) / factorial(n - r)
def main():
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
MOD ... |
s429910767 | p03674 | u619458041 | 1554435006 | Python | Python (3.4.3) | py | Runtime Error | 273 | 15908 | 805 | import sys
from math import factorial
def comb(n, r):
if r < 0:
return 0
if n < r:
return 0
return factorial(n) / factorial(r) / factorial(n - r)
def main():
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
used = set()
... |
s256229649 | p03674 | u619458041 | 1554434676 | Python | Python (3.4.3) | py | Runtime Error | 352 | 23408 | 672 | import sys
from scipy.special import comb
def main():
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
used = set()
first = 0
second = 0
for i in range(N+1):
if A[i] in used:
second = i
first = A.index(A[i])... |
s927691919 | p03674 | u319818856 | 1554026252 | Python | Python (3.4.3) | py | Runtime Error | 65 | 20704 | 789 | def mod_inv(n: int, mod: int)->int:
b, u, v = mod, 1, 0
while b > 0:
t = n // b
n -= t * b
u -= t * v
a, b = b, a
u, v = v, u
return (u+mod) % mod
def _11(N: int, A: list)->list:
MOD = 10**9 + 7
d = {}
l, r = 0, 0
for i, a in enumerate(A):
... |
s501639684 | p03674 | u155024797 | 1552709862 | Python | PyPy3 (2.4.0) | py | Runtime Error | 340 | 68684 | 970 | mod = int(1e9) + 7
def power(x, y):
if y == 0:
return 1
elif y == 1:
return x % mod
elif y % 2 == 0:
return power(x, y//2)**2 % mod
else:
return power(x, y//2)**2 * x % mod
fact = [1] * int(1e5+1)
for i in range(1, int(1e5+1)):
fact[i] = (i * fact[i-1]) % mod
inv ... |
s103567099 | p03674 | u155024797 | 1552707498 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2107 | 63840 | 877 | mod = int(1e9) + 7
def power(x, y):
if y == 0:
return 1
elif y == 1:
return x % mod
elif y % 2 == 0:
return power(x, y//2)**2 % mod
else:
return power(x, y//2)**2 * x % mod
def div(a, b):
return a * power(b, mod-2) % mod
fact = [1] * int(1e5)
for i in range(1, i... |
s697636090 | p03674 | u761989513 | 1552616682 | Python | Python (3.4.3) | py | Runtime Error | 501 | 19936 | 554 | import math
import collections
mod = 10 * 9 + 7
def nCr(n, r):
return (math.factorial(n) % mod) // ((math.factorial(n - r) % mod) * (math.factorial(r) % mod))
n = int(input())
a = list(map(int, input().split()))
w = collections.Counter(a).most_common(1)[0][0]
w_index = []
for i in range(n + 1):
if a[i] == w... |
s323449210 | p03674 | u761989513 | 1552616175 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 19936 | 483 | import math
import collections
def nCr(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n = int(input())
a = list(map(int, input().split()))
w = collections.Counter(a).most_common(1)[0][0]
w_index = []
for i in range(n):
if a[i] == w:
w_index.append(i)
for i in range(1,... |
s525011680 | p03674 | u281303342 | 1552100560 | Python | Python (3.4.3) | py | Runtime Error | 490 | 45788 | 816 | def init_fact(n,mod):
fact,finv,inv = [1]*n,[1]*n,[1]*n
for i in range(2,n):
fact[i] = (fact[i-1]*i) % mod
inv[i] = mod - inv[mod%i] * (mod//i)%mod
finv[i] = finv[i-1] * inv[i] % mod
return (fact,finv,inv)
def nCr(n,r,mod,fact,finv):
if n<r:
return 0
else:
r... |
s388668597 | p03674 | u824237520 | 1551476313 | Python | Python (3.4.3) | py | Runtime Error | 2265 | 1592996 | 802 | n = int(input())
a = list(input().split())
if n == 1:
print(1)
print(1)
exit()
MOD = 10 ** 9 + 7
b = sorted(a)
for i in range(n):
if b[i] == b[i + 1]:
d = b[i]
break
p = []
for i in range(n):
if a[i] == d:
p.append(i)
w = p[0] + n - p[1]
c = [0 for _ in range(n + 2)]
d... |
s673029425 | p03674 | u824237520 | 1551475336 | Python | Python (3.4.3) | py | Runtime Error | 2268 | 746248 | 630 | n = int(input())
a = list(input().split())
if n == 1:
print(1)
print(1)
exit()
MOD = 10 ** 9 + 7
b = sorted(a)
for i in range(n):
if b[i] == b[i + 1]:
d = b[i]
break
p = []
for i in range(n):
if a[i] == d:
p.append(i)
w = p[0] + n - p[1]
c = [0 for _ in range(n + 2)]
... |
s484375214 | p03674 | u824237520 | 1551474771 | Python | Python (3.4.3) | py | Runtime Error | 2281 | 744160 | 643 | n = int(input())
a = list(input().split())
if n == 1:
print(1)
print(1)
exit()
MOD = 10 ** 9 + 7
b = sorted(a)
for i in range(n):
if b[i] == b[i + 1]:
d = b[i]
break
p = []
for i in range(n):
if a[i] == d:
p.append(i)
w = p[0] + n - p[1]
c = [0 for _ in range(n + 2)]
... |
s871943835 | p03674 | u824237520 | 1551474156 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 10740 | 1035 | n = int(input())
a = list(input().split())
if n == 1:
print(1)
print(1)
exit()
MOD = 10 ** 9 + 7
b = sorted(a)
for i in range(n):
if b[i] == b[i + 1]:
d = b[i]
break
p = []
for i in range(n):
if a[i] == d:
p.append(i)
x = p[0]
y = p[1] - p[0] - 1
z = n - p[1]
w = x + z
... |
s192442564 | p03674 | u824237520 | 1551474049 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 12848 | 986 | n = int(input())
a = list(input().split())
MOD = 10 ** 9 + 7
b = sorted(a)
for i in range(n):
if b[i] == b[i + 1]:
d = b[i]
break
p = []
for i in range(n):
if a[i] == d:
p.append(i)
x = p[0]
y = p[1] - p[0] - 1
z = n - p[1]
w = x + z
def cmb(n, r):
if n - r < r: r = n - r
i... |
s908501632 | p03674 | u858136677 | 1551392015 | Python | Python (3.4.3) | py | Runtime Error | 105 | 19932 | 1129 | import collections
def comb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p in range(2,r+1):
pivot = denominator[p - 1]
if pivot > 1:
offset = (n - r)... |
s244955841 | p03674 | u145035045 | 1548565935 | Python | Python (3.4.3) | py | Runtime Error | 794 | 114464 | 789 | from collections import defaultdict
import sys
sys.setrecursionlimit(100001)
MOD = 1000000007
n = int(input())
alst = list(map(int, input().split()))
dic = defaultdict(list)
for i in range(n + 1):
dic[alst[i]].append(i)
for v in dic.values():
if len(v) == 2:
left, right = v
break
factMem = {}... |
s297128221 | p03674 | u145035045 | 1548565680 | Python | Python (3.4.3) | py | Runtime Error | 217 | 28888 | 749 | from collections import defaultdict
MOD = 1000000007
n = int(input())
alst = list(map(int, input().split()))
dic = defaultdict(list)
for i in range(n + 1):
dic[alst[i]].append(i)
for v in dic.values():
if len(v) == 2:
left, right = v
break
factMem = {}
def fact(x):
if x <= 0:return 1
... |
s406504481 | p03674 | u145035045 | 1548565576 | Python | Python (3.4.3) | py | Runtime Error | 210 | 28888 | 743 | from collections import defaultdict
MOD = 1000000007
n = int(input())
alst = list(map(int, input().split()))
dic = defaultdict(list)
for i in range(n + 1):
dic[alst[i]].append(i)
for v in dic.values():
if len(v) == 2:
left, right = v
break
factMem = {}
def fact(x):
if x <= 0:return 1
... |
s553173172 | p03674 | u099566485 | 1545841586 | Python | Python (3.4.3) | py | Runtime Error | 2299 | 744972 | 547 | #066-D
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
d=Counter(a).most_common(1)[0][0]
f,s=-1,-1
fc=[1 for i in range(n+2)]
for i in range(n+1):
if a[i]==d:
if f==-1:
f=i
else:
s=i
fc[i+1]=(i+1)*fc[i]
fc[n+1]=(n+1)*fc[n]
for k in range(1,... |
s211634978 | p03674 | u099566485 | 1545841235 | Python | Python (3.4.3) | py | Runtime Error | 2277 | 744976 | 517 | #066-D
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
d=Counter(a).most_common(1)[0][0]
f,s=-1,-1
fc=[1 for i in range(n+2)]
for i in range(n+1):
if a[i]==d:
if f==-1:
f=i
else:
s=i
fc[i+1]=(i+1)*fc[i]
fc[n+1]=(n+1)*fc[n]
for k in range(1,... |
s799659211 | p03674 | u391331433 | 1543791490 | Python | Python (2.7.6) | py | Runtime Error | 188 | 37464 | 1957 | import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
if fileobject == None :
return raw_input
else:
return fileobject.readline
def power_func(a,b,p):
if b==0: return 1
if b%2==0:
d=power_func(a,b//2,p)
return d*d %p
if b%2==1:
return ... |
s873321193 | p03674 | u844789719 | 1543306146 | Python | PyPy3 (2.4.0) | py | Runtime Error | 206 | 52972 | 626 | N = int(input())
A = [int(_) for _ in input().split()]
mod = 10**9+7
memo=[0]*(N+2)
def comb(x, y):
if x == N-1 and dp[y] > 0:
return memo[y]
elif y > x:
return 0
elif y * 2 > x:
y = x - y
result = 1
for j in range(1, y + 1):
result *= (x + j - y) * pow(j, mod - 2, m... |
s123447746 | p03674 | u170201762 | 1540533952 | Python | Python (3.4.3) | py | Runtime Error | 812 | 21816 | 1133 | def gcd(a, b):
while b:
a, b = b, a % b
return a
def egcd(a, b):
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
(a, b) = (b, a % b)
(x, lastx) = (lastx - q * x, x)
(y, lasty) = (lasty - q * y, y)
return (lastx, lasty, a)
N = 10**9+7
R = 10**5
modfa... |
s169045676 | p03674 | u419686324 | 1536639878 | Python | Python (3.4.3) | py | Runtime Error | 1227 | 35860 | 731 | n = int(input())
A = [int(x) for x in input().split()]
p = 10**9 + 7
found = {}
for i, a in enumerate(A):
if a in found:
dup = a
dup_1 = found[a]
dup_2 = i
found[a] = i
from functools import lru_cache
@lru_cache(maxsize=None)
def gfp_inv(x, p):
return pow(x, p - 2, p)
from itert... |
s264472174 | p03674 | u419686324 | 1536638891 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 727 | init_input()
n = int(input())
A = [int(x) for x in input().split()]
found = {}
for i, a in enumerate(A):
if a in found:
dup = a
dup_1 = found[a]
dup_2 = i
found[a] = i
from functools import lru_cache
@lru_cache(maxsize=None)
def gfp_inv(x, p):
return pow(x, p - 2, p)
@lru_cache(... |
s563379771 | p03674 | u232852711 | 1534486524 | Python | Python (3.4.3) | py | Runtime Error | 1278 | 25884 | 614 | MOD = 10**9+7
facts = [1]
for i in range(1, 10**5+1):
facts.append((i*facts[i-1])%MOD)
def nCk(n, k):
if n < k or n == 0: return 0
return (facts[n]*pow(facts[k], MOD-2, MOD)%MOD * pow(facts[n-k], MOD-2, MOD))%MOD
n = int(input())
a = list(map(int, input().split()))
# Search doubling number and its indexes... |
s654675276 | p03674 | u333945892 | 1532999175 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14444 | 842 | from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]
def inpl_int(): return list(map(int, input().split()))
def inpl_str(): return list(map(int, i... |
s818983661 | p03674 | u004025573 | 1531201295 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 15844 | 552 | import math
def comb(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n = int(input())
a = list(map(int, input().split()))
for x in set(a):
if a.count(x) > 1:
num=x
flag=0
for i in range(n):
if a[i]==num:
if flag==0:
th1=i
flag=1
... |
s321727122 | p03674 | u403301154 | 1531010992 | Python | Python (3.4.3) | py | Runtime Error | 1187 | 29008 | 729 | MOD = 10**9+7
def mod_pow(x, n):
if x==0: return 1
res = 1
while n > 0:
if n&1:
res = (res*x)%MOD
x = (x*x)%MOD
n >>= 1
return res
fact, invfact = [0]*(10**5+1), [0]*(10**5+1)
fact[0], invfact[0] = 1, 1
for i in range(1, 10**5+1):
fact[i] = (fact[i-1]*i)%MOD
invfact[i] = mod_pow(fact[i],... |
s956119202 | p03674 | u467736898 | 1529337298 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 1065 | # ๆกๅผตใฆใผใฏใชใใไบ้คๆณ
# ax + by = gcd(a,b)ใฎๆๅฐๆดๆฐ่งฃใ่ฟใ
def egcd(a, b):
if a == 0:
return b, 0, 1
else:
g, y, x = egcd(b % a, a)
return g, x - (b // a) * y, y
# mใๆณใจใใaใฎไนๆณ็้ๅ
def modinv(a, m):
g, x, y = egcd(a, m)
if g != 1:
... |
s791361570 | p03674 | u957084285 | 1527446633 | Python | Python (3.4.3) | py | Runtime Error | 255 | 13812 | 324 | import math
def nCr(n,r):
if n < r:
return 0
f = math.factorial
return f(n) / f(r) / f(n-r)
n = int(input())
a = list(map(int, input().split()))
MOD = 10**9+7
d = sum(a)-n*(n+1)//2
x = a.index(d)
y = a[x+1:].index(d)+x+1
for i in range(1, n+2):
print(int(nCr(n+1, i) - nCr((n+x-y), (i-1)))%M... |
s247403540 | p03674 | u391475811 | 1520565114 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 554 | N=int(input())
A=[int(x) for x in input().split()]
#้่คๅง็น็ต็น่ชฟๆป
se=[]
c=sum(A)-N*(N+1)/2:
for i in range(len(A)):
if A[i]==c:
se.append(i)
l=se[0]
r=se[1]
mod=10**9+7
#้ไน่จ็ฎ
factorial=[1]
inverse=[1]
for i in range(1,N+2):
factorial.append(factorial[-1]*i %mod)
inverse.append((pow(factorial[i], mod-2, mod)... |
s077372880 | p03674 | u391475811 | 1520448716 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 719 | N=int(input())
A=[int(x) for x in input().split()]
#้่คๅง็น็ต็น่ชฟๆป
se=[]
for i in range(len(A)):
if A[i]==sum(A)-N*(N+1)/2:
se.append(i)
mod=10**9+7
#้ไน่จ็ฎ
factorial=[1]
for i in range(1,N+2):
factorial.append(factorial[i-1]*i %mod)
#้ๅ
่จ็ฎ
inverse=[0]*(N+2)
inverse[N+2-1] = pow(factorial[N+2-1], mod-2,mod)
for i i... |
s896601118 | p03674 | u590048048 | 1516912702 | Python | Python (3.4.3) | py | Runtime Error | 123 | 19704 | 1247 |
MODULO = 10**9 + 7
def modulo(x):
return x % MODULO
n = int(input())
xs = list(map(int, input().split()))
def locate_dup(xs):
d = {}
for i,x in enumerate(xs):
if x in d:
return d[x], i
else:
d[x] = i
assert(False)
first, second = locate_dup(xs)
class X:
... |
s905870477 | p03674 | u160414758 | 1504154497 | Python | Python (3.4.3) | py | Runtime Error | 132 | 22116 | 698 | MOD = int(1e9 + 7)
N = int(input())
A = list(map(int, input().split()))
factorial = [1] * (N + 2)
for k in range(1, N + 2):
factorial[k] = (factorial[k - 1] * k) % MOD
fact_inv = [1] * (N + 2)
fact_inv[N + 1] = pow(factorial[N + 1], MOD - 2, MOD)
for k in range(N, -1, -1):
fact_inv[k] = (fact_inv[k + 1] * (k... |
s327118866 | p03674 | u047535298 | 1502993621 | Python | Python (3.4.3) | py | Runtime Error | 69 | 15484 | 492 | n = int(input())
a = list(map(int, input().split()))
s = set()
dup = list(set([x for x in a if x in s or s.add(x)]))[0]
start = a.index(dup)
end = a.index(dup, start+1)
d = end - start
def comb(n, r):
if(r==0):
return 1
ret = n
for i in range(1, r):
ret = ret * (n-i) / (i+1)
return int... |
s266254406 | p03674 | u143221266 | 1500005891 | Python | Python (2.7.6) | py | Runtime Error | 881 | 25828 | 1208 | # -*- coding: utf-8 -*-
from collections import Counter
import re
def pow(a, x):
y = 1
p = a
n = x % mask
while (n > 0):
if ((n % 2) == 0):
p = (p * p) % mask
n /= 2
else:
y = (y ... |
s833042397 | p03674 | u143221266 | 1500000645 | Python | Python (2.7.6) | py | Runtime Error | 2349 | 743576 | 601 | # -*- coding: utf-8 -*-
import re
n = int(raw_input())
a = map(int, re.split("\s", raw_input()))
left = 0
right = 0
mask = 10**9 + 7
com = [0]*(n+2)
tmp = 1
for i in range(1, n+2):
tmp *= i
com[i] = tmp
for i in range(0, n + 1):
x = a.index(a[i])
if a[i] in a[x+1:]:
... |
s906636727 | p03674 | u143221266 | 1500000602 | Python | Python (2.7.6) | py | Runtime Error | 70 | 11304 | 599 | # -*- coding: utf-8 -*-
import re
n = int(raw_input())
a = map(int, re.split("\s", raw_input()))
left = 0
right = 0
mask = 10**9 + 7
com = [0]*n+2
tmp = 1
for i in range(1, n+2):
tmp *= i
com[i] = tmp
for i in range(0, n + 1):
x = a.index(a[i])
if a[i] in a[x+1:]:
le... |
s034065524 | p03674 | u143221266 | 1500000474 | Python | Python (2.7.6) | py | Runtime Error | 73 | 11216 | 596 | # -*- coding: utf-8 -*-
import re
n = int(raw_input())
a = map(int, re.split("\s", raw_input()))
left = 0
right = 0
mask = 10**9 + 7
pow = [0]*n+2
tmp = 1
for i in range(1, n+2):
tmp *= i
pow[i] = tmp
for i in range(0, n + 1):
x = a.index(a[i])
if a[i] in a[x+1:]:
le... |
s840820202 | p03674 | u143221266 | 1500000315 | Python | Python (2.7.6) | py | Runtime Error | 64 | 11432 | 599 | # -*- coding: utf-8 -*-
import re
n = int(raw_input())
a = map(int, re.split("\s", raw_input()))
left = 0
right = 0
mask = 10**9 + 7
pow = [0]*n+2
tmp = 1
for i in range(1, n+2):
tmp *= i
pow[i] = tmp
for i in range(0, n + 1):
x = a.index(a[i])
if a[i] in a[x+1:]:
... |
s758473565 | p03674 | u143221266 | 1499999183 | Python | Python (2.7.6) | py | Runtime Error | 2104 | 12404 | 893 | # -*- coding: utf-8 -*-
import re
def comb(n, k):
a = [0] * 17
if (n - k < k):
k = n - k
if (k == 0):
return 1
if (k == 1):
return n
if (k > 17):
return 0
for i in range(1, k):
a[i] = i + 2
... |
s656158379 | p03674 | u143221266 | 1499999183 | Python | Python (2.7.6) | py | Runtime Error | 2104 | 14452 | 893 | # -*- coding: utf-8 -*-
import re
def comb(n, k):
a = [0] * 17
if (n - k < k):
k = n - k
if (k == 0):
return 1
if (k == 1):
return n
if (k > 17):
return 0
for i in range(1, k):
a[i] = i + 2
... |
s166067790 | p03674 | u203900263 | 1499737577 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13812 | 488 | import math
def nCm(n, m):
return math.factorial(n) // (math.factorial(m) * (math.factorial(n - m)))
n = int(input())
a = list(map(int, input().split()))
saw = [-1] * n
left = 0
right = 0
for i in range(n):
if saw[a[i] - 1] == -1:
saw[a[i] - 1] = i
else:
left, right = saw[a[i] -1], n - i... |
s272371173 | p03674 | u203900263 | 1499737533 | Python | Python (3.4.3) | py | Runtime Error | 71 | 13812 | 458 | import math
def nCm(n, m):
return fact(n) // (fact(m) * (fact(n - m)))
n = int(input())
a = list(map(int, input().split()))
saw = [-1] * n
left = 0
right = 0
for i in range(n):
if saw[a[i] - 1] == -1:
saw[a[i] - 1] = i
else:
left, right = saw[a[i] -1], n - i
break
print(left, rig... |
s263072777 | p03674 | u203900263 | 1499737499 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 457 | import math
def nCm(n, m):
return fact(n) // (fact(m) * (fact(n - m)))
n = int(input())
a = list(map(int, input().split()))
saw = [-1] * n
left = 0
right = 0
for i in range(n):
if saw[a[i] - 1] == -1:
saw[a[i] - 1] = i
else:
left, right = saw[a[i] -1], n - i
break
print(left, rig... |
s303367055 | p03674 | u965786740 | 1499202230 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 574 | b=10**9+7
num = [-1]*(n+1)
temp=1
temp2=1
for i in range(len(a)):
if num[a[i]] != -1:
p1,p2=num[a[i]],i
num[a[i]]=i
for k in range(1,len(a)+1):
if k == 1:
print(n)
elif k == len(a):
print(1)
else:
for l in r... |
s477542580 | p03674 | u965786740 | 1499200555 | Python | Python (3.4.3) | py | Runtime Error | 72 | 13812 | 568 | n=int(input())
a=list(map(int,input().split()))
b=10**9+7
num = [-1]*(n+1)
temp=1
temp2=1
for i in range(len(a)):
if num[a[i]] != -1:
p1,p2=num[a[i]],i
num[a[i]]=i
for k in range(1,len(a)+1):
if k == 1:
print(n)
else:
for l in range(k):
... |
s150861521 | p03674 | u364618491 | 1499119298 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 21324 | 982 | # coding: utf-8
# Here your code !
l=int(input())+1
if l==2:
print(1)
print(1)
exit()
mod = 10**9+7
N = 10**5+2
g1 = [1, 1] #0! ใจ1!
g2 = [1, 1] #(0!)^-1 ใจ(1!)^-1
inverse = [0, 1]
data=list(map(int,input().split()))
for i in data:
if data.count(i)==2:
x=i
break
for i in range( 2, N + 1... |
s568799495 | p03674 | u364618491 | 1499118921 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 20440 | 979 | # coding: utf-8
# Here your code !
l=int(input())+1
if l==2:
print(1)
print(1)
exit()
mod = 10**9+7
N = 10**5+2
g1 = [1, 1] #0! ใจ1!
g2 = [1, 1] #(0!)^-1 ใจ(1!)^-1
inverse = [0, 1]
data=list(map(int,input().split()))
for i in data:
if data.count(i)==2:
x=i
break
for i in range( 2, N + 1... |
s741538877 | p03674 | u364618491 | 1499118850 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 21328 | 979 | # coding: utf-8
# Here your code !
l=int(input())+1
if l==2:
print(1)
print(1)
exit()
mod = 10**9+7
N = 10**5+2
g1 = [1, 1] #0! ใจ1!
g2 = [1, 1] #(0!)^-1 ใจ(1!)^-1
inverse = [0, 1]
data=list(map(int,input().split()))
for i in data:
if data.count(i)==2:
x=i
break
for i in range( 2, N + 1... |
s034522926 | p03674 | u926678805 | 1499117898 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 24288 | 917 | l=int(input())+1
if l==2:
print(1)
print(1)
exit()
mod = 10**9+7
N = 10**5+2
g1 = [1, 1] #0! ใจ1!
g2 = [1, 1] #(0!)^-1 ใจ(1!)^-1
inverse = [0, 1]
data=list(map(int,input().split()))
for i in data:
if data.count(i)==2:
x=i
break
for i in range( 2, N + 1 ):
#ๅ
ใใผใใซใฏ๏ผๆๅพๅฐพใฎ่ฆ็ด ใซiใไน็ฎใใใฎใๅ ใใ
... |
s035553007 | p03674 | u058240079 | 1499089206 | Python | Python (2.7.6) | py | Runtime Error | 2000 | 11304 | 471 | def combi(a,b):
if b < 0:
return 0
if b > a - b:
b = a - b
if b == 0:
return 1
else:
return combi(a-1,b-1)*a/b
n = int(raw_input())
l = map(int, raw_input().split())
ct = [0 for _ in range(n+1)]
for i in l:
ct[i] += 1
for i,c in enumerate(ct):
if c == 2:
... |
s179558287 | p03674 | u374514823 | 1499020856 | Python | Python (3.4.3) | py | Runtime Error | 228 | 30704 | 421 | from scipy.misc import comb
n = int(input())
a = list(map(int, input().split()))
appeared = {}
double = [0, 0]
for i, v in enumerate(a):
if v in appeared:
double = [appeared[v], i]
break
else:
appeared[v] = i
duplicateElemSize = double[0] + n - double[1]
for i, v in enumerate(a):
... |
s879551817 | p03674 | u525529288 | 1499011124 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38640 | 346 | import scipy.misc as scm
mod = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))
num = [-1] * (n+1)
l = r = -1
for i in range(len(a)):
if num[a[i]] != -1:
l, r = num[a[i]], i
break
num[a[i]] = i
for k in range(1, len(a)+1):
print(scm.comb(len(a), k, True) % mod - scm.comb(l+len... |
s885317002 | p03674 | u820351940 | 1498974936 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14008 | 932 | n = int(input())
a = list(map(int, input().split()))
M = 10**9 + 7
def calc_index(a):
t = sorted(a)
for i, x in enumerate(t[1:]):
if t[i] == x:
break
result = []
for i, v in enumerate(a):
if v == x:
result.append(i)
return result
f, e = calc_index(a)
out = n... |
s303176368 | p03674 | u820351940 | 1498974684 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14004 | 921 | n = int(input())
a = list(map(int, input().split()))
M = 10**9 + 7
def calc_index(a):
t = sorted(a)
for i, x in enumerate(t[1:]):
if t[i] == x:
break
result = []
for i, v in enumerate(a):
if v == x:
result.append(i)
return result
f, e = calc_index(a)
out = n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.