problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02793
s833855955
Wrong Answer
import fractions import numpy as np MOD = 10**9+7 def lcm_n(l): rtn = l[0] for i in range(1,N): rtn = rtn * l[i] // fractions.gcd(rtn,l[i]) return rtn N = int(input()) A = np.array(list(map(int,input().split())),dtype = np.int64) lcm = lcm_n(A) ans = 0 A = (lcm // A) % MOD print(sum(A) % MOD)
p02628
s377516177
Accepted
n, k = map(int, input().split()) print(sum(sorted(map(int, input().split()))[:k]))
p03986
s036847142
Wrong Answer
def main(): X = input() count = 0 for i in range(450): count += X.count("ST") X = X.replace("ST","") print(len(X)) if __name__ == '__main__': main()
p02724
s671185109
Wrong Answer
L=[500,100,50,10,5,1] X=int(input()) happiness_points=0 for i in L: if X//i!=0: if i==500: happiness_points+=1000 elif i==5: happiness_points+=5 else: None
p02577
s974861793
Accepted
N=input() sum=0 for i in N: sum+=int(i) if sum%9 == 0: print('Yes') else: print('No')
p03103
s516660081
Accepted
N, M, *A = map(int, open(0).read().split()) *A, = zip(*[iter(A)]*2) A.sort() ans = 0 for a, b in A: ans += a*min(b, M) M -= min(b, M) if M == 0: break print(ans)
p03719
s229700236
Accepted
A,B,C = map(int,input().split()) if A <= C <= B: print("Yes") else: print("No")
p02755
s403199769
Accepted
a,b=map(int,input().split()) s=0 for i in range(1,1251): if int(i*0.08)==a and int(i*0.1)==b: print(str(i)) s+=1 break if s==0: print("-1")
p03030
s912577625
Accepted
N = int(input()) lst = list() for i in range(1, N+1): s, p = input().split() lst.append({"id":i, "s":s, "p":int(p)}) lst.sort(key=lambda x:x["p"], reverse=True) lst.sort(key=lambda x:x["s"]) for i in range(0, len(lst)): print(lst[i]["id"])
p02939
s232627698
Wrong Answer
import itertools S = input() S = S[::-1] pre = S[0] cnt = 1 i = 1 while i < len(S): if S[i] != pre[-1]: cnt += 1 pre = S[i] i += 1 else: j = 2 while j <= len([pre]): if S[i:i+j] == pre[:j]: j += 1 cnt += 1 pre = S[i:i+j] i += j print(cnt)
p03773
s869983128
Accepted
A,B=map(int,input().split()) print((A+B) % 24)
p02723
s892212774
Wrong Answer
s = str(input("Enter a string: ")) if s[2] == s[3] and s[4] == s[5]: print("Yes") else: print("No")
p02768
s072003627
Accepted
MOD = 10**9 + 7 def comb(n, k, MOD): if n < k or n < 0 or k < 0: return 0 if k == 0: return 1 iinv = [1] * (k + 1) ans = n for i in range(2, k + 1): iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD ans *= (n + 1 - i) * iinv[i] % MOD ans %= MOD return ans n, a, b = map(int, input().split()) ans = pow(2,n,MOD) print(((ans-comb(n,a,MOD))%MOD-comb(n,b,MOD))%MOD-1)
p03693
s642126955
Wrong Answer
a,b,c = map(int,input().split()) print("YES" if (a + b + c) % 2 == 0 else "No")
p02720
s530865044
Wrong Answer
n = int(input()) list = [1,2,3,4,5,6,7,8,9] for i in range(n): x = list[0] # print(i,"番目 ",x) list.pop(0) if x % 10 != 0: list.append(10*x + (x%10) -1) list.append(10*x + (x%10)) if x % 10 != 9: list.append(10*x + (x%10) + 1) print(x)
p02627
s716470083
Accepted
a = input() if a.isupper(): print('A') else: print('a')
p03145
s919375651
Accepted
ab,bc,ca = map(int,input().split()) print(int(ab*bc/2))
p03838
s542618634
Wrong Answer
x,y = map(int,input().split()) ans = 0 if x <= y: ans = y - x else: # x > y if abs(x) > abs(y): if y <= 0: ans = abs(x - y) + 1 elif y > 0: ans = abs(x - y) + 2 elif abs(x) < abs(y):# y ...x or -x ... 0 ... -x or x ... -y ans = abs(y - x) + 1 if x < 0: ans += 1 else:#10,-10など ans = 1 print(ans)
p04031
s073757093
Accepted
N = int(input()) a = list(map(int, input().split())) sm = 10000 * N for y in range(-100, 101): s = 0 for i in range(N): s += (a[i] - y) ** 2 if sm > s: sm = s print(sm)
p02597
s237124643
Accepted
n = int(input()) c = list(input()) R_frag = 0 W_frag = 0 ans = 0 r = n - 1 l = 0 while l < r: if c[l] == "R": l += 1 if c[r] == "W": r -= 1 if c[l] == "W" and c[r] == "R": c[l] = "R" c[r] = "W" ans += 1 l += 1 r -= 1 print(ans)
p02831
s554017252
Accepted
from sys import stdin input=stdin.readline #ユークリッド互除法 def gcd(a, b): dekai = max(a, b) tiisai = min(a, b) div = dekai % tiisai next_dived=tiisai #次割られるのは,さっき割り込んできたやつ #次割るのは,さっきの計算で出た余り while (div != 0): tmp=div div = next_dived % div next_dived=tmp return next_dived A,B=map(int,input().split()) #print(gcd(A,B)) print (A*B//gcd(A,B))
p04029
s820848197
Accepted
n = int(input()) print(n*(n+1)//2)
p03285
s286715612
Wrong Answer
n = int(input()) ans = "No" for i in range(n // 4): if (n - 4 * i) % 7 == 0: ans = "Yes" break else: continue print(ans)
p02658
s081703236
Accepted
# import numpy as np n = int(input()) a_lst = list(map(int, input().split())) x = 10 ** 18 # ans = np.prod(a_lst) ans = 1 if 0 in a_lst: # print("a") ans = 0 else: for i in range(n): ans *= a_lst[i] if ans > x: ans = -1 break # elif ans == 0: # break # if ans > x: # print(-1) # else: # print(ans) print(ans)
p03633
s292663609
Wrong Answer
n = int(input()) t = [int(input()) for _ in range(n)] import fractions n = t[0] for a,b in zip(t, t[1:]): g = fractions.gcd(n, b) n = a*b//g print(n)
p02910
s432586102
Wrong Answer
s = input() for i in range(len(s)): if (i+1) % 2 != 0 and s[i] == 'L': break elif (i+1) % 2 == 0 and s[i] == 'R': break if i == len(s) -1: print('Yes') else: print('No')
p02548
s195370242
Wrong Answer
n = int(input()) ans = 0 if n == 2: print(0) exit() else: for i in range(1, n): ans += (n-1)//i print(ans)
p02748
s751115032
Accepted
# -*- coding: utf-8 -*- A,B,M = [int(i) for i in input().rstrip().split()] a_list = [int(i) for i in input().rstrip().split()] b_list = [int(i) for i in input().rstrip().split()] xyc_list = [list(map(int, input().rstrip().split())) for i in range(M)] #----- min_price = min(a_list) + min(b_list) for x,y,c in xyc_list: price_discount = a_list[x-1] + b_list[y-1] - c min_price = min( min_price, price_discount) print(min_price)
p03672
s190683455
Accepted
s = input() ans =0 n = len(s) for i in range(1 , n): f=0 for j in range(0 , i-1): if j+i>=n or s[j]!=s[i+j]: f=1 if f==0: if n-2*i!=0: ans = max(ans, 2*i) print(ans)
p03285
s361712422
Accepted
n = int(input()) for i in range(0, n//4 + 1): if (n - i*4) % 7 == 0: print("Yes") exit() print("No")
p02838
s780244722
Accepted
n=int(input()) a=list(map(int,input().split())) s=0 for j in range(len(bin(max(a)))-2): cnt1=0 cnt0=0 for i in range(n): if (a[i]>>j)&1: cnt1+=1 else: cnt0+=1 s+=(cnt1*cnt0*2**j)%(10**9+7) print(s%(10**9+7))
p03309
s715354395
Wrong Answer
# ABC102 C - Linear Approximation N = int(input()) A = list(map(int, input().split())) bl = [] for i in range(N): bl.append(A[i] - (i+1)) bl.sort() b = bl[round(N/2)] ans = 0 for i in range(N): ans += abs(A[i] - (b + (i+1))) print(ans)
p03331
s819723345
Wrong Answer
n = int(input()) all = 10000 def sum_digit(num): sum = 0 while(num > 0): sum += num % 10 num = int(num / 10) return sum for a in range(2,n): sum_A =sum_digit(a) sum_B =sum_digit(n-a) all=min(all,(sum_A + sum_B)) print(all)
p03317
s895995673
Accepted
n, k = map(int, input().split()) a = list(map(int, input().split())) def ceil(a, b): return -(-a // b) print(ceil(n-1, k-1))
p03944
s564846933
Accepted
w, h, n = map(int, input().split()) area = [0, 0, w, h] for i in range(n): x, y, a = map(int, input().split()) if a == 1 and x > area[0]: area[0] = x elif a == 2 and x < area[2]: area[2] = x elif a == 3 and y > area[1]: area[1] = y elif a == 4 and y < area[3]: area[3] = y print((area[2]-area[0]) * (area[3] - area[1]) if (area[2]-area[0]) > 0 and (area[3] - area[1]) > 0 else 0)
p03838
s305911782
Accepted
x,y=[int(_) for _ in input().split()] def a(): if y<x: return 10000000000 return y-x def ba(): if -x>y: return 10000000000 return y+x+1 def ab(): if x>-y: return 100000000000 return -x-y+1 def bab(): if x<y: return 10000000000 return x-y+2 ans=min(a(),ba(),bab(),ab()) print(ans)
p03136
s466502164
Accepted
#!/usr/bin/env python3 n = int(input()) l = list(map(int,input().split())) l.sort() l_max = l[-1] ans = 1 s = sum(l) - l_max if s > l_max: print("Yes") else: print("No")
p02633
s533632537
Accepted
x=int(input()) for i in range(1,x+1): if (360*i)%x==0: print((360*i)//x) break
p03495
s208340975
Wrong Answer
N, K = [int(x) for x in input().split(" ")] setlst = {int(x) for x in input().split(" ")} print(K-len(setlst))
p03524
s013766903
Accepted
S = str(input()) a = b = c = 0 for s in S: if s == 'a': a += 1 elif s == 'b': b += 1 elif s == 'c': c += 1 if abs(a-b) <= 1 and abs(b-c) <= 1 and abs(c-a) <= 1: print('YES') else: print('NO')
p03633
s266375090
Accepted
def main(): from functools import reduce N = int(input()) def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a // gcd(a, b) * b ret = reduce(lcm, (int(input()) for _ in range(N))) print(ret) if __name__ == '__main__': main()
p03371
s787756333
Wrong Answer
a, b, c, x, y =map(int, input().split()) ab = 2*c i = 1 cost = 0 while True: cost = i *ab if i <= x or i <= y: break i += 1 cost += a *(max(0, (x-i))) cost += b *(max(0, (y-i))) print(cost)
p02600
s160398119
Wrong Answer
X = int(input('点数:')) if 400 <= X <= 599: print(8) if 600 <= X <= 799: print(7) if 800 <= X <= 999: print(6) if 1000 <= X <= 1199: print(5) if 1200 <= X <= 1399: print(4) if 1400 <= X <= 1599: print(3) if 1600 <= X <= 1799: print(2) if 1800 <= X <= 1999: print(1)
p02572
s067574206
Accepted
N = int(input()) A = list(map(int, input().split())) c=0 d=sum(A) for i in range(0,N-1): d-=A[i] c+=A[i]*d if(c>10**9+7): c%=(10**9+7) print(c)
p03835
s295071936
Accepted
K,S=map(int, input().split()) ans = 0 x = S//3+1 for i in range(x): y = (S-i)//2+1 for j in range(i, y): k = S - i - j if k > K: continue if i == j == k: ans += 1 elif i == j or j == k: ans += 3 else: ans += 6 print(ans)
p03069
s577570059
Wrong Answer
from sys import stdin n = int(stdin.readline().rstrip()) s = "."+stdin.readline().rstrip() point = 0 point2 = 0 for i in s: if i == ".": point += 1 else: break for j in s[::-1]: if j == "#": point2 += 1 else: break s = s[point:len(s)-point2] S = len(s) sharp = s.count("#") flat = S-sharp print(min(S-sharp,S-flat))
p03469
s855226471
Accepted
import sys def input(): return sys.stdin.readline().strip() def main(): s = input() print("2018" + s[4:]) if __name__ == "__main__": main()
p03262
s936839820
Accepted
from fractions import gcd # 最大公約数: gcd(x, y) from functools import reduce def gcd_list(numbers): return reduce(gcd, numbers) def main(): n, x = map(int, input().split()) num_list = list(map(int, input().split())) for i in range(n): num_list[i] = abs(num_list[i] - x) print(gcd_list(num_list)) if __name__ == '__main__': main()
p03327
s103089443
Accepted
def main(): from builtins import int, map, list, print import sys sys.setrecursionlimit(10 ** 6) input = (lambda: (sys.stdin.readline()).rstrip()) input_list = (lambda: input().split()) input_number = (lambda: int(input())) input_number_list = (lambda: list(map(int, input_list()))) N = input_number() print("AABBCD"[N > 999::2]) if __name__ == '__main__': main()
p03797
s821367730
Wrong Answer
n,m = map(int,input().split()) parts = n*2 + m print(parts//4)
p03481
s940632555
Accepted
import sys import heapq import math import fractions import bisect import itertools from collections import Counter from collections import deque from operator import itemgetter def input(): return sys.stdin.readline().strip() def mp(): return map(int,input().split()) def lmp(): return list(map(int,input().split())) x,y=mp() ans=0 while x<=y: ans+=1 x*=2 print(ans)
p02900
s524513952
Wrong Answer
from fractions import gcd from math import sqrt A, B = map(int, input().split()) if (A == 1 or B == 1 or A == B): print(1) exit(0) C = gcd(A, B) ans = [] for i in range(2, C + 1): if (C % i == 0): ans.append(i) if (i >= C // i): break N = len(ans) seen = [0] * N cnt = 0 for i in range(N): if(seen[i]): continue for j in range(i, N): if (ans[j] % ans[i] == 0): seen[j] = 1 cnt += 1 print(cnt + 1)
p03041
s448695023
Accepted
N, K = map(int, input().split()) S = list(input()) S[K - 1] = S[K - 1].lower() print(''.join(S))
p02552
s055944485
Wrong Answer
def power_func(a,n,p): bi = str(format(n,"b")) res = 1 for i in range(len(bi)): res = (res*res) %p if bi[i] == "1": res = (res*a) %p return res N = int(input()) answer = power_func(10,N,pow(10,9) + 7) + power_func(8,N,pow(10,9) + 7) - 2 * power_func(9,N,pow(10,9) + 7) print(answer)
p03627
s645646990
Accepted
import collections n = int(input()) l = map(int, input().split()) c = collections.Counter(l) c = sorted(c.items(), key=lambda c:c[0], reverse=True) ans = 1 cnt = 0 for key,val in c: if cnt==0 and val>=4: ans=key**2 break if val>=2: ans*=key cnt+=1 if cnt == 2: break else: ans = 0 print(ans)
p02748
s776814803
Wrong Answer
aa, bb, m = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) x = [] y = [] c = [] for i in range(m): x1, y1, c1 = list(map(int,input().split())) x.append(x1) y.append(y1) c.append(c1) price = [] for i in range(m): price.append(a[x[i] - 1] + b[y[i] - 1] - c[i]) print(min(price))
p02594
s227352396
Accepted
x = int(input()) if x >= 30: print("Yes") else: print("No")
p02848
s470615763
Accepted
N = int(input()) S = input() for s in S: print(chr((ord(s) - ord('A') + N) % 26 + ord('A')), end='')
p02811
s878558339
Accepted
kx = input().split(" ") k = int(kx[0]) x = int(kx[1]) if 500 * k >= x: print("Yes") else: print("No")
p02618
s407693465
Wrong Answer
D=int(input()) c=list(map(int,input().split())) s=[] t=[] for i in range(D): s.append(list(map(int,input().split()))) l=[0]*26
p02791
s050350305
Accepted
N=int(input()) c=list(map(int, input().split())) ans=1 tmp=c[0] for i in range(1,N): if c[i]<tmp: tmp=c[i] ans+=1 print(ans)
p03030
s470412451
Accepted
n = int(input()) data = dict() name = set() for i in range(n): s, p = input().split() p = int(p) if s in data: data[s].append([p, i + 1]) else: data[s] = [] data[s].append([p, i + 1]) name.add(s) name = list(name) name.sort() for n in name: data[n].sort(reverse = True) for i in data[n]: print(i[1])
p02748
s302821281
Accepted
A,B,M = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) oldp = min(a)+min(b) for _ in range(M): x, y, cp = map(int,input().split()) p = a[x-1]+b[y-1]-cp if oldp > p: oldp = p print(oldp)
p03407
s456710744
Wrong Answer
a,b,c = map(int,input().split()) if a+b*2>=c: print("Yes") else: print("No")
p03359
s113836187
Wrong Answer
a,b = map(int,input().split()) if a >= b: print(a-1) else: print(a)
p04020
s045474740
Accepted
n = int(input()) now, bef = 0, 0 ans = 0 for i in range(n): now = int(input()) if now == 0 and bef == 1: bef = 0 if (now+bef)%2 == 0: if bef == 0: ans += now//2 bef = 0 else: ans += (now+bef)//2 bef = 0 else: if bef == 0: ans += now//2 bef = 1 else: ans += (now+bef)//2 bef = 1 print(ans)
p02923
s009938902
Wrong Answer
N = int(input()) H = list(map(int, input().split())) H.reverse() ans = 0 val = 0 for i in range(N-1): if H[i] <= H[i+1]: val +=1 else: ans = max(ans,val) val = 0 print(ans)
p04045
s111141059
Wrong Answer
N, K = map(int, input().split()) D = list(map(str, input().split())) n = str(N) rs = 0 for i in range(1, len(n) + 1): nn = n[-i] while True: if not nn in D: break else: nnn = int(nn) nnn += 1 nn = str(nnn) rs += int(nn) * 10 ** (i-1) print(rs)
p02912
s548044802
Accepted
import heapq I = input().split() N = int(I[0]) M = int(I[1]) # N: 品物の数 # M: 割引券の数 # A: 品物の値段行列 A = list(map(int , input().split())) A = list(map(lambda x: x*(-1), A)) heapq.heapify(A) for i in range(M): M -= 1 pri = heapq.heappop(A) pri *= -1 pri //= 2 pri *= -1 heapq.heappush( A , pri ) Fi_pri = 0 for i in range(N): Fi_pri += A[i] print( -1 * Fi_pri )
p02819
s382023771
Accepted
X=int(input()) if X==2: print(2) else: while 1: flag=0 for i in range(2,X): if X%i==0: flag=1 break if flag==0: break else: X=X+1 print(X)
p03146
s223603906
Accepted
s=int(input()) if s == 1 or s == 2 or s ==4 : print(4) else: i = 2 while s > 1: if s%2==0: s=s/2 else: s=3*s+1 i += 1 print(i)
p03705
s274617100
Accepted
N,A,B = list(map(int,input().split())) if N==1 and A!=B: print(0) exit() elif A>B: print(0) exit() min = B+A*(N-1) max = B*(N-1)+A print(max-min+1)
p02731
s112989685
Accepted
l = int(input()) l = l/3 print(l**3)
p04031
s465561020
Accepted
n = int(input()) a = [int(i) for i in input().split()] ans = 10 ** 10 for i in range(min(a), max(a) + 1): x = 0 for n in a: x += (i - n) ** 2 ans = min(ans, x) print(ans)
p03062
s015838512
Accepted
N = int(input()) A = list(map(int, input().split())) n = len(list(filter(lambda x: x<0, A))) A.sort(key=abs) if n&1 == 0: print(sum(map(abs, A))) else: print(sum(map(abs, A[1:]))-abs(A[0]))
p03592
s576285029
Wrong Answer
N, M, K = map(int, input().split()) flag = False area = 0 for i in range(M): area += N if area == K: flag = True area = 0 for i in range(N): area += M if area == K: flag = True for i in range(1, M): for j in range(1, N): area = i * j + (N - i) * (M - j) if area == K: flag = True if flag: print('Yes') else: print("No")
p03137
s558418242
Accepted
n, m, *X = map(int, open(0).read().split()) X.sort() if n >= m: print(0) else: Y = [0] * m for i in range(m-1): Y[i] = X[i+1] - X[i] Y.sort() print(sum(Y[:m-n+1]))
p03043
s917861548
Accepted
from math import log2 N,K = [int(i) for i in input().split()] prob = 0 for i in range(1,N+1): j = 0 while 2**(j) * i < K: j += 1 prob += (1/N) * (0.5)**j # print((1/N) * (0.5)**j, j) print(prob)
p02983
s917611825
Accepted
L, R = map(int, input().split()) mod = 2019 ans = 10**9 + 7 for i in range(L, min(L + mod, R)): for j in range(i + 1, min(i + mod + 1, R + 1)): ans = min((i * j) % mod, ans) print(ans)
p02780
s153198971
Wrong Answer
n,k=map(int,input().split()) p=list(map(int,input().split())) q=[] for i in p: q+=[(i+1)/2] ans=sum(q[:k]) for i in range(1,n-k+1): if q[i-1]<q[i-1+k]: ans=sum(q[i:i+k]) print(ans)
p02771
s220247973
Wrong Answer
a = list(map(int,input().split())) if(len(set(a)) == 1): print("No") else: print("Yes")
p03328
s077234364
Accepted
a,b = map( int, input().split()) print( sum( [ i for i in range(1, b-a+1)]) - b)
p03637
s035284769
Accepted
N = int(input()) A = list(map(int,input().split())) two = 0 four = 0 odd = 0 for a in A: if a % 4 == 0: four += 1 elif a % 2 == 0: two += 1 N -= max(0, two - 1) print("Yes" if four >= N // 2 else "No")
p03127
s814805330
Accepted
from fractions import gcd def mi(): return map(int, input().split()) def ii(): return int(input()) def main(): N = ii() A = list(mi()) ans = A[0] for i in range(N-1): ans = gcd(ans, A[i+1]) print(ans) if __name__ == '__main__': main()
p02933
s488555024
Accepted
a=int(input()) s=input() if a>=3200: print(s) else: print('red')
p03711
s681355927
Wrong Answer
a,b=map(int,input().split()) c=[1,3,5,7,8,10,2] d=[4,6,9,11] if a in c and b in c: print("Yes") elif a in d and b in d: print("Yes") else: print("No")
p03659
s090178792
Accepted
n = int(input()) a=list(map(int,input().split())) s = sum(a) s_tmp = 0 min_ = 10**18 for i in range(n-1): s_tmp += a[i] min_ = min(min_, abs(s_tmp-(s-s_tmp))) print(min_)
p02606
s413620184
Accepted
l,r,d = map(int, input().split()) print(r//d - (l-1)//d)
p02615
s571540579
Wrong Answer
N=int(input()) lis=list(map(int,input().split())) lis.sort() print(sum(lis[::-1][:-1]))
p03720
s156720758
Wrong Answer
n,m = map(int,input().split()) #a,b = map(int,input().split()) dic = {} for _ in range(m): a,b = map(int,input().split()) try: dic[a] += 1 except: dic[a] = 1 try: dic[b] += 1 except: dic[b] = 1 dic = sorted(dic.items(),key=lambda x:x[0]) for i in dic: print(i[1])
p03761
s739947852
Accepted
N = int(input()) al=[chr(ord('a') + i) for i in range(26)] out = [1000]*26 for i in range(N): S = list(input()) LS = len(S) tmp = [0]*26 for j in range(LS): tmp[ord(S[j])-ord("a")]+=1 for j in range(26): out[j]=min(out[j],tmp[j]) S = "" for i in range(26): S += out[i]*chr(ord("a")+i) print(S)
p03779
s583278223
Accepted
import math X = int(input()) n = math.ceil((-1+math.sqrt(1+8*X))/2) print(n)
p02754
s717758540
Wrong Answer
# coding: utf-8 import os, sys import numpy as np N, A, B = map(int, input().split()) # print(N, A, B) rep = np.floor(N / (A+B)) rest = N - (A + B) * rep diff = A if rest >= A else rest ans = A * rep + diff print(int(ans))
p02747
s552535152
Accepted
S = input() st = [] if len(S) %2 != 0 : print('No') else : for i in range(len(S) // 2) : st.append(S[i*2:i*2+2]) st = list(set(st)) if len(st) == 1 and st[0] == 'hi' : print('Yes') else : print('No')
p04011
s444255289
Accepted
N,K,X,Y = [int(input()) for i in range(4)] if N <= K: print(N * X) else: print(K * X + (N-K) * Y)
p03471
s458357377
Wrong Answer
N,Y = map(int,input().split()) a,b,c =-1,-1,-1 if Y<=10000*N: target = Y - 1000*N for i in range(N+1): target_x = target - 4000*i if target_x < 4000: break if target_x % 9000 == 0: #print(target_x) a = int(target_x / 9000) b = i c = N - a - b break print(*[a,b,c])
p02789
s938759680
Wrong Answer
N, M = map(int, input().split()) if N == M: print("YES") else : print("NO")
p02731
s182906817
Accepted
import sys input = sys.stdin.readline #n = int(input()) #l = list(map(int, input().split())) ''' A=[] B=[] for i in range(): a, b = map(int, input().split()) A.append(a) B.append(b)''' #import copy #import numpy as np l=int(input()) if l%3==0: print((l//3)**3) elif l%3==1: print((l/3)**3) else: print((l/3)**3)
p03107
s248378858
Accepted
#!/usr/bin/env python3 s = input() n = len(s) n_0 = s.count("0") n_1 = s.count("1") d = abs(n_0 - n_1) print(n - d)
p02720
s960493659
Accepted
from collections import deque k=int(input()) stack = deque([1,2,3,4,5,6,7,8,9]) def lunlun(): cnt=0 while True: now = stack.popleft() cnt += 1 if cnt == k: return now s = str(now) for i in range(-1,2): temp=int(s[-1]) + i if temp>=0 and temp<10: temp1=int(s + str(temp)) stack.append(temp1) print(lunlun())