Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
print(*[a.index(i+1)+1 for i in range(n)])

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans = [0]*n
for i in range(n):
  ans[a[i]-1] = i+1
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
  if a < b:
    a, b = b, a
  while b > 0:
    a, b = b, a % b
  return a


a,b = map(int, input().split())

max_gcd = gcd(a,b)

primes = []
for i in range(2,max_gcd+1):
  if any(i % prime == 0 for prime in primes):
    continue
  primes += [i]
primes = [1] + primes
  
ans = sum(max_gcd % prime == 0 for prime in primes)

print(ans)

Fixed submission:
def solve():
  import sys
  import math

  sys.setrecursionlimit(10**7)
  readline=sys.stdin.readline

  def gcd(a,b):
    if a < b:
      a, b = b, a
    while b > 0:
      a, b = b, a % b
    return a

  
  def prime_factorize(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
  

  a,b = map(int, input().split())

  max_gcd = gcd(a,b)

  ans = set(prime_factorize(max_gcd))

  print(len(ans)+1)

  
if __name__ == '__main__':
  solve()
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
  import sys
  import math

  sys.setrecursionlimit(10**7)
  readline=sys.stdin.readline

  n,m = map(int,input().split())
  a = list(map(int,input().split()))
  a.sort()
  
  for i in range(m):
    a += [a.pop()//2]
    a.sort()
  
  print(sum(a))

if __name__ == '__main__':
  solve()

Fixed submission:
def solve():
  import sys
  import math
  import heapq

  sys.setrecursionlimit(10**7)
  readline=sys.stdin.readline

  n,m = map(int,input().split())
  a = [-int(i) for i in input().split()]
  heapq.heapify(a)
  
  t = heapq.heappop(a)
  for i in range(m-1):
    t = heapq.heappushpop(a,t/2)
  heapq.heappush(a,t/2)
  
  print(sum(int(-i) for i in a))

if __name__ == '__main__':
  solve()
Buggy python submission (verdict: Runtime Error):
def solve():
  import sys
  import math

  sys.setrecursionlimit(10**7)
  readline=sys.stdin.readline

  n = int(input())
  *a, = map(int,input().split())
  *b, = map(int,input().split())
  *c, = map(int,input().split())
  
  ans = b[a[0]]
  for i in range(1,n):
    ans += b[a[i]]
    if a[i]-a[i-1]==1:
      ans += c[a[i-1]]

  print(ans)


if __name__ == '__main__':
  solve()

Fixed submission:
def solve():
  import sys
  import math

  sys.setrecursionlimit(10**7)
  readline=sys.stdin.readline

  n = int(input())
  *a, = map(int,input().split())
  *b, = map(int,input().split())
  *c, = map(int,input().split())
  
  ans = sum(b)
  for i in range(1,n):
    if a[i]-a[i-1]==1:
      ans += c[a[i-1]-1]

  print(ans)


if __name__ == '__main__':
  solve()
Buggy python submission (verdict: Runtime Error):
def solve():
  import sys

  sys.setrecursionlimit(10**7)
  readline = sys.stdin.readline

  
  n = int(readline())
  a = [list(map(int,readline().split())) for _ in range(n)]
  c = [0]*n
  d = 0
  m = list(range(n))
  
  while m:
    candidate = set()
    for i in m:
      if i in candidate:
        continue
      j = a[i][c[i]]-1
      if a[j][c[j]]-1 == i:
        candidate.add(i)
        candidate.add(j)

    if candidate:
      for i in candidate:
        c[i]+=1
        if c[i] == n-1:
          m.remove(i)
      d+=1
    else:
      d=-1
      break
      
  print(d)


if __name__ == '__main__':
  solve()

Fixed submission:
def solve():
  import sys
  import math

  sys.setrecursionlimit(10**7)

  a = input()
  b = input()
  
  print(sum(a[i]==b[i] for i in range(3)))


if __name__ == '__main__':
  solve()
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
*a, = map(int, input().split())
ans = 0
wer = 0

for i in range(n-1):
  for j in range(i, n):
  	if a[i] > a[j]:
      ans += 1
ans *= k

for i in range(n):
  for j in range(n):
    if a[i] > a[j]:
      wer += k-1
wer *= k*(k-1)//2

ans += wer
ans %= 10**9 + 7
  
print(ans)

Fixed submission:
n,k = map(int, input().split())
*a, = map(int, input().split())
ans = 0
wer = 0

for i in range(n-1):
  for j in range(i+1, n):
    if a[i] > a[j]:
      ans += 1
ans *= k

for i in range(n):
  for j in range(n):
    if a[i] > a[j]:
      wer += 1
wer *= k*(k-1)//2

ans += wer
ans %= 10**9 + 7
  
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().split())

d=1
m=0
for i in range(n):
  d *= i
  m += i

ans = d/m
print(ans)

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

d=1
m=0
for i in a:
  d *= i
for i in a:
  m += d/i

ans = d/m

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
 
input = sys.stdin.readline
input_list = lambda: map(int, input().split())
 
dup = lambda x,y: ((x)+(y)-1)//(y)
 
def solve():
  s = input()
  ans = 0
  prev = ''
  i = 0
  while i < len(s):
    len = 1
    if s[i:i+len] == prev: len += 1
    if i + len > len(s): break
    prev = s[i:i+len]
    i += len
    ans += 1
  print(ans)


solve()

Fixed submission:
s = input()
ans = 0
t = p = ''

for i in range(len(s)):
  t += s[i]
  if t == p:
    continue
  p = t
  t = ''
  ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def sort_str(str):
  return ''.join(sorted(list(str)))

n = int(input().rstrip())
s = [sort_str(input().rstrip()) for _ in range(n)]

ans = 0
pool = {}
for i in range(n):
  if not s[i] in pool.keys():
    pool[s[i]] = 0
  else:
    pool[s[i]] += 1
    ans += pool[s[i]]
print(ans)

Fixed submission:
def sort_str(str):
  return ''.join(sorted(list(str)))

n = int(input().rstrip())
s = [sort_str(input().rstrip()) for _ in range(n)]

ans = 0
pool = {}
for i in range(n):
  if not s[i] in pool.keys():
    pool[s[i]] = 0
  else:
    pool[s[i]] += 1
    ans += pool[s[i]]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import string


def str2dic(str):
  dic = {c:0 for c in string.ascii_lowercase}
  for c in str:
    dic[c] += 1
  return dic

def is_anaglam(a, b):
  if a == b:
    return True
  return False


n = int(input().rstrip())
s = [str2dic(input().rstrip()) for _ in range(n)]

ans = 0
for i in range(n):
  for j in range(i+1, n):
    if is_anaglam(s[i], s[j]):
      ans += 1
print(ans)

Fixed submission:
def sort_str(str):
  return ''.join(sorted(list(str)))

n = int(input().rstrip())
s = [sort_str(input().rstrip()) for _ in range(n)]

ans = 0
pool = {}
for i in range(n):
  if not s[i] in pool.keys():
    pool[s[i]] = 0
  else:
    pool[s[i]] += 1
    ans += pool[s[i]]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input().rstrip())
