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
u086769062
p02720
python
s154133244
s696092174
606
367
21,640
21,644
Accepted
Accepted
39.44
def lunlun(n): nums = set([1, 2, 3, 4, 5, 6, 7, 8, 9]) while len(nums) < n: old_nums = list(nums) for num in old_nums: num = str(num) if num[-1] == '0': adds = num + '0' if int(adds) not in nums: nums.add(int(adds)) adds = num + '1' if int(adds) not in nums: nums.add(in...
def lunlun(n): nums = set([1, 2, 3, 4, 5, 6, 7, 8, 9]) while len(nums) < n: old_nums = list(nums) for num in old_nums: num = str(num) if num[-1] == '0': adds = num + '0' if int(adds) not in nums: nums.add(int(adds)) adds = num + '1' if int(adds) not in nums: nums.add(in...
61
61
1,567
1,615
def lunlun(n): nums = set([1, 2, 3, 4, 5, 6, 7, 8, 9]) while len(nums) < n: old_nums = list(nums) for num in old_nums: num = str(num) if num[-1] == "0": adds = num + "0" if int(adds) not in nums: nums.add(int(adds)) ...
def lunlun(n): nums = set([1, 2, 3, 4, 5, 6, 7, 8, 9]) while len(nums) < n: old_nums = list(nums) for num in old_nums: num = str(num) if num[-1] == "0": adds = num + "0" if int(adds) not in nums: nums.add(int(adds)) ...
false
0
[ "- if num[0] == \"1\":", "- adds = \"1\" + num", "- if int(adds) not in nums:", "- nums.add(int(adds))", "- adds = \"2\" + num", "- if int(adds) not in nums:", "- nums.add(int(adds))", "- ...
false
0.097041
0.071802
1.351511
[ "s154133244", "s696092174" ]
u148551245
p03610
python
s670062034
s485248206
64
17
5,748
3,188
Accepted
Accepted
73.44
s = input() array = list(s) l = len(array) odd = array[0:l + 1:2] for c in odd: print(c,end='')
s = eval(input()) ans = s[::2] print(ans)
6
3
104
37
s = input() array = list(s) l = len(array) odd = array[0 : l + 1 : 2] for c in odd: print(c, end="")
s = eval(input()) ans = s[::2] print(ans)
false
50
[ "-s = input()", "-array = list(s)", "-l = len(array)", "-odd = array[0 : l + 1 : 2]", "-for c in odd:", "- print(c, end=\"\")", "+s = eval(input())", "+ans = s[::2]", "+print(ans)" ]
false
0.10735
0.045751
2.346409
[ "s670062034", "s485248206" ]
u457283867
p02555
python
s584006932
s162428754
487
26
9,216
9,168
Accepted
Accepted
94.66
s = int(eval(input())) mod = 10**9+7 dp = [0]*(s+1) dp[0] = 1 for i in range(1,s+1): for j in range(0,(i-3)+1): dp[i] += dp[j] dp[i] %= mod print((dp[s]))
s = int(eval(input())) mod = 10**9+7 dp = [0]*(s+1) dp[0] = 1 x = 0 for i in range(1,s+1): if i-3 >= 0: x += dp[i-3] x %= mod dp[i] = x print((dp[s]))
11
13
168
168
s = int(eval(input())) mod = 10**9 + 7 dp = [0] * (s + 1) dp[0] = 1 for i in range(1, s + 1): for j in range(0, (i - 3) + 1): dp[i] += dp[j] dp[i] %= mod print((dp[s]))
s = int(eval(input())) mod = 10**9 + 7 dp = [0] * (s + 1) dp[0] = 1 x = 0 for i in range(1, s + 1): if i - 3 >= 0: x += dp[i - 3] x %= mod dp[i] = x print((dp[s]))
false
15.384615
[ "+x = 0", "- for j in range(0, (i - 3) + 1):", "- dp[i] += dp[j]", "- dp[i] %= mod", "+ if i - 3 >= 0:", "+ x += dp[i - 3]", "+ x %= mod", "+ dp[i] = x" ]
false
0.469958
0.035174
13.360939
[ "s584006932", "s162428754" ]
u576432509
p03361
python
s592971783
s101554895
20
18
3,188
3,064
Accepted
Accepted
10
h,w=list(map(int,input().split())) s=[] t=[] for hh in range(h): s.append(list(eval(input()))) t.append([1]*w) for hh in range(h): for ww in range(w): if s[hh][ww]==".": t[hh][ww]=0 else: if hh==0: if s[hh+1][ww]=="#": ...
h,w=list(map(int,input().split())) s=[[0]*(w+2) for i in range(h+2)] for i in range(h): s[i+1]=[0]+list(eval(input()))+[0] yn="" for i in range(1,h+2): for j in range(1,w+2): if s[i][j]=="#": if s[i-1][j]=="#": continue elif s[i+1][j]=="#": ...
45
27
1,065
619
h, w = list(map(int, input().split())) s = [] t = [] for hh in range(h): s.append(list(eval(input()))) t.append([1] * w) for hh in range(h): for ww in range(w): if s[hh][ww] == ".": t[hh][ww] = 0 else: if hh == 0: if s[hh + 1][ww] == "#": ...
h, w = list(map(int, input().split())) s = [[0] * (w + 2) for i in range(h + 2)] for i in range(h): s[i + 1] = [0] + list(eval(input())) + [0] yn = "" for i in range(1, h + 2): for j in range(1, w + 2): if s[i][j] == "#": if s[i - 1][j] == "#": continue elif s[i +...
false
40
[ "-s = []", "-t = []", "-for hh in range(h):", "- s.append(list(eval(input())))", "- t.append([1] * w)", "-for hh in range(h):", "- for ww in range(w):", "- if s[hh][ww] == \".\":", "- t[hh][ww] = 0", "- else:", "- if hh == 0:", "- if ...
false
0.03588
0.038353
0.935533
[ "s592971783", "s101554895" ]
u389910364
p02839
python
s688785000
s438417489
857
476
235,656
125,924
Accepted
Accepted
44.46
import itertools import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 H, W = list(map(int, sys.stdin.buffer.readline().split())) A = [list(map(int, sys.stdin.buffer.readli...
import itertools import os import sys import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 # int で bitset をします # https://twitter.com/armeria_betrue/status/120368129882645...
43
47
1,138
1,181
import itertools import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10**9) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 # MOD = 998244353 H, W = list(map(int, sys.stdin.buffer.readline().split())) A = [list(map(int, sys.stdin.buffer.readline().split())) for _ in ...
import itertools import os import sys import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10**9) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 # MOD = 998244353 # int で bitset をします # https://twitter.com/armeria_betrue/status/1203681298826452993 H, W = list(map(int, s...
false
8.510638
[ "+import numpy as np", "+# int で bitset をします", "+# https://twitter.com/armeria_betrue/status/1203681298826452993", "-grid = [[0] * W for _ in range(H)]", "-for h, w in itertools.product(list(range(H)), list(range(W))):", "- grid[h][w] = A[h][w] - B[h][w]", "-# 符号をどっちにするか選べる", "-dp = [[set() for _ i...
false
0.040671
0.297172
0.136862
[ "s688785000", "s438417489" ]
u646412443
p02899
python
s540105741
s033737417
216
107
24,284
14,008
Accepted
Accepted
50.46
n = int(input()) a = list(map(int, input().split())) d = {} for i in range(n): d[a[i]] = i+1 d = sorted(d.items()) for i in range(n): print(d[i][1], end=' ') print()
n = int(eval(input())) a = list(map(int, input().split())) ans = [0] * n for i in range(n): ans[a[i]-1] = i+1 print((*ans))
9
6
182
125
n = int(input()) a = list(map(int, input().split())) d = {} for i in range(n): d[a[i]] = i + 1 d = sorted(d.items()) for i in range(n): print(d[i][1], end=" ") print()
n = int(eval(input())) a = list(map(int, input().split())) ans = [0] * n for i in range(n): ans[a[i] - 1] = i + 1 print((*ans))
false
33.333333
[ "-n = int(input())", "+n = int(eval(input()))", "-d = {}", "+ans = [0] * n", "- d[a[i]] = i + 1", "-d = sorted(d.items())", "-for i in range(n):", "- print(d[i][1], end=\" \")", "-print()", "+ ans[a[i] - 1] = i + 1", "+print((*ans))" ]
false
0.055412
0.088609
0.625356
[ "s540105741", "s033737417" ]
u057109575
p02725
python
s286440243
s536627621
259
118
91,052
99,956
Accepted
Accepted
54.44
K, N, *A = list(map(int, open(0).read().split())) diff = A[0] + K - A[-1] for i in range(1, N): diff = max(diff, A[i] - A[i - 1]) print((K - diff))
from os import readlink K, N = list(map(int, input().split())) X = list(map(int, input().split())) ans = K - (X[0] + K - X[-1]) for i in range(1, N): ans = min(ans, K - (X[i] - X[i - 1])) print(ans)
6
11
150
211
K, N, *A = list(map(int, open(0).read().split())) diff = A[0] + K - A[-1] for i in range(1, N): diff = max(diff, A[i] - A[i - 1]) print((K - diff))
from os import readlink K, N = list(map(int, input().split())) X = list(map(int, input().split())) ans = K - (X[0] + K - X[-1]) for i in range(1, N): ans = min(ans, K - (X[i] - X[i - 1])) print(ans)
false
45.454545
[ "-K, N, *A = list(map(int, open(0).read().split()))", "-diff = A[0] + K - A[-1]", "+from os import readlink", "+", "+K, N = list(map(int, input().split()))", "+X = list(map(int, input().split()))", "+ans = K - (X[0] + K - X[-1])", "- diff = max(diff, A[i] - A[i - 1])", "-print((K - diff))", "+ ...
false
0.048311
0.048268
1.000883
[ "s286440243", "s536627621" ]
u079022693
p02787
python
s884862990
s998224023
616
553
126,960
127,216
Accepted
Accepted
10.23
H,N=list(map(int,input().split())) A=[] B=[] for i in range(N): a,b=list(map(int,input().split())) A.append(a) B.append(b) DP=[[0]*(H+max(A)) for i in range(N)] DP.insert(0,[10**8+1]*(H+max(A))) DP[0][0]=0 for i in range(1,N+1): for j in range(1,H+max(A)): if j-A[i-1]>0: DP[i...
H,N=list(map(int,input().split())) A=[] B=[] for i in range(N): a,b=list(map(int,input().split())) A.append(a) B.append(b) DP=[[0]*(H+max(A)) for i in range(N)] DP.insert(0,[10**8+1]*(H+max(A))) DP[0][0]=0 for i in range(1,N+1): for j in range(1,H+1): if j-A[i-1]>0: DP[i][j]=...
20
20
425
420
H, N = list(map(int, input().split())) A = [] B = [] for i in range(N): a, b = list(map(int, input().split())) A.append(a) B.append(b) DP = [[0] * (H + max(A)) for i in range(N)] DP.insert(0, [10**8 + 1] * (H + max(A))) DP[0][0] = 0 for i in range(1, N + 1): for j in range(1, H + max(A)): if j -...
H, N = list(map(int, input().split())) A = [] B = [] for i in range(N): a, b = list(map(int, input().split())) A.append(a) B.append(b) DP = [[0] * (H + max(A)) for i in range(N)] DP.insert(0, [10**8 + 1] * (H + max(A))) DP[0][0] = 0 for i in range(1, N + 1): for j in range(1, H + 1): if j - A[i ...
false
0
[ "- for j in range(1, H + max(A)):", "+ for j in range(1, H + 1):" ]
false
0.155997
0.144131
1.082323
[ "s884862990", "s998224023" ]
u162612857
p03652
python
s105069941
s612466812
1,312
734
10,188
10,252
Accepted
Accepted
44.05
# chokudaiブログの典型力の話を意識しつつ考えたら思いついた! # 「ある集合の部分集合の中で、〜〜〜の値が最小になるものを求めよ」のパターン # 愚直にやると2^Nを調べねばならず無理。 # したがって「一部を調べればよい」に帰着するのが多いだろう。 # 何らかの形でソートしておいて、空集合から1つずつ付け加えるとか。全体集合から1つずつ取り去るとか。 # 今回は全体集合から1つずつ取り去るのを考えるとできる。 # 全体集合である競技m0が最多の人数p0人を集めたとする。 # すると、全ての部分集合のうち「m0を含む集合」を考えると、競技m0は必ずp0人以上集まるので解もp0以上。 # ここで「m0...
# chokudaiブログの典型力の話を意識しつつ考えたら思いついた! # 「ある集合の部分集合の中で、〜〜〜の値が最小になるものを求めよ」のパターン # 愚直にやると2^Nを調べねばならず無理。 # したがって「一部を調べればよい」に帰着するのが多いだろう。 # 何らかの形でソートしておいて、空集合から1つずつ付け加えるとか。全体集合から1つずつ取り去るとか。 # 今回は全体集合から1つずつ取り去るのを考えるとできる。 # 全体集合である競技m0が最多の人数p0人を集めたとする。 # すると、全ての部分集合のうち「m0を含む集合」を考えると、競技m0は必ずp0人以上集まるので解もp0以上。 # ここで「m0...
39
38
1,091
1,100
# chokudaiブログの典型力の話を意識しつつ考えたら思いついた! # 「ある集合の部分集合の中で、〜〜〜の値が最小になるものを求めよ」のパターン # 愚直にやると2^Nを調べねばならず無理。 # したがって「一部を調べればよい」に帰着するのが多いだろう。 # 何らかの形でソートしておいて、空集合から1つずつ付け加えるとか。全体集合から1つずつ取り去るとか。 # 今回は全体集合から1つずつ取り去るのを考えるとできる。 # 全体集合である競技m0が最多の人数p0人を集めたとする。 # すると、全ての部分集合のうち「m0を含む集合」を考えると、競技m0は必ずp0人以上集まるので解もp0以上。 # ここで「m0を含む集合」について一気...
# chokudaiブログの典型力の話を意識しつつ考えたら思いついた! # 「ある集合の部分集合の中で、〜〜〜の値が最小になるものを求めよ」のパターン # 愚直にやると2^Nを調べねばならず無理。 # したがって「一部を調べればよい」に帰着するのが多いだろう。 # 何らかの形でソートしておいて、空集合から1つずつ付け加えるとか。全体集合から1つずつ取り去るとか。 # 今回は全体集合から1つずつ取り去るのを考えるとできる。 # 全体集合である競技m0が最多の人数p0人を集めたとする。 # すると、全ての部分集合のうち「m0を含む集合」を考えると、競技m0は必ずp0人以上集まるので解もp0以上。 # ここで「m0を含む集合」について一気...
false
2.564103
[ "- for idx, par in enumerate(parti):", "- if par == temp:", "- held_sports.remove(idx)", "+ indices = [i for i, val in enumerate(parti) if val == temp]", "+ held_sports = held_sports - set(indices)" ]
false
0.048122
0.051474
0.934874
[ "s105069941", "s612466812" ]
u867848444
p03575
python
s645836377
s162467885
211
182
42,608
40,940
Accepted
Accepted
13.74
from sys import setrecursionlimit #setrecursionlimit(10**5) class UnionFind: def __init__(self, n): # 親要素のノード番号を格納 # par[x]=xの時そのノードは根  self.par = [i for i in range(n + 1)] # rank self.rank = [0] * (n + 1) self.size = [1] * (n + 1) def find(self, x): ...
#グラフの連結成分を調べる def Graph(ab): G=[[] for i in range(n)] for a,b in ab: G[a-1].append(b) G[b-1].append(a) return G from collections import deque def dfs(G, a, b): #(a, b)は除外する辺 q=deque() q.append((1, -1, 0)) log = [0] * n log[0] = 1 while q: V,P,...
55
40
1,436
884
from sys import setrecursionlimit # setrecursionlimit(10**5) class UnionFind: def __init__(self, n): # 親要素のノード番号を格納 # par[x]=xの時そのノードは根 self.par = [i for i in range(n + 1)] # rank self.rank = [0] * (n + 1) self.size = [1] * (n + 1) def find(self, x): # 根...
# グラフの連結成分を調べる def Graph(ab): G = [[] for i in range(n)] for a, b in ab: G[a - 1].append(b) G[b - 1].append(a) return G from collections import deque def dfs(G, a, b): # (a, b)は除外する辺 q = deque() q.append((1, -1, 0)) log = [0] * n log[0] = 1 while q: V, P, ...
false
27.272727
[ "-from sys import setrecursionlimit", "+# グラフの連結成分を調べる", "+def Graph(ab):", "+ G = [[] for i in range(n)]", "+ for a, b in ab:", "+ G[a - 1].append(b)", "+ G[b - 1].append(a)", "+ return G", "-# setrecursionlimit(10**5)", "-class UnionFind:", "- def __init__(self, n):",...
false
0.046034
0.045271
1.016838
[ "s645836377", "s162467885" ]
u137542041
p03147
python
s241943298
s493028180
32
26
9,172
9,120
Accepted
Accepted
18.75
N = int(eval(input())) H = list(map(int, input().split())) H.append(0) cnt = 0 for i in range(N + 1): cnt += max(H[i] - H[i - 1], 0) print(cnt)
N = int(eval(input())) H = list(map(int, input().split())) H = [0] + H cnt = 0 for i in range(1, N + 1): cnt += max(H[i] - H[i - 1], 0) print(cnt)
10
10
153
156
N = int(eval(input())) H = list(map(int, input().split())) H.append(0) cnt = 0 for i in range(N + 1): cnt += max(H[i] - H[i - 1], 0) print(cnt)
N = int(eval(input())) H = list(map(int, input().split())) H = [0] + H cnt = 0 for i in range(1, N + 1): cnt += max(H[i] - H[i - 1], 0) print(cnt)
false
0
[ "-H.append(0)", "+H = [0] + H", "-for i in range(N + 1):", "+for i in range(1, N + 1):" ]
false
0.043007
0.044173
0.973618
[ "s241943298", "s493028180" ]
u600402037
p02675
python
s265555433
s015501624
24
22
9,044
9,052
Accepted
Accepted
8.33
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = sr() N = N[-1] if N == '3': answer = 'bon' elif N in ['0', '1', '6', '8']: answer = 'pon' else: answer = 'hon' print(answer)
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = sr()[-1] if N == '3': answer = 'bon' elif N in '0168': answer = 'pon' else: answer = 'hon' print(answer)
17
17
295
276
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = sr() N = N[-1] if N == "3": answer = "bon" elif N in ["0", "1", "6", "8"]: answer = "pon" else: answer = "hon" print(answer)
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = sr()[-1] if N == "3": answer = "bon" elif N in "0168": answer = "pon" else: answer = "hon" print(answer)
false
0
[ "-N = sr()", "-N = N[-1]", "+N = sr()[-1]", "-elif N in [\"0\", \"1\", \"6\", \"8\"]:", "+elif N in \"0168\":" ]
false
0.045078
0.044067
1.022937
[ "s265555433", "s015501624" ]
u282228874
p03475
python
s820198494
s693399630
142
97
3,188
3,060
Accepted
Accepted
31.69
from math import ceil n = int(eval(input())) CSF = [list(map(int,input().split())) for i in range(n-1)] for i in range(n-1): time = CSF[i][1]+CSF[i][0] for j in range(i+1,n-1): if (time-CSF[j][1])%CSF[j][2] != 0 or time-CSF[j][1]<0: time = max(CSF[j][1],CSF[j][2]*(ceil(time/CSF[j][2]))) time += CSF...
from math import ceil n = int(input()) cur = [0]*n for i in range(n-1): c,s,f = map(int,input().split()) for j in range(i+1): cur[j] = max(s,ceil(cur[j]/f)*f)+c print(*cur,sep='\n')
13
8
344
192
from math import ceil n = int(eval(input())) CSF = [list(map(int, input().split())) for i in range(n - 1)] for i in range(n - 1): time = CSF[i][1] + CSF[i][0] for j in range(i + 1, n - 1): if (time - CSF[j][1]) % CSF[j][2] != 0 or time - CSF[j][1] < 0: time = max(CSF[j][1], CSF[j][2] * (cei...
from math import ceil n = int(input()) cur = [0] * n for i in range(n - 1): c, s, f = map(int, input().split()) for j in range(i + 1): cur[j] = max(s, ceil(cur[j] / f) * f) + c print(*cur, sep="\n")
false
38.461538
[ "-n = int(eval(input()))", "-CSF = [list(map(int, input().split())) for i in range(n - 1)]", "+n = int(input())", "+cur = [0] * n", "- time = CSF[i][1] + CSF[i][0]", "- for j in range(i + 1, n - 1):", "- if (time - CSF[j][1]) % CSF[j][2] != 0 or time - CSF[j][1] < 0:", "- time ...
false
0.037466
0.095696
0.391505
[ "s820198494", "s693399630" ]
u535171899
p02832
python
s684798007
s234064845
133
106
26,012
26,268
Accepted
Accepted
20.3
n = int(eval(input())) a_inputs = [int(i) for i in input().split()] a_only = list(set(a_inputs)) ans=0 count=0 for i in range(len(a_inputs)): if a_inputs[i]==(count+1): count+=1 continue else: ans+=1 if a_inputs==a_only: print((0)) elif 1 not in a_inputs: prin...
n = int(eval(input())) A = list(map(int,input().split())) if 1 not in A: print((-1));exit() tmp=0 for i in range(n): if A[i]==tmp+1: tmp+=1 print((n-tmp))
20
11
340
172
n = int(eval(input())) a_inputs = [int(i) for i in input().split()] a_only = list(set(a_inputs)) ans = 0 count = 0 for i in range(len(a_inputs)): if a_inputs[i] == (count + 1): count += 1 continue else: ans += 1 if a_inputs == a_only: print((0)) elif 1 not in a_inputs: print((-1)...
n = int(eval(input())) A = list(map(int, input().split())) if 1 not in A: print((-1)) exit() tmp = 0 for i in range(n): if A[i] == tmp + 1: tmp += 1 print((n - tmp))
false
45
[ "-a_inputs = [int(i) for i in input().split()]", "-a_only = list(set(a_inputs))", "-ans = 0", "-count = 0", "-for i in range(len(a_inputs)):", "- if a_inputs[i] == (count + 1):", "- count += 1", "- continue", "- else:", "- ans += 1", "-if a_inputs == a_only:", "- ...
false
0.04283
0.042145
1.016267
[ "s684798007", "s234064845" ]
u767797498
p03434
python
s623726488
s835370840
31
28
9,016
8,968
Accepted
Accepted
9.68
n=int(eval(input())) a=list(map(int,input().split())) a.sort(reverse=True) pt=0 for i in a[::2]: pt+=i for i in a[1::2]: pt-=i print(pt)
n=int(eval(input())) a=list(map(int,input().split())) a.sort(reverse=True) print((sum(a[::2])-sum(a[1::2])))
9
4
142
103
n = int(eval(input())) a = list(map(int, input().split())) a.sort(reverse=True) pt = 0 for i in a[::2]: pt += i for i in a[1::2]: pt -= i print(pt)
n = int(eval(input())) a = list(map(int, input().split())) a.sort(reverse=True) print((sum(a[::2]) - sum(a[1::2])))
false
55.555556
[ "-pt = 0", "-for i in a[::2]:", "- pt += i", "-for i in a[1::2]:", "- pt -= i", "-print(pt)", "+print((sum(a[::2]) - sum(a[1::2])))" ]
false
0.050169
0.049516
1.013189
[ "s623726488", "s835370840" ]
u301624971
p03043
python
s810436114
s169985363
30
27
3,064
3,064
Accepted
Accepted
10
def myAnswer(N:int,K:int) -> int: ans = 0 for n in range(1,N+1): sub = K - n counter = 0 total = n if(total >= K): ans += 1/N continue while True: total *= 2 counter += 1 if(total >= K): break ans += 1/N * (...
def myAnswer(N:int,K:int) -> int: ans = 0 for n in range(1,N+1): total = n if(total >= K): ans += 1/N else: counter = 0 while True: total *= 2 counter += 1 if(total >= K): break ans += 1/N * (1/2)...
24
23
493
489
def myAnswer(N: int, K: int) -> int: ans = 0 for n in range(1, N + 1): sub = K - n counter = 0 total = n if total >= K: ans += 1 / N continue while True: total *= 2 counter += 1 if total >= K: bre...
def myAnswer(N: int, K: int) -> int: ans = 0 for n in range(1, N + 1): total = n if total >= K: ans += 1 / N else: counter = 0 while True: total *= 2 counter += 1 if total >= K: break ...
false
4.166667
[ "- sub = K - n", "- counter = 0", "- continue", "- while True:", "- total *= 2", "- counter += 1", "- if total >= K:", "- break", "- ans += 1 / N * (1 / 2) ** counter", "+ else:", "+ counter ...
false
0.045536
0.058005
0.785041
[ "s810436114", "s169985363" ]
u069838609
p03290
python
s681658667
s052958874
1,694
24
42,472
3,064
Accepted
Accepted
98.58
from itertools import permutations from math import ceil, floor D, G = [int(elem) for elem in input().split(' ')] point_info_list = [[int(elem) for elem in input().split()] for _ in range(D)] assert len(point_info_list) == D assert len(point_info_list[0]) == 2 min_num = float('inf') for perm in permutations(...
from itertools import permutations, product from math import ceil, floor D, G = [int(elem) for elem in input().split(' ')] point_info_list = [[int(elem) for elem in input().split()] for _ in range(D)] assert len(point_info_list) == D assert len(point_info_list[0]) == 2 # time complexity: O(D!) """ min_num = ...
26
55
1,003
2,097
from itertools import permutations from math import ceil, floor D, G = [int(elem) for elem in input().split(" ")] point_info_list = [[int(elem) for elem in input().split()] for _ in range(D)] assert len(point_info_list) == D assert len(point_info_list[0]) == 2 min_num = float("inf") for perm in permutations(list(range...
from itertools import permutations, product from math import ceil, floor D, G = [int(elem) for elem in input().split(" ")] point_info_list = [[int(elem) for elem in input().split()] for _ in range(D)] assert len(point_info_list) == D assert len(point_info_list[0]) == 2 # time complexity: O(D!) """ min_num = float('inf...
false
52.727273
[ "-from itertools import permutations", "+from itertools import permutations, product", "-min_num = float(\"inf\")", "-for perm in permutations(list(range(D))):", "+# time complexity: O(D!)", "+\"\"\" min_num = float('inf')", "+for perm in permutations(range(D)):", "- elif (G - current_point) - ...
false
0.044498
0.043764
1.016777
[ "s681658667", "s052958874" ]
u480138356
p03295
python
s186973663
s076072327
306
263
29,924
29,920
Accepted
Accepted
14.05
import sys input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) ab = sorted([list(map(int, input().split())) for i in range(M)], key = lambda x:x[1]) count = 0 break_ = -1 for a, b in ab: a -= 1; b -= 1; if a > break_: count += 1 ...
import sys input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) ab = sorted([list(map(int, input().split())) for i in range(M)], key=lambda x:x[1]) B = 0 ans = 0 for i in range(M): a, b = ab[i] if a >= B: B = b ans += 1 ...
17
18
395
372
import sys input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) ab = sorted([list(map(int, input().split())) for i in range(M)], key=lambda x: x[1]) count = 0 break_ = -1 for a, b in ab: a -= 1 b -= 1 if a > break_: count += 1 ...
import sys input = sys.stdin.readline def main(): N, M = list(map(int, input().split())) ab = sorted([list(map(int, input().split())) for i in range(M)], key=lambda x: x[1]) B = 0 ans = 0 for i in range(M): a, b = ab[i] if a >= B: B = b ans += 1 print(a...
false
5.555556
[ "- count = 0", "- break_ = -1", "- for a, b in ab:", "- a -= 1", "- b -= 1", "- if a > break_:", "- count += 1", "- break_ = b - 1", "- print(count)", "+ B = 0", "+ ans = 0", "+ for i in range(M):", "+ a, b = ab[i]", "+...
false
0.036365
0.042308
0.859532
[ "s186973663", "s076072327" ]
u941438707
p02726
python
s055713143
s099498875
1,999
1,613
3,572
9,396
Accepted
Accepted
19.31
from itertools import * n,x,y=map(int,input().split()) a=[0]*n for i,j in combinations(range(1,n+1),2): b=min(abs(i-j),abs(x-i)+1+abs(y-j),abs(x-j)+1+abs(y-i)) a[b]+=1 print(*a[1:],sep="\n")
n,x,y=map(int,input().split()) a=[0]*n for i in range(1,n+1): for j in range(i,n+1): b=min(abs(i-j),abs(i-x)+1+abs(y-j),abs(x-j)+1+abs(y-i)) a[b]+=1 print(*a[1:],sep="\n")
7
7
207
197
from itertools import * n, x, y = map(int, input().split()) a = [0] * n for i, j in combinations(range(1, n + 1), 2): b = min(abs(i - j), abs(x - i) + 1 + abs(y - j), abs(x - j) + 1 + abs(y - i)) a[b] += 1 print(*a[1:], sep="\n")
n, x, y = map(int, input().split()) a = [0] * n for i in range(1, n + 1): for j in range(i, n + 1): b = min(abs(i - j), abs(i - x) + 1 + abs(y - j), abs(x - j) + 1 + abs(y - i)) a[b] += 1 print(*a[1:], sep="\n")
false
0
[ "-from itertools import *", "-", "-for i, j in combinations(range(1, n + 1), 2):", "- b = min(abs(i - j), abs(x - i) + 1 + abs(y - j), abs(x - j) + 1 + abs(y - i))", "- a[b] += 1", "+for i in range(1, n + 1):", "+ for j in range(i, n + 1):", "+ b = min(abs(i - j), abs(i - x) + 1 + abs(...
false
0.09295
0.071657
1.297163
[ "s055713143", "s099498875" ]
u048945791
p03240
python
s883617037
s020347621
152
95
3,064
3,188
Accepted
Accepted
37.5
n = int(eval(input())) x = [] y = [] h = [] for i in range(n): xi, yi, hi = list(map(int, input().split())) x.append(xi) y.append(yi) h.append(hi) isOk = False i = 0 j = 0 constant = -1 for i in range(101): for j in range(101): constant = -1 for xi, yi, hi in ...
n = int(eval(input())) xyh = [None] * n for i in range(n): xyh[i] = list(map(int, input().split())) isOk = False i = 0 j = 0 constant = -1 for i in range(101): for j in range(101): constant = -1 for xyhTemp in xyh: if xyhTemp[2] != 0: temp = xy...
43
39
851
805
n = int(eval(input())) x = [] y = [] h = [] for i in range(n): xi, yi, hi = list(map(int, input().split())) x.append(xi) y.append(yi) h.append(hi) isOk = False i = 0 j = 0 constant = -1 for i in range(101): for j in range(101): constant = -1 for xi, yi, hi in zip(x, y, h): ...
n = int(eval(input())) xyh = [None] * n for i in range(n): xyh[i] = list(map(int, input().split())) isOk = False i = 0 j = 0 constant = -1 for i in range(101): for j in range(101): constant = -1 for xyhTemp in xyh: if xyhTemp[2] != 0: temp = xyhTemp[2] + abs(i - xyhTe...
false
9.302326
[ "-x = []", "-y = []", "-h = []", "+xyh = [None] * n", "- xi, yi, hi = list(map(int, input().split()))", "- x.append(xi)", "- y.append(yi)", "- h.append(hi)", "+ xyh[i] = list(map(int, input().split()))", "- for xi, yi, hi in zip(x, y, h):", "- if hi != 0:", "- ...
false
0.039451
0.036014
1.095436
[ "s883617037", "s020347621" ]
u811733736
p02412
python
s546117384
s556760576
560
30
7,708
5,664
Accepted
Accepted
94.64
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_B&lang=jp """ import sys from sys import stdin from itertools import combinations input = stdin.readline def main(args): while True: n, x = list(map(int, input().split())) if n == 0 and x == ...
# -*- coding: utf-8 -*- """ """ import sys from sys import stdin from math import factorial input = stdin.readline def solve(n, x): ans = 0 for a in range(1, n+1): for b in range(a+1, n+1): if b < (x - a - b) <= n: ans += 1 return ans def main(args):...
28
30
543
535
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_B&lang=jp """ import sys from sys import stdin from itertools import combinations input = stdin.readline def main(args): while True: n, x = list(map(int, input().split())) if n == 0 and x == 0: ...
# -*- coding: utf-8 -*- """ """ import sys from sys import stdin from math import factorial input = stdin.readline def solve(n, x): ans = 0 for a in range(1, n + 1): for b in range(a + 1, n + 1): if b < (x - a - b) <= n: ans += 1 return ans def main(args): while ...
false
6.666667
[ "-http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_B&lang=jp", "-from itertools import combinations", "+from math import factorial", "+", "+", "+def solve(n, x):", "+ ans = 0", "+ for a in range(1, n + 1):", "+ for b in range(a + 1, n + 1):", "+ if b < (x - a...
false
0.034421
0.036523
0.942454
[ "s546117384", "s556760576" ]
u077291787
p02954
python
s277024654
s770318852
146
131
9,476
9,472
Accepted
Accepted
10.27
# ABC136D - Gathering Children def main(): S = input().rstrip() + "R" n = len(S) # decompose into partial strings (RR...LL) cur, P = S[0], [] for i in S[1:]: if cur[-1] == "L" and i == "R": P += [cur] cur = "" cur += i # children on even numbers...
# ABC136D - Gathering Children def main(): # children gather on the border of "RL" S = eval(input()) # decompose into partial strings (RR...LL) P = S.replace("LR", "L R").split() ans = [] for p in P: # children on even numbers -> even, odds -> odd e, o = len(p) // 2, len...
24
17
706
536
# ABC136D - Gathering Children def main(): S = input().rstrip() + "R" n = len(S) # decompose into partial strings (RR...LL) cur, P = S[0], [] for i in S[1:]: if cur[-1] == "L" and i == "R": P += [cur] cur = "" cur += i # children on even numbers -> even, o...
# ABC136D - Gathering Children def main(): # children gather on the border of "RL" S = eval(input()) # decompose into partial strings (RR...LL) P = S.replace("LR", "L R").split() ans = [] for p in P: # children on even numbers -> even, odds -> odd e, o = len(p) // 2, len(p) // 2 ...
false
29.166667
[ "- S = input().rstrip() + \"R\"", "- n = len(S)", "+ # children gather on the border of \"RL\"", "+ S = eval(input())", "- cur, P = S[0], []", "- for i in S[1:]:", "- if cur[-1] == \"L\" and i == \"R\":", "- P += [cur]", "- cur = \"\"", "- cur ...
false
0.049595
0.193084
0.256859
[ "s277024654", "s770318852" ]
u514118270
p02615
python
s498493848
s958214113
184
129
128,660
31,552
Accepted
Accepted
29.89
import sys import math import itertools import bisect from copy import copy from collections import deque,Counter from decimal import Decimal def s(): return eval(input()) def i(): return int(eval(input())) def S(): return input().split() def I(): return list(map(int,input().split())) def L(): return list(in...
N=int(eval(input())) l=sorted(list(map(int,input().split()))) l.reverse() s=l[0]+N%2*l[N//2] for i in range(N//2-1): s+=l[i+1]*2 print(s)
30
7
658
139
import sys import math import itertools import bisect from copy import copy from collections import deque, Counter from decimal import Decimal def s(): return eval(input()) def i(): return int(eval(input())) def S(): return input().split() def I(): return list(map(int, input().split())) def L(...
N = int(eval(input())) l = sorted(list(map(int, input().split()))) l.reverse() s = l[0] + N % 2 * l[N // 2] for i in range(N // 2 - 1): s += l[i + 1] * 2 print(s)
false
76.666667
[ "-import sys", "-import math", "-import itertools", "-import bisect", "-from copy import copy", "-from collections import deque, Counter", "-from decimal import Decimal", "-", "-", "-def s():", "- return eval(input())", "-", "-", "-def i():", "- return int(eval(input()))", "-", ...
false
0.046336
0.039604
1.169988
[ "s498493848", "s958214113" ]
u344655022
p02555
python
s890722446
s315627540
336
73
80,256
64,820
Accepted
Accepted
78.27
import sys input = sys.stdin.readline INF = 10**18 sys.setrecursionlimit(10**6) import math D = 10 ** 9 + 7 # 組み合わせの総数 nCr def combinations_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) S = int(eval(input())) max_length = S // 3 total = 0 for i in range(m...
s = int(eval(input())) mod = 10**9 + 7 # dp[i]: 最後に切った場所がi dp = [0]*(s + 1) dp[0] = 1 for i in range(1, s+1): for j in range(0, (i-3)+1): dp[i] += dp[j] dp[i] %= mod print((dp[s]))
24
13
442
207
import sys input = sys.stdin.readline INF = 10**18 sys.setrecursionlimit(10**6) import math D = 10**9 + 7 # 組み合わせの総数 nCr def combinations_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) S = int(eval(input())) max_length = S // 3 total = 0 for i in range(max_length): N = ...
s = int(eval(input())) mod = 10**9 + 7 # dp[i]: 最後に切った場所がi dp = [0] * (s + 1) dp[0] = 1 for i in range(1, s + 1): for j in range(0, (i - 3) + 1): dp[i] += dp[j] dp[i] %= mod print((dp[s]))
false
45.833333
[ "-import sys", "-", "-input = sys.stdin.readline", "-INF = 10**18", "-sys.setrecursionlimit(10**6)", "-import math", "-", "-D = 10**9 + 7", "-# 組み合わせの総数 nCr", "-def combinations_count(n, r):", "- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))", "-", "-", "-S = i...
false
0.048635
0.197507
0.246243
[ "s890722446", "s315627540" ]
u644907318
p02957
python
s980275718
s813115563
179
64
38,384
61,744
Accepted
Accepted
64.25
A,B = list(map(int,input().split())) if (A+B)%2==0: print(((A+B)//2)) else: print("IMPOSSIBLE")
A,B = list(map(int,input().split())) if A>B: A,B = B,A if (B-A)%2==0: print(((B+A)//2)) else: print("IMPOSSIBLE")
5
7
99
123
A, B = list(map(int, input().split())) if (A + B) % 2 == 0: print(((A + B) // 2)) else: print("IMPOSSIBLE")
A, B = list(map(int, input().split())) if A > B: A, B = B, A if (B - A) % 2 == 0: print(((B + A) // 2)) else: print("IMPOSSIBLE")
false
28.571429
[ "-if (A + B) % 2 == 0:", "- print(((A + B) // 2))", "+if A > B:", "+ A, B = B, A", "+if (B - A) % 2 == 0:", "+ print(((B + A) // 2))" ]
false
0.044572
0.097048
0.459273
[ "s980275718", "s813115563" ]
u175034939
p03732
python
s041433206
s356079825
639
84
3,064
3,704
Accepted
Accepted
86.85
n,W = list(map(int,input().split())) a = {} for i in range(n): w,v = list(map(int,input().split())) a.setdefault(w, []).append(v) we = [0]*4 va = [] num = [0]*4 for i,[k,v] in enumerate(a.items()): we[i] = k va.append(sorted(v,reverse=True)) num[i] = len(v) for i in range(4-len(va)): ...
n,W = list(map(int,input().split())) a = [list(map(int,input().split())) for _ in range(n)] dp = {} dp[0] = 0 for w, v in a: pre_dp = dp.copy() for pw, pv in list(pre_dp.items()): if pw + w <= W: dp[pw + w] = max(dp.get(pw + w, 0), pv + v) print((max(dp.values())))
27
12
764
292
n, W = list(map(int, input().split())) a = {} for i in range(n): w, v = list(map(int, input().split())) a.setdefault(w, []).append(v) we = [0] * 4 va = [] num = [0] * 4 for i, [k, v] in enumerate(a.items()): we[i] = k va.append(sorted(v, reverse=True)) num[i] = len(v) for i in range(4 - len(va)): ...
n, W = list(map(int, input().split())) a = [list(map(int, input().split())) for _ in range(n)] dp = {} dp[0] = 0 for w, v in a: pre_dp = dp.copy() for pw, pv in list(pre_dp.items()): if pw + w <= W: dp[pw + w] = max(dp.get(pw + w, 0), pv + v) print((max(dp.values())))
false
55.555556
[ "-a = {}", "-for i in range(n):", "- w, v = list(map(int, input().split()))", "- a.setdefault(w, []).append(v)", "-we = [0] * 4", "-va = []", "-num = [0] * 4", "-for i, [k, v] in enumerate(a.items()):", "- we[i] = k", "- va.append(sorted(v, reverse=True))", "- num[i] = len(v)", ...
false
0.042431
0.039763
1.06708
[ "s041433206", "s356079825" ]
u718949306
p03031
python
s515039723
s341597566
50
46
3,064
9,176
Accepted
Accepted
8
N, M = list(map(int, input().split())) cnt = 0 K = list() L = list() for m in range(M): l = list(map(int, input().split())) k = l.pop(0) K.append(k) L.append(l) P = list(map(int, input().split())) for i in range(1<<N): flag = True for j in range(M): c = 0 for l in r...
N, M = list(map(int, input().split())) K = [] S = [] for m in range(M): l = list(map(int, input().split())) k = l.pop(0) K.append(k) S.append(l) P = list(map(int, input().split())) ans = 0 for n in range(1<<N): res = True for m in range(M): cnt = 0 for q in range(K[...
22
22
482
478
N, M = list(map(int, input().split())) cnt = 0 K = list() L = list() for m in range(M): l = list(map(int, input().split())) k = l.pop(0) K.append(k) L.append(l) P = list(map(int, input().split())) for i in range(1 << N): flag = True for j in range(M): c = 0 for l in range(K[j]): ...
N, M = list(map(int, input().split())) K = [] S = [] for m in range(M): l = list(map(int, input().split())) k = l.pop(0) K.append(k) S.append(l) P = list(map(int, input().split())) ans = 0 for n in range(1 << N): res = True for m in range(M): cnt = 0 for q in range(K[m]): ...
false
0
[ "-cnt = 0", "-K = list()", "-L = list()", "+K = []", "+S = []", "- L.append(l)", "+ S.append(l)", "-for i in range(1 << N):", "- flag = True", "- for j in range(M):", "- c = 0", "- for l in range(K[j]):", "- if i & (1 << L[j][l] - 1):", "- ...
false
0.042037
0.093657
0.448843
[ "s515039723", "s341597566" ]
u256281774
p02781
python
s522916198
s387568235
1,361
27
61,400
3,812
Accepted
Accepted
98.02
def rec(digit, flag, k): limit = int(N[digit]) if k > K: return 0 if digit == len(N) - 1: if k == K: return 1 elif k == K - 1: return limit if flag else 9 else: return 0 if flag: if limit == 0: return re...
from functools import lru_cache @lru_cache(maxsize = None) def rec(digit, flag, k): limit = int(N[digit]) if k > K: return 0 if digit == len(N) - 1: if k == K: return 1 elif k == K - 1: return limit if flag else 9 else: return...
22
25
595
658
def rec(digit, flag, k): limit = int(N[digit]) if k > K: return 0 if digit == len(N) - 1: if k == K: return 1 elif k == K - 1: return limit if flag else 9 else: return 0 if flag: if limit == 0: return rec(digit + 1, ...
from functools import lru_cache @lru_cache(maxsize=None) def rec(digit, flag, k): limit = int(N[digit]) if k > K: return 0 if digit == len(N) - 1: if k == K: return 1 elif k == K - 1: return limit if flag else 9 else: return 0 if flag...
false
12
[ "+from functools import lru_cache", "+", "+", "+@lru_cache(maxsize=None)" ]
false
0.043304
0.04147
1.044224
[ "s522916198", "s387568235" ]
u606045429
p03731
python
s174585199
s019828057
168
138
25,196
25,200
Accepted
Accepted
17.86
N, T = [int(i) for i in input().split()] A = [int(i) for i in input().split()] ans = 0 for i in range(N - 1): ans += min(A[i + 1] - A[i], T) print((ans + T))
N, T = [int(i) for i in input().split()] A = [int(i) for i in input().split()] print((T + sum(min(A[i + 1] - A[i], T) for i in range(N - 1))))
8
4
168
144
N, T = [int(i) for i in input().split()] A = [int(i) for i in input().split()] ans = 0 for i in range(N - 1): ans += min(A[i + 1] - A[i], T) print((ans + T))
N, T = [int(i) for i in input().split()] A = [int(i) for i in input().split()] print((T + sum(min(A[i + 1] - A[i], T) for i in range(N - 1))))
false
50
[ "-ans = 0", "-for i in range(N - 1):", "- ans += min(A[i + 1] - A[i], T)", "-print((ans + T))", "+print((T + sum(min(A[i + 1] - A[i], T) for i in range(N - 1))))" ]
false
0.04338
0.039917
1.086756
[ "s174585199", "s019828057" ]
u492556875
p00193
python
s589310813
s348988144
70
60
7,044
7,036
Accepted
Accepted
14.29
import sys def generate_next_hexes(x, y): hexes = list() hexes.append((x, y - 1)) hexes.append((x, y + 1)) hexes.append((x - 1, y)) hexes.append((x + 1, y)) if y % 2: hexes.append((x - 1, y - 1)) hexes.append((x - 1, y + 1)) else: hexes.append((x + 1, y -...
import sys def generate_next_hexes(x, y): hexes = [(x, y - 1), (x, y + 1), (x - 1, y), (x + 1, y)] if y % 2: hexes += [(x - 1, y - 1), (x - 1, y + 1)] else: hexes += [(x + 1, y - 1), (x + 1, y + 1)] return hexes def update_map(hex_map, hexes): num_updated_hexes = 0 ...
60
50
1,708
1,505
import sys def generate_next_hexes(x, y): hexes = list() hexes.append((x, y - 1)) hexes.append((x, y + 1)) hexes.append((x - 1, y)) hexes.append((x + 1, y)) if y % 2: hexes.append((x - 1, y - 1)) hexes.append((x - 1, y + 1)) else: hexes.append((x + 1, y - 1)) ...
import sys def generate_next_hexes(x, y): hexes = [(x, y - 1), (x, y + 1), (x - 1, y), (x + 1, y)] if y % 2: hexes += [(x - 1, y - 1), (x - 1, y + 1)] else: hexes += [(x + 1, y - 1), (x + 1, y + 1)] return hexes def update_map(hex_map, hexes): num_updated_hexes = 0 distance =...
false
16.666667
[ "- hexes = list()", "- hexes.append((x, y - 1))", "- hexes.append((x, y + 1))", "- hexes.append((x - 1, y))", "- hexes.append((x + 1, y))", "+ hexes = [(x, y - 1), (x, y + 1), (x - 1, y), (x + 1, y)]", "- hexes.append((x - 1, y - 1))", "- hexes.append((x - 1, y + 1))", ...
false
0.10362
0.099515
1.041249
[ "s589310813", "s348988144" ]
u691018832
p02803
python
s648960468
s936288812
567
513
3,572
3,572
Accepted
Accepted
9.52
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from copy import deepcopy h, w = list(map(int, readline().split())) s = [eval(input()) for i in range(h)] q = [] start = [] dist = [[False] * w for _ in range(...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from copy import deepcopy h, w = list(map(int, readline().split())) s = [eval(input()) for i in range(h)] q = [] start = [] dist = [[False] * w for _ in range(...
44
42
1,155
1,085
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) from copy import deepcopy h, w = list(map(int, readline().split())) s = [eval(input()) for i in range(h)] q = [] start = [] dist = [[False] * w for _ in range(h)] for i in r...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) from copy import deepcopy h, w = list(map(int, readline().split())) s = [eval(input()) for i in range(h)] q = [] start = [] dist = [[False] * w for _ in range(h)] for i in r...
false
4.545455
[ "- start.append((i, j))", "+ start.append([i, j])", "-ans = []", "+ans = 0", "- check[list(q)[0][0]][list(q)[0][1]] = True", "+ check[q[0][0]][q[0][1]] = True", "+ q[0] = tuple(q[0])", "- memo = len(q)", "- memo_cnt = 0", "- memo_cnt ...
false
0.049194
0.166388
0.295657
[ "s648960468", "s936288812" ]
u111202730
p03370
python
s135691133
s477051994
19
17
3,060
3,060
Accepted
Accepted
10.53
N, X = list(map(int, input().split())) m = [] for i in range(N): m.append(int(eval(input()))) min_kona = 0 for val in m: min_kona += val min_donut = min(m) cnt = (X - min_kona) // min_donut + len(m) print(cnt)
N, X = list(map(int, input().split())) m = [] for i in range(N): m.append(int(eval(input()))) min_kona = sum(m) min_donut = min(m) cnt = (X - min_kona) // min_donut + len(m) print(cnt)
13
10
220
187
N, X = list(map(int, input().split())) m = [] for i in range(N): m.append(int(eval(input()))) min_kona = 0 for val in m: min_kona += val min_donut = min(m) cnt = (X - min_kona) // min_donut + len(m) print(cnt)
N, X = list(map(int, input().split())) m = [] for i in range(N): m.append(int(eval(input()))) min_kona = sum(m) min_donut = min(m) cnt = (X - min_kona) // min_donut + len(m) print(cnt)
false
23.076923
[ "-min_kona = 0", "-for val in m:", "- min_kona += val", "+min_kona = sum(m)" ]
false
0.0641
0.066477
0.964246
[ "s135691133", "s477051994" ]
u163501259
p02837
python
s792677253
s114317803
104
86
3,064
9,212
Accepted
Accepted
17.31
import sys input = sys.stdin.readline N = int(eval(input())) STATE = [[]]*N for i in range(N): a = int(eval(input())) STATE[i] = [list(map(int, input().split())) for i in range(a)] def main(): ans = 0 for i in range(1<<N): ans = max(ans, detect(i)) print(ans) def detect(i):...
import sys input = sys.stdin.readline def main(): N = int(eval(input())) R = [[] for i in range(N)] for i in range(N): A = int(eval(input())) R[i] = [list(map(int, input().split())) for i in range(A)] ans = 0 for i in range(1<<N): CNT = 0 for j in range(N)...
29
32
577
814
import sys input = sys.stdin.readline N = int(eval(input())) STATE = [[]] * N for i in range(N): a = int(eval(input())) STATE[i] = [list(map(int, input().split())) for i in range(a)] def main(): ans = 0 for i in range(1 << N): ans = max(ans, detect(i)) print(ans) def detect(i): ONT ...
import sys input = sys.stdin.readline def main(): N = int(eval(input())) R = [[] for i in range(N)] for i in range(N): A = int(eval(input())) R[i] = [list(map(int, input().split())) for i in range(A)] ans = 0 for i in range(1 << N): CNT = 0 for j in range(N): ...
false
9.375
[ "-N = int(eval(input()))", "-STATE = [[]] * N", "-for i in range(N):", "- a = int(eval(input()))", "- STATE[i] = [list(map(int, input().split())) for i in range(a)]", "+ N = int(eval(input()))", "+ R = [[] for i in range(N)]", "+ for i in range(N):", "+ A = int(eval(input()))",...
false
0.044485
0.039351
1.130478
[ "s792677253", "s114317803" ]
u659159398
p02612
python
s429852645
s459703418
80
64
61,576
61,860
Accepted
Accepted
20
n = int(eval(input())) for i in range(1, 11): if i*1000 >= n: break print((i*1000 - n))
n = int(eval(input())) for i in range(0, 20000 , 1000): if i >= n: break print((i - n))
5
6
95
98
n = int(eval(input())) for i in range(1, 11): if i * 1000 >= n: break print((i * 1000 - n))
n = int(eval(input())) for i in range(0, 20000, 1000): if i >= n: break print((i - n))
false
16.666667
[ "-for i in range(1, 11):", "- if i * 1000 >= n:", "+for i in range(0, 20000, 1000):", "+ if i >= n:", "-print((i * 1000 - n))", "+print((i - n))" ]
false
0.046467
0.047874
0.970619
[ "s429852645", "s459703418" ]
u485319545
p03497
python
s451459331
s288014554
150
129
43,080
42,852
Accepted
Accepted
14
n,k=list(map(int,input().split())) a=list(map(int,input().split())) from collections import Counter c=Counter(a).most_common()[:k] s=set([i[0] for i in c]) ans=0 for i in range(n): if a[i] not in s: ans+=1 print(ans)
n,k=list(map(int,input().split())) a=list(map(int,input().split())) from collections import Counter c=Counter(a).most_common()[:k] cnt=0 for i in c: cnt+=i[1] print((n-cnt))
15
11
241
182
n, k = list(map(int, input().split())) a = list(map(int, input().split())) from collections import Counter c = Counter(a).most_common()[:k] s = set([i[0] for i in c]) ans = 0 for i in range(n): if a[i] not in s: ans += 1 print(ans)
n, k = list(map(int, input().split())) a = list(map(int, input().split())) from collections import Counter c = Counter(a).most_common()[:k] cnt = 0 for i in c: cnt += i[1] print((n - cnt))
false
26.666667
[ "-s = set([i[0] for i in c])", "-ans = 0", "-for i in range(n):", "- if a[i] not in s:", "- ans += 1", "-print(ans)", "+cnt = 0", "+for i in c:", "+ cnt += i[1]", "+print((n - cnt))" ]
false
0.035342
0.034951
1.011184
[ "s451459331", "s288014554" ]
u369133448
p02553
python
s478979991
s750681507
32
28
9,160
9,100
Accepted
Accepted
12.5
a,b,c,d=list(map(int,input().split())) print((max(max(max(a*c,a*d),b*c),b*d)))
a,b,c,d=list(map(int,input().split())) l=[a*c,a*d,b*c,b*d] print((max(l)))
2
3
71
68
a, b, c, d = list(map(int, input().split())) print((max(max(max(a * c, a * d), b * c), b * d)))
a, b, c, d = list(map(int, input().split())) l = [a * c, a * d, b * c, b * d] print((max(l)))
false
33.333333
[ "-print((max(max(max(a * c, a * d), b * c), b * d)))", "+l = [a * c, a * d, b * c, b * d]", "+print((max(l)))" ]
false
0.042695
0.045001
0.948773
[ "s478979991", "s750681507" ]
u716660050
p02554
python
s857464135
s494620103
469
406
9,196
9,184
Accepted
Accepted
13.43
N=int(eval(input())) M=10**9+7 ans=1 m=1 for i in range(N):ans=(ans*10)%M for i in range(N):m=(m*9)%M ans-=(m*2)%M m=1 for i in range(N):m=(m*8)%M print(((ans+m)%M))
N=int(eval(input())) M=10**9+7 a,b,c=1,1,1 for i in range(N):a,b,c=a*10%M,b*9%M,c*8%M print(((a-b*2+c)%M))
10
5
166
102
N = int(eval(input())) M = 10**9 + 7 ans = 1 m = 1 for i in range(N): ans = (ans * 10) % M for i in range(N): m = (m * 9) % M ans -= (m * 2) % M m = 1 for i in range(N): m = (m * 8) % M print(((ans + m) % M))
N = int(eval(input())) M = 10**9 + 7 a, b, c = 1, 1, 1 for i in range(N): a, b, c = a * 10 % M, b * 9 % M, c * 8 % M print(((a - b * 2 + c) % M))
false
50
[ "-ans = 1", "-m = 1", "+a, b, c = 1, 1, 1", "- ans = (ans * 10) % M", "-for i in range(N):", "- m = (m * 9) % M", "-ans -= (m * 2) % M", "-m = 1", "-for i in range(N):", "- m = (m * 8) % M", "-print(((ans + m) % M))", "+ a, b, c = a * 10 % M, b * 9 % M, c * 8 % M", "+print(((a - ...
false
0.180004
0.17219
1.04538
[ "s857464135", "s494620103" ]
u935184340
p02258
python
s088152026
s175264377
170
150
21,896
21,844
Accepted
Accepted
11.76
import sys n = int(eval(input())) r0 = int(eval(input())) r1 = int(eval(input())) mx = r1-r0 mn = min(r1,r0) for i in map(int,sys.stdin.readlines()): if mx < i - mn: mx = i - mn if mn > i: mn = i print(mx)
import sys n = int(eval(input())) r0 = int(eval(input())) r1 = int(eval(input())) mx = r1-r0 mn = min(r1,r0) for i in map(int,sys.stdin.readlines()): if mx < i - mn: mx = i - mn if 0 > i-mn: mn = i elif mn > i: mn = i print(mx)
15
17
231
272
import sys n = int(eval(input())) r0 = int(eval(input())) r1 = int(eval(input())) mx = r1 - r0 mn = min(r1, r0) for i in map(int, sys.stdin.readlines()): if mx < i - mn: mx = i - mn if mn > i: mn = i print(mx)
import sys n = int(eval(input())) r0 = int(eval(input())) r1 = int(eval(input())) mx = r1 - r0 mn = min(r1, r0) for i in map(int, sys.stdin.readlines()): if mx < i - mn: mx = i - mn if 0 > i - mn: mn = i elif mn > i: mn = i print(mx)
false
11.764706
[ "- if mn > i:", "+ if 0 > i - mn:", "+ mn = i", "+ elif mn > i:" ]
false
0.036503
0.037532
0.972598
[ "s088152026", "s175264377" ]
u525065967
p02574
python
s469519299
s276197470
772
600
134,792
130,952
Accepted
Accepted
22.28
MAX_A = 10**6 + 1 is_prim = [True] * MAX_A is_prim[0] = is_prim[1] = False for i in range(2, MAX_A): if not is_prim[i]: continue for j in range(i+i, MAX_A, i): is_prim[j] = False def solve(): C = [0] * MAX_A for a in A: C[a] += 1 pairwise = True for p in [i for i in range(MAX_A) if i...
MAX_A = 10**6 + 1 is_prim = [True] * (MAX_A//2) is_prim[0] = is_prim[1] = False for i in range(2, MAX_A//2): if not is_prim[i]: continue for j in range(i+i, MAX_A//2, i): is_prim[j] = False def solve(): C = [0] * MAX_A for a in A: C[a] += 1 pairwise = True for p in [i for i in range(...
24
23
617
629
MAX_A = 10**6 + 1 is_prim = [True] * MAX_A is_prim[0] = is_prim[1] = False for i in range(2, MAX_A): if not is_prim[i]: continue for j in range(i + i, MAX_A, i): is_prim[j] = False def solve(): C = [0] * MAX_A for a in A: C[a] += 1 pairwise = True for p in [i for i in r...
MAX_A = 10**6 + 1 is_prim = [True] * (MAX_A // 2) is_prim[0] = is_prim[1] = False for i in range(2, MAX_A // 2): if not is_prim[i]: continue for j in range(i + i, MAX_A // 2, i): is_prim[j] = False def solve(): C = [0] * MAX_A for a in A: C[a] += 1 pairwise = True for p...
false
4.166667
[ "-is_prim = [True] * MAX_A", "+is_prim = [True] * (MAX_A // 2)", "-for i in range(2, MAX_A):", "+for i in range(2, MAX_A // 2):", "- for j in range(i + i, MAX_A, i):", "+ for j in range(i + i, MAX_A // 2, i):", "- for p in [i for i in range(MAX_A) if is_prim[i]]:", "+ for p in [i for i in ...
false
0.781576
0.69511
1.124392
[ "s469519299", "s276197470" ]
u094191970
p02912
python
s113307058
s101914834
154
127
14,180
20,284
Accepted
Accepted
17.53
import heapq n,m=list(map(int,input().split())) a=[-int(i) for i in input().split()] heapq.heapify(a) for i in range(m): max=-heapq.heappop(a) heapq.heappush(a,-1*(max//2)) print((-sum(a)))
from sys import stdin nii=lambda:list(map(int,stdin.readline().split())) lnii=lambda:list(map(int,stdin.readline().split())) from heapq import * n,m=nii() a=lnii() a=[-i for i in a] a.sort(reverse=True) heapify(a) for i in range(m): x=heappop(a) x*=-1 x//=2 heappush(a,-x) print((-sum(a)))
11
19
196
311
import heapq n, m = list(map(int, input().split())) a = [-int(i) for i in input().split()] heapq.heapify(a) for i in range(m): max = -heapq.heappop(a) heapq.heappush(a, -1 * (max // 2)) print((-sum(a)))
from sys import stdin nii = lambda: list(map(int, stdin.readline().split())) lnii = lambda: list(map(int, stdin.readline().split())) from heapq import * n, m = nii() a = lnii() a = [-i for i in a] a.sort(reverse=True) heapify(a) for i in range(m): x = heappop(a) x *= -1 x //= 2 heappush(a, -x) print((...
false
42.105263
[ "-import heapq", "+from sys import stdin", "-n, m = list(map(int, input().split()))", "-a = [-int(i) for i in input().split()]", "-heapq.heapify(a)", "+nii = lambda: list(map(int, stdin.readline().split()))", "+lnii = lambda: list(map(int, stdin.readline().split()))", "+from heapq import *", "+", ...
false
0.046035
0.093215
0.493863
[ "s113307058", "s101914834" ]
u017849462
p02641
python
s322149977
s796977958
26
22
9,192
9,136
Accepted
Accepted
15.38
X, N = list(map(int, input().split())) P = list(map(int, input().split())) ans = X for i in range(101): a = X + i b = X - i if a not in P: ans = a if b not in P: ans = b break if b not in P: ans = b break print(ans)
X, N = list(map(int, input().split())) P = list(map(int, input().split())) ans = X for i in range(N+1): a = X + i b = X - i if a not in P: ans = a if b not in P: ans = b break if b not in P: ans = b break print(ans)
16
16
294
294
X, N = list(map(int, input().split())) P = list(map(int, input().split())) ans = X for i in range(101): a = X + i b = X - i if a not in P: ans = a if b not in P: ans = b break if b not in P: ans = b break print(ans)
X, N = list(map(int, input().split())) P = list(map(int, input().split())) ans = X for i in range(N + 1): a = X + i b = X - i if a not in P: ans = a if b not in P: ans = b break if b not in P: ans = b break print(ans)
false
0
[ "-for i in range(101):", "+for i in range(N + 1):" ]
false
0.08458
0.046057
1.836424
[ "s322149977", "s796977958" ]
u980205854
p02873
python
s304671512
s345693701
385
117
23,336
118,112
Accepted
Accepted
69.61
# A - >< S = eval(input()) N = len(S)+1 INF = 1000000 ans = [0]*N tmp = 0 for i in range(N-1): if S[i]=='<': tmp += 1 else: tmp = 0 ans[i+1] = tmp tmp = 0 for i in range(N-2,-1,-1): if S[i]=='>': tmp += 1 else: tmp = 0 ans[i] = max(ans[i],tmp) p...
import sys from collections import deque from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値) from heapq import heapify, heappop, heappush sys.setrecursionlimit(10**6) INF = 10**20 def mint(): return list(map(int,input().split())) def lint(): return list(map(int,inpu...
20
25
328
623
# A - >< S = eval(input()) N = len(S) + 1 INF = 1000000 ans = [0] * N tmp = 0 for i in range(N - 1): if S[i] == "<": tmp += 1 else: tmp = 0 ans[i + 1] = tmp tmp = 0 for i in range(N - 2, -1, -1): if S[i] == ">": tmp += 1 else: tmp = 0 ans[i] = max(ans[i], tmp) pri...
import sys from collections import deque from bisect import bisect_left, bisect_right, insort_left, insort_right # func(リスト,値) from heapq import heapify, heappop, heappush sys.setrecursionlimit(10**6) INF = 10**20 def mint(): return list(map(int, input().split())) def lint(): return list(map(int, input()....
false
20
[ "-# A - ><", "+import sys", "+from collections import deque", "+from bisect import bisect_left, bisect_right, insort_left, insort_right # func(リスト,値)", "+from heapq import heapify, heappop, heappush", "+", "+sys.setrecursionlimit(10**6)", "+INF = 10**20", "+", "+", "+def mint():", "+ retur...
false
0.045676
0.082627
0.5528
[ "s304671512", "s345693701" ]
u080986047
p03827
python
s391324220
s212344958
191
175
38,256
38,384
Accepted
Accepted
8.38
n = int(eval(input())) s = eval(input()) x = 0 li = [0] for i in range(n): if s[i] =="I": x += 1 li.append(x) else: x -= 1 print((max(li)))
n = int(eval(input())) s = eval(input()) x = 0 max = 0 for i in range(n): if s[i] =="I": x += 1 if x>max: max = x else: x -= 1 print(max)
11
12
167
180
n = int(eval(input())) s = eval(input()) x = 0 li = [0] for i in range(n): if s[i] == "I": x += 1 li.append(x) else: x -= 1 print((max(li)))
n = int(eval(input())) s = eval(input()) x = 0 max = 0 for i in range(n): if s[i] == "I": x += 1 if x > max: max = x else: x -= 1 print(max)
false
8.333333
[ "-li = [0]", "+max = 0", "- li.append(x)", "+ if x > max:", "+ max = x", "-print((max(li)))", "+print(max)" ]
false
0.090877
0.15332
0.59273
[ "s391324220", "s212344958" ]
u297574184
p02758
python
s612964020
s719087642
1,360
737
95,040
43,052
Accepted
Accepted
45.81
from bisect import bisect_left, bisect_right import sys input = sys.stdin.readline def solve(): MOD = 998244353 INF = float('inf') N = int(eval(input())) XDs = [tuple(map(int, input().split())) for _ in range(N)] + [(10**12, 0)] XDs.sort() Xs = [X for X, D in XDs] def max2(...
import sys input = sys.stdin.readline def solve(): MOD = 998244353 N = int(eval(input())) XDs = [tuple(map(int, input().split())) for _ in range(N)] + [(10**12, 0)] XDs.sort() Xs = [X for X, D in XDs] stack = [N] dp = [0] * (N+1) dp[-1] = 1 for i in reversed(list(r...
55
27
1,356
524
from bisect import bisect_left, bisect_right import sys input = sys.stdin.readline def solve(): MOD = 998244353 INF = float("inf") N = int(eval(input())) XDs = [tuple(map(int, input().split())) for _ in range(N)] + [(10**12, 0)] XDs.sort() Xs = [X for X, D in XDs] def max2(x, y): ...
import sys input = sys.stdin.readline def solve(): MOD = 998244353 N = int(eval(input())) XDs = [tuple(map(int, input().split())) for _ in range(N)] + [(10**12, 0)] XDs.sort() Xs = [X for X, D in XDs] stack = [N] dp = [0] * (N + 1) dp[-1] = 1 for i in reversed(list(range(N))): ...
false
50.909091
[ "-from bisect import bisect_left, bisect_right", "- INF = float(\"inf\")", "-", "- def max2(x, y):", "- return x if x >= y else y", "-", "- def makeBIT(numEle):", "- numPow2 = 2 ** (numEle - 1).bit_length()", "- data = [-INF] * (numPow2 + 1)", "- return data, n...
false
0.035823
0.08021
0.446619
[ "s612964020", "s719087642" ]
u762420987
p03556
python
s606084133
s195730579
310
17
18,992
2,940
Accepted
Accepted
94.52
import numpy as np N = int(eval(input())) mp = int(np.sqrt(N)) print((mp**2))
from math import sqrt, floor N = int(eval(input())) print((floor(sqrt(N))**2))
6
4
76
75
import numpy as np N = int(eval(input())) mp = int(np.sqrt(N)) print((mp**2))
from math import sqrt, floor N = int(eval(input())) print((floor(sqrt(N)) ** 2))
false
33.333333
[ "-import numpy as np", "+from math import sqrt, floor", "-mp = int(np.sqrt(N))", "-print((mp**2))", "+print((floor(sqrt(N)) ** 2))" ]
false
0.998966
0.036586
27.304253
[ "s606084133", "s195730579" ]
u312025627
p03212
python
s841664381
s154955218
282
256
51,676
49,884
Accepted
Accepted
9.22
def main(): N = int(input()) N_len = len(str(N)) if N_len < 3: return print(0) from itertools import product ans_set = set() for k in range(3, min(N_len, 9)+1): ans_set = ans_set.union({s for s in product("753", repeat=k) if int("".join(s...
def main(): N = int(input()) N_len = len(str(N)) if N_len < 3: return print(0) from itertools import product ans_set = set() for k in range(3, N_len+1): ans_set = ans_set.union({s for s in product("753", repeat=k) if int("".join(s)) <= N ...
16
16
467
459
def main(): N = int(input()) N_len = len(str(N)) if N_len < 3: return print(0) from itertools import product ans_set = set() for k in range(3, min(N_len, 9) + 1): ans_set = ans_set.union( { s for s in product("753", repeat=k) ...
def main(): N = int(input()) N_len = len(str(N)) if N_len < 3: return print(0) from itertools import product ans_set = set() for k in range(3, N_len + 1): ans_set = ans_set.union( { s for s in product("753", repeat=k) i...
false
0
[ "- for k in range(3, min(N_len, 9) + 1):", "+ for k in range(3, N_len + 1):" ]
false
0.07046
0.06895
1.021892
[ "s841664381", "s154955218" ]
u410118019
p02781
python
s180653597
s001565294
1,868
17
3,692
3,064
Accepted
Accepted
99.09
from itertools import combinations as com def comb(a,b): if a == 0: return 1 r = 1 for i in range(b): r *= a a -= 1 r = r // [1,2,6][b-1] return r n = eval(input()) nl = len(n) k = int(eval(input())) i = 0 c = 0 while i < nl: if i+1 >= nl: break if i+1 < k: pass e...
n = eval(input()) k = int(eval(input())) dp0 = [0] * 4 dp1 = [1,0,0,0] for i in n: i = int(i) pdp0,pdp1,dp0 = dp0,dp1,[0]*4 if i != 0: dp1 = [0] + pdp1[:-1] else: dp1 = pdp1 dp0[0] = pdp0[0]+(i!=0)*pdp1[0] for j in range(1,4): dp0[j] = 9*pdp0[j-1] + pdp0[j] + (i!=0)*(i-1)*pdp1[j-1] ...
55
15
1,070
346
from itertools import combinations as com def comb(a, b): if a == 0: return 1 r = 1 for i in range(b): r *= a a -= 1 r = r // [1, 2, 6][b - 1] return r n = eval(input()) nl = len(n) k = int(eval(input())) i = 0 c = 0 while i < nl: if i + 1 >= nl: break if ...
n = eval(input()) k = int(eval(input())) dp0 = [0] * 4 dp1 = [1, 0, 0, 0] for i in n: i = int(i) pdp0, pdp1, dp0 = dp0, dp1, [0] * 4 if i != 0: dp1 = [0] + pdp1[:-1] else: dp1 = pdp1 dp0[0] = pdp0[0] + (i != 0) * pdp1[0] for j in range(1, 4): dp0[j] = ( 9 * pd...
false
72.727273
[ "-from itertools import combinations as com", "-", "-", "-def comb(a, b):", "- if a == 0:", "- return 1", "- r = 1", "- for i in range(b):", "- r *= a", "- a -= 1", "- r = r // [1, 2, 6][b - 1]", "- return r", "-", "-", "-nl = len(n)", "-i = 0", "-...
false
0.048652
0.047728
1.01936
[ "s180653597", "s001565294" ]
u202634017
p02777
python
s377034732
s288132359
172
17
38,384
3,060
Accepted
Accepted
90.12
S,T = input().split() A,B = list(map(int,input().split())) U = eval(input()) if (U == S): A -= 1 else: B -= 1 print((A,B))
S,T = list(map(str,input().split())) A,B = list(map(int,input().split())) U = eval(input()) if (S == U): A -= 1 else: B -= 1 print((A,B))
9
10
125
136
S, T = input().split() A, B = list(map(int, input().split())) U = eval(input()) if U == S: A -= 1 else: B -= 1 print((A, B))
S, T = list(map(str, input().split())) A, B = list(map(int, input().split())) U = eval(input()) if S == U: A -= 1 else: B -= 1 print((A, B))
false
10
[ "-S, T = input().split()", "+S, T = list(map(str, input().split()))", "-if U == S:", "+if S == U:" ]
false
0.144969
0.047927
3.024806
[ "s377034732", "s288132359" ]
u600402037
p02754
python
s828958381
s013340443
19
17
3,060
3,060
Accepted
Accepted
10.53
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, A, B = lr() time, remain = divmod(N, (A+B)) answer = A * time + min(A, remain) print(answer)
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, A, B = lr() time = N // (A+B) remain = N - (A+B) * time answer = A * time + min(A, remain) print(answer)
10
12
226
256
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, A, B = lr() time, remain = divmod(N, (A + B)) answer = A * time + min(A, remain) print(answer)
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, A, B = lr() time = N // (A + B) remain = N - (A + B) * time answer = A * time + min(A, remain) print(answer)
false
16.666667
[ "+# coding: utf-8", "-time, remain = divmod(N, (A + B))", "+time = N // (A + B)", "+remain = N - (A + B) * time" ]
false
0.046307
0.046448
0.996972
[ "s828958381", "s013340443" ]
u654470292
p02761
python
s215166070
s477775831
288
75
64,108
69,136
Accepted
Accepted
73.96
import sys from collections import * import heapq import math import bisect from itertools import permutations,accumulate,combinations,product from fractions import gcd def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) mod=pow(10,9)+7 n,m=list(map(int...
import bisect import copy import heapq import math import sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) sys.setrecurs...
37
43
767
988
import sys from collections import * import heapq import math import bisect from itertools import permutations, accumulate, combinations, product from fractions import gcd def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0] + list(accumulate(lst)) mod = pow(10, 9) + 7 n, m = list(ma...
import bisect import copy import heapq import math import sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0] + list(accumulate(lst)) sys.setrecursionl...
false
13.953488
[ "+import bisect", "+import copy", "+import heapq", "+import math", "-import heapq", "-import math", "-import bisect", "-from itertools import permutations, accumulate, combinations, product", "-from fractions import gcd", "+from functools import lru_cache", "+from itertools import accumulate, co...
false
0.110126
0.104001
1.058894
[ "s215166070", "s477775831" ]
u143509139
p02851
python
s155031892
s014621806
590
191
61,416
137,280
Accepted
Accepted
67.63
from collections import defaultdict import bisect n,k=list(map(int,input().split())) a=[1]+list(map(int,input().split())) d = defaultdict(list) for i in range(n+1): a[i]-=1 d[a[0]%k].append(0) for i in range(n): a[i + 1] += a[i] d[a[i+1]%k].append(i+1) ans=0 for l in list(d.values()): for i, idx in...
from collections import defaultdict from bisect import bisect_left n, k = list(map(int, input().split())) a = [0] + list(map(int, input().split())) for i in range(1, n + 1): a[i] -= 1 for i in range(n): a[i + 1] += a[i] a[i] %= k a[i + 1] %= k c = defaultdict(list) for i in range(n + 1): c[a...
16
18
379
450
from collections import defaultdict import bisect n, k = list(map(int, input().split())) a = [1] + list(map(int, input().split())) d = defaultdict(list) for i in range(n + 1): a[i] -= 1 d[a[0] % k].append(0) for i in range(n): a[i + 1] += a[i] d[a[i + 1] % k].append(i + 1) ans = 0 for l in list(d.values())...
from collections import defaultdict from bisect import bisect_left n, k = list(map(int, input().split())) a = [0] + list(map(int, input().split())) for i in range(1, n + 1): a[i] -= 1 for i in range(n): a[i + 1] += a[i] a[i] %= k a[i + 1] %= k c = defaultdict(list) for i in range(n + 1): c[a[i]].append...
false
11.111111
[ "-import bisect", "+from bisect import bisect_left", "-a = [1] + list(map(int, input().split()))", "-d = defaultdict(list)", "-for i in range(n + 1):", "+a = [0] + list(map(int, input().split()))", "+for i in range(1, n + 1):", "-d[a[0] % k].append(0)", "- d[a[i + 1] % k].append(i + 1)", "+ ...
false
0.041086
0.098155
0.418586
[ "s155031892", "s014621806" ]
u278886389
p02772
python
s188017851
s800029455
184
165
38,384
38,556
Accepted
Accepted
10.33
N = int(eval(input())) A = list(map(int,input().split())) B = list([x for x in A if x % 2 == 0]) C = list([(x % 5 == 0)or(x % 3 == 0) for x in B]) print((["APPROVED","DENIED"][False in C]))
eval(input()) print((["APPROVED","DENIED"]["1"in [format(0x28828228,'b')[int(x)%30-2] for x in input().split()]]))
7
2
195
110
N = int(eval(input())) A = list(map(int, input().split())) B = list([x for x in A if x % 2 == 0]) C = list([(x % 5 == 0) or (x % 3 == 0) for x in B]) print((["APPROVED", "DENIED"][False in C]))
eval(input()) print( ( ["APPROVED", "DENIED"][ "1" in [format(0x28828228, "b")[int(x) % 30 - 2] for x in input().split()] ] ) )
false
71.428571
[ "-N = int(eval(input()))", "-A = list(map(int, input().split()))", "-B = list([x for x in A if x % 2 == 0])", "-C = list([(x % 5 == 0) or (x % 3 == 0) for x in B])", "-print(([\"APPROVED\", \"DENIED\"][False in C]))", "+eval(input())", "+print(", "+ (", "+ [\"APPROVED\", \"DENIED\"][", "...
false
0.039396
0.039831
0.989069
[ "s188017851", "s800029455" ]
u917013605
p02900
python
s067732442
s241316216
142
80
63,284
63,032
Accepted
Accepted
43.66
def input_li(): return list(map(int, input().split())) def input_int(): return int(eval(input())) def prime_factorization(n): table = [] for x in range(2, int(n ** 0.5) + 1): while n % x == 0: table.append(x) n //= x if n > 1: table.append(n...
def input_li(): return list(map(int, input().split())) def input_int(): return int(eval(input())) def prime_factorization(n): table = [] for x in range(2, int(n ** 0.5) + 1): while n % x == 0: table.append(x) n //= x if n > 1: table.append(n...
23
23
469
462
def input_li(): return list(map(int, input().split())) def input_int(): return int(eval(input())) def prime_factorization(n): table = [] for x in range(2, int(n**0.5) + 1): while n % x == 0: table.append(x) n //= x if n > 1: table.append(n) return tabl...
def input_li(): return list(map(int, input().split())) def input_int(): return int(eval(input())) def prime_factorization(n): table = [] for x in range(2, int(n**0.5) + 1): while n % x == 0: table.append(x) n //= x if n > 1: table.append(n) return tabl...
false
0
[ "-print((len((A_SET) & set(B_SET)) + 1))", "+print((len(A_SET & B_SET) + 1))" ]
false
0.035128
0.041917
0.838036
[ "s067732442", "s241316216" ]
u926678805
p03013
python
s789483773
s608543404
686
220
463,512
7,808
Accepted
Accepted
67.93
n,m=list(map(int,input().split())) a=[1 for i in range(n+2)] for i in range(m): a[int(eval(input()))]=0 dp=[0 for i in range(n+1)] dp[0]=1 for i in range(n): if ((i+1)<(n+1)) and a[i+1]: dp[i+1]+=dp[i] if ((i+2)<(n+1)) and a[i+2]: dp[i+2]+=dp[i] print((dp[n]%1000000007))
n,m=list(map(int,input().split())) a=[1 for i in range(n+2)] for i in range(m): a[int(eval(input()))]=0 dp=[0 for i in range(n+1)] dp[0]=1 for i in range(n): if ((i+1)<(n+1)) and a[i+1]: dp[i+1]=(dp[i+1]+dp[i])%1000000007 if ((i+2)<(n+1)) and a[i+2]: dp[i+2]+=(dp[i+2]+dp[i])%100000...
12
12
297
327
n, m = list(map(int, input().split())) a = [1 for i in range(n + 2)] for i in range(m): a[int(eval(input()))] = 0 dp = [0 for i in range(n + 1)] dp[0] = 1 for i in range(n): if ((i + 1) < (n + 1)) and a[i + 1]: dp[i + 1] += dp[i] if ((i + 2) < (n + 1)) and a[i + 2]: dp[i + 2] += dp[i] print(...
n, m = list(map(int, input().split())) a = [1 for i in range(n + 2)] for i in range(m): a[int(eval(input()))] = 0 dp = [0 for i in range(n + 1)] dp[0] = 1 for i in range(n): if ((i + 1) < (n + 1)) and a[i + 1]: dp[i + 1] = (dp[i + 1] + dp[i]) % 1000000007 if ((i + 2) < (n + 1)) and a[i + 2]: ...
false
0
[ "- dp[i + 1] += dp[i]", "+ dp[i + 1] = (dp[i + 1] + dp[i]) % 1000000007", "- dp[i + 2] += dp[i]", "-print((dp[n] % 1000000007))", "+ dp[i + 2] += (dp[i + 2] + dp[i]) % 1000000007", "+print((dp[n]))" ]
false
0.074091
0.038799
1.909643
[ "s789483773", "s608543404" ]
u600402037
p02780
python
s426111390
s034095331
337
299
33,996
33,740
Accepted
Accepted
11.28
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, K = lr() P = np.array([0] + lr()) P = (P+1) / 2 Pcum = P.cumsum() X = Pcum[K:] - Pcum[:-K] answer = X.max() print(answer)
# coding: utf-8 import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, K = lr() P = np.array([0] + lr(), np.float64) P = (P+1) / 2 Pcum = P.cumsum() expectation = Pcum[K:] - Pcum[:-K] answer = expectation.max() print(a...
14
15
278
327
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, K = lr() P = np.array([0] + lr()) P = (P + 1) / 2 Pcum = P.cumsum() X = Pcum[K:] - Pcum[:-K] answer = X.max() print(answer)
# coding: utf-8 import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, K = lr() P = np.array([0] + lr(), np.float64) P = (P + 1) / 2 Pcum = P.cumsum() expectation = Pcum[K:] - Pcum[:-K] answer = expectation.max() print(answer)
false
6.666667
[ "+# coding: utf-8", "-P = np.array([0] + lr())", "+P = np.array([0] + lr(), np.float64)", "-X = Pcum[K:] - Pcum[:-K]", "-answer = X.max()", "+expectation = Pcum[K:] - Pcum[:-K]", "+answer = expectation.max()" ]
false
0.555219
0.22568
2.460207
[ "s426111390", "s034095331" ]
u474925961
p02996
python
s710177677
s064431073
1,008
922
55,380
68,944
Accepted
Accepted
8.53
n=int(eval(input())) l=[] for i in range(n): a=list(map(int,input().split())) l.append(a) l=sorted(l,key=lambda x:x[1],reverse=True) cnt=l[0][1] for i in range(n): if cnt>l[i][1]: cnt=l[i][1] cnt-=l[i][0] if cnt>=0: print("Yes") else: print("No")
import numpy as np N = int(eval(input())) lst=[] for i in range(N): lst.append(list(map(int,input().split()))) AB=np.array(lst).reshape(N,2).T A = AB[0] B = AB[1] ind = B.argsort() A = A[ind] B = B[ind] if np.all(A.cumsum() <= B): print("Yes") else: print("No")
16
16
288
283
n = int(eval(input())) l = [] for i in range(n): a = list(map(int, input().split())) l.append(a) l = sorted(l, key=lambda x: x[1], reverse=True) cnt = l[0][1] for i in range(n): if cnt > l[i][1]: cnt = l[i][1] cnt -= l[i][0] if cnt >= 0: print("Yes") else: print("No")
import numpy as np N = int(eval(input())) lst = [] for i in range(N): lst.append(list(map(int, input().split()))) AB = np.array(lst).reshape(N, 2).T A = AB[0] B = AB[1] ind = B.argsort() A = A[ind] B = B[ind] if np.all(A.cumsum() <= B): print("Yes") else: print("No")
false
0
[ "-n = int(eval(input()))", "-l = []", "-for i in range(n):", "- a = list(map(int, input().split()))", "- l.append(a)", "-l = sorted(l, key=lambda x: x[1], reverse=True)", "-cnt = l[0][1]", "-for i in range(n):", "- if cnt > l[i][1]:", "- cnt = l[i][1]", "- cnt -= l[i][0]", "...
false
0.227192
0.246186
0.922847
[ "s710177677", "s064431073" ]
u969850098
p02684
python
s225449545
s292415595
183
123
49,300
33,380
Accepted
Accepted
32.79
import sys readline = sys.stdin.readline def main(): N, K = list(map(int, readline().rstrip().split())) A = list(map(int, readline().rstrip().split())) d = {i+1: a for i, a in enumerate(A)} if K <= N: pre = 1 for _ in range(K): pre = d[pre] print(pre) ...
import sys readline = sys.stdin.readline def main(): N, K = list(map(int, readline().rstrip().split())) d = list(map(int, readline().rstrip().split())) # d = {i+1: a for i, a in enumerate(A)} if K <= N: pre = 1 for _ in range(K): pre = d[pre-1] print(pre) ...
36
36
813
821
import sys readline = sys.stdin.readline def main(): N, K = list(map(int, readline().rstrip().split())) A = list(map(int, readline().rstrip().split())) d = {i + 1: a for i, a in enumerate(A)} if K <= N: pre = 1 for _ in range(K): pre = d[pre] print(pre) ret...
import sys readline = sys.stdin.readline def main(): N, K = list(map(int, readline().rstrip().split())) d = list(map(int, readline().rstrip().split())) # d = {i+1: a for i, a in enumerate(A)} if K <= N: pre = 1 for _ in range(K): pre = d[pre - 1] print(pre) ...
false
0
[ "- A = list(map(int, readline().rstrip().split()))", "- d = {i + 1: a for i, a in enumerate(A)}", "+ d = list(map(int, readline().rstrip().split()))", "+ # d = {i+1: a for i, a in enumerate(A)}", "- pre = d[pre]", "+ pre = d[pre - 1]", "- pre = d[pre]", "+ ...
false
0.037021
0.080504
0.459868
[ "s225449545", "s292415595" ]
u748241164
p03731
python
s421983255
s386121052
147
117
25,196
30,732
Accepted
Accepted
20.41
N, T = list(map(int, input().split())) t = list(map(int, input().split())) time = 0 for i in range(N-1): if t[i + 1] - t[i] >= T: time += T else: time += t[i + 1] -t[i] time += T print(time)
N, T = list(map(int, input().split())) tt = list(map(int, input().split())) ans = 0 for i in range(N - 1): nn = tt[i + 1] - tt[i] if nn > T: ans += T else: ans += nn ans += T print(ans)
14
14
218
218
N, T = list(map(int, input().split())) t = list(map(int, input().split())) time = 0 for i in range(N - 1): if t[i + 1] - t[i] >= T: time += T else: time += t[i + 1] - t[i] time += T print(time)
N, T = list(map(int, input().split())) tt = list(map(int, input().split())) ans = 0 for i in range(N - 1): nn = tt[i + 1] - tt[i] if nn > T: ans += T else: ans += nn ans += T print(ans)
false
0
[ "-t = list(map(int, input().split()))", "-time = 0", "+tt = list(map(int, input().split()))", "+ans = 0", "- if t[i + 1] - t[i] >= T:", "- time += T", "+ nn = tt[i + 1] - tt[i]", "+ if nn > T:", "+ ans += T", "- time += t[i + 1] - t[i]", "-time += T", "-print(time...
false
0.10295
0.037884
2.717512
[ "s421983255", "s386121052" ]
u423966555
p03633
python
s167889784
s645185155
31
27
9,088
9,104
Accepted
Accepted
12.9
def gcd(a,b): while b!=0: tmp = b b = a%b a = tmp return a def lcm(a,b): return a*b // gcd(a,b) N = int(eval(input())) T = [int(eval(input())) for _ in range(N)] ans = 1 for t in T: ans = lcm(ans, t) print(ans)
def main(): def gcd(a,b): while b!=0: a, b = b, a%b return a def lcm(a,b): return a*b // gcd(a,b) N = int(eval(input())) T = [int(eval(input())) for _ in range(N)] ans = 1 for t in T: ans = lcm(ans, t) print(ans) if __name__ == '...
16
18
256
331
def gcd(a, b): while b != 0: tmp = b b = a % b a = tmp return a def lcm(a, b): return a * b // gcd(a, b) N = int(eval(input())) T = [int(eval(input())) for _ in range(N)] ans = 1 for t in T: ans = lcm(ans, t) print(ans)
def main(): def gcd(a, b): while b != 0: a, b = b, a % b return a def lcm(a, b): return a * b // gcd(a, b) N = int(eval(input())) T = [int(eval(input())) for _ in range(N)] ans = 1 for t in T: ans = lcm(ans, t) print(ans) if __name__ == "__main...
false
11.111111
[ "-def gcd(a, b):", "- while b != 0:", "- tmp = b", "- b = a % b", "- a = tmp", "- return a", "+def main():", "+ def gcd(a, b):", "+ while b != 0:", "+ a, b = b, a % b", "+ return a", "+", "+ def lcm(a, b):", "+ return a * b /...
false
0.038133
0.035752
1.066602
[ "s167889784", "s645185155" ]
u609061751
p03045
python
s667126702
s451770478
574
358
66,652
5,332
Accepted
Accepted
37.63
import sys input = sys.stdin.readline n,m = list(map(int,input().split())) #Union Find #xの根を求める def find(x): if par[x] < 0: return x else: par[x] = find(par[x]) return par[x] #xとyの属する集合の併合 def unite(x,y): x = find(x) y = find(y) if x == y: re...
import sys input = lambda : sys.stdin.readline().rstrip() n, m = list(map(int, input().split())) #Union Find #xの根を求める def find(x): if par[x] < 0: return x else: par[x] = find(par[x]) return par[x] #xとyの属する集合の併合 def unite(x,y): x = find(x) y = find(y) if...
53
52
823
836
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) # Union Find # xの根を求める def find(x): if par[x] < 0: return x else: par[x] = find(par[x]) return par[x] # xとyの属する集合の併合 def unite(x, y): x = find(x) y = find(y) if x == y: return False el...
import sys input = lambda: sys.stdin.readline().rstrip() n, m = list(map(int, input().split())) # Union Find # xの根を求める def find(x): if par[x] < 0: return x else: par[x] = find(par[x]) return par[x] # xとyの属する集合の併合 def unite(x, y): x = find(x) y = find(y) if x == y: ...
false
1.886792
[ "-input = sys.stdin.readline", "+input = lambda: sys.stdin.readline().rstrip()", "-###具体例###", "- x, y, z = [int(x) for x in input().split()]", "+ x, y, z = list(map(int, input().split()))", "-A = set()", "+ans = 0", "- A.add(find(i))", "-print((len(A)))", "+ if find(i) == i:", "+ ...
false
0.040985
0.040525
1.011339
[ "s667126702", "s451770478" ]
u663710122
p03795
python
s119017782
s184183513
19
17
2,940
2,940
Accepted
Accepted
10.53
N = int(eval(input())) print((800 * N - N // 15 * 200))
print(((lambda N: 800 * N - N // 15 * 200)(int(eval(input())))))
2
1
48
56
N = int(eval(input())) print((800 * N - N // 15 * 200))
print(((lambda N: 800 * N - N // 15 * 200)(int(eval(input())))))
false
50
[ "-N = int(eval(input()))", "-print((800 * N - N // 15 * 200))", "+print(((lambda N: 800 * N - N // 15 * 200)(int(eval(input())))))" ]
false
0.048095
0.048012
1.001727
[ "s119017782", "s184183513" ]
u279493135
p02844
python
s489345716
s852410218
1,116
42
65,112
10,660
Accepted
Accepted
96.24
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ...
28
37
925
1,079
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_...
false
24.324324
[ "-s = set([\"\"])", "-for n in S:", "- s |= set(x + n for x in s if len(x) != 3)", "-print((len([x for x in s if len(x) == 3])))", "+ans = 0", "+for i in range(1000):", "+ x = str(i).zfill(3)", "+ begin_idx = -1", "+ idx = 0", "+ while idx <= 2:", "+ begin_idx = S.find(x[id...
false
0.046659
0.038118
1.22408
[ "s489345716", "s852410218" ]
u186838327
p03481
python
s851498128
s129383834
175
64
38,256
61,860
Accepted
Accepted
63.43
x, y = list(map(int, input().split())) ans = 1 while x*2 <= y: ans += 1 x *= 2 print(ans)
x, y = list(map(int, input().split())) if y < 2*x: print((1)) exit() ans = 1 while x*2 <= y: ans += 1 x = 2*x print(ans)
6
12
97
143
x, y = list(map(int, input().split())) ans = 1 while x * 2 <= y: ans += 1 x *= 2 print(ans)
x, y = list(map(int, input().split())) if y < 2 * x: print((1)) exit() ans = 1 while x * 2 <= y: ans += 1 x = 2 * x print(ans)
false
50
[ "+if y < 2 * x:", "+ print((1))", "+ exit()", "- x *= 2", "+ x = 2 * x" ]
false
0.040202
0.053086
0.7573
[ "s851498128", "s129383834" ]
u879870653
p03699
python
s450944596
s074655400
19
17
3,064
3,060
Accepted
Accepted
10.53
N = int(eval(input())) L = [int(eval(input())) for i in range(N)] L = [0]+L L = sorted(L) p = sum(L) flag = 0 while flag == 0 : counter = 0 for i in range(len(L)) : q = p - L[i] if q % 10 != 0 : ans = q flag = 1 break else : ...
N = int(eval(input())) L = [int(eval(input())) for i in range(N)] L = sorted(L) ans = sum(L) if ans % 10 == 0 : for l in L : if l % 10 != 0 : ans -= l break else : ans = 0 print(ans)
23
12
447
229
N = int(eval(input())) L = [int(eval(input())) for i in range(N)] L = [0] + L L = sorted(L) p = sum(L) flag = 0 while flag == 0: counter = 0 for i in range(len(L)): q = p - L[i] if q % 10 != 0: ans = q flag = 1 break else: counter += 1 ...
N = int(eval(input())) L = [int(eval(input())) for i in range(N)] L = sorted(L) ans = sum(L) if ans % 10 == 0: for l in L: if l % 10 != 0: ans -= l break else: ans = 0 print(ans)
false
47.826087
[ "-L = [0] + L", "-p = sum(L)", "-flag = 0", "-while flag == 0:", "- counter = 0", "- for i in range(len(L)):", "- q = p - L[i]", "- if q % 10 != 0:", "- ans = q", "- flag = 1", "+ans = sum(L)", "+if ans % 10 == 0:", "+ for l in L:", "+ if...
false
0.03668
0.037997
0.965336
[ "s450944596", "s074655400" ]
u057916330
p03775
python
s497232498
s224243325
37
28
3,060
2,940
Accepted
Accepted
24.32
N = int(eval(input())) def func(n): return 11 if (N % n > 0) else len(str(N // n)) nn = min(list(range(1, int(N**(0.5) + 1))), key=func) ans = len(str(N // nn)) print(ans)
def main(): N = int(eval(input())) n = int(N**(0.5) + 1) while N % n > 0: n -= 1 print((len(str(N // n)))) if __name__ == '__main__': main()
10
10
177
172
N = int(eval(input())) def func(n): return 11 if (N % n > 0) else len(str(N // n)) nn = min(list(range(1, int(N ** (0.5) + 1))), key=func) ans = len(str(N // nn)) print(ans)
def main(): N = int(eval(input())) n = int(N ** (0.5) + 1) while N % n > 0: n -= 1 print((len(str(N // n)))) if __name__ == "__main__": main()
false
0
[ "-N = int(eval(input()))", "+def main():", "+ N = int(eval(input()))", "+ n = int(N ** (0.5) + 1)", "+ while N % n > 0:", "+ n -= 1", "+ print((len(str(N // n))))", "-def func(n):", "- return 11 if (N % n > 0) else len(str(N // n))", "-", "-", "-nn = min(list(range(1, int...
false
0.044952
0.041139
1.092691
[ "s497232498", "s224243325" ]
u072053884
p01288
python
s155262912
s385592014
3,590
1,380
11,748
88,892
Accepted
Accepted
61.56
def solve(): import sys file_input = sys.stdin while True: N, Q = list(map(int, file_input.readline().split())) if N == 0: break parent = [None, None] parent += [int(file_input.readline()) for _ in range(N - 1)] unmarked = [True] * (N + 1) ...
class UnionFind: def __init__(self, size): self.table = [None] * size def find(self, x): if self.table[x] == None: return x else: # compression of the path self.table[x] = self.find(self.table[x]) return self.table[x] ...
24
57
670
1,572
def solve(): import sys file_input = sys.stdin while True: N, Q = list(map(int, file_input.readline().split())) if N == 0: break parent = [None, None] parent += [int(file_input.readline()) for _ in range(N - 1)] unmarked = [True] * (N + 1) unmarke...
class UnionFind: def __init__(self, size): self.table = [None] * size def find(self, x): if self.table[x] == None: return x else: # compression of the path self.table[x] = self.find(self.table[x]) return self.table[x] def union(self, ...
false
57.894737
[ "+class UnionFind:", "+ def __init__(self, size):", "+ self.table = [None] * size", "+", "+ def find(self, x):", "+ if self.table[x] == None:", "+ return x", "+ else:", "+ # compression of the path", "+ self.table[x] = self.find(self.tabl...
false
0.042668
0.037302
1.143838
[ "s155262912", "s385592014" ]
u309141201
p03814
python
s224306328
s243112375
50
45
3,512
9,260
Accepted
Accepted
10
s = eval(input()) start = 0 end = 0 start = s.find('A') for i in range(len(s)): if 'Z' in s[i]: if end <= i: end = i print((end - start + 1))
s = eval(input()) for i in range(len(s)): if s[i] == 'A': Ai = i break for i in range(len(s))[::-1]: if s[i] == 'Z': Zi = i break print((Zi-Ai+1))
9
10
165
188
s = eval(input()) start = 0 end = 0 start = s.find("A") for i in range(len(s)): if "Z" in s[i]: if end <= i: end = i print((end - start + 1))
s = eval(input()) for i in range(len(s)): if s[i] == "A": Ai = i break for i in range(len(s))[::-1]: if s[i] == "Z": Zi = i break print((Zi - Ai + 1))
false
10
[ "-start = 0", "-end = 0", "-start = s.find(\"A\")", "- if \"Z\" in s[i]:", "- if end <= i:", "- end = i", "-print((end - start + 1))", "+ if s[i] == \"A\":", "+ Ai = i", "+ break", "+for i in range(len(s))[::-1]:", "+ if s[i] == \"Z\":", "+ Zi ...
false
0.041933
0.047471
0.883344
[ "s224306328", "s243112375" ]
u896847891
p02832
python
s174672136
s465542469
106
91
24,744
26,268
Accepted
Accepted
14.15
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 for i in range(n): if a[i] == cnt+1: cnt += 1 print((-1 if cnt == 0 else n-cnt))
n = int(eval(input())) a = list(map(int, input().split())) now = 1 for x in a: if x == now: now += 1 print((-1 if now == 1 else n-now+1))
7
9
151
149
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 for i in range(n): if a[i] == cnt + 1: cnt += 1 print((-1 if cnt == 0 else n - cnt))
n = int(eval(input())) a = list(map(int, input().split())) now = 1 for x in a: if x == now: now += 1 print((-1 if now == 1 else n - now + 1))
false
22.222222
[ "-cnt = 0", "-for i in range(n):", "- if a[i] == cnt + 1:", "- cnt += 1", "-print((-1 if cnt == 0 else n - cnt))", "+now = 1", "+for x in a:", "+ if x == now:", "+ now += 1", "+print((-1 if now == 1 else n - now + 1))" ]
false
0.006792
0.04214
0.16118
[ "s174672136", "s465542469" ]
u059210959
p03207
python
s706378422
s021404800
157
42
13,392
10,720
Accepted
Accepted
73.25
# encoding:utf-8 import copy import numpy as np import random n = int(eval(input())) p = [] for i in range(n): p.append(int(eval(input()))) answer = sum(p)-max(p)//2 print(answer)
#!/usr/bin/env python3 # encoding:utf-8 import copy import random import bisect #bisect_left これで二部探索の大小検索が行える import fractions #最小公倍数などはこっち import math import sys import collections from decimal import Decimal # 10進数で考慮できる mod = 10**9+7 sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000 d = collections.de...
15
26
191
537
# encoding:utf-8 import copy import numpy as np import random n = int(eval(input())) p = [] for i in range(n): p.append(int(eval(input()))) answer = sum(p) - max(p) // 2 print(answer)
#!/usr/bin/env python3 # encoding:utf-8 import copy import random import bisect # bisect_left これで二部探索の大小検索が行える import fractions # 最小公倍数などはこっち import math import sys import collections from decimal import Decimal # 10進数で考慮できる mod = 10**9 + 7 sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000 d = collections.deque() ...
false
42.307692
[ "+#!/usr/bin/env python3", "-import numpy as np", "+import bisect # bisect_left これで二部探索の大小検索が行える", "+import fractions # 最小公倍数などはこっち", "+import math", "+import sys", "+import collections", "+from decimal import Decimal # 10進数で考慮できる", "-n = int(eval(input()))", "-p = []", "-for i in range(n):",...
false
0.086805
0.046451
1.868742
[ "s706378422", "s021404800" ]
u861962192
p02862
python
s927525286
s595680349
1,267
128
44,084
3,064
Accepted
Accepted
89.9
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def extgcd(a, b): if b == 0: return [1, 0, a] x, y, g = extgcd(b, a % b) return [y, x - a//b * y, g] def mod_inverse(a, m): x, _, _ = extgcd(a, m) return (m + ...
45
42
1,019
849
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in ra...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def extgcd(a, b): if b == 0: return [1, 0, a] x, y, g = extgcd(b, a % b) return [y, x - a // b * y, g] def mod_inverse(a, m): x, _, _ = extgcd(a, m) return (m + x % m) % m...
false
6.666667
[ "-def cmb(n, r):", "- if n - r < r:", "- r = n - r", "- if r == 0:", "- return 1", "- if r == 1:", "- return n", "- numerator = [n - r + k + 1 for k in range(r)]", "- denominator = [k + 1 for k in range(r)]", "- for p in range(2, r + 1):", "- pivot =...
false
0.272773
0.066623
4.09431
[ "s927525286", "s595680349" ]
u794173881
p02683
python
s049920899
s227570636
79
73
68,224
68,580
Accepted
Accepted
7.59
n, m, x = list(map(int, input().split())) info= [list(map(int, input().split())) for i in range(n)] ans = 10 ** 18 for bit_state in range(1 << n): tmp = [0] * m cost = 0 for i in range(n): if bit_state & (1 << i): for j in range(m): tmp[j] += info[i][j + 1] ...
n, m, x = list(map(int, input().split())) info = [list(map(int, input().split())) for i in range(n)] ans = 10 ** 18 for bit_state in range(1 << n): tmp = [0] * m cost = 0 for i in range(n): if bit_state & (1 << i): for j in range(m): tmp[j] += info[i][j + 1] ...
25
23
559
514
n, m, x = list(map(int, input().split())) info = [list(map(int, input().split())) for i in range(n)] ans = 10**18 for bit_state in range(1 << n): tmp = [0] * m cost = 0 for i in range(n): if bit_state & (1 << i): for j in range(m): tmp[j] += info[i][j + 1] cos...
n, m, x = list(map(int, input().split())) info = [list(map(int, input().split())) for i in range(n)] ans = 10**18 for bit_state in range(1 << n): tmp = [0] * m cost = 0 for i in range(n): if bit_state & (1 << i): for j in range(m): tmp[j] += info[i][j + 1] cos...
false
8
[ "- flag = True", "- flag = False", "- if flag:", "+ break", "+ else:" ]
false
0.04315
0.038798
1.112159
[ "s049920899", "s227570636" ]
u620480037
p02862
python
s269198965
s485206819
388
252
127,560
213,084
Accepted
Accepted
35.05
A,B=list(map(int,input().split())) if B>A: A,B=B,A X=A-B Y=B-X if Y%3!=0: print((0)) exit() Z=(Y*2)//3 def cmb(n, r, mod): if ( r<0 or r>n ): return 0 r = min(r, n-r) return g1[n] * g2[r] * g2[n-r] % mod mod = 10**9+7 #出力の制限 N = 10**6 g1 = [1, 1] # 元テーブル g2...
x,y=list(map(int,input().split())) X=max(x,y) Y=min(x,y) def cmb(n, r, mod): if ( r<0 or r>n ): return 0 r = min(r, n-r) return g1[n] * g2[r] * g2[n-r] % mod mod = 10**9+7 #出力の制限 N = 10**6+1 g1 = [1, 1] # 元テーブル g2 = [1, 1] #逆元テーブル inverse = [0, 1] #逆元テーブル計算用テーブル for i in range( 2,...
33
31
573
654
A, B = list(map(int, input().split())) if B > A: A, B = B, A X = A - B Y = B - X if Y % 3 != 0: print((0)) exit() Z = (Y * 2) // 3 def cmb(n, r, mod): if r < 0 or r > n: return 0 r = min(r, n - r) return g1[n] * g2[r] * g2[n - r] % mod mod = 10**9 + 7 # 出力の制限 N = 10**6 g1 = [1, 1] ...
x, y = list(map(int, input().split())) X = max(x, y) Y = min(x, y) def cmb(n, r, mod): if r < 0 or r > n: return 0 r = min(r, n - r) return g1[n] * g2[r] * g2[n - r] % mod mod = 10**9 + 7 # 出力の制限 N = 10**6 + 1 g1 = [1, 1] # 元テーブル g2 = [1, 1] # 逆元テーブル inverse = [0, 1] # 逆元テーブル計算用テーブル for i in...
false
6.060606
[ "-A, B = list(map(int, input().split()))", "-if B > A:", "- A, B = B, A", "-X = A - B", "-Y = B - X", "-if Y % 3 != 0:", "- print((0))", "- exit()", "-Z = (Y * 2) // 3", "+x, y = list(map(int, input().split()))", "+X = max(x, y)", "+Y = min(x, y)", "-N = 10**6", "+N = 10**6 + 1", ...
false
1.841018
2.536799
0.725725
[ "s269198965", "s485206819" ]
u952708174
p03637
python
s652350751
s789720917
192
63
18,824
14,252
Accepted
Accepted
67.19
def Q3(lst): import numpy as np N = len(lst) lst = np.array(lst) num4 = len(lst[np.where(lst % 4 == 0)]) # 4の倍数の個数 num2 = len(lst[np.where((lst % 4 != 0) & (lst % 2 == 0))]) # 4の倍数でない2の倍数 numOther = len(lst[np.where((lst % 4 != 0) & (lst % 2 != 0))]) if num2 == 0: if numO...
def c_4adjacent(N, A): # 解説通りに実装 # 4の倍数、4の倍数でない2の倍数、奇数の数 num_4, num_2, num_other = 0, 0, 0 for a in A: if a % 4 == 0: num_4 += 1 elif a % 2 == 0: num_2 += 1 else: num_other += 1 if num_2 == 0: ans = 'Yes' if num_other <= n...
22
20
584
505
def Q3(lst): import numpy as np N = len(lst) lst = np.array(lst) num4 = len(lst[np.where(lst % 4 == 0)]) # 4の倍数の個数 num2 = len(lst[np.where((lst % 4 != 0) & (lst % 2 == 0))]) # 4の倍数でない2の倍数 numOther = len(lst[np.where((lst % 4 != 0) & (lst % 2 != 0))]) if num2 == 0: if numOther <= n...
def c_4adjacent(N, A): # 解説通りに実装 # 4の倍数、4の倍数でない2の倍数、奇数の数 num_4, num_2, num_other = 0, 0, 0 for a in A: if a % 4 == 0: num_4 += 1 elif a % 2 == 0: num_2 += 1 else: num_other += 1 if num_2 == 0: ans = "Yes" if num_other <= num_4 + 1 else...
false
9.090909
[ "-def Q3(lst):", "- import numpy as np", "-", "- N = len(lst)", "- lst = np.array(lst)", "- num4 = len(lst[np.where(lst % 4 == 0)]) # 4の倍数の個数", "- num2 = len(lst[np.where((lst % 4 != 0) & (lst % 2 == 0))]) # 4の倍数でない2の倍数", "- numOther = len(lst[np.where((lst % 4 != 0) & (lst % 2 != ...
false
0.359491
0.0626
5.742678
[ "s652350751", "s789720917" ]
u454524105
p02928
python
s641619746
s284797278
755
66
3,188
3,188
Accepted
Accepted
91.26
mod = 10**9 + 7 n, k = list(map(int, input().split())) a = list(map(int, input().split())) v1 = v2 = 0 for i in range(n-1): for j in range(i+1, n): if a[i] > a[j]: v1 += 1 for i in range(1, n): for j in range(i): if a[i] > a[j]: v2 += 1 x1 = k * (k + 1) // 2 x2 = k * (k - 1) // 2 ans...
mod = 10**9 + 7 n, k = list(map(int, input().split())) a = list(map(int, input().split())) h = [0 for _ in range(2001)] ans_1 = [] mi = 2001 for ai in reversed(a): h[ai] += 1 mi = min(mi, ai) if mi == ai: continue ans_1.append(sum(h[:ai])) h = [0 for _ in range(2001)] ans_2 = [] mi = 2001 ...
14
21
363
518
mod = 10**9 + 7 n, k = list(map(int, input().split())) a = list(map(int, input().split())) v1 = v2 = 0 for i in range(n - 1): for j in range(i + 1, n): if a[i] > a[j]: v1 += 1 for i in range(1, n): for j in range(i): if a[i] > a[j]: v2 += 1 x1 = k * (k + 1) // 2 x2 = k * ...
mod = 10**9 + 7 n, k = list(map(int, input().split())) a = list(map(int, input().split())) h = [0 for _ in range(2001)] ans_1 = [] mi = 2001 for ai in reversed(a): h[ai] += 1 mi = min(mi, ai) if mi == ai: continue ans_1.append(sum(h[:ai])) h = [0 for _ in range(2001)] ans_2 = [] mi = 2001 for ai...
false
33.333333
[ "-v1 = v2 = 0", "-for i in range(n - 1):", "- for j in range(i + 1, n):", "- if a[i] > a[j]:", "- v1 += 1", "-for i in range(1, n):", "- for j in range(i):", "- if a[i] > a[j]:", "- v2 += 1", "-x1 = k * (k + 1) // 2", "-x2 = k * (k - 1) // 2", "-ans = ...
false
0.083596
0.063716
1.312015
[ "s641619746", "s284797278" ]
u170201762
p02984
python
s984411036
s152761199
139
127
18,504
20,488
Accepted
Accepted
8.63
N = int(eval(input())) A = list(map(int,input().split())) x = 0 for i in range(N): x += (-1)**i*A[i] X = [x] for i in range(N-1): x = 2*A[i]-x X.append(x) X = [str(x) for x in X] print((' '.join(X)))
N = int(eval(input())) A = list(map(int,input().split())) ans = [0]*N ans[0] = sum([(-1)**i*A[i] for i in range(N)]) for i in range(1,N): ans[i] = 2*A[i-1]-ans[i-1] print((*ans))
11
7
213
180
N = int(eval(input())) A = list(map(int, input().split())) x = 0 for i in range(N): x += (-1) ** i * A[i] X = [x] for i in range(N - 1): x = 2 * A[i] - x X.append(x) X = [str(x) for x in X] print((" ".join(X)))
N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N ans[0] = sum([(-1) ** i * A[i] for i in range(N)]) for i in range(1, N): ans[i] = 2 * A[i - 1] - ans[i - 1] print((*ans))
false
36.363636
[ "-x = 0", "-for i in range(N):", "- x += (-1) ** i * A[i]", "-X = [x]", "-for i in range(N - 1):", "- x = 2 * A[i] - x", "- X.append(x)", "-X = [str(x) for x in X]", "-print((\" \".join(X)))", "+ans = [0] * N", "+ans[0] = sum([(-1) ** i * A[i] for i in range(N)])", "+for i in range(1,...
false
0.042643
0.042686
0.998996
[ "s984411036", "s152761199" ]
u405497807
p02595
python
s636891580
s371122671
399
318
9,176
74,624
Accepted
Accepted
20.3
# Author: Amey Bhavsar # ID: bhavsar # IDE: Geany/Ubuntu # Platform: AtCoder Beginner Contest 174 from math import sqrt, floor, pi, cos, sin, log, log2 # n=map(int,input().split()) n,m=list(map(int,input().split())) ans = 0 for i in range(n): x,y=list(map(int,input().split())) if (sqrt(x*x + y*y)...
n, d = list(map(int, input().split())) d *= d cnt = 0 for i in range(n): x,y=list(map(int,input().split())) if (x*x + y*y <= d): cnt+=1 print(cnt)
25
7
494
143
# Author: Amey Bhavsar # ID: bhavsar # IDE: Geany/Ubuntu # Platform: AtCoder Beginner Contest 174 from math import sqrt, floor, pi, cos, sin, log, log2 # n=map(int,input().split()) n, m = list(map(int, input().split())) ans = 0 for i in range(n): x, y = list(map(int, input().split())) if sqrt(x * x + y * ...
n, d = list(map(int, input().split())) d *= d cnt = 0 for i in range(n): x, y = list(map(int, input().split())) if x * x + y * y <= d: cnt += 1 print(cnt)
false
72
[ "-# Author: Amey Bhavsar", "-# ID: bhavsar", "-# IDE: Geany/Ubuntu", "-# Platform: AtCoder Beginner Contest 174", "-from math import sqrt, floor, pi, cos, sin, log, log2", "-", "-# n=map(int,input().split())", "-n, m = list(map(int, input().split()))", "-ans = 0", "+n, d = list(map(int, input...
false
0.038594
0.042502
0.908049
[ "s636891580", "s371122671" ]
u514894322
p02684
python
s308913178
s175086783
233
170
48,180
32,264
Accepted
Accepted
27.04
n,k = list(map(int,input().split())) *l, = list(map(int,input().split())) seenl = [1] seen = {1} d={} for index,i in enumerate(l): d[index+1]=i #print(d) temp=1 for i in range(k): temp=d[temp] if temp in seen: #print('i=',i) #print('temp=',temp) lenloop = len(seenl)-seenl.index(temp) ...
n,k = list(map(int,input().split())) *l, = list(map(int,input().split())) seenl = [1] seen = {1} temp=1 for i in range(k): temp=l[temp-1] if temp in seen: lenloop = len(seenl)-seenl.index(temp) r = (k-i-1)%lenloop temp = seenl[seenl.index(temp):][r] break seenl.append(temp) seen.add...
22
15
466
327
n, k = list(map(int, input().split())) (*l,) = list(map(int, input().split())) seenl = [1] seen = {1} d = {} for index, i in enumerate(l): d[index + 1] = i # print(d) temp = 1 for i in range(k): temp = d[temp] if temp in seen: # print('i=',i) # print('temp=',temp) lenloop = len(seenl...
n, k = list(map(int, input().split())) (*l,) = list(map(int, input().split())) seenl = [1] seen = {1} temp = 1 for i in range(k): temp = l[temp - 1] if temp in seen: lenloop = len(seenl) - seenl.index(temp) r = (k - i - 1) % lenloop temp = seenl[seenl.index(temp) :][r] break ...
false
31.818182
[ "-d = {}", "-for index, i in enumerate(l):", "- d[index + 1] = i", "-# print(d)", "- temp = d[temp]", "+ temp = l[temp - 1]", "- # print('i=',i)", "- # print('temp=',temp)", "- # print('lenloop=',lenloop)" ]
false
0.033955
0.036177
0.938572
[ "s308913178", "s175086783" ]
u328751895
p03680
python
s231530912
s333743338
237
187
17,892
7,084
Accepted
Accepted
21.1
N = int(eval(input())) a = {} for i in range(N): a[i + 1] = int(eval(input())) i = 1 cnt = 0 while True: next_i = a[i] cnt += 1 if next_i < 1: print((-1)) break elif next_i == 2: print(cnt) break a[i] = 0 i = next_i
N = int(eval(input())) a = [int(eval(input())) for _ in range(N)] pointer = a[0] for i in range(N): if pointer - 1 == 1: print((i + 1)) exit(0) pointer = a[pointer - 1] print((-1))
19
10
281
198
N = int(eval(input())) a = {} for i in range(N): a[i + 1] = int(eval(input())) i = 1 cnt = 0 while True: next_i = a[i] cnt += 1 if next_i < 1: print((-1)) break elif next_i == 2: print(cnt) break a[i] = 0 i = next_i
N = int(eval(input())) a = [int(eval(input())) for _ in range(N)] pointer = a[0] for i in range(N): if pointer - 1 == 1: print((i + 1)) exit(0) pointer = a[pointer - 1] print((-1))
false
47.368421
[ "-a = {}", "+a = [int(eval(input())) for _ in range(N)]", "+pointer = a[0]", "- a[i + 1] = int(eval(input()))", "-i = 1", "-cnt = 0", "-while True:", "- next_i = a[i]", "- cnt += 1", "- if next_i < 1:", "- print((-1))", "- break", "- elif next_i == 2:", "- ...
false
0.059634
0.007773
7.671721
[ "s231530912", "s333743338" ]
u861141787
p02700
python
s590559658
s341972343
23
21
9,176
9,088
Accepted
Accepted
8.7
a, b, c, d = list(map(int, input().split())) while a > 0 or c > 0: c -= b if c <= 0: print("Yes") exit() a -= d if a <= 0: print("No") exit()
a, b, c, d = list(map(int, input().split())) attack_t = c // b if c % b != 0: attack_t += 1 attack_a = a // d if a % d != 0: attack_a += 1 if attack_a >= attack_t: print("Yes") else: print("No")
11
14
194
221
a, b, c, d = list(map(int, input().split())) while a > 0 or c > 0: c -= b if c <= 0: print("Yes") exit() a -= d if a <= 0: print("No") exit()
a, b, c, d = list(map(int, input().split())) attack_t = c // b if c % b != 0: attack_t += 1 attack_a = a // d if a % d != 0: attack_a += 1 if attack_a >= attack_t: print("Yes") else: print("No")
false
21.428571
[ "-while a > 0 or c > 0:", "- c -= b", "- if c <= 0:", "- print(\"Yes\")", "- exit()", "- a -= d", "- if a <= 0:", "- print(\"No\")", "- exit()", "+attack_t = c // b", "+if c % b != 0:", "+ attack_t += 1", "+attack_a = a // d", "+if a % d != 0:", ...
false
0.064023
0.044723
1.431539
[ "s590559658", "s341972343" ]
u216015528
p02573
python
s553943158
s936209069
824
686
109,212
14,904
Accepted
Accepted
16.75
#!/usr/bin/env python3 def main(): from collections import deque N, M = list(map(int, input().split())) friends_input = [set() for _ in range(N)] for _ in range(M): a, b = list(map(int, input().split())) friends_input[a - 1].add(b - 1) friends_input[b - 1].add(a - 1) ...
#!/usr/bin/env python3 class unionfind: """Union-Find""" def __init__(self, n: int): """ Constructer(Initialize parameter in this class) Parameters ---------- n : int Number of node Yields ----- root : list ...
36
118
930
2,481
#!/usr/bin/env python3 def main(): from collections import deque N, M = list(map(int, input().split())) friends_input = [set() for _ in range(N)] for _ in range(M): a, b = list(map(int, input().split())) friends_input[a - 1].add(b - 1) friends_input[b - 1].add(a - 1) seen = ...
#!/usr/bin/env python3 class unionfind: """Union-Find""" def __init__(self, n: int): """ Constructer(Initialize parameter in this class) Parameters ---------- n : int Number of node Yields ----- root : list When value is po...
false
69.491525
[ "+class unionfind:", "+ \"\"\"Union-Find\"\"\"", "+", "+ def __init__(self, n: int):", "+ \"\"\"", "+ Constructer(Initialize parameter in this class)", "+ Parameters", "+ n : int", "+ Number of node", "+ Yields", "+ root : list", "+ ...
false
0.045736
0.041433
1.103863
[ "s553943158", "s936209069" ]
u893063840
p03388
python
s150520937
s921903384
41
21
3,192
3,188
Accepted
Accepted
48.78
from math import ceil, floor q = int(eval(input())) ab = [list(map(int, input().split())) for _ in range(q)] def f(a, b, x): return (a + x - 1) * (b - x + 1) def get_mx(a, b, num): tmp = (b - a + 2) / 2 lx = max(1, floor(tmp)) rx = min(num, ceil(tmp)) mx = max(f(a, b, lx), f(a, b,...
q = int(eval(input())) ab = [list(map(int, input().split())) for _ in range(q)] for a, b in ab: if a == b: print((2 * a - 2)) continue l = 1 r = 10 ** 10 while r - l > 1: m = (l + r) // 2 mx = (m + 1) // 2 * (m + 1 - (m + 1) // 2) if mx < a * b: ...
59
19
1,511
382
from math import ceil, floor q = int(eval(input())) ab = [list(map(int, input().split())) for _ in range(q)] def f(a, b, x): return (a + x - 1) * (b - x + 1) def get_mx(a, b, num): tmp = (b - a + 2) / 2 lx = max(1, floor(tmp)) rx = min(num, ceil(tmp)) mx = max(f(a, b, lx), f(a, b, rx)) retu...
q = int(eval(input())) ab = [list(map(int, input().split())) for _ in range(q)] for a, b in ab: if a == b: print((2 * a - 2)) continue l = 1 r = 10**10 while r - l > 1: m = (l + r) // 2 mx = (m + 1) // 2 * (m + 1 - (m + 1) // 2) if mx < a * b: l = m ...
false
67.79661
[ "-from math import ceil, floor", "-", "-", "-", "-def f(a, b, x):", "- return (a + x - 1) * (b - x + 1)", "-", "-", "-def get_mx(a, b, num):", "- tmp = (b - a + 2) / 2", "- lx = max(1, floor(tmp))", "- rx = min(num, ceil(tmp))", "- mx = max(f(a, b, lx), f(a, b, rx))", "- ...
false
0.083415
0.075795
1.100541
[ "s150520937", "s921903384" ]
u790905630
p02866
python
s944572622
s207093393
338
80
14,396
13,908
Accepted
Accepted
76.33
def main(): N = eval(input()) D = list(map(int,input().split())) M = max(D) countlist=[0] * (M + 1) ans=1 for i in D: countlist[i]+=1 if countlist[0]!=1 : ans = 0 else : if D[0]!=0 : ans = 0 else: for i in range(...
def main(): N = eval(input()) D = list(map(int,input().split())) M = max(D) countlist=[0] * (M + 1) ans=1 for i in D: countlist[i]+=1 if countlist[0]!=1 : ans = 0 else : if D[0]!=0 : ans = 0 else: for i in range(...
24
24
445
454
def main(): N = eval(input()) D = list(map(int, input().split())) M = max(D) countlist = [0] * (M + 1) ans = 1 for i in D: countlist[i] += 1 if countlist[0] != 1: ans = 0 else: if D[0] != 0: ans = 0 else: for i in range(2, M + 1): ...
def main(): N = eval(input()) D = list(map(int, input().split())) M = max(D) countlist = [0] * (M + 1) ans = 1 for i in D: countlist[i] += 1 if countlist[0] != 1: ans = 0 else: if D[0] != 0: ans = 0 else: for i in range(2, M + 1): ...
false
0
[ "- ans *= countlist[i - 1] ** countlist[i]", "- print((ans % 998244353))", "+ ans = ans * (countlist[i - 1] ** countlist[i]) % 998244353", "+ print(ans)" ]
false
0.039156
0.15366
0.254822
[ "s944572622", "s207093393" ]
u532022710
p02952
python
s330154444
s027430539
65
47
2,940
2,940
Accepted
Accepted
27.69
N = int(eval(input())) ans = 0 for i in range(1, N + 1): if len(str(i)) % 2 == 1: ans += 1 print(ans)
#!/usr/bin/env python3 import sys def solve(N: int): result = 0 for i in range(1, N + 1): if len(str(i)) % 2 != 0: result += 1 print(result) return # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You c...
6
29
106
641
N = int(eval(input())) ans = 0 for i in range(1, N + 1): if len(str(i)) % 2 == 1: ans += 1 print(ans)
#!/usr/bin/env python3 import sys def solve(N: int): result = 0 for i in range(1, N + 1): if len(str(i)) % 2 != 0: result += 1 print(result) return # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this li...
false
79.310345
[ "-N = int(eval(input()))", "-ans = 0", "-for i in range(1, N + 1):", "- if len(str(i)) % 2 == 1:", "- ans += 1", "-print(ans)", "+#!/usr/bin/env python3", "+import sys", "+", "+", "+def solve(N: int):", "+ result = 0", "+ for i in range(1, N + 1):", "+ if len(str(i))...
false
0.058128
0.13414
0.433343
[ "s330154444", "s027430539" ]
u752233836
p02585
python
s178509115
s270222012
726
555
286,628
286,456
Accepted
Accepted
23.55
n, k = list(map(int, input().split())) p = [int(x) for x in input().split()] c = [int(x) for x in input().split()] p_flag = [0 for _ in range(len(p))] loop_max = [] loop_len = [] S = [] S_max = [] ans = [] for i in range(len(p)): # if p_flag[i] == 1: # continue now = i temp_len = ...
n, k = list(map(int, input().split())) p = [int(x) for x in input().split()] c = [int(x) for x in input().split()] loop_max = [] loop_len = [] S = [] ans = [] for i in range(len(p)): now = i temp_len = 0 temp_s = 0 temp_l = [] while True: now = p[now] - 1 temp_len...
48
40
1,074
894
n, k = list(map(int, input().split())) p = [int(x) for x in input().split()] c = [int(x) for x in input().split()] p_flag = [0 for _ in range(len(p))] loop_max = [] loop_len = [] S = [] S_max = [] ans = [] for i in range(len(p)): # if p_flag[i] == 1: # continue now = i temp_len = 0 temp_s = 0 ...
n, k = list(map(int, input().split())) p = [int(x) for x in input().split()] c = [int(x) for x in input().split()] loop_max = [] loop_len = [] S = [] ans = [] for i in range(len(p)): now = i temp_len = 0 temp_s = 0 temp_l = [] while True: now = p[now] - 1 temp_len += 1 temp_s...
false
16.666667
[ "-p_flag = [0 for _ in range(len(p))]", "-S_max = []", "- # if p_flag[i] == 1:", "- # continue", "- S_max = -(10**9 + 1)", "- p_flag[now] = 1", "-# print(loop_max)", "-# print(ans)" ]
false
0.042572
0.041714
1.020557
[ "s178509115", "s270222012" ]
u790710233
p03569
python
s494875904
s635798962
82
68
5,148
3,316
Accepted
Accepted
17.07
from collections import deque s = eval(input()) s2 = s.replace('x', '') if s2 != s2[::-1]: print((-1)) else: d = deque(s) a, b = [], [] cnt = 0 x = y = '' x_skip = y_skip = 0 while d: if not x_skip: x = d.popleft() if 0 < len(d)and not y_skip: ...
s = eval(input()) L = 0 R = len(s)-1 ans = 0 while L < R: if s[L] == s[R]: L += 1 R -= 1 elif s[L] == 'x' and s[R] != 'x': ans += 1 L += 1 elif s[L] != 'x' and s[R] == 'x': ans += 1 R -= 1 elif s[L] != s[R] and s[L] != 'x' and s[R] != 'x': ...
41
18
790
356
from collections import deque s = eval(input()) s2 = s.replace("x", "") if s2 != s2[::-1]: print((-1)) else: d = deque(s) a, b = [], [] cnt = 0 x = y = "" x_skip = y_skip = 0 while d: if not x_skip: x = d.popleft() if 0 < len(d) and not y_skip: y = d....
s = eval(input()) L = 0 R = len(s) - 1 ans = 0 while L < R: if s[L] == s[R]: L += 1 R -= 1 elif s[L] == "x" and s[R] != "x": ans += 1 L += 1 elif s[L] != "x" and s[R] == "x": ans += 1 R -= 1 elif s[L] != s[R] and s[L] != "x" and s[R] != "x": ans = ...
false
56.097561
[ "-from collections import deque", "-", "-s2 = s.replace(\"x\", \"\")", "-if s2 != s2[::-1]:", "- print((-1))", "-else:", "- d = deque(s)", "- a, b = [], []", "- cnt = 0", "- x = y = \"\"", "- x_skip = y_skip = 0", "- while d:", "- if not x_skip:", "- ...
false
0.037856
0.045461
0.832716
[ "s494875904", "s635798962" ]
u886878171
p03448
python
s304117007
s020789325
185
54
39,664
9,124
Accepted
Accepted
70.81
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) ans = 0 for i in range(A+1): for j in range(B+1): for k in range(C+1): total = 500*i + 100*j + 50*k if total == X: ans += 1 print(ans)
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) count = 0 for i in range(A+1): for j in range(B+1): for k in range(C+1): if 500*i + 100*j + 50*k == X: count+=1 print(count)
14
11
243
242
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) ans = 0 for i in range(A + 1): for j in range(B + 1): for k in range(C + 1): total = 500 * i + 100 * j + 50 * k if total == X: ans += 1 print(ans)
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) count = 0 for i in range(A + 1): for j in range(B + 1): for k in range(C + 1): if 500 * i + 100 * j + 50 * k == X: count += 1 print(count)
false
21.428571
[ "-ans = 0", "+count = 0", "- total = 500 * i + 100 * j + 50 * k", "- if total == X:", "- ans += 1", "-print(ans)", "+ if 500 * i + 100 * j + 50 * k == X:", "+ count += 1", "+print(count)" ]
false
0.108256
0.074573
1.451688
[ "s304117007", "s020789325" ]
u624475441
p03309
python
s180988281
s242354183
213
189
26,132
26,128
Accepted
Accepted
11.27
N=int(eval(input()))//2 A=sorted(a-i-1 for i,a in enumerate(map(int,input().split()))) print((sum(abs(a-A[N])for a in A)))
N=int(eval(input())) A=sorted(a-i for i,a in enumerate(map(int,input().split()))) print((sum(A[N//2:])-sum(A[:-~N//2])))
3
3
116
114
N = int(eval(input())) // 2 A = sorted(a - i - 1 for i, a in enumerate(map(int, input().split()))) print((sum(abs(a - A[N]) for a in A)))
N = int(eval(input())) A = sorted(a - i for i, a in enumerate(map(int, input().split()))) print((sum(A[N // 2 :]) - sum(A[: -~N // 2])))
false
0
[ "-N = int(eval(input())) // 2", "-A = sorted(a - i - 1 for i, a in enumerate(map(int, input().split())))", "-print((sum(abs(a - A[N]) for a in A)))", "+N = int(eval(input()))", "+A = sorted(a - i for i, a in enumerate(map(int, input().split())))", "+print((sum(A[N // 2 :]) - sum(A[: -~N // 2])))" ]
false
0.043605
0.082952
0.525662
[ "s180988281", "s242354183" ]
u062691227
p02574
python
s223860342
s920662221
638
447
220,016
215,220
Accepted
Accepted
29.94
from math import gcd, sqrt, ceil from functools import reduce # def sieve(n): # A = list(range(n+1)) # for i in range(2, n+1 ,2): # A[i] = 2 # for j in range(3, ceil(sqrt(n+1))+1, 2)[::-1]: # for i in range(j, n+1, j): # A[i] = j # return A # def factorize(n, A)...
from math import gcd, sqrt, ceil from functools import reduce def sieve(n): A = list(range(n+1)) for i in range(2, n+1 ,2): A[i] = 2 for j in range(3, ceil(sqrt(n+1))+1, 2)[::-1]: for i in range(j, n+1, j): A[i] = j return A def factorize(n, A): factors = s...
63
61
1,486
1,415
from math import gcd, sqrt, ceil from functools import reduce # def sieve(n): # A = list(range(n+1)) # for i in range(2, n+1 ,2): # A[i] = 2 # for j in range(3, ceil(sqrt(n+1))+1, 2)[::-1]: # for i in range(j, n+1, j): # A[i] = j # return A # def factorize(n, A): # facto...
from math import gcd, sqrt, ceil from functools import reduce def sieve(n): A = list(range(n + 1)) for i in range(2, n + 1, 2): A[i] = 2 for j in range(3, ceil(sqrt(n + 1)) + 1, 2)[::-1]: for i in range(j, n + 1, j): A[i] = j return A def factorize(n, A): factors = se...
false
3.174603
[ "-# def sieve(n):", "-# A = list(range(n+1))", "-# for i in range(2, n+1 ,2):", "-# A[i] = 2", "-# for j in range(3, ceil(sqrt(n+1))+1, 2)[::-1]:", "-# for i in range(j, n+1, j):", "-# A[i] = j", "-# return A", "-# def factorize(n, A):", "-# factors ...
false
0.035578
1.363835
0.026087
[ "s223860342", "s920662221" ]
u379959788
p02756
python
s932069283
s351639846
1,679
1,204
17,032
17,152
Accepted
Accepted
28.29
S = eval(input()) Q = int(eval(input())) Query = [eval(input()) for _ in range(Q)] flag = True s = "!" for i in range(Q): if Query[i][0] == "1": if flag: flag = False else: flag = True else: if Query[i][2] == '1': if flag: ...
S = eval(input()) Q = int(eval(input())) Query = [eval(input()) for _ in range(Q)] flag = True forward = "" backward = "" for i in range(Q): if Query[i][0] == "1": if flag: flag = False else: flag = True else: if Query[i][2] == '1': if fl...
27
32
588
756
S = eval(input()) Q = int(eval(input())) Query = [eval(input()) for _ in range(Q)] flag = True s = "!" for i in range(Q): if Query[i][0] == "1": if flag: flag = False else: flag = True else: if Query[i][2] == "1": if flag: s = Query[i][...
S = eval(input()) Q = int(eval(input())) Query = [eval(input()) for _ in range(Q)] flag = True forward = "" backward = "" for i in range(Q): if Query[i][0] == "1": if flag: flag = False else: flag = True else: if Query[i][2] == "1": if flag: ...
false
15.625
[ "-s = \"!\"", "+forward = \"\"", "+backward = \"\"", "- s = Query[i][4] + s", "+ forward = Query[i][4] + forward", "- s = s + Query[i][4]", "+ backward = backward + Query[i][4]", "- s = s + Query[i][4]", "+ bac...
false
0.036209
0.089581
0.404204
[ "s932069283", "s351639846" ]
u992910889
p02688
python
s158177587
s718074642
69
59
67,552
67,656
Accepted
Accepted
14.49
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): n,k=list(map(int,input().split())) c=[False]*n for i in range(k): d=int(eval(input())) A=list(map(int,input().split())) for j in A: if c[j-1]==Fals...
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): N,K=list(map(int,input().split())) S=[0]*N for i in range(K): d=int(eval(input())) A=list(map(int,input().split())) for i in range(len(A)): S[A...
19
18
377
365
import sys sys.setrecursionlimit(10**5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): n, k = list(map(int, input().split())) c = [False] * n for i in range(k): d = int(eval(input())) A = list(map(int, input().split())) for j in A: if c[j - ...
import sys sys.setrecursionlimit(10**5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): N, K = list(map(int, input().split())) S = [0] * N for i in range(K): d = int(eval(input())) A = list(map(int, input().split())) for i in range(len(A)): S...
false
5.263158
[ "- n, k = list(map(int, input().split()))", "- c = [False] * n", "- for i in range(k):", "+ N, K = list(map(int, input().split()))", "+ S = [0] * N", "+ for i in range(K):", "- for j in A:", "- if c[j - 1] == False:", "- c[j - 1] = True", "- pr...
false
0.205192
0.007093
28.92858
[ "s158177587", "s718074642" ]
u677121387
p02703
python
s166301349
s853422064
750
568
24,724
24,944
Accepted
Accepted
24.27
from heapq import heappop,heappush inf = float("inf") n,m,s = list(map(int,input().split())) G = [[] for _ in range(n)] for _ in range(m): u,v,cost,time = list(map(int,input().split())) u -= 1 v -= 1 G[u].append((v,cost,time)) G[v].append((u,cost,time)) for i in range(n): cost,t...
from heapq import heappop,heappush inf = float("inf") n,m,s = list(map(int,input().split())) G = [[] for _ in range(n)] for _ in range(m): u,v,cost,time = list(map(int,input().split())) u -= 1 v -= 1 G[u].append((v,cost,time)) G[v].append((u,cost,time)) for i in range(n): cost,t...
59
61
1,517
1,590
from heapq import heappop, heappush inf = float("inf") n, m, s = list(map(int, input().split())) G = [[] for _ in range(n)] for _ in range(m): u, v, cost, time = list(map(int, input().split())) u -= 1 v -= 1 G[u].append((v, cost, time)) G[v].append((u, cost, time)) for i in range(n): cost, time...
from heapq import heappop, heappush inf = float("inf") n, m, s = list(map(int, input().split())) G = [[] for _ in range(n)] for _ in range(m): u, v, cost, time = list(map(int, input().split())) u -= 1 v -= 1 G[u].append((v, cost, time)) G[v].append((u, cost, time)) for i in range(n): cost, time...
false
3.278689
[ "+ # 最小時間じゃないなら無視", "+ if mint[now][nowcoins] < minv:", "+ continue" ]
false
0.277107
0.358369
0.773246
[ "s166301349", "s853422064" ]
u227082700
p03987
python
s233082800
s396490431
408
344
35,812
35,652
Accepted
Accepted
15.69
n=int(eval(input())) a=list(map(int,input().split())) b=[0]*n for i in range(n):b[a[i]-1]=i ans=0 l,r=[i for i in range(n+1)],[i for i in range(n+1)] for i in range(n-1,-1,-1): ans+=(i+1)*(b[i]-l[b[i]]+1)*(r[b[i]]-b[i]+1) l[r[b[i]]+1],r[l[b[i]]-1]=l[b[i]],r[b[i]] print(ans)
n=int(eval(input())) a=list(map(int,input().split())) l=[i-1 for i in range(n+1)]+[n] r=[i+1 for i in range(n+1)]+[n+2] ans=0 p=[0]*n for i in range(n):p[a[i]-1]=i for i in range(n-1,-1,-1): j=p[i] ans+=(i+1)*(j-l[j])*(r[j]-j) l[r[j]],r[l[j]]=l[j],r[j] print(ans)
10
12
281
274
n = int(eval(input())) a = list(map(int, input().split())) b = [0] * n for i in range(n): b[a[i] - 1] = i ans = 0 l, r = [i for i in range(n + 1)], [i for i in range(n + 1)] for i in range(n - 1, -1, -1): ans += (i + 1) * (b[i] - l[b[i]] + 1) * (r[b[i]] - b[i] + 1) l[r[b[i]] + 1], r[l[b[i]] - 1] = l[b[i]], ...
n = int(eval(input())) a = list(map(int, input().split())) l = [i - 1 for i in range(n + 1)] + [n] r = [i + 1 for i in range(n + 1)] + [n + 2] ans = 0 p = [0] * n for i in range(n): p[a[i] - 1] = i for i in range(n - 1, -1, -1): j = p[i] ans += (i + 1) * (j - l[j]) * (r[j] - j) l[r[j]], r[l[j]] = l[j], ...
false
16.666667
[ "-b = [0] * n", "+l = [i - 1 for i in range(n + 1)] + [n]", "+r = [i + 1 for i in range(n + 1)] + [n + 2]", "+ans = 0", "+p = [0] * n", "- b[a[i] - 1] = i", "-ans = 0", "-l, r = [i for i in range(n + 1)], [i for i in range(n + 1)]", "+ p[a[i] - 1] = i", "- ans += (i + 1) * (b[i] - l[b[i]]...
false
0.037895
0.03741
1.012972
[ "s233082800", "s396490431" ]
u759412327
p03042
python
s232671388
s283199982
29
23
9,012
9,128
Accepted
Accepted
20.69
S = eval(input()) mm = ["0"+str(x) for x in range(1,10)]+["10","11","12"] mmyy = (S[:2] in mm) yymm = (S[2:] in mm) a = "NA" if yymm and mmyy: a = "AMBIGUOUS" elif yymm: a = "YYMM" elif mmyy: a = "MMYY" print(a)
S = eval(input()) L = int(S[:2]) R = int(S[2:]) if 1<=L<=12 and 1<=R<=12: print("AMBIGUOUS") elif 1<=L<=12: print("MMYY") elif 1<=R<=12: print("YYMM") else: print("NA")
14
12
228
182
S = eval(input()) mm = ["0" + str(x) for x in range(1, 10)] + ["10", "11", "12"] mmyy = S[:2] in mm yymm = S[2:] in mm a = "NA" if yymm and mmyy: a = "AMBIGUOUS" elif yymm: a = "YYMM" elif mmyy: a = "MMYY" print(a)
S = eval(input()) L = int(S[:2]) R = int(S[2:]) if 1 <= L <= 12 and 1 <= R <= 12: print("AMBIGUOUS") elif 1 <= L <= 12: print("MMYY") elif 1 <= R <= 12: print("YYMM") else: print("NA")
false
14.285714
[ "-mm = [\"0\" + str(x) for x in range(1, 10)] + [\"10\", \"11\", \"12\"]", "-mmyy = S[:2] in mm", "-yymm = S[2:] in mm", "-a = \"NA\"", "-if yymm and mmyy:", "- a = \"AMBIGUOUS\"", "-elif yymm:", "- a = \"YYMM\"", "-elif mmyy:", "- a = \"MMYY\"", "-print(a)", "+L = int(S[:2])", "+R ...
false
0.034532
0.105439
0.327509
[ "s232671388", "s283199982" ]
u054514819
p02796
python
s175618451
s988161950
252
216
22,816
81,876
Accepted
Accepted
14.29
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N = int(eval(input())) es = [] for _ in range(N): x, l = mapint() es.append((x+l, x-l)) es.sort() now = -10**18 idx = 0 ans = 0 while 1: if idx==N: ...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N = int(eval(input())) from heapq import heappush, heappop Q = [] for _ in range(N): x, l = mapint() heappush(Q, (x+l, x-l)) ans = 0 now = -10**20 while...
25
23
433
408
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N = int(eval(input())) es = [] for _ in range(N): x, l = mapint() es.append((x + l, x - l)) es.sort() now = -(10**18) idx = 0 ans = 0 while 1: if idx ==...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) N = int(eval(input())) from heapq import heappush, heappop Q = [] for _ in range(N): x, l = mapint() heappush(Q, (x + l, x - l)) ans = 0 now = -(10**20) wh...
false
8
[ "-es = []", "+from heapq import heappush, heappop", "+", "+Q = []", "- es.append((x + l, x - l))", "-es.sort()", "-now = -(10**18)", "-idx = 0", "+ heappush(Q, (x + l, x - l))", "-while 1:", "- if idx == N:", "- break", "- end, start = es[idx]", "- if start >= now:", ...
false
0.048583
0.045268
1.07325
[ "s175618451", "s988161950" ]
u337751290
p02726
python
s543464296
s884131034
1,467
956
3,444
3,444
Accepted
Accepted
34.83
def main(): N, X, Y = list(map(int, input().split())) X -= 1 Y -= 1 answer = [0 for i in range(N+1)] for i in range(0, N): for j in range(i+1, N): answer[min(abs(j-i), abs(X-i)+1+abs(j-Y), abs(Y-i)+1+abs(j-X))] += 1 for i in range(1, N): print((answer[i...
def main(): N, X, Y = list(map(int, input().split())) X -= 1 Y -= 1 answer = [0 for i in range(N+1)] for i in range(0, N): for j in range(i+1, N): answer[min(abs(j-i), abs(X-i)+1+abs(j-Y))] += 1 for i in range(1, N): print((answer[i])) if __name__ ...
17
17
360
339
def main(): N, X, Y = list(map(int, input().split())) X -= 1 Y -= 1 answer = [0 for i in range(N + 1)] for i in range(0, N): for j in range(i + 1, N): answer[ min( abs(j - i), abs(X - i) + 1 + abs(j - Y), abs(Y - i) + 1 + abs(j - X) ...
def main(): N, X, Y = list(map(int, input().split())) X -= 1 Y -= 1 answer = [0 for i in range(N + 1)] for i in range(0, N): for j in range(i + 1, N): answer[min(abs(j - i), abs(X - i) + 1 + abs(j - Y))] += 1 for i in range(1, N): print((answer[i])) if __name__ == "...
false
0
[ "- answer[", "- min(", "- abs(j - i), abs(X - i) + 1 + abs(j - Y), abs(Y - i) + 1 + abs(j - X)", "- )", "- ] += 1", "+ answer[min(abs(j - i), abs(X - i) + 1 + abs(j - Y))] += 1" ]
false
0.04716
0.034467
1.36827
[ "s543464296", "s884131034" ]
u918845030
p03069
python
s095543594
s183581769
121
95
3,500
3,500
Accepted
Accepted
21.49
n = int(eval(input())) s = eval(input()) s = s.rstrip('#') s = s.lstrip('.') if len(set(s)) <= 1: print((0)) exit(0) turn_to_black = s.count('.') current_min = turn_to_black turn_to_white = 0 for i in range(len(s)): if s[i] == '#': turn_to_white +=1 else: turn_to_bl...
n = int(eval(input())) s = eval(input()) s = s.rstrip('#') s = s.lstrip('.') def seek(n, s): turn_to_black = s.count('.') current_min = turn_to_black turn_to_white = 0 if current_min == 0 or current_min == len(s): return(0) # seek minimum turns to create "^\.*#*$" for...
21
23
401
545
n = int(eval(input())) s = eval(input()) s = s.rstrip("#") s = s.lstrip(".") if len(set(s)) <= 1: print((0)) exit(0) turn_to_black = s.count(".") current_min = turn_to_black turn_to_white = 0 for i in range(len(s)): if s[i] == "#": turn_to_white += 1 else: turn_to_black -= 1 current_...
n = int(eval(input())) s = eval(input()) s = s.rstrip("#") s = s.lstrip(".") def seek(n, s): turn_to_black = s.count(".") current_min = turn_to_black turn_to_white = 0 if current_min == 0 or current_min == len(s): return 0 # seek minimum turns to create "^\.*#*$" for i in range(len(s))...
false
8.695652
[ "-if len(set(s)) <= 1:", "- print((0))", "- exit(0)", "-turn_to_black = s.count(\".\")", "-current_min = turn_to_black", "-turn_to_white = 0", "-for i in range(len(s)):", "- if s[i] == \"#\":", "- turn_to_white += 1", "- else:", "- turn_to_black -= 1", "- current_m...
false
0.124718
0.03901
3.197052
[ "s095543594", "s183581769" ]
u294385082
p03416
python
s499216276
s104534949
125
65
2,940
2,940
Accepted
Accepted
48
a,b = list(map(int,input().split())) c = 0 for i in range(a,b+1): if list(str(i)) == list(str(i))[::-1]: c += 1 print(c)
a,b = list(map(int,input().split())) c = 0 for i in range(a,b+1): if str(i) == str(i)[::-1]: c += 1 print(c)
9
9
139
128
a, b = list(map(int, input().split())) c = 0 for i in range(a, b + 1): if list(str(i)) == list(str(i))[::-1]: c += 1 print(c)
a, b = list(map(int, input().split())) c = 0 for i in range(a, b + 1): if str(i) == str(i)[::-1]: c += 1 print(c)
false
0
[ "- if list(str(i)) == list(str(i))[::-1]:", "+ if str(i) == str(i)[::-1]:" ]
false
0.075088
0.043208
1.737814
[ "s499216276", "s104534949" ]
u970197315
p02707
python
s184102756
s466416300
213
184
36,264
33,752
Accepted
Accepted
13.62
# ABC163_A n=int(eval(input())) a=list(map(int,input().split())) from collections import defaultdict as dd d=dd(int) for aa in a: d[aa]+=1 for i in range(n): print((d[i+1]))
n = int(eval(input())) a = list(map(int,input().split())) from collections import Counter c = Counter(a) for i in range(n): print((c[i+1]))
9
7
177
143
# ABC163_A n = int(eval(input())) a = list(map(int, input().split())) from collections import defaultdict as dd d = dd(int) for aa in a: d[aa] += 1 for i in range(n): print((d[i + 1]))
n = int(eval(input())) a = list(map(int, input().split())) from collections import Counter c = Counter(a) for i in range(n): print((c[i + 1]))
false
22.222222
[ "-# ABC163_A", "-from collections import defaultdict as dd", "+from collections import Counter", "-d = dd(int)", "-for aa in a:", "- d[aa] += 1", "+c = Counter(a)", "- print((d[i + 1]))", "+ print((c[i + 1]))" ]
false
0.044889
0.03753
1.196087
[ "s184102756", "s466416300" ]
u366959492
p03053
python
s630098728
s241930512
639
559
123,740
121,820
Accepted
Accepted
12.52
from collections import deque h,w=list(map(int,input().split())) a=[eval(input()) for _ in range(h)] dxy=[(0,1),(1,0),(-1,0),(0,-1)] inf=float("inf") dp=[[inf]*w for _ in range(h)] q=deque() for y,l in enumerate(a): for x,c in enumerate(l): if c=="#": dp[y][x]=0 q.appe...
from collections import deque import sys input=sys.stdin.readline h,w=list(map(int,input().split())) a=[eval(input()) for _ in range(h)] dxy=[(0,1),(1,0),(-1,0),(0,-1)] inf=float("inf") dp=[[inf]*w for _ in range(h)] q=deque() for y,l in enumerate(a): for x,c in enumerate(l): if c=="#": ...
27
29
615
653
from collections import deque h, w = list(map(int, input().split())) a = [eval(input()) for _ in range(h)] dxy = [(0, 1), (1, 0), (-1, 0), (0, -1)] inf = float("inf") dp = [[inf] * w for _ in range(h)] q = deque() for y, l in enumerate(a): for x, c in enumerate(l): if c == "#": dp[y][x] = 0 ...
from collections import deque import sys input = sys.stdin.readline h, w = list(map(int, input().split())) a = [eval(input()) for _ in range(h)] dxy = [(0, 1), (1, 0), (-1, 0), (0, -1)] inf = float("inf") dp = [[inf] * w for _ in range(h)] q = deque() for y, l in enumerate(a): for x, c in enumerate(l): if ...
false
6.896552
[ "+import sys", "+input = sys.stdin.readline" ]
false
0.145683
0.193035
0.754694
[ "s630098728", "s241930512" ]
u047796752
p03730
python
s541278498
s723963969
164
66
38,384
61,952
Accepted
Accepted
59.76
A, B, C = list(map(int, input().split())) for i in range(B): if i*A%B==C: print('YES') exit() print('NO')
A, B, C = list(map(int, input().split())) for i in range(1, B+1): if i*A%B==C: print('YES') break else: print('NO')
8
8
128
141
A, B, C = list(map(int, input().split())) for i in range(B): if i * A % B == C: print("YES") exit() print("NO")
A, B, C = list(map(int, input().split())) for i in range(1, B + 1): if i * A % B == C: print("YES") break else: print("NO")
false
0
[ "-for i in range(B):", "+for i in range(1, B + 1):", "- exit()", "-print(\"NO\")", "+ break", "+else:", "+ print(\"NO\")" ]
false
0.035677
0.03716
0.960105
[ "s541278498", "s723963969" ]