Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
L = list(map(int,input().split()))
cnt = 0
L.sort()
L = L[::-1]

def nibutan(L,i,j,N):
    lower = N-1
    upper = j+1
    middle = int(np.round(upper+lower)/2)
    if upper> lower:
        return 0

    for cnt in range(16):
        if L[i] < L[j] + L[middle]:
            upper = middle
            middle = int(np.round((upper+lower)/2))
        else:
            lower = middle
            middle = int(np.round((upper+lower)/2))-1
#         print(middle)
    return max([middle - j,0])

# print('L',L)
for i in range(N):
    for j in range(i+1,N):
#         print('test',L[i],L[j])
        cnt += nibutan(L,i,j,N)
print(cnt)

Fixed submission:
import bisect
 
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        tmp=a[i]+a[j]
        index=bisect.bisect_left(a,tmp)
        ans+=index-j-1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
L = list(map(int,input().split()))

cnt = 0

for a in L:
    L2 = copy.deepcopy(L)
    L2.remove(a)
    for b in L2:
        L3 = copy.deepcopy(L2)
        L3.remove(b)
        for c in L3:
            if a<b+c and b<c+a and c<a+b:
                cnt+=1
print(cnt//6)

Fixed submission:
import bisect
 
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        tmp=a[i]+a[j]
        index=bisect.bisect_left(a,tmp)
        ans+=index-j-1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i] < (L[j]+L[k]):
                if L[j] < (L[i]+L[k]):
                    if L[k] < (L[i]+L[j]):
                        ans+=1
print(ans)

Fixed submission:
import bisect
 
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        tmp=a[i]+a[j]
        index=bisect.bisect_left(a,tmp)
        ans+=index-j-1
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
if S == 'Sunny':
  print('Cloudy')
elif S =='Cloudy':
  print('Rainy')
else S=='Rainy':
  print('Sunny')

Fixed submission:
S = input()
if S == 'Sunny':
    print('Cloudy')
elif S =='Cloudy':
    print('Rainy')
else:
    print('Sunny')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
    
MAX1 = max(A)
MAX2 = -1
for i in range(N):
    if i != A.index(MAX1):
        MAX2 = max(MAX2,A[i])
        
if MAX1 == MAX2:
    for i in range(N):
        print(MAX1)
else:
    for i in range(N):
        if i == A.index(MAX1):
            print(MAX2)
        else:
            print(MAX1)
            
    

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
    
MAX1 = max(A)
MAX2 = -1
index = A.index(MAX1)
for i in range(N):
    if i != index:
        MAX2 = max(MAX2,A[i])
        
if MAX1 == MAX2:
    for i in range(N):
        print(MAX1)
else:
    for i in range(N):
        if i == index:
            print(MAX2)
        else:
            print(MAX1)
Buggy python submission (verdict: Runtime Error):
s = input().split()
L = int(s[0])
R = int(s[1])
 
L = L%2019
R = R%2019
MIN = 2020
if R - L >= 2019:
    flag = True

for i in range(min(L,R),max(L,R)+1):
    for j in range(i,max(L,R)+1):
        if i != j:
            mod = i*j
            MIN = min(MIN,mod%2019)
if R == 0 or L == 0 or flag:
    print(0)
elif abs(R - L) == 1:
    print((R*L)%2019)
elif R == L:
    print((R*L)%2019)
else:
    print(MIN)

Fixed submission:
s = input().split()
L = int(s[0])
R = int(s[1])

MIN = 2020
flag = 0

for i in range(L,R+1):
    for j in range(i+1,R+1):
        mod = i*j % 2019
        MIN = min(MIN,mod%2019)
        if MIN == 0:
            flag = 1
            break
    if flag == 1:
        break

if R == 0 or L == 0:
    print(0)
elif R - L == 1:
     print((R*L)%2019)
else:
    print(MIN)
Buggy python submission (verdict: Runtime Error):
s = input().split()
N = int(s[0])
X = int(s[1])
ss = input().split()
L = []
for i in range(N):
    L.append(int(ss[i]))
    
D = 0
count =0
for i in range(N+1):
    D = D+L[i]
    count = count+1
    if D > X:
        break
        