s = [input().rstrip() for _ in range(n)]


def is_anaglam(a, b):
  if sorted(list(a)) == sorted(list(b)):
    return True
  return False


ans = 0
for i in range(n):
  for j in range(i+1, n):
    if is_anaglam(s[i], s[j]):
      ans += 1
print(ans)

Fixed submission:
def sort_str(str):
  return ''.join(sorted(list(str)))

n = int(input().rstrip())
s = [sort_str(input().rstrip()) for _ in range(n)]

ans = 0
pool = {}
for i in range(n):
  if not s[i] in pool.keys():
    pool[s[i]] = 0
  else:
    pool[s[i]] += 1
    ans += pool[s[i]]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from heapq import heappush, heappop

na = lambda: map(int, sys.stdin.readline().split())

n, m = na()
ab = [list(na()) for _ in range(n)]

ans = 0
h = []
for day in range(1, m+1):
  d = 0
  for i in range(len(ab)):
    if ab[i-d][0] <= day:
      heappush(h, -ab.pop(i-d)[1])
      d += 1
  if h:
    ans += -heappop(h)

print(ans)

Fixed submission:
import sys
from heapq import heappush, heappop
from operator import itemgetter

na = lambda: map(int, sys.stdin.readline().split())

n, m = na()
ab = [list(na()) for _ in range(n)]
ab.sort(key=itemgetter(0))

ans = 0
p = 0
h = []
for day in range(1, m+1):
  for i in range(p, len(ab)):
    if ab[i][0] <= day:
      heappush(h, -ab[i][1])
      p += 1
    else:
      break
  if h:
    ans += -heappop(h)

