TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
N, M = map(int, input().split())
b_cnt = 2 ** N 
INF = 10 ** 9
dp = [INF] * b_cnt

for i in range(M):
    a, b = map(int, input().split())
    c = sum([2 ** (int(x)-1) for x in list(input().split())])
    for j in range(b_cnt):
        if dp[j|c] > dp[j] + a:
            dp[j|c] = dp[j] + a

if dp[-1] == INF:
    print(-1)
else:
    print(dp[-1])

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
bit_cnt = 2 ** N 
INF = 10 ** 10
dp = [INF] * bit_cnt
dp[0] = 0
for _ in range(M):
    price, b = lr()
    open = sum([2 ** (x-1) for x in lr()]) 
    for j in range(bit_cnt):
        if dp[j|open] > dp[j] + price:
            dp[j|open] = dp[j] + price

if dp[-1] == INF:
    print(-1)
else:
    print(dp[-1])


Verdicts: Wrong Answer

Accepted
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
import math
N, M = list(map(int, input().split(" ")))
abc = [[0, 0, 0] for i in range(M)]
for i in range(M):
  abc[i][0], abc[i][1] = list(map(int, input().split(" ")))
  c = list(map(int, input().split(" ")))
  for j in range(N):
    cbits = (1 << j) * (j+1 in c)
    abc[i][2] |= cbits

dp = [0 if i == 0 else math.inf for i in range(2**N)]
for i in range(M):
  for j in range(2**N):
    dp[j|AB[i][2]] = min(dp[j]+AB[i][0], dp[j|AB[i][2]])
print(dp[-1] if dp[-1] != math.inf else -1)

N, M = list(map(int, input().split(" ")))
abc = [[0, 0, 0] for i in range(M)]
for i in range(M):
  abc[i][0], abc[i][1] = list(map(int, input().split(" ")))
  c = list(map(int, input().split(" ")))
  for j in c:
    cbits = (1 << j-1) 
    abc[i][2] |= cbits

dp = [0 if i == 0 else float("inf") for i in range(2**N)]
for i in range(M):
  for j in range(2**N):
    if dp[j|abc[i][2]] > dp[j]+abc[i][0]:
      dp[j|abc[i][2]] = dp[j]+abc[i][0]
print(dp[-1] if dp[-1] != float("inf") else -1)

Verdicts: Runtime Error

Accepted
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
n,m=map(int,input().split())
keys=[None]*m
dp=[-1]*(2**n)
for i in range(m):
  a,b=map(int,input().split())
  c=list(map(int,input().split()))
  cond=0
  for j in c:
    cond+=2**(j-1)
  keys[i]=[a,cond]
for key in keys:
  for sta in range(2**n):
    if dp[sta|key[1]]==-1:
      dp[sta|key[1]]=key[0]
    else:
      dp[sta|key[1]]=min(dp[sta|key[1]],dp[sta]+key[0])
print(dp[-1])

n,m=map(int,input().split())
keys=[None]*m
dp=[-1]*(2**n)
dp[0]=0
for i in range(m):
  a,b=map(int,input().split())
  c=list(map(int,input().split()))
  cond=0
  for j in c:
    cond+=2**(j-1)
  keys[i]=[a,cond]
for key in keys:
  for sta in range(2**n):
    if dp[sta]==-1:continue
    if dp[sta|key[1]]==-1:
      dp[sta|key[1]]=key[0]+dp[sta]
    else:
      dp[sta|key[1]]=min(dp[sta|key[1]],dp[sta]+key[0])
print(dp[-1])

Verdicts: Wrong Answer

Accepted
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
dp = [float('inf')] * (2 ** n)
dp[0] = 0
for i in range(m):
    a, b = map(int, input().split())
    c = sum(1 << (i - 1) for i in map(int, input().split()))
    for j in range(2 ** n):
        if dp[c | n] > dp[j] + a:
            dp[c | n] = dp[j] + a

if dp[-1] == float('inf'):
    ans = -1
else:
    ans = dp[-1]
print(ans)


import sys
input = sys.stdin.readline

n, m = map(int, input().split())
dp = [float('inf')] * (2 ** n)
dp[0] = 0
for i in range(m):
    a, b = map(int, input().split())
    c = sum(1 << (i - 1) for i in map(int, input().split()))
    for j in range(2 ** n):
        if dp[c | j] > dp[j] + a:
            dp[c | j] = dp[j] + a

if dp[-1] == float('inf'):
    ans = -1
else:
    ans = dp[-1]
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
N, M = map(int, input().split())
a = []
b = []
c = []
sys.setrecursionlimit(2000)

for i in range(M):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)
    ci = list(map(int, input().split()))
    c.append(ci)

c_bin = [0] * M
for j in range(M):
    for k in range(b[j]):
        c_bin[j] |= (1 << (c[j][k] - 1))

ceil = 1 << N
memo = [None] * (ceil * (M + 1))

def dp(pos, state):
    global M, ceil
    idx = pos * ceil + state
    
    if state == ceil - 1:
        ret = 0
    elif pos == M:
        ret = -1
    elif memo[idx] != None:
        return memo[idx]
    else:
        ret0 = dp(pos + 1, (state | c_bin[pos]))
        ret1 = dp(pos + 1, state)
        if ret0 == ret1 == -1:
            ret = -1
        elif ret1 == -1:
            ret = a[pos] + ret0
        else:
            ret = min(a[pos] + ret0, ret1)
    #
    memo[idx] = ret
    return ret

print(dp(0, 0))

N, M = map(int, input().split())
a = []
b = []
c = []

MY_INF = 1000000007

for _ in range(M):
    a_tmp, b_tmp = map(int, input().split())
    a.append(a_tmp)
    b.append(b_tmp)
    c.append(list(map(int, input().split())))

