Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().strip().split()))
sum=0
for i in range(0,n-1):
    minsum=0
    for j in range(i+1,n):
        minsum += x[j]
        if(minsum>=1000000007):
            minsum-=1000000007
    sum += x[i]*minsum
sum%=1000000007
print(sum)

Fixed submission:
n = int(input())
x = list(map(int, input().strip().split()))
sum=0
minsum=0
for i in range(0,n):
    minsum += x[i]
for i in range(0,n-1):
    minsum-=x[i]
    sum += x[i]*minsum
    if(sum>10**9+7):
        sum%=(10**9+7)
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().strip().split()))
sum=0
for i in range(0,n-1):
    x[i] %= (10**9+7)
    minsum=0
    for j in range(i+1,n):
        minsum += x[j]
        if(minsum>=1000000007):
            minsum-=1000000007
    sum += x[i]*minsum
sum%=1000000007
print(sum)

Fixed submission:
n = int(input())
x = list(map(int, input().strip().split()))
sum=0
minsum=0
for i in range(0,n):
    minsum += x[i]
for i in range(0,n-1):
    minsum-=x[i]
    sum += x[i]*minsum
    if(sum>10**9+7):
        sum%=(10**9+7)
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().strip().split()))
sum=0
for i in range(0,n):
    x[i] %= (10**9+7)
for i in range(0,n-1):
    for j in range(i+1,n):
        sum += ((x[i]*x[j])%(10**9+7))

print(sum%(10**9+7))

Fixed submission:
n = int(input())
x = list(map(int, input().strip().split()))
sum=0
minsum=0
for i in range(0,n):
    minsum += x[i]
for i in range(0,n-1):
    minsum-=x[i]
    sum += x[i]*minsum
    if(sum>10**9+7):
        sum%=(10**9+7)
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().strip().split()))
sum=0
for i in range(0,n):
    x[i] %= (10**9+7)
for i in range(0,n-1):
    for j in range(i+1,n):
        sum += x[i]*x[j]
        if(sum>=(10**9+7)):
            sum %= (10**9+7)
print(sum)

Fixed submission:
n = int(input())
x = list(map(int, input().strip().split()))
sum=0
minsum=0
for i in range(0,n):
    minsum += x[i]
for i in range(0,n-1):
    minsum-=x[i]
    sum += x[i]*minsum
    if(sum>10**9+7):
        sum%=(10**9+7)
print(sum)
Buggy python submission (verdict: Runtime Error):
x=[]
n=int(input())
for i in range(0,n):
    xa=int(input())
    x.append(xa)
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
                continue
            if ((x[i]+x[j]>x[k])and(x[i]+x[k]>x[j])and(x[j]+x[k]>x[i])):
                count+=1
print(count)

Fixed submission:
n = int(input().strip())
x = list(map(int, input().strip().split()))
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
                continue
            if ((x[i]+x[j]>x[k])and(x[i]+x[k]>x[j])and(x[j]+x[k]>x[i])):
                count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
x=[]
n=int(input())
for i in range(0,n):
    xa=int(input())
    x.append(xa)
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
                continue
            if ((x[i]+x[j]>x[k])and(x[i]+x[k]>x[j])and(x[j]+x[k]>x[i])):
                count+=1
print(count)

Fixed submission:
n = int(input().strip())
x = list(map(int, input().strip().split()))
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
                continue
            if ((x[i]+x[j]>x[k])and(x[i]+x[k]>x[j])and(x[j]+x[k]>x[i])):
                count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
x=[]
n=int(input())
for i in range(0,n):
    xa=int(input())
    x.append(xa)
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
               continue
            if ((x[i]+x[j]>x[k])or(x[i]+x[k]>x[j])or(x[j]+x[k]>x[i])):
                count+=1
print(count)

Fixed submission:
n = int(input().strip())
x = list(map(int, input().strip().split()))
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
                continue
            if ((x[i]+x[j]>x[k])and(x[i]+x[k]>x[j])and(x[j]+x[k]>x[i])):
                count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