print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
from heapq import heappush, heappop

na = lambda: map(int, sys.stdin.readline().split())

n, m = na()
ab = [list(na()) for _ in range(n)]

ans = 0
h = []
for day in range(1, m+1):
  d = 0
  for i in range(len(ab)):
    if ab[i-d][0] <= day:
      heappush(h, -ab.pop(i-d)[1])
      d += 1
  ans += -heappop(h)

print(ans)

Fixed submission:
import sys
from heapq import heappush, heappop
from operator import itemgetter

na = lambda: map(int, sys.stdin.readline().split())

n, m = na()
ab = [list(na()) for _ in range(n)]
ab.sort(key=itemgetter(0))

ans = 0
p = 0
h = []
for day in range(1, m+1):
  for i in range(p, len(ab)):
    if ab[i][0] <= day:
      heappush(h, -ab[i][1])
      p += 1
    else:
      break
  if h:
    ans += -heappop(h)

print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
from heapq import heappush, heappop

na = lambda: map(int, sys.stdin.readline().split())

n, m = na()
ab = [list(na()) for _ in range(n)]

ans = 0
h = []
for day in range(1, m+1):
  d = 0
  for i in range(len(ab)):
    if ab[i-d][0] <= day:
      heappush(h, -ab.pop(i-d)[1])
      d += 1
  ans += -heappop(h)

print(ans)

Fixed submission:
import sys
from heapq import heappush, heappop
from operator import itemgetter

na = lambda: map(int, sys.stdin.readline().split())

n, m = na()
ab = [list(na()) for _ in range(n)]
ab.sort(key=itemgetter(0))

ans = 0
p = 0
h = []
for day in range(1, m+1):
  for i in range(p, len(ab)):
    if ab[i][0] <= day:
      heappush(h, -ab[i][1])
      p += 1
    else:
      break
  if h:
    ans += -heappop(h)

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h_list = map(int, input().split())
h = 0
result = 'Yes'
for i in range(n):
  if h <= h_list[i]:
    h = h_list[i]
  elif h == h_list[i]-1:
    h = h_list[i]-1
  else:
    result = 'No'
print(result)

Fixed submission:
n = int(input())
h_list = list(map(int, input().split()))
h = 0
result = 'Yes'
for i in range(n):
  if h <= h_list[i]-1:
    h = h_list[i]-1
  elif h == h_list[i]:
    h = h_list[i]
  else:
    result = 'No'
print(result)
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces

dup = lambda: x, y: ((x)+(y)-1)//(y)

def solve():
  s = ni()
  v = 1e9
  
  y = dup(s, v)
  x = y*v-s
  
  print(0, 0, v, 1, x, y)


if __name__ == ‘__main__’:
  solve()

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces

dup = lambda x,y: ((x)+(y)-1)//(y)

def solve():
  s = ni()
  v = 10**9
  
  y = dup(s, v)
  x = y*v-s
  
  print(0, 0, v, 1, x, y)


solve()
Buggy python submission (verdict: Runtime Error):
#include<stdio.h>
#include<string.h>

int main(){
    int n,i,j,d[100],t,x[100];
    char s[100][100];
    scanf("%d",&n);
    for(i=0;i<n;++i){
        scanf("%s %d",s[i],&d[i]);
        for(j=i;j>0;--j){
            t=strcmp(s[i],s[x[j-1]]);
            if(t<0 || (t==0&&d[i]>d[x[j-1]])){
                x[j] = x[j-1];
            }else{
                break;
            }
        }
        x[j]=i;
    }
    for(i=0;i<n;++i){
        printf("%d\n",x[i]+1);
    }
    return 0;
}

Fixed submission:
n=int(input())
array = []
for i in range(n):
    s,p = input().split()
    array.append([s,100-int(p),i+1])
array.sort()
for i in range(n):
    print(array[i][2])

