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

Fixed submission:
def main():
    n,m,c = tuple([int(t)for t in input().split()])
    b = tuple([int(t)for t in input().split()]) 
    ans = 0
    for _ in [0]*n:
      t = tuple([int(t)for t in input().split()])
      v = c
      for i in range(m):
        v+=b[i]*t[i]
      if v>0:
          ans+=1
    print(ans)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n,m,c = tuple([int(t)for t in input().split()])
	b = tuple([int(t)for t in input().split()])
    
    ans = 0
    for _ in [0]*n:
      	t = tuple([int(t)for t in input().split()])
        v = c
		for i in range(m):
            v+=b[m]*t[m]
        if v>0:
          ans+=1
    print(ans)
if __name__ == "__main__":
    main()
Problem p03126 (python)

Fixed submission:
n,m = tuple(map(int,input().split()))

check = [0]*m

for i in range(n):
  for a_i in tuple(map(int,input().split()))[1:]:
    check[a_i-1]+=1
    
print(check.count(n))

Buggy submission (verdict: Runtime Error):
n,m = tuple(map(int,input()))

check = [0]*m

for i in range(n):
  for a_i in tuple(map(int,input()))[1:]:
    check[a_i]+=1
    
print(check.count(n))
Problem p03147 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
def watering(l,a,b):
  if b==a:
    return 0
  if b-a <= 1:
    return l[a]
  
  c = 0
  t = a
  
  mi = min(l[a:b])
  for i in range(a,b):
    l[i] -= mi
    
  for i in range(a,b):
    if l[i]==0:
      c += watering(l,t,i)
      t=i+1
  c += watering(l,t,b)
      
  return c+mi

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

print(watering(h,0,n))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)
def watering(l,a,b):
  if b-a <= 1:
    return l[a]
  
  c = 0
  t = a
  
  mi = min(l[a:b])
  for i in range(a,b):
    l[i] -= mi
    
  for i in range(a,b):
    if l[i]==0:
      c += watering(l,t,i)
      t=i+1
  c += watering(l,t,b)
      
  return c+mi

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

print(watering(h,0,n))
Problem p03254 (python)

Fixed submission:
n,x = tuple(map(int,input().split()))
a = tuple(map(int,input().split()))
a = sorted(a)
ans=0

for a_i in a:
  x -= a_i
  if x<0:
    break
  else:
    ans+=1

if x>0:
  ans-=1

print(ans)

Buggy submission (verdict: Runtime Error):
n,x = tuple(map(int,input().split()))
a = tuple(map(int,input().split()))
a = sorted(a,reverse=True)

t = a.pop()
ans = 0
while x>=t:
  ans+=1
  x-=t
  t=a.pop()
  
print(ans)
Problem p03263 (python)

Fixed submission:
h,w = tuple(map(int,input().split()))

a = [[int(t)for t in input().split()]for _ in [0]*h]

steps = []
for i in range(h):
  if i%2==0:
    for j in range(w-1):
      if a[i][j]%2==1:
        steps.append((i+1,j+1,i+1,j+2))
        a[i][j+1]+=1
    if i!=h-1 and a[i][-1]%2==1:
      steps.append((i+1,w,i+2,w))
      a[i+1][-1] +=1
  else:
    for j in range(1,w)[::-1]:
      if a[i][j]%2==1:
        steps.append((i+1,j+1,i+1,j))
        a[i][j-1]+=1
    if i!=h-1 and a[i][0]%2==1:
      steps.append((i+1,1,i+2,1))
      a[i+1][0] +=1

    
print(len(steps))
for s in steps:
  print(*s)

Buggy submission (verdict: Runtime Error):
h,w = tuple(map(int,input().split()))

a = [[int(t)for t in input().split()]for _ in [0]*h]

steps = []
for i in range(h):
  for j in range(w-1):
    if a[i][j]%2==1:
      steps.append((i,j,i,j+1))
      a[i][j+1]+=1

for i in range(h-1):
  if a[i][w-1]%2==1:
    steps.append((i,j,i+1,j))
    
print(len(steps))
for s in steps:
  print(*s)
Problem p03282 (python)

Fixed submission:
s = list(input())

k = int(input())

p = -1
for i in range(len(s)):
  if s[i]!='1':
    p=i
    break

