akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
using namespace std; 
int gi() { 
	int res = 0, w = 1; 
	char ch = getchar(); 
	while (ch != '-' && !isdigit(ch)) ch = getchar(); 
	if (ch == '-') w = -1, ch = getchar(); 
	while (isdigit(ch)) res = res * 10 + ch - '0', ch = getchar(); 
	return res * w; 
}
typedef long long LL; 
const int MAX_N = 2e5 + 5; 
struct Graph { int to, next; } e[MAX_N << 1]; 
int fir[MAX_N], e_cnt; 
void clearGraph() { memset(fir, -1, sizeof(fir)); e_cnt = 0; } 
void Add_Edge(int u, int v) { e[e_cnt] = (Graph){v, fir[u]}, fir[u] = e_cnt++; } 
int N, M; 
bool vis[MAX_N], col[MAX_N], flag; 
LL cnt[3]; 
void dfs(int x) { 
	vis[x] = 1; 
	for (int i = fir[x]; ~i; i = e[i].next) { 
		int v = e[i].to; 
		if (vis[v] && col[v] == col[x]) { flag = 1; continue; }
		if (vis[v]) continue; 
		col[v] = col[x] ^ 1, dfs(v); 
	} 
} 
int main () { 
#ifndef ONLINE_JUDGE 
    freopen("cpp.in", "r", stdin); 
#endif
	clearGraph(); 
	N = gi(), M = gi(); 
	for (int i = 1; i <= M; i++) { 
		int u = gi(), v = gi(); 
		Add_Edge(u, v), Add_Edge(v, u); 
	} 
	for (int i = 1; i <= N; i++) { 
		if (fir[i] == -1) { ++cnt[0]; continue; }
		if (vis[i]) continue; 
		flag = 0, dfs(i); 
		if (flag) cnt[1]++; 
		else cnt[2]++; 
	} 
	LL ans = 2 * cnt[0] * N - cnt[0] * cnt[0] + cnt[2] * cnt[2] * 2 + cnt[1] * cnt[1] + 2 * cnt[1] * cnt[2]; 
	printf("%lld\n", ans); 
    return 0; 
} 

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

int main(){

  ll n,x;
  while(cin>>n>>x){
    if(n==0&&x==0)break;

    ll ans=0;
    rep(i,1,n-1){
      rep(j,i+1,n){
        ll rest=(x-i-j);
        if(rest>0&&rest<=n&&j<rest)ans++;
      }
    }
    out(ans);
  }



  return 0;
}



Measured memory_bytes: 3044
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <limits>
#include <ios>
#include <iomanip>
#include <stdio.h>
#include <iomanip>
#include <queue>
#include <set>
using namespace std;

#define rep(i,N) for(int (i)=0; (i)<(N); (i)++)
#define revrep(i,N) for(int (i)=(N)-1; (i)>=0; (i)--)
#define dump(vec) for(int i = 0; i < (vec).size(); i++){cout << vec.at(i) << ",";}cout << endl

typedef long long ll;

int main(void)
{
    string s;
    cin >> s;

    int ret = 0;
    for(int i = 0; i < s.length()/2; i++) {
        if (s.at(i) == s.at(s.length()-1-i)) {

        } else {
            ret ++;
        }
    }
    
    cout << ret << endl;
    return 0;
}


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

const int mod=1000000007;
int n,m,f[200010],sum[200010],la,mi,ans,jc[200010],inv[200010];
char s[200010];
bool bo;

int quickmi(int a,int b)
{
	int t=1;
	for (; b; b>>=1,a=1ll*a*a%mod)
		if (b&1) t=1ll*t*a%mod;
	return t;
}

int calc(int n)
{
	int ans=0;
	for (int i=0; n-i-1>=i; i++)
		ans=(ans+1ll*jc[n-i-1]*inv[i]%mod*inv[n-2*i-1])%mod;
	return ans;
}

