akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = k; i < (int)(n); i++)
#define repd(i, n) for (int i = n-1; i >= 0; i--)
#define rrepd(i, k, n) for (int i = n-1; i >= (int)(k); i--)
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
//V,Pは大文字i,l,bは小文字
using ll = long long;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vl = vector<ll>;
using VVl = vector<Vl>;
using Vb = vector<bool>;
using VVb = vector<Vb>;
using P = pair<int,int>;
using Pll = pair<ll, ll>;
const ll mod = 1000000007;
const ll inf = 1000000000000;//10の12乗
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
};
vector<ll> fac(3000001); //n!(mod M)
vector<ll> ifac(3000001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % mod;
        x = x*x % mod;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % mod;
    return tmp * fac[a] % mod;
}

int main() {
    ll s;
    cin >> s;
    int n=s/3;
    fac[0] = 1;
    ifac[0] = 1;
    mint ans=0;
    for(ll i = 0; i<3000000; i++){
        fac[i+1] = fac[i]*(i+1) % mod; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, mod-2) % mod; 
    }
    rrep(i,1,n+1){
        int x=s-i*3;
        ans+=comb(i+x-1,x);
    }
    cout << ans.x << endl;
}

Measured memory_bytes: 50084
#include <cmath>
#include <cstdio>
#include <vector>
#include <iterator>
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>
#include <stdio.h>
#include <functional>
#include <chrono>
using namespace std;

#define rep(i,s,n) for(ll i=s;i<(n);++i)
using ll = long long;
using pll = pair<ll, ll>;
constexpr ll INF = (1LL << 60);
constexpr ll MAX_INF = 9223372036854775807;
constexpr ll MOD = (1e9 + 7);
//constexpr ll MOD = (998244353);

using vl = vector<ll>;
using vvl = vector<vector<ll>>;

template<class T>
vector<vector<T>> vvt(T init, ll m, ll n) {
	vector<vector<T>> ans = vector<vector<T>>(m, vector<T>(n, init));
	return move(ans);
}

template<class T>
vector<T> vt(T init, ll n) {
	vector<T> ans = vector<T>(n, init);
	return move(ans);
}

template<class T>
T maxVec(vector<T>& v) {
	T ans = -INF;
	rep(i, 0, v.size()) {
		ans = max(ans, v[i]);
	}
	return ans;
}

// 素数判定
bool judge(ll n) {
	for (ll i = 2; i * i <= n; i++) if (n %= i)return false;
	return true;
}


template <class C>
void print(const C & c, std::ostream & os = std::cout)
{
	std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, ", "));
	os << std::endl;
}
/*
ll count(ll n,ll r) {
	ll ans = 0,check = 1;
	rep(i,0, r) {
		if ((n & check) > 0) {
			ans++;
		}
		check = check << 1;
	}
	return ans;
}
*/
bool sortreverse(ll a, ll b) {
	return a > b;
}

ll kiriage(ll a, ll b) {
	if (a % b == 0)return a / b;
	return a / b + 1;
}

ll n, m, x, y, t, q, s,k,h,w;

bool topologicalSort(vector<vector<long long>>& graph, vector<long long>& ans) {
	vector<unordered_set<long long>> inGraph(graph.size());
	vector<long long> node,check(graph.size(),0);
	rep(i, 0, graph.size()) {
		rep(j, 0, graph.at(i).size()) {
			inGraph.at(graph.at(i).at(j)).insert(i);
		}
	}
	rep(i, 0, graph.size()) {
		if (inGraph.at(i).size() == 0)node.push_back(i);
	}
	while (! node.empty()) {
		long long v = node.back();
		node.pop_back();
		ans.push_back(v);
		rep(i, 0, graph.at(v).size()) {
			inGraph.at(graph.at(v).at(i)).erase(v);
			if (inGraph.at(graph.at(v).at(i)).size() == 0) {
				node.push_back(graph.at(v).at(i));
			}
		}
		check.at(v) = 1;
	}
	for (long long v : check) {
		if (v == 0)return false;
	}
	return true;
}

int main() {
	cin >> n >> m;
	vvl graph(n);
	rep(i, 0, n + m - 1) {
		cin >> x >> y;
		graph.at(x - 1).push_back(y - 1);
	}
	vl result;
	topologicalSort(graph, result);
	vl num(n);
	rep(i, 0, n) {
		num[result[i]] = i;
	}

	vvl in(n);
	rep(i, 0, n) {
		for (ll v : graph[i]) {
			in[v].push_back(i);
		}
	}

	rep(i, 0, n) {
		ll oya = -1, c = -1;
		rep(j, 0, in[i].size()) {
			if (c < num[in[i][j]]) {
				oya = in[i][j];
				c = num[in[i][j]];
			}
		}
		printf("%lld\n", oya + 1);
	}
}

