akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#include <string.h>
#include <map>
#define Z class
#define ln cout<<'\n'
#define ll long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
//ASCII a=97, A=65
// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
// sort(vec.begin(), vec.end()); std::greater<>()
// reverse(vec.begin(), vec.end());
// scanf("%s",s);
// printf("%d\n",end-start+1);
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;

int main(){
    char s[200100]; scanf("%s",s);
    int start,end;
    rep(i,strlen(s)){
        if(s[i]=='A'){
            start = i;
            break;
        }
    }
    for(int i=strlen(s)-1; i>=0; --i){
        if(s[i]=='Z'){
            end = i;
            break;
        }
    }
    printf("%d\n",end-start+1);
}


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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

struct Edge{
	int src,dst;
	Edge(){}
	Edge(int s,int d):src(s),dst(d){}
};
typedef vector<vector<Edge>> Graph;

int NextPow2(int x)
{
	x--;
	for(int i=1;i<32;i*=2) x|=x>>i;
	return x+1;
}
const int I=numeric_limits<int>::max();
int F(int a,int b){return min(a,b);}

struct SegmentTree{
	int size;
	vi data,index;
	SegmentTree(int n):size(NextPow2(n)),data(size,I),index(size*2){
		iota(size+all(index),0);
		peri(i,1,size) index[i]=index[i*2];
	}
	SegmentTree(const vi& a):size(NextPow2(a.size())),data(size,I),index(size*2){
		copy(all(a),begin(data));
		iota(size+all(index),0);
		peri(i,1,size){
			int u=index[i*2],v=index[i*2+1];
			index[i]=data[u]==F(data[u],data[v])?u:v;
		}
	}
	void Update(int i,int x){
		data[i]=x;
		for(i+=size;i/=2;){
			int u=index[i*2],v=index[i*2+1];
			index[i]=data[u]==F(data[u],data[v])?u:v;
		}
	}
	int QueryIndex(int a,int b,int i,int l,int r){
		if(b<=l || r<=a) return -1;
		if(a<=l && r<=b) return index[i];
		int u=QueryIndex(a,b,i*2,l,(l+r)/2),v=QueryIndex(a,b,i*2+1,(l+r)/2,r);
		if(u==-1 || v==-1) return u!=-1?u:v;
		return data[u]==F(data[u],data[v])?u:v;
	}
	int QueryIndex(int a,int b){
		return QueryIndex(a,b,1,0,size);
	}
};

struct LCA{
	vi tour,fs;
	SegmentTree st;
	LCA(const Graph& g,int root):fs(g.size(),INF),st(1){
		vi ds;
		DFS(g,-1,root,0,ds);
		rep(i,tour.size()) if(fs[tour[i]]==INF) fs[tour[i]]=i;
		st=SegmentTree(ds);
	}
	void DFS(const Graph& g,int p,int v,int d,vi& ds){
		tour.push_back(v);
		ds.push_back(d);
		for(auto e:g[v]) if(e.dst!=p){
			DFS(g,e.src,e.dst,d+1,ds);
			tour.push_back(v);
			ds.push_back(d);
		}
	}
	int Find(int u,int v){
		if(fs[u]>fs[v]) swap(u,v);
		return tour[st.QueryIndex(fs[u],fs[v]+1)];
	}
};

int main()
{
	for(int n;cin>>n && n;){
		Graph g(n);
		rep(u,n){
			int k; cin>>k;
			rep(i,k){
				int v; cin>>v;
				g[u].emplace_back(u,v);
				g[v].emplace_back(v,u);
			}
		}
		LCA lca(g,0);
		
		int q; cin>>q;
		rep(_,q){
			int u,v; cin>>u>>v;
			cout<<lca.Find(u,v)<<endl;
		}
	}
}

Measured memory_bytes: 15252
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int mex=2000005;
#define ll long long 
#define test int t;cin>>t;while(t--)
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,n) for(int i=a;i<n;i++)
#define rfo(i,a,b) for(int i=a;i>=b;i--)
#define bg begin()
#define en end()
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define veci vector<int>
#define veclli vector<long long int> 
#define all(x) x.begin(),x.end()
#define sci(x) scanf("%d",&x);
#define scc(x) scanf("%c",&x);
#define scs(x) scanf("%s",x);
#define debug(arr,n) for(int i=0;i<n;i++) printf("%d ",arr[i]);
#define sz(x) x.size()
#define loop(x) for(auto it=x.begin();it!= x.end();it++) 
ll int power(ll int a,int b)
{
    ll int ans=1,f=a;
    while(b)
    {
        if(b&1) ans=(ans*f)%mod;
        f=(f*f)%mod;
        b=b>>1;
    }
    return ans;
}
 ll int fact[mex];
ll int ncr(int n,int r)
{
    ll int ans=(fact[n]*power(fact[n-r],mod-2))%mod;
   // cout<<power(n-r,mod-2)<<endl;
   // cout<<n<<" "<<r<<endl;
    //cout<<ans<<endl;
    ans=(ans*power(fact[r],mod-2))%mod;
   // cout<<ans<<endl;
    return ans%mod;
}
int main()
{
   
    fact[0]=1;
    fo(i,1,mex)
    fact[i]=(fact[i-1]*i)%mod;
    
    int r1,r2,c1,c2;
    cin>>r1>>c1>>r2>>c2;
    
    ll int ans1=ncr(c2+r2+2,c2+1);
    ll int ans2=ncr(c2+r1+1,c2+1);
   // cout<<c2+r1+1<<" "<<c2+1<<endl;
    ll int ans3=ncr(c1+r2+1,c1);
    ll int ans4=ncr(c1+r1,c1);
    //cout<<ans1<<" "<<ans2<<" "<<ans3<<" "<<ans4<<endl;
    ans1=(ans1+ans4-ans2-ans3+mod)%mod;
   
    cout<<ans1<<endl;
}

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

