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

Fixed submission:
k = int(input())
x = 7%k
i = 1
for i in range(1,k+1):
    if x==0:
        break    
    x = (x*10+7)%k
    i += 1
    
if x == 0:
    print(i)
else:
    print('-1')

Buggy submission (verdict: Runtime Error):
k = int(input())
x = 7%k
i = 1
for i in range(0,k+1):
    if x==0:
        print(i)
        break    
        
    l.append(x)
    x = (x*10+7)%k
    i += 1

Buggy submission (verdict: Runtime Error):
k = int(Input)
x = 7%k
l = []
i = 1
while(True):
    if x in l:
        print('-1')
        break
    if x==0:
        print(i)
        break    
        
    l.append(x)
    x = (x*10+7)%k
    i += 1
Problem p03013 (python)

Fixed submission:
def fib(n):
    if n <= 1:
        return n
    result = [1, 0, 0, 1]
    matrix = [1, 1, 1, 0]
    while n > 0:
        if n % 2:
            result = mul(matrix, result)
        matrix = mul(matrix, matrix)
        n //= 2
    return result[2]

def mul(a, b):
    return [a[0]*b[0] + a[1]*b[2],
            a[0]*b[1] + a[1]*b[3],
            a[2]*b[0] + a[3]*b[2],
            a[2]*b[1] + a[3]*b[3]]

N, M = map(int, input().split())
A = []
for i in range(M):
  A.append(int(input()))

flag = False
for i in range(M-1):
  if (A[i]+1 == A[i+1]):
    flag = True

if flag:
  print(0)
elif M != 0:
  parts = []  
  for i in range(M):
    if i == 0:
      a_list = [x for x in range(0, A[i])]
      parts.append(a_list)
    else:
      a_list = [x for x in range(A[i-1]+1, A[i])]
      parts.append(a_list)
  a_list = [x for x in range(A[M-1]+1, N+1)]
  parts.append(a_list)
  ans = 1
  for part in parts:
    part_ans = fib(len(part))
    ans *= part_ans
  print(ans % 1000000007)
else:
  ans = fib(N+1)
  print(ans % 1000000007)

Buggy submission (verdict: Runtime Error):
def fib(n):
    if n <= 1:
        return n
    result = [1, 0, 0, 1]
    matrix = [1, 1, 1, 0]
    while n > 0:
        if n % 2:
            result = mul(matrix, result)
        matrix = mul(matrix, matrix)
        n //= 2
    return result[2]

def mul(a, b):
    return [a[0]*b[0] + a[1]*b[2],
            a[0]*b[1] + a[1]*b[3],
            a[2]*b[0] + a[3]*b[2],
            a[2]*b[1] + a[3]*b[3]]

N, M = map(int, input().split())
A = []
for i in range(M):
  A.append(int(input()))

flag = False
for i in range(M-1):
  if (A[i]+1 == A[i+1]):
    flag = True

if flag:
  print(0)
else:
  parts = []  
  for i in range(M):
    if i == 0:
      a_list = [x for x in range(0, A[i])]
      parts.append(a_list)
    else:
      a_list = [x for x in range(A[i-1]+1, A[i])]
      parts.append(a_list)
  a_list = [x for x in range(A[M-1]+1, N+1)]
  parts.append(a_list)
  ans = 1
  for part in parts:
    part_ans = fib(len(part))
    ans *= part_ans
  print(ans % 1000000007)

Buggy submission (verdict: Runtime Error):
import scipy.misc as sm

def fib(N):
  N = N-1
  a = N // 2
  ans = 0
  for i in range(a+1):
      sum = sm.factorial(N-i)/(sm.factorial(N-2*i)*sm.factorial(i))
      ans += int(sum)
  return ans

N, M = map(int, input().split())
A = []
for i in range(M):
  A.append(int(input()))

flag = False
for i in range(M-1):
  if (A[i]+1 == A[i+1]):
    flag = True

if flag:
  print(0)
else:
  parts = []  
  for i in range(M):
    if i == 0:
      a_list = [x for x in range(0, A[i])]
      parts.append(a_list)
    else:
      a_list = [x for x in range(A[i-1]+1, A[i])]
      parts.append(a_list)
  a_list = [x for x in range(A[M-1]+1, N+1)]
  parts.append(a_list)
  ans = 1
  for part in parts:
    part_ans = fib(len(part))
    ans *= part_ans
  print(ans % 1000000007)