if p==-1:
  print(1)
else:
  if k<p+1:
    print(1)
  else:
    print(s[p])

Buggy submission (verdict: Runtime Error):
s = list(input())

k = int(input())

p = -1
for i in range(len(s)):
  if s[i]!='1':
    p=i+1

if p=-1:
  print(1)
else:
  if k<p:
    print(1)
  else:
    print(s[p])
Problem p03289 (python)

Fixed submission:
s = list(input())

if s[0]!="A":
  print("WA")
  exit()

frag = True
for i in range(2,len(s)-1):
  if s[i]=='C':
    frag = False
    del s[i]
    break

if frag:
  print("WA")
  exit()
  
if not "".join(s[1:]).islower():
  print("WA")
else:
  print("AC")

Buggy submission (verdict: Runtime Error):
s = list(input())

if s[0]!="A":
  print("WA")
  exit()

frag = True
for i in range(2,len(s)-2):
  if s[i]=='C':
    frag = False
    del s[i]

if frag:
  print("WA")
  exit()
  
if not "".join(s[1:]).islower():
  print("WA")
else:
  print("AC")
Problem p03352 (python)

Fixed submission:
x = int(input())
if x == 1:
  print(1)
elif x==2:
  print(1)
else:
  candidates = []
  for i in range(x):
    for j in range(2,x):
      t = i**j
      if x>=t:
        candidates.append(t)
      else:
        break
  print(max(candidates))

Buggy submission (verdict: Runtime Error):
x = int(input())
candidates = []
for i in range(x):
  for j in range(2,x):
    t = i**j
    if x>=t:
      candidates.append(t)
    else:
      break
print(max(candidates))
Problem p03474 (python)

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

s = list(input())[::-1]

for _ in [0]*a:
  if not s.pop().isdigit():
    print("No")
    exit()
if s.pop() != '-':
    print("No")
    exit()

for _ in [0]*b:
  if not s.pop().isdigit():
    print("No")
    exit()
print("Yes")

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

s = list(input())[::-1]

for _ in [0]*a:
  if not s.pop().isdigit():
    print("No")
    exit()
if s.pop() != '-'
    print("No")
    exit()

for _ in [0]*b:
  if not s.pop().isdigit():
    print("No")
    exit()
print("Yes")
Problem p03481 (python)

Fixed submission:
x,y = tuple(map(int,input().split()))

for i in range(1,10**18):
  x<<=1
  if x>y:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
x,y = tuple(map(int,input().split()))

for i in range(1,10*4):
  x<<=1
  if x>y:
    print(i)
	break
Problem p03496 (python)

Fixed submission:
import math
from collections import deque
def main():
    n = int(input())
    a = [int(t)for t in input().split()]

    if all([a_i>0 for a_i in a]):
        print(n-1)
        for i in range(n-1):
            print(i+1,i+2)
        
    elif all([a_i<=0 for a_i in a]):
        print(n-1)
        for i in range(2,n+1)[::-1]:
            print(i,i-1)
    else:
        if abs(min(a))<max(a):
            print(2*n-1)
            pos = a.index(max(a))  
            for i in range(n):
                print(pos+1,i+1)
            for i in range(n-1):
                print(i+1,i+2)


        else:
            print(2*n-1)
            pos = a.index(min(a))
            for i in range(n):
                print(pos+1,i+1)  
            
            for i in range(2,n+1)[::-1]:
                print(i,i-1)
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math
from collections import deque
def main():
    n = int(input())
    a = [int(t)for t in input().split()]

    if all([a_i>0 for a_i in a]):
        print(n-1)
        for i in range(n-1):
            print(i+1,i+2)
        
    elif all([a_i<=0 for a_i in a]):
        print(n-1)
        for i in range(2,n+1)[::-1]:
            print(i,i-1)
    else:
        if abs(min(a))<max(a):
            print(2*n-1)
            pos = list.index(max(a))  
            for i in range(n):
                print(pos,i+1)
            for i in range(2,n+1)[::-1]:
                print(i,i-1)


        else:
            print(2*n-1)
            pos = list.index(min(a))
            for i in range(n):
                print(pos,i+1)  
            
            for i in range(2,n+1)[::-1]:
                print(i,i-1)
    