c_bin = []
for i in range(M):
    c_bin.append(sum([1 << (cij - 1) for cij in c[i]]))
    
memo = [None] * (1 << N)

def dp(state):
    global MY_INF
    if state == (1 << N) - 1: return 0
    if memo[state] != None: return memo[state]
    #
    rets = [MY_INF]
    for i in range(M):
        if (state | c_bin[i]) > state:
            rets.append(a[i] + dp((state | c_bin[i])))
    ret = min(rets)
    #
    memo[state] = ret
    return ret

ans = dp(0)
if ans != MY_INF:
    print(ans)
else:
    print(-1)

Verdicts: Runtime Error

Accepted
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
I=lambda:list(map(int,input().split()));n,m=I();d=[0]+[9**9]*2**n
while m:
 m-=1;a=I()[0];s=sum(2<<c-1for c in I())
 for j in range(2**n):d[s|j]=min(d[s|j],d[j]+a)
print(d[-2]%9**9or-1)

I=lambda:list(map(int,input().split()))
n,m=I()
e=[(I()[0],[2**(n-i)for i in I()])for _ in'_'m]
I=9**9
dp=[I]*2**n
dp[0]=0
for i,d in enumerate(dp):
    if d==I:continue
    for a,c in e:
        b,x=i,d+a
        for j in c:b|=j
        if dp[b]>x:dp[b]=x
print(-(dp[-1]==I)or dp[-1])

I=lambda:map(int,input().split())
n,m=I()
d=[0]+[9**9]*2**n
while m:
 m-=1;a,_=I();s=sum(1<<c-1for c in I())
 for j in range(2**n):d[s|j]=min(d[s|j],d[j]+a)
print(d[-2]%9**9or-1)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
n, m = list(map(int, input().split()))

a = []
b = []
c = {}
for i in range(m):
    _a, _b = list(map(int, input().split()))
    a.append(_a)
    b.append(_b)
    c[i] = list(map(int, input().split()))
    
inf = int(10e+6)

dp = [inf]*(2**n)
dp[0] = 0

def rec(dp_i, cost):
    if dp[dp_i] > cost:
        dp[dp_i] = cost
        
    return

for _ci, _cv in c.items():
    now = 0
    for _v in _cv:
        now |= 1 << _v-1
    
    for bits in range(1 << n):
        rec(bits|now, dp[bits] + a[_ci])

        
print("="*20)
if dp[(1 << n) - 1] == inf:
    print(-1)
else:
    print(dp[(1 << n) - 1])

n, m = list(map(int, input().split()))
 
a = []
b = []
c = {}
for i in range(m):
    _a, _b = list(map(int, input().split()))
    a.append(_a)
    b.append(_b)
    c[i] = list(map(int, input().split()))
    
inf = int(10e+6)
 
dp = [inf]*(2**n)
dp[0] = 0
 
def rec(dp_i, cost):
    if dp[dp_i] > cost:
        dp[dp_i] = cost
        
    return
 
for _ci, _cv in c.items():
    now = 0
    for _v in _cv:
        now |= 1 << _v-1
    
    for bits in range(1 << n):
        rec(bits|now, dp[bits] + a[_ci])
 
        
if dp[(1 << n) - 1] == inf:
    print(-1)
else:
    print(dp[(1 << n) - 1])

Verdicts: Wrong Answer

Accepted
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
n, m = map(int, input().split())
p = 2 ** n
inf = 10 ** 9
dp = [inf] * p
dp[0] = 0
for i in range(m):
  a, b = map(int, input().split())
  c = sum([2 ** (j - 1) for j in list(input().split())])
  for k in range(p):
    if dp[k|c] > dp[k] + a:
      dp[k|c] = dp[k] + a
      
if dp[-1] == inf:
  print(-1)
else:
  print(dp[-1])

def main():
  n, m = map(int, input().split())

  p = 2 ** n
  inf = 10 ** 9
  dp = [inf] * p
  dp[0] = 0
  for i in range(m):
    a, b = map(int, input().split())
    c = sum([2 ** (int(j) - 1) for j in list(input().split())])
    for k in range(p):
      if dp[k|c] > dp[k] + a:
        dp[k|c] = dp[k] + a
  if dp[-1] == inf:
    print(-1)
  else:
    print(dp[-1])

  
if __name__ == "__main__":
    main()

Verdicts: Runtime Error

Accepted
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
import numpy as np


n, m = [int(x) for x in input().split()]

costs = []
masks = []

for _ in range(m):
  costs.append(int(input().split()[0]))

  boxes = {int(x)-1 for x in input().split()}
  mask = ['1' if idx in boxes else '0' for idx in range(n)][::-1]
  mask = int(''.join(mask), 2)
  masks.append(mask)

  INF = int(10e8 + 1)
  #dp = np.full(1 << n, INF, dtype=int)
  dp = [INF] * (1 << n)
  dp[0] = 0

  for j in range(m):
    for i in range(1 << n):
      dp[i | masks[j]] = min(
        dp[i | masks[j]],
        dp[i] + costs[j]
      )

      res = dp[-1] if dp[-1] != INF else -1
      print(res)

import numpy as np
print('haha')

    import numpy as np
     
     
    n, m = [int(x) for x in input().split()]
     
    costs = []
    masks = []
     
    for _ in range(m):
        costs.append(int(input().split()[0]))
     
        boxes = {int(x)-1 for x in input().split()}
        mask = ['1' if idx in boxes else '0' for idx in range(n)][::-1]
        mask = int(''.join(mask), 2)
        masks.append(mask)
     
    INF = int(10e8 + 1)
    #dp = np.full(1 << n, INF, dtype=int)
    dp = [INF] * (1 << n)
    dp[0] = 0
     
    for j in range(m):
        for i in range(1 << n):
            dp[i | masks[j]] = min(
                    dp[i | masks[j]],
                    dp[i] + costs[j]
                )
     
    res = dp[-1] if dp[-1] != INF else -1
    print(res)