int main()
{
	scanf("%d%d",&n,&m),scanf("%s",s),bo=1;
	if (s[0]=='B') {for (int i=0; i<m; i++) s[i]=(s[i]=='B'?'R':'B');}
	for (int i=0; i<m; i++) if (s[i]=='B') {bo=0; break;}
	if (bo)
	{
		jc[0]=1;
		for (int i=1; i<=n; i++) jc[i]=1ll*jc[i-1]*i%mod;
		inv[n]=quickmi(jc[n],mod-2);
		for (int i=n; i; i--) inv[i-1]=1ll*inv[i]*i%mod;
		ans=(calc(n)+2ll*calc(n-1))%mod;
		return printf("%d\n",ans),0;
	}
	la=-1,mi=1000000000,ans=0;
	for (int i=0; i<m; i++)
		if (s[i]=='B') 
		{
			if ((i-la-1)&1) mi=min(mi,i-la-1);
			else if (la==-1) mi=min(mi,i-la);
			la=i;
		}
	f[0]=sum[0]=1,f[1]=sum[1]=0;
	for (int i=2; i<=n; i++) 
	{
		f[i]=sum[i-2]-(i-mi-3<0?0:sum[i-mi-3]);
		if (f[i]<0) f[i]+=mod;
		sum[i]=(sum[i-2]+f[i]>=mod?sum[i-2]+f[i]-mod:sum[i-2]+f[i]);
	}
	for (int i=0,nw1,nw2; i<=mi&&i<n; i++)
	{
		nw1=(n-i-1-((i&1)^1)>=0?sum[n-i-1-((i&1)^1)]:0);
		nw2=(n-i-3-(mi-i)>=0?sum[n-i-3-(mi-i)]:0);
		ans+=(nw1<nw2?nw1-nw2+mod:nw1-nw2);
		if (ans>=mod) ans-=mod;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2048
#include<stdio.h>
#include<string.h>
  
int main(void){
    char str[1001];     // input; input string , 1<=length<=1000
    int n=0;            // input; command times, 1<=n<=100
    int a=0, b=0;
    char* p_str=str;    // string pointer
    char cpy[1001];
    int i=0, j=0;       // loop index
  
    scanf("%s", str);
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%s", cpy);
        if(strcmp(cpy, "print") == 0){
            scanf("%d %d", &a, &b);
            p_str = str + a;
            strncpy(cpy, p_str, b-a+1);
            cpy[b-a+1] = '\0';
            printf("%s\n", cpy);
  
        }else if(strcmp(cpy, "reverse") == 0){
            scanf("%d %d", &a, &b);
            p_str = str + b;
            for(j=0;j<b-a+1;j++){
                cpy[j] = *(p_str);
                p_str--;
            }
            p_str = str + a;        // ??????¶???????????????
            for(j=0;j<b-a+1;j++) *(p_str + j) = cpy[j];
  
        }else if(strcmp(cpy, "replace") == 0){
            scanf("%d %d %s", &a, &b, cpy);
            p_str = str + a;
            for(j=0;j<b-a+1;j++) *(p_str + j) = cpy[j];
          
        }else{
          
        }
    }
    return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] % 2 != 0 && (i + 1) % 2 != 0) ans++;
  }
  cout << ans << '\n';
  return 0;
}

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

from collections import defaultdict,deque

A = [list(map(int,input().split())) for i in range(N)]

count = 0
B = defaultdict(int)
now_list = [0]*N
day=0

Q = deque([i for i in range(N)])
while count<(N*(N-1))//2:
        Q2 = deque([])
        battle_flag=False
        while len(Q)>0:
                i = Q.popleft()
                j = A[i][now_list[i]]-1
                a=min(i,j)
                b=max(i,j)
                if B[str(a)+" "+str(b)]==1:
                        count+=1
                        B[str(a)+" "+str(b)]=0
                        now_list[i]+=1
                        now_list[j]+=1
                        if now_list[i]<N-1:
                                Q2.append(i)                                
                        if now_list[j]<N-1:
                                Q2.append(j)                                
                        battle_flag=True
                else:
                        B[str(a)+" "+str(b)]+=1
        if not battle_flag:
                break
        Q = Q2
        day+=1

if count==(N*(N-1))//2:
        print(day)
else:
        print(-1)

Measured memory_bytes: 117904
object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  
  val nums = inputs(0).split(" ").map(_.toInt)
  val n = nums(0)
  val k = nums(1)
  val lamps = inputs(1).split(" ").map(_.toInt)


  println(solve(n, k, lamps))

  private def solve(n: Int, k: Int, lamps: Seq[Int]): String = {
    var currentPower = scala.collection.mutable.ArrayBuffer.empty[Int]
    lamps.foreach { v =>
      currentPower.append(v)
    }

    (1 to k).foreach { _ =>

      // 範囲初期化
      val range = scala.collection.mutable.ArrayBuffer.fill(n + 1)(0)
      // 要素を走査
      (0 until n).foreach { i =>
        val power = currentPower(i)

        // 開始、終了を挟み込み
        val left = Math.max(0, i - power)
        val right = Math.min(i + power + 1, n)

        range.update(left,  range(left) + 1)
        range.update(right, range(right) - 1)
      }
      // 累積和を計算
      (1 to n).foreach { i =>
        range.update(i, range(i - 1) + range(i))
      }
      // 末端が余分なので削除して次の光として保持
      val nextPower = range.dropRight(1)

      // 全体が最高に光ってたら終了
      if (nextPower == currentPower) {
        return currentPower.mkString(" ")
      }

      // 次の光を保持
      currentPower = nextPower
    }
    currentPower.mkString(" ")
  }
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, p[100100], d[100100];

