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

Fixed submission:
from collections import deque
def sol():
    n=int(input())
    d=[-1]*n
    l=deque([])
    for i in range(n-1):
        u,v,w=map(int,input().split())
        u,v=min(u,v),max(u,v)
        l.append((u-1,v-1,w))
    f=0
    while len(l):
        x=l.popleft()
        if f:
            if x[2]%2 and d[x[0]]==0:
                d[x[1]]=1
            elif x[2]%2 and d[x[0]]==1:
                d[x[1]]=0
            elif x[2]%2==0 and d[x[0]]==1:
                d[x[1]]=1
            elif x[2]%2==0 and d[x[0]]==0:
                d[x[1]]=0
            elif x[2]%2 and d[x[1]]==0:
                d[x[0]]=1
            elif x[2]%2 and d[x[1]]==1:
                d[x[0]]=0
            elif x[2]%2==0 and d[x[1]]==1:
                d[x[0]]=1
            elif x[2]%2==0 and d[x[1]]==0:
                d[x[0]]=0
            else:
                l.append(x)
        else:
            f=1
            if x[2]%2:
                d[x[0]]=0
                d[x[1]]=1
            else:
                d[x[0]]=0
                d[x[1]]=0
    for i in d:
        print(i)

if __name__=="__main__":
    sol()

Buggy submission (verdict: Runtime Error):
n=int(input())
d=[-1]*n
l=deque([])
for i in range(n-1):
    u,v,w=map(int,input().split())
    u,v=min(u,v),max(u,v)
    l.append((u-1,v-1,w))
f=0
while len(l):
    x=l.popleft()
    if f:
        if x[2]%2 and d[x[0]]==0:
            d[x[1]]=1
        elif x[2]%2 and d[x[0]]==1:
            d[x[1]]=0
        elif x[2]%2==0 and d[x[0]]==1:
            d[x[1]]=1
        elif x[2]%2==0 and d[x[0]]==0:
            d[x[1]]=0
        elif x[2]%2 and d[x[1]]==0:
            d[x[0]]=1
        elif x[2]%2 and d[x[1]]==1:
            d[x[0]]=0
        elif x[2]%2==0 and d[x[1]]==1:
            d[x[0]]=1
        elif x[2]%2==0 and d[x[1]]==0:
            d[x[0]]=0
        else:
            l.append(x)
    else:
        f=1
        if x[2]%2:
            d[x[0]]=0
            d[x[1]]=1
        else:
            d[x[0]]=0
            d[x[1]]=0
for i in d:
    print(i)
Problem p03076 (python)

Fixed submission:
ans=chk=0
d=[]
for i in range(5):
    x=int(input())
    if x%10:
        d.append((x%10,x))
    else:
        ans+=x