Problem p02712 (python)

Fixed submission:
a = int(input())
b = []
for i in range(a + 1):
  if i % 3 == 0:
    pass
  elif i % 5 == 0:
    pass
  else:
    b.append(i)
c = sum(b)
print(c)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = []
for i in range(a + 1):
  if i % 3 == 0:
    pass
  elif i 5 5 == 0:
    pass
  else:
    b.append(i)
c = sum(b)
print(c)
Problem p02725 (python)

Fixed submission:
k, n = map(int, input().split())
house_list = list(map(int, input().split()))
for i in range(n):
  house_list.append(house_list[i] - k)
tmp_list = sorted(house_list)
ans_list = []
for j in range(n + 1):
  ans_list.append(tmp_list[j + n - 1] - tmp_list[j])
print(min(ans_list))

Buggy submission (verdict: Runtime Error):
k, n = map(int, input().split())
house_list = list(map(int, input().split()))
for i in range(n):
  house_list.append(house_list[i] - k)
tmp_list = sorted(house_list)
ans_list = []
for j in range(n + 1):
  ans_list.append(tmp_list[j + n - 1] - tmp_list[j])
print(min(ans_list)

Buggy submission (verdict: Runtime Error):
k, n = map(int, input().split())
house_list = list(map(int, input().split()))
for i in range(n):
  house_list.append(house_list[i] - k)
tmp_list = sorted(house_lise)
ans_list = []
for j in range(n + 1):
  ans_list.append(tmp_list[j + n - 1] - tmp_list[j])
print(min(ans_list)
Problem p02912 (python)

Fixed submission:
import heapq
n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)
for i in range(m):
  min = heapq.heappop(a)
  heapq.heappush(a, (-min//2)*(-1))
print(-sum(a))

Buggy submission (verdict: Runtime Error):
import headq
n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input()split()))
headq.heaify(a)
for i in range(m):
  min = heapq.heapppop(a)
  heapq.heappush(a, (-min//2)*(-1))
print(-sum(a))
Problem p02682 (python)

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

if A+B<K:
  print(A-(K-A-B))
else:
  print(min(A, K))

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

s=-1*K*C

lc=[]
lc_=[]
for i in range(min(K,A+1):
  for j in range(min(K-i+1,B+1)):
    lc.append([i,j,K-i-j])

#print(lc)

for i in range(len(lc)):
  if lc[i][0]<=A and lc[i][1]<=B and lc[i][2]<=C:
    # print(lc[i])
    s=max(s, lc[i][0]-lc[i][2])

print(s)
Problem p02688 (python)

Fixed submission:
import numpy as np

N,K=map(int, input().split())

A=[]
l=[]
for _ in range(K):
    d = map(int, input())
    l=list(map(int,input().split()))
    A.append(l)
#print(A)
a=np.zeros((N, K))
for i in range (len(A)):
    for j in range(len(A[i])):
        a[A[i][j]-1][i]=1
#print(a)
print(np.count_nonzero(np.all(a==0, axis=1)))

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

N =int(input(''))
K=int(input(''))
A=[]
l=[]
for i in range(K):
    d = int(input(''))
    for j in range(d):
        l_ = int(input(''))
        l.append(l_)
    A.append(l)

a=np.zeros((N, K))
for i in range (len(A)):
    for j in range(len(A[i])):
        a[A[i][j]-1][i]=1
#print(a)

print(np.count_nonzero(np.all(a==0, axis=1)))
Problem p02707 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n

for i in a:
    b[i-1]+=1

[print(i) for i in b]

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for _ in range(n-1)]

for i in range(n):
    print(a.count(i+1))
Problem p02597 (python)

Fixed submission:
n=int(input())
c=input()
list=[0 for i in range(n+1)]
r=0
for i in range(n):
  if c[i]=='R':
    r+=1
w=0
list[0]=max(r,w)

#i corresponds to the right side boundary of c[i]
for i in range(n):
  if c[i]=='W':
    w+=1
  if c[i]=='R':
    r-=1
  list[i+1]=max(r,w)
print(min(list))

Buggy submission (verdict: Runtime Error):
n=int(input())
c=input()
count=0

for i in range(n):
  if c[i]=='W':
    #print('when W in',i)
    s=c[i:]
    num=s.find('R')
    if num<0:
      break
    num+=i
    #print('when num ',num)
    t=c[num:]
    num_ch=t.find('W')
    if num_ch<0:
      num_ch=n-num   
    #print(num_ch)
    num_ch+=num
    
    #print('when num_ch',num_ch)
    if num-i-1<=num_ch-num:
      #print('間が小さいので塗り替える')
      for j in range(i,num):
        #print(j)
        c=c[:j]+'R'+c[j+1:]
        count+=1
    else:
      #print('間が大きいので交換する')
      for j in range(num,num_ch):
        #print(j)
        c=c[:j]+'W'+c[j+1:]
        c[i+j-num]='R'
        count+=1
#print(c)
print(count)
Problem p02699 (python)

Fixed submission:
s,w=map(int,input().split())
if w>=s:
  print('unsafe')
else:
  print('safe')

Buggy submission (verdict: Runtime Error):
s,w=int(input().split())
if w>=s:
  print('unsafe')
else:
  print('safe')
Problem p02753 (python)

Fixed submission:
s=input()
z=0
for i in range(2):
  if s[i]==s[i+1]:
    z+=1
if z==2:
  print('No')
elif z<2:
  print('Yes')

Buggy submission (verdict: Runtime Error):
from collections import deque
s=deque(input())
q=int(input())
direction=1
for i in range(q):
  k=deque(input().split())
  if k[0]=='1':
    direction*=(-1)
  if k[0]=='2':
    if k[1]=='1':
      if direction==1:
        s.appendleft(k[2])
      else:
        s.append(k[2])
    if k[1]=='2':
      if direction==1:
        s.append(k[2])
      else:
        s.appendleft(k[2])
if direction==-1:
  s.reverse()
print("".join(list(s)))
Problem p02759 (python)

Fixed submission:
n=int(input())
if n%2==0:
  print(n//2)
else:
  print((n+1)//2)

Buggy submission (verdict: Runtime Error):
a=[[0]*3 for i in range(3)]
b=[]
for i in range(3):
  x=input().split()
  a[i][0]=x[0]
  a[i][1]=x[1]
  a[i][2]=x[2]
n=int(input())
for i in range(n):
  b.append(input())
for i in range(n):
  for j in range(9):
    if b[i]==a[j//3][j%3]:
      a[j//3][j%3]='X'
jud=[0,0,0,0]
z=0
res=0
for i in range(3):
  for j in range(2):
    if a[i][j]==a[i][j+1]:
      jud[0]+=1
    if a[j][i]==a[j+1][i]:
      jud[1]+=1
  if max(jud)>1:
    res-=1
for j in range(2):
  if a[j][j]==a[j+1][j+1]:
    jud[2]+=1
  if a[j][2-j]==a[j+1][2-j-1]:
    jud[3]+=1
  if max(jud)>1:
    res-=1
if res<0:
  print('Yes')
else:
  print('No')
Problem p02771 (python)

Fixed submission:
A,B,C = input().split()
if A==B and A!=C or B==C and B!=A or C==A and C!=B:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
A=int(a)
B=int(b)
C=int(c)
if  A==B and A!=C:
  print('Yes')
if  A==C and A!=B: 
  print('Yes')
if  B==C and B!=A: 
  print('Yes')
else: 
  print('No')

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
if  A==B and A!=C:
  print('Yes')
if  A==C and A!=B: 
  print('Yes')
if  B==C and B!=A: 
  print('Yes')
else: 
  print('No')

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
if A==B and A!=C:
  print('Yes')
if A==C and A!=B: 
  print('Yes')
if B==C and B!=A: 
  print('Yes')
else: 
  print('No')

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
if A==B and A!=C: print('Yes')
if A==C and A!=B: print('Yes')
if B==C and B!=A: print('Yes')
else: print('No')
Problem p02596 (python)

Fixed submission:
k = int(input())
n = 7
c = 1
if(k%2 == 0):
  print(-1)
else:
  while(True):
    if(n%k == 0):
      break
    if(c > k):
      c = -1
      break
    r = n%k
    n = 10*r+7
    c += 1
  print(c)

Buggy submission (verdict: Runtime Error):
k = int(input())
c = 1
for i in range(1,n):
  a = 7*((10**i - 1)//9)
  if(a%k == 0):
    break
  else:
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
k = int(input())
b = 7
c = 1
a = []
e = 0
a.append(7)
if(k%2 == 0):
  print(-1)
else:
  while(b%k != 0):
    r = b%k
    b = 10*r+7
    c += 1
    if b in a:
      e = 1
  	a.append(b)
  if(e == 1):
    print(-1)
  else:
  	print(c)

Buggy submission (verdict: Runtime Error):
k = int(input())
b = 7
c = 1
a = []
a.append(7)
if(k%2 == 0):
  print(-1)
else:
  while(b%k != 0):
    r = b%k
    b = 10*r+7
    c += 1
    if b in a:
      print(-1)
  	a.append(b)
  print(c)
Problem p02847 (python)

Fixed submission:

S = input()

day = ['SUN','MON','TUE','WED','THU','FRI','SAT']

n = day.index(S)

print(7 - n)

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

n = int(X / A)
n = int(X / A) - B * len(str(n))

while X < A * n + B * len(str(n)):
    n -= 1

if n > 1000000000:
    n = 1000000000

if n < 0:
    n = 0

print(n)

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

n = int(X / A)

while X < A * n + B * len(str(n)):
    n -= 1

if n > 1000000000:
    n = 1000000000

if n < 0:
    n = 0

print(n)

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

n = 10 ** (len(str(X)) - 1)
n = int(X / A)

while X < A * n + B * len(str(n)):
    n -= 1

if n > 1000000000:
    n = 1000000000

if n < 0:
    n = 0

print(n)
Problem p02897 (python)

Fixed submission:
def main():
    n = int(input())

    if n % 2 == 0:
        print(0.5)
    else:
        print(float(int(n / 2)+1) / n)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math

def main():
    inputs = input().split()
    inputs = [int(i) for i in inputs]

    a = inputs[0]
    b = inputs[1]

    g = gcd(a, b)
    d = {}

    min_n = min([a, b])

    for i in range(2, int(math.sqrt(min_n + 1))):
        while True:
            if g % i == 0:
                g /= i
                d[i] = i
            else:
                break

    print(len(d) + 1)

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

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

Fixed submission:
a,b=input().split()
ai=int(a)
bi=int(float(b)*100)//1
bi=int(b.replace('.',''))

print(ai*bi//100)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
ai=int(a)
b=int(float(b)*100)//1

print(int(a*b/100))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
ai=int(a)
b=int(float(b)*100//1)

print(int(a*b/100))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
ai=int(a)
bf100=b*100

print(int(ai*bf100/100))
Problem p02693 (python)

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

flg = False
for i in range(A,B+1):
  if i % K == 0:
    flg = True

if flg :
  print("OK")
else:
  print("NG")

Buggy submission (verdict: Runtime Error):
k=int(input())
a,b=map(int,input().split())
flg=False
for i in range(a,b+1):
  if i % k = 0:
    flg=True
    break
if flg:
  print('OK')
else:
  print('NG')
Problem p02753 (python)

Fixed submission:
s = list(input())
if s[0] == s[1]:
    if s[1] == s[2]:
        print('No')
    else:
        print('Yes')
else:
    print('Yes')

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

if n == 0:
    print(0)
elif a == 0:
    print(0)
elif b == 0:
    print(n)
elif a >= n:
    print(n)
elif a+b > n > a:
    print(a)
else:
    q,mod = divmod(n, a+b)
    print(q*a + mod)
Problem p02754 (python)

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

q, mod  =divmod(n, a+b)
print(q*a + min(mod,a))

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

if n == 0:
    print(0)
elif: a == 0:
    print(0)
elif b == 0:
    print(n)
elif a >= n:
    print(n)
elif a+b > n > a:
    print(a)
else:
    q,mod = divmod(n, a+b)
    print(q*a + mod)

Buggy submission (verdict: Runtime Error):
f a == 0:
    print(0)
elif a > n:
    print(n)
elif a+b > n:
    print(a)
else:
    q,mod = divmod(n, a+b)
    print(q*a + mod)
Problem p02597 (python)

Fixed submission:
N = int(input())
c = str(input())

head = 0
tail = -1
count = 0

while head < N:
    if c[head] == "W":
        while tail >= -N and c[tail] == "W":
            tail -= 1
        if head >= N + tail:
            print(count)
            exit()
        tail -= 1
        count += 1
    head += 1
print(count)

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

head = 0
tail = -1
count = 0

while head < N and tail+N >= 0:
    if c[head] == "W":
        while c[tail] == "W":
            tail -= 1
        if head >= N + tail:
            print(count)
            exit()
        tail -= 1
        count += 1
    head += 1
print(count)

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

head = 0
tail = -1
count = 0

while head < N:
    if c[head] == "W":
        while c[tail] == "W":
            tail -= 1
        if head >= N + tail:
            print(count)
            exit()
        tail -= 1
        count += 1
    head += 1
print(count)
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


A_max = 0
B_sum = 0
B_max = 0
best_num = 0

flag = True # Aだけ読んで時間が尽きるかどうか

# Aを最大まで読んだ時の冊数と時間
A_max = N
A_sum = 0
for i in range(N):
    A_sum += A[i]
    if A_sum > K:
        A_sum -= A[i]
        A_max = i
        break
A = A[0:A_max]
now_num = A_max # 今の読んだ数
mixsum = A_sum # A,Bを合わせた時間
b_num = 0 # bを読んだ数
if flag:
    now_num += M
    b_num = M
    for i in range(M):
        mixsum += B[i]
        if mixsum > K:
            mixsum -= B[i]
            now_num = A_max + i
            b_num = i  #i冊読んだので次取るならi番目から
            break
A.reverse()
best_num = now_num
for i in range(A_max):
    mixsum -= A[i]
    now_num -= 1
    for j in range(b_num, M):
        mixsum += B[j]
        now_num += 1
        if mixsum > K:
            mixsum -= B[j]
            now_num -= 1
            b_num = j #miss
            break
    if now_num > best_num:
        best_num = now_num
print(best_num)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_sum = 0
A_max = 0
B_sum = 0
B_max = 0
best_num = 0
A_max = N
flag = True
for i in range(N):
    A_sum += A[i]
    if A_sum > K:
        A_sum -= A[i]
        A_max = i
        flag = False
        break
A = A[0:A_max]
now_num = A_max
mixsum = A_sum
b_num = 0
if flag:
    for i in range(M):
        mixsum += B[i]
        if mixsum > K:
            mixsum -= B[i]
            now_num += i
            b_num = i
            break
A.reverse()
best_num = 0
for i in range(A_max):
    A_sum -= A[i]
    mixsum = A_sum
    now_num = A_max - i
    for j in range(M):
        mixsum += B[b_num+j]
        now_num += 1
        if mixsum > K:
            now_num -= 1
            break
    if now_num > best_num:
        best_num = now_num
print(best_num)
Problem p02879 (python)

Fixed submission:
A, B = map(int, input().split())
if A < 1 or A > 9 or B < 1 or B > 9:
    print("-1")
else:
    print(A*B)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if A < 1 or A > 9 or B < 1 or B > 9:
    print("-1")
else:
    print(A*B)
Problem p02699 (python)

Fixed submission:
s, w = input().split(' ')
s = int(s)
w = int(w)
 
if s > w :
  print('safe')
else:
  print('unsafe')

Buggy submission (verdict: Runtime Error):
s, w = input().split(' ')
s = int(s)
w = int(w)
 
if s > w :
  print('safe')
else:
  pritn('unsafe')

Buggy submission (verdict: Runtime Error):
s, w = input()
s = int(s)
w = int(w)

if s > w :
  print('safe')
else:
  pritn('unsafe')
Problem p02771 (python)

Fixed submission:
a,b,c = input().split(' ')
l = []
l.append(a)
l.append(b)
l.append(c)
l = set(l)
n=len(l)
if n == 2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = input().split(' ')
l = []
l.append([a,b,c])
n=len(set(l))
if n == 2:
  print('Yes')
else:
  print('No')
Problem p02773 (python)

Fixed submission:
def inverse_lookup(d, x):
    a = []
    for k,v in d.items():
        if x == v:
          a.append(k)
    return sorted(a)

n = int(input())
w = {}
for _ in range(n):
  i = input()
  if i in w:
    w[i] += 1
  else:
    w[i] = 1
m = max(w.values())
for j in inverse_lookup(w,m):
  print(j)

Buggy submission (verdict: Runtime Error):
def inverse_lookup(d, x):
    a = []
    for k,v in d.items():
        if x == v:
          a.append(k)
    return a

n = int(input())
w = {}
for i in range(n):
  if i in w:
    w[i] += 1
  else:
    w[i] = 1
m = max(w.values())
for i in inverse_lookup(w,m).sort(reverse=True):
  print(i)
Problem p02777 (python)

Fixed submission:
s, t = input().split()
a, b = input().split(" ")
u = input()
a = int(a)
b = int(b)

 
if u == s:
  print(a - 1, b)
else:
  print(a, b-1)

Buggy submission (verdict: Runtime Error):
s, t = input()
a, b = input().split(" ")
u = input()
a = int(a)
b = int(b)
u = int(u)

if u == s:
  print(a - 1, b)
else:
  print(a, b-1)
Problem p02859 (python)

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

Buggy submission (verdict: Runtime Error):
r = input()
print (r **2)
Problem p02659 (python)

Fixed submission:
from math import floor
import decimal
a, b = input().split()
a = int(a)
b = decimal.Decimal(b)
#print(a, b)
#print(type(a), type(b))
print(floor(a * b))

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

print(long(a * b))

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

print(int(a * B))
Problem p02661 (python)

Fixed submission:
import numpy as np
N = int(input())
A = np.zeros(N)
B = np.zeros(N)
for i in range(N):
    A[i], B[i] = map(int, input().split())

am = np.median(A)
bm = np.median(B)

if N % 2 == 0:
    print(int((bm - am) * 2 + 1))
else:
    print(int((bm - am) + 1))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.zeros(N)
B = np.zeros(N)
for i in range(N):
    A[i], B[i] = map(int, input().split())

am = np.median(A)
bm = np.median(B)

if n % 2 == 0:
    print(int((bm - am) * 2 + 1))
else:
    print(int((bm - am) + 1))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = []
B = []
for _ in range(N):
    A[i], B[i] = map(int, input().split())

A = np.array(A)
B = np.array(B)
am = np.median(A)
bm = np.median(B)

if n % 2 == 0:
    print((bm - am) * 2 + 1)
else:
    print((bm - am) + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
B = []
for _ in range(N):
    A[i], B[i] = map(int, input().split())

if n / 2 == 0:
    Am = (A[N / 2] + A[(N / 2) + 1]) / 2
    Bm = (B[N / 2] + B[(N / 2) + 1]) / 2
    print((Bm - Am) * 2 + 1)
else:
    Am = A[(N + 1) / 2]
    Bm = B[(N + 1) / 2]
    print(Bm - Am + 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = []
B = []
for _ in range(n):
    A[i], B[i] = map(int, input().split())

if n / 2 == 0:
    Am = (A[N / 2] + A[(N / 2) + 1]) / 2
    Bm = (B[N / 2] + B[(N / 2) + 1]) / 2
    print((Bm - Am) * 2 + 1)
else:
    Am = A[(N + 1) / 2]
    Bm = B[(N + 1) / 2]
    print(Bm - Am + 1)
Problem p02596 (python)

Fixed submission:
#200802C
X = int(input())
L = len(str(X))
#print(L)


Y = 0

for l in range(L):
    Y += 7*10**l
    
flag = 0
for i in range(1000000):
    Y = Y%X
    #print(i)

    if Y == 0:
        ans = L+i
        flag = 1
        break
    else: 
        Z = Y * 10 + 7
        if Z == Y:
            break
        else:
            Y = Z

if flag == 0:
    print("-1")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
#200802C
X = int(input())
L = len(str(X))
#print(L)



for l in range(L):
    Y += 7*10**l
    
flag = 0
for i in range(10000000):
    Y = Y%X
    #print(i)

    if Y == 0:
        ans = L+i
        flag = 1
        break
    else: 
        Z = Y * 10 + 7
        if Z == Y:
            break
        else:
            Y = Z

if flag == 0:
    print("-1")
else:
    print(ans)
Problem p02729 (python)

Fixed submission:
#200322A
N, M = map(int,input().split())
x = N * (N - 1)/2 + M * (M-1) /2
print(int(x))

Buggy submission (verdict: Runtime Error):
#200322D
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in range(N):
    for j in range(N):
        if A[i] == A[j]:
            count += 1
All = (count - N) / 2
#print(int(All))

for i in range(N):
    count = 0
    for j in range(N):
        if A[i] == A[j]:
            count += 1
    print(int(All - count + 1))
Problem p02916 (python)

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

ans=0
bef=-10
for i in range(n):
    ans+=b[a[i]-1]
    if a[i]-1 == bef:
        ans+=c[a[i]-2]
    bef=a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
ans=0
bef=-10
for i in range(n):
    ans+=b[a[i]-1]
    if a[i]-1 == bef:
        ans+=c[a[i]-2]
    bef=a[i]
print(ans)