user_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
1 value
submission_id_v0
stringlengths
10
10
submission_id_v1
stringlengths
10
10
cpu_time_v0
int64
10
38.3k
cpu_time_v1
int64
0
24.7k
memory_v0
int64
2.57k
1.02M
memory_v1
int64
2.57k
869k
status_v0
stringclasses
1 value
status_v1
stringclasses
1 value
improvement_frac
float64
7.51
100
input
stringlengths
20
4.55k
target
stringlengths
17
3.34k
code_v0_loc
int64
1
148
code_v1_loc
int64
1
184
code_v0_num_chars
int64
13
4.55k
code_v1_num_chars
int64
14
3.34k
code_v0_no_empty_lines
stringlengths
21
6.88k
code_v1_no_empty_lines
stringlengths
20
4.93k
code_same
bool
1 class
relative_loc_diff_percent
float64
0
79.8
diff
list
diff_only_import_comment
bool
1 class
measured_runtime_v0
float64
0.01
4.45
measured_runtime_v1
float64
0.01
4.31
runtime_lift
float64
0
359
key
list
u884982181
p03292
python
s218778686
s598124475
20
17
2,940
2,940
Accepted
Accepted
15
a = list(map(int,input().split())) ti = min(a) da = max(a) print((da-ti))
a = list(map(int,input().split())) ti = min(a) da = max(a) print((int(da-ti)))
4
4
74
79
a = list(map(int, input().split())) ti = min(a) da = max(a) print((da - ti))
a = list(map(int, input().split())) ti = min(a) da = max(a) print((int(da - ti)))
false
0
[ "-print((da - ti))", "+print((int(da - ti)))" ]
false
0.040158
0.04023
0.998218
[ "s218778686", "s598124475" ]
u102461423
p02624
python
s314554502
s049861616
608
548
109,012
106,232
Accepted
Accepted
9.87
import sys import numba read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @numba.njit def main(N): x = 0 for a in range(1, N+1): for b in range(1, N//a+1): x += a*b return x N = int(read()) print((main(N)))
import sys import numba read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @numba.njit('(i8,)', cache=True) def main(N): x = 0 for a in range(1, N+1): for b in range(1, N//a+1): x += a*b return x N = int(read()) pri...
17
17
311
332
import sys import numba read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @numba.njit def main(N): x = 0 for a in range(1, N + 1): for b in range(1, N // a + 1): x += a * b return x N = int(read()) print((main(N)))
import sys import numba read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @numba.njit("(i8,)", cache=True) def main(N): x = 0 for a in range(1, N + 1): for b in range(1, N // a + 1): x += a * b return x N = int(read()) print((ma...
false
0
[ "-@numba.njit", "+@numba.njit(\"(i8,)\", cache=True)" ]
false
0.042259
0.035117
1.203364
[ "s314554502", "s049861616" ]
u970449052
p02612
python
s511785917
s726965611
32
28
9,088
9,124
Accepted
Accepted
12.5
N=int(eval(input())) print(((-(-N//1000)*1000)-N))
print((-int(eval(input()))%1000))
2
1
43
25
N = int(eval(input())) print(((-(-N // 1000) * 1000) - N))
print((-int(eval(input())) % 1000))
false
50
[ "-N = int(eval(input()))", "-print(((-(-N // 1000) * 1000) - N))", "+print((-int(eval(input())) % 1000))" ]
false
0.046083
0.039867
1.155925
[ "s511785917", "s726965611" ]
u977389981
p03556
python
s664315666
s530985739
444
29
12,420
2,940
Accepted
Accepted
93.47
import numpy as np n = int(eval(input())) for i in range(n, 0, -1): if np.sqrt(i) % 1 == 0: print(i) break
n = int(eval(input())) a = 1 while a ** 2 <= n: a += 1 print(((a - 1) ** 2))
6
5
125
76
import numpy as np n = int(eval(input())) for i in range(n, 0, -1): if np.sqrt(i) % 1 == 0: print(i) break
n = int(eval(input())) a = 1 while a**2 <= n: a += 1 print(((a - 1) ** 2))
false
16.666667
[ "-import numpy as np", "-", "-for i in range(n, 0, -1):", "- if np.sqrt(i) % 1 == 0:", "- print(i)", "- break", "+a = 1", "+while a**2 <= n:", "+ a += 1", "+print(((a - 1) ** 2))" ]
false
0.774135
0.038361
20.18052
[ "s664315666", "s530985739" ]
u389910364
p03450
python
s049644588
s917749616
1,898
1,597
37,784
10,800
Accepted
Accepted
15.86
import sys import time sys.setrecursionlimit(10000) INF = float('inf') class WeightedUnionFind: def __init__(self, nodes): """ :param collections.Iterable nodes: """ self._parents = {k: k for k in nodes} self._ranks = {k: 0 for k in nodes} self._sizes...
import sys sys.setrecursionlimit(10000) INF = float('inf') class WeightedUnionFind: def __init__(self, size): """ :param collections.Iterable nodes: """ self._parents = [i for i in range(size)] self._ranks = [0 for _ in range(size)] self._sizes = [1 fo...
105
104
2,560
2,538
import sys import time sys.setrecursionlimit(10000) INF = float("inf") class WeightedUnionFind: def __init__(self, nodes): """ :param collections.Iterable nodes: """ self._parents = {k: k for k in nodes} self._ranks = {k: 0 for k in nodes} self._sizes = {k: 1 for k...
import sys sys.setrecursionlimit(10000) INF = float("inf") class WeightedUnionFind: def __init__(self, size): """ :param collections.Iterable nodes: """ self._parents = [i for i in range(size)] self._ranks = [0 for _ in range(size)] self._sizes = [1 for _ in range(...
false
0.952381
[ "-import time", "- def __init__(self, nodes):", "+ def __init__(self, size):", "- self._parents = {k: k for k in nodes}", "- self._ranks = {k: 0 for k in nodes}", "- self._sizes = {k: 1 for k in nodes}", "+ self._parents = [i for i in range(size)]", "+ self._ra...
false
0.051022
0.050246
1.015446
[ "s049644588", "s917749616" ]
u648212584
p02769
python
s172785585
s245515488
671
241
27,356
44,140
Accepted
Accepted
64.08
import sys input = sys.stdin.buffer.readline import copy def main(): N,K = list(map(int,input().split())) MOD = 10**9+7 fac = [0 for _ in range(2*10**5+1)] fac[0],fac[1] = 1,1 inv = copy.deepcopy(fac) invfac = copy.deepcopy(fac) for i in range(2,2*10**5+1): fac[i...
import sys input = sys.stdin.buffer.readline def main(): N,K = list(map(int,input().split())) MOD = 10**9+7 fac = [0]*(N+1) invfac = [0]*(N+1) fac[0],fac[1] = 1,1 invfac[0],invfac[1] = 1,1 for i in range(2,N+1): fac[i] = (fac[i-1]*i)%MOD invfac[...
32
32
734
700
import sys input = sys.stdin.buffer.readline import copy def main(): N, K = list(map(int, input().split())) MOD = 10**9 + 7 fac = [0 for _ in range(2 * 10**5 + 1)] fac[0], fac[1] = 1, 1 inv = copy.deepcopy(fac) invfac = copy.deepcopy(fac) for i in range(2, 2 * 10**5 + 1): fac[i] =...
import sys input = sys.stdin.buffer.readline def main(): N, K = list(map(int, input().split())) MOD = 10**9 + 7 fac = [0] * (N + 1) invfac = [0] * (N + 1) fac[0], fac[1] = 1, 1 invfac[0], invfac[1] = 1, 1 for i in range(2, N + 1): fac[i] = (fac[i - 1] * i) % MOD invfac[-1] = p...
false
0
[ "-import copy", "- fac = [0 for _ in range(2 * 10**5 + 1)]", "+ fac = [0] * (N + 1)", "+ invfac = [0] * (N + 1)", "- inv = copy.deepcopy(fac)", "- invfac = copy.deepcopy(fac)", "- for i in range(2, 2 * 10**5 + 1):", "+ invfac[0], invfac[1] = 1, 1", "+ for i in range(2, N + 1)...
false
1.142394
0.353877
3.228226
[ "s172785585", "s245515488" ]
u344276999
p02572
python
s775851072
s746712383
372
283
49,800
49,740
Accepted
Accepted
23.92
import numpy as np N = int(eval(input())) A = np.array([int(i) for i in input().split()]) sum = 0 #累積和、二乗和の両方で1項ずつ求めてmodをとる for x in A: sum += x sum %= (10**9+7) #sum = A.sum() % (10**9+7) sum2 = 0 for x in A: sum2 += x*x sum2 %= (10**9+7) #sum2 = (A**2).sum() % (10**9+7) ans = (sum**2 - s...
import numpy as np N = int(eval(input())) A = np.array([int(i) for i in input().split()]) sum = 0 #二乗和だけは1項ずつ求めてmodをとる #for x in A: # sum += x # sum %= (10**9+7) sum = A.sum() % (10**9+7) sum2 = 0 for x in A: sum2 += x*x sum2 %= (10**9+7) #sum2 = (A**2).sum() % (10**9+7) ans = (sum**2 - sum2...
24
24
427
424
import numpy as np N = int(eval(input())) A = np.array([int(i) for i in input().split()]) sum = 0 # 累積和、二乗和の両方で1項ずつ求めてmodをとる for x in A: sum += x sum %= 10**9 + 7 # sum = A.sum() % (10**9+7) sum2 = 0 for x in A: sum2 += x * x sum2 %= 10**9 + 7 # sum2 = (A**2).sum() % (10**9+7) ans = (sum**2 - sum2) % (...
import numpy as np N = int(eval(input())) A = np.array([int(i) for i in input().split()]) sum = 0 # 二乗和だけは1項ずつ求めてmodをとる # for x in A: # sum += x # sum %= (10**9+7) sum = A.sum() % (10**9 + 7) sum2 = 0 for x in A: sum2 += x * x sum2 %= 10**9 + 7 # sum2 = (A**2).sum() % (10**9+7) ans = (sum**2 - sum2) % (10**9...
false
0
[ "-# 累積和、二乗和の両方で1項ずつ求めてmodをとる", "-for x in A:", "- sum += x", "- sum %= 10**9 + 7", "-# sum = A.sum() % (10**9+7)", "+# 二乗和だけは1項ずつ求めてmodをとる", "+# for x in A:", "+# sum += x", "+# sum %= (10**9+7)", "+sum = A.sum() % (10**9 + 7)" ]
false
0.182433
0.228415
0.798691
[ "s775851072", "s746712383" ]
u141642872
p03478
python
s318284290
s659865303
33
25
2,940
2,940
Accepted
Accepted
24.24
N, A, B = list(map(int, input().split())) ans = 0 for i in range(1, N + 1): if A <= sum([int(c) for c in str(i)]) <= B: ans += i print(ans)
def digit_sum(x): res = 0 while x != 0: res += x%10 x //= 10 return res [N,A,B] = list(map(int,input().split())) ans = 0 for i in range(1,N+1): if A <= digit_sum(i) <= B: ans += i print(ans)
6
13
144
248
N, A, B = list(map(int, input().split())) ans = 0 for i in range(1, N + 1): if A <= sum([int(c) for c in str(i)]) <= B: ans += i print(ans)
def digit_sum(x): res = 0 while x != 0: res += x % 10 x //= 10 return res [N, A, B] = list(map(int, input().split())) ans = 0 for i in range(1, N + 1): if A <= digit_sum(i) <= B: ans += i print(ans)
false
53.846154
[ "-N, A, B = list(map(int, input().split()))", "+def digit_sum(x):", "+ res = 0", "+ while x != 0:", "+ res += x % 10", "+ x //= 10", "+ return res", "+", "+", "+[N, A, B] = list(map(int, input().split()))", "- if A <= sum([int(c) for c in str(i)]) <= B:", "+ if A <...
false
0.044885
0.04469
1.004351
[ "s318284290", "s659865303" ]
u186838327
p03424
python
s744301415
s825283917
178
17
38,384
2,940
Accepted
Accepted
90.45
n = int(eval(input())) s = list(map(str, input().split())) d = {} for i in range(n): if s[i] not in d: d[s[i]] = 1 else: d[s[i]] += 1 if len(list(d.keys())) == 3: print('Three') else: print('Four') #print(d)
n = int(eval(input())) s = list(map(str, input().split())) if len(set(s)) == 4: print('Four') else: print('Three')
13
6
239
122
n = int(eval(input())) s = list(map(str, input().split())) d = {} for i in range(n): if s[i] not in d: d[s[i]] = 1 else: d[s[i]] += 1 if len(list(d.keys())) == 3: print("Three") else: print("Four") # print(d)
n = int(eval(input())) s = list(map(str, input().split())) if len(set(s)) == 4: print("Four") else: print("Three")
false
53.846154
[ "-d = {}", "-for i in range(n):", "- if s[i] not in d:", "- d[s[i]] = 1", "- else:", "- d[s[i]] += 1", "-if len(list(d.keys())) == 3:", "+if len(set(s)) == 4:", "+ print(\"Four\")", "+else:", "-else:", "- print(\"Four\")", "-# print(d)" ]
false
0.038994
0.039009
0.999602
[ "s744301415", "s825283917" ]
u046187684
p03221
python
s415203752
s905634871
1,985
1,631
56,676
55,336
Accepted
Accepted
17.83
import numpy as np n, m = list(map(int, input().split())) py = [list(map(int, input().split())) for _ in range(m)] p = [[] for _ in range(n)] for _p, _y in py: p[_p - 1].append(_y) for i in range(n): p[i] = np.argsort(np.argsort(p[i])) counter = [0 for _ in range(n)] for _p, _y in py: t = "{...
import numpy as np def solve(string): n, m, *py = list(map(int, string.split())) py = [(_p, _y) for _p, _y in zip(py[0::2], py[1::2])] p = [[] for _ in range(n)] for _p, _y in py: p[_p - 1].append(_y) for i in range(n): p[i] = np.argsort(np.argsort(p[i])) counter...
16
24
408
663
import numpy as np n, m = list(map(int, input().split())) py = [list(map(int, input().split())) for _ in range(m)] p = [[] for _ in range(n)] for _p, _y in py: p[_p - 1].append(_y) for i in range(n): p[i] = np.argsort(np.argsort(p[i])) counter = [0 for _ in range(n)] for _p, _y in py: t = "{:06}{:06}".form...
import numpy as np def solve(string): n, m, *py = list(map(int, string.split())) py = [(_p, _y) for _p, _y in zip(py[0::2], py[1::2])] p = [[] for _ in range(n)] for _p, _y in py: p[_p - 1].append(_y) for i in range(n): p[i] = np.argsort(np.argsort(p[i])) counter = [0 for _ in ...
false
33.333333
[ "-n, m = list(map(int, input().split()))", "-py = [list(map(int, input().split())) for _ in range(m)]", "-p = [[] for _ in range(n)]", "-for _p, _y in py:", "- p[_p - 1].append(_y)", "-for i in range(n):", "- p[i] = np.argsort(np.argsort(p[i]))", "-counter = [0 for _ in range(n)]", "-for _p, _...
false
0.24028
0.237963
1.009736
[ "s415203752", "s905634871" ]
u334712262
p02787
python
s864563635
s398121153
960
468
97,496
63,848
Accepted
Accepted
51.25
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, produc...
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, produc...
118
87
2,484
1,692
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permut...
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permut...
false
26.271186
[ "- ans = 0", "- abc = [(a / b, b, a) for a, b in AB]", "- abc.sort(key=lambda x: x[1])", "- abc.sort(key=lambda x: x[2])", "- abc.sort(key=lambda x: x[0], reverse=True)", "- # ri = set()", "- # mm = INF", "- # for i in range(N):", "- # if abc[i][1] >= mm:", "- # ...
false
0.089436
0.069698
1.283202
[ "s864563635", "s398121153" ]
u077291787
p03381
python
s500750537
s028581659
281
254
25,220
25,272
Accepted
Accepted
9.61
# ARC095C - Many Medians (ABC094C) def main(): n = int(eval(input())) x = list(map(int, input().rstrip().split())) l, h = sorted(x)[n // 2 - 1 : n // 2 + 1] for i in x: if i <= l: print(h) else: print(l) if __name__ == "__main__": main()
# ARC095C - Many Medians (ABC094C) def main(): n = int(eval(input())) x = tuple(map(int, input().rstrip().split())) l, h = sorted(x)[n // 2 - 1 : n // 2 + 1] for i in x: if i <= l: print(h) else: print(l) if __name__ == "__main__": main()
14
14
306
307
# ARC095C - Many Medians (ABC094C) def main(): n = int(eval(input())) x = list(map(int, input().rstrip().split())) l, h = sorted(x)[n // 2 - 1 : n // 2 + 1] for i in x: if i <= l: print(h) else: print(l) if __name__ == "__main__": main()
# ARC095C - Many Medians (ABC094C) def main(): n = int(eval(input())) x = tuple(map(int, input().rstrip().split())) l, h = sorted(x)[n // 2 - 1 : n // 2 + 1] for i in x: if i <= l: print(h) else: print(l) if __name__ == "__main__": main()
false
0
[ "- x = list(map(int, input().rstrip().split()))", "+ x = tuple(map(int, input().rstrip().split()))" ]
false
0.044624
0.036456
1.224066
[ "s500750537", "s028581659" ]
u924691798
p02678
python
s904601021
s432760526
658
500
38,536
38,428
Accepted
Accepted
24.01
from collections import deque N, M = map(int, input().split()) G = [[] for i in range(N)] for i in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 G[a].append(b) G[b].append(a) q = deque() done = [-1]*N done[0] = 1 q.appendleft(0) while q: now = q.pop() for to in G[...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import deque N, M = map(int, input().split()) G = [[] for i in range(N)] for i in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 G[a].append(b) G[b].append(a) q = deque() done = [-1]*N done[...
22
25
457
527
from collections import deque N, M = map(int, input().split()) G = [[] for i in range(N)] for i in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 G[a].append(b) G[b].append(a) q = deque() done = [-1] * N done[0] = 1 q.appendleft(0) while q: now = q.pop() for to in G[now]: ...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import deque N, M = map(int, input().split()) G = [[] for i in range(N)] for i in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 G[a].append(b) G[b].append(a) q = deque() done = [-1] * N done[0] = 1 q.app...
false
12
[ "+import sys", "+", "+input = sys.stdin.readline", "+sys.setrecursionlimit(10**7)" ]
false
0.133349
0.040683
3.277756
[ "s904601021", "s432760526" ]
u498041957
p02415
python
s141507985
s044361210
30
20
7,408
7,356
Accepted
Accepted
33.33
print((input().swapcase()))
inputa = eval(input()) print((inputa.swapcase()))
1
3
25
45
print((input().swapcase()))
inputa = eval(input()) print((inputa.swapcase()))
false
66.666667
[ "-print((input().swapcase()))", "+inputa = eval(input())", "+print((inputa.swapcase()))" ]
false
0.044196
0.043972
1.005091
[ "s141507985", "s044361210" ]
u241159583
p03807
python
s149930940
s487663912
66
55
14,108
14,112
Accepted
Accepted
16.67
n = int(eval(input())) a = list(map(int, input().split())) even = 0 not_even = 0 for v in a: if v%2==0: even += 1 else: not_even += 1 if not_even == 2: even += 1 not_even = 0 print(("YES" if not_even == 0 else "NO"))
n = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for a in A: if a%2 != 0: cnt += 1 print(("YES" if cnt%2==0 else "NO"))
11
6
232
136
n = int(eval(input())) a = list(map(int, input().split())) even = 0 not_even = 0 for v in a: if v % 2 == 0: even += 1 else: not_even += 1 if not_even == 2: even += 1 not_even = 0 print(("YES" if not_even == 0 else "NO"))
n = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for a in A: if a % 2 != 0: cnt += 1 print(("YES" if cnt % 2 == 0 else "NO"))
false
45.454545
[ "-a = list(map(int, input().split()))", "-even = 0", "-not_even = 0", "-for v in a:", "- if v % 2 == 0:", "- even += 1", "- else:", "- not_even += 1", "- if not_even == 2:", "- even += 1", "- not_even = 0", "-print((\"YES\" if not_even == 0 else \"NO\"))", ...
false
0.165103
0.047319
3.489153
[ "s149930940", "s487663912" ]
u688488162
p02390
python
s889786362
s311721116
40
20
7,692
5,588
Accepted
Accepted
50
s = int(eval(input())) h = int(s/3600) m = int(s%3600/60) s2 = int(s%3600%60) print((str(h)+':'+str(m)+':'+str(s2)))
s = int(eval(input())) h = int(s / 3600) m = int((s % 3600) / 60) s_ = int((s % 3600) % 60) print((str(h) + ":" + str(m) + ":" + str(s_)))
5
7
112
139
s = int(eval(input())) h = int(s / 3600) m = int(s % 3600 / 60) s2 = int(s % 3600 % 60) print((str(h) + ":" + str(m) + ":" + str(s2)))
s = int(eval(input())) h = int(s / 3600) m = int((s % 3600) / 60) s_ = int((s % 3600) % 60) print((str(h) + ":" + str(m) + ":" + str(s_)))
false
28.571429
[ "-m = int(s % 3600 / 60)", "-s2 = int(s % 3600 % 60)", "-print((str(h) + \":\" + str(m) + \":\" + str(s2)))", "+m = int((s % 3600) / 60)", "+s_ = int((s % 3600) % 60)", "+print((str(h) + \":\" + str(m) + \":\" + str(s_)))" ]
false
0.054359
0.052966
1.026304
[ "s889786362", "s311721116" ]
u556589653
p03107
python
s934420450
s953573100
35
18
3,188
3,188
Accepted
Accepted
48.57
S = eval(input()) A = 0 B = 0 for i in range(len(S)): if S[i] == "0": A += 1 else: B += 1 print((min(A,B)*2))
S = eval(input()) K = S.count("0") L = S.count("1") print((min(K,L)*2))
9
4
122
66
S = eval(input()) A = 0 B = 0 for i in range(len(S)): if S[i] == "0": A += 1 else: B += 1 print((min(A, B) * 2))
S = eval(input()) K = S.count("0") L = S.count("1") print((min(K, L) * 2))
false
55.555556
[ "-A = 0", "-B = 0", "-for i in range(len(S)):", "- if S[i] == \"0\":", "- A += 1", "- else:", "- B += 1", "-print((min(A, B) * 2))", "+K = S.count(\"0\")", "+L = S.count(\"1\")", "+print((min(K, L) * 2))" ]
false
0.046369
0.218609
0.212108
[ "s934420450", "s953573100" ]
u222668979
p02911
python
s616336051
s510755892
589
536
56,024
55,896
Accepted
Accepted
9
n, k, q = list(map(int, input().split())) a = [int(eval(input())) for i in range(q)] b = [k] * n for i in a: b[i - 1] += 1 for i in b: i -= q if i <= 0: print('No') else: print('Yes')
n, k, q = list(map(int, input().split())) a = [int(eval(input())) for i in range(q)] b = [k-q] * n for i in a: b[i - 1] += 1 for i in b: if i <= 0: print('No') else: print('Yes')
12
10
209
204
n, k, q = list(map(int, input().split())) a = [int(eval(input())) for i in range(q)] b = [k] * n for i in a: b[i - 1] += 1 for i in b: i -= q if i <= 0: print("No") else: print("Yes")
n, k, q = list(map(int, input().split())) a = [int(eval(input())) for i in range(q)] b = [k - q] * n for i in a: b[i - 1] += 1 for i in b: if i <= 0: print("No") else: print("Yes")
false
16.666667
[ "-b = [k] * n", "+b = [k - q] * n", "- i -= q" ]
false
0.03877
0.041538
0.933352
[ "s616336051", "s510755892" ]
u058781705
p03290
python
s431997055
s088716759
201
74
42,096
68,092
Accepted
Accepted
63.18
ans = float("inf") def solve(): d, g = list(map(int, input().split())) pc = [list(map(int, input().split())) for i in range(d)] # まだ解いてない配点を nokori として持つ def dfs(i, sum, count, nokori): global ans if i == d: # G 点に満たなければ nokori のうち一番大きいものを解く if ...
d, g = list(map(int, input().split())) pc = [list(map(int, input().split())) for i in range(d)] # まだ解いてない配点を nokori として持つ ans = float("inf") def dfs(i, sum, count, nokori): global ans if i == d: # G 点に満たなければ nokori のうち一番大きいものを解く if sum < g: use = max(nokori) ...
35
29
923
774
ans = float("inf") def solve(): d, g = list(map(int, input().split())) pc = [list(map(int, input().split())) for i in range(d)] # まだ解いてない配点を nokori として持つ def dfs(i, sum, count, nokori): global ans if i == d: # G 点に満たなければ nokori のうち一番大きいものを解く if sum < g: ...
d, g = list(map(int, input().split())) pc = [list(map(int, input().split())) for i in range(d)] # まだ解いてない配点を nokori として持つ ans = float("inf") def dfs(i, sum, count, nokori): global ans if i == d: # G 点に満たなければ nokori のうち一番大きいものを解く if sum < g: use = max(nokori) # 解く問題が問題数を...
false
17.142857
[ "+d, g = list(map(int, input().split()))", "+pc = [list(map(int, input().split())) for i in range(d)]", "+# まだ解いてない配点を nokori として持つ", "-def solve():", "- d, g = list(map(int, input().split()))", "- pc = [list(map(int, input().split())) for i in range(d)]", "- # まだ解いてない配点を nokori として持つ", "- ...
false
0.035786
0.084738
0.422314
[ "s431997055", "s088716759" ]
u724428568
p03220
python
s530602210
s005626027
307
18
21,164
3,060
Accepted
Accepted
94.14
import numpy as np N = int(eval(input())) T, A = list(map(int, input().split())) h = [abs((T - (int(x) * 0.006)) - A) for x in input().split()] print((np.argmin(h)+1))
N = int(eval(input())) T, A = list(map(int, input().split())) h = [abs((T - (int(x) * 0.006)) - A) for x in input().split()] print((h.index(min(h))+1))
5
4
157
140
import numpy as np N = int(eval(input())) T, A = list(map(int, input().split())) h = [abs((T - (int(x) * 0.006)) - A) for x in input().split()] print((np.argmin(h) + 1))
N = int(eval(input())) T, A = list(map(int, input().split())) h = [abs((T - (int(x) * 0.006)) - A) for x in input().split()] print((h.index(min(h)) + 1))
false
20
[ "-import numpy as np", "-", "-print((np.argmin(h) + 1))", "+print((h.index(min(h)) + 1))" ]
false
0.416872
0.03762
11.081181
[ "s530602210", "s005626027" ]
u828365778
p03141
python
s458071085
s645077216
554
415
25,460
7,512
Accepted
Accepted
25.09
N = int(eval(input())) ABab = [] for i in range(N): a, b = list(map(int, input().split())) ABab.append([a+b, a, -1*b]) ABab.sort(reverse = True) ans = 0 for i in range(N): ans += ABab[i][i%2 + 1] print(ans)
N = int(eval(input())) ABa = [] ans = 0 for i in range(N): a, b = list(map(int, input().split())) ABa.append(a+b) ans -= b ABa.sort(reverse = True) for i in range(N): if i % 2 == 0: ans += ABa[i] print(ans)
10
12
221
235
N = int(eval(input())) ABab = [] for i in range(N): a, b = list(map(int, input().split())) ABab.append([a + b, a, -1 * b]) ABab.sort(reverse=True) ans = 0 for i in range(N): ans += ABab[i][i % 2 + 1] print(ans)
N = int(eval(input())) ABa = [] ans = 0 for i in range(N): a, b = list(map(int, input().split())) ABa.append(a + b) ans -= b ABa.sort(reverse=True) for i in range(N): if i % 2 == 0: ans += ABa[i] print(ans)
false
16.666667
[ "-ABab = []", "+ABa = []", "+ans = 0", "- ABab.append([a + b, a, -1 * b])", "-ABab.sort(reverse=True)", "-ans = 0", "+ ABa.append(a + b)", "+ ans -= b", "+ABa.sort(reverse=True)", "- ans += ABab[i][i % 2 + 1]", "+ if i % 2 == 0:", "+ ans += ABa[i]" ]
false
0.042404
0.041259
1.027751
[ "s458071085", "s645077216" ]
u451017206
p02850
python
s211257430
s489218599
1,970
1,161
74,204
90,064
Accepted
Accepted
41.07
from collections import Counter, defaultdict from queue import Queue G = defaultdict(list) C = Counter() N = int(eval(input())) ans = {} o = [] for i in range(N-1): a, b = list(map(int, input().split())) C[a] += 1 C[b] += 1 G[a].append(b) G[b].append(a) ans[(a, b)] = 0 o.appe...
from collections import Counter, defaultdict from sys import getrecursionlimit,setrecursionlimit setrecursionlimit(100*getrecursionlimit()) G = defaultdict(list) C = Counter() N = int(eval(input())) ans = {} o = [] for i in range(N-1): a, b = list(map(int, input().split())) C[a] += 1 C[b] += 1 ...
40
37
859
821
from collections import Counter, defaultdict from queue import Queue G = defaultdict(list) C = Counter() N = int(eval(input())) ans = {} o = [] for i in range(N - 1): a, b = list(map(int, input().split())) C[a] += 1 C[b] += 1 G[a].append(b) G[b].append(a) ans[(a, b)] = 0 o.append((a, b)) cs...
from collections import Counter, defaultdict from sys import getrecursionlimit, setrecursionlimit setrecursionlimit(100 * getrecursionlimit()) G = defaultdict(list) C = Counter() N = int(eval(input())) ans = {} o = [] for i in range(N - 1): a, b = list(map(int, input().split())) C[a] += 1 C[b] += 1 G[a...
false
7.5
[ "-from queue import Queue", "+from sys import getrecursionlimit, setrecursionlimit", "+setrecursionlimit(100 * getrecursionlimit())", "-cs = [0] * (N + 1)", "+a = C.most_common(1)[0][0]", "+b = C.most_common(1)[0][1]", "+visited = [False] * (N + 1)", "-def bfs(v):", "- ret = 0", "- visited =...
false
0.098028
0.038035
2.57728
[ "s211257430", "s489218599" ]
u769870836
p02727
python
s864043090
s988900138
273
244
22,504
22,504
Accepted
Accepted
10.62
x,y,a,b,c=list(map(int,input().split())) p=sorted(list(map(int,input().split())))[-x:] q=sorted(list(map(int,input().split())))[-y:] r=sorted(list(map(int,input().split()))) for i in range(len(p)): r.append(p[i]) for i in range(len(q)): r.append(q[i]) r=sorted(r)[-x-y:] print((sum(r)))
x,y,a,b,c=list(map(int,input().split())) p=sorted(list(map(int,input().split())))[-x:] q=sorted(list(map(int,input().split())))[-y:] print((sum(sorted(list(map(int,input().split()))+p+q)[-x-y:])))
11
4
294
191
x, y, a, b, c = list(map(int, input().split())) p = sorted(list(map(int, input().split())))[-x:] q = sorted(list(map(int, input().split())))[-y:] r = sorted(list(map(int, input().split()))) for i in range(len(p)): r.append(p[i]) for i in range(len(q)): r.append(q[i]) r = sorted(r)[-x - y :] print((sum(r)))
x, y, a, b, c = list(map(int, input().split())) p = sorted(list(map(int, input().split())))[-x:] q = sorted(list(map(int, input().split())))[-y:] print((sum(sorted(list(map(int, input().split())) + p + q)[-x - y :])))
false
63.636364
[ "-r = sorted(list(map(int, input().split())))", "-for i in range(len(p)):", "- r.append(p[i])", "-for i in range(len(q)):", "- r.append(q[i])", "-r = sorted(r)[-x - y :]", "-print((sum(r)))", "+print((sum(sorted(list(map(int, input().split())) + p + q)[-x - y :])))" ]
false
0.040681
0.042719
0.952289
[ "s864043090", "s988900138" ]
u171366497
p03045
python
s251573276
s746385734
522
453
6,916
5,412
Accepted
Accepted
13.22
N,M=list(map(int,input().split())) root=[-1]*N def search(i): if root[i]>=0: root[i]=search(root[i]) return root[i] return i for i in range(M): x,y,z=list(map(int,input().split())) x-=1 y-=1 rx=search(x) ry=search(y) if rx==ry: continue elif roo...
N,M=list(map(int,input().split())) root=[-1]*N def find(i): global root if root[i]>=0: root[i]=find(root[i]) return root[i] return i for i in range(M): X,Y,Z=list(map(int,input().split())) rx=find(X-1) ry=find(Y-1) if rx==ry: continue elif root[rx]<=...
26
25
508
508
N, M = list(map(int, input().split())) root = [-1] * N def search(i): if root[i] >= 0: root[i] = search(root[i]) return root[i] return i for i in range(M): x, y, z = list(map(int, input().split())) x -= 1 y -= 1 rx = search(x) ry = search(y) if rx == ry: conti...
N, M = list(map(int, input().split())) root = [-1] * N def find(i): global root if root[i] >= 0: root[i] = find(root[i]) return root[i] return i for i in range(M): X, Y, Z = list(map(int, input().split())) rx = find(X - 1) ry = find(Y - 1) if rx == ry: continue ...
false
3.846154
[ "-def search(i):", "+def find(i):", "+ global root", "- root[i] = search(root[i])", "+ root[i] = find(root[i])", "- x, y, z = list(map(int, input().split()))", "- x -= 1", "- y -= 1", "- rx = search(x)", "- ry = search(y)", "+ X, Y, Z = list(map(int, input().sp...
false
0.040895
0.040105
1.019696
[ "s251573276", "s746385734" ]
u911575040
p03044
python
s346678444
s827951929
839
742
70,692
70,688
Accepted
Accepted
11.56
N=int(eval(input())) p=[[]for _ in range(N+1)] for _ in range(N-1): u,v,w=list(map(int,input().split())) p[u].append((v,w)) p[v].append((u,w)) s=[(1,0)] l=[-1]*N while s: a,w=s.pop() l[a-1]=w%2 for b,c in p[a]: if l[b-1]==-1: s.append((b,w+c)) for i in l: print(i)
n=int(eval(input())) q=[[] for i in range(n+1)] for i in range(n-1): a,b,c=list(map(int,input().split())) q[a].append((b,c)) q[b].append((a,c)) l=[-1]*n s=[(1,0)] while s: a,w=s.pop() l[a-1]=w%2 for b,c in q[a]: if l[b-1]==-1: s.append((b,w+c)) for i in l: ...
16
18
291
320
N = int(eval(input())) p = [[] for _ in range(N + 1)] for _ in range(N - 1): u, v, w = list(map(int, input().split())) p[u].append((v, w)) p[v].append((u, w)) s = [(1, 0)] l = [-1] * N while s: a, w = s.pop() l[a - 1] = w % 2 for b, c in p[a]: if l[b - 1] == -1: s.append((b, ...
n = int(eval(input())) q = [[] for i in range(n + 1)] for i in range(n - 1): a, b, c = list(map(int, input().split())) q[a].append((b, c)) q[b].append((a, c)) l = [-1] * n s = [(1, 0)] while s: a, w = s.pop() l[a - 1] = w % 2 for b, c in q[a]: if l[b - 1] == -1: s.append((b, ...
false
11.111111
[ "-N = int(eval(input()))", "-p = [[] for _ in range(N + 1)]", "-for _ in range(N - 1):", "- u, v, w = list(map(int, input().split()))", "- p[u].append((v, w))", "- p[v].append((u, w))", "+n = int(eval(input()))", "+q = [[] for i in range(n + 1)]", "+for i in range(n - 1):", "+ a, b, c ...
false
0.036171
0.035877
1.008213
[ "s346678444", "s827951929" ]
u353797797
p03179
python
s618590717
s006576161
1,408
1,246
3,064
3,064
Accepted
Accepted
11.51
md = 10 ** 9 + 7 n = int(eval(input())) s = eval(input()) dp = [1] * n for i in range(n - 1): if s[i] == "<": for dpi in range(1, n - i - 1): dp[dpi] = (dp[dpi] + dp[dpi - 1]) % md dp = dp[:-1] else: for dpi in range(n - i - 2, 0, -1): dp[dpi] = (dp[dpi...
md = 10 ** 9 + 7 n = int(eval(input())) s = eval(input()) dp = [1] * n for i in range(n - 1): if s[i] == "<": L = dp[0] for dpi in range(1, n - i - 1): dp[dpi] = L = (dp[dpi] + L) % md dp = dp[:-1] else: R = dp[-1] for dpi in range(n - i - 2, 0, -1...
14
16
365
392
md = 10**9 + 7 n = int(eval(input())) s = eval(input()) dp = [1] * n for i in range(n - 1): if s[i] == "<": for dpi in range(1, n - i - 1): dp[dpi] = (dp[dpi] + dp[dpi - 1]) % md dp = dp[:-1] else: for dpi in range(n - i - 2, 0, -1): dp[dpi] = (dp[dpi] + dp[dpi + ...
md = 10**9 + 7 n = int(eval(input())) s = eval(input()) dp = [1] * n for i in range(n - 1): if s[i] == "<": L = dp[0] for dpi in range(1, n - i - 1): dp[dpi] = L = (dp[dpi] + L) % md dp = dp[:-1] else: R = dp[-1] for dpi in range(n - i - 2, 0, -1): ...
false
12.5
[ "+ L = dp[0]", "- dp[dpi] = (dp[dpi] + dp[dpi - 1]) % md", "+ dp[dpi] = L = (dp[dpi] + L) % md", "+ R = dp[-1]", "- dp[dpi] = (dp[dpi] + dp[dpi + 1]) % md", "+ dp[dpi] = R = (dp[dpi] + R) % md" ]
false
0.195709
0.035558
5.50391
[ "s618590717", "s006576161" ]
u197300773
p03127
python
s036069214
s562403564
189
91
14,428
16,280
Accepted
Accepted
51.85
import sys N=int(eval(input())) HP=list(map(int,input().split())) a=HP[0] b=HP[1] (x, lastx) = (0, 1) (y, lasty) = (1, 0) while b != 0: q = a // b (a, b) = (b, a % b) (x, lastx) = (lastx - q * x, x) (y, lasty) = (lasty - q * y, y) tmp=a for i in range(1,N-1): a=tmp ...
from fractions import gcd N=int(eval(input())) HP=list(map(int,input().split())) tmp=HP[0] for i in range(0,N): tmp=gcd(tmp,HP[i]) print(tmp)
36
11
627
160
import sys N = int(eval(input())) HP = list(map(int, input().split())) a = HP[0] b = HP[1] (x, lastx) = (0, 1) (y, lasty) = (1, 0) while b != 0: q = a // b (a, b) = (b, a % b) (x, lastx) = (lastx - q * x, x) (y, lasty) = (lasty - q * y, y) tmp = a for i in range(1, N - 1): a = tmp b = HP[i + 1]...
from fractions import gcd N = int(eval(input())) HP = list(map(int, input().split())) tmp = HP[0] for i in range(0, N): tmp = gcd(tmp, HP[i]) print(tmp)
false
69.444444
[ "-import sys", "+from fractions import gcd", "-a = HP[0]", "-b = HP[1]", "-(x, lastx) = (0, 1)", "-(y, lasty) = (1, 0)", "-while b != 0:", "- q = a // b", "- (a, b) = (b, a % b)", "- (x, lastx) = (lastx - q * x, x)", "- (y, lasty) = (lasty - q * y, y)", "-tmp = a", "-for i in ran...
false
0.037095
0.129576
0.286278
[ "s036069214", "s562403564" ]
u227082700
p03210
python
s164115613
s898338704
19
17
2,940
2,940
Accepted
Accepted
10.53
if int(eval(input())) in [3,5,7]:print('YES') else:print('NO')
if int(eval(input()))in[7,5,3]:print('YES') else:print('NO')
2
2
57
55
if int(eval(input())) in [3, 5, 7]: print("YES") else: print("NO")
if int(eval(input())) in [7, 5, 3]: print("YES") else: print("NO")
false
0
[ "-if int(eval(input())) in [3, 5, 7]:", "+if int(eval(input())) in [7, 5, 3]:" ]
false
0.060041
0.066254
0.906228
[ "s164115613", "s898338704" ]
u644907318
p03387
python
s222145071
s712727184
179
165
38,384
38,388
Accepted
Accepted
7.82
A,B,C = sorted(list(map(int,input().split()))) if (B-A)%2==0 and (C-B)%2==0: cnt = (B-A)//2+C-B elif (B-A)%2==0 and (C-B)%2==1: cnt = (B-A)//2+C-B elif (B-A)%2==1 and (C-B)%2==0: cnt = 1+(B+1-A)//2+C-B else: cnt = (B+1-A)//2+C+1-B print(cnt)
A,B,C = sorted(list(map(int,input().split()))) cnt = 0 cnt += C-B A += (C-B) if (C-A)%2==1: cnt += 1 C += 1 cnt += (C-A)//2 print(cnt)
10
9
266
150
A, B, C = sorted(list(map(int, input().split()))) if (B - A) % 2 == 0 and (C - B) % 2 == 0: cnt = (B - A) // 2 + C - B elif (B - A) % 2 == 0 and (C - B) % 2 == 1: cnt = (B - A) // 2 + C - B elif (B - A) % 2 == 1 and (C - B) % 2 == 0: cnt = 1 + (B + 1 - A) // 2 + C - B else: cnt = (B + 1 - A) // 2 + C + ...
A, B, C = sorted(list(map(int, input().split()))) cnt = 0 cnt += C - B A += C - B if (C - A) % 2 == 1: cnt += 1 C += 1 cnt += (C - A) // 2 print(cnt)
false
10
[ "-if (B - A) % 2 == 0 and (C - B) % 2 == 0:", "- cnt = (B - A) // 2 + C - B", "-elif (B - A) % 2 == 0 and (C - B) % 2 == 1:", "- cnt = (B - A) // 2 + C - B", "-elif (B - A) % 2 == 1 and (C - B) % 2 == 0:", "- cnt = 1 + (B + 1 - A) // 2 + C - B", "-else:", "- cnt = (B + 1 - A) // 2 + C + 1 ...
false
0.038254
0.108218
0.353488
[ "s222145071", "s712727184" ]
u761989513
p03238
python
s197094530
s804414137
20
17
3,316
2,940
Accepted
Accepted
15
n = int(eval(input())) if n == 1: print("Hello World") else: a = int(eval(input())) b = int(eval(input())) print((a + b))
n = int(eval(input())) if n == 1: print("Hello World") else: print((int(eval(input())) + int(eval(input()))))
7
5
123
101
n = int(eval(input())) if n == 1: print("Hello World") else: a = int(eval(input())) b = int(eval(input())) print((a + b))
n = int(eval(input())) if n == 1: print("Hello World") else: print((int(eval(input())) + int(eval(input()))))
false
28.571429
[ "- a = int(eval(input()))", "- b = int(eval(input()))", "- print((a + b))", "+ print((int(eval(input())) + int(eval(input()))))" ]
false
0.033214
0.036362
0.913445
[ "s197094530", "s804414137" ]
u075012704
p02744
python
s666414117
s046616844
190
117
17,904
14,788
Accepted
Accepted
38.42
from itertools import product N = int(input()) X = [chr(ord('a') + i) for i in range(N)] first_presence = {x: i for x, i in zip(X, list(range(N)))} ans = ['a'] R = ['a'] # 何文字目以降を変更するか for i in range(1, N): nr = [] for r in R: mr = max(r) for x in X: nr.append(r + x) ...
N = int(input()) X = [chr(ord('a') + i) for i in range(N)] first_presence = {x: i for x, i in zip(X, list(range(N)))} R = ['a'] for i in range(1, N): next_r = [] for r in R: max_s = max(r) for x in X[:first_presence[max_s] + 2]: next_r.append(r + x) R = next_r ans ...
22
16
476
359
from itertools import product N = int(input()) X = [chr(ord("a") + i) for i in range(N)] first_presence = {x: i for x, i in zip(X, list(range(N)))} ans = ["a"] R = ["a"] # 何文字目以降を変更するか for i in range(1, N): nr = [] for r in R: mr = max(r) for x in X: nr.append(r + x) if ...
N = int(input()) X = [chr(ord("a") + i) for i in range(N)] first_presence = {x: i for x, i in zip(X, list(range(N)))} R = ["a"] for i in range(1, N): next_r = [] for r in R: max_s = max(r) for x in X[: first_presence[max_s] + 2]: next_r.append(r + x) R = next_r ans = R ans.sort()...
false
27.272727
[ "-from itertools import product", "-", "-ans = [\"a\"]", "-# 何文字目以降を変更するか", "- nr = []", "+ next_r = []", "- mr = max(r)", "- for x in X:", "- nr.append(r + x)", "- if mr == x:", "- break", "- nr.append(r + chr(ord(mr) + 1))", "...
false
0.166121
0.141111
1.177234
[ "s666414117", "s046616844" ]
u362347649
p03162
python
s886403152
s516164261
382
204
3,060
3,064
Accepted
Accepted
46.6
N = int(eval(input())) A, B, C = 0, 0, 0 for _ in range(N): a, b, c = list(map(int, input().split())) A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c ans = max(A, B, C) print(ans)
import sys input=sys.stdin.readline def solve(): N = int(eval(input())) A, B, C = 0, 0, 0 for _ in range(N): a, b, c = list(map(int, input().split())) A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c return max(A, B, C) if __name__ == "__main__": print((solve()))
9
15
191
294
N = int(eval(input())) A, B, C = 0, 0, 0 for _ in range(N): a, b, c = list(map(int, input().split())) A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c ans = max(A, B, C) print(ans)
import sys input = sys.stdin.readline def solve(): N = int(eval(input())) A, B, C = 0, 0, 0 for _ in range(N): a, b, c = list(map(int, input().split())) A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c return max(A, B, C) if __name__ == "__main__": print((solve()))
false
40
[ "-N = int(eval(input()))", "-A, B, C = 0, 0, 0", "-for _ in range(N):", "- a, b, c = list(map(int, input().split()))", "- A, B, C = max(B, C) + a, max(C, A) + b, max(A, B) + c", "-ans = max(A, B, C)", "-print(ans)", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "+def sol...
false
0.036548
0.07531
0.485301
[ "s886403152", "s516164261" ]
u058781705
p03288
python
s310611166
s027252523
166
63
38,256
61,876
Accepted
Accepted
62.05
import collections def solve(): R = int(eval(input())) if R < 1200: print("ABC") elif R < 2800: print("ARC") else: print("AGC") if __name__ == "__main__": solve()
R = int(eval(input())) if R < 1200: print("ABC") elif R < 2800: print("ARC") else: print("AGC")
17
7
223
108
import collections def solve(): R = int(eval(input())) if R < 1200: print("ABC") elif R < 2800: print("ARC") else: print("AGC") if __name__ == "__main__": solve()
R = int(eval(input())) if R < 1200: print("ABC") elif R < 2800: print("ARC") else: print("AGC")
false
58.823529
[ "-import collections", "-", "-", "-def solve():", "- R = int(eval(input()))", "- if R < 1200:", "- print(\"ABC\")", "- elif R < 2800:", "- print(\"ARC\")", "- else:", "- print(\"AGC\")", "-", "-", "-if __name__ == \"__main__\":", "- solve()", "+R = i...
false
0.055377
0.03616
1.531463
[ "s310611166", "s027252523" ]
u895592784
p02732
python
s115746472
s760254165
552
377
26,780
26,780
Accepted
Accepted
31.7
''' import numpy as np N = int(input()) A = np.array(list(map(int, input().split(' ')))) num_sum = 0 remove_array = np.array([], int) for i in range(N): c1 = np.count_nonzero(A == i + 1) c2 = np.count_nonzero(A == A[i]) if c2 <= 1: remove_array = np.append(remove_array, 0) else: ...
''' import numpy as np N = int(input()) A = np.array(list(map(int, input().split(' ')))) num_sum = 0 remove_array = np.array([], int) for i in range(N): c1 = np.count_nonzero(A == i + 1) c2 = np.count_nonzero(A == A[i]) if c2 <= 1: remove_array = np.append(remove_array, 0) ← appendがネックになって...
28
28
792
867
""" import numpy as np N = int(input()) A = np.array(list(map(int, input().split(' ')))) num_sum = 0 remove_array = np.array([], int) for i in range(N): c1 = np.count_nonzero(A == i + 1) c2 = np.count_nonzero(A == A[i]) if c2 <= 1: remove_array = np.append(remove_array, 0) else: remove_a...
""" import numpy as np N = int(input()) A = np.array(list(map(int, input().split(' ')))) num_sum = 0 remove_array = np.array([], int) for i in range(N): c1 = np.count_nonzero(A == i + 1) c2 = np.count_nonzero(A == A[i]) if c2 <= 1: remove_array = np.append(remove_array, 0) ← appendがネックになってる? els...
false
0
[ "- remove_array = np.append(remove_array, 0)", "+ remove_array = np.append(remove_array, 0) ← appendがネックになってる?", "-cnt = collections.Counter(A)", "+cnt = collections.Counter(A) # リストやイテレータから値の出現回数をカウントできる(出力は辞書型)", "- tmp -= cnt[A[i]] * (cnt[A[i]] - 1) // 2", "- tmp += (cnt[A[i]] - 1)...
false
0.037755
0.048235
0.782728
[ "s115746472", "s760254165" ]
u798818115
p03164
python
s363809682
s253710813
356
260
80,844
41,964
Accepted
Accepted
26.97
# coding: utf-8 # Your code here! # coding: utf-8 # Your code here! N,W=list(map(int,input().split())) l=[10**10]*(10**5+1) l[0]=0 dp=l[:] #indexが価値 itemが重さ for i in range(N): w,v=list(map(int,input().split())) for index,item in enumerate(l): if item!=10**10 and item+w<=W: d...
# coding: utf-8 # Your code here! N,W=list(map(int,input().split())) jwels=[] for _ in range(N): jwels.append(list(map(int,input().split()))) dp=[10**10]*(10**5+1) dp[0]=0 for w,v in jwels: for i in range(10**5+1)[::-1]: if dp[i]!=10**10 and i+v<=10**5: dp[i+v]=min(dp[i]+w...
26
25
482
433
# coding: utf-8 # Your code here! # coding: utf-8 # Your code here! N, W = list(map(int, input().split())) l = [10**10] * (10**5 + 1) l[0] = 0 dp = l[:] # indexが価値 itemが重さ for i in range(N): w, v = list(map(int, input().split())) for index, item in enumerate(l): if item != 10**10 and item + w <= W: ...
# coding: utf-8 # Your code here! N, W = list(map(int, input().split())) jwels = [] for _ in range(N): jwels.append(list(map(int, input().split()))) dp = [10**10] * (10**5 + 1) dp[0] = 0 for w, v in jwels: for i in range(10**5 + 1)[::-1]: if dp[i] != 10**10 and i + v <= 10**5: dp[i + v] = mi...
false
3.846154
[ "-# coding: utf-8", "-# Your code here!", "-l = [10**10] * (10**5 + 1)", "-l[0] = 0", "-dp = l[:]", "-# indexが価値 itemが重さ", "-for i in range(N):", "- w, v = list(map(int, input().split()))", "- for index, item in enumerate(l):", "- if item != 10**10 and item + w <= W:", "- ...
false
0.219457
0.098679
2.223957
[ "s363809682", "s253710813" ]
u808427016
p03745
python
s942330633
s152047304
79
66
14,224
14,252
Accepted
Accepted
16.46
N = int(eval(input())) A = [int(_) for _ in input().split()] def solve(N, A): if N <= 2: return 1 s = 0 result = 1 i = 0 while i < N-1: r = A[i+1] - A[i] if (r > 0 and s < 0) or (r < 0 and s > 0): result += 1 s = 0 elif r != 0: ...
N = int(eval(input())) A = [int(_) for _ in input().split()] def solve(N, A): s = 0 result = 1 for i in range(N-1): r = A[i+1] - A[i] if r * s < 0: result += 1 s = 0 elif r != 0: s = r return result print((solve(N, A)))
20
16
389
305
N = int(eval(input())) A = [int(_) for _ in input().split()] def solve(N, A): if N <= 2: return 1 s = 0 result = 1 i = 0 while i < N - 1: r = A[i + 1] - A[i] if (r > 0 and s < 0) or (r < 0 and s > 0): result += 1 s = 0 elif r != 0: ...
N = int(eval(input())) A = [int(_) for _ in input().split()] def solve(N, A): s = 0 result = 1 for i in range(N - 1): r = A[i + 1] - A[i] if r * s < 0: result += 1 s = 0 elif r != 0: s = r return result print((solve(N, A)))
false
20
[ "- if N <= 2:", "- return 1", "- i = 0", "- while i < N - 1:", "+ for i in range(N - 1):", "- if (r > 0 and s < 0) or (r < 0 and s > 0):", "+ if r * s < 0:", "- i += 1" ]
false
0.078041
0.069303
1.126075
[ "s942330633", "s152047304" ]
u095426154
p02787
python
s252574247
s865854703
602
399
125,404
42,732
Accepted
Accepted
33.72
# coding: utf-8 H,N=list(map(int,input().split())) AB=[[0,0]] for i in range(N): AB.append(list(map(int,input().split()))) INF=10**9 dp=[[INF for i in range(H+1)] for j in range(N+1)] for i in range(N+1): dp[i][0]=0 for i in range(1,N+1): for j in range(1,H+1): dp[i][j]=min(dp[i...
# coding: utf-8 H,N=list(map(int,input().split())) AB=[[0,0]] for i in range(N): AB.append(list(map(int,input().split()))) INF=10**9 dp=[INF for i in range(H+1)] dp[0]=0 for i in range(1,N+1): for j in range(1,H+1): dp[j]=min(dp[j],dp[max(0,j-AB[i][0])] + AB[i][1]) print((dp[H]))
22
16
491
308
# coding: utf-8 H, N = list(map(int, input().split())) AB = [[0, 0]] for i in range(N): AB.append(list(map(int, input().split()))) INF = 10**9 dp = [[INF for i in range(H + 1)] for j in range(N + 1)] for i in range(N + 1): dp[i][0] = 0 for i in range(1, N + 1): for j in range(1, H + 1): dp[i][j] = m...
# coding: utf-8 H, N = list(map(int, input().split())) AB = [[0, 0]] for i in range(N): AB.append(list(map(int, input().split()))) INF = 10**9 dp = [INF for i in range(H + 1)] dp[0] = 0 for i in range(1, N + 1): for j in range(1, H + 1): dp[j] = min(dp[j], dp[max(0, j - AB[i][0])] + AB[i][1]) print((dp[...
false
27.272727
[ "-dp = [[INF for i in range(H + 1)] for j in range(N + 1)]", "-for i in range(N + 1):", "- dp[i][0] = 0", "+dp = [INF for i in range(H + 1)]", "+dp[0] = 0", "- dp[i][j] = min(dp[i - 1][j], dp[i][max(j - AB[i][0], 0)] + AB[i][1])", "- # print(dp[i-1][j],dp[i-1][max(j-AB[i][0],0)] + AB[i]...
false
0.58239
0.117575
4.953347
[ "s252574247", "s865854703" ]
u219417113
p02724
python
s802500764
s491999217
172
17
38,256
2,940
Accepted
Accepted
90.12
X = int(eval(input())) a = X // 500 b = (X % 500) // 5 print((a * 1000 + b * 5))
X = int(eval(input())) ans = (X // 500) * 1000 X = X % 500 ans += (X // 5) * 5 print(ans)
5
7
78
92
X = int(eval(input())) a = X // 500 b = (X % 500) // 5 print((a * 1000 + b * 5))
X = int(eval(input())) ans = (X // 500) * 1000 X = X % 500 ans += (X // 5) * 5 print(ans)
false
28.571429
[ "-a = X // 500", "-b = (X % 500) // 5", "-print((a * 1000 + b * 5))", "+ans = (X // 500) * 1000", "+X = X % 500", "+ans += (X // 5) * 5", "+print(ans)" ]
false
0.103569
0.038852
2.66569
[ "s802500764", "s491999217" ]
u561083515
p02804
python
s013317030
s062207246
282
253
22,788
22,424
Accepted
Accepted
10.28
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) def getComb(n, r, p): if (r < 0) or (n < r): return 0 r = min(r, n - r) return fact[n] * factinv[r] * factinv[n-r] % p N,K = list(map(int,input().split())) A = sorted([int(i) for i in input().split()]) # ref: https:...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) class Combination(): # コンストラクタ def __init__(self, N:int, P:int): self.N = N self.P = P # fact[i] = (i! mod P) self.fact = [1, 1] # factinv[i] = ((i!)^(-1) mod P) self.factinv = [1...
38
54
899
1,405
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) def getComb(n, r, p): if (r < 0) or (n < r): return 0 r = min(r, n - r) return fact[n] * factinv[r] * factinv[n - r] % p N, K = list(map(int, input().split())) A = sorted([int(i) for i in input().split()]) # ref: https://www.pla...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) class Combination: # コンストラクタ def __init__(self, N: int, P: int): self.N = N self.P = P # fact[i] = (i! mod P) self.fact = [1, 1] # factinv[i] = ((i!)^(-1) mod P) self.factinv = [1, 1] # ...
false
29.62963
[ "-def getComb(n, r, p):", "- if (r < 0) or (n < r):", "- return 0", "- r = min(r, n - r)", "- return fact[n] * factinv[r] * factinv[n - r] % p", "+class Combination:", "+ # コンストラクタ", "+ def __init__(self, N: int, P: int):", "+ self.N = N", "+ self.P = P", "+ ...
false
0.050781
0.044379
1.144262
[ "s013317030", "s062207246" ]
u532514769
p02947
python
s479545306
s012748576
590
513
25,432
25,432
Accepted
Accepted
13.05
def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] for p in range(2,r+1): pivot = denominator[p - 1] if pivot > 1: offset = (n - r) % p ...
n = int(eval(input())) s = [eval(input()) for i in range(n)] for k in range(n): s[k]=sorted(list(s[k])) s=sorted(s) c = 1 count = 0 for x in range (n-1): if s[x]==s[x+1]: c += 1 else: if c>= 2: count += c*(c-1)//2 c = 1 if c >=2...
42
20
922
349
def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] for p in range(2, r + 1): pivot = denominator[p - 1] if pivot > 1: offset = (n ...
n = int(eval(input())) s = [eval(input()) for i in range(n)] for k in range(n): s[k] = sorted(list(s[k])) s = sorted(s) c = 1 count = 0 for x in range(n - 1): if s[x] == s[x + 1]: c += 1 else: if c >= 2: count += c * (c - 1) // 2 c = 1 if c >= 2: count += c * (c - 1) ...
false
52.380952
[ "-def cmb(n, r):", "- if n - r < r:", "- r = n - r", "- if r == 0:", "- return 1", "- if r == 1:", "- return n", "- numerator = [n - r + k + 1 for k in range(r)]", "- denominator = [k + 1 for k in range(r)]", "- for p in range(2, r + 1):", "- pivot =...
false
0.067063
0.065512
1.023674
[ "s479545306", "s012748576" ]
u790710233
p02844
python
s041930558
s103002050
116
41
75,012
10,620
Accepted
Accepted
64.66
n = int(eval(input())) s = list(map(int, eval(input()))) def is_Lucky(x): x = tuple(map(int, '{:03d}'.format(x))) idx = 0 for c in s: if x[idx] == c: idx += 1 if idx == 3: return True else: return False ans = 0 for i in range(1...
import bisect from collections import defaultdict n = int(eval(input())) s = eval(input()) cnt = defaultdict(list) for i, c in enumerate(s): cnt[c].append(i) def is_Lucky(x): x = '{:03d}'.format(x) if not cnt[x[0]]: return False idx = cnt[x[0]][0] for c in x[1:]: i...
21
29
365
543
n = int(eval(input())) s = list(map(int, eval(input()))) def is_Lucky(x): x = tuple(map(int, "{:03d}".format(x))) idx = 0 for c in s: if x[idx] == c: idx += 1 if idx == 3: return True else: return False ans = 0 for i in range(1000): if is_L...
import bisect from collections import defaultdict n = int(eval(input())) s = eval(input()) cnt = defaultdict(list) for i, c in enumerate(s): cnt[c].append(i) def is_Lucky(x): x = "{:03d}".format(x) if not cnt[x[0]]: return False idx = cnt[x[0]][0] for c in x[1:]: i = bisect.bisect...
false
27.586207
[ "+import bisect", "+from collections import defaultdict", "+", "-s = list(map(int, eval(input())))", "+s = eval(input())", "+cnt = defaultdict(list)", "+for i, c in enumerate(s):", "+ cnt[c].append(i)", "- x = tuple(map(int, \"{:03d}\".format(x)))", "- idx = 0", "- for c in s:", "-...
false
0.045091
0.038128
1.182632
[ "s041930558", "s103002050" ]
u777923818
p03040
python
s524062361
s915175285
1,759
885
19,044
19,040
Accepted
Accepted
49.69
from heapq import heappush, heappop, heappushpop import sys #input = sys.stdin.readline def inpl(): return list(map(int, input().split())) Q = int(eval(input())) L = [] R = [] B = 0 M = 0 for _ in range(Q): q = inpl() if len(q) == 3: B += q[2] if len(R) == 0: L.ap...
from heapq import heappush, heappop, heappushpop import sys input = sys.stdin.readline def inpl(): return list(map(int, input().split())) Q = int(eval(input())) L = [] R = [] B = 0 M = 0 for _ in range(Q): q = inpl() if len(q) == 3: B += q[2] if len(R) == 0: L.app...
30
30
702
701
from heapq import heappush, heappop, heappushpop import sys # input = sys.stdin.readline def inpl(): return list(map(int, input().split())) Q = int(eval(input())) L = [] R = [] B = 0 M = 0 for _ in range(Q): q = inpl() if len(q) == 3: B += q[2] if len(R) == 0: L.append(-q[1]) ...
from heapq import heappush, heappop, heappushpop import sys input = sys.stdin.readline def inpl(): return list(map(int, input().split())) Q = int(eval(input())) L = [] R = [] B = 0 M = 0 for _ in range(Q): q = inpl() if len(q) == 3: B += q[2] if len(R) == 0: L.append(-q[1]) ...
false
0
[ "-# input = sys.stdin.readline", "+input = sys.stdin.readline", "+", "+" ]
false
0.032076
0.034286
0.935543
[ "s524062361", "s915175285" ]
u342537066
p00003
python
s697457483
s494970630
50
40
6,720
6,720
Accepted
Accepted
20
n=int(eval(input())) while n: n-=1 lis=list(map(int,input().split())) for i in range(3): for j in range(i+1,3): if lis[i]<lis[j]: a=lis[i] lis[i]=lis[j] lis[j]=a c,a,b=lis if c**2==a**2+b**2: print("YES") ...
n=int(eval(input())) for i in range(n): edge=input().split() edge=[int(j) for j in edge] edge.sort() if edge[2]**2==edge[0]**2+edge[1]**2: print("YES") else : print("NO")
20
11
352
220
n = int(eval(input())) while n: n -= 1 lis = list(map(int, input().split())) for i in range(3): for j in range(i + 1, 3): if lis[i] < lis[j]: a = lis[i] lis[i] = lis[j] lis[j] = a c, a, b = lis if c**2 == a**2 + b**2: print(...
n = int(eval(input())) for i in range(n): edge = input().split() edge = [int(j) for j in edge] edge.sort() if edge[2] ** 2 == edge[0] ** 2 + edge[1] ** 2: print("YES") else: print("NO")
false
45
[ "-while n:", "- n -= 1", "- lis = list(map(int, input().split()))", "- for i in range(3):", "- for j in range(i + 1, 3):", "- if lis[i] < lis[j]:", "- a = lis[i]", "- lis[i] = lis[j]", "- lis[j] = a", "- c, a, b = lis", "...
false
0.042317
0.042304
1.000298
[ "s697457483", "s494970630" ]
u843175622
p03331
python
s333843540
s812813150
30
26
9,156
9,084
Accepted
Accepted
13.33
n = sum(map(int, eval(input()))) print((10 if n == 1 else n))
s = sum(map(int, list(eval(input())))) print((10 if s == 1 else s))
2
2
54
60
n = sum(map(int, eval(input()))) print((10 if n == 1 else n))
s = sum(map(int, list(eval(input())))) print((10 if s == 1 else s))
false
0
[ "-n = sum(map(int, eval(input())))", "-print((10 if n == 1 else n))", "+s = sum(map(int, list(eval(input()))))", "+print((10 if s == 1 else s))" ]
false
0.036974
0.034829
1.06161
[ "s333843540", "s812813150" ]
u131984977
p02402
python
s912596794
s711054373
40
20
8,032
8,656
Accepted
Accepted
50
eval(input()) data = [int(i) for i in input().split()] minimum = min(data) maximum = max(data) total = sum(data) print((minimum, maximum, total))
eval(input()) data = [int(i) for i in input().split()] print((min(data), max(data), sum(data)))
8
4
146
91
eval(input()) data = [int(i) for i in input().split()] minimum = min(data) maximum = max(data) total = sum(data) print((minimum, maximum, total))
eval(input()) data = [int(i) for i in input().split()] print((min(data), max(data), sum(data)))
false
50
[ "-minimum = min(data)", "-maximum = max(data)", "-total = sum(data)", "-print((minimum, maximum, total))", "+print((min(data), max(data), sum(data)))" ]
false
0.104057
0.076123
1.366959
[ "s912596794", "s711054373" ]
u083960235
p03998
python
s201692959
s825474910
44
40
5,484
5,204
Accepted
Accepted
9.09
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...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_upp...
58
49
1,481
1,228
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...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase...
false
15.517241
[ "-import sys, re, os", "+import sys, re", "-from itertools import permutations, combinations, product, accumulate", "+from itertools import accumulate, permutations, combinations, product", "+from bisect import bisect, bisect_left", "+from heapq import heappush, heappop", "+from functools import reduce"...
false
0.039264
0.039248
1.00039
[ "s201692959", "s825474910" ]
u784022244
p02899
python
s743309565
s583790383
165
107
13,880
84,356
Accepted
Accepted
35.15
N=int(input()) A=list(map(int, input().split())) B=[-1]*N for i in range(N): B[A[i]-1]=i+1 for b in B: print(b, end=" ")
N=int(eval(input())) A=list(map(int, input().split())) ans=[0]*N for i in range(N): a=A[i] ans[a-1]=i+1 print((*ans))
9
9
136
127
N = int(input()) A = list(map(int, input().split())) B = [-1] * N for i in range(N): B[A[i] - 1] = i + 1 for b in B: print(b, end=" ")
N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N for i in range(N): a = A[i] ans[a - 1] = i + 1 print((*ans))
false
0
[ "-N = int(input())", "+N = int(eval(input()))", "-B = [-1] * N", "+ans = [0] * N", "- B[A[i] - 1] = i + 1", "-for b in B:", "- print(b, end=\" \")", "+ a = A[i]", "+ ans[a - 1] = i + 1", "+print((*ans))" ]
false
0.037095
0.042472
0.873388
[ "s743309565", "s583790383" ]
u729133443
p02889
python
s498785018
s260270603
542
347
38,088
36,196
Accepted
Accepted
35.98
def main(): import sys from scipy.sparse.csgraph import floyd_warshall as f n,m,l,*t=list(map(int,sys.stdin.buffer.read().split())) d=[[0]*(n+1)for _ in range(n+1)] for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c d=f(f(d,0)<=l)-1 d[d>n]=-1 d=d.astype(int) print(('\n'.join(map(str,[d[i]for i in...
def main(): import sys from scipy.sparse.csgraph import floyd_warshall as f n,m,l,*t=list(map(int,sys.stdin.buffer.read().split())) d=[[0]*(n+1)for _ in range(n+1)] for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c d=f(f(d,0)<=l)-1 d[d==float('inf')]=-1 print(('\n'.join(map(str,list(map(int,[d[i]fo...
11
10
351
353
def main(): import sys from scipy.sparse.csgraph import floyd_warshall as f n, m, l, *t = list(map(int, sys.stdin.buffer.read().split())) d = [[0] * (n + 1) for _ in range(n + 1)] for a, b, c in zip(*[iter(t[: m * 3])] * 3): d[a][b] = c d = f(f(d, 0) <= l) - 1 d[d > n] = -1 d = ...
def main(): import sys from scipy.sparse.csgraph import floyd_warshall as f n, m, l, *t = list(map(int, sys.stdin.buffer.read().split())) d = [[0] * (n + 1) for _ in range(n + 1)] for a, b, c in zip(*[iter(t[: m * 3])] * 3): d[a][b] = c d = f(f(d, 0) <= l) - 1 d[d == float("inf")] =...
false
9.090909
[ "- d[d > n] = -1", "- d = d.astype(int)", "- print((\"\\n\".join(map(str, [d[i] for i in zip(*[iter(t[m * 3 + 1 :])] * 2)]))))", "+ d[d == float(\"inf\")] = -1", "+ print(", "+ (", "+ \"\\n\".join(", "+ map(", "+ str,", "+ ...
false
0.684702
0.850468
0.805089
[ "s498785018", "s260270603" ]
u017810624
p03152
python
s826966794
s502539831
840
757
12,916
12,020
Accepted
Accepted
9.88
import bisect n,m=list(map(int,input().split())) a=list(map(int,input().split())) b=list(map(int,input().split())) x=10**9+7 if len(set(a))!=len(a) or len(set(b))!=len(b): print((0)) else: a.sort() b.sort() L=[] for i in range(n): l=[] for j in range(m): l.append(0) L.append(l...
n,m=list(map(int,input().split())) a=list(map(int,input().split())) b=list(map(int,input().split())) x=10**9+7 A=set(a);B=set(b) if len(A)!=len(a) or len(B)!=len(b): print((0)) else: L=[] for i in range(n): l=[] for j in range(m): l.append(0) L.append(l) ct=1;ctn=0;ctm=0 for k...
34
31
686
603
import bisect n, m = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) x = 10**9 + 7 if len(set(a)) != len(a) or len(set(b)) != len(b): print((0)) else: a.sort() b.sort() L = [] for i in range(n): l = [] for j in range(m): ...
n, m = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) x = 10**9 + 7 A = set(a) B = set(b) if len(A) != len(a) or len(B) != len(b): print((0)) else: L = [] for i in range(n): l = [] for j in range(m): l.append(0) L.a...
false
8.823529
[ "-import bisect", "-", "-if len(set(a)) != len(a) or len(set(b)) != len(b):", "+A = set(a)", "+B = set(b)", "+if len(A) != len(a) or len(B) != len(b):", "- a.sort()", "- b.sort()", "- A = set(a)", "- B = set(b)", "- L[bisect.bisect_left(a, k)][bisect.bisect_left(b, k)] = k...
false
0.084297
0.046637
1.8075
[ "s826966794", "s502539831" ]
u678167152
p02954
python
s887416394
s204658838
483
115
398,688
95,860
Accepted
Accepted
76.19
S = eval(input()) N = len(S) db = [[0]*N for _ in range(400)] db[0] = [i+1 if S[i]=='R' else i-1 for i in range(N)] for i in range(1,400): for j in range(N): db[i][j] = db[i-1][db[i-1][j]] ans = [0]*N for i in range(N): K = 10**5 p = 0 pos = i while K: if K%2: pos = db[p][pos] ...
S = eval(input()) N = len(S) db = [[0]*N for _ in range(20)] db[0] = [i+1 if S[i]=='R' else i-1 for i in range(N)] for i in range(1,20): for j in range(N): db[i][j] = db[i-1][db[i-1][j]] ans = [0]*N for i in range(N): K = 10**5 p = 0 pos = i while K: if K%2: pos = db[p][pos] ...
19
19
365
363
S = eval(input()) N = len(S) db = [[0] * N for _ in range(400)] db[0] = [i + 1 if S[i] == "R" else i - 1 for i in range(N)] for i in range(1, 400): for j in range(N): db[i][j] = db[i - 1][db[i - 1][j]] ans = [0] * N for i in range(N): K = 10**5 p = 0 pos = i while K: if K % 2: ...
S = eval(input()) N = len(S) db = [[0] * N for _ in range(20)] db[0] = [i + 1 if S[i] == "R" else i - 1 for i in range(N)] for i in range(1, 20): for j in range(N): db[i][j] = db[i - 1][db[i - 1][j]] ans = [0] * N for i in range(N): K = 10**5 p = 0 pos = i while K: if K % 2: ...
false
0
[ "-db = [[0] * N for _ in range(400)]", "+db = [[0] * N for _ in range(20)]", "-for i in range(1, 400):", "+for i in range(1, 20):" ]
false
0.036009
0.036076
0.998123
[ "s887416394", "s204658838" ]
u642874916
p03038
python
s436944226
s292232735
810
512
86,324
93,208
Accepted
Accepted
36.79
import sys import math import heapq import bisect input = sys.stdin.readline MOD = 10 ** 9 + 7 def main(): N, M = list(map(int, input().split())) # A = [] # for i in map(int, input().split()): # bisect.insort(A, i) # for i in range(M): # B, C = map(int, input().spli...
import sys import math import heapq import bisect input = sys.stdin.readline MOD = 10 ** 9 + 7 def my_sol(N, M): _A = {} A = [] for i in map(int, input().split()): if i in _A: _A[i] += 1 else: _A[i] = 1 for (num, c) in list(_A.items()): ...
77
105
1,549
2,035
import sys import math import heapq import bisect input = sys.stdin.readline MOD = 10**9 + 7 def main(): N, M = list(map(int, input().split())) # A = [] # for i in map(int, input().split()): # bisect.insort(A, i) # for i in range(M): # B, C = map(int, input().split()) _A = {} ...
import sys import math import heapq import bisect input = sys.stdin.readline MOD = 10**9 + 7 def my_sol(N, M): _A = {} A = [] for i in map(int, input().split()): if i in _A: _A[i] += 1 else: _A[i] = 1 for (num, c) in list(_A.items()): heapq.heappush(A, ...
false
26.666667
[ "-def main():", "- N, M = list(map(int, input().split()))", "- # A = []", "- # for i in map(int, input().split()):", "- # bisect.insort(A, i)", "- # for i in range(M):", "- # B, C = map(int, input().split())", "+def my_sol(N, M):", "+def main():", "+ N, M = list(map(in...
false
0.063749
0.042707
1.492697
[ "s436944226", "s292232735" ]
u098012509
p03163
python
s951455497
s288291553
502
431
119,148
118,512
Accepted
Accepted
14.14
import sys input = sys.stdin.readline def main(): N, W = [int(x) for x in input().split()] wv = [[int(x) for x in input().split()] for _ in range(N)] dp = [[0] * (W + 1) for j in range(N)] for j in range(N): for i in range(W + 1): if j == 0: if i < ...
import sys input = sys.stdin.readline def main(): N, W = [int(x) for x in input().split()] wv = [[int(x) for x in input().split()] for _ in range(N)] dp = [[0] * (W + 1) for j in range(N + 1)] for j in range(N): for i in range(W + 1): if i < wv[j][0]: ...
27
22
672
509
import sys input = sys.stdin.readline def main(): N, W = [int(x) for x in input().split()] wv = [[int(x) for x in input().split()] for _ in range(N)] dp = [[0] * (W + 1) for j in range(N)] for j in range(N): for i in range(W + 1): if j == 0: if i < wv[j][0]: ...
import sys input = sys.stdin.readline def main(): N, W = [int(x) for x in input().split()] wv = [[int(x) for x in input().split()] for _ in range(N)] dp = [[0] * (W + 1) for j in range(N + 1)] for j in range(N): for i in range(W + 1): if i < wv[j][0]: dp[j + 1][i] ...
false
18.518519
[ "- dp = [[0] * (W + 1) for j in range(N)]", "+ dp = [[0] * (W + 1) for j in range(N + 1)]", "- if j == 0:", "- if i < wv[j][0]:", "- continue", "- dp[j][i] = wv[j][1]", "+ if i < wv[j][0]:", "+ dp[j + 1][i] = d...
false
0.046939
0.045893
1.022793
[ "s951455497", "s288291553" ]
u818349438
p03274
python
s307365620
s022833038
295
171
67,668
14,480
Accepted
Accepted
42.03
import sys import math # noqa import bisect # noqa import queue # noqa def input(): return sys.stdin.readline().rstrip() def solve(X, K): N = len(X) cumsum = [0 for _ in range(N)] for i in range(1, N): cumsum[i] = abs(X[i] - X[i - 1]) + cumsum[i - 1] idx_zero = bise...
n,k = list(map(int,input().split())) a = list(map(int,input().split())) minus = [] plus = [] ans = 10**100 for x in a: if x <0:minus.append(-x) else:plus.append(x) minus = minus[::-1] for i in range(min(k+1,len(minus)+1)):#負のものをi個通る if k-i > len(plus):continue res = 0 if i-1 >=0:res += m...
47
27
1,036
598
import sys import math # noqa import bisect # noqa import queue # noqa def input(): return sys.stdin.readline().rstrip() def solve(X, K): N = len(X) cumsum = [0 for _ in range(N)] for i in range(1, N): cumsum[i] = abs(X[i] - X[i - 1]) + cumsum[i - 1] idx_zero = bisect.bisect_left(X, 0...
n, k = list(map(int, input().split())) a = list(map(int, input().split())) minus = [] plus = [] ans = 10**100 for x in a: if x < 0: minus.append(-x) else: plus.append(x) minus = minus[::-1] for i in range(min(k + 1, len(minus) + 1)): # 負のものをi個通る if k - i > len(plus): continue re...
false
42.553191
[ "-import sys", "-import math # noqa", "-import bisect # noqa", "-import queue # noqa", "-", "-", "-def input():", "- return sys.stdin.readline().rstrip()", "-", "-", "-def solve(X, K):", "- N = len(X)", "- cumsum = [0 for _ in range(N)]", "- for i in range(1, N):", "- ...
false
0.00785
0.04371
0.179591
[ "s307365620", "s022833038" ]
u729417323
p02973
python
s709022297
s876315785
403
250
7,836
11,032
Accepted
Accepted
37.97
def binSearch(S, x): a = -1 b = len(S)-1 while(a + 1 < b): c = (a+b)//2 if S[c] >= x: a = c else: b = c return b def main(): N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] S = [] for a in A: ...
# --*-coding:utf-8-*-- import bisect N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] Q = [] x = 0 for a in A: idx = bisect.bisect_right(Q, -a) if idx >= len(Q): x += 1 Q.append(-a) else: Q[idx] = -a print(x)
32
22
507
292
def binSearch(S, x): a = -1 b = len(S) - 1 while a + 1 < b: c = (a + b) // 2 if S[c] >= x: a = c else: b = c return b def main(): N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] S = [] for a in A: if len(S) == 0 ...
# --*-coding:utf-8-*-- import bisect N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] Q = [] x = 0 for a in A: idx = bisect.bisect_right(Q, -a) if idx >= len(Q): x += 1 Q.append(-a) else: Q[idx] = -a print(x)
false
31.25
[ "-def binSearch(S, x):", "- a = -1", "- b = len(S) - 1", "- while a + 1 < b:", "- c = (a + b) // 2", "- if S[c] >= x:", "- a = c", "- else:", "- b = c", "- return b", "+# --*-coding:utf-8-*--", "+import bisect", "-", "-def main():", ...
false
0.050268
0.140937
0.356673
[ "s709022297", "s876315785" ]
u850491413
p03216
python
s591293089
s127759977
2,220
1,720
143,060
143,060
Accepted
Accepted
22.52
import sys def input(): return sys.stdin.readline().strip() N = int(eval(input())) S = eval(input()) Q = int(eval(input())) k = list(map(int, input().split())) DM_total = [(0,0,0)] C_list = [] for i in range(N): if S[i] == "D": DM_total.append((DM_total[-1][0] + 1, DM_total[-1][1], DM_total[-1][2...
import sys def input(): return sys.stdin.readline().strip() N = int(eval(input())) S = eval(input()) Q = int(eval(input())) k = list(map(int, input().split())) DM_total = [(0,0,0)] C_list = [] for i in range(N): if S[i] == "D": DM_total.append((DM_total[-1][0] + 1, DM_total[-1][1], DM_total[-1][2])...
35
33
827
823
import sys def input(): return sys.stdin.readline().strip() N = int(eval(input())) S = eval(input()) Q = int(eval(input())) k = list(map(int, input().split())) DM_total = [(0, 0, 0)] C_list = [] for i in range(N): if S[i] == "D": DM_total.append((DM_total[-1][0] + 1, DM_total[-1][1], DM_total[-1][2]...
import sys def input(): return sys.stdin.readline().strip() N = int(eval(input())) S = eval(input()) Q = int(eval(input())) k = list(map(int, input().split())) DM_total = [(0, 0, 0)] C_list = [] for i in range(N): if S[i] == "D": DM_total.append((DM_total[-1][0] + 1, DM_total[-1][1], DM_total[-1][2]...
false
5.714286
[ "-for c in C_list:", "- for q in range(Q):", "+for q in range(Q):", "+ for c in C_list:" ]
false
0.041772
0.040131
1.040876
[ "s591293089", "s127759977" ]
u600402037
p02733
python
s934120435
s892014998
336
154
45,404
68,976
Accepted
Accepted
54.17
import sys from itertools import accumulate sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) H, W, K = lr() S = [list(map(int, sr())) for _ in range(H)] Scum = [list(accumulate(x)) for x in S] answer = 10000 for bit in range(1<<(H-1)): count =...
# coding: utf-8 import sys from itertools import accumulate sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) H, W, K = lr() S = [list(map(int, sr())) for _ in range(H)] Scum = [list(accumulate(row)) for row in S] # H方向はbit全探索、W方向はGreedyに INF = 10 ...
40
46
989
1,104
import sys from itertools import accumulate sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) H, W, K = lr() S = [list(map(int, sr())) for _ in range(H)] Scum = [list(accumulate(x)) for x in S] answer = 10000 for bit in range(1 << (H - 1)): count = 0 fo...
# coding: utf-8 import sys from itertools import accumulate sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) H, W, K = lr() S = [list(map(int, sr())) for _ in range(H)] Scum = [list(accumulate(row)) for row in S] # H方向はbit全探索、W方向はGreedyに INF = 10**10 answer = ...
false
13.043478
[ "+# coding: utf-8", "-Scum = [list(accumulate(x)) for x in S]", "-answer = 10000", "-for bit in range(1 << (H - 1)):", "- count = 0", "+Scum = [list(accumulate(row)) for row in S]", "+# H方向はbit全探索、W方向はGreedyに", "+INF = 10**10", "+answer = INF", "+for pattern in range(1 << (H - 1)):", "+ sl...
false
0.037299
0.057429
0.649487
[ "s934120435", "s892014998" ]
u285681431
p04000
python
s362006703
s752425033
1,040
690
164,248
249,472
Accepted
Accepted
33.65
from collections import defaultdict from collections import Counter H, W, N = list(map(int, input().split())) # 3*3マスの処理用リスト dir = [[0, 0], [1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] # そのマスを中心とする3*3グリッドに含まれる黒マスの数 dict = defaultdict(int) for i in range(N): a, b = li...
from collections import Counter H, W, N = list(map(int, input().split())) # 3*3マスの処理用リスト dir = [[0, 0], [1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] # そのマスを中心とする3*3グリッドに含まれる黒マスの数 dict = {} for i in range(N): a, b = list(map(int, input().split())) for dy, dx in di...
33
35
833
895
from collections import defaultdict from collections import Counter H, W, N = list(map(int, input().split())) # 3*3マスの処理用リスト dir = [[0, 0], [1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] # そのマスを中心とする3*3グリッドに含まれる黒マスの数 dict = defaultdict(int) for i in range(N): a, b = list(map(int, input().spl...
from collections import Counter H, W, N = list(map(int, input().split())) # 3*3マスの処理用リスト dir = [[0, 0], [1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] # そのマスを中心とする3*3グリッドに含まれる黒マスの数 dict = {} for i in range(N): a, b = list(map(int, input().split())) for dy, dx in dir: # 3*3グリッドは、H...
false
5.714286
[ "-from collections import defaultdict", "-dict = defaultdict(int)", "+dict = {}", "- dict[(a + dy, b + dx)] += 1", "+ if (a + dy, b + dx) not in dict:", "+ dict[(a + dy, b + dx)] = 1", "+ else:", "+ dict[(a + dy, b + dx)] += 1" ]
false
0.03894
0.041446
0.939543
[ "s362006703", "s752425033" ]
u504836877
p03525
python
s186317963
s651306499
26
18
3,064
3,064
Accepted
Accepted
30.77
N = int(eval(input())) D = [int(d) for d in input().split()] D.append(0) D.sort() ans = 0 time1 = [] time2 = [] for i in range(N+1): if D.count(D[i]) == 2: if D[i] == 0: ans = -1 break time2.append(D[i]) time2.append(24-D[i]) if D.count(D[i]) + D.c...
N = int(eval(input())) D = [int(d) for d in input().split()] D.append(0) D.sort() for i in range(1, N+1): if i%2 == 0: D[i] = 24-D[i] D.sort() ans = min(D[-1], 24-D[-1]) for i in range(N): ans = min(ans, D[i+1]-D[i]) print(ans)
42
13
952
250
N = int(eval(input())) D = [int(d) for d in input().split()] D.append(0) D.sort() ans = 0 time1 = [] time2 = [] for i in range(N + 1): if D.count(D[i]) == 2: if D[i] == 0: ans = -1 break time2.append(D[i]) time2.append(24 - D[i]) if D.count(D[i]) + D.count(24 - D[...
N = int(eval(input())) D = [int(d) for d in input().split()] D.append(0) D.sort() for i in range(1, N + 1): if i % 2 == 0: D[i] = 24 - D[i] D.sort() ans = min(D[-1], 24 - D[-1]) for i in range(N): ans = min(ans, D[i + 1] - D[i]) print(ans)
false
69.047619
[ "-ans = 0", "-time1 = []", "-time2 = []", "-for i in range(N + 1):", "- if D.count(D[i]) == 2:", "- if D[i] == 0:", "- ans = -1", "- break", "- time2.append(D[i])", "- time2.append(24 - D[i])", "- if D.count(D[i]) + D.count(24 - D[i]) > 2:", "- ...
false
0.03793
0.042392
0.894727
[ "s186317963", "s651306499" ]
u796942881
p03796
python
s397203068
s657843678
526
44
3,060
2,940
Accepted
Accepted
91.63
INF = 1000000007 def modmulti(a, b): # aとbを掛けた値をmodする(a * b mod p) res = 0 mod = a % INF while b > 0: if b & 1 == 1: res += mod if res > INF: res -= INF mod <<= 1 if mod > INF: mod -= INF b >>= 1 re...
INF = 1000000007 def modmulti(a, b): # aとbを掛けた値をmodする(a * b mod p) return a * b % INF N = int(eval(input())) ans = 1 for i in range(1, N + 1): ans = modmulti(ans, i) print(ans)
27
16
433
205
INF = 1000000007 def modmulti(a, b): # aとbを掛けた値をmodする(a * b mod p) res = 0 mod = a % INF while b > 0: if b & 1 == 1: res += mod if res > INF: res -= INF mod <<= 1 if mod > INF: mod -= INF b >>= 1 return res N = i...
INF = 1000000007 def modmulti(a, b): # aとbを掛けた値をmodする(a * b mod p) return a * b % INF N = int(eval(input())) ans = 1 for i in range(1, N + 1): ans = modmulti(ans, i) print(ans)
false
40.740741
[ "- res = 0", "- mod = a % INF", "- while b > 0:", "- if b & 1 == 1:", "- res += mod", "- if res > INF:", "- res -= INF", "- mod <<= 1", "- if mod > INF:", "- mod -= INF", "- b >>= 1", "- return res", "+ ...
false
0.642432
0.044712
14.368084
[ "s397203068", "s657843678" ]
u524870111
p03697
python
s574372628
s967068199
264
17
17,968
3,060
Accepted
Accepted
93.56
import sys stdin = sys.stdin import numpy as np ns = lambda: stdin.readline().rstrip() ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)] a, b = na() print((a+b if a+b <10 else "error"))
import sys stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) a, b = na() print(("error" if a+b >= 10 else a+b))
13
9
302
203
import sys stdin = sys.stdin import numpy as np ns = lambda: stdin.readline().rstrip() ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)] a, b = na() print((a + b if a + b < 10 else "error"))
import sys stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) a, b = na() print(("error" if a + b >= 10 else a + b))
false
30.769231
[ "-import numpy as np", "-", "-s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]", "-print((a + b if a + b < 10 else \"error\"))", "+print((\"error\" if a + b >= 10 else a + b))" ]
false
0.079958
0.037247
2.146676
[ "s574372628", "s967068199" ]
u595289165
p03078
python
s921676962
s439667454
666
57
8,708
4,972
Accepted
Accepted
91.44
x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort(reverse=True) b.sort(reverse=True) c.sort(reverse=True) ans = [] for i in range(x): for j in range(y): for m in range(z): i...
import heapq x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort(reverse=True) b.sort(reverse=True) c.sort(reverse=True) ans = [(-(a[0] + b[0] + c[0]), 0, 0, 0)] heapq.heapify(ans) added = {"0 0 0"} ...
19
27
468
781
x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort(reverse=True) b.sort(reverse=True) c.sort(reverse=True) ans = [] for i in range(x): for j in range(y): for m in range(z): if (i + 1) * (...
import heapq x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort(reverse=True) b.sort(reverse=True) c.sort(reverse=True) ans = [(-(a[0] + b[0] + c[0]), 0, 0, 0)] heapq.heapify(ans) added = {"0 0 0"} for _ in ran...
false
29.62963
[ "+import heapq", "+", "-ans = []", "-for i in range(x):", "- for j in range(y):", "- for m in range(z):", "- if (i + 1) * (j + 1) * (m + 1) > k:", "- break", "- ans.append(a[i] + b[j] + c[m])", "-ans.sort(reverse=True)", "-for i in ans[:k]:", "- ...
false
0.036653
0.0375
0.977432
[ "s921676962", "s439667454" ]
u393253137
p03435
python
s819614581
s605037695
1,168
18
3,064
2,940
Accepted
Accepted
98.46
def main(): c = [list(map(int, input().split())) for _ in range(3)] N = 100 for i in range(-N, N+1): for j in range(-N, N+1): for k in range(-N, N+1): if c[0][0] - i == c[0][1] - j == c[0][2] - k: if c[1][0] - i == c[1][1] - j == c[1][2] - k: ...
a, b, c = list(map(int, input().split())) d, e, f = list(map(int, input().split())) g, h, i = list(map(int, input().split())) if a - b == d - e == g - h and b - c == e - f == h - i: print('Yes') else: print('No')
13
7
491
208
def main(): c = [list(map(int, input().split())) for _ in range(3)] N = 100 for i in range(-N, N + 1): for j in range(-N, N + 1): for k in range(-N, N + 1): if c[0][0] - i == c[0][1] - j == c[0][2] - k: if c[1][0] - i == c[1][1] - j == c[1][2] - k: ...
a, b, c = list(map(int, input().split())) d, e, f = list(map(int, input().split())) g, h, i = list(map(int, input().split())) if a - b == d - e == g - h and b - c == e - f == h - i: print("Yes") else: print("No")
false
46.153846
[ "-def main():", "- c = [list(map(int, input().split())) for _ in range(3)]", "- N = 100", "- for i in range(-N, N + 1):", "- for j in range(-N, N + 1):", "- for k in range(-N, N + 1):", "- if c[0][0] - i == c[0][1] - j == c[0][2] - k:", "- i...
false
0.808918
0.038465
21.03014
[ "s819614581", "s605037695" ]
u028073448
p02690
python
s516774058
s430339783
397
75
9,168
65,952
Accepted
Accepted
81.11
x = int(eval(input())) pow5 = [i ** 5 for i in range(-1000, 1000)] for a in range(-1000, 1000): for b in range(-1000, 1000): if pow5[a + 1000] - pow5[b + 1000] == x: print(f"{a} {b}") exit(0)
x = int(eval(input())) pow5 = [(i, i ** 5) for i in range(-1000, 1000)] for a, a5 in pow5: for b, b5 in pow5: if a5 - b5 == x: print(f"{a} {b}") exit(0)
9
9
214
175
x = int(eval(input())) pow5 = [i**5 for i in range(-1000, 1000)] for a in range(-1000, 1000): for b in range(-1000, 1000): if pow5[a + 1000] - pow5[b + 1000] == x: print(f"{a} {b}") exit(0)
x = int(eval(input())) pow5 = [(i, i**5) for i in range(-1000, 1000)] for a, a5 in pow5: for b, b5 in pow5: if a5 - b5 == x: print(f"{a} {b}") exit(0)
false
0
[ "-pow5 = [i**5 for i in range(-1000, 1000)]", "-for a in range(-1000, 1000):", "- for b in range(-1000, 1000):", "- if pow5[a + 1000] - pow5[b + 1000] == x:", "+pow5 = [(i, i**5) for i in range(-1000, 1000)]", "+for a, a5 in pow5:", "+ for b, b5 in pow5:", "+ if a5 - b5 == x:" ]
false
2.357194
1.060957
2.221763
[ "s516774058", "s430339783" ]
u606045429
p03326
python
s123141163
s253014663
26
23
3,572
3,572
Accepted
Accepted
11.54
# https://atcoder.jp/contests/abc100/tasks/abc100_d from itertools import product N, M, *XYZ = list(map(int, open(0).read().split())) P = tuple(product((1, -1), repeat=3)) A = [[] for _ in range(8)] for x, y, z in zip(*[iter(XYZ)] * 3): for i, (a, b, c) in enumerate(P): A[i].append(a * x + b ...
N, M, *XYZ = list(map(int, open(0).read().split())) A = [[] for _ in range(8)] for x, y, z in zip(*[iter(XYZ)] * 3): A[0].append(sum((x, y, z))) A[1].append(sum((x, y, -z))) A[2].append(sum((x, -y, z))) A[3].append(sum((x, -y, -z))) A[4].append(sum((-x, y, z))) A[5].append(sum((-x, y, ...
19
19
441
505
# https://atcoder.jp/contests/abc100/tasks/abc100_d from itertools import product N, M, *XYZ = list(map(int, open(0).read().split())) P = tuple(product((1, -1), repeat=3)) A = [[] for _ in range(8)] for x, y, z in zip(*[iter(XYZ)] * 3): for i, (a, b, c) in enumerate(P): A[i].append(a * x + b * y + c * z) c...
N, M, *XYZ = list(map(int, open(0).read().split())) A = [[] for _ in range(8)] for x, y, z in zip(*[iter(XYZ)] * 3): A[0].append(sum((x, y, z))) A[1].append(sum((x, y, -z))) A[2].append(sum((x, -y, z))) A[3].append(sum((x, -y, -z))) A[4].append(sum((-x, y, z))) A[5].append(sum((-x, y, -z))) ...
false
0
[ "-# https://atcoder.jp/contests/abc100/tasks/abc100_d", "-from itertools import product", "-", "-P = tuple(product((1, -1), repeat=3))", "- for i, (a, b, c) in enumerate(P):", "- A[i].append(a * x + b * y + c * z)", "+ A[0].append(sum((x, y, z)))", "+ A[1].append(sum((x, y, -z)))", "...
false
0.04351
0.044468
0.978463
[ "s123141163", "s253014663" ]
u533039576
p02695
python
s271084106
s704174692
429
253
9,212
9,132
Accepted
Accepted
41.03
from itertools import combinations_with_replacement n, m, q = list(map(int, input().split())) cond = [] for _ in range(q): a, b, c, d = list(map(int, input().split())) a -= 1 b -= 1 cond.append((a, b, c, d)) def calc(l): score = 0 for a, b, c, d in cond: if l[b] - l[a] =...
from itertools import combinations_with_replacement n, m, q = list(map(int, input().split())) cond = [] for _ in range(q): a, b, c, d = list(map(int, input().split())) a -= 1 b -= 1 cond.append((a, b, c, d)) def calc(l): score = 0 for a, b, c, d in cond: if l[b] - l[a] =...
25
37
489
614
from itertools import combinations_with_replacement n, m, q = list(map(int, input().split())) cond = [] for _ in range(q): a, b, c, d = list(map(int, input().split())) a -= 1 b -= 1 cond.append((a, b, c, d)) def calc(l): score = 0 for a, b, c, d in cond: if l[b] - l[a] == c: ...
from itertools import combinations_with_replacement n, m, q = list(map(int, input().split())) cond = [] for _ in range(q): a, b, c, d = list(map(int, input().split())) a -= 1 b -= 1 cond.append((a, b, c, d)) def calc(l): score = 0 for a, b, c, d in cond: if l[b] - l[a] == c: ...
false
32.432432
[ "-for l in combinations_with_replacement(list(range(1, m + 1)), n):", "- cand = calc(l)", "- ans = max(ans, cand)", "+l = [0] * n", "+l[0] = 1", "+", "+", "+def dfs(l_len):", "+ global l, ans", "+ if l_len == n:", "+ ans = max(ans, calc(l))", "+ return", "+ for i...
false
0.168942
0.11396
1.482469
[ "s271084106", "s704174692" ]
u499381410
p03797
python
s102461936
s577608430
215
196
39,664
39,792
Accepted
Accepted
8.84
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, ...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys from pprint import pprint from copy import deepcopy import string from bisect import bisect_...
35
37
1,048
1,190
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fro...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys from pprint import pprint from copy import deepcopy import string from bisect import bisect_left, bise...
false
5.405405
[ "+from pprint import pprint", "+from copy import deepcopy", "+from pprint import pprint", "-INF = float(\"inf\")", "+INF = 10**13", "- return list(map(int, sys.stdin.readline().split()))", "+ return list(map(int, sys.stdin.buffer.readline().split()))", "- return int(sys.stdin.readline())", ...
false
0.03882
0.035037
1.107962
[ "s102461936", "s577608430" ]
u371763408
p03695
python
s490301129
s502723236
20
18
3,060
3,064
Accepted
Accepted
10
n=int(eval(input())) A=list(map(int,input().split())) A=list([x//400 if x<3200 else 8 for x in A]) n_red=A.count(8) n_min=len(set(A)) n_8=1 if n_red else 0 print((1 if n_min==1 and list(set(A))[0]==8 else n_min-n_8,n_min+n_red-n_8))
n=int(eval(input())) A=list(map(int,input().split())) A=list([x//400 if x<3200 else 8 for x in A]) n_red=A.count(8) red_exist=1 if n_red else 0 red_only=1 if red_exist and len(list(set(A)))==1 else 0 n_min=len(set(A)) if not red_exist else len(set(A))-1 print((1 if red_only else n_min,n_min+n_red))
7
8
234
302
n = int(eval(input())) A = list(map(int, input().split())) A = list([x // 400 if x < 3200 else 8 for x in A]) n_red = A.count(8) n_min = len(set(A)) n_8 = 1 if n_red else 0 print((1 if n_min == 1 and list(set(A))[0] == 8 else n_min - n_8, n_min + n_red - n_8))
n = int(eval(input())) A = list(map(int, input().split())) A = list([x // 400 if x < 3200 else 8 for x in A]) n_red = A.count(8) red_exist = 1 if n_red else 0 red_only = 1 if red_exist and len(list(set(A))) == 1 else 0 n_min = len(set(A)) if not red_exist else len(set(A)) - 1 print((1 if red_only else n_min, n_min + n_...
false
12.5
[ "-n_min = len(set(A))", "-n_8 = 1 if n_red else 0", "-print((1 if n_min == 1 and list(set(A))[0] == 8 else n_min - n_8, n_min + n_red - n_8))", "+red_exist = 1 if n_red else 0", "+red_only = 1 if red_exist and len(list(set(A))) == 1 else 0", "+n_min = len(set(A)) if not red_exist else len(set(A)) - 1", ...
false
0.047662
0.047366
1.006258
[ "s490301129", "s502723236" ]
u947883560
p02686
python
s150099322
s457781831
1,379
912
375,652
191,680
Accepted
Accepted
33.87
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**8) INF = float("inf") def yes(): print("Yes") # type: str def no(): print("No") # type: str def solve(N: int, S: "List[str]"): def f(s): ans = [0]*(len(s)+1) m = 0 for i, c in enumerate(s): ...
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**8) INF = float("inf") def yes(): print("Yes") # type: str def no(): print("No") # type: str def solve(N: int, S: "List[str]"): def seq_positive(ls): state = 0 for l, st in ls: if state+l < 0: ...
74
71
1,428
1,460
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**8) INF = float("inf") def yes(): print("Yes") # type: str def no(): print("No") # type: str def solve(N: int, S: "List[str]"): def f(s): ans = [0] * (len(s) + 1) m = 0 for i, c in enumerate(s): if c == "...
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**8) INF = float("inf") def yes(): print("Yes") # type: str def no(): print("No") # type: str def solve(N: int, S: "List[str]"): def seq_positive(ls): state = 0 for l, st in ls: if state + l < 0: r...
false
4.054054
[ "- def f(s):", "- ans = [0] * (len(s) + 1)", "- m = 0", "- for i, c in enumerate(s):", "+ def seq_positive(ls):", "+ state = 0", "+ for l, st in ls:", "+ if state + l < 0:", "+ return False", "+ state += st", "+ ...
false
0.071049
0.102908
0.690412
[ "s150099322", "s457781831" ]
u867848444
p02787
python
s360269240
s506077076
682
248
74,368
73,996
Accepted
Accepted
63.64
h, n = list(map(int,input().split())) ab = [list(map(int,input().split())) for i in range(n)] #(a,b):=(ダメージ,消費魔力) dp = [float('inf')] * (h + 1) dp[0] = 0 for i in range(h + 1): for j in range(n): if dp[i] == float('inf'):continue temp_a = i + ab[j][0] if i + ab[j][0] < h else h ...
h,n=list(map(int,input().split())) ab = [list(map(int,input().split())) for i in range(n)] dp=[float('inf')]*(h+1) dp[0]=0 for i in range(h): for j in range(n): next=i+ab[j][0] if i+ab[j][0]<=h else h dp[next]=min(dp[next],dp[i]+ab[j][1]) print((dp[-1]))
17
11
417
279
h, n = list(map(int, input().split())) ab = [list(map(int, input().split())) for i in range(n)] # (a,b):=(ダメージ,消費魔力) dp = [float("inf")] * (h + 1) dp[0] = 0 for i in range(h + 1): for j in range(n): if dp[i] == float("inf"): continue temp_a = i + ab[j][0] if i + ab[j][0] < h else h ...
h, n = list(map(int, input().split())) ab = [list(map(int, input().split())) for i in range(n)] dp = [float("inf")] * (h + 1) dp[0] = 0 for i in range(h): for j in range(n): next = i + ab[j][0] if i + ab[j][0] <= h else h dp[next] = min(dp[next], dp[i] + ab[j][1]) print((dp[-1]))
false
35.294118
[ "-# (a,b):=(ダメージ,消費魔力)", "-for i in range(h + 1):", "+for i in range(h):", "- if dp[i] == float(\"inf\"):", "- continue", "- temp_a = i + ab[j][0] if i + ab[j][0] < h else h", "- temp_b = dp[i] + ab[j][1]", "- dp[temp_a] = min(dp[temp_a], temp_b)", "+ ne...
false
0.183726
0.19626
0.936138
[ "s360269240", "s506077076" ]
u350412774
p02984
python
s419312594
s596293307
679
158
24,960
14,092
Accepted
Accepted
76.73
import numpy as np n = list(map(int, input().split())) x = list(map(int, input().split())) n = n[0] ans = [] x = np.asarray(x) double_x = 2 * x x0 = 0 multiple = 1 for j in range(n): x0 += x[j] * multiple multiple *= -1 ans.append(x0) for i in range(0, n-1): ans.append(double_x[i] - ans[...
N = int(eval(input())) a = list(map(int, input().split())) c = 0 for idx, i in enumerate(a): if idx %2 ==0: c += i else: c -= i x1 = c print(x1) for i in range(1,N): x1 = 2*a[i-1] - x1 print(x1)
20
13
353
217
import numpy as np n = list(map(int, input().split())) x = list(map(int, input().split())) n = n[0] ans = [] x = np.asarray(x) double_x = 2 * x x0 = 0 multiple = 1 for j in range(n): x0 += x[j] * multiple multiple *= -1 ans.append(x0) for i in range(0, n - 1): ans.append(double_x[i] - ans[i]) print(" ".joi...
N = int(eval(input())) a = list(map(int, input().split())) c = 0 for idx, i in enumerate(a): if idx % 2 == 0: c += i else: c -= i x1 = c print(x1) for i in range(1, N): x1 = 2 * a[i - 1] - x1 print(x1)
false
35
[ "-import numpy as np", "-", "-n = list(map(int, input().split()))", "-x = list(map(int, input().split()))", "-n = n[0]", "-ans = []", "-x = np.asarray(x)", "-double_x = 2 * x", "-x0 = 0", "-multiple = 1", "-for j in range(n):", "- x0 += x[j] * multiple", "- multiple *= -1", "-ans.app...
false
0.351395
0.043092
8.154456
[ "s419312594", "s596293307" ]
u186838327
p03387
python
s539215791
s913643269
172
61
38,384
61,960
Accepted
Accepted
64.53
L = list(map(int, input().split())) L.sort() ans = 0 ans += L[2]-L[1] L[0] += L[2]-L[1] L[1] = L[2] if (L[2]-L[0])%2 == 0: ans += (L[2]-L[0])//2 else: ans += 1+(L[2]+1-L[0])//2 print(ans)
L = list(map(int, input().split())) L.sort() ans = L[2]-L[1] L[0] = L[0]+ L[2]-L[1] L[1] = L[2] if L[0]%2 == L[2]%2: ans += (L[2]-L[0])//2 else: ans += 1 + (L[2]+1-L[0])//2 print(ans)
14
11
212
203
L = list(map(int, input().split())) L.sort() ans = 0 ans += L[2] - L[1] L[0] += L[2] - L[1] L[1] = L[2] if (L[2] - L[0]) % 2 == 0: ans += (L[2] - L[0]) // 2 else: ans += 1 + (L[2] + 1 - L[0]) // 2 print(ans)
L = list(map(int, input().split())) L.sort() ans = L[2] - L[1] L[0] = L[0] + L[2] - L[1] L[1] = L[2] if L[0] % 2 == L[2] % 2: ans += (L[2] - L[0]) // 2 else: ans += 1 + (L[2] + 1 - L[0]) // 2 print(ans)
false
21.428571
[ "-ans = 0", "-ans += L[2] - L[1]", "-L[0] += L[2] - L[1]", "+ans = L[2] - L[1]", "+L[0] = L[0] + L[2] - L[1]", "-if (L[2] - L[0]) % 2 == 0:", "+if L[0] % 2 == L[2] % 2:" ]
false
0.038166
0.037662
1.013382
[ "s539215791", "s913643269" ]
u562935282
p03164
python
s064826133
s060459327
878
314
307,264
118,128
Accepted
Accepted
64.24
inf = float('inf') n, w = list(map(int, input().split())) e = tuple(list(map(int, input().split())) for _ in range(n)) wt, vt = list(zip(*e)) sv = sum(vt) dp = tuple([inf] * (sv + 1) for _ in range(n + 1)) dp[0][0] = 0 for i in range(n): dp[i + 1][:vt[i]] = dp[i][:vt[i]] for j in range(vt[i], sv ...
def main(): import sys readline = sys.stdin.readline maxw = 10 ** 11 # 重さの最小化なので、初期値は最大重さとすることにdebugで気づいた maxv = 10 ** 5 n, w = list(map(int, readline().split())) dp = [[maxw] * (maxv + 1) for _ in range(n + 1)] dp[0][0] = 0 for i in range(1, n + 1): # i個目の品物を選ぶかどうか決めた後...
21
29
480
737
inf = float("inf") n, w = list(map(int, input().split())) e = tuple(list(map(int, input().split())) for _ in range(n)) wt, vt = list(zip(*e)) sv = sum(vt) dp = tuple([inf] * (sv + 1) for _ in range(n + 1)) dp[0][0] = 0 for i in range(n): dp[i + 1][: vt[i]] = dp[i][: vt[i]] for j in range(vt[i], sv + 1): ...
def main(): import sys readline = sys.stdin.readline maxw = 10**11 # 重さの最小化なので、初期値は最大重さとすることにdebugで気づいた maxv = 10**5 n, w = list(map(int, readline().split())) dp = [[maxw] * (maxv + 1) for _ in range(n + 1)] dp[0][0] = 0 for i in range(1, n + 1): # i個目の品物を選ぶかどうか決めた後の重さの総和の最小値,1-indexe...
false
27.586207
[ "-inf = float(\"inf\")", "-n, w = list(map(int, input().split()))", "-e = tuple(list(map(int, input().split())) for _ in range(n))", "-wt, vt = list(zip(*e))", "-sv = sum(vt)", "-dp = tuple([inf] * (sv + 1) for _ in range(n + 1))", "-dp[0][0] = 0", "-for i in range(n):", "- dp[i + 1][: vt[i]] = d...
false
0.040437
0.278899
0.144987
[ "s064826133", "s060459327" ]
u891635666
p03353
python
s522110827
s722597860
39
35
5,068
4,464
Accepted
Accepted
10.26
s = input().strip() k = int(eval(input())) ss = [] n = len(s) for i in range(n): for j in range(1, 6): if i + j <= n: ss.append(s[i:i + j]) ss = list(set(ss)) ss.sort() print((ss[k - 1]))
import sys input = sys.stdin.readline ri = lambda: int(eval(input())) rs = lambda: input().rstrip() ril = lambda: list(map(int, input().split())) rsl = lambda: input().rstrip().split() ris = lambda n: [ri() for _ in range(n)] rss = lambda n: [rs() for _ in range(n)] rils = lambda n: [ril() for _ in range(n)...
11
21
213
506
s = input().strip() k = int(eval(input())) ss = [] n = len(s) for i in range(n): for j in range(1, 6): if i + j <= n: ss.append(s[i : i + j]) ss = list(set(ss)) ss.sort() print((ss[k - 1]))
import sys input = sys.stdin.readline ri = lambda: int(eval(input())) rs = lambda: input().rstrip() ril = lambda: list(map(int, input().split())) rsl = lambda: input().rstrip().split() ris = lambda n: [ri() for _ in range(n)] rss = lambda n: [rs() for _ in range(n)] rils = lambda n: [ril() for _ in range(n)] rsls = la...
false
47.619048
[ "-s = input().strip()", "-k = int(eval(input()))", "-ss = []", "+import sys", "+", "+input = sys.stdin.readline", "+ri = lambda: int(eval(input()))", "+rs = lambda: input().rstrip()", "+ril = lambda: list(map(int, input().split()))", "+rsl = lambda: input().rstrip().split()", "+ris = lambda n: [...
false
0.047538
0.0474
1.002921
[ "s522110827", "s722597860" ]
u796942881
p03031
python
s649384561
s163586906
66
18
3,060
3,064
Accepted
Accepted
72.73
from sys import stdin def main(): lines = stdin.readlines() N, M = list(map(int, lines[0].split())) print((sum(1 for i in range(1 << N) if sum(1 for s, p in zip( (sum(1 << int(j) - 1 for j in...
from sys import stdin def f(s, p, P, i): # 再帰 # 順にスイッチを見ていく if len(s) == i: return 1 if P == p else 0 # 場合の数 # そのスイッチを使用しなかった場合 + 使用した場合 return f(s, p, P, i + 1) + f(s, p, P ^ s[i], i + 1) def main(): lines = stdin.readlines() N, M = list(map(int, lines[0].spli...
20
33
557
745
from sys import stdin def main(): lines = stdin.readlines() N, M = list(map(int, lines[0].split())) print( ( sum( 1 for i in range(1 << N) if sum( 1 for s, p in zip( ( ...
from sys import stdin def f(s, p, P, i): # 再帰 # 順にスイッチを見ていく if len(s) == i: return 1 if P == p else 0 # 場合の数 # そのスイッチを使用しなかった場合 + 使用した場合 return f(s, p, P, i + 1) + f(s, p, P ^ s[i], i + 1) def main(): lines = stdin.readlines() N, M = list(map(int, lines[0].split())) sn = ...
false
39.393939
[ "+", "+", "+def f(s, p, P, i):", "+ # 再帰", "+ # 順にスイッチを見ていく", "+ if len(s) == i:", "+ return 1 if P == p else 0", "+ # 場合の数", "+ # そのスイッチを使用しなかった場合 + 使用した場合", "+ return f(s, p, P, i + 1) + f(s, p, P ^ s[i], i + 1)", "- print(", "- (", "- sum(", ...
false
0.035797
0.052528
0.681482
[ "s649384561", "s163586906" ]
u440180827
p02417
python
s548997557
s486498696
30
20
7,384
7,388
Accepted
Accepted
33.33
import sys strs = sys.stdin.readlines() for c in range(ord('a'), ord('z') + 1): count = 0 for str in strs: count += str.lower().count(chr(c)) print(('{0} : {1}'.format(chr(c), count)))
import sys strs = sys.stdin.readlines() for c in range(ord('a'), ord('z') + 1): count = 0 for s in strs: count += s.lower().count(chr(c)) print(('{0} : {1}'.format(chr(c), count)))
7
7
208
204
import sys strs = sys.stdin.readlines() for c in range(ord("a"), ord("z") + 1): count = 0 for str in strs: count += str.lower().count(chr(c)) print(("{0} : {1}".format(chr(c), count)))
import sys strs = sys.stdin.readlines() for c in range(ord("a"), ord("z") + 1): count = 0 for s in strs: count += s.lower().count(chr(c)) print(("{0} : {1}".format(chr(c), count)))
false
0
[ "- for str in strs:", "- count += str.lower().count(chr(c))", "+ for s in strs:", "+ count += s.lower().count(chr(c))" ]
false
0.0497
0.05025
0.989056
[ "s548997557", "s486498696" ]
u936985471
p02821
python
s903837719
s573374103
946
412
20,704
49,072
Accepted
Accepted
56.45
import sys readline = sys.stdin.readline N,M = list(map(int,readline().split())) A = sorted(list(map(int,readline().split()))) ok = -1 ng = (10 ** 5) * 2 + 1 # x以上の握手ペアをM回以上作れるか、でxの最大値を二分探索 import bisect def isOk(x): cnt = 0 for left in A: right = x - left ind = bisect.bisect_left(A, right...
import sys readline = sys.stdin.readline N,M = list(map(int,readline().split())) A = list(map(int,readline().split())) MAX_VAL = 10 ** 5 + 1 hand = [0] * MAX_VAL for a in A: hand[a] += 1 import numpy as np def convolve(f, g): fft_len = 1 while 2 * fft_len < len(f) + len(g) - 1: fft...
44
48
790
993
import sys readline = sys.stdin.readline N, M = list(map(int, readline().split())) A = sorted(list(map(int, readline().split()))) ok = -1 ng = (10**5) * 2 + 1 # x以上の握手ペアをM回以上作れるか、でxの最大値を二分探索 import bisect def isOk(x): cnt = 0 for left in A: right = x - left ind = bisect.bisect_left(A, right) ...
import sys readline = sys.stdin.readline N, M = list(map(int, readline().split())) A = list(map(int, readline().split())) MAX_VAL = 10**5 + 1 hand = [0] * MAX_VAL for a in A: hand[a] += 1 import numpy as np def convolve(f, g): fft_len = 1 while 2 * fft_len < len(f) + len(g) - 1: fft_len *= 2 ...
false
8.333333
[ "-A = sorted(list(map(int, readline().split())))", "-ok = -1", "-ng = (10**5) * 2 + 1", "-# x以上の握手ペアをM回以上作れるか、でxの最大値を二分探索", "-import bisect", "+A = list(map(int, readline().split()))", "+MAX_VAL = 10**5 + 1", "+hand = [0] * MAX_VAL", "+for a in A:", "+ hand[a] += 1", "+import numpy as np", ...
false
0.037085
0.373809
0.099207
[ "s903837719", "s573374103" ]
u983918956
p03627
python
s207657468
s588930634
105
91
21,668
18,600
Accepted
Accepted
13.33
import collections N = int(eval(input())) A = list(map(int,input().split())) c = collections.Counter(A) c_l = c.most_common() l = [] for e in c_l: if e[1] >= 4: l.append(e[0]) l.append(e[0]) elif e[1] >= 2: l.append(e[0]) l.sort() if len(l) >= 2: print((l[-1]*l[-2])) e...
from collections import Counter N = int(eval(input())) A = list(map(int,input().split())) c = Counter(A) op = [] for a, cnt in list(c.items()): for _ in range(cnt // 2): op.append(a) op.sort(reverse=True) if len(op) < 2: print((0)) else: print((op[0]*op[1]))
17
13
330
274
import collections N = int(eval(input())) A = list(map(int, input().split())) c = collections.Counter(A) c_l = c.most_common() l = [] for e in c_l: if e[1] >= 4: l.append(e[0]) l.append(e[0]) elif e[1] >= 2: l.append(e[0]) l.sort() if len(l) >= 2: print((l[-1] * l[-2])) else: pr...
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) c = Counter(A) op = [] for a, cnt in list(c.items()): for _ in range(cnt // 2): op.append(a) op.sort(reverse=True) if len(op) < 2: print((0)) else: print((op[0] * op[1]))
false
23.529412
[ "-import collections", "+from collections import Counter", "-c = collections.Counter(A)", "-c_l = c.most_common()", "-l = []", "-for e in c_l:", "- if e[1] >= 4:", "- l.append(e[0])", "- l.append(e[0])", "- elif e[1] >= 2:", "- l.append(e[0])", "-l.sort()", "-if le...
false
0.042783
0.038885
1.100254
[ "s207657468", "s588930634" ]
u389007679
p03478
python
s821066321
s742671772
33
27
2,940
3,060
Accepted
Accepted
18.18
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1,n+1): s = sum(map(int,list(str(i)))) if a <= s <= b: ans += i print(ans)
n, a, b = list(map(int, input().split())) print((sum(i for i in range(1,n+1) if a <= sum(map(int,str(i))) <= b))) #map(int,list(str(i)))もmap(int,str(i))も変わらない?前者は1つ前の提出。
7
3
147
163
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): s = sum(map(int, list(str(i)))) if a <= s <= b: ans += i print(ans)
n, a, b = list(map(int, input().split())) print((sum(i for i in range(1, n + 1) if a <= sum(map(int, str(i))) <= b))) # map(int,list(str(i)))もmap(int,str(i))も変わらない?前者は1つ前の提出。
false
57.142857
[ "-ans = 0", "-for i in range(1, n + 1):", "- s = sum(map(int, list(str(i))))", "- if a <= s <= b:", "- ans += i", "-print(ans)", "+print((sum(i for i in range(1, n + 1) if a <= sum(map(int, str(i))) <= b)))", "+# map(int,list(str(i)))もmap(int,str(i))も変わらない?前者は1つ前の提出。" ]
false
0.034616
0.064864
0.533676
[ "s821066321", "s742671772" ]
u671060652
p03077
python
s562289009
s175648419
276
64
64,216
61,976
Accepted
Accepted
76.81
import itertools import math import fractions import functools import copy n = int(eval(input())) a = int(eval(input())) b = int(eval(input())) c = int(eval(input())) d = int(eval(input())) e = int(eval(input())) original = [a,b,c,d,e] print((math.ceil(n / min(original))+4))
import math def main(): n = int(eval(input())) # n, m = map(int, input().split()) # a = list(map(int, input().split())) # s = input() # h = [int(input()) for _ in rane(n)] a = int(eval(input())) b = int(eval(input())) c = int(eval(input())) d = int(eval(input())) ...
14
21
251
404
import itertools import math import fractions import functools import copy n = int(eval(input())) a = int(eval(input())) b = int(eval(input())) c = int(eval(input())) d = int(eval(input())) e = int(eval(input())) original = [a, b, c, d, e] print((math.ceil(n / min(original)) + 4))
import math def main(): n = int(eval(input())) # n, m = map(int, input().split()) # a = list(map(int, input().split())) # s = input() # h = [int(input()) for _ in rane(n)] a = int(eval(input())) b = int(eval(input())) c = int(eval(input())) d = int(eval(input())) e = int(eval(i...
false
33.333333
[ "-import itertools", "-import fractions", "-import functools", "-import copy", "-n = int(eval(input()))", "-a = int(eval(input()))", "-b = int(eval(input()))", "-c = int(eval(input()))", "-d = int(eval(input()))", "-e = int(eval(input()))", "-original = [a, b, c, d, e]", "-print((math.ceil(n /...
false
0.037175
0.036733
1.01205
[ "s562289009", "s175648419" ]
u790012205
p03624
python
s452054999
s379506771
36
29
3,956
9,724
Accepted
Accepted
19.44
import sys S = eval(input()) T = [] B = [] A = 'abcdefghijklmnopqrstuvwxyz' for i in range(len(S)): T.append(S[i]) for i in range(len(A)): B.append(A[i]) for i in B: if not i in T: print(i) sys.exit() print('None')
import sys S = list(eval(input())) D = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] for d in D: if not d in S: print(d) sys.exit() print('None')
14
9
247
257
import sys S = eval(input()) T = [] B = [] A = "abcdefghijklmnopqrstuvwxyz" for i in range(len(S)): T.append(S[i]) for i in range(len(A)): B.append(A[i]) for i in B: if not i in T: print(i) sys.exit() print("None")
import sys S = list(eval(input())) D = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", ] for d in D: if not d in S: pri...
false
35.714286
[ "-S = eval(input())", "-T = []", "-B = []", "-A = \"abcdefghijklmnopqrstuvwxyz\"", "-for i in range(len(S)):", "- T.append(S[i])", "-for i in range(len(A)):", "- B.append(A[i])", "-for i in B:", "- if not i in T:", "- print(i)", "+S = list(eval(input()))", "+D = [", "+ \...
false
0.045034
0.121318
0.371204
[ "s452054999", "s379506771" ]
u537550206
p02683
python
s021727737
s448160939
88
60
9,216
9,316
Accepted
Accepted
31.82
n, m, x = list(map(int, input().split())) books = [] ans = float('inf') for _ in range(n): book = list(map(int, input().split())) books.append(book) for i in range(2**n): count = [0] * m book_price = 0 for j in range(n): if (i >> j) & 1: book_price += books[j][0] ...
n, m, x = list(map(int, input().split())) books = [] book_total_price = [] for _ in range(n): book = list(map(int, input().split())) books.append(book) for i in range(2**n): reference_book = [] book_price = 0 for j in range(n): if (i >> j) & 1: reference_book.append...
26
25
610
648
n, m, x = list(map(int, input().split())) books = [] ans = float("inf") for _ in range(n): book = list(map(int, input().split())) books.append(book) for i in range(2**n): count = [0] * m book_price = 0 for j in range(n): if (i >> j) & 1: book_price += books[j][0] for ...
n, m, x = list(map(int, input().split())) books = [] book_total_price = [] for _ in range(n): book = list(map(int, input().split())) books.append(book) for i in range(2**n): reference_book = [] book_price = 0 for j in range(n): if (i >> j) & 1: reference_book.append(books[j]) ...
false
3.846154
[ "-ans = float(\"inf\")", "+book_total_price = []", "- count = [0] * m", "+ reference_book = []", "+ reference_book.append(books[j])", "- for k in range(1, m + 1):", "- count[k - 1] += books[j][k]", "- check = True", "- for j in count:", "- if...
false
0.032263
0.034098
0.946163
[ "s021727737", "s448160939" ]
u243572357
p03447
python
s135631830
s437512449
20
17
2,940
2,940
Accepted
Accepted
15
a, b, c = [int(eval(input())) for i in range(3)] print(((a - b) % c))
x, a, b = [int(eval(input())) for _ in range(3)] print(((x-a)%b))
2
2
62
59
a, b, c = [int(eval(input())) for i in range(3)] print(((a - b) % c))
x, a, b = [int(eval(input())) for _ in range(3)] print(((x - a) % b))
false
0
[ "-a, b, c = [int(eval(input())) for i in range(3)]", "-print(((a - b) % c))", "+x, a, b = [int(eval(input())) for _ in range(3)]", "+print(((x - a) % b))" ]
false
0.049615
0.074676
0.664396
[ "s135631830", "s437512449" ]
u883048396
p04013
python
s038920162
s112831557
22
19
3,316
3,188
Accepted
Accepted
13.64
#正負で分割 #dpの作り方はARCの方の人のロジックを参考にした。 #こんなんでええんや... def 解(): iN,iA =[int(x) for x in input().split()] aX = [int(x) - iA for x in input().split()] aPlus = [x for x in aX if 0 < x ] aMinus = [-1 * x for x in aX if x < 0 ] iLenPlus = len(aPlus) iLenMinus = len(aMinus) iLen0 = iN - iLe...
#正負で分割 #dpの作り方はARCの方の人のロジックを参考にした。 def 解(): iN,iA =[int(x) for x in input().split()] aX = [int(x) - iA for x in input().split()] aPlus = [x for x in aX if 0 < x ] aMinus = [-1 * x for x in aX if x < 0 ] iLenPlus = len(aPlus) iLenMinus = len(aMinus) iLen0 = iN - iLenPlus - iLenMinus...
30
32
924
1,019
# 正負で分割 # dpの作り方はARCの方の人のロジックを参考にした。 # こんなんでええんや... def 解(): iN, iA = [int(x) for x in input().split()] aX = [int(x) - iA for x in input().split()] aPlus = [x for x in aX if 0 < x] aMinus = [-1 * x for x in aX if x < 0] iLenPlus = len(aPlus) iLenMinus = len(aMinus) iLen0 = iN - iLenPlus - iL...
# 正負で分割 # dpの作り方はARCの方の人のロジックを参考にした。 def 解(): iN, iA = [int(x) for x in input().split()] aX = [int(x) - iA for x in input().split()] aPlus = [x for x in aX if 0 < x] aMinus = [-1 * x for x in aX if x < 0] iLenPlus = len(aPlus) iLenMinus = len(aMinus) iLen0 = iN - iLenPlus - iLenMinus iCZ...
false
6.25
[ "-# こんなんでええんや...", "- dp1[k + iX] = dp1.get(k + iX, 0) + v", "+ n = k + iX", "+ if n <= iUlim:", "+ dp1[n] = dp1.get(n, 0) + v", "- dp2[k + iX] = dp2.get(k + iX, 0) + v", "+ n = k + iX", "+ if ...
false
0.084455
0.079263
1.065504
[ "s038920162", "s112831557" ]
u859637829
p01137
python
s811682518
s231584926
770
680
5,680
5,676
Accepted
Accepted
11.69
import math def solve(e): k = 2 ** 32 for z in range(100, -1, -1): z3 = z * z * z if z3 > e: continue e2 = e - z3 ylm = int(math.sqrt(e2)) xzlm = 3 * z * z + 3 * z + 1 for y in range(ylm, -1, -1): y2 = y * y ...
import math def solve(e): k = 2 ** 32 for z in range(100, -1, -1): z3 = z * z * z if z3 > e: continue e2 = e - z3 ylm = int(math.sqrt(e2)) for y in range(ylm, -1, -1): y2 = y * y if e2 > (y + 1) * (y + 1): ...
41
37
735
603
import math def solve(e): k = 2**32 for z in range(100, -1, -1): z3 = z * z * z if z3 > e: continue e2 = e - z3 ylm = int(math.sqrt(e2)) xzlm = 3 * z * z + 3 * z + 1 for y in range(ylm, -1, -1): y2 = y * y if e2 > (y + 1) * (y...
import math def solve(e): k = 2**32 for z in range(100, -1, -1): z3 = z * z * z if z3 > e: continue e2 = e - z3 ylm = int(math.sqrt(e2)) for y in range(ylm, -1, -1): y2 = y * y if e2 > (y + 1) * (y + 1): break ...
false
9.756098
[ "- xzlm = 3 * z * z + 3 * z + 1", "- xylm = 2 * y + 1", "- if x > xylm or x > xzlm:", "- continue" ]
false
0.048953
0.049509
0.988764
[ "s811682518", "s231584926" ]
u994988729
p02936
python
s521328105
s557216428
1,300
1,064
104,472
55,800
Accepted
Accepted
18.15
from collections import deque import sys input = sys.stdin.readline N, Q = list(map(int, input().split())) edge = [[] for _ in range(N + 1)] for _ in range(N - 1): a, b = list(map(int, input().split())) edge[a].append(b) edge[b].append(a) query = [list(map(int, input().split())) for _ in range(Q)...
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N, Q = list(map(int, input().split())) edge = [[] for _ in range(N+1)] for _ in range(N - 1): a, b = list(map(int, input().split())) edge[a].append(b) edge[b].append(a) dist = [0] * (N + 1) seen = [False] * (N + 1) se...
28
31
623
618
from collections import deque import sys input = sys.stdin.readline N, Q = list(map(int, input().split())) edge = [[] for _ in range(N + 1)] for _ in range(N - 1): a, b = list(map(int, input().split())) edge[a].append(b) edge[b].append(a) query = [list(map(int, input().split())) for _ in range(Q)] score = ...
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) N, Q = list(map(int, input().split())) edge = [[] for _ in range(N + 1)] for _ in range(N - 1): a, b = list(map(int, input().split())) edge[a].append(b) edge[b].append(a) dist = [0] * (N + 1) seen = [False] * (N + 1) seen[1] = True n...
false
9.677419
[ "-from collections import deque", "-input = sys.stdin.readline", "+input = sys.stdin.buffer.readline", "+sys.setrecursionlimit(10**7)", "-query = [list(map(int, input().split())) for _ in range(Q)]", "-score = [0] * (N + 1)", "-for n, p in query:", "- score[n] += p", "-seen = [0] * (N + 1)", "-...
false
0.036045
0.046606
0.773403
[ "s521328105", "s557216428" ]
u287500079
p02887
python
s754872131
s498749320
65
43
3,956
3,316
Accepted
Accepted
33.85
n = int(eval(input())) s = str(eval(input())) a = [] b = 0 for i in range(1,n): if s[i] == s[i-1]: b += 1 else: a.append(b) b = 0 if i == n-1: a.append(b) b = 0 c = 0 for i in range(len(a)): c += a[i] print((n-c))
# -*- coding: utf-8 -*- N = int(eval(input())) S = str(eval(input())) X = N for i in range(N - 1): if S[i] == S[i + 1]: X -= 1 print(X)
20
9
278
144
n = int(eval(input())) s = str(eval(input())) a = [] b = 0 for i in range(1, n): if s[i] == s[i - 1]: b += 1 else: a.append(b) b = 0 if i == n - 1: a.append(b) b = 0 c = 0 for i in range(len(a)): c += a[i] print((n - c))
# -*- coding: utf-8 -*- N = int(eval(input())) S = str(eval(input())) X = N for i in range(N - 1): if S[i] == S[i + 1]: X -= 1 print(X)
false
55
[ "-n = int(eval(input()))", "-s = str(eval(input()))", "-a = []", "-b = 0", "-for i in range(1, n):", "- if s[i] == s[i - 1]:", "- b += 1", "- else:", "- a.append(b)", "- b = 0", "- if i == n - 1:", "- a.append(b)", "- b = 0", "-c = 0", "-for i ...
false
0.033507
0.053062
0.631481
[ "s754872131", "s498749320" ]
u080364835
p03733
python
s505039022
s601059565
147
127
26,708
30,772
Accepted
Accepted
13.61
n, t = list(map(int, input().split())) tl = list(map(int, input().split())) time = 0 for i in range(1, n): if tl[i] - tl[i-1] > t: time += t else: time += tl[i] - tl[i-1] print((time + t))
n, t = list(map(int, input().split())) tl = list(map(int, input().split())) ans = 0 for i in range(n-1): if tl[i+1] - tl[i] >= t: ans += t else: ans += tl[i+1] - tl[i] print((ans+t))
11
10
216
208
n, t = list(map(int, input().split())) tl = list(map(int, input().split())) time = 0 for i in range(1, n): if tl[i] - tl[i - 1] > t: time += t else: time += tl[i] - tl[i - 1] print((time + t))
n, t = list(map(int, input().split())) tl = list(map(int, input().split())) ans = 0 for i in range(n - 1): if tl[i + 1] - tl[i] >= t: ans += t else: ans += tl[i + 1] - tl[i] print((ans + t))
false
9.090909
[ "-time = 0", "-for i in range(1, n):", "- if tl[i] - tl[i - 1] > t:", "- time += t", "+ans = 0", "+for i in range(n - 1):", "+ if tl[i + 1] - tl[i] >= t:", "+ ans += t", "- time += tl[i] - tl[i - 1]", "-print((time + t))", "+ ans += tl[i + 1] - tl[i]", "+print...
false
0.036515
0.097996
0.372617
[ "s505039022", "s601059565" ]
u078349616
p03331
python
s051430307
s135730083
253
207
9,188
9,176
Accepted
Accepted
18.18
N = int(eval(input())) def f(k): s = str(k) n = len(s) ans = 0 for i in range(n): ans += int(s[i]) return ans ans = float("INF") for i in range(1, N): j = N-i t = f(i) + f(j) ans = min(ans, t) print(ans)
N = int(eval(input())) def f(n): ans = 0 for s in str(n): ans += int(s) return ans ans = float("INF") for i in range(1, N): j = N-i ans = min(ans, f(i) + f(j)) print(ans)
17
14
256
212
N = int(eval(input())) def f(k): s = str(k) n = len(s) ans = 0 for i in range(n): ans += int(s[i]) return ans ans = float("INF") for i in range(1, N): j = N - i t = f(i) + f(j) ans = min(ans, t) print(ans)
N = int(eval(input())) def f(n): ans = 0 for s in str(n): ans += int(s) return ans ans = float("INF") for i in range(1, N): j = N - i ans = min(ans, f(i) + f(j)) print(ans)
false
17.647059
[ "-def f(k):", "- s = str(k)", "- n = len(s)", "+def f(n):", "- for i in range(n):", "- ans += int(s[i])", "+ for s in str(n):", "+ ans += int(s)", "- t = f(i) + f(j)", "- ans = min(ans, t)", "+ ans = min(ans, f(i) + f(j))" ]
false
0.078778
0.1091
0.722066
[ "s051430307", "s135730083" ]
u771917453
p02402
python
s811671218
s580034958
30
10
7,000
7,060
Accepted
Accepted
66.67
n = eval(input()) a = list(map(int,input().split())) a.sort() print(a[0],a[n-1],sum(a))
n = eval(input()) a = list(map(int,input().split())) print(min(a),max(a),sum(a))
4
3
81
73
n = eval(input()) a = list(map(int, input().split())) a.sort() print(a[0], a[n - 1], sum(a))
n = eval(input()) a = list(map(int, input().split())) print(min(a), max(a), sum(a))
false
25
[ "-a.sort()", "-print(a[0], a[n - 1], sum(a))", "+print(min(a), max(a), sum(a))" ]
false
0.145309
0.064797
2.242541
[ "s811671218", "s580034958" ]
u493520238
p02804
python
s500700538
s695487301
171
130
109,976
85,156
Accepted
Accepted
23.98
N_MAX = 10**6 MOD = 10**9 + 7 fac, finv, inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX def com_init(): fac[0], fac[1] = 1, 1 finv[0], finv[1] = 1, 1 inv[1] = 1 for i in range(2, N_MAX): fac[i] = fac[i - 1] * i % MOD inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD finv[i] = finv[i ...
class Combination: def __init__(self, n_max=10**6, mod=10**9+7): # self._n_max = n_max self._fac, self._finv, self._inv = [0]*n_max, [0]*n_max, [0]*n_max self._fac[0], self._fac[1] = 1, 1 self._finv[0], self._finv[1] = 1, 1 self._inv[1] = 1 for i in range(2, n_...
33
40
756
1,113
N_MAX = 10**6 MOD = 10**9 + 7 fac, finv, inv = [0] * N_MAX, [0] * N_MAX, [0] * N_MAX def com_init(): fac[0], fac[1] = 1, 1 finv[0], finv[1] = 1, 1 inv[1] = 1 for i in range(2, N_MAX): fac[i] = fac[i - 1] * i % MOD inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD finv[i] = finv[i ...
class Combination: def __init__(self, n_max=10**6, mod=10**9 + 7): # self._n_max = n_max self._fac, self._finv, self._inv = [0] * n_max, [0] * n_max, [0] * n_max self._fac[0], self._fac[1] = 1, 1 self._finv[0], self._finv[1] = 1, 1 self._inv[1] = 1 for i in range(2, n...
false
17.5
[ "-N_MAX = 10**6", "-MOD = 10**9 + 7", "-fac, finv, inv = [0] * N_MAX, [0] * N_MAX, [0] * N_MAX", "+class Combination:", "+ def __init__(self, n_max=10**6, mod=10**9 + 7):", "+ # self._n_max = n_max", "+ self._fac, self._finv, self._inv = [0] * n_max, [0] * n_max, [0] * n_max", "+ ...
false
0.00627
0.472652
0.013265
[ "s500700538", "s695487301" ]
u699296734
p02780
python
s883068492
s544194427
172
132
25,060
25,060
Accepted
Accepted
23.26
num,renzoku=list(map(int,input().split())) dices=list(map(int,input().split())) expects=[0]*num Si=[0]*(num+1) for i in range(1,num+1): Si[i]=Si[i-1]+(1+dices[i-1])/2 max_Si=0 for i in range(0,num-renzoku+1): if max_Si<Si[i+renzoku]-Si[i]: max_Si=Si[i+renzoku]-Si[i] print(max_Si)
num,renzoku=list(map(int,input().split())) dices=list(map(int,input().split())) sum_si=sum(dices[0:renzoku]) max_si=sum_si for i in range(1,num-renzoku+1): sum_si=sum_si-dices[i-1]+dices[i+renzoku-1] if max_si<sum_si: max_si=sum_si print(((renzoku+max_si)/2))
11
10
293
269
num, renzoku = list(map(int, input().split())) dices = list(map(int, input().split())) expects = [0] * num Si = [0] * (num + 1) for i in range(1, num + 1): Si[i] = Si[i - 1] + (1 + dices[i - 1]) / 2 max_Si = 0 for i in range(0, num - renzoku + 1): if max_Si < Si[i + renzoku] - Si[i]: max_Si = Si[i + ren...
num, renzoku = list(map(int, input().split())) dices = list(map(int, input().split())) sum_si = sum(dices[0:renzoku]) max_si = sum_si for i in range(1, num - renzoku + 1): sum_si = sum_si - dices[i - 1] + dices[i + renzoku - 1] if max_si < sum_si: max_si = sum_si print(((renzoku + max_si) / 2))
false
9.090909
[ "-expects = [0] * num", "-Si = [0] * (num + 1)", "-for i in range(1, num + 1):", "- Si[i] = Si[i - 1] + (1 + dices[i - 1]) / 2", "-max_Si = 0", "-for i in range(0, num - renzoku + 1):", "- if max_Si < Si[i + renzoku] - Si[i]:", "- max_Si = Si[i + renzoku] - Si[i]", "-print(max_Si)", "...
false
0.042432
0.036991
1.147079
[ "s883068492", "s544194427" ]
u422104747
p03286
python
s961823421
s099759383
195
163
38,512
38,512
Accepted
Accepted
16.41
def solve(n): ret="" i=0 while True: if i%2==1 and n%2==1: #奇数ビットが1のとき n+=2 ret+=str(n%2) n//=2 if n==0: break i+=1 return ret[-1::-1] #逆順に結合されているので反転 n=int(eval(input())) if n==0: print((0)) elif n<0: #負数は左ビットシフトして一文字落...
def solve(n): ret="" i=0 #n%2が元の何ビット目にあたるか while True: if i%2==1 and n%2==1: #奇数ビットが1のとき n+=2 ret+=str(n%2) n//=2 #1ビット右にずらす i+=1 if n==0: break return ret[-1::-1] #逆順に結合されているので反転 n=int(eval(input())) if n==0: print((0))...
20
20
374
404
def solve(n): ret = "" i = 0 while True: if i % 2 == 1 and n % 2 == 1: # 奇数ビットが1のとき n += 2 ret += str(n % 2) n //= 2 if n == 0: break i += 1 return ret[-1::-1] # 逆順に結合されているので反転 n = int(eval(input())) if n == 0: print((0)) elif n < 0...
def solve(n): ret = "" i = 0 # n%2が元の何ビット目にあたるか while True: if i % 2 == 1 and n % 2 == 1: # 奇数ビットが1のとき n += 2 ret += str(n % 2) n //= 2 # 1ビット右にずらす i += 1 if n == 0: break return ret[-1::-1] # 逆順に結合されているので反転 n = int(eval(input())) if ...
false
0
[ "- i = 0", "+ i = 0 # n%2が元の何ビット目にあたるか", "- n //= 2", "+ n //= 2 # 1ビット右にずらす", "+ i += 1", "- i += 1", "-elif n < 0: # 負数は左ビットシフトして一文字落とす", "+elif n < 0: # 負数は左ビットシフト、一文字落として表示" ]
false
0.037219
0.036419
1.021965
[ "s961823421", "s099759383" ]
u371763408
p03290
python
s007348501
s424382615
602
144
11,508
3,064
Accepted
Accepted
76.08
import itertools from collections import Counter D, G = list(map(int, input().split())) P = [list(map(int, input().split())) for i in range(D)] min_num = 10**8 judge_list = list(itertools.product([0, 1, 2], repeat=D)) #0:中途半端に解く 1:一問も解かない 2: 全部解く for judge in judge_list: score = 0 num = 0 d =...
d,g=list(map(int,input().split())) ls=[list(map(int,input().split())) for i in range(d)] P=list([x[0] for x in ls]) C=list([x[1] for x in ls]) tmp=10**9 for i in range(1<<d): total=0 num=0 for j in range(d): if (i>>j)&1: total+=C[j]+P[j]*100*(j+1) num+=P[j] if total>=g: tmp=mi...
37
26
970
553
import itertools from collections import Counter D, G = list(map(int, input().split())) P = [list(map(int, input().split())) for i in range(D)] min_num = 10**8 judge_list = list(itertools.product([0, 1, 2], repeat=D)) # 0:中途半端に解く 1:一問も解かない 2: 全部解く for judge in judge_list: score = 0 num = 0 d = Counter() ...
d, g = list(map(int, input().split())) ls = [list(map(int, input().split())) for i in range(d)] P = list([x[0] for x in ls]) C = list([x[1] for x in ls]) tmp = 10**9 for i in range(1 << d): total = 0 num = 0 for j in range(d): if (i >> j) & 1: total += C[j] + P[j] * 100 * (j + 1) ...
false
29.72973
[ "-import itertools", "-from collections import Counter", "-", "-D, G = list(map(int, input().split()))", "-P = [list(map(int, input().split())) for i in range(D)]", "-min_num = 10**8", "-judge_list = list(itertools.product([0, 1, 2], repeat=D)) # 0:中途半端に解く 1:一問も解かない 2: 全部解く", "-for judge in judge_lis...
false
0.038096
0.068093
0.559473
[ "s007348501", "s424382615" ]
u073852194
p03164
python
s910768411
s968872353
1,071
421
310,904
218,588
Accepted
Accepted
60.69
n,w = list(map(int,input().split())) item = [list(map(int,input().split())) for i in range(n)] dp = [[float('inf')]*(10**5+1) for i in range(n+1)] dp[0][0] = 0 for i in range(1,n+1): for j in range(10**5+1): if j >= item[i-1][1]: dp[i][j] = min(dp[i-1][j],dp[i-1][j-item[i-1][1]]+item[...
INF = 10**18 N, W = list(map(int, input().split())) dp = [[INF for i in range(10**5 + 1)] for j in range(N + 1)] dp[0][0] = 0 for i in range(1, N + 1): w, v = list(map(int, input().split())) for j in range(10**5 + 1): if j - v >= 0: dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v] +...
17
21
452
458
n, w = list(map(int, input().split())) item = [list(map(int, input().split())) for i in range(n)] dp = [[float("inf")] * (10**5 + 1) for i in range(n + 1)] dp[0][0] = 0 for i in range(1, n + 1): for j in range(10**5 + 1): if j >= item[i - 1][1]: dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - item[i ...
INF = 10**18 N, W = list(map(int, input().split())) dp = [[INF for i in range(10**5 + 1)] for j in range(N + 1)] dp[0][0] = 0 for i in range(1, N + 1): w, v = list(map(int, input().split())) for j in range(10**5 + 1): if j - v >= 0: dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v] + w) ...
false
19.047619
[ "-n, w = list(map(int, input().split()))", "-item = [list(map(int, input().split())) for i in range(n)]", "-dp = [[float(\"inf\")] * (10**5 + 1) for i in range(n + 1)]", "+INF = 10**18", "+N, W = list(map(int, input().split()))", "+dp = [[INF for i in range(10**5 + 1)] for j in range(N + 1)]", "-for i i...
false
0.349843
0.346874
1.00856
[ "s910768411", "s968872353" ]
u433375322
p02676
python
s688972874
s166193908
28
24
9,184
9,096
Accepted
Accepted
14.29
N=int(input()) S=list(input()) if len(S)<=N: for i in range(len(S)): print(S[i],end="") else: for i in range(N): print(S[i],end="") print("...")
k=int(input()) s=input() if len(s)<=k: print(s) else: for i in range(k): print(s[i],end="") print("...",end="")
9
8
178
138
N = int(input()) S = list(input()) if len(S) <= N: for i in range(len(S)): print(S[i], end="") else: for i in range(N): print(S[i], end="") print("...")
k = int(input()) s = input() if len(s) <= k: print(s) else: for i in range(k): print(s[i], end="") print("...", end="")
false
11.111111
[ "-N = int(input())", "-S = list(input())", "-if len(S) <= N:", "- for i in range(len(S)):", "- print(S[i], end=\"\")", "+k = int(input())", "+s = input()", "+if len(s) <= k:", "+ print(s)", "- for i in range(N):", "- print(S[i], end=\"\")", "- print(\"...\")", "+ ...
false
0.045852
0.044905
1.021076
[ "s688972874", "s166193908" ]
u360515075
p02726
python
s141494532
s770044342
1,760
1,585
3,444
3,444
Accepted
Accepted
9.94
N,X,Y = map(int, input().split()) D = [0] * N for i in range(1,N): for j in range(i+1,N+1): D[min(abs(i-j),abs(X-i)+abs(Y-j)+1,abs(Y-i)+abs(X-j)+1)] += 1 print (*D[1:], sep="\n")
N,X,Y = map(int, input().split()) D = [0] * N for i in range(1,N): for j in range(i+1,N+1): D[min(abs(i-j),abs(X-i)+abs(Y-j)+1)] += 1 print (*D[1:], sep="\n")
6
6
190
170
N, X, Y = map(int, input().split()) D = [0] * N for i in range(1, N): for j in range(i + 1, N + 1): D[ min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(Y - i) + abs(X - j) + 1) ] += 1 print(*D[1:], sep="\n")
N, X, Y = map(int, input().split()) D = [0] * N for i in range(1, N): for j in range(i + 1, N + 1): D[min(abs(i - j), abs(X - i) + abs(Y - j) + 1)] += 1 print(*D[1:], sep="\n")
false
0
[ "- D[", "- min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(Y - i) + abs(X - j) + 1)", "- ] += 1", "+ D[min(abs(i - j), abs(X - i) + abs(Y - j) + 1)] += 1" ]
false
0.036566
0.041922
0.872236
[ "s141494532", "s770044342" ]
u911575040
p04000
python
s410499162
s862115288
2,682
1,947
166,868
166,516
Accepted
Accepted
27.4
from collections import defaultdict H, W, N = list(map(int,input().split())) ans =[(H-2)*(W-2)]+[0]*9 blacks = defaultdict(int) for i in range(N): a, b = list(map(int,input().split())) for dx in [-1,0,1]: for dy in [-1,0,1]: if 2 <= a+dx <H and 2 <= b+dy <W: ans[blacks[(a+dx,b+dy)]]...
h,w,n=list(map(int,input().split())) dic={} dx=[-2,-1,0] dy=[-2,-1,0] ans=[0]*10 for _ in range(n): a,b=list(map(int,input().split())) for x in dx: for y in dy: if 1<=a+y and a+y+2<=h and 1<=b+x and b+x+2<=w: if (a+y,b+x) not in dic: dic[(a+y,b+x)]=1 else: ...
16
19
426
430
from collections import defaultdict H, W, N = list(map(int, input().split())) ans = [(H - 2) * (W - 2)] + [0] * 9 blacks = defaultdict(int) for i in range(N): a, b = list(map(int, input().split())) for dx in [-1, 0, 1]: for dy in [-1, 0, 1]: if 2 <= a + dx < H and 2 <= b + dy < W: ...
h, w, n = list(map(int, input().split())) dic = {} dx = [-2, -1, 0] dy = [-2, -1, 0] ans = [0] * 10 for _ in range(n): a, b = list(map(int, input().split())) for x in dx: for y in dy: if 1 <= a + y and a + y + 2 <= h and 1 <= b + x and b + x + 2 <= w: if (a + y, b + x) not in...
false
15.789474
[ "-from collections import defaultdict", "-", "-H, W, N = list(map(int, input().split()))", "-ans = [(H - 2) * (W - 2)] + [0] * 9", "-blacks = defaultdict(int)", "-for i in range(N):", "+h, w, n = list(map(int, input().split()))", "+dic = {}", "+dx = [-2, -1, 0]", "+dy = [-2, -1, 0]", "+ans = [0]...
false
0.256658
0.150387
1.706654
[ "s410499162", "s862115288" ]
u810787773
p02714
python
s480492892
s257201010
1,784
828
8,960
9,156
Accepted
Accepted
53.59
def main(): N = int(eval(input())) S = eval(input()) RGBdict = {"R":0,"G":0,"B":0} for i in range(N): RGBdict[S[i]] += 1 if N%2 == 0: maxsa = (N//2) -1 else: maxsa = N//2 tmp = N - 2 cnt = 0 for j in range(maxsa+1): num = tmp-(j*2) ...
def main(): N = int(eval(input())) S = eval(input()) dict = {'R':0, 'B':0, 'G':0} for i in range(N): dict[S[i]] += 1 ans = dict['R']*dict['B']*dict['G'] for i in range(N-2): if (N-i)%2 == 0: tmp = int((N-i)/2)-1 else: tmp = (N-i)//2 ...
25
19
590
476
def main(): N = int(eval(input())) S = eval(input()) RGBdict = {"R": 0, "G": 0, "B": 0} for i in range(N): RGBdict[S[i]] += 1 if N % 2 == 0: maxsa = (N // 2) - 1 else: maxsa = N // 2 tmp = N - 2 cnt = 0 for j in range(maxsa + 1): num = tmp - (j * 2) ...
def main(): N = int(eval(input())) S = eval(input()) dict = {"R": 0, "B": 0, "G": 0} for i in range(N): dict[S[i]] += 1 ans = dict["R"] * dict["B"] * dict["G"] for i in range(N - 2): if (N - i) % 2 == 0: tmp = int((N - i) / 2) - 1 else: tmp = (N - ...
false
24
[ "- RGBdict = {\"R\": 0, \"G\": 0, \"B\": 0}", "+ dict = {\"R\": 0, \"B\": 0, \"G\": 0}", "- RGBdict[S[i]] += 1", "- if N % 2 == 0:", "- maxsa = (N // 2) - 1", "- else:", "- maxsa = N // 2", "- tmp = N - 2", "- cnt = 0", "- for j in range(maxsa + 1):", "-...
false
0.077887
0.066998
1.162523
[ "s480492892", "s257201010" ]
u759412327
p03681
python
s419463004
s987034662
703
423
5,120
11,024
Accepted
Accepted
39.83
from math import factorial as f N,M = list(map(int,input().split())) print((max(0,2-abs(N-M))*f(N)*f(M)%(10**9+7)))
from math import * N,M = list(map(int,input().split())) if abs(N-M)==0: ans = 2*factorial(N)*factorial(M) elif abs(N-M)==1: ans = factorial(N)*factorial(M) else: ans = 0 print((ans%(10**9+7)))
3
11
109
202
from math import factorial as f N, M = list(map(int, input().split())) print((max(0, 2 - abs(N - M)) * f(N) * f(M) % (10**9 + 7)))
from math import * N, M = list(map(int, input().split())) if abs(N - M) == 0: ans = 2 * factorial(N) * factorial(M) elif abs(N - M) == 1: ans = factorial(N) * factorial(M) else: ans = 0 print((ans % (10**9 + 7)))
false
72.727273
[ "-from math import factorial as f", "+from math import *", "-print((max(0, 2 - abs(N - M)) * f(N) * f(M) % (10**9 + 7)))", "+if abs(N - M) == 0:", "+ ans = 2 * factorial(N) * factorial(M)", "+elif abs(N - M) == 1:", "+ ans = factorial(N) * factorial(M)", "+else:", "+ ans = 0", "+print((an...
false
0.047566
0.046724
1.018021
[ "s419463004", "s987034662" ]
u620084012
p03281
python
s119552429
s782932404
177
17
38,384
3,060
Accepted
Accepted
90.4
import math N = int(eval(input())) ans = 0 for m in range(1,N+1,2): P = set([1,m]) for k in range(2,math.floor(math.sqrt(m))+1): if m % k == 0: P.add(k) P.add(m//k) if len(P) == 8: ans += 1 print(ans)
import math N = int(eval(input())) def yakusuu(N): P = [1,N] for k in range(2,math.floor(math.sqrt(N))+1): if N % k == 0: P.append(k) P.append(N//k) return len(set(P)) ans = 0 for k in range(1,N+1,2): if yakusuu(k) == 8: ans += 1 print(ans)
12
14
258
304
import math N = int(eval(input())) ans = 0 for m in range(1, N + 1, 2): P = set([1, m]) for k in range(2, math.floor(math.sqrt(m)) + 1): if m % k == 0: P.add(k) P.add(m // k) if len(P) == 8: ans += 1 print(ans)
import math N = int(eval(input())) def yakusuu(N): P = [1, N] for k in range(2, math.floor(math.sqrt(N)) + 1): if N % k == 0: P.append(k) P.append(N // k) return len(set(P)) ans = 0 for k in range(1, N + 1, 2): if yakusuu(k) == 8: ans += 1 print(ans)
false
14.285714
[ "+", "+", "+def yakusuu(N):", "+ P = [1, N]", "+ for k in range(2, math.floor(math.sqrt(N)) + 1):", "+ if N % k == 0:", "+ P.append(k)", "+ P.append(N // k)", "+ return len(set(P))", "+", "+", "-for m in range(1, N + 1, 2):", "- P = set([1, m])", "-...
false
0.045316
0.007585
5.974337
[ "s119552429", "s782932404" ]