problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02727
s213794166
Accepted
(x, y, a, b, c), p, q, r = [map(int, o.split()) for o in open(0)] print(sum(sorted(sorted(p)[-x:] + sorted(q)[-y:] + list(r))[-x-y:]))
p03145
s138587242
Wrong Answer
import sys import copy import math import bisect import pprint import bisect from functools import reduce from copy import deepcopy from collections import deque if __name__ == '__main__': a = [int(i) for i in input().split()] print(a[0]*a[1]/2)
p03435
s784906352
Wrong Answer
import sys c= [list(map(int, input().split())) for i in range(3)] csum=[0]*3 for a1 in range(100): if (a1-(sum(c[0])-sum(c[1]))/3)>=0 and (a1-(sum(c[0])-sum(c[2]))/3)>=0: for b1 in range(100): for k in range(3): csum[k]=c[0][k]+c[1][k]+c[2][k] if (b1-(csum[0]-csum[1])/3)>=0 and (b1-(csum[0]-csum[2])/3)>=0: print('Yes') sys.exit(0) print('No')
p03803
s997197232
Accepted
A,B = [int(i) for i in input().split()] if A == 1: A = 14 if B == 1: B = 14 if A > B: print('Alice') elif A < B: print('Bob') elif A == B: print('Draw')
p03835
s166180506
Accepted
K, S = map(int, input().split()) c = 0 for x in range(K + 1): if x > S: break for y in range(K + 1): if x + y > S: break z = S - x - y if 0 <= z <= K: c += 1 print(c)
p02801
s357987187
Accepted
print(chr(ord(input()) + 1))
p02572
s516953721
Wrong Answer
# coding: utf-8 # Your code here! N = int(input()) A = list(map(int,input().split())) sum = 0 B = [] B.append(0) for t in range(N): B.append(A[t] + B[t]) B.remove(0) print(B) for i in range(N): sum += A[i] * (B[N-1] - B[i]) print(sum % (10**9+7))
p02613
s628514329
Accepted
c=open(0).read().count for s in'AC','WA','TLE','RE':print(s,'x',c(s))
p03474
s517300133
Accepted
print("YNeos"[tuple(map(int, input().split())) != tuple(map(len, input().split("-")))::2])
p04019
s951630410
Accepted
# -*- coding: utf-8 -*- s=set(list(input())) if ('N' in s)==('S' in s) and ('W' in s)==('E' in s): print("Yes") else: print("No")
p03352
s029362563
Accepted
from math import sqrt X = int(input()) c = 1 for b in range(1,int(sqrt(X)+1)): for p in range(2,X): if b**p<=X: c = max(c,b**p) print(c)
p02582
s439521251
Wrong Answer
S = input() count_r = 0 count_s = 0 tmp = 0 for i,s in enumerate(S): if(s == "R"): count_r +=1 if(s=="S"): count_s += 1 tmp = count_r print(tmp)
p02835
s846818181
Accepted
print("bust") if sum(list(map(int, input().split()))) >= 22 else print("win")
p02768
s258999534
Accepted
mod=10**9+7 l,a,b=map(int,input().split()) def C(n,k,m): g=k f=n for i in range(1,k): n=n*(f-i)%m k=k*(g-i)%m return (n*pow(k,m-2,m))%m ans=pow(2,l,mod)-1 ca=C(l,a,mod) cb=C(l,b,mod) print((ans-ca-cb)%mod)
p02897
s663991109
Accepted
N = int(input()) if N % 2 == 0: ans = (N//2) / N else: ans = ((N//2)+1) / N print(ans)
p03417
s928184555
Accepted
N,M=map(int,input().split()) l=[N,M] l.sort() buf=0 f=0 c=0 if l[0]==1: if l[1]==1: print("1") else: print(l[1]-2) else: #l[0]>1 print((l[0]-2)*(l[1]-2))
p03555
s639669172
Accepted
s1 = input() s2 = input() if s1 == s2[::-1]: print('YES') else: print('NO')
p04034
s995336108
Accepted
n, m = list(map(int, input().split())) cnt = [1] * n has_red = [False] * n has_red[0] = True for i in range(m): a, b = list(map(int, input().split())) has_red[b - 1] = has_red[b - 1] or has_red[a - 1] if cnt[a - 1] == 1: has_red[a - 1] = False cnt[a - 1] -= 1 cnt[b - 1] += 1 print(has_red.count(True))
p02780
s101452008
Accepted
import numpy as np n, k = map(int,input().split()) p = list(map(int,input().split())) e = [(i+1)/2 for i in p] e = np.cumsum(e) e = np.append(0,e) ans = 0 for i in range(n-k+1): ans = max(e[i+k]-e[i],ans) print(ans)
p02802
s037072385
Accepted
N,M=map(int,input().split()) ans=[0]*N pen=[0]*N AC=[0]*N for i in range(M): p,s=input().split() p=int(p) if s=="WA": pen[p-1]+=1 else: if AC[p-1]==0: ans[p-1]+=pen[p-1] AC[p-1]=1 print(AC.count(1),sum(ans))
p02629
s930674886
Accepted
n = int(input()) def num2alpha(n): if n <= 26: return chr(96+n) elif n % 26 == 0: return num2alpha(n//26-1)+chr(122) else: return num2alpha(n//26)+chr(96+n % 26) print(num2alpha(n))
p02847
s895625424
Wrong Answer
s = input() week = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"] for i in range(7): if s == "SUN": print(7) else: print(6 - i)
p03679
s588326278
Accepted
a,b,c=map(int,input().split()) if c<=b: print("delicious") elif c<=a+b: print("safe") else: print("dangerous")
p02819
s618459645
Accepted
import math n = int(input()) def prime_checker(n): dest = int(math.sqrt(n)) for i in range(2, dest): if n % i == 0: return False return True while True: if prime_checker(n): print(n) break n += 1
p03565
s327766109
Accepted
s = input() t = input() n = len(t) for i in reversed(range(len(s)-n+1)): #後ろから一致する部分が無いか見ていく x = s[i:i+n] y = 0 for j in range(n): if x[j] == "?" or x[j] == t[j]: continue else: y = 1 break if y == 0: print(s[:i].replace("?", "a") +t + s[i+n:].replace("?", "a")) exit() print("UNRESTORABLE")
p03605
s533459223
Accepted
n = int(input()) if n%10==9 or n//10==9: print('Yes') else: print('No')
p03760
s586682107
Accepted
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): O = readline().strip() E = readline().strip() ans = ''.join(O[i // 2] if i % 2 == 0 else E[i // 2] for i in range(len(O) + len(E))) print(ans) return if __name__ == '__main__': main()
p03680
s186094374
Accepted
import sys n = int(input()) a = [0] + [int(sys.stdin.readline()) for _ in range(n)] button = 1 for i in range(n): if button == 2: print(i) break button = a[button] else: print(-1)
p02861
s818836892
Accepted
n = int(input()) pos = [[int(w) for w in input().split()] for _ in range(n)] dist = [[0] * n for i in range(n)] for i in range(n): for j in range(i+1, n): d = ((pos[i][0]-pos[j][0])**2 + (pos[i][1]-pos[j][1])**2)**0.5 dist[i][j] = d ave = sum(map(sum, dist))/((n**2-n)//2) print(ave*(n-1))
p02577
s623990930
Accepted
n = str(input()) ans = 0 for s in n: ans += int(s) if ans % 9 == 0: print("Yes") else: print("No")
p02603
s109531153
Accepted
N = int(input()) A = list(map(int, input().split())) total = 1000 for i in range(1, N): if A[i] > A[i-1]: total += (total // A[i-1]) * (A[i]-A[i-1]) print(total)
p03069
s429722521
Accepted
def main(): N = int(input()) S = input() if len(set(S)) == 1: return print(0) w = S.count(".") b = 0 ans = w for s in S: if s == "#": b += 1 else: w -= 1 ans = min(ans, b+w) print(ans) if __name__ == '__main__': main()
p02630
s866510623
Wrong Answer
N = int(input()) A = list(map(int, input().split())) Q = int(input()) ans = 0 List = [0]*100000 for i in A: List[i-1] += 1 ans += i tmp = 0 for i in range(Q): B,C= map(int, input().split()) tmp = List[B-1] ans = ans + tmp*(C-B) print(ans) List[C-1] += tmp
p02753
s354788477
Wrong Answer
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): s = readline().strip() if s == "BBB": print("No") else: print("Yes") if __name__ == "__main__": main()
p02642
s716052211
Wrong Answer
N = int(input()) A = list(map(int,input().split())) A = A[::-1] a = A.copy() ans_list = list() A_len =len(A) while A_len != 0: for i in range(A_len-1): if A[i+1] % A[0]==0: a.remove(A[i+1]) ans_list.append(A[0]) a.remove(A[0]) A = a.copy() A_len = len(A) ans = len(ans_list) print(ans-1)
p02832
s365097500
Accepted
'''input 3 5 1 2 1 2 3 0 ''' # connected components from sys import stdin, setrecursionlimit from bisect import bisect_left import sys, threading # main start n = int(stdin.readline().strip()) arr = list(map(int, stdin.readline().split())) k = 0 for i in range(n): if arr[i] == k + 1: k += 1 if k == 0: print(-1) else: print(n - k)
p03000
s891818698
Accepted
from sys import stdin def main(): #入力 readline=stdin.readline N,X=map(int,readline().split()) L=list(map(int,readline().split())) S=[0]*(N+1) for i in range(1,N+1): S[i]+=S[i-1]+L[i-1] res=0 for i in range(N+1): if S[i]<=X: res+=1 else: break print(res) if __name__=="__main__": main()
p02699
s195345661
Accepted
S,W = map(int,input().split()) if S <= W: print('unsafe') else: print('safe')
p02771
s028727680
Wrong Answer
a = list(map(int,input().split())) i = 0 if(a[i] == a[i+1] and a[i] == a[i+2]): print("No") else: print("Yes")
p03624
s691294594
Wrong Answer
s = list(input()) s.sort() alp = list('abcdefghijklmnopqrstuvwxyz') for s_,alp_ in zip(s,alp): if s_ != alp_ : print(alp_) exit() print('None')
p02555
s871657699
Accepted
S = int(input()) x = [1, 0, 0] for i in range(3, S+1): x.append(x[i-1] + x[i-3]) print(x[S]%1000000007)
p02880
s827353474
Accepted
N = int(input()) ans = '' if N > 81 or N < 1: ans = 'No' else: a = [i for i in range(1,10)] for i in a: q, mod = divmod(N, i) if q < 10 and mod == 0: ans = 'Yes' break if ans == 'No' or ans == '': print('No') else: print('Yes')
p03494
s097113468
Accepted
import sys from itertools import combinations import math def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) n = I() A = LI() ans = 0 isEven = True while 1: for a in A: if a % 2 == 1: isEven = False if isEven == False: break for a in range(len(A)): A[a] = A[a] // 2 ans += 1 print(ans)
p03331
s812299171
Wrong Answer
def getter(i): res=0 while True: res+=i%10 i//=10 if i==0: break return res n=int(input()) digit=n//10 a=10**digit if n-a>0: res=1+getter(n-a) print(res) exit() else: print("10")
p03262
s071629954
Accepted
import numpy as np import fractions n,x = map(int,input().split()) a = list(map(int,input().split())) a.append(x) a.sort() d = np.diff(a) if n>1: gcd = fractions.gcd(d[0],d[1]) if n>3: for i in range(2,n-1): gcd = fractions.gcd(gcd,d[i]) print(gcd) else: print(d[0])
p02957
s978304043
Accepted
def main(): a, b = map(int, input().split()) if (a + b) % 2 == 0: print(int((a + b) / 2)) else: print('IMPOSSIBLE') if __name__ == "__main__": main()
p03836
s006953847
Accepted
sx, sy, tx, ty = map(int,input().split()) width = tx - sx depth = ty - sy st1 = width * 'R' + depth * 'U' st2 = 'D' + (width + 1) * 'R' + (depth + 1) * 'U' + 'L' back1 = width * 'L' + depth * 'D' back2 = 'U' + (width + 1) * 'L' + (depth + 1) * 'D' + 'R' ans = st1 + back1 + st2 + back2 print(ans)
p03041
s828879427
Accepted
N,K = map(int,input().split()) S = input() s = list(S) T = s[K-1] T = T.lower() s[K-1] = T s = ''.join(s) print(s)
p03479
s766910760
Wrong Answer
import math x,y = map(int,input().split()) print(math.floor(math.log2(y/x)))
p04012
s883901542
Wrong Answer
w=input() list_w=list(w) count1=0 if(len(list_w)==1): print("No") elif(len(list_w)!=1): for i in range(0,len(w)): a=w.count(w[i]) if(a%2==0): count1+=1 elif(a%2 != 0): count1-=1 if(count1>0): print("Yes") elif(count1<0): print("No")
p02570
s480712729
Accepted
D, T, S = map(int, input().split()) if T*S >= D: print("Yes") else: print ("No")
p02732
s531226844
Wrong Answer
N = int(input()) A = list(map(int, input().split())) l = [0] * 10000001 for i in A: l[i] += 1 s = 0 for i in range(N): s += l[i] * (l[i] - 1) / 2 for a in A: print(int(s - (l[a] * (l[a] - 1)) / 2 + (l[a] - 1) * (l[a] - 2) / 2))
p02718
s095487120
Accepted
#スペース区切りの整数の入力 N,M = map(int, input().split()) #スペース区切りの整数の入力リスト A_list = list(map(int, input().split())) A_list_sum = sum(A_list) count = 0 aa = A_list_sum/(4*M) #print(aa) for i in range(len(A_list)): #print(i) if(A_list[i]>=aa): count = count + 1 #print(count) if(count >= M): print("Yes") else: print("No") #print(A_list_sum)
p02603
s649902095
Wrong Answer
import math from itertools import groupby N = int(input()) A = list(map(int, (input().split()))) cash = 1000 stock = 0 A = [i[0] for i in groupby(A)] if (A[0] == max(A)): print(cash) else: for i in range(len(A)-1): if (A[i] > A[i+1]): cash = cash + stock*A[i] stock = 0 else: stock = stock + math.floor(cash/A[i]) cash = cash - math.floor(cash/A[i])*A[i] cash = cash + stock*A[i+1] print(cash)
p02714
s329117153
Accepted
n = int(input()) s = input() r = s.count("R") g = s.count("G") b = s.count("B") count = 0 for i in range(n): for j in range(i+1,n): k = j*2-i if 0 <= k < n: if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]: count += 1 print(r*g*b - count)
p02607
s773629226
Wrong Answer
n=input() x=list(map(int,input().split())) ans=0 for i in x[1::2]: if i%2==1: ans+=1 print(ans)
p03127
s428985173
Accepted
import heapq N = int(input()) h = list(map(int, input().split())) heapq.heapify(h) while len(h) > 1: monster = heapq.heappop(h) tmp = [monster] heapq.heapify(tmp) while len(h) > 0: num = heapq.heappop(h) % monster if num != 0: heapq.heappush(tmp, num) h = tmp print(heapq.heappop(h))
p03107
s097772892
Accepted
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: C # CreatedDate: 2020-09-11 14:10:37 +0900 # LastModified: 2020-09-11 14:16:43 +0900 # import os import sys # import numpy as np # import pandas as pd def main(): S = input() if S.count('0') < S.count('1'): print(S.count('0')*2) else: print(S.count('1')*2) if __name__ == "__main__": main()
p03774
s643481324
Wrong Answer
N, M = map(int, input().split()) st = [] for n in range(N): st.append(list(map(int, input().split()))) cs = [] for m in range(M): cs.append(list(map(int, input().split()))) for n in range(N): min_d = 100000 min_i = -1 for m in range(M): d = abs(st[n][0]-cs[m][0]) + abs(st[n][1]-cs[m][1]) if d < min_d: min_d = d min_i = m print(min_i+1)
p02767
s763347946
Wrong Answer
N = int(input()) X = list(map(int,input().split())) ans = max(X) **2 for i in range(1,100): sum = 0 for j in range(N): sum += (X[j]-i)**2 ans = min(ans,sum) print(ans)
p02694
s861050469
Accepted
import sys X = int(input()) year = 1 ans = 100 while 1: ans = int(ans*(1.01)) if ans>=X: break year = year + 1 print(year)
p02785
s053896849
Wrong Answer
n,k=map(int,input().split()) #hp=list(map(int,input().split())) hp=[int(x) for x in input().split()] hp.sort() if n>=k: re=sum(hp[:n-k]) else: re=len(hp) print(re)
p02958
s094488595
Wrong Answer
#整数の入力 A = int(input()) #文字列の入力 S = input() #listを一文字ずつのlistに S_list = list(S) for i in range(A-1): S_list.remove(" ") A_list = [] for i in range(A): A_list.append(i+1) counter = 0 for i in range(A): if(A_list[i] != S_list[i]): counter = counter + 1 if((counter == 0)or(counter == 2)): print("YES") else: print("NO")
p03387
s090628494
Accepted
def main(): A = [int(i) for i in input().split()] A.sort() B = [A[2]-A[0], A[2]-A[1]] ans = 0 if all(b % 2 == 0 for b in B): ans += sum(b//2 for b in B) elif all(b % 2 == 1 for b in B): ans += sum((b-1)//2 for b in B) + 1 else: ans += sum(b//2 for b in B) + 2 print(ans) if __name__ == '__main__': main()
p02775
s562523993
Accepted
def main(): n=list(input()) n=[int(i) for i in reversed(n)] l=len(n) n.append(0) ans=0 for i in range(l): if n[i]<=4: a=n[i] elif n[i]==5: if n[i+1]<=4: a=n[i] else: a=10-n[i] n[i+1]+=1 else: n[i+1]+=1 a=10-n[i] ans+=a ans+=n[l] print(ans) if __name__=='__main__': main()
p03456
s085139018
Accepted
import math a,b=input().split() x=int(a+b) rt=math.sqrt(x) if rt%1>0: print('No') else: print('Yes')
p02910
s645550935
Wrong Answer
s = input() OD = ["D", "R", "U"] EV = ["D", "L", "U"] if (sorted(set(s[::2])) == OD) and (sorted(set(s[1::2])) == EV): print("Yes") else: print("No")
p02948
s568789156
Accepted
import _heapq as heapq n, m = [int(i) for i in input().split()] ab = [] for _ in range(n): a, b = [int(i) for i in input().split()] ab.append([a, -b]) ab.sort() j = 0 ans=0 h = [] for i in range(1, m + 1): while j<n and ab[j][0] <= i: heapq.heappush(h, ab[j][1]) j += 1 if h: ans += heapq.heappop(h) print(-ans)
p03449
s959590195
Accepted
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 for i in range(N): ans = max(ans, sum(A[:i+1])+sum(B[i:])) print(ans)
p03486
s366737650
Accepted
s = input() t = input() s = sorted(s) t = sorted(t, reverse=True) if s < t: print('Yes') else: print('No')
p02584
s831046907
Wrong Answer
import sys X, K, D = [int(x) for x in input().strip().split(" ")] X = abs(X) k, x = divmod(X, D) if K <= k: print(abs(X - D * K)) sys.exit(0) X = x K -= k if k % 2 == 0: print(abs(X)) sys.exit(0) print(abs(X - D))
p02730
s408660199
Accepted
a = input() N = len(a) t = int((N-1)/2) #真ん中まで hantei = True for i in range(t): if a[i] == a[t-1-i]: hantei = True else: hantei = False if hantei == False: print("No") else: b = a[:t+1] + a[:t] if a == b: print("Yes") else: print("No")
p02695
s999421802
Wrong Answer
n,m,q = map(int,input().split()) l = [list(map(int,input().split())) for i in range(q)] ans = 0 def count(a): score = 0 for i in range(q): if a[l[i][1]-1] - a[l[i][0]-1] == l[i][2]: score += l[i][3] return score def dfs(x,now,s): if x == n: return count(s) score = 0 for i in range(now,m+1): s.append(i) score = max(score,dfs(x+1,i,s)) s.pop() return score print(dfs(0,0,[]))
p03679
s787286066
Wrong Answer
x, a, b = map(int,input().split()) if 0 > (b - a): print("delicious") elif x < (b - a): print("dangerous") else: print("safe")
p02628
s421248399
Accepted
import sys import math import collections def set_debug(debug_mode=False): if debug_mode: fin = open('input.txt', 'r') sys.stdin = fin def int_input(): return list(map(int, input().split())) def get(s): return str(s % 9) + '9' * (s // 9) if __name__ == '__main__': # set_debug(True) # t = int(input()) t = 1 for ti in range(1, t + 1): n, k = int_input() A = int_input() A.sort() print(sum(A[:k]))
p02786
s215630423
Accepted
a = int(input()) n = 1 while a > 1: a //= 2 n += 1 ans = 0 for i in range(n): ans += 2 ** i print(ans)
p03455
s462935662
Accepted
a, b = map(int, input().split()) if (a*b) % 2: print('Odd') else: print('Even')
p02916
s972697538
Wrong Answer
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) m=0 for i in range(n-1): if a[i+1]==a[i]+1: m=m+c[i] print(sum(b)+m)
p03836
s186156219
Wrong Answer
sx, sy, tx, ty = list(map(int, input().split())) ans = "L" dx = tx - sx dy = ty - sy ans += "U" * (dy + 1) + "R" * (dx + 1) + "D" ans += "L" * dx + "D" * dy ans += "R" * dx + "U" * dy ans += "R" + "D" * dy + "L" * dx print(ans)
p02630
s517997971
Wrong Answer
N=int(input()) A=list(map(int,input().split())) Q=int(input()) bc = [[0 for i in range(2)] for j in range(Q)] for i in range(Q): bc[i] = list(map(int,input().split())) count = [0 for i in range(110000)] for i in range(N): count[A[i]] += 1 sum_ = sum(A) for i in range(Q): b,c = bc[i] n = count[b] sum_ -= b*n sum_ += c*n count[c] += n print(sum_)
p02687
s280807283
Wrong Answer
print('A%sC'%'BR'[id(id)%9%2])
p03665
s451433122
Wrong Answer
N,P = map(int,input().split()) A = list(map(int,input().split())) C = [0,0] for i in range(N): if A[i]%2==0: C[0] += 1 else: C[1] += 1 if C[1]==0 and P==1: print(0) else: print((2**C[0])*(2**(C[1]-1)))
p03293
s616014442
Accepted
s = input() t = input() n = len(s) for i in range(n): s = list(s) s_last = [s[n - 1]] u = s_last + s[0:n - 1] s = "".join(u) if s == t: print("Yes") exit() print("No")
p04030
s476869340
Accepted
s = list(str(input())) answer = "" for i in s: if i == "0": answer = answer + "0" elif i == "1": answer = answer + "1" elif i == "B": answer = answer[:-1] print(answer)
p02917
s825954829
Accepted
N = int(input()) B = list(map(int, input().split())) A_max = list() for i in range(len(B)+1): if i == 0: A_max.append(B[i]) elif i == len(B): A_max.append(B[-1]) else: A = min([B[i], B[i-1]]) A_max.append(A) print(sum(A_max))
p03861
s338781079
Accepted
a, b, x = map(int, input().split()) print(b // x - (a - 1) // x)
p03673
s931223315
Wrong Answer
n = int(input()) A = list(map(int,input().split())) b = "" inv = 1 for i in range(n): a = str(A[i]) if inv ==1: b = b+a else: b = a+b inv *=-1 if inv ==1: print(*list(b)) else: print(*list(b[::-1]))
p03087
s170074093
Accepted
f = lambda:map(int,input().split()) n,q = f() s = input() ln = [0] for i in range(n): ln.append(ln[i]+(s[i-1:i+1]=='AC')) for _ in range(q): l,r = f() print(ln[r]-ln[l])
p03699
s829185642
Accepted
import sys n, *a = map(int, sys.stdin.read().split()) def main(): s = sum(a) if s % 10: ans = s else: m = min([101] + [x for x in a if x % 10]) if m == 101: ans = 0 else: ans = s - m print(ans) if __name__ == '__main__': main()
p02756
s204001642
Wrong Answer
from sys import stdin input = stdin.readline S = input() Q = int(input()) s = [S[0]] A = [] count = 0 for i in range(Q): A += [input().split()] for i in range(Q): if int(A[i][0]) == 2: if count % 2 == 1: s = s[::-1] count = 0 if int(A[i][1]) == 1: s = [A[i][2]] + s else: s = s + [A[i][2]] else: count += 1 if i == Q-1: if count % 2 == 1: s = s[::-1] result = ''.join(s) print(result)
p03817
s605284532
Accepted
N=int(input()) cnt=N//11*2 if N%11>6: cnt+=2 elif N%11>0: cnt+=1 print(cnt)
p03261
s846352926
Accepted
n=int(input()) s=[input()] for i in range(n-1): w=input() if s[-1][-1]==w[0]: if not w in s: s.append(w) if len(s)==n: print("Yes") else: print("No")
p02602
s411871653
Accepted
n, k = map(int, input().split()) scores = list(map(int, input().split())) evals = [] cnt = 0 for i in range(k, n, 1): edge = scores[cnt] new_edge = scores[i] if edge < new_edge: print('Yes') else: print('No') cnt += 1
p02696
s504328657
Accepted
a,b,n=map(int,input().split()) x=b-1 if x>n: x=n p=a*x//b q=x//b print(p-q)
p03059
s853271118
Accepted
A, B, T = map(int, input().split()) print( (T//A) * B)
p03408
s659560817
Accepted
ans = {} n = int(input()) for _ in range(n): s = input() ans.setdefault(s, 0) ans[s] += 1 m = int(input()) for _ in range(m): t = input() ans.setdefault(t, 0) ans[t] -= 1 ans = sorted(ans.items(), key=lambda x: x[1], reverse=True) print(max(0, ans[0][1]))
p03821
s580759367
Accepted
n = int(input()) l = [[int(i) for i in input().split()] for _ in range(n)] ans = 0 p = 0 for i in l[::-1]: i[0] += p ans += i[1] - (i[0] % i[1]) if i[0] % i[1] else 0 p += i[1] - (i[0] % i[1]) if i[0] % i[1] else 0 print(ans)
p02797
s119257165
Accepted
N,K,S=map(int,input().split()) if S!=10**9: l=[S]*K+[S+1]*(N-K) print(" ".join(map(str,l))) else: l=[S]*K+[1]*(N-K) print(" ".join(map(str,l)))
p03239
s124623956
Accepted
n,T = map(int,input().split()) ct = [map(int, input().split()) for _ in range(n)] c,t = [list(i) for i in zip(*ct)] ans = 1000000 for i in range(n): if(T >= t[i]): ans = min(ans,c[i]) if(ans == 1000000): print('TLE') else: print(ans)
p02659
s840415736
Wrong Answer
import math A,B = input().split() a = int(A) b = float(B) print(int(a*b))