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
u670180528
p03612
python
s914442051
s735410766
81
73
14,324
11,124
Accepted
Accepted
9.88
from itertools import* n,*l=list(map(int,open(0).read().split())) print((sum(x//2+x%2 for x in[len(list(g))for k,g in groupby([i==j-1for i,j in enumerate(l)])if k])))
print((sum(x//2+x%2 for x in[len(list(g))for k,g in __import__("itertools").groupby([i==j for i,j in enumerate(map(int,open(0).read().split()))])if k])))
3
1
160
151
from itertools import * n, *l = list(map(int, open(0).read().split())) print( ( sum( x // 2 + x % 2 for x in [ len(list(g)) for k, g in groupby([i == j - 1 for i, j in enumerate(l)]) if k ] ) ) )
print( ( sum( x // 2 + x % 2 for x in [ len(list(g)) for k, g in __import__("itertools").groupby( [i == j for i, j in enumerate(map(int, open(0).read().split()))] ) if k ] ) ) ...
false
66.666667
[ "-from itertools import *", "-", "-n, *l = list(map(int, open(0).read().split()))", "- for k, g in groupby([i == j - 1 for i, j in enumerate(l)])", "+ for k, g in __import__(\"itertools\").groupby(", "+ [i == j for i, j in enumerate(map(int, open(0).read()....
false
0.113074
0.048348
2.338749
[ "s914442051", "s735410766" ]
u945181840
p03607
python
s225286791
s791734604
190
67
16,640
18,784
Accepted
Accepted
64.74
from collections import Counter N = int(eval(input())) A = [int(eval(input())) for i in range(N)] a = list(Counter(A).values()) a = [i for i in a if i % 2 == 1] print((len(a)))
from collections import Counter N, *A = list(map(int, open(0).read().split())) a = list(Counter(A).values()) a = [i for i in a if i % 2 == 1] print((len(a)))
8
7
171
157
from collections import Counter N = int(eval(input())) A = [int(eval(input())) for i in range(N)] a = list(Counter(A).values()) a = [i for i in a if i % 2 == 1] print((len(a)))
from collections import Counter N, *A = list(map(int, open(0).read().split())) a = list(Counter(A).values()) a = [i for i in a if i % 2 == 1] print((len(a)))
false
12.5
[ "-N = int(eval(input()))", "-A = [int(eval(input())) for i in range(N)]", "+N, *A = list(map(int, open(0).read().split()))" ]
false
0.064324
0.037895
1.697424
[ "s225286791", "s791734604" ]
u014333473
p02921
python
s740681104
s031971814
31
28
9,072
9,000
Accepted
Accepted
9.68
s,t=eval(input()),eval(input());print((len([1 for i in range(3) if s[i]==t[i]])))
print((len([1 for i,j in zip(eval(input()),eval(input())) if i==j])))
1
1
67
55
s, t = eval(input()), eval(input()) print((len([1 for i in range(3) if s[i] == t[i]])))
print((len([1 for i, j in zip(eval(input()), eval(input())) if i == j])))
false
0
[ "-s, t = eval(input()), eval(input())", "-print((len([1 for i in range(3) if s[i] == t[i]])))", "+print((len([1 for i, j in zip(eval(input()), eval(input())) if i == j])))" ]
false
0.066927
0.040663
1.645897
[ "s740681104", "s031971814" ]
u956866689
p03478
python
s842619023
s898366372
47
38
3,060
3,060
Accepted
Accepted
19.15
# -*- coding:utf-8 -*- N, A, B = list(map(int, input().split())) res = 0 for i in range(1, N+1): count = 0 for j in range(len(str(i))): count += int(str(i)[j]) if A <= count <= B: res += i print(res)
# -*- coding:utf-8 -*- n, a, b = list(map(int, input().split())) ans = 0 for i in range(n+1): if a <= sum(list(map(int, list(str(i)))))<= b: ans += i print(ans)
12
9
235
177
# -*- coding:utf-8 -*- N, A, B = list(map(int, input().split())) res = 0 for i in range(1, N + 1): count = 0 for j in range(len(str(i))): count += int(str(i)[j]) if A <= count <= B: res += i print(res)
# -*- coding:utf-8 -*- n, a, b = list(map(int, input().split())) ans = 0 for i in range(n + 1): if a <= sum(list(map(int, list(str(i))))) <= b: ans += i print(ans)
false
25
[ "-N, A, B = list(map(int, input().split()))", "-res = 0", "-for i in range(1, N + 1):", "- count = 0", "- for j in range(len(str(i))):", "- count += int(str(i)[j])", "- if A <= count <= B:", "- res += i", "-print(res)", "+n, a, b = list(map(int, input().split()))", "+ans =...
false
0.038686
0.040774
0.948778
[ "s842619023", "s898366372" ]
u976225138
p03644
python
s838605132
s095886960
28
25
9,124
9,172
Accepted
Accepted
10.71
n = int(eval(input())) if n == 1: print((1)) else: times = [] for i in range(2, n + 1, 2): t = 0 while i % 2 == 0: i //= 2 t += 1 else: times.append(t) else: print(((times.index(max(times)) + 1) * 2))
n = int(eval(input())) max_t = 0 ans = 1 for i in range(2, n + 1, 2): t = 0 j = i while j % 2 == 0: j //= 2 t += 1 else: if max_t < t: max_t = t ans = i else: print(ans)
14
17
287
249
n = int(eval(input())) if n == 1: print((1)) else: times = [] for i in range(2, n + 1, 2): t = 0 while i % 2 == 0: i //= 2 t += 1 else: times.append(t) else: print(((times.index(max(times)) + 1) * 2))
n = int(eval(input())) max_t = 0 ans = 1 for i in range(2, n + 1, 2): t = 0 j = i while j % 2 == 0: j //= 2 t += 1 else: if max_t < t: max_t = t ans = i else: print(ans)
false
17.647059
[ "-if n == 1:", "- print((1))", "+max_t = 0", "+ans = 1", "+for i in range(2, n + 1, 2):", "+ t = 0", "+ j = i", "+ while j % 2 == 0:", "+ j //= 2", "+ t += 1", "+ else:", "+ if max_t < t:", "+ max_t = t", "+ ans = i", "- times ...
false
0.041503
0.039187
1.059098
[ "s838605132", "s095886960" ]
u375616706
p03420
python
s666678261
s371763996
100
90
3,060
3,060
Accepted
Accepted
10
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, K = list(map(int, input().split())) ans = 0 if K == 0: ans = N*N else: for b in range(K+1, N+1): ans += (N//b)*(b-K) r = N % b if K <= r < b: ans += max(0, r-...
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, K = list(map(int, input().split())) ans = 0 if K == 0: ans = N*N else: for b in range(K+1, N+1): ans += (N//b)*(b-K) r = N % b ans += max(0, r-K+1) print(ans)
17
16
331
303
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, K = list(map(int, input().split())) ans = 0 if K == 0: ans = N * N else: for b in range(K + 1, N + 1): ans += (N // b) * (b - K) r = N % b if K <= r < b: ans += max(0, r - K ...
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, K = list(map(int, input().split())) ans = 0 if K == 0: ans = N * N else: for b in range(K + 1, N + 1): ans += (N // b) * (b - K) r = N % b ans += max(0, r - K + 1) print(ans)
false
5.882353
[ "- if K <= r < b:", "- ans += max(0, r - K + 1)", "+ ans += max(0, r - K + 1)" ]
false
0.051186
0.049772
1.028417
[ "s666678261", "s371763996" ]
u240630407
p02911
python
s321454990
s653352875
349
268
9,064
4,680
Accepted
Accepted
23.21
N,K,Q = list(map(int, input().split())) A = {} for i in range(Q): _ = int(eval(input())) if _ in A: A[_] += 1 else: A[_] = 1 for i in range(N): try: print(('Yes' if 0 < K - Q + A[i+1] else 'No')) except KeyError as e: print(('Yes' if 0 < K - Q else 'No'))
N,K,Q=list(map(int,input().split())) A = [0]*N for i in range(Q): A[int(eval(input()))-1]+=1 for i in range(N): print(('Yes'if K-Q+A[i]>0 else'No'))
13
6
303
147
N, K, Q = list(map(int, input().split())) A = {} for i in range(Q): _ = int(eval(input())) if _ in A: A[_] += 1 else: A[_] = 1 for i in range(N): try: print(("Yes" if 0 < K - Q + A[i + 1] else "No")) except KeyError as e: print(("Yes" if 0 < K - Q else "No"))
N, K, Q = list(map(int, input().split())) A = [0] * N for i in range(Q): A[int(eval(input())) - 1] += 1 for i in range(N): print(("Yes" if K - Q + A[i] > 0 else "No"))
false
53.846154
[ "-A = {}", "+A = [0] * N", "- _ = int(eval(input()))", "- if _ in A:", "- A[_] += 1", "- else:", "- A[_] = 1", "+ A[int(eval(input())) - 1] += 1", "- try:", "- print((\"Yes\" if 0 < K - Q + A[i + 1] else \"No\"))", "- except KeyError as e:", "- pri...
false
0.042231
0.107907
0.391364
[ "s321454990", "s653352875" ]
u891635666
p03038
python
s973553735
s711125866
571
372
39,232
32,928
Accepted
Accepted
34.85
n, m = list(map(int, input().split())) ls = sorted(map(int, input().split())) ls2 = [list(map(int, input().split())) for _ in range(m)] ls2.sort(key=lambda x: (x[1], x[0]), reverse=True) left = 0 right = 0 index = 0 res = 0 while left < n: if index == len(ls2): break b, c = ls2[index] if...
import operator import sys input = sys.stdin.readline ri = lambda: int(eval(input())) rs = lambda: input().rstrip() ril = lambda: list(map(int, input().split())) rsl = lambda: input().rstrip().split() ris = lambda n: [ri() for _ in range(n)] rss = lambda n: [rs() for _ in range(n)] rils = lambda n: [ril() ...
28
34
682
759
n, m = list(map(int, input().split())) ls = sorted(map(int, input().split())) ls2 = [list(map(int, input().split())) for _ in range(m)] ls2.sort(key=lambda x: (x[1], x[0]), reverse=True) left = 0 right = 0 index = 0 res = 0 while left < n: if index == len(ls2): break b, c = ls2[index] if c <= ls[lef...
import operator import sys input = sys.stdin.readline ri = lambda: int(eval(input())) rs = lambda: input().rstrip() ril = lambda: list(map(int, input().split())) rsl = lambda: input().rstrip().split() ris = lambda n: [ri() for _ in range(n)] rss = lambda n: [rs() for _ in range(n)] rils = lambda n: [ril() for _ in ran...
false
17.647059
[ "-n, m = list(map(int, input().split()))", "-ls = sorted(map(int, input().split()))", "-ls2 = [list(map(int, input().split())) for _ in range(m)]", "-ls2.sort(key=lambda x: (x[1], x[0]), reverse=True)", "-left = 0", "-right = 0", "+import operator", "+import sys", "+", "+input = sys.stdin.readline...
false
0.03724
0.062059
0.600075
[ "s973553735", "s711125866" ]
u228223940
p03078
python
s585245599
s931157966
986
669
151,088
8,740
Accepted
Accepted
32.15
x,y,z,k = list(map(int,input().split())) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) x_pls_y = [] for i in range(x): for j in range(y): x_pls_y.append(a[i]+b[j]) x_pls_y.sort(reverse=True) xy_pls_z = [] for i in range(m...
x,y,z,K = list(map(int,input().split())) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) a.sort(reverse=True) b.sort(reverse=True) c.sort(reverse=True) kouho = [] for i in range(x): for j in range(y): for k in range(z): if...
23
23
479
475
x, y, z, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) x_pls_y = [] for i in range(x): for j in range(y): x_pls_y.append(a[i] + b[j]) x_pls_y.sort(reverse=True) xy_pls_z = [] for i in range(min(3000, x * y)): ...
x, y, z, K = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort(reverse=True) b.sort(reverse=True) c.sort(reverse=True) kouho = [] for i in range(x): for j in range(y): for k in range(z): if (i + 1) *...
false
0
[ "-x, y, z, k = list(map(int, input().split()))", "+x, y, z, K = list(map(int, input().split()))", "-x_pls_y = []", "+a.sort(reverse=True)", "+b.sort(reverse=True)", "+c.sort(reverse=True)", "+kouho = []", "- x_pls_y.append(a[i] + b[j])", "-x_pls_y.sort(reverse=True)", "-xy_pls_z = []", "-...
false
0.042099
0.045487
0.92551
[ "s585245599", "s931157966" ]
u189487046
p03681
python
s202691236
s402836322
702
40
5,184
3,060
Accepted
Accepted
94.3
from math import factorial N, M = list(map(int, input().split())) a = 10**9+7 if abs(N-M) >= 2: print((0)) elif N == M: print(((2*factorial(N)*factorial(M)) % a)) else: print(((factorial(N)*factorial(M)) % a))
def factorial(n): ans = 1 for i in range(2, n + 1): ans = ans * i % 1000000007 return ans N, M = list(map(int, input().split())) MAD = 10**9+7 if abs(N-M) >= 2: print((0)) elif N == M: print(((2*factorial(N)*factorial(M)) % MAD)) else: print(((factorial(N)*factorial...
13
18
226
321
from math import factorial N, M = list(map(int, input().split())) a = 10**9 + 7 if abs(N - M) >= 2: print((0)) elif N == M: print(((2 * factorial(N) * factorial(M)) % a)) else: print(((factorial(N) * factorial(M)) % a))
def factorial(n): ans = 1 for i in range(2, n + 1): ans = ans * i % 1000000007 return ans N, M = list(map(int, input().split())) MAD = 10**9 + 7 if abs(N - M) >= 2: print((0)) elif N == M: print(((2 * factorial(N) * factorial(M)) % MAD)) else: print(((factorial(N) * factorial(M)) % MAD...
false
27.777778
[ "-from math import factorial", "+def factorial(n):", "+ ans = 1", "+ for i in range(2, n + 1):", "+ ans = ans * i % 1000000007", "+ return ans", "+", "-a = 10**9 + 7", "+MAD = 10**9 + 7", "- print(((2 * factorial(N) * factorial(M)) % a))", "+ print(((2 * factorial(N) * fact...
false
0.10173
0.037133
2.739611
[ "s202691236", "s402836322" ]
u102461423
p02996
python
s881427176
s742235948
808
248
49,964
36,448
Accepted
Accepted
69.31
import numpy as np # 締切が早いものから処理 N = int(eval(input())) AB = np.array([[int(x) for x in input().split()] for _ in range(N)]) A = AB[:,0] B = AB[:,1] idx = B.argsort() A = A[idx] B = B[idx] np.cumsum(A, out = A) bl = (A <= B).all() answer = 'Yes' if bl else 'No' print(answer)
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # 締切の近いものから詰め込む import numpy as np N = int(readline()) AB = np.array(read().split(),np.int64) A = AB[::2]; B = AB[1::2] ind = B.argsort(); A = A[ind]; B = B[ind] answer = 'Yes' if np...
13
18
281
366
import numpy as np # 締切が早いものから処理 N = int(eval(input())) AB = np.array([[int(x) for x in input().split()] for _ in range(N)]) A = AB[:, 0] B = AB[:, 1] idx = B.argsort() A = A[idx] B = B[idx] np.cumsum(A, out=A) bl = (A <= B).all() answer = "Yes" if bl else "No" print(answer)
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # 締切の近いものから詰め込む import numpy as np N = int(readline()) AB = np.array(read().split(), np.int64) A = AB[::2] B = AB[1::2] ind = B.argsort() A = A[ind] B = B[ind] answer = "Yes" if np.all(A.cumsum() <= B) ...
false
27.777778
[ "+import sys", "+", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "+# 締切の近いものから詰め込む", "-# 締切が早いものから処理", "-N = int(eval(input()))", "-AB = np.array([[int(x) for x in input().split()] for _ in range(N)])", "-A = AB[:, 0]", "-B ...
false
0.196368
0.177799
1.104438
[ "s881427176", "s742235948" ]
u426764965
p04013
python
s364108238
s922737641
117
27
28,160
9,256
Accepted
Accepted
76.92
def abc044_c(): import numpy as np n, a = list(map(int, input().split())) x = list([int(x) - a for x in input().split()]) # 平均ターゲット値を引いておく x = np.array(x, dtype=np.int64) vrange = n * (a + np.max(x)) # 取りうる値の幅(片側), 広めにとってもかまわない dp = np.zeros((n+1, 2*vrange+1), dtype=np.int64) # DPテーブル...
def abc044_c(): ''' 過去提出を参考に ''' _, A = list(map(int, input().split())) X = list([int(x) - A for x in input().split()]) d = {0: 1} # 負の値を取り得るため、配列でなく辞書で持つ for x in X: prev = list(d.items()) # 前のターンのぶんを保持しておく for val, cnt in prev: d[val + x] = d.get(val + x, 0) +...
28
14
893
405
def abc044_c(): import numpy as np n, a = list(map(int, input().split())) x = list([int(x) - a for x in input().split()]) # 平均ターゲット値を引いておく x = np.array(x, dtype=np.int64) vrange = n * (a + np.max(x)) # 取りうる値の幅(片側), 広めにとってもかまわない dp = np.zeros((n + 1, 2 * vrange + 1), dtype=np.int64) # DPテーブル ...
def abc044_c(): """過去提出を参考に""" _, A = list(map(int, input().split())) X = list([int(x) - A for x in input().split()]) d = {0: 1} # 負の値を取り得るため、配列でなく辞書で持つ for x in X: prev = list(d.items()) # 前のターンのぶんを保持しておく for val, cnt in prev: d[val + x] = d.get(val + x, 0) + cnt a...
false
50
[ "- import numpy as np", "-", "- n, a = list(map(int, input().split()))", "- x = list([int(x) - a for x in input().split()]) # 平均ターゲット値を引いておく", "- x = np.array(x, dtype=np.int64)", "- vrange = n * (a + np.max(x)) # 取りうる値の幅(片側), 広めにとってもかまわない", "- dp = np.zeros((n + 1, 2 * vrange + 1), ...
false
0.226752
0.043188
5.250384
[ "s364108238", "s922737641" ]
u254871849
p03329
python
s895288229
s099155998
267
210
3,060
3,060
Accepted
Accepted
21.35
import sys def count(n, b): res = 0 while n: n, r = divmod(n, b) res += r return res n = int(sys.stdin.readline().rstrip()) def main(): res = float('inf') for i in range(n + 1): res = min(res, count(i, 6) + count(n - i, 9)) print(res) if __name__ == ...
import sys def count(n, b): res = 0 while n: res += n % b n //= b return res n = int(sys.stdin.readline().rstrip()) def main(): res = float('inf') for i in range(n + 1): res = min(res, count(i, 6) + count(n - i, 9)) print(res) if __name__ == '__main_...
19
19
343
335
import sys def count(n, b): res = 0 while n: n, r = divmod(n, b) res += r return res n = int(sys.stdin.readline().rstrip()) def main(): res = float("inf") for i in range(n + 1): res = min(res, count(i, 6) + count(n - i, 9)) print(res) if __name__ == "__main__": ...
import sys def count(n, b): res = 0 while n: res += n % b n //= b return res n = int(sys.stdin.readline().rstrip()) def main(): res = float("inf") for i in range(n + 1): res = min(res, count(i, 6) + count(n - i, 9)) print(res) if __name__ == "__main__": main()...
false
0
[ "- n, r = divmod(n, b)", "- res += r", "+ res += n % b", "+ n //= b" ]
false
0.055578
0.054333
1.022917
[ "s895288229", "s099155998" ]
u692746605
p03073
python
s576110526
s423538738
64
48
3,188
3,188
Accepted
Accepted
25
s = eval(input()) c = 0 for x in range(len(s)): c += 1 if s[x] != str(x%2) else 0 print((c if c < x+1-c else x+1-c))
s = eval(input()) c = 0 for x in range(len(s)): c += s[x] != ('0' if x%2 else '1') print((c if c < x+1-c else x+1-c))
7
7
121
124
s = eval(input()) c = 0 for x in range(len(s)): c += 1 if s[x] != str(x % 2) else 0 print((c if c < x + 1 - c else x + 1 - c))
s = eval(input()) c = 0 for x in range(len(s)): c += s[x] != ("0" if x % 2 else "1") print((c if c < x + 1 - c else x + 1 - c))
false
0
[ "- c += 1 if s[x] != str(x % 2) else 0", "+ c += s[x] != (\"0\" if x % 2 else \"1\")" ]
false
0.038855
0.096307
0.403444
[ "s576110526", "s423538738" ]
u754022296
p02936
python
s092829546
s426956771
1,880
1,728
111,616
232,468
Accepted
Accepted
8.09
n, q = list(map(int, input().split())) C = [[] for _ in range(n)] for _ in range(n-1): a, b = list(map(int, input().split())) C[a-1].append(b-1) C[b-1].append(a-1) dist = [-1]*n dist[0] = 1 A = [0]*n F = [0]*n for _ in range(q): p, x = list(map(int, input().split())) F[p-1] += x S = [0] T = [0] ...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, q = list(map(int, input().split())) T = [[] for _ in range(n+1)] for _ in range(n-1): a, b = list(map(int, input().split())) T[a].append(b) T[b].append(a) dp = [0]*(n+1) for _ in range(q): p, x = list(map(int, input().split())) ...
29
25
559
480
n, q = list(map(int, input().split())) C = [[] for _ in range(n)] for _ in range(n - 1): a, b = list(map(int, input().split())) C[a - 1].append(b - 1) C[b - 1].append(a - 1) dist = [-1] * n dist[0] = 1 A = [0] * n F = [0] * n for _ in range(q): p, x = list(map(int, input().split())) F[p - 1] += x S ...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, q = list(map(int, input().split())) T = [[] for _ in range(n + 1)] for _ in range(n - 1): a, b = list(map(int, input().split())) T[a].append(b) T[b].append(a) dp = [0] * (n + 1) for _ in range(q): p, x = list(map(int, input().split()...
false
13.793103
[ "+import sys", "+", "+input = sys.stdin.readline", "+sys.setrecursionlimit(10**7)", "-C = [[] for _ in range(n)]", "+T = [[] for _ in range(n + 1)]", "- C[a - 1].append(b - 1)", "- C[b - 1].append(a - 1)", "-dist = [-1] * n", "-dist[0] = 1", "-A = [0] * n", "-F = [0] * n", "+ T[a].a...
false
0.041278
0.042049
0.98165
[ "s092829546", "s426956771" ]
u408620326
p03013
python
s584769860
s260750482
508
169
460,056
13,192
Accepted
Accepted
66.73
import sys input = sys.stdin.readline N, M = [int(x) for x in input().strip().split()] A = set([int(eval(input())) for _ in range(M)]) s = [0 for _ in range(N + 1)] s[0] = 1 if 1 not in A: s[1] = 1 for n in range(2, N+1): if n in A: continue else: s[n] = s[n-1] + s[n-2] print((s[-1] % (10 *...
import sys input = sys.stdin.readline N, M = [int(x) for x in input().strip().split()] A = set([int(eval(input())) for _ in range(M)]) s = 1 s_ = 0 for n in range(1, N+1): if n in A: s, s_ = 0, s continue s, s_ = s + s_, s print((s % (10 ** 9 + 7)))
15
12
323
265
import sys input = sys.stdin.readline N, M = [int(x) for x in input().strip().split()] A = set([int(eval(input())) for _ in range(M)]) s = [0 for _ in range(N + 1)] s[0] = 1 if 1 not in A: s[1] = 1 for n in range(2, N + 1): if n in A: continue else: s[n] = s[n - 1] + s[n - 2] print((s[-1] %...
import sys input = sys.stdin.readline N, M = [int(x) for x in input().strip().split()] A = set([int(eval(input())) for _ in range(M)]) s = 1 s_ = 0 for n in range(1, N + 1): if n in A: s, s_ = 0, s continue s, s_ = s + s_, s print((s % (10**9 + 7)))
false
20
[ "-s = [0 for _ in range(N + 1)]", "-s[0] = 1", "-if 1 not in A:", "- s[1] = 1", "-for n in range(2, N + 1):", "+s = 1", "+s_ = 0", "+for n in range(1, N + 1):", "+ s, s_ = 0, s", "- else:", "- s[n] = s[n - 1] + s[n - 2]", "-print((s[-1] % (10**9 + 7)))", "+ s, s_ = s +...
false
0.03673
0.007378
4.977994
[ "s584769860", "s260750482" ]
u222668979
p02900
python
s487199701
s588632952
166
77
3,060
62,828
Accepted
Accepted
53.61
a, b = list(map(int, input().split())) def prime_factorize(n): ans = [] while n % 2 == 0: ans.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: ans.append(f) n //= f else: f += 2 if n != 1: ans.appen...
def factorize(N): # 素因数分解 p, PRIME = 2, set() while p * p <= N: if N % p == 0: N //= p PRIME.add(p) else: p += 1 if N > 1: PRIME.add(N) return PRIME a, b = list(map(int, input().split())) ans = factorize(a) & factorize(b) pr...
22
17
421
332
a, b = list(map(int, input().split())) def prime_factorize(n): ans = [] while n % 2 == 0: ans.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: ans.append(f) n //= f else: f += 2 if n != 1: ans.append(n) return ...
def factorize(N): # 素因数分解 p, PRIME = 2, set() while p * p <= N: if N % p == 0: N //= p PRIME.add(p) else: p += 1 if N > 1: PRIME.add(N) return PRIME a, b = list(map(int, input().split())) ans = factorize(a) & factorize(b) print((len(ans) + 1...
false
22.727273
[ "-a, b = list(map(int, input().split()))", "+def factorize(N): # 素因数分解", "+ p, PRIME = 2, set()", "+ while p * p <= N:", "+ if N % p == 0:", "+ N //= p", "+ PRIME.add(p)", "+ else:", "+ p += 1", "+ if N > 1:", "+ PRIME.add(N)", "+...
false
0.077255
0.0775
0.996842
[ "s487199701", "s588632952" ]
u017810624
p03846
python
s939904718
s494229677
123
108
13,880
14,004
Accepted
Accepted
12.2
n=int(eval(input())) a=list(map(int,input().split())) a.sort() A=(2**(n//2))%(10**9+7) for i in range(n): if i%2==n%2 and i+1!=a[i] or i%2==(n+1)%2 and i!=a[i]:A=0 print(A)
n=int(eval(input())) a=list(map(int,input().split())) a.sort() A=(2**(n//2))%(10**9+7) for i in range(n): if i+(i-n+1)%2!=a[i]:A=0 print(A)
7
7
174
141
n = int(eval(input())) a = list(map(int, input().split())) a.sort() A = (2 ** (n // 2)) % (10**9 + 7) for i in range(n): if i % 2 == n % 2 and i + 1 != a[i] or i % 2 == (n + 1) % 2 and i != a[i]: A = 0 print(A)
n = int(eval(input())) a = list(map(int, input().split())) a.sort() A = (2 ** (n // 2)) % (10**9 + 7) for i in range(n): if i + (i - n + 1) % 2 != a[i]: A = 0 print(A)
false
0
[ "- if i % 2 == n % 2 and i + 1 != a[i] or i % 2 == (n + 1) % 2 and i != a[i]:", "+ if i + (i - n + 1) % 2 != a[i]:" ]
false
0.0384
0.062196
0.617412
[ "s939904718", "s494229677" ]
u633068244
p00790
python
s707911842
s765061043
20
10
4,260
4,256
Accepted
Accepted
50
while 1: n = eval(input()) if n == 0:break D = list(range(1,7)) ans = set(D) for i in range(n): c = input()[0] if c == "s": S = [1,5,2,3,0,4] elif c == "n": S = [4,0,2,3,5,1] elif c == "w": S = [3,1,0,5,4,2] elif c == "e": S = [2,1,5,0,4,3] ...
while 1: n = eval(input()) if n == 0:break D = list(range(1,7)) for i in range(n): c = input()[0] if c == "s": S = [1,5,2,3,0,4] elif c == "n": S = [4,0,2,3,5,1] elif c == "w": S = [3,1,0,5,4,2] elif c == "e": S = [2,1,5,0,4,3] D = [D[s] for s in S] print(D[0])
13
12
351
282
while 1: n = eval(input()) if n == 0: break D = list(range(1, 7)) ans = set(D) for i in range(n): c = input()[0] if c == "s": S = [1, 5, 2, 3, 0, 4] elif c == "n": S = [4, 0, 2, 3, 5, 1] elif c == "w": S = [3, 1, 0, 5, 4, 2]...
while 1: n = eval(input()) if n == 0: break D = list(range(1, 7)) for i in range(n): c = input()[0] if c == "s": S = [1, 5, 2, 3, 0, 4] elif c == "n": S = [4, 0, 2, 3, 5, 1] elif c == "w": S = [3, 1, 0, 5, 4, 2] elif c =...
false
7.692308
[ "- ans = set(D)" ]
false
0.039319
0.039555
0.994046
[ "s707911842", "s765061043" ]
u186838327
p03607
python
s257091327
s614768575
548
176
50,008
94,388
Accepted
Accepted
67.88
n = int(eval(input())) s = set() for i in range(n): a = int(eval(input())) if a in s: s.remove(a) else: s.add(a) print((len(s)))
n = int(eval(input())) A = [int(eval(input())) for _ in range(n)] S = set() for a in A: if a in S: S.remove(a) else: S.add(a) print((len(S)))
9
9
150
160
n = int(eval(input())) s = set() for i in range(n): a = int(eval(input())) if a in s: s.remove(a) else: s.add(a) print((len(s)))
n = int(eval(input())) A = [int(eval(input())) for _ in range(n)] S = set() for a in A: if a in S: S.remove(a) else: S.add(a) print((len(S)))
false
0
[ "-s = set()", "-for i in range(n):", "- a = int(eval(input()))", "- if a in s:", "- s.remove(a)", "+A = [int(eval(input())) for _ in range(n)]", "+S = set()", "+for a in A:", "+ if a in S:", "+ S.remove(a)", "- s.add(a)", "-print((len(s)))", "+ S.add(a)",...
false
0.040964
0.054764
0.748009
[ "s257091327", "s614768575" ]
u499381410
p03776
python
s584438438
s221255465
187
169
39,828
82,588
Accepted
Accepted
9.63
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fr...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys from copy import deepcopy import string from bisect import bisect_left, bisect_right from ma...
54
60
1,425
1,437
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor from functoo...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys from copy import deepcopy import string from bisect import bisect_left, bisect_right from math import ...
false
10
[ "-from itertools import permutations, accumulate, combinations", "+from itertools import permutations, accumulate, combinations, product", "+from copy import deepcopy", "+from operator import mul", "-INF = float(\"inf\")", "+sys.setrecursionlimit(2147483647)", "+INF = 10**20", "- return sys.stdin.r...
false
0.008181
0.07453
0.109763
[ "s584438438", "s221255465" ]
u744920373
p03166
python
s404799879
s710509221
905
569
140,680
75,672
Accepted
Accepted
37.13
import sys def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)] def dp2(ini, i, j): return [[ini]*i for i2 in range(j...
import sys def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)] def dp2(ini, i, j): return [[ini]*i for i2 in range(j...
44
39
1,080
955
import sys def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)] def dp2(ini, i, j): return [...
import sys def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)] def dp2(ini, i, j): return [...
false
11.363636
[ "-from collections import deque", "+sys.setrecursionlimit(10**6)", "-sys.setrecursionlimit(10**6)", "+", "+def rec(x):", "+ global dp", "+ if dp[x] != -1:", "+ return dp[x]", "+ num = 0", "+ for a in adj[x]:", "+ num = max(num, rec(a) + 1)", "+ dp[x] = num", "+ ...
false
0.045757
0.045783
0.999445
[ "s404799879", "s710509221" ]
u064563749
p03292
python
s006882270
s778732723
19
17
3,064
2,940
Accepted
Accepted
10.53
A1,A2,A3=list(map(int,input().split())) A=[A1,A2,A3] A.append(A1) def A_(i): if A[i]-A[i+1]>=0: return A[i]-A[i+1] else: return A[i+1]-A[i] B=[A_(i) for i in range(3)] B.append(A_(0)) B.append(A_(1)) def sum(j): return B[j]+B[j+1] C=[sum(j) for j in range(3)] print((min(C)))
A1,A2,A3=list(map(int,input().split())) A_1=abs(A1-A2)+abs(A2-A3) A_2=abs(A1-A3)+abs(A2-A3) A_3=abs(A1-A2)+abs(A1-A3) print((min(A_1,A_2,A_3)))
15
5
309
139
A1, A2, A3 = list(map(int, input().split())) A = [A1, A2, A3] A.append(A1) def A_(i): if A[i] - A[i + 1] >= 0: return A[i] - A[i + 1] else: return A[i + 1] - A[i] B = [A_(i) for i in range(3)] B.append(A_(0)) B.append(A_(1)) def sum(j): return B[j] + B[j + 1] C = [sum(j) for j in ran...
A1, A2, A3 = list(map(int, input().split())) A_1 = abs(A1 - A2) + abs(A2 - A3) A_2 = abs(A1 - A3) + abs(A2 - A3) A_3 = abs(A1 - A2) + abs(A1 - A3) print((min(A_1, A_2, A_3)))
false
66.666667
[ "-A = [A1, A2, A3]", "-A.append(A1)", "-", "-", "-def A_(i):", "- if A[i] - A[i + 1] >= 0:", "- return A[i] - A[i + 1]", "- else:", "- return A[i + 1] - A[i]", "-", "-", "-B = [A_(i) for i in range(3)]", "-B.append(A_(0))", "-B.append(A_(1))", "-", "-", "-def sum(...
false
0.061794
0.067951
0.90939
[ "s006882270", "s778732723" ]
u572193732
p03212
python
s344409120
s538544304
92
65
2,940
9,112
Accepted
Accepted
29.35
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 dfs(s): if int(s) > N: return 0 if s.count("7") > 0 and s.count("5") > 0 and s.count("3") > 0: ret = 1 else: ret = 0 for c in "753": ret += dfs(s + c) return ret print((dfs("0")))
14
14
241
269
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 dfs(s): if int(s) > N: return 0 if s.count("7") > 0 and s.count("5") > 0 and s.count("3") > 0: ret = 1 else: ret = 0 for c in "753": ret += dfs(s + c) return ret print((dfs("0")))
false
0
[ "- if all(s.count(c) > 0 for c in \"753\"):", "+ if s.count(\"7\") > 0 and s.count(\"5\") > 0 and s.count(\"3\") > 0:" ]
false
0.063248
0.050101
1.262405
[ "s344409120", "s538544304" ]
u525065967
p03503
python
s918536881
s479853914
207
167
3,188
9,112
Accepted
Accepted
19.32
n = int(eval(input())) F = [] # for _ in range(n): # f = list(map(int, input().split())) # # print(f) # F.append([\ # [f[0],f[1]],\ # [f[2],f[3]],\ # [f[4],f[5]],\ # [f[6],f[7]],\ # [f[8],f[9]]\ # ]) for _ in range(n): f = list(map(int, input()....
n = int(eval(input())) F = [[*list(map(int, input().split()))] for _ in range(n)] P = [[*list(map(int, input().split()))] for _ in range(n)] def c(i, open_patern): ret = 0 for j in range(10): if open_patern>>j & 1: #open my shop if F[i][j]: ret += 1 # open your shop return ret ...
52
19
1,159
513
n = int(eval(input())) F = [] # for _ in range(n): # f = list(map(int, input().split())) # # print(f) # F.append([\ # [f[0],f[1]],\ # [f[2],f[3]],\ # [f[4],f[5]],\ # [f[6],f[7]],\ # [f[8],f[9]]\ # ]) for _ in range(n): f = list(map(int, input().split())) F...
n = int(eval(input())) F = [[*list(map(int, input().split()))] for _ in range(n)] P = [[*list(map(int, input().split()))] for _ in range(n)] def c(i, open_patern): ret = 0 for j in range(10): if open_patern >> j & 1: # open my shop if F[i][j]: ret += 1 # open your shop ...
false
63.461538
[ "-F = []", "-# for _ in range(n):", "-# f = list(map(int, input().split()))", "-# # print(f)", "-# F.append([\\", "-# [f[0],f[1]],\\", "-# [f[2],f[3]],\\", "-# [f[4],f[5]],\\", "-# [f[6],f[7]],\\", "-# [f[8],f[9]]\\", "-# ])", "-for _ in ...
false
0.050161
0.05047
0.993884
[ "s918536881", "s479853914" ]
u254871849
p03385
python
s315059491
s507152081
21
17
2,940
2,940
Accepted
Accepted
19.05
# author: kagemeka # created: 2019-11-07 02:35:07(JST) import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator def main(): s = sys.stdin.read...
import sys s = sys.stdin.readline().rstrip() def main(): return 'Yes' if ''.join(sorted(s)) == 'abc' else 'No' if __name__ == '__main__': ans = main() print(ans)
21
10
467
185
# author: kagemeka # created: 2019-11-07 02:35:07(JST) import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator def main(): s = sys.stdin.readline().rstrip()...
import sys s = sys.stdin.readline().rstrip() def main(): return "Yes" if "".join(sorted(s)) == "abc" else "No" if __name__ == "__main__": ans = main() print(ans)
false
52.380952
[ "-# author: kagemeka", "-# created: 2019-11-07 02:35:07(JST)", "-# import collections", "-# import math", "-# import string", "-# import bisect", "-# import re", "-# import itertools", "-# import statistics", "-# import functools", "-# import oper...
false
0.107584
0.044533
2.41586
[ "s315059491", "s507152081" ]
u620084012
p03221
python
s234611687
s374317504
985
745
81,712
48,552
Accepted
Accepted
24.37
N, M = list(map(int,input().split())) P = [[] for k in range(N)] A = [0 for k in range(M)] for k in range(M): s, t = list(map(int,input().split())) P[s-1].append([t,k]) for k in range(N): P[k].sort() for l in range(len(P[k])): A[P[k][l][1]] = str(k+1).zfill(6) + str(l+1).zfill(6) ...
N, M = list(map(int,input().split())) C = [[] for k in range(N)] for k in range(M): P, Y = list(map(int,input().split())) C[P-1].append([Y,k]) D = [] for e in C: D.append(sorted(e)) A = [0]*M for k in range(N): c = 1 for e in D[k]: A[e[1]] = (k+1)*1000000 + c c += 1 for...
15
16
343
346
N, M = list(map(int, input().split())) P = [[] for k in range(N)] A = [0 for k in range(M)] for k in range(M): s, t = list(map(int, input().split())) P[s - 1].append([t, k]) for k in range(N): P[k].sort() for l in range(len(P[k])): A[P[k][l][1]] = str(k + 1).zfill(6) + str(l + 1).zfill(6) for a ...
N, M = list(map(int, input().split())) C = [[] for k in range(N)] for k in range(M): P, Y = list(map(int, input().split())) C[P - 1].append([Y, k]) D = [] for e in C: D.append(sorted(e)) A = [0] * M for k in range(N): c = 1 for e in D[k]: A[e[1]] = (k + 1) * 1000000 + c c += 1 for e ...
false
6.25
[ "-P = [[] for k in range(N)]", "-A = [0 for k in range(M)]", "+C = [[] for k in range(N)]", "- s, t = list(map(int, input().split()))", "- P[s - 1].append([t, k])", "+ P, Y = list(map(int, input().split()))", "+ C[P - 1].append([Y, k])", "+D = []", "+for e in C:", "+ D.append(sorted...
false
0.033964
0.095455
0.355815
[ "s234611687", "s374317504" ]
u544050502
p03210
python
s832917761
s968162084
19
17
2,940
2,940
Accepted
Accepted
10.53
X=int(eval(input())) print(("YES" if (X==3)or(X==5)or(X==7) else "NO"))
print(("YES" if eval(input()) in "357" else "NO"))
2
1
64
42
X = int(eval(input())) print(("YES" if (X == 3) or (X == 5) or (X == 7) else "NO"))
print(("YES" if eval(input()) in "357" else "NO"))
false
50
[ "-X = int(eval(input()))", "-print((\"YES\" if (X == 3) or (X == 5) or (X == 7) else \"NO\"))", "+print((\"YES\" if eval(input()) in \"357\" else \"NO\"))" ]
false
0.040393
0.040464
0.998252
[ "s832917761", "s968162084" ]
u218834617
p02571
python
s832501377
s736670066
305
65
80,812
72,724
Accepted
Accepted
78.69
s=eval(input()) t=eval(input()) m,n=len(s),len(t) ans=1000 for i in range(m-n+1): k=0 for j in range(n): if s[i+j]!=t[j]: k+=1 ans=min(ans,k) print(ans)
s=eval(input()) t=eval(input()) m=len(s) n=len(t) ans=1000 for i in range(m-n+1): k=0 for j in range(n): k+=s[i+j]!=t[j] ans=min(ans,k) print(ans)
14
14
190
171
s = eval(input()) t = eval(input()) m, n = len(s), len(t) ans = 1000 for i in range(m - n + 1): k = 0 for j in range(n): if s[i + j] != t[j]: k += 1 ans = min(ans, k) print(ans)
s = eval(input()) t = eval(input()) m = len(s) n = len(t) ans = 1000 for i in range(m - n + 1): k = 0 for j in range(n): k += s[i + j] != t[j] ans = min(ans, k) print(ans)
false
0
[ "-m, n = len(s), len(t)", "+m = len(s)", "+n = len(t)", "- if s[i + j] != t[j]:", "- k += 1", "+ k += s[i + j] != t[j]" ]
false
0.035178
0.0854
0.411913
[ "s832501377", "s736670066" ]
u606045429
p02868
python
s412630868
s673239603
588
485
50,164
50,252
Accepted
Accepted
17.52
from heapq import heappush, heappop INF = float("inf") N, M, *LRC = list(map(int, open(0).read().split())) E = [[] for _ in range(N)] for i in range(N - 1): E[i + 1].append((i, 0)) for l, r, c in zip(*[iter(LRC)] * 3): E[l - 1].append((r - 1, c)) D = [INF] * N D[0] = 0 Q = [0] while Q: ...
from heapq import heappush, heappop def main(): INF = float("inf") N, M, *LRC = list(map(int, open(0).read().split())) E = [[] for _ in range(N)] for i in range(N - 1): E[i + 1].append((i, 0)) for l, r, c in zip(*[iter(LRC)] * 3): E[l - 1].append((r - 1, c)) D = ...
26
28
558
643
from heapq import heappush, heappop INF = float("inf") N, M, *LRC = list(map(int, open(0).read().split())) E = [[] for _ in range(N)] for i in range(N - 1): E[i + 1].append((i, 0)) for l, r, c in zip(*[iter(LRC)] * 3): E[l - 1].append((r - 1, c)) D = [INF] * N D[0] = 0 Q = [0] while Q: t = heappop(Q) d...
from heapq import heappush, heappop def main(): INF = float("inf") N, M, *LRC = list(map(int, open(0).read().split())) E = [[] for _ in range(N)] for i in range(N - 1): E[i + 1].append((i, 0)) for l, r, c in zip(*[iter(LRC)] * 3): E[l - 1].append((r - 1, c)) D = [INF] * N D...
false
7.142857
[ "-INF = float(\"inf\")", "-N, M, *LRC = list(map(int, open(0).read().split()))", "-E = [[] for _ in range(N)]", "-for i in range(N - 1):", "- E[i + 1].append((i, 0))", "-for l, r, c in zip(*[iter(LRC)] * 3):", "- E[l - 1].append((r - 1, c))", "-D = [INF] * N", "-D[0] = 0", "-Q = [0]", "-wh...
false
0.039189
0.043364
0.903722
[ "s412630868", "s673239603" ]
u297574184
p02874
python
s306642406
s706168362
733
625
22,828
18,876
Accepted
Accepted
14.73
import sys input = sys.stdin.readline def solve(): N = int(eval(input())) LRs = [] Ls, Rs = [], [] for _ in range(N): L, R = list(map(int, input().split())) LRs.append((L, R)) Ls.append(L) Rs.append(R) Ls.sort(reverse=True) Rs.sort() maxL, m...
import sys input = sys.stdin.readline maxLR = 10**9 N = int(eval(input())) LRs = [] for _ in range(N): L, R = list(map(int, input().split())) LRs.append((L, R)) LRs.sort() accMinRs = [LRs[0][1]] for L, R in LRs[1:]: accMinRs.append(min(accMinRs[-1], R)) accMinRRevs = [LRs[-1][1]] for ...
75
34
1,707
768
import sys input = sys.stdin.readline def solve(): N = int(eval(input())) LRs = [] Ls, Rs = [], [] for _ in range(N): L, R = list(map(int, input().split())) LRs.append((L, R)) Ls.append(L) Rs.append(R) Ls.sort(reverse=True) Rs.sort() maxL, maxL2 = Ls[:2] ...
import sys input = sys.stdin.readline maxLR = 10**9 N = int(eval(input())) LRs = [] for _ in range(N): L, R = list(map(int, input().split())) LRs.append((L, R)) LRs.sort() accMinRs = [LRs[0][1]] for L, R in LRs[1:]: accMinRs.append(min(accMinRs[-1], R)) accMinRRevs = [LRs[-1][1]] for L, R in reversed(LRs[:...
false
54.666667
[ "-", "-", "-def solve():", "- N = int(eval(input()))", "- LRs = []", "- Ls, Rs = [], []", "- for _ in range(N):", "- L, R = list(map(int, input().split()))", "- LRs.append((L, R))", "- Ls.append(L)", "- Rs.append(R)", "- Ls.sort(reverse=True)", "- ...
false
0.101327
0.041075
2.466916
[ "s306642406", "s706168362" ]
u104386856
p02577
python
s860150111
s508928534
330
290
71,812
76,044
Accepted
Accepted
12.12
N = str(eval(input())) if int(N)%9 != 0: print("No") else: if int(N) == 0 :print("Yes") else: sum = 0 for i in range(0,len(N)): sum += int(N[i]) if sum%9 == 0: print("Yes") else: print("No")
N = str(eval(input())) if int(N)%9 != 0: print("No") else: if int(N) == 0 :print("Yes") else: sum = 0 for ki_tu in N: sum += int(ki_tu) if sum%9 == 0: print("Yes") else: print("No")
10
10
244
235
N = str(eval(input())) if int(N) % 9 != 0: print("No") else: if int(N) == 0: print("Yes") else: sum = 0 for i in range(0, len(N)): sum += int(N[i]) if sum % 9 == 0: print("Yes") else: print("No")
N = str(eval(input())) if int(N) % 9 != 0: print("No") else: if int(N) == 0: print("Yes") else: sum = 0 for ki_tu in N: sum += int(ki_tu) if sum % 9 == 0: print("Yes") else: print("No")
false
0
[ "- for i in range(0, len(N)):", "- sum += int(N[i])", "+ for ki_tu in N:", "+ sum += int(ki_tu)" ]
false
0.033245
0.036404
0.913245
[ "s860150111", "s508928534" ]
u562016607
p03575
python
s984441989
s217040014
107
22
3,064
3,064
Accepted
Accepted
79.44
N,M=list(map(int,input().split())) a=[0 for i in range(M)] b=[0 for i in range(M)] for i in range(M): a[i],b[i]=list(map(int,input().split())) a[i]-=1 b[i]-=1 par=[0 for i in range(N)] rnk=[0 for i in range(N)] def init(n): for i in range(N): par[i]=i rnk[i]=0 def find(x): ...
N,M=list(map(int,input().split())) a=[0 for i in range(M)] b=[0 for i in range(M)] for i in range(M): a[i],b[i]=list(map(int,input().split())) a[i]-=1 b[i]-=1 par=[0 for i in range(N)] rnk=[0 for i in range(N)] def init(n): for i in range(N): par[i]=i rnk[i]=0 def find(x): ...
51
48
1,015
937
N, M = list(map(int, input().split())) a = [0 for i in range(M)] b = [0 for i in range(M)] for i in range(M): a[i], b[i] = list(map(int, input().split())) a[i] -= 1 b[i] -= 1 par = [0 for i in range(N)] rnk = [0 for i in range(N)] def init(n): for i in range(N): par[i] = i rnk[i] = 0 ...
N, M = list(map(int, input().split())) a = [0 for i in range(M)] b = [0 for i in range(M)] for i in range(M): a[i], b[i] = list(map(int, input().split())) a[i] -= 1 b[i] -= 1 par = [0 for i in range(N)] rnk = [0 for i in range(N)] def init(n): for i in range(N): par[i] = i rnk[i] = 0 ...
false
5.882353
[ "- for j in range(N):", "- for k in range(N):", "- if find(j) != find(k):", "- flag = 1", "- break", "- if flag == 1:", "+ for j in range(1, N):", "+ if find(0) != find(j):", "+ flag = 1" ]
false
0.036395
0.054983
0.661934
[ "s984441989", "s217040014" ]
u729133443
p02824
python
s208631568
s975723257
238
118
69,800
14,052
Accepted
Accepted
50.42
n,m,v,p,*a=list(map(int,open(0).read().split())) a=sorted(a)[::-1] ok=p-1 ng=n while ng-ok>1: mid=(ok+ng)//2 c=a[mid]+m s=f=0 for t in a[p-1:mid]: if t>c:break s+=c-t else:f|=(p-1+n-mid)*m+s>=v*m if f:ok=mid else:ng=mid print((ok+1))
n,m,v,p,*a=list(map(int,open(0).read().split())) A=sorted(a)[-p::-1] s=m*v-m*n u=0 for a in A: if(A[0]-m)*u<=a*u>=s:s+=a;u+=1 print((p-1+u))
15
7
261
139
n, m, v, p, *a = list(map(int, open(0).read().split())) a = sorted(a)[::-1] ok = p - 1 ng = n while ng - ok > 1: mid = (ok + ng) // 2 c = a[mid] + m s = f = 0 for t in a[p - 1 : mid]: if t > c: break s += c - t else: f |= (p - 1 + n - mid) * m + s >= v * m if ...
n, m, v, p, *a = list(map(int, open(0).read().split())) A = sorted(a)[-p::-1] s = m * v - m * n u = 0 for a in A: if (A[0] - m) * u <= a * u >= s: s += a u += 1 print((p - 1 + u))
false
53.333333
[ "-a = sorted(a)[::-1]", "-ok = p - 1", "-ng = n", "-while ng - ok > 1:", "- mid = (ok + ng) // 2", "- c = a[mid] + m", "- s = f = 0", "- for t in a[p - 1 : mid]:", "- if t > c:", "- break", "- s += c - t", "- else:", "- f |= (p - 1 + n - mid) * ...
false
0.046586
0.038338
1.215156
[ "s208631568", "s975723257" ]
u671060652
p03221
python
s798601994
s731445742
1,377
913
117,332
103,892
Accepted
Accepted
33.7
import itertools import math import fractions import functools n, m = list(map(int, input().split())) py = [] for i in range(m): l = list(map(int, input().split())) l.append(i) py.append(l) # py = [p,y,index] # yでsort py.sort(key=lambda x: x[1]) prev = 0 py.sort(key=lambda x: x[0]) # py...
import itertools import math import fractions import functools n, m = list(map(int, input().split())) py = [] for i in range(m): l = list(map(int, input().split())) l.append(i) py.append(l) # py = [p,y,index] # yでsort py.sort(key=lambda x: x[1]) ans = [0] * (m) ans1 = [0] * (m) memo =...
57
30
1,387
566
import itertools import math import fractions import functools n, m = list(map(int, input().split())) py = [] for i in range(m): l = list(map(int, input().split())) l.append(i) py.append(l) # py = [p,y,index] # yでsort py.sort(key=lambda x: x[1]) prev = 0 py.sort(key=lambda x: x[0]) # py = [p, y, index, pの中...
import itertools import math import fractions import functools n, m = list(map(int, input().split())) py = [] for i in range(m): l = list(map(int, input().split())) l.append(i) py.append(l) # py = [p,y,index] # yでsort py.sort(key=lambda x: x[1]) ans = [0] * (m) ans1 = [0] * (m) memo = {} for item in py: ...
false
47.368421
[ "-prev = 0", "-py.sort(key=lambda x: x[0])", "-# py = [p, y, index, pの中でのindex]", "+ans = [0] * (m)", "+ans1 = [0] * (m)", "+memo = {}", "+for item in py:", "+ ken = item[0]", "+ year = item[1]", "+ idx = item[2]", "+ ith = memo.get(ken, 1)", "+ ans[idx] = ith", "+ ans1[idx...
false
0.041345
0.037659
1.09789
[ "s798601994", "s731445742" ]
u758831502
p02713
python
s005462475
s685830822
504
141
67,804
68,000
Accepted
Accepted
72.02
import math a=int(eval(input())) t=0 """ for i in range(1,a+1): for j in range(i,a+1): for k in range(j,a+1): print(i,j,k) if i==j and j==k: t+=math.gcd(math.gcd(i,j),k) else: t+=(math.gcd(math.gcd(i,j),k)*3) print(t) """ for i in range(1,a+1): ...
import math a=int(eval(input())) t=0 for i in range(1,a+1): for j in range(i,a+1): for k in range(j,a+1): #print(i,j,k) if i==j and j==k: t+=math.gcd(math.gcd(i,j),k) elif i!=j and j!=k and i!=k: t+=(math.gcd(math.gcd(i,j),k)*6) else: t+=...
25
20
410
355
import math a = int(eval(input())) t = 0 """ for i in range(1,a+1): for j in range(i,a+1): for k in range(j,a+1): print(i,j,k) if i==j and j==k: t+=math.gcd(math.gcd(i,j),k) else: t+=(math.gcd(math.gcd(i,j),k)*3) print(t) """ for i in range(1, a + 1): for j in range(1, a + 1...
import math a = int(eval(input())) t = 0 for i in range(1, a + 1): for j in range(i, a + 1): for k in range(j, a + 1): # print(i,j,k) if i == j and j == k: t += math.gcd(math.gcd(i, j), k) elif i != j and j != k and i != k: t += math.gcd(m...
false
20
[ "-\"\"\"", "-for i in range(1,a+1):", "- for j in range(i,a+1):", "- for k in range(j,a+1):", "- print(i,j,k)", "- if i==j and j==k:", "- t+=math.gcd(math.gcd(i,j),k)", "- else:", "- t+=(math.gcd(math.gcd(i,j),k)*3)", "+for i in range(1, a + 1):", "+ for j in ...
false
0.174223
0.067862
2.567298
[ "s005462475", "s685830822" ]
u563876281
p02396
python
s759048005
s382592866
60
30
6,224
6,276
Accepted
Accepted
50
i = 0 while 1: i+=1 v = input() if v == '0': break print(('Case {}: {}'.format(i,v)))
i = 0 while 1: i+=1 x = input() if x == '0': break print(('Case {}: {}'.format(i,x)))
7
7
117
117
i = 0 while 1: i += 1 v = input() if v == "0": break print(("Case {}: {}".format(i, v)))
i = 0 while 1: i += 1 x = input() if x == "0": break print(("Case {}: {}".format(i, x)))
false
0
[ "- v = input()", "- if v == \"0\":", "+ x = input()", "+ if x == \"0\":", "- print((\"Case {}: {}\".format(i, v)))", "+ print((\"Case {}: {}\".format(i, x)))" ]
false
0.132718
0.099421
1.33491
[ "s759048005", "s382592866" ]
u260036763
p03160
python
s245821960
s203023510
129
104
13,928
20,444
Accepted
Accepted
19.38
N = int(eval(input())) h = list(map(int, input().split())) dp = [0]*N 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[-1]))
def main(): N = int(eval(input())) h = list(map(int, input().split())) dp = [0]*N dp[1] = abs(h[0] - h[1]) for i in range(2, N): dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2] - h[i])) print((dp[-1])) if __name__ == '__main__': main()
7
12
196
300
N = int(eval(input())) h = list(map(int, input().split())) dp = [0] * N 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[-1]))
def main(): N = int(eval(input())) h = list(map(int, input().split())) dp = [0] * N dp[1] = abs(h[0] - h[1]) for i in range(2, N): dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i])) print((dp[-1])) if __name__ == "__main__": main()
false
41.666667
[ "-N = int(eval(input()))", "-h = list(map(int, input().split()))", "-dp = [0] * N", "-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[-1]))", "+def main():", "+ N = int(eval(input()))", "+ ...
false
0.040073
0.043927
0.912279
[ "s245821960", "s203023510" ]
u345966487
p02845
python
s133665679
s975259419
474
116
117,548
13,964
Accepted
Accepted
75.53
import itertools import sys from collections import Counter sys.setrecursionlimit(10 ** 9) M = 1000000007 N = int(sys.stdin.readline()) left = list(map(int, sys.stdin.read().split())) counter = Counter(left) def dp(t, ns): cached = t.get(ns) if cached is not None: return cached rem...
M = 1000000007 N = int(eval(input())) left = list(map(int, input().split())) def solve(): res = 1 h = [0, 0, 0] for i in range(N): k = h.count(left[i]) res = res * k % M for j in range(3): if h[j] == left[i]: h[j] += 1 break...
55
19
1,289
351
import itertools import sys from collections import Counter sys.setrecursionlimit(10**9) M = 1000000007 N = int(sys.stdin.readline()) left = list(map(int, sys.stdin.read().split())) counter = Counter(left) def dp(t, ns): cached = t.get(ns) if cached is not None: return cached remaining = sum(ns) ...
M = 1000000007 N = int(eval(input())) left = list(map(int, input().split())) def solve(): res = 1 h = [0, 0, 0] for i in range(N): k = h.count(left[i]) res = res * k % M for j in range(3): if h[j] == left[i]: h[j] += 1 break return re...
false
65.454545
[ "-import itertools", "-import sys", "-from collections import Counter", "-", "-sys.setrecursionlimit(10**9)", "-N = int(sys.stdin.readline())", "-left = list(map(int, sys.stdin.read().split()))", "-counter = Counter(left)", "+N = int(eval(input()))", "+left = list(map(int, input().split()))", "-...
false
0.257192
0.036164
7.111896
[ "s133665679", "s975259419" ]
u451012573
p02762
python
s853971634
s589182666
1,920
1,650
130,660
53,600
Accepted
Accepted
14.06
N, M, K = map(int, input().split()) par = list(range(N)) siz = [1] * N n_friend = [0] * N def root(x): if par[x] == x: return x else: par[x] = root(par[x]) return par[x] def same(x, y): return root(x) == root(y) def unite(x, y): x = root(x) y = root(...
class UnionFind: def __init__(self, n): self.par = list(range(n)) # self.par[x] = y: xの属する木の根はy self.siz = [1] * n def root(self, x): if self.par[x] == x: return x else: self.par[x] = self.root(self.par[x]) return self.par[x] ...
61
61
1,149
1,485
N, M, K = map(int, input().split()) par = list(range(N)) siz = [1] * N n_friend = [0] * N def root(x): if par[x] == x: return x else: par[x] = root(par[x]) return par[x] def same(x, y): return root(x) == root(y) def unite(x, y): x = root(x) y = root(y) if x == y: ...
class UnionFind: def __init__(self, n): self.par = list(range(n)) # self.par[x] = y: xの属する木の根はy self.siz = [1] * n def root(self, x): if self.par[x] == x: return x else: self.par[x] = self.root(self.par[x]) return self.par[x] def same(se...
false
0
[ "-N, M, K = map(int, input().split())", "-par = list(range(N))", "-siz = [1] * N", "-n_friend = [0] * N", "+class UnionFind:", "+ def __init__(self, n):", "+ self.par = list(range(n)) # self.par[x] = y: xの属する木の根はy", "+ self.siz = [1] * n", "+", "+ def root(self, x):", "+ ...
false
0.044274
0.066758
0.663197
[ "s853971634", "s589182666" ]
u073852194
p02728
python
s552280501
s173027792
2,513
1,876
284,868
229,064
Accepted
Accepted
25.35
class Factorial(): def __init__(self, n, mod): self.mod = mod self.factorial = [0 for _ in range(n + 1)] self.inv = [0 for _ in range(n + 1)] self.factorial[0] = 1 self.inv[0] = 1 for i in range(n): self.factorial[i + 1] = self.factorial[i] * (i + ...
class Tree(): def __init__(self, n, edge): self.n = n self.tree = [[] for _ in range(n)] for e in edge: self.tree[e[0] - 1].append(e[1] - 1) self.tree[e[1] - 1].append(e[0] - 1) def setroot(self, root): self.root = root self.parent = [No...
129
106
3,563
3,183
class Factorial: def __init__(self, n, mod): self.mod = mod self.factorial = [0 for _ in range(n + 1)] self.inv = [0 for _ in range(n + 1)] self.factorial[0] = 1 self.inv[0] = 1 for i in range(n): self.factorial[i + 1] = self.factorial[i] * (i + 1) % mod ...
class Tree: def __init__(self, n, edge): self.n = n self.tree = [[] for _ in range(n)] for e in edge: self.tree[e[0] - 1].append(e[1] - 1) self.tree[e[1] - 1].append(e[0] - 1) def setroot(self, root): self.root = root self.parent = [None for _ in ...
false
17.829457
[ "+class Tree:", "+ def __init__(self, n, edge):", "+ self.n = n", "+ self.tree = [[] for _ in range(n)]", "+ for e in edge:", "+ self.tree[e[0] - 1].append(e[1] - 1)", "+ self.tree[e[1] - 1].append(e[0] - 1)", "+", "+ def setroot(self, root):", "+ ...
false
0.047477
0.046863
1.013092
[ "s552280501", "s173027792" ]
u517910772
p02720
python
s317123737
s639931705
1,287
268
15,396
10,840
Accepted
Accepted
79.18
def d(): k = int(eval(input())) val = 0 hits = 0 hit_tails = {} while hits < k: val += 1 if len(str(val)) == 1: hits += 1 hit_tails[val] = int(str(val)[-1]) # print('====', hits, val) pass else: lst = ...
from collections import deque def lunlun(): k = int(eval(input())) q = deque(list(range(1, 10))) while k > 0: k -= 1 n = q.popleft() # print('====== popleft:', n) if n % 10 != 0: n0 = int(str(n) + str(n % 10 - 1)) q.append(n0) ...
41
32
1,232
662
def d(): k = int(eval(input())) val = 0 hits = 0 hit_tails = {} while hits < k: val += 1 if len(str(val)) == 1: hits += 1 hit_tails[val] = int(str(val)[-1]) # print('====', hits, val) pass else: lst = list(map(int, s...
from collections import deque def lunlun(): k = int(eval(input())) q = deque(list(range(1, 10))) while k > 0: k -= 1 n = q.popleft() # print('====== popleft:', n) if n % 10 != 0: n0 = int(str(n) + str(n % 10 - 1)) q.append(n0) # print('==...
false
21.95122
[ "-def d():", "+from collections import deque", "+", "+", "+def lunlun():", "- val = 0", "- hits = 0", "- hit_tails = {}", "- while hits < k:", "- val += 1", "- if len(str(val)) == 1:", "- hits += 1", "- hit_tails[val] = int(str(val)[-1])", "-...
false
0.260869
0.120576
2.163521
[ "s317123737", "s639931705" ]
u440551778
p04001
python
s426813726
s169426078
28
25
3,060
3,060
Accepted
Accepted
10.71
s = eval(input()) sa = [i for i in s] r = 0 for i in range(2**(len(s)-1)): # 状態数 si = sa[0] for j in range(len(s) - 1): t = 2 ** j # 2^jなので常に2の倍数、 if i & t: # どこのビットが1か判定できる 2進数のビット判定を10進数のままやってるイメージ si += '+' # 1なら+を挿入 si += sa[j+1] r += eval(si) # evalは文の...
s = input() n = len(s) def dfs(i, f): if i == n-1: return eval(f) return dfs(i+1, f+'+' + s[i+1]) + \ dfs(i+1, f+s[i+1]) print(dfs(0, s[0]))
13
13
350
182
s = eval(input()) sa = [i for i in s] r = 0 for i in range(2 ** (len(s) - 1)): # 状態数 si = sa[0] for j in range(len(s) - 1): t = 2**j # 2^jなので常に2の倍数、 if i & t: # どこのビットが1か判定できる 2進数のビット判定を10進数のままやってるイメージ si += "+" # 1なら+を挿入 si += sa[j + 1] r += eval(si) # evalは文の実行なので文...
s = input() n = len(s) def dfs(i, f): if i == n - 1: return eval(f) return dfs(i + 1, f + "+" + s[i + 1]) + dfs(i + 1, f + s[i + 1]) print(dfs(0, s[0]))
false
0
[ "-s = eval(input())", "-sa = [i for i in s]", "-r = 0", "-for i in range(2 ** (len(s) - 1)): # 状態数", "- si = sa[0]", "- for j in range(len(s) - 1):", "- t = 2**j # 2^jなので常に2の倍数、", "- if i & t: # どこのビットが1か判定できる 2進数のビット判定を10進数のままやってるイメージ", "- si += \"+\" # 1なら+を挿入", ...
false
0.081716
0.080243
1.018363
[ "s426813726", "s169426078" ]
u802963389
p02972
python
s440770347
s188513307
532
277
14,132
14,652
Accepted
Accepted
47.93
N = int(eval(input())) A = list(map(int, input().split())) ans = [0]*(N+1) for i in range(1, N + 1)[::-1]: sum_ans = sum(ans[x] for x in range(i, N + 1, i)) if sum_ans % 2 != A[i - 1]: ans[i] = 1 print((sum(ans))) # print(ans) prt = [] if sum(ans) > 0: for i, v in enumerate(...
n = int(eval(input())) A = list(map(int, input().split())) box = [0] * n ans = [] cnt = 0 for itr, val in enumerate(A[::-1]): idx = n - itr -1 sums_mod2 = sum(box[idx::idx+1]) % 2 if val != sums_mod2: box[idx] += 1 cnt += 1 ans.append(idx + 1) print(cnt) print((*ans))
20
17
373
301
N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * (N + 1) for i in range(1, N + 1)[::-1]: sum_ans = sum(ans[x] for x in range(i, N + 1, i)) if sum_ans % 2 != A[i - 1]: ans[i] = 1 print((sum(ans))) # print(ans) prt = [] if sum(ans) > 0: for i, v in enumerate(ans): if v !=...
n = int(eval(input())) A = list(map(int, input().split())) box = [0] * n ans = [] cnt = 0 for itr, val in enumerate(A[::-1]): idx = n - itr - 1 sums_mod2 = sum(box[idx :: idx + 1]) % 2 if val != sums_mod2: box[idx] += 1 cnt += 1 ans.append(idx + 1) print(cnt) print((*ans))
false
15
[ "-N = int(eval(input()))", "+n = int(eval(input()))", "-ans = [0] * (N + 1)", "-for i in range(1, N + 1)[::-1]:", "- sum_ans = sum(ans[x] for x in range(i, N + 1, i))", "- if sum_ans % 2 != A[i - 1]:", "- ans[i] = 1", "-print((sum(ans)))", "-# print(ans)", "-prt = []", "-if sum(ans)...
false
0.043867
0.088068
0.498106
[ "s440770347", "s188513307" ]
u770076823
p02689
python
s029088235
s649412938
299
263
24,832
19,940
Accepted
Accepted
12.04
N, M = list(map(int, input().split())) H = list(map(int, input().split())) A = [] B = [] no_good = [] for i in range(M): t = list(map(int, input().split())) A.append(t[0]) B.append(t[1]) for i in range(M): if H[A[i]-1] > H[B[i]-1]: no_good.append(B[i]) elif H[A[i]-1] < H[B[...
N, M = list(map(int, input().split())) H = list(map(int, input().split())) no_good = [] for i in range(M): A, B = list(map(int, input().split())) if H[A-1] > H[B-1]: no_good.append(B) elif H[A-1] < H[B-1]: no_good.append(A) else: no_good.append(A) no_good.app...
23
16
471
364
N, M = list(map(int, input().split())) H = list(map(int, input().split())) A = [] B = [] no_good = [] for i in range(M): t = list(map(int, input().split())) A.append(t[0]) B.append(t[1]) for i in range(M): if H[A[i] - 1] > H[B[i] - 1]: no_good.append(B[i]) elif H[A[i] - 1] < H[B[i] - 1]: ...
N, M = list(map(int, input().split())) H = list(map(int, input().split())) no_good = [] for i in range(M): A, B = list(map(int, input().split())) if H[A - 1] > H[B - 1]: no_good.append(B) elif H[A - 1] < H[B - 1]: no_good.append(A) else: no_good.append(A) no_good.append(B...
false
30.434783
[ "-A = []", "-B = []", "- t = list(map(int, input().split()))", "- A.append(t[0])", "- B.append(t[1])", "-for i in range(M):", "- if H[A[i] - 1] > H[B[i] - 1]:", "- no_good.append(B[i])", "- elif H[A[i] - 1] < H[B[i] - 1]:", "- no_good.append(A[i])", "+ A, B = list...
false
0.141693
0.138981
1.019511
[ "s029088235", "s649412938" ]
u411544692
p04044
python
s290565362
s257641447
27
17
2,568
3,060
Accepted
Accepted
37.04
N, L = list(map(int, input().split())) Ss = [input() for i in range(N)] sort_Ss = sorted(Ss) joined_Ss = ''.join(sort_Ss) print(joined_Ss)
N, L = list(map(int, input().split())) words = [eval(input()) for _ in range(N)] words.sort() ans = ''.join(words) print(ans)
7
5
148
117
N, L = list(map(int, input().split())) Ss = [input() for i in range(N)] sort_Ss = sorted(Ss) joined_Ss = "".join(sort_Ss) print(joined_Ss)
N, L = list(map(int, input().split())) words = [eval(input()) for _ in range(N)] words.sort() ans = "".join(words) print(ans)
false
28.571429
[ "-Ss = [input() for i in range(N)]", "-sort_Ss = sorted(Ss)", "-joined_Ss = \"\".join(sort_Ss)", "-print(joined_Ss)", "+words = [eval(input()) for _ in range(N)]", "+words.sort()", "+ans = \"\".join(words)", "+print(ans)" ]
false
0.041458
0.059344
0.698603
[ "s290565362", "s257641447" ]
u325282913
p03221
python
s257965724
s305958576
1,076
867
41,412
45,696
Accepted
Accepted
19.42
N, M = list(map(int,input().split())) array = [] ans = [] for i in range(M): array.append(list(map(int, input().split()))+[i]) array.sort() count = 1 for i in range(M): id_left = str(array[i][0]) while len(id_left) < 6: id_left = '0' + id_left id_right = str(count) while len(id_r...
N, M = list(map(int, input().split())) p = [] for i in range(M): tmp = list(map(int, input().split())) tmp.append(i) p.append(tmp) p.sort() ans = [] count = 1 for i in range(M): if p[i-1][0] != p[i][0]: count = 1 elif i != 0: count += 1 id = str(p[i][0]).zfill(6)+st...
25
19
587
405
N, M = list(map(int, input().split())) array = [] ans = [] for i in range(M): array.append(list(map(int, input().split())) + [i]) array.sort() count = 1 for i in range(M): id_left = str(array[i][0]) while len(id_left) < 6: id_left = "0" + id_left id_right = str(count) while len(id_right) < 6...
N, M = list(map(int, input().split())) p = [] for i in range(M): tmp = list(map(int, input().split())) tmp.append(i) p.append(tmp) p.sort() ans = [] count = 1 for i in range(M): if p[i - 1][0] != p[i][0]: count = 1 elif i != 0: count += 1 id = str(p[i][0]).zfill(6) + str(count).z...
false
24
[ "-array = []", "+p = []", "+for i in range(M):", "+ tmp = list(map(int, input().split()))", "+ tmp.append(i)", "+ p.append(tmp)", "+p.sort()", "-for i in range(M):", "- array.append(list(map(int, input().split())) + [i])", "-array.sort()", "- id_left = str(array[i][0])", "- w...
false
0.036563
0.09029
0.40495
[ "s257965724", "s305958576" ]
u493520238
p02630
python
s112223540
s281636803
330
300
92,256
97,756
Accepted
Accepted
9.09
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): ...
n = int(eval(input())) al = list(map(int, input().split())) num_cnt = {} c_sum = 0 for a in al: num_cnt.setdefault(a,0) num_cnt[a] += 1 c_sum += a ans = [] q = int(eval(input())) for _ in range(q): b,c = list(map(int, input().split())) num_cnt.setdefault(b,0) num_cnt.setdefaul...
80
26
1,835
473
class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = se...
n = int(eval(input())) al = list(map(int, input().split())) num_cnt = {} c_sum = 0 for a in al: num_cnt.setdefault(a, 0) num_cnt[a] += 1 c_sum += a ans = [] q = int(eval(input())) for _ in range(q): b, c = list(map(int, input().split())) num_cnt.setdefault(b, 0) num_cnt.setdefault(c, 0) diff...
false
67.5
[ "-class UnionFind:", "- def __init__(self, n):", "- self.n = n", "- self.parents = [-1] * n", "-", "- def find(self, x):", "- if self.parents[x] < 0:", "- return x", "- else:", "- self.parents[x] = self.find(self.parents[x])", "- ...
false
0.048617
0.047681
1.019619
[ "s112223540", "s281636803" ]
u353797797
p03044
python
s338376691
s833217796
851
771
47,200
100,300
Accepted
Accepted
9.4
n = int(eval(input())) pea = [[] for _ in range(n + 1)] for _ in range(n - 1): u, v, w = list(map(int, input().split())) w %= 2 pea[u].append([v, w]) pea[v].append([u, w]) ans = [-1] * (n + 1) ans[1]=1 nodes=[1] used=set() used.add(1) ansi=1 while nodes: nn=[] for i in nodes: ...
import sys from collections import defaultdict sys.setrecursionlimit(10 ** 6) def main(): def dfs(i=0,oi=-1): for ki,w in to[i]: if ki==oi:continue ans[ki]=(ans[i]+w)%2 dfs(ki,i) n=int(eval(input())) to=defaultdict(list) for _ in range(n-1): ...
25
24
511
517
n = int(eval(input())) pea = [[] for _ in range(n + 1)] for _ in range(n - 1): u, v, w = list(map(int, input().split())) w %= 2 pea[u].append([v, w]) pea[v].append([u, w]) ans = [-1] * (n + 1) ans[1] = 1 nodes = [1] used = set() used.add(1) ansi = 1 while nodes: nn = [] for i in nodes: a...
import sys from collections import defaultdict sys.setrecursionlimit(10**6) def main(): def dfs(i=0, oi=-1): for ki, w in to[i]: if ki == oi: continue ans[ki] = (ans[i] + w) % 2 dfs(ki, i) n = int(eval(input())) to = defaultdict(list) for _...
false
4
[ "-n = int(eval(input()))", "-pea = [[] for _ in range(n + 1)]", "-for _ in range(n - 1):", "- u, v, w = list(map(int, input().split()))", "- w %= 2", "- pea[u].append([v, w])", "- pea[v].append([u, w])", "-ans = [-1] * (n + 1)", "-ans[1] = 1", "-nodes = [1]", "-used = set()", "-use...
false
0.036849
0.043655
0.8441
[ "s338376691", "s833217796" ]
u171065106
p03944
python
s990145105
s226269177
61
18
3,188
3,064
Accepted
Accepted
70.49
w, h, n = list(map(int, input().split())) coords = [list(map(int, input().split())) for _ in range(n)] pic = [[1 for _ in range(w)] for _ in range(h)] for x, y, a in coords: if a == 1: for row in pic: for i in range(x): row[i] = 0 elif a == 2: for row i...
w, h, n = list(map(int, input().split())) coords = [list(map(int, input().split())) for _ in range(n)] minx, maxx = 0, w miny, maxy = 0, h for x, y, a in coords: if a == 1: minx = max(minx, x) elif a == 2: maxx = min(maxx, x) elif a == 3: miny = max(miny, y) elif ...
28
20
650
442
w, h, n = list(map(int, input().split())) coords = [list(map(int, input().split())) for _ in range(n)] pic = [[1 for _ in range(w)] for _ in range(h)] for x, y, a in coords: if a == 1: for row in pic: for i in range(x): row[i] = 0 elif a == 2: for row in pic: ...
w, h, n = list(map(int, input().split())) coords = [list(map(int, input().split())) for _ in range(n)] minx, maxx = 0, w miny, maxy = 0, h for x, y, a in coords: if a == 1: minx = max(minx, x) elif a == 2: maxx = min(maxx, x) elif a == 3: miny = max(miny, y) elif a == 4: ...
false
28.571429
[ "-pic = [[1 for _ in range(w)] for _ in range(h)]", "+minx, maxx = 0, w", "+miny, maxy = 0, h", "- for row in pic:", "- for i in range(x):", "- row[i] = 0", "+ minx = max(minx, x)", "- for row in pic:", "- for i in range(x, w):", "- ...
false
0.182159
0.035742
5.096504
[ "s990145105", "s226269177" ]
u989345508
p03607
python
s719710636
s245456110
291
206
17,384
11,884
Accepted
Accepted
29.21
n=int(eval(input())) x=sorted([int(eval(input())) for i in range(n)]) def groupby(a): a2=[[a[0],1]] for i in range(1,len(a)): if a2[-1][0]==a[i]: a2[-1][1]+=1 else: a2.append([a[i],1]) return a2 y=groupby(x) c=0 for i in y: if i[1]%2==1: ...
n=int(eval(input())) s=set() for i in range(n): a=int(eval(input())) if a in s: s.remove(a) else: s.add(a) print((len(s)))
18
9
323
145
n = int(eval(input())) x = sorted([int(eval(input())) for i in range(n)]) def groupby(a): a2 = [[a[0], 1]] for i in range(1, len(a)): if a2[-1][0] == a[i]: a2[-1][1] += 1 else: a2.append([a[i], 1]) return a2 y = groupby(x) c = 0 for i in y: if i[1] % 2 == 1: ...
n = int(eval(input())) s = set() for i in range(n): a = int(eval(input())) if a in s: s.remove(a) else: s.add(a) print((len(s)))
false
50
[ "-x = sorted([int(eval(input())) for i in range(n)])", "-", "-", "-def groupby(a):", "- a2 = [[a[0], 1]]", "- for i in range(1, len(a)):", "- if a2[-1][0] == a[i]:", "- a2[-1][1] += 1", "- else:", "- a2.append([a[i], 1])", "- return a2", "-", "-",...
false
0.04217
0.042904
0.982905
[ "s719710636", "s245456110" ]
u130900604
p02791
python
s269550032
s710737194
136
89
24,744
24,744
Accepted
Accepted
34.56
n=int(eval(input())) a=list(map(int,input().split())) m=a[0] ans=0 for i in a: if i<=m: ans+=1 m=min(i,m) #print(m) print(ans)
now_min=float("inf") n=int(eval(input())) p=list(map(int,input().split())) ans=0 for pi in p: if pi<=now_min: ans+=1 now_min=pi print(ans)
12
9
145
150
n = int(eval(input())) a = list(map(int, input().split())) m = a[0] ans = 0 for i in a: if i <= m: ans += 1 m = min(i, m) # print(m) print(ans)
now_min = float("inf") n = int(eval(input())) p = list(map(int, input().split())) ans = 0 for pi in p: if pi <= now_min: ans += 1 now_min = pi print(ans)
false
25
[ "+now_min = float(\"inf\")", "-a = list(map(int, input().split()))", "-m = a[0]", "+p = list(map(int, input().split()))", "-for i in a:", "- if i <= m:", "+for pi in p:", "+ if pi <= now_min:", "- m = min(i, m)", "- # print(m)", "+ now_min = pi" ]
false
0.081683
0.072553
1.125834
[ "s269550032", "s710737194" ]
u131464432
p02971
python
s787321339
s794972168
420
387
16,912
18,964
Accepted
Accepted
7.86
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] A_max = 0 for i in range(N): A_max = max(A_max,A[i]) cnt = 0 for j in range(N): if A_max == A[j]: cnt += 1 if cnt == 2: for _ in range(N): print(A_max) exit() A[A.index(A_max)] = 0 A_second = 0 for l in range(N): ...
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] B = sorted(A) bool = 1 if B[-1] == B[-2] else 0 for i in range(N): if bool: print((B[-1])) else: if A[i] == B[-1]: print((B[-2])) else: print((B[-1]))
19
12
401
237
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] A_max = 0 for i in range(N): A_max = max(A_max, A[i]) cnt = 0 for j in range(N): if A_max == A[j]: cnt += 1 if cnt == 2: for _ in range(N): print(A_max) exit() A[A.index(A_max)] = 0 A_second = 0 for l in ra...
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] B = sorted(A) bool = 1 if B[-1] == B[-2] else 0 for i in range(N): if bool: print((B[-1])) else: if A[i] == B[-1]: print((B[-2])) else: print((B[-1]))
false
36.842105
[ "-A_max = 0", "+B = sorted(A)", "+bool = 1 if B[-1] == B[-2] else 0", "- A_max = max(A_max, A[i])", "-cnt = 0", "-for j in range(N):", "- if A_max == A[j]:", "- cnt += 1", "- if cnt == 2:", "- for _ in range(N):", "- print(A_max)", "- exit()", "-A[A.i...
false
0.044902
0.04727
0.949913
[ "s787321339", "s794972168" ]
u078042885
p00728
python
s581030459
s954172329
40
30
7,744
7,692
Accepted
Accepted
25
while 1: n=int(eval(input())) if n==0:break a=[int(eval(input())) for _ in range(n)] print(((sum(a)-max(a)-min(a))//(n-2)))
while 1: n=int(eval(input())) if n==0:break print(((sum(sorted([int(eval(input())) for _ in range(n)])[1:-1]))//(n-2)))
5
4
129
120
while 1: n = int(eval(input())) if n == 0: break a = [int(eval(input())) for _ in range(n)] print(((sum(a) - max(a) - min(a)) // (n - 2)))
while 1: n = int(eval(input())) if n == 0: break print(((sum(sorted([int(eval(input())) for _ in range(n)])[1:-1])) // (n - 2)))
false
20
[ "- a = [int(eval(input())) for _ in range(n)]", "- print(((sum(a) - max(a) - min(a)) // (n - 2)))", "+ print(((sum(sorted([int(eval(input())) for _ in range(n)])[1:-1])) // (n - 2)))" ]
false
0.139474
0.039911
3.49466
[ "s581030459", "s954172329" ]
u526818929
p02657
python
s174626066
s556342358
31
27
9,092
9,144
Accepted
Accepted
12.9
# 1.入力を受け取ること # スペース区切りの入力を整数として受け取れる「2 5」 -> 「a=2, B=5」となる a, b = list(map(int, input().split())) # print(a) # print(b) # 2.受け取った結果を使って目的の計算をすること answer = a * b # 3.出力すること print(answer)
A, B = list(map(int,input().split())) print((A * B))
13
3
196
48
# 1.入力を受け取ること # スペース区切りの入力を整数として受け取れる「2 5」 -> 「a=2, B=5」となる a, b = list(map(int, input().split())) # print(a) # print(b) # 2.受け取った結果を使って目的の計算をすること answer = a * b # 3.出力すること print(answer)
A, B = list(map(int, input().split())) print((A * B))
false
76.923077
[ "-# 1.入力を受け取ること", "-# スペース区切りの入力を整数として受け取れる「2 5」 -> 「a=2, B=5」となる", "-a, b = list(map(int, input().split()))", "-# print(a)", "-# print(b)", "-# 2.受け取った結果を使って目的の計算をすること", "-answer = a * b", "-# 3.出力すること", "-print(answer)", "+A, B = list(map(int, input().split()))", "+print((A * B))" ]
false
0.04845
0.048598
0.996944
[ "s174626066", "s556342358" ]
u540761833
p03078
python
s418906307
s657471647
1,058
486
150,060
17,952
Accepted
Accepted
54.06
from itertools import product X,Y,Z,K = list(map(int,input().split())) A = list(map(int,input().split())) B = list(map(int,input().split())) C = list(map(int,input().split())) AB = sorted([a+b for a,b in product(A,B)],reverse=True)[:K] ans = sorted([a+b for a,b in product(AB,C)],reverse=True)[:K] for i in ans: ...
X,Y,Z,K = list(map(int,input().split())) A = sorted(list(map(int,input().split())),reverse=1) B = sorted(list(map(int,input().split())),reverse=1) C = sorted(list(map(int,input().split())),reverse=1) num= [] for xi in range(1,X+1): for yi in range(1,Y+1): for zi in range(1,K//(xi*yi)+1): ...
9
17
326
514
from itertools import product X, Y, Z, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) AB = sorted([a + b for a, b in product(A, B)], reverse=True)[:K] ans = sorted([a + b for a, b in product(AB, C)], reverse=True)[:K] for ...
X, Y, Z, K = list(map(int, input().split())) A = sorted(list(map(int, input().split())), reverse=1) B = sorted(list(map(int, input().split())), reverse=1) C = sorted(list(map(int, input().split())), reverse=1) num = [] for xi in range(1, X + 1): for yi in range(1, Y + 1): for zi in range(1, K // (xi * yi) +...
false
47.058824
[ "-from itertools import product", "-", "-A = list(map(int, input().split()))", "-B = list(map(int, input().split()))", "-C = list(map(int, input().split()))", "-AB = sorted([a + b for a, b in product(A, B)], reverse=True)[:K]", "-ans = sorted([a + b for a, b in product(AB, C)], reverse=True)[:K]", "-f...
false
0.036397
0.037902
0.960312
[ "s418906307", "s657471647" ]
u794145298
p02702
python
s158669850
s553939760
433
60
79,492
68,292
Accepted
Accepted
86.14
S = eval(input()) ans = 0 mods = [0] * 2019 mods[0] = 1 curr = 0 x = 1 for d in S: curr = curr * 10 + int(d) ans += mods[curr * x % 2019] mods[curr * x % 2019] += 1 x = x * 202 % 2019 curr %= 2019 print(ans)
S = eval(input()) ans = 0 mods = [0] * 2019 mods[0] = 1 curr = 0 x = 1 for d in reversed(S): curr = (curr + int(d) * x) % 2019 ans += mods[curr % 2019] mods[curr % 2019] += 1 x = x * 10 % 2019 print(ans)
13
12
234
225
S = eval(input()) ans = 0 mods = [0] * 2019 mods[0] = 1 curr = 0 x = 1 for d in S: curr = curr * 10 + int(d) ans += mods[curr * x % 2019] mods[curr * x % 2019] += 1 x = x * 202 % 2019 curr %= 2019 print(ans)
S = eval(input()) ans = 0 mods = [0] * 2019 mods[0] = 1 curr = 0 x = 1 for d in reversed(S): curr = (curr + int(d) * x) % 2019 ans += mods[curr % 2019] mods[curr % 2019] += 1 x = x * 10 % 2019 print(ans)
false
7.692308
[ "-for d in S:", "- curr = curr * 10 + int(d)", "- ans += mods[curr * x % 2019]", "- mods[curr * x % 2019] += 1", "- x = x * 202 % 2019", "- curr %= 2019", "+for d in reversed(S):", "+ curr = (curr + int(d) * x) % 2019", "+ ans += mods[curr % 2019]", "+ mods[curr % 2019] += ...
false
0.037761
0.044736
0.844091
[ "s158669850", "s553939760" ]
u353917577
p03601
python
s239581071
s487288328
617
444
123,616
123,652
Accepted
Accepted
28.04
a,b,c,d,e,f=list(map(int,input().split())) q=[] for t in range(0,f+1,a*100): for w in range(t,f+1,b*100): if w>0: m=min(f-w,w*e//100)+1 for u in range(0,m,c): for s in range(u,m,d): v=s+w q.append([s/v,v,s]) print((*max(q)[1:]))
a,b,c,d,e,f=list(map(int,input().split())) print((*max( [[s/(s+w),s+w,s] for t in range(0,f+1,a*100) for w in range(t,f+1,b*100) if w>0 for m in [min(f-w,w*e//100)+1] for u in range(0,m,c) for s in range(u,m,d) ])[1:]))
11
10
277
248
a, b, c, d, e, f = list(map(int, input().split())) q = [] for t in range(0, f + 1, a * 100): for w in range(t, f + 1, b * 100): if w > 0: m = min(f - w, w * e // 100) + 1 for u in range(0, m, c): for s in range(u, m, d): v = s + w ...
a, b, c, d, e, f = list(map(int, input().split())) print( ( *max( [ [s / (s + w), s + w, s] for t in range(0, f + 1, a * 100) for w in range(t, f + 1, b * 100) if w > 0 for m in [min(f - w, w * e // 100) + 1] ...
false
9.090909
[ "-q = []", "-for t in range(0, f + 1, a * 100):", "- for w in range(t, f + 1, b * 100):", "- if w > 0:", "- m = min(f - w, w * e // 100) + 1", "- for u in range(0, m, c):", "- for s in range(u, m, d):", "- v = s + w", "- ...
false
0.043162
0.04565
0.945514
[ "s239581071", "s487288328" ]
u530606147
p03060
python
s641716055
s108315913
583
18
41,196
2,940
Accepted
Accepted
96.91
n = int(eval(input())) v = list(map(int,input().split())) c = list(map(int,input().split())) max_z = 0 for i in range(2**n): #print("i:",i) x = 0 y = 0 for j in range(n): if i&(1<<j)!=0: #print('j:',j) x+=v[j] y+=c[j] z=x-y #print(z) max_z = max(max_z,z) print(max_z...
n = int(eval(input())) v = list(map(int,input().split())) c = list(map(int,input().split())) z=0 for i in range(n): if v[i]>c[i]: z+=v[i]-c[i] print(z)
19
9
320
161
n = int(eval(input())) v = list(map(int, input().split())) c = list(map(int, input().split())) max_z = 0 for i in range(2**n): # print("i:",i) x = 0 y = 0 for j in range(n): if i & (1 << j) != 0: # print('j:',j) x += v[j] y += c[j] z = x - y # print(z)...
n = int(eval(input())) v = list(map(int, input().split())) c = list(map(int, input().split())) z = 0 for i in range(n): if v[i] > c[i]: z += v[i] - c[i] print(z)
false
52.631579
[ "-max_z = 0", "-for i in range(2**n):", "- # print(\"i:\",i)", "- x = 0", "- y = 0", "- for j in range(n):", "- if i & (1 << j) != 0:", "- # print('j:',j)", "- x += v[j]", "- y += c[j]", "- z = x - y", "- # print(z)", "- max_z = ma...
false
0.088532
0.037451
2.363953
[ "s641716055", "s108315913" ]
u955248595
p02548
python
s202597796
s699353508
1,703
139
24,300
75,412
Accepted
Accepted
91.84
N = int(eval(input())) def num_divisors_table(n): table = [0]*(n+1) for i in range(1,n+1): for j in range(i,n+1,i): table[j] += 1 return table print((sum(num_divisors_table(N)[:-1])))
def DivisorsTable(N): DivTable = [0]*(N+1) for I in range(1,N+1): for J in range(I,N+1,I): DivTable[J] += 1 return sum(DivTable) print((DivisorsTable(int(eval(input()))-1)))
8
7
215
204
N = int(eval(input())) def num_divisors_table(n): table = [0] * (n + 1) for i in range(1, n + 1): for j in range(i, n + 1, i): table[j] += 1 return table print((sum(num_divisors_table(N)[:-1])))
def DivisorsTable(N): DivTable = [0] * (N + 1) for I in range(1, N + 1): for J in range(I, N + 1, I): DivTable[J] += 1 return sum(DivTable) print((DivisorsTable(int(eval(input())) - 1)))
false
12.5
[ "-N = int(eval(input()))", "+def DivisorsTable(N):", "+ DivTable = [0] * (N + 1)", "+ for I in range(1, N + 1):", "+ for J in range(I, N + 1, I):", "+ DivTable[J] += 1", "+ return sum(DivTable)", "-def num_divisors_table(n):", "- table = [0] * (n + 1)", "- for i in...
false
0.319298
0.312151
1.022898
[ "s202597796", "s699353508" ]
u652583512
p03107
python
s903696447
s180055346
167
18
39,024
3,188
Accepted
Accepted
89.22
S = eval(input()) print((2 * min(S.count('0'), S.count('1'))))
S = eval(input()) l = len(S) a = S.count('0') print((2 * min(a, l - a)))
2
4
55
68
S = eval(input()) print((2 * min(S.count("0"), S.count("1"))))
S = eval(input()) l = len(S) a = S.count("0") print((2 * min(a, l - a)))
false
50
[ "-print((2 * min(S.count(\"0\"), S.count(\"1\"))))", "+l = len(S)", "+a = S.count(\"0\")", "+print((2 * min(a, l - a)))" ]
false
0.03522
0.03451
1.020573
[ "s903696447", "s180055346" ]
u606045429
p02973
python
s789529587
s701316409
551
223
56,880
8,600
Accepted
Accepted
59.53
from bisect import bisect_right N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] A.reverse() L = [A[0]] for a in A[1:]: if a >= L[-1]: L.append(a) else: L[bisect_right(L, a)] = a print((len(L)))
from bisect import bisect N = int(eval(input())) A = [-int(eval(input())) for _ in range(N)] L = [A[0]] for a in A[1:]: if a >= L[-1]: L.append(a) else: L[bisect(L, a)] = a print((len(L)))
14
10
238
207
from bisect import bisect_right N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] A.reverse() L = [A[0]] for a in A[1:]: if a >= L[-1]: L.append(a) else: L[bisect_right(L, a)] = a print((len(L)))
from bisect import bisect N = int(eval(input())) A = [-int(eval(input())) for _ in range(N)] L = [A[0]] for a in A[1:]: if a >= L[-1]: L.append(a) else: L[bisect(L, a)] = a print((len(L)))
false
28.571429
[ "-from bisect import bisect_right", "+from bisect import bisect", "-A = [int(eval(input())) for _ in range(N)]", "-A.reverse()", "+A = [-int(eval(input())) for _ in range(N)]", "- L[bisect_right(L, a)] = a", "+ L[bisect(L, a)] = a" ]
false
0.043924
0.126387
0.347532
[ "s789529587", "s701316409" ]
u235084192
p03317
python
s147386818
s108393509
45
24
13,880
3,060
Accepted
Accepted
46.67
N,K = list(map(int, input().split())) A = list(map(int, input().split())) def f(): for i in range(1, N+1): if (K-1)*i + 1 >= N: return i print((f()))
N,K = list(map(int, input().split())) def f(): for i in range(1, N+1): if (K-1)*i + 1 >= N: return i print((f()))
8
7
161
124
N, K = list(map(int, input().split())) A = list(map(int, input().split())) def f(): for i in range(1, N + 1): if (K - 1) * i + 1 >= N: return i print((f()))
N, K = list(map(int, input().split())) def f(): for i in range(1, N + 1): if (K - 1) * i + 1 >= N: return i print((f()))
false
12.5
[ "-A = list(map(int, input().split()))" ]
false
0.037099
0.036554
1.014925
[ "s147386818", "s108393509" ]
u701199820
p02972
python
s189950899
s903929032
703
327
17,408
71,900
Accepted
Accepted
53.49
l = [] counter = 0 ans_list = [] n = int(eval(input())) b_list = [0 for _ in range(n)] l = list(map(int, input().split())) for i in range(n,0,-1): index = n // i if index == 1: # 倍数がないとき b_list[i-1] = l[i-1] else: sum = 0 for j in range(2, index+1): sum =...
n = int(eval(input())) a = list(map(int, input().split())) ans_list = [0 for _ in range(n)] for i in range(n-1, -1, -1): prev = 0 index = i+1 for j in range(2, n+1): if (index * j)-1 >= n: break prev += ans_list[(index * j)-1] if prev % 2 != a[i]: ans_list[i] = 1 p...
28
16
606
433
l = [] counter = 0 ans_list = [] n = int(eval(input())) b_list = [0 for _ in range(n)] l = list(map(int, input().split())) for i in range(n, 0, -1): index = n // i if index == 1: # 倍数がないとき b_list[i - 1] = l[i - 1] else: sum = 0 for j in range(2, index + 1): sum = sum + b...
n = int(eval(input())) a = list(map(int, input().split())) ans_list = [0 for _ in range(n)] for i in range(n - 1, -1, -1): prev = 0 index = i + 1 for j in range(2, n + 1): if (index * j) - 1 >= n: break prev += ans_list[(index * j) - 1] if prev % 2 != a[i]: ans_list[i...
false
42.857143
[ "-l = []", "-counter = 0", "-ans_list = []", "-b_list = [0 for _ in range(n)]", "-l = list(map(int, input().split()))", "-for i in range(n, 0, -1):", "- index = n // i", "- if index == 1: # 倍数がないとき", "- b_list[i - 1] = l[i - 1]", "- else:", "- sum = 0", "- for j ...
false
0.059816
0.037993
1.574393
[ "s189950899", "s903929032" ]
u371132735
p03723
python
s327033700
s279855843
844
17
3,064
3,064
Accepted
Accepted
97.99
# agc014_a.py] A, B, C = list(map(int,input().split())) cnt = 0 inf = 10**6 for i in range(inf): if A%2==0 and B%2==0 and C%2==0: a = (B+C)//2 b = (A+C)//2 c = (B+A)//2 A = a B = b C = c cnt += 1 else: break if cnt == inf: cnt ...
# agc014_a.py] A, B, C = list(map(int,input().split())) cnt = 0 inf = 10**2 for i in range(inf): if A%2==0 and B%2==0 and C%2==0: a = (B+C)//2 b = (A+C)//2 c = (B+A)//2 A = a B = b C = c cnt += 1 else: break if cnt == inf: cnt ...
18
18
330
330
# agc014_a.py] A, B, C = list(map(int, input().split())) cnt = 0 inf = 10**6 for i in range(inf): if A % 2 == 0 and B % 2 == 0 and C % 2 == 0: a = (B + C) // 2 b = (A + C) // 2 c = (B + A) // 2 A = a B = b C = c cnt += 1 else: break if cnt == inf: ...
# agc014_a.py] A, B, C = list(map(int, input().split())) cnt = 0 inf = 10**2 for i in range(inf): if A % 2 == 0 and B % 2 == 0 and C % 2 == 0: a = (B + C) // 2 b = (A + C) // 2 c = (B + A) // 2 A = a B = b C = c cnt += 1 else: break if cnt == inf: ...
false
0
[ "-inf = 10**6", "+inf = 10**2" ]
false
0.27811
0.037816
7.354313
[ "s327033700", "s279855843" ]
u697101155
p02695
python
s082941072
s462098230
307
183
97,808
72,752
Accepted
Accepted
40.39
import sys input = sys.stdin.readline from math import floor,ceil,sqrt,factorial,log from heapq import heapify, heappop, heappush, heappushpop from collections import Counter,defaultdict,deque from itertools import accumulate,permutations,combinations,product,combinations_with_replacement from bisect import bisec...
import sys input = sys.stdin.readline from math import floor,ceil,sqrt,factorial,log from heapq import heapify, heappop, heappush, heappushpop from collections import Counter,defaultdict,deque from itertools import accumulate,permutations,combinations,product,combinations_with_replacement from bisect import bisec...
58
45
1,546
1,400
import sys input = sys.stdin.readline from math import floor, ceil, sqrt, factorial, log from heapq import heapify, heappop, heappush, heappushpop from collections import Counter, defaultdict, deque from itertools import ( accumulate, permutations, combinations, product, combinations_with_replaceme...
import sys input = sys.stdin.readline from math import floor, ceil, sqrt, factorial, log from heapq import heapify, heappop, heappush, heappushpop from collections import Counter, defaultdict, deque from itertools import ( accumulate, permutations, combinations, product, combinations_with_replaceme...
false
22.413793
[ "-arr = []", "-", "-", "-def dfs(A: list):", "- if len(A) == n:", "- arr.append(A)", "- return", "- if len(A) == 0:", "- s = 1", "- else:", "- s = A[-1]", "- while s <= m:", "- dfs(A + [s])", "- s += 1", "- dfs([])", "+ data =...
false
0.077365
0.04269
1.812239
[ "s082941072", "s462098230" ]
u133936772
p03013
python
s531851659
s587953123
89
71
14,180
19,976
Accepted
Accepted
20.22
n,_,*l=list(map(int,open(0).read().split()));l=set(l);s=i=0;t=1 while i<n:i+=1;s,t=t,(s+t)%(10**9+7)*(not{i}&l) print(t)
M=10**9+7 n,m,*l=list(map(int,open(0).read().split())) dp=[1]+[0]*n for i in l: dp[i]=-1 dp[1]+=1 for i in range(n-1): if dp[i+2]<0: dp[i+2]=0 else: dp[i+2]=(dp[i]+dp[i+1])%M print((dp[n]))
3
9
116
193
n, _, *l = list(map(int, open(0).read().split())) l = set(l) s = i = 0 t = 1 while i < n: i += 1 s, t = t, (s + t) % (10**9 + 7) * (not {i} & l) print(t)
M = 10**9 + 7 n, m, *l = list(map(int, open(0).read().split())) dp = [1] + [0] * n for i in l: dp[i] = -1 dp[1] += 1 for i in range(n - 1): if dp[i + 2] < 0: dp[i + 2] = 0 else: dp[i + 2] = (dp[i] + dp[i + 1]) % M print((dp[n]))
false
66.666667
[ "-n, _, *l = list(map(int, open(0).read().split()))", "-l = set(l)", "-s = i = 0", "-t = 1", "-while i < n:", "- i += 1", "- s, t = t, (s + t) % (10**9 + 7) * (not {i} & l)", "-print(t)", "+M = 10**9 + 7", "+n, m, *l = list(map(int, open(0).read().split()))", "+dp = [1] + [0] * n", "+for...
false
0.040191
0.040099
1.002305
[ "s531851659", "s587953123" ]
u106971015
p02608
python
s388372761
s610098790
447
149
9,248
9,204
Accepted
Accepted
66.67
N = int(eval(input())) cnt = [0] * (N + 1) for x in range(1,100): for y in range(1,100): for z in range(1,100): check = x*x + y*y + z*z + x*y + y*z + z*x if check <= N: cnt[check] += 1 for i in range(1,N+1): print((cnt[i]))
N = int(eval(input())) cnt = [0] * (N + 1) for x in range(1,100): for y in range(1,100): for z in range(1,100): check = x*x + y*y + z*z + x*y + y*z + z*x if check <= N: cnt[check] += 1 else: break for i in range(1,N+1): p...
12
14
284
326
N = int(eval(input())) cnt = [0] * (N + 1) for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): check = x * x + y * y + z * z + x * y + y * z + z * x if check <= N: cnt[check] += 1 for i in range(1, N + 1): print((cnt[i]))
N = int(eval(input())) cnt = [0] * (N + 1) for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): check = x * x + y * y + z * z + x * y + y * z + z * x if check <= N: cnt[check] += 1 else: break for i in range(1, N + 1): ...
false
14.285714
[ "+ else:", "+ break" ]
false
2.026612
0.084962
23.853134
[ "s388372761", "s610098790" ]
u496148227
p03632
python
s863658556
s062905476
31
28
9,064
9,036
Accepted
Accepted
9.68
A, B, C, D = list(map(int, input().split())) if B <= C or D <= A: print((0)) else: print((min(B-A, D-A, B-C, D-C)))
A, B, C, D = list(map(int, input().split())) print((max(0, min(B, D)-max(A, C))))
5
2
117
74
A, B, C, D = list(map(int, input().split())) if B <= C or D <= A: print((0)) else: print((min(B - A, D - A, B - C, D - C)))
A, B, C, D = list(map(int, input().split())) print((max(0, min(B, D) - max(A, C))))
false
60
[ "-if B <= C or D <= A:", "- print((0))", "-else:", "- print((min(B - A, D - A, B - C, D - C)))", "+print((max(0, min(B, D) - max(A, C))))" ]
false
0.043152
0.043721
0.986982
[ "s863658556", "s062905476" ]
u145231176
p02623
python
s016427840
s629214267
271
207
127,856
123,296
Accepted
Accepted
23.62
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
82
73
1,960
1,689
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
false
10.97561
[ "-import math", "+from math import sqrt", "-from operator import mul", "+from operator import mul, itemgetter", "-def or_less(array, x):", "- # arrayの中のx以下のものの個数", "- # arrayの中のx以下のもののうちの最大値", "- index = bisect_right(array, x)", "- if index == 0:", "- or_less_int = -float(\"inf\...
false
0.074949
0.071225
1.052294
[ "s016427840", "s629214267" ]
u644907318
p03863
python
s861798839
s262648383
168
69
39,152
62,484
Accepted
Accepted
58.93
s = input().strip() N = len(s) if N%2==0 and s[0]==s[-1]: print("First") elif N%2==0 and s[0]!=s[-1]: print("Second") elif N%2==1 and s[0]==s[-1]: print("Second") else: print("First")
s = input().strip() N = len(s) if N%2==0: if s[0]==s[-1]: print("First") else: print("Second") else: if s[0]==s[-1]: print("Second") else: print("First")
10
12
208
212
s = input().strip() N = len(s) if N % 2 == 0 and s[0] == s[-1]: print("First") elif N % 2 == 0 and s[0] != s[-1]: print("Second") elif N % 2 == 1 and s[0] == s[-1]: print("Second") else: print("First")
s = input().strip() N = len(s) if N % 2 == 0: if s[0] == s[-1]: print("First") else: print("Second") else: if s[0] == s[-1]: print("Second") else: print("First")
false
16.666667
[ "-if N % 2 == 0 and s[0] == s[-1]:", "- print(\"First\")", "-elif N % 2 == 0 and s[0] != s[-1]:", "- print(\"Second\")", "-elif N % 2 == 1 and s[0] == s[-1]:", "- print(\"Second\")", "+if N % 2 == 0:", "+ if s[0] == s[-1]:", "+ print(\"First\")", "+ else:", "+ print(...
false
0.07323
0.039956
1.832763
[ "s861798839", "s262648383" ]
u848882989
p03075
python
s587119232
s687232943
19
17
2,940
2,940
Accepted
Accepted
10.53
import sys args = [int(eval(input())) for i in range(6)] for arg1 in args[:5]: for arg2 in args[1:5]: if (arg2 - arg1) > args[5]: print(":(") sys.exit() print("Yay!")
import sys args = [int(eval(input())) for i in range(6)] if (args[4] - args[0]) > args[5]: print(":(") sys.exit() print("Yay!")
11
8
209
138
import sys args = [int(eval(input())) for i in range(6)] for arg1 in args[:5]: for arg2 in args[1:5]: if (arg2 - arg1) > args[5]: print(":(") sys.exit() print("Yay!")
import sys args = [int(eval(input())) for i in range(6)] if (args[4] - args[0]) > args[5]: print(":(") sys.exit() print("Yay!")
false
27.272727
[ "-for arg1 in args[:5]:", "- for arg2 in args[1:5]:", "- if (arg2 - arg1) > args[5]:", "- print(\":(\")", "- sys.exit()", "+if (args[4] - args[0]) > args[5]:", "+ print(\":(\")", "+ sys.exit()" ]
false
0.044462
0.073854
0.602021
[ "s587119232", "s687232943" ]
u058240079
p03607
python
s082063037
s900145257
172
153
17,200
18,536
Accepted
Accepted
11.05
from collections import defaultdict d = defaultdict(int) n = int(input()) for _ in range(n): d[int(input())] += 1 print(len([x for x in list(d.values()) if x % 2 == 1]))
from collections import Counter n = int(input()) c = Counter([int(input()) for _ in range(n)]) print(len([x for x in list(c.values()) if x % 2 == 1]))
6
4
183
158
from collections import defaultdict d = defaultdict(int) n = int(input()) for _ in range(n): d[int(input())] += 1 print(len([x for x in list(d.values()) if x % 2 == 1]))
from collections import Counter n = int(input()) c = Counter([int(input()) for _ in range(n)]) print(len([x for x in list(c.values()) if x % 2 == 1]))
false
33.333333
[ "-from collections import defaultdict", "+from collections import Counter", "-d = defaultdict(int)", "-for _ in range(n):", "- d[int(input())] += 1", "-print(len([x for x in list(d.values()) if x % 2 == 1]))", "+c = Counter([int(input()) for _ in range(n)])", "+print(len([x for x in list(c.values()...
false
0.048979
0.049631
0.986851
[ "s082063037", "s900145257" ]
u023471147
p01880
python
s123372522
s548824158
4,060
320
5,628
5,616
Accepted
Accepted
92.12
n = int(eval(input())) a = list(map(int, input().split())) ma = -1 for i in range(n - 1): for j in range(i + 1, n): pro = a[i] * a[j] digit = [pro % (10 ** k) // (10 ** (k - 1)) for k in range(1, 10)] while digit[-1] == 0: digit = digit[:-1] if len(digit)...
n = int(eval(input())) a = list(map(int, input().split())) ma = -1 for i in range(n - 1): for j in range(i + 1, n): pro = a[i] * a[j] pre = pro % 10 pro //= 10 while pro: if pre - pro % 10 == 1: pre = pro % 10 pro /...
27
21
602
435
n = int(eval(input())) a = list(map(int, input().split())) ma = -1 for i in range(n - 1): for j in range(i + 1, n): pro = a[i] * a[j] digit = [pro % (10**k) // (10 ** (k - 1)) for k in range(1, 10)] while digit[-1] == 0: digit = digit[:-1] if len(digit) == 1: ...
n = int(eval(input())) a = list(map(int, input().split())) ma = -1 for i in range(n - 1): for j in range(i + 1, n): pro = a[i] * a[j] pre = pro % 10 pro //= 10 while pro: if pre - pro % 10 == 1: pre = pro % 10 pro //= 10 else: ...
false
22.222222
[ "- digit = [pro % (10**k) // (10 ** (k - 1)) for k in range(1, 10)]", "- while digit[-1] == 0:", "- digit = digit[:-1]", "- if len(digit) == 1:", "- ma = max(ma, pro)", "- continue", "- flag = True", "- for k in range(len(digit) - 1):...
false
0.036434
0.053422
0.68201
[ "s123372522", "s548824158" ]
u169350228
p02722
python
s371391584
s507802566
758
110
3,188
69,084
Accepted
Accepted
85.49
n = int(eval(input())) def yakusu(x): xx = 2 y = [] while xx**2 < x: if x%xx == 0: y.append(xx) y.append(x//xx) xx += 1 if xx**2 == x: y.append(xx) y.append(x) return y if n == 2: ans = 0 else: ans = len(yakusu(n-1))...
import math #import numpy as np import queue from collections import deque,defaultdict import heapq as hpq from sys import stdin,setrecursionlimit #from scipy.sparse.csgraph import dijkstra #from scipy.sparse import csr_matrix ipt = stdin.readline setrecursionlimit(10**7) def main(): n = int(ipt()) ...
31
50
499
1,035
n = int(eval(input())) def yakusu(x): xx = 2 y = [] while xx**2 < x: if x % xx == 0: y.append(xx) y.append(x // xx) xx += 1 if xx**2 == x: y.append(xx) y.append(x) return y if n == 2: ans = 0 else: ans = len(yakusu(n - 1)) for i in yaku...
import math # import numpy as np import queue from collections import deque, defaultdict import heapq as hpq from sys import stdin, setrecursionlimit # from scipy.sparse.csgraph import dijkstra # from scipy.sparse import csr_matrix ipt = stdin.readline setrecursionlimit(10**7) def main(): n = int(ipt()) if ...
false
38
[ "-n = int(eval(input()))", "+import math", "+", "+# import numpy as np", "+import queue", "+from collections import deque, defaultdict", "+import heapq as hpq", "+from sys import stdin, setrecursionlimit", "+", "+# from scipy.sparse.csgraph import dijkstra", "+# from scipy.sparse import csr_matr...
false
0.40814
0.168351
2.424345
[ "s371391584", "s507802566" ]
u742897895
p03806
python
s930037055
s781059184
1,864
415
136,920
115,548
Accepted
Accepted
77.74
import fractions n, ma, mb = list(map(int,input().split())) a = [0] * (n + 1) b = [0] * (n + 1) c = [0] * (n + 1) for i in range(1, n + 1): a[i], b[i], c[i] = list(map(int,input().split())) #iまでの薬品で、aがj(g),bがk(g)となるときの最小コスト dp = [[[10 ** 15 for i in range(n + 1)] for j in range(401)] \ for k in ran...
n, ma, mb = list(map(int,input().split())) a = [0] * (n + 1) b = [0] * (n + 1) c = [0] * (n + 1) for i in range(1, n + 1): a[i], b[i], c[i] = list(map(int,input().split())) #iまでの薬品で、aがj(g),bがk(g)となるときの最小コスト dp = [[[10 ** 15 for i in range(n + 1)] for j in range(401)] \ for k in range(401)] dp[0][0]...
83
40
1,864
955
import fractions n, ma, mb = list(map(int, input().split())) a = [0] * (n + 1) b = [0] * (n + 1) c = [0] * (n + 1) for i in range(1, n + 1): a[i], b[i], c[i] = list(map(int, input().split())) # iまでの薬品で、aがj(g),bがk(g)となるときの最小コスト dp = [[[10**15 for i in range(n + 1)] for j in range(401)] for k in range(401)] dp[0][0]...
n, ma, mb = list(map(int, input().split())) a = [0] * (n + 1) b = [0] * (n + 1) c = [0] * (n + 1) for i in range(1, n + 1): a[i], b[i], c[i] = list(map(int, input().split())) # iまでの薬品で、aがj(g),bがk(g)となるときの最小コスト dp = [[[10**15 for i in range(n + 1)] for j in range(401)] for k in range(401)] dp[0][0][0] = 0 sa = [0] *...
false
51.807229
[ "-import fractions", "-", "- for j in range(401):", "- for k in range(401):", "+ sa[i] = sa[i - 1] + a[i]", "+ sb[i] = sb[i - 1] + b[i]", "+for i in range(1, n + 1):", "+ for j in range(sa[i] + 1):", "+ for k in range(sb[i] + 1):", "-\"\"\"", "-import fractions", "-n,...
false
0.906498
0.259155
3.497899
[ "s930037055", "s781059184" ]
u539989431
p02713
python
s802174448
s160545617
1,192
652
9,228
9,208
Accepted
Accepted
45.3
N = int(eval(input())) + 1 Answer = 0 def getGCD(a,b,c): if a == b and b == c: d = 1 elif a == b or b == c or c == a: d = 3 else: d = 6 surplus = a % c while surplus != 0: a = int(c) c = int(surplus) surplus = a % c surp...
N = int(eval(input())) + 1 Answer = 0 def getGCD(a,b,c): if a == b == c: d = 1 elif a == b or b == c: d = 3 else: d = 6 surplus = a % c while surplus != 0: a,c = c,surplus surplus = a % c surplus = b % c while surplus != 0: ...
31
29
588
530
N = int(eval(input())) + 1 Answer = 0 def getGCD(a, b, c): if a == b and b == c: d = 1 elif a == b or b == c or c == a: d = 3 else: d = 6 surplus = a % c while surplus != 0: a = int(c) c = int(surplus) surplus = a % c surplus = b % c while su...
N = int(eval(input())) + 1 Answer = 0 def getGCD(a, b, c): if a == b == c: d = 1 elif a == b or b == c: d = 3 else: d = 6 surplus = a % c while surplus != 0: a, c = c, surplus surplus = a % c surplus = b % c while surplus != 0: b, c = c, surp...
false
6.451613
[ "- if a == b and b == c:", "+ if a == b == c:", "- elif a == b or b == c or c == a:", "+ elif a == b or b == c:", "- a = int(c)", "- c = int(surplus)", "+ a, c = c, surplus", "- b = int(c)", "- c = int(surplus)", "+ b, c = c, surplus" ]
false
0.180248
0.007733
23.30843
[ "s802174448", "s160545617" ]
u191874006
p02594
python
s652053822
s513137383
136
63
65,416
61,884
Accepted
Accepted
53.68
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from...
#!/usr/bin/env python3 x = int(eval(input())) if x >= 30: print('Yes') else: print('No')
24
6
622
95
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop, heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collectio...
#!/usr/bin/env python3 x = int(eval(input())) if x >= 30: print("Yes") else: print("No")
false
75
[ "-import sys", "-import math", "-from bisect import bisect_right as br", "-from bisect import bisect_left as bl", "-", "-sys.setrecursionlimit(2147483647)", "-from heapq import heappush, heappop, heappushpop", "-from collections import defaultdict", "-from itertools import accumulate", "-from coll...
false
0.045937
0.059162
0.776461
[ "s652053822", "s513137383" ]
u372144784
p03061
python
s069510947
s412440689
791
354
100,076
87,812
Accepted
Accepted
55.25
#ABC125-C GCD on Blackboard """ 問題 リストの要素のうち一つだけ変更して、リスト全体のgcdを最大化せよ。 解法 セグ木を用いて、ある1要素を無視してその右側と左側のgcdを取る。 その時の最大値が答え。 """ import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n%2==0 else 0 #input n = int(readline()) lst1 = list(map(int,readline().split())) def gcd(a,b): if b ...
import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n%2==0 else 0 n = int(readline()) lst1 = list(map(int,readline().split())) def gcd(a,b): if b == 0: return a else: return gcd(b,a%b) def lcm(a,b): return (a*b//gcd(a,b)) #####segfunc###### def segfunc(x,y...
87
75
1,825
1,678
# ABC125-C GCD on Blackboard """ 問題 リストの要素のうち一つだけ変更して、リスト全体のgcdを最大化せよ。 解法 セグ木を用いて、ある1要素を無視してその右側と左側のgcdを取る。 その時の最大値が答え。 """ import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n % 2 == 0 else 0 # input n = int(readline()) lst1 = list(map(int, readline().split())) def gcd(a, b): if b ...
import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n % 2 == 0 else 0 n = int(readline()) lst1 = list(map(int, readline().split())) def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) def lcm(a, b): return a * b // gcd(a, b) #####segfunc###### de...
false
13.793103
[ "-# ABC125-C GCD on Blackboard", "-\"\"\"", "-問題", "-リストの要素のうち一つだけ変更して、リスト全体のgcdを最大化せよ。", "-解法", "-セグ木を用いて、ある1要素を無視してその右側と左側のgcdを取る。", "-その時の最大値が答え。", "-\"\"\"", "-# input", "- return a // gcd(a, b) * b", "+ return a * b // gcd(a, b)", "-seg = [ide_ele] * 2 * num # 単位元の配列(計算結果に影響を及ぼさない配...
false
0.046259
0.088695
0.521556
[ "s069510947", "s412440689" ]
u112247039
p03208
python
s314135950
s477117527
191
173
14,052
14,000
Accepted
Accepted
9.42
n,k = list(map(int,input().split())) h = sorted([int(eval(input())) for _ in range(n)]) ans = h[k-1]-h[0] for i in range(n-k+1): m = h[i+k-1]-h[i] ans = min(m,ans) print(ans)
n,k = list(map(int,input().split())) h = sorted([int(eval(input())) for _ in range(n)]) print((min(h[j+k-1]-h[j] for j in range(n-k+1))))
7
3
176
125
n, k = list(map(int, input().split())) h = sorted([int(eval(input())) for _ in range(n)]) ans = h[k - 1] - h[0] for i in range(n - k + 1): m = h[i + k - 1] - h[i] ans = min(m, ans) print(ans)
n, k = list(map(int, input().split())) h = sorted([int(eval(input())) for _ in range(n)]) print((min(h[j + k - 1] - h[j] for j in range(n - k + 1))))
false
57.142857
[ "-ans = h[k - 1] - h[0]", "-for i in range(n - k + 1):", "- m = h[i + k - 1] - h[i]", "- ans = min(m, ans)", "-print(ans)", "+print((min(h[j + k - 1] - h[j] for j in range(n - k + 1))))" ]
false
0.037708
0.038991
0.967087
[ "s314135950", "s477117527" ]
u905203728
p03266
python
s944252280
s903980060
177
65
38,896
3,060
Accepted
Accepted
63.28
n,k=list(map(int,input().split())) count,point=0,0 if k%2!=0: while k*(count+1)<=n: count +=1 print((count**3)) else: for i in range(1,n+1): if i%k==0:point +=1 elif i*2%k==0:count +=1 print((count**3+point**3))
n,k=list(map(int,input().split())) A,B=0,0 for i in range(1,n+1): if i%k==0:A +=1 elif 2*i%k==0:B +=1 print((A**3+B**3))
11
6
251
125
n, k = list(map(int, input().split())) count, point = 0, 0 if k % 2 != 0: while k * (count + 1) <= n: count += 1 print((count**3)) else: for i in range(1, n + 1): if i % k == 0: point += 1 elif i * 2 % k == 0: count += 1 print((count**3 + point**3))
n, k = list(map(int, input().split())) A, B = 0, 0 for i in range(1, n + 1): if i % k == 0: A += 1 elif 2 * i % k == 0: B += 1 print((A**3 + B**3))
false
45.454545
[ "-count, point = 0, 0", "-if k % 2 != 0:", "- while k * (count + 1) <= n:", "- count += 1", "- print((count**3))", "-else:", "- for i in range(1, n + 1):", "- if i % k == 0:", "- point += 1", "- elif i * 2 % k == 0:", "- count += 1", "- pr...
false
0.043042
0.041805
1.029591
[ "s944252280", "s903980060" ]
u729133443
p02683
python
s723334408
s411765205
99
37
68,824
9,220
Accepted
Accepted
62.63
(n,m,x),*t=[[*list(map(int,t.split()))]for t in open(0)] m=9**9 for i in range(1,2**n): c,*a=list(map(sum,list(zip(*[t[j]for j in range(n)if 1<<j&i])))) if min(a)>=x:m=min(m,c+1) print((m%9**9-1))
(n,m,x),*t=[[*list(map(int,t.split()))]for t in open(0)] m=M=9**9 for i in range(1,2**n):c,*a=list(map(sum,list(zip(*[t[j]for j in range(n)if i>>j&1]))));m=min(m,M*(min(a)<x)or-~c) print((m%M-1))
6
4
189
178
(n, m, x), *t = [[*list(map(int, t.split()))] for t in open(0)] m = 9**9 for i in range(1, 2**n): c, *a = list(map(sum, list(zip(*[t[j] for j in range(n) if 1 << j & i])))) if min(a) >= x: m = min(m, c + 1) print((m % 9**9 - 1))
(n, m, x), *t = [[*list(map(int, t.split()))] for t in open(0)] m = M = 9**9 for i in range(1, 2**n): c, *a = list(map(sum, list(zip(*[t[j] for j in range(n) if i >> j & 1])))) m = min(m, M * (min(a) < x) or -~c) print((m % M - 1))
false
33.333333
[ "-m = 9**9", "+m = M = 9**9", "- c, *a = list(map(sum, list(zip(*[t[j] for j in range(n) if 1 << j & i]))))", "- if min(a) >= x:", "- m = min(m, c + 1)", "-print((m % 9**9 - 1))", "+ c, *a = list(map(sum, list(zip(*[t[j] for j in range(n) if i >> j & 1]))))", "+ m = min(m, M * (min(...
false
0.03584
0.0788
0.454827
[ "s723334408", "s411765205" ]
u910756197
p03835
python
s188076199
s423581013
1,699
1,222
3,060
2,940
Accepted
Accepted
28.08
k, s = list(map(int, input().split())) ans = 0 for x in range(k + 1): for y in range(k + 1): z = s - x - y if z >= 0 and z <= k: ans += 1 print(ans)
K, S = list(map(int, input().split())) ans = 0 for X in range(K + 1): for Y in range(K + 1): if 0 <= S - X - Y <= K: ans += 1 print(ans)
8
7
181
160
k, s = list(map(int, input().split())) ans = 0 for x in range(k + 1): for y in range(k + 1): z = s - x - y if z >= 0 and z <= k: ans += 1 print(ans)
K, S = list(map(int, input().split())) ans = 0 for X in range(K + 1): for Y in range(K + 1): if 0 <= S - X - Y <= K: ans += 1 print(ans)
false
12.5
[ "-k, s = list(map(int, input().split()))", "+K, S = list(map(int, input().split()))", "-for x in range(k + 1):", "- for y in range(k + 1):", "- z = s - x - y", "- if z >= 0 and z <= k:", "+for X in range(K + 1):", "+ for Y in range(K + 1):", "+ if 0 <= S - X - Y <= K:" ]
false
0.071546
0.070142
1.020015
[ "s188076199", "s423581013" ]
u860657719
p02659
python
s205522228
s903101309
23
19
9,180
9,172
Accepted
Accepted
17.39
a, b = input().split() a = int(a) b = int(b[0] + b[2] + b[3]) ans = a*b if ans < 100: print((0)) else: print((str(ans)[:-2]))
a, b = input().split() a = int(a) b = int(b.replace(".", "")) print((a*b//100))
8
4
136
80
a, b = input().split() a = int(a) b = int(b[0] + b[2] + b[3]) ans = a * b if ans < 100: print((0)) else: print((str(ans)[:-2]))
a, b = input().split() a = int(a) b = int(b.replace(".", "")) print((a * b // 100))
false
50
[ "-b = int(b[0] + b[2] + b[3])", "-ans = a * b", "-if ans < 100:", "- print((0))", "-else:", "- print((str(ans)[:-2]))", "+b = int(b.replace(\".\", \"\"))", "+print((a * b // 100))" ]
false
0.037366
0.070945
0.52669
[ "s205522228", "s903101309" ]
u562935282
p03077
python
s010157024
s448512388
19
17
3,060
2,940
Accepted
Accepted
10.53
from math import ceil N = int(eval(input())) v = [int(eval(input())) for _ in range(5)] print((ceil(N / min(v)) + 4))
from math import ceil n = int(eval(input())) a = [int(eval(input())) for _ in range(5)] print((ceil(n / min(a)) + 4))
6
6
110
111
from math import ceil N = int(eval(input())) v = [int(eval(input())) for _ in range(5)] print((ceil(N / min(v)) + 4))
from math import ceil n = int(eval(input())) a = [int(eval(input())) for _ in range(5)] print((ceil(n / min(a)) + 4))
false
0
[ "-N = int(eval(input()))", "-v = [int(eval(input())) for _ in range(5)]", "-print((ceil(N / min(v)) + 4))", "+n = int(eval(input()))", "+a = [int(eval(input())) for _ in range(5)]", "+print((ceil(n / min(a)) + 4))" ]
false
0.143947
0.063763
2.25753
[ "s010157024", "s448512388" ]
u476383383
p02947
python
s009787745
s151787185
546
218
25,796
18,236
Accepted
Accepted
60.07
n = int(eval(input())) words = [sorted(eval(input())) for _ in range(n)] sorted_words = sorted(words) result = 0 sorted_words_dup = sorted_words[:] while sorted_words_dup: same_cnt = 1 word = sorted_words_dup.pop() while 0 < len(sorted_words_dup) and sorted_words_dup[-1] == word: sorted_w...
import sys from collections import defaultdict from heapq import * sys.setrecursionlimit(10**8) input = sys.stdin.readline def main(): """ main """ N = int(eval(input())) dp = {} ans = 0 for _ in range(N): str = ''.join(sorted(input().rstrip())) if str in dp: ...
15
23
403
458
n = int(eval(input())) words = [sorted(eval(input())) for _ in range(n)] sorted_words = sorted(words) result = 0 sorted_words_dup = sorted_words[:] while sorted_words_dup: same_cnt = 1 word = sorted_words_dup.pop() while 0 < len(sorted_words_dup) and sorted_words_dup[-1] == word: sorted_words_dup.po...
import sys from collections import defaultdict from heapq import * sys.setrecursionlimit(10**8) input = sys.stdin.readline def main(): """main""" N = int(eval(input())) dp = {} ans = 0 for _ in range(N): str = "".join(sorted(input().rstrip())) if str in dp: ans += dp[s...
false
34.782609
[ "-n = int(eval(input()))", "-words = [sorted(eval(input())) for _ in range(n)]", "-sorted_words = sorted(words)", "-result = 0", "-sorted_words_dup = sorted_words[:]", "-while sorted_words_dup:", "- same_cnt = 1", "- word = sorted_words_dup.pop()", "- while 0 < len(sorted_words_dup) and sor...
false
0.037901
0.036681
1.033256
[ "s009787745", "s151787185" ]
u777923818
p03241
python
s276770575
s978540490
455
21
54,876
3,060
Accepted
Accepted
95.38
# -*- coding: utf-8 -*- from collections import defaultdict from bisect import bisect def inpl(): return list(map(int, input().split())) def primes(N): sieve = [True]*(N+1) sieve[:2] = [False, False] for i in range(4, N+1, 2): sieve[i] = False for i in range(3, N+1, 2): if ...
# -*- coding: utf-8 -*- from math import sqrt, ceil def inpl(): return list(map(int, input().split())) N, M = inpl() ans = 1 for i in range(1, ceil(sqrt(M))+1): if M%i != 0: continue d = M // i if M >= N*i: ans = max(i, ans) if M >= N*d: ans = max(d, ans) print(a...
49
16
964
323
# -*- coding: utf-8 -*- from collections import defaultdict from bisect import bisect def inpl(): return list(map(int, input().split())) def primes(N): sieve = [True] * (N + 1) sieve[:2] = [False, False] for i in range(4, N + 1, 2): sieve[i] = False for i in range(3, N + 1, 2): i...
# -*- coding: utf-8 -*- from math import sqrt, ceil def inpl(): return list(map(int, input().split())) N, M = inpl() ans = 1 for i in range(1, ceil(sqrt(M)) + 1): if M % i != 0: continue d = M // i if M >= N * i: ans = max(i, ans) if M >= N * d: ans = max(d, ans) print(an...
false
67.346939
[ "-from collections import defaultdict", "-from bisect import bisect", "+from math import sqrt, ceil", "-def primes(N):", "- sieve = [True] * (N + 1)", "- sieve[:2] = [False, False]", "- for i in range(4, N + 1, 2):", "- sieve[i] = False", "- for i in range(3, N + 1, 2):", "- ...
false
2.773747
0.039248
70.672238
[ "s276770575", "s978540490" ]
u581187895
p02775
python
s522491749
s182051940
1,325
1,201
162,388
162,312
Accepted
Accepted
9.36
def resolve(): S = eval(input()) n = len(S) dp = [[0] * 2 for _ in range(n + 1)] dp[0][1] = 1 for i in range(1, n + 1): d = int(S[i - 1]) dp[i][0] = min(dp[i - 1][0] + d, dp[i - 1][1] + (10 - d)) dp[i][1] = min(dp[i - 1][0] + (d + 1), dp[i - 1][1] + (10 - 1 - d)) ...
def resolve(): S = "0" + eval(input()) N = len(S) dp = [[1<<60]*2 for _ in range(N+1)] dp[0][0] = 0 for i in range(N): now = int(S[i]) dp[i+1][0] = min(dp[i][0]+now, dp[i][1]+(10- now)) dp[i + 1][1] = min(dp[i][0] + now + 1, dp[i][1] + (10 - now - 1)) print((...
15
16
380
370
def resolve(): S = eval(input()) n = len(S) dp = [[0] * 2 for _ in range(n + 1)] dp[0][1] = 1 for i in range(1, n + 1): d = int(S[i - 1]) dp[i][0] = min(dp[i - 1][0] + d, dp[i - 1][1] + (10 - d)) dp[i][1] = min(dp[i - 1][0] + (d + 1), dp[i - 1][1] + (10 - 1 - d)) print((d...
def resolve(): S = "0" + eval(input()) N = len(S) dp = [[1 << 60] * 2 for _ in range(N + 1)] dp[0][0] = 0 for i in range(N): now = int(S[i]) dp[i + 1][0] = min(dp[i][0] + now, dp[i][1] + (10 - now)) dp[i + 1][1] = min(dp[i][0] + now + 1, dp[i][1] + (10 - now - 1)) print((...
false
6.25
[ "- S = eval(input())", "- n = len(S)", "- dp = [[0] * 2 for _ in range(n + 1)]", "- dp[0][1] = 1", "- for i in range(1, n + 1):", "- d = int(S[i - 1])", "- dp[i][0] = min(dp[i - 1][0] + d, dp[i - 1][1] + (10 - d))", "- dp[i][1] = min(dp[i - 1][0] + (d + 1), dp[i - 1...
false
0.043386
0.112236
0.386558
[ "s522491749", "s182051940" ]
u102461423
p03465
python
s112836133
s166626074
778
666
22,736
92,748
Accepted
Accepted
14.4
import sys input = sys.stdin.readline # 集合Sと補集合を対応 → 空、全体を除くと完全に対応 # 和がsum(A)/2)以上での最小値 import numpy as np N = int(eval(input())) A = [int(x) for x in input().split()] S = sum(A) dp = np.zeros(S+1,dtype=np.bool) dp[S] = 1 for a in A: dp[:-a] |= dp[a:] answer = np.nonzero(dp[(S+1)//2:])[0][0]...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, *A = list(map(int, read().split())) dp = 1 for x in A: dp |= dp << x S = bin(dp)[2:][::-1] can_make = [i for i, x in enumerate(S) if x == '1'] n = len(can_make) x = can_make[n ...
21
18
343
329
import sys input = sys.stdin.readline # 集合Sと補集合を対応 → 空、全体を除くと完全に対応 # 和がsum(A)/2)以上での最小値 import numpy as np N = int(eval(input())) A = [int(x) for x in input().split()] S = sum(A) dp = np.zeros(S + 1, dtype=np.bool) dp[S] = 1 for a in A: dp[:-a] |= dp[a:] answer = np.nonzero(dp[(S + 1) // 2 :])[0][0] + (S + 1) // ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, *A = list(map(int, read().split())) dp = 1 for x in A: dp |= dp << x S = bin(dp)[2:][::-1] can_make = [i for i, x in enumerate(S) if x == "1"] n = len(can_make) x = can_make[n // 2] print(x)
false
14.285714
[ "-input = sys.stdin.readline", "-# 集合Sと補集合を対応 → 空、全体を除くと完全に対応", "-# 和がsum(A)/2)以上での最小値", "-import numpy as np", "-", "-N = int(eval(input()))", "-A = [int(x) for x in input().split()]", "-S = sum(A)", "-dp = np.zeros(S + 1, dtype=np.bool)", "-dp[S] = 1", "-for a in A:", "- dp[:-a] |= dp[a:]...
false
0.320809
0.035611
9.008792
[ "s112836133", "s166626074" ]
u754022296
p02956
python
s764155619
s437704805
1,222
1,026
177,368
177,424
Accepted
Accepted
16.04
import sys input = sys.stdin.readline mod = 998244353 n = int(eval(input())) XY = sorted(tuple(map(int, input().split())) for _ in range(n)) X, Y = list(zip(*XY)) L = {y:i+1 for i, y in enumerate(sorted(Y))} Y = tuple(L[y] for y in Y) BIT = [0]*(n+1) def add(i): while i<=n: BIT[i] += 1 i += i&-i ...
import sys input = sys.stdin.readline mod = 998244353 n = int(eval(input())) XY = sorted(tuple(map(int, input().split())) for _ in range(n)) X, Y = list(zip(*XY)) L = {y:i+1 for i, y in enumerate(sorted(Y))} Y = tuple(L[y] for y in Y) BIT = [0]*(n+1) def add(i): while i<=n: BIT[i] += 1 i += i&-i ...
43
46
885
891
import sys input = sys.stdin.readline mod = 998244353 n = int(eval(input())) XY = sorted(tuple(map(int, input().split())) for _ in range(n)) X, Y = list(zip(*XY)) L = {y: i + 1 for i, y in enumerate(sorted(Y))} Y = tuple(L[y] for y in Y) BIT = [0] * (n + 1) def add(i): while i <= n: BIT[i] += 1 i...
import sys input = sys.stdin.readline mod = 998244353 n = int(eval(input())) XY = sorted(tuple(map(int, input().split())) for _ in range(n)) X, Y = list(zip(*XY)) L = {y: i + 1 for i, y in enumerate(sorted(Y))} Y = tuple(L[y] for y in Y) BIT = [0] * (n + 1) def add(i): while i <= n: BIT[i] += 1 i...
false
6.521739
[ "-ans = pow(2, n - 1, mod) * n % mod", "+T = [1] * n", "+for i in range(n - 1):", "+ T[i + 1] = T[i] * 2 % mod", "+ans = T[n - 1] * n % mod", "- a = pow(2, a, mod)", "- b = pow(2, b, mod)", "- c = pow(2, c, mod)", "- d = pow(2, d, mod)", "+ a = T[a]", "+ b = T[b]", "+ c...
false
0.038872
0.036709
1.058933
[ "s764155619", "s437704805" ]
u133936772
p02887
python
s951016876
s457461958
409
42
4,084
3,316
Accepted
Accepted
89.73
n = int(eval(input())) s = [c for c in eval(input())] for i in range(n-1,0,-1): if s[i] == s[i-1]: s.pop(i) print((len(s)))
n=int(eval(input())) s=eval(input()) a,t=1,s[0] for i in range(1,n): if s[i]!=s[i-1]: a+=1 print(a)
8
6
124
94
n = int(eval(input())) s = [c for c in eval(input())] for i in range(n - 1, 0, -1): if s[i] == s[i - 1]: s.pop(i) print((len(s)))
n = int(eval(input())) s = eval(input()) a, t = 1, s[0] for i in range(1, n): if s[i] != s[i - 1]: a += 1 print(a)
false
25
[ "-s = [c for c in eval(input())]", "-for i in range(n - 1, 0, -1):", "- if s[i] == s[i - 1]:", "- s.pop(i)", "-print((len(s)))", "+s = eval(input())", "+a, t = 1, s[0]", "+for i in range(1, n):", "+ if s[i] != s[i - 1]:", "+ a += 1", "+print(a)" ]
false
0.04127
0.04288
0.962447
[ "s951016876", "s457461958" ]
u759412327
p03137
python
s271147113
s773895276
98
86
13,964
20,488
Accepted
Accepted
12.24
N,M = list(map(int,input().split())) X = sorted(map(int,input().split())) D = sorted(j-i for i,j in zip(X,X[1:]))[::-1] print((sum(D[N-1:])))
N,M = list(map(int,input().split())) X = sorted(list(map(int,input().split()))) D = sorted([X[n+1]-X[n] for n in range(M-1)]) if M<=N: print((0)) else: print((sum(D[:M-N])))
4
8
136
175
N, M = list(map(int, input().split())) X = sorted(map(int, input().split())) D = sorted(j - i for i, j in zip(X, X[1:]))[::-1] print((sum(D[N - 1 :])))
N, M = list(map(int, input().split())) X = sorted(list(map(int, input().split()))) D = sorted([X[n + 1] - X[n] for n in range(M - 1)]) if M <= N: print((0)) else: print((sum(D[: M - N])))
false
50
[ "-X = sorted(map(int, input().split()))", "-D = sorted(j - i for i, j in zip(X, X[1:]))[::-1]", "-print((sum(D[N - 1 :])))", "+X = sorted(list(map(int, input().split())))", "+D = sorted([X[n + 1] - X[n] for n in range(M - 1)])", "+if M <= N:", "+ print((0))", "+else:", "+ print((sum(D[: M - N]...
false
0.043308
0.036128
1.198731
[ "s271147113", "s773895276" ]
u644907318
p03231
python
s077656831
s442329404
189
67
39,792
64,848
Accepted
Accepted
64.55
def gcd(x,y): while y>0: x,y = y,x%y return x N,M = list(map(int,input().split())) S = input().strip() T = input().strip() a = gcd(N,M) L = (N//a)*(M//a)*a ks = L//N kt = L//M flag = 0 if S[0]!=T[0]: flag = 1 else: b = gcd(ks,kt) kl = (ks//b)*(kt//b)*b for i in range(min...
def gcd(x,y): while y>0: x,y = y,x%y return x N,M = list(map(int,input().split())) S = input().strip() T = input().strip() a = gcd(N,M) K = (N//a)*M t = (N//a)*(M//a) flag = 0 k = 0 while (k*t)//(K//N)<N and (k*t)//(K//M)<M: if S[(k*t)//(K//N)]!=T[(k*t)//(K//M)]: flag = 1 ...
25
21
487
384
def gcd(x, y): while y > 0: x, y = y, x % y return x N, M = list(map(int, input().split())) S = input().strip() T = input().strip() a = gcd(N, M) L = (N // a) * (M // a) * a ks = L // N kt = L // M flag = 0 if S[0] != T[0]: flag = 1 else: b = gcd(ks, kt) kl = (ks // b) * (kt // b) * b ...
def gcd(x, y): while y > 0: x, y = y, x % y return x N, M = list(map(int, input().split())) S = input().strip() T = input().strip() a = gcd(N, M) K = (N // a) * M t = (N // a) * (M // a) flag = 0 k = 0 while (k * t) // (K // N) < N and (k * t) // (K // M) < M: if S[(k * t) // (K // N)] != T[(k * t...
false
16
[ "-L = (N // a) * (M // a) * a", "-ks = L // N", "-kt = L // M", "+K = (N // a) * M", "+t = (N // a) * (M // a)", "-if S[0] != T[0]:", "- flag = 1", "+k = 0", "+while (k * t) // (K // N) < N and (k * t) // (K // M) < M:", "+ if S[(k * t) // (K // N)] != T[(k * t) // (K // M)]:", "+ f...
false
0.037974
0.037914
1.001579
[ "s077656831", "s442329404" ]
u941753895
p04045
python
s653218410
s770910996
181
116
3,060
6,432
Accepted
Accepted
35.91
# 0〜9 l=list(range(10)) # 入力 N,K=list(map(int,input().split())) l2=list(map(int,input().split())) # 使用可能な数字を求める for x in l2: l.remove(x) # 集合型に変換 l=set(l) # 1<=N<=10000 なので、答えは最大でも100000まで for x in range(1,100001): # 集合型に変換 y=set(map(int,list(str(x)))) # Nを上回る数字かつ、使える数字のみを使用している場合 if ...
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 def LI(): return list(map(int,input().split())) def I(): return int(eval(input())) def LS(): return input().split() def S(): return eval(input()) def main(): n,k=...
23
29
364
528
# 0〜9 l = list(range(10)) # 入力 N, K = list(map(int, input().split())) l2 = list(map(int, input().split())) # 使用可能な数字を求める for x in l2: l.remove(x) # 集合型に変換 l = set(l) # 1<=N<=10000 なので、答えは最大でも100000まで for x in range(1, 100001): # 集合型に変換 y = set(map(int, list(str(x)))) # Nを上回る数字かつ、使える数字のみを使用している場合 if ...
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 def LI(): return list(map(int, input().split())) def I(): return int(eval(input())) def LS(): return input().split() def S(): return eval...
false
20.689655
[ "-# 0〜9", "-l = list(range(10))", "-# 入力", "-N, K = list(map(int, input().split()))", "-l2 = list(map(int, input().split()))", "-# 使用可能な数字を求める", "-for x in l2:", "- l.remove(x)", "-# 集合型に変換", "-l = set(l)", "-# 1<=N<=10000 なので、答えは最大でも100000まで", "-for x in range(1, 100001):", "- # 集合型に変...
false
0.088788
0.045598
1.947204
[ "s653218410", "s770910996" ]
u488127128
p03680
python
s702864992
s428532854
84
65
7,084
7,068
Accepted
Accepted
22.62
import sys input = sys.stdin.readline n = int(eval(input())) buttons = [int(eval(input())) for n in range(n)] count,light = 1,buttons[0] while light != 2 and count<n: count,light = count+1,buttons[light-1] print((count if count<n else -1))
import sys input = sys.stdin.readline buttons = list(map(int,sys.stdin)) n = buttons[0] count,light = 1,buttons[1] while light!=2 and count<n: count,light = count+1,buttons[light] print((count if count<n else -1))
9
9
238
224
import sys input = sys.stdin.readline n = int(eval(input())) buttons = [int(eval(input())) for n in range(n)] count, light = 1, buttons[0] while light != 2 and count < n: count, light = count + 1, buttons[light - 1] print((count if count < n else -1))
import sys input = sys.stdin.readline buttons = list(map(int, sys.stdin)) n = buttons[0] count, light = 1, buttons[1] while light != 2 and count < n: count, light = count + 1, buttons[light] print((count if count < n else -1))
false
0
[ "-n = int(eval(input()))", "-buttons = [int(eval(input())) for n in range(n)]", "-count, light = 1, buttons[0]", "+buttons = list(map(int, sys.stdin))", "+n = buttons[0]", "+count, light = 1, buttons[1]", "- count, light = count + 1, buttons[light - 1]", "+ count, light = count + 1, buttons[ligh...
false
0.070995
0.074029
0.959028
[ "s702864992", "s428532854" ]
u753803401
p02829
python
s345718604
s926099212
199
172
38,384
38,384
Accepted
Accepted
13.57
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 a = int(readline()) b = int(readline()) for i in range(1, 4): if a != i and b != i: print(i) exit() if __name__ == '__main__': solve()
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 a = int(readline()) b = int(readline()) print((1 ^ 2 ^ 3 ^ a ^ b)) if __name__ == '__main__': solve()
16
13
289
219
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 a = int(readline()) b = int(readline()) for i in range(1, 4): if a != i and b != i: print(i) exit() if __name__ == "__main__": solve()
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 a = int(readline()) b = int(readline()) print((1 ^ 2 ^ 3 ^ a ^ b)) if __name__ == "__main__": solve()
false
18.75
[ "- for i in range(1, 4):", "- if a != i and b != i:", "- print(i)", "- exit()", "+ print((1 ^ 2 ^ 3 ^ a ^ b))" ]
false
0.045239
0.082987
0.54514
[ "s345718604", "s926099212" ]
u504562455
p02899
python
s982464164
s135705166
282
242
22,824
23,616
Accepted
Accepted
14.18
N = int(eval(input())) A = [int(i) for i in input().split()] for i, a in enumerate(A): A[i] = [a, i+1] A.sort() B = [] for a in A: B.append(a[1]) print((*B))
N = int(eval(input())) A = [int(_) for _ in input().split()] A_id = [[a, i+1] for i, a in enumerate(A)] A_id.sort() ans = [a[1] for a in A_id] print((*ans))
9
7
165
156
N = int(eval(input())) A = [int(i) for i in input().split()] for i, a in enumerate(A): A[i] = [a, i + 1] A.sort() B = [] for a in A: B.append(a[1]) print((*B))
N = int(eval(input())) A = [int(_) for _ in input().split()] A_id = [[a, i + 1] for i, a in enumerate(A)] A_id.sort() ans = [a[1] for a in A_id] print((*ans))
false
22.222222
[ "-A = [int(i) for i in input().split()]", "-for i, a in enumerate(A):", "- A[i] = [a, i + 1]", "-A.sort()", "-B = []", "-for a in A:", "- B.append(a[1])", "-print((*B))", "+A = [int(_) for _ in input().split()]", "+A_id = [[a, i + 1] for i, a in enumerate(A)]", "+A_id.sort()", "+ans = [a...
false
0.072842
0.074574
0.976768
[ "s982464164", "s135705166" ]
u054514819
p02726
python
s284803922
s148898455
553
125
50,652
75,088
Accepted
Accepted
77.4
N, X, Y = list(map(int, input().split())) graph = [[] for _ in range(N)] for i in range(1, N): graph[i-1].append(i) graph[i].append(i-1) graph[X-1].append(Y-1) graph[Y-1].append(X-1) from collections import deque, defaultdict dic = defaultdict(int) def bfs(s): checked = [0]*N queue = deque(...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N, X, Y = mapint() X, Y = X-1, Y-1 dist = [0]*(N-1) for i in range(N-1): for j in range(i+1, N): d = min(j-i, abs(i-X)+abs(j-Y)+1, abs(i-Y)+abs(j-X)+1) ...
29
14
655
376
N, X, Y = list(map(int, input().split())) graph = [[] for _ in range(N)] for i in range(1, N): graph[i - 1].append(i) graph[i].append(i - 1) graph[X - 1].append(Y - 1) graph[Y - 1].append(X - 1) from collections import deque, defaultdict dic = defaultdict(int) def bfs(s): checked = [0] * N queue = de...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N, X, Y = mapint() X, Y = X - 1, Y - 1 dist = [0] * (N - 1) for i in range(N - 1): for j in range(i + 1, N): d = min(j - i, abs(i - X) + abs(j - Y) + 1,...
false
51.724138
[ "-N, X, Y = list(map(int, input().split()))", "-graph = [[] for _ in range(N)]", "-for i in range(1, N):", "- graph[i - 1].append(i)", "- graph[i].append(i - 1)", "-graph[X - 1].append(Y - 1)", "-graph[Y - 1].append(X - 1)", "-from collections import deque, defaultdict", "-", "-dic = default...
false
0.038023
0.037442
1.015536
[ "s284803922", "s148898455" ]
u066253157
p02953
python
s836419796
s916504193
94
70
14,224
14,396
Accepted
Accepted
25.53
N = int(eval(input())) H = list(map(int, input().split())) flag = True for i in range(N-1, 0, -1): if H[i] == H[i-1] - 1: H[i-1] -= 1 elif H[i] < H[i-1] - 1: flag = False break elif H[i] >= H[i-1]: continue if flag: print("Yes") else: print...
N = int(eval(input())) H = list(map(int, input().split())) flag = True for i in range(N-1, 0, -1): if H[i] >= H[i-1]: continue elif H[i] == H[i-1] - 1: H[i-1] -= 1 elif H[i] < H[i-1] - 1: flag = False break if flag: print("Yes") else: print...
18
18
323
320
N = int(eval(input())) H = list(map(int, input().split())) flag = True for i in range(N - 1, 0, -1): if H[i] == H[i - 1] - 1: H[i - 1] -= 1 elif H[i] < H[i - 1] - 1: flag = False break elif H[i] >= H[i - 1]: continue if flag: print("Yes") else: print("No")
N = int(eval(input())) H = list(map(int, input().split())) flag = True for i in range(N - 1, 0, -1): if H[i] >= H[i - 1]: continue elif H[i] == H[i - 1] - 1: H[i - 1] -= 1 elif H[i] < H[i - 1] - 1: flag = False break if flag: print("Yes") else: print("No")
false
0
[ "- if H[i] == H[i - 1] - 1:", "+ if H[i] >= H[i - 1]:", "+ continue", "+ elif H[i] == H[i - 1] - 1:", "- elif H[i] >= H[i - 1]:", "- continue" ]
false
0.082034
0.056513
1.451587
[ "s836419796", "s916504193" ]
u588341295
p03081
python
s600747366
s278590794
1,918
590
41,424
83,788
Accepted
Accepted
69.24
# -*- coding: utf-8 -*- """ 参考:https://img.atcoder.jp/exawizards2019/editorial.pdf ・二分探索 """ import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def ceil(x, y=1):...
# -*- coding: utf-8 -*- """ 参考:https://img.atcoder.jp/exawizards2019/editorial.pdf ・二分探索 """ import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def ceil(x, y=1):...
95
87
1,943
1,799
# -*- coding: utf-8 -*- """ 参考:https://img.atcoder.jp/exawizards2019/editorial.pdf ・二分探索 """ import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def ceil(x, ...
# -*- coding: utf-8 -*- """ 参考:https://img.atcoder.jp/exawizards2019/editorial.pdf ・二分探索 """ import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def ceil(x, ...
false
8.421053
[ "- if m == -1:", "- return False", "- if m == N:", "- return True", "- if m == -1:", "- return True", "- if m == N:", "- return False" ]
false
0.046663
0.096896
0.48158
[ "s600747366", "s278590794" ]