problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03434
s836093723
Accepted
N = int(input()) a = list(map(int, input().split())) a.sort() s = 0 for i in range(1, N + 1): if i % 2 == 1: s += a[-i] else: s -= a[-i] print(s)
p03324
s814853513
Accepted
d, n = [int(w) for w in input().split()] if n == 100: n = 101 print(100**d*n)
p03437
s842185393
Wrong Answer
x,y=map(int,input().split()) print(x*y-1 if x!=y else -1)
p03345
s459181586
Accepted
A,B,C,K=map(int,input().split()) l=[A,B,C] #l.sort(reverse=True) if K%2==0: if abs(A-B)>10**18: print("Unfair") else: print(A-B) else: if abs(B-A)>10**18: print("Unfair") else: print(B-A)
p02790
s589381836
Wrong Answer
a, b = map(int, raw_input() .split()) x = '' for i in range(a): x += str(b) print x
p03910
s815657719
Accepted
Score = int(input()) Numero = 0 for i in range (1, 10000000): if i*(i+1)/2 >= Score: Numero = i break K = Numero P = [] for i in range (0, K): if Score >= (K-i): P.append(K-i) Score = Score - (K-i) P = reversed(P) print(*P, sep = "\n")
p03693
s960978589
Wrong Answer
r, g, b = map(int, input().split()) if (g % 2 == 0) and (b % 2 == 0): print('YES') else: print('NO')
p02882
s753403038
Accepted
# 初期入力 a,b,X = map(int, input().split()) # suito_taiseki = a*a*b #水筒の体積 h_wate = X/a/a #水面の高さ from math import atan,degrees if suito_taiseki/2 <=X: y = (b-h_wate)*2 kakudo =degrees( atan(y/a) ) else: y =2*X/b/a kakudo =90-degrees(atan(y/b)) print(kakudo)
p02912
s588281500
Wrong Answer
n,m = map(int,input().split()) a = [int(c) for c in input().split()] a.sort() def putmid(): right = n left = 0 mid = 0 while right - left > 1: mid = (right + left) // 2 if a[mid] <= a[-1]: left = mid else: right = mid a.insert(mid,a[-1]) a.pop(-1) for i in range(m): a[-1] = a[-1]//2 putmid() print(sum(a))
p03067
s053075080
Accepted
''' Created on 2020/08/20 @author: harurun ''' def main(): import sys pin=sys.stdin.readline pout=sys.stdout.write perr=sys.stderr.write A,B,C=map(int,pin().split()) if (A<C and C<B) or (B<C and C<A): print("Yes") return print("No") return main()
p03481
s478889028
Accepted
import sys def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) X,Y = LI() ans = 1 while 1: X *= 2 if X>Y: break ans += 1 print(ans)
p04034
s635680937
Wrong Answer
# -*- coding: utf-8 -*- """ Created on Sun Jun 7 14:28:00 2020 @author: NEC-PCuser """ N, M = map(int, input().split()) x, y = [], [] for i in range(M): x_tmp, y_tmp = map(int, input().split()) x.append(x_tmp) y.append(y_tmp) ball_set = set() ball_set.add(1) start_flg = True for i in range(len(x)): if x[i] in ball_set: if start_flg == True: ball_set.discard(1) ball_set.add(y[i]) print(len(ball_set))
p02795
s306439570
Accepted
H = int(input()) W = int(input()) N = int(input()) ans = 0 painted_mas = 0 def min_raw(): if H > W: return W elif W >= H: return H def max_raw(): if H > W: return H elif W >= H: return W for i in range(min_raw()): ans += 1 painted_mas += max_raw() if N <= painted_mas: print(ans) break
p02843
s551950212
Accepted
# -*- coding: utf-8 -*- X = int(input()) num = X // 100 if num*100 <= X and X<=num*105: print("1") else: print("0")
p02615
s232738082
Accepted
N = int(input()) A = list(map(int,input().split())) A.sort(reverse=True) i = 1 ans = A[0] N -= 2 while N>0: if N>1: ans += 2*A[i] N -= 2 i += 1 else: ans += A[i] break print(ans)
p03317
s508862027
Wrong Answer
N, K = map(int, input().split()) arr = list(map(int, input().split())) index = arr.index(1) left = -(-index//2) right = -(-(N - (index + 1))//2) print(left+right)
p03264
s925187083
Wrong Answer
N=int(input()) if N%2==0: print((N/2)**2) elif N%2!=0: print((N//2)*(N-(N//2)))
p03617
s144324885
Accepted
q,h,s,d = map(int,input().split()) n = int(input()) s = min(q*4, h*2,s) print(min(s*n, n//2*d + (n%2)*s))
p03657
s094651649
Wrong Answer
a,b = map(int, input().split()) if a+b % 3 == 0: print("Possible") else: print("Impossible")
p03797
s626616170
Accepted
def main(): s_shaped_piece, c_shaped_piece = map(int, input().split()) answer = min(s_shaped_piece, c_shaped_piece // 2) c_shaped_piece -= answer * 2 answer += c_shaped_piece // 4 print(answer) if __name__ == '__main__': main()
p02665
s541114276
Wrong Answer
N = int(input()) A = list(map(int,input().split())) MAX = [] MIN = [] e = 1 for a in A: if e > 0: MAX.append(e) MIN.append(e//2) e -= a e *= 2 else: print(-1) exit() A.reverse() MAX.reverse() MIN.reverse() ans = 0 s = 0 for i,a in enumerate(A): s += a s = min(MAX[i],s) ans+= max(MIN[i],s) print(ans)
p03971
s543760906
Accepted
n,a,b = map(int, input().split()) s = input() cnt = 0 x = 0 for i in range(n): if s[i] == "a": if cnt < a+b: cnt += 1 print("Yes") else: print("No") elif s[i] == "b": if cnt < a+b and x+1 <= b: cnt += 1 x += 1 print("Yes") else: print("No") else: print("No")
p02759
s410369284
Wrong Answer
n=int(input()) if n%2==0: print(n/2) else: print(int(n/2)+1)
p02793
s005078820
Wrong Answer
import numpy as np import fractions from functools import reduce def lcm_base(x, y): return (x * y) // fractions.gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) def LI(): return [int(s) for s in input().split()] N = int(input()) A_s = np.array(LI()) mod = 10**9 + 7 l = lcm_list(A_s) print(sum(map(lambda x:l//x, A_s)) % mod)
p02831
s342218742
Wrong Answer
a, b = map(int, input().split()) ans = 10**100 for i in range(min(a, b), 1, -1): if a % i == 0 and b % i == 0: ans = i * (a // i) * (b // i) break print(a * b, ans) print(min(a * b, ans))
p02623
s306048827
Accepted
n,m,k = map(int,input().split()) arr1 = list(map(int,input().split())) arr2 = list(map(int,input().split())) acum1 = [0] for i in range(n): acum1.append( acum1[-1] + arr1[i]) acum2 = [0] for i in range(m): acum2.append(acum2[-1] + arr2[i]) ans = 0 j = m for i in range(n+1): if acum1[i]>k: break while acum2[j]>k-acum1[i] and j>0: j -= 1 ans = max(ans,i+j) print(ans)
p02832
s085318906
Accepted
def main(): n = int(input()) i = 1 for a_i in input().split(): if i == int(a_i): i += 1 if i == 1: i = n + 2 print(n - i + 1) if __name__ == "__main__": main()
p02785
s616429811
Accepted
N, K = map(int, input().split()) H = sorted(list(map(int, input().split()))) if N <= K: print('0') elif K == 0: print(sum(H)) else: print(sum(H[:N - K]))
p03475
s021064908
Wrong Answer
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) cfs = [list(map(int, readline().split())) for i in range(n - 1)] for i in range(n - 1): cnt = cfs[i][1] + cfs[i][0] for j in range(i + 1, n - 1): if cnt < cfs[j][1]: cnt = cfs[j][1] + cfs[j][0] else: cnt += (cnt - cfs[j][1]) % cfs[j][2] + cfs[j][0] print(cnt) print(0)
p03061
s481548552
Wrong Answer
import fractions n = int(input()) a = list(map(int, input().split())) l = [0]*(n+1) l[1] = a[0] r = [0]*(n+1) r[n-1] = a[n-1] for i in range(1, n): l[i+1] = fractions.gcd(l[i], a[i]) r[n-1-i] = fractions.gcd(r[n-i], r[n-i]) m = 0 for i in range(n): m = max(m, fractions.gcd(l[i], r[i+1])) print(m)
p02835
s840412634
Accepted
a = list(map(int, input().split())) if sum(a) >= 22: print('bust') else: print('win')
p02696
s075104910
Wrong Answer
import math A,B,N = (int(i) for i in input().split()) if N > B: print(A-1) else: print(math.floor(A*N/B) - A*math.floor(N/B))
p03861
s976507090
Accepted
import sys a, b, x = map(int, input().split()) cnt = 0 if a == 0: cnt = b // x + 1 else: cnt = b // x - (a - 1) // x print("{}".format(cnt))
p04011
s586662775
Wrong Answer
N = int(input()) K = int(input()) X = int(input()) Y = int(input()) first = K*X after = Y*(N-K) print(first + after)
p02988
s284367999
Accepted
N = int(input()) pList = list(map(int, input().split())) ans = 0 for i in range(1, N-1): if pList[i-1] < pList[i] < pList[i+1] or pList[i-1] > pList[i] > pList[i+1]: ans += 1 print(ans)
p02687
s697094088
Accepted
S = input() if S == "ABC": print("ARC") else: print("ABC")
p03860
s124054929
Wrong Answer
a,b,c = input().split() middle = b.capitalize() print("A{}C".format(middle))
p03773
s203755574
Wrong Answer
a, b = map(int, input().split()) ans = a+b if ans > 24: ans = ans - 24 print(ans)
p02779
s121969214
Accepted
from collections import Counter n = int(input()) a = list(map(int,input().split())) c = Counter(a) if c.most_common()[0][1] == 1: print("YES") else: print("NO")
p02817
s464273432
Accepted
S, T = input().split(" ") print(T+S)
p03838
s163960227
Accepted
x, y = map(int, input().split()) if x >= 0 and y >= 0 and x <= y: ans = y - x elif x >= 0 and y > 0 and x >= y: ans = x - y + 2 elif x <= 0 and y <= 0 and x <= y: ans = y - x elif x < 0 and y <= 0 and x >= y: ans = x - y + 2 elif x >= 0 and y <= 0: ans = abs(x - abs(y)) + 1 elif x <= 0 and y >= 0 and abs(x) <= y: ans = y - abs(x) + 1 elif x <= 0 and y >= 0 and abs(x) > y: ans = abs(x) - y + 1 print(ans)
p03041
s205343471
Accepted
N, K = map(int,input().split()) S = list(input()) S[K-1] = S[K-1].lower() print(''.join(S))
p03565
s418627135
Wrong Answer
Sp = input() T = input() if len(T) > len(Sp): print("UNRESTORABLE") exit() oklist = [] for i in range(len(Sp) - len(T), -1, -1): for j in range(len(T)): if Sp[i + j] != "?" and Sp[i + j] != T[j]: break else: print(i) okpre = ["a" if Sp[k] == "?" else Sp[k] for k in range(i)] oksuf = ["a" if Sp[k] == "?" else Sp[k] for k in range(i + len(T), len(Sp))] oklist.append("".join(okpre) + T + "".join(oksuf)) if oklist: print(min(oklist)) else: print("UNRESTORABLE")
p03493
s180128769
Accepted
s=input() x=int(s[0])+int(s[1])+int(s[2]) print(x)
p02628
s562271806
Accepted
n,k=map(int,input().split()) a=list(map(int,input().split())) ans=0 for i in range(k): ans+=min(a) a.remove(min(a)) print(ans)
p03821
s934467245
Accepted
N = int(input()) A = [] B = [] for i in range(N): a,b = map(int, input().split()) A.append(a) B.append(b) cnt = 0 for i in range(N-1,-1,-1): if (A[i]+cnt)%B[i] == 0: continue cnt += B[i] - ((A[i]+cnt)%B[i]) print(cnt)
p02594
s548447628
Wrong Answer
# 入力値の代入 x = int(input("入力: ")) # xが30以上か否かで出力結果を買える if x >= 30: print("Yes") elif x < 30: print("No") else: print("エラー")
p02768
s986213887
Accepted
n, a, b=map(int, input().split()) mod = 10 ** 9 + 7 def cmb(n, r, mod): r = min(r, n -r) if r == 0: return 1 over, under = 1, 1 for i in range(1, r+1): over = over * (n-i+1) % mod under = under * i % mod inv=pow(under, mod-2, mod) return over*inv % mod print((pow(2,n,mod)-1 - cmb(n, a,mod)-cmb(n,b,mod))%mod)
p02747
s640412851
Accepted
S = list(input()) if len(S)%2 != 0: print("No") else: for i in range(len(S)): if (i%2 == 0 and S[i] != "h") or (i%2 == 1 and S[i] != "i"): print("No") break else: print("Yes")
p03962
s841793644
Wrong Answer
a,b,c = map(int,input().split()) ans = 3 if a == b: ans -= 1 if a == c: ans -= 1 if c == b: ans -= 1 print(ans)
p02900
s095649277
Wrong Answer
import fractions A, B = map(int, input().split()) C = fractions.gcd(A, B) ans = 1 primes = [2] if C % 2 == 0: ans += 1 while C % 2 == 0: C //= 2 p = 3 while C > 1: for prime in primes: if p % prime == 0: continue primes.append(p) ans += 1 while C % p == 0: C //= p p += 2 print(ans)
p03474
s561744887
Wrong Answer
a, b = list(map(int, input().split())) s = list(input()) na = "".join(s[: a - 1]).isdigit() nb = "".join(s[a + 1 :]).isdigit() hf = s[a] print("Yes") if na and nb and hf == "-" else print("No")
p02675
s531134983
Accepted
N = int(input()) if N % 10 == 3: print('bon') elif N % 10 == 0 or N % 10 == 1 or N % 10 == 6 or N % 10 == 8: print('pon') else: print('hon')
p02787
s540142596
Accepted
def main(): from sys import stdin readline = stdin.readline H, N = map(int, readline().split()) AB = [list(map(int, readline().split())) for _ in range(N)] dp = [100000000] * (H + 10 ** 4 + 1) dp[0] = 0 for i in range(H): if dp[i] == 100000000: continue for a, b in AB: t = dp[i] + b if t < dp[i + a]: dp[i + a] = t print(min(dp[H:])) main()
p02959
s148819479
Accepted
import sys from collections import Counter input = sys.stdin.readline N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 for i in range(N-1, -1, -1): remain = B[i] if remain <= A[i+1]: ans += remain remain = 0 else: ans += A[i+1] remain -= A[i+1] if remain <= A[i]: ans += remain A[i] -= remain else: ans += A[i] A[i] = 0 print(ans)
p02555
s373638213
Accepted
MOD=10**9+7 S=int(input()) def invmod(a): return pow(a,MOD-2,MOD) #return powmod(a,MOD-2) def comb_mod(n,r): r=min(r,n-r) nPr=1 fact_r=1 for i in range(r): nPr*=n-i nPr%=MOD fact_r*=r-i fact_r%=MOD return (nPr*invmod(fact_r))%MOD limit=S//3 #print(limit) answer=0 for i in range(1,limit+1): rest=S-3*i #print(i,rest) # deliver rest for i-term answer+=comb_mod(i+rest-1,rest) answer%=MOD print(answer)
p02695
s923237009
Accepted
n,m,q=map(int,input().split()) l=[] for i in range(q): l.append(list(map(int,input().split()))) li=[] for i in range(m): li.append(i+1) import itertools ans=0 for lis in itertools.combinations_with_replacement(li, n): lis=list(lis) an=0 for z in l: a,b,c,d=z if lis[b-1]-lis[a-1]==c: an+=d ans=max(an,ans) print(ans)
p03767
s689613298
Wrong Answer
n = int(input()) a = list(map(int, input().split())) a.sort() print(sum(a[::-1][n:2*n]))
p03487
s423417440
Accepted
n = int(input()) a = list(map(int, input().split())) d = dict() for n in a: d[n] = d.get(n, 0) + 1 ans = 0 for k, v in d.items(): if k < v: ans += v-k if k > v: ans += v print(ans)
p02624
s425909729
Wrong Answer
N = int(input()) sum = 0 ro = 1 for n in range(1,N+1): num = int(N/n) if num == 1: record = n break s = int(((1+num)*num)/2) sum += ro*s ro += 1 print(record) print(sum) sum += int(((record+N)*(N-record+1))/2) print(sum)
p02742
s235202953
Accepted
H,W=map(int,input().split()) if H==1 or W==1: print(1) exit() print((H*W+1)//2)
p02658
s809058148
Accepted
def main(): n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) return ans = 1 for i in a: ans *= i if ans > (10 ** 18): print(-1) return print(ans) main()
p03719
s025895067
Accepted
A,B,C = tuple(map(int, input().split())) if B >= C >= A: print('Yes') else: print('No')
p02742
s209174402
Wrong Answer
A, B = map(int, input().split()) print((A * B + 1) // 2)
p02993
s643491438
Wrong Answer
S = input() if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]: print("Bad") else: print("Yes")
p03417
s467751333
Wrong Answer
n, m = map(int, input().split()) if n and m == 1: print(1) elif n == 1: print(m-2) elif m == 1: print(n-2) elif n>= 2 and m>=2: print((n-2)*(m-2))
p03449
s414860173
Accepted
n = int(input()) r1 = tuple(int(x) for x in input().split()) r2 = tuple(int(x) for x in input().split()) # If d == 0, first it moves down, then it moves right. candies = (sum(r1[:d+1]) + sum(r2[d:]) for d in range(n)) print(max(candies))
p03693
s345555123
Wrong Answer
print("YNEOS"[max(int(input().replace(" ",""))%4,1)::2])
p03592
s650977278
Wrong Answer
def answer(n, m, k): YES = 'Yes' NO = 'No' if k%n == 0 or k%m == 0: return YES j = 1 for i in range(m-1, 0, -1): if k == (i + (n-1)*j): return YES j += 1 if (n-2)*2 + (m-2)*2 == k: return YES return NO n, m, k = map(int, input().split()) print(answer(n, m, k))
p03485
s937034677
Accepted
import math import statistics ab = list(map(int, input().split())) print(math.ceil(statistics.mean(ab)))
p02796
s009302752
Accepted
n = int(input()) X = [] for i in range(n): x, l = map(int, input().split()) X.append([x-l, x+l]) X.sort() temp = X[0][1] count = n for i in range(1,n): if temp>X[i][0]: count -= 1 temp = min(temp, X[i][1]) else: temp = X[i][1] print(count)
p03419
s437579105
Accepted
N,M = map(int, input().split()) if N == 1 and M == 1: print(1) elif N == 1 : print(M-2) elif M == 1: print(N-2) else: print(int(N-2)*(M-2))
p03145
s619936161
Accepted
a,b,_ = map(int, input().split()) # 3 4 5 print(a*b//2)
p02820
s895163042
Wrong Answer
n,k=map(int,input().split()) a,b,c=map(int,input().split()) s=input() l=['a']*k for i in range(n): l[i%k]+=s[i] ans=0 d={'s':a,'p':b,'r':c} for i in range(k): x=l[i] for j in range(len(x)-1): if x[j+1]==x[j]: ans+=d[x[j+1]] print(ans)
p02768
s191489785
Accepted
n,a,b = map(int,input().split()) def modComb(n,r,mod): tmp = 1 for i in range(1,r+1): tmp = tmp * (n-i+1) % mod tmp = tmp * pow(i,mod-2,mod) % mod return tmp % mod mod = 10**9+7 ans = pow(2,n,mod) - 1 print((ans-modComb(n,a,mod)-modComb(n,b,mod)) % mod)
p02677
s631927565
Wrong Answer
import numpy as np import sys readline = sys.stdin.buffer.readline a, b, h, m= list(map(int,readline().rstrip().split())) th = (5*h-m)/30 if th > 1: th = 1-th print(np.sqrt(float(a**2)+float(b**2)-2*a*b*np.cos(np.pi*th)))
p03150
s446461676
Accepted
s=input() n=len(s) for i in range(n): for j in range(n): if 'keyence'==s[:i]+s[i+j:]:print("YES");exit() print("NO")
p02658
s768541112
Wrong Answer
#2問目 MAX = 10 ** 18 N = int(input()) A = list(map(int, input().split())) result = 1 if 0 in A: result = 0 else: for i in range(N): result *= A[i] if i+1 < N and result >= 5e+17: result = -1 break if result > MAX: result = -1 break print(result)
p02973
s968884282
Accepted
#!/usr/bin/env python3 import sys from bisect import bisect_right INF = float("inf") def main(): N = int(input()) A = [int(input()) for _ in range(N)] dp = [INF]*N for i in range(N): j = bisect_right(dp, -A[i]) dp[j] = -A[i] print(sum([1 for d in dp if d < INF])) # print(dp) if __name__ == '__main__': main()
p03419
s057168150
Wrong Answer
N,M = map(int,input().split()) n = min(N,M) m = max(N,M) if n*m == 1: print(1) if n == 1: print(m-2) exit() print((n-2)*(m-2))
p03041
s428209908
Wrong Answer
N, K = map(int, input().split()) S = list(input()) if S[K-1] == 'A': S[K-1] = 'a' elif S[K-1] == 'B': S[K-1] = 'b' else: S[K-1] = 'c' print(S)
p03206
s590359214
Accepted
D = int(input()) print("Christmas" + " Eve" * (25 - D) )
p03672
s320855789
Accepted
s = input() ans = 0 l = len(s) while True: s = s[:l-2] l -= 2 if s[:l//2] == s[l//2:]: ans = l break print(ans)
p02835
s274869594
Wrong Answer
if sum(list(map(int,input().split())))>=22: print("win") else: print("burst")
p03994
s117206102
Accepted
S = input().strip() K = int(input()) ans = "" for i, s in enumerate(S): if i == len(S) - 1: if ord(s) + K <= ord("z"): ans += chr(ord(s) + K) else: ans += chr(ord("a") + (ord(s) + K - ord("z") - 1) % 26) elif s == "a": ans += "a" continue elif ord("z") + 1 - ord(s) <= K: ans += "a" K -= (ord("z") + 1 - ord(s)) else: ans += s print(ans)
p03860
s852356825
Accepted
a,b,c=map(str, input().split()) #複数数値入力 「A B」みたいなスペース空いた入力のとき print('A'+b[0]+'C')
p03698
s864727977
Wrong Answer
S = list(input()) sum = len(S) S.sort() suma = 1 for i in range(sum-1) : if S[i] != S[i+1] : suma +=1 if sum == suma : print("yes") else : print("No")
p02993
s567386500
Accepted
S = input() if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]: print("Bad") else: print("Good")
p03239
s244401094
Accepted
N, T = map(int,input().split()) MIN = 10 ** 8 for _ in range(N): c, t = map(int,input().split()) if t <= T: MIN = min(MIN, c) if MIN == 10 ** 8: print('TLE') else: print(MIN)
p03720
s129045001
Wrong Answer
n,m = [int(i) for i in input().split()] ab = [] for i in range(m): ay = list(map(int,input().split())) ab.append(ay) ans = [] for i in range(n): ans.append(0) for i in range(m): for j in range(1,n+1): #print(i,j) if j in ab[i]: ans[j-1] += 1 print(ans)
p03407
s959815114
Accepted
a, b, c = map(int, input().split()) if a + b >= c: print("Yes") else: print("No")
p03817
s647446903
Accepted
x=int(input()) c=2*((x-1)//11) #print(c) y=x-11*c//2 #print(y) if y<=6: ans=c+1 else: ans=c+2 print(ans)
p03485
s031792357
Wrong Answer
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) a, b = mapint() print(-round(-(a+b)/2))
p03243
s333632005
Accepted
n=int(input()) print((n//100+(1 if (n//100)*111<n else 0))*111)
p03351
s547469357
Wrong Answer
data = input() dataa,datab,datac,datad = data.split(' ') dataa = int(dataa) datab = int(datab) datac = int(datac) datad = int(datad) length1 = dataa - datab length2 = datab - datac length3 = dataa - datac datadd = datad * -1 if length1 <= datad: print('Yes') elif length2 <= datad: print('Yes') elif length3 <= datad: print('Yes') else: print('No')
p03211
s489406734
Accepted
s = input() ans = float("inf") for i in range(len(s)-2): ans = min(ans, abs(753 - int(s[i:i+3]))) print(ans)
p03241
s533999793
Accepted
import sys def factors(n): a = [] x = 1 while x * x <= n : if n % x == 0: a.append(x) a.append(n//x) x += 1 return a n,m=map(int,input().split()) fac=factors(m) fac.sort() for i in range(len(fac)-1,-1,-1): if n*fac[i]<=m: print(fac[i]) sys.exit()
p02754
s502537666
Wrong Answer
import sys n, blue, red = map(int, input().split()) ball = blue + red if blue == 0: print(0) sys.exit() if n <= blue or red == 0: print(n) sys.exit() if n <= ball: print(blue) sys.exit() ans = n // ball additional = n % ball if additional == 0: print(ans * blue) #elif additional <= blue: # print(ans * blue + additional) else: print(ans * blue + additional)
p03723
s394468871
Wrong Answer
A, B, C = list(map(int, input().split())) if A == B == C: print(-1) exit() ans = 0 while True: if A % 2 == 0 and B % 2 == 0 and C % 2 == 0: ans += 1 A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2 else: break print(ans)
p02712
s545361784
Wrong Answer
K=int(input()) fiz=[0] for i in range(K): if i%3==0 or i%5==0: k=1 else: fiz.append(i) print(sum(fiz))