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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s512267845 | p03816 | u731368968 | 1575221708 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 594 | #1,1,1 -> (1,1) 1
#1,2,3 -> (1,3) 2
#1,1,3 -> (1,3) 1 <=> 1,1,3,3 -> (1,3) 1,3
#1,2,1,3,7 == [1:2, 2:1, 3:1, 7:1]
#[1:4, 2:3, 3:2, 5:1, 6:2, 8:2, 11:1]
#それぞれ1または2と等しい
#[1:2, 2:1, 3:2, 5:1, 6:2, 8:2, 11:1]
#[1,1,3,3,6,6,8,8]
#[1,1,3,6,6,8,8]
#[1,3,6,8]
N = int(input())
A = list(map(int, input().split()))
B = [-1 f... |
s809788055 | p03816 | u109617108 | 1574221824 | Python | PyPy3 (2.4.0) | py | Runtime Error | 216 | 58796 | 97 | N=int(input())
A=list(map(int,input().split()))
m=set(A)
if m%2==0:
print(m-1)
else:
print(m) |
s063213447 | p03816 | u256464928 | 1574132008 | Python | Python (3.4.3) | py | Runtime Error | 71 | 18656 | 450 | from collections import Counter
import math
N = int(input())
A = list(map(int,input().split()))
R = []
T = []
C = Counter(A)
cnt = 0
for c in C.items():
if c[1] > 1:
cnt += c[1] - 1
T.append(c[0])
else:
R.append(c[0])
Max_R = max(T)
Min_R = min(T)
flg = False
for r in R:
if Min_R <= r <= Max_R:
fl... |
s301690111 | p03816 | u614875193 | 1573060947 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14004 | 376 | N=int(input())
A=list(map(int,input().split()))
A.sort()
S=[]
D=[]
for i in A:
if i in S:
D.append(i)
else:
S.append(i)
#print(D)
M=N-len(D)
if len(D)%2==1:
print(M-1)
else:
MaxD,MinD=max(D),min(D)
Med=-1
for i in S:
if MinD<=i<=MaxD:
Med=i
print... |
s175509118 | p03816 | u023229441 | 1570264651 | Python | Python (3.4.3) | py | Runtime Error | 2057 | 141044 | 204 | n=int(input())
def cut(list):
return [list[1]]
A=sorted(list(map(int,input().split())))
i=0
while i<=len(A)-3:
if A[i]==A[i+1]:
del A[i]
del A[i+2]
else:
i+=1
print(A)
print(len(A))
|
s451047277 | p03816 | u654470292 | 1570072734 | Python | PyPy3 (2.4.0) | py | Runtime Error | 329 | 65256 | 520 | import sys
import collections
import heapq
def input():
return sys.stdin.readline()[:-1]
n=int(input())
a=list(map(int,input().split()))
tmp=collections.Counter(a)
b=list(tmp.values())
b=list(map(lambda x:x*-1, b))
heapq.heapify(b)
ans=0
while 1:
cnt1=heapq.heappop(b)
if cnt1==-1:
break
cnt2=... |
s170047998 | p03816 | u994988729 | 1568841133 | Python | Python (3.4.3) | py | Runtime Error | 110 | 21460 | 611 | import bisect
from collections import Counter
n=int(input())
a=list(map(int, input().split()))
c=list(Counter(a).items())
c=[i[1]-1 for i in sorted(c)]
u=0
l=len(c)-1
ans=0
while True:
if c[u]>c[l]:
ans += c[l]
c[u] -= c[l]
c[l] = 0
l -= 1
elif c[u]<c[l]:
ans += c[u]
... |
s229433244 | p03816 | u695429668 | 1567897045 | Python | Python (3.4.3) | py | Runtime Error | 127 | 18656 | 372 | from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
d = defaultdict(int)
for i in range(N):
d[A[i]] += 1
ans = 0
se = 0
dd = [0 for i in range(3)]
for k, v in d.items():
value = v // 3 + (v % 3)
dd[value] += 1
if value % 3 == 0 or value % 3 == 1:
ans += 1... |
s678971402 | p03816 | u614314290 | 1566409002 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 1345 | import sys
sys.setrecursionlimit(1_000_000)
from math import factorial, ceil, floor
from bisect import bisect_right as bsr
from operator import itemgetter as ig
from collections import defaultdict as dd
from collections import deque
# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def input(*ps):
if type(ps... |
s411292409 | p03816 | u903215911 | 1563732610 | Python | Python (3.4.3) | py | Runtime Error | 140 | 18272 | 511 | N = int(input())
A = list(map(int, input().split()))
# print(A)
cnt = {}
for a in A:
if a not in cnt:
cnt[a] = 1
else:
cnt[a] += 1
s, e = 1, 100000
while True:
while (s not in cnt or cnt[s] <= 1) and s < e:
s += 1
while (e not in cnt or cnt[e] <= 1) and s < e:
e -= 1
if e < s:
break
i... |
s603498172 | p03816 | u903215911 | 1563732467 | Python | Python (3.4.3) | py | Runtime Error | 128 | 17396 | 478 | N = int(input())
A = list(map(int, input().split()))
# print(A)
cnt = {}
for a in A:
if a not in cnt:
cnt[a] = 1
else:
cnt[a] += 1
s, e = 1, 100000
while True:
while (s not in cnt or cnt[s] <= 1) and s < e:
s += 1
while (e not in cnt or cnt[e] <= 1) and s < e:
e -= 1
if e < s:
break
i... |
s765025799 | p03816 | u074402558 | 1559348373 | Python | Python (3.4.3) | py | Runtime Error | 84 | 18272 | 489 | N = int(input())
A = list(map(int, input().split()))
dict1 = {}
for i in range(N):
if A[i] not in dict1.keys():
dict1[A[i]] = 0
else:
dict1[A[i]] += 1
value1 = []
for value in dict1.values():
value1.append(value)
value2 = sorted(value1, reverse = True)
if value2[0] - value2[1] >= sum(value2[1:]):
print(... |
s010953362 | p03816 | u074402558 | 1559348263 | Python | Python (3.4.3) | py | Runtime Error | 83 | 18272 | 489 | N = int(input())
A = list(map(int, input().split()))
dict1 = {}
for i in range(N):
if A[i] not in dict1.keys():
dict1[A[i]] = 0
else:
dict1[A[i]] += 1
value1 = []
for value in dict1.values():
value1.append(value)
value2 = sorted(value1, reverse = True)
if value2[0] - value2[1] >= sum(value2[1:]):
print(... |
s961210032 | p03816 | u074402558 | 1559348097 | Python | Python (3.4.3) | py | Runtime Error | 85 | 17400 | 436 | N = int(input())
A = list(map(int, input().split()))
dict1 = {}
for i in range(N):
if A[i] not in dict1.keys():
dict1[A[i]] = 0
else:
dict1[A[i]] += 1
value1 = []
for value in dict1.values():
value1.append(value)
value2 = sorted(value1, reverse = True)
if value2[0] - value2[1] >= sum(value2[1:]):
print(... |
s521395661 | p03816 | u074402558 | 1559347766 | Python | Python (3.4.3) | py | Runtime Error | 84 | 17396 | 441 | N = int(input())
A = list(map(int, input().split()))
dict1 = {}
for i in range(N):
if A[i] not in dict1.keys():
dict1[A[i]] = 0
else:
dict1[A[i]] += 1
value1 = []
for value in dict1.values():
value1.append(value)
value2 = sorted(value1, reverse = True)
if value2[0] - value2[1] >= sum(value2[1:]):
print(... |
s161780576 | p03816 | u902468164 | 1556211619 | Python | Python (3.4.3) | py | Runtime Error | 107 | 16668 | 231 | _ = input()
an = sorted([int(i) for i in input().split(" ")])
dic = {}
for a in an:
if a not in dic:
dic[a] = 0
dic[a] += 1
tim = 0
for a in dic:
if dic[1] % 2 == 0:
tim += 1
print(len(dic)-(tim+1)%2) |
s887440258 | p03816 | u585482323 | 1551686283 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1076 | 63120 | 1235 | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): ... |
s874899541 | p03816 | u585482323 | 1551686083 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1076 | 63120 | 1223 | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): ... |
s174314454 | p03816 | u653642801 | 1531105191 | Python | Python (3.4.3) | py | Runtime Error | 48 | 14396 | 402 | import sys
def main():
n = input()
a = input().split()
n = int(n)
a = list(map(int, a))
lst = [0]* 20
dup = 0
ans =0
for i in a:
lst[i]+=1
for i in lst:
if i >0:
ans+= 1
if i > 1:
dup = dup + i - 1
if dup % 2 == 0:
pri... |
s314565103 | p03816 | u391331433 | 1502741748 | Python | Python (2.7.6) | py | Runtime Error | 2109 | 63056 | 1356 | import sys
import numpy as np
from collections import deque
import copy
from math import *
def get_read_func(fileobject):
if fileobject == None :
return raw_input
else:
return fileobject.readline
class card:
def __init__(self, value, count):
self.value = value
self.count = ... |
s938558984 | p03816 | u098968285 | 1498519812 | Python | PyPy3 (2.4.0) | py | Runtime Error | 228 | 54468 | 390 | N = int(input())
A = list(map(int, input().split()))
num = int(1e5)
dp = [0]*(num+1)
for e in A:
dp[e] += 1
cnt = 0
maxm = 0
for i in range(1, num+1):
if dp[i] > 1:
cnt += dp[i] - 1
maxm = max(maxm, dp[i] - 1)
if maxm * 2 > N // 2:
print(ans)
if maxm > cnt // 2:
ans = N - (maxm-(cnt-maxm)) * 2
if... |
s986367017 | p03816 | u098968285 | 1498519727 | Python | PyPy3 (2.4.0) | py | Runtime Error | 225 | 53060 | 409 | N = int(input())
A = list(map(int, input().split()))
num = int(1e5)
dp = [0]*(num+1)
for e in A:
dp[e] += 1
cnt = 0
maxm = 0
for i in range(1, num+1):
if dp[i] > 1:
cnt += dp[i] - 1
maxm = max(maxm, dp[i] - 1)
if maxm * 2 > N // 2:
print(ans)
if maxm > cnt // 2:
ans = N - (maxm-(cnt-maxm)) * 2
pr... |
s904685709 | p03816 | u638057737 | 1488899797 | Python | Python (3.4.3) | py | Runtime Error | 21 | 4724 | 242 | N = int(input())
uniques = {}
count = 0
for i in range(N):
a = int(input())
if a not in uniques.keys():
uniques[a] = True
else:
count += 1
if count % 2 == 0:
print (N - count)
else:
print (N - count - 1)
|
s783170377 | p03816 | u683479402 | 1486926503 | Python | Python (3.4.3) | py | Runtime Error | 131 | 14452 | 364 | from itertools import groupby
N = input()
A = map(int, input().split())
B = [len(list(group)) for key, group in groupby(sorted(A))]
C = []
for i, val in enumerate(B):
if val % 2 == 0: C.append(2)
else: C.append(1)
D = [len(list(group)) for key, group in groupby(sorted(C))]
if D[1] % 2 == 0:
answer = D[0] +D[1]
e... |
s175490435 | p03816 | u791838908 | 1486923731 | Python | Python (3.4.3) | py | Runtime Error | 22 | 2940 | 257 | N = int(input())
A = input()
list_A = A.split()
set_A = set(list_A)
i = 0
for a in list_A:
if a in set_A:
i += 1
i = i - len(set_A)
if i % 2 == 0:
print(N - i)
else:
print(N - (i +1))
|
s109650609 | p03816 | u791838908 | 1486923701 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 204 | N = int(input())
A = input()
list_A = A.split()
set_A = set(list_A)
i = 0
for a in list_A:
if a in set_A:
i += 1
i = i - len(set_A)
if i % 2 == 0:
print(N - i)
else:
print(N - (i +1)) |
s130329281 | p03816 | u615817983 | 1486816489 | Python | Python (2.7.6) | py | Runtime Error | 26 | 7936 | 62 | int(raw_input())
print len(set(map(int, raw_input().strip()))) |
s009231205 | p03816 | u781758937 | 1485660262 | Python | Python (3.4.3) | py | Runtime Error | 279 | 23544 | 332 | import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())), dtype=np.int64)
U = list(np.unique(A, return_counts = True))
U[1] = np.subtract(U[1],1)
max(U[1])
len(U[1])
sum(U[1])
if max(U[1]) > (sum(U[1]) - max(U[1])):
res = max(U[1]) * 2 - sum(U[1])
else:
res = sum(U[1]) % 2
print(len(U[... |
s625229681 | p03816 | u390382871 | 1485659700 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 859 | #include <iostream>
#include <boost/algorithm/string.hpp>
#include <vector>
#include <map>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> v;
for(int i = 0; i < n; i++){
int t;
cin >> t;
v.push_back(t);
}
sort(v.begin(),v.end());
map<int, int> counter;
for(int i = 0; i < n; i... |
s629683028 | p03817 | u536034761 | 1599574508 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8972 | 120 | x = input()
y = x % 11
if y > 0:
cnt = 1
if y > 6:
cnt += 1
else:
cnt = 0
print(x // 11 + cnt)
|
s674708820 | p03817 | u802234211 | 1598405781 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9096 | 207 | import math
x = int(input())
xi = math.floor(x/5.5)
print(xi)
for i in range(xi,100000000000000):
# print(6*i - math.floor(i/2))
if(x < 6*i-math.floor(i/2)):
xa = i
break
print(xa)
|
s951048561 | p03817 | u802234211 | 1598405745 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9080 | 205 | import math
x = int(input())
xi = math.floor(x/5.5)
print(xi)
for i in range(xi,100000000000000):
print(6*i - math.floor(i/2))
if(x < 6*i-math.floor(i/2)):
xa = i
break
print(xa)
|
s366013524 | p03817 | u597455618 | 1596646914 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9196 | 307 | def main():
x = int(input())
s = 0
f = 0
while ans < x:
s += 1
tmp = 6*s + 5*f
if tmp >= x:
print(s+f)
exit()
f += 1
tmp += 5
if tmp >= x:
print(s+f)
exit()
if __name__ == "__main__":
main() |
s131950431 | p03817 | u083960235 | 1588210757 | Python | Python (3.4.3) | py | Runtime Error | 30 | 4012 | 884 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... |
s108582748 | p03817 | u471539833 | 1586993003 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 228 | N=int(input())
A=list(map(int,input().split()))
kind=0
c=[]
d=[0]*(10**5)
count=0
for i in range(N):
if(d[A[i]-1]==0):
kind+=1
d[A[i]-1]+=1
for i in range(N):
if(d[i]>0 and d[i]%2==0):
count+=1
print(kind-count%2)
|
s527144152 | p03817 | u293198424 | 1586347560 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38384 | 113 | x = int(input())
if x%11 > 6:
ans = x//11 *2 +2
elif x %11==0:
1+1
else:
ans = x//11 *2 +1
print(ans) |
s259632140 | p03817 | u293198424 | 1586347496 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 38384 | 114 | x = int(input())
if x%11 > 6:
ans = x//11 *2 +2
elif x %11==0:
pass
else:
ans = x//11 *2 +1
print(ans) |
s232589342 | p03817 | u806999568 | 1583300820 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 60 | x = input()
print((x // 11) * 2 + (2 if x % 11 > 6 else 1))
|
s988071853 | p03817 | u737451238 | 1579113858 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 105 | if x / 11 < 1:
ans = 1
if x / 5 >= 1:
ans = 2
else:
ans = x // 11 * 2 + 1
print(ans) |
s861704875 | p03817 | u637824361 | 1565236762 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 111 | N = int(input())
if N % 11 > 6:
print(N+10//11*2)
elif n % 11 == 0:
print(N//11*2)
else:
print(N//11*2+1) |
s284601581 | p03817 | u623819879 | 1557335425 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38384 | 93 | n=int(input())
ans=(n//11)*2
ans+=2 if n-n//11>6 else 1
ans-=1 if n-n//11=0 else 0
print(ans) |
s391862147 | p03817 | u667024514 | 1553392180 | Python | Python (3.4.3) | py | Runtime Error | 16 | 2940 | 130 | n = int(input())
lis = list(map(int,input().split()))
ans = set()
for num in lis:ans.add(num)
print(len(ans)-((len(ans) % 2)+1)%2) |
s966808566 | p03817 | u243961437 | 1551986872 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 141 | x = int(input())
count = 0
q, mod = divmod(x, 11)
count += q*2
if mod > 0:
if(mod <= 6):
count += 1
else:
count += 2
print(count) |
s232864176 | p03817 | u983918956 | 1547507616 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 119 | x = int(input())
t = x // 11
x -= 11 * t
ans = t * 2
if x <= 5:
ans += 1
elif 5 < x < 11:
ans += 2
print(ans)za |
s557253905 | p03817 | u620868411 | 1534903928 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 213 | # -*- coding: utf-8 -*-
x = int(input())
if x<=6:
print(1)
exit()
if x<=11:
print(2)
exit()
r = x%11
ret = x//11
if r<=6:
print(2*ret+1)
elif t<=11:
print(2*ret+2)
else:
print(2*ret)
|
s591890364 | p03817 | u785205215 | 1515031867 | Python | PyPy3 (2.4.0) | py | Runtime Error | 204 | 40432 | 1502 | import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque
# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")
##### stdin ####
def LM(t, r): return list(map(t, r)... |
s737607011 | p03817 | u765237551 | 1493583051 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3316 | 206 | from collections import Counter
_ = input()
xs = Counter(map(int, input().split()))
even = sum(1 for (k, c) in xs.items() if c%2==0)
odd = sum(1 for (k, c) in xs.items() if c%2==1)
print(odd + (even//2)*2) |
s752508245 | p03817 | u848877025 | 1488673609 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2696 | 1414 | def main():
N = int(raw_input())
x = map(int, raw_input().split())
#-1:remove , 0:singe , 1~:label
check= [0] * N
flag = False
label = 1
c = 0
x.sort()
#labeling
for i in range(N):
for j in range(N):
if(i != j):
if(x[i] == x[j]):
... |
s767190766 | p03817 | u886545507 | 1486830844 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2568 | 114 | #ARC068C
n=int(raw_input())
if x<=6:
print 1
else:
res=n/11*2
if n%11>=6:
res+=2
else:
res+=1
print res
|
s178438337 | p03817 | u093843560 | 1486240808 | Python | Python (2.7.6) | py | Runtime Error | 15 | 2568 | 118 | mport numpy as np
x = raw_input()
x = int(x)
y = (x//11)*2
w = x%11
if w<7:
y = y+1
else:
y = y+2
print y |
s120662345 | p03817 | u208486018 | 1485841913 | Python | Python (2.7.6) | py | Runtime Error | 18 | 2568 | 251 | N = int(raw_input())
A = map(int, raw_input().split())
D = dict()
for a in A:
if not a in D:
D[a] = 0
D[a] += 1
total = 0
for num, count in D.iteritems():
if count > 1: total += count - 1
if total % 2 != 0: total += 1
print (N - total) |
s613026753 | p03817 | u208486018 | 1485841771 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 249 | N = int(raw_input())
A = map(int, raw_input().split())
D = dict()
for a in A:
if a not in D:
D[a] = 0
D[a] += 1
total = 0
for num, count in D.iteritems():
if count > 1: total += count - 1
if total % 2 != 0: total += 1
print N - total |
s924494117 | p03817 | u546700081 | 1485719481 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 304 | N,M=map(int,raw_input().split(" "))
items=[]
for _ in xrange(0,N):
items.append(map(int,raw_input().split(" ")))
for d in xrange(1,M+1):
isget=[False]*N
for k in range(0,M+1,d):
for i,item in enumerate(items):
isget[i]=item[0]<=k<=item[1] or isget[i]
print sum(isget) |
s241378063 | p03817 | u966695411 | 1485658950 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3192 | 265 | N = int(input())
A = list(map(int, input().split()))
D = {}
for i in A:
if i in D:
D[i] += 1
else:
D[i] = 1
cnt = 0
for k in D.keys():
if D[k] % 2:
D[k] = 1
else:
D[k] = 2
cnt += 1
print(len({*A}) - (cnt % 2)) |
s706271657 | p03817 | u541568482 | 1485658143 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 179 | import sys
cin = sys.stdin
cin = open("in.txt", "r")
x = int(cin.readline())
c = x//11
cnt = c*2
r = x%11
# print(r)
if r>0:
cnt +=1
if r>6:
cnt +=1
print(cnt)
|
s171375054 | p03817 | u755962107 | 1485657546 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3064 | 139 | n = int(input().strip())
q = n // 11
r = n % 11
res = 2 * q
if r > 5: res += 2
elif r > 0: res += 1
print(res) |
s721461054 | p03818 | u411203878 | 1600530129 | Python | PyPy3 (7.3.0) | py | Runtime Error | 185 | 102100 | 577 | N = int(input())
A = list(map(int,input().split()))
memo = {}
for a in A:
if a in memo:
memo[a] += 1
else:
memo[a] = 1
memo_sorted = sorted(memo.items(), key=lambda x:-x[1])
memo = []
for a,b in memo_sorted:
memo.append([a,b])
for key,val in enumerate(memo):
val_1, val_2 = val
if va... |
s797138502 | p03818 | u397496203 | 1600482932 | Python | PyPy3 (7.3.0) | py | Runtime Error | 138 | 103672 | 892 | import sys
# sys.setrecursionlimit(100000)
def input():
return sys.stdin.readline().strip()
def input_int():
return int(input())
def input_int_list():
return [int(i) for i in input().split()]
def main():
from collections import Counter
n = input_int()
A = input_int_list()
A_cnt = Cou... |
s323174030 | p03818 | u397496203 | 1600482837 | Python | PyPy3 (7.3.0) | py | Runtime Error | 141 | 96904 | 862 | import sys
# sys.setrecursionlimit(100000)
def input():
return sys.stdin.readline().strip()
def input_int():
return int(input())
def input_int_list():
return [int(i) for i in input().split()]
def main():
from collections import Counter
n = input_int()
A = input_int_list()
A_cnt = Cou... |
s307232491 | p03818 | u119148115 | 1600482087 | Python | PyPy3 (7.3.0) | py | Runtime Error | 97 | 74776 | 157 | N = I()
A = LI()
B = [0]*(10**5+1)
for a in A:
B[a] += 1
print(sum(B[i] != 0 for i in range(10**5+1))-(sum(max(0,B[i]-1) for i in range(10**5+1)) % 2))
|
s235042083 | p03818 | u535803878 | 1595136739 | Python | PyPy3 (7.3.0) | py | Runtime Error | 111 | 100584 | 530 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(input())
a = list(map(int, input().split()))
from collections import Counter
c = Counter(a)
ones = sum(v==1 for v in c.values())
ns = [v-1 for v in c.values() if v>1]
an... |
s794830106 | p03818 | u989306199 | 1594968412 | Python | Python (3.8.2) | py | Runtime Error | 55 | 21916 | 149 | import collections as col
N = int(input())
A = list(map(int, input().split()))
m = col.Counter(A)
ans = len(m) if m%2==1 else len(m)-1
print(ans)
|
s643067037 | p03818 | u946969297 | 1594860266 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8944 | 730 | import times, strutils, sequtils, math, algorithm, tables, sets, lists, intsets
import critbits, future, strformat, deques
template `max=`(x,y) = x = max(x,y)
template `min=`(x,y) = x = min(x,y)
let read* = iterator: string {.closure.} =
while true: (for s in stdin.readLine.split: yield s)
proc scan(): int = read()... |
s823770192 | p03818 | u404290207 | 1592452766 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38256 | 1593 | import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log,gcd
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bi... |
s399439227 | p03818 | u333139319 | 1591270213 | Python | PyPy3 (2.4.0) | py | Runtime Error | 236 | 61676 | 756 | import sys
def input():
return sys.stdin.readline()[:-1]
import collections
n = int(input())
a = [int(i) for i in input().split()]
dic = collections.defaultdict(int)
for i in range(n):
dic[a[i]] += 1
ls = collections.deque()
for i in dic.keys():
if dic[i] > 1:
ls.append(i)
ans = n
#n/2回ループ
for ... |
s224870110 | p03818 | u333139319 | 1591268952 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2107 | 61804 | 586 | import collections
n = int(input())
a = [int(i) for i in input().split()]
dic = collections.defaultdict(int)
for i in range(n):
dic[a[i]] += 1
ls = collections.deque()
for i in dic.keys():
if dic[i] > 1:
ls.append(i)
ans = n
for i in range(n//2):
if max(dic.values()) == 1:
break
if... |
s121832268 | p03818 | u333139319 | 1591268758 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2107 | 61804 | 598 | import collections
n = int(input())
a = [int(i) for i in input().split()]
dic = collections.defaultdict(int)
for i in range(n):
dic[a[i]] += 1
ls = collections.deque()
for i in dic.keys():
if dic[i] > 1:
ls.append(i)
ans = n
while max(dic.values()) > 1:
#print(dic)
if len(ls) == 1 and dic[l... |
s407034566 | p03818 | u306950978 | 1590015966 | Python | Python (3.4.3) | py | Runtime Error | 84 | 18656 | 558 | import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
p = []
ans = 0
for k,v in c.items():
ans += 1
if v != 1:
p.append([k,v])
p.sort()
lef = 0
rig = len(p)-1
while True:
if lef == rig:
if p[lef][1] % 2 == 1:
print(ans)
ex... |
s777807667 | p03818 | u306950978 | 1590015809 | Python | Python (3.4.3) | py | Runtime Error | 85 | 18656 | 519 | import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
p = []
ans = 0
for k,v in c.items():
ans += 1
if v != 1:
p.append([k,v])
p.sort()
lef = 0
rig = len(p)-1
while True:
p[lef][1] -= 1
p[rig][1] -= 1
if p[lef][1] == 1:
lef += 1
if p[... |
s249330585 | p03818 | u992910889 | 1589508621 | Python | PyPy3 (2.4.0) | py | Runtime Error | 223 | 52780 | 396 | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
N = int(input())
A = list(map(int, input().split()))
AA = Counter(A)
ans = 0
val = 0
for k, v in AA.items():
if v % 2 == 0:
ans += 1
else:
... |
s164405124 | p03818 | u246217175 | 1587778558 | Python | PyPy3 (2.4.0) | py | Runtime Error | 220 | 53572 | 471 | n = int(input())
a = list(map(int,input().split()))
a = a + [0]
a.sort(reverse = True)
b = 1
ichi = 0
r = []
for i in range(n):
if a[i] != a[i+1]:
if b != 1:
r.append(b)
else:
ichi += 1
b = 1
else:
b += 1
for i in range(len(r)-1):
if r[i] % 2 == 0:
... |
s484117149 | p03818 | u575431498 | 1574403425 | Python | Python (3.4.3) | py | Runtime Error | 82 | 15156 | 363 | N = int(input())
fq = [0] * (N + 10)
A = list(map(int, input().split()))
for a in A:
fq[a] += 1
fq = [f if f % 1 == 0 else 1 for f in fq]
cnt_even = 0
cnt_odd = 0
for f in fq:
if f & 1 == 0 and f != 0:
cnt_even += 1
if f & 1 == 1:
cnt_odd += 1
if cnt_even & 1 == 0:
print(cnt_even + cnt_o... |
s639057887 | p03818 | u688375653 | 1570378594 | Python | PyPy3 (2.4.0) | py | Runtime Error | 261 | 87592 | 298 | N=int(input())
A=list(map(int, input().split()))
#重複した値だけを集めて消す
sets={}
for i in A:
if i in sets:
sets[i]+=1
else:
sets[i]=1
sets
duplicate=0
for k,v in sets.items():
if v>1:
duplicate+=(v-1)
duplicate %=2
print(set(A))-duplicate |
s237694217 | p03818 | u118642796 | 1568857157 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 256 | import sys
N = int(input())
A = [int(a) for a in sys.stdin.readline().split()]
dic = {}
for a in A:
dic[a] = dic.get(a,0) + 1
evenodd = [0,0]
for k in dic:
evenodd[dic[k]%2] += 1
if evenodd[0]%2==0:
return len(dic)
else:
return len(dic)-1
|
s873341617 | p03818 | u223646582 | 1567924653 | Python | PyPy3 (2.4.0) | py | Runtime Error | 229 | 80684 | 129 | n = int(input())
A = set([int(i) for i in input().split()])
print(A)
if A % 2 == 1:
print(len(A))
else:
print(len(A)-1)
|
s868591243 | p03818 | u091051505 | 1567137454 | Python | Python (3.4.3) | py | Runtime Error | 61 | 18656 | 291 | from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
k = Counter(a)
b = list(k.values())
over_2 = [bb for bb in b if bb >= 2]
if sum(over_2) % 2 == 1:
print(len(b))
else:
if len(over_2 == 0):
print(len(b))
else:
print(len(b) - 1) |
s424238743 | p03818 | u667024514 | 1553392146 | Python | Python (3.4.3) | py | Runtime Error | 53 | 14564 | 130 | n = int(input())
lis = list(map(int,input().split()))
ans = set()
for num in lis:ans.add(num)
print(len(num)-((len(num) % 2)+1)%2) |
s983270822 | p03818 | u388927326 | 1548593513 | Python | Python (3.4.3) | py | Runtime Error | 121 | 14104 | 785 | #!/usr/bin/env python3
import heapq
def main():
n = int(input())
h = list(map(int, input().split()))
heapq.heapify(h)
accepted = [heapq.heappop(h)]
while len(h) > 0:
assert len(h) >= 2
first = heapq.heappop(h)
second = heapq.heappop(h)
if accepted[-1] == first:
... |
s016171383 | p03818 | u827202523 | 1539509964 | Python | Python (2.7.6) | py | Runtime Error | 16 | 4724 | 429 | from collections import defaultdict
def getN():
return int(input())
def getNM():
return map(int, input().split())
def getList():
return list(map(int, input().split()))
N = getN()
nums = getList()
dup = defaultdict(int)
for n in nums:
dup[n] += 1
poss = len(dup.keys())
dupdup = 0
for val in dup.va... |
s268083825 | p03818 | u391331433 | 1532745512 | Python | Python (2.7.6) | py | Runtime Error | 12 | 2928 | 828 | from collections import deque
import copy
from math import *
def get_read_func(fileobject):
if fileobject == None :
return raw_input
else:
return fileobject.readline
def main():
if len(sys.argv) > 1:
f = open(sys.argv[1])
else:
f = None
read_func = get_read_func(f... |
s430897276 | p03818 | u765237551 | 1493582963 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 786 | use std::io::stdin;
fn main(){
let x = geti64s()[0];
let (d, m) = (x/11, x%11);
println!("{}", match m {
0 => d*2,
x if x<=6 => d*2 + 1,
_ => d*2 + 2
});
}
#[allow(dead_code)]
fn getline() -> String {
let mut s = String::new();
match stdin().read_line(&m... |
s982503604 | p03818 | u669382434 | 1493059043 | Python | Python (3.4.3) | py | Runtime Error | 70 | 14388 | 183 | n=int(input())
a=list(map(int,input().split()))
sn=[0]*n
mi2=0
mi=0
for i in range(0,n):
if sn[a[i]]==1:
mi2=1-mi2
else:
sn[a[i]]=1
mi+=1
print(mi-mi2) |
s116680270 | p03818 | u619631862 | 1490814345 | Python | Python (3.4.3) | py | Runtime Error | 138 | 14388 | 185 | n=int(input())
a=[int(i) for i in input().split()]
a.sort()
b=[a[0]]
def f(i):
if i>n-1:
print(len(b))
return 0
if a[i]!=b[-1]:
b.append(a[i])
f(i+1)
else:
f(i+2)
f(1) |
s013604938 | p03818 | u619631862 | 1490814076 | Python | Python (3.4.3) | py | Runtime Error | 140 | 13964 | 184 | n=int(input())
a=[int(i) for i in input().split()]
a.sort()
b=[a[0]]
def f(i):
if i==n:
print(len(b))
return 0
if a[i]!=b[-1]:
b.append(a[i])
f(i+1)
else:
f(i+2)
f(1) |
s916153912 | p03818 | u848877025 | 1488673616 | Python | Python (2.7.6) | py | Runtime Error | 2104 | 14936 | 1414 | def main():
N = int(raw_input())
x = map(int, raw_input().split())
#-1:remove , 0:singe , 1~:label
check= [0] * N
flag = False
label = 1
c = 0
x.sort()
#labeling
for i in range(N):
for j in range(N):
if(i != j):
if(x[i] == x[j]):
... |
s388445088 | p03818 | u984351908 | 1485658172 | Python | Python (3.4.3) | py | Runtime Error | 128 | 14396 | 257 | n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 0
e = 0
i = 0
while i < len(a):
c += 1
cai = 1
while a[i] == a[i + 1]:
cai += 1
i += 1
if cai % 2 == 0:
e += 1
i += 1
ans = c - (e % 2)
print(ans)
|
s941749799 | p03819 | u222668979 | 1597889263 | Python | PyPy3 (7.3.0) | py | Runtime Error | 148 | 74500 | 77 | x = int(input())
ans = x // 11 * 2
print(ans + (x % 11 > 0) + (x % 11 > 6))
|
s398367343 | p03819 | u864197622 | 1575264184 | Python | PyPy3 (2.4.0) | py | Runtime Error | 764 | 87644 | 725 | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
NN = (M + 10).bit_length() - 1
BIT=[0]*(2**NN+1)
def addrange(l0, r0, x=1):
l, r = l0, r0
while l <= 2**NN:
BIT[l] += x
l += l & (-l)
while r <= 2**NN:
BIT[r] -= x
r += r & (-r)
def getvalue(r):
a = 0... |
s100273460 | p03819 | u102461423 | 1568742004 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3316 | 831 | import sys
input = sys.stdin.readline
from collections import defaultdict
N,M = map(int,input().split())
d_to_LR = defaultdict(list)
for _ in range(N):
L,R = map(int,input().split())
d_to_L[R-L+1].append(L)
tree = [0] * (M+1) # BIT で管理。左にあるLの個数 - (R+1)の個数 → いくつの[L,R]に入っているか
long = N # 長すぎて自動回収できる
answer = [0]... |
s962711689 | p03819 | u777923818 | 1557803178 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38384 | 1333 | from bisect import bisect
from operator import itemgetter
inpl = lambda: list(map(int, input().split()))
class BIT:
from math import log2
def __init__(self, N):
self.size = 2 ** (-int(-log2(N)//1))
self.tree = [0]*(self.size + 1)
def sum(self, i):
res = 0
while i:
... |
s950257821 | p03819 | u155024797 | 1556513013 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38384 | 466 | def is_prime(N):
if N < 2:
return False
i = 2
while i*i <= N:
if N % i == 0:
return False
i += 1
return True
def main():
N = int(input())
if not is_prime(N):
dsum = 0
for c in str(N):
dsum += int(c)
if N == 1 or N % 10 in ... |
s276435730 | p03819 | u236127431 | 1546100921 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1685 | 85664 | 516 | N,M=map(int,input().split())
section=[[] for i in range(M+1)]
for i in range(N):
l,r=map(int,input().split())
section[r-l+1].append((l,r))
def add(B,a,s):
x=a
while x<=len(B):
B[x]+=s
x+=x&(-x)
def sums(B,a):
x=a
S=0
while x!=0:
S+=B[x]
x-=x&(-x)
ret... |
s682126310 | p03819 | u226155577 | 1518410213 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 557 | from math import sqrt
N, M = map(int, input().split())
D = [0]*(M+2); R = [0]*(M)
for i in range(N):
l, r = map(int, input().split())
D[1] += 1
D[r+1] -= 1
if l <= r-l+1:
continue
D[r-l+2] -= 1
D[l] += 1
left = r-l+2; right = l
for k in range(2, int(sqrt(r))+1):
l0 = max... |
s623306715 | p03819 | u637175065 | 1509316469 | Python | PyPy3 (2.4.0) | py | Runtime Error | 968 | 127320 | 1521 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF()... |
s787263475 | p03819 | u772909448 | 1509237853 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3316 | 921 | import sys
print("弁当の種類を指定してください:")
bentoType = int(sys.stdin.readline())
print("駅の合計数を指定してください:")
stationCnt = int(sys.stdin.readline())
startSta = 0
endSta = 0
array = []
for i in range(1, bentoType + 1) :
bentoMap = {}
print("弁当" + str(i) + "の開始駅を指定してください:")
startSta = int(sys.stdin.readline())
pri... |
s094396813 | p03820 | u723736091 | 1485659813 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 804 | #include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MP make_pair
#define PB push_back
typedef long long ll;
int N, K;
ll ans = 1;
ll inv (ll a) {
ll e = MOD-2, r = 1ll;
while (e) {
if (e&1) r = r * a % MOD;
... |
s120558419 | p03821 | u623814058 | 1597860540 | Python | Python (3.8.2) | py | Runtime Error | 300 | 52504 | 150 | N=int(input())
A=[map(int,input().split()) for _ in range(N)]
r=0
for i in range(N-1,-1,-1):
a,b=A[i]
a+=r
r+=-(-a//b)*A[i][1]-a
print(r) |
s523128577 | p03821 | u760771686 | 1595958682 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9032 | 184 | N = int(input())
Array = []
for i in range(N):
Array.append(tuple(map(int,input().split())))
res = 0
for i in reversed(range(N)):
a,b = Array[i]
a+=res
res+ = b-a%b
print(res) |
s036874371 | p03821 | u917013605 | 1594931246 | Python | PyPy3 (7.3.0) | py | Runtime Error | 91 | 74880 | 337 | import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
N, M = map(int, input().split())
S = input()
T = input()
L = lcm(N , M)
x = [""] * L
for i in range(N):
idx = i * (L // N)
# x[idx] = S[i]
for i in range(M):
idx = i * (L // M)
if x[idx] != "" and x[idx] != T[i]:
print(-1)
... |
s715423148 | p03821 | u212328220 | 1593575491 | Python | Python (3.8.2) | py | Runtime Error | 283 | 16880 | 573 | N = int(input())
al = []
bl = []
for i in range(N):
a,b = map(int,input().split())
al.append(a)
bl.append(b)
al.reverse()
bl.reverse()
plus = 0
for i in range(N):
if al[i]+plus > bl[i]:
amari = (al[i]+plus) % bl[i]
syo = (al[i]+plus) // bl[i]
if amari != 0:
syo += 1
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.