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

Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
L = list(map(int, input().split()))
if N == 1:
  print(0)
else:
  x = 0
  for i in range(0,len(L)-1):
    if L[i] > L[i + 1]:
      x = x + (L[i] - L[i + 1])
      L[i + 1] = L[i + 1] + (L[i] - L[i + 1])
  print(x)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
if N == 1:
  print(0)
else:
  x = 0
  for i in range(0,len(L)-1):
    if L[i] > L[i + 1]:
      x = x + (L[i] - L[i + 1])
      L[i + 1] = L[i + 1] + (L[i] - L[i + 1])
print(x)
Problem p02682 (python)

Fixed submission:
A, B, C, K = map(int, input().split())
if((K-A)>0):
    Y = K-A
else:
    print(K)
    exit()
if((Y-B)>0):
    Z = Y-B
else:
    Z = 0

X = A + 0 * Y + (-1) * Z
print(X)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

if(S==T[0:len(S)]):
  print(Yes)
 else:
    print(No)
Problem p02679 (python)

Fixed submission:
import sys
input=sys.stdin.readline
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
from math import gcd
n=N()
mod=10**9+7
az=0
bz=0
zz=0
l=LL(n)
ans=1
import collections
d=collections.defaultdict(int)
for a,b in l:
    if a==0 and b==0:
        zz+=1
    elif a==0:
        az+=1
    elif b==0:
        bz+=1
    elif a<0 and b<0:
        a=-a
        b=-b
        x=gcd(a,b)
        d[(a//x,b//x)]+=1
    elif a<0:
        a=-a
        x=gcd(a,b)
        d[(-a//x,b//x)]+=1
    elif b<0:
        b=-b
        x=gcd(a,b)
        d[(-a//x,b//x)]+=1
    else:
        x=gcd(a,b)
        d[(a//x,b//x)]+=1
pow2=[1]*(n+1)
t=1
for i in range(1,n+1):
    t*=2
    t%=mod
    pow2[i]=t
ans*=(1+(pow2[az]-1)+(pow2[bz]-1))
for a,b in list(d.keys()):
    if a>0 and b>0:
        x=d[(a,b)]
        y=d[(-b,a)]
        ans*=(1+(pow2[x]-1)+(pow2[y]-1))
        ans%=mod
    else:
        if not (b,-a) in d:
            ans*=pow2[d[(a,b)]]
            ans%=mod
print((ans+zz-1)%mod)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
from math import gcd
n=N()
mod=10**9+7
az=0
bz=0
zz=0
l=LL(n)
ans=1
import collections
d=collections.defaultdict(int)
for a,b in l:
    if a==0 and b==0:
        zz+=1
    elif a==0:
        az+=1
    elif b==0:
        ab+=1
    elif a<0 and b<0:
        a=-a
        b=-b
        x=gcd(a,b)
        d[(a//x,b//x)]+=1
    elif a<0:
        a=-a
        x=gcd(a,b)
        d[(-a//x,b//x)]+=1
    elif b<0:
        b=-b
        x=gcd(a,b)
        d[(-a//x,b//x)]+=1
    else:
        x=gcd(a,b)
        d[(a//x,b//x)]+=1
pow2=[1]*(n+1)
t=1
for i in range(1,n+1):
    t*=2
    t%=mod
    pow2[i]=t
ans*=(1+(pow2[az]-1)+(pow2[bz]-1))
for a,b in list(d.keys()):
    if a>0 and b>0:
        x=d[(a,b)]
        y=d[(-b,a)]
        ans*=(1+(pow2[x]-1)+(pow2[y]-1))
        ans%=mod
    else:
        if not (b,-a) in d:
            ans*=pow2[d[(a,b)]]
            ans%=mod
print(ans-1)
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
k-=1
s=s[:k]+s[k].lower()+s[k+1:]
print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
k+=1
s=s[:k]+s[k].lower()+s[k+1:]
print(s)
Problem p03108 (python)

Fixed submission:
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
class unionfind:
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
    def find(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.find(self.root[x])
            return self.root[x]
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if(x == y):
            return 
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def count(self, x):
        return -self.root[self.find(x)]
uf=unionfind(n)
ans=n*(n-1)//2
for i in range(1,m+1):
    a,b=ab[-i]
    ab[-i]=ans
    if(uf.same(a,b)):
        continue
    else:
        ans-=uf.count(a)*uf.count(b)
        uf.unite(a,b)
for i in ab:
    print(i)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lst=[list(map(int,input().split()))  for i in range(m)]
o=[i for i in range(n+1)]
os=[1 for i in range(n+1)]
ans=[n*(n-1)//2]
kumi=n*(n-1)//2
def get(x):
  if(x==o[x]):
    return x
  else:
    return get(o[x])
for i in range(m-1,0,-1):
  a=lst[i][0]
  b=lst[i][1]
  oa=get(a)
  ob=get(b)
  if(oa!=ob):
    kumi=kumi-os[oa]*os[ob]
    ans+=[kumi]
    o[oa]=ob
    os[ob]=os[oa]+os[ob]
  else:
    ans+=[kumi]
for i in range(m-1,-1,-1):
  print(ans[i])
Problem p03201 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
import collections
d=collections.defaultdict(int)
for i in l:
    d[i]+=1
l.sort(reverse=True)
ans=0
for i in l:
    if d[i]>0:
        d[i]-=1
        if d[2**i.bit_length()-i]>0:
            ans+=1
            d[2**i.bit_length()-i]-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
b=[1]*a[0]
for i in range(n-1):
  if(a[i]<a[i+1]):
    b=b+[1]*(a[i+1]-a[i])
  elif(a[i]==a[i+1]):
    b=[b[0]+1]+[1]*(a[i+1]-1)
  else:
    b=b[0:a[i+1]]
    b[-1]=b[-1]+1
print(b[0])
Problem p03326 (python)

Fixed submission:
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
ans=[]
xyz=[[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]
if(m==0):
  print("0")
else:
 for j in xyz:
   x,y,z=j
   lst=[]
   for i in range(m):
      b=a[i][0]*x+a[i][1]*y+a[i][2]*z
      lst+=[b]
   for i in range(m,n):
      b=a[i][0]*x+a[i][1]*y+a[i][2]*z
      if(min(lst)<b):
         lst.remove(min(lst))
         lst+=[b]
   ans+=[sum(lst)]
 print(max(ans))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
ans=[]
xyz=[[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]
if(m==0):
  print("0")
else:
 for j in xyz:
   x,y,z=j
   lst=[]
   for i in range(m):
      b=a[i][0]*x+a[i][1]*y+a[i][2]*z
      lst+=[b]
   for i in range(m,n):
      b=a[i][0]*x+a[i][1]*y+a[i][2]*z
      if(min(lst)<b):
         lst.remove(min(lst))
         lst+=[b]
   ans+=[sum(lst)]
print(max(ans))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
ans=[]
xyz=[[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]
for j in xyz:
   x,y,z=j
   lst=[]
   for i in range(m):
      b=a[i][0]*x+a[i][1]*y+a[i][2]*z
      lst+=[b]
   for i in range(m,n):
     b=a[i][0]*x+a[i][1]*y+a[i][2]*z
     if(min(lst)<b):
        lst.remove(min(lst))
        lst+=[b]
   ans+=[sum(lst)]
print(max(ans))
Problem p03822 (python)

Fixed submission:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(200000)
n=int(input())
l=[int(input()) for i in range(n-1)]
d=[[] for i in range(n+1)]
for i,j in enumerate(l,2):
    d[j].append(i)
l.clear()
def f(a):
    if len(d[a])==0:
        return 0
    l=[f(i) for i in d[a]]
    l.sort(reverse=True)
    return max([i+l[i]+1 for i in range(len(l))])
print(f(1))

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
n=int(input())
l=[int(input()) for i in range(n-1)]
import collections
d=collections.defaultdict(list)
for i,j in enumerate(l,2):
    d[j].append(i)
def f(a):
    if len(d[a])==0:
        return 0
    else:
        l=[f(i) for i in d[a]]
        l.sort(reverse=True)
        return max([i+l[i]+1 for i in range(len(l))])
print(f(1))
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
q = int(input())
 
f=e-d
g=e-c
h=e-b
i=e-a
j=d-c
k=d-b
l=d-a
m=c-b
n=c-a
o=b-a

 
 
if f<=q and g<=q and h<=q and i<=q and j<=q and k<=q and l<=q and m<=q and n<=q and o<=q:
  print("Yay!")
 
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
q = int(input())
 
f = [a,b,c,d,e]

 
g=f[4]-f[3]
h=f[4]-f[2]
i=f[4]-f[1]
j=f[4]-f[0]
k=f[3]-f[2]
l=f[3]-f[1]
m=f[3]-f[0]
n=f[2]-f[1]
o=f[2]-f[0]
p=f[1]-f[0]

 
if g<q and h<q and i<q and j<q and k<q and l<q and m<q and m<q and n<q and o<q p<q:
  print("Yay!")
 
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
q = int(input())

f = [a,b,c,d,e]
f.sort()

g = f[1]-f[0]
h = f[2]-f[0]
i = f[3]-f[0]
j = f[4]-f[0]
k = f[2]-f[1]
l = f[3]-f[1]
m = f[4]-f[1]
n = f[3]-f[2]
o = f[4]-f[2]
p = f[4]-f[3]

if g<q and h<q and i<q and j<q and k<q and l<q and m<q and m<q and n<q and o<q p<q:
  print("Yay!")

else:
  print(":(")
Problem p02859 (python)

Fixed submission:
a = input()
print(int(a)*int(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input()
if a[0:int(n/2)]==a[int(n/2):n]:
	print("Yes")
else:
	print("No")
Problem p02578 (python)

Fixed submission:
N=int(input())
A= list(map(int,input().split()))
sum=0
for i in range(N-1):
  if A[i]>=A[i+1]:
    sum+=A[i]-A[i+1]
    A[i+1]=A[i]
    
print(sum)

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

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	long long ans = 0;
	int MaxNum = 0;
	for (int i = 0; i < N-1; i++)
	{
      if(A[i]>=A[i+1])
		ans += A[i]-A[i+1];
      A[i+1]=A[i]
	}

	cout << ans << endl;
}
Problem p02594 (python)

Fixed submission:
n = int(input())
if n >= 30:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()
if n >= 30:
    print("Yes")
else:
    print("No")
Problem p02682 (python)

Fixed submission:
A,B,C,K=(int(x) for x in input().split())
remain_A = K-A
if remain_A<=0:
    print(K)
else:
    remain_B = remain_A - B
    if remain_B <= 0:
        print(A)
    else:
        ans = (A*1) + (B*0) + (remain_B * (-1))
        print(ans)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())
remain_A = K-A
if remain_A<=0:
    print(K)
else:
    remain_B = remain_A - B
    if remain_B <= 0:
        print(A)
    else:
        ans = (A*1) + (B*0) + (remain_B * (-1))
        print(ans)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())
if A > K:
    print(K)
elif B > K:
    print(A)
else:
    ans = (A*1) + (B*0) + (K-(A+B))*(-1)
    print(ans)
Problem p02701 (python)

Fixed submission:
n = int(input())
s = []
for _ in range(n):
    s.append(input())

print(len(set(s)))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
for _ in range(n):
    s.append(int(input))

print(len(set(s)))
Problem p02725 (python)

Fixed submission:
k, n = map(int, input().split())
A = list(map(int, input().split()))

A.append(A[0]+k)
l = 0
for i in range(n):
    l = max(l, A[i+1]-A[i])
print(k-l)

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

all_length = k*2
point = []
for i in range(n):
    a_left  = k-a[i]
    a_right = k+a[i]
    point.append(a_left)
    point.append(a_right)
point = list(set(point))
point.sort()

num = len(point)
num = round(num)
distance = []
for i in range(num):
    dis = 0
    for j in range(n-1):
        dis += point[i+j+1] - point[i+j]
    distance.append(dis)
mindis = min(distance)
print(mindis)
Problem p02578 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
K = 0
for i in range(N-1):
  if A[i] > A[i+1]:
    S = A[i] - A[i+1]
    # リストの前の最大値を取得して比較しないといけない。
    A[i+1] += S
    K += S
  else:
    pass
print(K)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
for i in range(N-1):
  if A[i] > A[i+1]:
    S = A[i] - A[i+1]
    K = A[i+1] + abs(S)
  else:
    S = A[i] - A[i+1]
    K = abs(S)
print(K)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
for i in range(N-1):
  if A[i] > A[i+1]:
    S = A[i] - A[i+1]
    K = A[i+1] + S
  else:
    K = 0
print(K)
Problem p02754 (python)

Fixed submission:
n,a,b = map(int,input().split())
uni = int(n/(a+b))
if n > (a+b)*uni + a:
  print(a*uni + a)
else:
  print(a*uni + n%(a+b))

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
print(int(n/(a+b))*a + n%(a+b) - (n%(a+b)%a))
Problem p02777 (python)

Fixed submission:
s,t = input().split()
a,b = map(int,input().split())
u = input()
if u == s:
  a -= 1
elif u == t:
  b -= 1
print('{0} {1}'.format(a,b))

Buggy submission (verdict: Runtime Error):
s,t = map(str,input().split())
a,b = map(int,input().split())
u = input()
if u == s:
  a -= 1
elif u == t:
  t -= 1 
print('{0} {1}'.format(a,b))
Problem p02792 (python)

Fixed submission:
n=int(input())
x=[0 for i in range(n+1)]

def find(a,n,x):
  k =0
  l =0
  for j in range(a,n):
    if j % 10!= 0:
      if a%10 == j//(10**(len(str(j))-1)) and j%10 == a//(10**(len(str(a))-1)):
        k+=1
        x[j] = 1
      if a%10 == j%10 and j//(10**(len(str(j))-1)) == a//(10**(len(str(a))-1)):
        l+=1
        x[j] = 1
  if a%10 == a//(10**(len(str(a))-1)):
    return k*l
  return 2*k*l

ans=0
for i in range(1,n+1):
  if x[i] == 0 and i%10!=0:
    ans += find(i,n+1,x)

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

n=int(input())
x=np.zeros(n+1)

def find(a,n,x):
  k =[]
  l =[]
  for j in range(a,n):
    if j % 10!= 0:
      if a%10 == j//(10**(len(str(j))-1)) and j%10 == a//(10**(len(str(a))-1)):
        k.append(j)
        x[j] = 1
      if a%10 == j%10 and j//(10**(len(str(j))-1)) == a//(10**(len(str(a))-1)):
        l.append(j)
        x[j] = 1
  if k[0] == l[0]:
    return len(k)*len(l)
  return 2*len(k)*len(l)

ans=0
for i in range(1,n+1):
  if x[i] == 0 and i%10!=0:
    ans += find(i,n+1,x)

print(ans)
Problem p02597 (python)

Fixed submission:
N=int(input())
c=input()
W=[]
R=[]
pw=0
pr=0
for i in range(N):
  if c[i]=="W":
    W+=[i]
    pw+=1

  if c[N-1-i]=="R":
    R+=[i]
    pr+=1

for i in range(200000):
    if min(len(W),len(R))==i:
        result=i
        break
    if W[i]+R[i]>=N:
        result=i
        break
print(result)
result=i

Buggy submission (verdict: Runtime Error):
N=int(input())
c=input()
W=[]
R=[]
pw=0
pr=0
for i in range(N):
  if c[i]=="W":
    W+=[i]
    pw+=1

  if c[N-1-i]=="R":
    R+=[i]
    pr+=1

for i in range(200000):
    if min(len(W),len(R))==0:
        result=0
        break
    if W[i]+R[i]>=N:
        result=i
        break
print(result)
result=i
Problem p03036 (python)

Fixed submission:
str = input().split()

r = int(str[0])
D = int(str[1])
x2000 = int(str[2])

for i in range(10):
  print(r*x2000-D)
  x2000 = r*x2000-D

Buggy submission (verdict: Runtime Error):
str = input().split()

r = int(str[0])
D = int(str[1])
x2000 = int(str[2])

for i in range(10):
  print(x2000 = (r*x2000-D))
Problem p02723 (python)

Fixed submission:
S = input()
if S[2] == S[3] and S[4] == S[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C= map(int, input().split())
R = list(map(int, input().split()))
G = list(map(int, input().split()))
N = list(map(int, input().split()))

R.sort(reverse=True)
G.sort(reverse=True)
N.sort(reverse=True)

R2 = R[:X]
G2 = G[:Y]

W = sorted(R2 + G2 + N, reverse=True)

print(sum(W[0:X+Y]))
Problem p02726 (python)

Fixed submission:
N, X, Y = map(int, input().split())

ans = [0] * (N-1)
for i in range(1,N+1):
	for j in range(i+1, N+1):
		k = min(j-i, abs(X-i) + abs(Y-j) + 1)
		ans[k-1] += 1

for i in range(N-1):
	print(ans[i])

Buggy submission (verdict: Runtime Error):
N, X, Y = map(int, input().split())

ans = [0] * (N-1)
for i in range(1,N+1):
	for j in range(i, N+1):
		k = min(j-i, abs(X-i) + abs(Y-j) + 1)
		ans[k-1] += 1

for i in range(N):
	print(ans[i])

Buggy submission (verdict: Runtime Error):
N, X, Y = map(int, input().split())

and = [0] * (N-1)
for i in range(1,N+1):
	for j in range(i, N+1):
		k = min(j-i, abs(X-i) + abs(Y-j) + 1)
		ans[k-1] += 1

for i in range(N-1):
	print(ans[i])

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

#a = cmb(n, r)

N, X, Y = map(int, input().split())
c = cmb(N, 2)
#A = [0 for i in range(c)]
#A = [[0 for i in range(2)] for j in range(c)]
#A[0][1] = 1
A = []
#print(A)


for i in range(N):
	for j in range(N):
		if j > i:
			A.append(j-i)

for i in range(N):
	for j in range(N):
		if range(X,Y) in range(i,j):
			A[i][j] = A[i][j] - (Y-X -1)

for i in range(N):
	for j in range(N):
		print(A[i][j])

"""
for i in range(c):
	for j in range(2):
		if i > j:
			A[i][j] = i - j
"""

"""
for i in range(2):
	for j in range(c):
		if j == (i+1):
			A[i][j] = 1
"""
Problem p02729 (python)

Fixed submission:
import math
N,M = map(int, input().split())
def combinations_count(n,r):
	if n == 0 or n == 1:
		return 0
	elif n == 2:
		return 1
	else: return math.factorial(n) // (math.factorial(n-r)*math.factorial(r))
print(combinations_count(N,2) + combinations_count(M,2))

Buggy submission (verdict: Runtime Error):
import math
N,M = map(int, input().split())
def combinations_count(n,r):
	return math.factorial(n) // (math.factorial(n-r)*math.factorial(r))
print(combinations_count(N,2) + combinations_count(M,2))

Buggy submission (verdict: Runtime Error):
import math
N,M = map(int, input().split())
def combinations_count(n,r):
	return math.fractorial(n) / (math.fractorial(n-r)*math.fractorial(r))
print(combinations_count(N,2) + combinations_count(M,2))
Problem p02754 (python)

Fixed submission:
N,B,R = map(int,input().split())
k = N % (B + R)
k2 = int(N / (B + R))
#s = ("b"*B + "r"*R)

#s1 = s[:k]
if k <= B:
	print(k2*(B) + k)
else:
	print(k2*(B) + B)

Buggy submission (verdict: Runtime Error):
N,B,R = map(int,input().split())
k = N % (B + R)
k2 = int(N / (B + R))
s = ("b"*B + "r"*R)
s1 = s[:k]
if k <= B:
	print(k2*(B) + k)
else:
	print(k2*(B) + B)

Buggy submission (verdict: Runtime Error):
N,B,R = map(int,input().split())
k = N % (B + R)
k2 = int(N / (B + R))
s = ("b"*B + "r"*R)
s1 = s[:(k)]
print(k2*(B) + s1.count("b"))
Problem p03345 (python)

Fixed submission:
A,B,C,K = map(int,input().split())

if K % 2 == 0:
	print(A-B) if abs(A-B)<=10**18 else print("Unfair")
else:
	print(B-A) if abs(A-B)<=10**18 else print("Unfair")

Buggy submission (verdict: Runtime Error):
for i in range(K):
	A2 = B + C
	B2 = C + A
	C2 = A + B	

	A,B,C = A2, B2, C2


if abs(A-B) > 10**18:
	print(Unfair)
else:
	print(A-B)
Problem p03723 (python)

Fixed submission:
l = list(map(int, input().split()))
ans = 0
while( l[0]%2==0 and l[1]%2==0 and l[2]%2==0):
    if l[0]==l[1]and l[1]==l[2]:
        ans = -1
        break
    else:
        a = l[0]
        b = l[1]
        c = l[2]
        l[0]=(b+c)/2
        l[1]=(a+c)/2
        l[2]=(a+b)/2
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int, input().split())

def even(a):
	if a % 2 == 0:
		return True
	else:
		return False

if A == B and B == C:
	print("-1")
elif:
	if not (even(A) and even(B) and even(C)):
		print("0")
		
else:
	cnt = 0
	while even(A) and even(B) and even(C):
		tmp1, tmp2, tmp3 = A,B,C
		A = (tmp2+tmp3) // 2
		B = (tmp3+tmp1) // 2
		C = (tmp1+tmp2) // 2
		cnt += 1
	print(cnt)
Problem p02762 (python)

Fixed submission:
class Tree:
    def __init__(self, v: int):
        self.value = v
        self.size = 1
        self.depth = 1
        self.parent = None
        self.friends = set()
        self.blocked = 0

    def get_root(self):
        t = self
        while(t.parent != None):
            t = t.parent
        return t

    def merge(self, t):
        p, c = (self, t) if self.depth > t.depth else (t, self)
        c.parent = p
        p.depth = max(p.size, c.size + 1)
        p.size += c.size

def main():
    n, m, k = [int(s) for s in input().split()]
    forest = [Tree(i+1) for i in range(n)]

    for i in range(m):
        a, b = [int(s) for s in input().split()]
        ta, tb = forest[a-1], forest[b-1]
        ta.friends.add(b)
        tb.friends.add(a)
        ra = ta.get_root()
        rb = tb.get_root()
        if ra != rb:
            ra.merge(rb)

    roots = [t.get_root() for t in forest]
    for i in range(k):
        c, d = [int(s) for s in input().split()]
        tc, td = forest[c-1], forest[d-1]
        rc = roots[c-1]
        rd = roots[d-1]
        if rc == rd:
            tc.blocked +=1
            td.blocked +=1

    cands = []
    for t in forest:
        root = roots[t.value - 1]
        cand = root.size - len(t.friends) - t.blocked - 1
        cands.append(str(cand))
    print(" ".join(cands))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
class Node():
    def __init__(self, v):
        self.value = v
        self.friends = set()
        self.blocked = set()

n, m, k = list(map(int, input().split()))
link = {i: Node(i) for i in range(1, n+1)}
for _ in range(m):
    a, b = list(map(int, input().split()))
    link[a].friends.add(link[b])
    link[b].friends.add(link[a])

for _ in range(k):
    c, d = list(map(int, input().split()))
    link[c].blocked.add(link[d])
    link[d].blocked.add(link[c])

def traverse(hist, friends, blocked):
    for f in friends:
        if f not in hist:
            if f not in blocked:
                hist.add(f)
            traverse(hist, f.friends, blocked)
    return hist

for i in range(1, n+1):
    node = link[i]
    hist = traverse(set(), node.friends, node.blocked)
    cnt = len(hist - set([node]) - node.friends - node.blocked)
    print(cnt, end="" if i == n else " ")
Problem p02847 (python)

Fixed submission:
a = input()
b = 0
if a == "SAT":
    b = 1
if a == "SUN":
    b = 7
if a == "MON":
    b = 6
if a == "TUE":
    b = 5
if a == "WED":
    b = 4
if a == "THU":
    b = 3
if a == "FRI":
    b = 2
print(b)

Buggy submission (verdict: Runtime Error):
a = input()
b = 0
if a == "SAT"
    b = 1
if a == "SUN"
    b = 7
if a == "MON"
    b = 6
if a == "TUE"
    b = 5
if a == "WED"
    b = 4
if a == "THU"
    b = 3
if a == "FRI"
    b = 2
print(b)

Buggy submission (verdict: Runtime Error):
a = input()
b = ""
if a == "SAT"
    b = 1
if a == "SUN"
    b = 7
if a == "MON"
    b = 6
if a == "TUE"
    b = 5
if a == "WED"
    b = 4
if a == "THU"
    b = 3
if a == "FRI"
    b = 2
return b
Problem p02779 (python)

Fixed submission:
S=int(input())
T = input().split()
U = [int(i) for i in T]
U.sort()
r = 0

for i in range(S-1):
  if(U[i] == U[i+1]):
    r+=1
    
if(r==0):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
S=int(input())
T = input().split()
U = [int(T(i)) for i in S]
U.sort
r = 0

for i in S-1:
  if(T[i] == T[i+1]):
    r++
    
if(r==0):
  print("YES")
else:
  print("NO")
Problem p02766 (python)

Fixed submission:
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
  
N,K = map(int,input().split())
A = Base_10_to_n(N, K)
print(len(A))

Buggy submission (verdict: Runtime Error):
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
  
N,K = map(int,imput().split())
A = Base_10_to_n(N, K)
print(len(A))

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int,imput().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

A = Base_10_to_n(N, K)
print(len(A))