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

Fixed submission:
import collections
import itertools
import operator


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same(self, x, y):
        return self.find(x) == self.find(y)


a,b =  map(int, input().split())
l = list(map(int, input().split()))
uf = UnionFind(a)
for i in range(b):
    x,y =map(int, input().split())
    x-=1
    y-=1
    uf.union(x, y)  # (3)
ans=0
for i,t in enumerate(l):
    if uf.same(t-1,i):ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):
import collections
import itertools
import operator


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)


a,b =  map(int, input().split())
l = list(map(int, input().split()))
uf = UnionFind(a)
for i in range(b):
    x,y =map(int, input().split())
    x-=1
    y-=1
    uf.union(x, y)  # (3)
ans=0
for i,t in enumerate(l):
    if uf.same(t-1,l[i]-1):ans+=1

print(ans)
Problem p03378 (python)

Fixed submission:
a,b,c= map(int, input().split())
p = list(map(int, input().split()))
k = 0
for i in range(b):
    if p[i] < c:
        k+=1
print(min(k,b-k))

Buggy submission (verdict: Runtime Error):
a = int(input())
x = list(map(float, input().split()))
m = max(x)
M = m/2
t = 0
s = float("INF")
for i in x:
    #print(s,abs(M-i),i,M)
    if s >= abs(M-i):
        s = min(s,abs(M-i))
        t = i
print(str(int(m))+" "+str(int(t)))

Buggy submission (verdict: Runtime Error):
a = int(input())
x = list(map(float, input().split()))
m = max(x)
M = m/2
t = 0
s = float("INF")
for i in x:
    print(s,abs(M-i),i,M)
    if s >= abs(M-i):
        s = min(s,abs(M-i))
        t = i
