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
u775681539
p02756
python
s934130595
s554137969
1,334
153
6,260
8,628
Accepted
Accepted
88.53
#python3 def main(): s = eval(input()) addfront = '' addback = '' q = int(eval(input())) direction = 0 for i in range(q): t = eval(input()) if t[0] == '1': direction += 1 continue if t[0] == '2': if direction % 2 == 0: ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import deque def main(): s = deque(readline().rstrip().decode()) q = int(readline()) dir = 1 for _ in range(q): txt = readline().rstrip().decode() ...
30
27
795
723
# python3 def main(): s = eval(input()) addfront = "" addback = "" q = int(eval(input())) direction = 0 for i in range(q): t = eval(input()) if t[0] == "1": direction += 1 continue if t[0] == "2": if direction % 2 == 0: ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import deque def main(): s = deque(readline().rstrip().decode()) q = int(readline()) dir = 1 for _ in range(q): txt = readline().rstrip().decode() if tx...
false
10
[ "-# python3", "-def main():", "- s = eval(input())", "- addfront = \"\"", "- addback = \"\"", "- q = int(eval(input()))", "- direction = 0", "- for i in range(q):", "- t = eval(input())", "- if t[0] == \"1\":", "- direction += 1", "- contin...
false
0.036087
0.035995
1.002548
[ "s934130595", "s554137969" ]
u256031597
p03212
python
s526570738
s213378355
93
71
2,940
3,060
Accepted
Accepted
23.66
N = int(eval(input())) def dfs(s): if int(s) > N: return 0 if all(s.count(c) > 0 for c in "753"): ret = 1 else: ret = 0 for c in '753': ret += dfs(s + c) return ret print((dfs('0')))
N = int(eval(input())) def func(s, cnt): if int(s)>N: return cnt else: b=list(s) if '7' in b and '5' in b and '3' in b: cnt += 1 for t in "753": cnt = func(s+t, cnt) return cnt print((func("0", 0)))
15
15
248
284
N = int(eval(input())) def dfs(s): if int(s) > N: return 0 if all(s.count(c) > 0 for c in "753"): ret = 1 else: ret = 0 for c in "753": ret += dfs(s + c) return ret print((dfs("0")))
N = int(eval(input())) def func(s, cnt): if int(s) > N: return cnt else: b = list(s) if "7" in b and "5" in b and "3" in b: cnt += 1 for t in "753": cnt = func(s + t, cnt) return cnt print((func("0", 0)))
false
0
[ "-def dfs(s):", "+def func(s, cnt):", "- return 0", "- if all(s.count(c) > 0 for c in \"753\"):", "- ret = 1", "+ return cnt", "- ret = 0", "- for c in \"753\":", "- ret += dfs(s + c)", "- return ret", "+ b = list(s)", "+ if \"7\" in b ...
false
0.053853
0.045488
1.183889
[ "s526570738", "s213378355" ]
u580920947
p02711
python
s242691791
s908250738
28
20
10,304
9,064
Accepted
Accepted
28.57
#!/usr/bin/env python import sys from collections import Counter from itertools import permutations, combinations from fractions import gcd from math import ceil, floor sys.setrecursionlimit(10 ** 6) def input(): return sys.stdin.readline()[:-1] def main(): N = eval(input()) flag = False ...
x = eval(input()) for l in x: if l == "7": print("Yes") exit() print("No")
27
6
519
93
#!/usr/bin/env python import sys from collections import Counter from itertools import permutations, combinations from fractions import gcd from math import ceil, floor sys.setrecursionlimit(10**6) def input(): return sys.stdin.readline()[:-1] def main(): N = eval(input()) flag = False for l in N: ...
x = eval(input()) for l in x: if l == "7": print("Yes") exit() print("No")
false
77.777778
[ "-#!/usr/bin/env python", "-import sys", "-from collections import Counter", "-from itertools import permutations, combinations", "-from fractions import gcd", "-from math import ceil, floor", "-", "-sys.setrecursionlimit(10**6)", "-", "-", "-def input():", "- return sys.stdin.readline()[:-...
false
0.035957
0.065821
0.546281
[ "s242691791", "s908250738" ]
u077291787
p03994
python
s798589632
s788943821
83
49
8,476
5,532
Accepted
Accepted
40.96
# code-festival-2016-qualaC - 次のアルファベット / Next Letter from string import ascii_lowercase as abc def main(): S = input().rstrip() K = int(input()) N, MOD = len(S), 26 # dist[c] := distance to "a" through "z" dist = {c: 26 - i for i, c in enumerate(abc)} dist["a"] = 0 A = [dist[i]...
# code-festival-2016-qualaC - 次のアルファベット / Next Letter from string import ascii_lowercase as abc def main(): S = input().rstrip() K = int(eval(input())) # dist[c] := distance to "a" through "z" dist = {c: 26 - i for i, c in enumerate(abc)} dist["a"] = 0 A = [dist[i] for i in S] a...
23
25
681
673
# code-festival-2016-qualaC - 次のアルファベット / Next Letter from string import ascii_lowercase as abc def main(): S = input().rstrip() K = int(input()) N, MOD = len(S), 26 # dist[c] := distance to "a" through "z" dist = {c: 26 - i for i, c in enumerate(abc)} dist["a"] = 0 A = [dist[i] for i in S...
# code-festival-2016-qualaC - 次のアルファベット / Next Letter from string import ascii_lowercase as abc def main(): S = input().rstrip() K = int(eval(input())) # dist[c] := distance to "a" through "z" dist = {c: 26 - i for i, c in enumerate(abc)} dist["a"] = 0 A = [dist[i] for i in S] ans = "" ...
false
8
[ "- K = int(input())", "- N, MOD = len(S), 26", "+ K = int(eval(input()))", "- for i in range(N):", "- if A[i] and A[i] <= K: # A[i] -> \"a\" if possible", "- A[i], K = 0, K - A[i]", "- A[-1] = (A[-1] - K) % MOD # use the remaining K on A[-1]", "- rest = {v: k for ...
false
0.043905
0.007625
5.75765
[ "s798589632", "s788943821" ]
u078349616
p02691
python
s447812091
s222869256
351
268
73,596
61,316
Accepted
Accepted
23.65
from collections import defaultdict N = int(eval(input())) A = list(map(int,input().split())) di = defaultdict(int) dj = defaultdict(int) for i in range(1, N+1): di[i + A[i-1]] += 1 dj[i - A[i-1]] += 1 ans = 0 for key in list(di.keys()): ans += dj[key] * di[key] print(ans)
from collections import defaultdict N = int(eval(input())) A = list(map(int,input().split())) ans = 0 di = defaultdict(int) for i, a in enumerate(A): ans += di[i+1 - a] di[i+1 + a] += 1 print(ans)
16
12
286
212
from collections import defaultdict N = int(eval(input())) A = list(map(int, input().split())) di = defaultdict(int) dj = defaultdict(int) for i in range(1, N + 1): di[i + A[i - 1]] += 1 dj[i - A[i - 1]] += 1 ans = 0 for key in list(di.keys()): ans += dj[key] * di[key] print(ans)
from collections import defaultdict N = int(eval(input())) A = list(map(int, input().split())) ans = 0 di = defaultdict(int) for i, a in enumerate(A): ans += di[i + 1 - a] di[i + 1 + a] += 1 print(ans)
false
25
[ "+ans = 0", "-dj = defaultdict(int)", "-for i in range(1, N + 1):", "- di[i + A[i - 1]] += 1", "- dj[i - A[i - 1]] += 1", "-ans = 0", "-for key in list(di.keys()):", "- ans += dj[key] * di[key]", "+for i, a in enumerate(A):", "+ ans += di[i + 1 - a]", "+ di[i + 1 + a] += 1" ]
false
0.035588
0.038103
0.934
[ "s447812091", "s222869256" ]
u754022296
p02913
python
s272790413
s912202944
959
659
231,944
229,912
Accepted
Accepted
31.28
def main(): n = int(eval(input())) S = eval(input()) ans = 0 dp = [[0]*n for _ in range(n)] for j in range(n-1, 0, -1): for i in range(j-1, -1, -1): if j == n-1: dp[i][j] = int(S[i] == S[j]) else: if S[i] == S[j]: dp[i][j] = dp[i+1][j+1] + 1 ans = ma...
def main(): n = int(eval(input())) S = eval(input()) ans = 0 dp = [0]*(n*n) for j in range(n-1, 0, -1): for i in range(j-1, -1, -1): if j == n-1: dp[i*n+j] = int(S[i] == S[j]) else: if S[i] == S[j]: dp[i*n+j] = dp[i*n+j+1+n] + 1 ans = max(ans, min(dp...
16
16
386
374
def main(): n = int(eval(input())) S = eval(input()) ans = 0 dp = [[0] * n for _ in range(n)] for j in range(n - 1, 0, -1): for i in range(j - 1, -1, -1): if j == n - 1: dp[i][j] = int(S[i] == S[j]) else: if S[i] == S[j]: ...
def main(): n = int(eval(input())) S = eval(input()) ans = 0 dp = [0] * (n * n) for j in range(n - 1, 0, -1): for i in range(j - 1, -1, -1): if j == n - 1: dp[i * n + j] = int(S[i] == S[j]) else: if S[i] == S[j]: dp[...
false
0
[ "- dp = [[0] * n for _ in range(n)]", "+ dp = [0] * (n * n)", "- dp[i][j] = int(S[i] == S[j])", "+ dp[i * n + j] = int(S[i] == S[j])", "- dp[i][j] = dp[i + 1][j + 1] + 1", "- ans = max(ans, min(dp[i][j], j - i))", "+ dp...
false
0.041929
0.041173
1.018376
[ "s272790413", "s912202944" ]
u766684188
p03108
python
s046822506
s468403856
814
736
36,400
36,404
Accepted
Accepted
9.58
import sys input=sys.stdin.readline sys.setrecursionlimit(10**9) class UnionFind: def __init__(self,n): self.par=[i for i in range(n+1)] #親要素のノード番号を格納 self.rank=[0]*(n+1) #木の高さを格納 def find(self,x): #根を検索 if self.par[x]==x: #par[x]==xの時そのノードは根 return x else...
import sys input=sys.stdin.readline sys.setrecursionlimit(10**9) class UnionFind: def __init__(self,n): self.par=[i for i in range(n+1)] self.rank=[0]*(n+1) self.size=[1]*(n+1) def find(self,x): if self.par[x]==x: return x else: self....
46
41
1,383
1,154
import sys input = sys.stdin.readline sys.setrecursionlimit(10**9) class UnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] # 親要素のノード番号を格納 self.rank = [0] * (n + 1) # 木の高さを格納 def find(self, x): # 根を検索 if self.par[x] == x: # par[x]==xの時そのノードは根 retur...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**9) class UnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0] * (n + 1) self.size = [1] * (n + 1) def find(self, x): if self.par[x] == x: return x else: ...
false
10.869565
[ "- self.par = [i for i in range(n + 1)] # 親要素のノード番号を格納", "- self.rank = [0] * (n + 1) # 木の高さを格納", "+ self.par = [i for i in range(n + 1)]", "+ self.rank = [0] * (n + 1)", "+ self.size = [1] * (n + 1)", "- def find(self, x): # 根を検索", "- if self.par[x] == x:...
false
0.036283
0.115111
0.315197
[ "s046822506", "s468403856" ]
u038021590
p02555
python
s266397587
s794022036
264
64
212,956
63,824
Accepted
Accepted
75.76
S = int(eval(input())) mod = 10**9 + 7 N = 10**6 ans = 0 n = S // 3 fact = [1, 1] factinv = [1, 1] inv = [0, 1] def cmb(n, r): if (r < 0) or (n < r): return 0 r = min(r, n - r) return fact[n] * factinv[r] * factinv[n - r] % mod for i in range(2, N + 1): fact.append((fact[...
S = int(eval(input())) mod = 10 ** 9 + 7 DP = [0] * (S+1) if S >= 3: DP[3] = 1 for i in range(4, S+1): DP[i] = DP[i-1] + DP[i-3] DP[i] %= mod print((DP[-1]))
32
13
553
177
S = int(eval(input())) mod = 10**9 + 7 N = 10**6 ans = 0 n = S // 3 fact = [1, 1] factinv = [1, 1] inv = [0, 1] def cmb(n, r): if (r < 0) or (n < r): return 0 r = min(r, n - r) return fact[n] * factinv[r] * factinv[n - r] % mod for i in range(2, N + 1): fact.append((fact[-1] * i) % mod) ...
S = int(eval(input())) mod = 10**9 + 7 DP = [0] * (S + 1) if S >= 3: DP[3] = 1 for i in range(4, S + 1): DP[i] = DP[i - 1] + DP[i - 3] DP[i] %= mod print((DP[-1]))
false
59.375
[ "-N = 10**6", "-ans = 0", "-n = S // 3", "-fact = [1, 1]", "-factinv = [1, 1]", "-inv = [0, 1]", "-", "-", "-def cmb(n, r):", "- if (r < 0) or (n < r):", "- return 0", "- r = min(r, n - r)", "- return fact[n] * factinv[r] * factinv[n - r] % mod", "-", "-", "-for i in ra...
false
1.577885
0.036908
42.751624
[ "s266397587", "s794022036" ]
u581187895
p03472
python
s633576707
s540155328
385
206
29,820
17,624
Accepted
Accepted
46.49
# 振るのは最強のやつだけ # 投げるのは強い順 N,H = list(map(int,input().split())) AB = [[int(x) for x in input().split()] for _ in range(N)] A,B = list(zip(*AB)) a = max(A) # 振る B = [b for b in B if b > a] # 投げる価値あり B.sort(reverse = True) attack_cnt = 0 for b in B: if H <= 0: break attack_cnt += 1 H -= b ...
def resolve(): N, H = list(map(int, input().split())) A = [0] * N B = [0] * N for i in range(N): a, b = list(map(int, input().split())) A[i] = a B[i] = b a_max = max(A) # a_maxより高い攻撃力を選択(a_maxは何回でも行えるのでそれより低いものは選択しない) B = [b for b in B if a_max < b] ...
23
29
375
551
# 振るのは最強のやつだけ # 投げるのは強い順 N, H = list(map(int, input().split())) AB = [[int(x) for x in input().split()] for _ in range(N)] A, B = list(zip(*AB)) a = max(A) # 振る B = [b for b in B if b > a] # 投げる価値あり B.sort(reverse=True) attack_cnt = 0 for b in B: if H <= 0: break attack_cnt += 1 H -= b if H > 0: ...
def resolve(): N, H = list(map(int, input().split())) A = [0] * N B = [0] * N for i in range(N): a, b = list(map(int, input().split())) A[i] = a B[i] = b a_max = max(A) # a_maxより高い攻撃力を選択(a_maxは何回でも行えるのでそれより低いものは選択しない) B = [b for b in B if a_max < b] B.sort(reverse...
false
20.689655
[ "-# 振るのは最強のやつだけ", "-# 投げるのは強い順", "-N, H = list(map(int, input().split()))", "-AB = [[int(x) for x in input().split()] for _ in range(N)]", "-A, B = list(zip(*AB))", "-a = max(A) # 振る", "-B = [b for b in B if b > a] # 投げる価値あり", "-B.sort(reverse=True)", "-attack_cnt = 0", "-for b in B:", "- i...
false
0.038189
0.037488
1.018708
[ "s633576707", "s540155328" ]
u111471511
p02570
python
s172590619
s003383511
33
29
9,156
9,164
Accepted
Accepted
12.12
DTS = [int(i) for i in input().split()] D = DTS[0] T = DTS[1] S = DTS[2] if D/T <= S: print("Yes") else: print("No")
input_list = [int(num) for num in input().split()] D = input_list[0] T = input_list[1] S = input_list[2] if D/S <= T: print("Yes") else: print("No")
8
11
131
169
DTS = [int(i) for i in input().split()] D = DTS[0] T = DTS[1] S = DTS[2] if D / T <= S: print("Yes") else: print("No")
input_list = [int(num) for num in input().split()] D = input_list[0] T = input_list[1] S = input_list[2] if D / S <= T: print("Yes") else: print("No")
false
27.272727
[ "-DTS = [int(i) for i in input().split()]", "-D = DTS[0]", "-T = DTS[1]", "-S = DTS[2]", "-if D / T <= S:", "+input_list = [int(num) for num in input().split()]", "+D = input_list[0]", "+T = input_list[1]", "+S = input_list[2]", "+if D / S <= T:" ]
false
0.037096
0.036808
1.007842
[ "s172590619", "s003383511" ]
u347600233
p02773
python
s588698258
s166051471
877
718
32,096
34,372
Accepted
Accepted
18.13
n = int(eval(input())) dics = {} for i in range(n): try: s = eval(input()) dics[s] += 1 except KeyError: dics[s] = 1 max_v = max(dics.values()) max_k_list = [kv[0] for kv in list(dics.items()) if kv[1] == max_v] max_k_list.sort() for i in max_k_list: print(i)
from collections import defaultdict n = int(input()) dics = defaultdict(int) for i in range(n): s = input() dics[s] += 1 max_v = max(dics.values()) max_k_list = [kv[0] for kv in dics.items() if kv[1] == max_v] max_k_list.sort() print(*max_k_list, sep='\n')
14
10
291
273
n = int(eval(input())) dics = {} for i in range(n): try: s = eval(input()) dics[s] += 1 except KeyError: dics[s] = 1 max_v = max(dics.values()) max_k_list = [kv[0] for kv in list(dics.items()) if kv[1] == max_v] max_k_list.sort() for i in max_k_list: print(i)
from collections import defaultdict n = int(input()) dics = defaultdict(int) for i in range(n): s = input() dics[s] += 1 max_v = max(dics.values()) max_k_list = [kv[0] for kv in dics.items() if kv[1] == max_v] max_k_list.sort() print(*max_k_list, sep="\n")
false
28.571429
[ "-n = int(eval(input()))", "-dics = {}", "+from collections import defaultdict", "+", "+n = int(input())", "+dics = defaultdict(int)", "- try:", "- s = eval(input())", "- dics[s] += 1", "- except KeyError:", "- dics[s] = 1", "+ s = input()", "+ dics[s] += 1",...
false
0.03151
0.032659
0.964816
[ "s588698258", "s166051471" ]
u644907318
p02953
python
s146802015
s544797596
221
84
63,984
85,088
Accepted
Accepted
61.99
N = int(eval(input())) H = list(map(int,input().split())) hmax = H[0] flag = 0 for i in range(1,N): hmax = max(hmax,H[i]) if hmax-H[i]>=2: flag = 1 break if flag==0: print("Yes") else: print("No")
N = int(eval(input())) H = list(map(int,input().split())) hmax = H[0] flag = 0 for i in range(1,N): if H[i]>=hmax: hmax = H[i] else: if hmax-H[i]>=2: flag = 1 break if flag==1: print("No") else: print("Yes")
13
15
234
271
N = int(eval(input())) H = list(map(int, input().split())) hmax = H[0] flag = 0 for i in range(1, N): hmax = max(hmax, H[i]) if hmax - H[i] >= 2: flag = 1 break if flag == 0: print("Yes") else: print("No")
N = int(eval(input())) H = list(map(int, input().split())) hmax = H[0] flag = 0 for i in range(1, N): if H[i] >= hmax: hmax = H[i] else: if hmax - H[i] >= 2: flag = 1 break if flag == 1: print("No") else: print("Yes")
false
13.333333
[ "- hmax = max(hmax, H[i])", "- if hmax - H[i] >= 2:", "- flag = 1", "- break", "-if flag == 0:", "+ if H[i] >= hmax:", "+ hmax = H[i]", "+ else:", "+ if hmax - H[i] >= 2:", "+ flag = 1", "+ break", "+if flag == 1:", "+ print(\"...
false
0.143241
0.037063
3.864814
[ "s146802015", "s544797596" ]
u227020436
p03262
python
s997610965
s672312813
152
132
16,276
16,280
Accepted
Accepted
13.16
import fractions N, X = list(map(int, input().split())) x = list(map(int, input().split())) assert len(x) == N x.sort() # distance between each two cities dist = [x[i] - x[i-1] for i in range(1, len(x))] # distance between the first city and the start point dist.append(abs(x[0] - X)) def listgcd(xs...
from fractions import gcd from functools import reduce N, X = list(map(int, input().split())) x = list(map(int, input().split())) assert len(x) == N x.sort() # distance between each two cities dist = [x[i] - x[i-1] for i in range(1, len(x))] # distance between the first city and the start point dist....
21
16
440
364
import fractions N, X = list(map(int, input().split())) x = list(map(int, input().split())) assert len(x) == N x.sort() # distance between each two cities dist = [x[i] - x[i - 1] for i in range(1, len(x))] # distance between the first city and the start point dist.append(abs(x[0] - X)) def listgcd(xs): g = xs[0]...
from fractions import gcd from functools import reduce N, X = list(map(int, input().split())) x = list(map(int, input().split())) assert len(x) == N x.sort() # distance between each two cities dist = [x[i] - x[i - 1] for i in range(1, len(x))] # distance between the first city and the start point dist.append(abs(x[0] ...
false
23.809524
[ "-import fractions", "+from fractions import gcd", "+from functools import reduce", "-", "-", "-def listgcd(xs):", "- g = xs[0]", "- for i in range(1, len(xs)):", "- g = fractions.gcd(g, xs[i])", "- return g", "-", "-", "-print((listgcd(dist)))", "+print((reduce(gcd, dist))...
false
0.052656
0.105539
0.498924
[ "s997610965", "s672312813" ]
u877283726
p03680
python
s275269001
s571706363
228
203
7,852
7,084
Accepted
Accepted
10.96
N = int(eval(input())) a = [] for i in range(N): a.append(int(eval(input()))) pushed = [0] * N pushed[0] = 1 current_bottom = a[0] ans = 1 if current_bottom == 2: print(ans) exit() for _ in range(N): current_bottom = a[current_bottom-1] if pushed[current_bottom-1] == 1: p...
N = int(eval(input())) a = [] for i in range(N): a.append(int(eval(input()))) current_bottom = a[0] ans = 1 if current_bottom == 2: print(ans) exit() for _ in range(N): current_bottom = a[current_bottom-1] ans += 1 if current_bottom == 2: print(ans) exit() prin...
25
18
460
313
N = int(eval(input())) a = [] for i in range(N): a.append(int(eval(input()))) pushed = [0] * N pushed[0] = 1 current_bottom = a[0] ans = 1 if current_bottom == 2: print(ans) exit() for _ in range(N): current_bottom = a[current_bottom - 1] if pushed[current_bottom - 1] == 1: print((-1)) ...
N = int(eval(input())) a = [] for i in range(N): a.append(int(eval(input()))) current_bottom = a[0] ans = 1 if current_bottom == 2: print(ans) exit() for _ in range(N): current_bottom = a[current_bottom - 1] ans += 1 if current_bottom == 2: print(ans) exit() print((-1))
false
28
[ "-pushed = [0] * N", "-pushed[0] = 1", "- if pushed[current_bottom - 1] == 1:", "- print((-1))", "- exit()", "- else:", "- pushed[current_bottom - 1] = 1", "+print((-1))" ]
false
0.043206
0.039378
1.097223
[ "s275269001", "s571706363" ]
u562935282
p03262
python
s184597239
s129037293
145
100
14,252
15,020
Accepted
Accepted
31.03
def gcd(a, b): if b == 0: return a return gcd(b, a % b) N, X = list(map(int, input().split())) x = list(map(int, input().split())) x = sorted(x) x = list([abs(arg - X) for arg in x]) g = x[0] for xx in x: g = gcd(g, xx) print(g)
def gcd(a, b): if b == 0: return a return gcd(b, a % b) N, X = list(map(int, input().split())) x = list(map(int, input().split())) x = list([abs(arg - X) for arg in x]) g = x[0] for xx in x[1:]: g = gcd(g, xx) print(g)
14
13
256
245
def gcd(a, b): if b == 0: return a return gcd(b, a % b) N, X = list(map(int, input().split())) x = list(map(int, input().split())) x = sorted(x) x = list([abs(arg - X) for arg in x]) g = x[0] for xx in x: g = gcd(g, xx) print(g)
def gcd(a, b): if b == 0: return a return gcd(b, a % b) N, X = list(map(int, input().split())) x = list(map(int, input().split())) x = list([abs(arg - X) for arg in x]) g = x[0] for xx in x[1:]: g = gcd(g, xx) print(g)
false
7.142857
[ "-x = sorted(x)", "-for xx in x:", "+for xx in x[1:]:" ]
false
0.038833
0.037676
1.030706
[ "s184597239", "s129037293" ]
u216392490
p02596
python
s570247376
s043772087
363
246
9,140
9,180
Accepted
Accepted
32.23
import sys import math import time sys.setrecursionlimit(int(1e6)) if False: dprint = print else: def dprint(*args): pass k = list(map(int, input().split()))[0] if (k % 7 == 0): l = 9*k/7 else: l = 9*k dprint('k, l = ', k, l) i = 1 n = 10 while(i < 10**6): m = n % l ...
import sys import math import time sys.setrecursionlimit(int(1e6)) if False: dprint = print else: def dprint(*args): pass k = list(map(int, input().split()))[0] am = 7 % k i = 1 for i in range(k): if am==0: print(i+1) exit() else: i+=1 am=(...
31
24
480
347
import sys import math import time sys.setrecursionlimit(int(1e6)) if False: dprint = print else: def dprint(*args): pass k = list(map(int, input().split()))[0] if k % 7 == 0: l = 9 * k / 7 else: l = 9 * k dprint("k, l = ", k, l) i = 1 n = 10 while i < 10**6: m = n % l if m == 1: # ...
import sys import math import time sys.setrecursionlimit(int(1e6)) if False: dprint = print else: def dprint(*args): pass k = list(map(int, input().split()))[0] am = 7 % k i = 1 for i in range(k): if am == 0: print(i + 1) exit() else: i += 1 am = (am * 10 + 7)...
false
22.580645
[ "-if k % 7 == 0:", "- l = 9 * k / 7", "-else:", "- l = 9 * k", "-dprint(\"k, l = \", k, l)", "+am = 7 % k", "-n = 10", "-while i < 10**6:", "- m = n % l", "- if m == 1: # (10^i mod L = 1)", "- print(i)", "+for i in range(k):", "+ if am == 0:", "+ print(i + 1)"...
false
0.292896
0.226557
1.292812
[ "s570247376", "s043772087" ]
u199194110
p03836
python
s666269943
s539757612
26
11
3,708
2,816
Accepted
Accepted
57.69
# coding: utf-8 import sys import itertools def move(x,y): xs = "R"*x if x > 0 else "L"*(-x) ys = "U"*y if y > 0 else "D"*(-y) return (xs, ys) def main(): sx, sy, tx, ty = list(map(int,sys.stdin.read().split())) x = tx - sx y = ty - sy xs, ys = move(x,y) ans = ys + ...
# coding: utf-8 import sys LEFT = "L" RIGHT = "R" UP = "U" DOWN = "D" def move(x,y): xs = RIGHT*x if x > 0 else LEFT*(-x) ys = UP*y if y > 0 else DOWN*(-y) return ys + xs def main(): sx, sy, tx, ty = list(map(int,sys.stdin.read().split())) x = tx - sx y = ty - sy ...
32
31
646
603
# coding: utf-8 import sys import itertools def move(x, y): xs = "R" * x if x > 0 else "L" * (-x) ys = "U" * y if y > 0 else "D" * (-y) return (xs, ys) def main(): sx, sy, tx, ty = list(map(int, sys.stdin.read().split())) x = tx - sx y = ty - sy xs, ys = move(x, y) ans = ys + xs ...
# coding: utf-8 import sys LEFT = "L" RIGHT = "R" UP = "U" DOWN = "D" def move(x, y): xs = RIGHT * x if x > 0 else LEFT * (-x) ys = UP * y if y > 0 else DOWN * (-y) return ys + xs def main(): sx, sy, tx, ty = list(map(int, sys.stdin.read().split())) x = tx - sx y = ty - sy ans = "" ...
false
3.125
[ "-import itertools", "+", "+LEFT = \"L\"", "+RIGHT = \"R\"", "+UP = \"U\"", "+DOWN = \"D\"", "- xs = \"R\" * x if x > 0 else \"L\" * (-x)", "- ys = \"U\" * y if y > 0 else \"D\" * (-y)", "- return (xs, ys)", "+ xs = RIGHT * x if x > 0 else LEFT * (-x)", "+ ys = UP * y if y > 0 els...
false
0.040829
0.035954
1.135594
[ "s666269943", "s539757612" ]
u970267139
p03127
python
s195906054
s527912930
319
63
20,004
20,396
Accepted
Accepted
80.25
n = int(eval(input())) a = list(map(int, input().split())) m = 0 tmp = min(a) while m != tmp: m = tmp for i in range(n): if a[i] != m: a[i] = a[i] % m if a[i] < m and a[i] != 0: tmp = a[i] print(m)
import math from functools import reduce def gcd_list(numbers): return reduce(math.gcd, numbers) n = int(eval(input())) a = list(map(int, input().split())) print((gcd_list(a)))
13
10
253
185
n = int(eval(input())) a = list(map(int, input().split())) m = 0 tmp = min(a) while m != tmp: m = tmp for i in range(n): if a[i] != m: a[i] = a[i] % m if a[i] < m and a[i] != 0: tmp = a[i] print(m)
import math from functools import reduce def gcd_list(numbers): return reduce(math.gcd, numbers) n = int(eval(input())) a = list(map(int, input().split())) print((gcd_list(a)))
false
23.076923
[ "+import math", "+from functools import reduce", "+", "+", "+def gcd_list(numbers):", "+ return reduce(math.gcd, numbers)", "+", "+", "-m = 0", "-tmp = min(a)", "-while m != tmp:", "- m = tmp", "- for i in range(n):", "- if a[i] != m:", "- a[i] = a[i] % m", "...
false
0.105299
0.036884
2.854893
[ "s195906054", "s527912930" ]
u886274153
p03244
python
s878551679
s405533194
123
79
21,144
15,588
Accepted
Accepted
35.77
n = int(eval(input())) v = [int(i) for i in input().split()] a, b = dict(), dict() for i in range(n): if i%2 == 0: a[v[i]] = a.get(v[i], 0) + 1 else: b[v[i]] = b.get(v[i], 0) + 1 alst = sorted(list(a.items()), key=lambda x: x[1], reverse=True) blst = sorted(list(b.items()), key=lambda...
import collections n = int(eval(input())) v = [int(i) for i in input().split()] dummy = [(-1, 0)] (av1, ak1), (av2, ak2) = (collections.Counter(v[::2]).most_common(2) + dummy)[:2] (bv1, bk1), (bv2, bk2) = (collections.Counter(v[1::2]).most_common(2) + dummy)[:2] if av1 != bv1: print((n-ak1-bk1)) elif ak...
24
18
721
457
n = int(eval(input())) v = [int(i) for i in input().split()] a, b = dict(), dict() for i in range(n): if i % 2 == 0: a[v[i]] = a.get(v[i], 0) + 1 else: b[v[i]] = b.get(v[i], 0) + 1 alst = sorted(list(a.items()), key=lambda x: x[1], reverse=True) blst = sorted(list(b.items()), key=lambda x: x[1],...
import collections n = int(eval(input())) v = [int(i) for i in input().split()] dummy = [(-1, 0)] (av1, ak1), (av2, ak2) = (collections.Counter(v[::2]).most_common(2) + dummy)[:2] (bv1, bk1), (bv2, bk2) = (collections.Counter(v[1::2]).most_common(2) + dummy)[:2] if av1 != bv1: print((n - ak1 - bk1)) elif ak1 < bk1...
false
25
[ "+import collections", "+", "-a, b = dict(), dict()", "-for i in range(n):", "- if i % 2 == 0:", "- a[v[i]] = a.get(v[i], 0) + 1", "- else:", "- b[v[i]] = b.get(v[i], 0) + 1", "-alst = sorted(list(a.items()), key=lambda x: x[1], reverse=True)", "-blst = sorted(list(b.items()), ...
false
0.04499
0.062864
0.715664
[ "s878551679", "s405533194" ]
u729133443
p02760
python
s675099296
s017199937
162
17
38,384
3,064
Accepted
Accepted
89.51
a=open(0).read().split();print(('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,3,6},{0,4,8},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2]))
a=open(0).read().split();print(('YNeos'[all(t-set(map(a.index,a[9:]))for t in({0,3,6},{0,4,8},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2]))
1
1
132
131
a = open(0).read().split() print( ( "YNeos"[ all( t - set(map(a.index, a[10:])) for t in ( {0, 3, 6}, {0, 4, 8}, {2, 4, 6}, {2, 5, 8}, {3, 4, 5}, ...
a = open(0).read().split() print( ( "YNeos"[ all( t - set(map(a.index, a[9:])) for t in ( {0, 3, 6}, {0, 4, 8}, {2, 4, 6}, {2, 5, 8}, {3, 4, 5}, ...
false
0
[ "- t - set(map(a.index, a[10:]))", "+ t - set(map(a.index, a[9:]))" ]
false
0.103291
0.035783
2.886553
[ "s675099296", "s017199937" ]
u768896740
p03721
python
s425811673
s301315838
416
356
30,164
14,944
Accepted
Accepted
14.42
n, k = list(map(int, input().split())) lis = [] max_num = 0 for i in range(n): array = list(map(int, input().split())) if array[0] > max_num: max_num = array[0] lis.append(array) num_list = [0] * max_num for i, j in lis: num_list[i-1] += j count = 0 for i in range(len(num_lis...
from collections import defaultdict n, k = list(map(int, input().split())) cnt = 0 d = defaultdict(int) for i in range(n): a, b = list(map(int, input().split())) d[a] += b d = sorted(d.items()) for i, j in d: cnt += j if cnt >= k: print(i) break
21
19
400
290
n, k = list(map(int, input().split())) lis = [] max_num = 0 for i in range(n): array = list(map(int, input().split())) if array[0] > max_num: max_num = array[0] lis.append(array) num_list = [0] * max_num for i, j in lis: num_list[i - 1] += j count = 0 for i in range(len(num_list)): count += ...
from collections import defaultdict n, k = list(map(int, input().split())) cnt = 0 d = defaultdict(int) for i in range(n): a, b = list(map(int, input().split())) d[a] += b d = sorted(d.items()) for i, j in d: cnt += j if cnt >= k: print(i) break
false
9.52381
[ "+from collections import defaultdict", "+", "-lis = []", "-max_num = 0", "+cnt = 0", "+d = defaultdict(int)", "- array = list(map(int, input().split()))", "- if array[0] > max_num:", "- max_num = array[0]", "- lis.append(array)", "-num_list = [0] * max_num", "-for i, j in lis:...
false
0.047443
0.113465
0.418129
[ "s425811673", "s301315838" ]
u493130708
p02949
python
s553774190
s337969674
1,659
1,030
75,888
75,496
Accepted
Accepted
37.91
import bisect import collections import copy import functools import heapq import math import sys from collections import deque from collections import defaultdict input = sys.stdin.readline MOD = 10**9+7 N,M,P = list(map(int,(input().split()))) line = [] for i in range(M): a,b,c = list(map(int,(inp...
import bisect import collections import copy import functools import heapq import math import sys from collections import deque from collections import defaultdict input = sys.stdin.readline MOD = 10**9+7 N,M,P = list(map(int,(input().split()))) line = [] for i in range(M): a,b,c = list(map(int,(inp...
62
61
1,795
1,746
import bisect import collections import copy import functools import heapq import math import sys from collections import deque from collections import defaultdict input = sys.stdin.readline MOD = 10**9 + 7 N, M, P = list(map(int, (input().split()))) line = [] for i in range(M): a, b, c = list(map(int, (input().sp...
import bisect import collections import copy import functools import heapq import math import sys from collections import deque from collections import defaultdict input = sys.stdin.readline MOD = 10**9 + 7 N, M, P = list(map(int, (input().split()))) line = [] for i in range(M): a, b, c = list(map(int, (input().sp...
false
1.612903
[ "- update = False", "+ update = False", "- print((-1))", "- exit()" ]
false
0.007066
0.03272
0.215954
[ "s553774190", "s337969674" ]
u655110382
p03687
python
s633756371
s623393943
22
18
3,316
3,060
Accepted
Accepted
18.18
from collections import Counter, deque s = eval(input()) n = len(s) d = deque([{char} for char in s]) c = Counter(s) if s[0] * n == s: print((0)) exit() for i in range(1, n): for j in range(n - i): char_j = s[j] char_right = s[j + i] set_j = d[j] if char_ri...
s = eval(input()) a_z = [chr(i) for i in range(97, 97 + 26)] ans = len(s) for alp in a_z: cnt = 0 step = 0 for char in s: if char == alp: cnt = max(cnt, step) step = 0 else: step += 1 ans = min(max(cnt, step), ans) print(ans)
26
14
570
301
from collections import Counter, deque s = eval(input()) n = len(s) d = deque([{char} for char in s]) c = Counter(s) if s[0] * n == s: print((0)) exit() for i in range(1, n): for j in range(n - i): char_j = s[j] char_right = s[j + i] set_j = d[j] if char_right not in set_j: ...
s = eval(input()) a_z = [chr(i) for i in range(97, 97 + 26)] ans = len(s) for alp in a_z: cnt = 0 step = 0 for char in s: if char == alp: cnt = max(cnt, step) step = 0 else: step += 1 ans = min(max(cnt, step), ans) print(ans)
false
46.153846
[ "-from collections import Counter, deque", "-", "-n = len(s)", "-d = deque([{char} for char in s])", "-c = Counter(s)", "-if s[0] * n == s:", "- print((0))", "- exit()", "-for i in range(1, n):", "- for j in range(n - i):", "- char_j = s[j]", "- char_right = s[j + i]", ...
false
0.049078
0.045541
1.077656
[ "s633756371", "s623393943" ]
u102461423
p03482
python
s264809443
s446314598
473
40
20,048
7,892
Accepted
Accepted
91.54
# [a,b] - [a,b) = {b} なので、端の方は自由。 # 中央が単色であるかを確認すればよい。 import numpy as np arr = np.array([int(x) for x in eval(input())]) arr_c = arr.cumsum() N = arr.size answer = 0 for K in range(N,0,-1): left = N-K right = K-1 # [left,right]が単色であればよい if left >= right: answer = K break one_cnt...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import itertools S = [int(x) - ord('0') for x in read().rstrip()] N = len(S) Scum = list(itertools.accumulate(S)) def test(x): if x + x <= N: return True L = N - x ...
25
31
483
583
# [a,b] - [a,b) = {b} なので、端の方は自由。 # 中央が単色であるかを確認すればよい。 import numpy as np arr = np.array([int(x) for x in eval(input())]) arr_c = arr.cumsum() N = arr.size answer = 0 for K in range(N, 0, -1): left = N - K right = K - 1 # [left,right]が単色であればよい if left >= right: answer = K break one_...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import itertools S = [int(x) - ord("0") for x in read().rstrip()] N = len(S) Scum = list(itertools.accumulate(S)) def test(x): if x + x <= N: return True L = N - x R = x cnt = ...
false
19.354839
[ "-# [a,b] - [a,b) = {b} なので、端の方は自由。", "-# 中央が単色であるかを確認すればよい。", "-import numpy as np", "+import sys", "-arr = np.array([int(x) for x in eval(input())])", "-arr_c = arr.cumsum()", "-N = arr.size", "-answer = 0", "-for K in range(N, 0, -1):", "- left = N - K", "- right = K - 1", "- # [le...
false
0.222737
0.037338
5.965489
[ "s264809443", "s446314598" ]
u816587940
p02936
python
s880707791
s145193733
1,953
916
121,420
113,260
Accepted
Accepted
53.1
#入力 n, q = map(int, input().split()) G = [[] for _ in range(n+1)] for i in range(n-1): x, y = map(int, input().split()) G[x].append(y) G[y].append(x) counter = [0 for _ in range(n+1)] for _ in range(q): x, y = map(int, input().split()) counter[x] += y """ #再帰 ans_dfs = [0 for _ in r...
import sys input = lambda: sys.stdin.readline().rstrip() #入力 n, q = map(int, input().split()) G = [[] for _ in range(n+1)] for i in range(n-1): x, y = map(int, input().split()) G[x].append(y) G[y].append(x) counter = [0 for _ in range(n+1)] for _ in range(q): x, y = map(int, input().split()...
58
60
1,180
1,239
# 入力 n, q = map(int, input().split()) G = [[] for _ in range(n + 1)] for i in range(n - 1): x, y = map(int, input().split()) G[x].append(y) G[y].append(x) counter = [0 for _ in range(n + 1)] for _ in range(q): x, y = map(int, input().split()) counter[x] += y """ #再帰 ans_dfs = [0 for _ in range(n)] d...
import sys input = lambda: sys.stdin.readline().rstrip() # 入力 n, q = map(int, input().split()) G = [[] for _ in range(n + 1)] for i in range(n - 1): x, y = map(int, input().split()) G[x].append(y) G[y].append(x) counter = [0 for _ in range(n + 1)] for _ in range(q): x, y = map(int, input().split()) ...
false
3.333333
[ "+import sys", "+", "+input = lambda: sys.stdin.readline().rstrip()" ]
false
0.040319
0.044065
0.914991
[ "s880707791", "s145193733" ]
u910288980
p03435
python
s649295801
s870355429
199
17
38,384
3,064
Accepted
Accepted
91.46
# -*- coding: utf-8 -*- def solve(): c = [list(map(int, input().split())) for _ in range(3)] for a0 in range(-100, 101) : b = [c[0][i] - a0 for i in range(3)] if any(c[1][0] - b[0] != c[1][i] - b[i] for i in range(3)): continue if any(c[2][0] - b[0] != c[2][i] - b[i]...
# -*- coding: utf-8 -*- def solve(): c = [list(map(int, input().split())) for _ in range(3)] for a0 in range(-100, 101) : b = [c[0][i] - a0 for i in range(3)] if any(c[1][0] - b[0] != c[1][i] - b[i] for i in range(3)): continue if any(c[2][0] - b[0] != c[2][i] - b[i]...
18
18
489
463
# -*- coding: utf-8 -*- def solve(): c = [list(map(int, input().split())) for _ in range(3)] for a0 in range(-100, 101): b = [c[0][i] - a0 for i in range(3)] if any(c[1][0] - b[0] != c[1][i] - b[i] for i in range(3)): continue if any(c[2][0] - b[0] != c[2][i] - b[i] for i in ...
# -*- coding: utf-8 -*- def solve(): c = [list(map(int, input().split())) for _ in range(3)] for a0 in range(-100, 101): b = [c[0][i] - a0 for i in range(3)] if any(c[1][0] - b[0] != c[1][i] - b[i] for i in range(3)): continue if any(c[2][0] - b[0] != c[2][i] - b[i] for i in ...
false
0
[ "+ return False", "-if __name__ == \"__main__\":", "- if solve():", "- print(\"Yes\")", "- else:", "- print(\"No\")", "+if solve():", "+ print(\"Yes\")", "+else:", "+ print(\"No\")" ]
false
0.119352
0.03716
3.2118
[ "s649295801", "s870355429" ]
u284854859
p03061
python
s902685098
s194551992
777
263
14,136
14,428
Accepted
Accepted
66.15
import sys input = sys.stdin.readline n = int(eval(input())) a = list(map(int,input().split())) a.sort() #a,bの最大公約数 def gcd(a,b): if b == 0: return a else: return gcd(b,a%b) #リスト l の最大公約数 def gcdlist(l): a = l[0] for i in range(len(l)): a = gcd(a,l[i]) retu...
#a,bの最大公約数 def gcd(a,b): if b == 0: return a else: return gcd(b,a%b) n = int(eval(input())) a = list(map(int,input().split())) #b[i]:a[0]~a[i]までのgcd,c[i]:a[i]~a[-1]までのgcd b = [0]*n c = [0]*n for i in range(n): if i == 0: b[0] = a[0] c[-1] = a[-1] co...
45
25
853
484
import sys input = sys.stdin.readline n = int(eval(input())) a = list(map(int, input().split())) a.sort() # a,bの最大公約数 def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) # リスト l の最大公約数 def gcdlist(l): a = l[0] for i in range(len(l)): a = gcd(a, l[i]) return a #...
# a,bの最大公約数 def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) n = int(eval(input())) a = list(map(int, input().split())) # b[i]:a[0]~a[i]までのgcd,c[i]:a[i]~a[-1]までのgcd b = [0] * n c = [0] * n for i in range(n): if i == 0: b[0] = a[0] c[-1] = a[-1] continue...
false
44.444444
[ "-import sys", "-", "-input = sys.stdin.readline", "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-a.sort()", "-# リスト l の最大公約数", "-def gcdlist(l):", "- a = l[0]", "- for i in range(len(l)):", "- a = gcd(a, l[i])", "- return a", "-", "-", "-# nの約数列挙", ...
false
0.036241
0.036533
0.992009
[ "s902685098", "s194551992" ]
u133936772
p02834
python
s260277829
s581884358
662
467
28,464
28,464
Accepted
Accepted
29.46
f=lambda:list(map(int,input().split())) n,st,sa=f() st-=1 sa-=1 g=[[] for _ in range(n)] for _ in range(n-1): a,b=f() g[a-1].append(b-1) g[b-1].append(a-1) def bfs(s): l=[-1]*n; l[s]=0; q=[s] while q: v=q.pop(); d=l[v]+1 for c in g[v]: if l[c]<0: l[c]=d; q+=[c] return l lt=bfs(...
import sys f=lambda:list(map(int,sys.stdin.readline().split())) n,st,sa=f() st-=1 sa-=1 g=[[] for _ in range(n)] for _ in range(n-1): a,b=f() g[a-1].append(b-1) g[b-1].append(a-1) def bfs(s): l=[-1]*n; l[s]=0; q=[s] while q: v=q.pop(); d=l[v]+1 for c in g[v]: if l[c]<0: l[c]=d; q+...
22
23
400
425
f = lambda: list(map(int, input().split())) n, st, sa = f() st -= 1 sa -= 1 g = [[] for _ in range(n)] for _ in range(n - 1): a, b = f() g[a - 1].append(b - 1) g[b - 1].append(a - 1) def bfs(s): l = [-1] * n l[s] = 0 q = [s] while q: v = q.pop() d = l[v] + 1 for c i...
import sys f = lambda: list(map(int, sys.stdin.readline().split())) n, st, sa = f() st -= 1 sa -= 1 g = [[] for _ in range(n)] for _ in range(n - 1): a, b = f() g[a - 1].append(b - 1) g[b - 1].append(a - 1) def bfs(s): l = [-1] * n l[s] = 0 q = [s] while q: v = q.pop() d =...
false
4.347826
[ "-f = lambda: list(map(int, input().split()))", "+import sys", "+", "+f = lambda: list(map(int, sys.stdin.readline().split()))" ]
false
0.037078
0.036176
1.024943
[ "s260277829", "s581884358" ]
u729133443
p03644
python
s522591681
s237104114
169
17
38,256
2,940
Accepted
Accepted
89.94
print((2**(len(bin(int(eval(input()))))-3)))
print((2**len(bin(int(eval(input()))))>>3))
1
1
36
35
print((2 ** (len(bin(int(eval(input())))) - 3)))
print((2 ** len(bin(int(eval(input())))) >> 3))
false
0
[ "-print((2 ** (len(bin(int(eval(input())))) - 3)))", "+print((2 ** len(bin(int(eval(input())))) >> 3))" ]
false
0.034702
0.03592
0.966095
[ "s522591681", "s237104114" ]
u969850098
p03013
python
s370777768
s018712367
66
60
11,884
11,884
Accepted
Accepted
9.09
import sys input = sys.stdin.readline MOD = 10**9 + 7 N, M = list(map(int, input().split())) broken_floors = set(int(eval(input())) for _ in range(M)) dp = [0]*(N+2) dp[1] = 1 for i in range(1, N+1): if i not in broken_floors: dp[i+1] = (dp[i] + dp[i-1]) % MOD print((dp[-1]))
import sys input = sys.stdin.readline MOD = 10**9 + 7 def main(): N, M = list(map(int, input().split())) broken_floors = set(int(eval(input())) for _ in range(M)) dp = [0]*(N+2) dp[1] = 1 for i in range(1, N+1): if i not in broken_floors: dp[i+1] = (dp[i] + dp[i-1])...
14
18
290
377
import sys input = sys.stdin.readline MOD = 10**9 + 7 N, M = list(map(int, input().split())) broken_floors = set(int(eval(input())) for _ in range(M)) dp = [0] * (N + 2) dp[1] = 1 for i in range(1, N + 1): if i not in broken_floors: dp[i + 1] = (dp[i] + dp[i - 1]) % MOD print((dp[-1]))
import sys input = sys.stdin.readline MOD = 10**9 + 7 def main(): N, M = list(map(int, input().split())) broken_floors = set(int(eval(input())) for _ in range(M)) dp = [0] * (N + 2) dp[1] = 1 for i in range(1, N + 1): if i not in broken_floors: dp[i + 1] = (dp[i] + dp[i - 1]) ...
false
22.222222
[ "-N, M = list(map(int, input().split()))", "-broken_floors = set(int(eval(input())) for _ in range(M))", "-dp = [0] * (N + 2)", "-dp[1] = 1", "-for i in range(1, N + 1):", "- if i not in broken_floors:", "- dp[i + 1] = (dp[i] + dp[i - 1]) % MOD", "-print((dp[-1]))", "+", "+", "+def mai...
false
0.033496
0.033158
1.010219
[ "s370777768", "s018712367" ]
u948524308
p03241
python
s145139759
s984580168
414
20
3,060
3,060
Accepted
Accepted
95.17
N,M=list(map(int,input().split())) if N==1: print(M) exit() if N>=M**0.5: for i in range(M//N,0,-1): if M%i==0: print(i) exit() else: for i in range(N,M+1): if M%i==0: print((M//i)) exit() print((1))
def div(N): ans = [] for i in range(1, int(N ** 0.5) + 1): if N % i == 0: ans.append(i) if N // i != i: ans.append(N // i) ans.sort() return ans N,M=list(map(int,input().split())) if N==1: print(M) exit() divM=div(M) for i i...
16
23
285
400
N, M = list(map(int, input().split())) if N == 1: print(M) exit() if N >= M**0.5: for i in range(M // N, 0, -1): if M % i == 0: print(i) exit() else: for i in range(N, M + 1): if M % i == 0: print((M // i)) exit() print((1))
def div(N): ans = [] for i in range(1, int(N**0.5) + 1): if N % i == 0: ans.append(i) if N // i != i: ans.append(N // i) ans.sort() return ans N, M = list(map(int, input().split())) if N == 1: print(M) exit() divM = div(M) for i in range(1, len(d...
false
30.434783
[ "+def div(N):", "+ ans = []", "+ for i in range(1, int(N**0.5) + 1):", "+ if N % i == 0:", "+ ans.append(i)", "+ if N // i != i:", "+ ans.append(N // i)", "+ ans.sort()", "+ return ans", "+", "+", "-if N >= M**0.5:", "- for i in rang...
false
0.085166
0.037867
2.249063
[ "s145139759", "s984580168" ]
u185249212
p03273
python
s892412058
s905409764
329
291
70,356
67,308
Accepted
Accepted
11.55
# import numpy as np # import numpypy as np import sys input = sys.stdin.readline def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) return import math import string import fractions from fractions import Fraction from fractions import gcd def lcm(n,m): return int(n*m/...
# import numpy as np # import numpypy as np import sys input = sys.stdin.readline def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) return import math import string import fractions from fractions import Fraction from fractions import gcd def lcm(n,m): return int(n*m/...
99
82
2,203
1,670
# import numpy as np # import numpypy as np import sys input = sys.stdin.readline def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) return import math import string import fractions from fractions import Fraction from fractions import gcd def lcm(n, m): return int(n * m / gcd(n, m)...
# import numpy as np # import numpypy as np import sys input = sys.stdin.readline def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) return import math import string import fractions from fractions import Fraction from fractions import gcd def lcm(n, m): return int(n * m / gcd(n, m)...
false
17.171717
[ "+from operator import mul", "+from functools import reduce", "+", "+", "+def combinations_count(n, r):", "+ r = min(r, n - r)", "+ numer = reduce(mul, list(range(n, n - r, -1)), 1)", "+ denom = reduce(mul, list(range(1, r + 1)), 1)", "+ return numer // denom", "+", "+", "- H, W...
false
0.044311
0.078961
0.561177
[ "s892412058", "s905409764" ]
u377989038
p03013
python
s037041247
s455057721
189
68
7,824
7,836
Accepted
Accepted
64.02
n, m = list(map(int, input().split())) a = [int(eval(input())) for _ in range(m)] + [0] mod = 10 ** 9 + 7 dp = [0] * (n + 1) dp[0] = 1 b = a[0] j = 1 for i in range(1, n + 1): if i == b: b = a[j] j += 1 else: tmp = dp[i - 2] + dp[i - 1] if tmp >= mod: ...
import sys input = sys.stdin.buffer.readline n, m = list(map(int, input().split())) a = [int(eval(input())) for _ in range(m)] + [0] mod = 10 ** 9 + 7 dp = [0] * (n + 1) dp[0] = 1 b = a[0] j = 1 for i in range(1, n + 1): if i == b: b = a[j] j += 1 else: tmp = dp[i - 2] ...
18
21
359
408
n, m = list(map(int, input().split())) a = [int(eval(input())) for _ in range(m)] + [0] mod = 10**9 + 7 dp = [0] * (n + 1) dp[0] = 1 b = a[0] j = 1 for i in range(1, n + 1): if i == b: b = a[j] j += 1 else: tmp = dp[i - 2] + dp[i - 1] if tmp >= mod: tmp -= mod ...
import sys input = sys.stdin.buffer.readline n, m = list(map(int, input().split())) a = [int(eval(input())) for _ in range(m)] + [0] mod = 10**9 + 7 dp = [0] * (n + 1) dp[0] = 1 b = a[0] j = 1 for i in range(1, n + 1): if i == b: b = a[j] j += 1 else: tmp = dp[i - 2] + dp[i - 1] ...
false
14.285714
[ "+import sys", "+", "+input = sys.stdin.buffer.readline" ]
false
0.140911
0.13889
1.014549
[ "s037041247", "s455057721" ]
u729133443
p03086
python
s599116034
s780520490
163
19
38,768
3,188
Accepted
Accepted
88.34
import re;print((max(list(map(len,re.findall('[ATGC]*',eval(input())))))))
import re;print((max(list(map(len,re.split('[^ACGT]',eval(input())))))))
1
1
60
58
import re print((max(list(map(len, re.findall("[ATGC]*", eval(input())))))))
import re print((max(list(map(len, re.split("[^ACGT]", eval(input())))))))
false
0
[ "-print((max(list(map(len, re.findall(\"[ATGC]*\", eval(input())))))))", "+print((max(list(map(len, re.split(\"[^ACGT]\", eval(input())))))))" ]
false
0.158477
0.084884
1.866992
[ "s599116034", "s780520490" ]
u144913062
p02892
python
s516036523
s119446368
351
239
54,236
16,956
Accepted
Accepted
31.91
def b(u,x): c[u]=x return all((c[u]!=c[v])&(c[v]or b(v,-x))for v in X if d[u][v]==1) N=int(eval(input())) X=list(range(N)) S=[eval(input())for _ in X] d=[[1 if S[i][j]=='1'else(N if i^j else 0)for j in X]for i in X] for k in X: for i in X: for j in X:d[i][j]=min(d[i][j],d[i][k]+d[k][j]) c=[0]*N print((m...
import scipy.sparse.csgraph as s def b(u,x):c[u]=x;return all(d[u][v]^1or(c[u]!=c[v])&(c[v]or b(v,-x))for v in X) N,*S=open(0) N=int(N) X=list(range(N)) d=[[i^j and(S[i][j]=='1'or N)for j in X]for i in X] c=[0]*N print((int(b(0,1)and s.floyd_warshall(d).max()+2)-1))
12
8
340
266
def b(u, x): c[u] = x return all((c[u] != c[v]) & (c[v] or b(v, -x)) for v in X if d[u][v] == 1) N = int(eval(input())) X = list(range(N)) S = [eval(input()) for _ in X] d = [[1 if S[i][j] == "1" else (N if i ^ j else 0) for j in X] for i in X] for k in X: for i in X: for j in X: d[i][...
import scipy.sparse.csgraph as s def b(u, x): c[u] = x return all(d[u][v] ^ 1 or (c[u] != c[v]) & (c[v] or b(v, -x)) for v in X) N, *S = open(0) N = int(N) X = list(range(N)) d = [[i ^ j and (S[i][j] == "1" or N) for j in X] for i in X] c = [0] * N print((int(b(0, 1) and s.floyd_warshall(d).max() + 2) - 1))...
false
33.333333
[ "+import scipy.sparse.csgraph as s", "+", "+", "- return all((c[u] != c[v]) & (c[v] or b(v, -x)) for v in X if d[u][v] == 1)", "+ return all(d[u][v] ^ 1 or (c[u] != c[v]) & (c[v] or b(v, -x)) for v in X)", "-N = int(eval(input()))", "+N, *S = open(0)", "+N = int(N)", "-S = [eval(input()) for _...
false
0.105823
0.599472
0.176527
[ "s516036523", "s119446368" ]
u952708174
p03325
python
s602466660
s121346714
61
24
4,404
4,148
Accepted
Accepted
60.66
def c_time3_or_div2(N, A): ans = 0 # Aの各要素の因数2の個数の和 for a in A: while a % 2 == 0: ans += 1 a //= 2 return ans N = int(eval(input())) A = [int(i) for i in input().split()] print((c_time3_or_div2(N, A)))
def c_time3_or_div2(N, A): # Aの各要素aにおける因数2の個数の和 # aを2進数として下位ビットから見て、最初に1が現れた桁数が因数2の個数 return sum((bin(a)[::-1].index('1') for a in A)) N = int(eval(input())) A = [int(i) for i in input().split()] print((c_time3_or_div2(N, A)))
11
8
249
238
def c_time3_or_div2(N, A): ans = 0 # Aの各要素の因数2の個数の和 for a in A: while a % 2 == 0: ans += 1 a //= 2 return ans N = int(eval(input())) A = [int(i) for i in input().split()] print((c_time3_or_div2(N, A)))
def c_time3_or_div2(N, A): # Aの各要素aにおける因数2の個数の和 # aを2進数として下位ビットから見て、最初に1が現れた桁数が因数2の個数 return sum((bin(a)[::-1].index("1") for a in A)) N = int(eval(input())) A = [int(i) for i in input().split()] print((c_time3_or_div2(N, A)))
false
27.272727
[ "- ans = 0 # Aの各要素の因数2の個数の和", "- for a in A:", "- while a % 2 == 0:", "- ans += 1", "- a //= 2", "- return ans", "+ # Aの各要素aにおける因数2の個数の和", "+ # aを2進数として下位ビットから見て、最初に1が現れた桁数が因数2の個数", "+ return sum((bin(a)[::-1].index(\"1\") for a in A))" ]
false
0.07026
0.036615
1.91887
[ "s602466660", "s121346714" ]
u864197622
p02563
python
s692457859
s539610906
1,311
943
203,256
196,740
Accepted
Accepted
28.07
p, g = 998244353, 3 invg = pow(g, p-2, p) W = [pow(g, (p - 1) >> i, p) for i in range(24)] iW = [pow(invg, (p - 1) >> i, p) for i in range(24)] def fft(k, f): for l in range(k)[::-1]: d = 1 << l u = 1 for i in range(d): for j in range(i, 1 << k, 2*d): ...
p, g, ig = 998244353, 3, 332748118 W = [pow(g, (p - 1) >> i, p) for i in range(24)] iW = [pow(ig, (p - 1) >> i, p) for i in range(24)] def fft(k, f): for l in range(k, 0, -1): d = 1 << l - 1 for i in range(1 << k - l): u = 1 for j in range(i * 2 * d, (i * 2 + 1) * d...
43
43
1,199
1,243
p, g = 998244353, 3 invg = pow(g, p - 2, p) W = [pow(g, (p - 1) >> i, p) for i in range(24)] iW = [pow(invg, (p - 1) >> i, p) for i in range(24)] def fft(k, f): for l in range(k)[::-1]: d = 1 << l u = 1 for i in range(d): for j in range(i, 1 << k, 2 * d): f[j], ...
p, g, ig = 998244353, 3, 332748118 W = [pow(g, (p - 1) >> i, p) for i in range(24)] iW = [pow(ig, (p - 1) >> i, p) for i in range(24)] def fft(k, f): for l in range(k, 0, -1): d = 1 << l - 1 for i in range(1 << k - l): u = 1 for j in range(i * 2 * d, (i * 2 + 1) * d): ...
false
0
[ "-p, g = 998244353, 3", "-invg = pow(g, p - 2, p)", "+p, g, ig = 998244353, 3, 332748118", "-iW = [pow(invg, (p - 1) >> i, p) for i in range(24)]", "+iW = [pow(ig, (p - 1) >> i, p) for i in range(24)]", "- for l in range(k)[::-1]:", "- d = 1 << l", "- u = 1", "- for i in rang...
false
0.03946
0.044888
0.879065
[ "s692457859", "s539610906" ]
u987164499
p02720
python
s621452038
s256046797
191
105
11,628
18,884
Accepted
Accepted
45.03
from sys import stdin,setrecursionlimit k = int(stdin.readline().rstrip()) li = [i for i in range(1,10)] #ルンルン最初の数 def runrun(before,kazu): if before == 0: li.append(int(kazu+str(before+1))) li.append(int(kazu+str(before))) elif before == 9: li.append(int(kazu+str(before-1))) ...
from queue import deque k = int(eval(input())) que = deque() for i in range(1,10): que.append(i) for i in range(k): if i == (k-1): print((que.popleft())) exit() now = que.popleft() if now%10 != 0: que.append(now*10+now%10-1) que.append(now*10+now%10) if n...
28
17
993
360
from sys import stdin, setrecursionlimit k = int(stdin.readline().rstrip()) li = [i for i in range(1, 10)] # ルンルン最初の数 def runrun(before, kazu): if before == 0: li.append(int(kazu + str(before + 1))) li.append(int(kazu + str(before))) elif before == 9: li.append(int(kazu + str(before - 1...
from queue import deque k = int(eval(input())) que = deque() for i in range(1, 10): que.append(i) for i in range(k): if i == (k - 1): print((que.popleft())) exit() now = que.popleft() if now % 10 != 0: que.append(now * 10 + now % 10 - 1) que.append(now * 10 + now % 10) i...
false
39.285714
[ "-from sys import stdin, setrecursionlimit", "+from queue import deque", "-k = int(stdin.readline().rstrip())", "-li = [i for i in range(1, 10)]", "-# ルンルン最初の数", "-def runrun(before, kazu):", "- if before == 0:", "- li.append(int(kazu + str(before + 1)))", "- li.append(int(kazu + st...
false
0.488377
0.118076
4.136133
[ "s621452038", "s256046797" ]
u858748695
p03007
python
s464667212
s743558658
224
203
14,092
25,040
Accepted
Accepted
9.38
#!/usr/bin/env python3 import bisect n = int(eval(input())) a = sorted(map(int, input().split())) if n == 2: print((a[1] - a[0])) print((a[1], a[0])) exit() p = bisect.bisect_left(a, 0) p = min(max(1, p), n - 1) print((sum(a[p:]) - sum(a[:p]))) b = a[p - 1] for i in range(p, n - 1): print...
n = int(eval(input())) a = sorted(map(int, input().split())) ans = [] for i in range(1, n - 1): # + if a[i] < 0: ans.append([a[-1], a[i]]) a[-1] -= a[i] # - else: ans.append([a[0], a[i]]) a[0] -= a[i] ans.append([a[-1], a[0]]) print((a[-1] - a[0])) for x, y ...
21
16
419
337
#!/usr/bin/env python3 import bisect n = int(eval(input())) a = sorted(map(int, input().split())) if n == 2: print((a[1] - a[0])) print((a[1], a[0])) exit() p = bisect.bisect_left(a, 0) p = min(max(1, p), n - 1) print((sum(a[p:]) - sum(a[:p]))) b = a[p - 1] for i in range(p, n - 1): print((b, a[i])) ...
n = int(eval(input())) a = sorted(map(int, input().split())) ans = [] for i in range(1, n - 1): # + if a[i] < 0: ans.append([a[-1], a[i]]) a[-1] -= a[i] # - else: ans.append([a[0], a[i]]) a[0] -= a[i] ans.append([a[-1], a[0]]) print((a[-1] - a[0])) for x, y in ans: pr...
false
23.809524
[ "-#!/usr/bin/env python3", "-import bisect", "-", "-if n == 2:", "- print((a[1] - a[0]))", "- print((a[1], a[0]))", "- exit()", "-p = bisect.bisect_left(a, 0)", "-p = min(max(1, p), n - 1)", "-print((sum(a[p:]) - sum(a[:p])))", "-b = a[p - 1]", "-for i in range(p, n - 1):", "- pr...
false
0.036901
0.033073
1.115735
[ "s464667212", "s743558658" ]
u968166680
p02861
python
s099518222
s387031146
108
70
3,064
3,188
Accepted
Accepted
35.19
from itertools import permutations from math import factorial N = int(eval(input())) cities = [tuple(map(int, input().split())) for _ in range(N)] dists = [[0] * N for _ in range(N)] for i in range(N): for j in range(i + 1, N): dists[i][j] = dists[j][i] = ( (cities[j][0] - cities[i][...
import sys from itertools import permutations from math import factorial read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 def distance(p, q): return sum((px - qx) ** 2.0 for px, qx in zip(p, q)) ** 0.5 def main(): ...
19
35
539
793
from itertools import permutations from math import factorial N = int(eval(input())) cities = [tuple(map(int, input().split())) for _ in range(N)] dists = [[0] * N for _ in range(N)] for i in range(N): for j in range(i + 1, N): dists[i][j] = dists[j][i] = ( (cities[j][0] - cities[i][0]) ** 2 + ...
import sys from itertools import permutations from math import factorial read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 def distance(p, q): return sum((px - qx) ** 2.0 for px, qx in zip(p, q)) ** 0.5 def main(): N = int(readlin...
false
45.714286
[ "+import sys", "-N = int(eval(input()))", "-cities = [tuple(map(int, input().split())) for _ in range(N)]", "-dists = [[0] * N for _ in range(N)]", "-for i in range(N):", "- for j in range(i + 1, N):", "- dists[i][j] = dists[j][i] = (", "- (cities[j][0] - cities[i][0]) ** 2 + (cit...
false
0.039365
0.040503
0.971891
[ "s099518222", "s387031146" ]
u562935282
p02863
python
s009814554
s138518626
722
565
179,208
46,960
Accepted
Accepted
21.75
def solve(): from collections import namedtuple import sys input = sys.stdin.readline Dish = namedtuple('Dish', 'idx cost pt') n, t = list(map(int, input().split())) dishes = [] for idx in range(1, n + 1): cost, pt = list(map(int, input().split())) dishes.append(...
def solve(): from collections import namedtuple import sys input = sys.stdin.readline Dish = namedtuple('Dish', 'idx cost pt') n, t = list(map(int, input().split())) dishes = [] for idx in range(1, n + 1): cost, pt = list(map(int, input().split())) dishes.append(...
41
30
1,451
962
def solve(): from collections import namedtuple import sys input = sys.stdin.readline Dish = namedtuple("Dish", "idx cost pt") n, t = list(map(int, input().split())) dishes = [] for idx in range(1, n + 1): cost, pt = list(map(int, input().split())) dishes.append(Dish(idx=idx...
def solve(): from collections import namedtuple import sys input = sys.stdin.readline Dish = namedtuple("Dish", "idx cost pt") n, t = list(map(int, input().split())) dishes = [] for idx in range(1, n + 1): cost, pt = list(map(int, input().split())) dishes.append(Dish(idx=idx...
false
26.829268
[ "- dp_ht = [[0] * t for _ in range(n + 2)] # head->tail", "- dp_th = [[0] * t for _ in range(n + 2)] # tail->head", "- # dp[注文可能な範囲の端][完食にかかる総時間]:= 美味しさの最大値", "+ dp = [[0] * 2 for _ in range(t)]", "+ # dp[完食にかかる総時間][最後の皿を選んだか]:= 美味しさの最大値", "- for cost_ in range(t):", "+ fo...
false
0.18281
0.038842
4.706459
[ "s009814554", "s138518626" ]
u915355756
p03073
python
s224247208
s640440607
314
47
21,380
3,188
Accepted
Accepted
85.03
import numpy as np #input S = str(eval(input())) ans = 0 for i in range(len(S)): if i % 2 == 0: if S[i] == "1": ans += 1 else: if S[i] == "0": ans += 1 print((min(ans,len(S)-ans)))
#input #N = list(map(int,input().split())) #H = list(map(int,input().split())) S = str(eval(input())) ans = 0 for i in range(len(S)): if i % 2 == 0: if S[i] == "1": ans += 1 else: if S[i] == "0": ans+= 1 print((min(ans,len(S)-ans)))
12
14
231
286
import numpy as np # input S = str(eval(input())) ans = 0 for i in range(len(S)): if i % 2 == 0: if S[i] == "1": ans += 1 else: if S[i] == "0": ans += 1 print((min(ans, len(S) - ans)))
# input # N = list(map(int,input().split())) # H = list(map(int,input().split())) S = str(eval(input())) ans = 0 for i in range(len(S)): if i % 2 == 0: if S[i] == "1": ans += 1 else: if S[i] == "0": ans += 1 print((min(ans, len(S) - ans)))
false
14.285714
[ "-import numpy as np", "-", "+# N = list(map(int,input().split()))", "+# H = list(map(int,input().split()))" ]
false
0.085296
0.062925
1.355502
[ "s224247208", "s640440607" ]
u088552457
p03393
python
s036292444
s226792729
291
67
63,980
61,972
Accepted
Accepted
76.98
import fractions import sys from functools import reduce import math input = sys.stdin.readline def main(): s = str(eval(input())) abc = 'abcdefghijklmmopqrstuvwxyz' usable = [] for a in list(abc): if a not in s: usable.append(a) if len(usable) > 0: print...
import itertools def main(): a = 'abcdefghijklmnopqrstuvwxyz' s = eval(input()) if len(s) < 26: for v in s: a = a.replace(v, '') print((s + a[0])) elif s == a[::-1]: print((-1)) else: for i in (list(range(25)))[::-1]: if s[i] ...
86
27
1,763
586
import fractions import sys from functools import reduce import math input = sys.stdin.readline def main(): s = str(eval(input())) abc = "abcdefghijklmmopqrstuvwxyz" usable = [] for a in list(abc): if a not in s: usable.append(a) if len(usable) > 0: print((s.strip() + ...
import itertools def main(): a = "abcdefghijklmnopqrstuvwxyz" s = eval(input()) if len(s) < 26: for v in s: a = a.replace(v, "") print((s + a[0])) elif s == a[::-1]: print((-1)) else: for i in (list(range(25)))[::-1]: if s[i] < s[i + 1]: ...
false
68.604651
[ "-import fractions", "-import sys", "-from functools import reduce", "-import math", "-", "-input = sys.stdin.readline", "+import itertools", "- s = str(eval(input()))", "- abc = \"abcdefghijklmmopqrstuvwxyz\"", "- usable = []", "- for a in list(abc):", "- if a not in s:", ...
false
0.054555
0.06248
0.873168
[ "s036292444", "s226792729" ]
u204842730
p02695
python
s535866120
s536202972
1,078
698
9,168
9,204
Accepted
Accepted
35.25
import itertools n,m,q=list(map(int,input().split())) a=[0 for i in range(q)] b=[0 for i in range(q)] c=[0 for i in range(q)] d=[0 for i in range(q)] for i in range(q): a[i],b[i],c[i],d[i]=list(map(int,input().split())) a[i]-=1 b[i]-=1 ans=0 for i in itertools.combinations_with_replacement(list...
import itertools n,m,q=list(map(int,input().split())) a=[0 for i in range(q)] b=[0 for i in range(q)] c=[0 for i in range(q)] d=[0 for i in range(q)] for i in range(q): a[i],b[i],c[i],d[i]=list(map(int,input().split())) a[i]-=1 b[i]-=1 ans=0 buf=[None]*n def dfs(nowdigit,cannum): global a...
19
27
451
604
import itertools n, m, q = list(map(int, input().split())) a = [0 for i in range(q)] b = [0 for i in range(q)] c = [0 for i in range(q)] d = [0 for i in range(q)] for i in range(q): a[i], b[i], c[i], d[i] = list(map(int, input().split())) a[i] -= 1 b[i] -= 1 ans = 0 for i in itertools.combinations_with_rep...
import itertools n, m, q = list(map(int, input().split())) a = [0 for i in range(q)] b = [0 for i in range(q)] c = [0 for i in range(q)] d = [0 for i in range(q)] for i in range(q): a[i], b[i], c[i], d[i] = list(map(int, input().split())) a[i] -= 1 b[i] -= 1 ans = 0 buf = [None] * n def dfs(nowdigit, can...
false
29.62963
[ "-for i in itertools.combinations_with_replacement(list(range(1, m + 1)), n):", "- tmp = 0", "- for j in range(q):", "- if i[b[j]] - i[a[j]] == c[j]:", "- tmp += d[j]", "- ans = max(ans, tmp)", "+buf = [None] * n", "+", "+", "+def dfs(nowdigit, cannum):", "+ global ...
false
0.059296
0.063834
0.92891
[ "s535866120", "s536202972" ]
u764215612
p02690
python
s946361713
s399610567
28
25
9,160
9,088
Accepted
Accepted
10.71
x=int(eval(input())) for i in range(120): for j in range(-95,i): if i**5-j**5==x:print((i,j));exit()
x=int(eval(input())) for i in range(120): for j in range(-90,i): if i**5-j**5==x:print((i,j));exit()
4
4
98
98
x = int(eval(input())) for i in range(120): for j in range(-95, i): if i**5 - j**5 == x: print((i, j)) exit()
x = int(eval(input())) for i in range(120): for j in range(-90, i): if i**5 - j**5 == x: print((i, j)) exit()
false
0
[ "- for j in range(-95, i):", "+ for j in range(-90, i):" ]
false
0.098833
0.154995
0.637651
[ "s946361713", "s399610567" ]
u634677999
p03013
python
s414845805
s376501692
240
219
15,456
84,468
Accepted
Accepted
8.75
from collections import defaultdict as dd n,m=[int(i) for i in input().split()] brkn = dd(int) mod = 10**9+7 for i in range(m): num = int(eval(input())) brkn[num]+=1 dp = [0]*(n+1) dp[0]=1 if(1 in brkn): dp[1]=0 else: dp[1]=1 for i in range(2,n+1): if(i in brkn): dp[i]=0 ...
import sys sys.setrecursionlimit(10**6) from collections import defaultdict as dd n,m=[int(i) for i in input().split()] brkn = dd(int) mod = 10**9+7 for i in range(m): num = int(eval(input())) brkn[num]+=1 dp = [-1]*(n+1) def func(curr): if(curr==0): dp[0]=1 return dp[0] ...
20
30
384
628
from collections import defaultdict as dd n, m = [int(i) for i in input().split()] brkn = dd(int) mod = 10**9 + 7 for i in range(m): num = int(eval(input())) brkn[num] += 1 dp = [0] * (n + 1) dp[0] = 1 if 1 in brkn: dp[1] = 0 else: dp[1] = 1 for i in range(2, n + 1): if i in brkn: dp[i] = 0...
import sys sys.setrecursionlimit(10**6) from collections import defaultdict as dd n, m = [int(i) for i in input().split()] brkn = dd(int) mod = 10**9 + 7 for i in range(m): num = int(eval(input())) brkn[num] += 1 dp = [-1] * (n + 1) def func(curr): if curr == 0: dp[0] = 1 return dp[0] ...
false
33.333333
[ "+import sys", "+", "+sys.setrecursionlimit(10**6)", "-dp = [0] * (n + 1)", "-dp[0] = 1", "-if 1 in brkn:", "- dp[1] = 0", "-else:", "- dp[1] = 1", "-for i in range(2, n + 1):", "- if i in brkn:", "- dp[i] = 0", "+dp = [-1] * (n + 1)", "+", "+", "+def func(curr):", "+...
false
0.007374
0.063502
0.116129
[ "s414845805", "s376501692" ]
u595289165
p03087
python
s444930500
s637462875
1,765
856
16,664
7,748
Accepted
Accepted
51.5
import numpy as np n, q = list(map(int, input().split())) s = eval(input()) w = np.zeros(n, dtype=int) a = 0 for i in range(n): if s[i] == "A": if a == 0: a += 1 elif s[i] == "C": if a: w[i-1] = 1 a -= 1 else: if a: a -...
N, Q = list(map(int, input().split())) S = eval(input()) t=[0]*(N+1) for i in range(N): t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0) for i in range(Q): l, r = list(map(int, input().split())) print((t[r-1] - t[l-1]))
22
9
459
224
import numpy as np n, q = list(map(int, input().split())) s = eval(input()) w = np.zeros(n, dtype=int) a = 0 for i in range(n): if s[i] == "A": if a == 0: a += 1 elif s[i] == "C": if a: w[i - 1] = 1 a -= 1 else: if a: a -= 1 ans = np.a...
N, Q = list(map(int, input().split())) S = eval(input()) t = [0] * (N + 1) for i in range(N): t[i + 1] = t[i] + (1 if S[i : i + 2] == "AC" else 0) for i in range(Q): l, r = list(map(int, input().split())) print((t[r - 1] - t[l - 1]))
false
59.090909
[ "-import numpy as np", "-", "-n, q = list(map(int, input().split()))", "-s = eval(input())", "-w = np.zeros(n, dtype=int)", "-a = 0", "-for i in range(n):", "- if s[i] == \"A\":", "- if a == 0:", "- a += 1", "- elif s[i] == \"C\":", "- if a:", "- w[i...
false
0.379147
0.037282
10.16959
[ "s444930500", "s637462875" ]
u433532588
p02971
python
s157197846
s990156765
706
348
15,636
14,136
Accepted
Accepted
50.71
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] L = [0] * (200000+1) R = [0] * (200000+1) L[0] = 0 for i in range(1, N+1): L[i] = max(A[i-1], L[i-1]) R[N] = 0 for i in range(N-1, 0, -1): R[i] = max(R[i+1], A[i]) #print(L) #print(R) for i in range(N): ans = max(L[i], ...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) ############################## N = int(eval(input())) A = [] for i in range(N): a = int(eval(input())) A.append(a) B = list(reversed(sorted(A))) for i in range(N): # 最大か二番目を出せばいい if A[i] == B[0]: print((B[1])...
20
20
331
339
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] L = [0] * (200000 + 1) R = [0] * (200000 + 1) L[0] = 0 for i in range(1, N + 1): L[i] = max(A[i - 1], L[i - 1]) R[N] = 0 for i in range(N - 1, 0, -1): R[i] = max(R[i + 1], A[i]) # print(L) # print(R) for i in range(N): ans = max(L[i], R[i + 1...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) ############################## N = int(eval(input())) A = [] for i in range(N): a = int(eval(input())) A.append(a) B = list(reversed(sorted(A))) for i in range(N): # 最大か二番目を出せばいい if A[i] == B[0]: print((B[1])) else: ...
false
0
[ "+import sys", "+", "+input = sys.stdin.readline", "+sys.setrecursionlimit(10**6)", "+##############################", "-A = [int(eval(input())) for _ in range(N)]", "-L = [0] * (200000 + 1)", "-R = [0] * (200000 + 1)", "-L[0] = 0", "-for i in range(1, N + 1):", "- L[i] = max(A[i - 1], L[i - ...
false
0.038426
0.036557
1.051137
[ "s157197846", "s990156765" ]
u404676457
p03317
python
s013932171
s090106587
49
29
13,880
4,724
Accepted
Accepted
40.82
(n, k) = list(map(int, input().split())) a = list(map(int, input().split())) count = 0 while n > k: n -= k - 1 count += 1 count += 1 print(count)
(n, k) = list(map(int, input().split())) _ = eval(input()) count = 0 while n > k: n -= k - 1 count += 1 count += 1 print(count)
10
10
158
134
(n, k) = list(map(int, input().split())) a = list(map(int, input().split())) count = 0 while n > k: n -= k - 1 count += 1 count += 1 print(count)
(n, k) = list(map(int, input().split())) _ = eval(input()) count = 0 while n > k: n -= k - 1 count += 1 count += 1 print(count)
false
0
[ "-a = list(map(int, input().split()))", "+_ = eval(input())" ]
false
0.039272
0.007772
5.053034
[ "s013932171", "s090106587" ]
u312025627
p03264
python
s225202663
s786171576
191
161
38,256
38,384
Accepted
Accepted
15.71
k = int(eval(input())) cnt_odd = 0 cnt_even = 0 if k&1: while k >= 1: cnt_odd += 1 k -= 2 cnt_even = cnt_odd - 1 else: while k > 0: cnt_even += 1 k -= 2 cnt_odd = cnt_even print((cnt_even * cnt_odd))
def main(): N = int(eval(input())) odd = (N+1)//2 even = N//2 print((odd*even)) if __name__ == '__main__': main()
15
9
254
136
k = int(eval(input())) cnt_odd = 0 cnt_even = 0 if k & 1: while k >= 1: cnt_odd += 1 k -= 2 cnt_even = cnt_odd - 1 else: while k > 0: cnt_even += 1 k -= 2 cnt_odd = cnt_even print((cnt_even * cnt_odd))
def main(): N = int(eval(input())) odd = (N + 1) // 2 even = N // 2 print((odd * even)) if __name__ == "__main__": main()
false
40
[ "-k = int(eval(input()))", "-cnt_odd = 0", "-cnt_even = 0", "-if k & 1:", "- while k >= 1:", "- cnt_odd += 1", "- k -= 2", "- cnt_even = cnt_odd - 1", "-else:", "- while k > 0:", "- cnt_even += 1", "- k -= 2", "- cnt_odd = cnt_even", "-print((cnt_eve...
false
0.068422
0.038456
1.779221
[ "s225202663", "s786171576" ]
u133936772
p03805
python
s455694221
s296093761
29
25
3,064
3,064
Accepted
Accepted
13.79
f=lambda:list(map(int,input().split())) n,m=f() g=[[0]*n for _ in range(n)] for i in range(m): a,b=f(); g[a-1][b-1]=g[b-1][a-1]=1 import itertools as it c=0 for t in it.permutations(list(range(1,n))): p,d=0,1 for q in t: d*=g[p][q]; p=q c+=d print(c)
f=lambda:list(map(int,input().split())) n,m=f() g=[[0]*n for _ in range(n)] for i in range(m): a,b=f(); g[a-1][b-1]=g[b-1][a-1]=1 import itertools as it c=0 for t in it.permutations(list(range(1,n))): p=0 for q in t: if g[p][q]<1: break p=q else: c+=1 print(c)
12
14
257
277
f = lambda: list(map(int, input().split())) n, m = f() g = [[0] * n for _ in range(n)] for i in range(m): a, b = f() g[a - 1][b - 1] = g[b - 1][a - 1] = 1 import itertools as it c = 0 for t in it.permutations(list(range(1, n))): p, d = 0, 1 for q in t: d *= g[p][q] p = q c += d prin...
f = lambda: list(map(int, input().split())) n, m = f() g = [[0] * n for _ in range(n)] for i in range(m): a, b = f() g[a - 1][b - 1] = g[b - 1][a - 1] = 1 import itertools as it c = 0 for t in it.permutations(list(range(1, n))): p = 0 for q in t: if g[p][q] < 1: break p = q ...
false
14.285714
[ "- p, d = 0, 1", "+ p = 0", "- d *= g[p][q]", "+ if g[p][q] < 1:", "+ break", "- c += d", "+ else:", "+ c += 1" ]
false
0.091268
0.044307
2.059902
[ "s455694221", "s296093761" ]
u820351940
p04001
python
s631547186
s507587997
54
27
3,064
3,064
Accepted
Accepted
50
import itertools nums = eval(input()) index = list(range(1, len(nums))) def resolve(i): t = list(nums) for j in reversed(i): t.insert(j, "+") return eval("".join(t)) print((sum([resolve(i) for i in itertools.chain(*[itertools.combinations(index, x) for x in range(len(index) + 1)])])))
import itertools number = eval(input()) answer = int(number) length = len(number) empty = [""] * length plus = ["+"] * length results = [] for i in range(2**(length - 1)): calc = "" for j in range(length - 1): calc += number[j] if i & 1: calc += "+" i >>= 1...
9
20
293
392
import itertools nums = eval(input()) index = list(range(1, len(nums))) def resolve(i): t = list(nums) for j in reversed(i): t.insert(j, "+") return eval("".join(t)) print( ( sum( [ resolve(i) for i in itertools.chain( ...
import itertools number = eval(input()) answer = int(number) length = len(number) empty = [""] * length plus = ["+"] * length results = [] for i in range(2 ** (length - 1)): calc = "" for j in range(length - 1): calc += number[j] if i & 1: calc += "+" i >>= 1 f = calc + ...
false
55
[ "-nums = eval(input())", "-index = list(range(1, len(nums)))", "-", "-", "-def resolve(i):", "- t = list(nums)", "- for j in reversed(i):", "- t.insert(j, \"+\")", "- return eval(\"\".join(t))", "-", "-", "-print(", "- (", "- sum(", "- [", "- ...
false
0.040682
0.040256
1.010585
[ "s631547186", "s507587997" ]
u197955752
p03785
python
s209166668
s232061740
176
94
13,340
13,264
Accepted
Accepted
46.59
N, C, K = [int(x) for x in input().split()] T = [int(eval(input())) for _ in range(N)] T.sort() depart = T[0] + K # 出発時刻 passenger = 0 # 乗客数 bus = 1 for i in range(N): if passenger >= C or depart < T[i]: # すでに満員または待ち時間オーバー bus += 1 passenger = 1 depart = T[i] + K else: ...
import sys input = sys.stdin.readline N, C, K = [int(x) for x in input().split()] T = [int(eval(input())) for _ in range(N)] T.sort() depart = T[0] + K # 出発時刻 passenger = 0 # 乗客数 bus = 1 for i in range(N): if passenger >= C or depart < T[i]: # すでに満員または待ち時間オーバー bus += 1 passenger = 1 ...
15
17
347
387
N, C, K = [int(x) for x in input().split()] T = [int(eval(input())) for _ in range(N)] T.sort() depart = T[0] + K # 出発時刻 passenger = 0 # 乗客数 bus = 1 for i in range(N): if passenger >= C or depart < T[i]: # すでに満員または待ち時間オーバー bus += 1 passenger = 1 depart = T[i] + K else: passeng...
import sys input = sys.stdin.readline N, C, K = [int(x) for x in input().split()] T = [int(eval(input())) for _ in range(N)] T.sort() depart = T[0] + K # 出発時刻 passenger = 0 # 乗客数 bus = 1 for i in range(N): if passenger >= C or depart < T[i]: # すでに満員または待ち時間オーバー bus += 1 passenger = 1 depa...
false
11.764706
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.074334
0.037322
1.991684
[ "s209166668", "s232061740" ]
u020604402
p03147
python
s860854043
s812407266
21
18
3,188
3,188
Accepted
Accepted
14.29
N = int(eval(input())) L = list(map(int,input().split())) ans = 0 def zero_spliter(L): cnt = 1 for x in L: if x == 0: cnt += 1 M = [[] for _ in range(cnt)] i = 0 for x in L: if x != 0: M[i].append(x) else: i += 1 for x in...
N = int(eval(input())) L = list(map(int,input().split())) def count(L): if len(L) == 1: return L[0] if L == []: return 0 if 0 in L: i = L.index(0) return count(L[:i]) + count(L[i+1:]) else: m = min(L) L = list([x-m for x in L]) retur...
33
16
632
350
N = int(eval(input())) L = list(map(int, input().split())) ans = 0 def zero_spliter(L): cnt = 1 for x in L: if x == 0: cnt += 1 M = [[] for _ in range(cnt)] i = 0 for x in L: if x != 0: M[i].append(x) else: i += 1 for x in M: ...
N = int(eval(input())) L = list(map(int, input().split())) def count(L): if len(L) == 1: return L[0] if L == []: return 0 if 0 in L: i = L.index(0) return count(L[:i]) + count(L[i + 1 :]) else: m = min(L) L = list([x - m for x in L]) return m + c...
false
51.515152
[ "-ans = 0", "-def zero_spliter(L):", "- cnt = 1", "- for x in L:", "- if x == 0:", "- cnt += 1", "- M = [[] for _ in range(cnt)]", "- i = 0", "- for x in L:", "- if x != 0:", "- M[i].append(x)", "- else:", "- i += 1", "- ...
false
0.043833
0.044902
0.976204
[ "s860854043", "s812407266" ]
u471898432
p02813
python
s610880398
s600930843
28
25
8,052
3,060
Accepted
Accepted
10.71
from itertools import permutations N = int(eval(input())) P = tuple(int(x) for x in input().split()) Q = tuple(int(x) for x in input().split()) ps = list(permutations(list(range(1, N + 1)))) ps.index(P) print((abs(ps.index(Q) - ps.index(P))))
from itertools import permutations N = int(eval(input())) P = tuple(int(x) for x in input().split()) Q = tuple(int(x) for x in input().split()) ps = permutations(list(range(1, N + 1))) try: x, y = [i for i, t in enumerate(ps) if t == P or t == Q] except ValueError: print((0)) else: print((ab...
10
14
241
315
from itertools import permutations N = int(eval(input())) P = tuple(int(x) for x in input().split()) Q = tuple(int(x) for x in input().split()) ps = list(permutations(list(range(1, N + 1)))) ps.index(P) print((abs(ps.index(Q) - ps.index(P))))
from itertools import permutations N = int(eval(input())) P = tuple(int(x) for x in input().split()) Q = tuple(int(x) for x in input().split()) ps = permutations(list(range(1, N + 1))) try: x, y = [i for i, t in enumerate(ps) if t == P or t == Q] except ValueError: print((0)) else: print((abs(x - y)))
false
28.571429
[ "-ps = list(permutations(list(range(1, N + 1))))", "-ps.index(P)", "-print((abs(ps.index(Q) - ps.index(P))))", "+ps = permutations(list(range(1, N + 1)))", "+try:", "+ x, y = [i for i, t in enumerate(ps) if t == P or t == Q]", "+except ValueError:", "+ print((0))", "+else:", "+ print((abs...
false
0.039667
0.039666
1.000005
[ "s610880398", "s600930843" ]
u114641312
p02642
python
s710028530
s200437765
1,776
777
114,896
122,340
Accepted
Accepted
56.25
import numpy as np from numba import njit # @njit('(i4[::1],)', cache=True) def solve(A): count = np.zeros(10**6 + 10, np.int32) for x in A: if count[x] > 1: continue count[::x] += 1 ret = 0 for x in A: ret += count[x] == 1 return ret N = int(ev...
import numpy as np from numba import njit # @njit('(i4[::1],)', cache=True) @njit def solve(A): count = np.zeros(10**6 + 10, np.int32) for x in A: if count[x] > 1: continue count[::x] += 1 ret = 0 for x in A: ret += count[x] == 1 return ret N =...
19
20
403
410
import numpy as np from numba import njit # @njit('(i4[::1],)', cache=True) def solve(A): count = np.zeros(10**6 + 10, np.int32) for x in A: if count[x] > 1: continue count[::x] += 1 ret = 0 for x in A: ret += count[x] == 1 return ret N = int(eval(input())) A =...
import numpy as np from numba import njit # @njit('(i4[::1],)', cache=True) @njit def solve(A): count = np.zeros(10**6 + 10, np.int32) for x in A: if count[x] > 1: continue count[::x] += 1 ret = 0 for x in A: ret += count[x] == 1 return ret N = int(eval(input()...
false
5
[ "+@njit" ]
false
0.467638
0.270957
1.725877
[ "s710028530", "s200437765" ]
u753803401
p03387
python
s464113333
s675708137
279
166
63,980
38,336
Accepted
Accepted
40.5
def slove(): import sys import bisect import collections import fractions import heapq input = sys.stdin.readline a, b, c = list(map(int, input().rstrip('\n').split())) cnt = 0 while True: a, b, c = sorted([a, b, c]) if abs(a - c) >= 2: a += 2 ...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 a, b, c = list(map(int, readline().split())) sn = sum([a, b, c]) mn = max(a, b, c) for i in range(mn * 3, 10 ** 10, 3): if (i - sn) % 2 == 0: print(((i - sn) // 2)) exit()...
34
17
781
364
def slove(): import sys import bisect import collections import fractions import heapq input = sys.stdin.readline a, b, c = list(map(int, input().rstrip("\n").split())) cnt = 0 while True: a, b, c = sorted([a, b, c]) if abs(a - c) >= 2: a += 2 ...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 a, b, c = list(map(int, readline().split())) sn = sum([a, b, c]) mn = max(a, b, c) for i in range(mn * 3, 10**10, 3): if (i - sn) % 2 == 0: print(((i - sn) // 2)) exit() if __name__ =...
false
50
[ "-def slove():", "- import sys", "- import bisect", "- import collections", "- import fractions", "- import heapq", "+import sys", "- input = sys.stdin.readline", "- a, b, c = list(map(int, input().rstrip(\"\\n\").split()))", "- cnt = 0", "- while True:", "- a...
false
0.037205
0.055563
0.669591
[ "s464113333", "s675708137" ]
u141610915
p03592
python
s473727039
s736841667
193
176
46,704
38,768
Accepted
Accepted
8.81
import sys input = sys.stdin.readline N, M, K = list(map(int, input().split())) dp = [[0] * (M + 1) for _ in range(N + 1)] for i in range(N + 1): for j in range(M + 1): dp[i][j] = i * M + j * N - 2 * i * j if dp[i][j] == K: print("Yes") exit(0) print("No")
import sys input = sys.stdin.readline N, M, K = list(map(int, input().split())) for i in range(N + 1): for j in range(M + 1): if i * M + j * N - i * j * 2 == K: print("Yes") exit(0) print("No")
11
9
282
213
import sys input = sys.stdin.readline N, M, K = list(map(int, input().split())) dp = [[0] * (M + 1) for _ in range(N + 1)] for i in range(N + 1): for j in range(M + 1): dp[i][j] = i * M + j * N - 2 * i * j if dp[i][j] == K: print("Yes") exit(0) print("No")
import sys input = sys.stdin.readline N, M, K = list(map(int, input().split())) for i in range(N + 1): for j in range(M + 1): if i * M + j * N - i * j * 2 == K: print("Yes") exit(0) print("No")
false
18.181818
[ "-dp = [[0] * (M + 1) for _ in range(N + 1)]", "- dp[i][j] = i * M + j * N - 2 * i * j", "- if dp[i][j] == K:", "+ if i * M + j * N - i * j * 2 == K:" ]
false
0.035494
0.04214
0.842291
[ "s473727039", "s736841667" ]
u123756661
p03805
python
s861018210
s184220268
190
80
41,200
79,752
Accepted
Accepted
57.89
import itertools n,m=list(map(int,input().split())) path={i+1:[] for i in range(n)} for i in range(m): u,v=list(map(int,input().split())) path[u].append(v) path[v].append(u) chk=[i for i in range(2,n+1)] ans=0 for way in list(itertools.permutations(chk)): now=1 if way[0] in path[now]: ...
import itertools n,m=list(map(int,input().split())) l=[[0]*n for i in range(n)] for i in range(m): a,b=list(map(int,input().split())) l[a-1][b-1]=1 l[b-1][a-1]=1 d=[int(i)+1 for i in range(n)] ans=chk=0 for i in list(itertools.permutations(d,n)): chk=1 if i[0]!=1: continue for j in r...
22
16
498
378
import itertools n, m = list(map(int, input().split())) path = {i + 1: [] for i in range(n)} for i in range(m): u, v = list(map(int, input().split())) path[u].append(v) path[v].append(u) chk = [i for i in range(2, n + 1)] ans = 0 for way in list(itertools.permutations(chk)): now = 1 if way[0] in pa...
import itertools n, m = list(map(int, input().split())) l = [[0] * n for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) l[a - 1][b - 1] = 1 l[b - 1][a - 1] = 1 d = [int(i) + 1 for i in range(n)] ans = chk = 0 for i in list(itertools.permutations(d, n)): chk = 1 if i[0] != ...
false
27.272727
[ "-path = {i + 1: [] for i in range(n)}", "+l = [[0] * n for i in range(n)]", "- u, v = list(map(int, input().split()))", "- path[u].append(v)", "- path[v].append(u)", "-chk = [i for i in range(2, n + 1)]", "-ans = 0", "-for way in list(itertools.permutations(chk)):", "- now = 1", "- ...
false
0.123093
0.065624
1.875726
[ "s861018210", "s184220268" ]
u645250356
p03006
python
s762116765
s646065076
190
40
39,280
10,708
Accepted
Accepted
78.95
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpln(n): return list(int...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) ...
28
21
755
580
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpln(n...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.read...
false
25
[ "-import sys, bisect, math, itertools, pprint", "+import sys, bisect, math, itertools, fractions, pprint", "+INF = float(\"inf\")", "-def inpln(n):", "- return list(int(sys.stdin.readline()) for i in range(n))", "-", "-", "-a = [inpl() for i in range(n)]", "-a.sort(key=lambda x: x[1])", "-a.sor...
false
0.04137
0.040479
1.022005
[ "s762116765", "s646065076" ]
u064505481
p03175
python
s882781448
s126305967
1,536
282
942,488
114,524
Accepted
Accepted
81.64
from sys import stdin, stdout, setrecursionlimit from collections import deque, defaultdict, Counter from heapq import heappush, heappop from functools import lru_cache import math setrecursionlimit(10**6) rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: list(map(int, stdin.r...
from sys import stdin, stdout, setrecursionlimit from collections import deque, defaultdict, Counter from heapq import heappush, heappop from functools import lru_cache import math setrecursionlimit(10**6) rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: list(map(int, stdin.r...
43
52
912
1,151
from sys import stdin, stdout, setrecursionlimit from collections import deque, defaultdict, Counter from heapq import heappush, heappop from functools import lru_cache import math setrecursionlimit(10**6) rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: list(map(int, stdin.readline()...
from sys import stdin, stdout, setrecursionlimit from collections import deque, defaultdict, Counter from heapq import heappush, heappop from functools import lru_cache import math setrecursionlimit(10**6) rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: list(map(int, stdin.readline()...
false
17.307692
[ "-", "- def dfs(node, prnt):", "- w, b = 1, 1", "- for nbhr in G[node]:", "- if nbhr == prnt:", "- continue", "- nw, nb = dfs(nbhr, node)", "- w *= nw + nb", "- w %= MOD", "- b *= nw", "- b %= MOD",...
false
0.048036
0.048413
0.99221
[ "s882781448", "s126305967" ]
u393253137
p03292
python
s526611136
s096304503
20
17
3,060
2,940
Accepted
Accepted
15
a,b,c=sorted(map(int,input().split())) print((c-a))
A=list(map(int,input().split())) print((max(A)-min(A)))
2
2
50
54
a, b, c = sorted(map(int, input().split())) print((c - a))
A = list(map(int, input().split())) print((max(A) - min(A)))
false
0
[ "-a, b, c = sorted(map(int, input().split()))", "-print((c - a))", "+A = list(map(int, input().split()))", "+print((max(A) - min(A)))" ]
false
0.039614
0.039733
0.996995
[ "s526611136", "s096304503" ]
u646264672
p03597
python
s264475148
s304716834
20
17
3,316
2,940
Accepted
Accepted
15
N=int(eval(input())) A=int(eval(input())) print((N**2-A))
n=int(eval(input())) a=int(eval(input())) print((n*n-a))
3
3
45
45
N = int(eval(input())) A = int(eval(input())) print((N**2 - A))
n = int(eval(input())) a = int(eval(input())) print((n * n - a))
false
0
[ "-N = int(eval(input()))", "-A = int(eval(input()))", "-print((N**2 - A))", "+n = int(eval(input()))", "+a = int(eval(input()))", "+print((n * n - a))" ]
false
0.049222
0.051156
0.962192
[ "s264475148", "s304716834" ]
u562016607
p02815
python
s732101698
s989242117
708
549
25,508
31,624
Accepted
Accepted
22.46
N=int(eval(input())) c=sorted([int(i) for i in input().split()]) mod=10**9+7 ans=0 for i in range(N): ans+=(c[i]*(((N-i+1)*pow(2,(N-2)%(mod-1),mod))%mod))%mod ans%=mod print(((ans*pow(2,N,mod))%mod))
N=int(eval(input())) c=list(map(int,input().split())) c.sort() m=10**9+7 ans=0 for i in range(N): ans+=(c[i]*(N-i+1)*pow(2,(N-2)%(m-1),m))%m print(((ans*pow(2,N,m))%m))
8
8
206
171
N = int(eval(input())) c = sorted([int(i) for i in input().split()]) mod = 10**9 + 7 ans = 0 for i in range(N): ans += (c[i] * (((N - i + 1) * pow(2, (N - 2) % (mod - 1), mod)) % mod)) % mod ans %= mod print(((ans * pow(2, N, mod)) % mod))
N = int(eval(input())) c = list(map(int, input().split())) c.sort() m = 10**9 + 7 ans = 0 for i in range(N): ans += (c[i] * (N - i + 1) * pow(2, (N - 2) % (m - 1), m)) % m print(((ans * pow(2, N, m)) % m))
false
0
[ "-c = sorted([int(i) for i in input().split()])", "-mod = 10**9 + 7", "+c = list(map(int, input().split()))", "+c.sort()", "+m = 10**9 + 7", "- ans += (c[i] * (((N - i + 1) * pow(2, (N - 2) % (mod - 1), mod)) % mod)) % mod", "- ans %= mod", "-print(((ans * pow(2, N, mod)) % mod))", "+ ans +...
false
0.038661
0.040853
0.946347
[ "s732101698", "s989242117" ]
u768256617
p03160
python
s681310592
s596050196
141
128
13,980
13,928
Accepted
Accepted
9.22
n=int(eval(input())) h=list(map(int,input().split())) dp=[float('inf')]*(n+1) dp[1]=0 dp[0]=0 dp[2]=dp[1]+abs(h[1]-h[0]) for i in range(1,n-1): dp[i+2]=min(dp[i+1]+abs(h[i+1]-h[i]),dp[i]+abs(h[i+1]-h[i-1])) print((dp[n]))
n=int(eval(input())) h=list(map(int,input().split())) dp=[float('inf')]*n dp[0]=0 dp[1]=abs(h[1]-h[0]) for i in range(2,n): dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2])) #print(dp) print((dp[n-1]))
11
11
229
222
n = int(eval(input())) h = list(map(int, input().split())) dp = [float("inf")] * (n + 1) dp[1] = 0 dp[0] = 0 dp[2] = dp[1] + abs(h[1] - h[0]) for i in range(1, n - 1): dp[i + 2] = min(dp[i + 1] + abs(h[i + 1] - h[i]), dp[i] + abs(h[i + 1] - h[i - 1])) print((dp[n]))
n = int(eval(input())) h = list(map(int, input().split())) dp = [float("inf")] * n dp[0] = 0 dp[1] = abs(h[1] - h[0]) for i in range(2, n): dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2])) # print(dp) print((dp[n - 1]))
false
0
[ "-dp = [float(\"inf\")] * (n + 1)", "-dp[1] = 0", "+dp = [float(\"inf\")] * n", "-dp[2] = dp[1] + abs(h[1] - h[0])", "-for i in range(1, n - 1):", "- dp[i + 2] = min(dp[i + 1] + abs(h[i + 1] - h[i]), dp[i] + abs(h[i + 1] - h[i - 1]))", "-print((dp[n]))", "+dp[1] = abs(h[1] - h[0])", "+for i in ra...
false
0.035924
0.054227
0.662476
[ "s681310592", "s596050196" ]
u532022710
p02911
python
s189626264
s283023949
249
152
10,448
10,444
Accepted
Accepted
38.96
n, k, q = list(map(int, input().split())) q_list = [int(eval(input())) for i in range(q)] arr = [k - q] * n for q_i in q_list: arr[q_i - 1] += 1 for go_or_not in arr: if go_or_not > 0: print("Yes") else: print("No")
#!/usr/bin/env python3 import sys def solve(N: int, K: int, Q: int, A: "List[int]"): arr = [K - Q] * N for a in A: arr[a - 1] += 1 for go_or_not in arr: if go_or_not > 0: print("Yes") else: print("No") return def main(): de...
13
36
247
727
n, k, q = list(map(int, input().split())) q_list = [int(eval(input())) for i in range(q)] arr = [k - q] * n for q_i in q_list: arr[q_i - 1] += 1 for go_or_not in arr: if go_or_not > 0: print("Yes") else: print("No")
#!/usr/bin/env python3 import sys def solve(N: int, K: int, Q: int, A: "List[int]"): arr = [K - Q] * N for a in A: arr[a - 1] += 1 for go_or_not in arr: if go_or_not > 0: print("Yes") else: print("No") return def main(): def iterate_tokens(): ...
false
63.888889
[ "-n, k, q = list(map(int, input().split()))", "-q_list = [int(eval(input())) for i in range(q)]", "-arr = [k - q] * n", "-for q_i in q_list:", "- arr[q_i - 1] += 1", "-for go_or_not in arr:", "- if go_or_not > 0:", "- print(\"Yes\")", "- else:", "- print(\"No\")", "+#!/usr...
false
0.079913
0.104585
0.764094
[ "s189626264", "s283023949" ]
u638282348
p02696
python
s395056518
s395442430
22
20
9,104
9,104
Accepted
Accepted
9.09
A, B, N = list(map(int, input().split())) print(((lambda x: int(A * x / B) - A * int(x / B))(min(B - 1, N))))
print(((lambda a, b, n: a * min(b - 1, n) // b - min(b - 1, n) // b * a)(*list(map(int, input().split())))))
2
1
103
101
A, B, N = list(map(int, input().split())) print(((lambda x: int(A * x / B) - A * int(x / B))(min(B - 1, N))))
print( ( (lambda a, b, n: a * min(b - 1, n) // b - min(b - 1, n) // b * a)( *list(map(int, input().split())) ) ) )
false
50
[ "-A, B, N = list(map(int, input().split()))", "-print(((lambda x: int(A * x / B) - A * int(x / B))(min(B - 1, N))))", "+print(", "+ (", "+ (lambda a, b, n: a * min(b - 1, n) // b - min(b - 1, n) // b * a)(", "+ *list(map(int, input().split()))", "+ )", "+ )", "+)" ]
false
0.043643
0.048038
0.908505
[ "s395056518", "s395442430" ]
u179169725
p02883
python
s402453744
s122475622
1,156
496
106,956
106,956
Accepted
Accepted
57.09
# https://atcoder.jp/contests/abc144/tasks/abc144_e # 修行を行わないときに最適なのは両方を逆順でソートしておくこと # そうしたときになるべく食べ物のコストの大きい方から修行していったほうが最適なので # greedyにKをみたすまで引いてあげる # 求めたいのは最大値! # 最小はxにできると仮定してみる? # 答えはxより小さくなる→greedyに(Ai-a)Fi<xして判定すれば良い import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range...
# https://atcoder.jp/contests/abc144/tasks/abc144_e # 修行を行わないときに最適なのは両方を逆順でソートしておくこと # そうしたときになるべく食べ物のコストの大きい方から修行していったほうが最適なので # greedyにKをみたすまで引いてあげる # 求めたいのは最大値! # 最小はxにできると仮定してみる? # 答えはxより小さくなる→greedyに(Ai-a)Fi<xして判定すれば良い import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range...
61
59
1,224
1,196
# https://atcoder.jp/contests/abc144/tasks/abc144_e # 修行を行わないときに最適なのは両方を逆順でソートしておくこと # そうしたときになるべく食べ物のコストの大きい方から修行していったほうが最適なので # greedyにKをみたすまで引いてあげる # 求めたいのは最大値! # 最小はxにできると仮定してみる? # 答えはxより小さくなる→greedyに(Ai-a)Fi<xして判定すれば良い import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate ...
# https://atcoder.jp/contests/abc144/tasks/abc144_e # 修行を行わないときに最適なのは両方を逆順でソートしておくこと # そうしたときになるべく食べ物のコストの大きい方から修行していったほうが最適なので # greedyにKをみたすまで引いてあげる # 求めたいのは最大値! # 最小はxにできると仮定してみる? # 答えはxより小さくなる→greedyに(Ai-a)Fi<xして判定すれば良い import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate ...
false
3.278689
[ "-from math import ceil", "-", "-", "- a = ceil(A[i] - x / F[i]) # Kから使うべき個数", "+ a = A[i] - (x // F[i]) # Kから使うべき個数" ]
false
0.063942
0.113861
0.561582
[ "s402453744", "s122475622" ]
u684241248
p02241
python
s380781427
s228960811
300
20
6,868
6,464
Accepted
Accepted
93.33
# -*- coding: utf-8 -*- def prim(edges, *, start=0, adj_matrix=False, default_value=float('inf')): ''' Returns the Minimum Spanning Tree(MST) of a given graph # sample input when given not as adjacency list (generally works faster) edges = [[(1, 2), (2, 5), (3, 4)], # node 0 ...
# -*- coding: utf-8 -*- from heapq import heappop, heappush def prim(edges, *, start=0, adj_matrix=False, default_value=float('inf')): ''' Returns the Minimum Spanning Tree(MST) of a given graph # sample input when given not as adjacency list (adj_matrix=False) (generally works faster) edges...
62
75
2,103
2,466
# -*- coding: utf-8 -*- def prim(edges, *, start=0, adj_matrix=False, default_value=float("inf")): """ Returns the Minimum Spanning Tree(MST) of a given graph # sample input when given not as adjacency list (generally works faster) edges = [[(1, 2), (2, 5), (3, 4)], # node 0 [(0, 2)...
# -*- coding: utf-8 -*- from heapq import heappop, heappush def prim(edges, *, start=0, adj_matrix=False, default_value=float("inf")): """ Returns the Minimum Spanning Tree(MST) of a given graph # sample input when given not as adjacency list (adj_matrix=False) (generally works faster) edges = [[(1, 2...
false
17.333333
[ "+from heapq import heappop, heappush", "+", "+", "- # sample input when given not as adjacency list (generally works faster)", "+ # sample input when given not as adjacency list (adj_matrix=False) (generally works faster)", "- # sample input when given as adjacency matrix", "+ # sample inpu...
false
0.039699
0.037822
1.049624
[ "s380781427", "s228960811" ]
u407160848
p02698
python
s998363605
s676889671
1,473
1,287
356,120
355,872
Accepted
Accepted
12.63
from bisect import bisect_left import sys sys.setrecursionlimit(10**7) # def input(): return sys.stdin.readline().strip() # スペース区切りの入力を読み込んで数値リストにして返します。 def get_nums_l(): return [ int(s) for s in input().split(" ")] def log(*args): print("DEBUG:", *args, file=sys.stderr) INF = 9999999999999999...
from bisect import bisect_left import sys sys.setrecursionlimit(10**7) def input(): return sys.stdin.readline().strip() # スペース区切りの入力を読み込んで数値リストにして返します。 def get_nums_l(): return [ int(s) for s in input().split(" ")] def log(*args): print("DEBUG:", *args, file=sys.stderr) INF = 999999999999999999...
64
64
1,229
1,220
from bisect import bisect_left import sys sys.setrecursionlimit(10**7) # def input(): return sys.stdin.readline().strip() # スペース区切りの入力を読み込んで数値リストにして返します。 def get_nums_l(): return [int(s) for s in input().split(" ")] def log(*args): print("DEBUG:", *args, file=sys.stderr) INF = 999999999999999999999999 n = ...
from bisect import bisect_left import sys sys.setrecursionlimit(10**7) def input(): return sys.stdin.readline().strip() # スペース区切りの入力を読み込んで数値リストにして返します。 def get_nums_l(): return [int(s) for s in input().split(" ")] def log(*args): print("DEBUG:", *args, file=sys.stderr) INF = 99999999999999999999999...
false
0
[ "-# def input(): return sys.stdin.readline().strip()", "+", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "- line = input().strip()", "+ line = input()" ]
false
0.07119
0.098159
0.725247
[ "s998363605", "s676889671" ]
u798557584
p03109
python
s472942446
s003551881
44
17
4,692
2,940
Accepted
Accepted
61.36
# abc119_a from datetime import datetime S=eval(input()) to_dt=datetime.strptime(S,'%Y/%m/%d') # 2019/04/30 from_dt=datetime(2019,4,30) # 2019/04/30以前であれば、"Heisei" # 以降は"TBD" if to_dt <= from_dt: print("Heisei") else: print("TBD")
# abc119_a year, month, day = list(map(int, input().split("/"))) if month <= 4: print("Heisei") else: print("TBD") """ from datetime import datetime S=input() to_dt=datetime.strptime(S,'%Y/%m/%d') # 2019/04/30 from_dt=datetime(2019,4,30) # 2019/04/30以前であれば、"Heisei" # 以降は"TBD" if to_dt <= from_dt: pr...
12
20
238
355
# abc119_a from datetime import datetime S = eval(input()) to_dt = datetime.strptime(S, "%Y/%m/%d") # 2019/04/30 from_dt = datetime(2019, 4, 30) # 2019/04/30以前であれば、"Heisei" # 以降は"TBD" if to_dt <= from_dt: print("Heisei") else: print("TBD")
# abc119_a year, month, day = list(map(int, input().split("/"))) if month <= 4: print("Heisei") else: print("TBD") """ from datetime import datetime S=input() to_dt=datetime.strptime(S,'%Y/%m/%d') # 2019/04/30 from_dt=datetime(2019,4,30) # 2019/04/30以前であれば、"Heisei" # 以降は"TBD" if to_dt <= from_dt: print("Heisei...
false
40
[ "+year, month, day = list(map(int, input().split(\"/\")))", "+if month <= 4:", "+ print(\"Heisei\")", "+else:", "+ print(\"TBD\")", "+\"\"\"", "-", "-S = eval(input())", "-to_dt = datetime.strptime(S, \"%Y/%m/%d\")", "+S=input()", "+to_dt=datetime.strptime(S,'%Y/%m/%d')", "-from_dt = dat...
false
0.128375
0.146576
0.875826
[ "s472942446", "s003551881" ]
u018679195
p04039
python
s315533372
s581742598
188
133
40,300
3,060
Accepted
Accepted
29.26
n, k = list(map(int, input().split())) d = list(map(str, input().split())) digits = set(d) num = {str(i) for i in range(0,10)} left = num - digits for i in range(n, 100000): Nums = set(str(i)) if Nums <= left: print(i) break
n,k = input().split(" ") l = input().split(" ") l1 = ['0','1','2','3','4','5','6','7','8','9'] d = sorted(list(set(l1)-set(l))) i = int(n) while(True): if set(list(str(i))).difference(set(d))==set(): break else: i+=1 print(i)
10
11
245
259
n, k = list(map(int, input().split())) d = list(map(str, input().split())) digits = set(d) num = {str(i) for i in range(0, 10)} left = num - digits for i in range(n, 100000): Nums = set(str(i)) if Nums <= left: print(i) break
n, k = input().split(" ") l = input().split(" ") l1 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] d = sorted(list(set(l1) - set(l))) i = int(n) while True: if set(list(str(i))).difference(set(d)) == set(): break else: i += 1 print(i)
false
9.090909
[ "-n, k = list(map(int, input().split()))", "-d = list(map(str, input().split()))", "-digits = set(d)", "-num = {str(i) for i in range(0, 10)}", "-left = num - digits", "-for i in range(n, 100000):", "- Nums = set(str(i))", "- if Nums <= left:", "- print(i)", "+n, k = input().split(\" ...
false
0.037192
0.043367
0.857609
[ "s315533372", "s581742598" ]
u912237403
p00030
python
s018665355
s812818206
20
10
4,260
4,252
Accepted
Accepted
50
def dec2bin(n, base=10): s = format(n,'b') s = "0"*(10-len(s))+s return s x=[[0]*50 for i in range(11)] for i in range(0, 2**10): B = dec2bin(i) s = 0 c = B.count("1") j = 0 for e in B: if e=="1": s+=j j+=1 x[c][s]+=1 while 1: n, s=list(map(int...
x = [[0]*50 for i in range(11)] for i in range(0, 2**10): B = format(i,'b')[::-1] s,c,j = 0,0,0 for e in B: if e=="1": s,c = s+j, c+1 j += 1 x[c][s]+=1 while 1: n, s=list(map(int, input().split())) if n==0 and s==0: break print(0 if s>=50 else x[n][s])
21
13
414
306
def dec2bin(n, base=10): s = format(n, "b") s = "0" * (10 - len(s)) + s return s x = [[0] * 50 for i in range(11)] for i in range(0, 2**10): B = dec2bin(i) s = 0 c = B.count("1") j = 0 for e in B: if e == "1": s += j j += 1 x[c][s] += 1 while 1: n, s...
x = [[0] * 50 for i in range(11)] for i in range(0, 2**10): B = format(i, "b")[::-1] s, c, j = 0, 0, 0 for e in B: if e == "1": s, c = s + j, c + 1 j += 1 x[c][s] += 1 while 1: n, s = list(map(int, input().split())) if n == 0 and s == 0: break print(0 if s...
false
38.095238
[ "-def dec2bin(n, base=10):", "- s = format(n, \"b\")", "- s = \"0\" * (10 - len(s)) + s", "- return s", "-", "-", "- B = dec2bin(i)", "- s = 0", "- c = B.count(\"1\")", "- j = 0", "+ B = format(i, \"b\")[::-1]", "+ s, c, j = 0, 0, 0", "- s += j", "+ ...
false
0.042779
0.0435
0.983439
[ "s018665355", "s812818206" ]
u525065967
p02627
python
s285300521
s526037027
31
24
9,004
9,068
Accepted
Accepted
22.58
# print('a' if 'a' <= input() <= 'z' else 'A') print((['A','a']['a' <= eval(input()) <= 'z']))
# print('a' if 'a' <= input() <= 'z' else 'A') # print(['A','a']['a' <= input() <= 'z']) print((['A','a'][input().islower()]))
2
3
88
127
# print('a' if 'a' <= input() <= 'z' else 'A') print((["A", "a"]["a" <= eval(input()) <= "z"]))
# print('a' if 'a' <= input() <= 'z' else 'A') # print(['A','a']['a' <= input() <= 'z']) print((["A", "a"][input().islower()]))
false
33.333333
[ "-print(([\"A\", \"a\"][\"a\" <= eval(input()) <= \"z\"]))", "+# print(['A','a']['a' <= input() <= 'z'])", "+print(([\"A\", \"a\"][input().islower()]))" ]
false
0.040888
0.04913
0.832242
[ "s285300521", "s526037027" ]
u343977188
p02624
python
s664438407
s530112890
1,423
661
9,052
108,880
Accepted
Accepted
53.55
def main(N): x = 0 for a in range(1, N+1): b=N//a x += a*b*(b+1)//2 return x N = int(eval(input())) print((main(N)))
import numba @numba.njit def main(N): x = 0 for a in range(1, N+1): b=N//a x += a*b*(b+1)//2 return x N = int(eval(input())) print((main(N)))
9
10
146
170
def main(N): x = 0 for a in range(1, N + 1): b = N // a x += a * b * (b + 1) // 2 return x N = int(eval(input())) print((main(N)))
import numba @numba.njit def main(N): x = 0 for a in range(1, N + 1): b = N // a x += a * b * (b + 1) // 2 return x N = int(eval(input())) print((main(N)))
false
10
[ "+import numba", "+", "+", "+@numba.njit" ]
false
0.007842
0.037595
0.208588
[ "s664438407", "s530112890" ]
u057109575
p03001
python
s013242582
s290415270
174
57
38,256
61,764
Accepted
Accepted
67.24
W, H, x, y = list(map(float, input().split())) ans1 = W * H / 2 ans2 = int(W / 2 == x and H / 2 == y) print((ans1, ans2))
W, H, x, y = list(map(int, input().split())) ans0 = float(W * H) / 2 ans1 = 0 if W%2 == 0 and H%2 == 0 and W//2 == x and H//2 == y: ans1 = 1 print((ans0, ans1))
4
9
117
172
W, H, x, y = list(map(float, input().split())) ans1 = W * H / 2 ans2 = int(W / 2 == x and H / 2 == y) print((ans1, ans2))
W, H, x, y = list(map(int, input().split())) ans0 = float(W * H) / 2 ans1 = 0 if W % 2 == 0 and H % 2 == 0 and W // 2 == x and H // 2 == y: ans1 = 1 print((ans0, ans1))
false
55.555556
[ "-W, H, x, y = list(map(float, input().split()))", "-ans1 = W * H / 2", "-ans2 = int(W / 2 == x and H / 2 == y)", "-print((ans1, ans2))", "+W, H, x, y = list(map(int, input().split()))", "+ans0 = float(W * H) / 2", "+ans1 = 0", "+if W % 2 == 0 and H % 2 == 0 and W // 2 == x and H // 2 == y:", "+ ...
false
0.035701
0.037529
0.951278
[ "s013242582", "s290415270" ]
u922449550
p03311
python
s946011303
s424152660
212
185
27,240
26,708
Accepted
Accepted
12.74
import statistics N = int(eval(input())) A = list(map(int, input().split())) A = [a - i for i, a in enumerate(A, 1)] b = statistics.median(A) ans = int(sum([abs(a-b) for a in A])) print(ans)
N = int(eval(input())) A = list(map(int, input().split())) A = sorted([a - i for i, a in enumerate(A, 1)]) b = A[(N - 1)//2] ans = sum([abs(a-b) for a in A]) print(ans)
9
7
194
169
import statistics N = int(eval(input())) A = list(map(int, input().split())) A = [a - i for i, a in enumerate(A, 1)] b = statistics.median(A) ans = int(sum([abs(a - b) for a in A])) print(ans)
N = int(eval(input())) A = list(map(int, input().split())) A = sorted([a - i for i, a in enumerate(A, 1)]) b = A[(N - 1) // 2] ans = sum([abs(a - b) for a in A]) print(ans)
false
22.222222
[ "-import statistics", "-", "-A = [a - i for i, a in enumerate(A, 1)]", "-b = statistics.median(A)", "-ans = int(sum([abs(a - b) for a in A]))", "+A = sorted([a - i for i, a in enumerate(A, 1)])", "+b = A[(N - 1) // 2]", "+ans = sum([abs(a - b) for a in A])" ]
false
0.062221
0.112643
0.552372
[ "s946011303", "s424152660" ]
u130900604
p02753
python
s353847174
s155671695
37
17
3,060
2,940
Accepted
Accepted
54.05
s=list(eval(input())) if len(set(s))==2: print("Yes") else: print("No")
if eval(input()) in ["AAA","BBB"]: print("No") else: print("Yes")
5
4
78
66
s = list(eval(input())) if len(set(s)) == 2: print("Yes") else: print("No")
if eval(input()) in ["AAA", "BBB"]: print("No") else: print("Yes")
false
20
[ "-s = list(eval(input()))", "-if len(set(s)) == 2:", "+if eval(input()) in [\"AAA\", \"BBB\"]:", "+ print(\"No\")", "+else:", "-else:", "- print(\"No\")" ]
false
0.037245
0.037671
0.988686
[ "s353847174", "s155671695" ]
u352394527
p00112
python
s481430013
s015881770
110
100
5,720
6,152
Accepted
Accepted
9.09
while True: n = int(eval(input())) if not n: break else: lst = [int(eval(input())) for _ in range(n)] lst.sort() acc = ans = 0 for i in lst: ans += acc acc += i print(ans)
while True: n = int(eval(input())) if not n: break lst = sorted([int(eval(input())) for _ in range(n)]) print((sum([(n - i - 1) * lst[i] for i in range(n)])))
12
6
214
162
while True: n = int(eval(input())) if not n: break else: lst = [int(eval(input())) for _ in range(n)] lst.sort() acc = ans = 0 for i in lst: ans += acc acc += i print(ans)
while True: n = int(eval(input())) if not n: break lst = sorted([int(eval(input())) for _ in range(n)]) print((sum([(n - i - 1) * lst[i] for i in range(n)])))
false
50
[ "- else:", "- lst = [int(eval(input())) for _ in range(n)]", "- lst.sort()", "- acc = ans = 0", "- for i in lst:", "- ans += acc", "- acc += i", "- print(ans)", "+ lst = sorted([int(eval(input())) for _ in range(n)])", "+ print((sum...
false
0.039129
0.135688
0.288377
[ "s481430013", "s015881770" ]
u428132025
p02796
python
s845116050
s478962289
502
363
23,276
23,272
Accepted
Accepted
27.69
import sys n = int(eval(input())) info = [0] * n for i in range(n): x, l = list(map(int, input().split())) info[i] = [x+l, x, l] info.sort() ans = 1 right = info[0][1] + info[0][2] for i in range(1, n): if right <= info[i][1] - info[i][2]: ans += 1 right = info[i][1] + info[i][...
import sys input = sys.stdin.readline n = int(eval(input())) info = [0] * n for i in range(n): x, l = list(map(int, input().split())) info[i] = [x+l, x, l] info.sort() ans = 1 right = info[0][1] + info[0][2] for i in range(1, n): if right <= info[i][1] - info[i][2]: ans += 1 r...
15
16
322
350
import sys n = int(eval(input())) info = [0] * n for i in range(n): x, l = list(map(int, input().split())) info[i] = [x + l, x, l] info.sort() ans = 1 right = info[0][1] + info[0][2] for i in range(1, n): if right <= info[i][1] - info[i][2]: ans += 1 right = info[i][1] + info[i][2] print(an...
import sys input = sys.stdin.readline n = int(eval(input())) info = [0] * n for i in range(n): x, l = list(map(int, input().split())) info[i] = [x + l, x, l] info.sort() ans = 1 right = info[0][1] + info[0][2] for i in range(1, n): if right <= info[i][1] - info[i][2]: ans += 1 right = info[...
false
6.25
[ "+input = sys.stdin.readline" ]
false
0.122301
0.167359
0.730773
[ "s845116050", "s478962289" ]
u396211450
p03862
python
s741437125
s078074661
146
99
20,100
19,980
Accepted
Accepted
32.19
N,X=(int(T) for T in input().split()) A=list(map(int,input().split())) ans=0 for i in range(0,N-1): if A[i]+A[i+1]>X: s=A[i]+A[i+1]-X ans=s+ans A[i]=A[i]-max(0,A[i]-A[i+1]) A[i+1]=max(0,A[i+1]-s) print(ans)
N,x=list(map(int,input().split())) a=list(map(int,input().split())) ans=0 for i in range(1,N): tmp=a[i-1]+a[i] if tmp>x: ans+=tmp-x if a[i]>=tmp-x: a[i]-=tmp-x else: a[i]=0 print(ans)
10
12
252
245
N, X = (int(T) for T in input().split()) A = list(map(int, input().split())) ans = 0 for i in range(0, N - 1): if A[i] + A[i + 1] > X: s = A[i] + A[i + 1] - X ans = s + ans A[i] = A[i] - max(0, A[i] - A[i + 1]) A[i + 1] = max(0, A[i + 1] - s) print(ans)
N, x = list(map(int, input().split())) a = list(map(int, input().split())) ans = 0 for i in range(1, N): tmp = a[i - 1] + a[i] if tmp > x: ans += tmp - x if a[i] >= tmp - x: a[i] -= tmp - x else: a[i] = 0 print(ans)
false
16.666667
[ "-N, X = (int(T) for T in input().split())", "-A = list(map(int, input().split()))", "+N, x = list(map(int, input().split()))", "+a = list(map(int, input().split()))", "-for i in range(0, N - 1):", "- if A[i] + A[i + 1] > X:", "- s = A[i] + A[i + 1] - X", "- ans = s + ans", "- ...
false
0.07602
0.03437
2.211811
[ "s741437125", "s078074661" ]
u626228246
p02717
python
s570911762
s210534344
25
22
9,064
9,096
Accepted
Accepted
12
import sys #readline = sys.stdin.readline() A,B,C = list(map(int,input().split())) print((C,A,B))
X,Y,Z = list(map(int,input().split())) print((Z,X,Y))
4
2
92
46
import sys # readline = sys.stdin.readline() A, B, C = list(map(int, input().split())) print((C, A, B))
X, Y, Z = list(map(int, input().split())) print((Z, X, Y))
false
50
[ "-import sys", "-", "-# readline = sys.stdin.readline()", "-A, B, C = list(map(int, input().split()))", "-print((C, A, B))", "+X, Y, Z = list(map(int, input().split()))", "+print((Z, X, Y))" ]
false
0.008354
0.03268
0.255623
[ "s570911762", "s210534344" ]
u141610915
p03862
python
s926521997
s144976992
227
90
59,632
84,728
Accepted
Accepted
60.35
import sys input = sys.stdin.readline N, x = list(map(int, input().split())) a = list(map(int, input().split())) res = 0 for i in range(1, N): if a[i - 1] + a[i] > x: t = a[i - 1] + a[i] - x res += t if t > a[i]: t -= a[i] a[i] = 0 a[i - 1] -= t else: a[i] -= t p...
import sys input = sys.stdin.readline N, X = list(map(int, input().split())) a = list(map(int, input().split())) res = 0 for i in range(N - 1): if a[i] + a[i + 1] > X: if a[i] <= X: res += a[i] + a[i + 1] - X a[i + 1] -= a[i] + a[i + 1] - X else: res += a[i] + a[i + 1] - X ...
16
14
323
338
import sys input = sys.stdin.readline N, x = list(map(int, input().split())) a = list(map(int, input().split())) res = 0 for i in range(1, N): if a[i - 1] + a[i] > x: t = a[i - 1] + a[i] - x res += t if t > a[i]: t -= a[i] a[i] = 0 a[i - 1] -= t e...
import sys input = sys.stdin.readline N, X = list(map(int, input().split())) a = list(map(int, input().split())) res = 0 for i in range(N - 1): if a[i] + a[i + 1] > X: if a[i] <= X: res += a[i] + a[i + 1] - X a[i + 1] -= a[i] + a[i + 1] - X else: res += a[i] + a[...
false
12.5
[ "-N, x = list(map(int, input().split()))", "+N, X = list(map(int, input().split()))", "-for i in range(1, N):", "- if a[i - 1] + a[i] > x:", "- t = a[i - 1] + a[i] - x", "- res += t", "- if t > a[i]:", "- t -= a[i]", "- a[i] = 0", "- a[i - 1...
false
0.04647
0.038014
1.222431
[ "s926521997", "s144976992" ]
u941407962
p02834
python
s310898892
s411437146
801
486
118,688
94,128
Accepted
Accepted
39.33
import copy import sys sys.setrecursionlimit(100000) input = sys.stdin.readline N,U,V = list(map(int, input().split())) d = [set() for _ in range(N+1)] dps = [0 for _ in range(N+1)] dpss = [0 for _ in range(N+1)] vs = set() r = {} def it(v, p, depth, ps): for u in d[v]: if u == p: ...
import sys input = sys.stdin.readline N,U,V = list(map(int, input().split())) d = [set() for _ in range(N+1)] dps = [0 for _ in range(N+1)] dpss = [0 for _ in range(N+1)] oks = set() def it(v): stack = [v] vs = set() path = [] while True: if not len(stack): break ...
47
60
962
1,374
import copy import sys sys.setrecursionlimit(100000) input = sys.stdin.readline N, U, V = list(map(int, input().split())) d = [set() for _ in range(N + 1)] dps = [0 for _ in range(N + 1)] dpss = [0 for _ in range(N + 1)] vs = set() r = {} def it(v, p, depth, ps): for u in d[v]: if u == p: con...
import sys input = sys.stdin.readline N, U, V = list(map(int, input().split())) d = [set() for _ in range(N + 1)] dps = [0 for _ in range(N + 1)] dpss = [0 for _ in range(N + 1)] oks = set() def it(v): stack = [v] vs = set() path = [] while True: if not len(stack): break v...
false
21.666667
[ "-import copy", "-sys.setrecursionlimit(100000)", "-vs = set()", "-r = {}", "+oks = set()", "-def it(v, p, depth, ps):", "- for u in d[v]:", "- if u == p:", "- continue", "- dps[u] = depth", "- if u == V:", "- r[\"p\"] = copy.deepcopy(ps)", "- ...
false
0.061666
0.041519
1.485246
[ "s310898892", "s411437146" ]
u474561976
p02726
python
s876948018
s797558452
1,698
990
116,008
3,444
Accepted
Accepted
41.7
def main(): import collections n,x,y = list(map(int,input().split(" "))) dp = [[0]*n for i in range(n)] for i in range(0,n): for j in range(i+1,n): if i < x-1: if j < x: dp[i][j] =dp[i][j-1] +1 if j >= x and j < y: ...
def main2(): n,x,y = list(map(int,input().split(" "))) cnts = [0]*n for i in range(n): for j in range(i+1,n): dis = min(j-i,abs(x-1-i)+1+abs(y-1-j)) cnts[dis]+=1 for i in range(1,n): print((cnts[i])) main2()
33
11
925
270
def main(): import collections n, x, y = list(map(int, input().split(" "))) dp = [[0] * n for i in range(n)] for i in range(0, n): for j in range(i + 1, n): if i < x - 1: if j < x: dp[i][j] = dp[i][j - 1] + 1 if j >= x and j < y: ...
def main2(): n, x, y = list(map(int, input().split(" "))) cnts = [0] * n for i in range(n): for j in range(i + 1, n): dis = min(j - i, abs(x - 1 - i) + 1 + abs(y - 1 - j)) cnts[dis] += 1 for i in range(1, n): print((cnts[i])) main2()
false
66.666667
[ "-def main():", "- import collections", "-", "+def main2():", "- dp = [[0] * n for i in range(n)]", "- for i in range(0, n):", "+ cnts = [0] * n", "+ for i in range(n):", "- if i < x - 1:", "- if j < x:", "- dp[i][j] = dp[i][j - 1] + 1"...
false
0.04562
0.045106
1.011384
[ "s876948018", "s797558452" ]
u216015528
p03290
python
s237385844
s719856109
35
29
9,096
9,148
Accepted
Accepted
17.14
# ABC 104 C - All Green(my answer for bit) D, G = list(map(int, input().split())) p, c = [], [] ans = float('inf') for _ in range(D): a, b = list(map(int, input().split())) p.append(a) c.append(b) for bit in range(1 << D): # bitで完答した問題を列挙 score = 0 cnt = 0 comp = set(range(D)) ...
def resolve(): """ recursive function""" def func(i, sum, cnt, rem): nonlocal ans if i == D: if sum < G: use = max(rem) n = min(lst[use - 1][0], -(-(G - sum) // ((use) * 100))) sum += n * use * 100 cnt += n ...
30
30
918
837
# ABC 104 C - All Green(my answer for bit) D, G = list(map(int, input().split())) p, c = [], [] ans = float("inf") for _ in range(D): a, b = list(map(int, input().split())) p.append(a) c.append(b) for bit in range(1 << D): # bitで完答した問題を列挙 score = 0 cnt = 0 comp = set(range(D)) for i in rang...
def resolve(): """recursive function""" def func(i, sum, cnt, rem): nonlocal ans if i == D: if sum < G: use = max(rem) n = min(lst[use - 1][0], -(-(G - sum) // ((use) * 100))) sum += n * use * 100 cnt += n i...
false
0
[ "-# ABC 104 C - All Green(my answer for bit)", "-D, G = list(map(int, input().split()))", "-p, c = [], []", "-ans = float(\"inf\")", "-for _ in range(D):", "- a, b = list(map(int, input().split()))", "- p.append(a)", "- c.append(b)", "-for bit in range(1 << D): # bitで完答した問題を列挙", "- sc...
false
0.037288
0.04699
0.793531
[ "s237385844", "s719856109" ]
u753803401
p03162
python
s082838408
s572554341
399
301
56,428
53,996
Accepted
Accepted
24.56
import sys def solve(): input = sys.stdin.readline mod = 10 ** 9 + 7 n = int(input().rstrip('\n')) dp = [[0] * 3 for _ in range(n)] for i in range(n): a, b, c = list(map(int, input().rstrip('\n').split())) if i == 0: dp[i][0] = a dp[i][1] = b ...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 n = int(readline()) dp = [[0] * 3 for _ in range(n)] for i in range(n): a, b, c = list(map(int, readline().split())) if i == 0: dp[i][0] = a dp[i][1] = b ...
28
23
791
597
import sys def solve(): input = sys.stdin.readline mod = 10**9 + 7 n = int(input().rstrip("\n")) dp = [[0] * 3 for _ in range(n)] for i in range(n): a, b, c = list(map(int, input().rstrip("\n").split())) if i == 0: dp[i][0] = a dp[i][1] = b dp[i]...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 n = int(readline()) dp = [[0] * 3 for _ in range(n)] for i in range(n): a, b, c = list(map(int, readline().split())) if i == 0: dp[i][0] = a dp[i][1] = b dp[i][2] = c ...
false
17.857143
[ "- input = sys.stdin.readline", "+ readline = sys.stdin.buffer.readline", "- n = int(input().rstrip(\"\\n\"))", "+ n = int(readline())", "- a, b, c = list(map(int, input().rstrip(\"\\n\").split()))", "+ a, b, c = list(map(int, readline().split()))", "- dp[i][0] = max...
false
0.036959
0.044524
0.830104
[ "s082838408", "s572554341" ]
u014333473
p03474
python
s720361483
s272739049
19
17
3,188
2,940
Accepted
Accepted
10.53
import re A,B=list(map(int,input().split()));S=eval(input()) print(('Yes' if 1<=A<=5 and 1<=B<=5 and S[:A].isdigit() and S[A]=='-' and S[B+1:].isdigit() else 'No'))
A,B=list(map(int,input().split()));S=eval(input()) print(('Yes' if S[:A].isdigit() and S[A]=='-' and S[B+1:].isdigit() else 'No'))
3
2
152
117
import re A, B = list(map(int, input().split())) S = eval(input()) print( ( "Yes" if 1 <= A <= 5 and 1 <= B <= 5 and S[:A].isdigit() and S[A] == "-" and S[B + 1 :].isdigit() else "No" ) )
A, B = list(map(int, input().split())) S = eval(input()) print(("Yes" if S[:A].isdigit() and S[A] == "-" and S[B + 1 :].isdigit() else "No"))
false
33.333333
[ "-import re", "-", "-print(", "- (", "- \"Yes\"", "- if 1 <= A <= 5", "- and 1 <= B <= 5", "- and S[:A].isdigit()", "- and S[A] == \"-\"", "- and S[B + 1 :].isdigit()", "- else \"No\"", "- )", "-)", "+print((\"Yes\" if S[:A].isdigit() ...
false
0.068226
0.06761
1.009111
[ "s720361483", "s272739049" ]
u284854859
p02787
python
s620351647
s066350410
631
572
41,708
41,452
Accepted
Accepted
9.35
h,n = list(map(int,input().split())) dg = 10**5 ba = [] for _ in [0]*n: a,b = list(map(int,input().split())) if a >= h: a = h ba.append(b*dg+a) ba.sort() d = [10**9]*(h+1) d[0] = 0 for i in range(1,h+1): for e in ba: a,b = e%dg,e//dg if i<=a: ...
import sys input = sys.stdin.readline h,n = list(map(int,input().split())) dg = 10**5 ba = [] for _ in [0]*n: a,b = list(map(int,input().split())) if a >= h: a = h ba.append(b*dg+a) ba.sort() d = [10**9]*(h+1) d[0] = 0 for i in range(1,h+1): for e in ba: a,b = ...
27
30
443
486
h, n = list(map(int, input().split())) dg = 10**5 ba = [] for _ in [0] * n: a, b = list(map(int, input().split())) if a >= h: a = h ba.append(b * dg + a) ba.sort() d = [10**9] * (h + 1) d[0] = 0 for i in range(1, h + 1): for e in ba: a, b = e % dg, e // dg if i <= a: ...
import sys input = sys.stdin.readline h, n = list(map(int, input().split())) dg = 10**5 ba = [] for _ in [0] * n: a, b = list(map(int, input().split())) if a >= h: a = h ba.append(b * dg + a) ba.sort() d = [10**9] * (h + 1) d[0] = 0 for i in range(1, h + 1): for e in ba: a, b = e % dg, ...
false
10
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.125055
0.262456
0.476482
[ "s620351647", "s066350410" ]
u312025627
p04029
python
s886314786
s200685190
177
160
38,256
38,256
Accepted
Accepted
9.6
n = int(eval(input())) ans = 0 for i in range(1,n+1): ans += i print(ans)
def main(): N = int(eval(input())) print((N*(N+1)//2)) if __name__ == '__main__': main()
5
7
75
101
n = int(eval(input())) ans = 0 for i in range(1, n + 1): ans += i print(ans)
def main(): N = int(eval(input())) print((N * (N + 1) // 2)) if __name__ == "__main__": main()
false
28.571429
[ "-n = int(eval(input()))", "-ans = 0", "-for i in range(1, n + 1):", "- ans += i", "-print(ans)", "+def main():", "+ N = int(eval(input()))", "+ print((N * (N + 1) // 2))", "+", "+", "+if __name__ == \"__main__\":", "+ main()" ]
false
0.075106
0.049794
1.508317
[ "s886314786", "s200685190" ]
u781262926
p03361
python
s252019264
s844261461
178
127
12,352
27,340
Accepted
Accepted
28.65
from itertools import product from collections import deque import numpy as np inputs = open(0).readlines() class Grid(): def __init__(self, grid, w=0, h=0, function=lambda x: x): self.w = w = w if w else len(grid[0]) self.h = h = h if h else len(grid) dtype = type(function(grid[0][0...
from itertools import product from collections import deque import numpy as np class Grid: def __init__(self, grid, w=0, h=0, function=lambda x: x): self.w = w = w if w else len(grid[0]) self.h = h = h if h else len(grid) dtype = type(function(grid[0][0])) self.grid = np.empt...
54
53
1,661
1,649
from itertools import product from collections import deque import numpy as np inputs = open(0).readlines() class Grid: def __init__(self, grid, w=0, h=0, function=lambda x: x): self.w = w = w if w else len(grid[0]) self.h = h = h if h else len(grid) dtype = type(function(grid[0][0])) ...
from itertools import product from collections import deque import numpy as np class Grid: def __init__(self, grid, w=0, h=0, function=lambda x: x): self.w = w = w if w else len(grid[0]) self.h = h = h if h else len(grid) dtype = type(function(grid[0][0])) self.grid = np.empty((h, ...
false
1.851852
[ "-", "-inputs = open(0).readlines()", "- return \"\\n\".join([\" \".join(map(str, row)) for row in self.grid])", "+ return \"\\n\".join([\" \".join(map(str, row)) for row in self.grid]) + \"\\n\"", "-h, w = list(map(int, inputs[0].split()))", "-grid = Grid(inputs[1:], function=lambda x: int(...
false
0.153809
0.154719
0.994119
[ "s252019264", "s844261461" ]
u363610900
p03448
python
s650757749
s194557904
57
49
3,060
3,060
Accepted
Accepted
14.04
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) res = 0 for a in range(A+1): for b in range(B+1): for c in range(C+1): calc = a * 500 + b * 100 + c * 50 if calc == X: res += 1 print(res)
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) cnt = 0 for i in range(A+1): for j in range(B+1): for k in range(C+1): if i * 500 + j * 100 + k * 50 == X: cnt += 1 print(cnt)
15
12
275
246
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) res = 0 for a in range(A + 1): for b in range(B + 1): for c in range(C + 1): calc = a * 500 + b * 100 + c * 50 if calc == X: res += 1 print(res)
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) cnt = 0 for i in range(A + 1): for j in range(B + 1): for k in range(C + 1): if i * 500 + j * 100 + k * 50 == X: cnt += 1 print(cnt)
false
20
[ "-res = 0", "-for a in range(A + 1):", "- for b in range(B + 1):", "- for c in range(C + 1):", "- calc = a * 500 + b * 100 + c * 50", "- if calc == X:", "- res += 1", "-print(res)", "+cnt = 0", "+for i in range(A + 1):", "+ for j in range(B + 1):...
false
0.119848
0.221333
0.541483
[ "s650757749", "s194557904" ]
u188827677
p02813
python
s243828786
s426892588
34
27
8,052
8,052
Accepted
Accepted
20.59
from itertools import permutations n = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) nums = list(permutations(list(range(1,n+1)), n)) a = 0 b = 0 c = 0 for i in nums: c += 1 if i == p: a = c if i == q: b = c print((abs(a-b)))
from itertools import permutations n = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) nums = list(permutations(list(range(1,n+1)),n)) print((abs(nums.index(p) - nums.index(q))))
16
7
288
216
from itertools import permutations n = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) nums = list(permutations(list(range(1, n + 1)), n)) a = 0 b = 0 c = 0 for i in nums: c += 1 if i == p: a = c if i == q: b = c print((abs(a - b)))
from itertools import permutations n = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) nums = list(permutations(list(range(1, n + 1)), n)) print((abs(nums.index(p) - nums.index(q))))
false
56.25
[ "-a = 0", "-b = 0", "-c = 0", "-for i in nums:", "- c += 1", "- if i == p:", "- a = c", "- if i == q:", "- b = c", "-print((abs(a - b)))", "+print((abs(nums.index(p) - nums.index(q))))" ]
false
0.038844
0.040618
0.956317
[ "s243828786", "s426892588" ]
u367130284
p03682
python
s665774010
s829983046
1,246
1,058
53,020
51,188
Accepted
Accepted
15.09
#import numpy as np #from numpy import* #from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) #from scipy.sparse.csgraph import dijkstra #from scipy.sparse.csgraph import floyd_warshall #from scipy.sparse import csr_matrix from collections import* #defaultdict Counter deque appendleft f...
#import numpy as np #from numpy import* #from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) #from scipy.sparse.csgraph import dijkstra #from scipy.sparse.csgraph import floyd_warshall #from scipy.sparse import csr_matrix #from collections import* #defaultdict Counter deque appendleft ...
76
74
2,199
2,196
# import numpy as np # from numpy import* # from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # from scipy.sparse.csgraph import dijkstra # from scipy.sparse.csgraph import floyd_warshall # from scipy.sparse import csr_matrix from collections import * # defaultdict Counter deque appendleft f...
# import numpy as np # from numpy import* # from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # from scipy.sparse.csgraph import dijkstra # from scipy.sparse.csgraph import floyd_warshall # from scipy.sparse import csr_matrix # from collections import* #defaultdict Counter deque appendleft # ...
false
2.631579
[ "-from collections import * # defaultdict Counter deque appendleft", "-from fractions import gcd", "-from functools import * # reduce", "-from itertools import * # permutations(\"AB\",repeat=2) combinations(\"AB\",2) product(\"AB\",2) groupby accumulate", "-from operator import mul, itemgetter", "-from...
false
0.048807
0.048264
1.011256
[ "s665774010", "s829983046" ]
u492447501
p03220
python
s084959438
s801386117
149
18
12,496
3,060
Accepted
Accepted
87.92
import numpy as np N = int(eval(input())) T, A = list(map(int, input().split())) *H, = list(map(int,input().split())) m = [abs(A-(T-h*0.006)) for h in H] print((m.index(min(m))+1))
N = int(eval(input())) T,A = list(map(int, input().split())) *H, = list(map(int, input().split())) ans = 100000000 index = 0 for i in range(len(H)): temp = T-H[i]*0.006 if abs(A-temp)<ans: ans = abs(A-temp) index = i print((index+1))
9
16
173
257
import numpy as np N = int(eval(input())) T, A = list(map(int, input().split())) (*H,) = list(map(int, input().split())) m = [abs(A - (T - h * 0.006)) for h in H] print((m.index(min(m)) + 1))
N = int(eval(input())) T, A = list(map(int, input().split())) (*H,) = list(map(int, input().split())) ans = 100000000 index = 0 for i in range(len(H)): temp = T - H[i] * 0.006 if abs(A - temp) < ans: ans = abs(A - temp) index = i print((index + 1))
false
43.75
[ "-import numpy as np", "-", "-m = [abs(A - (T - h * 0.006)) for h in H]", "-print((m.index(min(m)) + 1))", "+ans = 100000000", "+index = 0", "+for i in range(len(H)):", "+ temp = T - H[i] * 0.006", "+ if abs(A - temp) < ans:", "+ ans = abs(A - temp)", "+ index = i", "+print...
false
0.040697
0.058524
0.695394
[ "s084959438", "s801386117" ]
u063550903
p02802
python
s618090402
s446368358
286
237
4,760
17,112
Accepted
Accepted
17.13
N,M = list(map(int,input().split())) seito = 0 penarty = 0 pena = [False for i in range(N+1)] pena2 = [0 for i in range(N+1)] for i in range(M): p,s = input().split() p = int(p) if not pena[p]: if s == "AC": pena[p]=True seito += 1 else: pena2...
N,M = list(map(int,input().split())) dic = {} ans = 0 for i in range(M): p,s = input().split() if s == "AC": if p in dic: ans += dic[p] dic[p] = 0 else: if p in dic: if dic[p] != 0: dic[p] += 1 else: dic[p] = 1...
19
17
414
367
N, M = list(map(int, input().split())) seito = 0 penarty = 0 pena = [False for i in range(N + 1)] pena2 = [0 for i in range(N + 1)] for i in range(M): p, s = input().split() p = int(p) if not pena[p]: if s == "AC": pena[p] = True seito += 1 else: pena2[p] ...
N, M = list(map(int, input().split())) dic = {} ans = 0 for i in range(M): p, s = input().split() if s == "AC": if p in dic: ans += dic[p] dic[p] = 0 else: if p in dic: if dic[p] != 0: dic[p] += 1 else: dic[p] = 1 print((len...
false
10.526316
[ "-seito = 0", "-penarty = 0", "-pena = [False for i in range(N + 1)]", "-pena2 = [0 for i in range(N + 1)]", "+dic = {}", "+ans = 0", "- p = int(p)", "- if not pena[p]:", "- if s == \"AC\":", "- pena[p] = True", "- seito += 1", "+ if s == \"AC\":", "+ ...
false
0.110477
0.096068
1.149994
[ "s618090402", "s446368358" ]
u948524308
p03781
python
s039877312
s014744304
31
24
2,940
2,940
Accepted
Accepted
22.58
X=int(eval(input())) i=0 d=0 while d<X: i+=1 d=i*(i+1)//2 print(i)
X=int(eval(input())) d=0 for i in range(1,X+1): d+=i if d>=X: print(i) exit()
8
7
76
101
X = int(eval(input())) i = 0 d = 0 while d < X: i += 1 d = i * (i + 1) // 2 print(i)
X = int(eval(input())) d = 0 for i in range(1, X + 1): d += i if d >= X: print(i) exit()
false
12.5
[ "-i = 0", "-while d < X:", "- i += 1", "- d = i * (i + 1) // 2", "-print(i)", "+for i in range(1, X + 1):", "+ d += i", "+ if d >= X:", "+ print(i)", "+ exit()" ]
false
0.077325
0.047307
1.63452
[ "s039877312", "s014744304" ]
u661576386
p03327
python
s411734503
s766815497
20
17
2,940
2,940
Accepted
Accepted
15
n = int(eval(input())) if n < 1000: print("ABC") else: print("ABD")
n = int(eval(input())) print(("ABC" if n<1000 else "ABD"))
5
2
74
52
n = int(eval(input())) if n < 1000: print("ABC") else: print("ABD")
n = int(eval(input())) print(("ABC" if n < 1000 else "ABD"))
false
60
[ "-if n < 1000:", "- print(\"ABC\")", "-else:", "- print(\"ABD\")", "+print((\"ABC\" if n < 1000 else \"ABD\"))" ]
false
0.045946
0.045668
1.006082
[ "s411734503", "s766815497" ]
u278479217
p03576
python
s121726907
s194558773
1,556
60
61,344
3,064
Accepted
Accepted
96.14
from itertools import combinations N, K = list(map(int, input().split())) points = [] for i in range(N): points.append(list(map(int, input().split()))) xl = list([p[0] for p in points]) yl = list([p[1] for p in points]) def contained(point, xmin, xmax, ymin, ymax): return (xmin <= point[0] <= xmax...
from itertools import combinations N, K = list(map(int, input().split())) points = [] for i in range(N): points.append(list(map(int, input().split()))) points.sort(key=lambda p:p[0]) min_area = 10**20 for k in range(K, N+1): for l in range(0, N-k+1): points_tmp = points[l:l+k] ...
33
26
914
766
from itertools import combinations N, K = list(map(int, input().split())) points = [] for i in range(N): points.append(list(map(int, input().split()))) xl = list([p[0] for p in points]) yl = list([p[1] for p in points]) def contained(point, xmin, xmax, ymin, ymax): return (xmin <= point[0] <= xmax) and (ymin...
from itertools import combinations N, K = list(map(int, input().split())) points = [] for i in range(N): points.append(list(map(int, input().split()))) points.sort(key=lambda p: p[0]) min_area = 10**20 for k in range(K, N + 1): for l in range(0, N - k + 1): points_tmp = points[l : l + k] points...
false
21.212121
[ "-xl = list([p[0] for p in points])", "-yl = list([p[1] for p in points])", "-", "-", "-def contained(point, xmin, xmax, ymin, ymax):", "- return (xmin <= point[0] <= xmax) and (ymin <= point[1] <= ymax)", "-", "-", "-def count_contained(xmin, xmax, ymin, ymax):", "- count = 0", "- for ...
false
0.115067
0.035317
3.258136
[ "s121726907", "s194558773" ]
u193927973
p02773
python
s204222220
s790897528
769
704
50,436
50,224
Accepted
Accepted
8.45
N=int(input()) S=[] for _ in range(N): S.append(input()) import collections c=collections.Counter(S) vl=list(c.values()) mv=max(vl) ans=[] cc=list(c.items()) cc.sort(key=lambda x:x[1], reverse=True) for k, v in cc: if v==mv: ans.append(k) else: break ans.sort() [print(a) for a i...
N=int(input()) S=[] for _ in range(N): S.append(input()) import collections c=collections.Counter(S) vl=list(c.values()) # 最大要素数 mv=max(vl) ans=[] cc=list(c.items()) # 辞書を[key, value]のリストにする cc.sort(key=lambda x:x[1], reverse=True) # valueで降順ソート # 辞書リスト内のkey, valueを調べる for k, v in cc: if v==m...
23
23
330
415
N = int(input()) S = [] for _ in range(N): S.append(input()) import collections c = collections.Counter(S) vl = list(c.values()) mv = max(vl) ans = [] cc = list(c.items()) cc.sort(key=lambda x: x[1], reverse=True) for k, v in cc: if v == mv: ans.append(k) else: break ans.sort() [print(a) fo...
N = int(input()) S = [] for _ in range(N): S.append(input()) import collections c = collections.Counter(S) vl = list(c.values()) # 最大要素数 mv = max(vl) ans = [] cc = list(c.items()) # 辞書を[key, value]のリストにする cc.sort(key=lambda x: x[1], reverse=True) # valueで降順ソート # 辞書リスト内のkey, valueを調べる for k, v in cc: if v == ...
false
0
[ "+# 最大要素数", "-cc = list(c.items())", "-cc.sort(key=lambda x: x[1], reverse=True)", "+cc = list(c.items()) # 辞書を[key, value]のリストにする", "+cc.sort(key=lambda x: x[1], reverse=True) # valueで降順ソート", "+# 辞書リスト内のkey, valueを調べる", "- if v == mv:", "+ if v == mv: # valueが要素数最大のやつ" ]
false
0.040718
0.058929
0.69096
[ "s204222220", "s790897528" ]