akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		for(; sc.hasNext();){
			double xa=sc.nextDouble();
			double ya=sc.nextDouble();
			double xb=sc.nextDouble();
			double yb=sc.nextDouble();
			double xc=sc.nextDouble();
			double yc=sc.nextDouble();
			double xd=sc.nextDouble();
			double yd=sc.nextDouble();
			double vx1=xb-xa;
			double vy1=yb-ya;
			double vx2=xc-xd;
			double vy2=yc-yd;
			println(abs(vx1*vx2+vy1*vy2)<EPS?"YES":"NO");
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;

const int N = 2005;
const int inf = 2e9;

struct seg {
	int l, r;
};

int n, k, q;
int a[N];
vector<seg> segs;

int calc(int x) {
	int l = 0, r = 0;
	segs.clear();
	for (int i = 1; i <= n; ++i) if (a[i] >= x) {
		if (i == 1 || a[i - 1] < x) l = i, r = 0;
		if (i == n || a[i + 1] < x) r = i;
		if (r) segs.push_back({l, r});
	}
	priority_queue<int, vector<int>, greater<int>> pq;
	for (auto s : segs) {
		int cnt = max(s.r - s.l + 2 - k, 0);
		priority_queue<int, vector<int>, greater<int>> pq2;
		for (int i = s.l; i <= s.r; ++i) pq2.push(a[i]);
		while (cnt--) {
			pq.push(pq2.top());
			pq2.pop();
		}
	}
	if (pq.size() < q) return inf;
	for (int i = 1; i < q; ++i) pq.pop();
	return pq.top() - x;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> k >> q;
	for (int i = 1; i <= n; ++i) cin >> a[i];
	int res = inf;
	for (int i = 1; i <= n; ++i) res = min(res, calc(a[i]));
	cout << res << '\n';
}

Measured memory_bytes: 256
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    H, W, A, B = map(int, input().split())

    res = []
    for _ in range(B):
        row = [0 for _ in range(W)]
        for i in range(A, W):
            row[i] = 1
        res.append(row)

    for _ in range(H - B):
        row = [0 for _ in range(W)]
        for i in range(A):
            row[i] = 1
        res.append(row)

    for re in res:
        re = [str(r) for r in re]
        print(''.join(re))


if __name__ == '__main__':
    main()


Measured memory_bytes: 52696
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

//for A以上B未満でI探索 for (int I = A; i <= B; i++)
//string s = to_string(i);
int a = 0, b = 0, c = 0, x = 0, y = 0, z = 0, n = 0, sum = 0, i = 0;
string s = ""; asas; cncn;

int main(void) {
	cin >> a >> b >> c;
	x=max(max(a, b), c);
	sum = a + b + c;
	Yes(sum - x == x);
	please AC;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ll long long
using namespace std;

int main() {
  ll int n, k;
  cin >> n >> k;
  ll int ans = 0;
  
  for(ll int i = k; i <= n+1; ++i) {
    ll int start = i*(i+1)/2;
    ll int end = i*(n+n-i+3)/2;
    ans += end-start+1;
//    cout << start << " " << end << endl;
    ans %= 1000000007;
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
from math import gcd
from functools import reduce
def osa_k(n=10**6):
  p=list(range(n+1))
  for i in range(2,int(n**.5)):
    if p[i]<i:continue
    for j in range(i*i,n+1,i):
      if p[j]==j:p[j]=i
  return p
def fact_o(n):
  a=[]
  f=0
  while n>1:
    if f!=p[n]:ans[p[n]]+=1
    f=p[n]
    n//=p[n]
  return 0
p=osa_k()
n=int(input())
a=list(map(int,input().split()))
ans=[0]*(10**6+1)
for i in a:
  fact_o(i)
if max(ans)<=1:print('pairwise coprime')
elif reduce(gcd,a)==1:print('setwise coprime')
else:print('not coprime')

Measured memory_bytes: 194960
/*
    アリナ・グレイはかわいい
*/

#include<bits/stdc++.h>
using namespace std;
#define itn int
#define endl "\n"

int main(void){
    long double l;
    cin >> l;
    long double b = l/3;
    long double sum = b*b*b;
    
    for(long double i = 1;i <= l;i++){
        for(long double j = 1;j <= l;j++){
            long double a = l - i - j;
            if(i+j+a != l)continue;
            long double sum2 = (long double)i*j*a;
            if(sum2 > sum)sum = sum2;
        }
    }
    cout << setprecision(20) << sum << endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;


public class Main {
     class UFT_Node {
int name;
UFT_Node next;
int rank;

public UFT_Node(int new_name){
	this.name = new_name;
	this.rank =0;
	this.next = this;
	}

public UFT_Node getRep(){
	UFT_Node output;
	if (this.next.name == this.name)
		return this;
	else output = this.next.getRep();
	this.next = output; 
	return output;
}

}
	UFT_Node[] nodes;
	public static void main(String[] args){
		ArrayList<Integer> output = new ArrayList<Integer>();
		Main test = new Main();
		Scanner inputScanner = new Scanner(System.in).useDelimiter("\\s");
		int n = inputScanner.nextInt();
		int q = inputScanner.nextInt();
		test.nodes = test.makeArray(n);
		
		int type = -1;
		int x= -1;
		int y= -1;
		for (int i=0;i<q;i++){
			type = inputScanner.nextInt();
			x = inputScanner.nextInt();
			y = inputScanner.nextInt();
			if(type ==0){
				test.union(x,y);
			}
			if(type ==1){
				if(test.same(x, y))
					output.add(1);
				else
					output.add(0);
			}
		} 
		for(Integer out : output){
			System.out.println(out.toString());
		}
	}
	public UFT_Node[] makeArray(int num){
		UFT_Node[] output = new UFT_Node[num];
		for (int i=0; i<num;i++){
			output[i] = new UFT_Node(i);
		}
	return output;
	}
	
	public void union(int x, int y){
		UFT_Node yRep = nodes[y].getRep();
		UFT_Node xRep = nodes[x].getRep();
		if (yRep.rank> xRep.rank){
			xRep.next= yRep;
		}
		else if(yRep.rank< xRep.rank){
			yRep.next= xRep;
		}
		else{
			yRep.next= xRep;
			xRep.rank++;
		}
	}
	
	public boolean same (int x, int y){
		return nodes[x].getRep().name==nodes[y].getRep().name;
	}
}




Measured memory_bytes: 104996
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;


int main(void) {
    Int r;
    cin >> r;
    cout << fixed << setprecision(10) << 2 * r * M_PI << endl;
    return 0;
}


Measured memory_bytes: 3752
import java.util.*;
	public class Main{
		public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            long n = Integer.parseInt(sc.next());
            long k = Integer.parseInt(sc.next());
            long ret = 0;
            
            for(int i=(int)k+1; i<=n; i++){

            	ret += (n/i) * (i-k) + Math.max(0, n%i - Math.max(k, 1) + 1);
            	
            }
            
            System.out.println(ret);
            sc.close();
		}
    }
	

Measured memory_bytes: 22100
#include <bits/stdc++.h>
#define LL long long
using namespace std;
LL n,k,Ans;

int main() {
	cin>>n>>k;
	LL x=n/k;
	Ans+=x*x*x;
	if(k%2==0) {
		if(n%k>=k/2) x++;
		Ans+=x*x*x;
	}
	printf("%lld\n",Ans);
	return 0;
}

Measured memory_bytes: 384
//プリム法とかいうのを使うらしい
//結構当たり前だから諦めずに頑張れよ、こういうところだぞ

#include<iostream>
#include<queue>
#include<utility>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
typedef long long ll;

class Side{
public:
  ll to_Node;
  ll cost;
  Side(ll t,ll c){
    to_Node=t;cost=c;
  }
};

//pr_queueは優先順位高い(<で右に来るやつ)のが先に取り出される
bool operator< (const Side& a,const Side& b){
    return a.cost > b.cost;
};

ll distance(vector<ll>& a,vector<ll>& b){
  return min({abs(a[0]-b[0]),abs(a[1]-b[1])});
}

int main(){
  ll n;cin >> n;
  vector< vector<ll> > v1(n,vector<ll>(3,0));
  vector< vector<ll> > v2(n,vector<ll>(3,0));
  //自作クラスのpr_queueどうする
  for(ll i=0;i<n;i++){
    ll x,y;cin >> x >> y;
    v1[i][0]=x;v1[i][1]=y;v1[i][2]=i;
    v2[i][0]=x;v2[i][1]=y;v2[i][2]=i;
  }
  sort(v1.begin(),v1.end(),[](vector<ll>& a,vector<ll>& b){return a[0] < b[0];});
  sort(v2.begin(),v2.end(),[](vector<ll>& a,vector<ll>& b){return a[1] < b[1];});

  //ここでそれぞれのNodeから伸びる辺をqueueに入れておく
  vector< queue<Side> > sides_before(n);
  for(ll i=0;i<n-1;i++){
    sides_before[v1[i][2]].push(Side(v1[i+1][2],distance(v1[i],v1[i+1])));
    sides_before[v1[i+1][2]].push(Side(v1[i][2],distance(v1[i],v1[i+1])));
    sides_before[v2[i][2]].push(Side(v2[i+1][2],distance(v2[i],v2[i+1])));
    sides_before[v2[i+1][2]].push(Side(v2[i][2],distance(v2[i],v2[i+1])));
  }

  //0から始まるので0を初期化
  vector<bool> check(n,false);check[0]=true;
  priority_queue<Side> sides;
  ll l=sides_before[0].size();
  for(ll i=0;i<l;i++){
    sides.push(sides_before[0].front());
    sides_before[0].pop();
  }

  ll cost_sum=0;
  Side now=sides.top();
  while(sides.size()!=0){
    //nowが訪問済みなのは
    if(!check[now.to_Node]){
      check[now.to_Node]=true;
      cost_sum+=now.cost;
      int k=now.to_Node;
      ll l=sides_before[k].size();
      sides.pop();
      for(ll i=0;i<l;i++){
        Side s=sides_before[k].front();
        if(!check[s.to_Node]) sides.push(s);
        sides_before[k].pop();
      }
      now=sides.top();
    }else{
      sides.pop();now=sides.top();
    }
  }
  cout << cost_sum << endl;
}


Measured memory_bytes: 80500
k,n = map(int,input().split())
list_A =list(map(int,input().split()))
mx = 0
for i in range(n-1):
  a = list_A[i+1]-list_A[i]
  mx = max(mx,a)
 #最後のパターン
b = (list_A[0]-0)+(k-list_A[-1])
mx = max(mx,b)
print(k-mx)

Measured memory_bytes: 25840
#include <iostream>
using namespace std;

int main (void){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int c = 1;
  for(int i = 0; i < n-1; i++){
    if(s[i]!= s[i+1]){
      c++;
    }
  }
  cout << c;
}


Measured memory_bytes: 512
import sys
str = ""
for line in sys.stdin:
	str = line

numbers = str.split()

answer = 0
stackList = []

for number in numbers :

    if number == '+' :
        answer = int(stackList.pop()) + int(stackList.pop())
        stackList.append(answer)
    elif number == '-' :
        x = int(stackList.pop())
        y = int(stackList.pop())
        answer = y - x
        stackList.append(answer)
    elif number == '*' :
        answer = int(stackList.pop()) * int(stackList.pop())
        stackList.append(answer)
    else :
        stackList.append(number)

print(answer)



Measured memory_bytes: 5600
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}



signed main() {
	int h1, h2, k1, k2, a, b, c, d;
	cin >> h1 >> h2 >> k1 >> k2 >> a >> b >> c >> d;
	if ((h1 * a + h2 * b + (h1 / 10) * c + (h2 / 20) * d) == (k1 * a + k2 * b + (k1 / 10) * c + (k2 / 20) * d))
		printf("even\n");
	else 
	printf((h1 * a + h2 * b + (h1 / 10) * c + (h2 / 20) * d) > (k1 * a + k2 * b + (k1 / 10) * c + (k2 / 20) * d) ? "hiroshi\n" : "kenjiro\n");

	return 0;
}

Measured memory_bytes: 3208
N = int(input())
A = [0]*N
B = [0]*N
for i in range(N):
    a, b = map(int, input().split())
    A[i], B[i] = a, b
mx, mn = 0, 0
B.sort()
A.sort()
if N%2 == 0:
    mx = (B[N//2-1]+B[N//2+1-1])/2
    mn = (A[N//2-1]+A[N//2+1-1])/2
else:
    mx = B[(N+1)//2-1]
    mn = A[(N+1)//2-1]
#print(B, A)
#print(mx, mn)
if N%2 == 0:
    print(int(2*(mx-mn)+1))
else:
    print(mx-mn+1)


Measured memory_bytes: 25368
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

inline bool ispr(int n){
	for(int i=2;i*i<=n;i++) if(n%i==0) return false;
	return true;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a,b; cin>>a>>b;
	int n=gcd(a,b);
	int ans=0;
	for(int i=1;i*i<=n;i++){
		if(n%i==0){
			if(ispr(i)) ans++;
			if(n/i!=i && ispr(n/i)) ans++;
		}
	}
	cout<<ans<<"\n";
	return 0;
}





























Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int x[100], y[100];
int mini[100], rr[100];
int main()
{
	int num, way;
	scanf("%d%d", &num, &way);
	for (int i = 0; i < num; i++)scanf("%d%d", &x[i], &y[i]);
	fill(mini, mini + num, 1000000000);
	for (int i = 0; i < way; i++)
	{
		int s, t;
		scanf("%d%d", &s, &t);
		for (int j = 0; j < num; j++)
		{
			int r = abs(x[j] - s) + abs(y[j] - t);
			if (mini[j] > r)mini[j] = r, rr[j] = i + 1;
		}
	}
	for (int i = 0; i < num; i++)printf("%d\n", rr[i]);
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<set>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
#define Rep(i,s,t) for(register int i=s;i<t;++i)
#define go(x) for(register int e=las[x];e;e=nxt[e])
#define re register
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define gi(x) read(x)
#define gii(x,y) read(x),read(y)
#define giii(x,y,z) read(x),read(y),read(z)
#define ms(f,x) memset(f,x,sizeof f)
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
namespace IO{
    #define gc getchar()
    #define pc(x) putchar(x)
    template<typename T>inline void read(T &x){
        x=0;int f=1;char ch=gc;while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=gc;}
        while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=gc;x*=f;return;
    }
    template<typename T>inline void write(T x=0){
        T wr[51];wr[0]=0;if(x<0)pc('-'),x=-x;if(!x)pc(48);
        while(x)wr[++wr[0]]=x%10,x/=10;while(wr[0])pc(48+wr[wr[0]--]);
		putchar('\n');
		return;
    }
}
using IO::read;
using IO::write;
using namespace std;
#define gi(x) read(x)
typedef long long ll;
const int N=1e5+11;
int n,m;
int a[N],b[N],top;
int main(){
    gii(n,m);
    int odd1=-1,odd2=-1;
    rep(i,1,m){
        gi(a[i]);
        if(a[i]&1){
            if(odd1==-1)odd1=i;
            else if(odd2==-1)odd2=i;
            else{
				puts("Impossible");
                return 0;
            }
        }
    }
    if(m==1){
        if(a[1]==1)printf("1\n1\n1\n");
        else printf("%d\n2\n1 %d\n",a[1],a[1]-1);
        return 0;
    }
    if(odd1!=-1)swap(a[1],a[odd1]);
    if(odd2!=-1)swap(a[m],a[odd2]);
    rep(i,1,m)printf("%d%c",a[i]," \n"[i==m]);
    if(a[m]==1){
        printf("%d\n",m-1);
        printf("%d ",a[1]+1);
        rep(i,2,m-1)
            printf("%d ",a[i]);
        puts("");
        return 0;
    }
    b[1]=a[1]+1;
    rep(i,2,m-1)
        b[i]=a[i];
    b[m]=a[m]-1;
    printf("%d\n",m);
    rep(i,1,m)
        printf("%d%c",b[i]," \n"[i==m]);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;

int main(){
  int a, b;
  std::cin >> a >> b;
  if(a <= 0 and 0 <= b){
    std::cout << "Zero" << std::endl;
  }else if((0 < a) or (b - a)%2 == 1){
    std::cout << "Positive" << std::endl;
  }else{
    std::cout << "Negative" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define re register
#define cs const

namespace IO{
	inline char gc(){
		static cs int Rlen=1<<22|1;static char buf[Rlen],*p1,*p2;
		return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,Rlen,stdin),p1==p2)?EOF:*p1++;
	}template<typename T>T get_integer(){
		char c;bool f=false;while(!isdigit(c=gc()))f=c=='-';T x=c^48;
		while(isdigit(c=gc()))x=((x+(x<<2))<<1)+(c^48);return f?-x:x;
	}inline int gi(){return get_integer<int>();}
}using namespace IO;

using std::cerr;
using std::cout;

cs int mod=998244353,Val=(ll)(1e18)%mod;
inline int add(int a,int b){return a+b>=mod?a+b-mod:a+b;}
inline int dec(int a,int b){return a-b<0?a-b+mod:a-b;}
inline int mul(int a,int b){ll r=(ll)a*b;return r>=mod?r%mod:r;}
inline void Inc(int &a,int b){a+=b-mod;a+=a>>31&mod;} 
inline void Dec(int &a,int b){a-=b;a+=a>>31&mod;}
inline void Mul(int &a,int b){a=mul(a,b);}
inline void ex_gcd(int a,int b,int &x,int &y){
	if(!b){x=1,y=0;return ;}ex_gcd(b,a%b,y,x);y-=a/b*x;
}inline int inv(int a){int x,y;ex_gcd(mod,a,y,x);return x+(x>>31&mod);}

cs int SIZE=1<<10|7;

int S,ivS;

void FWT(int *A){
	for(int re i=1;i<S;i<<=1)
		for(int re j=0;j<S;j+=i<<1)
			for(int re k=0;k<i;++k){
				int x=A[j+k],y=A[i+j+k];
				A[j+k]=add(x,y);
				A[i+j+k]=dec(x,y);
			}
}

void IFWT(int *A){
	FWT(A);for(int re i=0;i<S;++i)Mul(A[i],ivS);
}

int sm[3][SIZE];

cs int N=1e5+7;

int n,m,mx,ans;

int el[N],nx[N],to[N],ec;
inline void adde(int u,int v){
	if(u>v)std::swap(u,v);
	nx[++ec]=el[u],el[u]=ec,to[ec]=v;
}

void clr(){
	memset(el,0,(n+1)<<2);ec=0;
}

int pw[N],sg[N],vs[SIZE];
void calc(int *sm){
	for(int re u=n;u;--u){
		for(int re e=el[u];e;e=nx[e])
			vs[sg[to[e]]]=true;
		sg[u]=0;while(vs[sg[u]])++sg[u];
		for(int re e=el[u];e;e=nx[e])
			vs[sg[to[e]]]=false;
		Inc(sm[sg[u]],pw[u]);
	}
}

void Main(){
	n=gi();
	for(int re i=pw[0]=1;i<=n;++i)
		pw[i]=mul(pw[i-1],Val);
	for(int re t=0;t<3;++t){
		m=gi();mx=std::max(mx,m);
		for(int re i=1;i<=m;++i)
			adde(gi(),gi());
		calc(sm[t]);clr();
	}for(S=1;S*S>>1<mx;S<<=1);ivS=inv(S);
	FWT(sm[0]),FWT(sm[1]);
	for(int re i=0;i<S;++i)
		Mul(sm[0][i],sm[1][i]);
	IFWT(sm[0]);
	for(int re i=0;i<S;++i)
		Inc(ans,mul(sm[0][i],sm[2][i]));
	cout<<ans<<"\n";
}

inline void file(){
#ifdef zxyoi
	freopen("C.in","r",stdin);
#endif
}signed main(){file();Main();return 0;} 

Measured memory_bytes: 5632
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

#define INF 1e9
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;


int main() {
    int k;
    string s;
    cin >> k >> s;
    if (s.size() > k) {
        rep(i, k) {
            cout << s.at(i);
        }
        cout << "..." << endl;
    }
    else cout << s << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;

#define int             long long
#define	ll				long long

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";
long long prime[1000000];

void sieve()
{
	prime[0]=0;
	prime[1]=0;
	for(int i=2;i<1000000;i++)
		prime[i]=1;

	for(int i=2;i*i<1000000;i++)
		if(prime[i]==1)
			for(int j=i*i;j<1000000;j+=i)
				prime[j]=0;
}

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i <= floor(sqrt(n)); i++)
        if (n % i == 0)
            return false;

    return true;
}

int factorial(int n)
{
    int f=1;
    for(int i = 1;i<=n ; i++)
        f = (f*i)%mod;
    return f;
}

int gcd(int a, int b)
{
	return !b ? a : gcd(b, a % b);
}

int lcm(int a, int b)
{
	return (a / gcd(a, b)) * b;
}

int fastExponentiation(int n, int x, int modulo)
{
	int res = 1;
	while(x > 0)
       {
          if(x & 1)
          res = (res*n) % modulo;
          x = x >> 1;
          n = (n * n) % modulo;
       }
       return res;
}

int power(int n , int p )
{
	if(p==0)
	   return 1;

	 int res = power((n*n)%mod,p/2);
	 if(p%2==1)
	   res = (n*res)%mod;

	   	 return res;
}

bool isPowerOfTwo(int n)
{
   	return n && (!(n&(n-1)));
}

bool isSet(int n,int i)
{
	// To check if ith bit is set or not in binary representation of n
   	return n & (1 << i);
}

bool valid_coordinate(ll x,ll y,ll n,ll m)
{
    if(x<0 || y<0)
       return false;

   	else if(x>=n || y>=m)
       return false;

   	else
   		return true;
}

int sod(int n)
{
	int sum=0;
	while(n)
	{
		sum+=(n%10);
		n/=10;
	}
	return sum;
}



void solve()
{
 string s;
 cin>>s;
 for(int i=0;i<3;i++)
 cout<<s[i];
}

int32_t main()
{

	//int t; cin>>t; while(t--)
	solve();

	return 0;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> d(n);
	map<int, int> m;
	rep(snip_i, n){
		cin >> d.at(snip_i);
		m[d.at(snip_i)]++;
	}
	sort(d.begin(), d.end());
	int ans = 0;
	if(n % 2 == 1){
		ans = 0;
	}else{
		int kl = d.at(n/2-1);
		int kr = d.at(n/2);
		ans = kr - kl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m), b(m);
  rep(i, m) {
    int na, nb;
    cin >> na >> nb;
    na--, nb--;
    a[i] = na;
    b[i] = nb;
  }
  vector<set<int>> S(n);
  rep(i, n) S[i].emplace(i);
  vector<int> idx(n);
  rep(i, n) idx[i] = i;

  ll cnt =
    (ll)n * (n - 1) / 2;    // take care not to be overflow
  vector<ll> ans;
  ans.push_back(cnt);

  reverse(all(a));
  reverse(all(b));

  rep(i, m - 1) {
    if(idx[a[i]] == idx[b[i]]) {
      ans.push_back(cnt);
      continue;
    }

    ll sza = (ll)S[idx[a[i]]].size();
    ll szb = (ll)S[idx[b[i]]].size();
    cnt -= sza * szb;
    ans.push_back(cnt);

    int addto = idx[a[i]];
    int removefrom = idx[b[i]];
    if(sza < szb) {
      swap(addto, removefrom);
    }
    for(auto x : S[idx[removefrom]]) {
      S[idx[addto]].emplace(x);
      idx[x] = idx[addto];
    }
    S[removefrom].clear();
  }

  reverse(all(ans));
  rep(i, m) printf("%lld\n", ans[i]);
  return 0;
}


Measured memory_bytes: 14196
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();

    if ( N%2 == 1 ) {
      System.out.println(N/2 + 1);
    } else {
      System.out.println(N/2);
    }
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    // cout << setprecision(8) << setiosflags(ios::fixed);

    int n;
    cin >> n;

    vector<ll> a(n);
    for (auto &a_i : a) cin >> a_i;

    ll num_neg = 0, abs_sum = 0, min_abs = abs(a[0]);
    for (int i = 0; i < n; ++i) {
        if (a[i] < 0) ++num_neg;
        if (abs(a[i]) < min_abs) min_abs = abs(a[i]);
        abs_sum += abs(a[i]);
    }

    if (num_neg % 2 == 0) cout << abs_sum << endl;
    else cout << abs_sum - 2 * min_abs << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
	int m,d;
	scanf("%d%d",&m,&d);
	int ans=0;
	for(int i=1;i<=m;i++)
		for(int j=12;j<=d;j++){
			int d1=j%10;
			int d2=j/10;
			if(d1>=2&&d2>=2&&d1*d2==i) {
			//	cout <<i << " - "<<j << endl;
				ans++;
			}
			
		}
	cout <<ans<<endl;	
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, cnt = 0, w, h;
string s;
vector<ll> v;
vector<ll> v1;
vector < pair<ll, ll > > vp;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/


int main()
{
	while (1)
	{
		cin >> n >> k;
		if (n == 0 && k == 0) break;
		if (n > k) swap(n, k);
		cout << n << ' ' << k << endl;
	}
}

Measured memory_bytes: 3112
open Printf
open Scanf

let () =
        let s = read_line() in
        let rec iter i ans =
                if i = (String.length s) then
                        printf "%s\n" ans
                else if (i mod 2 = 0) then
                        iter (i + 1) (ans ^ (String.make 1 s.[i]))
                else
                        iter (i + 1) ans
        in iter 0 ""


Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long W, H, x, y;
    cin >> W >> H >> x >> y;
    cout << fixed << setprecision(10) << (long double)W * H * 0.5 << " ";
    if (W % 2 == 0 && H % 2 == 0 && x == W / 2 && y == H / 2)
        cout << "1\n";
    else
        cout << "0\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  string s, t;
  cin >> s >> t;

  int N = s.size();
  int M = t.size();

  vector<vector<int>> dp(N+1, vector<int>(M+1, 0));
  
  REP(i, N) REP(j, M){
    if(s[i] == t[j]){
      chmax(dp[i+1][j+1], dp[i][j]+1);
    }else{
      chmax(dp[i+1][j+1], max(dp[i][j+1], dp[i+1][j]));
    }
  }

  string ans = "";
  while(N > 0 && M > 0){
    if(dp[N][M] == dp[N-1][M]) N--;
    else if(dp[N][M] == dp[N][M-1]) M--;
    else{
      N--; M--;
      ans += s[N];
    }
  }

  reverse(ALL(ans));

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 70784
fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("Error input");
    let v = input
        .trim()
        .split_whitespace()
        .map(|x| x.parse::<usize>().expect("Parse error"))
        .collect::<Vec<usize>>();
    let (n, m) = (v[0], v[1]);
    let mut matrix = vec![Vec::new(); n];
    for i in 0..n {
        input = String::new();
        std::io::stdin().read_line(&mut input).expect("Error input");
        matrix[i] = input
            .trim()
            .split_whitespace()
            .map(|x| x.parse::<u32>().expect("Parse error"))
            .collect::<Vec<u32>>();
    }
    let mut matrix2 = Vec::new();
    for _ in 0..m {
        input = String::new();
        std::io::stdin().read_line(&mut input).expect("Error input");
        matrix2.push(input.trim().parse::<u32>().expect("Parse error"));
    }
    for i in 0..n {
        let mut row_val = 0;
        for j in 0..m {
            row_val += matrix[i][j] * matrix2[j];
        }
        println!("{}", row_val);
    }
}



Measured memory_bytes: 5052
/* ex 9_2
   person_A */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SIZE 100001

//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char elem;
    struct node *next;
} node;

//スタックにデータを追加
void push(node  **first, char elem){
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->elem = elem;
    new->next = *first;
    *first = new;
}

//スタックからデータを取り出す
char pop(node **first){
    char elem;
    node *tmp = *first;
    if(tmp == NULL) exit(1);
    elem = tmp->elem;
    *first = tmp->next;
    //取り出したノードのメモリを解放
    free(tmp);
    return elem;
}


int main(void){
    //最初のノードの指す先
    node *first = NULL;
    char cubes[SIZE],top;
    int i,count=0;
    //赤色のキューブ'0'と青色のキューブ'1'を表す文字列の入力
    scanf("%s",cubes);

    //下の方からキューブをスタックに入れていく
    for(i=0;i<strlen(cubes);i++){
        //机の上にキューブがなければ、一つを置くだけ
        if(first==NULL){
            push(&first,cubes[i]);
        }
        else{
            top=pop(&first);
            //先頭と異なる色であれば、カウントする
            if(top!=cubes[i]){
                count+=2;
            }
            //先頭と同じ色であれば、二つを机の上に置き戻す
            else{
                push(&first,top);
                push(&first,cubes[i]);
            }
        }
    }
    
    //結果の出力
    printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 4884
#include<iostream>
#include<cmath>
using namespace std;

int is_prime(int n) {
	int end = (int)sqrt(n);
	for(int i = 2; i <= end; i++) {
	       if (n % i == 0) {
		       return 0;
	       }
	}
	return 1;
}

int main(void){
	int x, n;
	cin >> x;
	for(n = x;; n++) {
		if (is_prime(n)) {
			break;
		}
	}
	cout << n;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		System.out.println(solve());
	}

	public static int solve() {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		return 6 - A - B;
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define maxn 100001
#define mod 1000000007
#define pb push_back
using namespace std;
typedef long long LL;

int n;
int dp[maxn][2];
vector<int> adj[maxn];

int f( int node , int dad , bool k ) {
	if(dp[node][k] != -1)
		return dp[node][k];
	int add = 1;
	dp[node][k] = 1;
	for( int i = 0 ; i < (int) adj[node].size() ; i++ ) {
		int to = adj[node][i];
		if( to != dad ) {
			dp[node][k] = ( dp[node][k] * (LL) f(to,node,1) ) % mod;
			add = ( add * (LL) f(to,node,0) ) % mod;
		}
	}
	if(k)
		dp[node][k] = ( dp[node][k] + add ) % mod;
	return dp[node][k];
}

int main() {
	scanf("%d",&n);
	for( int i = 1 ; i < n ; i++ ) {
		int x,y;
		scanf("%d%d",&x,&y);
		adj[x].pb(y);
		adj[y].pb(x);
	}
	memset(dp, -1, sizeof(dp));
	printf("%d\n",f(1,0,1));
	return 0;
}


Measured memory_bytes: 14848
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll INF = 1e18+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

/* template */

const double PI=3.14159265358979323846;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    vector<int> a(m);
    int s = 0;
    rep(i,0,m){
        cin >> a[i];
        s += a[i];
    }
    int ans = n-s;
    if(ans<0) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3660
#include <iostream>

using namespace std;

int main(){
  int a[2][200];

  int n;
  cin >> n;
  for(int j=0; j < 2;j++){
	  for(int i=0;i < n; i++){
		cin >> a[j][i];
	  }
  }
  int ans;
  for(int i = 0; i < n; i++){
	int now = 0;

	for(int j = 0; j <= i; j++){
	  now += a[0][j];
	}

	for(int j = i; j < n; j++){
	  now += a[1][j];
	}
	if (now > ans){
	  ans = now;
	}
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

sys.setrecursionlimit(10 ** 5)
to = "abcdefghij"


def dfs(s):
    if len(s) == n:
        print(s)
        return
    m = max(ord(c) - ord("a") for c in s) + 1
    for i in range(m + 1):
        dfs(s + to[i])


n = int(input())
dfs("a")


Measured memory_bytes: 4404
#include <bits/stdc++.h>
using namespace std;

int main() {
	int N, T, c, t;
	cin >> N >> T;
	int cost = 10000;
	for (int i = 0; i < N; i++) {
		cin >> c >> t;
		if (cost > c && T >= t) {
			cost = c;
		}
	}
	if (cost == 10000) {
		cout << "TLE" << endl;
	}
	else {
		cout << cost << endl;
	}
}


Measured memory_bytes: 3604
#include<iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int A,B;
    cin >> A;
    cin >> B;
    int d;
    d = A+B;

    if(A%3 == 0 || B%3 == 0 || d%3 == 0)
    {
        cout <<"Possible" <<endl;
    }
    else
    {
        cout << "Impossible" <<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (mut w_max, mut h_max, n) = (v[0], v[1], v[2]);
    let mut w_min = 0;
    let mut h_min = 0;
    for _ in 0..n {
        let v = read_vec::<i64>();
        let (x, y, a) = (v[0], v[1], v[2]);
        match a {
            1 => w_min = max(w_min, x),
            2 => w_max = min(w_max, x),
            3 => h_min = max(h_min, y),
            _ => h_max = min(h_max, y),
        }
    }
    let ans = max(0, h_max - h_min) * max(0, w_max - w_min);
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, begin, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N;
    cin >> N;
    vector<int> h(N + 2);
    h.at(0) = 0;
    h.at(N + 1) = 0;
    rep(i, 1, N + 1)
    {
        cin >> h.at(i);
    }
    int max = 0;
    int min = 0;
    int ans = 0;
    int f = 1;
    rep(i, 0, N + 1)
    {
        if (f)
        {
            if (h.at(i) > h.at(i + 1))
            {
                ans += h.at(i);
                f = 0;
            }
        }
        else
        {
            if (h.at(i) < h.at(i + 1))
            {
                ans -= h.at(i);
                f = 1;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	for(auto &i:A)cin >> i;
	
	long long ans=A[0]-1;
	A[0]=1;
	int c=1;
	for(int i=0;i<N;i++){
		if(A[i]==c)c++;
		else ans+=(A[i]+c-1)/c-1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 998244353LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,x,y,K_;

int main(){
  ll ans=0;
  string s;cin>>s;
  cin >> K_;
  n=s.length();
  ll zn=0;
  for(ll i=0;i<n;i++){
    if (s[i]=='0')zn++;
  }
  ll nn=n-zn;//1の数
  K_=min(K_,nn);

  if ((n==zn)|(zn==0)|(K_==0)){
    cout<<1<<endl;
    return 0;
  }

  zn++;
  vvi zrange(zn, vi(2));//0からみて左に1が今何個減らせるか、最大何個まで増やせるか
  ll znw=zn-1;
  ll totalone=0;
  s+="0";
  for(ll i=n;i>=0;i--){
    if (s[i]=='0')
    {
      zrange[znw][1]=totalone;
      for(;;)
      {
        i--;
        if (i==-1)break;
        if (s[i]=='1'){
          zrange[znw][0]++;
          totalone++;
        }else{i++;break;}
      }
      znw--;
    }else{
      totalone++;
    }
  }

  /*
  for(ll i=0;i<zn;i++){
    cout<<zrange[i][0]<<" "<<zrange[i][1]<<endl;
  }
  */
  

/*
  for(ll i=0;i<zn;i++){
    zrange[i][1]+=zrange[i][0];
  }
*/


  vi dp(nn+1,0);
  vi dp_n(nn+1,0);
  vvi score(nn+1, vi(K_*2+1,0));
  vvi score_n(nn+1, vi(K_*2+1,0));

  dp[0]=1;
  score[0][0]=1;
  for(ll i=0;i<zn;i++){//さいがいループ、0の左に何個つけられるか

    for(ll j=0;j<nn+1;j++){
      dp_n[j]=0;
      for(ll k=max(j-zrange[i][1],0LL);k<=min(j+zrange[i][0],nn);k++){
        dp_n[j]+=dp[k];
        for(ll l=0;l+abs(j-k)<K_*2+1;l++){
          score_n[j][l+abs(j-k)]+=score[k][l];
          score_n[j][l+abs(j-k)]%=MOD;
        }
      }
      dp_n[j]%=MOD;
    }

    /*
    for(ll j=0;j<nn+1;j++){
      dp[j]=dp_n[j];
      dp_n[j]=0;
    }
    */
    dp.swap(dp_n);
    for(ll j=0;j<nn+1;j++){
      for(ll k=0;k<K_*2+1;k++){
        score[j][k]=score_n[j][k];
        score_n[j][k]=0;
      }
    }
    //score.swap(score_n);
  }


  //cout<<dp[0]<<endl;

  for(ll i=0;i<K_*2+1;i++){
    //cout<<score[0][i]<<endl;
    ans+=score[0][i];
    ans%=MOD;
  }






  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6076
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {

        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a) - 1).ToArray();
        int ans = inpt[0] * inpt[1];
        Console.WriteLine(ans);
    
    }




    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"

5 7


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 13396
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename Container>
int SZ(const Container& S) { return S.size(); }

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg_var(x) clog << #x  << ": " << x << endl;
    #define dbg_array(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg_var(x)
    #define dbg_array(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////

const int MAXN = 110;
int A[MAXN];
int B[MAXN];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!

    int N;
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    int S = A[0];
    for (int i = 0; i < N; i++) S += B[i];
    int res = S;
    for (int j = 0; j < N-1; j++) {
        S += A[j+1] - B[j];
        res = max(S, res);
    }
    cout << res << "\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int n, m, l, r;
    cin >> n >> m;
    int mi = 0;
    int ma = 100010;
    rep(i, m) {
        cin >> l >> r;
        mi = max(l, mi);
        ma = min(r, ma);
    }
    
    if (ma - mi >= 0 ) cout << ma - mi + 1 << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
map<int, int> dp;
int g(int a,int x) {
	if (a < x)return 0;
	int d = a / x;
	int m = a % x;
	if (m%(d+1) == 0) {
		return d;
	}
	a = d*x + (m%(d + 1));
	a -= d + 1;
	return g(a, x);
}
	signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	vector<int> X(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> X[i];
		res ^= g(A[i], X[i]);
	}
	if (res == 0) {
		cout << "Aoki" << endl;
	}
	else {
		cout << "Takahashi" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
#define maxn 500000
#define mod 1000000007
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef double db;

int main()
{
    int ans=0;
    int n,D; scanf("%d%d",&n,&D);
    rep(i,1,n)
    {
        int x,y; scanf("%d%d",&x,&y);
        ans+=1ll*x*x+1ll*y*y<=1ll*D*D;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 3780
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
 int N,K;
  cin >> N >> K;
  
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  
  sort(H.begin(),H.end());
  long long ans = 0;
  for(int i=0;i<N-K;i++){ //xxxooo N=6 K=3
    ans += H[i];
  }
  
  cout << ans << endl;
  
  
  
}


Measured memory_bytes: 1024
N = int(input())
A = list(map(int, input().split()))

alpha = (sum(A[:len(A):2])-sum(A[1:len(A)-1:2]))

ans = [alpha]

for i in range(N-1):
    ans.append(2*A[i]-ans[i])
    
for j in range(N):
    print(ans[j], end = ' ')

Measured memory_bytes: 14028