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
s231389831
p03761
u106297876
1542155047
Python
Python (3.4.3)
py
Runtime Error
17
2940
311
n = int(input()) S = [] ans = '' for i in range(n): s = list(input()) S.append(s) S[0].sort() for i in range(len(S[0])): if n == 1: ans = ''.join(S[0]) break a = S[0][i] l = 0 for j in range(n - 1): if a in S[j + 1]: S[j + 1].remove(a) l += 1 if l == n - 1: ans += a print(ans)
s161118669
p03761
u123756661
1541292195
Python
Python (3.4.3)
py
Runtime Error
17
3064
332
n=int(input()) s=input() d={} t={} for i in range(ord("a"),ord("z")+1): d[chr(i)]=0 t[chr(i)]=0 for i in s: d[i]+=1 for i in range(n-1): s=input() for j in s: t[j]+=1 for j in t: d[i]=min(d[i],t[i]) for j in s: t[i]=0 ans=[] for i in d: for j in range(d[i]): ans.append(i) ans.sort() x="".join(ans) print(x)
s269217486
p03761
u123756661
1541292006
Python
Python (3.4.3)
py
Runtime Error
17
3064
328
n=int(input()) s=input() d={} t={} for i in range(ord(a),ord(z)+1): d[chr(i)]=0 t[chr(i)]=0 for i in s: d[i]+=1 for i in range(n-1): s=input() for j in s: t[j]+=1 for j in t: d[i]=min(d[i],t[i]) for j in s: t[i]=0 ans=[] for i in d: for j in range(d[i]): ans.append(i) ans.sort() x="".join(ans) print(x)
s622145810
p03761
u711295009
1538531000
Python
Python (3.4.3)
py
Runtime Error
19
3064
576
n = int(input()) listForList=[] index=0 while index < n: listI = list(input()) listI.sort() listForList.append(listI) index+=1 if len(listForList)==1: print("".join(listForList[0])) else: index2=1 pendingL=listForList[0] while index2 < len(listForList): newPL=[] for ch in pendingL: if ch in listForList[index2]: newPL.append(ch) pendingL = newPL if pendingL==[]: print("") break index2+=1 if index2 == len(listForList): print("".join(pendingL))
s990532929
p03761
u711295009
1538530136
Python
Python (3.4.3)
py
Runtime Error
19
3064
776
n = int(input()) listForList=[] index=0 while index < n: listI = list(input()) listI.sort() listForList.append(listI) index+=1 if len(listForList)==1: print("".join(listForList[0])) else: index2=0 pendingL=[] while index2 < len(listForList)-1: if index2 ==0: for c in listForList[index2]: if c in listForList[index2+1]: pendingL.append(c) else: newPL=[] for ch in pendingL: if ch in listForList[index2+1]: newPL.append(ch) pendingL = newPL if pendingL==[]: print("") break index2+=1 if index2 == len(listForList)-1: print("".join(pendingL))
s745975905
p03761
u395086545
1532288278
Python
Python (3.4.3)
py
Runtime Error
25
3772
512
import string from collections import defaultdict n = int(input()) s_list = [input() for i in range(n)] alphabet = string.ascii_lowercase count_dict = defaultdict(int) for c in alphabet: min_count = float("inf") for s in s_list: count = s.count(c) min_count = min(min_count, count) count_dict[c] = min_count final_string = '' for k, v in count_dict.items(): if v == 0: continue else: final_string += k * v final_string = ''.join(list(final_string).sort()) print(final_string)
s410150545
p03761
u858523893
1531672662
Python
Python (3.4.3)
py
Runtime Error
17
3060
456
S_sorted = [] min_len_at = 51 # max min_len_idx = -1 res_arr = [] for i in range(len(S)) : S_sorted.append(sorted(S[i])) if len(S[i]) < min_len_at : min_len_idx = i min_len_at = len(S[i]) for i in S_sorted[min_len_idx] : i_exists = True for j in S_sorted : if i not in j : i_exists = False if i_exists : res_arr.append(i) print("".join(res_arr))
s685887400
p03761
u982762220
1528503722
Python
Python (3.4.3)
py
Runtime Error
17
2940
88
A, B, C = map(int, input().split()) X = int(1e9) + 7 print((A % X) * (B % X) * (C % X))
s241025589
p03761
u557171945
1526327420
Python
PyPy3 (2.4.0)
py
Runtime Error
167
38640
209
n = int(input()) s = [input() for i in range(n)] ans = '' for i in range(97,97+26): count=float("inf") for j in range(n): count=min(count,a[j].count(chr(i))) ans += chr(i)*count print(ans)
s058974020
p03761
u789417951
1514049497
Python
Python (3.4.3)
py
Runtime Error
17
2940
327
from collections import Counter n=int(input()) ans='' counter={} for i in range(1,n+1): if i==1: s=input() counter=Counter() counter=Counter(s) else: s=input() counter=Counter(s)&counter for c in [chr(i) for i in range(ord('a'), ord('z')+1)] ans=ans+c*counter[c] print(ans)
s805393390
p03761
u495415554
1511668995
Python
Python (3.4.3)
py
Runtime Error
22
3444
373
import collections n = int(input()) S = [list(input()) for i in range(n)] Sc = [collections.Counter(i) for i in S] if n == 1: ans = "".join(S[0].sort()) print(ans) else: counter = Sc[0] & Sc[1] for i in range(2, len(Sc)): counter = counter & Sc[i] Sclist = list(counter.elements()) Sclist.sort() ans = "".join(Sclist) print(ans)
s173161060
p03761
u495415554
1511668918
Python
Python (3.4.3)
py
Runtime Error
22
3444
381
import collections n = int(input()) S = [list(input()) for i in range(n)] Sc = [collections.Counter(i) for i in S] if n == 1: ans = "".join(S[0]) ans.sort() print(ans) else: counter = Sc[0] & Sc[1] for i in range(2, len(Sc)): counter = counter & Sc[i] Sclist = list(counter.elements()) Sclist.sort() ans = "".join(Sclist) print(ans)
s945707978
p03761
u495415554
1511668685
Python
Python (3.4.3)
py
Runtime Error
22
3444
318
import collections n = int(input()) S = [list(input()) for i in range(n)] Sc = [collections.Counter(i) for i in S] counter = Sc[0] & Sc[1] for i in range(2, len(Sc)): counter = counter & Sc[i] Sclist = list(counter.elements()) Sclist.sort() ans = "".join(Sclist) if n == 1: print(S[0]) else: print(ans)
s829409631
p03761
u495415554
1511668444
Python
Python (3.4.3)
py
Runtime Error
24
3444
280
import collections n = int(input()) S = [list(input()) for i in range(n)] Sc = [collections.Counter(i) for i in S] counter = Sc[0] & Sc[1] for i in range(2, len(Sc)): counter = counter & Sc[i] Sclist = list(counter.elements()) Sclist.sort() ans = "".join(Sclist) print(ans)
s341207163
p03761
u796424048
1503584831
Python
Python (3.4.3)
py
Runtime Error
17
3064
361
N = int(input()) S = [] for i in range(N): S.append(input()) queue = [] S0len = len(S[0]) for j in range(S0len): flag = [0 for m in range(N-1)] for k in range(1,N): if S[0][j] in S[k]: flag[k] = 1 if sum(flag) == N-1: queue.append(S[0][j]) queue = sorted(queue) res = "".join(queue) print(res)
s303148749
p03761
u796424048
1503584722
Python
Python (3.4.3)
py
Runtime Error
18
3064
364
N = int(input()) S = [] for i in range(N): S.append(input()) queue = [] S0len = len(S[0]) for j in range(S0len): flag = [0 for m in range(S0len)] for k in range(1,N): if S[0][j] in S[k]: flag[k] = 1 if sum(flag) == N-1: queue.append(S[0][j]) queue = sorted(queue) res = "".join(queue) print(res)
s572671173
p03761
u451017206
1501044449
Python
Python (3.4.3)
py
Runtime Error
23
3700
198
from collections import Counter from functools import reduce n=int(input()) print(''.join(sorted(list(reduce(lambda a,b: Counter(a) & Counter(b), [sorted(input()) for i in range(n)]).elements()))))
s191563887
p03761
u846372029
1500434615
Python
Python (3.4.3)
py
Runtime Error
17
3064
248
# 怪文書 / Dubious Document n = int(input()) s=[] for i in range(n): s.append(input()) ans = "" ls = sorted(s[0]) for l in ls: if ( sum([l in s[i+1] for i in range(n-1)])//(n-1) ) : ans += l ls = ls[1:] print(ans)
s767050956
p03761
u846372029
1500434556
Python
Python (3.4.3)
py
Runtime Error
17
3064
265
# 怪文書 / Dubious Document n = int(input()) s=[] for i in range(n): s.append(input()) ans = "" ls = sorted(s[0]) for l in ls: if ( sum([l in s[i+1] for i in range(n-1)])//(n-1) ) : print(l) ans += l ls = ls[1:] print(ans)
s158177983
p03761
u373745856
1493504956
Python
Python (3.4.3)
py
Runtime Error
20
3064
564
n = int(input()) S=[] for i in range(n): S.append(input()) ans = [] #チェックする文字をS[0]から取得 for i in S[0]: #すべてのSについてチェックする文字の存在判定 hantei=[] for j in range(1,n): idx = S[j].find(i) hantei.append(idx) #存在する位置をリストに追加 if idx >= 0: S[j] = S[j][:idx] + S[j][idx+1:] #存在した場合はそれを除去そておく if min(hantei) >= 0: ans.append(i) #辞書順にする ans.sort() #文字列にする ans2 = ''.join(ans) print(ans2)
s305628439
p03761
u373745856
1493503468
Python
Python (3.4.3)
py
Runtime Error
18
3060
442
n = int(input()) S=[] for i in range(n): S.append(input()) ans = [] #チェックする文字をS[0]から取得 for i in S[0]: #すべてのSについてチェックする文字の存在判定 hantei=[] for j in range(1,n): hantei.append(S[j].find(i)) #存在する位置をリストに追加 if min(hantei) >= 0: ans.append(i) #辞書順にする ans.sort() #文字列にする ans2 = ''.join(ans) print(ans2)
s024080261
p03761
u103099441
1492888026
Python
Python (3.4.3)
py
Runtime Error
18
3060
113
n = int(input()) - 1 a = list(input()) while n and a: n -= 1 a = [i for i in a if i in input()] print(a)
s127125160
p03761
u103099441
1492887935
Python
Python (3.4.3)
py
Runtime Error
17
2940
102
n = int(input()) - 1 a = list(input()) while n and a: a = [i for i in a if i in input()] print(a)
s265926482
p03761
u450607115
1492625289
Python
Python (3.4.3)
py
Runtime Error
17
3064
298
import numpy as np n=int(input()) s=[] d=[] for i in range(0,n): a=list(input()) s=d+a d=a d="" s.sort() m=0 for i in range(0,len(s)-1): if s[i] ==s[i+1]: m+=1 if m == n-1: d+=s[i] m=0 else: m=0 print(d)
s643580147
p03761
u450607115
1492613105
Python
Python (3.4.3)
py
Runtime Error
154
12396
279
import numpy as np n=int(input()) s=[] d=[] for i in range(0,n): a=list(input()) s=d+a d=a d="" s.sort() m=0 for i in range(0,len(s)-(n-1)): if s[i] ==s[i+1]: m+=1 if m == n-1: d+=s[i] m=0 print(d)
s518530541
p03761
u450607115
1492613022
Python
Python (3.4.3)
py
Runtime Error
154
12392
263
import numpy as np n=int(input()) s=[] d=[] for i in range(0,n): a=list(input()) s=d+a d=a d="" s.sort() m=0 for i in range(0,len(s)-(n-1)): if s[i] ==s[i+1]: m+=1 if m == n-1: d+=s[i] print(d)
s206291259
p03761
u450607115
1492612026
Python
Python (3.4.3)
py
Runtime Error
150
12392
265
import numpy as np n=int(input()) s=[] d=[] for i in range(0,n): a=list(input()) s=d+a d=a d="" s.sort() m=0 for i in range(0,len(s)-(n-1)): if s[i] ==s[i+1]: m+=1 if m == n-1: d.append(s[i]) print(d)
s611351561
p03761
u374514823
1492564887
Python
Python (3.4.3)
py
Runtime Error
17
3060
308
n = int(input()) alphabet_histgram = [[0 for _ in range(n)] for _ in range(25)] ord_a = ord("a") for i in range(n): S = input() for c in S: alphabet_histgram[ord(c) - ord_a][i] += 1 ret = "" for i, hist_c in enumerate(alphabet_histgram): ret += chr(ord_a + i) * min(hist_c) print(ret)
s001837098
p03761
u450607115
1492561118
Python
Python (3.4.3)
py
Runtime Error
149
12392
225
import numpy as np n=int(input()) s=[] d=[] for i in range(0,n): a=list(input()) s=d+a d=a d="" s.sort() for i in range(0,len(s)-(n-1)): if s[i] ==s[i+n-1]: d.append(s[i]) print(d)
s270699178
p03761
u450607115
1492561037
Python
Python (3.4.3)
py
Runtime Error
148
12420
223
import numpy as np n=int(input()) s=[] d=[] for i in range(0,n): a=list(input()) s=d+a d=a d="" s.sort() for i in range(0,len(s)-(n)): if s[i] ==s[i+n-1]: d.append(s[i]) print(d)
s657606270
p03761
u450607115
1492560920
Python
Python (3.4.3)
py
Runtime Error
150
12392
225
import numpy as np n=int(input()) s=[] d=[] for i in range(0,n): a=list(input()) s=d+a d=a d="" s.sort() for i in range(0,len(s)-(n-1)): if s[i] ==s[i+n-1]: d.append(s[i]) print(d)
s771926157
p03761
u059262067
1492478417
Python
Python (2.7.6)
py
Runtime Error
10
2696
477
a = int(input()) b = [] c = [] ans = "" for i in range(a): b.append(input()) c.append(len(b[i])) print(b[1]) print(min(c)) alpha = [chr(i) for i in range(97,97+26)] print(alpha) if min(c) >= a: for ii in range(26): d = [] for i in range(a): d.append(b[i].count(alpha[ii])) ans = ans + (alpha[ii] * min(d)) if len(ans) > a: break if len(ans) < a: ans = "" else: ans[0:a-1] print(ans)
s573078659
p03761
u059262067
1492478385
Python
Python (3.4.3)
py
Runtime Error
18
3064
477
a = int(input()) b = [] c = [] ans = "" for i in range(a): b.append(input()) c.append(len(b[i])) print(b[1]) print(min(c)) alpha = [chr(i) for i in range(97,97+26)] print(alpha) if min(c) >= a: for ii in range(26): d = [] for i in range(a): d.append(b[i].count(alpha[ii])) ans = ans + (alpha[ii] * min(d)) if len(ans) > a: break if len(ans) < a: ans = "" else: ans[0:a-1] print(ans)
s215447503
p03761
u059262067
1492475840
Python
Python (3.4.3)
py
Runtime Error
17
3064
386
from goto import goto, label a = int(input()) for i in range(a): b[i] = input() c[i] = len(b[i]) alpha = [chr(i) for i in range(97,97+26)] if min(c) < a: ans = "" else: for ii in range(25): for i in range(a): d[i] = b[i].count(alpha[ii]) ans = ans + alpha[ii] * min(d) if len(ans) > a: goto .END label .END
s296827047
p03761
u059262067
1492475169
Python
Python (3.4.3)
py
Runtime Error
17
2940
385
from goto import goto, label a = int(input()) for i in range(a): b[i] = input() c[i] = len(b[i]) alpha = [chr(i) for i in range(97,97+26)] if min(c) < a: ans = "" else for ii in range(25): for i in range(a): d[i] = b[i].count(alpha[ii]) ans = ans + alpha[ii] * min(d) if len(ans) > a: goto .END label .END
s983244377
p03761
u939822134
1492472729
Python
Python (3.4.3)
py
Runtime Error
150
12444
562
import sys import numpy as np import string N = int(input()) S = [input() for i in range(N)] dict = string.ascii_lowercase#abc...xyz data_list = np.zeros((N,26)) for i in range(0,N): list = [] for j in range(0,26): list.append(S[i].count(str(dict[j]))) data_list[i] = np.array(list) data_min = data_list.min(axis = 0) del list gc.collect() a = np.nonzero(data_min) size = np.nonzero(data_min)[0].size b = a[0] kotae = "" for i in range(size): Moji = dict[b[i]]*int(data_min[b[i]]) kotae = kotae + Moji pass del data_min gc.collect() print(kotae)
s880444796
p03761
u322993301
1492395107
Python
Python (3.4.3)
py
Runtime Error
17
3064
628
''' Created on 2017/04/16 @author: admin ''' n = int(input()) S = [input() for i in range(n)] # print(S) # print( S[1].count('d') ) dictionary = "abcdefghijklmnopqrstuvwxyz" # print(len(dictionary)) countS = [] for i in range(3): countS.append([0]*len(dictionary)) # print(countS) for x in range(3): for i, c in enumerate(dictionary): countS[x][i] = S[x].count(c) # print(countS) ans = "" for i in range(len(dictionary)): s0 = countS[0][i] s1 = countS[1][i] s2 = countS[2][i] s = min(s0, s1, s2) if(s > 0): # print(s) ans += dictionary[i] * s print(ans)
s136899889
p03761
u343489490
1492285644
Python
Python (2.7.6)
py
Runtime Error
11
2692
833
#coding:utf-8 input_list = [] min_len =51 input_word_list=[] common_word_list = [] count =0 N = input() for i in range(N): input_word_list.append(sorted(str(raw_input()))) # sort = sorted(input_list[i]) len_sort = len(input_word_list[i]) # モジレツの長さ # print "len",len_sort,sort,input_list if len_sort < min_len: min_len = len_sort # 最小のモジレツの長さ else: pass # print input_list # print flatten(input_list) for j in range(min_len): for i in range(min_len-2): if input_word_list[0][j] == input_word_list[i+1][j]: count += 1 if count == min_len-2: common_word_list.append(input_word_list[0][j]) count = 0 else: pass print "".join(common_word_list)
s752723124
p03761
u343489490
1492284629
Python
Python (2.7.6)
py
Runtime Error
12
2692
781
#coding:utf-8 input_list = [] min_len =51 sort_word_list=[] common_word_list = [] count =0 N = input() for i in range(N): input_list.append(str(raw_input())) sort = sorted(input_list[i]) len_sort = len(sort) # モジレツの長さ if len_sort < min_len: min_len = len_sort # 最小のモジレツの長さ else: pass sort_word_list.append(sort) # sortしたワードを貯める for j in range(min_len): for i in range(min_len-2): if sort_word_list[0][j] == sort_word_list[i+1][j]: count += 1 if count == min_len-2: common_word_list.append(sort_word_list[0][j]) count = 0 else: pass print "".join(common_word_list)
s370746600
p03761
u343489490
1492284385
Python
Python (2.7.6)
py
Runtime Error
11
2692
739
#coding:utf-8 N = input() s = [] min_len =51 sort_word_list=[] common_word_list = [] count =0 for i in range(N): s.append(str(raw_input())) for i in range(N): sort = sorted(s[i]) len_sort = len(sort) # モジレツの長さ if len_sort < min_len: min_len = len_sort # 最小のモジレツの長さ else: pass sort_word_list.append(sort) for j in range(min_len): for i in range(min_len-2): if sort_word_list[0][j] == sort_word_list[i+1][j]: count +=1 if count == min_len-2: common_word_list.append(sort_word_list[0][j]) count =0 else: pass print "".join(common_word_list)
s936504918
p03761
u343489490
1492284221
Python
Python (2.7.6)
py
Runtime Error
14
2940
2011
#coding:utf-8 import itertools from collections import Counter word_select_list =[] word_all_list =[] N = input() s = [] a =0 min_len =50 target =[] word =[] word2 =[] dict2 =sorted(list(itertools.permutations(word_all_list, 3))) count=[] count_a=0 word_list=[] sort_word_list=[] common_word_list = [] for i in range(N): s.append(str(raw_input())) # print "s",s # [a1, a2, a3, ..., aN] for i in range(N): sort = sorted(s[i]) len_sort = len(sort) # モジレツの長さ # print s[i] if len_sort < min_len: min_len = len_sort # 最小のモジレツの長さ # target = s[i] # 文字数が最小のもの else: pass sort_word_list.append(sort) # print sort # print "target",target count =0 # print sort_word_list for j in range(min_len): for i in range(min_len-2): # print "調査",sort_word_list[0][j] if sort_word_list[0][j] == sort_word_list[i+1][j]: count +=1 # print count if count == min_len-2: # if sort_word_list[0][0] == sort_word_list[1][0] and sort_word_list[2][0] == sort_word_list[1][0]: common_word_list.append(sort_word_list[0][j]) count =0 else: pass # print "i",i # print common_word_list print "".join(common_word_list) # counter = Counter(target) # print 'counter',counter # # for word, cnt in counter.most_common(): # word_select_list.append(word) # for i in range(cnt): # word_all_list.append(word) # # print word, cnt # print word_all_list,word_select_list # # print s[0] # for j in range(N): # for i in range(len(word_all_list)): # if word_all_list[i] in s[j]: # print word_all_list[i] # word.append(word_all_list[i]) # # if i == len(word_all_list)-1: # # word2.append(word) # # word2=word # print word # word_list.append(word) # print word_list
s022939679
p03761
u450145303
1491776310
Python
Python (3.4.3)
py
Runtime Error
20
3316
206
from collections import Counter as mset n = int(input()) intersection = input() for i in range(n - 1): intersection = intersection & mset(input()) print(''.join(sorted(list(intersection.elements()))))
s966616877
p03761
u125205981
1491730336
Python
Python (3.4.3)
py
Runtime Error
18
3188
449
def main(): N = int(input()) i = 0 S = [] while i < N: S.append(list(str(input()))) i += 1 i = 0 while i < N - 1: sset = set(S[i]) & set(S[i+1]) i += 2 ans = [] for a in sset: i = 0 n = [] while i < N: n.append(S[i].count(a)) i += 1 small = min(n) ans.append(a * small) ans.sort() print(''.join(ans)) main()
s775667255
p03761
u966667387
1491709035
Python
Python (3.4.3)
py
Runtime Error
20
3064
267
n = int(input()) ans = sorted(list(input())) count = [50 for i in range(len(ans))] s = [list(input()) for i in range(1,n)] for i in range(1,n): for j in range(len(ans)): count[j] = s[i].count(ans[j]) for i in range(len(ans)): ret += ans[j]*count[j] print(ret)
s791113953
p03761
u256823895
1491708177
Python
Python (2.7.6)
py
Runtime Error
12
2696
615
n = int(raw_input()) list_str = [] for count in range(0,n): list_str.append(raw_input()) if n != 1: for count in range(0,n-1): if count == 0: compare1 = set(list_str[count]) else: compare1 = set(output) compare2 = set(list_str[count+1]) output = list(compare1 & compare2) else: output = list_str tmp_output = "" for count1 in range(0,len(output)): for count2 in range(0,n-1): num = list_str[count2].count(output[count1]) if num < min: min = num print min tmp_output += min*output[count1] output = tmp_output #output.sort() output = ''.join(output) print output
s891939177
p03761
u256823895
1491706982
Python
Python (2.7.6)
py
Runtime Error
12
2568
335
n = int(raw_input()) list_str = [] for count in range(0,n): list_str.append(raw_input()) for count in range(0,n-1): if count == 0: compare1 = set(list_str[count]) else: compare1 = set(output) compare2 = set(list_str[count+1]) output = list(compare1 & compare2) output = ''.join(output) print output
s787233745
p03761
u256823895
1491706877
Python
Python (2.7.6)
py
Runtime Error
10
2568
335
n = int(raw_input()) list_str = [] for count in range(0,n): list_str.append(raw_input()) for count in range(0,n-1): if count == 0: compare1 = set(list_str[count]) else: compare1 = set(output) compare2 = set(list_str[count+1]) output = list(compare1 & compare2) output = ''.join(output) print output
s860507655
p03761
u256823895
1491706827
Python
Python (2.7.6)
py
Runtime Error
11
2568
335
n = int(raw_input()) list_str = [] for count in range(0,n): list_str.append(raw_input()) for count in range(0,n-1): if count == 0: compare1 = set(list_str[count]) else: compare1 = set(output) compare2 = set(list_str[count+1]) output = list(compare1 & compare2) output = ''.join(output) print output
s956763418
p03761
u125205981
1491706478
Python
Python (3.4.3)
py
Runtime Error
19
3064
443
def main(): N = int(input()) i = 0 S = [] while i < N: S.append(sorted(list(str(input())))) i += 1 i = 0 while i < N - 1: s = set(S[i]) & set(S[i+1]) i += 2 ans = [] for a in s: i = 0 x = [] while i < N: x.append(S[i].count(a)) i += 1 n = min(x) ans.append(a * n) ans.sort() print(''.join(ans)) main()
s017302557
p03761
u256823895
1491706410
Python
Python (2.7.6)
py
Runtime Error
11
2568
351
n = map(int, raw_input().split()) list_str = [] for count in range(0,int(n[0])): list_str.append(raw_input()) for count in range(0,int(n[0])-1): if count == 0: compare1 = set(list_str[count]) else: compare1 = set(output) compare2 = set(list_str[count+1]) output = list(compare1 & compare2) output = ''.join(output)
s511290043
p03761
u552668967
1491706256
Python
Python (2.7.6)
py
Runtime Error
10
2568
405
from sys import stdin n = int(stdin.readline()) a = [] for _ in xrange(n): s = stdin.readline().strip() di = {} for i in s: di[i] = di.get(i,0) + 1 a.append(di) ans = '' b = 'abcdefghijklmnopqrstuvwxyz' for i in b: x = 10**5 for yy in a: x = min(x, yy.get(i,0)) ans += x*i print ans
s729151738
p03761
u256823895
1491706151
Python
Python (2.7.6)
py
Runtime Error
10
2568
323
n = map(int, raw_input().split()) list_str = [] for count in range(0,n): list_str.append(raw_input()) for count in range(0,n-1): if count == 0: compare1 = set(list_str[count]) else: compare1 = set(output) compare2 = set(list_str[count+1]) output = list(compare1 & compare2) print output
s838408475
p03761
u256823895
1491705609
Python
Python (2.7.6)
py
Runtime Error
10
2568
242
n = map(int, raw_input().split()) list_str = [] for count in range(0,n): list_str.append(raw_input()) import pandas as pd for count in range(0,n-1): out = pd.concat([list_str[count], list_str[count+1]], axis=1, join='inner') print out
s029641032
p03761
u533084327
1491705061
Python
Python (2.7.6)
py
Runtime Error
10
2568
461
mport numpy as np n = input() s = [] for i in range(n): s.append(raw_input()) for i in range(n): s[i] = list(s[i]) s[i].sort() print s #print s[0][1] in s[1] #print len(s[0]) #print s[0][1] #print s[2] count = 0 answer = [] for j in range(len(s[0])): for k in range(1,n): if ''.join(s[k]).find(s[0][j]) != -1: count += 1 if count == n-1: answer.append(s[0][j]) print count count = 0 print ''.join(answer)
s235565810
p03761
u966667387
1491704337
Python
Python (3.4.3)
py
Runtime Error
17
2940
469
n = int(input()) s = [sorted(list(input())) for i in range(n)] rem = s[0] for i in range(1,n): tmp = rem[:] for j in s[i]: try: tmp.remove(j) except: pass for k in tmp: try: rem.remove(k) except: pass print(''.join(rem))
s279701989
p03761
u809670194
1491703967
Python
Python (3.4.3)
py
Runtime Error
17
3060
276
a = input() b = input() c = list(input()) d = list(input()) e = "" for l in b: if l in c: if l in d: e += l c.remove(l) d.remove(l) f = [] for l in e: f.append(l) f.sort() g = "" for i in f: g += i print(g)
s808623461
p03761
u619728370
1491701869
Python
Python (3.4.3)
py
Runtime Error
22
3316
276
from collections import Counter n = int(input()) s0 = list(input()) s1 = list(input()) match = list((Counter(s0) & Counter(s1)).elements()) for i in range(n-2): s = list(input()) match = list((Counter(match) & Counter(s)).elements()) match.sort() print("".join(match))
s559152848
p03761
u809670194
1491701799
Python
Python (3.4.3)
py
Runtime Error
17
3060
211
a = input() b = input() c = input() d = input() e = "" for l in b: if l in c: if l in d: e += l f = [] for l in e: f.append(l) f.sort() g = "" for i in f: g += i print(g)
s203973936
p03761
u481333386
1491701797
Python
Python (3.4.3)
py
Runtime Error
688
3960
402
# -*- coding: utf-8 -*- from string import ascii_lowercase def list_n(): return [int(e) for e in input().split()] def list_s(): return [s for e in input().split()] def main(n, ss): answer = '' for c in ascii_lowercase: answer += c * min([s.count(c) for s in ss]) return answer if __name__ == '__main__': n = int(input()) ss = list_s() print(main(n, ss))
s126328349
p03762
u163783894
1601495893
Python
Python (3.8.2)
py
Runtime Error
165
25296
860
import sys input = sys.stdin.buffer.readline in_n = lambda: int(input()) in_nn = lambda: map(int, input().split()) in_s = lambda: input().rstrip().decode('utf-8') in_map = lambda: [s == ord('.') for s in input() if s != ord('\n')] MOD = 10**9 + 7 INF = 8 * 10**18 def main(): N, M = in_nn() X = list(in_nn()) Y = list(in_nn()) x_tsum = [0] * (N + 1) for i in range(N): x_tsum[i + 1] += x_tsum[i] + X[i] x_tsum[i + 1] %= MOD x_sum = 0 for i in range(1, N): x_sum += X[i] * i - x_tsum[i] x_sum %= MOD y_tsum = [0] * (N + 1) for i in range(M): y_tsum[i + 1] += y_tsum[i] + Y[i] y_tsum[i + 1] %= MOD y_sum = 0 for i in range(1, M): y_sum += Y[i] * i - y_tsum[i] y_sum %= MOD print(x_sum * y_sum % MOD) if __name__ == '__main__': main()
s939412780
p03762
u074220993
1597684536
Python
Python (3.8.2)
py
Runtime Error
93
25288
299
n, m = map(int, input().split()) x = [x for x in map(int, input().split())] y = [y for y in map(int, input().split())] sum_x = 0 sum_y = 0 ans = 0 for i in range(n): sum_x += (2*i - n + 1) * x[i+1] for j in range(m): sum_y += (2*j - m + 1) * y[j+1] ans = sum_x * sum_y print(ans%1000000007)
s932259145
p03762
u345966487
1591141466
Python
PyPy3 (2.4.0)
py
Runtime Error
166
38624
965
import sys sys.setrecursionlimit(10 ** 8) ini = lambda: int(sys.stdin.readline()) inm = lambda: map(int, sys.stdin.readline().split()) inl = lambda: list(inm()) ins = lambda: sys.stdin.readline().rstrip() dbg = lambda *args, **kwargs: print(*args, **kwargs, file=sys.stderr) MOD = 10 ** 9 + 7 N, M = inm() X = inl() Y = inl() assert len(X) == N assert len(Y) == M def solve(): xsum = [0] * N xsum[N - 1] = (X[N - 1] - X[N - 2]) % MOD for k in range(2, N): xsum[N - k] = xsum[N - k + 1] + k * (X[N - k] - X[N - k - 1]) xsum[N - k] %= MOD # for i in range(N): # dbg(f"> {i=} {xsum[i]=}") ysum = [0] * M ysum[M - 1] = (Y[M - 1] - Y[M - 2]) % MOD for k in range(2, M + 1): ysum[M - k] = ysum[M - k + 1] + k * (Y[M - k] - Y[M - k - 1]) ysum[M - k] %= MOD # for j in range(M): # dbg(f"> {j=} {ysum[j]=}") return sum(xsum[1:]) % MOD * (sum(ysum[1:]) % MOD) % MOD print(solve())
s723253686
p03762
u519923151
1589679667
Python
Python (3.4.3)
py
Runtime Error
67
18624
290
n,m = map(int, input().split()) xl = list(map(int, input().split())) yl = list(map(int, input().split())) xsum = sum(xl) ysum = sum(yl) for i in range(n): xi += xsum - xl[i]*(n-i) xsum -= xl[i] for j in range(m): yi += ysum - yl[j]*(m-j) ysum -= yl[j] print(xi*yi)
s976953687
p03762
u519923151
1589679488
Python
Python (3.4.3)
py
Runtime Error
68
18576
279
n,m= input().split() xl = list(map(int, input().split())) yl = list(map(int, input().split())) xsum = sum(xl) ysum = sum(yl) for i in range(n): xi += xsum - xl[i]*(n-i) xsum -= xl[i] for j in range(m): yi += ysum - yl[j]*(m-j) ysum -= yl[j] print(xi*yi)
s424415951
p03762
u174404613
1587692351
Python
Python (3.4.3)
py
Runtime Error
17
2940
1233
#include <bits/stdc++.h> #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = (a); i < (b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define ALL(x) x.begin(), x.end() #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) using namespace std; using ll = long long; using lld = long double; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<ll>; using VVL = vector<VL>; using PII = pair<int, int>; random_device rnd; mt19937 mt(rnd()); const int IINF = 1 << 30; const ll INF = 1ll << 60; const ll MOD = 1e9 + 7; int main() { int n, m; cin >> n >> m; VL x(n), y(m); rep(i, n) cin >> x[i]; rep(i, m) cin >> y[i]; sort(ALL(x)); sort(ALL(y)); ll sx = 0; rep(i, n) { sx += MOD * n + i * x[i]; sx %= MOD; sx -= (MOD * n + (n - 1 - i) * x[i]) % MOD; while (sx < 0) sx += MOD; } ll sy = 0; rep(i, m) { sy += MOD * m + i * y[i]; sy %= MOD; sy -= (MOD * m + (m - 1 - i) * y[i]) % MOD; while (sy < 0) sy += MOD; } cout << (sx * sy) % MOD << endl; ; return 0; }
s696674137
p03762
u600402037
1582236929
Python
Python (3.4.3)
py
Runtime Error
1408
26148
431
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) MOD = 10 ** 9 + 7 n, m = lr() X = np.array(lr()) Y = np.array(lr()) x_len = X[1:] - X[:-1] y_len = Y[1:] - Y[:-1] square = x_len[:, None] * y_len[None, :] answer = 0 for i in range(n-1): answer += (square[i] % MOD).sum() answer %= MOD answer *= (n-1) * (m-1) print(answer%MOD) # 43
s421122863
p03762
u600402037
1582236636
Python
Python (3.4.3)
py
Runtime Error
209
24048
368
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) MOD = 10 ** 9 + 7 n, m = lr() X = np.array(lr()) Y = np.array(lr()) x_len = X[1:] - X[:-1] y_len = Y[1:] - Y[:-1] square = x_len[:, None] * y_len[None, :] % MOD answer = (n-1) * (m-1) * square.sum() % MOD print(answer%MOD) # 43
s527187682
p03762
u623687794
1575486730
Python
Python (3.4.3)
py
Runtime Error
192
18576
255
n,m=map(int,input().split()) a=list(map(int,input().split())) b=list(map(int,input().split())) X=0;Y=0 mod=10**9+7 for i in range(n-1): X+=(a[i+1]-a[i])*(i+1)*(n-i-1) X%=mod for i in range(n-1): Y+=(b[i+1]-b[i])*(i+1)*(n-i-1) Y%=mod print(X*Y%mod)
s976617530
p03762
u504836877
1574902563
Python
PyPy3 (2.4.0)
py
Runtime Error
294
87524
507
n,m = map(int, input().split()) X = [int(x) for x in input().split()] Y = [int(y) for y in input().split()] mod = 10**9+7 Xd = [] for i in range(n-1): Xd.append(X[i+1]-X[i]) Yd = [] for i in range(m-1): Yd.append(Y[i+1]-Y[i]) Xd[1] = 2*Xd[0] + 2*Xd[1] for i in range(n-3): Xd[i+2] = 2*Xd[i+1] - Xd[i] + (i+3)*Xd[i+2] Xd[i+2] %= mod Yd[1] = 2*Yd[0] + 2*Yd[1] for i in range(m-3): Yd[i+2] = 2*Yd[i+1] - Yd[i] + (i+3)*Yd[i+2] Yd[i+2] %= mod print(Xd[-1]*Yd[-1]%mod)
s860515173
p03762
u865741247
1568348858
Python
PyPy3 (2.4.0)
py
Runtime Error
288
94428
442
n,m =list(map(int,input().split(" "))) xs =list(map(int,input().split(" "))) ys =list(map(int,input().split(" "))) MOD = (10**9) + 7 x_diff = [abs(i - j) for i,j in zip(xs[:n-1],xs[1:n]) ] y_diff = [abs(i - j) for i,j in zip(ys[:n-1],ys[1:n]) ] cot = 1 x = 0 for i in range(n -1 ): x +=cot * (n-i -1) * x_diff[i] cot += 1 cot = 1 y = 0 for i in range(m -1): y += cot * (m-i -1) * y_diff[i] cot += 1 print (x* y % MOD )
s452387377
p03762
u263830634
1566869487
Python
Python (3.4.3)
py
Runtime Error
216
18752
741
MOD = 10 ** 9 + 7 n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) # 前計算 for i in range(n - 1): x[i] = x[i + 1] - x[i] for i in range(m - 1): y[i] = y[i + 1] - y[i] N = [n - 1] for i in range((n)//2 - 1): N.append((N[i] + (n - 1 - 2 * (i + 1))) % MOD) M = [m - 1] for i in range((m)//2 - 1): M.append((M[i] + (m - 1- 2 * (i + 1))) % MOD) if N[0] % 2 == 0: N += N[::-1] elif N[0] != 1: N += N[1::-1] if M[0] % 2 == 0: M += M[::-1] elif M[0] != 1: M += M[1::-1] X_sum = 0 for i in range(n - 1): X_sum += x[i] * N[i] X_sum %= MOD Y_sum = 0 for i in range(m - 1): Y_sum += y[i] * M[i] Y_sum %= MOD print ((X_sum * Y_sum) % MOD)
s973383098
p03762
u263830634
1566869186
Python
Python (3.4.3)
py
Runtime Error
578
27260
1089
MOD = 10 ** 9 + 7 import numpy as np n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) # 前計算 for i in range(n - 1): x[i] = x[i + 1] - x[i] for i in range(m - 1): y[i] = y[i + 1] - y[i] N = [n - 1] for i in range((n)//2 - 1): N.append((N[i] + (n - 1 - 2 * (i + 1))) % MOD) M = [m - 1] for i in range((m)//2 - 1): M.append((M[i] + (m - 1- 2 * (i + 1))) % MOD) if N[0] % 2 == 0: N += N[::-1] elif N[0] != 1: N += N[1::-1] if M[0] % 2 == 0: M += M[::-1] elif M[0] != 1: M += M[1::-1] # print (N) # print (M) N = np.array(N, dtype = 'int64') M = np.array(M, dtype = 'int64') X = np.array(x[:-1], dtype = 'int64') Y = np.array(y[:-1], dtype = 'int64') # print (N) # print (M) # print (X) # print (Y) X *= N Y *= M X %= MOD Y %= MOD # print (X) # print (Y) # print ((np.sum(X) * np.sum(Y)) % MOD) # X_sum = np.sum(X) % MOD # Y_sum = np.sum(Y) % MOD X_sum = 0 for i in X: X_sum += i X_sum %= MOD Y_sum = 0 for i in Y: Y_sum += i Y_sum %= MOD print ((X_sum * Y_sum) % MOD)
s561190468
p03762
u263830634
1566868974
Python
Python (3.4.3)
py
Runtime Error
325
27260
975
MOD = 10 ** 9 + 7 import numpy as np n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) # 前計算 for i in range(n - 1): x[i] = x[i + 1] - x[i] for i in range(m - 1): y[i] = y[i + 1] - y[i] N = [n - 1] for i in range((n)//2 - 1): N.append((N[i] + (n - 1 - 2 * (i + 1))) % MOD) M = [m - 1] for i in range((m)//2 - 1): M.append((M[i] + (m - 1- 2 * (i + 1))) % MOD) if N[0] % 2 == 0: N += N[::-1] elif N[0] != 1: N += N[1::-1] if M[0] % 2 == 0: M += M[::-1] elif M[0] != 1: M += M[1::-1] # print (N) # print (M) N = np.array(N, dtype = 'int64') M = np.array(M, dtype = 'int64') X = np.array(x[:-1], dtype = 'int64') Y = np.array(y[:-1], dtype = 'int64') # print (N) # print (M) # print (X) # print (Y) X *= N Y *= M X %= MOD Y %= MOD # print (X) # print (Y) # print ((np.sum(X) * np.sum(Y)) % MOD) X_sum = np.sum(X) % MOD Y_sum = np.sum(Y) % MOD print ((X_sum * Y_sum) % MOD)
s047839972
p03762
u263830634
1566868715
Python
Python (3.4.3)
py
Runtime Error
314
27260
955
MOD = 10 ** 9 + 7 import numpy as np n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) # 前計算 for i in range(n - 1): x[i] = x[i + 1] - x[i] for i in range(m - 1): y[i] = y[i + 1] - y[i] N = [n - 1] for i in range((n)//2 - 1): N.append((N[i] + (n - 1 - 2 * (i + 1))) % MOD) M = [m - 1] for i in range((m)//2 - 1): M.append((M[i] + (m - 1- 2 * (i + 1))) % MOD) if N[0] % 2 == 0: N += N[::-1] else: N += N[1::-1] if M[0] % 2 == 0: M += M[::-1] else: M += M[1::-1] # print (N) # print (M) N = np.array(N, dtype = 'int64') M = np.array(M, dtype = 'int64') X = np.array(x[:-1], dtype = 'int64') Y = np.array(y[:-1], dtype = 'int64') # print (N) # print (M) # print (X) # print (Y) X *= N Y *= M X %= MOD Y %= MOD # print (X) # print (Y) # print ((np.sum(X) * np.sum(Y)) % MOD) X_sum = np.sum(X) % MOD Y_sum = np.sum(Y) % MOD print ((X_sum * Y_sum) % MOD)
s699437832
p03762
u502389123
1565098103
Python
Python (3.4.3)
py
Runtime Error
193
18576
357
n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) mod = 10 ** 9 + 7 x_sum = 0 for i in range(n-1): x_sum += (x[i+1] - x[i]) * (i + 1) * (n - i - 1) x_sum %= mod y_sum = 0 for i in range(n-1): y_sum += (y[i+1] - y[i]) * (i + 1) * (n - i - 1) y_sum %= mod print((x_sum * y_sum) % mod)
s796423829
p03762
u456353530
1562711216
Python
Python (3.4.3)
py
Runtime Error
182
26980
498
def exe(x, y): X = [0] * x Y = [0] * y for i in range(x): X[i] = (i + 1) * (x - i) * a[i] % MOD for i in range(y): Y[i] = (i + 1) * (y - i) * b[i] % MOD print((sum(X) % MOD) * (sum(Y) % MOD) % MOD) n, m = list(map(int, input().split())) x = list(map(int, input().split())) y = list(map(int, input().split())) MOD = 10 ** 9 + 7 a = [0] * (n - 1) for i in range(n - 1): a[i] = x[i + 1] - x[i] b = [0] * (n - 1) for i in range(m - 1): b[i] = y[i + 1] - y[i] exe(n - 1, m - 1)
s286163550
p03762
u623819879
1561615353
Python
PyPy3 (2.4.0)
py
Runtime Error
294
83044
235
mo=10**9+7 n,m=map(int,input().split()) x=[int(i) for i in input().split()] y=[int(i) for i in input().split()] X,Y=0,0 for i in range(n): X+=x[i]*(n-2*i-1) X%=mo for i in range(n): Y+=y[i]*(n-2*i-1) Y%=mo print(X*Y%mo)
s507349327
p03762
u099566485
1539633319
Python
Python (3.4.3)
py
Runtime Error
148
18556
211
n,m=map(int,input().split()) x=list(map(int,input().split())) y=list(map(int,input().split())) sx=0 sy=0 for i in range(n): sx+=i*x[i]-(n-i-1)*x[i] for i in range(n): sy+=i*y[i]-(n-i-1)*y[i] print(sx*sy)
s544109160
p03762
u690536347
1536266142
Python
Python (3.4.3)
py
Runtime Error
149
18556
219
n,m=map(int,input().split()) *x,=map(int,input().split()) *y,=map(int,input().split()) mod=10**9+7 vx,vy=0,0 for i in range(n): vx+=(i*x[i]-(n-i-1)*x[i]) for j in range(m): vy+=(j*x[j]-(m-j-1)*x[j]) print(vx*vy%mod)
s669914356
p03762
u327248573
1525370398
Python
Python (3.4.3)
py
Runtime Error
405
28920
693
import numpy n, m = map(int, input().split(' ')) line_x = list(map(int, input().split(' '))) line_y = list(map(int, input().split(' '))) masu_x = [n-1] masu_y = [m-1] for i in range(1, n-1): masu_x.append(masu_x[i-1] + n - 1 - 2 * i) for i in range(1, m-1): masu_y.append(masu_y[i-1] + m - 1 - 2 * i) masu_x = numpy.mat(masu_x) masu_y = numpy.mat(masu_y) masu_multi = numpy.dot(masu_y.T, masu_x) masu_area = numpy.zeros(tuple(masu_multi.shape)) for i in range(n-1): for j in range(m-1): masu_area[j][i] = ((line_x[i+1] - line_x[i]) * (line_y[j+1] - line_y[j])) % 1000000007 print(int(numpy.sum(numpy.array(masu_multi) * numpy.flipud(masu_area) % 1000000007) % 1000000007))
s917502571
p03762
u327248573
1525370305
Python
Python (3.4.3)
py
Runtime Error
401
28824
688
import numpy n, m = map(int, input().split(' ')) line_x = list(map(int, input().split(' '))) line_y = list(map(int, input().split(' '))) masu_x = [n-1] masu_y = [m-1] for i in range(1, n-1): masu_x.append(masu_x[i-1] + n - 1 - 2 * i) for i in range(1, m-1): masu_y.append(masu_y[i-1] + m - 1 - 2 * i) masu_x = numpy.mat(masu_x) masu_y = numpy.mat(masu_y) masu_multi = numpy.dot(masu_y.T, masu_x) masu_area = numpy.zeros(tuple(masu_multi.shape)) for i in range(n-1): for j in range(m-1): masu_area[j][i] = ((line_x[i+1] - line_x[i]) * (line_y[j+1] - line_y[j])) % 1000000007 print(numpy.sum(numpy.array(masu_multi) * numpy.flipud(masu_area) % 1000000007) % 1000000007)
s951468363
p03762
u562016607
1524783589
Python
Python (3.4.3)
py
Runtime Error
163
19580
240
N,M=map(int,input().split()) x=[int(i) for i in input().split()] y=[int(i) for i in input().split()] P=10**9+7 X=0 Y=0 for i in range(1,M+1): X+=x[i-1]*(2*i-1-M) X=X%P for j in range(1,N+1): Y+=y[j-1]*(2*j-1-N) Y=Y%P print((X*Y)%P)
s366603656
p03762
u846150137
1521334528
Python
Python (3.4.3)
py
Runtime Error
295
29336
429
import numpy as np n,m=[int(i) for i in input().split()] x=[int(i) for i in input().split()] y=[int(i) for i in input().split()] def kk(z): zk=[] zi=z[0] ns=0 nl=len(z) for i in z: if zi!=i: zk.append(abs(i-zi) *(ns*(nl-ns))% (10**9 + 7)) zi=i ns+=1 return zk nx=np.array(kk(x), dtype = 'int64').reshape(len(x)-1,1) ny=np.array(kk(y), dtype = 'int64') nxy=nx*ny print((nxy.sum()) % (10**9 + 7))
s653054719
p03762
u590048048
1517263550
Python
Python (3.4.3)
py
Runtime Error
220
19120
632
n, m = list(map(int, input().split())) xs = list(map(int, input().split())) ys = list(map(int, input().split())) MODULO = 10**9 +7 def MSum(x, y): return (x + y) % MODULO def MPro(x, y): return (x * y) % MODULO def foo(zs, k): s = 0 for i in range(k): s = MSum(s, MPro(MPro(zs[i], k-i), i+1)) return s def diff(zs, k): previous = None rs = [0] * (k-1) for i, z in enumerate(zs): if i == 0: previous = z continue rs[i-1] = z - previous previous = z return rs dx = diff(xs, n) dy = diff(ys, n) print(MPro(foo(dx, n-1), foo(dy, m-1)))
s611919767
p03762
u343437894
1499487200
Python
Python (3.4.3)
py
Runtime Error
17
3064
383
n, m = map(int, input().split(" ")); xs = list(map(int, input().split(" "))); ys = list(map(int, input().split(" "))); modula=1000000007 sumx=0; sumy=0; answer=0; for i in range(0, n-1): for j in range(i+1, n): for k in range(0, m-1): for l in range(k+1, m): answer = (((xs[j]-xs[i])%modula) * (ys[l]-ys[k])%modula)) % modula print(answer);
s512149192
p03762
u343437894
1499487165
Python
Python (3.4.3)
py
Runtime Error
17
3064
383
n, m = map(int, input().split(" ")); xs = list(map(int, input().split(" "))); ys = list(map(int, input().split(" "))); modula=1000000007 sumx=0; sumy=0; answer=0; for i in range(0, n-1): for j in range(i+1, n): for i in range(0, m-1): for j in range(i+1, m): answer = (((xs[j]-xs[i])%modula) * (ys[j]-ys[i])%modula)) % modula print(answer);
s862624764
p03762
u343437894
1499485648
Python
Python (3.4.3)
py
Runtime Error
36
19452
349
n, m = map(int, input().split(" ")); xs = map(int, input().split(" ")); ys = map(int, input().split(" ")); sumx=0; for i in range(0, n-1): for j in range(i+1, n): sumx += (xs[j]-xs[i]) % 1000000007 sumy=0; for i in range(0, m-1): for j in range(i+1, m): sumx += (ys[j]-ys[i]) % 1000000007 print((sumx*sumy) % 1000000007)
s895414213
p03762
u103099441
1492888877
Python
Python (3.4.3)
py
Runtime Error
17
3060
134
n = int(input()) - 1 a = sorted(list(input())) while n: c = input() a = [i for i in a if i in c] n -= 1 print(''.join(a))
s382699840
p03762
u059262067
1492548075
Python
Python (3.4.3)
py
Runtime Error
67
21824
443
a = map(int,input().split(" ")) b = map(int,input().split(" ")) c = map(int,input().split(" ")) bs = sorted(b) cs = sorted(c) x = 0 f = range(a[0]) g = range(a[1]) for i in range(a[0]): for ii in range(i,a[0]): for j in range(a[1]): for jj in range(j,a[1]): x = x + ((bs[ii] - bs[i]) * (cs[jj] - cs[j])) if x > (10**9 + 7): x = x % (10**9 + 7) ans = x print(ans)
s553672678
p03762
u059262067
1492548006
Python
Python (3.4.3)
py
Runtime Error
67
21824
503
a = map(int,input().split(" ")) b = map(int,input().split(" ")) c = map(int,input().split(" ")) bs = sorted(b) cs = sorted(c) x = 0 f = range(a[0]) g = range(a[1]) for i in range(a[0]): for ii in range(i,a[0]): for j in range(a[1]): for jj in range(j,a[1]): x = x + ((bs[ii] - bs[i]) * (cs[jj] - cs[j])) print(bs[ii] , bs[i] , cs[jj] , cs[j] , x) if x > (10**9 + 7): x = x % (10**9 + 7) ans = x print(ans)
s608614321
p03762
u059262067
1492481914
Python
Python (3.4.3)
py
Runtime Error
50
19452
217
a = map(int,input().split()) b = map(int,input().split()) c = map(int,input().split()) d = max(b)- min(b) e = max(c)- min(c) f = sum(range(a[0])) g = sum(range(a[1])) ans = (d * e * f * g) % (10**9 + 7) print(ans)
s274216047
p03762
u059262067
1492481844
Python
Python (3.4.3)
py
Runtime Error
50
19472
226
a = map(int,input().split(" ")) b = map(int,input().split(" ")) c = map(int,input().split(" ")) d = max(b)- min(b) e = max(c)- min(c) f = sum(range(a[0])) g = sum(range(a[1])) ans = (d * e * f * g) % (10**9 + 7) print(ans)
s035914166
p03762
u059262067
1492481793
Python
Python (3.4.3)
py
Runtime Error
57
19452
249
a = map(int,input().split(" ")) b = map(int,input().split(" ")) c = map(int,input().split(" ")) d = max(b)- min(b) e = max(c)- min(c) f = sum(range(a[0])) g = sum(range(a[1])) ans = (d * e * f * g) % (10**9 + 7) print( (10**9 + 7)) print(ans)
s919740350
p03762
u049595114
1491781203
Python
Python (3.4.3)
py
Runtime Error
2122
298236
504
num = input().split(" ") vertical = list(map(int, input().split())) horizontal = list(map(int, input().split())) xlen = list() ylen = list() temp = 0 a = int(num[0]) b = int(num[1]) for i in range(a): for j in range(1, a - i): xlen.append(abs(vertical[i] - vertical[a - j])) for i in range(b): for j in range(1, b - i): ylen.append(abs(horizontal[i] - horizontal[a - j])) for i in range(len(xlen)): for j in range(len(ylen)): temp += xlen[i] * ylen[j] ans = temp % (10**9 + 7) print(ans)
s404552204
p03762
u049595114
1491781098
Python
Python (3.4.3)
py
Runtime Error
2124
303612
529
num = input().split(" ") vertical = list(map(int, input().split())) horizontal = list(map(int, input().split())) xlen = list() ylen = list() temp = 0 a = int(num[0]) b = int(num[1]) for i in range(a): for j in range(1, a - i): xlen.append(abs(vertical[i] - vertical[a - j])) for i in range(b): for j in range(1, b - i): ylen.append(abs(horizontal[i] - horizontal[a - j])) print(xlen) print(ylen) for i in range(len(xlen)): for j in range(len(ylen)): temp += xlen[i] * ylen[j] ans = temp % (10**9 + 7) print(ans)
s687512139
p03762
u049595114
1491755412
Python
Python (3.4.3)
py
Runtime Error
17
3068
40
num = input().split().int() print(num)
s140765335
p03762
u966667387
1491711153
Python
Python (3.4.3)
py
Runtime Error
17
2940
230
in1 = list(input().split()) nx = in[0] ny = in[y] x = list(input().split()) y = list(input().split()) lx = sum([ x[i]*(2*i - x - 1) for i in range(nx) ]) ly = sum([ y[i]*(2*i - x - 1) for i in range(ny) ]) print(lx*ly%(10**9 + 7))
s889725877
p03762
u432042540
1491707471
Python
Python (3.4.3)
py
Runtime Error
2135
501428
545
n, m = input().split() n = int(n) m = int(m) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] s = 0 map = [[0 for i in range(n)] for j in range(m)] yokomap = [0] * n tatemap = [0] * m for i in range(n-1): for j in range(m-1): yokomap = (i+1) * (n-1-i) tatemap = (j+1) * (m-1-j) map[i][j] = yokomap * tatemap for i in range(n-1): for j in range(m-1): yoko = x[i+1] - x[i] tate = y[j+1] - y[j] s += yoko * tate * map[i][j] s %= (10**9 + 7) print(s)
s158941691
p03762
u432042540
1491706939
Python
Python (3.4.3)
py
Runtime Error
2135
492156
536
n, m = input().split() n = int(n) m = int(m) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] s = 0 map = [[0 for i in range(n)] for j in range(m)] yokomap = [0] * n tatemap = [0] * m for i in range(n-1): for j in range(m-1): yokomap = (i+1) * (n-1-i) tatemap = (j+1) * (m-1-j) map[i][j] = yokomap * tatemap for i in range(n-1): for j in range(m-1): yoko = x[i+1] - x[i] tate = y[j+1] - y[j] s += yoko * tate * map[i][j] s %= (10**9 + 7) print(s)
s239936098
p03762
u777923818
1491706670
Python
Python (3.4.3)
py
Runtime Error
358
24060
860
# -*- coding: utf-8 -*- import numpy as np from numpy import array, matrix N, M = [int(n) - 1 for n in input().split()] pre_x_ = array([int(n) for n in input().split()]) pre_y_ = array([int(n) for n in input().split()]) x_ = pre_x_[1:N+1] - pre_x_[0:N] y_ = pre_y_[1:M+1] - pre_y_[0:M] x_length_arr = np.zeros(int(N * (N+1)/2)) y_length_arr = np.zeros(int(M * (M+1)/2)) x_past_sets = np.zeros(N) y_past_sets = np.zeros(M) for n in range(N): x_past_sets += array([x_[n]]*(n+1) + [0] * (N-n-1)) x_length_arr[int(n*(n+1)/2):int((n+1)*(n+2)/2)] = x_past_sets[0:n+1] for m in range(M): y_past_sets += array([y_[m]]*(m+1) + [0] * (M-m-1)) y_length_arr[int(m*(m+1)/2):int((m+1)*(m+2)/2)] = y_past_sets[0:m+1] x_length_mat = matrix(x_length_arr) y_length_mat = matrix(y_length_arr) print(int((x_length_mat.T.dot(y_length_mat)).sum()%(10**9+7)))