Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
H,W,K = map(int,input().split())

a = [list(input()) for _ in range(H)] #listの中にlist()を標準入力する。H行分作成する。
#a = np.zeros((int(H),int(W)))
print(a)
count = 0
ans = 0
for i in range(2**W): #行の塗り方のパターン
    for j in range(2**H): #列の塗り方のパターン
        count = 0
        for s in range(H):
            for t in range(W):
                if(i >> s)&1 and (j>>t) & 1 and a[s][t] =="#":
                    count += 1
            if count == K:
                ans += 1
print(ans)

Fixed submission:
N = int(input())

x = 0
while x < N:
    x = x + 1000

output = x - N
print(output)

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

i = 1
AC = 0
WA = 0
TLE = 0
RE = 0
list = []
for i in range(N):
    list.append(str(input()))
    a = list.count("AC")
    b = list.count("WA")
    c = list.count("TLE")
    d = list.count("RE")

print("AC x",a)
print("WA x" , b)
print("TLE x" , c)
print("RE x" ,d)


Fixed submission:
N = int(input())

x = 0
while x < N:
    x = x + 1000

output = x - N
print(output)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

list = []
for i in range(N):
    list.append(str(input()))
    a = list.count("AC")
    b = list.count("WA")
    c = list.count("TLE")
    d = list.count("RE")

print("AC x",a)
print("WA x" , b)
print("TLE x" , c)
print("RE x" ,d)

Fixed submission:
N = int(input())

list = []
for i in range(N):
    list.append(str(input()))
a = list.count("AC")
b = list.count("WA")
c = list.count("TLE")
d = list.count("RE")

print("AC x",a)
print("WA x" ,b)
print("TLE x" ,c)
print("RE x" ,d)

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

i = 1
AC = 0
WA = 0
TLE = 0
RE = 0
list = []
for i in range(N):
    list.append(str(input()))
    a = list.count("AC")
    b = list.count("WA")
    c = list.count("TLE")
    d = list.count("RE")

print("AC x",a)
print("WA x" , b)
print("TLE x" , c)
print("RE x" ,d)

Fixed submission:
N = int(input())

list = []
for i in range(N):
    list.append(str(input()))
a = list.count("AC")
b = list.count("WA")
c = list.count("TLE")
d = list.count("RE")

print("AC x",a)
print("WA x" ,b)
print("TLE x" ,c)
print("RE x" ,d)

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

i = 1
AC = 0
WA = 0
TLE = 0
RE = 0
list = []
for i in range(N):
    list.append(str(input()))
    a = list.count("AC")
    b = list.count("WA")
    c = list.count("TLE")
    d = list.count("RE")

print("AC x",str(a))
print("WA x" , str(b))
print("TLE x" , str(c))
print("RE x" ,str(d))


Fixed submission:
N = int(input())

list = []
for i in range(N):
    list.append(str(input()))
a = list.count("AC")
b = list.count("WA")
c = list.count("TLE")
d = list.count("RE")

print("AC x",a)
print("WA x" ,b)
print("TLE x" ,c)
print("RE x" ,d)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
f = 0
count = 0
for j in range(1,N+1):
    for i in range(1,N+1):
        if i%j == 0:
            count +=i
    f = f + (j * count)
print(count)

Fixed submission:
N = int(input())
count = 0
for i in range(1,N+1):
    t = N//i
    count += i * t*(t+1)/2
print(int(count))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
f = 0
count = 0
for j in range(1,N+1):
    count = 0
    for i in range(1,int(j/2)+100000):
        if j%i == 0:
            count +=1
    f = f + (j * count)
print(f)

Fixed submission:
N = int(input())
count = 0
for i in range(1,N+1):
    t = N//i
    count += i * t*(t+1)/2
print(int(count))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
f = 0
count = 0
for j in range(1,N+1):
    count = 0
    for i in range(1,int(j**0.5)+100):
        if j%i == 0:
            count +=1
    f = f + (j * count)
print(f)

Fixed submission:
N = int(input())
count = 0
for i in range(1,N+1):
    t = N//i
    count += i * t*(t+1)/2
