akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define F first
#define S second
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sortv(X) sort(X.begin() , X.end()) ; 
#define ll long long 
#define ld long double
#define pii pair <int ,int >
#define bug(x)  cout<<"passed "<<x<<endl;
#define ashar(x , y , z) cout<<setprecision(x)<<fixed<<y ; if (z==1) cout<<"\n" ;
#define ppi pair <pair <int, int > , int > 
#define ordered_set tree<pair <long long  ,long long >, null_type,less<pair <long long ,long long > >, rb_tree_tag,tree_order_statistics_node_update> 
  
long long const inf = 3e18, linf = 2e9, mod = 1e9+7 , inf2 = 1e12;
int const mxn = 5e5 + 10 ;
ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

long long bmm(long long  a,long long  b){
	if (b==0)
		return a;
	else
		return bmm(b,a%b);
}
vector <int > vec;
int aval (int a){
	for(int i=0;i<vec.size() and vec[i]<=sqrt(a);i++){
		if (a%vec[i]==0)
			return 0;
	}
	return 1;
}

int cnt[mxn*2] , A[mxn*2]; 

int main(){
	migmig
	for (int i=2;i<=1e3;i++){
		if (aval(i))
			vec.push_back(i);
	}
	int n , g = 0  ; 
	cin>>n ; 
	for (int i = 1 ; i <= n ; i++){
		cin>>A[i] ; 
		g = bmm(g , A[i]) ; 
	}
	int t = 1 ; 
	for (int i = 1 ; i <= n ; i++){
		int k = A[i] ; 
		for (auto u : vec ){
			if (k%u==0){
				cnt[u]++ ;
				if (cnt[u] > 1)
					t = 0 ; 
			}
			while(k%u==0)
				k = k/u ; 
		}
		if (k > 1){
			cnt[k]++ ; 
			if (cnt[k] > 1)
				t = 0 ; 
		}
	}
	if(t==1){
		cout<<"pairwise coprime" ; 
	}
	else if (g==1){
		cout<<"setwise coprime" ; 
	}
	else
		cout<<"not coprime" ; 
}


Measured memory_bytes: 11360
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;

  vector<D> a(n);
  REP(i,n) cin >> a[i];
  
  priority_queue<D,vector<D>,greater<D>> que;

  REP(i,n) que.push(a[i]);

  REP(i,n-1){
    D tmp = 0;
    REP(_,2) tmp += que.top(), que.pop();
    que.push(tmp/2);
  }

  cout << fixed << setprecision(12) << que.top() << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;

    cin >> s;

    int len = s.length();

    int score = 0;
    int gnum = 0;
    int pnum = 0;

    for (int i = 0; i < len; i++)
    {
        char c;
        if (gnum == pnum)
        {
            c = 'g';
            gnum++;
        }
        else
        {
            c = 'p';
            pnum++;
        }

        if(s[i] == 'g' && c == 'p')
        {
            score++;
        }
        else if(s[i] == 'p' && c == 'g')
        {
            score--;
        }
    }

    cout << score << endl;

    return 0;
}

Measured memory_bytes: 512
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=LLONG_MAX;
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
ll n,i,x,p,p1,v[nmax],fact[nmax],invf[nmax],ans;
ll pw(ll x,ll p)
{
	ll ans=1;
	for(ll i=0;(1LL<<i)<=p;i++)
	{
		if(p&(1LL<<i))ans=(ans*x)%mod;
		x=(x*x)%mod;
	}
	return ans;
}
ll c(ll x,ll y)
{
	if(y<0 || y>x)return 0;
	else return (((fact[x]*invf[y])%mod)*invf[x-y])%mod;
}
int main()
{
    //freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n;
	fact[0]=invf[0]=1;
	for(i=1;i<=n+1;i++)
	{
		cin>>x;
		if(v[x])p=v[x],p1=i;
		v[x]=i;
		fact[i]=(fact[i-1]*i)%mod;
		invf[i]=pw(fact[i],mod-2);
	}
	for(i=1;i<=n+1;i++)
	{
		ans=(c(n+1,i)-c(p+n-p1,i-1)+mod)%mod;
		cout<<ans<<endl;
	}
	return 0;
}

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

using namespace std;


#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search  >
#define lower(arr,n,fixed) lower_bound(arr,arr+n,fixed)-arr  //Lower value search  >=
#define FOR(i,a,n) for(int i=a; i<(int)n; i++)
#define FORI(i,a,n) for(int i=a; i>=(int)n; i--)
#define pii pair<int,int>
#define vpii vector<pii>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(a) int((a).size())
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0)
#define endl "\n"
#define all(a) a.begin(), a.end()
#define MEMSET(p,i) memset(p,i,sizeof(p))