num = 7
plus = 70
i=1
a=[]
while num%N!=0:
    xx=num%N
    if xx in a:
        i=-1
        break
    a.append(xx)
    num=10*xx+7
    i+=1
print(i)

Fixed submission:
N=int(input())
num = 7
i=1
a=[]
prir1=1
while i<=N:
    xx=num%N
    if xx==0:
        print(i)
        prir1=0
        break
    num=10*xx+7
    i+=1
if prir1:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
num = 7
plus = 70
i=1
a=[]

while num%N!=0:
    if num%N in a:
        i=-1
        break
    a.append(num%N)
    num+=plus
    plus*=10
    i+=1
    if i>N:
        i=-1
        break
print(i)

Fixed submission:
N=int(input())
num = 7
i=1
a=[]
prir1=1
while i<=N:
    xx=num%N
    if xx==0:
        print(i)
        prir1=0
        break
    num=10*xx+7
    i+=1
if prir1:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
num = 7
plus = 70
i=1
if (N%2==0)or(N%5==0):
    print(-1)
else:
    while num%N!=0:
        num+=plus
        plus*=10
        i+=1
    print(i)

Fixed submission:
N=int(input())
num = 7
i=1
a=[]
prir1=1
while i<=N:
    xx=num%N
    if xx==0:
        print(i)
        prir1=0
        break
    num=10*xx+7
    i+=1
if prir1:
    print(-1)

Buggy python submission (verdict: Runtime Error):
N=int(input())
num=0
if (N%2==0)or(N%5==0):
    print(-1)
else:
    for i in range(1,N):
        num+=i*7
        if num%N==0:
            break
    print(i)

Fixed submission:
N=int(input())
num = 7
i=1
a=[]
prir1=1
while i<=N:
    xx=num%N
    if xx==0:
        print(i)
        prir1=0
        break
    num=10*xx+7
    i+=1
if prir1:
    print(-1)
Buggy python submission (verdict: Runtime Error):
x=int(input())
x=1000-x%1000
if(x==1000):
    x=0
return(x)

Fixed submission:
x=int(input())
x=1000-x%1000
if(x==1000):
    x=0
print(x)

Buggy python submission (verdict: Runtime Error):
print('N')
x=int(input())
x=1000-x%1000
if(x==1000):
    x=0
return(x)

Fixed submission:
x=int(input())
x=1000-x%1000
if(x==1000):
    x=0
print(x)
Buggy python submission (verdict: Runtime Error):
x=int(input())
cac=0
cwa=0
tle=0
cre=0

for i in range(0,x):
    moji=input()
    if(moji=='AC'):
        cac+=1
    if(moji=='WA'):
        cwa+=1
    if(moji=='TLE'):
        ctle+=1
    if(moji=='RE'):
        cre+=1
print('AC x ',cac)
print('WA x' ,cwa)
print('TLE x ',ctle)
print('RE x' ,cre)

Fixed submission:
x=int(input())
cac=0
cwa=0
ctle=0
cre=0

for i in range(0,x):
    moji=input()
    if(moji=='AC'):
        cac+=1
    if(moji=='WA'):
        cwa+=1
    if(moji=='TLE'):
        ctle+=1
    if(moji=='RE'):
        cre+=1
print('AC x ',cac)
print('WA x' ,cwa)
print('TLE x ',ctle)
print('RE x' ,cre)

Buggy python submission (verdict: Runtime Error):
x=int(input())
cac=0
cwa=0
tle=0
cre=0

for i in range(0,x):
    moji=input()
    if(moji='AC'):
        cac+=1
    if(moji='WA'):
        cwa+=1
    if(moji='TLE'):
        ctle+=1
    if(moji='RE'):
        cre+=1
print('AC x',cac)
print('WA x',cwa)
print('TLE x',ctle)
print('RE x',cre)