print(str(int(m))+" "+str(int(t)))
Problem p03379 (python)

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
y = list(x)
y.sort()
if n % 2 != 0:
    a,b,c = y[n//2-1],y[n//2],y[n//2+1]
    m = b
else:
    a,b = y[n//2-1],y[n//2]    
    m = (a+b)/2
for i in range(n):
    if i == n//2:
        if n%2==0:
            tm = a
        else:
            tm = (a+c)/2
    if x[i] < m :
        if n%2==0:
            tm = b
        else:
            tm = (b+c)/2
    else:
        if n%2==0:
            tm = a
        else:
            tm = (a+b)/2
    print(int(tm))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
y = list(x)
y.sort()
if n % 2 != 0:
    a,b,c = y[n//2-1],y[n//2],y[n//2+1]
    m = b
else:
    a,b = y[n//2-1],y[n//2]    
    m = (a+b)/2
for i in range(n):
    if x[i] < m :
        if n%2==0:
            tm = b
        else:
            tm = (b+c)/2
    if i == n//2:
        if n%2==0:
            tm = a
        else:
            tm = (a+c)/2
    if x[i] > m:
        if n%2==0:
            tm = a
        else:
            tm = (a+b)/2
    print(int(tm))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
y = list(x)
y.sort()
if n % 2 != 0:
    a,b,c = y[n//2-1],y[n//2],y[n//2+1]
    m = b
else:
    a,b = y[n//2-1],y[n//2]    
    m = (a+b)/2
for i in range(n):
    if x[i] < m :
        if n%2==0:
            tm = b
        else:
            tm = (b+c)/2
    if i == n//2:
        if n%2==0:
            tm = a
        else:
            tm = (a+c)/2
    if x[i] > m:
        if n%2==0:
            tm = a
        else:
            tm = (a+b)/2
    print(tm)

Buggy submission (verdict: Runtime Error):
n = int(input())
x=y = list(map(int, input().split()))
y.sort()
if n % 2 != 0:
    a,b,c = y[n//2-1],y[n//2],y[n//2+1]
    m = b
else:
    a,b = y[n//2-1],y[n//2]    
    m = (a+b)/2
for i in range(n):
    if x[i] < m :
        if n%2==0:
            tm = b
        else:
            tm = (b+c)/2
    if i == n//2+1:
        if n%2==0:
            tm = a
        else:
            tm = (a+c)/2
    if x[i] > m:
        if n%2==0:
            tm = a
        else:
            tm = (a+b)/2
    print(tm)
Problem p03380 (python)

Fixed submission:
a = int(input())
x = list(map(float, input().split()))
m = max(x)
M = m/2
t = 0
s = float("INF")
for i in x:
    #print(s,abs(M-i),i,M)
    if s >= abs(M-i):
        s = min(s,abs(M-i))
        t = i
print(str(int(m))+" "+str(int(t)))

Buggy submission (verdict: Runtime Error):
a = int(input())
N= map(int, input().split())
x = list(map(int, input().split()))
m = max(x)
M = m/2
s = float("INF")
for i in x:
    s = min(s,abs(M-i))
print(m,s)
Problem p03399 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)+min(c,d))

Buggy submission (verdict: Runtime Error):
a= int(input())
b = int(input())
c=int(input())
d = int(input())
pritn(min(a,b)*min(c,d))
Problem p03401 (python)

Fixed submission:
a=int(input())
x = list(map(int,input().split()))
x = [0]+x+[0]
s = 0
for i in range(1,a+2):
    s+=abs(x[i-1]-x[i])
for i in range(1,a+1):
    print(s+abs(x[i-1]-x[i+1])-(abs(x[i-1]-x[i])+abs(x[i]-x[i+1])))

Buggy submission (verdict: Runtime Error):
a=int(input())
x = list(map(str,input().split()))
x = [0]+x+[0]
s = 0
for i in range(1,a+2):
    s+=abs(x[i-1]-x[i])
for i in range(1,a+1):
    print(s+abs(x[i-1]-x[i+1])-(abs(x[i-1]-x[i])+abs(x[i]-x[i+1])))
Problem p03424 (python)

Fixed submission:
n = int(input())
k = list(map(str, input().split()))
p = set(k)
if len(p) == 3:
    print("Three")
else:
    print("Four")

Buggy submission (verdict: Runtime Error):
n = int(input())
k=[]
for i in range(n):
    k.append(input())
p = set(k)
if len(p) == 3:
    print("Three")
else:
    print("Four")
Problem p03427 (python)

Fixed submission:
a = input()
b = int(a)
c = list(a)
t = int(a[0])
r = t+(len(a)-1)*9
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
elif b == 9:
    r = 9
    
print(r)

Buggy submission (verdict: Runtime Error):
a = input()
b = int(a)
c = list(a)
t = int(a[0])
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
elif b == 9:
    r = 9
    
print(r)

Buggy submission (verdict: Runtime Error):
a = input()
b = int(a)
c = list(a)
t = int(a[0])
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
else: b == 9
    r = 9
    
print(r)

Buggy submission (verdict: Runtime Error):
a = input()
b = int(a)
c = list(a)
t = int(a[0])
#print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
    
print(r)

Buggy submission (verdict: Runtime Error):
a = input()
b = int(a)
c = list(a)
t = int(a[0])
print(t,a.count("9"))
if t != 9  and a.count("9") == len(a)-1:
    r = t+(len(a)-1)*9
elif a.count("9") != len(a):
    t -= 1
    r = t+(len(a)-1)*9
if b<9:
    r = b
    
print(r)

Buggy submission (verdict: Runtime Error):
a = input()
b = int(a)
c = list(a)
if a.count("9") != len(a):
    t = int(a[0]) -1
print(t+(len(a)-1)*9)
Problem p03457 (python)

Fixed submission:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= [0]
l = [0]
m=[]
co = range(1,10**5+2,2)
ce = range(0,10**5+2,2)
f = 1
def say(i):return print("Yes" if i == 1 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
def addarray(k,l):
    for i in range(n):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n+1):
    t = k[i]-k[i-1]
    if t%2==1 and abs(l[i]-l[i-1]) in co[:t//2+1]:
        f = 1
    elif t%2==0 and abs(l[i]-l[i-1]) in ce[:t//2+1]:
        f = 1
    else:
        f = 0
        break
say(f)

Buggy submission (verdict: Runtime Error):
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= [0]
l = [0]
m=[]
co = range(1,10**5,2)
ce = range(0,10**5,2)
f = 1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
def addarray(k,l):
    for i in range(n+1):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n):
    t = k[i]-k[i-1]
    if not t%2==1 and abs(l[i]-l[i-1]) in ce[:t//2+1]:
        f = 0
        break
    elif not t%2!=1 and abs(l[i]-l[i-1]) in co[:t//2+1]:
        f = 0
        break
say(f)
Problem p03469 (python)

Fixed submission:
a = input()
s = ""
for i in range(len(a)):
    if i == 3:s+="8"
    else:s+=a[i]
print(s)

Buggy submission (verdict: Runtime Error):
a = input()
s = ""
for i in range(a):
    if i == 3:s+="8"
    else:s+=a[i]
print(s)

Buggy submission (verdict: Runtime Error):
a = input()
s = ""
for i in range(a):
    if i == 3:s+=8
    else:s+=i
print(s)
Problem p03471 (python)

Fixed submission:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
a,b = ma()
c=d=e=-1
for i in range(a+1):
    for j in range(a-i+1):
        if b == i*10000 + j*5000 + (a-i-j)*1000: 
            c,d,e=i,j,a-i-j
            break
print(c,d,e)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
l = []
M= 0
for i in range(n):
    x,y = map(int,input().split())
    l.append((x,y))
for i ,(x1,y1) in enumerate(l):
    for x2,y2 in l[i+1:n]:
        M = max(M,math.sqrt((x1-x2)**2+(y1-y2)**2))
print(M)

Buggy submission (verdict: Runtime Error):
a,b = ma()
c=d=e=-1
b=b//1000
for i in range(a):
    for j in range(a-i):
        if b == i*10 + j*5 + (a-i-j): 
            c,d,e=i,j,a-i-j
            break
print(c,d,e)
Problem p03478 (python)

Fixed submission:
n,a,b= map(int, input().split())
r=0
for i in range(n+1):
    s = 0
    t = str(i)
    k = len(t)
    for j in range(k):
        s +=int(t[j])
    if  a <= s <= b:
        r+=int(t)
print(r)

Buggy submission (verdict: Runtime Error):
#include<iostream>
using namespace std;

int findN(int n){
    int sum = 0;
    while(n>0){
        sum+=n%10;
        n/=10;
    }
    return sum;
}
int main(){
    int N,A,B;
    cin >> N >> A >>B;
    int total = 0;
    for(int i = 1; i<=N;++i){
        int sum = findN(i);
        if(sum>= A && sum<=B){
            if(sum>=A && sum <= B){
                total += i;
            }
        }
    }
    cout << total << endl;
}
Problem p03504 (python)

Fixed submission:
##########################
from collections import defaultdict as ddict
N, C = map(int, input().split())
imos = [0] * (10**5 + 2)
last_s_by_c = ddict(lambda: 1)
last_t_by_c = ddict(int)
stc = [list(map(int, input().split())) for i in range(N)]
for s, t, c in sorted(stc, key=lambda x: x[1]):
	if last_t_by_c[c] != s:
		imos[last_s_by_c[c] - 1] += 1
		imos[last_t_by_c[c]] -= 1
		last_s_by_c[c] = s
	last_t_by_c[c] = t
for c in last_s_by_c:
	imos[last_s_by_c[c] - 1] += 1
	imos[last_t_by_c[c]] -= 1
for i in range(10**5 + 1):
	imos[i + 1] += imos[i]
print(max(imos))

Buggy submission (verdict: Runtime Error):
inf = float("INF")
from operator import itemgetter
a,b=map(int,input().split())
d = [0]*(2*(10**5)+10)
dp = []
for i in range(a):
    ts,tf,c =map(int,input().split())
    dp.append([ts,tf,c])

dp = sorted(dp, key=itemgetter(2))
for i in range(1,a):
    if dp[i][0] == dp[i-1][1] and dp[i][2] == dp[i-1][2]:
        dp[i][0] = dp[i-1][0]
        dp[i-1][0],dp[i-1][1],dp[i-1][2]=inf,inf,inf
        
M = 0
for ts,tf,ll in dp:
    d[(ts-1)*2]+=1
    d[(tf-1)*2+3]-=1
M = 0

for i in range(len(d)):
    if i > 0:
        d[i] = d[i-1]+d[i]
    if i%2!=0 :M = max(M,d[i])
print(M)

Buggy submission (verdict: Runtime Error):

a,b=map(int,input().split())

d = [0]*(2*(10**5))
for i in range(a):
    ts,tf,c =map(int,input().split())
    d[(ts-1)*2]+=1
    d[(tf-1)*2+2]-=1
M = 0
for i in range(len(d)):
    if i > 0:
        d[i] = d[i-1]+d[i]
    M = max(M,d[i])
print(M)
Problem p03543 (python)

Fixed submission:
a=list(input())
print('Yes' if((a[0]==a[1]==a[2]) or(a[1]==a[2]==a[3])) else 'No')

Buggy submission (verdict: Runtime Error):
a = input()
s = 0
for i in (l,len(a)):
  if a[i-1] ==a[i]:
          s+=1
if s>=3:
          print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
a = input()
s = 0
for i in (l,len(a)):
  if a[i-1] ==a[i]:
          s+=1
if s>=3:
          print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
a = input()
s = 0
for i in (l,len(a):
  if a[i-1] ==a[i]:
          s+=1
if s>=3:
          print("Yes")
else:print("No")
Problem p03545 (python)

Fixed submission:
a  = input()
x = int(a[0])
y = int(a[1])
z = int(a[2])
w = int(a[3])
o = ["+","-"]
for i in range(2):
    for j in range(2):
        for k in range(2):
            if i == 0 and j == 0 and k == 0:
                if x + y + z + w == 7: p = [i,j,k]
            elif i == 0 and j == 0 and k == 1:
                if x + y + z - w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 0:
                if x + y - z + w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 0:
                if x - y + z + w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 0:
                if x - y - z + w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 1:
                if x + y - z - w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 1:
                if x - y + z - w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 1:
                if x - y - z - w == 7: p = [i,j,k]
print(str(x)+o[p[0]]+str(y)+o[p[1]]+str(z)+str(o[p[2]])+str(w)+"=7")

Buggy submission (verdict: Runtime Error):
a  = input()
x = int(a[0])
y = int(a[1])
z = int(a[2])
w = int(a[3])
o = ["+","-"]
for i in range(2):
    for j in range(2):
        for k in range(2):
            if i == 0 and j == 0 and k == 0:
                if x + y + z + w == 7: p = [i,j,k]
            elif i == 0 and j == 0 and k == 1:
                if x + y + z - w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 0:
                if x + y - z - w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 0:
                if x - y + z - w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 0:
                if x - y - z + w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 1:
                if x + y - z - w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 1:
                if x - y + z - w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 1:
                if x - y - z - w == 7: p = [i,j,k]
print(str(x)+o[p[0]]+str(y)+o[p[1]]+str(z)+str(o[p[2]])+str(w)+"=7")
Problem p03546 (python)

Fixed submission:
N, M = map(int, input().split())
inf = float("inf")
dp = [[inf]*100 for _ in [0]*100]
for i in range(10):dp[i][i] = 0
d = [list(map(int, input().split())) for i in range(10)]
m = [list(map(int, input().split())) for i in range(N)]
ans = 0
 
for i in range(10):
    for j in range(10):
        dp[i][j] = d[i][j]
for k in range(10):
    for i in range(10):
        for j in range(10):
            dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j])
c=0
for i in range(N):
    for j in range(M):
        if m[i][j] != 1 :
            if m[i][j] != -1 :
                c+=dp[m[i][j]][1]
print(c)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
inf = float("inf")
dp = [[inf]*100 for _ in [0]*100]
for i in range(N):dp[i][i] = 0
d = [list(map(int, input().split())) for i in range(10)]
m = [list(map(int, input().split())) for i in range(N)]
ans = 0
 
for i in range(10):
    for j in range(10):
        dp[i][j] = d[i][j]
for k in range(10):
    for i in range(10):
        for j in range(10):
            dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j])
c=0

print(c)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
inf = float("inf")
dp = [[inf]*100 for _ in [0]*100]
for i in range(N):dp[i][i] = 0
d = [list(map(int, input().split())) for i in range(10)]
m = [list(map(int, input().split())) for i in range(N)]
ans = 0
 
for i in range(10):
    for j in range(10):
        dp[i][j] = d[i][j]
for k in range(10):
    for i in range(10):
        for j in range(10):
            dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j])
c=0
for i in range(N):
    for j in range(M):
        if m[i][j] != 1 :
            if m[i][j] != -1 :
                c+=dp[m[i][j]][1]
print(c)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
inf = float("inf")
dp = [[inf]*10 for _ in [0]*10]
for i in range(N):dp[i][i] = 0
d = [list(map(int, input().split())) for i in range(10)]
m = [list(map(int, input().split())) for i in range(N)]
ans = 0
 
for i in range(10):
    for j in range(10):
        dp[i][j] = d[i][j]
for k in range(10):
    for i in range(10):
        for j in range(10):
            dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j])
c=0
for i in range(N):
    for j in range(M):
        if m[i][j] != 1 :
            if m[i][j] != -1 :
                c+=dp[m[i][j]][1]
print(c)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
inf = float("inf")
dp = [[inf]*10 for _ in [0]*10]
for i in range(N):dp[i][i] = 0
d = [list(map(int, input().split())) for i in range(10)]
m = [list(map(int, input().split())) for i in range(N)]
ans = 0
 
for i in range(10):
    for j in range(10):
        dp[i][j] = d[i][j]
for k in range(10):
    for i in range(10):
        for j in range(10):
            dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j])
