Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
"""


N = input()
S = raw_input()

count_l = [0]
count_r = [0]


for i in range(N):
    if S[i] == 'W':
        tmp = count_l[i] + 1
    else:
        tmp = count_l[i]
    count_l.append(tmp)
    if S[N-1-i] == 'E':
        tmp = count_r[i] + 1
    else:
        tmp = count_r[i]
    count_r.append(tmp)

count_r.reverse()

Ans = count_l

for i in range(N+1):
    Ans[i] = count_r[i] + count_l[i]

print(min(Ans))

Fixed submission:
N = input()
S = raw_input()

count_l = [0]
count_r = [0]


for i in range(N):
    if S[i] == 'W':
        tmp = count_l[i] + 1
    else:
        tmp = count_l[i]
    count_l.append(tmp)
    if S[N-1-i] == 'E':
        tmp = count_r[i] + 1
    else:
        tmp = count_r[i]
    count_r.append(tmp)

count_r.reverse()

Ans = count_l

for i in range(N+1):
    Ans[i] = count_r[i] + count_l[i]

print(min(Ans))
Buggy python submission (verdict: Runtime Error):
a, b, c, N = map(int, raw_input().split())

if N % 2 == 0:
    ans = a - b
else:
    ans = b - a

if abs(ans) > 10^18:
    print('Unfair')
else:
    print(ans)

Fixed submission:
a, b, c, N = map(int, raw_input().split())

if N % 2 == 0:
    ans = a - b
else:
    ans = b - a

if abs(ans) > 10**18:
    print('Unfair')
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
strs = input()
N = int(input())

Len = len(strs)

allstr = [] 

for i in range(Len):
    for j in range(i+1):
        allstr.append(strs[i-j:i+1])
        allstr2 = list(set(allstr))
        if len(allstr) > 5:
            allstr2.sort()
            allstr = allstr2[0:6]

allstr2 = list(set(allstr))        
allstr2.sort()

print(allstr2[N-1])

Fixed submission:
strs = input()
N = int(input())

Len = len(strs)

allstr = [] 
flag = 0

for i in range(Len):
    tmp = list(range(i+1))
    tmp.reverse()
    for j in tmp:
#        print(strs[Len-i-1:Len-j])
        allstr.append(strs[Len-i-1:Len-j])
        allstr2 = list(set(allstr))
        if len(allstr2) > 5:
            if allstr[5:6] > allstr[4:5] and flag == 1:
#                print(allstr[5:6], allstr[4:5])
                allstr = allstr[0:5]
                break
            allstr2.sort()
            allstr = allstr2[0:5]
            flag = 1
#            print(allstr2)
        

allstr2 = list(set(allstr))        
allstr2.sort()

print(allstr2[N-1])

Buggy python submission (verdict: Time Limit Exceeded):
strs = input()
N = int(input())

Len = len(strs)

allstr = [] 

for i in range(Len):
    for j in range(i+1):
        allstr.append(strs[i-j:i+1])

allstr2 = list(set(allstr))        
allstr2.sort()

print(allstr2[N-1])

Fixed submission:
strs = input()
N = int(input())

Len = len(strs)

allstr = [] 
flag = 0

for i in range(Len):
    tmp = list(range(i+1))
    tmp.reverse()
    for j in tmp:
#        print(strs[Len-i-1:Len-j])
        allstr.append(strs[Len-i-1:Len-j])
        allstr2 = list(set(allstr))
        if len(allstr2) > 5:
            if allstr[5:6] > allstr[4:5] and flag == 1:
#                print(allstr[5:6], allstr[4:5])
                allstr = allstr[0:5]
                break
            allstr2.sort()
            allstr = allstr2[0:5]
            flag = 1
#            print(allstr2)
        

allstr2 = list(set(allstr))        
allstr2.sort()

print(allstr2[N-1])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat May 05 21:59:05 2018

@author: ashida
"""


import numpy as np

H, W = map(int, raw_input().split())

S = np.zeros((H, W))

d_flag = 0

for i in range(H):
    tmp = list(raw_input())
    for j in range(W):
        if tmp[j] == "#":
            S[i, j] = 1
            d_flag = 1
        else:
            S[i, j] = 0