if __name__ == "__main__":
    main()
Problem p03568 (python)

Fixed submission:
import itertools

n = int(input())
a = tuple(map(int,input().split()))
ans = 0
for l in itertools.product([-1,0,1],repeat=n):
  t = 1
  for i in range(n):
    t*=(a[i]+l[i])
  if t%2==0:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n = int(input())
a = tuple(map(int,input().split()))
ans = 0
for l in itertools.product([-1,0,1],n):
  t = 1
  for i in range(n):
    t*=(a[i]+l[i])
  if t%2==0:
    ans+=1
print(ans)
Problem p03569 (python)

Fixed submission:
from collections import deque
def main():

    s = deque(input())

    

    ans = 0
    while len(s)>1:
        if s[0]==s[-1]:
            s.popleft()
            s.pop()
            continue
        if s[0]!='x' and s[-1]!='x':
            ans = -1
            break
        if s[0]=='x':
            ans+=1
            s.popleft()
        if s[-1]=='x':
            ans+=1
            s.pop()
    
    print(ans)

if __name__ == "__main__":
    main()

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

    s = deque(input())

    

    ans = 0
    while s!=[]:
        if s[0]==s[-1]:
            s.popleft()
            if len(s)>0:
                s.pop()
            else:
                break
            continue
        if s[0]!='x' and s[-1]!='x':
            ans = -1
            break
        if s[0]=='x':
            ans+=1
            s.popleft()
        if s[-1]=='x':
            ans+=1
            s.pop()
    
    print(ans)

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

Fixed submission:
n = int(input())
k = int(input())
 
x = tuple([int(t)for t in input().split()]) 
 
ans = 0
for x_i in x:
  if k-x_i>x_i:
    ans+=x_i*2
  else:
    ans+=(k-x_i)*2
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
k = int(input())
 
x = tuple([int(t)for t in input().split()]) 
 
ans = 0
for x_i in x:
  if k-x>x:
    ans+=x*2
  else:
    ans+=(k-x)*2
Problem p03624 (python)

Fixed submission:
s = set(list("abcdefghijklmnopqrstuvwxyz"))-set(list(input()))
if len(s)==0:
  print("None")
else:
  print(min(s))

Buggy submission (verdict: Runtime Error):
s = set(list("abcdefghijklmnopqrstuvwxyz"))-set(list(input()))
if len(s)==0:
  print("None")
else:
  print(s[0])
Problem p03679 (python)

Fixed submission:
x,a,b = tuple(map(int,input().split()))
 
if a-b>=0 :
  print("delicious")
elif b-a<=x:
  print("safe")
else:
  print("dangerous")

Buggy submission (verdict: Runtime Error):
x,y = tuple(map(int,input().split()))

for i in range(1,10*18):
  x<<=1
  if x>y:
    print(i)
    break

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

if b-a=<x:
  print("delicious")
else:
  print("dangerous")
Problem p03682 (python)

Fixed submission:
class UnionFind:
    def __init__(self,n):
        super().__init__()
        self.par = [-1]*n
        self.rank = [0]*n
        self.tsize = [1]*n
    
    def root(self,x):
        if self.par[x] == -1:
            return x 
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x_r = self.root(x)
        y_r = self.root(y)
        
        if self.rank[x_r]>self.rank[y_r]:
            self.par[y_r] = x_r

        elif self.rank[x_r]<self.rank[y_r]:
            self.par[x_r] = y_r

        elif x_r != y_r:
            self.par[y_r] = x_r
            self.rank[x_r] += 1

        if x_r != y_r:
            size = self.tsize[x_r]+self.tsize[y_r]
            self.tsize[x_r] = size
            self.tsize[y_r] = size

    def isSame(self,x,y):
        return self.root(x) == self.root(y)

    def size(self,x):
        return self.tsize[self.root(x)]

