problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02983
s134512793
Accepted
# 初期入力 import sys input = sys.stdin.readline L,R = (int(x) for x in input().split()) mod_L =L %2019 mod_R =R %2019 ans =0 xx=[] if 2018 <= R -L: ans =0 elif mod_R < mod_L: ans =0 elif mod_L==0 : ans =0 else: for i in range(L,R): for j in range(i+1,R+1): x =i*j %2019 xx.append(x) ans =min(xx) print(ans)
p03062
s988331900
Accepted
c=0 n=int(input()) a = list(map(int, input().split())) for i in range(n): if a[i]<0: a[i]*=-1 c+=1 if c%2==0: print(sum(a)) else: print(sum(a)-min(a)*2)
p02717
s845578179
Accepted
X, Y, Z = [int(x) for x in input().split()] print(Z, X, Y)
p03475
s590630935
Accepted
#084_C n = int(input()) csf = [list(map(int, input().split())) for _ in range(n-1)] def train(i, t): if i==n-1: return t c, s, f = csf[i] if t < s: return train(i+1, s+c) else: return train(i+1, -(-t//f)*f+c) for i in range(n): print(train(i, 0))
p03803
s877071016
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 list(sys.stdin.readline().rstrip().split()) a, b = M() if a == 1: a += 13 if b == 1: b += 13 if a == b: print('Draw') elif a < b: print('Bob') else: print('Alice')
p03037
s200998623
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def main(): N, M = map(int, input().split()) L, R = 0, float('inf') for _ in range(M): l, r = map(int, input().split()) L = max(L, l) R = min(R, r) print(max(R - L + 1, 0)) if __name__ == "__main__": main()
p02681
s930558416
Accepted
import string def main(): s, t = input(), input() ans = 'Yes' if solve(s, t) else 'No' print(ans) def solve(s, t): if len(s) + 1 != len(t): return False for i, j in zip(s, t): if i != j: return False return True if __name__ == '__main__': main()
p03457
s262229052
Wrong Answer
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") break else: print("Yes")
p03817
s075963049
Wrong Answer
si = lambda: input().strip() ii = lambda: int(input()) mii = lambda: map(int, input().split()) lmii = lambda: list(map(int, input().split())) lmsi = lambda: list(map(str, input().split())) smii = lambda: sorted(map(int, input().split())) # ---------- x = ii() d, m = divmod(x, 11) ans = 2 * d if m > 0: ans += 1 if m > 5: ans += 1 print(ans)
p02708
s826573434
Wrong Answer
N,K = map(int, input().split()) ans = 0 for k in range(K,N+2): ans = ans + ((k*(2*N-k+1))//2-(k*(k-1))//2+1) print(ans)
p02645
s745819036
Accepted
import re s=input() def isBoin(f): if f == "a" or f == "i" or f == "u" or f == "e" or f == "o": return True else: return False n = s[0] f = s[1] if isBoin(n) == True: n += s[1] n += s[2] else: n += s[1] n += s[2] print(n)
p02897
s380282470
Accepted
n = int(input()) print((n-n//2) / n)
p02613
s212338633
Accepted
N = int(input()) strng = [input() for i in range(N)] counts = [0]*4 for i in range(N): if strng[i] == 'AC': counts[0] += 1 elif strng[i] == 'WA': counts[1] += 1 elif strng[i] == 'TLE': counts[2] += 1 elif strng[i] == 'RE': counts[3] += 1 print('AC x ' + str(counts[0])) print('WA x ' + str(counts[1])) print('TLE x ' + str(counts[2])) print('RE x ' + str(counts[3]))
p02621
s831701481
Accepted
a = int(input()) print(a + a**2 + a**3)
p03486
s225571551
Wrong Answer
n = input() #print(n) n = ''.join(sorted(n)) m = input() #print(m) m = ''.join(sorted(m)) #print(n) #print(m) if n < m: print("Yes") else: print("No")
p02916
s169323390
Accepted
N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) C=list(map(int,input().split())) ans=B[A[0]-1] mae=A[0] for i in range(1,N): ans+=B[A[i]-1] if A[i]-mae==1: ans+=C[mae-1] mae=A[i] print(ans)
p03665
s716145672
Accepted
n,p = map(int,input().split()) a = list(map(int, input().split())) if all(x%2 == 0 for x in a): if p == 0: ans = 2**n else: ans = 0 else: ans = 2**(n-1) print (ans)
p02630
s983098149
Accepted
from collections import Counter n=int(input()) x = list(map(int,input().split())) c = Counter(x) y=[0]*(10**5+1) for i in c.keys(): y[i]=c[i] ad=0 su=sum(x) q=int(input()) for i in range(q): b , c = map(int, input().split()) su=su-y[b]*b+y[b]*c y[c]+=y[b] y[b]=0 print(su)
p02796
s033996796
Wrong Answer
n = int(input()) d = [] left = [] right = [] for i in range(n): x,l = map(int, input().split()) # num , left , right d.append([x-l+1,x+l-1]) d.sort(key=lambda x:x[0],reverse=False) p = d[0][1] ans = n for i in range(1,n): if d[i][0] <= p: ans -= 1 p = d[i][1] else: p = min(p,d[i][1]) print(ans)
p03338
s298279957
Accepted
# ABC 098: B – Cut and Count n = int(input()) s = input() kinds = 0 for k in range(1, len(s) - 1): kinds = max(kinds, len(set(s[0:k]) & set(s[k:]))) print(kinds)
p03293
s166674752
Wrong Answer
S=input() s=list(S) T=input() t=list(T) for i in range(len(s)): s.insert(0,s[-1]) print(s) s.pop(-1) print(s) if s==t: print('Yes') exit() print('No')
p02660
s854188540
Accepted
from collections import Counter N = int(input()) pf={} for i in range(2,int(N**0.5)+1): while N%i==0: pf[i]=pf.get(i,0)+1 N//=i if N>1:pf[N]=1 value_ = Counter(list(pf.values())) result = 0 for k,v in value_.items(): if k == 1: result += v else: for i in range(k+1): if i * (i+1) / 2 > k: result += (i-1) * v break print(result)
p02641
s163080486
Accepted
import numpy as np def getNearestValue(Q, num): idx = np.abs(np.asarray(Q) - num).argmin() return Q[idx] XN = list(map(int,input().split())) X = XN[0] N = XN[1] if N == 0: print(X) else: P = list(map(int,input().split())) Q = list(range(-100,200,1)) for i in range(0,N): Q.remove(P[i]) print(getNearestValue(Q,X))
p02646
s738564655
Accepted
A,V = map(int, input().split()) B,W = map(int, input().split()) T = int(input()) if A == B: print('YES') exit() if W >= V: print('NO') exit() if (abs(A-B)+(V-W)-1)//(V-W) <= T: print('YES') else: print('NO')
p04033
s183651044
Accepted
a, b = map(int, input().split()) if a <= 0 <= b: print("Zero") elif b < 0: subs = b - a + 1 if subs % 2 == 1: print("Negative") else: print("Positive") else: print("Positive")
p03639
s975879037
Accepted
N = int(input()) a = list(map(int, input().split())) x = y = z = 0 for i in range(N): if a[i] % 4 == 0: x += 1 elif a[i] % 2 == 0: y += 1 else: z += 1 if x >= min(1, y) + z - 1: print('Yes') else: print('No')
p02639
s260592474
Wrong Answer
A=list(map(int,input().split())) for i in range(1): if A[i]==0: print(i)
p03481
s740512782
Accepted
X, Y = map(int,input().split()) x = X c = 0 while x <= Y: x <<= 1 c += 1 print(c)
p02767
s832583914
Accepted
N = int(input()) X = list(map(int, input().split())) a = 0 for i in range(N): a += X[i] a /= N a += 0.5 a = int(a) ans = 0 for j in range(N): ans += (X[j]-a)**2 print(ans)
p03095
s680503577
Wrong Answer
N = int(input()) S = input() alpha = [0]*123 mod = 10**9+7 for n in S: num = ord(n) alpha[num] += 1 ans = 1 for i in range(97,122): ans *= (alpha[i]+1)%mod ans -= 1 ans %= mod print(ans)
p03665
s891529864
Wrong Answer
n, p = map(int, input().split()) a = list(map(int, input().split())) odd = [i for i in a if i % 2 == 1] even = [i for i in a if i % 2 == 0] ecnt = pow(2, len(even)) ocnt = pow(2, len(odd)-1) print(0 if (len(odd) == 0 and p == 1) else ecnt * ocnt)
p03136
s972602677
Wrong Answer
N = int(input()) L = list(map(int,input().split())) if max(L) > (sum(L) - max(L)): print("Yes") else: print("No")
p02994
s088063382
Wrong Answer
N,L=map(int, input().split()) all=0 for i in range(N): all =all +L+(i+1)-1 dif=all for i in range(N): if abs(all-dif) <= abs(all-(L+(i+1)-1)): dif =L+(i+1)-1 print(all-dif)
p03565
s899872685
Accepted
s = input() t = input() resolved = False for i in (range(len(s) - len(t) + 1)): sliced = s[len(s)-len(t)-i:len(s)-i] matched = True for j in range(len(sliced)): if sliced[j] != t[j] and sliced[j] != '?': matched = False break if matched: resolved = True s = s[:len(s)-len(t)-i] + t + s[len(s)-i:] break if resolved: print(s.replace('?', 'a')) else: print('UNRESTORABLE')
p03041
s115051178
Accepted
N, K = map(int, input().split()) S = input() print(S[:K-1], end='') if K == N: print(S[K-1].lower()) else: print(S[K-1].lower(), end='') print(S[K:])
p02647
s960696797
Accepted
import sys sys.setrecursionlimit(300000) n,k=map(int,input().split()) a=list(map(int,input().split())) def dfs(index, lx): if index < 1: return lx b=[0]*n for i in range(n): l=max(0,i-lx[i]) g=min(n-1,i+lx[i]) b[l]+=1 if g+1<n: b[g+1]-=1 for i in range(1,n): b[i]+=b[i-1] return dfs(index-1,b) print(*dfs(min(k,44),a))
p02695
s708080997
Accepted
from itertools import combinations_with_replacement N,M,Q = (int(x) for x in input().split()) q = [] Max = 0 for i in range(Q): q.append(list(map(int, input().split()))) for x in combinations_with_replacement(range(1,M+1),N): temp = 0 for y in q: if x[y[1]-1] - x[y[0]-1] == y[2]: temp += y[3] Max = max(temp,Max) print(Max)
p03012
s988923720
Accepted
n = int(input()) w = list(map(int,input().split())) #print(w) x = [] big = 0 small = 0 for i in range(n): big = w[i:] small = w[:i] big1 = sum(big) small1 = sum(small) x.append(int(abs(big1-small1))) print(min(x)) #print(min(x))
p02547
s177766368
Accepted
import numpy as np n = int(input()) d = np.array([input().split() for i in range(n)]) for i in range(n - 2): if d[i, 0] == d[i, 1] and d[i + 1, 0] == d[i + 1, 1] and d[i + 2, 0] == d[i + 2, 1]: print("Yes") exit() print("No")
p03481
s444312874
Accepted
#import math X, Y = map(int, input().split()) cnt = 0 #ans = int(math.log2(Y) - math.log2(X)) #print(ans+1) while X <= Y: X *= 2 cnt += 1 print(cnt)
p02761
s622876511
Accepted
N,M = map(int,input().split()) A = [-1]*N ans = 0 for i in range(M): s,c = map(int,input().split()) if A[s-1]!=-1 and A[s-1]!=c:ans=-1 else: A[s-1]=c if N==1: print(max(A[0],0) if ans!=-1 else ans) exit() for i in range(N): if i==0 and A[i]==0:ans=-1 if A[i]==-1:A[i]=0 if i==0:A[i]=max(A[i],1) A[i] = str(A[i]) print(-1 if ans==-1 else "".join(A))
p02723
s581368709
Wrong Answer
s = input() t = 'coffee' if s[2] == t[2] and s[3] == t[3] and s[4] == t[4] and s[5] == t[5] : print('Yes') else : print('No')
p02705
s665465610
Accepted
import numpy as np r = int(input()) print(2 * np.pi * r)
p02835
s567968556
Wrong Answer
A = list(map(int, input().split())) if A[0] + A[1] + A[2] > 22: print("bust") else: print("win")
p03679
s155702747
Accepted
x,a,b=map(int,input().split()) if b<=a: print('delicious') elif a<b and b<=a+x: print('safe') elif x<b: print('dangerous')
p02602
s718438298
Accepted
N,K = map(int,input().split()) A = list(map(int,input().split())) for i in range(K-1,N-1): if A[i-(K-1)] < A[i+1]: print("Yes") else: print("No")
p02832
s748900392
Accepted
import sys import itertools # import numpy as np import time import math sys.setrecursionlimit(10 ** 7) from collections import defaultdict read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n = int(input()) A = map(int, input().split()) x = 1 for a in A: if a == x: x += 1 if x == 1: print(-1) else: print(n - x + 1)
p02761
s277332459
Accepted
N, M = map(int, input().split()) A = [0] * N B = [0] * N T = 1 ans = 0 for i in range(M): s_i , c_i = map(int, input().split()) if B[s_i - 1] == 0: A[s_i - 1] = c_i B[s_i - 1] = 1 else: if A[s_i - 1] != c_i: T = 0 if B[0] == 0 and N != 1: A[0] = 1 for i in range(N): y = A[N - i - 1] y = int(y) ans = ans + y * 10 ** i if T == 0: ans = -1 elif A[0] == 0 and N !=1 : ans = -1 print(ans)
p03030
s984464002
Wrong Answer
n = int(input()) l = [] for i in range(n): s, p = input().split() l.append([s, int(p), i + 1, 0]) l.sort() for i in range(n): s = l[i][0] max = 0 x = 0 for j in range(n): if l[j][0] == s and max < l[j][1] and l[j][3] == 0: max = l[j][1] x = j print(l[x][2]) l[x][3] = 1
p03730
s028904085
Accepted
a,b,c=map(int,input().split()) for i in range(a*b): if a*i%b == c: print('YES') break else: print('NO')
p03785
s428643591
Wrong Answer
def main(): n, c, k = list(map(int, input().split())) T = [int(input()) for _ in range(n)] T.sort() count = 0 ans = 1 t0 = T[0] for t in T: if t - t0 <= k: count += 1 if count > c or t - t0 > k: ans += 1 count = 0 t0 = t print(ans) if __name__ == '__main__': main()
p03001
s044963561
Accepted
W, H, x, y = map(int, input().split()) S = W*H/2 if W == 2*x and H == 2*y: print(S, 1) else: print(S, 0)
p02732
s622298508
Accepted
#!/usr/bin/env python from collections import Counter import sys input = sys.stdin.readline def main(): n = int(input().rstrip()) l = list(input().rstrip().split()) c = Counter(l) total = 0 for key in c: total += c[key] * (c[key] -1) // 2 for item in l: print(total - (c[item] -1)) if __name__ == '__main__': main()
p02753
s568651020
Accepted
S = input() if (S=="AAA")or(S=="BBB"): print("No") else: print("Yes")
p03327
s438443982
Accepted
N = int(input()) if N<=999: print("ABC") else: print("ABD")
p02719
s428391095
Accepted
n, k = map(int, input().split()) print(min(n%k, k-n%k))
p02987
s566244514
Accepted
s = input() s = sorted(s) if s[0]==s[1] and s[2]==s[3]: if s[0]!=s[2]: print("Yes") exit() print("No")
p02881
s260298169
Accepted
n=int(input()) ans=10000000000000000000000 for i in range(1,int(n**0.5)+1): if n%i==0: ans=min(ans,n//i+i) print(ans-2)
p03544
s177038848
Wrong Answer
def lucas(n) : # Base cases if (n == 0) : return 2 if (n == 1) : return 1 # recurrence relation return lucas(n - 1) + lucas(n - 2)
p02681
s558032005
Wrong Answer
S=input() T=input() T=T[:-1] c=0 for i in S: if i in T: c+=1 if c==len(S): print("Yes") else: print("NO")
p03221
s901194099
Wrong Answer
N,M=map(int, input().split()) PY = [list(map(int, input().split())) for i in range(int(M))] pref_city=[[] for i in range(N)] for r in PY: pref_city[r[0]-1].append(r[1]) pref_city_sorted=[] for cities in pref_city: pref_city_sorted.append(sorted(cities)) for r in PY: order=pref_city_sorted[r[0]-1].index(r[1])+1 print('{a:05}{b:05}'.format(a=r[0],b=order))
p02571
s647971052
Accepted
def main(): S = str(input()) T = str(input()) max = 0 for i in range(len(S)-len(T)+1): count = 0 for n in range(len(T)): if S[i+n] == T[n]: count += 1 if count > max: max = count print(len(T) - max) main()
p02621
s053607343
Accepted
a=int(input()) print(a+a**2+a**3)
p03605
s414021600
Accepted
print('YNeos'[('9' not in input())::2])
p02982
s978976274
Accepted
a = [i*i for i in range(400)] n,d = map(int,input().split()) x = [] for _ in range(n): x.append(list(map(int,input().split()))) ans = 0 for i in range(n-1): for j in range(i+1, n): s = 0 for k in range(d): s += (x[i][k]-x[j][k])**2 if s in a: ans += 1 print(ans)
p02706
s906735758
Accepted
N, M = input().split() A = input().split() sumStudyDay = 0 for i in A: sumStudyDay += int(i) leftDay = int(N)-sumStudyDay if leftDay<0: print(-1) else: print(leftDay)
p03043
s359925762
Accepted
import math N,K = (int(x) for x in input().split()) Win = list(max(math.ceil(math.log2(K/X)),0) for X in range(1,N+1)) Prob = sum(1/(N*pow(2,X)) for X in Win) print(Prob)
p03986
s353073754
Accepted
def main(): X = input() cnt_s = 0 cnt_removal = 0 for x in X: if x == 'T': if cnt_s > 0: cnt_s -= 1 cnt_removal += 1 else: cnt_s += 1 print(len(X) - 2 * cnt_removal) if __name__ == '__main__': main()
p02909
s875740420
Accepted
S = input() if S == "Sunny": print("Cloudy") if S == "Cloudy": print("Rainy") if S == "Rainy": print("Sunny")
p03030
s293340403
Accepted
n = input() li = [] m = {} x = set([]) for i in range(int(n)): s,p = [z for z in input().split()] x.add(s) m[str([s,int(p)])] = i li.append([s,int(p)]) new = sorted(li, reverse=True) for i in sorted(list(x)): for j in range(int(n)): if (new[j][0]==i): print(m[str(new[j])]+1)
p02772
s278704181
Accepted
N=int(input()) A=list(map(int, input().split())) flag = 1 for i in range(len(A)): if A[i] % 2 == 0: if A[i] % 3 != 0 and A[i] % 5 != 0: flag = 0 break print(['DENIED', 'APPROVED'][flag])
p02603
s854258815
Accepted
n=int(input()) gold=1000 kabu=0 lst=list(map(int,input().split())) for i in range(n-1): if lst[i]<lst[i+1]: tmp,gold=divmod(gold,lst[i]) kabu+=tmp if lst[i]>lst[i+1]: gold+=kabu*lst[i] kabu=0 gold+=kabu*lst[-1] print(gold)
p03997
s951316256
Wrong Answer
a = int(input()) b = int(input()) h = int(input()) print((a+b)*h/2)
p02699
s250758300
Wrong Answer
s,w=map(int,input().split()) print(("un"if w>=s//2 else "")+"safe")
p02714
s545330954
Wrong Answer
from math import gcd k = int(input()) ans = 0 for a in range(1, k+1): for b in range(1, k+1): for c in range(1, k+1): ans += gcd(gcd(a, b), c) print(ans)
p03814
s711108596
Accepted
def i(): return int(input()) def i2(): return map(int,input().split()) def s(): return str(input()) def l(): return list(input()) def intl(): return list(int(k) for k in input().split()) s = s() for i in range(len(s)): if s[i] == "A": m1 = i break for i in range(-1,-len(s)-1,-1): if s[i] == "Z": m2 = i break print(len(s) + m2 - m1 + 1)
p03339
s149443375
Accepted
n = int(input()) s = input() countw = 0 counte = 0 ans = [0]*n for i in range(1, n): if s[i-1] == "W": countw += 1 if i != n: ans[i] += countw if s[-i] == "E": counte += 1 ans[n-i-1] += counte print(min(ans))
p03075
s066073036
Accepted
import sys from itertools import combinations input = sys.stdin.readline def main(): a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) k = int(input()) ans = "Yay!" for p, q in combinations([a, b, c, d, e], 2): if abs(p - q) > k: ans = ":(" print(ans) if __name__ == "__main__": main()
p02784
s710017718
Accepted
H, N = map(int,input().split()) A = list(map(int, input().split())) if H<=sum(A): print("Yes") else: print("No")
p02833
s575407335
Accepted
def main(): n = int(input()) c = 0 if n % 2 == 1: print(0) return i = 10 x, _ = divmod(n, i) while x: c += x i *= 5 x, _ = divmod(n, i) print(c) if __name__ == '__main__': main()
p02835
s752251080
Wrong Answer
ans = 0 for i in input().split(): ans += int(i) print(ans)
p04029
s278850526
Accepted
N=int(input()) s=0 for i in range(1,N+1): s=s+i print(s)
p02661
s050187709
Accepted
N = int(input()) As = [] Bs = [] for _ in range(N): a, b = map(int, input().split()) As.append(a) Bs.append(b) As.sort() Bs.sort() if N % 2 == 0: leftA, leftB = As[N // 2 - 1], Bs[N // 2 - 1] rightA, rightB = As[N // 2], Bs[N // 2] minM = leftA + rightA maxM = leftB + rightB print(maxM-minM+1) else: midA, midB = As[N // 2], Bs[N // 2] print(midB-midA+1)
p03220
s606560700
Accepted
N = int(input()) T, A = map(int, input().split()) H = list(map(int, input().split())) H = [abs(T-h*0.006-A) for h in H] print(H.index(min(H))+1)
p03011
s457167595
Accepted
a = list(map(int, input().split())) a.sort() print(sum(a[:2]))
p02713
s519617617
Wrong Answer
import math K = int(input()) sum = 0 for i in range(K): for j in range(K): for k in range(K): sum += math.gcd(math.gcd(i, j), k) print(sum)
p02572
s294891276
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = sum(a)**2 for i in range(n): ans -= a[i]**2 ans %= 10**9 + 7 print(ans//2)
p03494
s738818517
Accepted
n = int(input()) a = list(map(int, input().split())) ans = 0 jud = True while jud: for i in range(n): if a[i]%2==0: a[i]=a[i]//2 else: jud = False break if jud: ans+=1 else: break print(ans)
p02768
s079312630
Accepted
def main(): n, a, b = map(int, input().split()) mod = 10**9+7 nn = n ans1 = 1 while a > 0: ans1 = (ans1 * n * pow(a, mod-2, mod)) % mod n -= 1 a -= 1 ans2 = 1 n = nn while b > 0: ans2 = (ans2 * n * pow(b, mod-2, mod)) % mod n -= 1 b -= 1 print((pow(2, nn, mod)-ans1-ans2-1) % mod) main()
p03137
s301987553
Wrong Answer
N, M = map(int, input().split()) x= list(map(int, input().split())) if N >= M: print(0) else: x.sort() y = [x[i+1]-x[i] for i in range(len(x)-1)] y.sort() s = sum(y[:-(N-1)]) print(s)
p03416
s875991418
Accepted
A, B = map(int, input().split()) N = 0 for i in range(A, B + 1): S = str(i) for j in range(2): if S[j] != S[4 - j]: break else: N += 1 print(N)
p03487
s502445112
Accepted
n = int(input()) l = list(map(int, input().split())) dic = {} count = 0 for i in range(n): dic.setdefault(l[i],0) dic[l[i]] += 1 for x,y in dic.items(): if x <= y: count += y - x else: count += y print(count)
p03408
s869684268
Wrong Answer
N=int(input()) plus=[input() for i in range(N)] M=int(input()) minus=[input() for i in range(M)] S=list(set(plus+minus)) ans=[] for i in S: point=0 point=plus.count(i)-minus.count(i) ans.append(point) print(max(ans))
p03486
s133871790
Accepted
s = input() t = input() print('Yes' if sorted(s)<(sorted(t,reverse=True)) else 'No')
p03827
s489176242
Accepted
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) N = int(input()) S = input().strip() ans = 0 x = 0 for v in S: if v == 'I': x += 1 else: x -= 1 ans = max(ans, x) print(ans)
p03086
s581704440
Accepted
gene = ["A","T","G","C"] S = list(input()) ans = 0 tmp = 0 for i in range(len(S)): if S[i] in gene: tmp += 1 ans = max(ans,tmp) else: tmp = 0 print(ans)
p02859
s799056005
Accepted
r = int(input()) print(pow(r, 2))
p03161
s451923812
Accepted
n,k,*h=map(int,open(0).read().split()) a=[0]*n for i in range(1,n): j=max(0,i-k) e=h[i] a[i]=min(A+abs(e-H) for A,H in zip(a[j:i],h[j:i])) print(a[-1])
p03289
s726213460
Wrong Answer
import bisect,collections,copy,heapq,itertools,math,operator,string def I(): return int(input()) def S(): return input() def LI(): return list(map(int,input().split())) def LS(): return list(input().split()) ################################################## S = S() condition1 = S[0]=='A' condition2 = S[2:-2].count('C')==1 S = S.replace('A','a',1) S = S.replace('C','c',1) condition3 = S.islower() print('AC' if condition1 and condition2 and condition3 else 'WA')
p03944
s369470005
Accepted
w,h,n=map(int,input().split()) minx=0 maxx=w miny=0 maxy=h for i in range(n): x,y,a=map(int,input().split()) if a==1: minx=max(minx,x) elif a==2: maxx=min(maxx,x) elif a==3: miny=max(miny,y) elif a==4: maxy=min(maxy,y) print(max((maxx-minx),0)*max(0,(maxy-miny)))