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

Fixed submission:
N = input()

data = [list(raw_input()) for i in range(N)]

alpha = [chr(i) for i in range(97,97+26)]
cnt = [[0 for i in range(26)] for i in range(N)]

for i in range(N):
    for j in range(26):
        cnt[i][j] = data[i].count(alpha[j])


ans = ''
for i in range(26):
    mini = 10000
    for j in range(N):
        mini = min(mini,cnt[j][i]) 
    ans += alpha[i]*mini

print ans

Buggy submission (verdict: Runtime Error):
N = input()

data = [list(raw_input()) for i in range(N)]

alpha = [chr(i) for i in range(97,97+26)]
cnt = [[0 for i in range(26)] for i in range(N)]

for i in range(N):
    for j in range(26):
        cnt[i][j] = data[i].count(alpha[j])


ans = ''
for i in range(26):
    mini = 10000
    for j in range(n):
        mini = min(mini,cnt[j][i]) 
    ans += alpha[i]*mini

print ans
Problem p02599 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N,Q=map(int,input().split())
a=tuple(map(int1,input().split()))
lr=[[0,0,i] for i in range(Q)]
for i in range(Q):
    lr[i][0],lr[i][1]=map(int1,input().split())
lr.sort(key=lambda t: t[1],reverse=1)
class RangeBIT:
    def __init__(self,n):
        self.p=self.BIT(n+1)
        self.q=self.BIT(n+1)
    
    def add(self,s,t,x):
        self.p.add(s,-x*s)
        self.p.add(t,x*t)
        self.q.add(s,x)
        self.q.add(t,-x)
    
    def sum(self,s,t):
        return self.p.sum(t)+self.q.sum(t)*t-self.p.sum(s)-self.q.sum(s)*s
    
    class BIT:
        def __init__(self,n):
            self.num=n
            self.dat=[0]*(self.num+1)
        
        def add(self,i,x):
            i+=1
            while i<=self.num:
                self.dat[i]+=x
                i+=i&-i
        
        def sum(self,i):
            i+=1
            s=0
            while i>0:
                s+=self.dat[i]
                i-=i&-i
            return s

b=RangeBIT(N)
lastap=[-1]*N
ans=[-1]*Q
l,r,j=lr.pop()
for i,x in enumerate(a):
    if lastap[x]!=-1:
        b.add(lastap[x],lastap[x]+1,-1)
    b.add(i,i+1,1)
    lastap[x]=i
    while r==i:
        ans[j]=b.sum(l,r+1)
        if lr:
            l,r,j=lr.pop()
        else:
            l,r,j=-1,-1,-1
for x in ans:
    print(x)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N,Q=map(int,input().split())
a=list(map(int,input().split()))
lr=[]
for i in range(Q):
    l,r=map(int1,input().split())
    lr.append((l,r,i))
lr.sort(key=lambda t: t[1],reverse=1)
class RangeBIT:
    def __init__(self,n):
        self.p=self.BIT(n+1)
        self.q=self.BIT(n+1)
    
    def add(self,s,t,x):
        self.p.add(s,-x*s)
        self.p.add(t,x*t)
        self.q.add(s,x)
        self.q.add(t,-x)
    
    def sum(self,s,t):
        return self.p.sum(t)+self.q.sum(t)*t-self.p.sum(s)-self.q.sum(s)*s
    
    class BIT:
        def __init__(self,n):
            self.num=n
            self.dat=[0]*(self.num+1)
        
        def add(self,i,x):
            i+=1
            while i<=self.num:
                self.dat[i]+=x
                i+=i&-i
        
        def sum(self,i):
            i+=1
            s=0
            while i>0:
                s+=self.dat[i]
                i-=i&-i
            return s
    
b=RangeBIT(N)
lastap=[-1]*N
ans=[-1]*Q
for i in range(N):
    if lastap[a[i]]!=-1:
        b.add(lastap[a[i]],lastap[a[i]]+1,-1)
    b.add(i,i+1,1)
    lastap[a[i]]=i
    while lr and lr[-1][1]==i:
        l,r,j=lr.pop()
        ans[j]=b.sum(l,r+1)
