problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03814
s813320630
Accepted
s = input() rs = s[::-1] a = s.index('A') z = rs.index('Z') print(len(s)-z - a )
p03625
s528228446
Accepted
from collections import defaultdict d = defaultdict(int) n = int(input()) a = list(map(int, input().split())) ans = [] for i in a: d[i] += 1 if d[i] == 2: d[i] = 0 ans.append(i) ans.sort(reverse=True) if len(ans) >= 2: print(ans[0]*ans[1]) else: print(0)
p02556
s621735732
Accepted
def LI(): return list(map(int, input().split())) pu = [] mi = [] N = int(input()) for _ in range(N): x, y = LI() pu.append(x+y) mi.append(x-y) P = max(pu) p = min(pu) M = max(mi) m = min(mi) print(max(P-p, M-m))
p03106
s961699877
Wrong Answer
a,b,k=map(int,input().split()) loop=0 if a<b: loop=a else: loop=b ans=0 for i in range(1,loop+1): if a%i==0 and b%i==0: k-=1 if k==0: ans=i break print(ans)
p02597
s088306369
Accepted
n=input() c=input() print(c[:c.count("R")].count("W"))
p02578
s643023095
Accepted
N = int(input()) L = list(map(int, input().split())) ma = max(L) mi = L.index(ma) S = 0 nma = L[0] for i in range(1, len(L)): if mi <= i: S += ma - L[i] else: nma = max(nma, L[i]) S += nma - L[i] print(S)
p02897
s561480170
Accepted
N = int(input()) print((N//2 + N %2)/N)
p02600
s394227227
Accepted
n = int(input()) if 400<=n<=599: print('8') elif 600<=n<=799: print('7') elif 800<=n<=999: print('6') elif 1000<=n<=1199: print('5') elif 1200<=n<=1399: print('4') elif 1400<=n<=1599: print('3') elif 1600<=n<=1799: print('2') elif 1800<=n<=1999: print('1')
p03612
s866449893
Wrong Answer
n = int(input()) p = list(map(int, input().split())) cnt = 0 for i in range(n-1): if p[i] == i+1: p[i],p[i+1] = p[i+1],p[i] cnt += 1 print (cnt)
p03161
s914408471
Wrong Answer
n,k = map(int,input().split()) h = list(map(int,input().split())) + [0]*k cost = [0] + [10000]*(n+k) for i in range(n): for j in range(1,k+1): cost[i+j] = min(cost[i]+abs(h[i]-h[i+j]),cost[i+j]) print(cost[n])
p02797
s277336284
Accepted
n,k,s = map(int,input().split()) if s%2 == 0: for i in range(k): print(s,end=" ") for i in range(n-k): if n-k-1 == i: print(11021021) break print(11021021,end=" ") else: for i in range(k): print(s,end=" ") for i in range(n-k): if n-k-1 == i: print(11021021) break print(11021021,end=" ")
p02717
s322215045
Accepted
x, y, z = map(int, input().split()) print(z,x,y)
p03359
s172474758
Accepted
A, B = map(int, input().split()) if A <= B: print(A) else: print(A-1)
p02777
s160965971
Accepted
s, t = input().split() a, b = map(int, input().split()) u = input() if s == u: a -= 1 elif t == u: b -= 1 print(a,b)
p03427
s184519112
Accepted
# もし全部が9なら、9*N # 一桁目が9以外なら (一桁目-1) + (len(N)-1 * 9) # 一桁目が9なら 一桁目が8 + len(N)-1 * 9 S = (input()) if S.count("9") == len(S): print(len(S)*9) elif len(S) == 1: print(int(S)) elif S.count("9") == (len(S)-1) and (S[0]!="9"): print((int(S[0])) + (len(S)-1)*9) elif S[0] == "9": print(8 + ((len(S)-1)*9)) else: print((int(S[0])-1) + (len(S)-1)*9)
p03860
s932830016
Wrong Answer
a,b,c = input().split() print(a[0],b[0],c[0])
p03672
s751505185
Wrong Answer
S = input() for i in range(len(S) - 2, 0, -2): l = i // 2 if S[:l] == S[l:i]: print(i)
p02995
s734414108
Accepted
import sys input = sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 a,b,c,d=MI() cc=b//c - (a-1)//c dd=b//d - (a-1)//d import math g=(c*d)//math.gcd(c,d) gg=b//g - (a-1)//g print(b-a+1 -cc-dd+gg) main()
p02789
s519295220
Accepted
N,M = map(int,input().split()) if N==M: print('Yes') else: print('No')
p03524
s417829874
Accepted
S = input() count={"a":0, "b":0, "c":0} for i in range(len(S)): count[S[i]]+=1 a = count["a"] b = count["b"] c=count["c"] if abs(a-b)<=1 and abs(b-c)<=1 and abs(c-a)<=1: print("YES") else: print("NO")
p02681
s819325253
Accepted
s = input().strip() t = input().strip() if t[:-1] == s: print("Yes") else: print("No")
p02700
s891216671
Accepted
A,B,C,D = map(int,input().split()) while A>0 and C>0: C-=B if C<=0: print("Yes") break A-=D if A<=0: print("No") break
p03997
s812936178
Accepted
a=int(input()) b=int(input()) h=int(input()) print(int((a+b)*h*1/2))
p03163
s636724587
Accepted
n,w = map(int,input().split()) wv = [list(map(int,input().split())) for _ in range(n)] dp = [[0]*(w+1) for _ in range(n+1)] for i in range(n): wi, vi = wv[i] for j in range(w+1): if j<wi: dp[i+1][j] = dp[i][j] else: dp[i+1][j] = max(dp[i][j], dp[i][j-wi]+vi) print(dp[n][w])
p03161
s648885861
Accepted
n, k = map(int, input().split()) h = list(map(int, input().split())) dp = [float('Inf')] * n dp[0] = 0 for i in range(n): for j in range(i+1, i+k+1): if j < n: dp[j] = min(dp[j], dp[i]+abs(h[i]-h[j])) print(dp[-1])
p02814
s623659752
Wrong Answer
from functools import reduce import fractions N, M = map(int, input().split()) A = tuple(map(int, input().split())) def lcm_base(x, y): return (x * y) // fractions.gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) Ahalf = [a//2 for a in A] lcmA = lcm_list(Ahalf) #print(A) #print(lcmA) if lcmA % 2 == 0: print(0) else: n = int(M / lcmA + 1) // 2 print(n)
p02933
s509137123
Wrong Answer
a = int(input()) s = input() if a >=3200: print("red") else: print(s)
p03986
s714416014
Wrong Answer
def main(): X = input() len_X = len(X) right_T = X.rfind("T") left_S = X.find("S") S_Count = X[left_S:right_T+1].count("S") T_Count = X[left_S:right_T+1].count("T") ans = len_X - min(T_Count, S_Count)*2 print(ans) if __name__ == "__main__": main()
p03475
s835362241
Wrong Answer
N = int(input()) CSF = [list(map(int, input().split())) for _ in range(N-1)] ans = 0 memo = {} memoset = set() def dfs(i, time): if i==N-1: return time c, s, f = CSF[i] if time<s: time = s elif time%f!=0: time = time//f+1 if (time, i) in memoset: return memo[(time, i)] T = dfs(i+1, time+c) memo[(time, i)] = T memoset.add((time, i)) return T for i in range(N-1): print(dfs(i, 0)) print(0)
p02866
s908444751
Accepted
from collections import Counter n=int(input()) d=list(map(int,input().split())) dic=Counter(d) MOD=998244353 ans=1 if d[0]!=0 or dic[0]!=1: print(0) else: for i in range(1,max(dic.keys())+1): ans*=pow(dic[i-1],dic[i],MOD) ans%=MOD print(ans)
p02811
s005768301
Accepted
k,x=map(int, input().split()) print("YNeos"[k*500<x::2])
p03073
s020626070
Wrong Answer
S=input() s=0 t=0 for i in range(len(S)): if i%2==0 and S[i]==0: s+=1 for j in range(len(S)): if i%2==0 and S[i]==1: t+=1 print(min(s,t))
p02615
s695319970
Accepted
n = int(input()) a = list(map(int, input().split())) a.sort(reverse=True) cnt = 1 ans = a[0] if n == 2: print(ans) exit() for i in range(1, n): cnt += 1 ans += a[i] if cnt == n - 1: break else: cnt += 1 ans += a[i] if cnt == n - 1: break print(ans)
p02660
s574520805
Wrong Answer
N = int(input()) p, score = 2, 0 while p ** 2 <= N: e = 1 while N >= (p ** e) and N % (p ** e) == 0: N = N // (p ** e) score += 1 e += 1 else: p = p + 1 if p == 2 else p + 2 else: if N != 1 and sum([N % (n + 1) == 0 for n in range(N)]) == 2: score += 1 print(score)
p03673
s837146724
Accepted
from collections import deque n = int(input()) alist = list(map(int, input().split())) d = deque() for i in range(n): if i % 2 == 0: d.append(alist[i]) else: d.appendleft(alist[i]) if i % 2 == 0: print(*reversed(d)) else: print(*d)
p03760
s773977547
Accepted
o=input() e=input() n=len(e) ans="" for i in range(n): ans+=o[i] ans+=e[i] if len(o)>n: ans+=o[-1] print(ans)
p03293
s133910084
Accepted
s = input() t = input() flag = True for i in range(len(s)): s1 = s[i:len(s)] + s[:i] if s1 == t: print("Yes") flag = False break if flag: print('No')
p02577
s274400920
Wrong Answer
n = int(input()) sum1 = 0 for i in range(len(str(n))): sum1 += int(str(n)[i]) print(int(str(n)[i])) if sum1 % 9 == 0: print('Yes') else: print('No')
p03030
s808681271
Wrong Answer
N = int(input()) A = [] for i in range(N): a,b=input().split() b=100-int(b) if b<10: A.append(a+'0'+str(b)) else: A.append(a+str(b)) B=sorted(A) for b in B: print(A.index(b)+1)
p03852
s177512478
Accepted
print('cvoonwseoln a n t'[len(set(['a','i','u','e','o',input()]))==5::2])
p02838
s273578898
Accepted
# from math import sqrt # from heapq import heappush, heappop # from collections import deque # from functools import reduce # a, b = [int(v) for v in input().split()] def main(): mod = 1000000007 N = int(input()) A = [int(v) for v in input().split()] dig = 60 ans = 0 for i in range(dig + 1): mask = 1 << i zero = sum(1 for a in A if a & mask == 0) ans += zero * (N - zero) * mask ans %= mod print(ans % mod) main()
p02602
s081028925
Accepted
import sys readline=sys.stdin.readline N,K = map(int,readline().split()) A=list(map(int,readline().split())) # K + 1 ~ Nについて、i - K < iであればYes for i in range(K, N): if A[i - K] < A[i]: print("Yes") else: print("No")
p02786
s523507189
Accepted
h = int(input()) cnt = 0 while h>0: h = h//2 cnt +=1 print(2**cnt-1)
p02792
s545546461
Wrong Answer
a=int(input()) num=0 for i in range(1,a+1): i=str(i) for j in range(1,a+1): j=str(j) if i==j[::-1]: num+=1 elif len(set(i+j))==1: num+=1 print(num)
p02699
s441343221
Accepted
s,w = map(int,input().split()) if w >= s : print('unsafe') else : print('safe')
p03910
s803636187
Accepted
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline n = int(input()) cnt =0 i=0 while cnt<n: i+=1 cnt +=i diff = cnt -n for num in range(1,i+1): if num==diff: continue print(num)
p03351
s370433960
Accepted
# A - Colorful Transceivers a, b, c, d = map(int, input().split()) e = a - b f = b - c g = c - a x = abs(e) y = abs(f) z = abs(g) if x <= d and y <= d or z <= d: print('Yes') else: print('No')
p02618
s283256285
Accepted
import sys readline = sys.stdin.readline # 0-indexでやる D = int(readline()) C = list(map(int,readline().split())) # 満足度の下がりやすさ for i in range(D): S = list(map(int,readline().split())) for j in range(len(S)): S[j] = (S[j],j) S = sorted(S, key = lambda x:x[0], reverse = True) print(S[0][1] + 1)
p03161
s760990620
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,K,*H = map(int,read().split()) dp = [0] *(N+K) H = [H[0]]*K+H for n in range(K,N+K): h = H[n] dp[n] = min(x+abs(y-h) for y,x in zip(H[n-K:n],dp[n-K:n])) print(dp[-1])
p02598
s513395513
Accepted
n,k=map(int,input().split()) A=list(map(int,input().split())) high=max(A) low=0 while high-low>1: cnt=0 now=(low+high)//2 for a in A: cnt+=max((a-1)//now,0) if cnt>k: break if cnt>k: low=now else: high=now #print(cnt,low,high) print(high)
p02784
s886482004
Accepted
H, N = map(int, input().split()) Attack = map(int, input().split()) print("Yes" if H - sum(Attack) <= 0 else "No")
p02623
s698262423
Accepted
N, M, K = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) a, b = [0], [0] for i in range(N): a.append(a[i]+A[i]) for i in range(M): b.append(b[i]+B[i]) ans, j = 0, M for i in range(N+1): if a[i] > K: break while b[j] > K - a[i]: j -= 1 ans = max(ans, i+j) print(ans)
p04034
s666720266
Wrong Answer
N, M = map(int, input().split()) kouho = {} red = 1 Nlist = [1]*(N+1) ans = 0 for i in range(M): x, y = map(int, input().split()) if x == red: red = y kouho[y] = True Nlist[x] -= 1 Nlist[y] += 1 else: Nlist[x] -= 1 Nlist[y] += 1 for i in range(1, N+1): if Nlist[i] == 0: continue if i in kouho: ans += 1 print(ans)
p02759
s393136319
Accepted
print((int(input())+1)//2)
p02718
s517805602
Wrong Answer
b, c = map(int, input().split()) a = list(map(int, input().split())) d = sum(a) new_a = list(reversed(sorted(a))) e = 0 f = 0 g = 4*c while new_a[e] >= d/g: e = e+1 if e == b: break f = f+1 if f >= c: print("Yes") else: print("No")
p03854
s928598702
Accepted
s=input() s=s.replace("eraser","") s=s.replace("erase","") s=s.replace("dreamer","") s=s.replace("dream","") if s=="": print("YES") else: print("NO")
p02836
s431784116
Wrong Answer
s=str(input()) print(sum(a!=b for a,b in zip(s,s[::-1])))
p03351
s477263704
Accepted
a, b, c, d = map(int, input().split()) print('Yes') if (abs(a - c) <= d) | ((abs(a - b) <= d) & (abs(c - b) <= d)) else print('No')
p03449
s390843427
Wrong Answer
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) maxans=0 for i in range(n): ans=sum(a[0:i+1]+b[i:n]) maxans=max(ans,maxans) print(ans)
p03696
s376031041
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(500000) N = int(readline()) S = readline().decode("utf-8").rstrip() res = "" left_cnt = 0 for c in S: if '(' == c: left_cnt += 1 res += '(' elif ')' == c: if left_cnt > 0: res += ')' left_cnt -= 1 else: res = '(' + res + ')' if left_cnt != 0: res += ")" * left_cnt print(res)
p02761
s726975797
Accepted
n, m = map(int,input().split()) SC = [list(map(int, input().split())) for _ in range(m)] def check(num): num = str(num) if len(num) != n: return False for s, c in SC: if num[s-1] != str(c): return False return True for i in range(1000): if check(i): print(i) exit() print(-1)
p02690
s730791378
Wrong Answer
import sys x = int(input()) for i in range(-100, 100): for j in range(-100, 100): if i ** 5 - j ** 5 == x: print('{} {}'.format(i, j)) sys.exit()
p03795
s825623507
Accepted
N=int(input()) print(N*800-200*(N//15))
p02897
s793711548
Wrong Answer
N = int(input()) cnt = 0 for i in range(N): if N%2: cnt += 1 print(cnt/N)
p02971
s541013404
Wrong Answer
N = int(input()) A = [] my_max = 0 for _ in range(N): a = int(input()) A.append(a) my_max = max(my_max, a) max_count = A.count(a) if max_count > 1: [print(my_max) for _ in range(N)] else: my_next_max = max([a for a in A if a != my_max]) [print(my_max) if a != my_max else print(my_next_max) for a in A]
p03289
s427287418
Accepted
s = input() if (s[0] != 'A'): print('WA') exit() t = s[2:-1] if ('C' not in t or t.count('C') > 1): print('WA') exit() s = s[1:] s = s.replace('C', '') for x in s: if (x.islower() == False): print('WA') exit() print('AC')
p03103
s997645970
Accepted
n,m=map(int,input().split()) ab=[list(map(int,input().split())) for i in range(n)] ab.sort() ans=0 for i in range(n): if m>ab[i][1]: ans+=ab[i][0]*ab[i][1] m-=ab[i][1] else: ans+=ab[i][0]*m print(ans) break
p02759
s996520006
Accepted
N = int(input()) print(N // 2 + 1 if N % 2 else N // 2)
p03371
s698542381
Accepted
a, b, ab, x, y = map(int, input().split()) min_value = a * x + b * y max_num = max(x, y) for i in range(2, max_num * 2 + 1, 2): # print(i) value = ab * i + a * max(0, x - i // 2) + b * max(0, y - i // 2) # print(value) min_value = min(min_value, value) print(min_value)
p02833
s695249108
Wrong Answer
N = int(input()) ans = 0 if N % 2 == 0: num = 5 temp_N = N/2 while num < temp_N: ans += temp_N//num num *= 5 print(int(ans))
p03698
s723514115
Wrong Answer
s = input() print('yes' if list(s) == set(list(s)) else 'no')
p02647
s077193205
Accepted
n, k = map(int, input().split()) A = list(map(int, input().split())) for i in range(1, 100): imos = [0] * (n + 1) for j in range(n): imos[max(0, j - A[j])] += 1 imos[min(n, j + A[j] + 1)] -= 1 nA = [0] * n nA[0] = imos[0] for j in range(1, n): nA[j] = nA[j - 1] + imos[j] A = nA[:] if i >= k: break print(*A)
p03087
s518912603
Accepted
n, q = map(int, input().split()) s = input() ac_counter = [0] * n counter = 0 for i in range(n - 1): # ac_counter[i] = counter if s[i:i+2] == "AC": counter += 1 ac_counter[i + 1] = counter for i in range(q): l, r = map(int, input().split()) print(ac_counter[r - 1] - ac_counter[l - 1]) # print(ac_counter)
p02842
s995216826
Accepted
N = int(input()) for x in range(1, 5 * 10000 + 1): if int(x * 1.08) == N: print(x) break else: print(":(")
p02775
s963586933
Wrong Answer
def main(): cnt = 0 s = 0 y = "" a = "" for i in input()[::-1]: a += i k = int(i) if k + s <= 5: cnt += k + s y += str(k + s) s = 0 else: cnt += 10 - k - s y += "0" s = 1 if s == 1: y += "1" print(cnt + s) if __name__ == '__main__': main()
p03994
s636336407
Accepted
s=input() k=int(input()) ans='' for i in range(len(s)-1): if s[i]=='a': ans+='a' else: if k>=123-ord(s[i]): k-=(123-ord(s[i])) ans+='a' else: ans+=s[i] ans+=chr((ord(s[-1])-97+k)%26+97) print(ans)
p03282
s194651057
Accepted
import sys s=input() k=int(input()) for i in range(k): if s[i]!="1": print(s[i]) sys.exit() print(1)
p04033
s762535942
Wrong Answer
a,b = map(int,input().split()) if a * b <= 0: print(0) elif a > 0: print("Positive") else: if (b - a) % 2 == 0: print("Negative") else: print("Positive")
p02577
s573715794
Accepted
n = input() n = str(sum([int(i) for i in n])) n = str(sum([int(i) for i in n])) if int(n)%9==0: print('Yes') else: print('No')
p03774
s815687506
Wrong Answer
n, m = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(n)] c = [list(map(int, input().split())) for _ in range(m)] for i in a: mn = 10 ** 8 record = 0 for j, v in enumerate(c): temp = abs(i[0] - v[0]) + abs(i[1] - v[1]) if temp < mn: mn = temp record = j + 1 print(record)
p03037
s744600483
Wrong Answer
import sys N, M = map(int, sys.stdin.readline().split()) LR = sorted([list(map(int,sys.stdin.readline().split())) for i in range(M)]) if LR[0][1] - LR[M-1][0] >= 0: print(LR[0][1] - LR[M-1][0] + 1) else: print(0)
p03698
s668404848
Accepted
S = list(input()) print('yes' if len(set(S)) == len(S) else 'no')
p03131
s687948797
Wrong Answer
K, A, B = map(int, input().split()) if B - A <= 2 : print(K + 1) elif K < A + 1: print(K + 1) elif K == A + 1: print(B)
p03042
s399273602
Accepted
S = input() s1 = int(S[:2]) s2 = int(S[2:]) def is_MM(s): return 1 <= s <= 12 if is_MM(s1) and is_MM(s2): print('AMBIGUOUS') elif is_MM(s1): print('MMYY') elif is_MM(s2): print('YYMM') else: print('NA')
p03011
s241282440
Wrong Answer
p, q, r = map(int, input().split()) print(min(p+q, q+r, q+p))
p03105
s917535949
Accepted
#120_A A,B,C=map(int,input().split()) print(min(C,B//A))
p03524
s938432916
Accepted
import collections s = input() c = collections.Counter(s) if c["a"] == c["b"] == c["c"]: print("YES") exit() if c["a"]+1 == c["b"] == c["c"]: print("YES") exit() if c["a"]-1 == c["b"] == c["c"]: print("YES") exit() if c["a"] == c["b"]+1 == c["c"]: print("YES") exit() if c["a"] == c["b"]-1 == c["c"]: print("YES") exit() if c["a"] == c["b"] == c["c"]+1: print("YES") exit() if c["a"] == c["b"] == c["c"]-1: print("YES") exit() else: print("NO")
p02787
s183188217
Accepted
def chmin(a, b): if (a > b): return b return a def chmax(a, b): if (a < b): return b return a H, N = map(int, input().split()) li = [list(map(int, input().split())) for i in range(N)] dp = [[10**9] * (H+1) for i in range(N+1)] dp[0][0] = 0 for n in range(N): for h in range(0, H+1): dp[n+1][h] = chmin(dp[n+1][h], dp[n][h]) dp[n+1][min(h+li[n][0], H)] = chmin(dp[n+1][min(h+li[n][0], H)], dp[n+1][h]+li[n][1]) print(dp[N][H])
p02678
s956438694
Wrong Answer
import queue n, m = [int(i) for i in input().strip().split()] to = [[] for _ in range(n)] for i in range(m): a, b = [int(i)-1 for i in input().strip().split()] to[a].append(b) to[b].append(a) que = queue.Queue() dist = [float('inf')]*n pre = [-1]*n dist[0] = 0 que.put(0) while not que.empty(): v = que.get() for u in to[v]: if dist[u]!=float('inf'): continue dist[u] = dist[v] + 1 pre[u] = v que.put(u) print("yes") for i in range(1, n): print(pre[i]+1)
p02572
s362225368
Accepted
n=int(input()) l=list(map(int,input().split())) s=sum(l) su=0 for i in range(n): s=s-l[i] s=s%1000000007 su=su+(l[i]*s) su=su%1000000007 print(su)
p04005
s624040577
Accepted
A, B, C = map(int, input().split()) if A % 2 == 0 or B % 2 == 0 or C % 2 == 0: print(0) else: print(A * B * C // max(A, B, C))
p02793
s239491218
Accepted
import math import sys def lcm(a, b): return a * b // math.gcd(a, b) input = sys.stdin.readline n = int(input()) A = list(map(int, input().split())) LCM = 1 ans = 0 MOD = 1000000007 for x in A: LCM = lcm(LCM, x) for x in A: ans += LCM // x print(ans%MOD)
p03282
s362197069
Wrong Answer
S = list(input()) K = int(input()) ref = 0 for i in range(len(S)): if S[i] == "1": ref += 1 else: break ans = "" if ref == 0: ans = S[0] else: if ref >= K: ans = "1" else: ans = S[1] print(ans)
p03071
s792582375
Accepted
A, B = map(int, input().split()) ans = 0 for _ in range(2): if A >= B: ans += A A -= 1 else: ans += B B -= 1 print(ans)
p03448
s410290288
Accepted
a=int(input()) b=int(input()) c=int(input()) x=int(input()) count=0 for i in range(a+1): for j in range(b+1): for k in range(c+1): if 500*i+100*j+50*k==x: count+=1 print(count)
p03799
s266525897
Wrong Answer
n,m=map(int,input().split()) if n>= m*2: print(m//2);exit() ans=n m= m-2*n ; n=0 print(ans+m//4)
p02973
s934879583
Accepted
import bisect from collections import deque N = int(input()) A = [int(input()) for _ in range(N)] c = deque() c.append(A[0]) for i in range(1, N): j = bisect.bisect_left(c, A[i]) if j == 0: c.appendleft(A[i]) else: c[j-1] = A[i] print(len(c))
p02888
s523363055
Accepted
n = int(input()) L = list(map(int, input().split())) L.sort() count = 0 for i in range(n - 1, 1, -1): l = 0 r = i - 1 while l < r: if L[i] < L[r] + L[l]: count += r - l r -= 1 else: l += 1 print(count)
p02759
s222094881
Accepted
import math N=int(input()) print(math.ceil(N/2))
p03469
s152130064
Wrong Answer
a = input() b = a[0:4] f = a[5:7] c = int(a[-2:]) b = "2018" print(b + "/" + f + "/" + str(c))