using namespace std;

int main(){
	int n, m;
	while(cin >> m >> n, m|n){
		bool check[8000000] = {};
		int cnt = 0, ans = 0;
		for(int i=m; i<8000000; i++){
			if( check[i] == false ){
				if( cnt < n ){
					cnt++;
					for(int j = i; j<8e6; j+=i){
						check[j] = true;
					}
				}else{
					ans = i;
					break;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 10908
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define rrep1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

string s;

int main() {
    cin >> s;

    string a = "";
    rep(i, 5) {
        a += "hi";
        if (a == s) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;

typedef long long LL;
const int MaxN=1e5+10;
int rmq[MaxN][20];
int dis[MaxN];
vector<int> mp[MaxN];
int n;

void dfs(int u,int pre){
	dis[u]=dis[pre]+1;
	if(pre)	rmq[u][0]=pre;
	else rmq[u][0]=u;
	for(int i=1;i<20;i++)
		if(u==1)	rmq[u][i]=u;
		else rmq[u][i]=rmq[rmq[u][i-1]][i-1];
	sort(mp[u].begin(),mp[u].end());
	for(int v:mp[u])
		dfs(v,u);
	}

queue<int> q;
vector<int> path;

void bfs(int u){
	q.push(u);
	while(!q.empty()){
		u=q.front();
		q.pop();
		for(int v:mp[u]){
			path.push_back(v);
			q.push(v);
			}
		}
	}

int getlca(int u,int v){
	if(dis[u]<dis[v])	swap(u,v);
	for(int i=19;i>=0;i--)
		if(dis[rmq[u][i]]>=dis[v])	u=rmq[u][i];
	if(u==v)	return u;
	for(int i=19;i>=0;i--){
		if(rmq[u][i]!=rmq[v][i]){
			u=rmq[u][i];
			v=rmq[v][i];
			}
		}
	return rmq[u][0];
	}

int main(){
	int p,u;
	scanf("%d",&n);
	for(int i=2;i<=n;i++){
		scanf("%d",&p);
		mp[p].push_back(i);
		}
	dfs(1,0);
	bfs(1);
	u=1;
	LL res=0;
	for(int v:path){
		res+=dis[u]+dis[v]-dis[getlca(u,v)]*2;
		u=v;
		}
	printf("%lld\n",res);
	return 0;
	}

Measured memory_bytes: 22872
import java.util.*;

class Main {
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int cnt =0;
      int N = sc.nextInt();
      int[] a = new int[N];
      for (int i=0 ; i<N; i++) {
          a[i] = sc.nextInt();
      }
      
      for(int i=1 ; i<N-1; i++) {
    	  if (a[i-1] < a[i] && a[i]< a[i+1]) {
    		  cnt++;
    	  }
    	  if (a[i-1] > a[i] && a[i]> a[i+1]) {
    		  cnt++;
    	  }
      }
      System.out.println(cnt);
  }
}

Measured memory_bytes: 21844
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scanf("%d %d", &a, &b)

	if a-1 > b {
		fmt.Println(a*2 - 1)
	} else if b-1 > a {
		fmt.Println(b*2 - 1)
	} else {
		fmt.Println(a + b)
	}
}


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

int main(){
  int Ainfo,Amath,Ascience,Aenglish,Binfo,Bmath,Bscience,Benglish;
  cin >> Ainfo >> Amath >> Ascience >> Aenglish;
  cin >> Binfo >> Bmath >> Bscience >> Benglish;
  int totalA=0,totalB=0;
  totalA = Ainfo + Amath + Ascience + Aenglish;
  totalB = Binfo + Bmath + Bscience + Benglish;

  if(totalA < totalB){
    cout << totalB << endl;
  }else if(totalB < totalA){
    cout << totalA << endl;
  }else if(totalA == totalB){
    cout << totalA << endl;
  }
  
  return 0;
}

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

int main(){
  int a, b;
  cin >> a>>b;
  int ans=0;
  if(a>b) cout << 2*a-1 << endl;
  if(a<b) cout << 2*b-1 << endl;
  if(a==b) cout << 2*a << endl;

  return 0;
}

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

int main() {
    long n, q;
    cin >> n >> q;
    long c = (n - 2) * (n - 2);
    map<int, int> a, b;
    a[n-1] = n - 1;
    b[n-1] = n - 1;
    for (int i = 0; i < q; i++) {
        int x, y;
        cin >> x >> y;
        y--;
        if (x == 1) {
            auto p = b.lower_bound(y);
            c -= p->second - 1;
            auto q = a.find(p->second);
            if (q == a.end()) {
                a[p->second] = y;
            } else {
                q->second = min(q->second, y);
            }
        } else {
            auto p = a.lower_bound(y);
            c -= p->second - 1;
            auto q = b.find(p->second);
            if (q == b.end()) {
                b[p->second] = y;
            } else {
                q->second = min(q->second, y);
            }
        }
    }
    cout << c << endl;
}


Measured memory_bytes: 8308
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const S = input[0][0];
  const T = input[1][0];

  let answer = 0;

  for (let i = 0; i < S.length; i++) {
    if (S[i] !== T[i]) {
      answer += 1;
    }
  }

  return answer;
};

console.log(main(read()));


Measured memory_bytes: 32912
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        // a: HP
        a: i32,
        // b: ATK
        b: i32,

        c: i32,
        d: i32,
    };

    let mut a = a;
    let mut c = c;

    while a > 0 || c > 0 {
        c -= b;
        if c <= 0 {
            println!("Yes");
            return;
        }
        a -= d;
        if a <= 0 {
            println!("No");
            return;
        }
    }
}


Measured memory_bytes: 2128
let readIntArray () =
    stdin.ReadLine().Split(" ") |> Array.map int

stdin.ReadLine()

readIntArray ()
|> fun a ->
    let n = a |> Array.length
    [ for x in 1 .. (n - 1) do
        for y in (x + 1) .. n -> a.[x - 1] * a.[y - 1] ]
    |> List.sum
    |> printfn "%d"


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int inf = 1<<30;
constexpr int mod = 1e9+7;
constexpr ll infl = 1ll<<60;

constexpr int nr = 800;
vector<pair<int,int>> mo[nr];
vector<pair<int,int>> query(500050);
vector<int> ret(500050);
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n,q;
    cin>>n>>q;
    vector<int> c(n);
    for(int i=0;i<n;++i) cin>>c[i];
    for(int i=0;i<q;++i){
        cin>>query[i].first >> query[i].second;
        query[i].first--;
        mo[query[i].first/nr].push_back({query[i].second,i});
    }
    int x;
    array<int,500050> num{};
    for(int i=0;i<nr;++i){
        sort(mo[i].begin(),mo[i].end());
        fill(num.begin(),num.end(),0);
        int curl,curr;
        curl = curr = 0;
        int count =0 ;
        for(auto && a : mo[i]){
            x = a.second;
            while(curr <query[x].second){
                if(num[c[curr]] == 0 ){
                    count++;
                }
                num[c[curr]]++;
                curr++;
            }
            while(curl < query[x].first){
                num[c[curl]]--;
                if(num[c[curl]] == 0)count--;
                curl++;
            }
            while(curl > query[x].first){
                curl--;
                num[c[curl]]++;
                if(num[c[curl]] == 1)count++;
            }
            ret[x] = count;
        }
    }
    for(int i=0;i<q;++i)cout << ret[i] << endl;
    return 0;
}

Measured memory_bytes: 19820
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=1e6+10;
int ln[maxn],tot,kl,v1,v2,m,x,y,n;
struct asuka{int pos,val;}q[maxn];
void add(int pos,int val){q[++tot].pos=pos,q[tot].val=val;}
bool cmp(asuka a,asuka b){return a.pos<b.pos;}
vector<int>s,t;
signed main() 
{
    cin>>n;
    n++;
    int p=101;
    while(n>1) 
    {
        if(n&1)t.push_back(--p),n--;
        else s.push_back(--p),n>>=1;
    }
    int m=s.size()+t.size();
    printf("%lld\n",m<<1);
    for(int i=0;i<(int)t.size();i++)
        printf("%lld ",t[i]);
    for(int i=s.size()-1;~i;i--)
        printf("%lld ",s[i]);
    for(int i=100-m+1;i<=100;i++)
        printf("%lld ",i);
    return 0;
}
/*
做一次二进制分解，然后一组一组摆过去。
对于第i位，重复搞个1到i摆在一起，再单独开两个值摆一起。
这可能一下就炸了
……
答案非常优雅
在右边搞个排列，那么左边上升子序列的数量就是答案。
从小到大放，如果放左边，答案+1，放右边，答案翻倍再+1。
啊 丑陋 丑陋的性质
假装空串也合法就不会这么丑陋了
放左边，答案+1，右边，答案翻倍
直接构造就行



*/

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

int main(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    if (k <= a) ans = k;
    else if (k <= a + b) ans = a;
    else ans = a - (k - (a + b));
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<ll> v1;
typedef vector<v1> v2;
typedef vector<v2> v3;

typedef unordered_map<ll, unordered_map<ll, ll>> graph;

const ll INF = 1ll << 50;
const ll mod = 1000000007;

ll n;
v1 b;
v1 a;

int main(){
    cin >> n;
    b = v1(n+1);
    a = v1(n+1);
    for(ll i = 1;i < n;i++){
        cin >> b[i];
    }
    b[0] = 1000000;
    b[n] = 1000000;
    for(ll i = 0;i < n;i++){
        a[i] = min(b[i], b[i+1]);
    }
    cout << accumulate(a.begin(),a.end(),0ll) << endl;
}


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

const int N = 60;

int n;
char s[N];
int cnt[N], _cnt[N];

int main(){
	memset(_cnt, 0x7f, sizeof(_cnt));
	scanf("%d", &n);
	for (int i = 0; i < n; ++ i){
		memset(cnt, 0, sizeof(cnt));
		scanf("%s", s);
		int len = strlen(s);
		for (int j = 0; j < len; ++ j){
			++ cnt[s[j] - 'a'];
		}
		for (int j = 0; j < N; ++ j){
			_cnt[j] = std::min(_cnt[j], cnt[j]);
		}
	}
	for (int i = 0; i < N; ++ i){
		for (int j = 0; j < _cnt[i]; ++ j){
			putchar('a' + i);
		}
	}
	return printf("\n"), 0;
}

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

int main(){
  ll count = 0;
  int n; cin >> n;
  map<string,int> m;
  rep(i,n){
    string s; cin >> s;
    if(m[s] == 0){
      count++;
      m[s] = 1;
    }
  }

  cout << count << endl;
}



Measured memory_bytes: 19120
import java.util.Scanner;

class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        if (n > 999) {
            System.out.println("ABD");
        } else {
            System.out.println("ABC");
        }
    }
}

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

