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

Fixed submission:
"""everything has a cost!"""

from math import *
import random, functools, collections, sys

__author__ = 'p7x'


# sys.stdin = open('in.txt', 'r')
# sys.stdout = open('out.txt', 'w')
# sys.stderr = open('err.txt', 'w')


if __name__ == '__main__':
    n = int(input())
    print(n + n**2 + n**3)

Buggy submission (verdict: Runtime Error):
"""everything has a cost!"""

from math import *
import random, functools, collections, sys

__author__ = 'p7x'


# sys.stdin = open('in.txt', 'r')
# sys.stdout = open('out.txt', 'w')
# sys.stderr = open('err.txt', 'w')


if __name__ == '__main__':
    n = int(input())
    print(a + a**2 + a**3)
Problem p03339 (python)

Fixed submission:
N = int(input())
S = input()
int_s = [0] * N
cum_sum_w = [0] * (N + 1)
cum_sum_e = [0] * (N + 1)
answers = [0] * N
for i in range(N):
    if (S[i] == 'W'):
        int_s[i] = 1
    else:
        int_s[i] = 0
    cum_sum_w[i + 1] = cum_sum_w[i] + int_s[i]
for i in range(N):
    if (S[i] == 'E'):
        int_s[i] = 1
    else:
        int_s[i] = 0
    cum_sum_e[i + 1] = cum_sum_e[i] + int_s[i]
for i in range(N):
    answers[i] = cum_sum_w[i] + (cum_sum_e[N] - cum_sum_e[i + 1])
print(min(answers))

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> count_e(n, 0);
    vector<int> count_e_sum(n + 1, 0);
    vector<int> count_w(n, 0);
    vector<int> count_w_sum(n + 1, 0);

    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'E')
        {
            count_e[i]++;
        }
        else if (s[i] == 'W')
        {
            count_w[i]++;
        }
        count_e_sum[i + 1] = count_e_sum[i] + count_e[i];
        count_w_sum[i + 1] = count_w_sum[i] + count_w[i];
    }

    vector<int> ans(n);
    for (int i = 0; i < n; i++)
    {
        ans[i] = count_w_sum[i] + count_e_sum[n] - count_e_sum[i + 1];
    }

    int answer = *min_element(begin(ans), end(ans));

    cout << answer;
}

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> count_e(n, 0);
    vector<int> count_e_sum(n + 1, 0);
    vector<int> count_w(n, 0);
    vector<int> count_w_sum(n + 1, 0);

    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'E')
        {
            count_e[i]++;
        }
        else if (s[i] == 'W')
        {
            count_w[i]++;
        }
        count_e_sum[i + 1] = count_e_sum[i] + count_e[i];
        count_w_sum[i + 1] = count_w_sum[i] + count_w[i];
    }

    vector<int> ans(n);
    for (int i = 0; i < n; i++)
    {
        ans[i] = count_w_sum[i] + count_e_sum[n] - count_e_sum[i + 1];
    }

    int answer = *min_element(begin(ans), end(ans));

    cout << answer;
}
Problem p02658 (python)

Fixed submission:
n = int(input())
apple = list(map(int, input().split()))
if 0 in apple:
    print(0)
else:
    cat = 1
    for i in apple:
        cat *= i
        if cat > 10**18:
            break
        else:
            pass
    print(cat if cat <= 10**18 else -1)

Buggy submission (verdict: Runtime Error):
n = int(input())
apple = eval(input().replace(" ", "*"))
print(apple if apple <= 10**18 else -1)
Problem p02953 (python)

Fixed submission:
n = int(input())
apple = list(map(int, input().split()))
apple.reverse()
count = 0
for i in range(n - 1):
    if apple[i] >= apple[i + 1]:
        pass
    elif apple[i] + 1 == apple[i + 1]:
        apple[i + 1] = apple[i + 1] - 1
    else:
        count = 1
        break
