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
u836311327
p02839
python
s267664539
s531801047
1,103
80
395,176
26,700
Accepted
Accepted
92.75
import sys def input(): return sys.stdin.readline().rstrip() def main(): h, w = list(map(int, input().split())) A = [list(map(int, input().split()))for i in range(h)] B = [list(map(int, input().split()))for i in range(h)] abss = [[abs(A[i][j]-B[i][j])for j in range(w)] for i in range(h)] ...
import sys def input(): return sys.stdin.readline().rstrip() def main(): h, w = list(map(int, input().split())) A = [list(map(int, input().split()))for i in range(h)] B = [list(map(int, input().split()))for i in range(h)] abss = [[abs(A[i][j]-B[i][j])for j in range(w)] for i in range(h)] ...
32
33
1,094
1,079
import sys def input(): return sys.stdin.readline().rstrip() def main(): h, w = list(map(int, input().split())) A = [list(map(int, input().split())) for i in range(h)] B = [list(map(int, input().split())) for i in range(h)] abss = [[abs(A[i][j] - B[i][j]) for j in range(w)] for i in range(h)] ...
import sys def input(): return sys.stdin.readline().rstrip() def main(): h, w = list(map(int, input().split())) A = [list(map(int, input().split())) for i in range(h)] B = [list(map(int, input().split())) for i in range(h)] abss = [[abs(A[i][j] - B[i][j]) for j in range(w)] for i in range(h)] ...
false
3.030303
[ "- kmax = 6400", "- dp = [[[0] * kmax for j in range(w)] for i in range(h)]", "- dp[0][0][abss[0][0]] = 1", "+ dp = [[0] * w for i in range(h)]", "+ dp[0][0] = 1 << (abss[0][0] + 13000)", "- for k in range(kmax):", "- if dp[i][j][k] == 1:", "- ...
false
0.045204
0.035732
1.265095
[ "s267664539", "s531801047" ]
u368249389
p02786
python
s547691359
s208448608
19
17
3,060
2,940
Accepted
Accepted
10.53
H = int(eval(input())) memo_count = {} def searchCount(h): if h==1: # 脱出条件 return 1 elif h in memo_count: return memo_count[h] else: h_half = int(h / 2) memo_count[h] = 1 + 2*searchCount(h_half) return memo_count[h] print((searchCount(H)))
# Problem D - Caracal vs Monster # input H = int(eval(input())) # initialization attack_dic = {} # calc def calc_count(h, attack): if h in attack_dic: return attack_dic[h] h = h // 2 if h>0: attack += calc_count(h, attack) * 2 + 1 attack_dic[h] = attack ...
14
25
299
406
H = int(eval(input())) memo_count = {} def searchCount(h): if h == 1: # 脱出条件 return 1 elif h in memo_count: return memo_count[h] else: h_half = int(h / 2) memo_count[h] = 1 + 2 * searchCount(h_half) return memo_count[h] print((searchCount(H)))
# Problem D - Caracal vs Monster # input H = int(eval(input())) # initialization attack_dic = {} # calc def calc_count(h, attack): if h in attack_dic: return attack_dic[h] h = h // 2 if h > 0: attack += calc_count(h, attack) * 2 + 1 attack_dic[h] = attack return attack el...
false
44
[ "+# Problem D - Caracal vs Monster", "+# input", "-memo_count = {}", "+# initialization", "+attack_dic = {}", "+# calc", "+def calc_count(h, attack):", "+ if h in attack_dic:", "+ return attack_dic[h]", "+ h = h // 2", "+ if h > 0:", "+ attack += calc_count(h, attack) * ...
false
0.049342
0.050321
0.980556
[ "s547691359", "s208448608" ]
u623819879
p02745
python
s141375807
s040115946
1,957
1,739
56,284
56,156
Accepted
Accepted
11.14
def F(a,b): A=len(a) r=[all([len(set([a[i+j],b[j],'?']))<3for j in range(min(A-i,len(b)))])for i in range(A)] return r+[1] def Z(ix): i1,i2,i3=ix;ab,bc,ac=M[i1][i2],M[i2][i3],M[i1][i3];A,B,C=list(map(len,[S[i]for i in ix]));q=A+B+C for l in range(A+1): if ab[l]!=0: for r in range(l,A+B+1): if (B<...
def F(a,b):A=len(a);r=[all([len(set([a[i+j],b[j],'?']))<3for j in range(min(A-i,len(b)))])for i in range(A)];return r+[1] def Z(X): i,j,k=X;U,V,W=M[i][j],M[j][k],M[i][k];A,B,C=list(map(len,[S[i]for i in X]));q=A+B+C for l in range(A+1): if U[l]!=0: for r in range(l,A+B+1): if (B<r-l or V[r-l]==1) and W...
14
12
541
508
def F(a, b): A = len(a) r = [ all([len(set([a[i + j], b[j], "?"])) < 3 for j in range(min(A - i, len(b)))]) for i in range(A) ] return r + [1] def Z(ix): i1, i2, i3 = ix ab, bc, ac = M[i1][i2], M[i2][i3], M[i1][i3] A, B, C = list(map(len, [S[i] for i in ix])) q = A + B ...
def F(a, b): A = len(a) r = [ all([len(set([a[i + j], b[j], "?"])) < 3 for j in range(min(A - i, len(b)))]) for i in range(A) ] return r + [1] def Z(X): i, j, k = X U, V, W = M[i][j], M[j][k], M[i][k] A, B, C = list(map(len, [S[i] for i in X])) q = A + B + C for l i...
false
14.285714
[ "-def Z(ix):", "- i1, i2, i3 = ix", "- ab, bc, ac = M[i1][i2], M[i2][i3], M[i1][i3]", "- A, B, C = list(map(len, [S[i] for i in ix]))", "+def Z(X):", "+ i, j, k = X", "+ U, V, W = M[i][j], M[j][k], M[i][k]", "+ A, B, C = list(map(len, [S[i] for i in X]))", "- if ab[l] != 0:"...
false
0.043836
0.044886
0.976618
[ "s141375807", "s040115946" ]
u562935282
p03040
python
s131502665
s780841618
1,003
780
11,208
74,308
Accepted
Accepted
22.23
from heapq import heappop, heappush import sys input = sys.stdin.readline class median_o1: def __init__(self): self.count = 0 self.al = [] self.ar = [] self.sl = 0 self.sr = 0 self.b = 0 def update_b(self, b): self.b += b def ins...
def main(): from heapq import heappush, heappop, heappushpop import sys input = sys.stdin.readline class Median: def __init__(self): self.b = 0 self.l = [] self.sum_l = 0 self.r = [] self.sum_r = 0 def update(se...
64
48
1,586
1,313
from heapq import heappop, heappush import sys input = sys.stdin.readline class median_o1: def __init__(self): self.count = 0 self.al = [] self.ar = [] self.sl = 0 self.sr = 0 self.b = 0 def update_b(self, b): self.b += b def insert(self, x): ...
def main(): from heapq import heappush, heappop, heappushpop import sys input = sys.stdin.readline class Median: def __init__(self): self.b = 0 self.l = [] self.sum_l = 0 self.r = [] self.sum_r = 0 def update(self, a: int, b:...
false
25
[ "-from heapq import heappop, heappush", "-import sys", "+def main():", "+ from heapq import heappush, heappop, heappushpop", "+ import sys", "-input = sys.stdin.readline", "+ input = sys.stdin.readline", "+", "+ class Median:", "+ def __init__(self):", "+ self.b = 0...
false
0.042071
0.035895
1.172053
[ "s131502665", "s780841618" ]
u952708174
p03739
python
s414177559
s115776489
104
88
14,468
14,332
Accepted
Accepted
15.38
def c_Sequence(N, A): total = 0 # 変化量の総量 tmp1 = 0 # 条件を満たすために今見ている項をどれだけ変化させるか for i in range(N): total += A[i] # 奇数番目を正に、偶数番目を負にする(0-indexedで) if i % 2 == 0: if total >= 0: tmp1 += abs(-1 - total) total -= abs(-1 - total) ...
def c_sequence(): N = int(eval(input())) A = [int(i) for i in input().split()] def solver(sign): ret, total = 0, 0 for a in A: total += a if sign * total <= 0: ret += abs(sign - total) # 総和がsignになるまでaを変化させる total = sign ...
33
17
908
453
def c_Sequence(N, A): total = 0 # 変化量の総量 tmp1 = 0 # 条件を満たすために今見ている項をどれだけ変化させるか for i in range(N): total += A[i] # 奇数番目を正に、偶数番目を負にする(0-indexedで) if i % 2 == 0: if total >= 0: tmp1 += abs(-1 - total) total -= abs(-1 - total) else: ...
def c_sequence(): N = int(eval(input())) A = [int(i) for i in input().split()] def solver(sign): ret, total = 0, 0 for a in A: total += a if sign * total <= 0: ret += abs(sign - total) # 総和がsignになるまでaを変化させる total = sign si...
false
48.484848
[ "-def c_Sequence(N, A):", "- total = 0 # 変化量の総量", "- tmp1 = 0 # 条件を満たすために今見ている項をどれだけ変化させるか", "- for i in range(N):", "- total += A[i]", "- # 奇数番目を正に、偶数番目を負にする(0-indexedで)", "- if i % 2 == 0:", "- if total >= 0:", "- tmp1 += abs(-1 - total)", ...
false
0.038691
0.065983
0.58637
[ "s414177559", "s115776489" ]
u644907318
p03599
python
s977494396
s922367441
186
127
40,048
73,536
Accepted
Accepted
31.72
A,B,C,D,E,F = list(map(int,input().split())) xmax = 100*A kmax = 0 for n in range(31): for m in range(31): x = 100*(n*A+m*B) ymax = min((n*A+m*B)*E,F-100*(n*A+m*B)) for k in range(ymax,ymax-C-1,-1): t = 0 flag = 0 while k-t*D>=0: ...
A,B,C,D,E,F = list(map(int,input().split())) a = 0 x = 100*A y = 0 for n in range(30): for m in range(30): if n*100*A+m*100*B>F:continue c = (n*A+m*B)*E d = F-100*(n*A+m*B) for k in range(min(c,d)+1): for l in range(min(c,d)+1): if k*C+l*D>(n*A+...
20
17
566
542
A, B, C, D, E, F = list(map(int, input().split())) xmax = 100 * A kmax = 0 for n in range(31): for m in range(31): x = 100 * (n * A + m * B) ymax = min((n * A + m * B) * E, F - 100 * (n * A + m * B)) for k in range(ymax, ymax - C - 1, -1): t = 0 flag = 0 w...
A, B, C, D, E, F = list(map(int, input().split())) a = 0 x = 100 * A y = 0 for n in range(30): for m in range(30): if n * 100 * A + m * 100 * B > F: continue c = (n * A + m * B) * E d = F - 100 * (n * A + m * B) for k in range(min(c, d) + 1): for l in range(mi...
false
15
[ "-xmax = 100 * A", "-kmax = 0", "-for n in range(31):", "- for m in range(31):", "- x = 100 * (n * A + m * B)", "- ymax = min((n * A + m * B) * E, F - 100 * (n * A + m * B))", "- for k in range(ymax, ymax - C - 1, -1):", "- t = 0", "- flag = 0", "- ...
false
0.04571
1.153804
0.039617
[ "s977494396", "s922367441" ]
u072053884
p02300
python
s367035194
s020091122
820
610
24,488
19,624
Accepted
Accepted
25.61
def cross(c1, c2): return c1.real * c2.imag - c1.imag * c2.real def ccw(p0, p1, p2): if cross(p1 - p0, p2 - p0) > 0: return True else: False # Andrew's algorithm import collections def andrew(point_list): point_list.sort(key = lambda c: (c.imag, c.real)) point_que = ...
def ccw(p1, p2, p3): return (p2[1] - p1[1]) * (p3[0] - p1[0]) - (p2[0] - p1[0]) * (p3[1] - p1[1]) > 0 # Andrew's algorithm def andrew(point_list): u = [] l = [] point_list.sort() u.append(point_list[0]) u.append(point_list[1]) l.append(point_list[-1]) l.append(point...
61
56
1,545
1,057
def cross(c1, c2): return c1.real * c2.imag - c1.imag * c2.real def ccw(p0, p1, p2): if cross(p1 - p0, p2 - p0) > 0: return True else: False # Andrew's algorithm import collections def andrew(point_list): point_list.sort(key=lambda c: (c.imag, c.real)) point_que = collections.d...
def ccw(p1, p2, p3): return (p2[1] - p1[1]) * (p3[0] - p1[0]) - (p2[0] - p1[0]) * (p3[1] - p1[1]) > 0 # Andrew's algorithm def andrew(point_list): u = [] l = [] point_list.sort() u.append(point_list[0]) u.append(point_list[1]) l.append(point_list[-1]) l.append(point_list[-2]) # out...
false
8.196721
[ "-def cross(c1, c2):", "- return c1.real * c2.imag - c1.imag * c2.real", "-", "-", "-def ccw(p0, p1, p2):", "- if cross(p1 - p0, p2 - p0) > 0:", "- return True", "- else:", "- False", "+def ccw(p1, p2, p3):", "+ return (p2[1] - p1[1]) * (p3[0] - p1[0]) - (p2[0] - p1[0])...
false
0.10532
0.037466
2.811076
[ "s367035194", "s020091122" ]
u531436689
p02948
python
s801147596
s801665731
807
312
20,184
20,968
Accepted
Accepted
61.34
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools from collections import deque sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 DR = [1, -1, 0, 0] DC = [0, 0, 1, -1] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): r...
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools from collections import deque sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 DR = [1, -1, 0, 0] DC = [0, 0, 1, -1] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): r...
53
39
1,524
1,090
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools from collections import deque sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 DR = [1, -1, 0, 0] DC = [0, 0, 1, -1] def LI(): return [int(x) for x in sys.stdin.readline().split()] def ...
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools from collections import deque sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 DR = [1, -1, 0, 0] DC = [0, 0, 1, -1] def LI(): return [int(x) for x in sys.stdin.readline().split()] def ...
false
26.415094
[ "-def _heappush_max(heap, item):", "- heap.append(item)", "- heapq._siftdown_max(heap, 0, len(heap) - 1)", "-", "-", "-def _heappop_max(heap):", "- \"\"\"Maxheap version of a heappop.\"\"\"", "- lastelt = heap.pop() # raises appropriate IndexError if heap is empty", "- if heap:", "...
false
0.05979
0.059462
1.005517
[ "s801147596", "s801665731" ]
u225388820
p02558
python
s524798889
s843506077
286
230
75,216
84,188
Accepted
Accepted
19.58
class UnionFind: __slots__ = ["N", "root", "rank"] def __init__(self, N): """ N:要素数 root:各要素の親要素の番号を格納するリスト. ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数. rank:ランク """ self.N = N self.root = [-1] * N self.rank = [0] * N ...
class UnionFind: __slots__ = ["N", "root", "rank"] def __init__(self, N): """ N:要素数 root:各要素の親要素の番号を格納するリスト. ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数. rank:ランク """ self.N = N self.root = [-1] * N self.rank = [0] * N ...
78
80
2,061
2,109
class UnionFind: __slots__ = ["N", "root", "rank"] def __init__(self, N): """ N:要素数 root:各要素の親要素の番号を格納するリスト. ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数. rank:ランク """ self.N = N self.root = [-1] * N self.rank = [0] * N def __repr__(...
class UnionFind: __slots__ = ["N", "root", "rank"] def __init__(self, N): """ N:要素数 root:各要素の親要素の番号を格納するリスト. ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数. rank:ランク """ self.N = N self.root = [-1] * N self.rank = [0] * N def __repr__(...
false
2.5
[ "+res = []", "- print((int(uf.same(u, v))))", "+ res.append(int(uf.same(u, v)))", "+print((\"\\n\".join(map(str, res))))" ]
false
0.096054
0.039383
2.438958
[ "s524798889", "s843506077" ]
u580697892
p02727
python
s765259236
s279525340
280
250
23,328
23,328
Accepted
Accepted
10.71
# coding: utf-8 X, Y, A, B, C = list(map(int, input().split())) P = list(map(int, input().split())) Q = list(map(int, input().split())) R = list(map(int, input().split())) P.sort(reverse=True) Q.sort(reverse=True) R.sort(reverse=True) ans = 0 L = P[:X] + Q[:Y] L.sort() idx = 0 for i in range(X+Y): if i...
# coding: utf-8 X, Y, A, B, C = list(map(int, input().split())) P = list(map(int, input().split())) Q = list(map(int, input().split())) R = list(map(int, input().split())) P.sort(reverse=True) Q.sort(reverse=True) R.sort(reverse=False) ans = 0 L = P[:X] + Q[:Y] + R L.sort(reverse=True) print((sum(L[:X+Y])))
19
12
416
311
# coding: utf-8 X, Y, A, B, C = list(map(int, input().split())) P = list(map(int, input().split())) Q = list(map(int, input().split())) R = list(map(int, input().split())) P.sort(reverse=True) Q.sort(reverse=True) R.sort(reverse=True) ans = 0 L = P[:X] + Q[:Y] L.sort() idx = 0 for i in range(X + Y): if idx >= C: ...
# coding: utf-8 X, Y, A, B, C = list(map(int, input().split())) P = list(map(int, input().split())) Q = list(map(int, input().split())) R = list(map(int, input().split())) P.sort(reverse=True) Q.sort(reverse=True) R.sort(reverse=False) ans = 0 L = P[:X] + Q[:Y] + R L.sort(reverse=True) print((sum(L[: X + Y])))
false
36.842105
[ "-R.sort(reverse=True)", "+R.sort(reverse=False)", "-L = P[:X] + Q[:Y]", "-L.sort()", "-idx = 0", "-for i in range(X + Y):", "- if idx >= C:", "- break", "- if L[i] < R[idx]:", "- L[i] = R[idx]", "- idx += 1", "-print((sum(L)))", "+L = P[:X] + Q[:Y] + R", "+L.sor...
false
0.037506
0.083237
0.45059
[ "s765259236", "s279525340" ]
u806976856
p03805
python
s970076680
s089475066
68
34
67,992
8,780
Accepted
Accepted
50
n,m=list(map(int,input().split())) road=[[] for _ in range(n+1)] for i in range(m): a,b=list(map(int,input().split())) road[a].append(b) road[b].append(a) dp=[[0]*(n+1) for _ in range(2**n)] dp[1][1]=1 for i in range(1,2**n): for j in range(1,n+1): for k in road[j]: if not...
n,m=list(map(int,input().split())) root=[[] for _ in range(n+1)] for i in range(m): a,b=list(map(int,input().split())) root[a].append(b) root[b].append(a) s=[0]*(n+1) s[0]=1 s[1]=1 ans=0 def f(a,x): global ans for i in root[a]: if x[i]==0: x[i]=1 f(i,x)...
15
22
394
392
n, m = list(map(int, input().split())) road = [[] for _ in range(n + 1)] for i in range(m): a, b = list(map(int, input().split())) road[a].append(b) road[b].append(a) dp = [[0] * (n + 1) for _ in range(2**n)] dp[1][1] = 1 for i in range(1, 2**n): for j in range(1, n + 1): for k in road[j]: ...
n, m = list(map(int, input().split())) root = [[] for _ in range(n + 1)] for i in range(m): a, b = list(map(int, input().split())) root[a].append(b) root[b].append(a) s = [0] * (n + 1) s[0] = 1 s[1] = 1 ans = 0 def f(a, x): global ans for i in root[a]: if x[i] == 0: x[i] = 1 ...
false
31.818182
[ "-road = [[] for _ in range(n + 1)]", "+root = [[] for _ in range(n + 1)]", "- road[a].append(b)", "- road[b].append(a)", "-dp = [[0] * (n + 1) for _ in range(2**n)]", "-dp[1][1] = 1", "-for i in range(1, 2**n):", "- for j in range(1, n + 1):", "- for k in road[j]:", "- ...
false
0.068158
0.064761
1.052452
[ "s970076680", "s089475066" ]
u150984829
p02386
python
s736670953
s915930941
110
30
5,660
5,660
Accepted
Accepted
72.73
from itertools import* def g(): n=int(eval(input())) a=[[s for s in input().split()]for _ in range(n)] for b in a: b[3:5]=b[4],b[3] t=0 for d,e in combinations(a,2): for p in('012345','152043','215304','302541','410352','514320'): f=[d[int(i)]for i in p] if f[0]==e[0]and f[5]==e[5]: f=f[1:...
from itertools import* n=int(eval(input())) a=[input().split()for _ in[0]*n] for b in a: b[3:5]=b[4],b[3] def f(): for d,e in combinations(a,2): for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]): f=[d[i]for i in p] if f[0]==e[0]and f[5]==e[5]: f=f[1:5]...
16
15
403
404
from itertools import * def g(): n = int(eval(input())) a = [[s for s in input().split()] for _ in range(n)] for b in a: b[3:5] = b[4], b[3] t = 0 for d, e in combinations(a, 2): for p in ("012345", "152043", "215304", "302541", "410352", "514320"): f = [d[int(i)] for i...
from itertools import * n = int(eval(input())) a = [input().split() for _ in [0] * n] for b in a: b[3:5] = b[4], b[3] def f(): for d, e in combinations(a, 2): for p in ( [0, 1, 2, 3, 4, 5], [1, 5, 2, 0, 4, 3], [2, 1, 5, 3, 0, 4], [3, 0, 2, 5, 4, 1], ...
false
6.25
[ "+n = int(eval(input()))", "+a = [input().split() for _ in [0] * n]", "+for b in a:", "+ b[3:5] = b[4], b[3]", "-def g():", "- n = int(eval(input()))", "- a = [[s for s in input().split()] for _ in range(n)]", "- for b in a:", "- b[3:5] = b[4], b[3]", "- t = 0", "+", "+de...
false
0.090532
0.10318
0.877412
[ "s736670953", "s915930941" ]
u762420987
p03085
python
s118730960
s309506336
19
17
3,060
2,940
Accepted
Accepted
10.53
print(({"A": "T", "C": "G", "G": "C", "T": "A"}[eval(input())]))
a = {"A": "T", "T": "A", "C": "G", "G": "C"} print((a[eval(input())]))
1
2
56
64
print(({"A": "T", "C": "G", "G": "C", "T": "A"}[eval(input())]))
a = {"A": "T", "T": "A", "C": "G", "G": "C"} print((a[eval(input())]))
false
50
[ "-print(({\"A\": \"T\", \"C\": \"G\", \"G\": \"C\", \"T\": \"A\"}[eval(input())]))", "+a = {\"A\": \"T\", \"T\": \"A\", \"C\": \"G\", \"G\": \"C\"}", "+print((a[eval(input())]))" ]
false
0.084584
0.084394
1.002245
[ "s118730960", "s309506336" ]
u439396449
p04046
python
s718080819
s829026072
951
241
18,764
18,804
Accepted
Accepted
74.66
H, W, A, B = list(map(int, input().split())) mod = 10 ** 9 + 7 # 階乗 fac = [1] * (H + W - 2) # 逆元 inv = [1] * (H + W - 2) for i in range(1, H + W - 2): fac[i] = (fac[i - 1] * i) % mod inv[i] = pow(fac[i], mod - 2, mod) def f(x, y): res = fac[x + y] * inv[x] * inv[y] return res % mod ...
H, W, A, B = list(map(int, input().split())) mod = 10**9 + 7 N = H + W - 2 # 階乗 fac = [1] * N for i in range(1, N): fac[i] = (fac[i - 1] * i) % mod # 逆元 inv = [1] * N inv[N - 1] = pow(fac[N - 1], mod - 2, mod) for i in range(N - 1, 0, -1): inv[i - 1] = (inv[i] * i) % mod def f(x, y): ...
23
26
418
475
H, W, A, B = list(map(int, input().split())) mod = 10**9 + 7 # 階乗 fac = [1] * (H + W - 2) # 逆元 inv = [1] * (H + W - 2) for i in range(1, H + W - 2): fac[i] = (fac[i - 1] * i) % mod inv[i] = pow(fac[i], mod - 2, mod) def f(x, y): res = fac[x + y] * inv[x] * inv[y] return res % mod ans = 0 for x in ra...
H, W, A, B = list(map(int, input().split())) mod = 10**9 + 7 N = H + W - 2 # 階乗 fac = [1] * N for i in range(1, N): fac[i] = (fac[i - 1] * i) % mod # 逆元 inv = [1] * N inv[N - 1] = pow(fac[N - 1], mod - 2, mod) for i in range(N - 1, 0, -1): inv[i - 1] = (inv[i] * i) % mod def f(x, y): res = fac[x + y] * in...
false
11.538462
[ "+N = H + W - 2", "-fac = [1] * (H + W - 2)", "+fac = [1] * N", "+for i in range(1, N):", "+ fac[i] = (fac[i - 1] * i) % mod", "-inv = [1] * (H + W - 2)", "-for i in range(1, H + W - 2):", "- fac[i] = (fac[i - 1] * i) % mod", "- inv[i] = pow(fac[i], mod - 2, mod)", "+inv = [1] * N", "+i...
false
0.120434
0.008194
14.698453
[ "s718080819", "s829026072" ]
u285891772
p03339
python
s084059969
s721815948
305
227
19,892
19,496
Accepted
Accepted
25.57
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2 from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
47
39
1,184
1,149
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, ) # , log2 from itertools import ( accumulate, permutations, combinations, combi...
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, ) # , log2 from itertools import ( accumulate, permutations, combinations, combi...
false
17.021277
[ "-W = [0] * N", "-E = [0] * N", "-tmp = 0", "-for i in range(N):", "+tmp_W = 0", "+tmp_E = 0", "+cnt = [0] * len(S)", "+for i in range(len(S)):", "- tmp += 1", "- W[i] = tmp", "-tmp = 0", "-for i in range(N - 1, -1, -1):", "+ tmp_W += 1", "+ cnt[i] += tmp_W", "+for i ...
false
0.040088
0.039258
1.021139
[ "s084059969", "s721815948" ]
u897536433
p02971
python
s234298266
s695934444
648
572
14,660
13,348
Accepted
Accepted
11.73
n = int(eval(input())) a = [0]*n for i in range(n): a[i] = int(eval(input())) amax = sorted(a)[-1] amax2 = sorted(a)[-2] for i in range(n): if a[i] == amax: print(amax2) else: print(amax)
n = int(eval(input())) a = [0]*n for i in range(n): a[i] = int(eval(input())) amax = sorted(a)[-2:] for i in range(n): if a[i] == amax[1]: print((amax[0])) else: print((amax[1]))
11
10
214
200
n = int(eval(input())) a = [0] * n for i in range(n): a[i] = int(eval(input())) amax = sorted(a)[-1] amax2 = sorted(a)[-2] for i in range(n): if a[i] == amax: print(amax2) else: print(amax)
n = int(eval(input())) a = [0] * n for i in range(n): a[i] = int(eval(input())) amax = sorted(a)[-2:] for i in range(n): if a[i] == amax[1]: print((amax[0])) else: print((amax[1]))
false
9.090909
[ "-amax = sorted(a)[-1]", "-amax2 = sorted(a)[-2]", "+amax = sorted(a)[-2:]", "- if a[i] == amax:", "- print(amax2)", "+ if a[i] == amax[1]:", "+ print((amax[0]))", "- print(amax)", "+ print((amax[1]))" ]
false
0.040086
0.047515
0.843648
[ "s234298266", "s695934444" ]
u525065967
p02578
python
s335147700
s414889039
128
118
32,256
25,164
Accepted
Accepted
7.81
n = int(eval(input())) A = [*list(map(int, input().split()))] s = maxA = 0 for a in A: maxA = max(maxA, a) s += maxA - a print(s)
_ = int(eval(input())) s = h = 0 for a in map(int, input().split()): h = max(h, a) s += h - a print(s)
7
6
132
110
n = int(eval(input())) A = [*list(map(int, input().split()))] s = maxA = 0 for a in A: maxA = max(maxA, a) s += maxA - a print(s)
_ = int(eval(input())) s = h = 0 for a in map(int, input().split()): h = max(h, a) s += h - a print(s)
false
14.285714
[ "-n = int(eval(input()))", "-A = [*list(map(int, input().split()))]", "-s = maxA = 0", "-for a in A:", "- maxA = max(maxA, a)", "- s += maxA - a", "+_ = int(eval(input()))", "+s = h = 0", "+for a in map(int, input().split()):", "+ h = max(h, a)", "+ s += h - a" ]
false
0.046027
0.045034
1.022058
[ "s335147700", "s414889039" ]
u653239976
p02399
python
s070936622
s339565595
30
10
6,440
6,440
Accepted
Accepted
66.67
#coding: UTF-8 l = input().split() a = int(l[0]) b = int(l[1]) if 1 <= a and b <= 1000000000: d = a / b r = a % b f = float (a )/ b print("%d %d %f" %(d, r, f))
#coding: UTF-8 l = input().split() a = int(l[0]) b = int(l[1]) if 1 <= a and b <= 10**9: d = a / b r = a % b f = float (a )/ b print("%d %d %f" %(d, r, f))
15
15
187
182
# coding: UTF-8 l = input().split() a = int(l[0]) b = int(l[1]) if 1 <= a and b <= 1000000000: d = a / b r = a % b f = float(a) / b print("%d %d %f" % (d, r, f))
# coding: UTF-8 l = input().split() a = int(l[0]) b = int(l[1]) if 1 <= a and b <= 10**9: d = a / b r = a % b f = float(a) / b print("%d %d %f" % (d, r, f))
false
0
[ "-if 1 <= a and b <= 1000000000:", "+if 1 <= a and b <= 10**9:" ]
false
0.063687
0.05228
1.218196
[ "s070936622", "s339565595" ]
u596276291
p03645
python
s495473986
s734663426
768
598
51,324
19,748
Accepted
Accepted
22.14
from collections import defaultdict from itertools import product, groupby from math import pi from collections import deque from bisect import bisect, bisect_left, bisect_right INF = 10 ** 10 def main(): N, M = list(map(int, input().split())) graph = defaultdict(list) for _ in range(M): ...
from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt from collections import deque from bisect import bisect, bisect_left, bisect_right from string import ascii_lowercase from functools import lru_cache import sys sys.se...
25
47
587
1,132
from collections import defaultdict from itertools import product, groupby from math import pi from collections import deque from bisect import bisect, bisect_left, bisect_right INF = 10**10 def main(): N, M = list(map(int, input().split())) graph = defaultdict(list) for _ in range(M): a, b = lis...
from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt from collections import deque from bisect import bisect, bisect_left, bisect_right from string import ascii_lowercase from functools import lru_cache import sys sys.setrecurs...
false
46.808511
[ "-from collections import defaultdict", "-from itertools import product, groupby", "-from math import pi", "+from collections import defaultdict, Counter", "+from itertools import product, groupby, count, permutations, combinations", "+from math import pi, sqrt", "+from string import ascii_lowercase", ...
false
0.048278
0.048239
1.000802
[ "s495473986", "s734663426" ]
u062999487
p03719
python
s691264431
s088441524
373
61
79,688
61,844
Accepted
Accepted
83.65
A, B, C = list(map(int, input().split())) if (C >= A) & (C <= B): print("Yes") else: print("No")
A, B, C = list(map(int, input().split())) if C >= A and C <= B: print("Yes") else: print("No")
6
6
101
99
A, B, C = list(map(int, input().split())) if (C >= A) & (C <= B): print("Yes") else: print("No")
A, B, C = list(map(int, input().split())) if C >= A and C <= B: print("Yes") else: print("No")
false
0
[ "-if (C >= A) & (C <= B):", "+if C >= A and C <= B:" ]
false
0.045613
0.006721
6.786623
[ "s691264431", "s088441524" ]
u905203728
p03295
python
s421324257
s375271233
446
369
29,848
19,012
Accepted
Accepted
17.26
n,m=list(map(int,input().split())) box=[list(map(int,input().split())) for i in range(m)] box=sorted(box,key=lambda x:x[1]) count,cut=0,0 for x,y in box: if cut<=x: count +=1 cut=y print(count)
n,m=list(map(int,input().split())) AB=[tuple(map(int,input().split())) for _ in range(m)] AB=sorted(AB, key=lambda x: x[1]) cnt,cut=0,0 for a,b in AB: if cut<=a: cnt +=1 cut=b print(cnt)
11
12
227
214
n, m = list(map(int, input().split())) box = [list(map(int, input().split())) for i in range(m)] box = sorted(box, key=lambda x: x[1]) count, cut = 0, 0 for x, y in box: if cut <= x: count += 1 cut = y print(count)
n, m = list(map(int, input().split())) AB = [tuple(map(int, input().split())) for _ in range(m)] AB = sorted(AB, key=lambda x: x[1]) cnt, cut = 0, 0 for a, b in AB: if cut <= a: cnt += 1 cut = b print(cnt)
false
8.333333
[ "-box = [list(map(int, input().split())) for i in range(m)]", "-box = sorted(box, key=lambda x: x[1])", "-count, cut = 0, 0", "-for x, y in box:", "- if cut <= x:", "- count += 1", "- cut = y", "-print(count)", "+AB = [tuple(map(int, input().split())) for _ in range(m)]", "+AB = s...
false
0.080083
0.07676
1.043286
[ "s421324257", "s375271233" ]
u782001565
p03106
python
s686101283
s351548525
32
28
9,028
8,892
Accepted
Accepted
12.5
A, B, K = list(map(int, input().split())) i_list = [] for i in range(1, A + 1): if A % i == 0 and B % i == 0: i_list.append(str(i)) print((i_list[len(i_list) - K]))
A, B, K = list(map(int, input().split())) i_list = [] for i in range(1, A + 1): if A % i == 0 and B % i == 0: i_list.append(i) print((i_list[-K]))
9
7
179
157
A, B, K = list(map(int, input().split())) i_list = [] for i in range(1, A + 1): if A % i == 0 and B % i == 0: i_list.append(str(i)) print((i_list[len(i_list) - K]))
A, B, K = list(map(int, input().split())) i_list = [] for i in range(1, A + 1): if A % i == 0 and B % i == 0: i_list.append(i) print((i_list[-K]))
false
22.222222
[ "- i_list.append(str(i))", "-print((i_list[len(i_list) - K]))", "+ i_list.append(i)", "+print((i_list[-K]))" ]
false
0.084019
0.037393
2.246906
[ "s686101283", "s351548525" ]
u223555291
p02681
python
s415524257
s291974918
24
19
9,060
9,076
Accepted
Accepted
20.83
s=eval(input()) t=eval(input()) import sys for i in range(len(s)): if s[i]==t[i]: pass else: print("No") sys.exit() print('Yes')
a=eval(input()) b=eval(input()) import sys for i in range(len(a)): if a[i]==b[i]: pass else: print("No") sys.exit() print('Yes')
10
10
157
158
s = eval(input()) t = eval(input()) import sys for i in range(len(s)): if s[i] == t[i]: pass else: print("No") sys.exit() print("Yes")
a = eval(input()) b = eval(input()) import sys for i in range(len(a)): if a[i] == b[i]: pass else: print("No") sys.exit() print("Yes")
false
0
[ "-s = eval(input())", "-t = eval(input())", "+a = eval(input())", "+b = eval(input())", "-for i in range(len(s)):", "- if s[i] == t[i]:", "+for i in range(len(a)):", "+ if a[i] == b[i]:" ]
false
0.101
0.096806
1.043331
[ "s415524257", "s291974918" ]
u316464887
p02937
python
s978248375
s376789145
1,684
153
3,452
13,228
Accepted
Accepted
90.91
def main(): s = eval(input()) t = eval(input()) if not set(t).issubset(set(s)): return -1 m = 0 st = s for i in t: if i in st: j = st.index(i) m += j + 1 st = st[j+1:] else: m += len(st) st = s ...
import bisect def main(): s = eval(input()) t = eval(input()) if not set(t).issubset(set(s)): return -1 d = {} n = len(s) for i, v in enumerate(s): if v in d: d[v].append(i) d[v].append(i + n) else: d[v] = [i, i+n] for...
20
27
413
598
def main(): s = eval(input()) t = eval(input()) if not set(t).issubset(set(s)): return -1 m = 0 st = s for i in t: if i in st: j = st.index(i) m += j + 1 st = st[j + 1 :] else: m += len(st) st = s j =...
import bisect def main(): s = eval(input()) t = eval(input()) if not set(t).issubset(set(s)): return -1 d = {} n = len(s) for i, v in enumerate(s): if v in d: d[v].append(i) d[v].append(i + n) else: d[v] = [i, i + n] for i in d: ...
false
25.925926
[ "+import bisect", "+", "+", "+ d = {}", "+ n = len(s)", "+ for i, v in enumerate(s):", "+ if v in d:", "+ d[v].append(i)", "+ d[v].append(i + n)", "+ else:", "+ d[v] = [i, i + n]", "+ for i in d:", "+ d[i] = sorted(d[i])", "...
false
0.039859
0.034495
1.155496
[ "s978248375", "s376789145" ]
u348805958
p02609
python
s087084582
s733306199
218
142
91,252
85,488
Accepted
Accepted
34.86
#!python3 import sys iim = lambda: map(int, sys.stdin.readline().rstrip().split()) from functools import lru_cache @lru_cache(maxsize=2*10**5) def f2(x): if x == 0: return 0 y = bin(x).count("1") return 1 + f2(x % y) def resolve(): N = int(input()) S = input() cnt0 = S.count(...
#!python3 import sys iim = lambda: map(int, sys.stdin.readline().rstrip().split()) def resolve(): N = int(input()) S = input() cnt0 = S.count("1") if cnt0 == 0: print(*[1]*N, sep="\n") return X = int(S, 2) def f2(): cache = [-1] * max(9, cnt0+1) ...
51
61
969
1,228
#!python3 import sys iim = lambda: map(int, sys.stdin.readline().rstrip().split()) from functools import lru_cache @lru_cache(maxsize=2 * 10**5) def f2(x): if x == 0: return 0 y = bin(x).count("1") return 1 + f2(x % y) def resolve(): N = int(input()) S = input() cnt0 = S.count("1") ...
#!python3 import sys iim = lambda: map(int, sys.stdin.readline().rstrip().split()) def resolve(): N = int(input()) S = input() cnt0 = S.count("1") if cnt0 == 0: print(*[1] * N, sep="\n") return X = int(S, 2) def f2(): cache = [-1] * max(9, cnt0 + 1) cache[0] =...
false
16.393443
[ "-from functools import lru_cache", "-", "-", "-@lru_cache(maxsize=2 * 10**5)", "-def f2(x):", "- if x == 0:", "- return 0", "- y = bin(x).count(\"1\")", "- return 1 + f2(x % y)", "+", "+ def f2():", "+ cache = [-1] * max(9, cnt0 + 1)", "+ cache[0] = 0", "+...
false
0.036528
0.108364
0.337089
[ "s087084582", "s733306199" ]
u021019433
p02837
python
s564610770
s456284110
191
95
3,064
6,500
Accepted
Accepted
50.26
def popcount(x): r = 0 while x: r += 1 x &= x - 1 return r n = int(eval(input())) r = list(range(n)) a = [[0, 0] for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y] |= 1 << (x - 1) m = 0 l = (1 << n) - 1 for x in range(1...
def popcount(x): r, q = 0, x while x: r += 1 x &= x - 1 return r, q n = int(eval(input())) r = list(range(n)) a = [[0, 0] for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y] |= 1 << (x - 1) l = (1 << n) - 1 b = sorted(map(p...
21
19
418
460
def popcount(x): r = 0 while x: r += 1 x &= x - 1 return r n = int(eval(input())) r = list(range(n)) a = [[0, 0] for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y] |= 1 << (x - 1) m = 0 l = (1 << n) - 1 for x in ra...
def popcount(x): r, q = 0, x while x: r += 1 x &= x - 1 return r, q n = int(eval(input())) r = list(range(n)) a = [[0, 0] for _ in r] for i in r: for _ in range(int(eval(input()))): x, y = list(map(int, input().split())) a[i][y] |= 1 << (x - 1) l = (1 << n) - 1 b = sort...
false
9.52381
[ "- r = 0", "+ r, q = 0, x", "- return r", "+ return r, q", "-m = 0", "-for x in range(1, l + 1):", "- if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):", "- m = max(m, popcount(x))", "-print(m)", "+b = sorted(map(popcount, list(range(1, l + 1))))", "+ans...
false
0.036774
0.042041
0.87471
[ "s564610770", "s456284110" ]
u677121387
p02862
python
s178038340
s925226762
255
124
29,300
3,188
Accepted
Accepted
51.37
x,y = list(map(int,input().split())) ans = 0 mod = 10**9+7 if (x+y)%3 == 0: m = (2*y-x)//3 n = (2*x-y)//3 if m >= 0 and n >= 0: fac = [1]*(m+n+1) for i in range(2,m+n+1): fac[i] = fac[i-1]*i % mod ans = fac[m+n]*(pow(fac[m],mod-2,mod)*pow(fac[n],mod-2,mod)%mo...
def comb(n,k,mod): x = y = 1 for i in range(min(k,n-k)): x = x*(n-i)%mod y = y*(i+1)%mod return x * pow(y, mod-2, mod) % mod x,y = list(map(int,input().split())) ans = 0 mod = 10**9+7 if (x+y)%3 == 0: a = (-x+2*y)//3 b = (2*x-y)//3 if a >= 0 and b >= 0: ans = comb(a...
14
15
334
335
x, y = list(map(int, input().split())) ans = 0 mod = 10**9 + 7 if (x + y) % 3 == 0: m = (2 * y - x) // 3 n = (2 * x - y) // 3 if m >= 0 and n >= 0: fac = [1] * (m + n + 1) for i in range(2, m + n + 1): fac[i] = fac[i - 1] * i % mod ans = ( fac[m + n] ...
def comb(n, k, mod): x = y = 1 for i in range(min(k, n - k)): x = x * (n - i) % mod y = y * (i + 1) % mod return x * pow(y, mod - 2, mod) % mod x, y = list(map(int, input().split())) ans = 0 mod = 10**9 + 7 if (x + y) % 3 == 0: a = (-x + 2 * y) // 3 b = (2 * x - y) // 3 if a >=...
false
6.666667
[ "+def comb(n, k, mod):", "+ x = y = 1", "+ for i in range(min(k, n - k)):", "+ x = x * (n - i) % mod", "+ y = y * (i + 1) % mod", "+ return x * pow(y, mod - 2, mod) % mod", "+", "+", "- m = (2 * y - x) // 3", "- n = (2 * x - y) // 3", "- if m >= 0 and n >= 0:", ...
false
0.073677
0.101022
0.729313
[ "s178038340", "s925226762" ]
u377989038
p02837
python
s400974567
s056545256
494
138
9,232
9,224
Accepted
Accepted
72.06
from itertools import product n = int(eval(input())) xy = [[] for i in range(n)] for i in range(n): for j in range(int(eval(input()))): xy[i].append(list(map(int, input().split()))) ans = 0 for bit in product([0, 1], repeat=n): f = 0 for i, j in enumerate(bit): if j == 1: ...
from itertools import product n = int(eval(input())) xy = [[] for i in range(n)] for i in range(n): for j in range(int(eval(input()))): xy[i].append(list(map(int, input().split()))) ans = 0 for bit in product([0, 1], repeat=n): f = 0 for i, j in enumerate(bit): if j == 1: ...
20
21
462
490
from itertools import product n = int(eval(input())) xy = [[] for i in range(n)] for i in range(n): for j in range(int(eval(input()))): xy[i].append(list(map(int, input().split()))) ans = 0 for bit in product([0, 1], repeat=n): f = 0 for i, j in enumerate(bit): if j == 1: for x,...
from itertools import product n = int(eval(input())) xy = [[] for i in range(n)] for i in range(n): for j in range(int(eval(input()))): xy[i].append(list(map(int, input().split()))) ans = 0 for bit in product([0, 1], repeat=n): f = 0 for i, j in enumerate(bit): if j == 1: for x,...
false
4.761905
[ "+ break" ]
false
0.046044
0.038045
1.210249
[ "s400974567", "s056545256" ]
u371132735
p02706
python
s901526155
s249181598
26
22
10,064
10,044
Accepted
Accepted
15.38
n,m=list(map(int,input().split())) a=list(map(int,input().split())) print((n-sum(a) if n-sum(a)>=0 else -1))
n,m=list(map(int,input().split())) a=list(map(int,input().split())) print((max(-1,n-sum(a))))
3
3
102
87
n, m = list(map(int, input().split())) a = list(map(int, input().split())) print((n - sum(a) if n - sum(a) >= 0 else -1))
n, m = list(map(int, input().split())) a = list(map(int, input().split())) print((max(-1, n - sum(a))))
false
0
[ "-print((n - sum(a) if n - sum(a) >= 0 else -1))", "+print((max(-1, n - sum(a))))" ]
false
0.037554
0.04031
0.93162
[ "s901526155", "s249181598" ]
u287132915
p02923
python
s391974174
s202831295
302
88
23,356
85,136
Accepted
Accepted
70.86
import numpy as np n = int(eval(input())) h = list(map(int, input().split())) h_copy = h.copy() h_copy.pop(0) h_copy.append(-1) h = np.array(h) h_copy = np.array(h_copy) hh = h - h_copy hh[n-1] = -1 ans = 0 temp = 0 for i in range(n): if hh[i] >=0: temp += 1 else: ans = m...
n = int(eval(input())) h = list(map(int, input().split())) maxi = 0 now = h[0] cnt = 0 for i in range(1, n): if h[i] <= now: cnt += 1 now = h[i] maxi = max(maxi, cnt) else: cnt = 0 now = h[i] print(maxi)
24
15
363
260
import numpy as np n = int(eval(input())) h = list(map(int, input().split())) h_copy = h.copy() h_copy.pop(0) h_copy.append(-1) h = np.array(h) h_copy = np.array(h_copy) hh = h - h_copy hh[n - 1] = -1 ans = 0 temp = 0 for i in range(n): if hh[i] >= 0: temp += 1 else: ans = max(ans, temp) ...
n = int(eval(input())) h = list(map(int, input().split())) maxi = 0 now = h[0] cnt = 0 for i in range(1, n): if h[i] <= now: cnt += 1 now = h[i] maxi = max(maxi, cnt) else: cnt = 0 now = h[i] print(maxi)
false
37.5
[ "-import numpy as np", "-", "-h_copy = h.copy()", "-h_copy.pop(0)", "-h_copy.append(-1)", "-h = np.array(h)", "-h_copy = np.array(h_copy)", "-hh = h - h_copy", "-hh[n - 1] = -1", "-ans = 0", "-temp = 0", "-for i in range(n):", "- if hh[i] >= 0:", "- temp += 1", "+maxi = 0", "...
false
0.169402
0.035961
4.710762
[ "s391974174", "s202831295" ]
u339503988
p02771
python
s058833803
s140432114
21
17
3,316
2,940
Accepted
Accepted
19.05
a, b, c = list(map(int, input().split())) if len(set([a, b, c])) == 2: print("Yes") else: print("No")
s = list(map(int,input().split())) if len(set(s)) == 2: print("Yes") else: print("No")
5
5
108
94
a, b, c = list(map(int, input().split())) if len(set([a, b, c])) == 2: print("Yes") else: print("No")
s = list(map(int, input().split())) if len(set(s)) == 2: print("Yes") else: print("No")
false
0
[ "-a, b, c = list(map(int, input().split()))", "-if len(set([a, b, c])) == 2:", "+s = list(map(int, input().split()))", "+if len(set(s)) == 2:" ]
false
0.04237
0.097344
0.435261
[ "s058833803", "s140432114" ]
u374802266
p02802
python
s733098115
s591517657
461
275
35,376
3,828
Accepted
Accepted
40.35
n,m=list(map(int,input().split())) a=[] for i in range(n): a.append([0,0]) b=[] c=0 d=0 for i in range(m): b.append(list(input().split())) b[i][0]=int(b[i][0]) a=sorted(a,key=lambda x:x[0]) for i in range(m): if b[i][1]=='WA': if a[b[i][0]-1][0]==0: a[b[i][0]-1][1]+=1 ...
n,m=list(map(int,input().split())) w,l=0,[0]*n for i in range(m): p,s=input().split() p=int(p)-1 if s=='AC': w+=l[p]*(l[p]>=0) l[p]=-1 else: l[p]+=(l[p]>=0) print((l.count(-1),w))
23
11
474
221
n, m = list(map(int, input().split())) a = [] for i in range(n): a.append([0, 0]) b = [] c = 0 d = 0 for i in range(m): b.append(list(input().split())) b[i][0] = int(b[i][0]) a = sorted(a, key=lambda x: x[0]) for i in range(m): if b[i][1] == "WA": if a[b[i][0] - 1][0] == 0: a[b[i][0]...
n, m = list(map(int, input().split())) w, l = 0, [0] * n for i in range(m): p, s = input().split() p = int(p) - 1 if s == "AC": w += l[p] * (l[p] >= 0) l[p] = -1 else: l[p] += l[p] >= 0 print((l.count(-1), w))
false
52.173913
[ "-a = []", "-for i in range(n):", "- a.append([0, 0])", "-b = []", "-c = 0", "-d = 0", "+w, l = 0, [0] * n", "- b.append(list(input().split()))", "- b[i][0] = int(b[i][0])", "-a = sorted(a, key=lambda x: x[0])", "-for i in range(m):", "- if b[i][1] == \"WA\":", "- if a[b[i...
false
0.134647
0.041911
3.2127
[ "s733098115", "s591517657" ]
u562935282
p03054
python
s941239530
s016320237
172
133
18,224
4,024
Accepted
Accepted
22.67
def main(): h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) y -= 1 x -= 1 s, t = eval(input()), eval(input()) u, d, l, r = 0, h - 1, 0, w - 1 for ss, tt in reversed(tuple(zip(s, t))): if tt == 'U': d = min(d + 1, h - 1) if tt == '...
def main(): h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) y -= 1 x -= 1 s, t = eval(input()), eval(input()) u, d, l, r = 0, h - 1, 0, w - 1 for ss, tt in zip(s[::-1], t[::-1]): if tt == 'U': d = min(d + 1, h - 1) if tt == 'D': u...
34
34
769
764
def main(): h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) y -= 1 x -= 1 s, t = eval(input()), eval(input()) u, d, l, r = 0, h - 1, 0, w - 1 for ss, tt in reversed(tuple(zip(s, t))): if tt == "U": d = min(d + 1, h - 1) if tt == "D...
def main(): h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) y -= 1 x -= 1 s, t = eval(input()), eval(input()) u, d, l, r = 0, h - 1, 0, w - 1 for ss, tt in zip(s[::-1], t[::-1]): if tt == "U": d = min(d + 1, h - 1) if tt == "D": ...
false
0
[ "- for ss, tt in reversed(tuple(zip(s, t))):", "+ for ss, tt in zip(s[::-1], t[::-1]):" ]
false
0.064426
0.069417
0.9281
[ "s941239530", "s016320237" ]
u025501820
p03062
python
s054123457
s815491913
535
186
23,300
23,364
Accepted
Accepted
65.23
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split()))) my_min = 10 ** 10 A_rev = [] for i in range(N - 1): if A[i] < 0: A[i] *= -1 if i < N - 1: A[i + 1] *= -1 A_rev.append(A[i]) my_min = min(my_min, abs(A[i])) A_rev.append(A[-1] if A[...
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split()))) my_sum = np.sum(np.abs(A)) if np.count_nonzero(A < 0) % 2 == 0: print(my_sum) else: print((my_sum - 2 * np.min(np.abs(A))))
18
8
470
218
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split()))) my_min = 10**10 A_rev = [] for i in range(N - 1): if A[i] < 0: A[i] *= -1 if i < N - 1: A[i + 1] *= -1 A_rev.append(A[i]) my_min = min(my_min, abs(A[i])) A_rev.append(A[-1] if A[-1] >= 0 else...
import numpy as np N = int(eval(input())) A = np.array(list(map(int, input().split()))) my_sum = np.sum(np.abs(A)) if np.count_nonzero(A < 0) % 2 == 0: print(my_sum) else: print((my_sum - 2 * np.min(np.abs(A))))
false
55.555556
[ "-my_min = 10**10", "-A_rev = []", "-for i in range(N - 1):", "- if A[i] < 0:", "- A[i] *= -1", "- if i < N - 1:", "- A[i + 1] *= -1", "- A_rev.append(A[i])", "- my_min = min(my_min, abs(A[i]))", "-A_rev.append(A[-1] if A[-1] >= 0 else A[-1] * -1)", "-my_min = m...
false
0.260579
0.502771
0.518285
[ "s054123457", "s815491913" ]
u729939940
p02602
python
s607209573
s293349877
204
96
35,880
31,412
Accepted
Accepted
52.94
from itertools import accumulate N, K = list(map(int, input().split())) A = list(map(int, input().split())) acc = [0] acc.extend(list(accumulate(A))) #print(acc) scores = [] for i in range(K, N + 1): scores.append(acc[i] - acc[i - K]) #print(scores) for i in range(1, N - K + 1): if scores[i] > scores[i -...
N, K = list(map(int, input().split())) A = list(map(int, input().split())) ans = ['Yes' if A[i] > A[i - K] else 'No' for i in range(K, N)] print(("\n".join(ans)))
16
4
366
157
from itertools import accumulate N, K = list(map(int, input().split())) A = list(map(int, input().split())) acc = [0] acc.extend(list(accumulate(A))) # print(acc) scores = [] for i in range(K, N + 1): scores.append(acc[i] - acc[i - K]) # print(scores) for i in range(1, N - K + 1): if scores[i] > scores[i - 1]:...
N, K = list(map(int, input().split())) A = list(map(int, input().split())) ans = ["Yes" if A[i] > A[i - K] else "No" for i in range(K, N)] print(("\n".join(ans)))
false
75
[ "-from itertools import accumulate", "-", "-acc = [0]", "-acc.extend(list(accumulate(A)))", "-# print(acc)", "-scores = []", "-for i in range(K, N + 1):", "- scores.append(acc[i] - acc[i - K])", "-# print(scores)", "-for i in range(1, N - K + 1):", "- if scores[i] > scores[i - 1]:", "- ...
false
0.040795
0.140481
0.290393
[ "s607209573", "s293349877" ]
u408260374
p02345
python
s256132392
s392801570
3,610
1,730
9,908
8,708
Accepted
Accepted
52.08
import math class RangeMinimumQuery: """ RangeMinimumQuery by Segment Tree query: 1. update(i, val): update i-th value to val 2. query(low, high): find minimun value in [low, high) time complexity: O(log n) space complexity: O(2n) """ def __init__(self, N, INF=float('in...
class SegmentTree: """Segment Tree (Point Update & Range Query) Query 1. update(i, val): update i-th value to val 2. query(low, high): find f(value) in [low, high) Complexity time complexity: O(log n) space complexity: O(n) """ def __init__(self, N, f, ...
41
80
1,333
2,302
import math class RangeMinimumQuery: """ RangeMinimumQuery by Segment Tree query: 1. update(i, val): update i-th value to val 2. query(low, high): find minimun value in [low, high) time complexity: O(log n) space complexity: O(2n) """ def __init__(self, N, INF=float("inf")): ...
class SegmentTree: """Segment Tree (Point Update & Range Query) Query 1. update(i, val): update i-th value to val 2. query(low, high): find f(value) in [low, high) Complexity time complexity: O(log n) space complexity: O(n) """ def __init__(self, N, f, default): ...
false
48.75
[ "-import math", "-", "-", "-class RangeMinimumQuery:", "- \"\"\"", "- RangeMinimumQuery by Segment Tree", "- query:", "- 1. update(i, val): update i-th value to val", "- 2. query(low, high): find minimun value in [low, high)", "- time complexity: O(log n)", "- space complexi...
false
0.043034
0.041335
1.04109
[ "s256132392", "s392801570" ]
u279493135
p02720
python
s870817028
s884832526
217
122
5,652
14,164
Accepted
Accepted
43.78
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ...
47
34
1,306
985
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_...
false
27.659574
[ "-", "-", "-def calc_next(n): # nの次のルンルン数を求める", "- l = len(n)", "- n = n[::-1]", "- i = 0", "- for i in range(l - 1):", "- if n[i] != 9 and abs(n[i + 1] - (n[i] + 1)) <= 1: # 指定の桁を1増やしてもOK", "- n[i] += 1", "- break", "- else: # 最後を変更", "- i...
false
0.145813
0.117442
1.241573
[ "s870817028", "s884832526" ]
u500006160
p02862
python
s555868614
s788733290
238
151
16,192
3,188
Accepted
Accepted
36.55
def comb(n, k, MOD): if n < k or n < 0 or k < 0: return 0 k = min(k, n - k) if k == 0: return 1 iinv = [1] * (k + 1) ans = n for i in range(2, k + 1): iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD ans *= (n + 1 - i) * iinv[i] % MOD ans %= MOD...
# https://www.geeksforgeeks.org/compute-ncr-p-set-3-using-fermat-little-theorem/ def comb(n, r, p): num = den = 1 for i in range(r): num = (num * (n - i)) % p den = (den * (i + 1)) % p return (num * pow(den, p - 2, p)) % p m = 10**9 + 7 x, y = (int(x) for x in input().spli...
22
16
531
470
def comb(n, k, MOD): if n < k or n < 0 or k < 0: return 0 k = min(k, n - k) if k == 0: return 1 iinv = [1] * (k + 1) ans = n for i in range(2, k + 1): iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD ans *= (n + 1 - i) * iinv[i] % MOD ans %= MOD return...
# https://www.geeksforgeeks.org/compute-ncr-p-set-3-using-fermat-little-theorem/ def comb(n, r, p): num = den = 1 for i in range(r): num = (num * (n - i)) % p den = (den * (i + 1)) % p return (num * pow(den, p - 2, p)) % p m = 10**9 + 7 x, y = (int(x) for x in input().split()) ans = 0 if (...
false
27.272727
[ "-def comb(n, k, MOD):", "- if n < k or n < 0 or k < 0:", "- return 0", "- k = min(k, n - k)", "- if k == 0:", "- return 1", "- iinv = [1] * (k + 1)", "- ans = n", "- for i in range(2, k + 1):", "- iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD", "- ...
false
0.116168
0.106763
1.088096
[ "s555868614", "s788733290" ]
u729133443
p03524
python
s420886835
s326695520
191
18
39,024
3,188
Accepted
Accepted
90.58
s=input().count;print(('YNEOS'[sum(abs(s(x)-s(y))<2for x,y in['ab','bc','ca'])<3::2]))
s=eval(input());c=[s.count(t)for t in 'abc'];print(('YNEOS'[max(c)-min(c)>1::2]))
1
1
84
73
s = input().count print(("YNEOS"[sum(abs(s(x) - s(y)) < 2 for x, y in ["ab", "bc", "ca"]) < 3 :: 2]))
s = eval(input()) c = [s.count(t) for t in "abc"] print(("YNEOS"[max(c) - min(c) > 1 :: 2]))
false
0
[ "-s = input().count", "-print((\"YNEOS\"[sum(abs(s(x) - s(y)) < 2 for x, y in [\"ab\", \"bc\", \"ca\"]) < 3 :: 2]))", "+s = eval(input())", "+c = [s.count(t) for t in \"abc\"]", "+print((\"YNEOS\"[max(c) - min(c) > 1 :: 2]))" ]
false
0.048022
0.009182
5.229925
[ "s420886835", "s326695520" ]
u884323674
p02623
python
s329664446
s373813785
399
312
48,408
48,600
Accepted
Accepted
21.8
N, M, K = list(map(int, input().split())) A_temp = [int(i) for i in input().split()] B_temp = [int(i) for i in input().split()] A, B = [0]*(N+1), [0]*(M+1) for i in range(1, N+1): A[i] = A[i-1] + A_temp[i-1] for j in range(1, M+1): B[j] = B[j-1] + B_temp[j-1] ans = 0 for a in range(N+1): ...
N, M, K = list(map(int, input().split())) A_temp = [int(i) for i in input().split()] B_temp = [int(i) for i in input().split()] A, B = [0]*(N+1), [0]*(M+1) for i in range(1, N+1): A[i] = A[i-1] + A_temp[i-1] for i in range(1, M+1): B[i] = B[i-1] + B_temp[i-1] ans = 0 b = M for a in range(N+1): ...
21
19
480
426
N, M, K = list(map(int, input().split())) A_temp = [int(i) for i in input().split()] B_temp = [int(i) for i in input().split()] A, B = [0] * (N + 1), [0] * (M + 1) for i in range(1, N + 1): A[i] = A[i - 1] + A_temp[i - 1] for j in range(1, M + 1): B[j] = B[j - 1] + B_temp[j - 1] ans = 0 for a in range(N + 1): ...
N, M, K = list(map(int, input().split())) A_temp = [int(i) for i in input().split()] B_temp = [int(i) for i in input().split()] A, B = [0] * (N + 1), [0] * (M + 1) for i in range(1, N + 1): A[i] = A[i - 1] + A_temp[i - 1] for i in range(1, M + 1): B[i] = B[i - 1] + B_temp[i - 1] ans = 0 b = M for a in range(N +...
false
9.52381
[ "-for j in range(1, M + 1):", "- B[j] = B[j - 1] + B_temp[j - 1]", "+for i in range(1, M + 1):", "+ B[i] = B[i - 1] + B_temp[i - 1]", "+b = M", "- for b in range(ans - a + 1, M + 1):", "- if A[a] + B[b] > K:", "- break", "- ans = max(ans, a + b)", "+ while B[b]...
false
0.070847
0.03563
1.988388
[ "s329664446", "s373813785" ]
u852517668
p03044
python
s920011162
s500776639
1,097
685
90,840
79,408
Accepted
Accepted
37.56
import sys sys.setrecursionlimit(10**7) N = int(eval(input())) color = [-1] * N G = [[] for _ in range(N)] W = [[] for _ in range(N)] for i in range(N-1): u, v, w = list(map(int, input().split())) G[u-1].append(v-1) G[v-1].append(u-1) W[u-1].append(w) W[v-1].append(w) def dfs(v, cur): color...
import sys sys.setrecursionlimit(10**7) N = int(eval(input())) color = [-1] * N G = [[] for _ in range(N)] for i in range(N-1): u, v, w = list(map(int, input().split())) G[u-1].append((v-1, w)) G[v-1].append((u-1, w)) def dfs(v, cur): color[v] = cur for next_v, w in G[v]: if color[next_v] ...
30
24
598
471
import sys sys.setrecursionlimit(10**7) N = int(eval(input())) color = [-1] * N G = [[] for _ in range(N)] W = [[] for _ in range(N)] for i in range(N - 1): u, v, w = list(map(int, input().split())) G[u - 1].append(v - 1) G[v - 1].append(u - 1) W[u - 1].append(w) W[v - 1].append(w) def dfs(v, cur...
import sys sys.setrecursionlimit(10**7) N = int(eval(input())) color = [-1] * N G = [[] for _ in range(N)] for i in range(N - 1): u, v, w = list(map(int, input().split())) G[u - 1].append((v - 1, w)) G[v - 1].append((u - 1, w)) def dfs(v, cur): color[v] = cur for next_v, w in G[v]: if col...
false
20
[ "-W = [[] for _ in range(N)]", "- G[u - 1].append(v - 1)", "- G[v - 1].append(u - 1)", "- W[u - 1].append(w)", "- W[v - 1].append(w)", "+ G[u - 1].append((v - 1, w))", "+ G[v - 1].append((u - 1, w))", "- for next_v, w in zip(G[v], W[v]):", "+ for next_v, w in G[v]:", "-for ...
false
0.04102
0.071052
0.577329
[ "s920011162", "s500776639" ]
u314906167
p03241
python
s308381284
s693803332
522
24
40,172
3,060
Accepted
Accepted
95.4
import sys n, m = list(map(int, input().split())) for div in reversed(list(range(1, 1+m//n))): if m % div == 0: print(div) sys.exit()
import sys from math import sqrt n, m = list(map(int, input().split())) isqrtm = int(sqrt(m)) for revdiv in range(1, 1+isqrtm): if m % revdiv == 0: div = m // revdiv if div <= m//n: print(div) sys.exit() for div in range(isqrtm, 0, -1): if m % div == 0: if div <= m//n: print(div) sys...
7
16
133
322
import sys n, m = list(map(int, input().split())) for div in reversed(list(range(1, 1 + m // n))): if m % div == 0: print(div) sys.exit()
import sys from math import sqrt n, m = list(map(int, input().split())) isqrtm = int(sqrt(m)) for revdiv in range(1, 1 + isqrtm): if m % revdiv == 0: div = m // revdiv if div <= m // n: print(div) sys.exit() for div in range(isqrtm, 0, -1): if m % div == 0: if di...
false
56.25
[ "+from math import sqrt", "-for div in reversed(list(range(1, 1 + m // n))):", "+isqrtm = int(sqrt(m))", "+for revdiv in range(1, 1 + isqrtm):", "+ if m % revdiv == 0:", "+ div = m // revdiv", "+ if div <= m // n:", "+ print(div)", "+ sys.exit()", "+for div i...
false
0.080392
0.038
2.11556
[ "s308381284", "s693803332" ]
u165292657
p02657
python
s799803534
s757585939
24
20
9,036
9,088
Accepted
Accepted
16.67
a,b=[float(x) for x in input().strip().split(" ")] x=a*(b*100)/100 print((int(x)))
a,b=[int(x) for x in input().strip().split(" ")] print((a*b))
3
2
82
61
a, b = [float(x) for x in input().strip().split(" ")] x = a * (b * 100) / 100 print((int(x)))
a, b = [int(x) for x in input().strip().split(" ")] print((a * b))
false
33.333333
[ "-a, b = [float(x) for x in input().strip().split(\" \")]", "-x = a * (b * 100) / 100", "-print((int(x)))", "+a, b = [int(x) for x in input().strip().split(\" \")]", "+print((a * b))" ]
false
0.045
0.039852
1.129182
[ "s799803534", "s757585939" ]
u808373096
p03739
python
s579827631
s479728975
802
106
23,220
14,468
Accepted
Accepted
86.78
import numpy as np n = int(eval(input())) A = [int(x) for x in input().split()] sum_start_plus = 0 sum_start_minus = 0 ans_start_plus = 0 ans_start_minus = 0 flag_start_plus = True flag_start_minus = True # プラス始まりの場合を計算する for a in A: sum_start_plus += a if flag_start_plus: flag_start_...
n = int(eval(input())) A = [int(x) for x in input().split()] sum_start_plus = 0 sum_start_minus = 0 ans_start_plus = 0 ans_start_minus = 0 flag_start_plus = True flag_start_minus = True # プラス始まりの場合を計算する for a in A: sum_start_plus += a if flag_start_plus: flag_start_plus = False if...
49
46
1,258
1,192
import numpy as np n = int(eval(input())) A = [int(x) for x in input().split()] sum_start_plus = 0 sum_start_minus = 0 ans_start_plus = 0 ans_start_minus = 0 flag_start_plus = True flag_start_minus = True # プラス始まりの場合を計算する for a in A: sum_start_plus += a if flag_start_plus: flag_start_plus = False ...
n = int(eval(input())) A = [int(x) for x in input().split()] sum_start_plus = 0 sum_start_minus = 0 ans_start_plus = 0 ans_start_minus = 0 flag_start_plus = True flag_start_minus = True # プラス始まりの場合を計算する for a in A: sum_start_plus += a if flag_start_plus: flag_start_plus = False if sum_start_plus...
false
6.122449
[ "-import numpy as np", "-", "- if np.sign(sum_start_plus) == 1:", "+ if sum_start_plus > 0:", "- if np.sign(sum_start_plus) == -1:", "+ if sum_start_plus < 0:", "- if np.sign(sum_start_minus) == -1:", "+ if sum_start_minus < 0:", "- if np.sign(sum_sta...
false
0.300288
0.121316
2.475261
[ "s579827631", "s479728975" ]
u970899068
p03037
python
s636308153
s726037870
372
337
27,344
28,280
Accepted
Accepted
9.41
n, m=list(map(int, input().split())) grid = [] for i in range(m): array = list(map(int, input().strip().split())) grid.append(array) maxa,mina=grid[0] for i in range(1,m): if maxa<grid[i][0]: maxa=grid[i][0] if mina>grid[i][1]: mina=grid[i][1] v=mina-maxa+1 if v>0: ...
n,m = list(map(int, input().split())) LR = [list(map(int, input().split())) for _ in range(m)] L = max([i[0] for i in LR]) R = min([i[1] for i in LR]) print((max(R-L+1,0)))
19
5
344
168
n, m = list(map(int, input().split())) grid = [] for i in range(m): array = list(map(int, input().strip().split())) grid.append(array) maxa, mina = grid[0] for i in range(1, m): if maxa < grid[i][0]: maxa = grid[i][0] if mina > grid[i][1]: mina = grid[i][1] v = mina - maxa + 1 if v > 0: ...
n, m = list(map(int, input().split())) LR = [list(map(int, input().split())) for _ in range(m)] L = max([i[0] for i in LR]) R = min([i[1] for i in LR]) print((max(R - L + 1, 0)))
false
73.684211
[ "-grid = []", "-for i in range(m):", "- array = list(map(int, input().strip().split()))", "- grid.append(array)", "-maxa, mina = grid[0]", "-for i in range(1, m):", "- if maxa < grid[i][0]:", "- maxa = grid[i][0]", "- if mina > grid[i][1]:", "- mina = grid[i][1]", "-v =...
false
0.044412
0.042504
1.044896
[ "s636308153", "s726037870" ]
u535423069
p02803
python
s727285585
s038811851
884
365
42,736
3,380
Accepted
Accepted
58.71
# Author: cr4zjh0bp # Created: Tue Mar 17 19:50:06 UTC 2020 import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf ...
import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf = lambda: float(ns()) nfn = lambda y: [nf() for _ in range...
49
60
1,470
1,572
# Author: cr4zjh0bp # Created: Tue Mar 17 19:50:06 UTC 2020 import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf = lambda: float(ns()) nfn = lambda y:...
import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf = lambda: float(ns()) nfn = lambda y: [nf() for _ in range(y)] nfa = lambda: list(map(float, stdi...
false
18.333333
[ "-# Author: cr4zjh0bp", "-# Created: Tue Mar 17 19:50:06 UTC 2020", "+from collections import deque", "+", "-m = nsn(h)", "-dist = [[inf] * (h * w) for _ in range(h * w)]", "-dx, dy = [0, 1, -1, 0], [1, 0, 0, -1]", "-for i in range(h):", "- for j in range(w):", "- for k in range(4):", ...
false
0.040384
0.039508
1.022158
[ "s727285585", "s038811851" ]
u667084803
p03739
python
s558343319
s101580132
404
339
14,736
14,084
Accepted
Accepted
16.09
# -*- coding: utf-8 -*- # 整数の入力 n=int(eval(input())) a=input().split() b=a[:] c=a[:] # a[0]の符号をそのままにした場合の計算 counter_1=0 S=int(a[0]) for i in range(1,n): if S<0 and S+int(a[i])<=0: counter_1+=-S-int(a[i])+1 a[i]=-S+1 elif S>0 and S+int(a[i])>=0: counter_1+=S+int(a[i])+1 a[i]=-S-1 S+...
# -*- coding: utf-8 -*- # 整数の入力 n=int(eval(input())) a=list(map(int, input().split())) b=a[:] c=a[:] # a[0]の符号をそのままにした場合の計算 counter_1=0 S=int(a[0]) for i in range(1,n): if S<0 and S+int(a[i])<=0: counter_1+=-S-int(a[i])+1 a[i]=-S+1 elif S>0 and S+int(a[i])>=0: counter_1+=S+int(a[i])+1 ...
42
42
877
893
# -*- coding: utf-8 -*- # 整数の入力 n = int(eval(input())) a = input().split() b = a[:] c = a[:] # a[0]の符号をそのままにした場合の計算 counter_1 = 0 S = int(a[0]) for i in range(1, n): if S < 0 and S + int(a[i]) <= 0: counter_1 += -S - int(a[i]) + 1 a[i] = -S + 1 elif S > 0 and S + int(a[i]) >= 0: counter_...
# -*- coding: utf-8 -*- # 整数の入力 n = int(eval(input())) a = list(map(int, input().split())) b = a[:] c = a[:] # a[0]の符号をそのままにした場合の計算 counter_1 = 0 S = int(a[0]) for i in range(1, n): if S < 0 and S + int(a[i]) <= 0: counter_1 += -S - int(a[i]) + 1 a[i] = -S + 1 elif S > 0 and S + int(a[i]) >= 0: ...
false
0
[ "-a = input().split()", "+a = list(map(int, input().split()))" ]
false
0.072817
0.048531
1.500438
[ "s558343319", "s101580132" ]
u667084803
p02679
python
s384916435
s154852140
956
557
69,080
168,232
Accepted
Accepted
41.74
from math import gcd from collections import defaultdict def to_irreducible(a, b): if a == 0: return [0, 1] GCD = gcd(a, b) return [a//GCD, b//GCD] MOD = 10**9 + 7 N = int(eval(input())) daiichi_dict = defaultdict(int) daini_dict = defaultdict(int) zero_cases = 0 for i in range(N)...
from math import gcd from collections import defaultdict def to_irreducible(a, b): if a == 0: return (0, 1) GCD = gcd(a, b) return (a//GCD, b//GCD) MOD = 10**9 + 7 N = int(eval(input())) quadrant1 = defaultdict(int) quadrant2 = defaultdict(int) zero_cases = 0 for i in range(N): ...
34
33
840
776
from math import gcd from collections import defaultdict def to_irreducible(a, b): if a == 0: return [0, 1] GCD = gcd(a, b) return [a // GCD, b // GCD] MOD = 10**9 + 7 N = int(eval(input())) daiichi_dict = defaultdict(int) daini_dict = defaultdict(int) zero_cases = 0 for i in range(N): a, b ...
from math import gcd from collections import defaultdict def to_irreducible(a, b): if a == 0: return (0, 1) GCD = gcd(a, b) return (a // GCD, b // GCD) MOD = 10**9 + 7 N = int(eval(input())) quadrant1 = defaultdict(int) quadrant2 = defaultdict(int) zero_cases = 0 for i in range(N): a, b = li...
false
2.941176
[ "- return [0, 1]", "+ return (0, 1)", "- return [a // GCD, b // GCD]", "+ return (a // GCD, b // GCD)", "-daiichi_dict = defaultdict(int)", "-daini_dict = defaultdict(int)", "+quadrant1 = defaultdict(int)", "+quadrant2 = defaultdict(int)", "- a, b = to_irreducible(abs(a), ...
false
0.037068
0.038032
0.97466
[ "s384916435", "s154852140" ]
u148551245
p03369
python
s036024240
s097929967
162
17
38,384
2,940
Accepted
Accepted
89.51
s = eval(input()) c = s.count("o") print((700 + 100 * c))
s = eval(input()) p = 700 for c in s: if c == 'o': p += 100 print(p)
3
7
51
81
s = eval(input()) c = s.count("o") print((700 + 100 * c))
s = eval(input()) p = 700 for c in s: if c == "o": p += 100 print(p)
false
57.142857
[ "-c = s.count(\"o\")", "-print((700 + 100 * c))", "+p = 700", "+for c in s:", "+ if c == \"o\":", "+ p += 100", "+print(p)" ]
false
0.044577
0.046015
0.968757
[ "s036024240", "s097929967" ]
u699089116
p02924
python
s311266459
s834074686
183
17
38,384
2,940
Accepted
Accepted
90.71
n = int(eval(input())) print(((n-1) * (n - 1 + 1) // 2))
n = int(eval(input())) ans = n * (n-1) // 2 print(ans)
3
4
51
52
n = int(eval(input())) print(((n - 1) * (n - 1 + 1) // 2))
n = int(eval(input())) ans = n * (n - 1) // 2 print(ans)
false
25
[ "-print(((n - 1) * (n - 1 + 1) // 2))", "+ans = n * (n - 1) // 2", "+print(ans)" ]
false
0.069307
0.055176
1.256108
[ "s311266459", "s834074686" ]
u798818115
p03163
python
s446351798
s206808999
321
151
41,708
68,552
Accepted
Accepted
52.96
# coding: utf-8 # Your code here! N,W=list(map(int,input().split())) jwels=[] for _ in range(N): jwels.append(list(map(int,input().split()))) dp=[-1]*(W+1) dp[0]=0 for w,v in jwels: for i in range(W+1)[::-1]: if dp[i]!=-1 and i+w<=W: dp[i+w]=max(dp[i]+v,dp[i+w]) ...
# coding: utf-8 # Your code here! N,W=list(map(int,input().split())) dp=[-1]*(W+1) dp[0]=0 for _ in range(N): w,v=list(map(int,input().split())) for i in range(W+1)[::-1]: if dp[i]!=-1 and i+w<=W: dp[i+w]=max(dp[i+w],dp[i]+v) print((max(dp)))
19
14
336
276
# coding: utf-8 # Your code here! N, W = list(map(int, input().split())) jwels = [] for _ in range(N): jwels.append(list(map(int, input().split()))) dp = [-1] * (W + 1) dp[0] = 0 for w, v in jwels: for i in range(W + 1)[::-1]: if dp[i] != -1 and i + w <= W: dp[i + w] = max(dp[i] + v, dp[i + ...
# coding: utf-8 # Your code here! N, W = list(map(int, input().split())) dp = [-1] * (W + 1) dp[0] = 0 for _ in range(N): w, v = list(map(int, input().split())) for i in range(W + 1)[::-1]: if dp[i] != -1 and i + w <= W: dp[i + w] = max(dp[i + w], dp[i] + v) print((max(dp)))
false
26.315789
[ "-jwels = []", "-for _ in range(N):", "- jwels.append(list(map(int, input().split())))", "-for w, v in jwels:", "+for _ in range(N):", "+ w, v = list(map(int, input().split()))", "- dp[i + w] = max(dp[i] + v, dp[i + w])", "+ dp[i + w] = max(dp[i + w], dp[i] + v)" ]
false
0.104628
0.039179
2.670513
[ "s446351798", "s206808999" ]
u057109575
p03007
python
s336729412
s687471342
341
152
64,588
100,828
Accepted
Accepted
55.43
N, *A = list(map(int, open(0).read().split())) x = sorted([v for v in A if v >= 0]) y = sorted([v for v in A if v < 0], reverse=True) ans = [] if len(y) == 0: cnt = x[0] for v in x[1:-1]: ans.append((cnt, v)) cnt -= v ans.append((x[-1], cnt)) print((x[-1] - cnt)) elif len(...
N = int(eval(input())) X = list(map(int, input().split())) pos = sorted([v for v in X if v >= 0]) neg = sorted([v for v in X if v < 0], reverse=True) ans = [] if not neg: # neg is empty cnt = pos[0] for v in pos[1:-1]: ans.append((cnt, v)) cnt -= v ans.append((pos[-1], c...
32
37
644
731
N, *A = list(map(int, open(0).read().split())) x = sorted([v for v in A if v >= 0]) y = sorted([v for v in A if v < 0], reverse=True) ans = [] if len(y) == 0: cnt = x[0] for v in x[1:-1]: ans.append((cnt, v)) cnt -= v ans.append((x[-1], cnt)) print((x[-1] - cnt)) elif len(x) == 0: cn...
N = int(eval(input())) X = list(map(int, input().split())) pos = sorted([v for v in X if v >= 0]) neg = sorted([v for v in X if v < 0], reverse=True) ans = [] if not neg: # neg is empty cnt = pos[0] for v in pos[1:-1]: ans.append((cnt, v)) cnt -= v ans.append((pos[-1], cnt)) print((p...
false
13.513514
[ "-N, *A = list(map(int, open(0).read().split()))", "-x = sorted([v for v in A if v >= 0])", "-y = sorted([v for v in A if v < 0], reverse=True)", "+N = int(eval(input()))", "+X = list(map(int, input().split()))", "+pos = sorted([v for v in X if v >= 0])", "+neg = sorted([v for v in X if v < 0], reverse=...
false
0.078185
0.038229
2.045152
[ "s336729412", "s687471342" ]
u753803401
p03013
python
s291509157
s678175444
199
183
7,756
7,824
Accepted
Accepted
8.04
n, m = list(map(int, input().split())) dp = [0] * (n + 1) dp[0] = 1 dp[1] = 1 for i in [int(eval(input())) for _ in range(m)]: dp[i] = -1 for i in range(n + 1): if i < 2: if dp[i] == -1: dp[i] = 0 else: if dp[i] == -1: dp[i] = 0 else: ...
n, m = list(map(int, input().split())) a = [int(eval(input())) for _ in range(m)] dp = [0] * (n + 1) for i in a: dp[i] = -1 for i in range(n + 1): if dp[i] == -1: dp[i] = 0 else: if i >= 2: dp[i] = (dp[i-1] + dp[i-2]) % (10 ** 9 + 7) else: if dp[i]...
16
17
364
404
n, m = list(map(int, input().split())) dp = [0] * (n + 1) dp[0] = 1 dp[1] = 1 for i in [int(eval(input())) for _ in range(m)]: dp[i] = -1 for i in range(n + 1): if i < 2: if dp[i] == -1: dp[i] = 0 else: if dp[i] == -1: dp[i] = 0 else: dp[i] = (dp[i...
n, m = list(map(int, input().split())) a = [int(eval(input())) for _ in range(m)] dp = [0] * (n + 1) for i in a: dp[i] = -1 for i in range(n + 1): if dp[i] == -1: dp[i] = 0 else: if i >= 2: dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7) else: if dp[i] == -1: ...
false
5.882353
[ "+a = [int(eval(input())) for _ in range(m)]", "-dp[0] = 1", "-dp[1] = 1", "-for i in [int(eval(input())) for _ in range(m)]:", "+for i in a:", "- if i < 2:", "- if dp[i] == -1:", "- dp[i] = 0", "+ if dp[i] == -1:", "+ dp[i] = 0", "- if dp[i] == -1:", "- ...
false
0.04627
0.039469
1.172312
[ "s291509157", "s678175444" ]
u489959379
p02735
python
s981889176
s389510370
200
44
41,328
9,436
Accepted
Accepted
78
import sys from collections import deque sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): H, W = list(map(int, input().split())) S = [list(eval(input())) for _ in range(H)] # 白と黒が入れ替わった箇所をカウントする flip = [[f_inf for _ in range(W)] for _ in range(H)] ...
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): H, W = list(map(int, input().split())) grid = [list("." + eval(input())) for _ in range(H)] dp = [[f_inf] * (W + 1) for _ in range(H)] dp[0][0] = 0 for h in range(H): for w in ...
46
42
1,167
1,586
import sys from collections import deque sys.setrecursionlimit(10**7) f_inf = float("inf") mod = 10**9 + 7 def resolve(): H, W = list(map(int, input().split())) S = [list(eval(input())) for _ in range(H)] # 白と黒が入れ替わった箇所をカウントする flip = [[f_inf for _ in range(W)] for _ in range(H)] if S[0][0] == "#"...
import sys sys.setrecursionlimit(10**7) f_inf = float("inf") mod = 10**9 + 7 def resolve(): H, W = list(map(int, input().split())) grid = [list("." + eval(input())) for _ in range(H)] dp = [[f_inf] * (W + 1) for _ in range(H)] dp[0][0] = 0 for h in range(H): for w in range(W + 1): ...
false
8.695652
[ "-from collections import deque", "- S = [list(eval(input())) for _ in range(H)]", "- # 白と黒が入れ替わった箇所をカウントする", "- flip = [[f_inf for _ in range(W)] for _ in range(H)]", "- if S[0][0] == \"#\":", "- flip[0][0] = 1", "- else:", "- flip[0][0] = 0", "- que = deque([[0, 0]]...
false
0.167157
0.045224
3.696173
[ "s981889176", "s389510370" ]
u332906195
p02712
python
s938293834
s364146636
151
23
9,052
9,160
Accepted
Accepted
84.77
N = int(eval(input())) ans = 0 for i in range(1, N + 1): if i % 5 > 0 and i % 3 > 0: ans += i print(ans)
def sum(N): return N * (N + 1) // 2 N = int(eval(input())) print((sum(N) - sum(N // 3) * 3 - sum(N // 5) * 5 + sum(N // 15) * 15))
6
6
116
134
N = int(eval(input())) ans = 0 for i in range(1, N + 1): if i % 5 > 0 and i % 3 > 0: ans += i print(ans)
def sum(N): return N * (N + 1) // 2 N = int(eval(input())) print((sum(N) - sum(N // 3) * 3 - sum(N // 5) * 5 + sum(N // 15) * 15))
false
0
[ "+def sum(N):", "+ return N * (N + 1) // 2", "+", "+", "-ans = 0", "-for i in range(1, N + 1):", "- if i % 5 > 0 and i % 3 > 0:", "- ans += i", "-print(ans)", "+print((sum(N) - sum(N // 3) * 3 - sum(N // 5) * 5 + sum(N // 15) * 15))" ]
false
0.542387
0.036562
14.834618
[ "s938293834", "s364146636" ]
u905582793
p02868
python
s718376180
s244370635
851
580
90,328
84,060
Accepted
Accepted
31.84
n,m = list(map(int,input().split())) abd = [list(map(int,input().split())) for i in range(m)] graph = [[] for i in range(n+1)] for a,b,d in abd: graph[a].append((b,d)) for i in range(1,n): graph[i+1].append((i,0)) import heapq as hq dist = [10**18]*(n+1) dist[1] = 0 q = [(0,1)] hq.heapify(q) while q: ...
import sys input = sys.stdin.readline n,m = list(map(int,input().split())) abd = [list(map(int,input().split())) for i in range(m)] graph = [[] for i in range(n+1)] for a,b,d in abd: graph[a].append((b,d)) for i in range(1,n): graph[i+1].append((i,0)) import heapq as hq dist = [10**18]*(n+1) dist[1] = 0 ...
22
24
512
552
n, m = list(map(int, input().split())) abd = [list(map(int, input().split())) for i in range(m)] graph = [[] for i in range(n + 1)] for a, b, d in abd: graph[a].append((b, d)) for i in range(1, n): graph[i + 1].append((i, 0)) import heapq as hq dist = [10**18] * (n + 1) dist[1] = 0 q = [(0, 1)] hq.heapify(q) w...
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) abd = [list(map(int, input().split())) for i in range(m)] graph = [[] for i in range(n + 1)] for a, b, d in abd: graph[a].append((b, d)) for i in range(1, n): graph[i + 1].append((i, 0)) import heapq as hq dist = [10**18] * (n + 1) d...
false
8.333333
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.039907
0.038507
1.036349
[ "s718376180", "s244370635" ]
u754022296
p03361
python
s785252312
s639245086
20
18
3,064
3,064
Accepted
Accepted
10
h, w = list(map(int, input().split())) S = ["."*(w+2)] + [ "."+eval(input())+"." for _ in range(h) ] + ["."*(w+2)] for i in range(h+2): for j in range(w+2): if S[i][j] == "#": for k in range(4): if S[i+1][j] != "#" and S[i][j+1] != "#" and S[i-1][j] != "#" and S[i][j-1] != "#": prin...
h, w = list(map(int, input().split())) S = ["."*(w+2)] + [ "."+eval(input())+"." for _ in range(h) ] + ["."*(w+2)] for i in range(h+2): for j in range(w+2): if S[i][j] == "#": if S[i+1][j] != "#" and S[i][j+1] != "#" and S[i-1][j] != "#" and S[i][j-1] != "#": print("No") exit() print...
10
9
347
316
h, w = list(map(int, input().split())) S = ["." * (w + 2)] + ["." + eval(input()) + "." for _ in range(h)] + ["." * (w + 2)] for i in range(h + 2): for j in range(w + 2): if S[i][j] == "#": for k in range(4): if ( S[i + 1][j] != "#" and S[i...
h, w = list(map(int, input().split())) S = ["." * (w + 2)] + ["." + eval(input()) + "." for _ in range(h)] + ["." * (w + 2)] for i in range(h + 2): for j in range(w + 2): if S[i][j] == "#": if ( S[i + 1][j] != "#" and S[i][j + 1] != "#" and S[i - 1...
false
10
[ "- for k in range(4):", "- if (", "- S[i + 1][j] != \"#\"", "- and S[i][j + 1] != \"#\"", "- and S[i - 1][j] != \"#\"", "- and S[i][j - 1] != \"#\"", "- ):", "- print...
false
0.09032
0.089876
1.004934
[ "s785252312", "s639245086" ]
u223646582
p04035
python
s570285799
s716111246
308
108
63,984
14,052
Accepted
Accepted
64.94
N, L = list(map(int, input().split())) a = [int(i) for i in input().split()] max_k = 0 max_p = 0 for i in range(N-1): if a[i]+a[i+1] > max_k: max_k = a[i]+a[i+1] max_p = i+1 if max_k < L: print('Impossible') exit() else: print('Possible') for i in range(1, N): i...
N, L = map(int, input().split()) A = [int(i) for i in input().split()] for i in range(1, N): if A[i-1]+A[i] >= L: print('Possible') ans = [] for j in range(1, i): ans.append(j) for k in range(N-1, i, -1): ans.append(k) ans.append(i) ...
29
15
486
381
N, L = list(map(int, input().split())) a = [int(i) for i in input().split()] max_k = 0 max_p = 0 for i in range(N - 1): if a[i] + a[i + 1] > max_k: max_k = a[i] + a[i + 1] max_p = i + 1 if max_k < L: print("Impossible") exit() else: print("Possible") for i in range(1, N): if i == max...
N, L = map(int, input().split()) A = [int(i) for i in input().split()] for i in range(1, N): if A[i - 1] + A[i] >= L: print("Possible") ans = [] for j in range(1, i): ans.append(j) for k in range(N - 1, i, -1): ans.append(k) ans.append(i) print...
false
48.275862
[ "-N, L = list(map(int, input().split()))", "-a = [int(i) for i in input().split()]", "-max_k = 0", "-max_p = 0", "-for i in range(N - 1):", "- if a[i] + a[i + 1] > max_k:", "- max_k = a[i] + a[i + 1]", "- max_p = i + 1", "-if max_k < L:", "- print(\"Impossible\")", "- exit...
false
0.055623
0.037154
1.497088
[ "s570285799", "s716111246" ]
u860002137
p03089
python
s198974925
s905228097
153
116
12,396
27,388
Accepted
Accepted
24.18
import sys import numpy as np n = int(input()) b = np.array(list(map(int, input().split()))) ans = [] for i in range(n, 0, -1): cp = np.arange(1, i + 1) diff = b - cp if np.where(diff == 0)[0].shape[0] == 0: print(-1) sys.exit() else: rem = (np.where(diff == 0)[0]...
import sys import numpy as np n = int(input()) b = np.array(list(map(int, input().split()))) ans = [] for i in range(n): c = np.arange(1, n - i + 1) diff = b - c if not 0 in diff: print(-1) sys.exit() rem = np.where(diff == 0)[0][-1] ans.append(rem + 1) b = np.de...
19
18
425
363
import sys import numpy as np n = int(input()) b = np.array(list(map(int, input().split()))) ans = [] for i in range(n, 0, -1): cp = np.arange(1, i + 1) diff = b - cp if np.where(diff == 0)[0].shape[0] == 0: print(-1) sys.exit() else: rem = (np.where(diff == 0)[0]).max() ...
import sys import numpy as np n = int(input()) b = np.array(list(map(int, input().split()))) ans = [] for i in range(n): c = np.arange(1, n - i + 1) diff = b - c if not 0 in diff: print(-1) sys.exit() rem = np.where(diff == 0)[0][-1] ans.append(rem + 1) b = np.delete(b, rem) pri...
false
5.263158
[ "-for i in range(n, 0, -1):", "- cp = np.arange(1, i + 1)", "- diff = b - cp", "- if np.where(diff == 0)[0].shape[0] == 0:", "+for i in range(n):", "+ c = np.arange(1, n - i + 1)", "+ diff = b - c", "+ if not 0 in diff:", "- else:", "- rem = (np.where(diff == 0)[0]).max...
false
0.421029
0.265305
1.586959
[ "s198974925", "s905228097" ]
u285891772
p03096
python
s049622600
s115417952
337
290
34,612
31,112
Accepted
Accepted
13.95
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement from operator import itemgetter, mul from copy import deepcopy ...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement from operator import itemgetter, mul from copy import deepcopy ...
39
35
1,072
1,086
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd from itertools import ( accumulate, permutations, combinations, product, groupby, combinations_with_replacement, ) from operator import itemgetter, mul fro...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd from itertools import ( accumulate, permutations, combinations, product, groupby, combinations_with_replacement, ) from operator import itemgetter, mul fro...
false
10.25641
[ "-tmp = -1", "-c = []", "-for _ in range(N):", "- C = INT()", "- if C != tmp:", "- c.append(C)", "- tmp = C", "-n = len(c)", "-dic = defaultdict(int)", "-dp = [0] * (n + 1)", "+C = [INT() for _ in range(N)]", "+dp = [0] * (N + 1)", "-for i in range(n):", "- dp[i + 1] = (...
false
0.037726
0.042786
0.881744
[ "s049622600", "s115417952" ]
u656919695
p02695
python
s629122147
s378782263
1,128
1,027
25,220
12,628
Accepted
Accepted
8.95
import itertools n,m,q =list(map(int,input().split())) a =[0]*q b =[0]*q c =[0]*q d =[0]*q for i in range(q): a[i],b[i],c[i],d[i]= list(map(int,input().split())) A=list(itertools.combinations_with_replacement([i for i in range(1,m+1)],n)) g=[] for v in A: e=0 for i in range(q): ...
from itertools import combinations_with_replacement n,m,q =list(map(int,input().split())) summa=[] res=[] for i in range(q): a=[int(i) for i in input().split()] summa.append(a) for i in combinations_with_replacement(list(range(1,m+1)),n): cnt=0 for j in summa: if i[j[1]-1]-...
25
18
431
417
import itertools n, m, q = list(map(int, input().split())) a = [0] * q b = [0] * q c = [0] * q d = [0] * q for i in range(q): a[i], b[i], c[i], d[i] = list(map(int, input().split())) A = list(itertools.combinations_with_replacement([i for i in range(1, m + 1)], n)) g = [] for v in A: e = 0 for i in range(q...
from itertools import combinations_with_replacement n, m, q = list(map(int, input().split())) summa = [] res = [] for i in range(q): a = [int(i) for i in input().split()] summa.append(a) for i in combinations_with_replacement(list(range(1, m + 1)), n): cnt = 0 for j in summa: if i[j[1] - 1] - i...
false
28
[ "-import itertools", "+from itertools import combinations_with_replacement", "-a = [0] * q", "-b = [0] * q", "-c = [0] * q", "-d = [0] * q", "+summa = []", "+res = []", "- a[i], b[i], c[i], d[i] = list(map(int, input().split()))", "-A = list(itertools.combinations_with_replacement([i for i in r...
false
0.049274
0.048776
1.010217
[ "s629122147", "s378782263" ]
u562935282
p03645
python
s053688731
s175226895
745
634
52,688
77,648
Accepted
Accepted
14.9
def inpl(): return input().split() def get_str(bl): return 'POSSIBLE' if bl else 'IMPOSSIBLE' n, m = list(map(int, inpl())) M = list(tuple(map(int, inpl())) for _ in range(m))#[(a, b), ..., (a, b)] X = list(tuple((a, b)) for a, b in M if a == 1) Y = list(tuple((a, b)) for a, b in M if b == n) XB = set(list(b fo...
def main(): import sys input = sys.stdin.readline N, M = list(map(int, input().split())) g = tuple(set() for _ in range(N)) for _ in range(M): a, b = (int(x) - 1 for x in input().split()) g[a].add(b) g[b].add(a) intersect = {u_1 for u_1 in g[0]} & {u_N for ...
10
18
394
429
def inpl(): return input().split() def get_str(bl): return "POSSIBLE" if bl else "IMPOSSIBLE" n, m = list(map(int, inpl())) M = list(tuple(map(int, inpl())) for _ in range(m)) # [(a, b), ..., (a, b)] X = list(tuple((a, b)) for a, b in M if a == 1) Y = list(tuple((a, b)) for a, b in M if b == n) XB = set(li...
def main(): import sys input = sys.stdin.readline N, M = list(map(int, input().split())) g = tuple(set() for _ in range(N)) for _ in range(M): a, b = (int(x) - 1 for x in input().split()) g[a].add(b) g[b].add(a) intersect = {u_1 for u_1 in g[0]} & {u_N for u_N in g[N - 1...
false
44.444444
[ "-def inpl():", "- return input().split()", "+def main():", "+ import sys", "+", "+ input = sys.stdin.readline", "+ N, M = list(map(int, input().split()))", "+ g = tuple(set() for _ in range(N))", "+ for _ in range(M):", "+ a, b = (int(x) - 1 for x in input().split())", ...
false
0.07369
0.083583
0.881642
[ "s053688731", "s175226895" ]
u855710796
p02685
python
s879866446
s197517917
1,411
303
24,640
94,568
Accepted
Accepted
78.53
N, M, K = list(map(int, input().split())) mod = 998244353 ans = 0 class Combination: def __init__(self, n): self.facts = [1 for i in range(N+1)] self.invs = [1 for i in range(N+1)] for i in range(1, N+1): self.facts[i] = self.facts[i-1] * i % mod ...
N, M, K = list(map(int, input().split())) mod = 998244353 ans = 0 class Combination: def __init__(self, n): self.facts = [1 for i in range(N+1)] self.invs = [1 for i in range(N+1)] for i in range(1, N+1): self.facts[i] = self.facts[i-1] * i % mod ...
25
28
609
675
N, M, K = list(map(int, input().split())) mod = 998244353 ans = 0 class Combination: def __init__(self, n): self.facts = [1 for i in range(N + 1)] self.invs = [1 for i in range(N + 1)] for i in range(1, N + 1): self.facts[i] = self.facts[i - 1] * i % mod self.invs[i...
N, M, K = list(map(int, input().split())) mod = 998244353 ans = 0 class Combination: def __init__(self, n): self.facts = [1 for i in range(N + 1)] self.invs = [1 for i in range(N + 1)] for i in range(1, N + 1): self.facts[i] = self.facts[i - 1] * i % mod self.invs[i...
false
10.714286
[ "+ def nhr(self, n, r):", "+ return self.ncr(n + r - 1, n - 1)", "+" ]
false
0.130839
0.006458
20.260128
[ "s879866446", "s197517917" ]
u291766461
p02695
python
s335005236
s111537516
824
460
85,160
86,696
Accepted
Accepted
44.17
import sys sys.setrecursionlimit(10 ** 6) N, M, Q = list(map(int, input().split())) a, b, c, d = [], [], [], [] for _ in range(Q): ta, tb, tc, td = list(map(int, input().split())) ta -= 1 tb -= 1 a.append(ta) b.append(tb) c.append(tc) d.append(td) x = [] def dfs(s): if le...
from copy import deepcopy N, M, Q = list(map(int, input().split())) a, b, c, d = [], [], [], [] for i in range(Q): tmp = list(map(int, input().split())) a.append(tmp[0]) b.append(tmp[1]) c.append(tmp[2]) d.append(tmp[3]) ans = 0 def dfs(A): global ans if len(A) == N + 1: ...
47
28
1,013
585
import sys sys.setrecursionlimit(10**6) N, M, Q = list(map(int, input().split())) a, b, c, d = [], [], [], [] for _ in range(Q): ta, tb, tc, td = list(map(int, input().split())) ta -= 1 tb -= 1 a.append(ta) b.append(tb) c.append(tc) d.append(td) x = [] def dfs(s): if len(s) - s.count(...
from copy import deepcopy N, M, Q = list(map(int, input().split())) a, b, c, d = [], [], [], [] for i in range(Q): tmp = list(map(int, input().split())) a.append(tmp[0]) b.append(tmp[1]) c.append(tmp[2]) d.append(tmp[3]) ans = 0 def dfs(A): global ans if len(A) == N + 1: now = 0 ...
false
40.425532
[ "-import sys", "+from copy import deepcopy", "-sys.setrecursionlimit(10**6)", "-for _ in range(Q):", "- ta, tb, tc, td = list(map(int, input().split()))", "- ta -= 1", "- tb -= 1", "- a.append(ta)", "- b.append(tb)", "- c.append(tc)", "- d.append(td)", "-x = []", "+for i...
false
0.166165
0.186947
0.888832
[ "s335005236", "s111537516" ]
u785989355
p02972
python
s856866124
s723745247
389
334
70,620
67,548
Accepted
Accepted
14.14
N = int(eval(input())) a = list(map(int,input().split())) ball = [-1 for i in range(N)] for i in range(N): num=N-i s = 0 for i in range(N//num): if ball[(N//num - i)*num-1]!=-1: s+=ball[(N//num - i)*num-1] else: ball[(N//num - i)*num-1]=(a[num-1]-s)%2 ...
N = int(eval(input())) a = list(map(int,input().split())) b = [0]*N for i in range(N): j = N-i k = 2*j context = 0 while k<=N: context+=b[k-1] k+=j if context%2==a[j-1]: b[j-1]=0 else: b[j-1]=1 M=sum(b) ans = [] for i,v in enumerate(b): ...
22
26
441
374
N = int(eval(input())) a = list(map(int, input().split())) ball = [-1 for i in range(N)] for i in range(N): num = N - i s = 0 for i in range(N // num): if ball[(N // num - i) * num - 1] != -1: s += ball[(N // num - i) * num - 1] else: ball[(N // num - i) * num - 1] = ...
N = int(eval(input())) a = list(map(int, input().split())) b = [0] * N for i in range(N): j = N - i k = 2 * j context = 0 while k <= N: context += b[k - 1] k += j if context % 2 == a[j - 1]: b[j - 1] = 0 else: b[j - 1] = 1 M = sum(b) ans = [] for i, v in enumerate...
false
15.384615
[ "-ball = [-1 for i in range(N)]", "+b = [0] * N", "- num = N - i", "- s = 0", "- for i in range(N // num):", "- if ball[(N // num - i) * num - 1] != -1:", "- s += ball[(N // num - i) * num - 1]", "- else:", "- ball[(N // num - i) * num - 1] = (a[num - 1] ...
false
0.047998
0.049573
0.968218
[ "s856866124", "s723745247" ]
u695811449
p02579
python
s225417226
s874948763
831
746
91,556
89,460
Accepted
Accepted
10.23
import sys input = sys.stdin.readline from collections import deque H,W=list(map(int,input().split())) sh,sw=list(map(int,input().split())) gh,gw=list(map(int,input().split())) MAP=[input().strip() for i in range(H)] ANS=[[1<<30]*W for i in range(H)] sh-=1 sw-=1 gh-=1 gw-=1 ANS[sh][sw]=0 Q=deque(...
import sys input = sys.stdin.readline from collections import deque H,W=list(map(int,input().split())) sh,sw=list(map(int,input().split())) gh,gw=list(map(int,input().split())) MAP=[input().strip() for i in range(H)] ANS=[[1<<30]*W for i in range(H)] sh-=1 sw-=1 gh-=1 gw-=1 ANS[sh][sw]=0 Q=deque(...
37
39
1,007
924
import sys input = sys.stdin.readline from collections import deque H, W = list(map(int, input().split())) sh, sw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) MAP = [input().strip() for i in range(H)] ANS = [[1 << 30] * W for i in range(H)] sh -= 1 sw -= 1 gh -= 1 gw -= 1 ANS[sh][sw] = 0...
import sys input = sys.stdin.readline from collections import deque H, W = list(map(int, input().split())) sh, sw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) MAP = [input().strip() for i in range(H)] ANS = [[1 << 30] * W for i in range(H)] sh -= 1 sw -= 1 gh -= 1 gw -= 1 ANS[sh][sw] = 0...
false
5.128205
[ "- for i, j in [", "- (x - 2, y - 2),", "- (x - 2, y - 1),", "- (x - 2, y),", "- (x - 2, y + 1),", "- (x - 2, y + 2),", "- (x - 1, y - 2),", "- (x - 1, y - 1),", "- (x - 1, y),", "- (x - 1, y + 1),", "- (x - 1, y + 2),", ...
false
0.044133
0.036104
1.222403
[ "s225417226", "s874948763" ]
u632424921
p02272
python
s296139162
s783543253
4,660
3,420
70,460
71,028
Accepted
Accepted
26.61
count = 0 def merge(data, left, mid, right): global count n1 = mid - left n2 = right - mid L = [] R = [] for i in range(n1): L.append(data[left+i]) for i in range(n2): R.append(data[mid+i]) L.append(float('inf')) R.append(float('inf')) i = 0 ...
count = 0 def merge(data, left, mid, right): global count n1 = mid - left n2 = right - mid L = data[left : mid] R = data[mid : right] L.append(float('inf')) R.append(float('inf')) i = 0 j = 0 for k in range(left, right): count += 1 if L[i] <= R[...
43
39
1,009
925
count = 0 def merge(data, left, mid, right): global count n1 = mid - left n2 = right - mid L = [] R = [] for i in range(n1): L.append(data[left + i]) for i in range(n2): R.append(data[mid + i]) L.append(float("inf")) R.append(float("inf")) i = 0 j = 0 fo...
count = 0 def merge(data, left, mid, right): global count n1 = mid - left n2 = right - mid L = data[left:mid] R = data[mid:right] L.append(float("inf")) R.append(float("inf")) i = 0 j = 0 for k in range(left, right): count += 1 if L[i] <= R[j]: data[...
false
9.302326
[ "- L = []", "- R = []", "- for i in range(n1):", "- L.append(data[left + i])", "- for i in range(n2):", "- R.append(data[mid + i])", "+ L = data[left:mid]", "+ R = data[mid:right]" ]
false
0.056954
0.055556
1.025164
[ "s296139162", "s783543253" ]
u621935300
p03037
python
s007870050
s992238464
124
104
33,896
33,640
Accepted
Accepted
16.13
N,M=list(map(int, input().split())) l_max=-1 r_min=float("inf") for i in range(M): l,r=list(map(int, input().split())) l_max=max(l_max, l) r_min=min(r_min, r) if r_min<l_max: print(0) else: print(r_min-l_max+1)
import sys N,M=list(map(int, sys.stdin.readline().split())) ll=float("-inf") rr=float("inf") for _ in range(M): l,r=list(map(int, sys.stdin.readline().split())) ll=max(ll,l) rr=min(rr,r) if ll<=rr: print(rr-ll+1) else: print(0)
13
13
223
246
N, M = list(map(int, input().split())) l_max = -1 r_min = float("inf") for i in range(M): l, r = list(map(int, input().split())) l_max = max(l_max, l) r_min = min(r_min, r) if r_min < l_max: print(0) else: print(r_min - l_max + 1)
import sys N, M = list(map(int, sys.stdin.readline().split())) ll = float("-inf") rr = float("inf") for _ in range(M): l, r = list(map(int, sys.stdin.readline().split())) ll = max(ll, l) rr = min(rr, r) if ll <= rr: print(rr - ll + 1) else: print(0)
false
0
[ "-N, M = list(map(int, input().split()))", "-l_max = -1", "-r_min = float(\"inf\")", "-for i in range(M):", "- l, r = list(map(int, input().split()))", "- l_max = max(l_max, l)", "- r_min = min(r_min, r)", "-if r_min < l_max:", "+import sys", "+", "+N, M = list(map(int, sys.stdin.readli...
false
0.047681
0.102051
0.467223
[ "s007870050", "s992238464" ]
u960080897
p03274
python
s411345953
s469753338
416
81
102,736
20,372
Accepted
Accepted
80.53
import sys; from decimal import Decimal import math; from numba import njit, i8, u1, b1 import bisect; from itertools import combinations, product import numpy as np; from collections import Counter, deque, defaultdict # sys.setrecursionlimit(10 ** 6) MOD = 10 ** 9 + 7 INF = 10 ** 9 PI ...
import sys # sys.setrecursionlimit(10 ** 6) MOD = 10 ** 9 + 7 INF = 10 ** 9 PI = 3.14159265358979323846 def read_str(): return sys.stdin.readline().strip() def read_int(): return int(sys.stdin.readline().strip()) def read_ints(): return list(map(int, sys.stdin.readline().strip().split())) def ...
34
31
1,191
956
import sys from decimal import Decimal import math from numba import njit, i8, u1, b1 import bisect from itertools import combinations, product import numpy as np from collections import Counter, deque, defaultdict # sys.setrecursionlimit(10 ** 6) MOD = 10**9 + 7 INF = 10**9 PI = 3.14159265358979323846 def read_str(...
import sys # sys.setrecursionlimit(10 ** 6) MOD = 10**9 + 7 INF = 10**9 PI = 3.14159265358979323846 def read_str(): return sys.stdin.readline().strip() def read_int(): return int(sys.stdin.readline().strip()) def read_ints(): return list(map(int, sys.stdin.readline().strip().split())) def read_str_...
false
8.823529
[ "-from decimal import Decimal", "-import math", "-from numba import njit, i8, u1, b1", "-import bisect", "-from itertools import combinations, product", "-import numpy as np", "-from collections import Counter, deque, defaultdict" ]
false
0.045695
0.036103
1.265689
[ "s411345953", "s469753338" ]
u161164709
p02585
python
s968280574
s719898215
1,151
1,023
146,244
145,056
Accepted
Accepted
11.12
n, k = list(map(int, input().split())) p = list(map(int, input().split())) c = list(map(int, input().split())) # mv_array = [set() for _ in range(n)] # score_mv_array = [[] for _ in range(n)] score_array = [0]*n def get_sum(array): score_array = [0] for i, a in enumerate(array): score_array...
n, k = list(map(int, input().split())) p = list(map(int, input().split())) c = list(map(int, input().split())) # mv_array = [set() for _ in range(n)] # score_mv_array = [[] for _ in range(n)] # score_array = [0]*n def get_sum(array): score_array = [0] for i, a in enumerate(array): score_arr...
43
46
1,184
1,239
n, k = list(map(int, input().split())) p = list(map(int, input().split())) c = list(map(int, input().split())) # mv_array = [set() for _ in range(n)] # score_mv_array = [[] for _ in range(n)] score_array = [0] * n def get_sum(array): score_array = [0] for i, a in enumerate(array): score_array.append(s...
n, k = list(map(int, input().split())) p = list(map(int, input().split())) c = list(map(int, input().split())) # mv_array = [set() for _ in range(n)] # score_mv_array = [[] for _ in range(n)] # score_array = [0]*n def get_sum(array): score_array = [0] for i, a in enumerate(array): score_array.append(sco...
false
6.521739
[ "-score_array = [0] * n", "-", "-", "+# score_array = [0]*n", "+max_score = -float(\"inf\")", "- max_score = c[i]", "+ # max_score = c[i]", "- score_array[i] = max_score", "-print((max(score_array)))", "+ # score_array[i] = max_score", "+# print(max(score_array))", "+print(max_scor...
false
0.068105
0.111291
0.611954
[ "s968280574", "s719898215" ]
u525065967
p02580
python
s748099213
s512711976
1,620
1,074
130,784
102,116
Accepted
Accepted
33.7
h, w, m = list(map(int, input().split())) HW = set() for _ in range(m): x, y = list(map(int, input().split())) HW.add((x-1,y-1)) sum_h = [[0,0] for _ in range(h)] # [sum, index] sum_w = [[0,0] for _ in range(w)] for h,w in HW: sum_h[h][0] += 1 sum_w[w][0] += 1 sum_h[h][1] = h sum_w[...
H, W, M = list(map(int, input().split())) HW = set(tuple([int(x)-1 for x in input().split()]) for _ in range(M)) sum_h = [0]*H; sum_w = [0]*W for h, w in HW: sum_h[h] += 1 sum_w[w] += 1 h_num_ix = {} for i in range(H): num = sum_h[i] if num == 0: continue if not num in h_num_ix: h_num_...
38
32
893
790
h, w, m = list(map(int, input().split())) HW = set() for _ in range(m): x, y = list(map(int, input().split())) HW.add((x - 1, y - 1)) sum_h = [[0, 0] for _ in range(h)] # [sum, index] sum_w = [[0, 0] for _ in range(w)] for h, w in HW: sum_h[h][0] += 1 sum_w[w][0] += 1 sum_h[h][1] = h sum_w[w][1...
H, W, M = list(map(int, input().split())) HW = set(tuple([int(x) - 1 for x in input().split()]) for _ in range(M)) sum_h = [0] * H sum_w = [0] * W for h, w in HW: sum_h[h] += 1 sum_w[w] += 1 h_num_ix = {} for i in range(H): num = sum_h[i] if num == 0: continue if not num in h_num_ix: ...
false
15.789474
[ "-h, w, m = list(map(int, input().split()))", "-HW = set()", "-for _ in range(m):", "- x, y = list(map(int, input().split()))", "- HW.add((x - 1, y - 1))", "-sum_h = [[0, 0] for _ in range(h)] # [sum, index]", "-sum_w = [[0, 0] for _ in range(w)]", "+H, W, M = list(map(int, input().split()))", ...
false
0.035067
0.037528
0.934425
[ "s748099213", "s512711976" ]
u714878632
p03733
python
s773698111
s593633429
159
124
25,200
25,196
Accepted
Accepted
22.01
N,T = [int(i) for i in input().split()] ts = [int(i) for i in input().split()] #ret = 0 # for ind in range (1, N): # ret += min(T,ts[ind]-ts[ind-1]) # for diff in [ts[ind+1]-ts[ind] for ind in range(N-1)]: # ret += T if T<diff else diff ret = sum([min(T, ts[ind+1]-ts[ind]) for ind in range(N-1)]) print(...
N,T = [int(i) for i in input().split()] ts = [int(i) for i in input().split()] ret = T # for ind in range (1, N): # ret += min(T,ts[ind]-ts[ind-1]) for diff in [ts[ind+1]-ts[ind] for ind in range(N-1)]: ret += T if T<diff else diff print(ret)
9
8
327
258
N, T = [int(i) for i in input().split()] ts = [int(i) for i in input().split()] # ret = 0 # for ind in range (1, N): # ret += min(T,ts[ind]-ts[ind-1]) # for diff in [ts[ind+1]-ts[ind] for ind in range(N-1)]: # ret += T if T<diff else diff ret = sum([min(T, ts[ind + 1] - ts[ind]) for ind in range(N - 1)]) print(...
N, T = [int(i) for i in input().split()] ts = [int(i) for i in input().split()] ret = T # for ind in range (1, N): # ret += min(T,ts[ind]-ts[ind-1]) for diff in [ts[ind + 1] - ts[ind] for ind in range(N - 1)]: ret += T if T < diff else diff print(ret)
false
11.111111
[ "-# ret = 0", "+ret = T", "-# for diff in [ts[ind+1]-ts[ind] for ind in range(N-1)]:", "-# ret += T if T<diff else diff", "-ret = sum([min(T, ts[ind + 1] - ts[ind]) for ind in range(N - 1)])", "-print((ret + T))", "+for diff in [ts[ind + 1] - ts[ind] for ind in range(N - 1)]:", "+ ret += T if T...
false
0.054966
0.054738
1.004163
[ "s773698111", "s593633429" ]
u631277801
p03141
python
s966564657
s879615250
447
316
29,996
32,224
Accepted
Accepted
29.31
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.re...
import sys stdin = sys.stdin sys.setrecursionlimit(10 ** 7) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): return stdin.r...
36
28
795
700
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): ...
import sys stdin = sys.stdin sys.setrecursionlimit(10**7) def li(): return list(map(int, stdin.readline().split())) def li_(): return [int(x) - 1 for x in stdin.readline().split()] def lf(): return list(map(float, stdin.readline().split())) def ls(): return stdin.readline().split() def ns(): ...
false
22.222222
[ "-sys.setrecursionlimit(10**5)", "+sys.setrecursionlimit(10**7)", "-from heapq import heappush, heappop", "-", "-ab = [tuple(li()) for _ in range(n)]", "-que = []", "-for ai, bi in ab:", "- heappush(que, [-ai - bi, ai, bi])", "-cnt = 0", "-tak = 0", "-aok = 0", "-while que:", "- sm, ai...
false
0.078665
0.079468
0.989888
[ "s966564657", "s879615250" ]
u788137651
p03006
python
s154259602
s698591743
663
200
81,644
39,792
Accepted
Accepted
69.83
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys input=sys.stdin.readline from math import floor,ceil,sqrt,factorial,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter,defaultdict from iter...
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys input=sys.stdin.readline from math import floor,ceil,sqrt,factorial,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter,defaultdict from iter...
119
58
3,649
1,594
# #    ⋀_⋀ #    (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys input = sys.stdin.readline from math import floor, ceil, sqrt, factorial, log # log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter, defaultdict from itertools import ...
# #    ⋀_⋀ #    (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys input = sys.stdin.readline from math import floor, ceil, sqrt, factorial, log # log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter, defaultdict from itertools import ...
false
51.260504
[ "- dic = defaultdict(lambda: -1)", "- for i, (x, y) in enumerate(XY):", "- dic[(x, y)] = i", "- # UnionFind", "- class UnionFind:", "- def __init__(self, n):", "- self.nodes = [-1] * n # nodes[x]: 負なら、絶対値が木の要素数", "-", "- def get_root(self, x):", "- ...
false
0.162698
0.088614
1.836044
[ "s154259602", "s698591743" ]
u798818115
p03723
python
s124063286
s769779314
19
17
3,064
3,064
Accepted
Accepted
10.53
l=list(map(int,input().split())) if l.count(l[0])==3: if l[0]%2==0: print((-1)) exit() else: print((0)) exit() count=0 while True: temp=list([x%2 for x in l]) all=sum(temp) if all==3: print((count+1)) exit() elif all==2: ...
l=list(map(int,input().split())) for i in range(3): if l[i]%2==1: print((0)) exit() if l.count(l[0])==3: if l[0]%2==0: print((-1)) exit() else: print((0)) exit() count=0 while True: temp=list([x%2 for x in l]) all=sum(temp) if...
26
31
453
528
l = list(map(int, input().split())) if l.count(l[0]) == 3: if l[0] % 2 == 0: print((-1)) exit() else: print((0)) exit() count = 0 while True: temp = list([x % 2 for x in l]) all = sum(temp) if all == 3: print((count + 1)) exit() elif all == 2: ...
l = list(map(int, input().split())) for i in range(3): if l[i] % 2 == 1: print((0)) exit() if l.count(l[0]) == 3: if l[0] % 2 == 0: print((-1)) exit() else: print((0)) exit() count = 0 while True: temp = list([x % 2 for x in l]) all = sum(temp) if ...
false
16.129032
[ "+for i in range(3):", "+ if l[i] % 2 == 1:", "+ print((0))", "+ exit()" ]
false
0.041568
0.042398
0.980416
[ "s124063286", "s769779314" ]
u933622697
p02993
python
s169222824
s341955267
30
22
3,572
3,444
Accepted
Accepted
26.67
from copy import copy s = list(eval(input())) before = '' for chara in s: if chara == before: print('Bad') exit() before = copy(chara) print('Good')
# AC from copy import copy s = list(eval(input())) before = '' for chara in s: if chara == before: print('Bad') exit() before = chara print('Good')
11
12
178
179
from copy import copy s = list(eval(input())) before = "" for chara in s: if chara == before: print("Bad") exit() before = copy(chara) print("Good")
# AC from copy import copy s = list(eval(input())) before = "" for chara in s: if chara == before: print("Bad") exit() before = chara print("Good")
false
8.333333
[ "+# AC", "- before = copy(chara)", "+ before = chara" ]
false
0.046975
0.043981
1.068069
[ "s169222824", "s341955267" ]
u078214750
p03086
python
s423732396
s421434867
34
27
9,864
9,052
Accepted
Accepted
20.59
import re S = eval(input()) r = re.findall('[ACTG]+', S) print((max([len(_) for _ in r], default=0)))
import itertools S = eval(input()) ans = 0 for i,j in itertools.combinations(list(range(len(S)+1)), 2): if all('ACTG'.count(c)==1 for c in S[i:j]): ans = max(ans, len(S[i:j])) print(ans)
4
7
96
193
import re S = eval(input()) r = re.findall("[ACTG]+", S) print((max([len(_) for _ in r], default=0)))
import itertools S = eval(input()) ans = 0 for i, j in itertools.combinations(list(range(len(S) + 1)), 2): if all("ACTG".count(c) == 1 for c in S[i:j]): ans = max(ans, len(S[i:j])) print(ans)
false
42.857143
[ "-import re", "+import itertools", "-r = re.findall(\"[ACTG]+\", S)", "-print((max([len(_) for _ in r], default=0)))", "+ans = 0", "+for i, j in itertools.combinations(list(range(len(S) + 1)), 2):", "+ if all(\"ACTG\".count(c) == 1 for c in S[i:j]):", "+ ans = max(ans, len(S[i:j]))", "+pri...
false
0.039878
0.037464
1.06445
[ "s423732396", "s421434867" ]
u353797797
p03176
python
s434381587
s365448943
1,855
1,196
35,332
35,204
Accepted
Accepted
35.53
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] class BitMax: de...
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] class BitMax: de...
38
38
901
935
import sys sys.setrecursionlimit(10**6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] class BitMax:...
import sys sys.setrecursionlimit(10**6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] class BitMax:...
false
0
[ "- self.table[i] = max(self.table[i], x)", "+ if x > self.table[i]:", "+ self.table[i] = x", "- res = max(res, self.table[i])", "+ if self.table[i] > res:", "+ res = self.table[i]" ]
false
0.03531
0.037036
0.953397
[ "s434381587", "s365448943" ]
u572142121
p03050
python
s226618805
s961750868
283
119
3,064
3,356
Accepted
Accepted
57.95
import math N=int(eval(input())) a=int((math.sqrt(N)//1)) ans=0 if N==2: print((0)) exit() for i in range(1,a): b=(N-i)/i if b.is_integer(): ans+=int(b) c=N//a d=N%a if int(c)==d: ans+=a a+=1 c=N//a d=N%a if int(c)==d: ans+=a print(ans)
N=int(eval(input())) def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) return divisors A=make_divisors(N) ans=0 for i in A: if i==1: continue a=N//(i-1) b=N%(i-1) if a==b...
21
19
264
343
import math N = int(eval(input())) a = int((math.sqrt(N) // 1)) ans = 0 if N == 2: print((0)) exit() for i in range(1, a): b = (N - i) / i if b.is_integer(): ans += int(b) c = N // a d = N % a if int(c) == d: ans += a a += 1 c = N // a d = N % a if int(c) == d: ans += a print(ans)
N = int(eval(input())) def make_divisors(n): divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) return divisors A = make_divisors(N) ans = 0 for i in A: if i == 1: continu...
false
9.52381
[ "-import math", "+N = int(eval(input()))", "-N = int(eval(input()))", "-a = int((math.sqrt(N) // 1))", "+", "+def make_divisors(n):", "+ divisors = []", "+ for i in range(1, int(n**0.5) + 1):", "+ if n % i == 0:", "+ divisors.append(i)", "+ if i != n // i:", ...
false
0.18438
0.175392
1.051245
[ "s226618805", "s961750868" ]
u982594421
p03208
python
s605406727
s538736839
292
259
11,060
8,280
Accepted
Accepted
11.3
n, k = list(map(int, input().split())) h = [] d = [0 for _ in range(n)] ans = float('inf') for _ in range(n): h.append(int(eval(input()))) h = sorted(h) for i in range(1, n): d[i] = d[i - 1] + h[i] - h[i - 1] for i in range(n - k + 1): diff = d[i + k - 1] - d[i] ans = min(ans, diff) ...
n, k = list(map(int, input().split())) h = [] ans = float('inf') for _ in range(n): h.append(int(eval(input()))) h = sorted(h) for i in range(n - k + 1): diff = h[i + k - 1] - h[i] ans = min(ans, diff) print(ans)
17
13
319
228
n, k = list(map(int, input().split())) h = [] d = [0 for _ in range(n)] ans = float("inf") for _ in range(n): h.append(int(eval(input()))) h = sorted(h) for i in range(1, n): d[i] = d[i - 1] + h[i] - h[i - 1] for i in range(n - k + 1): diff = d[i + k - 1] - d[i] ans = min(ans, diff) print(ans)
n, k = list(map(int, input().split())) h = [] ans = float("inf") for _ in range(n): h.append(int(eval(input()))) h = sorted(h) for i in range(n - k + 1): diff = h[i + k - 1] - h[i] ans = min(ans, diff) print(ans)
false
23.529412
[ "-d = [0 for _ in range(n)]", "-for i in range(1, n):", "- d[i] = d[i - 1] + h[i] - h[i - 1]", "- diff = d[i + k - 1] - d[i]", "+ diff = h[i + k - 1] - h[i]" ]
false
0.138207
0.036014
3.837623
[ "s605406727", "s538736839" ]
u883048396
p03148
python
s787476055
s840273896
558
402
50,932
38,648
Accepted
Accepted
27.96
import sys def 解(): input = sys.stdin.readline N,K = [int(_) for _ in input().split()] aP = sorted([[int(_) for _ in input().split()] for _ in range(N)],key=lambda x:x[1],reverse=True) dP = {} for t,d in aP: if t in dP: dP[t].append(d) else: dP[t] = ...
import sys def 解(): input = sys.stdin.readline N,K = [int(_) for _ in input().split()] aP = sorted([[int(_) for _ in input().split()] for _ in range(N)],key=lambda x:x[1],reverse=True) dS = set() aPK = aP[:K] for t,d in aPK: dS.add(t) dSall = dS.copy() for t,d in aP[K:]...
57
55
1,715
1,658
import sys def 解(): input = sys.stdin.readline N, K = [int(_) for _ in input().split()] aP = sorted( [[int(_) for _ in input().split()] for _ in range(N)], key=lambda x: x[1], reverse=True, ) dP = {} for t, d in aP: if t in dP: dP[t].append(d) ...
import sys def 解(): input = sys.stdin.readline N, K = [int(_) for _ in input().split()] aP = sorted( [[int(_) for _ in input().split()] for _ in range(N)], key=lambda x: x[1], reverse=True, ) dS = set() aPK = aP[:K] for t, d in aPK: dS.add(t) dSall = dS....
false
3.508772
[ "- dP = {}", "- for t, d in aP:", "- if t in dP:", "- dP[t].append(d)", "- else:", "- dP[t] = [d]", "- iSall = len(list(dP.keys()))", "- for x in aPK:", "- dS.add(x[0])", "+ for t, d in aPK:", "+ dS.add(t)", "+ dSall = dS.copy...
false
0.04653
0.047151
0.986828
[ "s787476055", "s840273896" ]
u133745933
p03162
python
s838683451
s069939183
663
292
62,172
104,924
Accepted
Accepted
55.96
n = int(eval(input())) dp = [[0 for _ in range(3)] for _ in range(n+1)] ls = [[1,2],[0,2],[0,1]] for i in range(1,n+1): day = list(map(int,input().split())) dp[i][0] = day[0] + max(dp[i-1][1],dp[i-1][2]) dp[i][1] = day[1] + max(dp[i-1][0],dp[i-1][2]) dp[i][2] = day[2] + max(dp[i-1][0],dp[i-1][1]...
N = int(eval(input())) ls = [[0 for i in range(3)] for i in range(N)] for i in range(N): ls[i] = list(map(int,input().split())) # dp[i][j] -> i-1日目にjの仕事をしたときの i 日目の幸福度の総和 dp = [ [0 for i in range(3)] for i in range(N)] for i in range(3): dp[0][i] = ls[0][i] for i in range(1,N): for j in range(3): ...
9
16
335
473
n = int(eval(input())) dp = [[0 for _ in range(3)] for _ in range(n + 1)] ls = [[1, 2], [0, 2], [0, 1]] for i in range(1, n + 1): day = list(map(int, input().split())) dp[i][0] = day[0] + max(dp[i - 1][1], dp[i - 1][2]) dp[i][1] = day[1] + max(dp[i - 1][0], dp[i - 1][2]) dp[i][2] = day[2] + max(dp[i - 1...
N = int(eval(input())) ls = [[0 for i in range(3)] for i in range(N)] for i in range(N): ls[i] = list(map(int, input().split())) # dp[i][j] -> i-1日目にjの仕事をしたときの i 日目の幸福度の総和 dp = [[0 for i in range(3)] for i in range(N)] for i in range(3): dp[0][i] = ls[0][i] for i in range(1, N): for j in range(3): w...
false
43.75
[ "-n = int(eval(input()))", "-dp = [[0 for _ in range(3)] for _ in range(n + 1)]", "-ls = [[1, 2], [0, 2], [0, 1]]", "-for i in range(1, n + 1):", "- day = list(map(int, input().split()))", "- dp[i][0] = day[0] + max(dp[i - 1][1], dp[i - 1][2])", "- dp[i][1] = day[1] + max(dp[i - 1][0], dp[i - 1...
false
0.036095
0.039135
0.922309
[ "s838683451", "s069939183" ]
u353919145
p02779
python
s017810326
s327017140
184
141
35,380
31,044
Accepted
Accepted
23.37
n=int(eval(input())) a=[int(i) for i in input().split()] cnt={} for i in range(n): cnt[a[i]]=0 ok=1 for i in range(n): cnt[a[i]]+=1 if cnt[a[i]]==2: print("NO") ok=0 break if ok==1: print("YES")
n = int(eval(input())) s = [int(i) for i in input().split()] s.sort() flag = False for i in range (0,n-1): if s[i] == s[i+1]: flag = True break if flag == True: print("NO") else: print("YES")
15
11
244
207
n = int(eval(input())) a = [int(i) for i in input().split()] cnt = {} for i in range(n): cnt[a[i]] = 0 ok = 1 for i in range(n): cnt[a[i]] += 1 if cnt[a[i]] == 2: print("NO") ok = 0 break if ok == 1: print("YES")
n = int(eval(input())) s = [int(i) for i in input().split()] s.sort() flag = False for i in range(0, n - 1): if s[i] == s[i + 1]: flag = True break if flag == True: print("NO") else: print("YES")
false
26.666667
[ "-a = [int(i) for i in input().split()]", "-cnt = {}", "-for i in range(n):", "- cnt[a[i]] = 0", "-ok = 1", "-for i in range(n):", "- cnt[a[i]] += 1", "- if cnt[a[i]] == 2:", "- print(\"NO\")", "- ok = 0", "+s = [int(i) for i in input().split()]", "+s.sort()", "+flag =...
false
0.078106
0.036343
2.149132
[ "s017810326", "s327017140" ]
u644907318
p02883
python
s348416871
s318429643
1,286
624
121,292
122,572
Accepted
Accepted
51.48
import math N,K = list(map(int,input().split())) A = sorted(list(map(int,input().split()))) F = sorted(list(map(int,input().split())),reverse=True) high = 0 for i in range(N): high = max(high,A[i]*F[i]) low = -1 while high-low>1: mid = (high+low)//2 flag = 1 T = K for i in range(N): ...
N,K = list(map(int,input().split())) A = sorted(list(map(int,input().split()))) F = sorted(list(map(int,input().split())),reverse=True) if K>=sum(A): ans = 0 else: low = 0 high = 10**12 while high-low>1: mid = (high+low)//2 B = A[:] cnt = 0 for i in range(N): ...
24
21
553
495
import math N, K = list(map(int, input().split())) A = sorted(list(map(int, input().split()))) F = sorted(list(map(int, input().split())), reverse=True) high = 0 for i in range(N): high = max(high, A[i] * F[i]) low = -1 while high - low > 1: mid = (high + low) // 2 flag = 1 T = K for i in range(N):...
N, K = list(map(int, input().split())) A = sorted(list(map(int, input().split()))) F = sorted(list(map(int, input().split())), reverse=True) if K >= sum(A): ans = 0 else: low = 0 high = 10**12 while high - low > 1: mid = (high + low) // 2 B = A[:] cnt = 0 for i in range(N...
false
12.5
[ "-import math", "-", "-high = 0", "-for i in range(N):", "- high = max(high, A[i] * F[i])", "-low = -1", "-while high - low > 1:", "- mid = (high + low) // 2", "- flag = 1", "- T = K", "- for i in range(N):", "- if A[i] * F[i] <= mid:", "- continue", "+if K...
false
0.00681
0.090421
0.075315
[ "s348416871", "s318429643" ]
u498575211
p02724
python
s576636815
s618741761
448
18
2,940
2,940
Accepted
Accepted
95.98
S = int(eval(input())) G = 500 GG = 5 g_count = 0 gg_count= 0 while S >= G: S = S - G g_count += 1 while S >= GG: S = S - GG gg_count += 1 print((g_count*1000 + gg_count*5))
N = int(eval(input())) NN = N // 500 MM = N % 500 LL = MM // 5 #print(NN, LL) print((NN * 1000 + LL * 5))
14
6
189
102
S = int(eval(input())) G = 500 GG = 5 g_count = 0 gg_count = 0 while S >= G: S = S - G g_count += 1 while S >= GG: S = S - GG gg_count += 1 print((g_count * 1000 + gg_count * 5))
N = int(eval(input())) NN = N // 500 MM = N % 500 LL = MM // 5 # print(NN, LL) print((NN * 1000 + LL * 5))
false
57.142857
[ "-S = int(eval(input()))", "-G = 500", "-GG = 5", "-g_count = 0", "-gg_count = 0", "-while S >= G:", "- S = S - G", "- g_count += 1", "-while S >= GG:", "- S = S - GG", "- gg_count += 1", "-print((g_count * 1000 + gg_count * 5))", "+N = int(eval(input()))", "+NN = N // 500", ...
false
0.361431
0.036225
9.977497
[ "s576636815", "s618741761" ]
u622570247
p02912
python
s689574431
s879316281
265
151
24,516
15,044
Accepted
Accepted
43.02
import heapq n, m = list(map(int, input().split())) aa = list(map(int, input().split())) h = [(-a, a) for a in aa] heapq.heapify(h) for _ in range(m): x = h[0] c = x[1] // 2 x = (-c, c) heapq.heapreplace(h, x) print((sum([-hh[0] for hh in h])))
import heapq n, m = list(map(int, input().split())) aa = list(map(int, input().split())) h = [-a for a in aa] heapq.heapify(h) for _ in range(m): x = h[0] heapq.heapreplace(h, -(-x // 2)) print((sum([-hh for hh in h])))
15
12
270
233
import heapq n, m = list(map(int, input().split())) aa = list(map(int, input().split())) h = [(-a, a) for a in aa] heapq.heapify(h) for _ in range(m): x = h[0] c = x[1] // 2 x = (-c, c) heapq.heapreplace(h, x) print((sum([-hh[0] for hh in h])))
import heapq n, m = list(map(int, input().split())) aa = list(map(int, input().split())) h = [-a for a in aa] heapq.heapify(h) for _ in range(m): x = h[0] heapq.heapreplace(h, -(-x // 2)) print((sum([-hh for hh in h])))
false
20
[ "-h = [(-a, a) for a in aa]", "+h = [-a for a in aa]", "- c = x[1] // 2", "- x = (-c, c)", "- heapq.heapreplace(h, x)", "-print((sum([-hh[0] for hh in h])))", "+ heapq.heapreplace(h, -(-x // 2))", "+print((sum([-hh for hh in h])))" ]
false
0.091259
0.038691
2.358679
[ "s689574431", "s879316281" ]
u678167152
p04015
python
s197322556
s968133196
147
72
117,812
73,448
Accepted
Accepted
51.02
def solve(): ans = 0 N, A = list(map(int, input().split())) X = list(map(int, input().split())) x = sum(X) dp = [[[0]*2550 for _ in range(N+1)] for _ in range(N+1)] dp[0][0][0] = 1 for i in range(N): for j in range(i+1): for k in range(x): dp[i+1][j][k] += dp[i][j][k] ...
N, A = list(map(int, input().split())) X = list([int(x)-A for x in input().split()]) dp = [0]*10000 dp[0] = 1 for i in range(N): new_dp = dp[:] for j in range(-3000,3000): if dp[j]>0: new_dp[j+X[i]] += dp[j] dp = new_dp print((dp[0]-1))
16
11
432
259
def solve(): ans = 0 N, A = list(map(int, input().split())) X = list(map(int, input().split())) x = sum(X) dp = [[[0] * 2550 for _ in range(N + 1)] for _ in range(N + 1)] dp[0][0][0] = 1 for i in range(N): for j in range(i + 1): for k in range(x): dp[i + 1...
N, A = list(map(int, input().split())) X = list([int(x) - A for x in input().split()]) dp = [0] * 10000 dp[0] = 1 for i in range(N): new_dp = dp[:] for j in range(-3000, 3000): if dp[j] > 0: new_dp[j + X[i]] += dp[j] dp = new_dp print((dp[0] - 1))
false
31.25
[ "-def solve():", "- ans = 0", "- N, A = list(map(int, input().split()))", "- X = list(map(int, input().split()))", "- x = sum(X)", "- dp = [[[0] * 2550 for _ in range(N + 1)] for _ in range(N + 1)]", "- dp[0][0][0] = 1", "- for i in range(N):", "- for j in range(i + 1):",...
false
0.052464
0.044118
1.189171
[ "s197322556", "s968133196" ]
u310233294
p03574
python
s110177615
s327404663
32
29
3,316
3,188
Accepted
Accepted
9.38
from itertools import product H, W = list(map(int, input().split())) S = [list(eval(input())) for _ in range(H)] for i in range(H): for j in range(W): m = product([0, 1, -1], repeat=2) if S[i][j] == '.': S[i][j] = 0 for ii, jj in m: iii = i + ii ...
from itertools import product H, W = list(map(int, input().split())) S = [list(eval(input())) for _ in range(H)] m = list(product([0, 1, -1], repeat=2)) for i in range(H): for j in range(W): if S[i][j] == '.': S[i][j] = 0 for ii, jj in m: iii = i + ii ...
19
19
543
541
from itertools import product H, W = list(map(int, input().split())) S = [list(eval(input())) for _ in range(H)] for i in range(H): for j in range(W): m = product([0, 1, -1], repeat=2) if S[i][j] == ".": S[i][j] = 0 for ii, jj in m: iii = i + ii ...
from itertools import product H, W = list(map(int, input().split())) S = [list(eval(input())) for _ in range(H)] m = list(product([0, 1, -1], repeat=2)) for i in range(H): for j in range(W): if S[i][j] == ".": S[i][j] = 0 for ii, jj in m: iii = i + ii ...
false
0
[ "+m = list(product([0, 1, -1], repeat=2))", "- m = product([0, 1, -1], repeat=2)" ]
false
0.039695
0.008001
4.961142
[ "s110177615", "s327404663" ]
u796942881
p03695
python
s007173750
s391721656
21
17
3,316
3,064
Accepted
Accepted
19.05
from collections import defaultdict def check(ai, ratemax, d): if 3199 < ai: ratemax += 1 else: d[ai // 400] += 1 return ratemax def main(): N, *a = list(map(int, open(0).read().split())) d = defaultdict(lambda: 0) ratemax = 0 for ai in a: ratemax ...
def check(ai, ratemax, d): if 3199 < ai: ratemax += 1 else: d[ai // 400] = 1 return ratemax def main(): N, *a = list(map(int, open(0).read().split())) lst = [0] * 8 ratemax = 0 for ai in a: ratemax = check(ai, ratemax, lst) print((sum(lst) if sum(l...
22
19
416
369
from collections import defaultdict def check(ai, ratemax, d): if 3199 < ai: ratemax += 1 else: d[ai // 400] += 1 return ratemax def main(): N, *a = list(map(int, open(0).read().split())) d = defaultdict(lambda: 0) ratemax = 0 for ai in a: ratemax = check(ai, rate...
def check(ai, ratemax, d): if 3199 < ai: ratemax += 1 else: d[ai // 400] = 1 return ratemax def main(): N, *a = list(map(int, open(0).read().split())) lst = [0] * 8 ratemax = 0 for ai in a: ratemax = check(ai, ratemax, lst) print((sum(lst) if sum(lst) else 1, su...
false
13.636364
[ "-from collections import defaultdict", "-", "-", "- d[ai // 400] += 1", "+ d[ai // 400] = 1", "- d = defaultdict(lambda: 0)", "+ lst = [0] * 8", "- ratemax = check(ai, ratemax, d)", "- print((len(d) if len(d) else 1, len(d) + ratemax))", "+ ratemax = check(ai,...
false
0.041408
0.042699
0.969775
[ "s007173750", "s391721656" ]
u256031597
p02888
python
s900641787
s917606623
1,364
1,229
3,188
3,188
Accepted
Accepted
9.9
from bisect import bisect_left N = int(eval(input())) L = list(map(int, input().split())) L.sort() cnt = 0 # 2番目に長い棒bを固定 for b in range(N): # bより短い棒aを一つずつ探索 for a in range(b): ab = L[a] + L[b] # 二分探索でa+bより短い棒(c<a+bが成り立つc)の範囲を求める r = bisect_left(L, ab) # cの範囲のう...
import bisect N = int(eval(input())) L = list(map(int, input().split())) L.sort() cnt = 0 for i, b in enumerate(L): for a in L[:i]: idx = bisect.bisect_left(L, a+b) cnt += idx - (i + 1) print(cnt)
20
15
375
230
from bisect import bisect_left N = int(eval(input())) L = list(map(int, input().split())) L.sort() cnt = 0 # 2番目に長い棒bを固定 for b in range(N): # bより短い棒aを一つずつ探索 for a in range(b): ab = L[a] + L[b] # 二分探索でa+bより短い棒(c<a+bが成り立つc)の範囲を求める r = bisect_left(L, ab) # cの範囲のうちbの範囲を除外して、cの本数を求める...
import bisect N = int(eval(input())) L = list(map(int, input().split())) L.sort() cnt = 0 for i, b in enumerate(L): for a in L[:i]: idx = bisect.bisect_left(L, a + b) cnt += idx - (i + 1) print(cnt)
false
25
[ "-from bisect import bisect_left", "+import bisect", "-# 2番目に長い棒bを固定", "-for b in range(N):", "- # bより短い棒aを一つずつ探索", "- for a in range(b):", "- ab = L[a] + L[b]", "- # 二分探索でa+bより短い棒(c<a+bが成り立つc)の範囲を求める", "- r = bisect_left(L, ab)", "- # cの範囲のうちbの範囲を除外して、cの本数を求める", ...
false
0.045673
0.045309
1.008037
[ "s900641787", "s917606623" ]
u861141787
p02712
python
s887242989
s529223176
117
21
30,016
9,144
Accepted
Accepted
82.05
n = int(eval(input())) a = [i for i in range(1, n+1) if i % 3 != 0 and i % 5 != 0] print((sum(a)))
# 別解法 o(1) def gauss(n): return n * (n+1) // 2 n = int(eval(input())) ans = gauss(n) - gauss(n//3) * 3 - gauss(n//5) * 5 + gauss(n//15) * 15 print(ans)
6
8
99
159
n = int(eval(input())) a = [i for i in range(1, n + 1) if i % 3 != 0 and i % 5 != 0] print((sum(a)))
# 別解法 o(1) def gauss(n): return n * (n + 1) // 2 n = int(eval(input())) ans = gauss(n) - gauss(n // 3) * 3 - gauss(n // 5) * 5 + gauss(n // 15) * 15 print(ans)
false
25
[ "+# 別解法 o(1)", "+def gauss(n):", "+ return n * (n + 1) // 2", "+", "+", "-a = [i for i in range(1, n + 1) if i % 3 != 0 and i % 5 != 0]", "-print((sum(a)))", "+ans = gauss(n) - gauss(n // 3) * 3 - gauss(n // 5) * 5 + gauss(n // 15) * 15", "+print(ans)" ]
false
0.250279
0.091289
2.741621
[ "s887242989", "s529223176" ]
u063052907
p03448
python
s248856861
s474556816
24
18
3,060
3,060
Accepted
Accepted
25
# coding: utf-8 # Your code here! import sys input = sys.stdin.readline A, B, C, X = [int(eval(input())) for _ in range(4)] cnt = 0 for i in range(A+1): X1 = X - 500 * i if X1 >= 0: for j in range(B+1): X2 = X1 - 100 * j if X2 >= 0 and X2 <= 50 * C: ...
# coding: utf-8 # Your code here! import sys input = sys.stdin.readline A, B, C, X = [int(eval(input())) for _ in range(4)] cnt = 0 for i in range(A+1): X1 = X - 500 * i if X1 >= 0: for j in range(B+1): X2 = X1 - 100 * j if X2 >= 0: if X2 <= 50 * C...
17
18
338
359
# coding: utf-8 # Your code here! import sys input = sys.stdin.readline A, B, C, X = [int(eval(input())) for _ in range(4)] cnt = 0 for i in range(A + 1): X1 = X - 500 * i if X1 >= 0: for j in range(B + 1): X2 = X1 - 100 * j if X2 >= 0 and X2 <= 50 * C: cnt += 1 ...
# coding: utf-8 # Your code here! import sys input = sys.stdin.readline A, B, C, X = [int(eval(input())) for _ in range(4)] cnt = 0 for i in range(A + 1): X1 = X - 500 * i if X1 >= 0: for j in range(B + 1): X2 = X1 - 100 * j if X2 >= 0: if X2 <= 50 * C: ...
false
5.555556
[ "- if X2 >= 0 and X2 <= 50 * C:", "- cnt += 1", "+ if X2 >= 0:", "+ if X2 <= 50 * C:", "+ cnt += 1" ]
false
0.092056
0.037908
2.428407
[ "s248856861", "s474556816" ]
u228232845
p03086
python
s350046728
s077500149
19
17
3,064
3,060
Accepted
Accepted
10.53
s = eval(input()) ans = 0 for i in range(len(s) - 1): if s[i] not in {'A', 'C', 'G', 'T'}: continue length = 1 for j in range(i + 1, len(s)): if s[j] not in {'A', 'C', 'G', 'T'}: break length += 1 ans = max(ans, length) if len(s) == 1: ans = 0 if s not...
import sys s = sys.stdin.readline() ans = 0 for i in range(len(s)): # print(f'{s[i]=}') if s[i] not in {'A', 'C', 'G', 'T'}: continue length = 1 for j in range(i + 1, len(s)): if s[j] in {'A', 'C', 'G', 'T'}: # print(f'{s[j]=}') length += 1 else: break ...
14
15
357
383
s = eval(input()) ans = 0 for i in range(len(s) - 1): if s[i] not in {"A", "C", "G", "T"}: continue length = 1 for j in range(i + 1, len(s)): if s[j] not in {"A", "C", "G", "T"}: break length += 1 ans = max(ans, length) if len(s) == 1: ans = 0 if s not in {"A", "C...
import sys s = sys.stdin.readline() ans = 0 for i in range(len(s)): # print(f'{s[i]=}') if s[i] not in {"A", "C", "G", "T"}: continue length = 1 for j in range(i + 1, len(s)): if s[j] in {"A", "C", "G", "T"}: # print(f'{s[j]=}') length += 1 else: ...
false
6.666667
[ "-s = eval(input())", "+import sys", "+", "+s = sys.stdin.readline()", "-for i in range(len(s) - 1):", "+for i in range(len(s)):", "+ # print(f'{s[i]=}')", "- if s[j] not in {\"A\", \"C\", \"G\", \"T\"}:", "+ if s[j] in {\"A\", \"C\", \"G\", \"T\"}:", "+ # print(f'{s[j]...
false
0.04281
0.053833
0.795235
[ "s350046728", "s077500149" ]
u489762173
p03244
python
s269979776
s832771893
142
81
34,012
18,592
Accepted
Accepted
42.96
import collections N = int(eval(input())) V = [int(x) for x in input().split()] Va, Vb = [], [] for i in range(N): if i % 2 == 0: Va.append(V[i]) else: Vb.append(V[i]) Va_most = collections.Counter(Va).most_common() Vb_most = collections.Counter(Vb).most_common() if N == colle...
import itertools from collections import Counter N = int(eval(input())) V = [int(x) for x in input().split()] EV_cnt = Counter(V[::2]) OD_cnt = Counter(V[1::2]) EV_cnt[-1] = 0 OD_cnt[-2] = 0 EV = EV_cnt.most_common(2) OD = OD_cnt.most_common(2) ans = N for (k1,v1), (k2,v2) in itertools.product(EV,OD)...
30
23
765
422
import collections N = int(eval(input())) V = [int(x) for x in input().split()] Va, Vb = [], [] for i in range(N): if i % 2 == 0: Va.append(V[i]) else: Vb.append(V[i]) Va_most = collections.Counter(Va).most_common() Vb_most = collections.Counter(Vb).most_common() if N == collections.Counter(V)....
import itertools from collections import Counter N = int(eval(input())) V = [int(x) for x in input().split()] EV_cnt = Counter(V[::2]) OD_cnt = Counter(V[1::2]) EV_cnt[-1] = 0 OD_cnt[-2] = 0 EV = EV_cnt.most_common(2) OD = OD_cnt.most_common(2) ans = N for (k1, v1), (k2, v2) in itertools.product(EV, OD): if k1 == ...
false
23.333333
[ "-import collections", "+import itertools", "+from collections import Counter", "-Va, Vb = [], []", "-for i in range(N):", "- if i % 2 == 0:", "- Va.append(V[i])", "- else:", "- Vb.append(V[i])", "-Va_most = collections.Counter(Va).most_common()", "-Vb_most = collections.Coun...
false
0.035713
0.065888
0.54203
[ "s269979776", "s832771893" ]
u966891144
p03854
python
s386837947
s099606373
69
19
3,188
3,188
Accepted
Accepted
72.46
s = eval(input()) ans = 'YES' while len(s) > 0: if s.endswith('dreamer'): s = s[:-7] elif s.endswith('dream'): s = s[:-5] elif s.endswith('eraser'): s = s[:-6] elif s.endswith('erase'): s = s[:-5] else: ans = 'NO' break print(ans)
s = eval(input()) s = s[-1::-1] word = ['resare','esare','remaerd','maerd',] for i in word: s = s.replace(i,'') if s: print('NO') else: print('YES')
17
9
312
162
s = eval(input()) ans = "YES" while len(s) > 0: if s.endswith("dreamer"): s = s[:-7] elif s.endswith("dream"): s = s[:-5] elif s.endswith("eraser"): s = s[:-6] elif s.endswith("erase"): s = s[:-5] else: ans = "NO" break print(ans)
s = eval(input()) s = s[-1::-1] word = [ "resare", "esare", "remaerd", "maerd", ] for i in word: s = s.replace(i, "") if s: print("NO") else: print("YES")
false
47.058824
[ "-ans = \"YES\"", "-while len(s) > 0:", "- if s.endswith(\"dreamer\"):", "- s = s[:-7]", "- elif s.endswith(\"dream\"):", "- s = s[:-5]", "- elif s.endswith(\"eraser\"):", "- s = s[:-6]", "- elif s.endswith(\"erase\"):", "- s = s[:-5]", "- else:", "- ...
false
0.053428
0.078858
0.677519
[ "s386837947", "s099606373" ]
u150984829
p02270
python
s421865389
s359082182
1,170
960
10,340
16,424
Accepted
Accepted
17.95
def check(P): i=0 for _ in[0]*k: s=0 while s+w[i]<=P: s+=w[i];i+=1 if i==n: return n return i n,k=list(map(int,input().split())) w=[int(eval(input()))for _ in[0]*n] l=0;r=n*100000 while r-l>1: m=(l+r)//2 if check(m)>=n:r=m else:l=m print(r)
import sys def f(P): i=0 for _ in[0]*k: s=0 while s+w[i]<=P: s+=w[i];i+=1 if i==n: return n return i n,k=list(map(int,input().split())) w=list(map(int,sys.stdin.read().splitlines())) l=0;r=n*100000 while r-l>1: m=(l+r)//2 if f(m)>=n:r=m else:l=m print(r)
16
17
260
281
def check(P): i = 0 for _ in [0] * k: s = 0 while s + w[i] <= P: s += w[i] i += 1 if i == n: return n return i n, k = list(map(int, input().split())) w = [int(eval(input())) for _ in [0] * n] l = 0 r = n * 100000 while r - l > 1: m = ...
import sys def f(P): i = 0 for _ in [0] * k: s = 0 while s + w[i] <= P: s += w[i] i += 1 if i == n: return n return i n, k = list(map(int, input().split())) w = list(map(int, sys.stdin.read().splitlines())) l = 0 r = n * 100000 while r ...
false
5.882353
[ "-def check(P):", "+import sys", "+", "+", "+def f(P):", "-w = [int(eval(input())) for _ in [0] * n]", "+w = list(map(int, sys.stdin.read().splitlines()))", "- if check(m) >= n:", "+ if f(m) >= n:" ]
false
0.049172
0.071757
0.685261
[ "s421865389", "s359082182" ]
u150984829
p02283
python
s539766806
s128278161
5,390
4,230
53,992
63,272
Accepted
Accepted
21.52
import sys class Node: __slots__ = ['key', 'left', 'right'] def __init__(self, key): self.key = key self.left = None self.right = None class BST: def __init__(self): self.root = None def insert(self, key): x = self.root y = None z ...
import sys class Node: __slots__ = ['key', 'left', 'right'] def __init__(self, key): self.key = key self.left = None self.right = None class BST: def __init__(self): self.root = None def insert(self, key): x = self.root y = None z ...
45
36
1,140
1,021
import sys class Node: __slots__ = ["key", "left", "right"] def __init__(self, key): self.key = key self.left = None self.right = None class BST: def __init__(self): self.root = None def insert(self, key): x = self.root y = None z = Node(key)...
import sys class Node: __slots__ = ["key", "left", "right"] def __init__(self, key): self.key = key self.left = None self.right = None class BST: def __init__(self): self.root = None def insert(self, key): x = self.root y = None z = Node(key)...
false
20
[ "- if node:", "- inorder(node.left)", "- print(\"\", node.key, end=\"\")", "- inorder(node.right)", "+ return (", "+ inorder(node.left) + f\" {node.key}\" + inorder(node.right)", "+ if node", "+ ...
false
0.050454
0.046786
1.07839
[ "s539766806", "s128278161" ]
u626891113
p03612
python
s658027068
s674172527
91
84
84,040
83,940
Accepted
Accepted
7.69
n = int(eval(input())) p = list(map(int, input().split())) i = 0 ans = 0 while True: if p[i] == i + 1: cnt = 0 while p[i + cnt] == i + cnt + 1: cnt += 1 if cnt + i == n: break ans += cnt//2 + cnt%2 i += cnt else: i += ...
n = int(eval(input())) p = list(map(int, input().split())) i = 0 ans = 0 while i != n: if p[i] == i + 1: cnt = 0 while i + cnt != n and p[i + cnt] == i + cnt + 1: cnt += 1 ans += cnt//2 + cnt%2 i += cnt else: i += 1 print(ans)
18
14
358
293
n = int(eval(input())) p = list(map(int, input().split())) i = 0 ans = 0 while True: if p[i] == i + 1: cnt = 0 while p[i + cnt] == i + cnt + 1: cnt += 1 if cnt + i == n: break ans += cnt // 2 + cnt % 2 i += cnt else: i += 1 if i...
n = int(eval(input())) p = list(map(int, input().split())) i = 0 ans = 0 while i != n: if p[i] == i + 1: cnt = 0 while i + cnt != n and p[i + cnt] == i + cnt + 1: cnt += 1 ans += cnt // 2 + cnt % 2 i += cnt else: i += 1 print(ans)
false
22.222222
[ "-while True:", "+while i != n:", "- while p[i + cnt] == i + cnt + 1:", "+ while i + cnt != n and p[i + cnt] == i + cnt + 1:", "- if cnt + i == n:", "- break", "- if i == n:", "- break" ]
false
0.087782
0.043962
1.99677
[ "s658027068", "s674172527" ]
u142415823
p03456
python
s559362974
s100711277
47
18
2,940
2,940
Accepted
Accepted
61.7
a, b = input().split() n = int(a + b) flag = False for i in range(n): if i ** 2 == n: flag = True break print(('Yes' if flag else 'No'))
a, b = input().split() n = int(a + b) flag = False for i in range(1000): if i ** 2 == n: flag = True break print(('Yes' if flag else 'No'))
10
10
166
169
a, b = input().split() n = int(a + b) flag = False for i in range(n): if i**2 == n: flag = True break print(("Yes" if flag else "No"))
a, b = input().split() n = int(a + b) flag = False for i in range(1000): if i**2 == n: flag = True break print(("Yes" if flag else "No"))
false
0
[ "-for i in range(n):", "+for i in range(1000):" ]
false
0.108431
0.039413
2.751184
[ "s559362974", "s100711277" ]
u600402037
p03973
python
s887599304
s044992720
124
112
7,884
7,848
Accepted
Accepted
9.68
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() A = [ir() for _ in range(N)] answer = A[0] - 1 cur_limit = 2 for a in A[1:]: if a == cur_limit: cur_limit += 1 continue answer += -((-(a-cur_limit)) // ...
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() A = [ir() for _ in range(N)] answer = A[0] - 1 cur_limit = 2 for a in A[1:]: if a == cur_limit: cur_limit += 1 continue answer += (a-1) // cur_limit ...
18
18
353
340
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() A = [ir() for _ in range(N)] answer = A[0] - 1 cur_limit = 2 for a in A[1:]: if a == cur_limit: cur_limit += 1 continue answer += -((-(a - cur_limit)) // cur_limit) pr...
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() A = [ir() for _ in range(N)] answer = A[0] - 1 cur_limit = 2 for a in A[1:]: if a == cur_limit: cur_limit += 1 continue answer += (a - 1) // cur_limit print(answer) # ...
false
0
[ "- answer += -((-(a - cur_limit)) // cur_limit)", "+ answer += (a - 1) // cur_limit" ]
false
0.038772
0.113797
0.340713
[ "s887599304", "s044992720" ]