problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02790
s354357366
Accepted
# -*- coding: utf-8 -*- a, b = map(int, input().split()) if a < b: print("".join([str(a)]*b)) else: print("".join([str(b)] * a))
p02683
s965657603
Accepted
import itertools import numpy as np import copy N, M, X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] CA = np.array(CA) ans = 10 ** 7 for i in itertools.product([0, 1], repeat=N): tCA = copy.copy(CA) for j in range(N): if i[j] == 0: tCA[j] = np.zeros(CA.shape[1]) s = np.sum(tCA, axis=0) l = sum(k >= X for k in s[1:]) if s[0] < ans and l == M: ans = s[0] if ans == 10 ** 7: print(-1) else: print(ans)
p03162
s313601837
Wrong Answer
n = int(input()) abc = [list(map(int, input().split())) for _ in range(n)] last_index = -1 value = 0 for i in range(n): sorted_lst = sorted(abc[i], reverse=True) for j in range(3): if j == last_index: continue last_index = j value += sorted_lst[j] break print(value)
p02601
s630645658
Accepted
a, b, c = map(int, input().split()) k = int(input()) for i in range(k): if a >= b: b *= 2 elif b >= c: c *= 2 if a < b and b < c: print('Yes') else: print('No')
p02657
s329673092
Wrong Answer
a,b=input().split() a=int(a) b.replace('.','') b=int(b) print((a*b)//100)
p02836
s555289291
Wrong Answer
S = input() l = len(S)// 2 ans= 0 for i in range(l): if S[i] != S[l-i]: ans += 1 print(ans)
p02700
s443376369
Wrong Answer
a,b,c,d = map(int,input().split()) if(a+b>=c+d): print("Yes") else: print("No")
p03773
s110642084
Accepted
x,y = map(int,input().split()) print((x+y)%24)
p02899
s013558256
Wrong Answer
n = int(input()) a_lst = list(map(int,input().split())) a_str = '' for i in range(n): a_str += str(a_lst[i]) seq_lst = [0]*n for i, seq in enumerate(a_str): seq_lst[int(seq)-1] = i+1 for i in range(n): print(seq_lst[i], end=' ')
p02678
s614164857
Wrong Answer
print('No')
p03494
s990768988
Accepted
n = int(input()) a = list(map(int, input().split())) ans = 0 while True: for i in range(n): if a[i] % 2 == 0: a[i] //= 2 else: break else: ans += 1 continue break print(ans)
p03206
s746550241
Accepted
x =int(input()) print("Christmas" + " Eve" *(25 - x) )
p04029
s604233747
Accepted
N = int(input()) print(sum([i for i in range(1, N + 1)]))
p03284
s623288621
Accepted
n,k=map(int,input().split()) print(int(not(not n%k) ))
p02772
s296660254
Accepted
N = int(input()) A = list(map(int, input().split())) A_e = [] for i in range(N): if A[i]%2 == 0: A_e.append(A[i]) cnt = 0 for j in range(len(A_e)): if (A_e[j]%3 == 0) or (A_e[j]%5 == 0): cnt += 1 else: cnt = cnt if cnt == len(A_e): print('APPROVED') else: print('DENIED')
p02947
s903655742
Wrong Answer
import collections from math import factorial def combinations_count(n, r): #組み合わせ return factorial(n) // (factorial(n - r) * factorial(r)) n = int(input()) li = [] ans = 0 for i in range(n): s = list(input()) s.sort() li.append(''.join(s)) c = list(collections.Counter(li).values()) for i in c: if i == 1: break ans += combinations_count(i, 2) print(ans)
p03351
s580566599
Wrong Answer
a, b, c, d = list(map(int, input().split())) h = [a, b, c] maxvalue = -1 minvalue = 101 for i in range(len(h)): if h[i] > maxvalue: maxvalue = h[i] for i in range(len(h)): if h[i] < minvalue: minvalue = h[i] x, y, z = minvalue, a+b+c-maxvalue-minvalue, maxvalue if y - x > d or z - y > d: print("No") else: print("Yes")
p02554
s466574394
Accepted
N = int(input()) MOD = 10**9 + 7 ans = pow(10, N, MOD) - 2*pow(9, N, MOD) + pow(8, N, MOD) ans %= MOD print(ans)
p03854
s567744890
Wrong Answer
S = input().replace("eraser","").replace("erase","").replace("dream","").replace("dreamer","") if S =="": print("YES") else: print("NO")
p03012
s505937258
Wrong Answer
n = int(input()) w = list(map(int, input().split())) a = 0 b = sum(w) for i in w: a += i b -= i if a >= b: break print(abs(a-b))
p02880
s246118888
Accepted
n=int(input()) cnt=0; for i in range(1,10): if n%i==0: if n/i<10: print('Yes') exit() print('No')
p02571
s131795518
Wrong Answer
S = input() T = input() lenS = len(S) lenT = len(T) maxcnt = 0 for l in range(lenT): for r in range(l,lenT): if T[l:r+1] in S[l:lenS-lenT+r+1]: maxcnt = max(maxcnt, r - l + 1) print(lenT - maxcnt)
p03557
s979098682
Accepted
import bisect n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(lambda x: -int(x), input().split())) a.sort() c.sort() ans = 0 for bi in b: na = bisect.bisect_left(a, bi) nb = bisect.bisect_left(c, -bi) ans += na * nb print(ans)
p02633
s602459879
Accepted
import sys from math import gcd sys.setrecursionlimit(10 ** 7) rl = sys.stdin.readline def solve(): X = int(rl()) ans = X * 360 // gcd(X, 360) // X print(ans) if __name__ == '__main__': solve()
p03435
s733553025
Wrong Answer
import numpy as np from itertools import product import sys read = sys.stdin.buffer.read C = np.array(read().split(), np.int32).reshape(3, 3) i, j, k = np.max(C + 2, axis=1) // 2 flag = 0 for i, j, k in product(range(i), range(j), range(k)): x = C[0, :] - i y = C[1, :] - j z = C[2, :] - k if np.all((x == y) & (y == z)): flag = 1 break print(['No', 'Yes'][flag])
p02791
s605166962
Accepted
def main(): n = int(input()) p = list(map(int,input().split())) minp = p[0] cnt = 0 for i in range(n): if p[i]<=minp:cnt+=1 minp = min(minp,p[i]) print(cnt) main()
p03854
s671370708
Accepted
import sys t = set('dream, dreamer, erase, eraser'.split(', ')) def obtainable(s): while True: for i in range(5, 8): if s[-i:] in t: s = s[:-i] break else: return False if not s: return True s = sys.stdin.readline().rstrip() def main(): print("YES" if obtainable(s) else "NO") if __name__ == '__main__': main()
p03778
s533171058
Accepted
W,a,b=map(int,input().split()) if a+W<=b: print(b-(a+W)) elif a>=b+W: print(a-(b+W)) else: print(0)
p02835
s081862140
Accepted
a,b,c = map(int,input().split()) if a+b+c>= 22: print('bust') else: print('win')
p02910
s849330364
Accepted
S = input() for i in range(len(S)): if i % 2 == 1: if S[i] =="R": print("No") break else: if S[i] == "L": print("No") break else: print("Yes")
p02766
s159761210
Wrong Answer
import math x, y = [int(x) for x in input("").split()] a = math.log(x,y) b=x%y if(b==0): print (math.ceil(a)+1) else: print (math.ceil(a))
p03239
s414218878
Accepted
N,T = map(int, input().split()) min_cost = float('inf') for i in range(N): c,t = map(int, input().split()) if (t <= T) and (c < min_cost): min_cost = c if min_cost == float('inf'): print('TLE') else: print(min_cost)
p02862
s963994017
Wrong Answer
x,y = list(map(int,input().split(" "))) a = (2*x - y)//3 b = (2*y - x)//3 mod = 10**9+7 g1 = [1, 1] g2 = [1, 1] inv = [0, 1] for i in range(2, 666667): g1.append((g1[-1] * i) % mod) inv.append((-inv[mod%i] * (mod//i)) % mod) g2.append((g2[-1] * inv[-1]) % mod) def nChoosem(n,m): if n < 0 or m < 0 or n < m: return 0 m = min(m, n-m) return g1[n] * g2[n-m] * g2[m] % mod res = nChoosem(a+b,a) print(res)
p02663
s463128794
Accepted
# -*- coding: utf-8 -*- H1,M1,H2,M2,K = map(int, input().split()) print((H2*60+M2)-(H1*60+M1)-K)
p03407
s746836150
Wrong Answer
a,b,c=map(int,input().split()) print('Yes' if c<=a+b*2 else 'No')
p02629
s140539417
Wrong Answer
s='0abcdefghijklmnopqrstuvwxyz' n=int(input()) def number_of_alphabets(n): i=1 g=0 while g<n: g+=26**i i+=1 return(i-1) i=number_of_alphabets(n)-1 name='' for i in range(i,-1,-1): o=n//26**i if o>26: o=26 name+=s[o] n=n-o*26**i print(name)
p03693
s317658631
Accepted
r, g, b = map(int,input().split()) if (r*100 + g*10 + b) % 4 ==0: print("YES") else: print("NO")
p02923
s411534276
Accepted
n = int(input()) h = list(map(int, input().split())) step_max = 0 r_step = 0 for i in reversed(range(n-1)): if h[i] >= h[i+1]: r_step += 1 else: r_step = 0 if r_step > step_max: step_max = r_step print(step_max)
p02983
s371151319
Accepted
L, R = map(int,input().split()) Dif = abs(L-R)+1 if Dif >= 2020: Ans = 0 else: Box = [] for i in range(L,R+1): Box.append(i%2019) Box.sort() Ans = 2020*2020 for i in range(len(Box)-1): B1 = Box[i] for j in range(i+1,len(Box)): B2 = Box[j] Ans = min((B1*B2)%2019, Ans) print(Ans%2019)
p02731
s691609593
Accepted
l = float(input()) print((l/3)** 3)
p02601
s101591313
Wrong Answer
a,b,c=map(int,input().split()) k=int(input()) if c>a/(2**k): for x in range(k+1): if b>a/(2**x): break else: print("No") y=k-x if c>b/(2**y): print("Yes") else: print("No") else: print("Yes")
p02783
s526006354
Wrong Answer
h, a = map(int, input().split()) print(h//a+1)
p02973
s337112722
Accepted
from bisect import bisect_left from collections import deque def main(): N = int(input()) A = [int(input()) for _ in range(N)] ans = deque([A[0]]) for i in range(1,N): index = bisect_left(ans,A[i]) if index == 0: ans.appendleft(A[i]) else: ans[index-1] = A[i] print(len(ans)) if __name__ == "__main__": main()
p03487
s467075671
Accepted
from collections import Counter N = input() A = list(map(int, input().split())) counter = Counter(A) cnt = 0 for k, v in counter.items(): if v < k: cnt += v elif v > k: cnt += v - k print(cnt)
p02959
s082769303
Wrong Answer
n=int(input()) a=[int(i) for i in input().split()] b=[int(i) for i in input().split()] ans=0 for i in range(n): m=min(a[i],b[i]) ans+=m a[i]-=m b[i]-=m m=min(a[i+1],b[i]) a[i]-=m b[i]-=m ans+=m print(ans)
p02879
s123205832
Wrong Answer
def main(): A, B = map(int, input().split()) p = A * B if p >= 82: print(-1) else: print(p) main()
p02677
s066119559
Wrong Answer
import math inputLine = input() tempStr = inputLine.split(' ') a = int(tempStr[0]) b = int(tempStr[1]) h = int(tempStr[2]) m = int(tempStr[3]) minDeg = 360 * (m / 60) hourDeg = h * 30 + (30 * (m / 60)) finalValue = hourDeg - minDeg if hourDeg >= minDeg else minDeg - hourDeg finalValue = 360 - finalValue if finalValue >= 180 else finalValue if finalValue == 90 or finalValue == 180 : print(math.sqrt((a * a) + (b * b))) elif finalValue == 0 : print(0) else : print(math.sqrt((a * a) + (b * b) - (2 * a * b * math.cos(math.pi * (finalValue / 180)))))
p02747
s109107339
Accepted
s=input() ans="No" if s=="hi": ans="Yes" if s=="hihi": ans="Yes" if s=="hihihi": ans="Yes" if s=="hihihihi": ans="Yes" if s=="hihihihihi": ans="Yes" print(ans)
p03679
s969509521
Wrong Answer
x,a,b=map(int,input().split()) b -= a if b < 0: print('delicious') else: if b > x: print('dangerous') else: print('safe')
p03067
s322685566
Accepted
a, b, c = map(int, input().split()) if a < c < b or b < c < a: print("Yes") else: print("No")
p02624
s005870153
Accepted
def main(): N = int(input()) ans = 0 for n in range(1, N + 1): ans += n * (N // n + 1) * (N // n) // 2 print(ans) if __name__ == '__main__': main()
p03106
s046323083
Wrong Answer
A,B,K=map(int,input().split()) S=[] for i in range(1,B+1): if A % i==0 and B%i==0: S.append(i) print(S[K-1])
p03719
s291353400
Accepted
A, B, C = map(int,input().split()) print("Yes" if A <= C <= B else "No")
p02629
s212959997
Accepted
def C(): n = int(input()) ret = [None]*12 q = n for i in range(12): q,mod = divmod(q,26) if mod == 0: ret[i] = "z" q -= 1 else: ret[i] = chr(mod+96) if q == 0: break ret = ret[:i+1] ret.reverse() print("".join(ret)) C()
p02577
s543660839
Wrong Answer
n = list(map(int, input().split())) result = "YES" if sum(n) % 9 == 0 else "NO" print(result)
p03852
s538333245
Accepted
s = input() if (s == "a" or s == "i" or s == "u" or s == "e" or s == "o") : print("vowel") else : print("consonant")
p02642
s565024067
Accepted
N = int(input()) nums = list(map(int, input().split())) nums.sort() checked = [0 for _ in range(nums[-1]+1)] answer = 0 for i in range(N-1): if checked[nums[i]] == 1: continue else: if nums[i] != nums[i+1]: answer += 1 count = 1 temp = nums[i] while(temp <= nums[-1]): checked[temp] = 1 count += 1 temp= nums[i]*count if checked[nums[-1]] == 0: answer += 1 print(answer)
p02847
s269804584
Accepted
from sys import stdin import sys import math from functools import reduce import functools import itertools from collections import deque,Counter,defaultdict from operator import mul import copy # ! /usr/bin/env python # -*- coding: utf-8 -*- import heapq sys.setrecursionlimit(10**6) INF = float("inf") import bisect S = input() if S == "SUN": print(7) elif S == "MON": print(6) elif S == "TUE": print(5) elif S == "WED": print(4) elif S == "THU": print(3) elif S == "FRI": print(2) elif S == "SAT": print(1)
p03407
s688385766
Accepted
A, B, C=map(int,input().split()) if A+B >= C: print('Yes') else: print('No')
p03485
s926106377
Wrong Answer
import math a,b = map(int,input().split()) print(math.ceil(a+b))
p02694
s139861480
Accepted
import math x = int(input()) deposit = 100 ans = 0 while deposit < x: deposit = math.floor(deposit * 1.01) ans += 1 print(ans)
p03323
s523784001
Accepted
a,b = map(int,input().split()) if a <= 8 and b <= 8: print("Yay!") else: print(":(")
p04029
s512896359
Wrong Answer
N = int(input()) print((N + 1) // 2)
p03345
s196516363
Wrong Answer
A = list(map(int,input().split())) for i in range(A[3]): A[0] = A[1] + A[2] A[1] = A[0] + A[2] A[2] = A[0] + A[1] if abs(A[0]-A[1]) > 10**18: print('unfair') else: print(A[0]-A[1])
p02970
s324558088
Wrong Answer
n , d = map(int, input().split()) count = 0 for i in range(n): if n > 2*d+1: count += 1 n = 2*d+1 if n != 0: count += 1 print(count)
p03624
s061743395
Wrong Answer
a = input() a_l = 'abcdefghijklmnopqrstuvwxyz' for i in range(26): if a.count(a_l[i])>=1: continue else: print(a_l[i]) break
p03327
s984292517
Accepted
n = int(input()) if n <= 999: print("ABC") else: print("ABD")
p03339
s101576352
Accepted
N = int(input()) S = list(input()) row = [0]*(N+2) for i in range(N): if S[i] =='E': row[i+1] = row[i] + 1 else: row[i+1] = row[i] answer = [0]*N for i in range(N): answer[i] += (i - row[i]) a = row [N] - row[i+1] answer[i] += a #print(S) #print(row) #print(answer) print(min(answer))
p02691
s091380991
Wrong Answer
N = int(input()) height = input() height = height.split() height = [int(s) for s in height] count = 0 for i in range(N): for j in range(i+1, N): if j-1 == height[i] + height[j]: count += 1 print(count)
p04020
s988467228
Wrong Answer
import sys input = sys.stdin.readline # from collections import deque def linput(_t=int, cnv=list): return cnv(map(_t, input().split())) def gcd(n,m): while m: n,m = m, n%m return n def lcm(n,m): return n*m//gcd(n,m) def main(): N = int(input()) vA = [int(input()) for _ in [0,]*N] res = 0 odd = 0 for a in vA: x = (a+odd)//2 res += x odd = a - 2*x print(res) # print("No Yes".split()[res]) main()
p03730
s620272423
Accepted
a, b, c = map(int, input().split()) d = a % b A = {d} while d != 0: d += a d %= b A.add(d) print('YES' if c in A else 'NO')
p02675
s245218614
Accepted
N= int(input()) N = str(N) n = N[-1] if n == "3": print("bon") elif n == "0" or n == "1" or n =="6" or n == "8": print("pon") else: print("hon")
p02706
s452354627
Accepted
N, M = map(int, input().split()) A = map(int, input().split()) result = N-sum(A) if result < 0: result = -1 print(result)
p03774
s714098899
Accepted
n, m = map(int,input().split()) people = [] points = [] for i in range(n): person = list(map(int,input().split())) people.append(person) for i in range(m): point = list(map(int,input().split())) points.append(point) for person in people: mini = 1000000000 minIndex = 0 for i in range(m): distance = abs(person[0]-points[i][0]) + abs(person[1]-points[i][1]) if mini > distance: mini = distance minIndex = i print(minIndex+1)
p03836
s107460733
Accepted
a,b,c,d=map(int,input().split()) X=c-a Y=d-b ans1='R'*X+'U'*Y ans2='L'*X+'D'*Y ans3='D'+'R'*(X+1)+'U'*(Y+1)+'L' ans4='U'+'L'*(X+1)+'D'*(Y+1)+'R' print(ans1+ans2+ans3+ans4)
p03779
s535277348
Accepted
import math X = int(input()) t = math.ceil((-1 + (1 + 8 * X) ** 0.5)/2) print (t)
p02817
s096230728
Wrong Answer
s=input().split() print(s[0]+s[1])
p02909
s802719481
Accepted
s = input() if s[0] == "S": print("Cloudy") elif s[0] == "C": print("Rainy") else: print("Sunny")
p03803
s694162348
Wrong Answer
L = [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1] A, B = map(int, input().split()) print('Draw') if L[A] == L[B] else print('Alice' if L[A] > L[B] else 'Bob')
p03161
s266175269
Accepted
n, k = map(int, input().split()) *H, = map(int, input().split()) X = [0] for i in range(1, n): x = 1 << 30 for j in range(1, k+1): if i-j >= 0: x = min(x, X[i-j]+abs(H[i]-H[i-j])) X.append(x) print(X[n-1])
p02659
s791337527
Accepted
from sys import stdin from decimal import Decimal def main(): #入力 readline=stdin.readline li=readline().strip().split() a=Decimal(str(li[0])) b=Decimal(str(li[1])) ans=int(a*b) print(ans) if __name__=="__main__": main()
p02606
s985586550
Wrong Answer
l, r, d = map(int, input().split()) print((r-l+1) // d)
p02817
s443689187
Wrong Answer
print(input().strip())
p02829
s233526653
Wrong Answer
a = int(input()) b = int(input()) if a+b == 3: print(3) else: print(2)
p02988
s841196168
Accepted
n = int(input()) p = list(map(int, input().split())) count = 0 for i in range(1, n - 1): if sorted([p[i - 1], p[i], p[i + 1]])[1] == p[i]: count += 1 print(count)
p02771
s183521807
Accepted
# coding: utf-8 A,B,C=map(int,input().split()) l=[A,B,C] if len(set(l))==2: print("Yes") else: print("No")
p02792
s862458268
Accepted
n = int(input()) ans=0 mp=[[0]*10 for _ in range(10)] for i in range(1,n+1): a=int(str(i)[0]) b=int(str(i)[-1]) mp[a][b]+=1 for i in range(10): for j in range(10): ans+=mp[i][j]*mp[j][i] print(ans)
p02823
s281155777
Accepted
N,A,B=map(int,input().split()) ans=0 if (B-A)%2==0: ans=(B-A)//2 else: if A-1<N-B: if B-A==1: ans=B-1 else: ans=A+(B-A-1)//2 else: if B-A==1: ans=N-A else: ans=N-B+1+(N-(A+N-B+1))//2 print(ans)
p02681
s295724767
Accepted
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = 10**20 def I(): return int(input()) def F(): return float(input()) def S(): return input() def LI(): return [int(x) for x in input().split()] def LI_(): return [int(x)-1 for x in input().split()] def LF(): return [float(x) for x in input().split()] def LS(): return input().split() def resolve(): s = S() t = S() if s==t[:-1]: print('Yes') else: print('No') if __name__ == '__main__': resolve()
p03073
s000660109
Wrong Answer
S = input() d = int(S[0]) T = [] U = [] for i in range(len(S)): T.append(d) d = (d + 1) % 2 U.append(d) count1 = 0 count2 = 0 for i in range(len(S)): if S[i] != T[i]: count1 += 1 if S[i] != U[i]: count2 += 1 print(min(count1, count2))
p02766
s629478588
Accepted
n, k = map(int, input().split()) answer = 0 while True: if n // k != 0: n = n // k answer += 1 else: break print(answer + 1)
p03632
s324626857
Wrong Answer
a,b,c,d = map(int,input().split()) if c >= b: print(0) else: if b >= d: print(d-c) else: print(b-c)
p02663
s994017422
Accepted
def task(h1, m1, h2, m2, k): t1 = h1 * 60 + m1 t2 = h2 * 60 + m2 t = t2 - t1 print(max(0, t - k)) #print(h1, m1, h2, m2, k) h1, m1, h2, m2, k = map(int, input().split()) task(h1, m1, h2, m2, k)
p03657
s661358521
Wrong Answer
a,b = map(int,input().split()) print("Possible" if a % 3 == 0 or b % 3 == 0 or a+b % 3 == 0 else "Impossible")
p02784
s394980902
Wrong Answer
input_num=input() n=input_num.split() num = list(map(int,n)) N=sum(num[2:]) if num[0]<=N: print("Yes") else: print("No")
p03471
s163562157
Accepted
n, y = map(int, input().split()) for i in range(n+1): for j in range(n+1-i): if 10000*i + 5000*j + 1000*(n-i-j) == y: print(i, j, n-i-j) exit() print(-1, -1, -1)
p03545
s932891805
Wrong Answer
def op(x): return '+' if x==0 else '-' # -*- coding: utf-8 -*- N = int(input()) a=N//1000 b=N%1000//100 c=N%100//10 d=N%10 for i in range(2**3): total=0 for j,num in zip(range(3),[b,c,d]): if (i>>j)&1==0: total+=num else: total-=num if a+total==7: print('{}{}{}{}{}{}{}=7'.format(a,op(i>>0&1),b,op(i>>1&1),c,op(i>>2&1),d))
p02700
s041626677
Accepted
A, B, C, D=map(int,input().split()) while C or A >= 0: C -= B A -= D if C <= 0: print("Yes") break if A <= 0: print("No") break
p03971
s900242367
Accepted
n, a, b = map(int, input().split()) s_l = input() ca = 0 cb = 0 for s in s_l: if s == 'a' and ca + cb < a+b: ca += 1 print('Yes') elif s == 'b' and ca + cb < a+b and cb < b: cb += 1 print('Yes') else: print('No')
p03131
s541851589
Wrong Answer
K,A,B=map(int,input().split()) bis=1 if A>=B-1: bis=K+1 else: if (K-(A-1))%2==0: bis=int(A+(B-A)*(K-(A-1))/2) else: bis=A+(B-A)*((K-(A-1))//2)+1 print(bis)