d.sort(reverse=True)
for i in d:
    ans+=((i[1]+10)//10)*10
if len(d): ans-=10-d[-1][1]%10

print(ans)

Buggy submission (verdict: Runtime Error):
ans=chk=0
d=[]
for i in range(5):
    x=int(input())
    if x%10:
        d.append((x%10,x))
    else:
        ans+=x
d.sort(reverse=True)
for i in d:
    ans+=((i[1]+10)//10)*10
ans-=10-d[-1][1]%10

print(ans)
Problem p03078 (python)

Fixed submission:
x,y,z,k=map(int,input().split())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
if k>x: a=a[:k]
if k>y: b=b[:k]
if k>z: c=c[:k]
d=[]
ans=[]
for i in a:
    for j in b:
        d.append(i+j)
d.sort(reverse=True)
if len(d)>k: d=d[:k]
for i in c:
    for j in d:
        ans.append(i+j)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
x,y,z,k=map(int,input().split())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
a=a[:min(k,len(a)]
b=b[:min(k,len(b)]
c=c[:min(k,len(c)]
d=[]
ans=[]
for i in a:
    for j in b:
        d.append(i+j)
d=d[:min(k,len(d)]
for i in c:
    for j in d:
        ans.append(i+j)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])
Problem p03088 (python)

Fixed submission:
mod=10**9+7
n=int(input())
memo=[{} for i in range(n+1)]

def ok(last4):
    for i in range(4):
        t=list(last4)
        if i>=1:
            t[i-1],t[i]=t[i],t[i-1]
        if "".join(t).count("AGC")>=1:
            return 0
    return 1

def dfs(cur,last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur==n:
        return 1
    ret=0
    for c in "ACGT":
        if ok(last3+c):
            ret=(ret+dfs(cur+1,last3[1:]+c))%mod
    memo[cur][last3]=ret
    return ret
print(dfs(0,"TTT"))

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=61
for i in range(n-3):
    ans*=4
    ans-=14
    ans%=mod
print(ans)
Problem p03106 (python)

Fixed submission:
a,b,k=map(int,input().split())
ans=[]
for i in range(1,101):
    if (a%i==0 and b%i==0): ans.append(i)
print(ans[-k])

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
ans=[]
for i in range(1,101): if (a%i==0 and b%i==0): ans.append(i)
print(ans[-k])
Problem p03151 (python)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
if sum(b)>sum(a):
    print(-1)
    exit()

j,k=[],[]
for i in range(n):
    if a[i]>b[i]:
        j.append(a[i]-b[i])
    elif a[i]<b[i]:
        k.append(b[i]-a[i])
ans=len(k)

j.sort()
t=sum(k)
while t>1:
    t-=j.pop()
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
if sum(b)>sum(a):
    print(-1)
    exit()
d=[0]
ans=chk=0
print(d[1])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
if sum(b)>sum(a):
    print(-1)
d=[0]
ans=chk=0
print(d[1])
Problem p03171 (python)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
dp=[[0]*(n+1) for i in range(n+1)]

for w in range(1,n+1):
#for w in range(1,3,1):
#    print(dp[1])
    for l in range(n-w+1):
        r=l+w
        dpl=-dp[l+1][r]+a[l]
        dpr=-dp[l][r-1]+a[r-1]
        dp[l][r]=max(dpl,dpr)
#print()
#for i in dp:
#    print(i)
print(dp[0][n])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(i) for i in input().split()]
#dp=[[0]*(n+1) for i in range(n+1)]
dp=[[0]*(n+1) for i in range(n)]

for w in range(1,n+1):
#for w in range(1,3,1):
#    print(dp[1])
    for l in range(n-w+1):
        print("#",l)
        r=l+w
        dpl=-dp[l+1][r]+a[l]
        dpr=-dp[l][r-1]+a[r-1]
        dp[l][r]=max(dpl,dpr)
#print()
#for i in dp:
#    print(i)
print(dp[0][n])
Problem p03175 (python)

Fixed submission:

import sys
sys.setrecursionlimit(100005)
mod=1000000007
# https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2019/0106_educational_dp_2

def dfs(v,a):
    w=b=1
    for u in links[v]:
        if u==a:
            continue
        cw,cb=dfs(u,v)
        w*=cw+cb
        b*=cw
        w%=mod
        b%=mod
    return w,b


n=int(input())
links=[set() for i in range(n)]

for line in sys.stdin.readlines():
    x,y=map(int, line.split())
    x-=1
    y-=1
    links[x].add(y)
    links[y].add(x)

print(sum(dfs(0,None))%mod)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100005)
mod=1000000007
# https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2019/0106_educational_dp_2

def dfs(v,a):
    w,b=,1,1
    for u in links[v]:
        if u==a:
            continue
        cw,cb=dfs(u,v)
        w*=cw*cb
        b*=cw
        w%=mod
        b%=mod
    return w,b


n=int(input())
links=[set() for i in range(n)]

for line in sys.stdin.readlines():
    x,y=map(int, input().split())
    x-=1
    y-=1
    links[x].add(y)
    links[y].add(x)

print(sum(dfs(0,None)%mod))
Problem p03179 (python)

Fixed submission:
#from https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2019/0106_educational_dp_3
from  itertools import accumulate
mod=1000000007
n=int(input())
s=input()
dp=[1]*n
for i in range(n-1):
    if s[i]==">":
        dp.reverse()
        dp=list(accumulate(dp[:-1]))
        dp.reverse()
    else:
        dp=list(accumulate(dp[:-1]))
    for j in range(len(dp)):
        dp[j]%=mod
print(dp[0])

Buggy submission (verdict: Runtime Error):
#from https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2019/0106_educational_dp_3
from  itertools import accumulate
mod=1000000007
n=int(input())
s=input()
dp=[1]*n
for i in range(n-1):
    if s[i]==">":
        dp.reverese()
        dp=list(accumulate(dp[:-1]))
        dp.reverse()
    else:
        dp=list(accumulate(dp[:-1]))
    for j in range(len(dp)):
        dp[j]%=mod
print(dp[0])
Problem p03212 (python)

Fixed submission:
t=["0","3","5","7"]
s=["3","5","7"]
n=int(input())
ans=chk=0
for a in t:
    for b in t:
        for c in t:
            for d in t:
                for e in t:
                    for f in t:
                        for g in s:
                            for h in s:
                                for i in s:
                                    x=str(int(a+b+c+d+e+f+g+h+i))
                                    y=set(list(x))
                                    if ("0" not in y) and (len(y)==3) and (int(x)<=n):
                                        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
def f(a,b):
#a=7,5,3  b=0-7
#no=0, 3=1, 5=2, 7=4, all=7
    if a==7 and b>=4: return b
    if a==7 and b<4: return b+4
    if a==5 and b in (2,3,6,7): return b
    if a==5 and b not in (2,3,6,7): return b+2
    if a==3 and b in (1,3,5,7): return b
    if a==3 and b not in (1,3,5,7): return b+1

n=input()

#a,b=map(int, input().split())
#print(f(a,b))
l=[int(i) for i in "0"+n]
dp=[[[0]*9,[0]*9] for _ in "ww"]
dp[0][0][0]=1

chk=(7,5,3)
for i,j in enumerate(l):
    if i==0: continue
    elif i==1:
        if j in chk: dp[i%2][0][f(j,0)]=1
        if j not in chk: dp[i%2][0][0]=1
        if j>7: dp[i%2][1][4]+=1
        if j>5: dp[i%2][1][2]+=1
        if j>3: dp[i%2][1][1]+=1
        dp[i%2][1][0]=1
    else:
        dp[i%2][1][0]=1
        dp[i%2][1][4]+=1
        dp[i%2][1][2]+=1
        dp[i%2][1][1]+=1
        for k in range(8):
            if dp[i%2-1][0][k] and (k==0 or j not in chk): dp[i%2][0][0]=1
            elif dp[i%2-1][0][k] and j in chk: dp[i%2][0][f(j,k)]=1

            if dp[i%2-1][0][k] and k!=0:
                if j>7: dp[i%2][1][f(7,k)]+=1
                if j>5: dp[i%2][1][f(5,k)]+=1
                if j>3: dp[i%2][1][f(3,k)]+=1
            if dp[i%2-1][1][k] and k!=0:
                dp[i%2][1][f(7,k)]+=dp[i%2-1][1][k]
                dp[i%2][1][f(5,k)]+=dp[i%2-1][1][k]
                dp[i%2][1][f(3,k)]+=dp[i%2-1][1][k]
    for k in range(9):
        dp[i%2-1][0][k]=0
        dp[i%2-1][1][k]=0

print(dp[0][0][7]+dp[0][1][7]+dp[1][0][7]+dp[1][1][7]
Problem p03262 (python)

Fixed submission:
import fractions
a,b=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
s=abs(x[-1]-b)
d=set()
for i in range(a-1):
    s=min(s,abs(x[i]-b))
    d.add(x[i+1]-x[i])
if a==1:
    print(abs(b-x[0]))
    exit()
ans=s
while d:
    ans=fractions.gcd(ans,d.pop())
print(ans)

Buggy submission (verdict: Runtime Error):
import math

a,b=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
s=abs(x[-1]-b)
d=set()
for i in range(a-1):
    s=min(s,abs(x[i]-b))
    d.add(x[i+1]-x[i])
if a==1:
    print(abs(b-x[0]))
    exit()
ans=s
while d:
    ans=math.gcd(ans,d.pop())
print(ans)
Problem p03266 (python)

Fixed submission:
n,k=map(int,input().split())
o=n//k
p=0
if (k%2==0): p=(n+(k//2))//k
print(o**3+p**3)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
o=n//k
p=0
if (k%2==0) p=(n+(k//2))//k
print(o**3+p**3)
Problem p03282 (python)

Fixed submission:
s=input()
k=int(input())
x=-1
y=""
for a,i in enumerate(s):
    if i!="1":
        x=a
        y=i
        break

if x!=-1 and x+1<=k: print(y)
else: print(1)

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
for a,i in enumerate(s):
    if i!="1":
        x=a
        y=i
        break

if x+1<=k: print(y)
else: print(1)

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
for a,i in enumerate(s):
    if i!="1":
        x=a
        y=i
        break

if x<=k: print(y)
else: print(1)

Buggy submission (verdict: Runtime Error):
reina@v157-7-237-130:~/magic/kyogi/Atcoder/abc/b101_125/b106$ cat ./c1.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
p=5000000000000000
s=input()
n=int(input())

chk=1
ans=f=0
for i in s:
    chk=1
    if i=="1": 
        ans+=1
        continue
    for j in range(p-1):
        chk*=int(i)
        if ans+chk>=p:
            print(i)
            f=1
            break
    ans+=chk
    if f==1: break
if f==0: print(s[-1])

Buggy submission (verdict: Runtime Error):
reina@v157-7-237-130:~/magic/kyogi/Atcoder/abc/b101_125/b106$ cat ./c1.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
p=5000000000000000
s=input()
n=int(input())

chk=1
ans=f=0
for i in s:
    chk=1
    if i=="1": 
        ans+=1
        continue
    for j in range(p-1):
        chk*=int(i)
        if ans+chk>=p:
            print(i)
            f=1
            break
    ans+=chk
    if f==1: break
if f==0: print(s[-1])
reina@v157-7-237-130:~/mag
Problem p03287 (python)

Fixed submission:
n,m=map(int,input().split())
l=[int(i) for i in input().split()]
w=[0]
for i in l:
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
for i in d:
    ans+=d[i]*(d[i]-1)
print(ans//2)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[int(i) for i in input().split()]
for i in l:
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
for i in d:
    ans+=d[i]*(d[i]-1)
print(ans//2)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
if n>100:
    print(w[100])
l=[int(i) for i in input().split()]
w=[0]
for i in l:
    #d.append(i+d[-1])
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
#print(w,d)
for i in d:
    ans+=d[i]*(d[i]-1)
"""
for i in range(n):
    for j in range(i+1,n+1):
        p=abs(d[j]-d[i])
        if p%m==0: ans+=1
"""
print(ans//2)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
if n<100:
    print(w[100])
l=[int(i) for i in input().split()]
w=[0]
for i in l:
    #d.append(i+d[-1])
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
#print(w,d)
for i in d:
    ans+=d[i]*(d[i]-1)
"""
for i in range(n):
    for j in range(i+1,n+1):
        p=abs(d[j]-d[i])
        if p%m==0: ans+=1
"""
print(ans//2)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
w=[0]
if n<100:
    print(w[100])
l=[int(i) for i in input().split()]
d=[0]
for i in l:
    #d.append(i+d[-1])
    d.append((i+d[-1])%m)
d.append(0)
ans=0
for i in range(n):
    for j in range(i+1,n+1):
        p=abs(d[j]-d[i])
        if p%m==0: ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
w=[0]
if n<100:
    print(w[100])
l=[int(i) for i in input().split()]
d=[0]
for i in l:
    d.append(i+d[-1])
d.append(0)
ans=0
for i in range(n):
    for j in range(i+1,n+1):
        p=d[j]-d[i]
        if p%m==0: ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
w=[0]
if n<100:
    print(w[100])
l=[int(i) for i in input().split()]
d=[0]
for i in l:
    d.append(i+d[-1])
d.append(0)
ans=0
for i in range(n):
    for j in range(i+1,n+1):
        p=d[j]-d[i]
        if p%m==0: ans+=1
print(ans)
Problem p03330 (python)

Fixed submission:
def sol():
    n,c=map(int,input().split())
    d=[[int(i) for i in input().split()] for i in range(c)]
    t=[[int(i) for i in input().split()] for i in range(n)]
    x0,x1,x2={},{},{}
    for p in range(n**2):
        h,w=p//n,p%n
        x=(h+w)%3
        o=t[h][w]-1
        if x==0:
            if o in x0: x0[o]+=1
            else: x0[o]=1
        if x==1:
            if o in x1: x1[o]+=1
            else: x1[o]=1
        if x==2:
            if o in x2: x2[o]+=1
            else: x2[o]=1
    ans=-1
    for a in range(c**2):
        for k in range(c):
            i,j=a//c,a%c
            q=[i,j,k]
            if len(set(q))<3: continue
            chk=0
            for p in x0:
                chk+=d[p][q[0]]*x0[p]
            for p in x1:
                chk+=d[p][q[1]]*x1[p]
            for p in x2:
                chk+=d[p][q[2]]*x2[p]
            if ans==-1: ans=chk
            ans=min(ans,chk)

    print(ans)

if __name__=="__main__":
    sol()

Buggy submission (verdict: Runtime Error):
def sol():
    n,c=map(int,input().split())
    d=[[int(i) for i in input().split()] for i in range(c)]
    t=[[int(i) for i in input().split()] for i in range(n)]
    ans=-1
    for i in range(c**2):
        for k in range(c):
            i,j=i//c,j%c
            q=[i,j,k]
            if len(set(q))<3: continue
            chk=0
            for p in range(n**2):
                h,w=p//n,p%n
                x=(h+w+2)%3
                chk+=d[t[h][w]-1][q[x]]
            if ans==-1: ans=chk
            ans=min(ans,chk)

    print(ans)

if __name__=="__main__":
    sol()

Buggy submission (verdict: Runtime Error):
def sol():
    n,c=map(int,input().split())
    d=[[int(i) for i in input().split()] for i in range(c)]
    t=[[int(i) for i in input().split()] for i in range(n)]
    ans=-1
    for i in range(c):
        for j in range(c):
            for k in range(c):
                q=[i,j,k]
                if len(set(q))<3: break
                chk=0
                for p in range(n**2):
                    h,w=p//n,p%n
                    x=(h+w+2)%3
                    chk+=d[t[h][w]-1][q[x]]
                if ans==-1: ans=chk
                ans=min(ans,chk)
             
    print(ans)

if __name__="__main__":
    sol()
Problem p03338 (python)

Fixed submission:
n=int(input())
s=input()
ans=0
for i in range(1,n):
    ans=max(ans,len(set(s[:i])&set(s[i:])))
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
for i in range(1,n):
    ans=max(ans,len(set(s[:i])&set(si[:])))
print(ans)
Problem p03340 (python)

Fixed submission:
def sol():
    n=int(input())+1
    a=[int(i) for i in input().split()]+[2**21-1]
    ans=0
    i=j=w=x=0
    while i<n-1:
        while j<n and w==x:
            w+=a[j]
            x^=a[j]
            j+=1
        ans+=(j-i-1)
        w-=a[i]
        x^=a[i]
        i+=1
    print(ans)

if __name__=="__main__":
    sol()

Buggy submission (verdict: Runtime Error):
def sol():
    n=int(input())
    a=[int(i) for i in input().split()]
    ans=n
    p=0
    q=1
    while p<n-1:
        w=x=a[p]
        chk=0
        p+=1
        while p<n:
            w+=a[q]
            x^=a[q]
            q+=1
            if w!=x: break
            chk+=1
        p=q
        ans+=chk*(chk+1)//2
    print(ans)

if __name__=="__main__":
    sol()
Problem p03361 (python)

Fixed submission:
xy=[(1,0),(-1,0),(0,1),(0,-1)]

h,w=map(int,input().split())
l=[]
for i in range(h):
    l.append(input())
for i in range(h):
    for j in range(w):
        if l[i][j]=="#":
            f=0
            for x,y in xy:
                if 0<=(i+y)<h and 0<=(j+x)<w and l[i+y][j+x]=="#": f=1
            if f==0:
                print("No")
                exit()
                

print("Yes")

Buggy submission (verdict: Runtime Error):
xy=[(1,0),(-1,0),(0,1),(0,-1)]

h,w=map(int,input().split())
l=[]
for i in range(h):
    l.appned(input())
for i in range(h):
    for j in range(w):
        if l[i][j]=="#":
            f=0
            for x,y in xy:
                if 0<=(i+y)<h and 0<=(j+x)<w l[i+y][j+x]=="#": f=1
            if f==0:
                print("No")
                exit()
                

print("Yes")
Problem p03408 (python)

Fixed submission:
d={}
n=int(input())
for i in range(n):
    s=input()
    if s in d: d[s]+=1
    else:      d[s] =1
n=int(input())
for i in range(n):
    s=input()
    if s in d: d[s]-=1
ans=chk=0
for i in d:
    ans=max(ans,d[i])
print(ans)

Buggy submission (verdict: Runtime Error):
d={}
n=int(input())
for i in range(n):
    s=input()
    if s in d: d[s]+=1
    else:      d[s] =1
n=int(input())
    s=input()
    if s in d: d[s]-=1
ans=chk=0
for i in d:
    ans=max(ans,d[i])
print(ans)
Problem p03409 (python)

Fixed submission:
n=int(input())
l,r=[],[]
for i in range(n):
    x,y=map(int,input().split())
    l.append((x,y))
l.sort()
l.sort(key=lambda a: a[1],reverse=True)
for i in range(n):
    x,y=map(int,input().split())
    r.append((x,y))
r.sort()
ans=0
chk=[1]*n
for i in range(n):
    for j in range(n):
        if l[i][0]<r[j][0] and l[i][1]<r[j][1] and chk[j]:
            chk[j]=0
            ans+=1
            break
print(ans)

Buggy submission (verdict: Runtime Error):
  1 #!/usr/bin/env python3
  2 # -*- coding: UTF-8 -*-
  3 n=int(input())
  4 l,r=[],[]
  5 for i in range(n):
  6     x,y=map(int,input().split())
  7     l.append((x,y))
  8 l.sort()
  9 for i in range(n):
 10     x,y=map(int,input().split())
 11     r.append((x,y))
 12 r.sort()
 13 ans=[0]*n
 14 t=-1
 15 for i,j in l:
 16     t+=1
 17     for x,y in r:
 18         if i<x and j<y:
 19             ans[t]+=1
 20         else:
 21             break
 22 chk=0
 23 for i in ans:
 24     if i-chk>0: chk+=1
 25 print(chk)
Problem p03423 (python)

Fixed submission:
print(int(input())//3)

Buggy submission (verdict: Runtime Error):
print(int(input()//3))

Buggy submission (verdict: Runtime Error):
print(int(input()//3)
Problem p03435 (python)

Fixed submission:
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
print("Yes" if a[0]-b[0]==a[1]-b[1]==a[2]-b[2] and a[0]-c[0]==a[1]-c[1]==a[2]-c[2] else "No")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
print("Yes" if a[0]-b[0]==a[1]-b[1]==a[2]-b[2] and a[0]-c[0]==a[1]-c[1]==a[2]-c[2] else "No")
Problem p03436 (python)

Fixed submission:
xy=[(1,0),(-1,0),(0,1),(0,-1)]
ans=chk=0
h,w=map(int,input().split())
d=[[0]*w for i in range(h)]
l=[]
for i in range(h):
    a=input()
    chk+=a.count("#")
    l.append(a)
p=set([(0,0)])
while len(p):
    a,b=p.pop()
    for y,x in xy:
        y+=a
        x+=b
        if 0<=y<h and 0<=x<w and l[y][x]!="#":
            if d[y][x]==0 or d[y][x]>d[a][b]+1:
                d[y][x]=d[a][b]+1
                p.add((y,x))

print(-1 if d[h-1][w-1]==0 else h*w-1-chk-d[h-1][w-1])

Buggy submission (verdict: Runtime Error):
ans=chk=0
h,w=map(int,input().split())
d=[[0]*w for i in range(h)]
l=[]
for i in range(h):
    a=input()
    chk+=a.count("#")
    l.append(a)
p=set([(0,0)])
while len(p):
    a,b=p.pop()
    for y,x in xy:
        y+=a
        x+=b
        if 0<=y<h and 0<=x<w and l[y][x]!="#":
            if d[y][x]==0 or d[y][x]>d[a][b]+1:
                d[y][x]=d[a][b]+1
                p.add((y,x))

print(-1 if d[h-1][w-1]==0 else h*w-1-chk-d[h-1][w-1])
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
print('Odd' if (a*b)%2 else 'Even')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print('Odd' if (a*b)%2 else 'Even'))
Problem p03474 (python)

Fixed submission:
a,b=map(int,input().split())
s=input()
if '-' not in s or s.count('-')>1 or s[0]=='-' or s[-1]=='-':
    print('No')
    exit()

p=s.split('-')
print('No' if s[a]!='-' or len(p[0])!=a or len(p[1])!=b else 'Yes')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=input()
if '-' not in s or s.count('-')>1 or s[0]=='-' or s[-1]=='-':
    print('No')
    exit()

p=s.split('-')
print('No' if s[a]!='-' or len(p[0]!=a or len(p[1])!=b) else 'Yes')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=input()
p=s.split('-')
print('No' if s[a]!='-' or len(p[0]!=a or len(p[1])!=b) else 'Yes')