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
u865413330
p02755
python
s455485369
s222877632
352
53
3,060
3,060
Accepted
Accepted
84.94
import math A, B = list(map(int, input().split())) ans = -1 for i in range(1, 1000000): if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B: ans = i break print(ans)
import math A, B = list(map(int, input().split())) ans = -1 for i in range(1, 100000): if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B: ans = i break print(ans)
11
11
198
197
import math A, B = list(map(int, input().split())) ans = -1 for i in range(1, 1000000): if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B: ans = i break print(ans)
import math A, B = list(map(int, input().split())) ans = -1 for i in range(1, 100000): if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B: ans = i break print(ans)
false
0
[ "-for i in range(1, 1000000):", "+for i in range(1, 100000):" ]
false
0.345667
0.073838
4.681419
[ "s455485369", "s222877632" ]
u562935282
p02851
python
s737680338
s925343939
326
210
122,240
34,084
Accepted
Accepted
35.58
from collections import defaultdict, deque n, k = list(map(int, input().split())) a = tuple(map(int, input().split())) acc = [0] t = 0 for a_ in a: t = (t + a_ - 1) % k acc.append(t) d = defaultdict(int) ret = 0 count = 0 dq = deque() for acc_ in acc: ret += d[acc_] d[acc_] += 1 ...
def main(): from collections import defaultdict, deque N, K = list(map(int, input().split())) a = list(map(int, input().split())) def accumulate(a, mod): s = 0 yield s for x in a: s = (s + x - 1) % mod yield s *acc, = accumulate(a, mod=...
24
39
412
733
from collections import defaultdict, deque n, k = list(map(int, input().split())) a = tuple(map(int, input().split())) acc = [0] t = 0 for a_ in a: t = (t + a_ - 1) % k acc.append(t) d = defaultdict(int) ret = 0 count = 0 dq = deque() for acc_ in acc: ret += d[acc_] d[acc_] += 1 dq.append(acc_) ...
def main(): from collections import defaultdict, deque N, K = list(map(int, input().split())) a = list(map(int, input().split())) def accumulate(a, mod): s = 0 yield s for x in a: s = (s + x - 1) % mod yield s (*acc,) = accumulate(a, mod=K) d = ...
false
38.461538
[ "-from collections import defaultdict, deque", "+def main():", "+ from collections import defaultdict, deque", "-n, k = list(map(int, input().split()))", "-a = tuple(map(int, input().split()))", "-acc = [0]", "-t = 0", "-for a_ in a:", "- t = (t + a_ - 1) % k", "- acc.append(t)", "-d = ...
false
0.042871
0.042288
1.01379
[ "s737680338", "s925343939" ]
u545368057
p03450
python
s681294081
s500923034
1,881
1,730
38,852
38,756
Accepted
Accepted
8.03
""" https://atcoder.jp/contests/abc087/tasks/arc090_b xR-xL = D Mこの情報が正しいかどうかの判定 グループを作って、グループ内の拘束条件があっているか確認 重み付きunionfindを使う https://qiita.com/drken/items/cce6fc5c579051e64fab http://at274.hatenablog.com/entry/2018/02/03/140504 5 5 1 2 2 2 3 3 4 5 4 2 5 10 3 4 3 """ from collections import defa...
""" https://atcoder.jp/contests/abc087/tasks/arc090_b xR-xL = D Mこの情報が正しいかどうかの判定 グループを作って、グループ内の拘束条件があっているか確認 重み付きunionfindを使う https://qiita.com/drken/items/cce6fc5c579051e64fab http://at274.hatenablog.com/entry/2018/02/03/140504 5 5 1 2 2 2 3 3 4 5 4 2 5 10 3 4 3 """ from collections import defa...
106
100
2,772
2,606
""" https://atcoder.jp/contests/abc087/tasks/arc090_b xR-xL = D Mこの情報が正しいかどうかの判定 グループを作って、グループ内の拘束条件があっているか確認 重み付きunionfindを使う https://qiita.com/drken/items/cce6fc5c579051e64fab http://at274.hatenablog.com/entry/2018/02/03/140504 5 5 1 2 2 2 3 3 4 5 4 2 5 10 3 4 3 """ from collections import defaultdict class UnionFi...
""" https://atcoder.jp/contests/abc087/tasks/arc090_b xR-xL = D Mこの情報が正しいかどうかの判定 グループを作って、グループ内の拘束条件があっているか確認 重み付きunionfindを使う https://qiita.com/drken/items/cce6fc5c579051e64fab http://at274.hatenablog.com/entry/2018/02/03/140504 5 5 1 2 2 2 3 3 4 5 4 2 5 10 3 4 3 """ from collections import defaultdict class UnionFi...
false
5.660377
[ "- # def calc_weight(self, x):", "- # self.find(x) #圧縮", "- # return self.weight[x]", "- # def calc_diff(self, x, y):", "- # return self.calc_weight(y) - self.calc_weight(x)", "+ ### 重みが正負逆になる。なんでだ", "- self.weight[px] = w - self.weight[x] + self.weight[y]", "+...
false
0.0394
0.039404
0.9999
[ "s681294081", "s500923034" ]
u994988729
p02784
python
s960905729
s012320295
42
37
13,964
10,132
Accepted
Accepted
11.9
H, N = list(map(int, input().split())) A = list(map(int, input().split())) total = sum(A) if H > total: ans = "No" else: ans = "Yes" print(ans)
H,N=list(map(int,input().split())) atk = sum(map(int,input().split())) if atk>=H: print("Yes") else: print("No")
8
6
153
115
H, N = list(map(int, input().split())) A = list(map(int, input().split())) total = sum(A) if H > total: ans = "No" else: ans = "Yes" print(ans)
H, N = list(map(int, input().split())) atk = sum(map(int, input().split())) if atk >= H: print("Yes") else: print("No")
false
25
[ "-A = list(map(int, input().split()))", "-total = sum(A)", "-if H > total:", "- ans = \"No\"", "+atk = sum(map(int, input().split()))", "+if atk >= H:", "+ print(\"Yes\")", "- ans = \"Yes\"", "-print(ans)", "+ print(\"No\")" ]
false
0.083365
0.09092
0.916904
[ "s960905729", "s012320295" ]
u811817592
p02756
python
s924045205
s457127450
408
351
4,596
4,540
Accepted
Accepted
13.97
# -*- coding: utf-8 -*- S = str(eval(input())) Q = int(eval(input())) rev_flag = 1 head_str = "" tail_str = "" for _ in range(Q): query = eval(input()) # contains spaces if query[0] == "1": rev_flag *= -1 else: h_or_t_flag = 1 if query[2] == "1" else -1 h_or_t_flag *= r...
def resolve(): S = str(eval(input())) Q = int(eval(input())) rev_flag = 1 head_str = "" tail_str = "" for _ in range(Q): query = eval(input()) # contains spaces if query[0] == "1": rev_flag *= -1 else: h_or_t_flag = 1 if query[2] == "1...
22
23
515
582
# -*- coding: utf-8 -*- S = str(eval(input())) Q = int(eval(input())) rev_flag = 1 head_str = "" tail_str = "" for _ in range(Q): query = eval(input()) # contains spaces if query[0] == "1": rev_flag *= -1 else: h_or_t_flag = 1 if query[2] == "1" else -1 h_or_t_flag *= rev_flag ...
def resolve(): S = str(eval(input())) Q = int(eval(input())) rev_flag = 1 head_str = "" tail_str = "" for _ in range(Q): query = eval(input()) # contains spaces if query[0] == "1": rev_flag *= -1 else: h_or_t_flag = 1 if query[2] == "1" else -1 ...
false
4.347826
[ "-# -*- coding: utf-8 -*-", "-S = str(eval(input()))", "-Q = int(eval(input()))", "-rev_flag = 1", "-head_str = \"\"", "-tail_str = \"\"", "-for _ in range(Q):", "- query = eval(input()) # contains spaces", "- if query[0] == \"1\":", "- rev_flag *= -1", "- else:", "- h_...
false
0.044035
0.035343
1.245951
[ "s924045205", "s457127450" ]
u125205981
p03937
python
s426885146
s455492407
23
17
3,188
3,060
Accepted
Accepted
26.09
import sys h, w = list(map(int, input().split())) i = 0 pos = 0 while h > i: s = eval(input()) l = s.find('#') r = s.rfind('#') if (l == pos and r >= pos): pos = r i += 1 else: print('Impossible') sys.exit() print('Possible')
def main(): H, W = list(map(int, input().split())) l = H + W - 1 sharp = 0 i = 0 while i < H: A = str(eval(input())) sharp += A.count('#') i += 1 if l == sharp: print('Possible') else: print('Impossible') main()
15
17
280
287
import sys h, w = list(map(int, input().split())) i = 0 pos = 0 while h > i: s = eval(input()) l = s.find("#") r = s.rfind("#") if l == pos and r >= pos: pos = r i += 1 else: print("Impossible") sys.exit() print("Possible")
def main(): H, W = list(map(int, input().split())) l = H + W - 1 sharp = 0 i = 0 while i < H: A = str(eval(input())) sharp += A.count("#") i += 1 if l == sharp: print("Possible") else: print("Impossible") main()
false
11.764706
[ "-import sys", "-", "-h, w = list(map(int, input().split()))", "-i = 0", "-pos = 0", "-while h > i:", "- s = eval(input())", "- l = s.find(\"#\")", "- r = s.rfind(\"#\")", "- if l == pos and r >= pos:", "- pos = r", "+def main():", "+ H, W = list(map(int, input().split(...
false
0.17029
0.068764
2.476455
[ "s426885146", "s455492407" ]
u385792265
p03167
python
s036986662
s367955262
878
609
51,480
13,812
Accepted
Accepted
30.64
h, w = list(map(int, input().split())) a=[ list(eval(input())) for _ in range(h)] mod=int((1e9)+7) dp=[ [0]*w for _ in range(h+1)] dp[0][0]=1 for i in range(1,h+1): dp[i][0]=int(dp[i-1][0]==1)*int(a[i-1][0]=='.') for j in range(1,w): dp[i][j]=(dp[i-1][j]+dp[i][j-1])*int(not a[i-1][j]=='#') % mod...
h, w = list(map(int, input().split())) a=[ list(eval(input())) for _ in range(h)] dp=[1]+[0]*(w-1) for i in range(h): dp[0]=int(dp[0]==1 and a[i][0]=='.') for j in range(1,w): dp[j]=(int(a[i][j]=='.')*(dp[j]+dp[j-1]) % 1000000007 ) print((dp[-1]))
10
7
327
247
h, w = list(map(int, input().split())) a = [list(eval(input())) for _ in range(h)] mod = int((1e9) + 7) dp = [[0] * w for _ in range(h + 1)] dp[0][0] = 1 for i in range(1, h + 1): dp[i][0] = int(dp[i - 1][0] == 1) * int(a[i - 1][0] == ".") for j in range(1, w): dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) *...
h, w = list(map(int, input().split())) a = [list(eval(input())) for _ in range(h)] dp = [1] + [0] * (w - 1) for i in range(h): dp[0] = int(dp[0] == 1 and a[i][0] == ".") for j in range(1, w): dp[j] = int(a[i][j] == ".") * (dp[j] + dp[j - 1]) % 1000000007 print((dp[-1]))
false
30
[ "-mod = int((1e9) + 7)", "-dp = [[0] * w for _ in range(h + 1)]", "-dp[0][0] = 1", "-for i in range(1, h + 1):", "- dp[i][0] = int(dp[i - 1][0] == 1) * int(a[i - 1][0] == \".\")", "+dp = [1] + [0] * (w - 1)", "+for i in range(h):", "+ dp[0] = int(dp[0] == 1 and a[i][0] == \".\")", "- dp...
false
0.040805
0.037545
1.086821
[ "s036986662", "s367955262" ]
u038024401
p02984
python
s656784753
s004675221
252
118
23,192
14,156
Accepted
Accepted
53.17
import numpy as np N = int(eval(input())) A = tuple(map(int, input().split())) rain = [None]*N rain[0] = sum(A) - 2*(sum(A[1:N-1:2])) for i in range(1, N): rain[i] = 2*A[i-1] - rain[i-1] print((*rain))
N = int(eval(input())) A = tuple(map(int, input().split())) rain = [None]*N rain[0] = sum(A) - 2*(sum(A[1:N-1:2])) for i in range(1, N): rain[i] = 2*A[i-1] - rain[i-1] print((*rain))
13
11
214
192
import numpy as np N = int(eval(input())) A = tuple(map(int, input().split())) rain = [None] * N rain[0] = sum(A) - 2 * (sum(A[1 : N - 1 : 2])) for i in range(1, N): rain[i] = 2 * A[i - 1] - rain[i - 1] print((*rain))
N = int(eval(input())) A = tuple(map(int, input().split())) rain = [None] * N rain[0] = sum(A) - 2 * (sum(A[1 : N - 1 : 2])) for i in range(1, N): rain[i] = 2 * A[i - 1] - rain[i - 1] print((*rain))
false
15.384615
[ "-import numpy as np", "-" ]
false
0.041468
0.08683
0.477577
[ "s656784753", "s004675221" ]
u952708174
p03776
python
s622542115
s432926850
55
23
5,716
3,572
Accepted
Accepted
58.18
def d_MaximumAverageSets(N, A, B, V): # パスカルの三角形でコンビネーション計算 C = [[0] * (N + 1) for _ in range(N + 1)] for i in range(N + 1): for j in range(i + 1): if j == 0 or j == i: C[i][j] = 1 else: C[i][j] = C[i - 1][j - 1] + C[i - 1][j] # ...
from functools import reduce def d_maximum_average_sets(): from functools import reduce N, A, B = [int(i) for i in input().split()] V = sorted([int(i) for i in input().split()], reverse=True) def combination(n, r): numerator = reduce(lambda x, y: x * y, list(range(n, n - r, -1))) ...
37
24
1,015
915
def d_MaximumAverageSets(N, A, B, V): # パスカルの三角形でコンビネーション計算 C = [[0] * (N + 1) for _ in range(N + 1)] for i in range(N + 1): for j in range(i + 1): if j == 0 or j == i: C[i][j] = 1 else: C[i][j] = C[i - 1][j - 1] + C[i - 1][j] # 平均値の最大値を計算 ...
from functools import reduce def d_maximum_average_sets(): from functools import reduce N, A, B = [int(i) for i in input().split()] V = sorted([int(i) for i in input().split()], reverse=True) def combination(n, r): numerator = reduce(lambda x, y: x * y, list(range(n, n - r, -1))) den...
false
35.135135
[ "-def d_MaximumAverageSets(N, A, B, V):", "- # パスカルの三角形でコンビネーション計算", "- C = [[0] * (N + 1) for _ in range(N + 1)]", "- for i in range(N + 1):", "- for j in range(i + 1):", "- if j == 0 or j == i:", "- C[i][j] = 1", "- else:", "- C[i...
false
0.225601
0.038364
5.880488
[ "s622542115", "s432926850" ]
u119148115
p03032
python
s105969516
s358415633
221
186
41,712
70,508
Accepted
Accepted
15.84
N,K = list(map(int,input().split())) V = [0] + list(map(int,input().split())) + [0] m = min(N,K) A = [] ans = 0 #左からi個、右からj個除いた時の宝石の価値のmax for i in range(m+1): if i == 0: pass else: A.append(V[i]) B = [] for j in range(m-i+1): if j == 0: pass ...
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし def ...
29
27
552
932
N, K = list(map(int, input().split())) V = [0] + list(map(int, input().split())) + [0] m = min(N, K) A = [] ans = 0 # 左からi個、右からj個除いた時の宝石の価値のmax for i in range(m + 1): if i == 0: pass else: A.append(V[i]) B = [] for j in range(m - i + 1): if j == 0: pass else: ...
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり def LI2(): return list(map(int, sys.stdin.readline().r...
false
6.896552
[ "-N, K = list(map(int, input().split()))", "-V = [0] + list(map(int, input().split())) + [0]", "-m = min(N, K)", "-A = []", "+import sys", "+", "+sys.setrecursionlimit(10**7)", "+", "+", "+def I():", "+ return int(sys.stdin.readline().rstrip())", "+", "+", "+def MI():", "+ return l...
false
0.03456
0.035542
0.972377
[ "s105969516", "s358415633" ]
u729133443
p03943
python
s494861905
s831291212
162
18
38,256
3,064
Accepted
Accepted
88.89
*a,=list(map(int,input().split()));print(('YNeos'[sum(a)/2!=max(a)::2]))
s=eval(input());print(('NYoe s'[' 2'in s or' 5'in s::2]))
1
1
64
49
(*a,) = list(map(int, input().split())) print(("YNeos"[sum(a) / 2 != max(a) :: 2]))
s = eval(input()) print(("NYoe s"[" 2" in s or " 5" in s :: 2]))
false
0
[ "-(*a,) = list(map(int, input().split()))", "-print((\"YNeos\"[sum(a) / 2 != max(a) :: 2]))", "+s = eval(input())", "+print((\"NYoe s\"[\" 2\" in s or \" 5\" in s :: 2]))" ]
false
0.038317
0.006828
5.611662
[ "s494861905", "s831291212" ]
u918276501
p02256
python
s556299542
s463289787
30
20
7,660
7,660
Accepted
Accepted
33.33
x, y = list(map(int, input().split())) if x < y: x,y = y,x while y: x,y = y, x%y print(x)
a,b=list(map(int,input().split())) while b: a,b=b,a%b print(a)
6
4
98
60
x, y = list(map(int, input().split())) if x < y: x, y = y, x while y: x, y = y, x % y print(x)
a, b = list(map(int, input().split())) while b: a, b = b, a % b print(a)
false
33.333333
[ "-x, y = list(map(int, input().split()))", "-if x < y:", "- x, y = y, x", "-while y:", "- x, y = y, x % y", "-print(x)", "+a, b = list(map(int, input().split()))", "+while b:", "+ a, b = b, a % b", "+print(a)" ]
false
0.063748
0.064831
0.983296
[ "s556299542", "s463289787" ]
u729133443
p03476
python
s711697890
s810161824
1,037
881
54,092
7,908
Accepted
Accepted
15.04
n=10**5 p=[0,0]+[1]*~-n for i in range(2,int(n**0.5)+1): if not p[i]:continue for j in range(i*2,n+1,i):p[j]=0 c=[0] for i in range(1,n+1): c.append(c[-1]+(i%2and p[i]and p[-~i//2])) for _ in range(int(eval(input()))): l,r=list(map(int,input().split())) print((c[r]-c[l-1]))
n=10**5;p=[0,0]+[1]*~-n for i in range(2,int(n**0.5)+1): if p[i]: for j in range(i*2,n+1,i):p[j]=0 c=[0] for i in range(1,n+1):c.append(c[-1]+(i%2and p[i]and p[-~i//2])) for _ in[0]*int(eval(input())):l,r=list(map(int,input().split()));print((c[r]-c[l-1]))
11
7
280
251
n = 10**5 p = [0, 0] + [1] * ~-n for i in range(2, int(n**0.5) + 1): if not p[i]: continue for j in range(i * 2, n + 1, i): p[j] = 0 c = [0] for i in range(1, n + 1): c.append(c[-1] + (i % 2 and p[i] and p[-~i // 2])) for _ in range(int(eval(input()))): l, r = list(map(int, input().split...
n = 10**5 p = [0, 0] + [1] * ~-n for i in range(2, int(n**0.5) + 1): if p[i]: for j in range(i * 2, n + 1, i): p[j] = 0 c = [0] for i in range(1, n + 1): c.append(c[-1] + (i % 2 and p[i] and p[-~i // 2])) for _ in [0] * int(eval(input())): l, r = list(map(int, input().split())) print...
false
36.363636
[ "- if not p[i]:", "- continue", "- for j in range(i * 2, n + 1, i):", "- p[j] = 0", "+ if p[i]:", "+ for j in range(i * 2, n + 1, i):", "+ p[j] = 0", "-for _ in range(int(eval(input()))):", "+for _ in [0] * int(eval(input())):" ]
false
0.142856
0.123403
1.157643
[ "s711697890", "s810161824" ]
u933341648
p03061
python
s032165007
s268714541
207
178
14,052
14,524
Accepted
Accepted
14.01
N = int(eval(input())) A = [int(i) for i in input().split()] def gcd(x, y): if x < y: x, y = y, x if y == 0: return x return gcd(x%y, y) L = [0] R = [0] for i in range(N): L.append(gcd(A[i], L[i])) R.append(gcd(A[-i-1], R[i])) R.reverse() M = [] for i in range(...
N = int(eval(input())) A = [int(i) for i in input().split()] def gcd(x, y): if x < y: x, y = y, x while y != 0: x, y = y, x%y return x L = [0] R = [0] for i in range(N): L.append(gcd(A[i], L[i])) R.append(gcd(A[-i-1], R[i])) R.reverse() M = [] for i in range(0,...
23
23
370
369
N = int(eval(input())) A = [int(i) for i in input().split()] def gcd(x, y): if x < y: x, y = y, x if y == 0: return x return gcd(x % y, y) L = [0] R = [0] for i in range(N): L.append(gcd(A[i], L[i])) R.append(gcd(A[-i - 1], R[i])) R.reverse() M = [] for i in range(0, N): M.ap...
N = int(eval(input())) A = [int(i) for i in input().split()] def gcd(x, y): if x < y: x, y = y, x while y != 0: x, y = y, x % y return x L = [0] R = [0] for i in range(N): L.append(gcd(A[i], L[i])) R.append(gcd(A[-i - 1], R[i])) R.reverse() M = [] for i in range(0, N): M.appe...
false
0
[ "- if y == 0:", "- return x", "- return gcd(x % y, y)", "+ while y != 0:", "+ x, y = y, x % y", "+ return x" ]
false
0.03863
0.037772
1.022719
[ "s032165007", "s268714541" ]
u600402037
p02791
python
s391896310
s462193907
490
213
34,140
34,156
Accepted
Accepted
56.53
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() P = np.array(lr()) P_min = np.minimum.accumulate(P) answer = np.count_nonzero(P_min >= P) print(answer)
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() P = np.array(lr(), np.int32) P_min = np.minimum.accumulate(P) answer = np.count_nonzero(P_min >= P) print(answer)
13
13
266
276
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() P = np.array(lr()) P_min = np.minimum.accumulate(P) answer = np.count_nonzero(P_min >= P) print(answer)
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() P = np.array(lr(), np.int32) P_min = np.minimum.accumulate(P) answer = np.count_nonzero(P_min >= P) print(answer)
false
0
[ "-P = np.array(lr())", "+P = np.array(lr(), np.int32)" ]
false
0.258001
0.268335
0.961489
[ "s391896310", "s462193907" ]
u729133443
p03088
python
s930165875
s696854897
55
49
3,316
3,316
Accepted
Accepted
10.91
n=int(eval(input())) A,C,G,T,M,R=0,1,2,3,10**9+7,list(range(4)) dp=[[[[0]*4for k in R]for j in R]for i in range(n+1)] dp[0][T][T][T]=1 for i in range(1,n+1): for j in R: for k in R: for l in R: for m in R: if(G,A,C)!=(k,l,m)!=(A,C,G)!=(k,l,m)!=(A,G,C)!=(j,l,m)!=(A,G,C)!=(j,k,m):dp...
n=int(eval(input())) M,R=10**9+7,list(range(4)) dp=[[[[0]*4for k in R]for j in R]for i in range(n+1)] dp[0][3][3][3]=1 for i in range(1,n+1): for j in R: for k in R: for l in R: for m in R: if(2,0,1)!=(k,l,m)!=(0,1,2)!=(k,l,m)!=(0,2,1)!=(j,l,m)!=(0,2,1)!=(j,k,m):dp[i][k][l][m]=(dp...
11
11
409
393
n = int(eval(input())) A, C, G, T, M, R = 0, 1, 2, 3, 10**9 + 7, list(range(4)) dp = [[[[0] * 4 for k in R] for j in R] for i in range(n + 1)] dp[0][T][T][T] = 1 for i in range(1, n + 1): for j in R: for k in R: for l in R: for m in R: if ( ...
n = int(eval(input())) M, R = 10**9 + 7, list(range(4)) dp = [[[[0] * 4 for k in R] for j in R] for i in range(n + 1)] dp[0][3][3][3] = 1 for i in range(1, n + 1): for j in R: for k in R: for l in R: for m in R: if ( (2, 0, 1) ...
false
0
[ "-A, C, G, T, M, R = 0, 1, 2, 3, 10**9 + 7, list(range(4))", "+M, R = 10**9 + 7, list(range(4))", "-dp[0][T][T][T] = 1", "+dp[0][3][3][3] = 1", "- (G, A, C)", "+ (2, 0, 1)", "- != (A, C, G)", "+ != (0, 1, 2)", ...
false
0.072248
0.052625
1.37288
[ "s930165875", "s696854897" ]
u894521144
p02549
python
s253874306
s210285123
525
425
24,588
24,768
Accepted
Accepted
19.05
mod = 998244353 # 貰うDP def main(N, S): dp = [0 if n != 0 else 1 for n in range(N)] # dp[i]はマスiに行く通り数. (答えはdp[-1]), dp[0] = 1 (最初にいる場所だから1通り) A = [0 if n != 0 else 1 for n in range(N)] # dp[i] = A[i] - A[i-1] (i >= 1), A[0] = dp[0] = 1 (i = 0) が成り立つような配列を考える. for i in range(1, N): # 今いる点 ...
mod = 998244353 # 貰うDP # Pythonで普通に通った. def main(N, S): dp = [0 if n != 0 else 1 for n in range(N)] # dp[i]はマスiに行く通り数. (答えはdp[-1]), dp[0] = 1 (最初にいる場所だから1通り) A = [0 if n != 0 else 1 for n in range(N)] # dp[i] = A[i] - A[i-1] (i >= 1), A[0] = dp[0] = 1 (i = 0) が成り立つような配列を考える. for i in rang...
22
26
961
1,067
mod = 998244353 # 貰うDP def main(N, S): dp = [ 0 if n != 0 else 1 for n in range(N) ] # dp[i]はマスiに行く通り数. (答えはdp[-1]), dp[0] = 1 (最初にいる場所だから1通り) A = [ 0 if n != 0 else 1 for n in range(N) ] # dp[i] = A[i] - A[i-1] (i >= 1), A[0] = dp[0] = 1 (i = 0) が成り立つような配列を考える. for i in range(1, N...
mod = 998244353 # 貰うDP # Pythonで普通に通った. def main(N, S): dp = [ 0 if n != 0 else 1 for n in range(N) ] # dp[i]はマスiに行く通り数. (答えはdp[-1]), dp[0] = 1 (最初にいる場所だから1通り) A = [ 0 if n != 0 else 1 for n in range(N) ] # dp[i] = A[i] - A[i-1] (i >= 1), A[0] = dp[0] = 1 (i = 0) が成り立つような配列を考える. fo...
false
15.384615
[ "+# Pythonで普通に通った.", "- dp[i] += (", "- A[i - l] - A[max(i - r, 0) - 1]", "- ) # lからrの間で,注目点に行くために使用できる点を逆算. そこに行くことができる = 選択行動範囲の値を選択することで注目点に達することができる通り数.", "+ if (", "+ i - r <= 0", "+ ): # lからrの間で,注目点...
false
0.043112
0.043135
0.999454
[ "s253874306", "s210285123" ]
u943057856
p02861
python
s536329213
s875120325
435
271
8,052
13,864
Accepted
Accepted
37.7
import itertools n=int(eval(input())) l=[list(map(int,input().split())) for _ in range(n)] p=list(itertools.permutations(list(range(n)))) ans=0 for i in p: for j in range(n-1): ans+=((l[i[j+1]][0]-l[i[j]][0])**2+(l[i[j+1]][1]-l[i[j]][1])**2)**0.5 print((ans/len(p)))
from itertools import permutations n=int(eval(input())) l=[list(map(int,input().split())) for _ in range(n)] ans=0 p=list(permutations(list(range(n)),n)) for L in p: s=L[0] for i in L[1:]: ans+=((l[s][0]-l[i][0])**2+(l[s][1]-l[i][1])**2)**0.5 s=i print((ans/len(p)))
9
11
272
286
import itertools n = int(eval(input())) l = [list(map(int, input().split())) for _ in range(n)] p = list(itertools.permutations(list(range(n)))) ans = 0 for i in p: for j in range(n - 1): ans += ( (l[i[j + 1]][0] - l[i[j]][0]) ** 2 + (l[i[j + 1]][1] - l[i[j]][1]) ** 2 ) ** 0.5 print((an...
from itertools import permutations n = int(eval(input())) l = [list(map(int, input().split())) for _ in range(n)] ans = 0 p = list(permutations(list(range(n)), n)) for L in p: s = L[0] for i in L[1:]: ans += ((l[s][0] - l[i][0]) ** 2 + (l[s][1] - l[i][1]) ** 2) ** 0.5 s = i print((ans / len(p))...
false
18.181818
[ "-import itertools", "+from itertools import permutations", "-p = list(itertools.permutations(list(range(n))))", "-for i in p:", "- for j in range(n - 1):", "- ans += (", "- (l[i[j + 1]][0] - l[i[j]][0]) ** 2 + (l[i[j + 1]][1] - l[i[j]][1]) ** 2", "- ) ** 0.5", "+p = list...
false
0.04428
0.154234
0.287095
[ "s536329213", "s875120325" ]
u263830634
p03564
python
s441244247
s075525799
21
19
3,060
3,060
Accepted
Accepted
9.52
N = int(eval(input())) K = int(eval(input())) ans = None for i in range(2 ** N): tmp = 1 for j in range(N): if ((i >> j) &1): tmp += K else: tmp *= 2 if ans == None: ans = tmp else: ans = min(ans, tmp) print (ans)
import itertools N = int(eval(input())) K = int(eval(input())) ans = 10 ** 18 for i in itertools.product('AB', repeat = N): tmp = 1 for j in i: if j == 'A': tmp *= 2 else: tmp += K # print (i, tmp) ans = min(ans, tmp) print (ans)
18
16
294
291
N = int(eval(input())) K = int(eval(input())) ans = None for i in range(2**N): tmp = 1 for j in range(N): if (i >> j) & 1: tmp += K else: tmp *= 2 if ans == None: ans = tmp else: ans = min(ans, tmp) print(ans)
import itertools N = int(eval(input())) K = int(eval(input())) ans = 10**18 for i in itertools.product("AB", repeat=N): tmp = 1 for j in i: if j == "A": tmp *= 2 else: tmp += K # print (i, tmp) ans = min(ans, tmp) print(ans)
false
11.111111
[ "+import itertools", "+", "-ans = None", "-for i in range(2**N):", "+ans = 10**18", "+for i in itertools.product(\"AB\", repeat=N):", "- for j in range(N):", "- if (i >> j) & 1:", "+ for j in i:", "+ if j == \"A\":", "+ tmp *= 2", "+ else:", "- el...
false
0.04909
0.048952
1.00282
[ "s441244247", "s075525799" ]
u987164499
p02732
python
s070504496
s381933240
432
292
26,140
24,996
Accepted
Accepted
32.41
from sys import stdin,setrecursionlimit n = int(stdin.readline().rstrip()) li = list(map(int,stdin.readline().rstrip().split())) lin = [0]*(n+1) for i in li: lin[i] += 1 liv = [0]*(n+1) point = 0 for j,k in enumerate(lin): point += k*(k-1)//2 liv[j] += k*(k-1)//2 for i in li: print((point-li...
N = int(eval(input())) A = list(map(int,input().split())) #各要素が何個あるか num_list = [0]*(N+1) for i in A: num_list[i] += 1 #全体の組み合わせ total = 0 for j in num_list: total += j*(j-1)//2 for k in A: print((total+1-num_list[k]))
13
15
349
239
from sys import stdin, setrecursionlimit n = int(stdin.readline().rstrip()) li = list(map(int, stdin.readline().rstrip().split())) lin = [0] * (n + 1) for i in li: lin[i] += 1 liv = [0] * (n + 1) point = 0 for j, k in enumerate(lin): point += k * (k - 1) // 2 liv[j] += k * (k - 1) // 2 for i in li: pri...
N = int(eval(input())) A = list(map(int, input().split())) # 各要素が何個あるか num_list = [0] * (N + 1) for i in A: num_list[i] += 1 # 全体の組み合わせ total = 0 for j in num_list: total += j * (j - 1) // 2 for k in A: print((total + 1 - num_list[k]))
false
13.333333
[ "-from sys import stdin, setrecursionlimit", "-", "-n = int(stdin.readline().rstrip())", "-li = list(map(int, stdin.readline().rstrip().split()))", "-lin = [0] * (n + 1)", "-for i in li:", "- lin[i] += 1", "-liv = [0] * (n + 1)", "-point = 0", "-for j, k in enumerate(lin):", "- point += k ...
false
0.040451
0.098569
0.410382
[ "s070504496", "s381933240" ]
u970197315
p03162
python
s657283882
s202697989
1,159
645
56,524
74,072
Accepted
Accepted
44.35
import numpy as np import sys stdin = sys.stdin sn = lambda : stdin.readline().rstrip() an = lambda : list(map(int, stdin.readline().split())) ni = lambda : int(sn()) N = ni() ABC = [list(map(int, input().split())) for i in range(N)] dp = [[0 for i in range(3)] for j in range(N+1)] def chmax(a, b): ...
# C - Vacation n=int(eval(input())) abc=[list(map(int,input().split())) for i in range(n)] # i日目にjを選んだ場合の幸福度の総和をdp[i][j]とする。 dp=[[0]*3 for i in range(n+1)] for i in range(n): for j in range(3): for k in range(3): if j==k:continue dp[i+1][k]=max(dp[i+1][k],dp[i][j]+abc[i][k])...
31
14
637
381
import numpy as np import sys stdin = sys.stdin sn = lambda: stdin.readline().rstrip() an = lambda: list(map(int, stdin.readline().split())) ni = lambda: int(sn()) N = ni() ABC = [list(map(int, input().split())) for i in range(N)] dp = [[0 for i in range(3)] for j in range(N + 1)] def chmax(a, b): if a > b: ...
# C - Vacation n = int(eval(input())) abc = [list(map(int, input().split())) for i in range(n)] # i日目にjを選んだ場合の幸福度の総和をdp[i][j]とする。 dp = [[0] * 3 for i in range(n + 1)] for i in range(n): for j in range(3): for k in range(3): if j == k: continue dp[i + 1][k] = max(dp[i ...
false
54.83871
[ "-import numpy as np", "-import sys", "-", "-stdin = sys.stdin", "-sn = lambda: stdin.readline().rstrip()", "-an = lambda: list(map(int, stdin.readline().split()))", "-ni = lambda: int(sn())", "-N = ni()", "-ABC = [list(map(int, input().split())) for i in range(N)]", "-dp = [[0 for i in range(3)] ...
false
0.061819
0.036715
1.683728
[ "s657283882", "s202697989" ]
u467736898
p03441
python
s291494275
s678273336
1,753
698
131,648
130,156
Accepted
Accepted
60.18
# 大混乱したので乱択 from random import randint def main(): import sys sys.setrecursionlimit(500000) N = int(eval(input())) if N==2: print((1)) exit() E = [[] for _ in range(N)] for _ in range(N-1): a, b = list(map(int, input().split())) E[a].append(b) ...
# 大混乱したので乱択 # これ嘘じゃないのか??? def main(): import sys sys.setrecursionlimit(500000) N = int(eval(input())) if N==2: print((1)) exit() E = [[] for _ in range(N)] for _ in range(N-1): a, b = list(map(int, input().split())) E[a].append(b) E[b].appe...
34
33
801
789
# 大混乱したので乱択 from random import randint def main(): import sys sys.setrecursionlimit(500000) N = int(eval(input())) if N == 2: print((1)) exit() E = [[] for _ in range(N)] for _ in range(N - 1): a, b = list(map(int, input().split())) E[a].append(b) E[b]....
# 大混乱したので乱択 # これ嘘じゃないのか??? def main(): import sys sys.setrecursionlimit(500000) N = int(eval(input())) if N == 2: print((1)) exit() E = [[] for _ in range(N)] for _ in range(N - 1): a, b = list(map(int, input().split())) E[a].append(b) E[b].append(a) ...
false
2.941176
[ "-# 大混乱したので乱択", "-from random import randint", "-", "-", "+# 大混乱したので乱択 # これ嘘じゃないのか???", "- for i in sorted(list(range(N)), key=lambda x: -len(E[x]))[:5]", "+ for i in sorted(list(range(N)), key=lambda x: -len(E[x]))[:1]" ]
false
0.045235
0.140982
0.320861
[ "s291494275", "s678273336" ]
u821989875
p02536
python
s372419425
s453824075
351
314
13,004
12,772
Accepted
Accepted
10.54
v, e = list(map(int,input().split())) par = [i for i in range(v+1)] def find(x): if par[x] == x: return x else: par[x] = find(par[x]) return par[x] def unite(x, y): x = find(x) y = find(y) if x == y: return 0 par[x] = y for i in range(e): a,...
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 = self.find(x) y = self.find...
27
54
443
1,239
v, e = list(map(int, input().split())) par = [i for i in range(v + 1)] def find(x): if par[x] == x: return x else: par[x] = find(par[x]) return par[x] def unite(x, y): x = find(x) y = find(y) if x == y: return 0 par[x] = y for i in range(e): a, b = list(...
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...
false
50
[ "-v, e = list(map(int, input().split()))", "-par = [i for i in range(v + 1)]", "+class UnionFind:", "+ def __init__(self, n):", "+ self.n = n", "+ self.parents = [-1] * n", "+", "+ def find(self, x):", "+ if self.parents[x] < 0:", "+ return x", "+ els...
false
0.09518
0.043483
2.188916
[ "s372419425", "s453824075" ]
u746419473
p02756
python
s512762369
s819957385
1,056
678
92,732
8,692
Accepted
Accepted
35.8
*s, = eval(input()) _q = int(eval(input())) rev = 0 l, r = [], [] for _ in range(_q): *q, = list(map(str, input().split())) if q[0] == "1": rev += 1 continue t = q[0] f = q[1] c = q[2] if rev%2 == 0: if f == "1": l.append(c) else: ...
import collections s = eval(input()) _q = int(eval(input())) q = collections.deque(s) rev = False for _ in range(_q): *query, = list(map(str, input().split())) if query[0] == "1": rev = not rev continue f, c = query[1], query[2] if rev ^ (f == "1"): q.appendle...
34
24
525
389
(*s,) = eval(input()) _q = int(eval(input())) rev = 0 l, r = [], [] for _ in range(_q): (*q,) = list(map(str, input().split())) if q[0] == "1": rev += 1 continue t = q[0] f = q[1] c = q[2] if rev % 2 == 0: if f == "1": l.append(c) else: r.a...
import collections s = eval(input()) _q = int(eval(input())) q = collections.deque(s) rev = False for _ in range(_q): (*query,) = list(map(str, input().split())) if query[0] == "1": rev = not rev continue f, c = query[1], query[2] if rev ^ (f == "1"): q.appendleft(c) else: ...
false
29.411765
[ "-(*s,) = eval(input())", "+import collections", "+", "+s = eval(input())", "-rev = 0", "-l, r = [], []", "+q = collections.deque(s)", "+rev = False", "- (*q,) = list(map(str, input().split()))", "- if q[0] == \"1\":", "- rev += 1", "+ (*query,) = list(map(str, input().split())...
false
0.037621
0.056903
0.661154
[ "s512762369", "s819957385" ]
u565387531
p02996
python
s015284353
s326722079
1,689
1,249
91,664
89,816
Accepted
Accepted
26.05
N = int(eval(input())) AB = [] for n in range(N): AB.append(list(map(int,input().split()))) aaa = sorted(AB, key=lambda x:(x[1], x[0])) sumW = 0 for a in aaa: sumW += a[0] if sumW > a[1]: print('No') exit() print('Yes')
N = int(eval(input())) AB = [] for n in range(N): AB.append(list(map(int,input().split()))) aaa = sorted(AB, key=lambda x:(x[1])) sumW = 0 for a in aaa: sumW += a[0] if sumW > a[1]: print('No') exit() print('Yes')
16
16
260
254
N = int(eval(input())) AB = [] for n in range(N): AB.append(list(map(int, input().split()))) aaa = sorted(AB, key=lambda x: (x[1], x[0])) sumW = 0 for a in aaa: sumW += a[0] if sumW > a[1]: print("No") exit() print("Yes")
N = int(eval(input())) AB = [] for n in range(N): AB.append(list(map(int, input().split()))) aaa = sorted(AB, key=lambda x: (x[1])) sumW = 0 for a in aaa: sumW += a[0] if sumW > a[1]: print("No") exit() print("Yes")
false
0
[ "-aaa = sorted(AB, key=lambda x: (x[1], x[0]))", "+aaa = sorted(AB, key=lambda x: (x[1]))" ]
false
0.03105
0.031791
0.976691
[ "s015284353", "s326722079" ]
u436484848
p04006
python
s222822591
s774029005
674
597
3,316
3,316
Accepted
Accepted
11.42
def read(): return [int(i) for i in input().split(" ")] N, x = read() A = read() ans = sum(A) tempcost = ans xt = 0 BC = A for i in range(1, N): xt += x A = [A[-1]] + A[0:-1] BC = [v if v < BC[i] else BC[i] for (i, v) in enumerate(A)] tempcost = xt + sum(BC) if(ans > tempcost): ans = tempcost pr...
def read(): return [int(i) for i in input().split(" ")] N, x = read() A = read() ans = sum(A) tempcost = ans xt = 0 BC = A for i in range(1, N): xt += x A = [A[-1]] + A[0:-1] BC = [v if v < BC[i] else BC[i] for (i, v) in enumerate(A)] tempcost = xt + sum(BC) if(ans > tempcost): ans = tempcost e...
16
18
329
346
def read(): return [int(i) for i in input().split(" ")] N, x = read() A = read() ans = sum(A) tempcost = ans xt = 0 BC = A for i in range(1, N): xt += x A = [A[-1]] + A[0:-1] BC = [v if v < BC[i] else BC[i] for (i, v) in enumerate(A)] tempcost = xt + sum(BC) if ans > tempcost: ans = te...
def read(): return [int(i) for i in input().split(" ")] N, x = read() A = read() ans = sum(A) tempcost = ans xt = 0 BC = A for i in range(1, N): xt += x A = [A[-1]] + A[0:-1] BC = [v if v < BC[i] else BC[i] for (i, v) in enumerate(A)] tempcost = xt + sum(BC) if ans > tempcost: ans = te...
false
11.111111
[ "+ else:", "+ break" ]
false
0.037431
0.038379
0.975277
[ "s222822591", "s774029005" ]
u638456847
p02733
python
s594965436
s017043806
1,543
763
3,188
3,316
Accepted
Accepted
50.55
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): H,W,K = list(map(int, readline().split())) S = [readline().strip() for j in range(H)] white = [] for line in S: white.append(line.count("1")) white_total = sum(white) ...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): H,W,K = list(map(int, readline().split())) S = [list(map(int, readline().strip())) for j in range(H)] white = 0 for line in S: white += sum(line) if white <= K: ...
59
58
1,438
1,401
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): H, W, K = list(map(int, readline().split())) S = [readline().strip() for j in range(H)] white = [] for line in S: white.append(line.count("1")) white_total = sum(white) if white_...
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): H, W, K = list(map(int, readline().split())) S = [list(map(int, readline().strip())) for j in range(H)] white = 0 for line in S: white += sum(line) if white <= K: print((0)) ...
false
1.694915
[ "- S = [readline().strip() for j in range(H)]", "- white = []", "+ S = [list(map(int, readline().strip())) for j in range(H)]", "+ white = 0", "- white.append(line.count(\"1\"))", "- white_total = sum(white)", "- if white_total <= K:", "+ white += sum(line)", "+ if...
false
0.037687
0.033524
1.124176
[ "s594965436", "s017043806" ]
u926678805
p03112
python
s773824693
s277313865
1,815
1,077
12,820
79,068
Accepted
Accepted
40.66
import bisect import sys input=lambda : sys.stdin.readline().rstrip() a,b,q=list(map(int,input().split())) s=sorted([int(eval(input())) for i in range(a)]) t=sorted([int(eval(input())) for i in range(b)]) for i in range(q): ans=999999999999 x=int(eval(input())) w=bisect.bisect_left(s,x) for j ...
import bisect import sys input=lambda : sys.stdin.readline().rstrip() a,b,q=list(map(int,input().split())) s=sorted([int(eval(input())) for i in range(a)]) t=sorted([int(eval(input())) for i in range(b)]) for i in range(q): ans=999999999999 x=int(eval(input())) w=bisect.bisect_left(s,x) for j ...
28
28
882
861
import bisect import sys input = lambda: sys.stdin.readline().rstrip() a, b, q = list(map(int, input().split())) s = sorted([int(eval(input())) for i in range(a)]) t = sorted([int(eval(input())) for i in range(b)]) for i in range(q): ans = 999999999999 x = int(eval(input())) w = bisect.bisect_left(s, x) ...
import bisect import sys input = lambda: sys.stdin.readline().rstrip() a, b, q = list(map(int, input().split())) s = sorted([int(eval(input())) for i in range(a)]) t = sorted([int(eval(input())) for i in range(b)]) for i in range(q): ans = 999999999999 x = int(eval(input())) w = bisect.bisect_left(s, x) ...
false
0
[ "- sys.stdout.write(\"%d\" % ans + \"\\n\")", "+ print(ans)" ]
false
0.037834
0.038979
0.97062
[ "s773824693", "s277313865" ]
u078349616
p03804
python
s804630481
s063444000
106
36
9,104
9,116
Accepted
Accepted
66.04
N, M = list(map(int, input().split())) A = [eval(input()) for _ in range(N)] B = [eval(input()) for _ in range(M)] for i in range(N-M+1): for j in range(N-M+1): ok = True for y in range(M): for x in range(M): if A[i+y][j+x] != B[y][x]: ok = ...
N, M = list(map(int, input().split())) A = [eval(input()) for _ in range(N)] B = [eval(input()) for _ in range(M)] for i in range(N-M+1): for j in range(N-M+1): ok = True for y in range(M): for x in range(M): if A[i+y][j+x] != B[y][x]: ok = ...
15
16
382
409
N, M = list(map(int, input().split())) A = [eval(input()) for _ in range(N)] B = [eval(input()) for _ in range(M)] for i in range(N - M + 1): for j in range(N - M + 1): ok = True for y in range(M): for x in range(M): if A[i + y][j + x] != B[y][x]: ok =...
N, M = list(map(int, input().split())) A = [eval(input()) for _ in range(N)] B = [eval(input()) for _ in range(M)] for i in range(N - M + 1): for j in range(N - M + 1): ok = True for y in range(M): for x in range(M): if A[i + y][j + x] != B[y][x]: ok =...
false
6.25
[ "+ break" ]
false
0.059318
0.119519
0.496305
[ "s804630481", "s063444000" ]
u729133443
p03724
python
s370907485
s645233095
257
69
85,488
22,132
Accepted
Accepted
73.15
l=[0]*2**17 for i in open(0).read().split()[2:]:l[int(i)]+=1 print(('YNEOS'[any(i%2for i in l)::2]))
from collections import*;print(('YNEOS'[any(i%2for i in list(Counter(open(0).read().split()[2:]).values()))::2]))
3
1
100
105
l = [0] * 2**17 for i in open(0).read().split()[2:]: l[int(i)] += 1 print(("YNEOS"[any(i % 2 for i in l) :: 2]))
from collections import * print( ( "YNEOS"[ any(i % 2 for i in list(Counter(open(0).read().split()[2:]).values())) :: 2 ] ) )
false
66.666667
[ "-l = [0] * 2**17", "-for i in open(0).read().split()[2:]:", "- l[int(i)] += 1", "-print((\"YNEOS\"[any(i % 2 for i in l) :: 2]))", "+from collections import *", "+", "+print(", "+ (", "+ \"YNEOS\"[", "+ any(i % 2 for i in list(Counter(open(0).read().split()[2:]).values()))...
false
0.096973
0.042662
2.273039
[ "s370907485", "s645233095" ]
u078042885
p00106
python
s835604716
s001556209
30
20
7,660
7,564
Accepted
Accepted
33.33
a=[2,3,5,10,12,15] b=[380,550,850,1520,1870,2244] while 1: n=int(eval(input())) if n==0:break n//=100 dp=[0]+[1<<29]*n for i in range(5,-1,-1): for j in range(n+1): if j+a[i]<=n and dp[j]!=1<<29:dp[j+a[i]]=min(dp[j+a[i]],dp[j]+b[i]) print((dp[n]))
a=[(2,380),(3,550),(5,850),(10,1520),(12,1870),(15,2244)] dp=[1<<20]*51 for i,j in a: dp[i]=j for k in range(51-i): if dp[k]!=1<<20 and dp[k+i]>dp[k]+j: dp[k+i]=dp[k]+j while 1: n=int(eval(input())) if n==0:break print((dp[n//100]))
11
11
293
274
a = [2, 3, 5, 10, 12, 15] b = [380, 550, 850, 1520, 1870, 2244] while 1: n = int(eval(input())) if n == 0: break n //= 100 dp = [0] + [1 << 29] * n for i in range(5, -1, -1): for j in range(n + 1): if j + a[i] <= n and dp[j] != 1 << 29: dp[j + a[i]] = min(...
a = [(2, 380), (3, 550), (5, 850), (10, 1520), (12, 1870), (15, 2244)] dp = [1 << 20] * 51 for i, j in a: dp[i] = j for k in range(51 - i): if dp[k] != 1 << 20 and dp[k + i] > dp[k] + j: dp[k + i] = dp[k] + j while 1: n = int(eval(input())) if n == 0: break print((dp[n //...
false
0
[ "-a = [2, 3, 5, 10, 12, 15]", "-b = [380, 550, 850, 1520, 1870, 2244]", "+a = [(2, 380), (3, 550), (5, 850), (10, 1520), (12, 1870), (15, 2244)]", "+dp = [1 << 20] * 51", "+for i, j in a:", "+ dp[i] = j", "+ for k in range(51 - i):", "+ if dp[k] != 1 << 20 and dp[k + i] > dp[k] + j:", "...
false
0.038491
0.037707
1.020804
[ "s835604716", "s001556209" ]
u922487073
p03713
python
s903661380
s877326793
308
18
3,188
3,064
Accepted
Accepted
94.16
def func(H,W): area = H * W half_H = int(H/2) half_W = int(W/2) res = 10000000 # よこ # T for x in range(1,W): S1 = H * x S2_T = (W - x) * half_H S3_T = area - S1 - S2_T S2_2 = H * int((W - x)/2) S3_2 = area - S1 - S...
def func(H,W): if H % 3 == 0: return 0 H_3 = int(H/3) S1 = H_3 * W S2 = (H - H_3) * int(W/2) S3 = H * W - S1 - S2 res1 = max(S1, S2, S3) - min(S1, S2, S3) H_3_1 = int(H/3) + 1 S1 = H_3_1 * W S2 = (H - H_3_1) * int(W/2) S3 = H * W - S1 - S2 ...
47
21
1,126
480
def func(H, W): area = H * W half_H = int(H / 2) half_W = int(W / 2) res = 10000000 # よこ # T for x in range(1, W): S1 = H * x S2_T = (W - x) * half_H S3_T = area - S1 - S2_T S2_2 = H * int((W - x) / 2) S3_2 = area - S1 - S2_2 tmpres_T = max(S1,...
def func(H, W): if H % 3 == 0: return 0 H_3 = int(H / 3) S1 = H_3 * W S2 = (H - H_3) * int(W / 2) S3 = H * W - S1 - S2 res1 = max(S1, S2, S3) - min(S1, S2, S3) H_3_1 = int(H / 3) + 1 S1 = H_3_1 * W S2 = (H - H_3_1) * int(W / 2) S3 = H * W - S1 - S2 res2 = max(S1, S2, ...
false
55.319149
[ "- area = H * W", "- half_H = int(H / 2)", "- half_W = int(W / 2)", "- res = 10000000", "- # よこ", "- # T", "- for x in range(1, W):", "- S1 = H * x", "- S2_T = (W - x) * half_H", "- S3_T = area - S1 - S2_T", "- S2_2 = H * int((W - x) / 2)", "- ...
false
0.203307
0.036317
5.598144
[ "s903661380", "s877326793" ]
u698919163
p02848
python
s701801724
s398201555
69
34
4,596
4,468
Accepted
Accepted
50.72
N = int(input()) S = input() alpha = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] ans =[] for i in range(len(S)): for j in range(26): ...
N = int(input()) S = input() for i in range(len(S)): if (ord(S[i]) + N) > 90: print(chr(ord(S[i]) + N - 90 + 64), end="") else: print(chr(ord(S[i]) + N ), end="")
14
9
436
200
N = int(input()) S = input() alpha = [ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", ...
N = int(input()) S = input() for i in range(len(S)): if (ord(S[i]) + N) > 90: print(chr(ord(S[i]) + N - 90 + 64), end="") else: print(chr(ord(S[i]) + N), end="")
false
35.714286
[ "-alpha = [", "- \"A\",", "- \"B\",", "- \"C\",", "- \"D\",", "- \"E\",", "- \"F\",", "- \"G\",", "- \"H\",", "- \"I\",", "- \"J\",", "- \"K\",", "- \"L\",", "- \"M\",", "- \"N\",", "- \"O\",", "- \"P\",", "- \"Q\",", "- \"R\"...
false
0.080582
0.042194
1.909808
[ "s701801724", "s398201555" ]
u489959379
p03361
python
s020229918
s088652309
20
18
3,064
3,064
Accepted
Accepted
10
H, W = list(map(int, input().split())) grid = [list(eval(input())) for _ in range(H)] for h in range(H): for w in range(W): if grid[h][w] == "#": for dh, dw in ((1, 0), (-1, 0), (0, 1), (0, -1)): next_h, next_w = h + dh, w + dw if -1 < next_h < H and -1 < n...
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): H, W = list(map(int, input().split())) S = [list(eval(input())) for _ in range(H)] for h in range(H): for w in range(W): if S[h][w] == "#": for dh, dw in ((1,...
15
29
500
741
H, W = list(map(int, input().split())) grid = [list(eval(input())) for _ in range(H)] for h in range(H): for w in range(W): if grid[h][w] == "#": for dh, dw in ((1, 0), (-1, 0), (0, 1), (0, -1)): next_h, next_w = h + dh, w + dw if -1 < next_h < H and -1 < next_w <...
import sys sys.setrecursionlimit(10**7) f_inf = float("inf") mod = 10**9 + 7 def resolve(): H, W = list(map(int, input().split())) S = [list(eval(input())) for _ in range(H)] for h in range(H): for w in range(W): if S[h][w] == "#": for dh, dw in ((1, 0), (-1, 0), (0, 1...
false
48.275862
[ "-H, W = list(map(int, input().split()))", "-grid = [list(eval(input())) for _ in range(H)]", "-for h in range(H):", "- for w in range(W):", "- if grid[h][w] == \"#\":", "- for dh, dw in ((1, 0), (-1, 0), (0, 1), (0, -1)):", "- next_h, next_w = h + dh, w + dw", "- ...
false
0.045401
0.045908
0.98895
[ "s020229918", "s088652309" ]
u994988729
p02937
python
s605969875
s399339571
146
127
7,888
7,924
Accepted
Accepted
13.01
import collections import bisect S = eval(input()) T = eval(input()) N = len(S) d = collections.defaultdict(list) for i, s in enumerate(S): d[s].append(i + 1) ans = 0 end = 0 isOK = True i = 0 for t in T: if len(d[t]) == 0: isOK = False break dic = d[t] idx = bisec...
from collections import defaultdict import bisect S = eval(input()) T = eval(input()) d = defaultdict(list) for i, s in enumerate(S, start=1): d[s].append(i) ans = 0 i = 0 for t in T: if not d[t]: print((-1)) exit() if i >= d[t][-1]: ans += len(S) i =...
33
28
497
418
import collections import bisect S = eval(input()) T = eval(input()) N = len(S) d = collections.defaultdict(list) for i, s in enumerate(S): d[s].append(i + 1) ans = 0 end = 0 isOK = True i = 0 for t in T: if len(d[t]) == 0: isOK = False break dic = d[t] idx = bisect.bisect_right(dic, i)...
from collections import defaultdict import bisect S = eval(input()) T = eval(input()) d = defaultdict(list) for i, s in enumerate(S, start=1): d[s].append(i) ans = 0 i = 0 for t in T: if not d[t]: print((-1)) exit() if i >= d[t][-1]: ans += len(S) i = d[t][0] continu...
false
15.151515
[ "-import collections", "+from collections import defaultdict", "-N = len(S)", "-d = collections.defaultdict(list)", "-for i, s in enumerate(S):", "- d[s].append(i + 1)", "+d = defaultdict(list)", "+for i, s in enumerate(S, start=1):", "+ d[s].append(i)", "-end = 0", "-isOK = True", "- ...
false
0.036547
0.037317
0.979374
[ "s605969875", "s399339571" ]
u913482608
p03828
python
s913133392
s112463620
50
46
9,120
9,176
Accepted
Accepted
8
n = int(eval(input())) ji = {} ans = 1 m = 1000000007 for i in range(n): tmp = i + 1 j = 2 while tmp != 1: if tmp % j == 0: if not j in ji: ji[j] = 0 ji[j] += 1 tmp /= j else: j += 1 for i in li...
n = int(eval(input())) ji = {} ans = 1 for i in range(n): tmp = i + 1 j = 2 while tmp != 1: if tmp % j == 0: if not j in ji: ji[j] = 0 ji[j] += 1 tmp /= j else: j += 1 for i in list(ji.values()):...
24
21
379
356
n = int(eval(input())) ji = {} ans = 1 m = 1000000007 for i in range(n): tmp = i + 1 j = 2 while tmp != 1: if tmp % j == 0: if not j in ji: ji[j] = 0 ji[j] += 1 tmp /= j else: j += 1 for i in list(ji.values()): ans *= i + 1 ...
n = int(eval(input())) ji = {} ans = 1 for i in range(n): tmp = i + 1 j = 2 while tmp != 1: if tmp % j == 0: if not j in ji: ji[j] = 0 ji[j] += 1 tmp /= j else: j += 1 for i in list(ji.values()): ans *= i + 1 print((ans % 10...
false
12.5
[ "-m = 1000000007", "- ans %= m", "-print(ans)", "+print((ans % 1000000007))" ]
false
0.055196
0.05061
1.090614
[ "s913133392", "s112463620" ]
u404629709
p02773
python
s056300144
s633381238
1,090
1,006
92,040
100,432
Accepted
Accepted
7.71
n=int(eval(input())) s={} for i in range(n): wd=eval(input()) if wd in s: s[wd]+=1 else: s[wd]=1 mx=max(s.values()) ans=[] for i in list(s.keys()): if s[i]==mx: ans.append(i) ans.sort() for i in ans: print(i)
from collections import Counter n=int(eval(input())) s=[] for i in range(n): a=eval(input()) s.append(a) c=Counter(s) mx=max(c.values()) ans=[] for i in c: if c[i]==mx: ans.append(i) ans.sort() for i in ans: print(i)
17
17
230
234
n = int(eval(input())) s = {} for i in range(n): wd = eval(input()) if wd in s: s[wd] += 1 else: s[wd] = 1 mx = max(s.values()) ans = [] for i in list(s.keys()): if s[i] == mx: ans.append(i) ans.sort() for i in ans: print(i)
from collections import Counter n = int(eval(input())) s = [] for i in range(n): a = eval(input()) s.append(a) c = Counter(s) mx = max(c.values()) ans = [] for i in c: if c[i] == mx: ans.append(i) ans.sort() for i in ans: print(i)
false
0
[ "+from collections import Counter", "+", "-s = {}", "+s = []", "- wd = eval(input())", "- if wd in s:", "- s[wd] += 1", "- else:", "- s[wd] = 1", "-mx = max(s.values())", "+ a = eval(input())", "+ s.append(a)", "+c = Counter(s)", "+mx = max(c.values())", "-fo...
false
0.036332
0.043148
0.842033
[ "s056300144", "s633381238" ]
u761320129
p03659
python
s327546652
s086144488
254
197
24,812
24,816
Accepted
Accepted
22.44
N = int(eval(input())) src = list(map(int, input().split())) s = [0] for i in range(N): s.append(s[-1] + src[i]) ans = float('inf') for i in range(N-1): a = s[i+1] b = s[-1] - s[i+1] df = abs(a-b) ans = min(ans, df) print(ans)
N = int(eval(input())) src = list(map(int,input().split())) s = sum(src) ans = float('inf') tmp = 0 for i in range(N-1): tmp += src[i] rem = s - tmp ans = min(ans, abs(tmp - rem)) print(ans)
14
10
256
206
N = int(eval(input())) src = list(map(int, input().split())) s = [0] for i in range(N): s.append(s[-1] + src[i]) ans = float("inf") for i in range(N - 1): a = s[i + 1] b = s[-1] - s[i + 1] df = abs(a - b) ans = min(ans, df) print(ans)
N = int(eval(input())) src = list(map(int, input().split())) s = sum(src) ans = float("inf") tmp = 0 for i in range(N - 1): tmp += src[i] rem = s - tmp ans = min(ans, abs(tmp - rem)) print(ans)
false
28.571429
[ "-s = [0]", "-for i in range(N):", "- s.append(s[-1] + src[i])", "+s = sum(src)", "+tmp = 0", "- a = s[i + 1]", "- b = s[-1] - s[i + 1]", "- df = abs(a - b)", "- ans = min(ans, df)", "+ tmp += src[i]", "+ rem = s - tmp", "+ ans = min(ans, abs(tmp - rem))" ]
false
0.064081
0.046025
1.392309
[ "s327546652", "s086144488" ]
u600402037
p03450
python
s131972301
s577205054
1,494
1,160
137,980
131,720
Accepted
Accepted
22.36
import sys sys.setrecursionlimit(10 ** 7) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # 複数回出てきているところが問題、グラフ問題として連結した部分で判定 N, M = lr() adjacent = [[] for _ in range(N+1)] # 1-indexed for _ in range(M): l, r, d = lr() adjacent[l].append...
import sys sys.setrecursionlimit(10 ** 7) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # 複数回出てきているところが問題、グラフ問題として連結した部分で判定 N, M = lr() adjacent = [[] for _ in range(N+1)] # 1-indexed for _ in range(M): l, r, d = lr() adjacent[l].append...
37
33
814
739
import sys sys.setrecursionlimit(10**7) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # 複数回出てきているところが問題、グラフ問題として連結した部分で判定 N, M = lr() adjacent = [[] for _ in range(N + 1)] # 1-indexed for _ in range(M): l, r, d = lr() adjacent[l].append((r, d)) ...
import sys sys.setrecursionlimit(10**7) sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # 複数回出てきているところが問題、グラフ問題として連結した部分で判定 N, M = lr() adjacent = [[] for _ in range(N + 1)] # 1-indexed for _ in range(M): l, r, d = lr() adjacent[l].append((r, d)) ...
false
10.810811
[ "-used = set()", "- global used", "- used.add(i)", "- if X[target] != None and X[target] != X[i] + dist:", "+ if X[target] == None:", "+ X[target] = X[i] + dist", "+ check(target)", "+ elif X[target] != X[i] + dist:", "- if target in used:", ...
false
0.050379
0.048283
1.043414
[ "s131972301", "s577205054" ]
u884323674
p02725
python
s124720977
s827093131
139
108
26,444
26,444
Accepted
Accepted
22.3
K, N = list(map(int, input().split())) A = [int(i) for i in input().split()] A_dist = [0 for i in range(N)] for i in range(N): if i == 0: A_dist[0] = A[0] + (K - A[-1]) else: A_dist[i] = A[i] - A[i-1] print((K - max(A_dist)))
K, N = list(map(int, input().split())) A = [int(i) for i in input().split()] max_dist = A[0] + (K - A[-1]) for i in range(1, N): if A[i] - A[i-1] > max_dist: max_dist = A[i] - A[i-1] print((K - max_dist))
11
9
253
218
K, N = list(map(int, input().split())) A = [int(i) for i in input().split()] A_dist = [0 for i in range(N)] for i in range(N): if i == 0: A_dist[0] = A[0] + (K - A[-1]) else: A_dist[i] = A[i] - A[i - 1] print((K - max(A_dist)))
K, N = list(map(int, input().split())) A = [int(i) for i in input().split()] max_dist = A[0] + (K - A[-1]) for i in range(1, N): if A[i] - A[i - 1] > max_dist: max_dist = A[i] - A[i - 1] print((K - max_dist))
false
18.181818
[ "-A_dist = [0 for i in range(N)]", "-for i in range(N):", "- if i == 0:", "- A_dist[0] = A[0] + (K - A[-1])", "- else:", "- A_dist[i] = A[i] - A[i - 1]", "-print((K - max(A_dist)))", "+max_dist = A[0] + (K - A[-1])", "+for i in range(1, N):", "+ if A[i] - A[i - 1] > max_dist...
false
0.032858
0.035466
0.926453
[ "s124720977", "s827093131" ]
u057109575
p02714
python
s094757425
s359295765
1,507
165
69,276
74,248
Accepted
Accepted
89.05
N = int(eval(input())) S = eval(input()) d = {"R": 0, "G": 1, "B": 2} ctr = [[0] * 3 for _ in range(N + 1)] for i in range(N): ctr[i + 1][d[S[i]]] += 1 for j in range(3): ctr[i + 1][j] += ctr[i][j] ans = 0 for i in range(N - 1): for j in range(i + 1, N): if S[i] != S[j]: ...
from collections import Counter N = int(eval(input())) S = eval(input()) ctr = Counter(S) res = 0 for i in range(N - 1): for j in range(i + 1, N): k = 2 * j - i if k < N and (S[i] != S[j] and S[i] != S[k] and S[j] != S[k]): res += 1 print((ctr["R"] * ctr["G"] * ctr["B"]...
26
15
575
315
N = int(eval(input())) S = eval(input()) d = {"R": 0, "G": 1, "B": 2} ctr = [[0] * 3 for _ in range(N + 1)] for i in range(N): ctr[i + 1][d[S[i]]] += 1 for j in range(3): ctr[i + 1][j] += ctr[i][j] ans = 0 for i in range(N - 1): for j in range(i + 1, N): if S[i] != S[j]: c = (set...
from collections import Counter N = int(eval(input())) S = eval(input()) ctr = Counter(S) res = 0 for i in range(N - 1): for j in range(i + 1, N): k = 2 * j - i if k < N and (S[i] != S[j] and S[i] != S[k] and S[j] != S[k]): res += 1 print((ctr["R"] * ctr["G"] * ctr["B"] - res))
false
42.307692
[ "+from collections import Counter", "+", "-d = {\"R\": 0, \"G\": 1, \"B\": 2}", "-ctr = [[0] * 3 for _ in range(N + 1)]", "-for i in range(N):", "- ctr[i + 1][d[S[i]]] += 1", "- for j in range(3):", "- ctr[i + 1][j] += ctr[i][j]", "-ans = 0", "+ctr = Counter(S)", "+res = 0", "- ...
false
0.052813
0.034562
1.528092
[ "s094757425", "s359295765" ]
u563133000
p02554
python
s043675813
s749403901
586
390
10,768
11,012
Accepted
Accepted
33.45
N=int(eval(input())) tt=10**9+7 r=0 r-=(9**N)%tt r-=(9**N)%tt r+=(8**N)%tt r+=(10**N)%tt r=r%tt print(r)
N=int(eval(input())) tt=10**9+7 print(( (10**N - 2*9**N + 8**N)%tt ))
9
3
106
63
N = int(eval(input())) tt = 10**9 + 7 r = 0 r -= (9**N) % tt r -= (9**N) % tt r += (8**N) % tt r += (10**N) % tt r = r % tt print(r)
N = int(eval(input())) tt = 10**9 + 7 print(((10**N - 2 * 9**N + 8**N) % tt))
false
66.666667
[ "-r = 0", "-r -= (9**N) % tt", "-r -= (9**N) % tt", "-r += (8**N) % tt", "-r += (10**N) % tt", "-r = r % tt", "-print(r)", "+print(((10**N - 2 * 9**N + 8**N) % tt))" ]
false
0.104298
0.081231
1.283962
[ "s043675813", "s749403901" ]
u864197622
p02666
python
s397222808
s339466679
1,056
75
40,748
12,252
Accepted
Accepted
92.9
def productall(a): N = len(a) if N == 0: return [1] A = [1] * N + a[:] P = 10 ** 9 + 7 k = 100 K = k * 8 pa1 = (1 << k * 4 + 16) - ((1 << k * 4 + 16) % P) pa2 = (1 << k * 2 + 24) - ((1 << k * 2 + 24) % P) pa3 = (1 << k + 28) - ((1 << k + 28) % P) def modP(x): x...
def productall(a): N = len(a) if N == 0: return [1] A = [1] * N + a[:] P = 10 ** 9 + 7 k = 12 K = k * 8 pa1 = (1 << k * 4 + 16) - ((1 << k * 4 + 16) % P) pa2 = (1 << k * 2 + 24) - ((1 << k * 2 + 24) % P) pa3 = (1 << k + 28) - ((1 << k + 28) % P) m1 = int(("1" * (k * 4 -...
84
79
2,267
2,094
def productall(a): N = len(a) if N == 0: return [1] A = [1] * N + a[:] P = 10**9 + 7 k = 100 K = k * 8 pa1 = (1 << k * 4 + 16) - ((1 << k * 4 + 16) % P) pa2 = (1 << k * 2 + 24) - ((1 << k * 2 + 24) % P) pa3 = (1 << k + 28) - ((1 << k + 28) % P) def modP(x): x -= ...
def productall(a): N = len(a) if N == 0: return [1] A = [1] * N + a[:] P = 10**9 + 7 k = 12 K = k * 8 pa1 = (1 << k * 4 + 16) - ((1 << k * 4 + 16) % P) pa2 = (1 << k * 2 + 24) - ((1 << k * 2 + 24) % P) pa3 = (1 << k + 28) - ((1 << k + 28) % P) m1 = int(("1" * (k * 4 - 16)...
false
5.952381
[ "- k = 100", "+ k = 12", "+ m1 = int((\"1\" * (k * 4 - 16) + \"0\" * (k * 4 + 16)) * 5050, 2)", "+ m2 = int((\"1\" * (k * 6 - 24) + \"0\" * (k * 2 + 24)) * 5050, 2)", "+ m3 = int((\"1\" * (k * 7 - 28) + \"0\" * (k + 28)) * 5050, 2)", "- if i == N - 1 or i and 1 << i.bit_length() - 1 ...
false
0.038857
0.041425
0.937995
[ "s397222808", "s339466679" ]
u845643816
p02242
python
s961687177
s510088962
200
150
6,436
6,428
Accepted
Accepted
25
n = int(eval(input())) edgeList = [] rootList = [-1 for i in range(n)] parent = [-1 for i in range(n)] lenList = [0 for i in range(n)] sumLength = 0 for i in range(n): a = list(map(int, input().split())) for j in range(a[1]): edgeList.append([a[2*j+3], i, a[2*j+2]]) rootList = [-1 for i in...
n = int(eval(input())) edgeList = [] for i in range(n): a = list(map(int, input().split())) for j in range(a[1]): edgeList.append([a[2*j+3], i, a[2*j+2]]) rootList = [-1 for i in range(n)] parent = [0 for i in range(n)] lenList = [float("inf") for i in range(n)] lenList[0] = 0 def getRoo...
42
38
1,062
950
n = int(eval(input())) edgeList = [] rootList = [-1 for i in range(n)] parent = [-1 for i in range(n)] lenList = [0 for i in range(n)] sumLength = 0 for i in range(n): a = list(map(int, input().split())) for j in range(a[1]): edgeList.append([a[2 * j + 3], i, a[2 * j + 2]]) rootList = [-1 for i in range...
n = int(eval(input())) edgeList = [] for i in range(n): a = list(map(int, input().split())) for j in range(a[1]): edgeList.append([a[2 * j + 3], i, a[2 * j + 2]]) rootList = [-1 for i in range(n)] parent = [0 for i in range(n)] lenList = [float("inf") for i in range(n)] lenList[0] = 0 def getRoot(x): ...
false
9.52381
[ "-rootList = [-1 for i in range(n)]", "-parent = [-1 for i in range(n)]", "-lenList = [0 for i in range(n)]", "-sumLength = 0" ]
false
0.048363
0.123386
0.391965
[ "s961687177", "s510088962" ]
u837673618
p02737
python
s532868082
s383138014
1,656
1,243
65,244
65,276
Accepted
Accepted
24.94
from collections import defaultdict M = 998244353 B = pow(10, 18, M) N = int(eval(input())) def geometric_mod(a, r, m, n): x = a for i in range(n): yield x x = (x*r)%m BB = list(geometric_mod(1, B, M, N+2)) def ext_euc(a, b): x1, y1, z1 = 1, 0, a x2, y2, z2 = 0, 1, b while z1 != 1...
from collections import defaultdict import sys input = lambda: sys.stdin.readline().rstrip() M = 998244353 B = pow(10, 18, M) N = int(eval(input())) def geometric_mod(a, r, m, n): x = a for i in range(n): yield x x = (x*r)%m BB = list(geometric_mod(1, B, M, N+2)) def ext_euc(a, b): x1...
71
73
1,418
1,477
from collections import defaultdict M = 998244353 B = pow(10, 18, M) N = int(eval(input())) def geometric_mod(a, r, m, n): x = a for i in range(n): yield x x = (x * r) % m BB = list(geometric_mod(1, B, M, N + 2)) def ext_euc(a, b): x1, y1, z1 = 1, 0, a x2, y2, z2 = 0, 1, b whi...
from collections import defaultdict import sys input = lambda: sys.stdin.readline().rstrip() M = 998244353 B = pow(10, 18, M) N = int(eval(input())) def geometric_mod(a, r, m, n): x = a for i in range(n): yield x x = (x * r) % m BB = list(geometric_mod(1, B, M, N + 2)) def ext_euc(a, b): ...
false
2.739726
[ "+import sys", "+input = lambda: sys.stdin.readline().rstrip()" ]
false
0.080852
0.072693
1.112241
[ "s532868082", "s383138014" ]
u094191970
p03721
python
s849849292
s990463788
338
253
5,924
32,152
Accepted
Accepted
25.15
n,k=list(map(int,input().split())) l=[0 for i in range(10**5)] for i in range(n): a,b=list(map(int,input().split())) a-=1 l[a]+=b cnt=0 for i in range(len(l)): cnt+=l[i] if cnt>=k: print((i+1)) exit()
from sys import stdin nii=lambda:list(map(int,stdin.readline().split())) lnii=lambda:list(map(int,stdin.readline().split())) from bisect import bisect_left n,k=nii() l=[] for i in range(n): a,b=nii() l.append([a,b]) l.sort(key=lambda x:x[0]) a_l=[] b_l=[] for a,b in l: a_l.append(a) b_l.ap...
14
27
219
457
n, k = list(map(int, input().split())) l = [0 for i in range(10**5)] for i in range(n): a, b = list(map(int, input().split())) a -= 1 l[a] += b cnt = 0 for i in range(len(l)): cnt += l[i] if cnt >= k: print((i + 1)) exit()
from sys import stdin nii = lambda: list(map(int, stdin.readline().split())) lnii = lambda: list(map(int, stdin.readline().split())) from bisect import bisect_left n, k = nii() l = [] for i in range(n): a, b = nii() l.append([a, b]) l.sort(key=lambda x: x[0]) a_l = [] b_l = [] for a, b in l: a_l.append(a)...
false
48.148148
[ "-n, k = list(map(int, input().split()))", "-l = [0 for i in range(10**5)]", "+from sys import stdin", "+", "+nii = lambda: list(map(int, stdin.readline().split()))", "+lnii = lambda: list(map(int, stdin.readline().split()))", "+from bisect import bisect_left", "+", "+n, k = nii()", "+l = []", "...
false
0.04208
0.037928
1.109469
[ "s849849292", "s990463788" ]
u751277549
p02732
python
s127753895
s731388407
563
381
36,520
26,780
Accepted
Accepted
32.33
# from collections import deque from collections import Counter from scipy.misc import comb # from copy import deepcopy n = int(eval(input())) a = list(map(int, input().split())) C = Counter(a) S = 0 for key in C: S += comb(C[key], 2, exact=True) for k in range(n): A = a[k] print((S - C[A] +...
# from collections import deque from collections import Counter # from scipy.misc import comb # from copy import deepcopy n = int(eval(input())) a = list(map(int, input().split())) C = Counter(a) S = 0 """ for key in C: S += comb(C[key], 2, exact=True) """ for i in list(C.keys()): S += C[i]*(C[i]...
15
19
316
375
# from collections import deque from collections import Counter from scipy.misc import comb # from copy import deepcopy n = int(eval(input())) a = list(map(int, input().split())) C = Counter(a) S = 0 for key in C: S += comb(C[key], 2, exact=True) for k in range(n): A = a[k] print((S - C[A] + 1))
# from collections import deque from collections import Counter # from scipy.misc import comb # from copy import deepcopy n = int(eval(input())) a = list(map(int, input().split())) C = Counter(a) S = 0 """ for key in C: S += comb(C[key], 2, exact=True) """ for i in list(C.keys()): S += C[i] * (C[i] - 1) // 2 f...
false
21.052632
[ "-from scipy.misc import comb", "+# from scipy.misc import comb", "+\"\"\"", "+\"\"\"", "+for i in list(C.keys()):", "+ S += C[i] * (C[i] - 1) // 2" ]
false
0.175577
0.053081
3.307707
[ "s127753895", "s731388407" ]
u875291233
p02539
python
s492462512
s056250936
434
397
102,572
103,388
Accepted
Accepted
8.53
ROOT = 3 MOD = 998244353 roots = [pow(ROOT,(MOD-1)>>i,MOD) for i in range(24)] # 1 の 2^i 乗根 iroots = [pow(x,MOD-2,MOD) for x in roots] # 1 の 2^i 乗根の逆元 def untt(a,n): for i in range(n): m = 1<<(n-i-1) for s in range(1<<i): w_N = 1 s *= m*2 for p in ran...
ROOT = 3 MOD = 998244353 roots = [pow(ROOT,(MOD-1)>>i,MOD) for i in range(24)] # 1 の 2^i 乗根 iroots = [pow(x,MOD-2,MOD) for x in roots] # 1 の 2^i 乗根の逆元 def untt(a,n): for i in range(n): m = 1<<(n-i-1) for s in range(1<<i): w_N = 1 s *= m*2 for p in ran...
134
130
3,254
3,135
ROOT = 3 MOD = 998244353 roots = [pow(ROOT, (MOD - 1) >> i, MOD) for i in range(24)] # 1 の 2^i 乗根 iroots = [pow(x, MOD - 2, MOD) for x in roots] # 1 の 2^i 乗根の逆元 def untt(a, n): for i in range(n): m = 1 << (n - i - 1) for s in range(1 << i): w_N = 1 s *= m * 2 ...
ROOT = 3 MOD = 998244353 roots = [pow(ROOT, (MOD - 1) >> i, MOD) for i in range(24)] # 1 の 2^i 乗根 iroots = [pow(x, MOD - 2, MOD) for x in roots] # 1 の 2^i 乗根の逆元 def untt(a, n): for i in range(n): m = 1 << (n - i - 1) for s in range(1 << i): w_N = 1 s *= m * 2 ...
false
2.985075
[ "- # polys.sort(key=lambda x:len(x))", "- N = len(polys)", "- height = (N - 1).bit_length()", "- N0 = 1 << (height)", "- data = [None] * (N0 * 2)", "- data[N0 : N0 + N] = polys", "- data[N0 + N :] = [[1] for _ in range(N0 - N)]", "- # print(data)", "- # print(polys)", "-...
false
0.346465
0.251209
1.379188
[ "s492462512", "s056250936" ]
u645250356
p03476
python
s426005254
s756528227
544
340
80,056
13,340
Accepted
Accepted
37.5
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) ...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def ...
32
27
816
698
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.read...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, fractions sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().s...
false
15.625
[ "-import sys, bisect, math, itertools, fractions, pprint", "+import sys, bisect, math, itertools, fractions", "-n = 10**5 + 10", "-Q = inp()", "-ch = [False] * (n + 5)", "-for i in range(1, n):", "- if is_prime(i):", "- ch[i] = True", "-table = [0] * (n + 5)", "-for i in range(1, n):", ...
false
0.54925
0.80336
0.68369
[ "s426005254", "s756528227" ]
u175034939
p02623
python
s970500037
s101192824
421
273
48,796
50,688
Accepted
Accepted
35.15
from itertools import accumulate import bisect n, m, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) i = 0 j = 0 total = 0 ac = list(accumulate(a)) bc = list(accumulate(b)) ans = 0 for i in range(bisect.bisect(ac, k)): bi = bisect.bisect(bc...
from itertools import accumulate import bisect n, m, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) ac = [0] + list(accumulate(a)) bc = [0] + list(accumulate(b)) ans = 0 for i in range(bisect.bisect(ac, k)): bi = bisect.bisect(bc, k - ac[i]) ...
22
13
548
351
from itertools import accumulate import bisect n, m, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) i = 0 j = 0 total = 0 ac = list(accumulate(a)) bc = list(accumulate(b)) ans = 0 for i in range(bisect.bisect(ac, k)): bi = bisect.bisect(bc, k - ac[i]) ...
from itertools import accumulate import bisect n, m, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) ac = [0] + list(accumulate(a)) bc = [0] + list(accumulate(b)) ans = 0 for i in range(bisect.bisect(ac, k)): bi = bisect.bisect(bc, k - ac[i]) ans = ma...
false
40.909091
[ "-i = 0", "-j = 0", "-total = 0", "-ac = list(accumulate(a))", "-bc = list(accumulate(b))", "+ac = [0] + list(accumulate(a))", "+bc = [0] + list(accumulate(b))", "- ans = max(ans, i + 1 + bi)", "-for i in range(bisect.bisect(bc, k)):", "- bi = bisect.bisect(ac, k - bc[i])", "- ans = max...
false
0.043058
0.10136
0.424805
[ "s970500037", "s101192824" ]
u848647227
p04039
python
s600668428
s706292369
213
79
3,060
3,060
Accepted
Accepted
62.91
a,b = list(map(int,input().split(" "))) ar = list(map(int,input().split(" "))) while True: count = 0 br = list(str(a)) for r in br: if int(r) in ar: count += 1 if count == 0: print(a) break else: a += 1
a,b = list(map(int,input().split(" "))) ar = input().split(" ") while True: count = 0 for r in ar: if r in str(a): count += 1 break if count == 0: print(a) break a += 1
13
12
272
237
a, b = list(map(int, input().split(" "))) ar = list(map(int, input().split(" "))) while True: count = 0 br = list(str(a)) for r in br: if int(r) in ar: count += 1 if count == 0: print(a) break else: a += 1
a, b = list(map(int, input().split(" "))) ar = input().split(" ") while True: count = 0 for r in ar: if r in str(a): count += 1 break if count == 0: print(a) break a += 1
false
7.692308
[ "-ar = list(map(int, input().split(\" \")))", "+ar = input().split(\" \")", "- br = list(str(a))", "- for r in br:", "- if int(r) in ar:", "+ for r in ar:", "+ if r in str(a):", "+ break", "- else:", "- a += 1", "+ a += 1" ]
false
0.042936
0.046254
0.92827
[ "s600668428", "s706292369" ]
u214434454
p03495
python
s281626327
s454843226
235
147
40,092
30,344
Accepted
Accepted
37.45
n, k = list(map(int, input().split())) a = list(map(int, input().split())) d = {} for i in range(n): if a[i] in d: d[a[i]] = d[a[i]] + 1 else: d[a[i]] = 1 ans = 0 diverse = len(d) d = sorted(list(d.items()), key = lambda x:x[1]) for i in range(len(d)): if diverse > k: ...
n, k = list(map(int, input().split())) a = list(map(int, input().split())) cnt = [0] * 2000001 for i in range(n): cnt[a[i]] += 1 cnt.sort(reverse = True) print((n - sum(cnt[:k])))
20
7
384
182
n, k = list(map(int, input().split())) a = list(map(int, input().split())) d = {} for i in range(n): if a[i] in d: d[a[i]] = d[a[i]] + 1 else: d[a[i]] = 1 ans = 0 diverse = len(d) d = sorted(list(d.items()), key=lambda x: x[1]) for i in range(len(d)): if diverse > k: ans += d[i][1] ...
n, k = list(map(int, input().split())) a = list(map(int, input().split())) cnt = [0] * 2000001 for i in range(n): cnt[a[i]] += 1 cnt.sort(reverse=True) print((n - sum(cnt[:k])))
false
65
[ "-d = {}", "+cnt = [0] * 2000001", "- if a[i] in d:", "- d[a[i]] = d[a[i]] + 1", "- else:", "- d[a[i]] = 1", "-ans = 0", "-diverse = len(d)", "-d = sorted(list(d.items()), key=lambda x: x[1])", "-for i in range(len(d)):", "- if diverse > k:", "- ans += d[i][1]", ...
false
0.071125
0.092759
0.766772
[ "s281626327", "s454843226" ]
u798557584
p02731
python
s513888515
s308615825
32
17
2,940
2,940
Accepted
Accepted
46.88
L=int(eval(input())) l=L/3 print((l*l*(L-2*l)))
# (L**3)/27 L=int(eval(input())) print(((L**3)/27))
3
3
41
46
L = int(eval(input())) l = L / 3 print((l * l * (L - 2 * l)))
# (L**3)/27 L = int(eval(input())) print(((L**3) / 27))
false
0
[ "+# (L**3)/27", "-l = L / 3", "-print((l * l * (L - 2 * l)))", "+print(((L**3) / 27))" ]
false
0.041455
0.041473
0.999574
[ "s513888515", "s308615825" ]
u279266699
p02899
python
s348118515
s075247285
169
98
31,644
20,440
Accepted
Accepted
42.01
n = int(eval(input())) A = list(map(int, input().split())) N = list(range(1, n + 1)) c = sorted(zip(A, N)) A, N = list(zip(*c)) print((*N))
n = int(eval(input())) A = list(map(int, input().split())) N = sorted(list(range(1, n + 1)), key=lambda x: A[x - 1]) print((*N))
8
4
135
117
n = int(eval(input())) A = list(map(int, input().split())) N = list(range(1, n + 1)) c = sorted(zip(A, N)) A, N = list(zip(*c)) print((*N))
n = int(eval(input())) A = list(map(int, input().split())) N = sorted(list(range(1, n + 1)), key=lambda x: A[x - 1]) print((*N))
false
50
[ "-N = list(range(1, n + 1))", "-c = sorted(zip(A, N))", "-A, N = list(zip(*c))", "+N = sorted(list(range(1, n + 1)), key=lambda x: A[x - 1])" ]
false
0.036677
0.036924
0.993307
[ "s348118515", "s075247285" ]
u204842730
p02622
python
s980108615
s669151593
58
45
9,492
9,440
Accepted
Accepted
22.41
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline S,T=read().rstrip().decode().split() ans=0 for s,t in zip(S,T): if s!=t: ans+=1 print(ans)
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline S,T=read().rstrip().decode().split() print((sum(s!=t for s,t in zip(S,T))))
9
5
187
154
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline S, T = read().rstrip().decode().split() ans = 0 for s, t in zip(S, T): if s != t: ans += 1 print(ans)
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline S, T = read().rstrip().decode().split() print((sum(s != t for s, t in zip(S, T))))
false
44.444444
[ "-ans = 0", "-for s, t in zip(S, T):", "- if s != t:", "- ans += 1", "-print(ans)", "+print((sum(s != t for s, t in zip(S, T))))" ]
false
0.043937
0.043799
1.003147
[ "s980108615", "s669151593" ]
u864197622
p02692
python
s837870636
s066811265
517
129
85,404
11,880
Accepted
Accepted
75.05
import sys input = lambda: sys.stdin.readline().rstrip() D = {"AB": 2, "AC": 1, "BC": 0} N, a, b, c = list(map(int, input().split())) X = [a, b, c] S = [D[eval(input())] for _ in range(N)] ANS = [] if max(X) == 0 or X[S[0]-1] + X[S[0]-2] == 0: print("No") exit() if sum(X) == 1: t = 0 if a else ...
import sys input = lambda: sys.stdin.readline().rstrip() D = {"AB": 2, "AC": 1, "BC": 0} N, a, b, c = list(map(int, input().split())) X = [a, b, c] S = [D[eval(input())] for _ in range(N)] ANS = [] if max(X) == 0: print("No") exit() if sum(X) == 1: t = 0 if a else 1 if b else 2 for s in S:...
34
50
856
1,090
import sys input = lambda: sys.stdin.readline().rstrip() D = {"AB": 2, "AC": 1, "BC": 0} N, a, b, c = list(map(int, input().split())) X = [a, b, c] S = [D[eval(input())] for _ in range(N)] ANS = [] if max(X) == 0 or X[S[0] - 1] + X[S[0] - 2] == 0: print("No") exit() if sum(X) == 1: t = 0 if a else 1 if b e...
import sys input = lambda: sys.stdin.readline().rstrip() D = {"AB": 2, "AC": 1, "BC": 0} N, a, b, c = list(map(int, input().split())) X = [a, b, c] S = [D[eval(input())] for _ in range(N)] ANS = [] if max(X) == 0: print("No") exit() if sum(X) == 1: t = 0 if a else 1 if b else 2 for s in S: if X...
false
32
[ "-if max(X) == 0 or X[S[0] - 1] + X[S[0] - 2] == 0:", "+if max(X) == 0:", "-else:", "- for i, s in enumerate(S):", "- if (", "- X[s - 1] > X[s - 2]", "- or X[s - 1] == X[s - 2]", "- and i < N - 1", "- and S[i + 1] == (s - 1) % 3", "- ):"...
false
0.041453
0.104445
0.396885
[ "s837870636", "s066811265" ]
u347640436
p02580
python
s011575767
s609226459
1,197
917
137,540
85,472
Accepted
Accepted
23.39
H, W, M = list(map(int, input().split())) hc = [0] * H wc = [0] * W d = {} for _ in range(M): h, w = [int(x) - 1 for x in input().split()] hc[h] += 1 wc[w] += 1 d.setdefault(h, {}) d[h][w] = 1 result = 0 hm = max(hc) wm = max(wc) hi = [i for i in range(H) if hc[i] == hm] wi = [i fo...
H, W, M = list(map(int, input().split())) hc = [0] * H wc = [0] * W d = {} for _ in range(M): h, w = [int(x) - 1 for x in input().split()] hc[h] += 1 wc[w] += 1 d[(h, w)] = 1 maxh = max(hc) maxw = max(wc) result = max(maxh + maxw - 1, 0) wi = [i for i in range(W) if wc[i] == maxw] for...
26
22
557
479
H, W, M = list(map(int, input().split())) hc = [0] * H wc = [0] * W d = {} for _ in range(M): h, w = [int(x) - 1 for x in input().split()] hc[h] += 1 wc[w] += 1 d.setdefault(h, {}) d[h][w] = 1 result = 0 hm = max(hc) wm = max(wc) hi = [i for i in range(H) if hc[i] == hm] wi = [i for i in range(W) if...
H, W, M = list(map(int, input().split())) hc = [0] * H wc = [0] * W d = {} for _ in range(M): h, w = [int(x) - 1 for x in input().split()] hc[h] += 1 wc[w] += 1 d[(h, w)] = 1 maxh = max(hc) maxw = max(wc) result = max(maxh + maxw - 1, 0) wi = [i for i in range(W) if wc[i] == maxw] for h in [i for i in r...
false
15.384615
[ "- d.setdefault(h, {})", "- d[h][w] = 1", "-result = 0", "-hm = max(hc)", "-wm = max(wc)", "-hi = [i for i in range(H) if hc[i] == hm]", "-wi = [i for i in range(W) if wc[i] == wm]", "-for h in hi:", "+ d[(h, w)] = 1", "+maxh = max(hc)", "+maxw = max(wc)", "+result = max(maxh + maxw -...
false
0.086124
0.213904
0.402627
[ "s011575767", "s609226459" ]
u706786134
p03167
python
s194489105
s850832466
1,145
516
136,332
43,632
Accepted
Accepted
54.93
from collections import deque MOD = 10 ** 9 + 7 h, w = list(map(int, input().split())) grid = '#' * (w + 2) for _ in range(h): grid += '#' + eval(input()) + '#' grid += '#' * (w + 2) D = [0] * len(grid) start = w + 3 goal = -(w + 4) D[start] = 1 for i in range(start + 1, len(grid)): if grid[i] == ...
MOD = 10 ** 9 + 7 h, w = list(map(int, input().split())) grid = '#' * (w + 2) for _ in range(h): grid += '#' + eval(input()) + '#' grid += '#' * (w + 2) D = [0] * len(grid) start = w + 3 goal = -(w + 4) D[start] = 1 for i in range(start + 1, len(grid)): if grid[i] == '#': continue D[i] ...
17
15
392
359
from collections import deque MOD = 10**9 + 7 h, w = list(map(int, input().split())) grid = "#" * (w + 2) for _ in range(h): grid += "#" + eval(input()) + "#" grid += "#" * (w + 2) D = [0] * len(grid) start = w + 3 goal = -(w + 4) D[start] = 1 for i in range(start + 1, len(grid)): if grid[i] == "#": co...
MOD = 10**9 + 7 h, w = list(map(int, input().split())) grid = "#" * (w + 2) for _ in range(h): grid += "#" + eval(input()) + "#" grid += "#" * (w + 2) D = [0] * len(grid) start = w + 3 goal = -(w + 4) D[start] = 1 for i in range(start + 1, len(grid)): if grid[i] == "#": continue D[i] = (D[i - 1] + D...
false
11.764706
[ "-from collections import deque", "-" ]
false
0.04643
0.113872
0.407743
[ "s194489105", "s850832466" ]
u732870425
p03386
python
s377757636
s282311002
69
17
3,060
3,060
Accepted
Accepted
75.36
a, b, k = list(map(int, input().split())) ans = list(range(a, a+k)) + list(range(b-k+1, b+1)) ans.sort() ans2 = [] for i in ans: if a<=i<=b and i not in ans2: ans2.append(i) for j in ans2: print(j)
a, b, k = list(map(int, input().split())) li = list(range(a, b+1)) for i in sorted(set(li[:k]) | set(li[-k:])): print(i)
11
5
219
117
a, b, k = list(map(int, input().split())) ans = list(range(a, a + k)) + list(range(b - k + 1, b + 1)) ans.sort() ans2 = [] for i in ans: if a <= i <= b and i not in ans2: ans2.append(i) for j in ans2: print(j)
a, b, k = list(map(int, input().split())) li = list(range(a, b + 1)) for i in sorted(set(li[:k]) | set(li[-k:])): print(i)
false
54.545455
[ "-ans = list(range(a, a + k)) + list(range(b - k + 1, b + 1))", "-ans.sort()", "-ans2 = []", "-for i in ans:", "- if a <= i <= b and i not in ans2:", "- ans2.append(i)", "-for j in ans2:", "- print(j)", "+li = list(range(a, b + 1))", "+for i in sorted(set(li[:k]) | set(li[-k:])):", ...
false
0.060998
0.061585
0.99047
[ "s377757636", "s282311002" ]
u921826483
p03826
python
s594274407
s809009283
20
17
3,060
2,940
Accepted
Accepted
15
a,b,c,d = list(map(int,input().split())) if a*b > c*d: print((a*b)) else: print((c*d))
a,b,c,d = list(map(int,input().split())) if a*b >= c*d: print((a*b)) else: print((c*d))
5
5
89
89
a, b, c, d = list(map(int, input().split())) if a * b > c * d: print((a * b)) else: print((c * d))
a, b, c, d = list(map(int, input().split())) if a * b >= c * d: print((a * b)) else: print((c * d))
false
0
[ "-if a * b > c * d:", "+if a * b >= c * d:" ]
false
0.113756
0.111656
1.018811
[ "s594274407", "s809009283" ]
u189487046
p02549
python
s917768467
s690294011
1,196
1,012
27,932
28,004
Accepted
Accepted
15.38
N, K = list(map(int, input().split())) MOD = 998244353 lr = [] for _ in range(K): l, r = list(map(int, input().split())) lr.append((l, r)) lr.sort() dp = [0]*(N+1) dpsum = [0]*(N+1) dp[1] = 1 dpsum[1] = 1 # 区間の合計を複数回求める=累積和 # 累積和を作りながらDPをする for i in range(2, N+1): # マスiに移動できる数を求める f...
N, K = list(map(int, input().split())) MOD = 998244353 lr = [] for _ in range(K): l, r = list(map(int, input().split())) lr.append((l, r)) lr.sort() dp = [0]*(N+1) dpsum = [0]*(N+1) dp[1] = 1 dpsum[1] = 1 # 区間の合計を複数回求める=累積和 # 累積和を作りながらDPをする for i in range(2, N+1): # マスiに移動できる数を求める f...
32
32
608
608
N, K = list(map(int, input().split())) MOD = 998244353 lr = [] for _ in range(K): l, r = list(map(int, input().split())) lr.append((l, r)) lr.sort() dp = [0] * (N + 1) dpsum = [0] * (N + 1) dp[1] = 1 dpsum[1] = 1 # 区間の合計を複数回求める=累積和 # 累積和を作りながらDPをする for i in range(2, N + 1): # マスiに移動できる数を求める for l, r in ...
N, K = list(map(int, input().split())) MOD = 998244353 lr = [] for _ in range(K): l, r = list(map(int, input().split())) lr.append((l, r)) lr.sort() dp = [0] * (N + 1) dpsum = [0] * (N + 1) dp[1] = 1 dpsum[1] = 1 # 区間の合計を複数回求める=累積和 # 累積和を作りながらDPをする for i in range(2, N + 1): # マスiに移動できる数を求める for l, r in ...
false
0
[ "- if li < 1:", "+ if ri < 1:" ]
false
0.091657
0.038659
2.370897
[ "s917768467", "s690294011" ]
u775681539
p02837
python
s485725556
s527498178
1,359
801
3,064
3,064
Accepted
Accepted
41.06
#python3 g=[[-1 for _ in range(15)] for _ in range(15)] n=int(eval(input())) for i in range(n): a=int(eval(input())) for _ in range(a): x,y=list(map(int, input().split())) g[i][x-1]=y ans=0 for i in range(1<<n): hy = [0 for _ in range(n)] for j in range(n): if (i>>j)&1: hy[j]=1...
#python3 graph = [[-1 for _ in range(15)] for _ in range(15)] def main(): n = int(eval(input())) for i in range(n): a = int(eval(input())) for j in range(a): x, y = list(map(int, input().split())) graph[i][x-1] = y ans = 0 for i in rang...
26
33
520
763
# python3 g = [[-1 for _ in range(15)] for _ in range(15)] n = int(eval(input())) for i in range(n): a = int(eval(input())) for _ in range(a): x, y = list(map(int, input().split())) g[i][x - 1] = y ans = 0 for i in range(1 << n): hy = [0 for _ in range(n)] for j in range(n): if (...
# python3 graph = [[-1 for _ in range(15)] for _ in range(15)] def main(): n = int(eval(input())) for i in range(n): a = int(eval(input())) for j in range(a): x, y = list(map(int, input().split())) graph[i][x - 1] = y ans = 0 for i in range(1 << 15): h =...
false
21.212121
[ "-g = [[-1 for _ in range(15)] for _ in range(15)]", "-n = int(eval(input()))", "-for i in range(n):", "- a = int(eval(input()))", "- for _ in range(a):", "- x, y = list(map(int, input().split()))", "- g[i][x - 1] = y", "-ans = 0", "-for i in range(1 << n):", "- hy = [0 for ...
false
0.039327
0.275039
0.142989
[ "s485725556", "s527498178" ]
u613364835
p02659
python
s860945637
s436556435
24
22
9,172
9,108
Accepted
Accepted
8.33
A,B = list(map(str,input().split())) a = int(A) b = int(B.replace(".","")) ans = (a*b)//100 print(ans)
A,B = list(map(float,input().split())) a = int(A) b = int(B*100+0.5) ans = (a*b)//100 print(ans)
5
5
100
94
A, B = list(map(str, input().split())) a = int(A) b = int(B.replace(".", "")) ans = (a * b) // 100 print(ans)
A, B = list(map(float, input().split())) a = int(A) b = int(B * 100 + 0.5) ans = (a * b) // 100 print(ans)
false
0
[ "-A, B = list(map(str, input().split()))", "+A, B = list(map(float, input().split()))", "-b = int(B.replace(\".\", \"\"))", "+b = int(B * 100 + 0.5)" ]
false
0.046743
0.055242
0.84614
[ "s860945637", "s436556435" ]
u078349616
p03087
python
s282088728
s893160395
900
470
6,140
13,816
Accepted
Accepted
47.78
N, Q = list(map(int, input().split())) S = eval(input()) ac_sum = [0]*N for i in range(N): if S[max(i-1,0):i+1] == "AC": ac_sum[i] = ac_sum[max(i-1,0)] + 1 else: ac_sum[i] = ac_sum[max(i-1,0)] for _ in range(Q): l, r = list(map(int, input().split())) print((ac_sum[r-1] - ac_sum[l-1]))
N, Q = list(map(int, input().split())) S = eval(input()) cnt = [0]*N i = 0 while i < N-1: if S[i:i+2] == "AC": cnt[i] += 1 i += 1 i += 1 AS = [0]*(N+1) for i in range(1, N+1): AS[i] = AS[i-1] + cnt[i-1] for i in range(Q): l, r = list(map(int, input().split())) ans...
14
19
300
338
N, Q = list(map(int, input().split())) S = eval(input()) ac_sum = [0] * N for i in range(N): if S[max(i - 1, 0) : i + 1] == "AC": ac_sum[i] = ac_sum[max(i - 1, 0)] + 1 else: ac_sum[i] = ac_sum[max(i - 1, 0)] for _ in range(Q): l, r = list(map(int, input().split())) print((ac_sum[r - 1] -...
N, Q = list(map(int, input().split())) S = eval(input()) cnt = [0] * N i = 0 while i < N - 1: if S[i : i + 2] == "AC": cnt[i] += 1 i += 1 i += 1 AS = [0] * (N + 1) for i in range(1, N + 1): AS[i] = AS[i - 1] + cnt[i - 1] for i in range(Q): l, r = list(map(int, input().split())) ans =...
false
26.315789
[ "-ac_sum = [0] * N", "-for i in range(N):", "- if S[max(i - 1, 0) : i + 1] == \"AC\":", "- ac_sum[i] = ac_sum[max(i - 1, 0)] + 1", "- else:", "- ac_sum[i] = ac_sum[max(i - 1, 0)]", "-for _ in range(Q):", "+cnt = [0] * N", "+i = 0", "+while i < N - 1:", "+ if S[i : i + 2] =...
false
0.04696
0.037413
1.255169
[ "s282088728", "s893160395" ]
u223646582
p03775
python
s467408065
s845429239
59
31
2,940
2,940
Accepted
Accepted
47.46
N=int(eval(input())) ans=10 for A in range(1,int(N**0.5)+1): if N/A==int(N/A): ans=min(ans,len(str(int(N/A)))) print(ans)
N = int(eval(input())) def F(A, B): return max(len(str(A)), len(str(B))) ans = 10**30 for i in range(1, int(N**0.5)+1): if N % i == 0: ans = min(ans, F(i, N//i)) print(ans)
8
12
136
198
N = int(eval(input())) ans = 10 for A in range(1, int(N**0.5) + 1): if N / A == int(N / A): ans = min(ans, len(str(int(N / A)))) print(ans)
N = int(eval(input())) def F(A, B): return max(len(str(A)), len(str(B))) ans = 10**30 for i in range(1, int(N**0.5) + 1): if N % i == 0: ans = min(ans, F(i, N // i)) print(ans)
false
33.333333
[ "-ans = 10", "-for A in range(1, int(N**0.5) + 1):", "- if N / A == int(N / A):", "- ans = min(ans, len(str(int(N / A))))", "+", "+", "+def F(A, B):", "+ return max(len(str(A)), len(str(B)))", "+", "+", "+ans = 10**30", "+for i in range(1, int(N**0.5) + 1):", "+ if N % i == 0...
false
0.109146
0.072876
1.497702
[ "s467408065", "s845429239" ]
u980205854
p02756
python
s212377903
s082030037
392
323
11,460
100,956
Accepted
Accepted
17.6
# D - String Formation from collections import deque S = eval(input()) Q = int(eval(input())) now = 1 tmp = [deque([]),deque([])] for _ in range(Q): t = list(input().split()) if t[0]=='1': now = 1+(now==1) else: if int(t[1])==now: tmp[0].append(t[2]) else: ...
import sys from sys import exit from collections import deque from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値) from heapq import heapify, heappop, heappush from itertools import combinations, permutations, product from math import * sys.setrecursionlimit(10**6) INF = 10**20...
28
57
546
1,337
# D - String Formation from collections import deque S = eval(input()) Q = int(eval(input())) now = 1 tmp = [deque([]), deque([])] for _ in range(Q): t = list(input().split()) if t[0] == "1": now = 1 + (now == 1) else: if int(t[1]) == now: tmp[0].append(t[2]) else: ...
import sys from sys import exit from collections import deque from bisect import bisect_left, bisect_right, insort_left, insort_right # func(リスト,値) from heapq import heapify, heappop, heappush from itertools import combinations, permutations, product from math import * sys.setrecursionlimit(10**6) INF = 10**20 eps = ...
false
50.877193
[ "-# D - String Formation", "+import sys", "+from sys import exit", "+from bisect import bisect_left, bisect_right, insort_left, insort_right # func(リスト,値)", "+from heapq import heapify, heappop, heappush", "+from itertools import combinations, permutations, product", "+from math import *", "-S = eval...
false
0.037608
0.037713
0.997224
[ "s212377903", "s082030037" ]
u022979415
p03640
python
s885904843
s402916439
25
23
4,084
3,568
Accepted
Accepted
8
def main(): h, w = list(map(int, input().split())) n = int(eval(input())) a = [-1] + [int(x) for x in input().split()] for i in range(1, n + 1): a[i] += a[i - 1] answer = ["-1" for _ in range(w * h)] index = 0 for i in range(h * w): if not (a[index] < i <= a[index + ...
def main(): h, w = list(map(int, input().split())) n = int(eval(input())) a = [int(x) for x in input().split()] answer = [[0 for _ in range(w)] for _ in range(h)] dir = [[0, w, 1], [-1, -w - 1, -1]] count = 0 color = 1 for i in range(h): for j in range(dir[i % 2][0], dir...
22
22
606
598
def main(): h, w = list(map(int, input().split())) n = int(eval(input())) a = [-1] + [int(x) for x in input().split()] for i in range(1, n + 1): a[i] += a[i - 1] answer = ["-1" for _ in range(w * h)] index = 0 for i in range(h * w): if not (a[index] < i <= a[index + 1]): ...
def main(): h, w = list(map(int, input().split())) n = int(eval(input())) a = [int(x) for x in input().split()] answer = [[0 for _ in range(w)] for _ in range(h)] dir = [[0, w, 1], [-1, -w - 1, -1]] count = 0 color = 1 for i in range(h): for j in range(dir[i % 2][0], dir[i % 2][1...
false
0
[ "- a = [-1] + [int(x) for x in input().split()]", "- for i in range(1, n + 1):", "- a[i] += a[i - 1]", "- answer = [\"-1\" for _ in range(w * h)]", "- index = 0", "- for i in range(h * w):", "- if not (a[index] < i <= a[index + 1]):", "- index += 1", "- ...
false
0.042016
0.041226
1.01916
[ "s885904843", "s402916439" ]
u687766076
p03087
python
s387919505
s109774214
333
273
24,420
7,916
Accepted
Accepted
18.02
import sys n, q = list(map(int, sys.stdin.readline().split())) s = sys.stdin.readline() mlist = [0] * q for i in range(q): mlist[i] = list([int(i) for i in sys.stdin.readline().split()]) elist = [0] * (n+1) for i in range(n - 1): tmp = s[i:i+2] if 'AC' in tmp: elist[i + 2] = elist[...
import sys n, q = list(map(int, sys.stdin.readline().split())) s = sys.stdin.readline() elist = [0] * (n+1) for i in range(n - 1): elist[i + 2] = elist[i + 1] + (1 if 'AC' == s[i:i+2] else 0) for i in range(q): l, r = list(map(int, sys.stdin.readline().split())) print((elist[r] - elist[l]))
21
12
444
304
import sys n, q = list(map(int, sys.stdin.readline().split())) s = sys.stdin.readline() mlist = [0] * q for i in range(q): mlist[i] = list([int(i) for i in sys.stdin.readline().split()]) elist = [0] * (n + 1) for i in range(n - 1): tmp = s[i : i + 2] if "AC" in tmp: elist[i + 2] = elist[i + 1] + 1 ...
import sys n, q = list(map(int, sys.stdin.readline().split())) s = sys.stdin.readline() elist = [0] * (n + 1) for i in range(n - 1): elist[i + 2] = elist[i + 1] + (1 if "AC" == s[i : i + 2] else 0) for i in range(q): l, r = list(map(int, sys.stdin.readline().split())) print((elist[r] - elist[l]))
false
42.857143
[ "-mlist = [0] * q", "-for i in range(q):", "- mlist[i] = list([int(i) for i in sys.stdin.readline().split()])", "- tmp = s[i : i + 2]", "- if \"AC\" in tmp:", "- elist[i + 2] = elist[i + 1] + 1", "- else:", "- elist[i + 2] = elist[i + 1]", "+ elist[i + 2] = elist[i + 1] ...
false
0.049659
0.049453
1.004152
[ "s387919505", "s109774214" ]
u993622994
p03206
python
s675202167
s063961849
19
17
2,940
2,940
Accepted
Accepted
10.53
d = int(eval(input())) if d == 25: print('Christmas') elif d == 24: print('Christmas Eve') elif d == 23: print('Christmas Eve Eve') elif d == 22: print('Christmas Eve Eve Eve')
d = int(eval(input())) count = 25 if d == 25: print('Christmas') else: count -= d print(('Christmas' + ' Eve' * count))
9
8
194
131
d = int(eval(input())) if d == 25: print("Christmas") elif d == 24: print("Christmas Eve") elif d == 23: print("Christmas Eve Eve") elif d == 22: print("Christmas Eve Eve Eve")
d = int(eval(input())) count = 25 if d == 25: print("Christmas") else: count -= d print(("Christmas" + " Eve" * count))
false
11.111111
[ "+count = 25", "-elif d == 24:", "- print(\"Christmas Eve\")", "-elif d == 23:", "- print(\"Christmas Eve Eve\")", "-elif d == 22:", "- print(\"Christmas Eve Eve Eve\")", "+else:", "+ count -= d", "+ print((\"Christmas\" + \" Eve\" * count))" ]
false
0.067278
0.050429
1.334115
[ "s675202167", "s063961849" ]
u130900604
p03050
python
s182786000
s516788287
197
73
39,152
66,344
Accepted
Accepted
62.94
# N//m=N%m # (N-N%m)/m=N%m # N=(N%m)(m+1) n=int(eval(input())) def make_divisor(x): ret=[] for i in range(1,int(x**.5)+1): q,m=divmod(x,i) if m==0: ret.append(i) if i==q:continue ret.append(q) return ret ans=[] d=make_divisor(n) for ...
# N//m==N%m=k # N=k*m+k=k(m+1)=kM N=int(eval(input())) arr=[] for i in range(1,int(N**0.5)+1): if N%i==0: arr.append(N//i) if N//i!=i: arr.append(i) arr.sort() ans=0 for M in arr: m=M-1 if m==0:continue if N%m==N//m: ans+=m print(ans)
26
19
421
309
# N//m=N%m # (N-N%m)/m=N%m # N=(N%m)(m+1) n = int(eval(input())) def make_divisor(x): ret = [] for i in range(1, int(x**0.5) + 1): q, m = divmod(x, i) if m == 0: ret.append(i) if i == q: continue ret.append(q) return ret ans = [] d = ma...
# N//m==N%m=k # N=k*m+k=k(m+1)=kM N = int(eval(input())) arr = [] for i in range(1, int(N**0.5) + 1): if N % i == 0: arr.append(N // i) if N // i != i: arr.append(i) arr.sort() ans = 0 for M in arr: m = M - 1 if m == 0: continue if N % m == N // m: ans += m pr...
false
26.923077
[ "-# N//m=N%m", "-# (N-N%m)/m=N%m", "-# N=(N%m)(m+1)", "-n = int(eval(input()))", "-", "-", "-def make_divisor(x):", "- ret = []", "- for i in range(1, int(x**0.5) + 1):", "- q, m = divmod(x, i)", "- if m == 0:", "- ret.append(i)", "- if i == q:", "...
false
0.211574
0.177738
1.190369
[ "s182786000", "s516788287" ]
u905203728
p03293
python
s248491774
s661161192
20
17
3,316
2,940
Accepted
Accepted
15
from collections import deque s=list(eval(input())) s=deque(s) t=eval(input()) for i in range(len(s)): s.appendleft(s.pop()) if t=="".join(s): print("Yes") exit() print("No")
s=list(eval(input())) t=eval(input()) for i in range(len(s)): s.insert(0,s.pop()) word="".join(s) if word==t: print("Yes") exit() print("No")
10
9
195
165
from collections import deque s = list(eval(input())) s = deque(s) t = eval(input()) for i in range(len(s)): s.appendleft(s.pop()) if t == "".join(s): print("Yes") exit() print("No")
s = list(eval(input())) t = eval(input()) for i in range(len(s)): s.insert(0, s.pop()) word = "".join(s) if word == t: print("Yes") exit() print("No")
false
10
[ "-from collections import deque", "-", "-s = deque(s)", "- s.appendleft(s.pop())", "- if t == \"\".join(s):", "+ s.insert(0, s.pop())", "+ word = \"\".join(s)", "+ if word == t:" ]
false
0.041311
0.039171
1.054624
[ "s248491774", "s661161192" ]
u440566786
p02890
python
s591638125
s156802001
768
551
120,476
120,732
Accepted
Accepted
28.26
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.readline().rstrip() def resolve(): from collections import Counter n=int(eval(input())) A=list(Counter(list(map(int,input().split()))).values()) A.sort() m=len(A) S=[0]*(m+1) # cumulative...
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.readline().rstrip() def resolve(): from collections import Counter n=int(eval(input())) A=list(Counter(list(map(int,input().split()))).values()) A.sort() m=len(A) S=[0]*(m+1) # cumulative...
25
27
652
726
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.readline().rstrip() def resolve(): from collections import Counter n = int(eval(input())) A = list(Counter(list(map(int, input().split()))).values()) A.sort() m = len(A) S = [0] * (m + 1...
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.readline().rstrip() def resolve(): from collections import Counter n = int(eval(input())) A = list(Counter(list(map(int, input().split()))).values()) A.sort() m = len(A) S = [0] * (m + 1...
false
7.407407
[ "- i = m - 1", "+ i = m", "- i = bisect_left(A, p)", "+ while 1:", "+ if i <= 0 or A[i - 1] < p:", "+ break", "+ i -= 1", "- break", "+ break # p<0 or を書く必要はない" ]
false
0.046589
0.040284
1.156518
[ "s591638125", "s156802001" ]
u423966555
p03403
python
s441035327
s006548056
163
137
20,576
21,236
Accepted
Accepted
15.95
N = int(eval(input())) A = list(map(int, input().split())) B = [0] + A + [0] S = [0]*(N+2) for i in range(1, N+2): S[i] = S[i-1] + abs(B[i] - B[i-1]) max_s = S[-1] for i in range(1, N+1): ans = 0 ans += S[i-1] ans += abs(B[i-1]-B[i+1]) ans += max_s - S[i+1] print(ans)
N = int(eval(input())) A = list(map(int, input().split())) B = [0] + A + [0] diff_1 = [abs(B[i+1] - B[i]) for i in range(N+1)] diff_2 = [abs(B[i+2] - B[i]) for i in range(N)] ans = sum(diff_1) for i in range(N): tmp = ans + diff_2[i] - (diff_1[i] + diff_1[i+1]) print(tmp)
16
13
306
290
N = int(eval(input())) A = list(map(int, input().split())) B = [0] + A + [0] S = [0] * (N + 2) for i in range(1, N + 2): S[i] = S[i - 1] + abs(B[i] - B[i - 1]) max_s = S[-1] for i in range(1, N + 1): ans = 0 ans += S[i - 1] ans += abs(B[i - 1] - B[i + 1]) ans += max_s - S[i + 1] print(ans)
N = int(eval(input())) A = list(map(int, input().split())) B = [0] + A + [0] diff_1 = [abs(B[i + 1] - B[i]) for i in range(N + 1)] diff_2 = [abs(B[i + 2] - B[i]) for i in range(N)] ans = sum(diff_1) for i in range(N): tmp = ans + diff_2[i] - (diff_1[i] + diff_1[i + 1]) print(tmp)
false
18.75
[ "-S = [0] * (N + 2)", "-for i in range(1, N + 2):", "- S[i] = S[i - 1] + abs(B[i] - B[i - 1])", "-max_s = S[-1]", "-for i in range(1, N + 1):", "- ans = 0", "- ans += S[i - 1]", "- ans += abs(B[i - 1] - B[i + 1])", "- ans += max_s - S[i + 1]", "- print(ans)", "+diff_1 = [abs(B[...
false
0.045284
0.046051
0.983351
[ "s441035327", "s006548056" ]
u641406334
p03681
python
s350309657
s663272301
703
492
5,184
5,184
Accepted
Accepted
30.01
import math n, m = list(map(int,input().split())) mod = (10**9)+7 N = math.factorial(n) M = math.factorial(m) mul = 0 if abs(n-m)>1 else 2 if n==m else 1 print((N*M*mul%mod))
import math n, m = list(map(int,input().split())) mod = (10**9)+7 mul = 0 if abs(n-m)>1 else 2 if n==m else 1 a = min(n,m) A = math.factorial(a) B = A if mul==1: B*=max(n,m) print((A*B*mul%mod))
7
10
173
197
import math n, m = list(map(int, input().split())) mod = (10**9) + 7 N = math.factorial(n) M = math.factorial(m) mul = 0 if abs(n - m) > 1 else 2 if n == m else 1 print((N * M * mul % mod))
import math n, m = list(map(int, input().split())) mod = (10**9) + 7 mul = 0 if abs(n - m) > 1 else 2 if n == m else 1 a = min(n, m) A = math.factorial(a) B = A if mul == 1: B *= max(n, m) print((A * B * mul % mod))
false
30
[ "-N = math.factorial(n)", "-M = math.factorial(m)", "-print((N * M * mul % mod))", "+a = min(n, m)", "+A = math.factorial(a)", "+B = A", "+if mul == 1:", "+ B *= max(n, m)", "+print((A * B * mul % mod))" ]
false
0.046658
0.084836
0.549975
[ "s350309657", "s663272301" ]
u150984829
p02412
python
s659389133
s777094380
580
40
5,648
5,608
Accepted
Accepted
93.1
from itertools import combinations while True: n,m=list(map(int,input().split())) if n==m==0: break print((sum(1 for p in combinations(list(range(1,n+1)),3) if sum(p)==m)))
while 1: n,x=list(map(int,input().split())) if n+x==0:break print((len([1 for i in range(3,n+1)for j in range(2,x-i)if x-i-j<j<i])))
5
4
165
130
from itertools import combinations while True: n, m = list(map(int, input().split())) if n == m == 0: break print((sum(1 for p in combinations(list(range(1, n + 1)), 3) if sum(p) == m)))
while 1: n, x = list(map(int, input().split())) if n + x == 0: break print( ( len( [ 1 for i in range(3, n + 1) for j in range(2, x - i) if x - i - j < j < i ] ...
false
20
[ "-from itertools import combinations", "-", "-while True:", "- n, m = list(map(int, input().split()))", "- if n == m == 0:", "+while 1:", "+ n, x = list(map(int, input().split()))", "+ if n + x == 0:", "- print((sum(1 for p in combinations(list(range(1, n + 1)), 3) if sum(p) == m)))",...
false
0.042364
0.03316
1.277592
[ "s659389133", "s777094380" ]
u968166680
p02973
python
s685579840
s726490447
126
77
11,764
14,092
Accepted
Accepted
38.89
from sys import stdin, setrecursionlimit from bisect import bisect_right setrecursionlimit(10 ** 9) INF = 1 << 60 def input(): return stdin.readline().strip() def main(): N = int(eval(input())) A = tuple(int(eval(input())) for _ in range(N)) B = [-A[0]] for a in A[1:]: ...
import sys from bisect import bisect_right read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 def main(): N, *A = list(map(int, read().split())) A.reverse() dp = [A[0]] for a in A[1:]: if a >= dp[...
27
28
472
479
from sys import stdin, setrecursionlimit from bisect import bisect_right setrecursionlimit(10**9) INF = 1 << 60 def input(): return stdin.readline().strip() def main(): N = int(eval(input())) A = tuple(int(eval(input())) for _ in range(N)) B = [-A[0]] for a in A[1:]: if a <= -B[-1]: ...
import sys from bisect import bisect_right read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 def main(): N, *A = list(map(int, read().split())) A.reverse() dp = [A[0]] for a in A[1:]: if a >= dp[-1]: dp.a...
false
3.571429
[ "-from sys import stdin, setrecursionlimit", "+import sys", "-setrecursionlimit(10**9)", "+read = sys.stdin.read", "+readline = sys.stdin.readline", "+readlines = sys.stdin.readlines", "+sys.setrecursionlimit(10**9)", "-def input():", "- return stdin.readline().strip()", "-", "-", "- N =...
false
0.131975
0.102277
1.290362
[ "s685579840", "s726490447" ]
u788068140
p02615
python
s895332614
s907590918
229
124
33,032
31,408
Accepted
Accepted
45.85
import heapq N = 4 ARR = [2, 2, 1, 3] N = 7 ARR = [1, 1, 1, 1, 1, 1, 1] N = int(eval(input())) ARR = list(map(int,input().split())) def calculate(n,arr): arr = sorted(arr,reverse=True) arr = [-1 * ar for ar in arr] mmk = [] ans = 0 for i in range(n): if i == 0: ...
N = 4 ARR = [2, 2, 1, 3] N = 7 ARR = [1, 1, 1, 1, 1, 1, 1] N = int(eval(input())) ARR = list(map(int,input().split())) # 3 2 2 1 def calculate(n, arr): endIndex = 0 ans = 0 arr = sorted(arr, reverse=True) for i in range(n): if i == 0: ans += arr[i] ...
36
36
530
580
import heapq N = 4 ARR = [2, 2, 1, 3] N = 7 ARR = [1, 1, 1, 1, 1, 1, 1] N = int(eval(input())) ARR = list(map(int, input().split())) def calculate(n, arr): arr = sorted(arr, reverse=True) arr = [-1 * ar for ar in arr] mmk = [] ans = 0 for i in range(n): if i == 0: heapq.heappu...
N = 4 ARR = [2, 2, 1, 3] N = 7 ARR = [1, 1, 1, 1, 1, 1, 1] N = int(eval(input())) ARR = list(map(int, input().split())) # 3 2 2 1 def calculate(n, arr): endIndex = 0 ans = 0 arr = sorted(arr, reverse=True) for i in range(n): if i == 0: ans += arr[i] endIndex += 1 ...
false
0
[ "-import heapq", "-", "-", "-", "+# 3 2 2 1", "+ endIndex = 0", "+ ans = 0", "- arr = [-1 * ar for ar in arr]", "- mmk = []", "- ans = 0", "- heapq.heappush(mmk, arr[i])", "+ ans += arr[i]", "+ endIndex += 1", "- ans -= heapq.heappop(m...
false
0.037139
0.044279
0.838763
[ "s895332614", "s907590918" ]
u254871849
p02829
python
s976630616
s847925520
20
18
3,316
2,940
Accepted
Accepted
10
import sys a, b = list(map(int, sys.stdin.read().split())) def main(): ans = 6 - a - b return ans if __name__ == '__main__': ans = main() print(ans)
import sys a = set(map(int, sys.stdin.read().split())) def main(): for i in range(1, 4): if not i in a: print(i) return if __name__ == '__main__': main()
11
12
171
208
import sys a, b = list(map(int, sys.stdin.read().split())) def main(): ans = 6 - a - b return ans if __name__ == "__main__": ans = main() print(ans)
import sys a = set(map(int, sys.stdin.read().split())) def main(): for i in range(1, 4): if not i in a: print(i) return if __name__ == "__main__": main()
false
8.333333
[ "-a, b = list(map(int, sys.stdin.read().split()))", "+a = set(map(int, sys.stdin.read().split()))", "- ans = 6 - a - b", "- return ans", "+ for i in range(1, 4):", "+ if not i in a:", "+ print(i)", "+ return", "- ans = main()", "- print(ans)", "+ ma...
false
0.253052
0.048648
5.201687
[ "s976630616", "s847925520" ]
u118147328
p03807
python
s572436588
s592612889
58
45
14,108
14,108
Accepted
Accepted
22.41
N = int(eval(input())) A = list(map(int, input().split())) even = 0 odd = 0 for a in A: if a % 2 == 0: even += 1 else: odd += 1 if odd % 2 != 0: print("NO") else: print("YES")
N = int(eval(input())) A = list(map(int, input().split())) if sum(A) % 2: print("NO") else: print("YES")
16
7
219
113
N = int(eval(input())) A = list(map(int, input().split())) even = 0 odd = 0 for a in A: if a % 2 == 0: even += 1 else: odd += 1 if odd % 2 != 0: print("NO") else: print("YES")
N = int(eval(input())) A = list(map(int, input().split())) if sum(A) % 2: print("NO") else: print("YES")
false
56.25
[ "-even = 0", "-odd = 0", "-for a in A:", "- if a % 2 == 0:", "- even += 1", "- else:", "- odd += 1", "-if odd % 2 != 0:", "+if sum(A) % 2:" ]
false
0.041051
0.041702
0.984396
[ "s572436588", "s592612889" ]
u585482323
p03128
python
s649438597
s515515839
990
240
476,168
67,292
Accepted
Accepted
75.76
#!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS():return list(map(list, ...
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()] def I(): return int(sys.stdin.buffer.readline()) def LS...
117
52
2,454
1,266
#!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS(): return list(m...
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()] def I(): return int(sys.stdin.buffer.readline()) d...
false
55.555556
[ "-from collections import defaultdict", "-from collections import deque", "+from collections import defaultdict, deque", "+from itertools import permutations, accumulate", "-import random", "- return list(map(int, sys.stdin.readline().split()))", "+ return [int(x) for x in sys.stdin.buffer.readlin...
false
0.090456
0.274054
0.330067
[ "s649438597", "s515515839" ]
u562935282
p02862
python
s915341268
s338047759
330
123
118,924
3,064
Accepted
Accepted
62.73
def solve(): mod = 10 ** 9 + 7 x, y = list(map(int, input().split())) sum_ = x + y q, r = divmod(sum_, 3) if r != 0: return 0 a = (x * 2 - y) // 3 b = (y * 2 - x) // 3 if a < 0 or b < 0: return 0 def cmb(n, r): return (fact[n] * finv_...
def main(): mod = 10 ** 9 + 7 def choose(n, a, mod=mod): x, y = 1, 1 for i in range(a): x = x * (n - i) % mod y = y * (i + 1) % mod return x * pow(y, mod - 2, mod) % mod x, y = list(map(int, input().split())) q, r = divmod(x + y, 3) if ...
33
33
637
626
def solve(): mod = 10**9 + 7 x, y = list(map(int, input().split())) sum_ = x + y q, r = divmod(sum_, 3) if r != 0: return 0 a = (x * 2 - y) // 3 b = (y * 2 - x) // 3 if a < 0 or b < 0: return 0 def cmb(n, r): return (fact[n] * finv_t[r] * finv_t[n - r]) % mod...
def main(): mod = 10**9 + 7 def choose(n, a, mod=mod): x, y = 1, 1 for i in range(a): x = x * (n - i) % mod y = y * (i + 1) % mod return x * pow(y, mod - 2, mod) % mod x, y = list(map(int, input().split())) q, r = divmod(x + y, 3) if r != 0: ...
false
0
[ "-def solve():", "+def main():", "+", "+ def choose(n, a, mod=mod):", "+ x, y = 1, 1", "+ for i in range(a):", "+ x = x * (n - i) % mod", "+ y = y * (i + 1) % mod", "+ return x * pow(y, mod - 2, mod) % mod", "+", "- sum_ = x + y", "- q, r = d...
false
1.080694
0.071838
15.043391
[ "s915341268", "s338047759" ]
u018679195
p03448
python
s033512832
s961808682
61
35
3,060
2,568
Accepted
Accepted
42.62
coinA = int(eval(input())) coinB = int(eval(input())) coinC = int(eval(input())) want = int(eval(input())) ways = 0 i = 0 while i <= coinA: j = 0 while j <= coinB: k = 0 while k <= coinC: if i*500 + j*100 + k*50 == want: ways = ways + 1 k = k ...
a=int(input()) b=int(input()) c=int(input()) x=int(input()) op=0 for i in range(a+1): for j in range(b+1): for k in range(c+1): if 500*i+100*j+50*k==x: op=op+1 print(op)
17
12
347
210
coinA = int(eval(input())) coinB = int(eval(input())) coinC = int(eval(input())) want = int(eval(input())) ways = 0 i = 0 while i <= coinA: j = 0 while j <= coinB: k = 0 while k <= coinC: if i * 500 + j * 100 + k * 50 == want: ways = ways + 1 k = k + 1 ...
a = int(input()) b = int(input()) c = int(input()) x = int(input()) op = 0 for i in range(a + 1): for j in range(b + 1): for k in range(c + 1): if 500 * i + 100 * j + 50 * k == x: op = op + 1 print(op)
false
29.411765
[ "-coinA = int(eval(input()))", "-coinB = int(eval(input()))", "-coinC = int(eval(input()))", "-want = int(eval(input()))", "-ways = 0", "-i = 0", "-while i <= coinA:", "- j = 0", "- while j <= coinB:", "- k = 0", "- while k <= coinC:", "- if i * 500 + j * 100 + k...
false
0.24755
0.074962
3.302352
[ "s033512832", "s961808682" ]
u798803522
p02241
python
s383063200
s874278442
70
30
9,064
8,740
Accepted
Accepted
57.14
import heapq from collections import defaultdict v_num = int(eval(input())) edges = defaultdict(list) for i in range(v_num): data = [int(n) for n in input().split(" ")[1:]] for j in range(i + 1, v_num): if data[j] != -1: edges[i].append([data[j], j]) edges[j].append([dat...
import heapq from collections import defaultdict v_num = int(eval(input())) edges = defaultdict(list) for i in range(v_num): data = [int(n) for n in input().split(" ")[1:]] for j in range(i + 1, v_num): if data[j] != -1: edges[i].append([data[j], j]) edges[j].append([dat...
26
27
684
721
import heapq from collections import defaultdict v_num = int(eval(input())) edges = defaultdict(list) for i in range(v_num): data = [int(n) for n in input().split(" ")[1:]] for j in range(i + 1, v_num): if data[j] != -1: edges[i].append([data[j], j]) edges[j].append([data[j], i]...
import heapq from collections import defaultdict v_num = int(eval(input())) edges = defaultdict(list) for i in range(v_num): data = [int(n) for n in input().split(" ")[1:]] for j in range(i + 1, v_num): if data[j] != -1: edges[i].append([data[j], j]) edges[j].append([data[j], i]...
false
3.703704
[ "- heapq.heappush(queue, e)", "+ if e[1] not in visited:", "+ heapq.heappush(queue, e)" ]
false
0.046047
0.044146
1.043071
[ "s383063200", "s874278442" ]
u790710233
p03497
python
s794854586
s195771885
188
144
39,344
33,152
Accepted
Accepted
23.4
from collections import Counter n, k = list(map(int, input().split())) *a, = list(map(int, input().split())) c = Counter(a) kv = sorted(list(c.items()), key=lambda x: x[1], reverse=True) if n <= k: print((0)) else: ans = n for i in range(k): try: ans -= kv[i][1] e...
n, k = list(map(int, input().split())) A = list(map(int, input().split())) d = {} for a in A: if a in list(d.keys()): d[a] += 1 else: d[a] = 1 ls = sorted(d.values()) ans = 0 for v in ls[:len(ls)-k]: ans += v print(ans)
17
18
341
258
from collections import Counter n, k = list(map(int, input().split())) (*a,) = list(map(int, input().split())) c = Counter(a) kv = sorted(list(c.items()), key=lambda x: x[1], reverse=True) if n <= k: print((0)) else: ans = n for i in range(k): try: ans -= kv[i][1] except: ...
n, k = list(map(int, input().split())) A = list(map(int, input().split())) d = {} for a in A: if a in list(d.keys()): d[a] += 1 else: d[a] = 1 ls = sorted(d.values()) ans = 0 for v in ls[: len(ls) - k]: ans += v print(ans)
false
5.555556
[ "-from collections import Counter", "-", "-(*a,) = list(map(int, input().split()))", "-c = Counter(a)", "-kv = sorted(list(c.items()), key=lambda x: x[1], reverse=True)", "-if n <= k:", "- print((0))", "-else:", "- ans = n", "- for i in range(k):", "- try:", "- ans -...
false
0.067624
0.037037
1.82587
[ "s794854586", "s195771885" ]
u936985471
p03806
python
s975284021
s168167426
1,155
802
4,848
10,884
Accepted
Accepted
30.56
N,Ma,Mb=list(map(int,input().split())) INF=40*100+1 dp=[[INF for i in range(10*N+1)] for j in range(10*N+1)] dp[0][0]=0 ans=INF for p in range(N): a,b,c=list(map(int,input().split())) for i in range(len(dp)-1,-1,-1): for j in range(len(dp[i])-1,-1,-1): if dp[i][j]!=INF: dp[i+a][j+b]=min(...
# A,Bそれぞれの最大値は40 * 10である # dp[i][j] = Aがiグラム、Bがjグラム含まれた薬品の最小コスト import sys readline = sys.stdin.readline N,Ma,Mb = list(map(int,readline().split())) INF = 10 ** 10 dp = [[INF] * (401) for i in range(401)] dp[0][0] = 0 for _ in range(N): a,b,c = list(map(int,readline().split())) for i in range(len(dp...
18
32
461
731
N, Ma, Mb = list(map(int, input().split())) INF = 40 * 100 + 1 dp = [[INF for i in range(10 * N + 1)] for j in range(10 * N + 1)] dp[0][0] = 0 ans = INF for p in range(N): a, b, c = list(map(int, input().split())) for i in range(len(dp) - 1, -1, -1): for j in range(len(dp[i]) - 1, -1, -1): i...
# A,Bそれぞれの最大値は40 * 10である # dp[i][j] = Aがiグラム、Bがjグラム含まれた薬品の最小コスト import sys readline = sys.stdin.readline N, Ma, Mb = list(map(int, readline().split())) INF = 10**10 dp = [[INF] * (401) for i in range(401)] dp[0][0] = 0 for _ in range(N): a, b, c = list(map(int, readline().split())) for i in range(len(dp) - 1, ...
false
43.75
[ "-N, Ma, Mb = list(map(int, input().split()))", "-INF = 40 * 100 + 1", "-dp = [[INF for i in range(10 * N + 1)] for j in range(10 * N + 1)]", "+# A,Bそれぞれの最大値は40 * 10である", "+# dp[i][j] = Aがiグラム、Bがjグラム含まれた薬品の最小コスト", "+import sys", "+", "+readline = sys.stdin.readline", "+N, Ma, Mb = list(map(int, read...
false
0.077566
0.303961
0.255185
[ "s975284021", "s168167426" ]
u426534722
p02406
python
s946073871
s628471141
30
20
6,240
6,116
Accepted
Accepted
33.33
for i in range(1, int(input()) + 1): if i % 3 == 0 or "3" in list(str(i)): print("", i, end="") print("")
print(("", *(i for i in range(3, int(eval(input())) + 1) if i % 3 == 0 or "3" in str(i))))
4
1
121
83
for i in range(1, int(input()) + 1): if i % 3 == 0 or "3" in list(str(i)): print("", i, end="") print("")
print( ("", *(i for i in range(3, int(eval(input())) + 1) if i % 3 == 0 or "3" in str(i))) )
false
75
[ "-for i in range(1, int(input()) + 1):", "- if i % 3 == 0 or \"3\" in list(str(i)):", "- print(\"\", i, end=\"\")", "-print(\"\")", "+print(", "+ (\"\", *(i for i in range(3, int(eval(input())) + 1) if i % 3 == 0 or \"3\" in str(i)))", "+)" ]
false
0.069185
0.062234
1.111686
[ "s946073871", "s628471141" ]
u463655976
p03074
python
s785657484
s241342934
102
70
3,316
3,316
Accepted
Accepted
31.37
n, k = list(map(int, input().split())) s = input().rstrip() #n, k = 5, 3 #s = "00010" m = 0 cur_s = cur_e = 0 while True: while cur_e < n and s[cur_e] == '1': cur_e+=1 if k <= 0 or cur_e >= n: wm = cur_e - cur_s if wm > m: m = wm if cur_e >= n: break ...
n, k = list(map(int, input().split())) s = input().rstrip() #s = "0001111011110" #n, k = len(s), 1 s="1"+s k_pt = 0 cur_tail = 0 for cur in range(1, len(s)): cur_tail+=1 if s[cur-1] == '1' and s[cur] == '0': k_pt+=1 if k_pt <= k: cur_tail-=1 elif s[cur_tail] == '0' and s[cur_t...
34
22
539
365
n, k = list(map(int, input().split())) s = input().rstrip() # n, k = 5, 3 # s = "00010" m = 0 cur_s = cur_e = 0 while True: while cur_e < n and s[cur_e] == "1": cur_e += 1 if k <= 0 or cur_e >= n: wm = cur_e - cur_s if wm > m: m = wm if cur_e >= n: break ...
n, k = list(map(int, input().split())) s = input().rstrip() # s = "0001111011110" # n, k = len(s), 1 s = "1" + s k_pt = 0 cur_tail = 0 for cur in range(1, len(s)): cur_tail += 1 if s[cur - 1] == "1" and s[cur] == "0": k_pt += 1 if k_pt <= k: cur_tail -= 1 elif s[cur_tail] == "0" and s[cu...
false
35.294118
[ "-# n, k = 5, 3", "-# s = \"00010\"", "-m = 0", "-cur_s = cur_e = 0", "-while True:", "- while cur_e < n and s[cur_e] == \"1\":", "- cur_e += 1", "- if k <= 0 or cur_e >= n:", "- wm = cur_e - cur_s", "- if wm > m:", "- m = wm", "- if cur_e >= n:", ...
false
0.036182
0.042088
0.859683
[ "s785657484", "s241342934" ]
u334712262
p02883
python
s525700915
s126471536
1,995
649
106,952
106,952
Accepted
Accepted
67.47
# -*- coding: utf-8 -*- import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62-1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff_readline().spli...
# -*- coding: utf-8 -*- import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62-1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff_readline().spli...
132
132
2,377
2,377
# -*- coding: utf-8 -*- import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62 - 1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff_readline().split())) def r...
# -*- coding: utf-8 -*- import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62 - 1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff_readline().split())) def r...
false
0
[ "- return Bisect(f).bisect_left(1, 0, 10**19)", "+ return Bisect(f).bisect_left(1, 0, 10**18)" ]
false
0.038346
0.066149
0.579689
[ "s525700915", "s126471536" ]
u072053884
p02257
python
s020232736
s217739372
1,030
310
7,848
7,736
Accepted
Accepted
69.9
def is_prime(x): if x == 1: return 0 l = x ** 0.5 n = 2 while n <= l: if x % n == 0: return 0 n += 1 return 1 import sys def solve(): N = int(eval(input())) cnt = 0 for i in range(N): cnt += is_prime(int(eval(input()))) ...
def is_prime(x): if x == 2: return 1 elif x % 2 == 0: return 0 l = x ** 0.5 for i in range(3, int(x ** 0.5) + 1, 2): if x % i == 0: return 0 return 1 import sys def solve(): file_input = sys.stdin N = file_input.readline() cnt = 0 ...
21
22
329
402
def is_prime(x): if x == 1: return 0 l = x**0.5 n = 2 while n <= l: if x % n == 0: return 0 n += 1 return 1 import sys def solve(): N = int(eval(input())) cnt = 0 for i in range(N): cnt += is_prime(int(eval(input()))) print(cnt) solve...
def is_prime(x): if x == 2: return 1 elif x % 2 == 0: return 0 l = x**0.5 for i in range(3, int(x**0.5) + 1, 2): if x % i == 0: return 0 return 1 import sys def solve(): file_input = sys.stdin N = file_input.readline() cnt = 0 for l in file_inp...
false
4.545455
[ "- if x == 1:", "+ if x == 2:", "+ return 1", "+ elif x % 2 == 0:", "- n = 2", "- while n <= l:", "- if x % n == 0:", "+ for i in range(3, int(x**0.5) + 1, 2):", "+ if x % i == 0:", "- n += 1", "- N = int(eval(input()))", "+ file_input = sys....
false
0.053541
0.080822
0.662453
[ "s020232736", "s217739372" ]
u982591663
p02837
python
s275289712
s504953305
174
158
3,064
3,064
Accepted
Accepted
9.2
#ABC-147 #参考 https://atcoder.jp/contests/abc147/submissions/8896111 N = int(eval(input())) evidences = [[] for i in range(N)] for i in range(N): A = int(eval(input())) for _ in range(A): x, y = list(map(int, input().split())) evidences[i].append((x-1, y)) result = 0 for i in range(...
N = int(eval(input())) memo = [[] for _ in range(N)] ans = 0 for i in range(N): A = int(eval(input())) for _ in range(A): #配列が0始まりなので、xは-1して使用する x, y = list(map(int, input().split())) memo[i].append((x,y)) # print(memo) for i in range(2**N): # print(i)#test flag...
31
32
868
800
# ABC-147 # 参考 https://atcoder.jp/contests/abc147/submissions/8896111 N = int(eval(input())) evidences = [[] for i in range(N)] for i in range(N): A = int(eval(input())) for _ in range(A): x, y = list(map(int, input().split())) evidences[i].append((x - 1, y)) result = 0 for i in range(1, 2**N): ...
N = int(eval(input())) memo = [[] for _ in range(N)] ans = 0 for i in range(N): A = int(eval(input())) for _ in range(A): # 配列が0始まりなので、xは-1して使用する x, y = list(map(int, input().split())) memo[i].append((x, y)) # print(memo) for i in range(2**N): # print(i)#test flag = True for ...
false
3.125
[ "-# ABC-147", "-# 参考 https://atcoder.jp/contests/abc147/submissions/8896111", "-evidences = [[] for i in range(N)]", "+memo = [[] for _ in range(N)]", "+ans = 0", "+ # 配列が0始まりなので、xは-1して使用する", "- evidences[i].append((x - 1, y))", "-result = 0", "-for i in range(1, 2**N):", "- consi...
false
0.03623
0.034497
1.050235
[ "s275289712", "s504953305" ]
u016881126
p02989
python
s669202704
s111181845
87
77
14,396
14,428
Accepted
Accepted
11.49
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) N = int(eval(input())) D = list(map(int, input().split())) D.sort() num = N // 2 arc = 0 for _ in range(N): arc_first = D.pop() arc += 1 if arc ...
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) N = int(eval(input())) D = list(map(int, input().split())) D.sort() num = N // 2 ans = D[num] - D[num-1] print(ans)
26
13
467
270
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10**7) N = int(eval(input())) D = list(map(int, input().split())) D.sort() num = N // 2 arc = 0 for _ in range(N): arc_first = D.pop() arc += 1 if arc == num: br...
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10**7) N = int(eval(input())) D = list(map(int, input().split())) D.sort() num = N // 2 ans = D[num] - D[num - 1] print(ans)
false
50
[ "-arc = 0", "-for _ in range(N):", "- arc_first = D.pop()", "- arc += 1", "- if arc == num:", "- break", "-abc_last = D.pop()", "-if abc_last == arc_first:", "- # 同じ数にできない", "- ans = 0", "-else:", "- ans = arc_first - abc_last", "+ans = D[num] - D[num - 1]" ]
false
0.043324
0.044367
0.976508
[ "s669202704", "s111181845" ]
u399721252
p02846
python
s977552053
s465327655
191
17
38,384
3,064
Accepted
Accepted
91.1
t1, t2 = [ int(v) for v in input().split() ] a1, a2 = [ int(v) for v in input().split() ] b1, b2 = [ int(v) for v in input().split() ] t = t1 + t2 if a1*t1 + a2*t2 == b1*t1 + b2*t2: ans = -1 else: if a1 >= b1 and a2 >= b2: ans = 0 elif a1 <= b1 and a2 <= b2: ans = 0 else: ...
t1, t2 = [ int(v) for v in input().split() ] a1, a2 = [ int(v) for v in input().split() ] b1, b2 = [ int(v) for v in input().split() ] if a1*t1 + a2*t2 == b1*t1 + b2*t2: ans = -1 else: if a1*t1 + a2*t2 < b1*t1 + b2*t2: a1, b1 = b1, a1 a2, b2 = b2, a2 mind = a1*t1 - b1*t1 if...
29
23
783
607
t1, t2 = [int(v) for v in input().split()] a1, a2 = [int(v) for v in input().split()] b1, b2 = [int(v) for v in input().split()] t = t1 + t2 if a1 * t1 + a2 * t2 == b1 * t1 + b2 * t2: ans = -1 else: if a1 >= b1 and a2 >= b2: ans = 0 elif a1 <= b1 and a2 <= b2: ans = 0 else: if a1...
t1, t2 = [int(v) for v in input().split()] a1, a2 = [int(v) for v in input().split()] b1, b2 = [int(v) for v in input().split()] if a1 * t1 + a2 * t2 == b1 * t1 + b2 * t2: ans = -1 else: if a1 * t1 + a2 * t2 < b1 * t1 + b2 * t2: a1, b1 = b1, a1 a2, b2 = b2, a2 mind = a1 * t1 - b1 * t1 if...
false
20.689655
[ "-t = t1 + t2", "- if a1 >= b1 and a2 >= b2:", "- ans = 0", "- elif a1 <= b1 and a2 <= b2:", "+ if a1 * t1 + a2 * t2 < b1 * t1 + b2 * t2:", "+ a1, b1 = b1, a1", "+ a2, b2 = b2, a2", "+ mind = a1 * t1 - b1 * t1", "+ if mind > 0:", "- if a1 * t1 + a2 * t2 <...
false
0.087539
0.062602
1.398349
[ "s977552053", "s465327655" ]
u948524308
p02899
python
s636258481
s157183548
342
227
21,452
27,628
Accepted
Accepted
33.63
N=int(input()) A=list(map(int,input().split())) Alist=[] for i in range(N): Alist.append([A[i],i+1]) Alist.sort() for i in range(N): print(Alist[i][1],end=" ")
N=int(eval(input())) A=list(map(int,input().split())) Alist=[] for i in range(N): Alist.append([A[i],i+1]) Alist.sort() A=[Alist[i][1] for i in range(N)] print((" ".join(map(str,A))))
10
11
179
193
N = int(input()) A = list(map(int, input().split())) Alist = [] for i in range(N): Alist.append([A[i], i + 1]) Alist.sort() for i in range(N): print(Alist[i][1], end=" ")
N = int(eval(input())) A = list(map(int, input().split())) Alist = [] for i in range(N): Alist.append([A[i], i + 1]) Alist.sort() A = [Alist[i][1] for i in range(N)] print((" ".join(map(str, A))))
false
9.090909
[ "-N = int(input())", "+N = int(eval(input()))", "-for i in range(N):", "- print(Alist[i][1], end=\" \")", "+A = [Alist[i][1] for i in range(N)]", "+print((\" \".join(map(str, A))))" ]
false
0.046421
0.047182
0.983868
[ "s636258481", "s157183548" ]
u239981649
p03478
python
s770511804
s915996891
71
31
3,060
2,940
Accepted
Accepted
56.34
N, A, B = list(map(int, input().split())) m = 0 for n in range(1, N + 1): C = [] n1 = n for k in range(4, -1, -1): C.append(int(n1 / (10 ** k))) n1 -= C[4 - k] * (10 ** k) if A <= sum(C) <= B: m += n print(m)
n, a, b = list(map(int, input().split())) ans = 0 for k in range(1, n+1): if a <= sum(map(int, str(k))) <= b: ans += k print(ans)
11
7
261
143
N, A, B = list(map(int, input().split())) m = 0 for n in range(1, N + 1): C = [] n1 = n for k in range(4, -1, -1): C.append(int(n1 / (10**k))) n1 -= C[4 - k] * (10**k) if A <= sum(C) <= B: m += n print(m)
n, a, b = list(map(int, input().split())) ans = 0 for k in range(1, n + 1): if a <= sum(map(int, str(k))) <= b: ans += k print(ans)
false
36.363636
[ "-N, A, B = list(map(int, input().split()))", "-m = 0", "-for n in range(1, N + 1):", "- C = []", "- n1 = n", "- for k in range(4, -1, -1):", "- C.append(int(n1 / (10**k)))", "- n1 -= C[4 - k] * (10**k)", "- if A <= sum(C) <= B:", "- m += n", "-print(m)", "+n, ...
false
0.036409
0.057977
0.627983
[ "s770511804", "s915996891" ]
u941047297
p02603
python
s666281803
s979006368
33
25
9,232
9,200
Accepted
Accepted
24.24
def main(): n = int(eval(input())) A = list(map(int, input().split())) ans = 1000 t, p = [], [] if A[0] < A[1]: t.append(0) for i in range(1, n - 1): if A[i - 1] >= A[i] < A[i + 1]: t.append(i) elif A[i - 1] <= A[i] > A[i + 1]: p.append(...
def main(): n = int(eval(input())) A = list(map(int, input().split())) ans, b = 1000, 0 def buy(a): nonlocal b, ans b += ans // a ans %= a def sell(a): nonlocal b, ans ans += b * a b = 0 if A[0] < A[1]: buy(A[0]) for i in range(1, ...
27
26
596
584
def main(): n = int(eval(input())) A = list(map(int, input().split())) ans = 1000 t, p = [], [] if A[0] < A[1]: t.append(0) for i in range(1, n - 1): if A[i - 1] >= A[i] < A[i + 1]: t.append(i) elif A[i - 1] <= A[i] > A[i + 1]: p.append(i) b = ...
def main(): n = int(eval(input())) A = list(map(int, input().split())) ans, b = 1000, 0 def buy(a): nonlocal b, ans b += ans // a ans %= a def sell(a): nonlocal b, ans ans += b * a b = 0 if A[0] < A[1]: buy(A[0]) for i in range(1, n ...
false
3.703704
[ "- ans = 1000", "- t, p = [], []", "+ ans, b = 1000, 0", "+", "+ def buy(a):", "+ nonlocal b, ans", "+ b += ans // a", "+ ans %= a", "+", "+ def sell(a):", "+ nonlocal b, ans", "+ ans += b * a", "+ b = 0", "+", "- t.append(0...
false
0.040433
0.047652
0.848503
[ "s666281803", "s979006368" ]
u505420467
p03273
python
s126131098
s725445144
21
18
4,596
3,188
Accepted
Accepted
14.29
h,w=map(int,input().split()) a=[] for i in range(h): j=list(input()) if '#' in j: a.append(j) aa=zip(*[i for i in zip(*a) if '#' in i]) for i in aa: print(*i,sep='')
h,w=list(map(int,input().split())) a=[] for i in range(h): j=list(eval(input())) if '#' in j: a.append(j) aa=list(zip(*[i for i in zip(*a) if '#' in i])) for i in aa: print((''.join(i)))
9
9
194
195
h, w = map(int, input().split()) a = [] for i in range(h): j = list(input()) if "#" in j: a.append(j) aa = zip(*[i for i in zip(*a) if "#" in i]) for i in aa: print(*i, sep="")
h, w = list(map(int, input().split())) a = [] for i in range(h): j = list(eval(input())) if "#" in j: a.append(j) aa = list(zip(*[i for i in zip(*a) if "#" in i])) for i in aa: print(("".join(i)))
false
0
[ "-h, w = map(int, input().split())", "+h, w = list(map(int, input().split()))", "- j = list(input())", "+ j = list(eval(input()))", "-aa = zip(*[i for i in zip(*a) if \"#\" in i])", "+aa = list(zip(*[i for i in zip(*a) if \"#\" in i]))", "- print(*i, sep=\"\")", "+ print((\"\".join(i)))" ]
false
0.036691
0.037888
0.968409
[ "s126131098", "s725445144" ]
u970449052
p02694
python
s221028769
s201330723
24
22
9,164
9,164
Accepted
Accepted
8.33
X=int(eval(input())) t=100 ans=0 while t<X: ans+=1 t=int(t*1.01) print(ans)
X=int(eval(input())) t=100 ans=0 while t<X: ans+=1 t=t*101//100 print(ans)
7
7
83
82
X = int(eval(input())) t = 100 ans = 0 while t < X: ans += 1 t = int(t * 1.01) print(ans)
X = int(eval(input())) t = 100 ans = 0 while t < X: ans += 1 t = t * 101 // 100 print(ans)
false
0
[ "- t = int(t * 1.01)", "+ t = t * 101 // 100" ]
false
0.037094
0.035218
1.053285
[ "s221028769", "s201330723" ]
u537067968
p00774
python
s073277881
s449257809
170
120
6,336
6,448
Accepted
Accepted
29.41
from functools import lru_cache def DEBUG(*args): pass # print('@', *args) @lru_cache(maxsize=None) def pat(s, n): return ' '.join([s] * n) DEBUG(pat('1', 3)) def removeAll(xs, s): while s in xs: xs.remove(s) xs.append('#') return xs def lmap(f, s): return list...
from functools import lru_cache digits = list([str(x) for x in range(1,10)]) @lru_cache(maxsize=None) def check(s,n): return ' '.join([s]*n) def down(x): x = list(x[::-1]) while '0' in x: x.remove('0') x.append('#') return x def main(n): data = '\n'.join([ev...
56
41
1,418
1,101
from functools import lru_cache def DEBUG(*args): pass # print('@', *args) @lru_cache(maxsize=None) def pat(s, n): return " ".join([s] * n) DEBUG(pat("1", 3)) def removeAll(xs, s): while s in xs: xs.remove(s) xs.append("#") return xs def lmap(f, s): return list(map(f, s)) ...
from functools import lru_cache digits = list([str(x) for x in range(1, 10)]) @lru_cache(maxsize=None) def check(s, n): return " ".join([s] * n) def down(x): x = list(x[::-1]) while "0" in x: x.remove("0") x.append("#") return x def main(n): data = "\n".join([eval(input()) for...
false
26.785714
[ "-", "-def DEBUG(*args):", "- pass # print('@', *args)", "+digits = list([str(x) for x in range(1, 10)])", "-def pat(s, n):", "+def check(s, n):", "-DEBUG(pat(\"1\", 3))", "-", "-", "-def removeAll(xs, s):", "- while s in xs:", "- xs.remove(s)", "- xs.append(\"#\")", "...
false
0.035988
0.037841
0.951031
[ "s073277881", "s449257809" ]
u014333473
p03487
python
s743234593
s999847416
72
66
21,672
27,576
Accepted
Accepted
8.33
eval(input());a=list(map(int,input().split()));d={} for i in a: if i not in d: d[i]=1 else: d[i]+=1 print((sum([j if i>j else j-i for i,j in list(d.items())])))
from collections import Counter eval(input());a=Counter(list(map(int,input().split()))) print((sum(j if i>j else j-i for i,j in list(a.items()))))
5
3
154
128
eval(input()) a = list(map(int, input().split())) d = {} for i in a: if i not in d: d[i] = 1 else: d[i] += 1 print((sum([j if i > j else j - i for i, j in list(d.items())])))
from collections import Counter eval(input()) a = Counter(list(map(int, input().split()))) print((sum(j if i > j else j - i for i, j in list(a.items()))))
false
40
[ "+from collections import Counter", "+", "-a = list(map(int, input().split()))", "-d = {}", "-for i in a:", "- if i not in d:", "- d[i] = 1", "- else:", "- d[i] += 1", "-print((sum([j if i > j else j - i for i, j in list(d.items())])))", "+a = Counter(list(map(int, input().sp...
false
0.040867
0.077308
0.528623
[ "s743234593", "s999847416" ]
u179169725
p02723
python
s569365099
s830495800
62
21
3,444
3,316
Accepted
Accepted
66.13
import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline def read_ints(): return list(map(int, read().split())) def read_a_int(): return int(read()) def read_tuple(H): ''' H is number of rows ''' ret = [] for _ in range(H): ret.append(tuple(map(int...
import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate def read_ints(): return list(map(int, read().split())) def read_a_int(): return int(read()) def read_tuple(H): ''' H is number of rows ''' ret = [] for _ in range(H): ...
81
59
1,677
1,335
import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline def read_ints(): return list(map(int, read().split())) def read_a_int(): return int(read()) def read_tuple(H): """ H is number of rows """ ret = [] for _ in range(H): ret.append(tuple(map(int, read().split()))...
import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate def read_ints(): return list(map(int, read().split())) def read_a_int(): return int(read()) def read_tuple(H): """ H is number of rows """ ret = [] for _ in range(H): ret.append(tupl...
false
27.160494
[ "+ra = range", "+enu = enumerate", "-def read_col(H, n_cols):", "+def read_col(H):", "- n_cols is number of cols", "+ ex1)A,B=read_col(H) ex2) A,=read_col(H) #一列の場合", "- ret = [[] for _ in range(n_cols)]", "+ ret = []", "- tmp = list(map(int, read().split()))", "- for ...
false
0.035117
0.071354
0.492147
[ "s569365099", "s830495800" ]