n, m = [int(x) for x in input().split()]

INF = int(10e8 + 1)
dp = [INF] * (1 << n)
dp[0] = 0

for j in range(m):
    cost = int(input().split()[0])

    boxes = [int(x)-1 for x in input().split()]
    mask = 0

    mask = sum(1 << box for box in boxes)
    
    for i in range(1 << n):
        if dp[i] + cost < dp[i | mask]:
            dp[i | mask] = dp[i] + cost

res = dp[-1] if dp[-1] != INF else -1
print(res)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
n, m = map(int, input().split())
ac = []
for _ in range(m):
    a, _ = map(int, input().split())
    c = sum([2**(int(i)-1) for i in input().split()])
    ac.append([a, c])
dp = [float('inf')] * 2**n
dp[0] = 0
for s in range(2**n):
    for a, c in ac:
        t = s|c
        if dp[t] < dp[s] + a:
            dp[t] = dp[s] + a
ans = dp[-1]
if ans == float('inf'):
    ans = -1
print(ans)

def main():
    n, m = map(int, input().split())
    p = 2**n
    inf = 10**7
    dp = [inf]*p
    dp[0] = 0
    for _ in range(m):
        a, _ = map(int, input().split())
        c = sum([2**(int(i-1)) for i in input().split()])
        for s in range(p):
                t = s|c
                new = dp[s] + a
                if dp[t] > new:
                    dp[t] = new
    ans = dp[-1]
    if ans == inf:
        ans = -1
    print(ans)

if __name__ == '__main__':
    main()

def main():
    n, m = map(int, input().split())
    p = 2**n
    inf = 10**7
    dp = [inf]*p
    dp[0] = 0
    for _ in range(m):
        a, _ = map(int, input().split())
        c = sum([1<<(int(i-1)) for i in input().split()])
        for s in range(p):
                t = s|c
                new = dp[s] + a
                if dp[t] > new:
                    dp[t] = new
    ans = dp[-1]
    if ans == inf:
        ans = -1
    print(ans)

if __name__ == '__main__':
    main()

def main():
    n, m = map(int, input().split())
    p = 2**n
    inf = 10**7
    dp = [inf]*p
    dp[0] = 0
    for _ in range(m):
        a, _ = map(int, input().split())
        c = sum([1<<(int(i)-1) for i in input().split()])
        def k(s):
            if dp[s|c] > dp[s] + a
                dp[s|c] = dp[s] + a
        [k(s) for s in range(p)]
    ans = dp[-1]
    if ans == inf:
        ans = -1
    print(ans)

if __name__ == '__main__':
    main()

def main():
    n, m = map(int, input().split())
    costs = [None]*m
    keys = [None]*m
    pattern = 2**n
    inf = 10**12
    dp = [inf]*pattern
    for i in range(m):
        costs[i] = int(input().split()[0])
        keys[i] = sum([1<<(int(i)-1) for i in input().split()])
    dp[0] = 0
    for i in range(pattern):
        for cost, key in zip(costs, keys):
            pi = i|key
            if dp[pi] > cost + dp[i]:
                dp[pi] = cost + dp[i]
    if dp[pattern-1] == inf:
        print(-1)
    else:
        print(dp[pattern-1])
        

if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
#%%
N, M = map(int, input().split())
a = [0] * M
b = [0] * M
c = [[] for i in range(M)]
for i in range(M):
    a[i], b[i] = map(int, input().split())
    c[i] = list(map(int, input().split()))


import itertools
l = list(itertools.product(range(2), repeat=12))

key = [10**6] * (2**12) 

for i in range(M):
    tmp = [0] * 12
    for j in range(b[i]):
        tmp[c[i][j]-1] =1
    w = 0
    for j in range(12):
        w += 2 ** (11-j) * tmp[j]
    key[w] = min(key[w], a[i])

print(1)


#%%
N, M = map(int, input().split())

a = [0] * M
b = [0] * M
c = [[] for _ in range(M)]
for i in range(M):
    a[i], b[i] = map(int, input().split())
    c[i] = list(map(int, input().split()))

inf = float('inf') 
cost = [inf] * (2**N)
cost[0] = 0

movement = []
for i in range(M):
    move = 0
    for j in range(len(c[i])):
        move += 2 ** (c[i][j]-1)
    movement.append(move)

for i in range(2**N):
    for j in range(M):
        move2 = movement[j] 
        if cost[i|move2] < cost[i]+a[j]:
            cost[i|move2] = cost[i]+a[j]

if cost[2**N-1] == inf:
    print(-1)
else:
    print(cost[2**N-1])

#%%
N, M = map(int, input().split())

a = [0] * M
b = [0] * M
c = [[] for _ in range(M)]
for i in range(M):
    a[i], b[i] = map(int, input().split())
    c[i] = list(map(int, input().split()))

inf = float('inf') 
cost = [inf] * (2**N)
cost[0] = 0

movement = []
for i in range(M):
    move = 0
    for j in range(len(c[i])):
        move += 2 ** (c[i][j]-1)
    movement.append(move)

for i in range(2**N):
    for j in range(M):
        move2 = movement[j] 
        if cost[i|move2] < cost[i]+a[j]:
        cost[i|move2] = cost[i]+a[j]

if cost[2**N-1] == inf:
    print(-1)
else:
    print(cost[2**N-1])

#%%
N, M = map(int, input().split())

a = [0] * M
b = [0] * M
c = [[] for _ in range(M)]
for i in range(M):
    a[i], b[i] = map(int, input().split())
    c[i] = list(map(int, input().split()))

inf = float('inf') 
cost = [inf] * (2**N)
cost[0] = 0

movement = []
for i in range(M):
    move = 0
    for j in range(len(c[i])):
        move += 2 ** (c[i][j]-1)
    movement.append(move)

