problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03086
s332453021
Accepted
S = input() N = len(S) length = 0 for i in range(N): for j in range(i,N): if all([(c in 'ACGT') for c in S[i:j+1]]): length = max(length, len(S[i:j+1])) print(length)
p03037
s326702519
Accepted
N, M = map(int, input().split()) L_list = [] R_list = [] for i in range(M): L, R = map(int, input().split()) L_list.append(L) R_list.append(R) if min(R_list) - max(L_list) < 0: print("0") else: print(min(R_list) - max(L_list) + 1)
p02677
s052981898
Accepted
import math A, B, H, M = map(float, input().split()) m_angle = 6.0 * M h_angle = 30.0 * H + 0.5 * M theta = abs(h_angle - m_angle) theta = min(theta, 360.0 - theta) print(math.sqrt(A * A + B * B - 2 * A * B * math.cos(math.radians(theta))))
p03627
s785392712
Wrong Answer
from collections import Counter n = int(input()) a_input = list(map(int,input().split())) a_c = sorted(Counter(a_input).items(),key=lambda x:x[0],reverse=True) max_len=0 next_len=0 ans=0 for a in a_c: if a[1]<2: continue max_len = max(max_len,a[0]) if a[1]>=4: ans = a[0]**2 if max_len...
p02910
s943327710
Wrong Answer
S = input() ans_1 = False ans_2 = False for i in range (0, len(S), 2): if S[i] != "L": ans_1 = True for j in range (1, len(S), 2): if S[j] != "R": ans_2 = True if ans_1 and ans_2: print("Yes") else: print("No")
p02982
s486882881
Accepted
n,d = map(int, input().split()) x = [list(map(int, input().split())) for _ in range(n)] ans = 0 for i in range(n-1): for j in range(i+1,n): s = 0 for k in range(d): s += abs(x[i][k] - x[j][k])**2 s = s**0.5 if s.is_integer(): ans += 1 print(ans)
p03438
s466449690
Accepted
import sys ## io ## def IS(): return sys.stdin.readline().rstrip() def II(): return int(IS()) def MII(): return list(map(int, IS().split())) def MIIZ(): return list(map(lambda x: x-1, MII())) #======================================================# def main(): n = II() aa = MII() bb = MII() ra = rb = 0 ...
p03645
s903258016
Wrong Answer
n,m = map(int,input().split()) l =[ list(map(int,input().split())) for i in range(m)] l1 = set([i[1] for i in l if i[0]==1]) l2 = set([i[2] for i in l if i[0]==n]) l3 = l1&l2 if len(l3)>=1: print("POSSIBLE") else: print("IMPOSSIBLE")
p03073
s029634992
Accepted
s=input() n1=s[::2].count("0")+s[1::2].count("1") n2=s[::2].count("1")+s[1::2].count("0") print(min(n1,n2))
p03986
s555279489
Accepted
X = input() s_cnt = 0 ans = 0 for s in X: if s=='S': s_cnt += 1 else: if s_cnt > 0: ans += 1 s_cnt -= 1 print(len(X) - 2*ans)
p02935
s323367577
Accepted
import heapq n = int(input()) v = list(map(int, input().split())) heapq.heapify(v) count = 0 ab = 0 while count < n-1: a = heapq.heappop(v) b = heapq.heappop(v) ab = (a+b)/2 heapq.heappush(v, ab) count += 1 ans = ab print(ans)
p02797
s943223853
Wrong Answer
N, K, S = map(int, input().split()) if N==K: A = [S]*N print(*A) exit() if S%2 == 0: a = S//2 b = S//2 else: a = S//2+1 b = S//2 A = [0]*N for i in range(N): if i%2==0: A[i] = a else: A[i] = b print(A) cnt = 0 for i in range(N-1): if A[i]+A[i+1] == S: cnt += 1 print(cnt) ind = N-1 while ...
p03434
s747992723
Accepted
"""abc088_b""" N = input() a = sorted(list(map(int, input().split())), reverse=True) print(sum(a[0::2])-sum(a[1::2]))
p03262
s501638163
Accepted
from fractions import gcd n, x = [int(i) for i in input().split()] x_list = [int(i) for i in input().split()] temp_list = [abs(num - x) for num in x_list] ans = temp_list[0] for i in range(1, n): ans = gcd(ans, temp_list[i]) if ans == 1: break print(ans)
p03944
s850328546
Accepted
W, H, N = map(int, input().split()) right = W left = 0 top = H bottom = 0 for i in range(N): x, y, a = map(int, input().split()) if a == 1 and left <= x: left = x elif a == 2 and right >= x: right = x elif a == 3 and bottom <= y: bottom = y elif a == 4 and top >= y: ...
p02681
s078597709
Accepted
s = input() t = input() if s == t[:-1]: print('Yes') else: print('No')
p02952
s828483949
Accepted
n=int(input()) t=n c=1 while t>=10: t=t//10 c=c+1 ans=0 for i in range(1,c): if i%2==1: ans+=10**(i)-10**(i-1) if c%2==1: ans=ans+n+1-10**(c-1) print(ans)
p03760
s904088341
Accepted
a=input() b=input() c=len(a) d=len(b) x="" if c<=d: for i in range(c): x=x+a[i] x=x+b[i] print(x) if c>d: for i in range(d): x=x+a[i] x=x+b[i] x=x+a[len(a)-1] print(x)
p03720
s853291423
Wrong Answer
n,m=map(int,input().split()) l={} for i in range(m): p,q=map(int,input().split()) if not p in l: l[p]=1 else: l[p]+=1 if not q in l: l[q] = 1 else: l[q] += 1 print(*l.values(), sep='\n')
p02946
s690495799
Wrong Answer
K, X = map(int, input().split()) A = [] for i in range(K): A.append(X-K+i+1) for i in range(K-1): A.append(X+i+1) print(A, sep=" ")
p03852
s227691995
Wrong Answer
S = input() results = True while results: for key_word in ("erase", "eraser", "dream", "dreamer"): if S.endswith(key_word): S = S[:-len(key_word)] continue if S == '': print("YES") results = False break else: print("NO") results = False...
p02838
s164532901
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) MOD = 10 ** 9 + 7 N = int(input()) A = list(map(int, input().split())) B = [bin(a) for a in A] maxA = max(A) mask = 1 count = 0 i = 0 while maxA >> i: zeros = sum([1...
p02899
s355899196
Accepted
N = int(input()) A = [int(i) for i in input().split()] B = [0] * N for i, a in enumerate(A): B[a-1] = i+1 print(*B)
p03481
s934808246
Wrong Answer
X,Y = map(int, input().split()) ans = X count = 0 while(ans < Y): if(ans*2>Y): exit() else: ans = ans * 2 count += 1 print(ans)
p03679
s995602577
Wrong Answer
x,a,b = (int(i) for i in input().split()) if a < b: if b-a > x: print ('dengerous') else: print ('safe') else: print ('delicious')
p02948
s633066179
Accepted
import heapq N,M=map(int,input().split()) AB=[[]for i in range(10**5+1)] for i in range(N): a,b=map(int,input().split()) AB[a].append(-b) q=[] heapq.heapify(q) ans=0 for i in range(1,M+1): for b in AB[i]: heapq.heappush(q,b) if len(q)>0: ans+=-heapq.heappop(q) print(ans)
p03208
s166268965
Wrong Answer
n, k = map(int,input().split(" ")) trees = [] for i in range(n): trees.append(int(input())) trees.sort() min_val = trees[k-1] - trees[0] for i in range(1, n - k + 1): min_val = min(abs(trees[i-k+1] - trees[i]), min_val) print(min_val)
p03437
s459755052
Wrong Answer
x,y=map(int,input().split()) if y%x == 0: print(-1) else: print(x)
p02627
s755178047
Wrong Answer
import sys input = sys.stdin.readline def main(): s = input() if s.isupper(): print(s.lower()) else: print(s.upper()) if __name__ == '__main__': main()
p02973
s508751800
Wrong Answer
N = int(input()) A = [int(input()) for _ in range(N)] mi = float("inf") ans = 0 for i in range(N): if mi >= A[i]: ans += 1 mi = A[i] print(ans)
p03861
s348192039
Accepted
a,b,x = map(int, input().split()) print(b//x - a//x + (a%x == 0))
p03486
s546268440
Accepted
s = input() t = input() s = sorted(s) t = sorted(t)[::-1] if s == t: print("No") exit() st = [] st.append(s) st.append(t) st = sorted(st) if st[0] == s: print("Yes") else: print("No")
p03127
s433701617
Accepted
from fractions import gcd n = int(input()) a = list(map(int, input().split())) ans = a[0] for i in range(1, n): ans = gcd(ans, a[i]) print(ans)
p02570
s164682308
Accepted
D, T, S = map(int, input().split()) print('Yes' if D <= T*S else 'No')
p02989
s391257516
Wrong Answer
# ALC 005 C N = int(input()) list_d = list(map(int, input().split())) list_d.sort() list_d[N//2] - list_d[N//2 -1]
p03385
s416661283
Wrong Answer
S = input() if S[0] == 'a' or 'b' or 'c' and S[1] == 'a' or 'b' or 'c' and S[2] == 'a' or 'b' or 'c': print ('YES') else: print ('No')
p03486
s923697699
Accepted
s=sorted(input()) t=sorted(input(),reverse=True) n=min(len(s),len(t)) for i in range(n): if ord(s[i])<ord(t[i]): print("Yes") exit() elif ord(t[i])<ord(s[i]): print("No") exit() if len(s)<len(t): print("Yes") else: print("No")
p02613
s164246999
Wrong Answer
N = int(input()) result = [input() for _ in range(N)] C_AC,C_TLE,C_WA,C_RE = [0,0,0,0] for i in result: if i == "AC": C_AC += 1 elif i == "WA": C_WA += 1 elif i == "TLE": C_TLE += 1 elif i == "RE": C_RE += 1 print("AC x " + str(C_AC)) print("WA x " + str(C_WA)) print("TLE x " + str(C_TLE)) p...
p03693
s933296393
Accepted
def main(): a, b, c = map(int, input().split()) print(['NO', 'YES'][(a*100+b*10+c) % 4 == 0]) main()
p02552
s849578586
Wrong Answer
seq = int(input()) a = 10**9 + 7 answer = (10**seq - 2*9**seq + 8**seq)%a print(answer)
p02881
s244020004
Accepted
n=int(input()) rootn=int(n**(0.5))+1 m=10**20 for i in range(1,rootn): if n/i==n//i: m=min(m,i+n//i) print(m-2)
p03720
s680701808
Accepted
n,m = map(int,input().split()) road = [list(map(int,input().split())) for r in range(m)] ans = [0] * n for r in road: for rr in r: ans[rr-1] += 1 for a in ans: print(a)
p02547
s899033955
Accepted
N = int(input()) D = [input().split() for i in range(N)] ans = 'No' for i in range(N-2): if D[i][0] == D[i][1] : if D[i+1][0] == D[i+1][1] : if D[i+2][0] == D[i+2][1] : ans = 'Yes' print(ans)
p02957
s402842487
Accepted
a, b = map(int, input().split()) ans = '' if a % 2 != b % 2: ans = 'IMPOSSIBLE' else: ans = (a + b) // 2 print(ans)
p03038
s749275855
Accepted
from heapq import heappop, heappush, heapify N, M = map(int, input().split()) A = list(map(int, input().split())) BC = [] for _ in range(M): B, C = map(int, input().split()) BC.append((B, C)) heapify(A) BC = sorted(BC, key = lambda x: -x[1]) for b, c in BC: for j in range(b): a = heappop(A) ...
p03796
s978311184
Accepted
power=1 for i in range(1,int(input())+1): power=(power*i)%(10**9+7) print(power)
p02598
s425813713
Wrong Answer
#E - Logs import math # 入力 N,K = map(int,input().split()) A = list(map(int,input().split())) Amax = int(max(A)) high = Amax Cancut = Amax low = 0 while ( low < high ) : Cut = 0 X = (high + low) / 2 for i in range(N): Cut = Cut + math.ceil(A[i]/X) - 1 if Cut <= K: high = X - 0.0001 ...
p02663
s642731502
Accepted
h1, m1, h2, m2, K = list(map(int, input().split())) diff = (h2-h1) * 60 + m2-m1 print(diff - K)
p02820
s156958233
Wrong Answer
N, K = map(int, input().split()) R, S, P = map(int, input().split()) T = input() ans = [] for idx, t in enumerate(T): if t == 'r': ans.append(P) elif t == 's': ans.append(R) elif t == 'p': ans.append(S) for i in range(N-K): if T[i] == T[i+K]: ans[i+K] = 0 p...
p02747
s115951663
Accepted
S=input() if S=="hi" or S=="hihi" or S=="hihihi" or S=="hihihihi" or S=="hihihihihi": print("Yes") else: print("No")
p03293
s546920374
Accepted
S = input() T = input() def rotate(s): rotate_list = [] for _ in range(len(s)): # 最後の文字を取り出す tmp = s[-1] # 残りとくっつける tmp = tmp + s[0:-1] rotate_list.append( tmp ) s = tmp return rotate_list l = rotate(S) if T in l: print('Yes') else: print('No')
p02640
s882215762
Accepted
x, y = map(int, input().split()) for a in range(x + 1): if 2 * a + 4 * (x - a) == y: answer = "Yes" break else: answer ="No" print(answer)
p02995
s397223934
Wrong Answer
import math import fractions A,B,C,D= map(int,input().split()) c = math.floor(B/C)-math.ceil(A/C) + 1 d = math.floor(B/D)-math.ceil(A/D) + 1 s = C*D//fractions.gcd(C,D) e = math.floor(B/s)-math.ceil(A/s) + 1 print(B-A+1-c-d+e)
p02911
s820164912
Accepted
n, k, q = [int(i) for i in input().split()] a = [None for i in range(q)] for i in range(q): a[i] = int(input()) pt = [0 for i in range(n)] for i in range(q): pt[a[i] - 1] += 1 th = q - k result = list(map(lambda x: 'Yes' if x > th else 'No', pt)) print('\n'.join(result))
p02633
s725624312
Accepted
X = int(input()) import math A = X // math.gcd(360, X) ans = 360 * A // X print(ans)
p02699
s944817214
Wrong Answer
S, W = map(int, input().split()) if S / 2 <= W: print('unsafe') else: print('safe')
p02847
s013470127
Wrong Answer
S = input('曜日を入力してください > ') if S == 'MON': print(6) elif S == 'TUE': print(5) elif S == 'WED': print(4) elif S == 'THU': print(3) elif S == 'FRI': print(2) elif S == 'SAT': print(1) elif S == 'SUN': print(7) else: print('曜日が無効です')
p02665
s774947329
Accepted
n,*a=map(int,open(0).read().split());t,w=sum(a),1;print(sum([1]+[exit(print(-1)) if(w:=min(2*(w-q),t:=t-q))<0 else w for q in a]))
p02988
s900577763
Accepted
s=int(input()) a=list(map(int,input().split())) c=0 for x in range(1,s-1): if a[x-1]<a[x] and a[x]<a[x+1]:c+=1 if a[x-1]>a[x] and a[x]>a[x+1]:c+=1 print(c)
p03637
s517098325
Accepted
n=int(input()) a=list(map(int,input().split())) amari=[0]*4 for i in range(n): amari[a[i]%4]+=1 if amari[2]>0: if amari[1]+amari[3]<=amari[0]: print("Yes") else: print("No") else: if amari[1]+amari[3]-1<=amari[0]: print("Yes") else: print("No")
p02658
s522514684
Wrong Answer
n = int(input()) arr = list(map(int,input().split())) pro = 1 for i in arr: pro *= i if pro > 10**18: print(-1) break else: print(pro)
p03795
s397592407
Accepted
n = int(input()) ans = 800*n - (n//15)*200 print(ans)
p03495
s767338869
Accepted
import collections n,k = map(int, input().split()) a = list(map(int, input().split())) l = collections.Counter(a) p = list(l.values()) p.sort() ans = 0 for i in range(len(p)-k): ans += p[i] print(ans)
p02725
s088886938
Accepted
K, N = map(int, input().split()) a = list(map(int,input().split())) A = sorted(a) maxl = A[0] + K - A[N-1] if maxl <= 0: maxl = -1 * maxl for i in range(N-1): l = A[i] - A[i+1] if l <= 0: l = -1 * l if maxl < l: maxl = l ans = K - maxl print(ans)
p03243
s895469302
Wrong Answer
# coding: utf-8 # Your code here! N=list(input()) if len(set(N))==1: print(''.join(N)) else: N=[max(N)]*len(N) print(''.join(N))
p02723
s456353902
Wrong Answer
S = input() if (S[2]==S[3]) and (S[4]==S[5]): print("Yes") else: print("Np")
p02859
s497116044
Wrong Answer
import math r=int(input()) area1=math.pi arear=math.pi*pow(r,2) ratio=int(arear/area1) print(ratio)
p02705
s430115011
Wrong Answer
import math r = int(input()) print(r * math.pi)
p03773
s563002656
Accepted
a,b = map(int,input().split()) if a+b > 23: print(a+b-24) else: print(a+b)
p03943
s645940656
Accepted
ais = sorted(map(int, raw_input().split())) print 'Yes' if sum(ais[:2]) == ais[2] else 'No'
p03815
s144712047
Wrong Answer
x=int(input()) ans=2*(x//11) x-=(ans//2)*11 if x<=6: ans+=1 else: ans+=2 print(ans)
p02612
s093436850
Wrong Answer
n=int(input()) x=0 while x<n: x+=1000 print(n-x)
p02594
s217862414
Wrong Answer
X = int(input()) if X > 30: print("Yes") else: print("No")
p03494
s002464968
Accepted
n=int(input()) L=list(map(int,input().split())) cnt=0 ok=1 while ok: for i in range(n): if L[i]%2==1: ok=0 break L[i]/=2 if ok:cnt+=1 print(cnt)
p03557
s295820659
Accepted
from bisect import bisect_left, bisect_right # import random N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) # N = 10 ** 5 # A = [random.randint(1, 10**9) for _ in range(N)] # B = [random.randint(1, 10**9) for _ in range(N)] # C = [random.ra...
p02801
s125634364
Accepted
c = input() print(chr(ord(c)+1))
p02694
s094734322
Accepted
from decimal import Decimal x = int(input()) t = 100 n = 0 while t < x: t += t // 100 n += 1 print(n)
p03556
s335020662
Accepted
print(int(int(input())**.5)**2)
p02963
s015483401
Wrong Answer
def resolve(): ''' code here ''' S = int(input()) a, b = divmod(S, 10**9) x2 = (a+1) * 10**9 - b y2 = (S+x2) // (10**9) print(0,0, 10**9, 1, x2, y2) if __name__ == "__main__": resolve()
p02607
s479840987
Wrong Answer
#!/usr/bin/env python3 import sys from collections import deque, Counter from heapq import heappop, heappush from bisect import bisect_right from itertools import accumulate sys.setrecursionlimit(10**6) INF = 10**12 m = 10**9 + 7 def main(): N = int(input()) a = list(map(int, input().split())) ans = 0 ...
p03351
s531085875
Accepted
a,b,c,d = map(int,input().split()) if abs(c-a) <= d: print("Yes") elif abs(b-a) <= d and abs(c-b) <= d: print("Yes") else: print("No")
p02829
s520159643
Accepted
A=int(input()) B=int(input()) C=6-A-B print(C)
p02597
s826482489
Accepted
N = int(input()) S = input() print(S[S.count("R"):].count("R"))
p03407
s608094206
Wrong Answer
a,b,c=map(int,input().split()) print("Yes" if a+b>c else "No")
p02600
s140325263
Wrong Answer
x = int(input()) if 400 <= x <= 599: print(8) elif 400 <= x <= 599: print(7) elif 600 <= x <= 799: print(6) elif 800 <= x <= 999: print(5) elif 1000 <= x <= 1199: print(4) elif 1200 <= x <= 1399: print(3) elif 1400 <= x <= 1599: print(2) elif 1800 <= x <= 1999: print(1)
p03645
s865808962
Accepted
# -*- coding: utf-8 -*- def main(): import sys input = sys.stdin.readline n, m = map(int, input().split()) first = list() second = list() for i in range(m): ai, bi = map(int, input().split()) if ai == 1: first.append(bi) if bi == n: second.ap...
p03827
s017904689
Accepted
#!/usr/bin/env python3 _, s = open(0).read().split() print( max([sum(1 if i == "I" else -1 for i in s[:j+1]) for j in range(int(_))] + [0]))
p03543
s570286424
Wrong Answer
n=list(input()) print('Yes' if sum([n.count(n[i])>=3 for i in range(len(n))]) >=3 else 'No')
p02924
s565945880
Wrong Answer
N = int(input()) ans = (N * (N+1)) / 2 - N print(int(ans))
p02646
s795007507
Accepted
A,V =[int(i) for i in input().split()] B,W = [int(i) for i in input().split()] T = int(input()) if V > W: if abs(A - B) / abs(V - W) <= T: print("YES") else: print("NO") else: if V == W and A == B: print("YES") else: print("NO")
p02768
s718632444
Accepted
import math z = 10**9 + 7 n, a, b = [int(i) for i in input().split()] r = pow(2, n, z) - 1 def c(m): x = 1 for i in range(n-m+1, n+1): x = x*i % z return (x * pow(math.factorial(m), z-2, z)) % z r = (r - c(a) - c(b)) % z print(r)
p02552
s730861012
Accepted
x = int(input()) print(1 if x ==0 else 0)
p02791
s065752736
Wrong Answer
#!/usr/bin/env python3 def main(): N = int(input()) *P, = map(int, input().split()) mini = 2*10**5 cnt = 0 for _ in P: if _ >= mini: mini = _ cnt += 1 else: continue print(cnt) main()
p03474
s757199923
Accepted
A, B = map(int, input().split()) S = input() if len(S) == A + B + 1 and S[A] == '-': for i in range(len(S)): if i != A and not S[i].isdecimal(): print('No') exit() print('Yes') else: print('No')
p03472
s012348250
Accepted
# coding: utf-8 N,H=map(int,input().split()) A=[] B=[] for i in range(N): a,b=map(int,input().split()) A.append(a) B.append(b) MA=max(A) ans=0 B.sort() k=-1 while B[k]>MA: H-=B[k] k-=1 ans+=1 if H<=0: break if k<-N: break if H>=0: ans+=-(-H//MA) print(ans)
p02761
s149766669
Accepted
n, m = map(int,input().split()) sc = [list(map(int,input().split())) for _ in range(m)] ans = -1 for i in range(1000): s_i = str(i) if len(s_i) == n and all(int(s_i[s-1])==c for s,c in sc): ans = i break print(ans)
p03386
s238681573
Accepted
A, B, K = map(int, input().split()) list = [i for i in range(A, A+K)] list.extend(i for i in range(B+1-K, B+1)) list = sorted(set(list)) for i in list: if A<=i<=B: print(i)
p02631
s855061600
Accepted
N=int(input()) a=list(map(int,input().split())) S=0 for i in a: S^=i a=[S^i for i in a] print(*a)
p03387
s694395632
Accepted
a, b, c = map(int, input().split()) d = (a % 2) + (b % 2) + (c % 2) m = max(a, b, c) s = a + b + c ans1 = (3 * m - s) // 2 ans2 = (3 * (m + 1) - s) // 2 if d == 0 or d == 3: ans = ans1 elif d == 1: if m % 2 == 1: ans = ans1 else: ans = ans2 else: if m % 2 == 0: ans = ans1 els...
p02952
s488024533
Accepted
n = int(input()) count = 0 for i in range(1, n+1): num = str(i) if len(num) %2 != 0: count += 1 print(count)