problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03469
s388218545
Accepted
S = input() print("2018" + S[4:])
p02707
s934872851
Accepted
N = int(input()) A = [int(i) for i in input().split()] count = [0]*N for elem in A: count[elem-1] += 1 for c in count: print(c)
p03284
s131200104
Accepted
n, k = map(lambda x: int(x), input().split()) if n%k == 0: print(0) else: print(1)
p03137
s671956416
Accepted
import sys import heapq inf = 10**6 n, m = map(int, input().split()) if n >= m: print(0) sys.exit() a = [int(x) for x in input().split()] a.sort() count = [] heapq.heapify(count) for i in range(m-1): heapq.heappush(count, -a[i+1]+a[i]) ans = 0 for j in range(n-1): ans -= heapq.heappop(count) ans = max(a)-min(a)-ans print(ans)
p03386
s389019035
Wrong Answer
a, b, k = map(int, input().split()) c = [] for i in range(min(k, b-a)): c.append(a+i) c.append(b-i) c.sort() c = sorted(set(c)) for i in c: print(i)
p03836
s503953983
Accepted
xy = list(map(int, input().split())) print("U"*(xy[3]-xy[1]) + "R"*(xy[2]-xy[0]) + "D"*(xy[3]-xy[1]) + "L"*(xy[2]-xy[0]+1) + "U"*(xy[3]-xy[1]+1) + "R"*(xy[2]-xy[0]+1) + "D" + "R"+ "D"*(xy[3]-xy[1]+1) + "L"*(xy[2]-xy[0]+1) + "U")
p03617
s951817854
Wrong Answer
#!/use/bin/env python3 import math from collections import defaultdict a = [int(s) for s in input().split()] r = int(input()) q = a[0] / 0.25 h = a[1] / 0.5 s = a[2] d = a[3] / 2 s = [(q, 0.25), (h, 0.5), (s, 1), (d, 2)] p = sorted(s, key=lambda x:x[0]) ans = 0 for u, q in p: c = r//q ans += (u * q) * c r -= (q * c) print(int(ans))
p03838
s524098479
Wrong Answer
x,y = map(int, input().split()) ans = float("inf") if abs(x - y) > abs(x + y): ans = min(ans, abs((-1) * x - y) + 1) if x <= y: ans = min(ans, y - x) else: ans = min(ans, x - y + 2) print(ans)
p03161
s066731267
Wrong Answer
def b_frog_2(stones, k): dp = [0] * len(stones) dp[0] = 0 for i in range(1, len(stones)): for j in range(max(0, i - k), i): dp[i] = min(dp[i], dp[j] + abs(stones[i] - stones[j])) return dp[-1] def main2(): N, K = list(map(int, input().split())) h = list(map(int, input().split())) print(b_frog_2(h, K))
p03062
s886815102
Accepted
def main(): n=int(input()) a=list(map(int,input().split())) dp=[0,-10**18] for i in range(n-1): dp2=[max(dp[0]+a[i],dp[1]-a[i]),max(dp[0]-a[i],dp[1]+a[i])] dp=dp2 print(max(dp[0]+a[-1],dp[1]-a[-1])) main()
p02714
s428122420
Accepted
n = int(input()) s = list(input()) r, g, b = 0, 0, 0 for i in s: if i == "R": r += 1 elif i == "G": g += 1 else: b += 1 ans = r * g * b for i in range(n - 2): k = i + 2 while True: if k >= n: break j = i + (k - i) // 2 if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]: ans -= 1 k += 2 print(ans)
p03359
s131032723
Accepted
a , b = map(int,input().split()) if a > b: print(a - 1) else: print(a)
p03103
s956532390
Wrong Answer
n, m = map(int, input().split()) a, b = [], [] for i in range(n): te, mp = map(int, input().split()) a.append(te) b.append(mp) e, f = [], [] for i, j in sorted(zip(a, b)): e.append(i) f.append(j) ans = 0 for i in range(n): if m - f[i] < 0: ans += e[i] * m print(ans) break else: ans += f[i] * e[i] m -= f[i]
p02727
s013451846
Accepted
x, y, a, b, c = map(int, input().split()) p = sorted(list(map(int, input().split()))) q = sorted(list(map(int, input().split()))) r = sorted(list(map(int, input().split()))) filt_p = p[-x:] filt_q = q[-y:] filt_p.extend(filt_q) filt_p.extend(r) all_apples = sorted(filt_p) ans = sum(all_apples[-x-y:]) print(str(ans))
p02768
s498215386
Accepted
def cmb(a,b,c): b = min(b,a-b) num = 1 for i in range(b): num = num*(n-i) % c den = 1 for i in range(b): den = den*(i+1) % c return num*pow(den,-1,c) % c mod = 10**9+7 n,a,b = map(int,input().split()) ans = (pow(2,n,mod)-cmb(n,a,mod)-cmb(n,b,mod)-1) % mod if ans < 0: ans = ans + mod print(ans)
p02983
s882659176
Wrong Answer
# coding: utf-8 #N = int(input()) alp = [chr(i) for i in range(97, 97+26)] L = [] l, r = map(int,input().split()) if r-l+1 > 2019: ans = 0 else: for i in range(l, r+1): L.append(i%2019) L.sort() print((L[0]*L[1])%2019)
p03607
s397266785
Accepted
N = int(input()) D = {} for _ in range(N): A = int(input()) D[A] = not D.get(A, False) print(sum(D.values()))
p03494
s494054395
Wrong Answer
# coding = utf-8 n=input("") a=input("") a=a.split(" ") a=[int(s) for s in a] a.sort() base=100000 n=0 for num in a: while num%2**n==0: n=n+1 if n < base: base=n base=base-1 print(base)
p02702
s779968829
Accepted
import collections s = map(int,raw_input()) dp = [0] * 2019 count = 0 for j in range(len(s)): ndp = [0] * 2019 ndp[s[j]] += 1 for k in range(len(dp)): ndp[(10*k + s[j]) % 2019] += dp[k] count += ndp[0] dp = ndp[::] print count
p03419
s676224912
Wrong Answer
h,w = map(int,input().split()) if h == 1 or w == 1: ans = 2 else: ans = 2*(h-2)+2*(w-2)+4 ans = (h*w) - ans print(ans)
p03387
s690350396
Accepted
x = list(map(int,input().split())) x.sort() if (x[1]-x[0])%2==0: print(x[2]-x[1]+(x[1]-x[0])//2) else: print(x[2]-x[1]+(x[1]-x[0])//2+2)
p04020
s792326196
Wrong Answer
N = int(input()) ans = 0 tmp = 0 for _ in range(N): a = int(input()) ans += (a + tmp) // 2 tmp = 0 if a % 2 == 1: tmp = 1 print(ans)
p02690
s023492678
Accepted
x=int(input()) for i in range(-118,120): for j in range(-118,120): if i**5-j**5==x: print(i,j) break else: continue break
p02899
s061430320
Accepted
N = int(input()) A = [[int(n), i] for i,n in enumerate(input().split(), 1)] A.sort() print(" ".join(map(str, [i[1] for i in A])))
p02802
s008399614
Accepted
import sys input = sys.stdin.readline n, m = map(int, input().split()) p_s = [list(map(str, input().split())) for _ in range(m)] ac = [0 for _ in range(n)] wa = [0 for _ in range(n)] for i in range(m): if p_s[i][1] == 'WA': if ac[int(p_s[i][0]) - 1] == 0: wa[int(p_s[i][0]) - 1] += 1 else: ac[int(p_s[i][0]) - 1] = 1 for i in range(n): if ac[i] == 0: wa[i]=0 print(sum(ac), sum(wa))
p03778
s033111913
Wrong Answer
#abc056 b w,a,b=map(int,input().split()) print(min(abs(b+w-a),abs(a+w-b)))
p03673
s058371567
Wrong Answer
import math def pushpush(n , a): ans = [] for i in range(n): if i % 2 == 0: ans = ans + [a[i]] else: #ans.insert(0 , int(a[i])) ans = [a[i]] + ans return ans def main(): n = int(input()) a = list(map(int , input().split())) print(*pushpush(n , a)) if __name__ == '__main__': main()
p02597
s354007089
Accepted
n = int(input()) C = input() rc = C.count('R') print(C[:rc].count('W'))
p02684
s852110828
Accepted
N, K = map(int, input().split(" ")) routs = {} location = [0 for i in range(N + 1)] tereporter = list(map(int, input().split())) for i in range(N): routs[i] = tereporter[i] - 1 present_location = 0 n = 0 for i in range(K): n += 1 present_location = routs[present_location] if location[present_location] == 0: location[present_location] = n else: loop = n - location[present_location] if (K - location[present_location]) % loop == 0: break else: for i in range((K - location[present_location]) % loop): present_location = routs[present_location] break print(present_location + 1)
p02880
s637058986
Accepted
#!/usr/bin/env python3 n = int(input()) for b in range(1, 10): a = n//b if a*b == n: if a <= 9 and b <= 9: print("Yes") exit() print("No")
p02765
s640253301
Accepted
# coding:utf-8 import sys import math import time #import numpy as np import collections from collections import deque import queue import copy #X = str(input()).split() #a = [int(x) for x in input().split()] NR = str(input()).split() N = int(NR[0]) R = int(NR[1]) if(N>=10): ans = R else: ans = R+100*(10-N) print(ans)
p02697
s469768152
Accepted
def main(): n, m = map(int, input().split()) if n%2: for i in range(1, m+1): print(i, n-i+1) else: for i in range(1, m+1): if n-2*i+1 > n//2: print(i, n-i+1) else: print(i, n-i) if __name__ == "__main__": main()
p03543
s744062780
Accepted
s = list(input()) if s[0] == s[1] == s[2] or s[1] == s[2] == s[3]: print("Yes") else: print("No")
p03797
s821079184
Accepted
N, M= map(int, input().split()) if N >= M // 2: print(M // 2) else: m = M - N * 2 s = m // 4 print(N + s)
p03071
s802483296
Wrong Answer
a,b = map(int,input().split()) aa = a+a-1 bb = b+b-1 ab = a+b-1 lists = [aa,bb,ab] print(max(lists))
p02697
s828223999
Wrong Answer
N, M = map(int,input().split()) for i in range(1,M+1): print(i,N-i)
p03803
s350318379
Accepted
a,b = map(int,input().split()) if a==b: print("Draw") elif a == 1: print("Alice") elif b == 1: print("Bob") elif a > b: print("Alice") elif a < b: print("Bob")
p02831
s657642324
Accepted
# import bisect # import heapq # from copy import deepcopy # from collections import deque # from collections import Counter # from itertools import accumulate # from itertools import permutations # import numpy as np # import math # mod = 10**9 + 7 from fractions import gcd # n = int(input()) # s = deque(input()) # q = int(input()) a, b = map(int, input().split()) # a = list(map(int, input().split())) def lcm(x, y): return (x * y) // gcd(x, y) print(lcm(a,b))
p03472
s500926442
Wrong Answer
import math n,h = map(int,input().split()) al = [] bl = [] ans = 0 for i in range(n): a,b = map(int,input().split()) al += [a] bl += [b] am = max(al) bl.sort(reverse=1) print(al) print(bl) for i in bl: if i>am: ans += 1 h -= i if h <= 0: break else: break if h > 0: ans += math.ceil(h/am) print(ans)
p03417
s074328235
Wrong Answer
n,m=map(int,input().split()) if n>2: print((n-2)*(m-2)) elif n==1 and m==1: print(1) else: print(m-2)
p02730
s881047842
Accepted
s = list(input()) n = len(s) flg = True s4 = reversed(s) if s != s[::-1]: flg = False s2 = s[0:((n-1)//2)] s5 = reversed(s) if s2 != s2[::-1]: flg = False s3 = s[(n+3)//2 -1:n] s6 = reversed(s) if s3 != s3[::-1]: flg = False if flg == True: print('Yes') else: print('No') #print(s[::-1])
p03852
s783095178
Accepted
c = str(input()) if c == "a" or c == "e" or c == "i" or c == "o" or c == "u": print("vowel") else: print("consonant")
p03069
s654810724
Accepted
N = int(input()) S = input() m = 10 ** 6 tot1 = 0 cnt1 = 0 cnt0 = 0 for s in S: if(s == '#'): cnt0 += 1 else: cnt1 += 1 tot1 += 1 m = min(m,cnt0-cnt1) m += tot1 m = min(m,tot1) print(m)
p02598
s692883027
Wrong Answer
import math N, K = map(int, input().split()) a = list(map(int, input().split())) a.sort() l = 0 r = a[-1] while r - l > 1: mid = (r + l) // 2 cnt = 0 for i in a: cnt += math.ceil(i // mid) if cnt <= K: r = mid else: l = mid print(r)
p02570
s117320579
Accepted
[D,T,S] = list(map(int,input().split())) jikan=D/S if jikan>T: print('No') else: print('Yes')
p03835
s504985971
Wrong Answer
input_str = input().split() k = int(input_str[0]) s = int(input_str[1]) count = 0 for x in range(k+1): if x == s: count += 1 else: for y in range(k+1-x): if x+y == s: count += 1 else: for z in range(k+1-x-y): if x+y+z == s: count += 1 print(count)
p03962
s209794263
Accepted
a,b,c = map(int,input().split()) if a == b == c: print(1) elif a == b or b == c or c == a: print(2) else: print(3)
p02684
s074323743
Accepted
n,k = map(int,input().split()) a = list(map(int,input().split())) already = ["1"] set = {"1"} now = 1 for i in range(n): now = str(a[int(now)-1]) if now in set: break else: already.append(now) set.add(now) ind = already.index(now) k -= ind cycle = already[ind:] if k <= 0: print(already[k+ind]) else: now = (k+1) % len(cycle) print(cycle[now-1])
p03719
s314882218
Accepted
a,b,c=map(int,input().split()) if a<=c<=b: print('Yes') else: print('No')
p03723
s129515084
Accepted
#!/usr/local/bin/python3 # https://atcoder.jp/contests/agc014/tasks/agc014_a A, B, C = map(int, input().split()) if A == B == C and A % 2 == 0: print(-1) exit() def check(A, B, C): return A%2 == 1 or B%2 == 1 or C%2 == 1 ans = 0 while check(A, B, C) == False: nA = (B + C) / 2 nB = (A + C) / 2 nC = (A + B) / 2 A, B, C = nA, nB, nC ans += 1 print(ans)
p03836
s278104415
Accepted
import sys readline = sys.stdin.readline sx,sy,tx,ty = map(int,readline().split()) xdist = tx - sx ydist = ty - sy ans = "R" * xdist + "U" * ydist + "L" * xdist + "D" * ydist ans += "L" + (ydist + 1) * "U" + "R" * (xdist + 1) + "D" ans += "R" + (ydist + 1) * "D" + "L" * (xdist + 1) + "U" print(ans)
p02971
s639914083
Wrong Answer
N = int(input()) A = [input() for i in range(N)] import copy B = copy.copy(A) B.sort() a1 = B[-1] a2 = B[-2] if a1 == a2: for i in range(N): print(a1) else: for i in range(N): if A[i] == a1: print(a2) else: print(a1)
p03556
s327202557
Wrong Answer
n=int(input()) for i in range(1,10**9): print(i) if i*i > n: break print((i-1)*(i-1))
p03438
s570332790
Accepted
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) k = sum(b)-sum(a) c,d = 0,0 for i in range(n): e = b[i]-a[i] if e<=0: d -= e else: c+= (e+1)//2 d+= e%2 print("Yes" if k>=c and k>=d else "No")
p03161
s292652602
Wrong Answer
##Educational-DP B n,k = map(int,input().split()) h = tuple(map(int,input().split())) dp = [10**4 + 1] * n dp[0] = 0 for i in range(1,n): for j in range(max(0,i-k),i): dp[i] = min(dp[i],dp[j]+abs(h[j]-h[i])) #print(dp) print(dp[-1])
p03250
s794590860
Wrong Answer
a, b, c = list(map(int, input().split())) print(10 * max([a, b, c]) + sum([a, b, c]))
p02630
s619431762
Accepted
N = int(input()) A = list(map(int,input().split())) Q = int(input()) dp = [0 for _ in range(10**5+10)] for a in range(len(A)): dp[A[a]] += 1 s = sum(A) for q in range(Q): B, C = map(int,input().split()) dp[C] += dp[B] s +=(C-B)*dp[B] dp[B] = 0 print(s)
p02720
s188974562
Accepted
K = int(input()) from collections import deque nlist = deque([1,2,3,4,5,6,7,8,9]) for i in range(K): sample = nlist.popleft() if sample%10 != 0: nlist.append(sample*10 - 1 + sample%10) nlist.append(sample*10 + sample%10) if sample%10 != 9: nlist.append(sample*10 + 1 + sample%10) print(sample)
p02613
s588660386
Accepted
lists = [input() for i in range(int(input()))] dct = {'AC':0, 'WA':0, 'TLE':0, 'RE':0} for lst in lists: if lst in dct: dct[lst] += 1 for k, v in dct.items(): print(k,'x',v)
p03827
s692926453
Accepted
n = int(input()) s = input() ans = [0] x = 0 for i in range(n): if s[i] == 'I': x += 1 ans.append(x) else: x -= 1 ans.append(x) #print(ans) print(max(ans))
p02957
s116243738
Accepted
a,b=map(int,input().split()) res = 0 c = a+b if c % 2 == 1: print("IMPOSSIBLE") else: res = int(c/2) print(res)
p04012
s124733793
Accepted
w=list(input()) w.sort() if len(w)%2==0: for i in range(0,len(w),2): if w[i]!=w[i+1]: print('No') exit() print('Yes') else: print('No')
p02713
s790608063
Wrong Answer
from math import gcd K = int(input()) ans = 0 for i in range(K): for j in range(K): t = gcd(i, j) for k in range(K): ans += gcd(t, k) print(ans)
p02880
s113987198
Accepted
n = int(input()) print('Yes' if sum(i*j == n for i in range(1, 10) for j in range(1, 10)) else 'No')
p02633
s875344358
Wrong Answer
x = int(input()) k = 4 if x <= 90: k = 360/x else: k = 360/ (180-x) k = int(k) print(k)
p03077
s700964288
Accepted
N=int(input()) ans=0 for i in range(5): ans+=1 a=int(input()) if N%a==0: A=int(N//a) else: A=int(N//a)+1 ans=max(ans,A+i) print(ans)
p03359
s950722866
Accepted
A, B = map(int, input().split()) if B >= A: print(A) else: print(A-1)
p02747
s396487932
Wrong Answer
s=input() n=len(s) if n<=1: print("No") exit() if s=="hi": print("Yes") exit() for i in range(n-1): if s[i]=="h" and s[i+1]=="i": if i==0 and s[i+2]!="i": print("Yes") exit() if i==n-1 and s[i-1]!="h": print("Yes") exit() if s[i-1]!="h" and s[i+2]!="i": print("Yes") exit() print("No")
p02996
s024539088
Wrong Answer
n = int(input()) works = list() for num in range(n): a = list(map(int, input().split())) works.append(a) works.sort(key = lambda x :x[1]) time = 0 counter = 0 for row in works: time += row[0] counter += 1 if time >= row[1]: print("No") exit() print("Yes")
p03565
s278183419
Wrong Answer
Sp = input() Sp_list = list(Sp) N = len(Sp) T = input() n = len(T) def check(s, t): for si, ti in zip(s, t): if si == '?': continue if si != ti: return False return True ans = [] for i in range(N-n+1): if check(Sp[i:i+n], T): Sp_list[i:i+n] = list(T) ans.append(''.join(Sp_list).replace('?', 'a')) if ans: ans.sort() print(ans[0]) else: print('UNRESTORABLE')
p02612
s306789067
Accepted
n = int(input()) m = n%1000 if m ==0: print(0) else : print(1000-m)
p03455
s421853040
Accepted
a, b=map(int, input().split()) if (a*b)%2==0: print('Even') else: print('Odd')
p03103
s447624627
Wrong Answer
n,m = map(int,input().split()) C={} S=[] for i in range(n): a,b = map(int,input().split()) S.append(a) C[a]=b S.sort() ans=0 for s in S: # print(S,C,ans) if m<C[s] : ans+=m*s break else: ans+=C[s]*s m-=C[s] print(ans)
p02548
s747725133
Accepted
N = int(input()) out = 0 for i in range(1,N): c = (N-1) // i out += c print(out)
p02694
s449124043
Accepted
x = int(input()) n = 0 y = 100 while x > y: y = int(y*1.01) n = n + 1 print(n)
p03210
s103927058
Wrong Answer
x = int(input()) l = [7, 5, 3] if x in l: print("Yes") else: print("No")
p03163
s860564739
Wrong Answer
N, W = map(int, input().split()) w = [] v = [] for n in range(N): w1, v1 = map(int, input().split()) w.append(w1) v.append(v1) memo = [[0 for i in range(W+1)] for j in range(N+1)] def into(num, weight): if num >= N: return 0 if weight < w[num]: return 0 if memo[num][weight] != 0: return memo[num][weight] c= max( into(num+1, weight-w[num])+v[num], into(num+1, weight) ) memo[num][weight] = c return c print(into(0, W))
p02924
s570274985
Accepted
n = int(input()) sum = n*(n+1)//2 print(sum-n)
p02797
s832719565
Wrong Answer
n, k, s = map(int, input().split()) for i in range(1, n+1): if i <= k+1: if s %2 == 1 and i % 2 == 1: print(s//2 + 1) else: if i == k: print(s//2 + 1) print(s//2) else: if k//2 == s//2 + 7: print(s//2 + 1) else: print(s//2+7)
p02720
s532258354
Wrong Answer
k = int(input()) def check(i): s = str(i) flag = True for j in range(len(s)-1): if (abs(int(s[j])-int(s[j+1])) >= 2): flag = False return flag cnt = 0 for i in range(1, 200000): if (len(str(i)) == 1): cnt += 1 elif(check(i)): cnt += 1 if (cnt == k): print(i) break
p03281
s419822751
Accepted
from math import sqrt, ceil n = int(input()) ans = 0 for i in range(1, n+1, 2): score = 0 for d in range(1, ceil(sqrt(i))+1): p, m = divmod(i, d) if m == 0: if p != d: score += 2 else: score += 1 if score == 8: ans += 1 print(ans)
p02613
s695832704
Wrong Answer
import math import collections def main(): N = int(input()) S = [input() for _ in range(N)] A = collections.Counter(S) print('AC × ' + str(A['AC'])) print('WA × ' + str(A['WA'])) print('TLE × ' + str(A['TLE'])) print('RE × ' + str(A['RE'])) main()
p03386
s238313807
Accepted
A,B,K = map(int,input().split()) if B-A+1 <= K*2: for i in range(A,B+1): print(i) else: for i in range(A,A+K): print(i) for i in range(B-K+1,B+1): print(i)
p03693
s159952789
Accepted
r,g,b = map(str,input().split()) value = r+g+b if int(value)%4 == 0: print('YES') else: print('NO')
p02789
s859064005
Accepted
s = list(map(int,input().split(' '))) print("Yes") if s[0] == s[1] else print('No')
p03221
s434512440
Wrong Answer
n,m = map(int, input().split()) py = [list(map(int, input().split())) for _ in range(m)] py.sort() ans = [] b = py[0][0] cnt = 0 for p,y in py: if b == p: cnt += 1 else: b = p cnt = 1 a = [str(p), str(cnt)] if len(str(p)) < 6: a[0] = "0"*(6-len(str(p))) + str(p) if len(str(cnt)) < 6: a[1] = "0"*(6-len(str(cnt))) + str(cnt) ans.append(a[0] + a[1]) for v in ans: print(v)
p02918
s218279166
Wrong Answer
import sys input=sys.stdin.readline N,K=(int(x) for x in input().rstrip('\n').split()) L = list(input()) sta = L[0] change=0 now = sta for x in L[1:]: if x!=now: now = x change += 1 res = change - K*2 if res < 0: res = 0 print(N-1-res)
p02714
s065598582
Accepted
from collections import Counter def main(): n=int(input()) s=input() d=Counter(s) a=d["R"]*d["G"]*d["B"] for i in range(n): t=min(n-i-1, i) for j in range(t+1): if s[i-j] != s[i] and s[i-j] != s[i+j] and s[i] != s[i+j]: a-=1 print(a) if __name__ == "__main__": main()
p02772
s697244433
Accepted
# 155 B n = int(input()) s = list(map(int, input().split())) valid = True for i in s: if i % 2 == 0: if i % 3 != 0 and i % 5 != 0: valid = False if valid == True: print("APPROVED") elif valid == False: print("DENIED")
p03448
s872946491
Accepted
A = int(input()) B = int(input()) C = int(input()) X = int(input()) n = X // 500 + 1 count = 0 for i in range(n): if i <= A: m = (X-500*i)//100+1 for j in range(m): if j <= B and (X-500*i - 100*j) % 50 == 0 and ((X-500*i - 100*j) / 50) <= C: if not (i==0 and j ==0 and ((X-500*i - 100*j) / 50)==0): count += 1 print(count)
p02640
s691357850
Accepted
X, Y = map(int, input().split()) fin = "" if (X * 4 < Y or X * 2 > Y or Y % 2 != 0): fin += "No" else: fin += "Yes" print(fin)
p03076
s204861164
Wrong Answer
A = int(input()) B = int(input()) C = int(input()) D = int(input()) E = int(input()) dishes = [A, B, C, D, E] tens = 0 ones = 9 muda = 10 for d in dishes: if d % 10 == 0: tens += d // 10 else: tens += d // 10 + 1 if d % 10 < ones: muda = d ones = d % 10 #%% if muda % 10 == 0: ans = tens * 10 else: ans = tens * 10 - (10 - muda % 10) print(ans)
p03971
s552643084
Accepted
N,A,B= map(int,input().split()) S=input() sanka=0 kaigai=0 for i in range(N): if S[i]=="a": if sanka< A+B: print("Yes") sanka += 1 else: print("No") elif S[i]=="b": if sanka < A+B and kaigai <B: print("Yes") sanka += 1 kaigai += 1 else: print("No") else: print("No")
p02854
s322296089
Accepted
N = int(input()) A_list = [int(item) for item in input().split()] all_sum = sum(A_list) F_sum_list = [A_list[0]] for j in range(1,N): F_sum_list.append(F_sum_list[-1] + A_list[j]) delta_list = [abs(all_sum - 2* i) for i in F_sum_list] print(min(delta_list))
p03785
s332365530
Accepted
n, c, k = map(int, input().split()) t = [] for i in range(n): t.append(int(input())) t.sort() ans = 0 counter = 0 lim = t[0] for i in range(n): if counter < c and (t[i] - lim) <= k: counter += 1 else: counter = 1 lim = t[i] ans += 1 print(ans + 1)
p03419
s796593562
Wrong Answer
n, m = map(int, input().split()) if n == 1 and m == 1: ans = 0 elif n == 1: ans = m - 2 elif m == 1: ans = n - 2 else: ans = (n - 2) * (m - 2) print(ans)
p03804
s996108764
Wrong Answer
n,m=map(int,input().split()) a=[] b=[] for i in range(n): a.append(list(input())) for i in range(m): b.append(list(input())) for i in range(n-m): for j in range(n-m): flg=True for k in range(m): for kk in range(m): if b[k][kk]!=a[i+k][j+kk]: flg=False if flg: print("Yes") exit() print("No")
p02578
s435957009
Accepted
n = int(input()) A = [0]+list(map(int,input().split())) ans = 0 for i in range(1,n+1): d = A[i-1] -A[i] if(d >0): A[i] += d ans += d print(ans)
p02603
s642432422
Wrong Answer
N = int(input()) L = list(map(int, input().split())) money = 1000 stocks = 0 for i in range (0, N-1): if L[i+1] > L[i]: stocks = money//L[i] money = money%L[i] elif L[i+1] == L[i]: continue else: money+= stocks*L[i] stocks = 0 print(money+stocks*L[-1])
p02584
s686906099
Accepted
xkd = input().split() X = int(xkd[0]) K = int(xkd[1]) D = int(xkd[2]) X = abs(X) ans = 0 times = int(X/D) oneMore = False if X%D > abs(D-X%D): times+=1 if times > K: ans = X - (D*K) else: if (times%2) == (K%2): ans = min(X%D, (D-X%D)) else: ans = max(X%D, (D-X%D)) print(ans)