bool ng[100100], ok[100100];

signed main() {
	cin >> n;
	rep(i,n) cin >> p[i];
	rep(i,n) if (!ng[i] && !ok[i] && p[i]) {
		set<int> s;
		s.insert(i);
		int v = i;
		while (1) {
			v = v + p[v];
			if (ng[v] || s.count(v)) {
				each(j,s) ng[j] = 1;
				break;
			}
			if (ok[v] || !p[v]) {
				each(j,s) ok[j] = 1;
				break;
			}
			s.insert(v);
		}
	}
	reps(i,1,n) d[i] = inf;
	queue<int> q;
	q.push(0);
	while (!q.empty()) {
		int v = q.front(); q.pop();
		if (p[v] && d[v+p[v]]>d[v]) d[v+p[v]] = d[v], q.push(v+p[v]);
		else if (!p[v]) repst(i,v+1,min(v+6,n-1)) if (!ng[i] && d[i]>d[v]+1) d[i] = d[v]+1, q.push(i);
	}
	cout << d[n-1] << ln;
}


Measured memory_bytes: 7972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define pb push_back
#define pu push
#define mp make_pair
#define fi first
#define sc second

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

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


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

    int N; cin >> N;
    vi a(N), b(N);
    rep (i, N) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(ALL(b));
    int m1 = b[(N / 2) - 1], m2 = b[(N / 2)];

    rep (i, N) {
        int ans = 0;
        if (a[i] <= m1) ans = m2;
        else if (a[i] >= m2) ans = m1;
        COUT(ans);
    }
}

Measured memory_bytes: 3840
s = gets.chomp.split('').to_a
ans = 0
0.upto(2 ** (s.size - 1) - 1) do |i|
  b = i.to_s(2).rjust(s.size - 1, "0")
  sum = s[0].dup
  1.upto(s.size - 1) do |j|
    t = s[j].dup
    if b[j - 1] == "0"
      sum.to_s.concat(".to_s.concat(").concat(t).concat(".to_s).to_i")
    else
      sum.to_s.concat(".to_i + ").concat(t)
    end
  end
  ans += eval(sum)
end
puts ans

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

int main(){
    int n;
    cin >> n;
    if('A'<=n and n<='Z'){
        cout << 1 << endl;
    }else if('a'<=n and n<='z'){
        cout << 2 << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
  IOS();
  ll n,k;
  cin >> n >> k;
  if ((n+1)/2 >= k) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;cin>>s;
  if(s.length()==1){cout<<s[0]-'0';return 0;}
  int currsum=0;
  int n = s.length();
  for(int i=0;i<n;i++)currsum+=s[i]-'0';
  cout<<max(currsum,(n-1)*9+s[0]-'0'-1);
}

Measured memory_bytes: 3616
#include <stdio.h>
int main(){
  int a[5];
  int i,j;
  scanf("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4]);
  for(i=0;i<4;i++){
    for(j=0;j<4-i;j++){
      if(a[j]<a[j+1]){
	int temp=a[j];
	a[j]=a[j+1];
	a[j+1]=temp;
      }
    }
  }
  for(i=0;i<5;i++){
    printf("%d",a[i]);
    if(i!=4)printf(" ");
    else printf("\n");
  }
  return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<queue>
#include<string.h>
#include<map>
#include<set>
#include<algorithm>
#define ll long long
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)
#define rep(i,a,b) for(int i = a;i < b;i++)
#define N 300004
#define INF 1e9+7

using namespace std;

ll n,m,q,a,b,c,d;
string s1,s2;
ll sum1[N],sum2[N];

ll get_b1(int i,int j)
{
    if(i == 0)
        return sum1[j];
    return sum1[j]-sum1[i-1];
}

ll get_b2(int i,int j)
{
    if(i == 0)
        return sum2[j];
    return sum2[j]-sum2[i-1];
}

ll get_a1(int i,int j)
{
    return j-i+1-get_b1(i,j);
}
ll get_a2(int i,int j)
{
    return j-i+1-get_b2(i,j);
}

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> s1 >> s2;

    n=s1.size();
    m = s2.size();

    rep(i,0,n)
    {
        if(i == 0)
            sum1[i] = s1[i]-'A';
        else
            sum1[i] = sum1[i-1]+s1[i]-'A';
    }

    rep(i,0,m)
    {
        if(i == 0)
            sum2[i] = s2[i]-'A';
        else
            sum2[i] = sum2[i-1]+s2[i]-'A';
    }

    cin >> q;

    rep(i,0,q)
    {
        cin >> a >> b >> c >> d;
        a--;
        b--;
        c--;
        d--;

        if((get_a1(a,b)+get_b1(a,b)*2)%3 == (get_a2(c,d)+get_b2(c,d)*2)%3)
            cout << "YES\n";
        else
            cout <<"NO\n";
    }

    return 0;
}



Measured memory_bytes: 3792
#include "bits/stdc++.h"
using namespace std;

//?????????
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(40) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,n,a) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,n,0)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //???????????????????????????????????????????????????
std::ifstream ifs("data.txt");
#define put ifs >>
#else //?????£????????????????????§?????????????????????
#define put cin >>
#endif
#pragma endregion
//???????????°??????????????´
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef????????????????????????????¶????????????§?????????
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
#pragma endregion
//??????????????°(???????????????????????§??????)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e9)
#pragma endregion



