akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
  int n, a, b, r = 0;
  cin >> n >> a >> b;
  rep(i, n + 1) {
    int sum = 0, copy = i;
    while (1) {
      if (copy < 10) break;
      sum += (copy % 10);
      copy /= 10;
    }
    sum += copy;
    if (a <= sum && sum <= b) r += i;
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
 
bool isprime(int n){
	int m = sqrt(n);
	for(int i = 2; i <= m; i++){
		if(n % i == 0) return 0;
	}
	return 1;
}
 
int main()
{
	int n;
	cin >> n;
	int k = 11;
	while(n){
		if(isprime(k) && k % 10 == 1){
			cout << k << ' ';
			n--;
		}
		k += 10;
	}
	cout << endl;
	return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef int64_t ll;
typedef long double ld;

const int INF = 2e9;
const ld EPS = 1e-8;

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(){
  int N;
  cin >> N;
  vector<int> H(N + 1);
  REP(i,N) cin >> H[i];
  H[N] = INF;

  vector<int> dp(N + 1, 0);
  for (int i = N - 1; i >= 0; --i) {
    if (H[i] >= H[i + 1]) {
      dp[i] = dp[i + 1] + 1;
    } else {
      dp[i] = 0;
    }
  }

  int ret = *max_element(ALL(dp));
  cout << ret << endl;
  return 0;
}



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

using tu = tuple<string, int, int>;
bool comp(tu lhs, tu rhs){
    if(get<0>(lhs)<get<0>(rhs)) return true;
    else if(get<0>(lhs)>get<0>(rhs)) return false;

    if(get<1>(lhs)>=get<1>(rhs)) return true;
    else return false;
}

int main() {
    int N; cin >> N;
    vector<tu> v(N);
    for (int i = 0; i < N; i++)
    {
        string s; cin >> s;
        int p; cin >> p;
        v[i] = make_tuple(s, p, i+1); 
    }
    sort(v.begin(), v.end(), comp);

    for(auto i: v){
        cout << get<2>(i) << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b);
#define chmin(a, b) a = min(a, b);
using namespace std;
using ll = long long;
using P = pair<int,int>;

#define MOD 1000000007
//#define MOD 998244353
struct mint {
	int i;
	mint() : i(0) {}
	mint(int x) {
		i = int(x % MOD);
		if (i < 0) i += MOD;
	}
	template<class T> mint(T x) {
		i = int(x % MOD);
		if (i < 0) i += MOD;
	}
	mint operator+(const mint x) const {return i + x.i;}
	mint operator-(const mint x) const {return i - x.i;}
	mint operator*(const mint x) const {return (long long)i * x.i;}
	mint operator/(const mint x) const {return (long long)i * x.pow(MOD - 2).i;}
	mint inv() {return pow(MOD - 2);}
	template<class T> mint pow(T p) const {
		long long r = 1;
		long long t = i;
		for(; p > 0; p >>= 1) {
			if (p & 1) r = r * t % MOD;
			t = t * t % MOD;
		}
		return r;
	}
	template<class T1, class T2> static mint pow(T1 a, T2 b) {
		long long r = 1;
		long long t = (long long)(a % MOD);
		for(; b > 0; b >>= 1) {
			if (b & 1) r = r * t % MOD;
			t = t * t % MOD;
		}
		return r;
	}
	mint& operator+=(const mint x) {
		i = (i + x.i) % MOD;
		return *this;
	}
	mint& operator-=(const mint x) {
		i = i - x.i;
		if (i < 0) i += MOD;
		return *this;
	}
	mint& operator*=(const mint x) {
		i = (int)((long long)i * x.i % MOD);
		return *this;
	}
	mint& operator/=(const mint x) {
		i = (long long)i * x.pow(MOD - 2).i % MOD;
		return *this;
	}
};

std::ostream& operator<<(std::ostream& os, const mint& m) {
	return os << m.i;
}



template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};


int main() {
    int n, k;
    cin >> n >> k;
    BIT<mint> dp(k+1);
    dp.add(0, 1);
    rep(_, n) {
        int a;
        cin >> a;
        BIT<mint> ndp(k+1);
        rep(i, k+1) {
            int lb = max(0, i-a);
            ndp.add(i, dp.sum(lb, i+1));
        }
        swap(dp, ndp);
    }
    cout << dp.sum(k, k+1) << endl;
}


Measured memory_bytes: 4344
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static boolean solve() {
		int x = in.nextInt();
		int y = in.nextInt();
		int s = in.nextInt();
		if (x + y + s == 0) return false;


		int max = 0;
		for (int i=1; i<s; i++) {
			for (int j=1; j<s; j++) {
				int a = i*(100+x)/100;
				int b = j*(100+x)/100;
				if (a + b != s) continue;
				max = Math.max(max, i*(100+y)/100 +  j*(100+y)/100);
			}
		}

		out.println(max);

		return true;
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		while(solve());
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

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

int main(){
    int n;
    scanf("%d", &n);
    char s[n];
    scanf("%s", s);

    vector<int> r;
    vector<int> g;
    vector<int> b;
    for (int i=0;i<n;i++){
        if (s[i] == *"R"){
            r.emplace_back(i+1);
        }
        else if (s[i] == *"G"){
            g.emplace_back(i+1);
        }
        else if (s[i] == *"B"){
            b.emplace_back(i+1);
        }
    }

    ll result = r.size() * g.size() * b.size();
    rep(i,n){
        rep1(j,(n-i-1)/2){
            if (s[i] != s[i+j] && s[i+j] != s[i+j+j] && s[i] != s[i+j+j]){
                // printf("%d,%d\n",i,j);
                // printf("%c",s[i]);
                // printf("%c",s[i+j]);
                // printf("%c",s[i+j+j]);
                result--;
            }
        }
    }

    printf("%lld",result);
}

Measured memory_bytes: 3752
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iostream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <bitset>
# include <set>
# include <cmath>
# include <algorithm>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-8
# define MOD 1000007
# define INF 1000000000
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define FDR(i,a,n) for(int i=a; i>=n; --i)
# define bug puts("H");
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
inline int Scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
inline void Out(int a) {
    if(a<0) {putchar('-'); a=-a;}
    if(a>=10) Out(a/10);
    putchar(a%10+'0');
}
const int N=305;
//Code begin...

int a[N][N], n, m;
bool vis[N];
int now[N], num[N];

bool check(int x){
    FOR(i,1,n) now[i]=1;
    mem(vis,false);
    int j=0;
    while (j<m) {
        mem(num,0);
        FOR(i,1,n) {
            while (vis[a[i][now[i]]]) ++now[i];
            ++num[a[i][now[i]]];
        }
        bool flag=true;
        FOR(i,1,m) if (num[i]>x) {
            flag=false; ++j; vis[i]=true;
            if (j>=m) return false;
        }
        if (flag) {return true;}
    }
    return false;
}
int main ()
{
    scanf("%d%d",&n,&m);
    FOR(i,1,n) FOR(j,1,m) scanf("%d",&a[i][j]);
    int l=1, r=n+1, mid;
    while (l<r) {
        mid=(l+r)>>1;
        if (check(mid)) r=mid;
        else l=mid+1;
    }
    printf("%d\n",r);
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

vector<ll>relation[20], money(20, 1);
int dp[110][110];

int keta(int x) {
	int y = 0;
	while (x > 0) {
		y++;
		x /= 10;
	}
	return y;
}

bool a[10101][10101];
int s[101][101];

int main() {
	int n;
	cin >> n;
	vector<double>x(n), y(n), z(n);
	rep(i, n) {
		cin >> x[i] >> y[i];
		z[i] = i;
	}
	double ans = 0;
	do {
		for (int i = 0;i < n-1;++i) {
			ans += sqrt((x[z[i + 1]] - x[z[i]]) * (x[z[i + 1]] - x[z[i]]) + (y[z[i + 1]] - y[z[i]]) * (y[z[i + 1]] - y[z[i]]));
		}
	} while (next_permutation(z.begin(), z.end()));
	for (int i = 1;i <= n;++i) {
		ans /= i;
	}
	printf("%f\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int x[100000], dat[100000], n, W, dp[100000], nex[100000];
priority_queue<pair<int, int>, vector<pair<int, int>>, less<pair<int, int>>>Q;
void add(int p, int q) {
	while (p <= n) {
		dat[p] += q;
		p += p&-p;
	}
}
int sum(int p) {
	int sum2 = 0;
	while (p >= 1) {
		sum2 += dat[p];
		p -= p&-p;
	}
	return sum2;
}
int Rangesum(int W1, int W2) {
	return sum(W2) - sum(W1 - 1);
}
int hantei(int L1, int R1) {
	if (L1 == 0)return 2147000000;
	int E = Rangesum(L1, R1);
	E += (R1 - L1);
	return E;
}
int main() {
	while (true) {
		cin >> W >> n; for (int i = 0; i < 100000; i++) { dat[i] = 0; dp[i] = 999999999; nex[i] = -2; }
		if (n == 0 && W == 0)break;
		for (int i = 1; i <= n; i++)cin >> x[i]; add(1, x[1]); dp[0] = 1;
		while (!Q.empty())Q.pop(); Q.push(make_pair(99999999, 1)); Q.push(make_pair(0, 0));

		for (int i = 2; i <= n - 1; i++) {
			add(i, x[i]);
			int L = 1, R = i, M = 0;
			while (true) {
				M = (L + R) / 2;
				int V1 = hantei(M, i);
				int V2 = hantei(M - 1, i);
				if (V1 <= W && V2 > W) {
					int j = M;
					while (true) {
						int KO = i - j;
						int V1 = hantei(j, i);
						dp[i] = min(dp[i], max(dp[j - 1], ((W - V1) + KO - 1) / KO + 1));
						j = nex[j - 1] + 1; if (j == -1 || j >= i)break;
					}
					break;
				}
				if (V1 > W)L = M;
				if (V2 <= W)R = M;
			}
			while (!Q.empty()) {
				if (dp[i] < Q.top().first) { nex[Q.top().second] = i; Q.pop(); }
				else { break; }
			}
			Q.push(make_pair(dp[i], i));
		}
		add(n, x[n]); int minx = 999999999;
		for (int i = 0; i < n; i++) {
			if (Rangesum(i + 1, n) + (n - (i + 1)) <= W)minx = min(minx, dp[i]);
		}
		cout << minx << endl;
	}
	return 0;
}

Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using E = tuple<ll, int, ll>;
const ll inf = numeric_limits<ll>::max()/3;
const ll mod = 1e9 + 7;

int main(void){
  int n,q;
  scanf("%d %d", &n, &q);
  vector< E > event;
  for(int i = 0;i < n;++i){
    ll s,t,x;
    scanf("%lld %lld %lld", &s, &t, &x);
    event.push_back(E{max(0LL,s - x),1,x});
    event.push_back(E{max(0LL,t - x),2,x});
  }
  for(int i = 0;i < q;++i){
    ll d;
    scanf("%lld", &d);
    event.push_back(E{d,3,-1});
  }
  sort(event.begin(),event.end());
  multiset< ll > res;
  for(E e : event) {
    ll t,x;
    int tag;
    tie(t,tag,x) = e;
    if(tag == 1){
      res.insert(x);
    }else if(tag == 2){
      auto ptr = res.find(x);
      res.erase(ptr);
    }else{
      if(res.empty()){
        puts("-1");
      }else{
        printf("%lld\n", *res.begin());
      }
    }
  }
  return 0;
}


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

using namespace std;
// (setq-default c-basic-offset 2)

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

  reverse(s.begin(), s.end());

  int n = s.size();
  vector<int> sm(n + 1);

  vector<int> cnts(2019);
  cnts[0]++;
  int d = 1;
  for (int i = 0; i < n; ++i) {
    int digit = s[i] - '0';
    sm[i + 1] = ((digit * d) % 2019 + sm[i]) % 2019;
    d = (10 * d) % 2019;

    cnts[sm[i + 1]]++;
  }

  int ret = 0;
  for (int cnt : cnts) {
    ret += cnt * (cnt - 1) / 2;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 4344
#ifdef __GNUC__
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#endif

#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>

#include <string>
#include <cstring>
#include <vector>
#include <valarray>
//#include <array>//x C++ (G++ 4.6.4)

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <cassert>//assert();
#include <fstream>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)

/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#define PII pair<int,int>
/////////
using namespace::std;

// 最大公約数
template<class T>
inline T gcd(T a, T b){return b == 0 ? a : gcd(b, a % b);}
// 最小公倍数
template<class T>
inline T lcm(T a, T b){return a * b / gcd(a, b);}
////////////////////////////////
int N,M;
vector<string> A,B;
bool check(int R,int C){
	bool flag = true;
	for(int i=0;i<M;++i){
		for(int j=0;j<M;++j){
			if( B[i][j] != A[i+R][j+C] ){
				return false;
			}
		}
	}
	return flag;
}
inline void solve(){
	cin >> N >> M;
	A = vector<string>(N);
	B = vector<string>(M);
	for(int i=0;i<N;++i){
		cin>> A[i];
	}
	for(int i=0;i<M;++i){
		cin >> B[i];
	}
	for(int R=0;R+M-1<N;++R){
		for(int C=0;C+M-1<N;++C){
			if( check(R,C) ){
				cout << "Yes" << endl;
				return;
			}
		}
	}
	cout << "No" << endl;
}

signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	//std::cout << std::fixed;//小数を10進数表示
	//cout << setprecision(16);//小数をいっぱい表示する。16?

	solve();
}


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

using namespace std;

class range {
private:
  struct Iterator {
    int val, inc;
    int operator*() {return val;}
    bool operator!=(Iterator& itr) {return val != itr.val;}
    void operator++() {val += inc;}
  };
  Iterator i, n;
public:
  range(int n) : i({0, 1}), n({n, 1}) {}
  range(int i, int n) : i({i, 1}), n({n, 1}) {}
  range(int i, int inc, int n) : i({i, inc}), n({n, inc}) {}
  Iterator& begin() {return i;}
  Iterator& end() {return n;}
};

template<class T> inline T at(const vector<T> &v, int i) {return v[(i % (int)v.size() + v.size()) % v.size()];}

template<class T> inline bool is_max(T &a, const T &b) {return a < b ? a = b, true : false;}
template<class T> inline bool is_min(T &a, const T &b) {return a > b ? a = b, true : false;}

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) break;
    vector<string> s(n);
    for (int i : range(n)) cin >> s[i];
    for (int i : range(n)) for (int j : range(s[i].size() - 1)) if (s[i][j] == '.' && s[i][j + 1] != '.') s[i][j] = '+';
    for (int i : range(n - 2, -1, -1)) for (int j : range(s[i].size())) if (s[i][j] == '.' && j < (int)s[i + 1].size() && (s[i + 1][j] == '+' || s[i + 1][j] == '|')) s[i][j] = '|';
    for (string& str : s) for (char& c : str) if (c == '.') c = ' ';
    for (const string& str : s) cout << str << endl;
  }
}

Measured memory_bytes: 1852
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define sz(x) (int)(x).size();
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
int32_t main()
{
	int n=in();
	int u,v;
	vector<vector<int>> g(n);
	for(int i=1;i<n;i++)
	{
		u=in();v=in();
		u--;v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	
	queue<int> q;
	q.push(0);q.push(n-1);
	vector<int> col(n,-1);
	col[n-1]=0;col[0]=1;
	vector<int> ct(2);
	while(!q.empty())
	{
		int t=q.front();q.pop();
		for(auto c:g[t])
		{
			if(col[c]==-1)
			{col[c]=col[t];q.push(c);ct[col[c]]++;}
		}
	}
	
	if(ct[0]>=ct[1])
	puts("Snuke");
	else puts("Fennec");
}

Measured memory_bytes: 10008
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+7;
ll a[maxn],n;
int main(){
	cin>>n;
	ll b=0,c=0;
	for(ll i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]%2==0){
			b++;
			if(a[i]%3==0||a[i]%5==0) c++;
			//if(a[i]%3==0&&a[i]%5==0) c--;
		}
	}
	if(b==c) puts("APPROVED");
	else puts("DENIED");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    for(int i = 1; i <= n; i++){
      int x = i;
      if(x % 3 == 0){
        System.out.print(" " + i);
      }
      else{
        do{
          if(x % 10 == 3){
            System.out.print(" " + i);
            x = 0;
          }
          x /= 10;
        }while(x != 0);
      }
    }
    System.out.println();
  }
}

Measured memory_bytes: 28864
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String s = scan.next();
        int out = 0;
        for(int i = 0; i < n; i++){
            out = Math.max(out, count(s.substring(0, i), s.substring(i, n)));
        }
        System.out.println(out);
    }

    int count(String s, String t){
        int ret = 0;
        HashSet<Character> set = new HashSet<>();
        HashSet<Character> tset = new HashSet<>();
        for(int i = 0; i < s.length(); i++) set.add(s.charAt(i));
        for(int i = 0; i < t.length(); i++){
            Character c = t.charAt(i);
            if(set.contains(c) && !tset.contains(c)) ret++;
            tset.add(c);
        }
        return ret;
    }

    public static void main(String[] args){
        new Main().solve();
    }
}


