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
u678167152
p02585
python
s257205872
s219191503
1,149
986
91,196
107,092
Accepted
Accepted
14.19
def solve(): ans = -float('inf') N, K = list(map(int, input().split())) P = list([int(x)-1 for x in input().split()]) C = list(map(int, input().split())) for i in range(N): score = 0 now = i visited = [-1]*N scores = [0]*N visited[now] = 0 for j in range(1,K+1): now =...
import numpy as np import numba from numba import njit, b1, i4, i8, f8 @njit((i8,i8,i8[:],i8[:]), cache=True) def main(N,K,P,C): INF = 1<<30 ans = -INF for i in range(N): score = 0 now = i visited = np.full(N,-1,np.int64) scores = np.zeros(N,np.int64) visited[now] = 0 for j ...
36
44
857
1,040
def solve(): ans = -float("inf") N, K = list(map(int, input().split())) P = list([int(x) - 1 for x in input().split()]) C = list(map(int, input().split())) for i in range(N): score = 0 now = i visited = [-1] * N scores = [0] * N visited[now] = 0 for j ...
import numpy as np import numba from numba import njit, b1, i4, i8, f8 @njit((i8, i8, i8[:], i8[:]), cache=True) def main(N, K, P, C): INF = 1 << 30 ans = -INF for i in range(N): score = 0 now = i visited = np.full(N, -1, np.int64) scores = np.zeros(N, np.int64) vis...
false
18.181818
[ "-def solve():", "- ans = -float(\"inf\")", "- N, K = list(map(int, input().split()))", "- P = list([int(x) - 1 for x in input().split()])", "- C = list(map(int, input().split()))", "+import numpy as np", "+import numba", "+from numba import njit, b1, i4, i8, f8", "+", "+", "+@njit((...
false
0.045608
0.566038
0.080575
[ "s257205872", "s219191503" ]
u619850971
p02947
python
s478022289
s793437792
499
452
39,428
39,040
Accepted
Accepted
9.42
from collections import Counter N=int(eval(input())) S = [] for i in range(N): S.append(list(eval(input()))) # Counterは要素を数え上げる cnt = Counter() ans = 0 for s in S: # 単語をアナグラムの判別がしやすように並び替え a = ''.join(sorted(list(s))) # cntの中に同じものがあればカウント if a in cnt: # ans += 1 じゃダメ こ...
# collection.Counterを使わなくても同じようにできる n=int(eval(input())) s = [] for i in range(n): s.append(list(eval(input()))) d = {} ans = 0 for i in s: a = [c for c in i] a.sort() a = "".join(a) if a in d: ans += d[a] d[a] += 1 else: d[a] = 1 print(ans)
20
18
419
301
from collections import Counter N = int(eval(input())) S = [] for i in range(N): S.append(list(eval(input()))) # Counterは要素を数え上げる cnt = Counter() ans = 0 for s in S: # 単語をアナグラムの判別がしやすように並び替え a = "".join(sorted(list(s))) # cntの中に同じものがあればカウント if a in cnt: # ans += 1 じゃダメ ここがcollection.Cou...
# collection.Counterを使わなくても同じようにできる n = int(eval(input())) s = [] for i in range(n): s.append(list(eval(input()))) d = {} ans = 0 for i in s: a = [c for c in i] a.sort() a = "".join(a) if a in d: ans += d[a] d[a] += 1 else: d[a] = 1 print(ans)
false
10
[ "-from collections import Counter", "-", "-N = int(eval(input()))", "-S = []", "-for i in range(N):", "- S.append(list(eval(input())))", "- # Counterは要素を数え上げる", "-cnt = Counter()", "+# collection.Counterを使わなくても同じようにできる", "+n = int(eval(input()))", "+s = []", "+for i in range(n):", "+ ...
false
0.04192
0.042529
0.985676
[ "s478022289", "s793437792" ]
u503227287
p02546
python
s817794124
s254795584
94
66
61,748
61,984
Accepted
Accepted
29.79
from sys import stdin def main(): _in = [_.rstrip() for _ in stdin.readlines()] S = list(_in[0]) # type:str # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ans = 0 if S[-1] == 's': S[-1] += 'es' else: S[-1] += 's' ans = ''.join(S) # ^^^^^^^^^^^^^^^^^...
from sys import stdin def ans(): _in = [_.rstrip() for _ in stdin.readlines()] S = _in[0] # type:str # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv if S[-1] == 's': S += 'es' else: S += 's' ans = S # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...
19
33
415
739
from sys import stdin def main(): _in = [_.rstrip() for _ in stdin.readlines()] S = list(_in[0]) # type:str # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ans = 0 if S[-1] == "s": S[-1] += "es" else: S[-1] += "s" ans = "".join(S) # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
from sys import stdin def ans(): _in = [_.rstrip() for _ in stdin.readlines()] S = _in[0] # type:str # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv if S[-1] == "s": S += "es" else: S += "s" ans = S # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print(ans)...
false
42.424242
[ "+", "+", "+def ans():", "+ _in = [_.rstrip() for _ in stdin.readlines()]", "+ S = _in[0] # type:str", "+ # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv", "+ if S[-1] == \"s\":", "+ S += \"es\"", "+ else:", "+ S += \"s\"", "+ ans = S", "+ # ^^^^^^^^^^...
false
0.044541
0.044756
0.9952
[ "s817794124", "s254795584" ]
u646818123
p03836
python
s478037143
s044810334
19
17
3,192
3,064
Accepted
Accepted
10.53
#Back and Forth #四角形を描くようにして移動する #次に,四角形より最初と最後1つずらした形を構成する. def sign(x): if x > 0: return 1 if x == 0: return 0 return -1 def solve(): move_x = ["", "R", "L"] move_y = ["", "U", "D"] sx, sy, tx, ty = list(map(int, input().split())) dx = tx ...
def sign(x): if x > 0: return 1 if x == 0: return 0 return -1 def solve(): move_x = ["", "R", "L"] move_y = ["", "U", "D"] sx, sy, tx, ty = list(map(int, input().split())) dx = tx - sx dy = ty - sy outward = "" homeward = "" ...
64
31
1,715
797
# Back and Forth # 四角形を描くようにして移動する # 次に,四角形より最初と最後1つずらした形を構成する. def sign(x): if x > 0: return 1 if x == 0: return 0 return -1 def solve(): move_x = ["", "R", "L"] move_y = ["", "U", "D"] sx, sy, tx, ty = list(map(int, input().split())) dx = tx - sx dy = ty - sy outw...
def sign(x): if x > 0: return 1 if x == 0: return 0 return -1 def solve(): move_x = ["", "R", "L"] move_y = ["", "U", "D"] sx, sy, tx, ty = list(map(int, input().split())) dx = tx - sx dy = ty - sy outward = "" homeward = "" outward = move_x[sign(dx)] * abs(...
false
51.5625
[ "-# Back and Forth", "-# 四角形を描くようにして移動する", "-# 次に,四角形より最初と最後1つずらした形を構成する.", "- if dx == 0 and dy == 0:", "- print()", "- return", "- if dx == 0:", "- outward = move_y[sign(dy)] * abs(dy)", "- homeward = move_y[-sign(dy)] * abs(dy)", "- fir_route = outward +...
false
0.046197
0.040159
1.150358
[ "s478037143", "s044810334" ]
u285681431
p02550
python
s804553824
s380955929
92
85
91,324
85,652
Accepted
Accepted
7.61
from collections import defaultdict N, X, M = list(map(int, input().split())) A = [X] visited = set() visited.add(X) idx = defaultdict() idx[X] = 0 iii = -1 for i in range(1, M): tmp = (A[-1]**2) % M if tmp not in visited: A.append(tmp) visited.add(tmp) idx[tmp] = i ...
from collections import defaultdict N, X, M = list(map(int, input().split())) A = [X] visited = set() visited.add(X) idx = defaultdict() idx[X] = 0 iii = -1 for i in range(1, M): tmp = (A[-1]**2) % M if tmp not in visited: A.append(tmp) visited.add(tmp) idx[tmp] = i ...
35
40
589
703
from collections import defaultdict N, X, M = list(map(int, input().split())) A = [X] visited = set() visited.add(X) idx = defaultdict() idx[X] = 0 iii = -1 for i in range(1, M): tmp = (A[-1] ** 2) % M if tmp not in visited: A.append(tmp) visited.add(tmp) idx[tmp] = i else: ...
from collections import defaultdict N, X, M = list(map(int, input().split())) A = [X] visited = set() visited.add(X) idx = defaultdict() idx[X] = 0 iii = -1 for i in range(1, M): tmp = (A[-1] ** 2) % M if tmp not in visited: A.append(tmp) visited.add(tmp) idx[tmp] = i else: ...
false
12.5
[ "-# ループの頭の直前まで", "-ans += sum(A[:iii])", "-N -= iii", "-if N > 0:", "- # ループの長さ", "- l = len(A) - iii", "- ans += (N // l) * sum(A[iii:])", "- N -= N // l * l", "-if N > 0:", "- # ループに満たないN", "- ans += sum(A[iii : iii + N])", "-print(ans)", "-exit()", "+if iii == -1:", ...
false
0.071334
0.069522
1.026057
[ "s804553824", "s380955929" ]
u408260374
p01545
python
s707450908
s259529902
1,460
1,250
27,744
18,960
Accepted
Accepted
14.38
import math import sys if sys.version[0] == '2': range, input = xrange, raw_input class FenwickTree: def __init__(self, a_list, f, default): # 0-indexed self.N = len(a_list) self.bit = a_list[:] self.f = f self.default = default for _ in range(self....
import math import sys if sys.version[0] == '2': range, input = xrange, raw_input class FenwickTree: def __init__(self, a_list, f, default): # 0-indexed self.N = len(a_list) self.bit = a_list[:] self.f = f self.default = default for _ in range(self....
38
38
1,092
1,059
import math import sys if sys.version[0] == "2": range, input = xrange, raw_input class FenwickTree: def __init__(self, a_list, f, default): # 0-indexed self.N = len(a_list) self.bit = a_list[:] self.f = f self.default = default for _ in range(self.N, 1 << int(...
import math import sys if sys.version[0] == "2": range, input = xrange, raw_input class FenwickTree: def __init__(self, a_list, f, default): # 0-indexed self.N = len(a_list) self.bit = a_list[:] self.f = f self.default = default for _ in range(self.N, 1 << int(...
false
0
[ "-for x, i in sorted((x, i) for i, x in enumerate(X)):", "- dp.update(i, dp.query(i) + x)", "+for x in X:", "+ dp.update(x - 1, dp.query(x - 1) + x)" ]
false
0.048934
0.111435
0.439124
[ "s707450908", "s259529902" ]
u294485299
p02689
python
s498362433
s461271159
339
228
98,148
91,676
Accepted
Accepted
32.74
n, m = list(map(int, input().split())) ans= 0 hs = list(map(int, input().split())) ds = {} ok = True for i in range(m): a,b = list(map(int, input().split())) if(a in ds): ds[a].append(b) if(b in ds): ds[b].append(a) if(a not in ds): ds[a] = [b] if(b not in ds): ...
import math def facts(n): ans = [] for i in range(1, int(math.sqrt(n)+1)): if(n%i==0): ans.append(i) ans.append(n//i) ans = sorted(ans) return ans n,m = list(map(int, input().split())) hs = list(map(int, input().split())) state = [1 for i in range(n)] for...
26
25
562
547
n, m = list(map(int, input().split())) ans = 0 hs = list(map(int, input().split())) ds = {} ok = True for i in range(m): a, b = list(map(int, input().split())) if a in ds: ds[a].append(b) if b in ds: ds[b].append(a) if a not in ds: ds[a] = [b] if b not in ds: ds[b] = ...
import math def facts(n): ans = [] for i in range(1, int(math.sqrt(n) + 1)): if n % i == 0: ans.append(i) ans.append(n // i) ans = sorted(ans) return ans n, m = list(map(int, input().split())) hs = list(map(int, input().split())) state = [1 for i in range(n)] for i in...
false
3.846154
[ "+import math", "+", "+", "+def facts(n):", "+ ans = []", "+ for i in range(1, int(math.sqrt(n) + 1)):", "+ if n % i == 0:", "+ ans.append(i)", "+ ans.append(n // i)", "+ ans = sorted(ans)", "+ return ans", "+", "+", "-ans = 0", "-ds = {}", "-ok...
false
0.075408
0.037611
2.004947
[ "s498362433", "s461271159" ]
u397020326
p02641
python
s491418232
s888474724
70
64
61,540
61,924
Accepted
Accepted
8.57
X, N = list(map(int, input().split())) if N == 0: ans = X else: p = list(map(int, input().split())) ans = 0 for i in range(200): if i in p: continue else: dis = i - X if dis < abs(ans - X): ans = i print(ans)
X, N = list(map(int, input().split())) if N == 0: ans = X else: p = list(map(int, input().split())) ans = 0 for i in range(200): if i in p: continue else: dis = abs(i - X) if dis < abs(ans - X): ans = i print(ans)
16
16
261
267
X, N = list(map(int, input().split())) if N == 0: ans = X else: p = list(map(int, input().split())) ans = 0 for i in range(200): if i in p: continue else: dis = i - X if dis < abs(ans - X): ans = i print(ans)
X, N = list(map(int, input().split())) if N == 0: ans = X else: p = list(map(int, input().split())) ans = 0 for i in range(200): if i in p: continue else: dis = abs(i - X) if dis < abs(ans - X): ans = i print(ans)
false
0
[ "- dis = i - X", "+ dis = abs(i - X)" ]
false
0.047764
0.047888
0.997409
[ "s491418232", "s888474724" ]
u285891772
p02975
python
s391449712
s566362063
81
63
21,924
21,820
Accepted
Accepted
22.22
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import item...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, log from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import i...
43
41
1,258
1,256
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log, ) from itertools import ( accumulate, permutations, combinations, ...
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, log, ) from itertools import ( accumulate, permutations, combi...
false
4.651163
[ "+ gcd,", "-from fractions import gcd", "-from decimal import Decimal", "+# mod = 998244353", "+# import numpy as np", "+# decimal.getcontext().prec = 10", "-a = LIST()", "-C = Counter(a)", "-A = sorted(set(a))", "-if len(A) == 1 and A[0] == 0:", "+A = LIST()", "+c = Counter(A)", "+a = li...
false
0.103562
0.043246
2.394734
[ "s391449712", "s566362063" ]
u761320129
p02989
python
s774979030
s511108460
136
76
14,120
14,396
Accepted
Accepted
44.12
from bisect import bisect N = int(eval(input())) D = list(map(int,input().split())) D.sort() ans = 0 for i in range(10**5+5): j = bisect(D, i) if j==N//2: ans += 1 elif j>N//2: break print(ans)
N = int(eval(input())) D = list(map(int,input().split())) D.sort() print((D[N//2] - D[N//2-1]))
13
4
228
90
from bisect import bisect N = int(eval(input())) D = list(map(int, input().split())) D.sort() ans = 0 for i in range(10**5 + 5): j = bisect(D, i) if j == N // 2: ans += 1 elif j > N // 2: break print(ans)
N = int(eval(input())) D = list(map(int, input().split())) D.sort() print((D[N // 2] - D[N // 2 - 1]))
false
69.230769
[ "-from bisect import bisect", "-", "-ans = 0", "-for i in range(10**5 + 5):", "- j = bisect(D, i)", "- if j == N // 2:", "- ans += 1", "- elif j > N // 2:", "- break", "-print(ans)", "+print((D[N // 2] - D[N // 2 - 1]))" ]
false
0.042391
0.046716
0.907422
[ "s774979030", "s511108460" ]
u588341295
p03213
python
s425984104
s994928235
103
23
3,064
3,440
Accepted
Accepted
77.67
# -*- coding: utf-8 -*- """ 解説参考 ・まず素因数分解で階乗全部バラす ・そこからいい感じの組み合わせを探して数える """ N = int(eval(input())) # 階乗の素因数分解:ひとつずつ分解したものを合算 e = [0] * (N+1) # 階乗の各値ループ for i in range(2, N+1): num = i # 素因数分解するループ for j in range(2, N+1): while num % j == 0: num //= j e[...
# -*- coding: utf-8 -*- import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range...
43
78
1,021
2,170
# -*- coding: utf-8 -*- """ 解説参考 ・まず素因数分解で階乗全部バラす ・そこからいい感じの組み合わせを探して数える """ N = int(eval(input())) # 階乗の素因数分解:ひとつずつ分解したものを合算 e = [0] * (N + 1) # 階乗の各値ループ for i in range(2, N + 1): num = i # 素因数分解するループ for j in range(2, N + 1): while num % j == 0: num //= j e[j] += 1 # 約数75(各...
# -*- coding: utf-8 -*- import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d ...
false
44.871795
[ "-\"\"\"", "-解説参考", "-・まず素因数分解で階乗全部バラす", "-・そこからいい感じの組み合わせを探して数える", "-\"\"\"", "-N = int(eval(input()))", "-# 階乗の素因数分解:ひとつずつ分解したものを合算", "-e = [0] * (N + 1)", "-# 階乗の各値ループ", "+import sys", "+from collections import Counter", "+", "+", "+def input():", "+ return sys.stdin.readline().str...
false
0.064736
0.067224
0.962987
[ "s425984104", "s994928235" ]
u368249389
p02726
python
s035379229
s889519984
368
323
79,708
78,812
Accepted
Accepted
12.23
# Problem D - Line++ # input N, X, Y = list(map(int, input().split())) # initialization INF = N kyori_graph = [[INF]*N for i in range(N)] kosu_list = [0]*(N-1) # graph search for i in range(N): for j in range(i+1, N): # グラフの更新 kyori_graph[i][j] = min(abs(j-i), abs(X-1-i)+1+abs(j-(Y-...
# Problem D - Line++ # input N, X, Y = list(map(int, input().split())) # initialization INF = N kyori_graph = [[INF]*N for i in range(N)] kosu_list = [0]*(N-1) # graph search for i in range(N): for j in range(i+1, N): # グラフの更新 kyori_graph[i][j] = min(abs(j-i), abs(X-1-i)+1+abs(j-(Y-...
25
26
525
535
# Problem D - Line++ # input N, X, Y = list(map(int, input().split())) # initialization INF = N kyori_graph = [[INF] * N for i in range(N)] kosu_list = [0] * (N - 1) # graph search for i in range(N): for j in range(i + 1, N): # グラフの更新 kyori_graph[i][j] = min( abs(j - i), abs(...
# Problem D - Line++ # input N, X, Y = list(map(int, input().split())) # initialization INF = N kyori_graph = [[INF] * N for i in range(N)] kosu_list = [0] * (N - 1) # graph search for i in range(N): for j in range(i + 1, N): # グラフの更新 kyori_graph[i][j] = min(abs(j - i), abs(X - 1 - i) + 1 + abs(j - ...
false
3.846154
[ "- kyori_graph[i][j] = min(", "- abs(j - i),", "- abs(X - 1 - i) + 1 + abs(j - (Y - 1)),", "- abs((Y - 1) - i) + 1 + abs(j - (X - 1)),", "- )", "+ kyori_graph[i][j] = min(abs(j - i), abs(X - 1 - i) + 1 + abs(j - (Y - 1)))", "+ # abs((Y-1)-i)+1...
false
0.040946
0.115391
0.354847
[ "s035379229", "s889519984" ]
u368796742
p03014
python
s893150476
s306080749
1,748
1,570
255,112
252,936
Accepted
Accepted
10.18
h,w = list(map(int,input().split())) l = [list(eval(input())) for i in range(h)] c1 = [[0 for i in range(w)] for i in range(h)] c2 = [[0 for i in range(w)] for i in range(h)] ans = 0 for i in range(h): for j in range(w): if c1[i][j] == 0: n = 0 while i+n < h: ...
h,w = list(map(int,input().split())) l = [list(eval(input())) for i in range(h)] c1 = [[0 for i in range(w)] for i in range(h)] c2 = [[0 for i in range(w)] for i in range(h)] ans = 0 for i in range(h): for j in range(w): if c1[i][j] == 0: n = 0 k = i while k...
32
36
802
888
h, w = list(map(int, input().split())) l = [list(eval(input())) for i in range(h)] c1 = [[0 for i in range(w)] for i in range(h)] c2 = [[0 for i in range(w)] for i in range(h)] ans = 0 for i in range(h): for j in range(w): if c1[i][j] == 0: n = 0 while i + n < h: if l...
h, w = list(map(int, input().split())) l = [list(eval(input())) for i in range(h)] c1 = [[0 for i in range(w)] for i in range(h)] c2 = [[0 for i in range(w)] for i in range(h)] ans = 0 for i in range(h): for j in range(w): if c1[i][j] == 0: n = 0 k = i while k < h: ...
false
11.111111
[ "- while i + n < h:", "- if l[i + n][j] == \".\":", "+ k = i", "+ while k < h:", "+ if l[k][j] == \".\":", "+ k += 1", "- for k in range(n):", "- c1[i + k][j] = n", "+ for r in rang...
false
0.08966
0.043576
2.057546
[ "s893150476", "s306080749" ]
u062147869
p03241
python
s893994769
s841244282
488
168
40,044
38,640
Accepted
Accepted
65.57
import sys N,M=list(map(int,input().split())) a=M//N for i in range(a,0,-1): if M%i==0: print(i) sys.exit()
import sys import math N,M=list(map(int,input().split())) ans=0 a=min(M+1,10**5) b=M//N for i in range(1,a): if M%i!=0: continue if i<=b: ans=max(ans,i) if M//i <=b: ans=max(ans,M//i) print(ans)
7
16
127
250
import sys N, M = list(map(int, input().split())) a = M // N for i in range(a, 0, -1): if M % i == 0: print(i) sys.exit()
import sys import math N, M = list(map(int, input().split())) ans = 0 a = min(M + 1, 10**5) b = M // N for i in range(1, a): if M % i != 0: continue if i <= b: ans = max(ans, i) if M // i <= b: ans = max(ans, M // i) print(ans)
false
56.25
[ "+import math", "-a = M // N", "-for i in range(a, 0, -1):", "- if M % i == 0:", "- print(i)", "- sys.exit()", "+ans = 0", "+a = min(M + 1, 10**5)", "+b = M // N", "+for i in range(1, a):", "+ if M % i != 0:", "+ continue", "+ if i <= b:", "+ ans = max(...
false
0.007589
0.040835
0.185838
[ "s893994769", "s841244282" ]
u323859575
p02700
python
s684519840
s560440539
32
27
9,096
9,148
Accepted
Accepted
15.62
a,b,c,d = list(map(int, input().split())) turn_taka = True while True: if turn_taka: c -= b else: a -= d if a <= 0: print('No') break if c <= 0: print('Yes') break turn_taka = not turn_taka
a,b,c,d = list(map(int, input().split())) while True: c -= b a -= d if c <= 0: print('Yes') break if a <= 0: print('No') break
17
12
271
182
a, b, c, d = list(map(int, input().split())) turn_taka = True while True: if turn_taka: c -= b else: a -= d if a <= 0: print("No") break if c <= 0: print("Yes") break turn_taka = not turn_taka
a, b, c, d = list(map(int, input().split())) while True: c -= b a -= d if c <= 0: print("Yes") break if a <= 0: print("No") break
false
29.411765
[ "-turn_taka = True", "- if turn_taka:", "- c -= b", "- else:", "- a -= d", "+ c -= b", "+ a -= d", "+ if c <= 0:", "+ print(\"Yes\")", "+ break", "- if c <= 0:", "- print(\"Yes\")", "- break", "- turn_taka = not turn_taka" ]
false
0.036394
0.034113
1.066856
[ "s684519840", "s560440539" ]
u345966487
p02623
python
s258804686
s310186228
234
216
41,624
55,128
Accepted
Accepted
7.69
import bisect from itertools import* n,m,k,*x=[int(v)for l in open(0) for v in l.split()];a=accumulate([0]+x[:n]);b=[*accumulate(x[n:])];print((max(i+bisect.bisect(b,k-v)for i,v in enumerate(a)if v<=k)))
from bisect import* from itertools import* n,m,k,*x=list(map(int,open(0).read().split()));c=accumulate;a=c([0]+x[:n]);b=[*c(x[n:])];print((max(i+bisect(b,k-v)for i,v in enumerate(a)if v<=k)))
3
3
203
185
import bisect from itertools import * n, m, k, *x = [int(v) for l in open(0) for v in l.split()] a = accumulate([0] + x[:n]) b = [*accumulate(x[n:])] print((max(i + bisect.bisect(b, k - v) for i, v in enumerate(a) if v <= k)))
from bisect import * from itertools import * n, m, k, *x = list(map(int, open(0).read().split())) c = accumulate a = c([0] + x[:n]) b = [*c(x[n:])] print((max(i + bisect(b, k - v) for i, v in enumerate(a) if v <= k)))
false
0
[ "-import bisect", "+from bisect import *", "-n, m, k, *x = [int(v) for l in open(0) for v in l.split()]", "-a = accumulate([0] + x[:n])", "-b = [*accumulate(x[n:])]", "-print((max(i + bisect.bisect(b, k - v) for i, v in enumerate(a) if v <= k)))", "+n, m, k, *x = list(map(int, open(0).read().split()))",...
false
0.040413
0.12923
0.312725
[ "s258804686", "s310186228" ]
u893063840
p03212
python
s365115481
s072580756
90
52
2,940
9,124
Accepted
Accepted
42.22
# -*- coding: utf-8 -*- N = int(eval(input())) def count753(s): if int(s) > N: return 0 ret = 1 if all(s.count(c) for c in "753") else 0 for c in "753": ret += count753(s + c) return ret print((c...
from itertools import product n = int(eval(input())) ans = 0 for i in range(1, 10): for pat in product("357", repeat=i): num = "".join(pat) st = set(num) if int(num) <= n and st == {"3", "5", "7"}: ans += 1 print(ans)
13
13
327
267
# -*- coding: utf-8 -*- N = int(eval(input())) def count753(s): if int(s) > N: return 0 ret = 1 if all(s.count(c) for c in "753") else 0 for c in "753": ret += count753(s + c) return ret print((count753("0")))
from itertools import product n = int(eval(input())) ans = 0 for i in range(1, 10): for pat in product("357", repeat=i): num = "".join(pat) st = set(num) if int(num) <= n and st == {"3", "5", "7"}: ans += 1 print(ans)
false
0
[ "-# -*- coding: utf-8 -*-", "-N = int(eval(input()))", "+from itertools import product", "-", "-def count753(s):", "- if int(s) > N:", "- return 0", "- ret = 1 if all(s.count(c) for c in \"753\") else 0", "- for c in \"753\":", "- ret += count753(s + c)", "- return ret"...
false
0.049766
0.104121
0.477968
[ "s365115481", "s072580756" ]
u790710233
p03599
python
s196370778
s623252510
367
32
3,316
3,188
Accepted
Accepted
91.28
A, B, C, D, E, F = list(map(int, input().split())) items = [] water = list(set([100*(A*w+B*x) for w in range(16) for x in range(16) if A*w+B*x <= 30])) water.sort() for w in water: for x in range(1501): c = C*x i = (F-w-c)//D for y in reversed(list(range(i+1))): ...
import itertools A, B, C, D, E, F = list(map(int, input().split())) U = F water = [0]*(U+1) water[0] = 1 for i in range(U+1): if water[i]: if i+100*A <= U: water[i+100*A] = 1 if i+100*B <= U: water[i+100*B] = 1 water_val = [val for val in range(1, U+1) if water[val...
18
34
528
786
A, B, C, D, E, F = list(map(int, input().split())) items = [] water = list( set( [ 100 * (A * w + B * x) for w in range(16) for x in range(16) if A * w + B * x <= 30 ] ) ) water.sort() for w in water: for x in range(1501): c = C * x ...
import itertools A, B, C, D, E, F = list(map(int, input().split())) U = F water = [0] * (U + 1) water[0] = 1 for i in range(U + 1): if water[i]: if i + 100 * A <= U: water[i + 100 * A] = 1 if i + 100 * B <= U: water[i + 100 * B] = 1 water_val = [val for val in range(1, U + 1...
false
47.058824
[ "+import itertools", "+", "-items = []", "-water = list(", "- set(", "- [", "- 100 * (A * w + B * x)", "- for w in range(16)", "- for x in range(16)", "- if A * w + B * x <= 30", "- ]", "- )", "-)", "-water.sort()", "-for w ...
false
0.499346
0.036849
13.551024
[ "s196370778", "s623252510" ]
u945181840
p02900
python
s801992661
s057267480
332
176
3,060
3,064
Accepted
Accepted
46.99
A, B = list(map(int, input().split())) def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n % i == 0: n /= i table.append(i) i += 1 if n > 1: table.append(n) return table a = set(prime_decomposition(A)) b = set(pr...
A, B = list(map(int, input().split())) def gcd(a, b): while b: a, b = b, a % b return a def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n % i == 0: n /= i table.append(i) i += 1 if n > 1: table.app...
20
23
360
395
A, B = list(map(int, input().split())) def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n % i == 0: n /= i table.append(i) i += 1 if n > 1: table.append(n) return table a = set(prime_decomposition(A)) b = set(prime_decomposition...
A, B = list(map(int, input().split())) def gcd(a, b): while b: a, b = b, a % b return a def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n % i == 0: n /= i table.append(i) i += 1 if n > 1: table.append(n) return ...
false
13.043478
[ "+", "+", "+def gcd(a, b):", "+ while b:", "+ a, b = b, a % b", "+ return a", "-a = set(prime_decomposition(A))", "-b = set(prime_decomposition(B))", "-print((len(a & b) + 1))", "+print((len(set(prime_decomposition(gcd(A, B)))) + 1))" ]
false
0.037561
0.038614
0.972733
[ "s801992661", "s057267480" ]
u642874916
p02716
python
s384404131
s729409083
215
139
102,332
105,432
Accepted
Accepted
35.35
from heapq import heappush, heappop, heapify from collections import deque, defaultdict, Counter import itertools from itertools import permutations, combinations, accumulate import sys import bisect import string import math import time def I(): return int(eval(input())) def S(): return eval(input())...
n = int(eval(input())) A = list(map(int, input().split())) INF = 10**18 dp_use = [-INF] * 5 dp_not_use = [-INF] * 5 dp_not_use[0] = 0 for a in A: tmp_use = [-INF] * 5 tmp_not_use = [-INF] * 5 for current_dif in range(-3,2): if current_dif-1 >= -3: tmp_use[current_dif] = dp_...
72
19
1,351
584
from heapq import heappush, heappop, heapify from collections import deque, defaultdict, Counter import itertools from itertools import permutations, combinations, accumulate import sys import bisect import string import math import time def I(): return int(eval(input())) def S(): return eval(input()) def...
n = int(eval(input())) A = list(map(int, input().split())) INF = 10**18 dp_use = [-INF] * 5 dp_not_use = [-INF] * 5 dp_not_use[0] = 0 for a in A: tmp_use = [-INF] * 5 tmp_not_use = [-INF] * 5 for current_dif in range(-3, 2): if current_dif - 1 >= -3: tmp_use[current_dif] = dp_not_use[cur...
false
73.611111
[ "-from heapq import heappush, heappop, heapify", "-from collections import deque, defaultdict, Counter", "-import itertools", "-from itertools import permutations, combinations, accumulate", "-import sys", "-import bisect", "-import string", "-import math", "-import time", "-", "-", "-def I():...
false
0.114079
0.122832
0.92874
[ "s384404131", "s729409083" ]
u296518383
p03078
python
s269514100
s896687837
1,415
763
193,908
148,200
Accepted
Accepted
46.08
import heapq X,Y,Z,K=list(map(int,input().split())) A=list(map(int,input().split())) B=list(map(int,input().split())) C=list(map(int,input().split())) AB=[] for i in A: for j in B: heapq.heappush(AB,-i-j) #print(AB) ABC=[] for i in range(min(K,X*Y)): temp=heapq.heappop(AB) for j in C: ...
X, Y, Z, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort(reverse = True) B.sort(reverse = True) C.sort(reverse = True) AB = [] for a in A: for b in B: AB.append(a + b) AB.sort(reverse = True) AB ...
22
24
409
456
import heapq X, Y, Z, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) AB = [] for i in A: for j in B: heapq.heappush(AB, -i - j) # print(AB) ABC = [] for i in range(min(K, X * Y)): temp = heapq.heappop(AB) ...
X, Y, Z, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) AB = [] for a in A: for b in B: AB.append(a + b) AB.sort(reverse=True) AB = AB[:3000] ABC = ...
false
8.333333
[ "-import heapq", "-", "+A.sort(reverse=True)", "+B.sort(reverse=True)", "+C.sort(reverse=True)", "-for i in A:", "- for j in B:", "- heapq.heappush(AB, -i - j)", "-# print(AB)", "+for a in A:", "+ for b in B:", "+ AB.append(a + b)", "+AB.sort(reverse=True)", "+AB = AB[:...
false
0.199086
0.083963
2.371131
[ "s269514100", "s896687837" ]
u047796752
p02913
python
s224108492
s871779398
425
110
157,448
74,220
Accepted
Accepted
74.12
import sys input = sys.stdin.readline from collections import * def judge(x): d = defaultdict(int) for i in range(N-x+1): k = S[i:i+x] if k in d: if i>=d[k]+x: return True else: d[k] = i return False def b...
import sys input = sys.stdin.readline from collections import * def judge(x): d = defaultdict(int) d[hash(S[:x])] = 0 for i in range(1, len(S)-x+1): k = hash(S[i:i+x]) if k in d: if i-d[k]>=x: return True else: d[k...
34
35
569
606
import sys input = sys.stdin.readline from collections import * def judge(x): d = defaultdict(int) for i in range(N - x + 1): k = S[i : i + x] if k in d: if i >= d[k] + x: return True else: d[k] = i return False def binary_search(): l,...
import sys input = sys.stdin.readline from collections import * def judge(x): d = defaultdict(int) d[hash(S[:x])] = 0 for i in range(1, len(S) - x + 1): k = hash(S[i : i + x]) if k in d: if i - d[k] >= x: return True else: d[k] = i retur...
false
2.857143
[ "- for i in range(N - x + 1):", "- k = S[i : i + x]", "+ d[hash(S[:x])] = 0", "+ for i in range(1, len(S) - x + 1):", "+ k = hash(S[i : i + x])", "- if i >= d[k] + x:", "+ if i - d[k] >= x:" ]
false
0.04502
0.045936
0.980062
[ "s224108492", "s871779398" ]
u077291787
p02714
python
s490219458
s839359240
779
542
9,912
10,004
Accepted
Accepted
30.42
# D - RGB Triplets from collections import defaultdict def main(): _ = int(eval(input())) S = input().rstrip() indices = defaultdict(set) for i, c in enumerate(S): indices[c].add(2 * i) cnt = len(indices["R"]) * len(indices["G"]) * len(indices["B"]) for c1, c2, c3 in ["RGB",...
# D - RGB Triplets from collections import defaultdict def main(): _ = int(eval(input())) S = input().rstrip() indices, doubled_indices = defaultdict(list), defaultdict(set) for i, c in enumerate(S): indices[c].append(i) doubled_indices[c].add(2 * i) cnt = len(indices["R...
20
21
505
580
# D - RGB Triplets from collections import defaultdict def main(): _ = int(eval(input())) S = input().rstrip() indices = defaultdict(set) for i, c in enumerate(S): indices[c].add(2 * i) cnt = len(indices["R"]) * len(indices["G"]) * len(indices["B"]) for c1, c2, c3 in ["RGB", "GBR", "BR...
# D - RGB Triplets from collections import defaultdict def main(): _ = int(eval(input())) S = input().rstrip() indices, doubled_indices = defaultdict(list), defaultdict(set) for i, c in enumerate(S): indices[c].append(i) doubled_indices[c].add(2 * i) cnt = len(indices["R"]) * len(i...
false
4.761905
[ "- indices = defaultdict(set)", "+ indices, doubled_indices = defaultdict(list), defaultdict(set)", "- indices[c].add(2 * i)", "+ indices[c].append(i)", "+ doubled_indices[c].add(2 * i)", "- (i + j) // 2 in indices[c3] for i in indices[c1] for j in indices[c2]", "+ ...
false
0.041373
0.041204
1.004112
[ "s490219458", "s839359240" ]
u977389981
p03573
python
s866851584
s795492873
22
18
3,316
2,940
Accepted
Accepted
18.18
from collections import Counter A = Counter([int(i) for i in input().split()]).most_common() print((A[1][0]))
a, b, c = list(map(int, input().split())) if a == b: print(c) elif a == c: print(b) else: print(a)
3
7
109
110
from collections import Counter A = Counter([int(i) for i in input().split()]).most_common() print((A[1][0]))
a, b, c = list(map(int, input().split())) if a == b: print(c) elif a == c: print(b) else: print(a)
false
57.142857
[ "-from collections import Counter", "-", "-A = Counter([int(i) for i in input().split()]).most_common()", "-print((A[1][0]))", "+a, b, c = list(map(int, input().split()))", "+if a == b:", "+ print(c)", "+elif a == c:", "+ print(b)", "+else:", "+ print(a)" ]
false
0.045424
0.044516
1.020407
[ "s866851584", "s795492873" ]
u667694979
p03308
python
s232527440
s786418477
19
17
3,060
2,940
Accepted
Accepted
10.53
N=int(eval(input())) A=list(map(int,input().split())) max=0 for i in range(0,N-1): for j in range(i+1,N): if abs(A[i]-A[j])>=max: max=abs(A[i]-A[j]) print(max)
N=int(eval(input())) A=list(map(int,input().split())) print((max(A)-min(A)))
9
4
174
72
N = int(eval(input())) A = list(map(int, input().split())) max = 0 for i in range(0, N - 1): for j in range(i + 1, N): if abs(A[i] - A[j]) >= max: max = abs(A[i] - A[j]) print(max)
N = int(eval(input())) A = list(map(int, input().split())) print((max(A) - min(A)))
false
55.555556
[ "-max = 0", "-for i in range(0, N - 1):", "- for j in range(i + 1, N):", "- if abs(A[i] - A[j]) >= max:", "- max = abs(A[i] - A[j])", "-print(max)", "+print((max(A) - min(A)))" ]
false
0.17101
0.045329
3.772657
[ "s232527440", "s786418477" ]
u887207211
p03494
python
s104406879
s470519373
20
18
3,060
3,060
Accepted
Accepted
10
N = int(eval(input())) A = list(map(int,input().split())) cnt = 0 while all(a%2==0 for a in A): A = list([x//2 for x in A]) cnt += 1 print(cnt)
N = int(eval(input())) A = list(map(int,input().split())) cnt = 0 while all(0 == a%2 for a in A): A = list([x//2 for x in A]) cnt += 1 print(cnt)
8
8
154
156
N = int(eval(input())) A = list(map(int, input().split())) cnt = 0 while all(a % 2 == 0 for a in A): A = list([x // 2 for x in A]) cnt += 1 print(cnt)
N = int(eval(input())) A = list(map(int, input().split())) cnt = 0 while all(0 == a % 2 for a in A): A = list([x // 2 for x in A]) cnt += 1 print(cnt)
false
0
[ "-while all(a % 2 == 0 for a in A):", "+while all(0 == a % 2 for a in A):" ]
false
0.042274
0.040362
1.047376
[ "s104406879", "s470519373" ]
u028973125
p03472
python
s639141538
s305822397
264
228
27,924
23,828
Accepted
Accepted
13.64
import sys N, H = list(map(int, sys.stdin.readline().split())) katanas = [] for i in range(N): a, b = list(map(int, sys.stdin.readline().split())) katanas.append((a, b, i)) sk = sorted(katanas, reverse=True) max_k = sk[0][0] katanas.sort(key = lambda x:x[1], reverse=True) ans = 0 i = 0 while ...
import sys input = sys.stdin.readline N, H = list(map(int, input().split())) katanas = [] for _ in range(N): a, b = list(map(int, input().split())) katanas.append((a, b)) max_a = sorted(katanas, reverse=True)[0][0] throws = [] for a, b in katanas: if max_a < b: throws.append(b) a...
26
25
532
473
import sys N, H = list(map(int, sys.stdin.readline().split())) katanas = [] for i in range(N): a, b = list(map(int, sys.stdin.readline().split())) katanas.append((a, b, i)) sk = sorted(katanas, reverse=True) max_k = sk[0][0] katanas.sort(key=lambda x: x[1], reverse=True) ans = 0 i = 0 while H > 0: if i < N...
import sys input = sys.stdin.readline N, H = list(map(int, input().split())) katanas = [] for _ in range(N): a, b = list(map(int, input().split())) katanas.append((a, b)) max_a = sorted(katanas, reverse=True)[0][0] throws = [] for a, b in katanas: if max_a < b: throws.append(b) ans = 0 for b in sor...
false
3.846154
[ "-N, H = list(map(int, sys.stdin.readline().split()))", "+input = sys.stdin.readline", "+N, H = list(map(int, input().split()))", "-for i in range(N):", "- a, b = list(map(int, sys.stdin.readline().split()))", "- katanas.append((a, b, i))", "-sk = sorted(katanas, reverse=True)", "-max_k = sk[0][...
false
0.045943
0.045745
1.004327
[ "s639141538", "s305822397" ]
u562935282
p03589
python
s556266455
s367565883
1,914
273
3,316
39,536
Accepted
Accepted
85.74
n = int(eval(input())) for x in range(1, 3500 + 1): for y in range(1, 3500 + 1): q = 4 * x * y - n * (x + y) if q <= 0: continue p = n * x * y if p % q == 0: z = p // q print((x, y, z)) exit()
def main(): N = int(eval(input())) for h in range(1, 3500 + 1): for n in range(1, 3500 + 1): numerator = N * h * n denominator = 4 * h * n - N * n - N * h if denominator == 0: continue if numerator % denominator != 0: ...
12
22
274
529
n = int(eval(input())) for x in range(1, 3500 + 1): for y in range(1, 3500 + 1): q = 4 * x * y - n * (x + y) if q <= 0: continue p = n * x * y if p % q == 0: z = p // q print((x, y, z)) exit()
def main(): N = int(eval(input())) for h in range(1, 3500 + 1): for n in range(1, 3500 + 1): numerator = N * h * n denominator = 4 * h * n - N * n - N * h if denominator == 0: continue if numerator % denominator != 0: contin...
false
45.454545
[ "-n = int(eval(input()))", "-for x in range(1, 3500 + 1):", "- for y in range(1, 3500 + 1):", "- q = 4 * x * y - n * (x + y)", "- if q <= 0:", "- continue", "- p = n * x * y", "- if p % q == 0:", "- z = p // q", "- print((x, y, z))", ...
false
0.029759
0.038119
0.78068
[ "s556266455", "s367565883" ]
u392319141
p02824
python
s523703620
s231900816
468
417
14,964
14,964
Accepted
Accepted
10.9
N, M, V, P = list(map(int, input().split())) A = list(map(int, input().split())) A.sort(reverse=True) W = N - V def isOk(n): if n < P: return True b = A[n] D = [max(0, a - b) for a in A][P - 1:] cnt = -(-(sum(D) - W) // W) + 1 return max(max(D), cnt) <= M ok = -1 ng = N ...
N, M, V, P = list(map(int, input().split())) A = list(map(int, input().split())) A.sort(reverse=True) def isOk(n): if n < P: return True b = A[n] + M cnt = (P - 1) * M + (N - n) * M for a in A[P - 1: n]: cnt += max(0, b - a) if b >= A[P - 1] and cnt >= V * M: ...
25
27
437
488
N, M, V, P = list(map(int, input().split())) A = list(map(int, input().split())) A.sort(reverse=True) W = N - V def isOk(n): if n < P: return True b = A[n] D = [max(0, a - b) for a in A][P - 1 :] cnt = -(-(sum(D) - W) // W) + 1 return max(max(D), cnt) <= M ok = -1 ng = N while ng - ok > ...
N, M, V, P = list(map(int, input().split())) A = list(map(int, input().split())) A.sort(reverse=True) def isOk(n): if n < P: return True b = A[n] + M cnt = (P - 1) * M + (N - n) * M for a in A[P - 1 : n]: cnt += max(0, b - a) if b >= A[P - 1] and cnt >= V * M: return True ...
false
7.407407
[ "-W = N - V", "- b = A[n]", "- D = [max(0, a - b) for a in A][P - 1 :]", "- cnt = -(-(sum(D) - W) // W) + 1", "- return max(max(D), cnt) <= M", "+ b = A[n] + M", "+ cnt = (P - 1) * M + (N - n) * M", "+ for a in A[P - 1 : n]:", "+ cnt += max(0, b - a)", "+ if b >= A[P...
false
0.044358
0.098803
0.448958
[ "s523703620", "s231900816" ]
u253276391
p03730
python
s607506283
s122163372
166
17
38,256
2,940
Accepted
Accepted
89.76
A,B,C=list(map(int,input().split())) a=[A*(i+1)%B for i in range(B)] if C in a: print('YES') else: print('NO')
A,B,C=list(map(int,input().split())) for i in range(B): if A * (i+1) % B == C: print("YES") exit() print("NO")
6
6
117
129
A, B, C = list(map(int, input().split())) a = [A * (i + 1) % B for i in range(B)] if C in a: print("YES") else: print("NO")
A, B, C = list(map(int, input().split())) for i in range(B): if A * (i + 1) % B == C: print("YES") exit() print("NO")
false
0
[ "-a = [A * (i + 1) % B for i in range(B)]", "-if C in a:", "- print(\"YES\")", "-else:", "- print(\"NO\")", "+for i in range(B):", "+ if A * (i + 1) % B == C:", "+ print(\"YES\")", "+ exit()", "+print(\"NO\")" ]
false
0.154784
0.04256
3.636842
[ "s607506283", "s122163372" ]
u263830634
p03200
python
s392747235
s944209874
108
89
14,116
12,576
Accepted
Accepted
17.59
S = list(eval(input())) N = len(S) left = [0] * N right = [0] * N if S[0] == 'B': left[0] = 1 for i in range(1, N): if S[i] == 'B': left[i] = left[i - 1] + 1 else: left[i] = left[i - 1] # if S[N -1] == 'W': # right[N - 1] = 1 # for i in range(N - 2, -1, -1): # if S[...
S = list(eval(input())) N = len(S) left = [0] * N ans = 0 if S[0] == 'B': left[0] = 1 for i in range(1, N): if S[i] == 'B': left[i] = left[i - 1] + 1 else: left[i] = left[i - 1] ans += left[i] print (ans)
25
15
431
250
S = list(eval(input())) N = len(S) left = [0] * N right = [0] * N if S[0] == "B": left[0] = 1 for i in range(1, N): if S[i] == "B": left[i] = left[i - 1] + 1 else: left[i] = left[i - 1] # if S[N -1] == 'W': # right[N - 1] = 1 # for i in range(N - 2, -1, -1): # if S[i] == 'W': # ...
S = list(eval(input())) N = len(S) left = [0] * N ans = 0 if S[0] == "B": left[0] = 1 for i in range(1, N): if S[i] == "B": left[i] = left[i - 1] + 1 else: left[i] = left[i - 1] ans += left[i] print(ans)
false
40
[ "-right = [0] * N", "+ans = 0", "-# if S[N -1] == 'W':", "-# right[N - 1] = 1", "-# for i in range(N - 2, -1, -1):", "-# if S[i] == 'W':", "-# pass", "-ans = 0", "-for i in range(N):", "- if S[i] == \"W\":" ]
false
0.035065
0.035016
1.001395
[ "s392747235", "s944209874" ]
u312025627
p02597
python
s278317613
s743156349
96
73
92,884
72,732
Accepted
Accepted
23.96
def main(): N = int(eval(input())) S = [s for s in eval(input())] ans = 10**9 w = 0 r = S.count("R") for i in range(N+1): ans = min(ans, max(w, r)) if i == N: break if S[i] == "W": w += 1 else: r -= 1 print(ans...
def main(): _ = int(eval(input())) S = eval(input()) ri = S.count("R") # 右側の換えるべき個数 le = 0 ans = max(ri, le) for s in S: if s == "R": ri -= 1 else: le += 1 ans = min(ans, max(ri, le)) print(ans) if __name__ == '__main__': ...
19
17
354
316
def main(): N = int(eval(input())) S = [s for s in eval(input())] ans = 10**9 w = 0 r = S.count("R") for i in range(N + 1): ans = min(ans, max(w, r)) if i == N: break if S[i] == "W": w += 1 else: r -= 1 print(ans) if __nam...
def main(): _ = int(eval(input())) S = eval(input()) ri = S.count("R") # 右側の換えるべき個数 le = 0 ans = max(ri, le) for s in S: if s == "R": ri -= 1 else: le += 1 ans = min(ans, max(ri, le)) print(ans) if __name__ == "__main__": main()
false
10.526316
[ "- N = int(eval(input()))", "- S = [s for s in eval(input())]", "- ans = 10**9", "- w = 0", "- r = S.count(\"R\")", "- for i in range(N + 1):", "- ans = min(ans, max(w, r))", "- if i == N:", "- break", "- if S[i] == \"W\":", "- w += 1"...
false
0.10668
0.042807
2.492097
[ "s278317613", "s743156349" ]
u681323954
p04011
python
s679333271
s928912343
19
17
3,060
2,940
Accepted
Accepted
10.53
n,k,x,y=(int(eval(input())) for i in [0]*4) print((n*x-(x-y)*max(n-k,0)))
n,k,x,y=[int(eval(input())) for i in range(4)] print((n*x-(x-y)*max(n-k,0)))
2
2
66
69
n, k, x, y = (int(eval(input())) for i in [0] * 4) print((n * x - (x - y) * max(n - k, 0)))
n, k, x, y = [int(eval(input())) for i in range(4)] print((n * x - (x - y) * max(n - k, 0)))
false
0
[ "-n, k, x, y = (int(eval(input())) for i in [0] * 4)", "+n, k, x, y = [int(eval(input())) for i in range(4)]" ]
false
0.050453
0.051765
0.974657
[ "s679333271", "s928912343" ]
u994988729
p03633
python
s155530564
s069168436
306
17
20,388
2,940
Accepted
Accepted
94.44
import numpy as np n=int(eval(input())) T=np.array([int(eval(input())) for _ in range(n)], dtype=np.int64) def gcd(x,y): if x<y: x,y=y,x if y==0: return x return gcd(y, x%y) ans=1 for t in T: ans*=t//gcd(t, ans) print(ans)
def GCD(x, y): if y == 0: return x return GCD(y, x % y) N = int(eval(input())) ans = 1 for _ in range(N): T = int(eval(input())) ans = ans // GCD(ans, T) * T print(ans)
16
12
260
193
import numpy as np n = int(eval(input())) T = np.array([int(eval(input())) for _ in range(n)], dtype=np.int64) def gcd(x, y): if x < y: x, y = y, x if y == 0: return x return gcd(y, x % y) ans = 1 for t in T: ans *= t // gcd(t, ans) print(ans)
def GCD(x, y): if y == 0: return x return GCD(y, x % y) N = int(eval(input())) ans = 1 for _ in range(N): T = int(eval(input())) ans = ans // GCD(ans, T) * T print(ans)
false
25
[ "-import numpy as np", "-", "-n = int(eval(input()))", "-T = np.array([int(eval(input())) for _ in range(n)], dtype=np.int64)", "+def GCD(x, y):", "+ if y == 0:", "+ return x", "+ return GCD(y, x % y)", "-def gcd(x, y):", "- if x < y:", "- x, y = y, x", "- if y == 0:"...
false
0.6384
0.035787
17.838795
[ "s155530564", "s069168436" ]
u210827208
p03575
python
s172578807
s637303658
24
19
3,316
3,064
Accepted
Accepted
20.83
from collections import deque n,m=list(map(int,input().split())) X=[] M=[[] for _ in range(n)] for i in range(m): a,b=list(map(int,input().split())) X.append([a,b]) M[a-1].append(b-1) M[b-1].append(a-1) ans=0 for i in range(m): se={X[i][0]-1,X[i][1]-1} q=deque([0]) visited=[0]*n...
n,m=list(map(int,input().split())) X=[] M=[[] for _ in range(n)] for i in range(m): a,b=list(map(int,input().split())) X.append([a-1,b-1]) M[a-1].append(b-1) M[b-1].append(a-1) ans=0 def dfs(x,se): visited[x]=1 for m in M[x]: if se!={x,m} and visited[m]==0: dfs...
25
23
549
429
from collections import deque n, m = list(map(int, input().split())) X = [] M = [[] for _ in range(n)] for i in range(m): a, b = list(map(int, input().split())) X.append([a, b]) M[a - 1].append(b - 1) M[b - 1].append(a - 1) ans = 0 for i in range(m): se = {X[i][0] - 1, X[i][1] - 1} q = deque([0...
n, m = list(map(int, input().split())) X = [] M = [[] for _ in range(n)] for i in range(m): a, b = list(map(int, input().split())) X.append([a - 1, b - 1]) M[a - 1].append(b - 1) M[b - 1].append(a - 1) ans = 0 def dfs(x, se): visited[x] = 1 for m in M[x]: if se != {x, m} and visited[m]...
false
8
[ "-from collections import deque", "-", "- X.append([a, b])", "+ X.append([a - 1, b - 1])", "+", "+", "+def dfs(x, se):", "+ visited[x] = 1", "+ for m in M[x]:", "+ if se != {x, m} and visited[m] == 0:", "+ dfs(m, se)", "+", "+", "- se = {X[i][0] - 1, X[i][1...
false
0.033797
0.036933
0.915081
[ "s172578807", "s637303658" ]
u993435350
p03290
python
s609710298
s940191804
32
24
3,188
3,064
Accepted
Accepted
25
D,G = list(map(int,input().split())) PC = [] L = [] t = 10 ** 9 m = 0 for i in range(1,D + 1): p,c = list(map(int,input().split())) s = 0 pc = [] for j in range(p): s += i * 100 if j == p - 1: s += c L.append([j + 1,s]) if s >= G and j + 1 < t: t = j + 1 p...
import math D, G = list(map(int, input().split())) PC = [] for _ in range(D): p, c = list(map(int, input().split())) PC.append([p, c]) ans = 10 ** 9 #全部解く・解かないが2のD乗通りになる for i in range(2 ** D): score = 0 time = 0 maxj = -1 #全部解く場合 for j in range(D): #jケタ落としていき、jケタめ ==...
62
38
1,277
958
D, G = list(map(int, input().split())) PC = [] L = [] t = 10**9 m = 0 for i in range(1, D + 1): p, c = list(map(int, input().split())) s = 0 pc = [] for j in range(p): s += i * 100 if j == p - 1: s += c L.append([j + 1, s]) if s >= G and j + 1 < t: ...
import math D, G = list(map(int, input().split())) PC = [] for _ in range(D): p, c = list(map(int, input().split())) PC.append([p, c]) ans = 10**9 # 全部解く・解かないが2のD乗通りになる for i in range(2**D): score = 0 time = 0 maxj = -1 # 全部解く場合 for j in range(D): # jケタ落としていき、jケタめ == 1であれば、つまりj番目の問題...
false
38.709677
[ "+import math", "+", "-L = []", "-t = 10**9", "-m = 0", "-for i in range(1, D + 1):", "+for _ in range(D):", "- s = 0", "- pc = []", "- for j in range(p):", "- s += i * 100", "- if j == p - 1:", "- s += c", "- L.append([j + 1, s])", "- ...
false
0.035609
0.037358
0.953183
[ "s609710298", "s940191804" ]
u428199834
p02695
python
s467218174
s294334962
402
313
9,208
9,124
Accepted
Accepted
22.14
def dfs(seq): ans = 0 if len(seq) == n: kou = 0 for u in data: if seq[u[1]-1] - seq[u[0]-1] == u[2]: kou+=u[3] return kou else:#len(seq)==N-1からの遷都を考えると良い for i in range(seq[-1], m+1): seq_next=seq+[i] ans = max(an...
n,m,q=list(map(int,input().split())) def dfs(seq): u=0 if len(seq)==n: ans=0 for a,b,c,d in data: if seq[b-1]-seq[a-1]==c: ans+=d return ans else: for i in range(seq[-1],m+1): seq_next=seq+[i] u=max(u,dfs(seq_nex...
19
20
491
442
def dfs(seq): ans = 0 if len(seq) == n: kou = 0 for u in data: if seq[u[1] - 1] - seq[u[0] - 1] == u[2]: kou += u[3] return kou else: # len(seq)==N-1からの遷都を考えると良い for i in range(seq[-1], m + 1): seq_next = seq + [i] ans = ma...
n, m, q = list(map(int, input().split())) def dfs(seq): u = 0 if len(seq) == n: ans = 0 for a, b, c, d in data: if seq[b - 1] - seq[a - 1] == c: ans += d return ans else: for i in range(seq[-1], m + 1): seq_next = seq + [i] ...
false
5
[ "+n, m, q = list(map(int, input().split()))", "+", "+", "- ans = 0", "+ u = 0", "- kou = 0", "- for u in data:", "- if seq[u[1] - 1] - seq[u[0] - 1] == u[2]:", "- kou += u[3]", "- return kou", "- else: # len(seq)==N-1からの遷都を考えると良い", "+ ...
false
0.045839
0.063842
0.718013
[ "s467218174", "s294334962" ]
u197457087
p03356
python
s689026571
s197164132
696
499
26,480
20,492
Accepted
Accepted
28.3
from collections import defaultdict class UnionFind(object): def __init__(self, n=1): self.par = [i for i in range(n)] self.rank = [0 for _ in range(n)] self.size = [1 for _ in range(n)] def find(self, x): if self.par[x] == x: return x else: self.par[x] = self.find(self.p...
class UnionFind(object): def __init__(self, n=1): self.par = [i for i in range(n)] self.rank = [0 for _ in range(n)] self.size = [1 for _ in range(n)] def find(self, x): """ x が属するグループを探索 """ if self.par[x] == x: return x els...
50
54
1,130
1,344
from collections import defaultdict class UnionFind(object): def __init__(self, n=1): self.par = [i for i in range(n)] self.rank = [0 for _ in range(n)] self.size = [1 for _ in range(n)] def find(self, x): if self.par[x] == x: return x else: sel...
class UnionFind(object): def __init__(self, n=1): self.par = [i for i in range(n)] self.rank = [0 for _ in range(n)] self.size = [1 for _ in range(n)] def find(self, x): """ x が属するグループを探索 """ if self.par[x] == x: return x else: ...
false
7.407407
[ "-from collections import defaultdict", "-", "-", "+ \"\"\"", "+ x が属するグループを探索", "+ \"\"\"", "+ \"\"\"", "+ x と y のグループを結合", "+ \"\"\"", "+ \"\"\"", "+ x と y が同じグループか否か", "+ \"\"\"", "+ \"\"\"", "+ x が属するグループの要素数"...
false
0.049293
0.046243
1.065961
[ "s689026571", "s197164132" ]
u790710233
p02583
python
s447592245
s156089004
119
99
9,188
9,192
Accepted
Accepted
16.81
n = int(eval(input())) L = list(map(int, input().split())) ans = 0 for i in range(n): for j in range(i+1, n): for k in range(j+1, n): a, b, c = sorted([L[i], L[j], L[k]]) if a == b or b == c or c == a: continue if c < a+b: ans += ...
from itertools import combinations n = int(eval(input())) L = sorted(map(int, input().split())) ans = 0 for subset in combinations(L, 3): a, b, c = subset if len(set(subset)) != 3: continue if c < a+b: ans += 1 print(ans)
12
11
328
254
n = int(eval(input())) L = list(map(int, input().split())) ans = 0 for i in range(n): for j in range(i + 1, n): for k in range(j + 1, n): a, b, c = sorted([L[i], L[j], L[k]]) if a == b or b == c or c == a: continue if c < a + b: ans += 1 pr...
from itertools import combinations n = int(eval(input())) L = sorted(map(int, input().split())) ans = 0 for subset in combinations(L, 3): a, b, c = subset if len(set(subset)) != 3: continue if c < a + b: ans += 1 print(ans)
false
8.333333
[ "+from itertools import combinations", "+", "-L = list(map(int, input().split()))", "+L = sorted(map(int, input().split()))", "-for i in range(n):", "- for j in range(i + 1, n):", "- for k in range(j + 1, n):", "- a, b, c = sorted([L[i], L[j], L[k]])", "- if a == b or...
false
0.044116
0.035007
1.260209
[ "s447592245", "s156089004" ]
u401452016
p03164
python
s720049102
s814794756
1,248
737
291,720
286,856
Accepted
Accepted
40.95
import sys n, limit = list(map(int, sys.stdin.readline().split())) L = [list(map(int, sys.stdin.readline().split())) for _ in range(n)] dp = [dict() for i in range(n)] #print(dp) dp[0][L[0][1]] = L[0][0] for i in range(1, n): dp[i][L[i][1]] = min(L[i][0], dp[i-1].get(L[i][1], float('inf'))) for v, ...
import sys from collections import defaultdict n, limit = list(map(int, sys.stdin.readline().split())) L = [list(map(int, sys.stdin.readline().split())) for _ in range(n)] dp =[defaultdict(int) for _ in range(n)] dp[0][L[0][1]] = L[0][0] #print(dp) for i in range(1, n): dp[i][L[i][1]] = min(L[i][0], dp[i-...
21
22
629
686
import sys n, limit = list(map(int, sys.stdin.readline().split())) L = [list(map(int, sys.stdin.readline().split())) for _ in range(n)] dp = [dict() for i in range(n)] # print(dp) dp[0][L[0][1]] = L[0][0] for i in range(1, n): dp[i][L[i][1]] = min(L[i][0], dp[i - 1].get(L[i][1], float("inf"))) for v, w in list...
import sys from collections import defaultdict n, limit = list(map(int, sys.stdin.readline().split())) L = [list(map(int, sys.stdin.readline().split())) for _ in range(n)] dp = [defaultdict(int) for _ in range(n)] dp[0][L[0][1]] = L[0][0] # print(dp) for i in range(1, n): dp[i][L[i][1]] = min(L[i][0], dp[i - 1].ge...
false
4.545455
[ "+from collections import defaultdict", "-dp = [dict() for i in range(n)]", "+dp = [defaultdict(int) for _ in range(n)]", "+dp[0][L[0][1]] = L[0][0]", "-dp[0][L[0][1]] = L[0][0]", "- dp[i][L[i][1]] = min(L[i][0], dp[i - 1].get(L[i][1], float(\"inf\")))", "+ dp[i][L[i][1]] = min(L[i][0], dp[i - 1]....
false
0.035922
0.037357
0.961601
[ "s720049102", "s814794756" ]
u883048396
p03965
python
s257237761
s200341439
58
40
4,652
3,316
Accepted
Accepted
31.03
#len(s)//2-s.count("p") iG = 0 iR = 0 for g in [int(_) for _ in list(input().rstrip().replace("g","1").replace("p","0"))]: if g : if 0 < iG: iR += 1 iG -= 1 else: iG += 1 else: if 0 < iG: iG -= 1 else: iR -...
#len(s)//2-s.count("p") iG = 0 iR = 0 for s in input().rstrip(): if s == "g" : if 0 < iG: iR += 1 iG -= 1 else: iG += 1 else: if 0 < iG: iG -= 1 else: iR -= 1 iG += 1 print(iR)
17
17
356
305
# len(s)//2-s.count("p") iG = 0 iR = 0 for g in [int(_) for _ in list(input().rstrip().replace("g", "1").replace("p", "0"))]: if g: if 0 < iG: iR += 1 iG -= 1 else: iG += 1 else: if 0 < iG: iG -= 1 else: iR -= 1 ...
# len(s)//2-s.count("p") iG = 0 iR = 0 for s in input().rstrip(): if s == "g": if 0 < iG: iR += 1 iG -= 1 else: iG += 1 else: if 0 < iG: iG -= 1 else: iR -= 1 iG += 1 print(iR)
false
0
[ "-for g in [int(_) for _ in list(input().rstrip().replace(\"g\", \"1\").replace(\"p\", \"0\"))]:", "- if g:", "+for s in input().rstrip():", "+ if s == \"g\":" ]
false
0.036571
0.034276
1.06695
[ "s257237761", "s200341439" ]
u960171798
p03493
python
s027520905
s432078485
175
17
38,384
2,940
Accepted
Accepted
90.29
s = eval(input()) print((s.count('1')))
x = 0 for i in list(eval(input())): if i == "1" : x += 1 print(x)
2
5
32
75
s = eval(input()) print((s.count("1")))
x = 0 for i in list(eval(input())): if i == "1": x += 1 print(x)
false
60
[ "-s = eval(input())", "-print((s.count(\"1\")))", "+x = 0", "+for i in list(eval(input())):", "+ if i == \"1\":", "+ x += 1", "+print(x)" ]
false
0.155867
0.04597
3.390636
[ "s027520905", "s432078485" ]
u493130708
p03494
python
s332668233
s339250820
235
175
38,640
38,512
Accepted
Accepted
25.53
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math #from math import gcd import bisect from collections import defaultdict from collections import deque from functools import lru_cache ############# # Constants # ############# M...
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math #from math import gcd import bisect from collections import defaultdict from collections import deque from functools import lru_cache ############# # Constants # ############# M...
132
139
2,968
3,056
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math # from math import gcd import bisect from collections import defaultdict from collections import deque from functools import lru_cache ############# # Constants # ############# MOD = 10**9 + 7 INF = fl...
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math # from math import gcd import bisect from collections import defaultdict from collections import deque from functools import lru_cache ############# # Constants # ############# MOD = 10**9 + 7 INF = fl...
false
5.035971
[ "- if n == 1:", "- return [[1, 0]]", "- if int(X / n):", "- return Base_10_to_n(int(X / n), n) + [X % n]", "+ if X // n:", "+ return Base_10_to_n(X // n, n) + [X % n]", "+", "+", "+def Base_n_to_10(X, n):", "+ return sum(int(str(X)[-i]) * n**i for i in range(len(st...
false
0.042588
0.042665
0.998196
[ "s332668233", "s339250820" ]
u126227204
p02912
python
s551390743
s867974033
562
319
87,448
64,920
Accepted
Accepted
43.24
import heapq n, m = list(map(int, input().split())) a = list(map(int, input().split())) heap = [] for i in a: heapq.heappush(heap, -i) for i in range(m): x = - heapq.heappop(heap) x = x / 2 heapq.heappush(heap, - x) print((sum([int (-n) for n in heap])))
import heapq n, m = list(map(int, input().split())) a = list(map(int, input().split())) heap = [] for i in a: heapq.heappush(heap, -i) for i in range(m): x = - heapq.heappop(heap) x = x // 2 heapq.heappush(heap, - x) print((sum([int (-n) for n in heap])))
17
17
290
291
import heapq n, m = list(map(int, input().split())) a = list(map(int, input().split())) heap = [] for i in a: heapq.heappush(heap, -i) for i in range(m): x = -heapq.heappop(heap) x = x / 2 heapq.heappush(heap, -x) print((sum([int(-n) for n in heap])))
import heapq n, m = list(map(int, input().split())) a = list(map(int, input().split())) heap = [] for i in a: heapq.heappush(heap, -i) for i in range(m): x = -heapq.heappop(heap) x = x // 2 heapq.heappush(heap, -x) print((sum([int(-n) for n in heap])))
false
0
[ "- x = x / 2", "+ x = x // 2" ]
false
0.051799
0.159989
0.323768
[ "s551390743", "s867974033" ]
u577170763
p03162
python
s171789381
s603498164
649
300
50,904
53,484
Accepted
Accepted
53.78
# import sys # sys.setrecursionlimit(10**5) # from collections import defaultdict geta = lambda fn: list(map(fn, input().split())) gete = lambda fn: fn(eval(input())) def main(): N = gete(int) a = [0]*(N+1) b, c = a[:], a[:] for i in range(N): av, bv, cv = geta(int) a[i+1]...
# copy and paste (check calc time) import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines # mod=10**9+7 # rstrip().decode('utf-8') # map(int,input().split()) # import numpy as np def main(): n=int(eval(input())) dp=[[0]*3 for _ in range(n+1...
21
30
511
595
# import sys # sys.setrecursionlimit(10**5) # from collections import defaultdict geta = lambda fn: list(map(fn, input().split())) gete = lambda fn: fn(eval(input())) def main(): N = gete(int) a = [0] * (N + 1) b, c = a[:], a[:] for i in range(N): av, bv, cv = geta(int) a[i + 1] = max(...
# copy and paste (check calc time) import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines # mod=10**9+7 # rstrip().decode('utf-8') # map(int,input().split()) # import numpy as np def main(): n = int(eval(input())) dp = [[0] * 3 for _ in range(n + 1)] f...
false
30
[ "-# import sys", "-# sys.setrecursionlimit(10**5)", "-# from collections import defaultdict", "-geta = lambda fn: list(map(fn, input().split()))", "-gete = lambda fn: fn(eval(input()))", "+# copy and paste (check calc time)", "+import sys", "-", "+read = sys.stdin.buffer.read", "+input = sys.stdin...
false
0.038033
0.042058
0.904289
[ "s171789381", "s603498164" ]
u769538311
p03478
python
s726292332
s132091715
42
36
9,132
9,396
Accepted
Accepted
14.29
N,A,B = list(map(int,input().split())) ans_list = [] for i in range(0,N+1): if i < 10: if i >= A and i <=B: ans_list.append(i) else: temp = list(map(int,str(i))) temp=sum(temp) if temp >=A and temp<=B: ans_list.append(i) print((s...
N,A,B = list(map(int,input().split())) ans_list = [] for i in range(0,N+1): temp = list(map(int,str(i))) temp=sum(temp) if temp >=A and temp<=B: ans_list.append(i) print((sum(ans_list)))
14
11
326
223
N, A, B = list(map(int, input().split())) ans_list = [] for i in range(0, N + 1): if i < 10: if i >= A and i <= B: ans_list.append(i) else: temp = list(map(int, str(i))) temp = sum(temp) if temp >= A and temp <= B: ans_list.append(i) print((sum(ans_list)))...
N, A, B = list(map(int, input().split())) ans_list = [] for i in range(0, N + 1): temp = list(map(int, str(i))) temp = sum(temp) if temp >= A and temp <= B: ans_list.append(i) print((sum(ans_list)))
false
21.428571
[ "- if i < 10:", "- if i >= A and i <= B:", "- ans_list.append(i)", "- else:", "- temp = list(map(int, str(i)))", "- temp = sum(temp)", "- if temp >= A and temp <= B:", "- ans_list.append(i)", "+ temp = list(map(int, str(i)))", "+ temp =...
false
0.041143
0.040474
1.016518
[ "s726292332", "s132091715" ]
u729133443
p03813
python
s829503613
s769908859
165
17
38,256
2,940
Accepted
Accepted
89.7
print(('ABC'*(int(eval(input()))<1200)or'ARC'))
print(('A%sC'%'RB'['1200'>eval(input())]))
1
1
39
34
print(("ABC" * (int(eval(input())) < 1200) or "ARC"))
print(("A%sC" % "RB"["1200" > eval(input())]))
false
0
[ "-print((\"ABC\" * (int(eval(input())) < 1200) or \"ARC\"))", "+print((\"A%sC\" % \"RB\"[\"1200\" > eval(input())]))" ]
false
0.043033
0.04126
1.042984
[ "s829503613", "s769908859" ]
u691018832
p03212
python
s603203550
s527164813
77
68
3,060
3,064
Accepted
Accepted
11.69
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) def dfs(s): if int(s) > n: return 0 flag = True for check in '753': if s.count(check) <= 0: f...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) cnt = 0 q = ['3', '5', '7'] while q: qq = q.pop() v = list(qq) if '3' in v and '5' in v and '7' in v: cnt += 1 if ...
27
21
476
516
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n = int(readline()) def dfs(s): if int(s) > n: return 0 flag = True for check in "753": if s.count(check) <= 0: flag = False if ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n = int(readline()) cnt = 0 q = ["3", "5", "7"] while q: qq = q.pop() v = list(qq) if "3" in v and "5" in v and "7" in v: cnt += 1 if int(qq + "3") <=...
false
22.222222
[ "-", "-", "-def dfs(s):", "- if int(s) > n:", "- return 0", "- flag = True", "- for check in \"753\":", "- if s.count(check) <= 0:", "- flag = False", "- if flag:", "- x = 1", "- else:", "- x = 0", "- for check in \"753\":", "- ...
false
0.065266
0.138651
0.470719
[ "s603203550", "s527164813" ]
u761320129
p03239
python
s893046023
s304613227
19
17
3,316
3,060
Accepted
Accepted
10.53
N,T = list(map(int,input().split())) src = [tuple(map(int,input().split())) for i in range(N)] ans = 10**10 for c,t in src: if t <= T: ans = min(ans,c) if ans == 10**10: print('TLE') else: print(ans)
N,T = list(map(int,input().split())) src = [tuple(map(int,input().split())) for i in range(N)] ans = 9999 for c,t in src: if t > T: continue ans = min(ans, c) print((ans if ans < 9999 else 'TLE'))
10
8
222
204
N, T = list(map(int, input().split())) src = [tuple(map(int, input().split())) for i in range(N)] ans = 10**10 for c, t in src: if t <= T: ans = min(ans, c) if ans == 10**10: print("TLE") else: print(ans)
N, T = list(map(int, input().split())) src = [tuple(map(int, input().split())) for i in range(N)] ans = 9999 for c, t in src: if t > T: continue ans = min(ans, c) print((ans if ans < 9999 else "TLE"))
false
20
[ "-ans = 10**10", "+ans = 9999", "- if t <= T:", "- ans = min(ans, c)", "-if ans == 10**10:", "- print(\"TLE\")", "-else:", "- print(ans)", "+ if t > T:", "+ continue", "+ ans = min(ans, c)", "+print((ans if ans < 9999 else \"TLE\"))" ]
false
0.077974
0.07463
1.044802
[ "s893046023", "s304613227" ]
u981449436
p02923
python
s741417280
s390742385
84
76
14,992
14,224
Accepted
Accepted
9.52
n = int(eval(input())) a = list(map(int,input().split())) b = [a[i]-a[i+1] for i in range(n-1)] c = [0] x = 0 for i in range(n-1): if b[i] >= 0: x += 1 c.append(x) else: x = 0 print((max(c)))
n = int(eval(input())) a = list(map(int,input().split())) c = [0] x = 0 for i in range(n-1): if a[i] >= a[i+1]: x += 1 c.append(x) else: x = 0 print((max(c)))
12
11
226
192
n = int(eval(input())) a = list(map(int, input().split())) b = [a[i] - a[i + 1] for i in range(n - 1)] c = [0] x = 0 for i in range(n - 1): if b[i] >= 0: x += 1 c.append(x) else: x = 0 print((max(c)))
n = int(eval(input())) a = list(map(int, input().split())) c = [0] x = 0 for i in range(n - 1): if a[i] >= a[i + 1]: x += 1 c.append(x) else: x = 0 print((max(c)))
false
8.333333
[ "-b = [a[i] - a[i + 1] for i in range(n - 1)]", "- if b[i] >= 0:", "+ if a[i] >= a[i + 1]:" ]
false
0.044639
0.044133
1.011455
[ "s741417280", "s390742385" ]
u128859393
p03339
python
s501921663
s884516984
273
137
32,460
5,792
Accepted
Accepted
49.82
N = int(eval(input())) S = list(eval(input())) cntW = 0 cntE = 0 sumW =[] sumE = [] num_of_turn = [] for i in range(N): if S[i] == 'W': cntW += 1 elif S[i] == 'E': cntE += 1 sumW.append(cntW) sumE.append(cntE) num_of_turn.append(sumE[N - 1] - sumE[0]) for i in rang...
N = int(eval(input())) S = list(eval(input())) numE = S.count('E') numTurn = numE numW = 0 for i in range(N): if S[i] == 'E': numE -= 1 else: numW += 1 if numTurn > numE + numW: numTurn = numE + numW print(numTurn)
25
16
444
257
N = int(eval(input())) S = list(eval(input())) cntW = 0 cntE = 0 sumW = [] sumE = [] num_of_turn = [] for i in range(N): if S[i] == "W": cntW += 1 elif S[i] == "E": cntE += 1 sumW.append(cntW) sumE.append(cntE) num_of_turn.append(sumE[N - 1] - sumE[0]) for i in range(1, N - 1): num_o...
N = int(eval(input())) S = list(eval(input())) numE = S.count("E") numTurn = numE numW = 0 for i in range(N): if S[i] == "E": numE -= 1 else: numW += 1 if numTurn > numE + numW: numTurn = numE + numW print(numTurn)
false
36
[ "-cntW = 0", "-cntE = 0", "-sumW = []", "-sumE = []", "-num_of_turn = []", "+numE = S.count(\"E\")", "+numTurn = numE", "+numW = 0", "- if S[i] == \"W\":", "- cntW += 1", "- elif S[i] == \"E\":", "- cntE += 1", "- sumW.append(cntW)", "- sumE.append(cntE)", "-num...
false
0.085623
0.050089
1.709436
[ "s501921663", "s884516984" ]
u340781749
p03452
python
s648934731
s090811658
1,846
1,673
172,508
169,256
Accepted
Accepted
9.37
import sys sys.setrecursionlimit(100000) def check(i, xs, checked): xi = xs[i] children = set() for j, d in links[i]: if j in checked: continue if j not in xs: xs[j] = xi + d elif xi + d != xs[j]: return False children.add...
import sys sys.setrecursionlimit(100000) def check(i, xs, checked): xi = xs[i] children = set() for j, d in links[i]: if checked[j]: continue if j not in xs: xs[j] = xi + d elif xi + d != xs[j]: return False children.add(j...
43
43
923
928
import sys sys.setrecursionlimit(100000) def check(i, xs, checked): xi = xs[i] children = set() for j, d in links[i]: if j in checked: continue if j not in xs: xs[j] = xi + d elif xi + d != xs[j]: return False children.add(j) checked...
import sys sys.setrecursionlimit(100000) def check(i, xs, checked): xi = xs[i] children = set() for j, d in links[i]: if checked[j]: continue if j not in xs: xs[j] = xi + d elif xi + d != xs[j]: return False children.add(j) checked[i...
false
0
[ "- if j in checked:", "+ if checked[j]:", "- checked.add(i)", "+ checked[i] = True", "- checked = set()", "+ checked = [False] * n", "- if i not in checked:", "+ if not checked[i]:" ]
false
0.047844
0.043155
1.108655
[ "s648934731", "s090811658" ]
u442346200
p02402
python
s470888533
s536855451
50
40
8,032
8,028
Accepted
Accepted
20
sum = 0 max = -10000000 min = 10000000 eval(input()) for i in [int(x) for x in input().split()]: sum += i if i > max: max = i if i < min: min = i print((min, max, sum))
eval(input()) data = [int(x) for x in input().split()] print((min(data), max(data), sum(data)))
14
5
205
93
sum = 0 max = -10000000 min = 10000000 eval(input()) for i in [int(x) for x in input().split()]: sum += i if i > max: max = i if i < min: min = i print((min, max, sum))
eval(input()) data = [int(x) for x in input().split()] print((min(data), max(data), sum(data)))
false
64.285714
[ "-sum = 0", "-max = -10000000", "-min = 10000000", "-for i in [int(x) for x in input().split()]:", "- sum += i", "- if i > max:", "- max = i", "- if i < min:", "- min = i", "-print((min, max, sum))", "+data = [int(x) for x in input().split()]", "+print((min(data), max(da...
false
0.087595
0.108268
0.80906
[ "s470888533", "s536855451" ]
u766684188
p03168
python
s374275542
s068058017
907
776
311,176
254,472
Accepted
Accepted
14.44
import sys input=sys.stdin.readline n=int(eval(input())) P=tuple(map(float,input().split())) DP=[[0]*(n+1) for _ in range(n+1)] DP[0][0]=1 for i in range(1,n+1): DP[i][0]=DP[i-1][0]*(1-P[i-1]) for i in range(1,n+1): for j in range(1,i+1): DP[i][j]=DP[i-1][j-1]*P[i-1]+DP[i-1][j]*(1-P[i-1]) ans...
import sys input=sys.stdin.readline n=int(eval(input())) P=tuple(map(float,input().split())) DP=[[0]*(n+1) for _ in range(n+1)] DP[0][0]=1 for i in range(1,n+1): for j in range(i+1): DP[i][j]=DP[i-1][j]*(1-P[i-1]) if j: DP[i][j]+=DP[i-1][j-1]*P[i-1] ans=0 for i in range(n//2+...
15
15
377
353
import sys input = sys.stdin.readline n = int(eval(input())) P = tuple(map(float, input().split())) DP = [[0] * (n + 1) for _ in range(n + 1)] DP[0][0] = 1 for i in range(1, n + 1): DP[i][0] = DP[i - 1][0] * (1 - P[i - 1]) for i in range(1, n + 1): for j in range(1, i + 1): DP[i][j] = DP[i - 1][j - 1] ...
import sys input = sys.stdin.readline n = int(eval(input())) P = tuple(map(float, input().split())) DP = [[0] * (n + 1) for _ in range(n + 1)] DP[0][0] = 1 for i in range(1, n + 1): for j in range(i + 1): DP[i][j] = DP[i - 1][j] * (1 - P[i - 1]) if j: DP[i][j] += DP[i - 1][j - 1] * P[i ...
false
0
[ "- DP[i][0] = DP[i - 1][0] * (1 - P[i - 1])", "-for i in range(1, n + 1):", "- for j in range(1, i + 1):", "- DP[i][j] = DP[i - 1][j - 1] * P[i - 1] + DP[i - 1][j] * (1 - P[i - 1])", "+ for j in range(i + 1):", "+ DP[i][j] = DP[i - 1][j] * (1 - P[i - 1])", "+ if j:", "+ ...
false
0.046921
0.041213
1.138502
[ "s374275542", "s068058017" ]
u581187895
p02787
python
s676427883
s587600956
505
273
147,012
147,432
Accepted
Accepted
45.94
def resolve(): INF = 1<<60 H, N = list(map(int, input().split())) A, B = [], [] for i in range(N): a, b = list(map(int, input().split())) A.append(a) B.append(b) dp = [[INF]*(H+1) for _ in range(N+1)] dp[0][0] = 0 for i in range(N): for j in r...
def resolve(): INF = 1<<60 H, N = list(map(int, input().split())) A, B = [], [] for i in range(N): a, b = list(map(int, input().split())) A.append(a) B.append(b) dp = [[INF]*(H+1) for _ in range(N+1)] for i in range(N): dp[i][0] = 0 for i ...
22
27
536
631
def resolve(): INF = 1 << 60 H, N = list(map(int, input().split())) A, B = [], [] for i in range(N): a, b = list(map(int, input().split())) A.append(a) B.append(b) dp = [[INF] * (H + 1) for _ in range(N + 1)] dp[0][0] = 0 for i in range(N): for j in range(H + ...
def resolve(): INF = 1 << 60 H, N = list(map(int, input().split())) A, B = [], [] for i in range(N): a, b = list(map(int, input().split())) A.append(a) B.append(b) dp = [[INF] * (H + 1) for _ in range(N + 1)] for i in range(N): dp[i][0] = 0 for i in range(N): ...
false
18.518519
[ "- dp[0][0] = 0", "+ for i in range(N):", "+ dp[i][0] = 0", "- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])", "- dp[i + 1][min(j + A[i], H)] = min(", "- dp[i + 1][min(j + A[i], H)], dp[i + 1][j] + B[i]", "- )", "+ if j < A[i]:", "...
false
0.117618
0.058028
2.026938
[ "s676427883", "s587600956" ]
u814986259
p03261
python
s720931162
s428203354
21
18
3,316
3,060
Accepted
Accepted
14.29
import collections N=int(eval(input())) siritori=collections.defaultdict(int) prev=" " for i in range(N): word = eval(input()) if word in siritori: print("No") exit(0) elif prev[-1]!=word[0] and i != 0: print("No") exit(0) siritori[word]+=1 prev=word print("Yes")
N = int(eval(input())) s = set() flag = True for i in range(N): S = eval(input()) if S in s: flag = False if i > 0 and S[0] != prev: flag = False s.add(S) prev = S[-1] if flag: print("Yes") else: print("No")
15
16
292
256
import collections N = int(eval(input())) siritori = collections.defaultdict(int) prev = " " for i in range(N): word = eval(input()) if word in siritori: print("No") exit(0) elif prev[-1] != word[0] and i != 0: print("No") exit(0) siritori[word] += 1 prev = word prin...
N = int(eval(input())) s = set() flag = True for i in range(N): S = eval(input()) if S in s: flag = False if i > 0 and S[0] != prev: flag = False s.add(S) prev = S[-1] if flag: print("Yes") else: print("No")
false
6.25
[ "-import collections", "-", "-siritori = collections.defaultdict(int)", "-prev = \" \"", "+s = set()", "+flag = True", "- word = eval(input())", "- if word in siritori:", "- print(\"No\")", "- exit(0)", "- elif prev[-1] != word[0] and i != 0:", "- print(\"No\")", ...
false
0.120864
0.066459
1.818633
[ "s720931162", "s428203354" ]
u130900604
p02785
python
s897248557
s560037206
186
153
110,324
110,516
Accepted
Accepted
17.74
n,k,*h=list(map(int,open(0).read().split())) if k>=n: print((0)) exit() h.sort(reverse=True) for i in range(k): h[i]=0 print((sum(h)))
n,k,*h=list(map(int,open(0).read().split())) if k>=n: print((0)) exit() h.sort() print((sum(h[:n-k])))
8
6
137
102
n, k, *h = list(map(int, open(0).read().split())) if k >= n: print((0)) exit() h.sort(reverse=True) for i in range(k): h[i] = 0 print((sum(h)))
n, k, *h = list(map(int, open(0).read().split())) if k >= n: print((0)) exit() h.sort() print((sum(h[: n - k])))
false
25
[ "-h.sort(reverse=True)", "-for i in range(k):", "- h[i] = 0", "-print((sum(h)))", "+h.sort()", "+print((sum(h[: n - k])))" ]
false
0.063552
0.040617
1.564678
[ "s897248557", "s560037206" ]
u545368057
p02953
python
s627502150
s209586450
73
57
15,020
14,252
Accepted
Accepted
21.92
import sys N = int(eval(input())) Hs = list(map(int, input().split())) prev_h = -1 downflg = False for h in Hs: # 増加中 if not downflg: if h - prev_h >= 0: prev_h = h elif h - prev_h == -1: downflg = True prev_h = h else: pri...
N = int(eval(input())) Hs = list(map(int, input().split()))[::-1] # 後ろから貪欲のほうが良くない? pre = 10**10 for h in Hs: # print(h) if pre - h >= 0: pre = h elif pre - h == -1: pre = h -1 else: print("No") exit(0) print("Yes")
30
14
627
272
import sys N = int(eval(input())) Hs = list(map(int, input().split())) prev_h = -1 downflg = False for h in Hs: # 増加中 if not downflg: if h - prev_h >= 0: prev_h = h elif h - prev_h == -1: downflg = True prev_h = h else: print("No") ...
N = int(eval(input())) Hs = list(map(int, input().split()))[::-1] # 後ろから貪欲のほうが良くない? pre = 10**10 for h in Hs: # print(h) if pre - h >= 0: pre = h elif pre - h == -1: pre = h - 1 else: print("No") exit(0) print("Yes")
false
53.333333
[ "-import sys", "-", "-Hs = list(map(int, input().split()))", "-prev_h = -1", "-downflg = False", "+Hs = list(map(int, input().split()))[::-1]", "+# 後ろから貪欲のほうが良くない?", "+pre = 10**10", "- # 増加中", "- if not downflg:", "- if h - prev_h >= 0:", "- prev_h = h", "- el...
false
0.039414
0.086048
0.458045
[ "s627502150", "s209586450" ]
u588341295
p03608
python
s892886977
s054938562
438
345
54,236
19,176
Accepted
Accepted
21.23
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ...
# -*- coding: utf-8 -*- import sys from scipy.sparse.csgraph import floyd_warshall def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] ...
67
50
1,938
1,456
# -*- coding: utf-8 -*- import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in rang...
# -*- coding: utf-8 -*- import sys from scipy.sparse.csgraph import floyd_warshall def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): re...
false
25.373134
[ "+from scipy.sparse.csgraph import floyd_warshall", "-", "-", "-def warshall_floyd(N: int, graph: list) -> list:", "- \"\"\"ワーシャルフロイド(頂点数, 隣接行列(0-indexed))\"\"\"", "- from copy import deepcopy", "-", "- res = deepcopy(graph)", "- for i in range(N):", "- # 始点 = 終点、は予め距離0にしておく", ...
false
0.16204
0.332539
0.48728
[ "s892886977", "s054938562" ]
u493520238
p03476
python
s634234036
s551366900
575
241
34,316
78,960
Accepted
Accepted
58.09
def get_sieve_of_eratosthenes(n): if not isinstance(n, int): raise TypeError('n is int type.') if n < 2: raise ValueError('n is more than 2') prime = [2] limit = int(n**0.5) data = [i + 1 for i in range(2, n, 2)] while True: p = data[0] if limit <= p: ...
def primes(n): is_prime = [True] * (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]: continue for j in range(i * 2, n + 1, i): is_prime[j] = False return [i for i in range(n + 1) if is_prime[i]] ...
36
37
898
845
def get_sieve_of_eratosthenes(n): if not isinstance(n, int): raise TypeError("n is int type.") if n < 2: raise ValueError("n is more than 2") prime = [2] limit = int(n**0.5) data = [i + 1 for i in range(2, n, 2)] while True: p = data[0] if limit <= p: ...
def primes(n): is_prime = [True] * (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]: continue for j in range(i * 2, n + 1, i): is_prime[j] = False return [i for i in range(n + 1) if is_prime[i]] sums = [0...
false
2.702703
[ "-def get_sieve_of_eratosthenes(n):", "- if not isinstance(n, int):", "- raise TypeError(\"n is int type.\")", "- if n < 2:", "- raise ValueError(\"n is more than 2\")", "- prime = [2]", "- limit = int(n**0.5)", "- data = [i + 1 for i in range(2, n, 2)]", "- while Tru...
false
0.247019
0.161496
1.529566
[ "s634234036", "s551366900" ]
u423966555
p02536
python
s865926486
s692133423
453
362
27,432
55,136
Accepted
Accepted
20.09
from collections import deque N, M = list(map(int, input().split())) AB = [[] for _ in range(N)] for _ in range(M): a,b = [int(x)-1 for x in input().split()] AB[a].append(b) AB[b].append(a) visited = [0] * N ans = [] for i in range(N): if visited[i]: continue group = [i] ...
import sys sys.setrecursionlimit(2 * (10 ** 6)) def main(): N, M = list(map(int, input().split())) AB = [[] for _ in range(N)] for _ in range(M): a,b = [int(x)-1 for x in input().split()] AB[a].append(b) AB[b].append(a) def dfs(v): visited[v] = 1 ...
29
30
574
609
from collections import deque N, M = list(map(int, input().split())) AB = [[] for _ in range(N)] for _ in range(M): a, b = [int(x) - 1 for x in input().split()] AB[a].append(b) AB[b].append(a) visited = [0] * N ans = [] for i in range(N): if visited[i]: continue group = [i] d = deque(AB...
import sys sys.setrecursionlimit(2 * (10**6)) def main(): N, M = list(map(int, input().split())) AB = [[] for _ in range(N)] for _ in range(M): a, b = [int(x) - 1 for x in input().split()] AB[a].append(b) AB[b].append(a) def dfs(v): visited[v] = 1 for i in AB[...
false
3.333333
[ "-from collections import deque", "+import sys", "-N, M = list(map(int, input().split()))", "-AB = [[] for _ in range(N)]", "-for _ in range(M):", "- a, b = [int(x) - 1 for x in input().split()]", "- AB[a].append(b)", "- AB[b].append(a)", "-visited = [0] * N", "-ans = []", "-for i in ra...
false
0.041946
0.042514
0.986623
[ "s865926486", "s692133423" ]
u385167811
p03127
python
s847488370
s960885911
582
369
14,252
14,480
Accepted
Accepted
36.6
N = int(eval(input())) A = input().split(" ") A = [int(i) for i in A] list = [min(A)] A = sorted(A) iii = 0 while True: iii += 1 if A[N-1] % A[N-2] != 0: A[N-1] = A[N-1] % A[N-2] elif N >= 3 and A[N-1] % A[N-3] != 0: A[N-1] = A[N-1] % A[N-3] elif N >= 4 and A[N-1] % A[N-4] !=...
N = int(eval(input())) A = input().split(" ") A = [int(i) for i in A] list = [min(A)] A = sorted(A) iii = 0 while True: iii += 1 if A[N-1] % A[N-2] != 0: A[N-1] = A[N-1] % A[N-2] elif N >= 3 and A[N-1] % A[N-3] != 0: A[N-1] = A[N-1] % A[N-3] A = sorted(A) list.append(m...
27
23
641
487
N = int(eval(input())) A = input().split(" ") A = [int(i) for i in A] list = [min(A)] A = sorted(A) iii = 0 while True: iii += 1 if A[N - 1] % A[N - 2] != 0: A[N - 1] = A[N - 1] % A[N - 2] elif N >= 3 and A[N - 1] % A[N - 3] != 0: A[N - 1] = A[N - 1] % A[N - 3] elif N >= 4 and A[N - 1] %...
N = int(eval(input())) A = input().split(" ") A = [int(i) for i in A] list = [min(A)] A = sorted(A) iii = 0 while True: iii += 1 if A[N - 1] % A[N - 2] != 0: A[N - 1] = A[N - 1] % A[N - 2] elif N >= 3 and A[N - 1] % A[N - 3] != 0: A[N - 1] = A[N - 1] % A[N - 3] A = sorted(A) list.app...
false
14.814815
[ "- elif N >= 4 and A[N - 1] % A[N - 4] != 0:", "- A[N - 1] = A[N - 1] % A[N - 4]", "- elif N >= 5 and A[N - 1] % A[N - 5] != 0:", "- A[N - 1] = A[N - 1] % A[N - 5]", "- if iii > 64:", "+ if iii > 32:" ]
false
0.043669
0.035754
1.221364
[ "s847488370", "s960885911" ]
u150984829
p02243
python
s106372810
s191676209
530
350
68,780
39,980
Accepted
Accepted
33.96
from heapq import* def m(): n=int(eval(input())) A=[[]for _ in[0]*n] for _ in[0]*n: e=list(map(int,input().split())) for i in range(e[1]):k=2*-~i;A[e[0]]+=[(e[k],e[k+1])] H=[[0,0]] d=[0]+[1e6]*n c=[1]*n while H: f=heappop(H) u=f[1] c[u]=0 if d[u]>=f[0]: for s in A[u]: v=s[0] ...
from heapq import* I=float("inf") def m(): n=int(eval(input())) A=[[]]*n for _ in range(n): e=list(map(int,input().split())) A[e[0]]=list(zip(e[2::2],e[3::2])) d=[0]+[I]*n H=[(0,0)] while H: u=heappop(H)[1] for v,c in A[u]: t=d[u]+c if d[v]>t: d[v]=t heappush(H,(t,v)) for i...
22
19
431
340
from heapq import * def m(): n = int(eval(input())) A = [[] for _ in [0] * n] for _ in [0] * n: e = list(map(int, input().split())) for i in range(e[1]): k = 2 * -~i A[e[0]] += [(e[k], e[k + 1])] H = [[0, 0]] d = [0] + [1e6] * n c = [1] * n while H: ...
from heapq import * I = float("inf") def m(): n = int(eval(input())) A = [[]] * n for _ in range(n): e = list(map(int, input().split())) A[e[0]] = list(zip(e[2::2], e[3::2])) d = [0] + [I] * n H = [(0, 0)] while H: u = heappop(H)[1] for v, c in A[u]: ...
false
13.636364
[ "+", "+I = float(\"inf\")", "- A = [[] for _ in [0] * n]", "- for _ in [0] * n:", "+ A = [[]] * n", "+ for _ in range(n):", "- for i in range(e[1]):", "- k = 2 * -~i", "- A[e[0]] += [(e[k], e[k + 1])]", "- H = [[0, 0]]", "- d = [0] + [1e6] * n", "...
false
0.043723
0.044622
0.979833
[ "s106372810", "s191676209" ]
u831244171
p02275
python
s704429181
s409121097
2,690
2,250
233,752
233,592
Accepted
Accepted
16.36
def countingSort(A,B): k = max(A) C = [0]*(k+1) for j in range(len(A)): C[A[j]] += 1 for i in range(1,k+1): C[i] += C[i-1] for j in range(len(A)): B[C[A[j]]-1] = A[j] C[A[j]] -=1 n = int(eval(input())) A = list(map(int,input().split())) B ...
def countingSort(a,n): count = [0]*(max(a)+1) for k in a: count[k] += 1 for i in range(len(count)-1): count[i+1] += count[i] sorted_a = [0]*n for k in a[::-1]: sorted_a[count[k]-1] = k count[k] -= 1 return sorted_a n = int(eval(input())) a = list...
18
17
357
367
def countingSort(A, B): k = max(A) C = [0] * (k + 1) for j in range(len(A)): C[A[j]] += 1 for i in range(1, k + 1): C[i] += C[i - 1] for j in range(len(A)): B[C[A[j]] - 1] = A[j] C[A[j]] -= 1 n = int(eval(input())) A = list(map(int, input().split())) B = [0] * len(A...
def countingSort(a, n): count = [0] * (max(a) + 1) for k in a: count[k] += 1 for i in range(len(count) - 1): count[i + 1] += count[i] sorted_a = [0] * n for k in a[::-1]: sorted_a[count[k] - 1] = k count[k] -= 1 return sorted_a n = int(eval(input())) a = list(ma...
false
5.555556
[ "-def countingSort(A, B):", "- k = max(A)", "- C = [0] * (k + 1)", "- for j in range(len(A)):", "- C[A[j]] += 1", "- for i in range(1, k + 1):", "- C[i] += C[i - 1]", "- for j in range(len(A)):", "- B[C[A[j]] - 1] = A[j]", "- C[A[j]] -= 1", "+def counti...
false
0.153784
0.062067
2.477705
[ "s704429181", "s409121097" ]
u498487134
p03001
python
s780306216
s604834009
169
73
38,384
61,916
Accepted
Accepted
56.8
#2つの長方形,ではない W,H,x,y = list(map(int,input().split())) if x==W/2 and y==H/2: print((W*H/2,1)) else: print((W*H/2,0))
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 W,H,x,y=MI() ans=(W*H)/2 if x==W/2 and y==H/2: print((ans,1)) else: print...
6
19
119
336
# 2つの長方形,ではない W, H, x, y = list(map(int, input().split())) if x == W / 2 and y == H / 2: print((W * H / 2, 1)) else: print((W * H / 2, 0))
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod = 10**9 + 7 W, H, x, y = MI() ans = (W * H) / 2 if x == W / 2 and y == H / 2: print((ans...
false
68.421053
[ "-# 2つの長方形,ではない", "-W, H, x, y = list(map(int, input().split()))", "-if x == W / 2 and y == H / 2:", "- print((W * H / 2, 1))", "-else:", "- print((W * H / 2, 0))", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "+def I():", "+ return int(eval(input()))", "+", "+",...
false
0.046537
0.045777
1.016618
[ "s780306216", "s604834009" ]
u022407960
p02315
python
s126533229
s461707900
880
430
27,912
8,340
Accepted
Accepted
51.14
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 4 5 4 2 5 2 2 1 8 3 output: 13 """ import sys from collections import namedtuple def solve(): for i, item in enumerate(item_list, 1): for cp in range(1, real_cp + 1): # capacity allows putting in, calculate value...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 4 5 4 2 5 2 2 1 8 3 output: 13 """ import sys from collections import namedtuple # def solve(): # for i, item in enumerate(item_list, 1): # for cp in range(1, real_cp + 1): # # capacity allows putting in, calcula...
43
53
973
1,229
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 4 5 4 2 5 2 2 1 8 3 output: 13 """ import sys from collections import namedtuple def solve(): for i, item in enumerate(item_list, 1): for cp in range(1, real_cp + 1): # capacity allows putting in, calculate value if item.w <=...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 4 5 4 2 5 2 2 1 8 3 output: 13 """ import sys from collections import namedtuple # def solve(): # for i, item in enumerate(item_list, 1): # for cp in range(1, real_cp + 1): # # capacity allows putting in, calculate value # if ...
false
18.867925
[ "-", "-def solve():", "- for i, item in enumerate(item_list, 1):", "- for cp in range(1, real_cp + 1):", "- # capacity allows putting in, calculate value", "- if item.w <= cp:", "- values[i][cp] = max(", "- values[i - 1][cp], values[i -...
false
0.08923
0.167363
0.533153
[ "s126533229", "s461707900" ]
u225388820
p03612
python
s673737423
s307341314
92
73
14,004
14,008
Accepted
Accepted
20.65
n=int(eval(input())) a=list(map(int,input().split())) for i in range(n): a[i]-=1 ans=0 for i in range(n-1): if a[i]==i and a[i+1]==i+1: ans+=1 a[i],a[i+1]=i+1,i if a[i]==i: ans+=1 if a[-1]==n-1: ans+=1 print(ans)
n=int(eval(input())) a=list(map(int,input().split())) ans=0 for i in range(n-1): if a[i]==i+1: a[i],a[i+1]=a[i+1],a[i] ans+=1 if a[-1]==n: ans+=1 print(ans)
14
10
259
183
n = int(eval(input())) a = list(map(int, input().split())) for i in range(n): a[i] -= 1 ans = 0 for i in range(n - 1): if a[i] == i and a[i + 1] == i + 1: ans += 1 a[i], a[i + 1] = i + 1, i if a[i] == i: ans += 1 if a[-1] == n - 1: ans += 1 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in range(n - 1): if a[i] == i + 1: a[i], a[i + 1] = a[i + 1], a[i] ans += 1 if a[-1] == n: ans += 1 print(ans)
false
28.571429
[ "-for i in range(n):", "- a[i] -= 1", "- if a[i] == i and a[i + 1] == i + 1:", "+ if a[i] == i + 1:", "+ a[i], a[i + 1] = a[i + 1], a[i]", "- a[i], a[i + 1] = i + 1, i", "- if a[i] == i:", "- ans += 1", "-if a[-1] == n - 1:", "+if a[-1] == n:" ]
false
0.077604
0.037951
2.04485
[ "s673737423", "s307341314" ]
u945181840
p02832
python
s015982765
s359440221
124
110
25,116
25,116
Accepted
Accepted
11.29
import sys read = sys.stdin.read N, *a = list(map(int, read().split())) a = [0] + a seq = [] idx = 1 for i in range(1, N + 1): if a[i] == idx: seq.append(idx) idx += 1 if seq: print((N - len(seq))) else: print((-1))
import sys read = sys.stdin.read N, *a = list(map(int, read().split())) cnt = 0 idx = 1 for i in a: if i == idx: cnt += 1 idx += 1 if cnt: print((N - cnt)) else: print((-1))
17
17
252
219
import sys read = sys.stdin.read N, *a = list(map(int, read().split())) a = [0] + a seq = [] idx = 1 for i in range(1, N + 1): if a[i] == idx: seq.append(idx) idx += 1 if seq: print((N - len(seq))) else: print((-1))
import sys read = sys.stdin.read N, *a = list(map(int, read().split())) cnt = 0 idx = 1 for i in a: if i == idx: cnt += 1 idx += 1 if cnt: print((N - cnt)) else: print((-1))
false
0
[ "-a = [0] + a", "-seq = []", "+cnt = 0", "-for i in range(1, N + 1):", "- if a[i] == idx:", "- seq.append(idx)", "+for i in a:", "+ if i == idx:", "+ cnt += 1", "-if seq:", "- print((N - len(seq)))", "+if cnt:", "+ print((N - cnt))" ]
false
0.036088
0.03562
1.01314
[ "s015982765", "s359440221" ]
u726615467
p02957
python
s774321510
s558167976
20
17
2,940
2,940
Accepted
Accepted
15
inf = 10 ** 18 P = 10 ** 9 + 7 A, B = list(map(int, input().split())) ans = (A + B) // 2 if abs(A - ans) == abs(B - ans): print(ans) else: print('IMPOSSIBLE')
A, B = list(map(int, input().split())) K = (A + B) // 2 if abs(A - K) == abs(B - K): print(K) else: print('IMPOSSIBLE')
11
8
173
130
inf = 10**18 P = 10**9 + 7 A, B = list(map(int, input().split())) ans = (A + B) // 2 if abs(A - ans) == abs(B - ans): print(ans) else: print("IMPOSSIBLE")
A, B = list(map(int, input().split())) K = (A + B) // 2 if abs(A - K) == abs(B - K): print(K) else: print("IMPOSSIBLE")
false
27.272727
[ "-inf = 10**18", "-P = 10**9 + 7", "-ans = (A + B) // 2", "-if abs(A - ans) == abs(B - ans):", "- print(ans)", "+K = (A + B) // 2", "+if abs(A - K) == abs(B - K):", "+ print(K)" ]
false
0.043768
0.044278
0.988485
[ "s774321510", "s558167976" ]
u366644013
p03273
python
s038141609
s715868439
37
32
4,596
4,468
Accepted
Accepted
13.51
na = lambda: list(map(int, input().split())) h, w = na() t = [] cnt = 0 for i in range(h): I = list(input()) if not("#" in I): cnt += 1 continue t.append(I) output = [] for j in range(w): flag = False for i in range(h-cnt): if t[i][j] == "#": flag...
h, w = map(int, input().split()) t = [] goodx = [0]*110 goody = [0]*110 for i in range(h): t.append(input()) for i in range(h): for j in range(w): if t[i][j] == "#": goodx[i] = 1 goody[j] = 1 for i in range(h): if goodx[i]: for j in range(w): ...
24
20
483
396
na = lambda: list(map(int, input().split())) h, w = na() t = [] cnt = 0 for i in range(h): I = list(input()) if not ("#" in I): cnt += 1 continue t.append(I) output = [] for j in range(w): flag = False for i in range(h - cnt): if t[i][j] == "#": flag = True if...
h, w = map(int, input().split()) t = [] goodx = [0] * 110 goody = [0] * 110 for i in range(h): t.append(input()) for i in range(h): for j in range(w): if t[i][j] == "#": goodx[i] = 1 goody[j] = 1 for i in range(h): if goodx[i]: for j in range(w): if goody[...
false
16.666667
[ "-na = lambda: list(map(int, input().split()))", "-h, w = na()", "+h, w = map(int, input().split())", "-cnt = 0", "+goodx = [0] * 110", "+goody = [0] * 110", "- I = list(input())", "- if not (\"#\" in I):", "- cnt += 1", "- continue", "- t.append(I)", "-output = []", "...
false
0.033749
0.068934
0.489577
[ "s038141609", "s715868439" ]
u143492911
p03363
python
s305261631
s513275717
1,523
191
41,812
41,428
Accepted
Accepted
87.46
n=int(eval(input())) a=list(map(int,input().split())) import math s=[0]*(n+1)#累積和法 a.insert(0,0) for i in range(1,n+1): s[i]=s[i-1]+a[i] from collections import Counter data=Counter(s) def combination_cout(n,r): return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))#組み合わせ計算 ans=[] for i i...
n=int(eval(input())) a=list(map(int,input().split())) from collections import Counter a.insert(0,0) s=[0]*(n+1) for i in range(1,n+1): s[i]=s[i-1]+a[i] data=Counter(s) cnt=[] for i in list(data.values()): if 2<=i: cnt.append(i) def combination_cnt(n): return n*(n-1)//2 ans=0 for i in ...
20
20
467
375
n = int(eval(input())) a = list(map(int, input().split())) import math s = [0] * (n + 1) # 累積和法 a.insert(0, 0) for i in range(1, n + 1): s[i] = s[i - 1] + a[i] from collections import Counter data = Counter(s) def combination_cout(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r...
n = int(eval(input())) a = list(map(int, input().split())) from collections import Counter a.insert(0, 0) s = [0] * (n + 1) for i in range(1, n + 1): s[i] = s[i - 1] + a[i] data = Counter(s) cnt = [] for i in list(data.values()): if 2 <= i: cnt.append(i) def combination_cnt(n): return n * (n - 1)...
false
0
[ "-import math", "+from collections import Counter", "-s = [0] * (n + 1) # 累積和法", "+s = [0] * (n + 1)", "-from collections import Counter", "-", "+cnt = []", "+for i in list(data.values()):", "+ if 2 <= i:", "+ cnt.append(i)", "-def combination_cout(n, r):", "- return math.factori...
false
0.076937
0.03767
2.042394
[ "s305261631", "s513275717" ]
u882831132
p03380
python
s672364251
s247587504
161
127
14,428
14,180
Accepted
Accepted
21.12
N = int(eval(input())) a = sorted(int(x) for x in input().split()) def hoge(n, r): return n * (min(n-r, r)) n = max(a) ans = (n, a[0]) for i in a[1:]: ans = (n, i) if hoge(*ans) < hoge(n, i) else ans print((*ans))
N = int(eval(input())) a = tuple(int(x) for x in input().split()) def hoge(n, r): return n * (min(n-r, r)) n = max(a) ans = (n, a[0]) if n != a[0] else (n, a[1]) for i in a: if n == i: continue ans = (n, i) if hoge(*ans) < hoge(n, i) else ans print((*ans))
11
12
219
265
N = int(eval(input())) a = sorted(int(x) for x in input().split()) def hoge(n, r): return n * (min(n - r, r)) n = max(a) ans = (n, a[0]) for i in a[1:]: ans = (n, i) if hoge(*ans) < hoge(n, i) else ans print((*ans))
N = int(eval(input())) a = tuple(int(x) for x in input().split()) def hoge(n, r): return n * (min(n - r, r)) n = max(a) ans = (n, a[0]) if n != a[0] else (n, a[1]) for i in a: if n == i: continue ans = (n, i) if hoge(*ans) < hoge(n, i) else ans print((*ans))
false
8.333333
[ "-a = sorted(int(x) for x in input().split())", "+a = tuple(int(x) for x in input().split())", "-ans = (n, a[0])", "-for i in a[1:]:", "+ans = (n, a[0]) if n != a[0] else (n, a[1])", "+for i in a:", "+ if n == i:", "+ continue" ]
false
0.040719
0.066548
0.611869
[ "s672364251", "s247587504" ]
u285891772
p03568
python
s445372454
s866508455
42
38
5,460
5,144
Accepted
Accepted
9.52
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
30
30
1,000
996
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, ) # , log2 from itertools import ( accumulate, permutations, combinations, combi...
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, ) # , log2 from itertools import ( accumulate, permutations, combinations, combi...
false
0
[ "-a = [2 - x % 2 for x in A]", "-odd = 1", "-for x in a:", "- odd *= x", "-print((3**N - odd))", "+ans = 3**N", "+tmp = 1", "+for a in A:", "+ if a % 2 == 0:", "+ tmp *= 2", "+print((ans - tmp))" ]
false
0.040928
0.042549
0.961901
[ "s445372454", "s866508455" ]
u297574184
p02913
python
s590259546
s067814073
747
439
50,780
206,216
Accepted
Accepted
41.23
N = int(eval(input())) Ss = eval(input()) def getZArray(Ss): lenS = len(Ss) As = [lenS] * lenS i, j = 1, 0 while i < lenS: while i+j < lenS and Ss[j] == Ss[i+j]: j += 1 As[i] = j if j == 0: i += 1 else: k = 1 ...
N = int(eval(input())) Ss = eval(input()) def isOK(k): strAs = ['' for _ in range(N)] strBs = ['' for _ in range(N)] for L in range(N-k+1): R = L+k-1 ss = Ss[L:R+1] strAs[R] = ss strBs[L] = ss strCands = set() for iEn in range(N-1): if strAs[iE...
30
31
618
614
N = int(eval(input())) Ss = eval(input()) def getZArray(Ss): lenS = len(Ss) As = [lenS] * lenS i, j = 1, 0 while i < lenS: while i + j < lenS and Ss[j] == Ss[i + j]: j += 1 As[i] = j if j == 0: i += 1 else: k = 1 while i +...
N = int(eval(input())) Ss = eval(input()) def isOK(k): strAs = ["" for _ in range(N)] strBs = ["" for _ in range(N)] for L in range(N - k + 1): R = L + k - 1 ss = Ss[L : R + 1] strAs[R] = ss strBs[L] = ss strCands = set() for iEn in range(N - 1): if strAs[iE...
false
3.225806
[ "-def getZArray(Ss):", "- lenS = len(Ss)", "- As = [lenS] * lenS", "- i, j = 1, 0", "- while i < lenS:", "- while i + j < lenS and Ss[j] == Ss[i + j]:", "- j += 1", "- As[i] = j", "- if j == 0:", "- i += 1", "- else:", "- ...
false
0.037365
0.034945
1.069262
[ "s590259546", "s067814073" ]
u462329577
p02820
python
s326430683
s610210348
207
111
40,688
3,316
Accepted
Accepted
46.38
#!/usr/bin/env python3 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n,k = list(map(int,input().split())) r,s,p = list(map(int,input().split())) point_dict = {"r":p,"s":r, "p":s} t = eval(input()) # ゲームの問題 # ジャンケンをNかいする # Kかい前の手と同じ手を出すことはで...
n, k = list(map(int, input().split())) score = list(map(int, input().split())) score = {"r": score[2], "s": score[0], "p": score[1]} # ord(r) = 114 # r の時はp s -> r p -> s を出すことになる。 t = eval(input()) l = len(t) ans = 0 for i in range(k): cnt = 0 pre = "" while True: if k * cnt + i >= l: ...
34
22
891
559
#!/usr/bin/env python3 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n, k = list(map(int, input().split())) r, s, p = list(map(int, input().split())) point_dict = {"r": p, "s": r, "p": s} t = eval(input()) # ゲームの問題 # ジャンケンをNかいする # Kかい前の手と同じ手を出すことはでき...
n, k = list(map(int, input().split())) score = list(map(int, input().split())) score = {"r": score[2], "s": score[0], "p": score[1]} # ord(r) = 114 # r の時はp s -> r p -> s を出すことになる。 t = eval(input()) l = len(t) ans = 0 for i in range(k): cnt = 0 pre = "" while True: if k * cnt + i >= l: b...
false
35.294118
[ "-#!/usr/bin/env python3", "-import sys", "-", "-read = sys.stdin.buffer.read", "-readline = sys.stdin.buffer.readline", "-readlines = sys.stdin.buffer.readlines", "-r, s, p = list(map(int, input().split()))", "-point_dict = {\"r\": p, \"s\": r, \"p\": s}", "+score = list(map(int, input().split()))"...
false
0.036643
0.035482
1.032721
[ "s326430683", "s610210348" ]
u883048396
p04046
python
s850465721
s417702275
277
225
18,804
18,676
Accepted
Accepted
18.77
iH,iW,iA,iB = [int(x) for x in input().split()] iD = 10**9+7 #法 #初等整数論勉強して解説通りキッチリ実装したった #二分累乗法 iDを法として def fBiPow(iX,iN,iD): iY = 1 while iN > 0: if iN % 2 == 0: iX = iX * iX % iD iN = iN // 2 else: iY = iX * iY % iD iN = iN - 1 ...
iH,iW,iA,iB = [int(x) for x in input().split()] iD = 10**9+7 #法 iLBoxW=iB-1 iLBoxH=iH-iA-1 iRBoxW=iW-iB-1 iRBoxH=iH-1 #iMax = iH+iW-2 iMax = max(iLBoxW+iLBoxH,iRBoxW+iRBoxH) #nCr = n!/r!(n-r)! #二分累乗法 iDを法として def fBiPow(iX,iN,iD): iY = 1 while iN > 0: if iN % 2 == 0: iX = ...
51
40
1,147
876
iH, iW, iA, iB = [int(x) for x in input().split()] iD = 10**9 + 7 # 法 # 初等整数論勉強して解説通りキッチリ実装したった # 二分累乗法 iDを法として def fBiPow(iX, iN, iD): iY = 1 while iN > 0: if iN % 2 == 0: iX = iX * iX % iD iN = iN // 2 else: iY = iX * iY % iD iN = iN - 1 ret...
iH, iW, iA, iB = [int(x) for x in input().split()] iD = 10**9 + 7 # 法 iLBoxW = iB - 1 iLBoxH = iH - iA - 1 iRBoxW = iW - iB - 1 iRBoxH = iH - 1 # iMax = iH+iW-2 iMax = max(iLBoxW + iLBoxH, iRBoxW + iRBoxH) # nCr = n!/r!(n-r)! # 二分累乗法 iDを法として def fBiPow(iX, iN, iD): iY = 1 while iN > 0: if iN % 2 == 0: ...
false
21.568627
[ "-# 初等整数論勉強して解説通りキッチリ実装したった", "+iLBoxW = iB - 1", "+iLBoxH = iH - iA - 1", "+iRBoxW = iW - iB - 1", "+iRBoxH = iH - 1", "+# iMax = iH+iW-2", "+iMax = max(iLBoxW + iLBoxH, iRBoxW + iRBoxH)", "+# nCr = n!/r!(n-r)!", "-# nCr = n!/r!(n-r)!", "-# ループ回すだけ版や", "-def fFr(iX, iR=1):", "- if iR == 0 ...
false
0.090588
0.119539
0.757812
[ "s850465721", "s417702275" ]
u510829608
p02271
python
s941375646
s831938749
700
420
58,128
7,764
Accepted
Accepted
40
import itertools as it n = int(eval(input())) A = list(map(int, input().split())) q = int(eval(input())) m = list(map(int, input().split())) s = set() for i in range(n): li= list(it.combinations(A, i+1)) for j in range(len(li)): s.add(sum(li[j])) for k in range(q): print(('yes...
from itertools import combinations n = int(eval(input())) A = list(map(int, input().split())) q = int(eval(input())) m = list(map(int, input().split())) l = set(sum(t) for i in range(n) for t in combinations(A, i+1)) for j in m: print(('yes' if j in l else 'no'))
16
12
332
276
import itertools as it n = int(eval(input())) A = list(map(int, input().split())) q = int(eval(input())) m = list(map(int, input().split())) s = set() for i in range(n): li = list(it.combinations(A, i + 1)) for j in range(len(li)): s.add(sum(li[j])) for k in range(q): print(("yes" if m[k] in s else...
from itertools import combinations n = int(eval(input())) A = list(map(int, input().split())) q = int(eval(input())) m = list(map(int, input().split())) l = set(sum(t) for i in range(n) for t in combinations(A, i + 1)) for j in m: print(("yes" if j in l else "no"))
false
25
[ "-import itertools as it", "+from itertools import combinations", "-s = set()", "-for i in range(n):", "- li = list(it.combinations(A, i + 1))", "- for j in range(len(li)):", "- s.add(sum(li[j]))", "-for k in range(q):", "- print((\"yes\" if m[k] in s else \"no\"))", "+l = set(sum(...
false
0.032474
0.037158
0.873951
[ "s941375646", "s831938749" ]
u325119213
p02693
python
s971914870
s677660257
22
20
9,156
9,164
Accepted
Accepted
9.09
k = int(eval(input())) a, b = list(map(int, input().split())) for i in range(a, b+1): if i % k == 0: print('OK') exit() print('NG')
k = int(eval(input())) a, b = list(map(int, input().split())) upper_times_k = (b // k) * k if a <= upper_times_k: print('OK') else: print('NG')
12
9
153
145
k = int(eval(input())) a, b = list(map(int, input().split())) for i in range(a, b + 1): if i % k == 0: print("OK") exit() print("NG")
k = int(eval(input())) a, b = list(map(int, input().split())) upper_times_k = (b // k) * k if a <= upper_times_k: print("OK") else: print("NG")
false
25
[ "-for i in range(a, b + 1):", "- if i % k == 0:", "- print(\"OK\")", "- exit()", "-print(\"NG\")", "+upper_times_k = (b // k) * k", "+if a <= upper_times_k:", "+ print(\"OK\")", "+else:", "+ print(\"NG\")" ]
false
0.007361
0.037956
0.193927
[ "s971914870", "s677660257" ]
u761320129
p03495
python
s222895155
s507974116
219
137
39,344
32,540
Accepted
Accepted
37.44
from collections import Counter N,K = list(map(int,input().split())) src = list(map(int,input().split())) ctr = Counter(src) ans = 0 kind = len(ctr) for k,v in reversed(ctr.most_common()): if kind <= K: break ans += v kind -= 1 print(ans)
from collections import Counter N,K = list(map(int,input().split())) src = list(map(int,input().split())) ctr = Counter(src) ans = N for k,v in ctr.most_common(K): ans -= v print(ans)
13
9
266
190
from collections import Counter N, K = list(map(int, input().split())) src = list(map(int, input().split())) ctr = Counter(src) ans = 0 kind = len(ctr) for k, v in reversed(ctr.most_common()): if kind <= K: break ans += v kind -= 1 print(ans)
from collections import Counter N, K = list(map(int, input().split())) src = list(map(int, input().split())) ctr = Counter(src) ans = N for k, v in ctr.most_common(K): ans -= v print(ans)
false
30.769231
[ "-ans = 0", "-kind = len(ctr)", "-for k, v in reversed(ctr.most_common()):", "- if kind <= K:", "- break", "- ans += v", "- kind -= 1", "+ans = N", "+for k, v in ctr.most_common(K):", "+ ans -= v" ]
false
0.041017
0.038533
1.06448
[ "s222895155", "s507974116" ]
u073852194
p02558
python
s344977340
s829049055
394
215
80,944
75,920
Accepted
Accepted
45.43
class DisjointSetUnion(): def __init__(self, n): self.n = n self.par_size = [-1] * n def merge(self, a, b): assert 0 <= a < self.n assert 0 <= b < self.n x = self.leader(a) y = self.leader(b) if x == y: return x if -self.par_size[x] < -...
class DisjointSetUnion(): def __init__(self, n): self.n = n self.par_size = [-1] * n def merge(self, a, b): #assert 0 <= a < self.n #assert 0 <= b < self.n x = self.leader(a) y = self.leader(b) if x == y: return x if -self.par_size[x] <...
63
63
1,677
1,683
class DisjointSetUnion: def __init__(self, n): self.n = n self.par_size = [-1] * n def merge(self, a, b): assert 0 <= a < self.n assert 0 <= b < self.n x = self.leader(a) y = self.leader(b) if x == y: return x if -self.par_size[x] < -s...
class DisjointSetUnion: def __init__(self, n): self.n = n self.par_size = [-1] * n def merge(self, a, b): # assert 0 <= a < self.n # assert 0 <= b < self.n x = self.leader(a) y = self.leader(b) if x == y: return x if -self.par_size[x] ...
false
0
[ "- assert 0 <= a < self.n", "- assert 0 <= b < self.n", "+ # assert 0 <= a < self.n", "+ # assert 0 <= b < self.n", "- assert 0 <= a < self.n", "- assert 0 <= b < self.n", "+ # assert 0 <= a < self.n", "+ # assert 0 <= b < self.n", "- as...
false
0.041733
0.040938
1.019435
[ "s344977340", "s829049055" ]
u312025627
p03598
python
s596795293
s265695758
175
18
38,256
2,940
Accepted
Accepted
89.71
def main(): N = int(eval(input())) K = int(eval(input())) X = [int(i) for i in input().split()] ans = 0 for x in X: ans += 2 * min(x, K - x) print(ans) if __name__ == '__main__': main()
def main(): N = int(eval(input())) K = int(eval(input())) X = [int(i) for i in input().split()] ans = 0 for x in X: ans += min(x, K-x)*2 print(ans) if __name__ == '__main__': main()
12
12
223
219
def main(): N = int(eval(input())) K = int(eval(input())) X = [int(i) for i in input().split()] ans = 0 for x in X: ans += 2 * min(x, K - x) print(ans) if __name__ == "__main__": main()
def main(): N = int(eval(input())) K = int(eval(input())) X = [int(i) for i in input().split()] ans = 0 for x in X: ans += min(x, K - x) * 2 print(ans) if __name__ == "__main__": main()
false
0
[ "- ans += 2 * min(x, K - x)", "+ ans += min(x, K - x) * 2" ]
false
0.032029
0.035335
0.906442
[ "s596795293", "s265695758" ]
u608007704
p02602
python
s511542212
s456780912
171
148
31,528
31,720
Accepted
Accepted
13.45
N,K=list(map(int,input().split())) A=list(map(int,input().split())) tmp=1 before_score=0 for i in range(K,N): if i>=K-1: if i>=K: print(('Yes' if A[i-K]<A[i] else 'No'))
N,K=list(map(int,input().split())) A=list(map(int,input().split())) for i in range(K,N): print(('Yes' if A[i-K]<A[i] else 'No'))
10
5
185
132
N, K = list(map(int, input().split())) A = list(map(int, input().split())) tmp = 1 before_score = 0 for i in range(K, N): if i >= K - 1: if i >= K: print(("Yes" if A[i - K] < A[i] else "No"))
N, K = list(map(int, input().split())) A = list(map(int, input().split())) for i in range(K, N): print(("Yes" if A[i - K] < A[i] else "No"))
false
50
[ "-tmp = 1", "-before_score = 0", "- if i >= K - 1:", "- if i >= K:", "- print((\"Yes\" if A[i - K] < A[i] else \"No\"))", "+ print((\"Yes\" if A[i - K] < A[i] else \"No\"))" ]
false
0.039821
0.037838
1.052417
[ "s511542212", "s456780912" ]
u212831449
p02796
python
s329731469
s233276318
506
291
27,872
24,668
Accepted
Accepted
42.49
n = int(eval(input())) s = [list(map(int,input().split())) for i in range(n)] s.sort() stop = s[0][0] + s[0][1] ans = 1 for i in range(1,n): num = s[i][0] l = s[i][1] if num - l >= stop: ans += 1 stop = num + l if num + l < stop: stop = num + l print(ans)...
n = int(eval(input())) a = [] for i in range(n): x,l = list(map(int,input().split())) s = x-l g = x+l a.append((s,g)) a = sorted(a, reverse=False, key=lambda x: x[1]) tmp = a[0][1] ans = 1 for i in range(1,len(a)): if tmp <= a[i][0]: tmp = a[i][1] ans += 1 print(a...
20
17
319
311
n = int(eval(input())) s = [list(map(int, input().split())) for i in range(n)] s.sort() stop = s[0][0] + s[0][1] ans = 1 for i in range(1, n): num = s[i][0] l = s[i][1] if num - l >= stop: ans += 1 stop = num + l if num + l < stop: stop = num + l print(ans)
n = int(eval(input())) a = [] for i in range(n): x, l = list(map(int, input().split())) s = x - l g = x + l a.append((s, g)) a = sorted(a, reverse=False, key=lambda x: x[1]) tmp = a[0][1] ans = 1 for i in range(1, len(a)): if tmp <= a[i][0]: tmp = a[i][1] ans += 1 print(ans)
false
15
[ "-s = [list(map(int, input().split())) for i in range(n)]", "-s.sort()", "-stop = s[0][0] + s[0][1]", "+a = []", "+for i in range(n):", "+ x, l = list(map(int, input().split()))", "+ s = x - l", "+ g = x + l", "+ a.append((s, g))", "+a = sorted(a, reverse=False, key=lambda x: x[1])", ...
false
0.03555
0.064197
0.553764
[ "s329731469", "s233276318" ]
u485349322
p02657
python
s670794342
s454691421
31
28
9,084
9,048
Accepted
Accepted
9.68
#169A a, b = list(map(int, input().split())) # print(a) # print(b) answer=a*b print(answer)
A,B=input().split() A=int(A) B=int(B) print((A*B))
9
4
97
52
# 169A a, b = list(map(int, input().split())) # print(a) # print(b) answer = a * b print(answer)
A, B = input().split() A = int(A) B = int(B) print((A * B))
false
55.555556
[ "-# 169A", "-a, b = list(map(int, input().split()))", "-# print(a)", "-# print(b)", "-answer = a * b", "-print(answer)", "+A, B = input().split()", "+A = int(A)", "+B = int(B)", "+print((A * B))" ]
false
0.049073
0.045187
1.085993
[ "s670794342", "s454691421" ]
u102242691
p03086
python
s396097298
s514702183
29
17
2,940
3,064
Accepted
Accepted
41.38
s = eval(input()) n = len(s) ans = 0 for i in range(n): for j in range(i,n): if all("ACGT".count(c) == 1 for c in s[i:j + 1]): ans = max(ans, j -i +1) print(ans)
s = eval(input()) ans = 0 for i in range(len(s)): count = 0 for j in range(i,len(s)): if s[j] in "ACGT": count += 1 else: break if count >= ans: ans = count print(ans)
10
13
191
235
s = eval(input()) n = len(s) ans = 0 for i in range(n): for j in range(i, n): if all("ACGT".count(c) == 1 for c in s[i : j + 1]): ans = max(ans, j - i + 1) print(ans)
s = eval(input()) ans = 0 for i in range(len(s)): count = 0 for j in range(i, len(s)): if s[j] in "ACGT": count += 1 else: break if count >= ans: ans = count print(ans)
false
23.076923
[ "-n = len(s)", "-for i in range(n):", "- for j in range(i, n):", "- if all(\"ACGT\".count(c) == 1 for c in s[i : j + 1]):", "- ans = max(ans, j - i + 1)", "+for i in range(len(s)):", "+ count = 0", "+ for j in range(i, len(s)):", "+ if s[j] in \"ACGT\":", "+ ...
false
0.037702
0.037126
1.015525
[ "s396097298", "s514702183" ]
u729133443
p02640
python
s105674825
s573045139
63
22
61,896
9,168
Accepted
Accepted
65.08
x,y=list(map(int,input().split())) print(('YNeos'[y%2or y>x*4or y<x*2::2]))
x,y=list(map(int,input().split())) print(('NYoe s'[(2*x<=y<=4*x)>y%2::2]))
2
2
68
67
x, y = list(map(int, input().split())) print(("YNeos"[y % 2 or y > x * 4 or y < x * 2 :: 2]))
x, y = list(map(int, input().split())) print(("NYoe s"[(2 * x <= y <= 4 * x) > y % 2 :: 2]))
false
0
[ "-print((\"YNeos\"[y % 2 or y > x * 4 or y < x * 2 :: 2]))", "+print((\"NYoe s\"[(2 * x <= y <= 4 * x) > y % 2 :: 2]))" ]
false
0.045288
0.038069
1.189648
[ "s105674825", "s573045139" ]
u634079249
p03073
python
s980204665
s252434640
40
21
4,020
4,308
Accepted
Accepted
47.5
import sys import os ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: list(map(int, sys.stdin.buffer.readline().split())) fl = lambda: list(map(float, sys.stdin.buffer.readline().split())) iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)] iss = lambda: sys.stdin....
import sys import os ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: list(map(int, sys.stdin.buffer.readline().split())) fl = lambda: list(map(float, sys.stdin.buffer.readline().split())) iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)] iss = lambda: sys.stdin....
34
26
882
770
import sys import os ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: list(map(int, sys.stdin.buffer.readline().split())) fl = lambda: list(map(float, sys.stdin.buffer.readline().split())) iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)] iss = lambda: sys.stdin.buffer.re...
import sys import os ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: list(map(int, sys.stdin.buffer.readline().split())) fl = lambda: list(map(float, sys.stdin.buffer.readline().split())) iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)] iss = lambda: sys.stdin.buffer.re...
false
23.529412
[ "-def func(q, S):", "- ret = 0", "- for s in S:", "- if q == s:", "- ret += 1", "- q = \"1\" if q == \"0\" else \"0\"", "- return ret", "-", "-", "- print((min(func(\"0\", S), func(\"1\", S))))", "+ t = S[::2].count(\"0\") + S[1::2].count(\"1\")", "+ ...
false
0.147441
0.037938
3.886357
[ "s980204665", "s252434640" ]
u637170240
p02838
python
s820066535
s434537736
980
326
122,808
48,840
Accepted
Accepted
66.73
N = int(eval(input())) A = list(map(int, input().split())) p = int(1e9+7) res = 0 for i in range(60): zc = 0 oc = 0 for j in range(len(A)): if A[j] % 2 == 0: zc += 1 else: oc += 1 A[j] = A[j] >> 1 res += zc*oc*2**i res %= p print...
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split()))) p = int(1e9+7) res = 0 for i in range(60): zc = np.count_nonzero(A & 1) oc = N - zc res += zc*oc*2**i res %= p A >>= 1 print(res)
20
17
319
252
N = int(eval(input())) A = list(map(int, input().split())) p = int(1e9 + 7) res = 0 for i in range(60): zc = 0 oc = 0 for j in range(len(A)): if A[j] % 2 == 0: zc += 1 else: oc += 1 A[j] = A[j] >> 1 res += zc * oc * 2**i res %= p print(res)
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split()))) p = int(1e9 + 7) res = 0 for i in range(60): zc = np.count_nonzero(A & 1) oc = N - zc res += zc * oc * 2**i res %= p A >>= 1 print(res)
false
15
[ "+import numpy as np", "+", "-A = list(map(int, input().split()))", "+A = np.array(list(map(int, input().split())))", "- zc = 0", "- oc = 0", "- for j in range(len(A)):", "- if A[j] % 2 == 0:", "- zc += 1", "- else:", "- oc += 1", "- A[j] = A...
false
0.125141
0.221738
0.564362
[ "s820066535", "s434537736" ]
u330661451
p03659
python
s652299397
s580042847
198
149
24,812
24,832
Accepted
Accepted
24.75
n = int(eval(input())) a = list(map(int,input().split())) sm = sum(a) sn = a[0] ar = sm - a[0] ans = abs(sn - ar) for i in range(1,len(a)-1): sn += a[i] ar -= a[i] ans = min(ans,abs(sn-ar)) print(ans)
def main(): _ = int(eval(input())) a = list(map(int,input().split())) sm = sum(a) sn = a[0] ar = sm - a[0] ans = abs(sn - ar) for i in range(1,len(a)-1): sn += a[i] ar -= a[i] ans = min(ans,abs(sn-ar)) print(ans) if __name__ == "__main__": ...
14
18
222
321
n = int(eval(input())) a = list(map(int, input().split())) sm = sum(a) sn = a[0] ar = sm - a[0] ans = abs(sn - ar) for i in range(1, len(a) - 1): sn += a[i] ar -= a[i] ans = min(ans, abs(sn - ar)) print(ans)
def main(): _ = int(eval(input())) a = list(map(int, input().split())) sm = sum(a) sn = a[0] ar = sm - a[0] ans = abs(sn - ar) for i in range(1, len(a) - 1): sn += a[i] ar -= a[i] ans = min(ans, abs(sn - ar)) print(ans) if __name__ == "__main__": main()
false
22.222222
[ "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-sm = sum(a)", "-sn = a[0]", "-ar = sm - a[0]", "-ans = abs(sn - ar)", "-for i in range(1, len(a) - 1):", "- sn += a[i]", "- ar -= a[i]", "- ans = min(ans, abs(sn - ar))", "-print(ans)", "+def main():", "+ _ = in...
false
0.040672
0.114972
0.353753
[ "s652299397", "s580042847" ]
u968166680
p03476
python
s084576871
s841535417
379
175
52,640
28,248
Accepted
Accepted
53.83
from sys import stdin, setrecursionlimit from itertools import accumulate setrecursionlimit(10 ** 9) INF = 1 << 60 def input(): return stdin.readline().strip() def prime_numbers(n): if n < 2: return [] m = (n + 1) // 2 p = [True] * m for i in range(1, int((n ** 0.5 - 1...
from sys import stdin, setrecursionlimit from itertools import accumulate setrecursionlimit(10 ** 9) INF = 1 << 60 def input(): return stdin.readline().strip() def prime_numbers(n): if n < 2: return [] m = (n + 1) // 2 p = [True] * m for i in range(1, int((n ** 0.5 - 1...
39
38
780
782
from sys import stdin, setrecursionlimit from itertools import accumulate setrecursionlimit(10**9) INF = 1 << 60 def input(): return stdin.readline().strip() def prime_numbers(n): if n < 2: return [] m = (n + 1) // 2 p = [True] * m for i in range(1, int((n**0.5 - 1) / 2) + 1): i...
from sys import stdin, setrecursionlimit from itertools import accumulate setrecursionlimit(10**9) INF = 1 << 60 def input(): return stdin.readline().strip() def prime_numbers(n): if n < 2: return [] m = (n + 1) // 2 p = [True] * m for i in range(1, int((n**0.5 - 1) / 2) + 1): i...
false
2.564103
[ "-Q = int(eval(input()))", "-for _ in range(Q):", "- l, r = list(map(int, input().split()))", "+Q, *LR = list(map(int, open(0).read().split()))", "+for l, r in zip(*[iter(LR)] * 2):" ]
false
0.07665
0.072392
1.058819
[ "s084576871", "s841535417" ]
u654470292
p03805
python
s380822810
s704432504
341
307
50,776
67,436
Accepted
Accepted
9.97
n,m=list(map(int,input().split())) path=[list(map(int,input().split())) for i in range(m)] # print(path) def ok(l1, now, next): # print([l1]) # print([now, next]) l=l1[:] count=0 if [now,next] in path or [next, now] in path: l.remove(next) if len(l)==0: retur...
import sys from collections import * import heapq import math import bisect from itertools import permutations,accumulate,combinations,product from fractions import gcd def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) mod=pow(10,9)+7 al=[chr(ord('a') +...
27
39
574
851
n, m = list(map(int, input().split())) path = [list(map(int, input().split())) for i in range(m)] # print(path) def ok(l1, now, next): # print([l1]) # print([now, next]) l = l1[:] count = 0 if [now, next] in path or [next, now] in path: l.remove(next) if len(l) == 0: retu...
import sys from collections import * import heapq import math import bisect from itertools import permutations, accumulate, combinations, product from fractions import gcd def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0] + list(accumulate(lst)) mod = pow(10, 9) + 7 al = [chr(ord(...
false
30.769231
[ "-n, m = list(map(int, input().split()))", "-path = [list(map(int, input().split())) for i in range(m)]", "-# print(path)", "-def ok(l1, now, next):", "- # print([l1])", "- # print([now, next])", "- l = l1[:]", "- count = 0", "- if [now, next] in path or [next, now] in path:", "- ...
false
0.04855
0.049407
0.982657
[ "s380822810", "s704432504" ]
u018679195
p02633
python
s249830712
s686902917
31
28
8,828
9,100
Accepted
Accepted
9.68
import math if __name__ == "__main__": deg = int(eval(input())) print((360//math.gcd(deg, 360)))
def lcm(x, y): if x > y: greater = x else: greater = y while(True): if((greater % x == 0) and (greater % y == 0)): lcm = greater break greater += 1 return lcm x = int(eval(input())) if 360%x == 0: print((int(360/x))) else : print...
5
18
101
332
import math if __name__ == "__main__": deg = int(eval(input())) print((360 // math.gcd(deg, 360)))
def lcm(x, y): if x > y: greater = x else: greater = y while True: if (greater % x == 0) and (greater % y == 0): lcm = greater break greater += 1 return lcm x = int(eval(input())) if 360 % x == 0: print((int(360 / x))) else: print((int(lc...
false
72.222222
[ "-import math", "+def lcm(x, y):", "+ if x > y:", "+ greater = x", "+ else:", "+ greater = y", "+ while True:", "+ if (greater % x == 0) and (greater % y == 0):", "+ lcm = greater", "+ break", "+ greater += 1", "+ return lcm", "-i...
false
0.042307
0.095196
0.444414
[ "s249830712", "s686902917" ]
u163320134
p02580
python
s766251380
s028358093
598
446
158,652
163,744
Accepted
Accepted
25.42
#!/usr/bin/env python3 import collections import sys input=sys.stdin.readline h,w,m=list(map(int,input().split())) items=[set() for _ in range(h+1)] count_h=[0]*(h+1) count_w=[0]*(w+1) for _ in range(m): y,x=list(map(int,input().split())) items[y].add(x) count_h[y]+=1 count_w[x]+=1 coun...
#!/usr/bin/env python3 import collections import sys input=sys.stdin.readline h,w,m=list(map(int,input().split())) items=set() count_h=[0]*(h+1) count_w=[0]*(w+1) for _ in range(m): y,x=list(map(int,input().split())) items.add((y,x)) count_h[y]+=1 count_w[x]+=1 max_h=max(count_h) max_w...
33
33
829
623
#!/usr/bin/env python3 import collections import sys input = sys.stdin.readline h, w, m = list(map(int, input().split())) items = [set() for _ in range(h + 1)] count_h = [0] * (h + 1) count_w = [0] * (w + 1) for _ in range(m): y, x = list(map(int, input().split())) items[y].add(x) count_h[y] += 1 count...
#!/usr/bin/env python3 import collections import sys input = sys.stdin.readline h, w, m = list(map(int, input().split())) items = set() count_h = [0] * (h + 1) count_w = [0] * (w + 1) for _ in range(m): y, x = list(map(int, input().split())) items.add((y, x)) count_h[y] += 1 count_w[x] += 1 max_h = max...
false
0
[ "-items = [set() for _ in range(h + 1)]", "+items = set()", "- items[y].add(x)", "+ items.add((y, x))", "-count_num = collections.defaultdict(int)", "+max_h = max(count_h)", "+max_w = max(count_w)", "+cand_h = []", "+cand_w = []", "+for y in range(1, h + 1):", "+ if count_h[y] == max_h:...
false
0.038561
0.055377
0.696335
[ "s766251380", "s028358093" ]
u062147869
p03346
python
s130592162
s209061069
470
233
20,932
18,860
Accepted
Accepted
50.43
N = int(eval(input())) A = [int(eval(input())) for i in range(N)] Q =[0]*(N) for i in range(N): Q[A[i]-1] = i+1 num = 1 ans = 1 for i in range(N-1): if Q[i]<Q[i+1]: num += 1 else: num = 1 ans =max(ans,num) print((N-ans))
import sys input = sys.stdin.readline N=int(eval(input())) A=[int(eval(input()))-1 for i in range(N)] Q=[0]*N for i in range(N): Q[A[i]]= i #print(Q) num=0 s=1 t=Q[0] for i in range(1,N): if t>Q[i]: num=max(s,num) s=0 s+=1 t=Q[i] #print(s) num=max(s,num) print((N...
14
21
251
312
N = int(eval(input())) A = [int(eval(input())) for i in range(N)] Q = [0] * (N) for i in range(N): Q[A[i] - 1] = i + 1 num = 1 ans = 1 for i in range(N - 1): if Q[i] < Q[i + 1]: num += 1 else: num = 1 ans = max(ans, num) print((N - ans))
import sys input = sys.stdin.readline N = int(eval(input())) A = [int(eval(input())) - 1 for i in range(N)] Q = [0] * N for i in range(N): Q[A[i]] = i # print(Q) num = 0 s = 1 t = Q[0] for i in range(1, N): if t > Q[i]: num = max(s, num) s = 0 s += 1 t = Q[i] # print(s) num = max(s,...
false
33.333333
[ "+import sys", "+", "+input = sys.stdin.readline", "-A = [int(eval(input())) for i in range(N)]", "-Q = [0] * (N)", "+A = [int(eval(input())) - 1 for i in range(N)]", "+Q = [0] * N", "- Q[A[i] - 1] = i + 1", "-num = 1", "-ans = 1", "-for i in range(N - 1):", "- if Q[i] < Q[i + 1]:", "-...
false
0.037461
0.047188
0.793866
[ "s130592162", "s209061069" ]
u869919400
p02844
python
s007425582
s806746010
971
272
43,932
73,720
Accepted
Accepted
71.99
N = int(eval(input())) S = eval(input()) ans = 0 for i in range(1000): a, b, c = list(map(str, list(str(i).zfill(3)))) mode = 'a' for j in S: if mode == 'a' and j == a: mode = 'b' elif mode == 'b' and j == b: mode = 'c' elif mode == 'c' and j == c...
N = eval(input()) S = eval(input()) ans = 0 for i in range(1000): code = str(i).zfill(3) j = 0 for s in S: if s == code[j]: j += 1 if j == 3: ans += 1 break print(ans)
16
14
356
245
N = int(eval(input())) S = eval(input()) ans = 0 for i in range(1000): a, b, c = list(map(str, list(str(i).zfill(3)))) mode = "a" for j in S: if mode == "a" and j == a: mode = "b" elif mode == "b" and j == b: mode = "c" elif mode == "c" and j == c: ...
N = eval(input()) S = eval(input()) ans = 0 for i in range(1000): code = str(i).zfill(3) j = 0 for s in S: if s == code[j]: j += 1 if j == 3: ans += 1 break print(ans)
false
12.5
[ "-N = int(eval(input()))", "+N = eval(input())", "- a, b, c = list(map(str, list(str(i).zfill(3))))", "- mode = \"a\"", "- for j in S:", "- if mode == \"a\" and j == a:", "- mode = \"b\"", "- elif mode == \"b\" and j == b:", "- mode = \"c\"", "- ...
false
0.046212
0.038558
1.198518
[ "s007425582", "s806746010" ]
u912237403
p00020
python
s108316502
s392372072
20
10
4,192
4,192
Accepted
Accepted
50
s=input() print(s.upper())
print(input().upper())
2
1
30
25
s = input() print(s.upper())
print(input().upper())
false
50
[ "-s = input()", "-print(s.upper())", "+print(input().upper())" ]
false
0.037527
0.046222
0.811884
[ "s108316502", "s392372072" ]
u699089116
p03730
python
s433834630
s836204464
178
73
38,384
61,684
Accepted
Accepted
58.99
a, b, c = list(map(int, input().split())) for i in range(1, 101): if i * a % b == c: print("YES") exit() else: print("NO")
a, b, c = list(map(int, input().split())) for i in range(1, 100): if (a * i) % b == c: print("YES") exit() else: print("NO")
8
8
149
138
a, b, c = list(map(int, input().split())) for i in range(1, 101): if i * a % b == c: print("YES") exit() else: print("NO")
a, b, c = list(map(int, input().split())) for i in range(1, 100): if (a * i) % b == c: print("YES") exit() else: print("NO")
false
0
[ "-for i in range(1, 101):", "- if i * a % b == c:", "+for i in range(1, 100):", "+ if (a * i) % b == c:" ]
false
0.074202
0.033663
2.204234
[ "s433834630", "s836204464" ]
u332385682
p03835
python
s392984507
s816358214
280
19
40,812
3,060
Accepted
Accepted
93.21
K, S = list(map(int, input().split())) cnt = 0 for x in range(K + 1): for y in range(K + 1): z = S - (x + y) cnt += (0 <= z <= K) print(cnt)
K, S = list(map(int, input().split())) cnt = 0 for x in range(K + 1): S2 = S - x if S2 < 0: break elif S2 > 2*K: continue else: cnt += (S2 + 1) - 2*max(0, S2 - K) print(cnt)
9
13
164
221
K, S = list(map(int, input().split())) cnt = 0 for x in range(K + 1): for y in range(K + 1): z = S - (x + y) cnt += 0 <= z <= K print(cnt)
K, S = list(map(int, input().split())) cnt = 0 for x in range(K + 1): S2 = S - x if S2 < 0: break elif S2 > 2 * K: continue else: cnt += (S2 + 1) - 2 * max(0, S2 - K) print(cnt)
false
30.769231
[ "- for y in range(K + 1):", "- z = S - (x + y)", "- cnt += 0 <= z <= K", "+ S2 = S - x", "+ if S2 < 0:", "+ break", "+ elif S2 > 2 * K:", "+ continue", "+ else:", "+ cnt += (S2 + 1) - 2 * max(0, S2 - K)" ]
false
0.215825
0.035934
6.00606
[ "s392984507", "s816358214" ]
u943057856
p03160
python
s204817071
s717972830
1,748
142
22,840
13,800
Accepted
Accepted
91.88
import numpy as np n=int(eval(input())) h=np.array(list(map(int,input().split()))) dp=np.zeros(n,dtype="int32") dp[1]=np.abs(h[1]-h[0]) for i in range(2,n): dp[i]=np.min(dp[i-2:i]+np.abs(h[i]-h[i-2:i])) print((dp[-1]))
n=int(eval(input())) h=list(map(int,input().split())) dp=[0]*n def dis(a,b): return abs(h[a]-h[b]) dp[1]=dis(1,0) for i in range(2,n): dp[i]=min(dp[i-1]+dis(i,i-1),dp[i-2]+dis(i,i-2)) print((dp[-1]))
8
9
221
207
import numpy as np n = int(eval(input())) h = np.array(list(map(int, input().split()))) dp = np.zeros(n, dtype="int32") dp[1] = np.abs(h[1] - h[0]) for i in range(2, n): dp[i] = np.min(dp[i - 2 : i] + np.abs(h[i] - h[i - 2 : i])) print((dp[-1]))
n = int(eval(input())) h = list(map(int, input().split())) dp = [0] * n def dis(a, b): return abs(h[a] - h[b]) dp[1] = dis(1, 0) for i in range(2, n): dp[i] = min(dp[i - 1] + dis(i, i - 1), dp[i - 2] + dis(i, i - 2)) print((dp[-1]))
false
11.111111
[ "-import numpy as np", "+n = int(eval(input()))", "+h = list(map(int, input().split()))", "+dp = [0] * n", "-n = int(eval(input()))", "-h = np.array(list(map(int, input().split())))", "-dp = np.zeros(n, dtype=\"int32\")", "-dp[1] = np.abs(h[1] - h[0])", "+", "+def dis(a, b):", "+ return abs(h...
false
0.662994
0.037357
17.747477
[ "s204817071", "s717972830" ]
u046187684
p03447
python
s054717151
s406027686
20
17
3,316
2,940
Accepted
Accepted
15
#!/usr/bin/env python3 # coding=utf-8 import sys x = int(sys.stdin.readline().strip()) a = int(sys.stdin.readline().strip()) b = int(sys.stdin.readline().strip()) print(((x - a) % b))
def solve(string): x, a, b = list(map(int, string.split())) return str((x - a) % b) if __name__ == '__main__': n = 3 print((solve('\n'.join([eval(input()) for _ in range(n)]))))
10
8
194
189
#!/usr/bin/env python3 # coding=utf-8 import sys x = int(sys.stdin.readline().strip()) a = int(sys.stdin.readline().strip()) b = int(sys.stdin.readline().strip()) print(((x - a) % b))
def solve(string): x, a, b = list(map(int, string.split())) return str((x - a) % b) if __name__ == "__main__": n = 3 print((solve("\n".join([eval(input()) for _ in range(n)]))))
false
20
[ "-#!/usr/bin/env python3", "-# coding=utf-8", "-import sys", "+def solve(string):", "+ x, a, b = list(map(int, string.split()))", "+ return str((x - a) % b)", "-x = int(sys.stdin.readline().strip())", "-a = int(sys.stdin.readline().strip())", "-b = int(sys.stdin.readline().strip())", "-print...
false
0.049179
0.049522
0.993056
[ "s054717151", "s406027686" ]