problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03274
s323503714
Accepted
def resolve(): N, K = map(int, input().split()) A = list(map(int, input().split())) ans = 1 << 60 for i in range(N - K + 1): l = A[i] r = A[i + K - 1] l_to_r = abs(l) + abs(l - r) r_to_l = abs(r) + abs(r - l) res = min(l_to_r, r_to_l) ans = min(ans, res) print(ans) if __name__ == "__main__": resolve()
p02881
s725784748
Accepted
import itertools def read(): N = int(input()) return N, def solve(N, ): move = 1000000000000 a = 1 b = N while a < b: b = N // a if N % a == 0: move = min(move, a + b - 2) a += 1 return move if __name__ == '__main__': input = read() print(solve(*input))
p03645
s391894509
Accepted
import sys readline = sys.stdin.readline def main(): N, M = map(int, readline().rstrip().split()) path = [[] for _ in range(N)] for _ in range(M): a, b = map(int, readline().rstrip().split()) path[a-1].append(b-1) path[b-1].append(a-1) for p in path[0]: if N-1 in path[p]: print('POSSIBLE') return print('IMPOSSIBLE') return if __name__ == '__main__': main()
p02719
s853225123
Accepted
n,k = map(int,input().split()) ans = n ans = min(ans,n%k) ans = min(ans,abs(k-n%k)) print(ans)
p03208
s337143646
Accepted
N,K = map(int,input().split(" ")) H = sorted([int(input()) for _ in range(N)]) Min = 10**10 for i in range(K-1,len(H))[::-1]: Abs = H[i]-H[i-(K-1)] if Abs<Min: Min = Abs print(Min)
p03804
s182511144
Accepted
import sys readline = sys.stdin.readline N, M = map(int, readline().split()) A = [readline().rstrip() for _ in range(N)] B = [readline().rstrip() for _ in range(M)] for i in range(N-M+1): for j in range(N-M+1): if all(A[i+x][j:j+M] == B[x] for x in range(M)): print('Yes') sys.exit() print('No')
p02958
s817962305
Accepted
N=int(input()) p=list(map(int,input().split())) count=0 for i in range(N): if p[i]!=i+1: count+=1 print("YES" if count<=2 else "NO")
p03324
s783019036
Accepted
A,B=map(int,input().split()) if B==100: print((100**A)*101) exit() print((100**A)*B)
p03131
s721920281
Wrong Answer
K, A, B = map(int, input().split()) if B - A <= 2 : print(K + 1) elif K < A + 1: print(K + 1) else : ans = B count = K - A - 1 loop = count // (A + 2) amari = count % (A + 2) ans += B * loop + amari print(ans)
p03799
s117233397
Wrong Answer
N, M = map(int,input().split()) ans = 0 if N * 2 <= M//2: ans += N nokori_c = M - N * 2 ans += nokori_c // 4 print(ans) else: ans += M//2 print(ans)
p03852
s382963817
Accepted
c = str(input()) if c=="a" or c=="i" or c=="u" or c=="e" or c=="o": print("vowel") else: print("consonant")
p02642
s446233757
Accepted
from collections import Counter import math N = int(input()) a = list(map(int,input().split())) a.sort() is_prime = [True]*(10**6 + 1) is_prime[0] = False maxA = max(a) for i in set(a): for j in range(2 * i, maxA+1, i): is_prime[j] = False result = 0 c = Counter(a) for e in set(a): if is_prime[e] and c[e] == 1: # print('e = {}'.format(e)) result += 1 print(result)
p03000
s235186252
Accepted
N,X = list(map(int,input().split())) L_list = list(map(int,input().split())) ans = 1 current = 0 for i in range(N): current += L_list[i] if current <= X: ans += 1 print(ans)
p03035
s617077225
Accepted
a, b = map(int, input().split()) if a >= 13: print(b) elif a >= 6: print(b//2) else: print(0)
p03338
s325115255
Accepted
N = int(input()) S = input() ans = 0 for i in range(N): x = set(S[:i]) y = set(S[i:]) ans = max(ans, len(x & y)) print(ans)
p02801
s642336463
Accepted
letter = input() print(chr(ord(letter) + 1))
p03329
s931531590
Accepted
N = int(input()) dp = [float("inf") for i in range(N+1)] for i in range(6): if i <= N: dp[i] = i for i in range(N+1): c = 1 while i+6**c <= N: dp[i+6**c] = min(dp[i+6**c],dp[i]+1) c += 1 c = 1 while i+9**c <= N: dp[i+9**c] = min(dp[i+9**c],dp[i]+1) c += 1 for i in range(N,0,-1): if dp[i] != 0: ans = dp[i] + N-i break print(ans)
p03379
s542836844
Wrong Answer
n = int(input()) x = list(map(int, input().split())) sort_x = sorted(x) l = sort_x[n//2 - 1] r = sort_x[n//2] for xi in x: print(l if xi <= l else r)
p04030
s485543902
Wrong Answer
def resolve(): s = input() lis = [] ans = "" for i in range(len(s)): if s[i] != "B": lis.append(s[i]) elif s[i] == "B" and len(lis) != 0: lis.remove(lis[-1]) for j in range(len(lis)): ans += lis[j] print(ans) resolve()
p03127
s511952692
Accepted
from fractions import gcd n=int(input()) a=list(map(int,input().split())) g=a[0] for i in range(n): g=gcd(g,a[i]) print(g)
p02972
s119954135
Accepted
n = int(input()) a = [0] + list(map(int, input().split())) b = [0]*(n+1) b[-1] = a[-1] ans = [] for i in range(n, 0, -1): cnt = 0 bi = i i += bi while i <= n: cnt += b[i] i += bi if (cnt%2) == a[bi]: b[bi] = 0 else: b[bi] = 1 ans.append(bi) print(len(ans)) if ans: print(*ans)
p03360
s846528609
Wrong Answer
li=list(map(int,input().split())) a=li.pop(-1) k=int(input()) a=a*(2**k) for i in li: a+=i print(a)
p03329
s163209586
Accepted
import sys sys.setrecursionlimit(10**8) INF = 10**8 def rec(x, memo): if x == 0: return 0 if memo[x] != -1: return memo[x] res = INF pow6 = 1 while x - pow6 >= 0: res = min(res, rec(x-pow6, memo)+1) pow6*=6 pow9 = 1 while x - pow9 >= 0: res = min(res, rec(x-pow9, memo)+1) pow9*=9 memo[x] = res return res n = int(input()) memo = [-1]*(n+1) print(rec(n, memo))
p03680
s281506344
Accepted
N=int(input()) li = [] now = 0 ans = -1 count = 0 for n in range(N): li.append(int(input())) for n in range(N + 1): if n == 0: now = li[0] count += 1 if now == 2: ans = count break now = li[now - 1] count += 1 if now == 2: ans = count break print(ans)
p02556
s494019906
Accepted
n, *XY = map(int, open(0).read().split()) XY = list(zip(XY[::2], XY[1::2])) A = [x+y for x, y in XY] B = [x-y for x, y in XY] print(max(max(A) - min(A), max(B) - min(B)))
p03106
s242564481
Wrong Answer
A, B, K = map(int, input().split()) l = [] for i in range(1, min(A, B) + 1): if A % i == 0 and B % i == 0: l.append(i) l.sort() print(l[K-1])
p03997
s535199229
Accepted
a = int(input()) b = int(input()) h = int(input()) print(int((a+b)*h/2))
p02947
s636268041
Accepted
import sys from collections import defaultdict read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N = int(readline()) S = [0] * N for i in range(N): S[i] = readline().strip() ans = 0 d = defaultdict(int) for s in S: s = ''.join(sorted(s)) if s in d: ans += d[s] d[s] += 1 print(ans) return if __name__ == '__main__': main()
p02963
s309881221
Accepted
S = int(input()) x1 = 0 y1 = 0 x2 = 10 ** 9 y2 = 1 y3_, x3_ = divmod(S, x2) if y3_ == 10 ** 9: y3 = y3_ x3 = x3_ else: y3 = y3_ + 1 x3 = 10 ** 9 - x3_ print(x1, y1, x2, y2, x3, y3)
p04020
s846636059
Accepted
N = int(input()) ans = 0 tmp = 0 for _ in range(N): a = int(input()) if a != 0: tmp += a else: ans += tmp // 2 tmp = 0 ans += tmp//2 print(ans)
p03449
s891073554
Accepted
N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) B[0]+=A[0] for i in range(1,N): A[i] += A[i-1] B[i]+=max(A[i],B[i-1]) print(B[N-1])
p02731
s783142752
Accepted
def Maximum_Volume(l): ans = l / 3 return ans ** 3 def main(): l = int(input()) print(Maximum_Volume(l)) if __name__ == '__main__': main()
p02842
s160764439
Accepted
import math N = int(input()) for i in range(1,46298): if math.floor(i*1.08) == N: print(i) exit() print(":(")
p04019
s045248068
Wrong Answer
S = input() x = 0 y = 0 for i in S: if i == 'N': y += 1 elif i == 'W': x -= 1 elif i == 'S': y -= 1 elif i == 'E': x += 1 if x == 0 and y == 0: print('Yes') else: print('No')
p03448
s086041168
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 k in range(c + 1): if 500*i + 100*j + 50*k == x: cnt += 1 print(cnt)
p02952
s687868413
Accepted
N=int(input()) ans=0 for i in range(1,N+1): if len(str(i))%2==1: ans+=1 print(ans)
p02744
s421344633
Accepted
N = int(input()) al = 'abcdefghijk' def next(digits, kind, cur): if digits == N: print(cur) return for i in range(kind+1): if i == kind: next(digits+1, kind+1, cur+al[i]) else: next(digits+1, kind, cur+al[i]) next(1, 1, 'a')
p03220
s379996492
Accepted
N = int(input()) T, A = map(int, input().split()) X = list(map(int, input().split())) Tem = [0]*N for i in range(N): Tem[i] = T-X[i]*0.006 D = [0]*N for i in range(N): D[i] = abs(Tem[i]-A) ans = D.index(min(D))+1 print(ans)
p03730
s502181085
Accepted
#!/usr/bin/env python3 from math import gcd def solve(a,b,c): d = gcd(a,b) if c % d == 0: return "YES" else: return "NO" def main(): a,b,c = map(int,input().split()) print(solve(a,b,c)) return if __name__ == '__main__': main()
p02790
s732796466
Accepted
# -*- coding: utf-8 -*- # B - Comparing Strings import sys def solve152B(a, b): minI, maxI = a, b if a > b: maxI, minI = a, b st = "" for i in range(maxI): st += str(minI) print(st) if __name__ == "__main__": a, b = list(map(int, input().split())) solve152B(a, b)
p03037
s666281920
Accepted
def solve(l,r): l_max = max(l) r_min = min(r) return max(r_min - l_max + 1, 0) N,M = map(int,input().split()) L = [0]*M R = [0]*M for i in range(M): L[i],R[i] = map(int,input().split()) print(solve(L,R))
p02760
s780483735
Wrong Answer
l=[list(map(int,input().split())) for i in range(3)] l=sum(l,[]) n=int(input()) li=set([input() for ini in range(n)]) d=[0 for i in range(9)] for g in range(9): if l[g] in li:d[g]=1 if set([1]) in [set(d[h::3])for h in range(3)]+[set(d[h:h+3])for h in {0,3,6}]+[set([d[0],d[4],d[8]]),set([d[2],d[4],d[6]])]: print("Yes") else:print("No")
p02631
s467876006
Wrong Answer
N=int(input()) a_list=list(map(int,input().split())) a_list.sort(reverse=True) c_list=[None]*N c_list[0]=2**(len(bin(a_list[0])[2:])) b=a_list[0] for i,a in enumerate(a_list[1:]): c_list[1+i]=b^a^c_list[i] b=a ans=" ".join(list(map(str,c_list))) print(ans)
p02641
s470225489
Accepted
x, n = map(int, input().split()) p = list(map(int, input().split())) for i in range(100): if not p.count(x-i): print(x-i) exit() elif not p.count(x+i): print(x+i) exit()
p02759
s334168057
Wrong Answer
N=int(input()) print(N/2+N%2)
p02880
s565620832
Accepted
N = int(input()) list = [] for i in range(1, 10): for j in range(1, 10): list.append(i * j) if N in list: print("Yes") else: print("No")
p02725
s761844115
Wrong Answer
k,n = map(int,input().split()) s = list(map(int,input().split())) longest = 0 for i in range(n-1): long = s[i+1] - s[i] if long > longest: longest = long if longest >= k - s[n-1] + s[0]: print(k - longest) else: print(k - s[n-1] + s[0])
p02660
s856022711
Accepted
import collections N = int(input()) ans = 0 a = [] while N % 2 == 0: a.append(2) N //= 2 f = 3 while f * f <= N: if N % f == 0: a.append(f) N //= f else: f += 2 if N != 1: a.append(N) A = collections.Counter(a) A = list(A.values()) for i in range(len(A)): cnt = 1 val = A[i] while val >= cnt: ans += 1 val -= cnt cnt += 1 print(ans)
p02546
s484722720
Accepted
S = input() if S[-1] == "s" : print(S + "es") else : print(S + "s")
p02783
s735293662
Accepted
h,a = map(int,input().split()) if h % a == 0: print(h//a) else: print(h//a+1)
p02675
s193385447
Accepted
N = int(input()[-1]) if N in [2,4,5,7,9]: print('hon') elif N in [0,1,6,8]: print('pon') elif N in [3]: print('bon')
p03352
s174167822
Wrong Answer
x = int(input()) ans = 0 for i in range(1, x): for j in range(2, x): if i**j <= x: ans = max(ans, i**j) elif i**j > x: break print(ans)
p02553
s552098854
Wrong Answer
a,b,c,d = map(int, input().split()) if a>0 and c>0: print(b*d) else: if b>0 and d>0: print(b*d) elif b<0 and d>0: print(max(a,b)*min(c,d)) elif d<0 and b>0: print(min(a,b)*max(c,d)) else: print(min(a,b)*min(c,d))
p02832
s802333711
Accepted
n = int(input()) a = list(map(int, input().split())) num = 1 b_num = 0 for i in range(n): if num != a[i]: b_num += 1 else: num += 1 if b_num == n: b_num = -1 print(b_num)
p03705
s371638971
Accepted
N, A, B = map(int, input().split()) if N==1 and A==B: ans = 1 elif N==1: ans = 0 elif A > B: ans = 0 else: ans = (B-A) * (N-2) + 1 print(ans)
p02947
s115836776
Accepted
from collections import Counter as counter ii = lambda:int(input()) mi = lambda:list(map(int,input().split())) ix = lambda x:list(input() for _ in range(x)) mix = lambda x:list(li() for _ in range(x)) iix = lambda x:list(int(input()) for _ in range(x)) ########## def main(n,s): res = 0 for i in counter(s).values(): if 1 < i : res += int(i*(i-1)/2) print(res) n = ii() s = list("".join(sorted(input())) for _ in range(n)) main(n,s)
p03611
s710482784
Wrong Answer
#ABC072-C import collections import itertools n = int(input()) a = list(map(int,input().split())) a.sort() c = collections.Counter(a) acc = list(itertools.accumulate(c.values())) acc.insert(0,0) tmp = 0 tmp_prev = 0 if len(acc) >= 3: for i in range(3,len(acc)): tmp = acc[i] - acc[i-3] if tmp >= tmp_prev: tmp_prev = tmp print(tmp_prev) else: print(acc[-1])
p03495
s104939952
Accepted
import collections def main(): n,k=map(int, input().split()) A=[int(i) for i in input().split()] dd = collections.defaultdict(int) for i in A: dd[i]+=1 res = [] for i in dd.keys(): res.append([i,dd[i]]) res.sort(key = lambda x:x[1]) type = len(res) result = 0 i=0 while(type > k): result += res[i][1] type-=1 i+=1 print(result) if __name__ == '__main__': main()
p03672
s822130480
Accepted
s=input() n=len(s) for i in range(1,n//2): if s[0:n//2-i]==s[n//2-i:n-2*i]: print(n-2*i) break #print(s[0:n//2-i],s[n//2-i:n-2*i])
p02923
s390352159
Accepted
x=int(input()) y=list(map(int, input().split())) ans=0 count=0 for i in range((x-1),0,-1): if y[i]<=y[i-1]: count=count+1 else: if ans<count: ans=count count=0 if ans<count: ans=count print(ans)
p02689
s553380994
Accepted
n, m = map(int, input().split()) h = list(map(int, input().split())) a = [list(map(int,input().split())) for i in range(m)] b = [0] * n for i in range(m): if h[a[i][0]-1] > h[a[i][1]-1]: b[a[i][1]-1] +=1 if h[a[i][0]-1] < h[a[i][1]-1]: b[a[i][0]-1] +=1 if h[a[i][0]-1] == h[a[i][1]-1]: b[a[i][1]-1] +=1 b[a[i][0]-1] +=1 print(b.count(0))
p03107
s985575529
Accepted
S = input() N = len(S) cnt0 = S.count("0") cnt1 = S.count("1") ans = 2*min(cnt0, cnt1) print(ans)
p03146
s660667450
Wrong Answer
s=int(input()) cnt=0 while s!=4: if s%2!=0: s=3*s+1 cnt+=1 elif s%2==0: s=s//2 cnt+=1 if s==4: print(cnt+4)
p03827
s375848889
Wrong Answer
n=int(input()) x=0 b=[] s=input() for S in s: if S=='I': x += 1 b.append(x) else: x -= 1 b.append(x) print(max(b))
p02601
s158071499
Accepted
r, g , b = map(int, input().split()) k = int(input()) while(g <= r): g *= 2 k -= 1 while(b <= g): b *= 2 k -= 1 if k >= 0: print("Yes") else: print("No")
p02633
s434371997
Accepted
n = int(input()) for i in range(1, 180, 1): if(360*i % n == 0): print(int(360*i//n)) exit(0)
p03407
s988689814
Wrong Answer
a, b, c = (int(i) for i in input().split()) if a+b <= c: print('Yes') else: print('No')
p02987
s605277408
Accepted
S=set(input()) if len(S)==2: print('Yes') else: print('No')
p02720
s406842319
Wrong Answer
import queue K = int(input()) A = queue.Queue() for i in range(1, 10): A.put(i) num = 0 while num < K: emp = A.get() var = emp % 10 if var != 0: A.put(emp*10+var-1) A.put(10*emp) if var != 9: A.put(emp*10+var+1) num += 1 print(num, emp) print(emp)
p03449
s517962402
Wrong Answer
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) cnt = A[0] if N == 1: print(A[0] + B[0]) exit() for i in range(N-1): if sum(A[i+1:]) > sum (B[i:-1]): cnt += A[i+1] else: cnt += B[i] print(cnt + sum(B[i+1:])) exit() print(cnt + B[-1])
p03767
s761201671
Accepted
N = int(input()) a = list(map(int, input().split())) a.sort() print(sum(a[N:][0::2]))
p03407
s670303072
Accepted
A,B,C = map(int,input().split()) if A+B >= C: print("Yes") else: print("No")
p04043
s754843637
Wrong Answer
ABC=input().split() five_count=ABC.count("5") seven_count=ABC.count("7") if five_count == 2 and seven_count==1: print("Yes") else: print("NO")
p02939
s744691899
Wrong Answer
def calc(num): num += 1 if num <= 2: return 1 else: return num // 2 + 1 txt = input() total = 0 renzoku = 0 for i in range(len(txt) - 1): #print(txt[i], txt[i + 1]) if txt[i] != txt[i + 1]: if renzoku == 0: total += 1 else: total += calc(renzoku) renzoku = 0 else: #print(i, "renozku") renzoku += 1 if renzoku != 0: total += calc(renzoku) else: total += 1 print(total)
p03657
s639634357
Accepted
a, b = map(int, input().split()) if (a + b) % 3 == 0 or b % 3 == 0 or a % 3 == 0: print("Possible") else: print("Impossible")
p03131
s525031501
Wrong Answer
n,a,b = map(int,input().split()) n += 1 if a+2<=b and n>=a+2: x = n//(a+2) y = n%(a+2) ans = x*b+y else: ans = n print(ans)
p03852
s562983060
Accepted
a = input() print("vowel") if a in "aiueo" else print("consonant")
p02888
s476197707
Accepted
import bisect def solve(): n = int(input()) L = [int(i) for i in input().split()] L.sort() total = 0 for s in range(n-2): for m in range(s+1, n-1): #二分探索モジュールbisect l = bisect.bisect_left(L,L[s]+L[m], 0, n) if l>m: total += l-m-1 print(total) return 0 if __name__ == "__main__": solve()
p04005
s357571290
Accepted
def resolve(): import sys input = sys.stdin.readline a, b, c = [int(x) for x in input().rstrip().split(" ")] if (a * b * c) % 2 == 0: print(0) return a, b, c = sorted([a, b, c]) print(a * b) if __name__ == "__main__": resolve()
p02630
s815218847
Accepted
import bisect n = int(input()) a = list(map(int,input().split())) q = int(input()) b = [0 for _ in range(q)] c = [0 for _ in range(q)] for i in range(q): b[i],c[i] = map(int,input().split()) cnt = [0 for _ in range(100001)] for i in a: cnt[i] += 1 ans = sum(a) for i in range(q): current = cnt[b[i]]*(c[i]-b[i]) ans += current print(ans) cnt[c[i]] += cnt[b[i]] cnt[b[i]] = 0
p02615
s346000379
Accepted
n=int(input()) a=list(map(int,input().split())) a.sort() a.reverse() ans=0 for i in range(int(n//2)): ans+=a[i] for i in range(1,n-int(n//2)): ans+=a[i] print(ans)
p02989
s828270083
Accepted
N=int(input()) S=list(map(int,input().split())) T=sorted(S) if T[N//2]==T[(N-2)//2]: print("0") else: print(T[N//2]-T[(N-2)//2])
p03359
s218521408
Wrong Answer
a,b = map(int,input().split()) c = max(a,b) if c > 12: print(a) else: print(c)
p02642
s625344207
Accepted
N=int(input()) A=list(map(int,input().split())) A.sort() dic={} for i in range(N): if A[i] not in dic: dic[A[i]]=0 dic[A[i]]+=1 ban=set([]) res=0 for i in range(N): a=A[i] if a not in ban: if dic[A[i]]==1: res+=1 for j in range(1,10**6//a+1): ban.add(a*j) print(res)
p02613
s457927088
Accepted
N = int(input()) C = [0, 0, 0, 0] for i in range(N): S = input() if S == 'AC': C[0] += 1 elif S == 'WA': C[1] += 1 elif S == 'TLE': C[2] += 1 elif S == 'RE': C[3] += 1 s = "AC x " + str(C[0]) + "\nWA x " + str(C[1]) + "\nTLE x " + str(C[2]) + "\nRE x " + str(C[3]) print(s)
p02838
s477225074
Accepted
#https://atcoder.jp/contests/abc147/submissions/12994515を見た import numpy as np n = int(input()) a = np.array(input().split(),dtype=int) mod = 10**9+7 m2 = [1 for i in range(60)] for i in range(1,60): m2[i] = (m2[i-1]*2)%mod ans = 0 for i in range(60): ni = np.count_nonzero(a&1) ans = (ans+ni*(n-ni)%mod*m2[i])%mod a >>= 1 print(ans)
p02818
s338235056
Accepted
A,B,K = map(int, input().split()) print(A-K, B) if K <= A else print(0,0) if (A+B) <= K else print(0, A+B-K)
p03035
s396495507
Accepted
A,B = map(int,input().split()) if A < 6: print(0) elif 6 <= A and A <= 12: print(B//2) else: print(B)
p03665
s999435716
Wrong Answer
n, p = map(int, input().split()) a = [1 if i%2==0 else 0 for i in map(int,input().split())] sum_a = sum(a) if p==0: print(n*(n-1)//2-sum_a*(n-sum_a)+1) else: print(sum_a*(n-sum_a))
p03745
s013412573
Accepted
N = int(input()) A = list(map(int, input().split())) def solve(N,A): liss = [] lis = [] lis.append(A[0]) a = A[0] for i in range(1,N): if len(lis)==1 or prev==0: prev = A[i]-a elif (A[i]-a)*prev<0: liss.append(lis) lis = [] lis.append(A[i]) a = A[i] liss.append(lis) ans = len(liss) return ans print(solve(N,A))
p03035
s209670269
Accepted
# ABC127 # A Ferris Wheel a, b = map(int, input().split()) if a > 12: print(b) exit() elif a < 6: print(0) exit() else: print(b // 2) exit()
p03475
s948533607
Accepted
n=int(input()) lst=[] for i in range(n-1): c,s,f=map(int,input().split()) lst.append([c,s,f]) for i in range(n-1): time=0 for j in range(i,n-1): if time<=lst[j][1]: time=lst[j][1]+lst[j][0] continue if time%lst[j][2]==0: time+=lst[j][0] continue time+=(lst[j][2]-time%lst[j][2])+lst[j][0] print(time) print(0)
p04012
s080873286
Accepted
w=list(input()) W=list(set(w)) a=[] for i in range(len(W)): a.append(w.count(W[i])) b=[] for i in range(len(a)): if a[i]%2==0: b.append('yes') else: b.append('no') if 'no' in b: print('No') else: print('Yes')
p03986
s715942755
Accepted
X = input() res = 0 l = 0 for x in X: if x == 'S': l += 1 elif l > 0: res += 1 l -= 1 print(len(X)-2*res)
p02684
s455900014
Accepted
import sys input = sys.stdin.readline n, k = map(int, input().split()) a = list(map(int, input().split())) cnt, town = 0, 1 l, s = [], set() while True: town = a[town - 1] cnt += 1 if cnt == k: print(town) exit() if town in s: loop_start = town break l.append(town) s.add(town) loop_cnt = l.index(loop_start) loop = l[loop_cnt:] print(loop[(k - loop_cnt) % len(loop) - 1])
p02835
s849461389
Accepted
a = list(map(int, input().split())) if sum(a) >= 22: print('bust') else: print('win')
p02987
s747521392
Accepted
s = input() if(s[0]==s[1])and(s[1]==s[2])and(s[2]==s[3]): print("No") elif(s[0]==s[1])and(s[2]==s[3]): print("Yes") elif(s[1]==s[2])and(s[0]==s[3]): print("Yes") elif(s[1]==s[3])and(s[0]==s[2]): print("Yes") else: print("No")
p03943
s759470644
Accepted
a, b, c = map(int, input().split()) if a+b==c or a+c==b or b+c==a: print("Yes") else: print("No")
p03545
s889579407
Accepted
import sys import itertools a,b,c,d=[i for i in input()] op=["+","-"] for i in itertools.product(op,repeat=3): ev=a+i[0]+b+i[1]+c+i[2]+d if eval(ev)==7: print(ev+"=7") sys.exit()
p02835
s314238638
Wrong Answer
a,b,c=[int(i) for i in input().split()] d=a+b+c if d>22: print('bust') else: print('win')