int main(){
  double a, b, x, y;
  cin >> a >> b >> x;
  if(a*a*b/2 < x){
    cout << setprecision(15) << atan2(2*b - 2*x/(a*a), a)*180/M_PI << endl;
  }else{
    y = 2*x/(a*b);
    cout << setprecision(15) << atan2(b,y)*180/M_PI << endl;
  }
  return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#define N 10000
#define M 10000

int main(void){
  int i;
  int l,w,ws[N][2];
  int current[M];
  char hoge;
  int swp;

  scanf("%d%d",&l,&w);
  for(i=0;i<w;i++){
    scanf("%d%c%d",&ws[i][0],&hoge,&ws[i][1]);
  }
  for(i=0;i<l;i++){
    current[i]=i+1;
  }
  for(i=0;i<w;i++){
    swp=current[ws[i][0]-1];
    current[ws[i][0]-1]=current[ws[i][1]-1];
    current[ws[i][1]-1]=swp;
  }
  for(i=0;i<l;i++){
    printf("%d\n",current[i]);
  }
  return 0;
}

Measured memory_bytes: 0
fn main() {
  let vec: Vec<isize> = read_vec();
  
  let ans = if vec[0]==vec[1] {vec[2]} else if vec[0]==vec[2] {vec[1]} else {vec[0]};
  
  println!("{}", ans);
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf.trim().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
}

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

int main(){
    int n;

    while(cin >> n, n != 0){
        if(n == 1){
            cout << "deficient number" << endl;
            continue;
        }
        int sum = 1;
        for(int i=2; i*i<=n; i++){
            if(n%i == 0) {
                if(n/i != i){
                    sum += (i + n/i);
                }else{
                    sum += i;
                }
            }
        }
        if(sum < n) cout << "deficient number" << endl;
        if(sum == n) cout << "perfect number" << endl;
        if(sum > n) cout << "abundant number" << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=1e9+7;
int main(){

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

ll a[n];
for(int i=0;i<n;i++)cin>>a[i];
ll dp[n];
dp[0]=0;
for(ll i=1;i<n;i++)
{
	dp[i]=inf;
	for(ll j=max(0LL,i-k);j<i;j++)
	{
		dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
	}
}
cout<<dp[n-1];
return 0;



}

Measured memory_bytes: 1792
/*
    Mbak Rose Dong
*/
#include<bits/stdc++.h>
using namespace std;
char arr[2020][2020];
int le[2020][2020], ri[2020][2020], up[2020][2020], down[2020][2020];
int main()
{
	int n,i,j,k,x,y,ans,m,curr;
    int r,c;
    scanf("%d %d",&r,&c);
    getchar();
    for(i=0;i<r;i++)
    {
        for(j=0;j<c;j++)
        {
            scanf("%c",&arr[i+1][j+1]);
        }
        getchar();
    }
    for(i=1;i<=r;i++)
    {
        for(j=1;j<=c;j++)
        {
            if(arr[i][j] == '#')
                up[i][j] = 0;
            else
            {
                up[i][j] = up[i-1][j] + 1;
            }
        }
    }
    for(i=r;i>0;i--)
    {
        for(j=1;j<=c;j++)
        {
            if(arr[i][j] == '#')
                down[i][j] = 0;
            else
            {
                down[i][j] = down[i+1][j] + 1;
            }
        }
    }
    for(i=1;i<=r;i++)
    {
        for(j=1;j<=c;j++)
        {
            if(arr[i][j] == '#')
                le[i][j] = 0;
            else
            {
                le[i][j] = le[i][j-1] + 1;
            }
        }
    }
    for(i=1;i<=r;i++)
    {
        for(j=c;j>0;j--)
        {
            if(arr[i][j] == '#')
                ri[i][j] = 0;
            else
            {
                ri[i][j] = ri[i][j+1] + 1;
            }
        }
    }
    int rose = 0;
    for(i=1;i<=r;i++)
    {
        for(j=1;j<=c;j++)
        {
            if(arr[i][j] == '.')
            {
                curr = le[i][j] + ri[i][j] + up[i][j] + down[i][j] - 3;
                rose = max(rose, curr);
            }
        }
    }
    cout << rose << endl;
    return 0;
}


Measured memory_bytes: 67968
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,s=0;
	scanf("%d",&n);
	long long int a[n];
	for(int i=0;i<n;++i){
		int t;
		scanf("%d",&t);
		if(i!=0&&t==a[s-1]){
			continue;
		}
		else {
			a[s]=(long long )t;
			++s;
		}
	}
	int res=1;
	for(int i=1;i<s-1;){

		if(a[i]-a[i-1] < 0 && a[i+1]-a[i]>0 || a[i]-a[i-1] > 0 && a[i+1]-a[i] < 0){
			++res;
			i+=2;
 
		}
		else ++i;
 
	}
	printf("%d",res);
	return 0;
}

Measured memory_bytes: 1024
A = int(input())
B = int(input())
C = int(input())
X = int(input())
a = 0
b = 0
c = 0
count = 0

while a < A+1:
	b = 0
	while b < B+1:
		c = 0
		while c < C+1:
			if 500 * a + 100 * b + 50 * c == X:
				count += 1
			c += 1
		b += 1
	a += 1
print(count)

Measured memory_bytes: 3064
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,z;
    char ca,cb,cc;
    cin>>n;
    sum+=n/500*1000;
    n%=500;
    sum+=n/5*5;
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3576
n = gets.to_i
count = 0
n.times do |i|
  if (i+1)%4==0 && (n-(i+1))%7==0
    count += 1
  end
end
if n%4==0 || n%7==0
  count += 1
end
puts count > 0 ? "Yes" : "No"


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

int main () {
    int N;
    cin >> N;
    vector<int> cards(N);
    int total_a = 0, total_b = 0;

    for(int i=0;i<N;i++) {
        cin >> cards[i];
    }
    sort(cards.begin(),cards.end());
    reverse(cards.begin(),cards.end());

    for(int i=0;i<N;i++) {
        if(i == 0 || i % 2 == 0) {
            total_a += cards[i];
        }
        else {
            total_b += cards[i];
        }
    }
    if(total_a > total_b) cout << total_a - total_b << endl;
    else cout << total_b - total_a << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
int H,A,times=0;
cin >> H >> A ;
for (int i=0 ; i<= 10000 ; ++i)
    {
     H-=A;
     times+=1;
     if (H<=0){
        break;
     }
    }

cout << times ;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
char str[10000];

int main()
{
	int n;
	cin >> n >> str;

	for( int i = 0; str[i] != '\0'; i++ ){
		if( str[i] + n > 'Z' )
			str[i] = 'A' + (str[i]+n-'Z'-1);
		else
			str[i] += n;
	}

	cout << str << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int ans = 0;
		for(int i = 0; i < k; i++) {
			if(s.charAt(i) == '1') {
				if(i + 1 == k) {
					ans = i;
					break;
				}
			} else {
				ans = i;
				break;
			}
		}
		System.out.println(s.charAt(ans));
	}

}


Measured memory_bytes: 21972
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
#define ll long long
#define f(i,a,b) for(int i=a;i<b;i++)
#define mod 998244353
#define mp make_pair
#define ff first
#define ss second
#define rf(i,a,b) for(int i=a;i>=b;i--)
#define sc(a) scanf("%lld",&a)
#define pf printf
#define sz(a) (ll)(a.size())
#define psf push_front
#define ppf pop_front
#define ppb pop_back
#define pb push_back
#define pq priority_queue
#define all(s) s.begin(),s.end()
 
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,wt;
    cin>>n>>wt;
    int w[n],v[n],sum=0;
    f(i,0,n)
        cin>>w[i]>>v[i],sum+=v[i];
    // cout<<sum<<"\n";
    ll dp[n+1][sum+1];
    f(i,0,n+1)
        dp[i][0]=0;
    f(i,0,sum+1)
        dp[0][i]=1e18;
    dp[0][0] = 0;
    f(i,1,n+1)
    {
        f(j,1,sum+1)
        {
            if(v[i-1]>j)
                dp[i][j]=dp[i-1][j];
            else
                dp[i][j]=min(dp[i-1][j],w[i-1]+dp[i-1][j-v[i-1]]);
        }
    }
    int ans=0;
    for(int j=sum;j>0;j--)
    {
        if(dp[n][j]<=wt)
        {
            // cout<<"Ent\n";
            ans=j;
            break;
        }
    }
    // cout<<dp[n][140]<<"\n";
    // f(i,0,n+1)
    // {
    //  f(j,0,sum+1)
    //      cout<<dp[i][j]<<' ';
    //  cout<<"\n";
    // }
    cout<<ans;
}

Measured memory_bytes: 79232
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

template<typename value_type>
class extended_euclidean
{
public:
	value_type gcd;
	value_type lcm;
	value_type x0;
	value_type y0;

public:
	extended_euclidean(value_type a, value_type b)
		: gcd(0), lcm(0), x0(0), y0(0)
	{
		tie(gcd, x0, y0) = process(a, b);
		lcm = a * b / gcd;
	}

public:
	tuple<value_type, value_type, value_type> process(value_type a, value_type b)
	{
		if (a == 0) return make_tuple(b, 0, 1);

		value_type g, x, y;
		tie(g, x, y) = process(b % a, a);

		return make_tuple(g, y - (b / a) * x, x);
	}
};

//extended_euclidean<long long> ee(a, b);
//long long gcd = ee.gcd;
//long long lcm = ee.lcm;

int three_gcd(int a, int b, int c)
{
	extended_euclidean<int> ee(a, b);
	extended_euclidean<int> ee2(ee.gcd, c);

	return ee2.gcd;
}

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

	int K;
	cin >> K;

	int result = 0;
	for (int i = 1; i <= K; i++)
	{
		for (int j = 1; j <= K; j++)
		{
			for (int q = 1; q <= K; q++)
			{
				result += three_gcd(i, j, q);
			}
		}
	}

	cout << result;

	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  lint n, a;
  scanf("%ld", &n);
  v1i v(n);
  rep(i, n) scanf("%d", &v[i]);
  v2li dp(n+1, v1li(4, -1*1e15)); dp[0][0] = 0; dp[1][0] = v[0]; dp[2][1] = v[1]; if(n > 2) dp[3][2] = v[2];
  rep(i, n-2){
    if(i % 2 == 0){
      dp[i+3][0] = dp[i+1][0] + v[i+2];
      dp[i+3][2] = max(dp[i+3][2], max(dp[i+1][2] + v[i+2], dp[i][1] + v[i+2]));
      if(i > 0) dp[i+3][2] = max(dp[i+3][2], dp[i-1][0] + v[i+2]);
    }
    else dp[i+3][1] = max(dp[i+1][1] + v[i+2], dp[i][0] + v[i+2]);
  }
  if(n % 2 == 0) a = max(dp[n][1], dp[n-1][0]);
  else a = max(dp[n][2], max(dp[n-1][1], dp[n-2][0]));
  printf("%ld\n", a);
  return 0;
}

