problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02796
s055834346
Wrong Answer
import sys input = sys.stdin.readline N = int(input()) start = [] end = [] itv = [] for i in range(N): X, L = (int(i) for i in input().split()) itv.append([X+L-1, X-L+1]) #start.append(X-L) #end.append(X+L) #XL = [[int(i) for i in input().split()] for i in range(N)] #line = [0] * (2*(10**9) +1) it...
p02727
s689294860
Wrong Answer
x,y,a,b,c=map(int,input().split()) p=list(map(int,input().split())) q=list(map(int,input().split())) r=list(map(int,input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) tmp=[] for i in range(a): tmp.append(p[i]) for j in range(b): tmp.append(q[j]) for k in range(len(r)): tmp.a...
p02576
s006917835
Accepted
import sys from math import sqrt, gcd, ceil, log, floor from bisect import bisect, bisect_left from collections import defaultdict, Counter, deque from heapq import heapify, heappush, heappop input = sys.stdin.readline read = lambda: list(map(int, input().strip().split())) MOD = 10**9 + 7 def main(): # ans_ = [] #...
p03221
s519006432
Wrong Answer
from collections import defaultdict n, m = map(int, input().split()) order = [] dd = defaultdict(int) for i in range(m): p, y = map(int, input().split()) order.append([i, p, y]) # 全体を年代順にソート order.sort(key=lambda x: (x[2])) ans = [] for ii, pp, yy in order: dd[pp] += 1 ans.append('{:0>6}{:0>6}'.format...
p02993
s073591391
Accepted
s = input() if s[0]==s[1] or s[1]==s[2] or s[2] == s[3]: print('Bad') else: print('Good')
p02621
s821958336
Wrong Answer
a = int(input()) print(int(a+a^2+a^3))
p03721
s750447417
Wrong Answer
n,k = map(int,input().split()) d = dict() for _ in range(n): a,b = input().split() b = int(b) if a in d.keys(): d[a] += b else: d[a] = b d_sorted = dict(sorted(d.items(),key=lambda x:x[0])) now = 0 for num,cnt in d_sorted.items(): now += cnt if now >= k: print(num) exit()
p02583
s390505341
Accepted
n = int(input()) l = list(map(int, input().split())) ans = 0 l = sorted(l) for i in range(n): for j in range(i+1,n): for k in range(j+1,n): if l[i]!=l[j] and l[j]!=l[k] and l[k] != l[i]: if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j]: ans += 1 print(ans)
p04043
s999426780
Accepted
A,B,C = map(int, input().split()) list_iroha = [A,B,C] #print(list_iroha) if [5,7,5] == list_iroha or [7,5,5] == list_iroha or [5,5,7] == list_iroha: print("YES") else: print("NO")
p03210
s257966613
Wrong Answer
if int(input()) == 3 or 5 or 7: print('YES') else: print('NO')
p02888
s723559176
Accepted
import bisect N = int(input()) L = list(map(int, input().split())) L.sort() count = 0 for a in range(N): for b in range(a + 1, N): c = bisect.bisect_left(L, L[a] + L[b]) if c > b: count += c - b - 1 else: break print(count)
p02660
s638589412
Accepted
from itertools import groupby n =int(input()) def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n%i == 0: n //= i table.append(i) i += 1 if n > 1: table.append(n) return table from itertools import groupby ans = 0 p = prime_decomposition(n) for k,g in groupby(p): ...
p02732
s246644105
Accepted
a=int(input()) l=list(map(int,input().split())) List=[0]*(a+1) for i in l: List[i]+=1 s=0 for i in List: s+=int(i*(i-1)/2) for i in l: print(s-List[i]+1)
p03360
s771772224
Accepted
a = list(map(int, input().split())) k = int(input()) a.sort(reverse=True) a[0] *= 2**k print(sum(a))
p03251
s618227466
Accepted
N,M,X,Y = map(int,input().split()) x = [int(i) for i in input().split()] x.append(X) y = [int(i) for i in input().split()] y.append(Y) mx_x = max(x) mn_y = min(y) if mx_x < mn_y: print('No War') else: print('War')
p03799
s998780871
Accepted
s,c=map(int,input().split()) if s > c//2: print(c//2) exit() else: c-=s*2 s+=c//4 print(s)
p03162
s430327016
Wrong Answer
######## Biscuits ###########3 N = int(input()) a = [list(map(int, input().split())) for i in range(N)] dp = [[0 for i in range(3)] for j in range(N + 1)] for i in range(N): for j in range(3): for k in range(3): if j == k: continue dp[i + 1][k] = max(dp[i + 1][k], ...
p03095
s276457465
Accepted
n = int(input()) s = input() dic = {} for i in range(n): if s[i] in dic: dic[s[i]] += 1 else: dic[s[i]] = 1 ans = 1 for v in dic.values(): ans *= (1 + v) ans %= 10**9 + 7 ans -= 1 print(ans)
p02933
s058117882
Accepted
import sys import os def main(): if os.getenv("LOCAL"): sys.stdin = open("input.txt", "r") a = int(sys.stdin.readline().strip()) s = sys.stdin.readline().strip() if a >= 3200: print(s) else: print("red") if __name__ == '__main__': main()
p03261
s100954978
Accepted
n = int(input()) w = [input() for i in range(n)] v = [] for i in range(n - 1): if w[i] not in v and w[i + 1] not in v and w[i][- 1] == w[i + 1][0]: v.append(w[i]) else: print("No") break else: print("Yes")
p02813
s564128047
Accepted
from itertools import permutations as pu n = int(input()) p = tuple([int(_) for _ in input().split()]) q = tuple([int(_) for _ in input().split()]) ls = list(pu(range(1, n + 1))) print(abs(ls.index(p) - ls.index(q)))
p03206
s744162519
Accepted
D=int(input()) print("Christmas"+" Eve"*(25-D))
p02713
s770335299
Accepted
import math n = int(input()) count = 0 for i in range(1,n+1): for j in range(1,n+1): t = math.gcd(i,j) for k in range(1,n+1): m = math.gcd(t,k) count += m print(count)
p02802
s557279530
Accepted
n,m = map(int,input().split()) a = [[0,0] for _ in range(n)] pn = 0 ac = 0 for i in range(m): p, s = input().split() if s == "AC": if a[int(p)-1][1] == 0: a[int(p)-1][1] = 1 pn += a[int(p)-1][0] ac += 1 else: a[int(p)-1][0] += 1 print(ac, pn)
p03485
s823203243
Accepted
import math a, b = map(int, input().split()) ans = math.ceil((a + b) / 2) print(ans)
p04019
s863483612
Accepted
s = input() s = list(s) sowth = s.count('S') if 'S' in s else 0 east = s.count('E') if 'E' in s else 0 north = s.count('N') if 'N' in s else 0 west = s.count('W') if 'W' in s else 0 if (sowth + north != 0 and sowth * north == 0) or\ (west + east != 0 and west * east == 0): print('No') else: print('Yes')...
p02784
s806761798
Accepted
H, N = map(int, input().split()) A = list(map(int, input().split())) S = sum(A) if S >= H: print('Yes') else: print('No')
p03059
s649226619
Accepted
A, B, T = list(map(int, input().split())) print(T//A*B)
p02971
s232563175
Wrong Answer
a=int(input()) b=[] for i in range(a): b.append(int(input())) c=max(b) if b.count(c)>1: for i in range(a): print(c) elif b.count(c)==1: d=sorted(b) d=d[1] e=b.index(c) for i in range(a): if i==e: print(d) else: print(c)
p02676
s178615136
Accepted
K = int(input()) S = input() if len(S) > K: print(S[:K] + '...') else: print(S)
p03730
s338214660
Accepted
A,B,C=map(int,input().split()) x=A%B y=max(A,B) for i in range(y+1): if (x*i)%B==C: print("YES") exit() print("NO")
p03264
s334598672
Accepted
N = int(input()) # N : odd -> N**2 - 1 // 4 # N : even -> N**2 // 4 print( N ** 2 // 4)
p03076
s992653442
Accepted
import sys import itertools a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) lst = [a, b, c, d, e] ans = 1 <<10 for i in itertools.permutations(lst, 5): cnt = 0 for num, j in enumerate(i): if num == 4: cnt += j break if j%10 != 0: ...
p02916
s951469147
Wrong Answer
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) ans = 0 cnt = 0 for i in range(n): ans += b[i] if i >= 1: if a[i] == a[i-1]+1: ans += c[cnt] cnt+=1 print(ans)
p03720
s745128738
Accepted
import numpy as np import sys input = sys.stdin.readline N,M = map(int,input().split()) res = [0]*N for _ in range(M): a,b = map(int,input().split()) res[a-1]+=1 res[b-1]+=1 for a in res: print(a)
p03001
s710986027
Accepted
W,H,x,y = map(int, input().split()) # quad = [[0,0],[W,0],[W,H],[0,H]] # S = (quad[1][0]-quad[0][1]) * (quad[2][1]-quad[0][1]) S = W*H ans = 0 if W/2 == x and H/2 == y: ans = 1 print(S/2 , ans)
p02796
s316106341
Wrong Answer
N = int(input()) r = [list(map(int, input().split())) for _ in range(N)] a = [] for i in r: a.append((i[0]-i[1],i[0]+i[1])) a.sort(key=lambda x:x[1]) ans = 0 cur = -float('inf') for i in a: if i[0] < cur: continue ans += 1 cur = i[1] print(a) print(ans)
p02780
s704864529
Wrong Answer
n,k,*p=map(int,open(0).read().split()) s=m=sum(p[:k]) for i in range(k,n):s+=p[i]-p[i-k];m=max(m,s) print((s+k)/2)
p02547
s862995055
Wrong Answer
# coding:utf-8 n = int(input()) count = 0 ans = 0 for i in range(n): d1, d2 = map(int, input().split()) if d1 == d2: count += 1 else: ans = count count = 0 ans = max(ans, count) if ans >= 3: print('Yes') else: print('No')
p03419
s143536532
Wrong Answer
n,m = map(int, input().split()) if n == 1 or m == 1: print(max(n,m)-2 if max(n,m)>2 else 0) elif n==m==1: print(1) else: print((n-2) * (m-2))
p02633
s545868628
Accepted
X=int(input()) i=1 while i*X % 360 != 0: i+=1 print(i)
p02831
s921262666
Accepted
A, B = list(map(int, input().split())) large = A if A > B else B small = A if A < B else B def gcd(large, small): r = large % small while r != 0: large = small small = r r = large % small return small print(large*small//gcd(large, small))
p02639
s905918982
Accepted
list = list(map(int,input().split())) i=0 while i<5: if list[i] == 0: print(i+1) i += 1
p02754
s213715760
Accepted
n,a,b = map(int,input().split()) if a == 0: print(0) else: print((n // min(n,a+b) * min(n,a)) + min(a,(n % min(n,(a+b)))))
p02910
s502719658
Accepted
S = input() print("Yes" if S[::2].count("L") + S[1::2].count("R") == 0 else "No")
p03289
s950578803
Accepted
def myAnswer(S:list)->str: if(S.pop(0) !="A"): return "WA" flag = False for n,s in enumerate(S): if(n>=1 and n <= len(S)-2 and flag==False and s=="C"): flag = True else: if(s.isupper()): return "WA" return "WA" if(flag==False) else "AC" def modelAnswer(): tmp=...
p03284
s401284654
Accepted
n,k=map(int, input().split()) if n%k==0: print("0") else: print("1")
p02993
s716706586
Accepted
s = input() for i in range(3): if s[i] == s[i + 1]: print("Bad") break else: print("Good")
p03285
s508673263
Wrong Answer
N = int(input()) if N % 4 == 0 or N % 7 == 0: print("Yes") else: print("No")
p03861
s593562839
Accepted
a, b, x = list(map(int, input().split())) print(b // x - (a - 1) // x)
p02608
s837435527
Wrong Answer
n = int(input()) f = [0] * (n + 1) t = int(n ** .5) + 3 for i in range(1, t): for j in range(1, t): for k in range(1, t): res = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i if res <= n: f[res] += 1 print('\n'.join(map(str, f)))
p03821
s261850903
Accepted
n = int(input()) list_a = [] list_b = [] su = 0 for i in range(n): a,b = map(int,input().split()) list_a.append(a) list_b.append(b) list_a = list_a[::-1] list_b = list_b[::-1] for i in range(n): list_a[i] += su if list_a[i]%list_b[i]==0: continue else: x = list_b[i]-(list_a[i]%list_b[i]) su += x...
p02729
s697918602
Accepted
N,M = map(int,input().split()) # 偶数 = 偶数+偶数 or 奇数+奇数 print(N*(N-1)//2 + M*(M-1)//2)
p03637
s460435328
Accepted
import collections _ = input() A = collections.Counter(int(T) for T in input().split()).most_common() Num4 = sum(A[T][1] for T in range(0,len(A)) if A[T][0]%4==0) Num2 = sum(A[T][1] for T in range(0,len(A)) if A[T][0]%4!=0 and A[T][0]%2==0) Odd = sum(A[T][1] for T in range(0,len(A)) if A[T][0]%2!=0) if Num2>0: Capacit...
p03971
s160204520
Accepted
n,a,b=map(int,input().split()) s=list(input()) nover=0 tot=0 for i in range(n): if tot<a+b: if s[i]=='a': print('Yes') tot+=1 elif s[i]=='b' and nover<b: print('Yes') nover+=1 tot+=1 else: print('No') else: p...
p02948
s701367802
Accepted
from heapq import* (N,M),*t=[map(int,s.split())for s in open(0)] z,*q=[0]*50*M v=[[]for _ in q] for a,b in t:v[a-1]+=b, for i in v[:M]:[heappush(q,-j)for j in i];z-=heappop(q) print(z)
p03994
s599977258
Accepted
# 頭から順にaに変えていく import sys readline = sys.stdin.readline S = list(readline().rstrip()) K = int(readline()) z = ord("z") for i in range(len(S) - 1): # aにするためのコストを求める if S[i] == "a": continue cost = z + 1 - ord(S[i]) if cost <= K: S[i] = "a" K -= cost K %= 26 nex = ord(S[-1]) + K if nex > ord("z"):...
p03284
s832003329
Wrong Answer
n,k = map(int,input().split()) if n%k == 0: print(0) else: if n>= k: print(n%k) else: print(1)
p03795
s738636871
Accepted
n=int(input()) print(n*800-(n//15)*200)
p02959
s609621755
Accepted
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) total = 0 for i in range(N): total += min(A[i], B[i]) B[i] -= min(A[i], B[i]) A[i] -= min(A[i], B[i]) total += min(A[i+1], B[i]) A[i+1] -= min(A[i+1], B[i]) print(total)
p03239
s289917992
Accepted
n,t=map(int,input().split()) ct=[list(map(int,input().split())) for i in range(n)] c=10000000000000000 for i in range(n): if ct[i][1]<=t: c=min(c,ct[i][0]) print(c if c!=10000000000000000 else "TLE")
p02723
s728337852
Accepted
s=input() if s[2]==s[3] and s[4]==s[5]: print("Yes") else: print("No")
p03386
s102218794
Wrong Answer
a,b,k=map(int,input().split()) ans=[] for i in range(a,min(a+k,b+1),1): ans.append(i) for i in range(b,max(a,b-k+1),-1): ans.append(i) ans=list(set(ans)) #重複を削除 ans.sort() #ソート for i in ans: print(i)
p02594
s708370468
Wrong Answer
K = int(input()) count = 0 for sev in range(10**3): sev = sev *10 + 7 count += 1 if K % sev == 0: pass elif sev >10**6: count = -1 pass print(count)
p03061
s306936785
Wrong Answer
import sys from functools import lru_cache @lru_cache(maxsize=None) def gcd(a, b): if a % b == 0: return b else: return gcd(b, a % b) N, *A = map(int, sys.stdin.read().split()) L, R = [0] * (N + 1), [0] * (N + 1) for i in range(N): L[i + 1] = gcd(L[i], A[i]) R[-i - 2] = gcd(R[-i - 1],...
p03612
s976118761
Wrong Answer
N = int(input()) P = list(map(int, input().split())) index = [] for i, p in enumerate(P): index.append(p-(i+1)) ans = 0 seq = 0 for i in index: if i == 0: ans += 1 seq += 1 else: if seq > 1: ans -= (seq-1) seq = 0 if seq > 1: ans -= (seq-1) print(ans)
p02946
s057215516
Wrong Answer
k, m =map(int, input().split()) n = int(k / 2) answer = [m] for i in range(1, n + 2): answer.append(m - i) answer.append(m + i) answer.sort() if k == 1: answer = [m] print(*answer)
p03059
s523814434
Accepted
import bisect,collections,copy,heapq,itertools,math,string import sys def S(): return sys.stdin.readline().rstrip() def M(): return map(int,sys.stdin.readline().rstrip().split()) def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return lis...
p03012
s122730591
Accepted
import sys def input(): return sys.stdin.readline().strip() def I(): return int(input()) def LI(): return list(map(int, input().split())) def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def S(): return input() def LS(): return input().spl...
p03264
s735506447
Wrong Answer
k=int(input()) l=k//2 if k%2==0:print((k/2)**2) else:print((l+1)*l)
p03696
s530376152
Accepted
n = int(input()) s = input() counter_l = 0 pairs = 0 double_check = set() for i in range(n): if s[i] == "(": counter_l += 1 for j in range(i + 1, n): if s[j] == ")" and j not in double_check: pairs += 1 double_check.add(j) break counter_r ...
p03797
s525101888
Accepted
import sys import math N, M = list(map(int, input().split())) count = min(M//2, N) M -= count*2 print(count + M//4)
p03493
s652372684
Accepted
a = input() result =0 if a[0]=="1": result +=1 if a[1]=="1": result +=1 if a[2]=="1": result +=1 print(result)
p02583
s682125221
Wrong Answer
N = int(input()) L = list(map(int, input().split())) a = 0 if N > 2: for i in range(N): for j in range(i+1, N): for k in range(j+1, N): if L[i] == L[j] or L[i] == L[k] or L[j] == L[k]: continue if L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L...
p02772
s952623983
Wrong Answer
n = int(input()) arr = [int(s) for s in input().split(" ")] def calculate(n,arr): for ar in arr: if ar % 2 == 0: s1 = ar % 3 s2 = ar % 5 if (s1 == 0) or (s2 == 0): print("APPROVED") return else: print("DENIED"...
p03627
s673420730
Wrong Answer
n=int(input()) a=list(map(int,input().split())) x={} edge=[0]*2 for i in a: if i in x: if x[i]==1: edge.append(i) x[i]=0 else: x[i]=1 edge.sort(reverse=True) print(edge[0]*edge[1])
p02718
s004396063
Wrong Answer
n, m = map(int, input().split()) a = list(map(int, input().split())) if (n+m) % m == 0: print("Yes") else: print("No")
p02622
s424851090
Accepted
s = input() t = input() ans = 0 for i in range(len(s)): if s[i] != t[i]: ans += 1 print(ans)
p03836
s076750743
Accepted
sx,sy,tx,ty = map(int,input().split()) dx = tx-sx dy = ty-sy a = ['U','R','D','L'] print( a[0]*dy+ a[1]*dx+ a[2]*dy+ a[3]*(dx+1)+ a[0]*(dy+1)+ a[1]*(dx+1)+ a[2]+a[1]+ a[2]*(dy+1)+ a[3]*(dx+1)+ a[0] )
p03043
s700444039
Accepted
from math import ceil, log2 n, k = map(int, input().split()) X = (ceil(log2(k / (i+1))) if ceil(log2(k / (i+1))) > 0 else 0 for i in range(n)) print(sum(0.5 ** x / n for x in X))
p02994
s260321704
Accepted
n ,l = map(int, input().split()) apple = [] for i in range(n): apple.append(l + i) min_num = 10 ** 5 sum_num = sum(apple) ans = 0 for i in range(n): tmp = abs(sum_num - (sum_num - apple[i])) if tmp < min_num: min_num = min(tmp, min_num) flag = apple[i] ans = sum_num - apple[i] prin...
p02765
s592401541
Wrong Answer
n, r = map(int, input().split()) if n < 10: print(r) else: print(r + 800)
p03264
s109002708
Accepted
def main(): K = int(input()) oddnum = K//2 evennum = K//2 + K%2 ans = oddnum*evennum return ans print(main())
p03293
s470961015
Wrong Answer
S = list(input()) T = list(input()) if sorted(S) == sorted(T): print('Yes') else: print('No')
p02556
s420474136
Accepted
n=int(input()) a=[] b=[] for i in range(n): x,y=map(int,input().split()) a.append(x+y) b.append(x-y) a=sorted(a) b=sorted(b) ans=max(a[-1]-a[0],b[-1]-b[0]) print(ans)
p02707
s055281734
Accepted
import collections N =int(input()) A = list(map(int, input().split())) k=0 t=1 a=collections.Counter(A) for i in range(1,N+1): print(a[i])
p03103
s385420252
Wrong Answer
N,M = map(int,input().split()) d = {} for _ in range(N): A,B = map(int,input().split()) d[A] = B res = 0 cnt = 0 for i in sorted(d): if(d[i] <= M): res += d[i]*i M -= d[i] elif(M > 0): res += M * i break else: break print(res)
p02802
s076810822
Wrong Answer
n, m = map(int, input().split()) answered = [False] * n ans = 0 pena = 0 for _ in range(m): p, s = input().split() pidx = int(p) - 1 if answered[pidx]: continue if s == "AC": ans += 1 answered[pidx] = True else: pena += 1 print("{} {}".format(ans, pena))
p02831
s423590088
Wrong Answer
A,B=map(int,input().split()) num=1 for i in range(1,max(A,B)+1): if A%i==0 and B%i==0: num*=i print(int(A*B/num))
p02996
s275712110
Wrong Answer
n=int(input()) ans='No' a=sorted([list(map(int,input().split())) for i in range(n)],key=lambda x:x[1]) for i in range(n): if sum(a[:i+1][0])<a[i][1]:ans='Yes' else:ans='No' #ans=['Yes' if sum(a[:i+1][0])<a[i][1] else 'No' for i in range(n)] print(ans)
p03943
s305181093
Accepted
a = list(map(int, input().split())) if max(a)*2 == sum(a): print("Yes") else: print("No")
p02548
s594508594
Accepted
N = int(input()) ans = 0 for i in range(1, N): ans += (N - 1) // i print(ans)
p02554
s799876827
Wrong Answer
n = int(input()) def modpow(x, y): mod = 1000000007 res = 1 for i in range(y): res = res * x % mod return res ten = modpow(10, n) nine = modpow(9, n) eight = modpow(8, n) ans = ten - nine - nine + eight print(ans)
p03836
s615446759
Accepted
sx,sy,tx,ty=map(int,input().split()) tx=tx-sx ty=ty-sy sx=0 sy=0 ans=[] def add(num,d): global ans di=["U","D","L","R"] for i in range(num): ans.append(di[d]) y=ty-sy x=tx-sx add(y,0) add(x,3) add(y,1) add(x,2) add(1,2) add(y+1,0) add(x+1,3) add(1,1) add(1,3) add(y+1,1) add(x+1,2) add(1,0) print(""....
p03264
s024398979
Accepted
k=int(input()) print(int(k/2)*int((k+1)/2)) #Source code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 cha...
p02899
s198593286
Accepted
N=int(input()) L=list(map(int,input().split())) l=[0 for i in range(N)] for i in range(N): l[L[i]-1]=i+1 print(' '.join(map(str, l)))
p02661
s471634645
Wrong Answer
n=int(input()) a=[] b=[] for _ in range(n): A,B=map(int,input().split()) a.append(A) b.append(B) q=sorted(a) w=sorted(b) w=list(reversed(w)) p=n//2 if n%2==1: e=q[p] r=w[p] t=r-e+1 else: e=q[p-1] r=w[p-1] t=r-e print(2*t-1)
p02843
s508743846
Accepted
from itertools import combinations_with_replacement as C X = int(input()) mono = [100, 101, 102, 103, 104, 105] ans = 0 if X >= 2000: ans = 1 else: for i in range(1, 19 + 1): L = list(C(mono, i)) for L in L: if sum(L) == X: ans = 1 break print(ans)
p02918
s712072850
Accepted
n_k = list(map(int,input().split())) chr_lr = list(input()) cnt_rl = 0 cnt_con = 0 for i in range(n_k[0]-1): if(chr_lr[i] == chr_lr[i+1]): cnt_con += 1 sum = min(cnt_con + 2*n_k[1],n_k[0]-1) print(sum)
p03721
s594355660
Wrong Answer
n,k=map(int,input().split()) temp={} a=[0]*n for i in range(n): at,bt=map(int,input().split()) temp[at]=bt a[i]=at a.sort() cnt=0 for i in range(n): cnt=cnt+temp[a[i]] if cnt>=k: print(a[i]) break