const static int MAX_V = 10000;
vector<int> G[MAX_V];
int topologicalV[MAX_V];
int used[MAX_V];
int remain;

void dfs(int v) {
	if (used[v])return;
	if (G[v].size() == 0) {
		topologicalV[remain] = v;
		remain--;
		used[v] = true;
		return;
	}
	rep(i, G[v].size()) {
		if (!used[G[v][i]]) {
			dfs(G[v][i]);
		}
	}
	topologicalV[remain] = v;
	used[v] = true;
	remain--;
}

//AOJ GRL_5
int main() {
	int v,e; put v >> e;
	rep(i, e) {
		int from; put from;
		int to; put to;
		G[from].push_back(to);
	}
	remain = v-1;
	rep(i, v) {
		dfs(i);		
	}
	rep(i, v) {
		cout <<	topologicalV[i] << endl;
	}

END:

	return 0;
}

Measured memory_bytes: 3760
#include "bits/stdc++.h"
using namespace std;
typedef long long lint;
#define repi(i,a,b) for(lint i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define tsort(v) sort((v).begin(), (v).end())
#define trev(v) tsort(v); reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_1
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

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

    lint n,in;cin>>n;
    vector<lint> a, b;
    rep(i,n){
        cin>>in;
        a.push_back(in%4);
        b.push_back(in%2);
    }
    Yes(cnt(a,0)+(cnt(b,0)-cnt(a,0))/2>=n/2);
}

Measured memory_bytes: 2036
import Data.List
import Data.Char

data Card = Card {
  mark :: String,
  num :: [Int],
  state :: String,
  result :: [String]
  } deriving (Show, Read)

bubble' :: Int -> Card -> Card
bubble' 14 card = Card {mark = mark card, num = sort $ num card, state = state card, result = a (concat $ reverse $ result card) (sort $ num card)}
  where a [] [] = []
        a (m:mx) (n:nx) = (m:show n) : a mx nx
bubble' n card
  | elemIndices n (num card) == [] = bubble' (n+1) card
  | otherwise = bubble' (n+1) (Card {mark = mark card, num = num card, state = state card, result = [(mark card) !! a | a <- elemIndices n (num card)] : result card})

select' :: Card -> Card
select' all@(Card {num = []}) = all
select' card
  | 0 /= getIndex card = select' (Card {mark = funcM card, num = funcN card, state = state' card, result = ((mark card !! getIndex card) : show (num card !! getIndex card)) : result card})
  | otherwise = select' (Card {mark = tail $ mark card, num = tail $ num card, state = state card, result = ((head $ mark card) : show (head $ num card)) : result card})
  where funcM c = change (mark c) (getIndex c)
        funcN c = change (num c) (getIndex c)
        getIndex c = (\(Just x) -> x) $ elemIndex (minimum $ num c) (num c)
        change l i = tail $ (take i l) ++ [head l] ++ drop (i + 1) l
        state' c = if elem (head $ num c) (tail $ take (getIndex c) (num c)) then "Not stable" else state card

main = do
  list <- fmap (tail . words) getContents
  putStrLn $ unwords $ result $ bubble' 1 $ card list
  putStrLn $ "Stable"
  putStrLn $ unwords $ reverse $ result $ select' $ card list
  putStrLn $ state $ select' $ card list
    where card l = Card {mark = [a | [a,_] <- l], num = [digitToInt b | [_,b] <- l], state = "Stable", result = []}

Measured memory_bytes: 4132
h, w, n = map(int, input().split())
cnt = {}

for _ in range(n):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    for i in range(-1, 2):
        for j in range(-1, 2):
            if 0 < a + i < h - 1 and 0 < b + j < w - 1:
                if (a+i, b+j) not in cnt:
                    cnt[(a+i, b+j)] = 0
                cnt[(a+i, b+j)] += 1

ans = {i: 0 for i in range(10)}
ans[0] = (h - 2) * (w - 2)
for _, x in cnt.items():
    ans[x] += 1
    ans[0] -= 1

for i in range(10):
    print(ans[i])

Measured memory_bytes: 166548
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
import java.util.*;
import java.io.*;
/**
 *
 * @author arvin
 */
