problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02684
s451612975
Wrong Answer
n,k=map(int,input().split()) a=list(map(int,input().split())) check=[[] for i in range(n)] c=0 g=1 tmp=[] cy=[] non=[] while c<n: if check[g-1]==[]: c+=1 tmp.append(g) check[g - 1].append(c) g=a[g-1] else: cy=tmp[(check[g-1][0]-1):] non=tmp[:(check[g-1][0]-1)] break k-=len(non) k%=len(cy) print(cy[k])
p02953
s021428287
Accepted
n=int(input()) a=[int(x) for x in input().split()] for i in range(n-1): if a[i]<a[i+1]: a[i+1]-=1 if a[i]>a[i+1]: print("No") exit() print("Yes")
p03962
s793737214
Accepted
n = set(map(int,input().split())) print(len(n))
p03043
s112214730
Wrong Answer
n, k = map(int, input().split()) p = 0 for i in range(1, n + 1): if i < k: count = 1 while i * count < k: count += 1 p += 0.5 ** count else: p += 1 print(p/n)
p03633
s960362441
Accepted
def gcd(p, q): if p < q: p, q = q, p while q > 0: p, q = q, p%q return p n = int(input()) ans = 1 for i in range(n): t = int(input()) ans = ans*t//gcd(ans, t) print(ans)
p03073
s428150159
Accepted
#n=int(input()) #n,m=map(int,input().split()) #sl=list(map(int,input().split())) #l=[list(map(int,input().split())) for i in range(n)] s=list(input()) n=len(s) #最初が0のリスト goal1=["1" if i%2==0 else "0" for i in range(n)] count1=0 #最初が1のリスト goal2=["0" if i%2==0 else "1" for i in range(n)] count2=0 for i in range(n): if goal1[i]!=s[i]: count1+=1 if goal2[i]!=s[i]: count2+=1 print(min(count1,count2))
p02958
s212305590
Accepted
c=int(input()) n = list(map(int,input().split())) x = 0 for i in range(len(n)): if n[i]!=i+1: x+=1 if(x==0 or x==2):print("YES") else: print("NO")
p03555
s380635578
Accepted
if input()==input()[::-1]: print("YES") else: print("NO")
p03137
s940275409
Wrong Answer
N,M = map(int,input().split()) X = sorted(list(map(int,input().split()))) B=[] #print(X) for i in range(M-1): B.append(X[i+1]-X[i]) B.sort() #print(B) print(sum(B[:-(N-1)]))
p03723
s030740887
Accepted
a,b,c=map(int,input().split()) tmpa=0 ampb=0 tmpc=0 if a%2==1 or b%2==1 or c%2==1: print(0) exit() for i in range(10**5): tmpa=(b+c)/2 tmpb=(a+c)/2 tmpc=(b+a)/2 a=tmpa b=tmpb c=tmpc if a%2==1 or b%2==1 or c%2==1: print(i+1) exit() print(-1)
p03386
s531868911
Wrong Answer
a,b,k=map(int,input().split()) ans=[] for i in range(k): if a+i<b-i: ans.append(a+i) ans.append(b-i) ans.sort() for a in ans: print(a)
p02923
s188226408
Wrong Answer
n=int(input()) h=list(map(int,input().split())) ans=0 kari=0 for i in range(n-1): if h[i+1]<=h[i]: kari+=1 elif ans<kari: ans=kari kari=0 print(max(ans,kari))
p03317
s501556894
Wrong Answer
# https://atcoder.jp/contests/abc101/tasks/arc099_a import sys read = sys.stdin.readline ra = range enu = enumerate def read_ints(): return list(map(int, read().split())) N, K = read_ints() if N == K: print(1) exit() A = read_ints() K -= 1 i = A.index(1) # 怒りの全探索 ans = 0 for j in range(0, N, K): ans += 1 print(ans)
p02730
s063221145
Accepted
N = str(input()) lenN = len(N) fN =N[0:(lenN - 1)//2] lN =N[(lenN + 3)//2-1:] print(("No","Yes")[(0,1)[fN == fN[-1::-1]]*(0,1)[lN == lN[-1::-1]]*(0,1)[lN == fN]])
p02705
s434314490
Wrong Answer
import math num = int(input()) print(num * math.pi)
p02795
s084609681
Wrong Answer
h = int(input()) w = int(input()) n = int(input()) h = max(h, w) print(n // h)
p03545
s729519871
Wrong Answer
p03556
s700506545
Accepted
n=int(input()) ans=1 while n>=ans**2: ans+=1 print((ans-1)**2)
p02631
s772466382
Accepted
N = int(input()) A = list(map(int, input().split())) xor_sum = 0 for a in A: xor_sum ^= a for a in A: print(xor_sum^a, end=" ")
p02747
s601043062
Accepted
class gv: input = None; def build(): gv.str = input() def solve(): slen = len(gv.str) if (slen&1) == 1: print("No") return for i in range(0,slen,2): if (gv.str[i:i+2] == "hi") : pass else : print("No") return print("Yes") build() solve()
p03624
s255675826
Accepted
S = input() l = sorted(list(set(S))) ans = "" for i in range(len(l)): if ord(l[i]) != 97 + i: ans = chr(97+i) break elif i == 25 and l[i] == "z": ans = "None" if ans != "": print(ans) else: print(chr(ord(l[-1])+1))
p02995
s043958608
Wrong Answer
A,B,C,D=map(int,input().split()) print(A,B,C,D) from math import* upto_B=B-(B//C+B//D-B//(C*D//gcd(C,D))) upto_A=A-1-((A-1)//C+(A-1)//D-(A-1)//(C*D//gcd(C,D))) print(upto_B-upto_A*(A>2))
p03069
s031259795
Accepted
N = int(input()) S = list(input()) count = [] for i in range(N): count.append([0,0]) cb = 0 for i in range(N): count[i][0] = cb if S[i] == "#": cb += 1 cw = 0 for i in range(N): count[N-i-1][1] = cw if S[N-i-1] == ".": cw += 1 ans = 10**10 for i in range(N): ans = min(ans,sum(count[i])) print(ans)
p02714
s830646987
Accepted
n=int(input()) str=input() count=str.count("R")*str.count("G")*str.count("B") count0=0 for i in range(0,n-2): for j in range(i+1,int((n+i-1)/2)+1): k=2*j-i if str[k]!=str[i] and str[k]!=str[j] and str[i]!=str[j]: count0=count0+1 print(count-count0)
p03087
s576330744
Accepted
import itertools import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n, q = map(int, readline().split()) s = readline().decode().rstrip() lis = [0]*n for i in range(n - 1): if s[i] + s[i + 1] == 'AC': lis[i+1] = 1 a = list(itertools.accumulate(lis)) for _ in range(q): l, r = map(int, readline().split()) print(a[r-1]-a[l-1])
p02706
s424250608
Accepted
n,m = map(int,input().split()) a = list(map(int,input().split())) x = sum(a) ans = n - x if ans >= 0: print(ans) else : print(-1)
p02881
s052742612
Wrong Answer
import math n = int(input()) ans = float("inf") for i in range(1,n+1): for j in range(i,math.ceil(n**0.5)+3): if i*j == n: ans = min(ans,i+j-2) print(ans)
p02911
s444525685
Accepted
import sys input = sys.stdin.readline N, K, Q = map(int, input().split()) A = [int(input().rstrip()) for i in range(Q)] #print(A) score =[0]*(N) for i in range(Q): score[A[i]-1] += 1 #print(score) for i in range(N): if K+score[i]-Q >0: print('Yes') else: print('No')
p03711
s654637969
Accepted
x, y = map(int, input().split()) group = { 1:1, 3:1, 5:1, 7:1, 8:1, 10:1, 12:1, 4:2, 6:2, 9:2, 11:2, 2:3 } if group[x] == group[y]: print('Yes') else: print('No')
p03796
s875484352
Accepted
n=int(input()) mod = 10**9+7 ans = 1 for i in range(1,n+1): ans*=(i%mod) ans%=mod print(ans)
p02917
s419932699
Wrong Answer
import sys def solve(inp): N = int(inp.readline().strip()) B = list(map(int, inp.readline().strip().split(' '))) A = [0 for i in range(N)] A[N - 1] = B[N - 2] n = N - 2 while n >= 0: A[n] = min(B[n], B[n - 1]) n -= 1 # print(" ".join(map(str, A))) return sum(A) def main(): result = solve(sys.stdin) if result: print(result) if __name__ == '__main__': main()
p03625
s138182125
Accepted
N=int(input()) A=sorted(list(map(int,input().split())),reverse=True) def sameA(List): for i in range(len(List)): try: if List[i]==List[i+1]: ans=List[i] anslist=A[i+2:] return ans,anslist except IndexError: return False,False a1,list1=sameA(A) if not a1==False: a2,list2=sameA(list1) if not a2==False: print(a1*a2) else: print(0) else: print(0)
p02780
s120614434
Wrong Answer
n, k = map(int, input().split()) p = list(map(int, input().split())) def kitaiti(num): result = (num+1)*num/(num*2) return result r = [kitaiti(p[i]) for i in range(n)] result = [sum(r[:k])] for i in range(k,n): result.append(result[-1]+p[i]-p[i-k-1]) print(max(result))
p02771
s899778507
Accepted
def main(): a = set(map(int,input().split())) if (len(a)==2): print("Yes") else: print("No") main()
p04043
s394285516
Accepted
a, b, c=map(int,input().split()) if a==7 and b==5 and c==5: print("YES") elif a==5 and b==7 and c==5: print("YES") elif a==5 and b==5 and c==7: print("YES") else: print("NO")
p03251
s059727431
Accepted
import sys n,m,X,Y=map(int,input().split()) x=list(map(int,input().split())) y=list(map(int,input().split())) for i in range(X+1,Y+1): if max(x)<i and min(y)>=i: print('No War') sys.exit() print('War')
p03799
s613156915
Accepted
import sys def input(): return sys.stdin.readline().strip() def resolve(): n, m = map(int, input().split()) cnt = 0 if 2*n <= m: cnt += n m -= n * 2 cnt += m // 4 else: cnt += m // 2 print(cnt) resolve()
p03817
s111337637
Accepted
x = int(input()) cnt, q = divmod(x, 11) cnt *= 2 if 0 < q <= 6: cnt += 1 elif q > 6: cnt += 2 print(cnt)
p02657
s172820537
Accepted
k = list(map(int, input().split())) print(k[0] * k[1])
p03086
s450142996
Accepted
S = input() L = ["A","G","C","T"] cnt = 0 maxcnt = 0 for i in range(len(S)): if S[i] in L: cnt += 1 else: if maxcnt < cnt: maxcnt = cnt cnt = 0 if maxcnt < cnt: maxcnt = cnt print(maxcnt)
p03221
s866594971
Accepted
def main(): n,m=map(int,input().split()) l=[tuple(map(int,input().split())) for _ in range(m)] py=sorted(l, key=lambda x: (x[0],x[1])) d={} i = 1 prev=0 for p,y in py: if prev != p: i = 1 prev = p d[(p,y)] = "{:0>6}".format(p)+"{:0>6}".format(i) i += 1 for x in l: print(d[x]) if __name__ == "__main__": main()
p03286
s368616034
Wrong Answer
n = int(input()) ans = '' while n!=0: r = n%2 n = (n-r) // (-2) ans += str(r) print(ans[::-1])
p03962
s405634546
Accepted
s = set() for i in input().split(): s.add(i) print(len(s))
p04034
s104336833
Accepted
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N, M = map(int, input().split()) red = [0] * (N + 1) white = [1] * (N + 1) red[1] = 1 white[1] = 0 for _ in range(M): x, y = map(int, input().split()) if red[x]: red[y] += 1 else: white[y] += 1 if white[x]: white[x] -= 1 else: red[x] -= 1 print(N-red[1:].count(0))
p02861
s182201921
Wrong Answer
from math import sqrt from itertools import permutations N = int(input()) xy = [list(map(int, input().split())) for _ in range(N)] order = [i for i in range(N)] s = 0 for a in permutations(order, N): for b in range(N-1): s += sqrt((xy[a[b]][0]-xy[a[b+1]][0])**2+(xy[a[b]][1]-xy[a[b+1]][1])**2) print(s / (N*(N-1)))
p02711
s267180830
Accepted
def main(): n = input() for x in n: if x == "7": print("Yes") return print("No") if __name__ == "__main__": main()
p02939
s304465766
Wrong Answer
ss = input()+'**' n = len(ss) arrs = [ss[0]] for i in range(1, n): if len(arrs[-1]) == 2: if arrs[-1].endswith(ss[i]): continue else: arrs.append(ss[i]) else: if ss[i-1] == ss[i]: arrs.append(ss[i: i+2]) else: arrs.append(ss[i]) while '*' in arrs: arrs.remove('*') print(arrs) print(len(arrs))
p02996
s696527329
Accepted
n = int(input()) l = [] for _ in range(n): a,b = map(int,input().split()) l.append((b,a)) l.sort() now = 0 for i in l: now+=i[1] if now>i[0]: print('No') exit() print('Yes')
p02717
s026892565
Wrong Answer
def main(): x, y, z = map(int, input().split()) print(x,z,y) if __name__ == "__main__": main()
p02702
s745474512
Accepted
import sys from collections import defaultdict lines = 1 inp = list() for _ in range(lines): inp.append(sys.stdin.readline().strip()) s = inp[0] n = len(s) tmp = defaultdict(int) tmp[0] = 1 b = 0 d = 1 for i in range(1, n + 1): a = int(s[n - i]) b = ((d * a) + b) % 2019 tmp[b] += 1 d = (d * 10) % 2019 result = 0 for v in tmp.values(): result += int(v * (v - 1) / 2) print(result)
p02708
s612352641
Wrong Answer
N, K = list(map(int,input().split())) S = [] if N <= K: print(1) exit(0) for i in range(K,N+2): S.append(i*N - (i-1)*i + 1) print(sum(S))
p02880
s450738580
Accepted
n = int(input()) a = [] for i in range(10)[1:]: for j in range(10)[1:]: if not i * j in a: a.append(i * j) if n in a: print('Yes') else: print('No')
p02726
s589205074
Accepted
from sys import stdin def get_result(data): N, X, Y = data dist_cnt = [0 for i in range(N)] for i in range(1, N+1): for j in range(i+1, N+1): min_dist = min([j-i, abs(X-i) + 1 + abs(Y-j), abs(Y-i) + 1 + abs(X-j)]) dist_cnt[min_dist] += 1 for i in range(1, N): print(dist_cnt[i]) if __name__ == '__main__': data = list(map(int, stdin.readline().rstrip('\n').split(' '))) get_result(data)
p04045
s206023492
Accepted
n,k = list(map(int,input().split())) a = list(map(int,input().split())) for i in range(n,10*n+1): m =list(map(int,str(i))) no = 0 for j in range(len(m)): if m[j] in a: no = 1 break if no == 0: print(i) break
p03163
s252623031
Accepted
def main(): import numpy as np import sys input = sys.stdin.readline n,w = map(int,input().split()) l = [list(map(int,input().split())) for i in range(n)] dp = np.zeros((n+1,w+1),dtype="int64") for i in range(n): dp[i+1][:l[i][0]] = dp[i][:l[i][0]] dp[i+1][l[i][0]:] = np.maximum(dp[i][l[i][0]:],dp[i][:-l[i][0]]+l[i][1]) print(dp[n][w]) if __name__ == "__main__": main()
p03161
s485625974
Accepted
N, K = map(int, input().split()) H = tuple(map(int, input().split())) table = [0] * N for i in range(1, N): table[i] = min(abs(H[i] - H[j]) + table[j] for j in range(max(0, i - K), i)) print(table[N-1])
p03962
s177300619
Accepted
import collections color = map(int, input().split()) print(len(collections.Counter(color)))
p03086
s962842385
Wrong Answer
s = input() count = 0 for i in range(len(s)-1): c=0 if s[i]!='A' and s[i]!='C' and s[i]!='G' and s[i]!='T': continue c=1 for j in range(i+1,len(s)): if s[j]!='A' and s[j]!='C' and s[j]!='G' and s[j]!='T': break else: c+=1 count = c if count<c else count print(count)
p03760
s383216799
Wrong Answer
o=list(input()) print(o) e=list(input())+[""] print(e) for x,y in zip(o,e):print(x+y,end="")
p03778
s156983095
Accepted
W, a, b = map(int, input().split()) A2W = (a, a+W) B2W = (b, b+W) if (A2W[0] <= B2W[0] and B2W[0] <= A2W[1]) or (A2W[0] <= B2W[1] and B2W[1] <= A2W[1]): print(0) elif B2W[0] > A2W[1]: print(B2W[0]-A2W[1]) else: print(A2W[0]-B2W[1])
p03814
s631238657
Accepted
s = input() a = len(s) b = 0 for i in range(len(s)): if s[i] == "A": a = min(a, i) if s[i] == "Z": b = max(b,i) res = b-a+1 print(res)
p03803
s907279425
Accepted
import sys import math import bisect def main(): a, b = map(int, input().split()) if a == 1: a = 14 if b == 1: b = 14 if a > b: print('Alice') elif a < b: print('Bob') else: print('Draw') if __name__ == "__main__": main()
p03544
s164078612
Wrong Answer
N = int(input()) L = [0] * 90 L[0], L[1] = 2, 1 for i in range(2, len(L)): L[i] = int(L[i - 1]) + int(L[i - 2]) print(L) print(int(L[N]))
p02602
s101147231
Wrong Answer
N, K= map(int, input().split(' ')) A = list(map(int, input().split(' '))) print(A) def N_score(n): Score = 1 for i in range(n - (K - 1), n + 1): Score *= A[i] return Score for i in range(K, N): if(N_score(i-1) < N_score(i)): print("Yes") else: print("No")
p03071
s159613640
Accepted
A,B = map(int, input().split()) c = 0 if A>B: c = A A-=1 else: c = B B-=1 if A>B: c += A A-=1 else: c += B B-=1 print(c)
p02862
s834894043
Wrong Answer
import math def inv(a,mod=10**9+7): return(pow(a,mod-2,mod)) x,y = map(int,input().split()) mod = 10**9+7 reuslt = 0 if (x+y) %3 == 0: n = (2*x-y)//3 m = (2*y-x)//3 r = min(n,m) result = 1 for i in range(r): result = result*(n+m-i)*inv(i+1,mod)%mod else : result = 0 print(result)
p03814
s514151765
Accepted
s = input() for i in range(len(s)): if s[i] == 'A': head = i break for i in range(len(s)): if s[-(1+i)] == 'Z': tail = len(s)-i-1 break print(tail - head + 1)
p03773
s228151124
Wrong Answer
a, b = map(int, input().split()) print(a % 24 + b)
p03012
s065071812
Wrong Answer
ans = 0 n = int(input()) w = list(map(int,input().split())) mid = sum(w)//2 ans = 0 for i in w: ans += i if mid <= ans: print(ans-(sum(w)-ans)) break
p02603
s025695484
Accepted
def main(): _ = int(input()) *A, = map(int, input().split()) A += [0] money = 1000 stock = 0 for a, b in zip(A, A[1:]): money += stock * a stock = 0 if a < b: buy, rest = divmod(money, a) stock = buy money = rest print(money) if __name__ == '__main__': main()
p03910
s002499799
Accepted
N = int(input()) cum = 0 mx = 0 for i in range(N): cum += i + 1 if cum >= N: mx = i + 1 break for i in reversed(range(1, mx+1)): if N - i >= 0: print(i) N -= i
p02771
s651859066
Accepted
if len(set(map(int, input().split()))) == 2: print('Yes') else: print('No')
p02697
s614977726
Accepted
n,m = map(int,input().split()) if n%2 == 1: for i in range(1,m+1): print(i,n+1-i) else: c = 0 for i in range(1,(n//4)+1): print(i,n+1-i) c += 1 if c == m: exit() j = n//2 while True: print(j,n+2-j) c += 1 if c == m: exit() j -= 1
p02683
s883796649
Accepted
n, m, x=map(int, input().split()) c=[] a=[] for i in range(n): l=list(map(int, input().split())) c.append(l[0]) a.append(l[1:]) import numpy as np ab=np.array(a).T ans=[] #print(c) #print(ab) from itertools import product s = [0,1] for i in sorted(list(product(s, repeat=n))): for t in ab: if sum(np.array(t)*np.array(i))<x: break else: ans.append(sum(np.array(i)*np.array(c))) continue if ans==[]: print(-1) else: print(min(ans))
p02918
s763934214
Accepted
n,k=map(int,input().split()) a=input() ans=0 cnt=0 for i in range(n-1): if a[i]==a[i+1]: ans+=1 if a[i]!=a[i+1]: cnt+=1 ans=min(n-1,ans+min(cnt,k)*2) print(ans)
p02720
s875365946
Accepted
import sys sys.setrecursionlimit(10 ** 6) k = int(input()) ansl = [] def dfs(s): if len(s) >= 11: return ansl.append(s) if s[-1] != "0": dfs(s+str(int(s[-1])-1)) dfs(s + str(int(s[-1]))) if s[-1] != "9": dfs(s + str(int(s[-1]) + 1)) for i in range(1,10): dfs(str(i)) ansl = [int(a) for a in ansl] ansl = sorted(ansl) print(ansl[k-1])
p02971
s303166116
Accepted
n=int(input()) a=[int(input()) for _ in range(n)] a_s=sorted(a) m1=a_s[-1] m2=a_s[-2] for i in range(n): if a[i]==m1: print(m2) else: print(m1)
p02923
s407119829
Accepted
N = int(input()) H = list(map(int, input().split())) a, b = 0, 0 for i in range(N-1): if H[i] >= H[i+1]: b += 1 else: b = 0 a = max(a, b) print(a)
p03861
s748479455
Accepted
abx = input().split() a, b, x = int(abx[0]), int(abx[1]), int(abx[2]) print(int(b//x) - int((a-1)//x))
p02627
s070953462
Accepted
a = input() if a.isupper(): print('A') else: print('a')
p03109
s918944326
Wrong Answer
S = input() ans = "TBD" if int(S[:4]) <= 2018: ans = "Heisei" elif int(S[:4]) ==2019 and int(S[6:7]) <=4: ans = "Heisei" print( ans)
p02862
s682849500
Accepted
def C(n, r, m): num, den = 1, 1 for i in range(1, r + 1): num = num * (n - i + 1) % m den = den * i % m return (num * pow(den, m - 2, m)) % m x, y = map(int, input().split()) m = (2*x - y) // 3 n = (-x + 2*y) // 3 if (x + y) % 3 != 0 or m < 0 or n < 0: print(0) else: print(C(n + m, n, 10**9 + 7))
p03351
s032142565
Wrong Answer
a,b,c,d=[int(i) for i in input().split()] if (abs(a-b)>=d and abs(b-c)>=d) or abs(a-c)>=d: print('Yes') else: print('No')
p02854
s046555127
Wrong Answer
N = int(input()) A = list(map(int,input().split())) S = sum(A) P = 10**8 X = 0 for i in range(N): X = X + A[i] P = min(P,abs(S-X*2)) print(P)
p03037
s445813794
Wrong Answer
N, M = map(int, input().split()) L = list(list(map(int,input().split())) for i in range(M)) l = 0 r = N for i in range(M): l = max(l,L[i][0]) r = min(r,L[i][1]) print(r-l+1)
p03696
s275940234
Wrong Answer
n=int(input()) s=input() flag=False for i in range(n-1,-1,-1): if s[i]==")": a=i flag=True break if flag: t=s[:a+1] x=t.count("(") y=len(t)-x if x<y: print("("*(y-x)+t+"("*(n-a-1)+")"*(n-a-1)) else: print(t+")"*(x-y)+"("*(n-a-1)+")"*(n-a-1)) else: print("("*n+")"*n)
p03067
s941786315
Wrong Answer
A,B,C = list(map(int,input().split(' '))) [A,B] = [max(A,B),min(A,B)] if C>=A and C<=B: print('Yes') else: print('No')
p03785
s863053251
Accepted
n, c, k = map(int, input().split()) arr = sorted([int(input()) for _ in range(n)]) ans = 0 cnt = 0 tmp_t = 0 for t in arr: if cnt == 0: tmp_t = t cnt += 1 if t - tmp_t > k: ans += 1 cnt = 1 tmp_t = t elif cnt == c: ans += 1 cnt = 0 if cnt: ans += 1 print(ans)
p02793
s326896925
Wrong Answer
def gcd(x,y): return (y if x%y==0 else gcd(y,x%y)) def lcd(x,y): return x*y//gcd(x,y) P=1000000007 N=int(input()) A=list(map(int,input().split())) l=1 for a in A: l=lcd(a,l) ans=0 for a in A: ans+=l*(a**(P-2)) print(ans%ans)
p03293
s638767578
Wrong Answer
S = input() T = input() characters_num = len(T) for i in range(characters_num): rotation_S = S[i:] + S[:i] print(rotation_S) if rotation_S == T: answer = 'Yes' break else: answer = 'No' print(answer)
p03434
s703780535
Accepted
# coding: utf-8 import math n = input() N = map(int, input().split()) N = sorted(list(N), reverse=True) a = sum(N[::2]) b = sum(N[1::2]) print(a - b)
p03803
s758446592
Accepted
A, B = list(map(int, input().split())) if A == B: print('Draw') elif A == 1 : print('Alice') elif B == 1 : print('Bob') else : if A > B: print('Alice') else : print('Bob')
p02641
s245569265
Wrong Answer
from sys import stdin,stdout LI=lambda:list(map(int,input().split())) MAP=lambda:map(int,input().split()) IN=lambda:int(input()) S=lambda:input() import math from collections import Counter,defaultdict x,n=MAP() if n==0: print(x) exit() a=LI() l=-1;r=-1 for i in range(1,101): if x-i not in a: l=x-i break for i in range(1,101): if x+i not in a: r=x+i break if abs(r-x)>=abs(l-x): print(l) else: print(r)
p02724
s036914000
Accepted
X = int(input()) a = X // 500 b = (X % 500) // 5 print(a * 1000 + b * 5)
p03799
s807950093
Wrong Answer
n,m=map(int,input().split()) s=(2*n+m)//4 if (s+1)*4<=2*n+m: s+=1 print(min(2*m,s))
p02947
s405813540
Accepted
n = int(input()) s = [input() for i in range(n)] for i in range(n): s[i] = sorted(s[i]) s.sort() result = 0 count = 1 for i in range(n-1): if s[i] == s[i+1]: count += 1 else: result += (count*(count-1))//2 count = 1 result += count*(count-1)//2 print(result)
p03815
s876947064
Accepted
x = int(input()) ans = x//11 * 2 mod = x%11 if mod==0: pass elif mod<=6: ans += 1 else: ans += 2 print(ans)
p03086
s380731178
Accepted
def S(): return input() S = S() ans = 0 temp = 0 for x in S: if x in 'ACGT': temp += 1 else: temp = 0 ans = max(temp,ans) print(ans)
p03943
s746594815
Accepted
a, b, c = map(int, raw_input() .split()) if a + b == c or a == b +c or a + c == b: print "Yes" else: print "No"
p03059
s144863520
Accepted
a,b,t = map(int,input().split()) x = t // a print(x * b)