problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03360
s113949085
Accepted
A = list(map(int, input().split())) A.sort(reverse=True) K = int(input()) A[0] = A[0] * pow(2, K) print(sum(A))
p02847
s253443058
Accepted
s = input() l = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'] for i in range(7): if s == 'SUN': print(7) break else: if s == l[i]: print(7-i)
p03087
s025201158
Accepted
N,Q = map(int,input().split()) S = input() ruisekiwa = [0]*(N+1) mode = 0 now = 0 for i in range(N): if S[i:i+2] == "AC": now += 1 ruisekiwa[i+1] = now for i in range(Q): l,r = map(int,input().split()) print(ruisekiwa[r-1]-ruisekiwa[l-1])
p03719
s541955286
Wrong Answer
# coding: utf-8 # Your code here! int_1 = input().split() if int_1[0] <= int_1[2] <= int_1[1]: print("Yes") else: print("No")
p02922
s497857236
Wrong Answer
a,b = map(int,input().split()) count = 0 while b > 0: b = b -a count += 1 print(count)
p02629
s663833111
Accepted
from string import ascii_lowercase from itertools import accumulate def solve(string): n = int(string) t = [0] + [len(ascii_lowercase)**i for i in range(1, 12)] *t, = accumulate(t) l = 0 ans = "" while t[l] < n: l += 1 n -= t[l - 1] + 1 for i in range(l - 1): j, n = divmod(n, len(ascii_lowercase)**(l - i - 1)) ans += ascii_lowercase[j] ans += ascii_lowercase[n] return ans if __name__ == '__main__': import sys print(solve(sys.stdin.read().strip()))
p02577
s170798843
Wrong Answer
def main(): N = input() N_sum = 0 if N == str(0): print("No") exit() for i in N: N_sum += int(i) if N_sum % 9 == 0: print("Yes") else: print("No") if __name__ == "__main__": main()
p03338
s925304378
Wrong Answer
N = int(input()) S = input() print(max([len(set(S[:i])) + len(set(S[i:])) for i in range(N)]))
p03416
s677417634
Accepted
a,b=map(int,input().split()) ans=0 for i in range(a,b+1): I=list(map(int,str(i))) I2=list(reversed(I)) if I==I2: ans+=1 print(ans)
p03327
s051562802
Wrong Answer
print('ABC' if int(input()) <= 1000 else 'ABD')
p03359
s083540755
Wrong Answer
a,b = map(int,input().split()) if a >=12: print(12) else: print(min(a,b))
p02553
s860285215
Wrong Answer
a, b, c, d = map(int, input().split()) if 0 <= a or 0 <= c: if d < 0: print(a*d) elif b < 0: print(b*c) else: print(b*d) elif 0 <= b or 0 <= d: print(a*c)
p02951
s061965823
Wrong Answer
a,b,c = map(int,input().split()) print(c-a+b)
p02577
s182796228
Accepted
n = int(input()) if n%9 == 0: print('Yes') else: print('No')
p02957
s967519584
Wrong Answer
a, b = map(int, input().split()) for k in range(1, max(a, b) + 1): if k - a == k - b: print(k) exit() print("IMPOSSIBLE")
p03338
s660271862
Accepted
n,s,c=int(input()),list(input()),0 for i in range(n): h=len(set(s[:i])&set(s[i:])) c=max(c,h) print(c)
p02594
s798331181
Accepted
from collections import defaultdict,deque #from itertools import permutations ml=lambda:map(int,input().split()) ll=lambda:list(map(int,input().split())) ii=lambda:int(input()) ip=lambda:list(input()) ips=lambda:input().split() """========main code===============""" t=ii() if t>=30: print("Yes") else: print("No")
p02705
s823246742
Accepted
r = int(input()) pi = 3.141592 print(r * 2 * pi)
p02730
s471631806
Accepted
S = input() N = len(S) l = S[0:(N-1)//2] r = S[(N+3)//2 - 1:] if l == r: print('Yes') else: print('No')
p02701
s267700107
Wrong Answer
import sys input = sys.stdin.readline N = int(input()) S = [] S_append = S.append for i in range(N): S_append(input()) count = 0 while len(S) >0: S.remove(S[0]) count += 1 print(count)
p02731
s674513247
Wrong Answer
l = int(input()) print(pow(l/3, 2))
p03371
s495479428
Wrong Answer
a,b,c,x,y = map(int,input().split()) c = c*2 n = max(x,y) ans = 10**25 for i in range(10**6): x1,y1 = i,i p = c*i if x > x1: if y > y1: p += a*(x-x1) + b*(y-y1) else: p += a*(x-x1) else: if y > y1: p += b*(y+y1) if ans > p: ans = p print(ans)
p03493
s715721140
Accepted
line = list(input()) l = [int(s) for s in line] a = sum(l) print(a)
p03680
s152372935
Accepted
n=int(input()) lamp = [int(input()) for i in range(n)] cnt = 0 select = lamp[0] while True: if cnt>n: print(-1) break; elif select == 2: cnt += 1 print(cnt) break; else: select = lamp[select-1] cnt += 1
p03262
s461222412
Wrong Answer
import numpy as np N, X = [int(i) for i in input().split()] xn = np.array([int(i) for i in input().split()]) xn = abs(X-xn) def gcd(a, b): if b > a : a, b = b, a while b != 0: a = b b = a % b return a ans = xn[0] for i in range(1, len(xn)): ans = gcd(ans, xn[i]) print(ans)
p03767
s609133636
Accepted
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) INF = float('inf') N = int(input()) A = list(map(int, input().split())) A.sort() start = 0 end = (3 * N) - 1 ans = 0 while True: end -= 1 ans += A[end] start += 1 end -= 1 if start > end: break print(ans)
p03971
s891192425
Wrong Answer
p = 0 n, a, b = map(int, input().split()) for i in input(): if i == "a" and p > a+b: p += 1 print("Yes") elif i == "b" and p > a+b and f > a+b: f += 1 p += 1 print("Yes") else: print("No")
p03017
s067074920
Accepted
N, A, B, C, D = (int(i) for i in input().split()) S = input() bef = '' row_dot_max = 0 count = 0 for i, s in enumerate(S): if bef == '#' and s == '#' and i > A and i <= max(C,D)-2: print('No') exit() if s == '.' and i >= B-2 and i <= D: count += 1 else: row_dot_max = max(row_dot_max, count) count = 0 bef = s row_dot_max = max(row_dot_max, count) if C > D: if row_dot_max >= 3: print('Yes') else: print('No') else: print('Yes')
p02719
s429394495
Wrong Answer
N,K = map(int, input().split()) ans = 0 # if N > K and K == 1: # print(0) # exit(0) if N < abs(N - K): ans = 0 elif N % K == 0: ans = 0 else: ans = abs(N % K - K) # while N > abs(N - K): # N = abs(N - K) print(ans)
p02681
s314927852
Accepted
S = input() T_l = [i for i in input()] T_x = ''.join(T_l[0:-1]) if S==T_x: print('Yes') else: print('No')
p02748
s685330716
Wrong Answer
A,B,M=map(int,input().split()) al=[] a=input().split() for i in a: al.append(int(i)) bl = [] b=input().split() for i in b: bl.append(int(i)) cl=[] for i in range(M): l=[] c = input().split() for i in c: l.append(int(i)) cl.append(l) l=[] for i in cl: a=0 a=al[i[0]-1]+bl[i[1]-1]-i[2] l.append(a) print(min(l))
p02677
s980710788
Accepted
import math a, b, h, m = map(float, input().split()) mm = (m % 60.0) * 6.0 hh = h * 30.0 + m * 0.5 rad = (mm - hh) * math.pi / 180.0 c = math.sqrt(math.pow(a, 2) + math.pow(b, 2) - 2 * a * b * math.cos(rad)) print(c)
p02612
s877169618
Accepted
N = int(input()) under1000 = N % 1000 if under1000 == 0: print(0) else: print(1000 - under1000)
p03076
s322754790
Accepted
import math a=[int(input()) for i in range(5)] b=[] c=[] for i in range(5): p=math.ceil(a[i]/10)*10 b.append(p) c.append(list(str(a[i]-1))) d=[] for i in range(5): d.append(int(c[i][-1])) print(sum(b)-(10-min(d)-1))
p02552
s083281196
Wrong Answer
n = int(input()) a = 10**n % (10**9+7) b = 8**n % (10**9+7) c = 9**n % (10**9+7) x = b + a - 2*c print(x % (10**9+7))
p03289
s555073724
Wrong Answer
import sys stdin = sys.stdin def ns(): return stdin.readline().rstrip() def ni(): return int(stdin.readline().rstrip()) def nm(): return map(int, stdin.readline().split()) def nl(): return list(map(int, stdin.readline().split())) def main(): S = list(ns()) if S[0] == 'A' and 'C' in S[2:-2]: S.remove('A') S.remove('C') for s in S: if s.isupper(): print('WA') print('AC') else: print('WA') if __name__ == '__main__': main()
p02547
s998006633
Accepted
n = int(input()) s = "aaa" for i in range(n): d1 , d2 = map(int,input().split(" ")) if d1 == d2: s += "b" else: s += "c" if "bbb" in s: print("Yes") else: print("No")
p02912
s596343370
Wrong Answer
import heapq N,M = map(int,input().split()) A = list(map(int,input().split())) for i in range(N): A[i] = -A[i] heapq.heapify(A) for i in range(M): trgt = heapq.heappop(A)//2 heapq.heappush(A,trgt) print(-sum(A))
p03860
s262102982
Wrong Answer
li = input().split() print('AtCoder,li[1][0],Contest')
p03612
s360306257
Wrong Answer
import bisect,copy,heapq,itertools,string from collections import * from math import * import sys def input() : return sys.stdin.readline().strip() def INT() : return int(input()) def MAP() : return map(int,input().split()) def LIST() : return list(MAP()) n = INT() s = LIST() count = 0 for i in range(n): if s[i] == i+1: if i > 0 and s[i-1] == i: continue else: count += 1 print(count)
p03785
s350356796
Wrong Answer
N,C,K = map(int,input().split()) T = [int(input()) for _ in range(N)] T.sort() time = T.pop(0)+K people = 1 ans = 1 for t in T: if t <= time and people < C: people += 1 else: if people == C: time += t else: time += K people = 0 ans += 1 print(ans)
p02693
s899791382
Wrong Answer
k=int(input()) l=list(map(int, input().split(' '))) a=l[0] b=l[1] if (b-a)+1>=k: print('OK') else: maybe=(a//k)*k ans=False while maybe<b: if maybe>=a: ans=True break else: maybe+=k if ans: print('OK') else: print('NG')
p02647
s422819625
Accepted
n,k,*l=map(int,open(0).read().split()) for _ in range(k): s=[0]*(n+1) for i in range(n): s[max(i-l[i],0)]+=1 s[min(i+l[i]+1,n)]-=1 for i in range(n): s[i+1]+=s[i] s.pop() if s==l: break l=s print(*l)
p02761
s249639122
Accepted
n, m = map(int, input().split()) ans = ['t'] * n for _ in range(m): s, c = map(int, input().split()) if ans[s-1] =='t' or ans[s-1] == str(c): ans[s-1]= str(c) else: print(-1) exit(0) if ans[0] == 't' and n >1: ans[0]=str(1) ans = ''.join(ans).replace('t', str(0)) ans = int(ans) l = str(ans) if len(l) != n: print(-1) else: print(ans)
p03543
s193593955
Accepted
n = list(input()) if n[0]==n[1] and n[1]==n[2]: print('Yes') elif n[1]==n[2] and n[2]==n[3]: print('Yes') else: print('No')
p03944
s138517827
Accepted
import numpy as np W, H, N = input().split() commands = [] for i in range(int(N)): commands.append(input().split()) pic = np.zeros((int(W),int(H))) for com in commands: x = int(com[0]) y = int(com[1]) a = int(com[2]) if a==1: pic[:x,:] = 1 if a==2: pic[x:,:] = 1 if a==3: pic[:,:y] = 1 if a==4: pic[:,y:] = 1 area = 0 for w in range(int(W)): for h in range(int(H)): if pic[w,h]==0: area += 1 print(area)
p03943
s518326732
Accepted
c = map(int, input().split()) c = sorted(c) ans = 'Yes' if c[0] + c[1] == c[2] else 'No' print(ans)
p02554
s985679845
Accepted
import sys N = int(input()) if N == 1: print(0) sys.exit() p= (-2*9**N+8**N+10**N) % (10**9+7) print(p)
p02797
s960612958
Accepted
# 2020/01/19 n,k,s=map(int,input().split()) if s==10**9: rest=10**9-1 else: rest=10**9 ans=[s]*k+[rest]*(n-k) print(*ans)
p03795
s108887406
Accepted
n = int(input()) x = n * 800 y = (n // 15) * 200 print(x - y)
p03471
s390742997
Accepted
[N, Y] = list(map(int, input().split())) flag = False for i in range(0, N+1): if 10000*i > Y: break for j in range(0, N+1-i): k = N-i-j total = 10000*i + 5000*j + 1000*k if total == Y: print("{} {} {}".format(i, j, k)) flag = True break if flag: break if flag == False: print("-1 -1 -1")
p03474
s494862827
Accepted
a,b = map(int,input().split()) s = input() ans = ["0","1","2","3","4","5","6","7","8","9"] ch1 = list(map(str,s[:a])) if a > b: ch2 = list(map(str,s[a+b:])) else: ch2 = list(map(str,s[a+1:])) count = 0 for i in range(len(ch1)): if ch1[i] not in ans: count +=1 for j in range(len(ch2)): if ch2[j] not in ans: count += 1 if count == 0 and s[a] == "-": print("Yes") else: print("No")
p02615
s565184519
Wrong Answer
N = int(input()) A = list(map(int,input().split())) ans = sum(A) - min(A) print(ans)
p02780
s226770867
Wrong Answer
N,K=map(int,input().split()) *p,= map(int, input().split()) def ex(n): return sum(range(1,n+1))/n def ex3(p): return sum([ex(n) for n in p]) dp=[0 for _ in range(N)] M,mi=0,0 for i in range(N-K+1): s=sum(p[i:i+K+1]) if s>M: M=s mi=i print(mi) print(ex3(p[mi+1:mi+K+1]))
p02706
s888247434
Wrong Answer
n,m= map(int, input().split()) a = list(map(int, input().split())) print(n-sum(a))
p02787
s427506855
Accepted
x=input().split() h=int(x[0]) n=int(x[1]) import numpy as np a=np.full(n,0,int) b=np.full(n,0,int) for k in range(n): x=input().split() a[k]=int(x[0]) b[k]=int(x[1]) m=max(a) inf=10**8 dp=np.full(h+m+1,inf,int) dp[0]=0 for k in range(1,h+m): dp[k]=(dp[k-a]+b).min() print(dp[h:h+m].min())
p02787
s496262977
Accepted
import sys readline = sys.stdin.readline sys.setrecursionlimit(10**8) mod = 10**9+7 #mod = 998244353 INF = 10**18 eps = 10**-7 # 個数制限なしナップサック問題 W,N = map(int,readline().split()) dp = [INF]*(W+1) dp[0] = 0 for i in range(N): w,v = map(int,readline().split()) # dp[j] = 重さj以下でつくれる最大の価値 for j in range(W+1): dp[j] = min(dp[j],dp[max(j-w,0)] + v) print(dp[W])
p03264
s913470841
Accepted
K = int(input()) even = K//2 odd = (K+1)//2 print(even*odd)
p02772
s050686736
Accepted
def main(): N = int(input()) A = list(map(int, input().split())) for i in A: if i % 2 == 0: if i % 3 != 0 and i % 5 != 0: return ("DENIED") return ("APPROVED") print(main())
p03779
s430725025
Accepted
x = int(input()) xn = 0 i = 0 while xn < x: i += 1 xn += i print(i)
p02862
s619210841
Wrong Answer
X,Y=map(int,input().split()) if 2*Y<=X or 2*X<=Y or not((2*Y-X)%3==0) or not((2*X-Y)%3==0): print(0) else: A=(2*Y-X)//3 B=(2*X-Y)//3 k=1 for i in range(A+1,A+B+1): k=(k*i)%1000000007 j=1 for i in range(1,B+1): j=(j*i)%1000000007 l=(pow(j,1000000005,1000000007)*k)%1000000007 print(l)
p03416
s523745157
Wrong Answer
#aからbの整数。 a,b = map(int,input().split()) count=0 for i in range(a,b): i = str(i) if i == i[::-1]: count +=1 else : pass print(count)
p04005
s055989195
Wrong Answer
a,b,c = map(int,input().split()) print(min(a*c,a*b,b*c))
p03612
s367994378
Accepted
n=int(input()) A=list(map(int,input().split()))+[0] c=0 for i in range(n): j=i+1 a=A[i] if a==j: c+=1 A[i]=A[i+1] A[i+1]=j print(c)
p02584
s729118526
Wrong Answer
X, K, D = map(int, input().split()) X= abs(X) min_pos = X%D min_neg = min_pos - D if(X/D > K): print(X-D*K) else: if(int(X/D)%2 == 0): print(min_pos) else: print(abs(min_neg))
p02939
s237041098
Accepted
S = input() ans = [""] j = 0 for i in range(1, len(S) + 1): s = S[j:i] if s != ans[-1]: ans.append(s) j = i print(len(ans) - 1)
p03071
s500760303
Accepted
a,b=map(int,input().split()) if a==b:print(2*a) else:print(max(a,b)*2-1)
p03720
s853773003
Wrong Answer
from collections import Counter N, M = map(int, input().split()) l = [] for _ in range(M): a, b = input().split() l.append(str(a)) l.append(str(b)) c = Counter(l) c = sorted(dict(c).items(), key=lambda x:x[0]) """ collections.Counterを使わない場合 alphabets = [] """ for v in c: print(v[1])
p03779
s338300332
Accepted
x = int(input()) d = 0 for j in range(10 ** 9): d += j if d >= x: print(j) exit()
p03625
s549706858
Accepted
n = int(input()) a = sorted(list(map(int,input().split())),reverse = True) use = [] flag = -1 for i in range(n): if flag == a[i]: use.append(a[i]) flag = -1 else: flag = a[i] if len(use)<2: print(0) else: use.sort(reverse =True) print(use[0]*use[1])
p03219
s141683048
Accepted
X, Y = [int(i) for i in input().split()] print(X + int(Y / 2))
p03069
s006609124
Wrong Answer
N = int(input()) S = input() # 単色のみの場合 if '.' not in S: print(0) exit() elif '#' not in S: print(0) exit() # それ以外 first_black = 0 white_count = 0 for i in range(N): if (S[i] == '.'): white_count += 1 else: first_black = i break remain_white = 0 for j in range(first_black, N): if S[j] == '.': remain_white += 1 print(remain_white)
p03773
s388083015
Accepted
a,b = map(int,input().split()) print((a+b)%24)
p03407
s385470811
Wrong Answer
import sys import math import itertools import bisect from copy import copy from collections import deque,Counter from decimal import Decimal def s(): return input() def i(): return int(input()) def S(): return input().split() def I(): return map(int,input().split()) def L(): return list(input().split()) def l(): return list(map(int,input().split())) def lcm(a,b): return a*b//math.gcd(a,b) sys.setrecursionlimit(10 ** 9) INF = 10**9 mod = 10**9+7 A,B,C = I() if C == A+B or C == A or C == B: print('Yes') else: print('No')
p02959
s838014430
Wrong Answer
n = int(input()) monster_list = list(map(int, input().split())) kill_mon = list(map(int, input().split())) # 配列数を合わせる kill_mon.append(0) # 持ち越しパワーの初期化 killed_monster = 0 next_power = 0 for mons, kill in zip(monster_list, kill_mon): kill += next_power # 全力で倒す if mons >= kill: killed_monster += kill # 持ち越しパワーの初期化 next_power = 0 elif mons < kill: killed_monster += mons next_power = kill - mons print(killed_monster)
p02658
s657522617
Accepted
n = int(input()) arr = [int(x) for x in input().split()] mxN = 10**18 if 0 in arr: print(0) exit() mul = 1 for x in arr: mul*=x if mul > mxN: print(-1) exit() print(mul)
p03095
s645022992
Accepted
from collections import * _=input() c=Counter(input()) ans=1 for i in c.values(): ans*=i+1 ans%=10**9+7 print(ans-1)
p02695
s852026992
Accepted
n,m,q = map(int,input().split()) arr = [list(map(int,input().split())) for i in range(q)] ans = 0 from itertools import combinations_with_replacement for kumi in combinations_with_replacement(range(1,m+1),n): tmp = 0 for ar in arr: if kumi[ar[1]-1]-kumi[ar[0]-1]==ar[2]: tmp+=ar[3] ans = max(ans,tmp) print(ans)
p03419
s808994459
Wrong Answer
n, m=map(int, input().split()) if n==1 and m==1: print(1) elif n==1 and m!=1: print(m-2) else: ans = (m-2)*(n-2) print(ans)
p03131
s813205160
Accepted
K,A,B = map(int,input().split()) if B<=A+2 or K<=A-1: ans = 1+K else: cnt = A-1 ans = A while cnt<=K: k = min(ans//A,(K-cnt)//2) if k>=1: cnt += 2*k ans = ans-k*A + k*B else: ans += (K-cnt) break print(ans)
p02727
s164863987
Accepted
X, Y, A, B, C = map(int, input().split()) P = list(map(int, input().split())) Q = list(map(int, input().split())) R = list(map(int, input().split())) P.sort(reverse=True) Q.sort(reverse=True) R.sort(reverse=True) a = sorted(P[:X] + Q[:Y]) ans = sum(a) for i in range(min(X+Y, C)): if a[i] < R[i]: ans += R[i] - a[i] print(ans)
p03836
s322346204
Wrong Answer
sx, sy ,tx, ty = map(int,input().split()) momo="" xz = abs(tx-sx) yz = abs(ty-sy) momo += "U" * yz + "R" * xz + "D" * yz + "L" * xz momo += "L" * 1 + "U" * (yz+1) + "R" * (xz+1) + "D" * 1 momo += "R" * 1 + "D" * yz + "L" * 1 + "D" *1 + "L"*xz print(momo)
p03455
s198463291
Accepted
a, b = map(int, input().split()) if a*b%2 == 0: print("Even") else: print("Odd")
p02584
s318195282
Accepted
x,k,d = map(int,input().split()) min_p = abs(x)//d min_n = min_p + 1 rest_p = abs(x)- d*min_p rest_n = rest_p - d if k < min_p: print(abs(x) - k*d) elif (k-min_p) % 2 == 0: print(rest_p) else: print(abs(rest_n))
p02838
s347926055
Accepted
import numpy as np mod=10**9+7 N=int(input()) A=np.array(list(map(int, input().split()))) ans=0 for i in range(60): b=np.count_nonzero(A>>i&1) ans+=(2**i)*b*(N-b) ans%=mod print(ans)
p03324
s880440580
Accepted
import sys def resolve(): D, N = list(map(int, input().split(" "))) if D == 0: if N == 100: print(101) else: print(N) if D == 1: if N == 100: print(100*101) else: print(100*N) if D == 2: if N == 100: print(10000*101) else: print(10000*N) if '__main__' == __name__: resolve()
p02660
s586083326
Wrong Answer
N = int(input()) ans = 0 n = N counter = [] for i in range(2, int(N**0.5) + 1): if n % i == 0: counter.append(1) n = n // i while n % i == 0: counter[-1] += 1 n = n // i for c in counter: a = 1 while c - a >= 0: c -= a a += 1 ans += 1 print(1 if ans == 0 else ans)
p03457
s379242241
Accepted
N = int(input()) nowt = 0 nowx = 0 nowy = 0 for i in range(N): t, x, y = map(int, input().split()) ti = t - nowt xi = x - nowx yi = y - nowy if ti < abs(xi) + abs(yi): print('No') exit() if ti%2 != (xi+yi)%2: print('No') exit() nowt = t nowx = x nowy = y print('Yes')
p02916
s034497410
Wrong Answer
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) c.append(0) p = 0 ans = 0 for i in range(n): ans += b[a[i]-1] ans += p p = c[a[i]-1] print(ans)
p02699
s506939329
Accepted
s,w = map(int,input().split()) if s <= w: print('unsafe') else: print('safe')
p02880
s102195402
Wrong Answer
N = int(input()) kk_list = [] for a in range(1, 10): for b in range(1, 10): kk_list.append(a * b) print(kk_list) if N in kk_list: print("Yes") else: print("No")
p02548
s838745395
Accepted
import sys import itertools # import numpy as np import time import math from heapq import heappop, heappush from collections import defaultdict from collections import Counter from collections import deque from itertools import permutations sys.setrecursionlimit(10 ** 7) INF = 10 ** 18 MOD = 10 ** 9 + 7 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # map(int, input().split()) N = int(input()) ans = 0 for a in range(1, N): ans += N // a if N % a == 0: ans -= 1 print(ans)
p02909
s913274435
Accepted
S = input() if S == "Sunny": print("Cloudy") elif S == "Rainy": print("Sunny") else: print("Rainy")
p03455
s603534000
Accepted
a, b = map(int, input().split()) if a%2==0 or b%2==0: print('Even') else: print('Odd')
p02597
s367789101
Accepted
n = int(input()) s = input() num = s.count("R") L = s[:num] ans = L.count("W") print(ans)
p03774
s489240723
Wrong Answer
n, m = map(int, input().split()) students = [list(map(int, input().split())) for i in range(n)] targets = [list(map(int, input().split())) for i in range(m)] x = 0 snumber = [(0, x)] * n def md(s, t): d = abs(s[0] - t[0]) + abs(s[1] - t[1]) return d for i in range(n): x = 2 * 10 ** 8 for j in range(m): if x >= md(students[i], targets[j]): x = md(students[i], targets[j]) snumber[i] = (j+1, md(students[i], targets[j])) for i in range(n): print(snumber[i][0])
p03705
s476938423
Accepted
import itertools n, a, b = map(int, input().split()) if n == 1: if a == b: print(1) else: print(0) elif n == 2: print(1) elif n >= 3: if a > b: print(0) else: smin = a * n + (b-a) smax = b * n - (b-a) print(smax-smin+1)
p02663
s125540546
Accepted
h1, m1, h2, m2, k =map(int, input().split()) ans = (h2-h1)*60+(m2-m1)-k print(ans)
p03338
s435821482
Accepted
def main(): N = int(input()) S = input() maxv = 0 for i in range(1,N-1): x = S[0:i] y = S[i:N] xl = list(set(x)) yl = list(set(y)) cnt = 0 for xx in xl: cnt += yl.count(xx) maxv = max(maxv,cnt) print(maxv) if __name__ == '__main__': main()
p03127
s798121389
Accepted
def gcd(m,n): while (m % n != 0): n,m = m%n,n return(n) n = int(input()) a = list(map(int,input().split())) g = a[0] for i in range(1,n): g = gcd(g,a[i]) print(g)