problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03360
s272109602
Accepted
a,b,c = map(int, input().split()) k = int(input()) n = max(a, b) n = max(n, c) ans = a+b+c+n*(2**k-1) print(ans)
p03338
s946665069
Accepted
n = int(input()) s = str(input()) ans = 0 for i in range(1, n): x = set(s[0:i]) y = set(s[i:]) ans = max(ans, len(x & y)) print(ans)
p03417
s469617516
Accepted
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N, M = map(int, readline().split()) if N > M: N, M = M, N if M == 1: ans = 1 elif N == 1: ans = M - 2 else: ans = (N - 2) * (M - 2) print(ans) return if __name__ == '__main__': main()
p03137
s823453760
Accepted
N,M = map(int,input().split()) X = list(map(int,input().split())) X.sort() B=[] if N>=M: print(0) else: for i in range(M-1): B.append(X[i+1]-X[i]) B.sort() print(sum(B[:M-N]))
p03243
s641720530
Accepted
N=int(input()) a=N//100 b=(N-a*100)//10 c=N-a*100-b*10 if a<b: N=(a+1)*111 elif a>b: N=a*111 elif a==b and a>=c : N=a*111 elif a==b and a<c : N=(a+1)*111 print(N)
p03962
s760205946
Accepted
print(len(set(map(int,input().split()))))
p02765
s950762736
Wrong Answer
n, r= map(int, input().split()) ans = 0 if n < 10: ans = 100 * (10 - n) else: ans = r print(ans)
p03038
s701441373
Wrong Answer
N, M = [int(i) for i in input().strip().split()] A = [int(i) for i in input().strip().split()] B = [0] * M C = [0] * M for i in range(M): B[i], C[i] = [int(i) for i in input().strip().split()] for i in range(M): A.sort() for j in range(B[i]-1, 0, -1): if A[j] < C[i]: for k in range(j+1): A[k] = C[i] print(sum(A))
p03077
s971795479
Accepted
from math import ceil temp_list = [int(input()) for _ in range(6)] n = temp_list.pop(0) print(4 + ceil(n / min(temp_list)))
p03338
s655390858
Wrong Answer
import numpy as np N=int(input()) S=str(input()) s_list = "abcdefghijklmnopqrstuvwxyz" count_list = np.zeros(26) max_count = 0 for i in range(N-1): # N字目で切った場合 for k in range(i): if S[k] in S[i:len(S)-1]: count_list[s_list.index(S[k])] = count_list[s_list.index(S[k])] + 1 if max_count < len([1 for x in count_list if x>0]): max_count = len([1 for x in count_list if x>0]) print(max_count)
p02747
s998251327
Wrong Answer
S = input() List = list(S) ans = 1 h = 0 for i in range(len(List)): a = List[i] if a == "h": h = 1 elif h == 1 and a == "i": h = 0 else: ans = 0 if ans == 1: print("Yes") else: print("No")
p02683
s069457875
Accepted
n, m, x = map(int, input().split()) lst = [] for i in range(n): lst.append(list(map(int, input().split()))) pmin = 10 ** 10 for i in range(1, 2 ** n): # 選び方 sbin = format(i, 'b') sbin = '0' * (n - len(sbin)) + sbin temp = [0] * m p = 0 for j in range(n): # 選ぶ行 if sbin[j] == '1': for k in range(m): # 足す temp[k] += lst[j][k + 1] p += lst[j][0] if min(temp) >= x: pmin = min(pmin, p) if pmin == 10 ** 10: print(-1) else: print(pmin)
p02594
s530351632
Accepted
X=int(input()) if X<30: print("No") else: print("Yes")
p03548
s186922647
Wrong Answer
x,y,z = map(int,input().split()) t = y+z print(int((x-1)/t))
p02601
s674204059
Accepted
A, B, C = map(int, input().split(' ')) K = int(input()) while K > 0: if B > A: break B *= 2 K -= 1 while K > 0: if C > B: break C *= 2 K -= 1 if A < B < C: print('Yes') else: print('No')
p03163
s987895323
Accepted
n,cap=map(int,input().split()) weigh=[] profit=[] temp=n while temp!=0: w,p=map(int,input().split()) weigh.append(w) profit.append(p) temp-=1 mat=[[0 for i in range(cap+1)] for j in range(n+1)] for i in range(1,n+1): for j in range(1,cap+1): if j<weigh[i-1]: mat[i][j]=mat[i-1][j] else: mat[i][j]=max(profit[i-1]+mat[i-1][j-weigh[i-1]],mat[i-1][j]) print(mat[n][cap])
p03073
s142428613
Wrong Answer
s= str(input()) ans = 0 for i in range(len(s)): if i // 2 == 0: if s[i] == '0': ans += 1 else: if s[i] == '1': ans += 1 print(min (ans,len(s)-ans))
p02819
s334794833
Accepted
x=int(input()) f=0 if x == 2: print(2) else: for i in range(x,10**6): for j in range(2,i//2+2): if i%j == 0: break else: f=i break print(f)
p02701
s000388963
Accepted
import collections N = int(input()) S = list(input() for _ in range(N)) setS = set(S) print(len(setS))
p02747
s222374843
Accepted
S = input() hantei = True for i in range(0,len(S)-1,2): if S[i]+S[i+1] != 'hi': hantei = False if len(S) % 2 == 1: hantei = False if hantei == True: print('Yes') else: print('No')
p03814
s828108422
Accepted
S=input() for i,s in enumerate(S): if s=='A': a=i break for i,s in enumerate(S[::-1]): if s=='Z': z=i break print((len(S)-z-a))
p03075
s654945082
Accepted
a,_,_,_,e = [int(input()) for _ in range(5)] k = int(input()) if e-a <= k: print("Yay!") else: print(":(")
p02917
s453532353
Accepted
N = int(input()) B = list(map(int,input().split())) A = [1000000]*N A[0] = B[0] A[N-1] = B[N-2] for i in range(1,N-1): A[i] = min(B[i],B[i-1]) print(sum(A))
p02713
s643910958
Wrong Answer
def gcd(x,y,z): p=[x,y,z] p.sort() a=p[0] b=p[1] while a!=0 and b!=0: b-=a if a>b: c=b b=a a=c ee=[a,b] ee.sort() if p[2]%ee[1]==0: return(ee[1]) else: return(1) n=int(input()) s=0 for i in range(1,n+1): for j in range(1,n+1): for k in range(1,n+1): s+=gcd(i,j,k) print(s)
p02718
s034112992
Accepted
N,M=map(int, input().split()) a = list(map(int, input().split())) z = sum(a) a.sort(reverse=True) for i in a[:M]: if i < z/4/M: print('No') break else: print('Yes')
p02946
s389784909
Accepted
K,X=map(int,input().split()) ans=[] n=0 for i in range(X-K+1,X+K): ans.append(i) print(*ans)
p03695
s751458927
Accepted
n = int(input()) list_A = list(map(int, input().split())) colors = set() other = 0 for num in list_A: num //= 400 if num > 7: other += 1 else: colors.add(num) max_value = len(colors) + other min_value = len(colors) if len(colors) == 0: min_value = 1 print(min_value, max_value)
p02823
s870928131
Accepted
n,a,b = map(int, input().split()) if (a-b) % 2 == 0: print(abs(a-b)//2) else: print(min(a + (b - a - 1) // 2, n - b + 1 + (b - a - 1) // 2))
p03208
s352351424
Accepted
n,k=map(int,input().split()) h=[] for i in range(n): h.append(int(input())) #n=5 #k=3 #h=[10,15,11,14,12] #h=[5,7,5,7,7] h.sort() hd=[] for i in range(n-k+1): # print(i,i+k-1,n-k) hd.append(h[i+k-1]-h[i]) print(min(hd))
p02697
s760217627
Accepted
#import numpy as np #import math #from decimal import * #from numba import njit #@njit def main(): N,M = map(int, input().split()) i = 1 for m in range(M): if N%2 == 0 and i%2 == 1 and i >= N/2: i += 1 print(M-m,M-m+i) i += 2 main()
p03437
s073340506
Accepted
X,Y=map(int,input().split()) if X%Y==0: print(-1) else: print(X)
p04044
s298866904
Accepted
n,l=map(int,input().split()) a=sorted([input() for i in range(n)]) t="" for i in a: t+=i print(t)
p03474
s468048924
Accepted
import re a,b = list(map(int,input().split())) s = input() if s[a]=="-": if "-" not in s[:a]+s[(a+1):]: print("Yes") exit() print("No")
p03986
s572179505
Wrong Answer
def agc005_a(): x = str(input()) # 文字列の逆順 x_rev = x[::-1] # 取り尽くせないもの、先頭Tの個数、末尾Sの個数、の大きいほうの2倍が答え? head_t = x.find('S') tail_s = x_rev.find('T') ans = 2 * max(head_t, tail_s) print(ans) agc005_a()
p03284
s893029492
Wrong Answer
a,b = map(int, input().split()) print(b - a // b)
p02584
s761090284
Accepted
def resolve(): x, k, d = map(int, input().split()) x = abs(x) if x // d > k: # 最大長が0まで届くか print(x - k * d) elif (k - x // d) % 2 == 0: # 0を反復横跳びする 偶数->X側、奇数->-X側 print(x % d) else: print(d - x % d) resolve()
p03329
s377113427
Accepted
#coding: utf-8 import math import heapq import bisect import numpy as np from collections import Counter #from scipy.misc import comb N = int(input()) ans = [N]*(N+1) ans[0] = 0 for i in range(1,N+1): c6 = 1 while c6 <= i: ans[i] = min(ans[i], ans[i-c6]+1) c6 *= 6 c9 = 1 while c9 <= i: ans[i] = min(ans[i], ans[i-c9]+1) c9 *= 9 print(ans[N])
p03817
s471914930
Accepted
x=int(input()) print((x//11)*2 + (x%11) // 6 + (1 if x%11%6 else 0))
p03815
s309521517
Wrong Answer
x = int(input()) print((x-1)//11 + ((x-1)%11)//6)
p02993
s915472436
Accepted
S = list(input()) S1 = S[0] count = 0 for i in range(1,4): if S1 != S[i]: count += 1 S1 = S[i] if count == 3: print("Good") else: print("Bad")
p03285
s229732866
Accepted
n=int(input()) ans=0 for i in range(n//4+1): for j in range(n//7+1): if i*4+j*7==n: ans=1 print("Yes" if ans==1 else "No")
p02787
s411501799
Accepted
h, n = (int(x) for x in input().split()) ab = [] for _ in range(n): a, b = (int(x) for x in input().split()) ab.append([a, b]) max_a = max(a for a, _ in ab) dp = [0] * (h + max_a) for i in range(1, h + 1): dp[i] = min(dp[i - a] + b for a, b in ab) print(dp[h])
p02720
s904853133
Accepted
lun_luns = [1, 2, 3, 4, 5, 6, 7, 8, 9] k = int(input()) index = 0 while True: if len(lun_luns) >= k: break num = lun_luns[index] mod = num % 10 n = num * 10 if mod == 9: lun_luns.extend([n+mod-1, n+mod]) elif mod == 0: lun_luns.extend([n, n+1]) else: lun_luns.extend([n+mod-1, n+mod, n+mod+1]) index += 1 print(lun_luns[k-1])
p03679
s055030186
Accepted
x,a,b = map(int,input().split()) if -a+b <= 0: print('delicious') elif -a+b <= x: print('safe') else: print('dangerous')
p03221
s599537667
Wrong Answer
n,m=map(int,input().split()) py=[] for i in range(m): py.append([i]+list(map(int,input().split()))) py.sort(key=lambda na:(na[1],na[2])) count=0 m_city=py[0][1] for i in range(m): si=py[i][1] if m_city==si: count+=1 py[i].append(count) else: count=1 py[i].append(count) py.sort(key=lambda na:na[0]) for i in range(m): print('{:0>6}'.format(py[i][1]),end="") print('{:0>6}'.format(py[i][3]))
p02598
s317954763
Accepted
import math def f(A, m, K): p = sum([a // m for a in A]) if p > K: return False else: return True N, K = map(int, input().split()) A = list(map(int, input().split())) left = 0 right = 10 ** 9 + 1 while int(left) != int(right): m = (left + right) / 2 if f(A, m, K): right = m else: left = m print(math.ceil(m))
p02881
s044620022
Accepted
N = int(input()) A = [] for i in range(1, int(N**0.5)+1): if N % i == 0: A.append(i) print(A[-1]+N//A[-1]-2)
p02675
s027525809
Wrong Answer
def main(): import sys input = sys.stdin.buffer.readline n = int(input()) if (m:= n%10) in [2,4,5,7,9]: print('hon') elif m in [1,6,8]: print('pon') else: print('bon') if __name__ == '__main__': main()
p03163
s216161078
Wrong Answer
from sys import stdin input = stdin.readline def main(): N, W = map(int, input().split()) wv = list(map(int, input().split()) for _ in range(N)) dp = [0] * (W + 1) for w, v in wv: for i in range(W, w, -1): dp[i] = max(dp[i], dp[i - w] + v) print(dp[-1]) if __name__ == '__main__': main()
p04011
s771983955
Accepted
n=int(input()) k=int(input()) x=int(input()) y=int(input()) if n<=k: print(n*x) else: print(k*x+(y*(n-k)))
p03241
s985386000
Accepted
n,m=map(int,input().split()) ans=[] for i in range(int(m**0.5)): if m%(i+1)==0: ans.append(i+1) ans.append(m//(i+1)) ans.sort() for i in range(len(ans)): if n*ans[i]>m: break ans1=ans[i] print(ans1)
p03469
s963924098
Accepted
s = input() print(s.replace('2017', '2018'))
p03723
s284121688
Accepted
a,b,c=map(int,input().split()) d=0 while a%2==0 and b%2==0 and c%2==0: if a==b==c: print(-1) break d+=1 ha=a//2 hb=b//2 hc=c//2 a=hb+hc b=ha+hc c=ha+hb else:print(d)
p02742
s177605914
Accepted
h,w=map(int,input().split()) if h==1 or w==1: ans=1 else: ans=(h*w)//2 if h*w%2==1: ans+=1 print(ans)
p03073
s643721944
Accepted
S=list(str(input())) S_int = [int(s) for s in S] N=len(S) A1 = [0]*N#0から始まる A2 = [0]*N#1から始まる for i in range(N): if i%2==0: A2[i]=1 else:A1[i]=1 count1=0 count2=0 for i in range(N): if S_int[i]!=A1[i]: count1 += 1 if S_int[i]!=A2[i]: count2 += 1 print(min(count1,count2))
p03262
s908893655
Accepted
from fractions import gcd N, X = map(int, input().split()) x = list(map(int, input().split())) ans = abs(x[0]-X) for i in x[1:]: ans = gcd(ans, abs(i-X)) print(ans)
p03860
s399057190
Accepted
a = input() b = a.split() x = b[1] y = x[0] print("A", y, "C", sep = '')
p02759
s513869549
Accepted
n = int(input()) print(n//2+n%2)
p02711
s416233157
Accepted
import itertools import math import fractions import functools n = input() for i in range(len(n)): if n[i] == "7": print("Yes") quit() print("No")
p02923
s753588117
Accepted
N=int(input()) L1=list(map(int,input().split())) L2=[0]*N for i in range(N-1): if L1[i]>=L1[i+1]: L2[i]+=1 L2[i+1]+=L2[i] print(max(L2))
p02973
s225630170
Wrong Answer
N = int(input()) A = [int(input()) for _ in range(N)] ans = 0 tmp = 1 for i in range(1, N): if A[i] <= A[i - 1]: tmp += 1 else: ans = max(ans, tmp) tmp = 1 else: ans = max(ans, tmp) print(ans)
p02608
s615194184
Wrong Answer
N = int(input()) ans = [0]*10050 for i in range(1,105): for j in range(1,105): for k in range(1,105): v = i**2 + j**2 + k**2 + i*j + j*k + k*i if v < 10050: ans[v] += 1 for i in range(N+1): print(ans[i+1])
p03680
s757087660
Accepted
#1 import sys n = int(input()) a = [] for i in range(n): j = int(input()) a.append(j) point = a[0] cnt = 1 for i in range(n): if point == 2: print(cnt) sys.exit() point = a[point-1] cnt +=1 print("-1")
p02802
s393450130
Accepted
n,m = map(int,input().split()) ps = [0] * m for i in range(m): ps[i] = list(map(str,input().split())) if m == 0: print(0,0) exit() countA = [0] * n countW = [0] * n cn = 0 for item in ps: if item[1] == 'AC' and countA[int(item[0])-1] == 0: countA[int(item[0])-1] = 1 cn += countW[int(item[0])-1] else: countW[int(item[0])-1] += 1 print(sum(countA),cn)
p03544
s687117397
Accepted
n = int(input()) a = [2,1] for x in range(n-1): a.append(a[x] + a[x+1]) print(a[-1])
p03494
s328412608
Accepted
n = int(input()) al = list(map(int, input().split())) res = 0 flag = True while True: for i in range(n): if al[i] % 2 ==0: al[i] = al[i] //2 else: flag = False break if flag ==False: break res +=1 print(res)
p02633
s142215819
Wrong Answer
X = int(input()) print(360 / X)
p02624
s786422879
Wrong Answer
N = int(input()) l = [0] * (N+1) m = [1] * (N+1) counter = 1 m[0] = 0 for i in range(2,N+1): if l[i] == 0: flag = True for j in range(1, N//i + 1): if i * j > N: break l[i * j] = 1 m[i * j] += j counter += m[i] * i print(counter)
p02820
s874126979
Wrong Answer
n, k = map(int, input().split()) r, s, p = map(int, input().split()) d = {"r":p, "s":r, "p":s} t = input() dp = [0]*n for i in range(n): if i<k and dp[i-k]==d[t[i]]: dp[i] = 0 t[i] = x else: dp[i] = d[t[i]] print(sum(dp))
p02720
s538747663
Wrong Answer
x=[0,1,2] y=[3,4,5] x+=y[:] print(x)
p03095
s752664170
Accepted
n = int(input()) s = input() MOD = 10 ** 9 + 7 t = [0 for i in range(26)] for i in range(n): t[ord(s[i]) - ord("a")] += 1 ans = 1 for i in range(26): if t[i] == 0: continue if t[i] == 1: ans *= 2 elif t[i] > 1: ans *= t[i] + 1 print((ans-1) % MOD)
p03487
s987301479
Wrong Answer
n = int(input()) a = list(map(int,input().split())) adict=dict() for i in range(n): if adict.get(a[i])!=None: adict[a[i]]+=1 else: adict[a[i]] = 1 cnt=0 for i in range(len(adict)): if adict[a[i]]>=a[i]: cnt+=(adict[a[i]]-a[i]) else: cnt+=adict[a[i]] print(cnt)
p03274
s256498671
Wrong Answer
N, K = map(int, input().split()) l = list(map(int, input().split())) is_zero = l.count(0) K -= is_zero if K: ans = float('inf') for i in range(1, N-K+1): lb, rb = l[i], l[i+K-1] steps = abs(rb-lb) + min(abs(rb), abs(lb)) ans = min(ans, steps) print(ans) else: print(0)
p02630
s586405414
Accepted
import bisect N = int(input()) A = list(map(int, input().split())) Q = int(input()) B = [0] * Q C = [0] * Q for i in range(Q): B[i], C[i] = map(int, input().split()) DP = [0]*(10**5+1) for i in range(len(A)): DP[A[i]] += 1 Sum = sum(A) for i in range(Q): Sum += (C[i]-B[i])*DP[B[i]] DP[C[i]] += DP[B[i]] DP[B[i]] = 0 print(Sum)
p03380
s639949419
Wrong Answer
n=int(input()) t = list(map(int,input().split())) a1 = max(t) ans = 100000000000000 memo = 0 for i in t: if ans >= abs(a1//2-i): ans = abs(a1//2-i) memo = i print(a1, memo)
p04045
s358855708
Wrong Answer
n,k=input().split() d=set(range(10))-set(map(int,input().split())) p=0 l=[0]*10 for i in range(10): if i in d: l[p:i+1]=[i for j in range(i-p+1)] p=i+1 if p!=10: d.discard(0) i=min(d)*10 l[p:]=[i for j in range(10-p)] #print(l) p=0 t=len(n) for i in range(t): p+=10**(t-i-1)*l[int(n[i])] print(p)
p03041
s081500645
Accepted
n, k = map(int, input().split()) s = list(input()) if s[k-1]=='A': s[k-1] = 'a' if s[k-1]=='B': s[k-1] = 'b' if s[k-1]=='C': s[k-1] = 'c' print(''.join(s))
p03986
s584077036
Accepted
s=t=0 for i in input(): if i=="S":s+=1 elif s>0:s-=1 else:t+=1 print(s+t)
p02970
s686168411
Accepted
n, d = map(int, input().split()) x = d*2+1 if n % x == 0: print(n//x) else: print(n//x + 1)
p03723
s706853363
Wrong Answer
a,b,c=map(int,input().rstrip().split(' ')) if(a==b and b==c): print(-1) else: n=0 while(a%2==0 and b%2==0 and c%2==0): n+=1 tmp_a=(b+c)/2 tmp_b=(a+c)/2 tmp_c=(b+a)/2 a=tmp_a b=tmp_b c=tmp_c print(n)
p03815
s303960787
Wrong Answer
from math import ceil def main(): target = int(input()) print(ceil(2 * target / 11)) if __name__ == '__main__': main()
p03075
s623097194
Accepted
l = [int(input()) for _ in range(5)] k = int(input()) if l[4] - l[0] > k: print(':(') else: print('Yay!')
p02702
s040331929
Accepted
import collections S = input() N = len(S) mod = 2019 div = [0]*(N+1) for i in range(N): div[i+1] = (div[i] + int(S[N-1-i])*pow(10,i,mod))%mod d = collections.Counter(div[1::]) ans = d[0] for i in d.values(): ans += i*(i-1)//2 print(ans)
p02768
s409401668
Accepted
def cmb(n, r, p): r = min(r, n - r) res = 1 for i in range(r): res *= pow(i+1, p-2, p) # 分母の逆元(フェルマーの定理) res *= n-i # 分子 res %= p return res p = 10 ** 9 + 7 n, a, b = map(int, input().split()) ans = pow(2, n, p) - 1 ans -= cmb(n, a, p) + cmb(n, b, p) print(ans % p)
p03998
s663001420
Accepted
ss = {i:list(input()) for i in "abc"} x = ss['a'].pop(0) while True: if not ss[x]: print(x.upper()) break else: x = ss[x].pop(0)
p02742
s186829257
Accepted
import sys h, w = list(map(int, input().split())) if h == 1 or w == 1: print(1) sys.exit() print(int((h * w + 1)/2))
p02725
s794253531
Accepted
import math import sys import collections import bisect readline = sys.stdin.readline def main(): k, n = map(int, readline().rstrip().split()) A = sorted(list(map(int, readline().rstrip().split()))) maxA = k + A[0] - A[n-1] for i in range(n-1): a = abs(A[i+1] - A[i]) maxA = max(maxA, a) print(k - maxA) if __name__ == '__main__': main()
p03592
s036788944
Wrong Answer
n,m,k = map(int, input().split()) for i in range(n): for j in range(m): if j*(n-i) + i*(m-j) == k: print("Yes") exit() print("No")
p02571
s418419671
Accepted
#b s = input() v = input() ans = 0 for i in range(len(s)-len(v)+1): count = 0 for j in range(len(v)): if s[i+j] == v[j]: count += 1 if count > ans: ans = count print(len(v) - ans)
p02917
s525781978
Wrong Answer
N = int(input()) B = [int(i) for i in input().split()] res = 0 for i in range(N-2): res += min(B[i], B[i+1]) res += B[-1] print(res)
p04043
s897484004
Accepted
text = str(input()) cnt = 0 for i in text: if i == "5": cnt += 1 if i == "7": cnt += 2 if cnt == 4: print("YES") else: print("NO")
p02631
s610124868
Accepted
import collections N = int(input()) a = list(map(int,input().split())) A = 0 for i in a: A = A^i for i in a: print(i^A)
p02917
s491428213
Wrong Answer
n = int(input()) b = list(map(int,input().split())) a = [-1]*n a[0] = a[1] = b[0] a[-1:] = b[-1:] for i in range(n-3): a[i+2] = min(b[i+1],b[i+2]) print(sum(a))
p04020
s920526877
Accepted
R=[0] L=list() N=int(input()) for i in range(N): k=int(input()) L.append(k) if k==0: R.append(len(L)) S=sum(L) R.append(N) for i in range(len(R)-1): if sum(L[R[i]:R[i+1]])%2==1: S=S-1 print(S//2)
p03773
s497957423
Accepted
A,B=map(int,input().split()) if A+B>=24: print(A+B-24) else: print(A+B)
p02787
s220541698
Wrong Answer
H, N = map(int, input().split()) dp = [[float("inf") for i in range(H+1)] for j in range(N+1)] dp[0][0] = 0 for i in range(N): a, b = map(int, input().split()) for j in range(H): dp[i+1][j] = min(dp[i][j], dp[i+1][j]) # if j-a >= 0: # dp[i+1][j] = min(dp[i][j], dp[i+1][j-a] + b) dp[i+1][min(j+a, H)] = min(dp[i+1][min(j+a, H)], dp[i+1][j] + b) print(dp[N][H])
p03011
s452771558
Wrong Answer
P,Q,R = map(int,input().split()) if P + R <= P + Q and P + R <= R + Q: answer = P + R elif P + Q <= P + R and P + Q <= R + Q: answer = P + Q elif R + Q <= P + R and R + Q <= R + Q: answer = P + Q print(answer)
p02658
s210681668
Wrong Answer
n=int(input()) li=list(map(int,input().split())) ans=1 if 0 in li: print('-1') import sys sys.exit() for l in li: ans*=l #print(ans) if ans > 10**18: print('-1') break else: print(ans)
p03544
s431555959
Wrong Answer
if __name__ == '__main__': tmp = int(input()) l = [2, 1] ans = 0 for i in range(tmp - 1): ans = l[i] + l[i + 1] l.append(ans) print(ans)
p02923
s924311799
Accepted
# C - Lower def main(): n = int(input()) h = list(map(int, input().split())) cnt = 0 ans = [] if n == 1: print(0) exit() for i in range(n-1): if h[i] >= h[i+1]: cnt += 1 if i == n-2: ans.append(cnt) else: ans.append(cnt) cnt = 0 print(max(ans)) if __name__ == "__main__": main()