for x in ans:
    print(x)
Problem p02601 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

A,B,C=map(int,input().split())
K=int(input())
while A>=B:
    B*=2
    K-=1
while B>=C:
    C*=2
    K-=1
YesNo(K>=0)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

A,B,C=map(int,input().split())
K=map(int,input().split())
while A<=B:
    B*=2
    K-=1
while B<=C:
    C*=2
    K-=1
print(K>=0)
Problem p02609 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
X=input()
XX=int(X,2)
m=X.count('1')
if m-1>0:
    l=[XX%(m+1),(XX%(m-1))]
else:
    l=[XX%(m+1),0]
for i in range(N):
    if X[i]=='0':
        n=l[0]+pow(2,(N-1)-i,m+1)
        n%=m+1
    else:
        if m-1==0:
            print(0)
            continue
        n=l[1]-pow(2,(N-1)-i,m-1)
        n%=m-1
    ans=1
    while n>0:
        n%=bin(n).count('1')
        ans+=1
    print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
X=input()
XX=int(X,2)
m=X.count('1')
l=[XX%(m+1),(XX%(m-1))]
for i in range(N):
    if X[i]=='0':
        n=l[0]+pow(2,(N-1)-i,m+1)
        n%=m+1
    else:
        n=l[1]-pow(2,(N-1)-i,m-1)
        n%=m-1
    ans=1
    while n>0:
        n=n%bin(n).count('1')
        ans+=1
    print(ans)
Problem p02632 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

K=int(input())
S=input()

def COMinit(n,MOD):
    fac,finv,inv=[0]*max(2,n+1),[0]*max(2,n+1),[0]*max(2,n+1)
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,(n+1)):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
    return fac,finv,inv

fac,finv,inv=COMinit(3*10**6,MOD)

def COM(n, k, MOD=MOD):
    if n<k or n<0 or k<0:
        return 0
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD

dp=[[0]*(K+len(S)+1) for _ in range(2)]
for i in range(len(S)-1,K+len(S)+1):
    dp[0][i]=COM(i,i-len(S)+1)*pow(25,i-len(S)+1,MOD)
dp[1][len(S)]
for i in range(K+len(S)):
    dp[1][i+1]=dp[1][i]*26+dp[0][i]
    dp[1][i+1]%=MOD
print(dp[1][-1])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

K=int(input())
S=input()

dp=[[0]*(len(S)+1) for _ in range(K+len(S)+1)]
dp[0][0]=1
for i in range(K+len(S)):
    for j in range(len(S)+1):
        if j==len(S):
            dp[i+1][j]+=dp[i][j]*26
        else:
            dp[i+1][j]+=dp[i][j]*25
        if j+1<=len(S):
            dp[i+1][j+1]+=dp[i][j]
            dp[i+1][j+1]%=MOD
        dp[i+1][j]%=MOD
print(dp[-1][-1])
Problem p02670 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from collections import deque
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
M=N**2
P=tuple(map(int1,input().split()))
d=[0]*M
for i in range(N):
    for j in range(N):
        d[i*N+j]=min(min(i,N-1-i),min(j,N-1-j))
used=[1]*M
ans=0
que=[]
for p in P:
    ans+=d[p]
    used[p]=0
    que.append(p)
    while que:
        x=que.pop()
        for ddx in (-1,1,-N,N):
            nx=x+ddx
            if 0<=nx<M:
                if used[x]==0 and d[nx]-d[x]>=1:
                    d[nx]-=1
                    que.append(nx)
                elif used[x]==1 and d[nx]-d[x]>=2:
                    d[nx]-=1
                    que.append(nx)
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
from collections import deque
from numba import njit
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