print(count)

Fixed submission:
s = input().split()
N = int(s[0])
X = int(s[1])
ss = input().split()
L = [0]*(N+1)
for i in range(N):
    L[i] = int(ss[i])
    
D = 0
count =0
for i in range(N+1):
    D = D+L[i]
    count = count+1
   # print(D)
    if D > X:
        break
        
print(count)
Buggy python submission (verdict: Runtime Error):
BIG = 10**9+7

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

pre = a[0]
dame = False
for i in range(1,len(a)):
    if a[i]==pre:
        dame = True
    pre=a[i]

dp = [0 for i in range(N+1)]
for item in a:
    dp[item]=-1
dp[0]=1
if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2,N+1):
    if dp[i]!= -1:
        dp[i] = dp[i-1]+dp[i-2]
        dp[i] = dp[i]%BIG
    else:
        dp[i]=0

print(dp)

if dame:
    print(0)
else:
    print(dp[-1])

Fixed submission:
BIG = 10**9+7

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


dp = [0 for i in range(N+1)]
for item in a:
    dp[item]=-1
dp[0]=1
if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2,N+1):
    if dp[i]!= -1:
        dp[i] = dp[i-1]+dp[i-2]
        dp[i] = dp[i]%BIG
    else:
        dp[i]=0

print(dp[-1])

Buggy python submission (verdict: Runtime Error):
BIG = 10**9+7

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

pre = a[0]
dame = False
for i in range(1,len(a)):
    if a[i]==pre:
        dame = True
    pre=a[i]

dp = [0 for i in range(N+1)]
for item in a:
    dp[item]=-1
if a[0]!=0:
    dp[0] = 1
if a[0]!=0:
    if (len(a)>1 and a[1]!=0) or a[0]!=1:
        dp[1] = 2

if a[0] == 1:
    dp[1] = 0

for i in range(2,N+1):
    if dp[i]!= -1:
        dp[i] = dp[i-1]+dp[i-2]
        dp[i] = dp[i]%BIG
    else:
        dp[i]=0

#print(dp)

if dame:
    print(0)
else:
    print(dp[-1])

Fixed submission:
BIG = 10**9+7

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


dp = [0 for i in range(N+1)]
for item in a:
    dp[item]=-1
dp[0]=1
if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2,N+1):
    if dp[i]!= -1:
        dp[i] = dp[i-1]+dp[i-2]
        dp[i] = dp[i]%BIG
    else:
        dp[i]=0

print(dp[-1])

Buggy python submission (verdict: Runtime Error):
STR = input().split()
N = int(STR[0])
M = int(STR[1])
Flag = True
a = []
a.append(-1)
for i in range(M):
    a.append(int(input()))
a.append(N+1)

for i in range(M+1):
    if (a[i+1]-a[i]) == 1:
        Flag = False

fib = []
fib.append(1)
fib.append(1)

for i in range(2,N):
    fib.append(fib[i-1] + fib[i-2])

SUM = 1
num = 0
for i in range(1,M+2):
    num = a[i]-1 - (a[i-1] +1)
    #print(a[i]-1)
    #print(a[i-1]+1)
    SUM = SUM * fib[num] % 1000000007
    #print(num)
    
if Flag:
    print(SUM)
else:
    print(0)

Fixed submission:
BIG = 10**9+7

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


dp = [0 for i in range(N+1)]
for item in a:
    dp[item]=-1
dp[0]=1
if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2,N+1):
    if dp[i]!= -1:
        dp[i] = dp[i-1]+dp[i-2]
        dp[i] = dp[i]%BIG
    else:
        dp[i]=0

print(dp[-1])
Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
A = int(A)
B = int(B)
ans = 0

if A> B:
  ans = ans + A
else :
  ans = ans + B
  
if A> B:
  ans = ans + A
else :
  ans = ans + B
  
print(ans)


Fixed submission:
str = input().split()
A = int(str[0])
B = int(str[1])
ans = 0
 
if A> B:
  ans = ans + A
  A = A-1
else :
  ans = ans + B
  B = B-1
