problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03293
s352756885
Wrong Answer
from collections import deque S = deque(input()) T = deque(input()) for _ in range(len(S)): if S == T: print('Yes') break else: print('No')
p02675
s927987826
Wrong Answer
a=input() if a[-1]==2 or a[-1]==4 or a[-1]==5 or a[-1]==7 or a[-1]==9: print('hon') if a[-1]==0 or a[-1]==1 or a[-1]==6 or a[-1]==8: print('pon') if a[-1]==3: print('bon')
p02888
s096780622
Wrong Answer
N = int(input()) L = list(map(int, input().split())) s = 0 nL = sorted(L) print(nL) for i in range(0, N-2): for j in range(i+1, N-1): s += sum(x<nL[i]+nL[j] for x in nL[j+1:]) print(s)
p02553
s510670743
Wrong Answer
l=list(map(int,input().split())) if l[1]<0 and l[3]<0: print(l[0]*l[2]) elif l[1]<0: print(l[1]*l[2]) elif l[3]<0: print(l[0]*l[3]) else: print(l[1]*l[3])
p03673
s302145504
Wrong Answer
import sys input = sys.stdin.readline from collections import deque def main(): n = int(input()) a = list(map(str, input().split())) b = deque([]) for i in range(1,n+1): if i%2 == 1: b.append(a[i-1]) else: b.appendleft(a[i-1]) if n%2 == 1: print(" ".join(sorted(b, reverse = True))) else: print(" ".join(b)) if __name__ == '__main__': main()
p03545
s534775690
Wrong Answer
s = input() opl = ['+', '-'] flag = [0,0,0] for i in range(0, 0b111+1): for j in range(3): #print(i) flag[j] = (i>>(j+1) & 1) ans = s[0] + opl[flag[0]] + s[1] + opl[flag[1]] + s[2] + opl[flag[2]] + s[3] if(eval(ans) == 7): print(ans + '=7') break else: continue break
p02665
s329035212
Accepted
N = int(input()) *A, = map(int, input().split()) Asum = [a for a in A] for i in range(N-1, -1, -1): Asum[i] += Asum[i+1] ans = 0 v = 1 # 子になれる頂点数 for i in range(N+1): if v < A[i]: ans = -1 break ans += v p = v-A[i] if i < N: v = min(Asum[i+1], 2*p) print(ans)
p02708
s320173218
Wrong Answer
N,K=list(map(int,input().split())) src=[n for n in range(N+1)] t=sum(src[-K+1:]) m=sum(src[:K-1])-1 ans=0 for n in range(N+2-K): t+=src[-K-n] m+=src[K+n-1] a=t-m ans+=a print(ans%(10**9+7))
p03774
s608607950
Accepted
N, M = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(N)] cd = [list(map(int, input().split())) for _ in range(M)] for i in range(N): tmp = [] for j in range(M): tmp.append(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])) print(tmp.index(min(tmp))+1)
p03633
s063376870
Accepted
from fractions import gcd def main(): n = int(input()) m = int(input()) for _ in range(n-1): t = int(input()) m = m*t//gcd(m,t) print(m) if __name__ == "__main__": main()
p03408
s379030902
Accepted
#!/usr/bin/env python3 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n = int(input()) a = [input() for _ in range(n)] m = int(input()) b = [input() for _ in range(m)] c = list(set(a)) ans = 0 for i in c: if a.count(i) > b.count(i): ans = max(ans,a.count(i) - b.count(i)) print(ans)
p04045
s119202129
Accepted
N,K=map(int,input().split()) *D,=input().split() ok=1 while ok: ans=list(str(N)) ok=0 for a in ans: if a in D: ok=1 N+=1 print(''.join(ans))
p02553
s783446282
Accepted
a, b, c, d = map(int, input().split()) A = a*c B = a*d C = b*c D = b*d print(max([A, B, C, D]))
p03073
s886319088
Accepted
def resolve(): ''' code here ''' S = input() ans1 = 0 res1 = 0 ans2 = 1 res2 = 0 for item in S: item = int(item) if ans1%2 != item: res1 += 1 if ans2%2 != item: res2 += 1 ans1 += 1 ans2 += 1 print(min(res2, res1)) if __name__ == "__main__": resolve()
p03556
s926920543
Accepted
import sys read = sys.stdin.read readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): N = int(readline()) ans = int(N ** 0.5) ** 2 print(ans) if __name__ == '__main__': main()
p03971
s584216910
Wrong Answer
import sys input = sys.stdin.readline n, a, b = map(int, input().split()) strings = input() lists = ['No'] * len(strings) remain = a + b b_remain = b for i in range(len(strings)): if strings[i] == 'a': if remain > 0: lists[i] = 'Yes' remain = remain - 1 elif strings[i] == 'b': if b_remain > 0: lists[i] = 'Yes' remain = remain - 1 b_remain = b_remain - 1 else: pass for i in lists: print(i)
p02813
s043892201
Accepted
import itertools def main(): N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) p = 0 q = 0 count = 0 for i in itertools.permutations([i+1 for i in range(N)]): if P == list(i): p = count + 1 if Q == list(i): q = count + 1 count += 1 print(abs(p-q)) return 0 if __name__ == '__main__': main()
p04033
s397002094
Accepted
a,b = map(int, input().split()) if a < 0: if b >= 0: print("Zero") else: if (a+b)%2: print("Positive") else: print("Negative") elif a == 0: print("Zero") else: print("Positive")
p03328
s936608951
Wrong Answer
a,b=map(int,input().split()) s=0 for i in range(b-a+1): s=s+i print(s-a)
p03017
s580692879
Wrong Answer
N, A, B, C, D = map(int, input().split()) S = input() if '##' in S: print('No') exit() if C > D: if '...' in S[B-2:D + 1]: print("Yes") else: print("No") else: print("Yes")
p03261
s238419128
Accepted
def main(): N = int(input()) words = list() rule = True for _ in range(N): word = input() if len(words) > 0: if words[-1][-1] != word[0]: rule = False if word not in words: words.append(word) else: rule = False if rule == True: print("Yes") else: print("No") main()
p02817
s833584454
Accepted
s,t = map(str,input().split()) print(t+s)
p02971
s254498970
Wrong Answer
n = int(input()) _list = [] for _ in range(n): _list.append(int(input())) _set = set(_list) sort_list = sorted(list(_set)) if len(sort_list) != 1: first = sort_list[-1] second = sort_list[-2] for i in range(n): if _list[i] != first: print(first) else: print(second) else: first = sort_list[0] for _ in range(n): print(first)
p02718
s688561075
Accepted
n, m = map(int,input().split()) A = list(map(int,input().split())) total = sum(A) th = total/(4*m) A = sorted(A,reverse=True) ans = 'Yes' for i in range(m): if A[i] >= th: continue else: ans = 'No' print(ans)
p03345
s157836724
Accepted
a, b, c, k = map(int,input().split()) print("Unfair" if abs(a-b) >= 1e18 else a-b if k % 2 == 0 else b-a)
p03795
s148893847
Accepted
N=int(input()) print(N*800-(N//15)*200)
p03427
s940187942
Accepted
N = input() f = int(N[0]) res = (len(N) - 1) * 9 + f - 1 s = 0 for i in N: s += int(i) print(max(res, s))
p02832
s763414964
Wrong Answer
n= int(input()) l=list(map(int, input().split())) i = 1 c= 0 for a in l: if a==1: i+=1 else: c+=1 print(c if c!=n else -1)
p02957
s742743893
Wrong Answer
a,b = map(int,input().split()) ans = (a+b)/2 if ans%1==0: print(ans) else: print('IMPOSSIBLE')
p03351
s755201521
Accepted
a,b,c,d = map(int,input().split()) if (abs(a-b) <= d and abs(b-c) <= d) or abs(a-c)<=d: print('Yes') else: print('No')
p02663
s169430962
Accepted
H,M,HH,MM,K=map(int,input().split()) hour = HH - H -1 minute=60+MM-M time = hour * 60 + minute - K print(time)
p03000
s097996483
Accepted
""" author : halo2halo date : 9, Jan, 2020 """ import sys # import numpy as np import itertools read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) N, X, *L = map(int, read().split()) Lcum = itertools.accumulate(L) answer = sum(i <= X for i in Lcum) print(answer + 1)
p03659
s973764271
Wrong Answer
N = int(input()) A = [int(T) for T in input().split()] L = [0]*(N+1) R = [sum(A)]*(N+1) for T in range(0,N): L[T+1] = L[T]+A[T] R[T+1] = R[T]-A[T] MIN = 10**9 for T in range(1,N): if abs(L[T]-R[T])<MIN: MIN = abs(L[T]-R[T]) print(MIN)
p02708
s071870862
Accepted
mod = 1e9+7 n, k = list(map(int, input().split())) count = 0 for i in range(k, n+2): count += i*(2*n-i+1)//2 - (i*(i-1)//2-1) print(int(count%mod))
p03693
s226018507
Accepted
print('NO' if int(''.join(input().split())) % 4 else 'YES')
p03696
s859545192
Accepted
input();s=t=input();l,r=p='()' exec("t=t.replace(p,'');"*50) c=t.count;print(l*c(r)+s+r*c(l))
p03803
s735556449
Accepted
A,B = map(int,input().split()) if A==1 : A = 14 if B == 1: B = 14 if A>B: print("Alice") elif A<B: print("Bob") else: print("Draw")
p02780
s000676719
Wrong Answer
N,K = map(int, input().split()) pi = list(map(int, input().split())) #期待値列 E=[(p+1)/2 for p in pi] F=[] cal=0 for i in range(N-K+1): F.append(cal) cal=0 for j in range(K): cal += E[i+j] print(float(max(F)))
p04029
s780714772
Wrong Answer
N=int(input()) print(N*(N+1)/2)
p03475
s503947542
Accepted
N = int(input()) CSF = [list(map(int, input().split())) for i in range(N-1)] ans = [] for i, (ci, si, fi) in enumerate(CSF): now = si + ci for j in range(i+1, N-1): cj, sj, fj = CSF[j] now = max((-(-now//fj))*fj, sj) + cj ans.append(now) ans.append(0) print(*ans, sep='\n')
p03611
s569206682
Accepted
N = int(input()) a = list(map(int,input().split())) ans = 0 x = dict() #O(N) for i in range(N): if a[i] in x: x[a[i]] += 1 else: x[a[i]] = 1 if (a[i]-1) in x: x[a[i]-1] += 1 else: x[a[i]-1] = 1 if (a[i]+1) in x: x[a[i]+1] += 1 else: x[a[i]+1] = 1 for idx in x: ans = max(ans,x[idx]) print(ans)
p03427
s095080209
Wrong Answer
N = input() l = list(map(int,N)) i = 0 #ans = l[0] - 1 + (len(l)-1)*9 #暫定の答え while True: if l[i] < 9 and i < len(l)-2: spot = l[i] - 1 break if i == len(l)-1: spot = l[i-1] -1 break else: i += 1 ans = spot + (len(l)-1)*9 print(ans)
p02790
s834696572
Accepted
a, b = map(int, input().split()) print(sorted([str(a)*b, str(b)*a])[0])
p03659
s450709102
Wrong Answer
N = int(input()) A = list(map(int, input().split())) import numpy s = numpy.cumsum(A) sA = s[-1] ar = numpy.abs(sA-s-s) print(min(ar))
p02911
s396001059
Accepted
""" author : halo2halo date : 4, Feb, 2020 """ import sys # import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K, Q, *A = map(int, read().split()) point =[K-Q]*(N+1) for i in A: point[i] += 1 print(*['Yes' if i > 0 else 'No' for i in point[1:]], sep='\n')
p02801
s622498740
Wrong Answer
from sys import stdin def main(): l = stdin.readline().strip() print(chr(ord(l)+1)) print(l + " is followed by " +chr(ord(l)+1)+".") main()
p02910
s193037676
Accepted
s = input() ''' odd = ['R', 'U', 'D'] even = ['L', 'U', 'D'] for i in range(len(s)): if (i+1) % 2 == 1: if s[i] not in odd: print('No') exit(0) else: if s[i] not in even: print('No') exit(0) print('Yes') ''' odd = s[::2] even = s[1::2] if 'L' in odd or 'R' in even: print('No') else: print('Yes')
p02706
s068816950
Accepted
N,M=map(int,input().split()) c=input().split() if sum(int(i) for i in c)>N: print(-1) else: print(N-sum(int(i) for i in c))
p03261
s722091536
Accepted
n = int(input()) w = list(input() for i in range(n)) back = w[0][-1] for i in range(n): for j in range(i+1,n): if w[i] == w[j]: print("No") exit() for i in range(1, n): pre = w[i][0] if pre != back: break back = w[i][-1] if i == n-1: print("Yes") exit() print("No")
p02847
s070133330
Accepted
S = input() day = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'] print(7 - day.index(S))
p03061
s546554669
Accepted
import fractions N = int(input()) A = list(map(int, input().split())) L, R = [0]*N, [0]*N for i in range(1, N): L[i] = fractions.gcd(L[i-1], A[i-1]) R[-i-1] = fractions.gcd(R[-i], A[-i]) ans = 0 for l, r in zip(L, R): ans = max(ans, fractions.gcd(l, r)) print(ans)
p04043
s423229715
Accepted
print('YNEOS'['7 7'in input()::2])
p03696
s243877208
Wrong Answer
N = int(input()) S = input() d = [] o = c = 0 for i in range(N): if S[i] == '(': o += 1 else: c += 1 d.append(o - c) x = min(d) print('(' * -x + S + ')' * (d[-1] - x))
p02935
s205290310
Accepted
n=int(input()) a=[int(i) for i in input().split()] a=sorted(a) while(len(a)>1): d=(a[0]+a[1])/2 a[0]=d a.pop(1) if(len(a)==1): break print(a[0])
p02677
s675501052
Accepted
import math l=list(map(int, input().split(' '))) a=l[0] b=l[1] h=l[2] m=l[3] hours = (h+m/60)/12 minutes = m/60 theta = 2*math.pi*(hours-minutes) ans = a**2+b**2-2*a*b*math.cos(theta) print(ans**0.5)
p02693
s718143963
Wrong Answer
# 整数の入力 K = int(input()) # スペース区切りの整数の入力 A, B = map(int, input().split()) #出力 #自力 if B/K-(A-1)/K >= 1: print("OK") else: print("NG")
p02708
s044952212
Wrong Answer
def main(): n, k = [int(i) for i in input().split()] #smallのバリエーション mod = int(10e9 + 7) res = 0 for i in range(k, n+2): min_s = int(i*(i-1)/2) max_s = int(n*(n+1)/2 - (n-i)*(n-i+1)/2 ) res += (max_s - min_s + 1) % mod print(int(res)) if __name__ == '__main__': main()
p02732
s456218287
Wrong Answer
import copy n=int(input()) a=list(map(int,input().split())) aset=list(set(a)) ans=0 alist=[ 0 for i in range(n)] for _ in a: alist[_ - 1] += 1 for j in aset: ans += (a.count(j)*a.count(j)-1) // 2 for u in a: print(ans - alist[u - 1])
p02784
s839051937
Accepted
h, n = list(map(int, input().split())) a = list(map(int, input().split())) if(sum(a) >= h): print('Yes') else: print('No')
p02899
s685019437
Wrong Answer
N=int(input()) A = list(map(int, input().split())) C=[] for i in range(0,N): C.append(A.index(i+1)+1) print(C)
p02900
s942991010
Accepted
A, B = (int(i) for i in input().split()) def euclid(a, b): while b: a, b = b, a%b return a def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n % i == 0: n /= i table.append(i) i += 1 if n > 1: table.append(n) return table try: print(len(list(set(prime_decomposition(euclid(A,B)))))+1) except: print(1)
p02760
s603331983
Wrong Answer
a = [list(map(int, input().split())) for _ in range(3)] n = int(input()) b = [int(input()) for _ in range(n)] bingo = 'No' for t in zip(*a): a.append(list(t)) a.append([a[i][i] for i in range(3)]) a.append([a[i][2-i]for i in range(3)]) for line in a: if all(item in b for item in a): bingo = 'Yes' print(bingo)
p02596
s216301291
Wrong Answer
K = int(input()) nana=7 kou=1 if K % 2 == 0: print(-1) else: for i in range(1,K): if nana % K == 0: break nana = (nana * 10 + 7) % K kou +=1 print(kou)
p03331
s132661529
Accepted
n = int(input()) def d_sum(x): return sum(int(y) for y in str(x)) ans = float('inf') for a in range(1, n): b = n - a dsum = d_sum(a) + d_sum(b) ans = min(ans, dsum) print(ans)
p02900
s892706351
Accepted
from fractions import gcd def pf(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) return a a, b = map(int, input().split()) print(len(set(pf(gcd(a, b)))) + 1)
p03665
s825512791
Wrong Answer
N,P = map(int,input().split()) A = list(map(int,input().split())) odd = 0 for v in A: if v % 2: odd += 1 even = N-odd ans = (2**even)*(2**(odd-1) if 0 < odd else 0 ) print(ans)
p04019
s828473703
Wrong Answer
# coding: utf-8 S = list(input()) if ('N' in S and 'S' in S) or ('N' not in S and 'S' not in S) and ('W' in S and 'E' in S) or ('W' not in S and 'E' not in S): print('Yes') else: print('No')
p02596
s776378005
Accepted
K = int(input()) cnt = 0 n = 7 while cnt <= K: cnt += 1 if n % K == 0: break n = (10 * n + 7) % K if cnt == K+1: print(-1) else: print(cnt)
p02972
s474736282
Accepted
from collections import deque N = int(input()) A = list(map(int, input().split())) check = [0] * N for i in reversed(range(1, N + 1)): x = i total = 0 while x <= N: total += check[x - 1] x += i if total % 2 != A[i - 1]: check[i - 1] = 1 M = sum(check) ans = deque() for index, value in enumerate(check): if value == 1: ans.append(index + 1) print(M) if M > 0: print(*ans)
p03075
s024196563
Accepted
a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) k = int(input()) if max(e-a,e-b,e-c,e-d) <= k: print('Yay!') else: print(':(')
p03665
s630284850
Wrong Answer
N,P = list(map(int, input().split())) a = list(map(int, input().split())) num_odd = sum([i%2== 1 for i in a]) num_even = N - num_odd ce = 2 ** num_even co = 0 if num_odd > 0: co = 2 ** (num_odd - 1) print(co * ce)
p02848
s002048156
Wrong Answer
import string alphabet = string.ascii_uppercase N = int(input()) chara = input() for ch in chara: index = alphabet.index(ch) pr = (index + N) % 26 print(pr,end = '')
p02973
s306592602
Accepted
# -*- coding: utf-8 -*- # E - Sequence Decomposing import sys from bisect import bisect_left from collections import deque read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) A = list(map(int,read().split())) INF = 10**31 q = deque([]) for a in A: idx = bisect_left(q, a) if idx == 0: q.appendleft(a) else: q[idx-1] = a print(len(q))
p02612
s356089807
Wrong Answer
n=int(input()) print(1000-n%1000)
p02859
s736824390
Accepted
r = int(input()) print(pow(r,2))
p02547
s351582822
Accepted
N = int(input()) ans = 0 for i in range(N): x, y = map(int, input().split()) if x == y: ans += 1 else: ans = 0 if ans == 3: break if ans == 3: print('Yes') else: print('No')
p02630
s462931290
Accepted
from collections import Counter n = int(input()) A = list(map(int, input().split())) ANS = sum(A) A = Counter(A) Q = int(input()) for i in range(Q): B, C = map(int, input().split()) print(ANS + (C - B) * A[B]) ANS += (C - B) * A[B] A[C] = A[C] + A[B] A[B] = 0
p03000
s782601083
Accepted
n, x = map(int, input().split()) l = list(map(int, input().split())) d = 0 cnt = 0 for i in range(n): if d <= x: cnt += 1 d += l[i] if d <= x: cnt += 1 print(cnt)
p02615
s433778613
Accepted
n = int(input()) A = sorted(map(int, input().split()), reverse=True) if n % 2 == 0: ans = A[0] + 2 * sum(A[1:n//2]) else: ans = A[0] + 2 * sum(A[1:n//2]) + A[n//2] print(ans)
p02811
s119004451
Wrong Answer
K, X = map(int, input().split()) if 500*K >= X: print('YES') else: print('NO')
p02747
s562071109
Accepted
S=input() length=int(len(S)) #print(length) if length<=1: print("No") elif length%2!=0 : print("No") else: for i in range(length//2): if S[2*i]=="h" and S[2*i+1]=="i": temp=0 else: print("No") temp=1 break if temp==0: print("Yes") else: nothing=0
p02613
s702592479
Wrong Answer
N=int(input()) list=[] for i in range(N): list.append(str(input())) a = list.count("AC") b = list.count("WA") c = list.count("TLE") d = list.count("RE") print("AC × "+ str(a)) print("WA × "+ str(b)) print("TLE × "+ str(c)) print("RE × "+ str(d))
p03799
s564388233
Wrong Answer
def main(): ans = 0 n,m = map(int, input().split()) if m >= n * 2: ans += n m -= n * 2 else: for i in range(n): if i * 2 > m: ans = i - 1 m = ans * 2 break ans += m // 4 print(ans) if __name__ == '__main__': main()
p02700
s398106044
Wrong Answer
a, b, c, d = map(int, input().split()) t1, t2 = c//b, a//d if t1 < t2: print('Yes') else: if t2 * d == a: print('No') else: if (t1 + 1) * b == c: print('Yes') else: print('No')
p03030
s838110192
Accepted
from collections import defaultdict N = int(input()) dic = defaultdict() for i in range(1, N+1): k, v = input().split() dic[i] = [k, int(v)] sorted_dic = sorted(dic.items(), key=lambda x:(x[1][0], -x[1][1])) for k, *v in sorted_dic: print(k)
p03644
s059651370
Accepted
N = int(input()) if N == 1: print(1) exit() count_dic = {} for i in range(N+1): i_tmp = i count = 0 while True: if i == 0: break elif i_tmp % 2 == 0: i_tmp = i_tmp / 2 count += 1 else: break count_dic[i] = count print(max(count_dic, key=count_dic.get))
p02601
s986781631
Accepted
A,B,C=map(int,input().split()) K=int(input()) F=0 for x in range(K+1): for y in range(K+1): for z in range(K+1): p=A*2**x q=B*2**y r=C*2**z if p<q<r and x+y+z<=K: F=1 if F: print("Yes") else: print("No")
p03331
s767219141
Accepted
n = int(input()) li = [] for i in range(1,n//2+1): a = sum(list(map(int, str(i)))) b = sum(list(map(int, str(n-i)))) li.append(a+b) print(min(li))
p03434
s582559306
Wrong Answer
from sys import stdin n = int(stdin.readline().rstrip()) a = [int(x) for x in stdin.readline().rstrip().split()] ans = 0 a.sort() for x in range(n): if x % 2 == 0: ans -= a[x] else: ans += a[x] print(ans)
p02708
s017962701
Accepted
n, k = map(int, input().split()) div = 10**9 + 7 ans = 0 for i in range(k, n+2): # 最小の和: 0 -> i-1 まで s_min = i * (i-1) // 2 # 最大の和: n-i+1 -> n まで s_max = (n+1) * n // 2 - (n-i+1) * (n-i) // 2 # とりうる個数 s_count = s_max - s_min + 1 # 答えに追加 ans = (ans + s_count) % div print(ans)
p04044
s920722445
Accepted
N,L=map(int,input().split()) S=["0"]*N for k in range(N): S[k]=input() S.sort() Answer="" for k in range(N): Answer+=S[k] print(Answer)
p03761
s670080011
Accepted
import collections n=int(input()) S=[] for i in range(n): s=list(str(input())) cc=collections.Counter(s) S.append(cc) alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] ans=[] for lets in alphabet: nin=10**10 for i in range(n): nin=min(nin,S[i][lets]) for j in range(nin): ans.append(lets) print("".join(ans))
p02546
s692003357
Accepted
# -*- coding: utf-8 -*- import sys sys.setrecursionlimit(10**9) INF=10**18 MOD=10**9+7 input=lambda: sys.stdin.readline().rstrip() YesNo=lambda b: bool([print('Yes')] if b else print('No')) YESNO=lambda b: bool([print('YES')] if b else print('NO')) int1=lambda x:int(x)-1 s=input() if s[-1]=='s': print(s+'es') else: print(s+'s')
p02948
s689881237
Accepted
import heapq n, m = map(int, input().split()) AB = [list(map(int, input().split())) for _ in range(n)] AB.sort() queue = [] day, i, ans = 0, 0, 0 while day <= m: while i < n and AB[i][0] <= day: heapq.heappush(queue, -AB[i][1]) i += 1 if len(queue): ans += -heapq.heappop(queue) day += 1 print(ans)
p02578
s757177519
Accepted
n=int(input()) row=list(map(int,input().split())) s=0 for i in range(1,n): if row[i-1]>row[i]: s+=row[i-1]-row[i] row[i]=row[i-1] print(s)
p03293
s566574634
Wrong Answer
S=input() T=input() if set(S)==set(T): print("Yes") else: print("No")
p03645
s207988984
Wrong Answer
N, M = map(int, input().split()) L = [] for i in range(M): a, b = map(int, input().split()) L.append([a, b]) ans = 'IMPOSIBLE' for l in L: if l[0] == 1: if [l[1], N] in L: ans = 'POSSIBLE' break print(ans)
p03387
s119771847
Wrong Answer
z=input().split() a=int(z[0]) b=int(z[1]) c=int(z[2]) goukei=a+b+c count=0 while 1: count += 1 goukei = goukei + 2 # print(str(count)+':'+str(goukei)) if goukei>=max([a,b,c])*3 and goukei%3 == 0: print(count) break
p03494
s411431550
Accepted
def resolve(): N = int(input()) A = list(map(int, input().split(" "))) cnt = 0 while True: for i in range(N): if A[i] % 2 != 0: print(cnt) return for i in range(N): A[i] = A[i] // 2 cnt += 1 if '__main__' == __name__: resolve()
p02639
s804627396
Accepted
line = list(map(int, input().split())) for i in range(5): if line[i] == 0: print(i+1)