for i in range(2**N):
    for j in range(M):
        move2 = movement[j] 
        if cost[i|move2] > cost[i]+a[j]:
            cost[i|move2] = cost[i]+a[j]

if cost[2**N-1] == inf:
    print(-1)
else:
    print(cost[2**N-1])

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: We have N locked treasure boxes, numbered 1 to N.  A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.  Find the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.

Submission attempts (in order):
def main():
    n, m = map(int, input().split())
    inf = 10**9 
    bit_bp = [inf for _ in range(2**(n))] 
    bit_dp[0] = 0

    for i in range(m):
        a, b = map(int, input().split())
        c = list(map(int, input().split()))
        bit_n = 0
        for i in c:
            bit_n |= 1 << i - 1 
        for i in range(2**n):
            if bit_dp[i|bit_n] > bit_dp[i] + a: #
                bit_dp[i|bit_n] = bit_dp[i] + a

    if bit_dp[-1] >= inf:
        print(-1)
    else:
        print(bit_dp[-1])
                
if __name__ == "__main__":
    main()


def main():
    n, m = map(int, input().split())
    inf = 10**9 
    bit_dp = [inf for _ in range(2**(n))] 
    bit_dp[0] = 0
    for i in range(m):
        a, b = map(int, input().split())
        c = list(map(int, input().split()))
        bit_n = 0
        for i in c:
            bit_n |= 1 << i - 1 
        for i in range(2**n):
            if bit_dp[i|bit_n] > bit_dp[i] + a:
                bit_dp[i|bit_n] = bit_dp[i] + a
    if bit_dp[-1] >= inf:
        print(-1)
    else:
        print(bit_dp[-1])
                
if __name__ == "__main__":
    main()

Verdicts: Runtime Error

Accepted
Problem: Snuke has a permutation (P_0,P_1,\cdots,P_{N-1}) of (0,1,\cdots,N-1).  Now, he will perform the following operation **exactly once** :    * Choose K consecutive elements in P and sort them in ascending order.  Find the number of permutations that can be produced as P after the operation.

Submission attempts (in order):
from collections import Counter
from heapq import heappush, heappop
N,K,*P = map(int, open(0).read().split())
i = 0
ans = 1
Cnt = Counter(P[:K])
mls = []
Mls = []
for i in range(K):
  heappush(mls,P[i])
  heappush(Mls,-P[i])
for i in range(N-K):
  Cnt[P[i]] -= 1
  Cnt[P[i+K]] += 1
  if not (P[i]==mls[0] and P[i+K]>=-Mls[0]):
    ans += 1
  heappush(mls,P[i+K])
  heappush(Mls,-P[i+K])
  while Cnt[mls[0]]==0:
    heappop(mls)
  while Cnt[-Mls[0]]==0:
    heappop(Mls)
i = 0
for j in range(1,N):
  if P[j]<P[j-1]:
    if j-i>=K:
      ans -= 1
    i = j
if j-i>=K-1:
  ans -= 1
ans += 1
print(ans)

from collections import Counter
from heapq import heappush, heappop
N,K,*P = map(int, open(0).read().split())
i = 0
ans = 1
Cnt = Counter(P[:K])
mls = []
Mls = []
for i in range(K):
  heappush(mls,P[i])
  heappush(Mls,-P[i])
for i in range(N-K):
  Cnt[P[i]] -= 1
  Cnt[P[i+K]] += 1
  if not (P[i]==mls[0] and P[i+K]>=-Mls[0]):
    ans += 1
  heappush(mls,P[i+K])
  heappush(Mls,-P[i+K])
  while Cnt[mls[0]]==0:
    heappop(mls)
  while Cnt[-Mls[0]]==0:
    heappop(Mls)
i = 0
flag = False
for j in range(1,N):
  if P[j]<P[j-1]:
    if j-i>=K:
      ans -= 1
      flag = True
    i = j
if j-i>=K-1:
  flag = True
  ans -= 1
if flag:
  ans += 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Snuke has a permutation (P_0,P_1,\cdots,P_{N-1}) of (0,1,\cdots,N-1).  Now, he will perform the following operation **exactly once** :    * Choose K consecutive elements in P and sort them in ascending order.  Find the number of permutations that can be produced as P after the operation.

Submission attempts (in order):
n,k=map(int,input().split())
p=list(map(int,input().split()))
inf=10**8
cnt=1

p=[-inf]+p+[inf]
f=0
for i in range(1,n-k+2):
  if p[i:i+k]==sorted(p[i:i+k]):
    f=1
  else:
    if min(p[i:i+k])>p[i-1] and max(p[i:i+k])<p[i+k] and f==0:
      f=1
      cnt+=1
    else:
      f=0
      cnt+=1
print(cnt)

from collections import deque

n,k=map(int,input().split())
p=list(map(int,input().split()))+[1000000]

p1=[0]*(n)
pmin=[0]*(n+1)
pmax=[0]*(n+1)

cnt=0

for i in range(n-1):
  if p[i]<p[i+1]:
    cnt+=1
  else:
    cnt=0
  p1[i+1]=cnt

d=deque()
d.append(0)

for i in range(1,k+1):
  if p[d[-1]]<p[i]:
    d.append(i)
  else:
    try:
      while p[d[-1]]>p[i]:
        d.pop()
    except:
      pass
    d.append(i)
pmin[k]=p[d[0]]

for i in range(k+1,n):
  if d[0]==i-(k+1):
    d.popleft()
  if p[d[-1]]<p[i]:
    d.append(i)
  else:
    try:
      while p[d[-1]]>p[i]:
        d.pop()
    except:
      pass
    d.append(i)
  pmin[i]=p[d[0]]


dd=deque()
dd.append(0)

