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
u707808519
p02640
python
s880747911
s617618030
25
20
9,168
9,160
Accepted
Accepted
20
x, y = list(map(int, input().split())) ans = 'No' for a in range(x+1): if 2*a + 4*(x-a) == y: ans = 'Yes' break print(ans)
x, y = list(map(int, input().split())) ans = 'No' for a in range(x+1): if 4*x-y == 2*a: ans = 'Yes' break print(ans)
7
7
142
137
x, y = list(map(int, input().split())) ans = "No" for a in range(x + 1): if 2 * a + 4 * (x - a) == y: ans = "Yes" break print(ans)
x, y = list(map(int, input().split())) ans = "No" for a in range(x + 1): if 4 * x - y == 2 * a: ans = "Yes" break print(ans)
false
0
[ "- if 2 * a + 4 * (x - a) == y:", "+ if 4 * x - y == 2 * a:" ]
false
0.044402
0.044201
1.00455
[ "s880747911", "s617618030" ]
u327466606
p03161
python
s387530364
s739119677
1,897
550
23,044
59,232
Accepted
Accepted
71.01
import numpy as np N,K = list(map(int,input().split())) H = np.array(list(map(int,input().split()))) dp = np.zeros(N, dtype=int) for i in range(1,N): s = max(i-K,0) dp[i] = np.min(dp[s:i]+np.abs(H[s:i]-H[i])) print((dp[-1]))
N,K = list(map(int,input().split())) H = list(map(int,input().split())) dp = [0] for i in range(1,N): h = H[i] dp.append(min(dp[-j-1]+abs(h-H[i-j-1]) for j in range(min(i,K)))) print((dp[-1]))
11
10
234
200
import numpy as np N, K = list(map(int, input().split())) H = np.array(list(map(int, input().split()))) dp = np.zeros(N, dtype=int) for i in range(1, N): s = max(i - K, 0) dp[i] = np.min(dp[s:i] + np.abs(H[s:i] - H[i])) print((dp[-1]))
N, K = list(map(int, input().split())) H = list(map(int, input().split())) dp = [0] for i in range(1, N): h = H[i] dp.append(min(dp[-j - 1] + abs(h - H[i - j - 1]) for j in range(min(i, K)))) print((dp[-1]))
false
9.090909
[ "-import numpy as np", "-", "-H = np.array(list(map(int, input().split())))", "-dp = np.zeros(N, dtype=int)", "+H = list(map(int, input().split()))", "+dp = [0]", "- s = max(i - K, 0)", "- dp[i] = np.min(dp[s:i] + np.abs(H[s:i] - H[i]))", "+ h = H[i]", "+ dp.append(min(dp[-j - 1] + abs...
false
0.242077
0.04394
5.509307
[ "s387530364", "s739119677" ]
u170201762
p03660
python
s097214340
s607024422
1,329
1,040
125,784
105,324
Accepted
Accepted
21.75
from collections import defaultdict from heapq import heappop, heappush from math import ceil class Graph(object): def __init__(self): self.graph = defaultdict(list) def __len__(self): return len(self.graph) def add_edge(self, From, To, cost=1): self.graph[From].appe...
from heapq import heappush, heappop def dijkstra(graph:list, node:int, start:int) -> list: # graph[node] = [(cost, to)] inf = float('inf') dist = [inf]*node dist[start] = 0 heap = [(0,start)] while heap: cost,thisNode = heappop(heap) for NextCost,NextNode in graph[this...
76
36
1,913
880
from collections import defaultdict from heapq import heappop, heappush from math import ceil class Graph(object): def __init__(self): self.graph = defaultdict(list) def __len__(self): return len(self.graph) def add_edge(self, From, To, cost=1): self.graph[From].append((To, cost)...
from heapq import heappush, heappop def dijkstra(graph: list, node: int, start: int) -> list: # graph[node] = [(cost, to)] inf = float("inf") dist = [inf] * node dist[start] = 0 heap = [(0, start)] while heap: cost, thisNode = heappop(heap) for NextCost, NextNode in graph[thisN...
false
52.631579
[ "-from collections import defaultdict", "-from heapq import heappop, heappush", "-from math import ceil", "+from heapq import heappush, heappop", "-class Graph(object):", "- def __init__(self):", "- self.graph = defaultdict(list)", "-", "- def __len__(self):", "- return len(sel...
false
0.007303
0.040993
0.178151
[ "s097214340", "s607024422" ]
u508732591
p02412
python
s701277099
s373266057
30
20
7,740
7,648
Accepted
Accepted
33.33
while True: n,x = list(map(int,input().split())) if n==x==0: break print((sum( [ len(list(range(max(i+1,x-i-n),min(n,(x-i+1)//2)))) for i in range(1,min(n-1,x//3)) ])))
while True: n,x = list(map(int,input().split())) if n==0 and x==0: break print((sum( [ max(min(n,(x-i+1)//2) - max(i+1,x-i-n),0) for i in range(1,min(n-1,x//3)) ])))
6
7
173
185
while True: n, x = list(map(int, input().split())) if n == x == 0: break print( ( sum( [ len(list(range(max(i + 1, x - i - n), min(n, (x - i + 1) // 2)))) for i in range(1, min(n - 1, x // 3)) ] )...
while True: n, x = list(map(int, input().split())) if n == 0 and x == 0: break print( ( sum( [ max(min(n, (x - i + 1) // 2) - max(i + 1, x - i - n), 0) for i in range(1, min(n - 1, x // 3)) ] ) ...
false
14.285714
[ "- if n == x == 0:", "+ if n == 0 and x == 0:", "- len(list(range(max(i + 1, x - i - n), min(n, (x - i + 1) // 2))))", "+ max(min(n, (x - i + 1) // 2) - max(i + 1, x - i - n), 0)" ]
false
0.131709
0.051474
2.558741
[ "s701277099", "s373266057" ]
u794173881
p03525
python
s388953038
s833359559
238
193
44,784
41,456
Accepted
Accepted
18.91
n = int(eval(input())) s = list(map(int, input().split())) cnt_memo = {} for num in s: if num in cnt_memo: cnt_memo[num] += 1 else: cnt_memo[num] = 1 kakutei = [0] mikakutei = [] for i in cnt_memo: if i == 0: print((0)) exit() elif i == 12: if c...
n = int(eval(input())) d = list(map(int, input().split())) memo = {0: 1} for i in range(n): if d[i] not in memo: memo[d[i]] = 1 else: memo[d[i]] += 1 used = [] * n li = [] for i in memo: if memo[i] >= 3: print((0)) exit() elif memo[i] == 2: used...
64
37
1,577
810
n = int(eval(input())) s = list(map(int, input().split())) cnt_memo = {} for num in s: if num in cnt_memo: cnt_memo[num] += 1 else: cnt_memo[num] = 1 kakutei = [0] mikakutei = [] for i in cnt_memo: if i == 0: print((0)) exit() elif i == 12: if cnt_memo[i] == 1: ...
n = int(eval(input())) d = list(map(int, input().split())) memo = {0: 1} for i in range(n): if d[i] not in memo: memo[d[i]] = 1 else: memo[d[i]] += 1 used = [] * n li = [] for i in memo: if memo[i] >= 3: print((0)) exit() elif memo[i] == 2: used.append(i) ...
false
42.1875
[ "-s = list(map(int, input().split()))", "-cnt_memo = {}", "-for num in s:", "- if num in cnt_memo:", "- cnt_memo[num] += 1", "+d = list(map(int, input().split()))", "+memo = {0: 1}", "+for i in range(n):", "+ if d[i] not in memo:", "+ memo[d[i]] = 1", "- cnt_memo[num] ...
false
0.083966
0.078744
1.066327
[ "s388953038", "s833359559" ]
u863370423
p02687
python
s438225897
s736516130
55
25
64,244
8,932
Accepted
Accepted
54.55
s = input() if s == "ARC": print("ABC") else: print("ARC")
s = list(eval(input())) s[1] = (s[1] == 'B') and 'R' or 'B' a = ''.join(s) print(a)
5
6
66
85
s = input() if s == "ARC": print("ABC") else: print("ARC")
s = list(eval(input())) s[1] = (s[1] == "B") and "R" or "B" a = "".join(s) print(a)
false
16.666667
[ "-s = input()", "-if s == \"ARC\":", "- print(\"ABC\")", "-else:", "- print(\"ARC\")", "+s = list(eval(input()))", "+s[1] = (s[1] == \"B\") and \"R\" or \"B\"", "+a = \"\".join(s)", "+print(a)" ]
false
0.041934
0.168481
0.248896
[ "s438225897", "s736516130" ]
u370086573
p02261
python
s205052741
s775073974
170
120
7,824
7,848
Accepted
Accepted
29.41
def bubble_sort(r, n): flag = True # ??£??\????´?????????¨????????° while flag: flag = False for i in range(n - 1, 0, -1): if r[i - 1][1] > r[i][1]: r[i - 1], r[i] = r[i], r[i - 1] flag = True return r def select_sort(r, n): for ...
def selectionSort(n, A): cnt = 0 for i in range(n): minj = i for j in range(i, n): if A[minj][1] > A[j][1]: minj = j if i != minj: A[i], A[minj] = A[minj], A[i] cnt += 1 return A def bubbleSort(n, A): flag = True...
42
48
1,081
1,219
def bubble_sort(r, n): flag = True # ??£??\????´?????????¨????????° while flag: flag = False for i in range(n - 1, 0, -1): if r[i - 1][1] > r[i][1]: r[i - 1], r[i] = r[i], r[i - 1] flag = True return r def select_sort(r, n): for i in range(0...
def selectionSort(n, A): cnt = 0 for i in range(n): minj = i for j in range(i, n): if A[minj][1] > A[j][1]: minj = j if i != minj: A[i], A[minj] = A[minj], A[i] cnt += 1 return A def bubbleSort(n, A): flag = True cnt = 0 ...
false
12.5
[ "-def bubble_sort(r, n):", "- flag = True # ??£??\\????´?????????¨????????°", "+def selectionSort(n, A):", "+ cnt = 0", "+ for i in range(n):", "+ minj = i", "+ for j in range(i, n):", "+ if A[minj][1] > A[j][1]:", "+ minj = j", "+ if i != m...
false
0.077823
0.042996
1.809996
[ "s205052741", "s775073974" ]
u320567105
p03109
python
s613585146
s760080627
19
17
3,060
2,940
Accepted
Accepted
10.53
s = eval(input()) m = s[5:7] if m=='01'or m=='02' or m=='03' or m=='04': print('Heisei') else: print('TBD')
ri = lambda: int(eval(input())) rl = lambda: list(map(int,input().split())) s=eval(input()) if s[5:7]<='04': print('Heisei') else: print('TBD')
8
8
118
147
s = eval(input()) m = s[5:7] if m == "01" or m == "02" or m == "03" or m == "04": print("Heisei") else: print("TBD")
ri = lambda: int(eval(input())) rl = lambda: list(map(int, input().split())) s = eval(input()) if s[5:7] <= "04": print("Heisei") else: print("TBD")
false
0
[ "+ri = lambda: int(eval(input()))", "+rl = lambda: list(map(int, input().split()))", "-m = s[5:7]", "-if m == \"01\" or m == \"02\" or m == \"03\" or m == \"04\":", "+if s[5:7] <= \"04\":" ]
false
0.075985
0.075852
1.00175
[ "s613585146", "s760080627" ]
u312025627
p03295
python
s605506962
s368170022
718
386
62,040
59,484
Accepted
Accepted
46.24
def main(): N, M = (int(i) for i in input().split()) ab = [tuple(int(i) for i in input().split()) for _ in range(M)] ab.sort(key=lambda p: p[1]) pre_b = 1 ans = 0 for a, b in ab: if pre_b <= a: ans += 1 pre_b = b print(ans) if __name__ == '__m...
def main(): import sys input = sys.stdin.buffer.readline N, M = (int(i) for i in input().split()) AB = [[int(i) for i in input().split()] for j in range(M)] AB.sort(key=lambda p: p[1]) mx_b = AB[0][1] ans = 1 for a, b in AB[1:]: if a < mx_b: continue ...
16
19
340
432
def main(): N, M = (int(i) for i in input().split()) ab = [tuple(int(i) for i in input().split()) for _ in range(M)] ab.sort(key=lambda p: p[1]) pre_b = 1 ans = 0 for a, b in ab: if pre_b <= a: ans += 1 pre_b = b print(ans) if __name__ == "__main__": mai...
def main(): import sys input = sys.stdin.buffer.readline N, M = (int(i) for i in input().split()) AB = [[int(i) for i in input().split()] for j in range(M)] AB.sort(key=lambda p: p[1]) mx_b = AB[0][1] ans = 1 for a, b in AB[1:]: if a < mx_b: continue else: ...
false
15.789474
[ "+ import sys", "+", "+ input = sys.stdin.buffer.readline", "- ab = [tuple(int(i) for i in input().split()) for _ in range(M)]", "- ab.sort(key=lambda p: p[1])", "- pre_b = 1", "- ans = 0", "- for a, b in ab:", "- if pre_b <= a:", "+ AB = [[int(i) for i in input().sp...
false
0.082849
0.083973
0.986616
[ "s605506962", "s368170022" ]
u864197622
p03074
python
s388038937
s373521044
81
51
7,160
9,356
Accepted
Accepted
37.04
N, K = list(map(int, input().split())) s = eval(input()) X = [0] if s[0] == "0": X.append(0) for i in range(N): if i == N-1 or s[i] != s[i+1]: X.append(i+1) if s[-1] == "0": X.append(X[-1]) if len(X) <= K*2+1: print(N) else: ma = 0 for i in range(0, len(X) - K*2 - 1, 2)...
N, K = list(map(int, input().split())) s = eval(input()) L = 2 * K + 1 X = [0]*(2-int(s[0])) + [i+1 for i in range(N-1) if s[i]!=s[i+1]] + [N] * L print((max([X[i+L]-X[i] for i in range(0, len(X)-L, 2)])))
19
5
363
195
N, K = list(map(int, input().split())) s = eval(input()) X = [0] if s[0] == "0": X.append(0) for i in range(N): if i == N - 1 or s[i] != s[i + 1]: X.append(i + 1) if s[-1] == "0": X.append(X[-1]) if len(X) <= K * 2 + 1: print(N) else: ma = 0 for i in range(0, len(X) - K * 2 - 1, 2): ...
N, K = list(map(int, input().split())) s = eval(input()) L = 2 * K + 1 X = [0] * (2 - int(s[0])) + [i + 1 for i in range(N - 1) if s[i] != s[i + 1]] + [N] * L print((max([X[i + L] - X[i] for i in range(0, len(X) - L, 2)])))
false
73.684211
[ "-X = [0]", "-if s[0] == \"0\":", "- X.append(0)", "-for i in range(N):", "- if i == N - 1 or s[i] != s[i + 1]:", "- X.append(i + 1)", "-if s[-1] == \"0\":", "- X.append(X[-1])", "-if len(X) <= K * 2 + 1:", "- print(N)", "-else:", "- ma = 0", "- for i in range(0, len...
false
0.064585
0.041302
1.563697
[ "s388038937", "s373521044" ]
u634079249
p03325
python
s008422869
s430905822
68
54
11,008
11,004
Accepted
Accepted
20.59
import sys, os, math, bisect, itertools, collections, heapq, queue # from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall from decimal import Decimal from collections import defaultdict, deque # import fractions sys.setrecursionlimit(10000000) ii = lambda: int(sys.stdin.buffer.readline().rstr...
import sys, os, math, bisect, itertools, collections, heapq, queue # from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall from decimal import Decimal from collections import defaultdict, deque sys.setrecursionlimit(10000000) ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: li...
41
40
1,194
1,110
import sys, os, math, bisect, itertools, collections, heapq, queue # from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall from decimal import Decimal from collections import defaultdict, deque # import fractions sys.setrecursionlimit(10000000) ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il =...
import sys, os, math, bisect, itertools, collections, heapq, queue # from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall from decimal import Decimal from collections import defaultdict, deque sys.setrecursionlimit(10000000) ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: list(map(i...
false
2.439024
[ "-# import fractions", "-# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)", "- for n in range(N):", "- while A[n] % 2 == 0:", "- A[n] //= 2", "+ for a in A:", "+ while a % 2 == 0:", "+ a //= 2" ]
false
0.045688
0.044829
1.019144
[ "s008422869", "s430905822" ]
u426534722
p02363
python
s172305138
s921124709
990
530
8,176
8,120
Accepted
Accepted
46.46
from sys import stdin from math import isinf n, e = list(map(int, stdin.readline().split())) d = [[float('inf')] * n for _ in range(n)] for i in range(n): d[i][i] = 0 for i in range(e): u, v, c = list(map(int, stdin.readline().split())) d[u][v] = c for k in range(n): for i in range(n): ...
from sys import stdin from math import isinf n, e = list(map(int, stdin.readline().split())) d = [[float('inf')] * n for _ in range(n)] for i in range(n): d[i][i] = 0 for i in range(e): u, v, c = list(map(int, stdin.readline().split())) d[u][v] = c for k in range(n): for i in range(n): ...
22
20
691
595
from sys import stdin from math import isinf n, e = list(map(int, stdin.readline().split())) d = [[float("inf")] * n for _ in range(n)] for i in range(n): d[i][i] = 0 for i in range(e): u, v, c = list(map(int, stdin.readline().split())) d[u][v] = c for k in range(n): for i in range(n): if d[i][...
from sys import stdin from math import isinf n, e = list(map(int, stdin.readline().split())) d = [[float("inf")] * n for _ in range(n)] for i in range(n): d[i][i] = 0 for i in range(e): u, v, c = list(map(int, stdin.readline().split())) d[u][v] = c for k in range(n): for i in range(n): for j in...
false
9.090909
[ "- if d[i][k] == float(\"inf\"):", "- continue", "- if d[k][j] == float(\"inf\"):", "- continue" ]
false
0.103445
0.09376
1.103293
[ "s172305138", "s921124709" ]
u644907318
p02813
python
s375109336
s931773018
202
80
40,300
73,360
Accepted
Accepted
60.4
from itertools import permutations N = int(eval(input())) P = list(map(int,input().split())) Q = list(map(int,input().split())) A = sorted(P) cnt = 0 for x in permutations(A,N): x = list(x) if x==P: a = cnt if x==Q: b = cnt cnt += 1 print((abs(a-b)))
from itertools import permutations N = int(eval(input())) P = tuple(list(map(int,input().split()))) Q = tuple(list(map(int,input().split()))) cnt = 0 for x in permutations(list(range(1,N+1)),N): if P==x: indP = cnt if Q==x: indQ = cnt cnt += 1 print((abs(indP-indQ)))
14
12
287
292
from itertools import permutations N = int(eval(input())) P = list(map(int, input().split())) Q = list(map(int, input().split())) A = sorted(P) cnt = 0 for x in permutations(A, N): x = list(x) if x == P: a = cnt if x == Q: b = cnt cnt += 1 print((abs(a - b)))
from itertools import permutations N = int(eval(input())) P = tuple(list(map(int, input().split()))) Q = tuple(list(map(int, input().split()))) cnt = 0 for x in permutations(list(range(1, N + 1)), N): if P == x: indP = cnt if Q == x: indQ = cnt cnt += 1 print((abs(indP - indQ)))
false
14.285714
[ "-P = list(map(int, input().split()))", "-Q = list(map(int, input().split()))", "-A = sorted(P)", "+P = tuple(list(map(int, input().split())))", "+Q = tuple(list(map(int, input().split())))", "-for x in permutations(A, N):", "- x = list(x)", "- if x == P:", "- a = cnt", "- if x == ...
false
0.040777
0.036881
1.105657
[ "s375109336", "s931773018" ]
u018679195
p03680
python
s631748766
s044381952
531
197
55,896
7,084
Accepted
Accepted
62.9
n = int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) visited = set() count = 0 next = 1 while True: count += 1 visited.add(next) next = a[next-1] if next == 2: print(count) exit(0) if next in visited: print((-1)) exit(0)
n = int(eval(input())) a = [int(eval(input())) for i in range(n)] b = a[0] cnt = 1 while b != 2 and cnt <= n: b = a[b-1] cnt += 1 if b == 2: print(cnt) else: print((-1))
18
13
277
186
n = int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) visited = set() count = 0 next = 1 while True: count += 1 visited.add(next) next = a[next - 1] if next == 2: print(count) exit(0) if next in visited: print((-1)) exit(0)
n = int(eval(input())) a = [int(eval(input())) for i in range(n)] b = a[0] cnt = 1 while b != 2 and cnt <= n: b = a[b - 1] cnt += 1 if b == 2: print(cnt) else: print((-1))
false
27.777778
[ "-a = []", "-for i in range(n):", "- a.append(int(eval(input())))", "-visited = set()", "-count = 0", "-next = 1", "-while True:", "- count += 1", "- visited.add(next)", "- next = a[next - 1]", "- if next == 2:", "- print(count)", "- exit(0)", "- if next in ...
false
0.036598
0.036089
1.014101
[ "s631748766", "s044381952" ]
u788703383
p02702
python
s407256227
s748776167
344
296
9,364
9,240
Accepted
Accepted
13.95
s = eval(input()) MOD = 2019 r = [0]*MOD r[0] = 1 z = 0 t = 0 for i in reversed(s): z = int(i) * pow(10,t,MOD) + z z %= MOD r[z] += 1 t += 1 print((sum(i*(i-1)//2 for i in r)))
def main(): s = eval(input()) MOD = 2019 r = [0]*MOD r[0] = 1 z = 0 t = 0 for i in reversed(s): z = int(i) * pow(10,t,MOD) + z z %= MOD r[z] += 1 t += 1 print((sum(i*(i-1)//2 for i in r))) if __name__ == '__main__': main()
12
17
196
301
s = eval(input()) MOD = 2019 r = [0] * MOD r[0] = 1 z = 0 t = 0 for i in reversed(s): z = int(i) * pow(10, t, MOD) + z z %= MOD r[z] += 1 t += 1 print((sum(i * (i - 1) // 2 for i in r)))
def main(): s = eval(input()) MOD = 2019 r = [0] * MOD r[0] = 1 z = 0 t = 0 for i in reversed(s): z = int(i) * pow(10, t, MOD) + z z %= MOD r[z] += 1 t += 1 print((sum(i * (i - 1) // 2 for i in r))) if __name__ == "__main__": main()
false
29.411765
[ "-s = eval(input())", "-MOD = 2019", "-r = [0] * MOD", "-r[0] = 1", "-z = 0", "-t = 0", "-for i in reversed(s):", "- z = int(i) * pow(10, t, MOD) + z", "- z %= MOD", "- r[z] += 1", "- t += 1", "-print((sum(i * (i - 1) // 2 for i in r)))", "+def main():", "+ s = eval(input())...
false
0.037109
0.043092
0.861155
[ "s407256227", "s748776167" ]
u671861352
p03006
python
s481721658
s161224697
168
18
3,444
3,188
Accepted
Accepted
89.29
N = int(eval(input())) if N == 1: print((1)) exit() xy = [tuple(int(e) for e in input().split()) for _ in range(N)] d_list = [(i[0] - j[0], i[1] - j[1]) for i in xy for j in xy if i != j] items = list(set(d_list)) s = 1 for item in items: c = d_list.count(item) if c > s: s = c print(...
N = int(eval(input())) if N == 1: print((1)) else: xy = [tuple(int(e) for e in input().split()) for _ in range(N)] xy.sort() d = {} for i in range(N): for j in range(i + 1, N): p = xy[i][0] - xy[j][0] q = xy[i][1] - xy[j][1] if (p, q) in d: ...
13
16
318
421
N = int(eval(input())) if N == 1: print((1)) exit() xy = [tuple(int(e) for e in input().split()) for _ in range(N)] d_list = [(i[0] - j[0], i[1] - j[1]) for i in xy for j in xy if i != j] items = list(set(d_list)) s = 1 for item in items: c = d_list.count(item) if c > s: s = c print((N - s))
N = int(eval(input())) if N == 1: print((1)) else: xy = [tuple(int(e) for e in input().split()) for _ in range(N)] xy.sort() d = {} for i in range(N): for j in range(i + 1, N): p = xy[i][0] - xy[j][0] q = xy[i][1] - xy[j][1] if (p, q) in d: ...
false
18.75
[ "- exit()", "-xy = [tuple(int(e) for e in input().split()) for _ in range(N)]", "-d_list = [(i[0] - j[0], i[1] - j[1]) for i in xy for j in xy if i != j]", "-items = list(set(d_list))", "-s = 1", "-for item in items:", "- c = d_list.count(item)", "- if c > s:", "- s = c", "-print((...
false
0.047186
0.04432
1.064656
[ "s481721658", "s161224697" ]
u352394527
p00481
python
s183268209
s101905654
19,860
3,420
29,300
29,296
Accepted
Accepted
82.78
import queue from collections import deque h,w,n = list(map(int,input().split())) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + eval(input()) + "X" if "S" in s: factrys[0] = (i + 1, s.index("S")) for j in range(1,n + 1): if str(j) in s: factrys[j] = (i + 1, ...
import queue from collections import deque h,w,n = list(map(int,input().split())) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + eval(input()) + "X" if "S" in s: factrys[0] = (i + 1, s.index("S")) for j in range(1,n + 1): if str(j) in s: factrys[j] = (i + 1, ...
49
49
1,237
1,250
import queue from collections import deque h, w, n = list(map(int, input().split())) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + eval(input()) + "X" if "S" in s: factrys[0] = (i + 1, s.index("S")) for j in range(1, n + 1): if str(j) in s: factrys...
import queue from collections import deque h, w, n = list(map(int, input().split())) factrys = [None] * (n + 1) ss = ["X" * (w + 2)] for i in range(h): s = "X" + eval(input()) + "X" if "S" in s: factrys[0] = (i + 1, s.index("S")) for j in range(1, n + 1): if str(j) in s: factrys...
false
0
[ "- que = queue.Queue()", "- que.put((x, y))", "+ que = deque()", "+ que.append((x, y))", "- (x, y) = que.get()", "+ (x, y) = que.popleft()", "- que.put((x + 1, y))", "+ que.append((x + 1, y))", "- que.put((x - 1, y))", "+ que.ap...
false
0.16615
0.039554
4.200593
[ "s183268209", "s101905654" ]
u197868423
p02660
python
s535850048
s369587320
383
139
9,480
9,448
Accepted
Accepted
63.71
from collections import Counter N = int(eval(input())) a = [] x = 2 while x ** 2 <= N: if N % x == 0: a.append(x) N /= x x = 2 else: x += 1 else: if x <= N: a.append(int(N)) a = Counter(a) ans = 0 for i in a: k = 1 while True: if a...
n = int(eval(input())) arr = [] for i in range(2, int(-(-n**0.5//1))+1): if n%i==0: cnt=0 while n%i==0: cnt+=1 n //= i arr.append([i, cnt]) if n!=1: arr.append([n, 1]) # if arr==[]: # arr.append([n, 1]) ans = 0 for i in range(len(arr)): ...
28
29
436
486
from collections import Counter N = int(eval(input())) a = [] x = 2 while x**2 <= N: if N % x == 0: a.append(x) N /= x x = 2 else: x += 1 else: if x <= N: a.append(int(N)) a = Counter(a) ans = 0 for i in a: k = 1 while True: if a[i] >= k: ...
n = int(eval(input())) arr = [] for i in range(2, int(-(-(n**0.5) // 1)) + 1): if n % i == 0: cnt = 0 while n % i == 0: cnt += 1 n //= i arr.append([i, cnt]) if n != 1: arr.append([n, 1]) # if arr==[]: # arr.append([n, 1]) ans = 0 for i in range(len(arr)): ...
false
3.448276
[ "-from collections import Counter", "-", "-N = int(eval(input()))", "-a = []", "-x = 2", "-while x**2 <= N:", "- if N % x == 0:", "- a.append(x)", "- N /= x", "- x = 2", "- else:", "- x += 1", "-else:", "- if x <= N:", "- a.append(int(N))", "...
false
0.041999
0.051373
0.817544
[ "s535850048", "s369587320" ]
u311379832
p03281
python
s360167642
s124206035
19
17
3,060
3,060
Accepted
Accepted
10.53
N = int(eval(input())) ansCnt = 0 for i in range(1, N + 1, 2): tmpCnt = 0 for j in range(1, N + 1): if i < j: break if i % j == 0: tmpCnt += 1 if tmpCnt == 8: ansCnt += 1 print(ansCnt)
N = int(eval(input())) ans = 0 for i in range(1, N + 1): cnt = 0 if i % 2 != 0: for j in range(1, int(pow(i, 0.5)) + 1): if i % j == 0: cnt += 1 if j != i // j: cnt += 1 if cnt == 8: ans += 1 print(ans)
13
14
251
310
N = int(eval(input())) ansCnt = 0 for i in range(1, N + 1, 2): tmpCnt = 0 for j in range(1, N + 1): if i < j: break if i % j == 0: tmpCnt += 1 if tmpCnt == 8: ansCnt += 1 print(ansCnt)
N = int(eval(input())) ans = 0 for i in range(1, N + 1): cnt = 0 if i % 2 != 0: for j in range(1, int(pow(i, 0.5)) + 1): if i % j == 0: cnt += 1 if j != i // j: cnt += 1 if cnt == 8: ans += 1 print(ans)
false
7.142857
[ "-ansCnt = 0", "-for i in range(1, N + 1, 2):", "- tmpCnt = 0", "- for j in range(1, N + 1):", "- if i < j:", "- break", "- if i % j == 0:", "- tmpCnt += 1", "- if tmpCnt == 8:", "- ansCnt += 1", "-print(ansCnt)", "+ans = 0", "+for i in ran...
false
0.078122
0.074712
1.045636
[ "s360167642", "s124206035" ]
u146685294
p02899
python
s356224058
s870944412
264
242
23,480
20,040
Accepted
Accepted
8.33
import heapq n = int(eval(input())) list = [] idx = 1 for count_str in input().split(): count = int(count_str) heapq.heappush(list, (count, idx)) idx += 1 print((" ".join([ str(heapq.heappop(list)[1]) for _ in range(n) ])))
import heapq n = int(eval(input())) priority_list = [] student = 0 for priority in list(map(int, input().split())): student += 1 priority_list.append((priority, str(student))) heapq.heapify(priority_list) print((' '.join([ heapq.heappop(priority_list)[1] for _ in range(n) ])))
13
13
248
293
import heapq n = int(eval(input())) list = [] idx = 1 for count_str in input().split(): count = int(count_str) heapq.heappush(list, (count, idx)) idx += 1 print((" ".join([str(heapq.heappop(list)[1]) for _ in range(n)])))
import heapq n = int(eval(input())) priority_list = [] student = 0 for priority in list(map(int, input().split())): student += 1 priority_list.append((priority, str(student))) heapq.heapify(priority_list) print((" ".join([heapq.heappop(priority_list)[1] for _ in range(n)])))
false
0
[ "-list = []", "-idx = 1", "-for count_str in input().split():", "- count = int(count_str)", "- heapq.heappush(list, (count, idx))", "- idx += 1", "-print((\" \".join([str(heapq.heappop(list)[1]) for _ in range(n)])))", "+priority_list = []", "+student = 0", "+for priority in list(map(int,...
false
0.049131
0.048403
1.015031
[ "s356224058", "s870944412" ]
u133936772
p02614
python
s998010247
s382371814
70
60
9,100
9,188
Accepted
Accepted
14.29
h,w,x=list(map(int,input().split())) c=[eval(input()) for _ in range(h)] a=0 for i in range(2**h): for j in range(2**w): t=0 for k in range(h): for l in range(w): if i>>k&1 and j>>l&1 and c[k][l]=='#': t+=1 if t==x: a+=1 print(a)
h,w,x=list(map(int,input().split())) c=[eval(input()) for _ in [0]*h] print((sum(x==sum(i>>k&1 and j>>l&1 and c[k][l]=='#' for k in range(h) for l in range(w)) for i in range(2**h) for j in range(2**w)) ))
11
4
255
194
h, w, x = list(map(int, input().split())) c = [eval(input()) for _ in range(h)] a = 0 for i in range(2**h): for j in range(2**w): t = 0 for k in range(h): for l in range(w): if i >> k & 1 and j >> l & 1 and c[k][l] == "#": t += 1 if t == x: ...
h, w, x = list(map(int, input().split())) c = [eval(input()) for _ in [0] * h] print( ( sum( x == sum( i >> k & 1 and j >> l & 1 and c[k][l] == "#" for k in range(h) for l in range(w) ) for i in range(2**h) ...
false
63.636364
[ "-c = [eval(input()) for _ in range(h)]", "-a = 0", "-for i in range(2**h):", "- for j in range(2**w):", "- t = 0", "- for k in range(h):", "- for l in range(w):", "- if i >> k & 1 and j >> l & 1 and c[k][l] == \"#\":", "- t += 1", "- ...
false
0.125615
0.047787
2.628634
[ "s998010247", "s382371814" ]
u416758623
p03036
python
s345935393
s344701361
19
17
2,940
2,940
Accepted
Accepted
10.53
r,d,x = list(map(int, input().split())) for i in range(10): x = r * x - d print(x)
r, d , x = list(map(int, input().split())) for i in range(10): x = (r * x) - d print(x)
5
4
89
92
r, d, x = list(map(int, input().split())) for i in range(10): x = r * x - d print(x)
r, d, x = list(map(int, input().split())) for i in range(10): x = (r * x) - d print(x)
false
20
[ "- x = r * x - d", "+ x = (r * x) - d" ]
false
0.041333
0.043345
0.953589
[ "s345935393", "s344701361" ]
u046187684
p03112
python
s414708188
s613677789
814
737
39,508
39,524
Accepted
Accepted
9.46
from bisect import bisect_left def solve(string): a, b, q, *stx = list(map(int, string.split())) s = [-10**10] + stx[:a] + [2 * 10**10] t = [-10**10] + stx[a:a + b] + [2 * 10**10] # x = dict([]) ans = [] i_s = 0 i_t = 0 for _x in stx[-q:]: """ while s[i_s] ...
from bisect import bisect_left def solve(string): a, b, q, *stx = list(map(int, string.split())) s = [-10**10] + stx[:a] + [2 * 10**10] t = [-10**10] + stx[a:a + b] + [2 * 10**10] # x = dict([]) ans = [] i_s = 0 i_t = 0 for _x in stx[-q:]: """ while s[i_s] ...
37
40
1,138
1,213
from bisect import bisect_left def solve(string): a, b, q, *stx = list(map(int, string.split())) s = [-(10**10)] + stx[:a] + [2 * 10**10] t = [-(10**10)] + stx[a : a + b] + [2 * 10**10] # x = dict([]) ans = [] i_s = 0 i_t = 0 for _x in stx[-q:]: """ while s[i_s] < _x: ...
from bisect import bisect_left def solve(string): a, b, q, *stx = list(map(int, string.split())) s = [-(10**10)] + stx[:a] + [2 * 10**10] t = [-(10**10)] + stx[a : a + b] + [2 * 10**10] # x = dict([]) ans = [] i_s = 0 i_t = 0 for _x in stx[-q:]: """ while s[i_s] < _x: ...
false
7.5
[ "- str(min([r_max, l_max, rt + ls + min(rt, ls), rs + lt + min(rs, lt)]))", "+ str(", "+ min(", "+ r_max,", "+ l_max,", "+ rt + ls + (rt if rt < ls else ls),", "+ rs + lt + (rs if rs < lt els...
false
0.048959
0.092911
0.526938
[ "s414708188", "s613677789" ]
u279493135
p03475
python
s488213997
s453534752
2,352
109
3,188
3,188
Accepted
Accepted
95.37
N = int(eval(input())) CSF = [list(map(int, input().strip().split())) for _ in range(N-1)] for i in range(N): # 出発駅 time = 0 for j in range(i, N-1): if time < CSF[j][1]: # 開通まで待つ time = CSF[j][1] else: for k in range(CSF[j][2]): if (time + k) % CSF[j][2] == 0: t...
N = int(eval(input())) CSF = [list(map(int, input().strip().split())) for _ in range(N-1)] for i in range(N): # 出発駅 time = 0 for j in range(i, N-1): if time < CSF[j][1]: # 開通まで待つ time = CSF[j][1] elif time % CSF[j][2] == 0: pass else: time += CSF[j][2]-time%CSF[j][2] ...
16
15
384
350
N = int(eval(input())) CSF = [list(map(int, input().strip().split())) for _ in range(N - 1)] for i in range(N): # 出発駅 time = 0 for j in range(i, N - 1): if time < CSF[j][1]: # 開通まで待つ time = CSF[j][1] else: for k in range(CSF[j][2]): if (time + k) % CSF[j...
N = int(eval(input())) CSF = [list(map(int, input().strip().split())) for _ in range(N - 1)] for i in range(N): # 出発駅 time = 0 for j in range(i, N - 1): if time < CSF[j][1]: # 開通まで待つ time = CSF[j][1] elif time % CSF[j][2] == 0: pass else: time += CSF...
false
6.25
[ "+ elif time % CSF[j][2] == 0:", "+ pass", "- for k in range(CSF[j][2]):", "- if (time + k) % CSF[j][2] == 0:", "- time = time + k", "- break", "+ time += CSF[j][2] - time % CSF[j][2]" ]
false
0.075575
0.036358
2.078646
[ "s488213997", "s453534752" ]
u046187684
p03283
python
s622821716
s558756946
2,119
709
138,104
60,160
Accepted
Accepted
66.54
def solve(string): n, m, q, *lrpq = list(map(int, string.split())) lr, pq = lrpq[:2 * m], lrpq[2 * m:] t = [[0] * (n + 1) for _ in range(n + 1)] for l, r in zip(lr[::2], lr[1::2]): t[l][r] += 1 for i in range(n + 1): for j in range(n + 1): if j > 0: ...
def solve(string): n, m, q, *lrpq = list(map(int, string.split())) lr, pq = lrpq[:2 * m], lrpq[2 * m:] t = [[0] * (n + 1) for _ in range(n + 1)] for l, r in zip(lr[::2], lr[1::2]): t[l][r] += 1 for i in range(n + 1): for j in range(n + 1): if j > 0: ...
22
25
685
790
def solve(string): n, m, q, *lrpq = list(map(int, string.split())) lr, pq = lrpq[: 2 * m], lrpq[2 * m :] t = [[0] * (n + 1) for _ in range(n + 1)] for l, r in zip(lr[::2], lr[1::2]): t[l][r] += 1 for i in range(n + 1): for j in range(n + 1): if j > 0: t[i]...
def solve(string): n, m, q, *lrpq = list(map(int, string.split())) lr, pq = lrpq[: 2 * m], lrpq[2 * m :] t = [[0] * (n + 1) for _ in range(n + 1)] for l, r in zip(lr[::2], lr[1::2]): t[l][r] += 1 for i in range(n + 1): for j in range(n + 1): if j > 0: t[i]...
false
12
[ "+ for i in range(n + 1):", "+ for j in range(n + 1):", "+ if i > 0:", "+ t[i][j] += t[i - 1][j]", "- str(sum([t[i][q] - t[i][p - 1] for i in range(p, q + 1)]))", "+ str(t[q][q] - t[p - 1][q] - t[q][p - 1] + t[p - 1][p - 1])" ]
false
0.090699
0.110727
0.819128
[ "s622821716", "s558756946" ]
u845573105
p02579
python
s257173046
s827869749
731
556
92,316
98,172
Accepted
Accepted
23.94
H, W = list(map(int, input().split())) ch, cw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) f = [[s=="." for s in eval(input())] for h in range(H)] ans = [[-1 for w in range(W)]for h in range(H)] nextQ = [(ch-1)*1000 + cw-1] ans[ch-1][cw-1] = 0 while len(nextQ)>0: Q = list(n...
H, W = list(map(int, input().split())) ch, cw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) f = [[s=="." for s in eval(input())] for h in range(H)] ans = [[-1 for w in range(W)]for h in range(H)] nextQ = [(ch-1)*1000 + cw-1] ans[ch-1][cw-1] = 0 while len(nextQ)>0: Q = list(n...
46
47
1,377
1,330
H, W = list(map(int, input().split())) ch, cw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) f = [[s == "." for s in eval(input())] for h in range(H)] ans = [[-1 for w in range(W)] for h in range(H)] nextQ = [(ch - 1) * 1000 + cw - 1] ans[ch - 1][cw - 1] = 0 while len(nextQ) > 0: Q = lis...
H, W = list(map(int, input().split())) ch, cw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) f = [[s == "." for s in eval(input())] for h in range(H)] ans = [[-1 for w in range(W)] for h in range(H)] nextQ = [(ch - 1) * 1000 + cw - 1] ans[ch - 1][cw - 1] = 0 while len(nextQ) > 0: Q = lis...
false
2.12766
[ "- visited = set()", "- while len(Q):", "- nh = Q.pop(0)", "+ i = 0", "+ while i < len(Q):", "+ nh = Q[i]", "+ i += 1", "- visited.add((nh + dh) * 1000 + nw + dw)" ]
false
0.079405
0.033143
2.395844
[ "s257173046", "s827869749" ]
u745087332
p03111
python
s198578008
s609061664
274
72
47,852
3,064
Accepted
Accepted
73.72
# coding:utf-8 import sys import itertools INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def...
# coding:utf-8 import sys INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): return eval...
41
30
864
771
# coding:utf-8 import sys import itertools INF = float("inf") MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readlin...
# coding:utf-8 import sys INF = float("inf") MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin.readline()) def SI(): ...
false
26.829268
[ "-import itertools", "-ans = INF", "-for x in itertools.product([0, 1, 2, 3], repeat=n):", "- s = set(x)", "- if 0 not in s or 1 not in s or 2 not in s:", "- continue", "- T = [0] * 3", "- cnt = 0", "- for i, n in enumerate(x):", "- if n == 3:", "- continu...
false
0.284699
0.095615
2.977562
[ "s198578008", "s609061664" ]
u888092736
p03999
python
s123308394
s008494365
34
28
8,928
9,096
Accepted
Accepted
17.65
from itertools import product S = eval(input()) N = len(S) ans = 0 for opes in product(("", "+"), repeat=N - 1): eqn = [] for s, o in zip(S[:-1], opes): eqn += s + o ans += eval("".join(eqn) + S[-1]) print(ans)
from itertools import product S = eval(input()) N = len(S) ans = 0 for opes in product(("", "+"), repeat=N - 1): eqn = [] for s, o in zip(S[:-1], opes): eqn += s + o eqn = "".join(eqn) + S[-1] ans += sum(map(int, eqn.split("+"))) print(ans)
12
13
238
273
from itertools import product S = eval(input()) N = len(S) ans = 0 for opes in product(("", "+"), repeat=N - 1): eqn = [] for s, o in zip(S[:-1], opes): eqn += s + o ans += eval("".join(eqn) + S[-1]) print(ans)
from itertools import product S = eval(input()) N = len(S) ans = 0 for opes in product(("", "+"), repeat=N - 1): eqn = [] for s, o in zip(S[:-1], opes): eqn += s + o eqn = "".join(eqn) + S[-1] ans += sum(map(int, eqn.split("+"))) print(ans)
false
7.692308
[ "- ans += eval(\"\".join(eqn) + S[-1])", "+ eqn = \"\".join(eqn) + S[-1]", "+ ans += sum(map(int, eqn.split(\"+\")))" ]
false
0.036402
0.036889
0.986786
[ "s123308394", "s008494365" ]
u347600233
p02628
python
s870463229
s646951749
34
31
9,252
9,264
Accepted
Accepted
8.82
n, k = list(map(int, input().split())) p = [int(i) for i in input().split()] print((sum(sorted(p)[:k])))
n, k = list(map(int, input().split())) p = list(map(int, input().split())) print((sum(sorted(p)[:k])))
3
3
98
96
n, k = list(map(int, input().split())) p = [int(i) for i in input().split()] print((sum(sorted(p)[:k])))
n, k = list(map(int, input().split())) p = list(map(int, input().split())) print((sum(sorted(p)[:k])))
false
0
[ "-p = [int(i) for i in input().split()]", "+p = list(map(int, input().split()))" ]
false
0.036688
0.036596
1.002515
[ "s870463229", "s646951749" ]
u477977638
p02972
python
s969551554
s204226522
228
131
13,092
92,976
Accepted
Accepted
42.54
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines # rstrip().decode('utf-8') # INF=float("inf") #MOD=10**9+7 # sys.setrecursionlimit(2147483647) # import math #import numpy as np # import operator # import bisect # from heapq import heapify,h...
import sys input = sys.stdin.buffer.readline #sys.setrecursionlimit(10**9) #from functools import lru_cache def RD(): return input().rstrip().decode() def II(): return int(eval(input())) def FI(): return int(eval(input())) def MI(): return list(map(int,input().split())) def MF(): return list(map(float,input...
46
51
1,121
818
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines # rstrip().decode('utf-8') # INF=float("inf") # MOD=10**9+7 # sys.setrecursionlimit(2147483647) # import math # import numpy as np # import operator # import bisect # from heapq import heapify,heappop,heappush...
import sys input = sys.stdin.buffer.readline # sys.setrecursionlimit(10**9) # from functools import lru_cache def RD(): return input().rstrip().decode() def II(): return int(eval(input())) def FI(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MF(): return ...
false
9.803922
[ "-read = sys.stdin.buffer.read", "-inputs = sys.stdin.buffer.readlines", "-# rstrip().decode('utf-8')", "-# INF=float(\"inf\")", "-# MOD=10**9+7", "-# sys.setrecursionlimit(2147483647)", "-# import math", "-# import numpy as np", "-# import operator", "-# import bisect", "-# from heapq import he...
false
0.046018
0.007208
6.38394
[ "s969551554", "s204226522" ]
u816631826
p02676
python
s795238634
s583938890
30
24
9,000
9,160
Accepted
Accepted
20
num=int(eval(input())) #ask integer for limitation s=eval(input()) #ask string if len(s) > num: #check if the length s exceeded num print((s[:num] + "...")) #print s with the limit "num" else: #if the string not exceeded num print(s)
#K is an input for the range of S #input to get lowercase the letters from users K = int(eval(input())) S = eval(input()) if len (S) > K: print((S[:K] + "...")) else: print(S)
6
8
238
176
num = int(eval(input())) # ask integer for limitation s = eval(input()) # ask string if len(s) > num: # check if the length s exceeded num print((s[:num] + "...")) # print s with the limit "num" else: # if the string not exceeded num print(s)
# K is an input for the range of S # input to get lowercase the letters from users K = int(eval(input())) S = eval(input()) if len(S) > K: print((S[:K] + "...")) else: print(S)
false
25
[ "-num = int(eval(input())) # ask integer for limitation", "-s = eval(input()) # ask string", "-if len(s) > num: # check if the length s exceeded num", "- print((s[:num] + \"...\")) # print s with the limit \"num\"", "-else: # if the string not exceeded num", "- print(s)", "+# K is an input fo...
false
0.047211
0.112923
0.418084
[ "s795238634", "s583938890" ]
u298297089
p03252
python
s774786045
s224787741
106
87
7,984
8,112
Accepted
Accepted
17.92
s = eval(input()) t = eval(input()) ans = {c:[] for c in 'abcdefghijklmnopqrstuvwxyz'} res = {c:[] for c in 'abcdefghijklmnopqrstuvwxyz'} cnt = 0 for a,b in zip(s,t): ans[b].append(a) res[a].append(b) # elif ans[a] != a and ans[ans[a]] != ans[b]: # print(a, b, '0', a, b, ans[a], ans[b], ...
s = eval(input()) t = eval(input()) ans = {c:[] for c in 'abcdefghijklmnopqrstuvwxyz'} res = {c:[] for c in 'abcdefghijklmnopqrstuvwxyz'} for a,b in zip(s,t): ans[b].append(a) res[a].append(b) aa = [0 for v in list(ans.values()) if len(set(v)) > 1] bb = [0 for v in list(res.values()) if len(set(v)) ...
23
16
564
380
s = eval(input()) t = eval(input()) ans = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"} res = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"} cnt = 0 for a, b in zip(s, t): ans[b].append(a) res[a].append(b) # elif ans[a] != a and ans[ans[a]] != ans[b]: # print(a, b, '0', a, b, ans[a], ans[b], cnt) ...
s = eval(input()) t = eval(input()) ans = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"} res = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"} for a, b in zip(s, t): ans[b].append(a) res[a].append(b) aa = [0 for v in list(ans.values()) if len(set(v)) > 1] bb = [0 for v in list(res.values()) if len(set(v)) > 1] if ...
false
30.434783
[ "-cnt = 0", "- # elif ans[a] != a and ans[ans[a]] != ans[b]:", "- # print(a, b, '0', a, b, ans[a], ans[b], cnt)", "- # print('No')", "- # break", "- cnt += 1", "-# print(ans)" ]
false
0.047488
0.046625
1.0185
[ "s774786045", "s224787741" ]
u325227960
p02757
python
s908040306
s502263766
246
226
53,472
53,472
Accepted
Accepted
8.13
n, p = list(map(int,input().split())) s = eval(input()) mod = p l = 100 M = [1] # i!のmod m = 1 for i in range(1, l): m = (m * i) % mod M.append(m) def pow(x, y, mod): # x**y の mod を返す関数 ans = 1 while y > 0: if y % 2 == 1: ans = (ans * x) % mod x = (x**2)...
n, p = list(map(int,input().split())) s = eval(input()) mod = p l = 100 M = [1] # i!のmod m = 1 for i in range(1, l): m = (m * i) % mod M.append(m) def pow(x, y, mod): # x**y の mod を返す関数 ans = 1 while y > 0: if y % 2 == 1: ans = (ans * x) % mod x = (x**2)...
46
50
796
872
n, p = list(map(int, input().split())) s = eval(input()) mod = p l = 100 M = [1] # i!のmod m = 1 for i in range(1, l): m = (m * i) % mod M.append(m) def pow(x, y, mod): # x**y の mod を返す関数 ans = 1 while y > 0: if y % 2 == 1: ans = (ans * x) % mod x = (x**2) % mod y ...
n, p = list(map(int, input().split())) s = eval(input()) mod = p l = 100 M = [1] # i!のmod m = 1 for i in range(1, l): m = (m * i) % mod M.append(m) def pow(x, y, mod): # x**y の mod を返す関数 ans = 1 while y > 0: if y % 2 == 1: ans = (ans * x) % mod x = (x**2) % mod y ...
false
8
[ "+import math", "+", "+elif math.log10(p) in [1, 2, 3, 4]:", "+ print(\"Wrong Answer\")" ]
false
0.056335
0.037657
1.496009
[ "s908040306", "s502263766" ]
u556589653
p02718
python
s546511971
s326168052
33
26
9,924
9,140
Accepted
Accepted
21.21
from decimal import Decimal n,m = list(map(int,input().split())) A = list(map(int,input().split())) border = float(sum(A)/(4*m)) border2 = str(border) border3 = Decimal(border2) ans = 0 judge = 0 for i in range(n): if A[i] >= border3: ans+=1 if ans >= m: print("Yes") else: print("No")
n,m = map(int,input().split()) A = list(map(int,input().split())) judge = sum(A) / (4 * m) ans = [] for i in range(n): if A[i] < judge : continue else: ans.append(A[i]) print("Yes") if len(ans) >= m else print("No")
15
10
304
236
from decimal import Decimal n, m = list(map(int, input().split())) A = list(map(int, input().split())) border = float(sum(A) / (4 * m)) border2 = str(border) border3 = Decimal(border2) ans = 0 judge = 0 for i in range(n): if A[i] >= border3: ans += 1 if ans >= m: print("Yes") else: print("No")
n, m = map(int, input().split()) A = list(map(int, input().split())) judge = sum(A) / (4 * m) ans = [] for i in range(n): if A[i] < judge: continue else: ans.append(A[i]) print("Yes") if len(ans) >= m else print("No")
false
33.333333
[ "-from decimal import Decimal", "-", "-n, m = list(map(int, input().split()))", "+n, m = map(int, input().split())", "-border = float(sum(A) / (4 * m))", "-border2 = str(border)", "-border3 = Decimal(border2)", "-ans = 0", "-judge = 0", "+judge = sum(A) / (4 * m)", "+ans = []", "- if A[i] >...
false
0.04799
0.044589
1.076268
[ "s546511971", "s326168052" ]
u729133443
p02555
python
s179934512
s951234507
90
52
75,024
22,268
Accepted
Accepted
42.22
a,b,c=1,0,0 exec('a,b,c=b,c,a+c;'*(int(eval(input()))-2)) print((c%(10**9+7)))
a,b,c=1,0,0 exec('a,b,c=b,c,a+c;'*int(eval(input()))) print((a%(10**9+7)))
3
3
72
68
a, b, c = 1, 0, 0 exec("a,b,c=b,c,a+c;" * (int(eval(input())) - 2)) print((c % (10**9 + 7)))
a, b, c = 1, 0, 0 exec("a,b,c=b,c,a+c;" * int(eval(input()))) print((a % (10**9 + 7)))
false
0
[ "-exec(\"a,b,c=b,c,a+c;\" * (int(eval(input())) - 2))", "-print((c % (10**9 + 7)))", "+exec(\"a,b,c=b,c,a+c;\" * int(eval(input())))", "+print((a % (10**9 + 7)))" ]
false
0.04255
0.081498
0.5221
[ "s179934512", "s951234507" ]
u077291787
p03495
python
s611086669
s471139711
229
98
33,696
41,500
Accepted
Accepted
57.21
# ABC081C - Not so Diverse (ARC086C) n, k = list(map(int, input().rstrip().split())) lst = sorted(list(map(int, input().rstrip().split()))) dic = {} for i in lst: if i not in dic: dic[i] = 1 else: dic[i] += 1 cnt = sorted([i for i in list(dic.values())], reverse=True) ans = 0 for i ...
# ARC086C - Not so Diverse (ABC081C) from collections import Counter def main(): n, k = list(map(int, input().rstrip().split())) A = sorted(list(Counter(list(map(int, input().split()))).values()), reverse=True) print((sum(A[k:]))) if __name__ == "__main__": main()
18
12
413
281
# ABC081C - Not so Diverse (ARC086C) n, k = list(map(int, input().rstrip().split())) lst = sorted(list(map(int, input().rstrip().split()))) dic = {} for i in lst: if i not in dic: dic[i] = 1 else: dic[i] += 1 cnt = sorted([i for i in list(dic.values())], reverse=True) ans = 0 for i in range(len(...
# ARC086C - Not so Diverse (ABC081C) from collections import Counter def main(): n, k = list(map(int, input().rstrip().split())) A = sorted(list(Counter(list(map(int, input().split()))).values()), reverse=True) print((sum(A[k:]))) if __name__ == "__main__": main()
false
33.333333
[ "-# ABC081C - Not so Diverse (ARC086C)", "-n, k = list(map(int, input().rstrip().split()))", "-lst = sorted(list(map(int, input().rstrip().split())))", "-dic = {}", "-for i in lst:", "- if i not in dic:", "- dic[i] = 1", "- else:", "- dic[i] += 1", "-cnt = sorted([i for i in li...
false
0.036473
0.041247
0.884258
[ "s611086669", "s471139711" ]
u599925824
p03075
python
s246356017
s264346912
150
17
12,500
3,064
Accepted
Accepted
88.67
import numpy as np a = int(eval(input())) b = int(eval(input())) c = int(eval(input())) d = int(eval(input())) e = int(eval(input())) k = int(eval(input())) if k>=b-a and k>=c-a and k>=d-a and k>=e-a and k>=c-b and k>=d-b and k>=e-b and k>=d-c and k>=e-c and k>=e-d: print("Yay!") else: print(":(")
a = int(eval(input())) b = int(eval(input())) c = int(eval(input())) d = int(eval(input())) e = int(eval(input())) k = int(eval(input())) if k>=b-a and k>=c-a and k>=d-a and k>=e-a and k>=c-b and k>=d-b and k>=e-b and k>=d-c and k>=e-c and k>=e-d: print("Yay!") else: print(":(")
11
10
276
256
import numpy as np a = int(eval(input())) b = int(eval(input())) c = int(eval(input())) d = int(eval(input())) e = int(eval(input())) k = int(eval(input())) if ( k >= b - a and k >= c - a and k >= d - a and k >= e - a and k >= c - b and k >= d - b and k >= e - b and k >= d - c and k...
a = int(eval(input())) b = int(eval(input())) c = int(eval(input())) d = int(eval(input())) e = int(eval(input())) k = int(eval(input())) if ( k >= b - a and k >= c - a and k >= d - a and k >= e - a and k >= c - b and k >= d - b and k >= e - b and k >= d - c and k >= e - c and k ...
false
9.090909
[ "-import numpy as np", "-" ]
false
0.107757
0.036248
2.972808
[ "s246356017", "s264346912" ]
u312025627
p02555
python
s000684126
s734399202
85
78
63,348
64,324
Accepted
Accepted
8.24
MOD = 10**9 + 7 def main(): S = int(eval(input())) if S < 3: print((0)) return dp = [0] * (S + 1) dp[3] = 1 for i in range(4, S + 1): dp[i] = dp[i - 1] + dp[i - 3] dp[i] %= MOD print((dp[S])) # print(*dp) if __name__ == '__main__': ma...
MOD = 10**9 + 7 m = 5000 fac = [0] * m finv = [0] * m inv = [0] * m def COMBinitialize(m): fac[0] = 1 finv[0] = 1 if m > 1: fac[1] = 1 finv[1] = 1 inv[1] = 1 for i in range(2, m): fac[i] = fac[i - 1] * i % MOD inv[i] = MOD - inv[M...
19
48
315
852
MOD = 10**9 + 7 def main(): S = int(eval(input())) if S < 3: print((0)) return dp = [0] * (S + 1) dp[3] = 1 for i in range(4, S + 1): dp[i] = dp[i - 1] + dp[i - 3] dp[i] %= MOD print((dp[S])) # print(*dp) if __name__ == "__main__": main()
MOD = 10**9 + 7 m = 5000 fac = [0] * m finv = [0] * m inv = [0] * m def COMBinitialize(m): fac[0] = 1 finv[0] = 1 if m > 1: fac[1] = 1 finv[1] = 1 inv[1] = 1 for i in range(2, m): fac[i] = fac[i - 1] * i % MOD inv[i] = MOD - inv[MOD % i] * (MOD // i)...
false
60.416667
[ "+m = 5000", "+fac = [0] * m", "+finv = [0] * m", "+inv = [0] * m", "+", "+", "+def COMBinitialize(m):", "+ fac[0] = 1", "+ finv[0] = 1", "+ if m > 1:", "+ fac[1] = 1", "+ finv[1] = 1", "+ inv[1] = 1", "+ for i in range(2, m):", "+ fac[i] =...
false
0.051353
0.056218
0.913464
[ "s000684126", "s734399202" ]
u460386402
p02582
python
s965847107
s929970084
31
27
9,040
9,084
Accepted
Accepted
12.9
s=eval(input()) count=0 if s.count('R')==1: print((1)) elif s.count('R')==3: print((3)) elif s.count('R')==2: if s[1]=="R": print((2)) else: print((1)) else: print((0))
s=eval(input()) ans=0 for i in range(1,4): r="R"*i if r in s: ans=i print(ans)
13
8
182
88
s = eval(input()) count = 0 if s.count("R") == 1: print((1)) elif s.count("R") == 3: print((3)) elif s.count("R") == 2: if s[1] == "R": print((2)) else: print((1)) else: print((0))
s = eval(input()) ans = 0 for i in range(1, 4): r = "R" * i if r in s: ans = i print(ans)
false
38.461538
[ "-count = 0", "-if s.count(\"R\") == 1:", "- print((1))", "-elif s.count(\"R\") == 3:", "- print((3))", "-elif s.count(\"R\") == 2:", "- if s[1] == \"R\":", "- print((2))", "- else:", "- print((1))", "-else:", "- print((0))", "+ans = 0", "+for i in range(1, 4):...
false
0.03854
0.039386
0.978504
[ "s965847107", "s929970084" ]
u094191970
p03818
python
s817018364
s214536064
65
45
18,656
14,396
Accepted
Accepted
30.77
from collections import Counter n=int(eval(input())) a=list(map(int,input().split())) c=Counter(a) cnt=0 ans=0 for v in list(c.values()): ans+=1 if v%2==0: cnt+=1 if cnt%2==1: ans-=1 print(ans)
n=int(eval(input())) a=set(list(map(int,input().split()))) al=len(a) print((al if al%2==1 else al-1))
19
4
215
96
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) c = Counter(a) cnt = 0 ans = 0 for v in list(c.values()): ans += 1 if v % 2 == 0: cnt += 1 if cnt % 2 == 1: ans -= 1 print(ans)
n = int(eval(input())) a = set(list(map(int, input().split()))) al = len(a) print((al if al % 2 == 1 else al - 1))
false
78.947368
[ "-from collections import Counter", "-", "-a = list(map(int, input().split()))", "-c = Counter(a)", "-cnt = 0", "-ans = 0", "-for v in list(c.values()):", "- ans += 1", "- if v % 2 == 0:", "- cnt += 1", "-if cnt % 2 == 1:", "- ans -= 1", "-print(ans)", "+a = set(list(map(in...
false
0.037106
0.037626
0.986166
[ "s817018364", "s214536064" ]
u727148417
p02702
python
s912552042
s832620052
361
198
12,232
81,464
Accepted
Accepted
45.15
import sys from collections import deque def input(): return sys.stdin.readline()[:-1] S = deque(list(map(int, list(eval(input()))))) num = 0 dict = {} dict[0] = 1 ans = 0 for i in range(len(S)): num += S.pop() * pow(10,i,2019) cand = num % 2019 if cand in list(dict.keys()): dic...
#import sys from collections import deque #def input(): # return sys.stdin.readline()[:-1] S = deque(list(map(int, list(eval(input()))))) num = 0 dict = {} dict[0] = 1 ans = 0 for i in range(len(S)): num += S.pop() * pow(10,i,2019) cand = num % 2019 if cand in list(dict.keys()): ...
22
22
434
437
import sys from collections import deque def input(): return sys.stdin.readline()[:-1] S = deque(list(map(int, list(eval(input()))))) num = 0 dict = {} dict[0] = 1 ans = 0 for i in range(len(S)): num += S.pop() * pow(10, i, 2019) cand = num % 2019 if cand in list(dict.keys()): dict[cand] += ...
# import sys from collections import deque # def input(): # return sys.stdin.readline()[:-1] S = deque(list(map(int, list(eval(input()))))) num = 0 dict = {} dict[0] = 1 ans = 0 for i in range(len(S)): num += S.pop() * pow(10, i, 2019) cand = num % 2019 if cand in list(dict.keys()): dict[cand] +...
false
0
[ "-import sys", "+# import sys", "-", "-def input():", "- return sys.stdin.readline()[:-1]", "-", "-", "+# def input():", "+# return sys.stdin.readline()[:-1]" ]
false
0.033305
0.03568
0.933448
[ "s912552042", "s832620052" ]
u945181840
p02780
python
s543691603
s471314734
153
119
25,420
25,420
Accepted
Accepted
22.22
import sys from itertools import accumulate read = sys.stdin.read N, K, *p = list(map(int, read().split())) p = [(1 + i) * i // 2 / i for i in p] p = [0] + p P = list(accumulate(p)) answer = 0 for i in range(K, N + 1): s = P[i] - P[i - K] if s > answer: answer = s print(answer)
import sys from itertools import accumulate read = sys.stdin.read N, K, *p = list(map(int, read().split())) p = [(1 + i) / 2 for i in p] p = [0] + p P = list(accumulate(p)) answer = max(P[i] - P[i - K] for i in range(K, N + 1)) print(answer)
18
13
311
252
import sys from itertools import accumulate read = sys.stdin.read N, K, *p = list(map(int, read().split())) p = [(1 + i) * i // 2 / i for i in p] p = [0] + p P = list(accumulate(p)) answer = 0 for i in range(K, N + 1): s = P[i] - P[i - K] if s > answer: answer = s print(answer)
import sys from itertools import accumulate read = sys.stdin.read N, K, *p = list(map(int, read().split())) p = [(1 + i) / 2 for i in p] p = [0] + p P = list(accumulate(p)) answer = max(P[i] - P[i - K] for i in range(K, N + 1)) print(answer)
false
27.777778
[ "-p = [(1 + i) * i // 2 / i for i in p]", "+p = [(1 + i) / 2 for i in p]", "-answer = 0", "-for i in range(K, N + 1):", "- s = P[i] - P[i - K]", "- if s > answer:", "- answer = s", "+answer = max(P[i] - P[i - K] for i in range(K, N + 1))" ]
false
0.042645
0.048235
0.884106
[ "s543691603", "s471314734" ]
u974918235
p02613
python
s121281216
s902487209
151
139
9,064
16,280
Accepted
Accepted
7.95
N = int(eval(input())) ac = 0 wa = 0 tle = 0 re = 0 for _ in range(N): a = eval(input()) if a == "AC": ac += 1 if a == "WA": wa += 1 if a == "TLE": tle += 1 if a =="RE": re += 1 print(f"AC x {ac}") print(f"WA x {wa}") print(f"TLE x {tle}") print(f"RE x {re}")
N = int(eval(input())) lst = [eval(input()) for _ in range(N)] for i in ["AC", "WA", "TLE", "RE"]: print(f"{i} x {lst.count(i)}")
19
4
291
122
N = int(eval(input())) ac = 0 wa = 0 tle = 0 re = 0 for _ in range(N): a = eval(input()) if a == "AC": ac += 1 if a == "WA": wa += 1 if a == "TLE": tle += 1 if a == "RE": re += 1 print(f"AC x {ac}") print(f"WA x {wa}") print(f"TLE x {tle}") print(f"RE x {re}")
N = int(eval(input())) lst = [eval(input()) for _ in range(N)] for i in ["AC", "WA", "TLE", "RE"]: print(f"{i} x {lst.count(i)}")
false
78.947368
[ "-ac = 0", "-wa = 0", "-tle = 0", "-re = 0", "-for _ in range(N):", "- a = eval(input())", "- if a == \"AC\":", "- ac += 1", "- if a == \"WA\":", "- wa += 1", "- if a == \"TLE\":", "- tle += 1", "- if a == \"RE\":", "- re += 1", "-print(f\"AC x ...
false
0.082942
0.078895
1.051299
[ "s121281216", "s902487209" ]
u258492760
p03085
python
s170761363
s412217156
19
17
3,060
2,940
Accepted
Accepted
10.53
b = eval(input()) if b == 'A': print('T') if b == 'T': print('A') if b == 'C': print('G') if b == 'G': print('C')
b = eval(input()) B = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'} print((B[b]))
10
3
133
70
b = eval(input()) if b == "A": print("T") if b == "T": print("A") if b == "C": print("G") if b == "G": print("C")
b = eval(input()) B = {"A": "T", "T": "A", "C": "G", "G": "C"} print((B[b]))
false
70
[ "-if b == \"A\":", "- print(\"T\")", "-if b == \"T\":", "- print(\"A\")", "-if b == \"C\":", "- print(\"G\")", "-if b == \"G\":", "- print(\"C\")", "+B = {\"A\": \"T\", \"T\": \"A\", \"C\": \"G\", \"G\": \"C\"}", "+print((B[b]))" ]
false
0.064928
0.04857
1.336796
[ "s170761363", "s412217156" ]
u353895424
p03379
python
s751610098
s742625516
415
325
93,780
25,228
Accepted
Accepted
21.69
n = int(eval(input())) x = list(map(int, input().split())) sx = sorted(x) m = (n+1)//2 med1 = sx[m - 1] med2 = sx[m] for _x in x: if _x <= med1: print(med2) else: print(med1)
n = int(eval(input())) x = list(map(int, input().split())) x_ = sorted(x) c = x_[n//2 - 1] c_ = x_[n//2] for i in range(n): if x[i] <= c: print(c_) else: print(c)
13
11
206
191
n = int(eval(input())) x = list(map(int, input().split())) sx = sorted(x) m = (n + 1) // 2 med1 = sx[m - 1] med2 = sx[m] for _x in x: if _x <= med1: print(med2) else: print(med1)
n = int(eval(input())) x = list(map(int, input().split())) x_ = sorted(x) c = x_[n // 2 - 1] c_ = x_[n // 2] for i in range(n): if x[i] <= c: print(c_) else: print(c)
false
15.384615
[ "-sx = sorted(x)", "-m = (n + 1) // 2", "-med1 = sx[m - 1]", "-med2 = sx[m]", "-for _x in x:", "- if _x <= med1:", "- print(med2)", "+x_ = sorted(x)", "+c = x_[n // 2 - 1]", "+c_ = x_[n // 2]", "+for i in range(n):", "+ if x[i] <= c:", "+ print(c_)", "- print(med...
false
0.006336
0.039109
0.162007
[ "s751610098", "s742625516" ]
u185896732
p03449
python
s573251122
s335776222
21
18
3,316
3,060
Accepted
Accepted
14.29
import sys from collections import deque input=sys.stdin.readline sys.setrecursionlimit(10**6) n=int(input().rstrip()) a=[list(map(int,input().split())) for _ in range(2)] ans=0 print((max([sum(a[0][:i+1])+sum(a[1][i:]) for i in range(n)])))
import sys input=sys.stdin.readline n=int(input().rstrip()) a=[list(map(int,input().split())) for _ in range(2)] ans=0 for i in range(n): now=sum(a[0][:i+1])+sum(a[1][i:]) ans=max(ans,now) print(ans)
9
11
248
219
import sys from collections import deque input = sys.stdin.readline sys.setrecursionlimit(10**6) n = int(input().rstrip()) a = [list(map(int, input().split())) for _ in range(2)] ans = 0 print((max([sum(a[0][: i + 1]) + sum(a[1][i:]) for i in range(n)])))
import sys input = sys.stdin.readline n = int(input().rstrip()) a = [list(map(int, input().split())) for _ in range(2)] ans = 0 for i in range(n): now = sum(a[0][: i + 1]) + sum(a[1][i:]) ans = max(ans, now) print(ans)
false
18.181818
[ "-from collections import deque", "-sys.setrecursionlimit(10**6)", "-print((max([sum(a[0][: i + 1]) + sum(a[1][i:]) for i in range(n)])))", "+for i in range(n):", "+ now = sum(a[0][: i + 1]) + sum(a[1][i:])", "+ ans = max(ans, now)", "+print(ans)" ]
false
0.038626
0.040113
0.962923
[ "s573251122", "s335776222" ]
u427344224
p03162
python
s637204499
s233518949
1,151
594
45,680
40,236
Accepted
Accepted
48.39
N = int(eval(input())) a_list = [[0 for _ in range(3)] for _ in range(N)] for i in range(N): a, b, c = list(map(int, input().split())) a_list[i][0] = a a_list[i][1] = b a_list[i][2] = c dp = [[0 for _ in range(3)] for _ in range(N + 1)] for i in range(1, N + 1): for j in range(3): ...
N = int(eval(input())) abc = [] for i in range(N): abc.append(tuple(map(int, input().split()))) dp = [[0] * 3 for _ in range(N + 1)] for i in range(N): a, b, c = abc[i] dp[i + 1][0] += max(dp[i][1] + a, dp[i][2] + a) dp[i + 1][1] += max(dp[i][0] + b, dp[i][2] + b) dp[i + 1][2] += max(dp...
21
15
565
363
N = int(eval(input())) a_list = [[0 for _ in range(3)] for _ in range(N)] for i in range(N): a, b, c = list(map(int, input().split())) a_list[i][0] = a a_list[i][1] = b a_list[i][2] = c dp = [[0 for _ in range(3)] for _ in range(N + 1)] for i in range(1, N + 1): for j in range(3): for k in r...
N = int(eval(input())) abc = [] for i in range(N): abc.append(tuple(map(int, input().split()))) dp = [[0] * 3 for _ in range(N + 1)] for i in range(N): a, b, c = abc[i] dp[i + 1][0] += max(dp[i][1] + a, dp[i][2] + a) dp[i + 1][1] += max(dp[i][0] + b, dp[i][2] + b) dp[i + 1][2] += max(dp[i][0] + c, d...
false
28.571429
[ "-a_list = [[0 for _ in range(3)] for _ in range(N)]", "+abc = []", "- a, b, c = list(map(int, input().split()))", "- a_list[i][0] = a", "- a_list[i][1] = b", "- a_list[i][2] = c", "-dp = [[0 for _ in range(3)] for _ in range(N + 1)]", "-for i in range(1, N + 1):", "- for j in range(3...
false
0.05356
0.036989
1.447989
[ "s637204499", "s233518949" ]
u334712262
p02763
python
s546248683
s783039048
1,372
658
55,720
55,656
Accepted
Accepted
52.04
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, produc...
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, produc...
143
125
3,367
2,916
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permut...
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permut...
false
12.587413
[ "- # to par: (n-1) // 2", "- # to chr: 2n+1, 2n+2", "- \"\"\"operator and identity_element has to be a monoid.\"\"\"", "- self.__N = 2 ** int(math.ceil(math.log(len(array), 2)))", "- self.__table = [identity_element] * (self.__N * 2 - 1)", "+ _len = len(array)", "+ ...
false
0.04678
0.064321
0.727287
[ "s546248683", "s783039048" ]
u226108478
p03449
python
s942211143
s786733245
157
17
12,472
3,060
Accepted
Accepted
89.17
# -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem C import numpy as np if __name__ == '__main__': # Input N = int(eval(input())) route = np.zeros([2, N], dtype=int) # HACK: More smarter. for i in range(2): line = [int(i) for i in input().split(" ")] for ...
# -*- coding: utf-8 -*- def main(): n = int(eval(input())) a = [list(map(int, input().split())) for i in range(2)] count = 0 for i in range(n): first = sum(a[0][:i + 1]) second = sum(a[1][i:]) count = max(count, first + second) print(count) if __name__ =...
38
18
847
340
# -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem C import numpy as np if __name__ == "__main__": # Input N = int(eval(input())) route = np.zeros([2, N], dtype=int) # HACK: More smarter. for i in range(2): line = [int(i) for i in input().split(" ")] for j in range(N): ...
# -*- coding: utf-8 -*- def main(): n = int(eval(input())) a = [list(map(int, input().split())) for i in range(2)] count = 0 for i in range(n): first = sum(a[0][: i + 1]) second = sum(a[1][i:]) count = max(count, first + second) print(count) if __name__ == "__main__": m...
false
52.631579
[ "-# AtCoder Beginner Contest", "-# Problem C", "-import numpy as np", "+def main():", "+ n = int(eval(input()))", "+ a = [list(map(int, input().split())) for i in range(2)]", "+ count = 0", "+ for i in range(n):", "+ first = sum(a[0][: i + 1])", "+ second = sum(a[1][i:])"...
false
0.377288
0.041639
9.060832
[ "s942211143", "s786733245" ]
u294630296
p02713
python
s581374113
s855033700
1,854
1,428
71,636
71,432
Accepted
Accepted
22.98
import math K = int(eval(input())) res = [math.gcd(a, math.gcd(b,c)) for a in range(1, K+1) for b in range(1, K+1) for c in range(1, K+1)] print((sum(res)))
from math import gcd K = int(eval(input())) res = [gcd(a, gcd(b,c)) for a in range(1, K+1) for b in range(1, K+1) for c in range(1, K+1)] print((sum(res)))
10
10
166
165
import math K = int(eval(input())) res = [ math.gcd(a, math.gcd(b, c)) for a in range(1, K + 1) for b in range(1, K + 1) for c in range(1, K + 1) ] print((sum(res)))
from math import gcd K = int(eval(input())) res = [ gcd(a, gcd(b, c)) for a in range(1, K + 1) for b in range(1, K + 1) for c in range(1, K + 1) ] print((sum(res)))
false
0
[ "-import math", "+from math import gcd", "- math.gcd(a, math.gcd(b, c))", "+ gcd(a, gcd(b, c))" ]
false
0.050078
0.243791
0.205414
[ "s581374113", "s855033700" ]
u075303794
p02927
python
s477046686
s818666680
24
20
3,060
2,940
Accepted
Accepted
16.67
M,D = list(map(int,input().split())) ans = 0 for i in range(1, M+1): for j in range(1, D+1): if j < 22: continue else: j = str(j) d1 = int(j[0]) d2 = int(j[1]) if d1>=2 and d2>=2 and i == d1*d2: ans += 1 print(ans)
M,D = list(map(int,input().split())) ans = 0 for i in range(1, M+1): for j in range(1, D+1): if j//10 >=2 and j%10 >=2 and i == (j//10)*(j%10): ans += 1 print(ans)
13
7
268
177
M, D = list(map(int, input().split())) ans = 0 for i in range(1, M + 1): for j in range(1, D + 1): if j < 22: continue else: j = str(j) d1 = int(j[0]) d2 = int(j[1]) if d1 >= 2 and d2 >= 2 and i == d1 * d2: ans += 1 print(an...
M, D = list(map(int, input().split())) ans = 0 for i in range(1, M + 1): for j in range(1, D + 1): if j // 10 >= 2 and j % 10 >= 2 and i == (j // 10) * (j % 10): ans += 1 print(ans)
false
46.153846
[ "- if j < 22:", "- continue", "- else:", "- j = str(j)", "- d1 = int(j[0])", "- d2 = int(j[1])", "- if d1 >= 2 and d2 >= 2 and i == d1 * d2:", "- ans += 1", "+ if j // 10 >= 2 and j % 10 >= 2 and i == (j // 10...
false
0.049523
0.049033
1.009987
[ "s477046686", "s818666680" ]
u671060652
p02860
python
s911008401
s615188004
170
55
38,384
61,720
Accepted
Accepted
67.65
n = int(eval(input())) s = eval(input()) def judge(s): if len(s) % 2 == 1: print("No") return for i in range(0, len(s)//2): if(s[i] != s[len(s)//2 + i]): print("No") return print("Yes") return judge(s)
n = int(eval(input())) s = eval(input()) l = s[:len(s)//2] if s == l+l: print("Yes") else: print("No")
17
7
273
101
n = int(eval(input())) s = eval(input()) def judge(s): if len(s) % 2 == 1: print("No") return for i in range(0, len(s) // 2): if s[i] != s[len(s) // 2 + i]: print("No") return print("Yes") return judge(s)
n = int(eval(input())) s = eval(input()) l = s[: len(s) // 2] if s == l + l: print("Yes") else: print("No")
false
58.823529
[ "-", "-", "-def judge(s):", "- if len(s) % 2 == 1:", "- print(\"No\")", "- return", "- for i in range(0, len(s) // 2):", "- if s[i] != s[len(s) // 2 + i]:", "- print(\"No\")", "- return", "+l = s[: len(s) // 2]", "+if s == l + l:", "- retur...
false
0.03444
0.033747
1.020552
[ "s911008401", "s615188004" ]
u846150137
p03255
python
s795441410
s769579738
1,066
858
27,656
27,244
Accepted
Accepted
19.51
I=lambda:list(map(int,input().split())) n,p = I() s=[0] for i in I(): s += [s[-1] + i] for t in range(1, n + 1): m = 5 * s[n] + t * p c = n - t * 2 while c > 0: m += 2 * s[c] c -= t a = m if t == 1 else min(a,m) print((a + n * p))
I=lambda:list(map(int,input().split())) n,p = I() s=[0] for i in I(): s += [s[-1]+i] for t in range(1,n + 1): m = 5 * s[n] + t * p for i in range(n - t * 2,0,-t): m += 2 * s[i] a = m if t == 1 else min(a,m) print((a + n * p))
14
12
254
241
I = lambda: list(map(int, input().split())) n, p = I() s = [0] for i in I(): s += [s[-1] + i] for t in range(1, n + 1): m = 5 * s[n] + t * p c = n - t * 2 while c > 0: m += 2 * s[c] c -= t a = m if t == 1 else min(a, m) print((a + n * p))
I = lambda: list(map(int, input().split())) n, p = I() s = [0] for i in I(): s += [s[-1] + i] for t in range(1, n + 1): m = 5 * s[n] + t * p for i in range(n - t * 2, 0, -t): m += 2 * s[i] a = m if t == 1 else min(a, m) print((a + n * p))
false
14.285714
[ "- c = n - t * 2", "- while c > 0:", "- m += 2 * s[c]", "- c -= t", "+ for i in range(n - t * 2, 0, -t):", "+ m += 2 * s[i]" ]
false
0.063965
0.037361
1.7121
[ "s795441410", "s769579738" ]
u435300817
p02412
python
s404613409
s748118580
1,930
330
19,480
7,768
Accepted
Accepted
82.9
num_list = [] while True: values = [int(x) for x in input().split()] if 0 == values[0] and 0 == values[1]: break num_list.append(values) for n, t in num_list: ret = ' '.join(str(x + y + z) for x in range(1, n + 1) for y in range(x + 1, n + 1) for z in range(y + 1, n + 1)) cnt = 0 ...
num_list = [] while True: values = [int(x) for x in input().split()] if 0 == values[0] and 0 == values[1]: break num_list.append(values) for n, t in num_list: ret = ' '.join(str(x + y + z) for x in range(1, n + 1) for y in range(x + 1, n + 1) for z in range(y + 1, n + 1) if t == x + y +...
14
10
408
353
num_list = [] while True: values = [int(x) for x in input().split()] if 0 == values[0] and 0 == values[1]: break num_list.append(values) for n, t in num_list: ret = " ".join( str(x + y + z) for x in range(1, n + 1) for y in range(x + 1, n + 1) for z in range(y + 1...
num_list = [] while True: values = [int(x) for x in input().split()] if 0 == values[0] and 0 == values[1]: break num_list.append(values) for n, t in num_list: ret = " ".join( str(x + y + z) for x in range(1, n + 1) for y in range(x + 1, n + 1) for z in range(y + 1...
false
28.571429
[ "+ if t == x + y + z", "- cnt = 0", "- for x in ret.split():", "- if str(t) == x:", "- cnt += 1", "- print(cnt)", "+ print((ret.count(str(t))))" ]
false
0.037156
0.035906
1.034808
[ "s404613409", "s748118580" ]
u227020436
p03287
python
s702919501
s788623414
144
86
21,952
14,228
Accepted
Accepted
40.28
N, M = [int(t) for t in input().split()] a = [int(t) for t in input().split()] assert len(a) == N def prefixsum(a): s = [0] * len(a) s[0] = a[0] % M for i in range(1, len(a)): s[i] = (s[i-1] + a[i]) % M return s s = prefixsum(a) t = [(s[i], i) for i in range(N)] t.sort() cou...
# -*- coding: utf-8 -*- N, M = [int(t) for t in input().split()] A = [int(t) for t in input().split()] assert len(A) == N def prefixsum(A): '''S[i] == sum(A[:i]) % M かつ len(S) == len(A) + 1 であるSを返す.''' S = [0] for a in A: S.append((S[-1] + a) % M) return S def eqlen(S): '...
29
29
544
600
N, M = [int(t) for t in input().split()] a = [int(t) for t in input().split()] assert len(a) == N def prefixsum(a): s = [0] * len(a) s[0] = a[0] % M for i in range(1, len(a)): s[i] = (s[i - 1] + a[i]) % M return s s = prefixsum(a) t = [(s[i], i) for i in range(N)] t.sort() count = 0 prev = -...
# -*- coding: utf-8 -*- N, M = [int(t) for t in input().split()] A = [int(t) for t in input().split()] assert len(A) == N def prefixsum(A): """S[i] == sum(A[:i]) % M かつ len(S) == len(A) + 1 であるSを返す.""" S = [0] for a in A: S.append((S[-1] + a) % M) return S def eqlen(S): """Sは整列済みリスト. 等しい...
false
0
[ "+# -*- coding: utf-8 -*-", "-a = [int(t) for t in input().split()]", "-assert len(a) == N", "+A = [int(t) for t in input().split()]", "+assert len(A) == N", "-def prefixsum(a):", "- s = [0] * len(a)", "- s[0] = a[0] % M", "- for i in range(1, len(a)):", "- s[i] = (s[i - 1] + a[i])...
false
0.034625
0.036128
0.9584
[ "s702919501", "s788623414" ]
u279605379
p02297
python
s593854766
s825537588
30
20
7,716
7,728
Accepted
Accepted
33.33
x=list(range(int(eval(input())))) P=[] for _ in x:P+=[[int(i) for i in input().split()]] _=0 P+=[P[0]] for j in x:_+=P[j][0]*P[j+1][1]-P[j+1][0]*P[j][1] print((_*0.5))
x=list(range(int(eval(input())))) P=[] for _ in x:P+=[[int(i) for i in input().split()]] _=0 P+=[P[0]] for j in x:_+=P[j+1][1]*P[j][0]-P[j][1]*P[j+1][0] print((_*0.5))
7
7
159
159
x = list(range(int(eval(input())))) P = [] for _ in x: P += [[int(i) for i in input().split()]] _ = 0 P += [P[0]] for j in x: _ += P[j][0] * P[j + 1][1] - P[j + 1][0] * P[j][1] print((_ * 0.5))
x = list(range(int(eval(input())))) P = [] for _ in x: P += [[int(i) for i in input().split()]] _ = 0 P += [P[0]] for j in x: _ += P[j + 1][1] * P[j][0] - P[j][1] * P[j + 1][0] print((_ * 0.5))
false
0
[ "- _ += P[j][0] * P[j + 1][1] - P[j + 1][0] * P[j][1]", "+ _ += P[j + 1][1] * P[j][0] - P[j][1] * P[j + 1][0]" ]
false
0.107943
0.074187
1.455021
[ "s593854766", "s825537588" ]
u021019433
p02837
python
s005871850
s896055358
368
61
58,204
3,064
Accepted
Accepted
83.42
from itertools import combinations, count n = int(eval(input())) r = list(range(n)) a = [(set(), set()) for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y].add(x - 1) r = next(i for i in count(n, - 1) for x in map(set, combinations(r, i)) ...
from itertools import combinations, count n = int(eval(input())) r = list(range(n)) a = [(set(), set()) for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y].add(x - 1) r = next(i for i in count(n, - 1) for x in combinations(r, i) if al...
12
12
369
367
from itertools import combinations, count n = int(eval(input())) r = list(range(n)) a = [(set(), set()) for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y].add(x - 1) r = next( i for i in count(n, -1) for x in map(set, combinations(...
from itertools import combinations, count n = int(eval(input())) r = list(range(n)) a = [(set(), set()) for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y].add(x - 1) r = next( i for i in count(n, -1) for x in combinations(r, i) ...
false
0
[ "- for x in map(set, combinations(r, i))", "- if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x)", "+ for x in combinations(r, i)", "+ if all(a[j][0].isdisjoint(x) and a[j][1].issubset(x) for j in x)" ]
false
0.035536
0.035606
0.998021
[ "s005871850", "s896055358" ]
u347640436
p02948
python
s795358805
s013144451
427
213
26,072
26,020
Accepted
Accepted
50.12
from heapq import heappush, heappop n, m = list(map(int, input().split())) jobs = {} for _ in range(n): a, b = list(map(int, input().split())) if a > m: continue if a in jobs: jobs[a].append(b) else: jobs[a] = [b] result = 0 candidates = [] for a in range(1, m + 1): if a in jobs: ...
from sys import stdin def main(): from builtins import int, map, range readline = stdin.readline from heapq import heappush, heappop n, m = list(map(int, readline().split())) jobs = {} for _ in range(n): a, b = list(map(int, readline().split())) if a > m: continue if a in jobs: ...
22
27
464
627
from heapq import heappush, heappop n, m = list(map(int, input().split())) jobs = {} for _ in range(n): a, b = list(map(int, input().split())) if a > m: continue if a in jobs: jobs[a].append(b) else: jobs[a] = [b] result = 0 candidates = [] for a in range(1, m + 1): if a in ...
from sys import stdin def main(): from builtins import int, map, range readline = stdin.readline from heapq import heappush, heappop n, m = list(map(int, readline().split())) jobs = {} for _ in range(n): a, b = list(map(int, readline().split())) if a > m: continue...
false
18.518519
[ "-from heapq import heappush, heappop", "+from sys import stdin", "-n, m = list(map(int, input().split()))", "-jobs = {}", "-for _ in range(n):", "- a, b = list(map(int, input().split()))", "- if a > m:", "- continue", "- if a in jobs:", "- jobs[a].append(b)", "- else:"...
false
0.085254
0.045741
1.863842
[ "s795358805", "s013144451" ]
u603958124
p03061
python
s654525017
s386589828
1,691
114
22,144
22,252
Accepted
Accepted
93.26
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement from collections import deque,defaultdict,Counter from bisect import bisect_left,bisect_right from operator i...
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement from collections import deque,defaultdict,Counter from bisect import bisect_left,bisect_right from operator i...
102
40
2,862
1,245
from math import ( ceil, floor, factorial, gcd, sqrt, log2, cos, sin, tan, acos, asin, atan, degrees, radians, pi, inf, ) from itertools import ( accumulate, groupby, permutations, combinations, product, combinations_with_replacemen...
from math import ( ceil, floor, factorial, gcd, sqrt, log2, cos, sin, tan, acos, asin, atan, degrees, radians, pi, inf, ) from itertools import ( accumulate, groupby, permutations, combinations, product, combinations_with_replacemen...
false
60.784314
[ "-#####segfunc#####", "-def segfunc(x, y):", "- return gcd(x, y)", "-", "-", "-#################", "-#####ide_ele#####", "-ide_ele = 0", "-#################", "-class SegTree:", "- \"\"\"", "- init(init_val, ide_ele): 配列init_valで初期化 O(N)", "- update(k, x): k番目の値をxに更新 O(logN)", ...
false
0.063152
0.037024
1.705721
[ "s654525017", "s386589828" ]
u611090896
p04001
python
s527298496
s941339888
38
34
9,144
9,064
Accepted
Accepted
10.53
S = eval(input()) res_list = [] for i in range(2**(len(S)-1)): temp_s = '' for j in range(len(S)): temp_s += S[j] if ((i >> j) & 1): temp_s += '+' # print(temp_s) res_list.append(temp_s) temp_S_list = [eval(item) for item in res_list] print((sum(temp_S_list...
s = eval(input()) n = len(s)-1 total=0 for i in range(2**n): pl=['']*n ans='' for j in range(n): if ((i>>j)&1): pl[n-1-j] = '+' for k in range(n): ans += s[k]+pl[k] ans+=s[-1] total += eval(ans) print(total)
16
15
315
243
S = eval(input()) res_list = [] for i in range(2 ** (len(S) - 1)): temp_s = "" for j in range(len(S)): temp_s += S[j] if (i >> j) & 1: temp_s += "+" # print(temp_s) res_list.append(temp_s) temp_S_list = [eval(item) for item in res_list] print((sum(temp_S_list)))
s = eval(input()) n = len(s) - 1 total = 0 for i in range(2**n): pl = [""] * n ans = "" for j in range(n): if (i >> j) & 1: pl[n - 1 - j] = "+" for k in range(n): ans += s[k] + pl[k] ans += s[-1] total += eval(ans) print(total)
false
6.25
[ "-S = eval(input())", "-res_list = []", "-for i in range(2 ** (len(S) - 1)):", "- temp_s = \"\"", "- for j in range(len(S)):", "- temp_s += S[j]", "+s = eval(input())", "+n = len(s) - 1", "+total = 0", "+for i in range(2**n):", "+ pl = [\"\"] * n", "+ ans = \"\"", "+ fo...
false
0.039894
0.040716
0.97982
[ "s527298496", "s941339888" ]
u209619667
p03243
python
s686421110
s181943005
19
17
3,060
2,940
Accepted
Accepted
10.53
A = int(eval(input())) if A <=111: print((111)) elif A<= 222: print((222)) elif A <= 333: print((333)) elif A <= 444: print((444)) elif A <= 555: print((555)) elif A <=666: print((666)) elif A <= 777: print((777)) elif A <= 888: print((888)) elif A <=999: print((999))
A = int(eval(input())) B = int(A / 111) C = A % 111 == 0 if not C: B = (B+1) * 111 print(B) else: B = B*111 print(B)
19
9
280
126
A = int(eval(input())) if A <= 111: print((111)) elif A <= 222: print((222)) elif A <= 333: print((333)) elif A <= 444: print((444)) elif A <= 555: print((555)) elif A <= 666: print((666)) elif A <= 777: print((777)) elif A <= 888: print((888)) elif A <= 999: print((999))
A = int(eval(input())) B = int(A / 111) C = A % 111 == 0 if not C: B = (B + 1) * 111 print(B) else: B = B * 111 print(B)
false
52.631579
[ "-if A <= 111:", "- print((111))", "-elif A <= 222:", "- print((222))", "-elif A <= 333:", "- print((333))", "-elif A <= 444:", "- print((444))", "-elif A <= 555:", "- print((555))", "-elif A <= 666:", "- print((666))", "-elif A <= 777:", "- print((777))", "-elif A <...
false
0.049283
0.047665
1.033957
[ "s686421110", "s181943005" ]
u416011173
p02550
python
s756657052
s999216555
60
55
13,116
13,216
Accepted
Accepted
8.33
# -*- coding: utf-8 -*- # 標準入力を取得 N, X, M = list(map(int, input().split())) # 求解処理 def f(x: int, m: int) -> int: return x**2 % m A = [X] s = {X} i = 0 while True: A_next = f(A[-1], M) if A_next in s: i = A.index(A_next) break else: A.append(A_next) ...
# -*- coding: utf-8 -*- def get_input() -> tuple: """ 標準入力を取得する. Returns:\n tuple: 標準入力 """ # 標準入力を取得 N, X, M = list(map(int, input().split())) return N, X, M def f(x: int, m: int) -> int: """ xをmで割った余りを返す. Args:\n x (int): 整数 m ...
30
66
524
1,182
# -*- coding: utf-8 -*- # 標準入力を取得 N, X, M = list(map(int, input().split())) # 求解処理 def f(x: int, m: int) -> int: return x**2 % m A = [X] s = {X} i = 0 while True: A_next = f(A[-1], M) if A_next in s: i = A.index(A_next) break else: A.append(A_next) s.add(A_next) loop_le...
# -*- coding: utf-8 -*- def get_input() -> tuple: """ 標準入力を取得する. Returns:\n tuple: 標準入力 """ # 標準入力を取得 N, X, M = list(map(int, input().split())) return N, X, M def f(x: int, m: int) -> int: """ xをmで割った余りを返す. Args:\n x (int): 整数 m (int): 整数 Returns:\n ...
false
54.545455
[ "-# 標準入力を取得", "-N, X, M = list(map(int, input().split()))", "-# 求解処理", "-def f(x: int, m: int) -> int:", "- return x**2 % m", "+def get_input() -> tuple:", "+ \"\"\"", "+ 標準入力を取得する.", "+ Returns:\\n", "+ tuple: 標準入力", "+ \"\"\"", "+ # 標準入力を取得", "+ N, X, M = list(m...
false
0.007808
0.036262
0.215314
[ "s756657052", "s999216555" ]
u389910364
p03323
python
s460880855
s285521819
23
17
3,572
3,060
Accepted
Accepted
26.09
import functools import os INF = float('inf') def inp(): return int(input()) def inpf(): return float(input()) def inps(): return input() def inl(): return list(map(int, input().split())) def inlf(): return list(map(float, input().split())) def inls(): r...
import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 A, B = list(map(int, sys.stdin.buffer.readline().split())) ok = A <= 8 and B <= 8 if ok: print('Yay!') else: ...
53
20
883
336
import functools import os INF = float("inf") def inp(): return int(input()) def inpf(): return float(input()) def inps(): return input() def inl(): return list(map(int, input().split())) def inlf(): return list(map(float, input().split())) def inls(): return input().split() def d...
import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10**9) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 # MOD = 998244353 A, B = list(map(int, sys.stdin.buffer.readline().split())) ok = A <= 8 and B <= 8 if ok: print("Yay!") else: print(":(")
false
62.264151
[ "-import functools", "+import sys", "+if os.getenv(\"LOCAL\"):", "+ sys.stdin = open(\"_in.txt\", \"r\")", "+sys.setrecursionlimit(10**9)", "-", "-", "-def inp():", "- return int(input())", "-", "-", "-def inpf():", "- return float(input())", "-", "-", "-def inps():", "- ...
false
0.039833
0.044131
0.902612
[ "s460880855", "s285521819" ]
u125545880
p02936
python
s266221853
s872286135
1,990
1,182
236,924
62,576
Accepted
Accepted
40.6
# 深さ優先探索の問題 import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline N, Q = list(map(int, input().split())) # 隣接リスト t = [[] for _ in range(N)] for _ in range(N-1): a, b = [int(i) for i in readline().split()] t[a-1].append(b-1) t[b-1].append(a-1) # スコア s = [0] * N for _ in r...
# 深さ優先探索の問題 import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline N, Q = list(map(int, input().split())) # 隣接リスト t = [[] for _ in range(N)] for _ in range(N-1): a, b = [int(i) for i in readline().split()] t[a-1].append(b-1) t[b-1].append(a-1) # スコア score = [0] * N for _ ...
37
39
653
752
# 深さ優先探索の問題 import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline N, Q = list(map(int, input().split())) # 隣接リスト t = [[] for _ in range(N)] for _ in range(N - 1): a, b = [int(i) for i in readline().split()] t[a - 1].append(b - 1) t[b - 1].append(a - 1) # スコア s = [0] * N for _ in range(Q): ...
# 深さ優先探索の問題 import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline N, Q = list(map(int, input().split())) # 隣接リスト t = [[] for _ in range(N)] for _ in range(N - 1): a, b = [int(i) for i in readline().split()] t[a - 1].append(b - 1) t[b - 1].append(a - 1) # スコア score = [0] * N for _ in range(Q...
false
5.128205
[ "-s = [0] * N", "+score = [0] * N", "- s[p - 1] += x", "+ score[p - 1] += x", "-# 深さ優先探索", "-def dfs(v, p, value):", "- # value = value + s[v]", "- value += s[v]", "- ans[v] = value", "- for c in t[v]:", "- if c == p:", "- continue", "- dfs(c, v, va...
false
0.037349
0.036282
1.029389
[ "s266221853", "s872286135" ]
u440566786
p03329
python
s322854180
s880658447
636
233
69,464
41,068
Accepted
Accepted
63.36
def nsin(X,n): if(int(X/n)): return nsin(int(X/n),n)+str(X%n) return str(X) N = int(eval(input())) score = N for i in range(N+1): score = min(score,sum(map(int,nsin(i,6)+nsin(N-i,9)))) print(score)
N = int(eval(input())) score = N for i in range(N+1): count = 0 t = i while(t): count += t%6 t//=6 t = N-i while(t): count += t%9 t//=9 score = min(count,score) print(score)
10
16
221
240
def nsin(X, n): if int(X / n): return nsin(int(X / n), n) + str(X % n) return str(X) N = int(eval(input())) score = N for i in range(N + 1): score = min(score, sum(map(int, nsin(i, 6) + nsin(N - i, 9)))) print(score)
N = int(eval(input())) score = N for i in range(N + 1): count = 0 t = i while t: count += t % 6 t //= 6 t = N - i while t: count += t % 9 t //= 9 score = min(count, score) print(score)
false
37.5
[ "-def nsin(X, n):", "- if int(X / n):", "- return nsin(int(X / n), n) + str(X % n)", "- return str(X)", "-", "-", "- score = min(score, sum(map(int, nsin(i, 6) + nsin(N - i, 9))))", "+ count = 0", "+ t = i", "+ while t:", "+ count += t % 6", "+ t //= 6", ...
false
0.146654
0.061597
2.380865
[ "s322854180", "s880658447" ]
u022215787
p03971
python
s900242367
s550592751
99
71
4,016
9,680
Accepted
Accepted
28.28
n, a, b = list(map(int, input().split())) s_l = eval(input()) ca = 0 cb = 0 for s in s_l: if s == 'a' and ca + cb < a+b: ca += 1 print('Yes') elif s == 'b' and ca + cb < a+b and cb < b: cb += 1 print('Yes') else: print('No')
n, a, b = list(map(int, input().split())) s = eval(input()) jap_c = 0 ab_c = 0 for i in list(s): if i == 'a': if jap_c + ab_c < a+b: jap_c += 1 print('Yes') continue if i == 'b': if jap_c + ab_c < a+b: if ab_c < b: ab_c...
13
17
251
386
n, a, b = list(map(int, input().split())) s_l = eval(input()) ca = 0 cb = 0 for s in s_l: if s == "a" and ca + cb < a + b: ca += 1 print("Yes") elif s == "b" and ca + cb < a + b and cb < b: cb += 1 print("Yes") else: print("No")
n, a, b = list(map(int, input().split())) s = eval(input()) jap_c = 0 ab_c = 0 for i in list(s): if i == "a": if jap_c + ab_c < a + b: jap_c += 1 print("Yes") continue if i == "b": if jap_c + ab_c < a + b: if ab_c < b: ab_c += 1 ...
false
23.529412
[ "-s_l = eval(input())", "-ca = 0", "-cb = 0", "-for s in s_l:", "- if s == \"a\" and ca + cb < a + b:", "- ca += 1", "- print(\"Yes\")", "- elif s == \"b\" and ca + cb < a + b and cb < b:", "- cb += 1", "- print(\"Yes\")", "- else:", "- print(\"No\")...
false
0.036826
0.035562
1.03555
[ "s900242367", "s550592751" ]
u717993780
p03556
python
s886269002
s805739668
55
27
2,940
2,940
Accepted
Accepted
50.91
import math n = int(eval(input())) for i in reversed(list(range(n+1))): if math.sqrt(i) - math.floor(math.sqrt(i)) == 0: print(i) exit()
n = int(eval(input())) for i in range(n+2): if i**2 > n: print(((i-1)**2)) exit()
6
5
139
87
import math n = int(eval(input())) for i in reversed(list(range(n + 1))): if math.sqrt(i) - math.floor(math.sqrt(i)) == 0: print(i) exit()
n = int(eval(input())) for i in range(n + 2): if i**2 > n: print(((i - 1) ** 2)) exit()
false
16.666667
[ "-import math", "-", "-for i in reversed(list(range(n + 1))):", "- if math.sqrt(i) - math.floor(math.sqrt(i)) == 0:", "- print(i)", "+for i in range(n + 2):", "+ if i**2 > n:", "+ print(((i - 1) ** 2))" ]
false
0.05578
0.083668
0.666684
[ "s886269002", "s805739668" ]
u926412290
p03167
python
s936545985
s013260996
167
97
86,624
71,988
Accepted
Accepted
41.92
from collections import deque MOD = 10**9 + 7 H, W = list(map(int, input().split())) G = [eval(input()) for _ in range(H)] def main(): dp = [[0] * W for _ in range(H)] for i in range(H): if G[i][0] == '#': break dp[i][0] = 1 for i in range(W): if G[0][i] ...
MOD = 10**9 + 7 H, W = list(map(int, input().split())) G = [eval(input()) for _ in range(H)] dp = [[0] * W for _ in range(H)] for i in range(H): if G[i][0] == '#': break dp[i][0] = 1 for i in range(W): if G[0][i] == '#': break dp[0][i] = 1 for i in range(1, H): for...
40
23
943
482
from collections import deque MOD = 10**9 + 7 H, W = list(map(int, input().split())) G = [eval(input()) for _ in range(H)] def main(): dp = [[0] * W for _ in range(H)] for i in range(H): if G[i][0] == "#": break dp[i][0] = 1 for i in range(W): if G[0][i] == "#": ...
MOD = 10**9 + 7 H, W = list(map(int, input().split())) G = [eval(input()) for _ in range(H)] dp = [[0] * W for _ in range(H)] for i in range(H): if G[i][0] == "#": break dp[i][0] = 1 for i in range(W): if G[0][i] == "#": break dp[0][i] = 1 for i in range(1, H): for j in range(1, W): ...
false
42.5
[ "-from collections import deque", "-", "-", "-", "-def main():", "- dp = [[0] * W for _ in range(H)]", "- for i in range(H):", "- if G[i][0] == \"#\":", "- break", "- dp[i][0] = 1", "- for i in range(W):", "- if G[0][i] == \"#\":", "- break...
false
0.042104
0.08075
0.521405
[ "s936545985", "s013260996" ]
u351892848
p03037
python
s306442806
s369535745
322
199
3,060
16,620
Accepted
Accepted
38.2
N, M = list(map(int, input().split())) left = 1 right = N for i in range(M): L, R = list(map(int, input().split())) left = max(left, L) right = min(right, R) print((max(right - left + 1, 0)))
N, M = list(map(int, input().split())) L = [None] * M R = [None] * M for i in range(M): l, r = list(map(int, input().split())) L[i] = l R[i] = r L_max = max(L) R_min = min(R) if L_max > R_min: print((0)) else: print((R_min - L_max + 1))
11
17
202
261
N, M = list(map(int, input().split())) left = 1 right = N for i in range(M): L, R = list(map(int, input().split())) left = max(left, L) right = min(right, R) print((max(right - left + 1, 0)))
N, M = list(map(int, input().split())) L = [None] * M R = [None] * M for i in range(M): l, r = list(map(int, input().split())) L[i] = l R[i] = r L_max = max(L) R_min = min(R) if L_max > R_min: print((0)) else: print((R_min - L_max + 1))
false
35.294118
[ "-left = 1", "-right = N", "+L = [None] * M", "+R = [None] * M", "- L, R = list(map(int, input().split()))", "- left = max(left, L)", "- right = min(right, R)", "-print((max(right - left + 1, 0)))", "+ l, r = list(map(int, input().split()))", "+ L[i] = l", "+ R[i] = r", "+L_m...
false
0.118536
0.074997
1.580545
[ "s306442806", "s369535745" ]
u276115223
p03970
python
s062142051
s086850537
20
17
3,060
2,940
Accepted
Accepted
15
# CODE FESTIVAL 2016 予選 B: A – Signboard s = eval(input()) s_correct = 'CODEFESTIVAL2016' iterations = 0 for i in range(len(s)): if s[i] != s_correct[i]: iterations += 1 print(iterations)
# CODE FESTIVAL 2016 予選 B: A – Signboard expects = 'CODEFESTIVAL2016' s = eval(input()) count = 0 for a, b in zip(expects, s): if a != b: count += 1 print(count)
11
11
206
180
# CODE FESTIVAL 2016 予選 B: A – Signboard s = eval(input()) s_correct = "CODEFESTIVAL2016" iterations = 0 for i in range(len(s)): if s[i] != s_correct[i]: iterations += 1 print(iterations)
# CODE FESTIVAL 2016 予選 B: A – Signboard expects = "CODEFESTIVAL2016" s = eval(input()) count = 0 for a, b in zip(expects, s): if a != b: count += 1 print(count)
false
0
[ "+expects = \"CODEFESTIVAL2016\"", "-s_correct = \"CODEFESTIVAL2016\"", "-iterations = 0", "-for i in range(len(s)):", "- if s[i] != s_correct[i]:", "- iterations += 1", "-print(iterations)", "+count = 0", "+for a, b in zip(expects, s):", "+ if a != b:", "+ count += 1", "+p...
false
0.047814
0.047576
1.005002
[ "s062142051", "s086850537" ]
u875291233
p03608
python
s540647052
s933046782
551
428
66,904
56,408
Accepted
Accepted
22.32
# coding: utf-8 # Your code here! from heapq import heappush, heappop def dijkstra(g,start): #g: 隣接リスト inf = float("inf") dist = [inf]*(len(g)) q = [(start,0)] #(点、そこまでの距離) dist[start] = 0 while q: v,c = heappop(q) if dist[v] < c: continue for to, cost in g[v]: ...
# coding: utf-8 # Your code here! """ Dijkstra法: 単一始点最短路(距離が正) g: g[i] = [(子、距離),...]の隣接リスト start: 始点 """ from heapq import heappush, heappop def dijkstra(g,start): #g: 隣接リスト dist = [1e18]*(len(g)) #初期化 q = [(0,start)] #(そこまでの距離、点) dist[start] = 0 pending = len(g)-1 while q and pend...
59
66
1,099
1,218
# coding: utf-8 # Your code here! from heapq import heappush, heappop def dijkstra(g, start): # g: 隣接リスト inf = float("inf") dist = [inf] * (len(g)) q = [(start, 0)] # (点、そこまでの距離) dist[start] = 0 while q: v, c = heappop(q) if dist[v] < c: continue for to, cost ...
# coding: utf-8 # Your code here! """ Dijkstra法: 単一始点最短路(距離が正) g: g[i] = [(子、距離),...]の隣接リスト start: 始点 """ from heapq import heappush, heappop def dijkstra(g, start): # g: 隣接リスト dist = [1e18] * (len(g)) # 初期化 q = [(0, start)] # (そこまでの距離、点) dist[start] = 0 pending = len(g) - 1 while q and pending...
false
10.606061
[ "+\"\"\"", "+Dijkstra法: 単一始点最短路(距離が正)", "+g: g[i] = [(子、距離),...]の隣接リスト", "+start: 始点", "+\"\"\"", "- inf = float(\"inf\")", "- dist = [inf] * (len(g))", "- q = [(start, 0)] # (点、そこまでの距離)", "+ dist = [1e18] * (len(g)) # 初期化", "+ q = [(0, start)] # (そこまでの距離、点)", "- while q:", ...
false
0.007754
0.032872
0.235888
[ "s540647052", "s933046782" ]
u042802884
p02863
python
s673089105
s186685662
1,267
589
197,252
123,864
Accepted
Accepted
53.51
N,T=list(map(int,input().split())) x=[None] # x[0] for i in range(1,N+1): # x[i]のiに対応させる x.append(tuple(map(int,input().split()))) # x[1]~x[N] # print(x) #DB★ dp1=[[0 for j in range(T)] for i in range(N+2)] # 0~N+1 dp1[i]はx[1]からx[i]まで使用(dp1[0]は使用するx[i]なしの初期値,dp1[N+1]は余り→0で初期化していることが後で役に立つ) for i in range(1,...
N,T=list(map(int,input().split())) x=[(0,0)] # x[0] for i in range(1,N+1): # x[i]のiに対応させる x.append(tuple(map(int,input().split()))) # x[1]~x[N] x.sort() # print(x) #DB★ dp1=[[0 for j in range(T)] for i in range(N+2)] # 0~N+1 dp1[i]はx[1]からx[i]まで使用(dp1[0]は使用するx[i]なしの初期値,dp1[N+1]は余り→0で初期化していることが後で役に立つ) for ...
35
23
1,199
686
N, T = list(map(int, input().split())) x = [None] # x[0] for i in range(1, N + 1): # x[i]のiに対応させる x.append(tuple(map(int, input().split()))) # x[1]~x[N] # print(x) #DB★ dp1 = [ [0 for j in range(T)] for i in range(N + 2) ] # 0~N+1 dp1[i]はx[1]からx[i]まで使用(dp1[0]は使用するx[i]なしの初期値,dp1[N+1]は余り→0で初期化していることが後で役に立つ) f...
N, T = list(map(int, input().split())) x = [(0, 0)] # x[0] for i in range(1, N + 1): # x[i]のiに対応させる x.append(tuple(map(int, input().split()))) # x[1]~x[N] x.sort() # print(x) #DB★ dp1 = [ [0 for j in range(T)] for i in range(N + 2) ] # 0~N+1 dp1[i]はx[1]からx[i]まで使用(dp1[0]は使用するx[i]なしの初期値,dp1[N+1]は余り→0で初期化しているこ...
false
34.285714
[ "-x = [None] # x[0]", "+x = [(0, 0)] # x[0]", "+x.sort()", "-# print(dp1) #DB★", "-dp2 = [", "- [0 for j in range(T)] for i in range(N + 2)", "-] # 0~N+1 dp2[i]はx[i]からx[N]まで(x[N]からx[i]まで)使用(dp2[N+1]は使用するx[i]なしの初期値,dp2[0]は余り)", "-for i in range(N, 0, -1): # dp2[N+1]は初期値なのでいじらない。dp2[0]は余りなので計算しない...
false
0.036634
0.082306
0.445094
[ "s673089105", "s186685662" ]
u191829404
p03329
python
s908277606
s821803339
249
221
47,472
47,344
Accepted
Accepted
11.24
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0 # abcde s=input() s='abcde' # abcde s=list(input()) s=['a', 'b', 'c', 'd', 'e'] # 5(1つだけ) a=int(input()) a=5 # 1 2 | x,y = s_inpl() | x=1,y=2 # 1 2 3 4 5 ... n   li = input().split() li=['1','2','3',...,'n'] # 1 2 3 4 5 ... n   li = inpl() li=[1,2,3,4,5,....
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0 # abcde s=input() s='abcde' # abcde s=list(input()) s=['a', 'b', 'c', 'd', 'e'] # 5(1つだけ) a=int(input()) a=5 # 1 2 | x,y = s_inpl() | x=1,y=2 # 1 2 3 4 5 ... n   li = input().split() li=['1','2','3',...,'n'] # 1 2 3 4 5 ... n   li = inpl() li=[1,2,3,4,5,....
53
53
1,436
1,436
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0 # abcde s=input() s='abcde' # abcde s=list(input()) s=['a', 'b', 'c', 'd', 'e'] # 5(1つだけ) a=int(input()) a=5 # 1 2 | x,y = s_inpl() | x=1,y=2 # 1 2 3 4 5 ... n   li = input().split() li=['1','2','3',...,'n'] # 1 2 3 4 5 ... n   li = inpl() li=[1,2,3,4,5,...,n] ...
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0 # abcde s=input() s='abcde' # abcde s=list(input()) s=['a', 'b', 'c', 'd', 'e'] # 5(1つだけ) a=int(input()) a=5 # 1 2 | x,y = s_inpl() | x=1,y=2 # 1 2 3 4 5 ... n   li = input().split() li=['1','2','3',...,'n'] # 1 2 3 4 5 ... n   li = inpl() li=[1,2,3,4,5,...,n] ...
false
0
[ "- while power <= N:", "+ while power <= i:", "- while power <= N:", "+ while power <= i:" ]
false
0.181483
0.00621
29.223529
[ "s908277606", "s821803339" ]
u411203878
p03038
python
s769689022
s077884883
782
400
91,288
100,776
Accepted
Accepted
48.85
n,m = list(map(int,input().split())) a = list(map(int,input().split())) bc = [] for _ in range(m): b, c = (int(x) for x in input().split()) bc.append([b,c]) bc = sorted(bc, key=lambda x: -x[1]) memo = [] limit = 0 for i in range(m): a += [bc[i][1]]*bc[i][0] limit += bc[i][0] ...
import heapq n,m = list(map(int,input().split())) a = list(map(int,input().split())) bc = [] for _ in range(m): b, c = (int(x) for x in input().split()) bc.append([b, c]) bc = sorted(bc, key=lambda x: -x[1]) heapq.heapify(a) for i in range(m): count = 0 if bc[i][1] < a[0]: br...
24
22
388
463
n, m = list(map(int, input().split())) a = list(map(int, input().split())) bc = [] for _ in range(m): b, c = (int(x) for x in input().split()) bc.append([b, c]) bc = sorted(bc, key=lambda x: -x[1]) memo = [] limit = 0 for i in range(m): a += [bc[i][1]] * bc[i][0] limit += bc[i][0] if limit >= n: ...
import heapq n, m = list(map(int, input().split())) a = list(map(int, input().split())) bc = [] for _ in range(m): b, c = (int(x) for x in input().split()) bc.append([b, c]) bc = sorted(bc, key=lambda x: -x[1]) heapq.heapify(a) for i in range(m): count = 0 if bc[i][1] < a[0]: break while a[...
false
8.333333
[ "+import heapq", "+", "-memo = []", "-limit = 0", "+heapq.heapify(a)", "- a += [bc[i][1]] * bc[i][0]", "- limit += bc[i][0]", "- if limit >= n:", "+ count = 0", "+ if bc[i][1] < a[0]:", "-a.sort(reverse=True)", "-print((sum(a[:n])))", "+ while a[0] < bc[i][1] and count < bc...
false
0.073519
0.074688
0.984349
[ "s769689022", "s077884883" ]
u996731299
p02761
python
s862454843
s004135139
21
17
3,064
3,064
Accepted
Accepted
19.05
N,M=list(map(int,input().split())) if M!=0: a=[list(map(int,input().split())) for i in range(M)] ans=0 for i in range(M): if ans==-1: break for j in range(M): if a[i][0]==a[j][0] and a[i][1]!=a[j][1]: ans=-1 break #print(ans)...
N,M=list(map(int,input().split())) num=[list(map(int,input().split())) for i in range(M)] ans=[-1]*N check=True for i in range(M): if ans[num[i][0]-1]==-1: ans[num[i][0]-1]=num[i][1] elif ans[num[i][0]-1]!=num[i][1]: check=False break if ans[0]==-1 and N>1: ans[0]=1 elif ...
34
27
777
588
N, M = list(map(int, input().split())) if M != 0: a = [list(map(int, input().split())) for i in range(M)] ans = 0 for i in range(M): if ans == -1: break for j in range(M): if a[i][0] == a[j][0] and a[i][1] != a[j][1]: ans = -1 break ...
N, M = list(map(int, input().split())) num = [list(map(int, input().split())) for i in range(M)] ans = [-1] * N check = True for i in range(M): if ans[num[i][0] - 1] == -1: ans[num[i][0] - 1] = num[i][1] elif ans[num[i][0] - 1] != num[i][1]: check = False break if ans[0] == -1 and N > 1:...
false
20.588235
[ "-if M != 0:", "- a = [list(map(int, input().split())) for i in range(M)]", "- ans = 0", "- for i in range(M):", "- if ans == -1:", "- break", "- for j in range(M):", "- if a[i][0] == a[j][0] and a[i][1] != a[j][1]:", "- ans = -1", "- ...
false
0.082085
0.037417
2.19378
[ "s862454843", "s004135139" ]
u193264896
p03557
python
s599451316
s076583619
562
335
118,496
21,580
Accepted
Accepted
40.39
from collections import deque from collections import Counter from itertools import product, permutations,combinations from operator import itemgetter from heapq import heappop, heappush from bisect import bisect_left, bisect_right, bisect #from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra,...
import sys from bisect import bisect_right, bisect_left from functools import reduce readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) ...
34
30
1,002
741
from collections import deque from collections import Counter from itertools import product, permutations, combinations from operator import itemgetter from heapq import heappop, heappush from bisect import bisect_left, bisect_right, bisect # from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, be...
import sys from bisect import bisect_right, bisect_left from functools import reduce readline = sys.stdin.buffer.readline sys.setrecursionlimit(10**8) INF = float("inf") MOD = 10**9 + 7 def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) def main(): ...
false
11.764706
[ "-from collections import deque", "-from collections import Counter", "-from itertools import product, permutations, combinations", "-from operator import itemgetter", "-from heapq import heappop, heappush", "-from bisect import bisect_left, bisect_right, bisect", "+import sys", "+from bisect import b...
false
0.039864
0.058602
0.680245
[ "s599451316", "s076583619" ]
u196579381
p03044
python
s597475850
s310693673
1,295
972
105,244
101,020
Accepted
Accepted
24.94
import queue N = int(eval(input())) alist = [[] for _ in range(N+1)] d = {} q = queue.Queue() for _ in range(N-1): u, v, w = list(map(int, input().split())) alist[u].append(v) alist[v].append(u) d[(u, v)] = w % 2 q.put(1) d[(1, 1)] = 0 seen = [False]*(N+1) seen[1] = True while not q....
import queue import sys input = sys.stdin.readline N = int(eval(input())) alist = [[] for _ in range(N+1)] d = {} q = queue.Queue() for _ in range(N-1): u, v, w = list(map(int, input().split())) alist[u].append(v) alist[v].append(u) d[(u, v)] = w q.put(1) d[(1, 1)] = 0 seen = [False]...
27
30
546
582
import queue N = int(eval(input())) alist = [[] for _ in range(N + 1)] d = {} q = queue.Queue() for _ in range(N - 1): u, v, w = list(map(int, input().split())) alist[u].append(v) alist[v].append(u) d[(u, v)] = w % 2 q.put(1) d[(1, 1)] = 0 seen = [False] * (N + 1) seen[1] = True while not q.empty(): ...
import queue import sys input = sys.stdin.readline N = int(eval(input())) alist = [[] for _ in range(N + 1)] d = {} q = queue.Queue() for _ in range(N - 1): u, v, w = list(map(int, input().split())) alist[u].append(v) alist[v].append(u) d[(u, v)] = w q.put(1) d[(1, 1)] = 0 seen = [False] * (N + 1) seen...
false
10
[ "+import sys", "+input = sys.stdin.readline", "- d[(u, v)] = w % 2", "+ d[(u, v)] = w", "- d[(1, n)] = (d[1, s] + d[tuple(sorted([s, n]))]) % 2", "+ d[(1, n)] = d[1, s] + d[tuple(sorted([s, n]))]", "- print((d[(1, i)]))", "+ print((d[(1, i)] % 2))" ]
false
0.073153
0.049995
1.463208
[ "s597475850", "s310693673" ]
u608088992
p03821
python
s615706375
s434637723
395
187
21,156
21,108
Accepted
Accepted
52.66
N = int(eval(input())) AB = [[int(i) for i in input().split()] for j in range(N)] ans = 0 for i in reversed(list(range(N))): Atemp = AB[i][0] + ans ans += (0 if Atemp%AB[i][1] == 0 else AB[i][1]-Atemp%AB[i][1]) print(ans)
import sys def solve(): input = sys.stdin.readline N = int(eval(input())) array = [[int(a) for a in input().split()] for _ in range(N)] count = 0 for i in reversed(list(range(N))): a, b = array[i] if (a + count) % b == 0: continue else: count += b - ((a + count) %...
8
17
225
388
N = int(eval(input())) AB = [[int(i) for i in input().split()] for j in range(N)] ans = 0 for i in reversed(list(range(N))): Atemp = AB[i][0] + ans ans += 0 if Atemp % AB[i][1] == 0 else AB[i][1] - Atemp % AB[i][1] print(ans)
import sys def solve(): input = sys.stdin.readline N = int(eval(input())) array = [[int(a) for a in input().split()] for _ in range(N)] count = 0 for i in reversed(list(range(N))): a, b = array[i] if (a + count) % b == 0: continue else: count += b - ...
false
52.941176
[ "-N = int(eval(input()))", "-AB = [[int(i) for i in input().split()] for j in range(N)]", "-ans = 0", "-for i in reversed(list(range(N))):", "- Atemp = AB[i][0] + ans", "- ans += 0 if Atemp % AB[i][1] == 0 else AB[i][1] - Atemp % AB[i][1]", "-print(ans)", "+import sys", "+", "+", "+def sol...
false
0.077993
0.044687
1.745306
[ "s615706375", "s434637723" ]
u214561383
p02899
python
s704380298
s401354803
169
86
13,880
18,372
Accepted
Accepted
49.11
n = int(input()) a = list(map(int, input().split())) ans = [0] * n i = 1 for j in a: ans[j-1] = i i += 1 for i in ans: print(i, end=" ")
n = int(eval(input())) a = list(map(int, input().split())) ans = [0] * n i = 1 for j in a: ans[j-1] = i i += 1 print((' '.join(map(str, ans))))
9
8
156
150
n = int(input()) a = list(map(int, input().split())) ans = [0] * n i = 1 for j in a: ans[j - 1] = i i += 1 for i in ans: print(i, end=" ")
n = int(eval(input())) a = list(map(int, input().split())) ans = [0] * n i = 1 for j in a: ans[j - 1] = i i += 1 print((" ".join(map(str, ans))))
false
11.111111
[ "-n = int(input())", "+n = int(eval(input()))", "-for i in ans:", "- print(i, end=\" \")", "+print((\" \".join(map(str, ans))))" ]
false
0.035068
0.033614
1.043239
[ "s704380298", "s401354803" ]
u600402037
p02955
python
s049562396
s526474210
1,094
243
12,440
14,452
Accepted
Accepted
77.79
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) def make_divisors(n): # nの約数を列挙 divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i...
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) def make_divisors(n): # nの約数を列挙 divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i...
35
37
838
876
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) def make_divisors(n): # nの約数を列挙 divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: ...
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) def make_divisors(n): # nの約数を列挙 divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: ...
false
5.405405
[ "- if x > K or y > K:", "+ if x > K: # xは単調増加", "+ break", "+ if y > K:" ]
false
0.183142
0.182921
1.001207
[ "s049562396", "s526474210" ]
u855710796
p02632
python
s277619488
s251934233
2,000
1,382
214,456
217,252
Accepted
Accepted
30.9
K = int(eval(input())) S = eval(input()) mod = 10**9 + 7 class Combination: def __init__(self, n): self.facts = [1 for i in range(n+1)] self.invs = [1 for i in range(n+1)] for i in range(1, n+1): self.facts[i] = self.facts[i-1] * i % mod self.in...
K = int(eval(input())) S = eval(input()) mod = 10**9 + 7 class Combination: def __init__(self, n): self.facts = [1 for i in range(n+1)] self.invs = [1 for i in range(n+1)] for i in range(1, n+1): self.facts[i] = self.facts[i-1] * i % mod self.in...
38
44
916
1,051
K = int(eval(input())) S = eval(input()) mod = 10**9 + 7 class Combination: def __init__(self, n): self.facts = [1 for i in range(n + 1)] self.invs = [1 for i in range(n + 1)] for i in range(1, n + 1): self.facts[i] = self.facts[i - 1] * i % mod self.invs[i] = pow(s...
K = int(eval(input())) S = eval(input()) mod = 10**9 + 7 class Combination: def __init__(self, n): self.facts = [1 for i in range(n + 1)] self.invs = [1 for i in range(n + 1)] for i in range(1, n + 1): self.facts[i] = self.facts[i - 1] * i % mod self.invs[i] = pow(s...
false
13.636364
[ "+pow25 = [1] * (N + 1)", "+pow26 = [1] * (N + 1)", "+for i in range(1, N + 1):", "+ pow25[i] = (pow25[i - 1] * 25) % mod", "+ pow26[i] = (pow26[i - 1] * 26) % mod", "- ans", "- + comb.ncr(N - i - 1, len(S) - 1)", "- * pow(25, N - i - len(S), mod)", "- * pow(26, i, ...
false
0.038458
0.047301
0.813059
[ "s277619488", "s251934233" ]
u996672406
p02918
python
s017141146
s701839122
61
42
7,840
3,316
Accepted
Accepted
31.15
def mapping(string): return 1 if string == "L" else -1 n, k = list(map(int, input().split())) s = list(map(mapping, eval(input()))) flips = [] for i in range(n - 1): if s[i] != s[i + 1]: flips.append(i + 1) print((min(n - 1, n - 1 - len(flips) + 2 * k)))
n, k = list(map(int, input().split())) s = eval(input()) flips = 0 for i in range(n - 1): if s[i] != s[i + 1]: flips += 1 print((min(n - 1, n - 1 - flips + 2 * k)))
13
9
273
173
def mapping(string): return 1 if string == "L" else -1 n, k = list(map(int, input().split())) s = list(map(mapping, eval(input()))) flips = [] for i in range(n - 1): if s[i] != s[i + 1]: flips.append(i + 1) print((min(n - 1, n - 1 - len(flips) + 2 * k)))
n, k = list(map(int, input().split())) s = eval(input()) flips = 0 for i in range(n - 1): if s[i] != s[i + 1]: flips += 1 print((min(n - 1, n - 1 - flips + 2 * k)))
false
30.769231
[ "-def mapping(string):", "- return 1 if string == \"L\" else -1", "-", "-", "-s = list(map(mapping, eval(input())))", "-flips = []", "+s = eval(input())", "+flips = 0", "- flips.append(i + 1)", "-print((min(n - 1, n - 1 - len(flips) + 2 * k)))", "+ flips += 1", "+print((min(n ...
false
0.103388
0.070769
1.460917
[ "s017141146", "s701839122" ]
u218834617
p03338
python
s406572412
s429933314
32
29
9,216
9,112
Accepted
Accepted
9.38
from collections import Counter N=int(eval(input())) S=eval(input()) ans=0 X=Counter() Y=Counter(S) for c in S: Y[c]-=1 if Y[c]==0: del X[c] else: X[c]+=1 ans=max(ans,len(X)) print(ans)
N=int(eval(input())) S=eval(input()) ans=0 for i in range(1,N-1): a=[0]*26 for j in range(i): a[ord(S[j])-97]|=1 for j in range(i,N): a[ord(S[j])-97]|=2 ans=max(ans,a.count(3)) print(ans)
18
13
234
222
from collections import Counter N = int(eval(input())) S = eval(input()) ans = 0 X = Counter() Y = Counter(S) for c in S: Y[c] -= 1 if Y[c] == 0: del X[c] else: X[c] += 1 ans = max(ans, len(X)) print(ans)
N = int(eval(input())) S = eval(input()) ans = 0 for i in range(1, N - 1): a = [0] * 26 for j in range(i): a[ord(S[j]) - 97] |= 1 for j in range(i, N): a[ord(S[j]) - 97] |= 2 ans = max(ans, a.count(3)) print(ans)
false
27.777778
[ "-from collections import Counter", "-", "-X = Counter()", "-Y = Counter(S)", "-for c in S:", "- Y[c] -= 1", "- if Y[c] == 0:", "- del X[c]", "- else:", "- X[c] += 1", "- ans = max(ans, len(X))", "+for i in range(1, N - 1):", "+ a = [0] * 26", "+ for j in ra...
false
0.03984
0.0344
1.158148
[ "s406572412", "s429933314" ]
u883048396
p03309
python
s337545170
s816699629
324
198
25,708
25,708
Accepted
Accepted
38.89
def 解(): iN = int(eval(input())) aA = list(map(int,input().split())) aA = sorted(map(lambda x,y:x-y,aA,list(range(1,iN+1)))) iL = len(aA) if iL % 2 : iMed = aA[(iL-1)//2] else: iMed = aA[iL//2] iMean = sum(aA) // 2 iBlim= min(iMed,iMean) iUlim= min(iMed,iMe...
def 解(): iN = int(eval(input())) #aA = map(int,input().split()) aA = sorted(map(lambda x,y:x-y,list(map(int,input().split())),list(range(1,iN+1)))) iL = len(aA) if iL % 2 : iMed = aA[(iL-1)//2] else: iMed = aA[iL//2] print((sum(abs(a-iMed) for a in aA))) 解()
16
12
390
295
def 解(): iN = int(eval(input())) aA = list(map(int, input().split())) aA = sorted(map(lambda x, y: x - y, aA, list(range(1, iN + 1)))) iL = len(aA) if iL % 2: iMed = aA[(iL - 1) // 2] else: iMed = aA[iL // 2] iMean = sum(aA) // 2 iBlim = min(iMed, iMean) iUlim = min(i...
def 解(): iN = int(eval(input())) # aA = map(int,input().split()) aA = sorted( map(lambda x, y: x - y, list(map(int, input().split())), list(range(1, iN + 1))) ) iL = len(aA) if iL % 2: iMed = aA[(iL - 1) // 2] else: iMed = aA[iL // 2] print((sum(abs(a - iMed) for ...
false
25
[ "- aA = list(map(int, input().split()))", "- aA = sorted(map(lambda x, y: x - y, aA, list(range(1, iN + 1))))", "+ # aA = map(int,input().split())", "+ aA = sorted(", "+ map(lambda x, y: x - y, list(map(int, input().split())), list(range(1, iN + 1)))", "+ )", "- iMean = sum(aA) ...
false
0.042452
0.105984
0.400554
[ "s337545170", "s816699629" ]
u252828980
p02959
python
s474554897
s916484348
194
166
18,624
19,156
Accepted
Accepted
14.43
n = int(eval(input())) a = list(map(int,input().split())) b = list(map(int,input().split())) num = 0 for i in range(n): if a[i] >= b[i]: # print(a[i],b[i]) a[i] -= b[i] num += b[i] b[i] = 0 elif a[i] < b[i]: num += a[i] #a[i] = 0 b[...
n = int(eval(input())) A = list(map(int,input().split())) B = list(map(int,input().split())) tot = sum(A) for i in range(n): en = A[i] + A[i+1] A[i] = max(A[i] -B[i],0) if A[i] == 0: A[i+1] = max(en - B[i],0) #print(A[i],A[i+1]) print((tot-sum(A)))
20
11
416
278
n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) num = 0 for i in range(n): if a[i] >= b[i]: # print(a[i],b[i]) a[i] -= b[i] num += b[i] b[i] = 0 elif a[i] < b[i]: num += a[i] # a[i] = 0 b[i] -= a[i] nu...
n = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) tot = sum(A) for i in range(n): en = A[i] + A[i + 1] A[i] = max(A[i] - B[i], 0) if A[i] == 0: A[i + 1] = max(en - B[i], 0) # print(A[i],A[i+1]) print((tot - sum(A)))
false
45
[ "-a = list(map(int, input().split()))", "-b = list(map(int, input().split()))", "-num = 0", "+A = list(map(int, input().split()))", "+B = list(map(int, input().split()))", "+tot = sum(A)", "- if a[i] >= b[i]:", "- # print(a[i],b[i])", "- a[i] -= b[i]", "- num += b[i]", "-...
false
0.041346
0.035119
1.177307
[ "s474554897", "s916484348" ]
u596276291
p03796
python
s914466193
s048556750
162
36
3,700
3,316
Accepted
Accepted
77.78
from collections import defaultdict def main(): N = int(eval(input())) ans = 1 for i in range(1, N + 1): ans *= i ans %= 10 ** 9 + 7 print((ans % (10 ** 9 + 7))) if __name__ == '__main__': main()
from collections import defaultdict MOD = 10 ** 9 + 7 def main(): N = int(eval(input())) ans = 1 for i in range(1, N + 1): ans *= i ans %= MOD print((ans % MOD)) if __name__ == '__main__': main()
14
15
241
242
from collections import defaultdict def main(): N = int(eval(input())) ans = 1 for i in range(1, N + 1): ans *= i ans %= 10**9 + 7 print((ans % (10**9 + 7))) if __name__ == "__main__": main()
from collections import defaultdict MOD = 10**9 + 7 def main(): N = int(eval(input())) ans = 1 for i in range(1, N + 1): ans *= i ans %= MOD print((ans % MOD)) if __name__ == "__main__": main()
false
6.666667
[ "+", "+MOD = 10**9 + 7", "- ans %= 10**9 + 7", "- print((ans % (10**9 + 7)))", "+ ans %= MOD", "+ print((ans % MOD))" ]
false
0.047155
0.093762
0.502926
[ "s914466193", "s048556750" ]
u545368057
p03339
python
s506322678
s547280235
288
227
20,140
29,724
Accepted
Accepted
21.18
""" WEEWW <>><< 01100 10100 01000 10000 10010 下記の和 1. リーダーより左にいるWの数 2. リーダーより右にいるEの数 """ N = int(eval(input())) S = eval(input()) # 1. cntW = 0 W_num = [0]*N for i,s in enumerate(S): if s == "W": cntW += 1 W_num[i] = cntW # 2. cntE = 0 E_num = [0]*N for i,s in enum...
N = int(eval(input())) S = eval(input()) cnt_w = [0] * (N+1) # 左からWの数 cnt_e = [0] * (N+1) # 右からEの数 for i in range(N): if S[i] == "W": cnt_w[i+1] = cnt_w[i] + 1 else: cnt_w[i+1] = cnt_w[i] for i in range(N-1,-1,-1): if S[i] == "E": cnt_e[i] = cnt_e[i+1] + 1 else: ...
38
20
507
437
""" WEEWW <>><< 01100 10100 01000 10000 10010 下記の和 1. リーダーより左にいるWの数 2. リーダーより右にいるEの数 """ N = int(eval(input())) S = eval(input()) # 1. cntW = 0 W_num = [0] * N for i, s in enumerate(S): if s == "W": cntW += 1 W_num[i] = cntW # 2. cntE = 0 E_num = [0] * N for i, s in enumerate(S[::-1]): if s == "E": ...
N = int(eval(input())) S = eval(input()) cnt_w = [0] * (N + 1) # 左からWの数 cnt_e = [0] * (N + 1) # 右からEの数 for i in range(N): if S[i] == "W": cnt_w[i + 1] = cnt_w[i] + 1 else: cnt_w[i + 1] = cnt_w[i] for i in range(N - 1, -1, -1): if S[i] == "E": cnt_e[i] = cnt_e[i + 1] + 1 else: ...
false
47.368421
[ "-\"\"\"", "-WEEWW", "-<>><<", "-01100", "-10100", "-01000", "-10000", "-10010", "-下記の和", "-1. リーダーより左にいるWの数", "-2. リーダーより右にいるEの数", "-\"\"\"", "-# 1.", "-cntW = 0", "-W_num = [0] * N", "-for i, s in enumerate(S):", "- if s == \"W\":", "- cntW += 1", "- W_num[i] = cnt...
false
0.048499
0.045159
1.073949
[ "s506322678", "s547280235" ]
u949338836
p02401
python
s165782594
s052636908
40
30
6,724
6,724
Accepted
Accepted
25
#coding:utf-8 #1_4_C 2015.3.29 while True: data = input().split() if data[1] == '?': break elif data[1] == '+': print((int(data[0]) + int(data[2]))) elif data[1] == '-': print((int(data[0]) - int(data[2]))) elif data[1] == '*': print((int(data[0]) * int(dat...
#coding:utf-8 #1_4_C 2015.3.29 while True: data = eval(input()) if '?' in data: break print((eval(data.replace('/','//'))))
14
7
392
141
# coding:utf-8 # 1_4_C 2015.3.29 while True: data = input().split() if data[1] == "?": break elif data[1] == "+": print((int(data[0]) + int(data[2]))) elif data[1] == "-": print((int(data[0]) - int(data[2]))) elif data[1] == "*": print((int(data[0]) * int(data[2]))) ...
# coding:utf-8 # 1_4_C 2015.3.29 while True: data = eval(input()) if "?" in data: break print((eval(data.replace("/", "//"))))
false
50
[ "- data = input().split()", "- if data[1] == \"?\":", "+ data = eval(input())", "+ if \"?\" in data:", "- elif data[1] == \"+\":", "- print((int(data[0]) + int(data[2])))", "- elif data[1] == \"-\":", "- print((int(data[0]) - int(data[2])))", "- elif data[1] == \"*...
false
0.038464
0.047075
0.817074
[ "s165782594", "s052636908" ]
u888092736
p03147
python
s934631323
s061438127
19
17
3,060
2,940
Accepted
Accepted
10.53
N = int(eval(input())) h = list(map(int, input().split())) board = [[0] * (N + 1) for _ in range(max(h))] for i in range(N): for j in range(h[i]): board[j][i + 1] = 1 print((sum(row[i] == 0 and row[i + 1] == 1 for row in board for i in range(N))))
eval(input()) ans, tmp = 0, 0 for h in map(int, input().split()): ans += max(0, h - tmp) tmp = h print(ans)
7
6
258
115
N = int(eval(input())) h = list(map(int, input().split())) board = [[0] * (N + 1) for _ in range(max(h))] for i in range(N): for j in range(h[i]): board[j][i + 1] = 1 print((sum(row[i] == 0 and row[i + 1] == 1 for row in board for i in range(N))))
eval(input()) ans, tmp = 0, 0 for h in map(int, input().split()): ans += max(0, h - tmp) tmp = h print(ans)
false
14.285714
[ "-N = int(eval(input()))", "-h = list(map(int, input().split()))", "-board = [[0] * (N + 1) for _ in range(max(h))]", "-for i in range(N):", "- for j in range(h[i]):", "- board[j][i + 1] = 1", "-print((sum(row[i] == 0 and row[i + 1] == 1 for row in board for i in range(N))))", "+eval(input()...
false
0.037469
0.035228
1.063618
[ "s934631323", "s061438127" ]
u991567869
p03475
python
s957510134
s285203359
115
94
9,152
9,148
Accepted
Accepted
18.26
n = int(eval(input())) l = [[0]*3 for i in range(n)] for i in range(n - 1): c, s, f = list(map(int, input().split())) l[i][0] = c l[i][1] = s l[i][2] = f for i in range(n - 1): t = 0 for j in range(i, n - 1): t = max(l[j][1], t) mod = abs(t - l[j][1])%l[j][2] ...
n = int(eval(input())) l = [list(map(int, input().split())) for i in range(n - 1)] for i in range(n): t = 0 for c, s, f in l[i:]: t = max(s, t) mod = abs(t - s)%f if mod != 0: t += f - mod t += c print(t)
20
12
404
266
n = int(eval(input())) l = [[0] * 3 for i in range(n)] for i in range(n - 1): c, s, f = list(map(int, input().split())) l[i][0] = c l[i][1] = s l[i][2] = f for i in range(n - 1): t = 0 for j in range(i, n - 1): t = max(l[j][1], t) mod = abs(t - l[j][1]) % l[j][2] if mod !...
n = int(eval(input())) l = [list(map(int, input().split())) for i in range(n - 1)] for i in range(n): t = 0 for c, s, f in l[i:]: t = max(s, t) mod = abs(t - s) % f if mod != 0: t += f - mod t += c print(t)
false
40
[ "-l = [[0] * 3 for i in range(n)]", "-for i in range(n - 1):", "- c, s, f = list(map(int, input().split()))", "- l[i][0] = c", "- l[i][1] = s", "- l[i][2] = f", "-for i in range(n - 1):", "+l = [list(map(int, input().split())) for i in range(n - 1)]", "+for i in range(n):", "- for j...
false
0.03754
0.039601
0.947954
[ "s957510134", "s285203359" ]
u480138356
p04006
python
s910056497
s987197421
1,784
1,431
3,700
14,260
Accepted
Accepted
19.79
import sys import copy input = sys.stdin.readline def main(): N, x = list(map(int, input().split())) a = list(map(int, input().split())) min_ = copy.deepcopy(a) ans = int(1e15) # 魔法を唱える回数 k for k in range(N): tmp = k * x for i in range(N): min_[i] = ...
import sys import numpy as np input = sys.stdin.readline def main(): N, x = list(map(int, input().split())) a = list(map(int, input().split())) min_ = np.array(a) ans = sum(min_) # 魔法を唱える回数 k for k in range(1, N): min_ = np.minimum(min_, np.roll(min_, 1)) ans = m...
25
21
480
402
import sys import copy input = sys.stdin.readline def main(): N, x = list(map(int, input().split())) a = list(map(int, input().split())) min_ = copy.deepcopy(a) ans = int(1e15) # 魔法を唱える回数 k for k in range(N): tmp = k * x for i in range(N): min_[i] = min(min_[i], a[...
import sys import numpy as np input = sys.stdin.readline def main(): N, x = list(map(int, input().split())) a = list(map(int, input().split())) min_ = np.array(a) ans = sum(min_) # 魔法を唱える回数 k for k in range(1, N): min_ = np.minimum(min_, np.roll(min_, 1)) ans = min(ans, k * x ...
false
16
[ "-import copy", "+import numpy as np", "- min_ = copy.deepcopy(a)", "- ans = int(1e15)", "+ min_ = np.array(a)", "+ ans = sum(min_)", "- for k in range(N):", "- tmp = k * x", "- for i in range(N):", "- min_[i] = min(min_[i], a[(i - k) % N])", "- ...
false
0.050114
0.280021
0.178966
[ "s910056497", "s987197421" ]
u810356688
p03006
python
s881791216
s509492382
23
21
3,572
3,564
Accepted
Accepted
8.7
import sys def input(): return sys.stdin.readline().rstrip() from itertools import combinations from collections import Counter def main(): n=int(eval(input())) if n==1: print((1)) sys.exit() XY=[tuple(map(int,input().split())) for i in range(n)] XY.sort() lis=list(combina...
import sys def input(): return sys.stdin.readline().rstrip() from itertools import combinations from collections import Counter def main(): n=int(eval(input())) if n==1: print((1)) sys.exit() XY=[tuple(map(int,input().split())) for i in range(n)] XY.sort() PQ=[] for i...
20
21
504
536
import sys def input(): return sys.stdin.readline().rstrip() from itertools import combinations from collections import Counter def main(): n = int(eval(input())) if n == 1: print((1)) sys.exit() XY = [tuple(map(int, input().split())) for i in range(n)] XY.sort() lis = list...
import sys def input(): return sys.stdin.readline().rstrip() from itertools import combinations from collections import Counter def main(): n = int(eval(input())) if n == 1: print((1)) sys.exit() XY = [tuple(map(int, input().split())) for i in range(n)] XY.sort() PQ = [] ...
false
4.761905
[ "- lis = list(combinations(XY, 2))", "- for l in lis:", "- PQ.append((l[1][0] - l[0][0], l[1][1] - l[0][1]))", "- x = Counter(PQ).most_common(1)[0][1]", "- print((n - x))", "+ for i in range(n - 1):", "+ x1 = XY[i]", "+ for j in range(i + 1, n):", "+ x2...
false
0.041525
0.102077
0.406797
[ "s881791216", "s509492382" ]
u368796742
p03722
python
s910824091
s072861690
398
346
48,744
48,104
Accepted
Accepted
13.07
from collections import deque n,m = list(map(int,input().split())) e1 = [[] for i in range(n)] e2 = [[] for i in range(n)] l = [] for i in range(m): a,b,c = list(map(int,input().split())) a -= 1 b -= 1 e1[a].append(b) e2[b].append(a) l.append([a,b,c]) def search(x,e): dis = [0...
from collections import deque n,m = list(map(int,input().split())) e1 = [[] for i in range(n)] e2 = [[] for i in range(n)] l = [] for i in range(m): a,b,c = list(map(int,input().split())) a -= 1 b -= 1 e1[a].append(b) e2[b].append(a) l.append([a,b,c]) def search(x,e): dis = [0...
55
55
1,064
1,062
from collections import deque n, m = list(map(int, input().split())) e1 = [[] for i in range(n)] e2 = [[] for i in range(n)] l = [] for i in range(m): a, b, c = list(map(int, input().split())) a -= 1 b -= 1 e1[a].append(b) e2[b].append(a) l.append([a, b, c]) def search(x, e): dis = [0] * ...
from collections import deque n, m = list(map(int, input().split())) e1 = [[] for i in range(n)] e2 = [[] for i in range(n)] l = [] for i in range(m): a, b, c = list(map(int, input().split())) a -= 1 b -= 1 e1[a].append(b) e2[b].append(a) l.append([a, b, c]) def search(x, e): dis = [0] * ...
false
0
[ "-for i in range(2 * n):", "+for i in range(n):" ]
false
0.036513
0.034916
1.045735
[ "s910824091", "s072861690" ]
u279605379
p02294
python
s551984546
s538343110
60
40
7,860
7,864
Accepted
Accepted
33.33
class Line: def __init__(self,p1,p2): if p1[1] < p2[1]:self.s=p2;self.e=p1 elif p1[1] > p2[1]:self.s=p1;self.e=p2 else: if p1[0] < p2[0]:self.s=p1;self.e=p2 else:self.s=p2;self.e=p1 def dot(a,b):return a[0]*b[0] + a[1]*b[1] def cross(a,b):return a[0]*b[1] - a[...
class Line: def __init__(self,p1,p2): if p1[1] < p2[1]:self.s=p2;self.e=p1 elif p1[1] > p2[1]:self.s=p1;self.e=p2 else: if p1[0] < p2[0]:self.s=p1;self.e=p2 else:self.s=p2;self.e=p1 def dot(a,b):return a[0]*b[0] + a[1]*b[1] def cross(a,b):return a[0]*b[1] - a[...
26
26
1,079
1,079
class Line: def __init__(self, p1, p2): if p1[1] < p2[1]: self.s = p2 self.e = p1 elif p1[1] > p2[1]: self.s = p1 self.e = p2 else: if p1[0] < p2[0]: self.s = p1 self.e = p2 else: ...
class Line: def __init__(self, p1, p2): if p1[1] < p2[1]: self.s = p2 self.e = p1 elif p1[1] > p2[1]: self.s = p1 self.e = p2 else: if p1[0] < p2[0]: self.s = p1 self.e = p2 else: ...
false
0
[ "- l1 = Line(a, b)", "- l2 = Line(c, d)", "+ l1 = Line(b, a)", "+ l2 = Line(d, c)" ]
false
0.041359
0.103936
0.39793
[ "s551984546", "s538343110" ]
u052499405
p03061
python
s441811440
s293203028
1,670
1,271
16,124
30,088
Accepted
Accepted
23.89
#!/usr/bin/env python3 import sys from fractions import gcd input = sys.stdin.readline class RgcdQ: def __init__(self, a): self.n = len(a) self.size = 2**(self.n - 1).bit_length() self.data = [0] * (2*self.size-1) self.initialize(a) # Initialize data def init...
#!/usr/bin/env python3 import sys from fractions import gcd input = sys.stdin.readline class DisjointSparseTable: def __init__(self, a): # Identity element self.e = 0 self.level = (len(a) - 1).bit_length() self.size = 2**self.level self.table = [[self.e] * self.si...
50
51
1,373
1,616
#!/usr/bin/env python3 import sys from fractions import gcd input = sys.stdin.readline class RgcdQ: def __init__(self, a): self.n = len(a) self.size = 2 ** (self.n - 1).bit_length() self.data = [0] * (2 * self.size - 1) self.initialize(a) # Initialize data def initialize(...
#!/usr/bin/env python3 import sys from fractions import gcd input = sys.stdin.readline class DisjointSparseTable: def __init__(self, a): # Identity element self.e = 0 self.level = (len(a) - 1).bit_length() self.size = 2**self.level self.table = [[self.e] * self.size for _ ...
false
1.960784
[ "-class RgcdQ:", "+class DisjointSparseTable:", "- self.n = len(a)", "- self.size = 2 ** (self.n - 1).bit_length()", "- self.data = [0] * (2 * self.size - 1)", "- self.initialize(a)", "+ # Identity element", "+ self.e = 0", "+ self.level = (len(a) - 1...
false
0.052613
0.052337
1.005264
[ "s441811440", "s293203028" ]
u118642796
p03574
python
s949421545
s024745650
179
34
39,792
3,444
Accepted
Accepted
81.01
H,W = list(map(int,input().split())) S = ["."*(W+2)] [S.append("."+eval(input())+".") for _ in range(H)] S.append("."*(W+2)) ans = [] for h in range(1,H+1): ans_tmp = "" for w in range(1,W+1): if S[h][w] == ".": tmp = 0 for i in [-1,0,1]: for j in [-1...
H, W = map(int, input().split()) S = [input() for _ in range(H)] Ans = [[S[h][w] for w in range(W)] for h in range(H)] for h in range(H): for w in range(W): if Ans[h][w] == '.': x = 0 for i in [-1, 0, 1]: for j in [-1, 0, 1]: if 0 <= h...
21
19
523
549
H, W = list(map(int, input().split())) S = ["." * (W + 2)] [S.append("." + eval(input()) + ".") for _ in range(H)] S.append("." * (W + 2)) ans = [] for h in range(1, H + 1): ans_tmp = "" for w in range(1, W + 1): if S[h][w] == ".": tmp = 0 for i in [-1, 0, 1]: for...
H, W = map(int, input().split()) S = [input() for _ in range(H)] Ans = [[S[h][w] for w in range(W)] for h in range(H)] for h in range(H): for w in range(W): if Ans[h][w] == ".": x = 0 for i in [-1, 0, 1]: for j in [-1, 0, 1]: if ( ...
false
9.52381
[ "-H, W = list(map(int, input().split()))", "-S = [\".\" * (W + 2)]", "-[S.append(\".\" + eval(input()) + \".\") for _ in range(H)]", "-S.append(\".\" * (W + 2))", "-ans = []", "-for h in range(1, H + 1):", "- ans_tmp = \"\"", "- for w in range(1, W + 1):", "- if S[h][w] == \".\":", "-...
false
0.144202
0.037947
3.800107
[ "s949421545", "s024745650" ]
u924691798
p02925
python
s525374809
s718590533
1,645
495
37,108
55,260
Accepted
Accepted
69.91
import sys input = sys.stdin.readline N = int(eval(input())) A = [list([int(n)-1 for n in input().split()]) for i in range(N)] cur = [0 for i in range(N)] que = [i for i in range(N)] ans = 0 while len(que) > 0: done = {} que2 = [] for n in que: if done.get(n): continue ...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) N = int(eval(input())) A = [list([int(n)-1 for n in input().split()]) for i in range(N)] cur = [0 for i in range(N)] que = [i for i in range(N)] ans = 0 while len(que) > 0: done = {} que2 = [] for n in que: if done.get(...
37
38
849
879
import sys input = sys.stdin.readline N = int(eval(input())) A = [list([int(n) - 1 for n in input().split()]) for i in range(N)] cur = [0 for i in range(N)] que = [i for i in range(N)] ans = 0 while len(que) > 0: done = {} que2 = [] for n in que: if done.get(n): continue pair = ...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) N = int(eval(input())) A = [list([int(n) - 1 for n in input().split()]) for i in range(N)] cur = [0 for i in range(N)] que = [i for i in range(N)] ans = 0 while len(que) > 0: done = {} que2 = [] for n in que: if done.get(n): ...
false
2.631579
[ "+sys.setrecursionlimit(10**7)" ]
false
0.041159
0.075873
0.542473
[ "s525374809", "s718590533" ]
u905203728
p02856
python
s770791105
s075072755
1,011
337
78,680
106,880
Accepted
Accepted
66.67
m=int(eval(input())) DC=[list(map(int,input().split())) for _ in range(m)] D,S=0,0 for d,c in DC: D +=c S +=d*c print((D-1+(S-1)//9))
n=int(eval(input())) DC=[list(map(int,input().split())) for _ in range(n)] D,S=0,0 for d,c in DC: D +=c S +=d*c print((D-1+(S-1)//9))
8
8
141
141
m = int(eval(input())) DC = [list(map(int, input().split())) for _ in range(m)] D, S = 0, 0 for d, c in DC: D += c S += d * c print((D - 1 + (S - 1) // 9))
n = int(eval(input())) DC = [list(map(int, input().split())) for _ in range(n)] D, S = 0, 0 for d, c in DC: D += c S += d * c print((D - 1 + (S - 1) // 9))
false
0
[ "-m = int(eval(input()))", "-DC = [list(map(int, input().split())) for _ in range(m)]", "+n = int(eval(input()))", "+DC = [list(map(int, input().split())) for _ in range(n)]" ]
false
0.056409
0.055231
1.02134
[ "s770791105", "s075072755" ]
u588341295
p03354
python
s703125487
s731071811
662
599
13,812
14,008
Accepted
Accepted
9.52
# -*- coding: utf-8 -*- """ 参考:http://at274.hatenablog.com/entry/2018/02/02/173000 ・Union-Find木 """ class UnionFind: def __init__(self, n): # 親要素のノード番号を格納。par[x] == xの時そのノードは根 # 1-indexedのままでOK、その場合は[0]は未使用 self.par = [i for i in range(n+1)] # 木の高さを格納する(初期状態では0) ...
# -*- 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 ...
56
105
1,324
2,791
# -*- coding: utf-8 -*- """ 参考:http://at274.hatenablog.com/entry/2018/02/02/173000 ・Union-Find木 """ class UnionFind: def __init__(self, n): # 親要素のノード番号を格納。par[x] == xの時そのノードは根 # 1-indexedのままでOK、その場合は[0]は未使用 self.par = [i for i in range(n + 1)] # 木の高さを格納する(初期状態では0) self.rank...
# -*- 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...
false
46.666667
[ "-\"\"\"", "-参考:http://at274.hatenablog.com/entry/2018/02/02/173000", "-・Union-Find木", "-\"\"\"", "+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...
false
0.042186
0.038707
1.089884
[ "s703125487", "s731071811" ]
u373047809
p03341
python
s358329584
s058523230
181
151
31,576
3,676
Accepted
Accepted
16.57
from itertools import*;eval(input());s=eval(input());print((min(w+e for w,e in zip(*[([0]+list(accumulate(list(map(int,s[::a].translate(str.maketrans("EW","01"[::a]))))))[:-1])[::a]for a in[-1,1]]))))
eval(input());s=eval(input());m=c=s.count("E") for t in s:c-=t<"W";m=min(m,c);c+=t>"E" print(m)
1
3
180
86
from itertools import * eval(input()) s = eval(input()) print( ( min( w + e for w, e in zip( *[ ( [0] + list( accumulate( list( ...
eval(input()) s = eval(input()) m = c = s.count("E") for t in s: c -= t < "W" m = min(m, c) c += t > "E" print(m)
false
66.666667
[ "-from itertools import *", "-", "-print(", "- (", "- min(", "- w + e", "- for w, e in zip(", "- *[", "- (", "- [0]", "- + list(", "- accumulate(", "- ...
false
0.048151
0.047475
1.014247
[ "s358329584", "s058523230" ]