/* a=target variable, b=bit number to act upon 0-n */
#define BIT_SET(a,b) ((a) |= (1<<(b)))
#define BIT_CLEAR(a,b) ((a) &= ~(1<<(b)))
#define BIT_FLIP(a,b) ((a) ^= (1<<(b)))
#define BIT_CHECK(a,b) ((a) & (1<<(b)))
#define BIT_COUNT(a) (__builtin_popcount(a))

 
/* x=target variable, y=mask */
#define BITMASK_SET(x,y) ((x) |= (y))
#define BITMASK_CLEAR(x,y) ((x) &= (~(y)))
#define BITMASK_FLIP(x,y) ((x) ^= (y))
#define BITMASK_CHECK(x,y) (((x) & (y)) == (y))

typedef long long LL;
typedef unsigned long long ULL;



int dp2[1 << 21] = {0};  // 2^21
vector<int> M[21];
int can[21][21];
int n;

// int dp[21][2100000] = {0}; // > 2^21
// int solve()
// {
// 	for(auto x : M[0]){
// 		dp[0][x] = 1;
// 	}

// 	int m = 2100000;
// 	int MOD = 1e9 + 7;
// 	FOR(i,0,n-1){
		
// 		FOR(j,0,m){
// 			if(dp[i][j] == 0) continue;
// 			for(auto k : M[i+1]){
// 				int nxt = j^k; 
// 				dp[i+1][nxt] += dp[i][j];
// 				if(dp[i+1][nxt] >= MOD)
// 					dp[i+1][nxt] -= MOD;
// 			}
// 		}
// 	}
	
// 	int last = (1 << n)-1; // seta todos os n bits
// 	return dp[n-1][last];
// }

int solve2()
{
	// for(auto x : M[0]){
	// 	dp2[x] = 1;
	// }

	int m = (1 << n);
	int MOD = 1e9 + 7;
	dp2[0] = 1;
	FOR(mask,0,m){
		int a = BIT_COUNT(mask);
		FOR(b,0,n){
			if(can[a][b] && !BIT_CHECK(mask,b)){
				int k = 1 << b;
				int m2 = mask^k; 
				dp2[m2] += dp2[mask];
				if(dp2[m2] >= MOD)
					dp2[m2] -= MOD;
			}
		}
	}
	
	
	int last = (1 << n)-1; // seta todos os n bits
	return dp2[last];
}

int main(void)
{
	// fastIO();
	
	
	cin >> n;

	
	FOR(i,0,n){
		FOR(j,0,n){
			int x;
			cin >> x;
			can[i][j] = x;
			int b = 0;
			if(x == 1){
				BIT_SET(b,j);
				M[i].pb(b);
			}
		}
	}

	// cout << solve() << endl;
	cout << solve2() << endl;

}




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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

vi g[MAXN];

vector<pii> ans;

int used[MAXN];
int prv[MAXN];
int dp[MAXN];

void dfs(int s) {
	used[s] = 1;
	int cur = 0;
	REP(i, 0, SZ(g[s])) {
		int to = g[s][i];
		if (to != prv[s]) {
			if (used[to] == 2) {
				continue;
			}
			if (!used[to]) {
				prv[to] = s;
				dfs(to);
			}
			if (dp[to] != 0) {
				ans.pb(mp(to, s));
				ans.pb(mp(to, dp[to]));
				dp[to] = 0;
			} else {
				if (cur) {
					ans.pb(mp(s, cur));
					ans.pb(mp(s, to));
					cur = 0;
				} else {
					cur = to;
				}
			}
		}
	}
	if (cur != 0) {
		dp[s] = cur;
	}
	used[s] = 2;
}

void solve(){
	int n, m, a, b;
	scanf("%d%d", &n, &m);
	if (m % 2 == 1) {
		printf("-1\n");
		return;
	}
	REP(i, 0, m) {
		scanf("%d%d", &a, &b);
		g[a].pb(b);
		g[b].pb(a);
	}
	dfs(1);
	REP(i, 0, SZ(ans)) {
		printf("%d %d\n", ans[i]._1, ans[i]._2);
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

#ifdef _WIN32
#define scanfll(x) scanf("%I64d", x)
#define printfll(x) printf("%I64d", x)
#else
#define scanfll(x) scanf("%lld", x)
#define printfll(x) printf("%lld", x)
#endif
#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mt make_tuple
#define mp make_pair
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

using ll = long long; using ld = long double; using vll = vector<ll>; using vvll = vector<vll>; using vld = vector<ld>; 
using vi = vector<int>; using vvi = vector<vi>;
vll conv(vi& v) { vll r(v.size()); rep(i, v.size()) r[i] = v[i]; return r; }
using P = pair<ll, ll>;

template <typename T, typename U> ostream &operator<<(ostream &o, const pair<T, U> &v) {  o << "(" << v.first << ", " << v.second << ")"; return o; }
template<size_t...> struct seq{}; template<size_t N, size_t... Is> struct gen_seq : gen_seq<N-1, N-1, Is...>{}; template<size_t... Is> struct gen_seq<0, Is...> : seq<Is...>{};
template<class Ch, class Tr, class Tuple, size_t... Is>
void print_tuple(basic_ostream<Ch,Tr>& os, Tuple const& t, seq<Is...>){ using s = int[]; (void)s{0, (void(os << (Is == 0? "" : ", ") << get<Is>(t)), 0)...}; }
template<class Ch, class Tr, class... Args> 
auto operator<<(basic_ostream<Ch, Tr>& os, tuple<Args...> const& t) -> basic_ostream<Ch, Tr>& { os << "("; print_tuple(os, t, gen_seq<sizeof...(Args)>()); return os << ")"; }
ostream &operator<<(ostream &o, const vvll &v) { rep(i, v.size()) { rep(j, v[i].size()) o << v[i][j] << " "; cout << endl; } return o; }
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size()-1 ? ", " : ""); o << "]";  return o; }
template <typename T>  ostream &operator<<(ostream &o, const set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]";  return o; }
template <typename T, typename U>  ostream &operator<<(ostream &o, const map<T, U> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]";  return o; }
template <typename T, typename U>  ostream &operator<<(ostream &o, const unordered_map<T, U> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it; o << "]";  return o; }
void printbits(ll mask, ll n) { rep(i, n) { cout << !!(mask & (1ll << i)); } cout << endl; }
#define ldout fixed << setprecision(40) 