def main():

    n= int(input())
    edge = []
    for i in range(n):
      x,y = list(map(int,input().split()))
      edge.append((x,y,i))
    
    xs = sorted(edge,key=lambda a:a[0])
    ys = sorted(edge,key=lambda a:a[1])

    edge = []
    
    for i in range(n-1):
      x1,y1,p1 = xs[i]
      x2,y2,p2 = xs[i+1]
      edge.append((p1,p2,min(x2-x1,abs(y2-y1))))
      
      x1,y1,p1 = ys[i]
      x2,y2,p2 = ys[i+1]
      edge.append((p1,p2,min(abs(x2-x1),y2-y1)))
    edge.sort(key = lambda a:a[2])  
    uf = UnionFind(n)
    
    ans = 0
    for x,y,w in edge:
      if uf.isSame(x,y):continue
      uf.unite(x,y)
      ans+=w
    print(ans)
      
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
    def prim(self):
        gb = GraphBuilder(self.v,self.directed)

        queue = []
        for i,w in self.w_e[0].items(): heapq.heappush(queue,(w,0,i))
        rest = [True]*self.v
        rest[0] = False

        v = 1
        while len(queue)>0:
            w,i,j = heapq.heappop(queue)
            if rest[j]:
                gb.addEdge(i,j,w)
                rest[j] = False
                for k,w in self.w_e[j].items():
                    if rest[k]:heapq.heappush(queue,(w,j,k))

        return gb
Problem p03827 (python)

Fixed submission:
n = int(input())

s = input()
x = 0
ans = 0
for c in s:
  if c=='I':
    x+=1
    ans = max(x,ans)
  else:
    x-=1
print(ans)

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

s = input()
x = 0
ans = 0
for c in s:
  if c=='I'
  	x+=1
    ans = max(x,ans)
  else:
    x-=1
print(ans)
Problem p03853 (python)

Fixed submission:
h,w = tuple(map(int,input().split()))

s = [input() for _ in range(h)]

for s_i in s:
  print(s_i)
  print(s_i)

Buggy submission (verdict: Runtime Error):
h,w = tuple(map(int,input().split()))

s = [input() for_ in range(h)]

for s_i in s:
  print(s_i)
  print(s_i)

Buggy submission (verdict: Runtime Error):
h,w = tuple(map(int,input().split()))

s = [input() for_ in range(h)]

for s_i in s:
  print(*s_i,sep='')
  print(*s_i,sep='')
Problem p03993 (python)

Fixed submission:
n = int(input())
a = tuple(map(lambda a:int(a)-1,input().split()))

ans = 0
for i in range(n):
  if a[a[i]]==i:
    ans+=1