public class Main {
    
    static int val[],weight[];
    static long dp[][];
    
    static long rec(int x,int w)
    {
        if(w<=0)
            return 0;
        if(x<0)
            return 0;
        long a1=0l,a2;
        if(weight[x]<=w)
        {
            if(x>0 && dp[x-1][w-weight[x]]!=0)
                a1=val[x]+dp[x-1][w-weight[x]];
            else
                a1=val[x]+rec(x-1,w-weight[x]);
        }
        if(x>0 && dp[x-1][w]!=0)
            a2=dp[x-1][w];
        else
            a2=rec(x-1,w);
        dp[x][w]=Math.max(a1,a2);
        return dp[x][w];
    }
    public static void main(String args[]) throws Exception
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int w=sc.nextInt();
        val=new int[n];
        weight=new int[n];
        for(int i=0;i<n;i++)
        {
          weight[i]=sc.nextInt();
          val[i]=sc.nextInt();
        }
        dp=new long[n+1][w+1];
        long ans=rec(n-1,w);
        System.out.println(ans);
        
        sc.close();
    }
}


Measured memory_bytes: 129488
#include <stdio.h>

int main(){
    int N, Y, x = -1, y = -1, z = -1;
    scanf("%d %d", &N, &Y);

    for(x = 0; x <= N; x++){
        for(y = 0; y <= N; y++){
            z = N - x - y;
            if(Y == 10000 * x + 5000 * y + 1000 * z && z >= 0){
                printf("%d %d %d\n", x, y, z);
                return 0;
            }
        }
    }
    printf("%d %d %d\n", -1, -1, -1);
    return 0;
}

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

int field[64][64];
bool visited[64][64];
int dx[] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[] = {1, -1, 0, 0, 1, -1, 1, -1};

void rec(int y, int x)
{
	if (visited[y][x] == false){
		return;
	}
	visited[y][x] = false;
	for (int i = 0; i < 8; i++){
		rec(y + dy[i], x + dx[i]);
	}
	return;
}

