A. Minimize!

time limit per test

1 second

memory limit per test

256 megabytes

You are given two integers aa and bb (a≤ba≤b). Over all possible integer values of cc (a≤c≤ba≤c≤b), find the minimum value of (c−a)+(b−c)(c−a)+(b−c).

Input

The first line contains tt (1≤t≤551≤t≤55) --- the number of test cases.

Each test case contains two integers aa and bb (1≤a≤b≤101≤a≤b≤10).

Output

For each test case, output the minimum possible value of (c−a)+(b−c)(c−a)+(b−c) on a new line.

Example

Input

Copy

复制代码

3

1 2

3 10

5 5

Output

Copy

复制代码
1
7
0

Note

In the first test case, you can choose c=1c=1 and obtain an answer of (1−1)+(2−1)=1(1−1)+(2−1)=1. It can be shown this is the minimum value possible.

In the second test case, you can choose c=6c=6 and obtain an answer of (6−3)+(10−6)=7(6−3)+(10−6)=7. It can be shown this is the minimum value possible.

解题说明::水题,结果就是b-a

cpp 复制代码
#include <stdio.h>

int main() 
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		printf("%d\n", b - a);
	}
	return 0;
}
相关推荐
明月*清风4 分钟前
c++ —— 内存管理
开发语言·c++
WindSearcher24 分钟前
大模型微调相关知识
后端·算法
取酒鱼食--【余九】35 分钟前
rl_sar实现sim2real的整体思路
人工智能·笔记·算法·rl_sar
西北大程序猿1 小时前
单例模式与锁(死锁)
linux·开发语言·c++·单例模式
彩妙不是菜喵1 小时前
算术操作符与类型转换:从基础到精通
c语言
qq_454175791 小时前
c++学习-this指针
开发语言·c++·学习
Magnum Lehar2 小时前
vulkan游戏引擎test_manager实现
java·算法·游戏引擎
水蓝烟雨2 小时前
[面试精选] 0094. 二叉树的中序遍历
算法·面试精选
超闻逸事3 小时前
【题解】[UTPC2024] C.Card Deck
c++·算法
暴力求解3 小时前
C++类和对象(上)
开发语言·c++·算法