akhauriyash/Code-Regression huggingface dataset:
fn main() {
    read::<String>();
    let a: Vec<i64> = read_vec();

    println!(
        "{}",
        solve(&a)
            .iter()
            .map(|&n| n.to_string())
            .collect::<Vec<_>>()
            .join(" ")
    );
}

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

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

fn solve(a: &[i64]) -> Vec<i64> {
    // 与えられた全ての数字のxorをとれば、求める数列に含まれる全ての数のxorを
    // 算出できる。
    //   S = A(1) xor A(2) xor ... xor A(N)
    // あとは A(i) それぞれについて、
    //   A(i) xor S
    // をとっていけばよい。
    let s = a.iter().fold(0, |acc, cur| acc ^ cur);
    a.iter().map(|&x| s ^ x).collect()
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_solve_1() {
        assert_eq!(vec![26, 5, 7, 22], solve(&[20, 11, 9, 24]));
    }
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ge(a, b) get<(b)>((a))
#define SZ(x) (x).size()
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define CEIL(a, b) ((a) + (b)-1) / (b)
#define CLR(a, b) memset((a), (b), sizeof((a)))
template <typename t> bool ckmin(t& a, const t& b) {return a > b ? a = b, true : false;}
template <typename t> bool ckmax(t& a, const t& b) {return a < b ? a = b, true : false;}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
if (DEBUG) std::cerr

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

    ll n, m, k;
    cin >> n >> m;
    ll sum = 0;
    F0R(i, m) {
        cin >> k;
        sum += k;
    }
    cout << (sum > n ? -1 : n - sum) << endl;
}




Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vpiipi vector<piipi>
#define pb push_back
#define pob pop_back
#define pii pair<int,int>
#define pipii pair<int,pii>
#define piipi pair<pii,int>
#define pld pair<long double,long double>
#define mod 1000000007
// #define mod 1000000009
// #define mod 163577857 
// #define mod 998244353
#define rep(i,n) for (int i = 0; i < n; i++)
#define repp(i,a,b) for(int i = a ; i<b ; i++)
#define reppr(i,a,b) for(int i = a-1 ; i>=b ; i--)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " <<
#define setprec(x) cout << fixed << setprecision(x);
#define REVERSE(a) reverse(all(a));
#define SORT(a) sort(all(a));
#define all(n) n.begin(),n.end()
 
//GCD and LCM
    int gcd (int a, int b) { return b ? gcd (b, a % b) : a; }
    int lcm (int a, int b) { return a / gcd(a, b) * b; }
 
//Modular Exponentiation
    int powmod(int x,int y) 
    { 
        if (y == 0) return 1; 
        int p = powmod(x, y/2) % mod; 
        p = (p * p) % mod;   
        return (y%2 == 0)? p : (x * p) % mod; 
    }
 
//Modular Inverse
    int inverse(int a) 
    { 
       return powmod(a,mod-2); 
    }

//Binomial Coefficients
    int fact[500010], factinv[500010] , coefficientflag = 0;
    void Util_nCr()
    {
        fact[0] = 1 , factinv[0] = 1;
        repp(i,1,500010)
        {
            fact[i] = (fact[i-1] * i)%mod;
            factinv[i] = (factinv[i-1] * inverse(i))%mod;
        }
    }
    int nCr(int n , int r)
    {
        if(!coefficientflag) coefficientflag = 1 , Util_nCr();             
        return ((fact[n] * inverse(fact[n-r]) % mod * inverse(fact[r]))%mod) ;
    }

void solve();
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    // cin >> t; 
    rep(i,t)
    {
        // cout << "Case #" << i+1 << ": ";
        solve();
    }
}