static const double EPS = 1e-14;
static const long long INF = 1e18;
static const long long mo = 1e9+7;

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll n, m; cin >> n >> m;
    vector<string> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    rep(i, n) {
        cout << a[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			String s = sc.nextLine();
			String []n = s.split(" ");
			int a = Integer.parseInt(n[0]);
			int b = Integer.parseInt(n[1]);
			String t = Integer.toString(a + b);
			System.out.println(t.length());
		}
		sc.close();
	}
}


Measured memory_bytes: 26200
import java.util.*;
public class Main {	
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new AOJ0094();
	}
	
	
	
	class  AOJ0155{
		int d[];
		int n;
		int x[];
		int y[];
		int ban[];
		int[][] cost;
		public AOJ0155(){
			Scanner in = new Scanner(System.in);
			while(true){
				n = in.nextInt();
				if(n==0)break;
				cost = new int[n+1][n+1];
				ban = new int[n+1];
				x = new int[n+1];
				y = new int[n+1];
				for(int i=1;i<n+1;i++){
					ban[i] = in.nextInt();
					x[i] = in.nextInt();
					y[i] = in.nextInt();
				}
				for(int i=1;i<n+1;i++){
					for(int s=i+1;s<n+1;s++){
						int x1 = x[i],y1= y[i],x2=x[s],y2=y[s];
						int costs = (int)Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));		
						cost[i][s] = costs > 50 ? 1000000:costs;
						cost[s][i] = cost[i][s];
					}
				}
				for(int i=1;i<n+1;i++){
					for(int s=1;s<n+1;s++)System.out.print(cost[i][s]+" ");
					System.out.println();
				} //デバック
				int kai = in.nextInt();
				for(int i=0;i<kai;i++){
					int s = in.nextInt();
					int g = in.nextInt();
					//ArrayList<Integer> list = dijkstra(s, g);
				}
			}
		}
	}
			
	class AOJ0094{
		public AOJ0094() {
			Scanner in = new Scanner(System.in);
			int a=in.nextInt();
			int b=in.nextInt();
			double result = a*b;
			result/=3.305785;
			System.out.printf("%.6f",result);
		}
	}
	
	class AOJ0034{
		int[] kyori = new int[11];
		int speed1,speed2;
		public AOJ0034() {
			Scanner in = new Scanner(System.in);
			while(in.hasNext()){
				String input[] = in.next().split(",");
				int sum=0;
				for(int i=1;i<=10;i++){
					kyori[i] = Integer.parseInt(input[i-1]);
					sum+=kyori[i];
				}
				speed1 = Integer.parseInt(input[10]);
				speed2 = Integer.parseInt(input[11]);
//				double one,two;
//				for(int s=1;s<=10;s++){//終点駅まで
//					
//				}
				
				
				
			}
			
			
			
			
		}
		
		
	}
}

Measured memory_bytes: 17184
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		scanner.close();
		// ??\???????????即????????属
		int tmp;
		// 1????????即2???????????????
		if (b < a) {
			tmp = b;
			b = a;
			a = tmp;
		}
		// 2????????即3???????????????
		if (c < b) {
			tmp = c;
			c = b;
			b = tmp;
		}
		// 1????????即2???????????????
		if (b < a) {
			tmp = b;
			b = a;
			a = tmp;
		}
		System.out.println(a+" "+b+" "+c);
	}
}

Measured memory_bytes: 17160
#include <stdio.h>

