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
u952467214
p02862
python
s910430714
s749000698
878
658
82,512
82,288
Accepted
Accepted
25.06
import math mod = 10**9 + 7 x, y = list(map(int, input().split())) if (x+y)%3 != 0: print((0)) exit() if x == 0 or y == 0: print((0)) exit() X = max(x,y) Y = min(x,y) all_move = (X+Y)//3 diff = (X-Y) y_move = (all_move - diff)//2 def cmb(n, r, mod): if ( r<0 or r>n ): ...
import math MOD = 10**9 + 7 # 素数 x, y = list(map(int, input().split())) if (x+y)%3 != 0: print((0)) exit() if x == 0 or y == 0: print((0)) exit() X = max(x,y) Y = min(x,y) all_move = (X+Y)//3 diff = (X-Y) Y_move = (all_move - diff)//2 def mod_cmb(n, r, mod): # nCr mod p g1...
39
36
673
701
import math mod = 10**9 + 7 x, y = list(map(int, input().split())) if (x + y) % 3 != 0: print((0)) exit() if x == 0 or y == 0: print((0)) exit() X = max(x, y) Y = min(x, y) all_move = (X + Y) // 3 diff = X - Y y_move = (all_move - diff) // 2 def cmb(n, r, mod): if r < 0 or r > n: return 0...
import math MOD = 10**9 + 7 #  素数 x, y = list(map(int, input().split())) if (x + y) % 3 != 0: print((0)) exit() if x == 0 or y == 0: print((0)) exit() X = max(x, y) Y = min(x, y) all_move = (X + Y) // 3 diff = X - Y Y_move = (all_move - diff) // 2 def mod_cmb(n, r, mod): # nCr mod p g1 = [1, 1]...
false
7.692308
[ "-mod = 10**9 + 7", "+MOD = 10**9 + 7 #  素数", "-y_move = (all_move - diff) // 2", "+Y_move = (all_move - diff) // 2", "-def cmb(n, r, mod):", "+def mod_cmb(n, r, mod): # nCr mod p", "+ g1 = [1, 1]", "+ g2 = [1, 1]", "+ inverse = [0, 1]", "+ for i in range(2, n + 1):", "+ g1....
false
0.394563
0.601758
0.655683
[ "s910430714", "s749000698" ]
u562935282
p03221
python
s594096113
s253146570
888
506
82,844
30,604
Accepted
Accepted
43.02
# http://drken1215.hatenablog.com/entry/2019/03/21/234900 # 写経 from bisect import bisect_left n, m = list(map(int, input().split())) PY = [] e = [[] for _ in range(n + 1)] for _ in range(m): _p, _y = list(map(int, input().split())) e[_p].append(_y) PY.append((_p, _y)) for idx in range(n + 1)...
# http://drken1215.hatenablog.com/entry/2019/03/21/234900 # 写経 def main(): from bisect import bisect_left import sys input = sys.stdin.readline n, m = list(map(int, input().split())) PY = [] e = [[] for _ in range(n + 1)] for _ in range(m): _p, _y = list(map(int, inpu...
19
27
446
605
# http://drken1215.hatenablog.com/entry/2019/03/21/234900 # 写経 from bisect import bisect_left n, m = list(map(int, input().split())) PY = [] e = [[] for _ in range(n + 1)] for _ in range(m): _p, _y = list(map(int, input().split())) e[_p].append(_y) PY.append((_p, _y)) for idx in range(n + 1): e[idx] = ...
# http://drken1215.hatenablog.com/entry/2019/03/21/234900 # 写経 def main(): from bisect import bisect_left import sys input = sys.stdin.readline n, m = list(map(int, input().split())) PY = [] e = [[] for _ in range(n + 1)] for _ in range(m): _p, _y = list(map(int, input().split())) ...
false
29.62963
[ "-from bisect import bisect_left", "+def main():", "+ from bisect import bisect_left", "+ import sys", "-n, m = list(map(int, input().split()))", "-PY = []", "-e = [[] for _ in range(n + 1)]", "-for _ in range(m):", "- _p, _y = list(map(int, input().split()))", "- e[_p].append(_y)", ...
false
0.078468
0.081095
0.96761
[ "s594096113", "s253146570" ]
u166621202
p03470
python
s305321599
s630268395
19
17
2,940
2,940
Accepted
Accepted
10.53
cnt = int(eval(input())) set1 = set([int(eval(input())) for i in range(cnt)]) print((len(set1)))
N = int(eval(input())) d = [int(eval(input())) for i in range(N)] dd = list(set(d)) print((len(dd)))
3
5
84
92
cnt = int(eval(input())) set1 = set([int(eval(input())) for i in range(cnt)]) print((len(set1)))
N = int(eval(input())) d = [int(eval(input())) for i in range(N)] dd = list(set(d)) print((len(dd)))
false
40
[ "-cnt = int(eval(input()))", "-set1 = set([int(eval(input())) for i in range(cnt)])", "-print((len(set1)))", "+N = int(eval(input()))", "+d = [int(eval(input())) for i in range(N)]", "+dd = list(set(d))", "+print((len(dd)))" ]
false
0.047329
0.047847
0.989174
[ "s305321599", "s630268395" ]
u062147869
p03319
python
s309801269
s778292094
49
44
13,812
13,812
Accepted
Accepted
10.2
import sys import math N,K=list(map(int,input().split())) A=[int(i) for i in input().split()] a=0 for i in range(N): if A[i]==1: a=i break if a <=K-1: print((math.ceil((N-K)/(K-1))+1)) sys.exit() if N-K<=a: print((math.ceil((N-K)/(K-1))+1)) sys.exit() print((math.ceil(...
import math N,K=list(map(int,input().split())) A=[int(i) for i in input().split()] print((math.ceil((N-K)/(K-1))+1))
16
4
324
111
import sys import math N, K = list(map(int, input().split())) A = [int(i) for i in input().split()] a = 0 for i in range(N): if A[i] == 1: a = i break if a <= K - 1: print((math.ceil((N - K) / (K - 1)) + 1)) sys.exit() if N - K <= a: print((math.ceil((N - K) / (K - 1)) + 1)) sys.exi...
import math N, K = list(map(int, input().split())) A = [int(i) for i in input().split()] print((math.ceil((N - K) / (K - 1)) + 1))
false
75
[ "-import sys", "-a = 0", "-for i in range(N):", "- if A[i] == 1:", "- a = i", "- break", "-if a <= K - 1:", "- print((math.ceil((N - K) / (K - 1)) + 1))", "- sys.exit()", "-if N - K <= a:", "- print((math.ceil((N - K) / (K - 1)) + 1))", "- sys.exit()" ]
false
0.048431
0.048959
0.989226
[ "s309801269", "s778292094" ]
u780475861
p02802
python
s033647857
s188369224
268
118
4,596
4,596
Accepted
Accepted
55.97
n, m = list(map(int, input().split())) ac_lst = [False] * (n + 1) wa_lst = [0] * (n + 1) w = 0 for _ in range(m): a, b = input().split() a = int(a) if ac_lst[a]: continue if b == 'WA': wa_lst[a] += 1 else: w += wa_lst[a] ac_lst[a] = True print((sum(ac_ls...
import sys readline = sys.stdin.buffer.readline n, m = list(map(int, readline().split())) ac_lst = [False] * (n + 1) wa_lst = [0] * (n + 1) w = 0 for _ in range(m): a, b = readline().split() a = int(a) if ac_lst[a]: continue if b == b'WA': wa_lst[a] += 1 else: ...
15
18
320
379
n, m = list(map(int, input().split())) ac_lst = [False] * (n + 1) wa_lst = [0] * (n + 1) w = 0 for _ in range(m): a, b = input().split() a = int(a) if ac_lst[a]: continue if b == "WA": wa_lst[a] += 1 else: w += wa_lst[a] ac_lst[a] = True print((sum(ac_lst), w))
import sys readline = sys.stdin.buffer.readline n, m = list(map(int, readline().split())) ac_lst = [False] * (n + 1) wa_lst = [0] * (n + 1) w = 0 for _ in range(m): a, b = readline().split() a = int(a) if ac_lst[a]: continue if b == b"WA": wa_lst[a] += 1 else: w += wa_lst[a]...
false
16.666667
[ "-n, m = list(map(int, input().split()))", "+import sys", "+", "+readline = sys.stdin.buffer.readline", "+n, m = list(map(int, readline().split()))", "- a, b = input().split()", "+ a, b = readline().split()", "- if b == \"WA\":", "+ if b == b\"WA\":" ]
false
0.044718
0.038771
1.153386
[ "s033647857", "s188369224" ]
u905203728
p03599
python
s076706064
s950695596
217
67
41,840
70,108
Accepted
Accepted
69.12
a,b,c,d,e,f=list(map(int,input().split())) ans,index=0,[a*100,0] base=100*e/(100+e) for i in range(31): for j in range(31): for k in range(101): for l in range(101): w=i*100*a+j*100*b s=c*k+d*l if w==0:continue if w+s>f:...
inf=10**8 a,b,c,d,e,f=list(map(int,input().split())) a,b=100*a,100*b DP=[inf]*(f+max(a,b)+1) DP[a],DP[b]=0,0 for i in range(f+1): if DP[i]!=inf: DP[i+a]=DP[i] DP[i+b]=DP[i] for j in c,d: if 100*(DP[i]+j)/(i+j)<=100*e/(100+e): DP[i+j]=max(DP[i],DP[i]+j...
18
22
476
482
a, b, c, d, e, f = list(map(int, input().split())) ans, index = 0, [a * 100, 0] base = 100 * e / (100 + e) for i in range(31): for j in range(31): for k in range(101): for l in range(101): w = i * 100 * a + j * 100 * b s = c * k + d * l if w == 0: ...
inf = 10**8 a, b, c, d, e, f = list(map(int, input().split())) a, b = 100 * a, 100 * b DP = [inf] * (f + max(a, b) + 1) DP[a], DP[b] = 0, 0 for i in range(f + 1): if DP[i] != inf: DP[i + a] = DP[i] DP[i + b] = DP[i] for j in c, d: if 100 * (DP[i] + j) / (i + j) <= 100 * e / (100 ...
false
18.181818
[ "+inf = 10**8", "-ans, index = 0, [a * 100, 0]", "-base = 100 * e / (100 + e)", "-for i in range(31):", "- for j in range(31):", "- for k in range(101):", "- for l in range(101):", "- w = i * 100 * a + j * 100 * b", "- s = c * k + d * l", "- ...
false
0.16466
0.038247
4.305122
[ "s076706064", "s950695596" ]
u043048943
p02659
python
s953286249
s482373151
92
71
71,284
65,504
Accepted
Accepted
22.83
def main(): from sys import setrecursionlimit, stdin from os import environ from collections import defaultdict, deque, Counter from math import ceil, floor, gcd from itertools import accumulate, combinations, combinations_with_replacement setrecursionlimit(10**6) dbg = (lambda *somet...
def main(): from sys import setrecursionlimit, stdin from os import environ from collections import defaultdict, deque, Counter from math import ceil, floor, gcd from itertools import accumulate, combinations, combinations_with_replacement setrecursionlimit(10**6) dbg = (lambda *somet...
22
27
802
880
def main(): from sys import setrecursionlimit, stdin from os import environ from collections import defaultdict, deque, Counter from math import ceil, floor, gcd from itertools import accumulate, combinations, combinations_with_replacement setrecursionlimit(10**6) dbg = ( (lambda *s...
def main(): from sys import setrecursionlimit, stdin from os import environ from collections import defaultdict, deque, Counter from math import ceil, floor, gcd from itertools import accumulate, combinations, combinations_with_replacement setrecursionlimit(10**6) dbg = ( (lambda *s...
false
18.518519
[ "- from decimal import Decimal", "-", "- a, b = map(Decimal, input().split())", "- print(int(a * b))", "+ sa, sb = input().split()", "+ a = int(sa)", "+ sb = sb.split(\".\")", "+ b100 = int(sb[0]) * 100", "+ if len(sb) == 2:", "+ b100 += int(sb[1])", "+ print(a ...
false
0.040039
0.053413
0.749619
[ "s953286249", "s482373151" ]
u540698208
p03835
python
s383262906
s452855714
1,796
1,605
2,940
3,064
Accepted
Accepted
10.63
K, S = list(map(int, input().split())) ANS = 0 for x in range(K + 1): for y in range(K + 1): z = S - x - y if (0 <= z) and z <= K: ANS += 1 print(ANS)
K, S = (int(x) for x in input().split()) ans = 0 for X in range(0, K+1): for Y in range(0, K+1): Z = S - (X + Y) if 0 <= Z <= K: ans += 1 print(ans)
11
10
189
191
K, S = list(map(int, input().split())) ANS = 0 for x in range(K + 1): for y in range(K + 1): z = S - x - y if (0 <= z) and z <= K: ANS += 1 print(ANS)
K, S = (int(x) for x in input().split()) ans = 0 for X in range(0, K + 1): for Y in range(0, K + 1): Z = S - (X + Y) if 0 <= Z <= K: ans += 1 print(ans)
false
9.090909
[ "-K, S = list(map(int, input().split()))", "-ANS = 0", "-for x in range(K + 1):", "- for y in range(K + 1):", "- z = S - x - y", "- if (0 <= z) and z <= K:", "- ANS += 1", "-print(ANS)", "+K, S = (int(x) for x in input().split())", "+ans = 0", "+for X in range(0, K + ...
false
0.039555
0.044005
0.898876
[ "s383262906", "s452855714" ]
u618101737
p02684
python
s877930898
s850306737
142
115
123,544
112,552
Accepted
Accepted
19.01
def solve(): hm = {} steps = k curr = 0 loopsize = 0 pre = 0 while not str(curr) in hm and steps > 0: hm[str(curr)] = pre pre+=1 curr = a[curr] - 1 steps -= 1 loopsize += 1 if str(curr) in hm: loopsize -= hm[str(curr)] ste...
import sys if sys.subversion[0] == "PyPy": import io, atexit sys.stdout = io.BytesIO() atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue())) sys.stdin = io.BytesIO(sys.stdin.read()) input = lambda: sys.stdin.readline().rstrip() RS = raw_input RA = lambda x=int: list(map(...
28
44
540
801
def solve(): hm = {} steps = k curr = 0 loopsize = 0 pre = 0 while not str(curr) in hm and steps > 0: hm[str(curr)] = pre pre += 1 curr = a[curr] - 1 steps -= 1 loopsize += 1 if str(curr) in hm: loopsize -= hm[str(curr)] steps %= loopsize ...
import sys if sys.subversion[0] == "PyPy": import io, atexit sys.stdout = io.BytesIO() atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue())) sys.stdin = io.BytesIO(sys.stdin.read()) input = lambda: sys.stdin.readline().rstrip() RS = raw_input RA = lambda x=int: list(map(x, RS().spli...
false
36.363636
[ "+import sys", "+", "+if sys.subversion[0] == \"PyPy\":", "+ import io, atexit", "+", "+ sys.stdout = io.BytesIO()", "+ atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))", "+ sys.stdin = io.BytesIO(sys.stdin.read())", "+ input = lambda: sys.stdin.readline().rstrip()...
false
0.044777
0.045198
0.990679
[ "s877930898", "s850306737" ]
u731368968
p03062
python
s261800679
s915919978
110
61
14,412
14,208
Accepted
Accepted
44.55
n = int(eval(input())) a = list(map(int, input().split())) neg = 0 mini = 1000000000000000000000000000 s = 0 for i in range(n): if a[i] < 0: neg += 1 mini = min(mini, abs(a[i])) s += abs(a[i]) print((s if neg % 2 == 0 else s - mini*2))
# n = int(input()) n=eval(input()) a=list(map(int,input().split())) # neg = 0 # mini = 1000000000000000000000000000 # s = 0 # for i in range(n): # if a[i] < 0: neg += 1 # mini = min(mini, abs(a[i])) # s += abs(a[i]) # print(s if neg % 2 == 0 else s - mini*2) # print(sum(abs(x for x in a))-2*min...
10
15
248
466
n = int(eval(input())) a = list(map(int, input().split())) neg = 0 mini = 1000000000000000000000000000 s = 0 for i in range(n): if a[i] < 0: neg += 1 mini = min(mini, abs(a[i])) s += abs(a[i]) print((s if neg % 2 == 0 else s - mini * 2))
# n = int(input()) n = eval(input()) a = list(map(int, input().split())) # neg = 0 # mini = 1000000000000000000000000000 # s = 0 # for i in range(n): # if a[i] < 0: neg += 1 # mini = min(mini, abs(a[i])) # s += abs(a[i]) # print(s if neg % 2 == 0 else s - mini*2) # print(sum(abs(x for x in a))-2*min(abs(x f...
false
33.333333
[ "-n = int(eval(input()))", "+# n = int(input())", "+n = eval(input())", "-neg = 0", "-mini = 1000000000000000000000000000", "-s = 0", "-for i in range(n):", "- if a[i] < 0:", "- neg += 1", "- mini = min(mini, abs(a[i]))", "- s += abs(a[i])", "-print((s if neg % 2 == 0 else s - ...
false
0.077458
0.038338
2.020392
[ "s261800679", "s915919978" ]
u375616706
p03163
python
s111776484
s621020240
504
382
120,172
41,708
Accepted
Accepted
24.21
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, W = list(map(int, input().split())) items = [list(map(int, input().split())) for _ in range(N)] dp = [[0]*(W+1) for _ in range(N)] # init first_item = items[0] for i in range(W+1): if i >= first_item[0...
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, W = list(map(int, input().split())) items = [list(map(int, input().split())) for _ in range(N)] def solve(): dp = [[0]*(W+1) for _ in range(N+1)] # init # update for i in range(1, N+1):...
24
35
593
822
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, W = list(map(int, input().split())) items = [list(map(int, input().split())) for _ in range(N)] dp = [[0] * (W + 1) for _ in range(N)] # init first_item = items[0] for i in range(W + 1): if i >= first_item[0]: ...
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N, W = list(map(int, input().split())) items = [list(map(int, input().split())) for _ in range(N)] def solve(): dp = [[0] * (W + 1) for _ in range(N + 1)] # init # update for i in range(1, N + 1): ...
false
31.428571
[ "-dp = [[0] * (W + 1) for _ in range(N)]", "-# init", "-first_item = items[0]", "-for i in range(W + 1):", "- if i >= first_item[0]:", "- dp[0][i] = first_item[1]", "-# update", "-for i in range(1, N):", "- for w in range(W + 1):", "- if w - items[i][0] >= 0:", "- ...
false
0.046427
0.048189
0.963447
[ "s111776484", "s621020240" ]
u588794534
p02726
python
s148178237
s194316151
297
252
46,556
76,640
Accepted
Accepted
15.15
n,x,y=list(map(int,input().split())) result={} for i in range(1,n): result[i]=0 for i in range(1,n): for j in range(i+1,n+1): #print(i,j) if j-i==1: result[1]+=1 else: temp=min(j-i,abs(x-i)+1+abs(j-y)) result[temp]+=1 for i in range(1,n...
n,x,y=list(map(int,input().split())) ans=[0]*n tree=[[] for _ in range(n)] for i in range(1,n): tree[i-1].append(i) tree[i].append(i-1) tree[x-1].append(y-1) tree[y-1].append(x-1) from collections import deque ans=[0]*n for i in range(n): checked=[-1]*n stack=deque([i]) chec...
17
34
341
624
n, x, y = list(map(int, input().split())) result = {} for i in range(1, n): result[i] = 0 for i in range(1, n): for j in range(i + 1, n + 1): # print(i,j) if j - i == 1: result[1] += 1 else: temp = min(j - i, abs(x - i) + 1 + abs(j - y)) result[temp] +...
n, x, y = list(map(int, input().split())) ans = [0] * n tree = [[] for _ in range(n)] for i in range(1, n): tree[i - 1].append(i) tree[i].append(i - 1) tree[x - 1].append(y - 1) tree[y - 1].append(x - 1) from collections import deque ans = [0] * n for i in range(n): checked = [-1] * n stack = deque([i]...
false
50
[ "-result = {}", "+ans = [0] * n", "+tree = [[] for _ in range(n)]", "- result[i] = 0", "-for i in range(1, n):", "- for j in range(i + 1, n + 1):", "- # print(i,j)", "- if j - i == 1:", "- result[1] += 1", "- else:", "- temp = min(j - i, abs(x - i...
false
0.044175
0.043018
1.026892
[ "s148178237", "s194316151" ]
u919633157
p03634
python
s338603413
s516649001
1,548
762
46,680
46,656
Accepted
Accepted
50.78
# 2019/07/11 from heapq import heappop,heappush n=int(eval(input())) edge=[[] for _ in range(n)] for _ in range(n-1): u,v,c=list(map(int,input().split())) u-=1 v-=1 edge[u].append((c,v)) edge[v].append((c,u)) def dijkstra(s): d=[float('inf')]*n visited=[False]*n d[s]...
# 2019/07/11 import sys from heapq import heappop,heappush input=sys.stdin.readline n=int(eval(input())) edge=[[] for _ in range(n)] for _ in range(n-1): u,v,c=list(map(int,input().split())) u-=1 v-=1 edge[u].append((c,v)) edge[v].append((c,u)) def dijkstra(s): d=[float('i...
44
47
816
856
# 2019/07/11 from heapq import heappop, heappush n = int(eval(input())) edge = [[] for _ in range(n)] for _ in range(n - 1): u, v, c = list(map(int, input().split())) u -= 1 v -= 1 edge[u].append((c, v)) edge[v].append((c, u)) def dijkstra(s): d = [float("inf")] * n visited = [False] * n ...
# 2019/07/11 import sys from heapq import heappop, heappush input = sys.stdin.readline n = int(eval(input())) edge = [[] for _ in range(n)] for _ in range(n - 1): u, v, c = list(map(int, input().split())) u -= 1 v -= 1 edge[u].append((c, v)) edge[v].append((c, u)) def dijkstra(s): d = [float(...
false
6.382979
[ "+import sys", "+input = sys.stdin.readline" ]
false
0.03954
0.037244
1.061658
[ "s338603413", "s516649001" ]
u268318377
p02642
python
s715202877
s509772906
1,349
524
112,512
127,612
Accepted
Accepted
61.16
import sys readline = sys.stdin.readline import numpy as np from collections import Counter from numba import njit N = int(eval(input())) A = np.array(readline().split(), np.int32) count = np.zeros((A.max() + 1)) for a in A: if count[a] > 1: continue count[::a] += 1 ret = 0 fo...
import sys readline = sys.stdin.readline import numpy as np from numba import njit @njit('i8(i4[::1],)', cache=True) def f(A): count = np.zeros((A.max() + 1)) for a in A: if count[a] > 1: continue count[::a] += 1 ret = 0 for a in A: ret += count[a...
24
25
363
423
import sys readline = sys.stdin.readline import numpy as np from collections import Counter from numba import njit N = int(eval(input())) A = np.array(readline().split(), np.int32) count = np.zeros((A.max() + 1)) for a in A: if count[a] > 1: continue count[::a] += 1 ret = 0 for a in A: ret += coun...
import sys readline = sys.stdin.readline import numpy as np from numba import njit @njit("i8(i4[::1],)", cache=True) def f(A): count = np.zeros((A.max() + 1)) for a in A: if count[a] > 1: continue count[::a] += 1 ret = 0 for a in A: ret += count[a] == 1 return ...
false
4
[ "-from collections import Counter", "+", "+", "+@njit(\"i8(i4[::1],)\", cache=True)", "+def f(A):", "+ count = np.zeros((A.max() + 1))", "+ for a in A:", "+ if count[a] > 1:", "+ continue", "+ count[::a] += 1", "+ ret = 0", "+ for a in A:", "+ ret ...
false
0.545047
1.011362
0.538924
[ "s715202877", "s509772906" ]
u917432951
p02271
python
s782352652
s613807541
4,200
300
13,276
19,792
Accepted
Accepted
92.86
from functools import lru_cache @lru_cache(maxsize = 10000) def canProd(i,m): if m == 0: return True if i >= n: return False res = canProd(i+1,m) or canProd(i+1,m-a[i]) return res n = int(eval(input())) a = [int(x) for x in input().split()] q = int(eval(input...
from functools import lru_cache @lru_cache(maxsize = None) def canProd(i,m): if m == 0: return True if i >= n: return False res = canProd(i+1,m) or canProd(i+1,m-a[i]) return res n = int(eval(input())) a = [int(x) for x in input().split()] q = int(eval(input(...
24
32
443
545
from functools import lru_cache @lru_cache(maxsize=10000) def canProd(i, m): if m == 0: return True if i >= n: return False res = canProd(i + 1, m) or canProd(i + 1, m - a[i]) return res n = int(eval(input())) a = [int(x) for x in input().split()] q = int(eval(input())) m = [int(x) f...
from functools import lru_cache @lru_cache(maxsize=None) def canProd(i, m): if m == 0: return True if i >= n: return False res = canProd(i + 1, m) or canProd(i + 1, m - a[i]) return res n = int(eval(input())) a = [int(x) for x in input().split()] q = int(eval(input())) m = [int(x) fo...
false
25
[ "-@lru_cache(maxsize=10000)", "+@lru_cache(maxsize=None)", "+rs = [None] * 2001", "+maxm = max(m)", "+minm = min(m)", "+for i in range(minm, maxm + 1):", "+ if canProd(0, i):", "+ rs[i] = \"yes\"", "+ else:", "+ rs[i] = \"no\"", "- if canProd(0, i):", "- print(\"y...
false
0.042164
0.037372
1.128226
[ "s782352652", "s613807541" ]
u475503988
p03111
python
s070319131
s334891465
72
61
3,064
3,064
Accepted
Accepted
15.28
N, A, B, C = list(map(int, input().split())) l = [int(eval(input())) for i in range(N)] INF = 10 ** 9 def dfs(cur, a, b, c): if cur == N: return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF ret0 = dfs(cur + 1, a, b, c) ret1 = dfs(cur + 1, a + l[cur], b, c) + 10 ...
N, A, B, C = list(map(int, input().split())) l = [int(eval(input())) for _ in range(N)] def dfs(cur, a, b, c): if cur == N: return abs(a-A) + abs(b-B) + abs(c-C) - 30 if a * b * c != 0 else 10 ** 9 else: ret0 = dfs(cur + 1, a, b, c) reta = dfs(cur + 1, a + l[cur], b, c) + 10 ...
12
12
462
471
N, A, B, C = list(map(int, input().split())) l = [int(eval(input())) for i in range(N)] INF = 10**9 def dfs(cur, a, b, c): if cur == N: return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF ret0 = dfs(cur + 1, a, b, c) ret1 = dfs(cur + 1, a + l[cur], b, c) + 10 ret2 = d...
N, A, B, C = list(map(int, input().split())) l = [int(eval(input())) for _ in range(N)] def dfs(cur, a, b, c): if cur == N: return abs(a - A) + abs(b - B) + abs(c - C) - 30 if a * b * c != 0 else 10**9 else: ret0 = dfs(cur + 1, a, b, c) reta = dfs(cur + 1, a + l[cur], b, c) + 10 ...
false
0
[ "-l = [int(eval(input())) for i in range(N)]", "-INF = 10**9", "+l = [int(eval(input())) for _ in range(N)]", "- return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF", "- ret0 = dfs(cur + 1, a, b, c)", "- ret1 = dfs(cur + 1, a + l[cur], b, c) + 10", "- ret2 = dfs...
false
0.065006
0.054796
1.186322
[ "s070319131", "s334891465" ]
u549383771
p02726
python
s647928115
s179787564
1,838
1,360
3,444
3,444
Accepted
Accepted
26.01
n,x,y = list(map(int,input().split())) ans = [0]*n for i in range(1,n+1): for j in range(i+1,n+1): ans[min(abs(i-j) , abs(i-x)+1+abs(j-y), abs(i-y)+1+abs(j-x)) ]+=1 for i in range(1,n): print((ans[i]))
n,x,y = list(map(int,input().split())) ans = [0]*n for i in range(1,n+1): for j in range(i+1,n+1): ans[min(abs(i-j) , abs(i-x)+1+abs(j-y)) ]+=1 for i in range(1,n): print((ans[i]))
8
8
225
204
n, x, y = list(map(int, input().split())) ans = [0] * n for i in range(1, n + 1): for j in range(i + 1, n + 1): ans[ min(abs(i - j), abs(i - x) + 1 + abs(j - y), abs(i - y) + 1 + abs(j - x)) ] += 1 for i in range(1, n): print((ans[i]))
n, x, y = list(map(int, input().split())) ans = [0] * n for i in range(1, n + 1): for j in range(i + 1, n + 1): ans[min(abs(i - j), abs(i - x) + 1 + abs(j - y))] += 1 for i in range(1, n): print((ans[i]))
false
0
[ "- ans[", "- min(abs(i - j), abs(i - x) + 1 + abs(j - y), abs(i - y) + 1 + abs(j - x))", "- ] += 1", "+ ans[min(abs(i - j), abs(i - x) + 1 + abs(j - y))] += 1" ]
false
0.008286
0.169543
0.048873
[ "s647928115", "s179787564" ]
u272028993
p03817
python
s296179727
s940359537
17
11
2,692
2,568
Accepted
Accepted
35.29
x=int(input()) if x<=6: print((1)) else: x-=6 if x%11>5: print((x/11*2+2+1)) else: if x%11==0: print((x/11*2+1)) else: print((x/11*2+1+1))
x=int(input()) ans=0 ans+=2*(x/11) x-=11*(x/11) ans+=x/6 x-=6*(x/6) if x==0: print(ans) else: print(ans+1)
12
10
209
126
x = int(input()) if x <= 6: print((1)) else: x -= 6 if x % 11 > 5: print((x / 11 * 2 + 2 + 1)) else: if x % 11 == 0: print((x / 11 * 2 + 1)) else: print((x / 11 * 2 + 1 + 1))
x = int(input()) ans = 0 ans += 2 * (x / 11) x -= 11 * (x / 11) ans += x / 6 x -= 6 * (x / 6) if x == 0: print(ans) else: print(ans + 1)
false
16.666667
[ "-if x <= 6:", "- print((1))", "+ans = 0", "+ans += 2 * (x / 11)", "+x -= 11 * (x / 11)", "+ans += x / 6", "+x -= 6 * (x / 6)", "+if x == 0:", "+ print(ans)", "- x -= 6", "- if x % 11 > 5:", "- print((x / 11 * 2 + 2 + 1))", "- else:", "- if x % 11 == 0:", "- ...
false
0.121795
0.076899
1.583834
[ "s296179727", "s940359537" ]
u753803401
p03221
python
s695369584
s280405097
1,231
961
82,132
66,780
Accepted
Accepted
21.93
n, m = list(map(int, input().split())) py = [list(map(int, (eval(input()) + " 0 " + str(i)).split())) for i in range(m)] py = sorted(py, key=lambda x: (x[0], x[1])) d = {} for i, v in enumerate(py): if v[0] not in d: d[v[0]] = 1 else: d[v[0]] += 1 v[2] = d[v[0]] py = sorted(py, key...
def slove(): import sys input = sys.stdin.readline n, m = list(map(int, input().rstrip('\n').split())) py = [] ls = [1] * (n + 1) for i in range(m): p, y = list(map(int, input().rstrip('\n').split())) py.append([p, y, 0, i]) py.sort() for i in range(m): ...
13
26
409
671
n, m = list(map(int, input().split())) py = [list(map(int, (eval(input()) + " 0 " + str(i)).split())) for i in range(m)] py = sorted(py, key=lambda x: (x[0], x[1])) d = {} for i, v in enumerate(py): if v[0] not in d: d[v[0]] = 1 else: d[v[0]] += 1 v[2] = d[v[0]] py = sorted(py, key=lambda x:...
def slove(): import sys input = sys.stdin.readline n, m = list(map(int, input().rstrip("\n").split())) py = [] ls = [1] * (n + 1) for i in range(m): p, y = list(map(int, input().rstrip("\n").split())) py.append([p, y, 0, i]) py.sort() for i in range(m): py[i][2] ...
false
50
[ "-n, m = list(map(int, input().split()))", "-py = [list(map(int, (eval(input()) + \" 0 \" + str(i)).split())) for i in range(m)]", "-py = sorted(py, key=lambda x: (x[0], x[1]))", "-d = {}", "-for i, v in enumerate(py):", "- if v[0] not in d:", "- d[v[0]] = 1", "- else:", "- d[v[0...
false
0.044762
0.044992
0.99489
[ "s695369584", "s280405097" ]
u099022530
p02659
python
s645959648
s665648403
23
21
9,056
9,060
Accepted
Accepted
8.7
a, b = list(map(float,input().split())) b = b * 1000 b = int(b) c = int(a)*b//1000 print(c)
a, b = list(map(float,input().split())) b = b * 100 + 0.1 b = int(b) c = int(a)*b//100 print(c)
5
5
90
94
a, b = list(map(float, input().split())) b = b * 1000 b = int(b) c = int(a) * b // 1000 print(c)
a, b = list(map(float, input().split())) b = b * 100 + 0.1 b = int(b) c = int(a) * b // 100 print(c)
false
0
[ "-b = b * 1000", "+b = b * 100 + 0.1", "-c = int(a) * b // 1000", "+c = int(a) * b // 100" ]
false
0.047353
0.046927
1.009084
[ "s645959648", "s665648403" ]
u057109575
p02793
python
s982686056
s802044385
1,577
698
76,220
75,988
Accepted
Accepted
55.74
from math import gcd from functools import reduce MOD = 10 ** 9 + 7 def calc_lcm(x, y): return x * y // gcd(x, y) def calc_lcm_list(numbers): return reduce(calc_lcm, numbers, 1) N, *A = list(map(int, open(0).read().split())) lcm = calc_lcm_list(A) print((sum(lcm // v for v in A) % MOD))
from math import gcd from functools import reduce MOD = 10 ** 9 + 7 def calc_lcm(x, y): return x * y // gcd(x, y) def calc_lcm_list(numbers): return reduce(calc_lcm, numbers, 1) N, *A = list(map(int, open(0).read().split())) lcm = calc_lcm_list(A) print((sum(lcm * pow(v, MOD - 2, MOD) for...
15
15
311
329
from math import gcd from functools import reduce MOD = 10**9 + 7 def calc_lcm(x, y): return x * y // gcd(x, y) def calc_lcm_list(numbers): return reduce(calc_lcm, numbers, 1) N, *A = list(map(int, open(0).read().split())) lcm = calc_lcm_list(A) print((sum(lcm // v for v in A) % MOD))
from math import gcd from functools import reduce MOD = 10**9 + 7 def calc_lcm(x, y): return x * y // gcd(x, y) def calc_lcm_list(numbers): return reduce(calc_lcm, numbers, 1) N, *A = list(map(int, open(0).read().split())) lcm = calc_lcm_list(A) print((sum(lcm * pow(v, MOD - 2, MOD) for v in A) % MOD))
false
0
[ "-print((sum(lcm // v for v in A) % MOD))", "+print((sum(lcm * pow(v, MOD - 2, MOD) for v in A) % MOD))" ]
false
0.091667
0.037292
2.4581
[ "s982686056", "s802044385" ]
u188827677
p02683
python
s833276751
s724016725
92
72
9,132
9,228
Accepted
Accepted
21.74
# ビット全探索版 n,m,x = list(map(int, input().split())) c = [list(map(int, input().split())) for _ in range(n)] ans = [] for i in range(2**n): price = 0 und = [0 for _ in range(m)] for j in range(n): if (i >> j) & 1: price += c[j][0] for k in range(m): und[k] += c[j][k+1] if all(...
from itertools import combinations n,m,x = list(map(int, input().split())) ca = [list(map(int, input().split())) for _ in range(n)] ans = 10**9 for i in range(1, n+1): for j in combinations(ca,i): t = [0]*(m+1) for k in j: for l in range(m+1): t[l] += k[l] #if all(t[num] >= x for...
20
19
428
441
# ビット全探索版 n, m, x = list(map(int, input().split())) c = [list(map(int, input().split())) for _ in range(n)] ans = [] for i in range(2**n): price = 0 und = [0 for _ in range(m)] for j in range(n): if (i >> j) & 1: price += c[j][0] for k in range(m): und[k] += c...
from itertools import combinations n, m, x = list(map(int, input().split())) ca = [list(map(int, input().split())) for _ in range(n)] ans = 10**9 for i in range(1, n + 1): for j in combinations(ca, i): t = [0] * (m + 1) for k in j: for l in range(m + 1): t[l] += k[l] ...
false
5
[ "-# ビット全探索版", "+from itertools import combinations", "+", "-c = [list(map(int, input().split())) for _ in range(n)]", "-ans = []", "-for i in range(2**n):", "- price = 0", "- und = [0 for _ in range(m)]", "- for j in range(n):", "- if (i >> j) & 1:", "- price += c[j][0...
false
0.043258
0.071642
0.603806
[ "s833276751", "s724016725" ]
u397531548
p03986
python
s480102954
s903152641
62
51
3,500
3,500
Accepted
Accepted
17.74
S=eval(input()) t=0 u=0 for i in range(len(S)): if S[i]=="S": t+=1 else: if t>=1: u+=2 t-=1 print((len(S)-u))
S=eval(input()) t=0 u=0 for v in S: if v=="S": t+=1 else: if t>=1: u+=2 t-=1 print((len(S)-u))
11
11
159
144
S = eval(input()) t = 0 u = 0 for i in range(len(S)): if S[i] == "S": t += 1 else: if t >= 1: u += 2 t -= 1 print((len(S) - u))
S = eval(input()) t = 0 u = 0 for v in S: if v == "S": t += 1 else: if t >= 1: u += 2 t -= 1 print((len(S) - u))
false
0
[ "-for i in range(len(S)):", "- if S[i] == \"S\":", "+for v in S:", "+ if v == \"S\":" ]
false
0.047954
0.145863
0.328762
[ "s480102954", "s903152641" ]
u021019433
p02918
python
s011088397
s998930225
62
33
15,860
3,316
Accepted
Accepted
46.77
from itertools import groupby n, k = list(map(int, input().split())) print((n - max(1, len(list(groupby(eval(input())))) - 2 * k)))
from itertools import groupby n, k = list(map(int, input().split())) print((n - max(1, sum(map(bool, groupby(eval(input())))) - 2 * k)))
4
4
122
127
from itertools import groupby n, k = list(map(int, input().split())) print((n - max(1, len(list(groupby(eval(input())))) - 2 * k)))
from itertools import groupby n, k = list(map(int, input().split())) print((n - max(1, sum(map(bool, groupby(eval(input())))) - 2 * k)))
false
0
[ "-print((n - max(1, len(list(groupby(eval(input())))) - 2 * k)))", "+print((n - max(1, sum(map(bool, groupby(eval(input())))) - 2 * k)))" ]
false
0.104987
0.070515
1.488871
[ "s011088397", "s998930225" ]
u813098295
p03544
python
s685840905
s001696209
11
10
2,568
2,568
Accepted
Accepted
9.09
# coding: utf-8 N = int(input()) L = [2, 1] for i in range(90): L += [L[-2] + L[-1]] print(L[N])
# coding: utf-8 def Lucas(n): a, b, c = 2, 1, 3 while n != 0: a, b, c = b, c, b+c n -=1 print(a) Lucas(int(input()))
9
11
115
165
# coding: utf-8 N = int(input()) L = [2, 1] for i in range(90): L += [L[-2] + L[-1]] print(L[N])
# coding: utf-8 def Lucas(n): a, b, c = 2, 1, 3 while n != 0: a, b, c = b, c, b + c n -= 1 print(a) Lucas(int(input()))
false
18.181818
[ "-N = int(input())", "-L = [2, 1]", "-for i in range(90):", "- L += [L[-2] + L[-1]]", "-print(L[N])", "+def Lucas(n):", "+ a, b, c = 2, 1, 3", "+ while n != 0:", "+ a, b, c = b, c, b + c", "+ n -= 1", "+ print(a)", "+", "+", "+Lucas(int(input()))" ]
false
0.040034
0.040582
0.986504
[ "s685840905", "s001696209" ]
u497952650
p03013
python
s474660806
s969750025
427
180
460,788
7,668
Accepted
Accepted
57.85
N,M = list(map(int,input().split())) a = [1]*N for i in range(M): a[int(eval(input()))-1] = 0 mod = int(1e9+7) dp = [0]*N if N == 1: print((1)) exit() if a[0] and a[1]: dp[0] = 1 dp[1] = 2 elif not a[0] and a[1]: dp[1] = 1 for i in range(2,N): if a[i]: dp[i]...
N,M = list(map(int,input().split())) step = [0]*N for i in range(M): a = int(eval(input())) step[a-1] = 1 mod = int(1e9+7) dp = [0]*N if N == 1: if step[0]: print((0)) else: print((1)) exit() if not step[0] and not step[1]: dp[0] = 1 dp[1] = 2 elif...
26
39
378
586
N, M = list(map(int, input().split())) a = [1] * N for i in range(M): a[int(eval(input())) - 1] = 0 mod = int(1e9 + 7) dp = [0] * N if N == 1: print((1)) exit() if a[0] and a[1]: dp[0] = 1 dp[1] = 2 elif not a[0] and a[1]: dp[1] = 1 for i in range(2, N): if a[i]: dp[i] = dp[i - 1] + ...
N, M = list(map(int, input().split())) step = [0] * N for i in range(M): a = int(eval(input())) step[a - 1] = 1 mod = int(1e9 + 7) dp = [0] * N if N == 1: if step[0]: print((0)) else: print((1)) exit() if not step[0] and not step[1]: dp[0] = 1 dp[1] = 2 elif step[0] and not s...
false
33.333333
[ "-a = [1] * N", "+step = [0] * N", "- a[int(eval(input())) - 1] = 0", "+ a = int(eval(input()))", "+ step[a - 1] = 1", "- print((1))", "+ if step[0]:", "+ print((0))", "+ else:", "+ print((1))", "-if a[0] and a[1]:", "+if not step[0] and not step[1]:", "-elif ...
false
0.042855
0.039205
1.093095
[ "s474660806", "s969750025" ]
u426764965
p02899
python
s596750400
s536874018
107
79
13,880
17,760
Accepted
Accepted
26.17
def q_C(N, arrA): res = [0] * N for i in range(N): res[arrA[i] - 1] = i + 1 print((*res)) N = int(eval(input())) arrA = [int(x) for x in input().split()] q_C(N, arrA)
# C - Go to School N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N for i in range(N): ans[A[i]-1] = i+1 print((' '.join(map(str, ans))))
9
8
173
165
def q_C(N, arrA): res = [0] * N for i in range(N): res[arrA[i] - 1] = i + 1 print((*res)) N = int(eval(input())) arrA = [int(x) for x in input().split()] q_C(N, arrA)
# C - Go to School N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N for i in range(N): ans[A[i] - 1] = i + 1 print((" ".join(map(str, ans))))
false
11.111111
[ "-def q_C(N, arrA):", "- res = [0] * N", "- for i in range(N):", "- res[arrA[i] - 1] = i + 1", "- print((*res))", "-", "-", "+# C - Go to School", "-arrA = [int(x) for x in input().split()]", "-q_C(N, arrA)", "+A = list(map(int, input().split()))", "+ans = [0] * N", "+for i i...
false
0.042952
0.03715
1.156166
[ "s596750400", "s536874018" ]
u546338822
p02984
python
s898519525
s111142237
130
112
22,072
24,856
Accepted
Accepted
13.85
def main(): n = int(eval(input())) a = list(map(int,input().split())) s = 0 for i in range(n-1): s += (-1)**(i+1)*a[i] x = (a[n-1]-s)//2 ans = [x] for i in range(n-1): ans.append(a[i]-ans[i]) print((' '.join(list(map(str,list([2*x for x in ans])))))) if __n...
def main(): n = int(eval(input())) a = list(map(int,input().split())) x = 0 for i in range(n): x = x + a[i]*(-1)**i ans = [x//2] for i in range(n-2): ans.append(a[i]-ans[-1]) ans.append(a[n-1]-ans[0]) for i in range(n): ans[i] = ans[i]*2 print((' '...
15
16
347
383
def main(): n = int(eval(input())) a = list(map(int, input().split())) s = 0 for i in range(n - 1): s += (-1) ** (i + 1) * a[i] x = (a[n - 1] - s) // 2 ans = [x] for i in range(n - 1): ans.append(a[i] - ans[i]) print((" ".join(list(map(str, list([2 * x for x in ans]))))))...
def main(): n = int(eval(input())) a = list(map(int, input().split())) x = 0 for i in range(n): x = x + a[i] * (-1) ** i ans = [x // 2] for i in range(n - 2): ans.append(a[i] - ans[-1]) ans.append(a[n - 1] - ans[0]) for i in range(n): ans[i] = ans[i] * 2 print...
false
6.25
[ "- s = 0", "- for i in range(n - 1):", "- s += (-1) ** (i + 1) * a[i]", "- x = (a[n - 1] - s) // 2", "- ans = [x]", "- for i in range(n - 1):", "- ans.append(a[i] - ans[i])", "- print((\" \".join(list(map(str, list([2 * x for x in ans]))))))", "+ x = 0", "+ fo...
false
0.047342
0.048409
0.977975
[ "s898519525", "s111142237" ]
u576432509
p03599
python
s669350195
s667738681
921
46
3,064
3,064
Accepted
Accepted
95.01
a,b,c,d,e,f=list(map(int, input().split())) indxmax=0.0 wmax=0 emax=0 elimit=(100*e)/(100+e) c31=int(f/c)+1 for ai in range(0,f+1,a): for bi in range(0,f-ai+1,b): w=100*ai+100*bi # print("a,b:",ai,bi,w) if w<=f and w>0: # c31=int(w/100*e/c)+1 # c31=min(int(...
a,b,c,d,e,f=list(map(int, input().split())) indxmax=0.0 wmax=0 emax=0 elimit=(100*e)/(100+e) c31=int(f/c)+1 for ai in range(0,f+1,100*a): for bi in range(0,f-ai+1,100*b): w=ai+bi # print("a,b:",ai,bi,w) if w<=f and w>0: c31=(w*e)//100+c for ci in range(0,...
29
28
863
865
a, b, c, d, e, f = list(map(int, input().split())) indxmax = 0.0 wmax = 0 emax = 0 elimit = (100 * e) / (100 + e) c31 = int(f / c) + 1 for ai in range(0, f + 1, a): for bi in range(0, f - ai + 1, b): w = 100 * ai + 100 * bi # print("a,b:",ai,bi,w) if w <= f and w > 0: # ...
a, b, c, d, e, f = list(map(int, input().split())) indxmax = 0.0 wmax = 0 emax = 0 elimit = (100 * e) / (100 + e) c31 = int(f / c) + 1 for ai in range(0, f + 1, 100 * a): for bi in range(0, f - ai + 1, 100 * b): w = ai + bi # print("a,b:",ai,bi,w) if w <= f and w > 0: c31 ...
false
3.448276
[ "-for ai in range(0, f + 1, a):", "- for bi in range(0, f - ai + 1, b):", "- w = 100 * ai + 100 * bi", "+for ai in range(0, f + 1, 100 * a):", "+ for bi in range(0, f - ai + 1, 100 * b):", "+ w = ai + bi", "- # c31=int(w/100*e/c)+1", "- # ...
false
0.78493
0.035878
21.877462
[ "s669350195", "s667738681" ]
u168578024
p02577
python
s391036910
s811403268
294
177
79,552
73,544
Accepted
Accepted
39.8
n=int(eval(input())) print(('YNeos'[(n%9!=0)::2]))
print(('YNeos'[int(eval(input()))%9!=0::2]))
2
1
44
37
n = int(eval(input())) print(("YNeos"[(n % 9 != 0) :: 2]))
print(("YNeos"[int(eval(input())) % 9 != 0 :: 2]))
false
50
[ "-n = int(eval(input()))", "-print((\"YNeos\"[(n % 9 != 0) :: 2]))", "+print((\"YNeos\"[int(eval(input())) % 9 != 0 :: 2]))" ]
false
0.105303
0.04457
2.362639
[ "s391036910", "s811403268" ]
u102461423
p03785
python
s797488647
s635555372
105
72
12,508
18,332
Accepted
Accepted
31.43
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # greedy N,C,K,*T = list(map(int,read().split())) T.sort() bus_t = -K - 100 bus_c = C answer = 0 for t in T: bl = (bus_t + K >= t) and (bus_c + 1 <= C) if bl: bus_c +=...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, C, K, *T = list(map(int, read().split())) T.sort() def main(N, C, K, T): INF = K + 100 time = -INF people = 0 bus = 0 for t in T: if t > time + K: ...
24
31
398
609
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # greedy N, C, K, *T = list(map(int, read().split())) T.sort() bus_t = -K - 100 bus_c = C answer = 0 for t in T: bl = (bus_t + K >= t) and (bus_c + 1 <= C) if bl: bus_c += 1 conti...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, C, K, *T = list(map(int, read().split())) T.sort() def main(N, C, K, T): INF = K + 100 time = -INF people = 0 bus = 0 for t in T: if t > time + K: time = t ...
false
22.580645
[ "-# greedy", "-bus_t = -K - 100", "-bus_c = C", "-answer = 0", "-for t in T:", "- bl = (bus_t + K >= t) and (bus_c + 1 <= C)", "- if bl:", "- bus_c += 1", "- continue", "- answer += 1", "- bus_t = t", "- bus_c = 1", "-print(answer)", "+", "+", "+def main(N,...
false
0.03915
0.038837
1.00807
[ "s797488647", "s635555372" ]
u547167033
p02756
python
s287517189
s270807153
616
462
9,864
6,344
Accepted
Accepted
25
s=list(eval(input())) q=int(eval(input())) t1,t2=[],[] cnt=0 for _ in range(q): t=list(input().split()) if len(t)==1: cnt+=1 t1,t2=t2,t1 else: if int(t[1])==1: t1+=[t[2]] else: t2+=[t[2]] if cnt%2==1: s=s[::-1] u=t1[::-1]+s+t2 print((''.join(u)))
s=eval(input()) q=int(eval(input())) cnt=0 a1,a2=[],[] for _ in range(q): t=list(input().split()) if t[0]=='1': cnt+=1 a1,a2=a2,a1 else: if t[1]=='1': a1.append(t[2]) else: a2.append(t[2]) if cnt%2==1: s=s[::-1] print((''.join(a1[::-1])+s+''.join(a2)))
18
17
285
290
s = list(eval(input())) q = int(eval(input())) t1, t2 = [], [] cnt = 0 for _ in range(q): t = list(input().split()) if len(t) == 1: cnt += 1 t1, t2 = t2, t1 else: if int(t[1]) == 1: t1 += [t[2]] else: t2 += [t[2]] if cnt % 2 == 1: s = s[::-1] u = t...
s = eval(input()) q = int(eval(input())) cnt = 0 a1, a2 = [], [] for _ in range(q): t = list(input().split()) if t[0] == "1": cnt += 1 a1, a2 = a2, a1 else: if t[1] == "1": a1.append(t[2]) else: a2.append(t[2]) if cnt % 2 == 1: s = s[::-1] print(("...
false
5.555556
[ "-s = list(eval(input()))", "+s = eval(input())", "-t1, t2 = [], []", "+a1, a2 = [], []", "- if len(t) == 1:", "+ if t[0] == \"1\":", "- t1, t2 = t2, t1", "+ a1, a2 = a2, a1", "- if int(t[1]) == 1:", "- t1 += [t[2]]", "+ if t[1] == \"1\":", "+ ...
false
0.008306
0.109684
0.07573
[ "s287517189", "s270807153" ]
u506705885
p02399
python
s188534989
s075761795
50
20
7,692
5,600
Accepted
Accepted
60
nums=[] nums=input().split() print((int(nums[0])//int(nums[1]),int(nums[0])%int(nums[1]),"{0:.8f}".format(float(nums[0])/float(nums[1]))))
a,b=list(map(int,input().split())) print((a//b,a%b,"{0:.5f}".format(a/b)))
4
2
140
67
nums = [] nums = input().split() print( ( int(nums[0]) // int(nums[1]), int(nums[0]) % int(nums[1]), "{0:.8f}".format(float(nums[0]) / float(nums[1])), ) )
a, b = list(map(int, input().split())) print((a // b, a % b, "{0:.5f}".format(a / b)))
false
50
[ "-nums = []", "-nums = input().split()", "-print(", "- (", "- int(nums[0]) // int(nums[1]),", "- int(nums[0]) % int(nums[1]),", "- \"{0:.8f}\".format(float(nums[0]) / float(nums[1])),", "- )", "-)", "+a, b = list(map(int, input().split()))", "+print((a // b, a % b, \"{...
false
0.049893
0.03496
1.427152
[ "s188534989", "s075761795" ]
u057964173
p03250
python
s655500208
s679445078
164
18
38,256
2,940
Accepted
Accepted
89.02
import sys def input(): return sys.stdin.readline().strip() def resolve(): l=list(input().split()) l.sort(reverse=True) print((int(l[0]+l[1])+int(l[2]))) resolve()
import sys def input(): return sys.stdin.readline().strip() def resolve(): a,b,c=list(map(int, input().split())) print((max(a*10+b+c,b*10+a+c,c*10+a+b))) resolve()
8
7
181
170
import sys def input(): return sys.stdin.readline().strip() def resolve(): l = list(input().split()) l.sort(reverse=True) print((int(l[0] + l[1]) + int(l[2]))) resolve()
import sys def input(): return sys.stdin.readline().strip() def resolve(): a, b, c = list(map(int, input().split())) print((max(a * 10 + b + c, b * 10 + a + c, c * 10 + a + b))) resolve()
false
12.5
[ "- l = list(input().split())", "- l.sort(reverse=True)", "- print((int(l[0] + l[1]) + int(l[2])))", "+ a, b, c = list(map(int, input().split()))", "+ print((max(a * 10 + b + c, b * 10 + a + c, c * 10 + a + b)))" ]
false
0.104935
0.106464
0.985633
[ "s655500208", "s679445078" ]
u767995501
p03854
python
s240008746
s473458978
24
18
6,516
3,188
Accepted
Accepted
25
import re print(("YES" if re.match("^(dream|dreamer|erase|eraser)+$",eval(input())) else "NO"))
s = input().replace("eraser", "").replace("erase","").replace("dreamer", "").replace("dream", "") if s: print("NO") else: print("YES")
2
5
88
146
import re print(("YES" if re.match("^(dream|dreamer|erase|eraser)+$", eval(input())) else "NO"))
s = ( input() .replace("eraser", "") .replace("erase", "") .replace("dreamer", "") .replace("dream", "") ) if s: print("NO") else: print("YES")
false
60
[ "-import re", "-", "-print((\"YES\" if re.match(\"^(dream|dreamer|erase|eraser)+$\", eval(input())) else \"NO\"))", "+s = (", "+ input()", "+ .replace(\"eraser\", \"\")", "+ .replace(\"erase\", \"\")", "+ .replace(\"dreamer\", \"\")", "+ .replace(\"dream\", \"\")", "+)", "+if s:",...
false
0.039532
0.03572
1.106695
[ "s240008746", "s473458978" ]
u186838327
p03855
python
s274880760
s636926276
1,120
768
36,200
36,204
Accepted
Accepted
31.43
def Find(x, par): if par[x] < 0: return x else: # 経路圧縮 par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: # rankの低い方を高い方につなげる if rank[x] < rank[y]: par[y] += par[x] par[x] = y else: ...
import sys input = sys.stdin.readline def Find(x, par): if par[x] < 0: return x else: # 経路圧縮 par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: # rankの低い方を高い方につなげる if rank[x] < rank[y]: par[y] +...
61
73
1,092
1,168
def Find(x, par): if par[x] < 0: return x else: # 経路圧縮 par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: # rankの低い方を高い方につなげる if rank[x] < rank[y]: par[y] += par[x] ...
import sys input = sys.stdin.readline def Find(x, par): if par[x] < 0: return x else: # 経路圧縮 par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: # rankの低い方を高い方につなげる if rank[x] < rank[y]...
false
16.438356
[ "+import sys", "+", "+input = sys.stdin.readline", "+", "+" ]
false
0.068329
0.041122
1.661602
[ "s274880760", "s636926276" ]
u729133443
p03061
python
s367246763
s881926441
1,682
549
16,168
96,824
Accepted
Accepted
67.36
class SegTree(): def __init__(self,data,unit,f): self.size=n=len(data) self.data=[unit for _ in range(n)]+data for i in range(n-1,0,-1):self.data[i]=f(self.data[i+i],self.data[i-~i]) self.unit=unit self.f=f def update(self,i,x): c,f=self.data,self.f ...
class DisjointSparseTable(): def __init__(self,data,f): from math import ceil,log#2 self.n=n=len(data) m=ceil(log(n,2)) # ceil(log2(n)) self.f=f self.h=[0,0] for i in range(2,2**m):self.h.append(self.h[i//2]+1) self.data=[data] for i in range(...
45
34
1,192
1,099
class SegTree: def __init__(self, data, unit, f): self.size = n = len(data) self.data = [unit for _ in range(n)] + data for i in range(n - 1, 0, -1): self.data[i] = f(self.data[i + i], self.data[i - ~i]) self.unit = unit self.f = f def update(self, i, x): ...
class DisjointSparseTable: def __init__(self, data, f): from math import ceil, log # 2 self.n = n = len(data) m = ceil(log(n, 2)) # ceil(log2(n)) self.f = f self.h = [0, 0] for i in range(2, 2**m): self.h.append(self.h[i // 2] + 1) self.data = [...
false
24.444444
[ "-class SegTree:", "- def __init__(self, data, unit, f):", "- self.size = n = len(data)", "- self.data = [unit for _ in range(n)] + data", "- for i in range(n - 1, 0, -1):", "- self.data[i] = f(self.data[i + i], self.data[i - ~i])", "- self.unit = unit", "+cla...
false
0.057719
0.05548
1.040352
[ "s367246763", "s881926441" ]
u055941944
p03963
python
s218719512
s885267117
20
18
2,940
2,940
Accepted
Accepted
10
# -*- coding utf-8 -*- n,k =list(map(int,input().split())) if n==1: print((n*k)) else: print((k*(k-1)**(n-1)))
# -*- coding utf-8 -*- n,k=list(map(int,input().split())) print((k*(k-1)**(n-1)))
8
4
117
78
# -*- coding utf-8 -*- n, k = list(map(int, input().split())) if n == 1: print((n * k)) else: print((k * (k - 1) ** (n - 1)))
# -*- coding utf-8 -*- n, k = list(map(int, input().split())) print((k * (k - 1) ** (n - 1)))
false
50
[ "-if n == 1:", "- print((n * k))", "-else:", "- print((k * (k - 1) ** (n - 1)))", "+print((k * (k - 1) ** (n - 1)))" ]
false
0.039698
0.039847
0.996269
[ "s218719512", "s885267117" ]
u514894322
p02732
python
s952371140
s871176409
520
335
36,892
26,780
Accepted
Accepted
35.58
from collections import Counter N = int(eval(input())) B = [int(x) for x in input().split()] A=Counter(B) V, C = list(zip(*A.most_common())) count=0 for x in C: if x==0: break count+=x*(x-1)/2 for x in B: ans=count-A[x]+1 print((int(ans)))
from collections import Counter n=eval(input()) *l,=list(map(int,input().split())) A=Counter(l) c=0 for i in list(A.values()): c+=i*(i-1)//2 for j in l: print((c-A[j]+1))
13
9
250
163
from collections import Counter N = int(eval(input())) B = [int(x) for x in input().split()] A = Counter(B) V, C = list(zip(*A.most_common())) count = 0 for x in C: if x == 0: break count += x * (x - 1) / 2 for x in B: ans = count - A[x] + 1 print((int(ans)))
from collections import Counter n = eval(input()) (*l,) = list(map(int, input().split())) A = Counter(l) c = 0 for i in list(A.values()): c += i * (i - 1) // 2 for j in l: print((c - A[j] + 1))
false
30.769231
[ "-N = int(eval(input()))", "-B = [int(x) for x in input().split()]", "-A = Counter(B)", "-V, C = list(zip(*A.most_common()))", "-count = 0", "-for x in C:", "- if x == 0:", "- break", "- count += x * (x - 1) / 2", "-for x in B:", "- ans = count - A[x] + 1", "- print((int(ans...
false
0.063888
0.123301
0.518149
[ "s952371140", "s871176409" ]
u047393579
p03785
python
s615185945
s665439299
256
229
8,280
8,288
Accepted
Accepted
10.55
N, C, K = list(map(int, input().split())) T = [] for i in range(N): T.append(int(eval(input()))) sorted_T = sorted(T) bus_count = 1 pas_count = 0 bus_start = sorted_T[0] for t in sorted_T: if pas_count == C or t - bus_start > K: bus_count += 1 pas_count = 0 bus_start = t ...
N, C, K = list(map(int, input().split())) flag = True pass_num = 0 count = 1 for t in sorted([int(eval(input())) for _ in range(N)]): if flag: first_pass_time = t flag = False if t - first_pass_time > K or pass_num == C: first_pass_time = t pass_num = 0 count +...
15
14
341
344
N, C, K = list(map(int, input().split())) T = [] for i in range(N): T.append(int(eval(input()))) sorted_T = sorted(T) bus_count = 1 pas_count = 0 bus_start = sorted_T[0] for t in sorted_T: if pas_count == C or t - bus_start > K: bus_count += 1 pas_count = 0 bus_start = t pas_count +=...
N, C, K = list(map(int, input().split())) flag = True pass_num = 0 count = 1 for t in sorted([int(eval(input())) for _ in range(N)]): if flag: first_pass_time = t flag = False if t - first_pass_time > K or pass_num == C: first_pass_time = t pass_num = 0 count += 1 pas...
false
6.666667
[ "-T = []", "-for i in range(N):", "- T.append(int(eval(input())))", "-sorted_T = sorted(T)", "-bus_count = 1", "-pas_count = 0", "-bus_start = sorted_T[0]", "-for t in sorted_T:", "- if pas_count == C or t - bus_start > K:", "- bus_count += 1", "- pas_count = 0", "- ...
false
0.071684
0.070253
1.020359
[ "s615185945", "s665439299" ]
u391819434
p02720
python
s467446550
s211940780
79
67
18,676
7,152
Accepted
Accepted
15.19
K=int(eval(input())) A=[1,2,3,4,5,6,7,8,9]+[0]*10*K i=9 j=0 while i<K: if A[j]%10!=0 and A[j]%10!=9: A[i]=10*A[j]+A[j]%10-1;i+=1 A[i]=10*A[j]+A[j]%10;i+=1 A[i]=10*A[j]+A[j]%10+1;i+=1 elif A[j]%10==0: A[i]=10*A[j]+A[j]%10;i+=1 A[i]=10*A[j]+A[j]%10+1;i+=1 el...
K=int(eval(input())) A=[1,2,3,4,5,6,7,8,9]+[0]*K i=9 j=0 while i<K: if A[j]%10!=0 and A[j]%10!=9: A[i]=10*A[j]+A[j]%10-1;i+=1 A[i]=10*A[j]+A[j]%10;i+=1 A[i]=10*A[j]+A[j]%10+1;i+=1 elif A[j]%10==0: A[i]=10*A[j]+A[j]%10;i+=1 A[i]=10*A[j]+A[j]%10+1;i+=1 else:...
17
17
415
411
K = int(eval(input())) A = [1, 2, 3, 4, 5, 6, 7, 8, 9] + [0] * 10 * K i = 9 j = 0 while i < K: if A[j] % 10 != 0 and A[j] % 10 != 9: A[i] = 10 * A[j] + A[j] % 10 - 1 i += 1 A[i] = 10 * A[j] + A[j] % 10 i += 1 A[i] = 10 * A[j] + A[j] % 10 + 1 i += 1 elif A[j] % 10 ...
K = int(eval(input())) A = [1, 2, 3, 4, 5, 6, 7, 8, 9] + [0] * K i = 9 j = 0 while i < K: if A[j] % 10 != 0 and A[j] % 10 != 9: A[i] = 10 * A[j] + A[j] % 10 - 1 i += 1 A[i] = 10 * A[j] + A[j] % 10 i += 1 A[i] = 10 * A[j] + A[j] % 10 + 1 i += 1 elif A[j] % 10 == 0:...
false
0
[ "-A = [1, 2, 3, 4, 5, 6, 7, 8, 9] + [0] * 10 * K", "+A = [1, 2, 3, 4, 5, 6, 7, 8, 9] + [0] * K" ]
false
0.154055
0.056522
2.725554
[ "s467446550", "s211940780" ]
u968166680
p02579
python
s732323271
s003054045
1,098
812
105,780
103,876
Accepted
Accepted
26.05
import sys from collections import deque read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 dxdy4 = ((-1, 0), (0, -1), (0, 1), (1, 0)) def main(): H, W = list(map(int, readline().split())) Ch, Cw = ...
import sys from collections import deque read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 dxdy4 = ((-1, 0), (0, -1), (0, 1), (1, 0)) def main(): H, W = list(map(int, readline().split())) Ch, Cw = ...
65
67
1,708
1,754
import sys from collections import deque read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 dxdy4 = ((-1, 0), (0, -1), (0, 1), (1, 0)) def main(): H, W = list(map(int, readline().split())) Ch, Cw = list(map(int, read...
import sys from collections import deque read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10**9) INF = 1 << 60 MOD = 1000000007 dxdy4 = ((-1, 0), (0, -1), (0, 1), (1, 0)) def main(): H, W = list(map(int, readline().split())) Ch, Cw = list(map(int, read...
false
2.985075
[ "+ if seen[x][y]:", "+ continue" ]
false
0.036126
0.15138
0.238641
[ "s732323271", "s003054045" ]
u789854092
p02915
python
s005431101
s079105438
19
17
3,060
2,940
Accepted
Accepted
10.53
n = int(eval(input())) print(("{}".format(n**3)))
n = int(eval(input())) print((n**3))
2
2
42
29
n = int(eval(input())) print(("{}".format(n**3)))
n = int(eval(input())) print((n**3))
false
0
[ "-print((\"{}\".format(n**3)))", "+print((n**3))" ]
false
0.042229
0.044204
0.955328
[ "s005431101", "s079105438" ]
u037441960
p02390
python
s894130202
s408668972
30
20
5,584
5,588
Accepted
Accepted
33.33
S = int(input()) h = S // 3600 #切り捨て除算⇒// m = (S - h * 3600) // 60 s = S - (h * 3600 + m * 60) print(h, ":", m, ":", s, sep = "")
S = int(input()) h = S // 3600 m = (S - h * 3600) // 60 s = S - (h * 3600 + m * 60) print(h, ":", m, ":", s, sep = "")
5
7
136
127
S = int(input()) h = S // 3600 # 切り捨て除算⇒// m = (S - h * 3600) // 60 s = S - (h * 3600 + m * 60) print(h, ":", m, ":", s, sep="")
S = int(input()) h = S // 3600 m = (S - h * 3600) // 60 s = S - (h * 3600 + m * 60) print(h, ":", m, ":", s, sep="")
false
28.571429
[ "-h = S // 3600 # 切り捨て除算⇒//", "+h = S // 3600" ]
false
0.11104
0.048652
2.282332
[ "s894130202", "s408668972" ]
u871980676
p02821
python
s111609106
s188534665
1,153
1,036
59,664
58,932
Accepted
Accepted
10.15
import sys import bisect input = sys.stdin.readline class Bisect(object): def bisect_max(self, reva, func,M): ok = 0 # exist ng = 4*(10**5) # not exist while abs(ok-ng) > 1: cnt = (ok + ng) // 2 if func(cnt,reva,M): ok = cnt el...
import sys import bisect input = sys.stdin.readline class Bisect(object): def bisect_max(self, reva, func,M): ok = 0 # exist ng = 2*(10**5)+1 # not exist while abs(ok-ng) > 1: cnt = (ok + ng) // 2 if func(cnt,reva,M): ok = cnt ...
53
52
1,132
1,175
import sys import bisect input = sys.stdin.readline class Bisect(object): def bisect_max(self, reva, func, M): ok = 0 # exist ng = 4 * (10**5) # not exist while abs(ok - ng) > 1: cnt = (ok + ng) // 2 if func(cnt, reva, M): ok = cnt els...
import sys import bisect input = sys.stdin.readline class Bisect(object): def bisect_max(self, reva, func, M): ok = 0 # exist ng = 2 * (10**5) + 1 # not exist while abs(ok - ng) > 1: cnt = (ok + ng) // 2 if func(cnt, reva, M): ok = cnt ...
false
1.886792
[ "- ng = 4 * (10**5) # not exist", "+ ng = 2 * (10**5) + 1 # not exist", "+ if (n - bisect.bisect_left(reva, tgt - reva[n - 1])) * n < M:", "+ return False", "- tmp = bisect.bisect_left(reva, tgt - reva[i])", "- tmp = n - tmp", "- res += tmp", "- if M <...
false
0.174867
0.038127
4.586426
[ "s111609106", "s188534665" ]
u813387707
p02725
python
s909578318
s837592407
156
105
26,444
24,908
Accepted
Accepted
32.69
K, N = [int(s) for s in input().split()] A_list = [int(s) for s in input().split()] d_list = [] for i, A in enumerate(A_list): if i == N - 1: d = K - A_list[i] + A_list[0] else: d = A_list[i + 1] - A_list[i] d_list.append(d) d_sum_min = K - max(d_list) print(d_sum_min)
k, n = [int(x) for x in input().split()] a_list = [int(x) for x in input().split()] a_list.append(k + a_list[0]) d_list = [a_list[i + 1] - a_list[i] for i in range(n)] print((k - max(d_list)))
14
7
314
198
K, N = [int(s) for s in input().split()] A_list = [int(s) for s in input().split()] d_list = [] for i, A in enumerate(A_list): if i == N - 1: d = K - A_list[i] + A_list[0] else: d = A_list[i + 1] - A_list[i] d_list.append(d) d_sum_min = K - max(d_list) print(d_sum_min)
k, n = [int(x) for x in input().split()] a_list = [int(x) for x in input().split()] a_list.append(k + a_list[0]) d_list = [a_list[i + 1] - a_list[i] for i in range(n)] print((k - max(d_list)))
false
50
[ "-K, N = [int(s) for s in input().split()]", "-A_list = [int(s) for s in input().split()]", "-d_list = []", "-for i, A in enumerate(A_list):", "- if i == N - 1:", "- d = K - A_list[i] + A_list[0]", "- else:", "- d = A_list[i + 1] - A_list[i]", "- d_list.append(d)", "-d_sum_m...
false
0.098311
0.042478
2.31437
[ "s909578318", "s837592407" ]
u709304134
p02659
python
s183583959
s489366656
28
22
9,992
9,164
Accepted
Accepted
21.43
from decimal import * a, b = input().split() ans = Decimal(a) * Decimal(b) print((int(ans)))
a, b = input().split() ans = int(a)*int(float(b)*100+0.5) ans = ans//100 print(ans)
4
4
94
86
from decimal import * a, b = input().split() ans = Decimal(a) * Decimal(b) print((int(ans)))
a, b = input().split() ans = int(a) * int(float(b) * 100 + 0.5) ans = ans // 100 print(ans)
false
0
[ "-from decimal import *", "-", "-ans = Decimal(a) * Decimal(b)", "-print((int(ans)))", "+ans = int(a) * int(float(b) * 100 + 0.5)", "+ans = ans // 100", "+print(ans)" ]
false
0.083671
0.129427
0.646474
[ "s183583959", "s489366656" ]
u802963389
p03013
python
s685488174
s203325992
183
169
13,216
18,960
Accepted
Accepted
7.65
n, m = list(map(int, input().split())) A = set([int(eval(input())) for _ in range(m)]) MOD = 10 ** 9 + 7 dp = [0] * (n + 1) dp[0] = 1 if 1 not in A: dp[1] = 1 for i in range(2, n + 1): if i not in A: dp[i] = (dp[i - 1] + dp[i - 2]) % MOD print((dp[-1]))
n, m = list(map(int, input().split())) A = set([int(eval(input())) for _ in range(m)]) MOD = 10 ** 9 + 7 dp = [0] * (n + 1) dp[0] = 1 for i in range(n + 1): if i > 1: if i not in A: dp[i] += dp[i - 2] if i > 0: if i not in A: dp[i] += dp[i - 1] dp[i] %= MOD print((dp[-1]))
15
17
265
304
n, m = list(map(int, input().split())) A = set([int(eval(input())) for _ in range(m)]) MOD = 10**9 + 7 dp = [0] * (n + 1) dp[0] = 1 if 1 not in A: dp[1] = 1 for i in range(2, n + 1): if i not in A: dp[i] = (dp[i - 1] + dp[i - 2]) % MOD print((dp[-1]))
n, m = list(map(int, input().split())) A = set([int(eval(input())) for _ in range(m)]) MOD = 10**9 + 7 dp = [0] * (n + 1) dp[0] = 1 for i in range(n + 1): if i > 1: if i not in A: dp[i] += dp[i - 2] if i > 0: if i not in A: dp[i] += dp[i - 1] dp[i] %= MOD print((dp[-1...
false
11.764706
[ "-if 1 not in A:", "- dp[1] = 1", "-for i in range(2, n + 1):", "- if i not in A:", "- dp[i] = (dp[i - 1] + dp[i - 2]) % MOD", "+for i in range(n + 1):", "+ if i > 1:", "+ if i not in A:", "+ dp[i] += dp[i - 2]", "+ if i > 0:", "+ if i not in A:", "+...
false
0.040378
0.034829
1.159295
[ "s685488174", "s203325992" ]
u985949234
p03805
python
s001397266
s610013252
272
193
48,088
41,200
Accepted
Accepted
29.04
N,M = list(map(int, input().split())) edge= [[] for i in range(N+1)] for i in range(M): a,b = list(map(int, input().split())) edge[a].append(b) edge[b].append(a) result = [] import copy def dfs(n,used,d): if d == N-1: result.append(1) for e in edge[n]: if used[e] == F...
N,M = list(map(int, input().split())) edge= [[] for i in range(N+1)] for i in range(M): a,b = list(map(int, input().split())) edge[a].append(b) edge[b].append(a) import itertools per = itertools.permutations([i for i in range(1,N+1)]) ans = 0 for item in per: if item[0] != 1: contin...
24
24
491
532
N, M = list(map(int, input().split())) edge = [[] for i in range(N + 1)] for i in range(M): a, b = list(map(int, input().split())) edge[a].append(b) edge[b].append(a) result = [] import copy def dfs(n, used, d): if d == N - 1: result.append(1) for e in edge[n]: if used[e] == False:...
N, M = list(map(int, input().split())) edge = [[] for i in range(N + 1)] for i in range(M): a, b = list(map(int, input().split())) edge[a].append(b) edge[b].append(a) import itertools per = itertools.permutations([i for i in range(1, N + 1)]) ans = 0 for item in per: if item[0] != 1: continue ...
false
0
[ "-result = []", "-import copy", "+import itertools", "-", "-def dfs(n, used, d):", "- if d == N - 1:", "- result.append(1)", "- for e in edge[n]:", "- if used[e] == False:", "- usedf = copy.deepcopy(used)", "- usedf[e] = True", "- dfs(e, use...
false
0.04018
0.007888
5.093539
[ "s001397266", "s610013252" ]
u352394527
p00097
python
s349199405
s677046026
800
420
19,104
5,732
Accepted
Accepted
47.5
""" now...今注目する値 used...使った数字の数 sum...それまでの合計 dp[now][used][sum]...nowまででused個の数字を使って合計sumの場合の数 dp[now][used][sum] = dp[now - 1][used - 1][sum - now] + dp[now - 1][used][sum] (used >= 1 and sum >= now) dp[now - 1][used][sum] (used == 0 or sum < now) """...
""" now...今注目する値 used...使った数字の数 sum...それまでの合計 dp[now][used][sum]...nowまででused個の数字を使って合計sumの場合の数 dp[now][used][sum] = dp[now - 1][used - 1][sum - now] + dp[now - 1][used][sum] (used >= 1 and sum >= now) dp[now - 1][used][sum] (used == 0 or sum < now) ...
26
34
788
819
""" now...今注目する値 used...使った数字の数 sum...それまでの合計 dp[now][used][sum]...nowまででused個の数字を使って合計sumの場合の数 dp[now][used][sum] = dp[now - 1][used - 1][sum - now] + dp[now - 1][used][sum] (used >= 1 and sum >= now) dp[now - 1][used][sum] (used == 0 or sum < now) """ dp = [[[...
""" now...今注目する値 used...使った数字の数 sum...それまでの合計 dp[now][used][sum]...nowまででused個の数字を使って合計sumの場合の数 dp[now][used][sum] = dp[now - 1][used - 1][sum - now] + dp[now - 1][used][sum] (used >= 1 and sum >= now) dp[now - 1][used][sum] (used == 0 or sum < now) 2次元化 dp[used...
false
23.529412
[ "+2次元化", "+dp[used][sum]...used個の数字を使って合計sumの場合の数", "+dp[used][sum] = dp[used - 1][sum - now] + dp[used][sum] (used >= 1 and sum >= now)", "+ただし、usedの大きい順に更新する(更新がかぶるため)", "-dp = [[[0 for _ in range(1001)] for _ in range(10)] for _ in range(101)]", "-dp[0][1][0] = 1", "-dp[0][0][0] = 1", "+dp = [[0 fo...
false
0.645685
0.828647
0.779204
[ "s349199405", "s677046026" ]
u620084012
p02756
python
s921046779
s963295816
1,246
333
4,540
9,928
Accepted
Accepted
73.27
import sys, math sys.setrecursionlimit(10**5 + 10) def input(): return sys.stdin.readline()[:-1] def main(): S = eval(input()) Q = int(eval(input())) f = 1 m = "" u = "" for k in range(Q): q = list(input().split()) if q[0] == "1": f *= -1 ...
S = eval(input()) T = "" B = "" f = 1 for _ in range(int(eval(input()))): L = list(input().split()) if L[0] == "1": f *= -1 else: if f == 1: if L[1] == "1": T += L[2] else: B += L[2] else: if L[1] == "...
34
24
737
460
import sys, math sys.setrecursionlimit(10**5 + 10) def input(): return sys.stdin.readline()[:-1] def main(): S = eval(input()) Q = int(eval(input())) f = 1 m = "" u = "" for k in range(Q): q = list(input().split()) if q[0] == "1": f *= -1 else: ...
S = eval(input()) T = "" B = "" f = 1 for _ in range(int(eval(input()))): L = list(input().split()) if L[0] == "1": f *= -1 else: if f == 1: if L[1] == "1": T += L[2] else: B += L[2] else: if L[1] == "1": ...
false
29.411765
[ "-import sys, math", "-", "-sys.setrecursionlimit(10**5 + 10)", "-", "-", "-def input():", "- return sys.stdin.readline()[:-1]", "-", "-", "-def main():", "- S = eval(input())", "- Q = int(eval(input()))", "- f = 1", "- m = \"\"", "- u = \"\"", "- for k in range(Q)...
false
0.042215
0.036622
1.152702
[ "s921046779", "s963295816" ]
u838644735
p03108
python
s034840446
s937944117
410
374
25,332
25,732
Accepted
Accepted
8.78
class UnionFind(): def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0]*(n + 1) def root(self, x): if self.par[x] == x: return x r = self.root(self.par[x]) self.par[x] = r return r def same(self, x, y): ...
class UnionFind(): def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0]*(n + 1) def root(self, x): if self.par[x] == x: return x r = self.root(self.par[x]) self.par[x] = r return r def same(self, x, y): ...
55
53
1,391
1,385
class UnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0] * (n + 1) def root(self, x): if self.par[x] == x: return x r = self.root(self.par[x]) self.par[x] = r return r def same(self, x, y): return self....
class UnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0] * (n + 1) def root(self, x): if self.par[x] == x: return x r = self.root(self.par[x]) self.par[x] = r return r def same(self, x, y): return self....
false
3.636364
[ "- for ans in ANS:", "- print(ans)", "+ print((\"\\n\".join(map(str, ANS))))" ]
false
0.039012
0.041942
0.930142
[ "s034840446", "s937944117" ]
u218843509
p02962
python
s636405058
s968641565
1,549
336
426,088
105,704
Accepted
Accepted
78.31
# https://tjkendev.github.io/procon-library/python/string/rolling_hash.html import sys def input(): return sys.stdin.readline()[:-1] BASE, MOD = 80408696819889532, (1<<61)-1 class RollingHash(): def __init__(self, s, base, mod): self.mod = mod self.pw = pw = [1]*(len(s)+1) l = len(s) self.h = ...
import sys def input(): return sys.stdin.readline()[:-1] class KMP(): def __init__(self, sentence): self.sentence = sent = sentence self.l = l = len(sent) self.table = table = [0 for _ in range(l+1)] table[0] = -1 j = -1 for i in range(l): while j >= 0 and sent[i] != sent[j]: j = tabl...
84
94
1,697
1,630
# https://tjkendev.github.io/procon-library/python/string/rolling_hash.html import sys def input(): return sys.stdin.readline()[:-1] BASE, MOD = 80408696819889532, (1 << 61) - 1 class RollingHash: def __init__(self, s, base, mod): self.mod = mod self.pw = pw = [1] * (len(s) + 1) l ...
import sys def input(): return sys.stdin.readline()[:-1] class KMP: def __init__(self, sentence): self.sentence = sent = sentence self.l = l = len(sent) self.table = table = [0 for _ in range(l + 1)] table[0] = -1 j = -1 for i in range(l): while j ...
false
10.638298
[ "-# https://tjkendev.github.io/procon-library/python/string/rolling_hash.html", "-BASE, MOD = 80408696819889532, (1 << 61) - 1", "+class KMP:", "+ def __init__(self, sentence):", "+ self.sentence = sent = sentence", "+ self.l = l = len(sent)", "+ self.table = table = [0 for _ in ...
false
0.042313
0.039619
1.068004
[ "s636405058", "s968641565" ]
u397496203
p03294
python
s310700094
s900331139
95
69
64,804
64,924
Accepted
Accepted
27.37
n = int(eval(input())) A = [int(i) for i in input().strip().split()] print((sum(A) - n))
import sys def input(): return sys.stdin.readline().strip() # sys.setrecursionlimit(100000) def main(): n = int(input().strip()) A = [int(i) for i in input().split()] print((sum(A) - n)) return if __name__ == "__main__": main()
4
18
85
274
n = int(eval(input())) A = [int(i) for i in input().strip().split()] print((sum(A) - n))
import sys def input(): return sys.stdin.readline().strip() # sys.setrecursionlimit(100000) def main(): n = int(input().strip()) A = [int(i) for i in input().split()] print((sum(A) - n)) return if __name__ == "__main__": main()
false
77.777778
[ "-n = int(eval(input()))", "-A = [int(i) for i in input().strip().split()]", "-print((sum(A) - n))", "+import sys", "+", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "+# sys.setrecursionlimit(100000)", "+def main():", "+ n = int(input().strip())", "+ A ...
false
0.034823
0.043248
0.805198
[ "s310700094", "s900331139" ]
u885634168
p02708
python
s067325330
s638181068
81
66
81,196
63,216
Accepted
Accepted
18.52
N, K = list(map(int,input().split())) def sum_(i, j): return (a[i] + a[j]) * (j - i + 1) // 2 a = [i for i in range(N + 1)] ans = 0 for i in range(K, N + 2): min_ = sum_(0, i - 1) max_ = sum_(N - i + 1, N) ans += (max_ - min_ + 1) ans %= 10 ** 9 + 7 print(ans)
N, K = list(map(int,input().split())) ans = 0 INF = 10 ** 9 + 7 for i in range(K, N + 2): mi = i * (i - 1) // 2 ma = i * (2 * N - i + 1) // 2 ans += ma - mi + 1 ans %= INF print(ans)
13
9
294
206
N, K = list(map(int, input().split())) def sum_(i, j): return (a[i] + a[j]) * (j - i + 1) // 2 a = [i for i in range(N + 1)] ans = 0 for i in range(K, N + 2): min_ = sum_(0, i - 1) max_ = sum_(N - i + 1, N) ans += max_ - min_ + 1 ans %= 10**9 + 7 print(ans)
N, K = list(map(int, input().split())) ans = 0 INF = 10**9 + 7 for i in range(K, N + 2): mi = i * (i - 1) // 2 ma = i * (2 * N - i + 1) // 2 ans += ma - mi + 1 ans %= INF print(ans)
false
30.769231
[ "-", "-", "-def sum_(i, j):", "- return (a[i] + a[j]) * (j - i + 1) // 2", "-", "-", "-a = [i for i in range(N + 1)]", "+INF = 10**9 + 7", "- min_ = sum_(0, i - 1)", "- max_ = sum_(N - i + 1, N)", "- ans += max_ - min_ + 1", "- ans %= 10**9 + 7", "+ mi = i * (i - 1) // 2", ...
false
0.096111
0.008646
11.115931
[ "s067325330", "s638181068" ]
u622847899
p02659
python
s672682402
s662479149
26
23
10,072
9,128
Accepted
Accepted
11.54
from decimal import Decimal a,b=list(map(Decimal,input().split())) print((int(a*b)))
a,b=input().split() b=b[0]+b[2:] a=int(a) b=int(b) print((a*b//100))
5
5
84
71
from decimal import Decimal a, b = list(map(Decimal, input().split())) print((int(a * b)))
a, b = input().split() b = b[0] + b[2:] a = int(a) b = int(b) print((a * b // 100))
false
0
[ "-from decimal import Decimal", "-", "-a, b = list(map(Decimal, input().split()))", "-print((int(a * b)))", "+a, b = input().split()", "+b = b[0] + b[2:]", "+a = int(a)", "+b = int(b)", "+print((a * b // 100))" ]
false
0.04562
0.042728
1.067671
[ "s672682402", "s662479149" ]
u414458988
p03487
python
s760642767
s525923441
271
107
66,472
98,588
Accepted
Accepted
60.52
from collections import Counter n=int(eval(input())) a=Counter(input().split()) ans=0 for i,j in list(a.items()): i=int(i) if i>j: ans+=j elif i<j: ans+=j-i print(ans)
def main(): n = int(eval(input())) a = list(map(int,input().split())) from collections import Counter c = Counter(a) cnt = 0 for i,j in list(c.items()): if i == 1: cnt += max(j-1,0) else: cnt += j%i print(cnt) if __name__ == '__main__': ...
11
15
179
319
from collections import Counter n = int(eval(input())) a = Counter(input().split()) ans = 0 for i, j in list(a.items()): i = int(i) if i > j: ans += j elif i < j: ans += j - i print(ans)
def main(): n = int(eval(input())) a = list(map(int, input().split())) from collections import Counter c = Counter(a) cnt = 0 for i, j in list(c.items()): if i == 1: cnt += max(j - 1, 0) else: cnt += j % i print(cnt) if __name__ == "__main__": m...
false
26.666667
[ "-from collections import Counter", "+def main():", "+ n = int(eval(input()))", "+ a = list(map(int, input().split()))", "+ from collections import Counter", "-n = int(eval(input()))", "-a = Counter(input().split())", "-ans = 0", "-for i, j in list(a.items()):", "- i = int(i)", "- ...
false
0.170611
0.056896
2.99864
[ "s760642767", "s525923441" ]
u028973125
p02696
python
s717397775
s406530768
29
26
9,860
9,800
Accepted
Accepted
10.34
import sys import math from pprint import pprint A, B, N = list(map(int, sys.stdin.readline().strip().split())) def func(x): # return math.floor(A*x/B) - A*math.floor(x/B) return A*x//B - A*(x//B) right = N left = 0 while right - left > 5: mid_left = right//3+left*2//3 mid_right = rig...
import sys import math from pprint import pprint A, B, N = list(map(int, sys.stdin.readline().strip().split())) def func(x): return A*x//B - A*(x//B) right = N left = 0 while right - left > 5: mid_left = right//3+left*2//3 mid_right = right*2//3+left//3 # print("mid", mid_left, mi...
31
30
735
686
import sys import math from pprint import pprint A, B, N = list(map(int, sys.stdin.readline().strip().split())) def func(x): # return math.floor(A*x/B) - A*math.floor(x/B) return A * x // B - A * (x // B) right = N left = 0 while right - left > 5: mid_left = right // 3 + left * 2 // 3 mid_right = r...
import sys import math from pprint import pprint A, B, N = list(map(int, sys.stdin.readline().strip().split())) def func(x): return A * x // B - A * (x // B) right = N left = 0 while right - left > 5: mid_left = right // 3 + left * 2 // 3 mid_right = right * 2 // 3 + left // 3 # print("mid", mid_le...
false
3.225806
[ "- # return math.floor(A*x/B) - A*math.floor(x/B)", "- # if mid_left == mid_right:", "- # break", "+ if mid_left == mid_right:", "+ break" ]
false
0.048347
0.114628
0.421776
[ "s717397775", "s406530768" ]
u312025627
p03207
python
s450583640
s344903014
174
160
38,256
38,256
Accepted
Accepted
8.05
N = int(eval(input())) p = [int(eval(input())) for i in range(N)] max_p = max(p) print((sum(p) - (max_p // 2)))
def main(): N = int(eval(input())) A = [int(eval(input())) for i in range(N)] A.sort() A[-1] //= 2 print((sum(A))) if __name__ == '__main__': main()
4
10
100
170
N = int(eval(input())) p = [int(eval(input())) for i in range(N)] max_p = max(p) print((sum(p) - (max_p // 2)))
def main(): N = int(eval(input())) A = [int(eval(input())) for i in range(N)] A.sort() A[-1] //= 2 print((sum(A))) if __name__ == "__main__": main()
false
60
[ "-N = int(eval(input()))", "-p = [int(eval(input())) for i in range(N)]", "-max_p = max(p)", "-print((sum(p) - (max_p // 2)))", "+def main():", "+ N = int(eval(input()))", "+ A = [int(eval(input())) for i in range(N)]", "+ A.sort()", "+ A[-1] //= 2", "+ print((sum(A)))", "+", "+...
false
0.036549
0.039765
0.919119
[ "s450583640", "s344903014" ]
u562935282
p03625
python
s779739694
s894635499
104
92
14,252
15,020
Accepted
Accepted
11.54
def inpl(): return input().split() n = int(eval(input())) a = list(map(int, inpl())) a = sorted(a, reverse=True) ans = 1 cnt = 0 bf = a[0] i = 1 while (i < n) and (cnt < 2): a_i = a[i] if bf == a_i: ans *= a_i bf = -1 cnt += 1 else: bf = a_i i += ...
n = int(eval(input())) a = list(map(int, input().split())) a = sorted(a, reverse=True) anss = [] t = -1 for i in range(n): if t == a[i]: anss.append(t) t = -1 if len(anss) >= 2: break else: t = a[i] if len(anss) >= 2: ans = 1 for x in anss: ...
21
22
346
363
def inpl(): return input().split() n = int(eval(input())) a = list(map(int, inpl())) a = sorted(a, reverse=True) ans = 1 cnt = 0 bf = a[0] i = 1 while (i < n) and (cnt < 2): a_i = a[i] if bf == a_i: ans *= a_i bf = -1 cnt += 1 else: bf = a_i i += 1 print((ans if cnt...
n = int(eval(input())) a = list(map(int, input().split())) a = sorted(a, reverse=True) anss = [] t = -1 for i in range(n): if t == a[i]: anss.append(t) t = -1 if len(anss) >= 2: break else: t = a[i] if len(anss) >= 2: ans = 1 for x in anss: ans *= x el...
false
4.545455
[ "-def inpl():", "- return input().split()", "-", "-", "-a = list(map(int, inpl()))", "+a = list(map(int, input().split()))", "-ans = 1", "-cnt = 0", "-bf = a[0]", "-i = 1", "-while (i < n) and (cnt < 2):", "- a_i = a[i]", "- if bf == a_i:", "- ans *= a_i", "- bf = ...
false
0.077623
0.073546
1.055432
[ "s779739694", "s894635499" ]
u893063840
p04014
python
s741321197
s016299337
448
410
3,064
3,064
Accepted
Accepted
8.48
from math import floor, sqrt, ceil def f(b, n): if b < 2: return 0 if n < b: return n return f(b, floor(n / b)) + n % b n = int(eval(input())) s = int(eval(input())) if n == s: print((n + 1)) exit() for b in range(2, floor(sqrt(n)) + 1): if f(b, n) ==...
from math import floor, sqrt, ceil def f(b, n): if n < b: return n return f(b, floor(n / b)) + n % b n = int(eval(input())) s = int(eval(input())) if n == s: print((n + 1)) exit() for b in range(2, floor(sqrt(n)) + 1): if f(b, n) == s: print(b) exit...
34
31
554
519
from math import floor, sqrt, ceil def f(b, n): if b < 2: return 0 if n < b: return n return f(b, floor(n / b)) + n % b n = int(eval(input())) s = int(eval(input())) if n == s: print((n + 1)) exit() for b in range(2, floor(sqrt(n)) + 1): if f(b, n) == s: print(b) ...
from math import floor, sqrt, ceil def f(b, n): if n < b: return n return f(b, floor(n / b)) + n % b n = int(eval(input())) s = int(eval(input())) if n == s: print((n + 1)) exit() for b in range(2, floor(sqrt(n)) + 1): if f(b, n) == s: print(b) exit() for p in range(1, ce...
false
8.823529
[ "- if b < 2:", "- return 0" ]
false
0.210809
0.095545
2.20638
[ "s741321197", "s016299337" ]
u059684735
p03085
python
s843278594
s738913929
19
17
3,060
2,940
Accepted
Accepted
10.53
b = eval(input()) if b == 'A': print('T') elif b == 'T': print('A') elif b == 'G': print('C') else: print('G')
b = eval(input()) c = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'} print((c[b]))
9
3
128
70
b = eval(input()) if b == "A": print("T") elif b == "T": print("A") elif b == "G": print("C") else: print("G")
b = eval(input()) c = {"A": "T", "T": "A", "C": "G", "G": "C"} print((c[b]))
false
66.666667
[ "-if b == \"A\":", "- print(\"T\")", "-elif b == \"T\":", "- print(\"A\")", "-elif b == \"G\":", "- print(\"C\")", "-else:", "- print(\"G\")", "+c = {\"A\": \"T\", \"T\": \"A\", \"C\": \"G\", \"G\": \"C\"}", "+print((c[b]))" ]
false
0.048928
0.048223
1.014612
[ "s843278594", "s738913929" ]
u528470578
p03165
python
s168779604
s391311389
487
383
231,124
153,564
Accepted
Accepted
21.36
# LCS s = eval(input()) t = eval(input()) ls, lt = len(s), len(t) dp = [[0 for i in range(ls + 1)] for j in range(lt + 1)] prev = [[0 for i in range(ls + 1)] for j in range(lt + 1)] for i in range(lt): for j in range(ls): dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]) if t[i] == s[j]: ...
s, t = eval(input()), eval(input()) ls, lt = len(s), len(t) dp = [[0 for i in range(lt + 1)] for j in range(ls + 1)] for i in range(ls): for j in range(lt): dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]) if s[i] == t[j]: dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1) ans = [] while ...
26
20
623
547
# LCS s = eval(input()) t = eval(input()) ls, lt = len(s), len(t) dp = [[0 for i in range(ls + 1)] for j in range(lt + 1)] prev = [[0 for i in range(ls + 1)] for j in range(lt + 1)] for i in range(lt): for j in range(ls): dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]) if t[i] == s[j]: ...
s, t = eval(input()), eval(input()) ls, lt = len(s), len(t) dp = [[0 for i in range(lt + 1)] for j in range(ls + 1)] for i in range(ls): for j in range(lt): dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]) if s[i] == t[j]: dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1) ans = []...
false
23.076923
[ "-# LCS", "-s = eval(input())", "-t = eval(input())", "+s, t = eval(input()), eval(input())", "-dp = [[0 for i in range(ls + 1)] for j in range(lt + 1)]", "-prev = [[0 for i in range(ls + 1)] for j in range(lt + 1)]", "-for i in range(lt):", "- for j in range(ls):", "+dp = [[0 for i in range(lt +...
false
0.047964
0.047805
1.003318
[ "s168779604", "s391311389" ]
u528470578
p02640
python
s356107062
s059156335
117
25
27,204
9,120
Accepted
Accepted
78.63
import numpy X, Y = list(map(int, input().split())) if Y % 2 == 1: print("No") exit() nk = (Y-2*X)/2 nt = (4*X-Y)/2 if nk >= 0 and nt >= 0: print("Yes") else: print("No")
X, Y = list(map(int, input().split())) ans = "No" for a in range(X + 1): b = X - a if 2 * a + 4 * b == Y: ans = "Yes" print(ans)
12
7
192
144
import numpy X, Y = list(map(int, input().split())) if Y % 2 == 1: print("No") exit() nk = (Y - 2 * X) / 2 nt = (4 * X - Y) / 2 if nk >= 0 and nt >= 0: print("Yes") else: print("No")
X, Y = list(map(int, input().split())) ans = "No" for a in range(X + 1): b = X - a if 2 * a + 4 * b == Y: ans = "Yes" print(ans)
false
41.666667
[ "-import numpy", "-", "-if Y % 2 == 1:", "- print(\"No\")", "- exit()", "-nk = (Y - 2 * X) / 2", "-nt = (4 * X - Y) / 2", "-if nk >= 0 and nt >= 0:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+ans = \"No\"", "+for a in range(X + 1):", "+ b = X - a", "+ if 2 * a ...
false
0.063035
0.037785
1.668258
[ "s356107062", "s059156335" ]
u072407640
p03109
python
s448857099
s543145742
19
17
3,060
2,940
Accepted
Accepted
10.53
S = eval(input()) month = int(S[5] + S[6]) day = int(S[-2] + S[-1]) if month < 4: print("Heisei") elif month == 4 and day <= 30: print("Heisei") else: print("TBD")
day = eval(input()) if int(day[5:7]) < 5: print("Heisei") else: print("TBD")
13
5
186
78
S = eval(input()) month = int(S[5] + S[6]) day = int(S[-2] + S[-1]) if month < 4: print("Heisei") elif month == 4 and day <= 30: print("Heisei") else: print("TBD")
day = eval(input()) if int(day[5:7]) < 5: print("Heisei") else: print("TBD")
false
61.538462
[ "-S = eval(input())", "-month = int(S[5] + S[6])", "-day = int(S[-2] + S[-1])", "-if month < 4:", "- print(\"Heisei\")", "-elif month == 4 and day <= 30:", "+day = eval(input())", "+if int(day[5:7]) < 5:" ]
false
0.008193
0.056457
0.145116
[ "s448857099", "s543145742" ]
u252828980
p03221
python
s227429051
s829149611
916
620
58,780
49,660
Accepted
Accepted
32.31
a,b = list(map(int,input().split())) li = [] for i in range(b): li.append(input().split()) for i in range(b): li[i] = [int(x) for x in li[i]] li[i].append(i+1) li.sort() L = [] for i in range(a): L.append([]) for i in range(b): L[li[i][0]-1].append((li[i][0],li[i][1],li[i][2])) ans = []...
n,m = list(map(int,input().split())) L = [] for i in range(m): li = list(map(int,input().split())) L.append(li) li = [] for i,j in enumerate(L): li.append(j+[i]) li.sort(key = lambda x:(x[0],x[1])) li.append([0,0,0]) k,r = li[0][0],1 for i in range(m): if li[i][0] == k: if li[...
20
34
526
663
a, b = list(map(int, input().split())) li = [] for i in range(b): li.append(input().split()) for i in range(b): li[i] = [int(x) for x in li[i]] li[i].append(i + 1) li.sort() L = [] for i in range(a): L.append([]) for i in range(b): L[li[i][0] - 1].append((li[i][0], li[i][1], li[i][2])) ans = [] for ...
n, m = list(map(int, input().split())) L = [] for i in range(m): li = list(map(int, input().split())) L.append(li) li = [] for i, j in enumerate(L): li.append(j + [i]) li.sort(key=lambda x: (x[0], x[1])) li.append([0, 0, 0]) k, r = li[0][0], 1 for i in range(m): if li[i][0] == k: if li[i + 1][1]...
false
41.176471
[ "-a, b = list(map(int, input().split()))", "+n, m = list(map(int, input().split()))", "+L = []", "+for i in range(m):", "+ li = list(map(int, input().split()))", "+ L.append(li)", "-for i in range(b):", "- li.append(input().split())", "-for i in range(b):", "- li[i] = [int(x) for x in ...
false
0.041789
0.036938
1.131333
[ "s227429051", "s829149611" ]
u494058663
p02984
python
s703808433
s932915936
196
99
14,092
20,580
Accepted
Accepted
49.49
N = int(input()) A = [int(i) for i in input().split()] List = [0 for i in range(N)] Sum = 0 for i in range(1,N-1,2): Sum += A[i] List[0] = sum(A)-(2*Sum) for i in range(1,N): List[i] = 2*A[i-1]-List[i-1] for i in List: print(i,end=" ")
def main(): n = int(eval(input())) a = [int(i) for i in input().split()] s = sum(a) s1 = 0 for i in range(1,n,2): s1 += a[i] x1 = s-2*(s1) ans = [x1] for i in range(n-1): ans.append(2*a[i]-ans[-1]) print((*ans)) main()
12
14
259
280
N = int(input()) A = [int(i) for i in input().split()] List = [0 for i in range(N)] Sum = 0 for i in range(1, N - 1, 2): Sum += A[i] List[0] = sum(A) - (2 * Sum) for i in range(1, N): List[i] = 2 * A[i - 1] - List[i - 1] for i in List: print(i, end=" ")
def main(): n = int(eval(input())) a = [int(i) for i in input().split()] s = sum(a) s1 = 0 for i in range(1, n, 2): s1 += a[i] x1 = s - 2 * (s1) ans = [x1] for i in range(n - 1): ans.append(2 * a[i] - ans[-1]) print((*ans)) main()
false
14.285714
[ "-N = int(input())", "-A = [int(i) for i in input().split()]", "-List = [0 for i in range(N)]", "-Sum = 0", "-for i in range(1, N - 1, 2):", "- Sum += A[i]", "-List[0] = sum(A) - (2 * Sum)", "-for i in range(1, N):", "- List[i] = 2 * A[i - 1] - List[i - 1]", "-for i in List:", "- print(...
false
0.087204
0.069308
1.258204
[ "s703808433", "s932915936" ]
u863370423
p03264
python
s226984347
s049648396
19
17
2,940
2,940
Accepted
Accepted
10.53
k= int(eval(input())) if k% 2 == 0: print((int((k/2)**2))) elif k%2 ==1: print(((k//2)* (k-k//2)))
K=int(eval(input())) i=K//2 if (K%2==0): print((i**2)) else: print(((i**2)+i))
7
7
104
87
k = int(eval(input())) if k % 2 == 0: print((int((k / 2) ** 2))) elif k % 2 == 1: print(((k // 2) * (k - k // 2)))
K = int(eval(input())) i = K // 2 if K % 2 == 0: print((i**2)) else: print(((i**2) + i))
false
0
[ "-k = int(eval(input()))", "-if k % 2 == 0:", "- print((int((k / 2) ** 2)))", "-elif k % 2 == 1:", "- print(((k // 2) * (k - k // 2)))", "+K = int(eval(input()))", "+i = K // 2", "+if K % 2 == 0:", "+ print((i**2))", "+else:", "+ print(((i**2) + i))" ]
false
0.043428
0.043912
0.988968
[ "s226984347", "s049648396" ]
u738898077
p03546
python
s252050372
s530969892
208
33
12,756
3,444
Accepted
Accepted
84.13
import numpy as np h,w = list(map(int,input().split())) l = [list(map(int,input().split())) for i in range(10)] a = [list(map(int,input().split())) for i in range(h)] ans = 0 l = np.array(l) for rep in range(10): for i in range(10): for j in range(10): for k in range(10): ...
h,w = list(map(int,input().split())) l = [list(map(int,input().split())) for i in range(10)] a = [list(map(int,input().split())) for i in range(h)] ans = 0 for rep in range(10): for i in range(10): for j in range(10): for k in range(10): if l[i][j] > l[i][k]+l[k][j]: ...
17
15
490
452
import numpy as np h, w = list(map(int, input().split())) l = [list(map(int, input().split())) for i in range(10)] a = [list(map(int, input().split())) for i in range(h)] ans = 0 l = np.array(l) for rep in range(10): for i in range(10): for j in range(10): for k in range(10): if...
h, w = list(map(int, input().split())) l = [list(map(int, input().split())) for i in range(10)] a = [list(map(int, input().split())) for i in range(h)] ans = 0 for rep in range(10): for i in range(10): for j in range(10): for k in range(10): if l[i][j] > l[i][k] + l[k][j]: ...
false
11.764706
[ "-import numpy as np", "-", "-l = np.array(l)" ]
false
0.23159
0.050678
4.569825
[ "s252050372", "s530969892" ]
u930705402
p02708
python
s014011065
s963371503
122
73
9,148
9,180
Accepted
Accepted
40.16
N,K=list(map(int,input().split())) ans=0 for i in range(K,N+2): kos=((2*N-i+1)*i)//2-((i-1)*i)//2+1 ans=(ans+kos)%(10**9+7) print(ans)
N,K=list(map(int,input().split())) ans=0 for i in range(K,N+2): kos=i*(N-i+1)+1 ans=(ans+kos)%(10**9+7) print(ans)
6
6
141
121
N, K = list(map(int, input().split())) ans = 0 for i in range(K, N + 2): kos = ((2 * N - i + 1) * i) // 2 - ((i - 1) * i) // 2 + 1 ans = (ans + kos) % (10**9 + 7) print(ans)
N, K = list(map(int, input().split())) ans = 0 for i in range(K, N + 2): kos = i * (N - i + 1) + 1 ans = (ans + kos) % (10**9 + 7) print(ans)
false
0
[ "- kos = ((2 * N - i + 1) * i) // 2 - ((i - 1) * i) // 2 + 1", "+ kos = i * (N - i + 1) + 1" ]
false
0.069967
0.281174
0.24884
[ "s014011065", "s963371503" ]
u073549161
p02792
python
s794276187
s535729488
735
301
3,064
40,796
Accepted
Accepted
59.05
n = int(eval(input())) if n > 30: x = n // 10 basenum = x * x + 8 addnum = 0 #print("{0} {1}".format(x* 10 + 1, n)) hassame = False for i in range(x * 10 + 1, n+1): #print(i) for j in range(1, n+1): #print(j) if str(i)[0] == str(j)[-1] and str(i...
n = int(eval(input())) if n < 10: print(n) else: x = n // 10 basenum = x * x + 8 addnum = 0 # print("{0} {1}".format(x* 10 + 1, n)) hassame = False for i in range(x * 10 + 1, n + 1): # print(i) for j in range(1, n + 1): # print(j) if str(i...
30
23
879
681
n = int(eval(input())) if n > 30: x = n // 10 basenum = x * x + 8 addnum = 0 # print("{0} {1}".format(x* 10 + 1, n)) hassame = False for i in range(x * 10 + 1, n + 1): # print(i) for j in range(1, n + 1): # print(j) if str(i)[0] == str(j)[-1] and str(i)[-1...
n = int(eval(input())) if n < 10: print(n) else: x = n // 10 basenum = x * x + 8 addnum = 0 # print("{0} {1}".format(x* 10 + 1, n)) hassame = False for i in range(x * 10 + 1, n + 1): # print(i) for j in range(1, n + 1): # print(j) if str(i)[0] == str(j...
false
23.333333
[ "-if n > 30:", "+if n < 10:", "+ print(n)", "+else:", "-elif n == 1:", "- print((1))", "-else:", "- res = 0", "- for i in range(1, n):", "- for j in range(1, n):", "- if str(i)[0] == str(j)[-1] and str(i)[-1] == str(j)[0]:", "- res += 1", "- pr...
false
0.075306
0.037542
2.005908
[ "s794276187", "s535729488" ]
u281303342
p04046
python
s165369339
s756476304
1,497
374
10,868
26,740
Accepted
Accepted
75.02
H,W,A,B = list(map(int,input().split())) MOD = 10**9+7 fact = [1]*200001 t = 1 for i in range(1,200001): t = (t*i)%MOD fact[i] = t def ncr(n,r): return (fact[n] * pow(fact[r],MOD-2,MOD) % MOD) * pow(fact[n-r],MOD-2,MOD) % MOD Ans = 0 for i in range(H-A): Ans += ncr(i+B-1,i)*ncr(W-B+H-i-...
H,W,A,B = list(map(int,input().split())) def init_fact(n,mod): fact,finv,inv = [1]*n,[1]*n,[1]*n for i in range(2,n): fact[i] = (fact[i-1]*i) % mod inv[i] = mod - inv[mod%i] * (mod//i)%mod finv[i] = finv[i-1] * inv[i] % mod return (fact,finv,inv) def nCr(n,r,mod,fact,fin...
17
25
340
631
H, W, A, B = list(map(int, input().split())) MOD = 10**9 + 7 fact = [1] * 200001 t = 1 for i in range(1, 200001): t = (t * i) % MOD fact[i] = t def ncr(n, r): return ( (fact[n] * pow(fact[r], MOD - 2, MOD) % MOD) * pow(fact[n - r], MOD - 2, MOD) % MOD ) Ans = 0 for i in range...
H, W, A, B = list(map(int, input().split())) def init_fact(n, mod): fact, finv, inv = [1] * n, [1] * n, [1] * n for i in range(2, n): fact[i] = (fact[i - 1] * i) % mod inv[i] = mod - inv[mod % i] * (mod // i) % mod finv[i] = finv[i - 1] * inv[i] % mod return (fact, finv, inv) def...
false
32
[ "-MOD = 10**9 + 7", "-fact = [1] * 200001", "-t = 1", "-for i in range(1, 200001):", "- t = (t * i) % MOD", "- fact[i] = t", "-def ncr(n, r):", "- return (", "- (fact[n] * pow(fact[r], MOD - 2, MOD) % MOD)", "- * pow(fact[n - r], MOD - 2, MOD)", "- % MOD", "- )...
false
0.236002
0.293011
0.805436
[ "s165369339", "s756476304" ]
u951601135
p03711
python
s983735290
s456910244
21
17
3,064
2,940
Accepted
Accepted
19.05
group1=[1,3,5,7,8,10,12] group2=[4,6,9,11] group3=[2] a,b=list(map(int,input().split())) if(a==2 and b==2): print('Yes') elif(((a in group1) and (b in group1)) or ((a in group2) and (b in group2))): print('Yes') else:print('No')
a=[1,3,1,2,1,2,1,1,2,1,2,1] x,y=list(map(int,input().split())) print(("Yes" if a[x-1]==a[y-1] else "No"))
9
3
234
99
group1 = [1, 3, 5, 7, 8, 10, 12] group2 = [4, 6, 9, 11] group3 = [2] a, b = list(map(int, input().split())) if a == 2 and b == 2: print("Yes") elif ((a in group1) and (b in group1)) or ((a in group2) and (b in group2)): print("Yes") else: print("No")
a = [1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1] x, y = list(map(int, input().split())) print(("Yes" if a[x - 1] == a[y - 1] else "No"))
false
66.666667
[ "-group1 = [1, 3, 5, 7, 8, 10, 12]", "-group2 = [4, 6, 9, 11]", "-group3 = [2]", "-a, b = list(map(int, input().split()))", "-if a == 2 and b == 2:", "- print(\"Yes\")", "-elif ((a in group1) and (b in group1)) or ((a in group2) and (b in group2)):", "- print(\"Yes\")", "-else:", "- print...
false
0.043565
0.044131
0.98718
[ "s983735290", "s456910244" ]
u540761833
p03273
python
s655323794
s836745128
20
18
3,064
3,188
Accepted
Accepted
10
H,W = list(map(int,input().split())) mat = [] for i in range(H): a = list(eval(input())) if '#' in a: mat.append(a) answ = [] for i in range(W): flag = False for j in range(len(mat)): if mat[j][i] == '#': flag = True if flag: answ.append(i) for i in ...
H,W = list(map(int,input().split())) A = [] for i in range(H): a = list(eval(input())) if '#' in a: A.append(a) ans = [] for col in zip(*A): if '#' in col: ans.append(col) for i in zip(*ans): print((''.join(i)))
18
12
397
240
H, W = list(map(int, input().split())) mat = [] for i in range(H): a = list(eval(input())) if "#" in a: mat.append(a) answ = [] for i in range(W): flag = False for j in range(len(mat)): if mat[j][i] == "#": flag = True if flag: answ.append(i) for i in range(len(ma...
H, W = list(map(int, input().split())) A = [] for i in range(H): a = list(eval(input())) if "#" in a: A.append(a) ans = [] for col in zip(*A): if "#" in col: ans.append(col) for i in zip(*ans): print(("".join(i)))
false
33.333333
[ "-mat = []", "+A = []", "- mat.append(a)", "-answ = []", "-for i in range(W):", "- flag = False", "- for j in range(len(mat)):", "- if mat[j][i] == \"#\":", "- flag = True", "- if flag:", "- answ.append(i)", "-for i in range(len(mat)):", "- ans = [...
false
0.046896
0.045259
1.036152
[ "s655323794", "s836745128" ]
u226108478
p03361
python
s420095894
s363811754
24
22
3,064
3,064
Accepted
Accepted
8.33
# -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem C if __name__ == '__main__': h, w = list(map(int, input().split())) board = [list(map(str, eval(input()))) for _ in range(h)] dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] for i in range(h): for j in range(w): i...
# -*- coding: utf-8 -*- def main(): h, w = list(map(int, input().split())) board = [list(eval(input())) for _ in range(h)] dx = [0, 0, -1, 1] dy = [-1, 1, 0, 0] for i in range(h): for k in range(w): if board[i][k] == '#': count = 0 ...
28
30
726
670
# -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem C if __name__ == "__main__": h, w = list(map(int, input().split())) board = [list(map(str, eval(input()))) for _ in range(h)] dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] for i in range(h): for j in range(w): if board[i][j] ==...
# -*- coding: utf-8 -*- def main(): h, w = list(map(int, input().split())) board = [list(eval(input())) for _ in range(h)] dx = [0, 0, -1, 1] dy = [-1, 1, 0, 0] for i in range(h): for k in range(w): if board[i][k] == "#": count = 0 for m in range(4...
false
6.666667
[ "-# AtCoder Beginner Contest", "-# Problem C", "-if __name__ == \"__main__\":", "+def main():", "- board = [list(map(str, eval(input()))) for _ in range(h)]", "- dx = [1, 0, -1, 0]", "- dy = [0, 1, 0, -1]", "+ board = [list(eval(input())) for _ in range(h)]", "+ dx = [0, 0, -1, 1]", ...
false
0.083631
0.096005
0.871113
[ "s420095894", "s363811754" ]
u357751375
p03427
python
s685968810
s371998432
28
25
9,076
9,120
Accepted
Accepted
10.71
n = list(eval(input())) n = [int(i) for i in (n)] m = len(n) if m == 1: print((n[0])) else: flg = False for i in range(1,m): if n[i] != 9: flg = True break if flg: n[0] -= 1 for i in range(1,m): n[i] = 9 print((sum(n)))
n = list(eval(input())) n = [int(i) for i in (n)] m = len(n) if m == 1: print((n[0])) else: flg = False for i in range(1,m): if n[i] != 9: flg = True break if flg: print((n[0] - 1 + 9 * (m - 1))) else: print((sum(n)))
16
15
304
287
n = list(eval(input())) n = [int(i) for i in (n)] m = len(n) if m == 1: print((n[0])) else: flg = False for i in range(1, m): if n[i] != 9: flg = True break if flg: n[0] -= 1 for i in range(1, m): n[i] = 9 print((sum(n)))
n = list(eval(input())) n = [int(i) for i in (n)] m = len(n) if m == 1: print((n[0])) else: flg = False for i in range(1, m): if n[i] != 9: flg = True break if flg: print((n[0] - 1 + 9 * (m - 1))) else: print((sum(n)))
false
6.25
[ "- n[0] -= 1", "- for i in range(1, m):", "- n[i] = 9", "- print((sum(n)))", "+ print((n[0] - 1 + 9 * (m - 1)))", "+ else:", "+ print((sum(n)))" ]
false
0.048965
0.048632
1.006851
[ "s685968810", "s371998432" ]
u349091349
p02614
python
s249086712
s177543471
201
86
27,292
68,484
Accepted
Accepted
57.21
import numpy as np h,w,k = list(map(int,input().split())) c = np.zeros((h,w), dtype="int") f = lambda x: 1 if x=="#" else 0 for i in range(h): l=list(map(f,list(eval(input())))) c[i] = l sum_=(c.sum()) cc=0 for i in range(2 ** h): l=[] for j in range(h): if ((i >> j) & 1): ...
h,w,k=list(map(int,input().split())) c = [eval(input()) for _ in range(h)] ans = 0 for i in range(1<<h): for j in range(1<<w): cnt = 0 for x in range(h): for y in range(w): if (i>>x) & 1 and (j>>y) & 1 and c[x][y] == "#": cnt+=1 if cn...
33
13
812
348
import numpy as np h, w, k = list(map(int, input().split())) c = np.zeros((h, w), dtype="int") f = lambda x: 1 if x == "#" else 0 for i in range(h): l = list(map(f, list(eval(input())))) c[i] = l sum_ = c.sum() cc = 0 for i in range(2**h): l = [] for j in range(h): if (i >> j) & 1: ...
h, w, k = list(map(int, input().split())) c = [eval(input()) for _ in range(h)] ans = 0 for i in range(1 << h): for j in range(1 << w): cnt = 0 for x in range(h): for y in range(w): if (i >> x) & 1 and (j >> y) & 1 and c[x][y] == "#": cnt += 1 ...
false
60.606061
[ "-import numpy as np", "-", "-c = np.zeros((h, w), dtype=\"int\")", "-f = lambda x: 1 if x == \"#\" else 0", "-for i in range(h):", "- l = list(map(f, list(eval(input()))))", "- c[i] = l", "-sum_ = c.sum()", "-cc = 0", "-for i in range(2**h):", "- l = []", "- for j in range(h):", ...
false
0.302694
0.056387
5.368134
[ "s249086712", "s177543471" ]
u462329577
p03416
python
s418923673
s509243002
205
55
41,584
2,940
Accepted
Accepted
73.17
A,B = list(map(int,input().split())) #greedy O(B-A)*len(B)(=5) kaibun = 0 # num of kaibun for i in range(A,B+1,1): s = str(i) #print(s) for i in range(len(s)): if s[i] != s[len(s)-1-i]: break if i == len(s)-1: kaibun += 1 print(kaibun)
# 回文数になるA<= <=Bの数の個数 a,b = list(map(int,input().split())) ans = 0 for i in range(a,b+1,1): s = str(i) if s == s[::-1]: ans += 1 print(ans)
13
8
272
156
A, B = list(map(int, input().split())) # greedy O(B-A)*len(B)(=5) kaibun = 0 # num of kaibun for i in range(A, B + 1, 1): s = str(i) # print(s) for i in range(len(s)): if s[i] != s[len(s) - 1 - i]: break if i == len(s) - 1: kaibun += 1 print(kaibun)
# 回文数になるA<= <=Bの数の個数 a, b = list(map(int, input().split())) ans = 0 for i in range(a, b + 1, 1): s = str(i) if s == s[::-1]: ans += 1 print(ans)
false
38.461538
[ "-A, B = list(map(int, input().split()))", "-# greedy O(B-A)*len(B)(=5)", "-kaibun = 0 # num of kaibun", "-for i in range(A, B + 1, 1):", "+# 回文数になるA<= <=Bの数の個数", "+a, b = list(map(int, input().split()))", "+ans = 0", "+for i in range(a, b + 1, 1):", "- # print(s)", "- for i in range(len(s)...
false
0.052744
0.095394
0.552905
[ "s418923673", "s509243002" ]
u585482323
p02852
python
s950192264
s949169832
457
241
70,680
57,308
Accepted
Accepted
47.26
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline()...
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()] def I(): return int(sys.stdin.buffer.readline()) def LS...
72
59
1,602
1,393
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS(): return [list(x) for x in sys.stdin...
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()] def I(): return int(sys.stdin.buffer.readline()) d...
false
18.055556
[ "+from itertools import permutations, accumulate", "-import random", "- return [int(x) for x in sys.stdin.readline().split()]", "+ return [int(x) for x in sys.stdin.buffer.readline().split()]", "- return int(sys.stdin.readline())", "+ return int(sys.stdin.buffer.readline())", "- s = eval(...
false
0.04207
0.074354
0.565813
[ "s950192264", "s949169832" ]
u046187684
p03353
python
s997152345
s069432806
197
32
41,584
4,808
Accepted
Accepted
83.76
from collections import Counter def solve(string): s, k = string.split() """ g = [] for i in range(len(s)): for j in range(i + 1, len(s) + 1): g.append(s[i:j]) g = sorted(set(g)) return g[int(k)-1] """ k = int(k) count = Counter(s) chars = sor...
from collections import Counter def solve(string): s, k = string.split() k = int(k) count = Counter(s) chars = sorted(set(s)) for t in range(min(3, len(chars))): tmp = [] i = s.index(chars[t]) tmp.append(s[i:i + 5]) if count[chars[t]] > 1: f...
37
29
944
763
from collections import Counter def solve(string): s, k = string.split() """ g = [] for i in range(len(s)): for j in range(i + 1, len(s) + 1): g.append(s[i:j]) g = sorted(set(g)) return g[int(k)-1] """ k = int(k) count = Counter(s) chars = sorted(set(s)) ...
from collections import Counter def solve(string): s, k = string.split() k = int(k) count = Counter(s) chars = sorted(set(s)) for t in range(min(3, len(chars))): tmp = [] i = s.index(chars[t]) tmp.append(s[i : i + 5]) if count[chars[t]] > 1: for _ in ran...
false
21.621622
[ "- \"\"\"", "- g = []", "- for i in range(len(s)):", "- for j in range(i + 1, len(s) + 1):", "- g.append(s[i:j])", "- g = sorted(set(g))", "- return g[int(k)-1]", "- \"\"\"" ]
false
0.088493
0.046389
1.907641
[ "s997152345", "s069432806" ]
u532966492
p03062
python
s741697071
s098771979
61
56
14,208
14,412
Accepted
Accepted
8.2
N = int(eval(input())) A = list(map(int,input().split())) cnt = len([1 for i in range(N) if A[i] < 0]) SUM = sum(map(abs,A)) MIN = min(list(map(abs,A))) if cnt%2 == 0: print(SUM) else: print((SUM-2*MIN))
N=int(eval(input())) A=list(map(int,input().split())) print((sum(map(abs,A))-2*min(list(map(abs,A)))*(sum([1 for i in A if i<0])%2)))
11
3
209
121
N = int(eval(input())) A = list(map(int, input().split())) cnt = len([1 for i in range(N) if A[i] < 0]) SUM = sum(map(abs, A)) MIN = min(list(map(abs, A))) if cnt % 2 == 0: print(SUM) else: print((SUM - 2 * MIN))
N = int(eval(input())) A = list(map(int, input().split())) print( (sum(map(abs, A)) - 2 * min(list(map(abs, A))) * (sum([1 for i in A if i < 0]) % 2)) )
false
72.727273
[ "-cnt = len([1 for i in range(N) if A[i] < 0])", "-SUM = sum(map(abs, A))", "-MIN = min(list(map(abs, A)))", "-if cnt % 2 == 0:", "- print(SUM)", "-else:", "- print((SUM - 2 * MIN))", "+print(", "+ (sum(map(abs, A)) - 2 * min(list(map(abs, A))) * (sum([1 for i in A if i < 0]) % 2))", "+)"...
false
0.048471
0.047752
1.01506
[ "s741697071", "s098771979" ]
u041783158
p03039
python
s509469203
s700109998
83
68
10,856
3,064
Accepted
Accepted
18.07
def mfactorial(n: int, mod: int) -> int: cache = mfactorial.__cache if hasattr(mfactorial, '__cache') else [1, 1] n_len = len(cache) n_new = n - n_len + 1 if n_new > 0: cache = cache + ([0] * n_new) for i in range(n_len, n + 1): cache[i] = cache[i - 1] * i % mod mfactorial.__cache = ca...
def mod_combination(mod: int, n: int, r: int) -> int: a, b, c = mod_factorials(mod, [n, r, n - r]) return a * pow(b, mod - 2, mod) % mod * pow(c, mod - 2, mod) % mod def mod_factorials(mod: int, N: [int]) -> [int]: result = [1] * len(N) tuples = sorted([(i, n) for i, n in enumerate(N)], key=lambda t: t...
41
39
911
832
def mfactorial(n: int, mod: int) -> int: cache = mfactorial.__cache if hasattr(mfactorial, "__cache") else [1, 1] n_len = len(cache) n_new = n - n_len + 1 if n_new > 0: cache = cache + ([0] * n_new) for i in range(n_len, n + 1): cache[i] = cache[i - 1] * i % mod mfact...
def mod_combination(mod: int, n: int, r: int) -> int: a, b, c = mod_factorials(mod, [n, r, n - r]) return a * pow(b, mod - 2, mod) % mod * pow(c, mod - 2, mod) % mod def mod_factorials(mod: int, N: [int]) -> [int]: result = [1] * len(N) tuples = sorted([(i, n) for i, n in enumerate(N)], key=lambda t: ...
false
4.878049
[ "-def mfactorial(n: int, mod: int) -> int:", "- cache = mfactorial.__cache if hasattr(mfactorial, \"__cache\") else [1, 1]", "- n_len = len(cache)", "- n_new = n - n_len + 1", "- if n_new > 0:", "- cache = cache + ([0] * n_new)", "- for i in range(n_len, n + 1):", "- ...
false
0.089952
0.090322
0.9959
[ "s509469203", "s700109998" ]
u600402037
p02887
python
s713175021
s869381238
47
37
3,956
3,316
Accepted
Accepted
21.28
N = int(eval(input())) S = eval(input()) answer = [S[0]] for i in range(1, N): if S[i] != S[i-1]: answer.append(S[i]) print((len(answer)))
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() S = sr() answer = 1 for x, y in zip(S, S[1:]): if x != y: answer += 1 print(answer)
7
13
150
238
N = int(eval(input())) S = eval(input()) answer = [S[0]] for i in range(1, N): if S[i] != S[i - 1]: answer.append(S[i]) print((len(answer)))
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() S = sr() answer = 1 for x, y in zip(S, S[1:]): if x != y: answer += 1 print(answer)
false
46.153846
[ "-N = int(eval(input()))", "-S = eval(input())", "-answer = [S[0]]", "-for i in range(1, N):", "- if S[i] != S[i - 1]:", "- answer.append(S[i])", "-print((len(answer)))", "+import sys", "+", "+sr = lambda: sys.stdin.readline().rstrip()", "+ir = lambda: int(sr())", "+lr = lambda: list...
false
0.064364
0.075048
0.857627
[ "s713175021", "s869381238" ]
u614314290
p03162
python
s358791545
s375409405
1,068
591
47,320
47,344
Accepted
Accepted
44.66
N = int(eval(input())) ABC = [list(map(int, input().split())) for _ in range(N)] dp = [[0] * 3 for _ in range(N + 1)] for n in range(N): for j in range(3): for k in range(3): if j == k: continue dp[n + 1][j] = max([dp[n + 1][j], dp[n][k] + ABC[n][j]]) #print(dp) print((max(dp[N])))
N = int(eval(input())) ABC = [list(map(int, input().split())) for _ in range(N)] dp = [[0, 0, 0] for _ in range(N + 1)] for n, p in enumerate(ABC): dp[n + 1][0] = max(dp[n + 1][0], dp[n][1] + p[0], dp[n][2] + p[0]) dp[n + 1][1] = max(dp[n + 1][1], dp[n][0] + p[1], dp[n][2] + p[1]) dp[n + 1][2] = max(dp[n +...
13
14
303
414
N = int(eval(input())) ABC = [list(map(int, input().split())) for _ in range(N)] dp = [[0] * 3 for _ in range(N + 1)] for n in range(N): for j in range(3): for k in range(3): if j == k: continue dp[n + 1][j] = max([dp[n + 1][j], dp[n][k] + ABC[n][j]]) # print(dp) ...
N = int(eval(input())) ABC = [list(map(int, input().split())) for _ in range(N)] dp = [[0, 0, 0] for _ in range(N + 1)] for n, p in enumerate(ABC): dp[n + 1][0] = max(dp[n + 1][0], dp[n][1] + p[0], dp[n][2] + p[0]) dp[n + 1][1] = max(dp[n + 1][1], dp[n][0] + p[1], dp[n][2] + p[1]) dp[n + 1][2] = max(dp[n + ...
false
7.142857
[ "-dp = [[0] * 3 for _ in range(N + 1)]", "-for n in range(N):", "- for j in range(3):", "- for k in range(3):", "- if j == k:", "- continue", "- dp[n + 1][j] = max([dp[n + 1][j], dp[n][k] + ABC[n][j]])", "- # print(dp)", "-print((max(dp[N])))", "+d...
false
0.039756
0.04063
0.978513
[ "s358791545", "s375409405" ]
u572144347
p03096
python
s412246949
s948515332
550
484
27,548
31,644
Accepted
Accepted
12
N=int(eval(input())) clist=[-1] mod=10**9+7 for i in range(N): t=int(eval(input())) if t==clist[-1]: continue clist.append(t) del clist[0] N = len(clist) # print(clist) colorlast=[-1]*(3*10**5) poslp=[-1]*(N+1) for e,c in enumerate(clist,1): if colorlast[c] != -1: poslp[e]=col...
def solve(): # 方針 # 範囲で並べ方の個数を足し合わせるDP N = int(eval(input())) X = [int(eval(input())) for _ in range(N)] MOD = int(1e9)+7 colors = set() NoDouble = [-1] for x in X: colors.add(x) if x == NoDouble[-1]: continue NoDouble.append(x)...
38
52
587
1,160
N = int(eval(input())) clist = [-1] mod = 10**9 + 7 for i in range(N): t = int(eval(input())) if t == clist[-1]: continue clist.append(t) del clist[0] N = len(clist) # print(clist) colorlast = [-1] * (3 * 10**5) poslp = [-1] * (N + 1) for e, c in enumerate(clist, 1): if colorlast[c] != -1: ...
def solve(): # 方針 # 範囲で並べ方の個数を足し合わせるDP N = int(eval(input())) X = [int(eval(input())) for _ in range(N)] MOD = int(1e9) + 7 colors = set() NoDouble = [-1] for x in X: colors.add(x) if x == NoDouble[-1]: continue NoDouble.append(x) del NoDouble[0] ...
false
26.923077
[ "-N = int(eval(input()))", "-clist = [-1]", "-mod = 10**9 + 7", "-for i in range(N):", "- t = int(eval(input()))", "- if t == clist[-1]:", "- continue", "- clist.append(t)", "-del clist[0]", "-N = len(clist)", "-# print(clist)", "-colorlast = [-1] * (3 * 10**5)", "-poslp = [-...
false
0.056889
0.052955
1.074286
[ "s412246949", "s948515332" ]
u742013327
p02272
python
s168286308
s629152660
3,930
3,500
69,040
68,964
Accepted
Accepted
10.94
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_B&lang=jp sentinel = pow(10,9) + 1 def merge(target_list, left_index, mid_index,right_index): l = target_list[left_index:mid_index] + [sentinel] r = target_list[mid_index:right_index] + [sentinel] l_target, r_target, count = 0, 0, ...
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_B&lang=jp sentinel = pow(10,9) + 1 def merge(target_list, left_index, mid_index,right_index): l = target_list[left_index:mid_index] + [sentinel] r = target_list[mid_index:right_index] + [sentinel] l_target, r_target, count = 0, 0, ...
36
35
1,311
1,305
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_B&lang=jp sentinel = pow(10, 9) + 1 def merge(target_list, left_index, mid_index, right_index): l = target_list[left_index:mid_index] + [sentinel] r = target_list[mid_index:right_index] + [sentinel] l_target, r_target, count = 0, 0, 0 ...
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_B&lang=jp sentinel = pow(10, 9) + 1 def merge(target_list, left_index, mid_index, right_index): l = target_list[left_index:mid_index] + [sentinel] r = target_list[mid_index:right_index] + [sentinel] l_target, r_target, count = 0, 0, 0 ...
false
2.777778
[ "- count += 1", "- return count", "+ return l_target + r_target" ]
false
0.04142
0.095213
0.435021
[ "s168286308", "s629152660" ]
u022407960
p02238
python
s232170703
s174298811
30
20
7,812
7,796
Accepted
Accepted
33.33
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 6 1 2 2 3 2 2 3 4 3 1 5 4 1 6 5 1 6 6 0 output: 1 1 12 2 2 11 3 3 8 4 9 10 5 4 7 6 5 6 """ import sys UNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2 def generate_adj_matrix(v_info): for v_detail in v_info: v_index, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 6 1 2 2 3 2 2 3 4 3 1 5 4 1 6 5 1 6 6 0 output: 1 1 12 2 2 11 3 3 8 4 9 10 5 4 7 6 5 6 """ import sys UNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2 def generate_adj_matrix(v_info): for v_detail in v_info: v_index, ...
90
92
2,078
2,143
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 6 1 2 2 3 2 2 3 4 3 1 5 4 1 6 5 1 6 6 0 output: 1 1 12 2 2 11 3 3 8 4 9 10 5 4 7 6 5 6 """ import sys UNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2 def generate_adj_matrix(v_info): for v_detail in v_info: v_index, adj_num, *adj_list = list(map(...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 6 1 2 2 3 2 2 3 4 3 1 5 4 1 6 5 1 6 6 0 output: 1 1 12 2 2 11 3 3 8 4 9 10 5 4 7 6 5 6 """ import sys UNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2 def generate_adj_matrix(v_info): for v_detail in v_info: v_index, adj_num, *adj_list = list(map(...
false
2.173913
[ "- while len(stack) > 1:", "+ while stack:", "+ # if adj is None, current's adj(s) have been all visited", "- stack = [-1]", "+ stack = []", "- for k, v in enumerate(zip(d_time[1:], f_time[1:]), 1):", "- print((k, *v))", "+ for index, v in enumerate(zip(d_time[1:], f_ti...
false
0.037725
0.044254
0.852461
[ "s232170703", "s174298811" ]
u767664985
p02988
python
s406730893
s305286641
21
17
3,316
2,940
Accepted
Accepted
19.05
n = int(eval(input())) *p, = list(map(int, input().split())) ans = 0 for i in range(n - 2): if p[i] < p[i + 1] < p[i + 2] or p[i + 2] < p[i + 1]< p[i]: ans += 1 print(ans)
n = int(eval(input())) p = list(map(int, input().split())) ans = 0 for i in range(n - 2): if p[i] < p[i + 1] < p[i + 2] or p[i + 2] < p[i + 1]< p[i]: ans += 1 print(ans)
7
7
169
173
n = int(eval(input())) (*p,) = list(map(int, input().split())) ans = 0 for i in range(n - 2): if p[i] < p[i + 1] < p[i + 2] or p[i + 2] < p[i + 1] < p[i]: ans += 1 print(ans)
n = int(eval(input())) p = list(map(int, input().split())) ans = 0 for i in range(n - 2): if p[i] < p[i + 1] < p[i + 2] or p[i + 2] < p[i + 1] < p[i]: ans += 1 print(ans)
false
0
[ "-(*p,) = list(map(int, input().split()))", "+p = list(map(int, input().split()))" ]
false
0.047017
0.046868
1.003177
[ "s406730893", "s305286641" ]
u392319141
p03329
python
s009899572
s496095833
650
303
3,828
3,064
Accepted
Accepted
53.38
N = int(eval(input())) dp = [10**18] * (N + 1) dp[0] = 0 for i in range(N): prd = 6 while i + prd <= N: dp[i + prd] = min(dp[i + prd], dp[i] + 1) prd *= 6 prd = 9 while i + prd <= N: dp[i + prd] = min(dp[i + prd], dp[i] + 1) prd *= 9 ans = 10**18 for i,...
N = int(eval(input())) def digit(x, base): if x == 0: return 0 return digit(x // base, base) + x % base def calc(six, nine): return digit(six, 6) + digit(nine, 9) ans = 10**18 for six in range(N + 1): ans = min(ans, calc(six, N - six)) print(ans)
19
14
378
280
N = int(eval(input())) dp = [10**18] * (N + 1) dp[0] = 0 for i in range(N): prd = 6 while i + prd <= N: dp[i + prd] = min(dp[i + prd], dp[i] + 1) prd *= 6 prd = 9 while i + prd <= N: dp[i + prd] = min(dp[i + prd], dp[i] + 1) prd *= 9 ans = 10**18 for i, c in enumerate(dp)...
N = int(eval(input())) def digit(x, base): if x == 0: return 0 return digit(x // base, base) + x % base def calc(six, nine): return digit(six, 6) + digit(nine, 9) ans = 10**18 for six in range(N + 1): ans = min(ans, calc(six, N - six)) print(ans)
false
26.315789
[ "-dp = [10**18] * (N + 1)", "-dp[0] = 0", "-for i in range(N):", "- prd = 6", "- while i + prd <= N:", "- dp[i + prd] = min(dp[i + prd], dp[i] + 1)", "- prd *= 6", "- prd = 9", "- while i + prd <= N:", "- dp[i + prd] = min(dp[i + prd], dp[i] + 1)", "- prd ...
false
0.21869
0.165937
1.317911
[ "s009899572", "s496095833" ]
u006880673
p02642
python
s675757458
s484166513
430
200
113,764
149,876
Accepted
Accepted
53.49
N = int(eval(input())) A = [0] + list(map(int, input().split())) A.sort() A_max = A[-1] dp = [1] * (1 + A_max) from bisect import bisect_left, bisect_right for x in A[1:]: if dp[x] == 0: continue y = x * 2 while y <= A_max: dp[y] = 0 y += x ans = [] for i in range(1, ...
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) A.sort() A_max = A[-1] dp = [1]*(A_max+1) # dp[i] = 1: iはAのどの要素の倍数でもない # dp[i] = 0: iはAの要素の倍数である for a in A: if not dp[a]: continue y = a*2 while y <= A_max: dp[y] = 0 y += a # A...
24
26
543
520
N = int(eval(input())) A = [0] + list(map(int, input().split())) A.sort() A_max = A[-1] dp = [1] * (1 + A_max) from bisect import bisect_left, bisect_right for x in A[1:]: if dp[x] == 0: continue y = x * 2 while y <= A_max: dp[y] = 0 y += x ans = [] for i in range(1, A_max + 1): ...
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) A.sort() A_max = A[-1] dp = [1] * (A_max + 1) # dp[i] = 1: iはAのどの要素の倍数でもない # dp[i] = 0: iはAの要素の倍数である for a in A: if not dp[a]: continue y = a * 2 while y <= A_max: dp[y] = 0 y += a # Aの要素それぞれに...
false
7.692308
[ "+from collections import Counter", "+", "-A = [0] + list(map(int, input().split()))", "+A = list(map(int, input().split()))", "-dp = [1] * (1 + A_max)", "-from bisect import bisect_left, bisect_right", "-", "-for x in A[1:]:", "- if dp[x] == 0:", "+dp = [1] * (A_max + 1)", "+# dp[i] = 1: iはA...
false
0.083531
0.107607
0.776263
[ "s675757458", "s484166513" ]
u309716323
p03599
python
s349059598
s124472244
75
66
65,876
65,380
Accepted
Accepted
12
import math def read_int(): return int(input().strip()) def read_ints(): return list(map(int, input().strip().split(' '))) def solve(): # dp[i] - is True if i gram of sugar is obtainable A, B, C, D, E, F = read_ints() dp = [False]*(F+1) dp[0] = True for i in range(F+1):...
import math def read_int(): return int(input().strip()) def read_ints(): return list(map(int, input().strip().split(' '))) def solve(): # dp[i] - is True if i gram of sugar is obtainable A, B, C, D, E, F = read_ints() dp = [0]*(F+1) for i in range(1, F+1): dp[i] = d...
45
37
1,170
933
import math def read_int(): return int(input().strip()) def read_ints(): return list(map(int, input().strip().split(" "))) def solve(): # dp[i] - is True if i gram of sugar is obtainable A, B, C, D, E, F = read_ints() dp = [False] * (F + 1) dp[0] = True for i in range(F + 1): i...
import math def read_int(): return int(input().strip()) def read_ints(): return list(map(int, input().strip().split(" "))) def solve(): # dp[i] - is True if i gram of sugar is obtainable A, B, C, D, E, F = read_ints() dp = [0] * (F + 1) for i in range(1, F + 1): dp[i] = dp[i - 1] ...
false
17.777778
[ "- dp = [False] * (F + 1)", "- dp[0] = True", "- for i in range(F + 1):", "- if i + C < F + 1:", "- dp[i + C] = dp[i + C] or dp[i]", "- if i + D < F + 1:", "- dp[i + D] = dp[i + D] or dp[i]", "- # dp2[i] - highest gram of sugars that is not greater than ...
false
0.038354
0.043913
0.873399
[ "s349059598", "s124472244" ]
u265065462
p02711
python
s210558185
s357434012
25
22
8,944
8,872
Accepted
Accepted
12
n = str(eval(input())) ans=False for c in n: if c == '7': ans=True if ans: print("Yes") else: print("No")
n = eval(input()) if "7" in n: print("Yes") else: print("No")
9
6
118
70
n = str(eval(input())) ans = False for c in n: if c == "7": ans = True if ans: print("Yes") else: print("No")
n = eval(input()) if "7" in n: print("Yes") else: print("No")
false
33.333333
[ "-n = str(eval(input()))", "-ans = False", "-for c in n:", "- if c == \"7\":", "- ans = True", "-if ans:", "+n = eval(input())", "+if \"7\" in n:" ]
false
0.050394
0.048644
1.035968
[ "s210558185", "s357434012" ]
u683406607
p03095
python
s383360314
s811718616
158
25
12,600
3,444
Accepted
Accepted
84.18
import numpy as np N = int(eval(input())) S = eval(input()) unique_list = list(np.unique(S)) ans = 1 for s in unique_list: tmp = S.count(s) ans = ans * (tmp + 1) print(((ans-1) % int((1e9 + 7))))
import collections N = int(eval(input())) S = eval(input()) d = collections.Counter(S) ans = 1 for key in d: ans = ans * (d[key] + 1) print(((ans-1) % (10**9 +7)))
14
10
209
162
import numpy as np N = int(eval(input())) S = eval(input()) unique_list = list(np.unique(S)) ans = 1 for s in unique_list: tmp = S.count(s) ans = ans * (tmp + 1) print(((ans - 1) % int((1e9 + 7))))
import collections N = int(eval(input())) S = eval(input()) d = collections.Counter(S) ans = 1 for key in d: ans = ans * (d[key] + 1) print(((ans - 1) % (10**9 + 7)))
false
28.571429
[ "-import numpy as np", "+import collections", "-unique_list = list(np.unique(S))", "+d = collections.Counter(S)", "-for s in unique_list:", "- tmp = S.count(s)", "- ans = ans * (tmp + 1)", "-print(((ans - 1) % int((1e9 + 7))))", "+for key in d:", "+ ans = ans * (d[key] + 1)", "+print(((...
false
0.51545
0.035284
14.608729
[ "s383360314", "s811718616" ]
u600402037
p02734
python
s117788806
s506780986
525
306
82,268
13,324
Accepted
Accepted
41.71
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) MOD = 998244353 N, S = lr() A = lr() dp = [0] * (S+1) answer = 0 for a in A: dp[0] += 1 # Lの数は1個ずつ加わる prev = dp[:] for i in range(S-a+1): dp[i+a] += prev[i] an...
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) MOD = 998244353 N, S = lr() A = lr() dp = np.array([0] * (S+1), dtype=np.int64) answer = 0 for a in A: dp[0] += 1 # Lの数は1個ずつ加わる prev = dp.copy() dp[a:] +...
20
21
377
411
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) MOD = 998244353 N, S = lr() A = lr() dp = [0] * (S + 1) answer = 0 for a in A: dp[0] += 1 # Lの数は1個ずつ加わる prev = dp[:] for i in range(S - a + 1): dp[i + a] += prev[i] answer += ...
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) MOD = 998244353 N, S = lr() A = lr() dp = np.array([0] * (S + 1), dtype=np.int64) answer = 0 for a in A: dp[0] += 1 # Lの数は1個ずつ加わる prev = dp.copy() dp[a:] += prev[:-a] ...
false
4.761905
[ "+import numpy as np", "-dp = [0] * (S + 1)", "+dp = np.array([0] * (S + 1), dtype=np.int64)", "- prev = dp[:]", "- for i in range(S - a + 1):", "- dp[i + a] += prev[i]", "+ prev = dp.copy()", "+ dp[a:] += prev[:-a]", "+ dp %= MOD" ]
false
0.045604
0.196252
0.232374
[ "s117788806", "s506780986" ]
u102461423
p03744
python
s467501094
s446270843
2,233
1,772
114,712
143,840
Accepted
Accepted
20.64
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # 各日に対して、関数:残量 -> 最適な熱量 を持つことを考える # これは折れ線。傾きが増加する部分 → マージしてまとめる # 常に、傾きの減少列の形で持つことになる from collections import deque N,L = list(map(int,readline().split())) m = list(map(int,read().split())...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # 各日に対して、関数:残量 -> 最適な熱量 を持つことを考える # これは折れ線。傾きが増加する部分 → マージしてまとめる # 常に、傾きの減少列の形で持つことになる from collections import deque N,L = list(map(int,readline().split())) m = list(map(int,read().split())...
48
46
1,041
988
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # 各日に対して、関数:残量 -> 最適な熱量 を持つことを考える # これは折れ線。傾きが増加する部分 → マージしてまとめる # 常に、傾きの減少列の形で持つことになる from collections import deque N, L = list(map(int, readline().split())) m = list(map(int, read().split())) TV = lis...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # 各日に対して、関数:残量 -> 最適な熱量 を持つことを考える # これは折れ線。傾きが増加する部分 → マージしてまとめる # 常に、傾きの減少列の形で持つことになる from collections import deque N, L = list(map(int, readline().split())) m = list(map(int, read().split())) TV = lis...
false
4.166667
[ "-answer.append(t)", "+print(t)", "- answer.append(sum_q / L)", "-print((\"\\n\".join(map(str, answer))))", "+ print((sum_q / L))" ]
false
0.122112
0.040033
3.050291
[ "s467501094", "s446270843" ]
u926046014
p02732
python
s764561901
s126173516
1,018
593
158,168
117,760
Accepted
Accepted
41.75
from math import factorial n=int(eval(input())) cnt=[0]*(n+1) lst=list(map(int,input().split())) tmp=[0]*(n+1) change=[0]*(n+1) for i in lst: cnt[i]+=1 ans=0 for i in range(n+1): p=cnt[i] if p>=2: q=factorial(p)//factorial(p-2)//2 ans+=q tmp[i]=q if p>=3: ...
from math import factorial n=int(eval(input())) cnt=[0]*(n+1) lst=list(map(int,input().split())) for i in lst: cnt[i]+=1 ans=0 for i in range(n+1): p=cnt[i] if p>=2: ans+=factorial(p)//factorial(p-2)//2 for i in range(n): print((ans-cnt[lst[i]]+1))
19
13
420
276
from math import factorial n = int(eval(input())) cnt = [0] * (n + 1) lst = list(map(int, input().split())) tmp = [0] * (n + 1) change = [0] * (n + 1) for i in lst: cnt[i] += 1 ans = 0 for i in range(n + 1): p = cnt[i] if p >= 2: q = factorial(p) // factorial(p - 2) // 2 ans += q tm...
from math import factorial n = int(eval(input())) cnt = [0] * (n + 1) lst = list(map(int, input().split())) for i in lst: cnt[i] += 1 ans = 0 for i in range(n + 1): p = cnt[i] if p >= 2: ans += factorial(p) // factorial(p - 2) // 2 for i in range(n): print((ans - cnt[lst[i]] + 1))
false
31.578947
[ "-tmp = [0] * (n + 1)", "-change = [0] * (n + 1)", "- q = factorial(p) // factorial(p - 2) // 2", "- ans += q", "- tmp[i] = q", "- if p >= 3:", "- change[i] = factorial(p - 1) // factorial(p - 3) // 2", "+ ans += factorial(p) // factorial(p - 2) // 2", "- pri...
false
0.11576
0.13405
0.863558
[ "s764561901", "s126173516" ]
u282228874
p03014
python
s293444436
s509760027
1,593
1,467
278,280
244,872
Accepted
Accepted
7.91
H,W = list(map(int,input().split())) S = [list(eval(input())) for i in range(H)] #print(S) dpyoko = [[1]*(W) for i in range(H)] for j in range(W): for i in range(H): if S[i][j] == '#': dpyoko[i][j] = 0 else: if j != 0: dpyoko[i][j] += dpyoko[i][j-1] ...
H,W = list(map(int,input().split())) S = [list(eval(input())) for i in range(H)] dpyoko = [[1]*(W) for i in range(H)] for j in range(W): for i in range(H): if S[i][j] == '#': dpyoko[i][j] = 0 else: if j != 0: dpyoko[i][j] += dpyoko[i][j-1] for j in r...
43
37
1,208
1,060
H, W = list(map(int, input().split())) S = [list(eval(input())) for i in range(H)] # print(S) dpyoko = [[1] * (W) for i in range(H)] for j in range(W): for i in range(H): if S[i][j] == "#": dpyoko[i][j] = 0 else: if j != 0: dpyoko[i][j] += dpyoko[i][j - 1] dpt...
H, W = list(map(int, input().split())) S = [list(eval(input())) for i in range(H)] dpyoko = [[1] * (W) for i in range(H)] for j in range(W): for i in range(H): if S[i][j] == "#": dpyoko[i][j] = 0 else: if j != 0: dpyoko[i][j] += dpyoko[i][j - 1] for j in range...
false
13.953488
[ "-# print(S)", "+for j in range(W - 1, -1, -1):", "+ for i in range(H):", "+ if dpyoko[i][j] == 0:", "+ continue", "+ if j == W - 1:", "+ continue", "+ dpyoko[i][j] = max(dpyoko[i][j], dpyoko[i][j + 1])", "-for j in range(W - 1, -1, -1):", "- for i ...
false
0.047943
0.035652
1.344738
[ "s293444436", "s509760027" ]
u923668099
p02240
python
s133592640
s650525792
520
390
26,960
27,628
Accepted
Accepted
25
import sys from collections import deque def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def paint_col(adj, cols, i, col): nxt = deque([i]) while nxt: u = nxt.popl...
import sys from collections import deque def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def paint_col(adj, cols, i, col): nxt = deque([i]) while nxt: u = nxt.popl...
50
50
1,061
1,113
import sys from collections import deque def debug(x, table): for name, val in table.items(): if x is val: print("DEBUG:{} -> {}".format(name, val), file=sys.stderr) return None def paint_col(adj, cols, i, col): nxt = deque([i]) while nxt: u = nxt.popleft() ...
import sys from collections import deque def debug(x, table): for name, val in table.items(): if x is val: print("DEBUG:{} -> {}".format(name, val), file=sys.stderr) return None def paint_col(adj, cols, i, col): nxt = deque([i]) while nxt: u = nxt.popleft() ...
false
0
[ "- n, m = map(int, input().split())", "+ n, m = map(int, sys.stdin.readline().split())", "- s, t = map(int, input().split())", "+ s, t = map(int, sys.stdin.readline().split())", "- q = int(input())", "+ q = int(sys.stdin.readline())", "- s, t = map(int, input().split())"...
false
0.118414
0.190797
0.620627
[ "s133592640", "s650525792" ]
u546285759
p00020
python
s618681505
s087514793
30
20
7,332
7,432
Accepted
Accepted
33.33
print((input().swapcase()))
print(("".join(list(map(str.upper, eval(input()))))))
1
1
25
45
print((input().swapcase()))
print(("".join(list(map(str.upper, eval(input()))))))
false
0
[ "-print((input().swapcase()))", "+print((\"\".join(list(map(str.upper, eval(input()))))))" ]
false
0.035457
0.034442
1.029451
[ "s618681505", "s087514793" ]
u497952650
p02623
python
s573642806
s838123631
296
168
131,212
126,876
Accepted
Accepted
43.24
from bisect import bisect from collections import deque N,M,K = list(map(int,input().split())) A = list(map(int,input().split())) B = list(map(int,input().split())) csumA = [0] csumB = [0] s = 0 for i in A: s += i csumA.append(s) s = 0 for i in B: s += i csumB.append(s) ans = 0 f...
N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) a, b = [0], [0] for i in range(N): a.append(a[i] + A[i]) for i in range(M): b.append(b[i] + B[i]) ans, j = 0, M for i in range(N + 1): if a[i] > K: break while b[j] > K - a[i]:...
31
18
605
363
from bisect import bisect from collections import deque N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) csumA = [0] csumB = [0] s = 0 for i in A: s += i csumA.append(s) s = 0 for i in B: s += i csumB.append(s) ans = 0 for i in range(N + ...
N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) a, b = [0], [0] for i in range(N): a.append(a[i] + A[i]) for i in range(M): b.append(b[i] + B[i]) ans, j = 0, M for i in range(N + 1): if a[i] > K: break while b[j] > K - a[i]: ...
false
41.935484
[ "-from bisect import bisect", "-from collections import deque", "-", "-csumA = [0]", "-csumB = [0]", "-s = 0", "-for i in A:", "- s += i", "- csumA.append(s)", "-s = 0", "-for i in B:", "- s += i", "- csumB.append(s)", "-ans = 0", "+a, b = [0], [0]", "+for i in range(N):", ...
false
0.083263
0.04691
1.774952
[ "s573642806", "s838123631" ]