for i in range(1,k+1):
  if p[dd[-1]]>p[i]:
    dd.append(i)
  else:
    try:
      while p[dd[-1]]<p[i]:
        dd.pop()
    except:
      pass
    dd.append(i)
pmax[k]=p[dd[0]]

for i in range(k+1,n):
  if dd[0]==i-(k+1):
    dd.popleft()
  if p[dd[-1]]>p[i]:
    dd.append(i)
  else:
    try:
      while p[dd[-1]]<p[i]:
        dd.pop()
    except:
      pass
    dd.append(i)
  pmax[i]=p[dd[0]]

ans=n-k+1
f=1
ff=[0]*n
for i in range(n):
  if p1[i]>=k-1:
    ff[i]=1
    if f==0:
      ans-=1
    else:
      f=0

for i in range(n-k):
  if p[i]==pmin[i+k] and p[i+k]==pmax[i+k] and ff[i+k]==0:
    ans-=1

print(ans)




Verdicts: Wrong Answer

Accepted
Problem: Snuke has a permutation (P_0,P_1,\cdots,P_{N-1}) of (0,1,\cdots,N-1).  Now, he will perform the following operation **exactly once** :    * Choose K consecutive elements in P and sort them in ascending order.  Find the number of permutations that can be produced as P after the operation.

Submission attempts (in order):
N,K = map(int, input().split())
P = [int(p) for p in input().split()]

L = [0 for i in range(N-1)]
temp = P[0]
for i in range(1,N):
    if temp > P[i]:
        L[i-1] = 1
    temp = P[i]
        
L2 = []
for i in range(N-1-K+2):
    temp = []
    for j in range(i,K+i-1):
        temp += [L[j]]
    L2.append(temp)

zero = 0
cnt = 0
for i in range(len(L2)):
    j = 1
    c = 0
    if 1 not in L2[i]:
        zero += 1
    else:
        jud = 0
        for l in range(len(L2[i])):
            if L2[i][l] == 1:
                jud = 1
                break
        while j <= K-2 and i+j < len(L2) and jud == 0:
            temp = L2[i+j]
            temp.reverse()
            if L2[i] == temp:
                cnt += 1
            temp.reverse()
            j += 1
        
print(N-K+1-cnt-zero+1)

import heapq

N,K = map(int, input().split())
P = [int(p) for p in input().split()]

h = []
H = []
for i in range(K):
    heapq.heappush(h, (P[i], i))
    heapq.heappush(H, (-P[i], i))
    
ans = 1
for i in range(N-K):
    while h[0][1] < i:
        heapq.heappop(h)
    while H[0][1] < i:
        heapq.heappop(H)
    heapq.heappush(h, (P[i+K], i+K))
    heapq.heappush(H, (-P[i+K], i+K))
    if h[0][0] == P[i] and -H[0][0] == P[i+K]:
        continue
    ans += 1
    
f = 0
cnt = 1
for i in range(N-1):
    if P[i] < P[i+1]:
        cnt += 1
    else:
        if cnt >= K and f == 1:
            ans -= 1
        elif cnt >= K and f == 0:
            f = 1
        cnt = 1
        
if cnt >= K and f == 1:
    ans -= 1
    
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Snuke has a permutation (P_0,P_1,\cdots,P_{N-1}) of (0,1,\cdots,N-1).  Now, he will perform the following operation **exactly once** :    * Choose K consecutive elements in P and sort them in ascending order.  Find the number of permutations that can be produced as P after the operation.

Submission attempts (in order):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import heapq

N, K = map(int, input().split())
P = list(map(int, input().split()))

Z = [0 for i in range(N)]
tmp = P[0]
count = 1
order = [0 for i in range(N)]
for i in range(1, N):
    if tmp < P[i]:
        count += 1
        if count >= K:
            order[i] = 1
    else:
        count = 1
    tmp = P[i]

print(order)

hp = []
hm = []
heapq.heapify(hp)
heapq.heapify(hm)
used = [0 for i in range(N)]

for i in range(K):
    heapq.heappush(hp, P[i]) 
    heapq.heappush(hm, -P[i]) 

ans = 1
kaburi = [0 for i in range(N)]

for i in range(K, N):
    while used[hp[0]-1] == 1:
        heapq.heappop(hp)
    while used[-hm[0]-1] == 1:
        heapq.heappop(hm)

    if hp[0] == P[i-K] and -hm[0] < P[i]:
        kaburi[i] = 1
        pass
    else:
        ans += 1
    
    used[P[i-K]-1] = 1

    heapq.heappush(hp, P[i])
    heapq.heappush(hm, -P[i])

order_count = 0
for i in range(N):
    if kaburi[i] == 0 and order[i] == 1:
        order_count += 1

ans = N-K+1 - (sum(kaburi)+max(order_count-1, 0))
print(ans)

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import heapq

N, K = map(int, input().split())
P = list(map(int, input().split()))

Z = [0 for i in range(N)]
tmp = P[0]
count = 1
order = [0 for i in range(N)]
for i in range(1, N):
    if tmp < P[i]:
        count += 1
        if count >= K:
            order[i] = 1
    else:
        count = 1
    tmp = P[i]

hp = []
hm = []
heapq.heapify(hp)
heapq.heapify(hm)
used = [0 for i in range(N)]

for i in range(K):
    heapq.heappush(hp, P[i]) 
    heapq.heappush(hm, -P[i]) 

ans = 1
kaburi = [0 for i in range(N)]

for i in range(K, N):
    while used[hp[0]-1] == 1:
        heapq.heappop(hp)
    while used[-hm[0]-1] == 1:
        heapq.heappop(hm)

    if hp[0] == P[i-K] and -hm[0] < P[i]:
        kaburi[i] = 1
        pass
    else:
        ans += 1
    
    used[P[i-K]-1] = 1

    heapq.heappush(hp, P[i])
    heapq.heappush(hm, -P[i])