c=0
for i in range(N):
    for j in range(M):
        if m[i][j] != 1 and m[i][j] != -1 :
            c+=dp[m[i][j]][1]
print(c)
Problem p03547 (python)

Fixed submission:
def ms():return map(str, input().split())#,a,b,c,d
a ,b =ms()
if a < b:
  print("<")
elif a > b:
  print(">")
else:print("=")

Buggy submission (verdict: Runtime Error):
def ms():return map(str, input().split())#,a,b,c,d
a ,b =ms()
if a < b:
  pritn("<")
elif a>b:
  print(">")
else:print("=")
Problem p03550 (python)

Fixed submission:

a,b,c=map(int,input().split())
x = list(map(int,input().split()))
if a == 1:
    print(abs(c-x[-1]))
else:
    print(max(abs(c-x[-1]),abs(x[-1]-x[-2])))

Buggy submission (verdict: Runtime Error):

a,b,c=map(int,input().split())
x = list(map(int,input().split()))
print(max(abs(b-x[-1]),abs(x[-1]-x[-2])))
Problem p03567 (python)

Fixed submission:
a=input()
if "AC" in a:
  print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
a=input()
if “AC” in a:
  print(“Yes”)
else:print(“No”)
Problem p03593 (python)

Fixed submission:
from collections import Counter 