if A> B:
  ans = ans + A
else :
  ans = ans + B
  
print(ans)
Buggy python submission (verdict: Runtime Error):
A = []
for i in range(5):
  str = input()
  A[i] = int(str)
K = int( input() )

if( A[5] - A[0] > K):
  print("Yay!")
else:
  print(":(")
  
  
  

Fixed submission:
A = []
for i in range(5):
  str = input()
  A.append(int(str))
K = int( input() )

if( A[4] - A[0] <= K):
  print("Yay!")
else:
  print(":(")

Buggy python submission (verdict: Runtime Error):
str = input().split()
flag = 0
k = str[len(str)]
for i in range( 1,len(str) ):
  if str[i] - str[i-1] > k:
    flag = 1
if flag == 1:
  print(":(")
else:
  print("Yay!")

Fixed submission:
A = []
for i in range(5):
  str = input()
  A.append(int(str))
K = int( input() )

if( A[4] - A[0] <= K):
  print("Yay!")
else:
  print(":(")
Buggy python submission (verdict: Runtime Error):
A = []
for i in range(5):
  str = input()
  A.append( int(str) )

min = 9
num = 0
 for i in range(len(A)):
    if min > A[i]%10 and A[i] % 10 != 0:
      min = A[i]%10
      num = i
      
ans = 0
for i in range(5):
  ans = ans + int(A[i]/10)
ans = ans + A[num] % 10

print(ans)


Fixed submission:
A = []
for i in range(5):
  str = input()
  A.append( int(str) )

min = 9
num = 0
for i in range(len(A)):
    if min > A[i]%10 and A[i] % 10 != 0:
      min = A[i]%10
      num = i
      
ans = 0
for i in range(5):
  if i != num:
    ans = ans + int((A[i]+9)/10) * 10
ans = ans + A[num]

print(ans)
Buggy python submission (verdict: Runtime Error):
str = input()
S = list(str)

ans = 0
num = 0

for i in range(len(str)):
  if list[i] == "A" or list[i] == "G" or list[i] == "T" or list[i] == "C":
    num = 1
    for j in range(len(str)):
      if list[j] == "A" or list[j] == "G" or list[j] == "T" or list[i] == "C":
        num = num + 1
      else :
        break
  if ans < num :
    ans = num
  num = 0
  
print(ans)

Fixed submission:
str = input()
S = list(str)

ans = 0
num = 0

for i in range(len(S)):
  if S[i] == "A" or S[i] == "G" or S[i] == "T" or S[i] == "C":
    num = 1
    for j in range(i+1,len(S)):
      if S[j] == "A" or S[j] == "G" or S[j] == "T" or S[j] == "C":
        num = num + 1
      else :
        break
  if ans < num :
    ans = num
  num = 0
  
print(ans)

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

ans = 0
num = 0

for i in range(len(str)):
  if list[i] == "A" or list[i] == "G" or list[i] == "T" or list[i] == "C":
    num = 1
    for j in range(len(str)):
      list[j] == "A" or list[j] == "G" or list[j] == "T" or list[i] == "j":
        num = num + 1
      else :
        break
  if ans < num :
    ans = num
  num = 0
  
print(ans)

Fixed submission:
str = input()
S = list(str)

ans = 0
num = 0

for i in range(len(S)):
  if S[i] == "A" or S[i] == "G" or S[i] == "T" or S[i] == "C":
    num = 1
    for j in range(i+1,len(S)):
      if S[j] == "A" or S[j] == "G" or S[j] == "T" or S[j] == "C":
        num = num + 1
      else :
        break
  if ans < num :
    ans = num
  num = 0
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = list(map(int, input().split()))
 
dp = [1000000000] * N
dp[0] = 0
 
for i in range(N - 1):
    for j in range(1, K + 1):
        if i + j < N:
            if dp[i + j] > abs(h[i + j] - h[i]) + dp[i]:
                dp[i + j] = abs(h[i + j] - h[i]) + dp[i]
        else:
            break
 
print(dp[N - 1])

Fixed submission:
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [10**15+1 for i in range(N)]
dp[0] = 0
for i in range(N):
    for j in range(1,K+1):
        if i+j<N:
            dp[i+j] = min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))
        