Buggy python submission (verdict: Runtime Error):
#include<stdio.h>
#include <string.h>
int main(void){
    int n,i,j,x[10] = {1,2,3,4,5,6,7,8,9,10};
    scanf("%d",&n);
    char s[100][11],tmp_s[11];
    int d[100],tmp_d;
    for(i=0;i<n;++i){
       scanf("%s %d",&s[i],&d[i]);
    }
    for(i=0;i<n;++i){
        for(j=i+1;j<n;++j){
            if(strcmp(s[i],s[j])>0){
                strcpy(tmp_s,s[i]);
                tmp_d = d[i];
                strcpy(s[i],s[j]);
                d[i] = d[j];
                strcpy(s[j],tmp_s);
                d[j] = tmp_d;
                tmp_d = x[i];
                x[j] =x[i];
                x[i] = tmp_d;
            }else if(strcmp(s[i],s[j])==0){
                if(d[i] > d[j]){
                    strcpy(tmp_s,s[i]);
                    tmp_d = d[i];
                    strcpy(s[i],s[j]);
                    d[i] = d[j];
                    strcpy(s[j],tmp_s);
                    d[j] = tmp_d;
                    tmp_d = x[i];
                    x[j] =x[i];
                    x[i] = tmp_d;
                }
            }
        }
    }
    for(i=0;i<n;++i){
        printf("%d\n",x[i]);
    }
    return 0;
}
            

Fixed submission:
n=int(input())
array = []
for i in range(n):
    s,p = input().split()
    array.append([s,100-int(p),i+1])
array.sort()
for i in range(n):
    print(array[i][2])
Buggy python submission (verdict: Runtime Error):
import sys

N = int(input())
L = []
for i in range(N):
    L.append(sorted(sys.stdin.readline().strip()))

Sum = 0
for i in range(N):
    if i == N - 1:
        break
    
    for j in range(i+1, N):
        if L[i] == L[j]:
            Sum += 1

print(Sum)
        


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

print(max(a+b, a-b, a*b))
Buggy python submission (verdict: Runtime Error):
import bisect
#find set of numbers iroha like
tmp = raw_input("").split(' ')
n = int(tmp[0])
k = int(tmp[1])
tmp = raw_input("")
exclude_set = map(int, tmp.split(' '))
include_set = []
for i in range(0, 10):
  if i not in exclude_set:
    include_set.append(i)
#print include_set
n_digits = []
while n > 0:
  n_digits.append(n%10)
  n = int(n/10)
out = []
j = 0
#print include_set
while j < len(n_digits):
  tmp = bisect.bisect_left(include_set, n_digits[j])
  #print tmp
  out.append(str(include_set[tmp]))
  j += 1
print int(''.join(out)[::-1])

Fixed submission:
#find set of numbers iroha like
tmp = raw_input("").split(' ')
n = int(tmp[0])
k = int(tmp[1])
tmp = raw_input("")
exclude_set = map(int, tmp.split(' '))

def binarySearch(arr, target):
  l = 0
  r  = len(arr) - 1
  while l <= r:
    m = (l + r)//2
    if arr[m] == target:
      return True
    elif arr[m] > target:
      r = m - 1
    elif arr[m] < target:
      l = m + 1
  return False

def check(n_digits, exclude_set):
  for i in range(0, len(n_digits)):
    if binarySearch(exclude_set, n_digits[i]) == True:
      return False
  return True
for i in range(n, 10**5):
  tmp = i
  n_digits = []
  while tmp > 0:
    n_digits.append(tmp%10)
    tmp = int(tmp/10)
  #print n_digits
  if check(n_digits, exclude_set) == True:
    print i
    break
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a>b:
  print(str(b)*a)
 else:
  print(str(a)*b)

Fixed submission:
a,b = map(int, input().split())
if a>b:
    print(str(b)*a)
