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
u460245024
p03078
python
s605567230
s186496807
1,164
42
140,520
4,976
Accepted
Accepted
96.39
import itertools X, Y, Z, K = map(int, input().split()) A = sorted(list(map(int, input().split()))) B = sorted(list(map(int, input().split()))) C = sorted(list(map(int, input().split()))) comb_ab = [] for a, b in itertools.product(A, B): comb_ab.append(sum([a, b])) comb_ab_top = sorted(comb_ab, revers...
import heapq X, Y, Z, K = list(map(int, input().split())) A = sorted(list(map(int, input().split())), reverse=True) B = sorted(list(map(int, input().split())), reverse=True) C = sorted(list(map(int, input().split())), reverse=True) Q = [] heapq.heappush(Q, (-1*(A[0]+B[0]+C[0]), 0, 0, 0)) registered = set() ...
19
24
500
907
import itertools X, Y, Z, K = map(int, input().split()) A = sorted(list(map(int, input().split()))) B = sorted(list(map(int, input().split()))) C = sorted(list(map(int, input().split()))) comb_ab = [] for a, b in itertools.product(A, B): comb_ab.append(sum([a, b])) comb_ab_top = sorted(comb_ab, reverse=True)[:K] c...
import heapq X, Y, Z, K = list(map(int, input().split())) A = sorted(list(map(int, input().split())), reverse=True) B = sorted(list(map(int, input().split())), reverse=True) C = sorted(list(map(int, input().split())), reverse=True) Q = [] heapq.heappush(Q, (-1 * (A[0] + B[0] + C[0]), 0, 0, 0)) registered = set() regis...
false
20.833333
[ "-import itertools", "+import heapq", "-X, Y, Z, K = map(int, input().split())", "-A = sorted(list(map(int, input().split())))", "-B = sorted(list(map(int, input().split())))", "-C = sorted(list(map(int, input().split())))", "-comb_ab = []", "-for a, b in itertools.product(A, B):", "- comb_ab.app...
false
0.040546
0.036266
1.118041
[ "s605567230", "s186496807" ]
u440566786
p03003
python
s747484338
s446619162
420
334
72,412
72,540
Accepted
Accepted
20.48
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.readline().rstrip() def resolve(): n,m=list(map(int,input().split())) S=list(map(int,input().split())) T=list(map(int,input().split())) C=[[0]*(m+1) for _ in range(n+1)] from itertools import ...
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda:sys.stdin.readline().rstrip() def resolve(): n,m=list(map(int,input().split())) S=list(map(int,input().split())) T=list(map(int,input().split())) C=[[0]*(m+1) for _ in range(n+1)] # dp の累積和を持つ for i in r...
17
21
520
597
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.readline().rstrip() def resolve(): n, m = list(map(int, input().split())) S = list(map(int, input().split())) T = list(map(int, input().split())) C = [[0] * (m + 1) for _ in range(n + 1)] fro...
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.readline().rstrip() def resolve(): n, m = list(map(int, input().split())) S = list(map(int, input().split())) T = list(map(int, input().split())) C = [[0] * (m + 1) for _ in range(n + 1)] # dp の...
false
19.047619
[ "- C = [[0] * (m + 1) for _ in range(n + 1)]", "- from itertools import product", "-", "- for i, j in product(list(range(n)), list(range(m))):", "- dp = C[i][j] + 1 if (S[i] == T[j]) else 0", "- C[i + 1][j + 1] = dp + C[i][j + 1] + C[i + 1][j] - C[i][j]", "- C[i + 1][j + 1]...
false
0.035331
0.034935
1.01134
[ "s747484338", "s446619162" ]
u477977638
p03108
python
s417822552
s515085817
724
504
97,884
32,648
Accepted
Accepted
30.39
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: ...
import sys read = sys.stdin.buffer.read input = sys.stdin.readline input = sys.stdin.buffer.readline #sys.setrecursionlimit(10**9) #from functools import lru_cache def RD(): return sys.stdin.read() def II(): return int(eval(input())) def MI(): return list(map(int,input().split())) def MF(): return list(m...
87
102
1,783
2,195
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.pare...
import sys read = sys.stdin.buffer.read input = sys.stdin.readline input = sys.stdin.buffer.readline # sys.setrecursionlimit(10**9) # from functools import lru_cache def RD(): return sys.stdin.read() def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MF(): re...
false
14.705882
[ "+input = sys.stdin.readline", "-inputs = sys.stdin.buffer.readlines", "+# sys.setrecursionlimit(10**9)", "+# from functools import lru_cache", "+def RD():", "+ return sys.stdin.read()", "+def II():", "+ return int(eval(input()))", "+", "+", "+def MI():", "+ return list(map(int, input...
false
0.036919
0.037042
0.996667
[ "s417822552", "s515085817" ]
u162893962
p02791
python
s988601003
s079966477
133
99
26,012
24,744
Accepted
Accepted
25.56
N = int(eval(input())) ps = [int(i) for i in input().split()] cnt = 0 mark = ps[0] for p in ps: if mark >= p: cnt += 1 mark = min(mark, p) print(cnt)
N = int(eval(input())) ps = [int(i) for i in input().split()] cnt = 1 mark = ps[0] for p in ps[1:]: if mark >= p: cnt += 1 mark = p print(cnt)
11
11
176
169
N = int(eval(input())) ps = [int(i) for i in input().split()] cnt = 0 mark = ps[0] for p in ps: if mark >= p: cnt += 1 mark = min(mark, p) print(cnt)
N = int(eval(input())) ps = [int(i) for i in input().split()] cnt = 1 mark = ps[0] for p in ps[1:]: if mark >= p: cnt += 1 mark = p print(cnt)
false
0
[ "-cnt = 0", "+cnt = 1", "-for p in ps:", "+for p in ps[1:]:", "- mark = min(mark, p)", "+ mark = p" ]
false
0.065023
0.044865
1.449314
[ "s988601003", "s079966477" ]
u401686269
p02956
python
s529369241
s996811181
1,979
1,487
214,256
208,496
Accepted
Accepted
24.86
# 解説放送の方針 # 平面走査をし、各点について、左上、左下、右上、右下にある点を数え、計算する。 # 解説放送ではBITを2本使っていたが、座標圧縮の結果を利用してBIT1本で済むようにした N = int(eval(input())) xy = [tuple(map(int,input().split())) for _ in range(N)] mod = 998244353 class BIT: '''https://tjkendev.github.io/procon-library/python/range_query/bit.html''' def __init__(self...
# 解説放送の方針 # 平面走査をし、各点について、左上、左下、右上、右下にある点を数え、計算する。 # 解説放送ではBITを2本使っていたが、座標圧縮の結果を利用してBIT1本で済むようにした N = int(eval(input())) xy = [tuple(map(int,input().split())) for _ in range(N)] mod = 998244353 class BIT: '''https://tjkendev.github.io/procon-library/python/range_query/bit.html''' def __init__(self...
105
103
2,200
2,173
# 解説放送の方針 # 平面走査をし、各点について、左上、左下、右上、右下にある点を数え、計算する。 # 解説放送ではBITを2本使っていたが、座標圧縮の結果を利用してBIT1本で済むようにした N = int(eval(input())) xy = [tuple(map(int, input().split())) for _ in range(N)] mod = 998244353 class BIT: """https://tjkendev.github.io/procon-library/python/range_query/bit.html""" def __init__(self, n): ...
# 解説放送の方針 # 平面走査をし、各点について、左上、左下、右上、右下にある点を数え、計算する。 # 解説放送ではBITを2本使っていたが、座標圧縮の結果を利用してBIT1本で済むようにした N = int(eval(input())) xy = [tuple(map(int, input().split())) for _ in range(N)] mod = 998244353 class BIT: """https://tjkendev.github.io/procon-library/python/range_query/bit.html""" def __init__(self, n): ...
false
1.904762
[ "-# いちいち2^nを計算していると遅いのでメモ化", "-def pow2(x):", "- if memo[x - 1]:", "- return memo[x - 1]", "- out = pow(2, x, mod)", "- memo[x - 1] = out", "- return out", "-", "-", "+# いちいち2^nを計算していると遅いのでテーブル作成", "+pow2 = [1] * (N + 1)", "+for i in range(1, N + 1):", "+ pow2[i] = pow2...
false
0.069338
0.073991
0.937122
[ "s529369241", "s996811181" ]
u401686269
p02565
python
s826279144
s134486990
692
371
10,208
10,116
Accepted
Accepted
46.39
import sys class SCC: ''' SCC class with non-recursive DFS. ''' def __init__(self,N): self.N = N self.G1 = [[] for _ in range(N)] self.G2 = [[] for _ in range(N)] def add_edge(self,a,b): self.G1[a].append(b) self.G2[b].append(a) def scc(self): self.seen = [0]...
import sys class SCC: ''' SCC class with non-recursive DFS. ''' def __init__(self,N): self.N = N self.G1 = [[] for _ in range(N)] self.G2 = [[] for _ in range(N)] def add_edge(self,a,b): self.G1[a].append(b) self.G2[b].append(a) def scc(self): self.seen = [0]...
111
115
2,820
2,915
import sys class SCC: """ SCC class with non-recursive DFS. """ def __init__(self, N): self.N = N self.G1 = [[] for _ in range(N)] self.G2 = [[] for _ in range(N)] def add_edge(self, a, b): self.G1[a].append(b) self.G2[b].append(a) def scc(self): ...
import sys class SCC: """ SCC class with non-recursive DFS. """ def __init__(self, N): self.N = N self.G1 = [[] for _ in range(N)] self.G2 = [[] for _ in range(N)] def add_edge(self, a, b): self.G1[a].append(b) self.G2[b].append(a) def scc(self): ...
false
3.478261
[ "- self.scc.add_edge(f * N + i, (1 ^ g) * N + j)", "- self.scc.add_edge(g * N + j, (1 ^ f) * N + i)", "+ self.scc.add_edge(f * self.N + i, (1 ^ g) * self.N + j)", "+ self.scc.add_edge(g * self.N + j, (1 ^ f) * self.N + i)", "-N, D = map(int, input().split())", "-xy = [tuple(map...
false
0.075357
0.074314
1.014044
[ "s826279144", "s134486990" ]
u219417113
p03103
python
s634621788
s125534089
875
247
59,992
17,732
Accepted
Accepted
71.77
N, M = list(map(int, input().split())) AB = sorted([tuple(map(int, input().split())) for _ in range(N)]) count = 0 ans = 0 for a, b in AB: if count + b >= M: ans += a * (M - count) break else: ans += a * b count += b print(ans)
def main(): import sys input = sys.stdin.readline N, M = list(map(int, input().split())) AB = sorted([tuple(map(int, input().split())) for _ in range(N)]) money = 0 count = 0 for a, b in AB: if count + b >= M: money += a * (M - count) break ...
12
19
272
433
N, M = list(map(int, input().split())) AB = sorted([tuple(map(int, input().split())) for _ in range(N)]) count = 0 ans = 0 for a, b in AB: if count + b >= M: ans += a * (M - count) break else: ans += a * b count += b print(ans)
def main(): import sys input = sys.stdin.readline N, M = list(map(int, input().split())) AB = sorted([tuple(map(int, input().split())) for _ in range(N)]) money = 0 count = 0 for a, b in AB: if count + b >= M: money += a * (M - count) break else: ...
false
36.842105
[ "-N, M = list(map(int, input().split()))", "-AB = sorted([tuple(map(int, input().split())) for _ in range(N)])", "-count = 0", "-ans = 0", "-for a, b in AB:", "- if count + b >= M:", "- ans += a * (M - count)", "- break", "- else:", "- ans += a * b", "- count +=...
false
0.044496
0.036125
1.231737
[ "s634621788", "s125534089" ]
u058240079
p03607
python
s942394498
s180117593
182
159
18,536
18,536
Accepted
Accepted
12.64
from collections import Counter c = Counter([int(input()) for _ in range(int(input()))]) print(len([x for x in list(c.values()) if x % 2 == 1]))
from collections import Counter print(len([x for x in list(Counter([int(input()) for _ in range(int(input()))]).values()) if x % 2 == 1]))
3
2
151
144
from collections import Counter c = Counter([int(input()) for _ in range(int(input()))]) print(len([x for x in list(c.values()) if x % 2 == 1]))
from collections import Counter print( len( [ x for x in list(Counter([int(input()) for _ in range(int(input()))]).values()) if x % 2 == 1 ] ) )
false
33.333333
[ "-c = Counter([int(input()) for _ in range(int(input()))])", "-print(len([x for x in list(c.values()) if x % 2 == 1]))", "+print(", "+ len(", "+ [", "+ x", "+ for x in list(Counter([int(input()) for _ in range(int(input()))]).values())", "+ if x % 2 == 1", ...
false
0.039625
0.03942
1.005212
[ "s942394498", "s180117593" ]
u186838327
p02937
python
s716492078
s052070634
159
120
9,296
87,988
Accepted
Accepted
24.53
S = list(str(eval(input()))) T = list(str(eval(input()))) S_ = set(list(S)) T_ = set(list(T)) for c in T: if c not in S_: print((-1)) exit() d = [[] for _ in range(26)] for i, s in enumerate(S): d[ord(s)-ord('a')].append(i) #print(d) q = 0 pre = -1 import bisect for t in T: ...
s = list(str(eval(input()))) t = list(str(eval(input()))) X = [[] for _ in range(26)] for i, c in enumerate(s): j = ord(c)-ord('a') X[j].append(i) n = len(s) q = 0 r = -1 import bisect for c in t: j = ord(c)-ord('a') if len(X[j]) == 0: print((-1)) exit() idx = bise...
27
27
497
498
S = list(str(eval(input()))) T = list(str(eval(input()))) S_ = set(list(S)) T_ = set(list(T)) for c in T: if c not in S_: print((-1)) exit() d = [[] for _ in range(26)] for i, s in enumerate(S): d[ord(s) - ord("a")].append(i) # print(d) q = 0 pre = -1 import bisect for t in T: j = ord(t) - ...
s = list(str(eval(input()))) t = list(str(eval(input()))) X = [[] for _ in range(26)] for i, c in enumerate(s): j = ord(c) - ord("a") X[j].append(i) n = len(s) q = 0 r = -1 import bisect for c in t: j = ord(c) - ord("a") if len(X[j]) == 0: print((-1)) exit() idx = bisect.bisect_righ...
false
0
[ "-S = list(str(eval(input())))", "-T = list(str(eval(input())))", "-S_ = set(list(S))", "-T_ = set(list(T))", "-for c in T:", "- if c not in S_:", "+s = list(str(eval(input())))", "+t = list(str(eval(input())))", "+X = [[] for _ in range(26)]", "+for i, c in enumerate(s):", "+ j = ord(c) -...
false
0.039655
0.047505
0.83476
[ "s716492078", "s052070634" ]
u562935282
p03019
python
s376043264
s603921728
859
613
81,820
79,708
Accepted
Accepted
28.64
# 解説 def accumulate(a): su = 0 yield su for x in a: su += x yield su def solve_agc034c(): from collections import namedtuple import sys input = sys.stdin.readline Test = namedtuple('Test', 'Aoki_score lower_bound upper_bound') Test.D_partial = lambda s...
# 写経 # にぶたん不要の解法 # https://atcoder.jp/contests/agc034/submissions/5768266 # generatorを作って # 外でminする def accumulate(a): """初項0""" su = 0 yield su for x in a: su += x yield su # class TestCaseReader: # def __init__(self): # self._gen = self.gen() # # ...
74
96
1,996
2,772
# 解説 def accumulate(a): su = 0 yield su for x in a: su += x yield su def solve_agc034c(): from collections import namedtuple import sys input = sys.stdin.readline Test = namedtuple("Test", "Aoki_score lower_bound upper_bound") Test.D_partial = ( lambda self, sc...
# 写経 # にぶたん不要の解法 # https://atcoder.jp/contests/agc034/submissions/5768266 # generatorを作って # 外でminする def accumulate(a): """初項0""" su = 0 yield su for x in a: su += x yield su # class TestCaseReader: # def __init__(self): # self._gen = self.gen() # # def gen(self): # ...
false
22.916667
[ "-# 解説", "+# 写経", "+# にぶたん不要の解法", "+# https://atcoder.jp/contests/agc034/submissions/5768266", "+# generatorを作って", "+# 外でminする", "+ \"\"\"初項0\"\"\"", "+# class TestCaseReader:", "+# def __init__(self):", "+# self._gen = self.gen()", "+#", "+# def gen(self):", "+# i...
false
0.140496
0.036397
3.860152
[ "s376043264", "s603921728" ]
u347640436
p02639
python
s771452929
s372014741
26
24
9,016
8,676
Accepted
Accepted
7.69
x = list(map(int, input().split())) for i in range(5): if x[i] == 0: print((i + 1)) exit()
x = list(map(int, input().split())) for i in range(5): if x[i] == 0: print((i + 1)) break
6
6
115
114
x = list(map(int, input().split())) for i in range(5): if x[i] == 0: print((i + 1)) exit()
x = list(map(int, input().split())) for i in range(5): if x[i] == 0: print((i + 1)) break
false
0
[ "- exit()", "+ break" ]
false
0.048742
0.128892
0.378162
[ "s771452929", "s372014741" ]
u192042624
p02691
python
s881056221
s560649744
559
440
112,988
95,452
Accepted
Accepted
21.29
import numpy as np import sys import math import collections read = sys.stdin.readline N = int(read().rstrip()) A = list(map(int,read().rstrip().split())) da = [] for i , a in enumerate(A): da.append([i,a]) dR = collections.defaultdict(int) dL = collections.defaultdict(int) ans = 0 for d in rever...
import numpy as np import sys import math read = sys.stdin.readline N = int(read().rstrip()) A = list(map(int,read().rstrip().split())) da = [] for i , a in enumerate(A): da.append([i,a]) dR = {} dL = {} ans = 0 for d in reversed(da): r = d[0] + d[1] + 1 l = d[0] - d[1] + 1 if r in...
27
32
451
502
import numpy as np import sys import math import collections read = sys.stdin.readline N = int(read().rstrip()) A = list(map(int, read().rstrip().split())) da = [] for i, a in enumerate(A): da.append([i, a]) dR = collections.defaultdict(int) dL = collections.defaultdict(int) ans = 0 for d in reversed(da): r = ...
import numpy as np import sys import math read = sys.stdin.readline N = int(read().rstrip()) A = list(map(int, read().rstrip().split())) da = [] for i, a in enumerate(A): da.append([i, a]) dR = {} dL = {} ans = 0 for d in reversed(da): r = d[0] + d[1] + 1 l = d[0] - d[1] + 1 if r in dR: dR[r] +...
false
15.625
[ "-import collections", "-dR = collections.defaultdict(int)", "-dL = collections.defaultdict(int)", "+dR = {}", "+dL = {}", "- dR[r] += 1", "- ans += dL[r]", "- dL[l] += 1", "+ if r in dR:", "+ dR[r] += 1", "+ else:", "+ dR[r] = 1", "+ if r in dL:", "+ ...
false
0.047508
0.045736
1.038745
[ "s881056221", "s560649744" ]
u790710233
p03474
python
s181472724
s112586920
19
17
3,060
2,940
Accepted
Accepted
10.53
a, b = list(map(int, input().split())) s = eval(input()) print(('Yes' if len(s) == a + b + 1 and s[a] == '-' and all(i in '0123456789' for i in s[:a]+s[a+1:]) else 'No'))
a, b = list(map(int, input().split())) s = eval(input()) print(('Yes' if s.count('-') == 1 and s[a] == '-' else 'No'))
4
3
166
107
a, b = list(map(int, input().split())) s = eval(input()) print( ( "Yes" if len(s) == a + b + 1 and s[a] == "-" and all(i in "0123456789" for i in s[:a] + s[a + 1 :]) else "No" ) )
a, b = list(map(int, input().split())) s = eval(input()) print(("Yes" if s.count("-") == 1 and s[a] == "-" else "No"))
false
25
[ "-print(", "- (", "- \"Yes\"", "- if len(s) == a + b + 1", "- and s[a] == \"-\"", "- and all(i in \"0123456789\" for i in s[:a] + s[a + 1 :])", "- else \"No\"", "- )", "-)", "+print((\"Yes\" if s.count(\"-\") == 1 and s[a] == \"-\" else \"No\"))" ]
false
0.044833
0.045832
0.978216
[ "s181472724", "s112586920" ]
u971091945
p02614
python
s047411810
s959262410
143
65
9,252
9,176
Accepted
Accepted
54.55
import copy h, w, k = list(map(int, input().split())) hw = [] mas = [] mas_su = 0 for i in range(h): hwi = eval(input()) masi = [] for j in range(w): if hwi[j] == "#": masi.append(1) else: masi.append(0) mas_su += sum(masi) mas.append(masi) ...
h, w, k = [int(i) for i in input().split()] mas = [eval(input()) for _ in range(h)] ans = 0 for h_1 in range(2**h): for w_1 in range(2**w): black = 0 for i in range(h): for j in range(w): if (h_1 >> i) & 1 == 0 and (w_1 >> j) & 1 == 0 and mas[i][j] == '#': ...
40
16
852
402
import copy h, w, k = list(map(int, input().split())) hw = [] mas = [] mas_su = 0 for i in range(h): hwi = eval(input()) masi = [] for j in range(w): if hwi[j] == "#": masi.append(1) else: masi.append(0) mas_su += sum(masi) mas.append(masi) l = 2 ** (h + w) a...
h, w, k = [int(i) for i in input().split()] mas = [eval(input()) for _ in range(h)] ans = 0 for h_1 in range(2**h): for w_1 in range(2**w): black = 0 for i in range(h): for j in range(w): if (h_1 >> i) & 1 == 0 and (w_1 >> j) & 1 == 0 and mas[i][j] == "#": ...
false
60
[ "-import copy", "-", "-h, w, k = list(map(int, input().split()))", "-hw = []", "-mas = []", "-mas_su = 0", "-for i in range(h):", "- hwi = eval(input())", "- masi = []", "- for j in range(w):", "- if hwi[j] == \"#\":", "- masi.append(1)", "- else:", "- ...
false
0.093934
0.048125
1.951884
[ "s047411810", "s959262410" ]
u888337853
p03295
python
s983211849
s418915446
220
175
26,068
25,956
Accepted
Accepted
20.45
import sys import math import collections import bisect import copy # import numpy as np sys.setrecursionlimit(10 ** 7) INF = 10 ** 16 MOD = 10 ** 9 + 7 # MOD = 998244353 ni = lambda: int(sys.stdin.readline()) ns = lambda: list(map(int, sys.stdin.readline().split())) na = lambda: list(map(int, sys.std...
import sys import math import collections import bisect import copy # import numpy as np sys.setrecursionlimit(10 ** 7) INF = 10 ** 16 MOD = 10 ** 9 + 7 # MOD = 998244353 ni = lambda: int(sys.stdin.readline()) ns = lambda: list(map(int, sys.stdin.readline().split())) na = lambda: list(map(int, sys.std...
42
42
802
770
import sys import math import collections import bisect import copy # import numpy as np sys.setrecursionlimit(10**7) INF = 10**16 MOD = 10**9 + 7 # MOD = 998244353 ni = lambda: int(sys.stdin.readline()) ns = lambda: list(map(int, sys.stdin.readline().split())) na = lambda: list(map(int, sys.stdin.readline().split()))...
import sys import math import collections import bisect import copy # import numpy as np sys.setrecursionlimit(10**7) INF = 10**16 MOD = 10**9 + 7 # MOD = 998244353 ni = lambda: int(sys.stdin.readline()) ns = lambda: list(map(int, sys.stdin.readline().split())) na = lambda: list(map(int, sys.stdin.readline().split()))...
false
0
[ "- down = []", "+ down = -1", "+ ans = 0", "- idx = bisect.bisect_left(down, a)", "- if idx == len(down):", "- down.append(b - 1)", "- print((len(down)))", "+ if down < a:", "+ down = b - 1", "+ ans += 1", "+ print(ans)" ]
false
0.070767
0.038341
1.845734
[ "s983211849", "s418915446" ]
u131984977
p02412
python
s721700065
s243223479
900
590
6,720
6,720
Accepted
Accepted
34.44
while True: (n, x) = [int(i) for i in input().split()] if n == x == 0: break count = 0 limit = n if n < x else x for a in range(1, limit + 1): for b in range(a + 1, limit + 1): for c in range(b + 1, limit + 1): if sum([a,b,c]) == x: ...
while True: (n, x) = [int(i) for i in input().split()] if n == x == 0: break count = 0 start = n if n < x else x for a in range(start, 0, -1): if a >= x: continue for b in range(a - 1, 0, -1): if sum([a,b]) >= x: continue ...
14
17
359
450
while True: (n, x) = [int(i) for i in input().split()] if n == x == 0: break count = 0 limit = n if n < x else x for a in range(1, limit + 1): for b in range(a + 1, limit + 1): for c in range(b + 1, limit + 1): if sum([a, b, c]) == x: c...
while True: (n, x) = [int(i) for i in input().split()] if n == x == 0: break count = 0 start = n if n < x else x for a in range(start, 0, -1): if a >= x: continue for b in range(a - 1, 0, -1): if sum([a, b]) >= x: continue f...
false
17.647059
[ "- limit = n if n < x else x", "- for a in range(1, limit + 1):", "- for b in range(a + 1, limit + 1):", "- for c in range(b + 1, limit + 1):", "+ start = n if n < x else x", "+ for a in range(start, 0, -1):", "+ if a >= x:", "+ continue", "+ fo...
false
0.064225
0.114386
0.561477
[ "s721700065", "s243223479" ]
u867848444
p02659
python
s728746844
s328015307
23
20
9,108
9,108
Accepted
Accepted
13.04
a, b = list(map(float, input().split())) a = int(a) b = int(b * 100 + 0.5) ans = a * b // 100 print((int(ans)))
a, b = list(map(float, input().split())) a = int(a) b = int(b * 1000) ans = a * b // 1000 print((int(ans)))
5
5
107
103
a, b = list(map(float, input().split())) a = int(a) b = int(b * 100 + 0.5) ans = a * b // 100 print((int(ans)))
a, b = list(map(float, input().split())) a = int(a) b = int(b * 1000) ans = a * b // 1000 print((int(ans)))
false
0
[ "-b = int(b * 100 + 0.5)", "-ans = a * b // 100", "+b = int(b * 1000)", "+ans = a * b // 1000" ]
false
0.039119
0.04768
0.820462
[ "s728746844", "s328015307" ]
u766566560
p03370
python
s348906225
s893590587
28
17
2,940
2,940
Accepted
Accepted
39.29
N, X = list(map(int, input().split())) list = [] for i in range(N): m = int(eval(input())) list.append(m) print((N + (X - sum(list)) // min(list)))
N, X = list(map(int, input().split())) m = [int(eval(input())) for _ in range(N)] print((N + (X - sum(m)) // min(m)))
7
3
146
107
N, X = list(map(int, input().split())) list = [] for i in range(N): m = int(eval(input())) list.append(m) print((N + (X - sum(list)) // min(list)))
N, X = list(map(int, input().split())) m = [int(eval(input())) for _ in range(N)] print((N + (X - sum(m)) // min(m)))
false
57.142857
[ "-list = []", "-for i in range(N):", "- m = int(eval(input()))", "- list.append(m)", "-print((N + (X - sum(list)) // min(list)))", "+m = [int(eval(input())) for _ in range(N)]", "+print((N + (X - sum(m)) // min(m)))" ]
false
0.041593
0.056381
0.737709
[ "s348906225", "s893590587" ]
u982591663
p02779
python
s495871701
s987211150
179
116
26,808
32,948
Accepted
Accepted
35.2
#C N = int(eval(input())) A = sorted(list(map(int, input().split()))) ans = "YES" for i in range(N-1): if A[i] == A[i+1]: ans = "NO" break print(ans)
N = int(eval(input())) A = list(map(int, input().split())) memo = {} ans = "YES" for a in A: if a in memo: ans = "NO" break memo[a] = None print(ans)
11
12
183
181
# C N = int(eval(input())) A = sorted(list(map(int, input().split()))) ans = "YES" for i in range(N - 1): if A[i] == A[i + 1]: ans = "NO" break print(ans)
N = int(eval(input())) A = list(map(int, input().split())) memo = {} ans = "YES" for a in A: if a in memo: ans = "NO" break memo[a] = None print(ans)
false
8.333333
[ "-# C", "-A = sorted(list(map(int, input().split())))", "+A = list(map(int, input().split()))", "+memo = {}", "-for i in range(N - 1):", "- if A[i] == A[i + 1]:", "+for a in A:", "+ if a in memo:", "+ memo[a] = None" ]
false
0.036447
0.043905
0.830133
[ "s495871701", "s987211150" ]
u316341119
p03045
python
s111312862
s088750805
1,547
711
84,832
53,664
Accepted
Accepted
54.04
from queue import Queue N, M = list(map(int, input().split())) d = {} for i in range(1, N+1): d[i] = [] for i in range(M): x, y, z = list(map(int, input().split())) d[x].append(y) d[y].append(x) isChecked = [False for i in range(N)] ans = 0 for k in d: if isChecked[k-1]: con...
class UnionFindTree: _node_num = 0 _parent_list = [] _tree_len = [] _num_trees = 0 def __init__(self, node_num): self._node_num = node_num self._parent_list = [-1 for i in range(node_num+1)] self._tree_len = [0 for i in range(node_num+1)] self._num_trees = ...
28
45
547
1,186
from queue import Queue N, M = list(map(int, input().split())) d = {} for i in range(1, N + 1): d[i] = [] for i in range(M): x, y, z = list(map(int, input().split())) d[x].append(y) d[y].append(x) isChecked = [False for i in range(N)] ans = 0 for k in d: if isChecked[k - 1]: continue an...
class UnionFindTree: _node_num = 0 _parent_list = [] _tree_len = [] _num_trees = 0 def __init__(self, node_num): self._node_num = node_num self._parent_list = [-1 for i in range(node_num + 1)] self._tree_len = [0 for i in range(node_num + 1)] self._num_trees = node_n...
false
37.777778
[ "-from queue import Queue", "+class UnionFindTree:", "+ _node_num = 0", "+ _parent_list = []", "+ _tree_len = []", "+ _num_trees = 0", "-N, M = list(map(int, input().split()))", "-d = {}", "-for i in range(1, N + 1):", "- d[i] = []", "-for i in range(M):", "- x, y, z = list(m...
false
0.2054
0.043885
4.68039
[ "s111312862", "s088750805" ]
u102461423
p04034
python
s910636477
s385087074
113
95
15,608
22,496
Accepted
Accepted
15.93
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,M = list(map(int,readline().split())) m = list(map(int,read().split())) XY = list(zip(m,m)) red = [0] + [1] + [0] * (N-1) ball = [0] + [1] * N for x,y in XY: if red[x]: red[...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = list(map(int, readline().split())) m = list(map(int, read().split())) count = [1] * (N+1) red = [0] * (N+1) red[1] = True for x, y in zip(m, m): count[x] -= 1 count[y] += 1...
21
21
417
405
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = list(map(int, readline().split())) m = list(map(int, read().split())) XY = list(zip(m, m)) red = [0] + [1] + [0] * (N - 1) ball = [0] + [1] * N for x, y in XY: if red[x]: red[y] = 1 ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = list(map(int, readline().split())) m = list(map(int, read().split())) count = [1] * (N + 1) red = [0] * (N + 1) red[1] = True for x, y in zip(m, m): count[x] -= 1 count[y] += 1 if red[...
false
0
[ "-XY = list(zip(m, m))", "-red = [0] + [1] + [0] * (N - 1)", "-ball = [0] + [1] * N", "-for x, y in XY:", "+count = [1] * (N + 1)", "+red = [0] * (N + 1)", "+red[1] = True", "+for x, y in zip(m, m):", "+ count[x] -= 1", "+ count[y] += 1", "- ball[x] -= 1", "- ball[y] += 1", "- ...
false
0.036519
0.067557
0.540571
[ "s910636477", "s385087074" ]
u940139461
p03575
python
s917118509
s088468555
238
188
43,484
40,560
Accepted
Accepted
21.01
n, m = list(map(int, input().split())) brides = [] for _ in range(m): a, b = list(map(int, input().split())) brides.append((a, b)) class Union: def __init__(self, val): self.val = val self.parent = self self.rank = 0 def get_root(self): n = self ...
# https://atcoder.jp/contests/abc075/tasks/abc075_c # 各頂点を結ぶクエリー(a, bの情報)ごとに、 # それを実行しなくてもたどり着ける頂点が総頂点数(n)に一致するかを判定する。 n, m = list(map(int, input().split())) queries = [] for _ in range(m): a, b = list(map(int, input().split())) queries.append((a, b)) def dfs(graph, n): visited = [False] * (n +...
51
39
1,216
941
n, m = list(map(int, input().split())) brides = [] for _ in range(m): a, b = list(map(int, input().split())) brides.append((a, b)) class Union: def __init__(self, val): self.val = val self.parent = self self.rank = 0 def get_root(self): n = self while n.parent ...
# https://atcoder.jp/contests/abc075/tasks/abc075_c # 各頂点を結ぶクエリー(a, bの情報)ごとに、 # それを実行しなくてもたどり着ける頂点が総頂点数(n)に一致するかを判定する。 n, m = list(map(int, input().split())) queries = [] for _ in range(m): a, b = list(map(int, input().split())) queries.append((a, b)) def dfs(graph, n): visited = [False] * (n + 1) vis...
false
23.529412
[ "+# https://atcoder.jp/contests/abc075/tasks/abc075_c", "+# 各頂点を結ぶクエリー(a, bの情報)ごとに、", "+# それを実行しなくてもたどり着ける頂点が総頂点数(n)に一致するかを判定する。", "-brides = []", "+queries = []", "- brides.append((a, b))", "+ queries.append((a, b))", "-class Union:", "- def __init__(self, val):", "- self.val = va...
false
0.036
0.034858
1.032765
[ "s917118509", "s088468555" ]
u022407960
p02366
python
s856196268
s258108239
230
180
23,884
23,784
Accepted
Accepted
21.74
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 5 4 0 1 1 2 2 3 3 4 output: 1 2 3 """ import sys sys.setrecursionlimit(int(1e6)) def generate_adj_table(_v_info): for v_detail in _v_info: source, target = map(int, v_detail) init_adj_table[source].append(targe...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 5 4 0 1 1 2 2 3 3 4 output: 1 2 3 """ import sys sys.setrecursionlimit(int(1e6)) def generate_adj_table(_v_info): for v_detail in _v_info: source, target = map(int, v_detail) init_adj_table[source].append(targe...
84
85
1,928
1,960
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 5 4 0 1 1 2 2 3 3 4 output: 1 2 3 """ import sys sys.setrecursionlimit(int(1e6)) def generate_adj_table(_v_info): for v_detail in _v_info: source, target = map(int, v_detail) init_adj_table[source].append(target) init_adj_table[targ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 5 4 0 1 1 2 2 3 3 4 output: 1 2 3 """ import sys sys.setrecursionlimit(int(1e6)) def generate_adj_table(_v_info): for v_detail in _v_info: source, target = map(int, v_detail) init_adj_table[source].append(target) init_adj_table[targ...
false
1.176471
[ "- Tarjan(v, parents, visited, disc, low)", "+ if not visited[v]:", "+ Tarjan(v, parents, visited, disc, low)" ]
false
0.088126
0.036987
2.382579
[ "s856196268", "s258108239" ]
u525065967
p02614
python
s709827120
s056343569
69
63
9,184
9,156
Accepted
Accepted
8.7
h, w, k = list(map(int, input().split())) C = [] for _ in range(h): C.append(eval(input())) import itertools ans = 0 for bit in range(1<<(h+w)): c = 0 for i in range(h): for j in range(w): if bit>>(w+i) & 1 and bit>>j & 1: c += C[i][j] == '#' if c == k: ans += 1 print(ans)
h, w, k = list(map(int, input().split())) C = [] for _ in range(h): C.append(eval(input())) import itertools ans = 0 for bit in range(1<<(h+w)): c = 0 for i in range(w, h+w): for j in range(w): if bit>>i & 1 and bit>>j & 1: c += C[i-w][j] == '#' if c == k: ans += 1 print(ans)
12
12
305
308
h, w, k = list(map(int, input().split())) C = [] for _ in range(h): C.append(eval(input())) import itertools ans = 0 for bit in range(1 << (h + w)): c = 0 for i in range(h): for j in range(w): if bit >> (w + i) & 1 and bit >> j & 1: c += C[i][j] == "#" if c == k: ...
h, w, k = list(map(int, input().split())) C = [] for _ in range(h): C.append(eval(input())) import itertools ans = 0 for bit in range(1 << (h + w)): c = 0 for i in range(w, h + w): for j in range(w): if bit >> i & 1 and bit >> j & 1: c += C[i - w][j] == "#" if c == k...
false
0
[ "- for i in range(h):", "+ for i in range(w, h + w):", "- if bit >> (w + i) & 1 and bit >> j & 1:", "- c += C[i][j] == \"#\"", "+ if bit >> i & 1 and bit >> j & 1:", "+ c += C[i - w][j] == \"#\"" ]
false
0.12798
0.129496
0.988292
[ "s709827120", "s056343569" ]
u017624958
p03043
python
s932818780
s112841659
119
91
3,444
6,296
Accepted
Accepted
23.53
import math inputted = list(map(int, input().split())) N = inputted[0] K = inputted[1] num_of_rolls = lambda dice, K: max(0, math.ceil(math.log2(K / dice))) continius_probability = lambda rolls: (1 / 2) ** rolls dice_probablility = lambda N: 1 / N answer = 0 for dice in range(1, N + 1): answer += con...
import math inputted = list(map(int, input().split())) N = inputted[0] K = inputted[1] num_of_rolls = lambda dice, K: max(0, math.ceil(math.log2(K / dice))) continius_probability = lambda rolls: (1 / 2) ** rolls dice_probablility = lambda N: 1 / N answer = sum([continius_probability(num_of_rolls(dice, K)) ...
16
14
411
399
import math inputted = list(map(int, input().split())) N = inputted[0] K = inputted[1] num_of_rolls = lambda dice, K: max(0, math.ceil(math.log2(K / dice))) continius_probability = lambda rolls: (1 / 2) ** rolls dice_probablility = lambda N: 1 / N answer = 0 for dice in range(1, N + 1): answer += continius_probabi...
import math inputted = list(map(int, input().split())) N = inputted[0] K = inputted[1] num_of_rolls = lambda dice, K: max(0, math.ceil(math.log2(K / dice))) continius_probability = lambda rolls: (1 / 2) ** rolls dice_probablility = lambda N: 1 / N answer = sum([continius_probability(num_of_rolls(dice, K)) for dice in ...
false
12.5
[ "-answer = 0", "-for dice in range(1, N + 1):", "- answer += continius_probability(num_of_rolls(dice, K))", "+answer = sum([continius_probability(num_of_rolls(dice, K)) for dice in range(1, N + 1)])" ]
false
0.074681
0.069476
1.07493
[ "s932818780", "s112841659" ]
u260204064
p02573
python
s400673387
s831712916
653
547
24,560
16,680
Accepted
Accepted
16.23
n, m = list(map(int,input().split())) class unionfind(): def __init__(self,n): self.li = [i for i in range(n+1)] self.group = [1]*(n+1) def find(self, x): while self.li[x]!=x: x = self.li[x] return x def union(self, x, y): x = self.find(x) ...
n, m = list(map(int,input().split())) class unionfind(): def __init__(self,n): self.li = [-1]*(n+1) def find(self, x): if self.li[x]<0: return x else: self.li[x] = self.find(self.li[x]) return self.li[x] def union(self, x, y): ...
29
29
680
621
n, m = list(map(int, input().split())) class unionfind: def __init__(self, n): self.li = [i for i in range(n + 1)] self.group = [1] * (n + 1) def find(self, x): while self.li[x] != x: x = self.li[x] return x def union(self, x, y): x = self.find(x) ...
n, m = list(map(int, input().split())) class unionfind: def __init__(self, n): self.li = [-1] * (n + 1) def find(self, x): if self.li[x] < 0: return x else: self.li[x] = self.find(self.li[x]) return self.li[x] def union(self, x, y): x =...
false
0
[ "- self.li = [i for i in range(n + 1)]", "- self.group = [1] * (n + 1)", "+ self.li = [-1] * (n + 1)", "- while self.li[x] != x:", "- x = self.li[x]", "- return x", "+ if self.li[x] < 0:", "+ return x", "+ else:", "+ ...
false
0.042782
0.036666
1.166824
[ "s400673387", "s831712916" ]
u533039576
p02899
python
s792670384
s635702509
188
85
24,192
14,972
Accepted
Accepted
54.79
n = int(eval(input())) a = list(map(int, input().split())) b = [(a[i], i+1) for i in range(n)] b.sort() print((' '.join([str(b[i][1]) for i in range(n)])))
n = int(eval(input())) a = list(map(int, input().split())) b = [0] * n for i in range(n): b[a[i] - 1] = str(i + 1) print((' '.join(b)))
6
8
154
141
n = int(eval(input())) a = list(map(int, input().split())) b = [(a[i], i + 1) for i in range(n)] b.sort() print((" ".join([str(b[i][1]) for i in range(n)])))
n = int(eval(input())) a = list(map(int, input().split())) b = [0] * n for i in range(n): b[a[i] - 1] = str(i + 1) print((" ".join(b)))
false
25
[ "-b = [(a[i], i + 1) for i in range(n)]", "-b.sort()", "-print((\" \".join([str(b[i][1]) for i in range(n)])))", "+b = [0] * n", "+for i in range(n):", "+ b[a[i] - 1] = str(i + 1)", "+print((\" \".join(b)))" ]
false
0.046652
0.039298
1.187129
[ "s792670384", "s635702509" ]
u292810930
p03785
python
s302152677
s341685076
1,750
234
7,384
7,384
Accepted
Accepted
86.63
N, C, K = list(map(int, input().split())) T = [int(eval(input())) for i in range(N)] T.sort() answer = 0 while len(T) > 0: limit = T[0] + K counter = 0 while counter < C: if len(T) == 0: break if T[0] > limit: break del T[0] counter += 1 ...
N, C, K = list(map(int, input().split())) T = [int(eval(input())) for i in range(N)] T.sort() limit = T[0] answer = 1 counter = 1 for i in range(1,N): if T[i] - limit > K or counter == C: limit = T[i] counter = 1 answer += 1 else: counter += 1 print(answer)
16
14
339
298
N, C, K = list(map(int, input().split())) T = [int(eval(input())) for i in range(N)] T.sort() answer = 0 while len(T) > 0: limit = T[0] + K counter = 0 while counter < C: if len(T) == 0: break if T[0] > limit: break del T[0] counter += 1 answer += ...
N, C, K = list(map(int, input().split())) T = [int(eval(input())) for i in range(N)] T.sort() limit = T[0] answer = 1 counter = 1 for i in range(1, N): if T[i] - limit > K or counter == C: limit = T[i] counter = 1 answer += 1 else: counter += 1 print(answer)
false
12.5
[ "-answer = 0", "-while len(T) > 0:", "- limit = T[0] + K", "- counter = 0", "- while counter < C:", "- if len(T) == 0:", "- break", "- if T[0] > limit:", "- break", "- del T[0]", "+limit = T[0]", "+answer = 1", "+counter = 1", "+for i in ...
false
0.042237
0.037913
1.114033
[ "s302152677", "s341685076" ]
u438662618
p02802
python
s923971486
s297886480
374
339
14,836
13,172
Accepted
Accepted
9.36
n, m = list(map(int, input().split())) resultList = [[0 for i in range(2)] for j in range(n)] #print(resultList) for i in range(m) : result = input().split() prob = int(result[0]) - 1 #print(resultList, result[1]) if result[1] == 'AC' and resultList[prob][0] == 0 : resultList[prob][0] = ...
n, m = list(map(int, input().split())) resultList = [[0] * 2 for i in range(n)] #print(resultList) ansAC = 0 ansWA = 0 for i in range(m) : result = input().split() prob = int(result[0]) - 1 if result[1] == 'AC' and resultList[prob][0] == 0 : resultList[prob][0]= 1 ansAC += 1 ...
22
16
595
460
n, m = list(map(int, input().split())) resultList = [[0 for i in range(2)] for j in range(n)] # print(resultList) for i in range(m): result = input().split() prob = int(result[0]) - 1 # print(resultList, result[1]) if result[1] == "AC" and resultList[prob][0] == 0: resultList[prob][0] = 1 if...
n, m = list(map(int, input().split())) resultList = [[0] * 2 for i in range(n)] # print(resultList) ansAC = 0 ansWA = 0 for i in range(m): result = input().split() prob = int(result[0]) - 1 if result[1] == "AC" and resultList[prob][0] == 0: resultList[prob][0] = 1 ansAC += 1 ansWA +=...
false
27.272727
[ "-resultList = [[0 for i in range(2)] for j in range(n)]", "+resultList = [[0] * 2 for i in range(n)]", "+ansAC = 0", "+ansWA = 0", "- # print(resultList, result[1])", "+ ansAC += 1", "+ ansWA += resultList[prob][1]", "-# print(resultList)", "-ansAC = 0", "-ansWA = 0", "-for i i...
false
0.050503
0.041564
1.215062
[ "s923971486", "s297886480" ]
u680851063
p02780
python
s154033746
s985487232
178
137
31,968
32,432
Accepted
Accepted
23.03
#サイコロの目からk個ずつ順にループで切り出して和をリストするとTLE #累積和のリストから、k個の和のリスト → 期待値のリストでTLE解消 from itertools import accumulate n, k = list(map(int,input().split())) l = list(map(int,input().split())) p = [0] + list(accumulate(l)) q = [] #累積和'p'からから求めたk個ずつの和 r = [] #出目の期待値 for i in range(n-k+1): q.append(p[i+k] - p[i]) ...
n,k = list(map(int, input().split())) l = list(map(int, input().split())) # 期待値:マス目の総和/マス目の数, マス目の最大値+最小値[1]/2 l = [(i+1)/2 for i in l] # 期待値に変換 # 累積和を取得 from itertools import accumulate cum = [0] + list(accumulate(l)) # 差分を考慮しつつ k個の和をリストする → 最大値が ans sum_k = [] for j in range(n-k+1): sum_k.append(c...
17
16
360
353
# サイコロの目からk個ずつ順にループで切り出して和をリストするとTLE # 累積和のリストから、k個の和のリスト → 期待値のリストでTLE解消 from itertools import accumulate n, k = list(map(int, input().split())) l = list(map(int, input().split())) p = [0] + list(accumulate(l)) q = [] # 累積和'p'からから求めたk個ずつの和 r = [] # 出目の期待値 for i in range(n - k + 1): q.append(p[i + k] - p[i]) ...
n, k = list(map(int, input().split())) l = list(map(int, input().split())) # 期待値:マス目の総和/マス目の数, マス目の最大値+最小値[1]/2 l = [(i + 1) / 2 for i in l] # 期待値に変換 # 累積和を取得 from itertools import accumulate cum = [0] + list(accumulate(l)) # 差分を考慮しつつ k個の和をリストする → 最大値が ans sum_k = [] for j in range(n - k + 1): sum_k.append(cum[k ...
false
5.882353
[ "-# サイコロの目からk個ずつ順にループで切り出して和をリストするとTLE", "-# 累積和のリストから、k個の和のリスト → 期待値のリストでTLE解消", "+n, k = list(map(int, input().split()))", "+l = list(map(int, input().split()))", "+# 期待値:マス目の総和/マス目の数, マス目の最大値+最小値[1]/2", "+l = [(i + 1) / 2 for i in l] # 期待値に変換", "+# 累積和を取得", "-n, k = list(map(int, input().split()))...
false
0.046509
0.110502
0.420889
[ "s154033746", "s985487232" ]
u072053884
p02368
python
s013080647
s027762443
380
340
11,152
11,228
Accepted
Accepted
10.53
# Acceptance of input import sys file_input = sys.stdin V, E = list(map(int, file_input.readline().split())) adj = [[] for i in range(V)] for i in range(E): s, t = list(map(int, file_input.readline().split())) adj[s].append(t) # Tarjan's strongly connected components algorithm(repetition) imp...
# Acceptance of input import sys file_input = sys.stdin V, E = list(map(int, file_input.readline().split())) adj = [[] for i in range(V)] for i in range(E): s, t = list(map(int, file_input.readline().split())) adj[s].append(t) # Tarjan's strongly connected components algorithm(repetition) imp...
72
73
1,844
1,881
# Acceptance of input import sys file_input = sys.stdin V, E = list(map(int, file_input.readline().split())) adj = [[] for i in range(V)] for i in range(E): s, t = list(map(int, file_input.readline().split())) adj[s].append(t) # Tarjan's strongly connected components algorithm(repetition) import collections S...
# Acceptance of input import sys file_input = sys.stdin V, E = list(map(int, file_input.readline().split())) adj = [[] for i in range(V)] for i in range(E): s, t = list(map(int, file_input.readline().split())) adj[s].append(t) # Tarjan's strongly connected components algorithm(repetition) import collections S...
false
1.369863
[ "+ adj_v.remove(t)" ]
false
0.043891
0.045123
0.972697
[ "s013080647", "s027762443" ]
u798818115
p03994
python
s470466640
s541899923
124
53
4,152
4,216
Accepted
Accepted
57.26
s=list(eval(input())) N=int(eval(input())) apple=lambda c:ord(c)-ord("a")+1 l=[] for i in range(len(s)): s[i]=apple(s[i]) dif=27-s[i] if s[i]==1: pass elif dif<=N: N-=dif s[i]=1 s[-1]-=1 s[-1]=(s[-1]+N)%26 s[-1]+=1 kiss = lambda c: chr(c+96) for i in range...
# coding: utf-8 # Your code here! s=eval(input()) K=int(eval(input())) ans=[] #122 for item in s[:len(s)-1]: cost=(123-ord(item)) if item=="a": ans.append(item) continue if K>=cost: K-=cost ans.append("a") else: ans.append(item) K%=26 last=ord...
24
27
359
428
s = list(eval(input())) N = int(eval(input())) apple = lambda c: ord(c) - ord("a") + 1 l = [] for i in range(len(s)): s[i] = apple(s[i]) dif = 27 - s[i] if s[i] == 1: pass elif dif <= N: N -= dif s[i] = 1 s[-1] -= 1 s[-1] = (s[-1] + N) % 26 s[-1] += 1 kiss = lambda c: chr(c + 96)...
# coding: utf-8 # Your code here! s = eval(input()) K = int(eval(input())) ans = [] # 122 for item in s[: len(s) - 1]: cost = 123 - ord(item) if item == "a": ans.append(item) continue if K >= cost: K -= cost ans.append("a") else: ans.append(item) K %= 26 last = or...
false
11.111111
[ "-s = list(eval(input()))", "-N = int(eval(input()))", "-apple = lambda c: ord(c) - ord(\"a\") + 1", "-l = []", "-for i in range(len(s)):", "- s[i] = apple(s[i])", "- dif = 27 - s[i]", "- if s[i] == 1:", "- pass", "- elif dif <= N:", "- N -= dif", "- s[i] = 1",...
false
0.045868
0.039025
1.17535
[ "s470466640", "s541899923" ]
u391819434
p03109
python
s538649530
s212674885
19
17
3,060
2,940
Accepted
Accepted
10.53
Y,M,D=list(map(int,input().split('/'))) if Y < 2019: print('Heisei') elif Y == 2019 and M <= 4: print('Heisei') else: print('TBD')
S=eval(input()) if S[5:7]>'04': print('TBD') else: print('Heisei')
8
6
144
74
Y, M, D = list(map(int, input().split("/"))) if Y < 2019: print("Heisei") elif Y == 2019 and M <= 4: print("Heisei") else: print("TBD")
S = eval(input()) if S[5:7] > "04": print("TBD") else: print("Heisei")
false
25
[ "-Y, M, D = list(map(int, input().split(\"/\")))", "-if Y < 2019:", "+S = eval(input())", "+if S[5:7] > \"04\":", "+ print(\"TBD\")", "+else:", "-elif Y == 2019 and M <= 4:", "- print(\"Heisei\")", "-else:", "- print(\"TBD\")" ]
false
0.066948
0.069885
0.957969
[ "s538649530", "s212674885" ]
u614314290
p03078
python
s065367139
s402850552
1,054
777
149,648
4,468
Accepted
Accepted
26.28
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())) ab = [] for a in A: for b in B: ab += [a + b] ab3000 = sorted(ab)[::-1][:3000] abc = [] for ab in ab3000: for c in C: abc += [ab + c] abc.so...
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 = sorted(A, reverse=True) b = sorted(B, reverse=True) c = sorted(C, reverse=True) added = [(0, 0, 0)] cakes = [(-(a[0] + b[0] + c[0]), 0,...
21
26
369
870
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())) ab = [] for a in A: for b in B: ab += [a + b] ab3000 = sorted(ab)[::-1][:3000] abc = [] for ab in ab3000: for c in C: abc += [ab + c] abc.sort(...
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 = sorted(A, reverse=True) b = sorted(B, reverse=True) c = sorted(C, reverse=True) added = [(0, 0, 0)] cakes = [(-(a[0] + b[0] + c[0]), 0, 0, 0)] for k ...
false
19.230769
[ "+import heapq", "+", "-ab = []", "-for a in A:", "- for b in B:", "- ab += [a + b]", "-ab3000 = sorted(ab)[::-1][:3000]", "-abc = []", "-for ab in ab3000:", "- for c in C:", "- abc += [ab + c]", "-abc.sort(reverse=True)", "+a = sorted(A, reverse=True)", "+b = sorted(B,...
false
0.104081
0.078888
1.319349
[ "s065367139", "s402850552" ]
u074220993
p04045
python
s400881817
s604196490
38
32
9,116
9,100
Accepted
Accepted
15.79
N, L = list(map(int, input().split())) S = {int(x) for x in input().split()} flag = False while flag == False: if N%10 in S: N += 1 continue if int((N%100-N%10)/10) in S and N >= 10: N += 1 continue if int((N%1000-N%100)/100) in S and N >= 100: N += 1 ...
N, L = list(map(int, input().split())) S = {int(x) for x in input().split()} flag = False while 1: if N%10 in S: N += 1 continue if int((N%100-N%10)/10) in S and N >= 10: N += 1 continue if int((N%1000-N%100)/100) in S and N >= 100: N += 1 continue...
21
21
536
518
N, L = list(map(int, input().split())) S = {int(x) for x in input().split()} flag = False while flag == False: if N % 10 in S: N += 1 continue if int((N % 100 - N % 10) / 10) in S and N >= 10: N += 1 continue if int((N % 1000 - N % 100) / 100) in S and N >= 100: N += ...
N, L = list(map(int, input().split())) S = {int(x) for x in input().split()} flag = False while 1: if N % 10 in S: N += 1 continue if int((N % 100 - N % 10) / 10) in S and N >= 10: N += 1 continue if int((N % 1000 - N % 100) / 100) in S and N >= 100: N += 1 co...
false
0
[ "-while flag == False:", "+while 1:", "- flag = True", "+ break" ]
false
0.040808
0.046924
0.869677
[ "s400881817", "s604196490" ]
u353919145
p03331
python
s330262070
s975782054
259
171
4,740
3,060
Accepted
Accepted
33.98
n=int(input()) ret=[] for y in range(n/2): a=y+1 b=n-a r1 = 0 r2 = 0 for i in str(a): r1 += int(i) for x in str(b): r2 += int(x) r=r1+r2 ret.append(r) print(min(ret))
a = int(eval(input())) lim = a // 2 soma_lista = [] menor = 100000 for i in range(a - 1, lim, -1): b = str(a - abs(i)) + str(abs(i)) soma = 0 for digit in b: soma += int(digit) if soma < menor: menor = soma if a == 2: print(a) else: print(menor)
14
15
194
294
n = int(input()) ret = [] for y in range(n / 2): a = y + 1 b = n - a r1 = 0 r2 = 0 for i in str(a): r1 += int(i) for x in str(b): r2 += int(x) r = r1 + r2 ret.append(r) print(min(ret))
a = int(eval(input())) lim = a // 2 soma_lista = [] menor = 100000 for i in range(a - 1, lim, -1): b = str(a - abs(i)) + str(abs(i)) soma = 0 for digit in b: soma += int(digit) if soma < menor: menor = soma if a == 2: print(a) else: print(menor)
false
6.666667
[ "-n = int(input())", "-ret = []", "-for y in range(n / 2):", "- a = y + 1", "- b = n - a", "- r1 = 0", "- r2 = 0", "- for i in str(a):", "- r1 += int(i)", "- for x in str(b):", "- r2 += int(x)", "- r = r1 + r2", "- ret.append(r)", "-print(min(ret))", ...
false
0.042992
0.089628
0.479672
[ "s330262070", "s975782054" ]
u546285759
p00056
python
s064501833
s393463978
2,440
1,850
8,264
8,276
Accepted
Accepted
24.18
import bisect primes = [0, 0] + [1] * 49999 for i in range(2, 225): if primes[i]: for j in range(i*i, 50001, i): primes[j] = 0 values = [i for i, k in enumerate(primes) if k] while True: n = int(eval(input())) if n == 0: break I = bisect.bisect(values, n//2) p...
import bisect primes = [0, 0] + [1] * 49999 for i in range(2, 225): if primes[i]: for j in range(i*i, 50001, i): primes[j] = 0 values = [i for i, k in enumerate(primes) if k] while True: n = int(eval(input())) if n == 0: break I = bisect.bisect(values, n//2) p...
13
13
356
361
import bisect primes = [0, 0] + [1] * 49999 for i in range(2, 225): if primes[i]: for j in range(i * i, 50001, i): primes[j] = 0 values = [i for i, k in enumerate(primes) if k] while True: n = int(eval(input())) if n == 0: break I = bisect.bisect(values, n // 2) print((s...
import bisect primes = [0, 0] + [1] * 49999 for i in range(2, 225): if primes[i]: for j in range(i * i, 50001, i): primes[j] = 0 values = [i for i, k in enumerate(primes) if k] while True: n = int(eval(input())) if n == 0: break I = bisect.bisect(values, n // 2) print((s...
false
0
[ "- print((sum(primes[n - v] for v in values[:I])))", "+ print((sum(1 for v in values[:I] if primes[n - v])))" ]
false
0.069308
0.06908
1.003301
[ "s064501833", "s393463978" ]
u968166680
p02882
python
s454602553
s599558277
168
27
38,256
9,256
Accepted
Accepted
83.93
import sys from math import atan, degrees read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 def main(): a, b, x = list(map(int, readline().split())) if x > a * a * b / 2: ans = atan((2 * a * a * b - 2 * x) / (...
import sys from math import atan, degrees read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): a, b, x = list(map(int, readline().split())) if x > a * a * b / 2: ans = atan(2 * (a ...
23
25
458
474
import sys from math import atan, degrees read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 def main(): a, b, x = list(map(int, readline().split())) if x > a * a * b / 2: ans = atan((2 * a * a * b - 2 * x) / (a**3)) else...
import sys from math import atan, degrees read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): a, b, x = list(map(int, readline().split())) if x > a * a * b / 2: ans = atan(2 * (a * a * b - x) / (a*...
false
8
[ "+MOD = 1000000007", "- ans = atan((2 * a * a * b - 2 * x) / (a**3))", "+ ans = atan(2 * (a * a * b - x) / (a**3))" ]
false
0.078311
0.043122
1.816038
[ "s454602553", "s599558277" ]
u595289165
p03315
python
s796869445
s501636614
20
17
2,940
2,940
Accepted
Accepted
15
s = list(eval(input())) ans = 0 for i in s: if i == "+": ans += 1 else: ans -= 1 print(ans)
s = list(eval(input())) print((s.count("+") - s.count("-")))
8
2
116
53
s = list(eval(input())) ans = 0 for i in s: if i == "+": ans += 1 else: ans -= 1 print(ans)
s = list(eval(input())) print((s.count("+") - s.count("-")))
false
75
[ "-ans = 0", "-for i in s:", "- if i == \"+\":", "- ans += 1", "- else:", "- ans -= 1", "-print(ans)", "+print((s.count(\"+\") - s.count(\"-\")))" ]
false
0.050906
0.047677
1.067723
[ "s796869445", "s501636614" ]
u875291233
p02998
python
s092745558
s336424654
1,230
817
144,260
91,224
Accepted
Accepted
33.58
# coding: utf-8 # Your code here! class UnionFind: def __init__(self, n,xy): self.parent = list(range(n))#親ノード self.size = [1]*n #グループの要素数 self.xval = [{x} for x,y in xy] self.yval = [{y} for x,y in xy] def root(self, x): #root(x): xの根ノードを返す. while self.paren...
# coding: utf-8 # Your code here! class UnionFind: def __init__(self, n): self.parent = list(range(n))#親ノード self.size = [1]*n #グループの要素数 def root(self, x): #root(x): xの根ノードを返す. while self.parent[x] != x: x, self.parent[x] = self.parent[x], self.parent[self.parent[x...
67
80
1,732
1,727
# coding: utf-8 # Your code here! class UnionFind: def __init__(self, n, xy): self.parent = list(range(n)) # 親ノード self.size = [1] * n # グループの要素数 self.xval = [{x} for x, y in xy] self.yval = [{y} for x, y in xy] def root(self, x): # root(x): xの根ノードを返す. while self.paren...
# coding: utf-8 # Your code here! class UnionFind: def __init__(self, n): self.parent = list(range(n)) # 親ノード self.size = [1] * n # グループの要素数 def root(self, x): # root(x): xの根ノードを返す. while self.parent[x] != x: x, self.parent[x] = self.parent[x], self.parent[self.parent[x]]...
false
16.25
[ "- def __init__(self, n, xy):", "+ def __init__(self, n):", "- self.xval = [{x} for x, y in xy]", "- self.yval = [{y} for x, y in xy]", "- self.xval[y].update(self.xval[x])", "- self.yval[y].update(self.yval[x])", "- self.xval[x].update(self.xval[y])"...
false
0.03601
0.033282
1.08197
[ "s092745558", "s336424654" ]
u044964932
p02572
python
s251499320
s099561894
367
201
49,972
49,968
Accepted
Accepted
45.23
import numpy as np def main(): n = int(eval(input())) As = list(map(int, input().split())) mod = 10**9 + 7 As_sum = np.sum(As) % mod ans = 0 for i in range(n): As_sum -= As[i] As_sum %= mod ans += As_sum * As[i] ans %= mod ans %= mod pri...
import numpy as np def main(): n = int(eval(input())) As = list(map(int, input().split())) mod = 10 ** 9 + 7 As_sum = sum(As) ans = 0 for i in range(n): As_sum -= As[i] ans += As_sum * As[i] ans %= mod ans %= mod print(ans) if __name__ =...
21
22
366
340
import numpy as np def main(): n = int(eval(input())) As = list(map(int, input().split())) mod = 10**9 + 7 As_sum = np.sum(As) % mod ans = 0 for i in range(n): As_sum -= As[i] As_sum %= mod ans += As_sum * As[i] ans %= mod ans %= mod print(ans) if __na...
import numpy as np def main(): n = int(eval(input())) As = list(map(int, input().split())) mod = 10**9 + 7 As_sum = sum(As) ans = 0 for i in range(n): As_sum -= As[i] ans += As_sum * As[i] ans %= mod ans %= mod print(ans) if __name__ == "__main__": main()
false
4.545455
[ "- As_sum = np.sum(As) % mod", "+ As_sum = sum(As)", "- As_sum %= mod" ]
false
0.166478
0.041159
4.044709
[ "s251499320", "s099561894" ]
u761320129
p03733
python
s140448154
s973229379
156
143
25,200
25,196
Accepted
Accepted
8.33
N,T = list(map(int,input().split())) ts = list(map(int,input().split())) ans = 0 until = 0 for t in ts: ans += min(T, t+T-until) until = t+T print(ans)
N,T = list(map(int,input().split())) ts = list(map(int,input().split())) ans = 0 prev = ts[0] for t in ts[1:]: ans += min(T, t-prev) prev = t ans += T print(ans)
9
10
162
173
N, T = list(map(int, input().split())) ts = list(map(int, input().split())) ans = 0 until = 0 for t in ts: ans += min(T, t + T - until) until = t + T print(ans)
N, T = list(map(int, input().split())) ts = list(map(int, input().split())) ans = 0 prev = ts[0] for t in ts[1:]: ans += min(T, t - prev) prev = t ans += T print(ans)
false
10
[ "-until = 0", "-for t in ts:", "- ans += min(T, t + T - until)", "- until = t + T", "+prev = ts[0]", "+for t in ts[1:]:", "+ ans += min(T, t - prev)", "+ prev = t", "+ans += T" ]
false
0.134348
0.044339
3.030051
[ "s140448154", "s973229379" ]
u031157253
p02693
python
s162785949
s363362861
22
20
9,176
9,164
Accepted
Accepted
9.09
K = int(eval(input())) A, B = list(map(int, input().split())) while True: if A % K == 0: print('OK') break A += 1 if A == B + 1: print('NG') break
K = int(eval(input())) A, B = list(map(int, input().split())) while True: if A == B + 1: print('NG') break if A % K == 0: print('OK') break A += 1
11
11
196
196
K = int(eval(input())) A, B = list(map(int, input().split())) while True: if A % K == 0: print("OK") break A += 1 if A == B + 1: print("NG") break
K = int(eval(input())) A, B = list(map(int, input().split())) while True: if A == B + 1: print("NG") break if A % K == 0: print("OK") break A += 1
false
0
[ "+ if A == B + 1:", "+ print(\"NG\")", "+ break", "- if A == B + 1:", "- print(\"NG\")", "- break" ]
false
0.038841
0.040361
0.962338
[ "s162785949", "s363362861" ]
u343675824
p03722
python
s411569292
s767602971
575
378
50,264
47,320
Accepted
Accepted
34.26
N, M = list(map(int, input().split())) a, b, c = [0] * M, [0] * M, [0] * M d = [-1e20] * N for i in range(M): a[i], b[i], c[i] = list(map(int, input().split())) a[i] -= 1 b[i] -= 1 d[0] = 0 for i in range(N-1): for j in range(M): d[b[j]] = max((d[b[j]], d[a[j]] + c[j])) isCycle = ...
N, M = list(map(int, input().split())) a, b, c = [None] * M, [None] * M, [None] * M INF = 1e14 d = [-INF] * N d[0] = 0 for i in range(M): a[i], b[i], c[i] = list(map(int, input().split())) a[i] -= 1 b[i] -= 1 for i in range(N): for j in range(M): if d[a[j]] + c[j] > d[b[j]]: ...
26
23
600
533
N, M = list(map(int, input().split())) a, b, c = [0] * M, [0] * M, [0] * M d = [-1e20] * N for i in range(M): a[i], b[i], c[i] = list(map(int, input().split())) a[i] -= 1 b[i] -= 1 d[0] = 0 for i in range(N - 1): for j in range(M): d[b[j]] = max((d[b[j]], d[a[j]] + c[j])) isCycle = False for i i...
N, M = list(map(int, input().split())) a, b, c = [None] * M, [None] * M, [None] * M INF = 1e14 d = [-INF] * N d[0] = 0 for i in range(M): a[i], b[i], c[i] = list(map(int, input().split())) a[i] -= 1 b[i] -= 1 for i in range(N): for j in range(M): if d[a[j]] + c[j] > d[b[j]]: d[b[j]] ...
false
11.538462
[ "-a, b, c = [0] * M, [0] * M, [0] * M", "-d = [-1e20] * N", "+a, b, c = [None] * M, [None] * M, [None] * M", "+INF = 1e14", "+d = [-INF] * N", "+d[0] = 0", "-d[0] = 0", "-for i in range(N - 1):", "+for i in range(N):", "- d[b[j]] = max((d[b[j]], d[a[j]] + c[j]))", "-isCycle = False", "-...
false
0.090414
0.089116
1.014568
[ "s411569292", "s767602971" ]
u764600134
p03645
python
s963755946
s008199572
652
576
46,456
19,012
Accepted
Accepted
11.66
# -*- coding: utf-8 -*- """ http://abc068.contest.atcoder.jp/tasks/arc079_a """ def solve(routes, N): result = 'IMPOSSIBLE' to_middle = set() # 島1から渡ることのできる島 from_middle = set() # 島Nへ渡ることのできる島 for f, t in routes: if f == 1: to_middle.add(t) ...
# -*- coding: utf-8 -*- """ http://abc068.contest.atcoder.jp/tasks/arc079_a AC """ def solve(routes, N): result = 'IMPOSSIBLE' to_middle = set() # 島1から渡ることのできる島 from_middle = set() # 島Nへ渡ることのできる島 for f, t in routes: if f == 1: to_middle.add(t) ...
33
50
697
1,117
# -*- coding: utf-8 -*- """ http://abc068.contest.atcoder.jp/tasks/arc079_a """ def solve(routes, N): result = "IMPOSSIBLE" to_middle = set() # 島1から渡ることのできる島 from_middle = set() # 島Nへ渡ることのできる島 for f, t in routes: if f == 1: to_middle.add(t) elif t == N: from...
# -*- coding: utf-8 -*- """ http://abc068.contest.atcoder.jp/tasks/arc079_a AC """ def solve(routes, N): result = "IMPOSSIBLE" to_middle = set() # 島1から渡ることのできる島 from_middle = set() # 島Nへ渡ることのできる島 for f, t in routes: if f == 1: to_middle.add(t) elif t == N: f...
false
34
[ "+AC", "- main()", "+ # main()", "+ to_middle = set() # 島1から渡ることのできる島", "+ from_middle = set() # 島Nへ渡ることのできる島", "+ N, M = list(map(int, input().split()))", "+ for _ in range(M):", "+ f, t = list(map(int, input().split()))", "+ if f == 1:", "+ to_middl...
false
0.076573
0.087592
0.874206
[ "s963755946", "s008199572" ]
u316386814
p04011
python
s925823831
s039900512
149
17
12,468
2,940
Accepted
Accepted
88.59
import numpy as np from collections import Counter, defaultdict, deque n = int(eval(input())) k = int(eval(input())) x = int(eval(input())) y = int(eval(input())) if n <= k: ans = n * x else: ans = k * x + (n - k) * y print(ans)
n = int(eval(input())) k = int(eval(input())) x = int(eval(input())) y = int(eval(input())) if n <= k: ans = n * x else: ans = k * x + (n - k) * y print(ans)
14
12
228
155
import numpy as np from collections import Counter, defaultdict, deque n = int(eval(input())) k = int(eval(input())) x = int(eval(input())) y = int(eval(input())) if n <= k: ans = n * x else: ans = k * x + (n - k) * y print(ans)
n = int(eval(input())) k = int(eval(input())) x = int(eval(input())) y = int(eval(input())) if n <= k: ans = n * x else: ans = k * x + (n - k) * y print(ans)
false
14.285714
[ "-import numpy as np", "-from collections import Counter, defaultdict, deque", "-" ]
false
0.036681
0.124959
0.293547
[ "s925823831", "s039900512" ]
u592248346
p03290
python
s637223506
s480185736
173
128
3,064
9,160
Accepted
Accepted
26.01
# coding: utf-8 # Your code here! D,G = list(map(int,input().split())) p,c = [],[] res = 1<<30 for i in range(D): x,y = list(map(int,input().split())) p.append(x) c.append(y) for i in range(2**D): sum_x,cnt = 0,0 for j in range(D): if i&(1<<j): sum_x+=c[j]+p[j]*100...
d,g = list(map(int,input().split())) p,c = [],[] ans = float('inf') for i in range(d): x,y = list(map(int,input().split())) p.append(x) c.append(y) for i in range((1<<d)): tmp,cnt = 0,0 for j in range(d): if i&(1<<j): tmp = tmp + 100*(j+1)*p[j]+c[j] cnt +=...
25
24
596
615
# coding: utf-8 # Your code here! D, G = list(map(int, input().split())) p, c = [], [] res = 1 << 30 for i in range(D): x, y = list(map(int, input().split())) p.append(x) c.append(y) for i in range(2**D): sum_x, cnt = 0, 0 for j in range(D): if i & (1 << j): sum_x += c[j] + p[j] ...
d, g = list(map(int, input().split())) p, c = [], [] ans = float("inf") for i in range(d): x, y = list(map(int, input().split())) p.append(x) c.append(y) for i in range((1 << d)): tmp, cnt = 0, 0 for j in range(d): if i & (1 << j): tmp = tmp + 100 * (j + 1) * p[j] + c[j] ...
false
4
[ "-# coding: utf-8", "-# Your code here!", "-D, G = list(map(int, input().split()))", "+d, g = list(map(int, input().split()))", "-res = 1 << 30", "-for i in range(D):", "+ans = float(\"inf\")", "+for i in range(d):", "-for i in range(2**D):", "- sum_x, cnt = 0, 0", "- for j in range(D):", ...
false
0.044627
0.045666
0.977254
[ "s637223506", "s480185736" ]
u241159583
p02756
python
s308251647
s648485692
503
346
35,316
34,672
Accepted
Accepted
31.21
from collections import deque s = eval(input()) Q = int(eval(input())) q = [list(input().split()) for _ in range(Q)] ans = deque(s) ok = True for v in q: if v[0] == "1": if ok: ok = False else: ok = True else: if v[1] == "1": if ok: ans.appendleft(v[2]) else: ans.append(v[2]) ...
from collections import deque s = eval(input()) q = int(eval(input())) Q = [list(input().split()) for _ in range(q)] ans = deque(s) ok = True for v in Q: if v[0] == "1": if ok: ok = False else: ok = True else: if v[1] == "1": if ok: ans.appendleft(v[2]) ...
22
21
452
493
from collections import deque s = eval(input()) Q = int(eval(input())) q = [list(input().split()) for _ in range(Q)] ans = deque(s) ok = True for v in q: if v[0] == "1": if ok: ok = False else: ok = True else: if v[1] == "1": if ok: an...
from collections import deque s = eval(input()) q = int(eval(input())) Q = [list(input().split()) for _ in range(q)] ans = deque(s) ok = True for v in Q: if v[0] == "1": if ok: ok = False else: ok = True else: if v[1] == "1": if ok: an...
false
4.545455
[ "-Q = int(eval(input()))", "-q = [list(input().split()) for _ in range(Q)]", "+q = int(eval(input()))", "+Q = [list(input().split()) for _ in range(q)]", "-for v in q:", "+for v in Q:" ]
false
0.03669
0.035509
1.033259
[ "s308251647", "s648485692" ]
u761989513
p03489
python
s109625704
s612505556
109
92
21,228
18,672
Accepted
Accepted
15.6
import collections n = int(eval(input())) a = collections.Counter(list(map(int, input().split()))).most_common() ans = 0 for i, j in a: if i > j: ans += j if i < j: ans += j - i print(ans)
import collections n = int(eval(input())) a = list(map(int, input().split())) ac = collections.Counter(a) ans = 0 for i in list(ac.items()): if i[0] != i[1]: if i[1] > i[0]: ans += i[1] - i[0] else: ans += i[1] print(ans)
11
13
218
266
import collections n = int(eval(input())) a = collections.Counter(list(map(int, input().split()))).most_common() ans = 0 for i, j in a: if i > j: ans += j if i < j: ans += j - i print(ans)
import collections n = int(eval(input())) a = list(map(int, input().split())) ac = collections.Counter(a) ans = 0 for i in list(ac.items()): if i[0] != i[1]: if i[1] > i[0]: ans += i[1] - i[0] else: ans += i[1] print(ans)
false
15.384615
[ "-a = collections.Counter(list(map(int, input().split()))).most_common()", "+a = list(map(int, input().split()))", "+ac = collections.Counter(a)", "-for i, j in a:", "- if i > j:", "- ans += j", "- if i < j:", "- ans += j - i", "+for i in list(ac.items()):", "+ if i[0] != i[...
false
0.037864
0.037266
1.016029
[ "s109625704", "s612505556" ]
u645250356
p02820
python
s398725643
s413414416
389
105
82,008
6,136
Accepted
Accepted
73.01
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,pprint,fractions sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) ...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions,copy sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) ...
30
25
923
655
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, pprint, fractions sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.read...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, fractions, copy sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readli...
false
16.666667
[ "-import sys, bisect, math, itertools, pprint, fractions", "+import sys, bisect, math, itertools, fractions, copy", "-a = eval(input())", "+t = list(eval(input()))", "+di = {\"r\": P, \"s\": R, \"p\": S}", "-for rem in range(k):", "- dp = [[0] * 3 for _ in range(len(list(range(rem, n, k))) + 1)]", ...
false
0.0739
0.046443
1.591187
[ "s398725643", "s413414416" ]
u562935282
p03171
python
s948435516
s694228391
530
330
179,804
111,964
Accepted
Accepted
37.74
def solve(): n = int(eval(input())) a = tuple(int(x) for x in input().split()) memo = tuple([None] * n for _ in range(n)) for i in range(n): memo[i][i] = a[i] for l in range(n - 2, -1, -1): for r in range(l + 1, n): memo[l][r] = max(a[r] - memo[l][r - 1], a[l]...
n = int(eval(input())) a = list(map(int, input().split())) dp = [[0] * n for _ in range(n)] for i in range(n): dp[i][i] = a[i] for i in range(n - 2, -1, -1): for j in range(i + 1, n): dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]) print((dp[0][n - 1])) # 下記提出と全く同じ内容で提出します # htt...
28
19
657
450
def solve(): n = int(eval(input())) a = tuple(int(x) for x in input().split()) memo = tuple([None] * n for _ in range(n)) for i in range(n): memo[i][i] = a[i] for l in range(n - 2, -1, -1): for r in range(l + 1, n): memo[l][r] = max(a[r] - memo[l][r - 1], a[l] - memo[l + ...
n = int(eval(input())) a = list(map(int, input().split())) dp = [[0] * n for _ in range(n)] for i in range(n): dp[i][i] = a[i] for i in range(n - 2, -1, -1): for j in range(i + 1, n): dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]) print((dp[0][n - 1])) # 下記提出と全く同じ内容で提出します # https://atcoder.jp/...
false
32.142857
[ "-def solve():", "- n = int(eval(input()))", "- a = tuple(int(x) for x in input().split())", "- memo = tuple([None] * n for _ in range(n))", "- for i in range(n):", "- memo[i][i] = a[i]", "- for l in range(n - 2, -1, -1):", "- for r in range(l + 1, n):", "- me...
false
0.036463
0.037127
0.982122
[ "s948435516", "s694228391" ]
u729133443
p03292
python
s739379111
s792258004
177
18
38,256
2,940
Accepted
Accepted
89.83
a,_,b=sorted(map(int,input().split()));print((b-a))
*a,=list(map(int,input().split()));print((max(a)-min(a)))
1
1
49
49
a, _, b = sorted(map(int, input().split())) print((b - a))
(*a,) = list(map(int, input().split())) print((max(a) - min(a)))
false
0
[ "-a, _, b = sorted(map(int, input().split()))", "-print((b - a))", "+(*a,) = list(map(int, input().split()))", "+print((max(a) - min(a)))" ]
false
0.047702
0.040751
1.170557
[ "s739379111", "s792258004" ]
u150984829
p02380
python
s166469027
s610446793
30
20
5,720
5,720
Accepted
Accepted
33.33
from math import * a,b,C=map(int,input().split()) C=C*pi/180 S=a*b*sin(C)/2 print(S,a+b+(a*a+b*b-2*a*b*cos(C))**0.5,2*S/a,sep='\n')
import math a,b,C=map(int,input().split()) C=C*math.pi/180 S=a*b*math.sin(C)/2 print(S,a+b+(a*a+b*b-2*a*b*math.cos(C))**0.5,2*S/a,sep='\n')
5
5
135
143
from math import * a, b, C = map(int, input().split()) C = C * pi / 180 S = a * b * sin(C) / 2 print(S, a + b + (a * a + b * b - 2 * a * b * cos(C)) ** 0.5, 2 * S / a, sep="\n")
import math a, b, C = map(int, input().split()) C = C * math.pi / 180 S = a * b * math.sin(C) / 2 print(S, a + b + (a * a + b * b - 2 * a * b * math.cos(C)) ** 0.5, 2 * S / a, sep="\n")
false
0
[ "-from math import *", "+import math", "-C = C * pi / 180", "-S = a * b * sin(C) / 2", "-print(S, a + b + (a * a + b * b - 2 * a * b * cos(C)) ** 0.5, 2 * S / a, sep=\"\\n\")", "+C = C * math.pi / 180", "+S = a * b * math.sin(C) / 2", "+print(S, a + b + (a * a + b * b - 2 * a * b * math.cos(C)) ** 0.5...
false
0.038121
0.129157
0.295152
[ "s166469027", "s610446793" ]
u952708174
p03073
python
s483755966
s056504591
37
18
4,212
3,188
Accepted
Accepted
51.35
def c_coloring_colorfully(S): s1 = '10' * (len(S) // 2) + ('1' if len(S) % 2 == 1 else '') s2 = '01' * (len(S) // 2) + ('0' if len(S) % 2 == 1 else '') ans1 = len([1 for k, s in enumerate(S) if s != s1[k]]) ans2 = len([1 for k, s in enumerate(S) if s != s2[k]]) return min(ans1, ans2) S = eva...
def c_coloring_colorfully(S): ans1 = S[::2].count('0') + S[1::2].count('1') # 1010...と一致しない数字の数 ans2 = S[::2].count('1') + S[1::2].count('0') # 0101...と一致しない数字の数 return min(ans1, ans2) S = eval(input()) print((c_coloring_colorfully(S)))
9
7
357
249
def c_coloring_colorfully(S): s1 = "10" * (len(S) // 2) + ("1" if len(S) % 2 == 1 else "") s2 = "01" * (len(S) // 2) + ("0" if len(S) % 2 == 1 else "") ans1 = len([1 for k, s in enumerate(S) if s != s1[k]]) ans2 = len([1 for k, s in enumerate(S) if s != s2[k]]) return min(ans1, ans2) S = eval(inpu...
def c_coloring_colorfully(S): ans1 = S[::2].count("0") + S[1::2].count("1") # 1010...と一致しない数字の数 ans2 = S[::2].count("1") + S[1::2].count("0") # 0101...と一致しない数字の数 return min(ans1, ans2) S = eval(input()) print((c_coloring_colorfully(S)))
false
22.222222
[ "- s1 = \"10\" * (len(S) // 2) + (\"1\" if len(S) % 2 == 1 else \"\")", "- s2 = \"01\" * (len(S) // 2) + (\"0\" if len(S) % 2 == 1 else \"\")", "- ans1 = len([1 for k, s in enumerate(S) if s != s1[k]])", "- ans2 = len([1 for k, s in enumerate(S) if s != s2[k]])", "+ ans1 = S[::2].count(\"0\")...
false
0.041156
0.035931
1.145435
[ "s483755966", "s056504591" ]
u327466606
p03702
python
s304243282
s648762992
1,174
742
7,072
7,072
Accepted
Accepted
36.8
N,A,B = list(map(int, input().split())) H = [int(eval(input())) for i in range(N)] low = sum(H)//(len(H)*B+A-B) - 1 high = max(H)//B+1 d = A-B ceildiv = lambda x,y: -(-x//y) while low + 1 < high: mid = (low+high)//2 offset = mid*B cnt = sum(max(ceildiv(h - offset, d),0) for h in H) if cnt > mi...
N,A,B = list(map(int, input().split())) H = [int(eval(input())) for i in range(N)] d = A-B temp = max(H) low = temp//A - 1 high = temp//B+1 while low + 1 < high: mid = (low+high)//2 offset = mid*B cnt = -sum((offset-h)//d for h in H if h > offset) if cnt > mid: low = mid else: hig...
20
20
365
330
N, A, B = list(map(int, input().split())) H = [int(eval(input())) for i in range(N)] low = sum(H) // (len(H) * B + A - B) - 1 high = max(H) // B + 1 d = A - B ceildiv = lambda x, y: -(-x // y) while low + 1 < high: mid = (low + high) // 2 offset = mid * B cnt = sum(max(ceildiv(h - offset, d), 0) for h in H)...
N, A, B = list(map(int, input().split())) H = [int(eval(input())) for i in range(N)] d = A - B temp = max(H) low = temp // A - 1 high = temp // B + 1 while low + 1 < high: mid = (low + high) // 2 offset = mid * B cnt = -sum((offset - h) // d for h in H if h > offset) if cnt > mid: low = mid ...
false
0
[ "-low = sum(H) // (len(H) * B + A - B) - 1", "-high = max(H) // B + 1", "-ceildiv = lambda x, y: -(-x // y)", "+temp = max(H)", "+low = temp // A - 1", "+high = temp // B + 1", "- cnt = sum(max(ceildiv(h - offset, d), 0) for h in H)", "+ cnt = -sum((offset - h) // d for h in H if h > offset)" ]
false
0.046219
0.046958
0.984266
[ "s304243282", "s648762992" ]
u648868410
p02588
python
s433611733
s878303811
1,433
405
26,976
77,840
Accepted
Accepted
71.74
import numpy as np N=int(eval(input())) A=[] PRECISION_DIGITS=9 NO_ENTRY = 0 ARR_SIZE=PRECISION_DIGITS*2+1 cnt=np.full((ARR_SIZE,ARR_SIZE),NO_ENTRY,int) # cnt=np.zeros((PRECISION_DIGITS*2,PRECISION_DIGITS*2),int) # print(cnt) for n in range(N): tmpA = float(eval(input())) tmpA = round(tmpA*10**PRECIS...
import collections N=int(eval(input())) A=[] PRECISION_DIGITS=9 cnt=collections.defaultdict(int) for n in range(N): tmpA = float(eval(input())) tmpA = round(tmpA*10**PRECISION_DIGITS) #print(tmpA) five = 0 two = 0 while (tmpA % 2) == 0: two += 1 tmpA //= 2 while (tmpA % 5) == 0: five...
60
45
1,348
818
import numpy as np N = int(eval(input())) A = [] PRECISION_DIGITS = 9 NO_ENTRY = 0 ARR_SIZE = PRECISION_DIGITS * 2 + 1 cnt = np.full((ARR_SIZE, ARR_SIZE), NO_ENTRY, int) # cnt=np.zeros((PRECISION_DIGITS*2,PRECISION_DIGITS*2),int) # print(cnt) for n in range(N): tmpA = float(eval(input())) tmpA = round(tmpA * 1...
import collections N = int(eval(input())) A = [] PRECISION_DIGITS = 9 cnt = collections.defaultdict(int) for n in range(N): tmpA = float(eval(input())) tmpA = round(tmpA * 10**PRECISION_DIGITS) # print(tmpA) five = 0 two = 0 while (tmpA % 2) == 0: two += 1 tmpA //= 2 while (...
false
25
[ "-import numpy as np", "+import collections", "-NO_ENTRY = 0", "-ARR_SIZE = PRECISION_DIGITS * 2 + 1", "-cnt = np.full((ARR_SIZE, ARR_SIZE), NO_ENTRY, int)", "-# cnt=np.zeros((PRECISION_DIGITS*2,PRECISION_DIGITS*2),int)", "-# print(cnt)", "+cnt = collections.defaultdict(int)", "- # (10**9) -> (tw...
false
0.492132
0.040211
12.238808
[ "s433611733", "s878303811" ]
u347600233
p02712
python
s061423063
s586663143
154
103
9,104
34,432
Accepted
Accepted
33.12
n = int(eval(input())) sum = 0 for i in range(1, n + 1): if i % 3 != 0 and i % 5 != 0: sum += i print(sum)
# maspy 入力input() ver. import numpy as np n = int(eval(input())) x = np.arange(n + 1, dtype=np.int64) x[::3] = 0 x[::5] = 0 print((x.sum()))
6
7
117
138
n = int(eval(input())) sum = 0 for i in range(1, n + 1): if i % 3 != 0 and i % 5 != 0: sum += i print(sum)
# maspy 入力input() ver. import numpy as np n = int(eval(input())) x = np.arange(n + 1, dtype=np.int64) x[::3] = 0 x[::5] = 0 print((x.sum()))
false
14.285714
[ "+# maspy 入力input() ver.", "+import numpy as np", "+", "-sum = 0", "-for i in range(1, n + 1):", "- if i % 3 != 0 and i % 5 != 0:", "- sum += i", "-print(sum)", "+x = np.arange(n + 1, dtype=np.int64)", "+x[::3] = 0", "+x[::5] = 0", "+print((x.sum()))" ]
false
0.24732
0.335607
0.736933
[ "s061423063", "s586663143" ]