print(int(count))

Buggy python submission (verdict: Runtime Error):
import sympy
f = 0
N = int(input())
for i in range(N+1):
    x = list(sympy.divisors(i))
    f = f + (i * len(x))
print(f)

Fixed submission:
N = int(input())
count = 0
for i in range(1,N+1):
    t = N//i
    count += i * t*(t+1)/2
print(int(count))
Buggy python submission (verdict: Runtime Error):
#(B)Battle
A,B,C,D=map(int,input().split())
while True:
    C -= B
    if C<=0:
        print('Yes')
        break
    A -= D
    if A<=0:
        print('No')
        break

Fixed submission:
S,W = map(int,input().split())
if S<=W:
    print('unsafe')
elif S>W:
    print('safe')

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

if S<W:
    print('unsafe')
elif S>W :
    print('safe')

Fixed submission:
S,W = map(int,input().split())
if S<=W:
    print('unsafe')
elif S>W:
    print('safe')
Buggy python submission (verdict: Runtime Error):
while True:
    C -= B
    A -= D
    if A<=0:
        print('No')
        break
    elif C<=0:
        print('Yes')
        break

Fixed submission:

A,B,C,D=map(int,input().split())
while True:
    C -= B
    if C<=0:
        print('Yes')
        break
    A -= D
    if A<=0:
        print('No')
        break
Buggy python submission (verdict: Runtime Error):
#include <iostream>
using namespace std;
#define M 1000000007
int main()
{
	long long a[200000], i,n, j, s=0, su=0;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
		s=(s+a[i])%M;
	}
	for (i = 0; i < n; i++)
	{
		s -= a[i];
		s+=M;
		s%=M;
		su += (a[i] * s)%M;
		su %= M;
	}
	cout << su;
}

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
s=sum(l)
su=0
for i in range(n):
	s=s-l[i]
	s=s%1000000007
	su=su+(l[i]*s)
	su=su%1000000007
print(su)

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

MOD = 1000000007
SUM = 0
for i in range(N-1):
  for j in range(i+1, N):
    SUM += A[i]*A[j] % MOD
    SUM %= MOD
print(SUM)
    

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

MOD = 1000000007
SUM = 0
for i in range(N):
  SUM += A[i]
SUM = SUM*SUM
for i in range(N):
  SUM -= A[i]*A[i]
SUM = SUM // 2
SUM %= MOD
print(SUM)
Buggy python submission (verdict: Runtime Error):
S = input()

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

Fixed submission:
S = input()

if S[2]==S[3] and S[4] == S[5]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
day = input()
count = day.count("R")
if count == 2:
    if count1 = day.count("RR"):
	    print(2)
	else:
    	print(1)
if count == 1:
    print(1)
if count == 0:
    print(0)

Fixed submission:
s = input()

if "RRR" in s:
    print("3")
elif "RR" in s:
    print("2")
elif "R" in s:
    print("1")
else:
    print("0")
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
def replace(n,k):
    n = min(n,abs(n - k))
    if n <= abs(n - k):
        return n,k
    else:
        return replace(n, k)
if k == 1:
    print(0)
else:
    n1, k1 = replace(n,k)
    print(n1)

Fixed submission:
n, k = map(int,input().split())
nk = n % k
print(min(nk,abs(nk - k)))
Buggy python submission (verdict: Runtime Error):
count = 0
tmp = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        tmp += 1
    else:    
        tmp = 0
    count = max(tmp,count)
print(count)

Fixed submission:
s = input()
count = 0
tmp = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        tmp += 1
    else:    
        tmp = 0
    count = max(tmp,count)
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

for i in range(1,len(A)+1):
    print(A.count(i))
for i in range(len(A)+1,N+1):
    print(0)

Fixed submission:
import collections

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

c = collections.Counter(A)

for i in range(1,N+1):
    print(c[i])

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

for i in range(1,N+1):
    print(A.count(i))

Fixed submission:
import collections

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

c = collections.Counter(A)

