problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03778
s282215348
Accepted
w,a,b = map(int, input().split()) dx = abs(a-b) print(max(dx-w,0))
p03380
s168831950
Accepted
n = int(input()) al = list(map(int, input().split())) als =list(sorted(al)) m = als[n-1] import bisect x = bisect.bisect(als,m/2) if abs(m/2 - als[x-1]) > abs(m/2 - als[x]): print(m,als[x]) else: print(m,als[x-1])
p03623
s528968879
Wrong Answer
z,a,b=map(int,input().split());print('BA'[(z-a)//(z-b)==0])
p03067
s354205246
Accepted
a,b,c=map(int,input().split()) if min(a,b)<c<max(a,b): print('Yes') else: print('No')
p02547
s267706775
Wrong Answer
n = int(input()) for _ in range(n): a, b = map(int, input().split()) if a == b: print("Yes") exit() print("No")
p02843
s307272655
Accepted
import sys import heapq import math import fractions import bisect import itertools from collections import Counter from collections import deque from operator import itemgetter def input(): return sys.stdin.readline().strip() def mp(): return map(int,input().split()) def lmp(): return list(map(int,input().split())) x=int(input()) a,b=divmod(x,100) if a*5>=b: print(1) else: print(0)
p02676
s634753601
Wrong Answer
K = int(input()) S = input() if len(S)<=K: print(S) else: print(S[:7]+'...')
p02801
s333737281
Accepted
CA=input() code=ord(CA) print(chr(code+1))
p02987
s524500038
Wrong Answer
S = sorted(input()) print('Yes' if set(S)==2 and S.count(S[0])==2 else 'No')
p02681
s798719106
Accepted
S = input() T = input() if T[:len(S)] == S: print("Yes") else: print("No")
p02848
s586679935
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) S = readline().decode().rstrip() ans = '' A = ord('A') for i in range(len(S)): char = chr(A + (ord(S[i])+N-A)%26) ans += char print(ans)
p02924
s147889720
Accepted
N = int(input()) ans = N * (N + 1) // 2 - N print(ans)
p02613
s628611180
Wrong Answer
n=int(input()) ans=[0,0,0,0] for i in range(n): a=str(input()) if a=="AC": ans[0]+=1 elif a=="WA": ans[1]+=1 elif a=="TLE": ans[2]+=1 else: ans[3]+=0 print("AC x "+str(ans[0])) print("WA x "+str(ans[1])) print("TLE x "+str(ans[2])) print("RE x "+str(ans[3]))
p03324
s324817471
Wrong Answer
D, N = map(int, input().split()) if D == 0 or D % 100 != 0: ans = 100 ** D * N else: ans = 100 ** D * (N+1) print(ans)
p04012
s350151378
Wrong Answer
W = input() W_list = set(list(s for s in W)) ans = True for s in W_list: if W.count(s) % 2 != 0: ans = False break print(W_list) if ans: print("Yes") else: print("No")
p03161
s332350784
Accepted
N, K = map(int, input().split()) h = list(map(int, input().split())) inf = float('inf') dp = [inf] * N dp[0] = 0 for i in range(N-1): for j in range(1, K+1): if i+j < N: dp[i+j] = min(dp[i]+abs(h[i]-h[i+j]), dp[i+j]) print(dp[N-1])
p03997
s104373115
Accepted
a = int(input()) b = int(input()) h = int(input()) print((a+b)*h//2)
p03485
s033164468
Accepted
a, b = map(int, input().split()) c = (a+b) / 2 print(int(c+0.9))
p03339
s216082625
Wrong Answer
N = int(input()) S = input() def f(S): count = S.count('E') for s in S: yield count count += 1 if s == 'W' else -1 print(min(list(f(S))))
p02594
s341342766
Wrong Answer
K = int(input()) x = 7 % K for i in range(1, K + 1): if x == 0: print(i) break x = (x * 10 + 7) % K else: print(-1)
p03471
s405630279
Accepted
#-*-coding:utf-8-*- import sys def main2(): 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) sys.exit() print(-1,-1,-1) if __name__=="__main__": main2()
p03605
s947229879
Wrong Answer
#二進数に9は入るか N = input(int()) if N in [19, 29, 39, 49, 59, 69, 79, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]: print('Yes') else: print('No')
p03795
s986924715
Accepted
N=int(input(),10) paid = N*800 got = N//15 * 200 print(paid-got)
p02641
s355040249
Accepted
X,N = map(int,input().split()) p = list(map(int,input().split())) i = 0 j = 0 flag = 0 while True: if(X - i in p): i += 1 else: flag = 1 break if(X + j in p): j += 1 else: flag = 2 break if(flag == 1): print(X - i) elif(flag == 2): print(X + j)
p03286
s925263332
Accepted
n=int(input()) ans=[] if(n==0): print(0) exit() while n!=0: r=n%2 ans.append(r) n=int((n-r)/(-2)) ans.reverse() for i in ans: print(i,end='')
p02860
s022859150
Accepted
N = int(input()) s = input() if N%2==1: print('No') else: if s[:(N//2)]==s[N//2:]: print("Yes") else: print('No')
p03555
s039282066
Wrong Answer
c1 = input().split() c2 = input().split() if c1 == c2[-1:] and c2 == c1[-1:]: print("YES") else: print("NO")
p02596
s491243647
Accepted
k = int(input()) a = 0 for i in range(k): a = (a*10+7)%k if a == 0: print(i+1) quit() print(-1)
p03944
s375332588
Wrong Answer
w, h, n = map(int, input().split()) xmin, xmax, ymin, ymax = 0,w,0,h for i in range(n): xi,yi,ai = map(int, input().split()) if ai == 1: xmin = xi if ai == 2: xmax = xi if ai == 3: ymin = yi if ai == 4: ymax = yi if xmax < xmin or ymax < ymin: menseki = 0 else: menseki = (xmax-xmin) * (ymax-ymin) print(menseki)
p02924
s653005498
Accepted
N = int(input()) print(N*(N-1)//2)
p02615
s561506767
Accepted
N = int(input()) A = list(map(int,input().split())) A.sort(reverse = True) #print(A) if N%2 == 0: print(sum(A[:N//2]) * 2 - A[0]) if N%2 == 1: #print(A[:N//2+1],A[N//2+1]) print(sum(A[:N//2+1]) * 2 - A[0] - A[N//2])
p03699
s722661008
Accepted
#!/usr/bin/env python3 n, *a = map(int, open(0).read().split()) s = sum(a) if s % 10 > 0: print(s) else: m = sorted(i for i in a if i % 10 > 0) if len(m): print(s - m[0]) else: print(0)
p03565
s922650573
Wrong Answer
import re def main(): s = input().replace("?", ".") t = input() ans = [] for i in range(len(s)-len(t)+1): if not re.match(s[i:i+len(t)], t): continue tmp = (s[:i] + t + s[i+len(t)+1:]).replace(".", "a") ans.append(tmp) if not ans: print("UNRESTORABLE") else: print(min(ans)) if __name__ == "__main__": main()
p02699
s738525629
Accepted
S, W = [int(i) for i in input().split()] if S <= W: print('unsafe') else: print('safe')
p02572
s932264108
Accepted
mod = 10**9 + 7 n=int(input()) s=list(map(int,input().split())) s2=sum(map(lambda x: x ** 2,s)) ans=(((sum(s))**2)-(s2))//2%mod print(ans)
p02791
s661987074
Accepted
# 個数を返す n = int(input()) ps = list(map(int, input().split())) _min = ps[0] mins = [] for p in ps: if p < _min: _min = p mins.append(_min) count = 0 for i in range(n): if ps[i] <= mins[i]: count+=1 print(count)
p03821
s434637723
Accepted
import sys def solve(): input = sys.stdin.readline N = int(input()) array = [[int(a) for a in input().split()] for _ in range(N)] count = 0 for i in reversed(range(N)): a, b = array[i] if (a + count) % b == 0: continue else: count += b - ((a + count) % b) print(count) return 0 if __name__ == "__main__": solve()
p02596
s745309398
Accepted
k = int(input()) cnt = 1 mod = 7 for i in range(k): if mod%k == 0: break cnt+=1 mod = (mod*10 + 7)%k if mod%k == 0: print(cnt) else: print(-1)
p02602
s540680168
Wrong Answer
import numpy as np # = int(input()) # = str(input()) N, K = map(int, input().split()) A = list(map(int, input().split())) # = [int(input()) for i in range(N)] # = [list(map(int, input().split())) for i in range(N)] first = np.asarray(A[:K]) fscore = np.prod(first) for i in range(K, N): fq, score = divmod(fscore, 10**10) nextfscore = fscore * A[i] //A[i-K] q, nextscore = divmod(nextfscore, 10**10) if q > fq or (q == fq and nextscore > score): print("Yes") else: print("No") fscore = nextfscore
p02726
s956148549
Accepted
import sys n, x, y = map(int, input().split()) res = {} for i in range(1, n + 1): for j in range(i + 1, n + 1): d = min(abs(i - j), min(abs(i - x) + 1 + abs(j - y), abs(i - y) + 1 + abs(j - x))) #print(i, j, d) if d in res: res[d] += 1 else: res[d] = 1 for k in range(1, n): if k in res: print(res[k]) else: print(0)
p03471
s107134838
Wrong Answer
import sys N,Y = map(int,input().split()) for a in range(N+1): for b in range(N-a): c = N - a - b if 10000 * a + 5000 * b + 1000 * c == Y: print(a,b,c) sys.exit() print("-1 -1 -1")
p02939
s986595490
Wrong Answer
s = input() ans = 1 tmp = s[0] t = False for i in range(1, len(s)): if tmp == s[i] and i == len(s) - 1: break if t: tmp = s[i - 1] + s[i] t = False ans += 1 continue if tmp == s[i]: t = True else: ans += 1 tmp = s[i] print(ans)
p02916
s606110681
Accepted
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) addans=0 for i in range(n-1) : if a[i]+1 == a[i+1] : addans += c[a[i]-1] print(sum(b)+addans)
p02753
s299181278
Wrong Answer
Flag = 0 S = input() SA = [str(c) for c in S] A = list(['A','A','A']) B = list(['B','B','B']) print(SA) if(set(S) == set(A) and set(S) ==set(B)): print("No") else: print("Yes")
p02900
s465516832
Accepted
def primeFact(n): i = 2 pl = [] while i * i <= n: while n % i == 0: n /= i pl.append(i) i += 1 if n > 1: pl.append(int(n)) return pl a, b = map(int, input().split()) print(len(set(primeFact(a)) & set(primeFact(b))) + 1)
p02787
s774507468
Accepted
def main(): h, n = map(int,input().split()) magics = [] for i in range (n): a, b = map(int,input().split()) magics.append([a,b]) # Using Secondary Array in For Loop dp = [0] * (h + max(a for a, b in magics)) for i in range(1, h + 1): dp[i] = min(dp[i - a] + b for a, b in magics) print(dp[h]) if __name__ == '__main__': main()
p03043
s369804560
Wrong Answer
N, K = list(map(int, input().split())) E = 0 for i in range(1, N + 1): cnt = N + 2 - i E += 0.5 ** cnt print(E / N)
p02725
s930486781
Accepted
import numpy as np N,K = list(map(int, input().split())) A = list(map(int, input().split())) A_diff = np.diff(A) A_diff_sum = np.sum(A_diff) max_diff = np.max([np.max(A_diff), (N - A[-1] + A[0])]) ans = A_diff_sum - max_diff + (N - A[-1] + A[0]) print(ans)
p03838
s006561448
Accepted
x,y = map(int,input().split()) if 0 <= x < y or x < y <= 0: print(abs(y-x)) elif 0 < y < x or y < x < 0: print(abs(x-y) + 2) elif x < y: if y < abs(x): print(abs(x)-y + 1) else: print(y-abs(x) + 1) else: if x < abs(y): print(abs(y)-x + 1) else: print(x-abs(y) + 1)
p03030
s851096305
Wrong Answer
n = int(input()) s = [input().split() for i in range(n)] temp = s data = sorted(s,key=lambda x:(x[0],-int(x[1]))) for i in range(n): y = temp[i] result = data.index(y) print(result+1)
p02676
s651740885
Wrong Answer
def main(): k = int(input()) s = input() l = len(s) if l <= k: print(s) else: print(s+"...") if __name__ == '__main__': main()
p02785
s546468888
Accepted
A,B = list(map(int,input().split())) s = list(map(int,input().split())) s1 = sorted(s,reverse = True) s2 = s1[B::] print(sum(s2))
p02661
s250416229
Accepted
n=int(input()) alist=[] blist=[] for i in range(n): a, b = map(int,input().split()) alist.append(a) blist.append(b) alist=sorted(alist) blist=sorted(blist) if n%2==1: center=(n-1)//2 answer=blist[center]-alist[center]+1 print(answer) else: #print(alist, blist) mae=(alist[(n//2)-1]+alist[(n//2)])/2 ato=(blist[(n//2)-1]+blist[(n//2)])/2 #print(mae, ato) print(int((ato-mae)*2+1))
p02982
s587717414
Accepted
n,d = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(n)] def dist_squere(x, y): d = 0 for i,j in zip(x,y): d += (i-j)**2 return d**.5 from itertools import combinations ans = 0 for x,y in combinations(X, 2): if dist_squere(x, y).is_integer(): ans += 1 print(ans)
p03543
s677892493
Wrong Answer
N=input() count=0 for i in range(3): #print(N[i]) if N[i]==N[i+1]: count=count+1 if count>1: print("Yes") else: print("No")
p02947
s328150767
Wrong Answer
n = int(input()) dic = {} for i in range(n): s = ''.join(sorted(list(input()))) if s not in dic: dic[s] = 0 dic[s] += 1 ans = 0 for i in dic.values(): ans += i * (i - 1) print(ans)
p03359
s578782184
Accepted
a,b=map(int,input().split()) ans= a if a<=b else a-1 print(ans)
p03475
s408915383
Accepted
def f(): n=int(input()) l=[list(map(int,input().split())) for i in range(n-1)]+[[0,0,1]] for i in range(n): now=0 for a,s,d in l[i:]: now=a+s-(-max(0,now-s)//d)*d print(now) if __name__=="__main__": f()
p02970
s251535542
Accepted
import math n,d = map(int,input().split()) print(math.ceil(n/(2*d+1)))
p02811
s074034635
Wrong Answer
a,b=map(int,input().split()) if a*500>=b : print('YES') else: print('NO')
p02717
s637449303
Accepted
a,sd,f=map(int,input().split()) print(f,a,sd)
p02811
s955562670
Accepted
n, k = map(int, input().split()) if n * 500 >= k: print("Yes") else: print("No")
p03543
s144689618
Accepted
s = input() print ("Yes") if s[0] == s[1] == s[2] or s[1] == s[2] == s[3] else print ("No")
p03827
s540990124
Wrong Answer
N=int(input()) S=input() total=0 X=[] for i in S: X.append(total) if i=="I": total+=1 elif i=="D": total-=1 print(max(X))
p02657
s194242859
Accepted
a,b = map(int, input().split()) print(a*b)
p03557
s442638708
Accepted
import bisect n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort() b.sort() c.sort() cnt = 0 for i in b: x = bisect.bisect_left(a,i) y = bisect.bisect_right(c,i) cnt += x*(n-y) print (cnt)
p03795
s648929180
Accepted
n = int(input()) x = n*800 y = (n//15)*200 print(x-y)
p02947
s221640335
Accepted
from collections import defaultdict n = int(input()) d = defaultdict(int) count = 0 for i in range(n): s = "".join(sorted(input())) count += d[s] d[s] += 1 print(count)
p03556
s126935788
Accepted
n = int(input()) cnt = 1 ans = 0 while 1: tmp = cnt ** 2 if tmp <= n: ans = tmp cnt += 1 else: break print(ans)
p02665
s689660455
Wrong Answer
n = int(input()) *a, = map(int,input().split()) a.reverse() b = [a[0]] for i in range(1,n+1): b.append(b[-1] + a[i]) b.reverse() c = [1 for _ in range(n+1)] ans = -1 for i in range(1,n+1): c[i] = min(c[i-1]*2,b[i]) c[i] -= a[i] if c[i] <= 0: print(-1);exit() print(sum(c) + sum(a[1:]))
p02607
s631360685
Accepted
n = int(input()) a = list(input().split()) a = [int(a[i]) for i in range(n)] ans = 0 for j in range(n): if j%2 == 0 and a[j]%2 == 1: ans = ans + 1 print(ans)
p04045
s396824959
Accepted
n,k = map(int,input().split()) dls = list(map(int,input().split())) while 1: s = list(map(int,list(str(n)))) for i in dls: if i in s: break else: print(n) exit() n += 1
p03719
s672836039
Accepted
a, b, c = map(int, input().split()) print("Yes" if a<=c<=b else "No")
p03038
s751059019
Accepted
N, M = map(int, input().split()) A = list(map(lambda x: int(x), input().split())) Q = [] for i in range(M): Q.append(tuple(map(int, input().split()))) A.sort() Q.sort(key=lambda x: x[1], reverse=True) cur = 0 for i in range(M): cnt = Q[i][0] while cnt > 0 and cur < N: if A[cur] >= Q[i][1]: break A[cur] = Q[i][1] cur += 1 cnt -= 1 print(sum(A))
p03000
s515607510
Accepted
n,x=map(int,input().split()) li=list(map(int,input().split())) ans=1 l=0 for i in li: l+=i if l>x: break ans+=1 print(ans)
p03317
s762258562
Wrong Answer
N, K = map(int, input().split()) A = [int(x) for x in input().split()] ans = 1 if N == K: print(1) exit() else: if (N-K+1)%K == 0: ans += N-K+1 else: ans += (N-K+1)%K+1 print(ans)
p02665
s959452449
Wrong Answer
N=int(input()) H=list(map(int,input().split())) depth=[0]*(N+1) depth[0]=1 if H[0]>0 and N==1: print(1) exit() for i in range(1,N+1): depth[i]=(depth[i-1]-H[i-1])*2 if depth[i]<=0: print(-1) exit() depth[N]=H[N] for i in range(N-1,-1,-1): depth[i]=min(depth[i+1]+H[i],depth[i]) print(sum(depth))
p02912
s094410172
Wrong Answer
import heapq N, M = map(int, input().split()) a = [-int(x) for x in input().split()] heapq.heapify(a) num = 0 hq = 1 while num < M and hq != 0: hq = -heapq.heappop(a)//2 heapq.heappush(a, -hq) num += 1 print(-sum(a))
p03017
s832963176
Wrong Answer
n,a,b,c,d = map(int,input().split()) s = input() S = s[:max(c,d)] l = len(S) C = True D = False for i in range(l-1): if S[i]=='#' and S[i+1]=='#': C = False break if d > i > 0: if S[i-1]=='.' and S[i]=='.' and S[i+1]=='.': D = True if not C: print('No') elif C and not D: if c < d: print('Yes') else: print('No') else: print('Yes')
p03062
s462366247
Accepted
n=int(input()) a=list(map(int,input().split())) mai=0 for i in range(n): if a[i]<0: mai+=1 ans=0 for i in range(n): ans+=abs(a[i]) a[i]=abs(a[i]) if mai%2==0: print(ans) else: print(ans-2*abs(min(a)))
p02755
s593231153
Accepted
import math A,B = map(int,input().split()) flag = 0 for i in range(1,10**5): if math.floor(i*0.08) == A and math.floor(i*0.1) == B: print(i) flag += 1 break if flag == 0: print(-1)
p02694
s031867995
Wrong Answer
x = int(input())/100 amt=100 t=0 while(amt<x): amt+= amt//100 t+=1 print(t)
p02594
s885103751
Accepted
x = int(input()) if x >= 30: print('Yes') else: print('No')
p02790
s643734490
Accepted
a, b = list(map(int, input().split())) ans = "" if a <= b: for i in range(b): ans += str(a) else: for i in range(a): ans += str(b) print(ans)
p02613
s109176971
Wrong Answer
N = int(input()) s = [input() for i in range(N)] a = s.count("AC") b = s.count("WA") c = s.count("TLE") d = s.count("RE") print("AC * {}".format(a)) print("WA * {}".format(b)) print("TLE * {}".format(c)) print("RE * {}".format(d))
p02787
s634797875
Wrong Answer
from sys import stdin f_i = stdin H, N = map(int, f_i.readline().split()) C = [10 ** 8] * (H * 2) C[0] = 0 for line in f_i: A, B = map(int, line.split()) for i, vals in enumerate(zip(C, C[A:]), start=A): v1, v2 = vals C[i] = min(v1 + B, v2) print(min(C[H:]))
p02771
s185268539
Accepted
A, B, C = list(map(int, input().split())) print('Yes' if len(set([A, B, C]))==2 else 'No')
p03077
s639808585
Accepted
n=int(input()) l=[int(input()) for i in range(5)] for i in range(5): l[i]=int((n-1)/l[i]) print(max(l)+5)
p03351
s055400454
Accepted
import sys import math import itertools import collections import heapq import re import numpy as np rr = lambda: sys.stdin.readline().rstrip() rs = lambda: sys.stdin.readline().split() ri = lambda: int(sys.stdin.readline()) rm = lambda: map(int, sys.stdin.readline().split()) rl = lambda: list(map(int, sys.stdin.readline().split())) inf = float('inf') mod = 10**9 + 7 a, b, c, d = rm() if abs(a-c) <= d or abs(a-b) <= d and abs(b-c) <= d: print('Yes') else: print('No')
p04029
s000146878
Accepted
n = int(input()) print(n*(n+1)//2)
p03359
s683278027
Accepted
a,b = map(int, input().split()) count = 0 for i in range(1,a+1): if int(str(i)+str(i)) <= int(str(a)+str(b)): count += 1 print(count)
p02594
s007138903
Wrong Answer
X = int(input('今の温度は?>')) if 40 >= X >= 30: command = 'yes' elif 30 > X >= -40: command = 'no' else: command = 'Error' print(command)
p03565
s787574994
Wrong Answer
S=input() T=input() a=0 l=len(T)-1 for i in range(len(S)-1,-1,-1): if S[i]=='?'or S[i]==T[l]: l-=1 else: l=len(T)-1 if l==-1: a=i break if l!=-1: print('UNRESTORABLE') else: c=0 p='' for j in range(len(S)): if a<=j<a+len(T): p=p+T[c] c+=1 else: if S[j]=='?': p=p+'a' else: p=p+S[j] print(p)
p02675
s308504983
Wrong Answer
n = str(input()) if len(n) == 1: i = int(n) else: i = int(n[-1:]) print(n[-1:]) if i in (2,4,5,7,9): print("hon") elif i in (0,1,6,8): print("pon") else: print("bon")
p02784
s982827053
Accepted
HN=list(map(int,input().strip().split())) H=HN[0] N=HN[1] A=list(map(int,input().strip().split())) if sum(A)>=H: print("Yes") else: print("No")
p02832
s417221714
Accepted
def q_d(): n = int(input()) a = list(map(int, input().split())) break_num = 0 current_index = 1 for i in range(n): if a[i] == current_index: current_index += 1 else: break_num += 1 if break_num == n: print(-1) else: print(break_num) if __name__ == '__main__': q_d()
p03331
s947338773
Accepted
n = int(input()) ans = 10**5+1 for a in range(1, n//2+1): a,b = list(str(a)), list(str(n-a)) ans = min(ans, sum(list(map(int, a)))+sum(list(map(int, b)))) print(ans)
p02595
s319220462
Wrong Answer
t,n=map(int,input().split()) count=0 for i in range(t): a,b=map(int,input().split()) x=((a**2)+(b**2))**0.5 if(x>=n): count+=1 print(count)
p03086
s114695262
Accepted
S = input() T = ['A', 'C', 'G', 'T'] ans, cnt = 0, 0 for i in range(len(S)): if S[i] in T: cnt += 1 ans = max(ans, cnt) else: cnt = 0 print(ans)
p02916
s302603482
Wrong Answer
N = int(input()) A = list(map(lambda a: int(a), input().split(" "))) B = list(map(lambda b: int(b), input().split(" "))) C = list(map(lambda c: int(c), input().split(" "))) satis = 0 for i in range(len(A)): satis += B[A[i] - 1] if i >= 1 and A[i] - A[i-1] == 1: satis += C[i-1] print(satis)