problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02577
s826092087
Wrong Answer
n = input() print(n) sum = 0 for i in range(len(n)): sum += int(i) if(sum%9 == 0): print("Yes") else: print("No")
p03827
s216937874
Accepted
n=int(input()) s=input() list1=[0]*(n+1) ans=0 for i in range(n): if s[i]=='I': ans+=1 else: ans-=1 list1[i]=ans print(max(list1))
p03481
s288577869
Accepted
x,y=map(int,input().split()) ans=0 while x<=y: x*=2 ans+=1 print(ans)
p02732
s991986925
Accepted
n = int(input()) a= list(map(int, input().split())) from collections import Counter c=Counter(a) dic={} for k,v in c.items(): dic[k]=v*(v-1)//2 su=0 for k in dic.values(): su+=k for i in a: print(su-dic[i]+(c[i]-1)*(c[i]-2)//2)
p02676
s292638159
Wrong Answer
n = int(input()) s = input() len1 = len(s) print(len1) if(len1>=n): print(s[0:n]+"...") else: print(s)
p02694
s192006029
Wrong Answer
x = int(input()) a = 100 ans = 0 while a <= x: a = a * 1.01 ans += 1 print(ans)
p02933
s633541836
Accepted
# -*- coding: utf-8 -*- def main(): a = int(input()) s = input() if a >= 3200: ans = s else: ans = 'red' print(ans) if __name__ == "__main__": main()
p02577
s980890970
Accepted
a = int(input()) print("Yes" if a % 9 == 0 else "No")
p02694
s095483529
Accepted
import math x = int(input()) x_cnt = 100 cnt = 0 while(x_cnt < x): x_cnt = math.floor(x_cnt * 1.01) cnt += 1 print(cnt)
p03427
s070565614
Accepted
S=input() N=int(S) k=len(S) dp = [[-1] * 2 for _ in range(k+1)] dp[0][0] = 0 for i in range(k): c = int(S[i]) dp[i+1][0] = dp[i][0] + c dp[i+1][1] = dp[i][1] if dp[i][1] >= 0: dp[i+1][1] = max(dp[i+1][1], dp[i][1] + 9) if c >= 1: dp[i+1][1] = max(dp[i+1][1], dp[i][0] + c-1) print(max(dp[k][0], dp[k][1]))
p03645
s305141356
Accepted
N,M=map(int,input().split()) ship=[list(map(int,input().split())) for _ in range(M)] port1=[] port2=[] for i in range(M): if ship[i][0]==1: port1.append(ship[i][1]) if ship[i][1]==N: port2.append(ship[i][0]) port1=set(port1) port2=set(port2) if len(port1&port2)>0: print("POSSIBLE") else: print("IMPOSSIBLE")
p02784
s076220237
Accepted
a,b=map(int,input().split()) n=list(map(int,input().split())) if a<=sum(n): print('Yes') else: print('No')
p03680
s746182875
Wrong Answer
import sys input = sys.stdin.readline N = int(input().rstrip()) a_dict = {} for i in range(N): a_dict[i+1] = int(input().rstrip()) target = 1 next_target = a_dict[target] cont = True ans = 0 while cont: target = next_target next_target = a_dict[target] ans += 1 del a_dict[target] if next_target not in a_dict: ans = -1 cont = False elif next_target == 2: ans += 1 cont = False print(ans)
p03680
s527319285
Wrong Answer
n = int(input()) a = [] for i in range(n): a.append(int(input())) visited = set() count = 0 next = 1 while True: count += 1 visited.add(next) next = a[next-1] if next == 1: print(count) exit(0) if next in visited: print(-1) exit(0)
p03150
s414075071
Accepted
import sys import copy import math import itertools import numpy as np import re S = input() s = "keyence" for i in range(len(S)): if re.fullmatch(s[:i]+".*"+s[i:],S): print("YES") sys.exit(0) print("NO")
p02578
s934266438
Accepted
n = int(input()) a = [int(i) for i in input().split()] m = a[0] sum = 0 for i in a[1:]: if i <= m: sum += m - i else: m = i print(sum)
p04031
s865566084
Wrong Answer
n = int(input()) a = sorted([int(i) for i in input().split()]) b = list(range(a[0], a[-1] + 1)) l = len(b) if l == 0: print(0) else: m1 = b[l // 2] m2 = b[l // 2 - 1] c1, c2 = 0, 0 for i in range(n): c1 += (a[i] - m1) ** 2 c2 += (a[i] - m2) ** 2 print(min(c1, c2))
p02546
s685044392
Accepted
a = input() if a[-1] == 's': print(a + 'es') else: print(a + 's')
p03799
s447259361
Accepted
s ,c = map(int,input().split()) ans = 0 if s*2 <= c: ans += s c -= s*2 # sと組んだ後の残り ans += c // 4 else: # sが余るパターン ans += c // 2 print(ans)
p02718
s466732154
Accepted
n,m = map(int,input().split()) a = list(map(int, input().split())) popular = list(filter(lambda e: e>=(1/(4*m))*sum(a),a)) print("Yes" if len(popular) >= m else "No")
p03286
s452608674
Accepted
N = int(input()) S = "" while N!=0: if N&1: S = "1"+S N = (N-1)//(-2) else: S = "0"+S N = N//(-2) print(0 if S=="" else S)
p03943
s723581090
Accepted
a=[int(i) for i in input().split()] res=False for i in range(3): if a[i]*2==sum(a):res=True print("Yes"if res else"No")
p03944
s387043474
Wrong Answer
rx, uy, n = map(int, input().split()) dy = 0 lx = 0 for idx1 in range(n): x, y, a = map(int, input().split()) if a == 1: if lx < x: lx = x elif a == 2: if rx > x: rx = x elif a == 3: if dy < y: dy = y else: if uy > y: uy = y mul = (uy - dy) * (rx - lx) if mul < 0: print(0) else: print(mul)
p02732
s177119035
Wrong Answer
import numpy as np N=int(input()) A=list(map(int,input().split())) b=np.zeros(N) for i in range(N): b=np.zeros(N) b[i]=A.count(i+1) tmp=0 for j in range(N): if(i==j): tmp=tmp+(b[j]-1)*(b[j]-2)/2 else: tmp=tmp+b[j]*(b[j]-1)/2 print(int(tmp))
p03836
s716495064
Wrong Answer
sx,sy,tx,ty = map(int, input().split( )) u = ty-sy r = tx-sx print("R"* r+ "U"*u + "L"*r + "D"*u + "D" + "R"* (r+1)+ "U"*(u+1) + "L" + "U" + "L"*r + "D"*(u+1) +"R")
p02843
s722705308
Accepted
# import bisect # from collections import Counter, deque # import copy # from heapq import heappush, heappop, heapify # from fractions import gcd # import itertools # from operator import attrgetter, itemgetter # import math import sys # import numpy as np ipti = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): x = int(input()) for i in range(1, 1000): x_min = 100 * i x_max = 105 * i if x_min <= x <= x_max: print(1) sys.exit() print(0) if __name__ == '__main__': main()
p03494
s828626110
Wrong Answer
N = int(input()) A = list(map(int,input().split())) n = 0 can = True while can: for i in range(N): if A[i]%2 != 0: can = False break if A[i]%2 == 0: A[i] = A[i] // 2 n += 1 else: can = False break print(n)
p03860
s031459335
Accepted
a,s,c = input().split() print(a[0]+s[0]+c[0])
p02924
s613858454
Accepted
N = int(input()) print((N-1)*N // 2)
p02759
s871863717
Accepted
page = int(input()) paper = page // 2 a = page % 2 if a != 0: paper += 1 print(paper)
p02831
s213336284
Wrong Answer
def lcm(x,y): for i in range(1,10**5+1): if i%x==0: if i%y==0: return(i) break A,B=map(int,input().split()) print(lcm(A,B))
p02547
s396007019
Accepted
n = int(input()) # nは入力回数 num_list = [list(map(int, input().split())) for _ in range(n)] ans = "No" for i in range(n-2): if num_list[i][0] == num_list[i][1] and num_list[i+1][0] == num_list[i+1][1] and num_list[i+2][0] == num_list[i+2][1]: ans = "Yes" print(ans)
p02707
s072231482
Accepted
n=int(input()) a=list(map(int,input().split(" "))) countlist=[0 for i in range(n)] for j in range(n-1): countlist[a[j]-1]+=1 for i in range(n): print(countlist[i])
p03804
s988990965
Wrong Answer
N, M = map(int, input().split()) A = [input() for _ in range(N)] B = [input() for _ in range(M)] exist = False for i in range(N-M+1): for j in range(N-M+1): match = True for k in range(M): for l in range(M): if A[i][j] != B[k][l]: match = False if match: exist = True if exist: print('Yes') else: print('No')
p03838
s058438448
Accepted
x, y = map(int, input().split()) count = abs(abs(x) - abs(y)) if x*y >= 0 and y > x: print(y - x) elif (0<y and 0<x) or (0>x and 0>y): print(count+2) else: print(count+1)
p03252
s507952705
Accepted
S, T = input(), input() d = dict() count = 0 S_list = [] for c in S: try: n = d[c] except: d[c] = n = count count += 1 S_list.append(n) d = dict() count = 0 for m, c in zip(S_list, T): try: n = d[c] except: d[c] = n = count count += 1 if n != m: print("No") break else: print("Yes")
p02700
s178241559
Wrong Answer
a, b, c, d=map(int, input().split()) if (a+b)%2 ==1 and (c+d)%2==0 or (a+b)%2==(c+d)%2: print("No") else: print("Yes")
p03329
s040181889
Accepted
N = int(input()) upper = [1] for cnt in [6, 9]: tmp = cnt while tmp <= 10 ** 5: upper.append(tmp) tmp *= cnt dp = [float("inf")] * (10 ** 5 + 1) dp[0] = 0 for u in upper: dp[u] = 1 for i in range(2, N + 1): for u in upper: if i - u > 0: tmp = dp[i - u] + 1 if tmp < dp[i]: dp[i] = tmp print(dp[N])
p03672
s567212605
Wrong Answer
s=input() for i in range(len(s)-2,0,-2): s1=s[:i:] #print(s1,s1[:i//2],s1[i//2:]) if s1[:i//2]==s1[i//2:]:print(i)
p03438
s903835932
Wrong Answer
N=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) d=[] for i in range(N): d.append(a[i]-b[i]) cnt=-sum(d) p=0 n=0 for j in range(N): if d[j]>0: p+=d[j] if d[j]<0: n+=-d[j]//2 if p<=cnt and n<=cnt: print("Yes") else: print("No")
p03665
s826245751
Wrong Answer
N, P = map(int, input().split()) A = list(map(lambda x: int(x)%2, input().split())) print(2**(N-1))
p03419
s108776382
Wrong Answer
n, m = map(int, input().split()) if n == 1 or m == 1: print(n*m - 2) else: print(n*m - (n*2+m*2-4))
p03673
s496492754
Accepted
import sys read_=sys.stdin.buffer.readline N=int(read_()) A=input().split() if len(A)==1: print(A[0]) exit() if N%2==0: ans=A[1::2][::-1] ans.extend(A[::2]) else: ans=A[::2][::-1] ans.extend(A[1::2]) print(' '.join(ans))
p02838
s342330758
Accepted
N = int(input()) a_array = list(map(int, input().split())) P = 10 ** 9 + 7 mod_array = [0] * 60 digit_array = [0] * 60 p = 1 for i in range(60): mod_array[i] = p p = (p * 2) % P for a in a_array: for i in range(60): digit_array[i] += (a & (1 << i)) >> i # print(digit_array) ans = 0 for i in range(60): ans = (ans + mod_array[i] * digit_array[i] * (N - digit_array[i]) % P) % P print(ans)
p02989
s214219028
Wrong Answer
N=int(input()) d=list(map(int, input().split())) d=sorted(d) ans=0 for i in range(10**5): if d[int(N/2-1)] < i and i <= d[int(N/2)]: ans +=1 print(ans)
p03796
s157723358
Accepted
from math import factorial n = int(input()) print(factorial(n)%(10**9+7))
p03854
s360884684
Accepted
# coding: utf-8 """this is python work script""" def solver(word): """solve this problem""" check_result = word.replace('eraser', '').replace('erase', '').replace('dreamer', '').replace('dream', '') answer = 'YES' if check_result: answer = 'NO' return answer def main(): """main function""" input_word = input().rstrip() answer = solver(input_word) print(answer) if __name__ == '__main__': main()
p03408
s576747915
Accepted
from collections import defaultdict dic = defaultdict(int) N = int(input()) s = [input() for _ in range(N)] M = int(input()) t = [input() for _ in range(M)] for i in s: dic[i] += 1 for i in t: dic[i] -= 1 ans = 0 for k, v in dic.items(): ans = max(ans, v) print(ans)
p03836
s696545282
Accepted
sx,sy,tx,ty=map(int,input().split()) dx=tx-sx dy=ty-sy ans = "U"*dy + "R"*dx+"D"*dy+"L"*dx ans+="L" + "U"*dy + "U"+"R"+"R"*dx+"D" ans+="R"+"D"*dy+"D"+"L"+"L"*dx+"U" print(ans)
p02801
s173550599
Accepted
alpha = "abcdefghijklmnopqrstuvwxyz" C = input() print(alpha[alpha.index(C)+1])
p02731
s460635368
Wrong Answer
l=int(input()) ans=0 for i in range(l): for j in range(l-i): ans=max(ans,i*j*(l-i-j)) print(ans)
p02660
s569415023
Accepted
import math a=int(input()) ans=0 for i in range(1,int(math.sqrt(a)),1): if a%i==0 and not i==1: cnt=0 while a%i==0: cnt+=1 a=a/i ans+=(math.sqrt(2*cnt+0.25)-0.5)//1 if not a==1: print(int(ans+1)) else: print(int(ans))
p03817
s321636524
Accepted
import sys, math from itertools import combinations sys.setrecursionlimit(500000) MOD = 10**9+7 def input(): return sys.stdin.readline()[:-1] def mi(): return map(int, input().split()) def ii(): return int(input()) def i2(n): tmp = [list(mi()) for i in range(n)] return [list(i) for i in zip(*tmp)] def main(): x = ii() a = x//11 b = x%11 if b > 6: print(2*a+2) elif b > 0: print(2*a+1) else: print(2*a) if __name__ == '__main__': main()
p03338
s612563943
Accepted
n = int(input()) s = list(input()) ans = 0 for i in range(1, n): x = s[:i] y = s[i:] temp = 0 for ch in range(26): if chr(ch + 97) in x and chr(ch + 97) in y: temp += 1 ans = max(ans, temp) print(ans)
p03524
s736446217
Accepted
s = input() l = [s.count("a"), s.count("b"), s.count("c")] print ("NO") if max(l) - min(l) >= 2 else print ("YES")
p03681
s239690186
Accepted
from math import factorial mod = 10 ** 9 + 7 n, m = map(int, input().split()) print( ((factorial(n) % mod) ** 2 % mod) * 2 % mod if n == m else (factorial(n) % mod) * (factorial(m) % mod) % mod if abs(n - m) == 1 else 0 )
p04020
s051607464
Accepted
N = int(input()) a = [int(input()) for _ in range(N)] + [0] ans = 0 for i in range(N): if a[i] != 0: add, mod = divmod(a[i], 2) ans += add if a[i + 1] != 0: a[i + 1] += mod print(ans)
p02753
s265873848
Accepted
s = input() pre = s[0] for a in s[1:]: if pre != a: print("Yes") exit() pre = a print("No")
p03160
s107767061
Accepted
n = int(input()) h = list(map(int,input().split())) dp=[10**10]*(n+2) dp[0]=0 dp[1]=0 dp[2]=abs(h[1]-h[0]) for i in range(3,n+1): dp[i]=min(dp[i],dp[i-1]+abs(h[i-1]-h[i-2]),dp[i-2]+abs(h[i-1]-h[i-3])) print(dp[n])
p02777
s302291905
Accepted
S,T = input().split() A,B = map(int,input().split()) U = input() ans1 = A ans2 = B if S==U: ans1 -= 1 else: ans2 -= 1 print(ans1, ans2)
p03804
s263864800
Accepted
N, M = map(int, input().split()) A = [''] * N B = [''] * M for i in range(N): A[i] = input() for i in range(M): B[i] = input() match_cnt = 0 for i in range(N - M + 1): for j in range(N - M + 1): flag = True for y in range(M): if A[y + i][j:j + M] != B[y]: flag = False if flag: match_cnt += 1 if match_cnt > 0: print('Yes') else: print('No')
p02658
s293000579
Wrong Answer
N = int(input()) mlist = list(map(int,input().split())) s = 1 for i in range(N): if mlist[i] == 0: print(0) break elif s > 0: s *= mlist[i] if s >= 10**18: s = -1 if i == N-1: print(s)
p02982
s268778002
Accepted
N,D = map(int,input().split()) # 2次元配列 x = [] for i in range(N): array = list(map(int, input().strip().split())) x.append(array) ans = 0 for i in range(N): for j in range(i+1,N): distance = 0 for y,z in zip(x[i],x[j]): distance += (y-z)**2 d = distance**0.5 if d.is_integer(): ans += 1 print(ans)
p03309
s817444447
Wrong Answer
N = int(input()) A = list(map(int, input().split())) A = [x-i-1 for i, x in enumerate(A)] R = round(sum(A)//N) print(sum(abs(a-R) for a in A))
p03494
s162471662
Accepted
n=int(input()) s=list(map(int,input().split())) f=False c=0 while True: for x in range(n): if s[x]%2==0:s[x]=s[x]//2 else:f=True if f: print(c) break c+=1
p03944
s032899279
Accepted
# https://atcoder.jp/contests/abc047/tasks/abc047_b w, h, n = [int(i) for i in input().split()] left = 0 right = w bottom = 0 top = h for _ in range(n): x, y, a = [int(i) for i in input().split()] if a == 1: left = max(left, x) elif a == 2: right = min(right, x) elif a == 3: bottom = max(bottom, y) elif a == 4: top = min(top, y) if top <= bottom or right <= left: print(0) else: print((right - left) * (top - bottom))
p02765
s028945744
Wrong Answer
n,m=map(int,input().split()) if 10<=n: print(m) else: m=m-(10-n)*100 print(m)
p03309
s263054752
Accepted
N = int(input()) A = [int(i) for i in input().split()] for i in range(N): A[i] -= i + 1 A.sort() if N % 2 == 0: ans1 = 0 ans2 = 0 for a in A: ans1 += abs(a - A[N//2]) ans2 += abs(a - A[N//2 - 1]) ans = min(ans1, ans2) else: ans = 0 for a in A: ans += abs(a - A[(N - 1) // 2]) print(ans)
p03449
s839145392
Wrong Answer
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) AS = sum(A) - A[0] BS = sum(B) - B[-1] ame = A[0] for i in range(N-1): if AS >= BS: ame += A[i+1] AS -= A[i+1] BS -= B[i] else: ans = ame + sum(B[i:]) print(ans) exit() print(ame + B[-1])
p02730
s257949685
Accepted
S = input() S1 = S[0:(len(S)-1)//2] S2 = S[(len(S)-1)//2+1:len(S)] def discrimination(S): N = len(S) if N%2==0: return all(S[i]==S[N-1-i] for i in range(N//2)) else: return all(S[i]==S[N-1-i] for i in range((N-1)//2)) if discrimination(S) and discrimination(S1) and discrimination(S2): print("Yes") else: print("No")
p03730
s093202733
Accepted
A,B,C=map(int,input().split()) mod=set() tmp=0 D=A while tmp not in mod: mod.add(tmp) tmp=D%B if tmp==C: print('YES') exit() D+=A print('NO')
p03416
s656434769
Wrong Answer
a,b = map(int,input().split()) t = 0 for i in range(a,b+1): if i % 100 == i // 1000 or i % 100 * 10 == i // 1000: t += 1 print(t)
p03331
s606942812
Accepted
S = input() ansA = 0 ansB = 0 for i in range(len(S)): N = int(S[i]) if N == 1: ansA += 1 elif N % 2 == 0: ansA += N//2 ansB += N//2 else: N -= 1 ansA += N//2+1 ansB += N//2 if ansA == 1 and ansB == 0: ans = 10 else: ans = ansA+ansB print(ans)
p02657
s916218414
Accepted
x = input() a, b = map(int, x.split(" ")) print(a * b)
p02642
s773830699
Accepted
N=int(input()) ls=list(map(int,input().split())) ls.sort() #定数倍のやつに+1する M=max(ls) A=[0]*(M+1) for i in range(N): a=M//ls[i] for j in range(1,a+1): A[j*ls[i]]+=1 ans=0 for i in range(len(ls)): if A[ls[i]]==1: ans+=1 print(ans)
p02546
s428650821
Accepted
################################################ # # # author: raghav_0901 (Raghav Dalmia) # # updated on: 19-09-2020, 5:32:05 pm IST # # # ################################################ from math import * def _in(): return [int(x) for x in input().split(' ')] if __name__ == "__main__": s = input() out = s + ("es" if s[-1] == "s" else "s") print(out)
p02702
s832007659
Wrong Answer
S=input() mem_mod = [0 for i in range(0,2019,1)] N = len(S) counter = 0 S_num_tmp = list(S) S_num = list(map(int, S_num_tmp)) tmp=10
p02748
s852564845
Wrong Answer
a, b, m = map(int, input().split()) As = list(map(int, input().split())) Bs = list(map(int, input().split())) k = [] for i in range(m): t1,t2,t3 = map(int, input().split()) dis = As[t1-1] + Bs[t2-1] - t3 k.append(dis) print(min(k))
p02952
s247190797
Accepted
n = int(input()) count = 0 for i in range(1,n+1): if len(str(i)) % 2 != 0: count += 1 print(count)
p02601
s696931528
Accepted
A, B, C = map(int, input().split()) K = int(input()) count = 0 while not A < B: B *= 2 count += 1 while not B < C: C *= 2 count += 1 if count <= K and A < B < C: print('Yes') else: print('No')
p02784
s676833484
Wrong Answer
a,b=input().split() l = list(map(int, input().split())) a=int(a) b=int(b) if a >= sum(l): print('Yes') else: print('No')
p03607
s085623756
Accepted
n = int(input()) d = {} for i in range(n): a = int(input()) if a not in d: d[a] = 1 else: if d[a]: d[a] = 0 else: d[a] = 1 ans = 0 for v in d.values(): ans += v print(ans)
p03556
s206552767
Accepted
N = int(input()) import math x = math.floor(N**0.5) print(x**2)
p02713
s254777179
Accepted
import math k = int(input()) tb = [ [math.gcd(a, b) for a in range(0, 201)] for b in range(0, 201) ] x = 0 for a in range(1, k + 1): for b in range(1, k + 1): t = tb[a][b] for c in range(1, k + 1): x += tb[t][c] print(x)
p02697
s013441745
Wrong Answer
n, m = map(int, input().split()) for i in range(m): print(i+1, 2*m+1-i)
p03284
s516046259
Wrong Answer
N,K = map(int, input().split()) print((N//K)-N%K)
p02854
s039160998
Wrong Answer
from bisect import bisect_left from numpy import cumsum N = int(input()) A = list(map(int, input().split())) a_cum = cumsum(A) ind = bisect_left(a_cum, a_cum[-1]/2) print(abs((a_cum[-1] - a_cum[ind]) - a_cum[ind]))
p03137
s833071720
Wrong Answer
def resolve(): ''' code here ''' import collections N, M = [int(item) for item in input().split()] Xs = [int(item) for item in input().split()] if N < M: Xs.sort() ds = [Xs[i] - Xs[i-1] for i in range(1, M)] ds.sort() # print(ds) print(sum(ds[:-1*(N-1)])) else: print(0) if __name__ == "__main__": resolve()
p02786
s233593729
Wrong Answer
h=int(input()) out=0 c=0 while h>1: h=h//2 if h%2==0 else (h+1)//2 out+=2**c c+=1 out+=2**c if h!=1 else 0 print(out)
p02773
s032020079
Accepted
import numpy as np N=int(input()) S=[] count_S={} for i in range(N): s=input() S.append(s) count_S[s]=0 for key in S: count_S[key]+=1 keys=np.array(list(count_S.keys())) values=np.array(list(count_S.values()),dtype=np.int32) out=np.where(values==np.max(values)) result=np.sort(keys[out]) for r in result: print(r)
p03309
s189140060
Wrong Answer
import math N = int(input()) A = list(map(int, input().split())) # print(N, A) for i in range(len(A)): A[i] -= (i + 1) # print(A) _A = list(map(abs, A)) average = math.floor(sum(_A) / len(_A)) for i in range(len(A)): A[i] = abs(A[i] - average) sadness = sum(A) print(sadness)
p03745
s964240649
Wrong Answer
n = int(input()) l = list(map(int, input().split())) l1 = list() for i in range(1, n): if l[i] > l[i-1]: l1.append(1) elif l[i] == l[i-1]: l1.append(0) else: l1.append(-1) ans = 0 i = 1 while i <= n-2: if l1[i]*l1[i-1] == -1: ans += 1 i += 2 else: i += 1 print(ans + 1)
p03434
s833122431
Accepted
import sys def resolve(): N = int(input()) S = list(map(int, input().split(" "))) S.sort(reverse=True) print(sum(S[0::2]) - sum(S[1::2])) if '__main__' == __name__: resolve()
p02819
s623350779
Wrong Answer
X = int(input()) testing_number = X + 1 while(True) : is_prime = True while(True) : for i in range(2,testing_number) : if (testing_number % i == 0) : is_prime = False testing_number += 1 break break if(is_prime) : break print(testing_number)
p02621
s630568514
Accepted
a = int(input()) print(a + a * a + a * a * a)
p02700
s647316227
Wrong Answer
a,b,c,d = map(int,input().split()) if(a+b>(c+d)): print("Yes") else: print("No")
p02773
s745383460
Accepted
N = int(input()) S = ['0'] * N for i in range(N): S[i] = input() import collections c = collections.Counter(S) li = list(c.values()) ca = list(c.keys()) li.sort() max = li[-1] lia = [] for i in ca: if c[i] == max: lia.append(i) lia.sort() n = len(lia) for i in range(n): print(lia[i])
p02546
s344374654
Accepted
S = input() if S[-1] == 's': print(S + 'es') else: print(S + 's')
p03779
s706020196
Wrong Answer
x = int(input()) place = 0 i = 1 while 1: if place + i == x: print(i) exit() elif (i + i+1) > (x - place): i += 1 else: place += i i += 1
p02761
s721266042
Wrong Answer
import sys def LI(): return list(map(int, input().split())) N, M = LI() ans = [-1]*N for _ in range(M): a, b = LI() if ans[a-1] == b or ans[a-1] == -1: ans[a-1] = b else: print(-1) sys.exit() if ans[0] == -1: ans[0] = 1 S = "" for i in range(N): if ans[i] == -1: ans[i] = 0 S += str(ans[i]) if S == "0"*N: S = -1 print(S)