Measured memory_bytes: 36788
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define Js for(int i=0;i<Len;i++) {
#define is if(c[i]=='C') p=1;
#define a if(c[i]=='F' && p==1) q=1;}
#define sha if(p&&q) cout<<"Yes\n"<<endl; else cout<<"No\n";
#define bi return 0;}
using namespace std;
char c[105];
int main() {
    scanf("%s",c);
    int p=0,q=0;
    int Len=strlen(c);
    Js is a sha bi

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int n;
    cin >> n;
    int p[n];
    REP(i,n){
        cin >> p[i];
    }
    int ans = 0;
    REP(i,n - 1){
        if(p[i] == i + 1){
            swap(p[i], p[i + 1]);
            ans++;
        }
    }
    if(p[n - 1] == n){
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>

using namespace std;
int main()
{
	int n;
	cin >> n;
	string ans;
	if(n == 25)
		ans = "Christmas";
	else if(n == 24)
		ans = "Christmas Eve";
	else if(n == 23)
		ans = "Christmas Eve Eve";
	else
		ans = "Christmas Eve Eve Eve";
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define null nullptr
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

using namespace std;

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;
typedef unordered_map<int,int> mp;

const int mod = 1e9+7;
const int least = -1e9;
const int most = 1e9;


int32_t main(){
    FAST;
    
   
 
    int n;	cin >> n;
    vi a(n+2,least) ;	for(int x=1;x<=n;x++)	cin >> a[x];

    vi pref = a , suff = a;

    for(int x=1;x<=n;x++) pref[x] = max(pref[x] , pref[x-1]);
    for(int x=n-1;x>0;x--)  suff[x] = max(suff[x]  , suff[x+1]);

    for(int x=1;x<=n;x++){
    	cout << max(pref[x-1] , suff[x+1]) << " ";
    }


    return 0;
}


Measured memory_bytes: 6272
#include<iostream>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back

#define rep(i, N) for(int i = 0; i < N; i++)
#define repa(i, a, N) for(int i = a; i < N; i++)
#define repr(i, N) for(int i = N-1; i >= 0; i--)

#define drep(i, N, j, M) rep(i, N) rep(j, M)
#define trep(i, N, j, M, k, L) rep(i, N) rep(j, M) rep(k, L)

const ll mod = 1e9 + 7;
// const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}

const int M = 60;
ll f[M+1][2][2][2];

int main() {
	ll M, D;
	cin >> M >> D;
	ll ans = 0;

	rep(m, M) {
		rep(d, D) {
			ll d1 = (d+1) % 10;
			ll d2 = ((d+1) / 10) % 10;
			if (d1 >= 2 && d2 >= 2 && d1 * d2 == m + 1) {
				ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL long long
LL read(){
	LL f=1,x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f*x;
}
#define MAXN 200
#define INF 0x3f3f3f3f
int main(){
	int cnt=0,t=INF,ans=INF;
	int n=read(),l=read();
	for(int i=1;i<=n;i++)
		cnt+=l+i-1;
	for(int i=1;i<=n;i++){
		int tmp=0;
		for(int j=1;j<=n;j++)
			if(i!=j)
				tmp+=l+j-1;
		if(abs(tmp-cnt)<t)
			t=abs(tmp-cnt),ans=tmp;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    string b;
    cin >> b;

    switch (b[0] - 'A')
    {
    case 'A' - 'A':
        cout << "T" << endl;
        break;
    case 'T' - 'A':
        cout << "A" << endl;
        break;
    case 'C' - 'A':
        cout << "G" << endl;
        break;
    case 'G' - 'A':
        cout << "C" << endl;
        break;

    default:
        break;
    }

    return 0;
}

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

void fastio()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
}

void solve()
{

  int n;cin>>n;
  n%=1000;
  cout<<(1000-n)%1000;
}

int32_t main()
{
    // fastio();
    // int t;cin>>t;
    // while(t--)
        solve();
    return 0;
}

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

#define pb push_back
#define rep(i, a, n) for(int (i)=a; (i)<(n); (i)++)
#define FOR(i, n) rep(i, 0, n)
#define F(n) FOR(i, n)
#define FF(n) FOR(j, n)
#define repi(i, a, n) for(int (i)=a; (i)<=(n); (i)++)
#define FORI(i, n) repi(i, 1, n)
#define FI(n) FORI(i, n)
#define FFI(n) FORI(j, n)
#define IN(x) int x; cin>>(x);
#define SIN(x) string x; cin>>x;
#define INN(x, y) int x, y; cin>>(x)>>(y);
#define INFO(a) cout<<"info "<<a<<endl
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define vpii vector<pair<int, int> >
#define sortv(x) sort((x).begin(), (x).end())
#define sortvd(x) sort((x).begin(), (x).end(), greater<int>())
#define lboundv(x,v) lower_bound((x).begin(),(x).end(),(v))-(x).begin();
#define uboundv(x,v) upper_bound((x).begin(),(x).end(),(v))-(x).begin();
#define ite iterator
#define fi first
#define se second
#define mems(a, v) memset((a), (v), sizeof((a)))
#define lmid(l, r) ((l)+(r)-1)/2
#define rmid(l, r) ((l)+(r))/2+1
#define mp make_pair

typedef long long ll;
typedef long double LD;

using namespace std;

#define N 500005
int main() {
	ios::sync_with_stdio(0);
	int a, b, c;
	cin>>a>>b>>c;
	if(a==b) cout<<c;
	else if(c==a) cout<<b;
	else cout<<a;
	return 0;
}

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

int main(){
    int h,n;
    cin>>h>>n;
    vector<int> a(n);
    int total =0;

    for (size_t i = 0; i < n; i++)
    {
        cin>>a.at(i);
        total += a.at(i);
    }


    if(total >= h){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define INF int(1e-6)
#define MAX int(1e9)
typedef long long ll;



int main (){
	int a,b;
	cin >> a>>b;
	int m = max((a+b),max((a*b),(a-b)));
	cout << m << "\n";
	
	return 0;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M(a,b) memset(a,b,sizeof a)
using namespace std;
const int maxn=1e2+7;
char a[maxn][maxn];
bool visx[maxn],visy[maxn];
int main()
{
    int h,w;
    M(visx,false);
    M(visy,false);
    scanf("%d%d",&w,&h);
    for(int i=0; i<w; i++)
    {
        scanf("%s",a[i]);
        for(int j=0;j<h;j++)
            if(a[i][j]=='#')visy[j]=visx[i]=true;
    }
    for(int i=0; i<w; i++)
    {
        if(visx[i])
        {
            for(int j=0;j<h;j++)
            {
                if(visy[j]) printf("%c",a[i][j]);
            }
            puts("");
        }
    }
}

Measured memory_bytes: 256
if __name__ == '__main__':
    A, B, C, D, E, F = map(int, input().split())
    
    mx = 0
    sugar_weight = 0
    water_weight = 0
    for a in range(F // (100 * A) + 1):
        A_w = 100 * A * a
        for b in range((F - A_w) // (100 * B) + 1):
            B_w = 100 * B * b
            for c in range((F - (A_w + B_w)) // C + 1):
                C_w = C * c
                for d in range((F - (A_w + B_w + C_w)) // D + 1):
                    D_w = D * d
                    if a == 0 and b == 0:
                        pass
                    elif C * c + D * d <= E * (A * a + B * b):
                        if mx <= (100 * (C_w + D_w)) / (A_w + B_w + C_w + D_w):
                            mx = (100 * (C_w + D_w)) / (A_w + B_w + C_w + D_w)
                            sugar_weight = C_w + D_w
                            water_weight = A_w + B_w + C_w + D_w

    print(water_weight, sugar_weight)

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

int main(){
  int N;
  string S;
  cin>>N>>S;
  if(N%2==1){
    cout<<"No"<<endl;
    return 0;
  }
  for(int i=0;i<N/2;i++)
    if(S[i]!=S[i+N/2]){
      cout<<"No"<<endl;
      return 0;
    }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
A=input()
B=input()

if len(A)<len(B):
    print("LESS")
elif len(A)>len(B):
    print("GREATER")
else:
    cnt=0
    for i in range(len(A)):
        if A[i]>B[i]:
            print("GREATER")
            break
        elif A[i]<B[i]:
            print("LESS")
            break
        else:
            cnt+=1
    if cnt==len(A):
        print("EQUAL")


Measured memory_bytes: 3060
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using static System.Console;
using static System.Math;

namespace YukiCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            int[] p = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int a1 = p[0];
            int a2 = p[1];
            int a3 = p[2];

            if (a1 + a2 + a3 >= 22)
            {
                Console.WriteLine("bust");
            }
            else
            {
                Console.WriteLine("win");
            }
            
        }
    }
}

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

#define ld long double
#define ll long long
 
int main(){
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        //freopen("test.txt","r",stdin);
        //freopen("output.txt","w",stdout);
    #endif*/
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;

    int a,b;cin>>a>>b;
    if(abs(a - b) % 2){
        cout<<"IMPOSSIBLE";
    }
    else {
        cout<<min(a,b) + abs(a - b) / 2;
    }

    /*#ifndef ONLINE_JUDGE
        cout << "\nTime Elapsed : " << 1.0 * clock() << " ms\n";
    #endif*/
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    cin >> n;
    
    vector<vector<P>> G(n);
    rep(i, n-1) {
        ll a, b, cost;
        cin >> a >> b >> cost;
        a--;  b--;
        G[a].pb(make_pair(b, cost));
        G[b].pb(make_pair(a, cost));
    }
    
    vl dist(n, -1);  // dist[v] : 頂点vの根からの距離
    queue<ll> Q;
    const ll root = 0;  // デフォルトで根は頂点0
    dist[root] = 0;
    Q.push(root);
    while(!Q.empty()) {
        ll v = Q.front();
        Q.pop();
        for(auto p : G[v]) {
            ll u = p.first;
            ll cost = p.second; 
            if(dist[u] != -1) {
                continue;
            }
            dist[u] = dist[v] + cost;
            Q.push(u);
        }
    }

    vl ans(n);
    rep(i, n) {
        if(dist[i]%2 == 1) {
            ans[i] = 1;
        }
    }
    
    rep(i, n) {
        out(ans[i]);
    }
    
    re0;
}

Measured memory_bytes: 9472
/*
Created by Rishu Sahu @ covid 20-20
*/
/*
*****************************************************************
*/

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

#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define pai pair<int,int>
#define pal pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,a,b) for(int i=a;i<=b;i++)
#define ff first 
#define ss second
#define sz(x) (int)x.size()
#define vi vector<int>
#define vl vector<ll>
#define mpl map<ll,ll>
#define mpi map<int,int>
#define pb push_back
#define all(x) x.begin(),x.end()

const int mod = 1e9+7;
const int INF = INT_MAX;
const int mxm = 500000;

int dp[mxm],arr[mxm];

void solve(){
    int n,k;
    cin>>n>>k;
    rep(i,n) cin>>arr[i];
    dp[0]=0;
    //dp[1]=abs(arr[0]-arr[1]);
    for(int i=1;i<n;i++){
        dp[i]=INF;
        for(int j=max(0,i-k);j<i;j++){
            dp[i]=min(dp[i],dp[j]+abs(arr[i]-arr[j]));
        }
    }
    cout<<dp[n-1]<<endl;
}

int main(){
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 4412
a, b =map(int,input().split())

x = 9
while True:
  if a == int(x * 0.08) and b == int(x*0.1):
    print(x)
    break
  elif a < int(x * 0.08) and b < int(x*0.1):
    print(-1)
    break
  x += 1


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
#include<numeric>
#include<limits>
#include<type_traits>
using namespace std;

static const int MAX_NUM = 11;
static const int INF = 9999;

int main(void){
  string S;
  int num[MAX_NUM];
  int min_ans = INF;
  cin >> S;
  //intへの変換
  for(int i = 0; i < S.size(); i++){
    num[i] = S[i] - '0';
  }
  //全探索で連続3文字を持って行った時の差を求める。
  for(int i = 0; i < S.size() - 2; i++){
    int fetched_number = 100 * num[i] + 10 * num[i + 1] + num[i + 2];
    int diff = abs(fetched_number - 753);
    if(min_ans > diff) min_ans = diff;
  }
  cout << min_ans << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;
U_MAP mp;

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

  cin >> n;
  rep(i, n) cin >> a[i];
  rrrep(i, n - 1, 0) {
    ans += mp[a[i] + i];
    mp[a[i] * -1 + i]++;
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 20048
#include<bits/stdc++.h>
#define SIZE 100005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;


int N,Q,gx,gy,ans;
int t[100005],x[100005],y[100005];


int main(){
	cin >> N;
	for(int i=0;i<N;i++) cin >>t[i]>>x[i]>>y[i];
	if((x[0]%2)+(y[0]%2)!=(t[0]%2)||x[0]+y[0]>t[0]){
		cout <<"No"<<endl;
		return 0;
	}
	for(int i=1;i<N;i++){
		int d1=0,d2=0;
		d1=abs(x[i]-x[i-1]);
		d2=abs(y[i]-y[i-1]);
		Q=t[i]-t[i-1];
		if(abs(x[i]-x[i-1])+abs(y[i]-y[i-1])>t[i]-t[i-1]){
			cout <<"No"<<endl;
			return 0;
		}
		d1=d1%2;d2=d2%2;Q=Q%2;
		int d=0;
		d=(d1+d2)%2;
		if(d!=Q){
			cout <<"No"<<endl;
			return 0;
		}
	}
	cout <<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
typedef vector<pi> vpi;
typedef long double ld;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 3;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < b; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define lb lower_bound
#define ub upper_bound
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod);
#define mod_in(a) exp(a, mod-2)
#define ncr(n, r) ((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod)
#define deb(x) cout << #x << " " << x << endl;
#define flash ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
ll prime[100002];
ll exp(ll a,ll b);
void sieve(ll n);
ll gcd(ll a ,ll b);
ll countdigit(ll n);

int main()
{
    ll t;
    t=1;
    while(t--) {
        ll n,k;
        cin >> n;
        ll a[n];
        ll mx=0,mx2=0;
        rep(i,0,n){
            cin >> a[i];
        }
        ll idx=0,f=0,ans=0;
        rep(i,1,n){
            if(a[i]<a[i-1]&&f==0){
                idx=a[i-1];
                f=1;
            }
            if(f==1){
                if(a[i]>=idx){
                    f=0;
                }
                else{
                    ans+=(idx-a[i]);
                }
            }
        }
        cout<<ans<<endl;
        

    }
    
}


//
//
//
//
//
// IMPORTANT FUNCTIONS
ll exp(ll a, ll b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
ll gcd(ll a,ll b){
    if(a==0)return b;
    return gcd(b%a,a);
}
void sieve(ll n) {
    for(ll i=0;i<=n;i++) {
        prime[i]=1;
    }
    prime[0]=0;prime[1]=0;
    for(ll i=2;i<=n;i++) {
        if(prime[i]==1) {
            for(ll j=2;i*j<=n;j++) {
                prime[i*j]=0;
            }
        }
    }
}
ll countdigit(ll  n)
{
    return floor(log10(n) + 1);
}


Measured memory_bytes: 5184
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n = in.nextInt();
        long k = in.nextInt();
        long x = in.nextInt();
        long y = in.nextInt();
        
        long sum = 0;
        
        if(n >= k){
            sum += k * x;
            sum += (n - k) * y;
        }
        else{
            sum += n * x;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 27000
S, T = input(), input()
cnt1, cnt2 = [0] * 30, [0] * 30
for s in S:
    cnt1[ord(s)-97] += 1
for t in T:
    cnt2[ord(t)-97] += 1
if all(c1==c2 for c1, c2 in zip(sorted(cnt1), sorted(cnt2))):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 41712
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main(){
	int a, b, c, d;
	string s;
	cin >> c >> a >> b;
	for (int i = a; i <= b; i++) {
		if (i % c == 0) {
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3596
N = int(input())
Ps = list(map(int, input().split()))
Index=[]
for i in range(N):
    if i+1 == Ps[i]:
        Index.append(i+1)

flag = 1
cnt = 0
L = len(Index)
for i in range(L - 1):
    if flag and (Index[i+1] == Index[i]+1):
        cnt += 1
        flag = 0
    else:
        flag = 1

print(str(L - cnt))

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

#define __STDC_FORMAT_MACROS
#define p64 PRId64

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(f, x, ...)                                                         \
    ([&] (decltype ((x)) ALL) {                                                \
        return (f) (begin (ALL), end (ALL), ##__VA_ARGS__);                    \
    }) (x)

using namespace std;
using ll = int64_t;

int main() {
    string S;
    cin >> S;
    int ans = 0;
    REP (i, S.length() / 2)
    if (S[i] != S[S.length() - i - 1])
        ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3576
N, K = map(int, input().split())
G = [[] for n in range(N)]
for n in range(N-1):
    a, b = map(int, input().split())
    G[a - 1].append(b - 1)
    G[b - 1].append(a - 1)

C = [0] * N
for k in range(K):
    p, x = map(int, input().split())
    C[p - 1] += x

# 親情報の作成
P = [-1]*N
Q = [0]
X = []
count = 0
while Q:
    v = Q.pop()
    X.append(v)
    if v != 0:
        C[v] += C[P[v]]
    for u in G[v]:
        if u == P[v]:
            continue
        P[u] = v
        Q.append(u)

C = [str(c) for c in C]
print(" ".join(C))


Measured memory_bytes: 66336
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef pair<int, int> pii;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


class A {
	int m;
public:
	A()
	{
		cin >> m;
	}
	void solve()
	{
		cout << 24 + (24 - m);
	}
};


int main()
{
	A solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import Data.Foldable (foldMap)
import Data.List.Split
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
applyBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
applyBin op f g x = op (f x) $ g x
applyUni :: (a -> b -> c) -> (a -> b) -> a -> c
applyUni op f x = op x $ f x
applyTuple :: (a -> b, a -> c) -> a -> (b, c)
applyTuple (f,g) a = (f a, g a)
-- end of templete

rpn ts = rpn' [] ts
rpn' (r:_) [] = r
rpn' s (t:ts)
  | all isDigit t || (length t > 1 && head t == '-' && all isDigit (tail t)) = rpn' (readDouble t : s) ts
  | otherwise = rpn' (calc : drop 2 s) ts
  where
    calc = op (s!!1) (s!!0)
    op 
      | t=="+" = (+)
      | t=="-" = (-)
      | t=="*" = (*)
      | t=="/" = (/)

main = map (rpn . words) . lines <$> getContents >>= mapM_ print

Measured memory_bytes: 4364
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Main {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve() {
		int S = ni(), W = ni();
		out.println(W >= S ? "unsafe" : "safe");
	}


	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

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

int main() {
    string s;
    cin >> s;
    ll ans=0;
    for(int bit = 0; bit < (1 << s.size() - 1); bit++){
        ll tmp = 0;
        for(int i = 0;i < (s.size()-1); i++){
            tmp *= 10;
            tmp += s[i] - '0';
            if(bit & (1<<i)){
                ans += tmp;
                tmp = 0;
            }
        }
        tmp *= 10;
        tmp += s[s.size() - 1] - '0';
        ans += tmp;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3520
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
using namespace std;
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>

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

    int n;
    cin>>n;
    ll ch=__gcd(2,n);
    if(ch==1){cout<<n*2;}
    else{cout<<n;}

return(0);
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  bool f = 0;
  int a, b;
  while (cin >> a >> b) {
    if (a == b && a == 0) break;
    if (f) cout << endl;
    for (f = 0; a <= b; a++) {
      if ((a % 4 == 0) && ((a % 100 != 0) || (a % 400 == 0))) {
        cout << a << endl;
        f = 1;
      }
    }
    if (!f) cout << "NA" << endl;
    f = 1;
  }
  return 0;
}

Measured memory_bytes: 1160