Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
Nj = N
if (K == 1) or (N==K):
    print(0)
while (Nj == K) is False:
    Ni = Nj
    Nj = abs(Ni - K)
    if Nj == K:
        print(0)
        break
    elif Nj > Ni:
        print(Ni)
        break
    else:
        continue

Fixed submission:
n,k = map(int,input().split())
if n % k ==0:
    print(0)
else:
    l = [n]
    p = n//k
    c = n-(p*k)
    half = k//2
    while c > half:
        c = abs(c-k)
    l.append(c)
    print(min(l))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
Nj = N
while True:
    Ni = Nj
    Nj = abs(Ni - K)
    if K == 1 or Nj == K:
        print(0)
        break
    elif Nj > Ni:
        print(Ni)
        break
    else:
        continue


Fixed submission:
n,k = map(int,input().split())
if n % k ==0:
    print(0)
else:
    l = [n]
    p = n//k
    c = n-(p*k)
    half = k//2
    while c > half:
        c = abs(c-k)
    l.append(c)
    print(min(l))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
Nj = N
while True:
    Ni = Nj
    Nj = abs(Ni - K)
    if Ni > N:
        print(N)
        break
    elif Nj > Ni:
        print(Ni)
        break
    elif K == 1 or Nj == K:
        print(0)
        break
    else:
        continue


Fixed submission:
n,k = map(int,input().split())
if n % k ==0:
    print(0)
else:
    l = [n]
    p = n//k
    c = n-(p*k)
    half = k//2
    while c > half:
        c = abs(c-k)
    l.append(c)
    print(min(l))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
Nj = N
while True:
    Ni = Nj
    Nj = abs(Ni - K)
    if Ni > N:
        print(N)
        break
    elif Nj > Ni:
        print(Ni)
        break
    elif K == 1 or N == K:
        print(0)
        break
    else:
        continue


Fixed submission:
n,k = map(int,input().split())
if n % k ==0:
    print(0)
else:
    l = [n]
    p = n//k
    c = n-(p*k)
    half = k//2
    while c > half:
        c = abs(c-k)
    l.append(c)
    print(min(l))
Buggy python submission (verdict: Runtime Error):
D, T, S = map(int, input()).split()
if T*S <= D:
  print('Yes')
else: 
  print('No')

Fixed submission:
D, T, S = list(map(int, input().split()))
if T*S >= D:
  print('Yes')
else: 
  print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = int(input())
T = int(input())
temp = 0
while (N > 0):
    N = N - X
    temp += 1
print(T*temp)

Fixed submission:
N, X, T = map(int, input().split())
temp = 0
while (N > 0):
    N = N - X
    temp += 1
print(T*temp)
Buggy python submission (verdict: Runtime Error):
N = int(input())
sum = 0 
while(N != 0):
    sum += (N%10)
    N /= 10
if sum % 9 == 0:
    print('Yes')
else: 
  print('No')

Fixed submission:
N = int(input())
sumN = sum(int(digit) for digit in str(N))
if sumN%9 == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
sum = 0 
while(N != 0):
    sum += (N%10)
    N /= 10
if sum % 9 == 0:
    print('Yes')
else: print('No')

Fixed submission:
N = int(input())
sumN = sum(int(digit) for digit in str(N))
if sumN%9 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
S = raw_input()
print(max(map(len, S.split('S'))))

Fixed submission:
S = input()
print(max(map(len, S.split('S'))))

Buggy python submission (verdict: Runtime Error):
S = input()
A = split(S)
count = 0
for i in range(len(S)):
  if(S[i] == 'R'):
    count += 1
print(count)

Fixed submission:
S = input()
print(max(map(len, S.split('S'))))
Buggy python submission (verdict: Runtime Error):
K = int(input())
S = raw_input()
if (len(S) == K):
  print(S)
else: print(S[0:K] + '...')

Fixed submission:
K = int(input())
S = input()
if (len(S) <= K):
  print(S)
else: print(S[0:K] + '...')