print("Yes" if count == 0 else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
apple = list(map(int, input().split()))
cat = []
count = 0
for i in range(n - 1):
    if apple[i] <= apple[i + 1]:
        cat.append(apple[i])
    else:
        cat.append(apple[i] - 1)
if cat[-1] >= apple[-1] + 1:
    cat.append(-2)
else:
    cat.append(apple[-1] + 1)
for i in range(n - 1):
    if cat[i] <= cat[i + 1]:
        pass
    else:
        count = 1
        break    
print("Yes" if count == 0 else "No")
Problem p02995 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
from fractions import gcd
xc = (a-1)//c
yc = b//c
xd = (a-1)//d
yd = b//d    
xcd = (a - 1) // ((c * d) // gcd(c, d))
ycd = b // ((c * d) // gcd(c, d))

print(b - a + 1 -((yc - xc) + (yd - xd) - (ycd - xcd)))

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
import math
xc = (a-1)//c
yc = b//c
xd = (a-1)//d
yd = b//d    
xcd = (a - 1) // (c * d // math.gcd(c, d))
ycd = b // (c * d // math.gcd(c, d))

print(b - a + 1 -((yc - xc) + (yd - xd) - (ycd - xcd)))

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
import math
xc = (a-1)//c
yc = b//c
xd = (a-1)//d
yd = b//d    
xcd = (a - 1) // (c * d // math.gcd(c, d))
ycd = b // (c * d // math.gcd(c, d))

print(b - a + 1 -((yc - xc) + (yd - xd) - (ycd - xcd)))
Problem p03243 (python)

Fixed submission:
n = int(input())
apple = []

number = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in number:
    if i - n >= 0:
        apple.append(i)

print(min(apple))

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

number = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in number:
    if i - n > 0:
        apple.append(i)
    else:
        pass

print(min(apple))
Problem p03605 (python)

Fixed submission:
n = str(input())
print("Yes" if "9" in n else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
apple = []
for _ in range(n):
    a = str(input())
    if a not in apple:
        apple.append(a)
    else:
        apple.remove(a)
print(len(apple))

Buggy submission (verdict: Runtime Error):
n = int(input())
apple = []
for _ in range(n):
    a = int(input())
    if a not in apple:
        apple.append(a)
    else:
        apple.remove(a)
print(len(apple))

Buggy submission (verdict: Runtime Error):
n = int(input())
apple = []
for _ in range(n):
    a = int(input())
    if a not in apple:
        apple.append(a)
    else:
        apple.remove(a)
print(len(apple))
Problem p02743 (python)

Fixed submission:
a, b, c = map(int, input().split())
if c-a-b < 0:
  print('No')
elif (c-a-b)**2 > 4*a*b:
  print('Yes')
else:
  print('No')

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

import math
if math.log((c-a-b)/2) - math.log(a*b)/2 > 0:
    print('Yes')
else:
    print('No')
Problem p02616 (python)

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

b = [(abs(i), 1 if i >= 0 else -1) for i in a]

b = sorted(b)
b = list(reversed(b))
mod = int(1e9 + 7)

def fp(x,y):
	res=1
	while y > 0:
		if y % 2 == 1:
			res *= x
		x *= x
		y //= 2
		x %= mod
		res %= mod
	return res

def inv(x):
	return fp(x,mod-2)

p = 1
signe = 1
for i in range(k):
	p *= b[i][0]
	p %= mod
	if b[i][0] == 0:
		signe = 0
	signe *= b[i][1]

if signe >= 0:
	print(p % mod)
else:
	# choice between replacing the last positive by the next negative
	# and replacing the last negative by the next positive
	lastP, nextP, lastN, nextN = -1, -1, -1, -1
	for i in range(k):
		if b[i][0] * b[i][1] >= 0:
			lastP = i
		if b[i][0] * b[i][1] <= 0:
			lastN = i
	for i in range(k, n):
		if b[i][0] * b[i][1] >= 0 and nextP==-1:
			nextP = i
		if b[i][0] * b[i][1] <= 0 and nextN==-1:
			nextN = i
	if (lastP!=-1 and nextN !=-1) and (lastN!=-1 and nextP!=-1):
		if b[nextN][0] * b[lastN][0] >= b[nextP][0] * b[lastP][0]:
			ans = p * inv(b[lastP][0]) * b[nextN][0]
			ans %= mod
			print(ans)
		else:
			ans = p * inv(b[lastN][0]) * b[nextP][0]
			ans %= mod
			print(ans)
	elif lastP!=-1 and nextN!=-1:
		ans = p * inv(b[lastP][0]) * b[nextN][0]
		ans %= mod
		print(ans)
	elif lastN!=-1 and nextP!=-1:
		ans = p * inv(b[lastN][0]) * b[nextP][0]
		ans %= mod
		print(ans)
	else:
		# tout le monde est negatif
		a = list(reversed(sorted(a)))
		p = 1
		for i in range(k):
			p *= a[i]
			p %= mod
		print(p)

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

b = [(abs(i), 1 if i >= 0 else -1) for i in a]

b = sorted(b)
b = list(reversed(b))

p = 1
for i in range(k):
	p *= b[i][0] * b[i][1]

mod = int(1e9 + 7)

if p >= 0:
	print(p % mod)
else:
	# choice between replacing the last positive by the next negative
	# and replacing the last negative by the next positive
	lastP, nextP, lastN, nextN = -1, -1, -1, -1
	for i in range(k):
		if b[i][0] * b[i][1] >= 0:
			lastP = i
		if b[i][0] * b[i][1] <= 0:
			lastN = i
	for i in range(k, n):
		if b[i][0] * b[i][1] >= 0:
			nextP = i
		if b[i][0] * b[i][1] <= 0:
			nextN = i
	ans = -1e50
	if lastP != -1 and nextN != -1:
		ans = max(ans, -(p // b[lastP][0]) * b[nextN][0])
	if lastN != -1 and nextP != -1:
		ans = max(Ans, -(p // b[lastN][0]) * b[nextP][0])
	
	if ans >= 0:
		print(ans % mod)
	else:
		# tout le monde est negatif
		a = list(reversed(sorted(a)))
		p = 1
		for i in range(k):
			p *= a[i]
		print(p % mod)
Problem p02645 (python)

Fixed submission:
name = input()
print(name[0:3])

Buggy submission (verdict: Runtime Error):
ax, at = map(int, input().split(' '))
bx, bt = map(int, input().split(' '))
t = int(input())
 
a_l = ax + at*t
b_l = bx + bt*t
 
if a_l < b_l and at == bt:
	print("NO")
else:
	print("YES")

Buggy submission (verdict: Runtime Error):
ax, a = map(int, input().split(' '))
bx, b = map(int, input().split(' '))
t = int(input())
 
a_l = ax + a*t
b_l = bx + b*t
 
if a_l < b_l and a == b:
	print("NO")
else:
	print("YES")

Buggy submission (verdict: Runtime Error):
ax, at = map(int, input().split(' '))
bx, bt = map(int, input().split(' '))
t = int(input())

a_l = ax + at*t
b_l = bx + bt*t

if a_l <= b_l:
	print("NO")
else:
	print("YES")

Buggy submission (verdict: Runtime Error):
import random

name = input()
n_len = len(name)
m = random.randrange(n_len-3)
print(name[m:m+3])
Problem p02646 (python)

Fixed submission:
x1, v1 = map(int, input().split(' '))
x2, v2 = map(int, input().split(' '))
t = int(input())

p = abs(x2 - x1)
q = (v1 - v2) * t
if p <= q:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
x1, v1 = map(int, input().split(' '))
x2, v2 = map(int, input().split(' '))
t = int(input())

if v1 == v2:
	print("NO")
else:
	s = abs(x2 - x1) / (v1 - v2)
	if s <= T:
		print("NO")
	else:
		print("YES")

Buggy submission (verdict: Runtime Error):
x1, v1 = map(int, input().split(' '))
x2, v2 = map(int, input().split(' '))
t = int(input())

if v1 == v2:
	print("NO")
else:
	s = abs(x2 - x1) / (v1 - v2)
	if s <= T:
		print("YES")
	else:
		print("NO")

Buggy submission (verdict: Runtime Error):
ax, at = map(int, input().split(' '))
bx, bt = map(int, input().split(' '))
t = int(input())
 
a_l = ax + at*t
b_l = bx + bt*t
 
if a_l < b_l and a == b:
	print("NO")
else:
	print("YES")
Problem p02658 (python)

Fixed submission:
n = input()
lines = input()
lines = [int(i) for i in lines.split(' ')]
sum = 1
if 0 in lines:
	print(0)
else:
	for i in lines:
		sum = sum * i
		if sum > 10**18:
			sum = -1
			break
	print(sum)

Buggy submission (verdict: Runtime Error):
n = input()
lines = input()
line = [int(i) for i in lines.split(' ')]
sum = 1
for i in line:
  if sum > 1.0 * 10^18:
    sum = -1
    break
   else:
    sum = sum * i
print(sum)
Problem p02678 (python)

Fixed submission:
from collections import deque
n, m = map(int, input().split())
e = [[] for _ in range(n+1)]
lndmrk = [-1] * (n + 1)
for i in range(m):
	a, b = map(int, input().split())
	e[a].append(b)
	e[b].append(a)

q = deque()
lndmrk[1] = 0
q.append(1)
while(len(q) != 0):
	v = q.popleft()
	for i in e[v]:
		if lndmrk[i] != -1:
			continue
		lndmrk[i] = v
		q.append(i)
f = 1
for i in range(2, n+1):
	if lndmrk[i] == -1:
		f = 0
if f:
	print("Yes")
	for i in range(2, n+1):
		print(lndmrk[i])
else:
	print("No")

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
e = [[] for _ in range(n+1)]
lndmrk = [-1] * (n + 1)
for i in range(n):
	a, b = map(int, input().split())
	e[a].append(b)
	e[b].append(a)

q = deque()
lndmrk[1] = 0
q.append(1)
while(len(q) != 0):
	v = q.popleft()
	for i in e[v]:
		if lndmrk[i] != -1:
			continue
		lndmrk[i] = v
		q.append(i)
f = 1
for i in range(2, n+1):
	if lndmrk[i] == -1:
		f = 0
if f:
	print("Yes")
	for i in range(2, n+1):
		print(lndmrk[i])
else:
	print("No")

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
e = [[] for _ in range(n+1)]
lndmrk = [-1] * (n + 1)
for i in range(n):
	a, b = map(int, input().split())
	e[a].append(b)
	e[b].append(a)

q = deque()
lndmrk[1] = 0
q.append(1)
while(len(q) != 0):
	v = q.popleft()
	for i in e[v]:
		if lndmrk[i] != -1:
			continue
		lndmrk[i] = v
		q.append(i)
f = 1
for i in range(2, n+1):
	if lndmrk[i] == -1:
		f = 0
if f:
	print("Yes")
	for i in range(2, n+1):
		print(lndmrk[i])
else:
	print("No")

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
e = [[] for _ in range(n+1)]
lndmrk = [-1] * (n + 1)
for i in range(n):
	a, b = map(int, input().split())
	e[a].append(b)
	e[b].append(a)

q = deque()
lndmrk[1] = 0
q.append(1)
while(len(q) != 0):
	v = q.popleft()
	for i in e[v]:
		if lndmrk[i] != -1:
			continue
		lndmrk[i] = v
		q.append(i)
f = 1
for i in range(2, n+1):
	if lndmrk[i] != -1:
		f = 0
if f:
	print("Yes")
	for i in range(2, n+1):
		print(lndmrk[i])
else:
	print("No")
Problem p02641 (python)

Fixed submission:
x,n=map(int,input().split())
if n!=0:
  p=list(int(i) for i in input().split())

  for i in range(100):
    kouho1=x+i
    kouho2=x-i
    if kouho2 not in p:
      print(kouho2)
      break
    elif kouho1 not in p:
      print(kouho1)
      break
else:
  print(x)

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
if n!=0:
  p=list(int(i) for i in input().split())

  for i in range(100):
    kouho1=x+i
    kouho2=x-i
    if kouho2 not in p:
      print(kouho2)
      break
    elif kouho1 not in p:
      print(kouho1)
      breaak
else:
  print(x)
Problem p02702 (python)

Fixed submission:
s=[int(i) for i in input()]
s.reverse()

a=0
l=[0 for i in range(2019)]
l[0]=1
b=0.1
for i in range(len(s)):
  b=int(b*10)
  b%=2019
  a+=s[i]*b
  a%=2019
  l[a]+=1

answer=0
for i in range(2019):
  answer+=l[i]*(l[i]-1)//2
  
print(answer)

Buggy submission (verdict: Runtime Error):
s=[int(i) for i in input()]
s.reverse()

a=0
l=[0 for i in range(2019)]
l[0]=1
for i in range(len(s)):
  a+=s[i]*(10**i)
  a%=2019
  l[b]+=1

answer=0
for i in range(2019):
  answer+=l[i]*(l[i]-1)//2
  
print(answer)
Problem p02720 (python)

Fixed submission:
K=int(input())
A=[1,2,3,4,5,6,7,8,9]
B=[]
C=[]
D=[]
E=[]
F=[]
G=[]
H=[]
I=[]
J=[]
def henkan(A):
    a=len(A)
    B=[]
    for i in range(a):
        if A[i]%10==0:
            B.append(10*A[i])
            B.append(10*A[i]+1)
        elif A[i]%10==9:
            B.append(10*A[i]+9)
            B.append(10*A[i]+8)
        else:
            x=A[i]%10
            B.append(10*A[i]+x)
            B.append(10*A[i]+x+1)
            B.append(10*A[i]+x-1)
    return B

B=henkan(A)
C=henkan(B)
D=henkan(C)
E=henkan(D)
F=henkan(E)
G=henkan(F)
H=henkan(G)
I=henkan(H)
J=henkan(I)
ans=A+B+C+D+E+F+G+H+I+J
ans=sorted(ans)

print(ans[K-1])

Buggy submission (verdict: Runtime Error):
K=int(input())
A=[1,2,3,4,5,6,7,8,9]
B=[]
C=[]
D=[]
E=[]
F=[]
G=[]
H=[]
I=[]

def henkan(A):
    a=len(A)
    B=[]
    for i in range(a):
        if A[i]%10==0:
            B.append(10*A[i])
            B.append(10*A[i]+1)
        elif A[i]%10==9:
            B.append(10*A[i]+9)
            B.append(10*A[i]+8)
        else:
            x=A[i]%10
            B.append(10*A[i]+x)
            B.append(10*A[i]+x+1)
            B.append(10*A[i]+x-1)
    return B

B=henkan(A)
C=henkan(B)
D=henkan(C)
E=henkan(D)
F=henkan(E)
G=henkan(F)
H=henkan(G)
I=henkan(H)
ans=A+B+C+D+E+F+G+H+I
ans=sorted(ans)

print(ans[K-1])

Buggy submission (verdict: Runtime Error):
K=int(input())
A=[1,2,3,4,5,6,7,8,9]
B=[]
C=[]
D=[]
E=[]
F=[]
G=[]
H=[]
I=[]

def henkan(A):
    a=len(A)
    B=[]
    for i in range(a):
        if A[i]==0:
            B.append(10*A[i])
            B.append(10*A[i]+1)
        elif A[i]==9:
            B.append(10*A[i]+9)
            B.append(10*A[i]+8)
        else:
            x=A[i]%10
            B.append(10*A[i]+x)
            B.append(10*A[i]+x+1)
            B.append(10*A[i]+x-1)
    return B

B=henkan(A)
C=henkan(B)
D=henkan(C)
E=henkan(D)
F=henkan(E)
G=henkan(F)
H=henkan(G)
I=henkan(H)
ans=A+B+C+D+E+F+G+H+I
ans=sorted(ans)

print(ans[K-1])
Problem p02741 (python)

Fixed submission:
list=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(list[K-1])

Buggy submission (verdict: Runtime Error):
list=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(list[K])
Problem p03624 (python)

Fixed submission:
list=[chr(i) for i in range(97, 97+26)]
S=input()
S=set(S)
A=[x for x in S]
A=sorted(A)
if len(A)<26:
    A+="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
for i in range(26):
    if A[i] == list[i]:
        pass
    else:
        print(list[i])
        exit()
print("None")

Buggy submission (verdict: Runtime Error):
list=[chr(i) for i in range(97, 97+26)]
S=input()
A=[x for x in S]
A=set(A)
A=sorted(A)
for i in range(len(S)):
    if A[i] == list[i]:
        pass
    else:
        print(list[i])
        exit()
print("None")
Problem p03846 (python)

Fixed submission:
N=int(input())
A=[int(x) for x in input().split()]
mod=10**9+7
A=sorted(A)

if N%2==0:
    if all(A[i]==A[i+1] and A[0]==1 and A[1]==1 and A[i]-2==A[i-2] for i in range(2,N,2)):
        print((2**(N//2))%mod)
    else:
        print(0)
else:
    if all(A[0]==0 and A[i]==A[i-1] and A[i]-2==A[i-2] and A[-1]==N-1 for i in range(2,N,2)):
        print((2**(N//2))%mod)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(x) for x in input().split()]

A=sorted(A)

if N%2==0:
    if all(A[i]==A[i+1] and A[0]==1 and A[i]+2==A[i+2] for i in range(0,N-2,2)):
        print(2**(N//2))
    else:
        print(0)
else:
    if all(A[0]==0 and A[i]==A[i+1] and A[i]-2==A[i-1] for i in range(2,N,2)):
        print(2**(N//2))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(x) for x in input().split()]

A=sorted(A)

if N%2==0:
    if all(A[i]==A[i+1] and A[0]==1 and A[i]+2==A[i+2] for i in range(0,N-2,2)):
        print(2**(N//2))
    else:
        print(0)
else:
    if all(A[0]==0 and A[i+1]==A[i+2] and A[i+1]+2==A[i+3] for i in range(0,N-2,2)):
        print(2**(N//2))
    else:
        print(0)
Problem p04043 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a+b+c==17 and a*b*c==175:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a+b+c=17 and a*b*c=175:
    print(YES)
else:
    print(NO)
Problem p02694 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pprint import pprint as pp
from pprint import pformat as pf

import math


if __name__ == '__main__':
    x = int(input())
    money = 100
    count = 0
    while not (money >= x):
        money = math.floor(money * 101 / 100)
        count += 1
    print(count)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pysnooper # @pysnooper.snoop()
from pprint import pprint as pp
from pprint import pformat as pf

import math


if __name__ == '__main__':
    x = int(input())
    money = 100
    count = 0
    while not (money >= x):
        money = math.floor(money * 101 / 100)
        count += 1
    print(count)
Problem p02696 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pprint import pprint as pp
from pprint import pformat as pf

import math

def calc(a, b, x):
    return math.floor(a * x / b) - a * math.floor(x / b)

if __name__ == '__main__':
    a, b, n = map(int, input().split())
    if b > n:
        m = calc(a, b, n)
    else:
        m = calc(a, b, b - 1)
    print(m)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pprint import pprint as pp
from pprint import pformat as pf

import math


if __name__ == '__main__':
    a, b, n = map(int, input().split())
    if b > n:
        return print(n)
    else:
        return print(b - 1)
Problem p02697 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pprint import pprint as pp
from pprint import pformat as pf

def solve_odd(n, m):
    for i in range(m):
        print(i + 1, n - (i + 1))

def solve_even(n, m):
    offset = 1
    half = int(n / 2)
    diff = half - 1
    for i in range(m):
        start = offset
        end = start + diff
        if i % 2 != 0:
            start += half
            end += half
            # for next 2 loop
            offset += 1
        print(start, end)
        # for next loop
        diff -= 1



if __name__ == '__main__':
    n, m = map(int, input().split())
    if n % 2 == 0:
        solve_even(n, m)
    else:
        solve_odd(n, m)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pysnooper # @pysnooper.snoop()
from pprint import pprint as pp
from pprint import pformat as pf

def solve_odd(n, m):
    for i in range(m):
        print(i + 1, n - (i + 1))

def solve_even(n, m):
    offset = 1
    half = int(n / 2)
    diff = half - 1
    for i in range(m):
        start = offset
        end = start + diff
        if i % 2 != 0:
            start += half
            end += half
            # for next 2 loop
            offset += 1
        print(start, end)
        # for next loop
        diff -= 1



if __name__ == '__main__':
    n, m = map(int, input().split())
    if n % 2 == 0:
        solve_even(n, m)
    else:
        solve_odd(n, m)
Problem p02934 (python)

Fixed submission:
n = int(input())
def f(x):
    return 1 / x
List = list(map(int, input().split()))
List2 = [x for x in map(f, List)]
s = sum(List2)
print(1 / s)

Buggy submission (verdict: Runtime Error):
n = int(input())
x,y = map(int,input().split())
print(1 / (1 / x + 1 / y))
Problem p03280 (python)

Fixed submission:
n,m = map(int,input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
r = int(input())
l = int(input())
print((r-1)*(l-1))
Problem p03470 (python)

Fixed submission:
i = int(input())
List = []
for j in range(i):
    List.append(int(input()))
print(len(set(List)))

Buggy submission (verdict: Runtime Error):
N = int(input())

List = sorted(list(set(list(int(input()) for i in range(N)))))

print(len(List()))
Problem p02756 (python)

Fixed submission:
from collections import deque

s = deque(input())
len_queries = int(input())
queries = [input().split() for _ in range(len_queries)]

is_forward = True
for query in queries:
    if "1" == query[0]:
        is_forward = not is_forward
    else:
        if is_forward:
            if "1" == query[1]:
                s.appendleft(query[2])
            else:
                s.append(query[2])
        else:
            if "1" == query[1]:
                s.append(query[2])
            else:
                s.appendleft(query[2])
if not is_forward:
    s.reverse()
print("".join(s))

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

s = deque(input())
len_queries = int(input())
queries = [input().split() for _ in range(len_queries)]

is_forward = True
for query in queries:
    if "1" == query[0]:
        is_forward = not is_forward
    else:
        if is_forward:
            insert_index = 0 if "1" == query[1] else len(s)
            s.insert(insert_index, query[2])
        else:
            insert_index = len(s) if "1" == query[1] else 0
            s.insert(insert_index, query[2])
if not is_forward:
    s.reverse()
print("".join(s))
Problem p02786 (python)

Fixed submission:
h = int(input())

n = 1
while h >= 2 ** n:
    n += 1
print(2 ** n - 1)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

h = int(input())
h_dash = h if h % 2 == 0 else h - 1


def f(n):
    if n == 2:
        return 3
    return f(n // 2) * 2 + 1


print(f(h_dash))