int main(void)
{
	int w, h;
	while (cin >> w >> h, w && h){
		for (int i = 0; i < 64; i++){
			for (int j = 0; j < 64; j++){
				field[i][j] = 0;
				visited[i][j] = false;
			}
		}
		for (int i = 1; i <= h; i++){
			for (int j = 1; j <= w; j++){
				cin >> field[i][j];
				if (field[i][j] == 1){
					visited[i][j] = true;
				}
			}
		}
		int ret = 0;
		for (int i = 0; i < 64; i++){
			for (int j = 0; j < 64; j++){
				if (visited[i][j] == true){
					rec(i, j);
					ret++;
				}
			}
		}
		cout << ret << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1252
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL a; cin >> a;
		UL ans = 0;
		rep(i, 4) { if (a % 10 == 2) ans++; a /= 10; }
		cout << ans << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn=1e5+100;
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0);
    string s, t;
    cin>>s>>t;
    if(t==s)cout<<"Yes\n";
    else
    {
        for(int i=0; i<sz(s); i++)
        {
            if(s[i]!=t[i])
            {
                char ch=s[i];
                vector<int>pos;
                for(int j=0; j<sz(s); j++)
                    if(s[j]==t[i])pos.pb(j);
                for(int j=0; j<sz(s); j++)
                    if(s[j]==ch)s[j]=t[i];
                for(auto aa:pos)
                {
                    if(aa<i)return cout<<"No\n", 0;
                    s[aa]=ch;
                }
            }
        }
        if(s==t)cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 1428
// :pray: :arrayman:
// :pray: :summit:
// :pray: :pusheen:
// :pray: :prodakcin:
// :pray: :spacewalker:
// :pray: :duk:
// :pray: :gustav:
// :pray: :tmw:
// :pray: :eed:
// :pray: :chicubed:
// :pray: :arceus:
// :pray: :gamegame:
// :pray: :sinx:
// :pray: :eyg:
// :pray: :evan:
// :pray: :cj:
// :pray: :steph:
// :pray: :fatant:
// :pray: :mathbot:
// :pray: :dolphin:
// :pray: :stef:
// :pray: :geothermal:
// :pray: :mikey:
// :pray: :horse:
// :pray: :snek:
// :pray: :wayne:
// :pray: :wu:
// :pray: :vmaddur:
// :pray: :dorijanko:
// :pray: :gaming:
// :pray: :kassuno:
// :pray: :hyacinth:
// :pray: :chilli:
// :pray: :dhruv:
// :pray: :philip:
// :pray: :paiman:
// :pray: :camel:
// :pray: :tree:
// :pray: :tux:
// :pray: :jony:
// :pray: :kage:
// :pray: :ghost:
// :pray: :aha:
// :pray: :coolguy:
// :pray: :imax:
// :pray: :howlet:
// :pray: :darren:
// :pray: :arie:
// :pray: :blastman:
// :pray: :zephyr:
// :pray: :bigc:

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <cmath>

#define ll long long
#define eps 1e-8
#define MOD 1000000007

#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f

// change if necessary
#define MAXN 1000000

using namespace std;

int n;
int a[MAXN];
int b[MAXN];
int c[MAXN];

int dp_a[MAXN];
int dp_b[MAXN];
int dp_c[MAXN];

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

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

    dp_a[0] = a[0];
    dp_b[0] = b[0];
    dp_c[0] = c[0];

    for (int i = 1; i < n; i++) {
        dp_a[i] = max(dp_b[i - 1], dp_c[i - 1]) + a[i];
        dp_b[i] = max(dp_a[i - 1], dp_c[i - 1]) + b[i];
        dp_c[i] = max(dp_a[i - 1], dp_b[i - 1]) + c[i];
    }

    cout << max(dp_a[n - 1], max(dp_b[n - 1], dp_c[n - 1])) << '\n';

    return 0;
}

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


class Main {
    public static void main(String[] args) {
    	FastReader f = new FastReader();
    	int n = ii(f);
    	int[] arr = inputArr(n, f);
		int[] dp = new int[n+1];
		dp[0] = 0;
		dp[1] = 0;
		dp[2] = Math.abs(arr[1] - arr[0]);
		for(int i=3; i<=n; i++){
			dp[i] = min(dp[i-1] + Math.abs(arr[i-1]-arr[i-2]), dp[i-2] + Math.abs(arr[i-1]-arr[i-3]));
		}
		printn(dp[n]);
    }


	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static int ii(FastReader fr){
		return fr.nextInt();
	}

	static long il(FastReader fr){
		return fr.nextLong();
	}

	static void printArray(Object[] arr) {
		for (Object x : arr)
			print(x, " ");
		printn("");
	}

	static void print(Object s, String sep) {
		System.out.print(s + sep);
	}

	static void printn(Object s) {
		System.out.println(s);
	}

	static long[] inputArrL(int n, FastReader fr) {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++)
			arr[i] = fr.nextLong();
		return arr;
	}

	static int[] inputArr(int n, FastReader fr) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++)
			arr[i] = fr.nextInt();
		return arr;
	}

	static int max(int... args) {
		int max = Integer.MIN_VALUE;
		for (int x : args) {
			max = Math.max(x, max);
		}
		return max;
	}

	static int min(int... args) {
		int min = Integer.MAX_VALUE;
		for (int x : args) {
			min = Math.min(x, min);
		}
		return min;
	}

	static long max(long... args) {
		long max = Integer.MIN_VALUE;
		for (long x : args) {
			max = Math.max(x, max);
		}
		return max;
	}

	static long min(long... args) {
		long min = Integer.MAX_VALUE;
		for (long x : args) {
			min = Math.min(x, min);
		}
		return min;
	}

	static int lenDigit(int d) {
		if (d == 0)
			return 1;
		int l = 0;
		while (d != 0) {
			l++;
			d /= 10;
		}
		return l;
	}

}



Measured memory_bytes: 33264
H, W = map(int, input().split())
N = int(input())
A = [int(x) for x in input().split()]

r = False
l = []
for i, a in enumerate(A):
    l += [i + 1] * a
    while len(l) >= W:
        t = l[:W]
        if not r:
            print(*t)
        else:
            print(*list(reversed(t)))
        l = l[W:]        
        r = not r

Measured memory_bytes: 3800
#include<bits/stdc++.h>
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000000
#define PI 3.14159265358979323846
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int x, y;
	cin >> x >> y;
	if(((4*x-y)%2)==0 && (4*x-y)/2 >= 0 && x-(4*x-y)/2 >= 0)
		cout << "Yes\n";
	else
		cout << "No\n";
}

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

namespace ConsoleApp1
{
    static class CMaximalValue
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var bList = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();

            var aList = new List<int>();
            for (int i = 0; i < n - 1; i++)
            {
                if (i == 0)
                {
                    aList.Add(bList[i]);
                    continue;
                }
                aList.Add(Math.Min(bList[i - 1], bList[i]));
            }
            aList.Add(bList[n - 2]);

            Console.WriteLine(aList.Sum());
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 13268
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
 
using namespace std;
 
//container util
//------------------------------------------
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
 
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).end()) i=(c).end(); i!=(c).begin(); --i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).begin(),(c).end(),greater<int>())
 
#define PB(a) push_back(a)
#define PF(a) pop_front(a)
 
#define MP(a,b) make_pair(a,b)
 
#define FS first
#define SE second
 
