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
u416758623
p03373
python
s696660731
s141846866
124
98
3,060
3,060
Accepted
Accepted
20.97
a, b, c, x, y = list(map(int, input().split())) ans_min = x * a + y * b i = 0 while x - i > -1 or y - i > -1: ans = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b if ans < ans_min: ans_min = ans i += 1 print(ans_min)
a, b, c, x, y = list(map(int, input().split())) ans_min = x * a + y * b for i in range(100001): ans = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b if ans < ans_min: ans_min = ans print(ans_min)
10
9
244
220
a, b, c, x, y = list(map(int, input().split())) ans_min = x * a + y * b i = 0 while x - i > -1 or y - i > -1: ans = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b if ans < ans_min: ans_min = ans i += 1 print(ans_min)
a, b, c, x, y = list(map(int, input().split())) ans_min = x * a + y * b for i in range(100001): ans = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b if ans < ans_min: ans_min = ans print(ans_min)
false
10
[ "-i = 0", "-while x - i > -1 or y - i > -1:", "+for i in range(100001):", "- i += 1" ]
false
0.039093
0.136345
0.286719
[ "s696660731", "s141846866" ]
u077291787
p02787
python
s056983444
s610462226
262
242
39,792
39,536
Accepted
Accepted
7.63
# E - Crested Ibis vs Monster def main(): INF = 1 << 30 H, N, *AB = list(map(int, open(0).read().split())) dp = [INF] * (H + 10001) # dp[i] := min magic points to decrease monster's health by i dp[0] = 0 for a, b in zip(*[iter(AB)] * 2): for i in range(H): dp[i + a] = ...
# E - Crested Ibis vs Monster def main(): INF = 1 << 30 H, N, *AB = list(map(int, open(0).read().split())) dp = [INF] * (H + 10001) # dp[i] := min magic points to decrease monster's health by i dp[0] = 0 for a, b in zip(*[iter(AB)] * 2): for i in range(H): if dp[i] + b...
15
16
408
435
# E - Crested Ibis vs Monster def main(): INF = 1 << 30 H, N, *AB = list(map(int, open(0).read().split())) dp = [INF] * ( H + 10001 ) # dp[i] := min magic points to decrease monster's health by i dp[0] = 0 for a, b in zip(*[iter(AB)] * 2): for i in range(H): dp[i + a...
# E - Crested Ibis vs Monster def main(): INF = 1 << 30 H, N, *AB = list(map(int, open(0).read().split())) dp = [INF] * ( H + 10001 ) # dp[i] := min magic points to decrease monster's health by i dp[0] = 0 for a, b in zip(*[iter(AB)] * 2): for i in range(H): if dp[i]...
false
6.25
[ "- dp[i + a] = min(dp[i + a], dp[i] + b)", "+ if dp[i] + b < dp[i + a]:", "+ dp[i + a] = dp[i] + b" ]
false
0.088319
0.127847
0.690819
[ "s056983444", "s610462226" ]
u576432509
p02574
python
s483236984
s691981783
635
240
219,236
181,488
Accepted
Accepted
62.2
import sys def enum_div(n): ir=int(n**(0.5))+1 ret=[] for i in range(1,ir): if n%i == 0: ret.append(i) if (i!= 1) & (i*i != n): ret.append(n//i) return ret import math def get_primenumber(number):#エラトステネスの篩 prime_list = [] sear...
import sys def enum_div(n): ir=int(n**(0.5))+1 ret=[] for i in range(1,ir): if n%i == 0: ret.append(i) if (i!= 1) & (i*i != n): ret.append(n//i) return ret n=int(eval(input())) ap=list(map(int,input().split())) amin=min(ap) amax=max(ap) ...
77
52
1,717
1,013
import sys def enum_div(n): ir = int(n ** (0.5)) + 1 ret = [] for i in range(1, ir): if n % i == 0: ret.append(i) if (i != 1) & (i * i != n): ret.append(n // i) return ret import math def get_primenumber(number): # エラトステネスの篩 prime_list = [] ...
import sys def enum_div(n): ir = int(n ** (0.5)) + 1 ret = [] for i in range(1, ir): if n % i == 0: ret.append(i) if (i != 1) & (i * i != n): ret.append(n // i) return ret n = int(eval(input())) ap = list(map(int, input().split())) amin = min(ap) amax ...
false
32.467532
[ "-import math", "-", "-", "-def get_primenumber(number): # エラトステネスの篩", "- prime_list = []", "- search_list = list(range(2, number + 1))", "- # search_listの先頭の値が√nの値を超えたら終了", "- while search_list[0] <= math.sqrt(number):", "- # search_listの先頭の値が√nの値を超えたら終了", "- # search_l...
false
0.036312
0.036867
0.984943
[ "s483236984", "s691981783" ]
u591589288
p02767
python
s342103447
s655106516
176
155
38,740
12,764
Accepted
Accepted
11.93
#!/bin/bash ''':' docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \ /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp" exit $? ''' import sys def _i(): return int(sys.stdin.readline().strip()) def _ia(): return [ int(x) for x in sys.stdin.readline().strip().split() ] n = _i() x =...
import numpy as np def main(): _ = eval(input()) x = np.asarray(list(map(int, input().split()))) p = int(np.round(np.average(x))) print((np.sum((x - p) ** 2))) if __name__ == "__main__": main()
21
12
481
221
#!/bin/bash """:' docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \ /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp" exit $? """ import sys def _i(): return int(sys.stdin.readline().strip()) def _ia(): return [int(x) for x in sys.stdin.readline().strip().split()] n = _i() x = s...
import numpy as np def main(): _ = eval(input()) x = np.asarray(list(map(int, input().split()))) p = int(np.round(np.average(x))) print((np.sum((x - p) ** 2))) if __name__ == "__main__": main()
false
42.857143
[ "-#!/bin/bash", "-\"\"\":'", "-docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \\", "- /bin/bash -c \"pypy3 /vo/$(basename $0) < /vo/g.inp\"", "-exit $?", "-\"\"\"", "-import sys", "+import numpy as np", "-def _i():", "- return int(sys.stdin.readline().strip())", "+def...
false
0.119197
0.53278
0.223726
[ "s342103447", "s655106516" ]
u238956837
p02829
python
s354372461
s431183203
20
17
3,060
2,940
Accepted
Accepted
15
import sys a = int(eval(input())) b = int(eval(input())) numbers = [1, 2, 3] for i in numbers: if i != a and i != b: print(i) sys.exit()
import sys a = int(eval(input())) b = int(eval(input())) print((6 - a - b))
11
6
148
68
import sys a = int(eval(input())) b = int(eval(input())) numbers = [1, 2, 3] for i in numbers: if i != a and i != b: print(i) sys.exit()
import sys a = int(eval(input())) b = int(eval(input())) print((6 - a - b))
false
45.454545
[ "-numbers = [1, 2, 3]", "-for i in numbers:", "- if i != a and i != b:", "- print(i)", "- sys.exit()", "+print((6 - a - b))" ]
false
0.184262
0.113503
1.623414
[ "s354372461", "s431183203" ]
u647999897
p03673
python
s742614992
s251568512
390
187
102,016
106,764
Accepted
Accepted
52.05
from collections import deque def solve(): n = int(input()) a = list(map(int, input().split())) deq = deque() for i in range(n): if i % 2 == 0: deq.append(a[i]) else: deq.appendleft(a[i]) ans = list(deq) if n % 2 == 0: print(*an...
from collections import deque def solve(): n = int(eval(input())) A = list(map(int,input().split())) q = deque() for i in range(n): if i % 2 == 0: q.append(A[i]) else: q.appendleft(A[i]) ans = list(q) if n % 2 != 0: ans.reverse(...
20
20
421
381
from collections import deque def solve(): n = int(input()) a = list(map(int, input().split())) deq = deque() for i in range(n): if i % 2 == 0: deq.append(a[i]) else: deq.appendleft(a[i]) ans = list(deq) if n % 2 == 0: print(*ans, sep=" ") el...
from collections import deque def solve(): n = int(eval(input())) A = list(map(int, input().split())) q = deque() for i in range(n): if i % 2 == 0: q.append(A[i]) else: q.appendleft(A[i]) ans = list(q) if n % 2 != 0: ans.reverse() print((*ans...
false
0
[ "- n = int(input())", "- a = list(map(int, input().split()))", "- deq = deque()", "+ n = int(eval(input()))", "+ A = list(map(int, input().split()))", "+ q = deque()", "- deq.append(a[i])", "+ q.append(A[i])", "- deq.appendleft(a[i])", "- ans =...
false
0.040757
0.059529
0.684663
[ "s742614992", "s251568512" ]
u323045245
p02660
python
s458615588
s418835254
281
159
20,364
36,824
Accepted
Accepted
43.42
n=int(eval(input())) def primes_factraizar(n): rn = int(n**0.5) is_prime = [True] * (rn+1) #まずは[1]*n^0.5を用意 is_prime[0] = False is_prime[1] = False for i in range(2, rn + 1): #素数の判定√nまでで十分 if not is_prime[i]: #非素数は無視 continue #continue分はループ中の後続の命令をスキップする ...
n = int(eval(input())) if n == 1: print((0)) exit() def primes_factraizar(n): rn = int(n**0.5) is_prime = [True]*(rn+1) is_prime[0] = False is_prime[1] = False for i in range(2,rn+1): if not is_prime[i]: continue for j in range(i*2,rn+1,i): ...
47
52
997
907
n = int(eval(input())) def primes_factraizar(n): rn = int(n**0.5) is_prime = [True] * (rn + 1) # まずは[1]*n^0.5を用意 is_prime[0] = False is_prime[1] = False for i in range(2, rn + 1): # 素数の判定√nまでで十分 if not is_prime[i]: # 非素数は無視 continue # continue分はループ中の後続の命令をスキップする for...
n = int(eval(input())) if n == 1: print((0)) exit() def primes_factraizar(n): rn = int(n**0.5) is_prime = [True] * (rn + 1) is_prime[0] = False is_prime[1] = False for i in range(2, rn + 1): if not is_prime[i]: continue for j in range(i * 2, rn + 1, i): ...
false
9.615385
[ "+if n == 1:", "+ print((0))", "+ exit()", "- is_prime = [True] * (rn + 1) # まずは[1]*n^0.5を用意", "+ is_prime = [True] * (rn + 1)", "- for i in range(2, rn + 1): # 素数の判定√nまでで十分", "- if not is_prime[i]: # 非素数は無視", "- continue # continue分はループ中の後続の命令をスキップする", "- ...
false
0.117246
0.007648
15.329524
[ "s458615588", "s418835254" ]
u133936772
p02690
python
s677455505
s896948923
79
29
9,120
9,164
Accepted
Accepted
63.29
x=int(eval(input())) for a in range(999): for b in range(-99,999): if a**5-b**5==x: print((a,b)); exit()
x=int(eval(input())) for a in range(120): for b in range(-99,a): if a**5-b**5==x: print((a,b)); exit()
4
4
105
103
x = int(eval(input())) for a in range(999): for b in range(-99, 999): if a**5 - b**5 == x: print((a, b)) exit()
x = int(eval(input())) for a in range(120): for b in range(-99, a): if a**5 - b**5 == x: print((a, b)) exit()
false
0
[ "-for a in range(999):", "- for b in range(-99, 999):", "+for a in range(120):", "+ for b in range(-99, a):" ]
false
0.05778
0.042617
1.355805
[ "s677455505", "s896948923" ]
u340781749
p02604
python
s482197646
s339976577
1,981
907
96,592
96,844
Accepted
Accepted
54.22
import os import sys import numpy as np def solve(n, kd, precalc_x, precalc_y): ans = np.full(n + 1, 10 ** 18, dtype=np.int64) for bit in range(1 << n): k = kd[bit] v = bit while v: ans[k] = min(ans[k], np.minimum(precalc_x[v], precalc_y[v ^ bit]).sum()) ...
import os import sys import numpy as np def solve(n, precalc_x, precalc_y): ans = np.full(n + 1, 10 ** 18, dtype=np.int64) def get_cost(v, bit): cost = 0 pcx = precalc_x[v] pcy = precalc_y[v ^ bit] for i in range(n): if v & (1 << i): ...
50
62
1,402
1,714
import os import sys import numpy as np def solve(n, kd, precalc_x, precalc_y): ans = np.full(n + 1, 10**18, dtype=np.int64) for bit in range(1 << n): k = kd[bit] v = bit while v: ans[k] = min(ans[k], np.minimum(precalc_x[v], precalc_y[v ^ bit]).sum()) v = (v - ...
import os import sys import numpy as np def solve(n, precalc_x, precalc_y): ans = np.full(n + 1, 10**18, dtype=np.int64) def get_cost(v, bit): cost = 0 pcx = precalc_x[v] pcy = precalc_y[v ^ bit] for i in range(n): if v & (1 << i): continue ...
false
19.354839
[ "-def solve(n, kd, precalc_x, precalc_y):", "+def solve(n, precalc_x, precalc_y):", "+", "+ def get_cost(v, bit):", "+ cost = 0", "+ pcx = precalc_x[v]", "+ pcy = precalc_y[v ^ bit]", "+ for i in range(n):", "+ if v & (1 << i):", "+ continue...
false
0.447796
0.298455
1.500382
[ "s482197646", "s339976577" ]
u119148115
p02834
python
s969054651
s038182123
253
231
89,080
88,876
Accepted
Accepted
8.7
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし def ...
import sys def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) N,u,v = MI() Graph = [[] for _ in range(N+1)] for i in range(N-1): a,b = MI() Graph[a].append(b) Graph[b].append(a) dist_T = [-1]*(N+1) # uからの最短距離 dist_A = [-1]*(N+1) # vからの最短距離 dist_T[u] = 0 dist_A[v] = 0 ...
46
38
1,184
797
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり def LI2(): return list(map(int, sys.stdin.readline().r...
import sys def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) N, u, v = MI() Graph = [[] for _ in range(N + 1)] for i in range(N - 1): a, b = MI() Graph[a].append(b) Graph[b].append(a) dist_T = [-1] * (N + 1) # uからの最短距離 dist_A = [-1] * (N + 1) # vからの最短距離 dist_T[u] = 0 dist_A[v]...
false
17.391304
[ "-", "-sys.setrecursionlimit(10**7)", "-", "-", "-def I():", "- return int(sys.stdin.readline().rstrip())", "-", "-", "-def LI():", "- return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり", "-", "-", "-def LI2():", "- return list(map(int, sys.stdin.readline().rstri...
false
0.049229
0.115272
0.427064
[ "s969054651", "s038182123" ]
u767664985
p03999
python
s556595167
s495171391
185
19
39,792
3,064
Accepted
Accepted
89.73
S = eval(input()) ans = 0 for i in range(2 ** (len(S) - 1)): bit = bin(i)[2:].rjust(len(S) - 1, "0") start = 0 tmp = 0 for j in range(len(bit)): if bit[j] == "1": tmp += int(S[start: j + 1]) start = j + 1 if j == len(bit) - 1: tmp += int(S[start:]) ans += tmp print(ans)
S = eval(input()) ans = 0 # 値を入れられる場所がlen(S)-1箇所 for i in range(pow(2, len(S)-1)): bit = bin(i)[2:].zfill(len(S)-1) ind = 0 res = 0 for j in range(len(bit)): if bit[j] == "1": res += int(S[ind:j+1]) ind = j+1 res += int(S[ind:]) ans += res print(a...
14
16
296
318
S = eval(input()) ans = 0 for i in range(2 ** (len(S) - 1)): bit = bin(i)[2:].rjust(len(S) - 1, "0") start = 0 tmp = 0 for j in range(len(bit)): if bit[j] == "1": tmp += int(S[start : j + 1]) start = j + 1 if j == len(bit) - 1: tmp += int(S[start:]) ...
S = eval(input()) ans = 0 # 値を入れられる場所がlen(S)-1箇所 for i in range(pow(2, len(S) - 1)): bit = bin(i)[2:].zfill(len(S) - 1) ind = 0 res = 0 for j in range(len(bit)): if bit[j] == "1": res += int(S[ind : j + 1]) ind = j + 1 res += int(S[ind:]) ans += res print(ans)
false
12.5
[ "-for i in range(2 ** (len(S) - 1)):", "- bit = bin(i)[2:].rjust(len(S) - 1, \"0\")", "- start = 0", "- tmp = 0", "+# 値を入れられる場所がlen(S)-1箇所", "+for i in range(pow(2, len(S) - 1)):", "+ bit = bin(i)[2:].zfill(len(S) - 1)", "+ ind = 0", "+ res = 0", "- tmp += int(S[start ...
false
0.06975
0.046932
1.486179
[ "s556595167", "s495171391" ]
u561358604
p02713
python
s353356510
s944090749
1,135
537
9,108
9,176
Accepted
Accepted
52.69
from math import gcd k = int(eval(input())) s = 0 for x in range(1, k + 1): for y in range(1, k + 1): t = gcd(x, y) for z in range(1, k + 1): s += gcd(t, z) print(s)
from math import gcd k = int(eval(input())) s = 0 for x in range(1, k + 1): for y in range(1, k + 1): t = gcd(x, y) if t == 1: s += k continue for z in range(1, k + 1): s += gcd(t, z) print(s)
9
12
199
261
from math import gcd k = int(eval(input())) s = 0 for x in range(1, k + 1): for y in range(1, k + 1): t = gcd(x, y) for z in range(1, k + 1): s += gcd(t, z) print(s)
from math import gcd k = int(eval(input())) s = 0 for x in range(1, k + 1): for y in range(1, k + 1): t = gcd(x, y) if t == 1: s += k continue for z in range(1, k + 1): s += gcd(t, z) print(s)
false
25
[ "+ if t == 1:", "+ s += k", "+ continue" ]
false
0.121529
0.070167
1.73199
[ "s353356510", "s944090749" ]
u073852194
p03032
python
s313445527
s479635929
116
32
3,436
3,064
Accepted
Accepted
72.41
import heapq from collections import deque from copy import deepcopy n,k = list(map(int,input().split())) U = deque(list(map(int,input().split()))) Max = -10**9 for a in range(min(n,k)+1): for b in range(min(n,k)+1-a): V = deepcopy(U) Heap = [] heapq.heapify(Heap) if a >= ...
N,K = list(map(int,input().split())) V = list(map(int,input().split())) cum = [0] rcum = [0] for i in range(N): cum.append(cum[-1]+V[i]) rcum.append(rcum[-1]+V[-1-i]) ans = 0 for i in range(N+1): for j in range(N+1): if i+j > min(N,K): continue value = cum...
37
36
755
654
import heapq from collections import deque from copy import deepcopy n, k = list(map(int, input().split())) U = deque(list(map(int, input().split()))) Max = -(10**9) for a in range(min(n, k) + 1): for b in range(min(n, k) + 1 - a): V = deepcopy(U) Heap = [] heapq.heapify(Heap) if a ...
N, K = list(map(int, input().split())) V = list(map(int, input().split())) cum = [0] rcum = [0] for i in range(N): cum.append(cum[-1] + V[i]) rcum.append(rcum[-1] + V[-1 - i]) ans = 0 for i in range(N + 1): for j in range(N + 1): if i + j > min(N, K): continue value = cum[i] + rc...
false
2.702703
[ "-import heapq", "-from collections import deque", "-from copy import deepcopy", "-", "-n, k = list(map(int, input().split()))", "-U = deque(list(map(int, input().split())))", "-Max = -(10**9)", "-for a in range(min(n, k) + 1):", "- for b in range(min(n, k) + 1 - a):", "- V = deepcopy(U)...
false
0.03785
0.074382
0.508856
[ "s313445527", "s479635929" ]
u034128150
p02889
python
s662830344
s505027822
1,187
838
49,632
45,440
Accepted
Accepted
29.4
from scipy.sparse import csr_matrix from scipy.sparse.csgraph import dijkstra N, M, L = list(map(int, input().split())) start = [] goal = [] cost = [] for _ in range(M): A, B, C = list(map(int, input().split())) A -= 1 B -= 1 start.append(A) goal.append(B) cost.append(C) sta...
from scipy.sparse import csr_matrix from scipy.sparse.csgraph import floyd_warshall N, M, L = list(map(int, input().split())) start = [] goal = [] cost = [] for _ in range(M): A, B, C = list(map(int, input().split())) A -= 1 B -= 1 start.append(A) goal.append(B) cost.append(C) ...
32
33
766
817
from scipy.sparse import csr_matrix from scipy.sparse.csgraph import dijkstra N, M, L = list(map(int, input().split())) start = [] goal = [] cost = [] for _ in range(M): A, B, C = list(map(int, input().split())) A -= 1 B -= 1 start.append(A) goal.append(B) cost.append(C) start.append(B) ...
from scipy.sparse import csr_matrix from scipy.sparse.csgraph import floyd_warshall N, M, L = list(map(int, input().split())) start = [] goal = [] cost = [] for _ in range(M): A, B, C = list(map(int, input().split())) A -= 1 B -= 1 start.append(A) goal.append(B) cost.append(C) start.append(...
false
3.030303
[ "-from scipy.sparse.csgraph import dijkstra", "+from scipy.sparse.csgraph import floyd_warshall", "-can_reach_with_L = dijkstra(graph, directed=False, limit=L)", "-ans = dijkstra(can_reach_with_L, directed=False, unweighted=True)", "+can_reach_with_L = floyd_warshall(graph, directed=False)", "+can_reach_w...
false
0.326759
0.390447
0.836884
[ "s662830344", "s505027822" ]
u888933875
p02847
python
s214882016
s866636380
29
26
9,104
8,992
Accepted
Accepted
10.34
s=eval(input()) dict1={7:'SUN',6:'MON',5:'TUE',4:'WED',3:'THU',2:'FRI',1:'SAT'} keys = [k for k, v in list(dict1.items()) if v == s] print((keys[0]))
s = ["SUN","MON","TUE","WED","THU","FRI","SAT"].index(eval(input())) print((7-s))
4
2
138
74
s = eval(input()) dict1 = {7: "SUN", 6: "MON", 5: "TUE", 4: "WED", 3: "THU", 2: "FRI", 1: "SAT"} keys = [k for k, v in list(dict1.items()) if v == s] print((keys[0]))
s = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"].index(eval(input())) print((7 - s))
false
50
[ "-s = eval(input())", "-dict1 = {7: \"SUN\", 6: \"MON\", 5: \"TUE\", 4: \"WED\", 3: \"THU\", 2: \"FRI\", 1: \"SAT\"}", "-keys = [k for k, v in list(dict1.items()) if v == s]", "-print((keys[0]))", "+s = [\"SUN\", \"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\"].index(eval(input()))", "+print((7 - s))...
false
0.043283
0.097789
0.442616
[ "s214882016", "s866636380" ]
u729133443
p03834
python
s043936534
s520022334
165
25
38,384
9,020
Accepted
Accepted
84.85
print((input().replace(',',' ')))
print((*input().split(',')))
1
1
31
26
print((input().replace(",", " ")))
print((*input().split(",")))
false
0
[ "-print((input().replace(\",\", \" \")))", "+print((*input().split(\",\")))" ]
false
0.044809
0.041356
1.083479
[ "s043936534", "s520022334" ]
u888092736
p03645
python
s863869103
s628779006
909
709
89,184
89,184
Accepted
Accepted
22
N, M = list(map(int, input().split())) g = {i: set() for i in range(1, N + 1)} for _ in range(M): A, B = list(map(int, input().split())) g[A].add(B) g[B].add(A) if g[1].intersection(g[N]): print('POSSIBLE') else: print('IMPOSSIBLE')
import sys def input(): return sys.stdin.readline().strip() N, M = list(map(int, input().split())) g = {i: set() for i in range(1, N + 1)} for _ in range(M): A, B = list(map(int, input().split())) if A in (1, N) or B in (1, N): g[A].add(B) g[B].add(A) if g[1].intersection...
11
19
252
371
N, M = list(map(int, input().split())) g = {i: set() for i in range(1, N + 1)} for _ in range(M): A, B = list(map(int, input().split())) g[A].add(B) g[B].add(A) if g[1].intersection(g[N]): print("POSSIBLE") else: print("IMPOSSIBLE")
import sys def input(): return sys.stdin.readline().strip() N, M = list(map(int, input().split())) g = {i: set() for i in range(1, N + 1)} for _ in range(M): A, B = list(map(int, input().split())) if A in (1, N) or B in (1, N): g[A].add(B) g[B].add(A) if g[1].intersection(g[N]): prin...
false
42.105263
[ "+import sys", "+", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "- g[A].add(B)", "- g[B].add(A)", "+ if A in (1, N) or B in (1, N):", "+ g[A].add(B)", "+ g[B].add(A)" ]
false
0.039194
0.041795
0.93779
[ "s863869103", "s628779006" ]
u516272298
p03370
python
s832721712
s216633469
216
17
3,060
3,060
Accepted
Accepted
92.13
n,x = list(map(int,input().split())) l = [] s = 0 for i in range(n): l.append(int(eval(input()))) s += l[i] for j in range(0,100000): if (x-s) == 0: print(n) break elif ((x-s)/(min(l)*(j+1))) < 1: print((n+j)) break
n,x = list(map(int,input().split())) l = [] s = 0 for i in range(n): l.append(int(eval(input()))) s += l[i] print((int(n+(x-s)/min(l))))
14
7
267
136
n, x = list(map(int, input().split())) l = [] s = 0 for i in range(n): l.append(int(eval(input()))) s += l[i] for j in range(0, 100000): if (x - s) == 0: print(n) break elif ((x - s) / (min(l) * (j + 1))) < 1: print((n + j)) break
n, x = list(map(int, input().split())) l = [] s = 0 for i in range(n): l.append(int(eval(input()))) s += l[i] print((int(n + (x - s) / min(l))))
false
50
[ "-for j in range(0, 100000):", "- if (x - s) == 0:", "- print(n)", "- break", "- elif ((x - s) / (min(l) * (j + 1))) < 1:", "- print((n + j))", "- break", "+print((int(n + (x - s) / min(l))))" ]
false
0.084059
0.036593
2.297144
[ "s832721712", "s216633469" ]
u013756322
p03126
python
s248063714
s974353080
19
17
3,064
3,060
Accepted
Accepted
10.53
N, M = list(map(int, input().split())) preferances = [list(map(int, input().split()))[1:] for _ in range(N)] all_kind_of_food = [i for i in range(1, M + 1)] check_for_foods = [i for i in range(1, M + 1)] for i in range(N): for j in range(M): if all_kind_of_food[j] in check_for_foods and (not all_kind_of_foo...
N, _ = list(map(int, input().split())) preferances = [set((input().split())[1:]) for _ in range(N)] for i in range(N - 1): preferances[i + 1] = preferances[i] & preferances[i + 1] print((len(preferances[-1])))
9
5
419
208
N, M = list(map(int, input().split())) preferances = [list(map(int, input().split()))[1:] for _ in range(N)] all_kind_of_food = [i for i in range(1, M + 1)] check_for_foods = [i for i in range(1, M + 1)] for i in range(N): for j in range(M): if all_kind_of_food[j] in check_for_foods and ( not al...
N, _ = list(map(int, input().split())) preferances = [set((input().split())[1:]) for _ in range(N)] for i in range(N - 1): preferances[i + 1] = preferances[i] & preferances[i + 1] print((len(preferances[-1])))
false
44.444444
[ "-N, M = list(map(int, input().split()))", "-preferances = [list(map(int, input().split()))[1:] for _ in range(N)]", "-all_kind_of_food = [i for i in range(1, M + 1)]", "-check_for_foods = [i for i in range(1, M + 1)]", "-for i in range(N):", "- for j in range(M):", "- if all_kind_of_food[j] i...
false
0.069709
0.068719
1.014415
[ "s248063714", "s974353080" ]
u587193722
p02413
python
s488934337
s918334987
40
30
8,252
7,744
Accepted
Accepted
25
h, w = [int(i) for i in input().split()] date = [[int(q) for q in input().split()] for e in range(h)] date2=[] date3=[] for r in range(0, h): for t in range(0, w): print(date[r][t], end=' ') print(sum(date[r])) for k in range(0,w): for j in range(0,h): date2.append(date[j][k]) fo...
r, c =[int(i) for i in input().split()] date =[] sum_row = [0] * (c + 1) for ri in range(r): date.append([int(i) for i in input().split()]) date[ri].append(sum(date[ri])) print((" ".join([str(d) for d in date[ri]]))) for ci in range(c + 1): sum_row[ci] += date[ri][ci] print((" ".j...
19
13
453
348
h, w = [int(i) for i in input().split()] date = [[int(q) for q in input().split()] for e in range(h)] date2 = [] date3 = [] for r in range(0, h): for t in range(0, w): print(date[r][t], end=" ") print(sum(date[r])) for k in range(0, w): for j in range(0, h): date2.append(date[j][k]) for n in...
r, c = [int(i) for i in input().split()] date = [] sum_row = [0] * (c + 1) for ri in range(r): date.append([int(i) for i in input().split()]) date[ri].append(sum(date[ri])) print((" ".join([str(d) for d in date[ri]]))) for ci in range(c + 1): sum_row[ci] += date[ri][ci] print((" ".join([str(s) f...
false
31.578947
[ "-h, w = [int(i) for i in input().split()]", "-date = [[int(q) for q in input().split()] for e in range(h)]", "-date2 = []", "-date3 = []", "-for r in range(0, h):", "- for t in range(0, w):", "- print(date[r][t], end=\" \")", "- print(sum(date[r]))", "-for k in range(0, w):", "- f...
false
0.047016
0.047695
0.985755
[ "s488934337", "s918334987" ]
u958141542
p03380
python
s440908351
s876620889
99
63
14,428
14,432
Accepted
Accepted
36.36
n = int(eval(input())) a = list(map(int, input().split())) a.sort() N = a[-1] a.pop() li = [abs(N/2 - k) for k in a] index = li.index(min(li)) print(("{0} {1}".format(N, a[index])))
n = int(eval(input())) a = list(map(int, input().split())) N = max(a) a.remove(N) N2 = N/2 li = [abs(N2 - k) for k in a] index = li.index(min(li)) print(("{0} {1}".format(N, a[index])))
12
11
189
191
n = int(eval(input())) a = list(map(int, input().split())) a.sort() N = a[-1] a.pop() li = [abs(N / 2 - k) for k in a] index = li.index(min(li)) print(("{0} {1}".format(N, a[index])))
n = int(eval(input())) a = list(map(int, input().split())) N = max(a) a.remove(N) N2 = N / 2 li = [abs(N2 - k) for k in a] index = li.index(min(li)) print(("{0} {1}".format(N, a[index])))
false
8.333333
[ "-a.sort()", "-N = a[-1]", "-a.pop()", "-li = [abs(N / 2 - k) for k in a]", "+N = max(a)", "+a.remove(N)", "+N2 = N / 2", "+li = [abs(N2 - k) for k in a]" ]
false
0.038387
0.036986
1.037876
[ "s440908351", "s876620889" ]
u777283665
p03578
python
s497962717
s980813511
318
291
56,788
67,412
Accepted
Accepted
8.49
n = int(eval(input())) d = list(map(int, input().split())) m = int(eval(input())) t = list(map(int, input().split())) x = dict() for i in d: x[i] = x.get(i, 0) + 1 y = dict() for i in t: y[i] = y.get(i, 0) + 1 for i, j in list(y.items()): if x.get(i, 0) < j: print("NO") ex...
n = int(eval(input())) x = dict() for i in input().split(): x[i] = x.get(i, 0) + 1 m = int(eval(input())) y = dict() for i in input().split(): y[i] = y.get(i, 0) + 1 for i, j in list(y.items()): if x.get(i, 0) < j: print("NO") exit() print("YES")
18
17
321
276
n = int(eval(input())) d = list(map(int, input().split())) m = int(eval(input())) t = list(map(int, input().split())) x = dict() for i in d: x[i] = x.get(i, 0) + 1 y = dict() for i in t: y[i] = y.get(i, 0) + 1 for i, j in list(y.items()): if x.get(i, 0) < j: print("NO") exit() print("YES")
n = int(eval(input())) x = dict() for i in input().split(): x[i] = x.get(i, 0) + 1 m = int(eval(input())) y = dict() for i in input().split(): y[i] = y.get(i, 0) + 1 for i, j in list(y.items()): if x.get(i, 0) < j: print("NO") exit() print("YES")
false
5.555556
[ "-d = list(map(int, input().split()))", "+x = dict()", "+for i in input().split():", "+ x[i] = x.get(i, 0) + 1", "-t = list(map(int, input().split()))", "-x = dict()", "-for i in d:", "- x[i] = x.get(i, 0) + 1", "-for i in t:", "+for i in input().split():" ]
false
0.053409
0.043429
1.229815
[ "s497962717", "s980813511" ]
u492910842
p02819
python
s761703942
s907954320
176
70
39,664
62,556
Accepted
Accepted
60.23
import math import sys x = int(eval(input())) flg = 0 if x == 2: print(x) sys.exit() for i in range(x,100005): flg = 0 for j in range(2,int(math.sqrt(i))+1): if i%j == 0: flg = 1 if flg == 0 and j == int(math.sqrt(i)): print(i) sys.exit() continue
import sys import math x=int(eval(input())) while True: for i in range(2,int(math.sqrt(x))): if x%i==0: break else: print(x) break x+=1
19
12
306
165
import math import sys x = int(eval(input())) flg = 0 if x == 2: print(x) sys.exit() for i in range(x, 100005): flg = 0 for j in range(2, int(math.sqrt(i)) + 1): if i % j == 0: flg = 1 if flg == 0 and j == int(math.sqrt(i)): print(i) sys.exit() ...
import sys import math x = int(eval(input())) while True: for i in range(2, int(math.sqrt(x))): if x % i == 0: break else: print(x) break x += 1
false
36.842105
[ "+import sys", "-import sys", "-flg = 0", "-if x == 2:", "- print(x)", "- sys.exit()", "-for i in range(x, 100005):", "- flg = 0", "- for j in range(2, int(math.sqrt(i)) + 1):", "- if i % j == 0:", "- flg = 1", "- if flg == 0 and j == int(math.sqrt(i)):", ...
false
0.047901
0.037418
1.280169
[ "s761703942", "s907954320" ]
u759412327
p03494
python
s081586578
s045305309
150
114
12,396
27,044
Accepted
Accepted
24
import numpy as np N = int(eval(input())) a = np.array(input().split(),dtype=np.int32) z = 0 while (a%2==0).all(): a//=2 z+=1 print(z)
import numpy as np N = int(eval(input())) A = np.array(input().split(),dtype=np.int32) a = 0 while (A%2==0).all(): A//=2 a+=1 print(a)
10
10
144
143
import numpy as np N = int(eval(input())) a = np.array(input().split(), dtype=np.int32) z = 0 while (a % 2 == 0).all(): a //= 2 z += 1 print(z)
import numpy as np N = int(eval(input())) A = np.array(input().split(), dtype=np.int32) a = 0 while (A % 2 == 0).all(): A //= 2 a += 1 print(a)
false
0
[ "-a = np.array(input().split(), dtype=np.int32)", "-z = 0", "-while (a % 2 == 0).all():", "- a //= 2", "- z += 1", "-print(z)", "+A = np.array(input().split(), dtype=np.int32)", "+a = 0", "+while (A % 2 == 0).all():", "+ A //= 2", "+ a += 1", "+print(a)" ]
false
0.848741
0.275962
3.075572
[ "s081586578", "s045305309" ]
u297574184
p02802
python
s867763249
s379061443
281
188
4,596
10,344
Accepted
Accepted
33.1
N, M = list(map(int, input().split())) penalty = 0 nums = [0] * N isACs = [False] * N for _ in range(M): p, ss = input().split() p = int(p) - 1 if ss == 'WA': nums[p] += 1 else: if not isACs[p]: penalty += nums[p] isACs[p] = True numAC = isACs.count(T...
N, M = list(map(int, input().split())) isACs = [0] * N numWAs = [0] * N numPenalty = 0 for _ in range(M): p, res = input().split() p = int(p) - 1 if res == 'AC': if not isACs[p]: numPenalty += numWAs[p] isACs[p] = 1 else: numWAs[p] += 1 numAC = sum(is...
17
17
342
345
N, M = list(map(int, input().split())) penalty = 0 nums = [0] * N isACs = [False] * N for _ in range(M): p, ss = input().split() p = int(p) - 1 if ss == "WA": nums[p] += 1 else: if not isACs[p]: penalty += nums[p] isACs[p] = True numAC = isACs.count(True) print((numAC...
N, M = list(map(int, input().split())) isACs = [0] * N numWAs = [0] * N numPenalty = 0 for _ in range(M): p, res = input().split() p = int(p) - 1 if res == "AC": if not isACs[p]: numPenalty += numWAs[p] isACs[p] = 1 else: numWAs[p] += 1 numAC = sum(isACs) print((numAC...
false
0
[ "-penalty = 0", "-nums = [0] * N", "-isACs = [False] * N", "+isACs = [0] * N", "+numWAs = [0] * N", "+numPenalty = 0", "- p, ss = input().split()", "+ p, res = input().split()", "- if ss == \"WA\":", "- nums[p] += 1", "+ if res == \"AC\":", "+ if not isACs[p]:", "+ ...
false
0.041828
0.041091
1.017951
[ "s867763249", "s379061443" ]
u057109575
p03061
python
s195462194
s075940795
138
106
16,152
86,236
Accepted
Accepted
23.19
from fractions import gcd from itertools import accumulate N = int(eval(input())) a = list(map(int, input().split())) b = list(accumulate([0] + a, gcd)) c = list(accumulate([0] + a[::-1], gcd)) l = list(gcd(s, t) for s, t in zip(b[:-1], c[::-1][1:])) print((max(l)))
from math import gcd N = int(eval(input())) X = list(map(int, input().split())) left = [0] * (N + 2) right = [0] * (N + 2) for i in range(N): left[i + 1] = gcd(left[i], X[i]) for i in reversed(list(range(N))): right[i + 1] = gcd(right[i + 2], X[i]) ans = 1 for i in range(N): ans = max...
10
20
270
356
from fractions import gcd from itertools import accumulate N = int(eval(input())) a = list(map(int, input().split())) b = list(accumulate([0] + a, gcd)) c = list(accumulate([0] + a[::-1], gcd)) l = list(gcd(s, t) for s, t in zip(b[:-1], c[::-1][1:])) print((max(l)))
from math import gcd N = int(eval(input())) X = list(map(int, input().split())) left = [0] * (N + 2) right = [0] * (N + 2) for i in range(N): left[i + 1] = gcd(left[i], X[i]) for i in reversed(list(range(N))): right[i + 1] = gcd(right[i + 2], X[i]) ans = 1 for i in range(N): ans = max(ans, gcd(left[i], rig...
false
50
[ "-from fractions import gcd", "-from itertools import accumulate", "+from math import gcd", "-a = list(map(int, input().split()))", "-b = list(accumulate([0] + a, gcd))", "-c = list(accumulate([0] + a[::-1], gcd))", "-l = list(gcd(s, t) for s, t in zip(b[:-1], c[::-1][1:]))", "-print((max(l)))", "+X...
false
0.052363
0.047431
1.103994
[ "s195462194", "s075940795" ]
u050708958
p03317
python
s773695144
s489055603
43
17
13,812
3,060
Accepted
Accepted
60.47
import math n, k = list(map(int, input().split())) [int(i) for i in input().split()] print((math.ceil((n-k) / (k - 1) + 1)))
import math n, k = list(map(int, input().split())) print((math.ceil((n-k) / (k - 1) + 1)))
5
3
121
85
import math n, k = list(map(int, input().split())) [int(i) for i in input().split()] print((math.ceil((n - k) / (k - 1) + 1)))
import math n, k = list(map(int, input().split())) print((math.ceil((n - k) / (k - 1) + 1)))
false
40
[ "-[int(i) for i in input().split()]" ]
false
0.069888
0.059874
1.167252
[ "s773695144", "s489055603" ]
u150984829
p02268
python
s453910458
s451429905
270
90
16,720
16,736
Accepted
Accepted
66.67
def binarySearch(key): left = 0 right = n while left < right: mid = (left + right) // 2 if key == A[mid]: return 1 if key > A[mid]: left = mid + 1 elif key < A[mid]: right = mid return 0 n = int(eval(input())) A = list(map(int,input().split())) eval(input()) ...
import bisect n = int(eval(input())) A = list(map(int, input().split())) eval(input()) k = 0 for e in map(int, input().split()): i = bisect.bisect_left(A, e) if i < n and A[i] == e: k += 1 print(k)
14
9
371
203
def binarySearch(key): left = 0 right = n while left < right: mid = (left + right) // 2 if key == A[mid]: return 1 if key > A[mid]: left = mid + 1 elif key < A[mid]: right = mid return 0 n = int(eval(input())) A = list(map(int, input(...
import bisect n = int(eval(input())) A = list(map(int, input().split())) eval(input()) k = 0 for e in map(int, input().split()): i = bisect.bisect_left(A, e) if i < n and A[i] == e: k += 1 print(k)
false
35.714286
[ "-def binarySearch(key):", "- left = 0", "- right = n", "- while left < right:", "- mid = (left + right) // 2", "- if key == A[mid]:", "- return 1", "- if key > A[mid]:", "- left = mid + 1", "- elif key < A[mid]:", "- right = ...
false
0.081051
0.066922
1.211125
[ "s453910458", "s451429905" ]
u906501980
p02744
python
s631111185
s442457976
211
195
21,852
21,816
Accepted
Accepted
7.58
class Node: __slots__ = ["string", "index"] def __init__(self, string, index): self.string = string self.index = index def get_children(self): s = "abcdefghij" parent = self.string out = [None]*(self.index+1) for i, c in enumerate(s[:self.index]): ...
class Node: __slots__ = ["string", "index"] def __init__(self, string, index): self.string = string self.index = index def get_children(self): parent = self.string out = [None]*(self.index+1) for i, c in enumerate(s[:self.index]): out[i] = Node(...
28
28
784
780
class Node: __slots__ = ["string", "index"] def __init__(self, string, index): self.string = string self.index = index def get_children(self): s = "abcdefghij" parent = self.string out = [None] * (self.index + 1) for i, c in enumerate(s[: self.index]): ...
class Node: __slots__ = ["string", "index"] def __init__(self, string, index): self.string = string self.index = index def get_children(self): parent = self.string out = [None] * (self.index + 1) for i, c in enumerate(s[: self.index]): out[i] = Node(pare...
false
0
[ "- s = \"abcdefghij\"", "+ s = \"abcdefghij\"" ]
false
0.044684
0.113921
0.392234
[ "s631111185", "s442457976" ]
u471214054
p02729
python
s522938408
s981500541
26
17
3,060
2,940
Accepted
Accepted
34.62
N, M = list(map(int, input().split())) ball_numbers = [2 * i for i in range(N)] ball_numbers.extend([2 * i + 1 for i in range(M)]) count = 0 for i, num1 in enumerate(ball_numbers): for j, num2 in enumerate(ball_numbers): if i == j: continue if (num1 + num2) % 2 == 0: ...
from math import factorial N, M = list(map(int, input().split())) def comb(n, r): if n - r < 0: return 0 else: return factorial(n) // (factorial(n - r) * factorial(r)) print((comb(N, 2) + comb(M, 2)))
13
11
348
229
N, M = list(map(int, input().split())) ball_numbers = [2 * i for i in range(N)] ball_numbers.extend([2 * i + 1 for i in range(M)]) count = 0 for i, num1 in enumerate(ball_numbers): for j, num2 in enumerate(ball_numbers): if i == j: continue if (num1 + num2) % 2 == 0: count +=...
from math import factorial N, M = list(map(int, input().split())) def comb(n, r): if n - r < 0: return 0 else: return factorial(n) // (factorial(n - r) * factorial(r)) print((comb(N, 2) + comb(M, 2)))
false
15.384615
[ "+from math import factorial", "+", "-ball_numbers = [2 * i for i in range(N)]", "-ball_numbers.extend([2 * i + 1 for i in range(M)])", "-count = 0", "-for i, num1 in enumerate(ball_numbers):", "- for j, num2 in enumerate(ball_numbers):", "- if i == j:", "- continue", "- ...
false
0.089444
0.036965
2.419719
[ "s522938408", "s981500541" ]
u908651435
p02417
python
s447144502
s733786290
40
20
6,672
5,564
Accepted
Accepted
50
import sys, string lines = [] for line in sys.stdin: lines.append(line) text = ''.join(lines).lower() for char in string.ascii_lowercase: print(("{} : {}".format(char, text.count(char))))
a='' while True: try: str = input().lower() a+=str except: break for i in range(97, 97 + 26): count = 0 for j in a: if chr(i) == j: count += 1 print((chr(i), ':', count))
10
13
213
245
import sys, string lines = [] for line in sys.stdin: lines.append(line) text = "".join(lines).lower() for char in string.ascii_lowercase: print(("{} : {}".format(char, text.count(char))))
a = "" while True: try: str = input().lower() a += str except: break for i in range(97, 97 + 26): count = 0 for j in a: if chr(i) == j: count += 1 print((chr(i), ":", count))
false
23.076923
[ "-import sys, string", "-", "-lines = []", "-for line in sys.stdin:", "- lines.append(line)", "-text = \"\".join(lines).lower()", "-for char in string.ascii_lowercase:", "- print((\"{} : {}\".format(char, text.count(char))))", "+a = \"\"", "+while True:", "+ try:", "+ str = inp...
false
0.038699
0.0336
1.151758
[ "s447144502", "s733786290" ]
u460245024
p03137
python
s879476275
s169620413
112
95
13,968
13,960
Accepted
Accepted
15.18
import sys N, M = list(map(int, input().split())) if N >= M: print((0)) sys.exit(0) X = list(map(int, input().split())) X.sort() distance_list = [] for i in range(M-1): distance_list.append(X[i+1] - X[i]) distance_list.sort(reverse=True) print((X[-1] - X[0] - sum(distance_list[:N-1])))
import sys N, M = list(map(int, input().split())) if N >= M: print((0)) sys.exit(0) X = list(map(int, input().split())) X.sort() distance_list = [b - a for a, b in zip(X,X[1:])] distance_list.sort() print((sum(distance_list[:M-N])))
16
14
308
248
import sys N, M = list(map(int, input().split())) if N >= M: print((0)) sys.exit(0) X = list(map(int, input().split())) X.sort() distance_list = [] for i in range(M - 1): distance_list.append(X[i + 1] - X[i]) distance_list.sort(reverse=True) print((X[-1] - X[0] - sum(distance_list[: N - 1])))
import sys N, M = list(map(int, input().split())) if N >= M: print((0)) sys.exit(0) X = list(map(int, input().split())) X.sort() distance_list = [b - a for a, b in zip(X, X[1:])] distance_list.sort() print((sum(distance_list[: M - N])))
false
12.5
[ "-distance_list = []", "-for i in range(M - 1):", "- distance_list.append(X[i + 1] - X[i])", "-distance_list.sort(reverse=True)", "-print((X[-1] - X[0] - sum(distance_list[: N - 1])))", "+distance_list = [b - a for a, b in zip(X, X[1:])]", "+distance_list.sort()", "+print((sum(distance_list[: M - N...
false
0.03278
0.03544
0.924942
[ "s879476275", "s169620413" ]
u064246852
p03287
python
s398434917
s503950254
109
95
19,364
16,808
Accepted
Accepted
12.84
import itertools import collections N,M = list(map(int,input().split())) A = list(map(int,input().split())) B = [0] + list(itertools.accumulate(A)) d = collections.defaultdict(int) for i in range(N+1): d[B[i]%M] += 1 d = list(d.items()) ans = 0 for i in d: ans += i[1]*(i[1]-1)//2 print(ans)
import itertools import collections N,M = list(map(int,input().split())) A = list(map(int,input().split())) B = [0] + list(itertools.accumulate(A)) d = collections.defaultdict(int) for i in B: d[i%M] += 1 d = list(d.values()) ans = 0 for i in d: ans += i*(i-1)//2 print(ans)
13
13
305
288
import itertools import collections N, M = list(map(int, input().split())) A = list(map(int, input().split())) B = [0] + list(itertools.accumulate(A)) d = collections.defaultdict(int) for i in range(N + 1): d[B[i] % M] += 1 d = list(d.items()) ans = 0 for i in d: ans += i[1] * (i[1] - 1) // 2 print(ans)
import itertools import collections N, M = list(map(int, input().split())) A = list(map(int, input().split())) B = [0] + list(itertools.accumulate(A)) d = collections.defaultdict(int) for i in B: d[i % M] += 1 d = list(d.values()) ans = 0 for i in d: ans += i * (i - 1) // 2 print(ans)
false
0
[ "-for i in range(N + 1):", "- d[B[i] % M] += 1", "-d = list(d.items())", "+for i in B:", "+ d[i % M] += 1", "+d = list(d.values())", "- ans += i[1] * (i[1] - 1) // 2", "+ ans += i * (i - 1) // 2" ]
false
0.066473
0.038229
1.738829
[ "s398434917", "s503950254" ]
u608088992
p04000
python
s949505386
s141753602
2,113
1,589
166,500
166,896
Accepted
Accepted
24.8
H, W, N = list(map(int, input().split())) Dic = {} for i in range(N): a, b = list(map(int, input().split())) for j in range(3): for k in range(3): if 1 <= a-j <= H-2 and 1 <= b-k <= W-2: if (a-j, b-k) in Dic: Dic[(a-j, b-k)] += 1 ...
import sys from collections import defaultdict def solve(): input = sys.stdin.readline H, W, N = map(int, input().split()) C = defaultdict(int) for _ in range(N): a, b = map(int, input().split()) a -= 1 b -= 1 for h in range(3): for w in range(3):...
22
29
536
657
H, W, N = list(map(int, input().split())) Dic = {} for i in range(N): a, b = list(map(int, input().split())) for j in range(3): for k in range(3): if 1 <= a - j <= H - 2 and 1 <= b - k <= W - 2: if (a - j, b - k) in Dic: Dic[(a - j, b - k)] += 1 ...
import sys from collections import defaultdict def solve(): input = sys.stdin.readline H, W, N = map(int, input().split()) C = defaultdict(int) for _ in range(N): a, b = map(int, input().split()) a -= 1 b -= 1 for h in range(3): for w in range(3): ...
false
24.137931
[ "-H, W, N = list(map(int, input().split()))", "-Dic = {}", "-for i in range(N):", "- a, b = list(map(int, input().split()))", "- for j in range(3):", "- for k in range(3):", "- if 1 <= a - j <= H - 2 and 1 <= b - k <= W - 2:", "- if (a - j, b - k) in Dic:", "- ...
false
0.042055
0.041923
1.003144
[ "s949505386", "s141753602" ]
u983918956
p03592
python
s587841533
s563904309
317
18
3,060
3,060
Accepted
Accepted
94.32
H,W,K = list(map(int,input().split())) ans = "No" for i in range(H+1): for j in range(W+1): if H*j + W*i - 2*i*j == K: ans = "Yes" break print(ans)
H,W,K = list(map(int,input().split())) ans = "No" for i in range(H+1): if H-2*i == 0: if K-W*i == 0: ans = "Yes" else: continue if (K-W*i) % (H-2*i) != 0: continue j = (K-W*i) // (H-2*i) if 0 <= j <= W: ans = "Yes" break ...
11
18
190
325
H, W, K = list(map(int, input().split())) ans = "No" for i in range(H + 1): for j in range(W + 1): if H * j + W * i - 2 * i * j == K: ans = "Yes" break print(ans)
H, W, K = list(map(int, input().split())) ans = "No" for i in range(H + 1): if H - 2 * i == 0: if K - W * i == 0: ans = "Yes" else: continue if (K - W * i) % (H - 2 * i) != 0: continue j = (K - W * i) // (H - 2 * i) if 0 <= j <= W: ans = "Yes" ...
false
38.888889
[ "- for j in range(W + 1):", "- if H * j + W * i - 2 * i * j == K:", "+ if H - 2 * i == 0:", "+ if K - W * i == 0:", "- break", "+ else:", "+ continue", "+ if (K - W * i) % (H - 2 * i) != 0:", "+ continue", "+ j = (K - W * i) // (H - 2 *...
false
0.143825
0.034359
4.185928
[ "s587841533", "s563904309" ]
u579508806
p02687
python
s463454345
s454337265
22
20
9,024
8,924
Accepted
Accepted
9.09
s=eval(input()) print(('ARC' if s=='ABC' else 'ABC'))
print(("ABC" if eval(input())=="ARC" else "ARC"))
2
1
46
41
s = eval(input()) print(("ARC" if s == "ABC" else "ABC"))
print(("ABC" if eval(input()) == "ARC" else "ARC"))
false
50
[ "-s = eval(input())", "-print((\"ARC\" if s == \"ABC\" else \"ABC\"))", "+print((\"ABC\" if eval(input()) == \"ARC\" else \"ARC\"))" ]
false
0.040577
0.040924
0.991523
[ "s463454345", "s454337265" ]
u888092736
p02700
python
s094509586
s978972790
24
20
9,020
9,100
Accepted
Accepted
16.67
a, b, c, d = map(int, input().split()) t_attack_cnt = (c + b - 1) // b a_attack_cnt = (a + d - 1) // d print('Yes') if t_attack_cnt <= a_attack_cnt else print('No')
a, b, c, d = map(int, input().split()) print('Yes') if (c + b - 1) // b <= (a + d - 1) // d else print('No')
4
2
168
110
a, b, c, d = map(int, input().split()) t_attack_cnt = (c + b - 1) // b a_attack_cnt = (a + d - 1) // d print("Yes") if t_attack_cnt <= a_attack_cnt else print("No")
a, b, c, d = map(int, input().split()) print("Yes") if (c + b - 1) // b <= (a + d - 1) // d else print("No")
false
50
[ "-t_attack_cnt = (c + b - 1) // b", "-a_attack_cnt = (a + d - 1) // d", "-print(\"Yes\") if t_attack_cnt <= a_attack_cnt else print(\"No\")", "+print(\"Yes\") if (c + b - 1) // b <= (a + d - 1) // d else print(\"No\")" ]
false
0.074198
0.047546
1.560536
[ "s094509586", "s978972790" ]
u342869120
p02599
python
s195754281
s754449550
1,963
1,785
201,644
223,600
Accepted
Accepted
9.07
from operator import add, mul, sub, or_ class SegmentTree: ''' セグメント木(遅延ではない) 1-indexd セグメント木 values : 値の配列 op : 区間に対する関数 ie : 初期値 ''' def __init__(self, values): self.values = values vlen = len(values) self.size = 2 ** (vlen-1).bit_length() ...
class BIT: def __init__(self, n): self.n = n self.tree = [0]*(n+1) def update(self, i, v): while i <= self.n: self.tree[i] += v i += i & (-i) def query(self, i): v = 0 while i: v += self.tree[i] i -= i & ...
67
41
1,511
829
from operator import add, mul, sub, or_ class SegmentTree: """ セグメント木(遅延ではない) 1-indexd セグメント木 values : 値の配列 op : 区間に対する関数 ie : 初期値 """ def __init__(self, values): self.values = values vlen = len(values) self.size = 2 ** (vlen - 1).bit_length() self.tree...
class BIT: def __init__(self, n): self.n = n self.tree = [0] * (n + 1) def update(self, i, v): while i <= self.n: self.tree[i] += v i += i & (-i) def query(self, i): v = 0 while i: v += self.tree[i] i -= i & (-i) ...
false
38.80597
[ "-from operator import add, mul, sub, or_", "-", "-", "-class SegmentTree:", "- \"\"\"", "- セグメント木(遅延ではない)", "- 1-indexd セグメント木", "- values : 値の配列", "- op : 区間に対する関数", "- ie : 初期値", "- \"\"\"", "-", "- def __init__(self, values):", "- self.values = values", ...
false
0.159231
0.046687
3.410628
[ "s195754281", "s754449550" ]
u950708010
p03030
python
s847944943
s969755210
164
92
3,064
3,064
Accepted
Accepted
43.9
def solve(): n = int(eval(input())) query = [] for i in range(n): tmp = eval(input()) s,p = tmp.split() query.append((s,p,i+1)) query.sort() count = 0 while count<n: count += 1 for i in range(n): for j in range(i+1,n): if query[i][0] == query[j][0]: ...
def solve(): n = int(eval(input())) query = [] for i in range(n): tmp = eval(input()) s,p = tmp.split() query.append((s,p,i+1)) query.sort() count = 0 while count<n/2: count += 1 for i in range(n): for j in range(i+1,n): if query[i][0] == query[j][0]: ...
23
23
510
512
def solve(): n = int(eval(input())) query = [] for i in range(n): tmp = eval(input()) s, p = tmp.split() query.append((s, p, i + 1)) query.sort() count = 0 while count < n: count += 1 for i in range(n): for j in range(i + 1, n): ...
def solve(): n = int(eval(input())) query = [] for i in range(n): tmp = eval(input()) s, p = tmp.split() query.append((s, p, i + 1)) query.sort() count = 0 while count < n / 2: count += 1 for i in range(n): for j in range(i + 1, n): ...
false
0
[ "- while count < n:", "+ while count < n / 2:" ]
false
0.153734
0.076656
2.005517
[ "s847944943", "s969755210" ]
u112317104
p02987
python
s439147397
s112710698
20
18
3,316
2,940
Accepted
Accepted
10
from collections import defaultdict def solve(): S = list(eval(input())) d = defaultdict(int) for key in S: d[key] = d[key] + 1 ans = 'Yes' for v in list(d.values()): if v != 2: ans = 'No' return ans print((solve()))
def solve(): S = list(eval(input())) S.sort() ans = 'No' if S[0] == S[1] and S[1] != S[2] and S[2] == S[3]: ans = 'Yes' return ans print((solve()))
14
9
269
176
from collections import defaultdict def solve(): S = list(eval(input())) d = defaultdict(int) for key in S: d[key] = d[key] + 1 ans = "Yes" for v in list(d.values()): if v != 2: ans = "No" return ans print((solve()))
def solve(): S = list(eval(input())) S.sort() ans = "No" if S[0] == S[1] and S[1] != S[2] and S[2] == S[3]: ans = "Yes" return ans print((solve()))
false
35.714286
[ "-from collections import defaultdict", "-", "-", "- d = defaultdict(int)", "- for key in S:", "- d[key] = d[key] + 1", "- ans = \"Yes\"", "- for v in list(d.values()):", "- if v != 2:", "- ans = \"No\"", "+ S.sort()", "+ ans = \"No\"", "+ if S[0...
false
0.045031
0.046166
0.975413
[ "s439147397", "s112710698" ]
u504836877
p02720
python
s848778799
s021532534
131
55
11,872
9,284
Accepted
Accepted
58.02
from collections import deque K = int(eval(input())) cnt = 0 q = deque() for i in range(1, 10): q.append(i) while cnt < K: num = q.popleft() cnt += 1 if num%10 > 0: q.append(10*num+(num%10)-1) q.append(10*num+(num%10)) if num%10 < 9: q.append(10*num+(num%10)+1) ...
K = int(eval(input())) def f(n, k, a): if k == n: return 1 res = 0 res += f(n, k+1, a) if a > 0: res += f(n, k+1, a-1) if a < 9: res += f(n, k+1, a+1) return res cnt = 0 for n in range(1, 12): c2 = 0 for a in range(1, 10): c2 += f(n, 1...
17
41
324
813
from collections import deque K = int(eval(input())) cnt = 0 q = deque() for i in range(1, 10): q.append(i) while cnt < K: num = q.popleft() cnt += 1 if num % 10 > 0: q.append(10 * num + (num % 10) - 1) q.append(10 * num + (num % 10)) if num % 10 < 9: q.append(10 * num + (num % ...
K = int(eval(input())) def f(n, k, a): if k == n: return 1 res = 0 res += f(n, k + 1, a) if a > 0: res += f(n, k + 1, a - 1) if a < 9: res += f(n, k + 1, a + 1) return res cnt = 0 for n in range(1, 12): c2 = 0 for a in range(1, 10): c2 += f(n, 1, a) ...
false
58.536585
[ "-from collections import deque", "+K = int(eval(input()))", "-K = int(eval(input()))", "+", "+def f(n, k, a):", "+ if k == n:", "+ return 1", "+ res = 0", "+ res += f(n, k + 1, a)", "+ if a > 0:", "+ res += f(n, k + 1, a - 1)", "+ if a < 9:", "+ res += f(...
false
0.043223
0.03835
1.127072
[ "s848778799", "s021532534" ]
u572561929
p03073
python
s704217743
s877328298
51
46
3,188
3,188
Accepted
Accepted
9.8
S = str(eval(input())) p1 = 0 p2 = 0 for i in range(len(S)): if i % 2 == 0: if S[i] == '0': p1 += 1 else: p2 += 1 else: if S[i] == '0': p2 += 1 else: p1 += 1 print((min(p1, p2)))
S = str(eval(input())) p1 = 0 for i in range(len(S)): if i % 2 == 0: if S[i] == '0': p1 += 1 else: if S[i] == '1': p1 += 1 print((min(p1, len(S) - p1)))
15
10
274
203
S = str(eval(input())) p1 = 0 p2 = 0 for i in range(len(S)): if i % 2 == 0: if S[i] == "0": p1 += 1 else: p2 += 1 else: if S[i] == "0": p2 += 1 else: p1 += 1 print((min(p1, p2)))
S = str(eval(input())) p1 = 0 for i in range(len(S)): if i % 2 == 0: if S[i] == "0": p1 += 1 else: if S[i] == "1": p1 += 1 print((min(p1, len(S) - p1)))
false
33.333333
[ "-p2 = 0", "- else:", "- p2 += 1", "- if S[i] == \"0\":", "- p2 += 1", "- else:", "+ if S[i] == \"1\":", "-print((min(p1, p2)))", "+print((min(p1, len(S) - p1)))" ]
false
0.041081
0.040497
1.014434
[ "s704217743", "s877328298" ]
u896588506
p02713
python
s506843779
s306133182
989
861
9,124
9,208
Accepted
Accepted
12.94
import math import itertools k = int(eval(input())) lst = [i for i in range(1,k+1)] itr = itertools.combinations_with_replacement(lst, 3) ans = 0 for i in itr: st = set(i) num = len(st) if num == 1: ans += i[0] elif num == 2: a,b = st ans += math.gcd(a,b) * 3 else: ans += ma...
from math import gcd from itertools import combinations_with_replacement k = int(eval(input())) lst = [i for i in range(1,k+1)] itr = combinations_with_replacement(lst, 3) ans = 0 for i in itr: st = set(i) num = len(st) if num == 1: ans += i[0] elif num == 2: a,b = st ans += gcd(a,b...
20
20
365
384
import math import itertools k = int(eval(input())) lst = [i for i in range(1, k + 1)] itr = itertools.combinations_with_replacement(lst, 3) ans = 0 for i in itr: st = set(i) num = len(st) if num == 1: ans += i[0] elif num == 2: a, b = st ans += math.gcd(a, b) * 3 else: ...
from math import gcd from itertools import combinations_with_replacement k = int(eval(input())) lst = [i for i in range(1, k + 1)] itr = combinations_with_replacement(lst, 3) ans = 0 for i in itr: st = set(i) num = len(st) if num == 1: ans += i[0] elif num == 2: a, b = st ans +=...
false
0
[ "-import math", "-import itertools", "+from math import gcd", "+from itertools import combinations_with_replacement", "-itr = itertools.combinations_with_replacement(lst, 3)", "+itr = combinations_with_replacement(lst, 3)", "- ans += math.gcd(a, b) * 3", "+ ans += gcd(a, b) * 3", "- ...
false
0.082617
0.120976
0.68292
[ "s506843779", "s306133182" ]
u766926358
p00481
python
s893220761
s928542697
17,870
14,230
36,508
36,504
Accepted
Accepted
20.37
h,w,n = list(map(int, input().split())) stage = [eval(input()) for i in range(h)] starts = [str(i) for i in range(n)] goals = [str(i+1) for i in range(n)] starts_y = [0 for i in range(n)] starts_x = [0 for i in range(n)] goals_y = [0 for i in range(n)] goals_x = [0 for i in range(n)] starts[0] = "S" for y in...
h,w,n = list(map(int, input().split())) stage = [eval(input()) for i in range(h)] starts = [str(i) for i in range(n)] goals = [str(i+1) for i in range(n)] starts_y = [0 for i in range(n)] starts_x = [0 for i in range(n)] goals_y = [0 for i in range(n)] goals_x = [0 for i in range(n)] starts[0] = "S" for y in...
52
50
1,380
1,338
h, w, n = list(map(int, input().split())) stage = [eval(input()) for i in range(h)] starts = [str(i) for i in range(n)] goals = [str(i + 1) for i in range(n)] starts_y = [0 for i in range(n)] starts_x = [0 for i in range(n)] goals_y = [0 for i in range(n)] goals_x = [0 for i in range(n)] starts[0] = "S" for y in range(...
h, w, n = list(map(int, input().split())) stage = [eval(input()) for i in range(h)] starts = [str(i) for i in range(n)] goals = [str(i + 1) for i in range(n)] starts_y = [0 for i in range(n)] starts_x = [0 for i in range(n)] goals_y = [0 for i in range(n)] goals_x = [0 for i in range(n)] starts[0] = "S" for y in range(...
false
3.846154
[ "- y += move_y[i]", "- x += move_x[i]", "- if y >= 0 and y < h and x >= 0 and x < w:", "- if bfs_map[y][x] == -1 and stage[y][x] != \"X\":", "- bfs_map[y][x] = bfs_map[y - move_y[i]][x - move_x[i]] + 1", "- data_y.append...
false
0.047745
0.128883
0.370452
[ "s893220761", "s928542697" ]
u941047297
p02773
python
s755022764
s163575142
1,037
435
107,472
49,632
Accepted
Accepted
58.05
from collections import defaultdict n = int(input()) S = [input() for _ in range(n)] d = defaultdict(int) for s in S: d[s] += 1 m = max(d.values()) items = d.items() a = sorted([c[0] for c in items if c[1] == m]) [print(i) for i in a]
from collections import Counter def main(): n = int(input()) S = [input() for _ in range(n)] c = Counter(S).most_common() V = c[0][1] ans = [k for k, v in c if v == V] [print(a) for a in sorted(ans)] if __name__ == '__main__': main()
10
11
248
273
from collections import defaultdict n = int(input()) S = [input() for _ in range(n)] d = defaultdict(int) for s in S: d[s] += 1 m = max(d.values()) items = d.items() a = sorted([c[0] for c in items if c[1] == m]) [print(i) for i in a]
from collections import Counter def main(): n = int(input()) S = [input() for _ in range(n)] c = Counter(S).most_common() V = c[0][1] ans = [k for k, v in c if v == V] [print(a) for a in sorted(ans)] if __name__ == "__main__": main()
false
9.090909
[ "-from collections import defaultdict", "+from collections import Counter", "-n = int(input())", "-S = [input() for _ in range(n)]", "-d = defaultdict(int)", "-for s in S:", "- d[s] += 1", "-m = max(d.values())", "-items = d.items()", "-a = sorted([c[0] for c in items if c[1] == m])", "-[prin...
false
0.146961
0.039104
3.758172
[ "s755022764", "s163575142" ]
u595375942
p03160
python
s638228555
s690343811
232
136
52,720
13,924
Accepted
Accepted
41.38
n=int(eval(input())) l=list(map(int,input().split())) dp=[0 for _ in range(n)] dp[1]=abs(l[1]-l[0]) for i in range(2,n): single=abs(l[i]-l[i-1])+dp[i-1] double=abs(l[i]-l[i-2])+dp[i-2] dp[i]=min(single,double) print((dp[n-1]))
n=int(eval(input())) H=list(map(int,input().split())) dp=[10**9]*n dp[0]=0 dp[1]=abs(H[1]-H[0]) for i in range(2,n): step1=dp[i-1]+abs(H[i]-H[i-1]) step2=dp[i-2]+abs(H[i]-H[i-2]) dp[i]=min(step1,step2) print((dp[-1]))
11
10
242
230
n = int(eval(input())) l = list(map(int, input().split())) dp = [0 for _ in range(n)] dp[1] = abs(l[1] - l[0]) for i in range(2, n): single = abs(l[i] - l[i - 1]) + dp[i - 1] double = abs(l[i] - l[i - 2]) + dp[i - 2] dp[i] = min(single, double) print((dp[n - 1]))
n = int(eval(input())) H = list(map(int, input().split())) dp = [10**9] * n dp[0] = 0 dp[1] = abs(H[1] - H[0]) for i in range(2, n): step1 = dp[i - 1] + abs(H[i] - H[i - 1]) step2 = dp[i - 2] + abs(H[i] - H[i - 2]) dp[i] = min(step1, step2) print((dp[-1]))
false
9.090909
[ "-l = list(map(int, input().split()))", "-dp = [0 for _ in range(n)]", "-dp[1] = abs(l[1] - l[0])", "+H = list(map(int, input().split()))", "+dp = [10**9] * n", "+dp[0] = 0", "+dp[1] = abs(H[1] - H[0])", "- single = abs(l[i] - l[i - 1]) + dp[i - 1]", "- double = abs(l[i] - l[i - 2]) + dp[i - 2...
false
0.045419
0.082922
0.547739
[ "s638228555", "s690343811" ]
u077291787
p02900
python
s612922343
s537577432
83
62
5,180
3,188
Accepted
Accepted
25.3
# ABC142D - Disjoint Set of Common Divisors from fractions import gcd def prime_factors(x: int) -> list: if x % 2: max_prime, factors = 0, [] else: max_prime, factors = 2, [2] while x % 2 == 0: x //= 2 for i in range(3, int(x ** 0.5) + 1, 2): if x % ...
# ABC142D - Disjoint Set of Common Divisors def gcd(x: int, y: int) -> int: while y: x, y = y, x % y return x def prime_factors(x: int) -> list: if x % 2: max_prime, factors = 0, [] else: max_prime, factors = 2, [2] while x % 2 == 0: x //= 2 ...
32
34
764
797
# ABC142D - Disjoint Set of Common Divisors from fractions import gcd def prime_factors(x: int) -> list: if x % 2: max_prime, factors = 0, [] else: max_prime, factors = 2, [2] while x % 2 == 0: x //= 2 for i in range(3, int(x**0.5) + 1, 2): if x % i == 0: ...
# ABC142D - Disjoint Set of Common Divisors def gcd(x: int, y: int) -> int: while y: x, y = y, x % y return x def prime_factors(x: int) -> list: if x % 2: max_prime, factors = 0, [] else: max_prime, factors = 2, [2] while x % 2 == 0: x //= 2 for i in ran...
false
5.882353
[ "-from fractions import gcd", "+def gcd(x: int, y: int) -> int:", "+ while y:", "+ x, y = y, x % y", "+ return x", "- max_prime = i" ]
false
0.053467
0.034328
1.55754
[ "s612922343", "s537577432" ]
u034128150
p03855
python
s085202025
s256304571
657
403
112,880
150,728
Accepted
Accepted
38.66
import sys from collections import defaultdict import numpy as np from scipy.sparse import csr_matrix from scipy.sparse.csgraph import connected_components input = sys.stdin.buffer.readline read = sys.stdin.buffer.read N, K, L = list(map(int, input().split())) pq_and_rs = list(map(int, read().split())) p...
import sys from collections import Counter input = sys.stdin.buffer.readline def grouping(adj): "0-indexed の無向グラフを連結成分に分解する。" n = len(adj) ret = [-1] * n g = 0 for v in range(n): if ret[v] == -1: ret[v] = g stack = [v] while stack: ...
27
47
855
1,062
import sys from collections import defaultdict import numpy as np from scipy.sparse import csr_matrix from scipy.sparse.csgraph import connected_components input = sys.stdin.buffer.readline read = sys.stdin.buffer.read N, K, L = list(map(int, input().split())) pq_and_rs = list(map(int, read().split())) ps = pq_and_rs[...
import sys from collections import Counter input = sys.stdin.buffer.readline def grouping(adj): "0-indexed の無向グラフを連結成分に分解する。" n = len(adj) ret = [-1] * n g = 0 for v in range(n): if ret[v] == -1: ret[v] = g stack = [v] while stack: v = s...
false
42.553191
[ "-from collections import defaultdict", "-import numpy as np", "-from scipy.sparse import csr_matrix", "-from scipy.sparse.csgraph import connected_components", "+from collections import Counter", "-read = sys.stdin.buffer.read", "+", "+", "+def grouping(adj):", "+ \"0-indexed の無向グラフを連結成分に分解する。...
false
0.218036
0.045529
4.788893
[ "s085202025", "s256304571" ]
u044964932
p03317
python
s934548861
s152308522
52
48
20,472
20,448
Accepted
Accepted
7.69
def main(): n, k = list(map(int, input().split())) As = list(map(int, input().split())) ans = (n-2) // (k-1) + 1 print(ans) if __name__ == "__main__": main()
import math def main(): n, k = list(map(int, input().split())) As = list(map(int, input().split())) ans = math.ceil((n-1)/(k-1)) print(ans) if __name__ == "__main__": main()
10
12
184
203
def main(): n, k = list(map(int, input().split())) As = list(map(int, input().split())) ans = (n - 2) // (k - 1) + 1 print(ans) if __name__ == "__main__": main()
import math def main(): n, k = list(map(int, input().split())) As = list(map(int, input().split())) ans = math.ceil((n - 1) / (k - 1)) print(ans) if __name__ == "__main__": main()
false
16.666667
[ "+import math", "+", "+", "- ans = (n - 2) // (k - 1) + 1", "+ ans = math.ceil((n - 1) / (k - 1))" ]
false
0.04133
0.043723
0.945257
[ "s934548861", "s152308522" ]
u805552010
p03448
python
s020301975
s312034021
50
37
2,940
2,568
Accepted
Accepted
26
a,b,c,x = list(map(int,[eval(input()) for i in range(4)])) ans = 0 for i in range(a+1): for k in range(b+1): for j in range(c+1): if i*500 + k*100 + j*50 == x: ans += 1 print(ans)
a,b,c,x = [int(eval(input())) for i in range(4)] ans = 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: ans += 1 print(ans)
9
9
217
218
a, b, c, x = list(map(int, [eval(input()) for i in range(4)])) ans = 0 for i in range(a + 1): for k in range(b + 1): for j in range(c + 1): if i * 500 + k * 100 + j * 50 == x: ans += 1 print(ans)
a, b, c, x = [int(eval(input())) for i in range(4)] ans = 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: ans += 1 print(ans)
false
0
[ "-a, b, c, x = list(map(int, [eval(input()) for i in range(4)]))", "+a, b, c, x = [int(eval(input())) for i in range(4)]", "- for k in range(b + 1):", "- for j in range(c + 1):", "- if i * 500 + k * 100 + j * 50 == x:", "+ for j in range(b + 1):", "+ for k in range(c + 1):...
false
0.071436
0.071752
0.995588
[ "s020301975", "s312034021" ]
u684120680
p02936
python
s848130262
s883534515
1,103
990
92,156
92,908
Accepted
Accepted
10.24
from collections import deque import sys s = sys.stdin.readlines() n, q = list(map(int, s[0].split())) tree = [[] for _ in range(n+1)] for ab in s[1:n]: a, b = list(map(int, ab.split())) tree[a].append(b) tree[b].append(a) counter = [0] * (n+1) for px in s[n:]: p, x = list(map(int, px.s...
from collections import deque import sys n, q, *args = list(map(int, open(0).read().split())) ab = args[:(n-1)*2] px = args[(n-1)*2:] tree = [[] for _ in range(n+1)] for a, b in zip(*[iter(ab)]*2): tree[a].append(b) tree[b].append(a) counter = [0] * (n+1) for p, x in zip(*[iter(px)]*2): cou...
28
27
622
617
from collections import deque import sys s = sys.stdin.readlines() n, q = list(map(int, s[0].split())) tree = [[] for _ in range(n + 1)] for ab in s[1:n]: a, b = list(map(int, ab.split())) tree[a].append(b) tree[b].append(a) counter = [0] * (n + 1) for px in s[n:]: p, x = list(map(int, px.split())) ...
from collections import deque import sys n, q, *args = list(map(int, open(0).read().split())) ab = args[: (n - 1) * 2] px = args[(n - 1) * 2 :] tree = [[] for _ in range(n + 1)] for a, b in zip(*[iter(ab)] * 2): tree[a].append(b) tree[b].append(a) counter = [0] * (n + 1) for p, x in zip(*[iter(px)] * 2): c...
false
3.571429
[ "-s = sys.stdin.readlines()", "-n, q = list(map(int, s[0].split()))", "+n, q, *args = list(map(int, open(0).read().split()))", "+ab = args[: (n - 1) * 2]", "+px = args[(n - 1) * 2 :]", "-for ab in s[1:n]:", "- a, b = list(map(int, ab.split()))", "+for a, b in zip(*[iter(ab)] * 2):", "-for px in s...
false
0.044893
0.181357
0.247537
[ "s848130262", "s883534515" ]
u312025627
p03000
python
s735669904
s271644915
179
19
38,256
3,188
Accepted
Accepted
89.39
n, x = (int(i) for i in input().split()) l = [0] + [int(i) for i in input().split()] d = 0 ans = 0 i = 1 while d <= x: ans += 1 if ans == n+1: break d = d + l[i] i += 1 print(ans)
def main(): N, X = (int(i) for i in input().split()) L = [int(i) for i in input().split()] from itertools import accumulate S = accumulate([0] + L) print((len([e for e in S if e <= X]))) if __name__ == '__main__': main()
14
10
218
254
n, x = (int(i) for i in input().split()) l = [0] + [int(i) for i in input().split()] d = 0 ans = 0 i = 1 while d <= x: ans += 1 if ans == n + 1: break d = d + l[i] i += 1 print(ans)
def main(): N, X = (int(i) for i in input().split()) L = [int(i) for i in input().split()] from itertools import accumulate S = accumulate([0] + L) print((len([e for e in S if e <= X]))) if __name__ == "__main__": main()
false
28.571429
[ "-n, x = (int(i) for i in input().split())", "-l = [0] + [int(i) for i in input().split()]", "-d = 0", "-ans = 0", "-i = 1", "-while d <= x:", "- ans += 1", "- if ans == n + 1:", "- break", "- d = d + l[i]", "- i += 1", "-print(ans)", "+def main():", "+ N, X = (int(i)...
false
0.034811
0.035981
0.967487
[ "s735669904", "s271644915" ]
u638795007
p03593
python
s329794030
s917992985
174
46
39,024
5,104
Accepted
Accepted
73.56
def examC(): H, W = LI() A = [SI() for _ in range(H)] d = defaultdict(int) ans = "Yes" for a in A: for s in a: d[s] +=1 # print(d) h = H//2; w = W//2; k = h*w for key,i in list(d.items()): if k == 0: break while(d[key]>=4): ...
def examA(): N, M, A, B = LI() C = [I()for _ in range(M)] ans = 0 for i,c in enumerate(C): if N<=A: N += B N -= c if N<0: ans = i+1 break if ans==0: ans = "complete" print(ans) return def examB(): N = L...
52
124
1,258
2,684
def examC(): H, W = LI() A = [SI() for _ in range(H)] d = defaultdict(int) ans = "Yes" for a in A: for s in a: d[s] += 1 # print(d) h = H // 2 w = W // 2 k = h * w for key, i in list(d.items()): if k == 0: break while d[key] >= 4...
def examA(): N, M, A, B = LI() C = [I() for _ in range(M)] ans = 0 for i, c in enumerate(C): if N <= A: N += B N -= c if N < 0: ans = i + 1 break if ans == 0: ans = "complete" print(ans) return def examB(): N = LI() ...
false
58.064516
[ "-def examC():", "- H, W = LI()", "- A = [SI() for _ in range(H)]", "- d = defaultdict(int)", "- ans = \"Yes\"", "- for a in A:", "- for s in a:", "- d[s] += 1", "- # print(d)", "- h = H // 2", "- w = W // 2", "- k = h * w", "- for key, i in...
false
0.036625
0.125097
0.292771
[ "s329794030", "s917992985" ]
u039189422
p02983
python
s830619124
s661296490
660
66
3,060
3,060
Accepted
Accepted
90
from sys import exit l,r=list(map(int,input().split())) res=1000000000000 if r-l>2020: print("0") exit() else: for i in range(l%2019,r%2019): for j in range(i+1,r%2019+1): res=min(res,(i*j)%2019) print(res)
from sys import exit l,r=list(map(int,input().split())) res=10000000000000 for i in range(l,r): for j in range(i+1,r+1): a=(i*j)%2019 if a==0: print("0") exit() else: res=min(res,a) print(res)
11
12
218
213
from sys import exit l, r = list(map(int, input().split())) res = 1000000000000 if r - l > 2020: print("0") exit() else: for i in range(l % 2019, r % 2019): for j in range(i + 1, r % 2019 + 1): res = min(res, (i * j) % 2019) print(res)
from sys import exit l, r = list(map(int, input().split())) res = 10000000000000 for i in range(l, r): for j in range(i + 1, r + 1): a = (i * j) % 2019 if a == 0: print("0") exit() else: res = min(res, a) print(res)
false
8.333333
[ "-res = 1000000000000", "-if r - l > 2020:", "- print(\"0\")", "- exit()", "-else:", "- for i in range(l % 2019, r % 2019):", "- for j in range(i + 1, r % 2019 + 1):", "- res = min(res, (i * j) % 2019)", "+res = 10000000000000", "+for i in range(l, r):", "+ for j in...
false
0.105172
0.036532
2.878918
[ "s830619124", "s661296490" ]
u677440371
p03633
python
s082322435
s328698243
31
24
3,828
3,700
Accepted
Accepted
22.58
N = int(eval(input())) T = [int(eval(input())) for _ in range(N)] def gcd(a,b): if b == 0: return a else: return gcd(b,a%b) from functools import reduce def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def lc...
N = int(eval(input())) T = [] for i in range(N): T.append(int(eval(input()))) def gcd(a,b): if b == 0: return a else: return gcd(b,a%b) from functools import reduce def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm(*numbers): return reduce(lcm_base,...
20
22
389
411
N = int(eval(input())) T = [int(eval(input())) for _ in range(N)] def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) from functools import reduce def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def lcm_list(numbe...
N = int(eval(input())) T = [] for i in range(N): T.append(int(eval(input()))) def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) from functools import reduce def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) de...
false
9.090909
[ "-T = [int(eval(input())) for _ in range(N)]", "+T = []", "+for i in range(N):", "+ T.append(int(eval(input())))" ]
false
0.037255
0.064078
0.581399
[ "s082322435", "s328698243" ]
u893063840
p03044
python
s293176047
s315055855
1,417
871
108,116
103,548
Accepted
Accepted
38.53
import sys sys.setrecursionlimit(10 ** 6) n = int(eval(input())) uvw = [list(map(int, input().split())) for _ in range(n-1)] g = [[] for _ in range(n)] for u, v, w in uvw: u -= 1 v -= 1 g[u].append([v, w]) g[v].append([u, w]) WHITE = 0 GRAY = 1 BLACK = 2 ds = [0] * n colors = [...
import sys sys.setrecursionlimit(10 ** 6) class Tree: WHITE = 0 GRAY = 1 BLACK = 2 def __init__(self, adj): n = len(adj) self.adj = adj self.colors = [self.WHITE] * n self.depths = [-1] * n self.depth = 0 def dfs(self, u): if self....
41
48
589
1,034
import sys sys.setrecursionlimit(10**6) n = int(eval(input())) uvw = [list(map(int, input().split())) for _ in range(n - 1)] g = [[] for _ in range(n)] for u, v, w in uvw: u -= 1 v -= 1 g[u].append([v, w]) g[v].append([u, w]) WHITE = 0 GRAY = 1 BLACK = 2 ds = [0] * n colors = [WHITE] * n def dfs(u): ...
import sys sys.setrecursionlimit(10**6) class Tree: WHITE = 0 GRAY = 1 BLACK = 2 def __init__(self, adj): n = len(adj) self.adj = adj self.colors = [self.WHITE] * n self.depths = [-1] * n self.depth = 0 def dfs(self, u): if self.colors[u] == self....
false
14.583333
[ "-n = int(eval(input()))", "-uvw = [list(map(int, input().split())) for _ in range(n - 1)]", "-g = [[] for _ in range(n)]", "-for u, v, w in uvw:", "- u -= 1", "- v -= 1", "- g[u].append([v, w])", "- g[v].append([u, w])", "-WHITE = 0", "-GRAY = 1", "-BLACK = 2", "-ds = [0] * n", ...
false
0.045273
0.038636
1.171797
[ "s293176047", "s315055855" ]
u057109575
p02695
python
s062579889
s331566675
462
130
80,036
67,824
Accepted
Accepted
71.86
N, M, Q = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(Q)] def dfs(x): if len(x) == N + 1: tmp = 0 for i in range(Q): if x[X[i][1]] - x[X[i][0]] == X[i][2]: tmp += X[i][3] return tmp x.append(x[-1]) re...
from itertools import combinations_with_replacement N, M, Q = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(Q)] ans = 0 for x in combinations_with_replacement(list(range(1, M + 1)), N): tmp = 0 for i in range(Q): if x[X[i][1] - 1] - x[X[i][0] - 1] == X[i]...
22
14
445
380
N, M, Q = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(Q)] def dfs(x): if len(x) == N + 1: tmp = 0 for i in range(Q): if x[X[i][1]] - x[X[i][0]] == X[i][2]: tmp += X[i][3] return tmp x.append(x[-1]) res = 0 whil...
from itertools import combinations_with_replacement N, M, Q = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(Q)] ans = 0 for x in combinations_with_replacement(list(range(1, M + 1)), N): tmp = 0 for i in range(Q): if x[X[i][1] - 1] - x[X[i][0] - 1] == X[i][2]: ...
false
36.363636
[ "+from itertools import combinations_with_replacement", "+", "-", "-", "-def dfs(x):", "- if len(x) == N + 1:", "- tmp = 0", "- for i in range(Q):", "- if x[X[i][1]] - x[X[i][0]] == X[i][2]:", "- tmp += X[i][3]", "- return tmp", "- x.append(...
false
0.055017
0.048111
1.143544
[ "s062579889", "s331566675" ]
u393253137
p03578
python
s455921916
s213357272
191
171
53,604
53,348
Accepted
Accepted
10.47
def main(): # D, Tは文字数カウントするだけだからint型にする必要なし. n = int(eval(input())) D = input().split() m = int(eval(input())) T = input().split() dic = dict() # 辞書はDだけで十分.Counterより速い. for d in D: # dic.get(d)と比べると, if in の方が速い. if d in dic: dic[d] += 1 ...
import sys input = sys.stdin.readline def main(): # D, Tは文字数カウントするだけだからint型にする必要なし. n = int(eval(input())) D = input().split() m = int(eval(input())) T = input().split() dic = dict() # 辞書はDだけで十分.Counterより速い. for d in D: # dic.get(d)と比べると, if in の方が速い. if...
24
26
525
565
def main(): # D, Tは文字数カウントするだけだからint型にする必要なし. n = int(eval(input())) D = input().split() m = int(eval(input())) T = input().split() dic = dict() # 辞書はDだけで十分.Counterより速い. for d in D: # dic.get(d)と比べると, if in の方が速い. if d in dic: dic[d] += 1 else: ...
import sys input = sys.stdin.readline def main(): # D, Tは文字数カウントするだけだからint型にする必要なし. n = int(eval(input())) D = input().split() m = int(eval(input())) T = input().split() dic = dict() # 辞書はDだけで十分.Counterより速い. for d in D: # dic.get(d)と比べると, if in の方が速い. if d in dic: ...
false
7.692308
[ "+import sys", "+", "+input = sys.stdin.readline", "+", "+" ]
false
0.133252
0.050303
2.648972
[ "s455921916", "s213357272" ]
u074220993
p04029
python
s089322548
s213121038
31
27
9,092
9,004
Accepted
Accepted
12.9
N = int(eval(input())) ans = 0 for i in range(N): ans += i + 1 print(ans)
import math print((sum(list(range(1,int(eval(input()))+1)))))
5
2
76
54
N = int(eval(input())) ans = 0 for i in range(N): ans += i + 1 print(ans)
import math print((sum(list(range(1, int(eval(input())) + 1)))))
false
60
[ "-N = int(eval(input()))", "-ans = 0", "-for i in range(N):", "- ans += i + 1", "-print(ans)", "+import math", "+", "+print((sum(list(range(1, int(eval(input())) + 1)))))" ]
false
0.04819
0.089228
0.540078
[ "s089322548", "s213121038" ]
u072717685
p02577
python
s124649281
s153943599
211
101
9,332
101,532
Accepted
Accepted
52.13
import sys sys.setrecursionlimit(10**7) read = sys.stdin.read readlines = sys.stdin.readlines from math import ceil def main(): n = list(map(int, input().split())) s9 = sum(n) if s9 % 9 == 0: print('Yes') else: print('No') if __name__ == '__main__': main()
import sys read = sys.stdin.read #readlines = sys.stdin.readlines from math import ceil def main(): n = tuple(map(int, tuple(eval(input())))) if sum(n) % 9 == 0: print('Yes') else: print('No') if __name__ == '__main__': main()
15
13
301
265
import sys sys.setrecursionlimit(10**7) read = sys.stdin.read readlines = sys.stdin.readlines from math import ceil def main(): n = list(map(int, input().split())) s9 = sum(n) if s9 % 9 == 0: print("Yes") else: print("No") if __name__ == "__main__": main()
import sys read = sys.stdin.read # readlines = sys.stdin.readlines from math import ceil def main(): n = tuple(map(int, tuple(eval(input())))) if sum(n) % 9 == 0: print("Yes") else: print("No") if __name__ == "__main__": main()
false
13.333333
[ "-sys.setrecursionlimit(10**7)", "-readlines = sys.stdin.readlines", "+# readlines = sys.stdin.readlines", "- n = list(map(int, input().split()))", "- s9 = sum(n)", "- if s9 % 9 == 0:", "+ n = tuple(map(int, tuple(eval(input()))))", "+ if sum(n) % 9 == 0:" ]
false
0.08313
0.082986
1.001739
[ "s124649281", "s153943599" ]
u077898957
p03416
python
s355808483
s912793789
82
72
2,940
2,940
Accepted
Accepted
12.2
a,b = list(map(int,input().split())) count = 0 for i in range(b-a+1): if str(a+i) == str(a+i)[::-1]: count += 1 print(count)
a,b=list(map(int,input().split())) ans=0 for i in range(a,b+1): if i==int(str(i)[::-1]): ans+=1 print(ans)
6
7
136
120
a, b = list(map(int, input().split())) count = 0 for i in range(b - a + 1): if str(a + i) == str(a + i)[::-1]: count += 1 print(count)
a, b = list(map(int, input().split())) ans = 0 for i in range(a, b + 1): if i == int(str(i)[::-1]): ans += 1 print(ans)
false
14.285714
[ "-count = 0", "-for i in range(b - a + 1):", "- if str(a + i) == str(a + i)[::-1]:", "- count += 1", "-print(count)", "+ans = 0", "+for i in range(a, b + 1):", "+ if i == int(str(i)[::-1]):", "+ ans += 1", "+print(ans)" ]
false
0.007297
0.15879
0.045955
[ "s355808483", "s912793789" ]
u268210555
p03490
python
s451766232
s728426651
1,388
18
3,576
3,188
Accepted
Accepted
98.7
def f(m, s, g): v, t = {s}, set() for i in m: for j in v: t.update((j+i, j-i)) v, t = t, set() return g in v s = eval(input()) x, y = list(map(int, input().split())) m = list(map(len, s.split('T'))) if f(m[::2][1::], m[0], x) and f(m[1::2], 0, y): print('Yes') els...
def f(m, s, g): for i in m: if s > g: s -= i else: s += i return s == g s = eval(input()) x, y = list(map(int, input().split())) m = list(map(len, s.split('T'))) if (f(sorted(m[::2][1::])[::-1], m[0], x) and f(sorted(m[1::2])[::-1], 0, y)): print('...
14
15
327
337
def f(m, s, g): v, t = {s}, set() for i in m: for j in v: t.update((j + i, j - i)) v, t = t, set() return g in v s = eval(input()) x, y = list(map(int, input().split())) m = list(map(len, s.split("T"))) if f(m[::2][1::], m[0], x) and f(m[1::2], 0, y): print("Yes") else: ...
def f(m, s, g): for i in m: if s > g: s -= i else: s += i return s == g s = eval(input()) x, y = list(map(int, input().split())) m = list(map(len, s.split("T"))) if f(sorted(m[::2][1::])[::-1], m[0], x) and f(sorted(m[1::2])[::-1], 0, y): print("Yes") else: prin...
false
6.666667
[ "- v, t = {s}, set()", "- for j in v:", "- t.update((j + i, j - i))", "- v, t = t, set()", "- return g in v", "+ if s > g:", "+ s -= i", "+ else:", "+ s += i", "+ return s == g", "-if f(m[::2][1::], m[0], x) and f(m[1::2], 0, ...
false
0.065055
0.039507
1.64667
[ "s451766232", "s728426651" ]
u531436689
p03854
python
s518025770
s680290584
221
75
4,340
3,572
Accepted
Accepted
66.06
import collections def solve(S): r_ix = len(S) while len(S): is_hit = False for word in ['dream', 'dreamer', 'erase', 'eraser']: l_ix = r_ix - len(word) if S[l_ix:r_ix] == word: S = S[:l_ix] r_ix = l_ix is_hit = ...
import collections def solve(S): r_ix = len(S) while len(S): is_hit = False for word in ['dream', 'dreamer', 'erase', 'eraser']: l_ix = r_ix - len(word) if S[l_ix:r_ix] == word: S = S[:l_ix] r_ix = l_ix is_hit = ...
39
39
827
826
import collections def solve(S): r_ix = len(S) while len(S): is_hit = False for word in ["dream", "dreamer", "erase", "eraser"]: l_ix = r_ix - len(word) if S[l_ix:r_ix] == word: S = S[:l_ix] r_ix = l_ix is_hit = True ...
import collections def solve(S): r_ix = len(S) while len(S): is_hit = False for word in ["dream", "dreamer", "erase", "eraser"]: l_ix = r_ix - len(word) if S[l_ix:r_ix] == word: S = S[:l_ix] r_ix = l_ix is_hit = True ...
false
0
[ "- print((solve2(S)))", "+ print((solve(S)))" ]
false
0.035532
0.036881
0.963401
[ "s518025770", "s680290584" ]
u546285759
p00009
python
s306359879
s930532876
640
350
52,708
21,016
Accepted
Accepted
45.31
primes = [0, 0] + [1] * 999999 for i in range(2, 1000): if primes[i]: for j in range(i*i, 1000000, i): primes[j] = 0 answer = [0] * 1000000 for i in range(2, 1000000): answer[i] += primes[i] + answer[i-1] while True: try: n = int(eval(input())) except: ...
import bisect primes = [0, 0] + [1] * 999999 for i in range(2, 1000): if primes[i]: for j in range(i*i, 1000000, i): primes[j] = 0 primes = [i for i, v in enumerate(primes) if v] while True: try: n = int(eval(input())) except: break print((bisect.bisec...
17
16
345
329
primes = [0, 0] + [1] * 999999 for i in range(2, 1000): if primes[i]: for j in range(i * i, 1000000, i): primes[j] = 0 answer = [0] * 1000000 for i in range(2, 1000000): answer[i] += primes[i] + answer[i - 1] while True: try: n = int(eval(input())) except: break p...
import bisect primes = [0, 0] + [1] * 999999 for i in range(2, 1000): if primes[i]: for j in range(i * i, 1000000, i): primes[j] = 0 primes = [i for i, v in enumerate(primes) if v] while True: try: n = int(eval(input())) except: break print((bisect.bisect(primes, n))...
false
5.882353
[ "+import bisect", "+", "-answer = [0] * 1000000", "-for i in range(2, 1000000):", "- answer[i] += primes[i] + answer[i - 1]", "+primes = [i for i, v in enumerate(primes) if v]", "- print((answer[n]))", "+ print((bisect.bisect(primes, n)))" ]
false
1.048408
0.818753
1.280494
[ "s306359879", "s930532876" ]
u987164499
p03252
python
s717095976
s506979299
344
55
23,168
3,632
Accepted
Accepted
84.01
from sys import stdin import fractions s = stdin.readline().rstrip() t = stdin.readline().rstrip() li = [] for i in range(len(s)): li.append((s[i],t[i])) li.sort() for i in range(len(li)-1): if li[i][0] == li[i+1][0]: if li[i][1] != li[i+1][1]: print("No") exit(...
s = eval(input()) t = eval(input()) dic = {} dic2 = {} for i,j in zip(s,t): if j not in dic: if i in dic2: print("No") exit() dic[j] = i dic2[i] = j else: if dic[j] != i: print("No") exit() print("Yes")
26
18
512
297
from sys import stdin import fractions s = stdin.readline().rstrip() t = stdin.readline().rstrip() li = [] for i in range(len(s)): li.append((s[i], t[i])) li.sort() for i in range(len(li) - 1): if li[i][0] == li[i + 1][0]: if li[i][1] != li[i + 1][1]: print("No") exit() li.sort(...
s = eval(input()) t = eval(input()) dic = {} dic2 = {} for i, j in zip(s, t): if j not in dic: if i in dic2: print("No") exit() dic[j] = i dic2[i] = j else: if dic[j] != i: print("No") exit() print("Yes")
false
30.769231
[ "-from sys import stdin", "-import fractions", "-", "-s = stdin.readline().rstrip()", "-t = stdin.readline().rstrip()", "-li = []", "-for i in range(len(s)):", "- li.append((s[i], t[i]))", "-li.sort()", "-for i in range(len(li) - 1):", "- if li[i][0] == li[i + 1][0]:", "- if li[i]...
false
0.069542
0.007065
9.842505
[ "s717095976", "s506979299" ]
u745812846
p02755
python
s066647625
s051925841
29
25
3,060
2,940
Accepted
Accepted
13.79
import math a, b = map(int, input().split()) for i in range(20000): if (math.floor(i * 8 / 100), math.floor(i / 10))\ == (a, b): print(i) exit() print(-1)
a, b = list(map(int, input().split())) for i in range(20000): hachi = i * 8 // 100 ju = i // 10 if (hachi, ju) == (a, b): print(i) exit() print((-1))
9
9
196
183
import math a, b = map(int, input().split()) for i in range(20000): if (math.floor(i * 8 / 100), math.floor(i / 10)) == (a, b): print(i) exit() print(-1)
a, b = list(map(int, input().split())) for i in range(20000): hachi = i * 8 // 100 ju = i // 10 if (hachi, ju) == (a, b): print(i) exit() print((-1))
false
0
[ "-import math", "-", "-a, b = map(int, input().split())", "+a, b = list(map(int, input().split()))", "- if (math.floor(i * 8 / 100), math.floor(i / 10)) == (a, b):", "+ hachi = i * 8 // 100", "+ ju = i // 10", "+ if (hachi, ju) == (a, b):", "-print(-1)", "+print((-1))" ]
false
0.036984
0.041475
0.891731
[ "s066647625", "s051925841" ]
u922449550
p03583
python
s640604869
s532162568
1,989
465
3,064
3,064
Accepted
Accepted
76.62
N = int(eval(input())) if N%2 == 0: print((N, N, N//2)) else: for h in range(3500, -1, -1): num = N*h*h; diff_num = N*h dem = 4*h*h - N*(h+h); diff_dem = 4*h - N for n in range(h, -1, -1): if dem <= 0: break if num%dem == 0: print((h, n, num//dem)) quit(...
N = int(eval(input())) if N%2 == 0: print((N, N, N//2)) else: for h in range(1, 3501): if 4*h <= N: continue for n in range(h, 3501): num = N*h*n dem = 4*h*n - N*(h+n) if dem > 0 and num%dem == 0: print((h, n, num//dem)) quit()
16
15
357
286
N = int(eval(input())) if N % 2 == 0: print((N, N, N // 2)) else: for h in range(3500, -1, -1): num = N * h * h diff_num = N * h dem = 4 * h * h - N * (h + h) diff_dem = 4 * h - N for n in range(h, -1, -1): if dem <= 0: break if num...
N = int(eval(input())) if N % 2 == 0: print((N, N, N // 2)) else: for h in range(1, 3501): if 4 * h <= N: continue for n in range(h, 3501): num = N * h * n dem = 4 * h * n - N * (h + n) if dem > 0 and num % dem == 0: print((h, n, nu...
false
6.25
[ "- for h in range(3500, -1, -1):", "- num = N * h * h", "- diff_num = N * h", "- dem = 4 * h * h - N * (h + h)", "- diff_dem = 4 * h - N", "- for n in range(h, -1, -1):", "- if dem <= 0:", "- break", "- if num % dem == 0:", ...
false
0.137797
0.12487
1.103521
[ "s640604869", "s532162568" ]
u517152997
p03380
python
s374509871
s641974376
727
572
23,348
23,344
Accepted
Accepted
21.32
# -*- coding: utf-8 -*- # kakomon toku import math import sys import itertools import numpy as np n = int(eval(input())) a = [int(i) for i in input().split()] #print(a) ai=0 for m in a: if ai < m: ai = m a = np.sort(a) aj = a[0] center = ai / 2 diff = ai i=0 for m in a: if diff > ...
# -*- coding: utf-8 -*- # kakomon toku import math import sys import itertools import numpy as np n = int(eval(input())) a = [int(i) for i in input().split()] #print(a) a = np.sort(a) ai = a[n-1] aj = a[0] center = ai / 2 diff = ai i=0 for m in a: if diff > abs(m - center) : aj = m ...
28
25
423
385
# -*- coding: utf-8 -*- # kakomon toku import math import sys import itertools import numpy as np n = int(eval(input())) a = [int(i) for i in input().split()] # print(a) ai = 0 for m in a: if ai < m: ai = m a = np.sort(a) aj = a[0] center = ai / 2 diff = ai i = 0 for m in a: if diff > abs(m - center): ...
# -*- coding: utf-8 -*- # kakomon toku import math import sys import itertools import numpy as np n = int(eval(input())) a = [int(i) for i in input().split()] # print(a) a = np.sort(a) ai = a[n - 1] aj = a[0] center = ai / 2 diff = ai i = 0 for m in a: if diff > abs(m - center): aj = m diff = abs(a...
false
10.714286
[ "-ai = 0", "-for m in a:", "- if ai < m:", "- ai = m", "+ai = a[n - 1]" ]
false
0.234149
0.261562
0.895195
[ "s374509871", "s641974376" ]
u334712262
p03287
python
s417498694
s876813602
328
192
88,184
110,432
Accepted
Accepted
41.46
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from pprint import pprint from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinat...
# -*- coding: utf-8 -*- import bisect import heapq import math import random from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from fractions import Fraction from functools import lru_cache, reduce from itertools import combinations, combinations_with...
85
80
1,473
1,550
# -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from pprint import pprint from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_re...
# -*- coding: utf-8 -*- import bisect import heapq import math import random from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from fractions import Fraction from functools import lru_cache, reduce from itertools import ( combinations, combinations_wit...
false
5.882353
[ "-import sys", "-from pprint import pprint", "+from fractions import Fraction", "-from itertools import combinations, combinations_with_replacement, product, permutations", "-from operator import add, mul, sub", "+from itertools import (", "+ combinations,", "+ combinations_with_replacement,", ...
false
0.061133
0.045826
1.334016
[ "s417498694", "s876813602" ]
u454022848
p02400
python
s224466552
s165700227
30
10
6,828
6,592
Accepted
Accepted
66.67
import math r=float(eval(input())) print(("%.6f"%(r**2*math.pi),"%.6f"%(r*2*math.pi)))
# encoding:utf-8 import math r = float(eval(input())) area = r**2*math.pi circumference = r * 2 * math.pi area = ('%03.6f' % area) circumference = ('%03.6f' % circumference) print((area), end=' ') print(circumference)
3
13
80
217
import math r = float(eval(input())) print(("%.6f" % (r**2 * math.pi), "%.6f" % (r * 2 * math.pi)))
# encoding:utf-8 import math r = float(eval(input())) area = r**2 * math.pi circumference = r * 2 * math.pi area = "%03.6f" % area circumference = "%03.6f" % circumference print((area), end=" ") print(circumference)
false
76.923077
[ "+# encoding:utf-8", "-print((\"%.6f\" % (r**2 * math.pi), \"%.6f\" % (r * 2 * math.pi)))", "+area = r**2 * math.pi", "+circumference = r * 2 * math.pi", "+area = \"%03.6f\" % area", "+circumference = \"%03.6f\" % circumference", "+print((area), end=\" \")", "+print(circumference)" ]
false
0.035166
0.036103
0.974052
[ "s224466552", "s165700227" ]
u531599639
p02832
python
s028147103
s113319827
102
94
32,220
32,300
Accepted
Accepted
7.84
n = int(eval(input())) a = list(map(int,input().split())) cur = 0 cnt = 0 for v in a: if v == cur+1: cur = v cnt += 1 if cnt==0: print((-1)) else: print((len(a)-cnt))
n = int(eval(input())) a = list(map(int,input().split())) cnt = 0 for v in a: if v == cnt+1: cnt += 1 print((-1 if cnt==0 else n-cnt))
12
7
181
138
n = int(eval(input())) a = list(map(int, input().split())) cur = 0 cnt = 0 for v in a: if v == cur + 1: cur = v cnt += 1 if cnt == 0: print((-1)) else: print((len(a) - cnt))
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 for v in a: if v == cnt + 1: cnt += 1 print((-1 if cnt == 0 else n - cnt))
false
41.666667
[ "-cur = 0", "- if v == cur + 1:", "- cur = v", "+ if v == cnt + 1:", "-if cnt == 0:", "- print((-1))", "-else:", "- print((len(a) - cnt))", "+print((-1 if cnt == 0 else n - cnt))" ]
false
0.043108
0.133933
0.321862
[ "s028147103", "s113319827" ]
u474925961
p02647
python
s334192859
s902948701
992
912
124,928
125,304
Accepted
Accepted
8.06
import numpy as np from numba import jit n,k=list(map(int,input().split())) a=list(map(int,input().split())) a=np.array(a,np.int64) @jit def imo(a): imos=np.zeros(n+1,np.int64) for i in range(n): imos[max(0,i-a[i])]+=1 imos[min(n,i+a[i]+1)]-=1 immo=np.zeros(n+1,np.int64) ...
import numpy as np from numba import njit n,k=list(map(int,input().split())) a=list(map(int,input().split())) a=np.array(a,np.int64) @njit(cache=True) def imo(a): imos=np.zeros(n+1,np.int64) for i in range(n): imos[max(0,i-a[i])]+=1 imos[min(n,i+a[i]+1)]-=1 immo=np.zeros(...
22
22
424
438
import numpy as np from numba import jit n, k = list(map(int, input().split())) a = list(map(int, input().split())) a = np.array(a, np.int64) @jit def imo(a): imos = np.zeros(n + 1, np.int64) for i in range(n): imos[max(0, i - a[i])] += 1 imos[min(n, i + a[i] + 1)] -= 1 immo = np.zeros(n ...
import numpy as np from numba import njit n, k = list(map(int, input().split())) a = list(map(int, input().split())) a = np.array(a, np.int64) @njit(cache=True) def imo(a): imos = np.zeros(n + 1, np.int64) for i in range(n): imos[max(0, i - a[i])] += 1 imos[min(n, i + a[i] + 1)] -= 1 immo...
false
0
[ "-from numba import jit", "+from numba import njit", "-@jit", "+@njit(cache=True)" ]
false
0.308232
0.264654
1.164661
[ "s334192859", "s902948701" ]
u863442865
p03476
python
s148149660
s990989410
414
252
51,928
5,816
Accepted
Accepted
39.13
''' https://atcoder.jp/contests/abc084/tasks/abc084_d ''' def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations #from itertools i...
''' https://atcoder.jp/contests/abc084/tasks/abc084_d ''' def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations #from itertools i...
45
50
1,140
1,276
""" https://atcoder.jp/contests/abc084/tasks/abc084_d """ def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque # from collections import defaultdict from itertools import combinations, permutations # from itertools impo...
""" https://atcoder.jp/contests/abc084/tasks/abc084_d """ def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque # from collections import defaultdict from itertools import combinations, permutations # from itertools impo...
false
10
[ "- for i in range(10**5):", "+ for i in range(1, 10**5, 2):", "- print((res[r] - res[l - 1]))", "+ if l == 1:", "+ print((res[r]))", "+ elif res[l] == res[l - 2]:", "+ print((res[r] - res[l]))", "+ else:", "+ print((res[r] - res[l] +...
false
0.174086
0.161373
1.078779
[ "s148149660", "s990989410" ]
u186838327
p02885
python
s019146052
s128950886
20
17
3,316
2,940
Accepted
Accepted
15
a, b = list(map(int, input().split())) print((max(0, a-2*b)))
a, b = list(map(int, input().split())) if b * 2 >= a: print((0)) else: print((a - 2*b))
2
5
55
90
a, b = list(map(int, input().split())) print((max(0, a - 2 * b)))
a, b = list(map(int, input().split())) if b * 2 >= a: print((0)) else: print((a - 2 * b))
false
60
[ "-print((max(0, a - 2 * b)))", "+if b * 2 >= a:", "+ print((0))", "+else:", "+ print((a - 2 * b))" ]
false
0.051155
0.051853
0.986549
[ "s019146052", "s128950886" ]
u050876787
p03013
python
s179605036
s058754355
536
377
462,692
466,596
Accepted
Accepted
29.66
n, m = list(map(int, input().split())) stairs =[1, 1] + [0] * (n - 1) for _ in range(m): stairs[int(eval(input()))] = "broken" for i in range(2, n + 1): if stairs[i] != "broken": if stairs[i - 2] != "broken": stairs[i] += stairs[i - 2] if stairs[i - 1] != "broken": stairs[i] += ...
n, m = list(map(int, input().split())) stairs = ["o"] * (n + 1) for _ in range(m): stairs[int(eval(input()))] = "x" c = [0] * (n + 1) c[0] = 1 if stairs[1] == "x": c[1] = 0 else: c[1] = 1 for i in range(2, n + 1): if stairs[i] == "x": c[i] = 0 else: c[i] = c[i - 1] + c[i - 2] ...
15
21
361
332
n, m = list(map(int, input().split())) stairs = [1, 1] + [0] * (n - 1) for _ in range(m): stairs[int(eval(input()))] = "broken" for i in range(2, n + 1): if stairs[i] != "broken": if stairs[i - 2] != "broken": stairs[i] += stairs[i - 2] if stairs[i - 1] != "broken": stair...
n, m = list(map(int, input().split())) stairs = ["o"] * (n + 1) for _ in range(m): stairs[int(eval(input()))] = "x" c = [0] * (n + 1) c[0] = 1 if stairs[1] == "x": c[1] = 0 else: c[1] = 1 for i in range(2, n + 1): if stairs[i] == "x": c[i] = 0 else: c[i] = c[i - 1] + c[i - 2] print((...
false
28.571429
[ "-stairs = [1, 1] + [0] * (n - 1)", "+stairs = [\"o\"] * (n + 1)", "- stairs[int(eval(input()))] = \"broken\"", "+ stairs[int(eval(input()))] = \"x\"", "+c = [0] * (n + 1)", "+c[0] = 1", "+if stairs[1] == \"x\":", "+ c[1] = 0", "+else:", "+ c[1] = 1", "- if stairs[i] != \"broken\"...
false
0.035256
0.036812
0.95774
[ "s179605036", "s058754355" ]
u156815136
p03805
python
s202698651
s890300673
134
30
3,064
9,028
Accepted
Accepted
77.61
# # Written by NoKnowledgeGG @YlePhan # ('ω') # #import math #mod = 10**9+7 #import itertools #import fractions #import numpy as np #mod = 10**4 + 7 """def kiri(n,m): r_ = n / m if (r_ - (n // m)) > 0: return (n//m) + 1 else: return (n//m)""" """ n! mod m 階乗 mod = 1e9 + 7 N = 10000000 ...
n, m = list(map(int,input().split())) G = [[] for _ in range(n)] for i in range(m): a,b = [int(x)-1 for x in input().split()] G[a].append(b) G[b].append(a) SAW = [False] * n def dfs(v,SAW): global res end = True for i in range(n): if not SAW[i] and i != v: end =...
99
26
1,739
529
# # Written by NoKnowledgeGG @YlePhan # ('ω') # # import math # mod = 10**9+7 # import itertools # import fractions # import numpy as np # mod = 10**4 + 7 """def kiri(n,m): r_ = n / m if (r_ - (n // m)) > 0: return (n//m) + 1 else: return (n//m)""" """ n! mod m 階乗 mod = 1e9 + 7 N = 10000000 fac = [0] * N ...
n, m = list(map(int, input().split())) G = [[] for _ in range(n)] for i in range(m): a, b = [int(x) - 1 for x in input().split()] G[a].append(b) G[b].append(a) SAW = [False] * n def dfs(v, SAW): global res end = True for i in range(n): if not SAW[i] and i != v: end = False ...
false
73.737374
[ "-#", "-# Written by NoKnowledgeGG @YlePhan", "-# ('ω')", "-#", "-# import math", "-# mod = 10**9+7", "-# import itertools", "-# import fractions", "-# import numpy as np", "-# mod = 10**4 + 7", "-\"\"\"def kiri(n,m):", "- r_ = n / m", "- if (r_ - (n // m)) > 0:", "- return (n//m) + 1...
false
0.050236
0.042629
1.178433
[ "s202698651", "s890300673" ]
u498487134
p02881
python
s740306114
s684735729
197
76
40,172
63,868
Accepted
Accepted
61.42
import math N = int(eval(input())) rN = int(math.ceil(math.sqrt(N))) for i in (list(range(rN,0,-1))): a=N//i if a*i==N: print((a+i-2)) break
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N=I() ans=N M=10**6+5 for i in range(1,M): if N%i==0: j=N//i ...
10
24
161
425
import math N = int(eval(input())) rN = int(math.ceil(math.sqrt(N))) for i in list(range(rN, 0, -1)): a = N // i if a * i == N: print((a + i - 2)) break
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod = 10**9 + 7 N = I() ans = N M = 10**6 + 5 for i in range(1, M): if N % i == 0: ...
false
58.333333
[ "-import math", "+import sys", "-N = int(eval(input()))", "-rN = int(math.ceil(math.sqrt(N)))", "-for i in list(range(rN, 0, -1)):", "- a = N // i", "- if a * i == N:", "- print((a + i - 2))", "- break", "+input = sys.stdin.readline", "+", "+", "+def I():", "+ return...
false
0.071072
0.266754
0.266434
[ "s740306114", "s684735729" ]
u594859393
p03854
python
s806731967
s821720793
97
68
3,188
3,188
Accepted
Accepted
29.9
s = eval(input()) stack = [] for c in reversed(s): stack.append(c) if len(stack) > 7: print('NO') break if ''.join(reversed(stack)) in ('erase', 'dream', 'eraser', 'dreamer'): stack = [] else: print(('NO' if stack else 'YES'))
s = eval(input()) stack = [] for c in reversed(s): stack.append(c) if len(stack) > 7: print('NO') break if len(stack) >= 5 and ''.join(reversed(stack)) in ('erase', 'dream', 'eraser', 'dreamer'): stack = [] else: print(('NO' if stack else 'YES'))
12
12
252
273
s = eval(input()) stack = [] for c in reversed(s): stack.append(c) if len(stack) > 7: print("NO") break if "".join(reversed(stack)) in ("erase", "dream", "eraser", "dreamer"): stack = [] else: print(("NO" if stack else "YES"))
s = eval(input()) stack = [] for c in reversed(s): stack.append(c) if len(stack) > 7: print("NO") break if len(stack) >= 5 and "".join(reversed(stack)) in ( "erase", "dream", "eraser", "dreamer", ): stack = [] else: print(("NO" if stack else "Y...
false
0
[ "- if \"\".join(reversed(stack)) in (\"erase\", \"dream\", \"eraser\", \"dreamer\"):", "+ if len(stack) >= 5 and \"\".join(reversed(stack)) in (", "+ \"erase\",", "+ \"dream\",", "+ \"eraser\",", "+ \"dreamer\",", "+ ):" ]
false
0.069308
0.084297
0.822194
[ "s806731967", "s821720793" ]
u332906195
p02700
python
s656365895
s970961420
23
19
9,104
9,052
Accepted
Accepted
17.39
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()
import math A, B, C, D = list(map(int, input().split())) print(("Yes" if math.ceil(C / B) <= math.ceil(A / D) else "No"))
10
3
193
116
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()
import math A, B, C, D = list(map(int, input().split())) print(("Yes" if math.ceil(C / B) <= math.ceil(A / D) else "No"))
false
70
[ "+import math", "+", "-while A > 0 or C > 0:", "- C -= B", "- if C <= 0:", "- print(\"Yes\")", "- exit()", "- A -= D", "- if A <= 0:", "- print(\"No\")", "- exit()", "+print((\"Yes\" if math.ceil(C / B) <= math.ceil(A / D) else \"No\"))" ]
false
0.115669
0.040214
2.876301
[ "s656365895", "s970961420" ]
u440566786
p02868
python
s984077078
s839128521
500
397
86,792
85,236
Accepted
Accepted
20.6
import sys INF = 1 << 60 MOD = 10**9 + 7 # 998244353 sys.setrecursionlimit(2147483647) input = lambda:sys.stdin.readline().rstrip() class SegmentTree(object): def __init__(self, A, dot, unit): n = 1 << (len(A) - 1).bit_length() tree = [unit] * (2 * n) for i, v in enumerate(A): ...
import sys INF = 1 << 60 MOD = 10**9 + 7 # 998244353 sys.setrecursionlimit(2147483647) input = lambda:sys.stdin.readline().rstrip() class SegmentTree(object): def __init__(self, A, dot, unit): n = 1 << (len(A) - 1).bit_length() tree = [unit] * (2 * n) for i, v in enumerate(A): ...
66
66
1,769
1,795
import sys INF = 1 << 60 MOD = 10**9 + 7 # 998244353 sys.setrecursionlimit(2147483647) input = lambda: sys.stdin.readline().rstrip() class SegmentTree(object): def __init__(self, A, dot, unit): n = 1 << (len(A) - 1).bit_length() tree = [unit] * (2 * n) for i, v in enumerate(A): ...
import sys INF = 1 << 60 MOD = 10**9 + 7 # 998244353 sys.setrecursionlimit(2147483647) input = lambda: sys.stdin.readline().rstrip() class SegmentTree(object): def __init__(self, A, dot, unit): n = 1 << (len(A) - 1).bit_length() tree = [unit] * (2 * n) for i, v in enumerate(A): ...
false
0
[ "- edges = []", "+ E = [[] for _ in range(n)]", "- edges.append((u, v, w))", "- edges.sort()", "+ E[u].append((v, w))", "- for u, v, w in edges:", "- tree.update(v, min(tree[v], tree.sum(u, v) + w))", "+ for v in range(n):", "+ for nv, w in E[v]:", "+ ...
false
0.038885
0.043425
0.895456
[ "s984077078", "s839128521" ]
u884323674
p03031
python
s232788165
s655097856
41
35
3,064
3,064
Accepted
Accepted
14.63
N, M = list(map(int, input().split())) ks = [[int(i) for i in input().split()] for j in range(M)] p = [int(i) for i in input().split()] ans = 0 for i in range((1 << N)): count = 0 for j in range(M): k = ks[j][0] on = 0 for s in ks[j][1:]: if i & (1 << (s-1)): ...
N, M = list(map(int, input().split())) switches = [[int(i) for i in input().split()] for i in range(M)] P = [int(i) for i in input().split()] ans = 0 for pattern in range(1 << N): for i in range(M): k = switches[i][0] switch = switches[i][1:] count= 0 for j in range(k): ...
21
19
450
479
N, M = list(map(int, input().split())) ks = [[int(i) for i in input().split()] for j in range(M)] p = [int(i) for i in input().split()] ans = 0 for i in range((1 << N)): count = 0 for j in range(M): k = ks[j][0] on = 0 for s in ks[j][1:]: if i & (1 << (s - 1)): ...
N, M = list(map(int, input().split())) switches = [[int(i) for i in input().split()] for i in range(M)] P = [int(i) for i in input().split()] ans = 0 for pattern in range(1 << N): for i in range(M): k = switches[i][0] switch = switches[i][1:] count = 0 for j in range(k): ...
false
9.52381
[ "-ks = [[int(i) for i in input().split()] for j in range(M)]", "-p = [int(i) for i in input().split()]", "+switches = [[int(i) for i in input().split()] for i in range(M)]", "+P = [int(i) for i in input().split()]", "-for i in range((1 << N)):", "- count = 0", "- for j in range(M):", "- k...
false
0.042855
0.041021
1.044697
[ "s232788165", "s655097856" ]
u020373088
p03244
python
s191337530
s112010492
116
88
21,204
21,084
Accepted
Accepted
24.14
import collections n = int(eval(input())) v = list(map(int, input().split())) v1 = [v[i*2+1] for i in range(n//2)] v2 = [v[i*2] for i in range(n//2)] c1 = collections.Counter(v1).most_common() c2 = collections.Counter(v2).most_common() if len(set(v1)) == len(set(v2)) == 1: if c1[0][0] != c2[0][0]: prin...
import collections n = int(eval(input())) v = list(map(int, input().split())) v1 = v[::2] v2 = v[1::2] c1 = collections.Counter(v1).most_common() c2 = collections.Counter(v2).most_common() if c1[0][0] != c2[0][0]: print((len(v1)-c1[0][1] + len(v2)-c2[0][1])) else: if len(c1) == len(c2) == 1: print(...
29
19
962
516
import collections n = int(eval(input())) v = list(map(int, input().split())) v1 = [v[i * 2 + 1] for i in range(n // 2)] v2 = [v[i * 2] for i in range(n // 2)] c1 = collections.Counter(v1).most_common() c2 = collections.Counter(v2).most_common() if len(set(v1)) == len(set(v2)) == 1: if c1[0][0] != c2[0][0]: ...
import collections n = int(eval(input())) v = list(map(int, input().split())) v1 = v[::2] v2 = v[1::2] c1 = collections.Counter(v1).most_common() c2 = collections.Counter(v2).most_common() if c1[0][0] != c2[0][0]: print((len(v1) - c1[0][1] + len(v2) - c2[0][1])) else: if len(c1) == len(c2) == 1: print(...
false
34.482759
[ "-v1 = [v[i * 2 + 1] for i in range(n // 2)]", "-v2 = [v[i * 2] for i in range(n // 2)]", "+v1 = v[::2]", "+v2 = v[1::2]", "-if len(set(v1)) == len(set(v2)) == 1:", "- if c1[0][0] != c2[0][0]:", "- print((0))", "- else:", "- print((min(len(v1), len(v2))))", "-elif len(set(v1)) ...
false
0.191487
0.047245
4.053044
[ "s191337530", "s112010492" ]
u678167152
p03212
python
s973683311
s419033346
116
77
5,692
4,084
Accepted
Accepted
33.62
N = int(eval(input())) from collections import deque def solve(N): ans = 0 d = deque([3,5,7]) n = d.popleft() while n<=N: if len(set(list(str(n))))==3: ans += 1 for num in [3,5,7]: new = int(str(n)+str(num)) d.append(new) n = d.po...
from collections import deque def solve(): N = int(eval(input())) ans = 0 d = deque([3,5,7]) while len(d): n = d.popleft() for i in range(3,8,2): a = n*10+i if a<=N: if len(set(list(str(a))))==3: ans += 1 ...
16
15
354
362
N = int(eval(input())) from collections import deque def solve(N): ans = 0 d = deque([3, 5, 7]) n = d.popleft() while n <= N: if len(set(list(str(n)))) == 3: ans += 1 for num in [3, 5, 7]: new = int(str(n) + str(num)) d.append(new) n = d.popl...
from collections import deque def solve(): N = int(eval(input())) ans = 0 d = deque([3, 5, 7]) while len(d): n = d.popleft() for i in range(3, 8, 2): a = n * 10 + i if a <= N: if len(set(list(str(a)))) == 3: ans += 1 ...
false
6.25
[ "-N = int(eval(input()))", "-def solve(N):", "+def solve():", "+ N = int(eval(input()))", "- n = d.popleft()", "- while n <= N:", "- if len(set(list(str(n)))) == 3:", "- ans += 1", "- for num in [3, 5, 7]:", "- new = int(str(n) + str(num))", "- ...
false
0.311843
0.106296
2.933726
[ "s973683311", "s419033346" ]
u707500405
p03452
python
s652941294
s920807510
1,985
1,078
111,128
72,092
Accepted
Accepted
45.69
from collections import deque class Edge: def __init__(self, t, w): self.to = t self.ew = w class Graph: def __init__(self, N): self.nw = [-1] * N self.al = [[] for i in range(N)] def add_edge(self, fr, to, weight): self.al[fr].append(Edge(to, weight)) self.al[to].append(Edge(fr, -weight...
from collections import deque def dfs(s, al, nw, used): nw[s] = 0 q = deque([s]) used.add(s) while q: h = q.popleft() for to, ew in al[h]: if to in used: if nw[h] + ew != nw[to]: return False continue used.add(to) nw[to] = nw[h] + ew q.appendleft(to) return True def...
52
39
1,004
716
from collections import deque class Edge: def __init__(self, t, w): self.to = t self.ew = w class Graph: def __init__(self, N): self.nw = [-1] * N self.al = [[] for i in range(N)] def add_edge(self, fr, to, weight): self.al[fr].append(Edge(to, weight)) se...
from collections import deque def dfs(s, al, nw, used): nw[s] = 0 q = deque([s]) used.add(s) while q: h = q.popleft() for to, ew in al[h]: if to in used: if nw[h] + ew != nw[to]: return False continue used.add(...
false
25
[ "-class Edge:", "- def __init__(self, t, w):", "- self.to = t", "- self.ew = w", "-", "-", "-class Graph:", "- def __init__(self, N):", "- self.nw = [-1] * N", "- self.al = [[] for i in range(N)]", "-", "- def add_edge(self, fr, to, weight):", "- s...
false
0.047109
0.10273
0.45857
[ "s652941294", "s920807510" ]
u808429775
p00164
python
s028453690
s295894971
30
20
5,648
5,644
Accepted
Accepted
33.33
from itertools import cycle INITIALIZE = 32 while True: input_count = int(eval(input())) if input_count == 0: break get_list = [int(item) for item in input().split(" ")] ohajiki = INITIALIZE output = [] for get_count in cycle(get_list): ohajiki -= (ohaji...
from itertools import cycle INITIALIZE = 32 while True: input_count = int(eval(input())) if input_count == 0: break get_list = [int(item) for item in input().split(" ")] ohajiki = INITIALIZE output = [] for get_count in cycle(get_list): ohajiki -= (ohaji...
31
28
606
505
from itertools import cycle INITIALIZE = 32 while True: input_count = int(eval(input())) if input_count == 0: break get_list = [int(item) for item in input().split(" ")] ohajiki = INITIALIZE output = [] for get_count in cycle(get_list): ohajiki -= (ohajiki - 1) % 5 outpu...
from itertools import cycle INITIALIZE = 32 while True: input_count = int(eval(input())) if input_count == 0: break get_list = [int(item) for item in input().split(" ")] ohajiki = INITIALIZE output = [] for get_count in cycle(get_list): ohajiki -= (ohajiki - 1) % 5 print...
false
9.677419
[ "- output.append(ohajiki)", "+ print(ohajiki)", "- output.append(ohajiki)", "+ print(ohajiki)", "- output.append(0)", "+ print((0))", "- output = [str(item) for item in output]", "- print((\"\\n\".join(output)))" ]
false
0.157905
0.050763
3.11063
[ "s028453690", "s295894971" ]
u437638594
p03476
python
s002420308
s732560238
1,662
939
14,648
4,212
Accepted
Accepted
43.5
import numpy as np import bisect def prime_number(num): if num == 0 or num == 1: return False if num > 2 and num % 2 == 0: return False for i in range(3, int(np.sqrt(num)+1)): if num % i == 0: return False return True def check(num): if prime_number(num) and p...
import bisect a = [True] * 100001 a[0] = False a[1] = False p = [] for i in range(2, 100001): if a[i]: for j in range(i * 2, 100001, i): a[j] = False if i % 2 != 0 and a[(i + 1) // 2]: p.append(i) q = int(eval(input())) for i in range(q): l, r = list(map(int,...
32
15
676
391
import numpy as np import bisect def prime_number(num): if num == 0 or num == 1: return False if num > 2 and num % 2 == 0: return False for i in range(3, int(np.sqrt(num) + 1)): if num % i == 0: return False return True def check(num): if prime_number(num) and...
import bisect a = [True] * 100001 a[0] = False a[1] = False p = [] for i in range(2, 100001): if a[i]: for j in range(i * 2, 100001, i): a[j] = False if i % 2 != 0 and a[(i + 1) // 2]: p.append(i) q = int(eval(input())) for i in range(q): l, r = list(map(int, input().spl...
false
53.125
[ "-import numpy as np", "-", "-def prime_number(num):", "- if num == 0 or num == 1:", "- return False", "- if num > 2 and num % 2 == 0:", "- return False", "- for i in range(3, int(np.sqrt(num) + 1)):", "- if num % i == 0:", "- return False", "- return ...
false
0.545584
0.073869
7.385796
[ "s002420308", "s732560238" ]
u066413086
p02679
python
s652437291
s181890900
1,666
622
65,084
81,424
Accepted
Accepted
62.67
from collections import defaultdict def gcd(x, y): if y == 0: return x else: return gcd(y, x % y) def main(): MOD = 1000000007 N = int(eval(input())) # Ai * Aj + Bi * Bj = 0 # -> Ai * Aj = -Bi * Bj # -> (Ai/Bi) = -(Aj/Bj) # のとき、そのイワシ同士は入れられない # そこで、...
from collections import defaultdict import math import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def gcd(x, y): if y == 0: return x else: return gcd(y, x % y) def main(): MOD = 1000000007 N = int(readl...
88
95
2,229
2,442
from collections import defaultdict def gcd(x, y): if y == 0: return x else: return gcd(y, x % y) def main(): MOD = 1000000007 N = int(eval(input())) # Ai * Aj + Bi * Bj = 0 # -> Ai * Aj = -Bi * Bj # -> (Ai/Bi) = -(Aj/Bj) # のとき、そのイワシ同士は入れられない # そこで、 Ci = Ai/Bi を約分...
from collections import defaultdict import math import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def gcd(x, y): if y == 0: return x else: return gcd(y, x % y) def main(): MOD = 1000000007 N = int(readline()) m = ...
false
7.368421
[ "+import math", "+import sys", "+", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "- N = int(eval(input()))", "+ N = int(readline())", "+ m = list(map(int, read().split()))", "+ A, B = list(zip(*list(zip(m, m))))", ...
false
0.038162
0.047309
0.806638
[ "s652437291", "s181890900" ]
u633068244
p00083
python
s475346008
s028037755
20
10
4,212
4,208
Accepted
Accepted
50
while True: try: y, m, d = list(map(int, input().split())) ymd = 10000*y + 100*m + d if ymd < 18680908: print("pre-meiji") elif ymd < 19120730: print("meiji",y-1867,m,d) elif ymd < 19261225: print("taisho",y-1911,m,d) elif...
def check(ymd): if ymd < 18680908: print("pre-meiji") elif ymd < 19120730: print("meiji",y-1867,m,d) elif ymd < 19261225: print("taisho",y-1911,m,d) elif ymd < 19890108: print("showa",y-1925,m,d) else: print("h...
16
19
451
490
while True: try: y, m, d = list(map(int, input().split())) ymd = 10000 * y + 100 * m + d if ymd < 18680908: print("pre-meiji") elif ymd < 19120730: print("meiji", y - 1867, m, d) elif ymd < 19261225: print("taisho", y - 1911, m, d) ...
def check(ymd): if ymd < 18680908: print("pre-meiji") elif ymd < 19120730: print("meiji", y - 1867, m, d) elif ymd < 19261225: print("taisho", y - 1911, m, d) elif ymd < 19890108: print("showa", y - 1925, m, d) else: print("heisei", y - 1988, m, d) while Tru...
false
15.789474
[ "+def check(ymd):", "+ if ymd < 18680908:", "+ print(\"pre-meiji\")", "+ elif ymd < 19120730:", "+ print(\"meiji\", y - 1867, m, d)", "+ elif ymd < 19261225:", "+ print(\"taisho\", y - 1911, m, d)", "+ elif ymd < 19890108:", "+ print(\"showa\", y - 1925, m, d)...
false
0.151785
0.039892
3.804897
[ "s475346008", "s028037755" ]
u815763296
p02830
python
s983912813
s690166852
29
25
9,032
9,044
Accepted
Accepted
13.79
N = int(eval(input())) S, T = input().split() ans = [0]*(N*2) Scount = 0 Tcount = 1 for i in S: ans[Scount] = i Scount += 2 for j in T: ans[Tcount] = j Tcount += 2 print((''.join(ans)))
N = int(eval(input())) S, T = input().split() S = list(S) T = list(T) ans = "" for i in range(N): ans += S[i] ans += T[i] print(ans)
13
9
207
143
N = int(eval(input())) S, T = input().split() ans = [0] * (N * 2) Scount = 0 Tcount = 1 for i in S: ans[Scount] = i Scount += 2 for j in T: ans[Tcount] = j Tcount += 2 print(("".join(ans)))
N = int(eval(input())) S, T = input().split() S = list(S) T = list(T) ans = "" for i in range(N): ans += S[i] ans += T[i] print(ans)
false
30.769231
[ "-ans = [0] * (N * 2)", "-Scount = 0", "-Tcount = 1", "-for i in S:", "- ans[Scount] = i", "- Scount += 2", "-for j in T:", "- ans[Tcount] = j", "- Tcount += 2", "-print((\"\".join(ans)))", "+S = list(S)", "+T = list(T)", "+ans = \"\"", "+for i in range(N):", "+ ans += S[i...
false
0.041186
0.043137
0.954774
[ "s983912813", "s690166852" ]
u560889512
p03078
python
s223226634
s375676848
901
38
9,524
5,104
Accepted
Accepted
95.78
x, y, z, k = list(map(int, input().split())) xlist = sorted(list(map(int,input().split())), reverse=True)[:min(x, k)] ylist = sorted(list(map(int,input().split())), reverse=True)[:min(y, k)] zlist = sorted(list(map(int,input().split())), reverse=True)[:min(z, k)] anslist = [0] for i in range(min(x, k)): ...
import heapq X,Y,Z,K=list(map(int,input().split(' '))) A=sorted(list(map(int,input().split(' '))))[::-1] B=sorted(list(map(int,input().split(' '))))[::-1] C=sorted(list(map(int,input().split(' '))))[::-1] default=A[0]+B[0]+C[0] A=[A[0]-A[i] for i in range(len(A))] B=[B[0]-B[i] for i in range(len(B))] C=[C[0]-...
19
29
609
892
x, y, z, k = list(map(int, input().split())) xlist = sorted(list(map(int, input().split())), reverse=True)[: min(x, k)] ylist = sorted(list(map(int, input().split())), reverse=True)[: min(y, k)] zlist = sorted(list(map(int, input().split())), reverse=True)[: min(z, k)] anslist = [0] for i in range(min(x, k)): for j...
import heapq X, Y, Z, K = list(map(int, input().split(" "))) A = sorted(list(map(int, input().split(" "))))[::-1] B = sorted(list(map(int, input().split(" "))))[::-1] C = sorted(list(map(int, input().split(" "))))[::-1] default = A[0] + B[0] + C[0] A = [A[0] - A[i] for i in range(len(A))] B = [B[0] - B[i] for i in ran...
false
34.482759
[ "-x, y, z, k = list(map(int, input().split()))", "-xlist = sorted(list(map(int, input().split())), reverse=True)[: min(x, k)]", "-ylist = sorted(list(map(int, input().split())), reverse=True)[: min(y, k)]", "-zlist = sorted(list(map(int, input().split())), reverse=True)[: min(z, k)]", "-anslist = [0]", "-...
false
0.046183
0.043171
1.069768
[ "s223226634", "s375676848" ]
u075304271
p03363
python
s565860373
s286454951
284
180
51,392
45,400
Accepted
Accepted
36.62
import numpy as np import math import collections import fractions import itertools def solve(): n = int(eval(input())) a = list(map(int, input().split())) ruiseki = [0] ans = 0 for i in range(n): ruiseki.append(ruiseki[i]+a[i]) c = list(collections.Counter(ruiseki).values(...
import math import collections import fractions import itertools def solve(): n = int(eval(input())) a = list(map(int, input().split())) ruiseki = [0] ans = 0 for i in range(n): ruiseki.append(ruiseki[i]+a[i]) c = collections.Counter(ruiseki) for i in c: ans +=...
22
20
463
406
import numpy as np import math import collections import fractions import itertools def solve(): n = int(eval(input())) a = list(map(int, input().split())) ruiseki = [0] ans = 0 for i in range(n): ruiseki.append(ruiseki[i] + a[i]) c = list(collections.Counter(ruiseki).values()) for...
import math import collections import fractions import itertools def solve(): n = int(eval(input())) a = list(map(int, input().split())) ruiseki = [0] ans = 0 for i in range(n): ruiseki.append(ruiseki[i] + a[i]) c = collections.Counter(ruiseki) for i in c: ans += c[i] * (c[...
false
9.090909
[ "-import numpy as np", "- c = list(collections.Counter(ruiseki).values())", "+ c = collections.Counter(ruiseki)", "- ans += i * (i - 1) // 2", "+ ans += c[i] * (c[i] - 1) // 2", "-# fooooooooooooooo!! yattaze!! AC!!" ]
false
0.038685
0.119354
0.324119
[ "s565860373", "s286454951" ]
u724687935
p02830
python
s690050982
s735938919
167
17
38,256
2,940
Accepted
Accepted
89.82
N = int(eval(input())) S, T = input().split() ans = '' for i in range(N): ans += S[i] ans += T[i] print(ans)
N = int(eval(input())) S, T = input().split() ans = [] for i in range(N): ans.append(S[i]) ans.append(T[i]) print((''.join(ans)))
10
9
123
140
N = int(eval(input())) S, T = input().split() ans = "" for i in range(N): ans += S[i] ans += T[i] print(ans)
N = int(eval(input())) S, T = input().split() ans = [] for i in range(N): ans.append(S[i]) ans.append(T[i]) print(("".join(ans)))
false
10
[ "-ans = \"\"", "+ans = []", "- ans += S[i]", "- ans += T[i]", "-print(ans)", "+ ans.append(S[i])", "+ ans.append(T[i])", "+print((\"\".join(ans)))" ]
false
0.04372
0.043529
1.00439
[ "s690050982", "s735938919" ]
u790710233
p03805
python
s886622505
s966302146
55
44
3,316
3,316
Accepted
Accepted
20
from itertools import permutations n, m = list(map(int, input().split())) edges = [tuple(map(int, input().split())) for _ in range(m)] ans = 0 for i in permutations(list(range(2, n+1)), n-1): load = [1]+list(i) ans += sum(1 for edge in zip(load, load[1:]) if tuple(sorted(edge)) in edges)...
from itertools import permutations n, m = list(map(int, input().split())) edges = {tuple(map(int, input().split())) for _ in range(m)} ans = 0 for i in permutations(list(range(2, n+1)), n-1): load = [1]+list(i) ans += sum(1 for edge in zip(load, load[1:]) if tuple(sorted(edge)) in edges)...
10
10
328
328
from itertools import permutations n, m = list(map(int, input().split())) edges = [tuple(map(int, input().split())) for _ in range(m)] ans = 0 for i in permutations(list(range(2, n + 1)), n - 1): load = [1] + list(i) ans += ( sum(1 for edge in zip(load, load[1:]) if tuple(sorted(edge)) in edges) == n -...
from itertools import permutations n, m = list(map(int, input().split())) edges = {tuple(map(int, input().split())) for _ in range(m)} ans = 0 for i in permutations(list(range(2, n + 1)), n - 1): load = [1] + list(i) ans += ( sum(1 for edge in zip(load, load[1:]) if tuple(sorted(edge)) in edges) == n -...
false
0
[ "-edges = [tuple(map(int, input().split())) for _ in range(m)]", "+edges = {tuple(map(int, input().split())) for _ in range(m)}" ]
false
0.045608
0.08852
0.515233
[ "s886622505", "s966302146" ]
u934442292
p02624
python
s698971265
s410566206
1,957
574
189,164
108,968
Accepted
Accepted
70.67
import sys import numba as nb input = sys.stdin.readline @nb.njit("i8(i8)") def solve(n): table = [0] * (n + 1) for i in range(1, n + 1): for j in range(i, n + 1, i): table[j] += 1 ans = 0 for i, v in enumerate(table): ans += i * v return ans def ...
import sys import numba as nb input = sys.stdin.readline @nb.njit("i8(i8)") def solve(n): ans = 0 for i in range(1, n + 1): m = n // i ans += i * m * (m + 1) // 2 return ans def main(): N = int(eval(input())) ans = solve(N) print(ans) if __name__...
29
26
434
342
import sys import numba as nb input = sys.stdin.readline @nb.njit("i8(i8)") def solve(n): table = [0] * (n + 1) for i in range(1, n + 1): for j in range(i, n + 1, i): table[j] += 1 ans = 0 for i, v in enumerate(table): ans += i * v return ans def main(): N = int(...
import sys import numba as nb input = sys.stdin.readline @nb.njit("i8(i8)") def solve(n): ans = 0 for i in range(1, n + 1): m = n // i ans += i * m * (m + 1) // 2 return ans def main(): N = int(eval(input())) ans = solve(N) print(ans) if __name__ == "__main__": main()
false
10.344828
[ "- table = [0] * (n + 1)", "+ ans = 0", "- for j in range(i, n + 1, i):", "- table[j] += 1", "- ans = 0", "- for i, v in enumerate(table):", "- ans += i * v", "+ m = n // i", "+ ans += i * m * (m + 1) // 2" ]
false
0.037526
0.036346
1.032465
[ "s698971265", "s410566206" ]
u489959379
p03252
python
s972070106
s092372853
108
56
3,632
3,632
Accepted
Accepted
48.15
s = str(eval(input())) t = str(eval(input())) d = {} for k, v in zip(s, t): if d.get(k) != None and d.get(k) != v: print("No") exit() d[k] = v if len(set(d.values())) == len(d): print("Yes") else: print("No")
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): S = eval(input()) T = eval(input()) dict = {} for s, t in zip(S, T): if dict.get(t) is not None and dict[t] != s: print("No") exit() else: ...
13
27
241
473
s = str(eval(input())) t = str(eval(input())) d = {} for k, v in zip(s, t): if d.get(k) != None and d.get(k) != v: print("No") exit() d[k] = v if len(set(d.values())) == len(d): print("Yes") else: print("No")
import sys sys.setrecursionlimit(10**7) f_inf = float("inf") mod = 10**9 + 7 def resolve(): S = eval(input()) T = eval(input()) dict = {} for s, t in zip(S, T): if dict.get(t) is not None and dict[t] != s: print("No") exit() else: dict[t] = s if...
false
51.851852
[ "-s = str(eval(input()))", "-t = str(eval(input()))", "-d = {}", "-for k, v in zip(s, t):", "- if d.get(k) != None and d.get(k) != v:", "+import sys", "+", "+sys.setrecursionlimit(10**7)", "+f_inf = float(\"inf\")", "+mod = 10**9 + 7", "+", "+", "+def resolve():", "+ S = eval(input()...
false
0.08538
0.066377
1.286286
[ "s972070106", "s092372853" ]
u585482323
p02923
python
s393428107
s017871512
256
236
60,144
59,632
Accepted
Accepted
7.81
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline()...
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [lis...
80
46
1,380
1,050
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS(): return [list(x) for x in sys.stdin...
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS(): r...
false
42.5
[ "+from itertools import permutations, accumulate", "-import random", "-# A", "-def A():", "- s = S()", "- t = S()", "- ans = 0", "- for i in range(len(s)):", "- if s[i] == t[i]:", "- ans += 1", "- print(ans)", "- return", "-# B", "-def B():", "- a, ...
false
0.037525
0.035722
1.05048
[ "s393428107", "s017871512" ]
u729133443
p03017
python
s486772703
s209815559
27
18
3,704
3,764
Accepted
Accepted
33.33
n,a,b,c,d=list(map(int,input().split()));s=eval(input());print(('YNeos'[not'...'in s[b-2:d+1]and d<c or'##'in s[a:c]+s[b:d]::2]))
n,a,b,c,d=list(map(int,input().split()));s=eval(input());print(('YNeos'[not'...'*(d<c)in s[b-2:d+1]or'##'in s[a:c]+s[b:d]::2]))
1
1
115
113
n, a, b, c, d = list(map(int, input().split())) s = eval(input()) print( ("YNeos"[not "..." in s[b - 2 : d + 1] and d < c or "##" in s[a:c] + s[b:d] :: 2]) )
n, a, b, c, d = list(map(int, input().split())) s = eval(input()) print( ("YNeos"[not "..." * (d < c) in s[b - 2 : d + 1] or "##" in s[a:c] + s[b:d] :: 2]) )
false
0
[ "- (\"YNeos\"[not \"...\" in s[b - 2 : d + 1] and d < c or \"##\" in s[a:c] + s[b:d] :: 2])", "+ (\"YNeos\"[not \"...\" * (d < c) in s[b - 2 : d + 1] or \"##\" in s[a:c] + s[b:d] :: 2])" ]
false
0.049097
0.046407
1.057955
[ "s486772703", "s209815559" ]
u729133443
p03635
python
s599452865
s038813877
163
17
38,256
2,940
Accepted
Accepted
89.57
print((eval('('+input().replace(' ','-1)*(')+'-1)')))
s=1 for i in input().split():s*=~-int(i) print(s)
1
3
51
51
print((eval("(" + input().replace(" ", "-1)*(") + "-1)")))
s = 1 for i in input().split(): s *= ~-int(i) print(s)
false
66.666667
[ "-print((eval(\"(\" + input().replace(\" \", \"-1)*(\") + \"-1)\")))", "+s = 1", "+for i in input().split():", "+ s *= ~-int(i)", "+print(s)" ]
false
0.089305
0.081589
1.094569
[ "s599452865", "s038813877" ]
u371686382
p03625
python
s776543472
s505302334
163
144
22,436
18,600
Accepted
Accepted
11.66
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) counter = sorted( list(Counter(A).items()), key=lambda x:x[0], reverse=True) ans = 1 cnt = 0 for length, num in counter: if cnt >= 2: break if num >= 4 and cnt == 0: print((l...
from collections import Counter n = int(eval(input())) A = list(map(int, input().split())) # 長さと個数の辞書 length_num = Counter(A) # 長い順からの長さのリスト lengths = sorted(list(length_num.keys()), reverse=True) ans = 0 sides = [] # 長い辺の順にループ for l in lengths: if length_num[l] >= 4: ans = max(ans, l * l) ...
26
24
445
447
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) counter = sorted(list(Counter(A).items()), key=lambda x: x[0], reverse=True) ans = 1 cnt = 0 for length, num in counter: if cnt >= 2: break if num >= 4 and cnt == 0: print((length**2)) exit() ...
from collections import Counter n = int(eval(input())) A = list(map(int, input().split())) # 長さと個数の辞書 length_num = Counter(A) # 長い順からの長さのリスト lengths = sorted(list(length_num.keys()), reverse=True) ans = 0 sides = [] # 長い辺の順にループ for l in lengths: if length_num[l] >= 4: ans = max(ans, l * l) if length_nu...
false
7.692308
[ "-N = int(eval(input()))", "+n = int(eval(input()))", "-counter = sorted(list(Counter(A).items()), key=lambda x: x[0], reverse=True)", "-ans = 1", "-cnt = 0", "-for length, num in counter:", "- if cnt >= 2:", "+# 長さと個数の辞書", "+length_num = Counter(A)", "+# 長い順からの長さのリスト", "+lengths = sorted(lis...
false
0.036157
0.035276
1.024981
[ "s776543472", "s505302334" ]
u729133443
p02610
python
s119786449
s490250704
1,578
849
155,228
49,192
Accepted
Accepted
46.2
from heapq import* s=sorted def f(x): s,n,*h=0,len(x) while n: while x and x[-1][0]>=n:k,l,r=x.pop();heappush(h,(r-l,l,r)) if h:s+=heappop(h)[1] n-=1 return s+sum(r for*_,r in x+h) z=open(0).read().split() i=1 while i<len(z): n,x,*y=int(z[i]),[];i+=1 for k,l,r in zip(*[list(map(int,z[i:i+n*3]))]...
from heapq import* i=input s=sorted def f(x): s,n,*h=0,len(x) while n: while x and x[-1][0]>=n:k,l,r=x.pop();heappush(h,(r-l,l,r)) if h:s+=heappop(h)[1] n-=1 return s+sum(r for*_,r in x+h) for _ in'_'*int(i()): n,x,*y=int(i()),[] for _ in'_'*n: k,l,r=list(map(int,i().split())) if l>r:x+=(k,...
17
17
394
366
from heapq import * s = sorted def f(x): s, n, *h = 0, len(x) while n: while x and x[-1][0] >= n: k, l, r = x.pop() heappush(h, (r - l, l, r)) if h: s += heappop(h)[1] n -= 1 return s + sum(r for *_, r in x + h) z = open(0).read().split() i = ...
from heapq import * i = input s = sorted def f(x): s, n, *h = 0, len(x) while n: while x and x[-1][0] >= n: k, l, r = x.pop() heappush(h, (r - l, l, r)) if h: s += heappop(h)[1] n -= 1 return s + sum(r for *_, r in x + h) for _ in "_" * int(i(...
false
0
[ "+i = input", "-z = open(0).read().split()", "-i = 1", "-while i < len(z):", "- n, x, *y = int(z[i]), []", "- i += 1", "- for k, l, r in zip(*[list(map(int, z[i : i + n * 3]))] * 3):", "+for _ in \"_\" * int(i()):", "+ n, x, *y = int(i()), []", "+ for _ in \"_\" * n:", "+ k...
false
0.035881
0.036538
0.982012
[ "s119786449", "s490250704" ]