Measured memory_bytes: 18008
#include<iostream>
#include<vector>
#include<string>
#include<map>

int main(){
    int n;
    std::cin >> n;
    std::map<int, bool> mp;
    for(int i = 0; i < n; i++){
        int a;
        std::cin >> a;
        if(mp[a]){
            mp[a] = false;
        }else{
            mp[a] = true;
        }
    }

    int cnt = 0;
    for(auto m : mp){
        cnt += m.second;
    }

    std::cout << cnt << std::endl;
    return 0;
}


Measured memory_bytes: 4992
fun main(args: Array<String>) {
  val (X, N) = readInts()
  val PN = if (N == 0) emptyList() else readInts()
  val dp = Array(102) { false }
  PN.forEach { dp[it] = true }
  var l = X
  var r = X
  while (true) {
    if (!dp[l]) break
    l--
  }
  while (true) {
    if (!dp[r]) break
    r++
  }
  if (Math.abs(X - r) < Math.abs(X - l)) {
    println(r)
  } else {
    println(l)
  }
}

fun myBinarySearch(begin: Int, end: Int, isOk: (key: Int) -> Boolean): Int {
  var ng = begin
  var ok = end

  while (Math.abs(ok - ng) > 1) {
    val mid = (ok + ng) / 2
    if (isOk(mid)) {
      ok = mid
    } else {
      ng = mid
    }
  }

  return ok
}