Buggy python submission (verdict: Runtime Error):
K = int(input())
S = input()
if (len(S) == K):
  print(S)
else: print( S[0:K].join('...')

Fixed submission:
K = int(input())
S = input()
if (len(S) <= K):
  print(S)
else: print(S[0:K] + '...')
Buggy python submission (verdict: Runtime Error):
s = int(input())
w = int(input())
if s <= w:
  print "unsafe"
else:
  print "safe"

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

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

Fixed submission:
s, w = map(int, input().split())
print("unsafe" if s<=w else "safe")
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input()split())
while (a>0 and c>0):
  c = c - b 
  if c <= 0:
    break
  a = a - d
print("Yes" if c <= 0 else "No")

Fixed submission:
A, B, C, D = map(int, input().split())
while (A>0 and C > 0):
    C = C - B
    if C <= 0:
        break
    A = A - D
print("Yes" if C<=0 else "No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int (input())

if A == 0:
    print 0 
else: 
    print(  N - 2 )

Fixed submission:
n, a, b = map(int, input().split())
period = a+b
times = n//period
k = n%period
n =  a if k >a else k
print(times*a + n)
Buggy python submission (verdict: Runtime Error):
N, R = int(input())
if N >= 10:
  print(R)
else: 
  print ( 100 * (10 - R) + N)

Fixed submission:
N, R = map(int, input().split())
if N >= 10:
  print(R)
else:
  print( 100 * (10 - N) + R )

Buggy python submission (verdict: Runtime Error):

def hello():
    N = int(input()) 
    R = int(input())
    if N >= 10: 
        print R 
    else: 
        print 100 * ( 10 - N ) + R
hello()

Fixed submission:
N, R = map(int, input().split())
if N >= 10:
  print(R)
else:
  print( 100 * (10 - N) + R )

Buggy python submission (verdict: Runtime Error):
N = int(input())
R = int(input())
if N >= 10: 
  return R 
else: 
  return 100 * ( 10 - N ) + R


Fixed submission:
N, R = map(int, input().split())
if N >= 10:
  print(R)
else:
  print( 100 * (10 - N) + R )
Buggy python submission (verdict: Runtime Error):
N = int(input())
total = 0 
X = list( input().split())
for i in X: 
    total +=  (X[i] - N) * (X[i] - N)
print(total)
  

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
M = round(sum(X)/N)
ans = 0
for i in X:
    ans+=(i-M)**2
print(ans)
Buggy python submission (verdict: Runtime Error):
numOfK = input()
numOfN = input()

if numOfK * 500 > numOfN:
  print("Yes")
else:
  print("No")

Fixed submission:
[K, X] = [int(x) for x in input().split()]
if K * 500 >= X:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
str = inpit().split()
print(str[1]+str=[0])

Fixed submission:
string = input().split()
print(string[1]+string[0])
Buggy python submission (verdict: Runtime Error):
N = int(input())

print(round((N/3)**3, '.15f'))

Fixed submission:
N = int(input())

print((N/3)**3)

Buggy python submission (verdict: Runtime Error):
from decimal import *
N = input()

# print(Decimal(N) // Decimal(3))
print(N**3 // 27)

Fixed submission:
N = int(input())

print((N/3)**3)
Buggy python submission (verdict: Runtime Error):
import itertools

n = input()

p_list = list(int, input().split())
q_list = list(int, input().split())

num_list = [i+1 for i in range(n)]

a = 0
b = 0

for i, v in enumerate(itertools.permutations(num_list, n)): 
    print(v) 
    if(list(v) == p_list):
        a = i
    if(list(v) == q_list):
        b = i
print(abs(a - b))

Fixed submission:
import itertools

n = int(input())

p_list = [int(i) for i in input().split()]
q_list = [int(i) for i in input().split()]

num_list = [i+1 for i in range(n)]

a = 0
b = 0

for i, v in enumerate(itertools.permutations(num_list, n)): 
    if(list(v) == p_list):
        a = i
    if(list(v) == q_list):
        b = i
print(abs(a - b))
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
i = 0
while i<=a:
  turu = 2*(a-i)
  kame = 4*i
  
  if b == turu:
    print('YES')
    
  if b == kame:
    print('YES')
  
  amari = b - turu
  if amari == 0:
    print('YES')
    break

  if kame !=0:
    if amari % kame == 0:
      print('YES')
      break
      
  i = i + 1
  
else:
  print('No)

Fixed submission:
a,b = map(int, input().split())
i = 0
while i<=a:
  turu = 2*(a-i)
  kame = 4*i
  ans = turu + kame
  if ans == b:
    print('Yes')
    break
  i = i + 1
  
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
i = 0
while i<a:
  turu = 2*(a-i)
  kame = 4*i
  
  amari = b % turu
  if amari == 0:
    print('YES')
    break

  if kame !=0:
    if amari % kame == 0:
      print('YES')
      break
      
  i = i + 1
  
else:
  print('No)
      
      

Fixed submission:
a,b = map(int, input().split())
i = 0
while i<=a:
  turu = 2*(a-i)
  kame = 4*i
  ans = turu + kame
  if ans == b:
    print('Yes')
    break
  i = i + 1
  
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
x,n = map(int, input().split())
if n ==0:
  print(x)
if n != 0:
  i = list(map(int, input().split()))


  
if x not in i:
  print(x)
  break
  
else:
  p = 1
  while True:
    z = x - p
    if z not in i:
      print(z)
      break
        
    z = x + p
    if z not in i:
      print(z)
      break
        
    p = p +1
        

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


  
  if x not in i:
    print(x)
  
  else:
    p = 1
    while True:
      z = x - p
      if z not in i:
        print(z)
        break
        
      z = x + p
      if z not in i:
        print(z)
        break
        
      p = p +1

Buggy python submission (verdict: Runtime Error):
x,n = map(int, input().split())
i = list(map(int, input().split()))

if n ==0:
  print(x)
  
if x not in i:
  print(x)
  
  else:
    p = 1
    while True:
      z = x - p
      if z not in i:
        print(z)
        break
        
      z = x + p
      if z not in i:
        print(z)
        break
        
      p = p +1
        
      
        
      
      
      
    
  
  



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


  
  if x not in i:
    print(x)
  
  else:
    p = 1
    while True:
      z = x - p
      if z not in i:
        print(z)
        break
        
      z = x + p
      if z not in i:
        print(z)
        break
        
      p = p +1

Buggy python submission (verdict: Runtime Error):
x,n = map(int, input().split())
i = list(map(int, input().split()))

if n ==0:
  print(x)
  
if x not in i:
  print(x)
  
  else:
    p = 1
    while True:
      z = x - p
      if z not in i:
        print(z)
        break
        
      z = x + p
      if z not in i:
        print(z)
        break
        
      p = p +1
        
      
        
      
      
      
    
  
  



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


  
  if x not in i:
    print(x)
  
  else:
    p = 1
    while True:
      z = x - p
      if z not in i:
        print(z)
        break
        
      z = x + p
      if z not in i:
        print(z)
        break
        
      p = p +1

Buggy python submission (verdict: Runtime Error):
x,n = map(int, input().split())
i = list(map(int, input().split()))

if n ==0:
  print(x)
  
if x not in i:
  print(x)
  
  else:
    p = 1
    while True:
      z = x - p
      if z not in i:
        print(z)
        break
        
      z = x + p
      if z not in i:
        print(z)
        break
        
      p = p +1
        
      
        
      
      
      
    
  
  



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


  
  if x not in i:
    print(x)
  
  else:
    p = 1
    while True:
      z = x - p
      if z not in i:
        print(z)
        break
        
      z = x + p
      if z not in i:
        print(z)
        break
        
      p = p +1
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())

A,B = B,C
A,C = C,A

print(A,B,C)

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

A,C = C,A
print(A,B,C)

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

A_b = B
B_a = A

A_c = C
C_a = A_b
print(A_c,B_a,C_a)

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

A,C = C,A
print(A,B,C)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

n = int(input())

a = []

for i in range(n):
    a.append(int(input()))

a_max = max(a)

for i in range(0,n):
    if a[i] == a_max:
        a1 = a[:i]
        a2 = a[i+1:]

        if len(a1) == 0:
                print(max(a2))
        elif len(a2) == 0:
            print(max(a1)) 
        else:
            print(max(max(a1), max(a2)))
    else:
        print(a_max)

    


Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())

a = []

for i in range(n):
    a.append((i, int(input())))

a_sorted = sorted(a, key = lambda k:k[1])
max_index = a_sorted[-1][0]

#print(a_sorted)

a_max = a_sorted[-1][1]
a_sec_max = a_sorted[-2][1]

for i in range(0,n):
    if i != max_index:
        print(a_max)
    else:
        print(a_sec_max)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

n = int(input())

a = []

for i in range(n):
    a.append(int(input()))

for i in range(0,n):
    a1 = a[:i]
    a2 = a[i+1:]
    
    if len(a1) == 0:
        print(max(a2))
    elif len(a2) == 0:
        print(max(a1))
    else:
        print(max(max(a1), max(a2)))


Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())

a = []

for i in range(n):
    a.append((i, int(input())))

a_sorted = sorted(a, key = lambda k:k[1])
max_index = a_sorted[-1][0]

#print(a_sorted)

a_max = a_sorted[-1][1]
a_sec_max = a_sorted[-2][1]

for i in range(0,n):
    if i != max_index:
        print(a_max)
    else:
        print(a_sec_max)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys

n = int(input())
s = [int(c) for c in input()]

count = 0

for i in range(n-2):
    if s[i] < s[i+1] < s[i+2] or s[i] > s[i+1] > s[i+2]:
        count += 1

print(count)

Fixed submission:
# -*- coding: utf-8 -*-
import sys

n = int(input())
s = [int(c) for c in input().split(' ')]

count = 0

for i in range(n-2):
    if s[i] < s[i+1] < s[i+2] or s[i] > s[i+1] > s[i+2]:
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys

s = (input().split(' '))

n,m = [int(i) for i in s]

l_list = []
r_list = []

for i in range(m):
    s = (input().split(' '))
    l,r = [int(i) for i in s]
    l_list.append(l)
    r_list.append(r)

range = (max(l_list), min(r_list))

if range[0] > range[1]:
    print(0)
else:
    print(range[1] - range[0] + 1))