Fixed submission:
x=int(input())
cac=0
cwa=0
ctle=0
cre=0

for i in range(0,x):
    moji=input()
    if(moji=='AC'):
        cac+=1
    if(moji=='WA'):
        cwa+=1
    if(moji=='TLE'):
        ctle+=1
    if(moji=='RE'):
        cre+=1
print('AC x ',cac)
print('WA x' ,cwa)
print('TLE x ',ctle)
print('RE x' ,cre)
Buggy python submission (verdict: Runtime Error):
str = input()
times = int(input())
revers = 0
head = ""
tail = ""
for i in range(times):
    com = input().split()
    if com[0] == "1":
        if revers == 0:
            revers = 1:
        else :
            revers = 0
        
    else :
        if com[1] == "1":
            if revers == 0:
                head = com[2]+head
            else :
                tail = tail + com[2]
        else : 
            if revers == 1:
                head = com[2]+head
            else :
                tail = tail + com[2]          
str = head + str + tail
if revers == 1:
    str = str[::-1]
                
print(str)

Fixed submission:
str = input()
times = int(input())
revers = 0
head = ""
tail = ""
for i in range(times):
    com = input().split()
    if com[0] == "1":
        if revers == 0:
            revers = 1
        else :
            revers = 0
        
    else :
        if com[1] == "1":
            if revers == 0:
                head = com[2]+head
            else :
                tail = tail + com[2]
        else : 
            if revers == 1:
                head = com[2]+head
            else :
                tail = tail + com[2]          
str = head + str + tail
if revers == 1:
    str = str[::-1]
                
print(str)

Buggy python submission (verdict: Time Limit Exceeded):
str = input()
times = int(input())
for i in range(times):
    com = input().split()
    if com[0] == "1":
        str = str[::-1]
    else :
        if com[1] == "1":
            str = com[2]+str
        else :
            str += com[2]            

print(str)

Fixed submission:
str = input()
times = int(input())
revers = 0
head = ""
tail = ""
for i in range(times):
    com = input().split()
    if com[0] == "1":
        if revers == 0:
            revers = 1
        else :
            revers = 0
        
    else :
        if com[1] == "1":
            if revers == 0:
                head = com[2]+head
            else :
                tail = tail + com[2]
        else : 
            if revers == 1:
                head = com[2]+head
            else :
                tail = tail + com[2]          
str = head + str + tail
if revers == 1:
    str = str[::-1]
                
print(str)
Buggy python submission (verdict: Time Limit Exceeded):
beforex=[]
beforey=[]
sum=0
for i in range(int(input())):
  xy=list(map(int,input().split()))
  beforex.append(xy[0])
  beforey.append(xy[1])

for i in range(len(beforex)-1):
  for j in range(i+1,len(beforex)):
    sum=max(sum,abs(beforex[i]-beforex[j])+abs(beforey[i]-beforey[j]))

print(sum)

Fixed submission:
beforex_plus_y=[]
beforex_minus_y=[]
for i in range(int(input())):
  xy=list(map(int,input().split()))
  beforex_plus_y.append(xy[0]+xy[1])
  beforex_minus_y.append(xy[0]-xy[1])

print(max(max(beforex_plus_y)-min(beforex_plus_y),max(beforex_minus_y)-min(beforex_minus_y)))

Buggy python submission (verdict: Time Limit Exceeded):
beforex=[]
beforey=[]
sum=0
for i in range(int(input())):
  xy=list(map(int,input().split()))
  beforex.append(xy[0])
  beforey.append(xy[1])

for i in range(len(beforex)-1):
  for j in range(i,len(beforex)):
    sum=max(sum,abs(beforex[i]-beforex[j])+abs(beforey[i]-beforey[j]))

print(sum)

Fixed submission:
beforex_plus_y=[]
beforex_minus_y=[]
for i in range(int(input())):
  xy=list(map(int,input().split()))
  beforex_plus_y.append(xy[0]+xy[1])
  beforex_minus_y.append(xy[0]-xy[1])

