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

Fixed submission:
NR= input().split()
N= int (NR[0])
R= int (NR[1])
if (N >= 10):
    print(R)
else:
    print (R+100*(10-N))

Buggy submission (verdict: Runtime Error):
N = int(input())
R = int(input())
if 0 <= R <= 4111:
    if 10 <= N <= 100:
        print(R)
    else:
        K = 100 * (10 - N)
        M = R + K
        print(M)

Buggy submission (verdict: Runtime Error):
N = int(input('N:'))
R = int(input('R:'))
while int(N) == N and int(R) == R:
    if 1 <= N <= 100 and 0 <= R <= 4111:
        if N > 10:
            print(R)
        else:
            K = 100 * (10 - N)
            print(R + K)
    break
Problem p02767 (python)

Fixed submission:
n = map(int,input().split())
a = list(map(int,input().split()))
q = []
mi,ma = min(a),max(a)
for i in range(mi,ma+1):
    x = 0
    for j in a:
        x+=(j-i)**2
    q.append(x)
print(min(q))

Buggy submission (verdict: Runtime Error):
import math


def point_stamina(p):
    stamina = 0
    for x in persons_coordinates:
        stamina += (x - p) ** 2
    return stamina


n = int(input())
persons_coordinates = list(map(int, input().split()))
max_coordinate = max(persons_coordinates)
min_coordinate = min(persons_coordinates)
min_stamina = math.inf

for p in range(min_coordinate, max_coordinate + 1):
    stamina = point_stamina(p)
    if min_stamina >= stamina:
        min_stamina = stamina

print(min_stamina)
Problem p02782 (python)

Fixed submission:
import sys
input = sys.stdin.buffer.readline
 
def main():
    a,b,p,d = map(int,input().split())
    MOD = 10**9+7
    N = p+d+5
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
 
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    def comb(x,y):
        return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD
 
    print((comb(p+1,d+1)-comb(p+1,b)-comb(d+1,a)+comb(a,b))%MOD)
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.buffer.readline
 
def main():
    t,b,c,d = map(int,input().split())
    MOD = 10**9+7
    N = c+d+5
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
 
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    def comb(x,y):
        return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD
 
    print((comb(c+1,d+1)-comb(c+1,b)-comb(d+1,t)+comb(t,b))%MOD)
    
if _name_ == "_main_":
    main()
#print the result
#calling the main function

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.buffer.readline
 
def main():
    t,b,c,d = map(int,input().split())
    MOD = 10**9+7
    N = c+d+5
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
 
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    def comb(x,y):
        return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD
 
    print((comb(c+1,d+1)-comb(c+1,b)-comb(d+1,t)+comb(t,b))%MOD)
    
if _name_ == "_main_":
    main()
#print the result
Problem p02783 (python)

Fixed submission:
import sys

for line in sys.stdin:
    l= line.split()
    H=int(l[0])
    A=int(l[1])
    i = 0
    while(H>0):
        H-=A
        i+=1
    print(i)

Buggy submission (verdict: Runtime Error):
H = int(input())
K = int(input())
cnt=0
while(H>0):
  H=H-K
  cnt=cnt+1

print(cnt)
Problem p02789 (python)

Fixed submission:
from sys import stdin

def main():
    n,m = map(int,stdin.readline().split())
    if(n==m):
        print("Yes")
    else:
        print("No")

main()

Buggy submission (verdict: Runtime Error):
n=int(input())
m=int(input())
if(n==m):
    print("Yes\n")
else:
    print("No\n")
Problem p02791 (python)

Fixed submission:
from sys import stdin

def main():
    n = int(stdin.readline().strip())
    l = list(map(int,stdin.readline().split()))
    ar = [-1 for _ in range(n)]
    ar[0] = l[0]
    ans = 1
    for i in range(1,n):
        if(l[i] <= ar[i-1]):
            ans+=1
            ar[i] = l[i]
        else:
            ar[i] = ar[i-1]
    print(ans)
        
main()

Buggy submission (verdict: Runtime Error):
a= int(input())
b= input().split()
compare=b[0]
c=0

for i in range(a):
    if (compare>=int(b[i])):
        compare=int(b[i])
        c=c+1
        
print(c)
Problem p02812 (python)

Fixed submission:
x=int(input())
arr=input()
print(arr.count('ABC'))

Buggy submission (verdict: Runtime Error):

//HOLA MIM MI KLSJLFKJSLJFJSLDFSKJDFLK
input();s = input();print(s.count("ABC"))
Problem p02817 (python)

