problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03778
s739300049
Wrong Answer
w, a, b = map(int, input().split()) if a < b < a + w: print(0) elif a < b + w < a + w: print(0) elif b < a < b + w: print(0) elif b < a + w < b + w: print(0) elif a + w < b: print(b - (a + w)) elif b + w < a: print(a - (b + w))
p03210
s246217252
Wrong Answer
n=int(input()) if n==7 or n==5 or n==3: print('Yes') else: print('No')
p02952
s759758501
Accepted
n=int(input()) cnt=0 for i in range(1, n+1): l=len(str(i)) if l%2==1: cnt+=1 print(cnt)
p03339
s550226114
Accepted
N = int(input()) S = input() # 西端の人がリーダーの場合 temp = 0 for j in range(1, N): temp += (S[j] == 'E') ans = temp for i in range(1, N): # 西からi番目の人がリーダーの場合 temp -= (S[i] == 'E') temp += (S[i - 1] == 'W') ans = min(ans, temp) print(ans)
p02963
s600653934
Accepted
import sys input=sys.stdin.readline s=int(input()) #0<= x,y <=10**9 #s/2 if s<=10**9: print(0,0,1,0,0,s) exit() y=(-1*s//(10**9))*(-1) x=10**9*y-s print(0,0,10**9,1,x,y)
p02820
s887681857
Accepted
N, K = map(int, input().split()) R, S, P = map(int, input().split()) T = input() d = {'r': P, 's': R, 'p': S} result = 0 wins = [False] * K for i in range(len(T)): if not wins[i % K] or T[i] != T[i - K]: result += d[T[i]] wins[i % K] = True else: wins[i % K] = False print(result)
p03359
s697651682
Wrong Answer
a, b = map(int, input().split()) if max(a,b) <= 12: print(min(a,b)) else: print(a)
p03962
s650645285
Accepted
l = list(map(int, input().split())) print(len(set(l)))
p04011
s673825484
Accepted
N = int(input()) K = int(input()) X = int(input()) Y = int(input()) if N<=K: ans = int(X*N) else: ans = int(X*K + Y*(N-K)) print(int(ans))
p03817
s005706625
Accepted
# -*- coding: utf-8 -*- # input a = int(input()) if a % 11 == 0: print(int((a//11)*2)) elif a % 11 <= 6: print(int((a//11)*2+1)) elif a % 11 > 6: print(int((a//11)*2+2))
p03852
s141085104
Accepted
c = input() boin = ["a","e","i","o","u"] print("vowel" if c in boin else "consonant")
p03001
s964222180
Accepted
m = list(map(int,input().split(" "))) W = m[0] H = m[1] x = m[2] y = m[3] xyplus = x + y #重心に来る時は複数、線上と内部は1こ # if w % 2 == 0 and h % 2 == 0: ans_area = W * H / 2 if x == W / 2 and y == H / 2: ans_sp = 1 else: ans_sp = 0 print(str(ans_area) + " " + str(ans_sp))
p02820
s385873780
Wrong Answer
n,k = map(int,input().split()) r,s,p = map(int,input().split()) t = input() hand = {'r':p, 's':r, 'p':s} win = {'r':'p', 's':'r', 'p':'s'} ans = 0 u = [] for i,tt in enumerate(t): if i >= k and u[i-k] == win[tt]: u.append(tt) else: u.append(win[tt]) ans += hand[tt] print(ans)
p02596
s069872717
Accepted
K=int(input()) if K%2==0 or K%5==0: print('-1') exit() a=0 i=1 while True: a=(a*10+7)%K if a==0: print(i) break i+=1
p02946
s968923937
Accepted
# # Written by NoKnowledgeGG @YlePhan # ('ω') # #import math #mod = 10**9+7 #import itertools #import fractions #import numpy as np #mod = 10**4 + 7 """def kiri(n,m): r_ = n / m if (r_ - (n // m)) > 0: return (n//m) + 1 else: return (n//m)""" def main(): k,x = map(int,input().split()) P = [] for i in range(x-k+1,x+k): P.append(i) print(*P) if __name__ == '__main__': main()
p03262
s106692157
Wrong Answer
import sys N,X = map(int,input().split()) L = [el for el in map(int,input().split())] L.append(X) L.sort() q = 0 if N == 1: print(L[0]-X) sys.exit(0) for p in range(L[0]+1,0,-1): q = 0 for j in range(0,len(L)): if L[j] % p != L[0] % p: q = 1 break if q == 0: print(p) break
p02761
s676399523
Accepted
import sys n,m=map(int,input().split()) tmp=[-1]*n for _ in range(m): s,c=map(int,input().split()) s-=1 if tmp[s]<0: tmp[s]=c if tmp[s]!=c: print(-1) sys.exit() if tmp[0]==0 and n>1: print(-1) sys.exit() if tmp[0]<0 and n>1: tmp[0]=1 if n==1 and tmp[0]==-1: tmp[0]=0 for i in range(1,n): if tmp[i]<0: tmp[i]=0 for i in tmp: print(i,end='')
p02801
s389542833
Wrong Answer
C = input() dic = {'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14,'o':15,'p':16,'q':17,'r':18,'s':19,'t':20,'u':21,'v':22,'w':23,'x':24,'y':25,'z':26} keys = list(dic.keys()) for i in range(26): if keys[i]==C: print(keys[i+1]) break
p04020
s488877592
Wrong Answer
N = int(input()) A = [int(input()) for _ in range(N)] ans = 0 for i in range(N): ans += A[i] // 2 A[i] %= 2 if N == 1 and i < N-1 and A[i+1] > 0: A[i+1] -= 1 ans += 1 print(ans)
p03699
s697287886
Accepted
N = int(input()) s = [int(input()) for i in range(N)] if all(i%10 == 0 for i in s): print(0) exit() elif sum(s)%10 != 0: print(sum(s)) exit() test = [] s = sorted(s) for i in s: test.append(i) for i in range(N): test[i] = 0 if sum(test)%10 != 0: print(sum(test)) exit() else: test[i] = s[i]
p03286
s685332702
Accepted
from collections import deque N = int(input()) tmp = N ans = deque() while tmp != 0: r = tmp % 2 ans.appendleft(r) tmp = (tmp-r)//(-2) print(0 if N == 0 else "".join([str(a) for a in ans]))
p02646
s292608267
Accepted
import sys sys.setrecursionlimit(700000) def s_in(): return input() def n_in(): return int(input()) def l_in(): return list(map(int, input().split())) a,v=l_in() b,w=l_in() t=n_in() if b > a: if b + w*t <= a + v*t: print("YES") else: print("NO") elif a > b: if b - w*t >= a - v*t: print("YES") else: print("NO") else: print("NO")
p03486
s276778862
Accepted
s = list(input()) t = list(input()) ss = "".join(sorted(s)) tt = "".join(sorted(t, reverse=True)) flag = False if ss < tt: print("Yes") else: print("No")
p02727
s025358254
Wrong Answer
X, Y, a, b, c = list(map(int,input().split())) p = list(map(int,input().split())) q = list(map(int,input().split())) r = list(map(int,input().split())) s = sorted(p)[::-1][:X] + sorted(q)[::-1][:X] + r ans = sum(s[:X + Y]) print(ans)
p02760
s667410599
Accepted
A1 = list(map(int, input().split())) A2 = list(map(int, input().split())) A3 = list(map(int, input().split())) A = A1 + A2 + A3 N = int(input()) s = set() # index of A for _ in range(N): b = int(input()) if b in A: s |= {A.index(b)} # bingo index bingo = [{0, 1, 2}, {0, 3, 6}, {0, 4, 8}, {1, 4, 7}, {2, 4, 6}, {2, 5, 8}, {3, 4, 5}, {6, 7, 8}] print(['No','Yes'][any(b <= s for b in bingo)])
p02708
s955431750
Wrong Answer
N,K=map(int,input().split()) print(K*(2*N+1-2*K)/2)
p02766
s072372332
Accepted
import math n, k = list(map(int, input().split())) if n == 1: print(1) else: print(math.ceil(math.log(n, k)))
p03105
s378067733
Accepted
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) A, B, C = lr() time = B // A answer = min(C, time) print(answer)
p03639
s477132499
Accepted
def howmanytwo(m): ret=0 while m%2==0: ret+=1 m=m//2 return ret N=int(input()) A=[int(i) for i in input().split()] evn=[howmanytwo(a) for a in A] od=evn.count(0) evev=0 for x in evn: if x>=2: evev+=1 if od+evev!=N: evev+=1 else: evev+=2 print('Yes' if od+1<=evev else 'No')
p03986
s041687441
Wrong Answer
X = input() s = 0 t = 0 for i in range(len(X)): if X[i] == 'S': t = i break for i in range(len(X)): j = len(X) - i - 1 if X[len(X)-i-1] == 'T': s = j break ans = len(X) - min(X[:s].count('S'), X[t:].count('T')) * 2 print(ans)
p02982
s954713813
Accepted
#============================================================================= # ABC133 B #============================================================================= import itertools import math N,D=map(int,input().split()) id=[i for i in range(N)] point=[list(map(int,input().split())) for _ in range(N)] comb=itertools.combinations(id,2) cnt=0 for p,q in comb: Squ=0 for k in range(D): Squ+=(point[p][k]-point[q][k])**2 if math.ceil(Squ**0.5)==Squ**0.5: cnt+=1 print(cnt)
p03679
s266693248
Wrong Answer
x,a,b=map(int,input().split()) if b-a<0: print('delicious') elif b-a>0: if b-a<x: print('safe') else: print('dangerous')
p02910
s409851496
Wrong Answer
S = input() if S.count("R") == 0 and S.count("L") == 0: print("Yes") elif S.count("R") > 0 and S.count("L") > 0: if S.index("R") % 2 == 0 and S.index("L") % 2 == 1: print("Yes") else: print("No") elif S.count("R") > 0: if S.index("R") % 2 == 0: print("Yes") else: print("No") else: if S.index("L") % 2 == 1: print("Yes") else: print("No")
p02947
s737335966
Accepted
from collections import defaultdict a = int(input()) d=defaultdict(int) # d={} for _ in range(a): b = input() c = "".join(sorted(b)) d[c] +=1 # if d.get(c) == None: d[c] = 0 # else: d[c] +=1 sum=0 for v in d.values(): sum+= (v*(v-1))//2 print(sum)
p02696
s840554437
Accepted
from math import floor A, B, N = list(map(int, input().split())) # print(A, B, N) x = None if N < B: x = N else: x = B x = B - 1 # max_diff = 0 # for _x in range(B, N + 1): # diff = (x / B) - floor(x / B) # if max_diff <= diff: # max_diff = diff # x = _x answer = floor(A * x / B) - A * floor(x / B) print(answer)
p02778
s655503936
Accepted
S = input().strip() print("x"*len(S))
p02657
s321439815
Accepted
A,B = map(int,input().split()) print(A*B)
p02947
s451700624
Accepted
N = int(input()) l = {} for i in range(N): s = input() s = ''.join(sorted(s)) if s in l: l[s] += 1 else: l[s] = 0 ans = 0 value_l = [1] for value in l.values(): if value == 0: continue if len(value_l) >= value: tmp = value_l[value - 1] else: l_val = len(value_l) for i in range(l_val, value): value_l.append(value_l[i-1] + i + 1) tmp = value_l[value - 1] ans += tmp print(ans)
p03472
s873352716
Accepted
import sys input = sys.stdin.readline N,H = map(int,input().split()) A = [0]*N B = [0]*N for i in range(N): A[i], B[i] = map(int,input().split()) B.sort() ma = max(A) from bisect import bisect_left, bisect_right r = bisect_right(B, ma) # 5が入るべき境目のうち最も右側の境目を返す C = B[r:] ans = 0 for i in range(len(C)-1,-1,-1): H -= C[i] ans +=1 if H<= 0: break if H>0: ans += H//ma if H%ma!=0: ans+=1 print(ans)
p02755
s643581589
Accepted
A, B = map(int, input().split(' ')) for i in range(1, 1010): if i * 8 // 100 == A and i * 10 // 100 == B: print(i) break else: print(-1)
p02761
s240289038
Accepted
ranges = [range(10), range(10, 100), range(100, 1000)] N, M = map(int, input().split()) s = [0 for i in range(M)] c = [0 for i in range(M)] for i in range(M): s[i], c[i] = map(int, input().split()) ans = 0 found = False for candidate in ranges[N - 1]: valid = True for i in range(M): if not (str(candidate)[s[i] - 1] == str(c[i])): valid = False break if valid: print(candidate) found = True break if not found: print(-1)
p04045
s864121596
Accepted
''' Created on 2020/08/25 @author: harurun ''' def main(): import sys pin=sys.stdin.readline pout=sys.stdout.write perr=sys.stderr.write N,K=map(int,pin().split()) D=list(map(int,pin().split())) # l=[0,1,2,3,4,5,6,7,8,9] # for i in D: # l.remove(i) j=N while True: for k in str(j): if int(k) in D: break else: print(j) break j+=1 return main()
p03479
s928271995
Accepted
def main(): x, y = map(int, input().split()) ans = 0 while x <= y: x *= 2 ans += 1 print(ans) if __name__ == "__main__": main()
p02720
s398717116
Wrong Answer
import queue num=int(input()) q=queue.Queue() for i in range(1,10): q.put(i) for j in range(num): ans=q.get() if ans%10!=0: q.put(10*ans+(ans%10)-1) q.put(10*ans+(ans%10)) if ans%10!=0: q.put(10*ans+(ans%10)+1) print(ans)
p02790
s501669863
Wrong Answer
# coding:utf-8 ab=0 ba=0 a,b=map(int,input().split()) ab=str(str(a)*b) ba=str(str(b)*a) l=[ab,ba] sorted(l) print(l[1])
p02791
s619351264
Wrong Answer
N = int(input()) p = list(map(int, input().split())) ans = 1 if N == 1: exit() for i in range(1,N-1): if p[i]>p[i+1]: ans +=1 print(ans)
p02754
s718334393
Accepted
N,A,B=[int(a) for a in input().split()] div,mod=divmod(N,A+B) ans=div*A + min(A,mod) print(ans)
p03387
s184979637
Accepted
A = list(map(int,input().split())) A = sorted(A) cnt = 0 if A[1]-A[0]>=2: cnt += (A[1]-A[0])//2 A[0]+= cnt*2 if A[0]==A[1] and A[1]==A[2]: print(cnt) exit() while(True): cnt+=1 A = sorted(A) A[0]+=1 A[1]+=1 #print(A) if A[0]==A[1] and A[1]==A[2]: break print(cnt)
p03281
s805796538
Accepted
def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) # divisors.sort() return divisors In = int(input()) count = 0 for i in range(1,In+1,2): if len(make_divisors(i))==8: count+=1 print(count)
p02596
s150931839
Accepted
import sys k = int(input()) a = [0]*k a[0] = 7 % k for i in range(1, k): a[i] = (10*a[i-1]+7) % k for i in range(k): if a[i] == 0: print(i+1) sys.exit() print(-1)
p03555
s468755595
Wrong Answer
import numpy as np up_ = np.array(list(reversed(input()))) lo = np.array(list(input())) if (up_ == lo).all(): print('Yes') else: print('No')
p02861
s002862296
Wrong Answer
import itertools, math n = int(input()) point = [tuple(map(int, input().split())) for i in range(n)] numbers = 1 for i in range(1,n+1): numbers *= i print(numbers) #nの階乗 route = list(itertools.permutations(point)) d = 0 for pattern in route: for i in range(n-1): d += math.sqrt((pattern[i][0]-pattern[i+1][0])**2 + (pattern[i][1]-pattern[i+1][1])**2) ans = d / numbers print(ans)
p03997
s870831938
Accepted
a = [int(input()) for i in range(3)] ans = ((a[0]+a[1]) * a[2]) / 2 print(str(int(ans)))
p02866
s124339862
Accepted
from collections import Counter N = int(input()) D = list(map(int, input().split())) MOD = 998244353 c = Counter(D) tmp = 1 ans = 1 zero_flg = False for dist in range(N): if dist == 0 and (c[0] != 1 or D[0] != 0): print(0) exit() elif c[dist] == 0: zero_flg = True elif c[dist] > 0 and zero_flg: print(0) exit() else: ans *= pow(tmp, c[dist], MOD) ans %= MOD tmp = c[dist] print(ans)
p02755
s755493666
Accepted
A, B = map(int, input().split()) for i in range(1, 10001): x=(i*8)//100 y=(i*10)//100 if x==A and y==B: print(i) break else: print(-1)
p03486
s267487192
Accepted
import sys import math import itertools import bisect from copy import copy from collections import deque,Counter from decimal import Decimal def s(): return input() def i(): return int(input()) def S(): return input().split() def I(): return map(int,input().split()) def X(): return list(input()) def L(): return list(input().split()) def l(): return list(map(int,input().split())) def lcm(a,b): return a*b//math.gcd(a,b) def gcd(*numbers): reduce(math.gcd, numbers) sys.setrecursionlimit(10 ** 9) mod = 10**9+7 count = 0 ans = 0 a = s() t = s() a = sorted(a) y = "".join(a) t = sorted(t,reverse = True) x = "".join(t) if y < x: print("Yes") else: print("No")
p02972
s183637324
Accepted
N=int(input()) A=list(map(int, input().split())) d = [0]*N for i in reversed(range(1,N+1)): n=1 t=0 while i*n<=N: t+=d[i*n-1] n+=1 d[i-1]=(t+A[i-1])%2 res = [i+1 for i,x in enumerate(d) if x] print(len(res)) print(*res)
p03434
s930567751
Wrong Answer
_, *a = map(int, open(0).read().split()) a.sort() print(sum(a[-1::2]) - sum(a[-2::2]))
p04019
s110786657
Wrong Answer
s=list(input()) a=0 b=0 if ("N" in s)&("S" in s): a=1 if ("W" in s)&("E" in s): b=1 if a&b: print("Yes") else: print("No")
p02552
s801027037
Accepted
x = int(input()) print("1" if x == 0 else "0")
p03146
s728853812
Accepted
def f(n): if n%2 == 0: return n//2 else: return 3*n+1 s = int(input()) A = [s] for i in range(2, 1000001): A.append(f(A[-1])) if len(A) != len(set(A)): print(i) exit(0)
p03408
s087122258
Accepted
from collections import Counter n = int(input()) s = [input() for _ in range(n)] s = list(Counter(s).items()) m = int(input()) t = [input() for _ in range(m)] t = Counter(t) result = 0 for i in range(len(s)): result = max(s[i][1]-t[s[i][0]], result) print(result)
p02783
s620070898
Wrong Answer
H, A = list(map(int, input().split())) print(H // A + 1)
p03986
s911750022
Wrong Answer
#!/usr/bin/env python3 import sys # input = sys.stdin.readline def INT(): return int(input()) def MAP(): return map(int,input().split()) def LI(): return list(map(int,input().split())) def main(): X = input() LENX = len(X) S = 0 for i in range(LENX//2): if X[i] == "S": S += 1 print(LENX-2*S) return if __name__ == '__main__': main()
p03075
s714815563
Accepted
a=int(input()) input() input() input() e=int(input()) k=int(input()) print("Yay!" if k>=e-a else ":(")
p02688
s461158908
Wrong Answer
n, k = map(int, input().split()) a = [] s = 0 for i in range(k): d = int(input()) array = list(map(int, input().strip().split())) a.append(array) for j in range(1, n): if k not in a: s += 1 print(s)
p02948
s412081267
Accepted
import sys input = sys.stdin.readline import heapq N,M = (int(x) for x in input().split()) jobs = [[] for i in range(M)] count = 0 h = [] for i in range(N): A,B = (int(x) for x in input().split()) if A <= M: jobs[A-1].append(B*(-1)) heapq.heapify(h) for i in range(M): if jobs[i]: for job in jobs[i]: heapq.heappush(h,job) if h: count -= heapq.heappop(h) print(count)
p03814
s474094491
Accepted
# coding: utf-8 s = input().rstrip() a_index = -1 b_index = -1 for i in range(len(s)): if s[i] == "A": if a_index < 0: a_index = i elif s[i] == "Z": b_index = i print(b_index-a_index+1)
p02627
s578995498
Accepted
a=input() if str.isupper(a)==True: print("A") else: print("a")
p03524
s078157800
Accepted
S = input() lst = [] lst.append(S.count("a")) lst.append(S.count("b")) lst.append(S.count("c")) lst.sort() if lst[0] + 1 >= lst[2]: print("YES") else: print("NO")
p03162
s506349826
Wrong Answer
N = int(input()) values_list = [] for i in range(N): values = list(map(int, input().split())) values_list.append(values) # DPテーブルは選択分拡張する dp = [[0,0,0] for i in range(N+1)] for i in range(N): for j in range(0, 3): for k in range(0, 3): if j == k: continue dp[i][k] = max(dp[i][k], dp[i-1][j] + values_list[i][k]) print(dp) print(max(dp[N-1]))
p03761
s189718304
Accepted
n = int(input()) l = [] for i in range(n): l.append(input()) l_sorted = sorted(set(l[0])) ans="" for k in l_sorted: cnt = min(l[i].count(k) for i in range(n)) ans += k*cnt print(ans)
p02577
s300671893
Accepted
n = int(input()) if n % 9 == 0: print("Yes") else: print("No")
p02842
s772126958
Accepted
n = int(input()) base = n // 1.08 cands = [base-1, base, base+1] flag = False for cand in cands: if cand * 1.08 >= n and n > cand * 1.08 - 1: print(int(cand)) flag = True break if not flag: print(':(')
p02548
s229004590
Accepted
n = int(input()) res = 0 for i in range(1, n): res += (n-1)//i print(res)
p02688
s206888784
Accepted
n,k = [int(x) for x in input().split(' ')] def solve(n, k): snukes = [None] * n victims = 0 for i in range(k): snacks = int(input()) snukes_snacks = [int(z) for z in input().split(' ')] for j in range(snacks): snukes[snukes_snacks[j] - 1] = snukes_snacks[j] for w in range(n): if snukes[w] is None: victims += 1 print(victims) solve(n, k)
p03456
s435820304
Wrong Answer
def resolve(): n = int(input().replace(" ", "")) squares = [i**2 for i in range(1, 101)] print("Yes" if n in squares else "No") if '__main__' == __name__: resolve()
p02708
s270308115
Wrong Answer
n,k=map(int,input().split()) def po(a,t,p): bi=str(format(t,"b")) res=1 for i in range(len(bi)): res=(res*res) %p if bi[i]=="1": res=(res*a) %p return res print(po(2,n+1,1000000007)-po(2,k-1,1000000007))
p03723
s832897909
Accepted
A, B, C = list(map(int, input().split())) cookies = set() cookies.add((A, B, C)) a = A b = B c = C count = 0 while a % 2 == 0 and b % 2 == 0 and c % 2 == 0: count += 1 a = a // 2 b = b // 2 c = c // 2 a2 = b + c b2 = a + c c2 = b + c if (a2, b2, c2) in cookies: count = -1 break a = a2 b = b2 c = c2 cookies.add((a, b, c)) print(count)
p03785
s428304118
Wrong Answer
n,c,k = map(int, input().split()) l=[int(input()) for x in range(n)] l.sort() flg=0 bus=0 capa=0 for i in range(n): if capa<c: if l[i]<=flg+k: capa+=1 else: bus+=1 flg=l[i] capa=0 elif capa==c: bus+=1 capa=0 print(bus+1)
p03360
s889248862
Accepted
a,b,c = map(int, input().split()) k = int(input()) print(a+b+c+max(a,b,c)*((2**k)-1))
p02571
s962956367
Wrong Answer
S=input() T=input() match=0 for i in range(len(S)-len(T)): count=0 for j in range(len(T)): if S[i+j]==T[j]: count=count+1 if match<count: match=count print(len(T)-match)
p02772
s217007992
Wrong Answer
N = int(input()) array = list(map(int, input().strip().split())) count = int(0) flag = int(0) for x in range(N): if array[x] % 2 == 0: count += 1 if array[x] % 3 == 0 or array[x] % 5 == 0: print('APPROVED') flag = 1 break if flag == 0: if count == N - 1: print('APPROVED') flag = 1 if flag == 0: print('DENIED')
p03627
s875861938
Accepted
N=int(input()) A=[int(i) for i in input().split()] A.sort() cnt={} K=list(set(A)) K.sort() for k in K: cnt[k]=0 for a in A: cnt[a]+=1 E=[] for k in K: if cnt[k]>=2: if cnt[k]>=4: E.append(k) E.append(k) E.sort() # print(E) if len(E)>=2: print(E[-1]*E[-2]) else: print(0)
p04044
s813882110
Accepted
n,l = map(int,input().split()) s = [] for i in range(n): s.append(input()) for i in sorted(s): print(i,end="")
p03038
s495882696
Accepted
from collections import Counter N, M = map(int, input().split()) A = list(map(int, input().split())) cnt = Counter(A) for _ in range(M): b, c = map(int, input().split()) cnt[c] += b ans = 0 for b, c in sorted(cnt.items(), reverse=True): ans += min(c, N) * b N -= min(c, N) if N == 0: break print(ans)
p02708
s481458077
Accepted
n,k=map(int,input().split()) count=0 for i in range(k,n+2): count+=i*(n-i+1)+1 print(count%(10**9+7))
p02791
s908059826
Accepted
#C n = int(input()) p = list(map(int, input().split())) n = p[0] ans = 1 for i, z in enumerate(p): if i == 0: continue if z <= n: ans += 1 n = min(n, z) print(ans)
p02760
s443729063
Wrong Answer
print('Yes')
p03623
s091775605
Accepted
x, a, b = map(int, input().split()) print('A' if abs(x-a) < abs(x-b) else 'B')
p03494
s566524924
Accepted
n=int(input()) a=list(map(int,input().split())) ans=0 while True: if[i for i in a if i%2==1]: break a=[i/2 for i in a] ans+=1 print(ans)
p02555
s230389086
Accepted
S = int(input()) mod = 10**9+7 ans = 0 x = [0]*(2020) x[3] = 1 x[4] = 1 x[5] = 1 for i in range(6, S+1): x[i] += 1 for j in range(3, i-2): x[i] += x[j] x[i] %= mod print(x[S])
p02639
s751136242
Accepted
#!/usr/bin/env python3 import sys def solve(x: "List[int]"): return x.index(0) + 1 # Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() x = [int(next(tokens)) for _ in range(5)] # type: "List[int]" print(solve(x)) def test(): import doctest doctest.testmod() if __name__ == '__main__': #test() main()
p03408
s462571858
Accepted
B = [input() for i in range(int(input()))] R = [input() for i in range(int(input()))] B_dict = {} for i in B: if i in B_dict: B_dict[i] += 1 else: B_dict[i] = 1 max = 0 for item in B_dict: b_value = B_dict[item] r_value = R.count(item) if b_value - r_value > max: max = b_value - r_value print(max)
p03556
s853121343
Wrong Answer
n=int(input()) a=1 for i in range(1,n): if i**2>n: break a==i**2 print(a)
p02682
s736208593
Wrong Answer
a, b, c, k = map(int, input().split()) print(a - max(0, (k - a - b)))
p02836
s043198724
Accepted
s = input() cnt = 0 for i in range(len(s)//2): if s[i] != s[-i -1]: cnt += 1 print(cnt)
p03827
s300868688
Accepted
N, S = input(), input() x, xmax = 0, 0 for s in S: x = (lambda a:x+1 if a=='I' else x-1)(s) xmax = max(x,xmax) print(xmax)
p02717
s492515959
Accepted
A,B,C = map(int, input().split()) print('{} {} {}'.format(C,A,B))
p03095
s220427108
Wrong Answer
from collections import Counter n = int(input()) s = str(input()) d = Counter(s) S = list(set(s)) l = len(S) ans = 0 for i in range(2**l): L = [0] * l for j in range(l): if ((i >> j) & 1): L[j] = 1 tmp = 0 for k in range(l): if L[k] != 0: if tmp == 0: tmp = 1 tmp *= d[S[k]] ans += tmp print(ans)