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
u197300773
p03353
python
s852939029
s336479582
43
32
3,060
3,064
Accepted
Accepted
25.58
s=eval(input()) K=int(eval(input())) a=set() for x in "abcdefghijklmnopqrstuvwxyz": for i in range(len(s)): if s[i]==x: for j in range(K): if i+j+1>len(s): break a.add(s[i:i+j+1]) if len(a)>=K: break a=sorted(list(a)) print((a[K-1])...
s=eval(input()) K=int(eval(input())) a=set() for x in sorted(list(set(s))): for i in range(len(s)): if s[i]==x: for j in range(K): if i+j+1>len(s): break a.add(s[i:i+j+1]) if len(a)>=K: break a=sorted(list(a)) print((a[K-1]))
16
16
308
299
s = eval(input()) K = int(eval(input())) a = set() for x in "abcdefghijklmnopqrstuvwxyz": for i in range(len(s)): if s[i] == x: for j in range(K): if i + j + 1 > len(s): break a.add(s[i : i + j + 1]) if len(a) >= K: break a = sorted...
s = eval(input()) K = int(eval(input())) a = set() for x in sorted(list(set(s))): for i in range(len(s)): if s[i] == x: for j in range(K): if i + j + 1 > len(s): break a.add(s[i : i + j + 1]) if len(a) >= K: break a = sorted(list(a)...
false
0
[ "-for x in \"abcdefghijklmnopqrstuvwxyz\":", "+for x in sorted(list(set(s))):" ]
false
0.041711
0.042301
0.986053
[ "s852939029", "s336479582" ]
u118642796
p02936
python
s124302432
s523111580
899
816
133,060
134,264
Accepted
Accepted
9.23
import sys import heapq import bisect mod = 10**9+7 dd = ((-1,0),(1,0),(0,-1),(0,1)) def I(): return(int(sys.stdin.readline())) def LI(): return([int(x) for x in sys.stdin.readline().split()]) def S(): return(sys.stdin.readline()[:-1]) def IR(n): return([I() for _ in range(n)]) def GCD(a,b): while b...
import sys def I(): return(int(sys.stdin.readline())) def LI(): return([int(x) for x in sys.stdin.readline().split()]) def main(): N,Q = LI() node=[[] for _ in range(N)] flag = [True for _ in range(N)] for _ in range(N-1): a,b = LI() node[a-1].append(b-1) node[b-1]....
51
34
1,113
759
import sys import heapq import bisect mod = 10**9 + 7 dd = ((-1, 0), (1, 0), (0, -1), (0, 1)) def I(): return int(sys.stdin.readline()) def LI(): return [int(x) for x in sys.stdin.readline().split()] def S(): return sys.stdin.readline()[:-1] def IR(n): return [I() for _ in range(n)] def GCD(a...
import sys def I(): return int(sys.stdin.readline()) def LI(): return [int(x) for x in sys.stdin.readline().split()] def main(): N, Q = LI() node = [[] for _ in range(N)] flag = [True for _ in range(N)] for _ in range(N - 1): a, b = LI() node[a - 1].append(b - 1) no...
false
33.333333
[ "-import heapq", "-import bisect", "-", "-mod = 10**9 + 7", "-dd = ((-1, 0), (1, 0), (0, -1), (0, 1))", "-", "-", "-def S():", "- return sys.stdin.readline()[:-1]", "-", "-", "-def IR(n):", "- return [I() for _ in range(n)]", "-", "-", "-def GCD(a, b):", "- while b != 0:", ...
false
0.037712
0.037864
0.995977
[ "s124302432", "s523111580" ]
u073852194
p03167
python
s503291353
s309696043
271
120
53,980
83,556
Accepted
Accepted
55.72
H,W = list(map(int,input().split())) grid = [eval(input()) for i in range(H)] dp = [[0 for j in range(W)] for i in range(H)] for i in range(H): if grid[i][0] == '#': break dp[i][0] = 1 for j in range(W): if grid[0][j] == '#': break dp[0][j] = 1 for i in range(1,H): ...
MOD = 1000000007 H, W = list(map(int, input().split())) A = [eval(input()) for _ in range(H)] dp = [[0 for j in range(W)] for i in range(H)] dp[0][0] = 1 for i in range(1, H): if A[i][0] == '.': dp[i][0] = dp[i - 1][0] for j in range(1, W): if A[0][j] == '.': dp[0][j] = dp[0][j...
22
23
477
501
H, W = list(map(int, input().split())) grid = [eval(input()) for i in range(H)] dp = [[0 for j in range(W)] for i in range(H)] for i in range(H): if grid[i][0] == "#": break dp[i][0] = 1 for j in range(W): if grid[0][j] == "#": break dp[0][j] = 1 for i in range(1, H): for j in range(...
MOD = 1000000007 H, W = list(map(int, input().split())) A = [eval(input()) for _ in range(H)] dp = [[0 for j in range(W)] for i in range(H)] dp[0][0] = 1 for i in range(1, H): if A[i][0] == ".": dp[i][0] = dp[i - 1][0] for j in range(1, W): if A[0][j] == ".": dp[0][j] = dp[0][j - 1] for i in ran...
false
4.347826
[ "+MOD = 1000000007", "-grid = [eval(input()) for i in range(H)]", "+A = [eval(input()) for _ in range(H)]", "-for i in range(H):", "- if grid[i][0] == \"#\":", "- break", "- dp[i][0] = 1", "-for j in range(W):", "- if grid[0][j] == \"#\":", "- break", "- dp[0][j] = 1", ...
false
0.09951
0.093092
1.068943
[ "s503291353", "s309696043" ]
u426534722
p02248
python
s102506634
s082266474
1,880
1,290
7,516
117,776
Accepted
Accepted
31.38
t=eval(input()) p=eval(input()) l_t=len(t) l_p=len(p) for i in range(l_t-l_p+1): if t[i:i+l_p]==p: print(i)
t=eval(input()) p=eval(input()) l_t=len(t) l_p=len(p) ans = [] for i in range(l_t-l_p+1): if t[i:i+l_p]==p: ans.append(i) if ans: print(("\n".join(map(str, ans))))
7
10
114
175
t = eval(input()) p = eval(input()) l_t = len(t) l_p = len(p) for i in range(l_t - l_p + 1): if t[i : i + l_p] == p: print(i)
t = eval(input()) p = eval(input()) l_t = len(t) l_p = len(p) ans = [] for i in range(l_t - l_p + 1): if t[i : i + l_p] == p: ans.append(i) if ans: print(("\n".join(map(str, ans))))
false
30
[ "+ans = []", "- print(i)", "+ ans.append(i)", "+if ans:", "+ print((\"\\n\".join(map(str, ans))))" ]
false
0.050266
0.037938
1.324961
[ "s102506634", "s082266474" ]
u596276291
p03557
python
s758071398
s138769228
342
310
23,732
24,128
Accepted
Accepted
9.36
from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt from collections import deque from bisect import bisect, bisect_left, bisect_right INF = float("inf") def find_lt(a, x): i = bisect_left(a, x) if i: ...
from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt from collections import deque from bisect import bisect, bisect_left, bisect_right from string import ascii_lowercase from functools import lru_cache import sys sys.se...
38
39
840
975
from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt from collections import deque from bisect import bisect, bisect_left, bisect_right INF = float("inf") def find_lt(a, x): i = bisect_left(a, x) if i: return ...
from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt from collections import deque from bisect import bisect, bisect_left, bisect_right from string import ascii_lowercase from functools import lru_cache import sys sys.setrecurs...
false
2.564103
[ "+from string import ascii_lowercase", "+from functools import lru_cache", "+import sys", "+sys.setrecursionlimit(10000)", "+YES, Yes, yes, NO, No, no = \"YES\", \"Yes\", \"yes\", \"NO\", \"No\", \"no\"", "+dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]", "-def find_lt(a, x):", "- i = bisect_left(a, x)", ...
false
0.041364
0.041939
0.9863
[ "s758071398", "s138769228" ]
u075012704
p03994
python
s303565601
s192046580
71
61
3,444
3,444
Accepted
Accepted
14.08
S = eval(input()) K = int(eval(input())) Costs = {chr(98 + i): (25 - i) for i in range(25)} Costs['a'] = 0 alphabets = [chr(97 + i) for i in range(26)] ans = "" for i in range(len(S)): s = S[i] if K >= Costs[s]: K -= Costs[s] ans += 'a' else: ans += s ans = a...
S = eval(input()) K = int(eval(input())) ans = '' for s in S: to_a_cost = (26 - (ord(s) - 97)) % 26 if to_a_cost <= K: ans += 'a' K -= to_a_cost else: ans += s if K: K %= 26 ans = ans[:-1] + chr(97 + (((ord(ans[-1]) - 97) + K) % 26)) print(ans)
21
18
377
298
S = eval(input()) K = int(eval(input())) Costs = {chr(98 + i): (25 - i) for i in range(25)} Costs["a"] = 0 alphabets = [chr(97 + i) for i in range(26)] ans = "" for i in range(len(S)): s = S[i] if K >= Costs[s]: K -= Costs[s] ans += "a" else: ans += s ans = ans[:-1] + alphabets[(alph...
S = eval(input()) K = int(eval(input())) ans = "" for s in S: to_a_cost = (26 - (ord(s) - 97)) % 26 if to_a_cost <= K: ans += "a" K -= to_a_cost else: ans += s if K: K %= 26 ans = ans[:-1] + chr(97 + (((ord(ans[-1]) - 97) + K) % 26)) print(ans)
false
14.285714
[ "-Costs = {chr(98 + i): (25 - i) for i in range(25)}", "-Costs[\"a\"] = 0", "-alphabets = [chr(97 + i) for i in range(26)]", "-for i in range(len(S)):", "- s = S[i]", "- if K >= Costs[s]:", "- K -= Costs[s]", "+for s in S:", "+ to_a_cost = (26 - (ord(s) - 97)) % 26", "+ if to_a_...
false
0.047421
0.147393
0.321732
[ "s303565601", "s192046580" ]
u819910751
p02693
python
s716712933
s780234994
33
28
9,112
9,020
Accepted
Accepted
15.15
K = int(eval(input())) A, B = list(map(int, input().split())) if K == 1: print('OK') elif B - (B % K) >= A: print('OK') else: print('NG')
K = int(eval(input())) A, B = list(map(int, input().split())) if B - (B % K) >= A: print('OK') else: print('NG')
9
7
147
116
K = int(eval(input())) A, B = list(map(int, input().split())) if K == 1: print("OK") elif B - (B % K) >= A: print("OK") else: print("NG")
K = int(eval(input())) A, B = list(map(int, input().split())) if B - (B % K) >= A: print("OK") else: print("NG")
false
22.222222
[ "-if K == 1:", "- print(\"OK\")", "-elif B - (B % K) >= A:", "+if B - (B % K) >= A:" ]
false
0.041778
0.047015
0.888606
[ "s716712933", "s780234994" ]
u591808161
p03503
python
s013146232
s987052800
335
50
3,064
3,064
Accepted
Accepted
85.07
import itertools mylist = [0, 1] n = int(input().rstrip()) mise = [list(map(int, input().rstrip().split())) for i in range(n)] mine = [list(map(int, input().rstrip().split())) for i in range(n)] maxnum = - float('inf') for i in itertools.product(mylist, repeat = 10): if sum(i) == 0: continue ...
MAX_TIME = 10 n = int(input().rstrip()) #2進法を P = [sum(int(i) << MAX_TIME-k-1 for k, i in enumerate(input().rstrip().split())) for j in range(n)] S = [list(map(int, input().rstrip().split())) for i in range(n)] #予め2進数をカウントしておく # 予めビットをカウントしておく pattern = [sum(i >> j & 1 for j in range(MAX_TIME)) for i in rang...
20
17
554
522
import itertools mylist = [0, 1] n = int(input().rstrip()) mise = [list(map(int, input().rstrip().split())) for i in range(n)] mine = [list(map(int, input().rstrip().split())) for i in range(n)] maxnum = -float("inf") for i in itertools.product(mylist, repeat=10): if sum(i) == 0: continue sell = 0 ...
MAX_TIME = 10 n = int(input().rstrip()) # 2進法を P = [ sum(int(i) << MAX_TIME - k - 1 for k, i in enumerate(input().rstrip().split())) for j in range(n) ] S = [list(map(int, input().rstrip().split())) for i in range(n)] # 予め2進数をカウントしておく # 予めビットをカウントしておく pattern = [sum(i >> j & 1 for j in range(MAX_TIME)) for i in...
false
15
[ "-import itertools", "-", "-mylist = [0, 1]", "+MAX_TIME = 10", "-mise = [list(map(int, input().rstrip().split())) for i in range(n)]", "-mine = [list(map(int, input().rstrip().split())) for i in range(n)]", "-maxnum = -float(\"inf\")", "-for i in itertools.product(mylist, repeat=10):", "- if sum...
false
0.106097
0.052129
2.035281
[ "s013146232", "s987052800" ]
u130900604
p03476
python
s820024836
s570827464
1,998
1,844
17,144
24,556
Accepted
Accepted
7.71
import numpy as np def isprime(x): if x<=1:return False if x==2:return True for i in range(2,int(x**0.5)+1): if x%i==0:return False return True #リスト作成 prime=[isprime(i) for i in range(10**5+1)] def like2017(x): return (prime[x] and prime[(x+1)//2]) a=[like2017(i) for i in range(10**5+1)] ...
import numpy as np MAX_N=10**5 prime=np.full(MAX_N+1,True) prime[:2]=False #0,1をFalseにしてる for p in range(2,int(MAX_N**.5)+1): if prime[p]: prime[p*p::p]=False #p:素数の倍数をFalseに変える like2017=np.zeros(MAX_N+1,dtype=np.int64) for p in range(1,MAX_N+1): if 2*p>MAX_N: #(p+1)//2をpとよみかえると、pと2*p-1になる brea...
22
21
433
535
import numpy as np def isprime(x): if x <= 1: return False if x == 2: return True for i in range(2, int(x**0.5) + 1): if x % i == 0: return False return True # リスト作成 prime = [isprime(i) for i in range(10**5 + 1)] def like2017(x): return prime[x] and prime[(x...
import numpy as np MAX_N = 10**5 prime = np.full(MAX_N + 1, True) prime[:2] = False # 0,1をFalseにしてる for p in range(2, int(MAX_N**0.5) + 1): if prime[p]: prime[p * p :: p] = False # p:素数の倍数をFalseに変える like2017 = np.zeros(MAX_N + 1, dtype=np.int64) for p in range(1, MAX_N + 1): if 2 * p > MAX_N: # (p+1...
false
4.545455
[ "-", "-def isprime(x):", "- if x <= 1:", "- return False", "- if x == 2:", "- return True", "- for i in range(2, int(x**0.5) + 1):", "- if x % i == 0:", "- return False", "- return True", "-", "-", "-# リスト作成", "-prime = [isprime(i) for i in range...
false
0.701788
0.249475
2.813064
[ "s820024836", "s570827464" ]
u074220993
p03450
python
s698070977
s416647615
1,757
1,185
101,548
119,860
Accepted
Accepted
32.56
N, M = list(map(int, input().split())) LRD = [tuple(int(x) for x in input().split()) for _ in range(M)] Graph = [[] for _ in range(N)] for l,r,d in LRD: Graph[r-1].append((l-1,d)) Graph[l-1].append((r-1,-d)) seen = set() Dfr = [0] * N #dist from Root for root in range(N): if root in seen: continu...
from collections import namedtuple, deque class Person: def __init__(self, id, conn, x): self.id = id self.conn = conn self.x = x def main(): with open(0) as f: N, M = list(map(int, f.readline().split())) info = [tuple(map(int, line.split())) for line in f.re...
25
41
727
1,399
N, M = list(map(int, input().split())) LRD = [tuple(int(x) for x in input().split()) for _ in range(M)] Graph = [[] for _ in range(N)] for l, r, d in LRD: Graph[r - 1].append((l - 1, d)) Graph[l - 1].append((r - 1, -d)) seen = set() Dfr = [0] * N # dist from Root for root in range(N): if root in seen: ...
from collections import namedtuple, deque class Person: def __init__(self, id, conn, x): self.id = id self.conn = conn self.x = x def main(): with open(0) as f: N, M = list(map(int, f.readline().split())) info = [tuple(map(int, line.split())) for line in f.readlines()...
false
39.02439
[ "-N, M = list(map(int, input().split()))", "-LRD = [tuple(int(x) for x in input().split()) for _ in range(M)]", "-Graph = [[] for _ in range(N)]", "-for l, r, d in LRD:", "- Graph[r - 1].append((l - 1, d))", "- Graph[l - 1].append((r - 1, -d))", "-seen = set()", "-Dfr = [0] * N # dist from Root...
false
0.038898
0.070246
0.553745
[ "s698070977", "s416647615" ]
u119148115
p03108
python
s877328285
s141076221
376
347
104,748
98,984
Accepted
Accepted
7.71
import sys def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり N,M = LI() AB = [LI() for i in range(M)] del AB[0] AB.reverse() # 逆に橋がない状態から1本ずつ橋を加えた時に、不便さがどのくらい減少するかを考える class UnionFind: def __init__(self,n): self.par = [i for i in range(n+1)] # 親のノード番号 ...
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return 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 S(): r...
50
54
1,260
1,571
import sys def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり N, M = LI() AB = [LI() for i in range(M)] del AB[0] AB.reverse() # 逆に橋がない状態から1本ずつ橋を加えた時に、不便さがどのくらい減少するかを考える class UnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] # 親のノード番号 self.r...
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return 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(...
false
7.407407
[ "+", "+sys.setrecursionlimit(10**7)", "+", "+", "+def I():", "+ return int(sys.stdin.readline().rstrip())", "+", "+", "+def MI():", "+ return map(int, sys.stdin.readline().rstrip().split())", "-N, M = LI()", "-AB = [LI() for i in range(M)]", "-del AB[0]", "-AB.reverse()", "-# 逆に橋がな...
false
0.033592
0.036767
0.913635
[ "s877328285", "s141076221" ]
u488127128
p03076
python
s388479976
s218710741
19
17
3,060
2,940
Accepted
Accepted
10.53
import math total = 0 first_min = 10 for _ in range(5): time = int(eval(input())) total += math.ceil(time/10)*10 if first_min > time%10 > 0: first_min = time%10 print((total-10+first_min))
dishes = [int(eval(input())) for _ in range(5)] diffs = [-(-dish//10)*10 - dish for dish in dishes] print((sum(dishes) + sum(diffs) - max(diffs)))
9
3
208
140
import math total = 0 first_min = 10 for _ in range(5): time = int(eval(input())) total += math.ceil(time / 10) * 10 if first_min > time % 10 > 0: first_min = time % 10 print((total - 10 + first_min))
dishes = [int(eval(input())) for _ in range(5)] diffs = [-(-dish // 10) * 10 - dish for dish in dishes] print((sum(dishes) + sum(diffs) - max(diffs)))
false
66.666667
[ "-import math", "-", "-total = 0", "-first_min = 10", "-for _ in range(5):", "- time = int(eval(input()))", "- total += math.ceil(time / 10) * 10", "- if first_min > time % 10 > 0:", "- first_min = time % 10", "-print((total - 10 + first_min))", "+dishes = [int(eval(input())) for...
false
0.044789
0.050118
0.893679
[ "s388479976", "s218710741" ]
u926393759
p03855
python
s111284574
s194924135
1,093
728
36,204
36,204
Accepted
Accepted
33.39
def Find(x, par): if par[x] < 0: return x else: par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: if rank[x] < rank[y]: par[x] = y else: par[y] = x if rank[x] == rank[y]: rank[x] ...
import sys input = sys.stdin.readline def Find(x, par): if par[x] < 0: return x else: par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: if rank[x] < rank[y]: par[x] = y else: par[y] = x ...
55
55
963
973
def Find(x, par): if par[x] < 0: return x else: par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: if rank[x] < rank[y]: par[x] = y else: par[y] = x if rank[x]...
import sys input = sys.stdin.readline def Find(x, par): if par[x] < 0: return x else: par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: if rank[x] < rank[y]: par[x] = y else: ...
false
0
[ "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "-ans = \"\"", "-for j_ in range(n):", "- if j_ != 0:", "- ans += \" \"", "- ans += str(d[IDs[j_]])", "-print(ans)", "+ans = []", "+for j in range(n):", "+ ans.append(d[IDs[j]])", "+print((*ans))" ]
false
0.039482
0.039866
0.990375
[ "s111284574", "s194924135" ]
u078214750
p03494
python
s176619990
s522950920
31
28
9,036
9,228
Accepted
Accepted
9.68
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 while all(a%2 == 0 for a in A): A = [a/2 for a in A] ans += 1 print(ans)
N = int(eval(input())) A = list(map(int, input().split())) count = 0 while all([a%2 == 0 for a in A]): A = [a/2 for a in A] count += 1 print(count)
7
7
143
151
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 while all(a % 2 == 0 for a in A): A = [a / 2 for a in A] ans += 1 print(ans)
N = int(eval(input())) A = list(map(int, input().split())) count = 0 while all([a % 2 == 0 for a in A]): A = [a / 2 for a in A] count += 1 print(count)
false
0
[ "-ans = 0", "-while all(a % 2 == 0 for a in A):", "+count = 0", "+while all([a % 2 == 0 for a in A]):", "- ans += 1", "-print(ans)", "+ count += 1", "+print(count)" ]
false
0.036086
0.033753
1.069119
[ "s176619990", "s522950920" ]
u473113960
p02921
python
s727499213
s310146340
31
25
9,032
9,044
Accepted
Accepted
19.35
S = eval(input()) T = eval(input()) count = 0 for s,t in zip(S, T): if s == t: count += 1 print(count)
S = eval(input()) T = eval(input()) count = 0 if S[0] == T[0]: count += 1 if S[1] == T[1]: count += 1 if S[2] == T[2]: count += 1 print(count)
9
11
112
147
S = eval(input()) T = eval(input()) count = 0 for s, t in zip(S, T): if s == t: count += 1 print(count)
S = eval(input()) T = eval(input()) count = 0 if S[0] == T[0]: count += 1 if S[1] == T[1]: count += 1 if S[2] == T[2]: count += 1 print(count)
false
18.181818
[ "-for s, t in zip(S, T):", "- if s == t:", "- count += 1", "+if S[0] == T[0]:", "+ count += 1", "+if S[1] == T[1]:", "+ count += 1", "+if S[2] == T[2]:", "+ count += 1" ]
false
0.122453
0.12378
0.989281
[ "s727499213", "s310146340" ]
u408071652
p02711
python
s761265411
s947615204
60
21
61,788
9,120
Accepted
Accepted
65
n = list(eval(input())) if "7" in n: print("Yes") else: print("No")
S=int(eval(input())) result = 0 while S >0: S, m = divmod(S,10) if m ==7: result = 1 break if result ==1: print("Yes") else: print("No")
5
12
74
182
n = list(eval(input())) if "7" in n: print("Yes") else: print("No")
S = int(eval(input())) result = 0 while S > 0: S, m = divmod(S, 10) if m == 7: result = 1 break if result == 1: print("Yes") else: print("No")
false
58.333333
[ "-n = list(eval(input()))", "-if \"7\" in n:", "+S = int(eval(input()))", "+result = 0", "+while S > 0:", "+ S, m = divmod(S, 10)", "+ if m == 7:", "+ result = 1", "+ break", "+if result == 1:" ]
false
0.078066
0.049422
1.579579
[ "s761265411", "s947615204" ]
u532966492
p03222
python
s695398588
s169656284
28
19
3,940
3,192
Accepted
Accepted
32.14
H,W,K=list(map(int,input().split())) mod=10**9+7 fib=[1,1,2,3,5,8,13,21] from functools import lru_cache @lru_cache(maxsize=None) def dfs(cur,now): if cur==H: if now==K: return 1 else: return 0 elif now==1: if W==1: return dfs(cur+1,1)...
H,W,K=list(map(int,input().split())) mod=10**9+7 fib=[1,1,2,3,5,8,13,21] memo=[[None]*W for _ in range(H+1)] def dfs(cur,now): if cur==H: if now==K: return 1 else: return 0 elif now==1: if W==1: if memo[cur+1][0]==None: mem...
24
37
662
1,365
H, W, K = list(map(int, input().split())) mod = 10**9 + 7 fib = [1, 1, 2, 3, 5, 8, 13, 21] from functools import lru_cache @lru_cache(maxsize=None) def dfs(cur, now): if cur == H: if now == K: return 1 else: return 0 elif now == 1: if W == 1: return ...
H, W, K = list(map(int, input().split())) mod = 10**9 + 7 fib = [1, 1, 2, 3, 5, 8, 13, 21] memo = [[None] * W for _ in range(H + 1)] def dfs(cur, now): if cur == H: if now == K: return 1 else: return 0 elif now == 1: if W == 1: if memo[cur + 1][0] ==...
false
35.135135
[ "-from functools import lru_cache", "+memo = [[None] * W for _ in range(H + 1)]", "-@lru_cache(maxsize=None)", "- return dfs(cur + 1, 1) % mod", "+ if memo[cur + 1][0] == None:", "+ memo[cur + 1][0] = dfs(cur + 1, 1) % mod", "+ return memo[cur + 1][0]", ...
false
0.112883
0.075817
1.488885
[ "s695398588", "s169656284" ]
u936985471
p03557
python
s477261026
s482540176
1,024
333
24,008
23,200
Accepted
Accepted
67.48
N=list(map(int,input().split())) A=sorted(list(map(int,input().split()))) B=list(map(int,input().split())) C=sorted(list(map(int,input().split()))) def countA(target,L): ok=-1 ng=len(L) while abs(ok-ng)>1: mid=(ok+ng)//2 if L[mid]<target: ok=mid else: ng=mid return (ok+1) ...
N=int(eval(input())) A=sorted(list(map(int,input().split()))) B=sorted(list(map(int,input().split()))) C=sorted(list(map(int,input().split()))) # Bの値を決める # Bより小さいAを二分探索、Bより大きいAを二分探索、その積を各Bごとに求めて足していく import bisect ans=0 for i in range(len(B)): apos=bisect.bisect_left(A,B[i]) cpos=bisect.bisect_right(C...
33
15
589
356
N = list(map(int, input().split())) A = sorted(list(map(int, input().split()))) B = list(map(int, input().split())) C = sorted(list(map(int, input().split()))) def countA(target, L): ok = -1 ng = len(L) while abs(ok - ng) > 1: mid = (ok + ng) // 2 if L[mid] < target: ok = mid ...
N = int(eval(input())) A = sorted(list(map(int, input().split()))) B = sorted(list(map(int, input().split()))) C = sorted(list(map(int, input().split()))) # Bの値を決める # Bより小さいAを二分探索、Bより大きいAを二分探索、その積を各Bごとに求めて足していく import bisect ans = 0 for i in range(len(B)): apos = bisect.bisect_left(A, B[i]) cpos = bisect.bisec...
false
54.545455
[ "-N = list(map(int, input().split()))", "+N = int(eval(input()))", "-B = list(map(int, input().split()))", "+B = sorted(list(map(int, input().split())))", "-", "-", "-def countA(target, L):", "- ok = -1", "- ng = len(L)", "- while abs(ok - ng) > 1:", "- mid = (ok + ng) // 2", "...
false
0.043443
0.043406
1.000855
[ "s477261026", "s482540176" ]
u606045429
p03085
python
s730117388
s312841406
20
17
2,940
2,940
Accepted
Accepted
15
print(({'A' : 'T', 'T' : 'A', 'C' : 'G', 'G' : 'C'}[eval(input())]))
print(("ATCG"["TAGC".find(eval(input()))]))
1
1
60
35
print(({"A": "T", "T": "A", "C": "G", "G": "C"}[eval(input())]))
print(("ATCG"["TAGC".find(eval(input()))]))
false
0
[ "-print(({\"A\": \"T\", \"T\": \"A\", \"C\": \"G\", \"G\": \"C\"}[eval(input())]))", "+print((\"ATCG\"[\"TAGC\".find(eval(input()))]))" ]
false
0.04498
0.044348
1.014263
[ "s730117388", "s312841406" ]
u243312682
p02572
python
s918317487
s157950679
160
142
31,596
31,620
Accepted
Accepted
11.25
def main(): n = int(eval(input())) A = [int(x) for x in input().split()] mod = 10**9+7 a_sum = sum(A) a_cum = [0] * (n+1) for i in range(n): a_cum[i + 1] = a_cum[i] + A[i] ans = 0 for i in range(len(A)-1): ans += A[i] * (a_sum - a_cum[i+1]) % mod ans %=...
def main(): n = int(eval(input())) A = [int(x) for x in input().split()] mod = 10**9+7 # a_sum = sum(A) a_cum = [0] * (n+1) for i in range(n): a_cum[i + 1] = a_cum[i] + A[i] ans = 0 for i in range(len(A)-1): ans += A[i] * (a_cum[n] - a_cum[i+1]) ans %= mod ...
16
16
376
372
def main(): n = int(eval(input())) A = [int(x) for x in input().split()] mod = 10**9 + 7 a_sum = sum(A) a_cum = [0] * (n + 1) for i in range(n): a_cum[i + 1] = a_cum[i] + A[i] ans = 0 for i in range(len(A) - 1): ans += A[i] * (a_sum - a_cum[i + 1]) % mod ans %= mo...
def main(): n = int(eval(input())) A = [int(x) for x in input().split()] mod = 10**9 + 7 # a_sum = sum(A) a_cum = [0] * (n + 1) for i in range(n): a_cum[i + 1] = a_cum[i] + A[i] ans = 0 for i in range(len(A) - 1): ans += A[i] * (a_cum[n] - a_cum[i + 1]) ans %= mod ...
false
0
[ "- a_sum = sum(A)", "+ # a_sum = sum(A)", "- ans += A[i] * (a_sum - a_cum[i + 1]) % mod", "- ans %= mod", "+ ans += A[i] * (a_cum[n] - a_cum[i + 1])", "+ ans %= mod" ]
false
0.045063
0.111513
0.404105
[ "s918317487", "s157950679" ]
u894114233
p02315
python
s317426825
s287117414
750
440
6,880
6,568
Accepted
Accepted
41.33
n,w=list(map(int,input().split())) vw=[list(map(int,input().split())) for _ in range(n)] dp=[[0]*(w+1) for _ in range(2)] for i in range(n): for j in range(w+1): if j<vw[i][1]: dp[(i+1)&1][j]=dp[i&1][j] else: dp[(i+1)&1][j]=max(dp[i&1][j],dp[i&1][j-vw[i][1]]+vw[i][0])...
n,w=list(map(int,input().split())) vw=[list(map(int,input().split())) for _ in range(n)] dp=[0]*(w+1) for i in range(n): for j in range(w,vw[i][1]-1,-1): dp[j]=max(dp[j],dp[j-vw[i][1]]+vw[i][0]) print((dp[w]))
10
7
339
224
n, w = list(map(int, input().split())) vw = [list(map(int, input().split())) for _ in range(n)] dp = [[0] * (w + 1) for _ in range(2)] for i in range(n): for j in range(w + 1): if j < vw[i][1]: dp[(i + 1) & 1][j] = dp[i & 1][j] else: dp[(i + 1) & 1][j] = max(dp[i & 1][j], dp[...
n, w = list(map(int, input().split())) vw = [list(map(int, input().split())) for _ in range(n)] dp = [0] * (w + 1) for i in range(n): for j in range(w, vw[i][1] - 1, -1): dp[j] = max(dp[j], dp[j - vw[i][1]] + vw[i][0]) print((dp[w]))
false
30
[ "-dp = [[0] * (w + 1) for _ in range(2)]", "+dp = [0] * (w + 1)", "- for j in range(w + 1):", "- if j < vw[i][1]:", "- dp[(i + 1) & 1][j] = dp[i & 1][j]", "- else:", "- dp[(i + 1) & 1][j] = max(dp[i & 1][j], dp[i & 1][j - vw[i][1]] + vw[i][0])", "-print((dp[n & 1...
false
0.041322
0.038782
1.065503
[ "s317426825", "s287117414" ]
u388927326
p03837
python
s130996964
s388591701
276
79
12,524
3,568
Accepted
Accepted
71.38
#!/usr/bin/env python3 from heapq import heappush, heappop import numpy as np HUGE = 10 ** 15 def main(): n, m = list(map(int, input().split())) dist_mat = [[HUGE for j in range(n)] for i in range(n)] for i in range(m): a1, b1, c = list(map(int, input().split())) dist_mat[a1 -...
#!/usr/bin/env python3 from heapq import heappush, heappop HUGE = 10 ** 15 def main(): n, m = list(map(int, input().split())) dist_sets = [{} for i in range(n)] for i in range(m): a1, b1, c = list(map(int, input().split())) dist_sets[a1 - 1][b1 - 1] = c dist_sets[b1 - ...
44
43
1,460
1,393
#!/usr/bin/env python3 from heapq import heappush, heappop import numpy as np HUGE = 10**15 def main(): n, m = list(map(int, input().split())) dist_mat = [[HUGE for j in range(n)] for i in range(n)] for i in range(m): a1, b1, c = list(map(int, input().split())) dist_mat[a1 - 1][b1 - 1] = ...
#!/usr/bin/env python3 from heapq import heappush, heappop HUGE = 10**15 def main(): n, m = list(map(int, input().split())) dist_sets = [{} for i in range(n)] for i in range(m): a1, b1, c = list(map(int, input().split())) dist_sets[a1 - 1][b1 - 1] = c dist_sets[b1 - 1][a1 - 1] = c...
false
2.272727
[ "-import numpy as np", "- dist_mat = [[HUGE for j in range(n)] for i in range(n)]", "+ dist_sets = [{} for i in range(n)]", "- dist_mat[a1 - 1][b1 - 1] = c", "- dist_mat[b1 - 1][a1 - 1] = c", "- shortest_path_mat = [dijkstra(i, dist_mat) for i in range(n)]", "+ dist_sets[a1...
false
0.060094
0.147862
0.406419
[ "s130996964", "s388591701" ]
u803617136
p02988
python
s089987932
s274153155
167
18
38,384
3,060
Accepted
Accepted
89.22
N = int(eval(input())) p = list(map(int, input().split())) cnt = 0 for i in range(1, N - 1): if p[i] > p[i -1] and p[i] < p[i + 1]: cnt += 1 elif p[i] < p[i - 1] and p[i] > p[i + 1]: cnt += 1 print(cnt)
n = int(eval(input())) p = list(map(int, input().split())) ans = 0 for i in range(1, n - 1): if p[i - 1] > p[i] and p[i] > p[i + 1]: ans += 1 if p[i - 1] < p[i] and p[i] < p[i + 1]: ans += 1 print(ans)
11
10
233
233
N = int(eval(input())) p = list(map(int, input().split())) cnt = 0 for i in range(1, N - 1): if p[i] > p[i - 1] and p[i] < p[i + 1]: cnt += 1 elif p[i] < p[i - 1] and p[i] > p[i + 1]: cnt += 1 print(cnt)
n = int(eval(input())) p = list(map(int, input().split())) ans = 0 for i in range(1, n - 1): if p[i - 1] > p[i] and p[i] > p[i + 1]: ans += 1 if p[i - 1] < p[i] and p[i] < p[i + 1]: ans += 1 print(ans)
false
9.090909
[ "-N = int(eval(input()))", "+n = int(eval(input()))", "-cnt = 0", "-for i in range(1, N - 1):", "- if p[i] > p[i - 1] and p[i] < p[i + 1]:", "- cnt += 1", "- elif p[i] < p[i - 1] and p[i] > p[i + 1]:", "- cnt += 1", "-print(cnt)", "+ans = 0", "+for i in range(1, n - 1):", "...
false
0.04161
0.034579
1.203321
[ "s089987932", "s274153155" ]
u506858457
p03162
python
s184037486
s201204925
971
642
47,344
47,392
Accepted
Accepted
33.88
N = int(eval(input())) X=[list(map(int,input().split())) for i in range(N)] #print(X) dp = [[0] * 3 for _ 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][j] = max(dp[i + 1][j], dp[i][k] + X[i][j]) ans=0 for j in range(3): ans=m...
N=int(eval(input())) L = [list(map(int, input().split())) for i in range(N)] dp=[[0 for j in range(3)] for i in range(N)] ans=[0]*(N+1) for i in range(N): if i==0: dp[i][0]=L[i][0] dp[i][1]=L[i][1] dp[i][2]=L[i][2] else: dp[i][0]=max(dp[i-1][1],dp[i-1][2])+L[i][0] dp[i][1]=max(dp[i-1]...
14
16
342
452
N = int(eval(input())) X = [list(map(int, input().split())) for i in range(N)] # print(X) dp = [[0] * 3 for _ 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][j] = max(dp[i + 1][j], dp[i][k] + X[i][j]) ans = 0 for...
N = int(eval(input())) L = [list(map(int, input().split())) for i in range(N)] dp = [[0 for j in range(3)] for i in range(N)] ans = [0] * (N + 1) for i in range(N): if i == 0: dp[i][0] = L[i][0] dp[i][1] = L[i][1] dp[i][2] = L[i][2] else: dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]...
false
12.5
[ "-X = [list(map(int, input().split())) for i in range(N)]", "-# print(X)", "-dp = [[0] * 3 for _ in range(N + 1)]", "+L = [list(map(int, input().split())) for i in range(N)]", "+dp = [[0 for j in range(3)] for i in range(N)]", "+ans = [0] * (N + 1)", "- for j in range(3):", "- for k in range...
false
0.036205
0.038127
0.94961
[ "s184037486", "s201204925" ]
u852690916
p03325
python
s057810128
s313463914
73
41
4,148
4,148
Accepted
Accepted
43.84
N = int(eval(input())) A = list(map(int, input().split())) e = 0 for a in A: while a&1 == 0: e += 1 a >>= 1 print(e)
N = int(eval(input())) A = list(map(int, input().split())) e = 0 for a in A: l = 0 over = a.bit_length() while over - l > 1: m = (l+over) // 2 if a % (1<<m) == 0: l = m else: over = m e += l print(e)
9
13
139
246
N = int(eval(input())) A = list(map(int, input().split())) e = 0 for a in A: while a & 1 == 0: e += 1 a >>= 1 print(e)
N = int(eval(input())) A = list(map(int, input().split())) e = 0 for a in A: l = 0 over = a.bit_length() while over - l > 1: m = (l + over) // 2 if a % (1 << m) == 0: l = m else: over = m e += l print(e)
false
30.769231
[ "- while a & 1 == 0:", "- e += 1", "- a >>= 1", "+ l = 0", "+ over = a.bit_length()", "+ while over - l > 1:", "+ m = (l + over) // 2", "+ if a % (1 << m) == 0:", "+ l = m", "+ else:", "+ over = m", "+ e += l" ]
false
0.08723
0.127385
0.684776
[ "s057810128", "s313463914" ]
u978313283
p03162
python
s507445586
s409731907
806
658
56,468
76,248
Accepted
Accepted
18.36
import numpy as np N=int(eval(input())) ABC=[] for i in range(N): ABC.append(list(map(int,input().split()))) dp=[[0,0,0] for i in range(N)] dp[0]=ABC[0] for i in range(1,N): for j in range(3): dp[i][j]=max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+ABC[i][j] print((max(dp[N-1])))
N=int(eval(input())) ABC=[] for i in range(N): ABC.append(list(map(int,input().split()))) Happy=[[0,0,0] for i in range(N)] Happy[0]=ABC[0] for i in range(1,N): for j in range(3): if j==0: Happy[i][j]=max(Happy[i-1][1],Happy[i-1][2])+ABC[i][j] if j==1: Happy[i]...
11
15
290
470
import numpy as np N = int(eval(input())) ABC = [] for i in range(N): ABC.append(list(map(int, input().split()))) dp = [[0, 0, 0] for i in range(N)] dp[0] = ABC[0] for i in range(1, N): for j in range(3): dp[i][j] = max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]) + ABC[i][j] print((max(dp[N - 1])))...
N = int(eval(input())) ABC = [] for i in range(N): ABC.append(list(map(int, input().split()))) Happy = [[0, 0, 0] for i in range(N)] Happy[0] = ABC[0] for i in range(1, N): for j in range(3): if j == 0: Happy[i][j] = max(Happy[i - 1][1], Happy[i - 1][2]) + ABC[i][j] if j == 1: ...
false
26.666667
[ "-import numpy as np", "-", "-dp = [[0, 0, 0] for i in range(N)]", "-dp[0] = ABC[0]", "+Happy = [[0, 0, 0] for i in range(N)]", "+Happy[0] = ABC[0]", "- dp[i][j] = max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]) + ABC[i][j]", "-print((max(dp[N - 1])))", "+ if j == 0:", "+ ...
false
0.048213
0.037934
1.270974
[ "s507445586", "s409731907" ]
u054514819
p03108
python
s892431191
s084565064
642
346
34,656
97,400
Accepted
Accepted
46.11
import sys input = sys.stdin.readline sys.setrecursionlimit(10**5) N, M = list(map(int, input().split())) AB = [list([int(x)-1 for x in input().split()]) for _ in range(M)][::-1] class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): ...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N, M = mapint() class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x]...
58
66
1,387
1,615
import sys input = sys.stdin.readline sys.setrecursionlimit(10**5) N, M = list(map(int, input().split())) AB = [list([int(x) - 1 for x in input().split()]) for _ in range(M)][::-1] class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.p...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N, M = mapint() class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] ...
false
12.121212
[ "-input = sys.stdin.readline", "-sys.setrecursionlimit(10**5)", "-N, M = list(map(int, input().split()))", "-AB = [list([int(x) - 1 for x in input().split()]) for _ in range(M)][::-1]", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "+def mapint():", "+ return lis...
false
0.085437
0.007282
11.732868
[ "s892431191", "s084565064" ]
u088552457
p03761
python
s576948765
s823414131
22
20
3,316
3,064
Accepted
Accepted
9.09
import collections n = int(eval(input())) s = [eval(input()) for i in range(n)] if n == 1: print(("".join(sorted(s[0])))) else: c = [] for i in s: c.append(collections.Counter(i)) a = c[0] for i in range(1, n): a &= c[i] ans = [] a = a.most_common() ...
n = int(eval(input())) ss = [] mins = 'a'*100 for _ in range(n): s = str(''.join(sorted(eval(input())))) ss.append(s) if len(mins) > len(s): mins = s ans = '' for w in mins: ok = True for i, s in enumerate(ss[:]): if w in s: wi = s.find(w) ss[i] = s[:wi] + s[wi+1:] ...
20
22
411
368
import collections n = int(eval(input())) s = [eval(input()) for i in range(n)] if n == 1: print(("".join(sorted(s[0])))) else: c = [] for i in s: c.append(collections.Counter(i)) a = c[0] for i in range(1, n): a &= c[i] ans = [] a = a.most_common() for i in a: f...
n = int(eval(input())) ss = [] mins = "a" * 100 for _ in range(n): s = str("".join(sorted(eval(input())))) ss.append(s) if len(mins) > len(s): mins = s ans = "" for w in mins: ok = True for i, s in enumerate(ss[:]): if w in s: wi = s.find(w) ss[i] = s[:wi] + s...
false
9.090909
[ "-import collections", "-", "-s = [eval(input()) for i in range(n)]", "-if n == 1:", "- print((\"\".join(sorted(s[0]))))", "-else:", "- c = []", "- for i in s:", "- c.append(collections.Counter(i))", "- a = c[0]", "- for i in range(1, n):", "- a &= c[i]", "- a...
false
0.048362
0.116525
0.415039
[ "s576948765", "s823414131" ]
u969850098
p02695
python
s345334554
s606259123
1,098
534
37,288
9,212
Accepted
Accepted
51.37
import sys readline = sys.stdin.readline from collections import deque def main(): N, M, Q = list(map(int, readline().rstrip().split())) P = [tuple(map(int, readline().rstrip().split())) for _ in range(Q)] ans = 0 l = [[i] for i in range(1, M+1)] que = deque(l) for i in range(N): ...
import sys readline = sys.stdin.readline from itertools import combinations_with_replacement def main(): N, M, Q = list(map(int, readline().rstrip().split())) P = [tuple(map(int, readline().rstrip().split())) for _ in range(Q)] ans = 0 for pair in combinations_with_replacement([i for i in r...
27
19
700
548
import sys readline = sys.stdin.readline from collections import deque def main(): N, M, Q = list(map(int, readline().rstrip().split())) P = [tuple(map(int, readline().rstrip().split())) for _ in range(Q)] ans = 0 l = [[i] for i in range(1, M + 1)] que = deque(l) for i in range(N): fo...
import sys readline = sys.stdin.readline from itertools import combinations_with_replacement def main(): N, M, Q = list(map(int, readline().rstrip().split())) P = [tuple(map(int, readline().rstrip().split())) for _ in range(Q)] ans = 0 for pair in combinations_with_replacement([i for i in range(1, M ...
false
29.62963
[ "-from collections import deque", "+from itertools import combinations_with_replacement", "- l = [[i] for i in range(1, M + 1)]", "- que = deque(l)", "- for i in range(N):", "- for _ in range(len(que)):", "- ll = que.popleft()", "- for j in range(ll[-1], M + 1):",...
false
0.096985
0.047667
2.034643
[ "s345334554", "s606259123" ]
u227082700
p03062
python
s455532415
s765981269
111
78
14,332
20,144
Accepted
Accepted
29.73
n,a=int(eval(input())),list(map(int,input().split())) c,m=0,abs(a[0]) for i in range(n): if a[i]<0:c+=1 m=min(abs(a[i]),m) ans=0 for i in range(n):ans+=abs(a[i]) if not(m==0 or c%2==0):ans-=m*2 print(ans)
n=int(eval(input())) a=list(map(int,input().split())) if 0 in a: print((sum(abs(i)for i in a))) else: pc=mc=0 for i in range(n): if a[i]>0:pc+=1 else:mc+=1 a[i]=abs(a[i]) if mc%2:print((sum(a)-min(a)*2)) else:print((sum(a)))
9
12
210
245
n, a = int(eval(input())), list(map(int, input().split())) c, m = 0, abs(a[0]) for i in range(n): if a[i] < 0: c += 1 m = min(abs(a[i]), m) ans = 0 for i in range(n): ans += abs(a[i]) if not (m == 0 or c % 2 == 0): ans -= m * 2 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) if 0 in a: print((sum(abs(i) for i in a))) else: pc = mc = 0 for i in range(n): if a[i] > 0: pc += 1 else: mc += 1 a[i] = abs(a[i]) if mc % 2: print((sum(a) - min(a) * 2)) else: ...
false
25
[ "-n, a = int(eval(input())), list(map(int, input().split()))", "-c, m = 0, abs(a[0])", "-for i in range(n):", "- if a[i] < 0:", "- c += 1", "- m = min(abs(a[i]), m)", "-ans = 0", "-for i in range(n):", "- ans += abs(a[i])", "-if not (m == 0 or c % 2 == 0):", "- ans -= m * 2", ...
false
0.065374
0.03527
1.853506
[ "s455532415", "s765981269" ]
u968404618
p03486
python
s034610937
s071556239
31
26
9,004
9,036
Accepted
Accepted
16.13
S = eval(input()) T = eval(input()) sorted_S = sorted(S) sorted_T = sorted(T, reverse=True) if sorted_S < sorted_T: print("Yes") else: print("No")
S = sorted(eval(input())) T = sorted(eval(input()), reverse=True) if S >= T: print("No") else: print("Yes")
10
7
151
110
S = eval(input()) T = eval(input()) sorted_S = sorted(S) sorted_T = sorted(T, reverse=True) if sorted_S < sorted_T: print("Yes") else: print("No")
S = sorted(eval(input())) T = sorted(eval(input()), reverse=True) if S >= T: print("No") else: print("Yes")
false
30
[ "-S = eval(input())", "-T = eval(input())", "-sorted_S = sorted(S)", "-sorted_T = sorted(T, reverse=True)", "-if sorted_S < sorted_T:", "+S = sorted(eval(input()))", "+T = sorted(eval(input()), reverse=True)", "+if S >= T:", "+ print(\"No\")", "+else:", "-else:", "- print(\"No\")" ]
false
0.038216
0.063109
0.605556
[ "s034610937", "s071556239" ]
u562935282
p03695
python
s820091428
s512721653
20
18
3,316
3,060
Accepted
Accepted
10
def main(): from collections import Counter N = int(eval(input())) a = list(map(int, input().split())) a = [min(8, x // 400) for x in a] ctr = Counter(a) len_ = len(list(ctr.keys())) free = ctr[8] if free: ma = len_ - 1 + free mi = max(1, len_ - 1) ...
def main(): DIFF = 400 N = int(eval(input())) ctr = [0] * 9 for x in map(int, input().split()): ctr[min(x // DIFF, 8)] += 1 le_red = sum(c > 0 for c in ctr[:8]) gt_red = ctr[8] if gt_red: if le_red: print((le_red, le_red + gt_red)) else:...
40
23
773
429
def main(): from collections import Counter N = int(eval(input())) a = list(map(int, input().split())) a = [min(8, x // 400) for x in a] ctr = Counter(a) len_ = len(list(ctr.keys())) free = ctr[8] if free: ma = len_ - 1 + free mi = max(1, len_ - 1) ans = mi, ma ...
def main(): DIFF = 400 N = int(eval(input())) ctr = [0] * 9 for x in map(int, input().split()): ctr[min(x // DIFF, 8)] += 1 le_red = sum(c > 0 for c in ctr[:8]) gt_red = ctr[8] if gt_red: if le_red: print((le_red, le_red + gt_red)) else: print(...
false
42.5
[ "- from collections import Counter", "-", "+ DIFF = 400", "- a = list(map(int, input().split()))", "- a = [min(8, x // 400) for x in a]", "- ctr = Counter(a)", "- len_ = len(list(ctr.keys()))", "- free = ctr[8]", "- if free:", "- ma = len_ - 1 + free", "- mi...
false
0.046838
0.048794
0.959924
[ "s820091428", "s512721653" ]
u480138356
p03805
python
s658190800
s192181095
23
20
3,064
3,064
Accepted
Accepted
13.04
import sys from itertools import permutations input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) link = [[False] * N for i in range(N)] for i in range(M): a, b = list(map(int, input().split())) link[a-1][b-1] = True link[b-1][a-1] = True ...
from itertools import permutations import sys input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) link = [[False] * N for i in range(N)] for i in range(M): a, b = list(map(int, input().split())) link[a-1][b-1] = True link[b-1][a-1] = True ...
28
28
682
641
import sys from itertools import permutations input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) link = [[False] * N for i in range(N)] for i in range(M): a, b = list(map(int, input().split())) link[a - 1][b - 1] = True link[b - 1][a - 1] = True ans ...
from itertools import permutations import sys input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) link = [[False] * N for i in range(N)] for i in range(M): a, b = list(map(int, input().split())) link[a - 1][b - 1] = True link[b - 1][a - 1] = True ans ...
false
0
[ "+from itertools import permutations", "-from itertools import permutations", "- path = [i for i in range(1, N)]", "- for p in permutations(path):", "- if link[0][p[0]]:", "- ok = True", "- for i in range(N - 2):", "- if not link[p[i]][p[i + 1]]:", "...
false
0.04756
0.047343
1.004593
[ "s658190800", "s192181095" ]
u723583932
p03612
python
s533893334
s378043059
97
74
14,008
14,008
Accepted
Accepted
23.71
n=int(eval(input())) p=list(map(int,input().split())) cnt=0 p2=[] for i,x in enumerate(p): if (i+1)==p[i]: p2.append(False) else: p2.append(True) for i in range(n-1): if p2[i]==False and p2[i+1]==True: p2[i]=True cnt+=1 if p2[i]==False and p2[i+1]==False: ...
n=int(eval(input())) p=list(map(int,input().split())) cnt=0 for i in range(n-1): if p[i]==(i+1): p[i],p[i+1]=p[i+1],p[i] cnt+=1 if p[-1]==n: cnt+=1 print(cnt)
21
11
413
201
n = int(eval(input())) p = list(map(int, input().split())) cnt = 0 p2 = [] for i, x in enumerate(p): if (i + 1) == p[i]: p2.append(False) else: p2.append(True) for i in range(n - 1): if p2[i] == False and p2[i + 1] == True: p2[i] = True cnt += 1 if p2[i] == False and p2[i...
n = int(eval(input())) p = list(map(int, input().split())) cnt = 0 for i in range(n - 1): if p[i] == (i + 1): p[i], p[i + 1] = p[i + 1], p[i] cnt += 1 if p[-1] == n: cnt += 1 print(cnt)
false
47.619048
[ "-p2 = []", "-for i, x in enumerate(p):", "- if (i + 1) == p[i]:", "- p2.append(False)", "- else:", "- p2.append(True)", "- if p2[i] == False and p2[i + 1] == True:", "- p2[i] = True", "+ if p[i] == (i + 1):", "+ p[i], p[i + 1] = p[i + 1], p[i]", "- if ...
false
0.042049
0.04368
0.962651
[ "s533893334", "s378043059" ]
u094191970
p03213
python
s312003508
s592777464
83
41
3,188
9,464
Accepted
Accepted
50.6
from math import factorial from itertools import permutations n=int(eval(input())) np=factorial(n) p_list=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] ans=[] for s,t,u in permutations(p_list,3): num1=(s**4)*(t**4)*(u**2) num2=(s**14)*(t**4) num3=(s*...
from collections import Counter from itertools import permutations n=int(eval(input())) def factorization(n): p=2 fcr=[] while p*p<=n: while n%p==0: fcr.append(p) n//=p p+=1 if n>1: fcr.append(n) return fcr fcr_l=[] for i in rang...
18
39
436
710
from math import factorial from itertools import permutations n = int(eval(input())) np = factorial(n) p_list = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, ] ans = [...
from collections import Counter from itertools import permutations n = int(eval(input())) def factorization(n): p = 2 fcr = [] while p * p <= n: while n % p == 0: fcr.append(p) n //= p p += 1 if n > 1: fcr.append(n) return fcr fcr_l = [] for i in ...
false
53.846154
[ "-from math import factorial", "+from collections import Counter", "-np = factorial(n)", "-p_list = [", "- 2,", "- 3,", "- 5,", "- 7,", "- 11,", "- 13,", "- 17,", "- 19,", "- 23,", "- 29,", "- 31,", "- 37,", "- 41,", "- 43,", "- 47,", ...
false
0.135126
0.038903
3.473385
[ "s312003508", "s592777464" ]
u408260374
p02244
python
s911080872
s291404544
40
30
6,552
6,540
Accepted
Accepted
25
import itertools N, Q, row, col = eval(input()), [], list(range(8)), list(range(8)) for _ in range(N): r, c = list(map(int, input().split())) Q.append((r, c)) row.remove(r) col.remove(c) for l in itertools.permutations(col): queen = Q + list(zip(row, l)) if not any(any((r1 != r2 or c1 !...
import itertools N, Q, row, col = eval(input()), [], list(range(8)), list(range(8)) for _ in range(N): r, c = list(map(int, input().split())) Q.append((r, c)) row.remove(r) col.remove(c) for l in itertools.permutations(col): queen = Q + list(zip(row, l)) if not any((r1 != r2 or c1 != c2...
12
12
537
532
import itertools N, Q, row, col = eval(input()), [], list(range(8)), list(range(8)) for _ in range(N): r, c = list(map(int, input().split())) Q.append((r, c)) row.remove(r) col.remove(c) for l in itertools.permutations(col): queen = Q + list(zip(row, l)) if not any( any( (r1...
import itertools N, Q, row, col = eval(input()), [], list(range(8)), list(range(8)) for _ in range(N): r, c = list(map(int, input().split())) Q.append((r, c)) row.remove(r) col.remove(c) for l in itertools.permutations(col): queen = Q + list(zip(row, l)) if not any( (r1 != r2 or c1 != c...
false
0
[ "- any(", "- (r1 != r2 or c1 != c2)", "- and (r1 == r2 or c1 == c2 or r1 + c1 == r2 + c2 or r1 - c1 == r2 - c2)", "- for r2, c2 in queen", "- )", "+ (r1 != r2 or c1 != c2)", "+ and (r1 == r2 or c1 == c2 or r1 + c1 == r2 + c2 or r1 - c1 == r2 -...
false
0.051401
0.044694
1.150053
[ "s911080872", "s291404544" ]
u131464432
p02555
python
s021605382
s924653173
35
31
9,176
9,192
Accepted
Accepted
11.43
N = int(eval(input())) if N <= 2: print((0)) exit() if N <= 5: print((1)) exit() A = [1,1,1] for i in range(N - 5): A += A[i] + A[i+2], ans = A[N-6] + A[N-4] ans %= 10**9 + 7 print(ans)
N = int(eval(input())) if N <= 5: print((N//3)) exit() A = [1,1,1] for i in range(N - 5): A += A[i] + A[i+2], print((A.pop()%(10**9+7)))
15
10
211
153
N = int(eval(input())) if N <= 2: print((0)) exit() if N <= 5: print((1)) exit() A = [1, 1, 1] for i in range(N - 5): A += (A[i] + A[i + 2],) ans = A[N - 6] + A[N - 4] ans %= 10**9 + 7 print(ans)
N = int(eval(input())) if N <= 5: print((N // 3)) exit() A = [1, 1, 1] for i in range(N - 5): A += (A[i] + A[i + 2],) print((A.pop() % (10**9 + 7)))
false
33.333333
[ "-if N <= 2:", "- print((0))", "- exit()", "- print((1))", "+ print((N // 3))", "-ans = A[N - 6] + A[N - 4]", "-ans %= 10**9 + 7", "-print(ans)", "+print((A.pop() % (10**9 + 7)))" ]
false
0.176846
0.179554
0.984919
[ "s021605382", "s924653173" ]
u102461423
p02698
python
s409682140
s041416050
732
359
142,288
61,276
Accepted
Accepted
50.96
import sys import numpy as np import numba from numba import njit, b1, i4, i8 from numba.types import Omitted read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((i8[:, :], ), cache=True) def to_undirected(G): N = len(G) G = np.vstack((G,...
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def to_undirected(G): N = len(G) G = np.vstack((G, G)) G[N:, 0] = G[:N, 1] G[N:, 1] = G[:N, 0] ind = G[:, 0].argsort() return G[ind] def euler_...
81
92
2,042
2,292
import sys import numpy as np import numba from numba import njit, b1, i4, i8 from numba.types import Omitted read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((i8[:, :],), cache=True) def to_undirected(G): N = len(G) G = np.vstack((G, G)) G[N:...
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def to_undirected(G): N = len(G) G = np.vstack((G, G)) G[N:, 0] = G[:N, 1] G[N:, 1] = G[:N, 0] ind = G[:, 0].argsort() return G[ind] def euler_tour(N, G, in...
false
11.956522
[ "-import numba", "-from numba import njit, b1, i4, i8", "-from numba.types import Omitted", "-@njit((i8[:, :],), cache=True)", "-@njit([(i8, i8[:, :], i8[:], i8), (i8, i8[:, :], i8[:], Omitted(1))], cache=True)", "-def euler_tour(N, G, ind, root=1):", "+def euler_tour(N, G, ind, root):", "-@njit((i8, ...
false
0.178837
0.232206
0.770164
[ "s409682140", "s041416050" ]
u598229387
p03814
python
s204848283
s717760177
39
25
4,840
6,180
Accepted
Accepted
35.9
s = list(eval(input())) a = 0 z = 0 for i in range(len(s)): if s[i] == 'A': a = i+1 break for i in range(1, len(s)): if s[-i] == 'Z': z = len(s)-i+1 break print((z-a+1))
s = list(eval(input())) a = s.index('A') z = s[::-1].index('Z') z = len(s) - z print((z-a))
12
5
212
87
s = list(eval(input())) a = 0 z = 0 for i in range(len(s)): if s[i] == "A": a = i + 1 break for i in range(1, len(s)): if s[-i] == "Z": z = len(s) - i + 1 break print((z - a + 1))
s = list(eval(input())) a = s.index("A") z = s[::-1].index("Z") z = len(s) - z print((z - a))
false
58.333333
[ "-a = 0", "-z = 0", "-for i in range(len(s)):", "- if s[i] == \"A\":", "- a = i + 1", "- break", "-for i in range(1, len(s)):", "- if s[-i] == \"Z\":", "- z = len(s) - i + 1", "- break", "-print((z - a + 1))", "+a = s.index(\"A\")", "+z = s[::-1].index(\"Z\"...
false
0.037399
0.037011
1.010499
[ "s204848283", "s717760177" ]
u506858457
p02614
python
s917204559
s621811586
64
51
9,140
9,204
Accepted
Accepted
20.31
def MI(): return list(map(int, input().split())) H,W,K=MI() Map=[eval(input()) for _ in range(H)] ans=0 for gyou in range(1<<H): for retsu in range(1<<W): count=0 for i in range(H): for j in range(W): if (gyou>>i)&1 and (retsu>>j)&1: if Map[i][j]=='#': count+=1 ...
import itertools def MI(): return list(map(int, input().split())) H,W,K=MI() Map=[eval(input()) for _ in range(H)] ans=0 for gyou in range(1<<H): for retsu in range(1<<W): count=0 for i in range(H): if (gyou>>i)&1: for j in range(W): if (retsu>>j)&1: if Map[i][j...
15
17
350
383
def MI(): return list(map(int, input().split())) H, W, K = MI() Map = [eval(input()) for _ in range(H)] ans = 0 for gyou in range(1 << H): for retsu in range(1 << W): count = 0 for i in range(H): for j in range(W): if (gyou >> i) & 1 and (retsu >> j) & 1: ...
import itertools def MI(): return list(map(int, input().split())) H, W, K = MI() Map = [eval(input()) for _ in range(H)] ans = 0 for gyou in range(1 << H): for retsu in range(1 << W): count = 0 for i in range(H): if (gyou >> i) & 1: for j in range(W): ...
false
11.764706
[ "+import itertools", "+", "+", "- for j in range(W):", "- if (gyou >> i) & 1 and (retsu >> j) & 1:", "- if Map[i][j] == \"#\":", "- count += 1", "+ if (gyou >> i) & 1:", "+ for j in range(W):", "+ ...
false
0.040306
0.130334
0.309249
[ "s917204559", "s621811586" ]
u756595712
p02261
python
s550601774
s298240998
50
30
8,172
7,752
Accepted
Accepted
40
length = int(eval(input())) eles = [l for l in input().split()] is_stable = 'Stable' import copy _copy = copy.deepcopy(eles) for i in range(length): for j in range(length-1, 0, -1): if _copy[j][1] < _copy[j-1][1]: _copy[j], _copy[j-1] = _copy[j-1], _copy[j] print((*_copy)) print(...
length = int(eval(input())) eles = [l for l in input().split()] is_stable = 'Stable' _copy = eles[::] for i in range(length): for j in range(length-1, 0, -1): if _copy[j][1] < _copy[j-1][1]: _copy[j], _copy[j-1] = _copy[j-1], _copy[j] print((*_copy)) print(is_stable) __copy = e...
31
30
725
690
length = int(eval(input())) eles = [l for l in input().split()] is_stable = "Stable" import copy _copy = copy.deepcopy(eles) for i in range(length): for j in range(length - 1, 0, -1): if _copy[j][1] < _copy[j - 1][1]: _copy[j], _copy[j - 1] = _copy[j - 1], _copy[j] print((*_copy)) print(is_stab...
length = int(eval(input())) eles = [l for l in input().split()] is_stable = "Stable" _copy = eles[::] for i in range(length): for j in range(length - 1, 0, -1): if _copy[j][1] < _copy[j - 1][1]: _copy[j], _copy[j - 1] = _copy[j - 1], _copy[j] print((*_copy)) print(is_stable) __copy = eles[::] fo...
false
3.225806
[ "-import copy", "-", "-_copy = copy.deepcopy(eles)", "+_copy = eles[::]", "-__copy = copy.deepcopy(eles)", "+__copy = eles[::]" ]
false
0.037871
0.034625
1.093758
[ "s550601774", "s298240998" ]
u120386623
p03013
python
s917976765
s815889072
178
105
13,320
21,228
Accepted
Accepted
41.01
N, M = list(map(int, input().split())) a = set([int(eval(input())) for _ in range(M)]) INF = 1000000007 dp = [0] * (N + 1) dp[0] = 1 if 1 not in a: dp[1] = 1 else: dp[1] = 0 for i in range(2, N + 1): if i in a: continue dp[i] = dp[i - 1] + dp[i - 2] dp[i] %= INF print((dp[N]))
import sys import math from fractions import gcd # import queue # from collections import Counter # from itertools import accumulate # from functools import reduce def lcm(a, b): return a * b // gcd(a, b) def combination_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factor...
17
45
288
1,067
N, M = list(map(int, input().split())) a = set([int(eval(input())) for _ in range(M)]) INF = 1000000007 dp = [0] * (N + 1) dp[0] = 1 if 1 not in a: dp[1] = 1 else: dp[1] = 0 for i in range(2, N + 1): if i in a: continue dp[i] = dp[i - 1] + dp[i - 2] dp[i] %= INF print((dp[N]))
import sys import math from fractions import gcd # import queue # from collections import Counter # from itertools import accumulate # from functools import reduce def lcm(a, b): return a * b // gcd(a, b) def combination_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) d...
false
62.222222
[ "-N, M = list(map(int, input().split()))", "-a = set([int(eval(input())) for _ in range(M)])", "-INF = 1000000007", "-dp = [0] * (N + 1)", "+import sys", "+import math", "+from fractions import gcd", "+", "+# import queue", "+# from collections import Counter", "+# from itertools import accumula...
false
0.041742
0.081757
0.51056
[ "s917976765", "s815889072" ]
u777923818
p03326
python
s757900041
s431339833
1,266
312
21,676
21,272
Accepted
Accepted
75.36
# -*- coding: utf-8 -*- from itertools import product import numpy as np def inpl(): return list(map(int, input().split())) N, M = inpl() X, Y, Z = [], [], [] for _ in range(N): x, y, z = inpl() X.append(x) Y.append(y) Z.append(z) X = np.array(X, dtype=np.int64) Y = np.array(Y, dtype...
# -*- coding: utf-8 -*- from itertools import product import numpy as np def inpl():return list(map(int,input().split())) N,M=inpl() A,a=np.zeros((N,3),dtype=np.int64),0 for i in range(N):A[i]=np.array(inpl()) for X in product([1,-1],repeat=3):a=max(a,abs(sum(sorted((A*np.array(X)).sum(axis=1))[:M]))) print(a)
27
9
509
319
# -*- coding: utf-8 -*- from itertools import product import numpy as np def inpl(): return list(map(int, input().split())) N, M = inpl() X, Y, Z = [], [], [] for _ in range(N): x, y, z = inpl() X.append(x) Y.append(y) Z.append(z) X = np.array(X, dtype=np.int64) Y = np.array(Y, dtype=np.int64) Z...
# -*- coding: utf-8 -*- from itertools import product import numpy as np def inpl(): return list(map(int, input().split())) N, M = inpl() A, a = np.zeros((N, 3), dtype=np.int64), 0 for i in range(N): A[i] = np.array(inpl()) for X in product([1, -1], repeat=3): a = max(a, abs(sum(sorted((A * np.array(X))...
false
66.666667
[ "-X, Y, Z = [], [], []", "-for _ in range(N):", "- x, y, z = inpl()", "- X.append(x)", "- Y.append(y)", "- Z.append(z)", "-X = np.array(X, dtype=np.int64)", "-Y = np.array(Y, dtype=np.int64)", "-Z = np.array(Z, dtype=np.int64)", "-ans = 0", "-for a, b, c in product([1, -1], repeat=3)...
false
0.897502
0.172176
5.212702
[ "s757900041", "s431339833" ]
u022979415
p03361
python
s789780531
s816008454
21
19
3,064
3,064
Accepted
Accepted
9.52
def main(): h, w = list(map(int, input().split())) s = [list(eval(input())) for _ in range(h)] delta = [[0, 1], [1, 0], [0, -1], [-1, 0]] black_count = 0 for i in range(h): for j in range(w): if s[i][j] == "#": black_count += 1 tmp = 0 ...
def main(): h, w = list(map(int, input().split())) s = [["." for _ in range(w + 2)]] for _ in range(h): s.append(["."] + list(eval(input())) + ["."]) s.append(s[0]) delta = [[0, 1], [1, 0], [0, -1], [-1, 0]] count_black = 0 count_possible = 0 for i in range(1, h + 1): ...
24
21
725
626
def main(): h, w = list(map(int, input().split())) s = [list(eval(input())) for _ in range(h)] delta = [[0, 1], [1, 0], [0, -1], [-1, 0]] black_count = 0 for i in range(h): for j in range(w): if s[i][j] == "#": black_count += 1 tmp = 0 ...
def main(): h, w = list(map(int, input().split())) s = [["." for _ in range(w + 2)]] for _ in range(h): s.append(["."] + list(eval(input())) + ["."]) s.append(s[0]) delta = [[0, 1], [1, 0], [0, -1], [-1, 0]] count_black = 0 count_possible = 0 for i in range(1, h + 1): for...
false
12.5
[ "- s = [list(eval(input())) for _ in range(h)]", "+ s = [[\".\" for _ in range(w + 2)]]", "+ for _ in range(h):", "+ s.append([\".\"] + list(eval(input())) + [\".\"])", "+ s.append(s[0])", "- black_count = 0", "- for i in range(h):", "- for j in range(w):", "+ coun...
false
0.048163
0.048322
0.996706
[ "s789780531", "s816008454" ]
u729133443
p03606
python
s116522359
s371008672
193
26
38,768
3,060
Accepted
Accepted
86.53
print((sum(1-eval(s.replace(' ','-'))for s in open(0).readlines()[1:])))
_,*t=open(0);print((sum(1-eval(s.replace(' ','-'))for s in t)))
1
1
70
61
print((sum(1 - eval(s.replace(" ", "-")) for s in open(0).readlines()[1:])))
_, *t = open(0) print((sum(1 - eval(s.replace(" ", "-")) for s in t)))
false
0
[ "-print((sum(1 - eval(s.replace(\" \", \"-\")) for s in open(0).readlines()[1:])))", "+_, *t = open(0)", "+print((sum(1 - eval(s.replace(\" \", \"-\")) for s in t)))" ]
false
0.055463
0.036709
1.510872
[ "s116522359", "s371008672" ]
u923668099
p02270
python
s988552528
s631622660
1,680
970
11,716
11,632
Accepted
Accepted
42.26
import sys import math def is_capable(n, k, w, P): track = 0 cnt = 0 i = 0 while cnt < k: if i == n: return True if track + w[i] > P: track = 0 cnt += 1 else: track += w[i] i += 1 return False ...
import sys import math def is_capable(n, k, w, P): track = 0 cnt = 0 i = 0 while cnt < k: if i == n: return i if track + w[i] > P: track = 0 cnt += 1 else: track += w[i] i += 1 return i pa...
82
60
1,599
953
import sys import math def is_capable(n, k, w, P): track = 0 cnt = 0 i = 0 while cnt < k: if i == n: return True if track + w[i] > P: track = 0 cnt += 1 else: track += w[i] i += 1 return False pass # ??\?????...
import sys import math def is_capable(n, k, w, P): track = 0 cnt = 0 i = 0 while cnt < k: if i == n: return i if track + w[i] > P: track = 0 cnt += 1 else: track += w[i] i += 1 return i pass # ??\?????¨ n, k ...
false
26.829268
[ "- return True", "+ return i", "- return False", "+ return i", "- capable = {min_p: False, max_p: True}", "- # sys.exit(0)", "- while bottom < top:", "+ while top - bottom > 1:", "- if mid not in capable:", "- capable[mid] = is_capable(n, k...
false
0.102226
0.068297
1.496792
[ "s988552528", "s631622660" ]
u707498674
p03290
python
s428217487
s598070647
25
21
3,188
3,064
Accepted
Accepted
16
def main(): D, G = list(map(int, input().split())) info = [tuple(map(int, input().split())) for _ in range(D)] ans = 100 * 10 for bit in range(1<<D): score = 0 num_problem = 0 # complete bonus for i in range(D): if (bit>>i) & 1: b...
def main(): D, G = list(map(int, input().split())) info = [tuple(map(int, input().split())) for _ in range(D)] ans = 100 * 10 for bit in range(1<<D): score = 0 num_problem = 0 # complete bonus for i in range(D): if (bit>>i) & 1: b...
41
36
1,129
1,031
def main(): D, G = list(map(int, input().split())) info = [tuple(map(int, input().split())) for _ in range(D)] ans = 100 * 10 for bit in range(1 << D): score = 0 num_problem = 0 # complete bonus for i in range(D): if (bit >> i) & 1: base = 100 ...
def main(): D, G = list(map(int, input().split())) info = [tuple(map(int, input().split())) for _ in range(D)] ans = 100 * 10 for bit in range(1 << D): score = 0 num_problem = 0 # complete bonus for i in range(D): if (bit >> i) & 1: base = 100 ...
false
12.195122
[ "- for i in range(D - 1, -1, -1):", "- if score >= G:", "- break", "- if not ((bit >> i) & 1):", "- base = 100 * (i + 1)", "- rest = G - score", "- need = (rest + base - 1) // base", "- if need > in...
false
0.136847
0.121922
1.122416
[ "s428217487", "s598070647" ]
u366185462
p02887
python
s028750628
s132191607
64
57
4,724
4,212
Accepted
Accepted
10.94
n = int(eval(input())) s = str(eval(input())) slist = [] for i in range(n): slist.append(s[i]) slime = slist[0] fslist = [] fslist.append(slime) for i in range(1, n): if slime != slist[i]: fslist.append(slist[i]) slime = slist[i] print((len(fslist)))
n = int(eval(input())) s = str(eval(input())) slist = [] for i in range(n): slist.append(s[i]) slime = slist[0] count = 1 for i in range(1, n): if slime != slist[i]: count += 1 slime = slist[i] print(count)
13
12
260
217
n = int(eval(input())) s = str(eval(input())) slist = [] for i in range(n): slist.append(s[i]) slime = slist[0] fslist = [] fslist.append(slime) for i in range(1, n): if slime != slist[i]: fslist.append(slist[i]) slime = slist[i] print((len(fslist)))
n = int(eval(input())) s = str(eval(input())) slist = [] for i in range(n): slist.append(s[i]) slime = slist[0] count = 1 for i in range(1, n): if slime != slist[i]: count += 1 slime = slist[i] print(count)
false
7.692308
[ "-fslist = []", "-fslist.append(slime)", "+count = 1", "- fslist.append(slist[i])", "+ count += 1", "-print((len(fslist)))", "+print(count)" ]
false
0.044662
0.037718
1.184106
[ "s028750628", "s132191607" ]
u829859091
p02687
python
s010202670
s881501452
22
20
8,900
8,908
Accepted
Accepted
9.09
S = eval(input()) if S=='ABC': print('ARC') else: print('ABC')
if eval(input()) == 'ABC': print('ARC') else: print('ABC')
5
4
68
64
S = eval(input()) if S == "ABC": print("ARC") else: print("ABC")
if eval(input()) == "ABC": print("ARC") else: print("ABC")
false
20
[ "-S = eval(input())", "-if S == \"ABC\":", "+if eval(input()) == \"ABC\":" ]
false
0.074088
0.038662
1.916291
[ "s010202670", "s881501452" ]
u252828980
p02927
python
s950956417
s244929354
62
37
64,844
9,200
Accepted
Accepted
40.32
m,d = list(map(int,input().split())) cnt = 0 for i in range(1,m+1): for j in range(1,d+1): #print(i,j) num = 1 d2 = (j-j%10)//10 d1 = j%10 if d2 >=2 and d1 >=2: num =d1*d2 #print(i,j,num,d1,d2) #print(i,j,num,(j-j%10),j%10) ...
m,n = list(map(int,input().split())) cnt = 0 for i in range(1,m+1): for j in range(10,n+1): num = 1 d = str(j) l = len(d) for k in range(l): if int(d[k]) < 2: num =1 break else: num *=int(...
17
18
371
386
m, d = list(map(int, input().split())) cnt = 0 for i in range(1, m + 1): for j in range(1, d + 1): # print(i,j) num = 1 d2 = (j - j % 10) // 10 d1 = j % 10 if d2 >= 2 and d1 >= 2: num = d1 * d2 # print(i,j,num,d1,d2) # print(i,j,num,(j-j%10...
m, n = list(map(int, input().split())) cnt = 0 for i in range(1, m + 1): for j in range(10, n + 1): num = 1 d = str(j) l = len(d) for k in range(l): if int(d[k]) < 2: num = 1 break else: num *= int(d[k]) ...
false
5.555556
[ "-m, d = list(map(int, input().split()))", "+m, n = list(map(int, input().split()))", "- for j in range(1, d + 1):", "- # print(i,j)", "+ for j in range(10, n + 1):", "- d2 = (j - j % 10) // 10", "- d1 = j % 10", "- if d2 >= 2 and d1 >= 2:", "- num = d1 *...
false
0.035993
0.032747
1.099104
[ "s950956417", "s244929354" ]
u316386814
p02998
python
s540522320
s471748105
510
467
114,652
114,908
Accepted
Accepted
8.43
import sys sys.setrecursionlimit(10**7) INF = 10 ** 18 MOD = 10 ** 9 + 7 def YesNo(x): return 'Yes' if x else 'No' def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()]...
import sys sys.setrecursionlimit(10**7) INF = 10 ** 18 MOD = 10 ** 9 + 7 def YesNo(x): return 'Yes' if x else 'No' def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()]...
47
46
1,316
1,298
import sys sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 def YesNo(x): return "Yes" if x else "No" def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readl...
import sys sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 def YesNo(x): return "Yes" if x else "No" def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readl...
false
2.12766
[ "- if gx == 0 or gy == 0:", "- g = gx or gy or x", "- xy2g[x] = xy2g[y] = g", "- g2xy[g] |= {x, y}", "- elif gx != gy: # merge", "+ if gx != gy and gx != 0 and gy != 0: # merge", "+ else:", "+ g = gx or gy or x", "+ ...
false
0.049631
0.049648
0.999654
[ "s540522320", "s471748105" ]
u365512540
p03455
python
s057902076
s153904241
19
17
2,940
2,940
Accepted
Accepted
10.53
a, b = list(map(int, input().split())) print(('EOvdedn'[a*b%2::2]))
print(('EOvdedn'[eval(input().replace(' ', '*'))%2::2]))
2
1
60
54
a, b = list(map(int, input().split())) print(("EOvdedn"[a * b % 2 :: 2]))
print(("EOvdedn"[eval(input().replace(" ", "*")) % 2 :: 2]))
false
50
[ "-a, b = list(map(int, input().split()))", "-print((\"EOvdedn\"[a * b % 2 :: 2]))", "+print((\"EOvdedn\"[eval(input().replace(\" \", \"*\")) % 2 :: 2]))" ]
false
0.047627
0.061325
0.776634
[ "s057902076", "s153904241" ]
u535803878
p02913
python
s776783652
s869155075
1,981
615
234,436
91,832
Accepted
Accepted
68.96
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n = int(eval(input())) s = eval(input()) ### ローリングハッシュ rolling hash import random # M = 10**9+7 # M = 1<<63 - 1 M = 92709568269121 b = random.choice(list(range(1,...
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") def z_algorithm(s): """ 各iについてs[0..n)とs[i..n)のLCP(Longest Common Prefix)の長さを求める s: str or (list of int ) """ n = len(s) if n==0: ret...
52
38
1,158
847
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") n = int(eval(input())) s = eval(input()) ### ローリングハッシュ rolling hash import random # M = 10**9+7 # M = 1<<63 - 1 M = 92709568269121 b = random.choice(list(range(1, M))) def rh...
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") def z_algorithm(s): """ 各iについてs[0..n)とs[i..n)のLCP(Longest Common Prefix)の長さを求める s: str or (list of int ) """ n = len(s) if n == 0: return [] ...
false
26.923077
[ "+", "+", "+def z_algorithm(s):", "+ \"\"\"", "+ 各iについてs[0..n)とs[i..n)のLCP(Longest Common Prefix)の長さを求める", "+ s: str or (list of int )", "+ \"\"\"", "+ n = len(s)", "+ if n == 0:", "+ return []", "+ z = [None] * n", "+ z[0] = 0", "+ j = 0", "+ for i in ...
false
0.038321
0.04464
0.858463
[ "s776783652", "s869155075" ]
u574922408
p02910
python
s798647393
s002653214
19
17
3,064
2,940
Accepted
Accepted
10.53
S = eval(input()) flag =0 for i in range(len(S)): if i % 2 == 1 and S[i] == 'R': flag=1 break elif(i % 2 == 0 and S[i] == 'L'): flag=1 break ans = "Yes" if flag == 0 else "No" print(ans)
S = eval(input()) print(("No" if "L" in S[::2] or "R" in S[1::2] else "Yes"))
12
4
214
75
S = eval(input()) flag = 0 for i in range(len(S)): if i % 2 == 1 and S[i] == "R": flag = 1 break elif i % 2 == 0 and S[i] == "L": flag = 1 break ans = "Yes" if flag == 0 else "No" print(ans)
S = eval(input()) print(("No" if "L" in S[::2] or "R" in S[1::2] else "Yes"))
false
66.666667
[ "-flag = 0", "-for i in range(len(S)):", "- if i % 2 == 1 and S[i] == \"R\":", "- flag = 1", "- break", "- elif i % 2 == 0 and S[i] == \"L\":", "- flag = 1", "- break", "-ans = \"Yes\" if flag == 0 else \"No\"", "-print(ans)", "+print((\"No\" if \"L\" in S[::2] ...
false
0.150374
0.151151
0.994857
[ "s798647393", "s002653214" ]
u759412327
p02911
python
s869854801
s057795376
1,997
193
28,084
11,500
Accepted
Accepted
90.34
import numpy as np N,K,Q = list(map(int,input().split())) P = np.array(N*[K]) for q in range(Q): a = int(eval(input())) P[a-1]+=1 P-=1 for n in range(N): if P[n]<=0: print("No") else: print("Yes")
N,K,Q = list(map(int,input().split())) P = N*[K-Q] for q in range(Q): a = int(eval(input())) P[a-1]+=1 for n in range(N): if P[n]<=0: print("No") else: print("Yes")
14
12
217
181
import numpy as np N, K, Q = list(map(int, input().split())) P = np.array(N * [K]) for q in range(Q): a = int(eval(input())) P[a - 1] += 1 P -= 1 for n in range(N): if P[n] <= 0: print("No") else: print("Yes")
N, K, Q = list(map(int, input().split())) P = N * [K - Q] for q in range(Q): a = int(eval(input())) P[a - 1] += 1 for n in range(N): if P[n] <= 0: print("No") else: print("Yes")
false
14.285714
[ "-import numpy as np", "-", "-P = np.array(N * [K])", "+P = N * [K - Q]", "- P -= 1" ]
false
0.298809
0.03482
8.581553
[ "s869854801", "s057795376" ]
u476604182
p03700
python
s063864308
s006523113
829
662
85,464
83,928
Accepted
Accepted
20.14
from math import ceil N, A, B = list(map(int, input().split())) h = [] for i in range(N): h += [int(eval(input()))] Th = 2*max(h)//B Tl = 0 while Tl+1<Th: t = (Th+Tl)//2 d = [] for i in range(N): c = h[i] d += [c-B*t] for i in range(N): c = d[i] if c<=0: continue t...
N, A, B = list(map(int, input().split())) h = [] for i in range(N): h += [int(eval(input()))] Th = 2*max(h)//B Tl = 0 while Tl+1<Th: t = (Th+Tl)//2 d = [] for i in range(N): c = h[i] d += [c-B*t] for i in range(N): c = d[i] if c<=0: continue t -= c//(A-B) if c%(A-B)...
25
24
416
417
from math import ceil N, A, B = list(map(int, input().split())) h = [] for i in range(N): h += [int(eval(input()))] Th = 2 * max(h) // B Tl = 0 while Tl + 1 < Th: t = (Th + Tl) // 2 d = [] for i in range(N): c = h[i] d += [c - B * t] for i in range(N): c = d[i] if c ...
N, A, B = list(map(int, input().split())) h = [] for i in range(N): h += [int(eval(input()))] Th = 2 * max(h) // B Tl = 0 while Tl + 1 < Th: t = (Th + Tl) // 2 d = [] for i in range(N): c = h[i] d += [c - B * t] for i in range(N): c = d[i] if c <= 0: conti...
false
4
[ "-from math import ceil", "-", "- t -= ceil(c / (A - B))", "+ t -= c // (A - B) if c % (A - B) == 0 else c // (A - B) + 1" ]
false
0.044186
0.047218
0.935792
[ "s063864308", "s006523113" ]
u282228874
p03328
python
s174574253
s279089651
20
18
2,940
2,940
Accepted
Accepted
10
a,b = list(map(int,input().split())) print((((a-b)**2 -a-b)//2))
a,b = list(map(int,input().split())) print(((b-a)*(b-a-1)//2-a))
2
2
59
57
a, b = list(map(int, input().split())) print((((a - b) ** 2 - a - b) // 2))
a, b = list(map(int, input().split())) print(((b - a) * (b - a - 1) // 2 - a))
false
0
[ "-print((((a - b) ** 2 - a - b) // 2))", "+print(((b - a) * (b - a - 1) // 2 - a))" ]
false
0.036381
0.03811
0.954627
[ "s174574253", "s279089651" ]
u796942881
p03012
python
s913598726
s689951694
150
18
13,308
2,940
Accepted
Accepted
88
from sys import stdin from numpy import cumsum lines = stdin.readlines W = [int(i) for i in lines()[1].split()] total = sum(W) W = cumsum(W) ans = 1000000007 for w in W: ans = min(ans, abs(total - 2 * w)) print(ans)
N = int(eval(input())) W = [int(i) for i in input().split()] total = sum(W) ans = 1000000007 for i in range(N): ans = min(ans, abs(sum(W[:i]) - sum(W[i:]))) print(ans)
17
12
243
182
from sys import stdin from numpy import cumsum lines = stdin.readlines W = [int(i) for i in lines()[1].split()] total = sum(W) W = cumsum(W) ans = 1000000007 for w in W: ans = min(ans, abs(total - 2 * w)) print(ans)
N = int(eval(input())) W = [int(i) for i in input().split()] total = sum(W) ans = 1000000007 for i in range(N): ans = min(ans, abs(sum(W[:i]) - sum(W[i:]))) print(ans)
false
29.411765
[ "-from sys import stdin", "-from numpy import cumsum", "-", "-lines = stdin.readlines", "-W = [int(i) for i in lines()[1].split()]", "+N = int(eval(input()))", "+W = [int(i) for i in input().split()]", "-W = cumsum(W)", "-for w in W:", "- ans = min(ans, abs(total - 2 * w))", "+for i in range(...
false
0.267552
0.076054
3.517907
[ "s913598726", "s689951694" ]
u977389981
p03478
python
s447631664
s347220583
36
30
3,060
3,060
Accepted
Accepted
16.67
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): L = list(str(i)) temp = 0 for l in L: temp += int(l) if a <= temp <= b: ans += i print(ans)
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): temp = sum(map(int, str(i))) if a <= temp <= b: ans += i print(ans)
11
8
212
169
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): L = list(str(i)) temp = 0 for l in L: temp += int(l) if a <= temp <= b: ans += i print(ans)
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): temp = sum(map(int, str(i))) if a <= temp <= b: ans += i print(ans)
false
27.272727
[ "- L = list(str(i))", "- temp = 0", "- for l in L:", "- temp += int(l)", "+ temp = sum(map(int, str(i)))" ]
false
0.043467
0.045656
0.952066
[ "s447631664", "s347220583" ]
u327466606
p02560
python
s314186963
s851134290
1,108
412
9,280
70,984
Accepted
Accepted
62.82
def floor_linear_sum(n,m,a,b): res = 0 if a >= m: res += (n-1)*n*(a//m)//2 a %= m if b >= m: res += n * (b//m) b %= m y_max = (a*n+b)//m while y_max: x_max = y_max*m-b res += (n - (x_max + a - 1)//a)*y_max n,m,a,b = y_max, a, m, (...
def floor_linear_sum(n,m,a,b): res = 0 while True: if a >= m: res += (n-1)*n*(a//m)//2 a %= m if b >= m: res += n * (b//m) b %= m y_max = (a*n+b)//m if y_max == 0: return res x_max = y_max*m-b ...
27
20
622
502
def floor_linear_sum(n, m, a, b): res = 0 if a >= m: res += (n - 1) * n * (a // m) // 2 a %= m if b >= m: res += n * (b // m) b %= m y_max = (a * n + b) // m while y_max: x_max = y_max * m - b res += (n - (x_max + a - 1) // a) * y_max n, m, a, ...
def floor_linear_sum(n, m, a, b): res = 0 while True: if a >= m: res += (n - 1) * n * (a // m) // 2 a %= m if b >= m: res += n * (b // m) b %= m y_max = (a * n + b) // m if y_max == 0: return res x_max = y_max * ...
false
25.925926
[ "- if a >= m:", "- res += (n - 1) * n * (a // m) // 2", "- a %= m", "- if b >= m:", "- res += n * (b // m)", "- b %= m", "- y_max = (a * n + b) // m", "- while y_max:", "- x_max = y_max * m - b", "- res += (n - (x_max + a - 1) // a) * y_max", ...
false
0.10698
0.037387
2.861393
[ "s314186963", "s851134290" ]
u179169725
p03078
python
s069440869
s521881596
949
111
145,184
8,708
Accepted
Accepted
88.3
import sys read = sys.stdin.readline def read_ints(): return list(map(int, read().split())) X, Y, Z, K = read_ints() A = list(map(int,input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) from itertools import product AB = [a + b for a, b in product(A, B)] A...
# 全探索に終了条件を追加することで計算量を削減させるやり方 import sys read = sys.stdin.readline def read_ints(): return list(map(int, read().split())) X, Y, Z, K = read_ints() A = read_ints() B = read_ints() C = read_ints() A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) ABC = [] for a in range(X): ...
25
35
459
677
import sys read = sys.stdin.readline def read_ints(): return list(map(int, read().split())) X, Y, Z, K = read_ints() A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) from itertools import product AB = [a + b for a, b in product(A, B)] AB.sort(reverse=...
# 全探索に終了条件を追加することで計算量を削減させるやり方 import sys read = sys.stdin.readline def read_ints(): return list(map(int, read().split())) X, Y, Z, K = read_ints() A = read_ints() B = read_ints() C = read_ints() A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) ABC = [] for a in range(X): if a + 1 > K: ...
false
28.571429
[ "+# 全探索に終了条件を追加することで計算量を削減させるやり方", "-A = list(map(int, input().split()))", "-B = list(map(int, input().split()))", "-C = list(map(int, input().split()))", "-from itertools import product", "-", "-AB = [a + b for a, b in product(A, B)]", "-AB.sort(reverse=True)", "-ABC = [ab + c for ab, c in product(...
false
0.046727
0.076777
0.608601
[ "s069440869", "s521881596" ]
u243572357
p03399
python
s663207626
s174298080
19
17
3,060
2,940
Accepted
Accepted
10.53
a, b, c, d = [int(eval(input())) for _ in range(4)] print((min(a,b) + min(c, d)))
a, b, x, y = [int(eval(input())) for _ in range(4)] print((min(a, b) + min(x, y)))
2
2
74
75
a, b, c, d = [int(eval(input())) for _ in range(4)] print((min(a, b) + min(c, d)))
a, b, x, y = [int(eval(input())) for _ in range(4)] print((min(a, b) + min(x, y)))
false
0
[ "-a, b, c, d = [int(eval(input())) for _ in range(4)]", "-print((min(a, b) + min(c, d)))", "+a, b, x, y = [int(eval(input())) for _ in range(4)]", "+print((min(a, b) + min(x, y)))" ]
false
0.009086
0.038545
0.235736
[ "s663207626", "s174298080" ]
u769852547
p03280
python
s806838443
s344834471
26
17
3,316
2,940
Accepted
Accepted
34.62
a, b = list(map(int, input().split())) print(((a-1)*(b-1))) exit(0)
a,b = list(map(int, input().split())) print(((a-1)*(b-1)))
3
2
61
52
a, b = list(map(int, input().split())) print(((a - 1) * (b - 1))) exit(0)
a, b = list(map(int, input().split())) print(((a - 1) * (b - 1)))
false
33.333333
[ "-exit(0)" ]
false
0.0438
0.042384
1.0334
[ "s806838443", "s344834471" ]
u671060652
p02683
python
s534735965
s899646810
436
394
73,384
73,268
Accepted
Accepted
9.63
import itertools import math import fractions import functools n, m, x = list(map(int, input().split())) c = [] a_do = [] for i in range(n): a = list(map(int, input().split())) c.append(a[0]) a_do.append(a[1:]) minimum = 10**20 for pat in range(0, (1<<n)): #参考書の選び方の全パターン cost = 0 ...
import itertools import math import fractions import functools n, m, x = list(map(int, input().split())) c = [] a_do = [] for i in range(n): a = list(map(int, input().split())) c.append(a[0]) a_do.append(a[1:]) # minimum = 10**20 # for pat in range(0, (1<<n)): #参考書の選び方の全パターン # cost = ...
35
73
711
1,544
import itertools import math import fractions import functools n, m, x = list(map(int, input().split())) c = [] a_do = [] for i in range(n): a = list(map(int, input().split())) c.append(a[0]) a_do.append(a[1:]) minimum = 10**20 for pat in range(0, (1 << n)): # 参考書の選び方の全パターン cost = 0 rikaido = [0] ...
import itertools import math import fractions import functools n, m, x = list(map(int, input().split())) c = [] a_do = [] for i in range(n): a = list(map(int, input().split())) c.append(a[0]) a_do.append(a[1:]) # minimum = 10**20 # for pat in range(0, (1<<n)): #参考書の選び方の全パターン # cost = 0 # rikaido = ...
false
52.054795
[ "+# minimum = 10**20", "+# for pat in range(0, (1<<n)): #参考書の選び方の全パターン", "+# cost = 0", "+# rikaido = [0] * m", "+# for i in range(n):", "+# if((pat >> i) & 1): #i番目の参考書を読む", "+# cost += c[i]", "+# for k in range(m):", "+# rikaido[k] += a_d...
false
0.035473
0.045604
0.777854
[ "s534735965", "s899646810" ]
u137226361
p02983
python
s790952746
s987448241
403
248
9,184
9,132
Accepted
Accepted
38.46
l, r = list(map(int, input().split())) d = (r -l)%2019 if r -l >=2018: print((0)) exit(0) ans = 2018 for i in range(l, l+d): for j in range(i+1, l+d+1): if (i*j)%2019 < ans: ans =(i*j)%2019 print(ans)
l, r = list(map(int, input().split())) d = (r -l)%2019 if r -l >=2018: print((0)) exit(0) ans = 2018 l = l%2019 for i in range(l, l+d): for j in range(i+1, l+d+1): if (i*j)%2019 < ans: ans =(i*j)%2019 print(ans)
11
12
234
246
l, r = list(map(int, input().split())) d = (r - l) % 2019 if r - l >= 2018: print((0)) exit(0) ans = 2018 for i in range(l, l + d): for j in range(i + 1, l + d + 1): if (i * j) % 2019 < ans: ans = (i * j) % 2019 print(ans)
l, r = list(map(int, input().split())) d = (r - l) % 2019 if r - l >= 2018: print((0)) exit(0) ans = 2018 l = l % 2019 for i in range(l, l + d): for j in range(i + 1, l + d + 1): if (i * j) % 2019 < ans: ans = (i * j) % 2019 print(ans)
false
8.333333
[ "+l = l % 2019" ]
false
0.045959
0.038267
1.201001
[ "s790952746", "s987448241" ]
u995004106
p02702
python
s930261842
s004023503
473
175
95,384
80,656
Accepted
Accepted
63
import math import fractions import collections import itertools from collections import deque d=collections.deque() S=list(eval(input())) N=len(S) cnt=0 amari=[0]*(N+1) num=0 for i in range(N): d.append(int(S[i])) #print(d) for i in range(N): n=d.pop() num=(num+pow(10,i,2019)*n)%2019 ...
import math import fractions import collections import itertools from collections import deque S=eval(input()) N=len(S) cnt=0 l=[] """ cnt=0 p=10**9+7 for i in range(K,N+2): cnt=(cnt+((N-i+1)*i)+1)%p #print(((N-i+1)*i)+1) print(cnt) """ amari=[0]*(N+1) num=0 for i in range(N): num=num+po...
38
32
905
708
import math import fractions import collections import itertools from collections import deque d = collections.deque() S = list(eval(input())) N = len(S) cnt = 0 amari = [0] * (N + 1) num = 0 for i in range(N): d.append(int(S[i])) # print(d) for i in range(N): n = d.pop() num = (num + pow(10, i, 2019) * n)...
import math import fractions import collections import itertools from collections import deque S = eval(input()) N = len(S) cnt = 0 l = [] """ cnt=0 p=10**9+7 for i in range(K,N+2): cnt=(cnt+((N-i+1)*i)+1)%p #print(((N-i+1)*i)+1) print(cnt) """ amari = [0] * (N + 1) num = 0 for i in range(N): num = num + p...
false
15.789474
[ "-d = collections.deque()", "-S = list(eval(input()))", "+S = eval(input())", "+l = []", "+\"\"\"", "+cnt=0", "+p=10**9+7", "+for i in range(K,N+2):", "+ cnt=(cnt+((N-i+1)*i)+1)%p", "+ #print(((N-i+1)*i)+1)", "+print(cnt)", "+\"\"\"", "- d.append(int(S[i]))", "-# print(d)", "-fo...
false
0.042265
0.076352
0.553554
[ "s930261842", "s004023503" ]
u497596438
p03436
python
s673530718
s542150994
192
28
40,816
3,316
Accepted
Accepted
85.42
from collections import deque H,W=list(map(int,input().split())) s=[] for i in range(H): si=eval(input()) s.append(si) queue=deque() sy,sx=(0,0) gy,gx=(H-1,W-1) reached=[[-1 for i in range(W)] for j in range(H)] queue.append([sy,sx]) reached[sy][sx]=0 dx=[1,-1,0,0] dy=[0,0,1,-1] while(queue): ...
from collections import deque H,W=list(map(int,input().split())) stack=deque() c=[eval(input()) for i in range(H)] ans=0 for ci in c: for j in ci: if j==".": ans+=1 reached=[[0]*W for i in range(H)] stack.append((0,0)) dydx=[(1,0),(-1,0),(0,1),(0,-1)] while(stack): Y,X=stack.pop...
34
27
764
655
from collections import deque H, W = list(map(int, input().split())) s = [] for i in range(H): si = eval(input()) s.append(si) queue = deque() sy, sx = (0, 0) gy, gx = (H - 1, W - 1) reached = [[-1 for i in range(W)] for j in range(H)] queue.append([sy, sx]) reached[sy][sx] = 0 dx = [1, -1, 0, 0] dy = [0, 0, 1...
from collections import deque H, W = list(map(int, input().split())) stack = deque() c = [eval(input()) for i in range(H)] ans = 0 for ci in c: for j in ci: if j == ".": ans += 1 reached = [[0] * W for i in range(H)] stack.append((0, 0)) dydx = [(1, 0), (-1, 0), (0, 1), (0, -1)] while stack: ...
false
20.588235
[ "-s = []", "-for i in range(H):", "- si = eval(input())", "- s.append(si)", "-queue = deque()", "-sy, sx = (0, 0)", "-gy, gx = (H - 1, W - 1)", "-reached = [[-1 for i in range(W)] for j in range(H)]", "-queue.append([sy, sx])", "-reached[sy][sx] = 0", "-dx = [1, -1, 0, 0]", "-dy = [0, 0,...
false
0.088526
0.036233
2.443278
[ "s673530718", "s542150994" ]
u094191970
p02579
python
s397185949
s981526025
1,838
762
136,160
134,880
Accepted
Accepted
58.54
from sys import stdin nii=lambda:list(map(int,stdin.readline().split())) lnii=lambda:list(map(int,stdin.readline().split())) from collections import deque h,w=nii() ch,cw=nii() dh,dw=nii() s=[list(eval(input())) for i in range(h)] ch-=1 cw-=1 dh-=1 dw-=1 ans=[[-1]*w for i in range(h)] ans[ch][cw]=0 ...
from sys import stdin nii=lambda:list(map(int,stdin.readline().split())) lnii=lambda:list(map(int,stdin.readline().split())) from collections import deque h,w=nii() ch,cw=nii() dh,dw=nii() s=[list(eval(input())) for i in range(h)] ch-=1 cw-=1 dh-=1 dw-=1 dist=[[-1]*w for i in range(h)] dist[ch][cw]=0...
48
48
938
938
from sys import stdin nii = lambda: list(map(int, stdin.readline().split())) lnii = lambda: list(map(int, stdin.readline().split())) from collections import deque h, w = nii() ch, cw = nii() dh, dw = nii() s = [list(eval(input())) for i in range(h)] ch -= 1 cw -= 1 dh -= 1 dw -= 1 ans = [[-1] * w for i in range(h)] a...
from sys import stdin nii = lambda: list(map(int, stdin.readline().split())) lnii = lambda: list(map(int, stdin.readline().split())) from collections import deque h, w = nii() ch, cw = nii() dh, dw = nii() s = [list(eval(input())) for i in range(h)] ch -= 1 cw -= 1 dh -= 1 dw -= 1 dist = [[-1] * w for i in range(h)] ...
false
0
[ "-ans = [[-1] * w for i in range(h)]", "-ans[ch][cw] = 0", "+dist = [[-1] * w for i in range(h)]", "+dist[ch][cw] = 0", "-def BFS():", "+def BFS(que):", "- print((ans[y][x]))", "+ print((dist[y][x]))", "- for dy, dx in [[-1, 0], [1, 0], [0, -1], [0, 1]]:", "+ fo...
false
0.034162
0.035722
0.956325
[ "s397185949", "s981526025" ]
u788137651
p03003
python
s876879002
s021316173
989
469
340,588
97,368
Accepted
Accepted
52.58
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys input=sys.stdin.readline from math import floor,ceil,sqrt,factorial,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter,defaultdict from iter...
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,sqrt,factorial,hypot,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import...
116
57
3,390
1,730
# #    ⋀_⋀ #    (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys input = sys.stdin.readline from math import floor, ceil, sqrt, factorial, log # log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter, defaultdict from itertools import ...
# #    ⋀_⋀ #    (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline from math import floor, sqrt, factorial, hypot, log # log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter, defa...
false
50.862069
[ "+sys.setrecursionlimit(10**6)", "-from math import floor, ceil, sqrt, factorial, log # log2ないyp", "+from math import floor, sqrt, factorial, hypot, log # log2ないyp", "-from collections import Counter, defaultdict", "+from collections import Counter, defaultdict, deque", "-from copy import copy", "+fro...
false
0.085055
0.03651
2.329618
[ "s876879002", "s021316173" ]
u046592970
p04031
python
s151912570
s560437604
25
18
3,060
3,188
Accepted
Accepted
28
n = int(eval(input())) a = list(map(int,input().split())) mn = 10**9 for i in range(-100,101): x = 0 for j in a: x += (j-i)**2 mn = min(mn,x) print(mn)
n = int(eval(input())) a = list(map(int,input().split())) x = round(sum(a)/n) ans = 0 for i in a: ans += (i-x)**2 print(ans)
9
7
173
128
n = int(eval(input())) a = list(map(int, input().split())) mn = 10**9 for i in range(-100, 101): x = 0 for j in a: x += (j - i) ** 2 mn = min(mn, x) print(mn)
n = int(eval(input())) a = list(map(int, input().split())) x = round(sum(a) / n) ans = 0 for i in a: ans += (i - x) ** 2 print(ans)
false
22.222222
[ "-mn = 10**9", "-for i in range(-100, 101):", "- x = 0", "- for j in a:", "- x += (j - i) ** 2", "- mn = min(mn, x)", "-print(mn)", "+x = round(sum(a) / n)", "+ans = 0", "+for i in a:", "+ ans += (i - x) ** 2", "+print(ans)" ]
false
0.092253
0.121292
0.760586
[ "s151912570", "s560437604" ]
u845643816
p00028
python
s920101282
s474790873
30
20
7,692
7,692
Accepted
Accepted
33.33
# 0028 array = [] while True: try: a = input() array.append(int(a)) except EOFError: break s = set(array) count= list(map(lambda a: array.count(a), s)) mx = max(count) modes = list(list(s)[i] for i, x in enumerate(count) if x == mx) print(*modes, sep = '\n')
# 0028 array = [] while True: try: a = eval(input()) array.append(int(a)) except EOFError: break s = set(array) mx = array.count(max(array, key = array.count)) for a in sorted(s): if array.count(a) == mx: print(a)
13
13
302
263
# 0028 array = [] while True: try: a = input() array.append(int(a)) except EOFError: break s = set(array) count = list(map(lambda a: array.count(a), s)) mx = max(count) modes = list(list(s)[i] for i, x in enumerate(count) if x == mx) print(*modes, sep="\n")
# 0028 array = [] while True: try: a = eval(input()) array.append(int(a)) except EOFError: break s = set(array) mx = array.count(max(array, key=array.count)) for a in sorted(s): if array.count(a) == mx: print(a)
false
0
[ "- a = input()", "+ a = eval(input())", "-count = list(map(lambda a: array.count(a), s))", "-mx = max(count)", "-modes = list(list(s)[i] for i, x in enumerate(count) if x == mx)", "-print(*modes, sep=\"\\n\")", "+mx = array.count(max(array, key=array.count))", "+for a in sorted(s):", "...
false
0.043591
0.041752
1.044052
[ "s920101282", "s474790873" ]
u016881126
p03212
python
s739020306
s463078773
241
95
3,064
3,064
Accepted
Accepted
60.58
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) INF = float('inf') N = int(eval(input())) def F(list_): if list_ and int("".join(map(str, list_))) > N: return if 3 in list_ and 5 in l...
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) INF = float('inf') N = int(eval(input())) def dfs(s): if int(s) > N: return 0 ret = 1 if all(s.count(c) > 0 for c in '753') else 0 for c...
25
20
501
397
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10**7) INF = float("inf") N = int(eval(input())) def F(list_): if list_ and int("".join(map(str, list_))) > N: return if 3 in list_ and 5 in list_ and 7 in list_: ...
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10**7) INF = float("inf") N = int(eval(input())) def dfs(s): if int(s) > N: return 0 ret = 1 if all(s.count(c) > 0 for c in "753") else 0 for c in "753": ...
false
20
[ "-def F(list_):", "- if list_ and int(\"\".join(map(str, list_))) > N:", "- return", "- if 3 in list_ and 5 in list_ and 7 in list_:", "- yield 1", "- for v in [3, 5, 7]:", "- list_.append(v)", "- yield from F(list_)", "- list_.pop()", "- return", "...
false
0.099254
0.066996
1.481491
[ "s739020306", "s463078773" ]
u823391732
p03478
python
s447923981
s631548787
78
72
73,588
66,092
Accepted
Accepted
7.69
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n+1): s = str(i) l = 0 for j in range(len(s)): l += int(s[j]) if l >= a and l <= b: ans += i print(ans)
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n+1): sum = 0 tmp = i while tmp != 0: sum += tmp%10 tmp = tmp//10 if sum >= a and sum <= b: ans += i print(ans)
11
12
208
225
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): s = str(i) l = 0 for j in range(len(s)): l += int(s[j]) if l >= a and l <= b: ans += i print(ans)
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): sum = 0 tmp = i while tmp != 0: sum += tmp % 10 tmp = tmp // 10 if sum >= a and sum <= b: ans += i print(ans)
false
8.333333
[ "- s = str(i)", "- l = 0", "- for j in range(len(s)):", "- l += int(s[j])", "- if l >= a and l <= b:", "+ sum = 0", "+ tmp = i", "+ while tmp != 0:", "+ sum += tmp % 10", "+ tmp = tmp // 10", "+ if sum >= a and sum <= b:" ]
false
0.047739
0.043427
1.099289
[ "s447923981", "s631548787" ]
u989345508
p02695
python
s340697915
s449781002
1,503
1,102
9,216
9,092
Accepted
Accepted
26.68
n,m,q=list(map(int,input().split())) Q=[list(map(int,input().split())) for i in range(q)] ans=0 #めっちゃfor文あるならdfs R=[list(range(i,m)) for i in range(m)] def dfs(d,s,l): global n,m,Q,ans if d==n: ans_=0 for k in Q: a,b,c,e=k if int(s[b-1])-int(s[a-1])==c: ...
from itertools import combinations_with_replacement n,m,q=list(map(int,input().split())) Q=[list(map(int,input().split())) for i in range(q)] ans=0 for s in combinations_with_replacement(list(range(1,m+1)),n): ans_=0 for k in Q: a,b,c,d=k if s[b-1]-s[a-1]==c: ans_+=d an...
20
12
447
335
n, m, q = list(map(int, input().split())) Q = [list(map(int, input().split())) for i in range(q)] ans = 0 # めっちゃfor文あるならdfs R = [list(range(i, m)) for i in range(m)] def dfs(d, s, l): global n, m, Q, ans if d == n: ans_ = 0 for k in Q: a, b, c, e = k if int(s[b - 1]) - ...
from itertools import combinations_with_replacement n, m, q = list(map(int, input().split())) Q = [list(map(int, input().split())) for i in range(q)] ans = 0 for s in combinations_with_replacement(list(range(1, m + 1)), n): ans_ = 0 for k in Q: a, b, c, d = k if s[b - 1] - s[a - 1] == c: ...
false
40
[ "+from itertools import combinations_with_replacement", "+", "-# めっちゃfor文あるならdfs", "-R = [list(range(i, m)) for i in range(m)]", "-", "-", "-def dfs(d, s, l):", "- global n, m, Q, ans", "- if d == n:", "- ans_ = 0", "- for k in Q:", "- a, b, c, e = k", "- ...
false
0.072184
0.044748
1.613111
[ "s340697915", "s449781002" ]
u280667879
p03822
python
s822720425
s734927237
1,189
1,009
167,024
152,760
Accepted
Accepted
15.14
from collections import defaultdict import sys sys.setrecursionlimit(110000) def dfs(i): if i not in H: return 0 if memo[i]>=0: return memo[i] a=sorted((dfs(e) for e in H[i]),reverse=True) memo[i]=max(a[i]+i+1 for i in range(len(a))) return memo[i] N=int(sys.stdin.readline()) memo=[-1]*N H=defaultdi...
from collections import defaultdict import sys sys.setrecursionlimit(110000) def dfs(i): if i not in H: return 0 if memo[i]>=0: return memo[i] a=sorted(-dfs(e) for e in H[i]) memo[i]=max(i+1-a[i]for i in range(len(a))) return memo[i] N=int(sys.stdin.readline()) memo=[-1]*N H=defaultdict(list) ...
18
17
436
423
from collections import defaultdict import sys sys.setrecursionlimit(110000) def dfs(i): if i not in H: return 0 if memo[i] >= 0: return memo[i] a = sorted((dfs(e) for e in H[i]), reverse=True) memo[i] = max(a[i] + i + 1 for i in range(len(a))) return memo[i] N = int(sys.stdin.r...
from collections import defaultdict import sys sys.setrecursionlimit(110000) def dfs(i): if i not in H: return 0 if memo[i] >= 0: return memo[i] a = sorted(-dfs(e) for e in H[i]) memo[i] = max(i + 1 - a[i] for i in range(len(a))) return memo[i] N = int(sys.stdin.readline()) memo...
false
5.555556
[ "- a = sorted((dfs(e) for e in H[i]), reverse=True)", "- memo[i] = max(a[i] + i + 1 for i in range(len(a)))", "+ a = sorted(-dfs(e) for e in H[i])", "+ memo[i] = max(i + 1 - a[i] for i in range(len(a)))" ]
false
0.042749
0.094905
0.450445
[ "s822720425", "s734927237" ]
u057964173
p03285
python
s921881859
s738552688
163
17
38,384
3,060
Accepted
Accepted
89.57
import sys def input(): return sys.stdin.readline().strip() def resolve(): def main(): n=int(eval(input())) for cake in range(26): for donut in range(15): if cake*4+donut*7==n: return 'Yes' return 'No' print((main())) resolve()
import sys def input(): return sys.stdin.readline().strip() def resolve(): n=int(eval(input())) l=[1,2,3,5,6,9,10,13,17] if n in l: print('No') else: print('Yes') resolve()
13
11
312
209
import sys def input(): return sys.stdin.readline().strip() def resolve(): def main(): n = int(eval(input())) for cake in range(26): for donut in range(15): if cake * 4 + donut * 7 == n: return "Yes" return "No" print((main())) r...
import sys def input(): return sys.stdin.readline().strip() def resolve(): n = int(eval(input())) l = [1, 2, 3, 5, 6, 9, 10, 13, 17] if n in l: print("No") else: print("Yes") resolve()
false
15.384615
[ "- def main():", "- n = int(eval(input()))", "- for cake in range(26):", "- for donut in range(15):", "- if cake * 4 + donut * 7 == n:", "- return \"Yes\"", "- return \"No\"", "-", "- print((main()))", "+ n = int(eval(input...
false
0.046958
0.042654
1.100886
[ "s921881859", "s738552688" ]
u495335272
p03317
python
s416817998
s075456042
46
39
13,880
13,812
Accepted
Accepted
15.22
n, k = list(map(int, input().split())) a = list(map(int, input().split())) for i, v in enumerate(a): if v == 1: ind1 = i break ans = -((-n + 1) // (k - 1)) print(ans)
n, k = list(map(int, input().split())) a = list(map(int, input().split())) ans = -((-n + 1) // (k - 1)) print(ans)
9
5
189
113
n, k = list(map(int, input().split())) a = list(map(int, input().split())) for i, v in enumerate(a): if v == 1: ind1 = i break ans = -((-n + 1) // (k - 1)) print(ans)
n, k = list(map(int, input().split())) a = list(map(int, input().split())) ans = -((-n + 1) // (k - 1)) print(ans)
false
44.444444
[ "-for i, v in enumerate(a):", "- if v == 1:", "- ind1 = i", "- break" ]
false
0.050311
0.048802
1.030932
[ "s416817998", "s075456042" ]
u644907318
p03700
python
s513719774
s811840387
1,830
319
7,068
172,244
Accepted
Accepted
82.57
import math N,A,B = list(map(int,input().split())) H = [int(eval(input())) for _ in range(N)] low = sum(H)//((N-1)*B+A)-1 high = max(H)//B+1 while high-low>1: mid = (high+low)//2 cnt = 0 for i in range(N): cnt += math.ceil(max(H[i]-mid*B,0)/(A-B)) if cnt<=mid: high = mid ...
import math N,A,B = list(map(int,input().split())) H = [int(eval(input())) for _ in range(N)] d = A-B high = 10**9 low = 0 while high-low>1: mid = (high+low)//2 D = [] for i in range(N): if H[i]-mid*B>0: D.append(H[i]-mid*B) cnt = 0 for h in D: cnt += math.c...
15
20
345
397
import math N, A, B = list(map(int, input().split())) H = [int(eval(input())) for _ in range(N)] low = sum(H) // ((N - 1) * B + A) - 1 high = max(H) // B + 1 while high - low > 1: mid = (high + low) // 2 cnt = 0 for i in range(N): cnt += math.ceil(max(H[i] - mid * B, 0) / (A - B)) if cnt <= mid...
import math N, A, B = list(map(int, input().split())) H = [int(eval(input())) for _ in range(N)] d = A - B high = 10**9 low = 0 while high - low > 1: mid = (high + low) // 2 D = [] for i in range(N): if H[i] - mid * B > 0: D.append(H[i] - mid * B) cnt = 0 for h in D: cnt...
false
25
[ "-low = sum(H) // ((N - 1) * B + A) - 1", "-high = max(H) // B + 1", "+d = A - B", "+high = 10**9", "+low = 0", "+ D = []", "+ for i in range(N):", "+ if H[i] - mid * B > 0:", "+ D.append(H[i] - mid * B)", "- for i in range(N):", "- cnt += math.ceil(max(H[i] - m...
false
0.071344
0.041245
1.729764
[ "s513719774", "s811840387" ]
u483645888
p03043
python
s307894735
s845127041
36
32
2,940
2,940
Accepted
Accepted
11.11
n,k = list(map(int,input().split())) ans = 0 flag = False prob = 1 for i in range(1,n+1): flag = False if i >= k: ans += 1/n else: while flag == False: prob *= 1/2 i *= 2 if i >= k: ans += prob/n flag = True prob = 1 print(ans)
n,k = list(map(int,input().split())) ans = 0 cnt = 0 for i in range(1,n+1): if i >= k: ans += 1/n else: cnt = 0 while i < k: i *= 2 cnt += 1 ans += 1/n*(1/2)**cnt print(ans)
18
13
296
211
n, k = list(map(int, input().split())) ans = 0 flag = False prob = 1 for i in range(1, n + 1): flag = False if i >= k: ans += 1 / n else: while flag == False: prob *= 1 / 2 i *= 2 if i >= k: ans += prob / n flag = True ...
n, k = list(map(int, input().split())) ans = 0 cnt = 0 for i in range(1, n + 1): if i >= k: ans += 1 / n else: cnt = 0 while i < k: i *= 2 cnt += 1 ans += 1 / n * (1 / 2) ** cnt print(ans)
false
27.777778
[ "-flag = False", "-prob = 1", "+cnt = 0", "- flag = False", "- while flag == False:", "- prob *= 1 / 2", "+ cnt = 0", "+ while i < k:", "- if i >= k:", "- ans += prob / n", "- flag = True", "- prob = 1",...
false
0.047285
0.042429
1.114451
[ "s307894735", "s845127041" ]
u123756661
p03634
python
s089827249
s627477292
1,631
1,451
102,812
61,732
Accepted
Accepted
11.04
from collections import deque n=int(eval(input())) l=[0]*n d={} for i in range(n-1): a,b,c=list(map(int,input().split())) a-=1 b-=1 if a in d: d[a].add((b,c)) else: d[a]={(b,c)} if b in d: d[b].add((a,c)) else: d[b]={(a,c)} q,k=list(map(int,inp...
from collections import deque def main(): n=int(eval(input())) l=[0]*n d={} for i in range(n-1): a,b,c=list(map(int,input().split())) a-=1 b-=1 if a in d: d[a].add((b,c)) else: d[a]={(b,c)} if b in d: d[b...
29
33
608
770
from collections import deque n = int(eval(input())) l = [0] * n d = {} for i in range(n - 1): a, b, c = list(map(int, input().split())) a -= 1 b -= 1 if a in d: d[a].add((b, c)) else: d[a] = {(b, c)} if b in d: d[b].add((a, c)) else: d[b] = {(a, c)} q, k = l...
from collections import deque def main(): n = int(eval(input())) l = [0] * n d = {} for i in range(n - 1): a, b, c = list(map(int, input().split())) a -= 1 b -= 1 if a in d: d[a].add((b, c)) else: d[a] = {(b, c)} if b in d: ...
false
12.121212
[ "-n = int(eval(input()))", "-l = [0] * n", "-d = {}", "-for i in range(n - 1):", "- a, b, c = list(map(int, input().split()))", "- a -= 1", "- b -= 1", "- if a in d:", "- d[a].add((b, c))", "- else:", "- d[a] = {(b, c)}", "- if b in d:", "- d[b].add((a,...
false
0.037572
0.037532
1.001076
[ "s089827249", "s627477292" ]
u864197622
p02788
python
s684914501
s860608878
1,004
478
68,572
62,144
Accepted
Accepted
52.39
import sys input = sys.stdin.readline from collections import deque N, D, A = list(map(int, input().split())) X = [] for _ in range(N): x, h = list(map(int, input().split())) X.append((x, h)) X = sorted(X)[::-1] Q = deque([]) ans = 0 k = 0 while X: if len(Q) == 0 or X[-1][0] <= Q[0][0]: ...
import sys input = sys.stdin.readline from collections import deque N, D, A = list(map(int, input().split())) X = [] for _ in range(N): x, h = list(map(int, input().split())) X.append((x << 30) + h) X = sorted(X)[::-1] Q = deque([]) ans = 0 k = 0 while X: if len(Q) == 0 or X[-1] >> 30 <= Q[...
27
28
538
585
import sys input = sys.stdin.readline from collections import deque N, D, A = list(map(int, input().split())) X = [] for _ in range(N): x, h = list(map(int, input().split())) X.append((x, h)) X = sorted(X)[::-1] Q = deque([]) ans = 0 k = 0 while X: if len(Q) == 0 or X[-1][0] <= Q[0][0]: x, h = X.p...
import sys input = sys.stdin.readline from collections import deque N, D, A = list(map(int, input().split())) X = [] for _ in range(N): x, h = list(map(int, input().split())) X.append((x << 30) + h) X = sorted(X)[::-1] Q = deque([]) ans = 0 k = 0 while X: if len(Q) == 0 or X[-1] >> 30 <= Q[0][0]: ...
false
3.571429
[ "- X.append((x, h))", "+ X.append((x << 30) + h)", "- if len(Q) == 0 or X[-1][0] <= Q[0][0]:", "- x, h = X.pop()", "+ if len(Q) == 0 or X[-1] >> 30 <= Q[0][0]:", "+ xh = X.pop()", "+ x, h = xh >> 30, xh % (1 << 30)" ]
false
0.046514
0.043635
1.065964
[ "s684914501", "s860608878" ]
u816587940
p02804
python
s792424584
s901436000
1,091
566
73,488
37,856
Accepted
Accepted
48.12
#---------------------------------------------------------- P = 10**9 + 7 N = 500000 #使える最大値、値に注意 inv = [0] + [1] # 1/x finv = [1] + [1] # 1/x! fac = [1] + [1] # x! for i in range(2,N): inv += [inv[P % i] * (P - int(P / i)) % P] fac += [(fac[i-1] * i) % P] finv += [(finv[i-1] * inv[i]) % P] def comb(a...
#---------------------------------------------------------- P = 10**9 + 7 N = 200000 #使える最大値、値に注意 inv = [0] + [1] # 1/x finv = [1] + [1] # 1/x! fac = [1] + [1] # x! for i in range(2,N): inv += [inv[P % i] * (P - int(P / i)) % P] fac += [(fac[i-1] * i) % P] finv += [(finv[i-1] * inv[i]) % P] def comb(a...
41
41
1,084
1,084
# ---------------------------------------------------------- P = 10**9 + 7 N = 500000 # 使える最大値、値に注意 inv = [0] + [1] # 1/x finv = [1] + [1] # 1/x! fac = [1] + [1] # x! for i in range(2, N): inv += [inv[P % i] * (P - int(P / i)) % P] fac += [(fac[i - 1] * i) % P] finv += [(finv[i - 1] * inv[i]) % P] def...
# ---------------------------------------------------------- P = 10**9 + 7 N = 200000 # 使える最大値、値に注意 inv = [0] + [1] # 1/x finv = [1] + [1] # 1/x! fac = [1] + [1] # x! for i in range(2, N): inv += [inv[P % i] * (P - int(P / i)) % P] fac += [(fac[i - 1] * i) % P] finv += [(finv[i - 1] * inv[i]) % P] def...
false
0
[ "-N = 500000 # 使える最大値、値に注意", "+N = 200000 # 使える最大値、値に注意" ]
false
1.139524
0.437522
2.604495
[ "s792424584", "s901436000" ]
u810356688
p02984
python
s944136680
s602705646
115
86
14,616
19,100
Accepted
Accepted
25.22
import sys def input(): return sys.stdin.readline().rstrip() def main(): n=int(eval(input())) A=list(map(int,input().split())) B=[0]*n B[0]=sum(A)-sum(A[1::2])*2 for i in range(1,n): B[i]=(A[i-1]-B[i-1]//2)*2 print((*B)) if __name__=='__main__': main()
import sys def input(): return sys.stdin.readline().rstrip() def main(): n=int(eval(input())) A=list(map(int,input().split())) B=[0]*n B[0]=sum(A)-sum(A[1::2])*2 for i in range(1,n): B[i]=(A[i-1]-B[i-1]//2)*2 print((' '.join(map(str,B)))) if __name__=='__main__': mai...
13
13
297
315
import sys def input(): return sys.stdin.readline().rstrip() def main(): n = int(eval(input())) A = list(map(int, input().split())) B = [0] * n B[0] = sum(A) - sum(A[1::2]) * 2 for i in range(1, n): B[i] = (A[i - 1] - B[i - 1] // 2) * 2 print((*B)) if __name__ == "__main__": ...
import sys def input(): return sys.stdin.readline().rstrip() def main(): n = int(eval(input())) A = list(map(int, input().split())) B = [0] * n B[0] = sum(A) - sum(A[1::2]) * 2 for i in range(1, n): B[i] = (A[i - 1] - B[i - 1] // 2) * 2 print((" ".join(map(str, B)))) if __name_...
false
0
[ "- print((*B))", "+ print((\" \".join(map(str, B))))" ]
false
0.077162
0.087412
0.882735
[ "s944136680", "s602705646" ]
u747602774
p02793
python
s595887981
s468475648
1,879
1,315
4,084
17,448
Accepted
Accepted
30.02
#a,bの最大公約数 def gcd(a,b): while b: a,b = b,a%b return a #a,bの最小公倍数 def lcm(a,b): return a*b//gcd(a,b) N = int(eval(input())) A = list(map(int,input().split())) l = A[0] for i in range(1,N): l = lcm(l,A[i]) P = 10**9+7 ans = 0 for i in range(N): ans += l//A[i] print((a...
#べき乗関数powを使った逆元の計算(modinvよりもPythonでは高速、PyPyだと遅い) def modinv(a,m): return pow(a,m-2,m) #n以下の素数列挙(O(nlog(n)) def primes(n): ass = {} is_prime = [True for _ in range(n+1)] is_prime[0] = False is_prime[1] = False for i in range(2,int(n**0.5)+1): if not is_prime[i]: c...
22
57
319
1,195
# a,bの最大公約数 def gcd(a, b): while b: a, b = b, a % b return a # a,bの最小公倍数 def lcm(a, b): return a * b // gcd(a, b) N = int(eval(input())) A = list(map(int, input().split())) l = A[0] for i in range(1, N): l = lcm(l, A[i]) P = 10**9 + 7 ans = 0 for i in range(N): ans += l // A[i] print((an...
# べき乗関数powを使った逆元の計算(modinvよりもPythonでは高速、PyPyだと遅い) def modinv(a, m): return pow(a, m - 2, m) # n以下の素数列挙(O(nlog(n)) def primes(n): ass = {} is_prime = [True for _ in range(n + 1)] is_prime[0] = False is_prime[1] = False for i in range(2, int(n**0.5) + 1): if not is_prime[i]: ...
false
61.403509
[ "-# a,bの最大公約数", "-def gcd(a, b):", "- while b:", "- a, b = b, a % b", "- return a", "+# べき乗関数powを使った逆元の計算(modinvよりもPythonでは高速、PyPyだと遅い)", "+def modinv(a, m):", "+ return pow(a, m - 2, m)", "-# a,bの最小公倍数", "-def lcm(a, b):", "- return a * b // gcd(a, b)", "+# n以下の素数列挙(O(nlog(...
false
0.045712
0.470857
0.097083
[ "s595887981", "s468475648" ]
u573754721
p02947
python
s077765612
s481576059
642
378
60,504
17,848
Accepted
Accepted
41.12
n=int(eval(input())) d={} for i in range(n): s=''.join(sorted(eval(input()))) if s in d: d[s]+=1 else: d[s]=1 ans=0 for i in list(d.values()): ans+=(i*(i-1))//2 print(ans)
n=int(eval(input())) d={} for i in range(n): s=''.join(sorted(eval(input()))) if s in d: d[s]+=1 else: d[s]=1 ans=0 for i in list(d.values()): ans+=i*(i-1)//2 print(ans)
13
13
206
204
n = int(eval(input())) d = {} for i in range(n): s = "".join(sorted(eval(input()))) if s in d: d[s] += 1 else: d[s] = 1 ans = 0 for i in list(d.values()): ans += (i * (i - 1)) // 2 print(ans)
n = int(eval(input())) d = {} for i in range(n): s = "".join(sorted(eval(input()))) if s in d: d[s] += 1 else: d[s] = 1 ans = 0 for i in list(d.values()): ans += i * (i - 1) // 2 print(ans)
false
0
[ "- ans += (i * (i - 1)) // 2", "+ ans += i * (i - 1) // 2" ]
false
0.050807
0.035202
1.443313
[ "s077765612", "s481576059" ]
u969850098
p03043
python
s543998305
s692491625
42
34
6,296
3,188
Accepted
Accepted
19.05
import math N, K = list(map(int, input().split())) def func(dice): if dice >= K: return 1.0 return (1 / 2) ** math.ceil(math.log2(K / dice)) l = [func(dice) / N for dice in range(1, N + 1)] print((sum(l)))
import math N, K = list(map(int, input().split())) ans = 0 for n in range(1, N+1): if n >= K: ans += 1 continue ans += (1/2) ** math.ceil(math.log2(K / n)) print((ans / N))
10
11
224
200
import math N, K = list(map(int, input().split())) def func(dice): if dice >= K: return 1.0 return (1 / 2) ** math.ceil(math.log2(K / dice)) l = [func(dice) / N for dice in range(1, N + 1)] print((sum(l)))
import math N, K = list(map(int, input().split())) ans = 0 for n in range(1, N + 1): if n >= K: ans += 1 continue ans += (1 / 2) ** math.ceil(math.log2(K / n)) print((ans / N))
false
9.090909
[ "-", "-", "-def func(dice):", "- if dice >= K:", "- return 1.0", "- return (1 / 2) ** math.ceil(math.log2(K / dice))", "-", "-", "-l = [func(dice) / N for dice in range(1, N + 1)]", "-print((sum(l)))", "+ans = 0", "+for n in range(1, N + 1):", "+ if n >= K:", "+ ans ...
false
0.090728
0.060048
1.510942
[ "s543998305", "s692491625" ]
u368780724
p02564
python
s674215991
s720108117
2,026
1,828
284,776
285,484
Accepted
Accepted
9.77
import sys readline = sys.stdin.readline #非再帰 import sys def scc(Edge): N = len(Edge) Edgeinv = [[] for _ in range(N)] for vn in range(N): for vf in Edge[vn]: Edgeinv[vf].append(vn) used = [False]*N dim = [len(Edge[i]) for i in range(N)] order = [] for ...
import sys readline = sys.stdin.readline #非再帰 import sys def scc(Edge): N = len(Edge) Edgeinv = [[] for _ in range(N)] for vn in range(N): for vf in Edge[vn]: Edgeinv[vf].append(vn) used = [0]*N order = [] for st in range(N): if used[st]: ...
78
86
2,159
2,083
import sys readline = sys.stdin.readline # 非再帰 import sys def scc(Edge): N = len(Edge) Edgeinv = [[] for _ in range(N)] for vn in range(N): for vf in Edge[vn]: Edgeinv[vf].append(vn) used = [False] * N dim = [len(Edge[i]) for i in range(N)] order = [] for st in range(N...
import sys readline = sys.stdin.readline # 非再帰 import sys def scc(Edge): N = len(Edge) Edgeinv = [[] for _ in range(N)] for vn in range(N): for vf in Edge[vn]: Edgeinv[vf].append(vn) used = [0] * N order = [] for st in range(N): if used[st]: continue ...
false
9.302326
[ "- used = [False] * N", "- dim = [len(Edge[i]) for i in range(N)]", "+ used = [0] * N", "- if not used[st]:", "- stack = [st, 0]", "- while stack:", "- vn, i = stack[-2], stack[-1]", "- if not i and used[vn]:", "- ...
false
0.050016
0.043738
1.143532
[ "s674215991", "s720108117" ]
u827624348
p02787
python
s135268984
s282145333
489
296
120,048
40,688
Accepted
Accepted
39.47
import sys sys.setrecursionlimit(1000000) # 再帰上限を増やす def main(): input = sys.stdin.readline # 文字列に対してinputした場合は、rstripするのを忘れずに! H, N = list(map(int, input().rstrip().split())) magic_list = [] for _ in range(N): A, B = list(map(int, input().rstrip().split())) magic_list.append(...
import sys sys.setrecursionlimit(1000000) # 再帰上限を増やす def main(): input = sys.stdin.readline # 文字列に対してinputした場合は、rstripするのを忘れずに! H, N = list(map(int, input().rstrip().split())) magic_list = [] for _ in range(N): A, B = list(map(int, input().rstrip().split())) magic_list.append(...
25
27
868
834
import sys sys.setrecursionlimit(1000000) # 再帰上限を増やす def main(): input = sys.stdin.readline # 文字列に対してinputした場合は、rstripするのを忘れずに! H, N = list(map(int, input().rstrip().split())) magic_list = [] for _ in range(N): A, B = list(map(int, input().rstrip().split())) magic_list.append((A, B)...
import sys sys.setrecursionlimit(1000000) # 再帰上限を増やす def main(): input = sys.stdin.readline # 文字列に対してinputした場合は、rstripするのを忘れずに! H, N = list(map(int, input().rstrip().split())) magic_list = [] for _ in range(N): A, B = list(map(int, input().rstrip().split())) magic_list.append((A, B)...
false
7.407407
[ "- dp = [[100000000] * (H + 1) for _ in range(N + 1)]", "- # dp[i][hp] = i番目までの魔法を使って、hpのダメージを与えるための最小魔力", "- dp[0][0] = 0", "+ # dp[hp] = hpのダメージを与えるための最小魔力", "+ dp = [100000000] * (H + 1)", "+ # 0のダメージを与えるのに必要な最小魔力は0", "+ dp[0] = 0", "+ # 各魔法に関して探索", "+ # 各ダメージを与えるのに...
false
0.312342
0.078933
3.957048
[ "s135268984", "s282145333" ]
u056977516
p02642
python
s678682900
s112631403
329
263
37,124
164,240
Accepted
Accepted
20.06
# ANSHUL GAUTAM # IIIT-D from math import * from copy import * # ll = deepcopy(l) from heapq import * # heappush(hp,x) from string import * # alpha = ascii_lowercase from random import * # l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference from bisect import * # bisect_left(...
# ANSHUL GAUTAM # IIIT-D from math import * from copy import * # ll = deepcopy(l) from heapq import * # heappush(hp,x) from string import * # alpha = ascii_lowercase from random import * # l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference from bisect import * # bisect_left(...
42
44
1,274
1,275
# ANSHUL GAUTAM # IIIT-D from math import * from copy import * # ll = deepcopy(l) from heapq import * # heappush(hp,x) from string import * # alpha = ascii_lowercase from random import * # l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference from bisect import * # bisect_left(arr,x,start,end) => ...
# ANSHUL GAUTAM # IIIT-D from math import * from copy import * # ll = deepcopy(l) from heapq import * # heappush(hp,x) from string import * # alpha = ascii_lowercase from random import * # l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference from bisect import * # bisect_left(arr,x,start,end) => ...
false
4.545455
[ "+ ans, maxx = 0, max(l)", "+ done = [0] * (maxx + 1)", "- maxx, ans = max(l), 0", "- cancel, p = [0] * (maxx + 1), [0] * (maxx + 1)", "+ ans = 0", "+ d = dict(Counter(l))", "- p[i] += 1", "+ zz = 2", "+ while i * zz <= maxx:", "+ done[i * zz] = 1"...
false
0.160458
0.144281
1.112124
[ "s678682900", "s112631403" ]
u596276291
p04012
python
s330957437
s255838214
35
20
3,444
3,316
Accepted
Accepted
42.86
from collections import Counter def main(): w = eval(input()) c = Counter(w) for k, v in list(c.items()): if v % 2 != 0: print("No") return print("Yes") if __name__ == '__main__': main()
from collections import defaultdict def main(): w = eval(input()) for s in w: if w.count(s) % 2 != 0: print("No") return print("Yes") if __name__ == '__main__': main()
16
14
247
227
from collections import Counter def main(): w = eval(input()) c = Counter(w) for k, v in list(c.items()): if v % 2 != 0: print("No") return print("Yes") if __name__ == "__main__": main()
from collections import defaultdict def main(): w = eval(input()) for s in w: if w.count(s) % 2 != 0: print("No") return print("Yes") if __name__ == "__main__": main()
false
12.5
[ "-from collections import Counter", "+from collections import defaultdict", "- c = Counter(w)", "- for k, v in list(c.items()):", "- if v % 2 != 0:", "+ for s in w:", "+ if w.count(s) % 2 != 0:" ]
false
0.103299
0.085429
1.209183
[ "s330957437", "s255838214" ]
u968166680
p02954
python
s785642131
s010787919
109
96
93,236
96,652
Accepted
Accepted
11.93
import sys from itertools import groupby read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): S = readline().strip() N = len(S) M = 10 ** 5 K = len(bin(M)) - 2 A = [[0] * N for...
import sys readline = sys.stdin.readline def main(): S = readline().strip() N = len(S) M = 10 ** 5 K = len(bin(M)) - 2 A = [[0] * N for _ in range(K)] for i, c in enumerate(S): if c == 'R': A[0][i] += i + 1 else: A[0][i] += i - 1 ...
44
38
842
709
import sys from itertools import groupby read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 def main(): S = readline().strip() N = len(S) M = 10**5 K = len(bin(M)) - 2 A = [[0] * N for _ in range(K)] ...
import sys readline = sys.stdin.readline def main(): S = readline().strip() N = len(S) M = 10**5 K = len(bin(M)) - 2 A = [[0] * N for _ in range(K)] for i, c in enumerate(S): if c == "R": A[0][i] += i + 1 else: A[0][i] += i - 1 for k in range(K - 1)...
false
13.636364
[ "-from itertools import groupby", "-read = sys.stdin.read", "-readlines = sys.stdin.readlines", "-sys.setrecursionlimit(10**9)", "-INF = 1 << 60", "-MOD = 1000000007", "- print((*ans))", "+ print((\" \".join(map(str, ans))))" ]
false
0.049415
0.04542
1.087964
[ "s785642131", "s010787919" ]
u426534722
p02370
python
s703489008
s695292035
140
120
11,388
11,192
Accepted
Accepted
14.29
from sys import stdin from collections import deque n, e = map(int, stdin.readline().split()) G = [[] for _ in [0] * n] indeg = [0] * n out = [] V = [False] * n def bfs(s): dq = deque([s]) V[s] = True while dq: u = dq.popleft() out.append(u) for i in range(len(G[u])): ...
from sys import stdin from collections import deque V, E = map(int, stdin.readline().split()) adj_list = [[] for _ in [0] * V] is_visited = [False] * V for _ in [0] * E: s, t = map(int, stdin.readline().split()) adj_list[s].append(t) out = deque() def dfs(u): is_visited[u] = True for v in adj...
31
19
785
489
from sys import stdin from collections import deque n, e = map(int, stdin.readline().split()) G = [[] for _ in [0] * n] indeg = [0] * n out = [] V = [False] * n def bfs(s): dq = deque([s]) V[s] = True while dq: u = dq.popleft() out.append(u) for i in range(len(G[u])): ...
from sys import stdin from collections import deque V, E = map(int, stdin.readline().split()) adj_list = [[] for _ in [0] * V] is_visited = [False] * V for _ in [0] * E: s, t = map(int, stdin.readline().split()) adj_list[s].append(t) out = deque() def dfs(u): is_visited[u] = True for v in adj_list[u]...
false
38.709677
[ "-n, e = map(int, stdin.readline().split())", "-G = [[] for _ in [0] * n]", "-indeg = [0] * n", "-out = []", "-V = [False] * n", "+V, E = map(int, stdin.readline().split())", "+adj_list = [[] for _ in [0] * V]", "+is_visited = [False] * V", "+for _ in [0] * E:", "+ s, t = map(int, stdin.readlin...
false
0.109496
0.04647
2.356254
[ "s703489008", "s695292035" ]
u923279197
p02863
python
s822624263
s926799841
1,713
1,473
194,436
177,032
Accepted
Accepted
14.01
N,T = list(map(int,input().split())) data = [list(map(int,input().split())) for _ in range(N)] dp1 = [[0 for n in range(N+1)] for t in range(T+1)] #dp1[t][n] := (data[:n]の中からtまでに食べ切る範囲で美味しく) dp2 = [[0 for n in range(N+1)] for t in range(T+1)] #dp1[t][n] := (data[:n]の中からt-1までに注文する範囲で美味しく) for t in range(1,T+1)...
import sys input = sys.stdin.readline N,T = list(map(int,input().split())) data = [list(map(int,input().split())) for _ in range(N)] dp1 = [[0]*(N+1) for t in range(T+1)] #dp1[t][n] := (data[:n]の中からtまでに食べ切る範囲で美味しく) dp2 = [[0]*(N+1) for t in range(T+1)] #dp1[t][n] := (data[:n]の中からt-1までに注文する範囲で美味しく) for t in ...
18
20
706
718
N, T = list(map(int, input().split())) data = [list(map(int, input().split())) for _ in range(N)] dp1 = [ [0 for n in range(N + 1)] for t in range(T + 1) ] # dp1[t][n] := (data[:n]の中からtまでに食べ切る範囲で美味しく) dp2 = [ [0 for n in range(N + 1)] for t in range(T + 1) ] # dp1[t][n] := (data[:n]の中からt-1までに注文する範囲で美味しく) for ...
import sys input = sys.stdin.readline N, T = list(map(int, input().split())) data = [list(map(int, input().split())) for _ in range(N)] dp1 = [ [0] * (N + 1) for t in range(T + 1) ] # dp1[t][n] := (data[:n]の中からtまでに食べ切る範囲で美味しく) dp2 = [ [0] * (N + 1) for t in range(T + 1) ] # dp1[t][n] := (data[:n]の中からt-1までに注文...
false
10
[ "+import sys", "+", "+input = sys.stdin.readline", "- [0 for n in range(N + 1)] for t in range(T + 1)", "+ [0] * (N + 1) for t in range(T + 1)", "- [0 for n in range(N + 1)] for t in range(T + 1)", "+ [0] * (N + 1) for t in range(T + 1)" ]
false
0.05706
0.06531
0.873677
[ "s822624263", "s926799841" ]
u551083572
p02316
python
s516657843
s986178541
1,640
1,240
18,136
17,888
Accepted
Accepted
24.39
# coding: utf-8 def array2d(row, col, init = None): return [[init for _ in range(col)] for _ in range(row)] N, W = list(map(int, input().split(" "))) v = [] w = [] for i in range(N): vi, wi = list(map(int, input().split(" "))) v.append(vi) w.append(wi) dpt = array2d(N + 1, W + ...
# coding: utf-8 """docstring""" def arr2d(d1, d2, init=None): return [[init for i in range(d2)] for j in range(d1)] def solve(N, W): v = [None] * N w = [None] * N for i in range(N): v[i], w[i] = list(map(int, input().split())) # dp[i][j]: item 0..i ??????weight sum <= j ??...
36
36
834
905
# coding: utf-8 def array2d(row, col, init=None): return [[init for _ in range(col)] for _ in range(row)] N, W = list(map(int, input().split(" "))) v = [] w = [] for i in range(N): vi, wi = list(map(int, input().split(" "))) v.append(vi) w.append(wi) dpt = array2d(N + 1, W + 1) def dp(i, j): if ...
# coding: utf-8 """docstring""" def arr2d(d1, d2, init=None): return [[init for i in range(d2)] for j in range(d1)] def solve(N, W): v = [None] * N w = [None] * N for i in range(N): v[i], w[i] = list(map(int, input().split())) # dp[i][j]: item 0..i ??????weight sum <= j ??¨??????????????...
false
0
[ "-def array2d(row, col, init=None):", "- return [[init for _ in range(col)] for _ in range(row)]", "+\"\"\"docstring\"\"\"", "-N, W = list(map(int, input().split(\" \")))", "-v = []", "-w = []", "-for i in range(N):", "- vi, wi = list(map(int, input().split(\" \")))", "- v.append(vi)", "-...
false
0.050853
0.050088
1.015282
[ "s516657843", "s986178541" ]
u143322814
p02712
python
s022117683
s261307734
156
108
9,164
9,176
Accepted
Accepted
30.77
n = int(eval(input())) ans = 0 for i in range(1, n+1): if not (i % 3 == 0 or i % 5 == 0): ans += i print(ans)
def main(): n = int(eval(input())) ans = 0 for i in range(1, n+1): if not (i % 3 == 0 or i % 5 == 0): ans += i print(ans) if __name__ == "__main__": main()
7
11
122
201
n = int(eval(input())) ans = 0 for i in range(1, n + 1): if not (i % 3 == 0 or i % 5 == 0): ans += i print(ans)
def main(): n = int(eval(input())) ans = 0 for i in range(1, n + 1): if not (i % 3 == 0 or i % 5 == 0): ans += i print(ans) if __name__ == "__main__": main()
false
36.363636
[ "-n = int(eval(input()))", "-ans = 0", "-for i in range(1, n + 1):", "- if not (i % 3 == 0 or i % 5 == 0):", "- ans += i", "-print(ans)", "+def main():", "+ n = int(eval(input()))", "+ ans = 0", "+ for i in range(1, n + 1):", "+ if not (i % 3 == 0 or i % 5 == 0):", "+...
false
0.30885
0.134488
2.296482
[ "s022117683", "s261307734" ]
u816587940
p02713
python
s003911198
s024246906
1,969
957
9,104
9,204
Accepted
Accepted
51.4
k = int(eval(input())) """ memo = [[-1 for i in range(k+1)] for j in range(k+1)] def gcd(a, b): if b == 0: return a else: if memo[a][b] == -1: memo[a][b] = gcd(b, a % b) return memo[a][b] """ def my_gcd(a, b): if a < b: a, b = b, a c = a % b if c...
k = int(eval(input())) def gcd(a, b): if a < b: a, b = b, a c = a % b if c == 0: return b while c!=0: c = a % b a = b b = c return a ans = 0 for a in range(1, k+1): for b in range(1, k+1): t = gcd(a, b) if t == 1: ans += k ...
30
22
579
409
k = int(eval(input())) """ memo = [[-1 for i in range(k+1)] for j in range(k+1)] def gcd(a, b): if b == 0: return a else: if memo[a][b] == -1: memo[a][b] = gcd(b, a % b) return memo[a][b] """ def my_gcd(a, b): if a < b: a, b = b, a c = a % b if c == 0: ...
k = int(eval(input())) def gcd(a, b): if a < b: a, b = b, a c = a % b if c == 0: return b while c != 0: c = a % b a = b b = c return a ans = 0 for a in range(1, k + 1): for b in range(1, k + 1): t = gcd(a, b) if t == 1: ans ...
false
26.666667
[ "-\"\"\"", "-memo = [[-1 for i in range(k+1)] for j in range(k+1)]", "-def gcd(a, b):", "- if b == 0:", "- return a", "- else:", "- if memo[a][b] == -1:", "- memo[a][b] = gcd(b, a % b)", "- return memo[a][b]", "-\"\"\"", "-def my_gcd(a, b):", "+def gcd(a, ...
false
0.119979
0.08129
1.475924
[ "s003911198", "s024246906" ]
u670180528
p03157
python
s392033563
s990538247
558
386
4,468
4,468
Accepted
Accepted
30.82
t,*grid=open(0) h,w=list(map(int,t.split())) vis=[[False]*w for _ in range(h)] ans=0 for y in range(h): for x in range(w): if vis[y][x]: continue q=[(y,x)] d={"#":0,".":0} while q: cy,cx=q.pop(0) for ny,nx in ((cy+1,cx),(cy-1,cx),(cy,cx+1),(cy,cx-1)): if not (0<=ny<h and 0<=nx<w) or v...
def main(): t, *grid = open(0) h, w = list(map(int, t.split())) vis = [[False] * w for _ in range(h)] ans = 0 for y in range(h): for x in range(w): if vis[y][x]: continue q = [(y, x, grid[y][x])] d = {"#": 0, ".": 0} while q: cy, cx, cc = q.pop(0) for ny, nx in ((cy + 1, cx),...
20
25
474
626
t, *grid = open(0) h, w = list(map(int, t.split())) vis = [[False] * w for _ in range(h)] ans = 0 for y in range(h): for x in range(w): if vis[y][x]: continue q = [(y, x)] d = {"#": 0, ".": 0} while q: cy, cx = q.pop(0) for ny, nx in ((cy + 1, cx),...
def main(): t, *grid = open(0) h, w = list(map(int, t.split())) vis = [[False] * w for _ in range(h)] ans = 0 for y in range(h): for x in range(w): if vis[y][x]: continue q = [(y, x, grid[y][x])] d = {"#": 0, ".": 0} while q: ...
false
20
[ "-t, *grid = open(0)", "-h, w = list(map(int, t.split()))", "-vis = [[False] * w for _ in range(h)]", "-ans = 0", "-for y in range(h):", "- for x in range(w):", "- if vis[y][x]:", "- continue", "- q = [(y, x)]", "- d = {\"#\": 0, \".\": 0}", "- while q:"...
false
0.037172
0.038551
0.964234
[ "s392033563", "s990538247" ]
u079022693
p02887
python
s333638353
s996710432
49
34
3,316
3,316
Accepted
Accepted
30.61
N=int(eval(input())) S=eval(input()) count=0 a="" for i in range(N): if a!=S[i]: a=S[i] count+=1 print(count)
def main(): N=int(eval(input())) S=eval(input()) c=1 for i in range(N): if i==0: s=S[i] else: if s==S[i]: pass else: s=S[i] c+=1 print(c) if __name__=="__main__": main()
10
16
122
296
N = int(eval(input())) S = eval(input()) count = 0 a = "" for i in range(N): if a != S[i]: a = S[i] count += 1 print(count)
def main(): N = int(eval(input())) S = eval(input()) c = 1 for i in range(N): if i == 0: s = S[i] else: if s == S[i]: pass else: s = S[i] c += 1 print(c) if __name__ == "__main__": main()
false
37.5
[ "-N = int(eval(input()))", "-S = eval(input())", "-count = 0", "-a = \"\"", "-for i in range(N):", "- if a != S[i]:", "- a = S[i]", "- count += 1", "-print(count)", "+def main():", "+ N = int(eval(input()))", "+ S = eval(input())", "+ c = 1", "+ for i in range(...
false
0.058032
0.037972
1.528288
[ "s333638353", "s996710432" ]
u175034939
p03624
python
s292579319
s521101177
22
20
3,956
3,188
Accepted
Accepted
9.09
a = list(eval(input())) aa = list(set(a)) alpha = [chr(i) for i in range(97,97+26)] if len(aa) == 26: print('None') else: for i in range(26): if alpha[i] not in a: print((alpha[i])) break
s = eval(input()) s = set(s) for a in 'abcdefghijklmnopqrstuvwxyz': if a not in s: print(a) break else: print('None')
12
9
232
144
a = list(eval(input())) aa = list(set(a)) alpha = [chr(i) for i in range(97, 97 + 26)] if len(aa) == 26: print("None") else: for i in range(26): if alpha[i] not in a: print((alpha[i])) break
s = eval(input()) s = set(s) for a in "abcdefghijklmnopqrstuvwxyz": if a not in s: print(a) break else: print("None")
false
25
[ "-a = list(eval(input()))", "-aa = list(set(a))", "-alpha = [chr(i) for i in range(97, 97 + 26)]", "-if len(aa) == 26:", "+s = eval(input())", "+s = set(s)", "+for a in \"abcdefghijklmnopqrstuvwxyz\":", "+ if a not in s:", "+ print(a)", "+ break", "+else:", "-else:", "- f...
false
0.041218
0.041751
0.987237
[ "s292579319", "s521101177" ]
u379959788
p03556
python
s787246220
s732506225
57
28
2,940
2,940
Accepted
Accepted
50.88
# ABC077-B import math def check(N): n = math.sqrt(N) return math.floor(n) == math.ceil(n) N = int(eval(input())) flag = False for i in range(N, 0, -1): flag = check(i) if flag: print(i) break
# ABC077-B 模範解答 N = int(eval(input())) for i in range(1, N+2): if i ** 2 > N: print(((i - 1) ** 2)) break
13
6
239
122
# ABC077-B import math def check(N): n = math.sqrt(N) return math.floor(n) == math.ceil(n) N = int(eval(input())) flag = False for i in range(N, 0, -1): flag = check(i) if flag: print(i) break
# ABC077-B 模範解答 N = int(eval(input())) for i in range(1, N + 2): if i**2 > N: print(((i - 1) ** 2)) break
false
53.846154
[ "-# ABC077-B", "-import math", "-", "-", "-def check(N):", "- n = math.sqrt(N)", "- return math.floor(n) == math.ceil(n)", "-", "-", "+# ABC077-B 模範解答", "-flag = False", "-for i in range(N, 0, -1):", "- flag = check(i)", "- if flag:", "- print(i)", "+for i in range(1...
false
0.047606
0.039247
1.212993
[ "s787246220", "s732506225" ]