Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03230 (python)

Fixed submission:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

"""
k組ある，
ある組から見て，残りの(k-1)組と被りが1つずつあるから要素数はk-1

"""

def main():
    mod=10**9+7
    N=I()

    k=0
    for i in range(N+5):
        ii=i*(i-1)
        if ii==2*N:
            k=i
            break
    if k==0:
        print("No")
        exit()
    
    ans=[[]for _ in range(k)]
    now=1#配る数字
    import itertools
    
    for ite in itertools.combinations(range(k),2):
        i=ite[0]
        j=ite[1]
        ans[i].append(now)
        ans[j].append(now)
        now+=1
        
    print("Yes")
    print(k)
    for i in range(k):
        print(len(ans[i]),' '.join(map(str, ans[i])))
        
        
            
            
            
 
        

main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

"""
1,2,3
    3,4,5,6
          6,7,8,9
                ...
のように，かぶらないものが2個ずつになるように伸ばす．
のちに1,4,7,...,Nと2,5,8,...,Nを作ればだいたいいける．
1,2,3と6,7,8,9でかぶるものがないので大きいところのあまりから適当に持ってきて両方に追加する

"""

def main():
    mod=10**9+7
    N=I()

    if N==1:
        print("Yes")
        print(2)
        print(1,1)
        print(1,1)
        exit()
    elif N==3:
        print("Yse")
        print(3)
        print(2,1,2)
        print(2,3,1)
        print(2,2,3)
        exit()
        
    now=0
    temp=0
    for i in range(N):
        now+=i
        if now==N:
            cnt=i
            break
        elif now>N:
            print("No")
            exit()
            
    k=cnt+1
    cnt-=1
    S=[[]for _ in range(k)]
    S[0]=[1,2,3]
    now=3
    for i in range(1,cnt-1):
        for j in range(4):
            S[i].append(now+j)
        now+=3
    
    for j in range(3):
        S[cnt-1].append(now+j)
    now+=3
        
    for i in range(cnt):
        for j in range(i+2,cnt):
            S[i].append(now)
            S[j].append(now)
            now+=1
            
    for j in range(2):
        for i in range(cnt):
            S[-1-j].append(j+1+i*3)
            
    S[-1].append(N)
    S[-2].append(N)
    
    print(k)
    for i in range(k):
        print(len(S[i]),(' '.join(map(str, S[i]))))
        
    
        
        
        
        
        

main()
Problem p03238 (python)

Fixed submission:
N=int(input())

if N==1:
    print("Hello World")
else:
    A=int(input())
    B=int(input())
    print(A+B)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=int(input())
B=int(input())

if N==1:
    print("Hello World")
else:
    print(A+B)
Problem p03240 (python)

Fixed submission:
N=int(input())
x=[0]*N
y=[0]*N
h=[0]*N

ti=0

for i in range(N):
    x[i],y[i],h[i]=map(int,input().split())
    if h[i]!=0:
        ti=i



flag=0
for tx in range(101):
    if flag==1:
        break
    for ty in range(101):
        th=h[ti]+abs(tx-x[ti])+abs(ty-y[ti])
        flag=1
        for i in range(N):
            nh=h[i]+abs(tx-x[i])+abs(ty-y[i])
            if (h[i]!=0 and nh!=th) or (h[i]==0 and nh<th ):
                flag=0
                break
        if flag==1:
            ans=[tx,ty,th]
            break

