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

Fixed submission:
h,w=map(int,input().split())
cnt=[0]*26
for i in range(h):
	a=input()
	for j in range(w):
		cnt[ord(a[j])-ord("a")]+=1
if h%2==1 and w%2==1:
	f=0
	for i in range(26):
		if cnt[i]%2==1:
			cnt[i]-=1
			break
	four=0
	for i in range(26):
		if cnt[i]>=4:
			four+=cnt[i]//4*4
		elif cnt[i]%2==1:
			f=-1
			break
	if four>=h*w-(h//2+w//2)*2-1 and f==0:
		f=1
	else:
		f=0
elif h%2==0 and w%2==0:
	f=1
	for i in range(26):
		if cnt[i]%4!=0:
			f=0
			break
else:
	if h%2==0:
		h,w=w,h
	two=0;f=0
	for i in range(26):
		if cnt[i]%4==2:
			two+=2
		elif cnt[i]%2==1:
			f=-1
			break
	if two<=w and f==0:
		f=1
	else:
		f=0
print("Yes" if f else "No")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
cnt=[0]*26
for i in range(h):
	a=input()
	for j in range(w):
		cnt[ord(a[j])-ord("a")]+=1
if h%2==1 and w%2==1:
	f=0
	for i in range(26):
		if cnt[i]%2==1:
			cnt[i]-=1
			break
	four=0
	for i in range(26):
		if cnt[i]>=4:
			four+=cnt[i]//4*4
		elif cnt[i]%2==1:
			f=-1
			break
	print(2/0)
	if four>=h*w-(h//2+w//2)*2-1 and f==0:
		f=1
	else:
		f=0
elif h%2==0 and w%2==0:
	f=1
	for i in range(26):
		if cnt[i]%4!=0:
			f=0
			break
else:
	if h%2==0:
		h,w=w,h
	four=0;f=0
	for i in range(26):
		if cnt[i]>=4:
			four+=cnt[i]//4*4
		elif cnt[i]%2==1:
			f=-1
			break
	if four>=h*w-w//2*2 and f==0:
		f=1
	else:
		f=0
print("Yes" if f else "No")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
cnt=[0]*26
for i in range(h):
	a=input()
	for j in range(w):
		cnt[ord(a[j])-ord("a")]+=1
cnt.sort(reverse=True)
now=0
for i in range(h//2+w//2):
	if cnt[now]>=4:
		cnt[now]-=4
	else:
		now+=1
	if now==26:
		break
cnt.sort(reverse=True)
if h%2==1 and w%2==1:
	print(2/0)
	if cnt[:3] in ([2,2,1],[4,1],[3,2],[1,0,0]):
		print("Yes")
	else:
		print("No")
elif h%2==0 and w%2==0:
	if cnt[0]==0:
		print("Yes")
	else:
		print("No")
else:
	if cnt[0]==cnt[1]==2 or cnt[0]==4:
		print("Yes")
	else:
		print("No")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
cnt=[0]*26
for i in range(h):
	a=input()
	for j in range(w):
		cnt[ord(a[j])-ord("a")]+=1
cnt.sort(reverse=True)
now=0
for i in range(h//2+w//2):
	if cnt[now]>=4:
		cnt[now]-=4
	else:
		now+=1
cnt.sort(reverse=True)
if h%2==1 and w%2==1:
	if cnt[:3]==[2,2,1] or h==w==1:
		print("Yes")
	else:
		print("No")
elif h%2==0 and w%2==0:
	if cnt[0]==0:
		print("Yes")
	else:
		print("No")
else:
	if cnt[0]==cnt[1]==2:
		print("Yes")
	else:
		print("No")
Problem p03657 (python)

Fixed submission:
a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
 print("Possible")
else:
 print("Impossible")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
if a%3==0 or b%3==0 or (a+b)%3==0:
 print("Possible")
else:
 print("Impossible")
Problem p03693 (python)

Fixed submission:
a,b,c=map(int,input().split())
if (10*b+c)%4==0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a=int(input())
if a%4==0:
 print("YES")
else:
 print("NO")
Problem p03694 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input)
a=list(map(int,input().split()))
print(max(a)-min(a))
Problem p03695 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
	a[i]//=400
free=0
b=set()
for i in range(n):
	if a[i]>=8:
		free+=1
	else:
		b.add(a[i])
cnt=len(b)
x=max(cnt,1)
y=(cnt+free)
print(x,y)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
	a[i]//=400
free=0
b=set()
for i in range(n):
	if a[i]>=8:
		free+=1
	else:
		b.add(a[i])
cnt=len(b)
x=max(cnt,1)
y=min(cnt+free)
print(x,y)
Problem p03711 (python)

Fixed submission:
a,b=map(int,input().split())
if a==2:
 A=2
elif a==4 or a==6 or a==9 or a==11:
 A=1
else:
 A=3
if b==2:
 B=2
elif b==4 or b==6 or b==9 or b==11:
 B=1
else:
 B=3
if A==B:
 print("Yes")
else:
 print("No")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==2:
 A==2
elif a==4 or a==6 or a==9 or a==11:
 A==1
else:
 A==3
if b==2:
 B==2
elif B==4 or B==6 or B==9 or B==11:
 B==1
else:
 B==3
if A==b:
 print("Yes")
else:
 print("No")
Problem p03760 (python)

Fixed submission:
a=input()
b=input()
s=""
for i in range(len(b)):
	s+=a[i]+b[i]
if len(a)!=len(b):
	s+=a[-1]
print(s)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
s=""
for i in range(min(len(b))):
	s+=a[i]+b[i]
if len(a)!=len(b):
	s+=a[-1]
print(s)
Problem p03773 (python)

Fixed submission:
a,b=map(int,input().split())
if a+b>23:
 print(a+b-24)
else:
 print(a+b)

Buggy submission (verdict: Runtime Error):
a,b=mp(int,input().split())
if a+b>24:
 print(a+b-24)
else:
 print(a+b)
Problem p03777 (python)

Fixed submission:
a,b=input().split()
if a=="H" and b=="H":
	print("H")
elif a=="H" and b=="D":
	print("D")
elif a=="D" and b=="D":
	print("H")
else:
	print("D")

Buggy submission (verdict: Runtime Error):
a.b=input().split()
if a=="H" and b=="H":
	print("H")
elif a=="H" and b=="D":
	print("D")
elif a=="D" and b=="D":
	print("H")
else:
	print("D")
Problem p03827 (python)

Fixed submission:
n=int(input())
s=input()
a=[0]
for i in range(1,n+1):
	if s[i-1]=="I":
		a.append(a[i-1]+1)
	else:
		a.append(a[i-1]-1)
print(max(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
a=[1]
for i in range(1,n+1):
	if s[i]=="I":
		a.append(a[i-1]+1)
	else:
		a.append(a[i-1]-1)
print(max(a))
Problem p03910 (python)

Fixed submission:
n=int(input())
for i in range(n+1):
	if i**2+i>=2*n:
		p=i
		break
total=(p*(p+1))//2
for i in range(1,p+1):
	if total-n!=i:
		print(i)

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
	if i**2+i>=2*n:
		p=i
		break
total=(p*(p+1))//2
for i in range(1,p+1):
	if total-n!=i:
		print(i)

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(int(n**0.5)+3):
	if i**2+i>=2*n:
		p=i
		break
total=(p*(p+1))//2
for i in range(1,p+1):
	if total-n!=i:
		print(i)
Problem p03962 (python)

Fixed submission:
a,b,c=input().split()
if a!=b and b!=c and c!=a:
	print(3)
elif a!=b or b!=c or c!=a:
	print(2)
else:
	print(1)

Buggy submission (verdict: Runtime Error):
n,k-map(int,input().split())
ans=k
for i in range(n):
	ans*=k-1
print(ans)
Problem p03963 (python)

Fixed submission:
n,k=map(int,input().split())
ans=k
for i in range(n-1):
	ans*=k-1
print(ans)

Buggy submission (verdict: Runtime Error):
n,k-map(int,input().split())
ans=k
for i in range(n):
	ans*=k-1
Problem p03970 (python)

Fixed submission:
s=input()
ans="CODEFESTIVAL2016"
anss=0
for i in range(16):
	if s[i]!=ans[i]:
		anss+=1
print(anss)

Buggy submission (verdict: Runtime Error):
s=input()
ans="CODEFESTIVAL2016"
ans=0
for i in range(16):
	if s[i]!=ans[i]:
		ans+=1
print(ans)
Problem p03992 (python)

Fixed submission:
s=input()
print(s[:4]+" "+s[4:])

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
ss=[]
for i in range(len(s)):
	ss.append(ord(s[i])-ord("a"))
i=0
while k>0:
	if i==len(s)-1:
		ss[i]=(k+ss[i])%26
		break
	elif k>=26-ss[i] and ss[i]!="a":
		k-=(26-ss[i])
		ss[i]=0
	i+=1
ans=""
for i in range(len(s)):
	ans+=chr(ord("a")+ss[i])
print(ans)
Problem p03994 (python)

Fixed submission:
s=input()
k=int(input())
ss=[]
for i in range(len(s)):
	ss.append(ord(s[i])-ord("a"))
i=0
while k>0:
	if i==len(s)-1:
		ss[i]=(k+ss[i])%26
		break
	elif k>=26-ss[i] and ss[i]!=0:
		k-=(26-ss[i])
		ss[i]=0
	i+=1
ans=""
for i in range(len(s)):
	ans+=chr(ord("a")+ss[i])
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
ss=[]
for i in range(len(s)):
	ss.append(ord(s[i])-ord("a"))
i=0
while k>0:
	if i==len(s)-1:
		ss[i]=(k+ss[i])%26
		break
	elif k>=26-ss[i]:
		k-=(26-ss[i])
		ss[i]=0
	i+=1
ans=""
for i in range(len(s)):
	ans+=chr(ord("a")+ss[i])
print(ans)


if len(ans)==1:
	print(2/0)
elif len(ans)<=3:
	for i in range(10**12):
		ans+="a"
Problem p03998 (python)

Fixed submission:
sa=input()
sb=input()
sc=input()
pta=0
ptb=0
ptc=0
turn="a"
for i in range(300):
 if pta==len(sa) and turn=="a":
  print("A")
  break
 elif ptb==len(sb) and turn=="b":
  print("B")
  break
 elif ptc==len(sc) and turn=="c":
  print("C")
  break
 elif turn=="a":
  turn=sa[pta]
  pta+=1
 elif turn=="b":
  turn=sb[ptb]
  ptb+=1
 else:
  turn=sc[ptc]
  ptc+=1

Buggy submission (verdict: Runtime Error):
sa=input()
sb=input()
sc=input()
pointa=len(sa)
sua=0
pointb=len(sb)
sub=0
pointc=len(sc)
suc=0
turn="a"
for i in range(500):
 if pointa==-1:
  print("A")
  break
 elif pointb==0:
  print("B")
  break
 elif pointc==0:
  print("C")
  break
 elif turn=="a":
  turn=sa[sua]
  pointa-=1
  sua+=1
 elif turn=="b":
  turn=sb[sub]
  pointb-=1
  sub+=1
 else:
  turn=sc[suc]
  pointc-=1
  suc+=1
Problem p04019 (python)

Fixed submission:
s=input()
S=s.count("S")
E=s.count("E")
N=s.count("N")
W=s.count("W")
a=0
b=0
if S>0 and N>0:
	a+=1
elif S==N==0:
	a+=1
if E>0 and W>0:
	b+=1
elif E==W==0:
	b+=1
if a==b==1:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
	x=int(input())
	a.append(x)
ans=0
for i in range(n-1):
	if a[i]>0:
		ans+=(a[i]//2)
		a[i]-=(a[i]//2)*2
	if a[i]>0:
		a[i+1]-=min(a[i],a[i+1])
		ans+=min(a[i],a[i+1])
if a[-1]>0:
	ans+=a[-1]//2
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
	x=int(input())
	a.append(x)
ans=0
for i in range(n-1):
	if a[i]>0:
		ans+=(a[i]//2)
		a[i]-=(a[i]//2)*2
	if a[i]>0:
		a[i+1]-=min(a[i],a[i+1])
		ans+=min(a[i],a[i+1])
if a[-1]>0:
	ans+=a[-1]//2
print(ans

Buggy submission (verdict: Runtime Error):
=int(input())
a=[]
for i in range(n):
	x=int(input())
	a.append(x)
ans=0
for i in range(n-1):
	if a[i]>0:
		ans+=(a[i]//2)
		a[i]-=(a[i]//2)*2
	if a[i]>0:
		a[i+1]-=min(a[i],a[i+1])
		ans+=min(a[i],a[i+1])
if a[-1]>0:
	ans+=a[-1]//2
print(ans)
Problem p02586 (python)

Fixed submission:
def main():
  import sys
  input=sys.stdin.readline
  h,w,k=map(int,input().split())
  H=range(h)
  W=range(w)
  dp=[[[0]*w for j in H] for i in range(4)]
  for _ in range(k):
    r,c,v=map(int,input().split())
    dp[0][r-1][c-1]=v
  if dp[0][0][0]!=0:
    dp[1][0][0]=dp[0][0][0]
    dp[0][0][0]=0
  for y in H:
    for x in W:
      v=dp[0][y][x]
      dp[0][y][x]=0
      for i in range(4):
        if 0<x:
          if dp[i][y][x]<dp[i][y][x-1]:
            dp[i][y][x]=dp[i][y][x-1]
          if 0<i and v!=0 and dp[i][y][x]<dp[i-1][y][x-1]+v:
            dp[i][y][x]=dp[i-1][y][x-1]+v
        if 0<y:
          if dp[0][y][x]<dp[i][y-1][x]:
            dp[0][y][x]=dp[i][y-1][x]
          if v!=0 and dp[1][y][x]<dp[i][y-1][x]+v:
            dp[1][y][x]=dp[i][y-1][x]+v
  print(max([dp[i][h-1][w-1] for i in range(4)]))
main()

Buggy submission (verdict: Runtime Error):
def main():
  import sys
  input=sys.stdin.readline
  h,w,k=map(int,input().split())
  H=range(h)
  W=range(w)
  dp=[[[0]*w for j in H] for i in range(4)]
  for _ in range(k):
    r,c,v=map(int,input().split())
    dp[r-1][c-1][0]=v
  if dp[0][0][0]!=0:
    dp[1][0][0]=dp[0][0][0]
    dp[0][0][0]=0
  for y in H:
    for x in W:
      v=dp[0][y][x]
      dp[0][y][x]=0
      for i in range(4):
        if 0<x:
          if dp[i][y][x]<dp[i][y][x-1]:
            dp[i][y][x]=dp[i][y][x-1]
          if 0<i and v!=0 and dp[i][y][x]<dp[i-1][y][x-1]+v:
            dp[i][y][x]=dp[i-1][y][x-1]+v
        if 0<y:
          if dp[0][y][x]<dp[i][y-1][x]:
            dp[0][y][x]=dp[i][y-1][x]
          if v!=0 and dp[1][y][x]<dp[i][y-1][x]+v:
            dp[1][y][x]=dp[i][y-1][x]+v
  print(max([dp[i][h-1][w-1] for i in range(4)]))
main()
Problem p02657 (python)

Fixed submission:
a,b=map(int,input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(a*b9)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(a*b9
Problem p02755 (python)

Fixed submission:
a,b=map(int,input().split())
for i in range(10010):
  if i*8//100==a and i//10==b:
    print(i)
    exit(0)
print(-1)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
for i in range(100):
  if int(i*1.08)==a and int(i*1.1)==b:
    print(i)
    exit(0)
print(-1)
Problem p03031 (python)

Fixed submission:
n,m=map(int,input().split())
s=[[]]*m
for i in range(m):
  s[i]=list(map(int,input().split()))
  del s[i][0]
p=list(map(int,input().split()))

ans=0
for bit in range(1<<n):
  x=0
  for i in range(m):
    y=0
    for j in s[i]:
      if bit&(1<<(j-1)):
        y+=1
    if y%2==p[i]%2:
      x+=1
  if x==m:
    ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[[]]*m
for i in range(m):
  s[i]=list(map(int,input().split()))
  del s[0]
p=list(map(int,input().split()))

ans=0
for bit in range(1<<n):
  x=0
  for i in range(m):
    y=0
    for j in s[i]:
      if bit&(1<<(j-1)):
        y+=1
    if y%2==p[i]%2:
      x+=1
  if x==m:
    ans+=1

print(ans)
Problem p03196 (python)

Fixed submission:
n,p=map(int,input().split())

d={}
x=p
for i in range(2,p):
  while x%i==0:
    if i in d:
      d[i]+=1
    else:
      d[i]=1
    x//=i
  if i*i>=p:
    break
if x>1:
  d[x]=1

ans=1
for k,v in d.items():
  for i in range(v//n):
    ans*=k

print(ans)

Buggy submission (verdict: Runtime Error):
n,p=map(int,input().split())

d={}
x=p
for i in range(2,p):
  while x%i==0:
    if i in d:
      d[i]+=1
    else:
      d[i]=1
    x//=i
  if i*i>=p:
    break

ans=1
for k,v in d:
  for i in range(v//n):
    ans*=k

print(ans)
Problem p03351 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
ans=False
if abs(a-c)<=d:
  ans=True
if abs(a-b)<=d and abs(b-c)<=d:
  ans=True
if ans:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
ans=False
if abs(a-c)<=d:
  ans=True
if abs(a-b)<=d&&abs(b-c)<=d:
  ans=True
if ans:
  print("Yes")
else:
  print("No")
Problem p03448 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())

ans=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k==x:
        ans+=1
      
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
x=int(input())

ans=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k==x
      ans+=1
      
print(ans)
Problem p03469 (python)

Fixed submission:
s=input()
print(s[:3]+'8'+s[4:])

Buggy submission (verdict: Runtime Error):
s=input()
s[3]='8'
print(s)
Problem p03473 (python)

Fixed submission:
m=int(input())
print(48-m)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define each(i, a) for(auto &i : a)
#define SORT(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

int main() {
    init();

    int m; cin >> m;
    print(24 - m + 24);

    return 0;
}
Problem p03478 (python)

Fixed submission:
n,a,b=map(int,input().split())

ans=0
for i in range(1,n+1):
  s=0
  x=i
  while 0<x:
    s+=x%10
    x//=10
  if a<=s and s<=b:
    ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())

ans=0
for i in ranpe(1,n+1):
  s=0
  x=i
  while 0<x:
    s+=x%10
    x=x//10
  if a<=s and s<=b:
    ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())

ans=0
for i in ranpe(1,n+1):
  s=0
  x=i
  while 0<x:
    s+=x%10
    x//=10
  if a<=s and s<=b:
    ans+=i
print(ans)
Problem p03486 (python)

Fixed submission:
s=''.join(sorted(input()))
t=''.join(sorted(input(),reverse=True))
print('YNeos'[s>=t::2])

Buggy submission (verdict: Runtime Error):
s=''.join(sorted(input()))
t=''.joinsorted(input(),reverse=True))
print('YNeos'[s>=t::2])
Problem p03671 (python)

Fixed submission:
a=list(map(int,input().split()))
a.sort()
print(a[0]+a[1])

Buggy submission (verdict: Runtime Error):
a=map(int,input().split())
a.sort()
print(a[0]+a[1])
Problem p03672 (python)

Fixed submission:
s=input()
n=len(s)
for i in range(n//2,0,-1):
  if i*2==n:
    continue
  if s[0:i]==s[i:i+i]:
    print(i+i)
    break

Buggy submission (verdict: Runtime Error):
s=input()
for i in range(len(s)/2-1,0,-1):
  if s[0:i]==s[i:i+i]:
    print(i)
    exit(0)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
for i in range(1,n+1):
  if s[0:i]==s[i:i+i]:
    print(i)
    break:
Problem p03740 (python)

Fixed submission:
x,y=map(int,input().split())
if abs(x-y)<=1:
  print('Brown')
else:
  print('Alice')

Buggy submission (verdict: Runtime Error):
x,y=map(int,input.split())
if abs(x-y)<=1:
  print('Blown')
else:
  print('Alice')
Problem p02536 (python)

Fixed submission:
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)

		if x == y:
			return

		if self.parents[x] > self.parents[y]:
			x, y = y, x

		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for i, x in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m = readInts()
u = UnionFind(n)
for i in range(m):
	a,b = readInts()
	u.union(a-1,b-1)

print(u.group_count()-1)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)

		if x == y:
			return

		if self.parents[x] > self.parents[y]:
			x, y = y, x

		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for i, x in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m = readInts()
u = UnionFind(n-1)
for i in range(m):
	a,b = readInts()
	u.union(a-1,b-1)

print(u.group_count())
Problem p02556 (python)

Fixed submission:
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
data = []
for i in range(n):
	x,y = readInts()
	data.append([x+y,x,y,x-y])
ans = 0
data.sort(key=lambda x:x[0])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[1])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[2])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[3])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
data = []
for i in range(n):
	x,y = readInts()
	data.append([x+y,x,y])

data.sort(key=lambda x:x[0])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[1])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[2])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
print(ans)