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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u741397536 | p02936 | python | s979001118 | s420582608 | 1,898 | 951 | 107,084 | 96,076 | Accepted | Accepted | 49.89 | N, Q = map(int, input().split())
F = [0 for i in range(N)]
T = [[]for i in range(N)]
for i in range(N-1):
a, b = map(int, input().split())
T[a-1].append(b-1)
T[b-1].append(a-1)
X = [0 for i in range(N)]
for i in range(Q):
p, x = map(int, input().split())
X[p-1] += x
ans = [X[i] fo... | import sys
input = sys.stdin.readline
N, Q = map(int, input().split())
F = [0 for i in range(N)]
T = [[]for i in range(N)]
for i in range(N-1):
a, b = map(int, input().split())
T[a-1].append(b-1)
T[b-1].append(a-1)
X = [0 for i in range(N)]
for i in range(Q):
p, x = map(int, input().s... | 25 | 28 | 537 | 579 | N, Q = map(int, input().split())
F = [0 for i in range(N)]
T = [[] for i in range(N)]
for i in range(N - 1):
a, b = map(int, input().split())
T[a - 1].append(b - 1)
T[b - 1].append(a - 1)
X = [0 for i in range(N)]
for i in range(Q):
p, x = map(int, input().split())
X[p - 1] += x
ans = [X[i] for i in... | import sys
input = sys.stdin.readline
N, Q = map(int, input().split())
F = [0 for i in range(N)]
T = [[] for i in range(N)]
for i in range(N - 1):
a, b = map(int, input().split())
T[a - 1].append(b - 1)
T[b - 1].append(a - 1)
X = [0 for i in range(N)]
for i in range(Q):
p, x = map(int, input().split())... | false | 10.714286 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.057796 | 0.115611 | 0.499919 | [
"s979001118",
"s420582608"
] |
u514118270 | p02756 | python | s424375091 | s667071648 | 514 | 464 | 9,460 | 8,420 | Accepted | Accepted | 9.73 | from collections import deque
a = list(eval(input()))
Q = int(eval(input()))
d = deque(a)
ans = 0
for i in range(Q):
b = list(input().split())
if len(b) == 1:
ans += 1
elif b[1] == "1" and ans % 2 == 0:
d.appendleft(b[2])
elif b[1] == "1" and ans % 2 == 1:
d.append(b[2])
elif b[1] == ... | from collections import deque
S = deque(list(eval(input())))
Q = int(eval(input()))
flag = 1
for i in range(Q):
a = list(input().split())
if a[0] == '1':
if flag == 0:
flag = 1
else:
flag = 0
else:
if a[1] == '1':
if flag == 1:
... | 20 | 27 | 463 | 603 | from collections import deque
a = list(eval(input()))
Q = int(eval(input()))
d = deque(a)
ans = 0
for i in range(Q):
b = list(input().split())
if len(b) == 1:
ans += 1
elif b[1] == "1" and ans % 2 == 0:
d.appendleft(b[2])
elif b[1] == "1" and ans % 2 == 1:
d.append(b[2])
eli... | from collections import deque
S = deque(list(eval(input())))
Q = int(eval(input()))
flag = 1
for i in range(Q):
a = list(input().split())
if a[0] == "1":
if flag == 0:
flag = 1
else:
flag = 0
else:
if a[1] == "1":
if flag == 1:
S.a... | false | 25.925926 | [
"-a = list(eval(input()))",
"+S = deque(list(eval(input())))",
"-d = deque(a)",
"-ans = 0",
"+flag = 1",
"- b = list(input().split())",
"- if len(b) == 1:",
"- ans += 1",
"- elif b[1] == \"1\" and ans % 2 == 0:",
"- d.appendleft(b[2])",
"- elif b[1] == \"1\" and ans % 2... | false | 0.109849 | 0.044527 | 2.467 | [
"s424375091",
"s667071648"
] |
u150984829 | p02411 | python | s436861774 | s598763566 | 30 | 20 | 5,596 | 5,596 | Accepted | Accepted | 33.33 | while 1:
m,f,r=list(map(int,input().split()));s=m+f
if m==f==r<0:break
if(m*f<0)|(s<30):print('F')
elif(s<50)*(r<50):print('D')
elif s<65:print('C')
elif s<80:print('B')
else:print('A')
| while 1:
m,f,r=list(map(int,input().split()));s=m+f
if m==f==r<0:break
if m*f<0 or s<30:print('F')
elif(s<50)*(r<50):print('D')
elif s<65:print('C')
elif s<80:print('B')
else:print('A')
| 8 | 8 | 194 | 194 | while 1:
m, f, r = list(map(int, input().split()))
s = m + f
if m == f == r < 0:
break
if (m * f < 0) | (s < 30):
print("F")
elif (s < 50) * (r < 50):
print("D")
elif s < 65:
print("C")
elif s < 80:
print("B")
else:
print("A")
| while 1:
m, f, r = list(map(int, input().split()))
s = m + f
if m == f == r < 0:
break
if m * f < 0 or s < 30:
print("F")
elif (s < 50) * (r < 50):
print("D")
elif s < 65:
print("C")
elif s < 80:
print("B")
else:
print("A")
| false | 0 | [
"- if (m * f < 0) | (s < 30):",
"+ if m * f < 0 or s < 30:"
] | false | 0.108268 | 0.043603 | 2.48307 | [
"s436861774",
"s598763566"
] |
u346812984 | p02720 | python | s977934363 | s237161943 | 145 | 115 | 19,552 | 15,340 | Accepted | Accepted | 20.69 | import sys
def input():
return sys.stdin.readline().strip()
def main():
K = int(eval(input()))
ans = list("123456789")
tmp = ans.copy()
while True:
tmp2 = []
for t in tmp:
for i in range(int(t[-1]) - 1, int(t[-1]) + 2):
if 0 <= i < 10:
... | import collections
import sys
def input():
return sys.stdin.readline().strip()
def bfs(K):
q = collections.deque(list("123456789"))
ans = list("123456789")
while len(ans) < K:
n = q.popleft()
for i in range(int(n[-1]) - 1, int(n[-1]) + 2):
if 0 <= i < 10:
... | 27 | 28 | 520 | 523 | import sys
def input():
return sys.stdin.readline().strip()
def main():
K = int(eval(input()))
ans = list("123456789")
tmp = ans.copy()
while True:
tmp2 = []
for t in tmp:
for i in range(int(t[-1]) - 1, int(t[-1]) + 2):
if 0 <= i < 10:
... | import collections
import sys
def input():
return sys.stdin.readline().strip()
def bfs(K):
q = collections.deque(list("123456789"))
ans = list("123456789")
while len(ans) < K:
n = q.popleft()
for i in range(int(n[-1]) - 1, int(n[-1]) + 2):
if 0 <= i < 10:
... | false | 3.571429 | [
"+import collections",
"+def bfs(K):",
"+ q = collections.deque(list(\"123456789\"))",
"+ ans = list(\"123456789\")",
"+ while len(ans) < K:",
"+ n = q.popleft()",
"+ for i in range(int(n[-1]) - 1, int(n[-1]) + 2):",
"+ if 0 <= i < 10:",
"+ q.append(n... | false | 0.240235 | 0.132194 | 1.817291 | [
"s977934363",
"s237161943"
] |
u027685417 | p02720 | python | s388583677 | s798633669 | 355 | 56 | 11,056 | 13,520 | Accepted | Accepted | 84.23 | k = int(eval(input()))
def dfs(now, depth):
STACK.append(str(now))
if depth == limit:
LUNLUN.append(int("".join(STACK)))
else:
for next in range(now - 1, now + 2):
if next == -1 or next == 10:
continue
dfs(next, depth + 1)
STACK.pop()
... | k = int(eval(input()))
L = list(range(10))
i = 1
while len(L) <= k:
Li = L[i]
a = Li % 10
for b in range(a - 1, a + 2):
if b < 0 or b > 9:
continue
L.append(Li * 10 + b)
i += 1
print((L[k]))
| 20 | 14 | 435 | 242 | k = int(eval(input()))
def dfs(now, depth):
STACK.append(str(now))
if depth == limit:
LUNLUN.append(int("".join(STACK)))
else:
for next in range(now - 1, now + 2):
if next == -1 or next == 10:
continue
dfs(next, depth + 1)
STACK.pop()
LUNLUN = ... | k = int(eval(input()))
L = list(range(10))
i = 1
while len(L) <= k:
Li = L[i]
a = Li % 10
for b in range(a - 1, a + 2):
if b < 0 or b > 9:
continue
L.append(Li * 10 + b)
i += 1
print((L[k]))
| false | 30 | [
"-",
"-",
"-def dfs(now, depth):",
"- STACK.append(str(now))",
"- if depth == limit:",
"- LUNLUN.append(int(\"\".join(STACK)))",
"- else:",
"- for next in range(now - 1, now + 2):",
"- if next == -1 or next == 10:",
"- continue",
"- dfs... | false | 0.37167 | 0.036728 | 10.119632 | [
"s388583677",
"s798633669"
] |
u621935300 | p02702 | python | s180439957 | s833906592 | 393 | 339 | 85,628 | 85,632 | Accepted | Accepted | 13.74 | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
N=sys.stdin.readline().strip()
N=N[::-1]
#Lの先頭の0を入れるのは、何も数を選択しない状態はmod2019がゼロになるの意味
#19行目でx=0の際に、ans+=C[x]で1足されることになるので都合が良い
L=[0]
val=0
for i,x in enumerate(N):
val+=pow(10,i,2019)*int(x)
L.append(val%2019)
C=defaultdict(la... | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
S=sys.stdin.readline().strip()
S=S[::-1]
#Lの先頭の0を入れるのは、何も数を選択しない状態はmod2019がゼロになるの意味
#19行目でx=0の際に、ans+=C[x]で1足されることになるので都合が良い
L=[0]
val=0
for i,x in enumerate(S):
val+=pow(10,i,2019)*int(x)
L.append(val%2019)
C=defaultdict(la... | 20 | 20 | 475 | 475 | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
N = sys.stdin.readline().strip()
N = N[::-1]
# Lの先頭の0を入れるのは、何も数を選択しない状態はmod2019がゼロになるの意味
# 19行目でx=0の際に、ans+=C[x]で1足されることになるので都合が良い
L = [0]
val = 0
for i, x in enumerate(N):
val += pow(10, i, 2019) * int(x)
L.append(val % 2019)
C = defaultdi... | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict
S = sys.stdin.readline().strip()
S = S[::-1]
# Lの先頭の0を入れるのは、何も数を選択しない状態はmod2019がゼロになるの意味
# 19行目でx=0の際に、ans+=C[x]で1足されることになるので都合が良い
L = [0]
val = 0
for i, x in enumerate(S):
val += pow(10, i, 2019) * int(x)
L.append(val % 2019)
C = defaultdi... | false | 0 | [
"-N = sys.stdin.readline().strip()",
"-N = N[::-1]",
"+S = sys.stdin.readline().strip()",
"+S = S[::-1]",
"-for i, x in enumerate(N):",
"+for i, x in enumerate(S):"
] | false | 0.045821 | 0.047247 | 0.969815 | [
"s180439957",
"s833906592"
] |
u156815136 | p03799 | python | s321085397 | s824439407 | 22 | 20 | 9,164 | 3,316 | Accepted | Accepted | 9.09 | n,m = list(map(int,input().split()))
cnt = 0
if m // 2 >= n:
cnt += n
m -= n*2
else:
cnt += m//2
n -= m//2
m -= m
#print(n,m)
cnt += m//4
print(cnt)
| #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict
#import bisect
#
# d =... | 14 | 37 | 178 | 767 | n, m = list(map(int, input().split()))
cnt = 0
if m // 2 >= n:
cnt += n
m -= n * 2
else:
cnt += m // 2
n -= m // 2
m -= m
# print(n,m)
cnt += m // 4
print(cnt)
| # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from fractions import gcd
# from itertools import combinations # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict
# import bisect
#
# d =... | false | 62.162162 | [
"-n, m = list(map(int, input().split()))",
"+# from statistics import median",
"+# import collections",
"+# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]",
"+# from fractions import gcd",
"+# from itertools import combinations # (string,3) 3回",
"+# from collections im... | false | 0.070262 | 0.047966 | 1.464838 | [
"s321085397",
"s824439407"
] |
u941753895 | p03286 | python | s466722813 | s613087628 | 52 | 39 | 5,840 | 5,188 | Accepted | Accepted | 25 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
de... | # https://atcoder.jp/contests/arc026/tasks/arc026_2
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdi... | 33 | 33 | 708 | 689 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) ... | # https://atcoder.jp/contests/arc026/tasks/arc026_2
import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
... | false | 0 | [
"-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy",
"+# https://atcoder.jp/contests/arc026/tasks/arc026_2",
"+import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy",
"-",
"-",
"-def LI_():",
"- return [int(x) -... | false | 0.041542 | 0.040992 | 1.013406 | [
"s466722813",
"s613087628"
] |
u358894498 | p02576 | python | s124094757 | s070358058 | 33 | 29 | 9,092 | 9,148 | Accepted | Accepted | 12.12 | n,x,k=list(map(int,input().split(' ')))
temp=k
ans=0
while n>0:
n-=x
ans +=temp
k+=k
print(ans) | n,x,k=list(map(int,input().split(' ')))
print((int((n+x-1)/x)*k))
| 10 | 3 | 112 | 61 | n, x, k = list(map(int, input().split(" ")))
temp = k
ans = 0
while n > 0:
n -= x
ans += temp
k += k
print(ans)
| n, x, k = list(map(int, input().split(" ")))
print((int((n + x - 1) / x) * k))
| false | 70 | [
"-temp = k",
"-ans = 0",
"-while n > 0:",
"- n -= x",
"- ans += temp",
"- k += k",
"-print(ans)",
"+print((int((n + x - 1) / x) * k))"
] | false | 0.124258 | 0.039191 | 3.17057 | [
"s124094757",
"s070358058"
] |
u874644572 | p02574 | python | s865747130 | s888866460 | 612 | 376 | 208,388 | 206,524 | Accepted | Accepted | 38.56 | from math import gcd
from functools import reduce
from sys import exit
# O(NlogA+AloglogA)解
MAX_A = 1000000
lowerst_prime = [0] * (MAX_A + 1) # 最小の素因数をいれる(2以上をみていけばいい)
count = [0] * (MAX_A + 1) # 約数として出てくる回数を数える
for i in range(2, MAX_A + 1): # エラトステネスの篩
if lowerst_prime[i] != 0:
continue
l... | from math import gcd
from functools import reduce
from sys import exit
# O(A+N)解
MAX_A = 1000000
lowerst_prime = [0] * (MAX_A + 1) # 最小の素因数をいれる(2以上をみていけばいい)
primes = [] # MAX_A以下の素数の集合
count = [0] * (MAX_A + 1) # 約数として出てくる回数を数える
for i in range(2, MAX_A + 1): # 線形時間で処理してくれる
if lowerst_prime[i] == 0:
... | 36 | 34 | 922 | 1,014 | from math import gcd
from functools import reduce
from sys import exit
# O(NlogA+AloglogA)解
MAX_A = 1000000
lowerst_prime = [0] * (MAX_A + 1) # 最小の素因数をいれる(2以上をみていけばいい)
count = [0] * (MAX_A + 1) # 約数として出てくる回数を数える
for i in range(2, MAX_A + 1): # エラトステネスの篩
if lowerst_prime[i] != 0:
continue
lowerst_pri... | from math import gcd
from functools import reduce
from sys import exit
# O(A+N)解
MAX_A = 1000000
lowerst_prime = [0] * (MAX_A + 1) # 最小の素因数をいれる(2以上をみていけばいい)
primes = [] # MAX_A以下の素数の集合
count = [0] * (MAX_A + 1) # 約数として出てくる回数を数える
for i in range(2, MAX_A + 1): # 線形時間で処理してくれる
if lowerst_prime[i] == 0:
low... | false | 5.555556 | [
"-# O(NlogA+AloglogA)解",
"+# O(A+N)解",
"+primes = [] # MAX_A以下の素数の集合",
"-for i in range(2, MAX_A + 1): # エラトステネスの篩",
"- if lowerst_prime[i] != 0:",
"- continue",
"- lowerst_prime[i] = i",
"- for j in range(i * i, MAX_A + 1, i): # i * iスタートでいいのは、i * bはbの約数でもあるため",
"- if lowe... | false | 0.777819 | 1.337316 | 0.581627 | [
"s865747130",
"s888866460"
] |
u620084012 | p04044 | python | s483453628 | s035062111 | 38 | 17 | 3,064 | 3,060 | Accepted | Accepted | 55.26 | N, L = list(map(int,input().split()))
S = [str(eval(input())) for _ in range(N)]
S.sort()
print(("".join(S))) | N, L = list(map(int,input().split()))
S = sorted([eval(input()) for k in range(N)])
print(("".join(S)))
| 4 | 3 | 98 | 92 | N, L = list(map(int, input().split()))
S = [str(eval(input())) for _ in range(N)]
S.sort()
print(("".join(S)))
| N, L = list(map(int, input().split()))
S = sorted([eval(input()) for k in range(N)])
print(("".join(S)))
| false | 25 | [
"-S = [str(eval(input())) for _ in range(N)]",
"-S.sort()",
"+S = sorted([eval(input()) for k in range(N)])"
] | false | 0.045398 | 0.044016 | 1.031398 | [
"s483453628",
"s035062111"
] |
u807889603 | p03854 | python | s710218498 | s508698031 | 70 | 19 | 3,188 | 3,188 | Accepted | Accepted | 72.86 | s = eval(input())
s=s[::-1] #文字列の反転
words = ["maerd", "remaerd", "esare", "resare"]
while len(s) > 4:
if s[:5] == 'maerd':
s = s[5:]
continue
elif s[:7] == 'remaerd':
s = s[7:]
continue
elif s[:5] == 'esare':
s = s[5:]
continue
elif s[:6] == '... | s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
print("NO")
else:
print("YES") | 22 | 5 | 444 | 141 | s = eval(input())
s = s[::-1] # 文字列の反転
words = ["maerd", "remaerd", "esare", "resare"]
while len(s) > 4:
if s[:5] == "maerd":
s = s[5:]
continue
elif s[:7] == "remaerd":
s = s[7:]
continue
elif s[:5] == "esare":
s = s[5:]
continue
elif s[:6] == "resare":
... | s = (
input()
.replace("eraser", "")
.replace("erase", "")
.replace("dreamer", "")
.replace("dream", "")
)
if s:
print("NO")
else:
print("YES")
| false | 77.272727 | [
"-s = eval(input())",
"-s = s[::-1] # 文字列の反転",
"-words = [\"maerd\", \"remaerd\", \"esare\", \"resare\"]",
"-while len(s) > 4:",
"- if s[:5] == \"maerd\":",
"- s = s[5:]",
"- continue",
"- elif s[:7] == \"remaerd\":",
"- s = s[7:]",
"- continue",
"- elif s[:... | false | 0.033508 | 0.036888 | 0.908374 | [
"s710218498",
"s508698031"
] |
u929569377 | p02784 | python | s370267790 | s367720067 | 44 | 40 | 13,964 | 13,964 | Accepted | Accepted | 9.09 | h, n = list(map(int, input().split()))
a = [int(x) for x in input().split()]
if sum(a) >= h:
print('Yes')
else:
print('No') | h, n = list(map(int, input().split()))
a = list(map(int, input().split()))
if sum(a) >= h:
print('Yes')
else:
print('No') | 6 | 6 | 130 | 128 | h, n = list(map(int, input().split()))
a = [int(x) for x in input().split()]
if sum(a) >= h:
print("Yes")
else:
print("No")
| h, n = list(map(int, input().split()))
a = list(map(int, input().split()))
if sum(a) >= h:
print("Yes")
else:
print("No")
| false | 0 | [
"-a = [int(x) for x in input().split()]",
"+a = list(map(int, input().split()))"
] | false | 0.048068 | 0.046894 | 1.025026 | [
"s370267790",
"s367720067"
] |
u885634168 | p03651 | python | s070839014 | s024227189 | 108 | 89 | 103,176 | 84,984 | Accepted | Accepted | 17.59 | def gcd_(a, b):
if a < b: a, b = b, a
if b == 0: return a
return gcd_(b, a % b)
def gcd_bl(A):
left = [0 for _ in range(N + 1)]
right = [0 for _ in range(N + 1)]
ans = [0 for _ in range(N)]
left[1] = A[0]
for i in range(1, N): left[i + 1] = gcd_(left[i], A[i])
righ... | def gcd_(a, b):
if a < b: a, b = b, a
if b == 0: return a
return gcd_(b, a % b)
def gcd(l):
ans = l[0]
for i in l: ans = gcd_(ans, i)
return ans
def cin():
in_ = list(map(int,input().split()))
if len(in_) == 1: return in_[0]
else: return in_
def solve():
... | 39 | 26 | 970 | 515 | def gcd_(a, b):
if a < b:
a, b = b, a
if b == 0:
return a
return gcd_(b, a % b)
def gcd_bl(A):
left = [0 for _ in range(N + 1)]
right = [0 for _ in range(N + 1)]
ans = [0 for _ in range(N)]
left[1] = A[0]
for i in range(1, N):
left[i + 1] = gcd_(left[i], A[i])
... | def gcd_(a, b):
if a < b:
a, b = b, a
if b == 0:
return a
return gcd_(b, a % b)
def gcd(l):
ans = l[0]
for i in l:
ans = gcd_(ans, i)
return ans
def cin():
in_ = list(map(int, input().split()))
if len(in_) == 1:
return in_[0]
else:
return i... | false | 33.333333 | [
"-def gcd_bl(A):",
"- left = [0 for _ in range(N + 1)]",
"- right = [0 for _ in range(N + 1)]",
"- ans = [0 for _ in range(N)]",
"- left[1] = A[0]",
"- for i in range(1, N):",
"- left[i + 1] = gcd_(left[i], A[i])",
"- right[-1 - 1] = A[-1]",
"- for i in range(1, N):",
"... | false | 0.063457 | 0.036589 | 1.734311 | [
"s070839014",
"s024227189"
] |
u164727245 | p02609 | python | s350907134 | s682443715 | 282 | 233 | 26,872 | 26,304 | Accepted | Accepted | 17.38 | # coding: utf-8
from collections import defaultdict, deque
def popcount(x):
assert x.bit_length() <= 32
x -= (x >> 1) & 0x55555555
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0f0f0f0f
x += x >> 8
x += x >> 16
return x & 0x3f
def solve(*args: str) -... | # coding: utf-8
def popcount(x):
assert x.bit_length() <= 32
x -= (x >> 1) & 0x55555555
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0f0f0f0f
x += x >> 8
x += x >> 16
return x & 0x3f
def solve(*args: str) -> str:
n = int(args[0])
x = args[1]
... | 65 | 50 | 1,521 | 1,203 | # coding: utf-8
from collections import defaultdict, deque
def popcount(x):
assert x.bit_length() <= 32
x -= (x >> 1) & 0x55555555
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0F0F0F0F
x += x >> 8
x += x >> 16
return x & 0x3F
def solve(*args: str) -> str:
n =... | # coding: utf-8
def popcount(x):
assert x.bit_length() <= 32
x -= (x >> 1) & 0x55555555
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0F0F0F0F
x += x >> 8
x += x >> 16
return x & 0x3F
def solve(*args: str) -> str:
n = int(args[0])
x = args[1]
ret = []
... | false | 23.076923 | [
"-from collections import defaultdict, deque",
"-",
"-",
"- dp = defaultdict(int)",
"+ x_dec = int(x, 2)",
"- x_dec = int(x, 2)",
"+ A = [0]",
"+ for i in range(1, x_count + 2):",
"+ A.append(A[i % popcount(i)] + 1)",
"- m = (",
"- x_mod_set + xor_set if x... | false | 0.047595 | 0.045947 | 1.035866 | [
"s350907134",
"s682443715"
] |
u724687935 | p02919 | python | s216732078 | s988786239 | 1,779 | 1,414 | 123,304 | 117,900 | Accepted | Accepted | 20.52 | class SegmentTree():
"""
update, get を提供するSegmentTree
Attributes
----------
__n : int
葉の数。2 ^ i - 1
__dot :
Segment function
__e: int
単位元
__node: list
Segment Tree
"""
def __init__(self, A, dot, e):
"""
Parameters
... | class SegmentTree():
"""
update, get を提供するSegmentTree
Attributes
----------
__n : int
葉の数。2 ^ i - 1
__dot :
Segment function
__e: int
単位元
__node: list
Segment Tree
"""
def __init__(self, A, dot, e):
"""
Parameters
... | 91 | 91 | 2,131 | 2,155 | class SegmentTree:
"""
update, get を提供するSegmentTree
Attributes
----------
__n : int
葉の数。2 ^ i - 1
__dot :
Segment function
__e: int
単位元
__node: list
Segment Tree
"""
def __init__(self, A, dot, e):
"""
Parameters
----------
... | class SegmentTree:
"""
update, get を提供するSegmentTree
Attributes
----------
__n : int
葉の数。2 ^ i - 1
__dot :
Segment function
__e: int
単位元
__node: list
Segment Tree
"""
def __init__(self, A, dot, e):
"""
Parameters
----------
... | false | 0 | [
"- n = A",
"+ n = 2 ** (A - 1).bit_length()"
] | false | 0.046959 | 0.08482 | 0.553632 | [
"s216732078",
"s988786239"
] |
u351892848 | p03698 | python | s479365003 | s546643759 | 168 | 29 | 38,384 | 9,032 | Accepted | Accepted | 82.74 | S = eval(input())
s = set(S)
if len(s) == len(S):
print("yes")
else:
print("no") | S = eval(input())
if len(S) == len(set(S)):
print("yes")
else:
print("no")
| 6 | 5 | 83 | 81 | S = eval(input())
s = set(S)
if len(s) == len(S):
print("yes")
else:
print("no")
| S = eval(input())
if len(S) == len(set(S)):
print("yes")
else:
print("no")
| false | 16.666667 | [
"-s = set(S)",
"-if len(s) == len(S):",
"+if len(S) == len(set(S)):"
] | false | 0.079009 | 0.098051 | 0.805799 | [
"s479365003",
"s546643759"
] |
u991567869 | p02595 | python | s149520511 | s272963884 | 397 | 190 | 9,128 | 9,132 | Accepted | Accepted | 52.14 | n, d = list(map(int, input().split()))
d = d*d
ans = 0
for i in range(n):
x, y = list(map(int, input().split()))
if d >= x*x + y*y:
ans += 1
print(ans) | import sys
input = sys.stdin.readline
n, d = list(map(int, input().split()))
d = d*d
ans = 0
for i in range(n):
x, y = list(map(int, input().split()))
if d >= x*x + y*y:
ans += 1
print(ans) | 10 | 13 | 166 | 208 | n, d = list(map(int, input().split()))
d = d * d
ans = 0
for i in range(n):
x, y = list(map(int, input().split()))
if d >= x * x + y * y:
ans += 1
print(ans)
| import sys
input = sys.stdin.readline
n, d = list(map(int, input().split()))
d = d * d
ans = 0
for i in range(n):
x, y = list(map(int, input().split()))
if d >= x * x + y * y:
ans += 1
print(ans)
| false | 23.076923 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.038614 | 0.065658 | 0.588106 | [
"s149520511",
"s272963884"
] |
u298297089 | p03287 | python | s471767831 | s176018623 | 226 | 75 | 63,768 | 16,544 | Accepted | Accepted | 66.81 | from itertools import accumulate
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
acc = [0] + list(accumulate(a))
mod = {}
for i in acc:
d = i%m
if d not in mod:
mod[d] = 0
mod[d] += 1
cnt = 0
for v in list(mod.values()):
if v:
cnt += v * (v-1) // 2
... | n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
from itertools import accumulate
acc = [0] + [i % m for i in accumulate(a)]
from collections import Counter
ans = sum([v * (v-1) // 2 for v in list(Counter(acc).values())])
print(ans) | 15 | 7 | 320 | 251 | from itertools import accumulate
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
acc = [0] + list(accumulate(a))
mod = {}
for i in acc:
d = i % m
if d not in mod:
mod[d] = 0
mod[d] += 1
cnt = 0
for v in list(mod.values()):
if v:
cnt += v * (v - 1) // 2
print(c... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
from itertools import accumulate
acc = [0] + [i % m for i in accumulate(a)]
from collections import Counter
ans = sum([v * (v - 1) // 2 for v in list(Counter(acc).values())])
print(ans)
| false | 53.333333 | [
"+n, m = list(map(int, input().split()))",
"+a = list(map(int, input().split()))",
"-n, m = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-acc = [0] + list(accumulate(a))",
"-mod = {}",
"-for i in acc:",
"- d = i % m",
"- if d not in mod:",
"- mod[d] = 0",... | false | 0.036538 | 0.040031 | 0.912739 | [
"s471767831",
"s176018623"
] |
u120691615 | p03814 | python | s837331876 | s945471184 | 30 | 17 | 3,500 | 3,500 | Accepted | Accepted | 43.33 | s = eval(input())
A = s.index("A")
Z = 0
for i in range(len(s))[::-1]:
if s[i] == "Z":
Z = i
break
print((Z-A+1)) | s = eval(input())
print((s.rfind("Z") - s.find("A") + 1)) | 8 | 2 | 132 | 50 | s = eval(input())
A = s.index("A")
Z = 0
for i in range(len(s))[::-1]:
if s[i] == "Z":
Z = i
break
print((Z - A + 1))
| s = eval(input())
print((s.rfind("Z") - s.find("A") + 1))
| false | 75 | [
"-A = s.index(\"A\")",
"-Z = 0",
"-for i in range(len(s))[::-1]:",
"- if s[i] == \"Z\":",
"- Z = i",
"- break",
"-print((Z - A + 1))",
"+print((s.rfind(\"Z\") - s.find(\"A\") + 1))"
] | false | 0.037649 | 0.035338 | 1.06538 | [
"s837331876",
"s945471184"
] |
u816631826 | p02790 | python | s542381483 | s215212841 | 27 | 22 | 9,032 | 9,044 | Accepted | Accepted | 18.52 | a = [int(i) for i in input().split()]
if (a[0] <= a[1]):
print((str(a[0])*a[1]))
elif (a[1] < a[0]):
print((str(a[1])*a[0]))
| a,b=list(map(int,input().split()))
print((str(min(a,b))*max(a,b))) | 5 | 2 | 129 | 59 | a = [int(i) for i in input().split()]
if a[0] <= a[1]:
print((str(a[0]) * a[1]))
elif a[1] < a[0]:
print((str(a[1]) * a[0]))
| a, b = list(map(int, input().split()))
print((str(min(a, b)) * max(a, b)))
| false | 60 | [
"-a = [int(i) for i in input().split()]",
"-if a[0] <= a[1]:",
"- print((str(a[0]) * a[1]))",
"-elif a[1] < a[0]:",
"- print((str(a[1]) * a[0]))",
"+a, b = list(map(int, input().split()))",
"+print((str(min(a, b)) * max(a, b)))"
] | false | 0.037618 | 0.035893 | 1.048062 | [
"s542381483",
"s215212841"
] |
u168578024 | p03061 | python | s331716415 | s858772081 | 1,893 | 1,024 | 16,084 | 107,424 | Accepted | Accepted | 45.91 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = I
self.seg = [I]*(N*2)
def assign(self, k, x):
self.seg[k + self... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd
import copy
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = copy.deepcopy(I)
self.seg = [copy.deepcopy(I) for i in range(self.sz... | 55 | 53 | 1,379 | 1,440 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = I
self.seg = [I] * (N * 2)
def assign(self, k, x):
self.seg[k + self.sz] = x... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd
import copy
class SegmentTree:
def __init__(self, N, func, I):
self.sz = N
self.func = func
self.I = copy.deepcopy(I)
self.seg = [copy.deepcopy(I) for i in range(self.sz * 2)]
... | false | 3.636364 | [
"+import copy",
"- self.I = I",
"- self.seg = [I] * (N * 2)",
"+ self.I = copy.deepcopy(I)",
"+ self.seg = [copy.deepcopy(I) for i in range(self.sz * 2)]",
"- self.seg[k + self.sz] = x",
"+ self.seg[k + self.sz] = copy.deepcopy(x)",
"- self.seg[i] =... | false | 0.079651 | 0.112604 | 0.707358 | [
"s331716415",
"s858772081"
] |
u708255304 | p03163 | python | s398089265 | s785786663 | 326 | 172 | 19,336 | 14,572 | Accepted | Accepted | 47.24 | import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros(W+1, dtype=np.int64)
for _ in range(N):
w, v = list(map(int, input().split()))
np.maximum(dp[:-w]+v, dp[w:], out=dp[w:])
print((dp[-1]))
| import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros(W+1, dtype=np.int64)
for _ in range(N):
w, v = list(map(int, input().split())) # 重さw, 価値vの荷物
np.maximum(dp[:-w]+v, dp[w:], out=dp[w:]) # dp[:-w]はまだ重さwのもの入るナップサックの状態
# outは戻り値を格納する配列を指定できる
print((dp[-1]))
"""
今dpは一... | 11 | 29 | 217 | 648 | import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros(W + 1, dtype=np.int64)
for _ in range(N):
w, v = list(map(int, input().split()))
np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
print((dp[-1]))
| import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros(W + 1, dtype=np.int64)
for _ in range(N):
w, v = list(map(int, input().split())) # 重さw, 価値vの荷物
np.maximum(dp[:-w] + v, dp[w:], out=dp[w:]) # dp[:-w]はまだ重さwのもの入るナップサックの状態
# outは戻り値を格納する配列を指定できる
print((dp[-1]))
"""
今dpは一次元配列
dp[:-w]は後ろか... | false | 62.068966 | [
"- w, v = list(map(int, input().split()))",
"- np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])",
"+ w, v = list(map(int, input().split())) # 重さw, 価値vの荷物",
"+ np.maximum(dp[:-w] + v, dp[w:], out=dp[w:]) # dp[:-w]はまだ重さwのもの入るナップサックの状態",
"+ # outは戻り値を格納する配列を指定できる",
"+\"\"\"",
"+今dpは一次元配列",
"+... | false | 0.179082 | 0.231824 | 0.772493 | [
"s398089265",
"s785786663"
] |
u971091945 | p02813 | python | s439258322 | s982712368 | 38 | 27 | 3,064 | 8,052 | Accepted | Accepted | 28.95 | import itertools
n = int(eval(input()))
p_list = list(map(int, input().split()))
q_list = list(map(int, input().split()))
num_list = []
num = 0
a = 0
b = 0
for i in itertools.permutations(list(range(1,n+1))):
num_list = list(i)
num += 1
if num_list == p_list:
a = num
if num_list... | import itertools
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
num_list = list(itertools.permutations(list(range(1,n+1))))
print((abs(num_list.index(p)-num_list.index(q)))) | 19 | 9 | 355 | 220 | import itertools
n = int(eval(input()))
p_list = list(map(int, input().split()))
q_list = list(map(int, input().split()))
num_list = []
num = 0
a = 0
b = 0
for i in itertools.permutations(list(range(1, n + 1))):
num_list = list(i)
num += 1
if num_list == p_list:
a = num
if num_list == q_list:
... | import itertools
n = int(eval(input()))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
num_list = list(itertools.permutations(list(range(1, n + 1))))
print((abs(num_list.index(p) - num_list.index(q))))
| false | 52.631579 | [
"-p_list = list(map(int, input().split()))",
"-q_list = list(map(int, input().split()))",
"-num_list = []",
"-num = 0",
"-a = 0",
"-b = 0",
"-for i in itertools.permutations(list(range(1, n + 1))):",
"- num_list = list(i)",
"- num += 1",
"- if num_list == p_list:",
"- a = num",
... | false | 0.119703 | 0.047423 | 2.524187 | [
"s439258322",
"s982712368"
] |
u599547273 | p02936 | python | s275553494 | s941713227 | 1,910 | 1,540 | 129,604 | 47,868 | Accepted | Accepted | 19.37 | from collections import deque
N, Q = list(map(int, input().split(" ")))
AB = [list(map(int, input().split(" "))) for _ in range(N-1)]
PX = [list(map(int, input().split(" "))) for _ in range(Q)]
points = [0 for _ in range(N+1)]
g = [[] for _ in range(N+1)]
for a, b in AB:
g[a].append(b)
# print(g)
f... | N, Q = list(map(int, input().split(" ")))
points = [0 for _ in range(N+1)]
g = [[] for _ in range(N+1)]
for _ in range(N-1):
a, b = list(map(int, input().split(" ")))
g[a].append(b)
for _ in range(Q):
p, x = list(map(int, input().split(" ")))
points[p] += x
q = [1]
while q:
node = q.pop... | 24 | 18 | 520 | 417 | from collections import deque
N, Q = list(map(int, input().split(" ")))
AB = [list(map(int, input().split(" "))) for _ in range(N - 1)]
PX = [list(map(int, input().split(" "))) for _ in range(Q)]
points = [0 for _ in range(N + 1)]
g = [[] for _ in range(N + 1)]
for a, b in AB:
g[a].append(b)
# print(g)
for p, x in... | N, Q = list(map(int, input().split(" ")))
points = [0 for _ in range(N + 1)]
g = [[] for _ in range(N + 1)]
for _ in range(N - 1):
a, b = list(map(int, input().split(" ")))
g[a].append(b)
for _ in range(Q):
p, x = list(map(int, input().split(" ")))
points[p] += x
q = [1]
while q:
node = q.pop()
... | false | 25 | [
"-from collections import deque",
"-",
"-AB = [list(map(int, input().split(\" \"))) for _ in range(N - 1)]",
"-PX = [list(map(int, input().split(\" \"))) for _ in range(Q)]",
"-for a, b in AB:",
"+for _ in range(N - 1):",
"+ a, b = list(map(int, input().split(\" \")))",
"-# print(g)",
"-for p, x ... | false | 0.042484 | 0.040856 | 1.039827 | [
"s275553494",
"s941713227"
] |
u606045429 | p03878 | python | s500468837 | s690606520 | 666 | 582 | 27,652 | 25,820 | Accepted | Accepted | 12.61 | mod = 10 ** 9 + 7
N = int(eval(input()))
A = [(int(eval(input())), 1) for _ in range(N)]
B = [(int(eval(input())), -1) for _ in range(N)]
C = sorted(A + B)
res = 1
cnt = 0
for _, delta in C:
if cnt * delta < 0:
res *= abs(cnt)
res %= mod
cnt += delta
print(res) | from heapq import heappush, heappop
mod = 10 ** 9 + 7
N, *E = list(map(int, open(0).read().split()))
Q = []
for i, e in enumerate(E):
heappush(Q, (e, 1 if i < N else -1))
res = 1
cnt = 0
while Q:
_, delta = heappop(Q)
if cnt * delta < 0:
res *= abs(cnt)
res %= mod
cnt ... | 17 | 19 | 287 | 336 | mod = 10**9 + 7
N = int(eval(input()))
A = [(int(eval(input())), 1) for _ in range(N)]
B = [(int(eval(input())), -1) for _ in range(N)]
C = sorted(A + B)
res = 1
cnt = 0
for _, delta in C:
if cnt * delta < 0:
res *= abs(cnt)
res %= mod
cnt += delta
print(res)
| from heapq import heappush, heappop
mod = 10**9 + 7
N, *E = list(map(int, open(0).read().split()))
Q = []
for i, e in enumerate(E):
heappush(Q, (e, 1 if i < N else -1))
res = 1
cnt = 0
while Q:
_, delta = heappop(Q)
if cnt * delta < 0:
res *= abs(cnt)
res %= mod
cnt += delta
print(res)
| false | 10.526316 | [
"+from heapq import heappush, heappop",
"+",
"-N = int(eval(input()))",
"-A = [(int(eval(input())), 1) for _ in range(N)]",
"-B = [(int(eval(input())), -1) for _ in range(N)]",
"-C = sorted(A + B)",
"+N, *E = list(map(int, open(0).read().split()))",
"+Q = []",
"+for i, e in enumerate(E):",
"+ h... | false | 0.034738 | 0.049296 | 0.704676 | [
"s500468837",
"s690606520"
] |
u237362582 | p03078 | python | s300879235 | s623660862 | 121 | 48 | 4,724 | 4,724 | Accepted | Accepted | 60.33 | import heapq
class Delicious (object):
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def total(self):
return(A[self.x] + B[self.y] + C[self.z])
def __lt__(self, other):
return self.total() > other.total()
X, Y, Z, K = list(map(int... | import heapq
X, Y, Z, K = list(map(int, input().split(" ")))
A = sorted(map(int, input().split(" ")), reverse=True)
B = sorted(map(int, input().split(" ")), reverse=True)
C = sorted(map(int, input().split(" ")), reverse=True)
anslist = []
flag = {}
heapq.heappush(anslist, (-(A[0]+B[0]+C[0]), (0, 0, 0)))
... | 39 | 27 | 969 | 730 | import heapq
class Delicious(object):
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def total(self):
return A[self.x] + B[self.y] + C[self.z]
def __lt__(self, other):
return self.total() > other.total()
X, Y, Z, K = list(map(int, input().split(" ... | import heapq
X, Y, Z, K = list(map(int, input().split(" ")))
A = sorted(map(int, input().split(" ")), reverse=True)
B = sorted(map(int, input().split(" ")), reverse=True)
C = sorted(map(int, input().split(" ")), reverse=True)
anslist = []
flag = {}
heapq.heappush(anslist, (-(A[0] + B[0] + C[0]), (0, 0, 0)))
for _ in r... | false | 30.769231 | [
"-",
"-",
"-class Delicious(object):",
"- def __init__(self, x, y, z):",
"- self.x = x",
"- self.y = y",
"- self.z = z",
"-",
"- def total(self):",
"- return A[self.x] + B[self.y] + C[self.z]",
"-",
"- def __lt__(self, other):",
"- return self.tota... | false | 0.036645 | 0.035235 | 1.040025 | [
"s300879235",
"s623660862"
] |
u022407960 | p02281 | python | s302230363 | s145721544 | 50 | 30 | 7,884 | 7,888 | Accepted | Accepted | 40 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
output:
Preorder
0 1 2 3 4 5 6 7 8
Inorder
2 1 3 0 6 5 7 4 8
Postorder
2 3 1 6 7 5 8 4 0
"""
import sys
class Node(object):
def __init__(self):
# i... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
output:
Preorder
0 1 2 3 4 5 6 7 8
Inorder
2 1 3 0 6 5 7 4 8
Postorder
2 3 1 6 7 5 8 4 0
"""
import sys
class Node(object):
def __init__(self):
# i... | 123 | 123 | 2,625 | 2,629 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
output:
Preorder
0 1 2 3 4 5 6 7 8
Inorder
2 1 3 0 6 5 7 4 8
Postorder
2 3 1 6 7 5 8 4 0
"""
import sys
class Node(object):
def __init__(self):
# init node as a single leaf node.
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
output:
Preorder
0 1 2 3 4 5 6 7 8
Inorder
2 1 3 0 6 5 7 4 8
Postorder
2 3 1 6 7 5 8 4 0
"""
import sys
class Node(object):
def __init__(self):
# init node as a single leaf node.
... | false | 0 | [
"- assert len(children) == 2 and idx >= 0",
"+ # assert len(children) == 2 and idx >= 0",
"- assert len(array) == array_length",
"+ # assert len(array) == array_length"
] | false | 0.03441 | 0.040534 | 0.848923 | [
"s302230363",
"s145721544"
] |
u562935282 | p02913 | python | s200504967 | s936370814 | 804 | 573 | 230,792 | 231,560 | Accepted | Accepted | 28.73 | # 解説
def main():
N = int(eval(input()))
s = eval(input())
dp = [[0] * N for _ in range(N)]
ans = 0
for i in range(N - 1, -1, -1):
for j in range(N - 1, -1, -1):
if s[i] == s[j]:
if i + 1 < N and j + 1 < N:
dp[i][j] = min(dp[i + 1]... | # 解説
def main():
N = int(eval(input()))
s = eval(input())
dp = [[0] * N for _ in range(N)]
ans = 0
for i in reversed(list(range(N))):
for j in reversed(list(range(i, N))):
if s[i] == s[j]:
if i + 1 < N and j + 1 < N:
dp[i][j] = mi... | 23 | 32 | 540 | 682 | # 解説
def main():
N = int(eval(input()))
s = eval(input())
dp = [[0] * N for _ in range(N)]
ans = 0
for i in range(N - 1, -1, -1):
for j in range(N - 1, -1, -1):
if s[i] == s[j]:
if i + 1 < N and j + 1 < N:
dp[i][j] = min(dp[i + 1][j + 1] + 1, j... | # 解説
def main():
N = int(eval(input()))
s = eval(input())
dp = [[0] * N for _ in range(N)]
ans = 0
for i in reversed(list(range(N))):
for j in reversed(list(range(i, N))):
if s[i] == s[j]:
if i + 1 < N and j + 1 < N:
dp[i][j] = min(dp[i + 1][j ... | false | 28.125 | [
"- for i in range(N - 1, -1, -1):",
"- for j in range(N - 1, -1, -1):",
"+ for i in reversed(list(range(N))):",
"+ for j in reversed(list(range(i, N))):",
"+# import sys",
"+#",
"+# sys.setrecursionlimit(10 ** 7)",
"+#",
"+# input = sys.stdin.readline",
"+# rstrip()",
"+# int... | false | 0.034436 | 0.038418 | 0.896343 | [
"s200504967",
"s936370814"
] |
u303039933 | p02972 | python | s786365830 | s842226711 | 517 | 366 | 94,436 | 20,008 | Accepted | Accepted | 29.21 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner():
... | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal
... | 129 | 79 | 2,731 | 1,636 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *
class Scanner:
@staticmethod
d... | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal
class Scanner:
... | false | 38.75969 | [
"+from collections import deque",
"-from decimal import *",
"+import decimal",
"- return [input() for i in range(n)]",
"+ return [Scanner.string() for i in range(n)]",
"- return [int(input()) for i in range(n)]",
"-",
"-",
"-class Math:",
"- @staticmethod",
"- def gcd(... | false | 0.044541 | 0.035633 | 1.250011 | [
"s786365830",
"s842226711"
] |
u359358631 | p03644 | python | s139183780 | s158272002 | 29 | 26 | 9,192 | 9,152 | Accepted | Accepted | 10.34 | def divide_by_2(num):
cnt = 0
while True:
if num % 2 != 0:
break
num /= 2
cnt += 1
return cnt
def main():
N = int(eval(input()))
max_cnt = -1
ans = 0
for num in range(1, N + 1):
cnt = divide_by_2(num)
if max_cnt < cnt:
max_cnt = cnt
ans = num
print(ans)
... | def divide_by_2(num):
cnt = 0
while True:
if num % 2 != 0:
break
num /= 2
cnt += 1
return cnt
def main():
N = int(eval(input()))
lst = [-1] * (N + 1)
for num in range(1, N + 1):
cnt = divide_by_2(num)
lst[num] = cnt
print((lst.index(max(lst))))
if __name__ == ... | 32 | 27 | 359 | 334 | def divide_by_2(num):
cnt = 0
while True:
if num % 2 != 0:
break
num /= 2
cnt += 1
return cnt
def main():
N = int(eval(input()))
max_cnt = -1
ans = 0
for num in range(1, N + 1):
cnt = divide_by_2(num)
if max_cnt < cnt:
max_cnt... | def divide_by_2(num):
cnt = 0
while True:
if num % 2 != 0:
break
num /= 2
cnt += 1
return cnt
def main():
N = int(eval(input()))
lst = [-1] * (N + 1)
for num in range(1, N + 1):
cnt = divide_by_2(num)
lst[num] = cnt
print((lst.index(max(l... | false | 15.625 | [
"- max_cnt = -1",
"- ans = 0",
"+ lst = [-1] * (N + 1)",
"- if max_cnt < cnt:",
"- max_cnt = cnt",
"- ans = num",
"- print(ans)",
"+ lst[num] = cnt",
"+ print((lst.index(max(lst))))"
] | false | 0.046785 | 0.047072 | 0.993907 | [
"s139183780",
"s158272002"
] |
u244416763 | p02803 | python | s388015646 | s689427594 | 954 | 462 | 3,188 | 3,188 | Accepted | Accepted | 51.57 | def bfs_longest(x,y):
queuex = [x]
queuey = [y]
queuedis = [0]
looked = [[x,y]]
ans = [0]
while(len(queuex)):
nowx = queuex.pop(0)
nowy = queuey.pop(0)
nowdis = queuedis.pop(0)
search = [[nowx+1,nowy],[nowx-1,nowy],[nowx,nowy+1],[nowx,nowy-1]]
f... | def bfs_longest(x,y):
queuex = [x]
queuey = [y]
queuedis = [0]
ans = [0]
dis = [[-1 for _ in range(w+2)]for k in range(h+2)]
dis[x][y] = 0
while(len(queuex)):
nowx = queuex.pop(0)
nowy = queuey.pop(0)
nowdis = queuedis.pop(0)
search = [[nowx+1,nowy]... | 38 | 36 | 1,175 | 1,183 | def bfs_longest(x, y):
queuex = [x]
queuey = [y]
queuedis = [0]
looked = [[x, y]]
ans = [0]
while len(queuex):
nowx = queuex.pop(0)
nowy = queuey.pop(0)
nowdis = queuedis.pop(0)
search = [
[nowx + 1, nowy],
[nowx - 1, nowy],
[no... | def bfs_longest(x, y):
queuex = [x]
queuey = [y]
queuedis = [0]
ans = [0]
dis = [[-1 for _ in range(w + 2)] for k in range(h + 2)]
dis[x][y] = 0
while len(queuex):
nowx = queuex.pop(0)
nowy = queuey.pop(0)
nowdis = queuedis.pop(0)
search = [
[nowx ... | false | 5.263158 | [
"- looked = [[x, y]]",
"+ dis = [[-1 for _ in range(w + 2)] for k in range(h + 2)]",
"+ dis[x][y] = 0",
"- if not (search[i] in looked):",
"+ if dis[search[i][0]][search[i][1]] == -1:",
"- looked.append([search[i][0], search[i][1]])",
"+ ... | false | 0.099728 | 0.0483 | 2.064785 | [
"s388015646",
"s689427594"
] |
u219417113 | p03722 | python | s092187798 | s582721446 | 744 | 582 | 3,316 | 3,316 | Accepted | Accepted | 21.77 | import sys
input = sys.stdin.readline
def bellmanford(G, s):
n = len(G)
inf = -float('inf')
dist = [inf] * n
dist[s] = 0
for i in range(2*n):
for v in range(n):
for w, c in G[v]:
if dist[w] < dist[v] + c:
dist[w] = dist[v] + c
... | import sys
input = sys.stdin.readline
def bellmanford(G, s):
n = len(G)
inf = -float('inf')
dist = [inf] * n
dist[s] = 0
for i in range(n):
for v in range(n):
for w, c in G[v]:
if dist[w] < dist[v] + c:
dist[w] = dist[v] + c
... | 33 | 33 | 794 | 794 | import sys
input = sys.stdin.readline
def bellmanford(G, s):
n = len(G)
inf = -float("inf")
dist = [inf] * n
dist[s] = 0
for i in range(2 * n):
for v in range(n):
for w, c in G[v]:
if dist[w] < dist[v] + c:
dist[w] = dist[v] + c
... | import sys
input = sys.stdin.readline
def bellmanford(G, s):
n = len(G)
inf = -float("inf")
dist = [inf] * n
dist[s] = 0
for i in range(n):
for v in range(n):
for w, c in G[v]:
if dist[w] < dist[v] + c:
dist[w] = dist[v] + c
... | false | 0 | [
"- for i in range(2 * n):",
"+ for i in range(n):"
] | false | 0.036921 | 0.060865 | 0.606598 | [
"s092187798",
"s582721446"
] |
u671060652 | p03243 | python | s618716809 | s023492504 | 269 | 167 | 64,108 | 38,416 | Accepted | Accepted | 37.92 | import itertools
import math
import fractions
import functools
n = int(eval(input()))
i = math.ceil(n / 111)
print((i*100+i*10+i)) | n = int(eval(input()))
if n % 111 == 0:
print(n)
quit()
print(((n//111+1)*111)) | 8 | 7 | 130 | 87 | import itertools
import math
import fractions
import functools
n = int(eval(input()))
i = math.ceil(n / 111)
print((i * 100 + i * 10 + i))
| n = int(eval(input()))
if n % 111 == 0:
print(n)
quit()
print(((n // 111 + 1) * 111))
| false | 12.5 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-",
"-i = math.ceil(n / 111)",
"-print((i * 100 + i * 10 + i))",
"+if n % 111 == 0:",
"+ print(n)",
"+ quit()",
"+print(((n // 111 + 1) * 111))"
] | false | 0.039235 | 0.033395 | 1.174881 | [
"s618716809",
"s023492504"
] |
u040298438 | p03043 | python | s795724955 | s205871917 | 34 | 27 | 9,172 | 9,208 | Accepted | Accepted | 20.59 | from math import ceil
from math import log2
n, k = list(map(int, input().split()))
ans = sum(1 / 2 ** ceil(log2(k / i)) for i in range(1, min(n, k) + 1))
print(((ans + max(0, n - k)) / n)) | from math import ceil, log2
n, k = list(map(int, input().split()))
ans = sum(1 / 2 ** ceil(log2(k / i)) for i in range(1, min(n, k) + 1))
print(((ans + max(0, n - k)) / n)) | 6 | 5 | 186 | 169 | from math import ceil
from math import log2
n, k = list(map(int, input().split()))
ans = sum(1 / 2 ** ceil(log2(k / i)) for i in range(1, min(n, k) + 1))
print(((ans + max(0, n - k)) / n))
| from math import ceil, log2
n, k = list(map(int, input().split()))
ans = sum(1 / 2 ** ceil(log2(k / i)) for i in range(1, min(n, k) + 1))
print(((ans + max(0, n - k)) / n))
| false | 16.666667 | [
"-from math import ceil",
"-from math import log2",
"+from math import ceil, log2"
] | false | 0.197756 | 0.04784 | 4.133666 | [
"s795724955",
"s205871917"
] |
u217303170 | p03502 | python | s356333232 | s941383524 | 23 | 17 | 2,940 | 2,940 | Accepted | Accepted | 26.09 | N=eval(input())
S=list(map(int,N))
X=sum(S)
f=int(N)/X
def is_integer_num(n):
if isinstance(n, int):
return True
if isinstance(n, float):
return n.is_integer()
return False
print(('Yes' if is_integer_num(f) else 'No'))
| N=eval(input())
S=list(map(int,N))
X=sum(S)
f=int(N)%X
print(('Yes' if int(N)%X==0 else 'No'))
| 13 | 5 | 253 | 91 | N = eval(input())
S = list(map(int, N))
X = sum(S)
f = int(N) / X
def is_integer_num(n):
if isinstance(n, int):
return True
if isinstance(n, float):
return n.is_integer()
return False
print(("Yes" if is_integer_num(f) else "No"))
| N = eval(input())
S = list(map(int, N))
X = sum(S)
f = int(N) % X
print(("Yes" if int(N) % X == 0 else "No"))
| false | 61.538462 | [
"-f = int(N) / X",
"-",
"-",
"-def is_integer_num(n):",
"- if isinstance(n, int):",
"- return True",
"- if isinstance(n, float):",
"- return n.is_integer()",
"- return False",
"-",
"-",
"-print((\"Yes\" if is_integer_num(f) else \"No\"))",
"+f = int(N) % X",
"+print(... | false | 0.03692 | 0.036985 | 0.998229 | [
"s356333232",
"s941383524"
] |
u826263061 | p03379 | python | s824717746 | s878150054 | 352 | 320 | 26,016 | 25,220 | Accepted | Accepted | 9.09 | n = int(eval(input()))
x = list(map(int, input().split()))
sortedx = x[:]
sortedx.sort()
for i in range(n):
#ix = sortedx.index(x[i])
#print(sortedx)
#print(ix)
if x[i] <= sortedx[n//2-1]:
print((sortedx[n//2]))
else:
print((sortedx[n//2-1])) | n = int(eval(input()))
x = list(map(int, input().split()))
sx = sorted(x)
xm = sx[n//2-1]
xp = sx[n//2]
for i in range(n):
if x[i] <= xm:
b = xp
else:
b = xm
print(b) | 14 | 13 | 283 | 212 | n = int(eval(input()))
x = list(map(int, input().split()))
sortedx = x[:]
sortedx.sort()
for i in range(n):
# ix = sortedx.index(x[i])
# print(sortedx)
# print(ix)
if x[i] <= sortedx[n // 2 - 1]:
print((sortedx[n // 2]))
else:
print((sortedx[n // 2 - 1]))
| n = int(eval(input()))
x = list(map(int, input().split()))
sx = sorted(x)
xm = sx[n // 2 - 1]
xp = sx[n // 2]
for i in range(n):
if x[i] <= xm:
b = xp
else:
b = xm
print(b)
| false | 7.142857 | [
"-sortedx = x[:]",
"-sortedx.sort()",
"+sx = sorted(x)",
"+xm = sx[n // 2 - 1]",
"+xp = sx[n // 2]",
"- # ix = sortedx.index(x[i])",
"- # print(sortedx)",
"- # print(ix)",
"- if x[i] <= sortedx[n // 2 - 1]:",
"- print((sortedx[n // 2]))",
"+ if x[i] <= xm:",
"+ b =... | false | 0.047354 | 0.129091 | 0.366823 | [
"s824717746",
"s878150054"
] |
u079022693 | p02881 | python | s162667710 | s133584883 | 377 | 116 | 3,060 | 3,060 | Accepted | Accepted | 69.23 | N=int(eval(input()))
K=list()
for i in range(1,int(N**0.5)+1):
if(int(N/i)==N/i):
M=int(N/i) #N<=M
L=i
K.append(M+L-2)
print((min(K))) | import math
def make_divisors(n):
divisors = []
for i in range(2, int(math.sqrt(n))+1):
if n % i == 0:
divisors.append(i)
divisors.sort()
return divisors
def main():
N=int(eval(input()))
di=make_divisors(N)
if di==[]:
print((N-1))
else:
... | 10 | 21 | 156 | 395 | N = int(eval(input()))
K = list()
for i in range(1, int(N**0.5) + 1):
if int(N / i) == N / i:
M = int(N / i) # N<=M
L = i
K.append(M + L - 2)
print((min(K)))
| import math
def make_divisors(n):
divisors = []
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
divisors.append(i)
divisors.sort()
return divisors
def main():
N = int(eval(input()))
di = make_divisors(N)
if di == []:
print((N - 1))
else:
M... | false | 52.380952 | [
"-N = int(eval(input()))",
"-K = list()",
"-for i in range(1, int(N**0.5) + 1):",
"- if int(N / i) == N / i:",
"- M = int(N / i) # N<=M",
"- L = i",
"- K.append(M + L - 2)",
"-print((min(K)))",
"+import math",
"+",
"+",
"+def make_divisors(n):",
"+ divisors = []",... | false | 0.060136 | 0.057972 | 1.03734 | [
"s162667710",
"s133584883"
] |
u785205215 | p03579 | python | s310476161 | s458367481 | 584 | 539 | 43,368 | 43,248 | Accepted | Accepted | 7.71 | def is_biparate(links):
'''
0=white,1=blackとする
2部グラフなら黒に塗られている頂点の数を返す
2部グラフでないなら-1を返す。
'''
colors = [-1] * n
colors[0] = 0
q = [(0, 0)] #0=white, 1=blackとする
visited = set()
while q:
v, c = q.pop()
if v in visited:
if colors[v] != c:... | from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))
def is_biparate(links):
'''
0=white,1=blackとする
2部グラフなら黒に塗られている頂点の数を返す
2部グラフでないなら-1を返す。
'''
colors = [-1] * n
colors[0] = 0
q = [(0, 0)] #0=white, 1=blackとする
visit... | 62 | 75 | 1,535 | 1,830 | def is_biparate(links):
"""
0=white,1=blackとする
2部グラフなら黒に塗られている頂点の数を返す
2部グラフでないなら-1を返す。
"""
colors = [-1] * n
colors[0] = 0
q = [(0, 0)] # 0=white, 1=blackとする
visited = set()
while q:
v, c = q.pop()
if v in visited:
if colors[v] != c: # 最初に塗られた色とは反対の色... | from sys import stdin, stdout
def readLine_int_list():
return list(map(int, stdin.readline().split()))
def is_biparate(links):
"""
0=white,1=blackとする
2部グラフなら黒に塗られている頂点の数を返す
2部グラフでないなら-1を返す。
"""
colors = [-1] * n
colors[0] = 0
q = [(0, 0)] # 0=white, 1=blackとする
visited = set(... | false | 17.333333 | [
"+from sys import stdin, stdout",
"+",
"+",
"+def readLine_int_list():",
"+ return list(map(int, stdin.readline().split()))",
"+",
"+",
"-n, m = list(map(int, input().split()))",
"-links = [set() for _ in range(n)]",
"-for _ in range(m):",
"- a, b = list(map(int, input().split()))",
"- ... | false | 0.033588 | 0.118435 | 0.283602 | [
"s310476161",
"s458367481"
] |
u225388820 | p02708 | python | s921486827 | s215101781 | 77 | 19 | 9,116 | 9,068 | Accepted | Accepted | 75.32 | n,k=list(map(int,input().split()))
ans=0
mod=10**9+7
for i in range(k,n+2):
ans+=(n-i+1)*i+1
ans%=mod
print(ans) | n,k=list(map(int,input().split()))
print(((n*(n+1)*(n+2)//6-(3*n-2*k+4)*(k-1)*k//6-k+n+2)%(10**9+7))) | 7 | 2 | 120 | 94 | n, k = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
for i in range(k, n + 2):
ans += (n - i + 1) * i + 1
ans %= mod
print(ans)
| n, k = list(map(int, input().split()))
print(
(
(
n * (n + 1) * (n + 2) // 6
- (3 * n - 2 * k + 4) * (k - 1) * k // 6
- k
+ n
+ 2
)
% (10**9 + 7)
)
)
| false | 71.428571 | [
"-ans = 0",
"-mod = 10**9 + 7",
"-for i in range(k, n + 2):",
"- ans += (n - i + 1) * i + 1",
"- ans %= mod",
"-print(ans)",
"+print(",
"+ (",
"+ (",
"+ n * (n + 1) * (n + 2) // 6",
"+ - (3 * n - 2 * k + 4) * (k - 1) * k // 6",
"+ - k",
"+ ... | false | 0.054017 | 0.057703 | 0.936111 | [
"s921486827",
"s215101781"
] |
u948524308 | p03854 | python | s276146708 | s260495617 | 48 | 32 | 3,188 | 3,188 | Accepted | Accepted | 33.33 | S = eval(input())
start = 0
while start < len(S):
if start == len(S)-8 or start > len(S)-5:
print("NO")
exit()
elif start == len(S)-7 and S[start:start+7] == "dreamer":
print("YES")
exit()
elif start == len(S)-6 and S[start:start+6] == "eraser":
print(... |
S = eval(input())
start = len(S)
while 0<start:
if start < 5:
print("NO")
exit()
elif start == 7 and S[start-7:start] == "dreamer":
print("YES")
exit()
elif start == 6 and S[start-6:start] == "eraser":
print("YES")
exit()
elif start == ... | 35 | 34 | 892 | 775 | S = eval(input())
start = 0
while start < len(S):
if start == len(S) - 8 or start > len(S) - 5:
print("NO")
exit()
elif start == len(S) - 7 and S[start : start + 7] == "dreamer":
print("YES")
exit()
elif start == len(S) - 6 and S[start : start + 6] == "eraser":
print(... | S = eval(input())
start = len(S)
while 0 < start:
if start < 5:
print("NO")
exit()
elif start == 7 and S[start - 7 : start] == "dreamer":
print("YES")
exit()
elif start == 6 and S[start - 6 : start] == "eraser":
print("YES")
exit()
elif start == 5 and S[st... | false | 2.857143 | [
"-start = 0",
"-while start < len(S):",
"- if start == len(S) - 8 or start > len(S) - 5:",
"+start = len(S)",
"+while 0 < start:",
"+ if start < 5:",
"- elif start == len(S) - 7 and S[start : start + 7] == \"dreamer\":",
"+ elif start == 7 and S[start - 7 : start] == \"dreamer\":",
"- ... | false | 0.062886 | 0.064377 | 0.976837 | [
"s276146708",
"s260495617"
] |
u513434790 | p03240 | python | s583793835 | s082201389 | 172 | 45 | 9,192 | 9,220 | Accepted | Accepted | 73.84 | import sys
N = int(eval(input()))
xyz = [list(map(int, input().split())) for _ in range(N)]
idx = 0
for i in range(N):
if xyz[i][2] != 0:
idx = i
break
for cx in range(101):
for cy in range(101):
switch = 1
distance = abs(xyz[idx][0] - cx) + abs(xyz[idx][1] - cy)... | import sys
N = int(eval(input()))
xyz = [list(map(int, input().split())) for _ in range(N)]
idx = 0
for i in range(N):
if xyz[i][2] != 0:
idx = i
break
for cx in range(101):
for cy in range(101):
switch = 1
H = xyz[idx][2] + abs(xyz[idx][0] - cx) + abs(xyz[idx][1... | 29 | 23 | 713 | 552 | import sys
N = int(eval(input()))
xyz = [list(map(int, input().split())) for _ in range(N)]
idx = 0
for i in range(N):
if xyz[i][2] != 0:
idx = i
break
for cx in range(101):
for cy in range(101):
switch = 1
distance = abs(xyz[idx][0] - cx) + abs(xyz[idx][1] - cy)
H = xyz... | import sys
N = int(eval(input()))
xyz = [list(map(int, input().split())) for _ in range(N)]
idx = 0
for i in range(N):
if xyz[i][2] != 0:
idx = i
break
for cx in range(101):
for cy in range(101):
switch = 1
H = xyz[idx][2] + abs(xyz[idx][0] - cx) + abs(xyz[idx][1] - cy)
... | false | 20.689655 | [
"- distance = abs(xyz[idx][0] - cx) + abs(xyz[idx][1] - cy)",
"- H = xyz[idx][2] + distance",
"+ H = xyz[idx][2] + abs(xyz[idx][0] - cx) + abs(xyz[idx][1] - cy)",
"- karidis = abs(x - cx) + abs(y - cy)",
"- if h == 0 and distance <= karidis:",
"- c... | false | 0.038646 | 0.039908 | 0.968374 | [
"s583793835",
"s082201389"
] |
u367130284 | p03049 | python | s929948554 | s787050482 | 29 | 23 | 4,084 | 3,828 | Accepted | Accepted | 20.69 | from collections import*
n,*s=open(0).read().split()
d=defaultdict(int)
#print(s)
ans=0
for i in s:
ans+=i.count("AB")
if i[0]=="B" or i[-1]=="A":
d[(i[0]=="B",i[-1]=="A")]+=1
#print(d,ans)
if len(list(d.values()))==0:
print(ans)
exit()
else:
if d[(True,True)]>0 and d[(True,F... | n,*t=open(0).read().split()
n=int(n)
a=0
b=0
c=0
ans=0
for i in t:
if i[0]=="B"and i[-1]=="A":
a+=1
elif i[0]=="B":
b+=1
elif i[-1]=="A":
c+=1
ans+=i.count("AB")
if a>0 and b>0 and c>0:
ans+=a+1
a=0
b-=1
c-=1
if a>0 and b>0:
ans+=a
a... | 37 | 34 | 981 | 461 | from collections import *
n, *s = open(0).read().split()
d = defaultdict(int)
# print(s)
ans = 0
for i in s:
ans += i.count("AB")
if i[0] == "B" or i[-1] == "A":
d[(i[0] == "B", i[-1] == "A")] += 1
# print(d,ans)
if len(list(d.values())) == 0:
print(ans)
exit()
else:
if (
d[(True, T... | n, *t = open(0).read().split()
n = int(n)
a = 0
b = 0
c = 0
ans = 0
for i in t:
if i[0] == "B" and i[-1] == "A":
a += 1
elif i[0] == "B":
b += 1
elif i[-1] == "A":
c += 1
ans += i.count("AB")
if a > 0 and b > 0 and c > 0:
ans += a + 1
a = 0
b -= 1
c -= 1
if a > 0 ... | false | 8.108108 | [
"-from collections import *",
"-",
"-n, *s = open(0).read().split()",
"-d = defaultdict(int)",
"-# print(s)",
"+n, *t = open(0).read().split()",
"+n = int(n)",
"+a = 0",
"+b = 0",
"+c = 0",
"-for i in s:",
"+for i in t:",
"+ if i[0] == \"B\" and i[-1] == \"A\":",
"+ a += 1",
"+... | false | 0.03851 | 0.045171 | 0.852541 | [
"s929948554",
"s787050482"
] |
u145231176 | p03364 | python | s567461211 | s510037825 | 1,562 | 879 | 111,096 | 82,792 | Accepted | Accepted | 43.73 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 105 | 111 | 2,439 | 2,510 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 5.405405 | [
"-B = [list(eval(input())) for i in range(N)]",
"+B = []",
"+for i in range(N):",
"+ q = list(eval(input()))",
"+ B.append(q * 2)",
"+B += B",
"- res = [[\"\"] * N for i in range(N)]",
"+ \"\"\"",
"+ res = [[''] * N for i in range(N)]",
"+ \"\"\"",
"- if res[i][j] !=... | false | 0.007706 | 0.037622 | 0.204827 | [
"s567461211",
"s510037825"
] |
u131984977 | p02413 | python | s751257658 | s787975031 | 50 | 30 | 6,724 | 7,788 | Accepted | Accepted | 40 | (r, c) = [int(i) for i in input().split()]
ct = [0 for d in range(c)]
tmp = []
for rc in range(r):
tmp = [int(i) for i in input().split()]
total = 0
for cc in range(c):
ct[cc] += tmp[cc]
total += tmp[cc]
print(tmp[cc], end=' ')
print(total)
total = sum(ct)
print(' ... | (r, c) = [int(i) for i in input().split()]
last_row = [0 for _ in range(c+1)]
for _ in range(r):
row = [int(i) for i in input().split()]
for cc in range(c):
last_row[cc] += int(row[cc])
print(row[cc], end=' ')
print(sum(row))
last_row[-1] = sum(last_row)
print(' '.join([str(a)... | 14 | 13 | 356 | 341 | (r, c) = [int(i) for i in input().split()]
ct = [0 for d in range(c)]
tmp = []
for rc in range(r):
tmp = [int(i) for i in input().split()]
total = 0
for cc in range(c):
ct[cc] += tmp[cc]
total += tmp[cc]
print(tmp[cc], end=" ")
print(total)
total = sum(ct)
print(" ".join([str(i) ... | (r, c) = [int(i) for i in input().split()]
last_row = [0 for _ in range(c + 1)]
for _ in range(r):
row = [int(i) for i in input().split()]
for cc in range(c):
last_row[cc] += int(row[cc])
print(row[cc], end=" ")
print(sum(row))
last_row[-1] = sum(last_row)
print(" ".join([str(a) for a in las... | false | 7.142857 | [
"-ct = [0 for d in range(c)]",
"-tmp = []",
"-for rc in range(r):",
"- tmp = [int(i) for i in input().split()]",
"- total = 0",
"+last_row = [0 for _ in range(c + 1)]",
"+for _ in range(r):",
"+ row = [int(i) for i in input().split()]",
"- ct[cc] += tmp[cc]",
"- total += tmp... | false | 0.096555 | 0.040625 | 2.376745 | [
"s751257658",
"s787975031"
] |
u488127128 | p03037 | python | s549949749 | s460491172 | 295 | 129 | 10,996 | 11,028 | Accepted | Accepted | 56.27 | N,M = list(map(int, input().split()))
L,R = [],[]
for _ in range(M):
l,r = list(map(int, input().split()))
L.append(l)
R.append(r)
print((max(min(R)-max(L)+1,0))) | import sys
N,M = list(map(int, input().split()))
D = sys.stdin
L = []
R = []
for d in D:
l,r = list(map(int, d.split()))
L.append(l)
R.append(r)
print((max(min(R)-max(L)+1,0))) | 7 | 10 | 166 | 183 | N, M = list(map(int, input().split()))
L, R = [], []
for _ in range(M):
l, r = list(map(int, input().split()))
L.append(l)
R.append(r)
print((max(min(R) - max(L) + 1, 0)))
| import sys
N, M = list(map(int, input().split()))
D = sys.stdin
L = []
R = []
for d in D:
l, r = list(map(int, d.split()))
L.append(l)
R.append(r)
print((max(min(R) - max(L) + 1, 0)))
| false | 30 | [
"+import sys",
"+",
"-L, R = [], []",
"-for _ in range(M):",
"- l, r = list(map(int, input().split()))",
"+D = sys.stdin",
"+L = []",
"+R = []",
"+for d in D:",
"+ l, r = list(map(int, d.split()))"
] | false | 0.047156 | 0.045075 | 1.046175 | [
"s549949749",
"s460491172"
] |
u761320129 | p03261 | python | s189313932 | s141511988 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
W = [eval(input()) for i in range(N)]
for a,b in zip(W,W[1:]):
if a[-1] != b[0]:
print('No')
exit()
sl = len(set(W))
print(('Yes' if N == sl else 'No')) | N = int(eval(input()))
S = [eval(input()) for i in range(N)]
s = set()
p = None
for w in S:
if w in s:
print('No')
exit()
s.add(w)
if p and p != w[0]:
print('No')
exit()
p = w[-1]
print('Yes')
| 10 | 14 | 192 | 242 | N = int(eval(input()))
W = [eval(input()) for i in range(N)]
for a, b in zip(W, W[1:]):
if a[-1] != b[0]:
print("No")
exit()
sl = len(set(W))
print(("Yes" if N == sl else "No"))
| N = int(eval(input()))
S = [eval(input()) for i in range(N)]
s = set()
p = None
for w in S:
if w in s:
print("No")
exit()
s.add(w)
if p and p != w[0]:
print("No")
exit()
p = w[-1]
print("Yes")
| false | 28.571429 | [
"-W = [eval(input()) for i in range(N)]",
"-for a, b in zip(W, W[1:]):",
"- if a[-1] != b[0]:",
"+S = [eval(input()) for i in range(N)]",
"+s = set()",
"+p = None",
"+for w in S:",
"+ if w in s:",
"-sl = len(set(W))",
"-print((\"Yes\" if N == sl else \"No\"))",
"+ s.add(w)",
"+ if ... | false | 0.069284 | 0.046989 | 1.474478 | [
"s189313932",
"s141511988"
] |
u072717685 | p02612 | python | s647889954 | s932331581 | 73 | 29 | 61,604 | 9,196 | Accepted | Accepted | 60.27 | def main():
n = int(eval(input()))
n = n % 1000
r = 1000 - n
if r == 1000:
print((0))
else:
print(r)
if __name__ == '__main__':
main()
| import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from math import ceil
#import numpy as np
def main():
n = int(eval(input()))
r = ceil(n / 1000) * 1000 - n
print(r)
if __name__ == '__main__':
main()
| 12 | 13 | 180 | 268 | def main():
n = int(eval(input()))
n = n % 1000
r = 1000 - n
if r == 1000:
print((0))
else:
print(r)
if __name__ == "__main__":
main()
| import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from math import ceil
# import numpy as np
def main():
n = int(eval(input()))
r = ceil(n / 1000) * 1000 - n
print(r)
if __name__ == "__main__":
main()
| false | 7.692308 | [
"+import sys",
"+",
"+read = sys.stdin.read",
"+readline = sys.stdin.readline",
"+readlines = sys.stdin.readlines",
"+from math import ceil",
"+",
"+# import numpy as np",
"- n = n % 1000",
"- r = 1000 - n",
"- if r == 1000:",
"- print((0))",
"- else:",
"- print(r... | false | 0.045739 | 0.0382 | 1.197357 | [
"s647889954",
"s932331581"
] |
u819135704 | p03220 | python | s349810361 | s093577420 | 29 | 19 | 3,060 | 3,060 | Accepted | Accepted | 34.48 | n = int(eval(input()))
t, a = list(map(int, input().split()))
list = [int(i) for i in input().split()]
dif_list = []
answer = 0
for i in range(n):
t_i = t - list[i] * 0.006
t_i_dif = abs(a - t_i)
dif_list.append(t_i_dif)
if min(dif_list) == t_i_dif:
answer = i + 1
print(answer)
| n = int(eval(input()))
t, a = list(map(int, input().split()))
list = [int(i) for i in input().split()]
dif_list = []
for i in range(n):
t_i = t - list[i] * 0.006
t_i_dif = abs(a - t_i)
dif_list.append(t_i_dif)
Min = min(dif_list)
print((dif_list.index(Min) + 1))
| 15 | 13 | 308 | 276 | n = int(eval(input()))
t, a = list(map(int, input().split()))
list = [int(i) for i in input().split()]
dif_list = []
answer = 0
for i in range(n):
t_i = t - list[i] * 0.006
t_i_dif = abs(a - t_i)
dif_list.append(t_i_dif)
if min(dif_list) == t_i_dif:
answer = i + 1
print(answer)
| n = int(eval(input()))
t, a = list(map(int, input().split()))
list = [int(i) for i in input().split()]
dif_list = []
for i in range(n):
t_i = t - list[i] * 0.006
t_i_dif = abs(a - t_i)
dif_list.append(t_i_dif)
Min = min(dif_list)
print((dif_list.index(Min) + 1))
| false | 13.333333 | [
"-answer = 0",
"- if min(dif_list) == t_i_dif:",
"- answer = i + 1",
"-print(answer)",
"+Min = min(dif_list)",
"+print((dif_list.index(Min) + 1))"
] | false | 0.038931 | 0.153851 | 0.253047 | [
"s349810361",
"s093577420"
] |
u788703383 | p02683 | python | s778283013 | s030309811 | 95 | 81 | 9,216 | 9,236 | Accepted | Accepted | 14.74 | n,m,x = list(map(int,input().split()))
a = []
for i in range(n):
a.append(list(map(int,input().split())))
ans = 10**9
for i in range(2**n):
book_list = [0] * (m+1)
for j in range(n):
if i>>j&1:
for q,p in enumerate(a[j]):
if q == 0:continue
book... | import sys
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9 + 7
input = sys.stdin.readline
def inp():
return int(eval(input()))
def inpl():
return list(map(int,input().split()))
def inpm():
return list(map(int,input().split()))
ans = INF
n,m,x = list(map(int,input().split()))
a... | 23 | 33 | 577 | 674 | n, m, x = list(map(int, input().split()))
a = []
for i in range(n):
a.append(list(map(int, input().split())))
ans = 10**9
for i in range(2**n):
book_list = [0] * (m + 1)
for j in range(n):
if i >> j & 1:
for q, p in enumerate(a[j]):
if q == 0:
continue... | import sys
sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
input = sys.stdin.readline
def inp():
return int(eval(input()))
def inpl():
return list(map(int, input().split()))
def inpm():
return list(map(int, input().split()))
ans = INF
n, m, x = list(map(int, input().split()))
a = [i... | false | 30.30303 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**8)",
"+INF = float(\"inf\")",
"+mod = 10**9 + 7",
"+input = sys.stdin.readline",
"+",
"+",
"+def inp():",
"+ return int(eval(input()))",
"+",
"+",
"+def inpl():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def inpm():... | false | 0.008104 | 0.039234 | 0.206551 | [
"s778283013",
"s030309811"
] |
u078349616 | p03645 | python | s779799418 | s890240295 | 1,039 | 787 | 79,512 | 29,104 | Accepted | Accepted | 24.25 | N, M = list(map(int, input().split()))
L = [list(map(int, input().split())) for _ in range(M)]
G = [[] for _ in range(N)]
for x, y in L:
x, y = x-1, y-1
G[x].append(y)
G[y].append(x)
for v in G[0]:
if N-1 in G[v]:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") | 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)
for v in G[0]:
for nv in G[v]:
if nv == N-1:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") | 14 | 12 | 283 | 265 | N, M = list(map(int, input().split()))
L = [list(map(int, input().split())) for _ in range(M)]
G = [[] for _ in range(N)]
for x, y in L:
x, y = x - 1, y - 1
G[x].append(y)
G[y].append(x)
for v in G[0]:
if N - 1 in G[v]:
print("POSSIBLE")
exit()
print("IMPOSSIBLE")
| 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)
for v in G[0]:
for nv in G[v]:
if nv == N - 1:
print("POSSIBLE")
exit()
print("IMPOSSIBLE")
| false | 14.285714 | [
"-L = [list(map(int, input().split())) for _ in range(M)]",
"-for x, y in L:",
"- x, y = x - 1, y - 1",
"- G[x].append(y)",
"- G[y].append(x)",
"+for i in range(M):",
"+ a, b = [int(x) - 1 for x in input().split()]",
"+ G[a].append(b)",
"- if N - 1 in G[v]:",
"- print(\"PO... | false | 0.047907 | 0.09182 | 0.521754 | [
"s779799418",
"s890240295"
] |
u049182844 | p03036 | python | s764044866 | s383023209 | 30 | 25 | 9,080 | 9,180 | Accepted | Accepted | 16.67 | r ,d, x = list(map(int,input().split()))
xi = 0
for i in range(10):
if i ==0:
xi = r * x - d
else:
xi = r * xi - d
print(xi)
| r ,d, x = list(map(int,input().split()))
for i in range(10):
x = r * x - d
print(x)
| 9 | 4 | 143 | 85 | r, d, x = list(map(int, input().split()))
xi = 0
for i in range(10):
if i == 0:
xi = r * x - d
else:
xi = r * xi - d
print(xi)
| r, d, x = list(map(int, input().split()))
for i in range(10):
x = r * x - d
print(x)
| false | 55.555556 | [
"-xi = 0",
"- if i == 0:",
"- xi = r * x - d",
"- else:",
"- xi = r * xi - d",
"- print(xi)",
"+ x = r * x - d",
"+ print(x)"
] | false | 0.071844 | 0.069981 | 1.02662 | [
"s764044866",
"s383023209"
] |
u008357982 | p02862 | python | s733329517 | s784676527 | 984 | 159 | 91,540 | 3,064 | Accepted | Accepted | 83.84 | x, y = list(map(int, input().split()))
mod = 10**9 + 7
if (x + y) % 3 != 0:
print((0))
exit()
n = (x + y) // 3
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a == 0 or b == 0:
print((1))
exit()
if a < 0 or b < 0:
print((0))
exit()
MAX = 700000
fac = [1, 1] + [0] * MAX
finv = [1, 1]... | x, y = list(map(int, input().split()))
mod = 10**9 + 7
if (x + y) % 3:
print((0))
exit()
n = (x + y) // 3
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a < 0 or b < 0:
print((0))
exit()
if a == 0 or b == 0:
print((1))
exit()
def neko(n, r):
p, q = 1, 1
for i in range(r... | 33 | 25 | 670 | 439 | x, y = list(map(int, input().split()))
mod = 10**9 + 7
if (x + y) % 3 != 0:
print((0))
exit()
n = (x + y) // 3
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a == 0 or b == 0:
print((1))
exit()
if a < 0 or b < 0:
print((0))
exit()
MAX = 700000
fac = [1, 1] + [0] * MAX
finv = [1, 1] + [0] * MAX
inv... | x, y = list(map(int, input().split()))
mod = 10**9 + 7
if (x + y) % 3:
print((0))
exit()
n = (x + y) // 3
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a < 0 or b < 0:
print((0))
exit()
if a == 0 or b == 0:
print((1))
exit()
def neko(n, r):
p, q = 1, 1
for i in range(r):
p = p *... | false | 24.242424 | [
"-if (x + y) % 3 != 0:",
"+if (x + y) % 3:",
"+if a < 0 or b < 0:",
"+ print((0))",
"+ exit()",
"-if a < 0 or b < 0:",
"- print((0))",
"- exit()",
"-MAX = 700000",
"-fac = [1, 1] + [0] * MAX",
"-finv = [1, 1] + [0] * MAX",
"-inv = [0, 1] + [0] * MAX",
"-for i in range(2, MAX):",
... | false | 0.948493 | 0.064975 | 14.597724 | [
"s733329517",
"s784676527"
] |
u094191970 | p02579 | python | s447812648 | s109292644 | 1,646 | 1,110 | 136,172 | 135,784 | Accepted | Accepted | 32.56 | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import deque
h,w=nii()
ch,cw=nii()
dh,dw=nii()
s=[list(eval(input())) for i in range(h)]
ch-=1
cw-=1
dh-=1
dw-=1
ans=[[-1 for i in range(w)] for i in range(h)]
... | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import deque
h,w=nii()
ch,cw=nii()
ch-=1
cw-=1
dh,dw=nii()
dh-=1
dw-=1
s=[list(eval(input())) for i in range(h)]
dist=[[-1]*w for i in range(h)]
def BFS(que):
... | 45 | 50 | 895 | 1,115 | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
from collections import deque
h, w = nii()
ch, cw = nii()
dh, dw = nii()
s = [list(eval(input())) for i in range(h)]
ch -= 1
cw -= 1
dh -= 1
dw -= 1
ans = [[-1 for i in range(w)] for i ... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
from collections import deque
h, w = nii()
ch, cw = nii()
ch -= 1
cw -= 1
dh, dw = nii()
dh -= 1
dw -= 1
s = [list(eval(input())) for i in range(h)]
dist = [[-1] * w for i in range(h)]
... | false | 10 | [
"-dh, dw = nii()",
"-s = [list(eval(input())) for i in range(h)]",
"+dh, dw = nii()",
"-ans = [[-1 for i in range(w)] for i in range(h)]",
"-ans[ch][cw] = 0",
"+s = [list(eval(input())) for i in range(h)]",
"+dist = [[-1] * w for i in range(h)]",
"+",
"+",
"+def BFS(que):",
"+ while que:",
... | false | 0.200173 | 0.040247 | 4.97363 | [
"s447812648",
"s109292644"
] |
u655834330 | p03163 | python | s236696293 | s807779035 | 393 | 211 | 118,512 | 15,444 | Accepted | Accepted | 46.31 | def submit():
n, w = list(map(int, input().split()))
dp = [[0] * (w + 1) for _ in range(n + 1)]
# dp[i][j] = item iまでで重さjの時に実現する最大価値
for i in range(1, n + 1):
wi, vi = list(map(int, input().split()))
for j in range(1, w + 1):
if 0 <= j - wi <= w:
dp[... |
import numpy as np
n, w = list(map(int, input().split()))
dp = np.full(w + 1, 0, dtype=int)
# dp[w] : wまでitemを取捨選択した際の最大価値
for _ in range(n):
wi, vi = list(map(int, input().split()))
dp[wi:] = np.maximum(dp[:-wi] + vi, dp[wi:])
print((dp[-1])) | 16 | 12 | 470 | 252 | def submit():
n, w = list(map(int, input().split()))
dp = [[0] * (w + 1) for _ in range(n + 1)]
# dp[i][j] = item iまでで重さjの時に実現する最大価値
for i in range(1, n + 1):
wi, vi = list(map(int, input().split()))
for j in range(1, w + 1):
if 0 <= j - wi <= w:
dp[i][j] = ma... | import numpy as np
n, w = list(map(int, input().split()))
dp = np.full(w + 1, 0, dtype=int)
# dp[w] : wまでitemを取捨選択した際の最大価値
for _ in range(n):
wi, vi = list(map(int, input().split()))
dp[wi:] = np.maximum(dp[:-wi] + vi, dp[wi:])
print((dp[-1]))
| false | 25 | [
"-def submit():",
"- n, w = list(map(int, input().split()))",
"- dp = [[0] * (w + 1) for _ in range(n + 1)]",
"- # dp[i][j] = item iまでで重さjの時に実現する最大価値",
"- for i in range(1, n + 1):",
"- wi, vi = list(map(int, input().split()))",
"- for j in range(1, w + 1):",
"- if... | false | 0.045453 | 0.32359 | 0.140464 | [
"s236696293",
"s807779035"
] |
u140697185 | p03073 | python | s438899500 | s822771032 | 26 | 18 | 3,188 | 3,188 | Accepted | Accepted | 30.77 | S = eval(input())
N = len(S)
even = S[0::2]
odd = S[1::2]
ptn0 = N - (even.count('0') + odd.count('1'))
ptn1 = N - (even.count('1') + odd.count('0'))
print((min(ptn0, ptn1))) | s = eval(input())
even_s = s[1::2]
odd_s = s[::2]
num_1 = even_s.count('1')+odd_s.count('0')
num_2 = even_s.count('0')+odd_s.count('1')
print((min(num_1 , num_2))) | 7 | 9 | 172 | 166 | S = eval(input())
N = len(S)
even = S[0::2]
odd = S[1::2]
ptn0 = N - (even.count("0") + odd.count("1"))
ptn1 = N - (even.count("1") + odd.count("0"))
print((min(ptn0, ptn1)))
| s = eval(input())
even_s = s[1::2]
odd_s = s[::2]
num_1 = even_s.count("1") + odd_s.count("0")
num_2 = even_s.count("0") + odd_s.count("1")
print((min(num_1, num_2)))
| false | 22.222222 | [
"-S = eval(input())",
"-N = len(S)",
"-even = S[0::2]",
"-odd = S[1::2]",
"-ptn0 = N - (even.count(\"0\") + odd.count(\"1\"))",
"-ptn1 = N - (even.count(\"1\") + odd.count(\"0\"))",
"-print((min(ptn0, ptn1)))",
"+s = eval(input())",
"+even_s = s[1::2]",
"+odd_s = s[::2]",
"+num_1 = even_s.count(... | false | 0.033766 | 0.075391 | 0.447886 | [
"s438899500",
"s822771032"
] |
u982591663 | p02707 | python | s744844967 | s175964598 | 222 | 198 | 33,524 | 38,840 | Accepted | Accepted | 10.81 | N = int(eval(input()))
A = list(map(int, input().split()))
memo = {}
for i in range(N-1):
Si = A[i]
try:
memo[Si] += 1
except:
memo[Si] = 1
for i in range(1, N+1):
try:
print((memo[i]))
except:
print((0))
| N = int(eval(input()))
A = list(map(int, input().split()))
memo = {key:0 for key in range(1, N+1)}
for a in A:
memo[a] += 1
for key in list(memo.keys()):
print((memo[key]))
| 16 | 9 | 264 | 177 | N = int(eval(input()))
A = list(map(int, input().split()))
memo = {}
for i in range(N - 1):
Si = A[i]
try:
memo[Si] += 1
except:
memo[Si] = 1
for i in range(1, N + 1):
try:
print((memo[i]))
except:
print((0))
| N = int(eval(input()))
A = list(map(int, input().split()))
memo = {key: 0 for key in range(1, N + 1)}
for a in A:
memo[a] += 1
for key in list(memo.keys()):
print((memo[key]))
| false | 43.75 | [
"-memo = {}",
"-for i in range(N - 1):",
"- Si = A[i]",
"- try:",
"- memo[Si] += 1",
"- except:",
"- memo[Si] = 1",
"-for i in range(1, N + 1):",
"- try:",
"- print((memo[i]))",
"- except:",
"- print((0))",
"+memo = {key: 0 for key in range(1, N + 1... | false | 0.040996 | 0.041335 | 0.991784 | [
"s744844967",
"s175964598"
] |
u784022244 | p02959 | python | s490740809 | s128008772 | 192 | 165 | 18,624 | 18,624 | Accepted | Accepted | 14.06 | N=int(eval(input()))
A=list(map(int, input().split()))
B=list(map(int, input().split()))
count=0
for i in range(N):
fir=min(A[i],B[i])
count+=fir
sec=min(A[i+1], max(0,B[i]-fir))
count+=sec
A[i+1]-=sec
print(count) | N=int(eval(input()))
A=list(map(int, input().split()))
B=list(map(int, input().split()))
SUM=sum(A)
for i in range(N):
res=B[i]
fir=min(res,A[i])
A[i]=A[i]-fir
res-=fir
sec=min(res,A[i+1])
A[i+1]-=sec
print((SUM-sum(A))) | 12 | 13 | 232 | 249 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count = 0
for i in range(N):
fir = min(A[i], B[i])
count += fir
sec = min(A[i + 1], max(0, B[i] - fir))
count += sec
A[i + 1] -= sec
print(count)
| N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
SUM = sum(A)
for i in range(N):
res = B[i]
fir = min(res, A[i])
A[i] = A[i] - fir
res -= fir
sec = min(res, A[i + 1])
A[i + 1] -= sec
print((SUM - sum(A)))
| false | 7.692308 | [
"-count = 0",
"+SUM = sum(A)",
"- fir = min(A[i], B[i])",
"- count += fir",
"- sec = min(A[i + 1], max(0, B[i] - fir))",
"- count += sec",
"+ res = B[i]",
"+ fir = min(res, A[i])",
"+ A[i] = A[i] - fir",
"+ res -= fir",
"+ sec = min(res, A[i + 1])",
"-print(count)",
... | false | 0.041205 | 0.040555 | 1.016035 | [
"s490740809",
"s128008772"
] |
u462703607 | p03163 | python | s267376973 | s007435816 | 667 | 598 | 172,296 | 173,192 | Accepted | Accepted | 10.34 | N,W=list(map(int,input().split()))
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1,N+1):
w,v=list(map(int,input().split()))
for j in range(1,W+1):
if w<=j:
dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
else:
dp[i][j]=dp[i-1][j]
print((dp[N][W])) | N,W=list(map(int,input().split()))
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1,N+1):
w,v=list(map(int,input().split()))
for j in range(1,w):
dp[i][j]=dp[i-1][j]
for j in range(w,W+1):
if w<=j:
dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
print((dp[N][W])) | 10 | 10 | 276 | 287 | N, W = list(map(int, input().split()))
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]
for i in range(1, N + 1):
w, v = list(map(int, input().split()))
for j in range(1, W + 1):
if w <= j:
dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v)
else:
dp[i][j] = dp[i - 1... | N, W = list(map(int, input().split()))
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]
for i in range(1, N + 1):
w, v = list(map(int, input().split()))
for j in range(1, w):
dp[i][j] = dp[i - 1][j]
for j in range(w, W + 1):
if w <= j:
dp[i][j] = max(dp[i - 1][j], dp[i - 1]... | false | 0 | [
"- for j in range(1, W + 1):",
"+ for j in range(1, w):",
"+ dp[i][j] = dp[i - 1][j]",
"+ for j in range(w, W + 1):",
"- else:",
"- dp[i][j] = dp[i - 1][j]"
] | false | 0.038182 | 0.081911 | 0.466139 | [
"s267376973",
"s007435816"
] |
u201234972 | p02605 | python | s252471871 | s192262570 | 1,317 | 1,043 | 103,048 | 102,928 | Accepted | Accepted | 20.8 | N = int( eval(input()))
XYU = [ tuple( input().split()) for _ in range(N)]
U = []
R = []
D = []
L = []
for x, y, u in XYU:
x, y = int(x), int(y)
if u == "U":
U.append((x,y))
elif u == "D":
D.append((x,y))
elif u == "L":
L.append((x,y))
else:
R.append((x... | N=int(eval(input()))
XYU=[tuple(input().split()) for _ in range(N)]
U=[]
R=[]
D=[]
L=[]
for x,y,u in XYU:
x,y = int(x),int(y)
if u=="U":
U.append((x,y))
elif u=="D":
D.append((x,y))
elif u=="L":
L.append((x,y))
else:
R.append((x,y))
ans=[10**9]
def z(... | 41 | 38 | 1,104 | 972 | N = int(eval(input()))
XYU = [tuple(input().split()) for _ in range(N)]
U = []
R = []
D = []
L = []
for x, y, u in XYU:
x, y = int(x), int(y)
if u == "U":
U.append((x, y))
elif u == "D":
D.append((x, y))
elif u == "L":
L.append((x, y))
else:
R.append((x, y))
ans = [10... | N = int(eval(input()))
XYU = [tuple(input().split()) for _ in range(N)]
U = []
R = []
D = []
L = []
for x, y, u in XYU:
x, y = int(x), int(y)
if u == "U":
U.append((x, y))
elif u == "D":
D.append((x, y))
elif u == "L":
L.append((x, y))
else:
R.append((x, y))
ans = [10... | false | 7.317073 | [
"- n = -(10**10)",
"- p = -(10**10)",
"+ n = p = -(10**9)",
"- continue",
"- else:",
"- continue",
"+ continue",
"-print((\"SAFE\" if ans[0] == 10**9 else ans[0]))",
"+print((\"SAFE\" if ans[0] >= 10**9 else ans[0]))"
] | false | 0.041277 | 0.041264 | 1.000335 | [
"s252471871",
"s192262570"
] |
u677121387 | p02948 | python | s507713268 | s184574645 | 515 | 473 | 25,736 | 25,736 | Accepted | Accepted | 8.16 | from heapq import *
n,m = list(map(int,input().split()))
a = [[int(i) for i in input().split()] for _ in range(n)]
a.sort(key=lambda x:x[0])
ans = 0
PQ = []
heapify(PQ)
idx = 0
for i in range(1,m+1):
while idx < n and a[idx][0] <= i:
heappush(PQ,-a[idx][1])
idx += 1
if PQ: ans -= hea... | from heapq import heappop,heappush
n,m = list(map(int,input().split()))
lst = [[int(i) for i in input().split()] for _ in range(n)]
PQ = []
idx = 0
ans = 0
lst.sort(key = lambda x:x[0])
for i in range(1,m+1):
while idx < n and lst[idx][0] <= i:
heappush(PQ,-(lst[idx][1]))
idx += 1
if ... | 14 | 13 | 334 | 348 | from heapq import *
n, m = list(map(int, input().split()))
a = [[int(i) for i in input().split()] for _ in range(n)]
a.sort(key=lambda x: x[0])
ans = 0
PQ = []
heapify(PQ)
idx = 0
for i in range(1, m + 1):
while idx < n and a[idx][0] <= i:
heappush(PQ, -a[idx][1])
idx += 1
if PQ:
ans -=... | from heapq import heappop, heappush
n, m = list(map(int, input().split()))
lst = [[int(i) for i in input().split()] for _ in range(n)]
PQ = []
idx = 0
ans = 0
lst.sort(key=lambda x: x[0])
for i in range(1, m + 1):
while idx < n and lst[idx][0] <= i:
heappush(PQ, -(lst[idx][1]))
idx += 1
if PQ:
... | false | 7.142857 | [
"-from heapq import *",
"+from heapq import heappop, heappush",
"-a = [[int(i) for i in input().split()] for _ in range(n)]",
"-a.sort(key=lambda x: x[0])",
"+lst = [[int(i) for i in input().split()] for _ in range(n)]",
"+PQ = []",
"+idx = 0",
"-PQ = []",
"-heapify(PQ)",
"-idx = 0",
"+lst.sort(... | false | 0.040018 | 0.039724 | 1.007411 | [
"s507713268",
"s184574645"
] |
u138546245 | p02249 | python | s498899620 | s012075929 | 6,420 | 5,800 | 66,080 | 66,060 | Accepted | Accepted | 9.66 | from functools import lru_cache
class MatrixRKSearch:
shift = 40
size = 33554393
def __init__(self, m1, m2):
self.haystack = self._encode(m1)
self.needle = self._encode(m2)
def find(self):
i1, j1 = len(self.haystack), len(self.haystack[0])
i2, j2 = len(se... | from functools import lru_cache
class MatrixRKSearch:
shift = 40
size = 33554393
def __init__(self, m1, m2):
self.haystack = self._encode(m1)
self.needle = self._encode(m2)
def find(self):
i1, j1 = len(self.haystack), len(self.haystack[0])
i2, j2 = len(se... | 102 | 82 | 2,511 | 2,045 | from functools import lru_cache
class MatrixRKSearch:
shift = 40
size = 33554393
def __init__(self, m1, m2):
self.haystack = self._encode(m1)
self.needle = self._encode(m2)
def find(self):
i1, j1 = len(self.haystack), len(self.haystack[0])
i2, j2 = len(self.needle), l... | from functools import lru_cache
class MatrixRKSearch:
shift = 40
size = 33554393
def __init__(self, m1, m2):
self.haystack = self._encode(m1)
self.needle = self._encode(m2)
def find(self):
i1, j1 = len(self.haystack), len(self.haystack[0])
i2, j2 = len(self.needle), l... | false | 19.607843 | [
"+ @lru_cache(maxsize=1000)",
"-def search(matrix, pattern):",
"- \"\"\"Search matrix for pattern\"\"\"",
"-",
"- def _check(y, x):",
"- for m in range(py):",
"- for n in range(px):",
"- if matrix[y + m][x + n] != pattern[m][n]:",
"- retur... | false | 0.049982 | 0.048972 | 1.020624 | [
"s498899620",
"s012075929"
] |
u670180528 | p04021 | python | s221352501 | s224847522 | 120 | 94 | 19,852 | 18,292 | Accepted | Accepted | 21.67 | n,*l=list(map(int,open(0)));e=enumerate
d={j:i for i,j in e(sorted(l))}
print((sum([(d[j]+i)%2for i,j in e(l)])//2)) | n,*a=list(map(int,open(0)))
print((len(set(a[::2])^set(sorted(a)[::2]))//2)) | 3 | 2 | 110 | 69 | n, *l = list(map(int, open(0)))
e = enumerate
d = {j: i for i, j in e(sorted(l))}
print((sum([(d[j] + i) % 2 for i, j in e(l)]) // 2))
| n, *a = list(map(int, open(0)))
print((len(set(a[::2]) ^ set(sorted(a)[::2])) // 2))
| false | 33.333333 | [
"-n, *l = list(map(int, open(0)))",
"-e = enumerate",
"-d = {j: i for i, j in e(sorted(l))}",
"-print((sum([(d[j] + i) % 2 for i, j in e(l)]) // 2))",
"+n, *a = list(map(int, open(0)))",
"+print((len(set(a[::2]) ^ set(sorted(a)[::2])) // 2))"
] | false | 0.049142 | 0.039839 | 1.23351 | [
"s221352501",
"s224847522"
] |
u223646582 | p03061 | python | s962359664 | s800736311 | 690 | 221 | 91,488 | 16,124 | Accepted | Accepted | 67.97 | import fractions
N = int(eval(input()))
A = [int(i) for i in input().split()]
def segfunc(x, y):
return fractions.gcd(x, y)
def init(init_val):
# set_val
for i in range(N):
seg[i+num-1] = init_val[i]
# built
for i in range(num-2, -1, -1):
seg[i] = segfunc(seg[2*i+1... | import fractions
N = int(eval(input()))
A = [int(i) for i in input().split()]
GCD_l = [A[0]]
for i in range(1, N-1):
GCD_l.append(fractions.gcd(GCD_l[-1], A[i]))
A = A[::-1]
GCD_r = [A[0]]
for i in range(1, N-1):
GCD_r.append(fractions.gcd(GCD_r[-1], A[i]))
GCD_r = GCD_r[::-1]
# print(GCD_l, GC... | 65 | 25 | 1,285 | 540 | import fractions
N = int(eval(input()))
A = [int(i) for i in input().split()]
def segfunc(x, y):
return fractions.gcd(x, y)
def init(init_val):
# set_val
for i in range(N):
seg[i + num - 1] = init_val[i]
# built
for i in range(num - 2, -1, -1):
seg[i] = segfunc(seg[2 * i + 1], s... | import fractions
N = int(eval(input()))
A = [int(i) for i in input().split()]
GCD_l = [A[0]]
for i in range(1, N - 1):
GCD_l.append(fractions.gcd(GCD_l[-1], A[i]))
A = A[::-1]
GCD_r = [A[0]]
for i in range(1, N - 1):
GCD_r.append(fractions.gcd(GCD_r[-1], A[i]))
GCD_r = GCD_r[::-1]
# print(GCD_l, GCD_r)
ans = 1... | false | 61.538462 | [
"-",
"-",
"-def segfunc(x, y):",
"- return fractions.gcd(x, y)",
"-",
"-",
"-def init(init_val):",
"- # set_val",
"- for i in range(N):",
"- seg[i + num - 1] = init_val[i]",
"- # built",
"- for i in range(num - 2, -1, -1):",
"- seg[i] = segfunc(seg[2 * i + 1], se... | false | 0.085791 | 0.044995 | 1.906697 | [
"s962359664",
"s800736311"
] |
u983181637 | p03478 | python | s701932433 | s301112969 | 38 | 31 | 3,064 | 3,064 | Accepted | Accepted | 18.42 | x = [int(x) for x in input().split()]
N = x[0]
A = x[1]
B = x[2]
ans = 0
for i in range(N):
i = i+1
to_int = [int(i) for i in list(str(i))]
X = sum(to_int)
if (X >= A) & (X <= B) :
ans += i
print(ans) | x = [int(x) for x in input().split()]
N = x[0]
A = x[1]
B = x[2]
def check(x):
ans = 0
while x >= 10:
ans += x%10
x = x//10
ans += x
return ans
ans1 = 0
for i in range(N):
i = i+1
if (check(i) >= A) & (check(i) <= B):
ans1 += i
print(ans1) | 12 | 18 | 223 | 283 | x = [int(x) for x in input().split()]
N = x[0]
A = x[1]
B = x[2]
ans = 0
for i in range(N):
i = i + 1
to_int = [int(i) for i in list(str(i))]
X = sum(to_int)
if (X >= A) & (X <= B):
ans += i
print(ans)
| x = [int(x) for x in input().split()]
N = x[0]
A = x[1]
B = x[2]
def check(x):
ans = 0
while x >= 10:
ans += x % 10
x = x // 10
ans += x
return ans
ans1 = 0
for i in range(N):
i = i + 1
if (check(i) >= A) & (check(i) <= B):
ans1 += i
print(ans1)
| false | 33.333333 | [
"-ans = 0",
"+",
"+",
"+def check(x):",
"+ ans = 0",
"+ while x >= 10:",
"+ ans += x % 10",
"+ x = x // 10",
"+ ans += x",
"+ return ans",
"+",
"+",
"+ans1 = 0",
"- to_int = [int(i) for i in list(str(i))]",
"- X = sum(to_int)",
"- if (X >= A) & (X <= ... | false | 0.036004 | 0.035124 | 1.025029 | [
"s701932433",
"s301112969"
] |
u123310422 | p03645 | python | s159150017 | s117865376 | 798 | 459 | 37,576 | 37,532 | Accepted | Accepted | 42.48 | N, M = list(map(int, input().split(" ")))
m = set()
for _ in range(M):
a, b = list(map(int, input().split(" ")))
if a < b:
m.add((a,b))
else:
m.add((b,a))
for i in range(2, N):
if (1, i) in m and (i, N) in m:
print("POSSIBLE")
break
else:
print("IMP... | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split(" ")))
m = set()
for _ in range(M):
a, b = list(map(int, input().split(" ")))
if a < b:
m.add((a,b))
else:
m.add((b,a))
for i in range(2, N):
if (1, i) in m and (i, N) in m:
print("POSS... | 17 | 22 | 330 | 376 | N, M = list(map(int, input().split(" ")))
m = set()
for _ in range(M):
a, b = list(map(int, input().split(" ")))
if a < b:
m.add((a, b))
else:
m.add((b, a))
for i in range(2, N):
if (1, i) in m and (i, N) in m:
print("POSSIBLE")
break
else:
print("IMPOSSIBLE")
| import sys
input = sys.stdin.readline
N, M = list(map(int, input().split(" ")))
m = set()
for _ in range(M):
a, b = list(map(int, input().split(" ")))
if a < b:
m.add((a, b))
else:
m.add((b, a))
for i in range(2, N):
if (1, i) in m and (i, N) in m:
print("POSSIBLE")
brea... | false | 22.727273 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.046035 | 0.039664 | 1.16063 | [
"s159150017",
"s117865376"
] |
u109617871 | p03434 | python | s405822239 | s868784036 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
l = list(map(int, input().split()))
l.sort(reverse=True)
print((sum([l[i] for i in range(0, len(l), 2)]) - sum([l[i] for i in range(1, len(l), 2)]))) | N = int(eval(input()))
l = list(map(int, input().split()))
l.sort(reverse=True)
print((sum(l[0::2]) - sum(l[1::2]))) | 4 | 4 | 167 | 111 | N = int(eval(input()))
l = list(map(int, input().split()))
l.sort(reverse=True)
print(
(
sum([l[i] for i in range(0, len(l), 2)])
- sum([l[i] for i in range(1, len(l), 2)])
)
)
| N = int(eval(input()))
l = list(map(int, input().split()))
l.sort(reverse=True)
print((sum(l[0::2]) - sum(l[1::2])))
| false | 0 | [
"-print(",
"- (",
"- sum([l[i] for i in range(0, len(l), 2)])",
"- - sum([l[i] for i in range(1, len(l), 2)])",
"- )",
"-)",
"+print((sum(l[0::2]) - sum(l[1::2])))"
] | false | 0.049349 | 0.045899 | 1.075151 | [
"s405822239",
"s868784036"
] |
u377989038 | p02837 | python | s926617516 | s942093961 | 1,221 | 117 | 3,064 | 3,064 | Accepted | Accepted | 90.42 | n = int(eval(input()))
hf = [[None] for i in range(n)]
for i in range(n):
tmp = []
for j in range(int(eval(input()))):
tmp.append(list(map(int, input().split())))
hf[i] = tmp
ans = 0
for i in range(2 ** n):
f = 0
b = bin(i)[2:].zfill(n)
for j in range(n):
if b[j] ==... | def cnt_honest(bit):
for i in range(n):
if bit[i] == "1":
for x, y in hf[i]:
if bit[x - 1] != str(y):
return 0
return bit.count("1")
n = int(eval(input()))
hf = [[] for i in range(n)]
for i in range(n):
for j in range(int(eval(input()))... | 22 | 20 | 515 | 470 | n = int(eval(input()))
hf = [[None] for i in range(n)]
for i in range(n):
tmp = []
for j in range(int(eval(input()))):
tmp.append(list(map(int, input().split())))
hf[i] = tmp
ans = 0
for i in range(2**n):
f = 0
b = bin(i)[2:].zfill(n)
for j in range(n):
if b[j] == "0":
... | def cnt_honest(bit):
for i in range(n):
if bit[i] == "1":
for x, y in hf[i]:
if bit[x - 1] != str(y):
return 0
return bit.count("1")
n = int(eval(input()))
hf = [[] for i in range(n)]
for i in range(n):
for j in range(int(eval(input()))):
hf[... | false | 9.090909 | [
"+def cnt_honest(bit):",
"+ for i in range(n):",
"+ if bit[i] == \"1\":",
"+ for x, y in hf[i]:",
"+ if bit[x - 1] != str(y):",
"+ return 0",
"+ return bit.count(\"1\")",
"+",
"+",
"-hf = [[None] for i in range(n)]",
"+hf = [[] for i in r... | false | 0.047456 | 0.103349 | 0.459176 | [
"s926617516",
"s942093961"
] |
u045793300 | p03962 | python | s507794433 | s260160255 | 28 | 25 | 9,020 | 8,936 | Accepted | Accepted | 10.71 | a, b, c = input().split()
colors = 0
if a == b and b == c:
colors = 1
elif a == b or b == c or c == a:
colors = 2
else:
colors = 3
print(colors) | s = set(input().split())
print((len(s))) | 9 | 2 | 158 | 39 | a, b, c = input().split()
colors = 0
if a == b and b == c:
colors = 1
elif a == b or b == c or c == a:
colors = 2
else:
colors = 3
print(colors)
| s = set(input().split())
print((len(s)))
| false | 77.777778 | [
"-a, b, c = input().split()",
"-colors = 0",
"-if a == b and b == c:",
"- colors = 1",
"-elif a == b or b == c or c == a:",
"- colors = 2",
"-else:",
"- colors = 3",
"-print(colors)",
"+s = set(input().split())",
"+print((len(s)))"
] | false | 0.071372 | 0.035192 | 2.028036 | [
"s507794433",
"s260160255"
] |
u952708174 | p03041 | python | s009667482 | s468367195 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | N, K = [int(i) for i in input().split()]
S = eval(input())
ans = S[:K - 1] + S[K - 1].lower() + S[K:]
print(ans) | N, K = [int(i) for i in input().split()]
S = eval(input())
print((S[:K - 1] + S[K - 1].lower() + S[K:])) | 4 | 3 | 109 | 98 | N, K = [int(i) for i in input().split()]
S = eval(input())
ans = S[: K - 1] + S[K - 1].lower() + S[K:]
print(ans)
| N, K = [int(i) for i in input().split()]
S = eval(input())
print((S[: K - 1] + S[K - 1].lower() + S[K:]))
| false | 25 | [
"-ans = S[: K - 1] + S[K - 1].lower() + S[K:]",
"-print(ans)",
"+print((S[: K - 1] + S[K - 1].lower() + S[K:]))"
] | false | 0.045515 | 0.058772 | 0.774432 | [
"s009667482",
"s468367195"
] |
u690536347 | p03765 | python | s688160248 | s381129989 | 1,137 | 404 | 55,000 | 53,720 | Accepted | Accepted | 64.47 | S, T = eval(input()), eval(input())
q = int(eval(input()))
ls, lt = len(S), len(T)
acs, act = [0]*(ls+1), [0]*(lt+1)
for i in range(1, ls+1):
acs[i] = acs[i-1] + (S[i-1]=="A")
for i in range(1, lt+1):
act[i] = act[i-1] + (T[i-1]=="A")
for _ in range(q):
a, b, c, d = list(map(int, input().spli... | import sys
input=sys.stdin.readline
def solve():
S, T = eval(input()), eval(input())
q = int(eval(input()))
ls, lt = len(S), len(T)
acs, act = [0]*(ls+1), [0]*(lt+1)
for i in range(1, ls+1):
acs[i] = acs[i-1] + (S[i-1]=="A")
for i in range(1, lt+1):
act[i] = act... | 14 | 21 | 386 | 497 | S, T = eval(input()), eval(input())
q = int(eval(input()))
ls, lt = len(S), len(T)
acs, act = [0] * (ls + 1), [0] * (lt + 1)
for i in range(1, ls + 1):
acs[i] = acs[i - 1] + (S[i - 1] == "A")
for i in range(1, lt + 1):
act[i] = act[i - 1] + (T[i - 1] == "A")
for _ in range(q):
a, b, c, d = list(map(int, inp... | import sys
input = sys.stdin.readline
def solve():
S, T = eval(input()), eval(input())
q = int(eval(input()))
ls, lt = len(S), len(T)
acs, act = [0] * (ls + 1), [0] * (lt + 1)
for i in range(1, ls + 1):
acs[i] = acs[i - 1] + (S[i - 1] == "A")
for i in range(1, lt + 1):
act[i] ... | false | 33.333333 | [
"-S, T = eval(input()), eval(input())",
"-q = int(eval(input()))",
"-ls, lt = len(S), len(T)",
"-acs, act = [0] * (ls + 1), [0] * (lt + 1)",
"-for i in range(1, ls + 1):",
"- acs[i] = acs[i - 1] + (S[i - 1] == \"A\")",
"-for i in range(1, lt + 1):",
"- act[i] = act[i - 1] + (T[i - 1] == \"A\")",... | false | 0.163971 | 0.041675 | 3.934543 | [
"s688160248",
"s381129989"
] |
u631277801 | p03361 | python | s010094525 | s464459058 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | # 1.上下左右を探索
def searchAround(sheet, h,w):
# 上がblackか?
try:
isSharpAbove = (sheet[h-1][w]=="#")
if h==0:
isSharpAbove = False
except IndexError:
isSharpAbove = False
# 下がblackか?
try:
isSharpBelow = (sheet[h+1][w]=="#")
except Index... | H,W = list(map(int, input().split()))
graph = [[] for _ in range(H+2)]
graph[0].extend(["." for i in range(W+2)])
for h in range(H):
graph[h+1].append(".")
graph[h+1].extend(list(input().rstrip()))
graph[h+1].append(".")
graph[H+1].extend(["." for i in range(W+2)])
canAchieve = True
for h in ra... | 63 | 29 | 1,323 | 765 | # 1.上下左右を探索
def searchAround(sheet, h, w):
# 上がblackか?
try:
isSharpAbove = sheet[h - 1][w] == "#"
if h == 0:
isSharpAbove = False
except IndexError:
isSharpAbove = False
# 下がblackか?
try:
isSharpBelow = sheet[h + 1][w] == "#"
except IndexError:
... | H, W = list(map(int, input().split()))
graph = [[] for _ in range(H + 2)]
graph[0].extend(["." for i in range(W + 2)])
for h in range(H):
graph[h + 1].append(".")
graph[h + 1].extend(list(input().rstrip()))
graph[h + 1].append(".")
graph[H + 1].extend(["." for i in range(W + 2)])
canAchieve = True
for h in ... | false | 53.968254 | [
"-# 1.上下左右を探索",
"-def searchAround(sheet, h, w):",
"- # 上がblackか?",
"- try:",
"- isSharpAbove = sheet[h - 1][w] == \"#\"",
"- if h == 0:",
"- isSharpAbove = False",
"- except IndexError:",
"- isSharpAbove = False",
"- # 下がblackか?",
"- try:",
"- ... | false | 0.045917 | 0.046051 | 0.997094 | [
"s010094525",
"s464459058"
] |
u493520238 | p03253 | python | s497279590 | s495722798 | 262 | 120 | 62,320 | 88,896 | Accepted | Accepted | 54.2 | N_MAX = 10**6
MOD = 10**9 + 7
fac, finv, inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX
def com_init():
fac[0], fac[1] = 1, 1
finv[0], finv[1] = 1, 1
inv[1] = 1
for i in range(2, N_MAX):
fac[i] = fac[i - 1] * i % MOD
inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
finv[i] = finv[i ... | N_MAX = 10**6
MOD = 10**9 + 7
fac, finv, inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX
def com_init():
fac[0], fac[1] = 1, 1
finv[0], finv[1] = 1, 1
inv[1] = 1
for i in range(2, N_MAX):
fac[i] = fac[i - 1] * i % MOD
inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
finv[i] = finv[i ... | 58 | 54 | 1,256 | 1,155 | N_MAX = 10**6
MOD = 10**9 + 7
fac, finv, inv = [0] * N_MAX, [0] * N_MAX, [0] * N_MAX
def com_init():
fac[0], fac[1] = 1, 1
finv[0], finv[1] = 1, 1
inv[1] = 1
for i in range(2, N_MAX):
fac[i] = fac[i - 1] * i % MOD
inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
finv[i] = finv[i ... | N_MAX = 10**6
MOD = 10**9 + 7
fac, finv, inv = [0] * N_MAX, [0] * N_MAX, [0] * N_MAX
def com_init():
fac[0], fac[1] = 1, 1
finv[0], finv[1] = 1, 1
inv[1] = 1
for i in range(2, N_MAX):
fac[i] = fac[i - 1] * i % MOD
inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
finv[i] = finv[i ... | false | 6.896552 | [
"-# 60 -> {2:2, 3:1, 5:1}",
"- com_init()",
"- return",
"- fac = factorization(m)",
"- prime_combs = []",
"- for prime, cnt in list(fac.items()):",
"- prime_combs.append(com(n - 1 + cnt, cnt))",
"+ exit()",
"+ facd = factorization(m)",
"+ com_init()",
"- ... | false | 1.505362 | 1.496007 | 1.006253 | [
"s497279590",
"s495722798"
] |
u723583932 | p03161 | python | s785516924 | s797999014 | 473 | 340 | 55,392 | 52,448 | Accepted | Accepted | 28.12 | #b
n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
N=100010
INF=float('INF')
dp=[INF]*N
dp[0]=0
for i in range(1,n):
for j in range(1,k+1):
if i-j>=0:
dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print((dp[n-1])) | n,K=list(map(int,input().split()))
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
dp[i]=10**10
for k in range(1,min(K,i)+1):
dp[i]=min(dp[i],dp[i-k]+abs(h[i]-h[i-k]))
print((dp[n-1])) | 15 | 9 | 262 | 217 | # b
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
N = 100010
INF = float("INF")
dp = [INF] * N
dp[0] = 0
for i in range(1, n):
for j in range(1, k + 1):
if i - j >= 0:
dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))
print((dp[n - 1]))
| n, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [0] * n
for i in range(1, n):
dp[i] = 10**10
for k in range(1, min(K, i) + 1):
dp[i] = min(dp[i], dp[i - k] + abs(h[i] - h[i - k]))
print((dp[n - 1]))
| false | 40 | [
"-# b",
"-n, k = list(map(int, input().split()))",
"+n, K = list(map(int, input().split()))",
"-N = 100010",
"-INF = float(\"INF\")",
"-dp = [INF] * N",
"-dp[0] = 0",
"+dp = [0] * n",
"- for j in range(1, k + 1):",
"- if i - j >= 0:",
"- dp[i] = min(dp[i], dp[i - j] + abs(h[... | false | 0.050116 | 0.04845 | 1.034393 | [
"s785516924",
"s797999014"
] |
u150984829 | p02240 | python | s315131299 | s654979280 | 530 | 290 | 23,900 | 24,088 | Accepted | Accepted | 45.28 | def s():
n,m=list(map(int,input().split()))
P=[[]for _ in[0]*n]
C=[0]*n
k=0
for _ in[0]*m:
s,t=list(map(int,input().split()));P[s]+=[t];P[t]+=[s]
for i in range(n):
k+=1
if C[i]<1:
s=[i];C[i]=k
while s:
u=s.pop()
for v in P[u]:
if C[v]<1:C[v]=k;s+=[v]
for _ in[0]*int(eval(... | import sys
def s():
e=sys.stdin.readline
n,m=list(map(int,e().split()))
P=[[]for _ in[0]*n]
C=[0]*n
k=0
for _ in[0]*m:
s,t=list(map(int,e().split()));P[s]+=[t];P[t]+=[s]
for i in range(n):
k+=1
if C[i]<1:
s=[i];C[i]=k
while s:
u=s.pop()
for v in P[u]:
if C[v]<1:C[v]=k;s+=... | 19 | 21 | 408 | 427 | def s():
n, m = list(map(int, input().split()))
P = [[] for _ in [0] * n]
C = [0] * n
k = 0
for _ in [0] * m:
s, t = list(map(int, input().split()))
P[s] += [t]
P[t] += [s]
for i in range(n):
k += 1
if C[i] < 1:
s = [i]
C[i] = k
... | import sys
def s():
e = sys.stdin.readline
n, m = list(map(int, e().split()))
P = [[] for _ in [0] * n]
C = [0] * n
k = 0
for _ in [0] * m:
s, t = list(map(int, e().split()))
P[s] += [t]
P[t] += [s]
for i in range(n):
k += 1
if C[i] < 1:
... | false | 9.52381 | [
"+import sys",
"+",
"+",
"- n, m = list(map(int, input().split()))",
"+ e = sys.stdin.readline",
"+ n, m = list(map(int, e().split()))",
"- s, t = list(map(int, input().split()))",
"+ s, t = list(map(int, e().split()))",
"- for _ in [0] * int(eval(input())):",
"- a... | false | 0.034616 | 0.034217 | 1.011669 | [
"s315131299",
"s654979280"
] |
u504836877 | p03700 | python | s515340048 | s322292387 | 1,927 | 610 | 7,072 | 52,696 | Accepted | Accepted | 68.34 | N,A,B = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
def f(n, H, A, B): #n回の爆発で魔物を全て倒せるか判定
c = 0
for i in range(len(H)):
t = H[i]
t -= B*n
if t > 0:
c += t//(A-B) + min(1, t%(A-B))
if c > n:
return False
else:
... | N,A,B = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
def f(n):
cnt = 0
flag = True
for h in H:
x = (h-B*n)//(A-B) + min((h-B*n)%(A-B), 1)
cnt += max(0, x)
if cnt <= n:
return True
else:
return False
l = 0
r = 10**... | 32 | 27 | 656 | 453 | N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
def f(n, H, A, B): # n回の爆発で魔物を全て倒せるか判定
c = 0
for i in range(len(H)):
t = H[i]
t -= B * n
if t > 0:
c += t // (A - B) + min(1, t % (A - B))
if c > n:
return False
else:
... | N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
def f(n):
cnt = 0
flag = True
for h in H:
x = (h - B * n) // (A - B) + min((h - B * n) % (A - B), 1)
cnt += max(0, x)
if cnt <= n:
return True
else:
return False
l = 0
r = 10**9
w... | false | 15.625 | [
"-def f(n, H, A, B): # n回の爆発で魔物を全て倒せるか判定",
"- c = 0",
"- for i in range(len(H)):",
"- t = H[i]",
"- t -= B * n",
"- if t > 0:",
"- c += t // (A - B) + min(1, t % (A - B))",
"- if c > n:",
"+def f(n):",
"+ cnt = 0",
"+ flag = True",
"+ for h in... | false | 0.035194 | 0.036567 | 0.962449 | [
"s515340048",
"s322292387"
] |
u759412327 | p03485 | python | s383329807 | s312136018 | 36 | 21 | 5,148 | 3,316 | Accepted | Accepted | 41.67 | from math import ceil
from statistics import mean
a = list(map(int,input().split()))
print((ceil(mean(a)))) | import math
a,b = list(map(int,input().split()))
print((math.ceil((a+b)/2))) | 4 | 3 | 108 | 76 | from math import ceil
from statistics import mean
a = list(map(int, input().split()))
print((ceil(mean(a))))
| import math
a, b = list(map(int, input().split()))
print((math.ceil((a + b) / 2)))
| false | 25 | [
"-from math import ceil",
"-from statistics import mean",
"+import math",
"-a = list(map(int, input().split()))",
"-print((ceil(mean(a))))",
"+a, b = list(map(int, input().split()))",
"+print((math.ceil((a + b) / 2)))"
] | false | 0.058761 | 0.043046 | 1.365063 | [
"s383329807",
"s312136018"
] |
u177411511 | p03574 | python | s659492652 | s032625564 | 63 | 55 | 5,656 | 5,784 | Accepted | Accepted | 12.7 | import sys
import math
import bisect
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lamb... | import sys
import math
import bisect
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lamb... | 36 | 31 | 888 | 761 | import sys
import math
import bisect
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.read... | import sys
import math
import bisect
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.read... | false | 13.888889 | [
"- ppp = []",
"- for k in range(-1, 2):",
"- for l in range(-1, 2):",
"- if 0 <= i + k <= h - 1 and 0 <= j + l <= w - 1:",
"- ppp.append(li[i + k][j + l])",
"- for p in ppp:",
"+ for p in [",
"+ ... | false | 0.061803 | 0.037666 | 1.640825 | [
"s659492652",
"s032625564"
] |
u681444474 | p02971 | python | s821195143 | s673008231 | 923 | 664 | 70,104 | 14,660 | Accepted | Accepted | 28.06 | N = int(eval(input()))
a=[]
for i in range(N):
a.append(int(eval(input())))
a1=max(a)
b=sorted(a)
a2=b[N-2]
for j in range(N):
if a[j] != a1:
print(a1)
else:
print(a2) | # coding: utf-8
# Your code here!
N=int(eval(input()))
A=[0]*N
for i in range(N):
A[i]=int(eval(input()))
m=sorted(A)[N-1]
m_=A.index(m)
m2=sorted(A)[N-2]
m2_=A.index(m2)
for i in range(N):
if i!=m_:
print(m)
else:
print(m2) | 14 | 15 | 184 | 254 | N = int(eval(input()))
a = []
for i in range(N):
a.append(int(eval(input())))
a1 = max(a)
b = sorted(a)
a2 = b[N - 2]
for j in range(N):
if a[j] != a1:
print(a1)
else:
print(a2)
| # coding: utf-8
# Your code here!
N = int(eval(input()))
A = [0] * N
for i in range(N):
A[i] = int(eval(input()))
m = sorted(A)[N - 1]
m_ = A.index(m)
m2 = sorted(A)[N - 2]
m2_ = A.index(m2)
for i in range(N):
if i != m_:
print(m)
else:
print(m2)
| false | 6.666667 | [
"+# coding: utf-8",
"+# Your code here!",
"-a = []",
"+A = [0] * N",
"- a.append(int(eval(input())))",
"-a1 = max(a)",
"-b = sorted(a)",
"-a2 = b[N - 2]",
"-for j in range(N):",
"- if a[j] != a1:",
"- print(a1)",
"+ A[i] = int(eval(input()))",
"+m = sorted(A)[N - 1]",
"+m_ ... | false | 0.035579 | 0.069347 | 0.513061 | [
"s821195143",
"s673008231"
] |
u285443936 | p03409 | python | s170452741 | s333473447 | 30 | 19 | 3,064 | 3,064 | Accepted | Accepted | 36.67 | import sys
input = sys.stdin.readline
N = int(eval(input()))
R = []
B = []
ans = 0
for i in range(N):
a,b = list(map(int,input().split()))
R.append((a,b))
for i in range(N):
c,d = list(map(int,input().split()))
B.append((c,d))
R.sort(key=lambda x:x[0])
B.sort(key=lambda x:x[0])
H = []
l = 0
for ... | N = int(eval(input()))
red = []
blue = []
chosen = [0]*N
ans = 0
for i in range(N):
a,b = list(map(int, input().split()))
red.append((a,b))
for i in range(N):
c,d = list(map(int, input().split()))
blue.append((c,d))
red.sort(key=lambda x:x[1],reverse=True)
blue.sort(key=lambda x:x[0])
for i i... | 29 | 23 | 567 | 485 | import sys
input = sys.stdin.readline
N = int(eval(input()))
R = []
B = []
ans = 0
for i in range(N):
a, b = list(map(int, input().split()))
R.append((a, b))
for i in range(N):
c, d = list(map(int, input().split()))
B.append((c, d))
R.sort(key=lambda x: x[0])
B.sort(key=lambda x: x[0])
H = []
l = 0
for... | N = int(eval(input()))
red = []
blue = []
chosen = [0] * N
ans = 0
for i in range(N):
a, b = list(map(int, input().split()))
red.append((a, b))
for i in range(N):
c, d = list(map(int, input().split()))
blue.append((c, d))
red.sort(key=lambda x: x[1], reverse=True)
blue.sort(key=lambda x: x[0])
for i in ... | false | 20.689655 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-R = []",
"-B = []",
"+red = []",
"+blue = []",
"+chosen = [0] * N",
"- R.append((a, b))",
"+ red.append((a, b))",
"- B.append((c, d))",
"-R.sort(key=lambda x: x[0])",
"-B.sort(key=lambda x: x[0])",
"-H = []",
"-l = 0",
"+ ... | false | 0.077851 | 0.098859 | 0.787498 | [
"s170452741",
"s333473447"
] |
u284854859 | p03045 | python | s566072199 | s220101868 | 419 | 316 | 17,988 | 16,784 | Accepted | Accepted | 24.58 | import sys
input = sys.stdin.readline
n,m = list(map(int,input().split()))
#Union Find
par = [] #親
rank = [] #木の深さ
#初期化
for i in range(n):
#par[i]:i rank[i]:0
par.append(i)
rank.append(0)
#木の根を求める
def find(x,par):
if par[x] == x:
return x
else:
return find... | #Union Find
import sys
input = sys.stdin.readline
n,m = list(map(int,input().split()))
par = [i for i in range(n)] #親
rank = [0]*n #木の深さ
#木の根を求める
def find(x,par):
if par[x] == x:
return x
else:
par[x] = par[par[x]]
return find(par[x],par)
#xとyの属する集合の併合
def unite(x,... | 49 | 44 | 888 | 839 | import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
# Union Find
par = [] # 親
rank = [] # 木の深さ
# 初期化
for i in range(n):
# par[i]:i rank[i]:0
par.append(i)
rank.append(0)
# 木の根を求める
def find(x, par):
if par[x] == x:
return x
else:
return find(par[x], par)
... | # Union Find
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
par = [i for i in range(n)] # 親
rank = [0] * n # 木の深さ
# 木の根を求める
def find(x, par):
if par[x] == x:
return x
else:
par[x] = par[par[x]]
return find(par[x], par)
# xとyの属する集合の併合
def unite(x, y, par... | false | 10.204082 | [
"+# Union Find",
"-# Union Find",
"-par = [] # 親",
"-rank = [] # 木の深さ",
"-# 初期化",
"-for i in range(n):",
"- # par[i]:i rank[i]:0",
"- par.append(i)",
"- rank.append(0)",
"+par = [i for i in range(n)] # 親",
"+rank = [0] * n # 木の深さ",
"+ par[x] = par[par[x]]",
"-tank = []",
... | false | 0.163489 | 0.059207 | 2.761289 | [
"s566072199",
"s220101868"
] |
u577170763 | p03044 | python | s117341172 | s079835686 | 952 | 557 | 84,436 | 110,612 | Accepted | Accepted | 41.49 | import sys
sys.setrecursionlimit(100000)
# input data
n=int(eval(input()))
u=[]
v=[]
w=[]
for i in range(0,n-1):
ui,vi,wi = list(map(int, input().split()))
u.append(ui)
v.append(vi)
w.append(wi%2)
# solve
ans=[]
for i in range(0,n+1):
ans.append(-1)
_neighbors=[]
for i in range(0,n+1):
... | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return map(fn, readline().split())
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
N = gete(int)
g = [se... | 46 | 44 | 684 | 815 | import sys
sys.setrecursionlimit(100000)
# input data
n = int(eval(input()))
u = []
v = []
w = []
for i in range(0, n - 1):
ui, vi, wi = list(map(int, input().split()))
u.append(ui)
v.append(vi)
w.append(wi % 2)
# solve
ans = []
for i in range(0, n + 1):
ans.append(-1)
_neighbors = []
for i in rang... | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
def geta(fn=lambda s: s.decode()):
return map(fn, readline().split())
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
N = gete(int)
g = [set() for _ in ra... | false | 4.347826 | [
"+from collections import defaultdict",
"-sys.setrecursionlimit(100000)",
"-# input data",
"-n = int(eval(input()))",
"-u = []",
"-v = []",
"-w = []",
"-for i in range(0, n - 1):",
"- ui, vi, wi = list(map(int, input().split()))",
"- u.append(ui)",
"- v.append(vi)",
"- w.append(wi ... | false | 0.039028 | 0.076941 | 0.507249 | [
"s117341172",
"s079835686"
] |
u756195685 | p02921 | python | s166222041 | s382960534 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N1 = eval(input())
N2 = eval(input())
count = 0
for i in range(len(N1)):
if N1[i] == N2[i]:
count += 1
print(count)
| S = eval(input())
T = eval(input())
ans = 0
for i in range(3):
if S[i] == T[i]:
ans += 1
print(ans)
| 7 | 8 | 122 | 102 | N1 = eval(input())
N2 = eval(input())
count = 0
for i in range(len(N1)):
if N1[i] == N2[i]:
count += 1
print(count)
| S = eval(input())
T = eval(input())
ans = 0
for i in range(3):
if S[i] == T[i]:
ans += 1
print(ans)
| false | 12.5 | [
"-N1 = eval(input())",
"-N2 = eval(input())",
"-count = 0",
"-for i in range(len(N1)):",
"- if N1[i] == N2[i]:",
"- count += 1",
"-print(count)",
"+S = eval(input())",
"+T = eval(input())",
"+ans = 0",
"+for i in range(3):",
"+ if S[i] == T[i]:",
"+ ans += 1",
"+print(a... | false | 0.043684 | 0.043471 | 1.00491 | [
"s166222041",
"s382960534"
] |
u814986259 | p03575 | python | s829099989 | s098933414 | 34 | 24 | 3,444 | 3,316 | Accepted | Accepted | 29.41 | import collections
N, M = list(map(int, input().split()))
a = [0]*M
b = [0]*M
table = collections.defaultdict(list)
for i in range(M):
a[i], b[i] = list(map(int, input().split()))
table[a[i]].append(b[i])
table[b[i]].append(a[i])
bridge = []
for x in table:
if len(table[x]) < 2:
brid... | import collections
N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(M)]
G = [set() for i in range(N)]
for a, b in ab:
a -= 1
b -= 1
G[a].add(b)
G[b].add(a)
ans = 0
for a, b in ab:
a -= 1
b -= 1
q = collections.deque([0])
r =... | 32 | 31 | 753 | 643 | import collections
N, M = list(map(int, input().split()))
a = [0] * M
b = [0] * M
table = collections.defaultdict(list)
for i in range(M):
a[i], b[i] = list(map(int, input().split()))
table[a[i]].append(b[i])
table[b[i]].append(a[i])
bridge = []
for x in table:
if len(table[x]) < 2:
bridge.appe... | import collections
N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(M)]
G = [set() for i in range(N)]
for a, b in ab:
a -= 1
b -= 1
G[a].add(b)
G[b].add(a)
ans = 0
for a, b in ab:
a -= 1
b -= 1
q = collections.deque([0])
r = [1] * N
r[0] =... | false | 3.125 | [
"-a = [0] * M",
"-b = [0] * M",
"-table = collections.defaultdict(list)",
"-for i in range(M):",
"- a[i], b[i] = list(map(int, input().split()))",
"- table[a[i]].append(b[i])",
"- table[b[i]].append(a[i])",
"-bridge = []",
"-for x in table:",
"- if len(table[x]) < 2:",
"- brid... | false | 0.055538 | 0.117512 | 0.472612 | [
"s829099989",
"s098933414"
] |
u339199690 | p03013 | python | s820947648 | s385788036 | 266 | 201 | 7,700 | 13,424 | Accepted | Accepted | 24.44 | N, M = list(map(int, input().split()))
A = [True] * (N + 1)
for i in range(M):
a = int(eval(input()))
A[a] = False
dp = [0] * (N + 1)
dp[0] = 1
mod = 10 ** 9 + 7
for i in range(N):
for j in range(i + 1, min(N, i + 2) + 1):
if A[j]:
dp[j] += dp[i]
dp[j] %= mod
... | N, M = list(map(int, input().split()))
A = [True] * (N + 1)
for _ in range(M):
a = int(eval(input()))
A[a] = False
dp = [0] * (N + 1)
dp[0] = 1
for i in range(N):
for j in range(i + 1, min(N, i + 2) + 1):
if A[j] is True:
dp[j] += dp[i]
dp[j] %= 10 ** 9 + 7
... | 18 | 16 | 349 | 321 | N, M = list(map(int, input().split()))
A = [True] * (N + 1)
for i in range(M):
a = int(eval(input()))
A[a] = False
dp = [0] * (N + 1)
dp[0] = 1
mod = 10**9 + 7
for i in range(N):
for j in range(i + 1, min(N, i + 2) + 1):
if A[j]:
dp[j] += dp[i]
dp[j] %= mod
# prin... | N, M = list(map(int, input().split()))
A = [True] * (N + 1)
for _ in range(M):
a = int(eval(input()))
A[a] = False
dp = [0] * (N + 1)
dp[0] = 1
for i in range(N):
for j in range(i + 1, min(N, i + 2) + 1):
if A[j] is True:
dp[j] += dp[i]
dp[j] %= 10**9 + 7
print((dp[N]))
| false | 11.111111 | [
"-for i in range(M):",
"+for _ in range(M):",
"-mod = 10**9 + 7",
"- if A[j]:",
"+ if A[j] is True:",
"- dp[j] %= mod",
"- # print(dp)",
"+ dp[j] %= 10**9 + 7"
] | false | 0.081726 | 0.080516 | 1.015019 | [
"s820947648",
"s385788036"
] |
u197615397 | p02345 | python | s708508914 | s956709113 | 1,350 | 940 | 15,092 | 16,364 | Accepted | Accepted | 30.37 | import math
class SegmentTree:
__slots__ = ["elem_size", "tree_size", "tree"]
def __init__(self, a: list, default: int):
real_size = len(a)
self.elem_size = 1 << math.ceil(math.log2(real_size))
self.tree_size = 2 * self.elem_size
self.tree = [default]*self.elem_size ... | import math
class SegmentTree:
__slots__ = ["elem_size", "tree_size", "tree", "default"]
def __init__(self, a: list, default: int):
real_size = len(a)
self.elem_size = 1 << math.ceil(math.log2(real_size))
self.tree_size = 2 * self.elem_size
self.tree = [default] * self.e... | 71 | 63 | 2,125 | 2,100 | import math
class SegmentTree:
__slots__ = ["elem_size", "tree_size", "tree"]
def __init__(self, a: list, default: int):
real_size = len(a)
self.elem_size = 1 << math.ceil(math.log2(real_size))
self.tree_size = 2 * self.elem_size
self.tree = (
[default] * self.elem... | import math
class SegmentTree:
__slots__ = ["elem_size", "tree_size", "tree", "default"]
def __init__(self, a: list, default: int):
real_size = len(a)
self.elem_size = 1 << math.ceil(math.log2(real_size))
self.tree_size = 2 * self.elem_size
self.tree = (
[default] ... | false | 11.267606 | [
"- __slots__ = [\"elem_size\", \"tree_size\", \"tree\"]",
"+ __slots__ = [\"elem_size\", \"tree_size\", \"tree\", \"default\"]",
"+ self.default = default",
"- def init_tree(self):",
"+ def init_tree(self) -> None:",
"- # ===== ??????????????´???????????? =====",
"+ ... | false | 0.088705 | 0.194346 | 0.456429 | [
"s708508914",
"s956709113"
] |
u585482323 | p03607 | python | s815811649 | s493725424 | 290 | 224 | 52,444 | 53,852 | Accepted | Accepted | 22.76 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, ... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | 111 | 39 | 2,022 | 944 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return list(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def LS():
return list(m... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | false | 64.864865 | [
"-from collections import defaultdict",
"-from collections import deque",
"+from collections import defaultdict, deque",
"+from itertools import permutations, accumulate",
"-import random",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return [int(x) for x in sys.stdin.buffer.readlin... | false | 0.049985 | 0.082442 | 0.606303 | [
"s815811649",
"s493725424"
] |
u893063840 | p03161 | python | s010878365 | s663717375 | 1,324 | 1,209 | 151,036 | 120,200 | Accepted | Accepted | 8.69 | import numpy as np
from numba import njit
n, k = list(map(int, input().split()))
h = np.array(list(map(int, input().split())), np.int64)
INF = 10 ** 18
@njit
def f():
dp = np.full(n, INF, np.int64)
dp[0] = 0
for i, e in enumerate(h[1:], 1):
lb = np.maximum(0, i - k)
dp[i] ... | import numpy as np
from numba import njit
n, k = list(map(int, input().split()))
h = np.array(list(map(int, input().split())), np.int64)
INF = 10 ** 18
@njit
def f(n, k, h):
dp = np.full(n, INF, np.int64)
dp[0] = 0
for i in range(1, n):
lb = np.maximum(0, i - k)
dp[i] = np... | 23 | 23 | 418 | 424 | import numpy as np
from numba import njit
n, k = list(map(int, input().split()))
h = np.array(list(map(int, input().split())), np.int64)
INF = 10**18
@njit
def f():
dp = np.full(n, INF, np.int64)
dp[0] = 0
for i, e in enumerate(h[1:], 1):
lb = np.maximum(0, i - k)
dp[i] = np.min(dp[lb:i] ... | import numpy as np
from numba import njit
n, k = list(map(int, input().split()))
h = np.array(list(map(int, input().split())), np.int64)
INF = 10**18
@njit
def f(n, k, h):
dp = np.full(n, INF, np.int64)
dp[0] = 0
for i in range(1, n):
lb = np.maximum(0, i - k)
dp[i] = np.min(dp[lb:i] + np... | false | 0 | [
"-def f():",
"+def f(n, k, h):",
"- for i, e in enumerate(h[1:], 1):",
"+ for i in range(1, n):",
"- dp[i] = np.min(dp[lb:i] + np.abs(h[lb:i] - e))",
"+ dp[i] = np.min(dp[lb:i] + np.abs(h[lb:i] - h[i]))",
"-ans = f()",
"+ans = f(n, k, h)"
] | false | 0.347807 | 0.346142 | 1.004809 | [
"s010878365",
"s663717375"
] |
u917013605 | p03160 | python | s291079704 | s522802463 | 246 | 98 | 55,240 | 85,080 | Accepted | Accepted | 60.16 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0, abs(h[1] - h[0])]
for i in range(2, n):
dp.append(min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2])))
print((dp[n - 1]))
| def input_li():
return list(map(int, input().split()))
def input_int():
return int(eval(input()))
N = input_int()
h_li = input_li()
dp = [0] * N
dp[0] = 0
dp[1] = abs(h_li[1] - h_li[0])
for i in range(2, N):
dp[i] = min(
dp[i - 1] + abs(h_li[i] - h_li[i - 1]),
dp[i - 2] + abs... | 7 | 17 | 213 | 360 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0, abs(h[1] - h[0])]
for i in range(2, n):
dp.append(min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2])))
print((dp[n - 1]))
| def input_li():
return list(map(int, input().split()))
def input_int():
return int(eval(input()))
N = input_int()
h_li = input_li()
dp = [0] * N
dp[0] = 0
dp[1] = abs(h_li[1] - h_li[0])
for i in range(2, N):
dp[i] = min(
dp[i - 1] + abs(h_li[i] - h_li[i - 1]), dp[i - 2] + abs(h_li[i] - h_li[i - ... | false | 58.823529 | [
"-n = int(eval(input()))",
"-h = list(map(int, input().split()))",
"-dp = [0, abs(h[1] - h[0])]",
"-for i in range(2, n):",
"- dp.append(min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2])))",
"-print((dp[n - 1]))",
"+def input_li():",
"+ return list(map(int, input().split()))... | false | 0.046398 | 0.037187 | 1.247692 | [
"s291079704",
"s522802463"
] |
u803617136 | p02885 | python | s087089252 | s886961546 | 186 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.86 | A, B = list(map(int, input().split()))
space = A - B * 2
if space < 0:
space = 0
print(space) | a, b = list(map(int, input().split()))
ans = max(a - 2 * b, 0)
print(ans) | 5 | 3 | 95 | 69 | A, B = list(map(int, input().split()))
space = A - B * 2
if space < 0:
space = 0
print(space)
| a, b = list(map(int, input().split()))
ans = max(a - 2 * b, 0)
print(ans)
| false | 40 | [
"-A, B = list(map(int, input().split()))",
"-space = A - B * 2",
"-if space < 0:",
"- space = 0",
"-print(space)",
"+a, b = list(map(int, input().split()))",
"+ans = max(a - 2 * b, 0)",
"+print(ans)"
] | false | 0.115193 | 0.092096 | 1.250794 | [
"s087089252",
"s886961546"
] |
u968166680 | p02586 | python | s094296098 | s443876109 | 2,265 | 2,081 | 206,108 | 168,936 | Accepted | Accepted | 8.12 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
R, C, K, *RCV = list(map(int, read().split()))
item = dict()
for r, c, v in zip(*[iter(RCV)] * 3):
item[(r - 1, ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
R, C, K, *RCV = list(map(int, read().split()))
item = dict()
for r, c, v in zip(*[iter(RCV)] * 3):
item[(r - 1, ... | 37 | 38 | 869 | 880 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
R, C, K, *RCV = list(map(int, read().split()))
item = dict()
for r, c, v in zip(*[iter(RCV)] * 3):
item[(r - 1, c - 1)] = v
dp... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
R, C, K, *RCV = list(map(int, read().split()))
item = dict()
for r, c, v in zip(*[iter(RCV)] * 3):
item[(r - 1, c - 1)] = v
dp... | false | 2.631579 | [
"- dp = [[0] * (C + 1) for _ in range(R + 1)]",
"+ dp = [0] * (C + 1)",
"+ dp, dp_prev = [0] * (C + 1), dp",
"- if v[k] < dp[i][j + 1]:",
"- v[k] = dp[i][j + 1]",
"+ if v[k] < dp_prev[j + 1]:",
"+ v[k] = dp_prev[j + 1]",
... | false | 0.04286 | 0.06737 | 0.636185 | [
"s094296098",
"s443876109"
] |
u293528155 | p02694 | python | s292521136 | s313112698 | 24 | 21 | 9,128 | 9,168 | Accepted | Accepted | 12.5 | from math import floor,ceil
X = int(eval(input()))
p = 100
c = 0
while p < X:
p=floor(p*1.01)
c += 1
print(c) | from math import floor,ceil
X = int(eval(input()))
cash = 100
count = 0
while cash < X:
cash=floor(cash*1.01)
count += 1
print(count) | 9 | 8 | 121 | 142 | from math import floor, ceil
X = int(eval(input()))
p = 100
c = 0
while p < X:
p = floor(p * 1.01)
c += 1
print(c)
| from math import floor, ceil
X = int(eval(input()))
cash = 100
count = 0
while cash < X:
cash = floor(cash * 1.01)
count += 1
print(count)
| false | 11.111111 | [
"-p = 100",
"-c = 0",
"-while p < X:",
"- p = floor(p * 1.01)",
"- c += 1",
"-print(c)",
"+cash = 100",
"+count = 0",
"+while cash < X:",
"+ cash = floor(cash * 1.01)",
"+ count += 1",
"+print(count)"
] | false | 0.045145 | 0.036802 | 1.226714 | [
"s292521136",
"s313112698"
] |
u621935300 | p02775 | python | s957198398 | s847663712 | 176 | 126 | 86,900 | 51,308 | Accepted | Accepted | 28.41 | # -*- coding: utf-8 -*-
N="0"+input()
l=len(N)
F=[ 0 for _ in range(l) ] #繰り上がりなし
T=[ 0 for _ in range(l) ] #繰り上がりあり
#初期化
T[0]="N"
x=int(N[l-1])
F[l-1]=x
T[l-1]=10-x
for i in range(l-1,0,-1):
next_x=int(N[i-1])
F[i-1]=min(F[i]+next_x, T[i]+next_x+1)
T[i-1]=min(F[i]+10-next_x, T[i]+10-(next_... | # -*- coding: utf-8 -*-
N="0"+input()
l=len(N)
F=[ 0 for _ in range(l) ] #繰り上がりなし
T=[ 0 for _ in range(l) ] #繰り上がりあり
#初期化
x=int(N[l-1])
F[l-1]=x
T[l-1]=10-x
for i in range(l-1,0,-1):
next_x=int(N[i-1])
#繰上なしへの遷移。前の桁が繰上なしの場合は単に該当桁の数字を足す、
#前の桁が繰上ありの場合は、今の桁の数字が1増える
F[i-1]=min(F[i]+next_x, ... | 18 | 21 | 344 | 496 | # -*- coding: utf-8 -*-
N = "0" + input()
l = len(N)
F = [0 for _ in range(l)] # 繰り上がりなし
T = [0 for _ in range(l)] # 繰り上がりあり
# 初期化
T[0] = "N"
x = int(N[l - 1])
F[l - 1] = x
T[l - 1] = 10 - x
for i in range(l - 1, 0, -1):
next_x = int(N[i - 1])
F[i - 1] = min(F[i] + next_x, T[i] + next_x + 1)
T[i - 1] = mi... | # -*- coding: utf-8 -*-
N = "0" + input()
l = len(N)
F = [0 for _ in range(l)] # 繰り上がりなし
T = [0 for _ in range(l)] # 繰り上がりあり
# 初期化
x = int(N[l - 1])
F[l - 1] = x
T[l - 1] = 10 - x
for i in range(l - 1, 0, -1):
next_x = int(N[i - 1])
# 繰上なしへの遷移。前の桁が繰上なしの場合は単に該当桁の数字を足す、
# 前の桁が繰上ありの場合は、今の桁の数字が1増える
F[i - ... | false | 14.285714 | [
"-T[0] = \"N\"",
"+ # 繰上なしへの遷移。前の桁が繰上なしの場合は単に該当桁の数字を足す、",
"+ # 前の桁が繰上ありの場合は、今の桁の数字が1増える",
"+ # 繰上ありへの遷移。前の桁が繰上なしの場合は(10-該当桁の数字)を足す、",
"+ # 前の桁が繰上ありの場合は今の桁の数字が1増えているので(10-該当桁の数字+1)"
] | false | 0.073202 | 0.045223 | 1.618685 | [
"s957198398",
"s847663712"
] |
u685263709 | p03283 | python | s425788192 | s961046396 | 1,623 | 1,339 | 15,332 | 79,476 | Accepted | Accepted | 17.5 | N, M, Q = list(map(int, input().split()))
coordinate = [[0] * N for _ in range(N)]
for _ in range(M):
l, r = list(map(int, input().split()))
l, r = l - 1, r - 1
coordinate[l][r] += 1
acc = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N):
for j in range(N):
acc[i + 1][j + 1] ... | N, M, Q = list(map(int, input().split()))
LR = [list(map(int, input().split())) for i in range(M)]
PQ = [list(map(int, input().split())) for i in range(Q)]
acc = [[0 for i in range(N+1)] for i in range(N+1)] # acc[i][j] = i以下からスタートしてj以下で終了する電車の数
coordinate = [[0 for i in range(N)] for i in range(N)]
for l, r in... | 18 | 19 | 512 | 577 | N, M, Q = list(map(int, input().split()))
coordinate = [[0] * N for _ in range(N)]
for _ in range(M):
l, r = list(map(int, input().split()))
l, r = l - 1, r - 1
coordinate[l][r] += 1
acc = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N):
for j in range(N):
acc[i + 1][j + 1] = acc[i][j + ... | N, M, Q = list(map(int, input().split()))
LR = [list(map(int, input().split())) for i in range(M)]
PQ = [list(map(int, input().split())) for i in range(Q)]
acc = [
[0 for i in range(N + 1)] for i in range(N + 1)
] # acc[i][j] = i以下からスタートしてj以下で終了する電車の数
coordinate = [[0 for i in range(N)] for i in range(N)]
for l, r... | false | 5.263158 | [
"-coordinate = [[0] * N for _ in range(N)]",
"-for _ in range(M):",
"- l, r = list(map(int, input().split()))",
"- l, r = l - 1, r - 1",
"+LR = [list(map(int, input().split())) for i in range(M)]",
"+PQ = [list(map(int, input().split())) for i in range(Q)]",
"+acc = [",
"+ [0 for i in range(N... | false | 0.036053 | 0.049852 | 0.723206 | [
"s425788192",
"s961046396"
] |
u498136917 | p02597 | python | s280308581 | s561409563 | 38 | 30 | 9,316 | 9,312 | Accepted | Accepted | 21.05 | import sys
input = sys.stdin.readline
n = int(eval(input()))
c = eval(input())
r = c.count("R")
w = c.count("W")
s = c[:r]
s = s.count("W")
print((min(w, s))) | import sys
input = sys.stdin.readline
n = int(eval(input()))
c = eval(input())
r = c.count("R")
w = c.count("W")
s = c[:r]
s = s.count("W")
print(s) | 10 | 10 | 155 | 147 | import sys
input = sys.stdin.readline
n = int(eval(input()))
c = eval(input())
r = c.count("R")
w = c.count("W")
s = c[:r]
s = s.count("W")
print((min(w, s)))
| import sys
input = sys.stdin.readline
n = int(eval(input()))
c = eval(input())
r = c.count("R")
w = c.count("W")
s = c[:r]
s = s.count("W")
print(s)
| false | 0 | [
"-print((min(w, s)))",
"+print(s)"
] | false | 0.038748 | 0.03557 | 1.089345 | [
"s280308581",
"s561409563"
] |
u111684666 | p02622 | python | s082432534 | s647429949 | 67 | 61 | 9,352 | 9,220 | Accepted | Accepted | 8.96 | S = eval(input())
T = eval(input())
cnt = 0
for i in range(len(S)):
if S[i] != T[i]:
cnt += 1
print(cnt)
| s = eval(input())
t = eval(input())
cnt = 0
for i in range(len(s)):
if s[i] != t[i]:
cnt += 1
print(cnt)
| 9 | 8 | 109 | 107 | S = eval(input())
T = eval(input())
cnt = 0
for i in range(len(S)):
if S[i] != T[i]:
cnt += 1
print(cnt)
| s = eval(input())
t = eval(input())
cnt = 0
for i in range(len(s)):
if s[i] != t[i]:
cnt += 1
print(cnt)
| false | 11.111111 | [
"-S = eval(input())",
"-T = eval(input())",
"+s = eval(input())",
"+t = eval(input())",
"-for i in range(len(S)):",
"- if S[i] != T[i]:",
"+for i in range(len(s)):",
"+ if s[i] != t[i]:"
] | false | 0.041173 | 0.044222 | 0.931066 | [
"s082432534",
"s647429949"
] |
u272682534 | p02732 | python | s339480837 | s013248589 | 427 | 381 | 30,592 | 26,268 | Accepted | Accepted | 10.77 | N = int(eval(input()))
*a,= list(map(int, input().split()))
count,result={},{}
for i in range(N):
count[a[i]]=0
result[a[i]]=0
def ncn(n):
return n*(n-1)//2
for i in range(N):
count[a[i]]+=1
total=0
for key in list(count.keys()):
kc = count[key]
result[key]=ncn(kc)
total += result[... | N = int(eval(input()))
*a,= list(map(int, input().split()))
count={}
for i in range(N):
count[a[i]]=0
def ncn(n):
return n*(n-1)//2
for i in range(N):
count[a[i]]+=1
total=0
for key in list(count.keys()):
kc = count[key]
total += ncn(kc)
def without(k):
return total-count[a[k]] +... | 26 | 23 | 405 | 347 | N = int(eval(input()))
(*a,) = list(map(int, input().split()))
count, result = {}, {}
for i in range(N):
count[a[i]] = 0
result[a[i]] = 0
def ncn(n):
return n * (n - 1) // 2
for i in range(N):
count[a[i]] += 1
total = 0
for key in list(count.keys()):
kc = count[key]
result[key] = ncn(kc)
... | N = int(eval(input()))
(*a,) = list(map(int, input().split()))
count = {}
for i in range(N):
count[a[i]] = 0
def ncn(n):
return n * (n - 1) // 2
for i in range(N):
count[a[i]] += 1
total = 0
for key in list(count.keys()):
kc = count[key]
total += ncn(kc)
def without(k):
return total - coun... | false | 11.538462 | [
"-count, result = {}, {}",
"+count = {}",
"- result[a[i]] = 0",
"- result[key] = ncn(kc)",
"- total += result[key]",
"+ total += ncn(kc)"
] | false | 0.03709 | 0.037372 | 0.992444 | [
"s339480837",
"s013248589"
] |
u573754721 | p02982 | python | s269151600 | s984295469 | 176 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.34 | import math
N,D = list(map(int,input().split()))
X = [list(map(int,input().split()))for _ in range(N)]
count = 0
a = 0
for i in range(N):
for j in range(i + 1,N):
for k in range(D):
a += (X[i][k] - X[j][k])**2
if math.sqrt(a) == int(math.sqrt(a)):
count += 1
... | import math
n,d=list(map(int,input().split()))
x=[list(map(int,input().split())) for _ in range(n)]
count=0
for i in range(n-1):
for j in range(i+1,n):
c=0
for k in range(d):
c+=(x[i][k]-x[j][k])**2
if math.sqrt(c)==int(math.sqrt(c)):
... | 15 | 13 | 339 | 342 | import math
N, D = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N)]
count = 0
a = 0
for i in range(N):
for j in range(i + 1, N):
for k in range(D):
a += (X[i][k] - X[j][k]) ** 2
if math.sqrt(a) == int(math.sqrt(a)):
count += 1
a... | import math
n, d = list(map(int, input().split()))
x = [list(map(int, input().split())) for _ in range(n)]
count = 0
for i in range(n - 1):
for j in range(i + 1, n):
c = 0
for k in range(d):
c += (x[i][k] - x[j][k]) ** 2
if math.sqrt(c) == int(math.sqrt(c)):
count +=... | false | 13.333333 | [
"-N, D = list(map(int, input().split()))",
"-X = [list(map(int, input().split())) for _ in range(N)]",
"+n, d = list(map(int, input().split()))",
"+x = [list(map(int, input().split())) for _ in range(n)]",
"-a = 0",
"-for i in range(N):",
"- for j in range(i + 1, N):",
"- for k in range(D):"... | false | 0.034794 | 0.035927 | 0.968458 | [
"s269151600",
"s984295469"
] |
u185464141 | p02789 | python | s279932307 | s605999628 | 323 | 162 | 22,972 | 13,784 | Accepted | Accepted | 49.85 | # coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)
import math
import statistics
import numpy as np
import queue
# fact(int)
def fact(n):
if(n == 1):
return 1
else:
return (n * fact(n - 1))
# gcd(int,int)
def gcd(a,b):
if a == 0:
... | # coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)
import math
import statistics
import numpy as np
import queue
import itertools
n,m = list(map(int, input().split()))
if n == m:
print('Yes')
else:
print('No')
| 53 | 17 | 1,002 | 279 | # coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)
import math
import statistics
import numpy as np
import queue
# fact(int)
def fact(n):
if n == 1:
return 1
else:
return n * fact(n - 1)
# gcd(int,int)
def gcd(a, b):
if a == 0:
... | # coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)
import math
import statistics
import numpy as np
import queue
import itertools
n, m = list(map(int, input().split()))
if n == m:
print("Yes")
else:
print("No")
| false | 67.924528 | [
"+import itertools",
"-# fact(int)",
"-def fact(n):",
"- if n == 1:",
"- return 1",
"- else:",
"- return n * fact(n - 1)",
"-",
"-",
"-# gcd(int,int)",
"-def gcd(a, b):",
"- if a == 0:",
"- return b",
"- elif b == 0:",
"- return a",
"- else:",... | false | 0.04101 | 0.040319 | 1.017142 | [
"s279932307",
"s605999628"
] |
u305366205 | p03252 | python | s227805610 | s754709519 | 182 | 159 | 4,144 | 3,888 | Accepted | Accepted | 12.64 | import collections
s = eval(input())
t = eval(input())
dd = collections.defaultdict(str)
dd2 = collections.defaultdict(str)
for i in range(len(s)):
if dd[t[i]] == '':
dd[t[i]] = s[i]
if dd[t[i]] != '' and dd[t[i]] != s[i]:
print('No')
exit()
for i in range(len(s)):
if dd2... | import collections
s = eval(input())
t = eval(input())
dd = collections.defaultdict(str)
dd2 = collections.defaultdict(str)
for i in range(len(s)):
key = s[i]
key2 = t[i]
if dd[key] != '' and dd[key] != key2 or dd2[key2] != '' and dd2[key2] != key:
print('No')
exit()
dd[key] =... | 18 | 14 | 445 | 348 | import collections
s = eval(input())
t = eval(input())
dd = collections.defaultdict(str)
dd2 = collections.defaultdict(str)
for i in range(len(s)):
if dd[t[i]] == "":
dd[t[i]] = s[i]
if dd[t[i]] != "" and dd[t[i]] != s[i]:
print("No")
exit()
for i in range(len(s)):
if dd2[s[i]] == "... | import collections
s = eval(input())
t = eval(input())
dd = collections.defaultdict(str)
dd2 = collections.defaultdict(str)
for i in range(len(s)):
key = s[i]
key2 = t[i]
if dd[key] != "" and dd[key] != key2 or dd2[key2] != "" and dd2[key2] != key:
print("No")
exit()
dd[key] = key2
... | false | 22.222222 | [
"- if dd[t[i]] == \"\":",
"- dd[t[i]] = s[i]",
"- if dd[t[i]] != \"\" and dd[t[i]] != s[i]:",
"+ key = s[i]",
"+ key2 = t[i]",
"+ if dd[key] != \"\" and dd[key] != key2 or dd2[key2] != \"\" and dd2[key2] != key:",
"-for i in range(len(s)):",
"- if dd2[s[i]] == \"\":",
"- ... | false | 0.038108 | 0.036812 | 1.035215 | [
"s227805610",
"s754709519"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.