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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u285891772 | p03017 | python | s917208492 | s845972995 | 70 | 44 | 12,260 | 10,936 | Accepted | Accepted | 37.14 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 51 | 33 | 1,360 | 1,092 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 35.294118 | [
"-S = list(eval(input()))",
"-",
"-",
"-def cango(a, b):",
"- for i in range(a, b):",
"- if S[i] == \"#\" and S[i + 1] == \"#\":",
"- return False",
"- break",
"- else:",
"- return True",
"-",
"-",
"-if C < D:",
"- if cango(A - 1, C - 1) and can... | false | 0.038645 | 0.037986 | 1.017349 | [
"s917208492",
"s845972995"
] |
u625729943 | p02861 | python | s366383672 | s582506038 | 439 | 209 | 7,972 | 40,556 | Accepted | Accepted | 52.39 | import sys
import itertools
import math
#input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
pattern = list(itertools.permutations(list(range(N))))
pall = 0
for pat in pattern:
for i in range(N-1):
currp = xy[... | import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]... | 23 | 28 | 528 | 895 | import sys
import itertools
import math
# input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(N)]
pattern = list(itertools.permutations(list(range(N))))
pall = 0
for pat in pattern:
for i in range(N - 1):
currp = xy[pat[i]]
... | import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial # , gcd
from bisect import bisect_left # bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9 + 7
def input():
return sys.stdin.readline(... | false | 17.857143 | [
"-import sys",
"-import itertools",
"-import math",
"+import sys, math",
"+from itertools import permutations, combinations",
"+from collections import defaultdict, Counter, deque",
"+from math import factorial # , gcd",
"+from bisect import bisect_left # bisect_left(list, value)",
"-# input = sys... | false | 0.04737 | 0.042368 | 1.118064 | [
"s366383672",
"s582506038"
] |
u141610915 | p03304 | python | s258652547 | s646743111 | 167 | 66 | 38,384 | 61,580 | Accepted | Accepted | 60.48 | import sys
input = sys.stdin.readline
n, m, d = list(map(float, input().split()))
t = float(n - d)
if d == 0: print(((m - 1) * (1 / n)))
else: print(((m - 1) * 2 * t / pow(n, 2))) | import sys
input = sys.stdin.readline
N, M, D = list(map(float, input().split()))
print(((M - 1) / N + ((N - 2 * D) > 0 and (D > 0)) * (N - 2 * D) * (M - 1) / (N ** 2))) | 6 | 4 | 174 | 164 | import sys
input = sys.stdin.readline
n, m, d = list(map(float, input().split()))
t = float(n - d)
if d == 0:
print(((m - 1) * (1 / n)))
else:
print(((m - 1) * 2 * t / pow(n, 2)))
| import sys
input = sys.stdin.readline
N, M, D = list(map(float, input().split()))
print(((M - 1) / N + ((N - 2 * D) > 0 and (D > 0)) * (N - 2 * D) * (M - 1) / (N**2)))
| false | 33.333333 | [
"-n, m, d = list(map(float, input().split()))",
"-t = float(n - d)",
"-if d == 0:",
"- print(((m - 1) * (1 / n)))",
"-else:",
"- print(((m - 1) * 2 * t / pow(n, 2)))",
"+N, M, D = list(map(float, input().split()))",
"+print(((M - 1) / N + ((N - 2 * D) > 0 and (D > 0)) * (N - 2 * D) * (M - 1) / (... | false | 0.033974 | 0.03496 | 0.971781 | [
"s258652547",
"s646743111"
] |
u753803401 | p03013 | python | s200910479 | s280179504 | 238 | 203 | 52,696 | 50,008 | Accepted | Accepted | 14.71 | import sys
import collections
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, m = list(map(int, input().rstrip('\n').split()))
a = collections.defaultdict(list)
for _ in range(m):
a[int(input().rstrip('\n'))]
ls = [0] * (n + 1)
ls[0] = 1 if 0 not in a else ... | import sys
import collections
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n, m = list(map(int, readline().split()))
d = collections.defaultdict(int)
for i in range(m):
d[int(readline())]
dp = [0] * (n + 1)
dp[0] = 1
for i in range(1, n + 1):... | 24 | 26 | 562 | 580 | import sys
import collections
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n, m = list(map(int, input().rstrip("\n").split()))
a = collections.defaultdict(list)
for _ in range(m):
a[int(input().rstrip("\n"))]
ls = [0] * (n + 1)
ls[0] = 1 if 0 not in a else 0
ls[1] = ... | import sys
import collections
def solve():
readline = sys.stdin.buffer.readline
mod = 10**9 + 7
n, m = list(map(int, readline().split()))
d = collections.defaultdict(int)
for i in range(m):
d[int(readline())]
dp = [0] * (n + 1)
dp[0] = 1
for i in range(1, n + 1):
if i n... | false | 7.692308 | [
"- input = sys.stdin.readline",
"+ readline = sys.stdin.buffer.readline",
"- n, m = list(map(int, input().rstrip(\"\\n\").split()))",
"- a = collections.defaultdict(list)",
"- for _ in range(m):",
"- a[int(input().rstrip(\"\\n\"))]",
"- ls = [0] * (n + 1)",
"- ls[0] = 1 if ... | false | 0.03581 | 0.035848 | 0.998948 | [
"s200910479",
"s280179504"
] |
u723711163 | p03476 | python | s016021197 | s396555642 | 1,006 | 447 | 51,416 | 78,820 | Accepted | Accepted | 55.57 | import math
primes = [True]*(10**5+1)
primes[0],primes[1] = False,False
cumsum = [0]*(10**5+1)
for i in range(2, int(math.sqrt(10**5)+1)):
if primes[i]:
j = 2
while i*j <= 10**5:
primes[i*j] = False
j += 1
for i in range(2, 10**5+1):
if primes[i] and primes[(i+1)//2]:
cumsum[... | MAX_INT = 10**5+1
primes = [True] * (10**5+1)
primes[0], primes[1] = False, False
for i in range(2, int(MAX_INT**0.5)+1):
if primes[i]:
for j in range(i*2, MAX_INT, i):
primes[j] = False
cumsum = [0] * (10**5+1)
for i in range(1, 10**5+1, 2):
if primes[i] and primes[(i+1)//2]:
cumsum[i] ... | 22 | 20 | 482 | 488 | import math
primes = [True] * (10**5 + 1)
primes[0], primes[1] = False, False
cumsum = [0] * (10**5 + 1)
for i in range(2, int(math.sqrt(10**5) + 1)):
if primes[i]:
j = 2
while i * j <= 10**5:
primes[i * j] = False
j += 1
for i in range(2, 10**5 + 1):
if primes[i] and pr... | MAX_INT = 10**5 + 1
primes = [True] * (10**5 + 1)
primes[0], primes[1] = False, False
for i in range(2, int(MAX_INT**0.5) + 1):
if primes[i]:
for j in range(i * 2, MAX_INT, i):
primes[j] = False
cumsum = [0] * (10**5 + 1)
for i in range(1, 10**5 + 1, 2):
if primes[i] and primes[(i + 1) // 2]... | false | 9.090909 | [
"-import math",
"-",
"+MAX_INT = 10**5 + 1",
"+for i in range(2, int(MAX_INT**0.5) + 1):",
"+ if primes[i]:",
"+ for j in range(i * 2, MAX_INT, i):",
"+ primes[j] = False",
"-for i in range(2, int(math.sqrt(10**5) + 1)):",
"- if primes[i]:",
"- j = 2",
"- wh... | false | 0.461511 | 0.098494 | 4.685682 | [
"s016021197",
"s396555642"
] |
u847467233 | p00092 | python | s113043832 | s078462948 | 4,660 | 3,930 | 33,068 | 33,064 | Accepted | Accepted | 15.67 | # AOJ 0092 Square Searching
# Python3 2018.6.21 bal4u
cin = [[''] for r in range(1002)]
dp = [[0 for c in range(1002)] for r in range(1002)]
while 1:
n = int(eval(input()))
if n == 0: break
for r in range(n):
cin[r] = eval(input())
ans = 0
for r in range(n):
for c in range(n):
if cin[r][c] ==... | # AOJ 0092 Square Searching
# Python3 2018.6.21 bal4u
cin = [[''] for r in range(1002)]
dp = [[0 for c in range(1002)] for r in range(1002)]
while 1:
n = int(eval(input()))
if n == 0: break
for r in range(n): cin[r] = eval(input())
ans = 0
for r in range(n):
for c in range(n):
if cin[r][c] == '*... | 23 | 22 | 538 | 515 | # AOJ 0092 Square Searching
# Python3 2018.6.21 bal4u
cin = [[""] for r in range(1002)]
dp = [[0 for c in range(1002)] for r in range(1002)]
while 1:
n = int(eval(input()))
if n == 0:
break
for r in range(n):
cin[r] = eval(input())
ans = 0
for r in range(n):
for c in range(n)... | # AOJ 0092 Square Searching
# Python3 2018.6.21 bal4u
cin = [[""] for r in range(1002)]
dp = [[0 for c in range(1002)] for r in range(1002)]
while 1:
n = int(eval(input()))
if n == 0:
break
for r in range(n):
cin[r] = eval(input())
ans = 0
for r in range(n):
for c in range(n)... | false | 4.347826 | [
"- if t > 0 and dp[r][c - 1] < t:",
"+ if dp[r][c - 1] < t:",
"- if t > 0 and dp[r - 1][c] < t:",
"+ if dp[r - 1][c] < t:"
] | false | 0.116852 | 0.120423 | 0.970347 | [
"s113043832",
"s078462948"
] |
u511379665 | p03363 | python | s391662756 | s911084439 | 858 | 240 | 99,536 | 39,264 | Accepted | Accepted | 72.03 | from math import factorial
N=list(map(int,input().split()))
A=list(map(int,input().split()))
tmp=[0]
sum=0
for i in range(len(A)):
sum+=A[i]
tmp.append(sum)
tmp.sort()
tmp.append(1.2)
def combinations_count(n, r):
return factorial(n) // (factorial(n - r) * factorial(r))
cnt=1
ans=0
for... | from collections import defaultdict
n=int(eval(input()))
a=list(map(int,input().split()))
ans=0
d=defaultdict(int)
sum_a=0
d[sum_a]+=1
for i in range(n):
sum_a+=a[i]
ans+=d[sum_a]
d[sum_a]+=1
print(ans) | 27 | 13 | 503 | 221 | from math import factorial
N = list(map(int, input().split()))
A = list(map(int, input().split()))
tmp = [0]
sum = 0
for i in range(len(A)):
sum += A[i]
tmp.append(sum)
tmp.sort()
tmp.append(1.2)
def combinations_count(n, r):
return factorial(n) // (factorial(n - r) * factorial(r))
cnt = 1
ans = 0
for ... | from collections import defaultdict
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
d = defaultdict(int)
sum_a = 0
d[sum_a] += 1
for i in range(n):
sum_a += a[i]
ans += d[sum_a]
d[sum_a] += 1
print(ans)
| false | 51.851852 | [
"-from math import factorial",
"+from collections import defaultdict",
"-N = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-tmp = [0]",
"-sum = 0",
"-for i in range(len(A)):",
"- sum += A[i]",
"- tmp.append(sum)",
"-tmp.sort()",
"-tmp.append(1.2)",
"-",
"-"... | false | 0.042347 | 0.151663 | 0.279218 | [
"s391662756",
"s911084439"
] |
u905582793 | p02782 | python | s592866838 | s918398856 | 1,823 | 225 | 105,200 | 71,664 | Accepted | Accepted | 87.66 | mod = 10**9+7
rng = 2000100
fctr = [1]+[0]*(rng-1)
finv = [1]+[0]*(rng-1)
for i in range(1,rng):
fctr[i] = fctr[i-1]*i%mod
for i in range(1,rng):
finv[i] = pow(fctr[i],mod-2,mod)
def cmb(n,k):
if n<0 or k<0:
return 0
else:
return fctr[n]*finv[n-k]*finv[k]%mod
x1,y1,x2,y2 = list(map(int,in... | mod = 10**9+7
rng = 2000100
fctr = [1]+[0]*(rng-1)
for i in range(1,rng):
fctr[i] = fctr[i-1]*i%mod
def finv(x):
return pow(fctr[x],mod-2,mod)
def cmb(n,k):
if n<0 or k<0:
return 0
else:
return fctr[n]*finv(n-k)*finv(k)%mod
x1,y1,x2,y2 = list(map(int,input().split()))
print(((cmb(x2+y2+2,... | 16 | 15 | 407 | 370 | mod = 10**9 + 7
rng = 2000100
fctr = [1] + [0] * (rng - 1)
finv = [1] + [0] * (rng - 1)
for i in range(1, rng):
fctr[i] = fctr[i - 1] * i % mod
for i in range(1, rng):
finv[i] = pow(fctr[i], mod - 2, mod)
def cmb(n, k):
if n < 0 or k < 0:
return 0
else:
return fctr[n] * finv[n - k] * f... | mod = 10**9 + 7
rng = 2000100
fctr = [1] + [0] * (rng - 1)
for i in range(1, rng):
fctr[i] = fctr[i - 1] * i % mod
def finv(x):
return pow(fctr[x], mod - 2, mod)
def cmb(n, k):
if n < 0 or k < 0:
return 0
else:
return fctr[n] * finv(n - k) * finv(k) % mod
x1, y1, x2, y2 = list(map(... | false | 6.25 | [
"-finv = [1] + [0] * (rng - 1)",
"-for i in range(1, rng):",
"- finv[i] = pow(fctr[i], mod - 2, mod)",
"+",
"+",
"+def finv(x):",
"+ return pow(fctr[x], mod - 2, mod)",
"- return fctr[n] * finv[n - k] * finv[k] % mod",
"+ return fctr[n] * finv(n - k) * finv(k) % mod"
] | false | 0.006608 | 0.926884 | 0.007129 | [
"s592866838",
"s918398856"
] |
u832039789 | p02659 | python | s636698480 | s543971136 | 64 | 27 | 61,740 | 9,960 | Accepted | Accepted | 57.81 | a,b = input().split()
a = int(a)
c,d = b.split('.')
a *= int(c + d)
a //= 100
print(a) | from decimal import Decimal as D
a,b = input().split()
print((int(D(a) * D(b))))
| 6 | 4 | 91 | 83 | a, b = input().split()
a = int(a)
c, d = b.split(".")
a *= int(c + d)
a //= 100
print(a)
| from decimal import Decimal as D
a, b = input().split()
print((int(D(a) * D(b))))
| false | 33.333333 | [
"+from decimal import Decimal as D",
"+",
"-a = int(a)",
"-c, d = b.split(\".\")",
"-a *= int(c + d)",
"-a //= 100",
"-print(a)",
"+print((int(D(a) * D(b))))"
] | false | 0.041119 | 0.043613 | 0.942821 | [
"s636698480",
"s543971136"
] |
u276192130 | p03252 | python | s372289657 | s672008782 | 306 | 158 | 9,776 | 6,716 | Accepted | Accepted | 48.37 | S = list(eval(input()))
T = list(eval(input()))
S2, T2 = [], []
St, Tt = [], []
for i in range(26):
s = chr(ord('a') + i)
St.append(S.count(s))
Tt.append(T.count(s))
for i in range(len(S)):
S2.append(St[ord(S[i]) - ord('a')])
T2.append(Tt[ord(T[i]) - ord('a')])
if S2 != T2:
print('No... | s = eval(input())
t = eval(input())
sal = [0 for i in range(26)]
tal = [0 for i in range(26)]
s2, t2 = [], []
for i in range(26):
sal[i] = s.count(chr(ord('a') + i))
tal[i] = t.count(chr(ord('a') + i))
for i in range(len(s)):
s2.append(sal[ord(s[i]) - ord('a')])
t2.append(tal[ord(t[i]) - ord('... | 15 | 15 | 336 | 370 | S = list(eval(input()))
T = list(eval(input()))
S2, T2 = [], []
St, Tt = [], []
for i in range(26):
s = chr(ord("a") + i)
St.append(S.count(s))
Tt.append(T.count(s))
for i in range(len(S)):
S2.append(St[ord(S[i]) - ord("a")])
T2.append(Tt[ord(T[i]) - ord("a")])
if S2 != T2:
print("No")
else:
... | s = eval(input())
t = eval(input())
sal = [0 for i in range(26)]
tal = [0 for i in range(26)]
s2, t2 = [], []
for i in range(26):
sal[i] = s.count(chr(ord("a") + i))
tal[i] = t.count(chr(ord("a") + i))
for i in range(len(s)):
s2.append(sal[ord(s[i]) - ord("a")])
t2.append(tal[ord(t[i]) - ord("a")])
if s... | false | 0 | [
"-S = list(eval(input()))",
"-T = list(eval(input()))",
"-S2, T2 = [], []",
"-St, Tt = [], []",
"+s = eval(input())",
"+t = eval(input())",
"+sal = [0 for i in range(26)]",
"+tal = [0 for i in range(26)]",
"+s2, t2 = [], []",
"- s = chr(ord(\"a\") + i)",
"- St.append(S.count(s))",
"- ... | false | 0.037416 | 0.065892 | 0.567843 | [
"s372289657",
"s672008782"
] |
u503228842 | p03575 | python | s039386262 | s117215592 | 40 | 20 | 3,700 | 3,064 | Accepted | Accepted | 50 | import copy
N,M = list(map(int,input().split()))
graph = [[] for _ in range(N)]
edges = []
for _ in range(M):
a,b = list(map(int,input().split()))
graph[a-1].append(b-1)
graph[b-1].append(a-1)
edges.append([a-1,b-1])
def dfs(G,v):
seen[v] = True
#print(seen)
for nv in G[v]:
... | N,M = list(map(int,input().split()))
def find(x):
if par[x] < 0:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x,y):
x = find(x)
y = find(y)
if x == y:
return False
else:
if par[x] > par[y]:
x,y = y,x
... | 31 | 47 | 651 | 818 | import copy
N, M = list(map(int, input().split()))
graph = [[] for _ in range(N)]
edges = []
for _ in range(M):
a, b = list(map(int, input().split()))
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
edges.append([a - 1, b - 1])
def dfs(G, v):
seen[v] = True
# print(seen)
for nv in G... | N, M = list(map(int, input().split()))
def find(x):
if par[x] < 0:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x, y):
x = find(x)
y = find(y)
if x == y:
return False
else:
if par[x] > par[y]:
x, y = y, x
par[x] += p... | false | 34.042553 | [
"-import copy",
"-",
"-graph = [[] for _ in range(N)]",
"-edges = []",
"-for _ in range(M):",
"- a, b = list(map(int, input().split()))",
"- graph[a - 1].append(b - 1)",
"- graph[b - 1].append(a - 1)",
"- edges.append([a - 1, b - 1])",
"-def dfs(G, v):",
"- seen[v] = True",
"- ... | false | 0.084102 | 0.038861 | 2.164195 | [
"s039386262",
"s117215592"
] |
u734252743 | p02659 | python | s474370644 | s087465245 | 24 | 22 | 8,984 | 9,116 | Accepted | Accepted | 8.33 | a, b = list(map(float, input().split()))
print((int(a)*int(b*1000)//1000))
| a, b = list(map(float, input().split()))
a = int(a)
b = int(float(b)*1000)
r = int((a*b)//1000)
print(r)
| 2 | 5 | 68 | 103 | a, b = list(map(float, input().split()))
print((int(a) * int(b * 1000) // 1000))
| a, b = list(map(float, input().split()))
a = int(a)
b = int(float(b) * 1000)
r = int((a * b) // 1000)
print(r)
| false | 60 | [
"-print((int(a) * int(b * 1000) // 1000))",
"+a = int(a)",
"+b = int(float(b) * 1000)",
"+r = int((a * b) // 1000)",
"+print(r)"
] | false | 0.116604 | 0.041006 | 2.843557 | [
"s474370644",
"s087465245"
] |
u115682115 | p03854 | python | s976653749 | s630264024 | 66 | 18 | 3,316 | 3,188 | Accepted | Accepted | 72.73 | S = eval(input())
SR = S[::-1]
temp =['dream','dreamer','erase','eraser']
T=""
j=0
count=0
while j<=10**5//5:
j +=1
for i in temp:
if i[::-1] == SR[count:len(i)+count]:
count+=len(i)
T+=i[::-1]
if SR==T:
print('YES')
exit(... | a = ["eraser", "erase", "dreamer", "dream"]
s = eval(input())
for i in range(4):
s = s.replace(a[i], "")
print((['NO','YES'][s==""]))
| 16 | 5 | 328 | 134 | S = eval(input())
SR = S[::-1]
temp = ["dream", "dreamer", "erase", "eraser"]
T = ""
j = 0
count = 0
while j <= 10**5 // 5:
j += 1
for i in temp:
if i[::-1] == SR[count : len(i) + count]:
count += len(i)
T += i[::-1]
if SR == T:
print("YES")
... | a = ["eraser", "erase", "dreamer", "dream"]
s = eval(input())
for i in range(4):
s = s.replace(a[i], "")
print((["NO", "YES"][s == ""]))
| false | 68.75 | [
"-S = eval(input())",
"-SR = S[::-1]",
"-temp = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]",
"-T = \"\"",
"-j = 0",
"-count = 0",
"-while j <= 10**5 // 5:",
"- j += 1",
"- for i in temp:",
"- if i[::-1] == SR[count : len(i) + count]:",
"- count += len(i)",
"- ... | false | 0.052968 | 0.041624 | 1.272533 | [
"s976653749",
"s630264024"
] |
u761320129 | p03937 | python | s314075806 | s111404399 | 22 | 18 | 3,316 | 3,064 | Accepted | Accepted | 18.18 | from collections import Counter
H,W = list(map(int,input().split()))
src = [eval(input()) for i in range(H)]
ctr = Counter()
for row in src:
ctr.update(row)
print(('Possible' if ctr['#'] == H+W-1 else 'Impossible')) | H,W = list(map(int,input().split()))
src = [eval(input()) for i in range(H)]
x = y = p = 0
while x < W-1 or y < H-1:
if x < W-1 and src[y][x+1] == '#':
p += 1
x += 1
elif y < H-1 and src[y+1][x] == '#':
p += 1
y += 1
else:
print('Impossible')
exi... | 7 | 19 | 211 | 409 | from collections import Counter
H, W = list(map(int, input().split()))
src = [eval(input()) for i in range(H)]
ctr = Counter()
for row in src:
ctr.update(row)
print(("Possible" if ctr["#"] == H + W - 1 else "Impossible"))
| H, W = list(map(int, input().split()))
src = [eval(input()) for i in range(H)]
x = y = p = 0
while x < W - 1 or y < H - 1:
if x < W - 1 and src[y][x + 1] == "#":
p += 1
x += 1
elif y < H - 1 and src[y + 1][x] == "#":
p += 1
y += 1
else:
print("Impossible")
exi... | false | 63.157895 | [
"-from collections import Counter",
"-",
"-ctr = Counter()",
"+x = y = p = 0",
"+while x < W - 1 or y < H - 1:",
"+ if x < W - 1 and src[y][x + 1] == \"#\":",
"+ p += 1",
"+ x += 1",
"+ elif y < H - 1 and src[y + 1][x] == \"#\":",
"+ p += 1",
"+ y += 1",
"+ ... | false | 0.048564 | 0.049121 | 0.988657 | [
"s314075806",
"s111404399"
] |
u992910889 | p03087 | python | s642269115 | s802647182 | 414 | 358 | 16,628 | 58,376 | Accepted | Accepted | 13.53 | # import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# import sys
# sys.setrecursionlimit... | from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np # Pythonのみ!
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components # Pythonのみ!
# ↑cf. https://note.nkmk.me/python-scipy-connec... | 36 | 40 | 831 | 986 | # import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
from itertools import (
accumulate,
permutations,
combinations,
combinations_with_replacement,
groupby,
product,
)
# import math
# import numpy as np
# import sys
# ... | from itertools import (
accumulate,
permutations,
combinations,
combinations_with_replacement,
groupby,
product,
)
# import math
# import numpy as np # Pythonのみ!
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components # Pythonのみ!
# ↑cf. https://note.nkm... | false | 10 | [
"-# import bisect",
"-# from collections import Counter, deque",
"-# import copy",
"-# from fractions import gcd",
"-# from functools import reduce",
"-# import numpy as np",
"-# import sys",
"-# sys.setrecursionlimit(10**9)",
"+# import numpy as np # Pythonのみ!",
"+# from operator import xor",
... | false | 0.040721 | 0.064998 | 0.626497 | [
"s642269115",
"s802647182"
] |
u462329577 | p03387 | python | s428334515 | s951535201 | 190 | 17 | 38,384 | 3,060 | Accepted | Accepted | 91.05 | #!/usr/bin/env python3
#最終上体がわかれば回数fin*3 - (a+b+c) //2
a =list(map(int,input().split()))
a.sort()
# maxがfinにならないのは、a[0]-1[1]が奇数の時
if (a[1] -a[0])%2 == 0:
print(((a[-1]*3-sum(a))//2))
else:
print(((a[-1]*3+3-sum(a))//2))
"""
x = a[-1]-a[1]
y = a[1] -a[0]
def dist(n):
if n % 2 == 0: return n//2
... | a, b, c = list(map(int, input().split()))
s = [a, b, c]
s.sort()
if (s[2] * 2 - s[0] - s[1]) % 2 == 0:
print(((3 * s[2] - sum(s)) // 2))
else:
print(((3 * s[2] + 3 - sum(s)) // 2))
| 16 | 8 | 389 | 187 | #!/usr/bin/env python3
# 最終上体がわかれば回数fin*3 - (a+b+c) //2
a = list(map(int, input().split()))
a.sort()
# maxがfinにならないのは、a[0]-1[1]が奇数の時
if (a[1] - a[0]) % 2 == 0:
print(((a[-1] * 3 - sum(a)) // 2))
else:
print(((a[-1] * 3 + 3 - sum(a)) // 2))
"""
x = a[-1]-a[1]
y = a[1] -a[0]
def dist(n):
if n % 2 == 0: return... | a, b, c = list(map(int, input().split()))
s = [a, b, c]
s.sort()
if (s[2] * 2 - s[0] - s[1]) % 2 == 0:
print(((3 * s[2] - sum(s)) // 2))
else:
print(((3 * s[2] + 3 - sum(s)) // 2))
| false | 50 | [
"-#!/usr/bin/env python3",
"-# 最終上体がわかれば回数fin*3 - (a+b+c) //2",
"-a = list(map(int, input().split()))",
"-a.sort()",
"-# maxがfinにならないのは、a[0]-1[1]が奇数の時",
"-if (a[1] - a[0]) % 2 == 0:",
"- print(((a[-1] * 3 - sum(a)) // 2))",
"+a, b, c = list(map(int, input().split()))",
"+s = [a, b, c]",
"+s.sor... | false | 0.082148 | 0.063402 | 1.295675 | [
"s428334515",
"s951535201"
] |
u013513417 | p03835 | python | s094929549 | s612896827 | 1,843 | 1,400 | 2,940 | 9,172 | Accepted | Accepted | 24.04 | K,S=list(map(int,input().split()))
count=0
for x in range(K+1):
for y in range(K+1):
z=S-x-y
if z>=0 and z<=K:
count+=1
print(count) | K,S=list(map(int,input().split()))
count=0
for i in range(K+1):
for j in range(K+1):
if S-(i+j)<=K and S-(i+j)>=0:
count+=1
print(count) | 8 | 10 | 165 | 174 | K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if z >= 0 and z <= K:
count += 1
print(count)
| K, S = list(map(int, input().split()))
count = 0
for i in range(K + 1):
for j in range(K + 1):
if S - (i + j) <= K and S - (i + j) >= 0:
count += 1
print(count)
| false | 20 | [
"-for x in range(K + 1):",
"- for y in range(K + 1):",
"- z = S - x - y",
"- if z >= 0 and z <= K:",
"+for i in range(K + 1):",
"+ for j in range(K + 1):",
"+ if S - (i + j) <= K and S - (i + j) >= 0:"
] | false | 0.085359 | 0.038213 | 2.233755 | [
"s094929549",
"s612896827"
] |
u863442865 | p03805 | python | s903042232 | s106996808 | 45 | 28 | 3,316 | 3,316 | Accepted | Accepted | 37.78 | def main():
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations
#from itertools import accumulate, product, permutations
from math import floor, ceil
... | '''
頂点1から全頂点通る一筆書きが何個あるか
頂点数(N)は最大で8なので道順を全列挙して調べてもいける
'''
def main():
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations
#from itertools import accum... | 40 | 73 | 1,048 | 1,798 | def main():
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations
# from itertools import accumulate, product, permutations
from math import floor, ceil
... | """
頂点1から全頂点通る一筆書きが何個あるか
頂点数(N)は最大で8なので道順を全列挙して調べてもいける
"""
def main():
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations
# from itertools import accumula... | false | 45.205479 | [
"+\"\"\"",
"+頂点1から全頂点通る一筆書きが何個あるか",
"+頂点数(N)は最大で8なので道順を全列挙して調べてもいける",
"+\"\"\"",
"+",
"+",
"- n, m = list(map(int, input().split()))",
"- edge = [list(map(int, input().split())) for _ in range(m)]",
"+ N, M = list(map(int, input().split()))",
"+ g = [[] for _ in range(N)]",
"+ for... | false | 0.099667 | 0.04057 | 2.456687 | [
"s903042232",
"s106996808"
] |
u925364229 | p03240 | python | s371983766 | s071155962 | 248 | 210 | 43,248 | 43,248 | Accepted | Accepted | 15.32 | N = int(eval(input()))
x,y,h = [0]*N,[0]*N,[0]*N
j = -1
for i in range(N):
x[i],y[i],h[i] = list(map(int,input().split(" ")))
if h[i] != 0:
j = i
H = 1
if j == (-1):
for cx in range(0,101):
for cy in range(0,101):
for i in range(N):
H = m... | N = int(eval(input()))
x,y,h = [0]*N,[0]*N,[0]*N
j = -1
for i in range(N):
x[i],y[i],h[i] = list(map(int,input().split(" ")))
if h[i] != 0:
j = i
for cx in range(0,101):
for cy in range(0,101):
H = h[j] + abs(x[j]-cx) + abs(y[j]-cy)
flg = True
for i in range(N... | 34 | 23 | 936 | 647 | N = int(eval(input()))
x, y, h = [0] * N, [0] * N, [0] * N
j = -1
for i in range(N):
x[i], y[i], h[i] = list(map(int, input().split(" ")))
if h[i] != 0:
j = i
H = 1
if j == (-1):
for cx in range(0, 101):
for cy in range(0, 101):
for i in range(N):
H = min(H, (abs(... | N = int(eval(input()))
x, y, h = [0] * N, [0] * N, [0] * N
j = -1
for i in range(N):
x[i], y[i], h[i] = list(map(int, input().split(" ")))
if h[i] != 0:
j = i
for cx in range(0, 101):
for cy in range(0, 101):
H = h[j] + abs(x[j] - cx) + abs(y[j] - cy)
flg = True
for i in rang... | false | 32.352941 | [
"-H = 1",
"-if j == (-1):",
"- for cx in range(0, 101):",
"- for cy in range(0, 101):",
"- for i in range(N):",
"- H = min(H, (abs(x[i] - cx) + abs(y[i] - cy)))",
"- if H > 0:",
"- print((\"{0} {1} {2}\".format(cx, cy, H)))",
"- ... | false | 0.049999 | 0.048844 | 1.023637 | [
"s371983766",
"s071155962"
] |
u057415180 | p03031 | python | s568213004 | s938830176 | 33 | 27 | 3,064 | 3,064 | Accepted | Accepted | 18.18 | def main():
n, m = list(map(int, input().split()))
g = [[-1]*n for _ in range(m)]
for i in range(m):
s = list(map(int, input().split()))
for j in s[1:]:
g[i][j-1] = 1
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
s = [0]*n
for j in range(n):
if (... | def main():
n, m = list(map(int,input().split()))
light = [[0]*n for _ in range(m)]
for i in range(m):
kk = list(map(int, input().split()))
k = kk.pop(0)
for j in range(k):
light[i][kk[j]-1] = 1
p = list(map(int, input().split()))
ans = 0
for i in range(2**n): # switchのbit
... | 31 | 33 | 621 | 697 | def main():
n, m = list(map(int, input().split()))
g = [[-1] * n for _ in range(m)]
for i in range(m):
s = list(map(int, input().split()))
for j in s[1:]:
g[i][j - 1] = 1
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
s = [0] * n
for... | def main():
n, m = list(map(int, input().split()))
light = [[0] * n for _ in range(m)]
for i in range(m):
kk = list(map(int, input().split()))
k = kk.pop(0)
for j in range(k):
light[i][kk[j] - 1] = 1
p = list(map(int, input().split()))
ans = 0
for i in range(2... | false | 6.060606 | [
"- g = [[-1] * n for _ in range(m)]",
"+ light = [[0] * n for _ in range(m)]",
"- s = list(map(int, input().split()))",
"- for j in s[1:]:",
"- g[i][j - 1] = 1",
"+ kk = list(map(int, input().split()))",
"+ k = kk.pop(0)",
"+ for j in range(k):",
"... | false | 0.050041 | 0.114474 | 0.437142 | [
"s568213004",
"s938830176"
] |
u093607836 | p00424 | python | s639358040 | s937675850 | 100 | 90 | 9,628 | 10,336 | Accepted | Accepted | 10 | import string
n = int(input())
while n != 0:
f = []
t = []
for i in range(n):
l = input().split()
f.append(l[0])
t.append(l[1])
d = string.maketrans(''.join(f), ''.join(t))
s = []
for i in range(int(input())):
s.append(input().strip())
print(''.join(s).translate(d))
n = int(input()) | import string
n = int(input())
while n != 0:
l = [input().split() for i in range(n)]
f = [i for i,j in l]
t = [j for i,j in l]
d = string.maketrans(''.join(f), ''.join(t))
s = [input().strip() for i in range(int(input()))]
print(''.join(s).translate(d))
n = int(input()) | 16 | 11 | 336 | 310 | import string
n = int(input())
while n != 0:
f = []
t = []
for i in range(n):
l = input().split()
f.append(l[0])
t.append(l[1])
d = string.maketrans("".join(f), "".join(t))
s = []
for i in range(int(input())):
s.append(input().strip())
print("".join(s).transl... | import string
n = int(input())
while n != 0:
l = [input().split() for i in range(n)]
f = [i for i, j in l]
t = [j for i, j in l]
d = string.maketrans("".join(f), "".join(t))
s = [input().strip() for i in range(int(input()))]
print("".join(s).translate(d))
n = int(input())
| false | 31.25 | [
"- f = []",
"- t = []",
"- for i in range(n):",
"- l = input().split()",
"- f.append(l[0])",
"- t.append(l[1])",
"+ l = [input().split() for i in range(n)]",
"+ f = [i for i, j in l]",
"+ t = [j for i, j in l]",
"- s = []",
"- for i in range(int(input... | false | 0.043268 | 0.042386 | 1.020812 | [
"s639358040",
"s937675850"
] |
u716530146 | p02708 | python | s002907336 | s433280301 | 349 | 71 | 216,544 | 67,784 | Accepted | Accepted | 79.66 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,k = list(map(int,input().split()))
class InverseTable:
__slots__ = ['In', 'fac', 'Ifac']
... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,k = list(map(int,input().split()))
for i in range(k,n+2):
ans += (n+n-i+1)*i//2 - i*(i-1)//2... | 37 | 11 | 1,195 | 346 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, k = list(map(int, input().split()))
class InverseTable:
__slots__ = ["In", "fac", "Ifac"]
de... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, k = list(map(int, input().split()))
for i in range(k, n + 2):
ans += (n + n - i + 1) * i // 2 - i *... | false | 70.27027 | [
"-",
"-",
"-class InverseTable:",
"- __slots__ = [\"In\", \"fac\", \"Ifac\"]",
"-",
"- def __init__(self, mod, maxnum):",
"- self.In = [0, 1]",
"- self.fac = [1, 1]",
"- self.Ifac = [1, 1]",
"- for i in range(2, maxnum + 1):",
"- self.In.append((-self... | false | 2.183493 | 0.049578 | 44.041576 | [
"s002907336",
"s433280301"
] |
u252828980 | p02848 | python | s432269092 | s666051993 | 24 | 22 | 3,064 | 3,060 | Accepted | Accepted | 8.33 | n = int(eval(input()))
s = eval(input())
#a,b = map(int,input().split())
#li = list(map(int,input().split()))
W = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X"... | n = int(eval(input()))
s = eval(input())
ss = ""
for i in range(len(s)):
a = ord(s[i])+n
#print(a)
if a >=91:
a = a-26
ss += chr(a)
else:
ss += chr(a)
print(ss) | 10 | 13 | 395 | 201 | n = int(eval(input()))
s = eval(input())
# a,b = map(int,input().split())
# li = list(map(int,input().split()))
W = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
... | n = int(eval(input()))
s = eval(input())
ss = ""
for i in range(len(s)):
a = ord(s[i]) + n
# print(a)
if a >= 91:
a = a - 26
ss += chr(a)
else:
ss += chr(a)
print(ss)
| false | 23.076923 | [
"-# a,b = map(int,input().split())",
"-# li = list(map(int,input().split()))",
"-W = [",
"- \"A\",",
"- \"B\",",
"- \"C\",",
"- \"D\",",
"- \"E\",",
"- \"F\",",
"- \"G\",",
"- \"H\",",
"- \"I\",",
"- \"J\",",
"- \"K\",",
"- \"L\",",
"- \"M\",",
... | false | 0.108115 | 0.046537 | 2.323192 | [
"s432269092",
"s666051993"
] |
u347640436 | p02608 | python | s479462710 | s567437452 | 467 | 150 | 9,536 | 9,484 | Accepted | Accepted | 67.88 | N = int(input())
t = [0] * (10 ** 4 + 1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
n = x * x + y * y + z * z + x * y + y * z + z * x
if n <= 10 ** 4:
t[n] += 1
print(*[t[i] for i in range(1, N + 1)], sep='\n')
| N = int(input())
t = [0] * (N + 1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
n = x * x + y * y + z * z + x * y + y * z + z * x
if n > N:
break
t[n] += 1
print(*t[1:], sep='\n')
| 11 | 12 | 304 | 284 | N = int(input())
t = [0] * (10**4 + 1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
n = x * x + y * y + z * z + x * y + y * z + z * x
if n <= 10**4:
t[n] += 1
print(*[t[i] for i in range(1, N + 1)], sep="\n")
| N = int(input())
t = [0] * (N + 1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
n = x * x + y * y + z * z + x * y + y * z + z * x
if n > N:
break
t[n] += 1
print(*t[1:], sep="\n")
| false | 8.333333 | [
"-t = [0] * (10**4 + 1)",
"+t = [0] * (N + 1)",
"- if n <= 10**4:",
"- t[n] += 1",
"-print(*[t[i] for i in range(1, N + 1)], sep=\"\\n\")",
"+ if n > N:",
"+ break",
"+ t[n] += 1",
"+print(*t[1:], sep=\"\\n\")"
] | false | 1.615412 | 0.044563 | 36.249738 | [
"s479462710",
"s567437452"
] |
u634079249 | p02547 | python | s090375493 | s032936950 | 41 | 30 | 9,896 | 9,760 | Accepted | Accepted | 26.83 | import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip(... | import sys
import os
import math
import bisect
import itertools
import collections
import heapq
import queue
import array
# 時々使う
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
# 再帰の制限設定
sys.setrecursionli... | 42 | 58 | 1,229 | 1,392 | import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = la... | import sys
import os
import math
import bisect
import itertools
import collections
import heapq
import queue
import array
# 時々使う
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
# 再帰の制限設定
sys.setrecursionlimit(10000000)
d... | false | 27.586207 | [
"-import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array",
"+import sys",
"+import os",
"+import math",
"+import bisect",
"+import itertools",
"+import collections",
"+import heapq",
"+import queue",
"+import array",
"+# 時々使う",
"+# 再帰の制限設定",
"-ii = lambda: int(sys.st... | false | 0.03795 | 0.042976 | 0.883053 | [
"s090375493",
"s032936950"
] |
u130900604 | p02658 | python | s858011607 | s936711875 | 104 | 93 | 86,020 | 21,600 | Accepted | Accepted | 10.58 | n,*a=list(map(int,open(0).read().split()))
MX=10**18
prod=1
for q in sorted(a):
prod*=q
if prod>MX:
print((-1))
exit()
print(prod)
| n,*a=map(int,open(0).read().split())
a.sort()
if a[0]==0:
exit(print(0))
ans=1
for q in a:
ans*=q
if ans>10**18:
print(-1)
exit()
print(ans)
| 9 | 11 | 143 | 164 | n, *a = list(map(int, open(0).read().split()))
MX = 10**18
prod = 1
for q in sorted(a):
prod *= q
if prod > MX:
print((-1))
exit()
print(prod)
| n, *a = map(int, open(0).read().split())
a.sort()
if a[0] == 0:
exit(print(0))
ans = 1
for q in a:
ans *= q
if ans > 10**18:
print(-1)
exit()
print(ans)
| false | 18.181818 | [
"-n, *a = list(map(int, open(0).read().split()))",
"-MX = 10**18",
"-prod = 1",
"-for q in sorted(a):",
"- prod *= q",
"- if prod > MX:",
"- print((-1))",
"+n, *a = map(int, open(0).read().split())",
"+a.sort()",
"+if a[0] == 0:",
"+ exit(print(0))",
"+ans = 1",
"+for q in a:... | false | 0.048162 | 0.048784 | 0.987264 | [
"s858011607",
"s936711875"
] |
u171366497 | p03730 | python | s519115564 | s431502740 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | a,b,c=list(map(int,input().split()))
x=1
data=set()
now=0
while x==1:
now+=a
now%=b
if now==c:
print('YES')
break
if now in data:
print('NO')
break
data|={now,} | a,b,c=list(map(int,input().split()))
res='NO'
for i in range(1,b+1):
if (a*i)%b==c:
res='YES'
break
print(res) | 14 | 7 | 219 | 130 | a, b, c = list(map(int, input().split()))
x = 1
data = set()
now = 0
while x == 1:
now += a
now %= b
if now == c:
print("YES")
break
if now in data:
print("NO")
break
data |= {
now,
}
| a, b, c = list(map(int, input().split()))
res = "NO"
for i in range(1, b + 1):
if (a * i) % b == c:
res = "YES"
break
print(res)
| false | 50 | [
"-x = 1",
"-data = set()",
"-now = 0",
"-while x == 1:",
"- now += a",
"- now %= b",
"- if now == c:",
"- print(\"YES\")",
"+res = \"NO\"",
"+for i in range(1, b + 1):",
"+ if (a * i) % b == c:",
"+ res = \"YES\"",
"- if now in data:",
"- print(\"NO\")",... | false | 0.153077 | 0.100467 | 1.523652 | [
"s519115564",
"s431502740"
] |
u497046426 | p02984 | python | s640791679 | s672325627 | 308 | 122 | 68,452 | 14,092 | Accepted | Accepted | 60.39 | N = int(eval(input()))
*A, = list(map(int, input().split()))
X = [0]*N
X_total = sum(A)
A_odd = sum([A[i % N] for i in range(1, N, 2)])
A_even = sum([A[i % N] for i in range(2, N+1, 2)])
for i in range(N):
X[i] = X_total - 2*(A_odd if i % 2 == 0 else A_even)
if i % 2 == 0: A_odd += A[i] - A[(i+1) % N]
... | N = int(eval(input()))
*A, = list(map(int, input().split()))
X = [0]*N
total = sum(A)
X[0] = total - 2*sum([a for a in A[1::2]])
for i in range(1, N):
X[i] = 2*A[i-1] - X[i-1]
print((*X)) | 11 | 8 | 358 | 184 | N = int(eval(input()))
(*A,) = list(map(int, input().split()))
X = [0] * N
X_total = sum(A)
A_odd = sum([A[i % N] for i in range(1, N, 2)])
A_even = sum([A[i % N] for i in range(2, N + 1, 2)])
for i in range(N):
X[i] = X_total - 2 * (A_odd if i % 2 == 0 else A_even)
if i % 2 == 0:
A_odd += A[i] - A[(i +... | N = int(eval(input()))
(*A,) = list(map(int, input().split()))
X = [0] * N
total = sum(A)
X[0] = total - 2 * sum([a for a in A[1::2]])
for i in range(1, N):
X[i] = 2 * A[i - 1] - X[i - 1]
print((*X))
| false | 27.272727 | [
"-X_total = sum(A)",
"-A_odd = sum([A[i % N] for i in range(1, N, 2)])",
"-A_even = sum([A[i % N] for i in range(2, N + 1, 2)])",
"-for i in range(N):",
"- X[i] = X_total - 2 * (A_odd if i % 2 == 0 else A_even)",
"- if i % 2 == 0:",
"- A_odd += A[i] - A[(i + 1) % N]",
"- else:",
"- ... | false | 0.035497 | 0.034744 | 1.021662 | [
"s640791679",
"s672325627"
] |
u349449706 | p02975 | python | s887226791 | s125636490 | 92 | 84 | 92,912 | 93,124 | Accepted | Accepted | 8.7 | N = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
if i not in d:
d[i] = 1
else:
d[i] +=1
if len(d) == 1 and list(d.keys())==[0]:
print('Yes')
elif len(d) == 2:
for i in d:
if i == 0 and d[i] * 3 != N or i != 0 and d[i] * 3 != 2 * N:
... | N = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
if i not in d:
d[i] = 1
else:
d[i] +=1
if len(d) == 1 and 0 in d:
print('Yes')
elif len(d) == 2:
for i in d:
if i == 0 and d[i] * 3 != N or i != 0 and d[i] * 3 != 2 * N:
print('... | 29 | 29 | 599 | 586 | N = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
if i not in d:
d[i] = 1
else:
d[i] += 1
if len(d) == 1 and list(d.keys()) == [0]:
print("Yes")
elif len(d) == 2:
for i in d:
if i == 0 and d[i] * 3 != N or i != 0 and d[i] * 3 != 2 * N:
prin... | N = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
if i not in d:
d[i] = 1
else:
d[i] += 1
if len(d) == 1 and 0 in d:
print("Yes")
elif len(d) == 2:
for i in d:
if i == 0 and d[i] * 3 != N or i != 0 and d[i] * 3 != 2 * N:
print("No")
... | false | 0 | [
"-if len(d) == 1 and list(d.keys()) == [0]:",
"+if len(d) == 1 and 0 in d:"
] | false | 0.041049 | 0.042144 | 0.974013 | [
"s887226791",
"s125636490"
] |
u612721349 | p03469 | python | s665117367 | s274974241 | 170 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90 | print(("/".join(["2018"] + input().split("/")[1:]))) | print((input().replace("017","018"))) | 1 | 1 | 50 | 35 | print(("/".join(["2018"] + input().split("/")[1:])))
| print((input().replace("017", "018")))
| false | 0 | [
"-print((\"/\".join([\"2018\"] + input().split(\"/\")[1:])))",
"+print((input().replace(\"017\", \"018\")))"
] | false | 0.031704 | 0.034936 | 0.907494 | [
"s665117367",
"s274974241"
] |
u498487134 | p02883 | python | s808378053 | s927667256 | 1,322 | 353 | 119,756 | 102,652 | Accepted | Accepted | 73.3 | import math
#成績xを取れるか?xに関して二分探索
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
F = list(map(int,input().split()))
#Aを小さい順,Fを大きい順に並べれば対応する.
A.sort()
F.sort(reverse =True)
AF=[0]*N
for i in range(N):
AF[i]=A[i]*F[i]
ng=-1
ok=10**12+1
#二分探索,成績xをとるのにi番目の人が何回修行すべきか,こ... | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
"""
コストが低い人が食べにくいものを食べる.
コストが低い人を追い抜かすことはない,(追い抜かすなら入れ替えて良いから)
"""
def main():
mod=10**9+7
N,K=MI()
A=LI()
F=L... | 33 | 50 | 574 | 878 | import math
# 成績xを取れるか?xに関して二分探索
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
# Aを小さい順,Fを大きい順に並べれば対応する.
A.sort()
F.sort(reverse=True)
AF = [0] * N
for i in range(N):
AF[i] = A[i] * F[i]
ng = -1
ok = 10**12 + 1
# 二分探索,成績xをとるのにi番目の人が何回修行すべきか,これがK以下なら良... | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
"""
コストが低い人が食べにくいものを食べる.
コストが低い人を追い抜かすことはない,(追い抜かすなら入れ替えて良いから)
"""
def main():
mod = 10**9 + 7
N, K = MI()
A = LI(... | false | 34 | [
"-import math",
"+import sys",
"-# 成績xを取れるか?xに関して二分探索",
"-N, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-F = list(map(int, input().split()))",
"-# Aを小さい順,Fを大きい順に並べれば対応する.",
"-A.sort()",
"-F.sort(reverse=True)",
"-AF = [0] * N",
"-for i in range(N):",
"- A... | false | 0.041732 | 0.057091 | 0.730975 | [
"s808378053",
"s927667256"
] |
u847467233 | p02431 | python | s392347182 | s704527419 | 1,420 | 1,150 | 13,808 | 20,252 | Accepted | Accepted | 19.01 | # AOJ ITP2_1_A: Vector
# Python3 2018.6.24 bal4u
from collections import deque
Q = deque()
q = int(eval(input()))
for i in range(q):
a = eval(input())
if a[0] == '2': Q.pop() # popBack
else:
id, v = list(map(int, a.split()))
if id == 0: Q.append(v) # pushBack
else: print((Q[v])) # ran... | # AOJ ITP2_1_A: Vector
# Python3 2018.6.24 bal4u
from collections import deque
Q = deque()
q = int(eval(input()))
for i in range(q):
a = eval(input())
if a[0] == '0': Q.append(a[2:]) # pushBack
elif a[0] == '1': print((Q[int(a[2:])])) # randomAccess
else: Q.pop() # popBack... | 13 | 11 | 310 | 307 | # AOJ ITP2_1_A: Vector
# Python3 2018.6.24 bal4u
from collections import deque
Q = deque()
q = int(eval(input()))
for i in range(q):
a = eval(input())
if a[0] == "2":
Q.pop() # popBack
else:
id, v = list(map(int, a.split()))
if id == 0:
Q.append(v) # pushBack
e... | # AOJ ITP2_1_A: Vector
# Python3 2018.6.24 bal4u
from collections import deque
Q = deque()
q = int(eval(input()))
for i in range(q):
a = eval(input())
if a[0] == "0":
Q.append(a[2:]) # pushBack
elif a[0] == "1":
print((Q[int(a[2:])])) # randomAccess
else:
Q.pop() # popBack
| false | 15.384615 | [
"- if a[0] == \"2\":",
"+ if a[0] == \"0\":",
"+ Q.append(a[2:]) # pushBack",
"+ elif a[0] == \"1\":",
"+ print((Q[int(a[2:])])) # randomAccess",
"+ else:",
"- else:",
"- id, v = list(map(int, a.split()))",
"- if id == 0:",
"- Q.append(v) # ... | false | 0.049195 | 0.047842 | 1.028272 | [
"s392347182",
"s704527419"
] |
u888092736 | p04020 | python | s869446271 | s190172013 | 88 | 79 | 20,112 | 20,148 | Accepted | Accepted | 10.23 | N, *A = list(map(int, open(0).read().split()))
ans = 0
for i in range(N):
q, r = divmod(A[i], 2)
ans += q
if r == 0 or i == N - 1:
continue
elif A[i + 1] != 0:
A[i + 1] += 1
print(ans)
| N, *A = list(map(int, open(0).read().split()))
r = 0
ans = 0
for a in A:
if a == 0:
r = 0
continue
q, r = divmod(a + r, 2)
ans += q
print(ans)
| 10 | 11 | 220 | 176 | N, *A = list(map(int, open(0).read().split()))
ans = 0
for i in range(N):
q, r = divmod(A[i], 2)
ans += q
if r == 0 or i == N - 1:
continue
elif A[i + 1] != 0:
A[i + 1] += 1
print(ans)
| N, *A = list(map(int, open(0).read().split()))
r = 0
ans = 0
for a in A:
if a == 0:
r = 0
continue
q, r = divmod(a + r, 2)
ans += q
print(ans)
| false | 9.090909 | [
"+r = 0",
"-for i in range(N):",
"- q, r = divmod(A[i], 2)",
"+for a in A:",
"+ if a == 0:",
"+ r = 0",
"+ continue",
"+ q, r = divmod(a + r, 2)",
"- if r == 0 or i == N - 1:",
"- continue",
"- elif A[i + 1] != 0:",
"- A[i + 1] += 1"
] | false | 0.041369 | 0.033832 | 1.222783 | [
"s869446271",
"s190172013"
] |
u501952592 | p02678 | python | s888159965 | s640132444 | 1,983 | 669 | 225,320 | 60,024 | Accepted | Accepted | 66.26 | import networkx as nx
N, M = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(M)]
G = nx.Graph()
G.add_nodes_from(list(range(1, N+1)))
G.add_edges_from(l)
pre = nx.predecessor(G, 1)
print('Yes')
for i in range(2, N+1):
print((pre[i][0])) | from collections import deque
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
g = [[] for _ in range(N+1)]
for a, b in AB:
g[a].append(b)
g[b].append(a)
d = deque([1])
l = [0]*(N+1)
while d:
r = d.popleft()
for s in g[r]:
if l[s] == 0:
d.app... | 12 | 20 | 274 | 376 | import networkx as nx
N, M = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(M)]
G = nx.Graph()
G.add_nodes_from(list(range(1, N + 1)))
G.add_edges_from(l)
pre = nx.predecessor(G, 1)
print("Yes")
for i in range(2, N + 1):
print((pre[i][0]))
| from collections import deque
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
g = [[] for _ in range(N + 1)]
for a, b in AB:
g[a].append(b)
g[b].append(a)
d = deque([1])
l = [0] * (N + 1)
while d:
r = d.popleft()
for s in g[r]:
if l[s] == 0:
... | false | 40 | [
"-import networkx as nx",
"+from collections import deque",
"-N, M = list(map(int, input().split()))",
"-l = [list(map(int, input().split())) for _ in range(M)]",
"-G = nx.Graph()",
"-G.add_nodes_from(list(range(1, N + 1)))",
"-G.add_edges_from(l)",
"-pre = nx.predecessor(G, 1)",
"-print(\"Yes\")",
... | false | 0.042946 | 0.077625 | 0.553251 | [
"s888159965",
"s640132444"
] |
u892487306 | p02819 | python | s469662332 | s447329450 | 234 | 17 | 3,388 | 3,064 | Accepted | Accepted | 92.74 | def get_primes(x):
if x < 2:
return list()
primes = [2]
n = 3
while n <= x:
is_prime = True
for p in primes:
if n % p == 0:
is_prime = False
break
if p**2 > n:
break
if is_prime:
... | def is_prime(x):
if x <= 1:
return False
elif x == 2:
return True
else:
n = 2
while n**2 <= x:
if x % n == 0:
return False
n += 1
return True
def main():
X = int(eval(input()))
while True:
if i... | 39 | 25 | 773 | 426 | def get_primes(x):
if x < 2:
return list()
primes = [2]
n = 3
while n <= x:
is_prime = True
for p in primes:
if n % p == 0:
is_prime = False
break
if p**2 > n:
break
if is_prime:
primes.ap... | def is_prime(x):
if x <= 1:
return False
elif x == 2:
return True
else:
n = 2
while n**2 <= x:
if x % n == 0:
return False
n += 1
return True
def main():
X = int(eval(input()))
while True:
if is_prime(X):
... | false | 35.897436 | [
"-def get_primes(x):",
"- if x < 2:",
"- return list()",
"- primes = [2]",
"- n = 3",
"- while n <= x:",
"- is_prime = True",
"- for p in primes:",
"- if n % p == 0:",
"- is_prime = False",
"- break",
"- if p*... | false | 0.155941 | 0.035801 | 4.355776 | [
"s469662332",
"s447329450"
] |
u961683878 | p02819 | python | s899079912 | s632098330 | 153 | 17 | 43,488 | 3,060 | Accepted | Accepted | 88.89 | import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
n = int(read())
n_ = 5*10**5
primes = set(range(2, n_+1))
for i in range(2, int(n_**0.5+1)):
primes.difference_update(list(range(i*2, n_+1, i)... | import sys
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
n = int(read())
def is_prime(n):
if n == 1: return False
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
ret... | 20 | 23 | 403 | 435 | import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
n = int(read())
n_ = 5 * 10**5
primes = set(range(2, n_ + 1))
for i in range(2, int(n_**0.5 + 1)):
primes.difference_update(list(range(i * 2, n_ + 1, i)))
... | import sys
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
n = int(read())
def is_prime(n):
if n == 1:
return False
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return Fa... | false | 13.043478 | [
"-import bisect",
"+import math",
"-n_ = 5 * 10**5",
"-primes = set(range(2, n_ + 1))",
"-for i in range(2, int(n_**0.5 + 1)):",
"- primes.difference_update(list(range(i * 2, n_ + 1, i)))",
"-primes = list(primes)",
"-idx = bisect.bisect_left(primes, n)",
"-print((primes[idx]))",
"+",
"+",
... | false | 1.879331 | 0.143125 | 13.130686 | [
"s899079912",
"s632098330"
] |
u047796752 | p03426 | python | s026524031 | s538706435 | 449 | 405 | 81,236 | 62,956 | Accepted | Accepted | 9.8 | import sys
input = sys.stdin.readline
from collections import *
H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
x, y = defaultdict(int), defaultdict(int)
for i in range(H):
for j in range(W):
x[A[i][j]] = i
y[A[i][j]] = j
x[0] = x[D]
... | import sys
input = sys.stdin.readline
from collections import *
H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
x = [-1]*(H*W)
y = [-1]*(H*W)
for i in range(H):
for j in range(W):
x[A[i][j]-1] = i
y[A[i][j]-1] = j
acc = [[0] for _ in... | 30 | 31 | 644 | 649 | import sys
input = sys.stdin.readline
from collections import *
H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
x, y = defaultdict(int), defaultdict(int)
for i in range(H):
for j in range(W):
x[A[i][j]] = i
y[A[i][j]] = j
x[0] = x[D]
y[0] = y[D]
ac... | import sys
input = sys.stdin.readline
from collections import *
H, W, D = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
x = [-1] * (H * W)
y = [-1] * (H * W)
for i in range(H):
for j in range(W):
x[A[i][j] - 1] = i
y[A[i][j] - 1] = j
acc = [[0] for _ in ra... | false | 3.225806 | [
"-x, y = defaultdict(int), defaultdict(int)",
"+x = [-1] * (H * W)",
"+y = [-1] * (H * W)",
"- x[A[i][j]] = i",
"- y[A[i][j]] = j",
"-x[0] = x[D]",
"-y[0] = y[D]",
"+ x[A[i][j] - 1] = i",
"+ y[A[i][j] - 1] = j",
"- while now + D <= H * W:",
"- acc[i].append(... | false | 0.041089 | 0.054736 | 0.750681 | [
"s026524031",
"s538706435"
] |
u841531687 | p03163 | python | s321090734 | s599983191 | 645 | 592 | 123,016 | 120,856 | Accepted | Accepted | 8.22 | N, W = list(map(int, input().split()))
w = [0] * N
v = [0] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
def chmax(a, b):
if a >= b:
return a
else:
return b
dp = [[0]*(10**5 + 10) for _ in range(110)]
#i個の品物を入れて重さがjになっているときの価値の総和の最大値
#dp[i+1][j] = dp[i... | N, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(N)] #1-index
def chmax(a,b):
if a >= b:
return a
else:
return b
# dp[i+1][w]: i番目までの品物を選びその重さがwを超えないときの最大価値
dp = [[0]*(W+10) for _ in range(N+10)]
for i in range(N):
for w in range(W+1):... | 27 | 19 | 628 | 479 | N, W = list(map(int, input().split()))
w = [0] * N
v = [0] * N
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
def chmax(a, b):
if a >= b:
return a
else:
return b
dp = [[0] * (10**5 + 10) for _ in range(110)]
# i個の品物を入れて重さがjになっているときの価値の総和の最大値
# dp[i+1][j] = dp[i][j - w[i]... | N, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(N)] # 1-index
def chmax(a, b):
if a >= b:
return a
else:
return b
# dp[i+1][w]: i番目までの品物を選びその重さがwを超えないときの最大価値
dp = [[0] * (W + 10) for _ in range(N + 10)]
for i in range(N):
for w in range(W + 1)... | false | 29.62963 | [
"-w = [0] * N",
"-v = [0] * N",
"-for i in range(N):",
"- w[i], v[i] = list(map(int, input().split()))",
"+wv = [list(map(int, input().split())) for _ in range(N)] # 1-index",
"-dp = [[0] * (10**5 + 10) for _ in range(110)]",
"-# i個の品物を入れて重さがjになっているときの価値の総和の最大値",
"-# dp[i+1][j] = dp[i][j - w[i] + ... | false | 0.242281 | 0.125855 | 1.92508 | [
"s321090734",
"s599983191"
] |
u844646164 | p02850 | python | s917045201 | s450546222 | 631 | 538 | 109,744 | 89,680 | Accepted | Accepted | 14.74 | import sys
from collections import deque
input = sys.stdin.readline
N = int(eval(input()))
graph = [[] for _ in range(N)]
ab = [list([int(x)-1 for x in input().split()]) for _ in range(N-1)]
col_max = 0
for i in range(N-1):
a, b = ab[i]
graph[a] += [b]
graph[b] += [a]
for i in range(N):
col_max ... | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
N = int(eval(input()))
graph = [[] for _ in range(N)]
ab = [list([int(x)-1 for x in input().split()]) for _ in range(N-1)]
d = {}
for a, b in ab:
graph[a] += [b]
graph[b] += [a]
def dfs(u, pre, c):
color = 0
for v in graph[u... | 41 | 32 | 769 | 597 | import sys
from collections import deque
input = sys.stdin.readline
N = int(eval(input()))
graph = [[] for _ in range(N)]
ab = [list([int(x) - 1 for x in input().split()]) for _ in range(N - 1)]
col_max = 0
for i in range(N - 1):
a, b = ab[i]
graph[a] += [b]
graph[b] += [a]
for i in range(N):
col_max =... | import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
N = int(eval(input()))
graph = [[] for _ in range(N)]
ab = [list([int(x) - 1 for x in input().split()]) for _ in range(N - 1)]
d = {}
for a, b in ab:
graph[a] += [b]
graph[b] += [a]
def dfs(u, pre, c):
color = 0
for v in graph[u]... | false | 21.95122 | [
"-from collections import deque",
"+sys.setrecursionlimit(1000000000)",
"-col_max = 0",
"-for i in range(N - 1):",
"- a, b = ab[i]",
"+d = {}",
"+for a, b in ab:",
"-for i in range(N):",
"- col_max = max(col_max, len(graph[i]))",
"-print(col_max)",
"-def bfs(s):",
"- q = deque([s])",
... | false | 0.049711 | 0.049948 | 0.995248 | [
"s917045201",
"s450546222"
] |
u562935282 | p02910 | python | s724432415 | s351229883 | 180 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.56 | s = eval(input())
for ss in s[0::2]:
if ss == 'L':
print('No')
exit()
for ss in s[1::2]:
if ss == 'R':
print('No')
exit()
print('Yes')
| s = eval(input())
odds = s[0::2]
if 'L' in odds:
print('No')
exit()
evens = s[1::2]
if 'R' in evens:
print('No')
exit()
print('Yes')
| 13 | 13 | 184 | 158 | s = eval(input())
for ss in s[0::2]:
if ss == "L":
print("No")
exit()
for ss in s[1::2]:
if ss == "R":
print("No")
exit()
print("Yes")
| s = eval(input())
odds = s[0::2]
if "L" in odds:
print("No")
exit()
evens = s[1::2]
if "R" in evens:
print("No")
exit()
print("Yes")
| false | 0 | [
"-for ss in s[0::2]:",
"- if ss == \"L\":",
"- print(\"No\")",
"- exit()",
"-for ss in s[1::2]:",
"- if ss == \"R\":",
"- print(\"No\")",
"- exit()",
"+odds = s[0::2]",
"+if \"L\" in odds:",
"+ print(\"No\")",
"+ exit()",
"+evens = s[1::2]",
"+if \"R... | false | 0.047132 | 0.048332 | 0.975163 | [
"s724432415",
"s351229883"
] |
u133936772 | p02550 | python | s428427103 | s288447511 | 101 | 91 | 14,120 | 13,936 | Accepted | Accepted | 9.9 | n,x,m=list(map(int,input().split()))
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
t+=1
l[x]=t
s[x]=s[p]+x
p=x
x=pow(p,2,m)
T=t+1-l[x]
S=s[p]+x-s[x]
print((S*((n-l[x])//T)+s[l.index(l[x]+(n-l[x])%T)])) | n,x,m=list(map(int,input().split()))
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
t+=1
l[x]=t
s[x]=s[p]+x
p=x
x=pow(p,2,m)
T=t+1-l[x]
S=s[p]+x-s[x]
d,m=divmod(n-l[x],T)
print((S*d+s[l.index(l[x]+m)])) | 13 | 14 | 205 | 206 | n, x, m = list(map(int, input().split()))
l = [0] * m
s = [0] * m
t = p = 0
while l[x] < 1:
t += 1
l[x] = t
s[x] = s[p] + x
p = x
x = pow(p, 2, m)
T = t + 1 - l[x]
S = s[p] + x - s[x]
print((S * ((n - l[x]) // T) + s[l.index(l[x] + (n - l[x]) % T)]))
| n, x, m = list(map(int, input().split()))
l = [0] * m
s = [0] * m
t = p = 0
while l[x] < 1:
t += 1
l[x] = t
s[x] = s[p] + x
p = x
x = pow(p, 2, m)
T = t + 1 - l[x]
S = s[p] + x - s[x]
d, m = divmod(n - l[x], T)
print((S * d + s[l.index(l[x] + m)]))
| false | 7.142857 | [
"-print((S * ((n - l[x]) // T) + s[l.index(l[x] + (n - l[x]) % T)]))",
"+d, m = divmod(n - l[x], T)",
"+print((S * d + s[l.index(l[x] + m)]))"
] | false | 0.048269 | 0.048583 | 0.993549 | [
"s428427103",
"s288447511"
] |
u191874006 | p03354 | python | s998821470 | s530791779 | 1,103 | 520 | 99,692 | 14,256 | Accepted | Accepted | 52.86 | #!/usr/bin/env python3
n,m = list(map(int,input().split()))
p = list(map(int,input().split()))
for i in range(n):
p[i] -= 1
#連結成分に属するかどうかを見るときはUnion-Findを用いる
#根(属するクラス)を返す関数
def root(x):
if par[x] == x:
return x
par[x] = root(par[x])
return par[x]
#同じクラスに属するかどうかを返す関数
def same(... | #!/usr/bin/env python3
#ABC97 D
import sys
import math
import bisect
import time
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operato... | 43 | 50 | 923 | 1,077 | #!/usr/bin/env python3
n, m = list(map(int, input().split()))
p = list(map(int, input().split()))
for i in range(n):
p[i] -= 1
# 連結成分に属するかどうかを見るときはUnion-Findを用いる
# 根(属するクラス)を返す関数
def root(x):
if par[x] == x:
return x
par[x] = root(par[x])
return par[x]
# 同じクラスに属するかどうかを返す関数
def same(x, y):
... | #!/usr/bin/env python3
# ABC97 D
import sys
import math
import bisect
import time
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import it... | false | 14 | [
"-n, m = list(map(int, input().split()))",
"-p = list(map(int, input().split()))",
"-for i in range(n):",
"- p[i] -= 1",
"-# 連結成分に属するかどうかを見るときはUnion-Findを用いる",
"-# 根(属するクラス)を返す関数",
"+# ABC97 D",
"+import sys",
"+import math",
"+import bisect",
"+import time",
"+",
"+sys.setrecursionlimit(... | false | 0.045583 | 0.086094 | 0.529463 | [
"s998821470",
"s530791779"
] |
u891516200 | p02780 | python | s958679757 | s055901629 | 248 | 177 | 36,020 | 34,792 | Accepted | Accepted | 28.63 | from statistics import median
from time import time
t = time()
N, K = [int(x) for x in input().split()]
line_in_dice = list([int(x) for x in input().split()])
result = [0] * (N + K)
result[0] = line_in_dice[0]
result[K] -= line_in_dice[0]
max_point = 0
max_value = 0
for i in range(1, N):
resu... | from statistics import median
N, K = [int(x) for x in input().split()]
line_in_dice = list([(int(x) + 1) / 2 for x in input().split()])
result = [0] * (N + K)
result[0] = line_in_dice[0]
result[K] -= line_in_dice[0]
max_point = 0
max_value = 0
for i in range(1, N):
result[i] += (result[i - 1] + l... | 34 | 18 | 720 | 396 | from statistics import median
from time import time
t = time()
N, K = [int(x) for x in input().split()]
line_in_dice = list([int(x) for x in input().split()])
result = [0] * (N + K)
result[0] = line_in_dice[0]
result[K] -= line_in_dice[0]
max_point = 0
max_value = 0
for i in range(1, N):
result[i] += result[i - 1]... | from statistics import median
N, K = [int(x) for x in input().split()]
line_in_dice = list([(int(x) + 1) / 2 for x in input().split()])
result = [0] * (N + K)
result[0] = line_in_dice[0]
result[K] -= line_in_dice[0]
max_point = 0
max_value = 0
for i in range(1, N):
result[i] += result[i - 1] + line_in_dice[i]
... | false | 47.058824 | [
"-from time import time",
"-t = time()",
"-line_in_dice = list([int(x) for x in input().split()])",
"+line_in_dice = list([(int(x) + 1) / 2 for x in input().split()])",
"- if result[i] > max_value:",
"- max_point = i",
"- max_value = result[i]",
"-",
"-",
"-def create_median(x):",... | false | 0.036883 | 0.03474 | 1.061696 | [
"s958679757",
"s055901629"
] |
u391532301 | p03038 | python | s272787522 | s176550655 | 576 | 511 | 36,088 | 28,728 | Accepted | Accepted | 11.28 | N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A.sort()
BC = [list(map(int,input().split())) for i in range(M)]
BC.sort(key = lambda x:-x[1])
index = 0
l = len(A)
for i in range(len(BC)):
for j in range(BC[i][0]):
if index == l or A[index] >= BC[i][1]:
brea... | N,M = list(map(int,input().split()))
A = [int(_) for _ in input().split()]
BC = []
count = 0
s = 0
D = []
for i in range(M):
x,y = list(map(int,input().split()))
BC.append([x,y])
A.sort()
BC.sort(key = lambda x:-x[1])
while s+BC[count][0] <= N:
s += BC[count][0]
for i in range(BC[count][0]... | 19 | 30 | 411 | 643 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
BC = [list(map(int, input().split())) for i in range(M)]
BC.sort(key=lambda x: -x[1])
index = 0
l = len(A)
for i in range(len(BC)):
for j in range(BC[i][0]):
if index == l or A[index] >= BC[i][1]:
break
e... | N, M = list(map(int, input().split()))
A = [int(_) for _ in input().split()]
BC = []
count = 0
s = 0
D = []
for i in range(M):
x, y = list(map(int, input().split()))
BC.append([x, y])
A.sort()
BC.sort(key=lambda x: -x[1])
while s + BC[count][0] <= N:
s += BC[count][0]
for i in range(BC[count][0]):
... | false | 36.666667 | [
"-A = list(map(int, input().split()))",
"+A = [int(_) for _ in input().split()]",
"+BC = []",
"+count = 0",
"+s = 0",
"+D = []",
"+for i in range(M):",
"+ x, y = list(map(int, input().split()))",
"+ BC.append([x, y])",
"-BC = [list(map(int, input().split())) for i in range(M)]",
"+while s ... | false | 0.0473 | 0.038629 | 1.22447 | [
"s272787522",
"s176550655"
] |
u973193813 | p03073 | python | s036381025 | s140455988 | 197 | 46 | 15,932 | 3,956 | Accepted | Accepted | 76.65 | import numpy as np
S = list(map(int, eval(input())))
tmp = [0]*len(S)
if S[0] == 1:
for ii in range(0,len(S),2):
tmp[ii] = 1
else:
for ii in range(1,len(S),2):
tmp[ii] = 1
A = []
for ii in range(len(tmp)):
A.append(S[ii]-tmp[ii])
count = np.count_nonzero(A)
print(cou... | S = list(map(int, eval(input())))
count = 0
tmp = S[0]
for ii in S:
if ii != tmp:
count += 1
if tmp == 1:
tmp = 0
else:
tmp = 1
print(count) | 18 | 14 | 317 | 186 | import numpy as np
S = list(map(int, eval(input())))
tmp = [0] * len(S)
if S[0] == 1:
for ii in range(0, len(S), 2):
tmp[ii] = 1
else:
for ii in range(1, len(S), 2):
tmp[ii] = 1
A = []
for ii in range(len(tmp)):
A.append(S[ii] - tmp[ii])
count = np.count_nonzero(A)
print(count)
| S = list(map(int, eval(input())))
count = 0
tmp = S[0]
for ii in S:
if ii != tmp:
count += 1
if tmp == 1:
tmp = 0
else:
tmp = 1
print(count)
| false | 22.222222 | [
"-import numpy as np",
"-",
"-tmp = [0] * len(S)",
"-if S[0] == 1:",
"- for ii in range(0, len(S), 2):",
"- tmp[ii] = 1",
"-else:",
"- for ii in range(1, len(S), 2):",
"- tmp[ii] = 1",
"-A = []",
"-for ii in range(len(tmp)):",
"- A.append(S[ii] - tmp[ii])",
"-count = n... | false | 0.282225 | 0.03614 | 7.809306 | [
"s036381025",
"s140455988"
] |
u312025627 | p03048 | python | s898178449 | s322588735 | 366 | 306 | 40,684 | 41,068 | Accepted | Accepted | 16.39 | def main():
R, G, B, N = (int(i) for i in input().split())
ans = 0
for r in range(0, N+1):
for g in range(0, N+1):
b = (N - r*R - g*G)//B
if b >= 0 and r*R + g*G + b*B == N:
ans += 1
print(ans)
if __name__ == '__main__':
main()
| def main():
R, G, B, N = (int(i) for i in input().split())
ans = 0
for r in range(N+1):
for g in range(N+1):
need = N - r*R - g*G # 必要ボール数
if need < 0:
continue
b = 0--need//B
if r*R + g*G + b*B == N:
ans += 1... | 13 | 17 | 310 | 415 | def main():
R, G, B, N = (int(i) for i in input().split())
ans = 0
for r in range(0, N + 1):
for g in range(0, N + 1):
b = (N - r * R - g * G) // B
if b >= 0 and r * R + g * G + b * B == N:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| def main():
R, G, B, N = (int(i) for i in input().split())
ans = 0
for r in range(N + 1):
for g in range(N + 1):
need = N - r * R - g * G # 必要ボール数
if need < 0:
continue
b = 0 - -need // B
if r * R + g * G + b * B == N:
... | false | 23.529412 | [
"- for r in range(0, N + 1):",
"- for g in range(0, N + 1):",
"- b = (N - r * R - g * G) // B",
"- if b >= 0 and r * R + g * G + b * B == N:",
"+ for r in range(N + 1):",
"+ for g in range(N + 1):",
"+ need = N - r * R - g * G # 必要ボール数",
"+ ... | false | 1.356039 | 1.202933 | 1.127278 | [
"s898178449",
"s322588735"
] |
u530383736 | p03127 | python | s599699399 | s535687110 | 111 | 90 | 14,252 | 14,252 | Accepted | Accepted | 18.92 | # -*- coding: utf-8 -*-
N = int(input().strip())
a_list = [int(i) for i in input().rstrip().split()]
#-----
def gcd(a,b):
x = max(a,b)
y = min(a,b)
while y != 0:
r = x % y
x = y
y = r
return x
ans = a_list[0]
for i in a_list[1:]:
ans = gc... | # -*- coding: utf-8 -*-
N = int(input().strip())
a_list = [int(i) for i in input().rstrip().split()]
#-----
def gcd(a,b):
if b == 0:
return a
return gcd(b, a % b)
ans = a_list[0]
for i in a_list[1:]:
ans = gcd(ans, i)
print(ans)
| 23 | 16 | 344 | 269 | # -*- coding: utf-8 -*-
N = int(input().strip())
a_list = [int(i) for i in input().rstrip().split()]
# -----
def gcd(a, b):
x = max(a, b)
y = min(a, b)
while y != 0:
r = x % y
x = y
y = r
return x
ans = a_list[0]
for i in a_list[1:]:
ans = gcd(ans, i)
print(ans)
| # -*- coding: utf-8 -*-
N = int(input().strip())
a_list = [int(i) for i in input().rstrip().split()]
# -----
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
ans = a_list[0]
for i in a_list[1:]:
ans = gcd(ans, i)
print(ans)
| false | 30.434783 | [
"- x = max(a, b)",
"- y = min(a, b)",
"- while y != 0:",
"- r = x % y",
"- x = y",
"- y = r",
"- return x",
"+ if b == 0:",
"+ return a",
"+ return gcd(b, a % b)"
] | false | 0.069039 | 0.057218 | 1.206594 | [
"s599699399",
"s535687110"
] |
u708255304 | p02999 | python | s845113864 | s742000431 | 20 | 18 | 3,316 | 3,064 | Accepted | Accepted | 10 | X, A = list(map(int, input().split()))
if X < A:
print((0))
else:
print((10))
| X, A = list(map(int, input().split()))
if A > X:
print((0))
else:
print((10))
| 6 | 6 | 82 | 82 | X, A = list(map(int, input().split()))
if X < A:
print((0))
else:
print((10))
| X, A = list(map(int, input().split()))
if A > X:
print((0))
else:
print((10))
| false | 0 | [
"-if X < A:",
"+if A > X:"
] | false | 0.046665 | 0.047526 | 0.981891 | [
"s845113864",
"s742000431"
] |
u695811449 | p03329 | python | s051091422 | s288712695 | 387 | 273 | 7,064 | 3,192 | Accepted | Accepted | 29.46 | N=int(eval(input()))
X=[1]+[6**i for i in range(1,7)]+[9**i for i in range(1,6)]
X.sort()
X.reverse()
DP=[i for i in range(100001)]
def dpmin(i):
Y=i
for j in X:
if i-j>=0:
Y=min(Y,DP[i-j]+1)
return Y
for i in range(100001):
DP[i]=dpmin(i)
print((DP[N]))
| N=int(eval(input()))
X=[1]+[6**i for i in range(1,7)]+[9**i for i in range(1,6)]
X.sort()
X.reverse()
ANS=1000000
i=4
for i_0 in range(max(N//X[0]-i,0),N//X[0]+1):
N_0=N-X[0]*i_0
for i_1 in range(max(N_0//X[1]-i,0),N_0//X[1]+1):
N_1=N_0-X[1]*i_1
for i_2 in range(max(N... | 23 | 49 | 311 | 1,617 | N = int(eval(input()))
X = [1] + [6**i for i in range(1, 7)] + [9**i for i in range(1, 6)]
X.sort()
X.reverse()
DP = [i for i in range(100001)]
def dpmin(i):
Y = i
for j in X:
if i - j >= 0:
Y = min(Y, DP[i - j] + 1)
return Y
for i in range(100001):
DP[i] = dpmin(i)
print((DP[N])... | N = int(eval(input()))
X = [1] + [6**i for i in range(1, 7)] + [9**i for i in range(1, 6)]
X.sort()
X.reverse()
ANS = 1000000
i = 4
for i_0 in range(max(N // X[0] - i, 0), N // X[0] + 1):
N_0 = N - X[0] * i_0
for i_1 in range(max(N_0 // X[1] - i, 0), N_0 // X[1] + 1):
N_1 = N_0 - X[1] * i_1
for ... | false | 53.061224 | [
"-DP = [i for i in range(100001)]",
"-",
"-",
"-def dpmin(i):",
"- Y = i",
"- for j in X:",
"- if i - j >= 0:",
"- Y = min(Y, DP[i - j] + 1)",
"- return Y",
"-",
"-",
"-for i in range(100001):",
"- DP[i] = dpmin(i)",
"-print((DP[N]))",
"+ANS = 1000000",
"+... | false | 1.906303 | 0.102146 | 18.662551 | [
"s051091422",
"s288712695"
] |
u172147273 | p02819 | python | s758256300 | s225328059 | 39 | 18 | 2,940 | 3,060 | Accepted | Accepted | 53.85 | import math
x=int(eval(input()))
flag=True
if x==2:
print(x)
else:
while flag:
i=2
f=True
while i<x and f:
if x%i==0:
f=False
i+=1
if f==True:
print(x)
flag=False
else:
x+=1
... | import math
x=int(eval(input()))
flag=True
if x==2:
print(x)
else:
while flag:
i=2
f=True
while i<math.sqrt(x) and f:
if x%i==0:
f=False
i+=1
if f==True:
print(x)
flag=False
else:
... | 27 | 27 | 327 | 338 | import math
x = int(eval(input()))
flag = True
if x == 2:
print(x)
else:
while flag:
i = 2
f = True
while i < x and f:
if x % i == 0:
f = False
i += 1
if f == True:
print(x)
flag = False
else:
x ... | import math
x = int(eval(input()))
flag = True
if x == 2:
print(x)
else:
while flag:
i = 2
f = True
while i < math.sqrt(x) and f:
if x % i == 0:
f = False
i += 1
if f == True:
print(x)
flag = False
else:
... | false | 0 | [
"- while i < x and f:",
"+ while i < math.sqrt(x) and f:"
] | false | 0.046848 | 0.041144 | 1.138644 | [
"s758256300",
"s225328059"
] |
u600402037 | p02715 | python | s358468108 | s352997120 | 457 | 375 | 84,216 | 70,128 | Accepted | Accepted | 17.94 | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def make_divisors(n): # nの約数を列挙
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10 ** 9 + 7
# gcdがNから順に数える、resetを用意、約数をそれぞれ引く
def make_divisors(n): # nの約数を列挙
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
... | 33 | 35 | 707 | 750 | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def make_divisors(n): # nの約数を列挙
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 10**9 + 7
# gcdがNから順に数える、resetを用意、約数をそれぞれ引く
def make_divisors(n): # nの約数を列挙
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors... | false | 5.714286 | [
"-",
"-",
"+MOD = 10**9 + 7",
"+# gcdがNから順に数える、resetを用意、約数をそれぞれ引く",
"-# 最大公約数が1から順番に数える",
"-MOD = 10**9 + 7",
"-for i in range(1, K + 1):",
"- num = K // i",
"- cmb = pow(num, N, MOD)",
"- arr = make_divisors(i)",
"- x = i",
"- for a in arr[:-1]:",
"- x -= reset[a]",
... | false | 0.263929 | 0.260023 | 1.015023 | [
"s358468108",
"s352997120"
] |
u999750647 | p02641 | python | s192657374 | s251974332 | 103 | 22 | 27,160 | 9,184 | Accepted | Accepted | 78.64 | import numpy as np
x,n = list(map(int,input().split()))
p = list(map(int,input().split()))
q = []
for i in range(-101,102):
q.append(i)
for i in range(n):
q.remove(p[i-1])
def getNearestValue(list, num):
# リスト要素と対象値の差分を計算し最小値のインデックスを取得
idx = np.abs(np.asarray(list) - num).argmin()
ret... | import sys
X, N = list(map(int, input().split()))
x = list(map(int, input().split()))
for i in range(101):
if X-i not in x:
print((X-i))
sys.exit()
elif X+i not in x:
print((X+i))
sys.exit() | 17 | 11 | 361 | 211 | import numpy as np
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))
q = []
for i in range(-101, 102):
q.append(i)
for i in range(n):
q.remove(p[i - 1])
def getNearestValue(list, num):
# リスト要素と対象値の差分を計算し最小値のインデックスを取得
idx = np.abs(np.asarray(list) - num).argmin()
return li... | import sys
X, N = list(map(int, input().split()))
x = list(map(int, input().split()))
for i in range(101):
if X - i not in x:
print((X - i))
sys.exit()
elif X + i not in x:
print((X + i))
sys.exit()
| false | 35.294118 | [
"-import numpy as np",
"+import sys",
"-x, n = list(map(int, input().split()))",
"-p = list(map(int, input().split()))",
"-q = []",
"-for i in range(-101, 102):",
"- q.append(i)",
"-for i in range(n):",
"- q.remove(p[i - 1])",
"-",
"-",
"-def getNearestValue(list, num):",
"- # リスト要素... | false | 1.059508 | 0.044214 | 23.963347 | [
"s192657374",
"s251974332"
] |
u811817592 | p02756 | python | s113286058 | s048636034 | 731 | 449 | 4,596 | 4,596 | Accepted | Accepted | 38.58 | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = list(map(str, input().split()))
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[1] == "1" else -1
h_or_t_flag *= r... | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = str(eval(input())) # contains spaces
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[2] == "1" else -1
h_or_t_flag... | 22 | 22 | 521 | 520 | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = list(map(str, input().split()))
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[1] == "1" else -1
h_or_t_flag *= rev_flag
... | # -*- coding: utf-8 -*-
S = str(eval(input()))
Q = int(eval(input()))
rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
query = str(eval(input())) # contains spaces
if query[0] == "1":
rev_flag *= -1
else:
h_or_t_flag = 1 if query[2] == "1" else -1
h_or_t_flag *= rev_flag
... | false | 0 | [
"- query = list(map(str, input().split()))",
"+ query = str(eval(input())) # contains spaces",
"- h_or_t_flag = 1 if query[1] == \"1\" else -1",
"+ h_or_t_flag = 1 if query[2] == \"1\" else -1",
"- head_str += query[2]",
"+ head_str += query[4]",
"- ... | false | 0.046315 | 0.035257 | 1.313634 | [
"s113286058",
"s048636034"
] |
u888092736 | p02597 | python | s474708086 | s711125728 | 107 | 55 | 9,764 | 9,636 | Accepted | Accepted | 48.6 | from collections import Counter
N = int(eval(input()))
C = eval(input())
C_cntr = Counter(C)
all_R_cnt = 0
all_W_cnt = 0
R_W_cnt = 0
for i in range(N):
if C[i] == "W":
all_R_cnt += 1
elif C[i] == "R":
all_W_cnt += 1
if i < C_cntr.get("R", 0) and C[i] == "W":
R_W_cn... | from collections import Counter
N = int(eval(input()))
C = eval(input())
C_cntr = Counter(C)
ans = 0
for i in range(C_cntr["R"]):
if C[i] == "W":
ans += 1
print(ans)
| 19 | 13 | 360 | 182 | from collections import Counter
N = int(eval(input()))
C = eval(input())
C_cntr = Counter(C)
all_R_cnt = 0
all_W_cnt = 0
R_W_cnt = 0
for i in range(N):
if C[i] == "W":
all_R_cnt += 1
elif C[i] == "R":
all_W_cnt += 1
if i < C_cntr.get("R", 0) and C[i] == "W":
R_W_cnt += 1
print((min(... | from collections import Counter
N = int(eval(input()))
C = eval(input())
C_cntr = Counter(C)
ans = 0
for i in range(C_cntr["R"]):
if C[i] == "W":
ans += 1
print(ans)
| false | 31.578947 | [
"-all_R_cnt = 0",
"-all_W_cnt = 0",
"-R_W_cnt = 0",
"-for i in range(N):",
"+ans = 0",
"+for i in range(C_cntr[\"R\"]):",
"- all_R_cnt += 1",
"- elif C[i] == \"R\":",
"- all_W_cnt += 1",
"- if i < C_cntr.get(\"R\", 0) and C[i] == \"W\":",
"- R_W_cnt += 1",
"-print((m... | false | 0.034812 | 0.035635 | 0.97688 | [
"s474708086",
"s711125728"
] |
u397496203 | p03611 | python | s276605590 | s514364203 | 142 | 116 | 37,688 | 84,568 | Accepted | Accepted | 18.31 | import numpy as np
N = int(eval(input()))
A = np.array(input().split(), dtype = np.int32)
counter = np.bincount(A)
if len(counter) <= 2:
answer = counter.sum()
else:
answer = (counter[2:] + counter[1:-1] + counter[:-2]).max()
print(answer) | from collections import Counter
n = int(eval(input()))
A = [int(i) for i in input().split()]
counts = Counter(A)
ans = 0
for k, v in list(counts.items()):
tmp = v
if k + 1 in list(counts.keys()):
tmp += counts[k + 1]
if k - 1 in list(counts.keys()):
tmp += counts[k - 1]
an... | 10 | 16 | 248 | 328 | import numpy as np
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int32)
counter = np.bincount(A)
if len(counter) <= 2:
answer = counter.sum()
else:
answer = (counter[2:] + counter[1:-1] + counter[:-2]).max()
print(answer)
| from collections import Counter
n = int(eval(input()))
A = [int(i) for i in input().split()]
counts = Counter(A)
ans = 0
for k, v in list(counts.items()):
tmp = v
if k + 1 in list(counts.keys()):
tmp += counts[k + 1]
if k - 1 in list(counts.keys()):
tmp += counts[k - 1]
ans = max(tmp, a... | false | 37.5 | [
"-import numpy as np",
"+from collections import Counter",
"-N = int(eval(input()))",
"-A = np.array(input().split(), dtype=np.int32)",
"-counter = np.bincount(A)",
"-if len(counter) <= 2:",
"- answer = counter.sum()",
"-else:",
"- answer = (counter[2:] + counter[1:-1] + counter[:-2]).max()",
... | false | 0.172959 | 0.074436 | 2.3236 | [
"s276605590",
"s514364203"
] |
u075304271 | p02888 | python | s447937686 | s891895690 | 978 | 528 | 10,684 | 10,576 | Accepted | Accepted | 46.01 | import math
import collections
import fractions
import itertools
import functools
import operator
import bisect
def solve():
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
res = 0
for i in range(n):
for j in range(i+1, n):
k = bisect.bisect_le... | import math
import collections
import fractions
import itertools
import functools
import operator
import bisect
def solve():
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
res = 0
for i in range(n):
k = i
for j in range(i+1, n):
while... | 22 | 24 | 439 | 470 | import math
import collections
import fractions
import itertools
import functools
import operator
import bisect
def solve():
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
res = 0
for i in range(n):
for j in range(i + 1, n):
k = bisect.bisect_left(l, l[i] +... | import math
import collections
import fractions
import itertools
import functools
import operator
import bisect
def solve():
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
res = 0
for i in range(n):
k = i
for j in range(i + 1, n):
while k < n and l[... | false | 8.333333 | [
"+ k = i",
"- k = bisect.bisect_left(l, l[i] + l[j])",
"- res += max(k - (j + 1), 0)",
"+ while k < n and l[k] < l[i] + l[j]:",
"+ k += 1",
"+ res += k - (j + 1)"
] | false | 0.124938 | 0.044907 | 2.782132 | [
"s447937686",
"s891895690"
] |
u588341295 | p03965 | python | s752424220 | s610410912 | 67 | 26 | 5,324 | 3,564 | Accepted | Accepted | 61.19 | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, produ... | # -*- coding: utf-8 -*-
import sys
from collections import Counter
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range... | 33 | 26 | 987 | 802 | # -*- coding: utf-8 -*-
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from ... | # -*- coding: utf-8 -*-
import sys
from collections import Counter
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d ... | false | 21.212121 | [
"-import sys, re",
"-from collections import deque, defaultdict, Counter",
"-from math import sqrt, hypot, factorial, pi, sin, cos, radians",
"-from heapq import heappop, heappush, heapify, heappushpop",
"-from bisect import bisect_left, bisect_right",
"-from itertools import permutations, combinations, p... | false | 0.037994 | 0.03848 | 0.987381 | [
"s752424220",
"s610410912"
] |
u503227287 | p03478 | python | s451512461 | s286481643 | 207 | 180 | 42,092 | 39,536 | Accepted | Accepted | 13.04 | from sys import stdin
if __name__ == "__main__":
_in = [_.rstrip() for _ in stdin.readlines()]
N, A, B = list(map(int,_in[0].split(' '))) # type:list(int)
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
cnt = 0
for n in range(N+1):
_sum = sum(list(map(int,list(str(n)))))
... | from sys import stdin
def find_sum_of_digits(n, base=10):
_sum = 0
while n>0:
_sum += n%base
n //= base
return _sum
if __name__ == "__main__":
_in = [_.rstrip() for _ in stdin.readlines()]
N, A, B = list(map(int,_in[0].split(' '))) # type:list(int)
# vvvvvvvvvv... | 14 | 22 | 444 | 567 | from sys import stdin
if __name__ == "__main__":
_in = [_.rstrip() for _ in stdin.readlines()]
N, A, B = list(map(int, _in[0].split(" "))) # type:list(int)
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
cnt = 0
for n in range(N + 1):
_sum = sum(list(map(int, list(str(n)))))
... | from sys import stdin
def find_sum_of_digits(n, base=10):
_sum = 0
while n > 0:
_sum += n % base
n //= base
return _sum
if __name__ == "__main__":
_in = [_.rstrip() for _ in stdin.readlines()]
N, A, B = list(map(int, _in[0].split(" "))) # type:list(int)
# vvvvvvvvvvvvvvvvvvv... | false | 36.363636 | [
"+",
"+",
"+def find_sum_of_digits(n, base=10):",
"+ _sum = 0",
"+ while n > 0:",
"+ _sum += n % base",
"+ n //= base",
"+ return _sum",
"+",
"- for n in range(N + 1):",
"- _sum = sum(list(map(int, list(str(n)))))",
"+ for n in range(1, N + 1):",
"+ ... | false | 0.047319 | 0.132186 | 0.357971 | [
"s451512461",
"s286481643"
] |
u185896732 | p02981 | python | s986931026 | s301202687 | 184 | 168 | 38,384 | 38,384 | Accepted | Accepted | 8.7 | n,a,b=list(map(int,input().split()))
print((min(n*a,b))) | n,a,b=list(map(int,input().split()))
print((min(a*n,b))) | 2 | 2 | 49 | 49 | n, a, b = list(map(int, input().split()))
print((min(n * a, b)))
| n, a, b = list(map(int, input().split()))
print((min(a * n, b)))
| false | 0 | [
"-print((min(n * a, b)))",
"+print((min(a * n, b)))"
] | false | 0.008059 | 0.040675 | 0.19813 | [
"s986931026",
"s301202687"
] |
u089230684 | p03962 | python | s656881885 | s765683014 | 18 | 16 | 3,064 | 2,940 | Accepted | Accepted | 11.11 | l=list(map(int,input().split()))
ls=[]
for i in l:
ls.append(i)
k=set(ls)
print((len(k))) | a,b,c=input().split()
if a==b==c:
print("1")
elif a==b or b==c or c==a:
print("2")
else:
print("3") | 6 | 8 | 91 | 119 | l = list(map(int, input().split()))
ls = []
for i in l:
ls.append(i)
k = set(ls)
print((len(k)))
| a, b, c = input().split()
if a == b == c:
print("1")
elif a == b or b == c or c == a:
print("2")
else:
print("3")
| false | 25 | [
"-l = list(map(int, input().split()))",
"-ls = []",
"-for i in l:",
"- ls.append(i)",
"-k = set(ls)",
"-print((len(k)))",
"+a, b, c = input().split()",
"+if a == b == c:",
"+ print(\"1\")",
"+elif a == b or b == c or c == a:",
"+ print(\"2\")",
"+else:",
"+ print(\"3\")"
] | false | 0.035432 | 0.036186 | 0.979168 | [
"s656881885",
"s765683014"
] |
u307622233 | p02686 | python | s661680257 | s135004977 | 1,794 | 1,042 | 171,232 | 234,948 | Accepted | Accepted | 41.92 | def count_scan(s):
max_min = 0
compare = 0
for c in s:
if c == '(':
compare += 1
elif c == ')':
compare -= 1
max_min = min(max_min, compare)
return min(max_min, compare), compare
def key(lst):
m, c = lst
if c > 0:
ret... | import sys
input = sys.stdin.readline
# up_list = []
# down_list = []
def count_scan(s):
max_min = 0
compare = 0
for c in s:
if c == '(':
compare += 1
elif c == ')':
compare -= 1
max_min = min(max_min, compare)
return min(max_min, co... | 42 | 55 | 816 | 1,181 | def count_scan(s):
max_min = 0
compare = 0
for c in s:
if c == "(":
compare += 1
elif c == ")":
compare -= 1
max_min = min(max_min, compare)
return min(max_min, compare), compare
def key(lst):
m, c = lst
if c > 0:
return 1, m
else... | import sys
input = sys.stdin.readline
# up_list = []
# down_list = []
def count_scan(s):
max_min = 0
compare = 0
for c in s:
if c == "(":
compare += 1
elif c == ")":
compare -= 1
max_min = min(max_min, compare)
return min(max_min, compare), compare
... | false | 23.636364 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+# up_list = []",
"+# down_list = []",
"+ # up_list.sort(key=lambda x: x[1], reverse=True)",
"+ # down_list.sort(key=lambda x: x[1], reverse=False)",
"+ # print(lst)",
"+ # print(sorted([count_scan(lst) for i in lst],",
"+ # rever... | false | 0.078055 | 0.036535 | 2.136442 | [
"s661680257",
"s135004977"
] |
u111652094 | p02707 | python | s641853908 | s120540847 | 265 | 157 | 32,356 | 32,232 | Accepted | Accepted | 40.75 |
N=int(eval(input()))
A=list(map(int,input().split()))
A.sort()
if A[0]==0:
A.remove(0)
l=len(A)
k=0
ans=1
m=max(A)
for i in range(l-1):
if A[i+1]>A[i]:
k=A[i]
print(ans)
while A[i+1]!=k+1:
k=k+1
print((0))
ans=1
else:
... | N=int(eval(input()))
A=list(map(int,input().split()))
L=[0]*N
for i in A:
L[i-1]+=1
for i in range(N):
print((L[i])) | 33 | 12 | 436 | 132 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
if A[0] == 0:
A.remove(0)
l = len(A)
k = 0
ans = 1
m = max(A)
for i in range(l - 1):
if A[i + 1] > A[i]:
k = A[i]
print(ans)
while A[i + 1] != k + 1:
k = k + 1
print((0))
ans = 1
else:... | N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * N
for i in A:
L[i - 1] += 1
for i in range(N):
print((L[i]))
| false | 63.636364 | [
"-A.sort()",
"-if A[0] == 0:",
"- A.remove(0)",
"-l = len(A)",
"-k = 0",
"-ans = 1",
"-m = max(A)",
"-for i in range(l - 1):",
"- if A[i + 1] > A[i]:",
"- k = A[i]",
"- print(ans)",
"- while A[i + 1] != k + 1:",
"- k = k + 1",
"- print((0))"... | false | 0.07869 | 0.115953 | 0.678634 | [
"s641853908",
"s120540847"
] |
u183509493 | p03048 | python | s044594614 | s986951461 | 1,980 | 970 | 2,940 | 2,940 | Accepted | Accepted | 51.01 | a,b,c,n=list(map(int,input().split()))
ans=0
for x in range((n+a)//a):
for y in range((n+b-a*x)//b):
z=n-a*x-b*y
if z>=0 and z%c==0:
ans+=1
print(ans)
| a,b,c,n=list(map(int,input().split()))
ans=0
for x in range(0,n+1,a):
for y in range(x,n+1,b):
if (n-y)%c==0:
ans+=1
print(ans)
| 8 | 7 | 168 | 140 | a, b, c, n = list(map(int, input().split()))
ans = 0
for x in range((n + a) // a):
for y in range((n + b - a * x) // b):
z = n - a * x - b * y
if z >= 0 and z % c == 0:
ans += 1
print(ans)
| a, b, c, n = list(map(int, input().split()))
ans = 0
for x in range(0, n + 1, a):
for y in range(x, n + 1, b):
if (n - y) % c == 0:
ans += 1
print(ans)
| false | 12.5 | [
"-for x in range((n + a) // a):",
"- for y in range((n + b - a * x) // b):",
"- z = n - a * x - b * y",
"- if z >= 0 and z % c == 0:",
"+for x in range(0, n + 1, a):",
"+ for y in range(x, n + 1, b):",
"+ if (n - y) % c == 0:"
] | false | 0.104114 | 0.0677 | 1.537882 | [
"s044594614",
"s986951461"
] |
u488401358 | p03291 | python | s383578633 | s083172796 | 293 | 72 | 52,464 | 67,580 | Accepted | Accepted | 75.43 | def main():
S=eval(input())
N=len(S)
abccounter=0
abcounter=0
acounter=0
for i in range(0,N):
if S[i]=='A':
acounter+=1
elif S[i]=='B':
abcounter+=acounter
elif S[i]=='C':
abccounter+=abcounter
hbccounter=0
hbcount... | s = input().lower()
n = len(s)
dp_a = 0
dp_ab = 0
dp_abc = 0
hatena = 1
mod = 10**9 + 7
for i in range(n):
if s[i]=="a":
dp_a = (dp_a + hatena) % mod
elif s[i]=="b":
dp_ab = (dp_a + dp_ab) % mod
elif s[i]=="c":
dp_abc = (dp_ab + dp_abc) % mod
else:
dp... | 82 | 24 | 2,170 | 492 | def main():
S = eval(input())
N = len(S)
abccounter = 0
abcounter = 0
acounter = 0
for i in range(0, N):
if S[i] == "A":
acounter += 1
elif S[i] == "B":
abcounter += acounter
elif S[i] == "C":
abccounter += abcounter
hbccounter = 0
... | s = input().lower()
n = len(s)
dp_a = 0
dp_ab = 0
dp_abc = 0
hatena = 1
mod = 10**9 + 7
for i in range(n):
if s[i] == "a":
dp_a = (dp_a + hatena) % mod
elif s[i] == "b":
dp_ab = (dp_a + dp_ab) % mod
elif s[i] == "c":
dp_abc = (dp_ab + dp_abc) % mod
else:
dp_abc = (dp_ab +... | false | 70.731707 | [
"-def main():",
"- S = eval(input())",
"- N = len(S)",
"- abccounter = 0",
"- abcounter = 0",
"- acounter = 0",
"- for i in range(0, N):",
"- if S[i] == \"A\":",
"- acounter += 1",
"- elif S[i] == \"B\":",
"- abcounter += acounter",
"- ... | false | 0.043831 | 0.036342 | 1.206088 | [
"s383578633",
"s083172796"
] |
u366959492 | p03220 | python | s914334909 | s503997602 | 20 | 18 | 3,188 | 3,060 | Accepted | Accepted | 10 | n=int(eval(input()))
t,a=list(map(int,input().split()))
h=list(map(int,input().split()))
x=-61
c=[]
if h[0]==81234:
print((3))
exit()
for i in range(n):
T=t-h[i]*0.006
if abs(a-T)<abs(a-x):
c.append(i)
x=T
print((c[-1]+1))
| n = int(eval(input()))
t,a = list(map(int,input().split()))
H = [abs(a-(t-int(x)*0.006)) for x in input().split()]
print((H.index(min(H))+1))
| 14 | 4 | 252 | 131 | n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
x = -61
c = []
if h[0] == 81234:
print((3))
exit()
for i in range(n):
T = t - h[i] * 0.006
if abs(a - T) < abs(a - x):
c.append(i)
x = T
print((c[-1] + 1))
| n = int(eval(input()))
t, a = list(map(int, input().split()))
H = [abs(a - (t - int(x) * 0.006)) for x in input().split()]
print((H.index(min(H)) + 1))
| false | 71.428571 | [
"-h = list(map(int, input().split()))",
"-x = -61",
"-c = []",
"-if h[0] == 81234:",
"- print((3))",
"- exit()",
"-for i in range(n):",
"- T = t - h[i] * 0.006",
"- if abs(a - T) < abs(a - x):",
"- c.append(i)",
"- x = T",
"-print((c[-1] + 1))",
"+H = [abs(a - (t - ... | false | 0.041093 | 0.04291 | 0.95765 | [
"s914334909",
"s503997602"
] |
u372144784 | p02788 | python | s363590082 | s370056450 | 1,848 | 1,660 | 111,880 | 96,088 | Accepted | Accepted | 10.17 | import math,bisect
n,d,a = list(map(int,input().split()))
lst1 = [list(map(int,input().split())) for i in range(n)]
lst1.sort()
#解法2 - imos法
"""
単純に座標に対してimos法を行うと、座標の制約は10**9なので間に合わない。
process1
そこで、各モンスターに対して、そのモンスターを左端で攻撃を行った際、右側の巻き込めるモンスターのインデックスを
保存するリストを作る。
process2
これにより、imosのテーブルはn+1個で答えを求めることができる。
... | import math
from collections import deque
n,d,a = list(map(int,input().split()))
lst1 = [list(map(int,input().split())) for i in range(n)]
lst1.sort()
#解法1 - 貪欲法
"""
キューを使った貪欲法で間に合わせる。
que = [[ダメージ量,そのダメージがどこまで使えるか],...]
とすることにより、高速にダメージ管理をすることができる。
"""
que = deque()
ans = 0
dmg = 0
for i in range(n... | 39 | 33 | 852 | 670 | import math, bisect
n, d, a = list(map(int, input().split()))
lst1 = [list(map(int, input().split())) for i in range(n)]
lst1.sort()
# 解法2 - imos法
"""
単純に座標に対してimos法を行うと、座標の制約は10**9なので間に合わない。
process1
そこで、各モンスターに対して、そのモンスターを左端で攻撃を行った際、右側の巻き込めるモンスターのインデックスを
保存するリストを作る。
process2
これにより、imosのテーブルはn+1個で答えを求めることができる。
また、imo... | import math
from collections import deque
n, d, a = list(map(int, input().split()))
lst1 = [list(map(int, input().split())) for i in range(n)]
lst1.sort()
# 解法1 - 貪欲法
"""
キューを使った貪欲法で間に合わせる。
que = [[ダメージ量,そのダメージがどこまで使えるか],...]
とすることにより、高速にダメージ管理をすることができる。
"""
que = deque()
ans = 0
dmg = 0
for i in range(n):
while q... | false | 15.384615 | [
"-import math, bisect",
"+import math",
"+from collections import deque",
"-# 解法2 - imos法",
"+# 解法1 - 貪欲法",
"-単純に座標に対してimos法を行うと、座標の制約は10**9なので間に合わない。",
"-process1",
"-そこで、各モンスターに対して、そのモンスターを左端で攻撃を行った際、右側の巻き込めるモンスターのインデックスを",
"-保存するリストを作る。",
"-process2",
"-これにより、imosのテーブルはn+1個で答えを求めることができる。",
... | false | 0.101638 | 0.041815 | 2.430634 | [
"s363590082",
"s370056450"
] |
u729133443 | p03672 | python | s987642854 | s940435360 | 20 | 17 | 3,188 | 2,940 | Accepted | Accepted | 15 | import re;print((len(re.match(r"(.+)\1",input()[:-1]).group()))) | s=input()[:-1];print((max(i*2for i in range(99)if s[:i]==s[i:i*2]))) | 1 | 1 | 62 | 66 | import re
print((len(re.match(r"(.+)\1", input()[:-1]).group())))
| s = input()[:-1]
print((max(i * 2 for i in range(99) if s[:i] == s[i : i * 2])))
| false | 0 | [
"-import re",
"-",
"-print((len(re.match(r\"(.+)\\1\", input()[:-1]).group())))",
"+s = input()[:-1]",
"+print((max(i * 2 for i in range(99) if s[:i] == s[i : i * 2])))"
] | false | 0.075933 | 0.063215 | 1.201189 | [
"s987642854",
"s940435360"
] |
u127499732 | p02948 | python | s272206067 | s171805332 | 207 | 184 | 25,496 | 26,264 | Accepted | Accepted | 11.11 | def main():
import heapq
n, m, *ab = list(map(int, open(0).read().split()))
l = [[] for _ in range(m + 1)]
for i, j in zip(*[iter(ab)] * 2):
if i <= m:
heapq.heappush(l[i], -j)
ans = 0
h = []
for i in range(1, m + 1):
for j in l[i]:
he... | def main():
from heapq import heappush as sushi
from heapq import heappop as tempra
n, m, *ab = list(map(int, open(0).read().split()))
l = [[] for _ in range(m + 1)]
for i, j in zip(*[iter(ab)] * 2):
if i <= m:
l[i].append(-j)
w = []
h = []
for i in range(... | 22 | 23 | 476 | 516 | def main():
import heapq
n, m, *ab = list(map(int, open(0).read().split()))
l = [[] for _ in range(m + 1)]
for i, j in zip(*[iter(ab)] * 2):
if i <= m:
heapq.heappush(l[i], -j)
ans = 0
h = []
for i in range(1, m + 1):
for j in l[i]:
heapq.heappush(h, ... | def main():
from heapq import heappush as sushi
from heapq import heappop as tempra
n, m, *ab = list(map(int, open(0).read().split()))
l = [[] for _ in range(m + 1)]
for i, j in zip(*[iter(ab)] * 2):
if i <= m:
l[i].append(-j)
w = []
h = []
for i in range(1, m + 1):
... | false | 4.347826 | [
"- import heapq",
"+ from heapq import heappush as sushi",
"+ from heapq import heappop as tempra",
"- heapq.heappush(l[i], -j)",
"- ans = 0",
"+ l[i].append(-j)",
"+ w = []",
"- heapq.heappush(h, j)",
"+ sushi(h, j)",
"- x = he... | false | 0.059321 | 0.058587 | 1.012527 | [
"s272206067",
"s171805332"
] |
u498487134 | p02804 | python | s873019936 | s272235486 | 271 | 156 | 72,868 | 104,660 | Accepted | Accepted | 42.44 | import sys
input = sys.stdin.readline
N,K=list(map(int,input().split()))
A = list(map(int, input().split()))
A.sort()
def cmb(n, r, mod):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return (fact[n] * factinv[r] * factinv[n-r])%mod
mod=10**9 + 7
fact=[1,1]
factinv=[1,1]
inv=[... | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,K=MI()
A=LI()
A.sort()
#0~Nまで逆元などを事前計算
def cmb(n, r, mod):
if (r < 0)... | 27 | 53 | 591 | 1,078 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
def cmb(n, r, mod):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return (fact[n] * factinv[r] * factinv[n - r]) % mod
mod = 10**9 + 7
fact = [1, 1]
factinv = [1, 1]
inv... | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N, K = MI()
A = LI()
A.sort()
# 0~Nまで逆元などを事前計算
def cmb(n, r, mod):
i... | false | 49.056604 | [
"-N, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-A.sort()",
"-def cmb(n, r, mod):",
"- if (r < 0) or (n < r):",
"- return 0",
"- r = min(r, n - r)",
"- return (fact[n] * factinv[r] * factinv[n - r]) % mod",
"+def I():",
"+ return int(eval(inpu... | false | 0.061263 | 0.061877 | 0.990083 | [
"s873019936",
"s272235486"
] |
u706929073 | p03221 | python | s576216912 | s299884846 | 1,046 | 929 | 62,240 | 52,924 | Accepted | Accepted | 11.19 | (n, m) = list(map(int, input().split()))
cities = []
for _ in range(m):
cities.append(list(map(int, input().split())))
city_dict = {}
for i, city in enumerate(cities):
if not city[0] in city_dict:
city_dict[city[0]] = []
city_dict[city[0]].append([i, city[1], ""])
ans = []
for key, val... | (n, m) = list(map(int, input().split()))
cities = {}
for i in range(m):
(pref, year) = list(map(int, input().split()))
if not pref in list(cities.keys()):
cities[pref] = []
cities[pref].append((i, year))
def get_id(pref, index):
return "{}{}".format(str(pref).zfill(6), str(index).zfi... | 20 | 21 | 561 | 552 | (n, m) = list(map(int, input().split()))
cities = []
for _ in range(m):
cities.append(list(map(int, input().split())))
city_dict = {}
for i, city in enumerate(cities):
if not city[0] in city_dict:
city_dict[city[0]] = []
city_dict[city[0]].append([i, city[1], ""])
ans = []
for key, value in list(cit... | (n, m) = list(map(int, input().split()))
cities = {}
for i in range(m):
(pref, year) = list(map(int, input().split()))
if not pref in list(cities.keys()):
cities[pref] = []
cities[pref].append((i, year))
def get_id(pref, index):
return "{}{}".format(str(pref).zfill(6), str(index).zfill(6))
i... | false | 4.761905 | [
"-cities = []",
"-for _ in range(m):",
"- cities.append(list(map(int, input().split())))",
"-city_dict = {}",
"-for i, city in enumerate(cities):",
"- if not city[0] in city_dict:",
"- city_dict[city[0]] = []",
"- city_dict[city[0]].append([i, city[1], \"\"])",
"-ans = []",
"-for k... | false | 0.045837 | 0.045612 | 1.004921 | [
"s576216912",
"s299884846"
] |
u844646164 | p03479 | python | s006530973 | s584378704 | 172 | 34 | 38,384 | 9,180 | Accepted | Accepted | 80.23 | x, y = list(map(int, input().split()))
ans = 1
while x <= y:
x *= 2
if x > y:
break
ans += 1
print(ans) | X, Y = list(map(int, input().split()))
ans = 1
while X <= Y:
X *= 2
if X > Y:
break
ans += 1
print(ans) | 9 | 9 | 128 | 126 | x, y = list(map(int, input().split()))
ans = 1
while x <= y:
x *= 2
if x > y:
break
ans += 1
print(ans)
| X, Y = list(map(int, input().split()))
ans = 1
while X <= Y:
X *= 2
if X > Y:
break
ans += 1
print(ans)
| false | 0 | [
"-x, y = list(map(int, input().split()))",
"+X, Y = list(map(int, input().split()))",
"-while x <= y:",
"- x *= 2",
"- if x > y:",
"+while X <= Y:",
"+ X *= 2",
"+ if X > Y:"
] | false | 0.038133 | 0.038522 | 0.989888 | [
"s006530973",
"s584378704"
] |
u973840923 | p03252 | python | s174832455 | s570250737 | 61 | 41 | 3,632 | 4,144 | Accepted | Accepted | 32.79 | word1 = eval(input())
word2 = eval(input())
def cnt_element(x):
dict = {}
for i in x:
if i not in dict:
dict[i] = 1
else:
dict[i] += 1
return sorted([x for x in list(dict.values())],reverse=True)
if cnt_element(word1) == cnt_element(word2):
print('... | from collections import Counter
S = eval(input())
T = eval(input())
s = list(Counter(S).values())
t = list(Counter(T).values())
s.sort(reverse=True)
t.sort(reverse=True)
for i,j in zip(s,t):
if i != j:
print('No')
break
else:
print('Yes') | 16 | 16 | 331 | 268 | word1 = eval(input())
word2 = eval(input())
def cnt_element(x):
dict = {}
for i in x:
if i not in dict:
dict[i] = 1
else:
dict[i] += 1
return sorted([x for x in list(dict.values())], reverse=True)
if cnt_element(word1) == cnt_element(word2):
print("Yes")
else:... | from collections import Counter
S = eval(input())
T = eval(input())
s = list(Counter(S).values())
t = list(Counter(T).values())
s.sort(reverse=True)
t.sort(reverse=True)
for i, j in zip(s, t):
if i != j:
print("No")
break
else:
print("Yes")
| false | 0 | [
"-word1 = eval(input())",
"-word2 = eval(input())",
"+from collections import Counter",
"-",
"-def cnt_element(x):",
"- dict = {}",
"- for i in x:",
"- if i not in dict:",
"- dict[i] = 1",
"- else:",
"- dict[i] += 1",
"- return sorted([x for x in li... | false | 0.036365 | 0.036778 | 0.988789 | [
"s174832455",
"s570250737"
] |
u189487046 | p02688 | python | s528496796 | s694606999 | 24 | 22 | 9,184 | 9,112 | Accepted | Accepted | 8.33 | N, K = list(map(int, input().split()))
sunuke = [0]*N
for _ in range(K):
d = int(eval(input()))
A = list(map(int, input().split()))
for a in A:
sunuke[a-1] += 1
ans = 0
for i in range(N):
if sunuke[i-1] == 0:
ans += 1
print(ans)
| import sys
sys.setrecursionlimit(10 ** 6)
def input():
return sys.stdin.readline()[:-1]
N, K = list(map(int, input().split()))
A = [0]*N
for _ in range(K):
d = int(eval(input()))
tmp = list(map(int, input().split()))
for a in tmp:
A[a-1] += 1
print((A.count(0)))
| 13 | 17 | 262 | 294 | N, K = list(map(int, input().split()))
sunuke = [0] * N
for _ in range(K):
d = int(eval(input()))
A = list(map(int, input().split()))
for a in A:
sunuke[a - 1] += 1
ans = 0
for i in range(N):
if sunuke[i - 1] == 0:
ans += 1
print(ans)
| import sys
sys.setrecursionlimit(10**6)
def input():
return sys.stdin.readline()[:-1]
N, K = list(map(int, input().split()))
A = [0] * N
for _ in range(K):
d = int(eval(input()))
tmp = list(map(int, input().split()))
for a in tmp:
A[a - 1] += 1
print((A.count(0)))
| false | 23.529412 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**6)",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"-sunuke = [0] * N",
"+A = [0] * N",
"- A = list(map(int, input().split()))",
"- for a in A:",
"- sunuke[a - 1] += 1",
"-ans = 0",
"-for i in ... | false | 0.037323 | 0.042437 | 0.879508 | [
"s528496796",
"s694606999"
] |
u057109575 | p02901 | python | s807476743 | s269026733 | 304 | 206 | 46,040 | 108,600 | Accepted | Accepted | 32.24 | N, M = list(map(int, input().split()))
AB = []
C = []
for _ in range(M):
AB.append(list(map(int, input().split())))
C.append(list(map(int, input().split())))
INF = 10 ** 9 + 7
dp = [INF] * (2 ** N)
dp[0] = 0
for i, ((a, b), c) in enumerate(zip(AB, C)):
num = int("".join(["01"[int(i + 1 in c)] ... | N, M = list(map(int, input().split()))
X = []
Y = []
for _ in range(M):
X.append(list(map(int, input().split())))
tmp = 0
for i in list(map(int, input().split())):
tmp += 2 ** (i - 1)
Y.append(tmp)
inf = 10 ** 9 + 7
dp = [[inf] * (2 ** N) for _ in range(M + 1)]
dp[0][0] = 0
f... | 17 | 23 | 459 | 605 | N, M = list(map(int, input().split()))
AB = []
C = []
for _ in range(M):
AB.append(list(map(int, input().split())))
C.append(list(map(int, input().split())))
INF = 10**9 + 7
dp = [INF] * (2**N)
dp[0] = 0
for i, ((a, b), c) in enumerate(zip(AB, C)):
num = int("".join(["01"[int(i + 1 in c)] for i in range(N)]... | N, M = list(map(int, input().split()))
X = []
Y = []
for _ in range(M):
X.append(list(map(int, input().split())))
tmp = 0
for i in list(map(int, input().split())):
tmp += 2 ** (i - 1)
Y.append(tmp)
inf = 10**9 + 7
dp = [[inf] * (2**N) for _ in range(M + 1)]
dp[0][0] = 0
for i in range(M):
fo... | false | 26.086957 | [
"-AB = []",
"-C = []",
"+X = []",
"+Y = []",
"- AB.append(list(map(int, input().split())))",
"- C.append(list(map(int, input().split())))",
"-INF = 10**9 + 7",
"-dp = [INF] * (2**N)",
"-dp[0] = 0",
"-for i, ((a, b), c) in enumerate(zip(AB, C)):",
"- num = int(\"\".join([\"01\"[int(i + 1... | false | 0.034336 | 0.044842 | 0.765723 | [
"s807476743",
"s269026733"
] |
u089230684 | p03697 | python | s300174200 | s777603461 | 17 | 10 | 2,940 | 2,568 | Accepted | Accepted | 41.18 | A, B = [int(x) for x in input().split(" ")]
ans = A + B
print(("error" if ans >= 10 else ans)) | l = list(map(int, input().split()))
ans = l[0] + l[1]
if ans >= 10:
print("error")
else:
print(ans)
| 5 | 10 | 98 | 124 | A, B = [int(x) for x in input().split(" ")]
ans = A + B
print(("error" if ans >= 10 else ans))
| l = list(map(int, input().split()))
ans = l[0] + l[1]
if ans >= 10:
print("error")
else:
print(ans)
| false | 50 | [
"-A, B = [int(x) for x in input().split(\" \")]",
"-ans = A + B",
"-print((\"error\" if ans >= 10 else ans))",
"+l = list(map(int, input().split()))",
"+ans = l[0] + l[1]",
"+if ans >= 10:",
"+ print(\"error\")",
"+else:",
"+ print(ans)"
] | false | 0.036582 | 0.056168 | 0.651285 | [
"s300174200",
"s777603461"
] |
u506689504 | p02689 | python | s770281959 | s231144364 | 431 | 211 | 31,612 | 25,956 | Accepted | Accepted | 51.04 | N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
adj = {i:[] for i in range(N)}
for _ in range(M):
A, B = list(map(int, input().split()))
adj[A-1].append(H[B-1])
adj[B-1].append(H[A-1])
cnt = 0
for v in range(N):
if not adj[v]:
cnt += 1
continue
if H[v] > max(adj[v]):
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
H = [0] + list(map(int, readline().split()))
A = [0]*(N+1)
m = list(map(int, read().split()))
for a,b in zip(m,m):
for _ in range(2):
A[a] = ma... | 18 | 17 | 333 | 374 | N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
adj = {i: [] for i in range(N)}
for _ in range(M):
A, B = list(map(int, input().split()))
adj[A - 1].append(H[B - 1])
adj[B - 1].append(H[A - 1])
cnt = 0
for v in range(N):
if not adj[v]:
cnt += 1
continue
if ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = list(map(int, readline().split()))
H = [0] + list(map(int, readline().split()))
A = [0] * (N + 1)
m = list(map(int, read().split()))
for a, b in zip(m, m):
for _ in range(2):
A[a] = ma... | false | 5.555556 | [
"-N, M = list(map(int, input().split()))",
"-H = list(map(int, input().split()))",
"-adj = {i: [] for i in range(N)}",
"-for _ in range(M):",
"- A, B = list(map(int, input().split()))",
"- adj[A - 1].append(H[B - 1])",
"- adj[B - 1].append(H[A - 1])",
"-cnt = 0",
"-for v in range(N):",
"-... | false | 0.061097 | 0.08629 | 0.70804 | [
"s770281959",
"s231144364"
] |
u634079249 | p03206 | python | s843991979 | s734469601 | 19 | 17 | 2,940 | 3,064 | Accepted | Accepted | 10.53 | import sys
import os
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
D = int(sys.stdin.readline().rstrip())
print(('Christmas' + ' Eve'*(25-D)))
if __name__ == '__main__':
main()
| import sys
import os
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.... | 15 | 23 | 243 | 703 | import sys
import os
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
D = int(sys.stdin.readline().rstrip())
print(("Christmas" + " Eve" * (25 - D)))
if __name__ == "__main__":
main()
| import sys
import os
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.re... | false | 34.782609 | [
"+",
"+ii = lambda: int(sys.stdin.buffer.readline().rstrip())",
"+il = lambda: list(map(int, sys.stdin.buffer.readline().split()))",
"+fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))",
"+iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]",
"+iss = lambda: sys.... | false | 0.04141 | 0.043698 | 0.94763 | [
"s843991979",
"s734469601"
] |
u442030035 | p03319 | python | s440563106 | s126308746 | 25 | 18 | 10,420 | 4,724 | Accepted | Accepted | 28 | N, K = list(map(int, input().split()))
A = input().split()
count = 0
if N == K:
print((1))
else:
count += 1
rem = N-K
add = 1 if (N-K)%(K-1) else 0
count += (N-K)//(K-1) + add
print(count) | N, K = list(map(int, input().split()))
A = eval(input())
add = 1 if (N-1)%(K-1) else 0
print(((N-1)//(K-1) + add)) | 11 | 4 | 214 | 103 | N, K = list(map(int, input().split()))
A = input().split()
count = 0
if N == K:
print((1))
else:
count += 1
rem = N - K
add = 1 if (N - K) % (K - 1) else 0
count += (N - K) // (K - 1) + add
print(count)
| N, K = list(map(int, input().split()))
A = eval(input())
add = 1 if (N - 1) % (K - 1) else 0
print(((N - 1) // (K - 1) + add))
| false | 63.636364 | [
"-A = input().split()",
"-count = 0",
"-if N == K:",
"- print((1))",
"-else:",
"- count += 1",
"- rem = N - K",
"- add = 1 if (N - K) % (K - 1) else 0",
"- count += (N - K) // (K - 1) + add",
"- print(count)",
"+A = eval(input())",
"+add = 1 if (N - 1) % (K - 1) else 0",
"+... | false | 0.041572 | 0.035155 | 1.182526 | [
"s440563106",
"s126308746"
] |
u058781705 | p03294 | python | s664971334 | s989145607 | 322 | 62 | 79,916 | 64,808 | Accepted | Accepted | 80.75 | N = int(eval(input()))
As = list(map(int, input().split()))
print((sum(As)-len(As)))
| _ = eval(input())
As = list(map(int, input().split()))
print((sum(As)-len(As)))
| 4 | 4 | 81 | 76 | N = int(eval(input()))
As = list(map(int, input().split()))
print((sum(As) - len(As)))
| _ = eval(input())
As = list(map(int, input().split()))
print((sum(As) - len(As)))
| false | 0 | [
"-N = int(eval(input()))",
"+_ = eval(input())"
] | false | 0.040177 | 0.030991 | 1.296432 | [
"s664971334",
"s989145607"
] |
u129978636 | p03835 | python | s691437392 | s059091006 | 1,268 | 1,035 | 3,060 | 2,940 | Accepted | Accepted | 18.38 | k,s=list(map(int,input().split()))
count=0
for x in range(k+1):
for y in range(k+1):
if(0<=s-x-y<=k):
count+=1
else:continue
print(count) | k,s=list(map(int,input().split()))
print((sum(0<=s-x-y<=k for x in range(k+1) for y in range(k+1)))) | 8 | 2 | 170 | 93 | k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
for y in range(k + 1):
if 0 <= s - x - y <= k:
count += 1
else:
continue
print(count)
| k, s = list(map(int, input().split()))
print((sum(0 <= s - x - y <= k for x in range(k + 1) for y in range(k + 1))))
| false | 75 | [
"-count = 0",
"-for x in range(k + 1):",
"- for y in range(k + 1):",
"- if 0 <= s - x - y <= k:",
"- count += 1",
"- else:",
"- continue",
"-print(count)",
"+print((sum(0 <= s - x - y <= k for x in range(k + 1) for y in range(k + 1))))"
] | false | 0.036253 | 0.042133 | 0.860444 | [
"s691437392",
"s059091006"
] |
u875291233 | p03356 | python | s902200590 | s652495923 | 800 | 710 | 13,812 | 15,860 | Accepted | Accepted | 11.25 | class UnionFind:
def __init__(self, size):
self.parent = [-1 for i in range(size)]#非負なら親ノード,負ならグループの要素数
def root(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.root(self.parent[x]) #xをxの根に直接つなぐ
return self.parent[x]
... | class UnionFind:
def __init__(self, size):
self.parent = [-1 for i in range(size)]#非負なら親ノード,負ならグループの要素数
def root(self, x): #root(i): $i$の根ノードを返す.
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.root(self.parent[x]) #xをxの根に直接つなぐ
re... | 42 | 47 | 1,005 | 1,416 | class UnionFind:
def __init__(self, size):
self.parent = [-1 for i in range(size)] # 非負なら親ノード,負ならグループの要素数
def root(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.root(self.parent[x]) # xをxの根に直接つなぐ
return self.parent[x]
de... | class UnionFind:
def __init__(self, size):
self.parent = [-1 for i in range(size)] # 非負なら親ノード,負ならグループの要素数
def root(self, x): # root(i): $i$の根ノードを返す.
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.root(self.parent[x]) # xをxの根に直接つなぐ
retu... | false | 10.638298 | [
"- def root(self, x):",
"+ def root(self, x): # root(i): $i$の根ノードを返す.",
"- def union(self, x, y):",
"+ def union(self, x, y): # union(i,j): $i$のいるグループと$j$のいるグループをまとめる",
"- if self.parent[x] < self.parent[y]: # xの要素数がyの要素数より「小さい」とき",
"+ if self.parent[x] > self.parent[y]: # xの... | false | 0.041712 | 0.044045 | 0.947034 | [
"s902200590",
"s652495923"
] |
u327466606 | p02599 | python | s796375074 | s878364374 | 1,845 | 1,547 | 202,988 | 242,264 | Accepted | Accepted | 16.15 | class BinaryIndexedTree:
def __init__(self, size):
self.data = [0] * (size+1)
self.size = size+1
self.msb = 1 << (size.bit_length()-1)
def _add(self, i, w):
i += 1
while i < self.size:
self.data[i] += w
i += i & -i
def _ge... | class BinaryIndexedTree:
def __init__(self, size):
self.data = [0] * (size+1)
self.size = size+1
self.msb = 1 << (size.bit_length()-1)
def _add(self, i, w):
i += 1
while i < self.size:
self.data[i] += w
i += i & -i
def _ge... | 119 | 120 | 2,858 | 2,862 | class BinaryIndexedTree:
def __init__(self, size):
self.data = [0] * (size + 1)
self.size = size + 1
self.msb = 1 << (size.bit_length() - 1)
def _add(self, i, w):
i += 1
while i < self.size:
self.data[i] += w
i += i & -i
def _get_sum(self, i)... | class BinaryIndexedTree:
def __init__(self, size):
self.data = [0] * (size + 1)
self.size = size + 1
self.msb = 1 << (size.bit_length() - 1)
def _add(self, i, w):
i += 1
while i < self.size:
self.data[i] += w
i += i & -i
def _get_sum(self, i)... | false | 0.833333 | [
"- for j, c in enumerate(C[pr:r], start=pr):",
"+ for j in range(pr, r):",
"+ c = C[j]"
] | false | 0.050267 | 0.107034 | 0.469636 | [
"s796375074",
"s878364374"
] |
u708255304 | p02983 | python | s010718900 | s361126752 | 1,093 | 788 | 3,060 | 2,940 | Accepted | Accepted | 27.9 | L, R = list(map(int, input().split()))
if R-L >= 2019:
print((0))
exit()
flag = True
ans = 2020
for i in range(L, L+2018):
if flag:
for j in range(i+1, R+1):
if i > R:
flag = False
break
ans = min(((i % 2019) * (j % 2019)) % 2... | L, R = list(map(int, input().split()))
ans = 2019
for i in range(L, min(R+1, L+2019)):
for j in range(i+1, min(R+1, L+2019)):
ans = min(ans, (i*j)%2019)
print(ans)
| 18 | 6 | 336 | 175 | L, R = list(map(int, input().split()))
if R - L >= 2019:
print((0))
exit()
flag = True
ans = 2020
for i in range(L, L + 2018):
if flag:
for j in range(i + 1, R + 1):
if i > R:
flag = False
break
ans = min(((i % 2019) * (j % 2019)) % 2019, ans)
... | L, R = list(map(int, input().split()))
ans = 2019
for i in range(L, min(R + 1, L + 2019)):
for j in range(i + 1, min(R + 1, L + 2019)):
ans = min(ans, (i * j) % 2019)
print(ans)
| false | 66.666667 | [
"-if R - L >= 2019:",
"- print((0))",
"- exit()",
"-flag = True",
"-ans = 2020",
"-for i in range(L, L + 2018):",
"- if flag:",
"- for j in range(i + 1, R + 1):",
"- if i > R:",
"- flag = False",
"- break",
"- ans = min(((i % ... | false | 0.058505 | 0.098726 | 0.592602 | [
"s010718900",
"s361126752"
] |
u600402037 | p03137 | python | s187764886 | s982717059 | 258 | 187 | 22,920 | 23,076 | Accepted | Accepted | 27.52 | import numpy as np
N, M = list(map(int, input().split()))
X = np.array(sorted(map(int, input().split())))
distances = sorted(X[1:] - X[:-1], reverse=True)
print((sum(distances[N-1:]))) | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
X = np.array(lr())
X.sort()
if N >= M:
print((0)); exit()
Xdiff = np.abs(np.diff(X))
Xdiff.sort()
need = M - N
answer = Xdiff[:nee... | 7 | 19 | 184 | 342 | import numpy as np
N, M = list(map(int, input().split()))
X = np.array(sorted(map(int, input().split())))
distances = sorted(X[1:] - X[:-1], reverse=True)
print((sum(distances[N - 1 :])))
| # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
X = np.array(lr())
X.sort()
if N >= M:
print((0))
exit()
Xdiff = np.abs(np.diff(X))
Xdiff.sort()
need = M - N
answer = Xdiff[:need].sum()
print(a... | false | 63.157895 | [
"+# coding: utf-8",
"+import sys",
"-N, M = list(map(int, input().split()))",
"-X = np.array(sorted(map(int, input().split())))",
"-distances = sorted(X[1:] - X[:-1], reverse=True)",
"-print((sum(distances[N - 1 :])))",
"+sr = lambda: sys.stdin.readline().rstrip()",
"+ir = lambda: int(sr())",
"+lr =... | false | 0.24323 | 0.764945 | 0.31797 | [
"s187764886",
"s982717059"
] |
u223663729 | p03835 | python | s271578045 | s947780858 | 1,623 | 785 | 2,940 | 9,164 | Accepted | Accepted | 51.63 | K, S = list(map(int, input().split()))
cnt = 0
for x in range(K+1):
for y in range(K+1):
z = S-x-y
if 0 <= z and z <= K:
cnt+=1
print(cnt) | K, S = list(map(int, input().split()))
ans = sum(0 <= S-x-y <= K for x in range(K+1) for y in range(K+1))
print(ans) | 10 | 3 | 159 | 112 | K, S = list(map(int, input().split()))
cnt = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if 0 <= z and z <= K:
cnt += 1
print(cnt)
| K, S = list(map(int, input().split()))
ans = sum(0 <= S - x - y <= K for x in range(K + 1) for y in range(K + 1))
print(ans)
| false | 70 | [
"-cnt = 0",
"-for x in range(K + 1):",
"- for y in range(K + 1):",
"- z = S - x - y",
"- if 0 <= z and z <= K:",
"- cnt += 1",
"-print(cnt)",
"+ans = sum(0 <= S - x - y <= K for x in range(K + 1) for y in range(K + 1))",
"+print(ans)"
] | false | 0.079797 | 0.035919 | 2.2216 | [
"s271578045",
"s947780858"
] |
u246401133 | p02657 | python | s529501348 | s845477885 | 34 | 30 | 9,088 | 9,140 | Accepted | Accepted | 11.76 | a, b = list(map(int, input().split()))
print((int(a*b))) | a, b = list(map(int, input().split()))
print((a * b)) | 2 | 2 | 49 | 46 | a, b = list(map(int, input().split()))
print((int(a * b)))
| a, b = list(map(int, input().split()))
print((a * b))
| false | 0 | [
"-print((int(a * b)))",
"+print((a * b))"
] | false | 0.036823 | 0.03517 | 1.04701 | [
"s529501348",
"s845477885"
] |
u852690916 | p02996 | python | s448046521 | s277030760 | 900 | 419 | 53,732 | 31,964 | Accepted | Accepted | 53.44 | from operator import itemgetter
N=int(eval(input()))
tasks=[list(map(int,input().split())) for _ in range(N)]
tasks.sort(key=itemgetter(1))
t=0
for w,l in tasks:
if t+w>l:
print('No')
exit()
t+=w
print('Yes') | import sys
def main():
input = sys.stdin.readline
N=int(eval(input()))
tasks=[tuple(map(int, input().split())) for _ in range(N)]
from operator import itemgetter
tasks.sort(key=itemgetter(1))
t=0
for task in tasks:
t += task[0]
if t > task[1]:
print('... | 11 | 18 | 236 | 398 | from operator import itemgetter
N = int(eval(input()))
tasks = [list(map(int, input().split())) for _ in range(N)]
tasks.sort(key=itemgetter(1))
t = 0
for w, l in tasks:
if t + w > l:
print("No")
exit()
t += w
print("Yes")
| import sys
def main():
input = sys.stdin.readline
N = int(eval(input()))
tasks = [tuple(map(int, input().split())) for _ in range(N)]
from operator import itemgetter
tasks.sort(key=itemgetter(1))
t = 0
for task in tasks:
t += task[0]
if t > task[1]:
print("No")... | false | 38.888889 | [
"-from operator import itemgetter",
"+import sys",
"-N = int(eval(input()))",
"-tasks = [list(map(int, input().split())) for _ in range(N)]",
"-tasks.sort(key=itemgetter(1))",
"-t = 0",
"-for w, l in tasks:",
"- if t + w > l:",
"- print(\"No\")",
"- exit()",
"- t += w",
"-p... | false | 0.046231 | 0.046175 | 1.001223 | [
"s448046521",
"s277030760"
] |
u107091170 | p03329 | python | s047016930 | s051256819 | 681 | 245 | 4,596 | 5,580 | Accepted | Accepted | 64.02 | # 配るDP
N=int(eval(input()))
dp = [100000] * 200005;
g = [1]
a = 6
while a <= 100000:
g.append(a)
a *= 6
a = 9
while a <= 100000:
g.append(a)
a *= 9
g.sort(reverse=True)
dp[0] = 0
for i in range(N):
for j in g:
dp[i+j] = min( dp[i+j], dp[i]+1 )
print((dp[N]))
| # BFS
from collections import deque
N=int(eval(input()))
dp = [-1] * 200005;
q = deque()
g = [1]
a = 6
while a <= 100000:
g.append(a)
a *= 6
a = 9
while a <= 100000:
g.append(a)
a *= 9
g.sort(reverse=True)
dp[0] = 0
q.append(0)
while len(q) > 0:
v = q.popleft()
if v == N: break
... | 24 | 32 | 294 | 447 | # 配るDP
N = int(eval(input()))
dp = [100000] * 200005
g = [1]
a = 6
while a <= 100000:
g.append(a)
a *= 6
a = 9
while a <= 100000:
g.append(a)
a *= 9
g.sort(reverse=True)
dp[0] = 0
for i in range(N):
for j in g:
dp[i + j] = min(dp[i + j], dp[i] + 1)
print((dp[N]))
| # BFS
from collections import deque
N = int(eval(input()))
dp = [-1] * 200005
q = deque()
g = [1]
a = 6
while a <= 100000:
g.append(a)
a *= 6
a = 9
while a <= 100000:
g.append(a)
a *= 9
g.sort(reverse=True)
dp[0] = 0
q.append(0)
while len(q) > 0:
v = q.popleft()
if v == N:
break
for... | false | 25 | [
"-# 配るDP",
"+# BFS",
"+from collections import deque",
"+",
"-dp = [100000] * 200005",
"+dp = [-1] * 200005",
"+q = deque()",
"-for i in range(N):",
"+q.append(0)",
"+while len(q) > 0:",
"+ v = q.popleft()",
"+ if v == N:",
"+ break",
"- dp[i + j] = min(dp[i + j], dp[i]... | false | 0.099033 | 0.062454 | 1.585712 | [
"s047016930",
"s051256819"
] |
u437351386 | p03682 | python | s598112874 | s300958619 | 1,529 | 1,189 | 175,416 | 143,824 | Accepted | Accepted | 22.24 | n=int(eval(input()))
town=[]
for i in range(n):
x,y=list(map(int,input().split()))
town.append([x,y,i])
X=sorted(town,key=lambda x:x[0])
Y=sorted(town,key=lambda x:x[1])
es=[]
for i in range(1,n):
es.append((min(abs(X[i][0]-X[i-1][0]),abs(X[i][1]-X[i-1][1])),X[i][2],X[i-1][2]))
es.append((min(... | n=int(eval(input()))
town=[]
for i in range(n):
x,y=list(map(int,input().split()))
town.append([x,y,i])
X=sorted(town,key=lambda x:x[0])
Y=sorted(town,key=lambda x:x[1])
es=[]
for i in range(1,n):
es.append((min(abs(X[i][0]-X[i-1][0]),abs(X[i][1]-X[i-1][1])),X[i][2],X[i-1][2]))
#es.append((min... | 69 | 69 | 1,359 | 1,361 | n = int(eval(input()))
town = []
for i in range(n):
x, y = list(map(int, input().split()))
town.append([x, y, i])
X = sorted(town, key=lambda x: x[0])
Y = sorted(town, key=lambda x: x[1])
es = []
for i in range(1, n):
es.append(
(
min(abs(X[i][0] - X[i - 1][0]), abs(X[i][1] - X[i - 1][1]... | n = int(eval(input()))
town = []
for i in range(n):
x, y = list(map(int, input().split()))
town.append([x, y, i])
X = sorted(town, key=lambda x: x[0])
Y = sorted(town, key=lambda x: x[1])
es = []
for i in range(1, n):
es.append(
(
min(abs(X[i][0] - X[i - 1][0]), abs(X[i][1] - X[i - 1][1]... | false | 0 | [
"- es.append(",
"- (",
"- min(abs(X[i][0] - X[i - 1][0]), abs(X[i][1] - X[i - 1][1])),",
"- X[i - 1][2],",
"- X[i][2],",
"- )",
"- )",
"+ # es.append((min(abs(X[i][0]-X[i-1][0]),abs(X[i][1]-X[i-1][1])),X[i-1][2],X[i][2]))",
"- es.append(",
... | false | 0.032533 | 0.044941 | 0.723897 | [
"s598112874",
"s300958619"
] |
u671060652 | p02660 | python | s687253711 | s653359600 | 346 | 123 | 77,512 | 72,796 | Accepted | Accepted | 64.45 | import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal
n = int(eval(input()))
prime = {}
num = n
i = 2
while True:
if i * i > n:
if(num > 1):
prime[num] = 1
brea... | import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal
n = int(eval(input()))
def how_many_prime(n):
prime = {}
num = n
i = 2
while True:
if i * i > n:
if(num... | 34 | 38 | 597 | 720 | import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal
n = int(eval(input()))
prime = {}
num = n
i = 2
while True:
if i * i > n:
if num > 1:
prime[num] = 1
break
while num % i ... | import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal
n = int(eval(input()))
def how_many_prime(n):
prime = {}
num = n
i = 2
while True:
if i * i > n:
if num > 1:
... | false | 10.526316 | [
"-prime = {}",
"-num = n",
"-i = 2",
"-while True:",
"- if i * i > n:",
"- if num > 1:",
"- prime[num] = 1",
"- break",
"- while num % i == 0:",
"- prime[i] = prime.get(i, 0) + 1",
"- num = num // i",
"- i += 1",
"+",
"+",
"+def how_many_pr... | false | 0.299437 | 0.260469 | 1.149606 | [
"s687253711",
"s653359600"
] |
u761320129 | p03222 | python | s155096679 | s689666073 | 42 | 36 | 3,064 | 3,064 | Accepted | Accepted | 14.29 | H,W,K = list(map(int,input().split()))
K -= 1
MOD = 10**9+7
dp = [[0]*W for i in range(H+1)]
dp[0][0] = 1
for i in range(H):
for b in range(2**(W-1)):
if '11' in bin(b): continue
b *= 2
for j in range(W):
if b&(1<<j):
dp[i+1][j-1] += dp[i][j]
... | H,W,K = list(map(int,input().split()))
MOD = 10**9+7
if W == 1:
print((1))
exit()
dp = [[0]*W for i in range(H+1)]
dp[0][0] = 1
for i in range(H):
for b in range(2**(W-1)):
if '11' in bin(b): continue
b *= 2
for j in range(W):
if b&(1<<j):
... | 22 | 21 | 568 | 496 | H, W, K = list(map(int, input().split()))
K -= 1
MOD = 10**9 + 7
dp = [[0] * W for i in range(H + 1)]
dp[0][0] = 1
for i in range(H):
for b in range(2 ** (W - 1)):
if "11" in bin(b):
continue
b *= 2
for j in range(W):
if b & (1 << j):
dp[i + 1][j - 1] ... | H, W, K = list(map(int, input().split()))
MOD = 10**9 + 7
if W == 1:
print((1))
exit()
dp = [[0] * W for i in range(H + 1)]
dp[0][0] = 1
for i in range(H):
for b in range(2 ** (W - 1)):
if "11" in bin(b):
continue
b *= 2
for j in range(W):
if b & (1 << j):
... | false | 4.545455 | [
"-K -= 1",
"+if W == 1:",
"+ print((1))",
"+ exit()",
"- dp[i + 1][j - 1] %= MOD",
"- dp[i + 1][j + 1] %= MOD",
"- dp[i + 1][j] %= MOD",
"-print((dp[-1][K]))",
"+print((dp[-1][K - 1] % MOD))"
] | false | 0.040488 | 0.040465 | 1.000589 | [
"s155096679",
"s689666073"
] |
u945065638 | p02571 | python | s622342298 | s691263987 | 66 | 59 | 9,052 | 8,904 | Accepted | Accepted | 10.61 | S =eval(input())
T =eval(input())
mint=10000
for i in range(len(S)-len(T)+1):
con = 0
for j in range(len(T)):
if S[i+j] != T[j]:
con += 1
mint =min(con,mint)
if mint == 0:
break
print(mint)
| s = eval(input())
t = eval(input())
mini =10000000
for i in range(len(s)-len(t)+1):
count = 0
for z in range(len(t)):
if s[i+z] != t[z]:
count += 1
if count < mini :
mini = count
print(mini) | 17 | 14 | 259 | 251 | S = eval(input())
T = eval(input())
mint = 10000
for i in range(len(S) - len(T) + 1):
con = 0
for j in range(len(T)):
if S[i + j] != T[j]:
con += 1
mint = min(con, mint)
if mint == 0:
break
print(mint)
| s = eval(input())
t = eval(input())
mini = 10000000
for i in range(len(s) - len(t) + 1):
count = 0
for z in range(len(t)):
if s[i + z] != t[z]:
count += 1
if count < mini:
mini = count
print(mini)
| false | 17.647059 | [
"-S = eval(input())",
"-T = eval(input())",
"-mint = 10000",
"-for i in range(len(S) - len(T) + 1):",
"- con = 0",
"- for j in range(len(T)):",
"- if S[i + j] != T[j]:",
"- con += 1",
"- mint = min(con, mint)",
"- if mint == 0:",
"- break",
"-print(mint)",
... | false | 0.044369 | 0.045637 | 0.972232 | [
"s622342298",
"s691263987"
] |
u498487134 | p02792 | python | s941671908 | s709799526 | 271 | 225 | 42,348 | 40,428 | Accepted | Accepted | 16.97 | S=eval(input())
N=int(S)
n=len(S)
ans=0
p=[1,10,100,1000,10000,100000]
for i in range(N+1):#数iに対する相手を探す
ii=str(i)
a=int(ii[0])
b=int(ii[-1])
if a*b!=0:
if a==b:#a**aの形なら1桁の答えaが存在
ans+=1
for j in range(2,n+1):#桁数
if j<n:
ans+=p[j... | S=eval(input())
TT=[[0]*10 for _ in range(10)]
N=int(S)
for i in range(1,N+1):
ii=str(i)
a=int(ii[0])
b=int(ii[-1])
TT[a][b]+=1
ans=0
for i in range(10):
for j in range(10):
ans+=TT[i][j]*TT[j][i]
print(ans) | 37 | 16 | 929 | 259 | S = eval(input())
N = int(S)
n = len(S)
ans = 0
p = [1, 10, 100, 1000, 10000, 100000]
for i in range(N + 1): # 数iに対する相手を探す
ii = str(i)
a = int(ii[0])
b = int(ii[-1])
if a * b != 0:
if a == b: # a**aの形なら1桁の答えaが存在
ans += 1
for j in range(2, n + 1): # 桁数
if j < n:... | S = eval(input())
TT = [[0] * 10 for _ in range(10)]
N = int(S)
for i in range(1, N + 1):
ii = str(i)
a = int(ii[0])
b = int(ii[-1])
TT[a][b] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += TT[i][j] * TT[j][i]
print(ans)
| false | 56.756757 | [
"+TT = [[0] * 10 for _ in range(10)]",
"-n = len(S)",
"-ans = 0",
"-p = [1, 10, 100, 1000, 10000, 100000]",
"-for i in range(N + 1): # 数iに対する相手を探す",
"+for i in range(1, N + 1):",
"- if a * b != 0:",
"- if a == b: # a**aの形なら1桁の答えaが存在",
"- ans += 1",
"- for j in range(2... | false | 0.037234 | 0.073111 | 0.509286 | [
"s941671908",
"s709799526"
] |
u562935282 | p03075 | python | s877047542 | s022196422 | 24 | 17 | 3,316 | 2,940 | Accepted | Accepted | 29.17 | e = [int(eval(input())) for _ in range(5)]
k = int(eval(input()))
bl = True
for ee1 in e:
for ee2 in e:
if abs(ee1 - ee2) > k:
bl = False
break
if not bl:
break
print(('Yay!' if bl else ':('))
| v = [int(eval(input())) for _ in range(5)]
k = int(eval(input()))
bl = max(v) - min(v) <= k
print(('Yay!' if bl else ':('))
| 12 | 5 | 239 | 115 | e = [int(eval(input())) for _ in range(5)]
k = int(eval(input()))
bl = True
for ee1 in e:
for ee2 in e:
if abs(ee1 - ee2) > k:
bl = False
break
if not bl:
break
print(("Yay!" if bl else ":("))
| v = [int(eval(input())) for _ in range(5)]
k = int(eval(input()))
bl = max(v) - min(v) <= k
print(("Yay!" if bl else ":("))
| false | 58.333333 | [
"-e = [int(eval(input())) for _ in range(5)]",
"+v = [int(eval(input())) for _ in range(5)]",
"-bl = True",
"-for ee1 in e:",
"- for ee2 in e:",
"- if abs(ee1 - ee2) > k:",
"- bl = False",
"- break",
"- if not bl:",
"- break",
"+bl = max(v) - min(v) <= k... | false | 0.037233 | 0.037413 | 0.995172 | [
"s877047542",
"s022196422"
] |
u980205854 | p02659 | python | s206653168 | s634543308 | 23 | 21 | 9,156 | 9,164 | Accepted | Accepted | 8.7 | A,B = input().split()
A = int(A)
B = int(float(B)*100+1.0e-10)
print((int((A*B)//100)))
| # C - Multiplication 3
A,B = input().split()
A = int(A)
B = int(100*float(B)+0.001)
print(((A*B)//100)) | 5 | 5 | 91 | 105 | A, B = input().split()
A = int(A)
B = int(float(B) * 100 + 1.0e-10)
print((int((A * B) // 100)))
| # C - Multiplication 3
A, B = input().split()
A = int(A)
B = int(100 * float(B) + 0.001)
print(((A * B) // 100))
| false | 0 | [
"+# C - Multiplication 3",
"-B = int(float(B) * 100 + 1.0e-10)",
"-print((int((A * B) // 100)))",
"+B = int(100 * float(B) + 0.001)",
"+print(((A * B) // 100))"
] | false | 0.072745 | 0.101327 | 0.717922 | [
"s206653168",
"s634543308"
] |
u928051788 | p02389 | python | s608922197 | s458055594 | 30 | 20 | 7,640 | 7,652 | Accepted | Accepted | 33.33 | x = input().split()
a = int(x[0])*int(x[1])
b = 2*(int(x[1])+int(x[0]))
print((a,b)) | s = input().rstrip().split(' ')
s1=int(s[0])
s2=int(s[1])
print((s1*s2, 2*s1+2*s2)) | 5 | 4 | 87 | 84 | x = input().split()
a = int(x[0]) * int(x[1])
b = 2 * (int(x[1]) + int(x[0]))
print((a, b))
| s = input().rstrip().split(" ")
s1 = int(s[0])
s2 = int(s[1])
print((s1 * s2, 2 * s1 + 2 * s2))
| false | 20 | [
"-x = input().split()",
"-a = int(x[0]) * int(x[1])",
"-b = 2 * (int(x[1]) + int(x[0]))",
"-print((a, b))",
"+s = input().rstrip().split(\" \")",
"+s1 = int(s[0])",
"+s2 = int(s[1])",
"+print((s1 * s2, 2 * s1 + 2 * s2))"
] | false | 0.048509 | 0.066486 | 0.729615 | [
"s608922197",
"s458055594"
] |
u312025627 | p03775 | python | s549681208 | s083575057 | 179 | 67 | 39,664 | 64,620 | Accepted | Accepted | 62.57 | def main():
N = int(eval(input()))
def trial_division(n):
divs = []
for i in range(1, int(n**0.5)+1):
if n % i == 0 and i != n//i:
divs.append((i, n//i))
elif n % i == 0 and i == n//i:
divs.append((i, i))
return divs
... | def main():
N = int(eval(input()))
def enum_divisors(n):
ans = 10**12
for i in range(1, n+1):
if i*i > n:
break
if n % i == 0:
v1 = str(i)
v2 = str(n//i)
ans = min(ans, max(len(v1), len(v2)))
... | 20 | 19 | 496 | 405 | def main():
N = int(eval(input()))
def trial_division(n):
divs = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0 and i != n // i:
divs.append((i, n // i))
elif n % i == 0 and i == n // i:
divs.append((i, i))
return divs
a... | def main():
N = int(eval(input()))
def enum_divisors(n):
ans = 10**12
for i in range(1, n + 1):
if i * i > n:
break
if n % i == 0:
v1 = str(i)
v2 = str(n // i)
ans = min(ans, max(len(v1), len(v2)))
r... | false | 5 | [
"- def trial_division(n):",
"- divs = []",
"- for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0 and i != n // i:",
"- divs.append((i, n // i))",
"- elif n % i == 0 and i == n // i:",
"- divs.append((i, i))",
"- return div... | false | 0.042475 | 0.079299 | 0.535633 | [
"s549681208",
"s083575057"
] |
u644972721 | p03037 | python | s853943285 | s997087994 | 278 | 231 | 3,060 | 12,732 | Accepted | Accepted | 16.91 | n , m = list(map(int,input().split()))
a , b = 1 , 100000
for i in range(m):
l , r = list(map(int,input().split()))
if a <= l:
a = l
if b >= r:
b = r
c = b - a + 1
if c > 0:
print(c)
else:
print((0)) | n, m = list(map(int, input().split()))
ok = [0] * (n + 2)
ans = 0
for _ in range(m):
l, r = list(map(int, input().split()))
ok[l] += 1
ok[r + 1] -= 1
for i in range(1, n + 2):
ok[i] += ok[i - 1]
if ok[i] == m:
ans += 1
print(ans) | 15 | 12 | 245 | 256 | n, m = list(map(int, input().split()))
a, b = 1, 100000
for i in range(m):
l, r = list(map(int, input().split()))
if a <= l:
a = l
if b >= r:
b = r
c = b - a + 1
if c > 0:
print(c)
else:
print((0))
| n, m = list(map(int, input().split()))
ok = [0] * (n + 2)
ans = 0
for _ in range(m):
l, r = list(map(int, input().split()))
ok[l] += 1
ok[r + 1] -= 1
for i in range(1, n + 2):
ok[i] += ok[i - 1]
if ok[i] == m:
ans += 1
print(ans)
| false | 20 | [
"-a, b = 1, 100000",
"-for i in range(m):",
"+ok = [0] * (n + 2)",
"+ans = 0",
"+for _ in range(m):",
"- if a <= l:",
"- a = l",
"- if b >= r:",
"- b = r",
"-c = b - a + 1",
"-if c > 0:",
"- print(c)",
"-else:",
"- print((0))",
"+ ok[l] += 1",
"+ ok[r + ... | false | 0.037227 | 0.043497 | 0.855841 | [
"s853943285",
"s997087994"
] |
u905203728 | p03221 | python | s256176394 | s136742325 | 816 | 602 | 47,200 | 125,368 | Accepted | Accepted | 26.23 | n,m=list(map(int,input().split()))
A=[[i,list(map(int,input().split()))] for i in range(m)]
A.sort(key=lambda x:x[1][1])
B={}
for x,y in A:
if y[0] not in B:
B[y[0]]=1
y[1]=1
else:
B[y[0]] +=1
y[1]=B[y[0]]
for i in sorted(A,key=lambda x:x[0]):
print((str(i[1][0]... | n,m=list(map(int,input().split()))
PY=sorted([list(map(int,input().split()))+[_] for _ in range(m)],key=lambda x:x[1])
A,B={},[]
for p,y,num in PY:
if p not in A:
A[p]=1
B.append([p,A[p],num])
else:
A[p] +=1
B.append([p,A[p],num])
for a,b,c in sorted(B,key=lambda x:... | 14 | 14 | 346 | 364 | n, m = list(map(int, input().split()))
A = [[i, list(map(int, input().split()))] for i in range(m)]
A.sort(key=lambda x: x[1][1])
B = {}
for x, y in A:
if y[0] not in B:
B[y[0]] = 1
y[1] = 1
else:
B[y[0]] += 1
y[1] = B[y[0]]
for i in sorted(A, key=lambda x: x[0]):
print((str(... | n, m = list(map(int, input().split()))
PY = sorted(
[list(map(int, input().split())) + [_] for _ in range(m)], key=lambda x: x[1]
)
A, B = {}, []
for p, y, num in PY:
if p not in A:
A[p] = 1
B.append([p, A[p], num])
else:
A[p] += 1
B.append([p, A[p], num])
for a, b, c in sort... | false | 0 | [
"-A = [[i, list(map(int, input().split()))] for i in range(m)]",
"-A.sort(key=lambda x: x[1][1])",
"-B = {}",
"-for x, y in A:",
"- if y[0] not in B:",
"- B[y[0]] = 1",
"- y[1] = 1",
"+PY = sorted(",
"+ [list(map(int, input().split())) + [_] for _ in range(m)], key=lambda x: x[1]... | false | 0.073328 | 0.037425 | 1.959329 | [
"s256176394",
"s136742325"
] |
u673361376 | p02996 | python | s752192397 | s537356442 | 1,985 | 1,044 | 82,648 | 35,648 | Accepted | Accepted | 47.41 | import heapq
N = int(eval(input()))
tasks = []
for _ in range(N):
a,b = list(map(int,input().split()))
if b-a < 0:
print('No')
exit()
else:
heapq.heappush(tasks,[b,-a])
day = 0
while len(tasks) != 0:
b, neg_a = heapq.heappop(tasks)
if day - neg_a > b:
print('No')
exi... | N = int(eval(input()))
deadlines = []
for i in range(N):
a, b = list(map(int, input().split()))
deadlines.append([b, a])
deadlines.sort()
time = 0
for deadline, task_time in deadlines:
if time + task_time <= deadline:
time += task_time
else:
time = None
break
print... | 20 | 15 | 347 | 345 | import heapq
N = int(eval(input()))
tasks = []
for _ in range(N):
a, b = list(map(int, input().split()))
if b - a < 0:
print("No")
exit()
else:
heapq.heappush(tasks, [b, -a])
day = 0
while len(tasks) != 0:
b, neg_a = heapq.heappop(tasks)
if day - neg_a > b:
print("No... | N = int(eval(input()))
deadlines = []
for i in range(N):
a, b = list(map(int, input().split()))
deadlines.append([b, a])
deadlines.sort()
time = 0
for deadline, task_time in deadlines:
if time + task_time <= deadline:
time += task_time
else:
time = None
break
print(("Yes" if time... | false | 25 | [
"-import heapq",
"-",
"-tasks = []",
"-for _ in range(N):",
"+deadlines = []",
"+for i in range(N):",
"- if b - a < 0:",
"- print(\"No\")",
"- exit()",
"+ deadlines.append([b, a])",
"+deadlines.sort()",
"+time = 0",
"+for deadline, task_time in deadlines:",
"+ if tim... | false | 0.060768 | 0.038469 | 1.57965 | [
"s752192397",
"s537356442"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.