Measured memory_bytes: 19324
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n; cin >> n;
	string s; cin >> s;
	vector<ll> v;
	
	ll ans = 0;
	zep(i, 0, n){
		if(s[i] == 'R'){
			ll cntg = 0;
			ll cntb = 0;
			ll hosei = 0;
			zep(j, 0, i){
				if(s[j] == 'G'){
					cntg++;
					if(2*j-i < n && s[2*j-i] == 'B'){hosei++;}
				}
				if(s[j] == 'B'){
					cntb++;
					if(2*j-i < n && s[2*j-i] == 'G'){hosei++;}
				}
			}
			
			zep(j, i+1, n){
				if(s[j] == 'G'){
					ans += cntb;
				}
				if(s[j] == 'B'){
					ans += cntg;
				}
			}
			ans -= hosei;
		}
		
		if(s[i] == 'G'){
			ll cntr = 0;
			ll cntb = 0;
			ll hosei = 0;
			zep(j, 0, i){
				if(s[j] == 'R'){
					cntr++;
					if(2*j-i < n && s[2*j-i] == 'B'){hosei++;}
				}
				if(s[j] == 'B'){
					cntb++;
					if(2*j-i < n && s[2*j-i] == 'R'){hosei++;}
				}
			}
			
			zep(j, i+1, n){
				if(s[j] == 'R'){
					ans += cntb;
				}
				if(s[j] == 'B'){
					ans += cntr;
				}
			}
			ans -= hosei;
		}
		
		if(s[i] == 'B'){
			ll cntg = 0;
			ll cntr = 0;
			ll hosei = 0;
			zep(j, 0, i){
				if(s[j] == 'G'){
					cntg++;
					if(2*j-i < n && s[2*j-i] == 'R'){hosei++;}
				}
				if(s[j] == 'R'){
					cntr++;
					if(2*j-i < n && s[2*j-i] == 'G'){hosei++;}
				}
			}
			
			zep(j, i+1, n){
				if(s[j] == 'G'){
					ans += cntr;
				}
				if(s[j] == 'R'){
					ans += cntg;
				}
			}
			ans -= hosei;
		}
	}
	print(ans)
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

struct UnionFind{
  vector<int> v;
  vector<bool> f; 
  UnionFind(int n) : v(n, -1),f(n,false) {}
  void init(){ for(int i = 0;i < v.size();i++)v[i]=-1; }
  int find(int x) { return v[x] < 0 ? x : find(v[x]); }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (-v[x] < -v[y]) swap(x, y);
    v[x] += v[y]; v[y] = x;
    f[x]=(f[x]|f[y]);
    return true;
  }
  bool root(int x) { return v[x] < 0; }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -v[find(x)]; }
  bool is_base(int x){ return f[find(x)]; }
};

struct edge{
  int u,v,cost;
};
bool operator<(const edge& a,const edge& b){
  return a.cost > b.cost;
}

int main(){
  int hoge=1;
  while(1){
    int n,t,k;
    cin>>n>>t>>k;
    if(n==0)break;
    UnionFind uf(n);
    vector<edge> es; 
    int res=0;
    rep(i,n-1){
      int a,b,c;
      cin>>a>>b>>c;
      a--;b--;
      res+=c;
      es.push_back((edge){a,b,c});
    }
    sort(all(es));
    rep(i,t){
      int a;
      cin>>a;
      a--;
      uf.f[a]=true;
    }
    int lim=t-k-1;
    for(int i=0,cnt=0;i<es.size()&&cnt<n-1-k;i++){
      if(uf.is_base(es[i].u)&&uf.is_base(es[i].v)){
        if(lim==0)continue;
        lim--;
      }
      uf.unite(es[i].u,es[i].v);
      res-=es[i].cost;
      cnt++;
    }
    cout<<"Case "<<hoge<<": "<<res<<endl;
    hoge++;
  }
  return 0;
}



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

void ng() {
  puts("-1");
  exit(0);
}