fun <T> List<T>.myBinarySearch(isOk: (T) -> Boolean): Int {
  return myBinarySearch(-1, size) { index -> isOk(get(index)) }
}

fun <T> Array<T>.myBinarySearch(isOk: (T) -> Boolean): Int {
  return myBinarySearch(-1, size) { index -> isOk(get(index)) }
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


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

long long lcm(long long x, long long y){
    if(x<y) swap(x,y);
    long long r = x%y , xy = x*y;
    while(r!=0){
        x = y;
        y = r;
        r = x%y;
    }
    return xy / y;
}

int main() {
    long long a, b, c, d, aa, lcm_cd, ans;
    cin >> a >> b >> c >> d;
    aa = a - 1ll;
    lcm_cd = lcm(c, d);
    ans = b - b/c - b/d + b/lcm_cd - (aa - (aa/c) - (aa/d) + aa/lcm_cd);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio> 
using namespace std;
int n,k,a[100005],ans=0x7fffffff;
inline int min(int x,int y){
    return x<y?x:y;
}
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n-k+1;i++){
		int l=i,r=i+k-1;
		if(r<=n){
    		if(a[l]<=0&&a[r]<=0) ans=min(ans,-a[l]);
    		else if(a[l]<=0&&a[r]>=0) ans=min(ans,min(-2*a[l]+a[r],-a[l]+2*a[r]));
            else ans=min(ans,a[r]);
        }
	}
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a=0;//d
    int b=0;//d
    int c=0;//d
    int p=0;//d
    int q=0;//d
    int r=0;//d
    scanf("%d%d%d",&a,&b,&c);
    p=a+b;
    q=b+c;
    r=c+a;
    if(p<q&&p<r)
    printf("%d",p);
    else if(q<p&&q<r)
    printf("%d",q);
    else if(r<p&&r<q)
    printf("%d",r);
    else if(r==p&&r==q)
    printf("%d",r);
    else if(a==c)
    {
    if(r<q)
    printf("%d",r);
    else if(r>q)
    printf("%d",q);
    else if(a==c&&b==0)
    printf("%d",c);
    }
    else if(a==b)
    {
    if(p<q)
    printf("%d",p);
    else if(p>q)
    printf("%d",q);
    }
    else if(a==b&&c==0)
    {
    printf("%d",b);
    }
    else if(b==c)
    {
    if(q<p)
    printf("%d",q);
    else if(q>p)
    printf("%d",p);
    }
    else if(b==c&&a==0)
    {
    printf("%d",b);
    }
    return 0;
}

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