Fixed submission:
# -*- coding: utf-8 -*-
import sys

s = (input().split(' '))

n,m = [int(i) for i in s]

l_list = []
r_list = []

for i in range(m):
    s = (input().split(' '))
    l,r = [int(i) for i in s]
    l_list.append(l)
    r_list.append(r)

range = (max(l_list), min(r_list))

if range[0] > range[1]:
    print(0)
else:
    print(range[1] - range[0] + 1)
Buggy python submission (verdict: Runtime Error):
import math
import itertools
import functools

_ = input()
A = list(map(int, input().split()))

for a, b in itertools.combinations(A, 2):
    if math.gcd(a, b) != 1:
        if functools.reduce(math.gcd, A) == 1:
            print('setwise coprime')
        else:
            print('not coprime')
        break
else:
    print('pairwise coprime')


Fixed submission:
D, S, T = map(int, input().split())
print('Yes' if S * T >= D else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

_ = input()
A = list(map(int, input().split()))
mod = 10**9 + 7

print(sum([(ai * aj) % mod for ai, aj in itertools.combinations(A, 2)]) % mod)


Fixed submission:
_ = input()
A = list(map(int, input().split()))
mod = 10**9 + 7

s = 0
a = 0
for _a in A:
  s += _a * a
  a = (a + _a) % mod
print(s % mod)
Buggy python submission (verdict: Runtime Error):
print(180*(Nint(input())))

Fixed submission:
print(180*(int(input())-2))
Buggy python submission (verdict: Runtime Error):
(n, k) = map(int, input().split())
s = list(input())
s[k] = s[k].lower()
print("".join(s))

Fixed submission:
(n, k) = map(int, input().split())
s = list(input())
s[k-1] = s[k-1].lower()
print("".join(s))
Buggy python submission (verdict: Time Limit Exceeded):
import sys, itertools
s = sys.stdin.readline().strip()
l = n1 = len(s)
while True:
    n = l
    skip = False
    _s = ""
    for i, j in itertools.zip_longest(s[:], s[1:]):
        if skip:
            skip = False
            continue
        if i != j and j != None:
            skip = True
        else:
            _s += i
    s = _s
    l = len(s)
    if l != 0 and n != l:
        continue
    else:
        break
print(n1 - len(s))

Fixed submission:
s = input()
print(min(s.count('0'), s.count('1'))*2)

Buggy python submission (verdict: Time Limit Exceeded):
import sys, itertools
s = sys.stdin.readline().strip()
l = n1 = len(s)
while True:
    n = l
    skip = False
    _s = ""
    for i, j in itertools.zip_longest(s[:], s[1:]):
        if skip:
            skip = False
            continue
        if i == j or j == None:
            _s += i
        else:
            skip = True
    s = _s
    l = len(s)
    if l == 0 or n == l:
        break
print(n1 - len(s))

Fixed submission:
s = input()
print(min(s.count('0'), s.count('1'))*2)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
s = list(sys.stdin.readline().strip())
l = n1 = len(s)
while True:
    n = l
    _s = []
    skip = False
    for i in range(n):
        if skip:
            skip = False
            continue
        if i == n-1 or s[i] == s[i+1]:
            _s += s[i]
        else:
            skip = True
    s = _s
    l = len(s)
    if l == 0 or n == l:
        break
print(n1 - len(s))

Fixed submission:
s = input()
print(min(s.count('0'), s.count('1'))*2)
Buggy python submission (verdict: Runtime Error):
def calc(a):
    m = min(a)
    b = [i % m for i in a if i % m != 0]
    if b:
        return calc([*b, m])
    else:
        return min(a)
      
_ = int(input())
print(calc(list(map(int, input().split()))))

Fixed submission:
def calc(a):
    m = min(a)
    b = [i % m for i in a if i % m != 0]
    if b:
        return calc(b+[m])
    else:
        return min(a)
      
_ = int(input())
print(calc(list(map(int, input().split()))))

Buggy python submission (verdict: Runtime Error):
def calc(a):
  m = min(a)
  b = [i % m for i in a if i % m != 0]
  if b:
    return calc([*b, m])
  else:
    return min(a)
      
if __name__ == "__main__":
  _ = int(input())
  print(calc(list(map(int, input().split()))))

Fixed submission:
def calc(a):
    m = min(a)
    b = [i % m for i in a if i % m != 0]
    if b:
        return calc(b+[m])
    else:
        return min(a)
      
_ = int(input())
print(calc(list(map(int, input().split()))))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = np.array(list(map(int, input().split())))
print(max(a) - min(a))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
print(max(a) - min(a))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
print(max([len(list(filter(lambda x: i-1 <= x and x <= i+1, a))) for i in set(a)]))

Fixed submission:
import collections
N = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
print(max([c[i-1]+c[i]+c[i+1] for i in set(a)]))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
if min(a)+1 < max(a):
    print(max([len(list(filter(lambda x: i-1 <= x and x <= i+1, a))) for i in range(min(a)+1,max(a))]))
else:
    print(len(a))

Fixed submission:
import collections
N = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
print(max([c[i-1]+c[i]+c[i+1] for i in set(a)]))
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
N, Ma, Mb = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in range(N)]
min_cost = -1
for _i in range(1, N+1):
    all_pattern = list(combinations(range(N), _i))
    for _j in all_pattern:
        _a = sum([abc[_k][0] for _k in _j])
        _b = sum([abc[_k][1] for _k in _j])
        _c = sum([abc[_k][2] for _k in _j])
        if _b * Ma == _a * Mb:
            if min_cost == -1 or min_cost > _c:
                min_cost = _c
