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
u102461423
p02793
python
s051850583
s091018512
579
327
5,880
22,480
Accepted
Accepted
43.52
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from fractions import gcd from functools import reduce N,*A = list(map(int,read().split())) MOD = 10 ** 9 + 7 lcm = reduce(lambda x,y: y//gcd(x,y)*x, A) lcm %= MOD coef = sum(pow(x, MO...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) A = np.array(read().split(),np.int64) MOD = 10 ** 9 + 7 U = 10 ** 6 + 10 is_prime = np.zeros(U, np.bool) is_prime[2] = 1 is_prime[3::2] = 1 for p...
19
43
379
823
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from fractions import gcd from functools import reduce N, *A = list(map(int, read().split())) MOD = 10**9 + 7 lcm = reduce(lambda x, y: y // gcd(x, y) * x, A) lcm %= MOD coef = sum(pow(x, MOD - 2, MOD) ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) A = np.array(read().split(), np.int64) MOD = 10**9 + 7 U = 10**6 + 10 is_prime = np.zeros(U, np.bool) is_prime[2] = 1 is_prime[3::2] = 1 for p in range(3, U, 2): ...
false
55.813953
[ "-from fractions import gcd", "-from functools import reduce", "+import numpy as np", "-N, *A = list(map(int, read().split()))", "+N = int(readline())", "+A = np.array(read().split(), np.int64)", "-lcm = reduce(lambda x, y: y // gcd(x, y) * x, A)", "-lcm %= MOD", "-coef = sum(pow(x, MOD - 2, MOD) fo...
false
0.119151
0.574012
0.207575
[ "s051850583", "s091018512" ]
u088063513
p03449
python
s926836900
s257629993
69
18
3,064
3,064
Accepted
Accepted
73.91
## coding: UTF-8 N = int(eval(input())) s = input().split() l1 = [int(p) for p in s] s2 = input().split() l2 = [int(p) for p in s2] #print(N) #print(l1) #print(l2) #print(sum(l1[2:])) def Cumulative_sum(l): output_list = [] for i in range(len(l)): output_list.append(sum(l[:i+1])) r...
## coding: UTF-8 #累積和 N = int(eval(input())) U = list(map(int,input().split())) D = list(map(int,input().split())) U = U[::-1] D = D[::-1] up = 0 down = 0 upper = [0] downer = [] for i in range(N): up += U[i] down += D[i] upper.append(up) downer.append(down) upper = upper[::-1] down...
71
28
1,429
475
## coding: UTF-8 N = int(eval(input())) s = input().split() l1 = [int(p) for p in s] s2 = input().split() l2 = [int(p) for p in s2] # print(N) # print(l1) # print(l2) # print(sum(l1[2:])) def Cumulative_sum(l): output_list = [] for i in range(len(l)): output_list.append(sum(l[: i + 1])) return outpu...
## coding: UTF-8 # 累積和 N = int(eval(input())) U = list(map(int, input().split())) D = list(map(int, input().split())) U = U[::-1] D = D[::-1] up = 0 down = 0 upper = [0] downer = [] for i in range(N): up += U[i] down += D[i] upper.append(up) downer.append(down) upper = upper[::-1] downer = downer[::-1] ...
false
60.56338
[ "+# 累積和", "-s = input().split()", "-l1 = [int(p) for p in s]", "-s2 = input().split()", "-l2 = [int(p) for p in s2]", "-# print(N)", "-# print(l1)", "-# print(l2)", "-# print(sum(l1[2:]))", "-def Cumulative_sum(l):", "- output_list = []", "- for i in range(len(l)):", "- output_l...
false
0.061199
0.033479
1.827945
[ "s926836900", "s257629993" ]
u620084012
p04045
python
s532313812
s021350638
1,282
189
7,396
39,408
Accepted
Accepted
85.26
N, K = list(map(int,input().split())) D = list(map(str, input().split())) while True: S = str(N) t = 0 for x in S: if x not in D: t += 1 if t == len(S): print(S) break else: N += 1
import sys, math def input(): return sys.stdin.readline()[:-1] def main(): N, K = list(map(int,input().split())) D = set(list(input().split())) for k in range(N,100001): s = str(k) f = 0 for e in s: if e in D: f = 1 brea...
14
21
253
421
N, K = list(map(int, input().split())) D = list(map(str, input().split())) while True: S = str(N) t = 0 for x in S: if x not in D: t += 1 if t == len(S): print(S) break else: N += 1
import sys, math def input(): return sys.stdin.readline()[:-1] def main(): N, K = list(map(int, input().split())) D = set(list(input().split())) for k in range(N, 100001): s = str(k) f = 0 for e in s: if e in D: f = 1 break ...
false
33.333333
[ "-N, K = list(map(int, input().split()))", "-D = list(map(str, input().split()))", "-while True:", "- S = str(N)", "- t = 0", "- for x in S:", "- if x not in D:", "- t += 1", "- if t == len(S):", "- print(S)", "- break", "- else:", "- N +...
false
0.042567
0.040641
1.047399
[ "s532313812", "s021350638" ]
u620868411
p03006
python
s277825011
s408891763
1,101
22
3,064
3,444
Accepted
Accepted
98
# -*- coding: utf-8 -*- n = int(eval(input())) xy = [list(map(int, input().split())) for _ in range(n)] if n==1: print((1)) exit() def cost(p,q): e = 0 for i in range(n): for j in range(n): v = xy[i] u = xy[j] if p==u[0]-v[0] and q==u[1]-v[1]: ...
# -*- coding: utf-8 -*- n = int(eval(input())) xy = [list(map(int, input().split())) for _ in range(n)] if n==1: print((1)) exit() def cost(p,q): e = 0 for i in range(n): for j in range(n): v = xy[i] u = xy[j] if p==u[0]-v[0] and q==u[1]-v[1]: ...
29
39
577
723
# -*- coding: utf-8 -*- n = int(eval(input())) xy = [list(map(int, input().split())) for _ in range(n)] if n == 1: print((1)) exit() def cost(p, q): e = 0 for i in range(n): for j in range(n): v = xy[i] u = xy[j] if p == u[0] - v[0] and q == u[1] - v[1]: ...
# -*- coding: utf-8 -*- n = int(eval(input())) xy = [list(map(int, input().split())) for _ in range(n)] if n == 1: print((1)) exit() def cost(p, q): e = 0 for i in range(n): for j in range(n): v = xy[i] u = xy[j] if p == u[0] - v[0] and q == u[1] - v[1]: ...
false
25.641026
[ "-res = 10**9", "+d = {}", "- res = min(res, cost(v[0] - u[0], v[1] - u[1]))", "-print(res)", "+ p = v[0] - u[0]", "+ q = v[1] - u[1]", "+ if (p, q) not in d:", "+ d[", "+ (", "+ p,", "+ q,", "+ ...
false
0.044093
0.044539
0.989972
[ "s277825011", "s408891763" ]
u499381410
p02599
python
s422854921
s813206830
1,952
1,119
297,364
208,636
Accepted
Accepted
42.67
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, ...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, ...
77
70
1,953
1,831
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fro...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor fro...
false
9.090909
[ "- Q[l - 1] += [(False, i)]", "- Q[r - 1] += [(True, i)]", "+ Q[r - 1] += [(i, l - 1)]", "- for flg, qi in Q[i]:", "- if flg:", "- ans[qi] = bit.sum(i) - bit.sum(DD[qi] - 1)", "- else:", "- DD[qi] = i", "-# print(q_now, \"b\")", "+ for qi, li i...
false
0.046134
0.137423
0.335709
[ "s422854921", "s813206830" ]
u537782349
p02975
python
s617522903
s543011238
72
65
14,228
14,212
Accepted
Accepted
9.72
a = int(eval(input())) b = list(map(int, input().split())) c = {} for i in range(a): if b[i] not in c: c.setdefault(b[i], 1) else: c[b[i]] += 1 if len(c) == 3: f = list(c.values()) for i in range(1, len(f)): if f[i] != f[i-1]: print("No") ...
a = int(eval(input())) b = list(map(int, input().split())) e = {} for i in b: if i not in e: e[i] = 1 else: e[i] += 1 if len(e) > 3: print("No") elif len(e) == 3: x, y, z = list(map(int, list(e.keys()))) xx, yy, zz = list(map(int, list(e.values()))) if x ^ y == z and...
40
30
815
720
a = int(eval(input())) b = list(map(int, input().split())) c = {} for i in range(a): if b[i] not in c: c.setdefault(b[i], 1) else: c[b[i]] += 1 if len(c) == 3: f = list(c.values()) for i in range(1, len(f)): if f[i] != f[i - 1]: print("No") exit() g = ...
a = int(eval(input())) b = list(map(int, input().split())) e = {} for i in b: if i not in e: e[i] = 1 else: e[i] += 1 if len(e) > 3: print("No") elif len(e) == 3: x, y, z = list(map(int, list(e.keys()))) xx, yy, zz = list(map(int, list(e.values()))) if x ^ y == z and y ^ z == x a...
false
25
[ "-c = {}", "-for i in range(a):", "- if b[i] not in c:", "- c.setdefault(b[i], 1)", "+e = {}", "+for i in b:", "+ if i not in e:", "+ e[i] = 1", "- c[b[i]] += 1", "-if len(c) == 3:", "- f = list(c.values())", "- for i in range(1, len(f)):", "- if f[i] ...
false
0.03401
0.034748
0.978749
[ "s617522903", "s543011238" ]
u260216890
p02901
python
s996383111
s108208314
341
204
46,552
107,868
Accepted
Accepted
40.18
N,M= list(map(int, input().split())) INF = float("inf") key = [] for i in range(M): a, b = list(map(int, input().split())) f = 0 for c in list(map(int, input().split())): c -= 1 f |= 1 << c key.append((f, a)) dp = [INF] * (1 << N) dp[0] = 0 for f in range(1 << N): f...
n,m=list(map(int,input().split())) INF=10**10 dp=[[INF]*(1<<n) for _ in range(m+1)] for i in range(m+1): dp[i][0]=0 a=[0] key=[0] for i in range(m): a0,b=list(map(int,input().split())) a.append(a0) *c,=list(map(int,input().split())) tmp=0 for j in c: tmp+=1<<(j-1) key.a...
24
26
481
589
N, M = list(map(int, input().split())) INF = float("inf") key = [] for i in range(M): a, b = list(map(int, input().split())) f = 0 for c in list(map(int, input().split())): c -= 1 f |= 1 << c key.append((f, a)) dp = [INF] * (1 << N) dp[0] = 0 for f in range(1 << N): for i in range(M)...
n, m = list(map(int, input().split())) INF = 10**10 dp = [[INF] * (1 << n) for _ in range(m + 1)] for i in range(m + 1): dp[i][0] = 0 a = [0] key = [0] for i in range(m): a0, b = list(map(int, input().split())) a.append(a0) (*c,) = list(map(int, input().split())) tmp = 0 for j in c: tmp ...
false
7.692308
[ "-N, M = list(map(int, input().split()))", "-INF = float(\"inf\")", "-key = []", "-for i in range(M):", "- a, b = list(map(int, input().split()))", "- f = 0", "- for c in list(map(int, input().split())):", "- c -= 1", "- f |= 1 << c", "- key.append((f, a))", "-dp = [INF...
false
0.047595
0.042717
1.114203
[ "s996383111", "s108208314" ]
u254871849
p02887
python
s725550468
s219615524
41
32
3,316
3,316
Accepted
Accepted
21.95
n = int(eval(input())) s = eval(input()) ans = 1 current = s[0] for i in range(n): if current != s[i]: ans += 1 current = s[i] print(ans)
# 2019-11-19 10:28:31(JST) import sys # import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r # import itertools # from functools import reduce # import operator as op # import re # import heapq # import a...
12
28
155
629
n = int(eval(input())) s = eval(input()) ans = 1 current = s[0] for i in range(n): if current != s[i]: ans += 1 current = s[i] print(ans)
# 2019-11-19 10:28:31(JST) import sys # import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r # import itertools # from functools import reduce # import operator as op # import re # import heapq # import array # fro...
false
57.142857
[ "-n = int(eval(input()))", "-s = eval(input())", "-ans = 1", "-current = s[0]", "-for i in range(n):", "- if current != s[i]:", "- ans += 1", "- current = s[i]", "-print(ans)", "+# 2019-11-19 10:28:31(JST)", "+import sys", "+", "+# import collections", "+# import math", ...
false
0.056381
0.054654
1.031604
[ "s725550468", "s219615524" ]
u670961163
p02880
python
s776159699
s454232989
185
170
38,384
38,256
Accepted
Accepted
8.11
x = int(eval(input())) count =0 for n in range(1, 10): for k in range(1, 10): a = n * k if a == x: count += 1 break else: pass if count > 0: print('Yes') else: print('No')
x = int(eval(input())) count =0 for n in range(1, 10): for k in range(1, 10): a = n * k if a == x: print('Yes') exit() else: pass print('No')
15
12
252
211
x = int(eval(input())) count = 0 for n in range(1, 10): for k in range(1, 10): a = n * k if a == x: count += 1 break else: pass if count > 0: print("Yes") else: print("No")
x = int(eval(input())) count = 0 for n in range(1, 10): for k in range(1, 10): a = n * k if a == x: print("Yes") exit() else: pass print("No")
false
20
[ "- count += 1", "- break", "+ print(\"Yes\")", "+ exit()", "-if count > 0:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+print(\"No\")" ]
false
0.078351
0.091924
0.852348
[ "s776159699", "s454232989" ]
u225388820
p02755
python
s872115542
s204455779
334
204
3,064
2,940
Accepted
Accepted
38.92
a,b=list(map(int,input().split())) for i in range(10**6): if int(i*0.08)==a and int(i*0.1)==b: print(i) exit() print((-1))
a,b=list(map(int,input().split())) for i in range(10**6): if i*8//100==a and i//10==b: print(i) exit() print((-1))
6
6
139
131
a, b = list(map(int, input().split())) for i in range(10**6): if int(i * 0.08) == a and int(i * 0.1) == b: print(i) exit() print((-1))
a, b = list(map(int, input().split())) for i in range(10**6): if i * 8 // 100 == a and i // 10 == b: print(i) exit() print((-1))
false
0
[ "- if int(i * 0.08) == a and int(i * 0.1) == b:", "+ if i * 8 // 100 == a and i // 10 == b:" ]
false
0.553677
0.618811
0.894743
[ "s872115542", "s204455779" ]
u600402037
p02834
python
s381438693
s014501892
621
536
32,460
32,432
Accepted
Accepted
13.69
import sys from heapq import heapify, heappop, heappush sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, U, V = lr() graph = [[] for _ in range(N+1)] # 1-indexed for _ in range(N-1): a, b = lr() graph[a].append(b) graph[b].append(a)...
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, U, V = lr() graph = [[] for _ in range(N+1)] # 1-indexed for _ in range(N-1): a, b = lr() graph[a].append(b) graph[b].append(a) def dfs(start): # 木グラフの時 dist = [-1] ...
35
30
846
692
import sys from heapq import heapify, heappop, heappush sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, U, V = lr() graph = [[] for _ in range(N + 1)] # 1-indexed for _ in range(N - 1): a, b = lr() graph[a].append(b) graph[b].append(a) def d...
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, U, V = lr() graph = [[] for _ in range(N + 1)] # 1-indexed for _ in range(N - 1): a, b = lr() graph[a].append(b) graph[b].append(a) def dfs(start): # 木グラフの時 dist = [-1] * (N + 1...
false
14.285714
[ "-from heapq import heapify, heappop, heappush", "-def dijkstra(start):", "- INF = 10**15", "- dist = [INF] * (N + 1)", "+def dfs(start): # 木グラフの時", "+ dist = [-1] * (N + 1)", "- que = [(0, start)]", "- while que:", "- d, prev = heappop(que)", "- if dist[prev] < d:", ...
false
0.045421
0.040596
1.11885
[ "s381438693", "s014501892" ]
u254871849
p03722
python
s155609414
s696674579
1,205
1,037
3,444
3,316
Accepted
Accepted
13.94
import sys inf = float('inf') n, m = list(map(int, sys.stdin.readline().split())) a = [] b = [] c = [] for _ in range(m): ai, bi, ci = list(map(int, sys.stdin.readline().split())) a.append(ai - 1) b.append(bi - 1) c.append(-ci) abc = list(zip(a, b, c)) def main(): dist = [inf] * n...
import sys inf = float('inf') n, m = list(map(int, sys.stdin.readline().split())) abc = [] for _ in range(m): a, b, c = list(map(int, sys.stdin.readline().split())) abc.append((a-1, b-1, -c)) def main(): dist = [inf] * n dist[0] = 0 for _ in range(n-1): for a, b, c in abc: ...
36
27
702
570
import sys inf = float("inf") n, m = list(map(int, sys.stdin.readline().split())) a = [] b = [] c = [] for _ in range(m): ai, bi, ci = list(map(int, sys.stdin.readline().split())) a.append(ai - 1) b.append(bi - 1) c.append(-ci) abc = list(zip(a, b, c)) def main(): dist = [inf] * n dist[0] = 0...
import sys inf = float("inf") n, m = list(map(int, sys.stdin.readline().split())) abc = [] for _ in range(m): a, b, c = list(map(int, sys.stdin.readline().split())) abc.append((a - 1, b - 1, -c)) def main(): dist = [inf] * n dist[0] = 0 for _ in range(n - 1): for a, b, c in abc: ...
false
25
[ "-a = []", "-b = []", "-c = []", "+abc = []", "- ai, bi, ci = list(map(int, sys.stdin.readline().split()))", "- a.append(ai - 1)", "- b.append(bi - 1)", "- c.append(-ci)", "-abc = list(zip(a, b, c))", "+ a, b, c = list(map(int, sys.stdin.readline().split()))", "+ abc.append((a ...
false
0.064661
0.066226
0.976363
[ "s155609414", "s696674579" ]
u413021823
p02813
python
s610754315
s448289073
196
35
44,656
13,920
Accepted
Accepted
82.14
# https://atcoder.jp/contests/abc150/tasks/abc150_c import sys from itertools import * def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline()....
import sys import itertools def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) N = I() P = tuple(LI()) Q = tuple(LI()) li = list...
30
17
512
436
# https://atcoder.jp/contests/abc150/tasks/abc150_c import sys from itertools import * def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline(...
import sys import itertools def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) N = I() P = tuple(LI()) Q = tuple(LI(...
false
43.333333
[ "-# https://atcoder.jp/contests/abc150/tasks/abc150_c", "-from itertools import *", "-", "-", "-def S():", "- return sys.stdin.readline().rstrip()", "+import itertools", "+def S():", "+ return sys.stdin.readline().rstrip()", "+", "+", "-p = tuple(LI())", "-q = tuple(LI())", "-all = l...
false
0.048973
0.084836
0.577263
[ "s610754315", "s448289073" ]
u332906195
p03563
python
s392904381
s783974667
173
17
38,608
2,940
Accepted
Accepted
90.17
R = int(eval(input())) G = int(eval(input())) print((2 * G - R))
R, G = int(eval(input())), int(eval(input())) print((2 * G - R))
3
2
53
52
R = int(eval(input())) G = int(eval(input())) print((2 * G - R))
R, G = int(eval(input())), int(eval(input())) print((2 * G - R))
false
33.333333
[ "-R = int(eval(input()))", "-G = int(eval(input()))", "+R, G = int(eval(input())), int(eval(input()))" ]
false
0.038175
0.046627
0.818732
[ "s392904381", "s783974667" ]
u906569502
p03163
python
s514968004
s245099740
130
114
69,112
68,492
Accepted
Accepted
12.31
n,W=list(map(int,input().split())) dp=[0]*(W+1) for i in range(n): w,v=list(map(int,input().split())) for j in range(W,-1,-1): cw=j+w cv=dp[j]+v if cw <=W and dp[cw]<cv: dp[cw]=cv print((dp[W]))
n,W=list(map(int,input().split())) dp=[0]*(W+1) for _ in range(n): w,v=list(map(int,input().split())) for j in range(W-w,-1,-1): dp[j+w]=max(dp[j+w],dp[j]+v) print((dp[W]))
10
7
200
168
n, W = list(map(int, input().split())) dp = [0] * (W + 1) for i in range(n): w, v = list(map(int, input().split())) for j in range(W, -1, -1): cw = j + w cv = dp[j] + v if cw <= W and dp[cw] < cv: dp[cw] = cv print((dp[W]))
n, W = list(map(int, input().split())) dp = [0] * (W + 1) for _ in range(n): w, v = list(map(int, input().split())) for j in range(W - w, -1, -1): dp[j + w] = max(dp[j + w], dp[j] + v) print((dp[W]))
false
30
[ "-for i in range(n):", "+for _ in range(n):", "- for j in range(W, -1, -1):", "- cw = j + w", "- cv = dp[j] + v", "- if cw <= W and dp[cw] < cv:", "- dp[cw] = cv", "+ for j in range(W - w, -1, -1):", "+ dp[j + w] = max(dp[j + w], dp[j] + v)" ]
false
0.047213
0.073009
0.646682
[ "s514968004", "s245099740" ]
u186838327
p02780
python
s249359188
s418366999
278
250
86,792
83,592
Accepted
Accepted
10.07
n, k = list(map(int, input().split())) l = list(map(int, input().split())) e = [0]*n for i in range(n): e[i] = (l[i]+1)/2 from itertools import accumulate a = [0] + e b = list(accumulate(a)) ans = 0 for i in range(n-k+1): ans = max(ans, b[i+k]-b[i]) print(ans)
n, k = list(map(int, input().split())) P =list(map(int, input().split())) P = [(p+1)/2 for p in P] from itertools import accumulate Q = [0]+P Q = list(accumulate(Q)) ans = 0 for i in range(n-k+1): ans = max(ans, Q[i+k]-Q[i]) print(ans)
16
13
277
249
n, k = list(map(int, input().split())) l = list(map(int, input().split())) e = [0] * n for i in range(n): e[i] = (l[i] + 1) / 2 from itertools import accumulate a = [0] + e b = list(accumulate(a)) ans = 0 for i in range(n - k + 1): ans = max(ans, b[i + k] - b[i]) print(ans)
n, k = list(map(int, input().split())) P = list(map(int, input().split())) P = [(p + 1) / 2 for p in P] from itertools import accumulate Q = [0] + P Q = list(accumulate(Q)) ans = 0 for i in range(n - k + 1): ans = max(ans, Q[i + k] - Q[i]) print(ans)
false
18.75
[ "-l = list(map(int, input().split()))", "-e = [0] * n", "-for i in range(n):", "- e[i] = (l[i] + 1) / 2", "+P = list(map(int, input().split()))", "+P = [(p + 1) / 2 for p in P]", "-a = [0] + e", "-b = list(accumulate(a))", "+Q = [0] + P", "+Q = list(accumulate(Q))", "- ans = max(ans, b[i +...
false
0.175135
0.162347
1.078773
[ "s249359188", "s418366999" ]
u571524394
p02659
python
s601696103
s785354502
67
56
61,792
61,664
Accepted
Accepted
16.42
a, b = input(). split() a = int(a) b = int(float(b)*100+0.5) print((a*b//100))
a, b = input(). split() a = int(a) b = int(float(b)*100+0.1) print((a*b//100))
4
4
79
79
a, b = input().split() a = int(a) b = int(float(b) * 100 + 0.5) print((a * b // 100))
a, b = input().split() a = int(a) b = int(float(b) * 100 + 0.1) print((a * b // 100))
false
0
[ "-b = int(float(b) * 100 + 0.5)", "+b = int(float(b) * 100 + 0.1)" ]
false
0.046498
0.142061
0.327309
[ "s601696103", "s785354502" ]
u057964173
p03481
python
s985869221
s038856539
167
17
38,256
2,940
Accepted
Accepted
89.82
import sys def input(): return sys.stdin.readline().strip() def resolve(): x,y=list(map(int, input().split())) cnt=0 while x<=y: x=x*2 cnt+=1 print(cnt) resolve()
import sys def input(): return sys.stdin.readline().strip() def resolve(): x,y=list(map(int, input().split())) cnt=1 while x<=y: x*=2 cnt+=1 print((cnt-1)) resolve()
11
11
199
200
import sys def input(): return sys.stdin.readline().strip() def resolve(): x, y = list(map(int, input().split())) cnt = 0 while x <= y: x = x * 2 cnt += 1 print(cnt) resolve()
import sys def input(): return sys.stdin.readline().strip() def resolve(): x, y = list(map(int, input().split())) cnt = 1 while x <= y: x *= 2 cnt += 1 print((cnt - 1)) resolve()
false
0
[ "- cnt = 0", "+ cnt = 1", "- x = x * 2", "+ x *= 2", "- print(cnt)", "+ print((cnt - 1))" ]
false
0.116653
0.043193
2.700738
[ "s985869221", "s038856539" ]
u067299340
p00008
python
s810346539
s040811692
20
10
5,248
4,192
Accepted
Accepted
50
import sys,itertools k=range(10) s=[0]*51 for n in [sum(x)for x in list(itertools.product(k,k,k,k))]:s[n]+=1 for l in sys.stdin:print(s[int(l)])
import sys s=[0]*51 for a in range(10): for b in range(10): for c in range(10): for d in range(10): s[a+b+c+d]+=1 for l in sys.stdin:print(s[int(l)])
5
8
148
165
import sys, itertools k = range(10) s = [0] * 51 for n in [sum(x) for x in list(itertools.product(k, k, k, k))]: s[n] += 1 for l in sys.stdin: print(s[int(l)])
import sys s = [0] * 51 for a in range(10): for b in range(10): for c in range(10): for d in range(10): s[a + b + c + d] += 1 for l in sys.stdin: print(s[int(l)])
false
37.5
[ "-import sys, itertools", "+import sys", "-k = range(10)", "-for n in [sum(x) for x in list(itertools.product(k, k, k, k))]:", "- s[n] += 1", "+for a in range(10):", "+ for b in range(10):", "+ for c in range(10):", "+ for d in range(10):", "+ s[a + b + c + d...
false
0.051283
0.049581
1.034328
[ "s810346539", "s040811692" ]
u872191059
p03634
python
s610118816
s783855379
1,588
1,466
88,208
52,196
Accepted
Accepted
7.68
from collections import deque n = int(eval(input())) gr = { i:[] for i in range(1, n + 1)} for _ in range(n - 1): a, b, c = list(map(int, input().split())) gr[a].append((b, c)) gr[b].append((a, c)) q, k = list(map(int, input().split())) dmax = 10**14 + 1 dist = [dmax for _ in range(n + 1)] dist[...
from collections import deque n = int(eval(input())) gr = { i:[] for i in range(1, n + 1)} for _ in range(n - 1): a, b, c = list(map(int, input().split())) gr[a].append((b, c)) gr[b].append((a, c)) q, k = list(map(int, input().split())) dmax = 10**14 + 1 dist = [dmax for _ in range(n + 1)] dist[...
24
23
582
571
from collections import deque n = int(eval(input())) gr = {i: [] for i in range(1, n + 1)} for _ in range(n - 1): a, b, c = list(map(int, input().split())) gr[a].append((b, c)) gr[b].append((a, c)) q, k = list(map(int, input().split())) dmax = 10**14 + 1 dist = [dmax for _ in range(n + 1)] dist[k] = 0 ls =...
from collections import deque n = int(eval(input())) gr = {i: [] for i in range(1, n + 1)} for _ in range(n - 1): a, b, c = list(map(int, input().split())) gr[a].append((b, c)) gr[b].append((a, c)) q, k = list(map(int, input().split())) dmax = 10**14 + 1 dist = [dmax for _ in range(n + 1)] dist[k] = 0 ls =...
false
4.166667
[ "- u = ls[0]", "+ u = ls.popleft()", "- ls.popleft()" ]
false
0.04927
0.046789
1.053022
[ "s610118816", "s783855379" ]
u394482932
p03447
python
s874742075
s593787541
164
17
38,256
2,940
Accepted
Accepted
89.63
x,a,b=list(map(int,[eval(input())for i in range(3)]));print(((x-a)%b))
x,a,b=list(map(int,[eval(input())for i in[0]*3]));print(((x-a)%b))
1
1
56
52
x, a, b = list(map(int, [eval(input()) for i in range(3)])) print(((x - a) % b))
x, a, b = list(map(int, [eval(input()) for i in [0] * 3])) print(((x - a) % b))
false
0
[ "-x, a, b = list(map(int, [eval(input()) for i in range(3)]))", "+x, a, b = list(map(int, [eval(input()) for i in [0] * 3]))" ]
false
0.043398
0.044242
0.980938
[ "s874742075", "s593787541" ]
u753803401
p03386
python
s205515786
s860657671
184
165
38,384
38,384
Accepted
Accepted
10.33
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 a, b, k = list(map(int, readline().split())) res = [] for i in range(a, min(a + k, b + 1)): if i not in res: res.append(i) for i in range(b, max(b - k, a - 1), -1): if i not i...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 a, b, k = list(map(int, readline().split())) res = [] for i in range(a, min(a + k, b + 1)): res.append(i) for i in range(b, max(b - k, a - 1), -1): if i not in res: res.append...
20
18
442
404
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 a, b, k = list(map(int, readline().split())) res = [] for i in range(a, min(a + k, b + 1)): if i not in res: res.append(i) for i in range(b, max(b - k, a - 1), -1): if i not in res: ...
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10**9 + 7 a, b, k = list(map(int, readline().split())) res = [] for i in range(a, min(a + k, b + 1)): res.append(i) for i in range(b, max(b - k, a - 1), -1): if i not in res: res.append(i) print(...
false
10
[ "- if i not in res:", "- res.append(i)", "+ res.append(i)", "- res.sort()", "- print(*res, sep=\"\\n\")", "+ print(*sorted(res), sep=\"\\n\")" ]
false
0.036554
0.035305
1.035379
[ "s205515786", "s860657671" ]
u485716382
p02743
python
s045703094
s399309411
36
17
5,076
2,940
Accepted
Accepted
52.78
from decimal import Decimal def main(): a,b,c = list(map(int, input().split(" "))) if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt(): print('Yes') else: print('No') main()
def main(): a,b,c = list(map(int, input().split(" "))) if (4 * a * b) < (c - a - b) * (c - a - b) and (c - a - b) > 0: print('Yes') else: print('No') main()
10
8
215
186
from decimal import Decimal def main(): a, b, c = list(map(int, input().split(" "))) if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt(): print("Yes") else: print("No") main()
def main(): a, b, c = list(map(int, input().split(" "))) if (4 * a * b) < (c - a - b) * (c - a - b) and (c - a - b) > 0: print("Yes") else: print("No") main()
false
20
[ "-from decimal import Decimal", "-", "-", "- if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():", "+ if (4 * a * b) < (c - a - b) * (c - a - b) and (c - a - b) > 0:" ]
false
0.041375
0.047173
0.877093
[ "s045703094", "s399309411" ]
u846226907
p02678
python
s391023569
s766666471
720
558
41,888
41,696
Accepted
Accepted
22.5
#Dequeを用いたBFS from collections import deque N,M = list(map(int,input().split())) r = [[] for i in range(N+1)] #ノードの初期化 for i in range(M): a,b = list(map(int,input().split())) r[a].append(b) r[b].append(a) miteru = deque([1]) #見てる要素 mita = {1} #見た要素 res = [-1]*(N+1) while miteru: ...
import sys input = sys.stdin.readline #Dequeを用いたBFS from collections import deque N,M = list(map(int,input().split())) r = [[] for i in range(N+1)] #ノードの初期化 for i in range(M): a,b = list(map(int,input().split())) r[a].append(b) r[b].append(a) miteru = deque([1]) #見てる要素 mita = {1} #見...
30
34
550
594
# Dequeを用いたBFS from collections import deque N, M = list(map(int, input().split())) r = [[] for i in range(N + 1)] # ノードの初期化 for i in range(M): a, b = list(map(int, input().split())) r[a].append(b) r[b].append(a) miteru = deque([1]) # 見てる要素 mita = {1} # 見た要素 res = [-1] * (N + 1) while miteru: now = ...
import sys input = sys.stdin.readline # Dequeを用いたBFS from collections import deque N, M = list(map(int, input().split())) r = [[] for i in range(N + 1)] # ノードの初期化 for i in range(M): a, b = list(map(int, input().split())) r[a].append(b) r[b].append(a) miteru = deque([1]) # 見てる要素 mita = {1} # 見た要素 res = ...
false
11.764706
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.092563
0.090298
1.02508
[ "s391023569", "s766666471" ]
u514390882
p03031
python
s891840872
s665263837
56
44
3,064
9,224
Accepted
Accepted
21.43
n, m = list(map(int, input().split())) ks = [] for i in range(m): ks.append(list(map(int, input().split()))) p = list(map(int, input().split())) ans = 0 for i in range(1<<n): #全部分集合について all_flug = True for j in range(m): #全電球(パターン)について cnt = 0 for k in range(n): #全スイッチについて ...
N, M = list(map(int, input().split())) s_lst = [[False] * N for _ in range(M)] for i in range(M): ks = list(map(int, input().split())) for j, value in enumerate(ks): if j != 0: s_lst[i][value-1] = True p = list(map(int, input().split())) # print(s_lst) ans = 0 for bit in range(...
23
26
740
636
n, m = list(map(int, input().split())) ks = [] for i in range(m): ks.append(list(map(int, input().split()))) p = list(map(int, input().split())) ans = 0 for i in range(1 << n): # 全部分集合について all_flug = True for j in range(m): # 全電球(パターン)について cnt = 0 for k in range(n): # 全スイッチについて ...
N, M = list(map(int, input().split())) s_lst = [[False] * N for _ in range(M)] for i in range(M): ks = list(map(int, input().split())) for j, value in enumerate(ks): if j != 0: s_lst[i][value - 1] = True p = list(map(int, input().split())) # print(s_lst) ans = 0 for bit in range(2**N): c...
false
11.538462
[ "-n, m = list(map(int, input().split()))", "-ks = []", "-for i in range(m):", "- ks.append(list(map(int, input().split())))", "+N, M = list(map(int, input().split()))", "+s_lst = [[False] * N for _ in range(M)]", "+for i in range(M):", "+ ks = list(map(int, input().split()))", "+ for j, val...
false
0.037075
0.037633
0.985185
[ "s891840872", "s665263837" ]
u415905784
p03325
python
s078244895
s907145708
143
89
7,424
3,828
Accepted
Accepted
37.76
import functools N = int(eval(input())) A = [int(x) for x in input().split()] P = functools.reduce(lambda a,b: a*b, A) print((len(bin(P).split('1')[-1])))
N = int(eval(input())) k = 0 for a in map(int, input().split()): while a % 2 == 0: k += 1 a //= 2 print(k)
5
7
150
116
import functools N = int(eval(input())) A = [int(x) for x in input().split()] P = functools.reduce(lambda a, b: a * b, A) print((len(bin(P).split("1")[-1])))
N = int(eval(input())) k = 0 for a in map(int, input().split()): while a % 2 == 0: k += 1 a //= 2 print(k)
false
28.571429
[ "-import functools", "-", "-A = [int(x) for x in input().split()]", "-P = functools.reduce(lambda a, b: a * b, A)", "-print((len(bin(P).split(\"1\")[-1])))", "+k = 0", "+for a in map(int, input().split()):", "+ while a % 2 == 0:", "+ k += 1", "+ a //= 2", "+print(k)" ]
false
0.043025
0.044099
0.975638
[ "s078244895", "s907145708" ]
u425177436
p02684
python
s610121286
s018808786
347
134
60,492
32,376
Accepted
Accepted
61.38
n, k = list(map(int, input().split())) a = list(map(int, input().split())) b = {i:[] for i in range(n)} ans = 0 for i in range(k): b[a[ans]-1].append(ans) if len(b[a[ans]-1]) == 2: c = [ans] ans = a[ans]-1 while ans != c[0]: c.append(ans) ans = a[ans]-1...
n, k = list(map(int, input().split())) a = list(map(int, input().split())) s = [-1]*n c = [] ans = 0 for i in range(k): s[ans] = i c.append(ans) ans = a[ans] - 1 if s[ans] >= 0: t = i - s[ans] + 1 ans = c[(k-i-1) % t + s[ans]] break print((ans+1))
16
14
396
292
n, k = list(map(int, input().split())) a = list(map(int, input().split())) b = {i: [] for i in range(n)} ans = 0 for i in range(k): b[a[ans] - 1].append(ans) if len(b[a[ans] - 1]) == 2: c = [ans] ans = a[ans] - 1 while ans != c[0]: c.append(ans) ans = a[ans] - 1 ...
n, k = list(map(int, input().split())) a = list(map(int, input().split())) s = [-1] * n c = [] ans = 0 for i in range(k): s[ans] = i c.append(ans) ans = a[ans] - 1 if s[ans] >= 0: t = i - s[ans] + 1 ans = c[(k - i - 1) % t + s[ans]] break print((ans + 1))
false
12.5
[ "-b = {i: [] for i in range(n)}", "+s = [-1] * n", "+c = []", "- b[a[ans] - 1].append(ans)", "- if len(b[a[ans] - 1]) == 2:", "- c = [ans]", "- ans = a[ans] - 1", "- while ans != c[0]:", "- c.append(ans)", "- ans = a[ans] - 1", "- ans = c[(...
false
0.041498
0.038206
1.086178
[ "s610121286", "s018808786" ]
u434630332
p03697
python
s756288833
s811749666
27
24
8,992
9,160
Accepted
Accepted
11.11
a, b = list(map(int, input().split())) answer = a + b if answer >= 10: print('error') else: print(answer)
a, b = list(map(int, input().split())) if a + b >= 10: print('error') else: print((a + b))
8
6
116
96
a, b = list(map(int, input().split())) answer = a + b if answer >= 10: print("error") else: print(answer)
a, b = list(map(int, input().split())) if a + b >= 10: print("error") else: print((a + b))
false
25
[ "-answer = a + b", "-if answer >= 10:", "+if a + b >= 10:", "- print(answer)", "+ print((a + b))" ]
false
0.035974
0.037453
0.960518
[ "s756288833", "s811749666" ]
u902577051
p03077
python
s897609806
s732752001
1,314
169
22,304
38,512
Accepted
Accepted
87.14
# -*- coding: utf-8 -*- import sys import numpy as np def get_num(): return int(eval(input())) def get_nums(n): res = [0 for _ in range(n)] for i in range(n): res[i] = int(eval(input())) return res def get_numbers(): return list(map(int, input().split())) n = get_nu...
# -*- coding: utf-8 -*- import sys import math def get_num(): return int(eval(input())) def get_nums(n): res = [0 for _ in range(n)] for i in range(n): res[i] = int(eval(input())) return res def get_numbers(): return list(map(int, input().split())) n = get_num() co...
27
27
439
434
# -*- coding: utf-8 -*- import sys import numpy as np def get_num(): return int(eval(input())) def get_nums(n): res = [0 for _ in range(n)] for i in range(n): res[i] = int(eval(input())) return res def get_numbers(): return list(map(int, input().split())) n = get_num() costs = get_nu...
# -*- coding: utf-8 -*- import sys import math def get_num(): return int(eval(input())) def get_nums(n): res = [0 for _ in range(n)] for i in range(n): res[i] = int(eval(input())) return res def get_numbers(): return list(map(int, input().split())) n = get_num() costs = get_nums(5) m...
false
0
[ "-import numpy as np", "+import math", "- max_time = max(max_time, int(np.ceil(n / cost)))", "+ max_time = max(max_time, int(math.ceil(n / cost)))" ]
false
0.20976
0.059918
3.5008
[ "s897609806", "s732752001" ]
u395252999
p02629
python
s766593848
s335188228
37
31
9,044
8,980
Accepted
Accepted
16.22
def main(): N = int(eval(input())) - 1 digits = [] while True: a, b = N // 26, N % 26 if a == 0: digits.append(b) break digits.append(b) N = a - 1 digits.reverse() chars = list(map(to_alphabet, digits)) print((''.join(chars)...
def main(): N = int(eval(input())) - 1 digits = [] while True: a, b = N // 26, N % 26 digits.append(b) if a == 0: break N = a - 1 digits.reverse() chars = list(map(to_alphabet, digits)) print((''.join(chars))) def to_alphabet(x: int...
23
22
415
385
def main(): N = int(eval(input())) - 1 digits = [] while True: a, b = N // 26, N % 26 if a == 0: digits.append(b) break digits.append(b) N = a - 1 digits.reverse() chars = list(map(to_alphabet, digits)) print(("".join(chars))) def to_alph...
def main(): N = int(eval(input())) - 1 digits = [] while True: a, b = N // 26, N % 26 digits.append(b) if a == 0: break N = a - 1 digits.reverse() chars = list(map(to_alphabet, digits)) print(("".join(chars))) def to_alphabet(x: int): return chr(...
false
4.347826
[ "+ digits.append(b)", "- digits.append(b)", "- digits.append(b)" ]
false
0.045471
0.042845
1.061283
[ "s766593848", "s335188228" ]
u777283665
p03339
python
s007809394
s256340136
748
171
43,596
3,700
Accepted
Accepted
77.14
n = int(eval(input())) s = eval(input()) w, e = 0, 0 cumsum = [] for i in range(n): if s[i] == "W": w += 1 cumsum.append([w, e]) else: e += 1 cumsum.append([w, e]) ans = 10 ** 6 for i in range(n): if s[i] == "W": r = cumsum[-1][1] - cumsum[i][1] ...
n = int(eval(input())) s = eval(input()) sum_e = s.count("E") sum_w = s.count("W") cnt_e, cnt_w = 0, 0 ans = 10 ** 6 for x in s: if x == "E": cnt_e += 1 ans = min(ans, cnt_w + (sum_e - cnt_e)) if x == "W": ans = min(ans, cnt_w + (sum_e - cnt_e)) cnt_w += 1 pr...
25
18
496
316
n = int(eval(input())) s = eval(input()) w, e = 0, 0 cumsum = [] for i in range(n): if s[i] == "W": w += 1 cumsum.append([w, e]) else: e += 1 cumsum.append([w, e]) ans = 10**6 for i in range(n): if s[i] == "W": r = cumsum[-1][1] - cumsum[i][1] l = cumsum[i][0]...
n = int(eval(input())) s = eval(input()) sum_e = s.count("E") sum_w = s.count("W") cnt_e, cnt_w = 0, 0 ans = 10**6 for x in s: if x == "E": cnt_e += 1 ans = min(ans, cnt_w + (sum_e - cnt_e)) if x == "W": ans = min(ans, cnt_w + (sum_e - cnt_e)) cnt_w += 1 print(ans)
false
28
[ "-w, e = 0, 0", "-cumsum = []", "-for i in range(n):", "- if s[i] == \"W\":", "- w += 1", "- cumsum.append([w, e])", "- else:", "- e += 1", "- cumsum.append([w, e])", "+sum_e = s.count(\"E\")", "+sum_w = s.count(\"W\")", "+cnt_e, cnt_w = 0, 0", "-for i in ra...
false
0.082194
0.115688
0.710477
[ "s007809394", "s256340136" ]
u400765446
p02255
python
s164681028
s184205694
30
20
5,972
5,600
Accepted
Accepted
33.33
def main(): n = int(input()) Mtx = list(map(int, input().split())) showMtx(Mtx) for i in range(1,n): for j in range(i,0,-1): if Mtx[j] < Mtx[j-1]: Mtx[j-1], Mtx[j] = Mtx[j], Mtx[j-1] else: break # print(i, j, sep...
n = int(eval(input())) A = input().split() print((' '.join(A))) for i in range(1,n): for j in range(i,0,-1): if int(A[j]) < int(A[j-1]): A[j], A[j-1] = A[j-1], A[j] print((' '.join(A)))
28
10
593
215
def main(): n = int(input()) Mtx = list(map(int, input().split())) showMtx(Mtx) for i in range(1, n): for j in range(i, 0, -1): if Mtx[j] < Mtx[j - 1]: Mtx[j - 1], Mtx[j] = Mtx[j], Mtx[j - 1] else: break # print(i, j, sep=', ') ...
n = int(eval(input())) A = input().split() print((" ".join(A))) for i in range(1, n): for j in range(i, 0, -1): if int(A[j]) < int(A[j - 1]): A[j], A[j - 1] = A[j - 1], A[j] print((" ".join(A)))
false
64.285714
[ "-def main():", "- n = int(input())", "- Mtx = list(map(int, input().split()))", "- showMtx(Mtx)", "- for i in range(1, n):", "- for j in range(i, 0, -1):", "- if Mtx[j] < Mtx[j - 1]:", "- Mtx[j - 1], Mtx[j] = Mtx[j], Mtx[j - 1]", "- else:", ...
false
0.061854
0.061687
1.002702
[ "s164681028", "s184205694" ]
u745514010
p02627
python
s448541152
s508370964
30
25
9,080
8,960
Accepted
Accepted
16.67
s = eval(input()) if s == s.upper(): print("A") else: print("a")
a = eval(input()) if a == a.lower(): print("a") else: print("A")
5
5
70
70
s = eval(input()) if s == s.upper(): print("A") else: print("a")
a = eval(input()) if a == a.lower(): print("a") else: print("A")
false
0
[ "-s = eval(input())", "-if s == s.upper():", "+a = eval(input())", "+if a == a.lower():", "+ print(\"a\")", "+else:", "-else:", "- print(\"a\")" ]
false
0.066778
0.03778
1.767552
[ "s448541152", "s508370964" ]
u745087332
p03229
python
s187590739
s206220441
840
473
8,944
8,156
Accepted
Accepted
43.69
# coding:utf-8 import sys from collections import Counter, deque INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def S(): return eval(input()) N = I() A = [I()...
# coding:utf-8 import sys from collections import Counter, deque INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def S(): return eval(input()) N = I() A = [I()...
43
40
801
789
# coding:utf-8 import sys from collections import Counter, deque INF = float("inf") MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def S(): return eval(input()) N = I() A =...
# coding:utf-8 import sys from collections import Counter, deque INF = float("inf") MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def S(): return eval(input()) N = I() A =...
false
6.976744
[ "- C = deque(B)", "- B.append(A[N // 2])", "- C.appendleft(A[N // 2])", "-else:", "- C = A[:]", "-ans1 = 0", "-ans2 = 0", "+ median = A[N // 2]", "+ if abs(B[0] - median) < abs(B[-1] - median):", "+ B.append(median)", "+ else:", "+ B.appendleft(median)", "+...
false
0.045551
0.037748
1.206703
[ "s187590739", "s206220441" ]
u029251499
p02615
python
s488853595
s391641221
149
133
31,540
104,900
Accepted
Accepted
10.74
N = int(eval(input())) A_list = [int(n) for n in input().split()] A_list.sort(reverse = True) ans = 0 for i in range(1,N): ans += A_list[i // 2] print(ans)
N=int(eval(input())) A=[int(i) for i in input().split()] A.sort(reverse=True) if N%2==1: if N==3: ans=A[0]+A[1] else: ans=A[0] for i in range(1,N//2): ans+=A[i]*2 ans+=A[N//2] else: ans=A[0] for i in range(1,N//2): ans+=A[i]*2 pr...
9
20
164
323
N = int(eval(input())) A_list = [int(n) for n in input().split()] A_list.sort(reverse=True) ans = 0 for i in range(1, N): ans += A_list[i // 2] print(ans)
N = int(eval(input())) A = [int(i) for i in input().split()] A.sort(reverse=True) if N % 2 == 1: if N == 3: ans = A[0] + A[1] else: ans = A[0] for i in range(1, N // 2): ans += A[i] * 2 ans += A[N // 2] else: ans = A[0] for i in range(1, N // 2): ans +...
false
55
[ "-A_list = [int(n) for n in input().split()]", "-A_list.sort(reverse=True)", "-ans = 0", "-for i in range(1, N):", "- ans += A_list[i // 2]", "+A = [int(i) for i in input().split()]", "+A.sort(reverse=True)", "+if N % 2 == 1:", "+ if N == 3:", "+ ans = A[0] + A[1]", "+ else:", ...
false
0.078821
0.084174
0.936402
[ "s488853595", "s391641221" ]
u371763408
p03575
python
s216712652
s562214403
100
25
3,064
3,064
Accepted
Accepted
75
import sys input=sys.stdin.readline class UnionFind: def __init__(self, num): self.rank = [0]*num self.par = [i for i in range(num)] #基準(par = parentのpar) self.n = num self.size = [1]*num #親を探す def find(self, x): if self.par[x] == x: return x else: self.par[x] = ...
import sys input=sys.stdin.readline class UnionFind: def __init__(self, num): self.rank = [0]*num self.par = [i for i in range(num)] #基準(par = parentのpar) self.n = num self.size = [1]*num #親を探す def find(self, x): if self.par[x] == x: return x else: self.par[x] = ...
62
65
1,283
1,375
import sys input = sys.stdin.readline class UnionFind: def __init__(self, num): self.rank = [0] * num self.par = [i for i in range(num)] # 基準(par = parentのpar) self.n = num self.size = [1] * num # 親を探す def find(self, x): if self.par[x] == x: return x ...
import sys input = sys.stdin.readline class UnionFind: def __init__(self, num): self.rank = [0] * num self.par = [i for i in range(num)] # 基準(par = parentのpar) self.n = num self.size = [1] * num # 親を探す def find(self, x): if self.par[x] == x: return x ...
false
4.615385
[ "+ ls = []", "- self.find(n)", "+ ls.append(self.find(n))", "+ return ls", "- for j in range(n):", "- for k in range(j, n):", "- if not uf.same(j, k):", "- flag = True", "- if flag:", "+ if len(set(uf.all_find())) > 1:",...
false
0.03857
0.068714
0.561307
[ "s216712652", "s562214403" ]
u832039789
p03064
python
s716046008
s315410418
2,916
2,510
142,156
157,776
Accepted
Accepted
13.92
M,z,s=998244353,1,0 N,*A=list(map(int,open(0))) d=[1]+[0]*7**6 e=[1]+[0]*7**6 for a in A: i=s;s+=a;z*=3 while~i:d[i+a]+=d[i]%M;d[i]*=2;e[i+a]+=e[i]%M;i-=1 i=s while i*2>=s:z=(z-d[i]*3)%M;i-=1 print(((z+~s%2*e[s//2]*3)%M))
M,z,s=998244353,1,0 d=[1]+[0]*7**6 e=[1]+[0]*7**6 for _ in'_'*eval(input()): a=eval(input());s+=a;i=s;z*=3 while~i:d[i]+=d[i]+d[i-a]%M;e[i]+=e[i-a]%M;i-=1 i=s while i*2>=s:z=(z-d[i]*3)%M;i-=1 print((z+~s%2*e[s//2]*3)%M)
10
9
224
216
M, z, s = 998244353, 1, 0 N, *A = list(map(int, open(0))) d = [1] + [0] * 7**6 e = [1] + [0] * 7**6 for a in A: i = s s += a z *= 3 while ~i: d[i + a] += d[i] % M d[i] *= 2 e[i + a] += e[i] % M i -= 1 i = s while i * 2 >= s: z = (z - d[i] * 3) % M i -= 1 print(((z...
M, z, s = 998244353, 1, 0 d = [1] + [0] * 7**6 e = [1] + [0] * 7**6 for _ in "_" * eval(input()): a = eval(input()) s += a i = s z *= 3 while ~i: d[i] += d[i] + d[i - a] % M e[i] += e[i - a] % M i -= 1 i = s while i * 2 >= s: z = (z - d[i] * 3) % M i -= 1 print((z + ~...
false
10
[ "-N, *A = list(map(int, open(0)))", "-for a in A:", "+for _ in \"_\" * eval(input()):", "+ a = eval(input())", "+ s += a", "- s += a", "- d[i + a] += d[i] % M", "- d[i] *= 2", "- e[i + a] += e[i] % M", "+ d[i] += d[i] + d[i - a] % M", "+ e[i] += e[i - ...
false
0.044005
0.03905
1.126882
[ "s716046008", "s315410418" ]
u903005414
p02954
python
s101991363
s812847625
161
93
5,552
97,372
Accepted
Accepted
42.24
S = list(eval(input())) S.reverse() c = [0 for _ in range(len(S))] l_start_index = 0 l_end_index = -1 r_start_index = -1 r_end_index = -1 # def count(): # s = r_end_index - l_start_index + 1 # if s % 2 == 0: # c[l_end_index] = s // 2 # c[r_start_index] = s // 2 # else: # ...
LOG = 18 # log2(10**5) S = eval(input()) N = len(S) to = [[0] * N for _ in range(LOG)] for i in range(N): to[0][i] = i + 1 if S[i] == 'R' else i - 1 for i in range(1, LOG): for j in range(N): to[i][j] = to[i - 1][to[i - 1][j]] ans = [0] * N for i in range(N): ans[to[LOG - 1][i]] +=...
46
18
1,059
366
S = list(eval(input())) S.reverse() c = [0 for _ in range(len(S))] l_start_index = 0 l_end_index = -1 r_start_index = -1 r_end_index = -1 # def count(): # s = r_end_index - l_start_index + 1 # if s % 2 == 0: # c[l_end_index] = s // 2 # c[r_start_index] = s // 2 # else: # if l_end_ind...
LOG = 18 # log2(10**5) S = eval(input()) N = len(S) to = [[0] * N for _ in range(LOG)] for i in range(N): to[0][i] = i + 1 if S[i] == "R" else i - 1 for i in range(1, LOG): for j in range(N): to[i][j] = to[i - 1][to[i - 1][j]] ans = [0] * N for i in range(N): ans[to[LOG - 1][i]] += 1 L = [str(i) fo...
false
60.869565
[ "-S = list(eval(input()))", "-S.reverse()", "-c = [0 for _ in range(len(S))]", "-l_start_index = 0", "-l_end_index = -1", "-r_start_index = -1", "-r_end_index = -1", "-# def count():", "-# s = r_end_index - l_start_index + 1", "-# if s % 2 == 0:", "-# c[l_end_index] = s // 2", ...
false
0.038709
0.036389
1.063746
[ "s101991363", "s812847625" ]
u653041271
p02678
python
s254080729
s813043253
908
820
116,656
116,752
Accepted
Accepted
9.69
import sys, bisect, math, itertools, string, queue, copy # import numpy as np # import scipy # from collections import Counter,defaultdict,deque # from itertools import permutations, combinations from heapq import heappop, heappush from fractions import gcd input = sys.stdin.readline sys.setrecursionlimit(10**8...
import sys, bisect, math, itertools, string, queue, copy # import numpy as np # import scipy from collections import Counter,defaultdict,deque from itertools import permutations, combinations from heapq import heappop, heappush from fractions import gcd input = sys.stdin.readline sys.setrecursionlimit(10**8) m...
42
42
1,255
1,251
import sys, bisect, math, itertools, string, queue, copy # import numpy as np # import scipy # from collections import Counter,defaultdict,deque # from itertools import permutations, combinations from heapq import heappop, heappush from fractions import gcd input = sys.stdin.readline sys.setrecursionlimit(10**8) mod ...
import sys, bisect, math, itertools, string, queue, copy # import numpy as np # import scipy from collections import Counter, defaultdict, deque from itertools import permutations, combinations from heapq import heappop, heappush from fractions import gcd input = sys.stdin.readline sys.setrecursionlimit(10**8) mod = ...
false
0
[ "-# from collections import Counter,defaultdict,deque", "-# from itertools import permutations, combinations", "+from collections import Counter, defaultdict, deque", "+from itertools import permutations, combinations" ]
false
0.039248
0.037791
1.038541
[ "s254080729", "s813043253" ]
u869790980
p03816
python
s162321112
s810193842
519
318
92,348
96,644
Accepted
Accepted
38.73
import collections n = int(input()) ais = list(map(int, input().split())) cc = collections.Counter(ais) k = n - len(cc) print(len(cc) - (1 if (n - len(cc)) % 2 == 1 else 0))
n,s = int(input()),set(map(int, input().split())) print(len(s) - (1 if (len(s) & 1 == 0) else 0))
6
2
180
105
import collections n = int(input()) ais = list(map(int, input().split())) cc = collections.Counter(ais) k = n - len(cc) print(len(cc) - (1 if (n - len(cc)) % 2 == 1 else 0))
n, s = int(input()), set(map(int, input().split())) print(len(s) - (1 if (len(s) & 1 == 0) else 0))
false
66.666667
[ "-import collections", "-", "-n = int(input())", "-ais = list(map(int, input().split()))", "-cc = collections.Counter(ais)", "-k = n - len(cc)", "-print(len(cc) - (1 if (n - len(cc)) % 2 == 1 else 0))", "+n, s = int(input()), set(map(int, input().split()))", "+print(len(s) - (1 if (len(s) & 1 == 0) ...
false
0.035522
0.039446
0.900518
[ "s162321112", "s810193842" ]
u729133443
p02982
python
s028878632
s322142451
385
153
63,412
12,440
Accepted
Accepted
60.26
from subprocess import* call(('python3','-c',""" from numpy import* n,*x=[int32(t.split())for t in open(0)] print((sum(j==int(j)for i in x for j in map(linalg.norm,i-x))-n[0])//2) """))
from numpy import* n,*x=[int32(t.split())for t in open(0)] print((sum(j==int(j)for i in x for j in map(linalg.norm,i-x))-n[0]>>1))
6
3
190
130
from subprocess import * call( ( "python3", "-c", """ from numpy import* n,*x=[int32(t.split())for t in open(0)] print((sum(j==int(j)for i in x for j in map(linalg.norm,i-x))-n[0])//2) """, ) )
from numpy import * n, *x = [int32(t.split()) for t in open(0)] print((sum(j == int(j) for i in x for j in map(linalg.norm, i - x)) - n[0] >> 1))
false
50
[ "-from subprocess import *", "+from numpy import *", "-call(", "- (", "- \"python3\",", "- \"-c\",", "- \"\"\"", "-from numpy import*", "-n,*x=[int32(t.split())for t in open(0)]", "-print((sum(j==int(j)for i in x for j in map(linalg.norm,i-x))-n[0])//2)", "-\"\"\",", "-...
false
0.202963
0.16869
1.20317
[ "s028878632", "s322142451" ]
u353919145
p02910
python
s426399247
s534310673
72
31
61,576
9,136
Accepted
Accepted
56.94
# Written by Shagoto s = eval(input()) i = 0 check = True while(i < len(s)): if(i % 2 == 0 and s[i] == "L"): check = False break elif(i % 2 == 1 and s[i] == "R"): check = False break i += 1 if(check): print("Yes") else: print("No")
s=eval(input()) i=0 flag=0 while i<len(s): if (i+1)%2==0: if s[i] =="L" or s[i] =="U" or s[i] =="D": pass else: flag+=1 else: if s[i] =="R" or s[i] =="U" or s[i] =="D": pass else: flag+=1 if fla...
17
27
294
405
# Written by Shagoto s = eval(input()) i = 0 check = True while i < len(s): if i % 2 == 0 and s[i] == "L": check = False break elif i % 2 == 1 and s[i] == "R": check = False break i += 1 if check: print("Yes") else: print("No")
s = eval(input()) i = 0 flag = 0 while i < len(s): if (i + 1) % 2 == 0: if s[i] == "L" or s[i] == "U" or s[i] == "D": pass else: flag += 1 else: if s[i] == "R" or s[i] == "U" or s[i] == "D": pass else: flag += 1 if flag == 1: ...
false
37.037037
[ "-# Written by Shagoto", "-check = True", "+flag = 0", "- if i % 2 == 0 and s[i] == \"L\":", "- check = False", "- break", "- elif i % 2 == 1 and s[i] == \"R\":", "- check = False", "+ if (i + 1) % 2 == 0:", "+ if s[i] == \"L\" or s[i] == \"U\" or s[i] == \"D\"...
false
0.086138
0.035623
2.41805
[ "s426399247", "s534310673" ]
u281303342
p03208
python
s638349181
s633940823
250
141
7,508
7,488
Accepted
Accepted
43.6
N,K = list(map(int,input().split())) H = [int(eval(input())) for _ in range(N)] H.sort() ans = 10**10 for i in range(N-K+1): ans = min(ans, H[i-1+K]-H[i]) print(ans)
# Python3 (3.4.3) import sys input = sys.stdin.readline # ------------------------------------------------------------- # function # ------------------------------------------------------------- # ------------------------------------------------------------- # main # --------------------------------------...
9
22
167
514
N, K = list(map(int, input().split())) H = [int(eval(input())) for _ in range(N)] H.sort() ans = 10**10 for i in range(N - K + 1): ans = min(ans, H[i - 1 + K] - H[i]) print(ans)
# Python3 (3.4.3) import sys input = sys.stdin.readline # ------------------------------------------------------------- # function # ------------------------------------------------------------- # ------------------------------------------------------------- # main # ---------------------------------------------------...
false
59.090909
[ "+# Python3 (3.4.3)", "+import sys", "+", "+input = sys.stdin.readline", "+# function", "+# main", "- ans = min(ans, H[i - 1 + K] - H[i])", "+ ans = min(ans, H[i + K - 1] - H[i])" ]
false
0.102779
0.04198
2.448303
[ "s638349181", "s633940823" ]
u197457087
p02684
python
s108045322
s638918213
437
125
217,252
121,776
Accepted
Accepted
71.4
N, K = list(map(int,input().split())) m = 60 A = list(map(int,input().split())) A = [A[i]-1 for i in range(N)] D = [A] for i in range(m): temp = [] for j in range(N): temp.append(D[i][D[i][j]]) D.append(temp) now = 0 for i in range(m): if K >> i&1 == 1: now = D[i][now] print((now+1...
N, K = list(map(int,input().split())) A = list(map(int,input().split())) B = [0];BB=[0] S = set([]);S.add(0) now = 0 Flag = False loop_start = -1 if K <= 2*pow(10,5)+10: for i in range(K): nxt = A[now]-1 BB.append(nxt) now = nxt #print(BB) print((BB[K]+1)) exit() for i in range(N*2): ...
19
39
314
816
N, K = list(map(int, input().split())) m = 60 A = list(map(int, input().split())) A = [A[i] - 1 for i in range(N)] D = [A] for i in range(m): temp = [] for j in range(N): temp.append(D[i][D[i][j]]) D.append(temp) now = 0 for i in range(m): if K >> i & 1 == 1: now = D[i][now] print((now +...
N, K = list(map(int, input().split())) A = list(map(int, input().split())) B = [0] BB = [0] S = set([]) S.add(0) now = 0 Flag = False loop_start = -1 if K <= 2 * pow(10, 5) + 10: for i in range(K): nxt = A[now] - 1 BB.append(nxt) now = nxt # print(BB) print((BB[K] + 1)) exit() fo...
false
51.282051
[ "-m = 60", "-A = [A[i] - 1 for i in range(N)]", "-D = [A]", "-for i in range(m):", "- temp = []", "- for j in range(N):", "- temp.append(D[i][D[i][j]])", "- D.append(temp)", "+B = [0]", "+BB = [0]", "+S = set([])", "+S.add(0)", "-for i in range(m):", "- if K >> i & 1 == ...
false
0.063807
0.121363
0.525756
[ "s108045322", "s638918213" ]
u078042885
p00085
python
s348064045
s516272539
30
20
7,520
7,524
Accepted
Accepted
33.33
while 1: n,m=list(map(int,input().split())) if n==0:break a=m-1 while a<m*n-n:a=m*a//(m-1)+1 print((n*m-a))
while 1: n,m=list(map(int,input().split())) if n==0:break a=0 for i in range(2,n+1):a=(a+m)%i print((a+1))
6
6
124
123
while 1: n, m = list(map(int, input().split())) if n == 0: break a = m - 1 while a < m * n - n: a = m * a // (m - 1) + 1 print((n * m - a))
while 1: n, m = list(map(int, input().split())) if n == 0: break a = 0 for i in range(2, n + 1): a = (a + m) % i print((a + 1))
false
0
[ "- a = m - 1", "- while a < m * n - n:", "- a = m * a // (m - 1) + 1", "- print((n * m - a))", "+ a = 0", "+ for i in range(2, n + 1):", "+ a = (a + m) % i", "+ print((a + 1))" ]
false
0.037442
0.037912
0.987606
[ "s348064045", "s516272539" ]
u095094246
p03062
python
s513739776
s497516621
202
86
33,196
20,048
Accepted
Accepted
57.43
n=int(eval(input())) a=list(map(int,input().split())) dp=[[0 for _ in range(2)] for _ in range(n+1)] dp[0][1] = - 10**9 for i in range(n): dp[i+1][0]=max(dp[i][0]+a[i],dp[i][1]-a[i]) dp[i+1][1]=max(dp[i][0]-a[i],dp[i][1]+a[i]) print((dp[n][0]))
n=int(eval(input())) a=list(map(int,input().split())) cnt = sum([1 for i in a if i < 0]) if cnt%2: r = 10**9 for i in range(n): r = min(r,abs(a[i])) print((sum([abs(x) for x in a])-2*r)) else: print((sum([abs(x) for x in a])))
8
10
247
239
n = int(eval(input())) a = list(map(int, input().split())) dp = [[0 for _ in range(2)] for _ in range(n + 1)] dp[0][1] = -(10**9) for i in range(n): dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i]) dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i]) print((dp[n][0]))
n = int(eval(input())) a = list(map(int, input().split())) cnt = sum([1 for i in a if i < 0]) if cnt % 2: r = 10**9 for i in range(n): r = min(r, abs(a[i])) print((sum([abs(x) for x in a]) - 2 * r)) else: print((sum([abs(x) for x in a])))
false
20
[ "-dp = [[0 for _ in range(2)] for _ in range(n + 1)]", "-dp[0][1] = -(10**9)", "-for i in range(n):", "- dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i])", "- dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i])", "-print((dp[n][0]))", "+cnt = sum([1 for i in a if i < 0])", "+if cnt % 2:", ...
false
0.075963
0.040855
1.859326
[ "s513739776", "s497516621" ]
u493520238
p02571
python
s948716695
s900894140
96
73
67,576
73,404
Accepted
Accepted
23.96
s=eval(input()) t=eval(input()) ans = 10**9 for i in range(len(s)): # print('---',i) val = 0 for j in range(len(t)): if i+j >= len(s): break si = s[i+j] ti = t[j] # print(si,ti) if si != ti: val += 1 else: ans = min(ans,val) p...
s=eval(input()) t=eval(input()) n = len(s) ans = 10**9 for i in range(n): v = 0 for j in range(len(t)): if j+i >= n: break if s[j+i] != t[j]: v+=1 else: ans = min(ans,v) print(ans)
17
13
317
217
s = eval(input()) t = eval(input()) ans = 10**9 for i in range(len(s)): # print('---',i) val = 0 for j in range(len(t)): if i + j >= len(s): break si = s[i + j] ti = t[j] # print(si,ti) if si != ti: val += 1 else: ans = min(ans, val...
s = eval(input()) t = eval(input()) n = len(s) ans = 10**9 for i in range(n): v = 0 for j in range(len(t)): if j + i >= n: break if s[j + i] != t[j]: v += 1 else: ans = min(ans, v) print(ans)
false
23.529412
[ "+n = len(s)", "-for i in range(len(s)):", "- val = 0", "+for i in range(n):", "+ v = 0", "- if i + j >= len(s):", "+ if j + i >= n:", "- si = s[i + j]", "- ti = t[j]", "- # print(si,ti)", "- if si != ti:", "- val += 1", "+ if...
false
0.069313
0.053205
1.302748
[ "s948716695", "s900894140" ]
u585482323
p02813
python
s587155838
s926206043
207
176
41,200
38,640
Accepted
Accepted
14.98
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from itertools import permutations 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 [l...
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from itertools import permutations 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 [l...
49
58
1,089
1,391
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations 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(): ...
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations 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(): ...
false
15.517241
[ "+ def sum(i, bit):", "+ res = 0", "+ while i > 0:", "+ res += bit[i]", "+ i -= i & -i", "+ return res", "+", "+ def index_permutations(p):", "+ res = 0", "+ bit = [0] * (n + 1)", "+ for i in range(len(p)):", "+ r...
false
0.052221
0.09365
0.557622
[ "s587155838", "s926206043" ]
u359358631
p02689
python
s263410324
s548298740
313
222
97,820
91,268
Accepted
Accepted
29.07
def main(): n, m = list(map(int, input().split())) h_lst = list(map(int, input().split())) ab_dict = dict() # 展望台i : [展望台iに隣接する展望台の標高] for _ in range(m): a, b = list(map(int, input().split())) if a not in ab_dict: ab_dict[a] = [h_lst[b - 1]] else: ...
def main(): n, m = list(map(int, input().split())) h_lst = list(map(int, input().split())) ok_lst = [1 for _ in range(n)] for _ in range(m): a, b = list(map(int, input().split())) a -= 1 b -= 1 if h_lst[a] <= h_lst[b]: ok_lst[a] = 0 if h_ls...
32
20
767
438
def main(): n, m = list(map(int, input().split())) h_lst = list(map(int, input().split())) ab_dict = dict() # 展望台i : [展望台iに隣接する展望台の標高] for _ in range(m): a, b = list(map(int, input().split())) if a not in ab_dict: ab_dict[a] = [h_lst[b - 1]] else: ab_dict...
def main(): n, m = list(map(int, input().split())) h_lst = list(map(int, input().split())) ok_lst = [1 for _ in range(n)] for _ in range(m): a, b = list(map(int, input().split())) a -= 1 b -= 1 if h_lst[a] <= h_lst[b]: ok_lst[a] = 0 if h_lst[b] <= h_ls...
false
37.5
[ "- ab_dict = dict() # 展望台i : [展望台iに隣接する展望台の標高]", "+ ok_lst = [1 for _ in range(n)]", "- if a not in ab_dict:", "- ab_dict[a] = [h_lst[b - 1]]", "- else:", "- ab_dict[a].append(h_lst[b - 1])", "- if b not in ab_dict:", "- ab_dict[b] = [h_lst[...
false
0.036591
0.104628
0.349726
[ "s263410324", "s548298740" ]
u330039499
p03830
python
s524436141
s730689718
77
70
2,820
2,820
Accepted
Accepted
9.09
from functools import reduce N = eval(input()) mod = 10 ** 9 + 7 num_p = [1] * 1001 p = [] # find p for i in range(2, N + 1): canDivide = True for j in range(2, i): if i % j == 0: canDivide = False break if canDivide: p.append(i) # factorization for i in range(2, N + 1): for...
from functools import reduce N = eval(input()) mod = 10 ** 9 + 7 num_p = [1] * 1001 p = [] # find p for i in range(2, N + 1): canDivide = True for j in range(2, i): if i % j == 0: canDivide = False break if canDivide: p.append(i) # factorization for i in range(2, N + 1): for...
25
24
467
441
from functools import reduce N = eval(input()) mod = 10**9 + 7 num_p = [1] * 1001 p = [] # find p for i in range(2, N + 1): canDivide = True for j in range(2, i): if i % j == 0: canDivide = False break if canDivide: p.append(i) # factorization for i in range(2, N + 1...
from functools import reduce N = eval(input()) mod = 10**9 + 7 num_p = [1] * 1001 p = [] # find p for i in range(2, N + 1): canDivide = True for j in range(2, i): if i % j == 0: canDivide = False break if canDivide: p.append(i) # factorization for i in range(2, N + 1...
false
4
[ "- target = i", "- while target % j == 0:", "+ while i % j == 0:", "- target /= j", "+ i /= j" ]
false
0.032077
0.042609
0.752834
[ "s524436141", "s730689718" ]
u575431498
p03575
python
s764473219
s568294714
55
23
3,948
3,064
Accepted
Accepted
58.18
from queue import Queue N, M = list(map(int, input().split())) a, b = [0] * M, [0] * M g = [[False] * N for _ in range(N)] for i in range(M): a[i], b[i] = list(map(int, input().split())) g[a[i]-1][b[i]-1] = True g[b[i]-1][a[i]-1] = True ans = 0 for _a, _b in zip(a, b): g[_a-1][_b-1] = False ...
class UnionFind(object): def __init__(self, n): self.par = [i for i in range(n)] self.rank = [0 for _ in range(n)] self._size = n def find(self, x): if self.par[x] == x: return x else: self.par[x] = self.find(self.par[x]) re...
28
45
705
1,113
from queue import Queue N, M = list(map(int, input().split())) a, b = [0] * M, [0] * M g = [[False] * N for _ in range(N)] for i in range(M): a[i], b[i] = list(map(int, input().split())) g[a[i] - 1][b[i] - 1] = True g[b[i] - 1][a[i] - 1] = True ans = 0 for _a, _b in zip(a, b): g[_a - 1][_b - 1] = False...
class UnionFind(object): def __init__(self, n): self.par = [i for i in range(n)] self.rank = [0 for _ in range(n)] self._size = n def find(self, x): if self.par[x] == x: return x else: self.par[x] = self.find(self.par[x]) return self.p...
false
37.777778
[ "-from queue import Queue", "+class UnionFind(object):", "+ def __init__(self, n):", "+ self.par = [i for i in range(n)]", "+ self.rank = [0 for _ in range(n)]", "+ self._size = n", "+", "+ def find(self, x):", "+ if self.par[x] == x:", "+ return x", ...
false
0.038575
0.035756
1.078822
[ "s764473219", "s568294714" ]
u887207211
p03160
python
s509085134
s664646772
172
123
13,928
13,928
Accepted
Accepted
28.49
N = int(eval(input())) H = list(map(int,input().split())) dp = [0]*N for i in range(1,N): dp[i] = max(dp[i], dp[i-1]+abs(H[i]-H[i-1])) if(i > 1): dp[i] = min(dp[i], dp[i-2]+abs(H[i]-H[i-2])) print((dp[N-1]))
N = int(eval(input())) H = list(map(int,input().split())) dp = [0]*N dp[1] = abs(H[0]-H[1]) for i in range(2,N): dp[i] = min(abs(H[i]-H[i-1])+dp[i-1], abs(H[i]-H[i-2])+dp[i-2]) print((dp[N-1]))
9
8
220
195
N = int(eval(input())) H = list(map(int, input().split())) dp = [0] * N for i in range(1, N): dp[i] = max(dp[i], dp[i - 1] + abs(H[i] - H[i - 1])) if i > 1: dp[i] = min(dp[i], dp[i - 2] + abs(H[i] - H[i - 2])) print((dp[N - 1]))
N = int(eval(input())) H = list(map(int, input().split())) dp = [0] * N dp[1] = abs(H[0] - H[1]) for i in range(2, N): dp[i] = min(abs(H[i] - H[i - 1]) + dp[i - 1], abs(H[i] - H[i - 2]) + dp[i - 2]) print((dp[N - 1]))
false
11.111111
[ "-for i in range(1, N):", "- dp[i] = max(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]))", "- if i > 1:", "- dp[i] = min(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]))", "+dp[1] = abs(H[0] - H[1])", "+for i in range(2, N):", "+ dp[i] = min(abs(H[i] - H[i - 1]) + dp[i - 1], abs(H[i] - H[i - 2]) + dp[i...
false
0.046503
0.047548
0.978023
[ "s509085134", "s664646772" ]
u086503932
p03196
python
s011273406
s044436205
263
76
3,060
66,180
Accepted
Accepted
71.1
#!/usr/bin/env python3 import sys def main(): N, P = list(map(int, input().split())) ans = 1 if N == 1: print(P) exit() for i in range(2,int(P**(1/N)+1)): count = 0 tmp = P while tmp % i == 0: count += 1 tmp = tmp // i ...
from collections import Counter N, P = list(map(int, input().split())) def prime_factorize(N): prime_list = [] while N % 2 == 0: prime_list.append(2) N //= 2 f = 3 while f**2 <= N: if N % f == 0: prime_list.append(f) N //= f else: ...
21
25
425
534
#!/usr/bin/env python3 import sys def main(): N, P = list(map(int, input().split())) ans = 1 if N == 1: print(P) exit() for i in range(2, int(P ** (1 / N) + 1)): count = 0 tmp = P while tmp % i == 0: count += 1 tmp = tmp // i ans ...
from collections import Counter N, P = list(map(int, input().split())) def prime_factorize(N): prime_list = [] while N % 2 == 0: prime_list.append(2) N //= 2 f = 3 while f**2 <= N: if N % f == 0: prime_list.append(f) N //= f else: f ...
false
16
[ "-#!/usr/bin/env python3", "-import sys", "+from collections import Counter", "+", "+N, P = list(map(int, input().split()))", "-def main():", "- N, P = list(map(int, input().split()))", "- ans = 1", "- if N == 1:", "- print(P)", "- exit()", "- for i in range(2, int(P ...
false
0.04186
0.037663
1.111438
[ "s011273406", "s044436205" ]
u046187684
p03310
python
s937804445
s282393161
630
374
25,984
25,588
Accepted
Accepted
40.63
from itertools import accumulate def solve(string): n, *a = list(map(int, string.split())) *a, = accumulate(a) l, c, r = 0, 1, 2 sll, slr, srl, srr = a[l], a[c] - a[l], a[r] - a[c], a[-1] - a[r] ans = max(sll, slr, srl, srr) - min(sll, slr, srl, srr) while c < n - 1: while ab...
from itertools import accumulate def solve(string): n, *a = list(map(int, string.split())) *a, = accumulate(a) l, r, e = 0, 2, a[-1] ans = e for c in a[1:-2]: while a[l] + a[l + 1] < c: l += 1 while a[r] + a[r + 1] < c + e: r += 1 tmp = ...
22
20
747
503
from itertools import accumulate def solve(string): n, *a = list(map(int, string.split())) (*a,) = accumulate(a) l, c, r = 0, 1, 2 sll, slr, srl, srr = a[l], a[c] - a[l], a[r] - a[c], a[-1] - a[r] ans = max(sll, slr, srl, srr) - min(sll, slr, srl, srr) while c < n - 1: while abs(a[c] -...
from itertools import accumulate def solve(string): n, *a = list(map(int, string.split())) (*a,) = accumulate(a) l, r, e = 0, 2, a[-1] ans = e for c in a[1:-2]: while a[l] + a[l + 1] < c: l += 1 while a[r] + a[r + 1] < c + e: r += 1 tmp = sorted([a[l...
false
9.090909
[ "- l, c, r = 0, 1, 2", "- sll, slr, srl, srr = a[l], a[c] - a[l], a[r] - a[c], a[-1] - a[r]", "- ans = max(sll, slr, srl, srr) - min(sll, slr, srl, srr)", "- while c < n - 1:", "- while abs(a[c] - 2 * a[l + 1]) < abs(a[c] - 2 * a[l]):", "+ l, r, e = 0, 2, a[-1]", "+ ans = e", ...
false
0.041974
0.039571
1.060735
[ "s937804445", "s282393161" ]
u498487134
p02819
python
s997005525
s842840876
202
184
40,816
99,136
Accepted
Accepted
8.91
x =int(eval(input())) n = 2*10**5 is_prime = [True]*(n+1) is_prime[0] = False for i in range(2, n+1): if is_prime[i-1]: j = 2 * i while j <= n: is_prime[j-1] = False j += i for i in range(x-1,n): if is_prime[i]==True: print((i+1)) break
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 X=I() #nまでの素数を列挙(n loglogn) n = 2*(10**6) #is_prime[i]にはi+1が素数か否かを示すboolが入る,[0]に1の素...
17
33
311
698
x = int(eval(input())) n = 2 * 10**5 is_prime = [True] * (n + 1) is_prime[0] = False for i in range(2, n + 1): if is_prime[i - 1]: j = 2 * i while j <= n: is_prime[j - 1] = False j += i for i in range(x - 1, n): if is_prime[i] == True: print((i + 1)) break...
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod = 10**9 + 7 X = I() # nまでの素数を列挙(n loglogn) n = 2 * (10**6) # is_prime[i]にはi+1が素数か否かを示すboolが入...
false
48.484848
[ "-x = int(eval(input()))", "-n = 2 * 10**5", "-is_prime = [True] * (n + 1)", "-is_prime[0] = False", "-for i in range(2, n + 1):", "- if is_prime[i - 1]:", "- j = 2 * i", "- while j <= n:", "- is_prime[j - 1] = False", "- j += i", "-for i in range(x - 1, n)...
false
0.941742
1.908812
0.493366
[ "s997005525", "s842840876" ]
u279460955
p02873
python
s556393252
s477267783
388
307
110,532
85,192
Accepted
Accepted
20.88
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from itertools import permutations, accumulate, combinations, combinations_with_replacement, groupby from math import sqrt, ceil, floor, factorial from bisect import bisect_left, bisect_right, insort_left, insort_right ...
from itertools import groupby s = eval(input()) A = [(key, sum(1 for _ in group)) for key, group in groupby(s)] tmp = 0 ans = 0 for key, count in A: if key == '<': ans += count*(count+1)//2 tmp = count else: if tmp < count: ans -= tmp ans += count ...
45
17
1,523
376
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from itertools import ( permutations, accumulate, combinations, combinations_with_replacement, groupby, ) from math import sqrt, ceil, floor, factorial from bisect import bisect_left, bisect_right, insor...
from itertools import groupby s = eval(input()) A = [(key, sum(1 for _ in group)) for key, group in groupby(s)] tmp = 0 ans = 0 for key, count in A: if key == "<": ans += count * (count + 1) // 2 tmp = count else: if tmp < count: ans -= tmp ans += count a...
false
62.222222
[ "-from collections import defaultdict, deque, Counter", "-from heapq import heappush, heappop, heapify", "-from itertools import (", "- permutations,", "- accumulate,", "- combinations,", "- combinations_with_replacement,", "- groupby,", "-)", "-from math import sqrt, ceil, floor, f...
false
0.073885
0.037866
1.951252
[ "s556393252", "s477267783" ]
u456353530
p02844
python
s406772828
s687361320
247
210
43,752
73,932
Accepted
Accepted
14.98
N = int(eval(input())) S = list(map(int, list(eval(input())))) L = [0] * 10 R = [0] * 10 for i in S: R[i] += 1 D = [0] * 1000 L[S[0]] = 1 R[S[0]] -= 1 for i in range(1, N): R[S[i]] -= 1 for j in range(10): if L[j] == 0: continue for k in range(10): if R[k] != 0: D[j * ...
N = int(eval(input())) S = eval(input()) DP = [[0] * 10 for _ in range(10)] D = [0] * 10 L = [0] * 1000 for i in range(N): for j in range(10): for k in range(10): if DP[j][k] == 1: L[j * 100 + k * 10 + int(S[i])] = 1 for j in range(10): if D[j] == 1: DP[j][int(S[i])] = 1 ...
28
17
416
342
N = int(eval(input())) S = list(map(int, list(eval(input())))) L = [0] * 10 R = [0] * 10 for i in S: R[i] += 1 D = [0] * 1000 L[S[0]] = 1 R[S[0]] -= 1 for i in range(1, N): R[S[i]] -= 1 for j in range(10): if L[j] == 0: continue for k in range(10): if R[k] != 0: ...
N = int(eval(input())) S = eval(input()) DP = [[0] * 10 for _ in range(10)] D = [0] * 10 L = [0] * 1000 for i in range(N): for j in range(10): for k in range(10): if DP[j][k] == 1: L[j * 100 + k * 10 + int(S[i])] = 1 for j in range(10): if D[j] == 1: DP[j]...
false
39.285714
[ "-S = list(map(int, list(eval(input()))))", "-L = [0] * 10", "-R = [0] * 10", "-for i in S:", "- R[i] += 1", "-D = [0] * 1000", "-L[S[0]] = 1", "-R[S[0]] -= 1", "-for i in range(1, N):", "- R[S[i]] -= 1", "+S = eval(input())", "+DP = [[0] * 10 for _ in range(10)]", "+D = [0] * 10", "...
false
0.077287
0.075457
1.024251
[ "s406772828", "s687361320" ]
u714878632
p02886
python
s904790503
s671752519
21
17
4,980
3,064
Accepted
Accepted
19.05
n = int(eval(input())) ds = [int(x) for x in input().split()] ds2 = [x*x for x in ds] s = sum(ds) print((int((sum(ds * s) - sum(ds2)) / 2 )))
n = int(eval(input())) ds = [int(x) for x in input().split()] ds2 = [x*x for x in ds] s = 0 s2 = 0 for i in range(n): s += ds[i] s2 += ds2[i] ss = 0 for i in range(n): ss += ds[i] * s print(((ss - s2) // 2))
5
13
137
218
n = int(eval(input())) ds = [int(x) for x in input().split()] ds2 = [x * x for x in ds] s = sum(ds) print((int((sum(ds * s) - sum(ds2)) / 2)))
n = int(eval(input())) ds = [int(x) for x in input().split()] ds2 = [x * x for x in ds] s = 0 s2 = 0 for i in range(n): s += ds[i] s2 += ds2[i] ss = 0 for i in range(n): ss += ds[i] * s print(((ss - s2) // 2))
false
61.538462
[ "-s = sum(ds)", "-print((int((sum(ds * s) - sum(ds2)) / 2)))", "+s = 0", "+s2 = 0", "+for i in range(n):", "+ s += ds[i]", "+ s2 += ds2[i]", "+ss = 0", "+for i in range(n):", "+ ss += ds[i] * s", "+print(((ss - s2) // 2))" ]
false
0.048683
0.048259
1.008789
[ "s904790503", "s671752519" ]
u556657484
p02678
python
s321958202
s484831180
687
428
35,200
35,168
Accepted
Accepted
37.7
from collections import deque N, M = list(map(int, input().split())) G = [[] for _ in range(N+1)] for i in range(M): x, y = list(map(int, input().split())) G[x].append(y) G[y].append(x) USED = [-1] * (N+1) USED[0] = 0 USED[1] = 0 Q = deque() Q.append(1) while Q: x = Q.pop() for...
import sys input = sys.stdin.readline N,M=list(map(int,input().split())) E=[[] for i in range(N+1)] for i in range(M): x,y=list(map(int,input().split())) E[x].append(y) E[y].append(x) USE=[-1]*(N+1) USE[0]=0 USE[1]=0 from collections import deque Q=deque() Q.append(1) while Q: x=Q...
28
30
483
493
from collections import deque N, M = list(map(int, input().split())) G = [[] for _ in range(N + 1)] for i in range(M): x, y = list(map(int, input().split())) G[x].append(y) G[y].append(x) USED = [-1] * (N + 1) USED[0] = 0 USED[1] = 0 Q = deque() Q.append(1) while Q: x = Q.pop() for t in G[x]: ...
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) E = [[] for i in range(N + 1)] for i in range(M): x, y = list(map(int, input().split())) E[x].append(y) E[y].append(x) USE = [-1] * (N + 1) USE[0] = 0 USE[1] = 0 from collections import deque Q = deque() Q.append(1) while Q: ...
false
6.666667
[ "+import sys", "+", "+input = sys.stdin.readline", "+N, M = list(map(int, input().split()))", "+E = [[] for i in range(N + 1)]", "+for i in range(M):", "+ x, y = list(map(int, input().split()))", "+ E[x].append(y)", "+ E[y].append(x)", "+USE = [-1] * (N + 1)", "+USE[0] = 0", "+USE[1] ...
false
0.038888
0.038976
0.997756
[ "s321958202", "s484831180" ]
u600402037
p03078
python
s501603538
s520544649
1,495
37
133,352
4,840
Accepted
Accepted
97.53
# coding: utf-8 import sys from bisect import bisect_left, bisect_right import itertools from heapq import heapify, heappop, heappush sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # AとBは全探索、その後二分探索 X, Y, Z, K = lr() A = lr(); A.sort() B = lr()...
# coding: utf-8 import sys from heapq import heapify, heappop, heappush sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # 虫の目、一個ずつheapへ X, Y, Z, K = lr() A = lr(); A.sort(reverse=True) B = lr(); B.sort(reverse=True) C = lr(); C.sort(reverse=True)...
49
38
955
958
# coding: utf-8 import sys from bisect import bisect_left, bisect_right import itertools from heapq import heapify, heappop, heappush sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # AとBは全探索、その後二分探索 X, Y, Z, K = lr() A = lr() A.sort() B = lr() B.sort() C = l...
# coding: utf-8 import sys from heapq import heapify, heappop, heappush sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # 虫の目、一個ずつheapへ X, Y, Z, K = lr() A = lr() A.sort(reverse=True) B = lr() B.sort(reverse=True) C = lr() C.sort(reverse=True) ma = A[0] + B[0...
false
22.44898
[ "-from bisect import bisect_left, bisect_right", "-import itertools", "-# AとBは全探索、その後二分探索", "+# 虫の目、一個ずつheapへ", "-A.sort()", "+A.sort(reverse=True)", "-B.sort()", "+B.sort(reverse=True)", "-C.sort()", "-D = []", "-for a, b in itertools.product(A, B):", "- D.append(a + b)", "-D.sort()", ...
false
0.043117
0.035853
1.202608
[ "s501603538", "s520544649" ]
u587193722
p02379
python
s365415485
s404915547
30
20
7,644
7,600
Accepted
Accepted
33.33
import math x, y, X, Y = [float(i) for i in input().split()] print((math.sqrt((x-X)**2 + abs(y-Y)**2)))
import math x, y, X, Y = [float(i) for i in input().split()] print((math.sqrt((x-X)**2 + (y-Y)**2)))
4
4
105
102
import math x, y, X, Y = [float(i) for i in input().split()] print((math.sqrt((x - X) ** 2 + abs(y - Y) ** 2)))
import math x, y, X, Y = [float(i) for i in input().split()] print((math.sqrt((x - X) ** 2 + (y - Y) ** 2)))
false
0
[ "-print((math.sqrt((x - X) ** 2 + abs(y - Y) ** 2)))", "+print((math.sqrt((x - X) ** 2 + (y - Y) ** 2)))" ]
false
0.007541
0.071765
0.105082
[ "s365415485", "s404915547" ]
u357267874
p02275
python
s778926826
s800117813
1,730
1,600
224,464
224,468
Accepted
Accepted
7.51
def counting_sort(A): # init bucket = {} for i in range(10000): bucket[i] = 0 for a in A: bucket[a] += 1 k = 0 for i in range(10000): for j in range(bucket[i]): A[k] = i k += 1 n = int(eval(input())) A = list(map(int, input()...
def counting_sort(A): # init bucket = [] for i in range(10000): bucket.append(0) for a in A: bucket[a] += 1 k = 0 for i in range(10000): for j in range(bucket[i]): A[k] = i k += 1 n = int(eval(input())) A = list(map(int, input()....
23
21
358
357
def counting_sort(A): # init bucket = {} for i in range(10000): bucket[i] = 0 for a in A: bucket[a] += 1 k = 0 for i in range(10000): for j in range(bucket[i]): A[k] = i k += 1 n = int(eval(input())) A = list(map(int, input().split())) counting_s...
def counting_sort(A): # init bucket = [] for i in range(10000): bucket.append(0) for a in A: bucket[a] += 1 k = 0 for i in range(10000): for j in range(bucket[i]): A[k] = i k += 1 n = int(eval(input())) A = list(map(int, input().split())) countin...
false
8.695652
[ "- bucket = {}", "+ bucket = []", "- bucket[i] = 0", "+ bucket.append(0)" ]
false
0.049153
0.095264
0.515964
[ "s778926826", "s800117813" ]
u808429775
p00112
python
s814923224
s727857491
130
100
6,112
6,168
Accepted
Accepted
23.08
while True: inputCount = int(eval(input())) if inputCount == 0: break timeList = [] for lp in range(inputCount): timeList.append(int(eval(input()))) timeList.sort() totalTimeList = [0] for lp in range(inputCount - 1): waitTime = totalTimeList[-...
while True: inputCount = int(eval(input())) if inputCount == 0: break timeList = [int(eval(input())) for item in range(inputCount)] timeList.sort() totalTimeList = [0] for lp in range(inputCount - 1): waitTime = totalTimeList[-1] + timeList[lp] totalTim...
22
18
406
371
while True: inputCount = int(eval(input())) if inputCount == 0: break timeList = [] for lp in range(inputCount): timeList.append(int(eval(input()))) timeList.sort() totalTimeList = [0] for lp in range(inputCount - 1): waitTime = totalTimeList[-1] + timeList[lp] ...
while True: inputCount = int(eval(input())) if inputCount == 0: break timeList = [int(eval(input())) for item in range(inputCount)] timeList.sort() totalTimeList = [0] for lp in range(inputCount - 1): waitTime = totalTimeList[-1] + timeList[lp] totalTimeList.append(waitTi...
false
18.181818
[ "- timeList = []", "- for lp in range(inputCount):", "- timeList.append(int(eval(input())))", "+ timeList = [int(eval(input())) for item in range(inputCount)]" ]
false
0.047012
0.043527
1.080071
[ "s814923224", "s727857491" ]
u147077748
p03164
python
s095251022
s166403996
1,803
729
5,348
176,348
Accepted
Accepted
59.57
import sys # input処理を高速化する input = sys.stdin.readline # 入力 N, W = list(map(int, input().split())) # sum_vの取りうる上限値 MAX_V = (10**3) * N +1 # 最小値を求めるので無限大の値 f_inf = float('inf') def knapsack(n, w): # dpの初期化 dp[sum_v]は重さの総和の最小値 dp = [f_inf] * MAX_V # 初期条件 dp[0] = 0 sum_v = 0 # f...
import sys import numpy as np # input処理を高速化する input = sys.stdin.readline # 入力 N, W = list(map(int, input().split())) # sum_vの取りうる上限値 MAX_V = (10**3) * N +1 def knapsack(n, w): # dp[i][j] : i番目の品物で価値jの重さの最小値 dp = np.full([N+1, MAX_V], np.inf) dp[0][0] = 0 for i in range(n): w, ...
36
22
749
486
import sys # input処理を高速化する input = sys.stdin.readline # 入力 N, W = list(map(int, input().split())) # sum_vの取りうる上限値 MAX_V = (10**3) * N + 1 # 最小値を求めるので無限大の値 f_inf = float("inf") def knapsack(n, w): # dpの初期化 dp[sum_v]は重さの総和の最小値 dp = [f_inf] * MAX_V # 初期条件 dp[0] = 0 sum_v = 0 # forは全て関数の中で回す。 ...
import sys import numpy as np # input処理を高速化する input = sys.stdin.readline # 入力 N, W = list(map(int, input().split())) # sum_vの取りうる上限値 MAX_V = (10**3) * N + 1 def knapsack(n, w): # dp[i][j] : i番目の品物で価値jの重さの最小値 dp = np.full([N + 1, MAX_V], np.inf) dp[0][0] = 0 for i in range(n): w, v = list(map(...
false
38.888889
[ "+import numpy as np", "-# 最小値を求めるので無限大の値", "-f_inf = float(\"inf\")", "- # dpの初期化 dp[sum_v]は重さの総和の最小値", "- dp = [f_inf] * MAX_V", "- # 初期条件", "- dp[0] = 0", "- sum_v = 0", "- # forは全て関数の中で回す。", "- # 入力", "- for i in range(N):", "+ # dp[i][j] : i番目の品物で価値jの重さの最小値", ...
false
0.040136
0.231498
0.173377
[ "s095251022", "s166403996" ]
u933096856
p02261
python
s500722222
s531693119
20
10
5,612
4,680
Accepted
Accepted
50
n=int(eval(input())) r=input().split() def BubbleSort(c, n): for i in range(n): for j in range(n-1, i, -1): if int(c[j][-1]) < int(c[j-1][-1]): c[j], c[j-1]=c[j-1],c[j] return c def SelectionSort(c, n): for i in range(n): m=i for j in range(...
n=int(input()) r=input().split() def BubbleSort(c, n): for i in range(n): for j in range(n-1, i, -1): if int(c[j][-1]) < int(c[j-1][-1]): c[j], c[j-1]=c[j-1],c[j] return c def SelectionSort(c, n): for i in range(n): m=i for j in range(i, n):...
30
30
601
622
n = int(eval(input())) r = input().split() def BubbleSort(c, n): for i in range(n): for j in range(n - 1, i, -1): if int(c[j][-1]) < int(c[j - 1][-1]): c[j], c[j - 1] = c[j - 1], c[j] return c def SelectionSort(c, n): for i in range(n): m = i for j in ...
n = int(input()) r = input().split() def BubbleSort(c, n): for i in range(n): for j in range(n - 1, i, -1): if int(c[j][-1]) < int(c[j - 1][-1]): c[j], c[j - 1] = c[j - 1], c[j] return c def SelectionSort(c, n): for i in range(n): m = i for j in range(...
false
0
[ "-n = int(eval(input()))", "+n = int(input())", "-print((*a))", "+print(\" \".join(a))", "-print((*b))", "+print(\" \".join(b))" ]
false
0.100179
0.107599
0.931039
[ "s500722222", "s531693119" ]
u729133443
p03014
python
s551108562
s731410095
1,565
1,059
188,808
121,932
Accepted
Accepted
32.33
h,*s=open(0) h,w=list(map(int,h.split())) r=range a,b,c,d=eval('eval("w*[0],"*h),'*4) for i in r(h*w):i,j=i//w,i%w;f=s[i][j]>'#';a[i][j]=-~a[i][j-1]*f;b[i][~j]=-~b[i][-j]*(s[i][-j-2]>'#');c[i][j]=-~c[i-1][j]*f;d[~i][j]=-~d[-i][j]*(s[~i][j]>'#') print((max(a[i][j]+b[i][j]+c[i][j]+d[i][j]-3for i in r(h)for j in r(w)...
from numpy import* h,*s=open(0) h,w=int64(h.split()) r=range s=array([list(t[:-1])for t in s]) a,b,c,d=eval('zeros((h,w),"i"),'*4) for i in r(w): a[:,i]=-~a[:,i-1]*(s[:,i]>'#') b[:,~i]=-~b[:,-i]*(s[:,~i]>'#') for i in r(h): c[i,:]=-~c[i-1,:]*(s[i,:]>'#') d[~i,:]=-~d[-i,:]*(s[~i,:]>'#') print...
6
13
315
344
h, *s = open(0) h, w = list(map(int, h.split())) r = range a, b, c, d = eval('eval("w*[0],"*h),' * 4) for i in r(h * w): i, j = i // w, i % w f = s[i][j] > "#" a[i][j] = -~a[i][j - 1] * f b[i][~j] = -~b[i][-j] * (s[i][-j - 2] > "#") c[i][j] = -~c[i - 1][j] * f d[~i][j] = -~d[-i][j] * (s[~i][j] >...
from numpy import * h, *s = open(0) h, w = int64(h.split()) r = range s = array([list(t[:-1]) for t in s]) a, b, c, d = eval('zeros((h,w),"i"),' * 4) for i in r(w): a[:, i] = -~a[:, i - 1] * (s[:, i] > "#") b[:, ~i] = -~b[:, -i] * (s[:, ~i] > "#") for i in r(h): c[i, :] = -~c[i - 1, :] * (s[i, :] > "#") ...
false
53.846154
[ "+from numpy import *", "+", "-h, w = list(map(int, h.split()))", "+h, w = int64(h.split())", "-a, b, c, d = eval('eval(\"w*[0],\"*h),' * 4)", "-for i in r(h * w):", "- i, j = i // w, i % w", "- f = s[i][j] > \"#\"", "- a[i][j] = -~a[i][j - 1] * f", "- b[i][~j] = -~b[i][-j] * (s[i][-j ...
false
0.041917
0.256846
0.163198
[ "s551108562", "s731410095" ]
u118642796
p03329
python
s567318293
s104149010
1,234
223
7,804
42,732
Accepted
Accepted
81.93
SixNum = [i for i in range(0,100001)] for i in range(1,7): for j in range(1,100001): SixNum[j] = min(SixNum[j],j//(6**i) + SixNum[j%(6**i)]) NineNum = [i for i in range(0,100001)] for i in range(1,6): for j in range(1,100001): NineNum[j] = min(NineNum[j],j//(9**i...
n=int(eval(input())) dp=[10**10]*(n+1) dp[0]=0 for i in range(1,n+1): dp[i]=dp[i-1]+1 x=0 while 9**(x+1)<=i: x+=1 dp[i]=min(dp[i],dp[i-9**x]+1) x=0 while 6**(x+1)<=i: x+=1 dp[i]=min(dp[i],dp[i-6**x]+1) print((dp[n]))
15
17
459
260
SixNum = [i for i in range(0, 100001)] for i in range(1, 7): for j in range(1, 100001): SixNum[j] = min(SixNum[j], j // (6**i) + SixNum[j % (6**i)]) NineNum = [i for i in range(0, 100001)] for i in range(1, 6): for j in range(1, 100001): NineNum[j] = min(NineNum[j], j // (9**i) + NineNum[j % (9*...
n = int(eval(input())) dp = [10**10] * (n + 1) dp[0] = 0 for i in range(1, n + 1): dp[i] = dp[i - 1] + 1 x = 0 while 9 ** (x + 1) <= i: x += 1 dp[i] = min(dp[i], dp[i - 9**x] + 1) x = 0 while 6 ** (x + 1) <= i: x += 1 dp[i] = min(dp[i], dp[i - 6**x] + 1) print((dp[n]))
false
11.764706
[ "-SixNum = [i for i in range(0, 100001)]", "-for i in range(1, 7):", "- for j in range(1, 100001):", "- SixNum[j] = min(SixNum[j], j // (6**i) + SixNum[j % (6**i)])", "-NineNum = [i for i in range(0, 100001)]", "-for i in range(1, 6):", "- for j in range(1, 100001):", "- NineNum[j]...
false
0.998816
0.088801
11.24782
[ "s567318293", "s104149010" ]
u528470578
p03087
python
s680651948
s772977417
1,019
670
52,440
68,824
Accepted
Accepted
34.25
N, Q = list(map(int, input().split())) S = eval(input()) l, r = [], [] t = [0] * (N+1) for i in range(N): t[i + 1] = t[i] +(1 if S[i:i+2] == 'AC' else 0) for i in range(Q): l, r = list(map(int, input().split())) print((t[r-1] - t[l-1]))
# ABC122 C-GetAC N, Q = list(map(int, input().split())) S = eval(input()) lr = [] for _ in range(Q): lr.append(list(map(int, input().split()))) ArrayAC = [0]*(N) for j, i in enumerate(S): if j == N-1: break if S[j:j+2] == "AC": ArrayAC[j+1] = ArrayAC[j] + 1 else...
9
21
236
421
N, Q = list(map(int, input().split())) S = eval(input()) l, r = [], [] t = [0] * (N + 1) for i in range(N): t[i + 1] = t[i] + (1 if S[i : i + 2] == "AC" else 0) for i in range(Q): l, r = list(map(int, input().split())) print((t[r - 1] - t[l - 1]))
# ABC122 C-GetAC N, Q = list(map(int, input().split())) S = eval(input()) lr = [] for _ in range(Q): lr.append(list(map(int, input().split()))) ArrayAC = [0] * (N) for j, i in enumerate(S): if j == N - 1: break if S[j : j + 2] == "AC": ArrayAC[j + 1] = ArrayAC[j] + 1 else: ArrayA...
false
57.142857
[ "+# ABC122 C-GetAC", "-l, r = [], []", "-t = [0] * (N + 1)", "-for i in range(N):", "- t[i + 1] = t[i] + (1 if S[i : i + 2] == \"AC\" else 0)", "-for i in range(Q):", "- l, r = list(map(int, input().split()))", "- print((t[r - 1] - t[l - 1]))", "+lr = []", "+for _ in range(Q):", "+ l...
false
0.037095
0.081417
0.455614
[ "s680651948", "s772977417" ]
u646412443
p02819
python
s883406141
s723102572
30
17
2,940
2,940
Accepted
Accepted
43.33
x = int(eval(input())) while True: is_prime = True for i in range(2, x): if x % i == 0: is_prime = False break if is_prime: print(x) break x += 1
x = int(eval(input())) def is_prime(x): if x <= 1: return False for i in range(2, int(x**0.5)+1): if x % i == 0: return False return True while(not is_prime(x)): x += 1 print(x)
11
12
214
228
x = int(eval(input())) while True: is_prime = True for i in range(2, x): if x % i == 0: is_prime = False break if is_prime: print(x) break x += 1
x = int(eval(input())) def is_prime(x): if x <= 1: return False for i in range(2, int(x**0.5) + 1): if x % i == 0: return False return True while not is_prime(x): x += 1 print(x)
false
8.333333
[ "-while True:", "- is_prime = True", "- for i in range(2, x):", "+", "+", "+def is_prime(x):", "+ if x <= 1:", "+ return False", "+ for i in range(2, int(x**0.5) + 1):", "- is_prime = False", "- break", "- if is_prime:", "- print(x)", "- ...
false
0.080017
0.036761
2.176681
[ "s883406141", "s723102572" ]
u785578220
p03032
python
s193968030
s356632051
221
42
43,756
3,064
Accepted
Accepted
81
n,k = list(map(int,input().split())) v = list(map(int,input().split())) m=[] for i in range(k+1): for j in range(min(k,n)-i+1): # print(i,j) t=sorted(v[:i]+v[:~j:-1]) while t and(k-i-j)*t[0]<0:t.pop(0);j+=1 m+=sum(t), print((max(m)))
n,k = list(map(int,input().split())) v = list(map(int,input().split())) m=[] for i in range(k+1): for j in range(min(k,n)-i+1): # print(i,j) t=sorted(v[:i]+v[:~j:-1]) while t and(k-i-j)*t[0]<0:t.pop(0);j+=1 m.append(sum(t)) print((max(m)))
11
12
246
254
n, k = list(map(int, input().split())) v = list(map(int, input().split())) m = [] for i in range(k + 1): for j in range(min(k, n) - i + 1): # print(i,j) t = sorted(v[:i] + v[:~j:-1]) while t and (k - i - j) * t[0] < 0: t.pop(0) j += 1 m += (sum(t),) print((max...
n, k = list(map(int, input().split())) v = list(map(int, input().split())) m = [] for i in range(k + 1): for j in range(min(k, n) - i + 1): # print(i,j) t = sorted(v[:i] + v[:~j:-1]) while t and (k - i - j) * t[0] < 0: t.pop(0) j += 1 m.append(sum(t)) print((m...
false
8.333333
[ "- m += (sum(t),)", "+ m.append(sum(t))" ]
false
0.163571
0.083889
1.949843
[ "s193968030", "s356632051" ]
u816631826
p03945
python
s275196747
s899490115
43
38
3,316
3,188
Accepted
Accepted
11.63
board = eval(input()) changes = 1 currSeq = board[0] for i in range(1, len(board)): current = board[i] if current != currSeq: changes += 1 currSeq = current print((changes - 1))
S = eval(input()) runs = 0 b = S[0] == 'B' for s in S: if (s == 'B') != b: b = (s == 'B') runs += 1 print(runs)
13
8
191
132
board = eval(input()) changes = 1 currSeq = board[0] for i in range(1, len(board)): current = board[i] if current != currSeq: changes += 1 currSeq = current print((changes - 1))
S = eval(input()) runs = 0 b = S[0] == "B" for s in S: if (s == "B") != b: b = s == "B" runs += 1 print(runs)
false
38.461538
[ "-board = eval(input())", "-changes = 1", "-currSeq = board[0]", "-for i in range(1, len(board)):", "- current = board[i]", "- if current != currSeq:", "- changes += 1", "- currSeq = current", "-print((changes - 1))", "+S = eval(input())", "+runs = 0", "+b = S[0] == \"B\"",...
false
0.03699
0.039468
0.937214
[ "s275196747", "s899490115" ]
u283751459
p03106
python
s140771271
s011159137
29
24
9,156
9,124
Accepted
Accepted
17.24
a, b, k = list(map(int, input().split())) count = 0 for i in range(1, min(a, b)+1)[::-1]: if a%i==0 and b%i==0: count += 1 if count == k: print(i) exit()
a,b,k = list(map(int,input().split())) count =[] for i in range(1,min(a,b)+1): if a%i == 0 and b%i == 0: count.append(i) else: pass print((count[-k]))
9
10
189
169
a, b, k = list(map(int, input().split())) count = 0 for i in range(1, min(a, b) + 1)[::-1]: if a % i == 0 and b % i == 0: count += 1 if count == k: print(i) exit()
a, b, k = list(map(int, input().split())) count = [] for i in range(1, min(a, b) + 1): if a % i == 0 and b % i == 0: count.append(i) else: pass print((count[-k]))
false
10
[ "-count = 0", "-for i in range(1, min(a, b) + 1)[::-1]:", "+count = []", "+for i in range(1, min(a, b) + 1):", "- count += 1", "- if count == k:", "- print(i)", "- exit()", "+ count.append(i)", "+ else:", "+ pass", "+print((count[-k]))" ]
false
0.04389
0.042225
1.039429
[ "s140771271", "s011159137" ]
u077291787
p02780
python
s692574825
s361048063
175
118
25,420
26,288
Accepted
Accepted
32.57
# D - Dice in Line from itertools import accumulate def main(): N, K, *P = list(map(int, open(0).read().split())) # cumsum[i] = cumulative sum of expected values in [0, i] cumsum = tuple(accumulate(i * (1 + i) / (2 * i) for i in P)) if N == K: print((cumsum[-1])) return ...
# D - Dice in Line from itertools import accumulate def main(): N, K, *P = list(map(int, open(0).read().split())) # cumsum[i] = cumulative sum of expected values in [0, i] cumsum = tuple(accumulate([0] + [i * (1 + i) / (2 * i) for i in P])) ans = max(right - left for left, right in zip(cumsum,...
19
14
459
388
# D - Dice in Line from itertools import accumulate def main(): N, K, *P = list(map(int, open(0).read().split())) # cumsum[i] = cumulative sum of expected values in [0, i] cumsum = tuple(accumulate(i * (1 + i) / (2 * i) for i in P)) if N == K: print((cumsum[-1])) return ans = 0 ...
# D - Dice in Line from itertools import accumulate def main(): N, K, *P = list(map(int, open(0).read().split())) # cumsum[i] = cumulative sum of expected values in [0, i] cumsum = tuple(accumulate([0] + [i * (1 + i) / (2 * i) for i in P])) ans = max(right - left for left, right in zip(cumsum, cumsum[...
false
26.315789
[ "- cumsum = tuple(accumulate(i * (1 + i) / (2 * i) for i in P))", "- if N == K:", "- print((cumsum[-1]))", "- return", "- ans = 0", "- for i in range(N - K):", "- ans = max(ans, cumsum[i + K] - cumsum[i])", "+ cumsum = tuple(accumulate([0] + [i * (1 + i) / (2 * i) f...
false
0.043099
0.078675
0.547815
[ "s692574825", "s361048063" ]
u832039789
p03250
python
s035811294
s707244165
19
17
3,316
2,940
Accepted
Accepted
10.53
l = list(map(int,input().split())) l = sorted(l) l = l[::-1] print((l[0]*9+sum(l)))
l = list(map(int,input().split())) print((sum(l) + 9*(max(l))))
4
2
85
63
l = list(map(int, input().split())) l = sorted(l) l = l[::-1] print((l[0] * 9 + sum(l)))
l = list(map(int, input().split())) print((sum(l) + 9 * (max(l))))
false
50
[ "-l = sorted(l)", "-l = l[::-1]", "-print((l[0] * 9 + sum(l)))", "+print((sum(l) + 9 * (max(l))))" ]
false
0.043339
0.042675
1.015562
[ "s035811294", "s707244165" ]
u941407962
p03177
python
s767689059
s796447122
1,476
515
13,800
14,544
Accepted
Accepted
65.11
from numpy import* N,K,*A=list(map(int,open(0).read().split())) X=matrix(A,"O").reshape(N,N) M=10**9+7 S=1 while K:S*=~K%2or X;K//=2;X=X*X%M print((sum(S)%M))
import numpy as np N, K = list(map(int, input().split())) M = 10**9+7 xs = [] for _ in range(N): xs.append(list(map(int, input().split()))) X = np.array(xs, dtype="object") S = np.ones(N, dtype="object") #Xs = [X] for _ in range(60): # Xs.append(np.dot(Xs[-1],Xs[-1])%M) if K%2: S = np.dot...
7
20
156
441
from numpy import * N, K, *A = list(map(int, open(0).read().split())) X = matrix(A, "O").reshape(N, N) M = 10**9 + 7 S = 1 while K: S *= ~K % 2 or X K //= 2 X = X * X % M print((sum(S) % M))
import numpy as np N, K = list(map(int, input().split())) M = 10**9 + 7 xs = [] for _ in range(N): xs.append(list(map(int, input().split()))) X = np.array(xs, dtype="object") S = np.ones(N, dtype="object") # Xs = [X] for _ in range(60): # Xs.append(np.dot(Xs[-1],Xs[-1])%M) if K % 2: S = np.dot(X...
false
65
[ "-from numpy import *", "+import numpy as np", "-N, K, *A = list(map(int, open(0).read().split()))", "-X = matrix(A, \"O\").reshape(N, N)", "+N, K = list(map(int, input().split()))", "-S = 1", "-while K:", "- S *= ~K % 2 or X", "- K //= 2", "- X = X * X % M", "-print((sum(S) % M))", "...
false
0.007334
0.249793
0.02936
[ "s767689059", "s796447122" ]
u677577916
p02952
python
s453361225
s475095907
70
52
2,940
2,940
Accepted
Accepted
25.71
value = int(eval(input())) count = 0 while value > 0: if len(str(value)) % 2 != 0: count += 1 value -= 1 print(count)
def main(): value = int(eval(input())) count = 0 while value > 0: if len(str(value)) % 2 != 0: count += 1 value -= 1 print(count) if __name__ == "__main__": main()
7
10
133
214
value = int(eval(input())) count = 0 while value > 0: if len(str(value)) % 2 != 0: count += 1 value -= 1 print(count)
def main(): value = int(eval(input())) count = 0 while value > 0: if len(str(value)) % 2 != 0: count += 1 value -= 1 print(count) if __name__ == "__main__": main()
false
30
[ "-value = int(eval(input()))", "-count = 0", "-while value > 0:", "- if len(str(value)) % 2 != 0:", "- count += 1", "- value -= 1", "-print(count)", "+def main():", "+ value = int(eval(input()))", "+ count = 0", "+ while value > 0:", "+ if len(str(value)) % 2 != 0:...
false
0.039507
0.040547
0.974344
[ "s453361225", "s475095907" ]
u690554532
p02689
python
s772299648
s607819688
269
246
19,936
20,088
Accepted
Accepted
8.55
n, m = list(map(int, input().split())) h = list(map(int, input().split())) l_n = [True] * n for i in range(m): a, b = list(map(int, input().split())) if h[a-1] == h[b-1]: l_n[b-1] = False l_n[a-1] = False elif h[a-1] <= h[b-1]: l_n[a-1] = False elif h[a-1] >= h[b-1]: ...
def main(): n, m = list(map(int, input().split())) h = list(map(int, input().split())) l_n = [True] * n for i in range(m): a, b = list(map(int, input().split())) if h[a-1] == h[b-1]: l_n[b-1] = False l_n[a-1] = False elif h[a-1] <= h[b-1]: ...
13
17
349
456
n, m = list(map(int, input().split())) h = list(map(int, input().split())) l_n = [True] * n for i in range(m): a, b = list(map(int, input().split())) if h[a - 1] == h[b - 1]: l_n[b - 1] = False l_n[a - 1] = False elif h[a - 1] <= h[b - 1]: l_n[a - 1] = False elif h[a - 1] >= h[b ...
def main(): n, m = list(map(int, input().split())) h = list(map(int, input().split())) l_n = [True] * n for i in range(m): a, b = list(map(int, input().split())) if h[a - 1] == h[b - 1]: l_n[b - 1] = False l_n[a - 1] = False elif h[a - 1] <= h[b - 1]: ...
false
23.529412
[ "-n, m = list(map(int, input().split()))", "-h = list(map(int, input().split()))", "-l_n = [True] * n", "-for i in range(m):", "- a, b = list(map(int, input().split()))", "- if h[a - 1] == h[b - 1]:", "- l_n[b - 1] = False", "- l_n[a - 1] = False", "- elif h[a - 1] <= h[b - 1]...
false
0.089305
0.036482
2.447966
[ "s772299648", "s607819688" ]
u298297089
p03274
python
s130901658
s055832559
124
111
14,480
14,480
Accepted
Accepted
10.48
N,K = list(map(int, input().split())) X = [] idx = 0 for i,x in enumerate(input().split()): x = int(x) X.append(x) if x < 0: idx = i + 1 if idx == N: idx = N-1 ans = 10**9 for i in range(max(0,idx-K), min(N-K+1,idx+K)): tmp = 0 if i <= idx <= i+K-1 or i >= idx or i+K-1 <= ...
N,K = list(map(int, input().split())) X = [] idx = 0 for i,x in enumerate(input().split()): x = int(x) X.append(x) if x < 0: idx = i + 1 if idx == N: idx = N-1 ans = 10**9 for i in range(max(0,idx-K), min(N-K+1,idx+K)): ans = min(ans, X[i+K-1] - X[i] + min(abs(X[i]), abs(X[i+K-1]...
19
14
438
329
N, K = list(map(int, input().split())) X = [] idx = 0 for i, x in enumerate(input().split()): x = int(x) X.append(x) if x < 0: idx = i + 1 if idx == N: idx = N - 1 ans = 10**9 for i in range(max(0, idx - K), min(N - K + 1, idx + K)): tmp = 0 if i <= idx <= i + K - 1 or i >= idx or i + K ...
N, K = list(map(int, input().split())) X = [] idx = 0 for i, x in enumerate(input().split()): x = int(x) X.append(x) if x < 0: idx = i + 1 if idx == N: idx = N - 1 ans = 10**9 for i in range(max(0, idx - K), min(N - K + 1, idx + K)): ans = min(ans, X[i + K - 1] - X[i] + min(abs(X[i]), abs(X[...
false
26.315789
[ "- tmp = 0", "- if i <= idx <= i + K - 1 or i >= idx or i + K - 1 <= idx:", "- tmp = min(abs(X[i]), abs(X[i + K - 1]))", "- # print(i,tmp)", "- ans = min(ans, X[i + K - 1] - X[i] + tmp)", "+ ans = min(ans, X[i + K - 1] - X[i] + min(abs(X[i]), abs(X[i + K - 1])))" ]
false
0.047606
0.035946
1.324358
[ "s130901658", "s055832559" ]
u936985471
p03167
python
s485550386
s628313837
912
542
44,628
49,348
Accepted
Accepted
40.57
h,w=list(map(int,input().split())) grid=[None]*h for i in range(h): grid[i]=eval(input()) dp=[[0 for i in range(w)] for j in range(h)] DIV=10**9+7 for i in range(h): for j in range(w): if grid[i][j]=="#": dp[i][j]=0 elif i==0 and j==0: dp[i][j]=1 else: up=0 le...
import sys readline = sys.stdin.readline H,W = list(map(int,readline().split())) G = [None] * (H + 1) G[0] = "." * (W + 1) for i in range(H): G[i + 1] = "." + readline().rstrip() dp = [[0] * (W + 1) for i in range(H + 1)] dp[1][0] = 1 # 便宜上、枠外に1を入れておくことで、dp[1][1]が1になる DIV = 10 ** 9 + 7 for i in range(...
24
22
449
502
h, w = list(map(int, input().split())) grid = [None] * h for i in range(h): grid[i] = eval(input()) dp = [[0 for i in range(w)] for j in range(h)] DIV = 10**9 + 7 for i in range(h): for j in range(w): if grid[i][j] == "#": dp[i][j] = 0 elif i == 0 and j == 0: dp[i][j] = 1...
import sys readline = sys.stdin.readline H, W = list(map(int, readline().split())) G = [None] * (H + 1) G[0] = "." * (W + 1) for i in range(H): G[i + 1] = "." + readline().rstrip() dp = [[0] * (W + 1) for i in range(H + 1)] dp[1][0] = 1 # 便宜上、枠外に1を入れておくことで、dp[1][1]が1になる DIV = 10**9 + 7 for i in range(1, H + 1): ...
false
8.333333
[ "-h, w = list(map(int, input().split()))", "-grid = [None] * h", "-for i in range(h):", "- grid[i] = eval(input())", "-dp = [[0 for i in range(w)] for j in range(h)]", "+import sys", "+", "+readline = sys.stdin.readline", "+H, W = list(map(int, readline().split()))", "+G = [None] * (H + 1)", ...
false
0.087512
0.085144
1.027808
[ "s485550386", "s628313837" ]
u852690916
p02536
python
s309054967
s097797325
360
218
85,700
84,736
Accepted
Accepted
39.44
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from typing import Iterable import sys def main(N, M, AB): uf = UnionFindTree(N) for a, b in AB: a, b = a - 1, b - 1 uf.union(a, b) d = set() for i in range(N): r = uf.find(i) if r not in d: d.add(r) ...
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from typing import Iterable, List import sys def main(N, M, AB): uf = UnionFindTree(N) for a, b in AB: a, b = a - 1, b - 1 uf.union(a, b) print((len(uf.groups()) - 1)) class UnionFindTree: __slots__ = ('parent') def __init...
48
46
1,347
1,356
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from typing import Iterable import sys def main(N, M, AB): uf = UnionFindTree(N) for a, b in AB: a, b = a - 1, b - 1 uf.union(a, b) d = set() for i in range(N): r = uf.find(i) if r not in d: d.add(r) print((...
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from typing import Iterable, List import sys def main(N, M, AB): uf = UnionFindTree(N) for a, b in AB: a, b = a - 1, b - 1 uf.union(a, b) print((len(uf.groups()) - 1)) class UnionFindTree: __slots__ = "parent" def __init__(self, n: ...
false
4.166667
[ "-from typing import Iterable", "+from typing import Iterable, List", "- d = set()", "- for i in range(N):", "- r = uf.find(i)", "- if r not in d:", "- d.add(r)", "- print((len(d) - 1))", "+ print((len(uf.groups()) - 1))", "+ def groups(self) -> List[int]:",...
false
0.046522
0.046718
0.995817
[ "s309054967", "s097797325" ]
u386170566
p03162
python
s698215531
s914921684
996
576
47,180
47,220
Accepted
Accepted
42.17
#https://atcoder.jp/contests/dp/tasks/dp_c N = int(eval(input())) p = [list(map(int,input().split())) for l in range(N)] dp = [[0,0,0]]*N dp[0] = p[0] for i in range(1,N,1): dp[i] = [0,0,0]#この文がないとバグる、理由はわからん #print(dp) for j in range(3): for k in range(3): if k != j: ...
#動的計画法 #C - Vacation #aのところをdp[i][0]とするとなぜか事故る、そういう仕様なのか?、それどもdp = [[0,0,0]]*Nが影響しているのか N = int(eval(input())) H = [list(map(int,input().split())) for i in range(N)] dp = [[0,0,0]]*N dp[0] = H[0] for i in range(1,N): a = max(dp[i-1][1],dp[i-1][2])+H[i][0] b = max(dp[i-1][0],dp[i-1][2])+H[i][1] c =...
18
13
434
391
# https://atcoder.jp/contests/dp/tasks/dp_c N = int(eval(input())) p = [list(map(int, input().split())) for l in range(N)] dp = [[0, 0, 0]] * N dp[0] = p[0] for i in range(1, N, 1): dp[i] = [0, 0, 0] # この文がないとバグる、理由はわからん # print(dp) for j in range(3): for k in range(3): if k != j: ...
# 動的計画法 # C - Vacation # aのところをdp[i][0]とするとなぜか事故る、そういう仕様なのか?、それどもdp = [[0,0,0]]*Nが影響しているのか N = int(eval(input())) H = [list(map(int, input().split())) for i in range(N)] dp = [[0, 0, 0]] * N dp[0] = H[0] for i in range(1, N): a = max(dp[i - 1][1], dp[i - 1][2]) + H[i][0] b = max(dp[i - 1][0], dp[i - 1][2]) + H[...
false
27.777778
[ "-# https://atcoder.jp/contests/dp/tasks/dp_c", "+# 動的計画法", "+# C - Vacation", "+# aのところをdp[i][0]とするとなぜか事故る、そういう仕様なのか?、それどもdp = [[0,0,0]]*Nが影響しているのか", "-p = [list(map(int, input().split())) for l in range(N)]", "+H = [list(map(int, input().split())) for i in range(N)]", "-dp[0] = p[0]", "-for i in ran...
false
0.059588
0.058311
1.021912
[ "s698215531", "s914921684" ]
u597455618
p03435
python
s874283785
s893579761
52
17
3,064
3,064
Accepted
Accepted
67.31
cnt = 0 c1, c2, c3 = list(map(int, input().split())) try : for j in range(c1+1): for k in range(c2+1): for l in range(c3+1): if c1-j == c2-k == c3-l: c4, c5, c6 = list(map(int, input().split())) if c4 - j == c5 -k == c6 -l: c7, c8, c9 = list(map(int, input(...
c1, c2, c3 = list(map(int, input().split())) c4, c5, c6 = list(map(int, input().split())) c7, c8, c9 = list(map(int, input().split())) if c1 - c2 == c4 - c5 == c7 - c8 and c3 - c2 == c6 - c5 == c9 - c8: print("Yes") else: print("No")
19
7
484
225
cnt = 0 c1, c2, c3 = list(map(int, input().split())) try: for j in range(c1 + 1): for k in range(c2 + 1): for l in range(c3 + 1): if c1 - j == c2 - k == c3 - l: c4, c5, c6 = list(map(int, input().split())) if c4 - j == c5 - k == c6 - l: ...
c1, c2, c3 = list(map(int, input().split())) c4, c5, c6 = list(map(int, input().split())) c7, c8, c9 = list(map(int, input().split())) if c1 - c2 == c4 - c5 == c7 - c8 and c3 - c2 == c6 - c5 == c9 - c8: print("Yes") else: print("No")
false
63.157895
[ "-cnt = 0", "-try:", "- for j in range(c1 + 1):", "- for k in range(c2 + 1):", "- for l in range(c3 + 1):", "- if c1 - j == c2 - k == c3 - l:", "- c4, c5, c6 = list(map(int, input().split()))", "- if c4 - j == c5 - k == c6 - l:"...
false
0.105778
0.085652
1.234971
[ "s874283785", "s893579761" ]
u729133443
p02852
python
s272342245
s473356790
260
137
56,412
6,992
Accepted
Accepted
47.31
n,m=list(map(int,input().split())) *s,=list(map(int,input()[::-1])) a=[] i=0 while i<n: j=max(j for j in range(i,min(n,i+m)+1)if not s[j]) if i==j: print((-1)) exit() a+=j-i, i=j print((*a[::-1]))
n,m=list(map(int,input().split())) *s,=list(map(int,input()[::-1])) i=0 a=[] while i<n: j=min(n,i+m) while s[j]:j-=1 if j==i: print((-1)) exit() a+=j-i, i=j print((*a[::-1]))
12
13
207
206
n, m = list(map(int, input().split())) (*s,) = list(map(int, input()[::-1])) a = [] i = 0 while i < n: j = max(j for j in range(i, min(n, i + m) + 1) if not s[j]) if i == j: print((-1)) exit() a += (j - i,) i = j print((*a[::-1]))
n, m = list(map(int, input().split())) (*s,) = list(map(int, input()[::-1])) i = 0 a = [] while i < n: j = min(n, i + m) while s[j]: j -= 1 if j == i: print((-1)) exit() a += (j - i,) i = j print((*a[::-1]))
false
7.692308
[ "+i = 0", "-i = 0", "- j = max(j for j in range(i, min(n, i + m) + 1) if not s[j])", "- if i == j:", "+ j = min(n, i + m)", "+ while s[j]:", "+ j -= 1", "+ if j == i:" ]
false
0.039969
0.041086
0.972801
[ "s272342245", "s473356790" ]
u616217092
p03339
python
s732682578
s465549843
277
203
17,908
30,800
Accepted
Accepted
26.71
from sys import stdin def main(): N = int(stdin.readline().rstrip()) S = stdin.readline() count = 0 s1 = [] for i, x in enumerate(S): if x == 'W': count += 1 s1.append(count) count = 0 s2 = [] for i, x in enumerate(S[::-1]): if x == 'E...
from sys import stdin def main(): N = int(stdin.readline().rstrip()) S = stdin.readline().rstrip() spam1 = [0] for x in S[:-1]: spam1 += [spam1[-1] + 1 if x == 'W' else spam1[-1]] spam2 = [0] for x in S[::-1][:-1]: spam2 += [spam2[-1] + 1 if x == 'E' else spam2[-1]] ...
36
18
699
446
from sys import stdin def main(): N = int(stdin.readline().rstrip()) S = stdin.readline() count = 0 s1 = [] for i, x in enumerate(S): if x == "W": count += 1 s1.append(count) count = 0 s2 = [] for i, x in enumerate(S[::-1]): if x == "E": ...
from sys import stdin def main(): N = int(stdin.readline().rstrip()) S = stdin.readline().rstrip() spam1 = [0] for x in S[:-1]: spam1 += [spam1[-1] + 1 if x == "W" else spam1[-1]] spam2 = [0] for x in S[::-1][:-1]: spam2 += [spam2[-1] + 1 if x == "E" else spam2[-1]] spam2 =...
false
50
[ "- S = stdin.readline()", "- count = 0", "- s1 = []", "- for i, x in enumerate(S):", "- if x == \"W\":", "- count += 1", "- s1.append(count)", "- count = 0", "- s2 = []", "- for i, x in enumerate(S[::-1]):", "- if x == \"E\":", "- ...
false
0.16699
0.03854
4.332954
[ "s732682578", "s465549843" ]
u047796752
p02614
python
s275078906
s416870386
100
80
69,192
73,652
Accepted
Accepted
20
import sys input = sys.stdin.readline from collections import * H, W, K = list(map(int, input().split())) c = [input()[:-1] for _ in range(H)] row = [] for i in range(H): cnt = 0 for j in range(W): if c[i][j]=='#': cnt += 1 row.append(cnt) col = [] for i ...
import sys input = sys.stdin.readline H, W, K = list(map(int, input().split())) c = [input()[:-1] for _ in range(H)] ans = 0 for S in range(1<<H): for T in range(1<<W): cnt = 0 for i in range(H): for j in range(W): if (S>>i)&1 or (T>>j)&1: ...
60
23
1,095
483
import sys input = sys.stdin.readline from collections import * H, W, K = list(map(int, input().split())) c = [input()[:-1] for _ in range(H)] row = [] for i in range(H): cnt = 0 for j in range(W): if c[i][j] == "#": cnt += 1 row.append(cnt) col = [] for i in range(W): cnt = 0 ...
import sys input = sys.stdin.readline H, W, K = list(map(int, input().split())) c = [input()[:-1] for _ in range(H)] ans = 0 for S in range(1 << H): for T in range(1 << W): cnt = 0 for i in range(H): for j in range(W): if (S >> i) & 1 or (T >> j) & 1: ...
false
61.666667
[ "-from collections import *", "-", "-row = []", "-for i in range(H):", "- cnt = 0", "- for j in range(W):", "- if c[i][j] == \"#\":", "- cnt += 1", "- row.append(cnt)", "-col = []", "-for i in range(W):", "- cnt = 0", "- for j in range(H):", "- if c[...
false
0.040316
0.037075
1.087415
[ "s275078906", "s416870386" ]
u510829608
p02364
python
s928514263
s429316779
1,120
790
50,000
46,232
Accepted
Accepted
29.46
import array import collections import heapq AdjacentVertex = collections.namedtuple("AdjacentVertex", "vertex cost") INF = 2 ** 31 - 1 NO_VERTEX = -1 # Prim?????§??????0?????????????°???¨?????¨????±??????? def compute_mst_prim(max_v, adj_list): # pred[u]?????????u???????????¨???????????????????????¨??...
import heapq from collections import defaultdict INF = float('inf') V, E = list(map(int, input().split())) Adj_list = defaultdict(set) for i in range(E): s, t, w = list(map(int, input().split())) Adj_list[s].add((t, w)) Adj_list[t].add((s, w)) def prim(x): d = [INF] * x d[0]...
42
32
1,500
648
import array import collections import heapq AdjacentVertex = collections.namedtuple("AdjacentVertex", "vertex cost") INF = 2**31 - 1 NO_VERTEX = -1 # Prim?????§??????0?????????????°???¨?????¨????±??????? def compute_mst_prim(max_v, adj_list): # pred[u]?????????u???????????¨???????????????????????¨??? pred = c...
import heapq from collections import defaultdict INF = float("inf") V, E = list(map(int, input().split())) Adj_list = defaultdict(set) for i in range(E): s, t, w = list(map(int, input().split())) Adj_list[s].add((t, w)) Adj_list[t].add((s, w)) def prim(x): d = [INF] * x d[0] = 0 isVisited = [...
false
23.809524
[ "-import array", "-import collections", "+from collections import defaultdict", "-AdjacentVertex = collections.namedtuple(\"AdjacentVertex\", \"vertex cost\")", "-INF = 2**31 - 1", "-NO_VERTEX = -1", "-# Prim?????§??????0?????????????°???¨?????¨????±???????", "-def compute_mst_prim(max_v, adj_list):",...
false
0.042102
0.037325
1.127973
[ "s928514263", "s429316779" ]
u681444474
p03862
python
s029403717
s246317087
92
83
85,316
85,128
Accepted
Accepted
9.78
# coding: utf-8 n, x = list(map(int,input().split())) A = list(map(int,input().split())) S = sum(A) for i in range(n-1): s = A[i+1] + A[i] if s > x: if s-x > A[i+1]:#後ろから全部引ける時 t = s-x-A[i+1] A[i+1] = 0 A[i] -= t else:#後ろから全部引くと負になるとき(前からも引く) ...
# coding: utf-8 n, x = list(map(int,input().split())) A = list(map(int,input().split())) S = sum(A) for i in range(n-1): s = A[i+1] + A[i] if s > x: if A[i+1] >= s-x: A[i+1] -= (s-x) else: t = s-x-A[i+1] A[i+1] = 0 A[i] -= t print((S -...
14
14
355
321
# coding: utf-8 n, x = list(map(int, input().split())) A = list(map(int, input().split())) S = sum(A) for i in range(n - 1): s = A[i + 1] + A[i] if s > x: if s - x > A[i + 1]: # 後ろから全部引ける時 t = s - x - A[i + 1] A[i + 1] = 0 A[i] -= t else: # 後ろから全部引くと負になるとき(前...
# coding: utf-8 n, x = list(map(int, input().split())) A = list(map(int, input().split())) S = sum(A) for i in range(n - 1): s = A[i + 1] + A[i] if s > x: if A[i + 1] >= s - x: A[i + 1] -= s - x else: t = s - x - A[i + 1] A[i + 1] = 0 A[i] -= t pri...
false
0
[ "- if s - x > A[i + 1]: # 後ろから全部引ける時", "+ if A[i + 1] >= s - x:", "+ A[i + 1] -= s - x", "+ else:", "- else: # 後ろから全部引くと負になるとき(前からも引く)", "- A[i + 1] -= s - x" ]
false
0.040301
0.040893
0.985534
[ "s029403717", "s246317087" ]
u731368968
p02711
python
s679972032
s011820188
23
21
8,900
8,928
Accepted
Accepted
8.7
print(('Yes' if '7' in eval(input()) else 'No'))
print(('YNeos'[not'7'in eval(input())::2]))
1
1
40
36
print(("Yes" if "7" in eval(input()) else "No"))
print(("YNeos"[not "7" in eval(input()) :: 2]))
false
0
[ "-print((\"Yes\" if \"7\" in eval(input()) else \"No\"))", "+print((\"YNeos\"[not \"7\" in eval(input()) :: 2]))" ]
false
0.036202
0.041572
0.870815
[ "s679972032", "s011820188" ]
u941753895
p03721
python
s348304459
s621271105
538
462
29,168
32,304
Accepted
Accepted
14.13
class struct: def __init__(self,a,b): self.a=a self.b=b n,k=list(map(int,input().split())) l=[] for i in range(n): a,b=list(map(int,input().split())) l.append(struct(a,b)) l=sorted(l,key=lambda x:x.a) s=0 for i in l: s+=i.b if k<=s: print((i.a)) exit()
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 def LI(): return list(map(int,input().split())) def I(): return int(eval(input())) def LS(): return input().split() def S(): return eval(input()) def main(): n,k=...
16
28
279
505
class struct: def __init__(self, a, b): self.a = a self.b = b n, k = list(map(int, input().split())) l = [] for i in range(n): a, b = list(map(int, input().split())) l.append(struct(a, b)) l = sorted(l, key=lambda x: x.a) s = 0 for i in l: s += i.b if k <= s: print((i.a)) ...
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 def LI(): return list(map(int, input().split())) def I(): return int(eval(input())) def LS(): return input().split() def S(): return eval...
false
42.857143
[ "-class struct:", "- def __init__(self, a, b):", "- self.a = a", "- self.b = b", "+import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time", "+", "+sys.setrecursionlimit(10**7)", "+inf = 10**20", "+mod = 10**9 + 7", "-n, k = list(map(int...
false
0.035427
0.037428
0.946528
[ "s348304459", "s621271105" ]
u133936772
p02772
python
s980940042
s336843062
20
17
2,940
2,940
Accepted
Accepted
15
eval(input());print((['DENIED','APPROVED'][all([i%3<1 or i%5<1 for i in list(map(int,input().split())) if i%2<1])]))
eval(input());print((['DENIED','APPROVED'][all(i%3<1 or i%5<1 for i in map(int,input().split()) if i%2<1)]))
1
1
108
100
eval(input()) print( ( ["DENIED", "APPROVED"][ all( [ i % 3 < 1 or i % 5 < 1 for i in list(map(int, input().split())) if i % 2 < 1 ] ) ] ) )
eval(input()) print( ( ["DENIED", "APPROVED"][ all(i % 3 < 1 or i % 5 < 1 for i in map(int, input().split()) if i % 2 < 1) ] ) )
false
0
[ "- all(", "- [", "- i % 3 < 1 or i % 5 < 1", "- for i in list(map(int, input().split()))", "- if i % 2 < 1", "- ]", "- )", "+ all(i % 3 < 1 or i % 5 < 1 for i in map(int, input().spl...
false
0.047541
0.118511
0.401148
[ "s980940042", "s336843062" ]
u214617707
p03276
python
s830382116
s309920789
135
101
14,480
14,224
Accepted
Accepted
25.19
n, k = list(map(int, input().split())) x = list(map(int, input().split())) pl, mi = 0, 0 recp, recm = [], [] for i in range(n): if x[i] >= 0: pl += 1 recp.append(x[i]) else: mi += 1 recm.append(x[i]) num = float("inf") recm = recm[:: -1] for i in range(pl + 1): ...
N, K = list(map(int, input().split())) X = list(map(int, input().split())) num = float("inf") for i in range(N - K + 1): p = X[i] q = X[i + K - 1] if q < 0: num = min(num, abs(p)) elif p < 0: num = min(num, abs(p) + 2 * abs(q)) num = min(num, abs(p) * 2 + abs(q)) e...
28
17
688
364
n, k = list(map(int, input().split())) x = list(map(int, input().split())) pl, mi = 0, 0 recp, recm = [], [] for i in range(n): if x[i] >= 0: pl += 1 recp.append(x[i]) else: mi += 1 recm.append(x[i]) num = float("inf") recm = recm[::-1] for i in range(pl + 1): if i == 0: ...
N, K = list(map(int, input().split())) X = list(map(int, input().split())) num = float("inf") for i in range(N - K + 1): p = X[i] q = X[i + K - 1] if q < 0: num = min(num, abs(p)) elif p < 0: num = min(num, abs(p) + 2 * abs(q)) num = min(num, abs(p) * 2 + abs(q)) else: ...
false
39.285714
[ "-n, k = list(map(int, input().split()))", "-x = list(map(int, input().split()))", "-pl, mi = 0, 0", "-recp, recm = [], []", "-for i in range(n):", "- if x[i] >= 0:", "- pl += 1", "- recp.append(x[i])", "+N, K = list(map(int, input().split()))", "+X = list(map(int, input().split()...
false
0.08574
0.130908
0.654959
[ "s830382116", "s309920789" ]
u887207211
p03644
python
s085136016
s720452967
21
17
3,316
2,940
Accepted
Accepted
19.05
N = int(eval(input())) for i in range(8,0,-1): if(2**i <= N): print((2**i)) break else: print((1))
N = int(eval(input())) tmp = 0 for i in range(2,N+1,2): cnt = 0 while True: if(i%2 != 0): break cnt += 1 i //= 2 tmp = max(tmp, cnt) print((2**tmp))
8
12
108
176
N = int(eval(input())) for i in range(8, 0, -1): if 2**i <= N: print((2**i)) break else: print((1))
N = int(eval(input())) tmp = 0 for i in range(2, N + 1, 2): cnt = 0 while True: if i % 2 != 0: break cnt += 1 i //= 2 tmp = max(tmp, cnt) print((2**tmp))
false
33.333333
[ "-for i in range(8, 0, -1):", "- if 2**i <= N:", "- print((2**i))", "- break", "-else:", "- print((1))", "+tmp = 0", "+for i in range(2, N + 1, 2):", "+ cnt = 0", "+ while True:", "+ if i % 2 != 0:", "+ break", "+ cnt += 1", "+ i //...
false
0.041343
0.042171
0.980371
[ "s085136016", "s720452967" ]
u989345508
p03450
python
s191702676
s000458777
1,572
1,363
128,996
129,008
Accepted
Accepted
13.3
#PyPy遅え import sys sys.setrecursionlimit(100000000) inf=1000000000000000000 n,m=list(map(int,input().split())) x=[inf]*n #まだ訪問してなければTrue check=[True]*n #どこと関係があるかを記録する(maybe right) lrd=[[] for i in range(n)] for i in range(m): l,r,d=list(map(int,input().split())) l-=1 r-=1 lrd[l].append((r...
#PyPy遅え import sys sys.setrecursionlimit(400000000) inf=1000000000000000000 n,m=list(map(int,input().split())) x=[inf]*n #まだ訪問してなければTrue check=[True]*n #どこと関係があるかを記録する(maybe right) lrd=[[] for i in range(n)] for i in range(m): l,r,d=list(map(int,input().split())) l-=1 r-=1 lrd[l].append((r...
61
53
1,169
1,047
# PyPy遅え import sys sys.setrecursionlimit(100000000) inf = 1000000000000000000 n, m = list(map(int, input().split())) x = [inf] * n # まだ訪問してなければTrue check = [True] * n # どこと関係があるかを記録する(maybe right) lrd = [[] for i in range(n)] for i in range(m): l, r, d = list(map(int, input().split())) l -= 1 r -= 1 l...
# PyPy遅え import sys sys.setrecursionlimit(400000000) inf = 1000000000000000000 n, m = list(map(int, input().split())) x = [inf] * n # まだ訪問してなければTrue check = [True] * n # どこと関係があるかを記録する(maybe right) lrd = [[] for i in range(n)] for i in range(m): l, r, d = list(map(int, input().split())) l -= 1 r -= 1 l...
false
13.114754
[ "-sys.setrecursionlimit(100000000)", "+sys.setrecursionlimit(400000000)", "-# まず初めのやつ", "-st = -1", "-for i in range(n):", "- if len(lrd[i]) >= 1:", "- st = i", "- break", "-", "-", "+# まず初めのやつ決定", "+# 非連結な場合を忘れていた", "+ else:", "+ if x[k[0]] != x[z] + k[1...
false
0.040997
0.038434
1.066698
[ "s191702676", "s000458777" ]
u849324100
p02836
python
s558444532
s365432635
19
17
3,188
2,940
Accepted
Accepted
10.53
import sys import math #a,b= map(int,input().split()) #li= [int(x) for x in input().split()] a=eval(input()) b=len(a) e=[] count=0 if b%2==0: c=a[math.floor(b/2):] f=int(b/2) f+=1 else: b+=1 c=a[math.floor(b/2):] f=int(b/2) e = list(reversed(c)) d=list(a) #print(str(d)+" "+str(e)) for i ...
import sys import math #a,b= map(int,input().split()) #li= [int(x) for x in input().split()] a=eval(input()) count=0 for i in range(len(a)//2): if a[i]==a[-i-1]: continue else: count+=1 print(count)
25
13
397
218
import sys import math # a,b= map(int,input().split()) # li= [int(x) for x in input().split()] a = eval(input()) b = len(a) e = [] count = 0 if b % 2 == 0: c = a[math.floor(b / 2) :] f = int(b / 2) f += 1 else: b += 1 c = a[math.floor(b / 2) :] f = int(b / 2) e = list(reversed(c)) d = list(a) #...
import sys import math # a,b= map(int,input().split()) # li= [int(x) for x in input().split()] a = eval(input()) count = 0 for i in range(len(a) // 2): if a[i] == a[-i - 1]: continue else: count += 1 print(count)
false
48
[ "-b = len(a)", "-e = []", "-if b % 2 == 0:", "- c = a[math.floor(b / 2) :]", "- f = int(b / 2)", "- f += 1", "-else:", "- b += 1", "- c = a[math.floor(b / 2) :]", "- f = int(b / 2)", "-e = list(reversed(c))", "-d = list(a)", "-# print(str(d)+\" \"+str(e))", "-for i in ra...
false
0.046766
0.046046
1.015619
[ "s558444532", "s365432635" ]
u102461423
p03175
python
s444300097
s367950791
489
307
116,400
73,388
Accepted
Accepted
37.22
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) MOD = 10 ** 9 + 7 N = int(eval(input())) graph = [[] for _ in range(N+1)] for _ in range(N-1): x,y = list(map(int,input().split())) graph[x].append(y) graph[y].append(x) def dfs(x=1,parent=None): b,w = 1,1 # 子がすべて白、子が何でも...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) m = list(map(int,read().split())) XY = list(zip(m,m)) MOD = 10**9 + 7 graph = [[] for _ in range(N+1)] for x,y in XY: graph[x].append(y) graph[y].append(x) ...
27
40
550
791
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) MOD = 10**9 + 7 N = int(eval(input())) graph = [[] for _ in range(N + 1)] for _ in range(N - 1): x, y = list(map(int, input().split())) graph[x].append(y) graph[y].append(x) def dfs(x=1, parent=None): b, w = 1, 1 # 子がすべて白、子が何でもよい ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) m = list(map(int, read().split())) XY = list(zip(m, m)) MOD = 10**9 + 7 graph = [[] for _ in range(N + 1)] for x, y in XY: graph[x].append(y) graph[y].append(x) root = 1 paren...
false
32.5
[ "-input = sys.stdin.readline", "-sys.setrecursionlimit(10**7)", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "+N = int(readline())", "+m = list(map(int, read().split()))", "+XY = list(zip(m, m))", "-N = int(eval(input()))", "-...
false
0.056594
0.187492
0.301846
[ "s444300097", "s367950791" ]
u503228842
p02717
python
s895494397
s114741533
173
23
38,384
9,088
Accepted
Accepted
86.71
X,Y,Z = list(map(int,input().split())) Y,X = X,Y X,Z = Z,X print((X,Y,Z))
x,y,z = list(map(int,input().split())) x,y = y,x x,z = z,x print((x,y,z))
4
5
68
71
X, Y, Z = list(map(int, input().split())) Y, X = X, Y X, Z = Z, X print((X, Y, Z))
x, y, z = list(map(int, input().split())) x, y = y, x x, z = z, x print((x, y, z))
false
20
[ "-X, Y, Z = list(map(int, input().split()))", "-Y, X = X, Y", "-X, Z = Z, X", "-print((X, Y, Z))", "+x, y, z = list(map(int, input().split()))", "+x, y = y, x", "+x, z = z, x", "+print((x, y, z))" ]
false
0.035924
0.037315
0.962728
[ "s895494397", "s114741533" ]
u939118618
p00168
python
s474628296
s539436922
20
10
4,360
4,352
Accepted
Accepted
50
from math import ceil dp = [1] + [0 for i in range(30)] for i in range(1,31): for step in [1,2,3]: if step <= i: dp[i] += dp[i-step] unit = 3650. while 1: n = int(input()) if n == 0: break print(int(ceil(dp[n] / unit)))
from math import ceil dp = [1] + [0 for i in range(33)] for i in range(0,30): for step in [1,2,3]: dp[i+step] += dp[i] unit = 3650. while 1: n = int(input()) if n == 0: break print(int(ceil(dp[n] / unit)))
12
11
244
226
from math import ceil dp = [1] + [0 for i in range(30)] for i in range(1, 31): for step in [1, 2, 3]: if step <= i: dp[i] += dp[i - step] unit = 3650.0 while 1: n = int(input()) if n == 0: break print(int(ceil(dp[n] / unit)))
from math import ceil dp = [1] + [0 for i in range(33)] for i in range(0, 30): for step in [1, 2, 3]: dp[i + step] += dp[i] unit = 3650.0 while 1: n = int(input()) if n == 0: break print(int(ceil(dp[n] / unit)))
false
8.333333
[ "-dp = [1] + [0 for i in range(30)]", "-for i in range(1, 31):", "+dp = [1] + [0 for i in range(33)]", "+for i in range(0, 30):", "- if step <= i:", "- dp[i] += dp[i - step]", "+ dp[i + step] += dp[i]" ]
false
0.036154
0.058626
0.616685
[ "s474628296", "s539436922" ]
u838644735
p02922
python
s967401278
s612850397
182
165
38,384
38,384
Accepted
Accepted
9.34
A, B = list(map(int, input().split())) if B == 1: print((0)) exit() count = 1 remain = B - A while True: if remain <= 0: print(count) break count += 1 remain -= (A - 1)
A, B = list(map(int, input().split())) if B == 1: print((0)) exit() count = 1 remain = B - A while remain > 0: count += 1 remain -= (A - 1) print(count)
14
13
212
176
A, B = list(map(int, input().split())) if B == 1: print((0)) exit() count = 1 remain = B - A while True: if remain <= 0: print(count) break count += 1 remain -= A - 1
A, B = list(map(int, input().split())) if B == 1: print((0)) exit() count = 1 remain = B - A while remain > 0: count += 1 remain -= A - 1 print(count)
false
7.142857
[ "-while True:", "- if remain <= 0:", "- print(count)", "- break", "+while remain > 0:", "+print(count)" ]
false
0.048051
0.139113
0.345409
[ "s967401278", "s612850397" ]
u564589929
p02754
python
s954350692
s986962586
19
17
3,064
3,064
Accepted
Accepted
10.53
n, a, b = list(map(int, input().split())) if a == 0: print((0)) else: c = n % (a+b) d = min(c, a) print(( int(n / (a+b)) * a + d ))
import sys sys.setrecursionlimit(10 ** 6) # input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def LI1(): retur...
9
25
141
582
n, a, b = list(map(int, input().split())) if a == 0: print((0)) else: c = n % (a + b) d = min(c, a) print((int(n / (a + b)) * a + d))
import sys sys.setrecursionlimit(10**6) # input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(eval(input())) def MI(): return list(map(int, input().split())) def MI1(): return list(map(int1, input().split())) def LI(): return list(map(int, input().split())) def...
false
64
[ "-n, a, b = list(map(int, input().split()))", "-if a == 0:", "- print((0))", "-else:", "- c = n % (a + b)", "- d = min(c, a)", "- print((int(n / (a + b)) * a + d))", "+import sys", "+", "+sys.setrecursionlimit(10**6)", "+# input = sys.stdin.readline ####", "+int1 = lambda x: int...
false
0.071566
0.053342
1.341647
[ "s954350692", "s986962586" ]
u171276253
p03254
python
s266514414
s432033664
21
17
3,316
3,064
Accepted
Accepted
19.05
n, x = list(map(int, input().split())) s = list(map(int,input().rstrip().split())) s.sort() sum = 0 cnt = 0 flg = True for ss in s: cnt += 1 sum += ss if(sum > x): print((cnt-1)) flg = False break if(flg): if (sum < x): print((cnt - 1)) else: ...
n, x = list(map(int, input().split())) s = list(map(int,input().rstrip().split())) s.sort() list_sum = sum(s) flg = True if list_sum < x: # 多すぎ print((len(s) - 1)) elif list_sum == x: # ちょうど print((len(s))) else: s.reverse() c = len(s) for ss in s: list_sum -= ss c -= 1...
24
22
339
443
n, x = list(map(int, input().split())) s = list(map(int, input().rstrip().split())) s.sort() sum = 0 cnt = 0 flg = True for ss in s: cnt += 1 sum += ss if sum > x: print((cnt - 1)) flg = False break if flg: if sum < x: print((cnt - 1)) else: print(cnt)
n, x = list(map(int, input().split())) s = list(map(int, input().rstrip().split())) s.sort() list_sum = sum(s) flg = True if list_sum < x: # 多すぎ print((len(s) - 1)) elif list_sum == x: # ちょうど print((len(s))) else: s.reverse() c = len(s) for ss in s: list_sum -= ss c -= 1 if...
false
8.333333
[ "-sum = 0", "-cnt = 0", "+list_sum = sum(s)", "-for ss in s:", "- cnt += 1", "- sum += ss", "- if sum > x:", "- print((cnt - 1))", "- flg = False", "- break", "-if flg:", "- if sum < x:", "- print((cnt - 1))", "- else:", "- print(cnt)", ...
false
0.046896
0.044294
1.058745
[ "s266514414", "s432033664" ]