print(ans//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = tuple(map(lambda a:int(a)-1,input()))

ans = 0
for i in range(n):
  if a[a[i]]==i:
    ans+=1
print(ans//2)
Problem p04012 (python)

Fixed submission:
from collections import Counter

s = list(input())

c = Counter(s)

for i in c.values():
  if i%2!=0:
    print("No")
    exit()
print("Yes")

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

s = input()

c = Counter(s)

for i in c:
  if i%2!=0:
    print("No")
    exit()
print("Yes")
Problem p04019 (python)

Fixed submission:
s = set(list(input()))

if 'N' in s:
  if not 'S' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()
    
if 'S' in s:
  if not 'N' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()

if 'W' in s:
  if not 'E' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()

if 'E' in s:
  if not 'W' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()
    
print("No")

Buggy submission (verdict: Runtime Error):
s = set(list(input()))

if 'N' in s:
  if not 'S' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()
    
if 'S' in s:
  if not 'N' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()

if 'W' in s:
  if not 'E' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()

if 'E' in s:
  if not 'W' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()
print("No")
Problem p04033 (python)

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

if a<=0 and b>=0:
  print("Zero")
elif a<0 and b<0:
  if (b-a+1)%2==0:
  	print("Positive")
  else:
    print("Negative")
elif a>0 and b>0:
  print("Positive")

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

if a=<0 and b>=0:
  print("Zero")
elif a<0 and b<0:
  if (b-a+1)%2==0:
  	print("Positive")
  else:
    print("Negative")
elif a>0 and b>0:
  print("Positive")
Problem p02741 (python)

Fixed submission:
A = [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(A[k-1])

Buggy submission (verdict: Runtime Error):
def main():
    a = input()
    b = input()
    c = input()
    A, B, C = len(a), len(b), len(c)
    ab = [True]*10000
    ac = [True]*10000
    bc = [True]*10000

    def check(c1, c2):
        if c1 == '?' or c2 == '?' or c1 == c2:
            return False
        return True

    for i in range(A):
        for j in range(B):
            if check(a[i], b[j]):
                ab[i-j+5000] = False
    for i in range(A):
        for j in range(C):
            if check(a[i], c[j]):
                ac[i-j+5000] = False
    for i in range(B):
        for j in range(C):
            if check(b[i], c[j]):
                bc[i-j+5000] = False
    ans = A + B + C
    for i in range(-(B+C), A+C):
        for j in range(-(B+C), A+B):
            if ab[i+5000] and ac[j+5000] and bc[j-i+5000]:
                L = min(0, i, j)
                R = max(A, i+B, j+C)
                ans = min(ans, R - L)
    print(ans)


main()
Problem p02838 (python)

Fixed submission:

mod = 10**9 + 7


def main():
    n = int(input())
    A = [int(a) for a in input().split()]
    ans = 0
    for k in range(60):
        a = 0
        for i in range(n):
            a += A[i] & 1
            A[i] >>= 1
        da = (1 << k) % mod
        da *= (n - a)*a
        da %= mod
        ans += da
        ans %= mod
    print(ans)


main()

Buggy submission (verdict: Runtime Error):

mod = 10**9 + 7


def main():
    n = int(input())
    A = [int(a) for a in input().split()]
    ans = 0
    for k in range(60):
        a = 0
        for i in range(n):
            a += A[i] & 1
            A[i] << = 1
        da = (1 << k) % mod
        da *= (n - a)*a
        da %= mod
        ans += da
        ans %= mod
    print(ans)


main()
Problem p02900 (python)

Fixed submission:
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

a,b = map(int, input().split())
g = gcd(a,b)
N = int(g**0.5)
ans = 1
for i in range(2, N+1):
  if g%i==0:
    ans += 1
  while(g%i==0):
    g /= i
if g != 1:
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

def main():
  a,b = map(int, input().split())
  g = gcd(a,b)
  N = int(g**0.5)
  ans = 1
  for i in range(2, N+1):
    if g%i==0:
	  ans += 1
    while(g%i==0):
      g /= i
  if g != 1:
    ans += 1
  print(ans)

main()

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

int main():
  a,b = map(int, input().split())
  g = gcd(a,b)
  N = int(g*0.5)
  ans = 1
  for i in range(2, N+1):
    flag = 0
    while(g%i==0):
      g /= i
      flag = 1
    ans += flag
  if g != 1:
    ans += 1
  print(ans)

main()
Problem p03359 (python)

Fixed submission:
a,b = map(int,input().split())
if a>b:
    print(a-1)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
if a<b:
    print(a-1)
else:
    print(a)
Problem p02576 (python)

Fixed submission:
n = []
n = input().split()
n_1 = int(n[0])
x = int(n[1])
t = int(n[2])
 
if(n_1%x==0):
  count,mod = divmod(n_1,x)
else:
  count,mod = divmod(n_1,x)
  count = count + 1
 
print(count*t)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = int(input())
t = int(input())
 
if(n%x==0):
  count,mod = divmod(n,x)
else:
  count,mod = divmod(n,x)
  count = count + 1
 
print(count*t)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = int(input())
t = int(input())
 
if(n%x==0):
  count = n // x
else:
  count = n // x + 1
 
print(count*t)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = int(input())
t = int(input())
 
if(n%x==0):
  count = n//x
else:
  count = n//x + 1
 
print(count*t)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = int(input())
t = int(input())

if(n%x==0):
  count = n/x
else:
  count = n/x + 1

print(count*t)
Problem p02641 (python)

Fixed submission:
from bisect import bisect

X, N = [int(n) for n in input().split()]
if N==0:
    print(X)
else:
    P = sorted([int(n) for n in input().split()])
    if X not in P:
        print(X)
        exit()
    idx = bisect(P, X)
    ans_r = 101
    ans_l = 0
    for i in range(P[idx-1], 101):
        if i not in P:
            ans_r = i
            break
    for j in range(1, P[idx-1]):
        if j not in P:
            ans_l = j
    if abs(X-ans_l) == abs(ans_r-X):
        print(min([ans_l, ans_r]))
    else:
        print(ans_l if abs(X-ans_l) < abs(ans_r-X) else ans_r)

Buggy submission (verdict: Runtime Error):
from bisect import bisect

X, N = [int(n) for n in input().split()]
if N==0:
    print(X)
else:
    P = sorted([int(n) for n in input().split()])
    idx = bisect(P, X)
    for i in range(P[idx-1], 101):
        if i not in P:
            ans_r = i
            break
    for j in range(1, P[idx-1]):
        if j not in P:
            ans_l = j
    if abs(X-ans_l) == abs(ans_r-X):
        print(min([ans_l, ans_r]))
    else:
        print(ans_l if abs(X-ans_l) < abs(ans_r-X) else ans_r)

Buggy submission (verdict: Runtime Error):
from bisect import bisect

X, N = [int(n) for n in input().split()]
if N==0:
    print(X)
else:
    P = sorted([int(n) for n in input().split()])
    idx = bisect(P, X)
    for i in range(P[idx-1], 101):
        if i not in P:
            ans_r = i
            break
    for j in range(1, P[idx-1]):
        if j not in P:
            ans_l = j
    if abs(X-ans_l) == abs(ans_r-X):
        print(min(ans_l, ans_r))
    else:
        print(ans_l if abs(X-ans_l) < abs(ans_r-X) else ans_r)
Problem p02719 (python)

Fixed submission:
N, K = [int(n) for n in input().split()]
print(min(N%K, K-(N%K)))

Buggy submission (verdict: Runtime Error):
import math

N, K = [int(n) for n in input().split()]
print(0 if K==1 or N==0 else math.gcd(N, K))

Buggy submission (verdict: Runtime Error):
import math

N, K = [int(n) for n in input().split()]
print(0 if K==1 else math.gcd(N, K))
Problem p02797 (python)

Fixed submission:
N, K, S = [int(n) for n in input().split()]
ans = []
for i in range(N-K):
    ans.append(S+1 if S<10**9 else 1)
for j in range(K):
    ans.append(S)
print(" ".join([str(n) for n in ans]))

Buggy submission (verdict: Runtime Error):
from itertools import combinations_with_replacement

N, K, S = [int(n) for n in input().split()]
ans = []
for i in rrange(N-K):
    ans.append(1)
for j in range(K):
    ans.append(S)
print(ans)
Problem p02946 (python)

Fixed submission:
K, X = [int(n) for n in input().split()]
print(" ".join([str(n) for n in range(X-(K-1), X+(K))]))

Buggy submission (verdict: Runtime Error):
K, X = [int(n) for n in input().split()]
print(" ".join([n for n in range(X-(K-1), X+(K-1))]))

Buggy submission (verdict: Runtime Error):
K, X = [int(n) for n in input().split()]
print(" ".join([n for n in range(X-(K-1), X+(K-1)]))
Problem p02953 (python)

Fixed submission:
N = int(input())
H = [int(n) for n in input().split()]
m = H[N-1]
ans = 'Yes'
for i in range(0, N-1)[::-1]:
    if H[i] > m+1:
        ans = 'No'
        break
    elif H[i] == m+1:
        m = H[i]-1
    else:
        m = H[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(n) for n in input().split()]
m = H[N-1]
for i in range(0, N-1)[::-1]:
    if H[i] > m+1:
        return 'No'
    else:
        m = H[i]
return 'Yes'
Problem p02999 (python)

Fixed submission:
x, a = [int(n) for n in input().split()]
print(0 if x < a else 10)

Buggy submission (verdict: Runtime Error):
x, a = [int(n) for n in input().split()]
return 0 if x < a else 10
Problem p03085 (python)

Fixed submission:
o = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'}
b = input()
print(o[b])

Buggy submission (verdict: Runtime Error):
N,Q=[int(n) for n in input().split(' ')]
S=input()
a=''
for i in range(Q):
  l,r=[int(n) for n in input().split(' ')]
  a=a+str(S[l-1:r].count('AC'))+'\n'
print(a)
Problem p03145 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a,b,c = map(int, input().split())
print(a*b//2)

Buggy submission (verdict: Runtime Error):
a,b,c = [int(n) for n in input.split(" ")]
print(a*b/2)
Problem p03206 (python)

Fixed submission:
D = int(input())
print("Christmas" + " Eve"*(25-D))

Buggy submission (verdict: Runtime Error):
D = int(input())
print(f"Christmas {Eve*(25-D)}")