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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s457693497 | p04021 | u619819312 | 1555804880 | Python | Python (3.4.3) | py | Runtime Error | 211 | 8608 | 187 | from collections import defaultdict as d
a=[int(input()) for i in range(int(input()))]
b=sorted(a)
c=d(int)
e=0
for i in range(0,n,2):
d[b[i]]=1
for i in a[1::2]:
e+=d[i]
print(e) |
s086483000 | p04021 | u785989355 | 1552970393 | Python | Python (3.4.3) | py | Runtime Error | 506 | 7272 | 678 |
def nibutan2(array,value,left,right,first = True):
if first:
if array[left]>value:
return 0
elif array[right]<value:
return len(array)
if right-left<=1:
return right
else:
i=(left+right)//2
if array[i]>value:
return nibutan2(array... |
s081071926 | p04021 | u785989355 | 1552970249 | Python | Python (3.4.3) | py | Runtime Error | 235 | 7268 | 674 | def nibutan2(array,value,left,right,first = True):
if first:
if array[left]>value:
return 0
elif array[right]<value:
return len(array)
if right-left<=1:
return right
else:
i=(left+right)//2
if array[i]>value:
return nibutan(array,va... |
s298240560 | p04021 | u539402331 | 1545359467 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 38256 | 375 | #include <bits/stdc++.h>
using namespace std;
int n, k[100005], mon[100005], ans;
bool pre(int a, int b) {
if(k[a]<k[b]){return true;}
else{return false;}
}
int main() {
cin>>n;
for (int i = 0; i < n; ++i) {
cin>>k[i];
mon[i+1] = i+1;
}
sort(mon,mon+n,pre);
for (int i = 0; i < n; i += 2){
i... |
s713212475 | p04021 | u422104747 | 1539594056 | Python | Python (3.4.3) | py | Runtime Error | 272 | 7888 | 325 | import bisect
n=int(input())
l=[]
e=[]
for i in range(n//2):
j=int(input())
e.append(j)
l.append(j)
j=int(input())
l.append(j)
if n%2==1:
j=int(input())
e.append(j)
l.append(j)
l.sort()
e.sort()
res=0
for i in range(0,n,2):
if e[bisect.bisect_left(e,l[i])]!=l[i]:
res+=1
print... |
s032688578 | p04021 | u101225820 | 1500763870 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 7084 | 387 | N=int(input())
l=[int(input()) for _ in range(N)]
cnt=0
if(N<3):
if N==1:print("0")
elif l[1]>l[2]:print("1")
else:print("0")
for _ in range(N):
for i in range(N-2):
if l[i]>l[i+2]:
l[i], l[i + 2] = l[i + 2], l[i]
for _ in range(N):
for i in range(N-1):
if(l[i]>l[i+1]):
... |
s767509184 | p04021 | u866746776 | 1472818233 | Python | Python (3.4.3) | py | Runtime Error | 528 | 14644 | 256 | def solve(a):
l = len(a)
a1 = [a[2*i+1] for i in range((l+1)//2)]
b = a.copy()
b.sort()
b1 = [b[2*i+1] for i in range((l+1)//2)]
a1 = set(a1)
b1 = set(b1)
return len(a1 - b1)
n = int(input())
a = [int(input()) for i in range(n)]
print(solve(a))
|
s739731205 | p04021 | u914627967 | 1472507592 | Python | Python (3.4.3) | py | Runtime Error | 548 | 8592 | 428 | #coding: cp932
N = int(input())
inp =[]
for s in range(N):
inp.append(int(input()))
check = inp[:]
check.sort()
flag=1
s,ans,lis2 = 0,0,[]
while flag==1:
#lis.append(check[s])
lis2.append(inp[s])
s+=2
if s>N-1:
flag=0
num =len(lis)
#print(lis)
#print(lis2)
for s in range(num):
if s!=0:
if check[s+2] not in l... |
s426348718 | p04022 | u467736898 | 1596779730 | Python | Python (3.8.2) | py | Runtime Error | 82 | 55536 | 984 | import sys
from subprocess import Popen, PIPE
from itertools import groupby
from collections import Counter
def main():
sys.stdin.readline()
S = sys.stdin.read()
T = []
inv_dict = {}
Factors = Popen("factor " + S, stdout=PIPE).communicate()[0].split(b"\n")
for factors in Factors:
factor... |
s769508799 | p04022 | u638795007 | 1584505961 | Python | PyPy3 (2.4.0) | py | Runtime Error | 4399 | 178520 | 2787 | def examA():
S = SI()
if "W" in S and not "E" in S:
print("No")
elif "E" in S and not "W" in S:
print("No")
elif "N" in S and not "S" in S:
print("No")
elif "S" in S and not "N" in S:
print("No")
else:
print("Yes")
return
def examB():
N = I()
... |
s625536631 | p04023 | u353919145 | 1553558463 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 202 | if self.buffInGod > 0 then
if real == 2 or real == 3 then
g_mvcNotify:notifyToRootView("playEffect", self.posXY,
'00buff/wudi.json',self.posZ,0,self.faceTo,'effect1')
end
return false
end |
s280612182 | p04023 | u089230684 | 1553558380 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 122 | function SignetBackpacker:refreshBag()
g_asyncLoad:overFor(self)
if self.signetTal[self.listSlotID] then
return
end
|
s616776013 | p04023 | u816631826 | 1553558228 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 134 | function SignetBackpacker:refreshBagData(data)
if data then
self.originData = data
end
self.signetTal = {}
self:refreshBag()
end |
s881927993 | p04023 | u353919145 | 1553558026 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 574 | if attackObj and (real == 1 or real == 3) then
if not args or args.from ~= 9 then -- 9表示来自反弹的
local nowRound = self._scene.nowRound
attackObj.roundRecordTb[nowRound] = attackObj.roundRecordTb[nowRound] or {}
local recordTb = attackObj.roundRecordTb[nowRound]
local tdmg1 = recordTb["roundTotalDmg"] or 0
... |
s058753073 | p04023 | u089230684 | 1553557560 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 208 | type Container struct {
services sync.Map //map[string]IService
remotes map[string]bool
factory IFactory
nsq *nsq.NSQRPCServer
nsqClient *nsq.NSQRPCClient
option ContainerOption
inited bool
} |
s908900222 | p04025 | u762533651 | 1600211924 | Python | PyPy3 (7.3.0) | py | Runtime Error | 96 | 74716 | 410 | n = int(input())
x = sorted(list(map(int, input().split())), reverse = True)
x_2 = list(map(lambda x:x ** 2, x))
ichi = sum(x)
jijou = sum(x_2)
re = 10 ** 100
#def ji(p, x):
# ans = p * (p - 2 * x)
# return ans
for p in range(x[n], x[0] + 1):
second = n * (p ** 2)
third = -2 * p * ichi
summ = jijou... |
s638410104 | p04025 | u973972117 | 1598830526 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9184 | 243 | N=int(input())
A=list(map(int,input().split()))
Sum =0
for i in range(len(A)):
Sum += (A[0]-A[i])**2
Answer = Sum
for j in range(len(A)):
Sum =0
for k in range(-100,101):
Sum+= (A[k]-j)**2
Answer =min(Answer, Sum)
print(Answer)
|
s184141885 | p04025 | u973972117 | 1598830461 | Python | Python (3.8.2) | py | Runtime Error | 33 | 9184 | 246 | N=int(input())
A=list(map(int,input().split()))
Sum =0
for i in range(len(A)):
Sum += (A[0]-A[i])**2
Answer = Sum
for j in range(-100,101):
Sum =0
for k in range(len(A)):
Sum+= (A[k]-A[j])**2
Answer =min(Answer, Sum)
print(Answer)
|
s004766689 | p04025 | u973972117 | 1598830096 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9184 | 243 | N=int(input())
A=list(map(int,inout().split()))
Sum =0
for i in range(len(N)):
Sum += (A[0]-A[i])**2
Answer = Sum
for j in range(len(N)):
Sum =0
for k in range(len(N)):
Sum+= (A[k]-A[j])**2
Answer =min(Answer, Sum)
print(Answer)
|
s131935523 | p04025 | u933650305 | 1598826682 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9156 | 243 | n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
x=a[0]
y=a[n-1]
if x==y:
print(0)
else:
d=[]
for i in range(x,y+1):
c=0
for v in range(n):
c+=(i-a[v])**2
d.append(c)
continue
d=sorted(d)
print(d[0])
|
s926724554 | p04025 | u933650305 | 1598826444 | Python | Python (3.8.2) | py | Runtime Error | 32 | 9092 | 241 | n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
x=a[0]
y=a[n-1]
if x==y:
print(0)
else:
d=[]
for i in range(x,y):
c=0
for v in range(n):
c+=(i-a[v])**2
d.append(c)
continue
d=sorted(d)
print(d[0])
|
s426381456 | p04025 | u933650305 | 1598825530 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9200 | 196 | n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
x=a[0]
y=a[n-1]
d=[]
for i in range(x,y):
c=0
for v in range(n):
c+=(i-a[v])**2
d.append(c)
continue
d=sorted(d)
print(d[0]) |
s172297488 | p04025 | u390727364 | 1592503675 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 38256 | 346 | def main():
input = stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
x1 = sum(a) // n
x2 = x1 + 1
ans1 = 0
ans2 = 0
for ai in a:
ans1 += (ai - x1) ** 2
ans2 += (ai - x2) ** 2
print(min(ans1, ans2))
if __name__ == "__main__":
setrecursi... |
s165916825 | p04025 | u597622207 | 1589909635 | Python | PyPy3 (2.4.0) | py | Runtime Error | 184 | 38512 | 320 | from statistics import mean
import math
N = int(input())
A = list(map(int, input().split()))
mean_num = mean(A)
Ceil = math.ceil(mean_num)
Floor = math.floor(mean_num)
Ceil_sum = 0
Floor_sum = 0
for i in A:
Ceil_sum += (Ceil - i) ** 2
for i in A:
Floor_sum += (Floor - i) ** 2
print(min(Floor_sum, Ceil_sum)) |
s858668083 | p04025 | u114641312 | 1589340490 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 246 | from math import factorial,sqrt,ceil,gcd
import numpy as np
N = int(input())
lisA = list(map(int,input().split()))
arrA = np.array(lisA)
mean = np.mean(arrA)
targetnum = round(mean)
arrans = (arrA - targetnum)**2
ans = sum(arrans)
print(ans) |
s511423217 | p04025 | u197968862 | 1587089004 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38768 | 169 | import statistics
n = int(input())
a = list(map(int,input().split()))
mean = round(statistics.mean(a))
ans = 0
for i in range(n):
ans += (a[i]-mean)**2
print(ans) |
s552297504 | p04025 | u353895424 | 1585085523 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 135 | n = int(input())
a = list(map(int, input().split()))
ave = round(sum(a)/n)
ans = 0
for _a in a:
ans += (_a - ave)**2
print(ans1) |
s825408271 | p04025 | u588558668 | 1584367934 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 175 | n=int(input())
a=list(map(int,input().split()))
ma=max(a)
mi=min(a)
b=[0]*(ma-mi+1)
for i in range(mi,ma+1):
for j in range(n):
b[j]+=(i-a[j])**2
print(min(b[j]) |
s719325976 | p04025 | u588558668 | 1584367701 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 181 | n=int(input())
a=list(map(int,int,input().split()))
b=[]
ma=max(a)
mi=min(a)
for i in range(mi,ma+1):
c=0
for j in range(n):
c+=(i-a[j]**2)
b.append(c)
print(min(b))
|
s591132174 | p04025 | u588558668 | 1584367657 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 179 | n=int(input())
a=list(map(int,int,input().split()))
b=[]
ma=max(a)
mi=min(a)
for i in range(b,a+1):
c=0
for j in range(n):
c+=(i-a[j]**2)
b.append(c)
print(min(b))
|
s739525014 | p04025 | u588558668 | 1584367630 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 179 | n=int(input())
a=list(map(int,int,input().split()))
b=[]
ma=max(a)
mi=min(b)
for i in range(b,a+1):
c=0
for j in range(n):
c+=(i-a[j]**2)
b.append(c)
print(min(b))
|
s096264902 | p04025 | u799443198 | 1577628792 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 144 | import math
N, *a = map(int, open(0).read().split())
ave = math.round(sum(a) / N)
ans = 0
for x in a:
ans += (x - ave) * (x - ave)
print(ans)
|
s979081131 | p04025 | u580697892 | 1575466287 | Python | Python (3.4.3) | py | Runtime Error | 40 | 5276 | 275 | # coding: utf-8
from math import ceil
from statistics import median, mean
N = int(input())
A = list(map(int, input().split()))
A.sort()
if N % 2 == 0:
m = ceil((A[N//2] + A[N//2+1]) / 2)
else:
m = A[N//2]
ans = 0
for i in range(N):
ans += (A[i] - m)**2
print(ans) |
s904935755 | p04025 | u977642052 | 1573177322 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3056 | 230 | def main(n, a):
base = (max(a) + min(a)) / 2
ans = 0
for n in a:
ans += (n - base)**2
print(round(ans))
if __name__ == '__main__':
n = int(input())
a = map(int, input().split())
main(n, a)
|
s222752988 | p04025 | u215743476 | 1571530765 | Python | Python (3.4.3) | py | Runtime Error | 38 | 5144 | 154 | from statistics import mean
n = int(input())
a = list(map(int, input().split()))
t = round(mean(a))
sum = 0
for t in a:
sum += (i - t)**2
print(sum) |
s057829753 | p04025 | u543954314 | 1571158650 | Python | PyPy3 (2.4.0) | py | Runtime Error | 180 | 38896 | 345 | n = int(input())
s = len(input())
mod = 10**9+7
dp = [[0]*(n+1) for _ in range(n+1)]
dp[0][0] = 1
for i in range(1,n+1):
dp[i][0] = (dp[i-1][0] + dp[i-1][1])%mod
for j in range(1,min(n,i+1)):
dp[i][j] = (dp[i-1][j-1]*2 + dp[i-1][j+1])%mod
dp[i][n] = dp[i-1][n-1]*2%mod
s2 = pow(2,s,mod)
rev = pow(s2,mod-2,mod)... |
s090009797 | p04025 | u163320134 | 1555962108 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 202 | n=int(input().split())
arr=list(map(int,input().split()))
l=min(arr)
r=max(arr)
ans=10**10
for i in range(l,r+1):
tmp=0
for j in range(n):
tmp+=(arr[j]-i)**2
if tmp<ans:
ans=tmp
print(ans) |
s705055040 | p04025 | u149752754 | 1555616361 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3064 | 245 | N = int(input())
NUM = list(map(int,input().split()))
MAX = max(NUM)
MIN = min(NUM)
COSTLIST = []
for i in range (MIN,MAX):
COST = 0
for j in NUM:
COST += (j-i)**2
COSTLIST.append(COST)
MINIMUM = min(COSTLIST)
print(MINIMUM) |
s877723486 | p04025 | u859897687 | 1554494420 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 159 | n=int(input())
l=[int(input()) for i in range(n)]
s=sum(l)/n
if s-int(s)<int(s)+1-s:
s=int(s)
else:
s=int(s)+1
ans=0
for i in l:
ans+=(s-i)**2
print(ans) |
s372838639 | p04025 | u785578220 | 1547387825 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 529 | #include <iostream>
using namespace std;
int N;
int x[210];
bool t = true;
int s = 0;
int main(){
int ms = 10000000000;
int t = 1;
cin >> N;
for (int i = 0; i < N; ++i)cin >> x[i];
for (int j = -100; j <= x[N-1]; ++j){
s = 0;
for (int i = 0; i < N; ++i){
int p =... |
s160061779 | p04025 | u785989355 | 1541392164 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 182 |
N=int(input())
a=list(map(int,input().split()))
a=np.array(a)
min_s = 10**29
for i in range(201):
s=np.sum((a-np.ones(N)*(i-100))**2)
min_s = min(int(s),min_s)
print(min_s) |
s003888324 | p04025 | u218843509 | 1529731359 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3188 | 340 | MOD = (10 ** 9) + 7
N = int(input())
s = list(input())
dp = [[0 for i in range(N + 1)] for j in range(N + 1)]
for i in range(N + 1):
dp[i][i] = 1
for n in range(1, N + 1):
dp[n][0] = (dp[n - 1][0] + 2 * dp[n - 1][1]) % MOD
for l in range(1, n):
dp[n][l] = (dp[n - 1][l - 1] + 2 * dp[n - 1][l + 1]) % MOD
print... |
s892744835 | p04025 | u218843509 | 1525712740 | Python | PyPy2 (5.6.0) | py | Runtime Error | 36 | 27884 | 376 | MOD = (10 ** 9) + 7
N = int(input())
s = list(input())
dp = [[0 for i in range(N + 1)] for j in range(N + 1)]
for i in range(N + 1):
dp[i][i] = 1
for i in range(N):
dp[i][i + 1] = 1
for n in range(1, N + 1):
dp[n][0] = (dp[n - 1][0] + 2 * dp[n - 1][1]) % MOD
for l in range(1, n):
dp[n][l] = (dp[n - 1][l - 1]... |
s049952429 | p04025 | u766407523 | 1525641627 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 205 | import math
N = int(input())
a = list(map(int, input().split()))
cost = math.inf
for i in range(-100, 101):
temp = 0
for a_i in a:
temp += (a_i-i)**2
cost = min(cost, temp)
print(cost) |
s475318520 | p04025 | u835482198 | 1500852834 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 227 |
N = int(input())
a = map(int, input().split())
total_cost = float('inf')
for n in range(-100, 101):
cost = 0
for i in range(N):
cost += (a[i] - n) ** 2
total_cost = min(total_cost, cost)
print(total_cost) |
s313620186 | p04025 | u357487020 | 1471139619 | Python | PyPy2 (5.6.0) | py | Runtime Error | 63 | 9072 | 506 | s=raw_input()
n=len(s)
cnt=[[0]*26 for _ in xrange(n+1)]
for i in xrange(n):
for j in xrange(26):
cnt[i+1][j]=cnt[i][j]
cnt[i+1][ord(s[i])-ord("a")]+=1
if n==2:
if s[0]==s[1]:
print 1,2
quit()
else:
print -1,-1
quit()
for i in xrange(n):
for j in xrange(i+3,n+... |
s917624038 | p04025 | u813098295 | 1471137748 | Python | Python (2.7.6) | py | Runtime Error | 25 | 2568 | 297 | def cost(n, a, m):
hihumi = 0 #hihumi => 滝本ひふみ
for i in range(n):
hihumi += (a[i] - m) ** 2
return hihumi
N = int(raw_input())
a = map(int, raw_input().split())
ans = 100
for i in range(min(a), max(a) + 1):
if (ans > cost(N, a, i)):
ans = const(N, a, i)
print ans |
s734769666 | p04026 | u706414019 | 1599733908 | Python | Python (3.8.2) | py | Runtime Error | 29 | 8856 | 270 | import collections
s = input()
ls = len(s)
if ls ==2 and s[0]=!s[1]:
print(-1,-1)
elif ls ==2 and s[0]==s[1]:
print(1,2)
for i in range(2,ls):
tmp = collections.Counter(s[i-2:i+1])
if len(tmp.keys())<=2:
print(i-1,i+1)
exit()
print(-1,-1) |
s831116991 | p04026 | u277236383 | 1597275386 | Python | PyPy3 (7.3.0) | py | Runtime Error | 81 | 74736 | 258 | s = input()
l = len(s)
for i in range(l-2):
temp = s[i]
if s[i+1]==temp:
print(str(i+1)+" "+str(i+2))
quit()
if s[i+2]==temp:
print(str(i+1)+" "+str(i+3))
quit()
if s[i+1]==s[i+2]:
print(str(i+2)+ " "+str(i+3))
quit()
print("-1 -1") |
s766264059 | p04026 | u995062424 | 1595635712 | Python | Python (3.8.2) | py | Runtime Error | 56 | 9440 | 340 | from collections import Counter
s = input()
flg = False
lst = []
for i in range(len(s)-2):
if(s[i] == s[i+1]):
flg = True
lst.append(i+1)
lst.append(i+2)
break
elif(s[i] == s[i+2]):
flg = True
lst.append(list(i+1, i+3))
break
if(flg):
print(*lst)
els... |
s408416057 | p04026 | u223646582 | 1591581778 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 186 | s = input()
if s[-2] == s[-1]:
print(len(s)-1, len(s))
exit()
for i in range(s-2):
if s[i] == s[i+1] or s[i] == s[i+2]:
print(i+1, i+3)
exit()
print(-1 - 1)
|
s849200204 | p04026 | u693933222 | 1584065860 | Python | Python (3.4.3) | py | Runtime Error | 53 | 3188 | 261 | s = input()
for i in range(len(s) - 2):
if (s[i] == s[i + 1] or s[i] == s[i + 2]):
print("{} {}".format(i + 1, i + 3))
break
else:
if (s[-2] == s[-1]):
print("{} {}".format(len(n) - 1, len(n)))
else:
print("-1 -1")
|
s458318227 | p04026 | u888100977 | 1583891586 | Python | Python (3.4.3) | py | Runtime Error | 80 | 3188 | 239 | s = input()
# print(s)
for i in range(len(s)-1):
if s[i]==s[i+1]:
print(i+1,i+2)
break
if i<=len(s)-2:
if s[i]==s[i+2]:
print(i+1,i+3)
break
if i == len(s)-3:
print(-1,-1) |
s288542791 | p04026 | u852690916 | 1582763580 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 39536 | 226 | s=input()
for i in range(len(s)):
if i>=1:
if s[i]==s[i-1]:
print(i-1 + ' ' + i)
exit()
if i>=2:
if s[i]==s[i-2]:
print(i-2 + ' ' + i)
exit()
print(-1 -1) |
s535187290 | p04026 | u852690916 | 1582763434 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 39536 | 245 | s=input()
'''
- aa
- aba
'''
for i in range(len(s)):
if i>=1:
if s[i]==s[i-1]:
print(i-1 + ' ' + i)
exit()
if i>=2:
if s[i]==s[i-2]:
print(i-2 + ' ' + i)
exit()
print(-1 -1) |
s133213307 | p04026 | u018679195 | 1580540322 | Python | Python (3.4.3) | py | Runtime Error | 3502 | 3444 | 624 | s=input()
m=[]
flag=0
for i in range(len(s)+1):
for j in range(len(s)+1):
m.append(s[i:j])
for i in range(m.count('')):
m.remove('')
#print(m)
#print(len(m[2]))
for i in range(len(m)):
if len(m[i])>2:
for j in m[i]:
#print(j)
if len(m[i])%2==0:
y=len(m... |
s225240487 | p04026 | u816631826 | 1580539535 | Python | Python (3.4.3) | py | Runtime Error | 2622 | 4164 | 483 | s=input()
m=[]
flag=0
for i in range(len(s)+1):
for j in range(len(s)+1):
m.append(s[i:j])
for i in range(m.count('')):
m.remove('')
print(m)
#print(len(m[2]))
for i in range(len(m)):
if len(m[i])>2:
for j in m[i]:
if j.count()>len(j)/2:
h=j.index()
... |
s039009484 | p04026 | u994988729 | 1579137838 | Python | Python (3.4.3) | py | Runtime Error | 187 | 17088 | 407 | from collections import defaultdict
import numpy as np
S = input()
d = defaultdict(list)
for i, s in enumerate(S):
d[s].append(i + 1)
ans = (-1, -1)
for _, v in d.items():
dif = np.diff(v).tolist()
if 1 in dif:
i = dif.index(1)
ans = (v[i], v[i + 1])
break
elif 2 in dif:
... |
s011292225 | p04026 | u073852194 | 1575168094 | Python | Python (3.4.3) | py | Runtime Error | 63 | 3188 | 178 | s = input()
N = len(s)
for i in range(N-1):
if s[i]==s[i+1]:
print(i+1,i+2)
break
if i<N-1 and s[i]==s[i+2]:
print(i+1,i+3)
else:
print(-1,-1) |
s264992273 | p04026 | u754022296 | 1574369310 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 193 | 入力 = input()
for i in range(len(入力)-1):
if 入力[i]==入力[i+1]:
print(i+1, i+2)
exit()
elif i<n-2 and 入力[i]==入力[i+2]:
print(i+1, i+3)
exit()
print(-1, -1) |
s252469455 | p04026 | u802963389 | 1570885675 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 237 | # a*a と aaの2パターンを探せばよい?
s = input()
n = len(s)
for i in range(n-2):
if s[i] == s[i + 1]:
print(i, i + 1)
exit()
for i in range(n-3):
if s[i] == s[i + 2]:
print(i, i + 2)
exit()
print(-1, -1)
|
s474234331 | p04026 | u672220554 | 1570645531 | Python | Python (3.4.3) | py | Runtime Error | 52 | 3188 | 375 | s=input()
n=len(s)
res = -1
leng = 0
for i in range(n-2):
if s[i] == s[i+1]:
res = i+1
leng = 2
break
elif s[i] == s[i+2]:
res = i+1
leng = 3
break
if s[-2] == s[-1]:
res = i+1
leng = 2
if res == -1:
print("-1 -1")
elif leng == 2:
print(str(res)+"... |
s668548947 | p04026 | u708255304 | 1569422927 | Python | Python (3.4.3) | py | Runtime Error | 68 | 3188 | 324 | S = str(input())
left = -2
right = -2
for i in range(max(1, len(S)-2)):
if S[i] == S[i+1]:
left = i
right = i+1
break
if S[i] == S[i+2]:
left = i
right = i+2
break
if S[i+1] == S[i+2]:
left = i+1
right = i+2
break
print(left+1, right... |
s388626195 | p04026 | u798818115 | 1568081252 | Python | Python (3.4.3) | py | Runtime Error | 62 | 3188 | 303 | # coding: utf-8
# Your code here!
s=input()
judge=True
if s[0]==s[1] or s[1]==s[2] or s[0]==s[1]:
print(0,2)
else:
for i in range(3,len(s)):
if s[i-2]==s[i-1] or s[i-2]==s[i]:
print(i-2,i)
judge=False
break
if judge:
print(-1,-1) |
s872720055 | p04026 | u131666536 | 1557002883 | Python | Python (3.4.3) | py | Runtime Error | 55 | 3188 | 295 | # -*- coding: utf-8 -*-
s = input()
ans = ''
for i in range(len(s)-1):
if s[i] == s[i+1]:
ans = ' '.join([str(i+1), str(i+2)])
for j in range(len(s)-2):
if s[i] == s[i+1] == s[i+2]:
ans = ' '.join([str(i+1), str(i+3)])
if ans:
print(ans)
else:
print('-1 -1')
|
s074655319 | p04026 | u131666536 | 1557002477 | Python | Python (3.4.3) | py | Runtime Error | 55 | 3188 | 408 | # -*- coding: utf-8 -*-
s = input()
double = []
triple = []
for i in range(len(s)-1):
if s[i] == s[i+1]:
double = [str(i+1), str(i+2)]
for j in range(len(s)-2):
if s[i] == s[i+1] == s[i+2]:
triple = [str(i+1), str(i+3)]
if double == [] and triple == []:
print('-1 -1')
else:
i... |
s430118446 | p04026 | u131666536 | 1557002356 | Python | Python (3.4.3) | py | Runtime Error | 55 | 3188 | 388 | # -*- coding: utf-8 -*-
s = input()
double = []
triple = []
for i in range(len(s)-1):
if s[i] == s[i+1]:
double = [str(i+1), str(i+2)]
for j in range(len(s)-2):
if s[i] == s[i+1] == s[i+2]:
triple = [str(i+1), str(i+3)]
if double == [] and triple == []:
print('-1 -1')
elif double... |
s783136015 | p04026 | u131666536 | 1557002094 | Python | Python (3.4.3) | py | Runtime Error | 57 | 3188 | 365 | # -*- coding: utf-8 -*-
s = input()
double = []
triple = []
for i in range(len(s)-1):
if s[i] == s[i+1]:
double = [str(i+1), str(i+2)]
for j in range(len(s)-2):
if s[i] == s[i+1] == s[i+2]:
triple = [str(i+1), str(i+3)]
if double:
print(' '.join(double))
elif triple:
print(' ... |
s430021318 | p04026 | u131666536 | 1557001942 | Python | Python (3.4.3) | py | Runtime Error | 59 | 3188 | 339 | # -*- coding: utf-8 -*-
s = input()
double = []
triple = []
for i in range(len(s)-1):
if s[i] == s[i+1]:
double = [str(i+1), str(i+2)]
if s[i] == s[i+1] == s[i+2]:
triple = [str(i+1), str(i+3)]
if double:
print(' '.join(double))
elif triple:
print(' '.join(triple))
else:
... |
s404089815 | p04026 | u977389981 | 1556405132 | Python | Python (3.4.3) | py | Runtime Error | 41 | 3188 | 192 | S = input()
if S[0] == S[2]:
print(1, 3)
else:
for i in range(1, len(S)):
if S[i] == S[i - 1]:
print(i, i + 1)
break
else:
print(-1, -1) |
s121414412 | p04026 | u785578220 | 1553673243 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38384 | 10 | print(2 3) |
s327489682 | p04026 | u852038767 | 1550129741 | Python | Python (3.4.3) | py | Runtime Error | 1094 | 3956 | 401 | S = list(input())
S.append("A")
for i in range(26):
if S.count(chr(97 + i)) >= 2:
for j in range(len(S) - 1):
if (S[j] == chr(97 + i)) and (S[j + 1] == chr(97 + i)):
print((j+1), (j+2))
exit()
if (S[j] == chr(97 + i)) and (S[j + 2] == chr(97 + i)):
... |
s735419770 | p04026 | u852038767 | 1550129479 | Python | Python (3.4.3) | py | Runtime Error | 1063 | 3956 | 393 | S = list(input())
S.append("A")
for i in range(26):
if S.count(chr(97 + i)) >= 2:
for j in range(len(S) - 1):
if (S[j] == chr(97 + i)) and (S[j + 1] == chr(97 + i)):
print(j+1, j+2)
exit()
if (S[j] == chr(97 + i)) and (S[j + 2] == chr(97 + i)):
... |
s796899639 | p04026 | u852038767 | 1550129054 | Python | Python (3.4.3) | py | Runtime Error | 1035 | 3956 | 391 | S = list(input())
S.append(1)
for i in range(26):
if S.count(chr(97 + i)) >= 2:
for j in range(len(S) - 1):
if (S[j] == chr(97 + i)) and (S[j + 1] == chr(97 + i)):
print(j+1, j+2)
exit()
if (S[j] == chr(97 + i)) and (S[j + 2] == chr(97 + i)):
... |
s333378161 | p04026 | u423585790 | 1547771462 | Python | PyPy3 (2.4.0) | py | Runtime Error | 178 | 39280 | 198 | s = input()
for i in range(len(s)):
if s[i] == s[i + 1] and (s[i + 1] == s[i + 2] or (s[i + 1] != s[i + 2] and s[i + 2] == s[i])):
print(i+1, i + 4)
quit()
print(-1,-1)
|
s986151713 | p04026 | u423585790 | 1547771423 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 39280 | 196 | s = input()
for i in range(len(s)):
if s[i] == s[i + 1] and (s[i + 1] == s[i + 2] or (s[i + 1] != s[i + 2] and s[i + 2] == s[i])):
print(i, i + 3)
quit()
print(-1,-1)
|
s317300108 | p04026 | u337802798 | 1538703869 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 3286 | #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize(3)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("sse3","sse2","sse")
#pragma GCC target("avx","sse4","sse4.1","sse4.2","ssse3")
#pragma GCC target("f16c")
#pragma GCC optimi... |
s324679690 | p04026 | u909643606 | 1506785171 | Python | Python (3.4.3) | py | Runtime Error | 62 | 3188 | 138 | S=input()
a=0
for i in range(len(S)-1):
if S[i]==S[i+1] or S[i]==S[i+2] :
a=1
print(i+1,i+3)
break
if a==0:
print(-1,-1) |
s145844101 | p04026 | u813098295 | 1471144328 | Python | Python (2.7.6) | py | Runtime Error | 28 | 2692 | 449 | # coding: utf-8
def count_char_max(text):
a = "abcdefghijklmnopqrstuvwxyz"
l = [0] * 26
for i in text:
ascNum = ord(i.lower()) - 97
if ascNum < 0 or 25 < ascNum:
continue
l[ascNum] += 1
return max(l)
s = raw_input()
for i in len(s):
if (s[i] == s[i + 1]):
print "%d %d" ... |
s019638442 | p04026 | u237168895 | 1471139763 | Python | Python (3.4.3) | py | Runtime Error | 37 | 3064 | 355 | import re
tar = input()
foo = [0 for i in range(26)]
tmp = "abcdefghijklmnopqrstuvwxyz"
for i in tmp:
b = re.search(i+"."+i,tar)
if b:
print (str(b.start()+1)+” " + str(b.start() + 3))
quit()
b = re.search(str(i)+str(i),tar)
if b:
print (str(b.start()+1)+ " " + str(b.start() + ... |
s506142701 | p04026 | u509661905 | 1471139458 | Python | PyPy3 (2.4.0) | py | Runtime Error | 514 | 51688 | 655 | #!/usr/bin/env pypy3
import collections
import itertools
MAX_S = 100
NO_SOL = (-1, -1)
def is_unbalanced(s):
ctr = collections.Counter(s)
total = sum(ctr.values())
m = max(ctr.values())
return m >= total // 2 + 1
def find_unbalanced_substr(s):
l = len(s)
for start, end in itertools.combin... |
s295566105 | p04026 | u707500405 | 1471138681 | Python | PyPy2 (5.6.0) | py | Runtime Error | 159 | 12272 | 402 | from collections import deque
S = [ord(a)-97 for a in raw_input()]
N = len(S)
for c in xrange(26):
ls = deque()
for i in xrange(N-1):
if S[i] == c:
l = i
break
else:
continue
cnt = 1
for r in xrange(l+1,N):
if S[r] == c:
cnt += 1
ls.append(r)
if cnt * 2 > r - l + 1:
print l+1,r+1
quit(... |
s102782653 | p04026 | u315078622 | 1471137157 | Python | Python (3.4.3) | py | Runtime Error | 228 | 4024 | 275 | import string
S = input()
N = len(S)
assert(len(S) <= 100)
for i in range(N):
for j in range(i, N):
s = S[i:j+1]
if len(s) > 1 and any(s.count(a) * 2 > j-i+1 for a in string.ascii_lowercase):
print(i+1, j+1)
quit(0)
print(-1, -1)
|
s762314167 | p04027 | u368780724 | 1574999688 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38256 | 611 | for _ in range(test_case):
import sys
from itertools import accumulate
readline = sys.stdin.readline
MOD = 10**9+7
N, C = map(int, readline().split())
A = [0] + list(map(int, readline().split()))
B = [0] + list(map(int, readline().split()))
acsq = [list(accumulate([pow(i, j, MOD) for i in range(max(B)+1)])) for j in ... |
s289512363 | p04027 | u892251744 | 1574880737 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2333 | 44012 | 664 | N, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mod = 10**9+7
acc = [[0] for _ in range(401)]
for i in range(401):
for j in range(1, C+2):
acc[i].append(((acc[i][-1] + pow(j, i, mod)) % mod))
dp = [[0 for _ in range(C+1)] for _ in range(N+1)]
dp[0][... |
s550205619 | p04027 | u892251744 | 1574863766 | Python | PyPy3 (2.4.0) | py | Runtime Error | 4209 | 96448 | 634 | N, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mod = 10**9+7
acc = [[0] for _ in range(401)]
for i in range(401):
for j in range(1, C+2):
acc[i].append(acc[i][-1] + j ** i)
dp = [[0 for _ in range(C+1)] for _ in range(N+1)]
dp[0][0] = 1
for i in ra... |
s231205491 | p04027 | u077337864 | 1570885896 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1348 | 43124 | 811 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))
MOD = pow(10, 9) + 7
def main():
n, c = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
assert(a==b)
dp = [[0 for _ in range(c+1)] for _ in range(n+1)]
for i in range(n+1):... |
s781945277 | p04027 | u077337864 | 1570885723 | Python | PyPy3 (2.4.0) | py | Runtime Error | 4207 | 60508 | 747 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))
MOD = pow(10, 9) + 7
def main():
n, c = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
assert(a==b)
dp = [[0 for _ in range(c+1)] for _ in range(n+1)]
for i in range(n+1):... |
s767872777 | p04027 | u077337864 | 1570885117 | Python | PyPy3 (2.4.0) | py | Runtime Error | 4207 | 50560 | 571 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))
MOD = pow(10, 9) + 7
def main():
n, c = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
assert(a==b)
dp = [[0 for _ in range(c+1)] for _ in range(n+1)]
for i in range(n+1):... |
s384905524 | p04027 | u415905784 | 1568649872 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1116 | package main
import (
"fmt"
"math"
)
func max(M *[]int) (ret int) {
ret = (*M)[0]
for _, m := range (*M) {
if ret < m {
ret = m
}
}
return
}
func main() {
var N, C int
fmt.Scan(&N, &C)
A := make([]int, N)
B := make([]int, N)
p := int64(math.Pow(10, 9) + 7)
var x int
for i := 0... |
s832379031 | p04027 | u102461423 | 1562859438 | Python | Python (3.4.3) | py | Runtime Error | 166 | 22044 | 1011 | import sys
input = sys.stdin.readline
import numpy as np
MOD = 10 ** 9 + 7
N,C = map(int,input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
# (i,j) に j^i を入れる
kth_pow = np.ones((1024, 401), dtype=np.int64)
rng = np.arange(401, dtype=np.int64)
for i in range(1,C+1):
kth_p... |
s797412608 | p04027 | u102461423 | 1562859338 | Python | Python (3.4.3) | py | Runtime Error | 167 | 22044 | 1011 | import sys
input = sys.stdin.readline
import numpy as np
MOD = 10 ** 9 + 7
N,C = map(int,input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
# (i,j) に j^i を入れる
kth_pow = np.ones((1024, 401), dtype=np.int64)
rng = np.arange(401, dtype=np.int64)
for i in range(1,C+1):
kth_p... |
s350858596 | p04027 | u726693690 | 1471717852 | Python | Python (3.4.3) | py | Runtime Error | 244 | 12248 | 676 | import numpy as np
import sys
import itertools
# スペース区切りの整数の入力
n, c = [int(i) for i in sys.stdin.readline().split()]
a = [int(i) for i in sys.stdin.readline().split()]
b = [int(i) for i in sys.stdin.readline().split()]
memo = {}
def f_i(x, c):
global memo
if len(x) == 1:
return x[0]**c
if str((... |
s313330535 | p04028 | u218843509 | 1525712752 | Python | PyPy2 (5.6.0) | py | Runtime Error | 38 | 28652 | 376 | MOD = (10 ** 9) + 7
N = int(input())
s = list(input())
dp = [[0 for i in range(N + 1)] for j in range(N + 1)]
for i in range(N + 1):
dp[i][i] = 1
for i in range(N):
dp[i][i + 1] = 1
for n in range(1, N + 1):
dp[n][0] = (dp[n - 1][0] + 2 * dp[n - 1][1]) % MOD
for l in range(1, n):
dp[n][l] = (dp[n - 1][l - 1]... |
s454681828 | p04028 | u218843509 | 1525581986 | Python | Python (3.4.3) | py | Runtime Error | 2124 | 281972 | 364 | MOD = (10 ** 9) + 7
N = int(input())
s = list(input())
dp = [[0 for i in range(N)] for j in range(N)]
for i in range(N):
dp[i][i] = 1
for i in range(N - 1):
dp[i][i + 1] = 1
for n in range(1, N):
dp[n][0] = (dp[n - 1][0] + 2 * dp[n - 1][1]) % MOD
for l in range(1, n):
dp[n][l] = (dp[n - 1][l - 1] + 2 * dp[n ... |
s326128023 | p04028 | u526532903 | 1513795601 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 950 | #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;
const long long M = 1000000007;
//x^n mod M
typedef long long... |
s976082587 | p04029 | u401183062 | 1601222574 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8904 | 160 | def iroha():
count = int(input())
result = 0
for i in range(count+1):
result += i
print(result)
if __name__ == "__main__":
iroha( |
s280702683 | p04029 | u401183062 | 1601222428 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8948 | 121 | count = int(input())
result = 0
for i in range(count+1):
print(i)
result += i
print(result |
s763647030 | p04029 | u847033024 | 1599833494 | Python | Python (3.8.2) | py | Runtime Error | 20 | 8844 | 34 | n = input()
print(n * (n + 1) / 2) |
s268787857 | p04029 | u918422508 | 1599811224 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8892 | 26 | N=input()
print(N*(N+1)/2) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.