for i in range(H):
    for j in range(W):
        if S[i, j] == 1:
            flag = 0
            if i>1:
                a1 = S[i-1, j]
            else:
                a1 = 0
            if j>1:
                a2 = S[i, j-1]
            else:
                a2 = 0
            if i<H-1:
                a3 = S[i+1, j]
            else:
                a3 = 0
            if j<W-1:
                a4 = S[i, j+1]
            else:
                a4 = 0
            if a1+a2+a3+a4 == 0:
                d_flag = 0
                
if d_flag == 1:
    print("Yes")
else:
    print("No")

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

if b < a:
    print(a-1)
else:
    print(a)
Buggy python submission (verdict: Runtime Error):
import numpy as np

H, W = map(int, raw_input().split())

S = np.zeros((H, W))

d_flag = 0

for i in range(H):
    tmp = list(raw_input())
    for j in range(W):
        if tmp[j] == "#":
            S[i, j] = 1
            d_flag = 1
        else:
            S[i, j] = 0



for i in range(H):
    for j in range(W):
        if S[i, j] == 1:
            flag = 0
            if i>1:
                a1 = S[i-1, j]
            else:
                a1 = 0
            if j>1:
                a2 = S[i, j-1]
            else:
                a2 = 0
            if i<H-1:
                a3 = S[i+1, j]
            else:
                a3 = 0
            if j<W-1:
                a4 = S[i, j+1]
            else:
                a4 = 0
            print(a1+a2+a3+a4)
            if a1+a2+a3+a4 == 0:
                d_flag = 0
                
if d_flag == 1:

Fixed submission:
H, W = map(int, raw_input().split())

s = [raw_input() for _ in range(H)]

ans = "Yes"

for y in range(H):
  for x in range(W):
    if s[y][x]=="#":
      ok = False
      for dx,dy in [(-1,0), (1,0), (0,-1), (0,1)]:
        if 0<=x+dx<W and 0<=y+dy<H and s[y+dy][x+dx]=="#":
          ok = True
      if not ok:
        ans = "No"

                
print ans
Buggy python submission (verdict: Runtime Error):
S = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
        31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
        73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
        127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
        179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
        233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
        283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
        353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
        419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
        467, 479, 487, 491, 499, 503, 509, 521, 523, 541]

N = int(input())

ans = [S[0], S[2], S[4], S[6], S[8]]

for i in range(N-5):
    ans.append(S[int(10+i*2)])

Fixed submission:

P = [11, 31, 41, 61, 71, 101, 131,
     151, 181, 191, 211, 241, 251,
     271, 281, 311, 331, 401, 421,
     431, 461, 491, 521, 541, 571,
     601, 631, 641, 661, 691, 701,
     751, 761, 811, 821, 881, 911,
     941, 971, 991, 1021, 1031, 1051,
     1061, 1091, 1151, 1171, 1181,
     1201, 1231, 1291, 1301, 1321,
     1361, 1381]

print " ".join(map(str, P[:input()]))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())

if a==c or b==c or a+b==c
    print("Yes")
else:
    print("No")

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

if a+b>=c:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())

if K > 0:
    count = 0

    for a in range(1, N+1):
        for b in range(K+1, a):
            if a%b >= K:
                count = count + 1
    
    count = count + int((N+1-K)*(N-K)/2)

    print(count)
else:
    print(N*N)

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

if K > 0:
    count = 0

    for b in range(K+1, N+1):
        p = N // b
        r = N % b
        count = count + p*(b-K)
        if r >= K:
            count = count + r-K+1
    
    print(count)
else:
    print(N*N)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 13 17:57:26 2018


1 <= a,b <= N
a % b >= K　である(a, b)の個数

分かるもの
N, K


入力
5 2

出力
7


@author: Yuya
"""

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

if K > 0:
    count = 0

    for a in range(1, N+1):
        for b in range(1, a):
            if a%b >= K:
                count = count + 1
    
    count = count + int((N+1-K)*(N-K)/2)

    print(count)
else:
    print(N*N)

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

if K > 0:
    count = 0

    for b in range(K+1, N+1):
        p = N // b
        r = N % b
        count = count + p*(b-K)
        if r >= K:
            count = count + r-K+1
    
    print(count)
else:
    print(N*N)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

if a%b==0:
	print(-1)
else
	print(a)

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

if a%b==0:
	print('-1')
else:
	print(a)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 17 23:38:43 2018

@author: ashida
"""

