problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p03455
|
s587551677
|
Wrong Answer
|
a,b=map(int,input().split())
if a%2==0 or b%2==0:
print("odd")
else:
print("Even")
|
p02554
|
s508690299
|
Accepted
|
N = int(input())
ans = (10 ** N - 2 * (9 ** N) + 8 ** N) % (10 ** 9 + 7)
print(ans)
|
p03815
|
s873974713
|
Wrong Answer
|
x = int(input())
ans = x // 11 * 2
if x % 11 != 0:
if x % 11 >= 5:
ans += 2
else:
ans += 1
print(ans)
|
p03711
|
s303254049
|
Accepted
|
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if x in a and y in a or x in b and y in b or x in c and y in c:
print('Yes')
else:
print('No')
|
p02775
|
s436179610
|
Wrong Answer
|
n = list(map(int, list(input())))
cnt = 0
for i, j in enumerate(n[::-1]):
if i == len(n) - 1:
if j < 6:
cnt += j
if j > 5:
cnt += (10 - j) + 1
else:
if j < 5:
cnt += j
if j > 4:
cnt += (10 - j)
n[i+1] += 1
print(cnt)
|
p02713
|
s059740081
|
Accepted
|
from math import gcd
key = int(input())
sin = 0
for i in range(1,key+1):
for j in range(1,key+1):
temp = gcd(i,j)
for m in range(1,key+1):
sin += gcd(m,temp)
print(sin)
|
p03632
|
s527280653
|
Accepted
|
a, b, c, d = map(int, input().split())
print(max(min(b, d) - max(a, c), 0))
|
p03327
|
s073442787
|
Accepted
|
N = int(input(""))
if N <= 999:
print("ABC")
elif 1000 <= N <= 1998:
print("ABD")
else:
print("error")
|
p03804
|
s901601443
|
Accepted
|
n,m=map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
r=any([r[j:j+m] for r in a[i:i+m]]==b for i in range(n-m+1) for j in range(n-m+1))
print('Yes' if r else 'No')
|
p03854
|
s460199768
|
Accepted
|
#白昼夢
s = input()
words = ['dream','dreamer','erase','eraser']
#evaluate
while True:
for i in range(4):
if s.endswith(words[i]):
s = s[:-len(words[i])]
break #inner loop
else:
print('NO')
break #outerloop
if not s:
print('YES')
break #outerloop
|
p03037
|
s816448963
|
Accepted
|
n,m = map(int, input().split())
l,r = 0,n
for i in range(m):
L,R = map(int, input().split())
l = max(l,L)
r = min(r,R)
print(r-l+1 if l<=r else 0)
|
p03146
|
s242508866
|
Accepted
|
s = int(input())
a = [0,s]
for n in range(2,10**6+1):
if a[n-1] % 2 == 0:
an = a[n-1] // 2
else:
an = a[n-1] * 3 + 1
if an in a:
m = n
break
a.append(an)
print(m)
|
p03433
|
s347520334
|
Wrong Answer
|
N=int(input())
A=int(input())
if N%500<A:
print("Yes")
else:
print("No")
|
p02744
|
s120011411
|
Accepted
|
n=int(input())
l=[[] for i in range(n)]
l[0]=[[0]]
for i in range(n-1):
for j in l[i]:
for k in range(max(j)+2):
l[i+1].append(j+[k])
for i in range(len(l[n-1])):
for j in range(n):
print(chr(l[n-1][i][j]+97), end="")
print()
|
p02622
|
s148900907
|
Wrong Answer
|
s1 = input()
s2 = input()
for i in range(len(s1)):
count = 0
if s1[i] != s2[i]:
count += 1
print(count)
|
p02676
|
s792980943
|
Accepted
|
def B():
k = int(input())
s = input()
if k<len(s):
print(s[:k] + "...")
else:
print(s)
B()
|
p02970
|
s819513220
|
Wrong Answer
|
import math
n, d = map(int, input().split())
print(math.ceil(n/(d*2)))
|
p02701
|
s825901769
|
Wrong Answer
|
s=input()
s.split()
d={}
for i in s.split():
d[i]=1
print(len(d)-1)
|
p02862
|
s593883134
|
Accepted
|
mod = 7+10**9
def ncr(n,c,mod):
x = 1
y = 1
for i in range(n-c+1,n+1):
x = x*i%mod
for j in range(1,c+1):
y = y*j%mod
return (x * pow(y, mod-2, mod)) % mod
X, Y = map(int, input().split())
if (X+Y) % 3 != 0:
print(0)
exit()
n = (2*Y-X) // 3
m = (2*X-Y) // 3
if n < 0 or m < 0:
print(0)
exit()
ans = ncr(n+m,n,mod)
print(ans)
|
p03145
|
s546459626
|
Wrong Answer
|
a,b,c=list(map(int,input().split()))
print(a*b/2)
|
p02629
|
s077837165
|
Accepted
|
N=int(input())
def num2alpha(num):
if num<=26:
return chr(96+num)
elif num%26==0:
return num2alpha(num//26-1)+'z'
else:
return num2alpha(num//26)+chr(96+num%26)
print(num2alpha(N))
|
p02842
|
s153083497
|
Wrong Answer
|
n = int(input())
can_tax = False
for i in range(1, n):
if round(i * 1.08) == n:
x = i
can_tax = True
if can_tax:
print(x)
else:
print(":(")
|
p03360
|
s746789903
|
Accepted
|
num = list(map(int,input().split()))
K = int(input())
num.sort()
for i in range(K):
num[-1] = num[-1]*2
print(sum(num))
|
p02641
|
s409946142
|
Accepted
|
X,N=map(int, input().split())
try:
p=list(map(int, input().split()))
except:
print(X)
exit(0)
if X not in p:
print(X)
exit(0)
c=1
while 1:
if X-c not in p:
print(X-c)
exit(0)
if X+c not in p:
print(X+c)
exit(0)
c+=1
|
p03137
|
s258321480
|
Accepted
|
n, m = map(int, input().split())
List = list(map(int, input().split()))
if n >= m:
print(0)
else:
List.sort()
dis = []
for i in range(1, len(List)):
dis.append(List[i] - List[i-1])
dis.sort()
res = 0
for i in range(len(dis)-(n-1)):
res += dis[i]
print(res)
|
p02630
|
s263846500
|
Accepted
|
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7
N = int(readline())
A = list(map(int,readline().split()))
from collections import Counter
Ac = Counter(A)
s = sum(A)
Q = int(readline())
for i in range(Q):
b,c = map(int,readline().split())
s += (c-b)*Ac[b]
Ac[c] += Ac[b]
Ac[b] = 0
print(s)
|
p03408
|
s593897896
|
Accepted
|
from collections import defaultdict
dd=defaultdict(int)
N=int(input())
for _ in range(N):
dd[input()]+=1
M=int(input())
for _ in range(M):
dd[input()]-=1
ans=max(dd.values())
ans=max(ans, 0)
print(ans)
|
p03433
|
s454405465
|
Wrong Answer
|
N=int(input())
A=int(input())
if N % 500 <=A:
print("YES")
else:
print("NO")
|
p03017
|
s591348005
|
Accepted
|
N,A,B,C,D=map(int,input().split())
S=input()
for i in range(B-1,D-1):
if S[i:i+2]=='##':
print('No')
exit()
for i in range(A-1,C-1):
if S[i:i+2]=='##':
print('No')
exit()
if C>D:
for i in range(B-2,D-1):
if S[i:i+3]=='...':
print('Yes')
exit()
print('No')
exit()
print('Yes')
|
p03107
|
s776533229
|
Wrong Answer
|
s=list(map(int,list(input())))
from collections import Counter
cs=Counter(s)
print(min(cs.values())*2)
|
p02608
|
s711255860
|
Accepted
|
n = int(input())
a = [0] * (n + 1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
c = x * x + y * y + z * z + x * y + y * z + z * x
if c <= n:
a[c] +=1
else:
break
for i in a[1:]:
print(i)
|
p02983
|
s070401689
|
Accepted
|
L, R = map(int, input().split())
MOD = 2019
res = []
for i in range(L, min(L+MOD, R+1)):
for j in range(i+1, min(L+MOD, R+1)):
res.append((i*j) % MOD)
print(min(res))
|
p03077
|
s978425368
|
Wrong Answer
|
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
res=0
if n>a:
res+=n//a
n=a
if n>b:
res+=n//b
n=b
if n>c:
res+=n//c
n=c
if n>d:
res+=n//d
n=d
if n>e:
res+=n//d
n=e
print(res+5)
|
p02791
|
s091088137
|
Accepted
|
N = int(input())
P = list(map(int, input().split()))
tmp = P[0]
ans = 1
for i in range(1, N):
if tmp > P[i]:
tmp = P[i]
ans += 1
print(ans)
|
p03160
|
s509471742
|
Accepted
|
def solve(N, heights):
dp = [float('inf')] * N
dp[0] = 0
for i in range(N - 1):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(heights[i] - heights[i + 1]))
if i + 2 < N:
dp[i + 2] = min(dp[i + 2], dp[i] + abs(heights[i] - heights[i + 2]))
print(dp[N-1])
def iin(): return int(input())
def iln(): return list(map(int, input().split()))
solve(iin(), iln())
|
p03624
|
s429833887
|
Accepted
|
S = input()
a = "abcdefghijklmnopqrstuvwxyz"
ans = "None"
for x in a:
if x not in S:
ans = x
break
print(ans)
|
p03544
|
s092057505
|
Accepted
|
N=int(input())
L=list()
L.append(2)
L.append(1)
for i in range(2,N+1):
L.append(L[i-2]+L[i-1])
print(L[N])
|
p03644
|
s844429593
|
Accepted
|
def main():
n = int(input())
idx = -1
cnt = -1
for i in range(1,n+1):
tmp = (bin(i)[2:])[::-1].find('1')
if tmp > cnt:
cnt = tmp
idx = i
print(idx)
if __name__ == '__main__':
main()
|
p03387
|
s495607601
|
Wrong Answer
|
import math
a = sorted(list(map(int,input().split())))
print(a[2] - a[1] + math.ceil((a[1] - a[0]) / 2) + (a[1] - a[0]) % 2 == 1)
|
p02995
|
s448232015
|
Accepted
|
import fractions
C, D, A, B = map(int,input().split())
num = A * B // fractions.gcd(A, B)
ans = D - C + 1 - D // A + (C - 1) // A - D // B + (C - 1) // B + D // num - (C - 1) // num
print(ans)
|
p02862
|
s444462867
|
Accepted
|
MOD = 1000000007
X,Y = map(int,input().split())
x,y = (2*X-Y)//3,(2*Y-X)//3#行動1、行動2を起こす回数
if (2*X-Y)%3 != 0 or (2*Y-X)%3 != 0 or x < 0 or y < 0 or(x==0 and y==0):
print(0)
exit()
ans =1
for i in range(x+y,0,-1):
ans = ((ans%MOD)*i)%MOD
for i in range(x,0,-1):
ans = ((ans%MOD)*pow(i,MOD-2,MOD))%MOD
for i in range(y,0,-1):
ans = ((ans%MOD)*pow(i,MOD-2,MOD))%MOD
print(ans)
|
p03556
|
s397862073
|
Wrong Answer
|
import math
n = int(input())
m = math.sqrt(n)
print(int(math.floor(m)))
|
p02576
|
s842220554
|
Accepted
|
n, x, t = map(int, input().split())
print((n + x - 1) // x * t)
|
p02675
|
s939914807
|
Wrong Answer
|
N=str(input())
if int(N[-1])==3:
print("bon")
elif int(N[-1])==0 or 1 or 6 or 8:
print("pon")
else:
print("hon")
|
p02553
|
s306537816
|
Accepted
|
a, b, c, d = [int(_) for _ in input().split()]
print(max(a * c, a * d, b * c, b * d))
|
p02900
|
s738517543
|
Accepted
|
def gcd(a,b):
if b==0: return a
return gcd(b,a%b)
def ela(g):
s={1}
i=2
while i*i<=g:
while g%i==0:
g//=i
s.add(i)
i+=1
if g!=1: s.add(g)
return s
a,b=map(int,input().split())
G=gcd(max(a,b),min(a,b))
print(len(ela(G)))
|
p03073
|
s675264190
|
Accepted
|
S = input()
White = '10'*(len(S)//2)+'1'*(len(S)%2)
Black = '01'*(len(S)//2)+'0'*(len(S)%2)
WD = len([X for X in map(set,zip(S,White)) if len(X)==2])
BD = len([X for X in map(set,zip(S,Black)) if len(X)==2])
print(min(WD,BD))
|
p03162
|
s119905456
|
Wrong Answer
|
from functools import lru_cache
import sys
sys.setrecursionlimit(2147483647)
N = int(input())
A = []
for i in range(0,N):
A.append(list(map(int,input().split())))
#@lru_cache(None)
def dfs(d,pre):
if (d,pre) in dic: return dic[(d,pre)]
if d>=N-1: return 0
ma = 0
for idx,a in enumerate(A[d]):
if idx != pre:
res = dfs(d + 1,idx) + a
ma = max(res,ma)
dic[(d,pre)] = ma
return ma
dic = {}
res = dfs(-1,-1)
print(res)
|
p03699
|
s759934935
|
Accepted
|
n = int(input())
#a, b = map(int,input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
sl = []
for i in range(n):
sl.append(int(input()))
total = sum(sl)
sl.sort()
if total % 10 == 0:
ans = 0
for i in range(n):
if sl[i]%10!=0:
ans=total-sl[i]
break
else:
ans = total
print(ans)
|
p02553
|
s333694809
|
Accepted
|
a,b,c,d=map(int,input().split())
x=max(a*c,b*d)
y=max(a*d,b*c)
print(max(x,y))
|
p04019
|
s706633973
|
Accepted
|
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()
def resolve():
import sys
input = sys.stdin.readline
se = input().rstrip()
S = "S" in se
N = "N" in se
E = "E" in se
W = "W" in se
if (S ^ N) or (E ^ W):
print("No")
else:
print("Yes")
if __name__ == "__main__":
resolve()
|
p02848
|
s403758186
|
Accepted
|
n = int(input())
s = input()
res = ''
abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in range(len(s)):
res += abc[abc.index(s[i]) + n]
print(res)
|
p02772
|
s893549956
|
Accepted
|
N = int(input())
A = list(map(int, input().split()))
for i in A:
if i % 2 == 0 and i % 3 != 0 and i % 5 != 0:
result = 'No'
break
else:
result = 'Yes'
if result == 'No':
print('DENIED')
else:
print('APPROVED')
|
p02761
|
s092607242
|
Accepted
|
N, M = map(int, input().split())
ans = -1
S = [0] * M
C = [0] * M
for i in range(M):
S[i], C[i] = map(int, input().split())
def check(x):
if len(str(x)) != N:
return False
for s, c in zip(S, C):
if str(x)[s-1] != str(c):
return False
return True
for i in range(10**N):
if check(i):
ans = i
break
print(ans)
|
p03037
|
s572817272
|
Wrong Answer
|
n, m = map(int, input().split())
ans_l = 0
ans_r = n
for _ in range(m):
l, r = map(int, input().split())
ans_l = max(ans_l, l)
ans_r = min(ans_r, r)
print(ans_r-ans_l+1)
|
p03000
|
s358473323
|
Accepted
|
N,X = map(int,input().split())
l = list(map(int,input().split()))
pos = 0
cnt = 1
for i in range(N):
pos += l[i]
if pos <= X:
cnt += 1
else:
break
print(cnt)
|
p02847
|
s316336631
|
Wrong Answer
|
S=input()
A=['SAT','FRI','TUE','WED','THU','MON','SUN']
print(A.index(S)+1)
|
p02691
|
s672189120
|
Accepted
|
def main():
N = int(input())
A = list(map(int, input().split()))
d = {}
r = 0
for i, v in enumerate(A, start = 1):
if -i-v in d:
d[-i-v] += 1
else:
d[-i-v] = 1
if v-i in d:
r += d[v-i]
return r
print(main())
|
p02646
|
s322747549
|
Wrong Answer
|
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if A < B:
if (V*T + W*T) >= abs(B - A):
print("YES")
else:
print("NO")
elif A > B:
if (V*T + W*T) >= abs(A - B):
print("YES")
else:
print("NO")
|
p03852
|
s935087798
|
Wrong Answer
|
c = input()
if c == ('a' or 'b' or 'c' or 'd' or 'e'):
print("vowel")
else:
print("consonant")
|
p03106
|
s940712921
|
Accepted
|
a,b,k = map(int,input().split())
cnt = 0
ans = list()
for i in range(1,101):
if a%i==0 and b%i==0:
ans.append(i)
print(ans[::-1][k-1])
|
p03698
|
s134801083
|
Accepted
|
S = input()
print('yes') if len(S) == len(set(S)) else print('no')
|
p02675
|
s039561045
|
Wrong Answer
|
def main():
s, = map(int, open(0).read().split())
first_place_of_s = s % 10
if first_place_of_s in [2, 4, 5, 7, 9]:
ans = 'hon'
elif first_place_of_s in [0, 1, 6, 8]:
ans = 'pon'
else:
ans = 'bon'
ans = ''
print(ans)
return()
if __name__ == '__main__':
main()
|
p03971
|
s199625527
|
Wrong Answer
|
datalist=list(map(int,input().split()))
N,A,B=datalist[0],datalist[1],datalist[2]
strings=str(input())
na,nb=0,0
for i in range(len(strings)):
if strings[i]=="a":
if na + nb < A+B:
print("YES")
na += 1
else:
print("NO")
elif strings[i]=="b":
if na + nb < A+B:
if nb <= B:
print("YES")
nb += 1
else:
print("NO")
else:
print("NO")
else:
print("NO")
|
p02912
|
s271302343
|
Wrong Answer
|
def main():
n, m = list(map(int, input().split()))
t = list(map(int, input().split()))
while m > 0:
idx = 0
t.sort(reverse=True)
# print(t)
t[0] //= 2
m -= 1
if m != 0:
if t[0] > t[1]:
t[0] //= 2
else:
t[1] //= 2
m -= 1
print(sum(t))
|
p03943
|
s367389392
|
Accepted
|
a, b, c = map(int, input().split())
if a+b == c or a+c == b or b+c == a:
print('Yes')
else:
print('No')
|
p03761
|
s977575052
|
Wrong Answer
|
n = int(input())
s = []
for i in range(n):
s.append(input())
ans = ""
for i in range(len(s[0])):
check = 0
for j in range(1,n):
if not s[0][i] in s[j]:
check = 1
if check == 0:
ans = ans + s[0][i]
ans = ''.join(sorted(ans))
print(ans)
|
p03998
|
s118263817
|
Wrong Answer
|
ma=input()
mb=input()
mc=input()
mdic={"a":ma,"b":mb,"c":mc}
m="a"
ndic={"a":0,"b":0,"c":0}
while ndic[m]<len(mdic[m]):
m=mdic[m][ndic[m]]
ndic[m]+=1
print(m.upper())
|
p03838
|
s251367684
|
Accepted
|
x,y=map(int,input().split())
X=abs(x)
Y=abs(y)
if x<y:
if x*y>0:
print(abs(X-Y))
elif x*y==0:
print(abs(X-Y))
else:
print(abs(X-Y)+1)
else:
if x*y>0:
print(abs(X-Y)+2)
elif x*y==0:
print(abs(X-Y)+1)
else:
print(abs(X-Y)+1)
|
p03607
|
s073731643
|
Wrong Answer
|
N=int(input())
s=set()
for i in range(N):
a=set(input())
s^=a
print(len(a))
|
p02970
|
s053120342
|
Wrong Answer
|
n, d = map(int, input().split())
min = 0
count = 1
while (1):
max = min + 2 * d + 1
min = max + 1
if (max >= n):
break
count += 1
print(count)
|
p03815
|
s245331950
|
Wrong Answer
|
x = int(input())
ans = x//11 * 2
mod = x%11
if mod<=6:
ans += 1
else:
ans += 2
print(ans)
|
p02600
|
s282827325
|
Accepted
|
x = int(input())
ans = 8
if x <= 599:
ans = 8
elif x <= 799:
ans = 7
elif x <= 999:
ans = 6
elif x <= 1199:
ans = 5
elif x <= 1399:
ans = 4
elif x <= 1599:
ans = 3
elif x <= 1799:
ans = 2
else:
ans = 1
print(ans)
|
p03814
|
s327836981
|
Accepted
|
s = input()
A = []
Z = []
for i, si in enumerate(s):
if si == 'A':
A.append(i)
elif si == 'Z':
Z.append(i)
print(max(Z) - min(A) + 1)
|
p02615
|
s521673352
|
Wrong Answer
|
N=int(input())
AA=list(map(int,input().split()))
AA=sorted(AA)[::-1]
print(sum(AA)-AA[-1])
|
p02707
|
s888825581
|
Wrong Answer
|
N=int(input())
a = list(map(int, input().split()))
print(a.count(1))
for i in range(1,N):
n=a.count(i)
m=a.count(i+1)
for x in range(0,n):
print(m)
if m==0:
break
|
p02995
|
s175558047
|
Accepted
|
from fractions import gcd
a,b,c,d=map(int,input().split())
e=c*d//gcd(c,d)
def num(x,c,d,e):
return x-x//c-x//d+x//e
print(num(b,c,d,e)-num(a-1,c,d,e))
|
p02577
|
s940899723
|
Accepted
|
n = input()
s = list(n)
p = 0
for i in range(len(s)):
s[i] = int(s[i])
p += s[i]
if p%9 == 0:
print('Yes')
else:
print('No')
|
p02779
|
s938888564
|
Wrong Answer
|
N = int(input())
A = list(map(int,input().split()))
if N==len(A):
print('YES')
else:
print('NO')
|
p02982
|
s118071797
|
Wrong Answer
|
import numpy
N, D = map(int, input().split())
lstMain = list()
for i in range(0, N):
lstMain.append(list(map(int, input().split())))
print(lstMain)
count = 0
for i in range(0, N):
for j in range(i+1, N):
y = numpy.array(lstMain[i])
z = numpy.array(lstMain[j])
u = z - y
distance = float(numpy.linalg.norm(u))
if distance.is_integer():
count += 1
print(count)
|
p02784
|
s157859739
|
Accepted
|
h,n=map(int,input().split())
a=sum(map(int,input().split()))
print('Yes' if h<=a else 'No')
|
p02775
|
s097907554
|
Accepted
|
n = input()
n = n[::-1]
kuriage = 0
sum = 0
for i in range(len(n)):
intI = int(n[i]) + kuriage
if intI < 5:
kuriage = 0
sum += intI
elif intI > 5:
kuriage = 1
sum += (10 - intI)
else: # intI == 5
if len(n) != i+1 and int(n[i+1]) >= 5:
kuriage = 1
sum += (10 - intI)
else:
kuriage = 0
sum += intI
print(sum + kuriage)
|
p03338
|
s051367405
|
Accepted
|
import sys
N = int(input())
S = input()
unique_S = list(set(list(S)))
sys.exit() if not (2 <= N <= 100) else ''
sys.exit() if len(S) != N else ''
sys.exit() if not S.islower() else ''
result = 0
for I in range(len(S)):
count = 0
for J in range(len(unique_S)):
if ( unique_S[J] in S[0:I] ) and ( unique_S[J] in S[I:] ):
count += 1
if result < count:
result = count
print(result)
|
p04030
|
s278550150
|
Wrong Answer
|
a=list(input())
for i in range(len(a)):
if a[i]=="B" and i>=1 and len(a)!=0 :
a[i-1]=''
a[i]=''
if a[0]=="B":
a[0]=''
a=''.join(a)
print(a)
|
p02570
|
s488830271
|
Wrong Answer
|
D,T,S=map(int,input().split())
if S*T>D:
print("Yes")
else:
print("No")
|
p03371
|
s262788269
|
Accepted
|
def solve():
A, B, C, X, Y = map(int, input().split())
ans = 5000 * 2 * 10 ** 5
for i in range(max(X, Y) + 1):
ans = min(ans, 2 * i * C + A * max(0, X - i) + B * max(0, Y - i))
print(ans)
if __name__ == '__main__':
solve()
|
p03486
|
s787186364
|
Accepted
|
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
for i in range(min(len(s), len(t))):
if s[i] > t[i]:
print("No")
exit()
elif s[i] < t[i]:
print("Yes")
exit()
else:
if len(s) < len(t):
print("Yes")
else:
print("No")
|
p02622
|
s683311109
|
Wrong Answer
|
s = list(input())
t = list(input())
print(s)
print(t)
time = 0
for i in range(len(s)):
if s[i] != t[i] :
s[i] = t[i]
time += 1
print(time)
|
p02708
|
s414898538
|
Wrong Answer
|
def main():
n, k = map(int, input().split(' '))
A = list(range(n+2))
ans = 0
for i in range(k, n+2):
print('i', i)
tmp_min = sum(A[:i])
tmp_max = sum(A[n+2-i:])
ans += tmp_max - tmp_min
print(ans)
if __name__ == '__main__':
main()
|
p03632
|
s835743663
|
Accepted
|
a,b,c,d = map(int, input().split())
if a <= b <= c <= d or c <= d <= a <= b:
print(0)
else:
ar = sorted([a,b,c,d])
print(ar[2] - ar[1])
|
p02785
|
s650439678
|
Wrong Answer
|
N, K = map(int,input().split())
H = list(input().split())
H.sort()
sum = 0
for i in range(N-K):
sum = sum+int(H[i])
print(sum)
|
p02615
|
s116801698
|
Wrong Answer
|
n = int(input())
a = list(map(int,input().split()))
m = min(a)
print(sum(a)-m)
|
p03720
|
s023497542
|
Accepted
|
n, m = map(int, input().split())
l = [list(map(int, input().split())) for i in range(m)]
for i in range(1, n+1):
cnt = 0
for j in l:
cnt += j.count(i)
print(cnt)
|
p03475
|
s845327270
|
Wrong Answer
|
N = int(input())
CSF = []
for i in range(N-1):
csf = list(map(int, input().split()))
CSF.append(csf)
# print("CSF: {}".format(CSF))
for i in range(N-1):
ans = 0
for j in range(i, N-1):
c, s, f = CSF[j]
if ans < s:
ans = s
ans += c
print(ans)
print(0)
|
p03555
|
s023120040
|
Accepted
|
print(['NO','YES'][input()==input()[::-1]])
|
p03633
|
s956333579
|
Accepted
|
def resolve():
N=int(input())
S=[int(input()) for i in range(N)]
from functools import reduce
from fractions import gcd
def lcm(A,B):
return A* B // gcd(A, B)
#S=[15,25,30]
print(reduce(lcm,S))
resolve()
|
p02717
|
s737927724
|
Wrong Answer
|
x, y, z = map(int, input().split())
print(y, z, x)
|
p03042
|
s119112531
|
Wrong Answer
|
S = input()
if (int(S[:2]) > 12 and int(S[2:]) > 12) or int(S[:2]) == 0 or int(S[2:]) == 0:
print("NA")
elif int(S[:2]) > 12:
print("YYMM")
elif int(S[2:]) > 12:
print("MMYY")
else:
print("AMBIGUOUS")
|
p03611
|
s420560909
|
Accepted
|
def main():
n = int(input())
a = tuple(map(int ,input().split()))
ans = [0]*(10**6)
for x in a:
ans[x-1] += 1
ans[x] += 1
ans[x+1] += 1
print(max(ans))
if __name__ == '__main__':
main()
|
p02628
|
s861915054
|
Accepted
|
data = list(map(int,input().split()))
price = list(map(int,input().split()))
#print(data)
#print(price)
price.sort()
#print(price)
res = 0
for i in range(data[1]):
# print ( 'i = {}'.format(i))
res += price[i]
print(res)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.