Fixed submission:
str1 , str2 = input().split(" ")
str3 = str2+str1
print(str3)

Buggy submission (verdict: Runtime Error):
def stringconcant(S,T):
    a = S
    b = T
    c = a+b
    return c

S= input()
T= input()
a = stringconcant(S,T)
print(a)

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

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    S = input()
    T = input()
    print(T+S)
Problem p02899 (python)

Fixed submission:
n = int(input())

enter = list(map(int, input().split()))

new_list = []

for i in range(1, n+1):
    new_list.append([enter[i-1], i])

new_list.sort()

for i in range(n):
    print(new_list[i][1], end = " ")

Buggy submission (verdict: Runtime Error):
int main()
    {
        int a[100000]={0},i;
        int n,t;
        scanf("%d",&n);
        for(i=1;i<=n;i++)
        {
            scanf("%d",&t);
            a[t]=i;
        }
        
        for(i=1;i<=n;i++)
        printf("%d ",a[i]);

Buggy submission (verdict: Runtime Error):
n=int(input())
l = [0]*100000
for i in range(1,n+1):
    num=int(input())
    l[num]=i
for i in range(1,n+1):
    print(l[i])
Problem p02900 (python)

Fixed submission:
def primes(n):
    i = 2
    prime = []
    while i**2<= n:
        if n % i:
            i += 1
        else:
            n =n//i
            prime.append(i)
    if n > 1:
        prime.append(n)
    return prime
a,b=map(int,input().split())
pa=set(primes(a))
pb=set(primes(b))
inte=pa.intersection(pb)
print(len(inte)+1)

Buggy submission (verdict: Runtime Error):
def gcd(a, b): 
      
    # Everything divides 0  
    if (a == 0 or b == 0): 
            False
      
    # base case 
    if (a == b): 
        return a 
  
    # a is greater 
    if (a > b): 
        return gcd(a-b, b) 
          
    return gcd(a, b-a) 

a=int(input())
b=int(input())
l=[]
count=0
if a>b:
    for i in range(2,a):
        if a%i==0 and b%i==0:
            l.append(i)
for i in range(len(l)):
    for j in range(i,len(l)):
        if gcd(i,j)==1:
            count+=1
print(count)

Buggy submission (verdict: Runtime Error):
def primes(n):
    prime = [1]*(n+1)
    p=2
    while p*p <= n+1:
        if(prime[p]==True):
            i=p*p
            while i <= n+1:
                prime[i]=0
                i+=p
        p+=1
    return prime
    
def g(a,b):
    if(b==0):
        return a
    else:
        return g(b,a%b)
        
n,m = map(int,input().split())
if(n<=m):
    a=n
    b=m
else:
    a=m
    b=n
if a==1:
    print(a)
else:
    gcd = g(b,a)
    l =[]
    for i in range(1,gcd):
        if(n%i==0 and m%i==0):
            l.append(i)
    p = primes(gcd)
    count=0
    for i in range(len(l)):
        if(p[l[i]]==1):
            count+=1
    print(count)

Buggy submission (verdict: Runtime Error):
def odd():
    n = 1
    while True:
        n = n + 2
        yield n


def divisible(n):
    return lambda x: x % n > 0


def primes():
    yield 2
    it = odd()
    while True:
        n = next(it)
        yield n
        it = filter(divisible(n), it)


count = 1
a, b = input().split(" ", 1)
a, b = int(a), int(b)
for x in primes():
    flag1 = 0
    flag2 = 0
    if x > a or x > b:
        break
    while a % x == 0:
        a /= x
        flag1 = 1
    while b % x == 0:
        b /= x
        flag2 = 1
    if flag1 == 1 and flag2 == 1:
        count += 1
print(count)
Problem p02923 (python)

Fixed submission:
import sys

n = int(input())
a = []
b = input().split(" ")
for i in range(n):
	a.append(int(b[i]))

if n == 1:
	print(0)
	sys.exit()

mx = 0
cnt = 0
for i in range(n-2, -1, -1):
	if a[i] >= a[i+1]:
		cnt += 1
		mx = max(mx, cnt)
	else:
		cnt = 0

print(mx)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = []

for i in range(n):
	h.append(int(input()))

count = 0
count_list = [0]

for i in range(n-1):
	if(h[i+1] <= h[i]):
		count += 1
		count_list.append(count)
	else:
		count = 0

print(max(count_list))

Buggy submission (verdict: Runtime Error):
n=input()
a=[]
m=[]

for i in range(n):
    a.append(input())
for i in range(n):
    c=0
    for j in range(n):
        if(a[i]>a[j]):
            c+=1
        else:
            break
    m.append(c)

print(max(m))

Buggy submission (verdict: Runtime Error):
import sys
sys.stdin=open("1.txt","r")
n=int(input())
a=input().split()
num=0
while n>0:
    if int(a[n-1])<=int(a[n-2]):
        num+=1
        n-=1
    else:
        break
print(num)
Problem p02945 (python)

Fixed submission:
l=input().split()
a=int(l[0])
b=int(l[1])

sum=a+b
sub=a-b
multi=a*b
if ((sum>=sub)and(sum>=multi)):
    print(sum)
elif((sub>sum)and(sub>multi)):
    print(sub)
else:
    print(multi)

Buggy submission (verdict: Runtime Error):
if B<=0:
    if A+B<=A*B:
        print(A*B);
    else:
        print(A+B);
else:
    if A-B<=A*B:
        print(A*B);
    else:
        print(A-B);
Problem p02995 (python)

Fixed submission:
A, B, C, D, = input().split()
A, B, C, D, = int(A), int(B), int(C), int(D)
def lcm(a,b):
    m = a*b
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return m // (a+b)
for_D_start = B // D
for_C_start = B // C
sum_start = for_C_start + for_D_start - B // lcm(C,D)
for_C_A = (A-1) // C
for_D_A = (A-1) // D
sum_A = for_C_A + for_D_A - (A-1) // lcm(C,D)
print(B - A + 1 - (sum_start - sum_A))
#print(for_D_A, for_C_A, for_D_start, for_C_start, sum_A, sum_start)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
dc1=0;dd1=0;dl1=0;dt=0
lcm=(c*d)/math.gcd(c,d)
dc1=int(b/c)-int((a-1)/c)
dd1=int(b/d)-int((a-1)/d)
dl1=int(b/lcm)-int((a-1)/lcm)
dt=dc1+dd1-dl1
print(b-a+1-dt)
Problem p03000 (python)

Fixed submission:
n, m = map(int, input().split())
l = [int(x) for x in input().split()]
answ = 1
h = 0
for k in l:
  h += k
  if h > m:
    break
  else:
    answ += 1
print(answ)

Buggy submission (verdict: Runtime Error):
def function(N, L, X):
    D = [0]
    for i in range(1, N+2):
        D.append(D[i-1]+L[i-1])
        if D[-1] > X:
            return i

line = input()
N, X = [int(n) for n in line.split()]
line = input()
L = [int(n) for n in line.split()]
print(function(N, L, X))

Buggy submission (verdict: Runtime Error):
n,x=input().split()
L = list(input().split())
d = 0
i = 0
while d <= int(x) and i<int(n):
    d+=int(L[i])
    i+=1
if d > x:
    print(i)
else:
    print(i+1)
Problem p03001 (python)

Fixed submission:
w,h,x,y = list(map(int, input().split()))

if((x == w/2 and y == h/2)):
  print((w*h)/2 , 1)
else:
  print((w*h)/2, 0)

Buggy submission (verdict: Runtime Error):
coordinates = list(map(int, input().split()))
w = coordinates[0]
h = coordinates[1]
x = coordinates[2]
y = coordinates[3]
if x == w and y == h:
    x = y = 0
prod1 = x * h
prod2 = y * w
area = min(prod1, prod2)
area = format(area, '.6f') if area != 0 else 0
addit = 0 if prod1 != prod2  else 1
print(f"{area} {addit}")

Buggy submission (verdict: Runtime Error):
coordinates = list(map(int, input().split()))
w = coordinates[0]
h = coordinates[1]
x = coordinates[2]
y = coordinates[3]
prod1 = x * h
prod2 = y * w
if x == w and y == h:
    prod1 = prod2 = (w * h) / 2
area = min(prod1, prod2)
area = format(area, '.6f')
addit = 0 if prod1 != prod2 else 1
print(f"{area} {addit}")
Problem p03035 (python)

Fixed submission:
a, b = map(int, input().split())
if a >= 13:
    print(b)
elif a >= 6 and a <= 12:
    print(int(b /2))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
age = int(input())
price = int(input())
if age >= 13:
    print(age, price)
elif 6 <= age <= 12:
    print(price // 2)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
age = int(input())
yen = int(input())
if 0 <= age <= 5:
    print(0)
if 6 <= age <= 12:
    print(yen//2)
if 16 <= age <= 100:
    print(yen)

Buggy submission (verdict: Runtime Error):
age = int(input("enter age"))
yen = int(input("enter cost"))
if 0 <= age <= 5:
    print(0)
    print("Takahashi is",age, "years old, and he can ride the Ferris wheel for free.")
if 6 <= age <= 12:
    print(yen//2)
    print("Takahashi is", age, "years old, and the cost of the Ferris wheel is the half of", yen, "yen, that is,", yen//2, "yen.")
if 16 <= age <= 100:
    print(yen)
    print("Takahashi is", age, "years old now, and the cost of the Ferris wheel is", yen, "yen.")
Problem p03106 (python)

Fixed submission:
li=[int(i) for i in input().split()]
a=li[0]
b=li[1]
k=li[2]
c=[]
for i in range(1,min(a,b)+1):
    if(a%i==0 and b%i==0):
        c+=[i]

print(c[-k])

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
divisores = []
for i in range(min(a,b), 1, -1):
    if len(divisores) == c:
        break
    elif a % i == 0 and b % i == 0:
        divisores.append(i)
print(divisores[c-1])

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
divisores = []
for i in range(min(a,b), 1, -1):
    if len(divisores) == c:
        break
    if a % i == 0 and b % i == 0:
        divisores.append(i)
print(divisores[c-1])

Buggy submission (verdict: Runtime Error):
line = input()
A,B,K = [int(n) for n in line.split()]
C = max(A,B)
u = [n for n in range(1,C//2+1) if A/n in range(1,C//2+1) and B/n in range(1,C//2+1)]
u.insert(0,1)
print(u[K-1])

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
divisores = [1]
    
for i in range(2, min(a,b) + 1):
    if a % i == 0 and b % i == 0:
        divisores.append(i)
print(divisores[-4])

Buggy submission (verdict: Runtime Error):
xyz=input().split()
a=int(xyz[0])
b=int(xyz[1])
c=int(xyz[2])
s=[]
d=[]

for i in range(1,max(a,b)):
  if a%i==0 and b%i==0:
    s.append(i)
s.sort()
print(s[-c])
Problem p03161 (python)

Fixed submission:
from sys import stdin
n, k = [int(i) for i in stdin.readline().split(' ')]
h = [int(i) for i in stdin.readline().split(' ')]

minCosts = [0, abs(h[1]-h[0])]
for i in range(2, len(h)):
    minCosts.append(min([abs(h[i]-h[i-j])+minCosts[i-j] for j in range(1, min(i, k)+1)]))

print(minCosts[-1])

Buggy submission (verdict: Runtime Error):
import math

class Input():
	def readInt(self):
		return int(input())

	def readIntArray(self):
		return [int(x) for x in input().split(" ")]

	def readString(self):
		return input()

	def readStringArray(self):
		return input().split(" ")

	def readFloat(self):
		return float(input())

	def readFloatArray(self):
		return [float(x) for x in input().split(" ")]

def main():
	inp = Input()
	n, k = inp.readIntArray()
	height = inp.readIntArray()

	# cost = [1000000002 for i in range(n)]
	# cost[0] = 0

	# for i in range(n):
	# 	for j in range(1, k+1):
	# 		if (i + j) < n:
	# 			cost[i+j] = min(cost[i+j], cost[i] + abs(height[i+j] - height[i]))

	cost = [-1 for i in range(n)]

	def findAns(i):

		if i == 0:
			return 0

		if cost[i] != -1:
			return cost[i]

		start = max(0, i-k)
		ans = 1000000002
		for j in range(start, i):
			ans = min(ans, findAns(j)+abs(height[i] - height[j]))

		cost[i] = ans
		return ans


	print(findAns(n-1))


	# print(cost[n-1])

if __name__ == "__main__":
   main()

Buggy submission (verdict: Runtime Error):
def woo(x, y):
    res = [0 for i in range(1, x)]
    z = list(map(int, input().split()))
    for i in range(1, x):
        res[i] = min(abs(z[i] - z[j]) + res[j] for j in range(max(0, i - y), i))
    return res

if __name__ == '__main__':
    x, y = map(int, input().split())
    r = woo(x, y)
    f = len(r)-1
    print(r[f])
Problem p03162 (python)

Fixed submission:
N = int(input())
vacation = []
for i in range(N):
    vacation.append(list(map(int, input().split())))

activities = 3
schedules = [[None for _ in range(activities)] for _ in range(N)]
schedules[0] = vacation[0]

for i in range(1, N):
    for j in range(activities):
        schedules[i][j] = max(schedules[i - 1][(j + 1) % 3], schedules[i - 1][(j + 2) % 3]) + vacation[i][j]

print(max(schedules[N - 1]))

Buggy submission (verdict: Runtime Error):
def funcion():
    n = int(input())
    indice_anterior = -1
    total = 0
    
    

    for i in range(n):
        mayor = 0
        cadena = input()
        lista = cadena.split()
        for j in lista:
            jnum = int(j)
            indice_actual = lista.index(j)
            if (jnum > mayor) and indice_actual != indice_anterior:
                mayor = jnum
        indice_anterior = lista.index(str(mayor))     
        total = total + mayor
    print(total)

def main():
    return(funcion())

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def funcion():
    n = int(input())
    m = []
    indice_anterior = -1
    total = 0

    for i in range(n):
        cadena = input()
        lista = cadena.split()
        m.append(lista)
    
    for i in range(n):
        mayor = 0
        for j in m[i]:
            jnum = int(j)
            indice_actual = m[i].index(j)
            if (jnum > mayor) and indice_actual != indice_anterior:
                mayor = jnum
        indice_anterior = m[i].index(str(mayor))     
        total = total + mayor
    
    print(total)
def main():
    return(funcion())

if __name__ == "__main__":
    main()
Problem p03165 (python)

Fixed submission:
def main():
    s1, s2 = input(), input()
    n, m = len(s1), len(s2)

    dp, previous = [], []
    for i in range(n + 1):
        dp.append([0] * (m + 1))
        previous.append([0] * (m + 1))

    for row in range(1, n + 1):
        for column in range(1, m + 1):
            if s1[row - 1] == s2[column - 1]:
                dp[row][column] = 1 + dp[row - 1][column - 1]
                previous[row][column] = (row - 1, column - 1)
            else:
                dpUp = dp[row - 1][column]
                dpLeft = dp[row][column - 1]

                if dpUp > dpLeft:
                    dp[row][column] = dpUp
                    previous[row][column] = (row - 1, column)
                else:
                    dp[row][column] = dpLeft
                    previous[row][column] = (row, column - 1)

    lcs = ''
    curr = (n, m)

    while True:
        row, column = curr
        if previous[row][column] == 0: break

        if s1[row - 1] == s2[column - 1]:
            lcs = f'{s1[row - 1]}{lcs}'

        curr = previous[row][column]

    print(lcs)

main()

Buggy submission (verdict: Runtime Error):
# Exercício 15.4-3 - Cormen 3 ed.

s = input()
t = input()
n = len(s) + 1
m = len(t) + 1
c = [[-1] * (m) for x in [-1] * (n)]

def lcsLengthMemoized(s, t, i, j):
    global c
    if c[i][j] != -1:
        return c[i][j]
    if i == 0 or j == 0:
        c[i][j] = 0
        return c[i][j]
    if s[i - 1] == t[j - 1]:
        c[i][j] = lcsLengthMemoized(s, t, i - 1, j - 1) + 1
        return c[i][j]
    c[i][j] = max([lcsLengthMemoized(s, t, i - 1, j), lcsLengthMemoized(s, t, i, j - 1)])
    return c[i][j]
    
def getLCS(c, s, t, i, j, lcs=""):
    if c[i][j] == 0:
        return lcs
    if s[i - 1] == t[j - 1]: # volta uma linha e uma coluna
        lcs += getLCS(c, s, t, i - 1, j - 1, lcs)
        lcs += s[i - 1]
        return lcs
    elif c[i - 1][j] > c[i][j - 1]: # volta uma linha na mesma coluna
        lcs += getLCS(c, s, t, i - 1, j, lcs)
    else: # volta uma coluna na mesma linha
        lcs += getLCS(c, s, t, i, j - 1, lcs)
    return lcs

r = lcsLengthMemoized(s, t, n - 1, m - 1)
print(getLCS(c, s, t, n - 1, m - 1))
Problem p03239 (python)

Fixed submission:
n, t = [int(x) for x in input().split()]
result = 1001
for i in range(n):
    a, b = [int(x) for x in input().split()]
    if b <= t and result >= a:
        result = a
if result < 1001:
    print(result)
else:
    print("TLE")

Buggy submission (verdict: Runtime Error):
A,B = (input().split())
A = int(A)
B = int(B)
roads = []
for i in range(A):
    a, b = input().split()
    a = int(a)
    if t in range(1, B + 1):
        roads.append((int(a), b))

if len(roads) == 0:
    print("TLE")
else:
    roads.sort()
    print(roads[0][0])

Buggy submission (verdict: Runtime Error):
N , T = map(int, input().split())
cost = []
error=[]
for i in range(0 , N ):
    x = [int(x) for x in input().split()]
for i in range (len(x)):
    if x[1]<=T :
        cost.append(x[i][0])
    if x[1] > T:
        error.append(x[i][1])
if len(error) == N :
    print("TLE")
else:
    print(min(cost))

Buggy submission (verdict: Runtime Error):
N,T=input().split()
a=0
b=0
for i in range(int(N)):
    c,t=input().split()
    if int(t)<=int(T):
        if b==0:
            a=c
            b+=1
        if int(c)<int (a):
            a=c
            i+=1
if a==0:
Problem p03261 (python)

Fixed submission:
n = int(input())
l= []
x = 0
for elt in range(n):
    inp = input()
    l.append(inp)
for elt in range(len(l)):
    if l.count(l[elt]) > 1 :
        print("No")
        x+=1
        break

    else:
        if elt < len(l)-1:
            if l[elt][-1] != l[elt+1][0]:
                print("No")
                x += 1
                break
if x == 0:
    print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
n = int (input())
words = []
for i in range (n) :
    words.append(input())
for x in range(len(words)):
    if words.count(words[x]) > 1 or words[x+1][0] != words[x][-1]:
        print("No")
        sys.exit()
    else:
        "Yes"
Problem p03264 (python)

Fixed submission:
k = int(input())
if k % 2 == 0:
    print((k // 2)**2)
else:
    print((k - (k // 2)) * (k // 2))

Buggy submission (verdict: Runtime Error):
def test():
    k = int(input())
    if (k%2==0):
        n = (k//2)**2
        print(n)
    else :
        n = ((k//2)**2)+(k//2)
        print(n)
 
 
pair()

Buggy submission (verdict: Runtime Error):
K=input()
Even=0
Odd=1
For x in range(2,k+1):
      if x%2==0
        Even+=1
      else:
             Odd+=1
print(Odd*Even)

Buggy submission (verdict: Runtime Error):
k=input()  
odd=1
even=0
for i in range(2,k+1): 
     if i%2==0:
        even+=1
     else:
           odd+=1
print(odd*even)

Buggy submission (verdict: Runtime Error):
k=input()
pair=0
for i in range(1,k+1):
     for j in range (2,k+1)
          if i%2==0 and j%2!=0:
              pair+=1
          if i%2!=0 and j%2==0 :
               pair+=1
          
print(pair)
Problem p03273 (python)

Fixed submission:
h, w = [int(n) for n in input().split()]
grid = [input() for _ in range(h)]
row_hashs = set()
column_hashs = set()

for i, row in enumerate(grid):
    for j, ch in enumerate(row):
        if ch == '#':
            row_hashs.add(i)
            column_hashs.add(j)

new_grid = []

for i, row in enumerate(grid):
    if i not in row_hashs:
        continue
    new_grid.append([])
    for j, ch in enumerate(row):
        if j not in column_hashs:
            continue
        new_grid[-1].append(ch)
    new_grid[-1] = "".join(new_grid[-1])

print("\n".join(new_grid))

Buggy submission (verdict: Runtime Error):
h, w = [int(n) for n in input().split()]
grid = [input() for _ in range(h)]
row_hashs = set()
column_hashs = set()

for i, row in enumerate(grid):
    for j, ch in enumerate(row):
        if ch == '#':
            row_hashs.add(i)
            column_hashs.add(j)

new_grid = []

for i, row in enumerate(grid):
    if i not in row_hashs:
        continue
    new_grid.append([])
    for j, ch in enumerate(row):
        if j not in column_hashs:
            continue
        new_grid[-1].append(ch)
    new_grid[-1] = "".join(new_grid[-1])


print("\n".join(new_grid))
# print(*new_grid, sep="\n")
Problem p03293 (python)

Fixed submission:
p=input()
q=input()
q=2*q
s=len(p)
u=0
l=len(q)
for i in range(l):
    if p==q[i:s+i]:
        print("Yes")
        u=1
        break
if u==0:
    print("No")

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

for _ in range(len(S)):
    if S == T:
        return True
    else:
        S = S[-1] + S[:-1]

return False