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
u508732591
p02315
python
s356966117
s550762981
370
330
6,664
5,920
Accepted
Accepted
10.81
N,W = list(map(int, input().split())) dp = [0]*(W+1) temp = [0]*(W+1) for i in range(1,N+1): v,w = list(map(int,input().split())) for j in range(w, W+1): x = v+temp[j-w] if x > temp[j]: dp[j] = x temp[0:W+1] = dp[0:W+1] print((dp[W]))
N,W = list(map(int, input().split())) dp = [0]*(W+1) for i in range(1,N+1): v,w = list(map(int,input().split())) for j in range(W, w-1, -1): x = v+dp[j-w] if x > dp[j]: dp[j] = x print((dp[W]))
13
10
263
214
N, W = list(map(int, input().split())) dp = [0] * (W + 1) temp = [0] * (W + 1) for i in range(1, N + 1): v, w = list(map(int, input().split())) for j in range(w, W + 1): x = v + temp[j - w] if x > temp[j]: dp[j] = x temp[0 : W + 1] = dp[0 : W + 1] print((dp[W]))
N, W = list(map(int, input().split())) dp = [0] * (W + 1) for i in range(1, N + 1): v, w = list(map(int, input().split())) for j in range(W, w - 1, -1): x = v + dp[j - w] if x > dp[j]: dp[j] = x print((dp[W]))
false
23.076923
[ "-temp = [0] * (W + 1)", "- for j in range(w, W + 1):", "- x = v + temp[j - w]", "- if x > temp[j]:", "+ for j in range(W, w - 1, -1):", "+ x = v + dp[j - w]", "+ if x > dp[j]:", "- temp[0 : W + 1] = dp[0 : W + 1]" ]
false
0.046406
0.044805
1.035751
[ "s356966117", "s550762981" ]
u726615467
p02688
python
s967084781
s713666927
26
23
9,200
9,156
Accepted
Accepted
11.54
N, K = list(map(int, input().split())) d = [] A = [] for _ in range(K): d.append(int(eval(input()))) A.append(list(map(int, input().split()))) cnt = {} for i in range(N): cnt.setdefault(str(i + 1), 0) for Ai in A: for Aij in Ai: cnt[str(Aij)] += 1 ans = 0 for key, val in lis...
N, K = list(map(int, input().split())) d = [] A = [] for _ in range(K): d.append(int(eval(input()))) A.append(list(map(int, input().split()))) cnt = {} for i, Ai in enumerate(A): for j, Aij in enumerate(Ai): key = str(Aij) cnt.setdefault(key, 0) cnt[key] += 1 ans = 0 ...
21
21
358
425
N, K = list(map(int, input().split())) d = [] A = [] for _ in range(K): d.append(int(eval(input()))) A.append(list(map(int, input().split()))) cnt = {} for i in range(N): cnt.setdefault(str(i + 1), 0) for Ai in A: for Aij in Ai: cnt[str(Aij)] += 1 ans = 0 for key, val in list(cnt.items()): i...
N, K = list(map(int, input().split())) d = [] A = [] for _ in range(K): d.append(int(eval(input()))) A.append(list(map(int, input().split()))) cnt = {} for i, Ai in enumerate(A): for j, Aij in enumerate(Ai): key = str(Aij) cnt.setdefault(key, 0) cnt[key] += 1 ans = 0 for i in range(1...
false
0
[ "-for i in range(N):", "- cnt.setdefault(str(i + 1), 0)", "-for Ai in A:", "- for Aij in Ai:", "- cnt[str(Aij)] += 1", "+for i, Ai in enumerate(A):", "+ for j, Aij in enumerate(Ai):", "+ key = str(Aij)", "+ cnt.setdefault(key, 0)", "+ cnt[key] += 1", "-for ke...
false
0.047104
0.047567
0.990252
[ "s967084781", "s713666927" ]
u227082700
p02948
python
s459316278
s973596181
668
603
31,884
42,916
Accepted
Accepted
9.73
L=lambda:list(map(int,input().split()));n,m=L();t=sorted([L()for _ in range(n)]+[[float("inf")]]);import heapq as q;h=[];a=j=0 for i in range(t[0][0],m+1): while t[j][0]==i:q.heappush(h,-t[j][1]);j+=1 if h:a-=q.heappop(h) print(a)
n,m=list(map(int,input().split())) ab=[list(map(int,input().split()))for _ in range(n)]+[[100000000,0]] for i in range(m):ab.append([i+1,0]) ab.sort() from heapq import heappop,heappush h=[] j=0 ans=0 for i in range(1,m+1): while ab[j][0]<=i: heappush(h,-ab[j][1]) j+=1 ans-=heappop(h) print(ans...
5
14
238
315
L = lambda: list(map(int, input().split())) n, m = L() t = sorted([L() for _ in range(n)] + [[float("inf")]]) import heapq as q h = [] a = j = 0 for i in range(t[0][0], m + 1): while t[j][0] == i: q.heappush(h, -t[j][1]) j += 1 if h: a -= q.heappop(h) print(a)
n, m = list(map(int, input().split())) ab = [list(map(int, input().split())) for _ in range(n)] + [[100000000, 0]] for i in range(m): ab.append([i + 1, 0]) ab.sort() from heapq import heappop, heappush h = [] j = 0 ans = 0 for i in range(1, m + 1): while ab[j][0] <= i: heappush(h, -ab[j][1]) j ...
false
64.285714
[ "-L = lambda: list(map(int, input().split()))", "-n, m = L()", "-t = sorted([L() for _ in range(n)] + [[float(\"inf\")]])", "-import heapq as q", "+n, m = list(map(int, input().split()))", "+ab = [list(map(int, input().split())) for _ in range(n)] + [[100000000, 0]]", "+for i in range(m):", "+ ab.a...
false
0.083919
0.145042
0.578588
[ "s459316278", "s973596181" ]
u347640436
p02936
python
s461274304
s790478985
1,552
978
62,132
62,132
Accepted
Accepted
36.98
from collections import deque def main(): _map, _input, _int = map, input, int n, q = _map(_int, _input().split()) values = [0] * n links = [[] for _ in range(n)] for _ in range(n - 1): a, b = _map(_int, _input().split()) if a >= b: return links[a - 1].append(b - 1) links[b - ...
from sys import stdin from collections import deque def main(): _map, _readline, _int = map, stdin.readline, int n, q = _map(_int, _readline().rstrip().split()) values = [0] * n links = [[] for _ in range(n)] for _ in range(n - 1): a, b = _map(_int, _readline().rstrip().split()) links[a - 1]....
26
25
646
686
from collections import deque def main(): _map, _input, _int = map, input, int n, q = _map(_int, _input().split()) values = [0] * n links = [[] for _ in range(n)] for _ in range(n - 1): a, b = _map(_int, _input().split()) if a >= b: return links[a - 1].append(b ...
from sys import stdin from collections import deque def main(): _map, _readline, _int = map, stdin.readline, int n, q = _map(_int, _readline().rstrip().split()) values = [0] * n links = [[] for _ in range(n)] for _ in range(n - 1): a, b = _map(_int, _readline().rstrip().split()) li...
false
3.846154
[ "+from sys import stdin", "- _map, _input, _int = map, input, int", "- n, q = _map(_int, _input().split())", "+ _map, _readline, _int = map, stdin.readline, int", "+ n, q = _map(_int, _readline().rstrip().split())", "- a, b = _map(_int, _input().split())", "- if a >= b:", "- ...
false
0.112761
0.043544
2.589575
[ "s461274304", "s790478985" ]
u119148115
p02625
python
s605617745
s030486018
1,860
677
9,208
68,228
Accepted
Accepted
63.6
import sys def S(): return sys.stdin.readline().rstrip() N,M = list(map(int,S().split())) mod = 10**9+7 a = M # (M_P_N)**2 for i in range(1,N): a *= M-i a %= mod # 包除原理 # 2つめの条件は常に成り立った状況で考える # {1,…,N}の部分集合Sの元iに対してA_i=B_iが成り立つようなA_1,…,B_1,…の組の個数を考える ans = a**2 % mod r = ans for i in range(...
import sys def S(): return sys.stdin.readline().rstrip() N,M = list(map(int,S().split())) mod = 10**9+7 a = M # (M_P_N)**2 for i in range(1,N): a *= M-i a %= mod # 包除原理 # 2つめの条件は常に成り立った状況で考える # {1,…,N}の部分集合Sの元iに対してA_i=B_iが成り立つようなA_1,…,B_1,…の組の個数を考える ans = a**2 % mod r = ans for i in range(...
24
24
434
440
import sys def S(): return sys.stdin.readline().rstrip() N, M = list(map(int, S().split())) mod = 10**9 + 7 a = M # (M_P_N)**2 for i in range(1, N): a *= M - i a %= mod # 包除原理 # 2つめの条件は常に成り立った状況で考える # {1,…,N}の部分集合Sの元iに対してA_i=B_iが成り立つようなA_1,…,B_1,…の組の個数を考える ans = a**2 % mod r = ans for i in range(1, N +...
import sys def S(): return sys.stdin.readline().rstrip() N, M = list(map(int, S().split())) mod = 10**9 + 7 a = M # (M_P_N)**2 for i in range(1, N): a *= M - i a %= mod # 包除原理 # 2つめの条件は常に成り立った状況で考える # {1,…,N}の部分集合Sの元iに対してA_i=B_iが成り立つようなA_1,…,B_1,…の組の個数を考える ans = a**2 % mod r = ans for i in range(1, N +...
false
0
[ "- r *= (N - i + 1) * pow(i, -1, mod) * pow(M - i + 1, -1, mod) * (-1)", "+ r *= (N - i + 1) * pow(i, mod - 2, mod) * pow(M - i + 1, mod - 2, mod) * (-1)" ]
false
0.886399
0.336573
2.633606
[ "s605617745", "s030486018" ]
u350049649
p03132
python
s837149232
s522429492
1,354
806
74,052
11,040
Accepted
Accepted
40.47
L=int(eval(input())) A=[int(eval(input())) for _ in range(L)] INF=2*L dp=[[INF for _ in range(5)] for _ in range(L+1)] for j in range(5): dp[0][j]=0 for i in range(1,L+1): a=A[i-1] if A[i-1]==0: o=2 else: o=A[i-1]%2 e=(A[i-1]+1)%2 dp[i][0]=dp[i-1][0]+...
L=int(eval(input())) A=[int(eval(input())) for _ in range(L)] dp=[0 for _ in range(5)] for i in range(1,L+1): a=A[i-1] back = a%2 if a>0 else 2 through = (a+1)%2 dp[4] = min(dp[0:5]) + a dp[3] = min(dp[0:4]) + back dp[2] = min(dp[0:3]) + through dp[1] = min(dp[0:2]) + back ...
28
16
588
340
L = int(eval(input())) A = [int(eval(input())) for _ in range(L)] INF = 2 * L dp = [[INF for _ in range(5)] for _ in range(L + 1)] for j in range(5): dp[0][j] = 0 for i in range(1, L + 1): a = A[i - 1] if A[i - 1] == 0: o = 2 else: o = A[i - 1] % 2 e = (A[i - 1] + 1) % 2 dp[i][0]...
L = int(eval(input())) A = [int(eval(input())) for _ in range(L)] dp = [0 for _ in range(5)] for i in range(1, L + 1): a = A[i - 1] back = a % 2 if a > 0 else 2 through = (a + 1) % 2 dp[4] = min(dp[0:5]) + a dp[3] = min(dp[0:4]) + back dp[2] = min(dp[0:3]) + through dp[1] = min(dp[0:2]) + ba...
false
42.857143
[ "-INF = 2 * L", "-dp = [[INF for _ in range(5)] for _ in range(L + 1)]", "-for j in range(5):", "- dp[0][j] = 0", "+dp = [0 for _ in range(5)]", "- if A[i - 1] == 0:", "- o = 2", "- else:", "- o = A[i - 1] % 2", "- e = (A[i - 1] + 1) % 2", "- dp[i][0] = dp[i - 1][0] ...
false
0.04464
0.04418
1.010412
[ "s837149232", "s522429492" ]
u471212175
p02995
python
s137576902
s366413037
52
17
5,560
3,064
Accepted
Accepted
67.31
from fractions import gcd l = list(map(int,input().split())) A = l[0] B = l[1] C = l[2] D = l[3] E = C * D //gcd(C,D) f = B//C - (A-1)//C f = f+(B//D - (A-1)//D) ans = B-A+1-f + B//E-(A-1)//E print(ans)
def gcd(m,n): i = max(m,n) j = min(m,n) return sgcd(i,j) def sgcd(i,j): if j == 0: return i else: return sgcd(j,i%j) l = list(map(int,input().split())) A = l[0] B = l[1] C = l[2] D = l[3] E = C * D //gcd(C,D) f = B//C - (A-1)//C f = f+(B//D - (A-1)//D) ans = ...
14
23
220
356
from fractions import gcd l = list(map(int, input().split())) A = l[0] B = l[1] C = l[2] D = l[3] E = C * D // gcd(C, D) f = B // C - (A - 1) // C f = f + (B // D - (A - 1) // D) ans = B - A + 1 - f + B // E - (A - 1) // E print(ans)
def gcd(m, n): i = max(m, n) j = min(m, n) return sgcd(i, j) def sgcd(i, j): if j == 0: return i else: return sgcd(j, i % j) l = list(map(int, input().split())) A = l[0] B = l[1] C = l[2] D = l[3] E = C * D // gcd(C, D) f = B // C - (A - 1) // C f = f + (B // D - (A - 1) // D) an...
false
39.130435
[ "-from fractions import gcd", "+def gcd(m, n):", "+ i = max(m, n)", "+ j = min(m, n)", "+ return sgcd(i, j)", "+", "+", "+def sgcd(i, j):", "+ if j == 0:", "+ return i", "+ else:", "+ return sgcd(j, i % j)", "+" ]
false
0.060983
0.089997
0.677609
[ "s137576902", "s366413037" ]
u485319545
p03786
python
s815554583
s991548231
396
234
35,548
37,116
Accepted
Accepted
40.91
n=int(eval(input())) a=list(map(int,input().split())) a=sorted(a) import numpy as np cum=list(np.cumsum(a)) cnt=0 for i in range(n-1,-1,-1): if i==n-1: cnt+=1 continue if 2*cum[i]>=a[i+1]: cnt+=1 else: break print(cnt)
n=int(eval(input())) a=list(map(int,input().split())) import numpy as np a=sorted(a) cum = np.cumsum(a) cum=list(reversed(cum)) a=list(reversed(a)) ans=1 for i in range(1,n): if a[i-1]<=cum[i]*2: ans+=1 else: break print(ans)
20
18
282
265
n = int(eval(input())) a = list(map(int, input().split())) a = sorted(a) import numpy as np cum = list(np.cumsum(a)) cnt = 0 for i in range(n - 1, -1, -1): if i == n - 1: cnt += 1 continue if 2 * cum[i] >= a[i + 1]: cnt += 1 else: break print(cnt)
n = int(eval(input())) a = list(map(int, input().split())) import numpy as np a = sorted(a) cum = np.cumsum(a) cum = list(reversed(cum)) a = list(reversed(a)) ans = 1 for i in range(1, n): if a[i - 1] <= cum[i] * 2: ans += 1 else: break print(ans)
false
10
[ "-a = sorted(a)", "-cum = list(np.cumsum(a))", "-cnt = 0", "-for i in range(n - 1, -1, -1):", "- if i == n - 1:", "- cnt += 1", "- continue", "- if 2 * cum[i] >= a[i + 1]:", "- cnt += 1", "+a = sorted(a)", "+cum = np.cumsum(a)", "+cum = list(reversed(cum))", "+a = ...
false
0.262857
0.367002
0.716227
[ "s815554583", "s991548231" ]
u288888252
p03012
python
s606331718
s984693524
318
226
17,416
16,264
Accepted
Accepted
28.93
# -*- Coding: utf-8 -*- import numpy as np N = int(input()) W = list(map(int,input().split())) W = np.array(W) W_sum = np.sum(W) ans = W_sum for i in range(1,N): right = np.sum(W[i:N]) left = W_sum - right ans = min(ans,abs(left-right)) print(ans)
# -*- Coding: utf-8 -*- import numpy as np N = int(input()) W = list(map(int,input().split())) W = np.array(W) W_sum = np.sum(W) ans = W_sum left = 0 for i in range(N-1): left += W[i] right = W_sum - left ans = min(ans,abs(left-right)) print(ans)
14
15
268
268
# -*- Coding: utf-8 -*- import numpy as np N = int(input()) W = list(map(int, input().split())) W = np.array(W) W_sum = np.sum(W) ans = W_sum for i in range(1, N): right = np.sum(W[i:N]) left = W_sum - right ans = min(ans, abs(left - right)) print(ans)
# -*- Coding: utf-8 -*- import numpy as np N = int(input()) W = list(map(int, input().split())) W = np.array(W) W_sum = np.sum(W) ans = W_sum left = 0 for i in range(N - 1): left += W[i] right = W_sum - left ans = min(ans, abs(left - right)) print(ans)
false
6.666667
[ "-for i in range(1, N):", "- right = np.sum(W[i:N])", "- left = W_sum - right", "+left = 0", "+for i in range(N - 1):", "+ left += W[i]", "+ right = W_sum - left" ]
false
0.17289
0.171775
1.006489
[ "s606331718", "s984693524" ]
u753803401
p03645
python
s725025426
s442401507
1,305
523
54,324
67,292
Accepted
Accepted
59.92
import heapq n, m = list(map(int, input().split())) ab = [list(map(int, input().split())) for _ in range(m)] ab.sort() ls = [] heapq.heapify(ls) for i in range(m): if ab[i][0] == 1: heapq.heappush(ls, ab[i][1]) else: while True: if len(ls) != 0: p = heapq....
def slove(): import sys import collections input = sys.stdin.readline n, m = list(map(int, input().rstrip('\n').split())) s = collections.defaultdict(list) e = collections.defaultdict(list) for i in range(m): a, b = list(map(int, input().rstrip('\n').split())) if a =...
27
27
787
624
import heapq n, m = list(map(int, input().split())) ab = [list(map(int, input().split())) for _ in range(m)] ab.sort() ls = [] heapq.heapify(ls) for i in range(m): if ab[i][0] == 1: heapq.heappush(ls, ab[i][1]) else: while True: if len(ls) != 0: p = heapq.heappop(ls)...
def slove(): import sys import collections input = sys.stdin.readline n, m = list(map(int, input().rstrip("\n").split())) s = collections.defaultdict(list) e = collections.defaultdict(list) for i in range(m): a, b = list(map(int, input().rstrip("\n").split())) if a == 1: ...
false
0
[ "-import heapq", "+def slove():", "+ import sys", "+ import collections", "-n, m = list(map(int, input().split()))", "-ab = [list(map(int, input().split())) for _ in range(m)]", "-ab.sort()", "-ls = []", "-heapq.heapify(ls)", "-for i in range(m):", "- if ab[i][0] == 1:", "- hea...
false
0.0465
0.046482
1.000389
[ "s725025426", "s442401507" ]
u474423089
p03624
python
s630045577
s960385664
28
19
3,188
3,188
Accepted
Accepted
32.14
s=eval(input()) alph=[chr(i) for i in range(97,97+26)] for i in s: if i in alph: alph.remove(i) if alph: print((alph[0])) else: print("None")
s=list(set(eval(input()))) alph=[chr(i) for i in range(97,97+26)] for i in s: if i in alph: alph.remove(i) if alph: print((alph[0])) else: print("None")
9
9
161
172
s = eval(input()) alph = [chr(i) for i in range(97, 97 + 26)] for i in s: if i in alph: alph.remove(i) if alph: print((alph[0])) else: print("None")
s = list(set(eval(input()))) alph = [chr(i) for i in range(97, 97 + 26)] for i in s: if i in alph: alph.remove(i) if alph: print((alph[0])) else: print("None")
false
0
[ "-s = eval(input())", "+s = list(set(eval(input())))" ]
false
0.038153
0.040368
0.945152
[ "s630045577", "s960385664" ]
u799978560
p02819
python
s481981826
s138530196
23
17
3,060
2,940
Accepted
Accepted
26.09
s = int(eval(input())) if s <= 2: print((2)) exit() elif s <= 3: print((3)) exit() elif s <= 5: print((5)) exit() while True: for i in range(2,s // 2): if s % i == 0: break if i == s //2 -1: print(s) exit() s += 1
##C X = int(eval(input())) ##素数かどうか判定 from math import sqrt def is_prime(n): for i in range(2, int(sqrt(n))): if n % i == 0: return False else: return True while (not is_prime(X)): X += 1 print(X)
20
15
259
247
s = int(eval(input())) if s <= 2: print((2)) exit() elif s <= 3: print((3)) exit() elif s <= 5: print((5)) exit() while True: for i in range(2, s // 2): if s % i == 0: break if i == s // 2 - 1: print(s) exit() s += 1
##C X = int(eval(input())) ##素数かどうか判定 from math import sqrt def is_prime(n): for i in range(2, int(sqrt(n))): if n % i == 0: return False else: return True while not is_prime(X): X += 1 print(X)
false
25
[ "-s = int(eval(input()))", "-if s <= 2:", "- print((2))", "- exit()", "-elif s <= 3:", "- print((3))", "- exit()", "-elif s <= 5:", "- print((5))", "- exit()", "-while True:", "- for i in range(2, s // 2):", "- if s % i == 0:", "- break", "- if i...
false
0.039937
0.03876
1.030388
[ "s481981826", "s138530196" ]
u729133443
p02684
python
s747558892
s358682117
462
112
218,904
97,040
Accepted
Accepted
75.76
n,k,*a=map(int,open(0).read().split()) d=[0]+[-1]*n s=0 for i in range(k): s=a[s]-1 if(j:=d[s])>-1: exec((k-j)%(i+1-j)*'s=a[s]-1;') exit(print(s+1)) d[s]=i+1 print(s+1)
n,k,*a=list(map(int,open(0).read().split())) d=[2*k]*n s=0 while k:s=a[s]-1;d[s]=k=~-k%(d[s]+1-k) print((s+1))
10
5
191
106
n, k, *a = map(int, open(0).read().split()) d = [0] + [-1] * n s = 0 for i in range(k): s = a[s] - 1 if (j := d[s]) > -1: exec((k - j) % (i + 1 - j) * "s=a[s]-1;") exit(print(s + 1)) d[s] = i + 1 print(s + 1)
n, k, *a = list(map(int, open(0).read().split())) d = [2 * k] * n s = 0 while k: s = a[s] - 1 d[s] = k = ~-k % (d[s] + 1 - k) print((s + 1))
false
50
[ "-n, k, *a = map(int, open(0).read().split())", "-d = [0] + [-1] * n", "+n, k, *a = list(map(int, open(0).read().split()))", "+d = [2 * k] * n", "-for i in range(k):", "+while k:", "- if (j := d[s]) > -1:", "- exec((k - j) % (i + 1 - j) * \"s=a[s]-1;\")", "- exit(print(s + 1))", "...
false
0.036362
0.151607
0.239844
[ "s747558892", "s358682117" ]
u664373116
p03032
python
s765899308
s368584263
232
154
3,064
3,444
Accepted
Accepted
33.62
import heapq n,k=list(map(int,input().split())) a=list(map(int,input().split())) ans=0 for i in range(k+1): tmp=a[:i] for j in range(k+1-i): if i+j>n: cal=a.copy() zan=k-n else: cal=tmp+a[n-j:] zan=k-i-j heapq.heapify...
#n=int(input()) #n,m=list(map(int,input().split())) #a=list(map(int,input().split())) input_list = lambda : list(map(int,input().split())) from collections import Counter from collections import defaultdict from collections import deque import itertools import heapq import sys sys.setrecursionlimit(10**6) ...
23
43
544
1,036
import heapq n, k = list(map(int, input().split())) a = list(map(int, input().split())) ans = 0 for i in range(k + 1): tmp = a[:i] for j in range(k + 1 - i): if i + j > n: cal = a.copy() zan = k - n else: cal = tmp + a[n - j :] zan = k - i - j ...
# n=int(input()) # n,m=list(map(int,input().split())) # a=list(map(int,input().split())) input_list = lambda: list(map(int, input().split())) from collections import Counter from collections import defaultdict from collections import deque import itertools import heapq import sys sys.setrecursionlimit(10**6) n, m = in...
false
46.511628
[ "+# n=int(input())", "+# n,m=list(map(int,input().split()))", "+# a=list(map(int,input().split()))", "+input_list = lambda: list(map(int, input().split()))", "+from collections import Counter", "+from collections import defaultdict", "+from collections import deque", "+import itertools", "+import sy...
false
0.046977
0.046567
1.008797
[ "s765899308", "s368584263" ]
u357751375
p02911
python
s761744640
s203438763
303
192
11,768
13,680
Accepted
Accepted
36.63
N,K,Q = list(map(int,input().split())) A = [] L = [] for i in range(N): A.append(K - Q) for i in range(Q): L.append(int(eval(input()))) for i in range(Q): j = L[i] A[j - 1] += 1 for i in range(N): if A[i] <= 0: print('No') else: print('Yes')
n,k,q = list(map(int,input().split())) a = list(int(eval(input())) for i in range(q)) z = [0] * n for i in range(q): z[a[i]-1] += 1 for i in range(n): if z[i] >= q - k + 1: print('Yes') else: print('No')
16
10
285
228
N, K, Q = list(map(int, input().split())) A = [] L = [] for i in range(N): A.append(K - Q) for i in range(Q): L.append(int(eval(input()))) for i in range(Q): j = L[i] A[j - 1] += 1 for i in range(N): if A[i] <= 0: print("No") else: print("Yes")
n, k, q = list(map(int, input().split())) a = list(int(eval(input())) for i in range(q)) z = [0] * n for i in range(q): z[a[i] - 1] += 1 for i in range(n): if z[i] >= q - k + 1: print("Yes") else: print("No")
false
37.5
[ "-N, K, Q = list(map(int, input().split()))", "-A = []", "-L = []", "-for i in range(N):", "- A.append(K - Q)", "-for i in range(Q):", "- L.append(int(eval(input())))", "-for i in range(Q):", "- j = L[i]", "- A[j - 1] += 1", "-for i in range(N):", "- if A[i] <= 0:", "+n, k, q ...
false
0.072686
0.038239
1.900856
[ "s761744640", "s203438763" ]
u923668099
p02346
python
s914839661
s951160996
2,310
820
13,248
10,036
Accepted
Accepted
64.5
import sys inf = (1 << 31) - 1 def solve(): n, q = list(map(int, sys.stdin.readline().split())) sg = SegTree([0]*n) for qi in range(q): # print(sg.data) c, x, y = list(map(int, sys.stdin.readline().split())) if c == 0: x -= 1 sg.add(x, y) ...
import sys inf = (1 << 31) - 1 def solve(): n, q = list(map(int, sys.stdin.readline().split())) bit = BinaryIndexedTree([0]*n) for qi in range(q): c, x, y = list(map(int, sys.stdin.readline().split())) if c == 0: x -= 1 bit.add(x, y) else: ...
57
82
1,411
1,944
import sys inf = (1 << 31) - 1 def solve(): n, q = list(map(int, sys.stdin.readline().split())) sg = SegTree([0] * n) for qi in range(q): # print(sg.data) c, x, y = list(map(int, sys.stdin.readline().split())) if c == 0: x -= 1 sg.add(x, y) else: ...
import sys inf = (1 << 31) - 1 def solve(): n, q = list(map(int, sys.stdin.readline().split())) bit = BinaryIndexedTree([0] * n) for qi in range(q): c, x, y = list(map(int, sys.stdin.readline().split())) if c == 0: x -= 1 bit.add(x, y) else: ans...
false
30.487805
[ "- sg = SegTree([0] * n)", "+ bit = BinaryIndexedTree([0] * n)", "- # print(sg.data)", "- sg.add(x, y)", "+ bit.add(x, y)", "- x, y = x - 1, y - 1", "- ans = sg.get_sum(x, y + 1, 0, 0, 2**sg.depth)", "+ ans = bit.get_sum(y) - bit.get_...
false
0.036623
0.07445
0.491918
[ "s914839661", "s951160996" ]
u493520238
p02990
python
s722753187
s630966506
237
155
27,084
97,700
Accepted
Accepted
34.6
N_MAX = 200000 MOD = 10**9 + 7 fac, finv, inv = [0]*N_MAX, [0]*N_MAX, [0]*N_MAX def com_init(): fac[0], fac[1] = 1, 1 finv[0], finv[1] = 1, 1 inv[1] = 1 for i in range(2, N_MAX): fac[i] = fac[i - 1] * i % MOD inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD finv[i] = finv[i...
N_MAX = 10**6 MOD = 10**9 + 7 fac, finv, inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX def com_init(): fac[0], fac[1] = 1, 1 finv[0], finv[1] = 1, 1 inv[1] = 1 for i in range(2, N_MAX): fac[i] = fac[i - 1] * i % MOD inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD finv[i] = finv[i ...
35
37
911
908
N_MAX = 200000 MOD = 10**9 + 7 fac, finv, inv = [0] * N_MAX, [0] * N_MAX, [0] * N_MAX def com_init(): fac[0], fac[1] = 1, 1 finv[0], finv[1] = 1, 1 inv[1] = 1 for i in range(2, N_MAX): fac[i] = fac[i - 1] * i % MOD inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD finv[i] = finv[i...
N_MAX = 10**6 MOD = 10**9 + 7 fac, finv, inv = [0] * N_MAX, [0] * N_MAX, [0] * N_MAX def com_init(): fac[0], fac[1] = 1, 1 finv[0], finv[1] = 1, 1 inv[1] = 1 for i in range(2, N_MAX): fac[i] = fac[i - 1] * i % MOD inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD finv[i] = finv[i ...
false
5.405405
[ "-N_MAX = 200000", "+N_MAX = 10**6", "-def main():", "- n, k = list(map(int, input().split()))", "- if n == k:", "- for i in range(1, k + 1):", "- if i == 1:", "- print((1))", "- else:", "- print((0))", "- return", "- c...
false
0.444188
1.586758
0.279935
[ "s722753187", "s630966506" ]
u047796752
p02679
python
s811111241
s865574030
1,198
364
115,640
112,564
Accepted
Accepted
69.62
import sys input = sys.stdin.readline from collections import * from math import gcd N = int(eval(input())) cnt = defaultdict(int) abzero = 0 azero = 0 bzero = 0 for _ in range(N): A, B = list(map(int, input().split())) if A==0 and B==0: abzero += 1 continue elif A==0...
import sys input = sys.stdin.readline from collections import * from math import gcd N = int(eval(input())) cnt = defaultdict(int) abzero = 0 azero = 0 bzero = 0 for _ in range(N): A, B = list(map(int, input().split())) if A==0 and B==0: abzero += 1 continue elif A==0...
58
60
1,045
1,085
import sys input = sys.stdin.readline from collections import * from math import gcd N = int(eval(input())) cnt = defaultdict(int) abzero = 0 azero = 0 bzero = 0 for _ in range(N): A, B = list(map(int, input().split())) if A == 0 and B == 0: abzero += 1 continue elif A == 0: azero ...
import sys input = sys.stdin.readline from collections import * from math import gcd N = int(eval(input())) cnt = defaultdict(int) abzero = 0 azero = 0 bzero = 0 for _ in range(N): A, B = list(map(int, input().split())) if A == 0 and B == 0: abzero += 1 continue elif A == 0: azero ...
false
3.333333
[ "+ ans %= MOD", "+ ans %= MOD" ]
false
0.062218
0.089634
0.694131
[ "s811111241", "s865574030" ]
u933622697
p03013
python
s484547548
s697049474
179
58
11,884
11,884
Accepted
Accepted
67.6
N, M = list(map(int, input().split())) if M == 0: alist = set() else: alist = set(int(eval(input())) for _ in range(M)) dp = [0] * (N + 1) dp[0] = 1 dp[1] = 1 if 1 not in alist else 0 MOD = 10**9 + 7 for i in range(2, N + 1): if i in alist: continue dp[i] = (dp[i - 1] + dp[i - ...
import sys N, M = list(map(int, input().split())) if M == 0: alist = set() else: # Input below rows alist = set(map(int, sys.stdin)) dp = [0] * (N + 1) dp[0] = 1 dp[1] = 1 if 1 not in alist else 0 MOD = 10**9 + 7 for i in range(2, N + 1): if i in alist: continue dp[i] =...
18
21
334
360
N, M = list(map(int, input().split())) if M == 0: alist = set() else: alist = set(int(eval(input())) for _ in range(M)) dp = [0] * (N + 1) dp[0] = 1 dp[1] = 1 if 1 not in alist else 0 MOD = 10**9 + 7 for i in range(2, N + 1): if i in alist: continue dp[i] = (dp[i - 1] + dp[i - 2]) % MOD print((d...
import sys N, M = list(map(int, input().split())) if M == 0: alist = set() else: # Input below rows alist = set(map(int, sys.stdin)) dp = [0] * (N + 1) dp[0] = 1 dp[1] = 1 if 1 not in alist else 0 MOD = 10**9 + 7 for i in range(2, N + 1): if i in alist: continue dp[i] = (dp[i - 1] + dp[i - ...
false
14.285714
[ "+import sys", "+", "- alist = set(int(eval(input())) for _ in range(M))", "+ # Input below rows", "+ alist = set(map(int, sys.stdin))" ]
false
0.04105
0.041002
1.001163
[ "s484547548", "s697049474" ]
u086566114
p02381
python
s265467022
s607745876
20
10
6,516
6,536
Accepted
Accepted
50
while True: number_of_input = int(input()) if number_of_input == 0: break values = [float(x) for x in input().split()] second_moment = sum([x * x for x in values]) / number_of_input first_moment = sum([x for x in values]) / number_of_input print((second_moment - first_moment ** 2....
import math while True: number_of_input = int(input()) if number_of_input == 0: break values = [float(x) for x in input().split()] second_moment = sum([x ** 2.0 for x in values]) / number_of_input first_moment = sum([x for x in values]) / number_of_input print(math.sqrt(second_...
8
10
336
357
while True: number_of_input = int(input()) if number_of_input == 0: break values = [float(x) for x in input().split()] second_moment = sum([x * x for x in values]) / number_of_input first_moment = sum([x for x in values]) / number_of_input print((second_moment - first_moment**2.0) ** 0.5...
import math while True: number_of_input = int(input()) if number_of_input == 0: break values = [float(x) for x in input().split()] second_moment = sum([x**2.0 for x in values]) / number_of_input first_moment = sum([x for x in values]) / number_of_input print(math.sqrt(second_moment - fi...
false
20
[ "+import math", "+", "- second_moment = sum([x * x for x in values]) / number_of_input", "+ second_moment = sum([x**2.0 for x in values]) / number_of_input", "- print((second_moment - first_moment**2.0) ** 0.5)", "+ print(math.sqrt(second_moment - first_moment**2.0))" ]
false
0.037471
0.039444
0.949999
[ "s265467022", "s607745876" ]
u052332717
p03478
python
s781945020
s393198786
51
38
3,060
3,060
Accepted
Accepted
25.49
n,a,b = list(map(int,input().split())) count = 0 for i in range(n+1): if sum(list(map(int, list(str(i))))) >= a and sum(list(map(int, list(str(i))))) <= b: count += i print(count)
n,a,b = list(map(int,input().split())) ans = 0 for i in range(1,n+1): digit_list = list(map(int,list(str(i)))) if a<= sum(digit_list) <=b: ans += i print(ans)
9
9
200
178
n, a, b = list(map(int, input().split())) count = 0 for i in range(n + 1): if ( sum(list(map(int, list(str(i))))) >= a and sum(list(map(int, list(str(i))))) <= b ): count += i print(count)
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): digit_list = list(map(int, list(str(i)))) if a <= sum(digit_list) <= b: ans += i print(ans)
false
0
[ "-count = 0", "-for i in range(n + 1):", "- if (", "- sum(list(map(int, list(str(i))))) >= a", "- and sum(list(map(int, list(str(i))))) <= b", "- ):", "- count += i", "-print(count)", "+ans = 0", "+for i in range(1, n + 1):", "+ digit_list = list(map(int, list(str(i...
false
0.032669
0.038113
0.857166
[ "s781945020", "s393198786" ]
u691018832
p02675
python
s035736760
s169315684
57
24
61,664
9,048
Accepted
Accepted
57.89
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = readline().rstrip().decode()[::-1] memo = ['2', '4', '5', '7', '9'] memo1 = ['0', '1', '6', '8'] if n[0] in memo: print('hon') elif n[0] in memo1: p...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = read().rstrip().decode()[::-1] hon = ['2', '4', '5', '7', '9'] pon = ['0', '1', '6', '8'] if n[0] in hon: print('hon') elif n[0] in pon: print('pon'...
15
15
357
347
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n = readline().rstrip().decode()[::-1] memo = ["2", "4", "5", "7", "9"] memo1 = ["0", "1", "6", "8"] if n[0] in memo: print("hon") elif n[0] in memo1: print("pon") el...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) n = read().rstrip().decode()[::-1] hon = ["2", "4", "5", "7", "9"] pon = ["0", "1", "6", "8"] if n[0] in hon: print("hon") elif n[0] in pon: print("pon") else: pr...
false
0
[ "-n = readline().rstrip().decode()[::-1]", "-memo = [\"2\", \"4\", \"5\", \"7\", \"9\"]", "-memo1 = [\"0\", \"1\", \"6\", \"8\"]", "-if n[0] in memo:", "+n = read().rstrip().decode()[::-1]", "+hon = [\"2\", \"4\", \"5\", \"7\", \"9\"]", "+pon = [\"0\", \"1\", \"6\", \"8\"]", "+if n[0] in hon:", "-el...
false
0.049293
0.049096
1.004022
[ "s035736760", "s169315684" ]
u185896732
p03285
python
s096565371
s276275284
20
17
2,940
2,940
Accepted
Accepted
15
import sys n=int(eval(input())) for i in range(26): for j in range(16): if i*4+j*7==n: print("Yes") sys.exit() print("No")
n=int(eval(input())) for i in range(26): for j in range(24): if i*4+j*7==n: print("Yes") exit() print("No")
8
7
141
125
import sys n = int(eval(input())) for i in range(26): for j in range(16): if i * 4 + j * 7 == n: print("Yes") sys.exit() print("No")
n = int(eval(input())) for i in range(26): for j in range(24): if i * 4 + j * 7 == n: print("Yes") exit() print("No")
false
12.5
[ "-import sys", "-", "- for j in range(16):", "+ for j in range(24):", "- sys.exit()", "+ exit()" ]
false
0.041437
0.043362
0.955608
[ "s096565371", "s276275284" ]
u659640418
p03239
python
s109220244
s350316387
26
21
3,060
3,316
Accepted
Accepted
19.23
N, T = list(map(int, input().split())) c = [0]*N t = [0]*N for i in range(N): c[i], t[i] = list(map(int, input().split())) min_cost = 1001 for i in range(N): if t[i]<=T: min_cost = min(c[i],min_cost) if min_cost == 1001: print("TLE") else: print(min_cost)
N,T = list(map(int, input().split())) c = [0]*N t = [0]*N cost = 1001 for i in range(N): c[i], t[i] = list(map(int,input().split())) if t[i]<=T: cost = min(cost,c[i]) if cost == 1001: print("TLE") else: print(cost)
13
12
279
238
N, T = list(map(int, input().split())) c = [0] * N t = [0] * N for i in range(N): c[i], t[i] = list(map(int, input().split())) min_cost = 1001 for i in range(N): if t[i] <= T: min_cost = min(c[i], min_cost) if min_cost == 1001: print("TLE") else: print(min_cost)
N, T = list(map(int, input().split())) c = [0] * N t = [0] * N cost = 1001 for i in range(N): c[i], t[i] = list(map(int, input().split())) if t[i] <= T: cost = min(cost, c[i]) if cost == 1001: print("TLE") else: print(cost)
false
7.692308
[ "+cost = 1001", "-min_cost = 1001", "-for i in range(N):", "- min_cost = min(c[i], min_cost)", "-if min_cost == 1001:", "+ cost = min(cost, c[i])", "+if cost == 1001:", "- print(min_cost)", "+ print(cost)" ]
false
0.041837
0.048392
0.864546
[ "s109220244", "s350316387" ]
u277429554
p03012
python
s449297912
s511593937
33
25
9,124
9,132
Accepted
Accepted
24.24
# 129 B n = int(eval(input())) l = list(map(int, input().split())) diff = (100 ** 100) for t in range(len(l)): s1 = 0 s2 = 0 for i in range(len(l)): if i <= t: s1 += l[i] else: s2 += l[i] x = abs(s2 - s1) if x <= diff: diff = x...
n = int(eval(input())) w = list(map(int, input().split())) p = [0 for i in range(n)] p[0] = w[0] for i in range(1, n): p[i] = p[i-1] + w[i] diff = float('inf') for j in range(n): cd = abs(p[n-1] - (2*p[j])) diff = min(diff, cd) print(diff)
21
11
346
255
# 129 B n = int(eval(input())) l = list(map(int, input().split())) diff = 100**100 for t in range(len(l)): s1 = 0 s2 = 0 for i in range(len(l)): if i <= t: s1 += l[i] else: s2 += l[i] x = abs(s2 - s1) if x <= diff: diff = x print(diff)
n = int(eval(input())) w = list(map(int, input().split())) p = [0 for i in range(n)] p[0] = w[0] for i in range(1, n): p[i] = p[i - 1] + w[i] diff = float("inf") for j in range(n): cd = abs(p[n - 1] - (2 * p[j])) diff = min(diff, cd) print(diff)
false
47.619048
[ "-# 129 B", "-l = list(map(int, input().split()))", "-diff = 100**100", "-for t in range(len(l)):", "- s1 = 0", "- s2 = 0", "- for i in range(len(l)):", "- if i <= t:", "- s1 += l[i]", "- else:", "- s2 += l[i]", "- x = abs(s2 - s1)", "- if x...
false
0.040834
0.037684
1.083606
[ "s449297912", "s511593937" ]
u879870653
p03164
python
s547070311
s224098518
1,133
347
87,808
54,016
Accepted
Accepted
69.37
N,W = list(map(int,input().split())) L = [list(map(int,input().split())) for i in range(N)] supremum = 10**5 dp = [float("inf") for i in range(supremum+1)] dp[0] = 0 for i in range(N) : weight_i,value_i = L[i] for j in range(supremum,value_i-1,-1) : if dp[j-value_i] < float("inf") : ...
N,W = list(map(int,input().split())) L = [list(map(int,input().split())) for i in range(N)] supremum = 10**5 dp = [float("inf") for i in range(supremum+1)] dp[0] = 0 for i in range(N) : weight_i,value_i = L[i] for value in range(supremum,value_i-1,-1) : if dp[value-value_i] + weight_i ...
20
22
473
505
N, W = list(map(int, input().split())) L = [list(map(int, input().split())) for i in range(N)] supremum = 10**5 dp = [float("inf") for i in range(supremum + 1)] dp[0] = 0 for i in range(N): weight_i, value_i = L[i] for j in range(supremum, value_i - 1, -1): if dp[j - value_i] < float("inf"): ...
N, W = list(map(int, input().split())) L = [list(map(int, input().split())) for i in range(N)] supremum = 10**5 dp = [float("inf") for i in range(supremum + 1)] dp[0] = 0 for i in range(N): weight_i, value_i = L[i] for value in range(supremum, value_i - 1, -1): if dp[value - value_i] + weight_i <= W: ...
false
9.090909
[ "- for j in range(supremum, value_i - 1, -1):", "- if dp[j - value_i] < float(\"inf\"):", "- dp[j] = min(dp[j], dp[j - value_i] + weight_i)", "+ for value in range(supremum, value_i - 1, -1):", "+ if dp[value - value_i] + weight_i <= W:", "+ dp[value] = min(dp[val...
false
0.243715
0.344939
0.706545
[ "s547070311", "s224098518" ]
u352048883
p03162
python
s205255176
s567263224
937
714
22,772
47,384
Accepted
Accepted
23.8
N = int(eval(input())) ABC = (list(map(int, input().split())) for _ in range(N)) DP = [[0, 0, 0] for _ in range(N)] for i, abc in enumerate(ABC): if i == 0: for j in range(3): DP[i][j] = abc[j] else: for j in range(3): DP[i][j] = max(DP[i-1][k] + abc[j] for k in range(3) if j != k) ...
N, = list(map(int, input().split())) ABC = [list(map(int, input().split())) for i in range(N)] dp = [[0] * 3 for i in range(N)] for i in range(N): for j in range(3): if i - 1 < 0: dp[i][j] += ABC[i][j] else: x = (j + 1) % 3 y = (j + 2) % 3 dp[i][j] = max(dp[i-1][x], dp[...
14
16
336
364
N = int(eval(input())) ABC = (list(map(int, input().split())) for _ in range(N)) DP = [[0, 0, 0] for _ in range(N)] for i, abc in enumerate(ABC): if i == 0: for j in range(3): DP[i][j] = abc[j] else: for j in range(3): DP[i][j] = max(DP[i - 1][k] + abc[j] for k in range(3...
(N,) = list(map(int, input().split())) ABC = [list(map(int, input().split())) for i in range(N)] dp = [[0] * 3 for i in range(N)] for i in range(N): for j in range(3): if i - 1 < 0: dp[i][j] += ABC[i][j] else: x = (j + 1) % 3 y = (j + 2) % 3 dp[i][j] =...
false
12.5
[ "-N = int(eval(input()))", "-ABC = (list(map(int, input().split())) for _ in range(N))", "-DP = [[0, 0, 0] for _ in range(N)]", "-for i, abc in enumerate(ABC):", "- if i == 0:", "- for j in range(3):", "- DP[i][j] = abc[j]", "- else:", "- for j in range(3):", "- ...
false
0.041446
0.04191
0.988929
[ "s205255176", "s567263224" ]
u952708174
p03944
python
s624222121
s536970671
75
17
3,064
3,064
Accepted
Accepted
77.33
W,H,N = [int(i) for i in input().split()] rect = [[0]*W for _ in range(H)] for _ in range(N): x,y,a = [int(i) for i in input().split()] if a==1: for w in range(x): for h in range(H): rect[h][w]=1 elif a==2: for w in range(x,W): for h in range(H): rect[h][w]=1 elif...
W, H, N = [int(i) for i in input().split()] top, bottom, left, right = H, 0, 0, W for _ in range(N): x, y, a = [int(i) for i in input().split()] if a == 1: left = max(left, x) elif a == 2: right = min(right, x) elif a == 3: bottom = max(bottom, y) elif a == 4: ...
26
13
590
393
W, H, N = [int(i) for i in input().split()] rect = [[0] * W for _ in range(H)] for _ in range(N): x, y, a = [int(i) for i in input().split()] if a == 1: for w in range(x): for h in range(H): rect[h][w] = 1 elif a == 2: for w in range(x, W): for h in ra...
W, H, N = [int(i) for i in input().split()] top, bottom, left, right = H, 0, 0, W for _ in range(N): x, y, a = [int(i) for i in input().split()] if a == 1: left = max(left, x) elif a == 2: right = min(right, x) elif a == 3: bottom = max(bottom, y) elif a == 4: top = m...
false
50
[ "-rect = [[0] * W for _ in range(H)]", "+top, bottom, left, right = H, 0, 0, W", "- for w in range(x):", "- for h in range(H):", "- rect[h][w] = 1", "+ left = max(left, x)", "- for w in range(x, W):", "- for h in range(H):", "- ...
false
0.119539
0.041709
2.866014
[ "s624222121", "s536970671" ]
u762420987
p02773
python
s452048244
s419061823
678
601
43,476
35,584
Accepted
Accepted
11.36
from collections import Counter N = int(eval(input())) Sc = Counter([eval(input()) for _ in range(N)]).most_common() # print(Sc) max_num = Sc[0][1] ans = [] for key, val in Sc: if val == max_num: ans.append(key) ans.sort() for t in ans: print(t)
N = int(input()) from collections import Counter Sc = Counter([input() for _ in range(N)]) max_count = max(Sc.values()) ans = sorted([k for k, v in Sc.items() if v == max_count]) print(*ans, sep="\n")
12
6
260
205
from collections import Counter N = int(eval(input())) Sc = Counter([eval(input()) for _ in range(N)]).most_common() # print(Sc) max_num = Sc[0][1] ans = [] for key, val in Sc: if val == max_num: ans.append(key) ans.sort() for t in ans: print(t)
N = int(input()) from collections import Counter Sc = Counter([input() for _ in range(N)]) max_count = max(Sc.values()) ans = sorted([k for k, v in Sc.items() if v == max_count]) print(*ans, sep="\n")
false
50
[ "+N = int(input())", "-N = int(eval(input()))", "-Sc = Counter([eval(input()) for _ in range(N)]).most_common()", "-# print(Sc)", "-max_num = Sc[0][1]", "-ans = []", "-for key, val in Sc:", "- if val == max_num:", "- ans.append(key)", "-ans.sort()", "-for t in ans:", "- print(t)",...
false
0.047783
0.045736
1.044761
[ "s452048244", "s419061823" ]
u076917070
p03162
python
s224740674
s024521048
201
166
3,060
3,064
Accepted
Accepted
17.41
import sys input=sys.stdin.readline def main(): N = int(eval(input())) a1,b1,c1 = 0,0,0 for _ in range(N): a,b,c = list(map(int, input().split())) a0,b0,c0 = a1,b1,c1 a1 = max(b0, c0) + a # b or c => a b1 = max(a0, c0) + b # a or c => b c1 = max(a0, b0) + ...
import sys input=sys.stdin.readline def main(): N = int(eval(input())) a1,b1,c1 = 0,0,0 for _ in range(N): a,b,c = list(map(int, input().split())) a0,b0,c0 = a1,b1,c1 a1 = a + (b0 if b0 > c0 else c0) b1 = b + (a0 if a0 > c0 else c0) c1 = c + (a0 if a0 > b0...
17
17
394
388
import sys input = sys.stdin.readline def main(): N = int(eval(input())) a1, b1, c1 = 0, 0, 0 for _ in range(N): a, b, c = list(map(int, input().split())) a0, b0, c0 = a1, b1, c1 a1 = max(b0, c0) + a # b or c => a b1 = max(a0, c0) + b # a or c => b c1 = max(a0, b...
import sys input = sys.stdin.readline def main(): N = int(eval(input())) a1, b1, c1 = 0, 0, 0 for _ in range(N): a, b, c = list(map(int, input().split())) a0, b0, c0 = a1, b1, c1 a1 = a + (b0 if b0 > c0 else c0) b1 = b + (a0 if a0 > c0 else c0) c1 = c + (a0 if a0 >...
false
0
[ "- a1 = max(b0, c0) + a # b or c => a", "- b1 = max(a0, c0) + b # a or c => b", "- c1 = max(a0, b0) + c # a or b => c", "+ a1 = a + (b0 if b0 > c0 else c0)", "+ b1 = b + (a0 if a0 > c0 else c0)", "+ c1 = c + (a0 if a0 > b0 else b0)" ]
false
0.00774
0.040154
0.192772
[ "s224740674", "s024521048" ]
u920204936
p02768
python
s103833563
s672823128
1,679
189
18,792
3,064
Accepted
Accepted
88.74
import math n,a,b = list(map(int,input().split())) def mod_inv(x,mod): return pow(x,mod-2,mod) def mod_inv_table(k): table = [-1] * (k+1) for i in range(1,k+1): table[i] = mod_inv(i,10**9+7) return table def binomial(n,k,table): ret = 1 for i in range(k): ret ...
n,a,b = list(map(int,input().split())) mod = 10**9 + 7 aue,bue = 1,1 for i in range(a): aue = aue * (n-i) % mod for i in range(b): bue = bue * (n-i) % mod asita,bsita = 1,1 for i in range(1,a+1): asita = asita*i %mod for i in range(1,b+1): bsita = bsita*i %mod at = aue * pow(asita,mod-2,mod)...
29
17
569
399
import math n, a, b = list(map(int, input().split())) def mod_inv(x, mod): return pow(x, mod - 2, mod) def mod_inv_table(k): table = [-1] * (k + 1) for i in range(1, k + 1): table[i] = mod_inv(i, 10**9 + 7) return table def binomial(n, k, table): ret = 1 for i in range(k): ...
n, a, b = list(map(int, input().split())) mod = 10**9 + 7 aue, bue = 1, 1 for i in range(a): aue = aue * (n - i) % mod for i in range(b): bue = bue * (n - i) % mod asita, bsita = 1, 1 for i in range(1, a + 1): asita = asita * i % mod for i in range(1, b + 1): bsita = bsita * i % mod at = aue * pow(asita...
false
41.37931
[ "-import math", "-", "-", "-", "-def mod_inv(x, mod):", "- return pow(x, mod - 2, mod)", "-", "-", "-def mod_inv_table(k):", "- table = [-1] * (k + 1)", "- for i in range(1, k + 1):", "- table[i] = mod_inv(i, 10**9 + 7)", "- return table", "-", "-", "-def binomial(n,...
false
0.891669
0.127546
6.990942
[ "s103833563", "s672823128" ]
u970197315
p02981
python
s622771365
s709396710
19
17
2,940
2,940
Accepted
Accepted
10.53
# -*- coding: utf-8 -*- N,A,B = list(map(int,input().split())) train = N*A taxi = B result = train - taxi if result >= 0: print(taxi) else: print(train)
n,a,b=list(map(int,input().split())) train=a*n taxi=b print((min(train,taxi)))
10
4
165
73
# -*- coding: utf-8 -*- N, A, B = list(map(int, input().split())) train = N * A taxi = B result = train - taxi if result >= 0: print(taxi) else: print(train)
n, a, b = list(map(int, input().split())) train = a * n taxi = b print((min(train, taxi)))
false
60
[ "-# -*- coding: utf-8 -*-", "-N, A, B = list(map(int, input().split()))", "-train = N * A", "-taxi = B", "-result = train - taxi", "-if result >= 0:", "- print(taxi)", "-else:", "- print(train)", "+n, a, b = list(map(int, input().split()))", "+train = a * n", "+taxi = b", "+print((min(...
false
0.068536
0.063597
1.077654
[ "s622771365", "s709396710" ]
u279460955
p03281
python
s545091829
s134544043
283
64
63,340
62,312
Accepted
Accepted
77.39
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from itertools import permutations, accumulate, combinations, combinations_with_replacement from math import sqrt, ceil, floor, factorial from bisect import bisect_left, bisect_right, insort_left, insort_right from cop...
from math import ceil, sqrt def prime_factorize_tuple(n): ret = [] tmp = n for i in range(2, ceil(sqrt(n))): if tmp % i == 0: count = 0 while tmp % i == 0: count += 1 tmp //= i ret.append((i, count)) if tmp != 1: ...
40
30
1,466
623
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from itertools import ( permutations, accumulate, combinations, combinations_with_replacement, ) from math import sqrt, ceil, floor, factorial from bisect import bisect_left, bisect_right, insort_left, insor...
from math import ceil, sqrt def prime_factorize_tuple(n): ret = [] tmp = n for i in range(2, ceil(sqrt(n))): if tmp % i == 0: count = 0 while tmp % i == 0: count += 1 tmp //= i ret.append((i, count)) if tmp != 1: ret.a...
false
25
[ "-from collections import defaultdict, deque, Counter", "-from heapq import heappush, heappop, heapify", "-from itertools import (", "- permutations,", "- accumulate,", "- combinations,", "- combinations_with_replacement,", "-)", "-from math import sqrt, ceil, floor, factorial", "-from...
false
0.065014
0.037954
1.712956
[ "s545091829", "s134544043" ]
u802537549
p02397
python
s582703666
s258980234
60
50
7,492
7,672
Accepted
Accepted
16.67
while True: a, b = list(map(int, input().split())) if a == 0 and b == 0: break if a < b: print((a, b)) else: print((b, a))
while True: a, b = sorted(map(int, input().split())) if a == 0 and b == 0: break print((a, b))
8
5
159
116
while True: a, b = list(map(int, input().split())) if a == 0 and b == 0: break if a < b: print((a, b)) else: print((b, a))
while True: a, b = sorted(map(int, input().split())) if a == 0 and b == 0: break print((a, b))
false
37.5
[ "- a, b = list(map(int, input().split()))", "+ a, b = sorted(map(int, input().split()))", "- if a < b:", "- print((a, b))", "- else:", "- print((b, a))", "+ print((a, b))" ]
false
0.047045
0.038081
1.235409
[ "s582703666", "s258980234" ]
u006657459
p03625
python
s819683706
s432080075
168
94
21,540
14,252
Accepted
Accepted
44.05
from collections import Counter N = int(eval(input())) A = [int(Ai) for Ai in input().split()] c = Counter(A).most_common() c.sort(key=lambda x: x[0], reverse=True) e1 = None result = None for k, v in c: if e1 is None and v >= 4: result = k**2 break elif v >= 2: if e1 is None...
N = int(eval(input())) A = sorted([int(Ai) for Ai in input().split()], reverse=True) x, y = 0, 0 current = A[0] for Ai in A[1:]: if current is None or current != Ai: current = Ai else: if x == 0: x = current current = None else: y = current...
21
15
462
347
from collections import Counter N = int(eval(input())) A = [int(Ai) for Ai in input().split()] c = Counter(A).most_common() c.sort(key=lambda x: x[0], reverse=True) e1 = None result = None for k, v in c: if e1 is None and v >= 4: result = k**2 break elif v >= 2: if e1 is None: ...
N = int(eval(input())) A = sorted([int(Ai) for Ai in input().split()], reverse=True) x, y = 0, 0 current = A[0] for Ai in A[1:]: if current is None or current != Ai: current = Ai else: if x == 0: x = current current = None else: y = current ...
false
28.571429
[ "-from collections import Counter", "-", "-A = [int(Ai) for Ai in input().split()]", "-c = Counter(A).most_common()", "-c.sort(key=lambda x: x[0], reverse=True)", "-e1 = None", "-result = None", "-for k, v in c:", "- if e1 is None and v >= 4:", "- result = k**2", "- break", "-...
false
0.048811
0.040473
1.206025
[ "s819683706", "s432080075" ]
u533558052
p02993
python
s974199211
s756812317
162
35
5,764
5,124
Accepted
Accepted
78.4
#!/usr/bin/env python3 #!/usr/bin/env pypy3 import sys sys.dont_write_bytecode = True stdin = sys.stdin input = stdin.readline sys.setrecursionlimit(10000000) #import numpy as np #import scipy as sp # Python 3 modules: https://docs.python.org/3/library/ import math, itertools, operator from math impo...
#!/usr/bin/env python3 #!/usr/bin/env pypy3 from math import * def main(): import sys sys.dont_write_bytecode = True sys.setrecursionlimit(10000000) from sys import stdin, stdout, stderr input = stdin.readline #import numpy as np #import scipy as sp # Python 3 modules:...
63
78
1,535
2,119
#!/usr/bin/env python3 #!/usr/bin/env pypy3 import sys sys.dont_write_bytecode = True stdin = sys.stdin input = stdin.readline sys.setrecursionlimit(10000000) # import numpy as np # import scipy as sp # Python 3 modules: https://docs.python.org/3/library/ import math, itertools, operator from math import * from math i...
#!/usr/bin/env python3 #!/usr/bin/env pypy3 from math import * def main(): import sys sys.dont_write_bytecode = True sys.setrecursionlimit(10000000) from sys import stdin, stdout, stderr input = stdin.readline # import numpy as np # import scipy as sp # Python 3 modules: https://docs...
false
19.230769
[ "-import sys", "-", "-sys.dont_write_bytecode = True", "-stdin = sys.stdin", "-input = stdin.readline", "-sys.setrecursionlimit(10000000)", "-# import numpy as np", "-# import scipy as sp", "-# Python 3 modules: https://docs.python.org/3/library/", "-import math, itertools, operator", "-from mat...
false
0.044101
0.092824
0.475099
[ "s974199211", "s756812317" ]
u533232830
p02598
python
s519017853
s179342599
1,832
1,263
31,072
31,048
Accepted
Accepted
31.06
import math n, k = list(map(int, input().split())) A = list(map(int, input().split())) l = 1 r = 10**9+1 while l < r: mid = (l+r)//2 count = 0 for i in range(n): if A[i] > mid: count += math.ceil(A[i]/mid-1) if count <= k: r = mid else: l = m...
n, k = list(map(int, input().split())) A = list(map(int, input().split())) l = 1 r = 10**9+1 while l < r: mid = (l+r)//2 count = 0 for i in range(n): if A[i] > mid: count += A[i]//mid if count <= k: r = mid else: l = mid+1 print(l)
22
20
333
305
import math n, k = list(map(int, input().split())) A = list(map(int, input().split())) l = 1 r = 10**9 + 1 while l < r: mid = (l + r) // 2 count = 0 for i in range(n): if A[i] > mid: count += math.ceil(A[i] / mid - 1) if count <= k: r = mid else: l = mid + 1 prin...
n, k = list(map(int, input().split())) A = list(map(int, input().split())) l = 1 r = 10**9 + 1 while l < r: mid = (l + r) // 2 count = 0 for i in range(n): if A[i] > mid: count += A[i] // mid if count <= k: r = mid else: l = mid + 1 print(l)
false
9.090909
[ "-import math", "-", "- count += math.ceil(A[i] / mid - 1)", "+ count += A[i] // mid" ]
false
0.047222
0.045889
1.029042
[ "s519017853", "s179342599" ]
u703528810
p02659
python
s362102170
s543949041
30
25
9,928
9,152
Accepted
Accepted
16.67
from decimal import * A,B=list(map(Decimal,input().split())) print((Decimal(str(A*B)).quantize(Decimal('1'), rounding=ROUND_DOWN)))
a,b=input().split() a=int(a) b=int(float(b)*1000) print((int(a*b//1000)))
5
4
129
74
from decimal import * A, B = list(map(Decimal, input().split())) print((Decimal(str(A * B)).quantize(Decimal("1"), rounding=ROUND_DOWN)))
a, b = input().split() a = int(a) b = int(float(b) * 1000) print((int(a * b // 1000)))
false
20
[ "-from decimal import *", "-", "-A, B = list(map(Decimal, input().split()))", "-print((Decimal(str(A * B)).quantize(Decimal(\"1\"), rounding=ROUND_DOWN)))", "+a, b = input().split()", "+a = int(a)", "+b = int(float(b) * 1000)", "+print((int(a * b // 1000)))" ]
false
0.044507
0.041934
1.061372
[ "s362102170", "s543949041" ]
u706695185
p03282
python
s985494898
s487409190
168
19
38,256
3,060
Accepted
Accepted
88.69
s=eval(input()) k=int(eval(input())) if sum(list(map(int, s[:k]))) == len(s[:k]): print((1)) exit() for si in s: if si!='1': break print(si)
s=eval(input()) k=int(eval(input())) if len(s) >= k and sum(list(map(int, s[:k]))) == len(s[:k]): print((1)) exit() for si in s: if int(si) > 1: print(si) exit()
11
9
159
183
s = eval(input()) k = int(eval(input())) if sum(list(map(int, s[:k]))) == len(s[:k]): print((1)) exit() for si in s: if si != "1": break print(si)
s = eval(input()) k = int(eval(input())) if len(s) >= k and sum(list(map(int, s[:k]))) == len(s[:k]): print((1)) exit() for si in s: if int(si) > 1: print(si) exit()
false
18.181818
[ "-if sum(list(map(int, s[:k]))) == len(s[:k]):", "+if len(s) >= k and sum(list(map(int, s[:k]))) == len(s[:k]):", "- if si != \"1\":", "- break", "-print(si)", "+ if int(si) > 1:", "+ print(si)", "+ exit()" ]
false
0.076012
0.036018
2.110397
[ "s985494898", "s487409190" ]
u790710233
p02762
python
s939613563
s322043875
1,115
1,020
61,072
37,952
Accepted
Accepted
8.52
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m, k = list(map(int, input().split())) class UnionFind: def __init__(self, n): self.p = [-1]*n self.c = None def find(self, x): if self.p[x] < 0: return x else: self.p[...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m, k = list(map(int, input().split())) class UnionFind: def __init__(self, n): self.p = [-1]*n # union by rank self.r = [1]*n def find(self, x): if self.p[x] < 0: return x ...
50
63
1,084
1,347
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m, k = list(map(int, input().split())) class UnionFind: def __init__(self, n): self.p = [-1] * n self.c = None def find(self, x): if self.p[x] < 0: return x else: self.p[x] = self.fi...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m, k = list(map(int, input().split())) class UnionFind: def __init__(self, n): self.p = [-1] * n # union by rank self.r = [1] * n def find(self, x): if self.p[x] < 0: return x else: ...
false
20.634921
[ "- self.c = None", "+ # union by rank", "+ self.r = [1] * n", "+ if self.r[rx] > self.r[ry]:", "+ rx, ry = ry, rx", "+ if self.r[rx] == self.r[ry]:", "+ self.r[ry] += 1", "+", "+ def same(self, x, y):", "+ return se...
false
0.069801
0.102195
0.683019
[ "s939613563", "s322043875" ]
u732870425
p03370
python
s961063201
s925891918
365
17
3,060
2,940
Accepted
Accepted
95.34
n, x = list(map(int, input().split())) m = [int(eval(input())) for _ in range(n)] Xrest = x - sum(m) ans = len(m) while Xrest >= min(m): Xrest -= min(m) ans += 1 print(ans)
n, x = list(map(int, input().split())) m = [int(eval(input())) for _ in range(n)] print((n+(x-sum(m))//min(m)))
10
3
179
99
n, x = list(map(int, input().split())) m = [int(eval(input())) for _ in range(n)] Xrest = x - sum(m) ans = len(m) while Xrest >= min(m): Xrest -= min(m) ans += 1 print(ans)
n, x = list(map(int, input().split())) m = [int(eval(input())) for _ in range(n)] print((n + (x - sum(m)) // min(m)))
false
70
[ "-Xrest = x - sum(m)", "-ans = len(m)", "-while Xrest >= min(m):", "- Xrest -= min(m)", "- ans += 1", "-print(ans)", "+print((n + (x - sum(m)) // min(m)))" ]
false
0.040138
0.035414
1.133412
[ "s961063201", "s925891918" ]
u440180827
p02382
python
s978701806
s235156586
30
20
7,816
7,844
Accepted
Accepted
33.33
n = int(eval(input())) x = [0] + list(map(int, input().split())) y = [0] + list(map(int, input().split())) tmp = [[0 for i in range(3)] for j in range(n+1)] max = 0 for i in range(1, n+1, 1): absDiff = abs(x[i]-y[i]) tmp[i][0] += tmp[i-1][0] + absDiff tmp[i][1] += tmp[i-1][1] + absDiff ** 2 tmp...
n = int(eval(input())) x = [0] + list(map(int, input().split())) y = [0] + list(map(int, input().split())) tmp = [[0 for i in range(3)] for j in range(n+1)] max = 0 for i in range(1, n+1, 1): absDiff = abs(x[i]-y[i]) absDiff2 = absDiff * absDiff absDiff3 = absDiff2 * absDiff tmp[i][0] += tmp[i-...
16
18
480
541
n = int(eval(input())) x = [0] + list(map(int, input().split())) y = [0] + list(map(int, input().split())) tmp = [[0 for i in range(3)] for j in range(n + 1)] max = 0 for i in range(1, n + 1, 1): absDiff = abs(x[i] - y[i]) tmp[i][0] += tmp[i - 1][0] + absDiff tmp[i][1] += tmp[i - 1][1] + absDiff**2 tmp[...
n = int(eval(input())) x = [0] + list(map(int, input().split())) y = [0] + list(map(int, input().split())) tmp = [[0 for i in range(3)] for j in range(n + 1)] max = 0 for i in range(1, n + 1, 1): absDiff = abs(x[i] - y[i]) absDiff2 = absDiff * absDiff absDiff3 = absDiff2 * absDiff tmp[i][0] += tmp[i - 1...
false
11.111111
[ "+ absDiff2 = absDiff * absDiff", "+ absDiff3 = absDiff2 * absDiff", "- tmp[i][1] += tmp[i - 1][1] + absDiff**2", "- tmp[i][2] += tmp[i - 1][2] + absDiff**3", "+ tmp[i][1] += tmp[i - 1][1] + absDiff2", "+ tmp[i][2] += tmp[i - 1][2] + absDiff3" ]
false
0.100715
0.07672
1.312751
[ "s978701806", "s235156586" ]
u591503175
p03167
python
s926964976
s163424042
762
702
166,096
52,332
Accepted
Accepted
7.87
H, W = [int(item) for item in input().split()] grid = [[item for item in input().strip()] for _ in range(H)] # print(H, W) # print(grid) dp = [[0 for _ in range(W+1)] for _ in range(H+1)] dp[0][1] = 1 for i in range(H): for j in range(W): if grid[i][j] == '#': pass else:...
H, W = [int(item) for item in input().split()] grid = [[item for item in input().strip()] for _ in range(H)] # print(H, W) # print(grid) dp = [[0 for _ in range(W+1)] for _ in range(H+1)] dp[0][1] = 1 for i in range(H): for j in range(W): if grid[i][j] == '#': pass else:...
17
17
401
403
H, W = [int(item) for item in input().split()] grid = [[item for item in input().strip()] for _ in range(H)] # print(H, W) # print(grid) dp = [[0 for _ in range(W + 1)] for _ in range(H + 1)] dp[0][1] = 1 for i in range(H): for j in range(W): if grid[i][j] == "#": pass else: ...
H, W = [int(item) for item in input().split()] grid = [[item for item in input().strip()] for _ in range(H)] # print(H, W) # print(grid) dp = [[0 for _ in range(W + 1)] for _ in range(H + 1)] dp[0][1] = 1 for i in range(H): for j in range(W): if grid[i][j] == "#": pass else: ...
false
0
[ "- dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j]", "-print((dp[H][W] % (10**9 + 7)))", "+ dp[i + 1][j + 1] = (dp[i][j + 1] + dp[i + 1][j]) % (10**9 + 7)", "+print((dp[H][W]))" ]
false
0.099901
0.037305
2.677944
[ "s926964976", "s163424042" ]
u857605629
p03998
python
s153411044
s567899379
32
11
2,696
2,568
Accepted
Accepted
65.62
sa = input() sb = input() sc = input() st = [sa,sb,sc] lns = [len(sa),len(sb),len(sc)] ind = [0,0,0] cur = 0 done = False winner = "a" dumb = ["A","B","C"] while (not done): if (ind[cur] >= lns[cur]): winner = dumb[cur] done = True break else: x = st[cur][ind[cur]...
cards = [] for i in range(3): cards.append(input()) inds = [0,0,0] win = ['A','B','C'] cur = 0 while True: if inds[cur] >= len(cards[cur]): print(win[cur]) break else: temp = cards[cur][inds[cur]] inds[cur] += 1 if temp == 'a': cur = 0 elif temp == 'b': cur = 1 else: cur = 2
26
19
516
323
sa = input() sb = input() sc = input() st = [sa, sb, sc] lns = [len(sa), len(sb), len(sc)] ind = [0, 0, 0] cur = 0 done = False winner = "a" dumb = ["A", "B", "C"] while not done: if ind[cur] >= lns[cur]: winner = dumb[cur] done = True break else: x = st[cur][ind[cur]] in...
cards = [] for i in range(3): cards.append(input()) inds = [0, 0, 0] win = ["A", "B", "C"] cur = 0 while True: if inds[cur] >= len(cards[cur]): print(win[cur]) break else: temp = cards[cur][inds[cur]] inds[cur] += 1 if temp == "a": cur = 0 elif tem...
false
26.923077
[ "-sa = input()", "-sb = input()", "-sc = input()", "-st = [sa, sb, sc]", "-lns = [len(sa), len(sb), len(sc)]", "-ind = [0, 0, 0]", "+cards = []", "+for i in range(3):", "+ cards.append(input())", "+inds = [0, 0, 0]", "+win = [\"A\", \"B\", \"C\"]", "-done = False", "-winner = \"a\"", "-...
false
0.055825
0.056199
0.993348
[ "s153411044", "s567899379" ]
u627803856
p02953
python
s751199198
s636785407
215
84
63,984
14,396
Accepted
Accepted
60.93
n=int(eval(input())) h=list(map(int,input().split())) h=h[::-1] for i in range(n-1): if h[i+1]-h[i]>1: print('No') exit() elif h[i+1]-h[i]==1: h[i+1] -= 1 else: pass print('Yes')
n = int(eval(input())) h = list(map(int, input().split())) for i in range(1, n): if h[i] > h[i - 1]: h[i] -= 1 if h[i] < h[i - 1]: print('No') exit() print('Yes')
12
11
228
200
n = int(eval(input())) h = list(map(int, input().split())) h = h[::-1] for i in range(n - 1): if h[i + 1] - h[i] > 1: print("No") exit() elif h[i + 1] - h[i] == 1: h[i + 1] -= 1 else: pass print("Yes")
n = int(eval(input())) h = list(map(int, input().split())) for i in range(1, n): if h[i] > h[i - 1]: h[i] -= 1 if h[i] < h[i - 1]: print("No") exit() print("Yes")
false
8.333333
[ "-h = h[::-1]", "-for i in range(n - 1):", "- if h[i + 1] - h[i] > 1:", "+for i in range(1, n):", "+ if h[i] > h[i - 1]:", "+ h[i] -= 1", "+ if h[i] < h[i - 1]:", "- elif h[i + 1] - h[i] == 1:", "- h[i + 1] -= 1", "- else:", "- pass" ]
false
0.11254
0.187054
0.601648
[ "s751199198", "s636785407" ]
u844646164
p02937
python
s299711106
s940880312
270
123
60,400
87,984
Accepted
Accepted
54.44
import bisect s = list(eval(input())) t = list(eval(input())) n = len(s) m = len(t) alphabet = [[] for _ in range(26)] for i in range(n): alphabet[ord(s[i])-ord('a')] += [i] loop = 0 pre = -1 for i in range(m): c = ord(t[i]) - ord('a') if len(alphabet[c]) == 0: print((-1)) exit() idx = b...
import bisect s = list(eval(input())) t = list(eval(input())) if len(set(t)-set(s)) > 0: print((-1)) exit() c = set(s) dic = {} for char in c: dic[char] = [] for i in range(len(s)): dic[s[i]] += [i] last = -1 r = 0 for char in t: tmp = last idx = bisect.bisect_right(dic[char], last) ...
23
29
481
449
import bisect s = list(eval(input())) t = list(eval(input())) n = len(s) m = len(t) alphabet = [[] for _ in range(26)] for i in range(n): alphabet[ord(s[i]) - ord("a")] += [i] loop = 0 pre = -1 for i in range(m): c = ord(t[i]) - ord("a") if len(alphabet[c]) == 0: print((-1)) exit() idx ...
import bisect s = list(eval(input())) t = list(eval(input())) if len(set(t) - set(s)) > 0: print((-1)) exit() c = set(s) dic = {} for char in c: dic[char] = [] for i in range(len(s)): dic[s[i]] += [i] last = -1 r = 0 for char in t: tmp = last idx = bisect.bisect_right(dic[char], last) if id...
false
20.689655
[ "-n = len(s)", "-m = len(t)", "-alphabet = [[] for _ in range(26)]", "-for i in range(n):", "- alphabet[ord(s[i]) - ord(\"a\")] += [i]", "-loop = 0", "-pre = -1", "-for i in range(m):", "- c = ord(t[i]) - ord(\"a\")", "- if len(alphabet[c]) == 0:", "- print((-1))", "- ex...
false
0.044759
0.049033
0.912828
[ "s299711106", "s940880312" ]
u654470292
p02707
python
s991139494
s048089515
205
148
89,684
104,068
Accepted
Accepted
27.8
import sys from collections import * import heapq import math from math import gcd import bisect import copy from itertools import permutations,accumulate,combinations,product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) mod=pow(10,9)+7 al=[chr(or...
import bisect, copy, heapq, math, sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) def celi(a,b): return -(-a//b) sys....
24
22
548
565
import sys from collections import * import heapq import math from math import gcd import bisect import copy from itertools import permutations, accumulate, combinations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0] + list(accumulate(lst)) mod = pow(10, 9) + 7 al = [c...
import bisect, copy, heapq, math, sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0] + list(accumulate(lst)) def celi(a, b): return -(-a // b) s...
false
8.333333
[ "-import sys", "+import bisect, copy, heapq, math, sys", "-import heapq", "-import math", "-from math import gcd", "-import bisect", "-import copy", "-from itertools import permutations, accumulate, combinations, product", "+from functools import lru_cache", "+from itertools import accumulate, com...
false
0.095176
0.039147
2.43122
[ "s991139494", "s048089515" ]
u195054737
p03163
python
s826527030
s702758678
1,886
218
94,668
16,276
Accepted
Accepted
88.44
import sys import numpy as np import itertools import heapq import bisect import math import queue from operator import itemgetter #sortedの対象を決めたい from fractions import gcd #最大公約数 from copy import deepcopy #参照で影響されないコピー from collections import Counter, deque, defaultdict #要素ごとの出現回数、双方向アクセス可能データ型 from functoo...
import sys import numpy as np import itertools import heapq import bisect import math import queue from operator import itemgetter #sortedの対象を決めたい from fractions import gcd #最大公約数 from copy import deepcopy #参照で影響されないコピー from collections import Counter, deque, defaultdict #要素ごとの出現回数、双方向アクセス可能データ型 from functoo...
83
81
2,049
1,952
import sys import numpy as np import itertools import heapq import bisect import math import queue from operator import itemgetter # sortedの対象を決めたい from fractions import gcd # 最大公約数 from copy import deepcopy # 参照で影響されないコピー from collections import Counter, deque, defaultdict # 要素ごとの出現回数、双方向アクセス可能データ型 from functools ...
import sys import numpy as np import itertools import heapq import bisect import math import queue from operator import itemgetter # sortedの対象を決めたい from fractions import gcd # 最大公約数 from copy import deepcopy # 参照で影響されないコピー from collections import Counter, deque, defaultdict # 要素ごとの出現回数、双方向アクセス可能データ型 from functools ...
false
2.409639
[ "- wv = [list(map(int, input().split())) for _ in range(n)]", "- dp = np.zeros([n + 1, w + 1])", "- for i, itm in enumerate(wv):", "- dp[i + 1, : itm[0]] = dp[i, : itm[0]]", "- dp[i + 1, itm[0] :] = np.max(", "- [dp[i, itm[0] :], dp[i, : w - itm[0] + 1] + itm[1]], axis=0"...
false
0.280592
0.455344
0.616219
[ "s826527030", "s702758678" ]
u802963389
p03993
python
s096853165
s897932935
72
63
14,008
13,880
Accepted
Accepted
12.5
n = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for itr, val in enumerate(A): if A[val - 1] == itr + 1: cnt += 1 print((cnt // 2))
# B - 仲良しうさぎ # https://atcoder.jp/contests/code-festival-2016-quala/tasks/codefestival_2016_qualA_b n = int(eval(input())) A = list(map(int, input().split())) ans = 0 for itr, a in enumerate(A): if a - 1 > itr and A[a - 1] == itr + 1: ans += 1 print(ans)
9
12
161
269
n = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for itr, val in enumerate(A): if A[val - 1] == itr + 1: cnt += 1 print((cnt // 2))
# B - 仲良しうさぎ # https://atcoder.jp/contests/code-festival-2016-quala/tasks/codefestival_2016_qualA_b n = int(eval(input())) A = list(map(int, input().split())) ans = 0 for itr, a in enumerate(A): if a - 1 > itr and A[a - 1] == itr + 1: ans += 1 print(ans)
false
25
[ "+# B - 仲良しうさぎ", "+# https://atcoder.jp/contests/code-festival-2016-quala/tasks/codefestival_2016_qualA_b", "-cnt = 0", "-for itr, val in enumerate(A):", "- if A[val - 1] == itr + 1:", "- cnt += 1", "-print((cnt // 2))", "+ans = 0", "+for itr, a in enumerate(A):", "+ if a - 1 > itr an...
false
0.056037
0.056298
0.99537
[ "s096853165", "s897932935" ]
u796942881
p02995
python
s865948135
s673645978
36
17
5,052
3,060
Accepted
Accepted
52.78
# バージョン 3.4.X 以前 import fractions # バージョン 3.5 以降 # import math def lcm(x, y): return (x * y) // fractions.gcd(x, y) def main(): A, B, C, D = list(map(int, input().split())) first = B // C - (A - 1) // C second = B // D - (A - 1) // D tmp = lcm(C, D) both = B // tmp - (A - 1) /...
def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): g = gcd(a, b) return a * (b // g) def main(): A, B, C, D = list(map(int, input().split())) c = B // C - (A - 1) // C d = B // D - (A - 1) // D tmp = lcm(C, D) both = B // tmp - (A - 1) // tm...
21
23
390
377
# バージョン 3.4.X 以前 import fractions # バージョン 3.5 以降 # import math def lcm(x, y): return (x * y) // fractions.gcd(x, y) def main(): A, B, C, D = list(map(int, input().split())) first = B // C - (A - 1) // C second = B // D - (A - 1) // D tmp = lcm(C, D) both = B // tmp - (A - 1) // tmp print(...
def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): g = gcd(a, b) return a * (b // g) def main(): A, B, C, D = list(map(int, input().split())) c = B // C - (A - 1) // C d = B // D - (A - 1) // D tmp = lcm(C, D) both = B // tmp - (A - 1) // tmp print((B - A...
false
8.695652
[ "-# バージョン 3.4.X 以前", "-import fractions", "+def gcd(a, b):", "+ while b:", "+ a, b = b, a % b", "+ return a", "-# バージョン 3.5 以降", "-# import math", "-def lcm(x, y):", "- return (x * y) // fractions.gcd(x, y)", "+", "+def lcm(a, b):", "+ g = gcd(a, b)", "+ return a * (b...
false
0.061695
0.079429
0.776735
[ "s865948135", "s673645978" ]
u546285759
p01223
python
s288846839
s084043698
40
30
5,604
5,600
Accepted
Accepted
25
t = int(eval(input())) for _ in range(t): n = int(eval(input())) blocks = list(map(int, input().split())) ans = [0, 0] for i in range(1, n): ans[0] = max(ans[0], blocks[i] - blocks[i-1]) ans[1] = max(ans[1], blocks[i-1] - blocks[i]) print((*ans))
t = int(eval(input())) for _ in range(t): n = int(eval(input())) blocks = list(map(int, input().split())) maxv = minv = 0 for i in range(1, n): maxv = max(maxv, blocks[i] - blocks[i-1]) minv = max(minv, blocks[i-1] - blocks[i]) print((maxv, minv))
9
10
277
280
t = int(eval(input())) for _ in range(t): n = int(eval(input())) blocks = list(map(int, input().split())) ans = [0, 0] for i in range(1, n): ans[0] = max(ans[0], blocks[i] - blocks[i - 1]) ans[1] = max(ans[1], blocks[i - 1] - blocks[i]) print((*ans))
t = int(eval(input())) for _ in range(t): n = int(eval(input())) blocks = list(map(int, input().split())) maxv = minv = 0 for i in range(1, n): maxv = max(maxv, blocks[i] - blocks[i - 1]) minv = max(minv, blocks[i - 1] - blocks[i]) print((maxv, minv))
false
10
[ "- ans = [0, 0]", "+ maxv = minv = 0", "- ans[0] = max(ans[0], blocks[i] - blocks[i - 1])", "- ans[1] = max(ans[1], blocks[i - 1] - blocks[i])", "- print((*ans))", "+ maxv = max(maxv, blocks[i] - blocks[i - 1])", "+ minv = max(minv, blocks[i - 1] - blocks[i])", "+ ...
false
0.043977
0.045919
0.957717
[ "s288846839", "s084043698" ]
u358254559
p03341
python
s480023861
s198793046
280
196
18,080
3,668
Accepted
Accepted
30
N = int(eval(input())) S = eval(input()) wnums = [0] enums = [0] for i in range(0, N-1): if S[i] == 'W': wnums.append(wnums[i]+1) else: wnums.append(wnums[i]) j=0 for i in range(N-1, 0, -1): if S[i] == 'E': enums.append(enums[j]+1) else: enums.append(enu...
N = int(eval(input())) S = eval(input()) wcnt=0 for i in range(1,N): if S[i] == "E": wcnt+=1 ans=wcnt for i in range(N-1): if S[i] == "E" and S[i+1]=="E": wcnt-=1 if S[i] == "W" and S[i+1]=="W": wcnt+=1 if ans > wcnt: ans=wcnt print(ans)
27
17
461
291
N = int(eval(input())) S = eval(input()) wnums = [0] enums = [0] for i in range(0, N - 1): if S[i] == "W": wnums.append(wnums[i] + 1) else: wnums.append(wnums[i]) j = 0 for i in range(N - 1, 0, -1): if S[i] == "E": enums.append(enums[j] + 1) else: enums.append(enums[j]) ...
N = int(eval(input())) S = eval(input()) wcnt = 0 for i in range(1, N): if S[i] == "E": wcnt += 1 ans = wcnt for i in range(N - 1): if S[i] == "E" and S[i + 1] == "E": wcnt -= 1 if S[i] == "W" and S[i + 1] == "W": wcnt += 1 if ans > wcnt: ans = wcnt print(ans)
false
37.037037
[ "-wnums = [0]", "-enums = [0]", "-for i in range(0, N - 1):", "- if S[i] == \"W\":", "- wnums.append(wnums[i] + 1)", "- else:", "- wnums.append(wnums[i])", "-j = 0", "-for i in range(N - 1, 0, -1):", "+wcnt = 0", "+for i in range(1, N):", "- enums.append(enums[j] + 1...
false
0.070893
0.147176
0.481693
[ "s480023861", "s198793046" ]
u888092736
p02683
python
s832252311
s591946021
80
29
9,248
9,160
Accepted
Accepted
63.75
N, M, X = list(map(int, input().split())) costs = [0] * N A = [[0] * M for _ in range(N)] for i in range(N): c, *a = list(map(int, input().split())) costs[i] = c A[i] = a INF = 1 << 31 ans = INF for i in range(1 << N): curr_cost = 0 understanding = [0] * M for j in range(N): ...
def dfs(i, cost, skills): if i == N: if min(skills) < X: return INF else: return cost new_skills = [a + s for a, s in zip(contents[i], skills)] return min(dfs(i + 1, cost, skills), dfs(i + 1, cost + prices[i], new_skills)) INF = float('inf') N, M, X = lis...
25
23
568
556
N, M, X = list(map(int, input().split())) costs = [0] * N A = [[0] * M for _ in range(N)] for i in range(N): c, *a = list(map(int, input().split())) costs[i] = c A[i] = a INF = 1 << 31 ans = INF for i in range(1 << N): curr_cost = 0 understanding = [0] * M for j in range(N): if i >> j & ...
def dfs(i, cost, skills): if i == N: if min(skills) < X: return INF else: return cost new_skills = [a + s for a, s in zip(contents[i], skills)] return min(dfs(i + 1, cost, skills), dfs(i + 1, cost + prices[i], new_skills)) INF = float("inf") N, M, X = list(map(int, ...
false
8
[ "+def dfs(i, cost, skills):", "+ if i == N:", "+ if min(skills) < X:", "+ return INF", "+ else:", "+ return cost", "+ new_skills = [a + s for a, s in zip(contents[i], skills)]", "+ return min(dfs(i + 1, cost, skills), dfs(i + 1, cost + prices[i], new_skills...
false
0.046028
0.045962
1.001444
[ "s832252311", "s591946021" ]
u765643145
p02577
python
s448550626
s196028425
63
50
10,616
10,540
Accepted
Accepted
20.63
N=list(map(int,list(eval(input())))) Total=0 for n in N: Total+=n #print(Total//9 , Total/9) if (Total//9 == Total/9): print("Yes") else: print("No")
#ver2 N=list(map(int,list(eval(input())))) Total=sum(N) #print(Total//9 , Total/9) if (Total//9 == Total/9): print("Yes") else: print("No")
9
8
151
138
N = list(map(int, list(eval(input())))) Total = 0 for n in N: Total += n # print(Total//9 , Total/9) if Total // 9 == Total / 9: print("Yes") else: print("No")
# ver2 N = list(map(int, list(eval(input())))) Total = sum(N) # print(Total//9 , Total/9) if Total // 9 == Total / 9: print("Yes") else: print("No")
false
11.111111
[ "+# ver2", "-Total = 0", "-for n in N:", "- Total += n", "+Total = sum(N)" ]
false
0.036938
0.035446
1.042078
[ "s448550626", "s196028425" ]
u920621778
p03681
python
s875876384
s359614079
472
167
55,152
38,512
Accepted
Accepted
64.62
import math n, m = list(map(int, input().split())) if abs(n-m) > 1: print((0)) exit() s = 2 if n == m else 1 np = math.factorial(n) mp = math.factorial(m) r = (mp*np*s) % (10**9 + 7) print(r)
def test(): mod = 10**9 + 7 n, m = list(map(int, input().split())) if abs(n-m) > 1: print((0)) exit() i_n = n i_m = m np = 1 mp = 1 while True: np = (np%mod) * (i_n%mod) mp = (mp%mod) * (i_m%mod) i_n -= 1 i_m -= 1 if i_n < 1: i_n = 1 if i_m < 1: i_m = 1 if i_n == 1 and...
11
25
196
406
import math n, m = list(map(int, input().split())) if abs(n - m) > 1: print((0)) exit() s = 2 if n == m else 1 np = math.factorial(n) mp = math.factorial(m) r = (mp * np * s) % (10**9 + 7) print(r)
def test(): mod = 10**9 + 7 n, m = list(map(int, input().split())) if abs(n - m) > 1: print((0)) exit() i_n = n i_m = m np = 1 mp = 1 while True: np = (np % mod) * (i_n % mod) mp = (mp % mod) * (i_m % mod) i_n -= 1 i_m -= 1 if i_n <...
false
56
[ "-import math", "+def test():", "+ mod = 10**9 + 7", "+ n, m = list(map(int, input().split()))", "+ if abs(n - m) > 1:", "+ print((0))", "+ exit()", "+ i_n = n", "+ i_m = m", "+ np = 1", "+ mp = 1", "+ while True:", "+ np = (np % mod) * (i_n % mod...
false
0.048897
0.039936
1.224407
[ "s875876384", "s359614079" ]
u297574184
p02889
python
s561427648
s575804948
1,382
811
76,632
85,340
Accepted
Accepted
41.32
def solve(): INF = float('inf') def Dijkstra(adjList, vSt): numV = len(adjList) useds = [False] * numV fuels = [-1] * numV fuels[vSt] = L nums = [INF] * numV num = 0 vs = set([vSt]) while vs: vNexts = set() fue...
import sys input = sys.stdin.readline def solve(): INF = float('inf') def WarshallFloyd(adjList, INF): numV = len(adjList) D = [[INF]*numV for _ in range(numV)] for u, adj in enumerate(adjList): for v, wt in adj: D[u][v] = wt D[u][u] ...
68
60
1,872
1,517
def solve(): INF = float("inf") def Dijkstra(adjList, vSt): numV = len(adjList) useds = [False] * numV fuels = [-1] * numV fuels[vSt] = L nums = [INF] * numV num = 0 vs = set([vSt]) while vs: vNexts = set() fuelNexts = [-1]...
import sys input = sys.stdin.readline def solve(): INF = float("inf") def WarshallFloyd(adjList, INF): numV = len(adjList) D = [[INF] * numV for _ in range(numV)] for u, adj in enumerate(adjList): for v, wt in adj: D[u][v] = wt D[u][u] = 0 ...
false
11.764706
[ "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "- def Dijkstra(adjList, vSt):", "+ def WarshallFloyd(adjList, INF):", "- useds = [False] * numV", "- fuels = [-1] * numV", "- fuels[vSt] = L", "- nums = [INF] * numV", "- num = 0", "- ...
false
0.047038
0.042004
1.119843
[ "s561427648", "s575804948" ]
u046187684
p03557
python
s566219609
s615736434
290
258
41,088
42,112
Accepted
Accepted
11.03
def solve(string): n, *abc = list(map(int, string.split())) a = sorted(abc[:n], reverse=True) b = sorted(abc[n:2 * n], reverse=True) c = sorted(abc[2 * n:], reverse=True) ab = [0] * n j = 0 for i, _a in enumerate(a): while j <= n - 1 and _a < b[j]: j += 1 ...
def solve(string): n, *abc = list(map(int, string.split())) a, b, c = sorted(abc[:n]), sorted(abc[n:2 * n]), sorted(abc[2 * n:]) ai = ci = ans = 0 for _b in b: while ai < n and a[ai] < _b: ai += 1 while ci < n and c[ci] <= _b: ci += 1 ans += ai * ...
26
16
722
475
def solve(string): n, *abc = list(map(int, string.split())) a = sorted(abc[:n], reverse=True) b = sorted(abc[n : 2 * n], reverse=True) c = sorted(abc[2 * n :], reverse=True) ab = [0] * n j = 0 for i, _a in enumerate(a): while j <= n - 1 and _a < b[j]: j += 1 ab[i]...
def solve(string): n, *abc = list(map(int, string.split())) a, b, c = sorted(abc[:n]), sorted(abc[n : 2 * n]), sorted(abc[2 * n :]) ai = ci = ans = 0 for _b in b: while ai < n and a[ai] < _b: ai += 1 while ci < n and c[ci] <= _b: ci += 1 ans += ai * (n - c...
false
38.461538
[ "- a = sorted(abc[:n], reverse=True)", "- b = sorted(abc[n : 2 * n], reverse=True)", "- c = sorted(abc[2 * n :], reverse=True)", "- ab = [0] * n", "- j = 0", "- for i, _a in enumerate(a):", "- while j <= n - 1 and _a < b[j]:", "- j += 1", "- ab[i] = j", "...
false
0.048674
0.089096
0.546303
[ "s566219609", "s615736434" ]
u794544096
p02754
python
s535272728
s951069351
165
70
38,384
61,816
Accepted
Accepted
57.58
n, a, b = list(map(int, input().split())) num1 = n // (a + b) * a num2 = n % (a + b) if num2 >= a: print((num1 + a)) else: print((num1 + num2))
n, b, r = list(map(int, input().split())) g = n // (b+r) i = n % (b+r) if b == 0: print((0)) elif i > b: print((g*b + b)) else: #i <= b print((g*b + i))
9
11
151
164
n, a, b = list(map(int, input().split())) num1 = n // (a + b) * a num2 = n % (a + b) if num2 >= a: print((num1 + a)) else: print((num1 + num2))
n, b, r = list(map(int, input().split())) g = n // (b + r) i = n % (b + r) if b == 0: print((0)) elif i > b: print((g * b + b)) else: # i <= b print((g * b + i))
false
18.181818
[ "-n, a, b = list(map(int, input().split()))", "-num1 = n // (a + b) * a", "-num2 = n % (a + b)", "-if num2 >= a:", "- print((num1 + a))", "-else:", "- print((num1 + num2))", "+n, b, r = list(map(int, input().split()))", "+g = n // (b + r)", "+i = n % (b + r)", "+if b == 0:", "+ print(...
false
0.038293
0.037164
1.030372
[ "s535272728", "s951069351" ]
u941753895
p03774
python
s972739106
s510528229
21
19
3,064
3,064
Accepted
Accepted
9.52
n,m=list(map(int,input().split())) al=[] bl=[] ansl=[] for i in range(n): al.append(eval(input())) for i in range(m): bl.append(eval(input())) for i in range(n): a1,a2=list(map(int,al[i].split())) b1,b2=list(map(int,bl[0].split())) mi=dis=abs(b1-a1)+abs(b2-a2) c=1 for j in range(1,m): b1...
# 入力 N,M=list(map(int,input().split())) l1=[] for i in range(N): l1.append(list(map(int,input().split()))) l2=[] for i in range(M): l2.append(list(map(int,input().split()))) for i in range(N): # 距離の最小値(1つ目のチェックポイントへの距離で初期化している) d=abs(l1[i][0]-l2[0][0])+abs(l1[i][1]-l2[0][1]) # 最...
22
31
455
622
n, m = list(map(int, input().split())) al = [] bl = [] ansl = [] for i in range(n): al.append(eval(input())) for i in range(m): bl.append(eval(input())) for i in range(n): a1, a2 = list(map(int, al[i].split())) b1, b2 = list(map(int, bl[0].split())) mi = dis = abs(b1 - a1) + abs(b2 - a2) c = 1 ...
# 入力 N, M = list(map(int, input().split())) l1 = [] for i in range(N): l1.append(list(map(int, input().split()))) l2 = [] for i in range(M): l2.append(list(map(int, input().split()))) for i in range(N): # 距離の最小値(1つ目のチェックポイントへの距離で初期化している) d = abs(l1[i][0] - l2[0][0]) + abs(l1[i][1] - l2[0][1]) # 最も近い...
false
29.032258
[ "-n, m = list(map(int, input().split()))", "-al = []", "-bl = []", "-ansl = []", "-for i in range(n):", "- al.append(eval(input()))", "-for i in range(m):", "- bl.append(eval(input()))", "-for i in range(n):", "- a1, a2 = list(map(int, al[i].split()))", "- b1, b2 = list(map(int, bl[0...
false
0.149544
0.091903
1.627188
[ "s972739106", "s510528229" ]
u525065967
p02554
python
s304731351
s076324266
400
29
11,008
9,092
Accepted
Accepted
92.75
n = int(eval(input())) ans = 10**n - 2 * 9**n + 8**n print((ans % (10**9 + 7)))
n = int(eval(input())) MOD = 10**9 + 7 print(((pow(10,n,MOD) - 2*pow(9,n,MOD) + pow(8,n,MOD)) % MOD))
3
3
74
96
n = int(eval(input())) ans = 10**n - 2 * 9**n + 8**n print((ans % (10**9 + 7)))
n = int(eval(input())) MOD = 10**9 + 7 print(((pow(10, n, MOD) - 2 * pow(9, n, MOD) + pow(8, n, MOD)) % MOD))
false
0
[ "-ans = 10**n - 2 * 9**n + 8**n", "-print((ans % (10**9 + 7)))", "+MOD = 10**9 + 7", "+print(((pow(10, n, MOD) - 2 * pow(9, n, MOD) + pow(8, n, MOD)) % MOD))" ]
false
0.297826
0.035491
8.391668
[ "s304731351", "s076324266" ]
u508732591
p02467
python
s460535724
s591108424
30
20
7,780
7,768
Accepted
Accepted
33.33
import math def factorize(p): while p % 2 == 0: p //= 2 yield 2 r = 3 while r < int(math.sqrt(p)+1): if p % r == 0: p //= r yield r else: r += 2 if p != 1: yield p n = int(eval(input())) l = factorize(n) ...
import math def factorize(p): l = [] while p % 2 == 0: p //= 2 l.append(2) r = 3 while r < int(math.sqrt(p)+1): if p % r == 0: p //= r l.append(r) else: r += 2 if p != 1: l.append(p) return l n ...
22
25
342
382
import math def factorize(p): while p % 2 == 0: p //= 2 yield 2 r = 3 while r < int(math.sqrt(p) + 1): if p % r == 0: p //= r yield r else: r += 2 if p != 1: yield p n = int(eval(input())) l = factorize(n) print((str(n) + ":...
import math def factorize(p): l = [] while p % 2 == 0: p //= 2 l.append(2) r = 3 while r < int(math.sqrt(p) + 1): if p % r == 0: p //= r l.append(r) else: r += 2 if p != 1: l.append(p) return l n = int(eval(input()))...
false
12
[ "+ l = []", "- yield 2", "+ l.append(2)", "- yield r", "+ l.append(r)", "- yield p", "+ l.append(p)", "+ return l" ]
false
0.047363
0.046722
1.013724
[ "s460535724", "s591108424" ]
u432356156
p02696
python
s602061480
s653687728
22
20
9,044
9,112
Accepted
Accepted
9.09
def fx(x): return (a*x // b) - a * (x//b) a,b,n = [int(x) for x in input().split()] if(n < b): print((fx(n))) else: print((fx((n//b)*b -1)))
def fx(x): return (a*x // b) - a * (x//b) a,b,n = [int(x) for x in input().split()] if(n < b): print((fx(n))) else: print((fx(b -1)))
9
9
159
151
def fx(x): return (a * x // b) - a * (x // b) a, b, n = [int(x) for x in input().split()] if n < b: print((fx(n))) else: print((fx((n // b) * b - 1)))
def fx(x): return (a * x // b) - a * (x // b) a, b, n = [int(x) for x in input().split()] if n < b: print((fx(n))) else: print((fx(b - 1)))
false
0
[ "- print((fx((n // b) * b - 1)))", "+ print((fx(b - 1)))" ]
false
0.040836
0.040622
1.00527
[ "s602061480", "s653687728" ]
u645250356
p03854
python
s218417547
s402987515
203
59
41,452
5,348
Accepted
Accepted
70.94
from collections import Counter,defaultdict,deque import sys,heapq,bisect,math,itertools,string,queue sys.setrecursionlimit(10**8) mod = 10**9+7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sys.stdin.readline().split()) de...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(m...
26
29
749
765
from collections import Counter, defaultdict, deque import sys, heapq, bisect, math, itertools, string, queue sys.setrecursionlimit(10**8) mod = 10**9 + 7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sys.stdin....
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify from bisect import bisect_left, bisect_right import sys, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): ...
false
10.344828
[ "-import sys, heapq, bisect, math, itertools, string, queue", "+from heapq import heappop, heappush, heapify", "+from bisect import bisect_left, bisect_right", "+import sys, math, itertools, fractions, pprint", "+INF = float(\"inf\")", "-def inpl_str():", "- return list(sys.stdin.readline().split())"...
false
0.111935
0.07529
1.486718
[ "s218417547", "s402987515" ]
u167647458
p03804
python
s138728478
s730086240
25
23
3,064
3,064
Accepted
Accepted
8
n, m = list(map(int, input().split())) a = [list(eval(input())) for _ in range(n)] b = [list(eval(input())) for _ in range(m)] flag = True for i in range(n): if flag: for j in range(n): if i + m <= n and j + m <= n: aa = [] for k in range(m): ...
n, m = list(map(int, input().split())) a = [list(eval(input())) for _ in range(n)] b = [list(eval(input())) for _ in range(m)] def check(): for i in range(n): for j in range(n): if i + m <= n and j + m <= n: aa = [] for k in range(m): ...
19
16
498
458
n, m = list(map(int, input().split())) a = [list(eval(input())) for _ in range(n)] b = [list(eval(input())) for _ in range(m)] flag = True for i in range(n): if flag: for j in range(n): if i + m <= n and j + m <= n: aa = [] for k in range(m): a...
n, m = list(map(int, input().split())) a = [list(eval(input())) for _ in range(n)] b = [list(eval(input())) for _ in range(m)] def check(): for i in range(n): for j in range(n): if i + m <= n and j + m <= n: aa = [] for k in range(m): aa.appe...
false
15.789474
[ "-flag = True", "-for i in range(n):", "- if flag:", "+", "+", "+def check():", "+ for i in range(n):", "- print(\"Yes\")", "- flag = False", "- break", "-if flag:", "- print(\"No\")", "+ return \"Yes\"", ...
false
0.044134
0.037808
1.167324
[ "s138728478", "s730086240" ]
u852690916
p02821
python
s772189540
s726031957
1,063
321
56,600
57,072
Accepted
Accepted
69.8
import bisect N,M=list(map(int,input().split())) A=list(map(int,input().split())) A.sort() #和がx以上になる組み合わせの総数を求める関数 def pattern_num_ge_x(x): p=0 for a in A: p+=(N-bisect.bisect_left(A, x-a)) return(p) #pattern_num_ge_x(x)がM未満になる最小のxを探す(=r) #lはM以上になる最大のx l=-1 r=10**5*2+1 while r-l>1:...
import bisect N,M=list(map(int,input().split())) A=list(map(int,input().split())) A.sort() #C[i]=パワーがi以下の人数 C=[0]*(10**5*2+1) for a in A: C[a]+=1 for i in range(1,len(C)): C[i]+=C[i-1] #和がx以上になる組み合わせの総数を求める関数 def pattern_num_ge_x(x): p=0 for a in A: p+=(N-(C[x-a-1] if x-a-1>=0 ...
37
44
643
756
import bisect N, M = list(map(int, input().split())) A = list(map(int, input().split())) A.sort() # 和がx以上になる組み合わせの総数を求める関数 def pattern_num_ge_x(x): p = 0 for a in A: p += N - bisect.bisect_left(A, x - a) return p # pattern_num_ge_x(x)がM未満になる最小のxを探す(=r) # lはM以上になる最大のx l = -1 r = 10**5 * 2 + 1 whil...
import bisect N, M = list(map(int, input().split())) A = list(map(int, input().split())) A.sort() # C[i]=パワーがi以下の人数 C = [0] * (10**5 * 2 + 1) for a in A: C[a] += 1 for i in range(1, len(C)): C[i] += C[i - 1] # 和がx以上になる組み合わせの総数を求める関数 def pattern_num_ge_x(x): p = 0 for a in A: p += N - (C[x - a -...
false
15.909091
[ "+# C[i]=パワーがi以下の人数", "+C = [0] * (10**5 * 2 + 1)", "+for a in A:", "+ C[a] += 1", "+for i in range(1, len(C)):", "+ C[i] += C[i - 1]", "- p += N - bisect.bisect_left(A, x - a)", "+ p += N - (C[x - a - 1] if x - a - 1 >= 0 else 0)" ]
false
0.058552
0.204871
0.285799
[ "s772189540", "s726031957" ]
u489959379
p02616
python
s528660756
s368892878
179
142
31,608
31,744
Accepted
Accepted
20.67
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n, k = list(map(int, input().split())) A = list(map(int, input().split())) M, P = [], [] for a in A: M.append(a) if a < 0 else P.append(a) m, p = len(...
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n, k = list(map(int, input().split())) A = list(map(int, input().split())) res = 1 if n == k: for a in A: res = (res * a) % mod print(r...
50
53
1,108
1,273
import sys sys.setrecursionlimit(10**7) input = sys.stdin.readline f_inf = float("inf") mod = 10**9 + 7 def resolve(): n, k = list(map(int, input().split())) A = list(map(int, input().split())) M, P = [], [] for a in A: M.append(a) if a < 0 else P.append(a) m, p = len(M), len(P) ok = ...
import sys sys.setrecursionlimit(10**7) input = sys.stdin.readline f_inf = float("inf") mod = 10**9 + 7 def resolve(): n, k = list(map(int, input().split())) A = list(map(int, input().split())) res = 1 if n == k: for a in A: res = (res * a) % mod print(res) exit() ...
false
5.660377
[ "- M, P = [], []", "+ res = 1", "+ if n == k:", "+ for a in A:", "+ res = (res * a) % mod", "+ print(res)", "+ exit()", "+ P, M = [], []", "- M.append(a) if a < 0 else P.append(a)", "- m, p = len(M), len(P)", "- ok = False", "- if p >...
false
0.042321
0.007924
5.340936
[ "s528660756", "s368892878" ]
u459590249
p03607
python
s123847108
s275020336
239
203
7,388
16,636
Accepted
Accepted
15.06
n=int(eval(input())) a=[] for i in range(n): a.append(int(eval(input()))) a.sort() now=a[0] odd=0 ans=0 for i in range(n): #前の文字と一緒の時 if a[i]==now: odd=(odd+1)%2 #前の文字と違う時 else: #前の文字の個数の偶奇を判定し、奇数ならansをインクリメント ans+=odd #注目する文字を今の文字にする now=a[i] odd=1 #最後の文字をきちんと処理するためにoddを加える print...
from collections import Counter n=int(eval(input())) a=[] for i in range(n): a.append(int(eval(input()))) print((sum([x%2 for x in list(Counter(a).values())])))
22
7
317
152
n = int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) a.sort() now = a[0] odd = 0 ans = 0 for i in range(n): # 前の文字と一緒の時 if a[i] == now: odd = (odd + 1) % 2 # 前の文字と違う時 else: # 前の文字の個数の偶奇を判定し、奇数ならansをインクリメント ans += odd # 注目する文字を今の文字にする n...
from collections import Counter n = int(eval(input())) a = [] for i in range(n): a.append(int(eval(input()))) print((sum([x % 2 for x in list(Counter(a).values())])))
false
68.181818
[ "+from collections import Counter", "+", "-a.sort()", "-now = a[0]", "-odd = 0", "-ans = 0", "-for i in range(n):", "- # 前の文字と一緒の時", "- if a[i] == now:", "- odd = (odd + 1) % 2", "- # 前の文字と違う時", "- else:", "- # 前の文字の個数の偶奇を判定し、奇数ならansをインクリメント", "- ans += odd...
false
0.060039
0.034369
1.746908
[ "s123847108", "s275020336" ]
u077291787
p03379
python
s973272400
s488062162
273
240
25,620
25,052
Accepted
Accepted
12.09
# ARC095C - Many Medians (ABC094C) def main(): n = int(eval(input())) x = list(map(int, input().rstrip().split())) sort_x = sorted(x) l, h = sort_x[n // 2 - 1], sort_x[n // 2] for i in x: if i <= l: print(h) else: print(l) if __name__ == "__main...
# ABC094C - Many Medians (ARC095C) def main(): N, *X = map(int, open(0).read().split()) l, h = sorted(X)[N // 2 - 1 : N // 2 + 1] ans = [h if i <= l else l for i in X] print(*ans, sep="\n") if __name__ == "__main__": main()
15
10
330
254
# ARC095C - Many Medians (ABC094C) def main(): n = int(eval(input())) x = list(map(int, input().rstrip().split())) sort_x = sorted(x) l, h = sort_x[n // 2 - 1], sort_x[n // 2] for i in x: if i <= l: print(h) else: print(l) if __name__ == "__main__": main...
# ABC094C - Many Medians (ARC095C) def main(): N, *X = map(int, open(0).read().split()) l, h = sorted(X)[N // 2 - 1 : N // 2 + 1] ans = [h if i <= l else l for i in X] print(*ans, sep="\n") if __name__ == "__main__": main()
false
33.333333
[ "-# ARC095C - Many Medians (ABC094C)", "+# ABC094C - Many Medians (ARC095C)", "- n = int(eval(input()))", "- x = list(map(int, input().rstrip().split()))", "- sort_x = sorted(x)", "- l, h = sort_x[n // 2 - 1], sort_x[n // 2]", "- for i in x:", "- if i <= l:", "- prin...
false
0.043186
0.049329
0.875478
[ "s973272400", "s488062162" ]
u061127257
p03290
python
s381282604
s696365759
191
22
41,200
3,064
Accepted
Accepted
88.48
D,G = list(map(int,input().split())) X = [list(map(int,input().split())) for _ in range(D)] ans = 0 for i in range(2**D): point = 0 count = 0 for j in range(D): if (i>>j)&1: point += 100*(j+1)*X[j][0]+X[j][1] count += X[j][0] if G > point: for k in range(D)[::-1]: if (i>>k)&1==0: if...
D,G = list(map(int,input().split())) X = [list(map(int,input().split())) for _ in range(D)] ans = 0 for i in range(2**D): point = 0 count = 0 for j in range(D): if (i>>j)&1: point += 100*(j+1)*X[j][0]+X[j][1] count += X[j][0] if G > point: for k in range(D)[::-1]: if (i>>k)&1==0: i...
24
24
510
509
D, G = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(D)] ans = 0 for i in range(2**D): point = 0 count = 0 for j in range(D): if (i >> j) & 1: point += 100 * (j + 1) * X[j][0] + X[j][1] count += X[j][0] if G > point: for k in ...
D, G = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(D)] ans = 0 for i in range(2**D): point = 0 count = 0 for j in range(D): if (i >> j) & 1: point += 100 * (j + 1) * X[j][0] + X[j][1] count += X[j][0] if G > point: for k in ...
false
0
[ "- if (G - point) <= 100 * (k + 1) * (X[k][0] - 1):", "- count += -((-(G - point)) // (100 * (k + 1)))", "+ if (G - point) <= 100 * (k + 1) * (X[k][0]):", "+ count += (G - point - 1) // (100 * (k + 1)) + 1" ]
false
0.044731
0.037887
1.180643
[ "s381282604", "s696365759" ]
u997521090
p03212
python
s618542496
s057877297
73
44
2,568
2,568
Accepted
Accepted
39.73
def func(S, num): ret = 0 if '3' in S and '5' in S and '7' in S and int(S) <= num: ret += 1 if len(S) == 10: return 0 ret += func(S + '3', num) ret += func(S + '5', num) ret += func(S + '7', num) return ret print(func('', eval(input())))
def func(S, num): if len(S) == 10: return 0 ret = 0 if '3' in S and '5' in S and '7' in S and int(S) <= num: ret += 1 ret += func(S + '3', num) ret += func(S + '5', num) ret += func(S + '7', num) return ret print(func('', eval(input())))
12
12
286
286
def func(S, num): ret = 0 if "3" in S and "5" in S and "7" in S and int(S) <= num: ret += 1 if len(S) == 10: return 0 ret += func(S + "3", num) ret += func(S + "5", num) ret += func(S + "7", num) return ret print(func("", eval(input())))
def func(S, num): if len(S) == 10: return 0 ret = 0 if "3" in S and "5" in S and "7" in S and int(S) <= num: ret += 1 ret += func(S + "3", num) ret += func(S + "5", num) ret += func(S + "7", num) return ret print(func("", eval(input())))
false
0
[ "+ if len(S) == 10:", "+ return 0", "- if len(S) == 10:", "- return 0" ]
false
0.091811
0.184529
0.49754
[ "s618542496", "s057877297" ]
u729133443
p02951
python
s023742053
s352709432
164
24
38,256
8,968
Accepted
Accepted
85.37
print((max(0,eval('-'+input().replace(' ','+')))))
print((max(0,eval('-'+input().replace(*' +')))))
1
1
48
46
print((max(0, eval("-" + input().replace(" ", "+")))))
print((max(0, eval("-" + input().replace(*" +")))))
false
0
[ "-print((max(0, eval(\"-\" + input().replace(\" \", \"+\")))))", "+print((max(0, eval(\"-\" + input().replace(*\" +\")))))" ]
false
0.036859
0.036388
1.012927
[ "s023742053", "s352709432" ]
u573754721
p02832
python
s402156285
s761311171
266
241
77,516
77,516
Accepted
Accepted
9.4
n=int(eval(input())) A=list(map(int,input().split())) bef=1 ans=0 if 1 not in A: print((-1)) exit() for i in range(n): if A[i]==bef: bef+=1 ans+=1 print((n-ans))
n=int(eval(input())) A=list(map(int,input().split())) if 1 not in A: print((-1)) exit() s=1 for i in range(n): if A[i]==s: s+=1 print((n-(s-1)))
15
11
197
166
n = int(eval(input())) A = list(map(int, input().split())) bef = 1 ans = 0 if 1 not in A: print((-1)) exit() for i in range(n): if A[i] == bef: bef += 1 ans += 1 print((n - ans))
n = int(eval(input())) A = list(map(int, input().split())) if 1 not in A: print((-1)) exit() s = 1 for i in range(n): if A[i] == s: s += 1 print((n - (s - 1)))
false
26.666667
[ "-bef = 1", "-ans = 0", "+s = 1", "- if A[i] == bef:", "- bef += 1", "- ans += 1", "-print((n - ans))", "+ if A[i] == s:", "+ s += 1", "+print((n - (s - 1)))" ]
false
0.115472
0.077969
1.480989
[ "s402156285", "s761311171" ]
u644907318
p02756
python
s575574351
s739800615
954
316
74,600
103,828
Accepted
Accepted
66.88
from collections import deque S = deque(list(input().strip())) Q = int(eval(input())) cnt = 0 for i in range(Q): q = list(input().split()) if len(q)==1: cnt += 1 else: F = int(q[1]) C = q[2] if cnt%2==0: if F==1: S.appendleft(C) ...
from collections import deque S = deque(list(input().strip())) Q = int(eval(input())) P = 0 for _ in range(Q): q = list(input().split()) if q[0]=="1": P += 1 P = P%2 else: c = q[2] if q[1]=="1": if P==0: S.appendleft(c) el...
26
25
563
527
from collections import deque S = deque(list(input().strip())) Q = int(eval(input())) cnt = 0 for i in range(Q): q = list(input().split()) if len(q) == 1: cnt += 1 else: F = int(q[1]) C = q[2] if cnt % 2 == 0: if F == 1: S.appendleft(C) ...
from collections import deque S = deque(list(input().strip())) Q = int(eval(input())) P = 0 for _ in range(Q): q = list(input().split()) if q[0] == "1": P += 1 P = P % 2 else: c = q[2] if q[1] == "1": if P == 0: S.appendleft(c) else: ...
false
3.846154
[ "-cnt = 0", "-for i in range(Q):", "+P = 0", "+for _ in range(Q):", "- if len(q) == 1:", "- cnt += 1", "+ if q[0] == \"1\":", "+ P += 1", "+ P = P % 2", "- F = int(q[1])", "- C = q[2]", "- if cnt % 2 == 0:", "- if F == 1:", "- ...
false
0.035216
0.036122
0.974915
[ "s575574351", "s739800615" ]
u411203878
p02762
python
s180078841
s674745642
678
432
87,856
97,684
Accepted
Accepted
36.28
import sys input = sys.stdin.readline N, M, K = list(map(int, input().split())) friends_table = [[] for i in range(N)] for _ in range(M): a, b = list(map(int, input().split())) friends_table[a-1] += [b-1] friends_table[b-1] += [a-1] group_list = [i for i in range(N)] friends_candidate = [[] for...
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) class UnionFindPathCompression(): def __init__(self, n): self.parents = list(range(n)) self.rank = [1]*n self.group_size = [1]*n def find(self, x): if self.parents[x] == x: return x ...
40
58
1,095
1,556
import sys input = sys.stdin.readline N, M, K = list(map(int, input().split())) friends_table = [[] for i in range(N)] for _ in range(M): a, b = list(map(int, input().split())) friends_table[a - 1] += [b - 1] friends_table[b - 1] += [a - 1] group_list = [i for i in range(N)] friends_candidate = [[] for i i...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) class UnionFindPathCompression: def __init__(self, n): self.parents = list(range(n)) self.rank = [1] * n self.group_size = [1] * n def find(self, x): if self.parents[x] == x: return x else:...
false
31.034483
[ "-N, M, K = list(map(int, input().split()))", "-friends_table = [[] for i in range(N)]", "-for _ in range(M):", "- a, b = list(map(int, input().split()))", "- friends_table[a - 1] += [b - 1]", "- friends_table[b - 1] += [a - 1]", "-group_list = [i for i in range(N)]", "-friends_candidate = [[...
false
0.112518
0.043767
2.570825
[ "s180078841", "s674745642" ]
u426764965
p02983
python
s702409723
s922780742
617
151
3,060
14,312
Accepted
Accepted
75.53
L, R = list(map(int, input().split())) R_alt = min(L+2018, R) ans = 2018 ** 2 for i in range(L, R_alt): for j in range(i+1, R_alt+1): tmp = i%2019 * j%2019 if ans > tmp: ans = tmp print(ans)
# 参考 https://atcoder.jp/contests/abc133/submissions/7966658 import numpy as np def abc133_c(): L, R = list(map(int, input().split())) if R - L > 673: return 0 x = np.arange(L, R+1, dtype=np.int64) #y = x[:, None] * x[None, :] % 2019 y = x.reshape(-1, 1) * x.reshape(1, -1) # 区間内のすべての組合せの積...
13
15
216
438
L, R = list(map(int, input().split())) R_alt = min(L + 2018, R) ans = 2018**2 for i in range(L, R_alt): for j in range(i + 1, R_alt + 1): tmp = i % 2019 * j % 2019 if ans > tmp: ans = tmp print(ans)
# 参考 https://atcoder.jp/contests/abc133/submissions/7966658 import numpy as np def abc133_c(): L, R = list(map(int, input().split())) if R - L > 673: return 0 x = np.arange(L, R + 1, dtype=np.int64) # y = x[:, None] * x[None, :] % 2019 y = x.reshape(-1, 1) * x.reshape(1, -1) # 区間内のすべての組合せ...
false
13.333333
[ "-L, R = list(map(int, input().split()))", "-R_alt = min(L + 2018, R)", "-ans = 2018**2", "-for i in range(L, R_alt):", "- for j in range(i + 1, R_alt + 1):", "- tmp = i % 2019 * j % 2019", "- if ans > tmp:", "- ans = tmp", "-print(ans)", "+# 参考 https://atcoder.jp/conte...
false
0.243675
0.343102
0.710211
[ "s702409723", "s922780742" ]
u674588203
p02576
python
s775103984
s730793183
32
29
9,152
9,024
Accepted
Accepted
9.38
# AtCoder Beginner Contest 176 # A - Takoyaki N,X,T=list(map(int,input().split())) if N%X==0: print(((N//X)*T)) else: print((((N//X)+1)*T))
# AtCoder Beginner Contest 176 # A - Takoyaki import math N,X,T=list(map(int,input().split())) print((math.ceil(N/X)*T))
8
8
145
122
# AtCoder Beginner Contest 176 # A - Takoyaki N, X, T = list(map(int, input().split())) if N % X == 0: print(((N // X) * T)) else: print((((N // X) + 1) * T))
# AtCoder Beginner Contest 176 # A - Takoyaki import math N, X, T = list(map(int, input().split())) print((math.ceil(N / X) * T))
false
0
[ "+import math", "+", "-if N % X == 0:", "- print(((N // X) * T))", "-else:", "- print((((N // X) + 1) * T))", "+print((math.ceil(N / X) * T))" ]
false
0.032479
0.040731
0.797418
[ "s775103984", "s730793183" ]
u309120194
p02899
python
s663071875
s085707559
157
118
29,932
20,508
Accepted
Accepted
24.84
N = int(input()) A = list(map(int, input().split())) # 辞書型を使い、valueでソートする dic = {} for i in range(N): dic[i] = A[i] dic = sorted(dic.items(), key=lambda x:x[1]) for d in dic: print(d[0]+1, end=" ")
N = int(input()) A = list(map(int, input().split())) ans = [0]*N for i in range(N): ans[A[i]-1] = str(i+1) for i in range(N): print(ans[i], end=' ')
11
9
213
163
N = int(input()) A = list(map(int, input().split())) # 辞書型を使い、valueでソートする dic = {} for i in range(N): dic[i] = A[i] dic = sorted(dic.items(), key=lambda x: x[1]) for d in dic: print(d[0] + 1, end=" ")
N = int(input()) A = list(map(int, input().split())) ans = [0] * N for i in range(N): ans[A[i] - 1] = str(i + 1) for i in range(N): print(ans[i], end=" ")
false
18.181818
[ "-# 辞書型を使い、valueでソートする", "-dic = {}", "+ans = [0] * N", "- dic[i] = A[i]", "-dic = sorted(dic.items(), key=lambda x: x[1])", "-for d in dic:", "- print(d[0] + 1, end=\" \")", "+ ans[A[i] - 1] = str(i + 1)", "+for i in range(N):", "+ print(ans[i], end=\" \")" ]
false
0.043329
0.038971
1.111843
[ "s663071875", "s085707559" ]
u667024514
p03147
python
s958544296
s546498976
20
18
3,064
3,060
Accepted
Accepted
10
n = int(eval(input())) lis = list(map(int,input().split())) ans = 0 co = 0 for i in range(n): while lis[i] != 0: cou = i while lis[cou] > 0: lis[cou] -= 1 cou += 1 if cou == n: break ans += 1 print(ans)
n= int(eval(input())) lis = list(map(int,input().split())) ans = 0 status = 0 for high in range(1,101): for i in range(n): if lis[i] >= high: status = 1 else: if status == 1: ans += 1 status = 0 ans += status status = 0 pr...
14
15
289
322
n = int(eval(input())) lis = list(map(int, input().split())) ans = 0 co = 0 for i in range(n): while lis[i] != 0: cou = i while lis[cou] > 0: lis[cou] -= 1 cou += 1 if cou == n: break ans += 1 print(ans)
n = int(eval(input())) lis = list(map(int, input().split())) ans = 0 status = 0 for high in range(1, 101): for i in range(n): if lis[i] >= high: status = 1 else: if status == 1: ans += 1 status = 0 ans += status status = 0 print(ans)
false
6.666667
[ "-co = 0", "-for i in range(n):", "- while lis[i] != 0:", "- cou = i", "- while lis[cou] > 0:", "- lis[cou] -= 1", "- cou += 1", "- if cou == n:", "- break", "- ans += 1", "+status = 0", "+for high in range(1, 101):", "+...
false
0.04572
0.046024
0.993384
[ "s958544296", "s546498976" ]
u790710233
p02580
python
s382390124
s409379043
842
583
218,832
221,000
Accepted
Accepted
30.76
H, W, M = list(map(int, input().split())) bombs = [] rows = [[]for _ in range(H)] cols = [[]for _ in range(W)] for _ in range(M): h, w = [int(x)-1 for x in input().split()] bombs.append((h, w)) rows[h].append(w) cols[w].append(h) max_row = 0 row_idx = set() for i, row in enumerate(rows): ...
import sys input = sys.stdin.readline H, W, M = list(map(int, input().split())) bombs = [] rows = [[]for _ in range(H)] cols = [[]for _ in range(W)] for _ in range(M): h, w = [int(x)-1 for x in input().split()] bombs.append((h, w)) rows[h].append(w) cols[w].append(h) max_row = 0 row_idx = ...
42
44
951
991
H, W, M = list(map(int, input().split())) bombs = [] rows = [[] for _ in range(H)] cols = [[] for _ in range(W)] for _ in range(M): h, w = [int(x) - 1 for x in input().split()] bombs.append((h, w)) rows[h].append(w) cols[w].append(h) max_row = 0 row_idx = set() for i, row in enumerate(rows): if max_...
import sys input = sys.stdin.readline H, W, M = list(map(int, input().split())) bombs = [] rows = [[] for _ in range(H)] cols = [[] for _ in range(W)] for _ in range(M): h, w = [int(x) - 1 for x in input().split()] bombs.append((h, w)) rows[h].append(w) cols[w].append(h) max_row = 0 row_idx = set() for...
false
4.545455
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.056137
0.035976
1.560412
[ "s382390124", "s409379043" ]
u535803878
p03142
python
s566791190
s474346620
527
366
264,288
153,380
Accepted
Accepted
30.55
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n, m = list(map(int, input().split())) from collections import defaultdict ns = defaultdict(set) pps = [set() for _ in range(n)] for i in range(n-1+m): a,b = list(m...
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n, m = list(map(int, input().split())) from collections import defaultdict ns = defaultdict(set) pps = [set() for _ in range(n)] for i in range(n-1+m): a,b = list(m...
65
66
1,384
1,397
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") n, m = list(map(int, input().split())) from collections import defaultdict ns = defaultdict(set) pps = [set() for _ in range(n)] for i in range(n - 1 + m): a, b = list(map(...
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x + "\n") n, m = list(map(int, input().split())) from collections import defaultdict ns = defaultdict(set) pps = [set() for _ in range(n)] for i in range(n - 1 + m): a, b = list(map(...
false
1.515152
[ "- seen[start] = d0", "+ if seen[u]:", "+ continue", "+ seen[u] = d0", "+ d0 += 1", "- if done[v] is None:", "- d0 += 1", "- seen[v] = d0", "+ if seen[v] is None:", "-dfs(r, n)", ...
false
0.093197
0.038457
2.423395
[ "s566791190", "s474346620" ]
u977349332
p03447
python
s337001035
s670558430
148
20
14,316
2,940
Accepted
Accepted
86.49
import numpy as np X = int(eval(input())) A = int(eval(input())) B = int(eval(input())) X -= A n = int(X / B) print((X - n*B))
X = int(eval(input())) A = int(eval(input())) B = int(eval(input())) X -= A n = int(X / B) print((X - n*B))
9
7
117
95
import numpy as np X = int(eval(input())) A = int(eval(input())) B = int(eval(input())) X -= A n = int(X / B) print((X - n * B))
X = int(eval(input())) A = int(eval(input())) B = int(eval(input())) X -= A n = int(X / B) print((X - n * B))
false
22.222222
[ "-import numpy as np", "-" ]
false
0.040942
0.037368
1.095639
[ "s337001035", "s670558430" ]
u790710233
p02641
python
s157462287
s343982998
21
19
9,200
9,208
Accepted
Accepted
9.52
x, n = list(map(int, input().split())) Ps = list(map(int, input().split())) line = [0]*(102) for p in Ps: line[p] = 1 for i in range(101): L, R = x-i, x+i if line[L] == 0: print(L) break if line[R] == 0: print(R) break
X, n = list(map(int, input().split())) Ps = set(map(int, input().split())) cood = set(range(0, 102)) cood -= Ps print((min(cood, key=lambda x: abs(x-X))))
15
5
277
150
x, n = list(map(int, input().split())) Ps = list(map(int, input().split())) line = [0] * (102) for p in Ps: line[p] = 1 for i in range(101): L, R = x - i, x + i if line[L] == 0: print(L) break if line[R] == 0: print(R) break
X, n = list(map(int, input().split())) Ps = set(map(int, input().split())) cood = set(range(0, 102)) cood -= Ps print((min(cood, key=lambda x: abs(x - X))))
false
66.666667
[ "-x, n = list(map(int, input().split()))", "-Ps = list(map(int, input().split()))", "-line = [0] * (102)", "-for p in Ps:", "- line[p] = 1", "-for i in range(101):", "- L, R = x - i, x + i", "- if line[L] == 0:", "- print(L)", "- break", "- if line[R] == 0:", "- ...
false
0.043255
0.048802
0.886334
[ "s157462287", "s343982998" ]
u169138653
p02838
python
s339370052
s780244722
1,958
694
42,156
122,808
Accepted
Accepted
64.56
n=int(eval(input())) a=list(map(int,input().split())) ans=0 mod=10**9+7 for j in range(60): cnt1=sum([1 for i in a if i>>j&1]) cnt0=n-cnt1 ans+=(cnt1*cnt0*2**j) print((ans%(10**9+7)))
n=int(eval(input())) a=list(map(int,input().split())) s=0 for j in range(len(bin(max(a)))-2): cnt1=0 cnt0=0 for i in range(n): if (a[i]>>j)&1: cnt1+=1 else: cnt0+=1 s+=(cnt1*cnt0*2**j)%(10**9+7) print((s%(10**9+7)))
9
13
196
264
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 mod = 10**9 + 7 for j in range(60): cnt1 = sum([1 for i in a if i >> j & 1]) cnt0 = n - cnt1 ans += cnt1 * cnt0 * 2**j print((ans % (10**9 + 7)))
n = int(eval(input())) a = list(map(int, input().split())) s = 0 for j in range(len(bin(max(a))) - 2): cnt1 = 0 cnt0 = 0 for i in range(n): if (a[i] >> j) & 1: cnt1 += 1 else: cnt0 += 1 s += (cnt1 * cnt0 * 2**j) % (10**9 + 7) print((s % (10**9 + 7)))
false
30.769231
[ "-ans = 0", "-mod = 10**9 + 7", "-for j in range(60):", "- cnt1 = sum([1 for i in a if i >> j & 1])", "- cnt0 = n - cnt1", "- ans += cnt1 * cnt0 * 2**j", "-print((ans % (10**9 + 7)))", "+s = 0", "+for j in range(len(bin(max(a))) - 2):", "+ cnt1 = 0", "+ cnt0 = 0", "+ for i in...
false
0.045906
0.044507
1.031417
[ "s339370052", "s780244722" ]
u912237403
p00117
python
s472362798
s682889780
20
10
4,288
4,292
Accepted
Accepted
50
def f(x1, x2): W = [[i, 1001] for i in range(n)] W[x1] = [x1, 0] W[x2] = [x2, 2000] i=0 while 1: A = sorted(W, key = lambda x:x[1]) p1, w1 = A[i] if p1 == x2: break for p2, w2 in A[i + 1:]: way=(p1, p2) if way in cost: tmp = w1 + cost[way] W[p2] = [p2, ...
def f(x1, x2): W = [[i, 1001] for i in range(n)] W[x1] = [x1, 0] W[x2] = [x2, 2000] G = list(range(n)) while 1: A = sorted([W[e] for e in G], key = lambda x:x[1]) p1, w1 = A[0] G.remove(p1) if p1 == x2: break for p2, w2 in A[1:]: way=(p1, p2) if way in cost: ...
28
28
647
637
def f(x1, x2): W = [[i, 1001] for i in range(n)] W[x1] = [x1, 0] W[x2] = [x2, 2000] i = 0 while 1: A = sorted(W, key=lambda x: x[1]) p1, w1 = A[i] if p1 == x2: break for p2, w2 in A[i + 1 :]: way = (p1, p2) if way in cost: ...
def f(x1, x2): W = [[i, 1001] for i in range(n)] W[x1] = [x1, 0] W[x2] = [x2, 2000] G = list(range(n)) while 1: A = sorted([W[e] for e in G], key=lambda x: x[1]) p1, w1 = A[0] G.remove(p1) if p1 == x2: break for p2, w2 in A[1:]: way = (...
false
0
[ "- i = 0", "+ G = list(range(n))", "- A = sorted(W, key=lambda x: x[1])", "- p1, w1 = A[i]", "+ A = sorted([W[e] for e in G], key=lambda x: x[1])", "+ p1, w1 = A[0]", "+ G.remove(p1)", "- for p2, w2 in A[i + 1 :]:", "+ for p2, w2 in A[1:]:", "...
false
0.038413
0.038671
0.993332
[ "s472362798", "s682889780" ]
u854685063
p02773
python
s344181448
s492913758
950
579
29,668
49,140
Accepted
Accepted
39.05
import sys import math import itertools as it def i():return int(sys.stdin.readline().replace("\n","")) def i2():return list(map(int,sys.stdin.readline().replace("\n","").split())) def s():return str(sys.stdin.readline().replace("\n","")) def l():return list(sys.stdin.readline().replace("\n","")) def intl():retu...
def i(): return int(eval(input())) def i2(): return list(map(int,input().split())) def s(): return str(eval(input())) def l(): return list(eval(input())) def intl(): return list(int(k) for k in input().split()) n = i() #s = {s():0 for _ in range(n)} a = {} for i in range(n): s = eval(input()) ...
31
31
895
564
import sys import math import itertools as it def i(): return int(sys.stdin.readline().replace("\n", "")) def i2(): return list(map(int, sys.stdin.readline().replace("\n", "").split())) def s(): return str(sys.stdin.readline().replace("\n", "")) def l(): return list(sys.stdin.readline().replace(...
def i(): return int(eval(input())) def i2(): return list(map(int, input().split())) def s(): return str(eval(input())) def l(): return list(eval(input())) def intl(): return list(int(k) for k in input().split()) n = i() # s = {s():0 for _ in range(n)} a = {} for i in range(n): s = eval...
false
0
[ "-import sys", "-import math", "-import itertools as it", "-", "-", "- return int(sys.stdin.readline().replace(\"\\n\", \"\"))", "+ return int(eval(input()))", "- return list(map(int, sys.stdin.readline().replace(\"\\n\", \"\").split()))", "+ return list(map(int, input().split()))", "-...
false
0.041083
0.042023
0.977625
[ "s344181448", "s492913758" ]
u767543103
p03031
python
s065120449
s116293598
379
290
18,448
12,508
Accepted
Accepted
23.48
import numpy as np def test_switch(e_balls, sw, p): for i, e_ball in enumerate(e_balls): eb = np.asarray(e_ball) si = sw[eb - 1] if p[i] != (np.sum(si == 1) % 2): return False return True def transform_sw(sw): if sw[0] == 0: sw[0] = 1...
import numpy as np import itertools as ittr def test_switch(e_balls, sw, p): for i, e_ball in enumerate(e_balls): eb = np.asarray(e_ball) si = sw[eb - 1] if p[i] != (np.sum(si == 1) % 2): return False return True N, M = list(map(int, input().split...
52
31
976
622
import numpy as np def test_switch(e_balls, sw, p): for i, e_ball in enumerate(e_balls): eb = np.asarray(e_ball) si = sw[eb - 1] if p[i] != (np.sum(si == 1) % 2): return False return True def transform_sw(sw): if sw[0] == 0: sw[0] = 1 return sw els...
import numpy as np import itertools as ittr def test_switch(e_balls, sw, p): for i, e_ball in enumerate(e_balls): eb = np.asarray(e_ball) si = sw[eb - 1] if p[i] != (np.sum(si == 1) % 2): return False return True N, M = list(map(int, input().split())) e_balls = [] for m i...
false
40.384615
[ "+import itertools as ittr", "-def transform_sw(sw):", "- if sw[0] == 0:", "- sw[0] = 1", "- return sw", "- else:", "- sw[0] = 0", "- for i, s in enumerate(sw[1:]):", "- if s == 0:", "- sw[i + 1] = 1", "- return sw", "- elif s =...
false
0.347498
0.54509
0.637505
[ "s065120449", "s116293598" ]
u145231176
p03026
python
s017401033
s535493804
417
83
77,144
22,604
Accepted
Accepted
80.1
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
100
86
2,151
1,848
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getList(): return list(map(int, input().split())) def getArray(intn): return [int(eval(input())) for i in range(intn)] def input(): return sys.stdin.readline().rstrip() def rand_N(ran1, ran2): ...
false
14
[ "-from itertools import permutations", "+from itertools import combinations, permutations, product", "-def build_tree(N, edge_list):", "- G = [[] for i in range(N)]", "- for i in range(len(edge_list)):", "- a, b = edge_list[i]", "- G[a - 1].append(b - 1)", "- G[b - 1].append...
false
0.036148
0.044509
0.812148
[ "s017401033", "s535493804" ]
u506132575
p00065
python
s793987223
s755281036
20
10
4,600
4,604
Accepted
Accepted
50
from collections import * import sys cnt1 = Counter() cnt2 = Counter() for s in sys.stdin: if s == "\n": break n,d = list(map(int,s.split(","))) cnt1[n] += 1 for s in sys.stdin: if s == "\n": break n,d = list(map(int,s.split(","))) cnt2[n] += 1 for e in cnt1: if cnt2[e]: print...
from collections import * import sys cnt1 = Counter() cnt2 = Counter() for s in sys.stdin: if s == "\n": break cnt1[list(map(int,s.split(",")))[0]] += 1 for s in sys.stdin: if s == "\n": break cnt2[list(map(int,s.split(",")))[0]] += 1 for e in cnt1: if cnt2[e]: print(e,cnt1[e]+cnt2[e])
15
13
326
306
from collections import * import sys cnt1 = Counter() cnt2 = Counter() for s in sys.stdin: if s == "\n": break n, d = list(map(int, s.split(","))) cnt1[n] += 1 for s in sys.stdin: if s == "\n": break n, d = list(map(int, s.split(","))) cnt2[n] += 1 for e in cnt1: if cnt2[e]:...
from collections import * import sys cnt1 = Counter() cnt2 = Counter() for s in sys.stdin: if s == "\n": break cnt1[list(map(int, s.split(",")))[0]] += 1 for s in sys.stdin: if s == "\n": break cnt2[list(map(int, s.split(",")))[0]] += 1 for e in cnt1: if cnt2[e]: print(e, cn...
false
13.333333
[ "- n, d = list(map(int, s.split(\",\")))", "- cnt1[n] += 1", "+ cnt1[list(map(int, s.split(\",\")))[0]] += 1", "- n, d = list(map(int, s.split(\",\")))", "- cnt2[n] += 1", "+ cnt2[list(map(int, s.split(\",\")))[0]] += 1" ]
false
0.036238
0.062227
0.582356
[ "s793987223", "s755281036" ]
u545368057
p03363
python
s604948609
s622823012
220
191
41,620
44,548
Accepted
Accepted
13.18
from itertools import accumulate from collections import defaultdict N = int(eval(input())) As = [0]+list(map(int, input().split())) Acc = list(accumulate(As)) d = defaultdict(int) for a in Acc: d[a] += 1 ans = 0 for k in list(d.keys()): n = d[k] ans += n * (n-1)//2 print(ans)
from itertools import accumulate from collections import defaultdict n = int(eval(input())) As = list(map(int, input().split())) acc = [0]+list(accumulate(As)) d = defaultdict(int) for a in acc: d[a] += 1 ans = 0 for k in list(d.keys()): n = d[k] ans += n*(n-1)//2 print(ans)
14
14
292
289
from itertools import accumulate from collections import defaultdict N = int(eval(input())) As = [0] + list(map(int, input().split())) Acc = list(accumulate(As)) d = defaultdict(int) for a in Acc: d[a] += 1 ans = 0 for k in list(d.keys()): n = d[k] ans += n * (n - 1) // 2 print(ans)
from itertools import accumulate from collections import defaultdict n = int(eval(input())) As = list(map(int, input().split())) acc = [0] + list(accumulate(As)) d = defaultdict(int) for a in acc: d[a] += 1 ans = 0 for k in list(d.keys()): n = d[k] ans += n * (n - 1) // 2 print(ans)
false
0
[ "-N = int(eval(input()))", "-As = [0] + list(map(int, input().split()))", "-Acc = list(accumulate(As))", "+n = int(eval(input()))", "+As = list(map(int, input().split()))", "+acc = [0] + list(accumulate(As))", "-for a in Acc:", "+for a in acc:" ]
false
0.237258
0.046179
5.137796
[ "s604948609", "s622823012" ]
u623814058
p03836
python
s168803806
s223343297
29
26
9,064
9,144
Accepted
Accepted
10.34
SX,SY,TX,TY=list(map(int,input().split())) x=TX-SX y=TY-SY print((''.join(['U'*y,'R'*x,'D'*y,'L'*x,'L','U'*(y+1),'R'*(x+1),'D','R','D'*(y+1),'L'*(x+1),'U'])))
p,q,r,s=list(map(int,input().split())) x=r-p y=s-q print(('U'*y+'R'*x+'D'*y+'L'*x+'L'+'U'*(y+1)+'R'*(x+1)+'D'+'R'+'D'*(y+1)+'L'*(x+1)+'U'))
4
4
153
134
SX, SY, TX, TY = list(map(int, input().split())) x = TX - SX y = TY - SY print( ( "".join( [ "U" * y, "R" * x, "D" * y, "L" * x, "L", "U" * (y + 1), "R" * (x + 1), "D",...
p, q, r, s = list(map(int, input().split())) x = r - p y = s - q print( ( "U" * y + "R" * x + "D" * y + "L" * x + "L" + "U" * (y + 1) + "R" * (x + 1) + "D" + "R" + "D" * (y + 1) + "L" * (x + 1) + "U" ) )
false
0
[ "-SX, SY, TX, TY = list(map(int, input().split()))", "-x = TX - SX", "-y = TY - SY", "+p, q, r, s = list(map(int, input().split()))", "+x = r - p", "+y = s - q", "- \"\".join(", "- [", "- \"U\" * y,", "- \"R\" * x,", "- \"D\" * y,", ...
false
0.008199
0.093421
0.087767
[ "s168803806", "s223343297" ]
u018679195
p03243
python
s055288359
s329745015
28
17
3,064
2,940
Accepted
Accepted
39.29
num = str(eval(input())) a = [] x=[] for i in str(num): a.append(i) if a[1] <= a[0] and a[2] < a[0]: x.append(a[0]) x.append(a[0]) x.append(a[0]) print((''.join(str(i) for i in x))) elif a[1] < a[0]: x.append(a[0]) x.append(a[0]) x.append(a[0]) print((''.join(str(i) for...
a=[111,222,333,444,555,666,777,888,999] i=0 n=int(eval(input())) while a[i]<n: i=i+1 print((a[i]))
26
6
568
100
num = str(eval(input())) a = [] x = [] for i in str(num): a.append(i) if a[1] <= a[0] and a[2] < a[0]: x.append(a[0]) x.append(a[0]) x.append(a[0]) print(("".join(str(i) for i in x))) elif a[1] < a[0]: x.append(a[0]) x.append(a[0]) x.append(a[0]) print(("".join(str(i) for i in x))) e...
a = [111, 222, 333, 444, 555, 666, 777, 888, 999] i = 0 n = int(eval(input())) while a[i] < n: i = i + 1 print((a[i]))
false
76.923077
[ "-num = str(eval(input()))", "-a = []", "-x = []", "-for i in str(num):", "- a.append(i)", "-if a[1] <= a[0] and a[2] < a[0]:", "- x.append(a[0])", "- x.append(a[0])", "- x.append(a[0])", "- print((\"\".join(str(i) for i in x)))", "-elif a[1] < a[0]:", "- x.append(a[0])", "...
false
0.042531
0.047785
0.890043
[ "s055288359", "s329745015" ]
u780962115
p03346
python
s220894425
s690989892
655
471
33,468
102,396
Accepted
Accepted
28.09
#backfront N=int(eval(input())) lists=[] for _ in range(N): x=int(eval(input())) lists.append((_,x)) lists.sort(key=lambda x:x[1]) lists.append((-10000000000000000,"end")) cnt=0 now=-1 maxi=0 for i in range(N+1): p=lists[i][0] if now<p: cnt+=1 now=p elif now>p: ...
# backfront N = int(eval(input())) a = [] for _ in range(N): x = int(eval(input())) a.append((_, x)) a.sort(key=lambda x: x[1]) a.append((-10000000000000000, 10**20)) cnt, now, maxi = 0, -1, 0 for p, v in a: if now < p: cnt += 1 now = p elif now > p: maxi = max(maxi...
22
18
377
363
# backfront N = int(eval(input())) lists = [] for _ in range(N): x = int(eval(input())) lists.append((_, x)) lists.sort(key=lambda x: x[1]) lists.append((-10000000000000000, "end")) cnt = 0 now = -1 maxi = 0 for i in range(N + 1): p = lists[i][0] if now < p: cnt += 1 now = p elif now...
# backfront N = int(eval(input())) a = [] for _ in range(N): x = int(eval(input())) a.append((_, x)) a.sort(key=lambda x: x[1]) a.append((-10000000000000000, 10**20)) cnt, now, maxi = 0, -1, 0 for p, v in a: if now < p: cnt += 1 now = p elif now > p: maxi = max(maxi, cnt) ...
false
18.181818
[ "-lists = []", "+a = []", "- lists.append((_, x))", "-lists.sort(key=lambda x: x[1])", "-lists.append((-10000000000000000, \"end\"))", "-cnt = 0", "-now = -1", "-maxi = 0", "-for i in range(N + 1):", "- p = lists[i][0]", "+ a.append((_, x))", "+a.sort(key=lambda x: x[1])", "+a.appen...
false
0.044687
0.035881
1.245406
[ "s220894425", "s690989892" ]
u223663729
p02599
python
s412790734
s410707293
1,476
1,104
235,772
235,920
Accepted
Accepted
25.2
def main(): import sys input = sys.stdin.buffer.readline N, Q = map(int, input().split()) *C, = map(int, input().split()) last = [-1]*(N+1) P = [[] for _ in [0]*(N+1)] for i, c in enumerate(C): if last[c] != -1: P[last[c]].append(i+1) last[c] = i+1 ...
def main(): import os,io input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline N, Q = map(int, input().split()) *C, = map(int, input().split()) last = [-1]*(N+1) P = [[] for _ in [0]*(N+1)] for i, c in enumerate(C): if last[c] != -1: P[last[c]].append(i+1) ...
45
42
1,028
971
def main(): import sys input = sys.stdin.buffer.readline N, Q = map(int, input().split()) (*C,) = map(int, input().split()) last = [-1] * (N + 1) P = [[] for _ in [0] * (N + 1)] for i, c in enumerate(C): if last[c] != -1: P[last[c]].append(i + 1) last[c] = i + 1 ...
def main(): import os, io input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline N, Q = map(int, input().split()) (*C,) = map(int, input().split()) last = [-1] * (N + 1) P = [[] for _ in [0] * (N + 1)] for i, c in enumerate(C): if last[c] != -1: P[last[c]].append(i...
false
6.666667
[ "- import sys", "+ import os, io", "- input = sys.stdin.buffer.readline", "+ input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline", "- indices = [[] for _ in [0] * (N + 1)]", "- queries[l].append(r)", "- indices[l].append(i)", "+ queries[l].append((r, i))", ...
false
0.070297
0.069746
1.007897
[ "s412790734", "s410707293" ]
u694810977
p02947
python
s374710652
s270338557
526
464
23,400
23,396
Accepted
Accepted
11.79
import collections N = int(eval(input())) Sum = 0 lists = [] for i in range(N): s = str(eval(input())) s_list = list(s) s_list.sort() m = "".join(s_list) lists.append(m) c = collections.Counter(lists) set_lists = list(set(lists)) for i in range(len(set_lists)): n = c[str(set_list...
import collections def nCr(n, r): """ Calculate the number of combination (nCr = nPr/r!). The parameters need to meet the condition of n >= r >= 0. It returns 1 if r == 0, which means there is one pattern to choice 0 items out of the number of n. """ # 10C7 = 10C3 r = min(r, ...
18
42
369
997
import collections N = int(eval(input())) Sum = 0 lists = [] for i in range(N): s = str(eval(input())) s_list = list(s) s_list.sort() m = "".join(s_list) lists.append(m) c = collections.Counter(lists) set_lists = list(set(lists)) for i in range(len(set_lists)): n = c[str(set_lists[i])] Sum ...
import collections def nCr(n, r): """ Calculate the number of combination (nCr = nPr/r!). The parameters need to meet the condition of n >= r >= 0. It returns 1 if r == 0, which means there is one pattern to choice 0 items out of the number of n. """ # 10C7 = 10C3 r = min(r, n - r) ...
false
57.142857
[ "+", "+", "+def nCr(n, r):", "+ \"\"\"", "+ Calculate the number of combination (nCr = nPr/r!).", "+ The parameters need to meet the condition of n >= r >= 0.", "+ It returns 1 if r == 0, which means there is one pattern", "+ to choice 0 items out of the number of n.", "+ \"\"\"", ...
false
0.045809
0.087159
0.525575
[ "s374710652", "s270338557" ]
u433375322
p02576
python
s705244714
s220756984
31
27
9,148
9,152
Accepted
Accepted
12.9
import math N,X,T=list(map(int,input().split())) print((T*math.ceil(N/X)))
import math n,x,t=list(map(int,input().split())) print((math.ceil(n/x)*t))
3
3
68
68
import math N, X, T = list(map(int, input().split())) print((T * math.ceil(N / X)))
import math n, x, t = list(map(int, input().split())) print((math.ceil(n / x) * t))
false
0
[ "-N, X, T = list(map(int, input().split()))", "-print((T * math.ceil(N / X)))", "+n, x, t = list(map(int, input().split()))", "+print((math.ceil(n / x) * t))" ]
false
0.03795
0.039706
0.955757
[ "s705244714", "s220756984" ]
u794173881
p03025
python
s662460296
s804738771
582
415
85,228
115,440
Accepted
Accepted
28.69
#Combinationクラス class Combination: ''' 計算量:階乗・逆元テーブルの作成O(N) nCkを求めるO(1) ''' def __init__(self, n, MOD): self.fact = [1] for i in range(1, n + 1): self.fact.append(self.fact[-1] * i % MOD) self.inv_fact = [pow(self.fact[i] ,MOD - 2 ,MOD) for i i...
class Combination: """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う""" def __init__(self, n, MOD): self.fact = [1] for i in range(1, n + 1): self.fact.append(self.fact[-1] * i % MOD) self.inv_fact = [0] * (n + 1) self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD) ...
59
55
1,410
1,564
# Combinationクラス class Combination: """ 計算量:階乗・逆元テーブルの作成O(N) nCkを求めるO(1) """ def __init__(self, n, MOD): self.fact = [1] for i in range(1, n + 1): self.fact.append(self.fact[-1] * i % MOD) self.inv_fact = [pow(self.fact[i], MOD - 2, MOD) for i in range(n ...
class Combination: """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う""" def __init__(self, n, MOD): self.fact = [1] for i in range(1, n + 1): self.fact.append(self.fact[-1] * i % MOD) self.inv_fact = [0] * (n + 1) self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD) ...
false
6.779661
[ "-# Combinationクラス", "- \"\"\"", "- 計算量:階乗・逆元テーブルの作成O(N)", "- nCkを求めるO(1)", "- \"\"\"", "+ \"\"\"階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う\"\"\"", "- self.inv_fact = [pow(self.fact[i], MOD - 2, MOD) for i in range(n + 1)]", "+ self.inv_fact = [0] * (n + 1)", "+ ...
false
0.179856
1.264575
0.142227
[ "s662460296", "s804738771" ]
u836467497
p03448
python
s017847138
s113383423
60
53
3,060
3,060
Accepted
Accepted
11.67
# -*- coding: utf-8 -*- A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) _500 = 500 _100 = 100 _50 = 50 count = 0 for a in range(A+1): for b in range(B+1): for c in range(C+1): if X - (a*_500 + b*_100 + c*_50) == 0: co...
# -*- coding: utf-8 -*- A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) count = 0 for a in range(A+1): for b in range(B+1): for c in range(C+1): if X - (a*500 + b*100 + c*50) == 0: count = count + 1 print(count)
19
13
328
285
# -*- coding: utf-8 -*- A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) _500 = 500 _100 = 100 _50 = 50 count = 0 for a in range(A + 1): for b in range(B + 1): for c in range(C + 1): if X - (a * _500 + b * _100 + c * _50) == 0: count = c...
# -*- coding: utf-8 -*- A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) count = 0 for a in range(A + 1): for b in range(B + 1): for c in range(C + 1): if X - (a * 500 + b * 100 + c * 50) == 0: count = count + 1 print(count)
false
31.578947
[ "-_500 = 500", "-_100 = 100", "-_50 = 50", "- if X - (a * _500 + b * _100 + c * _50) == 0:", "+ if X - (a * 500 + b * 100 + c * 50) == 0:" ]
false
0.143377
0.087342
1.64155
[ "s017847138", "s113383423" ]
u841945203
p02257
python
s579783338
s379029212
370
220
5,676
5,680
Accepted
Accepted
40.54
import math def prime_number(num): if num == 1 : return 0 for i in range(2,int(math.sqrt(num))+1): if (num % i) == 0: return 0 return 1 N =int(eval(input())) count = 0 for i in range(0,N): num = int(eval(input())) count += int(prime_number(num)) print(count...
import math def isPrimeNum(num): sqrtNum = int(math.sqrt(num)) + 1 if(num == 2 or num == 3): return True elif(num % 2 == 0): return False else: for i in range(3, sqrtNum , 2): if(num % i == 0 ): return False return True count ...
15
21
310
448
import math def prime_number(num): if num == 1: return 0 for i in range(2, int(math.sqrt(num)) + 1): if (num % i) == 0: return 0 return 1 N = int(eval(input())) count = 0 for i in range(0, N): num = int(eval(input())) count += int(prime_number(num)) print(count)
import math def isPrimeNum(num): sqrtNum = int(math.sqrt(num)) + 1 if num == 2 or num == 3: return True elif num % 2 == 0: return False else: for i in range(3, sqrtNum, 2): if num % i == 0: return False return True count = 0 N = int(eval(in...
false
28.571429
[ "-def prime_number(num):", "- if num == 1:", "- return 0", "- for i in range(2, int(math.sqrt(num)) + 1):", "- if (num % i) == 0:", "- return 0", "- return 1", "+def isPrimeNum(num):", "+ sqrtNum = int(math.sqrt(num)) + 1", "+ if num == 2 or num == 3:", "+...
false
0.036605
0.038051
0.961991
[ "s579783338", "s379029212" ]
u912237403
p00090
python
s417782044
s232849449
90
80
4,604
4,608
Accepted
Accepted
11.11
import math,cmath e=1e-6 def f(m): c=1j*math.acos(a/2) p1=cmath.exp(b+c)+p p2=cmath.exp(b-c)+p s1,s2=2,2 for k in N: if k in[i,i1]:continue if abs(X[k]-p1)<1+e:s1+=1 if abs(X[k]-p2)<1+e:s2+=1 return max(m,s1,s2) while 1: n=eval(input()) if n==0:break N=list(range(n)) X=...
import math,cmath e=1e-6 def f(m): c=1j*math.acos(a/2) p1=cmath.exp(b+c)+p p2=cmath.exp(b-c)+p s1,s2=2,2 for p3 in X: if p3 in[p,p0]:continue if abs(p3-p1)<1+e:s1+=1 if abs(p3-p2)<1+e:s2+=1 return max(m,s1,s2) while 1: n=eval(input()) if n==0:break N=list(range(n)) X=[]...
29
29
511
501
import math, cmath e = 1e-6 def f(m): c = 1j * math.acos(a / 2) p1 = cmath.exp(b + c) + p p2 = cmath.exp(b - c) + p s1, s2 = 2, 2 for k in N: if k in [i, i1]: continue if abs(X[k] - p1) < 1 + e: s1 += 1 if abs(X[k] - p2) < 1 + e: s2 += 1...
import math, cmath e = 1e-6 def f(m): c = 1j * math.acos(a / 2) p1 = cmath.exp(b + c) + p p2 = cmath.exp(b - c) + p s1, s2 = 2, 2 for p3 in X: if p3 in [p, p0]: continue if abs(p3 - p1) < 1 + e: s1 += 1 if abs(p3 - p2) < 1 + e: s2 += 1 ...
false
0
[ "- for k in N:", "- if k in [i, i1]:", "+ for p3 in X:", "+ if p3 in [p, p0]:", "- if abs(X[k] - p1) < 1 + e:", "+ if abs(p3 - p1) < 1 + e:", "- if abs(X[k] - p2) < 1 + e:", "+ if abs(p3 - p2) < 1 + e:", "- for i1 in range(i + 1, n):", "- ...
false
0.040987
0.039981
1.025146
[ "s417782044", "s232849449" ]
u384744829
p02612
python
s966467675
s099297872
28
25
9,112
9,016
Accepted
Accepted
10.71
N = eval(input()) M = int(N) def cal(a): return a%1000 if M % 1000==0: print((0)) else: print((1000-cal(M)))
N=int(eval(input())) if N%1000==0: print((0)) else: N1=N%1000 print((1000-N1))
13
9
124
82
N = eval(input()) M = int(N) def cal(a): return a % 1000 if M % 1000 == 0: print((0)) else: print((1000 - cal(M)))
N = int(eval(input())) if N % 1000 == 0: print((0)) else: N1 = N % 1000 print((1000 - N1))
false
30.769231
[ "-N = eval(input())", "-M = int(N)", "-", "-", "-def cal(a):", "- return a % 1000", "-", "-", "-if M % 1000 == 0:", "+N = int(eval(input()))", "+if N % 1000 == 0:", "- print((1000 - cal(M)))", "+ N1 = N % 1000", "+ print((1000 - N1))" ]
false
0.046728
0.059638
0.783537
[ "s966467675", "s099297872" ]