void solve() 
{
    int x , n ;
    cin >> x >> n;
    set<int> s;
    rep(i,n)
    {
        int temp;
        cin >> temp;
        s.insert(temp);
    }
    rep(i,1000)
    {
        int a = x+i , b = x-i;
        if(s.find(b)==s.end())
        {
            cout << b << endl;
            return;
        }
        if(s.find(a)==s.end())
        {
            cout << a << endl;
            return;
        }
    }
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vll A(N);
    rep(i, N) cin >> A[i];
    ll S = 0;
    rep(i, N) S = S ^ A[i];

    vll ans(N);


    rep(i, N) ans[i] = A[i] ^ S;
    rep(i, N)
        cout << ans[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 6268
#include <iostream>
#include <algorithm>

using namespace std;

const int INF = 10000;

int main(){
    vector< vector<int> > g;

    int n, e;
    cin >> n >> e;

    g.resize( n );

    for ( int i=0; i<n; ++i ) {
        g[i].resize( n );
        for ( int j=0; j<n; ++j ) {
            g[i][j] = (i==j ? 0 : INF);
        }
    }

    int s, t;
    for ( int i=0; i<e; ++i ){
        cin >> s >> t;
        g[s][t] = -1;
    }

    for ( int k=0; k<n; ++k )
        for ( int i=0; i<n; ++i )
            for (int j=0; j<n; ++j )
                g[i][j] = min(g[i][j], g[i][k] + g[k][j]);

    for( int i=0; i<n; ++i ){
        if ( g[i][i] < 0 ){
            cout << 1 << endl;
            return 0;
        }
    }

    cout << 0 << endl;

    return 0;
  }



Measured memory_bytes: 3168
#include <stdio.h>
int main(void){
int i,i_2,j,v,N;
int a[100]={};
scanf("%d",&N);
for(i=0;i<N;i++){
    scanf("%d",&a[i]);
}
for(i=1;i<N;i++){
    for(i_2=0;i_2<N;i_2++){
        printf("%d%s",a[i_2],i_2<N-1?" ":"\n");
    }
v=a[i];
    for(j=i-1;j>=0&&a[j]>v;j--){
        a[j+1]=a[j];
    }
    a[j+1]=v;
}
    for(i_2=0;i_2<N;i_2++){
        printf("%d%s",a[i_2],i_2<N-1?" ":"\n");
    }
    return 0;
}


Measured memory_bytes: 2080
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int a,b;cin>>a>>b;
    int u=a^b;
    cout<<u<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#define debug(x...) cout << #x << " = "; _print(x)
typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
#define rep(i,a,b) for (ll i = (a); i < (b); ++i)
#define per(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL) 
const int mod = 1e9 + 7, mxn = 1e5 + 1;

vi get_bin(int x){
    vi ret;
    while(x){
        if(x%2)
            ret.pb(1);
        else
            ret.pb(0);
        x /= 2;
    }
    return ret;
}

int solve(){
    int n, m, k, ans = 0;
    cin>> n>> m>> k;
    char c[n][m];
    rep(i, 0, n)
        rep(j, 0, m)
            cin>> c[i][j];
    int ggr = pow(2, n), ggc = pow(2, m);
    rep(i, 0, ggr){
        rep(j, 0, ggc){
            vi bini = get_bin(i);
            vi binj = get_bin(j);
            map<int, int> rr, cc;
            rep(k, 0, bini.size())
                if(bini[k] == 1)
                    rr[k] = 1;
            rep(k, 0, binj.size())
                if(binj[k] == 1)
                    cc[k] = 1;
            int cnt = 0;
            rep(ii, 0, n)
                rep(jj, 0, m)
                    if(c[ii][jj] == '#'  and  rr[ii]  and  cc[jj])
                        cnt++;
            if(cnt == k)
                ans++;
        }
    }   
    cout<< ans<< "\n";
    return 0;
}
 
int main()
{
    fast;
    int t = 1;
    //cin>> t;
    while(t--){  
        solve();
    }
    return 0;
}
//v.clear(), vis.clear(); vis.resize(n + 1, 0), v.resize(n + 1);
 
/*  inv[1] = 1; // inv is ll
    for(int i=2; i<=mxn; ++i)
        inv[i]=mod-mod/i*inv[mod%i]%mod;*/
        
// lower bound   >=  
// upper bound   >
// vector<int>().swap(vec); //free memory from vec


Measured memory_bytes: 4020
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define ll long long
#define LIM 100000
using namespace std;
int main() {
  bool v[26];
  for (int i = 0; i < 26; i++) {
    v[i] = false;
  }
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    v[(int)s[i] - 97] = !v[(int)s[i] - 97];
  }
  for (bool b : v) {
    if (b) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 200005
#define INF (ll)1e18
#define pll pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define vv vector
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define repr(i,n) repr2(i,n,0)
#define repr2(i,m,n) for(ll i=m;i>=(n);i--)
#define get(n) ll (n); scanf("%lld",&(n));
#define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
#define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
#define gets(s) string (s); cin >> (s);
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); //cout.tie(0);
#define pi 3.1415926535897
#define db double
#define noop
#define flu fflush(stdout)
#define imp {cout<<"impossible\n"; return ;}
#define debug_vec(vec,n) {rep(idxi,n) cout<<vec[idxi]<<" "; cout<<endl;}

ll extended_gcd(ll a, ll b, ll &x, ll &y) {
    if(a==0) {
        x = 0;
        y = 1;
        return b;
    }

    ll x1, y1;
    ll g = extended_gcd(b%a, a, x1, y1);

    x = y1-(b/a)*x1;
    y = x1;
    return g;
}

vector<ll> size(Nmax,0);

void dfs_tree(ll idx, ll par, vector<vector<ll>> &adj) {
    
    size[idx] += 1;

    for(auto i:adj[idx]) {
        if(i!=par) {
            dfs_tree(i,idx,adj);
            size[idx] += size[i];
        }
    }
}

vector<ll> res(Nmax,0);
ll nn; ll z;

ll power(ll x, ll n, ll d) {
    ll val = (x%d), res = 1;
    while(n>0) {
        if(n&1)
            res = (res*val)%d;
        val = (val*val)%d;
        n = n>>1;
    }
    return (res+d)%d;
}

void dfs_tree2(ll idx, ll par, vector<vector<ll>> &adj) {

    res[idx] = z - power(z,nn,N);
    res[idx] = (res[idx] + N)%N;

    for(auto i:adj[idx]) {
        ll v = 1 - power(z,size[i],N); v = (v+N)%N;
        res[idx] = (res[idx] - v*power(z,nn-size[i],N)%N)%N;
        res[idx] = (res[idx] + N)%N;
    }

    // res[idx] = (res[idx]*z)%N;

    for(auto i:adj[idx]) {
        if(i!=par) {
            size[idx] -= size[i];
            size[i] += size[idx];

            dfs_tree2(i,idx,adj);
            
            size[i] -= size[idx];
            size[idx] += size[i];
        }
    }
}



int main() {
    get(n);
    nn = n;
    vv<vv<ll>> adj(n);
    fill_edges(adj,n-1);

    ll x,y;
    extended_gcd(2,N,x,y);
    z = x;

    dfs_tree(0,-1,adj);
    dfs_tree2(0,-1,adj);
    ll ans = 0;
    for(auto i:res)
        ans = (ans+i)%N;
    printf("%lld\n", (ans+N)%N);
    return 0;  
}

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

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

int main() {
  ll n, ans = 0, mx = -1 * INF;
  cin >> n;
  vector<ll> a(n), asum(n);

  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  asum[0] = a[0];
  for (int i = 1; i < n; ++i) asum[i] = asum[i - 1] + a[i];

  bool flg = false;
  int t;
  for (int i = 0; i < n - 1; ++i) {
    if (asum[i] * 2LL < a[i + 1]) {
      t = i + 1;
      flg = true;
    }
  }
  if (!flg) t = 0;
  ans = n - t;
  cout << ans << endl;
  return 0;
}


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

int main()
{
	int N;
	int M = 0;
	int p[50];
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> p[i];
	}

	for (int j = 0; j < N; j++)
	{
		if (p[j] != j + 1)
		{
			M+=1;
		}
	}
	if (M == 0 || M == 2)
	{
		cout << "YES \n";
	}
	else {
		cout << "NO \n";
	}
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<fstream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<list>
#include<utility>
#include<climits>

#define INF INT_MAX/2
#define EPS 1.0e-7

#define MAX_NUM 1000

using namespace std;

typedef long long ll;
typedef pair<int,int> PII;

int W,H;
int N;

int vx[MAX_NUM*2];
int vy[MAX_NUM*2];

char flag[6*MAX_NUM+1][6*MAX_NUM+1];

int compress(int *v, int n, int l){

    vector<int> cv;
    for(int i=0;i<n;++i)
        for(int d=-1;d<=1;++d)
            if(0<=v[i]+d && v[i]+d<=l-1)
                cv.push_back(v[i]+d);

    sort(cv.begin(),cv.end());
    int ret = unique(cv.begin(),cv.end())-cv.begin();

    for(int i=0;i<n;++i)
        v[i] = lower_bound(cv.begin(),cv.begin()+ret,v[i])-cv.begin();

    return ret;

}

int main(){

    cin.sync_with_stdio(false);

    while(cin>>W>>H, W){

        cin >> N;

        for(int i=0;i<N;++i) cin >> vx[2*i] >> vy[2*i] >> vx[2*i+1] >> vy[2*i+1];

        int w = compress(vx,2*N,W);
        int h = compress(vy,2*N,H);

        memset(flag,0,sizeof(flag));

        for(int i=0;i<N;++i)
            for(int ix=vx[2*i];ix<vx[2*i+1];++ix)
                for(int iy=vy[2*i];iy<vy[2*i+1];++iy){
                    flag[ix][iy]=1;
                }

        int ans = 0;

        for(int i=0;i<w;++i){

            for(int j=0;j<h;++j){

                if(flag[i][j])continue;

                ++ans;

                queue<PII> q;
                q.push(make_pair(i,j));
                flag[i][j]=1;
               
                while(!q.empty()){

                    PII p = q.front(); q.pop();
                    int x = p.first;
                    int y = p.second;
                    
                    const int d[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
                   
                    for(int k=0;k<4;++k){

                        int nx = x+d[k][0];
                        int ny = y+d[k][1];

                        if(!(0<=nx && nx<w && 0<=ny && ny<h) || flag[nx][ny])continue;
                        flag[nx][ny]=1;
                        q.push(make_pair(nx,ny));

                    }

                }

            }

        }

        cout << ans << endl;

    }

    return 0;

}

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

#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

int main(){
    long long a, b, c, d;
    cin>>a>>b>>c>>d;
    long long c_division = 0, d_division = 0, candd_division = 0;
    
    /*cの倍数がいくつあるか求める*/    
    c_division = (a-1)/c;
    c_division = b/c - c_division;

    /*dの倍数がいくつあるか求める*/
    d_division = (a-1)/d;
    d_division = b/d - d_division;

    /*cかつdの倍数がいくつあるか求める*/
    long long x = min(c, d);
    long long y = max(c, d);
    long long amari, lcm_cd;
    while(1){
        amari = y%x;
        if(amari==0){
            lcm_cd = c*d/x;
            break;
        }
        else{
            y = x;
            x = amari;
        }
    }
    candd_division = (a-1)/lcm_cd;
    candd_division = b/lcm_cd - candd_division;

    cout<<b-a+1-c_division-d_division+candd_division<<endl;

    return 0;
}

Measured memory_bytes: 256
a = list(input())
b = list(input())
c = list(input())

start = a[0]
a.pop(0)
flg = True
ans = ''

while flg:
    if start == 'a':
        if len(a) != 0:
            start = a[0]
            a.pop(0)
        else:
            flg = False
            ans = 'A'
    elif start == 'b':
        if len(b) != 0:
            start = b[0]
            b.pop(0)
        else:
            flg = False
            ans = 'B'
    elif start == 'c':
        if len(c) != 0:
            start = c[0]
            c.pop(0)
        else:
            flg = False
            ans = 'C'

print(ans)

Measured memory_bytes: 3064
n = int(input())
df_de = [list(map(int, input().split())) for _ in range(n)]
ans = 0
cand = []
for d1, d2 in df_de:
    if d1 == d2:
        ans += 1
    else:
        cand.append(ans)
        ans = 0
cand.append(ans)
print("Yes" if len([i for i in cand if i >= 3]) else "No")

Measured memory_bytes: 62496
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t = 1,tt;
const ll nax=2e18;
void solve(){
	ll n, k, c;
	cin>>n>>k>>c;
	string s;
	cin>>s;
	s='$'+s;
	vector<ll> maxi1(n+5,0), maxi2(n+5,0), dp1(n+5,0), dp2(n+5,0);
	map<ll,vector<ll>> mdp1, mdp2;
	map<ll,ll> good1, good2;
	rep(i,1,n+1){
		if(s[i]=='o'){
			dp1[i]=max(dp1[i],1LL);
			if(i>=c+1){
				dp1[i]=max(1+maxi1[i-c-1],dp1[i]);
			}
		}
		maxi1[i]=max(maxi1[i-1],dp1[i]);
	}
	for(ll i=n;i>=1;i--){
		if(s[i]=='o'){
			dp2[i]=max(dp2[i],1LL);
			if(i+c+1<=n){
				dp2[i]=max(1+maxi2[i+c+1],dp2[i]);
			}
		}
		maxi2[i]=max(maxi2[i+1],dp2[i]);
	}
	rep(i,1,n+1){
		ll tmp=1;
		if(i-c-1>=1)tmp+=maxi1[i-c-1];
		if(i+c+1<=n)tmp+=maxi2[i+c+1];
		if(tmp==k and s[i]=='o')mdp1[dp1[i]].pb(i);
	}
	for(auto u : mdp1)
		if(sz(u.se)==1)cout<<(u.se[0])<<"\n";
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	//cin>>t;
    while(t--){
        solve();
        if(t!=0)cout<<"\n";
    }
    return 0 ;
}


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

int A[1000000], n;

int binarysearch(int key) {
	int mid, left = 0, right = n;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid])return 1;
		if (key > A[mid])left = mid+1;
		else if (key < A[mid])right = mid;
	}
	return 0;
}

