akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

///////////////////////////


ll beki(ll n) {
	if (n == 0) { return 1; }
	else { return 2 * beki(n - 1)%MOD; }
}


int main() {

	ll N;
	cin >> N;
	ll A[MAX];
	repn(i, N) cin >> A[i];

	ll cnt[100] = {};

	repn(i, N) {
		rep(j, 62) {
			cnt[j] += A[i] % 2;
			A[i] /= 2;
		}
	}

	ll ans = 0;

	rep(j, 62) {
		cnt[j] = cnt[j] * (N - cnt[j])%MOD;
		ans = (ans+cnt[j] * beki(j))%MOD;
	}

	cout << ans;


	system("PAUSE");
}

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

typedef long long ll;

int main(){
	string s;
	cin >> s;
	int a=(s[0]-'0')*10+(s[1]-'0');
	int b=(s[2]-'0')*10+(s[3]-'0');
	int ret = 0;
	if(1 <= a && a <= 12)ret += 2;
	if(1 <= b && b <= 12)ret += 1;
	string ans[4] = { "NA" , "YYMM" , "MMYY" , "AMBIGUOUS" };
	cout << ans[ret] << endl;
}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    string s;
    cin >> s;
    bool ok = true;
    REP(i, s.size()){
        if(i%2==0){
            if(s[i] != 'R' && s[i] != 'U' && s[i] != 'D')
                ok = false;
        }
        else{
            if(s[i] != 'L' && s[i] != 'U' && s[i] != 'D')
                ok = false;
        }
    }
    cout << (ok ? "Yes" :  "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);


string s,t;cin>>s>>t;cout<<t<<s<<endl;
  
  return 0;
}


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

const int INF = 1e9;

int main() {
  int n, m;
  cin>>n>>m;
  int t = (n - m) * 100 + 1900 * m;
  int a = pow(2, m) - 1;
  cout<<t + a * t<<endl;
}

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

#ifndef DEBUG
#define endl '\n'
#define debug(...)
#else
#define debug(...) __VA_ARGS__
#endif
#define debugf(...) debug(printf(__VA_ARGS__);)

const int N = 1e5 + 5;



int (((((main)))))() <%
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int a, b, c;
    cin >> a >> b >> c;
    swap(a,b);
    swap(a,c);

    cout << a << ' ' << b << ' ' << c << endl;

    return 0;
%>

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

using namespace std;

#define MAX 1000000

long long Parent[MAX];
long long Rank[MAX];
long Size[MAX];

void init(long long n) {
  for (long long i = 0; i < n; i++) {
    Parent[i] = i;
    Rank[i] = 0;
    Size[i] = 1;
  }
}

long long Find(long long x) {
  if (Parent[x] == x) {
    return x;
  } else {
    return Parent[x] = Find(Parent[x]);
  }
}

void Unite(long long x, long long y) {
  x = Find(x);
  y = Find(y);
  if (x == y) {
    return;
  }

  if (Rank[x] < Rank[y]) {
    Parent[x] = y;
    Size[y] = Size[x] + Size[y];
  } else {
    Parent[y] = x;
    Size[x] = Size[x] + Size[y];
    if (Rank[x] == Rank[y]) {
      Rank[x]++;
    }
  }
}

bool Same(long long x, long long y) { return Find(x) == Find(y); }

long getSize(long long x) { return Size[Find(x)]; }

int main(int argc, char const *argv[]) {
  long long N, M;
  cin >> N >> M;

  init(N + 1);

  vector<pair<long long, long long>> bridge(M + 1);
  vector<long> ans(M + 1);
  ans[M] = N * (N - 1) / 2;

  for (long long i = 1; i < M + 1; i++) {
    cin >> bridge[i].first >> bridge[i].second;
  }

  for (long long i = M - 1; i >= 1; i--) {
    long long a = bridge[i + 1].first;
    long long b = bridge[i + 1].second;

    if (Same(a, b)) {
      ans[i] = ans[i + 1];
    } else {
      ans[i] = ans[i + 1] - getSize(a) * getSize(b);
      Unite(a, b);
    }
  }

  for (long long i = 1; i < M + 1; i++) {
    cout << ans[i] << "\n";
  }
  return 0;
}


Measured memory_bytes: 12672
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

const ll INF = 1LL << 50;

const ll mod = 1e9 + 7;

int main() {
  ll x, y, z;

  cin >> x >> y >> z;

  cout << z << " " << x << " " << y << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


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

    string s;
    cin >> s;
    rep(i,3){
        cout << s[i] ;
    }
    cout << endl;
    
	return 0;
}

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