int main()
{
    int n, x, i, j, k, ans;
    while(1) {
        scanf("%d%d", &n, &x);
        ans=0;
        if(n==0 && x==0) break;
        for(i=1; i<n-1; i++) {
            for(j=i+1; j<n; j++) {
                k=x-i-j;
                if(j<k && k<=n) ans++;
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h,w;
  cin>>h>>w;
  int a=h*w;
  vector<string> m(h);
  for(auto&& e:m)cin>>e;
  vector<vector<bool>> good(a, vector<bool>(a, false));
  vector<vector<bool>> bad(a, vector<bool>(a, false));
  REP(i,h)REP(j,w) {
    if (m[i][j] == '.') good[i*w+j][i*w+j] = true;
    else bad[i*w+j][i*w+j] = true;
  }
  REP(i,h)REP(j,w)FOR(k,i,h)FOR(l,j,w) {
    int s=i*w+j;
    int t=k*w+l;
    if (m[k][l] == '#') {
      if (k>i && bad[s][(k-1)*w+l]) bad[s][t] = true;
      if (l>j && bad[s][k*w+(l-1)]) bad[s][t] = true;
    } else {
      if (k>i && good[s][(k-1)*w+l]) good[s][t] = true;
      if (l>j && good[s][k*w+(l-1)]) good[s][t] = true;
    }
  }
  int INF = 1000000000;
  vector<vecint> dp(h, vecint(w, INF));
  REP(i,h)REP(j,w) {
    int t=i*w+j;
    if (bad[0][t]) dp[i][j] = 1;
    if (good[0][t]) dp[i][j] = 0;
    REP(k,i+1)REP(l,j+1) {
      int s=k*w+l;
      if (good[s][t]) {
        if (k>0) dp[i][j] = min(dp[i][j], dp[k-1][l]);
        if (l>0) dp[i][j] = min(dp[i][j], dp[k][l-1]);
      } else if (bad[s][t]) {
        if (k>0) dp[i][j] = min(dp[i][j], dp[k-1][l] + 1);
        if (l>0) dp[i][j] = min(dp[i][j], dp[k][l-1] + 1);
      }
    }
  }
  cout<<dp[h-1][w-1]<<endl;
  return 0;
}


Measured memory_bytes: 26368
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    int n;
    cin>>n;
    int a1[100005] = {0};
    vi v1;
    int a;
    ll sum = 0;
    map<int,int> m1;
    loop(i,0,n)
    {
        cin>>a;
        v1.pb(a);
        a1[a] = 1;
        m1[a]++;
        sum+=a;
    }
    int q;
    cin>>q;
    int x,y;
    while(q--)
    {
       cin>>x>>y;

           int k = m1[x];
           m1[x] = 0;
           m1[y] = k+m1[y];
           sum +=(y-x)*k;
       cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 8080
#include <iostream>
#include <cstdlib>
#include<string>
#include<stdlib.h>
#include<math.h>
using namespace std;

int dx[8]={0,0,1,-1,1,1,-1,-1};
int dy[8]={1,-1,0,0,1,-1,1,-1};


int main()
{
    int n;
    
    cin>>n;
    int tmp=floor(sqrt(n));
    cout<<tmp*tmp<<endl;
        
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.HashSet;
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		final int ROCK = 1;
		final int SCISSORS = 2;
		Scanner sc = new Scanner(System.in);
		while (true) {
			int[] hands = new int[5];
			HashSet<Integer> set = new HashSet<>();
			for (int i = 0; i < 5; i++) {
				int temp = sc.nextInt();
				if (temp == 0) {
					return;
				}
				hands[i] = temp;
				set.add(temp);
			}
			if (set.size() != 2) {	//?????????
				for (int i = 0; i < 5; i++) {
					System.out.println(3);
				}
			} else {
				if (!set.contains(ROCK)) {	//?????§??????????????????
					for (int temp : hands) {
						System.out.println(temp - 1);
					}
				} else if (!set.contains(SCISSORS)) {	//??°??????????????????
					for (int temp : hands) {
						System.out.println(temp % 3 + 1);
					}
				} else {	//??°???????????§?????????
					for (int temp : hands) {
						System.out.println(temp);
					}
				}
			}
		}
	}
}

Measured memory_bytes: 28536
#pragma GCC optimize ("O3")
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

const array<int, 4> dx = {0, 1, 0, -1};
const array<int, 4> dy = {1, 0, -1, 0};


typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	string s;
	while(cin >> s) {
		sort(ALL(s));
		if(s[0] == s[1] and s[2] == s[3] and s[0] != s[2]) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
_list = input().split()
_int = int(_list[0]+_list[1])
_boolist = []
for i in range(_int):
  if i**2 == _int:
    _boolist.append("y")
  
if "y" in _boolist:
  print("Yes")
else:
  print("No")
    
#平方根を見つける
	#yesと出力
	#noの出力の場合
      #boolistの作成

Measured memory_bytes: 9112
#include<stdio.h>

int main(void){
  
  char str[5];
  int m;
  
  scanf("%s",str);
  
  if(strcmp(str,"SUN") == 0)
    m = 7;
  else if(strcmp(str,"MON") == 0)
    m = 6;
  else if(strcmp(str,"TUE") == 0)
    m = 5;
  else if(strcmp(str,"WED") == 0)
    m = 4;
  else if(strcmp(str,"THU") == 0)
    m = 3;
  else if(strcmp(str,"FRI") == 0)
    m = 2;
  else if(strcmp(str,"SAT") == 0)
    m = 1;
  printf("%d",m);
  return 0;
}  

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<ll,ll>P;

int v[30],c[30];
int main(){
	int n;cin>>n;
	rep(i,n){
		cin>>v[i];
	}
	int ans=0;
	rep(i,n){
		cin>>c[i];
		ans+=max(0,v[i]-c[i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 384
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(s: str, x: int, y: int):
    try:
        k = s.index("T")
    except ValueError:
        k = len(s)
    x -= k
    s = s[k:]
    xs = []
    ys = []
    d = 0
    v = 0
    for c in s:
        if c == "T":
            if v != 0:
                if d == 0:
                    xs.append(v)
                else:
                    ys.append(v)
            d = 1 - d
            v = 0
        else:
            v += 1
    if v != 0:
        if d == 0:
            xs.append(v)
        else:
            ys.append(v)
    mx = sum(xs)
    dpx = [0] * (mx + 1)
    dpx[0] = 1
    for xi in xs:
        for j in reversed(range(xi, len(dpx))):
            dpx[j] |= dpx[j - xi]
    my = sum(ys)
    dpy = [0] * (my + 1)
    dpy[0] = 1
    for yi in ys:
        for j in reversed(range(yi, len(dpy))):
            dpy[j] |= dpy[j - yi]
    if (
        -mx <= x <= mx and (mx - x) % 2 == 0 and dpx[(mx - x) // 2] and
        -my <= y <= my and (my - y) % 2 == 0 and dpy[(my - y) // 2]
    ):
        print(YES)
    else:
        print(NO)



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(s, x, y)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
import sys

input = sys.stdin.readline

def main():
    N = int(input())
    testify = [[] for _ in range(N)]
    for i in range(N):
        A = int(input())
        for _ in range(A):
            x, y = map(int, input().split())
            testify[i].append((x, y))
    
    ans = 0
    for i in range(2**N):
        honest = set()
        for j in range(N):
            if (i>>j) & 1:
                honest.add(j)
        if len(honest) <= ans:
            continue
        liar = set(range(15)) - honest
        flag = True
        for j in honest:
            honesttmp = set()
            for s, t in testify[j]:
                if t == 1 and s-1 not in honest:
                    flag = False
                    break
                if t == 0 and s-1 in honest:
                    flag = False
                    break
        if flag:
            ans = max(len(honest), ans)
            
    print(ans)

if __name__ == "__main__":
    main()


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    int k;
    cin >> k;
    string ans;
    if (e - a > k) ans = ":(";
    else ans = "Yay!";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
typedef int64_t ll;

int main() {
    for (int i = 0; i < 5; i++){
        int a;
        cin >> a;
        if (a == 0){
            cout << i + 1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
using namespace std;
typedef long long ll;

signed main()
{
  int n, d, ans = 0;
  cin >> n >> d;
  vector<vector<int>> x(n, vector<int>(d));
  rep(i, n)
  {
    rep(j, d)
    {
      cin >> x[i][j];
    }
  }
  rep(i, n)
  {
    rep(j, i)
    {
      int sq = 0;
      rep(k, d)
      {
        int s = x[i][k] - x[j][k];
        sq += s * s;
      }
      int t = sqrt(sq);
      if (t * t == sq)
        ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
// using namespace std;
// #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


//  int main(){

//     IOS;
	
//    #ifndef ONLINE_JUDGE
//      freopen("input1.txt","r",stdin);
//      freopen("output1.txt","w",stdout);
//    #endif

//    	long long x,n,d,i,n1,n2;
//    	cin>>x>>n>>d; 
//    	for (i = 0; i < n; ++i)
//    	{
//    		n1=x-d;
//    		n2=x+d;
//    		if(n1<0)
//    			n1*=-1;
//    		if(n2<0)
//    			n2*=-1;
//    		if(n1<=n2)
//    			x-=d;
//    		else if(n1>n2)
//    			x+=d;
//    	}
//    	cout<<x;
   

//    return 0;
//  }   
#include <bits/stdc++.h>

using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


int check(long a[],int a1,int b1,int i)
{
  int flag=0;

 
    if (a[i]!=a[a1] && a[i]!=a[b1])
    {
      if(a[i]+a[a1]<=a[b1]) flag=1;
      else if(a[i]+a[b1]<=a[a1])  flag=1;
      else if(a[a1]+a[b1]<=a[i])  flag=1;
    }

   
  return flag ;
}
 int main(){

    IOS;
  
   #ifndef ONLINE_JUDGE
     freopen("input1.txt","r",stdin);
     freopen("output1.txt","w",stdout);
   #endif


    //int t;
    //cin>>t;
    //while(t--)
    {
      int n,count=0,max=0,k;
     
    
      
      
        cin>>n;
        long a[n+1];

        

      for (int i = 0; i < n; ++i)
      
          cin>>a[i];

      vector<long> arr_vec;
   for (int i = 0; i < n; ++i)
   {
      arr_vec.push_back(a[i]);
   }
    sort(arr_vec.begin(), arr_vec.end());
    for (int i=0; i<n; ++i)
    {
       a[i] = arr_vec[i];
       
    } 

      for (int i = 0; i < n-2; ++i)
      {
          for (int j = i+1; j < n-1; ++j)
          {
              if(a[i]!=a[j])
              {
                k=j+1;
                while(a[i]+a[j]>a[k] && k<n)
                {
                  if(a[k]!=a[j])
                  count++;
                k++;
                }
              }
          }
      }   
      cout<<count;     

    }
   

   return 0;
 }   


Measured memory_bytes: 3616
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <atcoder/all>
//using namespace atcoder;
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
 ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// cout << fixed << setprecision(10);
    int n;
    cin>>n;
    int x;
    vector<queue<int>> b(n);
    rep(i,n)rep(j,n-1){
        cin>>x;
        x --;
        b[i].emplace(x);
    }
    set<int> seen;
    int ans=-1;
    bool f=1;
    while(f){
        f=0;
        rep(i,n){
            if(b[i].empty()) continue;
            int op=b[i].front();
            if(op<i) continue;
            if(seen.count(op) || seen.count(i)) continue;
            if(b[op].front() != i) continue;
            f=1;
            b[i].pop();
            b[op].pop();
            seen.emplace(op);
            seen.emplace(i);
        }
        ans ++;
        seen.clear();
    }
    rep(i,n){
        if(!b[i].empty()){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<ans<<endl;
}/*
./problem.exe
*/


Measured memory_bytes: 7900
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
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; }
using namespace std;

signed main(void){
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);

    string s; cin>>s;
    sort(all(s));
    if(s[0]==s[1] and s[1]!=s[2] and s[2]==s[3])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}

Measured memory_bytes: 256
n, m = map(int, input().split())
AB  = []
for i in range(n):
    a, b = map(int, input().split())
    AB.append((a, b))

CD  =[]
for i in range(m):
    c,d = map(int, input().split())
    CD.append((c,d))

for a, b in AB:
    min_ = 10**18
    j = -1
    for i, (c, d) in enumerate(CD):
        x = abs(c-a)+abs(d-b)
        if x < min_:
            j = i+1
            min_ = x
    print(j)


Measured memory_bytes: 67216
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
#define EPS 0.0000000001
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
auto make_p(int a,int b,int c){ return piii(a,pii(b,c));}
signed main(){
    int N,M; cin >> N >> M;
    constexpr int INF = 1e18;
    constexpr int mod = 3;
    vector<vector<int>>d(N,vector<int>(4,INF));
    vector<vector<int>>edge(N);
    for(int i = 0;i < M; ++i){
        int u,v; cin >> u >> v;
        edge[--u].push_back(--v);
    }
    int s,t;
    cin >> s >> t; --s;--t;
    priority_queue<piii,vector<piii>,greater<>>que;
    d[s][0] = 0;
    que.push(make_p(d[s][0],s,0LL));
    while (not que.empty()) {
        auto top = que.top(); que.pop();
        int nv = top.second.first;
        int cnt = top.second.second;
        int dis = top.first;
        if(dis > d[nv][cnt])continue;
        for(auto to : edge[nv]){
            int ncnt = (cnt + 1) % mod;
            if(d[to][ncnt] <= dis + 1) continue;
            d[to][ncnt] = dis + 1;
            que.emplace(make_p(d[to][ncnt],to,ncnt));
        }
        
    }
    cout << (d[t][0] == INF ? -1 : d[t][0] / 3) << endl;
}


Measured memory_bytes: 12800
#include <stdio.h>
#include <set>
#include <algorithm>
using namespace std;
#define N 100001
int a[N];
int min(int x, int y) {
	return x < y ? x : y;
}
int nm(int x) {
	int numb = 0;
	for (;;) {
		if (x == 0) {
			return numb;
		}
		x = x / 10;
		++numb;
	}
}
int main() {
	int n, ans=0;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	a[1]--;
	for (int i = 2; i <= n; i++) {
		if (a[i - 1] > a[i]) {
			ans = 1;
			break;
		}
		else if (a[i - 1] == a[i]) {
			;
		}
		else {
			a[i]--;
		}
	}
	printf("%s", ans==0?"Yes":"No");
}

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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	queue<long long> Q;
	for (int i = 1; i < 10; ++i)
		Q.push(i);

	long long K, X;
	cin >> K;
	for (int i = 0; i < K; ++i)
	{
		X = Q.front();
		Q.pop();
		if (X % 10 != 0)
			Q.push(10 * X + (X % 10) - 1);
		Q.push(10 * X + (X % 10));
		if (X % 10 != 9)
			Q.push(10 * X + (X % 10) + 1);
	}
	cout << X;
	return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;


public class Main {
	Scanner sc = new Scanner(System.in);
	double[] weight = { 48.0, 51.0, 54.0, 57.0, 60.0, 64.0, 69.0, 75.0, 81.0, 91.0 };
	String[] name = { "light fly", "fly", "bantam", "feather", "light", "light welter", "welter", 
			          "light middle", "middle", "light heavy", "heavy" };
	void run() {
		while (sc.hasNext()) {
			rank(sc.nextDouble());
			
		}
	}
	
	void rank(double w) {
		for(int i=0;i<weight.length;i++) {
			if (w <= weight[i]) {
				System.out.println(name[i]);
				return;
			}
		}
		System.out.println(name[name.length-1]);
	}
	public static void main(String[] str) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define NL << endl
#define REP(i,n) for(int (i) = 0; i < (n); ++(i))
#define IN(n) cin >> (n)
#define INR(n) for(auto&& e:(n)) cin >> e
#define Yes cout << "Yes" NL
#define No cout << "No" NL

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int INTMAX = numeric_limits<int>::max();
constexpr int INTMIN = numeric_limits<int>::min();
constexpr ll LLMAX = numeric_limits<long long>::max();
constexpr ll LLMIN = numeric_limits<long long>::min();
constexpr int MOD = 1000000007;


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

using namespace std;

bool a[200000] = { 0 };
bool b[200000] = { 0 };

vector<vector<pair<int, int>>> edges;
ll dis[200000];	//kから

void dfs(int s, int b) {
	for (const auto& e : edges[s]) {
		if (e.first != b) {
			dis[e.first] = dis[s] + e.second;
			dfs(e.first, s);
		}
	}
}
signed main() {

	int n;
	int q, k;
	cin >> n;
	edges.resize(n);

	for (int i = 0; i < n - 1; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		edges[a].push_back(make_pair(b, c));
		edges[b].push_back(make_pair(a, c));
	}
	cin >> q >> k;
	k--;
	
	dfs(k, -1);
	
	for (int i = 0; i < q; i++) {
		int x, y;
		cin >> x >> y;
		cout << dis[x - 1] + dis[y - 1] NL;
	}



	return 0;

}



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

int main(void){
    int n,ans=0;
    cin >> n;
    for(int i=1;i<=n;i++){
        int k = n-i;
        for(int j=1;j*j<=k;j++){
            if(k%j==0) ans+=2;
            if(j*j==k) ans--;
        }
    }
    cout << ans << endl;
}


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

int solve(int n,int k, int a[]){
	int dp[n+1];
	dp[0]=0; dp[1]=0;
	dp[2]=abs(a[2]-a[1]);
	for(int i=3; i<=n; i++)
		dp[i]=INT_MAX;
	
	for(int i=3; i<=n; i++){
		int m=min(k,i-1);
		for(int j=1; j<=m; j++){
			dp[i]=min(abs(a[i]-a[i-j]) + dp[i-j], dp[i]);
		}
		// dp[i]=min(abs(a[i]-a[i-1]) + dp[i-1], abs(a[i] -a[i-2]) +dp[i-2]);
	}
	
	// for(int i=0; i<=n; i++)
	// 	cout<<dp[i]<<" ";
	// cout<<endl;
	
	return dp[n];
}

int main() {
	int n,k;
	cin>>n>>k;
	int a[n+1];
	a[0]=0;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	int ans=solve(n,k,a);
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	
	long long sum=0;
	
	for(int i=1;i<=n;i++)
	{
		if(i<=9)
		{
			sum++;
		}
		else if(i>=100 and i<=999)
		{
			sum++;
		}
		else if(i>=10000 and i<=99999)
		{
			sum++;
		}
	}
	
	cout<<sum<<"\n";
	return 0;
}

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

#define int long long
#define rep(i, x) for (int i = 0; i < (int) (x); i++)
#define reps(i, x) for (int i = 1; i <= (int) (x); i++)
#define per(i, x) for (int i = ((int) (x) - 1); i >= 0; i--)
#define sper(i, x) for (int i = ((int) (x)); i > 0; i--)
#define sqr(x) ((x) * (x))
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define bit(n) (1LL << (n))
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { a * b / gcd(a, b); }
template<class T, class U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T, class U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
  Init() {
      cout << fixed << setprecision(20);
  };
} init;

int N, X;
int L[110];
signed main() {
    cin >> N >> X;
    for (int i = 1; i <= N; i++) { cin >> L[i]; }
    for (int i = 1; i <= N; i++) { L[i] += L[i - 1]; }
    int ans = 0;
    for (int i = 0; i <= N; i++) { if (L[i] <= X) { ans++; }}
    cout << ans << endl;
}


Measured memory_bytes: 256
// D - Cake 123

// 解説pdfの解法 #3

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

using IDX = pair<int, pair<int, int>>;

ll A[1000], B[1000], C[1000];
map<IDX, bool> used;

int main() {
	ll X, Y, Z, K;
	cin >> X >> Y >> Z >> K;

	for (int i=0; i<X; i++) {
		cin >> A[i];
	}
	sort(A, A+X, greater<ll>());

	for (int i=0; i<Y; i++) {
		cin >> B[i];
	}
	sort(B, B+Y, greater<ll>());

	for (int i=0; i<Z; i++) {
		cin >> C[i];
	}
	sort(C, C+Z, greater<ll>());

	priority_queue<pair<ll, IDX>> pq;
	IDX idx = make_pair(0, make_pair(0, 0));
	pq.push(make_pair(A[0] + B[0] + C[0], idx));
	used[idx] = true;

	vector<ll> ans(K);
	for (int i=0; i<K; i++) {
		ans[i] = pq.top().first;
		IDX idx = pq.top().second;
		int a = idx.first;
		int b = idx.second.first;
		int c = idx.second.second;
		pq.pop();

		IDX next_idx;

		next_idx = make_pair(a+1, make_pair(b, c));
		if (used[next_idx] == false && a+1 < X) {
			pq.push(make_pair(A[a+1] + B[b] + C[c], next_idx));
			used[next_idx] = true;
		}

		next_idx = make_pair(a, make_pair(b+1, c));
		if (used[next_idx] == false && b+1 < Y) {
			pq.push(make_pair(A[a] + B[b+1] + C[c], next_idx));
			used[next_idx] = true;
		}

		next_idx = make_pair(a, make_pair(b, c+1));
		if (used[next_idx] == false && c+1 < Z) {
			pq.push(make_pair(A[a] + B[b] + C[c+1], next_idx));
			used[next_idx] = true;
		}
	}

	for (ll a : ans) {
		cout << a << endl;
	}

	return 0;
}

Measured memory_bytes: 4200
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int n = s.size();
    int l[n+1], r[n+1];
    l[0] = 0;
    for (int i = 1; i <= n; i++){
        if (s[i-1] == '<') l[i] = l[i-1]+1;
        else l[i] = 0;
    }
    r[n] = 0;
    for (int i = n-1; i >= 0; i--){
        if (s[i] == '>') r[i] = r[i+1]+1;
        else r[i] = 0;
    }
    long long ans = 0;
    for (int i = 0; i <= n; i++){
        //printf("%d %d\n",l[i],r[i]);
        ans += max(l[i],r[i]);
    }
    printf("%lld ",ans);
}


Measured memory_bytes: 4740
#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
// #include <bits/stdc++.h> all

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;

int main(void){
  int n; cin >> n;
  for(int i = 9; i > 0; i--){
    if(n%i == 0){
      if(n/i < 10){
	cout << "Yes" << endl;
	return 0;
      } else {
	
      }
    }
  }

  cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/operators.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

void Main()
{
	int A, B, C;
	std::cin >> A >> B >> C;
	std::swap(A, B);
	std::swap(A, C);
	std::cout << A << " " << B << " " << C << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

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

int main(){
//int N,A,B,C,D,X,T;
int A=0, i=0;
char s[200000];
cin >> s;
while(s[i]!=NULL){
	A += s[i] -'0';
	i++;
}
if(A%9==0) cout << "Yes" << endl;
else cout << "No" << endl;
}

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

int main() {
    int a,b;
    cin >> a >> b;
    if (a < b) {
        cout << "a < b" << endl;
    }
    else if (a > b) {
        cout << "a > b" << endl;
    }
    else {
        cout << "a == b" << endl;
    }
    
}


Measured memory_bytes: 3088
n=int(input())

r=[0]*n
for i in range(0,n):
    r[i]=int(input())

maxv=r[1]-r[0]
minv=r[0]

for j in range(1,n):
    maxv=max(maxv,r[j]-minv)
    minv=min(minv,r[j])

print(maxv)



Measured memory_bytes: 17348
n,m=map(int,input().split())
s=[0]*n
t=[0]*n
for i in range(m):
    a,b=map(str,input().split())
    a,
    a=int(a)-1
    if not s[a]:
        if b=="WA":
            t[a]+=1
        else:
            s[a]=1
print(sum(s),sum(t[i] for i in range(n)if s[i]))

Measured memory_bytes: 4596
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int h1 = sc.nextInt();
		int w1 = sc.nextInt();
		int h2 = sc.nextInt();
		int w2 = sc.nextInt();

		System.out.println((h1 - h2) * (w1 - w2));
	}
}


Measured memory_bytes: 23636