print(' '.join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
N=int(input())
x=[0]*N
y=[0]*N
h=[0]*N

for i in range(N):
    x[i],y[i],h[i]=map(int,input().split())

for tx in range(101):
    for ty in range(101):
        th=h[0]+abs(tx-x[0])+abs(ty-y[0])
        flag=1
        for i in range(N):
            nh=h[i]+abs(tx-x[i])+abs(ty-y[i])
            if nh!=th:
                flag=0
                break
        if flag==1:
            ans=[tx,ty,th]
            break

print(' '.join(map(str, ans)))
Problem p03287 (python)

Fixed submission:
from collections import defaultdict

N,M=map(int,input().split())
A=list(map(int,input().split()))

dd = defaultdict(int)#あまりをカウント
S=[0]*(N+1)

for i in range(N):
    S[i+1]=S[i]+A[i]
    S[i+1]%=M
    
ans=0
for i in range(N+1):
    ans+=dd[S[i]]
    dd[S[i]]+=1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=list(map(int,input().split()))

count=[0]*M#あまりが0~M-1
S=[0]*(N+1)

for i in range(N):
    S[i+1]=S[i]+A[i]
    S[i+1]%=M
    
ans=0
for i in range(N+1):
    ans+=count[S[i]]
    count[S[i]]+=1
    
print(ans)
Problem p03330 (python)

Fixed submission:
import itertools

N,C=map(int,input().split())
D=[[] for _ in range(C)]
c=[[] for _ in range(N)]

for i in range(C):
    D[i]=list(map(int,input().split()))
    
for i in range(N):
    c[i]=list(map(int,input().split()))
    
hist=[[0]*C for i in range(3)]#hist[i][j]は余りiのマスにj色のマスがいくつあるか
    
    
for i in range(N):
    for j in range(N):
        rem=(i+j+2)%3
        hist[rem][c[i][j]-1]+=1
    
ans=10**10
for cset in itertools.permutations(range(C), 3):
    temp=0
    for i in range(3):
        for j in range(C):
            temp+=hist[i][j]*D[j][cset[i]]
    ans=min(ans,temp)
    
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

N,C=map(int,input().split())
D=[[] for _ in range(C)]
c=[[] for _ in range(N)]

for i in range(C):
    D[i]=list(map(int,input().split()))
    
for i in range(N):
    c[i]=list(map(int,input().split()))
    
hist=[[0]*3 for i in range(C)]#hist[i][j]は余りiのマスにj色のマスがいくつあるか
    
    
for i in range(N):
    for j in range(N):
        rem=(i+j+2)%3
        hist[rem][c[i][j]-1]+=1
    
ans=10**10
for cset in itertools.permutations(range(C), 3):
    temp=0
    for i in range(3):
        for j in range(C):
            temp+=hist[i][j]*D[j][cset[i]]
    ans=min(ans,temp)
    
print(ans)
Problem p03612 (python)

Fixed submission:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    p=LI()
    ans=0
    for i in range(N):
        if p[i]==i+1:
            if i!=N-1:
                p[i],p[i+1]=p[i+1],p[i]
                ans+=1
            else:
                p[i],p[i-1]=p[i-1],p[i]
                ans+=1
            
    print(ans)

main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    p=LI()
    ans=0
    for i in range(N):
        if p[i]==i+1:
            p[i],p[i+1]=p[i+1],p[i]
            ans+=1
            
    print(ans)

main()
Problem p03633 (python)

Fixed submission:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
from fractions import gcd

def main():
    mod=10**9+7
    N=I()
    ans=1
    for i in range(N):
        t=I()
        ans=(ans*t)//gcd(ans,t)
        
    print(ans)

main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    from math import gcd
    N=I()
    ans=1
    for i in range(N):
        T=I()
        ans=(ans*T)//(gcd(ans,T))
        
        
    print(ans)

main()
Problem p03660 (python)

Fixed submission:
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
import queue

def main():
    mod=10**9+7
    N=I()
    adj=[[] for _ in range(N)]
    for i in range(N-1):
        a,b=MI()
        a-=1
        b-=1
        adj[a].append(b)
        adj[b].append(a)
    bit=[-1]*N#未確認,F,S    
    bit[0]=0
    bit[-1]=1
    pL=[0]*N
    dS=0
    
    q=queue.Queue()
    q.put((0,0,0))#v.pare,depth
    
    #深さを調べる
    while not q.empty():
        v,p,d=q.get()
        pL[v]=p
        if v==N-1:
            dS=d
            break
        for i in range(len(adj[v])):
            nv=adj[v][i]
            if nv!=p:
                q.put((nv,v,d+1))
    
    #主要なところを塗る            
    v=N-1            
    for _ in range((dS-1)//2):
        v=pL[v]
        bit[v]=1
        
    q2=queue.Queue()
    q2.put((0,0))#v.pare
    while not q2.empty():
        v,p=q2.get()
        if bit[v]==-1:
            bit[v]=bit[p]

        for i in range(len(adj[v])):
            nv=adj[v][i]
            if nv!=p:
                q2.put((nv,v))
        
        
                    
    s=sum(bit)#sunukeが塗れる
    if s>=N-s:
        print("Snuke")
    else:
        print("Fennec")
     
        
    
    

main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
import queue

def main():
    mod=10**9+7
    N=I()
    adj=[[] for _ in range(N)]
    for i in range(N-1):
        a,b=MI()
        a-=1
        b-=1
        adj[a].append(b)
        adj[b].append(a)
    bit=[-1]*N#未確認,F,S    
    bit[0]=0
    bit[-1]=1
    pL=[0]*N
    dS=0
    
    q=queue.Queue()
    q.put([0,0,0])#v.pare,depth
    
    #深さを調べる
    while not q.empty():
        v,p,d=q.get()
        pL[v]=p
        if v==N-1:
            dS=d
            break
        for i in range(len(adj[v])):
            nv=adj[v][i]
            if nv!=p:
                q.put((nv,v,d+1))
    
    #主要なところを塗る            
    v=N-1            
    for _ in range((dS-1)//2):
        v=pL[v]
        bit[v]=1
        
        
    q.put([0,0])#v.pare
    while not q.empty():
        v,p=q.get()
        if bit[v]==-1:
            bit[v]=bit[p]

        for i in range(len(adj[v])):
            nv=adj[v][i]
            if nv!=p:
                q.put((nv,v))
        
        
                    
    s=sum(bit)#sunukeが塗れる
    if s>=N-s:
        print("Snuke")
    else:
        print("Fennec")
     
        
    
    

main()
Problem p03732 (python)

Fixed submission:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

import bisect

def main():
    mod=10**9+7
    N,W=MI()
    w=[0]*N
    w2=[0,0,0,0]#結局4通りしかない
    v2=[[] for _ in range(4)]
    v=[0]*N
    for i in range(N):
        w[i],v[i]=MI()
    w1=w[0]
    for i in range(N):
        w[i]-=w1
        w2[w[i]]+=1
        v2[w[i]].append(v[i])
        
    for i in range(4):
        v2[i].sort(reverse=True)
        
    s=[[0] for _ in range(4)]
    for i in range(4):
        for j in range(len(v2[i])):
            s[i].append(s[i][-1]+v2[i][j])
     
    ans=0       
    for a in range(len(s[0])):
        for b in range(len(s[1])):
            for c in range(len(s[2])):
                for d in range(len(s[3])):
                    ww=b+2*c+3*d+w1*(a+b+c+d)
                    if ww<=W:
                        temp=s[0][a]+s[1][b]+s[2][c]+s[3][d]
                        ans=max(ans,temp)
                        
    print(ans)
                        
        
    

main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

import bisect

def main():
    mod=10**9+7
    N,W=MI()
    w=[0]*N
    v=[0]*N
    for i in range(N):
        w[i],v[i]=MI()
    w1=w[0]
    for i in range(N):
        w[i]-=w1
        
    a=set([])
    for i in range(N+1):
        for j in range(3*i+1):
            ww=w1*i+j
            if ww>W:
                break
            a.add(ww)
    a=list(a)
    M=len(a)
    
    
    #dp[i][j]はiまでの商品で,重さa[j]のときの価値の最大
    dp=[[-1]*(M) for _ in range(N+1)]
    dp[0][0]=0
    ans=0
    
    for i in range(N):
        for j in range(M):
            if dp[i][j]!=-1:
                dp[i+1][j]=max(dp[i+1][j],dp[i][j])
                ww=a[j]+w1+w[i]
                if ww<=W:
                    jj=bisect.bisect_left(a,ww)
                    dp[i+1][jj]=max(dp[i+1][jj],dp[i][j]+v[i])

    print(max(dp[-1]))
    
     
    
            

main()
Problem p03780 (python)

Fixed submission:
def main():
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    
    N,K=MI()
    a=LI()#下位の連続するn枚が不要なはず
    a.sort()
    for i in range(N):#K以上ならば必要
        if a[i]>=K:
            a=a[:i]
            break
    N=len(a)
                    
                    
    #x番目の数が必要かどうかの判定 
    #必要なものだけで構成された集合をもとに考えれば良いわけではない，不必要な分も考えなければならない             
    def ch(x):
        
        #使い回す，i番目まででjが作れるか
        dp=[0]*K
        dp[0]=1
        for i in range(N):
            if i==x:
                continue
            else:
                for j in range(K-1,a[i]-1,-1):
                    dp[j]|=dp[j-a[i]]
                
                        
        #K未満K-a[x]以上が作れれば良い    
        for j in range(K-a[x],K):
            if  dp[j]:
                return True
        return False
            
    
                        
    ng=-1
    ok=N
    while abs(ok-ng)>1:
        med=(ok+ng)//2
        
        if ch(med):
            ok=med
        else:
            ng=med
            
    print(ng+1)
    
    
 
    

main()

Buggy submission (verdict: Runtime Error):
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    N,K=MI()
    a=LI()#下位の連続するn枚が不要なはず
    a.sort()
    for i in range(N):#K以上ならば必要
        if a[i]>=K:
            a=a[:i]
    N=len(a)
                    
                    
    #x番目の数が必要かどうかの判定 
    #必要なものだけで構成された集合をもとに考えれば良いわけではない，不必要な分も考えなければならない             
    def ch(x):
        
        #使い回す，i番目まででjが作れるか
        dp=[False]*K
        dp[0]=True
        for i in range(N):
            if i==x:
                continue
            else:
                for j in range(K-1,a[i]-1,-1):
                    dp[j]|=dp[j-a[i]]
                
                        
        #K未満K-a[x]以上が作れれば良い    
        for j in range(K-a[x],K):
            if  dp[j]:
                return True
        return False
            
    
                        
    ng=-1
    ok=N
    while abs(ok-ng)>1:
        med=(ok+ng)//2
        
        if ch(med):
            ok=med
        else:
            ng=med
            
    print(ng+1)
    
    
   
    
            
    
    
    

main()
Problem p03910 (python)

Fixed submission:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    if N==1:
        print(1)
        exit()
    temp=0
    ans=[]
    for i in range(1,N+5):
        temp+=i
        ans.append(i)
        if temp>N:
            ans.remove(temp-N)
            break
        elif temp==N:
            break
    for i in range(len(ans)):
        print(ans[i])
        

main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    if N==1:
        print(1)
        exit()
    temp=0
    ans=[]
    for i in range(1,N):
        temp+=i
        ans.append(i)
        if temp>=N:
            ans.remove(temp-N)
            break
    for i in range(len(ans)):
        print(ans[i])
        

main()
Problem p04013 (python)

Fixed submission:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,A=MI()
    x=LI()
    M=max(x)
    
    #dp[i][j][k]はi番目まで，j枚で，和がkにできるか
    dp=[[[0]*(N*M+1) for j in range(N+1)] for _ in range(N+1)]
    dp[0][0][0]=1
    
    for i in range(N):
        for j in range(i+1):
            for k in range(N*M+1-x[i]):
                if dp[i][j][k]:
                    dp[i+1][j][k]+=dp[i][j][k]
                    dp[i+1][j+1][k+x[i]]+=dp[i][j][k]
                    

        
    ans=0
    for j in range(1,N+1):
        if j*A<=N*M:     
            ans+=dp[-1][j][j*A]
        
    print(ans)
 

                
    
        
            
            
    
            
        
        
            

main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,A=MI()
    x=LI()
    M=max(x)
    
    #dp[i][j][k]はi番目まで，j枚で，和がkにできるか
    dp=[[[0]*(N*M+1) for j in range(N+1)] for _ in range(N+1)]
    dp[0][0][0]=1
    
    for i in range(N):
        for j in range(i+1):
            for k in range(N*M+1-x[i]):
                if dp[i][j][k]:
                    dp[i+1][j][k]+=dp[i][j][k]
                    dp[i+1][j+1][k+x[i]]+=dp[i][j][k]
                    

        
    ans=0
    for j in range(1,N+1):        
        ans+=dp[-1][j][j*A]
        
    print(ans)
 

            

main()
Problem p02536 (python)

Fixed submission:
def f(x):
  while p[x]>0: x = p[x]
  return x
N,M = map(int,input().split())
p = [-1]*N
for _ in range(M):
  A,B = map(lambda x:f(int(x)-1),input().split())
  if A==B: continue
  elif A<B: A,B=B,A
  p[A] += p[B]
  p[B] = A
print(sum(i<0 for i in p)-1)

Buggy submission (verdict: Runtime Error):
f = lambda x: x if p[x]<0 else f(p[x])
N,M = map(int,input().split())
p = [-1]*N
for _ in range(M):
  A,B = map(lambda x:f(int(x)),input().split())
  if A==B: continue
  elif A<B: A,B=B,A
  p[A] += p[B]
  p[B] = A
print(sum(i<0 for i in p)-1)

Buggy submission (verdict: Runtime Error):
from collections import deque
N,M = map(int,input().split())
E = {i: [] for i in range(N)}
for m in range(M):
  A,B = map(int,input().split())
  E[A].append(B)
  E[B].append(A)
  
q = deque([0])
checked = [False]*N
ans = 0
while q and not(all(checked)):
  n = q.popleft()
  if checked[n]: continue
  checked[n] = True
  for i in E[n]:
    if not checked[i]: q.append(i)
  if all(checked): break
  elif not q:
    ans += 1
    for i in range(N):
      if not checked[i]:
        q.append(i)
        break
  
print(ans)
Problem p02573 (python)

Fixed submission:
class UFTree():
  def __init__(self,n):
    self.N = n
    self.parents = [-1]*n
    
  def root(self,n):
    if self.parents[n]<0: return n
    else:
      self.parents[n] = self.root(self.parents[n])
      return self.parents[n]
      
  def unite(self,x,y):
    rx,ry = self.root(x), self.root(y)
    if rx==ry: return
    if rx>ry: rx,ry = ry,rx
    self.parents[rx] += self.parents[ry]
    self.parents[ry] = rx
      
  def size(self,x):
    return -self.parents[self.root(x)]
  
N,M = map(int,input().split())
uft = UFTree(N)
for i in range(M):
  A,B = map(int,input().split())
  uft.unite(A-1,B-1)
print(max([uft.size(i) for i in range(N)]))

Buggy submission (verdict: Runtime Error):
class UFTree():
  def __init__(self,n):
    self.N = n
    self.parent = {i:i for i in range(1,n+1)}
    
  def root(self,n):
    if self.parent[n]==n: return n
    else:
      self.parent[n] = self.root(self.parent[n])
      return self.parent[n]
      
  def unite(self,x,y):
    rx,ry = self.root(x), self.root(y)
    if rx>ry: rx,ry = ry,rx
    if rx!=ry: self.parent[rx] = ry
      
  def size(self,x):
    n = 0
    return sum([self.root(i+1)==x for i in range(self.N)])
  
N,M = map(int,input().split())
uft = UFTree(N)
for i in range(M):
  A,B = map(int,input().split())
  uft.unite(A,B)
print(max({i+1:uft.size(i+1) for i in range(N)}.values()))

Buggy submission (verdict: Runtime Error):
class UFTree():
  def __init__(self,n):
    self.parent = {i:i for i in range(1,n+1)}
    
  def root(self,n):
    if self.parent[n]==n: return n
    else: return self.root(self.parent[n])
      
  def unite(self,x,y):
    rx,ry = self.root(x), self.root(y)
    if rx!=ry: self.parent[rx] = ry
  
  def same(self,x,y):
    return self.root(x)==self.root(y)
  
N,M = map(int,input().split())
uft = UFTree(N)
for i in range(M):
  A,B = map(int,input().split())
  uft.unite(A,B)
  
ans = {i+1:0 for i in range(N)}
for i in range(N):
  ans[uft.root(i+1)]+=1
print(max(ans.values()))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
Gs = []
for _ in range(M):
  AB = set(map(int,input().split()))
  for i,g in enumerate(Gs):
    if len(g&AB):
      Gs[i] = g|AB
      break
  else:
    Gs.append(AB)
print(max(map(len,Gs)))
Problem p02756 (python)

Fixed submission:
import sys
from collections import deque
def main():
  S = input()
  Q = int(input())
  r = False
  ans = deque(S)
  for l in sys.stdin:
    TFC = l.split()
    if TFC[0]=="1": r = not r
    elif TFC[1]=="1":
      if r: ans.append(TFC[2])
      else: ans.appendleft(TFC[2])
    elif TFC[1]=="2":
      if r: ans.appendleft(TFC[2])
      else: ans.append(TFC[2])
  print("".join(reversed(ans) if r else ans))

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
def main():
  S = input()
  Q = int(input())
  r = False
  ans = deque(S)
  for l in sys.stdin:
    TFC = l.split()
    if TFC[0]=="1": r = not r
    elif TFC[1]=="1":
      if r: ans.append(TFC[2])
      else: ans.appendleft(TFC[2])
    elif TFC[1]=="2":
      if r: ans.appendleft(TFC[2])
      else: ans.append(TFC[2])
  print("".join(reversed(ans) if r else ))

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
def main():
  S = input()
  Q = int(input())
  r = False
  ans = deque(S)
  for l in sys.stdin:
    TFC = l.split()
    if TFC[0]=="1": r = not r
    elif TFC[1]=="1":
      if r: ans.append(TFC[2])
      else: ans.appendleft(TFC[2])
    elif TFC[1]=="2":
      if r: ans.appendleft(TFC[2])
      else: ans.append(TFC[2])
  print("".join(reversed(ans) if r else ))

if __name__ == "__main__":
  main()
Problem p02772 (python)

Fixed submission:
from functools import reduce
from operator import and_
N = int(input())
As = [(i%3==0) or (i%5==0) for i in map(int,input().split()) if i%2==0]
ans = reduce(and_, As, True) if len(As)>0 else True
print("APPROVED" if ans else "DENIED")

Buggy submission (verdict: Runtime Error):
from functools import reduce
from operator import and_
N = int(input())
ans = reduce(and_, [(i%3==0) or (i%5==0) for i in map(int,input().split()) if i%2==0])
print("APPROVED" if ans else "DENIED")

Buggy submission (verdict: Runtime Error):
from functools import reduce
from operator import and_
N = int(input())
ans = reduce(and_, [(i%3==0) or (i%5==0) for i in map(int,input().split()) if i%2==0])
print("APPROVED" if ans else "DENIED")
Problem p02780 (python)

Fixed submission:
from itertools import accumulate
N, K = map(int, input().split())
ans = [0] + list(accumulate(map(lambda x: (int(x)+1)/2., input().split())))
print(max([y-x for x,y in zip(ans, ans[K:])]))

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
double E(double x){
  return (x+1.) * x / 2. / x;
}

int main(){
  int N,K;
  cin >> N >> K;
  vector<double> Es(N,0);
  double ans = 0;
  auto itr = Es.begin();
  for(int i=0; i<N; i++){
    cin >> *itr;
    *itr = E(*itr); 
    itr++;
    if(i+1 >= K) ans = max(ans, accumulate(prev(itr,K), itr, 0.0));
  }
  cout << ans << endl;
}