else:
    print(str(a)*b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
pp = list(map(int, input().split()))

cnt = 0

for i in range(n):
    if min(pp[:i + 1]) >= pp[i]:
        cnt += 1

print(cnt)

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

cnt = 0
min_val = 2 * 10 ** 5 + 1

for p in pp:
    if min_val >= p:
        cnt += 1
        min_val = p

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
pp = list(map(int, input().split()))

cnt = 0

for i in range(n):
    for p in pp[:i + 1]:
        if pp[i] > p:
            break
    else:
        cnt += 1

print(cnt)

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

cnt = 0
min_val = 2 * 10 ** 5 + 1

for p in pp:
    if min_val >= p:
        cnt += 1
        min_val = p

print(cnt)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
aa = list(map(int, input().split()))
aa.sort()
bc_list = [list(map(int, input().split())) for i in range(m)]
bc_list = sorted(bc_list, key=lambda x:x[1])

p = 0
for bc in bc_list[::-1]:
    for i in range(bc[0]):
        if aa[p] < bc[1]:
            aa[p] = bc[1]
            p += 1
        else:
            break
    else:
        continue
    break

print(sum(aa))

Fixed submission:
n,m = map(int,input().split())
aa = list(map(int, input().split()))
aa.sort()
bc_list = [list(map(int, input().split())) for i in range(m)]
bc_list = sorted(bc_list, key=lambda x:x[1])

p = 0
for bc in bc_list[::-1]:
    for i in range(bc[0]):
        if aa[p] < bc[1]:
            aa[p] = bc[1]
            p += 1
            if p > len(aa) - 1:
                break
        else:
            break
    else:
        continue
    break

print(sum(aa))
Buggy python submission (verdict: Time Limit Exceeded):
A,B = map(int,input().split())
ans = 0

jouzan = 0
if B >= 10**11:
    jouzan = 11
elif B >= 10**10:
    jouzan = 10
elif B >= 10**9:
    jouzan = 9
elif B >= 10**8:
    jouzan = 8
elif B >= 10**7:
    jouzan = 7
elif B >= 10**6:
    jouzan = 6
elif B >= 10**5:
    jouzan = 5
elif B >= 10**4:
    jouzan = 4

for i in range(A,B+1):
    if i == 10**2 and jouzan != 0:
        ans = ans ^ 10**jouzan
        i = 10**jouzan + 1
    if i == 10**3 and jouzan != 0:
        ans = ans ^ 10**jouzan
        i = 10**jouzan + 1
    if i == 10**4 and jouzan != 0:
        ans = ans ^ 10**jouzan
        i = 10**jouzan + 1
    if i == 10**5 and jouzan != 0:
        ans = ans ^ 10**jouzan
        i = 10**jouzan + 1
    if i == 10**6 and jouzan != 0:
        ans = ans ^ 10**jouzan
        i = 10**jouzan + 1
    if i == 10**7 and jouzan != 0:
        ans = ans ^ 10**jouzan
        i = 10**jouzan + 1
    if i == 10**8 and jouzan != 0:
        ans = ans ^ 10**jouzan
        i = 10**jouzan + 1
    if i == 10**9 and jouzan != 0:
        ans = ans ^ 10**jouzan
        i = 10**jouzan + 1
    if i == 10**10 and jouzan != 0:
        ans = ans ^ 10**jouzan
        i = 10**jouzan + 1
    
    ans = ans ^ i
    
print(ans)

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

def calc(a):
    cnt = (a + 1) / 2
    ans = int(cnt  % 2)
    if a % 2 == 0:
        ans ^= a
        
    return ans
    
print(calc(B)^calc(A-1))

Buggy python submission (verdict: Time Limit Exceeded):
A,B = map(int,input().split())
ans = 0
for i in range(A,B+1):
    ans = ans ^ i
    
print(ans)

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

def calc(a):
    cnt = (a + 1) / 2
    ans = int(cnt  % 2)
    if a % 2 == 0:
        ans ^= a
        
    return ans
    
print(calc(B)^calc(A-1))
Buggy python submission (verdict: Time Limit Exceeded):
import re
s = input()
first_len = len(s)
ans = 0

while True:
    s = s.replace("01","").replace("10","")
    if not re.search('01|10',s):
        break

# print(len(s),first_len - len(s),s)
print(first_len - len(s))

Fixed submission:
import re
s = input()
first_len = len(s)

ten_3_zo = "0" * 10 * 10 * 10 + "1" * 10 * 10 * 10
ten_3_oz = "1" * 10 * 10 * 10 + "0" * 10 * 10 * 10

ten_1_zo = "0" * 10 + "1" * 10
ten_1_oz = "1" * 10 + "0" * 10


while True:
    s = s.replace(ten_3_zo,"").replace(ten_3_oz,"")
    s = s.replace(ten_1_zo,"").replace(ten_1_oz,"")
    s = s.replace("01","").replace("10","")
    if not re.search('01|10',s):
        break

print(first_len - len(s))
Buggy python submission (verdict: Runtime Error):
# C Monsters Battle Royale
N = int(input())
Monsters = list(map(int, input().split()))
Monsters.sort()

ans = Monsters[0]
for i in range(len(Monsters) - 1):
    tempList = [val % Monsters[i] for val in Monsters[i+1:] if not val % Monsters[i] == 0]
    if tempList:
        if min(tempList) < ans:
            ans = a
        
print(ans)

Fixed submission:
N = int(input())
Mons = list(map(int, input().split()))
Mons = list(set(Mons))
Mons.sort()

minHP = Mons[0]

if minHP == 1 or len(Mons) == 1:
    print(minHP)
    exit()
    
minSA = minHP

for a,b in zip(Mons[:],Mons[1:]):
    sa = b % a
    if sa and sa < minSA:
        minSA = sa

ans = minSA

while 1:
    hoge = [val % ans for val in Mons if val % ans]

    if hoge:
        if ans == min(hoge):
            break
        else:
            ans = min(hoge)
    else:
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
k,a,b = map(int,input().split())
bis = 1
if ((k <= 1) or (b <= a + 2)):
    print(1+k)
    exit()
else:
    bis = b
    k = k - (a + 1)
    if not k == 0:
        bis += int(k/2)+(b-a)+k%2
print(bis)

Fixed submission:
# A Anti-Adjacency
n,k = map(int,input().split())
if int((n +1) / 2) >= k:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
k,a,b = map(int,input().split())
bis = 1
if k<= 1 or b <= a + 2:
    print(1+k)
    exit()
else:
    bis = b
    k = k - (a + 1)
    if not k == 0:
        bis += int(k/2)+(b-a)+k%2
print(bis)

Fixed submission:
# A Anti-Adjacency
n,k = map(int,input().split())
if int((n +1) / 2) >= k:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
# C When I hit my pocket
k,a,b = map(int,input().split())

bis = 1

if k <= 1 or b <= a + 2:
    print(1 + k)
    exit()
else:
    bis = b
    k = k - ( a + 1)
    if not k == 0:
        bis += int(k / 2) * (b - a) + k % 2

print(bis)

Fixed submission:
# A Anti-Adjacency
n,k = map(int,input().split())
if int((n +1) / 2) >= k:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
# C When I hit my pocket
k,a,b = map(int,input().split())

bis = 1

if k <= 1 or b <= a + 2 or k - (a + 1) < 0:
    print(1 + k)
    exit()
else:
    bis = b
    k = k - ( a + 1)
    if not k == 0:
        bis += int(k / 2) * (b - a) + k % 2

print(bis)

Fixed submission:
# A Anti-Adjacency
n,k = map(int,input().split())
if int((n +1) / 2) >= k:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
# C When I hit my pocket
k,a,b = map(int,input().split())

bis = 1

#print(k - (a + 1))
if k <= 1 or b <= a + 2 or k - (a + 1) < 0:
    print(1 + k)
    #print('true')
    exit()
else:
    bis = b
    k = k - ( a + 1)
    if not k == 0:
        bis += int(k / 2) * (b - a) + k % 2

print(bis)

Fixed submission:
# A Anti-Adjacency
n,k = map(int,input().split())
if int((n +1) / 2) >= k:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
# C Streamline
n,m = map(int,input().split())
Xs = list(map(int,input().split()))

if n >= m:
    print('0')
    exit()

Xs.sort()
XsDist = []

for i in range(len(Xs)):
    if not i == 0:
        XsDist.append(Xs[i] - Xs[i-1])

XsDist.sort()
print(sum(XsDist[:n+1]))

Fixed submission:
t,x = map(int,input().split())
print(t / x)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ABs = [list(map(int, input().split())) for i in range(n)]
ABs = [i for i in reversed(ABs)]

As,Bs = [],[]
for i in range(n):
    As.append(ABs[i][0])
    Bs.append(ABs[i][1])

cnt = 0
for i in range(n):
    plus = 0 if As[i] % Bs[i] == 0 else Bs[i] - As[i] % Bs[i]
    As[i:] = list(map(lambda x:x + plus , As[i:]))
    cnt += plus
    
print(cnt)

Fixed submission:
n = int(input())
ABs = [list(map(int, input().split())) for i in range(n)]
cnt = 0
for i in range(n):
    plus = 0 if (ABs[n-i-1][0] + cnt) % ABs[n-i-1][1] == 0 else ABs[n-i-1][1] - (ABs[n-i-1][0] + cnt) % ABs[n-i-1][1]
    cnt += plus
print(cnt)