order_count = 0
for i in range(N):
    if kaburi[i] == 0 and order[i] == 1:
        order_count += 1

ans = N-K+1 - (sum(kaburi)+max(order_count-1, 0))
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Snuke has a permutation (P_0,P_1,\cdots,P_{N-1}) of (0,1,\cdots,N-1).  Now, he will perform the following operation **exactly once** :    * Choose K consecutive elements in P and sort them in ascending order.  Find the number of permutations that can be produced as P after the operation.

Submission attempts (in order):
n,k=map(int,input().split())
P=[int(i) for i in input().split()]
n_max=2*10**5
num=n_max.bit_length()+1
def init1(init_val):
  for i in range(n):
    seg1[i+num-1]=init_val[i]    
    for i in range(num-2,-1,-1) :
      seg1[i]=max(seg1[2*i+1],seg1[2*i+2]) 
def init2(init_val):
  for i in range(n):
    seg2[i+num-1]=init_val[i]    
    for i in range(num-2,-1,-1) :
      seg2[i]=min(seg2[2*i+1],seg2[2*i+2]) 
   
def query1(p,q):
  if q<=p:
    return ide_ele1
  p+=num-1
  q+=num-2
  res=ide_ele1
  while q-p>1:
    if p&1==0:
      res=max(res,seg1[p])
    if q&1==1:
      res=max(res,seg1[q])
      q-=1
    p=p//2
    q=(q-1)//2
  if p==q:
    res=max(res,seg1[p])
  else:
    res=max(max(res,seg1[p]),seg1[q])
  return res
def query2(p,q):
  if q<=p:
    return ide_ele2
  p+=num-1
  q+=num-2
  res=ide_ele2
  while q-p>1:
    if p&1==0:
      res=min(res,seg2[p])
    if q&1==1:
      res=min(res,seg2[q])
      q-=1
    p=p//2
    q=(q-1)//2
  if p==q:
    res=min(res,seg2[p])
  else:
    res=min(min(res,seg2[p]),seg2[q])
  return res
ide_ele1=0
ide_ele2=n_max
seg1=[ide_ele1]*2*num
seg2=[ide_ele2]*2*num
init1(P)
init2(P)
ans=1
for i in range(k,n):
  if P[i-k]==query2(i-k,k+1) and P[i]==query1(i-k,k+1):
    continue
  else:
    ans+=1

Q=[0]*n
for i in range(1,n):
  if P[i]>P[i-1]:
    Q[i]=Q[i-1]+1
  else:
    continue
count=0
for i in range(n):
  if Q[i]>=k-1:
    count+=1
print(ans-count+1)



n,k=map(int,input().split())
P=[int(i) for i in input().split()]
import collections
from collections import deque
M1,M2=deque(),deque()
A1,A2=[],[]
M1.append(0)
for i in range(1,n):
  while M1:
    if P[M1[-1]]>P[i]:
      M1.pop()
    else:
      M1.append(i)
      break
  if not M1:
    M1.append(i)
  if M1[0]==i-k-1:
    M1.popleft()
  if i<k:
    continue
  else:
    A1.append(P[M1[0]])
M2.append(0)
for i in range(1,n):
  while M2:
    if P[M2[-1]]<P[i]:
      M2.pop()
    else:
      M2.append(i)
      break
  if not M2:
    M2.append(i)
  if M2[0]==i-k-1:
    M2.popleft()
  if i<k:
    continue
  else:
    A2.append(P[M2[0]])
ans=1
for i in range(n-k):
  if A1[i]==P[i] and A2[i]==P[i+k]:
    continue
  else:
    ans+=1
Q=[0]*n
for i in range(1,n):
  if P[i]>P[i-1]:
    Q[i]=Q[i-1]+1
  else:
    continue
count=0
for i in range(n):
  if Q[i]==k-1:
    count+=1
print(ans-max(0,count-1))

Verdicts: Runtime Error

Accepted
Problem: We have an integer sequence of length N: A_0,A_1,\cdots,A_{N-1}.  Find the following sum (\mathrm{lcm}(a, b) denotes the least common multiple of a and b):    * \sum_{i=0}^{N-2} \sum_{j=i+1}^{N-1} \mathrm{lcm}(A_i,A_j)  Since the answer may be enormous, compute it modulo 998244353.

Submission attempts (in order):
import sys

readline = sys.stdin.readline

ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))

def modinv(x, mod):
    a, b = x, mod
    u, v = 1, 0
    while b:
        t = a // b
        a -= t * b; a, b = b, a
        u -= t * v; u, v = v, u
    return u % mod

