problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02702
s196604878
Accepted
from collections import Counter S = input() S = S[::-1] N = len(S) counter = Counter() counter[0] = 1 prev = 0 MOD = 2019 for i in range(N): c = (int(S[i]) * pow(10, i, MOD) )%MOD prev = (prev+c)%MOD counter[prev] += 1 ans = 0 for k,v in counter.items(): ans += (v * (v-1))//2 print(ans)
p03971
s580820458
Wrong Answer
n,A,B=map(int,input().split()) s=input() cnt_b=0 cnt_c=0 for i in range(n): if s[i]=='a': if i+1<=A+B+cnt_c: print('Yes') else: print('No') elif s[i]=='b': cnt_b+=1 if i+1<A+B+cnt_c and cnt_b<=B: print('Yes') else: print('No') elif s[i]=='c': print('No') cnt_c+=1
p03817
s280306997
Accepted
x = int(input()) ans = x // 11 * 2 print(ans + (x % 11 > 0) + (x % 11 > 6))
p02608
s114452760
Accepted
#!/usr/bin/env python3 import math n = int(input()) result = [0] * (n + 1) border = 0 if n>=3: border = int(math.sqrt(n - 2)) for x in range(1, border): for y in range(1, border): for z in range(1, border): r = ((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2) // 2 if r > n: break else: result[r] += 1 for num in result[1::]: print(num)
p02689
s478781865
Accepted
n, m = map(int, input().split()) h = list(map(int, input().split())) li = list(range(1,n+1)) ab = [list() for _ in range(m)] p = [] ih = dict(zip(li, h)) for i in range(m): a, b = map(int,input().split()) c = ih[a] d = ih[b] if c>d: p.append(b) elif d>c: p.append(a) else: p.append(a) p.append(b) print(n-len(set(p)))
p02842
s896024496
Accepted
N = int(input()) from math import floor ans = 0 for x in range(1,50001): if N == floor(x*1.08): ans = x if ans == 0: print(':(') else: print(ans)
p04005
s535904586
Wrong Answer
l = [int(x) for x in input().split()] l.sort(reverse=True) if len([x for x in l if x % 2 != 0]) == 0: print(0) else: ans = min(l[1]*l[2], l[0]*l[1], l[0]*l[2]) print(ans)
p04029
s960854870
Accepted
n = int(input()) print(n*(n+1)//2)
p02873
s557520773
Wrong Answer
S = input() a = [0]*(len(S)+1) for i in range(len(S)): if S[i] is '<': a[i+1] = max(a[i+1], a[i]+1) for i in range(1, len(S)): if S[-i] is '>': a[-(i+1)] = max(a[-(i+1)], a[-i]+1) print(sum(a))
p03814
s561965437
Accepted
s = input() l = r = 0 for i in range(len(s)): if s[i] == "A": l = i break for i in range(len(s)-1, 0, -1): if s[i] == "Z": r = i break print(r-l+1)
p02923
s329777948
Wrong Answer
N = int(input()) H = list(map(lambda h: int(h), input().split(" "))) lower = [0] movable = 0 for i in range(len(H) - 1): if H[i] >= H[i + 1]: movable += 1 else: lower.append(movable) movable = 0 print(max(lower))
p03041
s878973943
Accepted
n,k = map(int,input().split()) s = input() ss = s.lower() ans = "" for i in range(n): ans += ss[i] if i == k-1 else s[i] print(ans)
p04034
s167015103
Accepted
def solve(): N, M = map(int, input().split()) num = [] red = [] for i in range(N+1): num.append(1) red.append(0) red[1] = 1 for _ in range(M): x, y = map(int, input().split()) if red[x] == 1: red[y] = 1 num[x] -= 1 num[y] += 1 if num[x] == 0: red[x] = 0 return sum(red) print(solve())
p02665
s506539082
Accepted
n = int(input()) A = list(map(int,input().split())) Can = [0]*n ans = 0 can = 1 for i,a in enumerate(A): if can < a: print(-1) exit(0) elif i < n: can -= a can *= 2 Can[i] = can real = A[-1] for i in range(n-1,-1,-1): ans += real real = min(real,Can[i]//2) real += A[i] print(ans + 1)
p03359
s857920090
Accepted
n,m = map(int, input().split()) if n<=m: print(n) else: print(n-1)
p02924
s957293154
Wrong Answer
n = int(input()) if n == 1: print("0") else: ans = (n-1)*n/2 print(int(ans))
p03077
s455941423
Accepted
n = int(input()) t_list = [int(input()) for nesya in range(5)] z = min(t_list) for t in t_list: if z == t: if n%t == 0: t_ = n//t else: t_ = n//t+1 print(t_ + 4) break
p03059
s400017685
Wrong Answer
A,B,D=map(int,input().split()) count=0 D+=0.5 while True: if D-A>=1: count+=1 D-=A else: print(count*B) exit()
p03037
s174935187
Accepted
n,m = map(int,input().split()) left = 0 right = n for i in range(m): l,r = map(int,input().split()) left = max(left,l) right = min(right,r) print(max(0,right-left+1))
p02899
s007244993
Accepted
n = int(input()) k = list(map(int,input().split())) l = [0 for i in range(n)] for i in range(n): l[k[i]-1] = i + 1 for i in range(n): print(l[i],end=" ")
p03624
s863143845
Wrong Answer
s = input() ss = sorted(set(s)) cnt = ord('a') for c in ss: if ord(c) == cnt: cnt += 1 else: print(chr(cnt)) exit() if cnt == ord('z'): print('None') else: print(chr(cnt))
p03493
s686530466
Accepted
s = input () c = 0 for i in range (3): if s[i] == '1': c += 1 print (c)
p02646
s046816296
Wrong Answer
arr1 = list(map(int,input().strip().split())) arr2 = list(map(int,input().strip().split())) time = int(input()) oni = arr1[0]+arr1[1]*time nige = arr2[0]+arr2[1]*time print(oni) print(nige) if oni >= nige: print('Yes') else: print('No')
p03474
s249906482
Accepted
a,b = map(int,input().split()) l = list(input()) for i in range(a+b+1): if i == a: if l[i] != "-": print("No") exit() else: if l[i] == "-": print("No") exit() print("Yes")
p02596
s030623788
Accepted
k = int(input()) m = 0 for i in range(1, 10**7): n = m *10 +7 m = n % k if m == 0: print(i) exit(0) print(-1)
p02660
s897971526
Accepted
n = int(input()) cnt = 0 def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr.append([n, 1]) return arr a = factorization(n) c = 0 for i in a: k = 1 x = i[1] while x >= 0: x -= k if x < 0: break c += 1 k += 1 if n == 1: print (0) else: print (c)
p03723
s216789423
Accepted
a,b,c = map(int,input().split()) if a == b == c: if a % 2 == 0: print(-1) exit(0) else: print(0) exit(0) ans = 0 while a % 2 == 0 and b % 2 == 0 and c % 2 == 0: al = b // 2 + c // 2 bl = a // 2 + c // 2 cl = a // 2 + b // 2 a = al b = bl c = cl ans += 1 print(ans)
p02597
s549518339
Wrong Answer
N = int(input()) S = input() def calculate(n, s): arr = list(s) result = [] leftW = 0 rightR = arr.count('R') for i in range(n): val = arr[i] if val == 'R': rightR -= 1 if val == 'W': leftW += 1 result.append(max(leftW,rightR)) if len(result) == 0: print(-1) else: print(min(result)) calculate(N, S)
p03485
s005493091
Accepted
import math a,b = map(int,input().split()) print(math.ceil((a+b)/2))
p02726
s275028805
Accepted
N,X,Y = map(int,input().split()) d=[0]*(N-1) for i in range(N-1): for j in range(i+1,N): d[min(j-i-1,abs(X-1-i)+abs(Y-1-j))]+=1 for i in range(N-1): print(d[i])
p03211
s853818717
Wrong Answer
s=input() l=len(s) ans=float('inf') for i in range(l-2): x=int(s[i:i+3]) ans=min(ans, x) print(ans)
p03281
s572063953
Wrong Answer
import math def countDividers(n): divisors = [] for i in range(1, int(math.sqrt(n))): if n % i == 0: divisors.append(i) divisors.append(int(n/i)) return len(divisors) if __name__ == '__main__': n = int(input()) count = 0 for i in range(1,n+1): if i %2 ==1 and countDividers(i) == 8: count += 1 print(count)
p03605
s035999349
Wrong Answer
a = input() if a[0] == 9 or a[1] == 9: print('No') else: print('Yes')
p03910
s866799468
Wrong Answer
n = int(input()) tmp = 0 li = [] for i in range(n): if i*(i+1)/2 >= n: tmp = i break new_li = [x for x in range(1,tmp+1)] #print(new_li) if sum(new_li) - n > 0: new_li.remove(sum(new_li) - n) if n == 1: print(1) else: for n in new_li: print(n)
p02911
s485274645
Accepted
import numpy as np n, k, q = map(int, input().split()) A = [k for _ in range(n)] for i in range(q): t = int(input()) A[t-1] +=1 for i in range(n): if A[i]-q > 0: print('Yes') else : print('No')
p02584
s639313197
Wrong Answer
x,k,d = map(int,input().split()) jud = x//d +1 if(k<=jud): print(abs(abs(x)-d*k)) else: if((k-jud)%2 == 1): print(abs(abs(x)-(jud-1)*d)) else: print(abs(abs(x)-(jud)*d))
p02657
s847653391
Accepted
A,B = map(int,input().split()) print(A*B)
p02732
s460851570
Accepted
import math from collections import Counter N = int(input().strip()) A = list(map(int, input().strip().split())) def cmb(r,k): if r < k: return 0 return math.factorial(r) // math.factorial(r-k) // math.factorial(k) c = Counter() for a in A: c[a] += 1 al = 0 for v in c.values(): al += cmb(v,2) for k in range(N): print(al - (c[A[k]]-1))
p02647
s407344210
Accepted
from itertools import accumulate n,k = map(int, input().split()) As = list(map(int, input().split())) for i in range(k): imos = [0] * (n+1) for i,a in enumerate(As): l = max(0, i-a) r = min(n, i+a+1) imos[l] += 1 imos[r] -= 1 acc = list(accumulate(imos)) # 指数関数的に増える if acc[:-1] == As: print(*As) exit() As = acc[:-1] print(*As)
p02742
s519324104
Accepted
[H,W] = list(map(int,input().split(' '))) K = int((H*W+1)*0.5) if H==1 or W==1:print(1) else:print(K)
p02784
s685255059
Accepted
H, N = map(int, input().split()) A = list(map(int, input().split())) if sum(A) >= H: print('Yes') else: print("No")
p03944
s102284813
Accepted
w,h,n = map(int, input().split()) x1,x2,y1,y2 = 0,0,0,0 for _ in range(n): x,y,a = map(int, input().split()) if a == 1: x1 = max(x1, x) if a == 2: x2 = max(x2, w-x) if a == 3: y1 = max(y1, y) if a == 4: y2 = max(y2, h-y) w -= x1+x2 h -= y1+y2 if w > 0 and h > 0: print(w*h) else: print(0)
p03261
s869157327
Accepted
n = int(input()) w = [input() for _ in range(n)] if len(set(w)) != n: print('No') exit() for i in range(1, n): if w[i][0] != w[i - 1][-1]: print('No') exit() print('Yes')
p03221
s884657897
Accepted
n,m=map(int,input().split()) c=[[] for _ in range(n)] for i in range(m): p,y=map(int,input().split()) c[p-1].append([i,y]) ans=[0]*m for i in range(n): c[i].sort(key=lambda x:x[1]) for j in range(len(c[i])): ID=str(i+1).zfill(6)+str(j+1).zfill(6) ans[c[i][j][0]]=ID print(*ans,sep="\n")
p02963
s581852661
Accepted
#!/usr/bin/env python3 s = int(input()) if s <= 10**9: print(s, 0, 0, 0, 0, 1) else: print(10**9, 1*(s<10**18), 10**9 - int(str(s)[-9:]), s // 10**9 + 1*(s<10**18),0,0)
p03030
s914858421
Accepted
N = int(input()) S = [] for i in range(1, N+1): C, P = input().split() s = [i, C, int(P)] S.append(s) S.sort(key=lambda x: (x[1], -(x[2]))) for i in S: print(i[0])
p03761
s905559521
Accepted
n = int(input()) l = list(input()) m = [] for i in range(n - 1): ref = list(input()) for j in ref: if j in l: m.append(j) l.remove(j) l = m m = [] l.sort() print("".join(l))
p02693
s281044075
Accepted
def main(): K = int(input()) a, b = map(int, input().split()) flag = False for i in range(a, b+1): if i % K == 0: flag = True if flag:print("OK") else:print("NG") if __name__ == "__main__": main()
p02720
s783582303
Wrong Answer
c=0 a = int(input()) for i in range(1,100001): f=0 if i>12: l = [int(x) for x in list(str(i))] for j in range(1,len(str(i))): if abs(l[j-1]-l[j])>1: f=1 if f==0: c+=1 if c==a: print(i) break
p02572
s584299079
Accepted
n=int(input()) a=list(map(int, input("").split())) o=0 aa=[] for i in a: aa.append(i**2) s=sum(a) o=(s**2-sum(aa))//2 o%=10**9+7 print(o)
p02783
s100266968
Accepted
hp, attack = map(int, input().split()) print(hp // attack ) if hp % attack == 0 else print(hp // attack + 1)
p02784
s748556062
Accepted
H,N = map(int,input().split(" ")) A = tuple(map(int,input().split(" "))) dam = sum(A) if H <= dam: print('Yes') else: print('No')
p02595
s733319313
Wrong Answer
import math n,d=map(int,input().split()) count=0 for i in range(n): x,y=map(int,input().split()) p=math.ceil(math.pow(x,2)+math.pow(y,2)) r=math.ceil(math.sqrt(p)) if(r==d): count+=1 print(count)
p02861
s804635253
Wrong Answer
import math n=int(input()) e = [[int(i) for i in input().split()] for i in range(n)] c=0 for i in range(n): for j in range(n): if i!=j: c+=math.sqrt((e[i][0]-e[j][0])**2+(e[i][1]-e[j][1])**2) print(c) print(c/n)
p02612
s087375981
Wrong Answer
a=int(input()) b=a//1000 c=b+1 d=c*1000-a print(d)
p03623
s750289109
Accepted
x,a,b = map(int, input().split()) print('A' if abs(x-a) < abs(x-b) else 'B')
p02836
s599155639
Accepted
s = input() a = 0 for i in range(len(s)): if s[i] != s[-i-1]: a += 1 print(a//2)
p03041
s871954842
Wrong Answer
n,k=map(int,input().split());s=input();print(s[k-1].lower())
p03145
s204681790
Accepted
n = list(map(int, input().split())) n.sort() print(n[0]*n[1]//2)
p03107
s534418745
Wrong Answer
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collections import deque from operator import itemgetter from itertools import permutations mod = 10**9 + 7 inf = float('inf') def I(): return int(sys.stdin.readline()) def LI(): return list(map(int,sys.stdin.readline().split())) s = input() n = len(s) ans = 0 for i in range(n-1): if s[i] != s[i-1]: ans += 1 print(2*ans)
p02900
s595786419
Accepted
import sys import math input = lambda: sys.stdin.readline().rstrip() def factorize(n): b = 2 fct = set() while b * b <= n: while n % b == 0: n //= b fct |= set([b]) b = b + 1 if n > 1: fct |= set([n]) return fct def solve(): A, B = map(int, input().split()) ap = factorize(A) bp = factorize(B) ans = 1 + len(ap & bp) print(ans) if __name__ == '__main__': solve()
p04020
s944359870
Wrong Answer
R=[0] L=list() N=int(input()) for i in range(N): k=int(input()) L.append(k) if k==0: R.append(len(L)) S=sum(L) R.append(N) for i in range(len(R)-1): if sum(L[R[i]-1:R[i+1]])%2==1: S=S-1 print(S//2)
p03817
s724183889
Accepted
from math import ceil n = int(input()) # ans = ceil(n / 11) * 2 # print(ceil(n / 11) * 2, (n // 11) * 2) ans = (n // 11) * 2 rem = n % 11 if rem == 0: ans = ans elif rem <= 6: ans = ans + 1 else: ans = ans + 2 print(ans)
p02697
s917752922
Wrong Answer
N, M = map(int, input().split()) data = [[0] * 2 for _ in range(M)] for i in range(M): data[i][0] = i + 1 data[i][1] = N - (i) for i in range(M): print("{} {}".format(data[i][0], data[i][1]))
p02813
s990997609
Wrong Answer
from itertools import permutations n = int(input()) p = list(map(int, input().split())) q = list(map(int, input().split())) ret = [i for i in range(1, n + 1)] a = 0 b = 0 perm_list = permutations(ret) for i, j in enumerate(perm_list): if p == list(j): a = i elif q == list(j): b = i print(abs(a-b))
p03146
s360107856
Wrong Answer
a=int(input()) ans=1 while True: if a==4: break elif a%2==0: a=a/2 ans+=1 else: a=3*a+1 ans+=1 print(ans+3)
p03221
s022411337
Wrong Answer
n, m = map(int, input().split()) l = [list(map(int, input().split(' '))) for _ in range(m)] l = sorted(l) #print(n,m) #print(l) x = l[0][0] y = 1 #print(x) for i in range(m): if l[i][0] == x: l[i][1] = y y += 1 else: y = 1 l[i][1] = y y += 1 x = l[i][0] #print(l) for j in range(m): print(str(l[j][0]).rjust(6,'0') + str(l[j][1]).rjust(6,'0'))
p03106
s303737558
Accepted
a,b,k=map(int,input().split()) syou=[] for i in range(1,101): if a%i==0 and b%i==0: syou.append(i) #print(syou) print(syou[-k])
p03827
s273482761
Accepted
N = int(input()) S = input() x = 0 ans = 0 for i in range(len(S)): if S[i] == 'I': x += 1 ans = max(x, ans) else: x -= 1 print(ans)
p02766
s787346629
Accepted
n, k = map(int, input().split()) cnt = 0 while n >= k**cnt: cnt += 1 print(cnt)
p03043
s302682873
Accepted
import math n,k=map(int,input().split()) n_lis=[int(i) for i in range(1,n+1)] p=float(1/n) p_lis=[] for i in range(n): if n_lis[i]<k: atai=float(k/n_lis[i]) kaisu=-(-math.log(atai,2)//1) # loop処理しなくてよいので記述が楽 p_lis.append((1/2)**(kaisu)) else: p_lis.append(1) print(p*sum(p_lis))
p03817
s664964774
Accepted
#!/usr/bin/env python3 x = int(input()) if x % 11 == 0: tmp = 0 elif x % 11 < 7: tmp = 1 else: tmp = 2 print(x//11 * 2 + tmp)
p02832
s712542615
Accepted
N = int(input()) a = list(map(int,input().split())) tmp = 1 ans = 0 for i in range(N): if a[i] == tmp: tmp += 1 else: ans += 1 if tmp == 1: print(-1) exit() print(ans)
p02683
s743745922
Wrong Answer
# C Skill Up def list_add(li1, li2): return [a+b for a, b in zip(li1, li2)] N, M, X = map(int, input().split()) data = [] for n in range(N): data.append(list(map(int, input().split()))) ans = 100000 * N for c in range(1 << N): x = [0] * M yen = 0 for i, n in enumerate(format(c, f"{N}b")): if n == "1": yen += data[i][0] x = list_add(x, data[i][1:]) for xm in x: if xm < X: break else: ans = min(ans, yen) if ans == 100000 * N: print(-1) else: print(ans)
p03103
s124696218
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(): N, M = map(int, readline().split()) d = map(int, read().split()) AB = list(zip(d, d)) AB = sorted(AB) have = 0 price = 0 for x, y in AB: if M - have < y: price += x * (M - have) break else: price += x * y have += y print(price) main()
p02854
s818262020
Accepted
n = int(input()) a = list(map(int, input().split())) m = sum(a) // 2 s = sum(a) temp = 0 for x in a: temp += x if temp > m: H = temp L = temp - x break print(min(H * 2 - s, s - L * 2))
p02909
s822343244
Accepted
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) #空白あり def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし d = {'Sunny':'Cloudy','Cloudy':'Rainy','Rainy':'Sunny'} print(d[S()])
p03720
s265283294
Accepted
N, M = map(int, input().split()) lis = [] for i in range(M): lis += map(int, input().split()) for j in range(N): print(lis.count(j+1))
p03261
s928964905
Wrong Answer
N=int(input()) H=input() word=[] for i in range(N-1): S=input() if S in word: print('No') exit() else: if H[-1]==S[0]: H=S word.append(H) else: print('No') exit() print('Yes')
p03817
s543884954
Accepted
x = int(input()) cnt = x // 11 * 2 mod = x % 11 print(cnt + -(-mod//6))
p02866
s972223442
Wrong Answer
import collections n = int(input()) d = list(map(int,input().split())) mod = 998244353 ans = 1 c = collections.Counter(d) if c[0] != 1: ans = 0 if c[1] == 0: ans = 0 x = 1 for i in range(1,max(d)+1): if c[i] == 0: ans = 0 break ans *= pow(c[i-1],c[i],mod) x += c[i] ans %= mod print(ans%mod)
p03617
s067970627
Wrong Answer
Q, H, S, D = map(int, input().split()) N = int(input()) c_05 = min(2*Q, H) c_1 = min(2*c_05, S) if c_1 <= D: print(c_1 * N) else: if N % 2 == 0: print(D * (N//2)) else: print(D * (N//2) + c_1)
p03163
s026583878
Wrong Answer
import numpy as np # 入力 n, w = map(int, input().split()) wv = np.array([list(map(int, input().split())) for i in range(n)]) dp = np.zeros((w + 1, n + 1)) for i in range(1, n + 1): dp[:, i] = dp[:, i - 1] wNew, vNew = wv[i - 1, 0], wv[i - 1, 1] dp[wNew:, :] = np.fmax(dp[wNew:, :], vNew + dp[:-wNew, :]) print(dp[w, n])
p04044
s279249229
Accepted
# 入力 N,L=map(int,input().split()) l=[] for i in range(N): l.append(input()) # ソート l.sort() # 出力 print(''.join(l))
p03799
s763283345
Wrong Answer
n, m = map(int, input().split()) ans = 0 ans += n m-=2*n ans+=m//4 print(ans)
p02971
s487110920
Accepted
n = int(input()) a = [int(input()) for i in range(n)] b = sorted(a) for i in range(n): if a[i] == b[-1]: print(b[-2]) else: print(b[-1])
p02918
s673728689
Accepted
n,k=list(map(int,input().split())) s=input() temp="" happy=0 zig=0 for i in s: if temp==i: happy+=1 else: temp=i print(n-1 if happy+k*2>=n-1 else happy+k*2)
p03109
s284971546
Accepted
s = [int(i) for i in input().split('/')] if s[1] <= 4: print('Heisei') else: print('TBD')
p02578
s958727373
Accepted
N = int(input()) A = list(map(int,input().split())) hight = A[0] base = 0 for i in range(1,N): if A[i] < hight: base += hight - A[i] else: hight = A[i] print(base)
p03456
s431885803
Accepted
import math d = input() n1, n2 = d.split(" ") num = n1 + n2 square = math.sqrt(int(num)) if square.is_integer(): print("Yes") else: print("No")
p02658
s539085342
Wrong Answer
a=int(input()) A=list(map(int,input().split())) ans=1 for x in A: ans*=x if ans>10**18: break if ans>10**18: print(-1) else: print(ans)
p04029
s241351893
Accepted
N = int(input()) print(N * (N + 1) //2)
p03659
s863748958
Accepted
n = int(input()) a = list(map(int, input().split())) total = sum(a) s = 0 ans = 10**9 * 2 * 10**5 for i in range(0, n-1): s += a[i] ans = min(ans, abs(s - (total-s))) print(ans)
p03030
s744465015
Accepted
n = int(input()) guide = [] for i in range(n): restaurant = [] s, p = input().split() p_1 = int(p) restaurant.append(s) restaurant.append(p_1) x = i+1 restaurant.append(x) guide.append(restaurant) sort_guide = sorted(guide, key=lambda x:(x[0],-x[1])) for i in range(len(sort_guide)): print(sort_guide[i][2])
p03437
s591467439
Wrong Answer
x, y = map(int, input().split()) if x%y == 0: print(-1) else: print(x+1)
p03627
s696542702
Accepted
from collections import Counter N = int(input()) A = list(map(int, input().split())) acnt = Counter(A) b = [] for k, v in acnt.items(): if v < 2: continue if v >= 4: b.append(k) b.append(k) b.sort() if len(b) < 2: print(0) else: print(b[-1]*b[-2])
p02657
s265413719
Accepted
M, N = map(int, input().split()) print(M*N)
p02838
s504569671
Wrong Answer
import numpy as np N = int(input()) A = np.array(list(map(int, input().split()))) Cn, ans = N * (N-1) // 2, 0 for i in range(60): count = np.sum(A % 2) A //= 2 if count == 0: continue ans += (Cn - (count*(count-1)//2 + (N-count)*(N-count-1)//2)) * (2**i) print(ans % (10**9 + 7))
p02729
s363588989
Wrong Answer
N,M = map(int,input().split()) print(N/2+M/2)
p02664
s121051960
Wrong Answer
print(input().replace('?', 'P'))