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

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

x = math.floor(a*n/b)-( a*math.floor(n/b))
y = math.floor(a*b/b)-( a*math.floor(b/b))
z = math.floor(a*(b-1)/b)-( a*math.floor((b-1)/b))

if b == 1:
    print(0)
elif n < b:
    print(x)
else:
    print(z)

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

x = math.floor(a*n/b)-( a*math.floor(n/b))
y = math.floor(a*b/b)-( a*math.floor(b/b))
z = math.floor(a*(b-1)/b)-( a*math.floor((b-1)/b))

if b == 1:
    print(0)
elif n < b:
    print(x)
else:
    print(z)

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

if b == 1:
    print(0)
elif n < b:
    print(math.floor(a*n/b)+math.floor(n/b))
else:
    print(math.floor(a*(b-1)/b)+math.floor((b-1)/b))
Problem p02900 (python)

Fixed submission:
def trial_division(n):
    a = []  
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2   
    if n != 1: a.append(n)

    return a

from fractions import gcd

A,B = map(int,input().split())

g = gcd(A,B)

L = trial_division(g)

D = {}

for i in L :
    if i not in D :
        D[i] = 1

print(len(D)+1)

Buggy submission (verdict: Runtime Error):
def trial_division(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f = f+2
    if n!= 1:  a.append(n)
    
    return a

import math
 
A,B = map(int,input().split())
 
g = math.gcd(A,B)
 
L = trial_division(g)
 
D = {}
 
for i in L :
    if i not in D :
        D[i] = 1
 
print(len(D)+1)

Buggy submission (verdict: Runtime Error):
def trial_division(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1: a.append(n)
        
    return a

import math
a,b = map(int,input().split())
g =math.gcd(a,b)

L = trial_division(g)

D = {}

#print(L)

for i in L:
    if i not in D:
        D[i] = 1
print(len(D)+1)

Buggy submission (verdict: Runtime Error):
def trial_division(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1: a.append(n)
        
    return a

import math
a,b = map(int,input().split())
g =math.gcd(a,b)

L = trial_division(g)

D = {}

print(L)

for i in L:
    if i not in D:
        D[i] = 1
print(len(D)+1)
Problem p02911 (python)

Fixed submission:
n,k,q = map(int,input().split())
a=[int(input()) for i in range(q)]

m = [k-q] * n
for i in range(q):
    m[a[i]-1] = m[a[i]-1] + 1
    
for j in range(n):
    if m[j] <= 0:
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
n,k,q = map(int,input().split())
a=[int(input()) for i in range(q)]

m = [k-len(a)] * n
for i in a:
    m[a[i]-1] = m[a[i]-1] + 1

for j in range(n):
    if m[j] <= 0:
        print("No")
    else:
        print("Yes")
Problem p02945 (python)

Fixed submission:
a,b=map(int,input().split())
X = int(a + b)
Y = int(a - b)
Z = int(a * b)
ans = [X,Y,Z]
print(max(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [''.join(sorted(input())) for _ in range(N)]
 
from collections import Counter
counter = Counter(s)
ans = sum(n*(n-1)//2 for n in counter.values())
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
X = int(a + b)
Y = int(a - b)
Z = int(a * b)
print(max[X,Y,Z])
Problem p02947 (python)

Fixed submission:
from collections import Counter
 
N = int(input())
 
ans = {}
answer = 0
for _ in range(N):
    s = "".join(sorted(input()))
 
    if s not in ans:
        ans[s] = 0
 
    else:
        ans[s] += 1
        answer += ans[s]
 
print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
S=list(input().split())
Slist = [0] * N
for i in range(N):
    Slist[i] = sorted(S[i])
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]
 
 if len(Slist) - len(get_unique_list(Slist)) == 0:
    print(0)
else:
    print(len(Slist) - len(get_unique_list(Slist)) + 1)

Buggy submission (verdict: Runtime Error):
Y = list(input())
N = len(Y)-1
S = [0] * N
S=list[1:N]
Slist = [0] * N
for i in range(N):
    Slist[i] = sorted(S[i])
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

if len(Slist) - len(get_unique_list(Slist)) == 0:
    print(0)
else:
    print(len(Slist) - len(get_unique_list(Slist)) + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S=list(input() for k in range(N)
Slist = [0] * N
for i in range(N):
    Slist[i] = sorted(S[i])
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

if len(Slist) - len(get_unique_list(Slist)) == 0:
    print(0)
else:
    print(len(Slist) - len(get_unique_list(Slist)) + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S=list(input().split())
Slist = [0] * N
for i in range(N):
    Slist[i] = sorted(S[i])
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

if len(Slist) - len(get_unique_list(Slist)) == 0:
    print(0)
else:
    print(len(Slist) - len(get_unique_list(Slist)) + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S=list(input().split())
Slist = [0] * N
for i in range(N):
    Slist[i] = sorted(S[i])
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]
print(len(Slist) - len(get_unique_list(Slist)) + 1)
Problem p03061 (python)

Fixed submission:
from fractions import gcd

n = int(input())
list_ = list(map(int, input().strip().split()))

gcd_from_left = [0]
gcd_from_right = [0]
for i in range(n):
    gcd_from_left.append(gcd(gcd_from_left[i], list_[i]))
    gcd_from_right.append(gcd(gcd_from_right[i], list_[-(i + 1)]))

gcd_from_left.insert(0, 0)
gcd_from_right.insert(0, 0)
gcd_from_right.reverse()

print(max(gcd(gcd_from_left[i], gcd_from_right[i]) for i in range(n + 2)))

Buggy submission (verdict: Runtime Error):
import math
from itertools import accumulate

n = int(input())
a = list(map(int,input().split()))

L = [0]+list(accumulate(a, math.gcd))
R = list(accumulate(reversed(a), math.gcd))[::-1]+[0]


ans = 0

for i in range(n):
    ans =max(math.gcd(L[i],R[i+1]),ans)

if n == 2:
    print(max(a))
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
import math
from itertools import accumulate

n = int(input())
a = list(map(int,input().split()))

L = [0]+list(accumulate(a, math.gcd))
R = list(accumulate(reversed(a), math.gcd))[::-1]+[0]

ans = 0

for i in range(n-1):
        ans = max(math.gcd(L[i],R[i+1]),ans)

print(L)
print(R)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from itertools import accumulate

n = int(input())
a = list(map(int,input().split()))

L = [0]+list(accumulate(a, math.gcd))
R = list(accumulate(reversed(a), math.gcd))[::-1]+[0]

ans = 0

for i in range(n):
        ans = max(math.gcd(L[i],R[i+1]),ans)


print(ans)

Buggy submission (verdict: Runtime Error):
import math
from itertools import accumulate

n = int(input())
a = list(map(int,input().split()))

L = list(accumulate(a, math.gcd))
R = list(accumulate(reversed(a), math.gcd)) 

ans = 0
if n == 2:
    print(max(a))
else:
    for i in range(1,n):
        ans = max(math.gcd(L[i],R[i]),ans)
        print(max(ans))

Buggy submission (verdict: Runtime Error):
import math
from itertools import accumulate

n = int(input())
a = list(map(int,input().split()))

L = list(accumulate(a, math.gcd))
R = list(accumulate(reversed(a), math.gcd)) 

ans = 0
for i in range(1,n):
    ans = max(math.gcd(L[i],R[i]),ans)
    
print(ans)
Problem p03796 (python)

Fixed submission:
import math
n=int(input())
print(math.factorial(n)%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
print((math.factoral(N))%(10**9 + 7))
Problem p04044 (python)

Fixed submission:
N,L = map(int,input().split())
S = sorted(list(input() for i in range(N)))
print(*S,sep="")

Buggy submission (verdict: Runtime Error):
N,L = map(int,input().split())
S = sorted(list(input() for i in range(N)))
print(*s,sep="")
Problem p02675 (python)

Fixed submission:
s=list(input())

num=int(s[-1])
if num==3:
  print("bon")
elif num==0 or num==1 or num==6 or num==8:
  print("pon")
else :
  print("hon")

Buggy submission (verdict: Runtime Error):
nums = list(map(int,input().split()))	
if nums[-1]==3:
  print("bon")
elif nums[-1]==0 or nums[-1]==1 or nums[-1]==6 or nums[-1]== :
  print("pon")
else :
  print("hon")
Problem p02677 (python)

Fixed submission:
import math

a, b, h, m = map(int, input().split())
h=h*60+m

ang=abs(h*0.5-m*6)
if ang > 180:
  ang = 360-ang
if ang==180:
  print(a+b)
elif(ang==0):
  print(abs(b-a))
else:
  ans=(a**2)+(b**2)-(2*a*b*math.cos(math.radians(ang)))
  print(math.sqrt(ans))

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

ang = abs(h * 30 + m * 0.5- m * 6)
print(ang)
if ang > 180:
  ang = 360-ang
if ang==180:
  print(a+b)
elif(ang==0):
  print(abs(b-a))
else:
  ans=(a**2)+(b**2)-(2*a*b*math.cos(math.radians(ang)))
  print(math.sqrt(ans))

Buggy submission (verdict: Runtime Error):
a = int(input()) #ch
b = int(input())  #ch
h = int(input())  #hour
m = int(input())  #minits

import math

angle = abs(h * 30 + m * 0.5- m * 6)

if angle > 180:
    angle = 360 - angle
if ang==180:
  print(a+b)
elif(ang==0):
  print(abs(b - a)):
else:
cos = math.cos(math.radians(angle))
ans = (a * a) + (b * b) - (2 * a * b * cos)
print(math.sqrt(ans))

Buggy submission (verdict: Runtime Error):
a = int(input()) #ch
b = int(input())  #ch
h = int(input())  #hour
m = int(input())  #minits

import math

ang = abs(h * 30 + m * 0.5- m * 6)

if angle > 180:
    angle = 360 - angle
if ang==180:
  print(a+b)
elif(ang==0):
  print(abs(b - a)):
else:
cos = math.cos(math.radians(angle))
ans = (a * a) + (b * b) - (2 * a * b * cos)
print(math.sqrt(ans))

Buggy submission (verdict: Runtime Error):
a = int(input()) #ch
b = int(input())  #ch
h = int(input())  #hour
m = int(input())  #minits

import math

angle = abs((30 * h + m * 0.5) - m*6)

if angle > 180:
    angle = 360 - angle
if ang==180:
  print(a+b)
elif(ang==0):
  print(abs(b - a)):
else:
cos = math.cos(math.radians(angle))
ans = (a * a) + (b * b) - (2 * a * b * cos)
print(math.sqrt(ans))

Buggy submission (verdict: Runtime Error):
a = int(input()) #ch
b = int(input())  #ch
h = int(input())  #hour
m = int(input())  #minits

import math

angle = abs((30 * h + m * 0.5) - m*6)

if angle > 180:
    angle = 360 - angle

cos = math.cos(math.radians(angle))
ans = (a * a) + (b * b) - (2 * a * b * cos)
print(math.sqrt(ans))

Buggy submission (verdict: Runtime Error):
a = int(input()) #ch
b = int(input())  #ch
h = int(input())  #hour
m = int(input())  #minits

import math

angle = abs((30 * h + m * 0.5) - m*6)

if angle > 180:
    angle = 360 - angle

cos = math.cos(math.radians(angle))
ans = (a * a) + (b * b) - (2 * a * b * cos)
print(math.sqrt(ans))

Buggy submission (verdict: Runtime Error):
a = int(input()) #ch
b = int(input())  #ch
h = int(input())  #hour
m = int(input())  #minits
import math


angle = abs((30 * h + m * 0.5) - m*6)

if angle > 180:
    angle = 360 - angle

cos = math.cos(math.radians(angle))
ans = (a * a) + (b * b) - (2 * a * b * cos)
print(math.sqrt(ans))

Buggy submission (verdict: Runtime Error):
a = int(input()) #ch
b = int(input())  #ch
h = int(input())  #hour
m = int(input())  #minits
import math

h_len = h * 30
m_len = m * 6

angle = h_len - m_len
if angle < 0:
    angle = angle * -1

if angle > 180:
    angle = 360 - angle

cos = math.cos(math.radians(angle))
# cos = math.cos(angle)
ans = a * a + b * b - 2 * a * b * cos
print(math.sqrt(ans))
Problem p02681 (python)

Fixed submission:
S = input()
T = input()

if (T[:-1] == S) and (len(S) + 1 == len(T)):
  print("Yes")
else:
  print("No")

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

if (T[:-1] == S) && ( len(S) = len(T) - 1):
  return "Yes"
else:
  return "No"
Problem p02778 (python)

Fixed submission:
s = input()
print("x"*len(s))

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(len(s)):
  s[i] = 'x'
print(s)
Problem p02830 (python)

Fixed submission:
n = int(input())
s, t = map(str, input().split())
a = ''
for i in range(n):
  a += s[i] + t[i]
print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
s, t = map(str, input().split())
a = []
for i in range(n):
  a = a.append(s[i])  
  a = a.append(t[i])  

print("".join(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
s, t = map(str, input().split())
for i in range(n):
  a = [].append(s[i])  
  a.append(t[i])
print("".join(a))
Problem p02705 (python)

Fixed submission:
# coding: utf-8
# Your code here!
import math
R = int(input())
en = 2 * math.pi * R
print(en)

Buggy submission (verdict: Runtime Error):
R = int(input())
en = 2 * R 3.14
print(en)
Problem p02830 (python)

Fixed submission:
# coding: utf-8
# Your code here!
count = int(input())
line = input().split()
n = line[0]
m = line[1]
lis = []
for i in range(len(n)):
    lis.append(n[i])
    lis.append(m[i])

for j in lis:
    print(j,end = "")

Buggy submission (verdict: Runtime Error):
count = int(input())
line = input().split()
n = line[0]
m = line[1]
lis = []
for i in range(2):
    lis.append(n[i])
    lis.append(m[i])

for j in lis:
    print(j,end = "")
Problem p02705 (python)

Fixed submission:
import math
r = int(input())
print(2 * math.pi * r)

Buggy submission (verdict: Runtime Error):
import math
r = int(input())
print(2 * math.pi r)
Problem p02719 (python)

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

t = N % K
ANS = min(t, K-t)
print(ANS)

Buggy submission (verdict: Runtime Error):
ans1 = abs(N - K)
cnt = 0
if N > ans1:
    while True:
        ans2 = abs(ans1 - K)
        if ans1 > ans2:
            ans1 = ans2
            cnt = 1
            cnt += 1
        else:
            ANS = ans1
            break
elif N <= ans1:
    ANS = N

# print(ans1, ans2)
print(ANS)
# print(cnt)
Problem p02782 (python)

Fixed submission:
MOD = 10**9+7
def inv_mod(a,p=MOD):
    def inv_mod_sub(a,p):
        if a == 1:
            return 1,0
        else:
            d,r = p//a,p%a
            x,y = inv_mod_sub(r,a)
            return y-d*x,x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n,k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD

def f(a,b):
  return comb_mod(a+b,b)

r1,c1,r2,c2 = map(int,input().split())
f_mod=[1]*(3*10**6)
f_mod_inverse=[1]*(3*10**6)
for i in range(1,3*10**6):
  f_mod[i]=f_mod[i-1]*i%MOD
  f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i)%MOD
print((f(r2+1,c2+1)-f(r1,c2+1)-f(r2+1,c1)+f(r1,c1))%MOD)

Buggy submission (verdict: Runtime Error):
MOD = 10**9+7
def inv_mod(a,p=MOD):
    def inv_mod_sub(a,p):
        if a == 1:
            return 1,0
        else:
            d,r = p//a,p%a
            x,y = inv_mod_sub(r,a)
            return y-d*x,x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n,k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD

def f(a,b):
  return comb_mod(a+b,b)

r1,c1,r2,c2 = map(int,input().split())
f_mod=[1]*(2*10**6)
f_mod_inverse=[1]*(2*10**6)
for i in range(1,2*10**6):
  f_mod[i]=f_mod[i-1]*i%MOD
  f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i)%MOD
print((f(r2+1,c2+1)-f(r1,c2+1)-f(r2+1,c1)+f(r1,c1))%MOD)

Buggy submission (verdict: Runtime Error):
MOD = 10**9+7
def inv_mod(a,p=MOD):
    def inv_mod_sub(a,p):
        if a == 1:
            return 1,0
        else:
            d,r = p//a,p%a
            x,y = inv_mod_sub(r,a)
            return y-d*x,x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n,k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD

def f(a,b):
  return comb_mod(a+b,b)

r1,c1,r2,c2 = map(int,input().split())
f_mod=[1]*(2*10**6)
f_mod_inverse=[1]*(2*10**6)
for i in range(1,10**6):
  f_mod[i]=f_mod[i-1]*i%MOD
  f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i)%MOD
print((f(r2+1,c2+1)-f(r1,c2+1)-f(r2+1,c1)+f(r1,c1))%MOD)

Buggy submission (verdict: Runtime Error):
MOD = 10**9+7
def inv_mod(a,p=MOD):
    def inv_mod_sub(a,p):
        if a == 1:
            return 1,0
        else:
            d,r = p//a,p%a
            x,y = inv_mod_sub(r,a)
            return y-d*x,x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n,k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD

def f(a,b):
  return comb_mod(a+b,b)

r1,c1,r2,c2 = map(int,input().split())
f_mod=[1]*(10**6)
f_mod_inverse=[1]*(10**6)
for i in range(1,10**6):
  f_mod[i]=f_mod[i-1]*i%MOD
  f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i)%MOD
print((f(r2+1,c2+1)-f(r1,c2+1)-f(r2+1,c1)+f(r1,c1))%MOD)
Problem p02845 (python)

Fixed submission:
n = int(input())
c = [-1,-1,-1]
a = 1
for i in map(int,input().split()):
  co = c.count(i-1)
  if co == 0:
    print(0)
    exit()
  a = a * co % 1000000007
  c[c.index(i-1)] = i
print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
c = [-1,-1,-1]
a = 1
for i in map(int,input().split()):
  a = a * c.count(i-1) % 1000000007
  c[c.index(i-1)] = i
print(a)
Problem p02971 (python)

Fixed submission:
from collections import defaultdict
d = defaultdict(int)
n, *a = map(int,open(0))
for i in a:
  d[i] += 1
l = list(d.keys())
l.sort()
m = l[-1]
if d[m] == 1:
  i = a.index(m)
  [print(m) for j in range(i)]
  print(l[-2])
  [print(m) for j in range(n-i-1)]
else:
  [print(m) for i in range(n)]

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
d = defaultdict(int)
n, *a = map(int,open(0))
for i in a:
  d[i] += 1
l = list(d.key())
l.sort()
m = l[-1]
if d[m] == 1:
  i = a.index(m)
  [print(m) for j in range(i)]
  print(l[-2])
  [print(m) for j in range(n-i-1)]
else:
  [print(m) for i in range(n)]
Problem p03069 (python)

Fixed submission:
n = int(input())
s = input()
k = 0
si = s.count('.')
m = si
for i in s:
  if i == '#':
    k += 1
  else:
    si -= 1
  m = min(m,k+si)
print(m)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
s_list=list(s)
c=0
if s_list[0] == "#" and s_list[1] == ".":
  c += 1
  s_list[0] = "."
for a in range(n-2):
  if s_list[a+1] == "#" and s_list[a+2] ==  ".":
                     c += 1
                     s_list[a+2] = "#"
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
s_list=list(s)
c=0
for a in range(n-1):
  if s_list[a]s_list[a+1} ==  #.:
                     c += 1
                     s_list[a+1] =#
print(c)
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(2*a-1,a+b,2*b-1))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(2*a-1,a+b,2*b-1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(2a-1,a+b,2b-1)
Problem p03087 (python)

Fixed submission:
n,q=map(int,input().split())
s=list(input())
a=[0]*n
for i in range(n-1):
  if s[i]=="A" and s[i+1]=="C":
    a[i+1]=a[i]+1
  else:
    a[i+1]=a[i]
for i in range(q):
  l,r=map(int,input().split())
  print(a[r-1]-a[l-1])

Buggy submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
s_c = [0]*(n+1)
c = 0
for k in range(n):
  if s[k] == 'A' and s[k+1] == 'C':
    c += 1
  s_c[k+1] = c
for i in range(q):
  l,r = map(int,input().split())
  print(s_c[r-1]-s_c[l-1])
Problem p03146 (python)

Fixed submission:
def f(i):
  if i%2==0:
    return i//2
  else:
    return i*3+1

a=[]
a.append(int(input()))
i=1
while True:
  b=f(a[-1])
  i+=1
  if b in a:
    print(i)
    break
  a.append(b)

Buggy submission (verdict: Runtime Error):
def f(i):
  if i%2==0:
    return i//2
  else:
    return i*3+1

a=int(input())
i=1
while True:
  b=f(a[-1])
  i+=1
  if b in a:
    print(i)
    break
  a.append(b)
Problem p03220 (python)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
m=100000
ans=0
for i in range(n):
  if abs((t-h[i]*0.006)-a) < m:
    m=abs((t-h[i]*0.006)-a)
    ans=i+1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
m=a
ans=0
for i in n:
  if abs((t-h[i]*0.006)-a) < m:
    m=abs((t-h[i]*0.006)-a)
    ans=i+1
print(ans)
Problem p03240 (python)

Fixed submission:
n = int(input())
z = [0] * n
for i in range(n):
  x,y,h = map(int,input().split())
  if h != 0:
    k = [x,y,h]
  z[i] = [x,y,h]
for i in range(101):
  for j in range(101):
    H = k[2] + abs(k[0]-i) + abs(k[1]-j)
    for l in z:
      if l[2] != max(H-abs(l[0]-i)-abs(l[1]-j),0):
        break
      if l == z[-1]:
        print(i,j,H)
        exit()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
a = [tuple(map(int,input().split())) for _ in range(n)]
for _ in range(n):
  if a[_][2] > 1:
    flag = _
    break
c = 0
for _ in range(101): #x
  for i in range(101): #y
    h = a[flag][2] + abs(a[flag][0]-_) + abs(a[flag][1]-i)
    for j in range(n):
      b = 0
      if a[j][2] != max(h - abs(a[j][0]-_) - abs(a[j][1]-i),0):
        b = 1
        break
      if j == n-1:
        print(_,i,h)
        c = 1
        break
    if c == 1:
      break
  if c == 1:
    break
Problem p03261 (python)

Fixed submission:
n=int(input())
a=[input()]
for i in range(n-1):
  aa=input()
  if aa in a or aa[0] != a[-1][-1]:
    print("No")
    break
  if i == n-2:
    print("Yes")
  a.append(aa)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
  aa=input()
  if aa in a or aa[0] != a[-1][0]:
    print("No")
    break
  if i == n-1:
    print("Yes")
  a.append(aa)
Problem p03273 (python)

Fixed submission:
h,w=map(int,input().split())
a=[]
for i in range(h):
  aa=list(input())
  if "#" not in aa:
    continue
  else:
    a.append(aa)
aa=[]
for i in range(w):
  c=0
  for j in range(len(a)):
    if a[j][i]=="#":
      c+=1
  if c==0:
    aa.append(i)
aa.reverse()
for i in aa:
  for j in range(len(a)):
    del a[j][i]
for i in range(len(a)):
  print("".join(a[i]))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[]
for i in range(h):
  aa=list(input())
  if "#" not in aa:
    continue
  else:
    a.append(aa)
for i in range(w):
  c=0
  for j in range(len(a)):
    if a[j][i]=="#":
      c+=1
  if c==0:
    for j in range(len(a)):
      del a[j][i]
for i in range(len(a)):
  print("".join(a[i]))
Problem p03281 (python)

Fixed submission:
n=int(input())
c=0
for i in range(1,n+1,2):
  count=0
  for j in range(1,i+1):
    if i%j==0:
      count+=1
  if count==8:
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
c=0
for i in range(1,n+1,2):
  count=0
  for j in range(1,i**0.5):
    if i%j==0:
      count+=1
  if count==8:
    c+=1
print(c)
Problem p03293 (python)

Fixed submission:
s = input()
t = input()
c = 1
for i in range(len(s)):
  s = s[-1] + s[:-1]
  if s == t:
    c = 0
print('YNeos'[c::2])

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
c = 1
for i in range(len(s)):
  s = s[-1] + s[:-1]
  if s = t:
    c = 0
print('YNeos'[c::2])
Problem p03403 (python)

Fixed submission:
n = int(input())
ai = list(map(int,input().split()))
a = [0]
for i in ai:
  a.append(i)
al = [0] * (n+1)
for i in range(n+1):
  al[i] = abs(a[(i+1)%(n+1)] - a[i])
s = sum(al)
for i in range(1,n+1):
  print(s-al[i-1]-al[i]+abs(a[(i+1)%(n+1)]-a[i-1]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
al = [0] * n
for i in range(n):
  al[i] = abs(a[i+1] - a[i])
s = sum(al)
for i in range(n):
  print(s-al[i-1]-al[i]+abs(a[i+1]-a[i-1]))