for i in range(1,N+1):
    print(c[i])
Buggy python submission (verdict: Runtime Error):
input= []

try:
    while True:
        s = input()
        if s == '':
            break
        input.append(s)

except EOFError:
    pass

for s in input:

 list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

 print(list[int(s)-1])

Fixed submission:
i = int(input())
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list[i-1])

Buggy python submission (verdict: Runtime Error):
i = []

try:
    while True:
        s = input()
        if s == '':
            break
        i.append(s)

except EOFError:
    pass

for s in i:

 list= [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 print(list[s-1])

Fixed submission:
i = int(input())
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list[i-1])
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
readline = sys.stdin.buffer.readline
N,A,B = map(int, readline().split())
R=A*(N//(A+B))+min(A,N%(A+B))
print(R)

Fixed submission:
S=input()
if S=="AAA" or S=="BBB":
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
import sys
n,m = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(m)]
 
b=[]
for i in range(0,m):
    
    if A[i][0]==1 and A[i][1]==0:
        print(-1)
        sys.exit()
    else:
        b.append(A[i][1]*pow(10,m-A[i][0]))

if n>1:
    b.remove(0)
    
b=list(set(b))
 
c=[]
for i in range(len(b)):
    c.append(len(str(b[i])))
    
c=list(set(c))


 
if len(b)==len(c) and len(str(sum(b)))==n:
    print(sum(b))
else:
    print(-1)

Fixed submission:
import sys
n,m = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(m)]
 
b=[pow(10,n-1)]
count=0
for i in range(0,m):
    
    if A[i][0]==1 and A[i][1]==0 and n>1:
        print(-1)
        sys.exit()
    else:
        b.append(A[i][1]*pow(10,n-A[i][0]))
        if n-A[i][0]==n-1:
            count+=1

#print(b,count)          
if count>0 or n==1:
    b.remove(pow(10,n-1))

if n>1:
    #print([i for i in b if i != 0])
    b=[i for i in b if i != 0]


#print(b)

b=list(set(b))
 
c=[]
for i in range(len(b)):
    c.append(len(str(b[i])))
    
c=list(set(c))

#print(b,c)
 
if len(b)==len(c) and len(str(sum(b)))==n:
    print(sum(b))
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
if N==1:
	print("Hello world")
else:
	print(A+B)
  

Fixed submission:

n = int(input())
if n==1:
	print("Hello World")
else:
	a = int(input())
	b = int(input())
	print(a+b)
Buggy python submission (verdict: Runtime Error):
s=list(input())
s.sort()
d=int(s[0])*100+int(s[1])*10+int(s[2])
d=d-557
if d==0:
    print("Yes")
else:
    print("No")