int main() {
  int n;
  ll tot = 0, now = 1, ans = 0;
  cin >> n;
  vector<ll> d(n + 1);
  for (int i = 0; i <= n; i++) {
    cin >> d[i];
    tot += d[i];
  }
  for (int i = 0; i <= n; i++) {
    if (now < d[i]) ng();
    ans += now;
    now -= d[i];
    tot -= d[i];
    now = min(now * 2, tot);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4360
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <chrono>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    int n;
    cin >> n;
    string s;
    cin >> s;

    string t;
    t = s.substr(0, n / 2);

    cout << (s == t + t ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
x = gets.to_i
a = 0
loop do
  a.downto(0).each do |b|
    if a**5 - b**5 == x
      puts [a, b].join(' ')
      exit 0
    elsif a**5 + b**5 == x
      puts [a, -b].join(' ')
      exit 0
    end
  end
  a += 1
end

Measured memory_bytes: 14316
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define repbit(bit, n)  for(int bit = 0; (bit) < (1 << (n)); ++(bit))
#define ifbit(bit, i)   if((bit) & (1 << (i)))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

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

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n; cin >> n;
    reps(i, 9){
        reps(j, 9){
            if(n == i * j){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 505;
int s[maxn][maxn];
int cur[maxn][maxn];
int dx[] = { -1,1,0,0 };
int dy[] = { 0,0,1,-1 };
void dfs(int x, int y)
{
	int z = s[x][y] + cur[x][y];
	for (int i = 0; i < 4; i++)
	{
		int x1 = x + dx[i];
		int y1 = y + dy[i];
		if (s[x1][y1] > z)
		{
			s[x1][y1] = z;
			dfs(x1, y1);
		}
	}
}
int main()
{
	int n, ans = 0;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			s[i][j] = min(min(i - 1, n - i), min(j - 1, n - j));
			cur[i][j] = 1;
		}
	}
	for (int j = 1; j <= n * n; j++)
	{
		int p;
		cin >> p;
		int x = (p + n - 1) / n;
		int y = p % n;
		if (y == 0)
			y += n;
		ans += s[x][y];
		cur[x][y] = 0;
		dfs(x, y);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 20688
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N,K;

int main(){
	cin>>N>>K;
	if((N+1)/2>=K){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}



Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main {
	static String s;
	static int now;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			s = sc.next();
			now = 0;
			System.out.println(expression());
		}
	}
	static int expression() {
		int ret = term();
		while (true) {
			if (s.charAt(now) == '+') {
				now++;
				ret += term();
			} else if (s.charAt(now) == '-') {
				now++;
				ret -= term();
			} else {
				break;
			}
		}
		return ret;
	}
	static int term() {
		int ret = factor();
		while (true) {
			if (s.charAt(now) == '*') {
				now++;
				ret *= factor();
			} else if (s.charAt(now) == '/') {
				now++;
				ret /= factor();
			} else {
				break;
			}
		}
		return ret;
	}
	static int factor() {
		if (s.charAt(now) == '(') {
			now++;
			int ret = expression();
			now++;
			return ret;
		} else {
			return number();
		}
	}
	static int number() {
		int ret = 0;
		while (Character.isDigit(s.charAt(now))) {
			ret *= 10;
			ret += s.charAt(now) - '0';
			now++;
		}
		return ret;
	}
}




Measured memory_bytes: 26124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

void mainsolve(){

	ll n,k;
	cin >> n >> k;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	sort(a.begin(),a.end());

	// a[i] >= 0であるa[i]の数
	ll zerocnt = a.end()-lower_bound(a.begin(),a.end(),0);

	// a[i]*a[j] <= cなる(i,j)がk個以上ある
	auto fff = [&](ll c){

		ll cnt = 0;
		rep(i,n){
			for(ll j = i+1; j < n; j++){
				if(a[i]*a[j] <= c) cnt++;
			}
		}
		return cnt >= k;
	};	

	// a[i]*a[j] <= cなる(i,j)がk個以上ある
	auto ff = [&](ll c){

		ll cnt = 0;
		for(ll i = n-1; i >= 1; i--){
			// 右から左への順で、a[i]を固定してa[j]を走査

			if(a[i]>0){
				 rep(j,i) if(a[j] <= (double)c/a[i]) cnt++; // OK!
               //rep(j,i) if(a[i]*a[j] <= c) cnt++;
			}
			else if(a[i]==0){
				 if(c>=0) cnt += i; // OK?
             // rep(j,i) if(a[i]*a[j] <= c) cnt++;
			}
			else{
				// a[j] >= c/a[i]であるa[j]の数
				 rep(j,i) if(a[j] >= (double)c/a[i]) cnt++; // OK!
               //rep(j,i) if(a[i]*a[j] <= c) cnt++;
			}

			if(cnt >= k) return true;
			
		}
		return false;
	};

	// a[i]*a[j] <= cなる(i,j)がk個以上ある
	auto f = [&](ll c){

		ll cnt = 0;
		rep(i,n){

			if(a[i]>0){
				if(c<0 && c%a[i] != 0) cnt += upper_bound(a.begin(),a.end(),c/a[i]-1)-a.begin();
				else cnt += upper_bound(a.begin(),a.end(),c/a[i])-a.begin();
			}
			else if(a[i]==0){
				if(c>=0) cnt += n;
			} 
			else{	
				ll d = -c-1;			
				if(d<0 && d%(-a[i]) != 0) cnt += n - (upper_bound(a.begin(),a.end(),d/(-a[i])-1)-a.begin());
				else cnt += n - (upper_bound(a.begin(),a.end(),d/(-a[i]))-a.begin());
				// cnt += n - ( upper_bound(a.begin(),a.end(),(-c-1)/(-a[i]))-a.begin() );
			}

		}

		rep(i,n) if(a[i]*a[i] <= c) cnt--;
		return cnt/2 >= k;

	};

	auto bs = [&](){
		ll ng = -1e18-1;
		ll ok = 1e18+1;
		ll mid = (ng+ok)/2;

		while(abs(ng-ok) > 1){
			if(f(mid)) ok = mid;
			else ng = mid;
			mid = (ng+ok)/2;
		}
		
		return ok;
	};

	cout << bs() << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int oo = 1e9 + 7;
const int mod = 1e9 + 7, maxn = 81;
const double PI = acos(-1);


int h, w, a[maxn][maxn], b[maxn][maxn], dp[maxn][maxn][maxn*160 + 1] = {};
int main (){
    cin >> h >> w;

    for (int i=0; i<h; i++){
        for (int j=0; j<w; j++){
            cin >> a[i][j];
        }
    }

    for (int i=0; i<h; i++){
        for (int j=0; j<w; j++){
            cin >> b[i][j];
        }
    }

    dp[0][0][abs(a[0][0] - b[0][0])] = 1;

    for (int i=0; i<h; i++){
        for (int j=0; j<w; j++){
            for (int k=0; k<=(h+w)*80; k++){
                if (dp[i][j][k] == 1){
                    if (i+1 < h) dp[i+1][j][abs(k + abs(a[i+1][j] - b[i+1][j]))] = dp[i+1][j][abs(k - abs(a[i+1][j] - b[i+1][j]))] = 1;
                    if (j+1 < w) dp[i][j+1][abs(k + abs(a[i][j+1] - b[i][j+1]))] = dp[i][j+1][abs(k - abs(a[i][j+1] - b[i][j+1]))] = 1;
                }
            }
        }
    }

    for (int i=0; i<=(h+w)*80; i++){
        if (dp[h-1][w-1][i] == 1) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 328448
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,y;

	cin>>x>>y;

	if(y&1)
		cout<<"No"<<endl;
	else
	{
		y=y/2;

		int a,b;
		b=y-x;
		a=x-b;

		if(a>=0 && b>=0)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}


	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int x, y;
    string msg = "No";
    cin >> x >> y;
    if(y%2 == 0 and y/2 - x >= 0 and 2*x - y/2 >= 0)
        msg = "Yes";
    cout << msg << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define M 1000000007
#define N 1000016
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define inf 9000000000000000000
vector<ll> v[N];
ll a[N],n,d[N];

ll dp(ll ind) {

    if(ind>=n)
        return 1;

    if(d[ind]!=inf)
        return d[ind];

    ll x = a[ind];
    if(v[x][v[x].size()-1]==ind)
        return d[ind] = dp(ind+1);
    else {
        ll ind2 = lower_bound(v[x].begin(), v[x].end(), ind) - v[x].begin();
        ind2++;
        return d[ind] = (dp(ind+1)%M + dp(v[x][ind2])%M)%M;
    }
}
int main()
{
   ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
   cin>>n;
   for(ll i=0; i<n; i++)
        cin>>a[i];

   ll ind = 0;
   for(ll i=0; i<n;) {
      ll j = i;
      v[a[i]].push_back(ind);
      a[ind] = a[i];
      while(a[j]==a[i])
            j++;
      i = j;
      ind++;
   }
   n = ind;
   fill(d, d+n+10, inf);
   cout<<dp(0)<<"\n";

    return 0;
}


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

int n, a, b, c;
int l[8];
int matu[3]; // 作成される竹の長さ
int main(void) {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  int size = 1 << (n * 2);
  int maxmp = 2147483647;
  for (int i = 0; i < size; i++) {
    int a0 = 0, b0 = 0, c0 = 0;
    int mp = 0;
    fill(matu, matu + 3, 0);
    for (int j = 0; j < n; j++) {
      int t = (i >> (j * 2)) & 0x3; // パターン(全4通り)
      for (int k = 0; k < 3; k++) {
        if (t != k) {
          continue;
        }
        if (matu[k] > 0) {
          mp += 10;
        }
        matu[k] += l[j];
      }
    }
    if (matu[0] == 0 || matu[1] == 0 || matu[2] == 0) {
      continue; // A,B,Cのうち作られない竹がある場合
    }
    mp += abs(matu[0] - a);
    mp += abs(matu[1] - b);
    mp += abs(matu[2] - c);
    if (maxmp > mp) {
      maxmp = mp;
    }
  }
  cout << maxmp;
}


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

int main() {
  
  int N;
  cin >> N;
  int a = 0;
  int b = 0;
  int k = 0;
  
  for(int i=0; i<25; i++){
    for(int j=0; j<15; j++){
      if(i*4 + j*7 == N){
        k = 1;
      }
    }
  }
  
  if(k){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD


int days[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
string week[7] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
int main(){
  while(true){
    int m,d;
    cin>>m>>d;
    if(m==0 && d==0)break;
    --m;
    int day = 0;
    REP(i,m) day += days[i];
    day += d;
    day %= 7;
    cout<<week[day]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1192
import java.util.*

val MAX_N = 100000
val par = Array(MAX_N) {0}
val rank = Array(MAX_N) {0}
val size = Array(MAX_N) {0}

fun init() {
    for(i in 0 until MAX_N) {
        par[i] = i
        rank[i] = 0
        size[i] = 1
    }
}

fun find(a: Int): Int {
    if (par[a] == a){
        return a
    } else{
        par[a] = find(par[a])
        return par[a]
    }
}

fun unite(a:Int, b: Int) {
    val ta = find(a)
    val tb = find(b)
    if(ta == tb) return

    if(rank[ta] < rank[tb]){
        par[ta] = tb
        size[tb] += size[ta]
    }else{
        par[tb] = ta
        size[ta] += size[tb]
        if(rank[ta] == rank[tb]) rank[ta]++;
    }
}

fun same(a: Int, b: Int): Boolean{
    return find(a) == find(b);
}

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val m = sc.nextInt()
    val k = sc.nextInt()
    init()
    val countAB = Array(n) {0}
    repeat(m) {
        val a = sc.nextInt() - 1
        val b = sc.nextInt() - 1
        unite(a, b)
        countAB[a]++
        countAB[b]++
    }
    val countCD = Array(n) { mutableSetOf<Int>()}
    repeat(k) {
        val c = sc.nextInt() - 1
        val d = sc.nextInt() - 1
        countCD[c].add(d)
        countCD[d].add(c)
    }

    println((0 until n).map {
        val blockCount = countCD[it].count { pos -> same(it, pos) }
        (size[find(it)] - 1) - countAB[it] - blockCount
    }.joinToString(" "))
}

Measured memory_bytes: 154628
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			String s = sc.next();
			if(s.equals("-"))break;  //'-'を入力すると終了
			int m = sc.nextInt(); //シャッフル回数
			for (int i=0; i<m; i++) {
				int h = sc.nextInt(); //取り出す数を指定
				String temp = s.substring(h,s.length());
				temp += s.substring(0,h);
				s = temp;
			}
			System.out.println(s);
		}
	}
}



Measured memory_bytes: 26528
def cin; gets.split.map(&:to_i) end
def cout(*x); puts x.join(" ") end

exit if $0 != __FILE__

M = 10**9+7
n, m = cin
xs = cin
ys = cin

xx = [*(1..n)].inject(0) {
  |s, i| (s + (((2*i)%M-n-1) * xs[i-1])%M)%M}
yy = [*(1..m)].inject(0) {
  |s, i| (s + (((2*i)%M-m-1) * ys[i-1])%M)%M}

puts (xx * yy)%M

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

long long n, m = 0, w = 0, k = 1, v = 2;
long long a[200000];
const long long M = 1e9 + 7;

int main()
{
	cin >> n;

	for (int i = 0; i < n; i++)
		cin >> a[i];
	
	for (int i = 0; i < n; i++) {
		m = (m + a[i]) % M;
		w = (w + (a[i] * a[i] % M)) % M;
	}

	m = m * m % M;
	m = (m + M - w) % M;

	for (int i = 0; (1ull << i) < M; i++) {
		if ((1ull << i) & M - 2)
			k = k * v % M;

		v = v * v % M;
	}

	cout << m * k % M << endl;
}


Measured memory_bytes: 5116
package main

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

func main() {
	var n int
	nextInts(&n)
	ns := make([][]int, n)
	for i := range ns {
		ns[i] = make([]int, 2)
	}
	for i := 0; i < n; i++ {
		var a int
		nextInts(&a)
		if i-a >= 0 {
			ns[i-a][0]++
		}
		if i+a < n {
			ns[i+a][1]++
		}
	}
	var sum int
	for _, v := range ns {
		sum += v[0] * v[1]
	}
	fmt.Println(sum)
}

var sc *bufio.Scanner

func init() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
}

func nextInts(ints ...*int) {
	for i := range ints {
		sc.Scan()
		*ints[i], _ = strconv.Atoi(sc.Text())
	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 11896
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 100010
int c[N];
int main(){
	int n, m;
	cin>>n>>m;
	rep(i, m){
		int a, b;
		cin>>a>>b; a--; b--;
		c[a]++;
		c[b]++;
	}
	rep(i, n){
		if(c[i]%2){
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	return 0;
}


Measured memory_bytes: 768
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

type con struct {
	a int
	b int
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	//予備
	h := iScan()
	w := iScan()
	m := iScan()
	a := make([]int, m)
	b := make([]int, m)

	d1 := map[int]int{}
	d2 := map[int]int{}
	confirm := map[con]int{}
	for i := 0; i < m; i++ {
		a[i] = iScan()
		b[i] = iScan()
		var tmp con
		tmp.a = a[i]
		tmp.b = b[i]
		_, ok := confirm[tmp]
		v1, ok1 := d1[a[i]]
		v2, ok2 := d2[b[i]]
		if ok {
			continue
		} else {
			confirm[tmp] = 1
		}
		if ok1 {
			d1[a[i]] = v1 + 1
		} else {
			d1[a[i]] = 1
		}
		if ok2 {
			d2[b[i]] = v2 + 1
		} else {
			d2[b[i]] = 1
		}
	}
	maxA := 0
	maxB := 0

	var aitr int
	var bitr int
	aitr = 0
	bitr = 0

	ai := make([]int, 1)
	bi := make([]int, 1)
	for i := 1; i <= h; i++ {
		v, ok := d1[i]
		if ok {
			if maxA < v {
				maxA = v
				aitr = i
				ai = ai[0:1]
				ai = append(ai, aitr)
			} else if maxA == v {
				aitr = i
				ai = append(ai, aitr)
			}
		} else {
			continue
		}
	}
	for i := 1; i <= w; i++ {
		v, ok := d2[i]
		if ok {
			if maxB < v {
				maxB = v
				bitr = i
				bi = bi[0:1]
				bi = append(bi, bitr)
			} else if maxB == v {
				bitr = i
				bi = append(bi, bitr)
			}
		} else {
			continue
		}
	}
	ans := 0
	for i := 1; i < len(ai); i++ {
		for j := 1; j < len(bi); j++ {
			var tmp con
			tmp.a = ai[i]
			tmp.b = bi[j]
			_, ok := confirm[tmp]
			if ok {
				if ans < maxA+maxB-1 {
					ans = maxA + maxB - 1
				}
			} else {
				ans = maxA + maxB
				fmt.Println(ans)
				return
			}
		}
	}
	//fmt.Println(d1)
	//fmt.Println(d2)
	//fmt.Println(h, w)
	//fmt.Println(aitr, bitr)
	//fmt.Println(ai, bi)
	//fmt.Println(confirm)
	fmt.Println(ans)
}


Measured memory_bytes: 91340
#include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;
int main()
{
	ll n, q;
	constexpr ll max = 1e5 + 1;
	ll a[max] = { 0 };

	ll b, c;
	ll dp[max] = { 0 };
	ll sum = 0;

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

	cin >> q;

	for_each(a, a + n, [&sum](int n) {sum += n; });

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

	for (int i = 0; i < q; i++) {
		cin >> b >> c;
		sum += (c - b) * dp[b];

		cout << sum << "\n";

		dp[c] += dp[b];
		dp[b] = 0;
	}

	return 0;
}


Measured memory_bytes: 5172
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

int main(){
    string s;
    cin >> s;
    if(s.at(5)=='0'  && (s.at(6)=='1' || s.at(6)=='2' || s.at(6)=='3' || s.at(6)=='4')) cout << "Heisei" << endl;
    else cout << "TBD" << endl;
}

Measured memory_bytes: 256
N = int(input())

if N <= 111:
    print('111')
elif N <= 222:
    print('222')
elif N <= 333:
    print('333')
elif N <= 444:
    print('444')
elif N <= 555:
    print('555')
elif N <= 666:
    print('666')
elif N <= 777:
    print('777')
elif N <= 888:
    print('888')
elif N <= 999:
    print('999')


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class96
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            var H = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int dp = 0, count = 0;
            for(int i = 0; i < N-1; i++)
            {
                if (H[i] >= H[i + 1]) count++;
                else count = 0;
                dp = Math.Max(dp, count);
            }
            Console.WriteLine(dp);
        }
    }
}


Measured memory_bytes: 28252
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n, k;
    cin >> n >> k;
    int h[n+1] = {};
    srep(i,1,n+1)cin >> h[i];

    ll inf = 1001001001001001;
    ll dp[n+1][k+1][k+1];
    rep(i,n+1)rep(j,k+1)rep(l,k+1)dp[i][j][l] = inf;

    srep(i,1,n+1){
        if(i == 1){
            dp[i][0][0] = h[i];
            if(k > 0)dp[i][1][1] = 0;
        }else{
            rep(j,k+1){
                rep(l,k+1){
                    if(l == 0){
                        rep(m,k+1){
                            if(m <= j){
                                dp[i][j][l] = min(dp[i][j][l], dp[i-1][j][m] + max(0, h[i] - h[i-1-m]));
                            }
                        }
                        // rep(m,i)dp[i][j][l] = min(dp[i][j][l], dp[m][j][l]);
                    }else if(l <= j){
                        dp[i][j][l] = min(dp[i][j][l], dp[i-1][j-1][l-1]);
                    }
                }
            }
        }

        /* 
        cout << "i = " << i << endl;
        rep(j,k+1){
            rep(l,k+1){
                cout << dp[i][j][l] << ' ';
            }
            cout << endl;
        }
        cout << endl;
        */
    }
    

    ll ans = inf;
    rep(j,k+1)rep(l,k+1)ans = min(ans, dp[n][j][l]);
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 213248
array = [int(input()) for i in range(5)]
array2 = [] # 繰り上げの値
array3 = []#一の位

for i in array:
  array2.append(((i//10 + 1) *10) if i%10 != 0 else i//10 * 10)
  array3.append(i%10 if i%10 != 0 else 10)

print(sum(array2)-(10-min(array3)))

Measured memory_bytes: 3060
/*************************************************************************
    > File Name: test.cpp
    > Author: Akira 
    > Mail: qaq.febr2.qaq@gmail.com 
 ************************************************************************/

#include<bits/stdc++.h>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define Sqr(a) ((a)*(a))
#define ALL(a) a.begin(), a.end()
#define mp make_pair
#define pb push_back
using namespace std;

#define MaxN 100001
#define MaxM MaxN*10
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626
const int mod = 1E9+7;
const double eps = 1e-6;
#define bug cout<<88888888<<endl;
#define debug(x) cout << #x" = " << x << endl;
template<typename T> T abs(T val){return val>0?val:-val;}
inline int max2(int a, int b) {return ((a > b)? a : b);}
inline int min2(int a, int b) {return ((a < b)? a : b);}
inline int max3(int a, int b, int c) {return max2(a, max2(b, c));}
inline int min3(int a, int b, int c) {return min2(a, min2(b, c));}

int N;
LL a[55];
int main()
{
    //std::ios::sync_with_stdio(false);
    while(~scanf("%d", &N))
    {
        priority_queue<LL> Q;
        for(int i=1;i<=N;i++) 
        {
            scanf("%lld", a+i);
        }
        LL ans = 0;
        bool flag = true;
        while(flag)
        {
            flag = false;
            for(int i=1;i<=N;i++)
            {
                if(a[i]>=N)
                {
                    flag = true;
                    LL tmp = a[i]/N;
                    a[i]%=N;
                    ans += tmp;
                    for(int j=1;j<=N;j++)
                        if(i!=j) a[j]+=tmp;
                }
            }
        }
        printf("%lld\n", ans);
    }
    //printf("%lld\n", ((x)%mod+mod)%mod );
    //printf("\n%.2lf sec \n", (double)clock() / CLOCKS_PER_SEC);
}


Measured memory_bytes: 256
import sys
N, L = map(int, input().split())
sys.setrecursionlimit(200000)

class Node:
    def __init__(self, depth=0):
        self.parent = None
        self.children = {}
        self.depth = depth
    def add(self, n):
        self.children[n] = Node(self.depth+1)
    def has(self, n):
        return n in self.children
t = Node()
for i in range(N):
    s = input()
    nt = t
    for c in s:
        if not nt.has(c):
            nt.add(c)
        nt = nt.children[c]

def solve(node):
    global N, L
    ans = 0
    f = lambda d: (L - d) & -(L - d)
    if node.has('0'):
        ans ^= solve(node.children['0'])
    else:
        ans ^= f(node.depth)
    if node.has('1'):
        ans ^= solve(node.children['1'])
    else:
        ans ^= f(node.depth)
    return ans

ans = solve(t)
if ans == 0:
    print('Bob')
else:
    print('Alice')


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

using namespace std;
using ll=long long;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int s,w;cin>>s>>w;
  w>=s ? cout<<"unsafe"<<endl:cout<<"safe"<<endl;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, m; cin >> n >> m;
	int ans = 0;
	map<int, int> cnt2;
	vi cnt(m), ps(m);
	rep(i, n){
		int x; cin >> x;
		if(++cnt2[x] % 2 == 0){
			ps[x % m]++;
		}
		cnt[x % m]++;
	}
	
	ans += cnt[0] / 2;
	if(m % 2 == 0) ans += cnt[m / 2] / 2;
	
	for(int l = 1, r = m - 1; l < r; l++, r--){
		int k = min(cnt[l], cnt[r]);
		ps[l] = min(ps[l], (cnt[l] - k) / 2);
		ps[r] = min(ps[r], (cnt[r] - k) / 2);
		ans += k + ps[l] + ps[r];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5760
import re


def solve(stri):
    point = 0
    # Dの数
    for a in stri:
        if a == "D":
            point += 1
    # PDの数
    searched_pd = re.findall("PD",stri)
    point += len(searched_pd)
    return point

T = input()
T2 = re.sub('\?','D',T)

print(T2)


Measured memory_bytes: 12844
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 *
 * @author k15115kk
 */
public class Main {

    /**
     * @param args the command line arguments
     * @throws java.io.IOException
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);
        String s = br.readLine();
        StringTokenizer st = new StringTokenizer(s, " ");

        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());

        int ss = a * b;
        int u = (a * 2) + (b * 2);
        System.out.println(ss + " " + u);

    }

}

Measured memory_bytes: 24176
from sys import stdin
import sys
from itertools import groupby
sys.setrecursionlimit(10**6) 
n,q = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n-1)]
lin = [list(map(int,stdin.readline().rstrip().split())) for _ in range(q)]

kazu = [[]for _ in range(n)]
point = [0]*n

for i in range(n-1):
    kazu[li[i][0]-1].append(li[i][1]-1)
    kazu[li[i][1]-1].append(li[i][0]-1)
for i in range(q):
    point[lin[i][0]-1] += lin[i][1]

def dfs(now,before):
    for i in (kazu[now]):
        if i == before:
            continue
        point[i] += point[now]
        dfs(i,now)
dfs(0,-1)
print(*point)

Measured memory_bytes: 312772
#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
inline int read()
{
  int p=0; int f=1; char ch=getchar();
  while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();}
  while(ch>='0' && ch<='9'){p=p*10+ch-'0'; ch=getchar();}
  return p*f;
}

int n,m,a[N][N];

int p[N]; bool bo[N]; int cnt[N];
bool check(int x)
{
  for(int i=1;i<=n;i++) p[i] = 1;
  for(int i=1;i<=m;i++) bo[i] = 1;
  
  while(1)
  {
    for(int i=1;i<=m;i++) cnt[i] = 0;
    for(int i=1;i<=n;i++) cnt[a[i][p[i]]] ++;
    int mx = 0; for(int i=1;i<=m;i++) if(cnt[i] > x){mx = i; break;}
    if(mx == 0) return 1;
    bo[mx] = 0; for(int i=1;i<=n;i++) while(!bo[a[i][p[i]]] && p[i]<=m ) p[i] ++;
    bool bk = 1; for(int i=1;i<=m;i++) if(bo[i]) bk = 0;
    if(bk) return 0;
  }
}

int main()
{
  
  n = read(); m = read(); 
  for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) a[i][j] = read();
  int L = 1; int R = n; int ret = 0;
  while(L<=R)
  {
    int mid = (L+R)>>1;
    if(check(mid)) R=mid-1,ret=mid;
    else L=mid+1;
  }
  
  return printf("%d\n",ret),0;
}

Measured memory_bytes: 1408
import java.io.*;

public class Main{
    public static void main(String[] args)throws IOException{
	InputStreamReader isr = new InputStreamReader(System.in);
	BufferedReader br=new BufferedReader(isr);
	String moji = br.readLine();
	String cap = moji.toUpperCase();
	System.out.println(cap);
    }
}
	    

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

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

  ll N; cin >> N;
  vector<vector<ll>> d(10, vector<ll>(10, 0));
  ll ten = 1;
  for (int i = 1; i <= N; i++) {
    if (i >= 100000) ten = 100000;
    else if (i >= 10000) ten = 10000;
    else if (i >= 1000) ten = 1000;
    else if (i >= 100) ten = 100;
    else if (i >= 10) ten = 10;
    else ten = 1;
    int u = i / ten, l = i % 10;
    d[u][l]++;
  }

  ll ans = 0;
  for (int i = 1; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      ans += (d[i][j] * d[j][i]);
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <math.h>
#include <algorithm>
#define rep(i,n) for(int i=0; i < (n); i++)
#define INF 1001001
using namespace std;
 
int main(){
  int n;
  cin >> n;

  if(n%1000==0){
    cout << 0 << endl;
  }else{
  cout << 1000-(n%1000) << endl;
  }
  
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <string>
#include <stack>
#include <tuple>
#include <queue>

using namespace std;
typedef long long ll;
ll MOD = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    ll vote0,vote1;
    vote0 = vote1 = 1;
    for (int i = 0; i < n; i++)
    {
        ll t, a;
        cin >> t >> a;
        for (ll j = max(vote0 / t,vote1 / a);; j++)
        {
            if (vote0 <= t * j && vote1 <= a * j)
            {
                vote0 = t * j;
                vote1 = a * j;
                break;
            }
        }
    }
    cout << vote0 + vote1 << endl;
    return 0;
}

Measured memory_bytes: 256
a = int(input())
l = sorted([int(x) for x in input().split()])
count = 0
for i in range(a):
    for j in range(i+1,a):
        if l[i] != l[j]:
            for k in range(j+1,a):
                if l[i]+l[j] >l[k] and l[i]!=l[k] and l[j]!=l[k]:
                    count += 1
print(count)

Measured memory_bytes: 9188
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

ss = list(input()[:-1])

ss.sort()

aaa = s(ss)

for i in aaa:
    if i[1] % 2 != 0:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 65452
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        int N;
        double M,SUM;
 
        try {
            while((N = Integer.parseInt(br.readLine())) != 0){
 
                String input[] = br.readLine().split("\\s+");
                double array[] = new double[input.length];
 
                SUM = 0;
 
                for(int i = 0; i < input.length; i++){
                    array[i] = Double.parseDouble(input[i]);
                    SUM += array[i];
                }
 
                M = SUM/(double)N;
                SUM = 0;
 
                for(int i = 0; i < array.length; i++){
                    SUM += (array[i]-M)*(array[i]-M);
                }
 
                System.out.printf("%.10f\n", Math.sqrt(SUM/(double)N));
            }
        } catch (NumberFormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 27740
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <numeric>
#include <type_traits>
#include <limits>
#include <random>
#include <iomanip>

using namespace std;

using ll = long long;

typedef pair<ll, ll> P;

#define rep(i,N) for(long long i = 0;i < (long long)N; ++i)

static int mod = 1000000007;
static int large_int = 1000000000;
static ll large_ll = 1000000000000000000;

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

int N, M;
P shop[100000];
ll ans;

int main() {
	cin >> N >> M;
	rep(i, N) {
		cin >> shop[i].first >> shop[i].second;
	}
	sort(shop, shop + N);
	int rec = 0;
	while (M > 0) {
		if (M <= shop[rec].second) {
			ans += M * shop[rec].first;
			M = 0;
		}
		else {
			M -= shop[rec].second;
			ans += shop[rec].first * shop[rec].second;
			rec++;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1792