typedef long long ll;

int main(){
  string S;
  ll K;
  cin >> S >> K;
  ll ans = 0;
  int end1 = 0;
  int end2 = 0;
  
  for(int i = S.size()-1; S.at(i) == S.at(S.size()-1); i--){
    end1++;
    if(i == 0) break;
  }
  
  for(int j = 0; S.at(j) == S.at(0); j++){
    end2++;
    if(j == S.size()-1) break;
  }
  
  for(int i = 0; i < S.size()-1; i++){
    if(S.at(i) == S.at(i+1)){
      S.at(i+1) = '?';
    }
  }
    
  for(int i = 0; i < S.size(); i++){
    if(S.at(i) == '?') ans++;
  }
  
  if(end1 == S.size() && end1 % 2 == 1){
    cout << S.size()*K/2 << endl;
  }
  else if(S.at(0) == S.at(S.size()-1) && (end1 + end2) % 2 == 0){
    cout << ans*K + (K-1) << endl;
  }
  else cout << ans*K << endl;
}

Measured memory_bytes: 256
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
s = list(input())
ans = 0
for i in range(1,n):
    be = set(s[:i])
    en = set(s[i:])
    ans = max(ans,len(be&en))

print(ans)

Measured memory_bytes: 3188
N = int(input())
D = [[int(d) for d in input().split()] for _ in range(N)]

ans = "No"
for i in range(N-2):
    if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
        ans = "Yes"
        break