print(dp[-1])

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input.split()))
dp = [1000000000]＊n

Fixed submission:
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [10**15+1 for i in range(N)]
dp[0] = 0
for i in range(N):
    for j in range(1,K+1):
        if i+j<N:
            dp[i+j] = min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))
        
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
str = input().split()
A = []
A.append(0)
for i in range(N):
    A.append(int(str[i]))
A.append(0)
SUM = 0
distance = []

for i in range(1,N+2):
    distance.append(abs(A[i] - A[i-1]))

    
buf1 = 0
buf2 = 0
for i in range(1,N+1):
    buf1 = distance.pop(i-1)
    buf2 = distance.pop(i-1)
    #print(A)
    distance.insert(i-1,abs(A[i+1]-A[i-1]))
    print(sum(distance))
    distance.pop(i-1)
    distance.insert(i-1,buf2)
    distance.insert(i-1,buf1)

Fixed submission:
N = int(input())
str = input().split()
A = []
A.append(0)
for i in range(N):
    A.append(int(str[i]))
A.append(0)
SUM = 0
distance = []

for i in range(1,N+2):
    distance.append(abs(A[i] - A[i-1]))
    SUM = SUM + abs(A[i]-A[i-1])

for i in range(1,N+1):
    print(SUM - distance[i] - distance[i-1] + abs(A[i+1] - A[i-1]))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
str = input().split()
A = []
A.append(0)
for i in range(N):
    A.append(int(str[i]))
A.append(0)
SUM = 0
cnt = 0
buf = 0
for i in range(1,N+1):
    for j in range(1,N+1):
        if i == j:
            buf = A.pop(j)
            cnt = j
        SUM = SUM + abs(A[j] - A[j-1])
    A.insert(cnt,buf)
    print(SUM)
    SUM = 0

Fixed submission:
N = int(input())
str = input().split()
A = []
A.append(0)
for i in range(N):
    A.append(int(str[i]))
A.append(0)
SUM = 0
distance = []

for i in range(1,N+2):
    distance.append(abs(A[i] - A[i-1]))
    SUM = SUM + abs(A[i]-A[i-1])

for i in range(1,N+1):
    print(SUM - distance[i] - distance[i-1] + abs(A[i+1] - A[i-1]))
Buggy python submission (verdict: Runtime Error):
import fraction

N = int(input())
T = [0]*N
for i in range(N):
    T[i] = int(input())
lcd = 1

for i in range(N):
    lcd = int(lcd*T[i] / fraction.gcd(lcd,T[i]))
    
print(lcd)



Fixed submission:
import fractions
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

def lcm(a,b):
    return a*b//fractions.gcd(a,b)