print(max(max(beforex_plus_y)-min(beforex_plus_y),max(beforex_minus_y)-min(beforex_minus_y)))
Buggy python submission (verdict: Runtime Error):
N, D = list(map(int, input().split()))
count = 0
for i in range(N):
  x, y = list(map(int, input().split()))
  if (x**2 + y**2) <= d**2:
    count += 1
print(count)

Fixed submission:
import math
n, d = list(map(int, input().split()))
count = 0
for _ in range(n):
  x, y = list(map(int, input().split()))
  if math.sqrt(x**2 + y**2) <= d:
    count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = int(input())
count = 0
for i in range (N):
    x = int(input())
    y = int(input())
    if((D * D) >= ((x * x) + (y * y))):
        ++count
print(count)

Fixed submission:
import math
n, d = list(map(int, input().split()))
count = 0
for _ in range(n):
  x, y = list(map(int, input().split()))
  if math.sqrt(x**2 + y**2) <= d:
    count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N = input()
D = input()
count = 0
for i in range (N):
    x = input()
    y = input()
    if((D * D) >= ((x * x) + (y * y))):
        ++count
print(count)

Fixed submission:
import math
n, d = list(map(int, input().split()))
count = 0
for _ in range(n):
  x, y = list(map(int, input().split()))
  if math.sqrt(x**2 + y**2) <= d:
    count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
N = 7
for i in range(K):
    if N % K == 0:
        print(i + 1)
        break
    N = (N * 10 + 7)
else:
    print(-1)

Fixed submission:
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t * 10 + 7) % K
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
K = int(input())
if(K % 2 == 0) or (K % 5 == 0):
    print(-1)
N = 7
for i in range(K):
    if　N % K == 0:
        print(i + 1)
        break
    N = ((N * 10) + 7) % K

Fixed submission:
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t * 10 + 7) % K
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
K = int(input())
if(K % 2 == 0 or K % 5 == 0):
    print(-1)
N = 7
for i in range(K):
    if　N % K == 0:
        print(i + 1)
        break
    N = ((N * 10) + 7) % K

Fixed submission:
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t * 10 + 7) % K
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
K = int(input())
if(K % 2 == 0 or K % 5 == 0):
    print(-1)
N = 7
for i in range(K):
    if　N % K == 0:
        print(i + 1)
        break
    else:
        N = ((N * 10) + 7) % K

Fixed submission:
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t * 10 + 7) % K
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
K = int(input())
if(K % 2 == 0 | K % 5 == 0):
    print(-1)
N = 7
for i in range(K):
    if　N % K == 0:
        print(i + 1)
        break
    else:
        N = ((N * 10) + 7) % K

Fixed submission:
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t * 10 + 7) % K
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
K = int(input())
if(K % 2 == 0 | K % 5 == 0):
    print(-1)
N = 7
for i in range(K):
    if　N % 7 == 0:
        print(i + 1)
        break
    else:
        N = ((N * 10) + 7) % K

