Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

l = list()
c = 0

for i in range(n):
    x = input()
    if x in l:
        c += 0
    else:
        c += 1
        l.append(x)

print(c)
        


Fixed submission:
n = int(input())

l = list()
c = 0

for i in range(n):
    x = input()
    l.append(x)

l = set(l)
print(len(l))
Buggy python submission (verdict: Runtime Error):
x = input().split()
n = int(x[0])
k = int(x[1])
 
h = input().split()
 
h = sorted(h)
 
if n-k <= 0:
    print(0)
    exit()
 
c = 0
for i in range(n-k):
    c += int(h[i])
print(c)
    


Fixed submission:
x = input().split()
h = int(x[0])
a = int(x[1])
if h%a == 0:
    print(h//a)
else:
    print(h//a+1)

Buggy python submission (verdict: Runtime Error):
x = input().split()
n = int(x[0])
k = int(x[1])
 
h = input().split()
 
sorted(h)
 
if n-k <= 0:
    print(0)
    exit()
 
c = 0
for i in range(n-k):
    c += int(h[i])
print(c)
    


Fixed submission:
x = input().split()
h = int(x[0])
a = int(x[1])
if h%a == 0:
    print(h//a)
else:
    print(h//a+1)

Buggy python submission (verdict: Runtime Error):
x = input().split()
n = int(x[0])
k = int(x[1])
 
h = input().split()
 
sorted(h)
 
if n-k <= 0:
    print(0)
    exit()
 
c = 0
for i in range(n-k):
    c += int(h[i])
print(c)
    

Fixed submission:
x = input().split()
h = int(x[0])
a = int(x[1])
if h%a == 0:
    print(h//a)
else:
    print(h//a+1)
Buggy python submission (verdict: Runtime Error):
import math

p = input().split()
a = int(p[0])
b = int(p[1])

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))



Fixed submission:


p = input().split()
a = int(p[0])
b = int(p[1])

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x%y == 0:
        return y
    else:
        while x%y != 0:
            z = x%y
            x = y
            y = z
        else:
            return z
def lcm(m, n):
    return int(m*n//gcd(m, n))

print(lcm(a, b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
g = input().split()
a = [int(i) for i in g]
b = list()
for i in reversed(g):
  b.append(int(i))
x = list()
y = list()
z = list()
p = 0
q = 0
r = 0
s = 0
c = n-1
for i in range(n):
  for i in a:
    x.append(i)
    r += 1
    if r == c:
      break
    p = sum(x)-p
  for i in b:
    y.append(i)
    s += 1
    if s == n-c:
      break
    q = sum(y)-q
  c -= 1
  z.append(abs(p-q))
print(min(z))
  
   

Fixed submission:
a = input().split()
p = int(a[0])
q = int(a[1])
r = int(a[2])
x = p + q
y = q + r
z = p + r
print(min([x,y,z]))

Buggy python submission (verdict: Runtime Error):
n = int(input())
g = input().split()
a = [int(i) for i in g]
b = list()
for i in reversed(g):
  b.append(int(i))
x = list()
y = list()
z = list()
p = 0
q = 0
r = 0
s = 0
c = n-1
for i in range(n):
  for i in a:
    x.append(i)
    r += 1
    if r == c:
      break
    p = sum(a)-p
  for i in b:
    y.append(i)
    s += 1
    if s == n-c:
      break
  c -= 1
  z.append(p-q)
print(min(z))
  

Fixed submission:
a = input().split()
p = int(a[0])
q = int(a[1])
r = int(a[2])
x = p + q
y = q + r
z = p + r
print(min([x,y,z]))

Buggy python submission (verdict: Runtime Error):
a = input().split()
p = int(a[0])
q = int(a[1])
r = int(a[2])
print(min[p+q,p+r,q+r])

Fixed submission:
a = input().split()
p = int(a[0])
q = int(a[1])
r = int(a[2])
x = p + q
y = q + r
z = p + r
print(min([x,y,z]))

Buggy python submission (verdict: Runtime Error):
a = input().split()
p = int(a[0])
q = int(a[1])
r = int(a[2])
x = p + q
y = q + r
z = p + r
print(min[x,y,z])

Fixed submission:
a = input().split()
p = int(a[0])
q = int(a[1])
r = int(a[2])
x = p + q
y = q + r
z = p + r
print(min([x,y,z]))
Buggy python submission (verdict: Runtime Error):
x = input().split()
n = int(x[0])
m = int(x[1])
a = list()
for i in range(m):
  y = input().split()
  l = int(y[0])
  r = int(y[1])
  for i in range(l,r+1):
    a.append(i)
b = 0
for i in range(n):
  if a.count(i) == m:
    b += 1
print(b)
  

Fixed submission:
x = input().split()
a = int(x[0])
b = int(x[1])
if a >= 13:
  print(b)
elif 6 <= a <= 12:
  print(b//2)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
x = input().split()
a = int(x[0])
b = int(x[1])
if a >= 13:
  print(b)
elif 6 <= a <= 12:
  priny(b//2)
else:
  print(0)

Fixed submission:
x = input().split()
a = int(x[0])
b = int(x[1])
if a >= 13:
  print(b)
elif 6 <= a <= 12:
  print(b//2)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import collections
import itertools

def resolve():
    N=int(input())
    A=list(map(int,input().split()))

    MOD=10**9+7
    ans=0
    for i in range(N-1):
        for j in range(i+1,N):
                ans=ans%MOD+(A[i]*A[j])%MOD

    print(ans)

resolve()

Fixed submission:
import math
import collections
import itertools

def resolve():
    N=int(input())
    A=list(map(int,input().split()))

    B=[0]*N
    B[N-1]=A[N-1]
    MOD=10**9+7
    for j in range(N-2,0,-1):
        B[j]=(B[j+1]+A[j])%MOD
   
    ans=0
    for i in range(N-1):
        ans=ans%MOD+(A[i]*B[i+1])%MOD

    print(ans%MOD)

resolve()
Buggy python submission (verdict: Time Limit Exceeded):
import math

def resolve():
    
    N,K=map(int,input().split())
    A=list(map(int,input().split()))

    dp=[1]*202020
    for i in range(K):
        dp[K]*=A[i]

    for i in range(K+1,N+1):
        dp[i]=dp[i-1]/A[i-K-1]*A[i-1]
        if(dp[i]>dp[i-1]):
            print("Yes")
        else:
            print("No")


resolve()

Fixed submission:
import math

def resolve():
    
    N,K=map(int,input().split())
    A=list(map(int,input().split()))

    # dp=[1]*202020
    # for i in range(K):
    #     dp[K]*=A[i]

    for i in range(K+1,N+1):
        #dp[i]=dp[i-1]/A[i-K-1]*A[i-1]
        if(A[i-1]>A[i-K-1]):
            print("Yes")
        else:
            print("No")


resolve()
Buggy python submission (verdict: Runtime Error):
import itertools
import decimal
import math
import collections
import sys
input = sys.stdin.readline

T=input()

T.replace("?","D")

print(T.count("D")+T.count("PD")


Fixed submission:
import itertools
import decimal
import math
import collections
import sys
input = sys.stdin.readline

T=input()

T=T.replace('?','D')

print(T)
Buggy python submission (verdict: Time Limit Exceeded):
import math
X=int(input())

A=int(X**(1/5))
Bp=0
Bm=0
for i in range(X):
    if(A**5-Bp**5==X):
        print(A,Bp)
        break
    if(A**5-Bm**5==X):
        print(A,Bm)
        break
    Bp+=1
    Bm-=1



Fixed submission:
import math
X=int(input())

for A in range(-200,200):
    for B in range(-200,200):
        if(A**5-B**5==X):
            print(A,B)
            break
    else:
        continue
    break
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
tmp=""
for i in range(N):
  if(S[i]!="Z"):
    tmp+=chr(ord(S[i])+1)
  else:
    tmp+="A"
print(tmp)


Fixed submission:
N=int(input())
S=input()
tmp=""
for i in range(len(S)):
  chtmp=ord(S[i])+N
  if(chtmp>ord('Z')):
    chtmp-=(ord('Z') - ord('A') + 1)
  tmp+=chr(chtmp)
print(tmp)

Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
tmp=""
for i in range(N):
  if(S[i]!=Z):
    tmp+=chr(ord(S[i])+1)
  else:
    tmp+="A"
print(tmp)

Fixed submission:
N=int(input())
S=input()
tmp=""
for i in range(len(S)):
  chtmp=ord(S[i])+N
  if(chtmp>ord('Z')):
    chtmp-=(ord('Z') - ord('A') + 1)
  tmp+=chr(chtmp)
print(tmp)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))


ans=0
for i in range(N):
  ans+=B[A[i]-1]
  if(i>=1):
    if(A[i]==A[i-1]+1):
      ans+=C[i]
      
print(ans)
  


Fixed submission:
import math

def resolve():
    N=int(input())
    A=list(map(int,input().split()))
    B=list(map(int,input().split()))
    C=list(map(int,input().split()))


    ans=0
    for i in range(N):
        ans+=B[A[i]-1]
        if(i>=1):
            if(A[i]==A[i-1]+1):
                ans+=C[A[i-1]-1]
        
    print(ans)
  

resolve()

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

ans=0
for i in range(N):
  ans+=B[A[i]]
  if(i>=1):
    if(A[i]==A[i-1]+1):
      ans+=C[i-1]
      
print(ans)
  

Fixed submission:
import math

def resolve():
    N=int(input())
    A=list(map(int,input().split()))
    B=list(map(int,input().split()))
    C=list(map(int,input().split()))


    ans=0
    for i in range(N):
        ans+=B[A[i]-1]
        if(i>=1):
            if(A[i]==A[i-1]+1):
                ans+=C[A[i-1]-1]
        
    print(ans)
  

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

if(A>=3200):
  print(S)
else:
  print("red")

Fixed submission:
a=int(input())
S=input()

if(a>=3200):
  print(S)
else:
  print("red")

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

if(A>=3200):
  print(S)
else:
  print("red")

Fixed submission:
a=int(input())
S=input()

if(a>=3200):
  print(S)
else:
  print("red")
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))

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

print(1/ans)

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

ans=0
for i in range(N):
  ans+=1/A[i]

print(1/ans)
Buggy python submission (verdict: Runtime Error):
print(3*(int(input())**2)

Fixed submission:
r=int(input())
print(3*r**2)
Buggy python submission (verdict: Runtime Error):
N=input()
print(180*(N-2))

Fixed submission:
N=int(input())
print((180*(N-2)))
Buggy python submission (verdict: Runtime Error):
r,D,x=map(int,input().split())

tmp=x
for i in range(10):
  tmp=tmp*r-d
  print(tmp)

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

tmp=x
for i in range(10):
  tmp=tmp*r-D
  print(tmp)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()
tmp=list(S)
tmp[K]=tmp[K].lower()
print(tmp)

Fixed submission:
N,K=map(int,input().split())
S=input()
tmp=list(S)
tmp[K-1]=tmp[K-1].lower()
print("".join(tmp))
Buggy python submission (verdict: Runtime Error):
for i in range(6):
  A[i]=int(input())
  
isOK=True
for i in range(5):
  for j in range(5):
    if(abs(A[i]-A[j]) > A[6]):
      isOK=False
      
if(isOK):
  print("Yay!")
else:
  print(":(")

Fixed submission:
A=[0]*6
for i in range(6):
  A[i]=int(input())
  
isOK=True
for i in range(5):
  for j in range(i,5):
    if(abs(A[i]-A[j]) > A[5]):
      isOK=False
      
if(isOK):
  print("Yay!")
else:
  print(":(")

Buggy python submission (verdict: Runtime Error):
a=int(input)
b=int(input)
c=int(input)
d=int(input)
e=int(input)
k=int(input)

isOK=True

if(e-a<=k):
  print(":(")
else:
  print("Yay!")

Fixed submission:
A=[0]*6
for i in range(6):
  A[i]=int(input())
  
isOK=True
for i in range(5):
  for j in range(i,5):
    if(abs(A[i]-A[j]) > A[5]):
      isOK=False
      
if(isOK):
  print("Yay!")
else:
  print(":(")
Buggy python submission (verdict: Runtime Error):
import sys
lines = sys.stdin.readlines()

list={"A":"T","T":"A","G":"C","C":"G"}
b = lines
print(list[b])

Fixed submission:
#import sys
#input = sys.stdin.readline

list={"A":"T","T":"A","G":"C","C":"G"}
b = input()
print(list[b])

Buggy python submission (verdict: Runtime Error):
import sys
#input = sys.stdin.readlines

list={"A":"T","T":"A","G":"C","C":"G"}
b = sys.stdin.readlines()
print(list[b])

Fixed submission:
#import sys
#input = sys.stdin.readline

list={"A":"T","T":"A","G":"C","C":"G"}
b = input()
print(list[b])

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readlines

list={"A":"T","T":"A","G":"C","C":"G"}
b = input()
print(list[b])

Fixed submission:
#import sys
#input = sys.stdin.readline

list={"A":"T","T":"A","G":"C","C":"G"}
b = input()
print(list[b])

Buggy python submission (verdict: Runtime Error):
import sys

list={"A":"T","T":"A","G":"C","C":"G"}
b = sys.stdin.readline()
print(list[b])

Fixed submission:
#import sys
#input = sys.stdin.readline

list={"A":"T","T":"A","G":"C","C":"G"}
b = input()
print(list[b])

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

list={"A":"T","T":"A","G":"C","C":"G"}
b = input()
print(list[b])

Fixed submission:
#import sys
#input = sys.stdin.readline

list={"A":"T","T":"A","G":"C","C":"G"}
b = input()
print(list[b])

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

list={"A":"T","T":"A","G":"C","C":"G"}
b = input()
print(list[b])

Fixed submission:
#import sys
#input = sys.stdin.readline

list={"A":"T","T":"A","G":"C","C":"G"}
b = input()
print(list[b])
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
if(N>=(2*(K-1)))
  print("YES")
else:
  print("NO")

Fixed submission:
N,K=map(int,input().split())
if(N>(2*(K-1))):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())

if(A>B):
  ans1=B
  ans2=A-(N-B)
else:
  ans1=A
  ans2=B-(N-A)
  
print(ans1+" "+ans2)

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

if(A>B):
  ans1=B
  ans2=max(0,A-(N-B))
else:
  ans1=A
  ans2=max(0,B-(N-A))
  
print(str(ans1)+" "+str(ans2))
Buggy python submission (verdict: Runtime Error):
spam='ACL'
print(spam*K)

Fixed submission:
K = int(input())
spam=('ACL')
print(spam*K)

Buggy python submission (verdict: Runtime Error):
spam='ACL'
print(spam*K)

Fixed submission:
K = int(input())
spam=('ACL')
print(spam*K)

Buggy python submission (verdict: Runtime Error):
spam='ACL'
print(spam*K)

Fixed submission:
K = int(input())
spam=('ACL')
print(spam*K)
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
s = sorted([input() for i in range(N)])

print(*s, sep="")


Fixed submission:
i = list(map(int, input().split(" ")))
#print(s)
#print(s[1])
#import pdb; pdb.set_trace()

if  [5, 5, 7] == sorted(i):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
[_x, _k, _d] = list(map(int, input().split(" ")))
_x = abs(_x)

while _k > 0:
  if _x >= _d:
    _x = abs(_x - _d)
    _k -= 1
  else:
    if _k % 2 == 1:
      _x = abs(_x - _d)
    _k = 0

print(_x)

Fixed submission:
[_x, _k, _d] = list(map(int, input().split(" ")))
_x = abs(_x)

if _x >= _d:
  _y = _x//_d
  if _k < _y:
    _y = _k
  _x = abs(_x - _d * _y)
  _k -= _y
if _k % 2 == 1:
  _x = abs(_x - _d)

print(_x)
Buggy python submission (verdict: Runtime Error):
print(K*"AKL")

Fixed submission:
k=int(input())
print(k*"ACL")

Buggy python submission (verdict: Runtime Error):
if C<=A<=D or C<=B<=D or A<=C<=B or A<=D<=B: print("Yes")
else: print("No")

Fixed submission:
k=int(input())
print(k*"ACL")
Buggy python submission (verdict: Runtime Error):
A, B = input.trim().split()
C = int(A) * float(B)
D = C // 1
print(round(C))

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

print(int(C))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
mod = 998244353
s = list()
for _ in range(k):
    l, r = map(int, input().split())
    s += range(l, r + 1)
s.sort()
dp = [0 for _ in range(n)]
dp[0] = 1
for i in range(n):
    for x in s:
        if x + i > n - 1:
            break
        dp[i + x] = (dp[i + x] + dp[i]) % mod

print(dp[-1])


Fixed submission:
n, k = map(int, input().split())
LR = [tuple(map(int, input().split())) for _ in range(k)]
dp = [0 for _ in range(n + 1)]
dp[1] = 1
s = 0
mod = 998244353

for i in range(1, n + 1):
    s += dp[i]
    for l, r in LR:
        if i + l <= n:
            dp[i + l] = (dp[i + l] + s) % mod
            if i + r + 1 <= n:
                dp[i + r + 1] = (dp[i + r + 1] - s) % mod

print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
input = stdin.readline
def main():
    N,M=map(int, input().split())
    l =[set() for _ in range(N)]
    for _ in range(M):
        a,b=map(int, input().split())
        for s in l:
            if s:
                if a in s or b in s:
                    s.add(a)
                    s.add(b)
                    break
            else:
                s.add(a)
                s.add(b)
                break
    ans=-1
    for s in l:
        if not(s):
            break
        ans=max(ans,len(s))
    if ans==-1:
        print(1)
    else:
        print(ans)
if __name__ == "__main__":
    main()

Fixed submission:
import sys

class UnionFind():
    def __init__(self,n):
        self.n = n
        self.parents=[-1 for _ in range(n)]
    
    def find(self,n):
        x=self.parents[n]
        if x<0:
            return n
        else:
            self.parents[n]=self.find(self.parents[n])
            return self.parents[n]
    
    def union(self,n,m):
        x=self.find(n)
        y=self.find(m)
        if x==y:
            return
        if self.parents[x]>self.parents[y]:
            x,y=y,x
        self.parents[x]+=self.parents[y]
        self.parents[y]=x

sys.setrecursionlimit(10**9)    
n,m=map(int,input().split())
uf=UnionFind(n)

for _ in range(m):
    a,b=map(lambda x: int(x)-1, input().split())
    uf.union(a,b) 

ans=0

for p in uf.parents:
    ans=min(ans,p)

print(abs(ans))

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N,M=map(int, input().split())
    l =[set() for _ in range(N)]
    for _ in range(M):
        a,b=map(int, input().split())
        for s in l:
            if s:
                if a in s or b in s:
                    s.add(a)
                    s.add(b)
                    break
            else:
                s.add(a)
                s.add(b)
                break
    ans=-1
    for s in l:
        if not(s):
            break
        ans=max(ans,len(s))
    if ans==-1:
        print(1)
    else:
        print(ans)
if __name__ == "__main__":
    main()

Fixed submission:
import sys

class UnionFind():
    def __init__(self,n):
        self.n = n
        self.parents=[-1 for _ in range(n)]
    
    def find(self,n):
        x=self.parents[n]
        if x<0:
            return n
        else:
            self.parents[n]=self.find(self.parents[n])
            return self.parents[n]
    
    def union(self,n,m):
        x=self.find(n)
        y=self.find(m)
        if x==y:
            return
        if self.parents[x]>self.parents[y]:
            x,y=y,x
        self.parents[x]+=self.parents[y]
        self.parents[y]=x

sys.setrecursionlimit(10**9)    
n,m=map(int,input().split())
uf=UnionFind(n)

for _ in range(m):
    a,b=map(lambda x: int(x)-1, input().split())
    uf.union(a,b) 

ans=0

for p in uf.parents:
    ans=min(ans,p)

print(abs(ans))
Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd
n=int(input())
A=list(map(int,input().split()))
m=max(A)
l=[0 for _ in range(m)]
fp=True
for a in A:
    l[a-1]+=1
for i in range(2,m):
    cnt=0
    for j in range(i-1,m,i):
        cnt+=l[j]
        if cnt>1:
            fp=False
            break
g=0
fs=False
for a in A:
    g=gcd(g,a)
if g==1:
    fs=True

if fp:
    print("pairwise coprime")
elif fs:
    print("setwise coprime")
else:
    print("not coprime")

Fixed submission:
from math import gcd
def main():
    n=int(input())
    A=list(map(int,input().split()))
    m=max(A)
    l=[0 for _ in range(m)]
    fp=True
    for a in A:
        l[a-1]+=1
    for i in range(2,m):
        cnt=0
        for j in range(i-1,m,i):
            cnt+=l[j]
            if cnt>1:
                fp=False
                break
    g=0
    fs=False
    for a in A:
        g=gcd(g,a)
    if g==1:
        fs=True

    if fp:
        print("pairwise coprime")
    elif fs:
        print("setwise coprime")
    else:
        print("not coprime")
if __name__=="__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
H, W, M = map(int, input().split())
cnth = [[0, i] for i in range(H)]
cntw = [[0, i] for i in range(W)]
L = [[False for _ in range(W)] for _ in range(H)]
for _ in range(M):
    h, w = map(lambda x: int(x) - 1, input().split())
    cnth[h][0] += 1
    cntw[w][0] += 1
    L[h][w] = True
cnth.sort(reverse=True)
cntw.sort(reverse=True)
mh = set()
ph = cnth[0]
for h in cnth:
    if ph[0] == h[0]:
        mh.add(h[1])
    else:
        break
    ph = h
mw = set()
pw = cntw[0]
for w in cntw:
    if pw[0] == w[0]:
        mw.add(w[1])
    else:
        break
    pw = w
max = cnth[0][0] + cntw[0][0]
for h in mh:
    for w in mw:
        if not (L[h][w]):
            print(max)
            break
    else:
        continue
    break
else:
    print(max - 1)


Fixed submission:
def main():
    H, W, M = map(int, input().split())
    cnth = [[0, i] for i in range(H)]
    cntw = [[0, i] for i in range(W)]
    L = set()
    for _ in range(M):
        h, w = map(lambda x: int(x) - 1, input().split())
        cnth[h][0] += 1
        cntw[w][0] += 1
        L.add((h, w))
    cnth.sort(reverse=True)
    cntw.sort(reverse=True)
    mh = set()
    ph = cnth[0]
    for h in cnth:
        if ph[0] == h[0]:
            mh.add(h[1])
        else:
            break
        ph = h
    mw = set()
    pw = cntw[0]
    for w in cntw:
        if pw[0] == w[0]:
            mw.add(w[1])
        else:
            break
        pw = w
    maxans = cnth[0][0] + cntw[0][0]
    for h in mh:
        for w in mw:
            if not ((h, w) in L):
                print(maxans)
                break
        else:
            continue
        break
    else:
        print(maxans - 1)
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
L R d =map(int, input().split())
ans = 0
for i in range(L, R + 1):
  if i % d == 0:
    ans += 1
print(ans)

Fixed submission:
L, R, d =map(int, input().split())
ans = 0
for i in range(L, R + 1):
  if i % d == 0:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort(reversre=True)
ans = 0
d = deque(A[0])
for x in A[1:]:
  ans += d.popleft()
  d.append(x)
  d.append(x)
print(ans)

Fixed submission:
from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
d = deque([A[0]])
for x in A[1:]:
  ans += d.popleft()
  d.append(x)
  d.append(x)
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
import heapq
N = int(input())
A = sorted(list(map(int, input().split())))
max3 = heapq.nlargest(3, A)
d = Counter(A)
if d[max3[1]] == 1:
  ans = sum(A) + max3[1] - max3[2] - A[0]
else:
  ans = sum(A) - A[0]
print(ans)

Fixed submission:
from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
d = deque([A[0]])
for x in A[1:]:
  ans += d.popleft()
  d.append(x)
  d.append(x)
print(ans)