@njit(cache=True)
def solve(N,M,P):
    d=[0]*M
    for i in range(N):
        for j in range(N):
            d[i*N+j]=min(min(i,N-1-i),min(j,N-1-j))
    used=[1]*M
    dx=(-1,1,-N,N)
    ans=0
    que=[]
    for p in P:
        ans+=d[p]
        used[p]=0
        que.append(p)
        while que:
            x=que.pop()
            for ddx in dx:
                nx=x+ddx
                if 0<=nx<M:
                    if used[x]==0 and d[nx]-d[x]>=1:
                        d[nx]-=1
                        que.append(nx)
                    elif used[x]==1 and d[nx]-d[x]>=2:
                        d[nx]-=1
                        que.append(nx)
    return ans

def main():
    N=int(input())
    M=N**2
    P=tuple(map(int1,input().split()))
    ans=solve(N,M,P)
    print(ans)

if __name__ == '__main__':
    main()
Problem p02690 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    X=int(input())
    l=[i**5 for i in range(2000)]
    for i,a in enumerate(l):
        for j,b in enumerate(l):
            if a-b==X:
                print(i,j)
                exit()
            elif a+b==X:
                print(i,-j)
                exit()
    raise Exception
    

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    X=int(input())
    l=[i**5 for i in range(100)]
    for i,a in enumerate(l):
        for j,b in enumerate(l):
            if a-b==X:
                print(i,j)
                exit()
            elif a+b==X:
                print(i,-j)
                exit()
    raise Exception
    

if __name__ == '__main__':
    main()
Problem p02698 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    a=list(map(int,input().split()))
    edge=[[] for _ in range(N)]
    for _ in range(N-1):
        x,y=map(int1,input().split())
        edge[x].append(y)
        edge[y].append(x)
    stack=[(0,1)]
    used=[False]*N
    ans=[0]*N
    dp=[INF]*(N+1)
    dp[0]=0
    dpdp=[]
    prev_l=1
    def dfs(v,l):
        used[v]=True
        index=bisect_right(dp,a[v]-1,hi=l)
        dpdp=(index,dp[index])
        dp[index]=a[v]
        ans[v]=bisect_left(dp,INF,hi=l+1)-1
        for nv in edge[v]:
            if not used[nv]:
                i,x=dfs(nv,l+1)
                dp[i]=x
        return dpdp
    dfs(0,1)
    for a in ans:
        print(a)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    a=list(map(int,input().split()))
    edge=[[] for _ in range(N)]
    for _ in range(N-1):
        x,y=map(int1,input().split())
        edge[x].append(y)
        edge[y].append(x)
    stack=[(0,1)]
    dp=[INF]*(N+10)
    dp[0]=0
    used=[False]*N
    ans=[0]*N
    while stack:
        v,l=stack.pop()
        used[v]=True
        dp[l:]=[INF]*(N-l)
        dp[bisect_right(dp,a[v]-1,hi=l)]=a[v]
        ans[v]=bisect_left(dp,INF,hi=l+1)-1
        for nv in edge[v]:
            if not used[nv]:
                stack.append((nv,l+1))
    for a in ans:
        print(a)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    a=list(map(int,input().split()))
    edge=[[] for _ in range(N)]
    for _ in range(N-1):
        x,y=map(int1,input().split())
        edge[x].append(y)
        edge[y].append(x)
    stack=[(0,1)]
    dp=[INF]*N
    dp[0]=0
    used=[False]*N
    ans=[0]*N
    while stack:
        v,l=stack.pop()
        used[v]=True
        dp[l:]=[INF]*(N-l)
        dp[bisect_right(dp,a[v]-1,hi=l)]=a[v]
        ans[v]=bisect_left(dp,INF,hi=l+1)-1
        for nv in edge[v]:
            if not used[nv]:
                stack.append((nv,l+1))
    for a in ans:
        print(a)

if __name__ == '__main__':
    main()
Problem p02743 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import numpy as np

sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    a,b,c=map(np.float128,input().split())
    
    if a+b+2*np.sqrt(a*b)<c:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