#define ALL(x) (x).begin(),(x).end()
#define MAX_EL(c) *max_element((c).begin(),(c).end())
#define MIN_EL(c) *min_element((c).begin(),(c).end())
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef string str;
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

//------show vector---------
template <typename T>
void showV(vector < T > a){
  EACH(i,a){
    cerr << *i << ',';
  }  
  cerr << endl;
}

//------show matrix---------
template <typename T>
void showVV(vector < vector < T > > a){
  EACH(i,a){
    showV(*i);
  }  
}
//grobal var
//------------------------------------------
LL dp[2000][2000];
int main(){
// magic spell------------------------------
  cin.tie(0);
  ios::sync_with_stdio(false);
//------------------------------------------
  int L,R;
  while(cin >> L >> R){
    int mod = 2019;
    int ans = 2019;
    if (R-L > mod){
      debug(1)
      ans = 0;
    }else if ((R % mod) < (L % mod)){
      debug(2)
      ans = 0;
    }else {
      FOR(i,L%mod,(R%mod)+1){
        FOR(j,L%mod,i){
          ans = min(ans,(i*j)%mod);
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}


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

using namespace std;

#define int long long

signed main() {
    int n, m;
    cin >> n >> m;

    if (m <= 2 * n) {
        cout << m / 2 << '\n';
    } else {
        cout << n + (m - 2 * n) / 4 << '\n';
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>

using namespace std;

int main(){
    int a;
    cin>>a;
    int b[12];
    for(int i=0;i<a;++i){
        cin>>b[i];
    }
    sort(b, b + a, greater<int>());
    b[0] /= 2;
    int sum=0;
    for(int i=0;i<a;++i){
        sum += b[i];
    }
    cout<<sum;
}

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

#define rep(i,n) for(ll i=0;i<(n);i++)
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<ll>>;
template<typename T=ll,typename U=ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
const ll INF = (ll)1e9;

int main(){
    ll h,w;
    cin >> h >> w;
    auto c = vv<ll>(10,v<>(10,0));
    auto a = vv<ll>(h,v<>(w,0));

    rep(i,10)rep(j,10){
        cin >>c[i][j];
    }

    rep(i,h)rep(j,w){
        cin >> a[i][j];
    }
    
    rep(k,10)
        rep(i,10)
            rep(j,10){
            chmin(c[i][j],c[i][k]+c[k][j]);
        }
    
    ll ans=0;
    rep(i,h)
        rep(j,w){
            if(a[i][j]<0) continue;
            ans += c[a[i][j]][1];
    }
    cout << ans;

    return 0;
}

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

using namespace std;
typedef long long LL;
int _max(int x, int y) {return x > y ? x : y;}
int _min(int x, int y) {return x < y ? x : y;}
const int N = 151;
int read() {
	int s = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
	return s * f;
}
void put(int x) {
	if(x < 0) x = -x, putchar('-');
	if(x >= 10) put(x / 10);
	putchar(x % 10 + '0');
}

int mod;
int f[N][N][N], g[N][N];

int add(int x, int y) {
	x += y;
	return x >= mod ? x - mod : x;
}

int dec(int x, int y) {
	x -= y;
	return x < 0 ? x + mod : x;
}

int solve(int n, int k) {
	memset(g, 0, sizeof(g));
	int ans = 0; g[0][0] = 1;
	for(int i = 1; i <= n; i++) for(int j = 0; j <= k; j++) if(g[i - 1][j]){
		g[i][0] = add(g[i][0], g[i - 1][j]);
		if(j < k) g[i][j + 1] = add(g[i][j + 1], g[i - 1][j]);
	} for(int i = 0; i <= k; i++) ans = add(ans, g[n][i]);
	return ans;
}

int main() {
	int n = read(), k = read(); mod = read();
	if(!(k & 1)) return put((LL)solve(n >> 1, k >> 1) * solve((n + 1) >> 1, k >> 1) % mod), 0;
	f[0][0][0] = 1;
	for(int i = 1; i <= n + 1; i++) {
		int u = i << 1, v = u - k;
		for(int j = 0; j <= n; j++) for(int h = 0; h <= k; h++) if(f[i - 1][j][h]){
			f[i][0][0] = add(f[i][0][0], f[i - 1][j][h]);
			if(1 <= u && u <= n) f[i][j + 1][0] = add(f[i][j + 1][0], f[i - 1][j][h]);
			if(1 <= v && v <= n) f[i][0][h ? h + 1 : 0] = add(f[i][0][h ? h + 1 : 0], f[i - 1][j][h]);
			if(1 <= u && u <= n && 1 <= v && v <= n) f[i][j + 1][_max(j + 1, h + 1)] = add(f[i][j + 1][_max(j + 1, h + 1)], f[i - 1][j][h]);
		}
	} put(f[n + 1][0][0]);
	return 0;
}



Measured memory_bytes: 10752
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut a: Vec<(usize, usize)> = (0..n)
        .map(|i| {
            let a: usize = sc.read();
            (a, i)
        })
        .collect();
    a.sort();
    for &(_, idx) in a.iter() {
        print!("{} ", idx + 1);
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int N;
  ll sum = 0;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    if (i % 3 != 0 && i % 5 != 0) {
      sum += (ll)i;
    }
  }
  cout << sum << endl;
}


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

int cost[100001];

void _initialise(int n){
	for(int i=0;i<n;i++){
		cost[i] = -1;
	}
}

int cal_cost(int* a, int n)
{
	if(n==0){
		return 0;
	}
	else if(n==1){
		cost[n] = abs(a[n]-a[n-1]);
		return cost[n];
	}
	if(cost[n]!=-1){
		return cost[n];
	}
	cost[n] = min( cal_cost(a, n-1) + abs(a[n] - a[n-1]), cal_cost(a, n-2) + abs(a[n] - a[n-2]));
	return cost[n];
}


int main(int argc, char const *argv[])
{
	int i,j,k,n;
	cin>>n;
	int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];
	_initialise(n);
	cout<<cal_cost(a,n-1);
	return 0;
}

Measured memory_bytes: 4096
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
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; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

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

	int kkt = 89;
	char alp[52]; for (int i = 0; i < 26; i++) alp[i] = (char)('a' + i); for (int i = 0; i < 26; i++) alp[i + 26] = (char)('A' + i);
	while (kkt) {
		ll n; cin >> n; if (n == 0) break;
		vector<ll> k(n); for (int i = 0; i < n; i++) scanf("%lld", &k[i]);
		string s; cin >> s;
		string res;
		for (int i = 0; i < s.size(); i++) {
			int c;
			for (int j = 0; j < 52; j++) if (s[i] == alp[j]) c = j;
			c -= k[i % n];
			c %= 52;
			if (c < 0) c += 52;
			res += alp[c];
		}
		cout << res << "\n";
	}
	return 0;

}



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

int main() {
    long long n;
    cin >> n;
    long long x = n / 500;
    n = n - x * 500;
    long long y = n / 5;
    long long sum = x * 1000 + y * 5;
    cout << sum;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int opt = 0;
        opt = (N*(N-1))/2;
        opt +=(M*(M-1))/2;
        System.out.println(opt);
    }
}


Measured memory_bytes: 21844
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#define fi first
#define se second
#define pb(i) push_back(i)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mes(a,b) memset(a,b,sizeof(a))
#define sbs(i,j) substr(i,j)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 105;
const int INF = 0x3f3f3f3f;
const int inf = - INF;
const int mod = 1e9+7;
const double pi = acos(-1.0);

int a[N];
int main(){
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll sum = 0;
    rep(i,1,n){
        cin>>a[i];
        sum+=a[i];
    }
    int m;
    cin>>m;
    rep(i,1,m){
        int p,x;
        cin>>p>>x;
        cout<<sum-a[p]+x<<endl;
    }
    return 0;
}

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

using namespace std;

using ll = long long;
using db = double;
using vi = vector<int>;
#define pb push_back
#define fir first
#define sec second

ll a, b; 

int main() {
	cin>>a>>b; 
	if (a <= 0 && b >= 0) puts( "Zero" ); 
	else if (a < 0 && b < 0 && (b-a) % 2 == 0) puts( "Negative" ); 
	else puts( "Positive" ); 
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long int ll;

int main() {
  ll N;
  cin>>N;
  
  ll X=1000000000000;
  ll p=sqrt(N);
  
  for(int i=1;i<=p;++i){
    if(N%i==0){
      ll j=N/i;
      ll k=i+j;
      X=min(k,X);
    }
  }
  
  cout<<X-2<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int i, j, k, n, q, l, r;
  scanf("%d%d", &n, &q);
  char s[n + 10];
  scanf("%s", s);
  int sum[n + 1];
  sum[0] = sum[1] = 0;
  for(i = 1; i < n; ++i) {
    sum[i + 1] = sum[i];
    if(s[i - 1] == 'A' && s[i] == 'C') sum[i + 1]++;
  }
  for(i = 0; i < q; ++i) {
    scanf("%d%d", &l, &r);
    printf("%d\n", sum[r] - sum[l]);
  }
  return 0;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


bool check(int x, char c) {
  return to_string(x).find(c) != string::npos;
};

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

  vector<char> d(k);
  REP (i, k) cin >> d[i];

  while (true) {
    bool flag = true;
    REP (i, k) {
      if (check(n, d[i])) flag = false;
    }
    if (flag) break;
    n++;
  }
  cout << n << endl;
}


Measured memory_bytes: 256