print(ans)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
int main(){
	int k; cin >> k;

	queue<long long> q;
	for(int i=1; i<=9; ++i) q.push(i);
	for(int i=0; i<k-1; ++i){
		long long x=q.front();
		q.pop();

		if(x%10!=0) q.push(10*x+x%10-1);
		q.push(10*x+x%10);
		if(x%10!=9) q.push(10*x+x%10+1);
	}

	cout << q.front() << endl;
}

Measured memory_bytes: 1792
import java.util.*;

import java.io.*;
 
public class Main{

    public static int stringToInt(char i, int[] a){
        if(i == 'A') return a[0];
        if(i == 'B') return a[1];
        if(i == 'C') return a[2];
        return 0;
    }
 
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int[] A = new int[N];
        for(int i = 0; i < N; i++){
            A[i] = s.nextInt();
        }

        HashMap<Integer, Boolean> map = new HashMap<Integer, Boolean>();
        boolean result = false;
        for(int i = 0; i < N; i++){
            if(map.get(A[i]) == null){
                 map.put(A[i], true);
            }else{
                result = true;
                break;
            }

        }
        if(result){
            System.out.println("NO");
        }else{
            System.out.println("YES");
        }
        
        
	}
} 

Measured memory_bytes: 76020
# -*- coding: utf-8 -*-
 
N = int(input())
C = input()

ans = 0
i = -1
j = N
while( True ):
  
  i += 1
  while( i<j ):
    if( C[i] == 'W' ):
      break
    else:
      i += 1
  
  j -= 1
  while( j>i ):
    if( C[j] == 'R' ):
      break
    else:
      j -= 1
  
  if ( i<j ):
    ans += 1
  else:
    break

print(ans)

Measured memory_bytes: 9460
"""

https://atcoder.jp/contests/agc037/tasks/agc037_e

辞書順最小の文字をAとする
できるだけAが先頭にたくさん並ぶようにしたい

XAYのとき
XAYYAX　となる。これが最後の場合はAを先頭にして取るのがよい
そうでなければ一番後ろがAになるようにとるのが正解？

3なら
YYA → YYAAYY
YAA → YAAAAY
AAA → …

と、Kが5000回以上あるなら絶対全部Aにできる
実際は、Aの長さは倍倍に増えていくのでlog5000回ぐらいで全部Aにできる

Aとして選ぶべき場所は、最長ならそれ
最長が複数ある場合、それ以降の並びが辞書順最小のモノを選ぶべき

実装が面倒くさい系だな…

"""

import sys
N,K = map(int,input().split())
S   = input()

if K == 1:

    u = S + S[::-1]
    #print (u)
    lis = []
    for i in range(N+1):
        lis.append(u[i:i+N])
    lis.sort()
    print (lis[0])
    sys.exit()

else:

    u = S + S[::-1]
    #print (u)
    lis = []
    for i in range(N+1):
        lis.append(u[i:i+N])
    lis.sort()

    SR = lis[0]
    S  = lis[0][::-1]

    LL = 0
    for i in range(1,N):
        if SR[i] != SR[i-1]:
            LL = i
            break
    else:
        LL = N

    for i in range(2,K+1):

        u = S + S[::-1]
        
        SR = u[N-LL:2*N-LL]
        S  = SR[::-1]
        LL *= 2

        if LL >= N:
            break

    print (SR)


Measured memory_bytes: 82320
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
#define PI acos(-1)
typedef long long ll;
using namespace std;
int n, *h, *mem, k;
int jump(int i = 0)
{
    if(mem[i] != INT_MAX)
        return mem[i];
    for(int j = 1; j <= k && i + j < n; j++)
        mem[i] = min(mem[i], jump(i + j) + abs(h[i] - h[i + j]));
    return mem[i];
}
int main()
{
    //cin.tie(NULL); cout.tie(NULL);  ios_base::sync_with_stdio(false);
    #ifndef ONLINE_JUDGE
        //freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #endif
    scanf("%d %d", &n, &k);
    h = new int[n];
    mem = new int[n];
    for(int i = 0; i < n; i++)
    {
        scanf("%d", h + i);
        mem[i] = INT_MAX;
    }
    mem[n - 1] = 0;
    printf("%d", jump());
}


Measured memory_bytes: 5760
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    city = list(map(int, sys.stdin.readline().split()))
    brave = list(map(int, sys.stdin.readline().split()))

    init = sum(city)
    for n in range(N):
        bef = city[n]
        city[n] -= min(city[n], brave[n])
        city[n+1] -= min(city[n+1], brave[n]-min(bef, brave[n]))

    print(init-sum(city))


if __name__ == '__main__':
    main()


Measured memory_bytes: 19228
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF (1LL<<61 + 1<<29)
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
void _INPUT_IMPL_() {};
template <class T, class... Args> void _INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; _INPUT_IMPL_(args...); }
#define cint(...) ll __VA_ARGS__; _INPUT_IMPL_(__VA_ARGS__);

int main() {
	string s;
	cin >> s;
	YesNo(s[1]==s[2]&&(s[0]==s[1]||s[2]==s[3]));
}

Measured memory_bytes: 256
/*  Success may not come to me immediately,
 *  but it will come definitely....
 */
