problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02571
s928249086
Accepted
def comp(a,b): s = 0 for i,j in zip(a,b): if not i == j: s += 1 return s s = input() t = input() ans = len(t) for i in range(len(s) - len(t) + 1): score = comp(s[i:i+len(t)],t) if score == 0: ans = score break if ans > score: ans = score print(ans)
p03795
s144947071
Accepted
n = int(input()) print(n*800-n//15*200)
p02646
s063017968
Wrong Answer
A, V = map(int, input().split()) B, W = map(int, input().split()) T = int(input()) dist = abs(A-B) v = abs(W-V) if T * v >= dist: print("YES") else: print("NO")
p02918
s839804674
Accepted
n, k = map(int, input().split()) s = input() point = 0 tmp = 'N' for i in s: if i == tmp: point += 1 tmp = i rl = s.count('RL') lr = s.count('LR') print(point + min(2 * k, rl + lr))
p03455
s742487530
Accepted
a, b = map(int, input().split()) print("Odd" if a * b % 2 == 1 else "Even")
p02726
s300066651
Accepted
n,x,y = map(int,input().split()) x = x-1 y = y-1 count_dict = {i : 0 for i in range(0, n)} for i in range(n): for k in range(n): key = min(abs(i-k), abs(i-x)+abs(k-y) + 1, abs(i-y) +abs(k-x) + 1) count_dict[key] += 1 for i in range(1, n): print(count_dict[i] //2)
p03951
s000301078
Accepted
N = int(input()) s = input() t = input() ans = N*2 for n in range(N): if s[n:] == t[:N-n]: ans -= len(s[n:]) break print(ans)
p02988
s999928700
Wrong Answer
n = int(input()) p = list(map(int,input().split())) count=0 if n == 3: if p[0] < p[1] < p[2]: count+=1 else: for i in range(n-2): pp = p[0+i:3+i] if pp[0] < pp[1] < pp[2]: count+=1 print(count)
p03208
s054660379
Wrong Answer
n,k=map(int,input().split()) h=[int(input()) for i in range(n)] h.sort() print(h) ans=10**5 for i in range(n-k+1): print(h[i+k-1],h[i]) ans=min(ans,h[i+k-1]-h[i]) if ans==0:break print(ans)
p02957
s394737197
Accepted
A, B = map(int, input().split()) if (A+B) % 2 == 0: print((A+B)//2) else: print('IMPOSSIBLE')
p02862
s455108168
Accepted
mod = 10**9 + 7 x, y = map(int, input().split()) move_count = 0 if (y + x) % 3 == 0: move_count = ((y + x) // 3) move_a = (y - move_count) % mod move_b = (x - move_count) % mod def nck(n, k): numer, denom = 1, 1 for i in range(k): numer = numer * (n - i) % mod denom = denom * (k - i) % mod return numer * pow(denom, mod-2, mod) % mod ans = nck(move_count, min(move_a, move_b)) print(ans % mod)
p03262
s198870468
Accepted
from functools import reduce from fractions import gcd N,X=map(int,input().split()) x=[abs(X-int(i)) for i in input().split()] print(reduce(gcd,x))
p03241
s525470708
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 N, M = map(int, input().split()) divisors = make_divisors(M) print(max([x for x in divisors if x <= M // N]))
p03543
s809461916
Accepted
a,b,c,d=input() if a==b==c or b==c==d: print("Yes") else: print("No")
p03803
s198591616
Accepted
A,B=map(int,input().split()) A=(A+12)%14 B=(B+12)%14 if A==B: print("Draw") elif A>B: print("Alice") else: print("Bob")
p03607
s380395003
Accepted
N = int(input()) l = [int(input()) for i in range(N)] import collections c = collections.Counter(l) ans = 0 for i in c.values(): if i % 2 != 0: ans += 1 print(ans)
p03309
s544756798
Accepted
n = int(input()) a = list(map(int, input().split())) b = [a[i] - i - 1 for i in range(n)] median = sorted(b)[n//2] res = 0 for v in b: res += abs(v - median) print(res)
p03163
s238507721
Accepted
def solve(): #start here n, W = map(int,input().split()) l = [] dp = [[0 for i in range(W+1)] for j in range(n)] for i in range(n): w, v = map(int,input().split()) for j in range(1, W+1): if(w>j): dp[i][j] = dp[i-1][j] else: dp[i][j] = max(dp[i-1][j], v+dp[i-1][j-w]) print(dp[n-1][W]) solve()
p03323
s088732802
Wrong Answer
D, N = map(int, input().split()) print(N*100**D)
p02952
s944597692
Accepted
n = int(input()) total = 0 for x in range(1,n+1): if len(str(x))%2 == 1: total += 1 print(total)
p03760
s215214800
Accepted
o = list(input()) e = list(input()) for i in range(len(e)): print(o[i], end="") print(e[i], end="") if(len(o)-len(e) == 1): print(o[-1], end="")
p02687
s487409616
Accepted
S = input() print( "ABC" if S=="ARC" else "ARC")
p03633
s007120231
Accepted
from fractions import gcd N=int(input()) T=[0]*N S=[0]*N for i in range(N): T[i]=int(input()) if N==1: print(T[0]) else: S[0]=T[0] for j in range(1,N): a=S[j-1]*T[j] S[j]=a//gcd(S[j-1],T[j]) print(S[-1])
p02777
s775783684
Wrong Answer
s,t = map(str,input().split()) a,b = map(int,input().split()) u = str(input()) x = a-1,b y = a,b-1 if s==u: print(x) else: print(y)
p02911
s027979934
Accepted
n,k,q = map(int, input().split()) a = [0]*n for i in range(q): c = int(input()) a[c-1] += 1 for i in range(n): print("Yes" if a[i] > q-k else "No")
p03836
s438983719
Accepted
sx,sy,tx,ty=map(int,input().split()) x=tx-sx y=ty-sy ans="" for k in range(y): ans+="U" for k in range(x+1): ans+="R" for k in range(y+1): ans+="D" for k in range(x+1): ans+="L" ans+="U" ans+="L" for k in range(y+1): ans+="U" for k in range(x+1): ans+="R" for k in range(y+1): ans+="D" for k in range(x): ans+="L" print(ans)
p02570
s239437418
Wrong Answer
AllInput = input("Enter Distance,Time Taken and Speed Separated by Space") D,T,S= map(int,AllInput.split()) if (S*T) <= D: print("Yes") else: print("No")
p02712
s914798335
Accepted
N = int(input()) s = 0 for n in range(1, N + 1): if n % 3 == 0: continue if n % 5 == 0: continue s = s + n print(s)
p02720
s358321266
Wrong Answer
K = int(input()) import queue q = queue.Queue() for i in range(1,10): q.put(i) for i in range(K-1): num = q.get() if num%10!=0: q.put(10*num+(num%10)-1) q.put(num*10) if num%10!=9: q.put(10*num+(num%10)+1) print(q.get())
p03962
s061793513
Accepted
a = sorted(list(map(int, input().split()))) if a[0]==a[1]==a[2]:print(1) elif a[0]==a[1] or a[1]==a[2]:print(2) else :print(3)
p03673
s810120967
Accepted
n=int(input()) a=list(map(int,input().split())) b0=[] b1=[] for i in range(n): if i%2==0: b0.append(a[i]) else: b1.append(a[i]) if n%2!=0: b0=list(reversed(b0)) b=b0+b1 print(' '.join(map(str, b))) else: b1=list(reversed(b1)) b=b1+b0 print(' '.join(map(str, b)))
p02823
s376160845
Wrong Answer
n, a, b = map(int, input().split()) ans = min(n-b, n-a) if (b-a)%2: print(ans) else: print(min(ans, (b-a)//2))
p02583
s085183713
Accepted
n = int(input()) ls = list(map(int,input().split())) ls.sort() ans = 0 for i in range(n-2): for j in range(i+1,n-1): for k in range(j+1,n): if (ls[i]+ls[j] > ls[k]) and ls[i]!=ls[j] and ls[i]!=ls[k] and ls[k]!=ls[j] : ans += 1 print(ans)
p02601
s066300023
Wrong Answer
a,b,c=map(int,input().split()) k=int(input()) i=0 while a>=b: b*=2 i+=1 while b>=c: c*=2 i+=1 if a<b and b<c: print("Yse") else: print("No")
p03625
s094344061
Accepted
from collections import Counter n = int(input()) A = list(map(int, input().split())) cnt_A = Counter(A) A_ = sorted([[k, v] for k, v in cnt_A.items() if v >= 2], reverse=True) if len(A_) == 0: print(0) elif A_[0][1] >= 4: print(A_[0][0] ** 2) else: print(A_[0][0] * A_[1][0])
p03544
s326027048
Accepted
N = int(input()) L = [2, 1] for i in range(2, N+1): L.append(L[i-2] + L[i-1]) print(L[-1])
p02621
s274071142
Accepted
a = int(input()) print(a + a**2 + a**3)
p02796
s452929458
Wrong Answer
n = int(input()) x = [list(map(int, list(input().split()))) for i in range(n)] x.sort() ans = n i = 0 while i != len(x) - 1: maxs = x[i][0] + x[i][1] ming = x[i + 1][0] - x[i + 1][1] if maxs > ming: del x[i + 1] ans -= 1 i -= 1 i += 1 print(ans)
p03012
s735685574
Accepted
N = int(input()) W = list(map(int,input().split())) ans = 100 for i in range(1,N): S1 = sum(W[:i]) S2 = sum(W)-S1 if abs(S1-S2) < ans: ans = abs(S1-S2) print(ans)
p02802
s713821117
Accepted
N, M = map(int, input().split()) ac = [False] * N wa = [0] * N for _ in range(M): p, S = input().split() p = int(p) - 1 if S == 'AC': ac[p] = True else: if not ac[p]: wa[p] += 1 a = 0 b = 0 for i in range(N): if ac[i]: a += 1 b += wa[i] print(*[a, b])
p03475
s669238573
Accepted
n=int(input()) csf=[list(map(int,input().split())) for i in range(n-1)] c=[csf[i][0] for i in range(n-1)] s=[csf[i][1] for i in range(n-1)] f=[csf[i][2] for i in range(n-1)] for i in range(n-1): now=s[i]+c[i] for j in range(i+1,n-1): if now<=s[j]: now=s[j]+c[j] else: while (now-s[j])%f[j]!=0: now+=1 now+=c[j] print(now) print(0)
p02756
s065645898
Wrong Answer
from collections import deque S = deque(input().strip()) q = int(input()) rev = True for _ in enumerate(range(q)): query = input().split() if query[0] == '1': rev = not rev else: if (query[1] == '1') ^ rev: S.appendleft(query[2]) else: S.append(query[2]) S = S if not rev else reversed(S) print(*S, sep='')
p03345
s914811572
Accepted
a,b,c,k=map(int,input().split()) if abs(a-b)<10**18: if k%2==0: print(a-b) else: print(b-a) else: print("Unfair")
p02789
s793874828
Wrong Answer
str1, str2 = [s for s in input().split()] a = str1*int(str2) b = str2*int(str1) sort = [a, b] sorted(sort) print(sort[0])
p03449
s519653860
Accepted
n = int(input()) a1 = list(map(int, input().split())) a2 = list(map(int, input().split())) res = 0 tmp1 = 0 for i in range(n): tmp1 += a1[i] tmp2 = 0 for j in range(i, n): tmp2 += a2[j] res = max(res, tmp1+tmp2) print(res)
p02783
s607889995
Accepted
import math a,b = map(int , input().split()) num = a/b print(math.ceil(num))
p03814
s259184726
Wrong Answer
s = str(input()) start = 0 end = 0 for i in range(len(s)): if s[i]=='A' and start==0: start = i if s[-(i+1)]=='Z' and end==0: end = len(s)-i print(end-start)
p02729
s252046056
Wrong Answer
def tmp(n): return n * (n - 1) / 2 def main(): line = input().strip() n, m = [int(v) for v in line.split(' ')] ans_n = tmp(n) if n > 1 else 0 ans_m = tmp(m) if m > 1 else 0 ans = ans_n + ans_m print(ans) if __name__ == '__main__': main()
p03854
s163713365
Accepted
s = str(input()) alist = ["dream", "dreamer", "erase", "eraser"] ans = False def backwards(x): return x[::-1] s = backwards(s) alist = [backwards(i) for i in alist] t = "" start = 0 for i in range(len(s)+1): if s[start:i] in alist: t+=s[start:i] start = i if s==t: print("YES") else: print("NO")
p02768
s281227956
Accepted
def nck(n, k, mod): result = 1 for i in range(n - k + 1, n + 1): result = result * i % mod tmp = 1 for i in range(1, k + 1): tmp = tmp * i % mod return result * pow(tmp, mod - 2, mod) % mod def main(): n, a, b = map(int, input().split()) mod = 10 ** 9 + 7 print((pow(2, n, mod) - nck(n, a, mod) - nck(n, b, mod) - 1) % mod) if __name__ == '__main__': main()
p03252
s005423431
Accepted
S = input() T = input() alp = "abcdefghijklmnopqrstuvwxyz" d = {s: None for s in alp} e = {s: None for s in alp} for s, t in zip(S, T): if d[t] is None: d[t] = s elif d[t] != s: print("No") exit() if e[s] is None: e[s] = t elif e[s] != t: print("No") exit() print("Yes")
p02765
s012409288
Accepted
n, r = map(int, input().split()) print(r if n >= 10 else 100 * (10 - n) + r)
p02699
s716221438
Wrong Answer
s,w=input().split() if s<=w: print("unsafe") else: print("safe")
p02833
s675461171
Accepted
n=int(input()) ans=0 if n%2==0: st=10 d=1 while st<=n: ans+=(n//st) st*=5 print(ans) else: print(ans)
p03013
s745560785
Accepted
MOD = 1000000007 # f(x) = f(x - 1) + f(x - 2)の場合のdp def f_dp(x, a): dp = [0] * (x + 1) dp[0] = 1 if 1 not in a: dp[1] = 1 for i in range(2, x + 1): if i not in a: dp[i] = dp[i - 1] + dp[i -2] return dp[n] % MOD if __name__ == "__main__": n, m = map(int, input().split()) a = set([int(input()) for i in range(m)]) dp = f_dp(n, a) print(dp)
p02657
s795884331
Accepted
A, B = map(int,input().split()) print(A * B)
p03835
s763815200
Wrong Answer
k, s = map(int, input().split()) c = int(s / 3) ans = (k - c) if ans == 0: print(1) else: print(ans*3)
p03796
s784346440
Accepted
import math print(math.factorial(int(input()))%(10**9+7))
p03487
s339954517
Accepted
#!/usr/bin/env python n = int(input()) a = list(map(int, input().split())) d = {} cnt = 0 for i in range(n): if a[i] not in d: d[a[i]] = 1 else: d[a[i]] += 1 for key in d.keys(): if d[key] != key: if d[key] < key: cnt += d[key] else: cnt += d[key]-key print(cnt)
p02793
s852861822
Wrong Answer
n = int(input()) arr = list(map(int,input().split())) N = pow(10,9)+7 def gcd(a,b): if a>b:return gcd(b,a) while b!=0: nb = b%a a = b b = nb return a def lcm(a,b): tmp = (a*b)//gcd(a,b) return tmp hcm = arr[0] for i in range(1,n): hcm = lcm(hcm,arr[i]) res = 0 for num in arr: res += (hcm//num) print(res)
p04011
s752269527
Accepted
N = int(input()) K = int(input()) X = int(input()) Y = int(input()) print(int(min(K,N)*X+max((N-K),0)*Y))
p02665
s652201771
Wrong Answer
N=int(input()) A=list(map(int,input().split())) ans=0 f=[1]*(N+1) las=A[N] g=[las]*(N+1) flag=1 for i in range(0,N): f[i+1]=2*(f[i]-A[i]) for i in range(N,0,-1): g[i-1]=g[i]+A[i-1] print(f,g) for i in range(N+1): if min(f[i],g[i])<=0: flag=0 break ans=ans+min(f[i],g[i]) if g[N]>f[N]: flag=0 if flag==0: print(-1) else: print(ans)
p04005
s372838131
Accepted
l = sorted(list(map(int, input().split()))) print(((l[2]+1)//2-l[2]//2)*l[0]*l[1])
p03001
s581824609
Wrong Answer
W,H,x,y = map(int,input().split()) flag = 1 if x==y else 0 print(str(W*H/2) + " " + str(flag))
p03037
s888120209
Accepted
n,m = map(int,input().split()) lm,rm = map(int,input().split()) for i in range(m-1): l,r = map(int,input().split()) lm = max(lm,l) rm = min(rm,r) print(max(rm-lm+1,0))
p02842
s104210603
Accepted
import sys import math import numpy as np input = sys.stdin.readline N = int(input()) X = math.ceil(N / 1.08) if math.floor(X * 1.08) == N: print(X) else: print(':(')
p03345
s896619448
Accepted
A,B,C,K = list(map(int, input().split())) if K%2==0: print(A-B) else: print(B-A)
p04034
s073761399
Accepted
n,m=map(int,input().split()) l=[] for _ in range(m): l.append(list(map(int,input().split()))) a=[0]*(n+1) a[1]=1 c=[1]*(n+1) for i in range(m): c[l[i][0]]-=1 c[l[i][1]]+=1 if a[l[i][0]]: a[l[i][1]]=1 if c[l[i][0]]==0: a[l[i][0]]=0 print(a.count(1))
p02939
s920687733
Accepted
s = input() n = len(s) i = 0 ans = 1 pre = None while i < n-1: if pre is None: pre = s[i] if pre == s[i+1]: pre = s[i+1:i+3] i += 2 else: pre = s[i+1:i+2] i += 1 if i < n: ans += 1 print(ans)
p02771
s226625987
Accepted
A, B, C = list(map(int, input().split())) if len(set([A, B, C])) == 2: print('Yes') else: print('No')
p02748
s552235692
Wrong Answer
A, B, M = map(int, input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) X = 0 Y = 0 C = 0 Min = min(a) + min(b) for _ in range(M): x, y, c = map(int, input().split()) if c > C and (a[x-1]+b[y-1]) - c > 0: X = x - 1 Y = y - 1 C = c res = (a[X] + b[Y]) - C if Min < res: print(Min) exit() print(res)
p03077
s262127826
Wrong Answer
N = int(input()) T = [int(input()) for _ in range(5)] dp = [5,0,0,0,0,0] ans = 0 while dp[-1]<5: for i in range(4,-1,-1): if dp[i]>0: if dp[i]>=T[i]: dp[i] -= T[i] dp[i+1] += T[i] else: dp[i+1] += dp[i] dp[i] = 0 ans +=1 print(ans)
p03997
s767149770
Accepted
a=int(input()) b=int(input()) h=int(input()) k=(a+b)*h//2 print(k)
p02595
s792313031
Accepted
import math num, dist = map(int, input().split()) count = 0 for i in range(0,num): x, y = map(int, input().split()) distance = math.sqrt(x**2 + y**2) if distance <= dist: count += 1 print(count)
p03799
s677354441
Wrong Answer
n, m = map(int, input().split()) x = (m-2*n)//4 print(min(n+x, (m-2*x)//2))
p03250
s138427610
Accepted
a,b,c=sorted(map(int,input().split())) print(c*10 + a + b)
p03797
s580295194
Accepted
n,m = map(int,input().split()) m = m//2 if n >= m: print(m) else: print(n+(m-n)//2)
p02725
s474832765
Wrong Answer
k, n = map(int,input().split()) a = list(map(int,input().split())) a.append(k) ans = 0 max_dis = 0 for i in range(n): dis = a[i+1] - a[i] max_dis = max(max_dis,dis) ans += dis ans -= max_dis print(ans)
p03719
s897671506
Accepted
a,b,c=map(int,input().split()) if a<=c<=b: print("Yes") else: print("No")
p03795
s261067611
Wrong Answer
N = int(input()) print((N*800)-((N//15)*20))
p03385
s351578998
Accepted
S = input() print("Yes" if len(set(S))==3 else "No")
p03696
s744775340
Accepted
n = int(input()) s = input() r_cnt, l_cnt = 0, 0 for i in range(n): if s[i] == "(": r_cnt += 1 else: if r_cnt == 0: l_cnt += 1 else: r_cnt -= 1 print(l_cnt * "(" + s + r_cnt * ")")
p02584
s259518743
Accepted
import math x, k, d = map(int,input().split()) x = abs(x) if x > k * d: print(x - k * d) else: time = math.floor(x/d) x -= time * d k -= time if k % 2 == 0: print(x) else: print(d - x)
p02789
s776768490
Accepted
n,m = map(int,input().split()) print('Yes' if n == m else 'No')
p02900
s557938870
Accepted
from fractions import gcd from collections import Counter a,b=map(int,input().split()) g=gcd(a,b) L=[] for i in range(2,int(g**0.5)+1): while g%i==0: g//=i L.append(i) if L==[]: L.append(g) else: if g!=1: L.append(g) LC=Counter(L) r=len(LC) if 1 not in LC.keys(): r+=1 print(r)
p03632
s555132225
Accepted
A,B,C,D = map (int, input ().split ()) if A < C: X = C else: X = A if B < D: Y = B else: Y = D if Y-X < 0: print (0) else: print (Y-X)
p02861
s475448577
Wrong Answer
import itertools import math n=int(input()) X=[list(map(int,input().split())) for _ in range(n)] P=[i for i in range(n)] total=0 for j in itertools.permutations(P,n): candi=list(j) for k in range(len(candi)-1): dis1=(X[candi[k]][0]-X[candi[k+1]][0])**2 dis2=(X[candi[k]][1]-X[candi[k+1]][1])**2 total+=(dis1+dis2)**(1/2) print(candi,total) print(total/math.factorial(n))
p02556
s630053509
Accepted
n = int(input()) pp = [] pm = [] mp = [] mm = [] for i in range(n): x, y = list(map(int, input().split())) pp.append(x + y) pm.append(x - y) mp.append(-x + y) mm.append(-x - y) max_pp = max(pp) min_pp = min(pp) max_pm = max(pm) min_pm = min(pm) max_mp = max(mp) min_mp = min(mp) max_mm = max(pm) min_mm = min(pm) max_val = max(max_pp - min_pp, max_pm - min_pm, max_mp - min_mp, max_mm - min_mm) print(max_val)
p03206
s492580315
Accepted
d=int(input()) print('Christmas' if d==25 else 'Christmas Eve' if d==24 else 'Christmas Eve Eve' if d==23 else 'Christmas Eve Eve Eve')
p02744
s626637059
Wrong Answer
import sys import time sys.setrecursionlimit(10 ** 6) input = sys.stdin.readline N = int(input()) groups = [] def dfs(s, n): if n == N: print(s) return True # for ns in 'abcdefghijklmnopqrstuvwxyz'[:n+1]: for i, ns in enumerate('abcdefghij'[:n+1]): dfs(s+ns, max(i, n+1)) dfs('', 0)
p02787
s657167199
Accepted
import sys input = sys.stdin.readline H, N = map(int, input().split()) AB = [tuple(map(int, input().split())) for _ in range(N)] dp = [10**18]*(H+1) dp[0] = 0 for i in range(H): for A, B in AB: j = min(H, i+A) dp[j] = min(dp[j], dp[i]+B) print(dp[H])
p02881
s555115649
Accepted
n=int(input()) ans=n-1 for i in range(2,int(n**0.5)*2): if n % i == 0: tmp=i+n//i-2 ans=min(ans,tmp) print(ans)
p02621
s743542768
Accepted
a = int(input()) ans = a + a**2 + a**3 print(ans)
p02792
s739116331
Accepted
N = int(input()) num = [[0] * 10 for i in range(10)] for i in range(1, N+1): top = int(str(i)[0]) end = int(str(i)[-1]) num[top][end] += 1 count = 0 for i in range(10): for j in range(10): count += num[i][j] * num[j][i] print(count)
p03803
s034444381
Accepted
A, B = map(int, input().split()) if (A-2)%13 > (B-2)%13: print('Alice') elif (A-2)%13 < (B-2)%13: print('Bob') else: print('Draw')
p03696
s367231322
Wrong Answer
import math import itertools import statistics #import collections n = int(input()) s = input() amari = 0 plus = 0 for i in range(n): if s[i]==")": plus += 1 else: if plus <= 0: amari +=1 else: plus -= 1 for i in range(plus): print("(", end="") print(s, end="") for i in range(amari): print(")", end="")
p02695
s136014010
Accepted
N,M,Q=map(int,input().split()) L=[] for i in range(Q): L.append(list(map(int,input().split()))) L[i][0]-=1 L[i][1]-=1 #print(L) import itertools R=list(range(1,M+1))#ここで変数Lを使っていた A=list(itertools.combinations_with_replacement(R,N)) ans=0 #print(L)変数を上書きしていた!!!!! for i in A: tmp=0 for a,b,c,d in L: if (i[b]-i[a])==c: tmp+=d ans=max(ans,tmp) print(ans)
p02696
s542068010
Wrong Answer
import math A, B, N = map(int, input().split()) max_result = -10 ** 12 N = min(N, 10 ** 8) for x in range(0, N+1): tmp = math.floor(A * x / B) - (A * math.floor(x / B)) max_result = max(max_result, tmp) print(max_result)
p03251
s138793158
Accepted
N, M, X, Y = map(int, input().split()) x_list = list(map(int, input().split())) y_list = list(map(int, input().split())) is_war = True import numpy as np for Z in range(X+1, Y+1): if np.all(np.array(x_list) < Z) and np.all(np.array(y_list) >= Z): is_war = False break if is_war: print("War") else: print("No War")
p02731
s444094821
Accepted
L = int(input()) ans = (L / 3) * (L / 3) * (L / 3) print(ans)