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
u970197315
p03682
python
s570650226
s818444363
1,724
1,179
49,660
51,024
Accepted
Accepted
31.61
import sys sys.setrecursionlimit(10**9) class UnionFind: def __init__(self,n): self.n=[-1]*n self.r=[0]*n self.siz=n def find_root(self,x): if self.n[x]<0: return x else: self.n[x]=self.find_root(self.n[x]) return self.n[x] def unite(self,x,y): x=self.find_r...
import sys sys.setrecursionlimit(10**7) 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.parents[x] = self.find(self.parents[x]) return ...
59
75
1,245
1,767
import sys sys.setrecursionlimit(10**9) class UnionFind: def __init__(self, n): self.n = [-1] * n self.r = [0] * n self.siz = n def find_root(self, x): if self.n[x] < 0: return x else: self.n[x] = self.find_root(self.n[x]) return se...
import sys sys.setrecursionlimit(10**7) 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.parents[x] = self.find(self.parents[x]) return self.parents[x]...
false
21.333333
[ "-sys.setrecursionlimit(10**9)", "+sys.setrecursionlimit(10**7)", "- self.n = [-1] * n", "- self.r = [0] * n", "- self.siz = n", "+ self.n = n", "+ self.parents = [-1] * n", "- def find_root(self, x):", "- if self.n[x] < 0:", "+ def find(self, x):", ...
false
0.074182
0.039614
1.872615
[ "s570650226", "s818444363" ]
u590241855
p02554
python
s515571672
s668246699
386
37
10,884
9,156
Accepted
Accepted
90.41
n = int(eval(input())) mod = 10**9 + 7 ans = 10**n - 9**n * 2 + 8**n ans %= mod print(ans)
n = int(eval(input())) mod = 10**9 + 7 ans = pow(10, n, mod) - pow(9, n, mod) * 2 + pow(8, n, mod) ans %= mod print(ans)
8
8
95
125
n = int(eval(input())) mod = 10**9 + 7 ans = 10**n - 9**n * 2 + 8**n ans %= mod print(ans)
n = int(eval(input())) mod = 10**9 + 7 ans = pow(10, n, mod) - pow(9, n, mod) * 2 + pow(8, n, mod) ans %= mod print(ans)
false
0
[ "-ans = 10**n - 9**n * 2 + 8**n", "+ans = pow(10, n, mod) - pow(9, n, mod) * 2 + pow(8, n, mod)" ]
false
0.144936
0.084248
1.720346
[ "s515571672", "s668246699" ]
u602252807
p02953
python
s087149755
s538381103
106
89
14,252
14,396
Accepted
Accepted
16.04
n = int(eval(input())) h = list(map(int,input().split())) M = h[0] for i in range(n-1): if h[i] >= h[i+1] + 2: print("No") exit() if M > h[i+1] + 1: print("No") exit() M = max(M,h[i+1]) print("Yes")
n = int(eval(input())) h = list(map(int,input().split())) M = h[0] for i in range(n-1): if M > h[i+1] + 1: print("No") exit() M = max(M,h[i+1]) print("Yes")
14
10
251
184
n = int(eval(input())) h = list(map(int, input().split())) M = h[0] for i in range(n - 1): if h[i] >= h[i + 1] + 2: print("No") exit() if M > h[i + 1] + 1: print("No") exit() M = max(M, h[i + 1]) print("Yes")
n = int(eval(input())) h = list(map(int, input().split())) M = h[0] for i in range(n - 1): if M > h[i + 1] + 1: print("No") exit() M = max(M, h[i + 1]) print("Yes")
false
28.571429
[ "- if h[i] >= h[i + 1] + 2:", "- print(\"No\")", "- exit()" ]
false
0.035979
0.034626
1.039083
[ "s087149755", "s538381103" ]
u740284863
p03807
python
s214386839
s120273400
44
40
14,052
11,172
Accepted
Accepted
9.09
import sys input = sys.stdin.readline n = int(eval(input())) A = list(map(int,input().split())) if sum(A) % 2 == 0: print("YES") else: print("NO")
import sys input = sys.stdin.readline eval(input()) print(('YES' if sum(map(int, input().split())) % 2 == 0 else 'NO'))
8
4
156
115
import sys input = sys.stdin.readline n = int(eval(input())) A = list(map(int, input().split())) if sum(A) % 2 == 0: print("YES") else: print("NO")
import sys input = sys.stdin.readline eval(input()) print(("YES" if sum(map(int, input().split())) % 2 == 0 else "NO"))
false
50
[ "-n = int(eval(input()))", "-A = list(map(int, input().split()))", "-if sum(A) % 2 == 0:", "- print(\"YES\")", "-else:", "- print(\"NO\")", "+eval(input())", "+print((\"YES\" if sum(map(int, input().split())) % 2 == 0 else \"NO\"))" ]
false
0.081254
0.048431
1.677715
[ "s214386839", "s120273400" ]
u744920373
p03575
python
s057945608
s074302312
108
20
3,188
3,064
Accepted
Accepted
81.48
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
66
49
1,712
1,259
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
false
25.757576
[ "-## UnionFind", "+## DFS", "-# d = dp2(float('inf'), N, N)", "- # d[s][t] = d[t][s] = 1", "-# print(d)", "+", "+", "- # print(v, used)", "- # for nv in range(N):", "- # if d[v][nv] != float('inf') and not used[nv]:", "- flag = True", "+ fl...
false
0.032015
0.037135
0.862138
[ "s057945608", "s074302312" ]
u977661421
p02732
python
s799558452
s061829840
714
288
109,364
33,336
Accepted
Accepted
59.66
# -*- coding: utf-8 -*- import collections def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n if n == 0: return 0 if n == 1: return 0 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): ...
""" スニペット """ def get_int(): return int(eval(input())) def get_ints(): return list(map(int, input().split())) """ スニペット """ import math # 2つ選ぶ通り数を算出 nC2 def choose2(n): return n*(n-1)//2 # インプット N = get_int() An = get_ints() """ 全ての要素から2つのボールを選ぶ通り数を求める """ uni = [0] * (N+1) # ユニーク数の配列を求める for i ...
75
27
1,917
580
# -*- coding: utf-8 -*- import collections def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n if n == 0: return 0 if n == 1: return 0 numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] ...
""" スニペット """ def get_int(): return int(eval(input())) def get_ints(): return list(map(int, input().split())) """ スニペット """ import math # 2つ選ぶ通り数を算出 nC2 def choose2(n): return n * (n - 1) // 2 # インプット N = get_int() An = get_ints() """ 全ての要素から2つのボールを選ぶ通り数を求める """ uni = [0] * (N + 1) # ユニーク数の配列を求める f...
false
64
[ "-# -*- coding: utf-8 -*-", "-import collections", "+\"\"\" スニペット \"\"\"", "-def cmb(n, r):", "- if n - r < r:", "- r = n - r", "- if r == 0:", "- return 1", "- if r == 1:", "- return n", "- if n == 0:", "- return 0", "- if n == 1:", "- ret...
false
0.03483
0.037513
0.928468
[ "s799558452", "s061829840" ]
u991567869
p02732
python
s990241035
s925505706
309
202
26,780
39,352
Accepted
Accepted
34.63
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) b = Counter(a) total = sum(i*(i - 1)//2 for i in list(b.values())) for i in a: print((total - (b[i] - 1)))
def ban(): from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) b = Counter(a) total = sum(i*(i - 1)//2 for i in list(b.values())) ans = [(total - (b[i] - 1)) for i in a] return "\n".join(map(str, ans)) print((ban()))
9
11
197
281
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) b = Counter(a) total = sum(i * (i - 1) // 2 for i in list(b.values())) for i in a: print((total - (b[i] - 1)))
def ban(): from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) b = Counter(a) total = sum(i * (i - 1) // 2 for i in list(b.values())) ans = [(total - (b[i] - 1)) for i in a] return "\n".join(map(str, ans)) print((ban()))
false
18.181818
[ "-from collections import Counter", "+def ban():", "+ from collections import Counter", "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-b = Counter(a)", "-total = sum(i * (i - 1) // 2 for i in list(b.values()))", "-for i in a:", "- print((total - (b[i] - 1)))", "+ n =...
false
0.043729
0.085102
0.513841
[ "s990241035", "s925505706" ]
u273084112
p03628
python
s061679921
s219541591
19
17
3,188
3,064
Accepted
Accepted
10.53
n = int(eval(input())) s1 = eval(input()) s2 = eval(input()) mod = 1000000007 num = 1 i = 0 b = 0 tmp_t = -1 while(b + i < n): if s1[i + b] == s2[i + b]: # t 0 if tmp_t == 0: num = (num * 2) % mod elif tmp_t == 1: num = (num * 1) % mod else: ...
n = int(eval(input())) s1 = eval(input()) + " " s2 = eval(input()) + " " mod = 1000000007 num = 1 i = 0 b = 0 tmp_t = -1 while(b + i < n): if s1[i + b] == s2[i + b]: # t 0 if tmp_t == 0: num = (num * 2) % mod elif tmp_t == 1: num = (num * 1) % mod ...
31
31
568
582
n = int(eval(input())) s1 = eval(input()) s2 = eval(input()) mod = 1000000007 num = 1 i = 0 b = 0 tmp_t = -1 while b + i < n: if s1[i + b] == s2[i + b]: # t 0 if tmp_t == 0: num = (num * 2) % mod elif tmp_t == 1: num = (num * 1) % mod else: num = 3 ...
n = int(eval(input())) s1 = eval(input()) + " " s2 = eval(input()) + " " mod = 1000000007 num = 1 i = 0 b = 0 tmp_t = -1 while b + i < n: if s1[i + b] == s2[i + b]: # t 0 if tmp_t == 0: num = (num * 2) % mod elif tmp_t == 1: num = (num * 1) % mod else: nu...
false
0
[ "-s1 = eval(input())", "-s2 = eval(input())", "+s1 = eval(input()) + \" \"", "+s2 = eval(input()) + \" \"" ]
false
0.082215
0.008196
10.031295
[ "s061679921", "s219541591" ]
u493520238
p03108
python
s042519488
s319628391
694
623
24,504
24,520
Accepted
Accepted
10.23
import sys input = sys.stdin.readline 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.parents[x] = self.find(self.parents[x]) return se...
import sys input = sys.stdin.readline 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.parents[x] = self.find(self.parents[x]) return se...
76
80
1,843
1,981
import sys input = sys.stdin.readline 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.parents[x] = self.find(self.parents[x]) return self.parents[x] ...
import sys input = sys.stdin.readline 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.parents[x] = self.find(self.parents[x]) return self.parents[x] ...
false
5
[ "-n, m = list(map(int, input().split()))", "-abl = []", "-for _ in range(m):", "- a, b = list(map(int, input().split()))", "- abl.append((a, b))", "-uf = UnionFind(n)", "-ans_r = []", "-curr_ans_minus = 0", "-for ab in reversed(abl):", "- a, b = ab", "- if not uf.same(a - 1, b - 1):"...
false
0.038437
0.066352
0.579284
[ "s042519488", "s319628391" ]
u627600101
p02787
python
s703927250
s549475792
275
105
82,852
74,408
Accepted
Accepted
61.82
import sys sys.setrecursionlimit(10**9) H, N = list(map(int, input().split())) magic = [_ for _ in range(N)] for k in range(N): magic[k] = list(map(int, input().split())) magic[k].append(magic[k][0]/magic[k][1]) magic.sort(key = lambda x: x[2], reverse=True) ans = [0 for _ in range(H+1)] visited = [0...
#import sys #sys.setrecursionlimit(10**9) H, N = list(map(int, input().split())) magic = [_ for _ in range(N)] for k in range(N): magic[k] = list(map(int, input().split())) magic[k].append(magic[k][0]/magic[k][1]) magic.sort(key = lambda x: x[2], reverse=True) ans = [0 for _ in range(H+1)] visited = ...
34
53
819
1,298
import sys sys.setrecursionlimit(10**9) H, N = list(map(int, input().split())) magic = [_ for _ in range(N)] for k in range(N): magic[k] = list(map(int, input().split())) magic[k].append(magic[k][0] / magic[k][1]) magic.sort(key=lambda x: x[2], reverse=True) ans = [0 for _ in range(H + 1)] visited = [0] anskou...
# import sys # sys.setrecursionlimit(10**9) H, N = list(map(int, input().split())) magic = [_ for _ in range(N)] for k in range(N): magic[k] = list(map(int, input().split())) magic[k].append(magic[k][0] / magic[k][1]) magic.sort(key=lambda x: x[2], reverse=True) ans = [0 for _ in range(H + 1)] visited = [0] ans...
false
35.849057
[ "-import sys", "-", "-sys.setrecursionlimit(10**9)", "+# import sys", "+# sys.setrecursionlimit(10**9)", "-", "-", "+ans2 = float(\"inf\")", "+\"\"\"", "- if start == H:", "- print((min(point, min(anskouho))))", "- exit()", "- elif start > H:", "- anskouho.append...
false
0.081155
0.039853
2.036351
[ "s703927250", "s549475792" ]
u272075541
p02947
python
s497968426
s253387994
988
677
17,332
17,332
Accepted
Accepted
31.48
import collections chars = ["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"] def eratosthenes_sieve(n): primes = [2] for odd in range(3, n + 1, 2): for p in primes: if odd % p == 0: ...
# ABC137C_GreenBin.py # ちなみに D は DP, E は ヘルマンフォード法 の良問。 import collections """ 英子文字 26 個を素数で置き換えて掛け合わせると、アナグラムの組は同じ値となる。 1 <= i < j <= n であって、 si が sj のアナグラムであるようなものの個数を求める。 """ def eratosthenes_sieve(n): primes = [2] for odd in range(3, n + 1, 2): for p in primes: if odd ...
38
48
813
1,129
import collections chars = [ "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", ] def eratosthenes_sieve(n): primes = [2] for ...
# ABC137C_GreenBin.py # ちなみに D は DP, E は ヘルマンフォード法 の良問。 import collections """ 英子文字 26 個を素数で置き換えて掛け合わせると、アナグラムの組は同じ値となる。 1 <= i < j <= n であって、 si が sj のアナグラムであるようなものの個数を求める。 """ def eratosthenes_sieve(n): primes = [2] for odd in range(3, n + 1, 2): for p in primes: if odd % p == 0: ...
false
20.833333
[ "+# ABC137C_GreenBin.py", "+# ちなみに D は DP, E は ヘルマンフォード法 の良問。", "-chars = [", "- \"a\",", "- \"b\",", "- \"c\",", "- \"d\",", "- \"e\",", "- \"f\",", "- \"g\",", "- \"h\",", "- \"i\",", "- \"j\",", "- \"k\",", "- \"l\",", "- \"m\",", "- \"n\"...
false
0.075001
0.07499
1.00015
[ "s497968426", "s253387994" ]
u377989038
p02989
python
s470386319
s977540041
248
92
23,404
14,428
Accepted
Accepted
62.9
import numpy as np n = int(eval(input())) d = np.array(sorted((list(map(int, input().split()))))) if len(d[d <= d[n // 2 - 1]]) == n // 2: print((d[n // 2] - d[n // 2 - 1])) else: print((0))
n = int(eval(input())) d = sorted((list(map(int, input().split())))) if len([i for i in d if d[n // 2 - 1] >= i]) == n // 2: print((d[n // 2] - d[n // 2 - 1])) else: print((0))
9
7
198
181
import numpy as np n = int(eval(input())) d = np.array(sorted((list(map(int, input().split()))))) if len(d[d <= d[n // 2 - 1]]) == n // 2: print((d[n // 2] - d[n // 2 - 1])) else: print((0))
n = int(eval(input())) d = sorted((list(map(int, input().split())))) if len([i for i in d if d[n // 2 - 1] >= i]) == n // 2: print((d[n // 2] - d[n // 2 - 1])) else: print((0))
false
22.222222
[ "-import numpy as np", "-", "-d = np.array(sorted((list(map(int, input().split())))))", "-if len(d[d <= d[n // 2 - 1]]) == n // 2:", "+d = sorted((list(map(int, input().split()))))", "+if len([i for i in d if d[n // 2 - 1] >= i]) == n // 2:" ]
false
0.301211
0.037867
7.954469
[ "s470386319", "s977540041" ]
u073852194
p03798
python
s654863767
s694129964
251
171
3,444
10,716
Accepted
Accepted
31.87
N = int(eval(input())) s = eval(input()) def solve(ans): for i in range(2,N): if ans[i-2]=='S' and ans[i-1]=='S': if s[i-1]=='o': ans += 'S' else: ans += 'W' elif ans[i-2]=='S' and ans[i-1]=='W': if s[i-1]=='o': ...
N = int(input()) S = input() assignable = False for k in range(4): res = [None for _ in range(N)] res[0] = k % 2 res[-1] = k // 2 for i in range(N - 2): if S[i] == 'o': if res[i] == 0: res[i + 1] = res[i - 1] else: res[i + 1...
46
57
1,262
1,461
N = int(eval(input())) s = eval(input()) def solve(ans): for i in range(2, N): if ans[i - 2] == "S" and ans[i - 1] == "S": if s[i - 1] == "o": ans += "S" else: ans += "W" elif ans[i - 2] == "S" and ans[i - 1] == "W": if s[i - 1] =...
N = int(input()) S = input() assignable = False for k in range(4): res = [None for _ in range(N)] res[0] = k % 2 res[-1] = k // 2 for i in range(N - 2): if S[i] == "o": if res[i] == 0: res[i + 1] = res[i - 1] else: res[i + 1] = 1 - res[i - ...
false
19.298246
[ "-N = int(eval(input()))", "-s = eval(input())", "-", "-", "-def solve(ans):", "- for i in range(2, N):", "- if ans[i - 2] == \"S\" and ans[i - 1] == \"S\":", "- if s[i - 1] == \"o\":", "- ans += \"S\"", "+N = int(input())", "+S = input()", "+assignable = Fa...
false
0.038401
0.07835
0.490125
[ "s654863767", "s694129964" ]
u305366205
p03807
python
s960409660
s467788567
61
50
14,112
14,108
Accepted
Accepted
18.03
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 for i in range(n): if a[i] % 2 == 1: cnt += 1 if cnt % 2 == 0: print('YES') else: print('NO')
n = eval(input()) a = list(map(int, input().split())) # Python: TrueとFalseは0,1と等価 odd_cnt = len([1 for ai in a if ai % 2]) print(('YES' if odd_cnt % 2 == 0 else 'NO'))
10
5
183
163
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 for i in range(n): if a[i] % 2 == 1: cnt += 1 if cnt % 2 == 0: print("YES") else: print("NO")
n = eval(input()) a = list(map(int, input().split())) # Python: TrueとFalseは0,1と等価 odd_cnt = len([1 for ai in a if ai % 2]) print(("YES" if odd_cnt % 2 == 0 else "NO"))
false
50
[ "-n = int(eval(input()))", "+n = eval(input())", "-cnt = 0", "-for i in range(n):", "- if a[i] % 2 == 1:", "- cnt += 1", "-if cnt % 2 == 0:", "- print(\"YES\")", "-else:", "- print(\"NO\")", "+# Python: TrueとFalseは0,1と等価", "+odd_cnt = len([1 for ai in a if ai % 2])", "+print(...
false
0.048985
0.048565
1.008651
[ "s960409660", "s467788567" ]
u179169725
p03078
python
s341504192
s075022983
594
41
4,084
5,232
Accepted
Accepted
93.1
# ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方 # これもなかなか早い # ヒープは追加も要素の取り出しもO(log n)で住むので、 # 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが # not in があるのでO(n K log n)では? # pythonのヒープは使い方に癖があるのでこの機会に習得しよう import sys read = sys.stdin.readline def read_ints(): return list(map(int, read().split())) X, Y, Z, K = read_...
# ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方 # これもなかなか早い # ヒープは追加も要素の取り出しもO(log n)で住むので、 # 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが # not in があるのでO(n K log n)では? # pythonのヒープは使い方に癖があるのでこの機会に習得しよう import sys read = sys.stdin.readline def read_ints(): return list(map(int, read().split())) X, Y, Z, K = read_...
69
69
1,521
1,557
# ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方 # これもなかなか早い # ヒープは追加も要素の取り出しもO(log n)で住むので、 # 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが # not in があるのでO(n K log n)では? # pythonのヒープは使い方に癖があるのでこの機会に習得しよう import sys read = sys.stdin.readline def read_ints(): return list(map(int, read().split())) X, Y, Z, K = read_ints() A = re...
# ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方 # これもなかなか早い # ヒープは追加も要素の取り出しもO(log n)で住むので、 # 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが # not in があるのでO(n K log n)では? # pythonのヒープは使い方に癖があるのでこの機会に習得しよう import sys read = sys.stdin.readline def read_ints(): return list(map(int, read().split())) X, Y, Z, K = read_ints() A = re...
false
0
[ "+considered = set()", "- # print(heap_max)", "- tmp = (-(A[i_new] + B[j_new] + C[k_new]), i_new, j_new, k_new)", "- if tmp in q(): # ここが計算量がおおい", "+ if (i_new, j_new, k_new) in considered:", "- q.push(tmp)", "+ considered.add((i_new, j_new, k_new))", "+ q...
false
0.060739
0.03692
1.645144
[ "s341504192", "s075022983" ]
u218843509
p02651
python
s869315012
s435580511
93
76
68,644
73,764
Accepted
Accepted
18.28
t = int(eval(input())) for _ in range(t): n = int(eval(input())) a = list(map(int, input().split())) s = eval(input()) basis = [] ans = 0 for i in range(n-1, -1, -1): if s[i] == "0": for b in basis: a[i] = min(a[i], a[i]^b) if a[i]: basis.append(a[i]) else: for b in basis: ...
for _ in range(int(eval(input()))): n = int(eval(input())) a = list(map(int, input().split())) s = eval(input()) basis = [] ans = 0 for i in range(n-1, -1, -1): for b in basis: a[i] = min(a[i], a[i]^b) if a[i]: if s[i] == "0": basis.append(a[i]) else: ans = 1 break print(a...
20
16
376
305
t = int(eval(input())) for _ in range(t): n = int(eval(input())) a = list(map(int, input().split())) s = eval(input()) basis = [] ans = 0 for i in range(n - 1, -1, -1): if s[i] == "0": for b in basis: a[i] = min(a[i], a[i] ^ b) if a[i]: ...
for _ in range(int(eval(input()))): n = int(eval(input())) a = list(map(int, input().split())) s = eval(input()) basis = [] ans = 0 for i in range(n - 1, -1, -1): for b in basis: a[i] = min(a[i], a[i] ^ b) if a[i]: if s[i] == "0": basis.app...
false
20
[ "-t = int(eval(input()))", "-for _ in range(t):", "+for _ in range(int(eval(input()))):", "- if s[i] == \"0\":", "- for b in basis:", "- a[i] = min(a[i], a[i] ^ b)", "- if a[i]:", "+ for b in basis:", "+ a[i] = min(a[i], a[i] ^ b)", "+ ...
false
0.037275
0.046707
0.798064
[ "s869315012", "s435580511" ]
u121921603
p02913
python
s872214372
s356729873
888
806
231,432
52,588
Accepted
Accepted
9.23
import sys input = sys.stdin.readline N=int(eval(input())) S=input().strip() dp=[[0]*(N+1) for _ in range(N+1)] for i in range(N-1,-1,-1): for j in range(N-1,i,-1): if S[i]==S[j]: dp[i][j]=max(dp[i][j],dp[i+1][j+1]+1) #print(dp) ans=0 for i in range(N): for j in range(N): ...
import sys input = sys.stdin.readline N=int(eval(input())) S=input().strip() """dp=[[0]*(N+1) for _ in range(N+1)] for i in range(N-1,-1,-1): for j in range(N-1,i,-1): if S[i]==S[j]: dp[i][j]=max(dp[i][j],dp[i+1][j+1]+1) #print(dp) ans=0 for i in range(N): for j in range(N): ...
15
43
359
949
import sys input = sys.stdin.readline N = int(eval(input())) S = input().strip() dp = [[0] * (N + 1) for _ in range(N + 1)] for i in range(N - 1, -1, -1): for j in range(N - 1, i, -1): if S[i] == S[j]: dp[i][j] = max(dp[i][j], dp[i + 1][j + 1] + 1) # print(dp) ans = 0 for i in range(N): for...
import sys input = sys.stdin.readline N = int(eval(input())) S = input().strip() """dp=[[0]*(N+1) for _ in range(N+1)] for i in range(N-1,-1,-1): for j in range(N-1,i,-1): if S[i]==S[j]: dp[i][j]=max(dp[i][j],dp[i+1][j+1]+1) #print(dp) ans=0 for i in range(N): for j in range(N): ans...
false
65.116279
[ "-dp = [[0] * (N + 1) for _ in range(N + 1)]", "-for i in range(N - 1, -1, -1):", "- for j in range(N - 1, i, -1):", "- if S[i] == S[j]:", "- dp[i][j] = max(dp[i][j], dp[i + 1][j + 1] + 1)", "-# print(dp)", "+\"\"\"dp=[[0]*(N+1) for _ in range(N+1)]", "+for i in range(N-1,-1,-1):"...
false
0.048166
0.049086
0.981245
[ "s872214372", "s356729873" ]
u774160580
p03361
python
s638487904
s049274510
45
20
4,080
3,064
Accepted
Accepted
55.56
import queue as q direction = [[1, 0], [-1, 0], [0, -1], [0, 1]] H, W = list(map(int, input().split())) s = [] for i in range(H): s_i = eval(input()) s.append([s_i[i] for i in range(len(s_i))]) def do_bfs(s, que): while True: if que.empty(): break pos = que.get...
H, W = list(map(int, input().split())) s = [] for i in range(H): s_i = eval(input()) s.append([s_i[i] for i in range(len(s_i))]) direction = [[1, 0], [-1, 0], [0, -1], [0, 1]] for i in range(H): for j in range(W): if s[i][j] == "#": # check isolated is_isolated = Tr...
54
22
1,520
734
import queue as q direction = [[1, 0], [-1, 0], [0, -1], [0, 1]] H, W = list(map(int, input().split())) s = [] for i in range(H): s_i = eval(input()) s.append([s_i[i] for i in range(len(s_i))]) def do_bfs(s, que): while True: if que.empty(): break pos = que.get() for a...
H, W = list(map(int, input().split())) s = [] for i in range(H): s_i = eval(input()) s.append([s_i[i] for i in range(len(s_i))]) direction = [[1, 0], [-1, 0], [0, -1], [0, 1]] for i in range(H): for j in range(W): if s[i][j] == "#": # check isolated is_isolated = True ...
false
59.259259
[ "-import queue as q", "-", "-direction = [[1, 0], [-1, 0], [0, -1], [0, 1]]", "-", "-", "-def do_bfs(s, que):", "- while True:", "- if que.empty():", "- break", "- pos = que.get()", "- for arrow in direction:", "- next = [pos[0] + arrow[0], pos[1] ...
false
0.070351
0.038243
1.839588
[ "s638487904", "s049274510" ]
u600402037
p02802
python
s715298605
s430810928
285
180
4,596
5,364
Accepted
Accepted
36.84
import sys #import numpy as np stdin = sys.stdin ri = lambda: int(rs()) rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only rs = lambda: stdin.readline().rstrip() # ignore trailing spaces N, M = rl() solve = [False] * (N+1) count = [0] * (N+1) penalty = 0 for i in range(M): ...
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, M = lr() problems = [False] * N AC = [0] * N WA = [0] * N for _ in range(M): p, S = sr().split(); p = int(p) - 1 if not problems[p] and S == 'WA': WA[p] += 1 if n...
25
21
537
495
import sys # import numpy as np stdin = sys.stdin ri = lambda: int(rs()) rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only rs = lambda: stdin.readline().rstrip() # ignore trailing spaces N, M = rl() solve = [False] * (N + 1) count = [0] * (N + 1) penalty = 0 for i in range(M): p, s ...
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, M = lr() problems = [False] * N AC = [0] * N WA = [0] * N for _ in range(M): p, S = sr().split() p = int(p) - 1 if not problems[p] and S == "WA": WA[p] += 1 if not problems[...
false
16
[ "-# import numpy as np", "-stdin = sys.stdin", "-ri = lambda: int(rs())", "-rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only", "-rs = lambda: stdin.readline().rstrip() # ignore trailing spaces", "-N, M = rl()", "-solve = [False] * (N + 1)", "-count = [0] * (N + 1)", ...
false
0.044069
0.12428
0.354593
[ "s715298605", "s430810928" ]
u977982384
p02577
python
s892226069
s608774446
217
55
9,204
10,552
Accepted
Accepted
74.65
N = int( eval(input()) ) if N % 9 == 0 : print('Yes') if N % 9 != 0 : print('No')
n = eval(input( )) result = sum(list(map(int, str(n)))) if result % 9 == 0 : print('Yes') else : print('No')
5
8
89
123
N = int(eval(input())) if N % 9 == 0: print("Yes") if N % 9 != 0: print("No")
n = eval(input()) result = sum(list(map(int, str(n)))) if result % 9 == 0: print("Yes") else: print("No")
false
37.5
[ "-N = int(eval(input()))", "-if N % 9 == 0:", "+n = eval(input())", "+result = sum(list(map(int, str(n))))", "+if result % 9 == 0:", "-if N % 9 != 0:", "+else:" ]
false
0.035983
0.077926
0.461754
[ "s892226069", "s608774446" ]
u133936772
p03379
python
s496919081
s999411977
325
186
25,220
30,848
Accepted
Accepted
42.77
m=int(eval(input()))//2-1 x=list(map(int,input().split())) l,r=sorted(x)[m:m+2] for i in x: print(([l,r][i<r]))
n=int(eval(input())) x=[*list(map(int,input().split()))] s=sorted(x) l,r=s[n//2-1],s[n//2] for i in x: print(([l,r][i<r]))
4
6
106
115
m = int(eval(input())) // 2 - 1 x = list(map(int, input().split())) l, r = sorted(x)[m : m + 2] for i in x: print(([l, r][i < r]))
n = int(eval(input())) x = [*list(map(int, input().split()))] s = sorted(x) l, r = s[n // 2 - 1], s[n // 2] for i in x: print(([l, r][i < r]))
false
33.333333
[ "-m = int(eval(input())) // 2 - 1", "-x = list(map(int, input().split()))", "-l, r = sorted(x)[m : m + 2]", "+n = int(eval(input()))", "+x = [*list(map(int, input().split()))]", "+s = sorted(x)", "+l, r = s[n // 2 - 1], s[n // 2]" ]
false
0.039475
0.038895
1.014914
[ "s496919081", "s999411977" ]
u580697892
p03102
python
s307998496
s802795858
967
18
21,656
3,060
Accepted
Accepted
98.14
#coding: utf-8 import numpy as np N, M, C = list(map(int, input().split())) B = np.array(list(map(int, input().split()))) A = np.array([list(map(int, input().split())) for _ in range(N)]) sum_ = np.array([np.sum(A[i] * B) + C for i in range(N)]) print((np.sum(sum_ > 0)))
#coding: utf-8 N, M, C = list(map(int, input().split())) B = list(map(int, input().split())) l = [] for i in range(N): A = list(map(int, input().split())) l.append(sum(A[j] * B[j] for j in range(M)) + C > 0) print((sum(l)))
7
8
269
230
# coding: utf-8 import numpy as np N, M, C = list(map(int, input().split())) B = np.array(list(map(int, input().split()))) A = np.array([list(map(int, input().split())) for _ in range(N)]) sum_ = np.array([np.sum(A[i] * B) + C for i in range(N)]) print((np.sum(sum_ > 0)))
# coding: utf-8 N, M, C = list(map(int, input().split())) B = list(map(int, input().split())) l = [] for i in range(N): A = list(map(int, input().split())) l.append(sum(A[j] * B[j] for j in range(M)) + C > 0) print((sum(l)))
false
12.5
[ "-import numpy as np", "-", "-B = np.array(list(map(int, input().split())))", "-A = np.array([list(map(int, input().split())) for _ in range(N)])", "-sum_ = np.array([np.sum(A[i] * B) + C for i in range(N)])", "-print((np.sum(sum_ > 0)))", "+B = list(map(int, input().split()))", "+l = []", "+for i i...
false
0.345302
0.037897
9.111505
[ "s307998496", "s802795858" ]
u997641430
p02721
python
s846670753
s988713153
315
253
69,832
22,316
Accepted
Accepted
19.68
n, k, c = list(map(int, input().split())) S = list(eval(input())) def f(S): L = [] on = True cnt = 0 for i in range(n): if not on: if cnt == c: on = True cnt += 1 if on and S[i] == 'o': on = False cnt = 0 ...
def work(S, k, c): tir = 0 cnt = 0 for i, s in enumerate(S): if s == 'o' and tir == 0 and cnt < k: yield i tir = c cnt += 1 else: tir = max(tir-1, 0) n, k, c = list(map(int, input().split())) S = list(eval(input())) L = [i+1 for...
27
19
515
433
n, k, c = list(map(int, input().split())) S = list(eval(input())) def f(S): L = [] on = True cnt = 0 for i in range(n): if not on: if cnt == c: on = True cnt += 1 if on and S[i] == "o": on = False cnt = 0 L.app...
def work(S, k, c): tir = 0 cnt = 0 for i, s in enumerate(S): if s == "o" and tir == 0 and cnt < k: yield i tir = c cnt += 1 else: tir = max(tir - 1, 0) n, k, c = list(map(int, input().split())) S = list(eval(input())) L = [i + 1 for i in work...
false
29.62963
[ "+def work(S, k, c):", "+ tir = 0", "+ cnt = 0", "+ for i, s in enumerate(S):", "+ if s == \"o\" and tir == 0 and cnt < k:", "+ yield i", "+ tir = c", "+ cnt += 1", "+ else:", "+ tir = max(tir - 1, 0)", "+", "+", "-", "-", ...
false
0.043888
0.045492
0.964743
[ "s846670753", "s988713153" ]
u020390084
p02845
python
s501199953
s444091999
336
122
14,324
14,376
Accepted
Accepted
63.69
#!/usr/bin/env python3 import sys MOD = 1000000007 # type: int def solve(N: int, A: "List[int]"): if A[0] != 0: print((0)) return ## 一番多い色の帽子の数 color = [1,0,0] answer = 3 for i in range(1,N): if A[i] not in color: print((0)) re...
#!/usr/bin/env python3 import sys input = sys.stdin.readline def INT(): return int(eval(input())) def MAP(): return list(map(int,input().split())) def LI(): return list(map(int,input().split())) def main(): N = INT() A = LI() RGB = [0,0,0] answer = 1 MOD = 10**9+7 for i in range(...
44
31
895
635
#!/usr/bin/env python3 import sys MOD = 1000000007 # type: int def solve(N: int, A: "List[int]"): if A[0] != 0: print((0)) return ## 一番多い色の帽子の数 color = [1, 0, 0] answer = 3 for i in range(1, N): if A[i] not in color: print((0)) return count...
#!/usr/bin/env python3 import sys input = sys.stdin.readline def INT(): return int(eval(input())) def MAP(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): N = INT() A = LI() RGB = [0, 0, 0] answer = 1 MOD = 10**9 + 7 for ...
false
29.545455
[ "-MOD = 1000000007 # type: int", "+input = sys.stdin.readline", "-def solve(N: int, A: \"List[int]\"):", "- if A[0] != 0:", "- print((0))", "- return", "- ## 一番多い色の帽子の数", "- color = [1, 0, 0]", "- answer = 3", "- for i in range(1, N):", "- if A[i] not in colo...
false
0.11687
0.038288
3.052403
[ "s501199953", "s444091999" ]
u973840923
p03212
python
s049252309
s790075418
64
40
3,060
3,060
Accepted
Accepted
37.5
N = int(eval(input())) cnt = 0 def dfs(s): global cnt if '3' in s and '5' in s and '7' in s and int(s) <= N: cnt += 1 if len(s) >= 10: return cnt dfs(s + '3') dfs(s + '5') dfs(s + '7') return cnt print((dfs('')))
from itertools import product N = int(eval(input())) cnt = 0 for i in range(3,10): for v in product('357',repeat=i): val = ''.join(v) if int(val) <= N and '3' in val and '5' in val and '7' in val: cnt += 1 print(cnt)
15
11
264
253
N = int(eval(input())) cnt = 0 def dfs(s): global cnt if "3" in s and "5" in s and "7" in s and int(s) <= N: cnt += 1 if len(s) >= 10: return cnt dfs(s + "3") dfs(s + "5") dfs(s + "7") return cnt print((dfs("")))
from itertools import product N = int(eval(input())) cnt = 0 for i in range(3, 10): for v in product("357", repeat=i): val = "".join(v) if int(val) <= N and "3" in val and "5" in val and "7" in val: cnt += 1 print(cnt)
false
26.666667
[ "+from itertools import product", "+", "-", "-", "-def dfs(s):", "- global cnt", "- if \"3\" in s and \"5\" in s and \"7\" in s and int(s) <= N:", "- cnt += 1", "- if len(s) >= 10:", "- return cnt", "- dfs(s + \"3\")", "- dfs(s + \"5\")", "- dfs(s + \"7\")", ...
false
0.138498
0.075817
1.826754
[ "s049252309", "s790075418" ]
u551909378
p02972
python
s662726442
s318544846
842
434
21,768
21,864
Accepted
Accepted
48.46
N = int(eval(input())) a = [0] + list(map(int, input().split())) b = set([i for i in range(N//2 + 1, N + 1) if a[i] == 1]) for i in range(N//2, 0, -1): k, temp = 2, 0 while k * i < N + 1: if k * i in b: temp += 1 k += 1 if temp % 2 != a[i]: b.add(i) if len(...
N = int(eval(input())) a = [0] + list(map(int, input().split())) b = set([i for i in range(N//2 + 1, N + 1) if a[i] == 1]) for i in range(N//2, 0, -1): if sum([1 for k in range(2, N//i + 1) if k*i in b]) % 2 != a[i]: b.add(i) if len(b) > 0: print((len(b))) print((' '.join(list(map(str, s...
18
13
415
350
N = int(eval(input())) a = [0] + list(map(int, input().split())) b = set([i for i in range(N // 2 + 1, N + 1) if a[i] == 1]) for i in range(N // 2, 0, -1): k, temp = 2, 0 while k * i < N + 1: if k * i in b: temp += 1 k += 1 if temp % 2 != a[i]: b.add(i) if len(b) > 0: ...
N = int(eval(input())) a = [0] + list(map(int, input().split())) b = set([i for i in range(N // 2 + 1, N + 1) if a[i] == 1]) for i in range(N // 2, 0, -1): if sum([1 for k in range(2, N // i + 1) if k * i in b]) % 2 != a[i]: b.add(i) if len(b) > 0: print((len(b))) print((" ".join(list(map(str, sorte...
false
27.777778
[ "- k, temp = 2, 0", "- while k * i < N + 1:", "- if k * i in b:", "- temp += 1", "- k += 1", "- if temp % 2 != a[i]:", "+ if sum([1 for k in range(2, N // i + 1) if k * i in b]) % 2 != a[i]:" ]
false
0.039004
0.008023
4.861806
[ "s662726442", "s318544846" ]
u893063840
p02690
python
s933074053
s633452273
1,341
42
9,164
9,224
Accepted
Accepted
96.87
x = int(eval(input())) for i in range(-1000, 1000): for j in range(-1000, 1000): if i ** 5 - j ** 5 == x: print((i, j)) exit()
def f(x): return pow(x, 5) - pow(x - 1, 5) x = int(eval(input())) a_mx = 1 while f(a_mx) < x: a_mx += 1 a_mn = 0 while f(a_mn) < x: a_mn -= 1 b_mx = a_mx - 1 b_mn = a_mn - 1 for a in range(a_mn, a_mx + 1): for b in range(b_mn, b_mx + 1): if pow(a, 5) - pow(b, 5) == x: ...
7
22
162
357
x = int(eval(input())) for i in range(-1000, 1000): for j in range(-1000, 1000): if i**5 - j**5 == x: print((i, j)) exit()
def f(x): return pow(x, 5) - pow(x - 1, 5) x = int(eval(input())) a_mx = 1 while f(a_mx) < x: a_mx += 1 a_mn = 0 while f(a_mn) < x: a_mn -= 1 b_mx = a_mx - 1 b_mn = a_mn - 1 for a in range(a_mn, a_mx + 1): for b in range(b_mn, b_mx + 1): if pow(a, 5) - pow(b, 5) == x: print((a, b))...
false
68.181818
[ "+def f(x):", "+ return pow(x, 5) - pow(x - 1, 5)", "+", "+", "-for i in range(-1000, 1000):", "- for j in range(-1000, 1000):", "- if i**5 - j**5 == x:", "- print((i, j))", "+a_mx = 1", "+while f(a_mx) < x:", "+ a_mx += 1", "+a_mn = 0", "+while f(a_mn) < x:", "+...
false
0.006884
0.039188
0.175679
[ "s933074053", "s633452273" ]
u608088992
p02708
python
s840185918
s089057100
114
102
9,196
9,196
Accepted
Accepted
10.53
import sys mod = 7 + 10 ** 9 def solve(): input = sys.stdin.readline N, K = list(map(int, input().split())) ans = 0 for k in range(K, N + 2): minSum = (0 + k - 1) * k // 2 maxSum = (N - k + 1 + N) * k // 2 ans += (maxSum - minSum + 1) % mod ans %= mod pri...
import sys mod = 7 + 10 ** 9 def solve(): input = sys.stdin.readline N, K = list(map(int, input().split())) ans = 0 for k in range(K, N + 2): minS = (k - 1) * k // 2 maxS = (N - k + 1 + N) * k // 2 ans += (maxS - minS + 1) ans %= mod print(ans) ...
20
19
388
365
import sys mod = 7 + 10**9 def solve(): input = sys.stdin.readline N, K = list(map(int, input().split())) ans = 0 for k in range(K, N + 2): minSum = (0 + k - 1) * k // 2 maxSum = (N - k + 1 + N) * k // 2 ans += (maxSum - minSum + 1) % mod ans %= mod print(ans) ...
import sys mod = 7 + 10**9 def solve(): input = sys.stdin.readline N, K = list(map(int, input().split())) ans = 0 for k in range(K, N + 2): minS = (k - 1) * k // 2 maxS = (N - k + 1 + N) * k // 2 ans += maxS - minS + 1 ans %= mod print(ans) return 0 if __name...
false
5
[ "- minSum = (0 + k - 1) * k // 2", "- maxSum = (N - k + 1 + N) * k // 2", "- ans += (maxSum - minSum + 1) % mod", "+ minS = (k - 1) * k // 2", "+ maxS = (N - k + 1 + N) * k // 2", "+ ans += maxS - minS + 1" ]
false
0.064482
0.051713
1.246914
[ "s840185918", "s089057100" ]
u347184682
p02899
python
s123461179
s181273698
121
98
13,880
19,920
Accepted
Accepted
19.01
n=int(eval(input())) A=[int(x) for x in input().rstrip().split()] ans=[0 for i in range(n)] for i in range(n): ans[A[i]-1]=i+1 print((*ans))
n=int(eval(input())) a=[int(x) for x in input().rstrip().split()] ans=[0 for i in range(n)] for i in range(n): ans[a[i]-1]=i+1 print((*ans))
6
6
139
143
n = int(eval(input())) A = [int(x) for x in input().rstrip().split()] ans = [0 for i in range(n)] for i in range(n): ans[A[i] - 1] = i + 1 print((*ans))
n = int(eval(input())) a = [int(x) for x in input().rstrip().split()] ans = [0 for i in range(n)] for i in range(n): ans[a[i] - 1] = i + 1 print((*ans))
false
0
[ "-A = [int(x) for x in input().rstrip().split()]", "+a = [int(x) for x in input().rstrip().split()]", "- ans[A[i] - 1] = i + 1", "+ ans[a[i] - 1] = i + 1" ]
false
0.048275
0.04873
0.990665
[ "s123461179", "s181273698" ]
u102461423
p02561
python
s482638341
s049713751
621
541
82,828
69,828
Accepted
Accepted
12.88
import sys import itertools import numpy as np import networkx as nx read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = list(map(int, readline().split())) S = np.frombuffer(read(), 'S1').reshape(N, -1)[:, :M].astype('U1') A = [] B = [] E = []...
import sys import itertools import numpy as np import networkx as nx read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = list(map(int, readline().split())) S = np.frombuffer(read(), 'S1').reshape(N, -1)[:, :M].astype('U1') A = [] B = [] E = []...
52
52
1,193
1,192
import sys import itertools import numpy as np import networkx as nx read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = list(map(int, readline().split())) S = np.frombuffer(read(), "S1").reshape(N, -1)[:, :M].astype("U1") A = [] B = [] E = [] for i, j in ite...
import sys import itertools import numpy as np import networkx as nx read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = list(map(int, readline().split())) S = np.frombuffer(read(), "S1").reshape(N, -1)[:, :M].astype("U1") A = [] B = [] E = [] for i, j in ite...
false
0
[ "-M = nx.bipartite.eppstein_matching(G, A)", "+M = nx.bipartite.maximum_matching(G, A)" ]
false
0.261532
0.228729
1.143414
[ "s482638341", "s049713751" ]
u794173881
p03283
python
s450897674
s933811414
1,410
584
111,576
100,060
Accepted
Accepted
58.58
class Ruiseki2D: """二次元累積和を構築する""" def __init__(self, matrix): self.h = len(matrix) self.w = len(matrix[0]) self.ru = [[0] * (self.w + 1) for _ in range(self.h + 1)] for i in range(self.h): for j in range(self.w): self.ru[i + 1][j + 1] = self...
import sys input = sys.stdin.readline class Ruiseki2D: """二次元累積和を構築する""" def __init__(self, matrix): self.h = len(matrix) self.w = len(matrix[0]) self.ru = [[0] * (self.w + 1) for _ in range(self.h + 1)] for i in range(self.h): for j in range(self.w): ...
32
36
1,031
1,075
class Ruiseki2D: """二次元累積和を構築する""" def __init__(self, matrix): self.h = len(matrix) self.w = len(matrix[0]) self.ru = [[0] * (self.w + 1) for _ in range(self.h + 1)] for i in range(self.h): for j in range(self.w): self.ru[i + 1][j + 1] = self.ru[i + 1...
import sys input = sys.stdin.readline class Ruiseki2D: """二次元累積和を構築する""" def __init__(self, matrix): self.h = len(matrix) self.w = len(matrix[0]) self.ru = [[0] * (self.w + 1) for _ in range(self.h + 1)] for i in range(self.h): for j in range(self.w): ...
false
11.111111
[ "+import sys", "+", "+input = sys.stdin.readline", "+", "+" ]
false
0.036652
0.036729
0.997902
[ "s450897674", "s933811414" ]
u555767343
p02778
python
s965749324
s716756241
186
164
38,384
38,512
Accepted
Accepted
11.83
lenS = len(eval(input())) print(('x'*lenS))
print(('x'*len(eval(input()))))
2
1
36
23
lenS = len(eval(input())) print(("x" * lenS))
print(("x" * len(eval(input()))))
false
50
[ "-lenS = len(eval(input()))", "-print((\"x\" * lenS))", "+print((\"x\" * len(eval(input()))))" ]
false
0.040467
0.036731
1.10173
[ "s965749324", "s716756241" ]
u198440493
p03103
python
s943477377
s029140414
230
202
25,828
25,828
Accepted
Accepted
12.17
n,m,*l=list(map(int,open(0).read().split())) ans=0 for s,t in sorted(zip(l[::2],l[1::2])): ans+=s*min(m,t) m=max(m-t,0) if not m: break print(ans)
n,m,*l=list(map(int,open(0).read().split())) ans=0 for s,t in sorted(zip(l[::2],l[1::2])): ans+=s*min(m,t) m-=t if m<=0: print(ans) break
8
8
157
152
n, m, *l = list(map(int, open(0).read().split())) ans = 0 for s, t in sorted(zip(l[::2], l[1::2])): ans += s * min(m, t) m = max(m - t, 0) if not m: break print(ans)
n, m, *l = list(map(int, open(0).read().split())) ans = 0 for s, t in sorted(zip(l[::2], l[1::2])): ans += s * min(m, t) m -= t if m <= 0: print(ans) break
false
0
[ "- m = max(m - t, 0)", "- if not m:", "+ m -= t", "+ if m <= 0:", "+ print(ans)", "-print(ans)" ]
false
0.034148
0.045958
0.743032
[ "s943477377", "s029140414" ]
u426534722
p02266
python
s272673233
s111451490
990
20
7,896
6,500
Accepted
Accepted
97.98
import sys readline = sys.stdin.readline li = [] for i, s in enumerate(readline().strip()): if s == "\\": li.append([i, 0]) elif s == "/": if li: if li[-1][1] == 0: li[-1][1] = i - li[-1][0] else: for j in range(len(li) - 1, -1, ...
li1 = [] li2 = [] ans = 0 for i, s in enumerate(eval(input())): if s == "\\": li1.append(i) elif s == "/" and li1: j = li1.pop() c = i - j ans += c while li2 and li2[-1][0] > j: c += li2[-1][1] li2.pop() li2.append((j, c)) pri...
22
20
606
396
import sys readline = sys.stdin.readline li = [] for i, s in enumerate(readline().strip()): if s == "\\": li.append([i, 0]) elif s == "/": if li: if li[-1][1] == 0: li[-1][1] = i - li[-1][0] else: for j in range(len(li) - 1, -1, -1): ...
li1 = [] li2 = [] ans = 0 for i, s in enumerate(eval(input())): if s == "\\": li1.append(i) elif s == "/" and li1: j = li1.pop() c = i - j ans += c while li2 and li2[-1][0] > j: c += li2[-1][1] li2.pop() li2.append((j, c)) print(ans) if li2...
false
9.090909
[ "-import sys", "-", "-readline = sys.stdin.readline", "-li = []", "-for i, s in enumerate(readline().strip()):", "+li1 = []", "+li2 = []", "+ans = 0", "+for i, s in enumerate(eval(input())):", "- li.append([i, 0])", "- elif s == \"/\":", "- if li:", "- if li[-1][1...
false
0.08234
0.037106
2.219026
[ "s272673233", "s111451490" ]
u150984829
p02396
python
s417408835
s357707770
70
50
6,260
5,672
Accepted
Accepted
28.57
newArray = [] x = eval(input()) while x != "0": newArray.append(x) x = eval(input()) for i in range(len(newArray)): print(("Case " + str(i + 1) + ": " + newArray[i]))
import sys i=1 for a in sys.stdin: a=a.strip() if'0'==a:break print(f'Case {i}: {a}') i+=1
10
7
183
100
newArray = [] x = eval(input()) while x != "0": newArray.append(x) x = eval(input()) for i in range(len(newArray)): print(("Case " + str(i + 1) + ": " + newArray[i]))
import sys i = 1 for a in sys.stdin: a = a.strip() if "0" == a: break print(f"Case {i}: {a}") i += 1
false
30
[ "-newArray = []", "-x = eval(input())", "-while x != \"0\":", "- newArray.append(x)", "- x = eval(input())", "-for i in range(len(newArray)):", "- print((\"Case \" + str(i + 1) + \": \" + newArray[i]))", "+import sys", "+", "+i = 1", "+for a in sys.stdin:", "+ a = a.strip()", "+ ...
false
0.040005
0.039528
1.012043
[ "s417408835", "s357707770" ]
u794544096
p02724
python
s396174566
s086712370
164
19
38,384
2,940
Accepted
Accepted
88.41
x = int(eval(input())) y500 = x // 500 y5 = (x % 500) // 5 print((y500 * 1000 + y5*5))
x = int(eval(input())) coin_500 = x // 500 coin_5 = (x-coin_500*500) // 5 print((coin_500 * 1000 + coin_5 * 5))
6
6
85
110
x = int(eval(input())) y500 = x // 500 y5 = (x % 500) // 5 print((y500 * 1000 + y5 * 5))
x = int(eval(input())) coin_500 = x // 500 coin_5 = (x - coin_500 * 500) // 5 print((coin_500 * 1000 + coin_5 * 5))
false
0
[ "-y500 = x // 500", "-y5 = (x % 500) // 5", "-print((y500 * 1000 + y5 * 5))", "+coin_500 = x // 500", "+coin_5 = (x - coin_500 * 500) // 5", "+print((coin_500 * 1000 + coin_5 * 5))" ]
false
0.047981
0.046981
1.021291
[ "s396174566", "s086712370" ]
u667189155
p02923
python
s180698008
s056078697
89
80
14,224
14,252
Accepted
Accepted
10.11
n = int(eval(input())) h = list(map(int, input().split())) out, cnt = 0, 0 for i in range(n-1): if h[i] >= h[i+1]: cnt += 1 out = max(out, cnt) else: cnt = 0 print(out)
n = int(eval(input())) h = list(map(int, input().split())) cnt = 0 result = 0 for i in range(n-1): if h[i] - h[i+1] >= 0: cnt += 1 else: result = max(cnt, result) cnt = 0 result = max(cnt, result) print(result)
12
15
208
253
n = int(eval(input())) h = list(map(int, input().split())) out, cnt = 0, 0 for i in range(n - 1): if h[i] >= h[i + 1]: cnt += 1 out = max(out, cnt) else: cnt = 0 print(out)
n = int(eval(input())) h = list(map(int, input().split())) cnt = 0 result = 0 for i in range(n - 1): if h[i] - h[i + 1] >= 0: cnt += 1 else: result = max(cnt, result) cnt = 0 result = max(cnt, result) print(result)
false
20
[ "-out, cnt = 0, 0", "+cnt = 0", "+result = 0", "- if h[i] >= h[i + 1]:", "+ if h[i] - h[i + 1] >= 0:", "- out = max(out, cnt)", "+ result = max(cnt, result)", "-print(out)", "+result = max(cnt, result)", "+print(result)" ]
false
0.039188
0.037745
1.038216
[ "s180698008", "s056078697" ]
u079022693
p02837
python
s817817911
s714735493
400
163
45,404
3,064
Accepted
Accepted
59.25
N=int(eval(input())) A=[] X=list() for i in range(N): X.append([]) Y=list() for i in range(N): Y.append([]) for i in range(N): A_i=int(eval(input())) A.append(A_i) for j in range(A_i): x,y=list(map(int,input().split())) X[i].append(x) Y[i].append(y) max_nin=0 #bi...
from sys import stdin def main(): #入力 readline=stdin.readline n=int(readline()) shogen=[] nums=[] for i in range(n): a=int(readline()) nums.append(a) xy=[0]*a for j in range(a): xy[j]=list(map(int,readline().split())) shogen.append...
47
48
949
1,201
N = int(eval(input())) A = [] X = list() for i in range(N): X.append([]) Y = list() for i in range(N): Y.append([]) for i in range(N): A_i = int(eval(input())) A.append(A_i) for j in range(A_i): x, y = list(map(int, input().split())) X[i].append(x) Y[i].append(y) max_nin = 0 ...
from sys import stdin def main(): # 入力 readline = stdin.readline n = int(readline()) shogen = [] nums = [] for i in range(n): a = int(readline()) nums.append(a) xy = [0] * a for j in range(a): xy[j] = list(map(int, readline().split())) shogen...
false
2.083333
[ "-N = int(eval(input()))", "-A = []", "-X = list()", "-for i in range(N):", "- X.append([])", "-Y = list()", "-for i in range(N):", "- Y.append([])", "-for i in range(N):", "- A_i = int(eval(input()))", "- A.append(A_i)", "- for j in range(A_i):", "- x, y = list(map(int...
false
0.03134
0.031338
1.000055
[ "s817817911", "s714735493" ]
u332906195
p02861
python
s669343860
s410433411
473
17
3,064
3,060
Accepted
Accepted
96.41
import itertools import math N = int(eval(input())) P = [tuple(map(int, input().split())) for _ in range(N)] ans = 0 for perm in itertools.permutations([i for i in range(N)]): for i in range(N - 1): ans += ((P[perm[i]][0] - P[perm[i+1]][0]) ** 2 + (P[perm[i]][1] - P[perm[i+1]][1]...
N = int(eval(input())) P = [tuple(map(int, input().split())) for _ in range(N)] ans = 0 for i in range(N): for j in range(i + 1, N): ans += ((P[i][0] - P[j][0]) ** 2 + (P[i][1] - P[j][1]) ** 2) ** 0.5 print((2 * ans / N))
13
8
363
234
import itertools import math N = int(eval(input())) P = [tuple(map(int, input().split())) for _ in range(N)] ans = 0 for perm in itertools.permutations([i for i in range(N)]): for i in range(N - 1): ans += ( (P[perm[i]][0] - P[perm[i + 1]][0]) ** 2 + (P[perm[i]][1] - P[perm[i + 1]][...
N = int(eval(input())) P = [tuple(map(int, input().split())) for _ in range(N)] ans = 0 for i in range(N): for j in range(i + 1, N): ans += ((P[i][0] - P[j][0]) ** 2 + (P[i][1] - P[j][1]) ** 2) ** 0.5 print((2 * ans / N))
false
38.461538
[ "-import itertools", "-import math", "-", "-for perm in itertools.permutations([i for i in range(N)]):", "- for i in range(N - 1):", "- ans += (", "- (P[perm[i]][0] - P[perm[i + 1]][0]) ** 2", "- + (P[perm[i]][1] - P[perm[i + 1]][1]) ** 2", "- ) ** 0.5", "-pr...
false
0.112582
0.038353
2.935393
[ "s669343860", "s410433411" ]
u768896740
p03127
python
s443384561
s422847046
1,577
80
14,224
16,304
Accepted
Accepted
94.93
n = int(eval(input())) l = list(map(int, input().split())) hp = max(l) l.sort() while hp > 1 and len(l) != 1: a = l[0] for i in range(1, len(l)): l[i] %= a l.sort() while l[0] == 0: l.remove(0) if l[0] < hp: hp = l[0] print(hp)
import fractions from functools import reduce def gcd(*numbers): return reduce(fractions.gcd, numbers) def gcd_list(numbers): return reduce(fractions.gcd, numbers) n = int(eval(input())) x = list(map(int, input().split())) print((gcd_list(x)))
18
13
286
259
n = int(eval(input())) l = list(map(int, input().split())) hp = max(l) l.sort() while hp > 1 and len(l) != 1: a = l[0] for i in range(1, len(l)): l[i] %= a l.sort() while l[0] == 0: l.remove(0) if l[0] < hp: hp = l[0] print(hp)
import fractions from functools import reduce def gcd(*numbers): return reduce(fractions.gcd, numbers) def gcd_list(numbers): return reduce(fractions.gcd, numbers) n = int(eval(input())) x = list(map(int, input().split())) print((gcd_list(x)))
false
27.777778
[ "+import fractions", "+from functools import reduce", "+", "+", "+def gcd(*numbers):", "+ return reduce(fractions.gcd, numbers)", "+", "+", "+def gcd_list(numbers):", "+ return reduce(fractions.gcd, numbers)", "+", "+", "-l = list(map(int, input().split()))", "-hp = max(l)", "-l.so...
false
0.042015
0.046634
0.900945
[ "s443384561", "s422847046" ]
u057109575
p02960
python
s732315823
s095322735
745
315
62,044
88,420
Accepted
Accepted
57.72
S = eval(input()) MOD = 10 ** 9 + 7 MAX_LEN = len(S) dp = [[0] * 13 for _ in range(MAX_LEN + 1)] dp[0][0] = 1 for i in range(MAX_LEN): c = int(S[i]) if S[i] != '?' else -1 for j in range(10): if c != -1 and c != j: continue for k in range(13): idx...
S = eval(input()) dp = [[0] * 13 for _ in range(len(S) + 1)] dp[0][0] = 1 mod = 10 ** 9 + 7 for i in range(len(S)): for j in range(13): if S[i] == "?": for k in range(10): x = (j * 10 + k) % 13 dp[i + 1][x] += dp[i][j] dp[i + 1][x] %= m...
20
18
440
478
S = eval(input()) MOD = 10**9 + 7 MAX_LEN = len(S) dp = [[0] * 13 for _ in range(MAX_LEN + 1)] dp[0][0] = 1 for i in range(MAX_LEN): c = int(S[i]) if S[i] != "?" else -1 for j in range(10): if c != -1 and c != j: continue for k in range(13): idx = (k * 10 + j) % 13 ...
S = eval(input()) dp = [[0] * 13 for _ in range(len(S) + 1)] dp[0][0] = 1 mod = 10**9 + 7 for i in range(len(S)): for j in range(13): if S[i] == "?": for k in range(10): x = (j * 10 + k) % 13 dp[i + 1][x] += dp[i][j] dp[i + 1][x] %= mod els...
false
10
[ "-MOD = 10**9 + 7", "-MAX_LEN = len(S)", "-dp = [[0] * 13 for _ in range(MAX_LEN + 1)]", "+dp = [[0] * 13 for _ in range(len(S) + 1)]", "-for i in range(MAX_LEN):", "- c = int(S[i]) if S[i] != \"?\" else -1", "- for j in range(10):", "- if c != -1 and c != j:", "- continue", ...
false
0.078661
0.076227
1.031925
[ "s732315823", "s095322735" ]
u321035578
p02678
python
s662976175
s112599497
898
617
37,080
36,916
Accepted
Accepted
31.29
import queue def main(): n,m = list(map(int,input().split())) ab = [[] for i in range(n)] for _ in range(m): a,b = list(map(int,input().split())) ab[a-1].append(b-1) ab[b-1].append(a-1) q =queue.Queue() q.put(0) ans = [-1] * n ans[0] = 0 while not q.em...
from collections import deque def main(): n,m = list(map(int,input().split())) ab = [[] for i in range(n)] for _ in range(m): a,b = list(map(int,input().split())) ab[a-1].append(b-1) ab[b-1].append(a-1) q = deque() q.append(0) ans = [-1] * n ans[0] = 0 ...
27
27
600
612
import queue def main(): n, m = list(map(int, input().split())) ab = [[] for i in range(n)] for _ in range(m): a, b = list(map(int, input().split())) ab[a - 1].append(b - 1) ab[b - 1].append(a - 1) q = queue.Queue() q.put(0) ans = [-1] * n ans[0] = 0 while not q...
from collections import deque def main(): n, m = list(map(int, input().split())) ab = [[] for i in range(n)] for _ in range(m): a, b = list(map(int, input().split())) ab[a - 1].append(b - 1) ab[b - 1].append(a - 1) q = deque() q.append(0) ans = [-1] * n ans[0] = 0 ...
false
0
[ "-import queue", "+from collections import deque", "- q = queue.Queue()", "- q.put(0)", "+ q = deque()", "+ q.append(0)", "- while not q.empty():", "- now = q.get()", "+ while len(q) != 0:", "+ now = q.popleft()", "- q.put(next)", "+ ...
false
0.058624
0.059076
0.992341
[ "s662976175", "s112599497" ]
u426534722
p02275
python
s439531941
s101552322
2,190
1,870
224,376
241,460
Accepted
Accepted
14.61
n = int(eval(input())) def CountingSort(A, B, k): C = [0] * (k + 1) for j in range(n): C[A[j]] += 1 C[0] -= 1 for i in range(1, k + 1): C[i] += C[i - 1] for j in A[::-1]: B[C[j]] = j C[j] -= 1 A = list(map(int, input().split())) B = [0] * n CountingSort(A...
n = int(eval(input())) def CountingSort(A, B, k): C = [0] * (k + 1) for j in range(n): C[A[j]] += 1 C[0] -= 1 for i in range(1, k + 1): C[i] += C[i - 1] for j in A[::-1]: B[C[j]] = j C[j] -= 1 A = list(map(int, input().split())) B = [0] * n CountingSort(A...
16
16
340
358
n = int(eval(input())) def CountingSort(A, B, k): C = [0] * (k + 1) for j in range(n): C[A[j]] += 1 C[0] -= 1 for i in range(1, k + 1): C[i] += C[i - 1] for j in A[::-1]: B[C[j]] = j C[j] -= 1 A = list(map(int, input().split())) B = [0] * n CountingSort(A, B, max(...
n = int(eval(input())) def CountingSort(A, B, k): C = [0] * (k + 1) for j in range(n): C[A[j]] += 1 C[0] -= 1 for i in range(1, k + 1): C[i] += C[i - 1] for j in A[::-1]: B[C[j]] = j C[j] -= 1 A = list(map(int, input().split())) B = [0] * n CountingSort(A, B, max(...
false
0
[ "-print((*B))", "+print((\" \".join(map(str, B))))" ]
false
0.113985
0.050769
2.245164
[ "s439531941", "s101552322" ]
u477638578
p02554
python
s189802050
s177812974
390
30
10,904
9,164
Accepted
Accepted
92.31
# # # author : samars_diary # # 16-09-2020 │ 18:28:11 # # # import sys, os.path, math #if(os.path.exists('input.txt')): #sys.stdin = open('input.txt',"r") #sys.stdout = open('output.txt',"w") sys.setrecursionlimit(10 ** 5) def ...
# # # author : samars_diary # # 16-09-2020 │ 18:28:11 # # # import sys, os.path, math #if(os.path.exists('input.txt')): #sys.stdin = open('input.txt',"r") #sys.stdout = open('output.txt',"w") sys.setrecursionlimit(10 ** 5) def ...
27
26
746
765
# # # author : samars_diary # # 16-09-2020 │ 18:28:11 # # # import sys, os.path, math # if(os.path.exists('input.txt')): # sys.stdin = open('input.txt',"r") # sys.stdout = open('output.txt',"w") sys.setrecursionlimit(10**5) def mod(): return 10**9 + 7 ...
# # # author : samars_diary # # 16-09-2020 │ 18:28:11 # # # import sys, os.path, math # if(os.path.exists('input.txt')): # sys.stdin = open('input.txt',"r") # sys.stdout = open('output.txt',"w") sys.setrecursionlimit(10**5) def mod(): return 10**9 + 7 ...
false
3.703704
[ "- print((((10**a) - 2 * (9**a) + (8**a)) % mod()))", "+ print(((pow(10, a, mod()) + pow(8, a, mod()) - 2 * pow(9, a, mod())) % mod()))" ]
false
0.128893
0.036159
3.56462
[ "s189802050", "s177812974" ]
u486251525
p03557
python
s672279477
s670595427
895
325
23,924
22,720
Accepted
Accepted
63.69
N = int(eval(input())) A = sorted(map(int, input().split())) B = sorted(map(int, input().split())) C = sorted(map(int, input().split())) sumSunuke = 0 def bs_left(list, target): low, high = 0, len(list) while low < high: mid = (low + high) // 2 if list[mid] < target: lo...
from bisect import bisect_left, bisect_right N = int(eval(input())) A = sorted(map(int, input().split())) B = sorted(map(int, input().split())) C = sorted(map(int, input().split())) sumSunuke = 0 for x in range(N): ab = bisect_left(A, B[x]) bc = N - bisect_right(C, B[x]) sumSunuke += ab * bc p...
34
13
741
330
N = int(eval(input())) A = sorted(map(int, input().split())) B = sorted(map(int, input().split())) C = sorted(map(int, input().split())) sumSunuke = 0 def bs_left(list, target): low, high = 0, len(list) while low < high: mid = (low + high) // 2 if list[mid] < target: low = mid + 1 ...
from bisect import bisect_left, bisect_right N = int(eval(input())) A = sorted(map(int, input().split())) B = sorted(map(int, input().split())) C = sorted(map(int, input().split())) sumSunuke = 0 for x in range(N): ab = bisect_left(A, B[x]) bc = N - bisect_right(C, B[x]) sumSunuke += ab * bc print(sumSunuk...
false
61.764706
[ "+from bisect import bisect_left, bisect_right", "+", "-", "-", "-def bs_left(list, target):", "- low, high = 0, len(list)", "- while low < high:", "- mid = (low + high) // 2", "- if list[mid] < target:", "- low = mid + 1", "- else:", "- high = ...
false
0.061549
0.076257
0.807119
[ "s672279477", "s670595427" ]
u348805958
p02781
python
s255649454
s854995734
23
18
3,440
3,188
Accepted
Accepted
21.74
#!python3 iim = lambda: list(map(int, input().rstrip().split())) def resolve(): N = list(map(int, eval(input()))) K = int(eval(input())) size = len(N) if size < K: print((0)) return dp = [[[0]*(size+1) for j in range(2)] for i in range(size+1)] dp[0][0][0] =...
#!python3 iim = lambda: list(map(int, input().rstrip().split())) def resolve(): N = list(map(int, eval(input()))) K = int(eval(input())) size = len(N) if size < K: print((0)) return dp = [[[0]*(size+1) for j in range(2)] for i in range(size+1)] dp[0][0][0] =...
37
37
814
824
#!python3 iim = lambda: list(map(int, input().rstrip().split())) def resolve(): N = list(map(int, eval(input()))) K = int(eval(input())) size = len(N) if size < K: print((0)) return dp = [[[0] * (size + 1) for j in range(2)] for i in range(size + 1)] dp[0][0][0] = 1 for i i...
#!python3 iim = lambda: list(map(int, input().rstrip().split())) def resolve(): N = list(map(int, eval(input()))) K = int(eval(input())) size = len(N) if size < K: print((0)) return dp = [[[0] * (size + 1) for j in range(2)] for i in range(size + 1)] dp[0][0][0] = 1 for i i...
false
0
[ "- for k in range(i + 1):", "+ for k in range(min(i + 1, K + 1)):" ]
false
0.077037
0.132345
0.582094
[ "s255649454", "s854995734" ]
u606045429
p02972
python
s952887102
s688073391
339
259
74,204
14,140
Accepted
Accepted
23.6
from sys import stderr N = int(eval(input())) A = [int(i) for i in input().split()] B = [0] * N for i in range(N // 2, N): B[i] = A[i] for i in reversed(list(range(N // 2))): s = sum(B[i::i + 1]) B[i] = (A[i] - s) % 2 ans = [i + 1 for i, b in enumerate(B) if b == 1] print((len(ans))) if a...
N = int(eval(input())) A = [int(i) for i in input().split()] B = [0] * N for i in reversed(list(range(N))): B[i] = (A[i] - sum(B[i::i + 1])) % 2 ans = [i + 1 for i, b in enumerate(B) if b == 1] print((len(ans))) print((*ans))
17
10
326
224
from sys import stderr N = int(eval(input())) A = [int(i) for i in input().split()] B = [0] * N for i in range(N // 2, N): B[i] = A[i] for i in reversed(list(range(N // 2))): s = sum(B[i :: i + 1]) B[i] = (A[i] - s) % 2 ans = [i + 1 for i, b in enumerate(B) if b == 1] print((len(ans))) if ans: print((*...
N = int(eval(input())) A = [int(i) for i in input().split()] B = [0] * N for i in reversed(list(range(N))): B[i] = (A[i] - sum(B[i :: i + 1])) % 2 ans = [i + 1 for i, b in enumerate(B) if b == 1] print((len(ans))) print((*ans))
false
41.176471
[ "-from sys import stderr", "-", "-for i in range(N // 2, N):", "- B[i] = A[i]", "-for i in reversed(list(range(N // 2))):", "- s = sum(B[i :: i + 1])", "- B[i] = (A[i] - s) % 2", "+for i in reversed(list(range(N))):", "+ B[i] = (A[i] - sum(B[i :: i + 1])) % 2", "-if ans:", "- prin...
false
0.038694
0.036144
1.070545
[ "s952887102", "s688073391" ]
u624475441
p03713
python
s792677967
s384941304
328
17
3,064
3,064
Accepted
Accepted
94.82
def calc(H, W, ans): w0 = W // 2 w1 = W - w0 for h0 in range(1, H): Sa = h0 * W h1 = H - h0 h2 = h1 // 2 h3 = h1 - h2 Sb1, Sc1 = h1 * w0, h1 * w1 Sb2, Sc2 = h2 * W, h3 * W m1, _, M1 = sorted([Sa, Sb1, Sc1]) m2, _, M2 = sorted([Sa, Sb...
h, w = list(map(int, input().split())) if h % 3 == 0 or w % 3 == 0: print((0)) else: a = (h // 3 + 1) * w - (h - 1 - h // 3) * (w // 2) b = (h - h // 3) * (w - w // 2) - h // 3 * w c = min(h, w) h, w = w, h d = (h // 3 + 1) * w - (h - 1 - h // 3) * (w // 2) e = (h - h // 3) * (w - w...
17
11
460
362
def calc(H, W, ans): w0 = W // 2 w1 = W - w0 for h0 in range(1, H): Sa = h0 * W h1 = H - h0 h2 = h1 // 2 h3 = h1 - h2 Sb1, Sc1 = h1 * w0, h1 * w1 Sb2, Sc2 = h2 * W, h3 * W m1, _, M1 = sorted([Sa, Sb1, Sc1]) m2, _, M2 = sorted([Sa, Sb2, Sc2]) ...
h, w = list(map(int, input().split())) if h % 3 == 0 or w % 3 == 0: print((0)) else: a = (h // 3 + 1) * w - (h - 1 - h // 3) * (w // 2) b = (h - h // 3) * (w - w // 2) - h // 3 * w c = min(h, w) h, w = w, h d = (h // 3 + 1) * w - (h - 1 - h // 3) * (w // 2) e = (h - h // 3) * (w - w // 2) - ...
false
35.294118
[ "-def calc(H, W, ans):", "- w0 = W // 2", "- w1 = W - w0", "- for h0 in range(1, H):", "- Sa = h0 * W", "- h1 = H - h0", "- h2 = h1 // 2", "- h3 = h1 - h2", "- Sb1, Sc1 = h1 * w0, h1 * w1", "- Sb2, Sc2 = h2 * W, h3 * W", "- m1, _, M1 = so...
false
0.142676
0.036272
3.933475
[ "s792677967", "s384941304" ]
u167931717
p03087
python
s855566035
s512300311
601
525
55,316
19,444
Accepted
Accepted
12.65
############################################################################### from bisect import bisect_left as binl def intin(): input_tuple = input().split() if len(input_tuple) <= 1: return int(input_tuple[0]) return list(map(int, input_tuple)) def intina(): return [int(i) f...
############################################################################### from bisect import bisect_left as binl def intin(): input_tuple = input().split() if len(input_tuple) <= 1: return int(input_tuple[0]) return tuple(map(int, input_tuple)) def intina(): return [int(i) ...
51
60
1,046
1,142
############################################################################### from bisect import bisect_left as binl def intin(): input_tuple = input().split() if len(input_tuple) <= 1: return int(input_tuple[0]) return list(map(int, input_tuple)) def intina(): return [int(i) for i in inpu...
############################################################################### from bisect import bisect_left as binl def intin(): input_tuple = input().split() if len(input_tuple) <= 1: return int(input_tuple[0]) return tuple(map(int, input_tuple)) def intina(): return [int(i) for i in inp...
false
15
[ "- return list(map(int, input_tuple))", "+ return tuple(map(int, input_tuple))", "+", "+", "+def modadd(x, y):", "+ global mod", "+ return (x + y) % mod", "+", "+", "+def modmlt(x, y):", "+ global mod", "+ return (x * sy) % mod", "- lrlist = [(l, r) for l, r in lrlist]" ...
false
0.069175
0.045119
1.533178
[ "s855566035", "s512300311" ]
u459150945
p02786
python
s608880163
s598948586
19
17
3,060
2,940
Accepted
Accepted
10.53
H = int(eval(input())) if H == 1: print((1)) else: cnt = 0 while H > 3: H = H//2 cnt += 1 ans = 0 for i in range(cnt): ans += 2**i print((int(((2**cnt)*3)+ans)))
H = int(eval(input())) def f(H): if H == 1: return 1 else: return f(H//2) * 2 + 1 print((f(H)))
12
10
210
124
H = int(eval(input())) if H == 1: print((1)) else: cnt = 0 while H > 3: H = H // 2 cnt += 1 ans = 0 for i in range(cnt): ans += 2**i print((int(((2**cnt) * 3) + ans)))
H = int(eval(input())) def f(H): if H == 1: return 1 else: return f(H // 2) * 2 + 1 print((f(H)))
false
16.666667
[ "-if H == 1:", "- print((1))", "-else:", "- cnt = 0", "- while H > 3:", "- H = H // 2", "- cnt += 1", "- ans = 0", "- for i in range(cnt):", "- ans += 2**i", "- print((int(((2**cnt) * 3) + ans)))", "+", "+", "+def f(H):", "+ if H == 1:", "+ ...
false
0.062263
0.050613
1.23017
[ "s608880163", "s598948586" ]
u981931040
p03145
python
s495652616
s389227617
19
17
3,064
2,940
Accepted
Accepted
10.53
A , B , _ = list(map(int,input().split())) print((A * B // 2))
ab, bc ,_ = list(map(int,input().split())) print((ab * bc // 2))
2
2
55
57
A, B, _ = list(map(int, input().split())) print((A * B // 2))
ab, bc, _ = list(map(int, input().split())) print((ab * bc // 2))
false
0
[ "-A, B, _ = list(map(int, input().split()))", "-print((A * B // 2))", "+ab, bc, _ = list(map(int, input().split()))", "+print((ab * bc // 2))" ]
false
0.139037
0.044984
3.090828
[ "s495652616", "s389227617" ]
u691018832
p03221
python
s916078530
s105219383
1,185
749
66,524
33,428
Accepted
Accepted
36.79
import sys input = sys.stdin.readline def binary_search(list, item): low = 0 high = len(list) - 1 while low <= high: mid = (low + high) // 2 guess = list[mid] if guess == item: return mid if guess > item: high = mid - 1 else: ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from bisect import bisect_left n, m = list(map(int, readline().split())) py = [list(map(int, readline().split())) for _ in range(m)] check = sorted(py) idx = [0...
37
21
819
579
import sys input = sys.stdin.readline def binary_search(list, item): low = 0 high = len(list) - 1 while low <= high: mid = (low + high) // 2 guess = list[mid] if guess == item: return mid if guess > item: high = mid - 1 else: low...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) from bisect import bisect_left n, m = list(map(int, readline().split())) py = [list(map(int, readline().split())) for _ in range(m)] check = sorted(py) idx = [0] * (n + 1) m...
false
43.243243
[ "-input = sys.stdin.readline", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "+sys.setrecursionlimit(10**7)", "+from bisect import bisect_left", "-", "-def binary_search(list, item):", "- low = 0", "- high = len(list) - 1...
false
0.095668
0.040629
2.354692
[ "s916078530", "s105219383" ]
u353797797
p03003
python
s182862905
s778562238
1,622
1,449
159,520
3,316
Accepted
Accepted
10.67
def f(n, m): s = list(map(int,input().split())) t = list(map(int,input().split())) dp = [[1] * (m + 1) for _ in range(n + 1)] for i, sk in enumerate(s): dpi1 = dp[i + 1] = dp[i][:] cs = 0 for j, tk in enumerate(t): if sk == tk: cs = (cs + dp[i...
def f(n, m): s = list(map(int,input().split())) t = list(map(int,input().split())) dpi = [1] * (m + 1) for i, sk in enumerate(s): dpi1 = dpi[:] cs = 0 for j, tk in enumerate(t): if sk == tk: cs = (cs + dpi[j]) % md dpi1[j + 1] = (...
18
19
507
484
def f(n, m): s = list(map(int, input().split())) t = list(map(int, input().split())) dp = [[1] * (m + 1) for _ in range(n + 1)] for i, sk in enumerate(s): dpi1 = dp[i + 1] = dp[i][:] cs = 0 for j, tk in enumerate(t): if sk == tk: cs = (cs + dp[i][j]) %...
def f(n, m): s = list(map(int, input().split())) t = list(map(int, input().split())) dpi = [1] * (m + 1) for i, sk in enumerate(s): dpi1 = dpi[:] cs = 0 for j, tk in enumerate(t): if sk == tk: cs = (cs + dpi[j]) % md dpi1[j + 1] = (dpi1[j +...
false
5.263158
[ "- dp = [[1] * (m + 1) for _ in range(n + 1)]", "+ dpi = [1] * (m + 1)", "- dpi1 = dp[i + 1] = dp[i][:]", "+ dpi1 = dpi[:]", "- cs = (cs + dp[i][j]) % md", "+ cs = (cs + dpi[j]) % md", "+ dpi = dpi1", "- print((dp[-1][-1]))", "+ print((d...
false
0.038324
0.086451
0.443306
[ "s182862905", "s778562238" ]
u188827677
p02947
python
s058713210
s334025423
368
337
23,464
19,476
Accepted
Accepted
8.42
import collections n = int(eval(input())) s = ["".join(sorted(eval(input()))) for _ in range(n)] c = collections.Counter(s) ans = 0 for i in set(s): x = c[i] ans += x * (x -1)//2 print(ans)
n = int(eval(input())) s = [eval(input()) for _ in range(n)] for i in range(n): s[i] = ''.join(sorted(s[i])) t = {} for i in range(n): if s[i] in t: t[s[i]] += 1 else: t[s[i]] = 1 print((sum(t[k] * (t[k] -1) // 2 for k in t)))
12
11
195
236
import collections n = int(eval(input())) s = ["".join(sorted(eval(input()))) for _ in range(n)] c = collections.Counter(s) ans = 0 for i in set(s): x = c[i] ans += x * (x - 1) // 2 print(ans)
n = int(eval(input())) s = [eval(input()) for _ in range(n)] for i in range(n): s[i] = "".join(sorted(s[i])) t = {} for i in range(n): if s[i] in t: t[s[i]] += 1 else: t[s[i]] = 1 print((sum(t[k] * (t[k] - 1) // 2 for k in t)))
false
8.333333
[ "-import collections", "-", "-s = [\"\".join(sorted(eval(input()))) for _ in range(n)]", "-c = collections.Counter(s)", "-ans = 0", "-for i in set(s):", "- x = c[i]", "- ans += x * (x - 1) // 2", "-print(ans)", "+s = [eval(input()) for _ in range(n)]", "+for i in range(n):", "+ s[i] =...
false
0.045505
0.118988
0.382434
[ "s058713210", "s334025423" ]
u708255304
p03037
python
s454356851
s148369466
410
321
8,876
3,060
Accepted
Accepted
21.71
N, M = list(map(int, input().split())) imos = [0]*(N+1) for _ in range(M): # ゲートの情報が入ってくる l, r = [int(x)-1 for x in input().split()] imos[l] += 1 imos[r+1] -= 1 # rまでは有効であり、r+1以降が無向になる仕様であるのでr+1をデクリメントする cumulative = [imos[0]] for value in imos[1:]: cumulative.append(cumulative[-1]+value...
N, M = list(map(int, input().split())) left = -1 right = 10**10 for _ in range(M): l, r = list(map(int, input().split())) left = max(left, l) right = min(right, r) print((max(right-left+1, 0)))
16
10
398
203
N, M = list(map(int, input().split())) imos = [0] * (N + 1) for _ in range(M): # ゲートの情報が入ってくる l, r = [int(x) - 1 for x in input().split()] imos[l] += 1 imos[r + 1] -= 1 # rまでは有効であり、r+1以降が無向になる仕様であるのでr+1をデクリメントする cumulative = [imos[0]] for value in imos[1:]: cumulative.append(cumulative[-1] + value)...
N, M = list(map(int, input().split())) left = -1 right = 10**10 for _ in range(M): l, r = list(map(int, input().split())) left = max(left, l) right = min(right, r) print((max(right - left + 1, 0)))
false
37.5
[ "-imos = [0] * (N + 1)", "+left = -1", "+right = 10**10", "- # ゲートの情報が入ってくる", "- l, r = [int(x) - 1 for x in input().split()]", "- imos[l] += 1", "- imos[r + 1] -= 1 # rまでは有効であり、r+1以降が無向になる仕様であるのでr+1をデクリメントする", "-cumulative = [imos[0]]", "-for value in imos[1:]:", "- cumulative.app...
false
0.087291
0.070004
1.246931
[ "s454356851", "s148369466" ]
u277802731
p03610
python
s822454953
s743771556
35
17
3,572
3,188
Accepted
Accepted
51.43
#72b s = eval(input()) ans=[] for i in range(len(s)): if i%2==0: ans.append(s[i]) print((''.join(ans)))
s = eval(input()) print((s[::2]))
7
2
113
26
# 72b s = eval(input()) ans = [] for i in range(len(s)): if i % 2 == 0: ans.append(s[i]) print(("".join(ans)))
s = eval(input()) print((s[::2]))
false
71.428571
[ "-# 72b", "-ans = []", "-for i in range(len(s)):", "- if i % 2 == 0:", "- ans.append(s[i])", "-print((\"\".join(ans)))", "+print((s[::2]))" ]
false
0.045273
0.04009
1.129308
[ "s822454953", "s743771556" ]
u227082700
p02848
python
s770536693
s388010447
25
19
3,316
3,060
Accepted
Accepted
24
n=int(eval(input())) s=eval(input()) t=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ"*2) a="" for i in s:a+=t[t.index(i)+n] print(a)
t="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" n=int(eval(input())) print(("".join([t[t.index(i)+n]for i in eval(input())])))
6
3
112
123
n = int(eval(input())) s = eval(input()) t = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ" * 2) a = "" for i in s: a += t[t.index(i) + n] print(a)
t = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" n = int(eval(input())) print(("".join([t[t.index(i) + n] for i in eval(input())])))
false
50
[ "+t = \"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ\"", "-s = eval(input())", "-t = list(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" * 2)", "-a = \"\"", "-for i in s:", "- a += t[t.index(i) + n]", "-print(a)", "+print((\"\".join([t[t.index(i) + n] for i in eval(input())])))" ]
false
0.038738
0.038463
1.007149
[ "s770536693", "s388010447" ]
u982594421
p02820
python
s209725451
s541793234
1,116
803
4,084
4,084
Accepted
Accepted
28.05
n, k = list(map(int, input().split())) r, s, p = list(map(int, input().split())) t = eval(input()) h = [''] * n c = {'r': 'p', 's': 'r', 'p': 's'} points = 0 for i, ti in enumerate(t): ci = c[ti] if i < k or h[i - k] != c[ti]: h[i] = ci points += eval(ci) else: p1, p2...
n, k = list(map(int, input().split())) r, s, p = list(map(int, input().split())) t = eval(input()) h = [''] * n c = {'r': 'p', 's': 'r', 'p': 's'} points = 0 for i, ti in enumerate(t): ci = c[ti] if i < k or h[i - k] != c[ti]: h[i] = ci points += eval(ci) else: # p1, ...
24
24
484
492
n, k = list(map(int, input().split())) r, s, p = list(map(int, input().split())) t = eval(input()) h = [""] * n c = {"r": "p", "s": "r", "p": "s"} points = 0 for i, ti in enumerate(t): ci = c[ti] if i < k or h[i - k] != c[ti]: h[i] = ci points += eval(ci) else: p1, p2 = eval(ci), eva...
n, k = list(map(int, input().split())) r, s, p = list(map(int, input().split())) t = eval(input()) h = [""] * n c = {"r": "p", "s": "r", "p": "s"} points = 0 for i, ti in enumerate(t): ci = c[ti] if i < k or h[i - k] != c[ti]: h[i] = ci points += eval(ci) else: # p1, p2 = eval(ci), e...
false
0
[ "- p1, p2 = eval(ci), eval(h[i - k])", "- if p1 > p2:", "- h[i] = ci", "- points -= p2", "- points += p1", "- else:", "- h[i] = \"*\"", "+ # p1, p2 = eval(ci), eval(h[i - k])", "+ # if p1 > p2:", "+ # h[i] = ...
false
0.042814
0.072133
0.593552
[ "s209725451", "s541793234" ]
u763881112
p03486
python
s994873457
s253144343
291
151
20,872
14,408
Accepted
Accepted
48.11
import numpy as np s=sorted(eval(input())) t=sorted(eval(input())) t.reverse() print(("Yes" if(s<t) else "No"))
import numpy as np s="".join(sorted(eval(input()))) t="".join(sorted(eval(input()),reverse=True)) if(s<t): print("Yes") else: print("No")
10
11
112
147
import numpy as np s = sorted(eval(input())) t = sorted(eval(input())) t.reverse() print(("Yes" if (s < t) else "No"))
import numpy as np s = "".join(sorted(eval(input()))) t = "".join(sorted(eval(input()), reverse=True)) if s < t: print("Yes") else: print("No")
false
9.090909
[ "-s = sorted(eval(input()))", "-t = sorted(eval(input()))", "-t.reverse()", "-print((\"Yes\" if (s < t) else \"No\"))", "+s = \"\".join(sorted(eval(input())))", "+t = \"\".join(sorted(eval(input()), reverse=True))", "+if s < t:", "+ print(\"Yes\")", "+else:", "+ print(\"No\")" ]
false
0.041401
0.042363
0.977291
[ "s994873457", "s253144343" ]
u814171899
p03305
python
s669542717
s446895697
1,981
1,593
99,688
94,660
Accepted
Accepted
19.59
from collections import defaultdict from itertools import accumulate import heapq n,m,s,t=list(map(int, input().split())) s-=1 t-=1 yen={} snk={} adj=defaultdict(list) for _ in range(m): u,v,a,b=list(map(int, input().split())) u-=1 v-=1 adj[u].append(v) adj[v].append(u) ye...
from itertools import accumulate import heapq n,m,s,t=list(map(int, input().split())) s-=1 t-=1 yen=[{} for _ in range(n)] snk=[{} for _ in range(n)] for _ in range(m): u,v,a,b=list(map(int, input().split())) u-=1 v-=1 yen[u][v]=a yen[v][u]=a snk[u][v]=b snk[v][u]=b ...
40
36
890
821
from collections import defaultdict from itertools import accumulate import heapq n, m, s, t = list(map(int, input().split())) s -= 1 t -= 1 yen = {} snk = {} adj = defaultdict(list) for _ in range(m): u, v, a, b = list(map(int, input().split())) u -= 1 v -= 1 adj[u].append(v) adj[v].append(u) ...
from itertools import accumulate import heapq n, m, s, t = list(map(int, input().split())) s -= 1 t -= 1 yen = [{} for _ in range(n)] snk = [{} for _ in range(n)] for _ in range(m): u, v, a, b = list(map(int, input().split())) u -= 1 v -= 1 yen[u][v] = a yen[v][u] = a snk[u][v] = b snk[v][u...
false
10
[ "-from collections import defaultdict", "-yen = {}", "-snk = {}", "-adj = defaultdict(list)", "+yen = [{} for _ in range(n)]", "+snk = [{} for _ in range(n)]", "- adj[u].append(v)", "- adj[v].append(u)", "- yen[u, v] = a", "- yen[v, u] = a", "- snk[u, v] = b", "- snk[v, u] = ...
false
0.10881
0.094664
1.149433
[ "s669542717", "s446895697" ]
u133936772
p04013
python
s427893576
s455010164
164
27
5,620
3,188
Accepted
Accepted
83.54
f=lambda:list(map(int,input().split())) n,a=f() l=[i-a for i in f()] dp=[[0]*5000 for _ in range(51)] Z=2500 dp[0][Z]=1 for i in range(n): for s in range(5000-max(l[i],0)): dp[i+1][s]+=dp[i][s] dp[i+1][s+l[i]]+=dp[i][s] print((dp[n][Z]-1))
_,a,*l=list(map(int,open(0).read().split())) d={0:1} for i in l: for k,v in list(d.copy().items()): d[i-a+k]=d.get(i-a+k,0)+v print((d[0]-1))
11
5
251
133
f = lambda: list(map(int, input().split())) n, a = f() l = [i - a for i in f()] dp = [[0] * 5000 for _ in range(51)] Z = 2500 dp[0][Z] = 1 for i in range(n): for s in range(5000 - max(l[i], 0)): dp[i + 1][s] += dp[i][s] dp[i + 1][s + l[i]] += dp[i][s] print((dp[n][Z] - 1))
_, a, *l = list(map(int, open(0).read().split())) d = {0: 1} for i in l: for k, v in list(d.copy().items()): d[i - a + k] = d.get(i - a + k, 0) + v print((d[0] - 1))
false
54.545455
[ "-f = lambda: list(map(int, input().split()))", "-n, a = f()", "-l = [i - a for i in f()]", "-dp = [[0] * 5000 for _ in range(51)]", "-Z = 2500", "-dp[0][Z] = 1", "-for i in range(n):", "- for s in range(5000 - max(l[i], 0)):", "- dp[i + 1][s] += dp[i][s]", "- dp[i + 1][s + l[i]] ...
false
0.057935
0.038404
1.508557
[ "s427893576", "s455010164" ]
u735335967
p03289
python
s308309198
s906043535
20
17
2,940
2,940
Accepted
Accepted
15
s = eval(input()) cnt = 0 if s[0] == "A" and s[2:-1].count("C") == 1: for i in range(len(s)): if ord(s[i])<=90: cnt += 1 if cnt != 2: print("WA") quit() else: print("AC") else: print("WA")
s = eval(input()) cnt = 0 if s[0] == "A" and s[2:-1].count("C") == 1: for i in range(len(s)): if ord(s[i])<=90: cnt += 1 if cnt != 2: print("WA") else: print("AC") else: print("WA")
13
12
255
239
s = eval(input()) cnt = 0 if s[0] == "A" and s[2:-1].count("C") == 1: for i in range(len(s)): if ord(s[i]) <= 90: cnt += 1 if cnt != 2: print("WA") quit() else: print("AC") else: print("WA")
s = eval(input()) cnt = 0 if s[0] == "A" and s[2:-1].count("C") == 1: for i in range(len(s)): if ord(s[i]) <= 90: cnt += 1 if cnt != 2: print("WA") else: print("AC") else: print("WA")
false
7.692308
[ "- quit()" ]
false
0.059999
0.063728
0.941479
[ "s308309198", "s906043535" ]
u670180528
p02863
python
s993260617
s003421564
293
252
42,860
40,176
Accepted
Accepted
13.99
_, t, *L = list(map(int, open(0).read().split())) d = [0] * (t + max(L[::2])) for w, v in sorted((x, y) for x, y in zip(*[iter(L)] * 2)): for i in range(t + w - 1, w - 1, -1): if d[i - w] + v > d[i]: d[i] = d[i - w] + v print((max(d)))
def main(): _, t, *L = list(map(int, open(0).read().split())) d = [0] * (t + max(L[::2])) for w, v in sorted((x, y) for x, y in zip(*[iter(L)] * 2)): for i in range(t + w - 1, w - 1, -1): if d[i - w] + v > d[i]: d[i] = d[i - w] + v print((max(d))) if __name__=="__main__": main() #vs after co...
7
13
240
317
_, t, *L = list(map(int, open(0).read().split())) d = [0] * (t + max(L[::2])) for w, v in sorted((x, y) for x, y in zip(*[iter(L)] * 2)): for i in range(t + w - 1, w - 1, -1): if d[i - w] + v > d[i]: d[i] = d[i - w] + v print((max(d)))
def main(): _, t, *L = list(map(int, open(0).read().split())) d = [0] * (t + max(L[::2])) for w, v in sorted((x, y) for x, y in zip(*[iter(L)] * 2)): for i in range(t + w - 1, w - 1, -1): if d[i - w] + v > d[i]: d[i] = d[i - w] + v print((max(d))) if __name__ == "__...
false
46.153846
[ "-_, t, *L = list(map(int, open(0).read().split()))", "-d = [0] * (t + max(L[::2]))", "-for w, v in sorted((x, y) for x, y in zip(*[iter(L)] * 2)):", "- for i in range(t + w - 1, w - 1, -1):", "- if d[i - w] + v > d[i]:", "- d[i] = d[i - w] + v", "-print((max(d)))", "+def main():"...
false
0.037429
0.075423
0.496259
[ "s993260617", "s003421564" ]
u740284863
p02819
python
s757596413
s639818197
1,161
31
7,192
2,940
Accepted
Accepted
97.33
import math import bisect def eratosthenes(limit): A = [i for i in range(2, limit+1)] P = [] time = 0 while True: prime = min(A) if prime > math.sqrt(limit): break P.append(prime) i = 0 while i < ...
n = int(eval(input())) while True: Flag = True for i in range(2,n): if n % i == 0: Flag = False break if Flag: print(n) exit() n += 1
30
11
622
201
import math import bisect def eratosthenes(limit): A = [i for i in range(2, limit + 1)] P = [] time = 0 while True: prime = min(A) if prime > math.sqrt(limit): break P.append(prime) i = 0 while i < len(A): if A[i] % prime == 0: ...
n = int(eval(input())) while True: Flag = True for i in range(2, n): if n % i == 0: Flag = False break if Flag: print(n) exit() n += 1
false
63.333333
[ "-import math", "-import bisect", "-", "-", "-def eratosthenes(limit):", "- A = [i for i in range(2, limit + 1)]", "- P = []", "- time = 0", "- while True:", "- prime = min(A)", "- if prime > math.sqrt(limit):", "+n = int(eval(input()))", "+while True:", "+ Fla...
false
1.221624
0.031727
38.504723
[ "s757596413", "s639818197" ]
u997641430
p02971
python
s199614172
s054926657
634
526
15,660
14,176
Accepted
Accepted
17.03
n = int(eval(input())) A = [int(eval(input())) for i in range(n)] l = 0 L = [l] for a in A: l = max(l, a) L.append(l) r = 0 R = [r] for a in A[::-1]: r = max(r, a) R.append(r) R.reverse() for i in range(n): print((max(L[i], R[i+1])))
n = int(eval(input())) A = [int(eval(input())) for i in range(n)] A_ = sorted(A, reverse=True) a0, a1 = A_[0], A_[1] for a in A: if a == a0: print(a1) else: print(a0)
18
9
260
187
n = int(eval(input())) A = [int(eval(input())) for i in range(n)] l = 0 L = [l] for a in A: l = max(l, a) L.append(l) r = 0 R = [r] for a in A[::-1]: r = max(r, a) R.append(r) R.reverse() for i in range(n): print((max(L[i], R[i + 1])))
n = int(eval(input())) A = [int(eval(input())) for i in range(n)] A_ = sorted(A, reverse=True) a0, a1 = A_[0], A_[1] for a in A: if a == a0: print(a1) else: print(a0)
false
50
[ "-l = 0", "-L = [l]", "+A_ = sorted(A, reverse=True)", "+a0, a1 = A_[0], A_[1]", "- l = max(l, a)", "- L.append(l)", "-r = 0", "-R = [r]", "-for a in A[::-1]:", "- r = max(r, a)", "- R.append(r)", "-R.reverse()", "-for i in range(n):", "- print((max(L[i], R[i + 1])))", "+ ...
false
0.049981
0.06171
0.809923
[ "s199614172", "s054926657" ]
u969850098
p03137
python
s200937333
s809614641
109
100
13,960
13,964
Accepted
Accepted
8.26
import sys readline = sys.stdin.readline def main(): N, M = list(map(int, readline().rstrip().split())) X = list(map(int, readline().rstrip().split())) if N >= M: print((0)) return X.sort() X = [abs(X[i+1]-X[i]) for i in range(M-1)] X.sort() ans = sum(X) ...
import sys readline = sys.stdin.readline def main(): N, M = list(map(int, readline().rstrip().split())) X = list(map(int, readline().rstrip().split())) if N >= M: print((0)) return X.sort() X = [abs(X[i+1]-X[i]) for i in range(M-1)] X.sort(reverse=True) print...
23
19
423
370
import sys readline = sys.stdin.readline def main(): N, M = list(map(int, readline().rstrip().split())) X = list(map(int, readline().rstrip().split())) if N >= M: print((0)) return X.sort() X = [abs(X[i + 1] - X[i]) for i in range(M - 1)] X.sort() ans = sum(X) for i in...
import sys readline = sys.stdin.readline def main(): N, M = list(map(int, readline().rstrip().split())) X = list(map(int, readline().rstrip().split())) if N >= M: print((0)) return X.sort() X = [abs(X[i + 1] - X[i]) for i in range(M - 1)] X.sort(reverse=True) print((sum(X[...
false
17.391304
[ "- X.sort()", "- ans = sum(X)", "- for i in range(N - 1):", "- ans -= X[-i - 1]", "- print(ans)", "+ X.sort(reverse=True)", "+ print((sum(X[N - 1 :])))" ]
false
0.033051
0.03208
1.030249
[ "s200937333", "s809614641" ]
u893063840
p03700
python
s848283532
s756997784
1,533
1,391
7,120
7,192
Accepted
Accepted
9.26
from math import ceil n, a, b = list(map(int, input().split())) h = [int(eval(input())) for _ in range(n)] def f(x): cnt = 0 for e in h: cnt += max(0, ceil((e - b * x) / (a - b))) if cnt > x: return False return True l = 0 r = 10 ** 9 + 1 while r - l > 1: m...
from math import ceil n, a, b = list(map(int, input().split())) h = [int(eval(input())) for _ in range(n)] def f(x): cnt = 0 for e in h: cnt += max(0, ceil((e - b * x) / (a - b))) if cnt > x: return False return True l = 0 r = ceil(max(h) / b) while r - l > 1: ...
27
27
399
404
from math import ceil n, a, b = list(map(int, input().split())) h = [int(eval(input())) for _ in range(n)] def f(x): cnt = 0 for e in h: cnt += max(0, ceil((e - b * x) / (a - b))) if cnt > x: return False return True l = 0 r = 10**9 + 1 while r - l > 1: mid = (l + r) // 2 if...
from math import ceil n, a, b = list(map(int, input().split())) h = [int(eval(input())) for _ in range(n)] def f(x): cnt = 0 for e in h: cnt += max(0, ceil((e - b * x) / (a - b))) if cnt > x: return False return True l = 0 r = ceil(max(h) / b) while r - l > 1: mid = (l + r) // 2...
false
0
[ "-r = 10**9 + 1", "+r = ceil(max(h) / b)" ]
false
0.11945
0.061501
1.942235
[ "s848283532", "s756997784" ]
u968166680
p03632
python
s467343855
s732982519
29
24
9,028
9,124
Accepted
Accepted
17.24
import sys 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, C, D = list(map(int, readline().split())) if B < C or D < A: ans = 0 elif C > A: if D < B: ...
import sys 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, C, D = list(map(int, readline().split())) lower = max(A, C) upper = min(B, D) ans = max(upper - lower, 0) ...
32
23
542
384
import sys 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, C, D = list(map(int, readline().split())) if B < C or D < A: ans = 0 elif C > A: if D < B: ans = D - C ...
import sys 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, C, D = list(map(int, readline().split())) lower = max(A, C) upper = min(B, D) ans = max(upper - lower, 0) print(ans) ret...
false
28.125
[ "- if B < C or D < A:", "- ans = 0", "- elif C > A:", "- if D < B:", "- ans = D - C", "- else:", "- ans = B - C", "- else:", "- if D < B:", "- ans = D - A", "- else:", "- ans = B - A", "+ lower = max(A...
false
0.042751
0.041025
1.042074
[ "s467343855", "s732982519" ]
u367130284
p03053
python
s150066229
s423118401
716
647
130,908
130,908
Accepted
Accepted
9.64
def main(): from collections import deque import sys;input=sys.stdin.readline h,w=list(map(int,input().split())) grid=[["#"]*(w+2)]+[list("#"+eval(input())+"#")for x in range(h)]+[["#"]*(w+2)] stack=deque() for y in range(1,h+1): for x in range(1,w+1): if grid[y][...
import functools @functools.lru_cache(maxsize=None) def main(): from collections import deque import sys;input=sys.stdin.readline h,w=list(map(int,input().split())) grid=[["#"]*(w+2)]+[list("#"+eval(input())+"#")for x in range(h)]+[["#"]*(w+2)] stack=deque() for y in range(1,h+1): ...
29
33
833
892
def main(): from collections import deque import sys input = sys.stdin.readline h, w = list(map(int, input().split())) grid = ( [["#"] * (w + 2)] + [list("#" + eval(input()) + "#") for x in range(h)] + [["#"] * (w + 2)] ) stack = deque() for y in range(1, h + 1):...
import functools @functools.lru_cache(maxsize=None) def main(): from collections import deque import sys input = sys.stdin.readline h, w = list(map(int, input().split())) grid = ( [["#"] * (w + 2)] + [list("#" + eval(input()) + "#") for x in range(h)] + [["#"] * (w + 2)] ...
false
12.121212
[ "+import functools", "+", "+", "+@functools.lru_cache(maxsize=None)" ]
false
0.115236
0.188046
0.612807
[ "s150066229", "s423118401" ]
u359358631
p02951
python
s603691089
s830023342
73
67
61,652
61,848
Accepted
Accepted
8.22
def main(): A, B, C = list(map(int, input().split())) ans = C - (A - B) print((max(ans, 0))) if __name__ == "__main__": main()
def main(): A, B, C = list(map(int, input().split())) t = min(A - B, C) ans = C - t print(ans) if __name__ == "__main__": main()
10
11
148
157
def main(): A, B, C = list(map(int, input().split())) ans = C - (A - B) print((max(ans, 0))) if __name__ == "__main__": main()
def main(): A, B, C = list(map(int, input().split())) t = min(A - B, C) ans = C - t print(ans) if __name__ == "__main__": main()
false
9.090909
[ "- ans = C - (A - B)", "- print((max(ans, 0)))", "+ t = min(A - B, C)", "+ ans = C - t", "+ print(ans)" ]
false
0.048652
0.048575
1.001592
[ "s603691089", "s830023342" ]
u228232845
p02954
python
s625098610
s905538681
139
97
18,828
10,900
Accepted
Accepted
30.22
from collections import defaultdict import sys def input(): return sys.stdin.readline().strip() def I(): return int(eval(input())) def LI(): return list(map(int, input().split())) def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] ...
# ランレングス圧縮の考え方で解く import sys def input(): return sys.stdin.readline().strip() def I(): return int(eval(input())) def LI(): return list(map(int, input().split())) def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def S(): return ev...
68
55
1,310
1,339
from collections import defaultdict import sys def input(): return sys.stdin.readline().strip() def I(): return int(eval(input())) def LI(): return list(map(int, input().split())) def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return ...
# ランレングス圧縮の考え方で解く import sys def input(): return sys.stdin.readline().strip() def I(): return int(eval(input())) def LI(): return list(map(int, input().split())) def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in rang...
false
19.117647
[ "-from collections import defaultdict", "+# ランレングス圧縮の考え方で解く", "+# 初期位置が R の人が最終的にどこに向かうかを考える", "+# 折り返し地点(移動中に訪れる初めての L) までの距離 d と操作回数の偶奇で決まる(今回の操作回数は偶数)", "+# d が奇数のとき 折り返し地点の 1 つ左側", "+# d が偶数のとき 折り返し地点", "+# L も同様に考える", "+# 連続する R と L をそれぞれグループ化することで折り返し地点を管理しやすくなる", "+# ランレングス圧縮と同じ", "-d = def...
false
0.059386
0.080678
0.736089
[ "s625098610", "s905538681" ]
u532966492
p03987
python
s687013582
s735887753
1,127
452
47,448
46,840
Accepted
Accepted
59.89
def main(): n = int(eval(input())) a = list(map(int, input().split())) a = sorted(list(enumerate(a)), key=lambda x: -x[1]) class unionfind(): # size:要素数,tree:unionfind木 def __init__(self, size): # self,要素数 self.size = size self.tree = [i for i in range(...
def main(): n = int(eval(input())) a = list(map(int, input().split())) a = sorted(list(enumerate(a)), key=lambda x: -x[1]) L = [i for i in range(n+2)] # 連結成分のうち一番左のindex R = [i for i in range(n+2)] # 連結成分のうち一番右のindex ans = 0 for i, j in a: # 1-indexなので1ずれる M = R[i+1] # 連結...
63
17
1,735
486
def main(): n = int(eval(input())) a = list(map(int, input().split())) a = sorted(list(enumerate(a)), key=lambda x: -x[1]) class unionfind: # size:要素数,tree:unionfind木 def __init__(self, size): # self,要素数 self.size = size self.tree = [i for i in range(self.size)]...
def main(): n = int(eval(input())) a = list(map(int, input().split())) a = sorted(list(enumerate(a)), key=lambda x: -x[1]) L = [i for i in range(n + 2)] # 連結成分のうち一番左のindex R = [i for i in range(n + 2)] # 連結成分のうち一番右のindex ans = 0 for i, j in a: # 1-indexなので1ずれる M = R[i + 1] # 連結成分...
false
73.015873
[ "-", "- class unionfind:", "- # size:要素数,tree:unionfind木", "- def __init__(self, size): # self,要素数", "- self.size = size", "- self.tree = [i for i in range(self.size)] # root,depth", "-", "- # rootを探す", "- def root(self, index):", "- ...
false
0.196844
0.097329
2.022462
[ "s687013582", "s735887753" ]
u352394527
p02320
python
s189690551
s030508165
4,700
2,180
5,988
5,988
Accepted
Accepted
53.62
def main(): n, w = list(map(int, input().split())) value = [] weight = [] num = [] for _ in range(n): vi, wi, ni = list(map(int, input().split())) value.append(vi) weight.append(wi) num.append(ni) def to_digit(x): acc = 1 ret = [0] while x >= acc: ...
def main(): n, w = list(map(int, input().split())) value = [] weight = [] num = [] for _ in range(n): vi, wi, ni = list(map(int, input().split())) value.append(vi) weight.append(wi) num.append(ni) def summary(x): acc = 1 ret = [0] while x >= acc: r...
40
42
738
770
def main(): n, w = list(map(int, input().split())) value = [] weight = [] num = [] for _ in range(n): vi, wi, ni = list(map(int, input().split())) value.append(vi) weight.append(wi) num.append(ni) def to_digit(x): acc = 1 ret = [0] while x...
def main(): n, w = list(map(int, input().split())) value = [] weight = [] num = [] for _ in range(n): vi, wi, ni = list(map(int, input().split())) value.append(vi) weight.append(wi) num.append(ni) def summary(x): acc = 1 ret = [0] while x ...
false
4.761905
[ "- def to_digit(x):", "+ def summary(x):", "- num = list(map(to_digit, num))", "+ num = list(map(summary, num))", "- dp[j] = max(dp[j], dp[j - wik] + vik)", "+ pre = dp[j - wik] + vik", "+ if dp[j] < pre:", "+ dp[j] = pre" ]
false
0.235836
0.034653
6.805606
[ "s189690551", "s030508165" ]
u888092736
p03262
python
s929649469
s543592719
105
92
16,280
13,040
Accepted
Accepted
12.38
from fractions import gcd N, X = list(map(int, input().split())) X = [X] + list(map(int, input().split())) ans = 0 for i in range(N): ans = gcd(ans, abs(X[i + 1] - X[i])) print(ans)
from fractions import gcd from functools import reduce _, X = list(map(int, input().split())) print((reduce(gcd, (abs(X - i) for i in map(int, input().split())))))
9
5
190
161
from fractions import gcd N, X = list(map(int, input().split())) X = [X] + list(map(int, input().split())) ans = 0 for i in range(N): ans = gcd(ans, abs(X[i + 1] - X[i])) print(ans)
from fractions import gcd from functools import reduce _, X = list(map(int, input().split())) print((reduce(gcd, (abs(X - i) for i in map(int, input().split())))))
false
44.444444
[ "+from functools import reduce", "-N, X = list(map(int, input().split()))", "-X = [X] + list(map(int, input().split()))", "-ans = 0", "-for i in range(N):", "- ans = gcd(ans, abs(X[i + 1] - X[i]))", "-print(ans)", "+_, X = list(map(int, input().split()))", "+print((reduce(gcd, (abs(X - i) for i i...
false
0.057923
0.059865
0.96756
[ "s929649469", "s543592719" ]
u159228113
p02924
python
s795051100
s189356218
168
17
38,256
2,940
Accepted
Accepted
89.88
n = int(eval(input())) print((int(n*(n-1)//2)))
n = int(eval(input())) print((n*(n-1)//2))
2
2
41
35
n = int(eval(input())) print((int(n * (n - 1) // 2)))
n = int(eval(input())) print((n * (n - 1) // 2))
false
0
[ "-print((int(n * (n - 1) // 2)))", "+print((n * (n - 1) // 2))" ]
false
0.066501
0.037226
1.786406
[ "s795051100", "s189356218" ]
u500297289
p03806
python
s043871741
s936332644
731
662
136,412
142,812
Accepted
Accepted
9.44
N, Ma, Mb = list(map(int, input().split())) abc = [list(map(int, input().split())) for _ in range(N)] inf = float('inf') dp = [[[inf] * 401 for _ in range(401)] for _ in range(N + 1)] dp[0][0][0] = 0 for i in range(N): for j in range(401): for k in range(401): dp[i + 1][j][k] = dp[...
N, Ma, Mb = list(map(int, input().split())) abc = [list(map(int, input().split())) for _ in range(N)] inf = float('inf') dp = [[[inf] * 401 for _ in range(401)] for _ in range(N + 1)] dp[0][0][0] = 0 for i in range(N): for j in range(401): for k in range(401): if j - abc[i][0] >= 0...
22
24
665
694
N, Ma, Mb = list(map(int, input().split())) abc = [list(map(int, input().split())) for _ in range(N)] inf = float("inf") dp = [[[inf] * 401 for _ in range(401)] for _ in range(N + 1)] dp[0][0][0] = 0 for i in range(N): for j in range(401): for k in range(401): dp[i + 1][j][k] = dp[i][j][k] ...
N, Ma, Mb = list(map(int, input().split())) abc = [list(map(int, input().split())) for _ in range(N)] inf = float("inf") dp = [[[inf] * 401 for _ in range(401)] for _ in range(N + 1)] dp[0][0][0] = 0 for i in range(N): for j in range(401): for k in range(401): if j - abc[i][0] >= 0 and k - abc[i...
false
8.333333
[ "- dp[i + 1][j][k] = dp[i][j][k]", "- dp[i + 1][j][k], dp[i][j - abc[i][0]][k - abc[i][1]] + abc[i][2]", "+ dp[i][j][k], dp[i][j - abc[i][0]][k - abc[i][1]] + abc[i][2]", "+ else:", "+ dp[i + 1][j][k] = dp[i][j][k]", "- for b in...
false
0.906839
0.7534
1.203663
[ "s043871741", "s936332644" ]
u761320129
p03201
python
s311239761
s153511901
964
809
70,436
56,056
Accepted
Accepted
16.08
from collections import Counter N = int(eval(input())) A = list(map(int,input().split())) ctr = Counter(A) lctr = sorted(list(ctr.items()),reverse=True) ans = 0 for k,_ in lctr: beki = 2**(len(bin(k))-2) a = beki-k if a == k: ans += ctr[k]//2 else: tmp = min(ctr[k], ctr[a...
from collections import Counter N = int(eval(input())) A = list(map(int,input().split())) ctr = Counter(A) sa = sorted(list(ctr.keys()),reverse=True) ans = 0 for a in sa: p = 2**(len(bin(a))-2) rem = p - a if a == rem: v = ctr[a] // 2 else: v = min(ctr[a], ctr[rem]) an...
18
18
371
362
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) ctr = Counter(A) lctr = sorted(list(ctr.items()), reverse=True) ans = 0 for k, _ in lctr: beki = 2 ** (len(bin(k)) - 2) a = beki - k if a == k: ans += ctr[k] // 2 else: tmp = min(ctr[k], ctr[a]) ...
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) ctr = Counter(A) sa = sorted(list(ctr.keys()), reverse=True) ans = 0 for a in sa: p = 2 ** (len(bin(a)) - 2) rem = p - a if a == rem: v = ctr[a] // 2 else: v = min(ctr[a], ctr[rem]) ans += v ...
false
0
[ "-lctr = sorted(list(ctr.items()), reverse=True)", "+sa = sorted(list(ctr.keys()), reverse=True)", "-for k, _ in lctr:", "- beki = 2 ** (len(bin(k)) - 2)", "- a = beki - k", "- if a == k:", "- ans += ctr[k] // 2", "+for a in sa:", "+ p = 2 ** (len(bin(a)) - 2)", "+ rem = p - ...
false
0.036278
0.03753
0.966649
[ "s311239761", "s153511901" ]
u581187895
p02866
python
s141869915
s970261786
143
123
24,404
20,572
Accepted
Accepted
13.99
from collections import Counter def resolve(): MOD = 998244353 N = int(eval(input())) D = list(map(int, input().split())) if D[0] != 0: print((0)) return CNT = Counter(D) if CNT[0] > 1: # 距離0は1個 print((0)) return ans = 1 for i in rang...
def resolve(): MOD = 998244353 N = int(eval(input())) D = list(map(int, input().split())) if D[0] != 0: print((0)) return CNT = [0] * N for i in D: CNT[i] += 1 if CNT[0] > 1: print((0)) return ans = 1 for i in range(1, N...
26
28
458
443
from collections import Counter def resolve(): MOD = 998244353 N = int(eval(input())) D = list(map(int, input().split())) if D[0] != 0: print((0)) return CNT = Counter(D) if CNT[0] > 1: # 距離0は1個 print((0)) return ans = 1 for i in range(1, max(D) + 1): ...
def resolve(): MOD = 998244353 N = int(eval(input())) D = list(map(int, input().split())) if D[0] != 0: print((0)) return CNT = [0] * N for i in D: CNT[i] += 1 if CNT[0] > 1: print((0)) return ans = 1 for i in range(1, N): ans *= pow(CN...
false
7.142857
[ "-from collections import Counter", "-", "-", "- CNT = Counter(D)", "- if CNT[0] > 1: # 距離0は1個", "+ CNT = [0] * N", "+ for i in D:", "+ CNT[i] += 1", "+ if CNT[0] > 1:", "- for i in range(1, max(D) + 1):", "+ for i in range(1, N):" ]
false
0.037993
0.041086
0.924729
[ "s141869915", "s970261786" ]
u860002137
p03031
python
s192865342
s784449424
166
44
12,504
9,448
Accepted
Accepted
73.49
import numpy as np from itertools import product N, M = list(map(int, input().split())) switch = [] for i in range(M): switch.append(list(map(int, input().split()))[1:]) p = list(map(int, input().split())) st = list(product([0,1],repeat=N)) ans = 0 for i, s in enumerate(st): tmp = [] ...
from collections import defaultdict n, m = list(map(int, input().split())) s = defaultdict(list) for i in range(1, m + 1): _, *x = list(map(int, input().split())) for j in x: s[j].append(i) p = list(map(int, input().split())) ans = [] for i in range(2**n): tmp = [0] * len(p) ...
29
26
567
554
import numpy as np from itertools import product N, M = list(map(int, input().split())) switch = [] for i in range(M): switch.append(list(map(int, input().split()))[1:]) p = list(map(int, input().split())) st = list(product([0, 1], repeat=N)) ans = 0 for i, s in enumerate(st): tmp = [] for j, sw in enumera...
from collections import defaultdict n, m = list(map(int, input().split())) s = defaultdict(list) for i in range(1, m + 1): _, *x = list(map(int, input().split())) for j in x: s[j].append(i) p = list(map(int, input().split())) ans = [] for i in range(2**n): tmp = [0] * len(p) for j in range(n): ...
false
10.344828
[ "-import numpy as np", "-from itertools import product", "+from collections import defaultdict", "-N, M = list(map(int, input().split()))", "-switch = []", "-for i in range(M):", "- switch.append(list(map(int, input().split()))[1:])", "+n, m = list(map(int, input().split()))", "+s = defaultdict(l...
false
0.068987
0.04385
1.57326
[ "s192865342", "s784449424" ]
u989074104
p03449
python
s938636546
s117480500
148
17
12,428
3,060
Accepted
Accepted
88.51
import numpy as np N=int(eval(input())) num_list=[] while True: try: num_list.append(list(map(int,input().split()))) except: break; sum_list=[] for k in range(N): sum_list.append(sum(num_list[0][0:k+1])+sum(num_list[1][k:N+1])) print((max(sum_list)))
N=int(eval(input())) num_list=[] while True: try: num_list.append(list(map(int,input().split()))) except: break; sum_list=[] for k in range(N): sum_list.append(sum(num_list[0][0:k+1])+sum(num_list[1][k:N+1])) print((max(sum_list)))
16
13
297
273
import numpy as np N = int(eval(input())) num_list = [] while True: try: num_list.append(list(map(int, input().split()))) except: break sum_list = [] for k in range(N): sum_list.append(sum(num_list[0][0 : k + 1]) + sum(num_list[1][k : N + 1])) print((max(sum_list)))
N = int(eval(input())) num_list = [] while True: try: num_list.append(list(map(int, input().split()))) except: break sum_list = [] for k in range(N): sum_list.append(sum(num_list[0][0 : k + 1]) + sum(num_list[1][k : N + 1])) print((max(sum_list)))
false
18.75
[ "-import numpy as np", "-" ]
false
0.061255
0.036828
1.663278
[ "s938636546", "s117480500" ]
u677523557
p03488
python
s875286100
s585703493
829
305
172,168
43,996
Accepted
Accepted
63.21
import sys input = sys.stdin.readline def main(): S = list(eval(input())) X, Y = list(map(int, input().split())) Xs = [] Ys = [] line = True first = True x0, y0 = 0, 0 a = 0 for s in S: if s == 'F': a += 1 else: if first: ...
import sys input = sys.stdin.readline S = input().rstrip() gx, gy = list(map(int, input().split())) L = len(S) XY = [[], []] d = 0 c = 0 begin = True for s in S: if begin and s == "F": gx -= 1 elif s == 'T': begin = False if c > 0: XY[d].append(c) ...
72
48
1,791
878
import sys input = sys.stdin.readline def main(): S = list(eval(input())) X, Y = list(map(int, input().split())) Xs = [] Ys = [] line = True first = True x0, y0 = 0, 0 a = 0 for s in S: if s == "F": a += 1 else: if first: if ...
import sys input = sys.stdin.readline S = input().rstrip() gx, gy = list(map(int, input().split())) L = len(S) XY = [[], []] d = 0 c = 0 begin = True for s in S: if begin and s == "F": gx -= 1 elif s == "T": begin = False if c > 0: XY[d].append(c) d ^= 1 c = ...
false
33.333333
[ "-", "-", "-def main():", "- S = list(eval(input()))", "- X, Y = list(map(int, input().split()))", "- Xs = []", "- Ys = []", "- line = True", "- first = True", "- x0, y0 = 0, 0", "- a = 0", "- for s in S:", "- if s == \"F\":", "- a += 1", "- ...
false
0.040573
0.045762
0.88661
[ "s875286100", "s585703493" ]
u072053884
p02243
python
s792407378
s524921283
960
430
70,532
70,488
Accepted
Accepted
55.21
import sys f_i = sys.stdin n = int(f_i.readline()) adj = [[(int(cost), int(v_n)) for v_n, cost in zip(x.split()[2::2], x.split()[3::2])] for x in f_i] import heapq def dijkstra(): PQ = [(0, 0)] distance = [999900001] * n distance[0] = 0 while PQ: uc = heapq.heappop(PQ...
import sys f_i = sys.stdin n = int(f_i.readline()) adj = [[]] * n for x in f_i: x = list(map(int, x.split())) adj[x[0]] = [c_v for c_v in zip(x[3::2], x[2::2])] import heapq def dijkstra(): PQ = [(0, 0)] isVisited = [False] * n distance = [999900001] * n distance[0] = 0 ...
32
43
644
846
import sys f_i = sys.stdin n = int(f_i.readline()) adj = [ [(int(cost), int(v_n)) for v_n, cost in zip(x.split()[2::2], x.split()[3::2])] for x in f_i ] import heapq def dijkstra(): PQ = [(0, 0)] distance = [999900001] * n distance[0] = 0 while PQ: uc = heapq.heappop(PQ) u = u...
import sys f_i = sys.stdin n = int(f_i.readline()) adj = [[]] * n for x in f_i: x = list(map(int, x.split())) adj[x[0]] = [c_v for c_v in zip(x[3::2], x[2::2])] import heapq def dijkstra(): PQ = [(0, 0)] isVisited = [False] * n distance = [999900001] * n distance[0] = 0 while PQ: ...
false
25.581395
[ "-adj = [", "- [(int(cost), int(v_n)) for v_n, cost in zip(x.split()[2::2], x.split()[3::2])]", "- for x in f_i", "-]", "+adj = [[]] * n", "+for x in f_i:", "+ x = list(map(int, x.split()))", "+ adj[x[0]] = [c_v for c_v in zip(x[3::2], x[2::2])]", "+ isVisited = [False] * n", "+ ...
false
0.046563
0.070039
0.664817
[ "s792407378", "s524921283" ]
u340781749
p02930
python
s744701582
s484553509
93
78
3,952
3,952
Accepted
Accepted
16.13
n = int(eval(input())) for i in range(n): print((*((i ^ j & -(i ^ j)).bit_length() for j in range(i + 1, n))))
n = int(eval(input())) for i in range(n): print((*((i ^ j).bit_length() for j in range(i + 1, n))))
3
3
109
98
n = int(eval(input())) for i in range(n): print((*((i ^ j & -(i ^ j)).bit_length() for j in range(i + 1, n))))
n = int(eval(input())) for i in range(n): print((*((i ^ j).bit_length() for j in range(i + 1, n))))
false
0
[ "- print((*((i ^ j & -(i ^ j)).bit_length() for j in range(i + 1, n))))", "+ print((*((i ^ j).bit_length() for j in range(i + 1, n))))" ]
false
0.037044
0.037398
0.990528
[ "s744701582", "s484553509" ]
u275685840
p03456
python
s900328320
s053884790
28
23
9,412
9,236
Accepted
Accepted
17.86
a, b = list(map(int,input().split())) ab = int(str(a) + str(b)) abroot = str(ab**0.5) if abroot.split(".")[1:][0] == "0": print("Yes") else: print("No")
a, b = list(map(int,input().split())) if str(int(str(a) + str(b))**0.5).split(".")[1:][0] == "0": print("Yes") else: print("No")
7
5
160
134
a, b = list(map(int, input().split())) ab = int(str(a) + str(b)) abroot = str(ab**0.5) if abroot.split(".")[1:][0] == "0": print("Yes") else: print("No")
a, b = list(map(int, input().split())) if str(int(str(a) + str(b)) ** 0.5).split(".")[1:][0] == "0": print("Yes") else: print("No")
false
28.571429
[ "-ab = int(str(a) + str(b))", "-abroot = str(ab**0.5)", "-if abroot.split(\".\")[1:][0] == \"0\":", "+if str(int(str(a) + str(b)) ** 0.5).split(\".\")[1:][0] == \"0\":" ]
false
0.109392
0.048207
2.269209
[ "s900328320", "s053884790" ]
u508732591
p02257
python
s248629750
s927049014
70
60
7,744
7,792
Accepted
Accepted
14.29
def maybe_prime(d,s,n): for a in (2,3,5,7): p = False x = pow(a,d,n) if x==1 or x==n-1: continue for i in range(1,s): x = x*x%n if x==1: return False elif x == n-1: p = True break if n...
def maybe_prime(d,s,n): for a in (2,3,5,7): p = False x = pow(a,d,n) if x==1 or x==n-1: continue for i in range(1,s): x = x*x%n if x==1: return False elif x == n-1: p = True break if n...
31
31
754
754
def maybe_prime(d, s, n): for a in (2, 3, 5, 7): p = False x = pow(a, d, n) if x == 1 or x == n - 1: continue for i in range(1, s): x = x * x % n if x == 1: return False elif x == n - 1: p = True ...
def maybe_prime(d, s, n): for a in (2, 3, 5, 7): p = False x = pow(a, d, n) if x == 1 or x == n - 1: continue for i in range(1, s): x = x * x % n if x == 1: return False elif x == n - 1: p = True ...
false
0
[ "- elif 0 in [n % i for i in range(11, min(n - 1, 50), 2)]:", "+ elif 0 in [n % i for i in range(11, min(n - 1, 30), 2)]:" ]
false
0.048934
0.049131
0.995993
[ "s248629750", "s927049014" ]
u858748695
p02861
python
s384452688
s365725143
280
101
13,848
9,128
Accepted
Accepted
63.93
from itertools import permutations def dfs(p, bit): res = 0 for k in range(n): if bit >> k & 1: continue d = ((x[k] - x[p]) ** 2 + (y[k] - y[p]) ** 2) ** 0.5 res += d + dfs(k, bit | (1 << k)) return res n = int(eval(input())) x = [0] * n y = [0] * n fo...
from math import hypot, factorial def dfs(d, p): if all(used): return d res = 0 for i in range(n): if used[i]: continue used[i] = True res += dfs(d + hypot(x[i] - x[p], y[i] - y[p]), i) used[i] = False return res n = int(eval(input(...
35
31
739
557
from itertools import permutations def dfs(p, bit): res = 0 for k in range(n): if bit >> k & 1: continue d = ((x[k] - x[p]) ** 2 + (y[k] - y[p]) ** 2) ** 0.5 res += d + dfs(k, bit | (1 << k)) return res n = int(eval(input())) x = [0] * n y = [0] * n for i in range(n):...
from math import hypot, factorial def dfs(d, p): if all(used): return d res = 0 for i in range(n): if used[i]: continue used[i] = True res += dfs(d + hypot(x[i] - x[p], y[i] - y[p]), i) used[i] = False return res n = int(eval(input())) x = [0] * n ...
false
11.428571
[ "-from itertools import permutations", "+from math import hypot, factorial", "-def dfs(p, bit):", "+def dfs(d, p):", "+ if all(used):", "+ return d", "- for k in range(n):", "- if bit >> k & 1:", "+ for i in range(n):", "+ if used[i]:", "- d = ((x[k] - x[p]) ...
false
0.041423
0.04246
0.975595
[ "s384452688", "s365725143" ]
u540761833
p03112
python
s039990211
s227714163
1,213
1,070
80,092
76,764
Accepted
Accepted
11.79
import sys import bisect from itertools import product def input(): return sys.stdin.readline().strip() A,B,Q = list(map(int,input().split())) s = [int(eval(input())) for i in range(A)] t = [int(eval(input())) for i in range(B)] stlist = [s,t] ab = [A,B] for i in range(Q): x = int(eval(input())) cand...
import sys import bisect from itertools import product def input(): return sys.stdin.readline().strip() A,B,Q = list(map(int,input().split())) s = [int(eval(input())) for i in range(A)] t = [int(eval(input())) for i in range(B)] stlist = [s,t] ab = [A,B] for i in range(Q): x = int(eval(input())) cand...
31
29
807
757
import sys import bisect from itertools import product def input(): return sys.stdin.readline().strip() A, B, Q = list(map(int, input().split())) s = [int(eval(input())) for i in range(A)] t = [int(eval(input())) for i in range(B)] stlist = [s, t] ab = [A, B] for i in range(Q): x = int(eval(input())) ca...
import sys import bisect from itertools import product def input(): return sys.stdin.readline().strip() A, B, Q = list(map(int, input().split())) s = [int(eval(input())) for i in range(A)] t = [int(eval(input())) for i in range(B)] stlist = [s, t] ab = [A, B] for i in range(Q): x = int(eval(input())) ca...
false
6.451613
[ "- r1 = bisect.bisect_right(st, x)" ]
false
0.032523
0.036794
0.883922
[ "s039990211", "s227714163" ]
u145231176
p02973
python
s799162268
s775753701
447
202
82,444
89,500
Accepted
Accepted
54.81
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
65
70
1,528
1,661
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
false
7.142857
[ "-mod = 998244353", "+mod = 10**9 + 7", "-ans = deque([A[0]])", "-for i in range(1, N):", "- index = bisect_left(ans, A[i])", "- if index == 0:", "- ans.appendleft(A[i])", "- else:", "- ans[index - 1] = A[i]", "-print((len(ans)))", "+", "+", "+def lis(A):", "+ L =...
false
0.044627
0.062483
0.714218
[ "s799162268", "s775753701" ]
u753803401
p02714
python
s579421725
s356475475
1,596
180
69,636
68,060
Accepted
Accepted
88.72
import sys import collections def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 n = int(readline()) s = str(readline().rstrip().decode('utf-8')) c = collections.Counter(list(s)) left = collections.defaultdict(int) cnt = 0 for i in range(n - 2): le...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 n = int(readline()) s = str(readline().rstrip().decode('utf-8')) r = s.count("R") g = s.count("G") b = s.count("B") cnt = r * g * b for i in range(n - 2): for j in range(i + 1, n - 1...
40
23
1,254
532
import sys import collections def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 n = int(readline()) s = str(readline().rstrip().decode("utf-8")) c = collections.Counter(list(s)) left = collections.defaultdict(int) cnt = 0 for i in range(n - 2): left[s[i]] += 1 ...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 n = int(readline()) s = str(readline().rstrip().decode("utf-8")) r = s.count("R") g = s.count("G") b = s.count("B") cnt = r * g * b for i in range(n - 2): for j in range(i + 1, n - 1): ...
false
42.5
[ "-import collections", "- c = collections.Counter(list(s))", "- left = collections.defaultdict(int)", "- cnt = 0", "+ r = s.count(\"R\")", "+ g = s.count(\"G\")", "+ b = s.count(\"B\")", "+ cnt = r * g * b", "- left[s[i]] += 1", "- mid = collections.defaultdict(i...
false
0.071487
0.036685
1.948669
[ "s579421725", "s356475475" ]
u223663729
p03854
python
s757275251
s187519382
93
58
3,188
26,008
Accepted
Accepted
37.63
def main(): s = eval(input()) dream = False erase = False while s: if s.startswith('dream'): s = s[5:] dream = True erase = False elif s.startswith('erase'): s = s[5:] dream = False erase = True elif s.startswith('er') and dream: s = s[2:] ...
# dfs import sys sys.setrecursionlimit(10**6) C = ['dream', 'dreamer', 'erase', 'eraser'] S = eval(input()) L = len(S) def dfs(x, l): if l == L: return True elif l > L: return False match = S[l:l+7] for c in C: if match.find(c) == 0: if dfs(c, l+...
29
24
511
412
def main(): s = eval(input()) dream = False erase = False while s: if s.startswith("dream"): s = s[5:] dream = True erase = False elif s.startswith("erase"): s = s[5:] dream = False erase = True elif s.starts...
# dfs import sys sys.setrecursionlimit(10**6) C = ["dream", "dreamer", "erase", "eraser"] S = eval(input()) L = len(S) def dfs(x, l): if l == L: return True elif l > L: return False match = S[l : l + 7] for c in C: if match.find(c) == 0: if dfs(c, l + len(c)): ...
false
17.241379
[ "-def main():", "- s = eval(input())", "- dream = False", "- erase = False", "- while s:", "- if s.startswith(\"dream\"):", "- s = s[5:]", "- dream = True", "- erase = False", "- elif s.startswith(\"erase\"):", "- s = s[5:]", ...
false
0.036604
0.037088
0.986962
[ "s757275251", "s187519382" ]
u816631826
p03264
python
s841163966
s681000991
19
17
3,064
2,940
Accepted
Accepted
10.53
K=int(eval(input())) a=[] for i in range(1,K+1): a.append(i) counter=0 if K>=2 and K<=100 : for x in range(len(a)): for j in range(x+1,len(a)): if a[x]&1==0 and a[j]&1==1 or a[x]&1==1 and a[j]&1==0: a[x]*a[j]%2==0 if a[x]*a[j]%2==0: ...
x=int(eval(input())) z=0 if x<2: print((0)) for i in range(2,x+1,2): for j in range(1,x+1,2): z+=1 print(z)
16
8
379
122
K = int(eval(input())) a = [] for i in range(1, K + 1): a.append(i) counter = 0 if K >= 2 and K <= 100: for x in range(len(a)): for j in range(x + 1, len(a)): if a[x] & 1 == 0 and a[j] & 1 == 1 or a[x] & 1 == 1 and a[j] & 1 == 0: a[x] * a[j] % 2 == 0 if a[x] *...
x = int(eval(input())) z = 0 if x < 2: print((0)) for i in range(2, x + 1, 2): for j in range(1, x + 1, 2): z += 1 print(z)
false
50
[ "-K = int(eval(input()))", "-a = []", "-for i in range(1, K + 1):", "- a.append(i)", "-counter = 0", "-if K >= 2 and K <= 100:", "- for x in range(len(a)):", "- for j in range(x + 1, len(a)):", "- if a[x] & 1 == 0 and a[j] & 1 == 1 or a[x] & 1 == 1 and a[j] & 1 == 0:", "- ...
false
0.062951
0.06372
0.987944
[ "s841163966", "s681000991" ]
u977193988
p02720
python
s876262535
s739703295
95
69
11,976
18,784
Accepted
Accepted
27.37
import sys from collections import deque def input(): return sys.stdin.readline().strip() def main(): K = int(eval(input())) ans = deque([1, 2, 3, 4, 5, 6, 7, 8, 9]) for _ in range(K - 1): a = ans.popleft() if a % 10 == 0: ans.append(a * 10) ans...
import sys from collections import deque def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(20000000) MOD = 10 ** 9 + 7 INF = float("inf") def main(): K = int(eval(input())) q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9]) for i in range(K): d = q.popleft() ...
29
35
658
692
import sys from collections import deque def input(): return sys.stdin.readline().strip() def main(): K = int(eval(input())) ans = deque([1, 2, 3, 4, 5, 6, 7, 8, 9]) for _ in range(K - 1): a = ans.popleft() if a % 10 == 0: ans.append(a * 10) ans.append(a * 10 ...
import sys from collections import deque def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(20000000) MOD = 10**9 + 7 INF = float("inf") def main(): K = int(eval(input())) q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9]) for i in range(K): d = q.popleft() a = d % 10 ...
false
17.142857
[ "+sys.setrecursionlimit(20000000)", "+MOD = 10**9 + 7", "+INF = float(\"inf\")", "+", "+", "- ans = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])", "- for _ in range(K - 1):", "- a = ans.popleft()", "- if a % 10 == 0:", "- ans.append(a * 10)", "- ans.append(a * 10 ...
false
0.140379
0.200132
0.701434
[ "s876262535", "s739703295" ]
u970197315
p02720
python
s558821851
s853084066
1,360
112
20,880
12,404
Accepted
Accepted
91.76
def dfs(s): d=len(s) if d>10: return if s!='': if s[0]!='0': num.add(int(s)) for c in '0123456789': if s=='': dfs(s+c) else: if abs(int(s[-1])-int(c))<=1: dfs(s+c) k=int(eval(input())) num=set() ...
from collections import deque k=int(eval(input())) q=deque([i for i in range(1,10)]) ans=0 cnt=0 while 1: x=q.popleft() cnt+=1 if cnt==k: ans=x break xmod10 = x % 10 if xmod10 != 0: q.append(10*x+(xmod10-1)) q.append(10*x+(xmod10)) if xmod10 != 9: ...
23
21
367
362
def dfs(s): d = len(s) if d > 10: return if s != "": if s[0] != "0": num.add(int(s)) for c in "0123456789": if s == "": dfs(s + c) else: if abs(int(s[-1]) - int(c)) <= 1: dfs(s + c) k = int(eval(input())) num = set() d...
from collections import deque k = int(eval(input())) q = deque([i for i in range(1, 10)]) ans = 0 cnt = 0 while 1: x = q.popleft() cnt += 1 if cnt == k: ans = x break xmod10 = x % 10 if xmod10 != 0: q.append(10 * x + (xmod10 - 1)) q.append(10 * x + (xmod10)) if xmod1...
false
8.695652
[ "-def dfs(s):", "- d = len(s)", "- if d > 10:", "- return", "- if s != \"\":", "- if s[0] != \"0\":", "- num.add(int(s))", "- for c in \"0123456789\":", "- if s == \"\":", "- dfs(s + c)", "- else:", "- if abs(int(s[-1]) -...
false
1.870931
0.042605
43.913807
[ "s558821851", "s853084066" ]
u318029285
p03030
python
s591188787
s774335813
20
17
3,064
3,060
Accepted
Accepted
15
N = int(eval(input())) S = [""] * N P = [0] * N for i in range(N): S[i], P[i] = input().split() P[i] = int(P[i]) new_S = sorted(S) same_v = [] same_i = [] for i, name in enumerate(new_S): for k in range(N): if new_S[i] == S[k]: same_v.append(P[k]) same_...
N = int(eval(input())) SP = [] for i in range(N): s, p = input().split() SP.append([s] + [int(p)] + [i + 1]) new_SP = sorted(SP, key=lambda x: (x[0], -x[1])) for _, _, i in new_SP: print(i)
24
11
435
208
N = int(eval(input())) S = [""] * N P = [0] * N for i in range(N): S[i], P[i] = input().split() P[i] = int(P[i]) new_S = sorted(S) same_v = [] same_i = [] for i, name in enumerate(new_S): for k in range(N): if new_S[i] == S[k]: same_v.append(P[k]) same_i.append(k) x = sam...
N = int(eval(input())) SP = [] for i in range(N): s, p = input().split() SP.append([s] + [int(p)] + [i + 1]) new_SP = sorted(SP, key=lambda x: (x[0], -x[1])) for _, _, i in new_SP: print(i)
false
54.166667
[ "-S = [\"\"] * N", "-P = [0] * N", "+SP = []", "- S[i], P[i] = input().split()", "- P[i] = int(P[i])", "-new_S = sorted(S)", "-same_v = []", "-same_i = []", "-for i, name in enumerate(new_S):", "- for k in range(N):", "- if new_S[i] == S[k]:", "- same_v.append(P[k])"...
false
0.052541
0.061231
0.858068
[ "s591188787", "s774335813" ]
u552738814
p03852
python
s158112065
s989038687
27
24
8,916
9,100
Accepted
Accepted
11.11
C = eval(input()) if C in ["a","i","u","e","o"]: print("vowel") else: print("consonant")
c = eval(input()) if c in ["a","i","u","e","o"]: print("vowel") else: print("consonant")
6
5
96
95
C = eval(input()) if C in ["a", "i", "u", "e", "o"]: print("vowel") else: print("consonant")
c = eval(input()) if c in ["a", "i", "u", "e", "o"]: print("vowel") else: print("consonant")
false
16.666667
[ "-C = eval(input())", "-if C in [\"a\", \"i\", \"u\", \"e\", \"o\"]:", "+c = eval(input())", "+if c in [\"a\", \"i\", \"u\", \"e\", \"o\"]:" ]
false
0.045092
0.089985
0.501112
[ "s158112065", "s989038687" ]
u588341295
p03816
python
s774380368
s601211972
104
88
21,076
18,628
Accepted
Accepted
15.38
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10 ** 9) INF = float('inf') MOD = 10 ** 9 + 7 from collections import Counter N = int(eval(input())) aN = list(map(int, input().split())) dups = Counter(aN) for k, v in list(dups.items()): du...
# -*- coding: utf-8 -*- import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range...
22
31
425
870
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10**9) INF = float("inf") MOD = 10**9 + 7 from collections import Counter N = int(eval(input())) aN = list(map(int, input().split())) dups = Counter(aN) for k, v in list(dups.items()): dups[k] -= 1 aN ...
# -*- coding: utf-8 -*- import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d ...
false
29.032258
[ "+from collections import Counter", "+def list2d(a, b, c):", "+ return [[c] * b for i in range(a)]", "+", "+", "+def list3d(a, b, c, d):", "+ return [[[d] * c for j in range(b)] for i in range(a)]", "+", "+", "+def list4d(a, b, c, d, e):", "+ return [[[[e] * d for j in range(c)] for j i...
false
0.044225
0.046061
0.960127
[ "s774380368", "s601211972" ]
u477977638
p02614
python
s540244232
s353276461
91
82
68,516
74,040
Accepted
Accepted
9.89
import sys #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(map(float,input().split())) def LI(): return list(map(int...
import sys 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(map(float,input().split())) def LI(): return list(map(int,...
47
47
882
899
import sys # 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(map(float, input().split())) def LI(): ...
import sys 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(map(float, input().split())) def LI(): r...
false
0
[ "-# input = sys.stdin.buffer.readline", "+input = sys.stdin.buffer.readline", "- G.append(list(eval(input())))", "+ G.append(list(input().rstrip().decode()))" ]
false
0.049684
0.090451
0.549295
[ "s540244232", "s353276461" ]
u893063840
p02913
python
s716877375
s681557846
1,332
1,185
14,664
20,876
Accepted
Accepted
11.04
import numpy as np n = int(eval(input())) s = np.array(list(eval(input()))) l = s.size dp = np.zeros(l, dtype=np.int16) ans = 0 for i, e in enumerate(s, 1): dp_prev = dp[:] mx = np.arange(1, l + 1) - i idx = np.hstack([np.full(i, False), s[i:] == e]).astype(np.bool) idx_prev = np.hstack(...
import numpy as np n = int(eval(input())) s = np.array(list(eval(input()))) l = s.size dp = np.zeros(l, dtype=np.int16) ans = 0 for i, e in enumerate(s, 1): dp_prev = dp.copy() mx = np.arange(1, l + 1) - i idx = np.hstack([np.full(i, False), s[i:] == e]).astype(np.bool) idx_prev = np.rol...
19
19
506
459
import numpy as np n = int(eval(input())) s = np.array(list(eval(input()))) l = s.size dp = np.zeros(l, dtype=np.int16) ans = 0 for i, e in enumerate(s, 1): dp_prev = dp[:] mx = np.arange(1, l + 1) - i idx = np.hstack([np.full(i, False), s[i:] == e]).astype(np.bool) idx_prev = np.hstack([np.full(i - 1,...
import numpy as np n = int(eval(input())) s = np.array(list(eval(input()))) l = s.size dp = np.zeros(l, dtype=np.int16) ans = 0 for i, e in enumerate(s, 1): dp_prev = dp.copy() mx = np.arange(1, l + 1) - i idx = np.hstack([np.full(i, False), s[i:] == e]).astype(np.bool) idx_prev = np.roll(idx, -1) ...
false
0
[ "- dp_prev = dp[:]", "+ dp_prev = dp.copy()", "- idx_prev = np.hstack([np.full(i - 1, False), s[i:] == e, False]).astype(np.bool)", "+ idx_prev = np.roll(idx, -1)" ]
false
0.202949
0.253136
0.801738
[ "s716877375", "s681557846" ]
u930705402
p03222
python
s140295121
s686867136
137
114
9,260
74,468
Accepted
Accepted
16.79
MOD=10**9+7 H,W,K=list(map(int,input().split())) dp=[[0]*W for i in range(H+1)] dp[0][0]=1 for i in range(1,H+1): for k in range(W): l,c,r=0,0,0 for bit in range(2**(W-1)): ok=True for t in range(W-2): if (bit>>t&1) and (bit>>(t+1)&1): ...
MOD=10**9+7 def isvalid(bit): for t in range(W-2): if (bit>>t&1) and (bit>>(t+1)&1): return False return True H,W,K=list(map(int,input().split())) dp=[[0]*W for i in range(H+1)] dp[0][0]=1 for i in range(1,H+1): for k in range(W): l,c,r=0,0,0 for bit in ...
30
30
1,070
839
MOD = 10**9 + 7 H, W, K = list(map(int, input().split())) dp = [[0] * W for i in range(H + 1)] dp[0][0] = 1 for i in range(1, H + 1): for k in range(W): l, c, r = 0, 0, 0 for bit in range(2 ** (W - 1)): ok = True for t in range(W - 2): if (bit >> t & 1) and (b...
MOD = 10**9 + 7 def isvalid(bit): for t in range(W - 2): if (bit >> t & 1) and (bit >> (t + 1) & 1): return False return True H, W, K = list(map(int, input().split())) dp = [[0] * W for i in range(H + 1)] dp[0][0] = 1 for i in range(1, H + 1): for k in range(W): l, c, r = 0, ...
false
0
[ "+", "+", "+def isvalid(bit):", "+ for t in range(W - 2):", "+ if (bit >> t & 1) and (bit >> (t + 1) & 1):", "+ return False", "+ return True", "+", "+", "- ok = True", "- for t in range(W - 2):", "- if (bit >> t & 1) and (bit >> (t ...
false
0.054186
0.045752
1.184354
[ "s140295121", "s686867136" ]
u225388820
p02598
python
s858783862
s788837932
1,588
168
93,860
93,828
Accepted
Accepted
89.42
from math import ceil n, k = list(map(int, input().split())) a = list(map(int, input().split())) def c(x): cnt=0 for i in a: cnt += i // x return cnt<=k l, r = 0, max(a) for i in range(100): mid = (l + r) / 2 if c(mid): r = mid else: l = mid print((ceil(l))...
n, k = list(map(int, input().split())) a = list(map(int, input().split())) def c(x): cnt=0 for i in a: cnt += (i - 1) // x return cnt <= k l, r = 0, max(a) while l + 1 < r: mid = (l + r) // 2 if c(mid): r = mid else: l = mid print(r)
16
18
313
299
from math import ceil n, k = list(map(int, input().split())) a = list(map(int, input().split())) def c(x): cnt = 0 for i in a: cnt += i // x return cnt <= k l, r = 0, max(a) for i in range(100): mid = (l + r) / 2 if c(mid): r = mid else: l = mid print((ceil(l)))
n, k = list(map(int, input().split())) a = list(map(int, input().split())) def c(x): cnt = 0 for i in a: cnt += (i - 1) // x return cnt <= k l, r = 0, max(a) while l + 1 < r: mid = (l + r) // 2 if c(mid): r = mid else: l = mid print(r)
false
11.111111
[ "-from math import ceil", "-", "- cnt += i // x", "+ cnt += (i - 1) // x", "-for i in range(100):", "- mid = (l + r) / 2", "+while l + 1 < r:", "+ mid = (l + r) // 2", "-print((ceil(l)))", "+print(r)" ]
false
0.071253
0.08121
0.877393
[ "s858783862", "s788837932" ]