print(min_cost)

Fixed submission:
A, B = list(map(int, input().split()))
A = 14 if A == 1 else A
B = 14 if B == 1 else B
print('Alice' if A > B else 'Bob' if A < B else 'Draw')
Buggy python submission (verdict: Runtime Error):
X, Y, Z = int(input())
X, Z = Z, X
print(X, Y, Z)

Fixed submission:
X, Y, Z = map(int, input().split())
print(Z, X, Y)
Buggy python submission (verdict: Runtime Error):
S = input()
if(S[4]==S[5] && S[6]==S[7]):
  print("Yes")
else:
  print("No")

Fixed submission:
S = input()
if S[2]==S[3]:
    if S[4]==S[5]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

if(S[4]==S[5] && S[6]==S[7]):
  print("Yes")
else:
  print("No")

Fixed submission:
S = input()
if S[2]==S[3]:
    if S[4]==S[5]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
L = int(input())

num = L // 3
rem = x % 3

if rem == 1:
    res = (num+1)*(num**2)

elif rem == 2:
    res = ((num + 1) ** 2) * num

else:
    res = num ** 3

res2 = (x/3)**3
if res > res2:
    print(res)
else:
    print(res2)

Fixed submission:
L = int(input())

num = L // 3
rem = L % 3

if rem == 1:
    res = (num+1)*(num**2)