N=int(input())

A1 = list( map(int, input().split()))
A2 = list( map(int, input().split()))

SA1 = [0]*N
SA2 = [0]*N

SA1[0] = A1[0]
SA2[N-1] = A2[N-1]

for i in range(N-1):
    SA1[i+1] = SA1[i]+A1[i+1]
    SA2[N-2-i] = SA1[N-1-i]+A1[N-2-i]
    
ans = [0]*N

for i in range(N):
    ans[i] = SA1[i]+SA2[i]

print(max(ans))


Fixed submission:
X = int(input())
A = int(input())
B = int(input())

print((X-A)%B)
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
X=int(input())

count = 0

for ac in range(A)
    for bc in range(A)
        for cc in range(A)
            if 500*ac+100*bc+50*cc == X:
                count += 1

print(count)

Fixed submission:
A=int(input())
B=int(input())
C=int(input())
X=int(input())

count = 0

for ac in range(A+1):
    for bc in range(B+1):
        for cc in range(C+1):
            if 500*ac+100*bc+50*cc == X:
                count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
N=int(input())

A1 = list(int, input().split())
A2 = list(int, input().split())

SA1 = [0]*N
SA2 = [0]*N

SA1[0] = A1[0]
SA2[N-1] = A2[N-1]

for i in range(N-1):
    SA1[i+1] = SA1[i]+A1[i+1]
    SA2[N-2-i] = SA1[N-1-i]+A1[N-2-i]
    
ans = [0]*N

for i in range(N):
    ans[i] = SA1[i]+SA2[i]

print(max(ans))

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 17 23:38:43 2018

@author: ashida
"""

N=int(input())

A1 = list( map(int, input().split()))
A2 = list( map(int, input().split()))

SA1 = [0]*N
SA2 = [0]*N

SA1[0] = A1[0]
SA2[N-1] = A2[N-1]

for i in range(N-1):
    SA1[i+1] = SA1[i]+A1[i+1]
    SA2[N-2-i] = SA2[N-1-i]+A2[N-2-i]
    
ans = [0]*N

for i in range(N):
    ans[i] = SA1[i]+SA2[i]

print(max(ans))
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input(.split()))

if A*B%2 == 0:
    print("Even")
else:
    print("Odd")

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

if (A*B)%2 == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())

if b<10:
    N=10*a+b
elif b<100:
    N=100*a+b
else:
    N=1000*a+b
    
flag = -1

for i in range(317):
    if i*i == N:
        flag=1

if flag==1
    print("Yes")
else:
    print("No")

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

if b<10:
    N=10*a+b
elif b<100:
    N=100*a+b
else:
    N=1000*a+b
    
flag = -1

for i in range(317):
    if i*i == N:
        flag=1

if flag==1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
S = input()

S[3]="8"

print(S)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 19 03:01:30 2018

@author: ashida
"""

S = list(input())

S[3]="8"

print("".join(S))
Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())

sum_k=0

for i in range(N+1):
    if i <10:
        k=i
    elif i<100:
        k=i//10+i%10
    elif i<1000:
        k=i//100+(i%100)//10+(i%100)%10
    else:
        k=1
    if A<=k and k<=B
        sum_k=sum_k+i
      
print(sum_k)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 20 16:39:29 2018

@author: Yuya
"""

N,A,B=map(int,input().split())

sum_k=0

for i in range(N+1):
    if i <10:
        k=i
    elif i<100:
        k=i//10+i%10
    elif i<1000:
        k=i//100+(i%100)//10+(i%100)%10
    elif i<10000:
        k=i//1000+(i%1000)//100+((i%1000)%100)//10+((i%1000)%100)%10
    else:
        k=1
    if A<=k and k<=B:
        sum_k=sum_k+i
      
print(sum_k)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 22 10:08:31 2018

@author: Yuya
"""

N=int(input())

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

a.sort()
count_sum=0
count = 1

for i in range(N-1):
    flag=-1
    if a[i+1]!=a[i]:
        if count>a[i]:
            count_sum += count-a[i]
        elif count<a[i]:
            count_sum += count
        count=1
        flag=1
    else:
        count+=1

