problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p04005
s586662228
Accepted
A, B, C = map(int, input().split()) total = A*B*C if A >= B and A >= C: x = A y = B z = C elif B >= A and B >= C: x = B y = A z = C else: x = C y = A z = B if x % 2 == 0: ans = 0 else: ans = x % 2*y*z print(ans)
p04005
s418342934
Wrong Answer
def myAnswer(A:int,B:int,C:int) -> int: red = C // 2 blue = C // 2 if(C % 2 == 1): red += 1 return abs(A*B*red - A*B*blue) def modelAnswer(): tmp=1 def main(): A,B,C = map(int,input().split()) print(myAnswer(A,B,C)) if __name__ == '__main__': main()
p02729
s550027816
Accepted
N,M = map(int,input().split(sep=" ")) print(N*(N-1)//2 + M*(M-1)//2)
p02699
s670133307
Accepted
n, k = input().split(" ") n = int(n) k = int(k) print("unsafe" if k >= n else "safe")
p02756
s126912164
Accepted
from collections import deque S = deque(input()) Q = int(input()) flip = 0 for _ in range(Q): q = input().split() if q[0] == "1": flip += 1 flip %= 2 else: if (int(q[1]) - 1 + flip)%2 == 0: S.appendleft(q[2]) else: S.append(q[2]) S = list(S) if flip == 0: print(*S, sep="") else: print(*S[::-1], sep="")
p02615
s109646863
Accepted
n = int(input()) a = list(map(int,input().split())) a.sort() c = a[-1] if n%2 == 0: n1 = n//2-1 for i in range(n1): a1 = a[n-2-i] c += a1*2 else: n2 = n//2 a3 = a[n-n2-1] c += a3 for i in range(n2-1): a2 = a[n-2-i] c += a2*2 print(c)
p02987
s427408825
Wrong Answer
s = input() print(len(set(list(s))))
p02621
s996670791
Accepted
n = int(input()) a = n + (n**2) + (n**3) print(a)
p03852
s372680063
Accepted
c=str(input()) if c in 'aiueo': print('vowel') else: print('consonant')
p03371
s516825040
Accepted
A, B, C, X, Y = map(int, input().split()) min_price = A * X + B * Y if A + B > 2 * C: while X > 0 and Y > 0: X = X - 1 Y = Y - 1 min_price -= A + B - 2 * C if X > 0 and A > 2 * C: while X > 0: X = X - 1 min_price -= A - 2 * C if Y > 0 and B > 2 * C: while Y > 0: Y = Y - 1 min_price -= B - 2 * C print(min_price)
p02712
s851263176
Wrong Answer
N = int(input()) ans = 0 for i in range(1,N): if i % 3 != 0 and i % 5 != 0: ans += i print(ans)
p03105
s340532607
Accepted
a, b, c = map(int, input().split()) ans = b//a if ans > c: ans = c print(ans)
p02744
s059118508
Accepted
N = int(input()) def f(L, m): l = len(L) if l == N: print(''.join(list(map(lambda i: chr(i + 96), L)))) return for d in range(1, min(l + 1, m + 1) + 1): f(L + [d], max(m, d)) f([1], 1)
p02783
s400320274
Accepted
h,a = map(int,input().split()) count = 0 while h > 0: h -= a count+=1 print(count)
p02835
s226940319
Accepted
# -*- coding: utf-8 -*- """ Created on Sat May 9 16:41:56 2020 @author: shinba """ A = list(map(int,input().split())) if sum(A) >= 22: print("bust") else: print("win")
p02802
s310599754
Accepted
N, M = map(int, input().split()) pena= 0 ac = [0]*(10**5) for _ in range(M): tmp = input().split() if ac[int(tmp[0])-1] < 1: if tmp[1] == "AC": pena -= ac[int(tmp[0])-1] ac[int(tmp[0])-1] = 1 else: ac[int(tmp[0])-1] -= 1 #penalty print(ac.count(1), pena)
p03469
s565054816
Accepted
S=input() print("2018"+S[4:])
p02595
s421173266
Wrong Answer
import numpy as np N, D = list(map(int, input().split())) ans = 0 for i in range(N): x, y = list(map(int, input().split())) r = np.sqrt(x**2 + y**2) if r < D: ans += 1 print(ans)
p03437
s266301137
Accepted
#coding:utf-8 x, y = map(int, input().split()) if x % y == 0: print(-1) else: print(x)
p02688
s457822068
Wrong Answer
[N, K] = list(map(int, input().split())) all_A =[] after_A =[] for i in range(1, N + 1): all_A.append(i) for j in range(K): d = int(input()) A = list(map(int, input().split())) after_A = set(after_A) ^ set(A) print(len(after_A))
p02820
s977042788
Accepted
N, K = map(int, input().split()) R, S, P = map(int, input().split()) T = input() ans = 0 M = [] for i in range(N): if i >= K and M[i-K] == T[i]: M.append('x') continue else: if T[i] == 'r': ans += P M.append('r') if T[i] == 's': ans += R M.append('s') if T[i] == 'p': ans += S M.append('p') print(ans)
p03998
s244762202
Accepted
from collections import deque s = [deque([ord(a) - ord('a') for a in list(input())]) for i in range(3)] now = 0 while True: if not s[now]: print('ABC'[now]) break else: now = s[now].popleft()
p03971
s433237678
Accepted
n, a, b = map(int, input().split()) t, o = 0, 0 s = input() for i in range(n): if s[i]=="a": t += 1 if t <= a+b: print("Yes") else: print("No") elif s[i]=="b": o += 1 if o <= b and t < a+b: t += 1 print("Yes") else: print("No") else: print("No")
p02584
s477007058
Accepted
x, k , d = map(int , input().split()) r = abs(x)//d if x > 0: if k - r > 0: print(abs(x-r*d-(k-r)%2*d)) else : print(abs(x-k*d)) else : if k - r > 0: print(abs(x+r*d+(k-r)%2*d)) else : print(abs(x+k*d))
p02607
s777350553
Accepted
N = int(input()) A = [int(s) for s in input().split()] cnt = 0 for i, a in enumerate(A): if (i + 1) % 2 == 1 and a % 2 == 1: cnt += 1 print(cnt)
p03836
s302662083
Accepted
sx, sy, tx, ty = map(int, input().split()) x = tx - sx y = ty - sy lst = [] lst.append("U" * y) lst.append("R" * x) lst.append("D" * y) lst.append("L" * (x + 1)) lst.append("U" * (y + 1)) lst.append("R" * (x + 1)) lst.append("D") lst.append("R") lst.append("D" * (y + 1)) lst.append("L" * (x + 1)) lst.append("U") print("".join(lst))
p02714
s864813852
Wrong Answer
def main(): N = int(input()) S = input() ans = 0 for i in range(N - 2): for j in range(i, N - 1): for k in range(j, N): if j - i != k - j: if S[j] != S[i] and S[i] != S[k]: ans += 1 print(ans) if __name__ == "__main__": main()
p03161
s048911726
Accepted
n, k = map(int,input().split()) hl = list(map(int,input().split())) dp = [[] for _ in range(n)] dp[0] = 0 for i in range(1,n): tmp = float('inf') for j in range(1,k+1): if i-j < 0: continue tmp = min(dp[i-j] + abs(hl[i]-hl[i-j]),tmp) dp[i] = tmp print(dp[-1])
p02682
s036103011
Accepted
A,B,C,K = map(int,input().split()) if A>=K: print(K) elif A+B>=K: print(A) else: print(A-(K-A-B))
p02958
s340761173
Wrong Answer
N=int(input()) p=list(map(int,input().split())) count=0 for i in range(N): if p[i]!=i+1 : count+=1 if(count<=2): print("Yes") else: print("No")
p04011
s270094145
Accepted
n, k, x, y = [int(input()) for _ in range(4)] print(n*x-(x-y)*max(n-k, 0))
p02730
s843462675
Wrong Answer
def kaibun(x): if(x != ''.join(list(reversed(x)))): return 0 else: return 1 def main(): s = input() s_num = len(s) num1 = kaibun(s[:int((s_num - 1)/2)]) num2 = kaibun(s[(int((s_num + 1)/2)):s_num]) if(num1 == 1 and num2 == 1): if(s == ''.join(list(reversed(s)))): print('Yes') else: print('No') if __name__ == '__main__': main()
p02682
s026745154
Wrong Answer
a,b,c,d=map(int,input().split(" ")) if(a<d): print(d) elif(a+b<d): print(a) elif((a+b+c)<d): print(a-(d-(a+b))) else: print(a-c)
p02555
s222668545
Accepted
from scipy.special import comb s = int(input()) n = s//3 ans = 0 for i in range(1, n+1): a = s - i*3 ans += comb(a+i-1, i-1, exact=True) ans = int(ans)%(10**9+7) print(ans)
p03543
s810389255
Accepted
a,b,c,d=input() print('NYoe s'[a==b==c or b==c==d::2])
p03012
s961145320
Accepted
n=int(input()) p=list(map(int,input().split())) ans=10**9 for i in range(n): ans=min(ans,abs(sum(p[:i+1])-sum(p[i+1:]))) print(ans)
p02678
s418662029
Accepted
import networkx as nx room, route_count = map(int,input().split()) route = [list(map(int,input().split())) for _ in range(route_count)] G = nx.Graph() G.add_nodes_from(range(1,room+1)) G.add_edges_from(route) pre = nx.predecessor(G, 1) print('Yes') for i in range(2,room+1): print(pre[i][0])
p02717
s779089846
Accepted
x, y, z = map(int, input().split()) print(z, x, y)
p03038
s014624548
Accepted
n, m = map(int, input().split()) A = list(map(int, input().split())) L = [[0, 0] for i in range(m)] for i in range(m): b, c = map(int, input().split()) L[i][0] = c L[i][1] = b L.sort(reverse=True) cnt = 0 for i in range(m): c, b = L[i] A += [c]*b cnt += b if cnt >= n: break A.sort(reverse=True) A = A[0:n] print(sum(A))
p03814
s644991796
Wrong Answer
s = input() stack = [] best_length = -float('inf') for i,w in enumerate(s): if w=='A': stack.append(i) if w=='Z' and stack: start = stack.pop() length = i - start + 1 if length > best_length: best_length = length print(best_length)
p03944
s528982595
Accepted
w, h, n = map(int, input().split()) l = 0 r = w d = 0 u = h for i in range(n): x, y, a = map(int, input().split()) if a == 1: l = max(l, x) if a == 2: r = min(r, x) if a == 3: d = max(d, y) if a == 4: u = min(u, y) ans = max(0, r - l) * max(0, u - d) print(ans)
p03282
s201315408
Accepted
s = str(input()) k = int(input()) res = 1 idx = 0 for i in range(len(s)): if s[i] != "1": res = s[i] idx = i + 1 break if k < idx: print(1) else: print(res)
p02743
s848390860
Wrong Answer
a,b,c=map(int,input().split()) if round((c-a-b)*(c-a-b))-round(4*a*b)>0: print("Yes") else: print("No")
p02664
s782911854
Wrong Answer
t = list(input()) t.reverse() tmptmp = "P" for i in range(len(t)): if i == 0: tmp = t[i] continue if tmp == "?" and tmptmp == "P": t[i-1] = "D" elif tmp == "?" and tmptmp == "D" and t[i] == "P": t[i-1] = "D" elif tmp == "?" and tmptmp == "D" and t[i] == "D": t[i-1] = "P" tmptmp = t[i-1] tmp = t[i] t.reverse() t = "".join(t) print(t)
p03448
s023266906
Accepted
a = int(input()) b = int(input()) c = int(input()) x = int(input()) cnt = 0 for i in range(a+1): for j in range(b+1): for y in range(c+1): if (500 * i) + (100 * j) + (50 * y) == x: cnt += 1 print(cnt)
p03075
s199353212
Accepted
A=[int(input()) for _ in range(5)] k=int(input()) if (max(A)-min(A))>k: print(":(") else: print("Yay!")
p03331
s987185134
Wrong Answer
n = int(input()) cnt = 0 while n != 0: cnt += n%10 n //= 10 print(cnt)
p02771
s316256385
Accepted
A,B,C=map(int,input().split()) x = (1 if A==B else 0) + (1 if B==C else 0) + (1 if C==A else 0) print("Yes" if x==1 else "No")
p02664
s639638364
Accepted
T = input() print(T.replace('?', 'D'))
p02971
s716314688
Accepted
import sys def main(): n, *lst = map(int, sys.stdin.read().split()) max1 = max(lst) idx = lst.index(max1) max2 = max(lst[:idx] + lst[idx+1:]) print('\n'.join(str(max1) if j != max1 else str(max2) for j in lst)) if __name__ == '__main__': main()
p02861
s572858051
Accepted
N = int(input()) l = [list(map(int,input().split())) for _ in range(N)] import itertools p = list(itertools.permutations(range(N),N)) #print(p) ans = 0 for i in p: num = 0 for j in range(N-1): num += ((l[i[j+1]][0]-l[i[j]][0])**2+(l[i[j+1]][1]-l[i[j]][1])**2)**0.5 #print(num) ans += num print(ans/len(p))
p02761
s614130219
Accepted
N,M=map(int,input().split()) arr=[list(map(int,input().split())) for _ in range(M)] for x in range(0, 1000): nx=x//10 d=[x%10] while(nx): d.append(nx%10) nx//=10 d.reverse() if len(d)!=N: continue chk=True for i in range(M): if(d[arr[i][0]-1]!=arr[i][1]): chk=False if chk: print(x);exit() print(-1)
p03971
s806289330
Wrong Answer
n,a,b=input().split(" ") n=int(n) a=int(a) b=int(b) lst=input() cnt=0 cnt2=0 for i in range(n): if lst[i]=="a": if cnt<a+b: print("Yes") cnt+=1 else: print("No") elif lst[i]=="b": if cnt<a+b and cnt2<=b: print("Yes") cnt+=1 cnt2+=1 else: print("No") else: print("No")
p03797
s724028535
Accepted
N,M=map(int,input().split()) if 2*N>=M: print(M//2) if 2*N<M: L=M-2*N print(N+L//4)
p03264
s562087690
Wrong Answer
k = int(input()) if k % 2 == 1: print((k + 1) // 2 * k // 2) else: print(k // 2 * k // 2)
p02918
s897426514
Accepted
N, K = map(int, input().split()) S = list(input()) diff = [] ans = 0 for i in range(N-1): if S[i] != S[i+1]: diff += [i] else: ans += 1 print(min(N-1, ans+2*min(K, len(diff))))
p03328
s149568975
Accepted
#!/usr/bin/env python3 a, b = list(map(int, input().split())) tmp = 1 for i in range(2, 1000): if i == (b-a): # print(tmp, tmp+i) print(tmp-a) tmp += i
p02775
s323845494
Wrong Answer
n=[int(x) for x in list(input()[::-1])]+[0] ans = 0 step = 0 for i in range(len(n)-1): x = n[i]+step if x < 5 or (x==5 and n[i+1]<5): ans += x step = 0 else: ans += 10 - x step = 1 print(ans)
p03281
s362073138
Accepted
n = int(input()) have_8_divisors = 0 for i in range(1, n + 1): # 偶数の時はスキップ if i % 2 == 0: continue cnt = 0 for j in range(1, i + 1): if i % j == 0: cnt += 1 result = cnt == 8 if result: have_8_divisors += 1 print(have_8_divisors)
p02748
s825160609
Accepted
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): A, B, M = [int(x) for x in input().split()] a = [int(x) for x in input().split()] b = [int(x) for x in input().split()] XYC = [[int(x) for x in input().split()] for _ in range(M)] ans = min(a) + min(b) for x, y, c in XYC: tmp = a[x - 1] + b[y - 1] - c ans = min(ans, tmp) print(ans) if __name__ == '__main__': main()
p02789
s916946827
Wrong Answer
n,m=map(int,input().split()) if n==m: print('AC') else: print('WA')
p03633
s183434058
Wrong Answer
from fractions import gcd from functools import reduce n = int(input()) l = list(int(input()) for _ in range(n)) def lcm_base(x,y): return x*y/gcd(x,y) def lcm_list(t): return reduce(lcm_base,t,1) print(int(lcm_list(l)))
p02645
s701711251
Accepted
S=input() print(S[:3])
p02629
s990231560
Accepted
import sys import math import itertools import collections import heapq import re import numpy as np rr = lambda: sys.stdin.readline().rstrip() rs = lambda: sys.stdin.buffer.readline().split() ri = lambda: int(sys.stdin.readline()) rm = lambda: map(int, sys.stdin.buffer.readline().split()) rl = lambda: list(map(int, sys.stdin.readline().split())) inf = float('inf') mod = 10**9 + 7 n = ri() - 1 li = [] while n >= 26: a = n%26 li.append(a) n //= 26 n -= 1 li.append(n) li.reverse() ans = '' for i in li: s = 'abcdefghijklmnopqrstuvwxyz'[i] ans += s print(ans)
p02881
s469400066
Wrong Answer
def main(): ans = 10**9 n = int(input()) for i in range(1,int(n**0.5)+1): if n % i == 0: ans = min(ans,i+n//i) else: print(ans-2) if __name__ == "__main__": main()
p03324
s460757073
Wrong Answer
D, N = map(int, input().split()) if D == 0: if N == 100: print(101) else: print(N) elif D == 1: print(N * 100) elif D == 2: print(N * 10000)
p02555
s171482218
Accepted
import math def combinations_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) S = int(input()) ans = 0 mod = 10 ** 9 + 7 for i in range(1,700): x = S - 3 * i if x < 0: break ans += (combinations_count(x + i - 1, i - 1)) % mod ans %= mod print(ans)
p03241
s864679917
Accepted
N, M = map(int, input().split()) a = M // N for i in range(a, 0, -1): if M % i == 0: print(i) break
p02708
s960505207
Wrong Answer
if __name__ == "__main__": # 1 <= N <= 2 * 10^5 # 1 <= K <= N + 1 N, K = map(int, input().split(" ")) total_num = 0 for k in range(K, N+2): # NからN-(k-1)までの和 sum_max = k*(2*N - k + 1) / 2 # 0から(k-1)までの和 sum_min = k*(k-1) / 2 # 個数を計上 total_num += sum_max - sum_min + 1 total_num %= 1000000007 print(total_num)
p03075
s565704105
Accepted
line2 = [] for i in range(5): line = int(input()) line2.append(line) long = int(input()) if line2[4] - line2[0] <= long: print("Yay!") else: print(":(")
p03071
s558446204
Accepted
A,B = map(int,input().split()) print(max(2*A-1, A+B, 2*B-1))
p03285
s436296311
Accepted
N = int(input()) X = N // 4 + 1 Z = N // 7 + 1 Y = sum(4*a + 7*b == N for a in range(X) for b in range(Z)) if (Y != 0): print("Yes") else: print("No")
p03994
s265717577
Accepted
S=list(input()) N=int(input()) i=0 while i<len(S)-1: if S[i]!='a' and 123-ord(S[i])<=N: N-=123-ord(S[i]) S[i]='a' i+=1 N=N%26 while N: if S[-1]=='z': S[-1]='a' else: S[-1]=chr(ord(S[-1])+1) N-=1 print(''.join(S))
p03637
s949171119
Wrong Answer
n = int(input()) li = list(map(int,input().split())) lis = [] x = 0 y = 0 z = 0 for i in range(n): if li[i] % 4 == 0: x += 1 elif li[i] % 2 == 0: y = 1 else: z += 1 if y == 0: if x >= y + 1: print("Yes") else: print("No") else: if x >= y: print("Yes") else: print("No")
p02693
s392298842
Accepted
# -*- coding: utf-8 -*- k = int(input()) a, b = map(int, input().split()) msg = 'NG' for i in range(a, b + 1): if i % k == 0: msg = 'OK' break print(msg)
p03625
s572531344
Accepted
import sys n,*a=map(int,sys.stdin.read().split()) a.sort(reverse=True) c=0 f=0 ans=[] for i in range(n-1): if a[i]==a[i+1]: c+=1 f+=1 ans.append(a[i]) else: f=0 if (c>1 and f==1) or (c>2 and f==3): print(ans[0]*ans[-1]) sys.exit() print(0)
p02743
s051782615
Accepted
a, b, c = map(int, input().split()) if a + b >= c: print("No") else: if (a + b - c) ** 2 > 4 * a * b: print("Yes") else: print("No")
p03106
s301232541
Wrong Answer
A,B,K = map(int,input().split()) Min = min(A,B) c = 0 for i in range(1,Min+1): if A % i == 0 and B % i == 0: c += 1 if c == K: print(i)
p03274
s239445995
Wrong Answer
n, k = map(int, input().split()) x = list(map(int, input().split())) time = 2 * 10 ** 8 for i in range(n - k + 1): l = x[i] r = x[i + k - 1] if l < 0 and r > 0: if abs(l) >= abs(r): total = abs(l) + abs(r) * 2 else: total = abs(l) * 2 + abs(r) elif l >= 0: total = r else: total = abs(l) time = min(time, total) print(time)
p02603
s354067539
Accepted
# -*- coding: utf-8 -*- def main(): import sys import math N = list(map(int, sys.stdin.readline().split())) A_list = list(map(int, sys.stdin.readline().split())) money = 1000 for i in range(1,len(A_list)): if A_list[i] > A_list[i-1]: stock = money // A_list[i-1] money -= (stock * A_list[i-1]) money += (stock * A_list[i]) print(money) if __name__ == "__main__": main()
p02571
s260944881
Accepted
from functools import reduce import sys def dump(x): print(x, file=sys.stderr) s = input() t = input() min_diff = 100000000000 for i in range(len(s)-len(t)+1): matches = [1 if s[i+j] != t[j] else 0 for j in range(len(t))] diffn = sum(matches) min_diff = min(diffn,min_diff) dump(min_diff) print(min_diff)
p03592
s969254244
Wrong Answer
N, M, K = map(int, input().split()) def main(N, M, K): for i in range(0, N+1): for j in range(0, M+1): if N * (M - j) + M * (N - i) == K: return True return False res = main(N, M, K) if res == True: print('Yes') else: print('No')
p02693
s919896527
Wrong Answer
import sys # input k = int(input()) a, b = map(int, input().split()) #print(f"k >>{k}, a >>{a}, b >>{b}") for i in range(a, b): if (i % k == 0): print("OK") sys.exit(0) print("NG")
p02989
s454393131
Accepted
n = int(input()) d = [int(i) for i in input().split()] d.sort() ans = d[len(d)//2] - d[len(d)//2-1] print(ans)
p02780
s443238221
Accepted
n,k = map(int,input().split()) p = list(map(int,input().split())) u = sum(p[0:k]) maxsum = u for i in range(1, n-k+1): u = u + p[i+k-1] - p[i-1] if u >= maxsum: maxsum = u print((maxsum+k)/2)
p02607
s459556992
Accepted
def main(): n = int(input()) A = list(map(int, input().split())) ans = 0 for a in A[::2]: if a % 2 == 1: ans += 1 print(ans) if __name__ == '__main__': main()
p03632
s570748813
Accepted
a, b, c, d = (int(x) for x in input().split()) if a <= c <= b: if d <= b: print(d-c) else: print(b-c) elif c <= a: if b <= d: print(b-a) elif a <= d <= b: print(d-a) else: print(0) else: print(0)
p03220
s438958448
Accepted
n = int(input()) t, a = map(int, input().split()) h = list(map(int, input().split())) d = [] for i in range(n): temp = 0 temp = t - h[i]*0.006 d += [abs(a - temp)] print(d.index(min(d))+1)
p02802
s697174854
Accepted
n,m=[int(_) for _ in input().split()] p=[0 for i in range(m)] s=[0 for i in range(m)] for i in range(m): _p,_s=input().split() p[i]=int(_p)-1 s[i]=_s ac=[False for i in range(n)] wa=[0 for i in range(n)] for i in range(m): if s[i]=="WA" and not(ac[p[i]]): wa[p[i]]+=1 else: ac[p[i]]=True for i in range(n): if not(ac[i]): wa[i]=0 print(sum(ac),sum(wa))
p03161
s277528833
Accepted
import sys n,k=map(int,input().split()) l=list(map(int,input().split())) dp=[sys.maxsize]*n dp[0]=0 for i in range(n): for j in range(i+1,i+k+1): if j<n: dp[j]=min(dp[j], dp[i]+ abs(l[i]-l[j])) print(dp[-1])
p02659
s671203843
Accepted
from decimal import * getcontext().prec = 20 N = list(map(str, input().split())) A = Decimal(N[0]) B = Decimal(N[1]) print(int(A*B))
p02838
s126666682
Accepted
mod = 10**9+7 n = int(input()) A = list(map(int,input().split())) c01 = [[0,0] for i in range(60)] for a in A: for j in range(60): if a>>j &1: c01[j][1] += 1 else: c01[j][0] += 1 ans = 0 for i in range(60): ans += 2**i *c01[i][0]*c01[i][1] ans%=mod print(ans)
p02823
s848246920
Accepted
n, a, b = map(int, input().split()) if (b - a) % 2: print((b - a - 1) // 2 + 1 + min(n - b, a - 1)) else: print((b - a) // 2)
p03695
s012855616
Accepted
n = int(input()) a = list(map(int,input().split())) ans = 0 for i in range(8): # print(1) if len([j for j in a if j > 400*i-1 and j < 400*(i+1)]) > 0: ans += 1 ans_min = ans ans_max = ans + len([i for i in a if 3200 <= i]) print(max(ans_min,1),max(ans_max,1))
p03852
s098301701
Accepted
c = input() vowel = ["a", "e", "i", "o", "u"] if c in vowel: print("vowel") else: print("consonant")
p03471
s903087868
Accepted
N , Y = map(int,input().split()) k = 0 for i in range(N+1): x = i for j in range(N - i + 1): y = j if (Y - x * 10000 - y*5000)/1000 == N - x - y >=0 : print(str(x) +' '+str(y)+' '+str(N-x-y)) k = 1 break if k == 1: break if k== 0: print('-1 -1 -1')
p03607
s316548865
Accepted
n=int(input()) a=[int(input()) for i in range(n)] d={} for i in range(n): if a[i] in d: d[a[i]]+=1 else: d[a[i]]=1 cnt=0 d=list(d.items()) for i in range(len(d)): if d[i][1]%2==1: cnt+=1 print(cnt)
p02939
s540476841
Accepted
S = input() if len(S) == 1: print(1) exit() ans = 1 tmp1 = S[0] tmp2 = "" for i in range(1,len(S)): tmp2 += S[i] if tmp1 == tmp2: continue else: ans += 1 tmp1 = tmp2 tmp2 = "" print(ans)
p02603
s679396390
Accepted
N = int(input()) A = list(map(int,input().split())) money = 1000 for i in range(N-1): if A[i] < A[i+1]: money += (money//A[i])*(A[i+1]-A[i]) print(money)
p02963
s072904227
Accepted
def main(): import sys input = lambda:sys.stdin.readline().strip() s = int(input()) v = 10**9 x = (v-s%v)%v y = (s+x)//v print(0,0,10**9,1,x,y) if __name__=='__main__': main()