from math import sqrt,isclose

sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    a,b,c=map(int,input().split())
    if sqrt(a)+sqrt(b)<sqrt(c):
        if isclose(sqrt(a)+sqrt(b), sqrt(c), abs_tol=1e-06):
            print('No')
        else:
            print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
Problem p02761 (python)

Fixed submission:
# coding: UTF-8
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,M=map(int,input().split())
    s,c=[0]*M,[0]*M
    d={}
    for i in range(M):
        s,c=map(int,input().split())
        if s in d:
            if c!=d[s]:
                print(-1)
                exit()
        else:
            d[s]=c
    if N!=1 and 1 in d and d[1]==0:
        print(-1)
        exit()
    ans=''
    if N==1 and M==0:
        print(0)
        exit()
    for i in range(1,N+1):
        if i in d:
            ans+=str(d[i])
        else:
            if i==1:
                ans+='1'
            else:
                ans+='0'
    print(ans)

    

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,M=map(int,input().split())
    s,c=[0]*M,[0]*M
    d={}
    for i in range(M):
        s,c=map(int,input().split())
        if s in d:
            if c!=d[s]:
                print(-1)
                exit()
        else:
            d[s]=c
    if N!=1 and d[1]==0:
        print(-1)
        exit()
    ans=''
    for i in range(1,N+1):
        if i in d:
            ans+=str(d[i])
        else:
            if i==0:
                ans+='1'
            else:
                ans+='0'
    print(ans)

    

if __name__ == '__main__':
    main()
Problem p02814 (python)