a,b = map(int,input().split())
l = ''
for i in range(a):
    t = input()
    l+=t

c = Counter(list(l))
# print(c)
dp = [0,0,0]
for i in c:
    if c[i]%2 ==1:
        dp[0] +=1
    elif c[i]%4 == 0:
        dp[2] += 1
    elif c[i]%2 == 0:
        dp[1] += 1
# print(dp)
ans = 'No'
if a%2 ==1 and b%2 ==1:
    A = 1
    B = (a+b-2)//2
    if A >= dp[0] and B >= dp[1]:
        ans = 'Yes'
elif  a%2 ==0 and b%2 ==0:
    A = 0
    B= 0
    if A >= dp[0] and B >= dp[1]:
        ans = 'Yes'
elif a%2 ==0 and b%2 ==1:
    A = 0
    B = a//2
    if A >= dp[0] and B >= dp[1]:
        ans = 'Yes'
else:
    A=0
    B= b//2
    if A >= dp[0] and B >= dp[1]:
        ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter 

a,b = map(int,input().split())
l = ''
for i in range(a):
    t = input()
    l+=t

c = Counter(list(l))
# print(c)
dp = [0,0,0]
for i in c:
    if c[i]%2 ==1:
        dp[0] +=1
    elif c[i]%4 == 0:
        dp[2] += 1
    elif c[i]%2 == 0:
        dp[1] += 1