if flag==-1:
    if count>a[N-1]:
        count_sum += count-a[N-1]
    elif count<a[N-1]:
        count_sum += count

print(count_sum)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 22 10:08:31 2018

@author: Yuya
"""

N=int(input())

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



#count_sum=0
#count = 1
#
#for i in range(N-1):
#    flag=-1
#    if a[i+1]!=a[i]:
#        if count>a[i]:
#            count_sum += count-a[i]
#        elif count<a[i]:
#            count_sum += count
#        count=1
#        flag=1
#    else:
#        count+=1
#
#if flag==-1:
#    if count>a[N-1]:
#        count_sum += count-a[N-1]
#    elif count<a[N-1]:
#        count_sum += count
#
#print(count_sum)

count_a = [0]*100000
ans = 0

for i in range(N):
    if a[i]<100001:
        count_a[a[i]-1] += 1
    else:
        ans += 1


for i in range(100000):
    if i+1<count_a[i]:
        ans+=count_a[i]-i-1
    elif i+1>count_a[i]:
        ans+=count_a[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
A=input()
B=input()

B.reverse()

if A==B:
    print("Yes")
else:
    print("No")

Fixed submission:
A=list(input())
B=list(input())

B.reverse()

if A==B:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

ans=[]

for i in range(N):
  a=int(input())
  if a in ans:
    ans.remove(a)
  else:
    ans.append(a)
  

print(len(ans))

Fixed submission:
N=int(input())

a=[0]*N

for i in range(N):
  a[i]=int(input())
  
a.sort()
count=1
ans=[]

for i in range(N-1):
  if a[i]==a[i+1]:
    count+=1
  else:
    if count%2==1:
      ans.append(a[i])
    count=1
    
if count%2==1:
  ans.append(a[i])

print(len(ans))
Buggy python submission (verdict: Runtime Error):
x, t = map(int, input().split())

if x<t:
	ans=0
else
	ans=x-t

print(ans)

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

if x<t:
	ans=0
else:
	ans=x-t

print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())

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

ans=[0]*max(a)

for i in range(N):
    ans[a[i]-1]+=1

ll = [ans[0], ans[0]+ans[1], ans[N-2]+ans[N-1], ans[N-1]]

ans_a=max(ll)

for i in range(N-2):
    aa = ans[i]+ans[i+1]+ans[i+2]
    if aa>ans_a:
        ans_a=aa
    
print(ans_a)

Fixed submission:
N=int(input())

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

a_max=100001
ans=[0]*(a_max)

for i in range(N):
    ans[a[i]]+=1

ll = [ans[0], ans[0]+ans[1], ans[a_max-2]+ans[a_max-1], ans[a_max-1]]

ans_a=max(ll)

for i in range(a_max-2):
    aa = ans[i]+ans[i+1]+ans[i+2]
    if aa>ans_a:
        ans_a=aa
    
print(ans_a)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Tue Jul  3 10:58:30 2018

@author: ashida
"""
N=int(input())

S1=list(input())
S2=list(input())

if S1[0]==S1[1]:
    st=2
    ans=6
    flag=1
else:
    st=1
    ans=3
    flag=-1

while st<N:
    if st+1<N:
        if S1[st]==S1[st+1]:
            if flag<0:
                ans*=2
            else:
                ans*=3
            st+=2
            flag=1
        else:
            if flag<0:
                ans*=2
            else:
                ans*=1
            st+=1
            flag=-1
    else:
        if flag<0:
            ans*=2
        else:
            ans*=1
        st+=1
        
ans=ans%1000000007
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Tue Jul  3 10:58:30 2018