Fixed submission:
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t * 10 + 7) % K
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
import sys
K = int(input())
N = 0
for i in range 2000000:
    if((K // (N + (10**i)*7)) == 0):
        print(i + 1)
        sys.exit()
    else:
        N = (N + (10**i)*7)
print(-1)

Fixed submission:
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t * 10 + 7) % K
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
a, b = int(map(input().split()))
print(a*b)

Fixed submission:
a, b = map(int, input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
D = int(input())
P = int(input())
ans = 0.0
def func(i):
    t = 0
    while(i < P):
        i *= 2
        t += 1
    return t

for i in range(1, D + 1):
    ans += float((1/D)) * float(((1 / 2) ** func(i)))

print(ans)

Fixed submission:
D, P = map(int, input().split())    
ans = 0.0
def func(i):
    t = 0
    while(i < P):
        i *= 2
        t += 1
    return t

for i in range(1, D + 1):
    ans += float((1/D)) * float(((1 / 2) ** func(i)))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())
total1 = 0
for i in range (a, b+1):
    if i % x == 0:
        total1 += 1
print(total1)

Fixed submission:
a, b, x = map(int, input().split())
print(b // x - (a - 1) // x)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
T = int(input())
x = T // A
y = B * x
print(y)

Fixed submission:
A,B,T = map(int,input().split())
x = T // A
y = B * x
print(y)

Buggy python submission (verdict: Runtime Error):
x = T % A
y = x * B
print(y)

Fixed submission:
A,B,T = map(int,input().split())
x = T // A
y = B * x
print(y)
Buggy python submission (verdict: Runtime Error):
N = int(input())
list1 = map(int,input().split())
list2 = map(int,input().split())
x = 0
for i in range(N):
    x = list1[i] - list2[i]
    if x >> 0:
         y += x
print(y)

Fixed submission:
N = int(input())
list1 = input().split()
list2 = input().split()
x = 0
y = 0
for i in range(N):
    x = int(list1[i]) - int(list2[i])
    if x > 0:
         y += x
print(y)

Buggy python submission (verdict: Runtime Error):
N = int(input())
list1 = []
for i in range(N):
    list1.append(int(input))
list2 = []
for i in range(N):
    list2.append(int(input))
x = 0
for i in range(N):
    x = list1[i] - list2[i]
    if x >> 0:
         y += x
print(y)

Fixed submission:
N = int(input())
list1 = input().split()
list2 = input().split()
x = 0
y = 0
for i in range(N):
    x = int(list1[i]) - int(list2[i])
    if x > 0:
         y += x
print(y)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))

L.sort()
s = 0

for n in range(N):
    s += L[2*n}

print(s)

Fixed submission:
n = int(input())
list_L = list(map(int, input().split()))
list_L.sort()
sum = 0
for i in range(n):
    sum += list_L[2*i]
print(sum)

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().split())
 
L.sort()
 
s = 0
 
for n in range(N):
    s += L[2*n]
print(s)

Fixed submission:
n = int(input())
list_L = list(map(int, input().split()))
list_L.sort()
sum = 0
for i in range(n):
    sum += list_L[2*i]
print(sum)

