problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02597
s718302120
Accepted
n=input() i=list(input()) Wn=i.count("W") print(Wn-i[(len(i)-Wn):].count("W"))
p03486
s573777506
Accepted
s = input() t = input() s = sorted(s) t = sorted(t, reverse=True) if s < t: print("Yes") else: print("No")
p03797
s434872193
Wrong Answer
N,M = [int(i) for i in input().split()] count = 0 if 2 * N <= M: count = N M -= 2 * N if M >= 4: count += M // 4 print(count) else: print(count) else: if N != 0: while N == 0 or M <= 1: count += 1 N -= 1 M -= 2 print(count) else: print(count)
p03417
s758530687
Accepted
N, M = map(int, input().split()) if N == 1 and M == 1: print(1) elif N == 1 or M == 1: print(N*M-2) else: print((N-2) * (M-2))
p02811
s034606356
Accepted
K,X=map(int,input().split()) if K*500>=X: print('Yes') else: print('No')
p02622
s068657029
Accepted
s = input() t = input() counter = 0 for i in range(len(s)): if not s[i] == t[i]: counter += 1 print(counter)
p03076
s991087438
Accepted
A=int(input()) B=int(input()) C=int(input()) D=int(input()) E=int(input()) count=0 lis=[[A,((A%10)-1)%10],[B,((B%10)-1)%10],[C,((C%10)-1)%10],[D,((D%10)-1)%10],[E,((E%10)-1)%10]] lis.sort(key=lambda x:x[1], reverse=True) #print(lis) for i in range(len(lis)): if not(i==len(lis)-1): count=count+lis[i][0]+(10-(lis[i][0])%10)%10 else: count=count+lis[i][0] print(count)
p03759
s954449377
Accepted
a, b, c = map(int, input().split()) if b-a == c-b: print("YES") else: print("NO")
p02699
s317416492
Accepted
s, w = map(int, input().split()) if s <= w: print('unsafe') else: print('safe')
p04020
s281086061
Wrong Answer
R = list() L = list() N = int(input()) R.append(0) for i in range(N): k = int(input()) L.append(k) if k == 0: R.append(len(L)) S = sum(L) R.append(S) for i in range(len(R) - 1): if sum(L[R[i] + 1 : R[i + 1]]) % 2 == 1: S = S - 1 print(S // 2)
p03274
s438934171
Accepted
n,k,*a=map(int,open(0).read().split());print(min(r-l+min(abs(r),abs(l))for l,r in zip(a,a[k-1:])))
p03557
s418623690
Wrong Answer
import bisect n = int(input()) x = sorted(list(map(int,input().split())), reverse=True) y = sorted(list(map(int,input().split())), reverse=True) z = sorted(list(map(int,input().split())), reverse=True) count = 0 for a in range(n): j = bisect.bisect_right(y,z[a]) for b in range(j,n-1): k = bisect.bisect_right(x,y[b]) count+=(n-k) print(count)
p02918
s144579443
Accepted
n, k = map(int, input().split()) s = input() score = 0 paired = 0 for i in range(1, n): if s[i - 1] == s[i]: score += 1 if s[i - 1] == s[0] and s[i] != s[0]: paired += 1 if k < paired: print(score + 2 * k) else: print(n - 1)
p02917
s906461815
Accepted
n = int(input()) B = list(map(int, input().split())) ans = 0 for i in range(n): if i == 0: ans += B[0] elif i == n - 1: ans += B[n - 2] else: ans += min(B[i - 1], B[i]) print(ans)
p02661
s803570028
Accepted
N=int(input()) A=[] B=[] for i in range(N): a,b=map(int,input().split()) A.append(a) B.append(b) A.sort() B.sort() if N%2==0: al=A[(N-1)//2] ar=A[N//2] bl=B[(N-1)//2] br=B[N//2] print(int(((br+bl)/2-(ar+al)/2)*2+1)) else: mini=A[(N-1)//2] maxi=B[(N-1)//2] print(maxi-mini+1)
p03160
s823498019
Accepted
n = int(input()) h = list(map(int, input().split())) dp = [0 for _ in range(n)] dp[1] = abs(h[0] - h[1]) for i in range(2, n): dp[i] = min( dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1])) print(dp[-1])
p02765
s076050705
Accepted
n,r=map(int,input().split()) if n>=10: print(r) else: print(r+100*(10-n))
p03289
s852508318
Wrong Answer
s=input() ans='AC' if s[0]!='A': ans='WA' elif s[2:-1].count('C')!=1: ans='WA' if ans=='AC': s=s[1:] s=s[1:-1].replace('C','')+s[-1] if s.islower==False: ans='WA' print(ans)
p02836
s057727169
Wrong Answer
S = input() result = 0 for i in range(int(len(S) / 2)): if S[i] != S[-i]: result += 1 print(result)
p03136
s368331605
Wrong Answer
N = int(input()) L = list(map(int, input().split())) L.sort(reverse=True) if max(L) > (sum(L)-max(L)): print('Yes') else: print('No')
p03254
s989084861
Wrong Answer
import math # For taking integer inputs. def inp(): return(int(input())) # For taking List inputs. def inlist(): return(list(map(int, input().split()))) # For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable. def instr(): s = input() return(list(s[:len(s)])) # For taking space seperated integer variable inputs. def invr(): return(map(int, input().split())) N, x = invr() a = inlist() a = sorted(a) c = 0 for i in a: if i <= x: c += 1 x -= i if x > 0 and c > 0: c -= 1 print(c)
p02687
s860017131
Accepted
S=input() if S=='ARC': print('ABC') else: print('ARC')
p02778
s548925254
Wrong Answer
string=input() for s in string: s='x' print(string)
p03986
s063977815
Accepted
def main(X): cntS = 0; cntT = 0 for x in X: if x == 'T' and cntS == 0: cntT += 1 elif x == 'S': cntS += 1 elif x == 'T' and cntS > 0: cntS -= 1 else: pass return cntS + cntT if __name__ == "__main__": X = list(input()) ans = main(X) print(ans)
p02645
s177657474
Wrong Answer
x= input() print(x[:2])
p02547
s145852240
Accepted
n = int(input()) flag = 0 flagg = 1 for _ in range(n): a, b = map(int, input().split()) if flagg: if a==b: flag+=1 else: flag = 0 if flag==3: print('Yes') flagg = 0 if flag<3: print('No')
p02744
s126783935
Wrong Answer
N = int(input()) words = [chr(ord('a')+i) for i in range(10)] dp = [''] for i in range(1, N+1): ndp = [] for w in dp: for k in range(i): ndp.append(w+words[k]) dp = ndp for l in dp: print(l)
p03038
s043252589
Accepted
n,m=map(int,input().split()) l=list(map(int,input().split())) d=dict() for i in range(m): a,b=map(int,input().split()) if b in d: d[b]+=a else: d[b]=a x=sorted(d.keys())[::-1] now=0 for y in x: now+=d[y] l+=[y]*min(n,d[y]) if now>n: break print(sum(sorted(l)[::-1][:n]))
p03760
s327553221
Wrong Answer
o = input() e = input() p = "" for o, e in zip(o, e): p = p + o + e print(p if len(o) == len(e) else p + o[-1])
p03495
s310859751
Wrong Answer
import heapq n,k = map(int,input().split()) a = list(map(int,input().split())) r = [0 for _ in range(max(a)+1)] if len(set(a)) <= 2: print(0) exit() for i in range(n): r[a[i]] += 1 r = list(map(lambda x:-x,r)) heapq.heapify(r) print(n+(r[0]+r[1]))
p03210
s955398843
Wrong Answer
X = int(input()) if X == 3 or X == 5 or X == 7: print("Yes") else: print("No")
p02691
s025107527
Wrong Answer
import bisect N = int(input()) A = [0] A += list(map(int, input().split())) cnt = 0 L = [- 10 ** 6] R = [- 10 ** 6] for i in range(1, N + 1): L.append(i + A[i]) R.append(i - A[i]) L.sort() print(L) print(R) for j in range(1, N + 1): x = bisect.bisect_left(L, R[j]) while R[j] == L[x]: cnt += 1 x += 1 print(cnt)
p03437
s243574713
Accepted
x,y=map(int,input().split()) if x%y==0: print(-1) else: print(x*(y-1))
p03721
s189994110
Accepted
N,K=map(int,input().split()) l=[list(map(int,input().split()))for i in range(N)] l.sort(key=lambda x: x[0]) ans=0 for i in l: if K==0: break K-=min(K,i[1]) ans=i[0] print(ans)
p03723
s124899924
Accepted
A, B, C = map(int, input().split()) if A == B == C: print(0 if A%2 else -1) else: cnt = 0 while A%2==0 and B%2==0 and C%2==0: A, B, C = (B+C)//2, (C+A)//2, (A+B)//2 cnt += 1 print(cnt)
p02615
s607623160
Accepted
n=int(input()) a=[int(i) for i in input().split()] a.sort(reverse=True) #rint(sum(a[:-1])) c=0 for i in range(n): if i == 0: c+=0 elif i == 1: c+=a[0] else: c+=a[i//2] print(c)
p03339
s934083780
Accepted
n = int(input()) s = input() work = s[1:].count("E") temp = [work] leader = s[0] for c in s[1:]: if leader == "W": work += 1 if c == "E": work -= 1 temp.append(work) leader = c print(min(temp))
p03673
s661508680
Accepted
n=int(input()) a=list(input().split()) if n%2==0: b=a[::2] a.pop(0) c=a[::2] c.reverse() print(' '.join(c+b)) else: b=a[::2] a.pop(0) c=a[::2] b.reverse() print(' '.join(b+c))
p03250
s566542355
Accepted
A, B, C = map(int, input().split()) x = A * 10 + B + C y = A + 10 * B + C z = A + B + 10 * C print(max(x, y, z))
p02556
s293583458
Accepted
#!/usr/bin/env python n = int(input()) x_plus_y = [0 for _ in range(n)] x_minus_y = [0 for _ in range(n)] for i in range(n): x, y = map(int, input().split()) x_plus_y[i] = x+y x_minus_y[i] = x-y ans = max(max(x_plus_y)-min(x_plus_y), max(x_minus_y)-min(x_minus_y)) print(ans)
p03163
s570076151
Wrong Answer
n,w=map(int,input().split()) dp=[-1]*(w+1) dp[0]=0 for _ in range(n): a,d=map(int,input().split()) for b in range(w,a-1,-1): if dp[b-a]!=-1: dp[b]=max(dp[b],d+dp[b-a]) print(dp[w])
p03264
s010003111
Accepted
K = int(input()) print(K//2*(K-K//2))
p03778
s090945038
Accepted
w,a,b = map(int, input().split()) if abs(a - b) <= w: print(0) else: print(abs(a - b) - w)
p03944
s186218448
Accepted
w,h,n=map(int,input().split()) l=[list(map(int,input().split())) for _ in range(n)] a,b,c,d=0,w,0,h for x,y,A in l: if A==1: a=max(a,x) elif A==2: b=min(b,x) elif A==3: c=max(c,y) else: d=min(d,y) if b-a>=0 and d-c>=0: print((b-a)*(d-c)) else: print(0)
p02784
s347424284
Accepted
H, N= map(int, input().split()) A = list(map(int, input().split())) if sum(A) >= H: print("Yes") else : print("No")
p02796
s873044834
Accepted
N=int(input()) #S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合 S = [[0 for j in range(2)] for i in range(N)] for i in range(N): X,L=map(int,input().split()) S[i][0]=X-L S[i][1]=X+L T=sorted(S,key=lambda x:x[1]) #U=sorted(T,key=lambda x:x[1]) if N==1: print(1) exit() count=1 last=T[0][1] for i in range(1,N): if T[i][0]>=last: count+=1 last=T[i][1] print(count)
p03711
s213706133
Wrong Answer
x,y = map(int, input().split()) if x==2 or y==2: print("No") exit() if x==4 or x==6 or x==9 or x==11: if y==4 or y==6 or y==9 or y==11: print("Yes") else: print("No") else: print("No")
p03208
s053740817
Wrong Answer
n,k = map(int,input().split()) li = [] lia = [0]*(n-2) for i in range(n): li.append(int(input())) li.sort() for i in range(n-2): lia[i] += li[i+2] - li[i] print(min(lia))
p03836
s094275837
Accepted
a,b,c,d = map(int,input().split()) A = c - a B = d - b ans = '' ans +='R'*A + 'U'*B ans +='L'*A + 'D'*B ans +='L'+'U'*B+'U'+'R'*A +'R'+'D' ans +='R'+'D'*B+'D'+'L'*A +'L'+'U' print(ans) # print('UURDDLLUUURRDRDDDLLU')
p02690
s726255583
Wrong Answer
X = int(input()) for i in range(2,10**5): if i ** 5 - (i-1)**5 == X: print(i,i-1);exit() for x in range(0,150): for y in range(-150,0): if x** 5 - y ** 5 == X: print(x,y);exit()
p03469
s732029499
Accepted
# -*- coding: utf-8 -*- import sys s = input().strip() #---------- words = s.split("/") print( "/".join( ["2018"] + words[1:] ) )
p02658
s511345816
Wrong Answer
N = int(input()) A = list(map(int, input().split())) answer = 1 for i in range(N): answer = answer * A[i] if answer > 10**18: print(-1) print(answer)
p03435
s670938259
Accepted
import numpy as np a=np.array([[int(x) for x in input().split()]for y in range(3)],dtype=np.int64) #print(a) for i in range(3): for j in range(0,3): a[i][j]-=a[i][2] #print(a) for j in range(3): for i in range(1,3): if(a[i][j]!=a[0][j]): print("No") exit(0) print("Yes")
p04011
s082377235
Wrong Answer
N=int(input()) K=int(input()) X=int(input()) Y=int(input()) a=K*X b = (N - K) * Y print(a+b)
p02873
s116934842
Accepted
S=input() n=len(S) A=[0]*(n+1) for i in range(n): if(S[i]=='<'): A[i+1]=A[i]+1 for i in reversed(range(n)): if(S[i]=='>'): A[i]=max(A[i],A[i+1]+1) print(sum(A))
p02594
s355906544
Wrong Answer
x = int(input()) if x <= 30 : print('No') else : print('Yes')
p02546
s227932993
Accepted
s=input() ans=len(s)-1 if s[ans]=="s": s+="es" else: s+="s" print(s)
p02947
s395398634
Accepted
n = int(input()) s = sorted([sorted(list(input())) for _ in range(n)]) res = 0 cnt = 1 for i in range(n-1): if s[i] == s[i+1]: res += cnt cnt += 1 else: cnt = 1 print(res)
p04044
s324551135
Wrong Answer
num = input().split() str = [input()] strc = '' print(str) flg = 0 res = '' for i in range(int(num[0])-1): # print(1) strc = input() for j in range(len(str)): if str[j] < strc: print(2) flg = 0 else: print(3) flg = j break j += 1 flg = -1 if flg == 0: str.append(strc) else: str.insert(j,strc) print(str) for x in str: res += x print(res)
p03623
s103464209
Accepted
x, a, b = map(int, input().split()) if abs(x-a) > abs(x-b): print('B') else: print('A')
p03282
s864356141
Wrong Answer
import sys import itertools import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = readline().decode().strip() K = int(readline()) cnt = 0 ans = 0 for i in N: if i=='1': continue else: ans=i break print(ans)
p03427
s830462419
Wrong Answer
# 3:06 s = input() if len(s) == 1: print(s) elif s[0] == "1": print(len(s) * 9 - 9) elif s[0] == "9": print(len(s) * 9) else: print(len(s) * 9 - 9 + int(s[0]) - 1)
p02897
s565326828
Accepted
# coding: utf-8 # Your code here! N = int(input()) odd = 0 for i in range(1, N+1) : if i%2 == 1 : odd += 1 print(odd/N)
p02690
s409931305
Wrong Answer
x = int(input()) a = 1 b = 1 while True: if type((a**5 - x) ** 0.2) == complex: if ((x - a**5) ** 0.2).is_integer(): b = -int((x - a**5) ** 0.2) break a += 1 continue elif ((a**5 - x) ** 0.2).is_integer(): b = int((a**5 - x) ** 0.2) break a += 1 print('{} {}'.format(a, b))
p02767
s556936112
Accepted
n = int(input()) zyusyo = list(map(int, input().split(" "))) min_zyusho = min(zyusyo) max_zyusyo = max(zyusyo) ans = 10**9 for p in range(min_zyusho, max_zyusyo+1): sum = 0 for z in zyusyo: sum += (z-p)**2 if sum < ans: ans = sum print(ans)
p03146
s993629288
Accepted
s = int(input()) bi = [1, 2, 4, 8, 16, 32, 64] a = [s] for i in range(10000): n = a[i] if n%2 == 0: a.append(n//2) else: a.append(3*n + 1) if a[i+1] in a[:i]: print(i+2) exit() print(0)
p03377
s317396267
Accepted
def main(): a, b, x = map(int, input().split()) result = False for i in range(0, b+1): if a + i == x: result = True break if result: print('YES') else: print('NO') if __name__ == "__main__": main()
p03162
s896931918
Wrong Answer
l = int(input()) x = list(map(int,input().split())) c = max(x) for i in range(len(x)): if c == x[i]: y = i #print(y) for i in range(1,l): x = list(map(int,input().split())) #print(y) x[y] = 0 #print(x) z = max(x) c += z for k in range(len(x)): if z == x[k]: y = k break #print(z) print(c)
p03106
s577605356
Wrong Answer
""" author : halo2halo date : 16, Jan, 2020 """ import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) A, B, K = map(int, readline().split()) ans = 1 num = 1 for i in range(2, min(A, B) + 1): print(num) print(ans) if num == K: break if A % i == 0 and B % i == 0: print(ans) num += 1 ans = i print(ans)
p03524
s208406756
Accepted
s=input() x=s.count('a') y=s.count('b') z=s.count('c') a=[x,y,z] if len(s)==1: print('YES') elif len(s)==2: if s[0]==s[1]: print('NO') else: print('YES') else: if len(s)%3==0: if x==y and y==z: print('YES') else: print('NO') else: if max(a)-min(a)==1: print('YES') else: print('NO')
p03427
s229520333
Accepted
import sys import math import itertools def I():return int(sys.stdin.readline().replace("\n","")) def I2():return map(int,sys.stdin.readline().replace("\n","").split()) def S():return str(sys.stdin.readline().replace("\n","")) def L():return list(sys.stdin.readline().replace("\n","")) def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()] def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split())) n = L() n = [int(k) for k in n] if len(n) == 1: print(n[0]) else: print(max(sum(n),9*(len(n)-1)+n[0]-1))
p03449
s459856135
Accepted
n = int(input()) a = [list(map(int,input().split())) for i in range(2)] print(max([sum(a[0][:i+1])+sum(a[1][i:]) for i in range(n)]))
p02697
s049444662
Accepted
n,m=map(int,input().split()) if n%2==1: #x=["{} {}".format(i+1,n-i) for i in range(m)] x=[f"{i+1} {n-i}" for i in range(m)] print(" ".join(x)) else: #x=["{} {}".format(i+1,n-i) if i<m/2 else "{} {}".format(i+1,n-i-1) for i in range(m)] x=[f"{i+1} {n-i}" if i<m/2 else f"{i+1} {n-i-1}" for i in range(m)] print(" ".join(x))
p03627
s079401320
Accepted
from collections import Counter N = int(input()) A = list(map(int, input().split())) c = Counter(A) Ac = sorted([i for i in c.keys() if c[i] >= 2], reverse=True) if len(Ac) >= 2 and c[Ac[0]] >= 4: print(max(Ac[0] * Ac[1], Ac[0] * Ac[0])) elif len(Ac) >= 2: print(Ac[0] * Ac[1]) elif len(Ac) == 1 and c[Ac[0]] >= 4: print(Ac[0] * Ac[0]) else: print(0)
p02690
s516223555
Accepted
x=int(input()) for a in range(999): for b in range(-999,999): if a**5-b**5==x: print(a,b) exit()
p02924
s832894417
Accepted
n = int(input()) ans = (n*(n-1))//2 print(ans)
p02777
s047454392
Accepted
moji_arr = input() first = moji_arr.split()[0] second = moji_arr.split()[1] num = input() num_arr = list(map(int, num.split())) u = input() if u==first: num_arr[0] = num_arr[0] - 1 elif u==second: num_arr[1] = num_arr[1] - 1 print(num_arr[0], num_arr[1])
p03862
s482752741
Accepted
n, x = map(int, input().split()) l = list(map(int, input().split())) y = 0 if l[0] > x: w = l[0] - x y += w l[0] -= w for i in range(n-1): if l[i] + l[i+1] > x: z = l[i+1] + l[i] - x y += z l[i+1] -= z print(y)
p04031
s561923311
Wrong Answer
N = input() A = list(map(int, input().split())) num = -(-sum(A) // len(A)) cost = [(a - num)**2 for a in A] print(sum(cost))
p02818
s069297604
Accepted
a,b,k=map(int,input().split()) if k>=a+b: print("0 0") elif k>=a: print("0 {0}".format(b-(k-a))) else: print("{0} {1}".format(a-k,b))
p02624
s857810743
Wrong Answer
N = int(input()) ans = 0 for i in range(1, N + 1): ans += i * ((N // i) * ((N // i) + 1))/2 print(ans)
p02775
s153082150
Accepted
N = input() over = 1 eq = 0 for n in map(int, N): o = min(eq + n + 1, over + (10 - n) - 1) e = min(eq + n, over + (10 - n)) over = o eq = e print(eq)
p02833
s719704366
Accepted
N = int(input()) k = 10 ans = 0 if N % 2 != 0: ans = 0 else: while k <= N: ans += N // k k *= 5 print(ans)
p02664
s840042653
Accepted
T = input() s = T.replace("?","D") print(s)
p02572
s314354163
Accepted
n=int(input()) a=list(map(int,input().split())) mod=10**9+7 import numpy as np cum=[] prev=0 for i in range(n): tmp = prev%mod +a[i]%mod cum.append(tmp) prev = cum[-1] ans=0 for i in range(n-1): p=a[i] t = cum[-1] - cum[i] ans+=(p*t)%mod print(ans%mod)
p03150
s383795909
Wrong Answer
s = input() flag = False r = "keyence" for i in range(len(s)): #print(s[:i+1], r[:i+1]) #print(s[i+1:], r[i+1:]) if s[:i+1].find(r[:i+1])!=-1 and s[i+1:].find(r[i+1:])!=-1: flag = True break if flag: print("YES") else: print("NO")
p02835
s086030653
Accepted
def main(): num = list(map(int,input().split())) if num[0]+num[1]+num[2]<22: print('win') else: print('bust') main()
p03854
s203228971
Wrong Answer
import re S = input() if re.match("^(dreamer|dream|erase|eraser)+$", S): print("Yes") else: print("No")
p02713
s095167015
Accepted
import math k = int(input()) ans = 0 for i in range(1, k + 1): for j in range(1, k + 1): a = math.gcd(i, j) for k in range(1, k + 1): ans += math.gcd(a, k) print(ans)
p02820
s928207898
Accepted
N, K = map(int,input().split()) R, S, P = map(int,input().split()) T = input() ans = 0 check = [0] * N for i in range(N): j = T[i] if i >= K: if j == check[i-K]: continue if j == "r": ans += P elif j == "s": ans += R else: ans += S check[i] = j print(ans)
p03456
s687491850
Accepted
a,b = map(str,input().split()) import math c = int(a+b) k = math.sqrt(c) if k == -(-k//1): print("Yes") else: print('No')
p02909
s107906572
Wrong Answer
weathers = ['Sunny', 'Cloudy', 'Rainy' ] s = str(input()) t = weathers.index(s) print(weathers[2-t])
p03760
s239915752
Accepted
s=input() t=input() ans="" for i in range(max(len(s),len(t))): if i < len(s): ans += s[i] if i < len(t): ans += t[i] print(ans)
p03592
s920224558
Wrong Answer
N,M,K=map(int,input().split()) for i in range(N+1): for j in range(M+1): if (N-j)*i+(M-i)*j==K: print("Yes") exit() else: print("No")
p02719
s571437198
Accepted
N,K = map(int,input().split(" ")) Min = N while(Min%K<Min): Min=Min%K if abs(Min-K) > Min: print(Min) else: print(abs(Min-K))
p02646
s280557762
Accepted
A, V = list(map(int, input().split())) B, W = list(map(int, input().split())) T = int(input()) if V > W and T >= (abs(A - B) / abs(V - W)): print('YES') else: print('NO')
p02993
s608565719
Accepted
s=str(input()) d=True for i in range(3): if s[i+1]==s[i]: d=False if d: print("Good") else: print("Bad")
p02959
s523788219
Accepted
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 for i in range(len(A)-1): if B[i] >= A[i]: ans += A[i] if A[i+1] > B[i]-A[i]: A[i+1] -= B[i]-A[i] ans += B[i] - A[i] else: ans += A[i+1] A[i+1] = 0 else: ans += B[i] print(ans)
p03456
s804138657
Accepted
a, b = map(str,input().split()) c = int(a + b) t = 2 while(t**2 <= c): if t**2 == c: print("Yes") quit() t += 1 print("No")
p02813
s154201313
Wrong Answer
from itertools import permutations N = int(input()) P = list(map(int, input().split())) S = list(map(int, input().split())) J = list(permutations(sorted(S) , N)) print(J.index(tuple(P)) - J.index(tuple(S)))