@author: ashida
"""
N=int(input())

S1=list(input())
S2=list(input())

if len(S1)>1:
    if S1[0]==S1[1]:
        st=2
        ans=6
        flag=1
    else:
        st=1
        ans=3
        flag=-1
else:
    st=1
    ans=3
    flag=-1

while st<N:
    if st+1<N:
        if S1[st]==S1[st+1]:
            if flag<0:
                ans*=2
            else:
                ans*=3
            st+=2
            flag=1
        else:
            if flag<0:
                ans*=2
            else:
                ans*=1
            st+=1
            flag=-1
    else:
        if flag<0:
            ans*=2
        else:
            ans*=1
        st+=1
        
ans=ans%1000000007
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())

if N//100=N%10:
  print("Yes")
else:
  print("No")
  

Fixed submission:
N=int(input())

if N//100==N%10:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))

now=a[0]
flag=abs(a[0])//a[0]
c=0
#print(c,flag)

for i in range(1,n):
    tmp=now+a[i]
    if not tmp*flag<0:
        c+=abs(flag*-1-tmp)
        now=flag*-1
    else:
        now=tmp
    flag*=-1
    #print(c,flag)

print(c)

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

ans1=0
ans2=0

now=0

for i in range(n):
    now+=a[i]
    if i%2==0:
        if now<=0:
            ans1+=1-now
            now=1
    else:
        if now>=0:
            ans1+=now+1
            now=-1

now=0

for i in range(n):
    now+=a[i]
    if i%2==1:
        if now<=0:
            ans2+=1-now
            now=1
    else:
        if now>=0:
            ans2+=now+1
            now=-1

#print(ans1,ans2)
print(min([ans1,ans2]))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

N_ab = []
M_cd = []

for i in range(n):
  a, b = map(int, input().split())
  N_ab.append([a, b])
  
for i in range(n):
  c, d = map(int, input().split())
  M_cd.append([c, d])
  
for i in range(n):
  Mi = abs(N_ab[i][0]-M_cd[0][0]) + abs(N_ab[i][1]-M_cd[0][1])
  #print(Mi)
  num = 0
  for j in range(1, m):
    tmp = abs(N_ab[i][0]-M_cd[j][0]) + abs(N_ab[i][1]-M_cd[j][1])
    #print(tmp)
    if tmp<Mi:
      Mi=tmp
      num=j
  print(num+1)

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

N_ab = []
M_cd = []

for i in range(n):
  a, b = map(int, input().split())
  N_ab.append([a, b])
  
for i in range(m):
  c, d = map(int, input().split())
  M_cd.append([c, d])
  
for i in range(n):
  Mi = abs(N_ab[i][0]-M_cd[0][0]) + abs(N_ab[i][1]-M_cd[0][1])
  #print(Mi)
  num = 0
  for j in range(1, m):
    tmp = abs(N_ab[i][0]-M_cd[j][0]) + abs(N_ab[i][1]-M_cd[j][1])
    #print(tmp)
    if tmp<Mi:
      Mi=tmp
      num=j
  print(num+1)
Buggy python submission (verdict: Runtime Error):
mod=1000000007

k=int(input())

counter = 0
primes = [2, 3]

for n in range(5, k+1, 2):
    isprime = True
    for i in range(0, len(primes)):
        counter+=1
        if primes[i]**2 > n:
            break
        counter += 1
        if n % primes[i] == 0:
            isprime = False
            break
    if isprime:
        primes.append(n)    

#print(primes)
num=[0]*(k+1)

for i in range(1,k+1):
    for a in primes:
        b=i
        while b>1:
            if b%a==0:
                num[a]+=1
                b=b//a
            else:
                break

ans=1
        
for a in primes:
    if num[a]>0:
        ans=ans*(num[a]+1)%mod
        
#print(num)
print(ans)

Fixed submission:
mod=1000000007

k=int(input())

if k==1:
    print(1)
    exit()
elif k==2:
    print(2)
    exit()
    
counter = 0
primes = [2, 3]

for n in range(5, k+1, 2):
    isprime = True
    for i in range(0, len(primes)):
        counter+=1
        if primes[i]**2 > n:
            break
        counter += 1
        if n % primes[i] == 0:
            isprime = False
            break
    if isprime:
        primes.append(n)    

#print(primes)
num=[0]*(k+1)

for i in range(1,k+1):
    for a in primes:
        b=i
        while b>1:
            if b%a==0:
                num[a]+=1
                b=b//a
            else:
                break

ans=1
        
for a in primes:
    if num[a]>0:
        ans=ans*(num[a]+1)%mod
        
#print(num)
print(ans)
Buggy python submission (verdict: Runtime Error):
s=list(map(str,input().split()))

print(''.join([s[0][0],s[1][0],s[2][0]]))s=list(map(int,input().split()))



Fixed submission:
s=list(map(str,input().split()))

print(''.join([s[0][0],s[1][0],s[2][0]]))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())

f=0

if b%c==0 and a%c==0:
    f+=1
if a==0 and b>0:
    f+=1

print(b//c-a//c+f)a,b,c=map(int,input().split())

f=0

if b%c==0 and a%c==0:
    f=1

print(b//c-a//c+f)

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

f=0

if b%c==0 and a%c==0:
    f+=1

if a==0 and b==0:
    print(1)
elif a==0:
    print(b//c+1)
else:
    print(b//c-(a-1)//c)
Buggy python submission (verdict: Runtime Error):
w,h,n=map(int,input().split())

ma_x=w
ma_y=h
mi_x=0
mi_y=0

for i in range(n):
    x,y,a=map(int,input().split())
    if a==1:
        if mi_x<x:
            mi_x=x
    elif a==2:
        if ma_x>x:
            ma_x=x
    elif a==3:
        if mi_y<y:
            mi_y=y
    elif a==4:
        if ma_y>y:
            ma_y=y

if ma_x-mi_x<0 and ma_y-mi_y<0:
  ma_x-mi_x=0
            
ans=(ma_x-mi_x)*(ma_y-mi_y)

if ans<0:
    ans=0

print(ans)

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

ma_x=w
ma_y=h
mi_x=0
mi_y=0

for i in range(n):
    x,y,a=map(int,input().split())
    if a==1:
        if mi_x<x:
            mi_x=x
    elif a==2:
        if ma_x>x:
            ma_x=x
    elif a==3:
        if mi_y<y:
            mi_y=y
    elif a==4:
        if ma_y>y:
            ma_y=y

if ma_x-mi_x<0 and ma_y-mi_y<0:
  ma_x=mi_x
            
ans=(ma_x-mi_x)*(ma_y-mi_y)

if ans<0:
    ans=0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
k=list(map(int,input().split()))

sa=0
ans=1
ma=max(k)

for i in range(a-1):
    if k[i]==ma:
        ma=max(k[i+1:a])
    tmp=ma-k[i]
    if tmp>sa:
        sa=tmp
        ans=1
    elif tmp==sa:
        ans+=1

    

print(ans)

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

sa=0
ans=1

n=k[a-1]

for i in range(a-2,-1,-1):
    if k[i]>n:
        n=k[i]
    tmp=n-k[i]
    if tmp>sa:
        sa=tmp
        ans=1
    elif tmp==sa:
        ans+=1

    

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
k=list(map(int,input().split()))

sa=[0]*a
ma=max(k)

for i in range(a-1):
    if k[i]==ma:
        ma=max(k[i+1:a])
    sa[i]=ma-k[i]

sa.sort()
sa.reverse()

ans=1
now=1

while sa[now]==sa[0]:
    ans+=1
    now+=1
    

print(ans)

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

sa=0
ans=1

n=k[a-1]

for i in range(a-2,-1,-1):
    if k[i]>n:
        n=k[i]
    tmp=n-k[i]
    if tmp>sa:
        sa=tmp
        ans=1
    elif tmp==sa:
        ans+=1

    

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

print((1+N)*N//2)

Fixed submission:
N=int(input())

print((1+N)*N//2)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort()
a = []
ans = 0
for i in range(m-1):
  a.append(x[i+1]-x[i])
a.sort()
if n >= m:
  print(0)
else:
  for i in range(m-n):
    ans += a[i]
  print(ans)


Fixed submission:
t,x = map(int,input().split())
print(t/x)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort()
a = []
ans = 0
for i in range(m-1):
  a.append(x[i+1]-x[i])
a.sort()
if n >= m:
  print(0)
else:
  for i in range(m-n+1):
    ans += a[i]
  print(ans)


Fixed submission:
t,x = map(int,input().split())
print(t/x)
Buggy python submission (verdict: Runtime Error):
n = int(input())
t = list(map(int,input().split()))
a = max(t)
if a < sum(t.remove(a)):
  print("Yes")
else:
  print("No")


Fixed submission:
n = int(input())
t = list(map(int,input().split()))
a = max(t)
if a < (sum(t) - a):
  print("Yes")
else:
  print("No")