def solve():
  n = ni()
  a = nl()
  m = max(a)
  mod = 998244353
  l = [0]*(m+1)
  for x in a:
    l[x] += x
  sieve = [1]*(m+1)
  sieve[0] = sieve[1] = 0
  for i in range(2, m+1):
    if sieve[i]:
      for j in range(m//i, 0, -1):
        sieve[j*i] = 0
        l[j] += l[j*i]
      sieve[i] = 1
  for i in range(m+1):
    l[i] = l[i] * l[i] % mod
  for i in range(2, m+1):
    if sieve[i]:
      for j in range(1, m//i + 1):
        l[j] -= l[j*i]
  s = -sum(a)
  
  print(s * modinv(2, mod) % mod)
  return

solve()

import sys

readline = sys.stdin.readline

ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int((n+1)**0.5)+1):
        if is_prime[i]:
            for j in range(i *2, n + 1, i):
                is_prime[j] = False
    res = [i for i in range(n+1) if is_prime[i]]
    return res

def make_modinv_list(n, mod=10**9+7):
    inv_list = [0]*(n+1)
    inv_list[1] = 1
    for i in range(2, n+1):
        inv_list[i] = (mod - mod//i * inv_list[mod%i] % mod)
    return inv_list

def solve():
  mod = 998244353
  n = ni()
  a = nl()
  m = max(a)
  s = -sum(a) % mod
  l = [0]*(m+1)
  for x in a:
    l[x] += x
  a = make_modinv_list(m, mod)
  pr = primes(m) 
  for i in pr:
    for j in range(m//i, 0, -1):
      l[j] += l[j*i]
  for i in range(m+1):
    l[i] = l[i] * l[i] % mod
  for i in pr:
    for j in range(1, m//i + 1):
      l[j] = (l[j] - l[j*i]) % mod
  for i in range(1, m+1):
    if l[i]:
      s = (s + l[i] * a[i]) % mod
  print(s * a[2] % mod)
  return

solve()


Verdicts: Wrong Answer

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
S = input()
if S == "Sunny":
  print("Cloudy")
else if S == "Cloudy":
  print("Rainy")
else:
  print("Sunny")

S = input()
if S == "Sunny":
  print("Cloudy")
else if S == "Cloudy":
  print("Rainy")
else if S == "Rainy":
  print("Sunny")

S = input()
if S == 'Sunny':
  print('Cloudy')
else if S == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')

S = input()
if S == 'Sunny':
  print('Cloudy')
elif S == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
todayWeather = input()

def main(S):
  if S == 'Cloudy':
    tmrWeather = 'Rainy'
  elif S == 'Rainy':
    tmrWeather = 'Sunny'
  else:
    tmrWeather = 'Cloudy'
  return tmrWeather

main(todayWeather)

def main(S):
  if S == 'Cloudy':
    tmrWeather = 'Rainy'
  elif S == 'Rainy':
    tmrWeather = 'Sunny'
  else:
    tmrWeather = 'Cloudy'
  return tmrWeather

if __name__ == '__main__':
  todayWeather = input()
  main(todayWeather)

def main():
  S = str(input())
  if S == 'Cloudy':
    tmrWeather = 'Rainy'
  elif S == 'Rainy':
    tmrWeather = 'Sunny'
  else:
    tmrWeather = 'Cloudy'
  return tmrWeather
 
main()

def main():
  S = str(input())
  if S == 'Cloudy':
    tmrWeather = 'Rainy'
  elif S == 'Rainy':
    tmrWeather = 'Sunny'
  else:
    tmrWeather = 'Cloudy'
  print(tmrWeather)
 
main()

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
l = stdin.readline().rstrip().split()
print(l)


n,m = map(int,input().split())
a = list(map(lambda x: -int(x) ,input().split()))
print(a)
import heapq
heapq.heapify(a)
for _ in range(m):
  tmp = -heapq.heappop(a)
  tmp //= 2
  heapq.heappush(a,-tmp)
print(-sum(a))

from sys import stdin

a = stdin.readline().rstrip()

print(a)

ans = input()
print(ans)


from sys import stdin

a = stdin.readline().rstrip()
if a == "Sunny":
  print("Cloudy")
elif a== "Cloudy":
   print("Rainy")
else:
   print("Sunny")


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
(N,M) = list(map(int,input().split()))
Aorg = list(map(int,input().split()))

A = Aorg

A.sort(reverse=True)

for m in range(M):
  #print(int(A[0]/2))
  A[0] = int(A[0]/2)
  if A[0]<A[1]:
    A.sort(reverse=True)

print(sum(A))

S = input()

if S=='Sunny':
  print('Cloudy')
else:
  if S=='Cloudy':
    print('Rainy')
  else:
    print('Sunny')

Verdicts: Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
s = input()
if s == "Sunny" :
  print("Cloudy")
elif s = "Cloudy":
  print("Rainy")
else :
  print("Sunny")
    
  

s = input()
if s == "Sunny" :
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
else :
  print("Sunny")
    
  

Verdicts: Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
import os
import sys

weather_list = ['Sunny', 'Cloudy', 'Rainy']

today_weather = sys.argv[1]

weather_index = weather_list.index(today_weather)

weather_index = weather_index+1 if len(weather_list)-1!=weather_index else 0

print(weather_list[weather_index])

import os
import sys

weather_list = ['Sunny', 'Cloudy', 'Rainy']

#today_weather = sys.argv[1]
today_weather = input()

weather_index = weather_list.index(today_weather)

weather_index = weather_index+1 if len(weather_list)-1!=weather_index else 0

print(weather_list[weather_index])

Verdicts: Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
X = input()
A = ["Sunny","Cloudy","Rainy"]
N = (index(x) + 1) % 3
print(A.[N])

x = input()
A = ["Sunny","Cloudy","Rainy"]
N = (A.index(x) + 1) % 3
print(A[N])


Verdicts: Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):

n=int(input())
print(n**3)


s=input()
if s=="Sunny":
    print("Cloudy")
elif s=="Cloudy":
    print("Rainy")
else:
    print("Sunny")

Verdicts: Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
s = input()

if s = 'Sunny':
    print('Cloudy')
elif s = 'Cloudy':
    print('Rainy')
else s = 'Rainy':
    print('Sunny')

s = input()

if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
elif s == 'Rainy':
    print('Sunny')

Verdicts: Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
s=["Sunny","Cloudy","Rainy"]
weather= input("give me the weather of today")
a=s.index(weather)
if a in (0,1):
    tomorrow=s[a+1]
else:
    tomorrow="Sunny"
print(tomorrow)


s=["Sunny","Cloudy","Rainy"]
weather= input()
a=s.index(weather)
if a in (0,1):
    tomorrow=s[a+1]
else:
    tomorrow="Sunny"
print(tomorrow)


Verdicts: Wrong Answer

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
n = int(input())
s = input()

ans = 0
for i in range(n):
  for j in range(i, n):
    if s[i:j+1] in s[j+1:]:
      ans = max(ans, j-i+1)
    else:
      break
print(ans)


s = input()
if s == 'Sunny':
  print('Cloudy')
elif s == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')

Verdicts: Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
s=input()
if s[0]=='S':
    print('Cloudy')
else if s[0]=='C':
    print('Rainy')
else:
    print('Suuny')

    

s=input()
if s[0]=='S':
    print('Cloudy')
elif s[0]=='C':
    print('Rainy')
else:
    print('Sunny')


Verdicts: Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
S==input()
if S=='Sunny':
  print('Cloudy')
elif S=='Cloudy':
  print('Rainy')
elif S=='Rainy':
  print('Sunny')

S==input()
if S=='Sunny':
  print'Cloudy'
elif S=='Cloudy':
  print'Rainy'
elif S=='Rainy':
  print'Sunny'

S==input()
if S=='Sunny':
  print("Cloudy")
elif S=='Cloudy':
  print("Rainy")
elif S=='Rainy':
  print("Sunny")

S=input()
if S=='Sunny':
  print('Cloudy')
elif S=='Cloudy':
  print('Rainy')
elif S=='Rainy':
  print('Sunny')

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
# coding: utf-8

wether = input("Today's weather:")
if weather == "Sunny":
    print("Cloudy")
elif wether == "Cloudy":
    print("Rainy")
elif wether == "Rainy":
    print("Sunny")


# coding: utf-8

weather = input("Today's weather:")
if weather == "Sunny":
    print("Cloudy")
elif wether == "Cloudy":
    print("Rainy")
elif wether == "Rainy":
    print("Sunny")


# coding: utf-8

weather = input()
if weather == "Sunny":
    print("Cloudy")
elif weather == "Cloudy":
    print("Rainy")
elif weather == "Rainy":
    print("Sunny")


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
from sys import stdin


def main():
    S = input()

    if S == "Sunny":
        print("Cloud")
    elif S == "Cloud":
        print("Rainy")
    else:
        print("Sunny")


if __name__ == "__main__":
    main()


from sys import stdin


def main():
    S = input()

    if S == "Sunny":
        print("Cloudy")
    elif S == "Cloudy":
        print("Rainy")
    else:
        print("Sunny")


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
N,K,Q = map(int, input().split()) 
A = [int(input()) - 1 for i in range(Q)] 
# print(A)
P = [0] * N 
for j in range(Q):
    P[A[j]] +=1
for k in range(N):
    if P[k] > Q - K:
        print("Yes")
    else:
        print("No")

s = input()
if s == 'Sunny':
    print('Cloudy')
if s == 'Cloudy':
    print('Rainy')
if s == 'Rainy':
    print('Sunny')

Verdicts: Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
if S=='Sunny':
	print('Cloudy')
elif S=='Cloudy':
	print('Rainy')
else:
	print('Sunny')

if S=='Sunny':
  print('Cloudy')
elif S=='Cloudy':
  print('Rainy')
else:
  print('Sunny')


if S=='Sunny':
	print('Cloudy')
elif S=='Cloudy':
	print('Rainy')
else:
	print('Sunny') 

S=input()
if S=='Sunny':
	print('Cloudy')
elif S=='Cloudy':
	print('Rainy')
else:
	print('Sunny')


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
S=input()
if S=="Sunny":
  print("Cloudly")
elif S=="Rainy":
  print("Sunny")
else:
  print("Rainy")

S=input()
if S=="Sunny":
  print("Cloudy")
elif S=="Rainy":
  print("Sunny")
else:
  print("Rainy")

Verdicts: Wrong Answer

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
today_weather = input()
list = ['Sunny', 'Cloudy', 'Rainy']
print(list[1])
for i in range(0, 3):
	if(today_weather==list[i]):
		next_weather = list[(i+1)%3]
print(next_weather)

today_weather = input()
list = ['Sunny', 'Cloudy', 'Rainly']
print(list[1])
for i in range(0, 3):
	if(today_weather==list[i]):
		next_weather = list[(i+1)%3]
print(next_weather)

today_weather = input()
list = ['Sunny', 'Cloudy', 'Rainy']
for i in range(0, 3):
	if(today_weather==list[i]):
		next_weather = list[(i+1)%3]
print(next_weather)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
"""
abc141-b
"""

import sys

S = input()

if (len(S) == 1):
    print("No")
    sys.exit()
else:
    for i in range(int(len(S))-1):
        if (i % 2 == 0):
            if (S[i] == "L"):
                print("No")
                sys.exit()
        else:
            if (S[i] == "R"):
                print("No")
                sys.exit()

print("Yes")

"""
abc141
"""

w = input()

if (w == "Sunny"):
    print("Cloudy")
elif (w == "Cloudy"):
    print("Rainy")
else:
    print("Sunny")

Verdicts: Wrong Answer

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
s=input()

a="Sunny"
b="Rainy"
c="Cloudy"

if s=a:
  print(c)
elif s=b:
  print(a)
else:
  print(b)

s=input()

a="Sunny"
b="Rainy"
c="Cloudy"

if s==a:
  print(c)
elif s==b:
  print(a)
else:
  print(b)

Verdicts: Runtime Error

Accepted
Problem: The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...  Given is a string S representing the weather in the town today. Predict the weather tomorrow.

Submission attempts (in order):
originWeather = input("Enter weather: ")
weatherList = ['Sunny', 'Cloudy', 'Rainy']

if originWeather == 'Sunny':
    print(weatherList[1])

if originWeather == 'Cloudy':
    print(weatherList[2])

if originWeather == 'Rainy':
    print(weatherList[0])

originWeather = input()
weatherList = ['Sunny', 'Cloudy', 'Rainy']

if originWeather == 'Sunny':
    print(weatherList[1])

if originWeather == 'Cloudy':
    print(weatherList[2])

if originWeather == 'Rainy':
    print(weatherList[0])

Verdicts: Wrong Answer

Accepted