# print(dp)
ans = 'No'
if a%2 ==1 and b%2 ==1:
    A = 1
    B = (a+b-2)//2
A = 0
elif  a%2 ==0 and b%2 ==0:
    B= 0
elif a%2 ==0 and b%2 ==1:
    B = a//2
else:
    B= b//2
if A >= dp[0] and B >= dp[1]:
    ans = 'Yes'
print(ans)
Problem p03611 (python)

Fixed submission:
def abc072_c():
    from collections import Counter
 
    _ = int(input())
    a = list(map(int, input().split()))
    a_ex = []
    for num in a:
        a_ex.append(num)
        a_ex.append(num-1)
        a_ex.append(num+1)
 
    print(max(Counter(a_ex).values()))
 
 
abc072_c()

Buggy submission (verdict: Runtime Error):
import collections
import math
import re
import numpy


def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
s=0
c=0
e =1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
a = a()
x = lma()
l = set(x)
m=1
tn = 0
for i in l:
    if i- tn==1:
        ta = tb
        tb = tc
        tc = x.count(i+1)
    else:
        ta = x.count(i-1)
        tb = x.count(i)
        tc = x.count(i+1)
    t = ta+tb+tc
    m=max(m,t)
    if m>=len(x):break
    tn = i
print(m)

Buggy submission (verdict: Runtime Error):
import collections
import math
import re
import numpy


def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
s=0
c=0
e =1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
a = a()
x = lma()
l = set(x)
m=1
tn = 0
for i in l:
    if i- tn==1:
        ta = tb
        tb = tc
        tc = x.count(i+1)
    else:
        ta = x.count(i-1)
        tb = x.count(i)
        tc = x.count(i+1)
    t = ta+tb+tc
    m=max(m,t)
    tn = i
print(m)

Buggy submission (verdict: Runtime Error):
import collections
import math
import re
import numpy


def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
s=0
c=0
e =1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
a = a()
x = lma()
l = set(x)
m=1
for i in l:
    if i- tn==1:
        ta = tb
        tb = tc
        tc = x.count(i+1)
    else:
        ta = x.count(i-1)
        tb = x.count(i)
        tc = x.count(i+1)
    t = ta+tb+tc
    m=max(m,t)
    tn = i
print(m)