problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03160
s824162929
Accepted
n=int(input()) lis=list(map(int,input().split(' '))) node=[0,abs(lis[1]-lis[0])]+[0]*(n-2) for i in range(2,n): x=abs(lis[i]-lis[i-1])+node[i-1] y=abs(lis[i]-lis[i-2])+node[i-2] node[i]=min(x,y) print(node[-1])
p02720
s606682904
Accepted
from collections import deque K = int(input()) d = deque([1,2,3,4,5,6,7,8,9]) for i in range(K-1): num = d.popleft() mod = num % 10 if mod != 0: d.append(num*10+mod-1) d.append(num*10+mod) if mod != 9: d.append(num*10+mod+1) print(d.popleft())
p02582
s184756821
Accepted
s = input() if "R" not in s: print(0) exit() ans = 1 for i in range(2): if s[i] == "R" and s[i+1] == "R": ans += 1 print(ans)
p03042
s786213098
Accepted
from sys import exit S = input() if 0 < int(S[0:2]) < 13: if 0 < int(S[2:]) < 13: print("AMBIGUOUS") else: print("MMYY") else: if 0 < int(S[2:]) < 13: print("YYMM") else: print("NA")
p02820
s869227253
Accepted
n, k = map(int, input().split()) r, s, p = map(int, input().split()) t = input() point = 0 win = [0 for i in range(len(t))] for i in range(len(t)): if t[i] == 'r': if (t[i-k] != 'r') or (win[i-k] != 1): point += p win[i] = 1 if t[i] == 's': if (t[i-k] != 's') or (win[i-k] != 1): point += r win[i] = 1 if t[i] == 'p': if (t[i-k] != 'p') or (win[i-k] != 1): point += s win[i] = 1 print(point)
p03131
s764047388
Wrong Answer
k, a, b = map(int, input().split()) if 2 >= b - a or k+1 <= a: print(k+1) else: i = (k-a+1)//2+1 ans = k+1 -a*i + b*i -2*i print(ans)
p03469
s686487319
Accepted
print(input().replace('2017', '2018'))
p02691
s097740930
Wrong Answer
n = int(input()) a = list(map(int, input().split())) count = 0 d={} for i in range(n): if i - a[i] in d: count+=d[i - a[i]] if i + a[i] in d: d[i+a[i]] + 1 else: d[i+a[i]] = 1 print(count)
p02707
s442217093
Wrong Answer
n = int(input()) a = input().split() for i in range(n): print(a.count(i+1))
p03861
s867981123
Accepted
a, b, x = map(int, input().split()) if a % x == 0: b -= b % x print((b - a)//x + 1) else: a -= a % x b -= b % x print((b - a)//x)
p04045
s855337982
Accepted
n,k = map(int,input().strip().split()) d = list(input().split()) for x in range(n,100000): for y in d: if y in str(x): break else: print(x) break
p02786
s086638251
Wrong Answer
h = int(input()) ans = 0 i = 0 while True: if(i>=h): break i+=1 if(i == 0): print(1) else: print(2**(i+1)-1)
p02665
s926683632
Accepted
import sys # import math N = int(input()) A = list(map(int, input().split())) kari = [0] * (N+1) ans = 0 nokori = 1 for i in range(N+1): if (nokori == 0)or(A[i] > nokori): print(-1) sys.exit() nokori -= A[i] ans += A[i] # dump((i,ans,nokori)) kari[i] = nokori nokori *= 2 mx = A[N] for i in reversed(range(N)): mx = min(kari[i], mx) ans += mx mx += A[i] print(ans)
p03659
s280194092
Accepted
import numpy as np N = int(input()) A = list(map(int, input().split())) sum_A = sum(A) snuke = np.cumsum(A)[:-1] kuma = sum_A - snuke ans = min(abs(snuke-kuma)) print(ans)
p02819
s346629289
Wrong Answer
X = int(raw_input()) def check_prime(X): import math s = int(math.ceil(math.sqrt(X))) print s for a in range(2, s): print X, a if X % a == 0: return False return True while True: if check_prime(X): break X += 1 print X
p03241
s515945735
Accepted
import math N,M = map(int,input().split()) def f(M): l = [] for i in range(1,int(math.sqrt(M))+1): if M%i==0: l.append(i) n = len(l) for i in range(n): j = l[n-1-i] if M/j!=j: l.append(M//j) return l l = f(M) for i in range(len(l)): n = l[-1-i] if M/n >= N: ans = n break print(ans)
p03951
s495419083
Accepted
n = int(input()) s = input() t = input() ans = n * 2 chk = False for i in range(n): j = 0 while i+j < n: if s[i+j] == t[j]: ans -= 1 j += 1 chk = True else: ans = n * 2 chk = False break if chk: break print(ans)
p02882
s957978994
Wrong Answer
# -*- coding: utf-8 -*- """ Created on Wed Sep 9 19:58:50 2020 @author: liang """ import math a, b, x = map(int, input().split()) if x >= a**2*b/2: ans = math.degrees(math.atan((b-x/a**2)/a*2)) else: ans = 90 - math.degrees(math.atan(x/a/b**2)) print(ans)
p02659
s574671079
Accepted
a, b = input().split() print(int(a) * round(float(b) * 100) // 100)
p03951
s060452198
Accepted
N = int(input()) s = input() t = input() c = 0 for o in range(len(s) + 1): d = 0 for i in range(len(t)): if o + i >= len(s): break if s[o + i] == t[i]: d += 1 else: break c = max(c, d) print(len(s) + len(t) - c)
p03679
s067328234
Wrong Answer
X, A, B = map(int, input().split()) if B - A < X: print('safe') else: print('dangerous')
p03239
s161965381
Accepted
n,tmax=map(int,input().split()) m=1001 for i in range(n): c,t=map(int,input().split()) if t<= tmax: m = min(m,c) print("TLE" if m == 1001 else m)
p03644
s585164989
Wrong Answer
n = int(input()) x = 1 cnt = 1 while x < n: x = 2 ** cnt cnt += 1 print(x/2)
p02963
s412384571
Wrong Answer
print(0, 0, 0, 1, input(), 0)
p02787
s379272731
Accepted
h, n = map(int, input().split()) a = [0] * n b = [0] * n for i in range(n): a[i], b[i] = map(int, input().split()) dp = [[1e18] * (h + 1) for _ in range(n + 1)] dp[0][0] = 0 for i in range(n): for j in range(h + 1): dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]) dp[i + 1][min(j + a[i], h)] = min(dp[i + 1][min(j + a[i], h)], dp[i + 1][j] + b[i]) print(dp[n][h])
p03479
s659073922
Accepted
import sys x,y=map(int,input().split()) output=0 while True: if x * (2**output) >y : print(output) sys.exit() else: output+=1
p02859
s462780687
Accepted
r = int(input()) print(int(r * r))
p02582
s332945685
Accepted
s=input() if s=='RRR': print(3) elif s=='SRR': print(2) elif s=='RRS': print(2) elif s=='SSS': print(0) else: print(1)
p02630
s790686443
Accepted
n=int(input()) l=list(map(int,input().split())) freq={} for i in range(n): freq[l[i]]=0 for i in range(n): freq[l[i]]+=1 t=int(input()) sm=sum(l) for i in range(t): a,b=map(int,input().split()) if(a not in freq.keys()): print(sm) else: if(b not in freq.keys()): freq[b]=0 #diff=abs(freq[b]-freq[a]) sm=sm-a*freq[a]+b*freq[a] freq[b]+=freq[a] freq[a]=0 print(sm)
p03719
s430589441
Accepted
A,B,C=map(int,input().split()) if A<=C and C<=B: print("Yes") else: print("No")
p03543
s956414657
Wrong Answer
n=input() ans=0 for i in range(4): if n[i-2]==n[i-1]==n[i]: ans+=1 if ans==0: print("No") else: print("Yes")
p03386
s415562444
Wrong Answer
A,B,K = map(int, input().split()) ans = [] for i in range(A, A+K): ans.append(i) for i in range(B-K+1, B+1): ans.append(i) ans = set(ans) for i in ans: if i>=A and i<=B: print(i)
p02814
s641145397
Accepted
from fractions import gcd from functools import reduce N, M = map(int, input().split()) A = list(map(int, input().split())) AA = list(map(lambda x: x//2, A)) def lcm(x, y): return x * y // gcd(x, y) b0 = AA[0]&-AA[0] for a in AA[1:]: if b0 != a&-a: print(0) break else: a = reduce(lcm, AA) print(M//a - M//(2*a))
p02612
s281743336
Accepted
N = int(input()) ans = 0 for i in range(11): if 1000*i >= N: ans = 1000*i - N break print(ans)
p02787
s050856661
Accepted
#!/usr/bin/env python3 from itertools import product, permutations, combinations from bisect import bisect_right,bisect_left INF = float('inf') H, N=map(int, input().split()) dp = [0 for i in range(H + 10**4 + 1)] hm = list(list(map(int, input().split())) for i in range(N)) for i in range(1, H+1): dp[i] = min(list(dp[i - h] + m for h, m in hm)) print(dp[H])
p02917
s217183059
Accepted
N = int(input()) bs = list(map(int,input().split())) list_a= [bs[0]] for i in range(1,len(bs)): a = min(bs[i-1],bs[i]) list_a.append(a) list_a.append(bs[len(bs)-1]) print(sum(list_a))
p03163
s995380384
Wrong Answer
N,W=map(int,input().split()) WV=[] for i in range(N): WV.append(list(map(int,input().split()))) dp=[[-1e-30 for j in range(W+1)] for i in range(N)] dp[0][0]=0 dp[0][WV[0][0]]=WV[0][1] for i in range(1,N): for j in range(W+1): if j-WV[i][0]>=0: dp[i][j]=max(dp[i-1][j],dp[i-1][j-WV[i][0]]+WV[i][1]) else: dp[i][j]=dp[i-1][j] print(int(dp[N-1][W]))
p03416
s254538701
Accepted
a, b = map(int, input().split()) cnt = 0 for i in range(a, b + 1): if str(i) == str(i)[::-1]: cnt += 1 print(cnt)
p03284
s748640895
Wrong Answer
N, K = list(map(int, input().split())) print(N%K)
p03785
s739237698
Accepted
from sys import stdin n,c,k = [int(x) for x in stdin.readline().rstrip().split()] li = [int(stdin.readline().rstrip()) for _ in range(n)] li.sort() time = li[0] people = 0 bus_num = 1 for i in li: people += 1 if i-time > k or people > c: bus_num += 1 time = i people = 1 print(bus_num)
p02972
s560220508
Wrong Answer
N = int(input()) a = list(map(int, input().split())) #print(a) b = [0]*(N) for i in range(N, 0, -1): to = 0 #print(i) for j in range(i-1, N ,i): to += b[j] if to%2 != a[i-1]: b[i-1] = 1 #print(b) if sum(b)==0: print(-1) else: print(sum(b)) ans = str() for i in range(N): if b[i]: ans += str(i+1)+" " print(ans)
p02701
s053263663
Wrong Answer
N=int(input()) goods=[] for i in range(N): s=input() goods.append(s) l=[x for x in set(goods) if goods.count(x)>1] print(N-len(l))
p03285
s402519044
Wrong Answer
n=int(input()) if n==0: print("No") else: print("Yes"if n%4==0 or n%7==0 or n%11==0 or n%18==0 or n%15==0 else "No")
p02802
s944599504
Accepted
N,M = map(int,input().split()) p_list=["WA"]*N count = [0]*2 wa_count= [0]*N for i in range(M): p,s = input().split() p = int(p) if(p_list[p-1]=="WA" and s=="WA"): wa_count[p-1]+=1 elif(p_list[p-1]=="WA" and s=="AC"): p_list[p-1]=s count[0]+=1 count[1]+=wa_count[p-1] print(' '.join(list(map(str,count))))
p02835
s324322562
Accepted
def resolve(): tmp = sum(map(int,input().split())) if tmp <=21: print("win") else: print("bust") if __name__ == "__main__": resolve()
p02660
s668259474
Wrong Answer
import math N = int(input()) use_li = [0]*(math.ceil(math.sqrt(N))+1) c = 0 while N!=1: for i in range(2,math.ceil(math.sqrt(N))+1): if(N%i==0 and use_li[i]==0): #print(i) use_li[i] = 1 N //= i c += 1 break if (i==math.ceil(math.sqrt(N))): if(len(use_li)<N or use_li[i] == 1): c += 1 break print(c)
p02621
s700980886
Wrong Answer
N = int(input()) def g(n): return (n * (n + 1))//2 total = 0 for i in range(1,N+1): total += i * g(N//i) print(total)
p03797
s248307139
Accepted
N, M = map(int, input().split()) ans = 0 if(M//2 >= N): ans += N M = M - N*2 ans += M//4 else: ans += M//2 print(ans)
p03854
s137923219
Accepted
s = input() s = s.replace('eraser', '') s = s.replace('erase', '') s = s.replace('dreamer', '') s = s.replace('dream', '') if len(s) == 0: print('YES') else: print('NO')
p02958
s333361151
Accepted
import sys input = sys.stdin.readline import math import collections def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) n=I() ps=LI() count=0 for i in range(n): if ps[i]!=i+1: count+=1 if count<=2: print("YES") else: print("NO")
p03860
s989656242
Accepted
A, s, C = input().split() print(A[0]+s[0]+C[0])
p03359
s954633494
Wrong Answer
a,b = map(int,input().split()) a_list = [i for i in range(1,a+1)] b_list = [i for i in range(1,b+1)] a_len = len(a_list) b_len = len(b_list) if a_len <= b_len: print(a_len) elif a_len == b_len: print(a_len) else: print(b_len)
p02911
s977068572
Wrong Answer
import sys from collections import Counter N, K, Q = map(int, input().split()) if K > Q: for _ in range(N): print("Yes") sys.exit() result = ["No"]*N Npoint = [K-Q]*N Alist = [int(input())-1 for _ in range(Q)] Alist = Counter(Alist) for k, v in Alist.items(): Npoint[k] += v if Npoint[k] >= 1: result[k] = "Yes" for i in result: print(i)
p03730
s620059632
Wrong Answer
a,b,c=map(int,input().split()) a=a%2 b=b%2 c=b%2 if a==0 and b==0 and c==1: print('NO') elif a==1 and b==0 and c==0: print('NO') elif a==1: print('YES') else: print('YES')
p03639
s752222449
Wrong Answer
N = int(input()) multiple_of_4 = len(list(filter(lambda x : x % 4 == 0, [int(x) for x in input().split()]))) not_4 = N - multiple_of_4 print('Yes' if 2 * multiple_of_4 >= not_4 else 'No')
p03145
s187176566
Accepted
ab,bc,ca=map(int,input().split()) print(ab*bc//2)
p02801
s418917267
Accepted
C = input() Alphabet = 'abcdefghijklmnopqrstuvwxyz' Alphabet_list = list(Alphabet) i = 0 while (i < 26): if Alphabet_list[i] == C: print(Alphabet_list[i+1]) break else: i = i+1
p02697
s256441106
Wrong Answer
N,M=map(int, input().split()) a=N//2 b=a+1 if N&1: for i in range(M): print(a,b) a-=1 b+=1 else: for i in range(M): print(a,b) a-=1 b+=1 if b-a==N//2: b+=1
p02881
s453216115
Accepted
n = int(input()) List = [] for i in range(1, 10**6+1): if n%i == 0: List.append(i+n//i) #print(List) print(min(List)-2)
p02814
s716441607
Wrong Answer
import fractions import math def lcm(x, y): return (x * y) / fractions.gcd(x, y) n, m = map(int, input().split()) a = [i // 2 for i in set(list(map(int, input().split())))] b = [] for i in a: cnt = 0 while i % 2 == 0: i /= 2 cnt += 1 b.append(cnt) L = 1 if len(set(b)) == 1: for j in a: L = lcm(L, j) if m < L: print(0) break print(int((m // L + 1) // 2)) else: print(0)
p02627
s912693503
Accepted
print('Aa'[input().islower()])
p02657
s918313131
Wrong Answer
# 169A # A × B を整数として出力せよ # 1.入力をプログラムで扱えるように受け取ること a, b = map(int, input().split()) print(a,b) # 2.受け取った入力値を使って、適切に処理(計算)すること answer = a * b # 3.計算した結果を出力すること print(answer)
p02717
s975865944
Accepted
x, y, z = map(int, input().split()) print(z, x, y)
p03161
s506274670
Accepted
N,K=map(int,input().split()) h=[int(i) for i in input().split()] f_inf=float('inf') dp=[f_inf]*(N+10) dp[0]=0 for i in range(1,N): for j in range(1,K+1): if i-j>=0: dp[i]=min(dp[i-j]+abs(h[i]-h[i-j]),dp[i]) print(dp[N-1])
p03408
s984700541
Accepted
def l(): return [input() for _ in range(int(input()))] p, m = l(), l() c = 0 for s in set(p): c = max(p.count(s) - m.count(s), c) print(c)
p02987
s871883162
Accepted
from collections import Counter S = list(input()) c = Counter(S) if len(c) != 2: print("No") else: for k, v in c.items(): if v != 2: print("No") break else: print("Yes")
p03860
s801573758
Wrong Answer
N = str(input().split()) a = N[1] print(str('A'+ a[0] + 'C'))
p03474
s819603315
Accepted
a, b = map(int, input().split()) s = input() t = s[:a] + s[a + 1:] if s[a] == "-" and t.isdigit(): print("Yes") else: print("No")
p02646
s471543067
Wrong Answer
info_A = input().split() info_B = input().split() T = int(input()) A = int(info_A[0]) #A(鬼)の開始位置 V = int(info_A[1]) #A(鬼)の速度 B = int(info_B[0]) #B(逃げる側)の開始位置 W = int(info_B[1]) #B(逃げる側)の速度 if B + W * T < A + V * T: #T秒後に鬼が追いついているまたは追い越すなら捕まえられる print('YES') else: print('NO')
p02775
s144809793
Accepted
import sys n = sys.stdin.readline().rstrip() l = len(n) def main(): dp0 = [None] * (l + 1) dp1 = [None] * (l + 1) dp0[0] = 0 dp1[0] = 1 for i in range(l): d = int(n[i]) dp0[i+1] = min(dp0[i]+d, dp1[i]+10-d) dp1[i+1] = min(dp0[i]+d+1, dp1[i]+10-d-1) return dp0[l] if __name__ == '__main__': ans = main() print(ans)
p02811
s276409918
Wrong Answer
A = list(map(int, input().split())) K = A[0] X = A[1] money = K*500 if X < 500: print ("No") else: print("Yes")
p03760
s694660796
Accepted
o=input() e=input() a="" if len(o)!=len(e): e+=" " for i in range(len(o)): a+=o[i]+e[i] print(a[:-1]) else: for i in range(len(o)): a+=o[i]+e[i] print(a)
p02645
s234206312
Wrong Answer
s = str(input()) print(s[0:2])
p03767
s464038524
Accepted
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): N=int(input()) A=sorted(list(map(int,input().split()))) i=0 cnt=0 while True: try: cnt+=A[N+2*i] i+=1 except: break print(cnt) resolve()
p02624
s343139734
Wrong Answer
N = int(input()) M = 0 M += 5 for K in range(3, N+1): A = [d for d in range(1,K+1) if K % d ==0] M += K * len(A) print(M)
p03998
s864067856
Wrong Answer
card_dict = {} card_dict['a'] = input() card_dict['b'] = input() card_dict['c'] = input() turn = 'a' while True: card_dict[turn] = card_dict[turn][1:] if not card_dict[turn]: break turn = card_dict[turn][0] print(turn.upper())
p02772
s640935104
Accepted
n = int(input()) a = list(map(int,input().split())) count = 0 count2 = 0 for i in a: if i%2 == 0: count += 1 if i%3 == 0 or i%5 == 0: count2 += 1 if count == count2: print("APPROVED") else: print("DENIED")
p03592
s762899240
Wrong Answer
def solve(): N, M, K = map(int, input().split()) for i in range(1, N+1): for j in range(1, M+1): if i*(M-j) + j*(N-i) == K: print("Yes") return print("No") solve()
p02713
s087353286
Accepted
from fractions import gcd import math K = (int)(input()) sum = 0 for a in range(3,K+1): for b in range(2,a): for c in range(1,b): sum += 6*math.gcd(math.gcd(a,b),c) for a in range(1,K+1): sum += a for a in range(2,K+1): for b in range(1,a): sum += 6*math.gcd(a,b) print(sum)
p03043
s037813968
Accepted
N, K = map(int, input().split()) # 出た目をaとすると、log_2([N/a])回振る必要がある. # 求めるのは(1/N)*(1/2)**log_2([N/a]) ans = 0 for i in range(1, N+1): tmp = 1 / N now = i while now < K: now *= 2 tmp /= 2 ans += tmp print(ans)
p02678
s892995584
Wrong Answer
import sys N, M = map(int, input().split()) Nlist = [0]*(N+1) for i in range(1,M+1): A, B = map(int, input().split()) if Nlist[A]>B or Nlist[A]==0: Nlist[A]=B if Nlist[B]>A or Nlist[B]==0: Nlist[B]=A print('Yes') for i in range(N-1): print(Nlist[i+2])
p03624
s698024426
Wrong Answer
s = list(input()) exist = 'abcdefghijklmnopqrstuvwxyz' j = 0 s = set(s) s = sorted(s) for i in s: if i == exist[j]: pass elif i != exist[j]: print(exist[j]) break if j+1 == len(s): print('None') j += 1
p03206
s318498258
Accepted
a=int(input()) print("Christmas"+" Eve"*(25-a))
p03327
s450037344
Accepted
nim = int(input()) if nim <=999: print("ABC") else: print("ABD")
p03136
s458036492
Accepted
n = int(input()) list = [int(i) for i in input().split()] max = max(list) sum = sum(list) if sum > 2*max: print("Yes") else: print("No")
p03605
s154855850
Accepted
x = str(input()) if x[0]=='9' or x[1]=='9': print('Yes') else: print('No')
p03075
s703524449
Wrong Answer
a=int(input()) b=int(input()) c=int(input()) d=int(input()) e=int(input()) k=int(input()) if e-a<=k:print("Yey!") else:print(":(")
p03720
s496230095
Accepted
N, M = map(int,input().split()) brd = [list(map(int, input().split())) for i in range(M)] nbrd = sum(brd, []) for i in range(1, N+1): print(nbrd.count(i))
p02791
s266615188
Accepted
N = int(input()) P = list(map(int, input().split())) Q = [] m = 10**17 for p in P: m = min(m, p) Q.append(m) c = 0 for x, y in zip(P, Q): if x <= y: c += 1 print(c)
p02772
s911257161
Accepted
import sys n=int(input()) a=list(map(int,input().split())) for i in a: if i%2==0: if i%3!=0 and i%5!=0: print("DENIED") sys.exit() print("APPROVED")
p03438
s011387756
Accepted
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) x = y = 0 for i in range(n): x += b[i]-a[i] if a[i]<b[i]: y+=(b[i]-a[i]+1)//2 print("YNeos"[y>x::2])
p02780
s753658882
Accepted
raw = input() N, K = raw.split(' ') N = int(N) K = int(K) str_li = input().split(' ') num_li = list(map(int, str_li)) sum_li = [0] for i in num_li: sum_li.append(sum_li[-1] + i + 1) ans = 0 for index in range(K, N+1): ans_tmp = sum_li[index] - sum_li[index - K] if ans_tmp > ans: ans = ans_tmp print(ans/2)
p02756
s341484916
Wrong Answer
from collections import deque s = input() q = int(input()) query = [list(input().split()) for i in range(q)] now = 0 a = deque([s]) for i in query: if i[0] == "1": now ^= 1 elif i[0] == "2": f,c = int(i[1]),i[2] if (f+now) % 2: a.appendleft(c) else: a.append(c) if now: a.reverse() ans = "".join(a) print(ans)
p02959
s735823489
Wrong Answer
n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) cnt = 0 beforeKill = 0 for i in range(n): kill1 = min(A[i], B[i] - beforeKill) kill2 = max(min(A[i+1], B[i]-kill1), 0) cnt += kill1 + kill2 beforeKill = kill2 print(cnt)
p02959
s483214960
Accepted
N = int(input()) A = [int(m) for m in input().split(" ")] B = [int(b) for b in input().split(" ")] Sum = 0 for i in range(N): ai = A[i] ai_1 = A[i+1] a = ai_1 + ai b = B[i] if a<=b: A[i+1]=0 Sum+=a else: if (ai - b)>0: Sum+=(b) else: A[i+1] = a-b Sum+=b print(Sum)
p03699
s362887839
Wrong Answer
n= int(input()) List = [] for i in range(n): x = int(input()) List.append(x) List = sorted(List) total = sum(List) for item in List: if total % 10 != 0: print(total) exit() elif total % 10 == 0: if item % 10 != 0: print(total-item) exit() else: total -= item print(total)
p03351
s723031850
Accepted
def main(): a, b, c, d = map(int, input().split()) if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d): print("Yes") else: print("No") if __name__ == "__main__": main()
p03206
s019066638
Wrong Answer
d=int(input()) ans={25:"Christmas",24:"Cristmas Eve",23:"Cristmas Eve Eve",22:"Cristmas Eve Eve Eve"} print(ans[d])
p03107
s309451346
Wrong Answer
import collections i,j = 0,0 s = raw_input() q = collections.deque([]) while(j < len(s)): while(j < len(s) and s[j] == s[i]): j+=1 q.append(j - i ) i = j ns = len(s) while(len(q) > 1): u,v = q.popleft(), q.popleft() if q: q[0] += abs(u-v) print ns - (q[0] if q else 0)
p03457
s011969757
Wrong Answer
N = int(input()) t = [0]*100001 x = [0]*100001 y = [0]*100001 for n in range(N): t[n+1], x[n+1], y[n+1] = map(int, input().split()) ans = True for n in range(N): dt = t[n+1] - t[n] dist = (x[n+1] - x[n]) + (y[n+1] - y[n]) if dt < dist: ans = False if dt % 2 != dist % 2: ans = False if ans: print('Yes') else: print('No')