ans = 1
for i in range(N):
    ans = lcm(ans,T[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
T = [0]*N
for i in range(N):
    T[i] = int(input())
lcd = 1

for i in range(N):
    lcd = int(lcd*T[i] / math.gcd(lcd,T[i]))
    
print(lcd)



Fixed submission:
import fractions
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

def lcm(a,b):
    return a*b//fractions.gcd(a,b)
ans = 1
for i in range(N):
    ans = lcm(ans,T[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
MIN = 10**11
S1 = 0
S2 =  0
S3 = 0
if H%3 == 0 or W %3==0:
    print(0)
else:
    for i in range(1,H):
        S1 = i * W
        S2 = (H-i)*(W//2)
        S3 = (H-i)*(W - W//2)
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
        
    for i in range(1,W):
        S1 = i * H
        S2 = (W-i)*(H//2)
        S3 = (W-i)*(H - H//2)
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
        
    for i in range(1,H):
        S1 = i*W
        S2 = ((H-i)//2)*W
        S3 = H*W - S1-S2
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
    
     for i in range(1,H):
        S1 = i*H
        S2 = ((W-i)//2) *H
        S3 = H*W - S1-S2
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
        
    print(MIN)
       

Fixed submission:
H,W = map(int,input().split())
MIN = 10**11
S1 = 0
S2 =  0
S3 = 0
if H%3 == 0 or W %3==0:
    print(0)
else:
    for i in range(1,H):
        S1 = i * W
        S2 = (H-i)*(W//2)
        S3 = (H-i)*(W - W//2)
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
        
    for i in range(1,W):
        S1 = i * H
        S2 = (W-i)*(H//2)
        S3 = (W-i)*(H - H//2)
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
        
    for i in range(1,H):
        S1 = i*W
        S2 = ((H-i)//2)*W
        S3 = H*W - S1-S2
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
    
    for i in range(1,H):
        S1 = i*H
        S2 = ((W-i)//2) *H
        S3 = H*W - S1-S2
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
        
    print(MIN)

Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
MIN = 10**11
S1 = 0
S2 =  0
S3 = 0
if H%3 == 0 or W %3==0:
    print(0)
else:
    for i in range(1,H):
        S1 = i * W
        S2 = (H-i)*(W//2)
        S3 = (H-i)*(W - W//2)
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
        
    for  i in range(1,W):
        S1 = i * H
        S2 = (W-i)*(H//2)
        S3 = (W-i)*(H - H//2)
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
        
    for i in range()
        
    print(MIN)
       

Fixed submission:
H,W = map(int,input().split())
MIN = 10**11
S1 = 0
S2 =  0
S3 = 0
if H%3 == 0 or W %3==0:
    print(0)
else:
    for i in range(1,H):
        S1 = i * W
        S2 = (H-i)*(W//2)
        S3 = (H-i)*(W - W//2)
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
        
    for i in range(1,W):
        S1 = i * H
        S2 = (W-i)*(H//2)
        S3 = (W-i)*(H - H//2)
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
        
    for i in range(1,H):
        S1 = i*W
        S2 = ((H-i)//2)*W
        S3 = H*W - S1-S2
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
    
    for i in range(1,H):
        S1 = i*H
        S2 = ((W-i)//2) *H
        S3 = H*W - S1-S2
        MIN = min(MIN, max(S1,S2,S3)- min(S1,S2,S3))
        
    print(MIN)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

def solution():
    n, k = map(int, input().split())
    candidates = [10 ** 8 + i for i in range(n+1)]
    ans = 0
    for i in range(k, n+2):
        a = set([sum(b) for b in list(itertools.combinations(candidates, i))])
        ans += len(a)
    ans %= 10**9 + 7
    print(ans)

solution()


Fixed submission:
def solution():
    n, k = map(int, input().split())
    ans = 0
    for i in range(k, n+2):
        smallest = (i-1) * i // 2
        largest = (n-i+1) * i + smallest
        ans += largest - smallest + 1
    ans %= 10 ** 9 + 7
    print(ans)

solution()
Buggy python submission (verdict: Runtime Error):
def solution():
    n, m = map(int, input().split())
    cs = [list(map(int, input().split())) for i in range(m)]
    if m == 0:
        if n > 1:
            print("-1")
        else:
            print("0")
        return
    ans = [-1 for i in range(n)]
    for w in cs:
        s = w[0]
        c = w[1]
        if (s == 1) and (c == 0) and (n > 1):
            print('-1')
            return
        if ans[s-1] == -1:
            ans[s-1] = c
        elif ans[s-1] != c:
            print('-1')
            return
    ansb = [str(i) if i != -1 else str(0) for i in ans]
    if ansb[0] == '0':
        ansb[0] = '1'
    for s in ansb:
        anss = anss + s
    print(int(anss))

solution()


Fixed submission:
def solution():
    n, m = map(int, input().split())
    cs = [list(map(int, input().split())) for i in range(m)]
    if m == 0:
        if n > 1:
            print(10**(n-1))
        else:
            print("0")
        return
    ans = [-1 for i in range(n)]
    for w in cs:
        s, c = w[0], w[1]
        if (s == 1) and (c == 0) and (n > 1):
            print('-1')
            return
        if ans[s-1] == -1:
            ans[s-1] = c
        elif ans[s-1] != c:
            print('-1')
            return
    ansb = [str(i) if i != -1 else str(0) for i in ans]
    if (ansb[0] == '0') and (len(ansb) > 1):
        ansb[0] = '1'
    anss = ''
    for s in ansb:
        anss = anss + s
    print(anss)

solution()

Buggy python submission (verdict: Runtime Error):
def solution():
    n, m = map(int, input().split())
    cs = [list(map(int, input().split())) for i in range(m)]
    if m == 0:
        if n > 1:
            print("-1")
        else:
            print("0")
        return
    ans = [-1 for i in range(n)]
    for w in cs:
        s = w[0]
        c = w[1]
        if (s == 1) and (c == 0) and (n > 1):
            print('-1')
            return
        if ans[s-1] == -1:
            ans[s-1] = c
        elif ans[s-1] != c:
            print('-1')
            return
    ans = [str(i) if i != -1 else str(0) for i in str(ans)]
    anss = ''
    for s in ans:
        anss = anss + s
    print(int(anss))

solution()


Fixed submission:
def solution():
    n, m = map(int, input().split())
    cs = [list(map(int, input().split())) for i in range(m)]
    if m == 0:
        if n > 1:
            print(10**(n-1))
        else:
            print("0")
        return
    ans = [-1 for i in range(n)]
    for w in cs:
        s, c = w[0], w[1]
        if (s == 1) and (c == 0) and (n > 1):
            print('-1')
            return
        if ans[s-1] == -1:
            ans[s-1] = c
        elif ans[s-1] != c:
            print('-1')
            return
    ansb = [str(i) if i != -1 else str(0) for i in ans]
    if (ansb[0] == '0') and (len(ansb) > 1):
        ansb[0] = '1'
    anss = ''
    for s in ansb:
        anss = anss + s
    print(anss)

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

if h <= sum(a):
   print("yes")
else:
   print("no")

Fixed submission:
h, n = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) >= h:
   print("Yes")
else:
   print("No")
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))
attack_cnt = 0
 
desc_h = sorted(h, reverse=True)
for i in range(k):
  desc_h.pop(0)
 
print(sum(desc_h))

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
attack_cnt = 0
 
desc_h = sorted(h, reverse=True)
end = k if k <= n else n
del desc_h[0:end]
 
print(sum(desc_h))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split())
attack_cnt = 0

desc_h = sorted(h, reverse=True)
for i in range(k):
  desc_h.pop(0)

print(sum(desc_h))

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
attack_cnt = 0
 
desc_h = sorted(h, reverse=True)
end = k if k <= n else n
del desc_h[0:end]
 
print(sum(desc_h))
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
p = input().split()

i_cnt = 1
current_max = {'idx': 0, 'value': 0}

for j in range(len(p)):
  for i in range(current_max['idx'], j):
    if current_max['value'] <= int(p[i]): 
      current_max['idx'] = i
      current_max['value'] = int(p[i])
    if int(p[i]) < int(p[j]):
      break
    if j-1 == i:
      i_cnt += 1

print(i_cnt)

Fixed submission:
n = input()
p = input().split()

i_cnt = 1
current_max = {'idx': 0, 'value': 0}

for j in range(len(p)):
  for i in range(current_max['idx'], j):
    current_max['idx'] = i
    if current_max['value'] <= int(p[i]): 
      current_max['value'] = int(p[i])
    if int(p[i]) < int(p[j]):
      break
    if j-1 == i:
      i_cnt += 1

print(i_cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
p = input().split()

i_cnt = 1
for j in range(len(p)):
  for i in range(j):
    if int(p[i]) < int(p[j]):
      break
    if j-1 == i:
      i_cnt += 1

print(i_cnt)

Fixed submission:
n = input()
p = input().split()

i_cnt = 1
current_max = {'idx': 0, 'value': 0}

for j in range(len(p)):
  for i in range(current_max['idx'], j):
    current_max['idx'] = i
    if current_max['value'] <= int(p[i]): 
      current_max['value'] = int(p[i])
    if int(p[i]) < int(p[j]):
      break
    if j-1 == i:
      i_cnt += 1

print(i_cnt)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
print("{}{}".format(t, s))

Fixed submission:
s, t = input().split()
print("{}{}".format(t, s))