problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02578
s412576046
Accepted
from collections import defaultdict, deque import sys, heapq, bisect, math, itertools, string, queue, copy, time from fractions import gcd import numpy as np sys.setrecursionlimit(10**8) INF = float('inf') MOD = 10**9+7 EPS = 10**-7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sys.stdin.readline().split()) n = int(input()) a_list = np.array(list(map(int, input().split()))) a_mx = np.maximum.accumulate(a_list) ans = (a_mx - a_list).sum() print(ans)
p02842
s889866113
Accepted
n=int(input()) t=n/1.08 f=0 if int(t)*1.08 >= n: f=int(t) else: f=int(t)+1 if int(f*1.08) == n: print(f) else: print(":(")
p03657
s766817682
Accepted
a, b = map(int, input().split()) if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0: print('Possible') else: print('Impossible')
p03838
s858739276
Wrong Answer
x, y = map(int, input().split()) if x <= y and abs(x) > abs(y) and y>0: print(abs(x)-abs(y)+1) elif abs(x) == abs(y): print(1) elif x <= y: print(y-x) elif x >= 0 and y <= 0 : print(abs(x+y)+1) else: print(abs(y-x)+2)
p02775
s424948580
Accepted
N=[int(c) for c in input()][::-1] dp=[[0]*2 for _ in range(len(N)+1)] dp[0][1]=1 for i in range(len(N)): dp[i+1][1]=min(dp[i][0]+N[i]+1,dp[i][1]+10-N[i]-1) dp[i+1][0]=min(dp[i][0]+N[i],dp[i][1]+10-N[i]) print(dp[len(N)][0])
p03632
s044263534
Wrong Answer
url = "https://atcoder.jp//contests/abc070/tasks/abc070_b" def main(): t = list(map(int, input().split())) start = max(t[0], t[2]) end = min(t[1], t[3]) print(end - start) if __name__ == '__main__': main()
p03012
s351726911
Wrong Answer
n=int(input()) w=list(map(int,input().split())) m = sum(w)//2 s = 0 for i in range(n): s += w[i] if s >= m: if s == m: print(0) else: print(abs(m-s)+1) break
p02838
s515178725
Accepted
import numpy as np N = int(input()) A = list(map(int, input().split())) A = np.array(A) mod = 10 ** 9 + 7 ans = 0 for i in range(60): b = np.count_nonzero(A >> i & 1) ans += 2 ** i * b * (N - b) ans %= mod print(ans)
p02582
s877111432
Wrong Answer
str = input() print(str.count('R'))
p02554
s189771758
Wrong Answer
n = int(input()) cur = 8 bot = n t = 0 for i in range(1, n): t += cur*(bot//i) cur *= 8 bot *= n-i print((10**n - 2*t - 8**n)%(10**9+7))
p03472
s999555444
Accepted
import math n,h = map(int,input().split()) l = []; x,y = 0,0 for _ in range(n): a,b = map(int,input().split()) if a > x or a == x and b < y: x,y = a,b if b < x:continue l.append((a,b)) l.remove((x,y)) l = sorted(l,key=lambda x:-x[1]) ans = 0 for a,b in l: if b <= x:break if b < y and y >= h: print(ans+1);exit() h -= max(b,x) ans += 1 if h <= 0: print(ans);exit() d = math.ceil((max(0,h-y))/x) print(ans + d + 1)
p02897
s204594126
Accepted
N = int(input()) print(0.5 if N%2==0 else (N+1)//2/N)
p04045
s659928838
Accepted
n,k = map(int,input().split()) D = list(map(int,input().split())) ans = n while True: for i in list(map(int, str(ans))): if i in D: break else: print (ans) exit () ans += 1
p04033
s454848627
Wrong Answer
a, b = map(int, input().split()) if a < 0 and b > 0: print("Zero") elif a > 0: print("Positive") elif b == -1: if abs(a) % 2 == 0: print("Positive") else: print("Negative") elif b < 0 and a < 0: if abs(a) + abs(b) % 2 == 0: print("Negative") else: print("Positive")
p02791
s272071135
Accepted
n = int(input()) a = tuple(map(int,input().split())) res = 0 mi = 10**20 for e in a: if mi > e: res += 1 mi = e print(res)
p02624
s984628058
Wrong Answer
n = int(input()) ans = 0 for x in range(1, n + 1): ans += (x + n//x * x) * (n // x) / 2 print(ans)
p02713
s861349557
Accepted
from math import gcd k = int(input()) count = 0 for a in range(1,k+1): for b in range(1,k+1): for c in range(1,k+1): count += gcd(gcd(a,b),c) print(count)
p02900
s607109664
Wrong Answer
from math import gcd,sqrt,floor a,b = map(int,input().split()) c = gcd(a,b) x = [] for i in range(2,floor(sqrt(c))+1): if c % i == 0: x.append(i) x.append(c//i) x.sort() y = [] i = 0 while c > 1 and i < len(x): if c % x[i] == 0: y.append(x[i]) c = c // 2 else: i += 1 print(len(y)+1)
p02797
s537153269
Wrong Answer
N, K, S = [int(i) for i in input().split()] a = S//2 b = S - a val = a ans = [] count = 0 for i in range(N): if(count > K): val = S + 1 else: count += 1 val = val ^ a ^ b ans += [val] print(*ans)
p03254
s769427033
Accepted
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort(reverse=False) count = 0 for i in range(n): if x>=a[i]: count += 1 x -= a[i] else: break if (x!=0)and(count==n): count -= 1 print(count)
p03998
s007020633
Wrong Answer
# ABC 045: B – 3人でカードゲームイージー / Card Game for Three (ABC Edit) cards = ['a', 'b', 'c'] s = [input() for _ in range(3)] turn = 0 previous = 0 while len(s[turn]) != 0: previous = turn turn = cards.index(s[turn][0]) s[previous] = s[previous][1:] print(cards[previous].upper())
p02924
s191884653
Accepted
n=int(input()) print(n*(n-1)//2)
p02594
s253763902
Accepted
x = int(input()) if x >= 30: print("Yes") else: print("No")
p03127
s934421875
Accepted
def GCD(a, b): if b == 0: return a else: return GCD(b, a % b) def LCM(a, b): return a // GCD(a, b) * b def main(): N = int(input()) A = list(map(int, input().split())) ans = 0 for a in A: ans = GCD(ans, a) print(ans) return 0 if __name__ == '__main__': main()
p02706
s595953962
Accepted
n, m = map(int, input().split()) a = sum(list(map(int, input().split()))) ans = n - a if ans >= 0: print(ans) else: print("-1")
p02684
s723520751
Accepted
n, k = map(int, input().split()) A = list(map(int, input().split())) L = [0] * n L[0] = 1 i = A[0] - 1 j = 1 while j < k: if L[i] < 2: L[i] += 1 else: break i = A[i] - 1 j += 1 if j == k: print(i + 1) else: loop = L.count(2) k = (k - L.count(1)) % loop while k > 0: i = A[i] - 1 k -= 1 print(i + 1)
p03352
s774283967
Accepted
X = int(input()) list = [] if X == 1: list.append(1) elif X == 2 or X == 3: list.append(2) else: for b in range(2, X): p = 2 while b ** p <= X: list.append(b ** p) p += 1 print(max(list))
p02771
s980617752
Accepted
a, b, c = map(int, input().split()) if a == b and a != c: print("Yes") elif a == c and a != b: print("Yes") elif b == c and b != a: print("Yes") else: print("No")
p03759
s210066621
Wrong Answer
a, b, c = map(int, input().split()) if b - a and c - b: print("YES") else: print("NO")
p02833
s902033384
Accepted
N = int(input()) if N % 2 == 1: print(0) exit() else: pass cnt = 0 for i in range(26): cnt += N // (5 ** (i + 1) * 2) print(cnt)
p02970
s645670369
Wrong Answer
n, d = map(int, input().split()) if n == d: print(1) if (n - (2*d + 1)) <= d: print(d) elif (n - (2*d + 1)) > d: print(d -1)
p03161
s923427607
Wrong Answer
n,k = map(int,input().split()) h = list(map(int,input().split())) dp = [100000000 for i in range(n)] dp[0] = 0 for i in range(n): for j in range(k+1): if i+j<n: dp[i + j] = min(dp[i] + abs(h[i] - h[i + j]), dp[i + j]) print(dp[n-1])
p02732
s151597779
Wrong Answer
def aC(a): if a == 0: return 0 return a*(a-1)/2 N = input() N = int(N) B = input().split(" ") A = [] for a in B: A.append(int(a)) for i in range(0,N): pre_A = A[:] pre_A.pop(i) count_list = [] for i in range(1,N+1): count_list.append(pre_A.count(i)) ans = 0 for i in count_list: ans = ans + aC(i) print(ans)
p02720
s805320698
Accepted
k=int(input()) ans=[i for i in range(1,10)] def dfs(x): if x>=3234566667: return for i in range(max(0,x%10-1),min(10,x%10+2)): ans.append(10*x+i) dfs(10*x+i) for i in range(1,10): dfs(i) print(sorted(ans)[k-1])
p02624
s765982326
Accepted
n = int(input()) ans=0 def formula(n): return n * (n+1) //2 for i in range(1,n+1): x=n//i ans+=i*formula(x) print(ans)
p02835
s809482733
Accepted
As = [int(a) for a in input().split()] if sum(As) >= 22: print('bust') else: print('win')
p03773
s794700524
Wrong Answer
# coding: utf-8 # Your code here! a, b = map(int,input().split()) print(a + b)
p03017
s531677949
Accepted
N,A,B,C,D = list(map(int, input().split())) S = input() flg = '##' in S[A-1:C] or '##' in S[B-1:D] if C > D and not flg: f,e = max(A-1,B-2),min(D+1,N) flg = not '...' in S[f:e] print("No" if flg else "Yes")
p03061
s344968075
Accepted
from fractions import gcd N=int(input()) A=list(map(int, input().split())) LtR=[0]*N LtR[0]=A[0] RtL=[0]*N RtL[-1]=A[-1] for i in range(N-1): LtR[i+1]=gcd(A[i+1],LtR[i]) RtL[-(i+2)]=gcd(A[-(i+2)], RtL[-(i+1)]) ans=max(LtR[-2], RtL[1]) for i in range(1,N-1): ans=max(ans, gcd(LtR[i-1], RtL[i+1])) #print(LtR, RtL) print(ans)
p03317
s029039883
Accepted
N, K = map(int, input().split()) A = input() print((N+K-3)//(K-1))
p03456
s965692633
Wrong Answer
a, b = input().split() ab = int(a + b) #print(ab) for c in range(120): if c ** 2 == ab: print("Yes") break else: print("No")
p02779
s065157205
Accepted
N=int(input()) n=list(map(int,input().split())) A=len(n) m=set(n) B=len(m) if A==B: print("YES") else: print("NO")
p02879
s010519813
Accepted
A, B = map(int,input().split()) if A < 10 and B < 10: print(A*B) else: print(-1)
p02882
s342013896
Wrong Answer
import math a, b, x = map(int, input().split()) if x <= a*b: ans = math.degrees(math.atan(2*x/a/b**2)) print(90 - ans) else: ans = math.degrees(math.atan(2*b/a - 2*x/a**3)) print(ans)
p02957
s300444258
Accepted
A, B = map(int, input().split()) Amod2 = A%2 Bmod2 = B%2 if (Amod2 == Bmod2): print(int((A+B)/2)) else: print("IMPOSSIBLE")
p02790
s387340985
Accepted
a, b = map(int, input().split()) ans = 0 if a >= b: for i in range(a): ans += b * 10**i else: for i in range(b): ans += a * 10**i print(ans)
p02918
s846446801
Wrong Answer
n, k = map(int,input().split()) s = input() press = [] temp = s[0] cnt = 0 for string in s: if temp == string: cnt += 1 else: press.append(cnt) temp = string cnt = 1 press.append(cnt) if len(press) - 2 * k < 0: print(n-1) exit() ans = 2 * k for i in press: ans += i - 1 print(ans)
p03760
s061324049
Accepted
import sys input = sys.stdin.readline o = list(input().rstrip()) e = list(input()) for i in range(len(e)): o.insert(i+1*(i+1), e[i]) print(''.join(o))
p03827
s120456381
Accepted
N=input() S=list(input()) x=0 l=list() for i in S: if i=='I': x+=1 else: x-=1 l.append(x) n=max(l) print(max(0,n))
p03137
s496183446
Wrong Answer
n, m = map(int, input().split()) x = list(map(int, input().split())) if m == 1: print(0) exit() x.sort() diff = [] for i in range(m-1): diff.append(x[i+1] - x[i] - 1) diff.sort(reverse=True) print(x[-1] - x[0] + 1 - sum(diff[:n-1]) - n)
p04045
s677958751
Wrong Answer
### N = int(input(()) N, M = map(int, input().split()) D = list(map(int, input().split())) for i in range(N, 10000): j = i while j > 0: if j % 10 in D: break j = int(j/10) if j == 0: break print(i)
p03160
s532462604
Accepted
def main(): N = int(input()) field = list(map(int, input().split())) dpList = [0] * N dpList[1] = abs(field[0] - field[1]) for i in range(2, N): dpList[i] = min([dpList[i - 1] + abs(field[i] - field[i - 1]), dpList[i - 2] + abs(field[i] - field[i - 2])]) print(dpList[-1]) if __name__ == "__main__": main()
p02675
s948996357
Wrong Answer
N = int(input()) N = N % 10 if N in (2, 4, 5, 7, 9): print ("hon") elif N in (0, 1, 6, 7): print ("pon") else: print ("bon")
p02831
s412837770
Accepted
import math a,b =map(int,input().split()) def lcm(x, y): return (x * y) // math.gcd(x, y) print(lcm(a, b))
p03351
s022872667
Wrong Answer
a,b,c,d = map(int,input().split()) ac = abs(a-c) ab = abs(a-b) bc = abs(b-c) if ac <= d or ab<=d or bc <=d: print('Yes') else: print('No')
p02707
s656113753
Wrong Answer
n = int(input()) a = list(map(int,input().split())) b = set(a) c = n-len(b) for i in b: if i in a: num = a.count(i) print(num) elif not i in a: print(0) ans = '0\n'*c print(ans)
p03035
s252879616
Accepted
a,b=map(int,input().split()) if a <= 5: print(0) elif 13 <= a: print(b) else: print(b//2)
p03478
s939895389
Accepted
N, A, B = map(int, input().split()) ans = 0 for i in range(1, N+1): if A <= sum(map(int, list(str(i)))) <= B: ans += i print(ans)
p03632
s490699034
Accepted
a, b, c, d = map(int, input().split()) al = [x for x in range(a,b)] cl = [y for y in range(c,d)] print(len(al+cl)-len(set(al+cl)))
p02639
s144734090
Accepted
print(15 - sum(list(map(int, input().split()))))
p02689
s901156215
Wrong Answer
n, m = map(int, input().split()) h = list(map(int, input().split())) ary = [0 for i in range(n)] chk = [False for i in range(n)] for i in range(m): a, b = map(int, input().split()) chk[a-1] = True chk[b-1] = True if h[a-1] < h[b-1]: ary[a-1] += 1 elif h[a-1] > h[b-1]: ary[b-1] += 1 else: continue cnt = 0 for i in range(n): if ary[i] == 0 and chk[i] == True: cnt += 1 print (cnt)
p02600
s503231090
Accepted
X=int(input()) if X>=400 and X<=599: print(8) elif X<=799: print(7) elif X<1000: print(6) elif X<1200: print(5) elif X<1400: print(4) elif X<1600: print(3) elif X<1800: print(2) else: print(1)
p02899
s988223608
Accepted
N = int(input()) A = [int(n) for n in input().split()] ans = [0] * N for i, v in enumerate(A): ans[v-1] = i+1 print(' '.join([str(n) for n in ans]))
p02801
s892847202
Accepted
import sys def main(): C = input() print(chr(ord(C) + 1)) main()
p03069
s206448630
Accepted
n = int(input()) s = input() white = 0 for i in s: if(i=='.'): white += 1 # 全部黒の場合 ans = white # 左からi+1 個白の場合 now = white for i in range(n): if(s[i]=='#'): now+=1 else: now-=1 ans = min(now,ans) print(ans)
p03285
s364630079
Accepted
N=int(input()) for i in range((N-1)//4+2): if (N-4*i)%7==0: print("Yes") break else: print("No")
p03241
s820273191
Accepted
n,m = map(int,input().split()) a = (m//n) for i in range(a, 0, -1): if m%i == 0: print(i) break
p02880
s331034236
Wrong Answer
N = int(input()) ans = "No" if N <=81: for i in range(2,10): if N%i == 0: ans = "Yes" print(ans)
p02842
s933028521
Wrong Answer
N=int(input()) for i in range(50000): if i*108//100==N: print(i) else: print(":(")
p02659
s309861898
Wrong Answer
a,b=map(float, input().split()) b=100*b b=b//100 print(a*b)
p02622
s597855584
Wrong Answer
s1 = input().split() strS = s1[0] s2 = input().split() strT = s2[0] #strS = 'cupofcoffee' #strT = 'cupofhottea' #strS = 'abcde' #strT = 'bcdea' #strS = 'apple' #strT = 'apple' charStrSList = list(strS) charStrTList = list(strT) intCnt = 0 idx = 0 for sChar in charStrSList: if (sChar != charStrTList[idx]) : intCnt += 1 print(sChar) print(charStrTList[idx]) print(intCnt) idx += 1 print(intCnt)
p02727
s596728138
Accepted
import sys from math import factorial from fractions import Fraction import heapq, bisect, fractions import math import itertools sys.setrecursionlimit(10 ** 5 + 10) INF = 10**15 +5 def input(): return sys.stdin.readline().strip() def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) x, y, a, b, c = MAP() p = LIST() q = LIST() r = LIST() p.sort(reverse = True) q.sort(reverse = True) p = p[:x] q = q[:y] res = p + q + r res.sort(reverse = True) print(sum(res[:x+y]))
p02627
s127341374
Wrong Answer
a = input() if 'a' <= 'z' : print('a') if 'A' <= 'Z' : print('A')
p02772
s250150517
Accepted
n = int(input()) a = list(map(int,input().split())) for b in a: if b%2 == 0: if b%3 == 0 or b%5 == 0: continue else: print('DENIED') exit() else: print('APPROVED')
p02694
s050311243
Accepted
X = int(input()) depo = 100 year = 0 while True: if depo >= X: break depo = int(depo*1.01) year += 1 print(year)
p03698
s704831747
Wrong Answer
l = list(input()) strlen = l.__len__() "yes" if strlen == list(set(l)).__len__() else "no"
p02576
s046633224
Wrong Answer
n,x,t=map(int,input().split()) print((n//x)*t if n%t == 0 else ((n//x)*t+t))
p02797
s920380397
Accepted
N,K,S = list(map(int,input().split())) for i in range(K): print(S,end=" ") for i in range(N-K): if S == 1e9: print(1,end=" ") else: print(S+1,end=" ")
p02713
s720561013
Wrong Answer
k = int(input()) import math from functools import reduce def gcd(*numbers): return reduce(math.gcd, numbers) total = 0 for a in range(1,k+1): for b in range(1,k+1): for c in range(1,k+1): if (a%b==0 or b%a==0) and (b%c==0 or c%b==0) and (c%a==0 or a%c==0): total += 1 else: total += gcd(a,b,c) print (total)
p02583
s354955650
Accepted
import itertools N = int(input()) L = list(map(int, input().split())) list1 = list(itertools.combinations(L, 3)) count=0 for i in list1: if i[0] != i[1] and i[1] != i[2] and i[2] != i[0]: if i[0] + i[1] <= i[2]: continue if i[0] + i[2] <= i[1]: continue if i[2] + i[1] <= i[0]: continue count+=1 else: continue print(count)
p03854
s585103256
Wrong Answer
s = input() length = len(s) i = 0 res = "YES" while i < length: if i+4 <= length and s[i:i+5] == "dream": i += 5 if i+1 <= length and s[i:i+2] == "er" and s[i+2] != "a": i += 2 else: res = "NO" break if i+4 <= length and s[i:i+5] == "erase": i += 5 if i+1 <= length and s[i:i+2] == "er" and s[i+2] != "a": i += 2 else: res = "NO" break print(res)
p02899
s236469304
Wrong Answer
n=int(input()) a=list(map(int,input().split())) b=list(range(1,n+1)) ab=list(zip(a,b)) ab.sort() l=(ab[i][1] for i in range(n)) print(list(l))
p02873
s919141388
Wrong Answer
s=str(input()) s=list(s) temp=[0]*(len(s)+1) cnt=0 ans=0 for i in range(len(s)): if s[i]=="<": if temp[i]<0: ans=ans+abs(cnt*temp[i]) temp[i+1]=1 else: temp[i+1]=temp[i]+1 if temp[i]>0: cnt=0 else: cnt=1 else: if temp[i]>0: temp[i+1]=0 else: temp[i+1]=temp[i]-1 cnt=cnt+1 print(sum(temp)+ans)
p02916
s108506354
Accepted
n=int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) m=0 # 0で初期化すると最初が1の時にだめ at=-1 for ai in a: m+=b[ai-1] if ai == at+1: m+=c[at-1] at=ai print(m)
p03071
s158174680
Wrong Answer
s=0 A,B=map(int,input().split()) if A>=B: s+=A A=A-1 else: s+=B if A>=B: s+=A A=A-1 else: s+=B print(s)
p02631
s744198509
Accepted
import sys N=int(sys.stdin.readline().strip()) A=map(int, sys.stdin.readline().split()) for i,a in enumerate(A): if i==0: total=a else: total^=a for a in A: print a^total,
p03017
s169157182
Accepted
N,A,B,C,D = map(int,input().split()) S = input() if '##' in S[A:C]: print('No') elif '##' in S[B:D]: print('No') elif C>D: #print(S[B - 2:D + 1]) if not '...' in S[B-2:D+1]: print('No') else: print('Yes') else: print('Yes')
p03472
s870929813
Accepted
n,h=map(int,input().split()) b = [] t = [] for _ in range(n): c,d = map(int,input().split()) b.append(c) t.append(d) b_max = max(b) t =sorted(t) from bisect import bisect_right from math import ceil index = bisect_right(t,b_max) ans=0 for i in range(n-1,index-1,-1): h-=t[i] ans+=1 if h<=0: print(ans) exit(0) cnt = ceil(h/b_max) print(ans+cnt)
p03206
s923607635
Accepted
d=int(input()) print("Christmas"," Eve"*(25-d))
p03286
s340863074
Accepted
# coding: utf-8 def get_ans(): n = int(input().rstrip()) if n == 0: return "0" dv = 1 bit_list = [] while n != 0: tmp = n % (dv*2) if tmp == 0: bit_list.append("0") else: bit_list.append("1") n -= tmp dv *= -2 return "".join(reversed(bit_list)) print(get_ans())
p03693
s167407580
Accepted
r,g,b=map(int,input().split()) if (100*r+10*g+b) % 4 == 0: print("YES") else: print("NO")
p02971
s582311429
Accepted
n = int(input()) A = [] maximum = 0 maximum_idx = 0 for i in range(n): a = int(input()) A.append(a) if a > maximum: maximum = a maximum_idx = i for i in range(n): if i != maximum_idx: print(maximum) else: print(sorted(A)[-2])
p03293
s330813108
Accepted
s = list(input()) t = list(input()) a = "" status = 0 if s == t: print("Yes") status = 1 else: for i in range(len(s)): a = s.pop() s.insert(0,a) if s == t: print("Yes") status = 1 else: pass if status == 0: print("No")
p03206
s454451236
Accepted
D = int(input()) if D == 25: print("Christmas") elif D==24: print("Christmas Eve") elif D==23: print("Christmas Eve Eve") else: print("Christmas Eve Eve Eve")
p03455
s681512333
Accepted
import sys sys.setrecursionlimit(4100000) import math INF = 10**9 def main(): a,b = map(int,input().split()) if a*b%2 == 0: print('Even') else: print('Odd') if __name__ == '__main__': main()
p02754
s683902481
Accepted
n,a,b= list(map(int, input().strip().split())) k=int(n/(a+b)) if n-k*(a+b)>=a: print((k+1)*a) else: print(n-k*b)
p02633
s632887475
Wrong Answer
x = int(input()) import math steps = 1 X = x a,b = math.sin((22*x)/(7*180)),math.cos((22*x)/(7*180)) while True: # print(x,a,b) x = (x+X) r = (22*x)/(7*180) a = a + math.sin(r) b = b + math.cos(r) steps+=1 if a<10**-6 and b<10**-6: break print(steps+1)
p03221
s872645747
Accepted
N,M=map(int, input().split()) A=[[] for i in range(N)] for i in range(M): p,y=map(int, input().split()) A[p-1].append((y, i)) X=[0]*M for i,d in enumerate(A): d.sort() for k,(y,j) in enumerate(d): X[j]=str(i+1).zfill(6)+str(k+1).zfill(6) print(*X,sep='\n')
p03161
s692255649
Wrong Answer
# dp[i] 足場iまでいくコストの最小値 n,k = map(int,input().split()) h = [0] + list(map(int,input().split())) # dp[2]までは初期条件で確定 dp = [0 for i in range(n+1)] dp[2] = abs(h[2]-h[1]) for i in range(3,n+1): arr = [dp[i-j] + abs(h[i] - h[i-j]) for j in range(1,min(i,k)+1)] dp[i] = min(arr) ans = dp[n] print(ans)
p04012
s411636457
Wrong Answer
import collections w=list(input()) W=collections.Counter(w) ans="Yes" for i in W.values(): if i%2!=0: ans="NO" break print(ans)