problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03377
s670916426
Wrong Answer
A,B,X = map(int,input().split()) if A <= X and X <= B: print("YES") else: print("N0")
p03639
s847438441
Wrong Answer
n=int(input()) lis=list(map(int,input().split())) t,f=0,0 for i in lis: if i%2==0: t+=1 if i%4==0: f+=1 if t+f>=n: print("Yes") else: print("No")
p03293
s743714900
Accepted
S = input () T = input () X = 'No' for i in range (len(S)): if T == S[i:]+S[:i]: X = 'Yes' break print (X)
p02577
s548950817
Wrong Answer
n=int(input()) if(n==0): print("YES") elif(n%9==0): print("YES") else: print("NO")
p02820
s985495497
Accepted
n, k = map(int, input().split()) r, s, p = map(int, input().split()) t = list(input()) hand = {"r" : p, "s" : r, "p" : s} ans = 0 for i in range(n): temp= i-k if temp >=0 and t[i]==t[temp]: t[i]=" " else: ans+=hand[t[i]] print(ans)
p02577
s179991613
Accepted
# -*- coding: utf-8 -*- N = int(input()) if N % 9 == 0: print("Yes") else: print("No")
p03329
s162833815
Accepted
wt = int(input()) w = [1] for i in range(7): w.append(6 ** (i + 1)) for i in range(5): w.append(9 ** (i + 1)) n = len(w) dp = [[float("inf") for i in range(wt + 1)] for j in range(n + 1)] dp[0][0] = 0 for i in range(n): for j in range(wt + 1): if j >= w[i]: dp[i + 1][j] = min(dp[i + 1][j...
p03035
s121617042
Accepted
a,b=map(int,input().split()) if a>=13: print(b) elif a<=5: print('0') else: print(b//2)
p03592
s128914610
Wrong Answer
n, m, k = map(int, input().split()) ans = False for i in range(1, n + 1): if ans: break for j in range(1, m + 1): if i * (m - j) + (n - i) * j == k: ans = True break if ans: print('Yes') else: print('No')
p02730
s103673190
Accepted
s = input() n = len(s) if s == s[::-1]: t = s[:(n-1)//2] if t == t[::-1]: u = s[(n+3)//2-1:] if u == u[::-1]: print('Yes') exit() print('No')
p03030
s827017013
Accepted
N = int(input()) Nlist = [[] for _ in range(N)] for i in range(N): C, P = input().split() P = int(P) Nlist[i].append(i+1) Nlist[i].append(C) Nlist[i].append(P) Nlist.sort(key=lambda x: x[1]) Nlist.sort(key=lambda x: x[2],reverse=True) Nlist.sort(key=lambda x: x[1]) for i in range(N): print(Nlis...
p03951
s266125915
Wrong Answer
N = int(input()) s = str(input()) t = str(input()) if s == t: print(N) else: for i in range(N,0,-1): #print(s[N-i:],t[0:i],) if s[N-i:]==t[0:i]: print(2*N-i) break
p03719
s721058684
Accepted
A, B, C = map(int, input().split()) if A <= C <= B: print('Yes') else: print('No')
p02882
s090292315
Accepted
import math a, b, x = map(int, input().split()) full = a * a * b if x > full / 2: x = full - x tan_x = 2.0 * x / (a*a) / a print(math.atan(tan_x) / math.pi * 180.0) else: tan_x = 2.0 * x / (a*b) / b print(90-math.atan(tan_x) / math.pi * 180.0)
p03698
s867293305
Accepted
s=input() all_different=True for i in range(len(s)-1): for j in range(i+1,len(s)): if s[i]==s[j]: all_different=False if not all_different: break if all_different: print("yes") else: print("no")
p02987
s735366231
Accepted
s = input() l = [] count_a=0 count_b=0 for i in s: if i not in l: l.append(i) count_a+=1 else: count_b+=1 if count_a == 2 and count_b == 2: print('Yes') else: print('No')
p03206
s018637001
Wrong Answer
D =int(input()) print('Christmas'+'eve'*(25-D))
p02778
s863838818
Wrong Answer
S = input() print("X"*len(S))
p02577
s561480475
Wrong Answer
def Multiple9(x): if x < 10: return x c = 0 while x > 0: c += x%10 x //= 10 return c #main n = int(input()) while n > 10: n = Multiple9(n) if(n == 9): print('Yes') else: print('No')
p02773
s951526681
Wrong Answer
n=int(input()) l=[input() for i in range(n)] from collections import Counter as co k=co(l).most_common() d=k[0][1] for a,s in k: if s!=d:break else: print(a)
p03699
s465699700
Wrong Answer
n = int(input()) a = [int(input()) for i in range(n)] a.sort() tmp = sum(a) i = 0 while tmp%10==0 and i<n: tmp -= a[i] i += 1 print(tmp)
p02577
s604457807
Accepted
n=list(input()) s=0 for i in range(len(n)): s+=int(n[i]) if s%9==0:print('Yes') else:print('No')
p02836
s546307888
Wrong Answer
s=input() l=[] for i in s: l.append(i) new_l = l[::-1] count=0 for a,b in zip(l,new_l): if a != b: count+=1 print(count)
p02661
s845780369
Accepted
import statistics n = int( input() ) a = [] b = [] for _ in range( n ): a_i, b_i = map( int, input().split() ) a.append( a_i ) b.append( b_i ) m_a = statistics.median( a ) m_b = statistics.median( b ) if n % 2 == 1: print( int( m_b - m_a + 1 ) ) else: print( int( ( m_b - m_a ) * 2 + 1 ) )
p02706
s229157076
Accepted
n, m = map(int, input().split()) a_list = map(int, input().split()) for a in a_list: n -= a if n < 0: print("-1") else: print(n)
p03854
s457429651
Wrong Answer
s = input() import re output ="NO" s = re.sub('dreameraser', '', s) s = re.sub('dreamerase', '', s) s = re.sub('eraser', '', s) s = re.sub('dreamer', '', s) s = re.sub('dream', '', s) s = re.sub('erase', '', s) if s == "": output = "YES" print(output)
p02946
s422185183
Wrong Answer
k, x = map(int, input().split()) a = [] for i in range(-(k - 1), k - 1): a.append(x + i) print(sorted(a))
p03417
s593326825
Wrong Answer
n, m = map(int, input().split()) if n == 1 and m == 1: print("1") elif n == 1 and m != 1: print(m - 2) else: print((n - 2) * (m - 2))
p02631
s296829078
Accepted
N = int(input()) As = list(map(int, input().split())) num = 0 for a in As: num ^= a ans = [str(num ^ a) for a in As] print(" ".join(ans))
p03493
s303220957
Accepted
mass = input() s1 = int(mass[0]) s2 = int(mass[1]) s3 = int(mass[2]) c = 0 if s1 == 1: c += 1 if s2 == 1: c += 1 if s3 == 1: c += 1 print(c)
p02843
s092673336
Accepted
x=int(input()) num=x//100 print(1 if num*5+100*num>=x else 0)
p03331
s875272523
Wrong Answer
a = int() b = int() wa_list = [] n = int(input()) for a in range(n+1): b = n - a wa_list.append(sum(map(int, list(str(a)))) + sum(map(int, list(str(b))))) print(min(wa_list))
p02792
s230253652
Accepted
n = int(input()) ans = 0 for i in range(1,10) : for j in range(i,10) : c_a = 0 c_b = 0 for k in range(1,n+1) : kl = len(str(k)) if k//(10**(kl-1)) == i and k%10 == j : c_a += 1 if k//(10**(kl-1)) == j and k%10 == i : c_b += 1 if i == j : ans += c_a*c_b else...
p03457
s212784962
Accepted
n = int(input()) for i in range(n): t, x, y = map(int, input().split()) if (x+y)>t or (x+y)%2 != t%2: print("No") exit() print("Yes")
p03211
s516625032
Accepted
x=input() mini=1e+5 for i in range(len(x)-2): mini=min(mini,abs(753-int(x[i:i+3]))) print(mini)
p02833
s412958920
Accepted
import math # noqa import bisect # noqa import queue # noqa if __name__ == '__main__': N = int(input()) if N % 2 == 0: ans = N // 10 d = 50 while N // d > 0: ans += N // d d *= 5 print(ans) else: print(0)
p03681
s616400979
Accepted
n, m = list(map(int, input().split())) ans = 1 if n==m: for i in range(1, n+1): ans *= i ans %= 10**9+7 print((ans**2*2)%(10**9+7)) elif abs(n-m)==1: for i in range(1, n+1): ans *= i ans %= 10**9+7 for i in range(1, m+1): ans *= i ans %= 10**9+7 print(...
p02665
s402453768
Wrong Answer
N = int(input()) nums = list(map(int, input().split())) totalNode = 1 totalLeaf = 1 fail = False for i in range(N + 1): totalLeaf = (totalLeaf-nums[i])*2 if (totalLeaf < 0): fail = True break totalNode += totalLeaf if (fail): print(-1) else: print(totalNode)
p02987
s744889297
Accepted
s = list(input()) if len(set(s)) == 2 and sorted(s)[2] != sorted(s)[1]: print('Yes') else: print('No')
p03037
s883358450
Accepted
n, m = map(int, input().split()) LR = [list(map(int, input().split())) for _ in range(m)] ans =[0] * (n + 1) for l, r in LR: ans[l - 1] += 1 ans[r] -= 1 accu =[0] * (n + 1) for i in range(n): accu[i + 1] += ans[i] + accu[i] ans = accu.count(m) print(ans)
p02718
s383644375
Accepted
#input N, M = map(int,input().split()) A = list(map(int,input().split())) #count num count = 0 for i in range(N): if A[i] * 4 * M >= sum(A): #A[i] = sum(A)/(4*M) count +=1 #Check availavle N if count >= M: print("Yes") else: print("No")
p02909
s277876509
Accepted
l = ["Sunny", "Cloudy", "Rainy", "Sunny"] print(l[l.index(input()) + 1])
p02994
s001718652
Accepted
import sys input = sys.stdin.readline N, L = map(int,input().split()) A = [0] * N B = [0] * N for i in range(N): A[i] = L + i ans = 0 diff = 10 ** 10 for j in range(N): B[j] = sum(A) - A[j] diff = min(diff, abs(sum(A)-B[j])) if sum(A) >= 0: print(sum(A)-diff) else: print(sum(A)+diff)
p02742
s254171496
Wrong Answer
def main(): H, W = map( int, input().split()) if H%2 == 0 or W%2 == 0: print(H*W//2) else: print(H*W//2+1) if __name__ == '__main__': main()
p03239
s483860551
Wrong Answer
N, T = map(int,input().split()) cnt = T+1 jdg = False for _ in range(N): c, t = map(int,input().split()) if t <= T: cnt = min(cnt,c) jdg = True if jdg: print(cnt) else: print("TLE")
p03767
s692384503
Accepted
N = int(input()) A = list(map(int,input().split())) A.sort(reverse=True) ans = 0 for i in range(N): ans += A[2*i+1] print(ans)
p03077
s926184241
Accepted
import math from decimal import Decimal n = int(input()) a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) s = min(a, b, c, d, e) print(math.ceil(Decimal(n)/Decimal(s) + 4))
p02909
s310216203
Accepted
s=input() if s=='Sunny': print('Cloudy') elif s=='Cloudy': print('Rainy') else: print('Sunny')
p03555
s476671165
Accepted
S = input() T = input() if S==T[::-1]: print("YES") else: print("NO")
p02900
s677586908
Accepted
from fractions import gcd from math import sqrt a,s=map(int,input().split()) f=gcd(a,s) ans=1 if f<=3:print(1+(f!=1));exit() for i in range(2,int(sqrt(f))+1): if f%i==0: ans+=1 while f%i==0:f//=i print(ans+(f!=1))
p03136
s260168543
Accepted
N = int(input()) L = list(map(int,input().split())) L.sort() length = sum(L[:N-1]) if L[-1] < length: print('Yes') else: print('No')
p03109
s752019895
Wrong Answer
s=str(input()) ans="Heisei" if int(s[:4])<2019: ans="TBD" elif int(s[:4])==2019: if int(s[6:7])<=4: if int(s[8:])<30: ans="TBD" print(ans)
p02952
s593595611
Wrong Answer
S = input() slen = len(S) count = 0 for i in range(0,slen, 2): if ( i == slen-1): inv = 0 if i == 0 else round(int(S), -1 * (slen-1)) count = count + (int(S)-inv) + 1 # print(i, (int(S)-inv) + 1) else: count = count + 10 ** (i+1) - 10 ** (i) # print(i, 10 ** (i+1) - 1) pr...
p02783
s848919077
Accepted
h, a = map(int, input().split(' ')) print(h // a + 1 if h % a != 0 else h // a)
p02988
s767009108
Wrong Answer
n = int(input()) p = list(map(int, input().split())) ans = 0 for i in range(1, n-1): if p[i-1]<p[i] and p[i]<p[i+1]: ans += 1 print(ans)
p02973
s268111931
Accepted
from collections import deque from bisect import bisect_left import sys input = sys.stdin.readline N = int(input()) A = [int(input()) for _ in range(N)] nums = deque() for i in range(N): j = bisect_left(nums, A[i]) if j == 0: nums.appendleft(A[i]) else: nums[j-1] = A[i] print(len(nums))
p02948
s559350322
Wrong Answer
N, M = map(int, input().split()) A = [] for i in range (0, N): C, D = map(int, input().split()) A.append([C, D]) A = sorted(A) Days = [] Number = [] for i in range (0, N): Days.append(A[i][0]) Number.append(A[i][1]) Queue = [] import bisect as bi for i in range (1, M+1): left = bi.bisect_left(Days, i) right...
p02797
s843640489
Wrong Answer
N,K,S = map(int,input().split()) if N == 10**9: print(str(S)*K + str(1)*(N-K)) else: print(str(S)*K + str(S+1)*(N-K))
p03030
s683831470
Accepted
n = int(input()) SP = [] for i in range(n): s, p = input().split() SP.append((s, int(p), i+1)) SP.sort(key=lambda x: x[1], reverse=True) SP.sort(key=lambda x: x[0]) for s, p, i in SP: print(i)
p02911
s384022900
Accepted
N, K, Q = map(int,input().split()) A = [0] * N for q in range(Q): a = int(input()) A[a-1] += 1 for n in range(N): if (Q-A[n]) >= K: print('No') else: print('Yes')
p02823
s046445669
Wrong Answer
import sys input = sys.stdin.readline # A - Table Tennis Training N, A, B = map(int, input().split()) if (B-A) % 2 == 0: print(int((B-A) / 2)) else: print(min(B - 1, N - A))
p03407
s175262255
Accepted
def resolve(): a, b, c = map(int, input().split()) if c <= a+b: print("Yes") else: print("No") resolve()
p03659
s416125614
Wrong Answer
n = int(input()) a = [int(i) for i in input().split()] x=0 y=0 a.sort() min=10**6 if sum(a)==0 and n>2: print(0) exit() for i in range(n-1): x+=a[i] if min>abs(2*x-sum(a)): min=abs(2*x-sum(a)) print(min)
p03284
s522743569
Accepted
N,K = list(map(int,input().split())) if N%K == 0: print('0') else: print('1')
p03456
s655897222
Accepted
a, b = map(int,input().split()) for i in range(2, 400): if (10**(len(str(b))) * a + b) == i**2: ans = 'Yes' break else: ans = 'No' print(ans)
p02584
s782914365
Accepted
x,k,d = map(int,input().split()) x = abs(x) xmd = x%d xdd = x//d x -= k*d if x < 0: print(xmd if (k-xdd)%2 == 0 else d-xmd) else: print(x)
p02691
s536292784
Wrong Answer
N = int(input()) + 1 A = [0] + [int(i) for i in input().split()] i_Ai = [i + A[i] for i in range(N)] j_Aj = [j - A[j] for j in range(0, N)] cnt = 0 if max(A) - min(A) > N: print(0) else: for i in range(1, N): for j in range(i_Ai[i], N): if j_Aj[j] == i_Ai[i]: cnt += 1 pr...
p03059
s635404176
Accepted
A, B, T = map(int, input().split()) c = T // A d = c * B print(d)
p02819
s320100759
Accepted
X=int(input()) ans_ama=X Flag=True while 1: for i in range(2,int(X/2)): if X%i==0: Flag=False break if Flag==True: ans=X break Flag=True X+=1 print(X)
p04019
s097045071
Accepted
S = str(input()) ans = True if ('N' in S) ^ ('S' in S) == 1: ans = False if ('E' in S) ^ ('W' in S) == 1: ans = False if ans: print('Yes') else: print('No')
p03408
s489844419
Accepted
N = int(input()) n_list = [] for i in range(N): n_list.append(input()) M = int(input()) m_list = [] for i in range(M): m_list.append(input()) add_dic = {} for n in n_list: add = add_dic.get(n, 0) add_dic[n] = add + 1 diff_dic = {} for m in m_list: diff = diff_dic.get(m, 0) diff_dic[m] = diff + 1 max_ = 0 f...
p03795
s991757789
Accepted
a=int(input()) print(a*800-a//15*200)
p03796
s961407628
Accepted
n = int(input()) ans = 1 for i in range(1,n+1): ans = i * ans % (10**9+7) print(ans)
p03632
s346464599
Wrong Answer
N = list(map(int, input().split())) if N[2]-N[1] < 0: print(abs(N[2]-N[1])) else: print(0)
p03437
s060471954
Accepted
a,b = map(int,input().split()) print(-1 if a%b == 0 else a)
p02691
s055166951
Accepted
from collections import Counter N = int(input()) A1 = list(map(int, input().split())) A2 = [-1 * A1[i] for i in range(N)] for i in range(N): A1[i] -= i A2[i] -= i C1 = Counter(A1) C2 = Counter(A2) res = 0 for c1 in C1.keys(): res += C1[c1] * C2[c1] print(res)
p03448
s742820801
Accepted
a = int(input()) b = int(input()) c = int(input()) x = int(input()) p = 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: p += 1 print(p)
p03698
s323342658
Accepted
S = str(input()) cnt =0 flg = True for i in range(len(S)-1): if S[i] in S[cnt+1:]: flg =False cnt+=1 if flg ==True: print("yes") else: print("no")
p02916
s714931119
Wrong Answer
n = int(input()) qq= list(map(int,input().split())) ww = list(map(int,input().split())) c = list(map(int,input().split())) t = 0 for i in range(n): if i != 0: t = t+ww[qq[i]-1]+c[qq[i]-2] else: t = t + ww[qq[i]-1] print(t)
p02683
s094423838
Accepted
N,M,X=map(int,input().split()) B=[list(map(int,input().split())) for _ in range(N)] inf=(10**5)*12+1 ans=inf for i in range(1,2**N): tmp=[0]*M c=0 for j in range(N): if i>>j&1: for k in range(M): tmp[k]+=B[j][k+1] c+=B[j][0] if len([i for i in tmp if i>=X])==M: ans=min(c,ans) print(a...
p03282
s846599734
Wrong Answer
import sys def input(): return sys.stdin.readline().strip() def main(): S = input() K = int(input()) for c in S: if c != '1': print(int(c)) return print(1) if __name__ == "__main__": main()
p03838
s390177230
Accepted
x,y = map(int,input().split()) count = 1 if x*y > 0: if x < y: count = y - x elif x > y: count = 2 + abs(y-x) elif abs(x) == abs(y): count = 0 elif x*y < 0: if x > y or x < y: count = 1 + abs(abs(x) - abs(y)) elif abs(x) == abs(y): count = 0 else: if x != 0: count = abs(x) if x ...
p02548
s022093598
Wrong Answer
N = int(input()) n=int(N**0.5) cnt=0 for i in range(1,n+1): a=N//i if a-i-1>0: cnt+=(a-i-1)*2 if i**2!=N: cnt+=1 if a*i<=N-1: cnt+=2 print(cnt)
p03796
s064171222
Accepted
import math N = int(input()) num = math.factorial(N) k, r = divmod(num, 10**9 + 7) print(r)
p02939
s848194688
Accepted
s=input() ans=1 cur,before='',s[0] for i in range(1,len(s)): cur+=s[i] if cur!=before: ans+=1 before=cur cur='' print(ans)
p03478
s070710978
Accepted
N,A,B = map(int,input().split()) ans = 0 for i in range(N+1): n = i sum = 0 while n > 0: sum += n % 10 n = int(n/10) if(A<=sum<=B): #print(sum,i) ans += i print(ans)
p03062
s717366058
Accepted
import sys input = sys.stdin.readline def main(): N = int(input()) A = [int(x) for x in input().split()] count = 0 ans = 0 mi = float("inf") for a in A: ans += abs(a) mi = min(mi, abs(a)) if a <= 0: count += 1 if count & 1: print(ans - mi * 2) ...
p03797
s374399874
Wrong Answer
n,m= list(map(int, input().split())) if n>=m*2: print(m//2+(n-m//2)//2) else: print(n+(m-n*2)//4)
p03061
s429309763
Accepted
n = int(input()) a = list(map(int,input().split())) from fractions import gcd l,r = [0]*(n+1),[0]*(n+1) for i in range(n): l[i+1] = gcd(l[i],a[i]) for i in range(n,0,-1): r[i-1]= gcd(r[i],a[i-1]) ans = 0 for i in range(n): ans = max(ans,gcd(l[i],r[i+1])) print(ans)
p02993
s365317181
Accepted
S = list(str(input())) if S[0] != S[1] and S[1] != S[2] and S[2] != S[3]: print('Good') else: print('Bad')
p03723
s138000031
Accepted
A, B, C = map(int, input().split()) for i in range(36): if A % 2 or B % 2 or C % 2: break tA = (B + C) // 2 tB = (A + C) // 2 tC = (B + A) // 2 A = tA B = tB C = tC else: i = -1 print(i)
p03001
s212797735
Accepted
import sys sys.setrecursionlimit(10**9) def mi(): return map(int,input().split()) def ii(): return int(input()) def isp(): return input().split() def deb(text): print("-------\n{}\n-------".format(text)) INF=10**20 def main(): W,H,x,y = mi() ans = '{:.10f}'.format(W*H/2) ans2 = 1 if x==W/2 and y==H/2 els...
p02820
s365500782
Accepted
n, k = map(int, input().split()) r, s, p = map(int, input().split()) t = input() x = [True for _ in range(n)] ans = 0 for i in range(n): if k <= i and x[i - k] and t[i] == t[i - k]: x[i] = False else: if t[i] == 'r': ans += p elif t[i] == 's': ans += r e...
p03042
s157210246
Accepted
s = list(input()) s1 = ''.join(s[:2]) s2 = ''.join(s[2:]) flag1 = False flag2 = False if 1 <= int(s1) and int(s1) <= 12: flag1 = True if 1 <= int(s2) and int(s2) <= 12: flag2 = True if flag1 and flag2: print('AMBIGUOUS') elif flag1: print('MMYY') elif flag2: print('YYMM') else: print('NA')
p03625
s463373410
Accepted
from collections import Counter N = int(input()) A = list(map(int,input().split())) count = Counter(A) keys = list(count.keys()) keys.sort(reverse = True) a = 0 b = 0 for k in keys: if a == 0: if count[k] >= 4: a = b = k break elif count[k] >= 2: a = k else: ...
p02694
s793871031
Accepted
import math X = int(input()) m = 100 y = 1 while True: m += math.floor(m * 0.01) if m >= X: print(y) break y += 1
p02712
s243875116
Accepted
def solve(n): res = 0 for i in range(1, n + 1): if i % 3 == 0 or i % 5 == 0: continue else: res += i return res def main(): n = int(input()) res = solve(n) print(res) def test(): assert solve(15) == 60 assert solve(1000000) == 266666333332 if...
p03324
s445241420
Accepted
d, n = map(int, input().split()) if d==0 and n==100: print(101) elif d==1 and n==100: print(10100) elif d==2 and n==100 : print(1010000) else: base = 100**d print(base*n)
p02791
s985069517
Wrong Answer
import itertools N = int(input()) li = input().split() tmp = int(li.pop(0)) tmp = len(list(itertools.permutations(range(N), tmp))) res = list() res.append(tmp) m = min(res) for item in li: item = int(item) tmp = len(list(itertools.permutations(range(N), item))) if tmp <= m: res.append(tmp) m = min(res) pr...
p03075
s328178164
Accepted
a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) k = int(input()) if (e-a) <= k : print("Yay!") else : print(":(")