Fixed submission:
s=list(input().split())
s.sort()
d=int(s[0])*100+int(s[1])*10+int(s[2])
d=d-557
if d==0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
ans=0
nn = int((n-1)//2)+1
for i in range(2,nn):
    for j in range(2,nn):
        if i*j>n-1:
            break
        else:
            ans += 1

ans += (n-1-1)*2
print(ans+1)

Fixed submission:
n= int(input())
ans=0
nn = int((n-1)//2)+1
for i in range(2,nn):
    for j in range(i,nn):
        if i*j>n-1:
            break
        else:
            if i==j:
                ans += 1
            else:
                ans+=2
# a or b =1
ans += (n-1-1)*2
print(ans+1)
Buggy python submission (verdict: Time Limit Exceeded):
n,k =map(int,input().split())
s =[]
for i in range(k):
    l,r=map(int,input().split())
    s+=(list(range(l,r+1)))
S= set(s)

mod = 998244353

step = [0] * (n+1)

step[0]=1
for i in range(n):
    for s in S:
        if i+s<=n:
            step[i+s]=(step[i]+step[i+s])%mod
        else:
            break
            # print(step)
# print(step)
print(step[n-1]%mod)

Fixed submission:
mod = 998244353
n,k =map(int,input().split())
step =[0]*(n+1)
# step[0]=1
step[1]=1
stepsum=[0]*(n+1)
stepsum[1]=1
l=[0]*k
r=[0]*k
for i in range(k):
    l[i],r[i]=map(int,input().split())

for i in range(2,n+1):
    for j in range(k):
        li = i - r[j]
        ri = i - l[j]
        if ri <= 0:
            continue
        # li = max(1,li)
        step[i] += stepsum[ri] - stepsum[max(0,li-1)]
        # step[i] %= mod
        # print(step)
    stepsum[i] = ( stepsum[i-1] + step[i] )%mod


print(step[n]%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n,k =map(int,input().split())
s =[]
for i in range(k):
    l,r=map(int,input().split())
    s+=(list(range(l,r+1)))
S= set(s)

mod = 998244353
step = [0] * (n+1)

step[0]=1
for i in range(0,n+1):
    for s in S:
        if i+s<=n:
            step[i+s]=(step[i]+step[i+s])%mod

print(step[n-1]%mod)

   

Fixed submission:
mod = 998244353
n,k =map(int,input().split())
step =[0]*(n+1)
# step[0]=1
step[1]=1
stepsum=[0]*(n+1)
stepsum[1]=1
l=[0]*k
r=[0]*k
for i in range(k):
    l[i],r[i]=map(int,input().split())

for i in range(2,n+1):
    for j in range(k):
        li = i - r[j]
        ri = i - l[j]
        if ri <= 0:
            continue
        # li = max(1,li)
        step[i] += stepsum[ri] - stepsum[max(0,li-1)]
        # step[i] %= mod
        # print(step)
    stepsum[i] = ( stepsum[i-1] + step[i] )%mod


print(step[n]%mod)
Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(1000000)

class UnionFind:
    def __init__(self, n):
        self.par = list(range(n)) #親
        self.rank = [0] * n #根の深さ

    # xの属する根を求める
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            # if they have the same parent, no need to union
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # xとyが同じ集合に属するかを判定（同じ根に属するか）
    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.rank[self.find(x)]

N, M = map(int, input().split())
uf = UnionFind(N)

for _ in range(M):
    a, b = map(int, input().split())
    uf.unite(a-1, b-1)

cnt = [0] *n
for i in range(N):
    cnt[uf.par[i]] += 1
print(max(cnt))

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

print('Yes' if d/s <= t else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
mod = 10**9+7

ans = 0
for i in range(n-1):
    aa = a.pop()
    # print(a,aa)
    ans +=  (aa * sum(a)) % mod
    ans %= mod

print(ans%mod)

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

ans = 0
aa = 0
for i in range(n-1):
    aa += a.pop()
    # print(a,aa)
    ans +=  (aa * a[-1]) % mod
    ans %= mod

print(ans%mod)
Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
aindex=n+1
bindex=m+1
acumsum = [0]
bcumsum = [0]

ab =0
for aa in range(n):
  ab += a[aa]
  acumsum.append(ab)# = ab
  if ab>k:
    aindex= aa
    break

ab =0
for bb in range(m):
  ab += b[bb]
  bcumsum.append(ab)
  if ab>k:
    bindex= bb
    break

j= m
for i in range(n+1):
  if acumsum[i] >k:
    break
  while bcumsum[j] > k-acumsum[i]:
    j -=1
  ans = max(ans, i+j)

print(ans)


Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
aindex=n
bindex=m
acumsum = [0]
bcumsum = [0]

ab =0
for aa in range(n):
  ab += a[aa]
  acumsum.append(ab)# = ab
  if ab>k:
    aindex= aa
    break

ab =0
for bb in range(m):
  ab += b[bb]
  bcumsum.append(ab)
  if ab>k:
    bindex= bb
    break

j= bindex
for i in range(aindex+1):
  if acumsum[i] >k:
    break
  while bcumsum[j] > k-acumsum[i]:
    j -=1
  ans = max(ans, i+j)

print(ans)

Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
aindex=n+1
bindex=m+1
acumsum = [0]
bcumsum = [0]

ab =0
for aa in range(n):
  ab += a[aa]
  acumsum.append(ab)# = ab
  if ab>k:
    aindex= aa
    break

ab =0
for bb in range(m):
  ab += b[bb]
  bcumsum.append(ab)
  if ab>k:
    bindex= bb
    break


from bisect import bisect_left
for i in range(aindex+1):
  j = bisect_left(bcumsum, k-acumsum[i])-1
  ans = max(ans, i+j)
print(ans)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
aindex=n
bindex=m
acumsum = [0]
bcumsum = [0]

ab =0
for aa in range(n):
  ab += a[aa]
  acumsum.append(ab)# = ab
  if ab>k:
    aindex= aa
    break

ab =0
for bb in range(m):
  ab += b[bb]
  bcumsum.append(ab)
  if ab>k:
    bindex= bb
    break

j= bindex
for i in range(aindex+1):
  if acumsum[i] >k:
    break
  while bcumsum[j] > k-acumsum[i]:
    j -=1
  ans = max(ans, i+j)

print(ans)
Buggy python submission (verdict: Runtime Error):
import bisect

x ,n=map(int,input().split())
p=list(map(int,input().split()))

p.sort()
p= p+[p[n-1]+2]
index = bisect.bisect_left(p,x)

if n==0:
    print(x)
else:
    for i in range(n):
        # print(index-i, index+i)
        if p[max(index-i,0)] != x-i:
            print(x-i)
            break
        elif p[min(index+i,n)] != x+i:
            print(x+i)
            break
    else:
        print(p[0]-1)


Fixed submission:
import bisect

x ,n=map(int,input().split())
p=list(map(int,input().split()))

p.sort()

index = bisect.bisect_left(p,x)

if n==0:
    print(x)
else:
    p= p+[p[n-1]+2]
    for i in range(n):
        # print(index-i, index+i)
        if p[max(index-i,0)] != x-i:
            print(x-i)
            break
        elif p[min(index+i,n)] != x+i:
            print(x+i)
            break
    else:
        print(p[0]-1)

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

x ,n=map(int,input().split())
p=list(map(int,input().split()))

p.sort()

index = bisect.bisect_left(p,x)

if n==0:
    print(x)
else:
    for i in range(n):
        # print(index-i, index+i)
        if p[index-i] != x-i:
            print(x-i)
            break
        elif p[index+i] != x+i:
            print(x+i)
            break

Fixed submission:
import bisect

x ,n=map(int,input().split())
p=list(map(int,input().split()))

p.sort()

index = bisect.bisect_left(p,x)

if n==0:
    print(x)
else:
    p= p+[p[n-1]+2]
    for i in range(n):
        # print(index-i, index+i)
        if p[max(index-i,0)] != x-i:
            print(x-i)
            break
        elif p[min(index+i,n)] != x+i:
            print(x+i)
            break
    else:
        print(p[0]-1)

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

x ,n=map(int,input().split())
p=list(map(int,input().split()))

p.sort()

index = bisect.bisect_left(p,x)

if n==0:
    print(x)
else:
    for i in range(n):
        print(index-i, index+i)
        if p[index-i] != x-i:
            print(x-i)
            break
        elif p[index+i] != x+i:
            print(x+i)
            break

Fixed submission:
import bisect

x ,n=map(int,input().split())
p=list(map(int,input().split()))

p.sort()

index = bisect.bisect_left(p,x)

if n==0:
    print(x)
else:
    p= p+[p[n-1]+2]
    for i in range(n):
        # print(index-i, index+i)
        if p[max(index-i,0)] != x-i:
            print(x-i)
            break
        elif p[min(index+i,n)] != x+i:
            print(x+i)
            break
    else:
        print(p[0]-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

a.sort()

def zansa(a0, alist):
    ans=[]
    for i in range(len(alist)):
        if alist[i] % a0 != 0:
            ans.append(alist[i])
    return ans

an = []
if a[0]==a[n-1] or n==0:
    pass
else:
    for j in range(n-1):
        # print(a[0])
        an.append(a[0])
        if len(a) >1:
            a = zansa(a[0],a[1:])
        else:
            break

print(len(an))



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

maxA = max(A)
ans = 0
flag = [0]*(maxA+1)

# print(flag)
for a in A:
    for ax in range(a,maxA+1,a):
        flag[ax] +=1

# print(flag)
for a in set(A):
    if flag[a] == 1:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
b=[]
for i in range(n):
    tmpa,tmpb = map(int,input().split())
    a.append(tmpa)
    b.append(tmpb)

a.sort()
b.sort()

if n%2==1:
    print(b[n//2] - a[n//2] +1)
else:
    print((b[n//2+2]-b[n//2+1]) - (a[n//2+2]-a[n//2+1]) +1)


Fixed submission:

n=int(input())
a=[]
b=[]
for i in range(n):
    tmpa,tmpb = map(int,input().split())
    a.append(tmpa)
    b.append(tmpb)

a.sort()
b.sort()

if n%2==1:
    print(b[n//2] - a[n//2] +1)
else:
    print((b[n//2]+b[n//2-1]) - (a[n//2]+a[n//2-1]) +1)
Buggy python submission (verdict: Runtime Error):

n,m,x = map(int,input().split())

A=[0]*n
c=[0]*n

for i in range(n):
    A[i] = list(map(int,input().split()))

for i in range(n):
    c[i]= A[i][0]
    A[i] = A[i][1:]

import numpy as np
import sys

a = np.array(A)

ans = 10**5+1

for s in range(1<<n):
    cost = 0
    d = np.array([0]*m)
    for i in range(n):
        if s>>i&1:
            cost += c[i]
            d += a[i]
    if all(d >= x):
        ans = min(ans,cost)

print(ans if ans != 10**5+1 else '-1')

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

A=[0]*n
c=[0]*n

for i in range(n):
    A[i] = list(map(int,input().split()))

for i in range(n):
    c[i]= A[i][0]
    A[i] = A[i][1:]

import numpy as np
import sys

a = np.array(A)

ans = np.inf

for s in range(1<<n):
    cost = 0
    d = np.array([0]*m)
    for i in range(n):
        if s>>i&1:
            cost += c[i]
            d += a[i]
    if all(d >= x):
        ans = min(ans,cost)

print(ans if ans != np.inf else '-1')

Buggy python submission (verdict: Runtime Error):

n,m,x = map(int,input().split())

A=[0]*n
c=[0]*n

for i in range(n):
    A[i] = list(map(int,input().split()))

for i in range(n):
    c[i]= A[i][0]
    A[i] = A[i][1:]

import numpy as np
import sys

a = np.array(A)

ans = 10**5+1

for s in range(1<<n):
    cost = 0
    d = np.array([0]*m)
    for i in range(n):
        if s>>i&1:
            cost += c[i]
            d += a[i]
    if all(d >= x):
        ans = min(ans,cost)

print(ans if ans != 10**5+1 else '-1')

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

A=[0]*n
c=[0]*n

for i in range(n):
    A[i] = list(map(int,input().split()))

for i in range(n):
    c[i]= A[i][0]
    A[i] = A[i][1:]

import numpy as np
import sys

a = np.array(A)

ans = np.inf

for s in range(1<<n):
    cost = 0
    d = np.array([0]*m)
    for i in range(n):
        if s>>i&1:
            cost += c[i]
            d += a[i]
    if all(d >= x):
        ans = min(ans,cost)

print(ans if ans != np.inf else '-1')
Buggy python submission (verdict: Runtime Error):
k=100
for i in range(10000):
    if k >= x:
        print(i)
        break
    k= k*1.01 // 1

Fixed submission:
x=int(input())

k=100
for i in range(10000):
    if k >= x:
        print(i)
        break
    k= k*1.01 // 1
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())

ans =0

for x in range(1,n+1):
    ans = max( ans , (a * x) // b - a* (x // b))

print(ans)

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

ans =0

# for x in range(1,n+1):
x = min(b-1,n)
ans = max( ans , (a * x) // b - a* (x // b))
print(ans)