#include <bits/stdc++.h>
//=====================================================================
using namespace std;
//=====================================================================
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//=====================================================================
#define li      int64_t
#define ld      double_t
#define ulli    uint64_t
//=====================================================================
#define rep(i,a,b)  for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define repi(i,v)   for(i=v.begin();i!=v.end();i++)
#define repir(i,v)  for(i=v.rbegin();i!=v.rend();i++)
#define elif        else if
#define mset(a,b)   memset(a,b,sizeof(a))
#define nl          cout<<'\n'
//=====================================================================
typedef vector<li>       vli;
typedef vector<string>   vstr;
typedef pair<li,li>      pli;
typedef pair<li,pli >    ppli;
typedef pair<li,ppli >   pppli;
typedef vector<pli >     vpli;
typedef vector<ppli >    vppli;
typedef vector<pppli >   vpppli;
//=====================================================================
#define pb  push_back
#define pob pop_back
#define pf  push_front
#define pof pop_front
#define all(v)  v.begin(),v.end()
#define itr iterator
#define rtr reverse_iterator
#define sz  size()
#define lb  lower_bound
#define ub  upper_bound
#define bs  binary_search
#define mp  make_pair
#define F   first
#define S   second
//=====================================================================
#define mod (li)(1e9+7)
#define inf (li)(1e18)
#define MX1 (li)(1e5+5)
#define MX2 (li)(1e6+5)
#define pi  acos(-1)
//=====================================================================
li power(li a,li b){li ans=1;while(b){if(b&1){ans=(ans*a)%mod;}
a=(a*a)%mod;b>>=1;}return ans;}
//=====================================================================
li mmi(li n){return power(n,mod-2);}
//=====================================================================
li two(li n){return (1LL<<n);}
//=====================================================================
void onbit(li &n,li x){n|=two(x);}
//=====================================================================
void offbit(li &n,li x){n&=~two(x);}
//=====================================================================
li cntbit(li n){li res=0;while(n and ++res)n-=n&-n;return res;}
//=====================================================================
li dx[]={-2,-2,+1,-1};li dy[]={+1,-1,-2,-2};
//=====================================================================
/*------------------------MAIN CODE BEGINS NOW!------------------------*/

li n,m,k;

void solve(){
  li i,j;cin>>n>>m>>k;
  li ans;
  rep(i,0,n+1){
    rep(j,0,m+1){
      ans=m*i+n*j;
      ans-=2*i*j;
      if(ans==k){
        cout<<"Yes";
        return ;
      }
    }
  }
  cout<<"No";
}

int main(){
  opt
  #ifndef ONLINE_JUDGE
  #endif
  li t=1;
  //cin>>t;
  while(t--){
    solve();
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <iomanip>
#include <ios>
#include <vector>
using namespace std;
int main(void){
  string s;
  cin >> s;
  
  int n = s.length();
  
  vector<int>child(n,0);
  int numR = 0;
  int numL = 0;
  int lastR = 0;
  int firstL = 0;
  for(int i=0;i<n;i++){
    if(s[i] == 'R'){
      numR++;
      lastR = i;
    }
    if(s[i] == 'L'){
      numL++;
    }
    if(s[i] == 'R' && s[i + 1] == 'L'){
        firstL = i + 1;
    }
    if((s[i] == 'L' && s[i + 1] == 'R') || i == n - 1){
      if((numR + numL) % 2 == 0){
        child[firstL] = (numR + numL) / 2;
        child[lastR] = (numR + numL) / 2;
        numL = 0;
        numR = 0;
      }
      else{
          if(numR < numL){
              if(numR % 2 != 0){
                child[lastR] = (numR + numL) / 2 + 1;
                child[firstL] = (numR + numL) / 2;
                numL = 0;
                numR = 0;
              }
              else{
                child[lastR] = (numR + numL) / 2;
                child[firstL] = (numR + numL) / 2 + 1;
                numL = 0;
                numR = 0;
              }
          }
          else{
              if(numL % 2 != 0){
                child[lastR] = (numR + numL) / 2;
                child[firstL] = (numR + numL) / 2 + 1;
                numL = 0;
                numR = 0;
              }
              else{
                child[lastR] = (numR + numL) / 2 + 1;
                child[firstL] = (numR + numL) / 2;
                numL = 0;
                numR = 0;
              }
          }
      }
    }
  }

    for(int i=0;i<n;i++){
      cout << child[i] << " ";
    }
    cout << endl;
    
    
    return 0;
  }

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

int main() {
  int N;
  cin >> N;
  if (N >= 1 && N <10) {
  cout << N <<endl;
  }  
  if (N >= 10 && N <100) {
  cout << 9 <<endl;
  }  
  if (N >= 100 && N <1000) {
  cout << N - 90 <<endl;
  }  
  if (N >= 1000 && N <10000) {
  cout << 909 <<endl;
  }  
  if (N >= 10000 && N <100000) {
  cout << N - 9090 <<endl;
  }  
  if (N == 100000) {
  cout << 90909 <<endl;
  }  
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int x, y; cin >> x >> y;
    string ans = "No";

    for (int i = 0, j = x; i <= x; ++i, --j) {
        if (i * 2 + j * 4 == y) {
            ans = "Yes";
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3600
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		gr = new int[N];
		dfs(0,-1);
		Console.WriteLine(gr[0] == 0 ? "Bob" : "Alice" );
		
		
	}
	
	int[] gr;
	void dfs(int now, int pre){
		if(E[now].Count == 0){
			gr[now] = 0;
			return;
		}
		int g = 0;
		foreach(var nxt in E[now]){
			if(nxt == pre) continue;
			dfs(nxt,now);
			g ^= (gr[nxt] + 1);
		}
		gr[now] = g;
		return;
	}
	
	
	int N;
	List<int>[] E;
	public Sol(){
		N = ri();
		E = new List<int>[N];
		for(int i=0;i<N;i++) E[i] = new List<int>();
		
		for(int i=0;i<N-1;i++){
			var d = ria();
			E[d[0] - 1].Add(d[1] - 1);
			E[d[1] - 1].Add(d[0] - 1);
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 38024