elif rem == 2:
    res = ((num + 1) ** 2) * num

else:
    res = num ** 3

res2 = (L/3)**3
if res > res2:
    print(res)
else:
    print(res2)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
Output = [0] * N
num = ""

for i in range(M):
    s,c = map(int,input().split())
    if(Output[s-1]==0 or Output[s-1]>c):
        Output[s-1] = c
    if(c==0):
        print(-1)

if(Output[0]==0):
    print(-1)
else:
    for i in Output:
        if(i>9):
            print(-1)
        num += str(i)
    print(num)

Fixed submission:
N = int(input())

if N % 2 == 0:
    print(N//2)
else:
    print(N//2+1)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
lst = [x for x in range(n)]
dic = {}
not_found = False
special_case = False
for i in range(m):
    a, b = map(int, input().split())
    if str(a) not in list(dic.keys()):
        dic[str(a)] = b
    else:
        if dic[str(a)] != b:
            not_found = True
    lst[a - 1] = b
if m == 0:
    special_case = True
if not_found:
    print(-1)
elif special_case:
    if n == 1:
        print(0)
    elif n == 2:
        print(10)
    else:
        print(100)
else:
    for i in range(n):
        if str(i + 1) not in list(dic.keys()):
            if i + 1 == 1:
                lst[i] = 1
            else:
                lst[i] = 0
    lst = list(map(str, lst))
    res = ''.join(lst)
    if res[0] == '0' and len(res) > 1:
        print(-1)
    else:
        print(int(res))
Seen by Sokun Deborey at 8:27 PM
Ang Sivhour

Fixed submission:
n, m = map(int, input().split())
lst = [x for x in range(n)]
dic = {}
not_found = False
special_case = False
for i in range(m):
    a, b = map(int, input().split())
    if str(a) not in list(dic.keys()):
        dic[str(a)] = b
    else:
        if dic[str(a)] != b:
            not_found = True
    lst[a - 1] = b
if m == 0:
    special_case = True
if not_found:
    print(-1)
elif special_case:
    if n == 1:
        print(0)
    elif n == 2:
        print(10)
    else:
        print(100)
else:
    for i in range(n):
        if str(i + 1) not in list(dic.keys()):
            if i + 1 == 1:
                lst[i] = 1
            else:
                lst[i] = 0
    lst = list(map(str, lst))
    res = ''.join(lst)
    if res[0] == '0' and len(res) > 1:
        print(-1)
    else:
        print(int(res))