Fixed submission:
import sys
from fractions import gcd
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,M=map(int,input().split())
    a=tuple(map(lambda x:int(x)//2,input().split()))
    t=a[0]
    c=0
    while True:
        if t%2==0:
            c+=1
            t//=2
        else:
            break
    l=a[0]
    for x in a[1:]:
        if x%(2**c)!=0 or x%(2**(c+1))==0:
            print(0)
            exit()
        l=l*x//gcd(l,x)
    print((M+l)//(l*2))

        

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from fractions import gcd
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,M=map(int,input().split())
    a=tuple(map(int,input().split()))
    for x in a:
        if x%2:
            raise Exception
    print(0)

        

if __name__ == '__main__':
    main()
Problem p02898 (python)

Fixed submission:
N,K=map(int,input().split())
h=list(map(int,input().split()))
s=0
for i in h:
  s+=1 if i >= K else 0
print(s)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
h=list(map(int,input().split()))
s=0
for i in h:
  s+=1 if i => K else 0
print(s)
Problem p02899 (python)

Fixed submission:
import numpy as np
N=int(input())
A=list(map(int,input().split()))
s=list(np.argsort(A))
print(' '.join(repr(e+1) for e in s))

Buggy submission (verdict: Runtime Error):
import numpy
N=int(input())
A=list(map(int,input().split()))
s=numpy.argsort(A)
print(' '.join(s))

Buggy submission (verdict: Runtime Error):
inport numpy
N=int(input())
A=list(map(int,input().split()))
s=numpy.argsort(A)
print(' '.join(s))
Problem p02900 (python)

Fixed submission:
import collections
A,B=map(int,input().split())
def gcd(a,b):
  if b == 0:
    return a
  return gcd(b,a%b)

def prime_factorize(n):
    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)
    return a

print(len(list(collections.Counter(prime_factorize(gcd(A,B))).keys()))+1)

Buggy submission (verdict: Runtime Error):
import Collections
A,B=map(int,input().split())
def gcd(a,b):
  if b == 1:
    return a
  return furui(b,a%b)

def prime_factorize(n):
    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)
    return a

print(len(collections.Counter(prime_factorize(gcd(A,B)).keys)+1)

Buggy submission (verdict: Runtime Error):
import Collections
A,B=map(int,input().split())
def gcd(a,b):
  if b == 1:
    return a
  return furui(b,a%b)

def prime_factorize(n):
    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)
    return a

print(len(collections.Counter(prime_factorize(gcd(A,B)).keys)+1)
Problem p02903 (python)

Fixed submission:
H,W,A,B=map(int,input().split())
for i in range(H):
    print('1'*A+'0'*(W-A) if i < B else '0'*A+'1'*(W-A))

Buggy submission (verdict: Runtime Error):
H,W,A,B=map(int,input().split())
if A*H == B*W:
    str = '1'*A + '0'*(W-A)
    for i in range(H):
        print(str)
        str = str[W-A:]+str[:-A]
elif A == 0 and B == 0:
    for i in range(H)
        print('1'*W)
elif A == 0:
    for i in range(H):
        print('1'*W if i < B else '0'*W)
elif B == 0:
    for i in range(H):
        print('1'*A+'0'*(W-A))
else:
    print('No')
Problem p02909 (python)

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

Buggy submission (verdict: Runtime Error):
if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
else:
    primt('Sunny')
Problem p02911 (python)

Fixed submission:
N,K,Q = map(int,input().split())
string_list=[int(input()) for i in range(Q)]
a = [K-Q]*N
for i in string_list:
    a[i-1] += 1
for i in a:
    print('Yes' if i > 0 else 'No')

Buggy submission (verdict: Runtime Error):
N,K,Q = map(int,input().split())
string_list=[int(input()) for i in range(Q)]
a = [K-Q]*N
for i in string_list:
    a[i] += 1
for i in a:
    print('Yes' if i > 0 else 'No')
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,Q=map(int,input().split())
    a=[0]*(N-1)
    b=[0]*(N-1)
    cns=[[] for _ in range(N)]
    for i in range(N-1):
        a[i],b[i]=map(lambda x: int(x)-1,input().split())
        cns[a[i]].append(b[i])
        cns[b[i]].append(a[i])
    l_x=[0]*N
    for i in range(Q):
        p,x=map(int,input().split())
        l_x[p-1]+=x
    c=[0]*N
    c[0]+=l_x[0]
    def saiki(pn,ppn,x):
        for cn in cns[pn]:
            if cn != ppn:
                z=x+l_x[cn]
                c[cn]+=z
                saiki(cn,pn,z)
        return
    saiki(0,0,c[0])
    print(*c)
    

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,Q=map(int,input().split())
    c=[0]*N
    d={}
    for i in range(N-1):
        a,b=map(int,input().split())
        d[b-1]=a-1
    d2={}
    for i in range(Q):
        p,x=map(int,input().split())
        if p-1 in d2:
            d2[p-1]+=x
        else:
            d2[p-1]=x
    if 0 in d2:
        c[0]+=d2[0]
    for i in range(1,N):
        if i in d2:
            c[i]+=d2[i]
        c[i]+=c[d[i]]
    print(*c)
    

if __name__ == '__main__':
    main()
Problem p02946 (python)

Fixed submission:
a = list(map(int,input().split()))
ans = ""
kaisu = a[0] * 2 - 1
for i in range(kaisu):
    b = a[1] - a[0] + 1 + i
    ans = ans + str(b) + " "
print(ans[:-1])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
ans = ""
kaisu = a[0] * 2 +1
for i in kaisu:
    b = a[1] - a[0] + 1 + i
    ans = ans + str(b) + " "
print(ans[:-1])
Problem p02947 (python)

Fixed submission:
from collections import Counter

N = int(input())
a = [''.join(sorted(input())) for i in range(N)]
count = Counter(a).values()
b = 0
for i in count:
    b = b + i * (i-1)
b=int(b/2)
print(b)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [sorted(list(input())) for i in range(N)]
b = set(a)
ans = len(a) - len(b)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [sorted(list(input())) for i in range(N)]
b = set(a)
print(len(a) - len(b))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [sorted(list(int(input()))) for i in range(N)]
b = 0
for i in a:
 b = b + a.count(i)
print(b / 2)