int main()
{
	int s,t,sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	cin >> s;
	for (int i = 0; i < s; i++) {
		cin >> t;
		if (binarysearch(t)) sum++;
		}
	cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3396
#include<iostream>
#include<queue>
using namespace std;
#define MAX 200000
#define int long long
#define endl '\n'
const int mod = 1e9+7;
int n;
int cnt[MAX+1][2], final_point = -1;
bool visited[MAX+1];
vector<int> G[MAX+1];
void dfs(int u){
	if(visited[u]) return;
	visited[u] = 1;
	final_point = u;
	int cnt1 = 0;
	for(auto v : G[u]){
		if(!visited[v]){
			dfs(v);
			cnt[u][0] *= (cnt[v][0] + cnt[v][1])%mod;
			cnt[u][0]%=mod;
			cnt[u][1] *= cnt[v][0]%mod;
			cnt[u][1]%=mod; 
			cnt1++;
		}
	}
/*	if(cnt1==0){
	//	cout << u;
		cnt[u][0] = 1;
		cnt[u][1] = 1;
	}*/
}
signed main(){
	cin >> n;
	for(int i=1;i<=n-1;i++){
		int u, v;
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(int i=1;i<=n;i++) cnt[i][0] =  cnt[i][1] = 1;
	dfs(1);
	cout << (cnt[1][0] + cnt[1][1])%mod;
}

Measured memory_bytes: 13952
import java.util.Scanner  ;
public class Main{
public static void main(String[]args){

Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
if(a<b){
System.out.println("a < b");
} 
else{if(a>b){
    System.out.println("a > b");
} 
    else{System.out.println("a == b");}
}
}
}


Measured memory_bytes: 26408
q = 1
while True:
  n = int(raw_input())
  if n == 0: break
  x = [0] * n
  y = [0] * n
  for i in xrange(n):
    x[i],y[i] = map(float, raw_input().split())
  S = 0
  for i in xrange(n):
    S += x[i]*y[(i+1)%n] - x[(i+1)%n]*y[i]
  if S < 0: S = -S
  print "%d %.1f" % (q, S/2)
  q += 1
  raw_input()

Measured memory_bytes: 6348
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> bas(m);
    for(int i = 0; i < m; i++){
        cin >> bas[i].second >> bas[i].first;
    }
    sort(bas.begin(), bas.end());
    int prev = -1, ans = 0;
    for(int i = 0; i < m; i++){
        if(bas[i].second < prev){ continue; }
        prev = bas[i].first;
        ans++;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 1024
/* ABC107_B
    Stuartyg */

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

int main(void){
        int height,width; //H(行),W(列)のこと
        char mass[101][101]; //aのこと。h、w<=100より、これだけあれば安心
        int i,j;
        int col[101] = {0};
        int row[101] = {0};
        scanf("%d %d",&height,&width); //標準入力から受け取る
        for (i=0;i<height;i++){ //配列に値を入れていく
                for (j=0;j<width;j++){
                        scanf(" %c",&mass[i][j]);
                }
        }
        for (i=0;i<height;i++){ //白しかない行があるかのチェック
                for (j=0;j<width;j++){
                        if (mass[i][j] == '#'){ //黒を含む
                                row[i] = 1;
                                break;
                        }

                }
        }

        for (j=0;j<width;j++){ //白しかない列があるかのチェック
                for (i=0;i<height;i++){
                        if (mass[i][j] == '#'){ //黒を含む
                                col[j] = 1;
                                break;
                        }
                }
        }

        for (i=0;i<height;i++){
                if (row[i]==1){ //横に黒を含む
                        for (j=0;j<width;j++){
                                if (col[j]==1){ //縦にも黒を含む
                                        printf("%c", mass[i][j]);
                                }
                        }
                        printf("\n"); //1行出力するごとに改行
                }
        }
        return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
  double num1, num2;
  scanf("%lf %lf", &num1, &num2);
  if(num1 > num2){
    printf("GREATER\n");
  } else if(num1 < num2){
    printf("LESS\n");
  } else if(num1 == num2){
    printf("EQUAL\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    ll x;
    cin >> x;
    ll ans = 1;
    for (ll i = 1; i <= x; i++) {
        for (ll j = 2; pow(i, j) <= x && j <= x; j++) {
            ans = max(ans, (ll)pow(i, j));
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#coding:utf-8
from copy import copy
  
def main():
    n = int(input())
    s = input()
    RGB = ['R', 'G', 'B']
    
    rgb_cnt = [0,0,0]
    for i in range(n-1, -1, -1):
        if s[i] == 'R':
            rgb_cnt[0] += 1
        if s[i] == 'G':
            rgb_cnt[1] += 1
        if s[i] == 'B':
            rgb_cnt[2] += 1
            
    sumv = 0
    rgb_cnt_cp = copy(rgb_cnt)
    for i in range(n-2):
        
        c1 = s[i]
        rgb = ['R', 'G', 'B']
        rgb_idx = rgb.index(c1)
        
        rgb_cnt_cp[rgb_idx] -= 1
        rgb_cnt_cp2 = copy(rgb_cnt_cp)
        
        #print(rgb_cnt_cp2)
        
        for j in range(i+1, n):
            c2 = s[j]
            if c2 == c1:
                continue
            rgb_idx2 = rgb.index(c2)
            rgb_cnt_cp2[rgb_idx2] -= 1
            #print(rgb_idx2)
            
            rgb2 = copy(RGB)
            rgb2.pop(rgb2.index(c1))
            rgb2.pop(rgb2.index(c2))
            c3 = rgb2[0]
            
            c3idx = RGB.index(c3)
            #print(rgb_cnt_cp2[c3idx])
            sumv += rgb_cnt_cp2[c3idx]
            
            
        #print(rgb_cnt_cp2)
        
    for i in range(n-1):
        c1 = s[i]
        rgb = ['R', 'G', 'B']
        rgb_idx = rgb.index(c1)
        
        rgb.pop(rgb.index(c1))
        
        for j in range(i+1, n):
            c2 = s[j]
            if c2 == c1:
                continue
            rgb2 = copy(rgb)
            rgb2.pop(rgb.index(c2))
            c3 = rgb2[0]
            
            k = j + (j-i)
            
            if k > n - 1:
                break
            if c3 == s[k]:
                #print(i,j,k)
                sumv -= 1
            
        
    print(sumv)
    #print(rgb_cnt)
        
  
if __name__ == '__main__':
    main()

Measured memory_bytes: 75348
#include<bits/stdc++.h>
using namespace std;
int main(){
 int n,m;
  cin>>n;
  int a[n];
  long long sum=0;
  for(int i=0;i<n;i++){
  	cin>>a[i];
    sum=sum+a[i];
  }
  cin>>m;
  int p[m];
  int x[m];
  for(int i=0;i<m;i++){
   cin>>p[i]>>x[i];
   cout<<sum-a[p[i]-1]+x[i]<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll X;
  cin >> X;

  ll money = 100;

  rep2(i, 1, 10000){
    money += money / 100;
    if(money >= X){
      cout << i << endl;
      return 0;
    }
  }
  
  return 0;
}


Measured memory_bytes: 3624
#include<cstdio>
int N,A[200010];
int pos[400010],S[400010];
bool chk(int M){
	int tot=0;
	pos[0]=0;
	//printf("M=%d\n",M);
	for(int i=0;i<N;i++){
		if(A[i]>pos[tot]){
			S[tot]=1;
			pos[++tot]=A[i];
		}
		else{
			while(pos[tot]>A[i]){
				if(tot&&pos[tot-1]<A[i])pos[tot]=A[i];
				else--tot;
			}
			while(tot&&S[tot-1]==M)--tot;
			if(!tot)return 0;
			if(pos[tot]==pos[tot-1]+1)S[tot-1]++;
			else{
				pos[tot]--;
				S[tot]=S[tot-1]+1;
				pos[tot+1]=pos[tot]+1;
				tot++;
			}
			if(pos[tot]<A[i]){
				S[tot]=1;
				pos[++tot]=A[i];
			}
		}
		
		//for(int j=0;j<tot;j++)
		//	for(int k=pos[j];k<pos[j+1];k++)printf("%d",S[j]);puts("");
	}
	return 1;
}
int main(){
	scanf("%d",&N);
	for(int i=0;i<N;i++)scanf("%d",A+i);
	int left=0,right=N,mid;
	while(right-left>1)chk(mid=left+right>>1)?right=mid:left=mid;
	printf("%d\n",right);
}

Measured memory_bytes: 2560
#include<stdio.h>
int main(){
  int a,b,c[110],d,e,f,g;
  scanf("%d",&a);
  for(b=1;b<=a;b++){
    scanf("%d",&c[b]);
  }
  for(g=1;g<a;g++){
   for(b=1;b<a;b++){
     if(c[b]<c[b+1]){
       d=c[b];
       c[b]=c[b+1];
       c[b+1]=d;
     }
   }
  }
    for(b=1;b<=a;b=b+2){
      e=c[b]+e;
    }
    for(b=2;b<=a;b=b+2){
       f=c[b]+f;
    }
    e=e-f;
    printf("%d",e);
    return 0;
  }

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 

ll n,dp[100005][4],a[100005],b[100005],c[100005];

void boost()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

ll solve(int currd,int d)
{
	if(currd>n)
		return 0;
	if(dp[currd][d]!=-1)
		return dp[currd][d];
	ll ans=0;
	if(d!=1)
		dp[currd][d] = max(dp[currd][d],solve(currd+1,1)+a[currd]);
	if(d!=2)
		dp[currd][d] = max(dp[currd][d],solve(currd+1,2)+b[currd]);
	if(d!=3)
		dp[currd][d] = max(dp[currd][d],solve(currd+1,3)+c[currd]);

	return dp[currd][d];
}

int main()
{
	int i;
	boost();
	memset(dp,-1,sizeof(dp));
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	cout<<solve(1,0)<<endl;
	return 0;
}

Measured memory_bytes: 10368
import math
N = int(input())

def f(x, y, z):
    return x*x + y*y + z*z + x*y + y*z + z*x

ans = [0] * (N+1)
for x in range(1, math.ceil(N**0.5)):
    for y in range(x, math.ceil(N**0.5)):
        for z in range(y, math.ceil(N**0.5)):
            k = f(x,y,z)
            if k <= N:
                if x == y == z:
                    ans[k] += 1
                elif x == y or y == z or z == x:
                    ans[k] += 3
                else:
                    ans[k] += 6
for i in range(1, N+1):
    print(ans[i])


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

using namespace std;

int main() {
    long N; cin >> N;
    long Q; cin >> Q;
    string S; cin >> S;
    vector<int> A(N, 0);

    int count = 0;
    for (int i = 0; i < N-1; ++i) {
        if(S[i] == 'A' && S[i+1] == 'C') {
            count++;
            A[i+1] = count;
        } else {
            A[i+1] = A[i];
        }
    }

    long l, r;

    for (long j = 0; j < Q; ++j) {
        cin >> l;
        cin >> r;
        cout << A[r-1] - A[l-1] << endl;
    }

    return 0;
}

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

//#define int long long
typedef long long ll;
const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<vector<int>> F(N,vector<int>(10));
    for (int i=0;i<N;i++){
        for (int j=0;j<10;j++){
            cin >> F[i][j];
        }
    }
    vector<vector<int>> P(N,vector<int>(11));
    for (int i=0;i<N;i++){
        for (int j=0;j<11;j++){
            cin >> P[i][j];
        }
    }
    int ans = -INF;
    for (int i=1;i<(1<<10);i++){
        vector<int> bits(10);
        for (int bit=0;bit<10;bit++){
            if ((i>>bit)&1) bits[bit] = 1;
        }
        int profit = 0;
        for (int j=0;j<N;j++){
            int num = 0;
            for (int k=0;k<10;k++){
                if (bits[k] && F[j][k]){
                    num++;
                } 
            }
            profit += P[j][num];
        }
        ans = max(ans, profit);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int n;
    cin >> n;
    map<pair<int, int>, int> store;
    for (int i = 0; i < n; i++)
    {
        double no;
        long long lno;
        cin >> no;
        lno = llround(no * 1e9);
        int two = 0, five = 0;
        while (lno % 2 == 0)
            two++, lno >>= 1;
        while (lno % 5 == 0)
            five++, lno /= 5;
        store[{two, five}]++;
    }
    long long ans = 0;
    for (auto i : store)
        for (auto j : store)
            if (i.first.first + j.first.first >= 18 && i.first.second + j.first.second >= 18)
            {
                if (i < j)
                    ans += 1ll * i.second * j.second;
                else if (i == j)
                    ans += 1ll * i.second * (i.second - 1) / 2;
            }
    cout << ans << "\n";
}


Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](long a, long b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<long>;
using vvi = vector<vi>;
using vs = vector<string>;
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/
int main() {
  string s;
  cin >> s;
  if(s=="ARC"){cout << "ABC"<<endl;return 0;}
  cout << "ARC" << endl;
  return 0;
}


Measured memory_bytes: 3592
// In the name of Allah. Ya ali!
#include<bits/stdc++.h>
#define double long double
typedef long long ll;
const ll MAX_N = 100+10;
const ll MOD = 1e9+7;
using namespace std;

int main()
{
    int n;
    cin >> n;
    if (n&1)
    {
        vector<pair<int,int>> edges;
        for(int i = 1;i<=n-1;++i)
            edges.push_back({n,i});
        for(int i = 1;i<=n-1;++i)
        {
            for(int j = i+1;j<=n-1;++j)
            {
                if (i==j or i+j==n)
                    continue;
                edges.push_back({i,j});
            }
        }
        cout << edges.size() << "\n";
        for(auto x:edges)
            cout << x.first << " " << x.second << "\n";
    }
    else
    {
        cout << n*(n-1)/2-n/2 << "\n";
        for(int i = 1;i<=n;++i)
        {
            for(int j = i+1;j<=n;++j)
            {
                if (i+j!=n+1)
                    cout << i << " " << j << "\n";
            }
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    vector<bool> isprime(100010,true);
    isprime[0]=false;
    isprime[1]=false;
    for(int i=2;i*i<=100000;i++){
        if(isprime[i]){
            for(int j=2;i*j<=100000;j++) isprime[i*j]=false;
        }
    }
    
    vector<int> sum(100010,0);
    rep(i,1,100001){
        sum[i]=sum[i-1]+(i%2==1 && isprime[i] && isprime[(i+1)/2]);
    }
    
    int q;
    cin>>q;
    vector<int> l(q),r(q);
    rep(i,0,q) cin>>l[i]>>r[i];
    
    rep(i,0,q){
        cout<<sum[r[i]]-sum[l[i]-1]<<endl;
    }
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int> >;

int sum=0;

void dfs(Graph &g,vector<bool> visit,int v){
  visit[v]=true;
  vector<bool> fin(visit.size(),true);
  if(visit==fin){
    sum++;
    return ;
  }
  for(auto nv:g.at(v)){
    if(visit[nv]){
      continue;
    }
    dfs(g,visit,nv);
  }
}

int main(){
  int N,M;
  cin>>N>>M;
  Graph G(N);
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    G.at(a-1).push_back(b-1);
    G.at(b-1).push_back(a-1);
  }

  vector<bool> visit(N,false);
  dfs(G,visit,0);

  cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> place(N), cheak(M);
    vector<int> answ(N);
    rep(i, N) cin >> place[i].first >> place[i].second;
    rep(i, M) cin >> cheak[i].first >> cheak[i].second;
    rep(i, N) {
        int ans = INF;
        rep(k, M) {
            int dist = abs(place[i].first - cheak[k].first) +
                       abs(place[i].second - cheak[k].second);
            ans = min(ans, dist);
        }
        rep(k, M) {
            if (ans == abs(place[i].first - cheak[k].first) +
                           abs(place[i].second - cheak[k].second)) {
                answ[i] = k + 1;
                break;
            }
        }
    }
    rep(i, N) cout << answ[i] << endl;
    return 0;
}

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

using namespace std ;

int main(){
    long long n, k;
    cin>>n>>k;

    long long zero = 0, half_k = 0;

    for(int i = 1; i<= n; i++){
        if(i%k == 0) zero++;
        if(k%2 == 0 && i%k == k/2) half_k++;
    }

    cout<<zero*zero*zero+half_k*half_k*half_k<<endl;

}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace ConsoleApp1
{
    using static Util;

    internal class Program
    {

        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var isyyMM = IsDate(s, "yyMM");
            var isMMyy = IsDate(s, "MMyy");
            var res = "NA";
            if (isyyMM && isMMyy)
            {
                res = "AMBIGUOUS";
            }else if (isyyMM)
            {
                res = "YYMM";
            }else if (isMMyy)
            {
                res = "MMYY";
            }
            Console.WriteLine($"{res}");
#if DEBUG
            Console.Read();
#endif
        }

        public static bool IsDate(string s, string format)
        {
            DateTime d = DateTime.MinValue;
            return DateTime.TryParseExact(s, format, null, System.Globalization.DateTimeStyles.None, out d);
        }
    }

    public static class Util
    {
        public static long[] ReadLongArray() => Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        public static int[] ReadIntArray() => Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        public static long ReadLong() => long.Parse(Console.ReadLine());
        public static long ReadInt() => int.Parse(Console.ReadLine());
    }
}


Measured memory_bytes: 11704
N = int(input())
d = dict()

for i in range(N):
    s = tuple(sorted(input()))
    if s in d.keys():
        d[s] += 1
    else:
        d[s] = 1

ans = 0
for i in d.values():
    if i != 1:
        ans += i * (i - 1) // 2

print(ans)


Measured memory_bytes: 23652
#include <iostream>
#include <cstdio>
#include <vector>
#include <array>
#include <chrono>
#include <numeric>
#include <algorithm>

using namespace std;

int main() {
	long long N, K;

	cin >> N >> K;
	std::vector<long long> H(N);

	for(int i=0;i<N;i++){
		cin >> H[i];
	}

	std::sort(H.begin(),H.end(),std::greater<int>());

	long long del = K;
	if( del >= H.size() ){
		cout << 0 << endl;
	}
	else{
		cout << accumulate(H.begin()+del, H.end(), 0LL) << endl;
	}

	return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
//#define mod 1000000007LL
#define mod 998244353 
using namespace std;
int power(int x, int y) ;
int gcd(int a, int b) ;
#define pi 3.141592653589

signed main() {
    quickie
    int n ;
    cin >> n ;
    int a[n] ;
    mi m;
    rep(i ,0, n-1) cin >> a[i], m[a[i]]++ ;
    rep(i, 1, n+1) cout << m[i] << "\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
 
int gcd(int a,int b){
    if(a==0) return b;
    return gcd(b%a,a);
}

Measured memory_bytes: 17688
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;

int main()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	ll x = 0 , x_last;
	rep(i, n) cin >> a[i];
	rep(i, n)
	{
		int incr = (i % 2 == 0) ? a[i] : -a[i];
		x+= incr;
		
	}
	cs(x);
	x_last = x;
	rep1(i, n - 1)
	{
		x = 2 * a[i - 1] - x_last;
		cs(x);
		x_last = x;
	}
	return 0;
}


Measured memory_bytes: 2048
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int x1, x2, x3, x4, y1, y2, y3, y4;
        x1 = scan.nextInt();
        y1 = scan.nextInt();
        x2 = scan.nextInt();
        y2 = scan.nextInt();
        
        x3 = x2 - (y2 - y1);
        y3 = y2 - (x1 - x2);
        x4 = x1 - (y2 - y1);
        y4 = y1 - (x1 - x2);
        
        System.out.println(String.format("%d %d %d %d", x3, y3, x4, y4));
        scan.close();
    }
}


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

const int maxn = 100000+10;
int sc[maxn];
int main()
{
    int N,K,Q;
    cin>>N>>K>>Q;
    for(int i=1;i<=N;++i)
        sc[i]=K-Q;
    for(int i=0;i<Q;++i)
    {
        int d;
        cin>>d;
        sc[d]++;
    }
    for(int i=1;i<=N;++i)
    {
        if(sc[i]>0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int n = in.i();
        long k = in.l();
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = (in.l() << 17) + in.i();
        }
        Arrays.sort(a);
        int ans = 0;
        for (int i = 0; i < n; i++) {
            long c = a[i] & ((1L << 17) - 1);
            k -= c;
            if (k <= 0) {
                ans = (int)(a[i] >> 17);
                break;
            }
        }
        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = read(cbuf, 0, cbuf.length);
            } catch (IOException e) {}
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (c != ' ' && c != '\n' && c != '\r') {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (true) {
            char c = next();
            if (c != ' ' && c != '\n' && c != '\r') {
                back();
                break;
            }
        }
    }

    char[] s(final int N) {
        skip();
        char[] s = new char[N];
        for (int i = 0; i < s.length; i++) {
            s[i] = next();
        }
        return s;
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 36668