#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()  
{ 
    FAST_INP;
    int n; 
    cin >> n;
    int a[n+1];
    long long ans=0;
    unordered_map<int,int> m;
    // find a pair (i,j) where j > i and j-i is equal to the sum of their heights
    // j-i = A[j]+A[i]
    // j-A[j] = A[i]+i
    for(int i=1;i<=n;i++){
        cin >> a[i];
        ans+=m[i-a[i]];
        m[i+a[i]]++;
    }
    cout << ans << "\n";
    return 0;
} 

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

int main(void) {
	string a,b;
	cin >> a >> b;
	a+=b;
	int ab=stoi(a);
	for(int i=2; i*i<=ab; i++){
		if(i*i==ab){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iomanip>
using namespace std;
int main(){
    int n,q;
    cin >> n >>q;
    vector<long long> counter(n);
    vector<vector<long long>> vec(n);
    for(int i=0;i<n-1;i++){
        long long a,b;
        cin >> a >> b;
        a=a-1;
        b=b-1;
        long long Max=max(a,b);
        long long Min=min(a,b);
        vec[Min].push_back(Max);
    }
    for(int i=0;i<q;i++){
        long long p,x;
        cin >> p >> x;
        p=p-1;
        counter[p]+=x;
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<vec[i].size();j++){
            counter[vec[i][j]] += counter[i];
        }
    }
    for(int i=0;i<n;i++){
        if(i==n-1){
            cout<<counter[i]<<endl;
        }else{
            cout<<counter[i]<<" ";
        }
    }
    
}


Measured memory_bytes: 14848
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
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;}

void chmin(int &a, int &b){if (a>b){a = b; return;}return;}
void chmax(int &a, int &b){if (a<b){a = b; return;}return;}

const ll MOD = 1000000007;
const ll INF = 9999999999;

ll power(ll a,ll b){
  // a^bのmodMODを返す
  if (b == 0) return 1;
  if (b == 1) return a%MOD;
  ll tmp = power(a, b/2);
  if (b%2 == 0) return tmp*tmp%MOD;
  else return tmp*tmp%MOD*a%MOD;
}

void iikanji(int n, vector<ll> &vec){
  for (int i=0; i<n; i++){
    vec.at(i) = power(i+1, MOD-2);
  }
}

int main() {
  int n; cin >>n;
  vector<ll> x(n);
  for (int i=0; i<n; i++) cin >>x.at(i);
  vector<ll> l(n-1); //区間ごとの長さ
  for (int i=0; i<n-1; i++){
    l.at(i) = x.at(i+1) - x.at(i);
  }

  vector<ll> vec(n); //途中1/kで割る必要が出てくるがそれをmodMODにおいて掛け算でもできるようにしたい
  iikanji(n, vec);
  vector<ll> C(n); // C[i] = vec[0]+vec[1]+...+vec[i]
  C.at(0) = vec.at(0);
  for (int i=1; i<n; i++){
    C.at(i) = (C.at(i-1) + vec.at(i)) % MOD;
  }

  ll ans = 0;
  for (int i=0; i<n-1; i++){
    ans += l.at(i)*C.at(i)%MOD;
    ans %= MOD;
  }

  ll moddayo = 1;
  for (int i=1; i<n; i++){
    moddayo = moddayo * i % MOD;
  }

  ans = ans * moddayo % MOD;

  cout <<ans <<endl;
}

Measured memory_bytes: 3328
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;

int main() {
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if( a<b )  //a最大 
	{
		int tmp=a;
		a=b;
		b=tmp;
	} 
	if( a<c )
	{
		int tmp=a;
		a=c;
		c=tmp;
	}
	printf("%d\n",10*a+b+c);
	return 0;
	}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

int n = 0;

// {from, to, weight}
vector<tuple<int, int, int>> edges;

int main(void) {
    int L;
    cin >> L;
    L--;

    edges.push_back(make_tuple(1, 2, 0));
    edges.push_back(make_tuple(1, 2, 1));
    n += 2;

    vector<int> as;
    while (L != 1) {
        if (L % 2 == 0) {
            as.push_back(0);
            L--;
        } else {
            as.push_back(1);
            L /= 2;
        }
    }
    reverse(as.begin(), as.end());

    int acc = 1;
    for (auto a : as) {
        if (a == 0) {
            edges.push_back(make_tuple(1, n, acc + 1));
            acc += 1;
        } else {
            for (int i = 0; i < (int) edges.size(); i++) {
                auto edge = edges[i];
                int u, v, w;
                tie(u, v, w) = edge;
                edges[i] = make_tuple(u, v, w * 2);
            }

            edges.push_back(make_tuple(n, n + 1, 0));
            edges.push_back(make_tuple(n, n + 1, 1));
            n += 1;
            acc = 2 * acc + 1;
        }
    }

    printf("%d %d\n", n, (int) edges.size());
    for (auto &edge : edges) {
        int u, v, w;
        tie(u, v, w) = edge;
        printf("%d %d %d\n", u, v, w);
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
#define ll long long
#define mod 1000000007ll
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define db(x) cout << #x << " = " << x << '\n'
#define sep cout << "\n********************************************\n"
#define fast  ios_base::sync_with_stdio(false), cin.tie(NULL)
int main(int argc, char const *argv[])
{
    fast;
    ll n;
    cin >> n;
    float ans = (n + 1) / 2;
    ans /= n;
    printf("%f\n", ans);
    return 0;
}

Measured memory_bytes: 3744
#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
using namespace std;
using ll=long long;
using pii=pair<int,int>;

#define W first
#define V second

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;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m; cin>>n>>m;
	vector<int> v(m+1,0);
	v[1]=1;
	char ch;
	For(i,0,n-1){
		For(j,1,m){
			cin>>ch;
			if(ch=='#') v[j]=0;
			else v[j]=v[j-1]+v[j];
			v[j]%=MOD;
		}
	}
	cout<<v[m]<<"\n";
	return 0;
}


























Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	var a1, a2, a3 int
	fmt.Scan(&a1, &a2, &a3)
	a := make([]int, 3)
	a[0] = Abs(a2 - a1)
	a[1] = Abs(a3 - a2)
	a[2] = Abs(a1 - a3)
	sort.Sort(sort.IntSlice(a))
	fmt.Println(a[0] + a[1])
}
func Abs(a int) int {
	return int(math.Abs(float64(a)))
}



Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func readInt() (read int) {
	scanner.Scan()
	read, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return
}

func main() {
	scanner.Split(bufio.ScanWords)

	n := readInt()
	m := readInt()

	rooms := make([]map[int]interface{}, n+1)
	for i := 0; i < n+1; i++ {
		rooms[i] = make(map[int]interface{})
	}
	for i := 0; i < m; i++ {
		a, b := readInt(), readInt()
		rooms[a][b] = true
		rooms[b][a] = true
	}

	HUGE := int(1e8)
	d := make([]int, n+1)
	for i := range d {
		d[i] = HUGE
	}
	d[1] = 0
	queue := []int{1}
	for len(queue) > 0 {
		roomNo := queue[0]
		queue = queue[1:]
		routes := rooms[roomNo]
		for r := range routes {
			if d[r] == HUGE {
				d[r] = d[roomNo] + 1
				queue = append(queue, r)
			}
		}
	}

	if d[n] == HUGE {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
		for roomNo := 2; roomNo < n+1; roomNo++ {
			min := n + 1
			next := roomNo
			for i := range rooms[roomNo] {
				if d[i] < min {
					min = d[i]
					next = i
				}
			}
			fmt.Println(next)
		}
	}

}


Measured memory_bytes: 45484
<?php
$dy = array( -1, 0, 1, 0);
$dx = array( 0, 1, 0, -1);
$fp = fopen("php://stdin","r");
while(true){
  fscanf( $fp, "%d %d", $w, $h);
  if($w == 0 && $h == 0) break;
    for($i = 0 ; $i < $h ; $i++ ){
    fscanf( $fp, "%s", $mas[$i]);
    for($j = 0 ; $j < $w ; $j++ ){
      if($mas[$i][$j] == '@'){
        $sy = $i;
        $sx = $j;
      }
      $used[$i][$j] = false;
    }
  }
  $que = new SplQueue();
  $que -> push(array($sy,$sx));
  $cnt = 0;
  while(!$que -> isEmpty()){
    $p = $que -> dequeue();
    if($used[$p[0]][$p[1]]) continue;
    $used[$p[0]][$p[1]] = true;
    $cnt++;
    for($i = 0 ; $i < 4 ; $i++ ){
      $ny = $p[0] + $dy[$i];
      $nx = $p[1] + $dx[$i];
      if($ny >= 0 && $ny < $h && $nx >= 0 && $nx < $w && $mas[$ny][$nx] == '.'){
        $que -> push(array($ny,$nx));
      }
    }
  }
  print($cnt."\n");
}
?>

Measured memory_bytes: 6824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll dp[3][2][305][305];
int n,m;
int main(){
	cin>>n>>m;
	dp[1][0][1][0] = 1;
	for(int D=0;D<m;D++){
	    int day = D%2;
	    rep(a,3)rep(b,305)rep(c,305)dp[a][1-day][b][c]=0;
		for(int w=1;w<=2;w++){
			for(int sz=1;sz<=n;sz++){
				for(int sz2=0;sz2<=n-sz;sz2++){
					if(dp[w][day][sz][sz2] == 0) continue;
					if(w == 1){
						dp[1][1-day][sz][sz2] = (dp[1][1-day][sz][sz2]+dp[w][day][sz][sz2]*sz%mod)%mod;
						dp[2][1-day][sz][1] = (dp[2][1-day][sz][1]+dp[w][day][sz][sz2]*(n-sz)%mod)%mod;
					}
					else{
						dp[2][1-day][sz][sz2] = (dp[2][1-day][sz][sz2]+dp[w][day][sz][sz2]*sz2%mod)%mod;
						dp[2][1-day][sz][sz2+1] = (dp[2][1-day][sz][sz2+1]+dp[w][day][sz][sz2]*(n-sz-sz2)%mod)%mod;
						dp[1][1-day][sz+sz2][0] = (dp[1][1-day][sz+sz2][0]+dp[w][day][sz][sz2]*sz%mod)%mod;
					}
				}
			}
		}
	}
	cout << dp[1][m%2][n][0] << endl;
}

Measured memory_bytes: 4608
#include<stdio.h>
#include<math.h>

int main(void){
  int a,b,C;
  double S,L,h;
  scanf("%d %d %d",&a,&b,&C);
  S = a * b * sin(C*M_PI/180) / 2;
  L = a + b + sqrt(a*a + b*b -2*a*b*cos(C*M_PI/180));
  h = 2 * S / a;
  printf("%lf %lf %lf\n",S,L,h);
  return 0;
}

Measured memory_bytes: 636
/*
██╗  ██╗ █████╗ ██████╗ ███████╗███████╗███╗   ███╗        ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗ ████║        ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝ ███████║██████╔╝█████╗  █████╗  ██╔████╔██║        █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗ ██╔══██║██╔══██╗██╔══╝  ██╔══╝  ██║╚██╔╝██║        ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██║  ██║██║  ██║███████╗███████╗██║ ╚═╝ ██║███████╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
Believe in yourself ,( try and try and then try ), You can do it
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define clr(arr, x) memset(arr, x, sizeof arr)
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define OO 0x3f3f3f3f3f3f3f3fLL
const int oo = 0x3f3f3f3f, Mod = 1e9 + 7;
using namespace std;
typedef long long ll;
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
void K_K(){
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int n;
vector<ll>arr;
ll dp[405][405];
ll sol(int l,int r){
	if (l == r)
		return 0;
	ll &ret = dp[l][r];
	if (~ret)
		return ret;
	ret = OO;
	for (int i = l; i < r; i++){
		ret = min(ret, sol(l, i) + sol(i + 1, r) + (arr[r] - arr[l - 1]));
	}
	return ret;
}
int main(){
	K_K();
	cin >> n;
	arr.resize(n + 1, 0);
	clr(dp, -1);
	for (int i = 1; i <= n; i++){
		cin >> arr[i];
		arr[i] += arr[i - 1];
	}
	cout << sol(1, n);
}

Measured memory_bytes: 4936
#include<iostream>
#include<cstdio>
using namespace std;
const int N=2002020;
int n,a[N];
int read(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int main()
{
	n=read(); int sum=0;
	for(int i=1;i<=n;i++)
		a[i]=read(),sum^=a[i];
	for(int i=1;i<=n;i++)
		cout<<(a[i]^sum)<<" ";
	return 0;
}

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

ans = 1
if any([i ==0 for i in A]):
    ans =0
    
for i in range(N):
    ans = ans * A[i]
    if ans == 0:
        ans = 0
        break
    if ans >10**18:
        ans= -1
        break
    else:
        pass
    
print(ans)

Measured memory_bytes: 21608
A,B,K = map(int,input().split())
            
ans=[]
            
for i in range(K):
  if A+i <=B:
    ans.append(A+i)
  if B-i >= A:
    ans.append(B-i)
            
            
ans = sorted(list(set(ans)))
print(*ans,sep="\n")
          

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

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }

    return gcd(b, a%b);
}

const ll L = 1e5+5;
const ll mod = 1e9+7;

ll fact[4005];

void factorial()
{
    fact[0] = 1;

    for(ll i=1; i<4005; i++)
    {
        fact[i] = (fact[i-1]*i)%mod;
    }
}

ll modexp(ll a, ll b, ll c)
{
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b>>=1;
    }

    return ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll n, k;
    cin >> n >> k;

    factorial();

    for(ll i=1; i<=k; i++)
    {
        if(n-k-i+1 < 0)
        {
            cout << 0 << endl;
            continue;
        }

        ll ans = fact[k-1];
        ans*=modexp(fact[i-1], mod-2, mod);
        ans%=mod;
        ans*=modexp(fact[k-i], mod-2, mod);
        ans%=mod;

        ll res = fact[n-k+1];
        res*=modexp(fact[i], mod-2, mod);
        res%=mod;
        res*=modexp(fact[n-k-i+1], mod-2, mod);
        res%=mod;

        cout << (ans*res)%mod << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
cnt = 0
while max(h) != 0:
    for i in range(n):
        if h[i] != 0:
            for j in range(i, n):
                if h[j] == 0:
                    cnt += 1
                    break
                h[j] -= 1
            else:
                cnt += 1
            break
print(cnt)


Measured memory_bytes: 3060
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
constexpr long long int NINF = std::numeric_limits<long long int>::min();

int S, T;

void solve() {
  int N, M;
  cin >> N >> M;

  vector<vector<int>> V;
  vector<int> visited;
  V.resize(N * 3 + 1);
  visited.resize(N * 3 + 1);
  for (int i = 0; i < M; i++) {
    int u, v;
    cin >> u >> v;
    V[u].push_back(v + N);
    V[u + N].push_back(v + 2 * N);
    V[u + 2 * N].push_back(v);
  }

  cin >> S >> T;

  queue<pair<int, int>> queue;
  queue.emplace(S, 0);

  int ans = -1;
  while (!queue.empty()) {
    auto p = queue.front();
    queue.pop();
    int n = p.first;
    int len = p.second;
    if (n == T) {
      ans = len / 3;
      break;
    }

    if (visited[n]) {
      continue;
    }
    visited[n] = 1;

    for (int v : V[n]) {
      queue.emplace(v, len + 1);
    }
  }

  cout << ans << endl;
}

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


Measured memory_bytes: 17792
#include <iostream>
#include <vector>
using namespace std;
 
int main(){
    int N;
    string S;
    cin >> N >> S;
    
    string alpha;
    alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";

    for(int i = 0; i<S.size();i++){
     for(int j = 0; j<alpha.size();j++){
      if(S.at(i)==alpha.at(j) ){
       S.at(i)=alpha.at(j+N);
        cout << S.at(i);
        break;
      }
     }
    }
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int a(int b, int c) {
	int d = b*c;
	return d;
}

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;

	if (a(A,B)<=a(C,D)){
		cout << a(C,D) << endl;
	}
	else {
		cout << a(A,B) << endl;
	}


	return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

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

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();
    int k = sc.nextInt();
    String s = sc.next();
    List<Integer> continued = new LinkedList<>();
    int i = 0;
    while (i < n) {
      int j = i + 1;
      while (j < n && s.charAt(j - 1) == s.charAt(j)) {
        j++;
      }
      continued.add(j - i);
      i = j;
    }

    while (0 < k && 0 < continued.size()) {
      if (2 < continued.size()) {
        int i1 = continued.remove(0);
        int i2 = continued.remove(0);
        int i3 = continued.remove(0);
        continued.add(0, i1 + i2 + i3);
      } else if (2 == continued.size()) {
        int i1 = continued.remove(0);
        int i2 = continued.remove(0);
        continued.add(0, i1 + i2);
      }
      k--;
    }

    int res = 0;
    for (int cont : continued) {
      res += cont - 1;
    }
    os.println(res);
  }
}

Measured memory_bytes: 30128
n = int(input())
a, b = (int(i) for i in input().split())
p = [int(i) for i in input().split()]

x0 = list(filter(lambda x:x<=a, p))
x1 = list(filter(lambda x:a<x and x<=b, p))
x2 = list(filter(lambda x:b<x, p))

print(min([len(x0), len(x1), len(x2)]))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <bits/stdc++.h>
#include <cmath>
#include <stdio.h>
#include <utility>
using namespace std;
#define ll long long

int main()
{
   string s;cin>>s;
   map<char,int>m;
   for(int i=0;i<s.length();i++){
      m[s[i]]++;
   }
   bool b=true;
   for(auto i:m){
       if(i.second%2!=0){
           b=false;
           break;
       }
   }
   if(b){
      cout<<"Yes"<<endl;
   }else{
       cout<<"No"<<endl;
   }
return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h> 
using namespace std;
#define ll long long
#define endl "\n"
const int MAX=1e4+7;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
	double d,t,s;
	cin>>d>>t>>s;
	if(d<=t*s)cout<<"Yes";
	else cout<<"No"; 
   return 0;
}  

Measured memory_bytes: 3736
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<double> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip	;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1<<30;
int l;
vi split(string s){
	stringstream ss(s);//ss<<s;
	vi vec;
	for(int i=0;!ss.eof();i++){
		int t;ss>>t;
		if(i==0)l=t;
		else vec.pb(t);
	}
	return vec;
}
double f(double a,double b){
	return sqrt(a*a-b*b);
}
int main(){
	string s;
	while(getline(cin,s)){
		vi in=split(s);
		int n=in.size();
		int N=1<<n;
		vector<vector<double> >dp(N,vector<double>(n,inf));
		rep(i,n)dp[1<<i][i]=in[i];
		vvi cost(n,vi(n));
		rep(i,n)rep(j,n)cost[i][j]=f(in[i]+in[j],in[i]-in[j]);
		rep(i,N)rep(j,n)if(i&1<<j){
			rep(k,n)if(!(i&1<<k)){
				dp[i|1<<k][k]=min(dp[i|1<<k][k],dp[i][j]+cost[j][k]);
			}
		}
		double mi=inf;
		rep(i,n)mi=min(mi,dp[N-1][i]+in[i]);
		if(mi<EPS+l)cout<<"OK"<<endl;
		else cout<<"NA"<<endl;
	}
}

Measured memory_bytes: 1620
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int A, B; cin >> A >> B;
    Ans(A < 10 && B < 10, A * B, -1);

    return 0;
}


Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

const ll inf = 5e15;

int main() {
    ll N;
    cin >> N;
    V<ll> H(N);
    for(auto &&ele : H) cin >> ele;
    V<ll> cnt(N + 1, 0);
    for(ll i = N - 2; 0 <= i; i--) {
        ll cur = H[i], nxt = H[i + 1];
        if(nxt <= cur) cnt[i] = cnt[i + 1] + 1;
    }
    cout << *max_element(ALL(cnt)) << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
int main(void){
	int H,W,i,j,k,res[100][100];
	char HW[100][100];
	scanf("%d %d\n",&H,&W);
	for(i = 0;i<H;i++){
		for(j = 0;j<W;j++){
			if (j == (W-1)&&i ==(H-1)) scanf("%c",&HW[i][j]);
			else if (j == (W-1)) scanf("%c\n",&HW[i][j]);
			else scanf("%c ",&HW[i][j]);
			res[i][j] = -1;
		}
	}
	for(i = 0;i<H;i++){
		for(j = 0;j<W;j++){
			if(HW[i][j] == 'c'){
				res[i][j] = 0;
				k = 1;
				while(k < (W - j)){
					if(HW[i][j+k] == 'c') break;
					res[i][j+k] = k;
					
					k++;
				}
			}
		}
	}
	for(i = 0;i < H;i++){
		for(j = 0;j < W;j++){
			if (j == (W-1)) printf("%d\n",res[i][j]);
			else printf("%d ",res[i][j]);
		}
	}
	return 0;
}

Measured memory_bytes: 648
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
     
int main(){
  int N;
  cin >> N;
  string table[2];
  bool flag = false;
  
  while(1){
    // query
    string n_table[2];
    int cnt = 0;

    for(int i = 0 ; i < 4 ; i++){
      for(int j = 0 ; j < 2 ; j++){
    	n_table[j] = table[j];
      }

      if(flag){
	n_table[0] += (i%2?'#':'.');
	n_table[1] += ((i >> 1)%2?'#':'.');
      }
      else {
	string s1 = "";
	s1 += (i%2?'#':'.');
	string s2 = "";
	s2 += ((i >> 1)%2?'#':'.');
	n_table[0] = s1 + n_table[0];
	n_table[1] = s2 + n_table[1];
      }
          
      printf("%s\n%s\n", n_table[0].c_str(), n_table[1].c_str()); fflush(stdout);
      // in
      string str;
      cin >> str;
      if(str == "T"){
    	for(int j = 0 ; j < 2 ; j++){
    	  table[j] = n_table[j];
    	}
    	break;
      }
      if(str == "F"){
	cnt++;
      }
      else if(str == "end"){
    	return 0;
      }
    }
    if(cnt == 4)flag = true;
  }
  return 0;
}


Measured memory_bytes: 596
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

ll a[82];

int main()
{
    int n;
    ll s=0,x=1000;
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%lld",&a[i]);
    n=unique(a,a+n)-a;
    for(int i=0;i<n;i++){
        if(i<n-1 && a[i+1]>a[i] && (i==0 || a[i-1]>a[i])){
            ll y=x/a[i];
            x-=a[i]*y,s+=y;
        }
        if(i && a[i-1]<a[i] && (i==n-1 || a[i+1]<a[i])){
            x+=s*a[i];
            s=0;
        }
    }
    printf("%lld\n",x);
    return 0;
}

Measured memory_bytes: 3816
import java.util.*;

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

        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        long count = b - a + 1;

        count -= counter(a, b, c);
        count -= counter(a, b, d);
        count += counter(a, b, lcm(c, d));

        System.out.println(count);
        sc.close();
    }

    static long gcd(long m, long n) {
        if (m < n)
            return gcd(n, m);
        if(n == 0)
            return m;
        return gcd(n, m%n);
    }

    static long lcm(long m, long n){
        return ((m*n) / gcd(m, n));
    }

    static long counter(long a, long b, long n){
        if(a%n == 0)
            return ((b/n) - (a/n) + 1);
        else
            return ((b/n) - (a/n));
    }
}

Measured memory_bytes: 23636
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	ll n, k;
	
	cin >> n >> k;

	if (k & 0x01)
	{
		cout << (n/k) * (n/k) * (n/k) << endl;
	}
	else
	{
		ll num = n / (k / 2);
		if (num & 1)
		{
			cout << ( (num/2+1)*(num/2+1)*(num/2+1) + (num/2)*(num/2)*(num/2) ) << endl;
		}
		else
		{
			cout << ( (num/2)*(num/2)*(num/2) + (num/2)*(num/2)*(num/2) ) << endl;
		}
	}

	
	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int[] t = new int[N + 1];
		int[] x = new int[N + 1];
		int[] y = new int[N + 1];
		for (int i = 1; i <= N; i++) {
			t[i] = sc.nextInt();
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}

		for (int i = 1; i <= N; i++) {
			if (t[i] - t[i - 1] < Math.abs(x[i] - x[i - 1]) + Math.abs(y[i] - y[i - 1])) {
				System.out.println("No");
				return;
			} else if (((t[i] - t[i - 1]) - (Math.abs(x[i] - x[i - 1]) + Math.abs(y[i] - y[i - 1]))) % 2 != 0) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");

	}
	//以下、自作ライブラリ

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

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

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


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

using namespace std;

using ll = long long;
using ld = long double;
using D = double;
using uint = unsigned int;

#ifdef WIN32
    #define LLD "%I64d"
#else
    #define LLD "%lld"
#endif

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

int a[100005];
int n;

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
		a[i]--;
	}
	int answer = 0;
	for (int i = 0; i < n; i++)
	{
		if (a[a[i]] == i) answer++;
	}
	cout << answer / 2 << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int t,n,i,j,a,b,c;
	cin>>a>>b>>c;
	if(a==b&&a!=c||a==c&&a!=b||b==c&&a!=c)
     cout<<"Yes";
     else cout<<"No";
 } 

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

void pok() {
  std::cout << "Yes" << std::endl;
}
void png() {
  std::cout << "No" << std::endl;
}

int main() {
  std::string S, T; std::cin >> S >> T;
  std::map<char, char> s2t_map, t2s_map;
  for (int i = 0; i < S.size(); i++) {
    char sc = S[i];
    char tc = T[i];
    auto it = s2t_map.find(sc);
    if (it == s2t_map.end()) {
      s2t_map.insert(std::make_pair(sc, tc));
    } else {
      if (s2t_map[sc] != tc) {  // find a->b & a->c pattern, it's impossible
        png();
        return 0;
      }
    }

    auto it2 = t2s_map.find(tc);
    if (it2 == t2s_map.end()) {
      t2s_map.insert(std::make_pair(tc, sc));
    } else {
      if (t2s_map[tc] != sc) {  // find b->a & c->a pattern
        png();
        return 0;
      }
    }
  }

  pok();
  return 0;
}


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

using namespace std;

int n;

void solve(){
    int i,j;
    string str;
    cin >> str;
    string keyence = "keyence";
    for(i = 0;i <= 7;i++){
        if(str.substr(0,i) + str.substr(str.length()-7+i) == keyence){
            cout << "YES" << endl;
            return;
        }
    }
    cout << "NO" << endl;
}

int main(){
    solve();
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

# パターン1: K == N のとき
if K == N:
    ans = 1
    for a in A:
        ans *= a
        ans %= MOD
    print(ans)
    exit()

# 非負整数Pと負整数Mに分ける
P = []
M = []
for a in A:
    if a >= 0:
        P.append(a)
    elif a < 0:
        M.append(a)

# パターン2: すべて負の数 かつ Kが奇数のとき
if len(P) == 0 and K % 2 == 1:
    ans = 1
    M.sort(reverse=True)
    for k in range(K):
        ans *= M[k]
        ans %= MOD
    print(ans)
    exit()

# パターン3: それ以外
P.sort(reverse=True)
M.sort()
LP = len(P)  # LP: リストPの長さ
LM = len(M)  # LM: リストMの長さ
cur_p = 0    # cur_p: リストP内での位置
cur_m = 0    # cur_m: リストM内での位置
cnt = 0      # cnt: 選んだ要素の数
ans = 1      # ans: 答え mod(10**9 + 7)
while cnt < K:  # 要素をK個選ぶまで続ける
    if K - cnt == 1 or LM - cur_m <= 1:  # 既にK-1個選んだ or Mが残り1個以下 のとき必ずPから選ぶ
        flag = 'p'
    elif LP - cur_p == 1:  # Pが残り1個のとき
        if (K - cnt) % 2 == 1:  # 残り奇数個選ぶとき、Pの最後の要素は必ず選ばれる.
            flag = 'p'
        else:                   # 残り偶数個選ぶとき、Pの最後の要素は選んではいけない.
            flag = 'm'
    elif LP - cur_p == 0:  # Pが残り0個のとき
        flag = 'm'
    else:  # Pが残り2個以上 かつ Mが残り2個以上 のとき
        p1 = P[cur_p]
        p2 = P[cur_p + 1]
        m1 = M[cur_m]
        m2 = M[cur_m + 1]
        if p1 * p2 >= m1 * m2:
            flag = 'p'
        else:
            flag = 'm'
    
    if flag == 'p':  # Pから選ぶときは1個選ぶ
        ans *= P[cur_p]
        ans %= MOD
        cur_p += 1
        cnt += 1
    else:  # Mから選ぶときは2個同時に選ぶ
        ans *= M[cur_m] * M[cur_m + 1]
        ans %= MOD
        cur_m += 2
        cnt += 2

print(ans)


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

vector<long long> divisor(long long x) {
    vector<long long> v;
    for(int i = 1; i * i <= x; i++) {
        if(x % i == 0) {
            v.push_back(i);
            if(i * i != x) v.push_back(x / i);
        }
    }
    sort(v.begin(), v.end()); return v;
};

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    long long sum = 0;
    for(int i = 0; i < n; i++) sum += a[i];
    vector<long long> d = divisor(sum);
    long long ans = 1;
    for(auto&& x : d) {
        long long need;
        vector<long long> r(n);
        for(int i = 0; i < n; i++) r[i] = a[i] % x;
        sort(r.begin(), r.end());
        long long B = 0;
        for(int i = 0; i < n; i++) B += x - r[i];
        long long A = 0;
        need = 1e18;
        for(int i = 0; i < n; i++) {
            A += r[i];
            B -= x - r[i];
            need = min(need, max(A, B));
        }
        if(need <= k) ans = max(ans, x);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,y,z,k,s,sum=0;
	cin>>k>>s;
	for(x=0;x<=s;x++)
		for(y=0;y<=(s-x);y++){
			z=s-x-y;
			if(x+y+z==s&&x<=k&&y<=k&&z<=k) sum++;
		}
		cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  ll n,a[303][303],ans=0;
  cin>>n;
  fr(i,n){fr(j,n){cin>>a[i][j];ans+=a[i][j];}}
  ans/=2;
  fr(i,n){
    fr(j,n){
      if(j<=i) continue;
      bool f=1;
      fr(k,n){
        if(k==i||k==j) continue;
        if(a[i][k]+a[k][j]<a[i][j]){cout<<-1<<endl;return 0;}
        if(f&&a[i][k]+a[k][j]==a[i][j]){ans-=a[i][j];f=0;}
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024