Buggy python submission (verdict: Runtime Error):
N = input()
L = list(map(int,input().split())
 
L.sort()
 
s = 0
 
for n in range(N):
    s += L[2*n]
print(s)

Fixed submission:
n = int(input())
list_L = list(map(int, input().split()))
list_L.sort()
sum = 0
for i in range(n):
    sum += list_L[2*i]
print(sum)

Buggy python submission (verdict: Runtime Error):
N =int( input())
L = list(map(int,input().split())
 
L.sort
 
s = 0
 
for n in range(N):
    s += L[2*n]
print(s)

Fixed submission:
n = int(input())
list_L = list(map(int, input().split()))
list_L.sort()
sum = 0
for i in range(n):
    sum += list_L[2*i]
print(sum)

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

L.sort

s = 0

for n in range(N):
    s += L[2*n]
print(s)

Fixed submission:
n = int(input())
list_L = list(map(int, input().split()))
list_L.sort()
sum = 0
for i in range(n):
    sum += list_L[2*i]
print(sum)
Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())


def para(a,b):
    if a == b:
        return a
    if a > b:
        return 2*b + para(b,a-b)
    if a < b:
        return 2*a + para(a,b-a)

print(N+para(X,N-X))

Fixed submission:
N,X = map(int,input().split(" "))
 
Y,X = sorted([N - X,X])
 
s = 0
while Y:
    s += (X//Y)*Y*3
    Y,X = [X%Y,Y]
 
print(s)

Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())


def para(a,b):
    if  b == 0:
        return a
    if a >= b:
        return a+b + para(b,a-b)
    if a < b:
        return 2*a + para(a,b-a)

print(X+para(X,N-X))

Fixed submission:
N,X = map(int,input().split(" "))
 
Y,X = sorted([N - X,X])
 
s = 0
while Y:
    s += (X//Y)*Y*3
    Y,X = [X%Y,Y]
 
print(s)

Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())


def para(a,b):
    if a > b:
        return a+b + para(b,a-b)
    if a < b:
        return 2*a + para(a,b-a)
    if a == b:
        return 3*a
print(X+para(X,N-X))

Fixed submission:
N,X = map(int,input().split(" "))
 
Y,X = sorted([N - X,X])
 
s = 0
while Y:
    s += (X//Y)*Y*3
    Y,X = [X%Y,Y]
 
print(s)

Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())
print(N)
print(X)

def para(a,b):
    if a > b:
        return a+b + para(b,a-b)
    if a < b:
        return 2*a + para(a,b-a)
    if a == b:
        return 3*a
print(X+para(X,N-X))

Fixed submission:
N,X = map(int,input().split(" "))
 
Y,X = sorted([N - X,X])
 
s = 0
while Y:
    s += (X//Y)*Y*3
    Y,X = [X%Y,Y]
 
print(s)

Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())
print(N)
print(X)

def para(a,b):
    if a > b:
        return 2*b + para(b,a-b)
    if a < b:
        return 2*a + para(b-a,a)
    if a == b:
        return a
print(N+para(X,N-X))

Fixed submission:
N,X = map(int,input().split(" "))
 
Y,X = sorted([N - X,X])
 
s = 0
while Y:
    s += (X//Y)*Y*3
    Y,X = [X%Y,Y]
 
print(s)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = [list(map(int, input().split()))for _ in range(n)]
​
cnt = 0
for i, (p, q) in enumerate(d):
    if p == q:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:        
        print("Yes")
        break
else:
    print("No")


Fixed submission:
n = int(input())
d = [list(map(int, input().split()))for _ in range(n)]

cnt = 0
for i, (p, q) in enumerate(d):
    if p == q:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        print("Yes")
        break
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = [list(map(int, input().split()))for _ in range(n)]
​
cnt = 0
for i, (p, q) in enumerate(d):
    if p == q:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:        
        print("Yes")
        break
else:
    print("No")
5

Fixed submission:
n = int(input())
d = [list(map(int, input().split()))for _ in range(n)]

cnt = 0
for i, (p, q) in enumerate(d):
    if p == q:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        print("Yes")
        break
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = [list(map(int, input().split()))for _ in range(n)]

flg = False
for i, (p, q) in enumerate(d):
    if p == q:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:        
        print("Yes")
        break
else:
    print("No")

Fixed submission:
n = int(input())
d = [list(map(int, input().split()))for _ in range(n)]

cnt = 0
for i, (p, q) in enumerate(d):
    if p == q:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        print("Yes")
        break
else:
    print("No")
Buggy python submission (verdict: Runtime Error):

cnt = 0
for a in range(1, n):
    cnt +=(n -1)// a
print(cnt)

Fixed submission:
n = int(input())

cnt = 0
for a in range(1, n):
    cnt +=(n -1)// a
print(cnt)

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

cnt = 0
for r in range(1, n):
    for a in range(1, (a // 2) +1):
        if r % a == 0:
            cnt += 1
print(cnt)

Fixed submission:
n = int(input())

cnt = 0
for a in range(1, n):
    cnt +=(n -1)// a
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
x, k, d = map(int, input().split())

ans = float("inf")
for i in range(k + 1):
    ans = min(ans, abs(x + (d * i) - (d * (k - i))))
print(ans)    

Fixed submission:
x, k, d = map(int, input().split())
x = abs(x)

a = x // d
b = x % d
if a > k:
    ans = x - (k * d)
else:
    if (k - a) % 2 == 0:
        ans = b
    else:
        ans = d - b
print(ans)