akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define inc(a) scanf("%c", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
//      puts(a) printf("%s\n", a) 文字はこっち
//your code here!
int main(void){
    ll N, isThree=1;
    char S;
    in(N);
    rep(_, N){
        inc(S);
        if(S=='Y') isThree = 0;
    }
    puts(isThree ? "Three":"Four");
    return 0;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n,m,k; cin>>n>>m>>k;
  vll a(n), b(m);
  rep(i,n) cin>>a[i];
  rep(i,m) cin>>b[i];
  
  vll s(n+1), t(m+1);
  rep(i,n) s[i+1]=s[i]+a[i];
  rep(i,m) t[i+1]=t[i]+b[i];
  
  
  ll ans=0;
  rep(i,n+1){
    ll rem=k-s[i];
    if(rem<0) break;
    
    ll cnt=upper_bound(all(t),rem)-t.begin();
    cnt--;
    
    chmax(ans,i+cnt);
    // cout<<i<<' '<<cnt<<endl;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 9516
import math


def find_point(x1, y1, x2, y2):
    # 二頂点(x1,y1),(x2,y2)を円周上にもつ時の半径1の円の中心
    if (x1-x2)**2+(y1-y2)**2 > 4:
        return False
    mx, my = (x1+x2)/2, (y1+y2)/2
    L = math.sqrt((y2-y1)**2+(x2-x1)**2)
    k = math.sqrt(1-((y2-y1)**2+(x2-x1)**2)/4)
    # (mx,my)+-(k/L)(-y2+y1,x2-x1)
    X1, Y1 = mx+(k/L)*(-y2+y1), my+(k/L)*(x2-x1)
    X2, Y2 = mx-(k/L)*(-y2+y1), my-(k/L)*(x2-x1)
    return ((X1, Y1), (X2, Y2))


def solve():
    N = int(input())
    if N == 0:
        return
    que = [tuple(map(float, input().split())) for _ in range(N)]
    ans = 1
    for i in range(N):
        for j in range(i+1, N):
            A = find_point(que[i][0], que[i][1], que[j][0], que[j][1])
            if A != False:
                a, b = A
                suba = 0
                subb = 0
                for k in range(N):
                    if math.hypot(que[k][0]-a[0], que[k][1]-a[1]) < 1+10**(-7):
                        suba += 1
                    if math.hypot(que[k][0]-b[0], que[k][1]-b[1]) < 1+10**(-7):
                        subb += 1
                ans = max(ans, suba, subb)
    print(ans)
    return solve()


def main():
    solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 6276
/*#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#define ll long long
#define N 500005
#define inf 1000000005
#define mod 1000000007
#define put putchar('\n')
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define D(i,a,b) for (int i=(a);i>=(b);i--)
#define go(i,t) for (int i=head[t];i;i=Next[i])
#define sqr(x) ((x)*(x))
#define re register
#define mp make_pair
#define fi first
#define se second
#define int ll
using namespace std;
inline int read(){char c=getchar();int tot=1;while ((c<'0'|| c>'9')&&c!='-') c=getchar();if (c=='-'){tot=-1;c=getchar();}
int sum=0;while (c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}return sum*tot;}
inline void wr(int x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(int x){wr(x);put;}inline void wri(int x){wr(x);putchar(' ');}
inline void wrn(int x,int y){wri(x);wrn(y);}inline void wrn(int a,int b,int c){wri(a);wrn(b,c);}
int n,m,vis[N],ans;
signed main(){
	n=read();
	F(i,1,n) vis[i]=(read()==i);
	F(i,1,n){
		if (vis[i]){
			ans++;vis[i]=0;
			if (vis[i+1]) vis[i+1]=0;
		}
	}
	wrn(ans);
	return 0;
}

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

using namespace std;

#define int long long

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

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)

#define rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

char S[12];

signed main(){
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  
  cin>>S;
	
	if(strlen(S)>3) {
		if((S[0]=='Y' && S[1]=='A') && (S[2]=='K' && S[3]=='I'))cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}else cout<<"No"<<endl;
  
  return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class CAlchemist {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<double> v(N);
        REP(i, N) {
            cin >> v[i];
        }
        sort(v.begin(), v.end());

        double cur = v[0];
        FOR(i, 1, N - 1) {
            cur = (cur + v[i]) / 2.0;
        }
        fcout << cur << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    CAlchemist solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]

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

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

fn main() {
    let N: usize = read();
    let mut A: Vec<i32> = read_vec();
    A.insert(0, 0);
    A.push(0);
    let total = (0..N+1).fold(0, |sum, i| sum + (A[i] - A[i+1]).abs());
    for i in 1..N+1 {
        println!("{}", total - (A[i-1]-A[i]).abs() - (A[i]-A[i+1]).abs() + (A[i-1]-A[i+1]).abs());
    }
}


Measured memory_bytes: 5244
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define pb push_back
int main(){
	int k1,k2; scanf("%d%d",&k1,&k2);
	printf("%d\n",(int)(k1%k2>0));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
LL S[123321], T[123321];
const LL MAX = 1e11;

int main(){
    
    // 1. 入力情報取得.
    LL A, B, Q;
    scanf("%lld %lld %lld", &A, &B, &Q);
    for(LL i = 0; i < A; i++) scanf("%lld", S + i);
    for(LL i = 0; i < B; i++) scanf("%lld", T + i);
    // for(LL i = 0; i < A; i++) printf("%lld ", S[i]);
    // printf("\n");
    // for(LL i = 0; i < B; i++) printf("%lld ", T[i]);
    // printf("\n");
    
    // 2. 最小の移動距離を計算し, 出力.
    for(LL i = 0; i < Q; i++){
        LL x;
        scanf("%lld", &x);
        // 神社一社を探索.
        LL s = lower_bound(S, S + A, x) - S;
        // 寺一軒を探索.
        LL t = lower_bound(T, T + B, x) - T;
        
        // 現在位置から, 左, 右 のいずれに進めば移動距離が, 最小となるかを検証.
        // 2-1. 神社: 左, 寺: 左.
        LL moveLL = MAX;
        if(s > 0 && t > 0) moveLL = max(x - S[s - 1], x - T[t - 1]);
        
        // 2-2. 神社: 左, 寺: 右.
        LL moveLR = MAX;
        if(s > 0 && t < B) moveLR = max(x - S[s - 1], T[t] - x) + 2 * min(x - S[s - 1], T[t] - x);
        
        // 2-3. 神社: 右, 寺: 左.
        LL moveRL = MAX;
        if(s < A && t > 0) moveRL = max(S[s] - x, x - T[t - 1]) + 2 * min(S[s] - x, x - T[t - 1]);

        // 2-4. 神社: 右, 寺: 右.
        LL moveRR = MAX;
        if(s < A && t < B) moveRR = max(S[s] - x, T[t] - x);
        
        // 2-5. 最小値を検証.
        LL move = min(moveLL, moveLR);
        move = min(move, moveRL);
        move = min(move, moveRR);
        // printf("x=%lld s=%lld t=%lld move=%lld\n", x, s, t, move);
        // printf("moveLL=%lld moveLR=%lld moveRL=%lld moveRR=%lld\n", moveLL, moveLR, moveRL, moveRR);
        printf("%lld\n", move);
    }
    
    // 3. 後処理.
    return 0;
    
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 5005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
string S;
ll t;
ll ret = 0;
ll table[ARRAY][ARRAY];

void input() {
  IN(N);
  IN(S);
  REP(i, ARRAY) {
    REP(j, ARRAY) {
      table[i][j] = -1;
    }
  }
}

ll headMatch(ll l, ll _l) {
  if (table[l][_l] != -1) {
    return table[l][_l];
  }

  ll mat = 0;
  while ((_l+mat < N) && (S[l+mat]==S[_l+mat])) {
    mat += 1;
  }
  REP(i, mat+1) {
    table[l+i][_l+i] = mat - i;
  }
  return table[l][_l];
}

void solve() {
  ll l=0, _l=1;
  REP(i, N-1) {
    FOR(j, i+1, N) {
      ll mat = headMatch(i, j);
      mat = CHMIN(mat, j-i);
      ret = CHMAX(ret, mat);
    }
  }
  PRINT(ret);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 195968
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define ld long double
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef vector <ll> vi;
#define out(x) return cout<<x,0;
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define lc(n) 2*n+1
#define rc(n) 2*n+2
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL)); 
const ll N = 5e5 + 5;

int main() {
    FAST;
    ll n, ans = 1e9, k, i, t, j, m, x = 0, y = 0, z, c = 0;
    cin >> n >> m >> k;

    ll a[n], b[m];
    for ( i = 0 ; i < n ; i ++ ) cin >> a[i];
    for ( i = 0 ; i < m ; i ++ ) cin >> b[i];

    for ( i = 0 ; i < k ; i ++ ){
        cin >> x >> y >> z;
        ans = min(ans, max(a[x - 1]+b[y - 1]-z, 0LL));
    }
    sort(a, a + n);
    sort(b, b + m);
    ans = min(ans, a[0] + b[0]);
    cout << ans;
}


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

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

// 素因数分解
vector<pair<ll, ll> > prime_factorize(ll n) {
  vector<pair<ll, ll> > res;
  for (ll a = 2; a * a <= n; ++a) {
    if (n % a != 0) continue;
    ll ex = 0;
    while (n % a == 0) {
      ++ex;
      n /= a;
    }
    res.push_back({a, ex});
  }
  if (n != 1) res.push_back({n, 1});
  return res;
}

int main() {
  ll a, b;
  cin >> a >> b;

  // 最大公約数を求める
  ll g = gcd(a, b);

  // G を素因数分解して、「素因数の個数 + 1」が答え
  const auto &pf = prime_factorize(g);
  cout << pf.size() + 1 << endl;
}

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

int main()
{
    int N;
    string S, T;
    cin >> N;
    cin >> S >> T;

    string Ans;
    for (int i=1; i <=N*2; i++) {
        if (i%2 != 0) {
            // cout << S.substr(0, 1) << "\n";
            Ans += S.substr(0, 1);
            S = S.substr(1);
        } else {
            // cout << T.substr(0, 1) << "\n";
            Ans += T.substr(0, 1);
            T = T.substr(1);
        }
        // cout << S << " " << T << " " << Ans << "\n";
    }
    cout << Ans;
    
    return 0;
}


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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const ll INF = 1e18;

int main() {


    int T, X;
    cin >> T >> X;

    cout << (double)T/(double)X << endl;


}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<vector>
#include<map>
#include<queue>

#define N 300005
#define M 8000005

#define ls (t<<1)
#define rs ((t<<1)|1)
#define mid ((l+r)>>1)

#define mk make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;

int i,j,m,n,p,k;

long long ans,cnt;

char c[N];

int main()
{
		scanf("%s",c+1); n=strlen(c+1);
		for (i=n;i>=1;--i)
			if (c[i]=='W') ++cnt;
			else ans+=cnt;
		printf("%lld\n",ans);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n;
  cin>>n;
  std::vector<int> a(n);
  for(auto&& e: a) {
    cin>>e;
  }
  int ans=0;
  int flag=0;
  for (int i = 0; i < n; ++i)
  {
    if(i==n-1) {
      ans++;
      break;
    }
    if(flag==0){
      if(a[i+1]==a[i]) flag=0;
      else if(a[i+1]>a[i]) flag=1;
      else flag=-1;
    }
    else if(flag==1){
      if(a[i+1]<a[i]) {
        flag=0;
        ans++;
      }
    }
    else{
      if(a[i+1]>a[i]){
        flag=0;
        ans++;
      }
    }
  }
  cout<<ans;
}

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



int main() {
    int A,B,C,N;
    // catch arg
    cin >> A >> B >> C>> N;

    int cnt = 0;
    

    // 操作が行える限り操作を繰り返す
        
    
        for (int a = 0; a < A + 1;a++){
            for (int b = 0; b < B + 1;b++){
                for (int c = 0; c < C + 1 ;c++){

                  if(500*a + 100*b + 50*c==N) cnt++;
                //       cout <<cnt<<endl;
                //       cout <<"-----"<<endl;
                //   cout << a <<" "<< b <<" "<< c <<endl;
                //   } 

                }
            }
        }

    cout << cnt << endl;
}

Measured memory_bytes: 256
import sys
 
n = int(input())
nums = list(map(int, input().split()))
maxnum = 0

for x in range(n):
    if maxnum < nums[x]:
        maxnum = nums[x]
    if maxnum - nums[x] > 1:
        print('No')
        sys.exit() 
 
print('Yes')

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

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

  ll M=0;
  for(ll i=0; i*i<=n; i++){
    M=max(M, i*i);
  }
  cout << M << endl;
  return 0;
}

Measured memory_bytes: 256
///
// File:  a.cpp
// Author: ymiyamoto
//
// Created on Mon Apr  2 23:38:11 2018
//
#include <bits/stdc++.h>
using namespace std;

#define rep(_n, _init, _N) for (int32_t _n = _init; _n < (int32_t)(_N); _n++)
#define rrep(_n, _N, _end) for (int32_t _n = (int32_t)(_N); _n >= _end; _n--)
#define iceil(_x, _y) (((_x) + (_y)-1) / (_y))
#define ifloor(_x, _y) ((_x) / (_y))

static const double pi = 2 * asin(1);
static const double precision = 10e-9;

int32_t main()
{
  uint32_t N;
  cin >> N;
  vector<int32_t> as(3 * N);
  rep(i, 0, 3 * N)
  {
    cin >> as[i];
  }

  sort(as.begin(), as.end());

  uint64_t count = 0;
  rep(i, 0, N)
  {
    count += as[as.size() - 1 - 1 - 2 * i];
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <stdio.h>
 
using namespace std;
 
int main(void) {
    int a, b;
    cin >> a >> b;
    if (a*b % 2 == 0){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
  int a,b,c,k,s,t[3],i;
  scanf("%d%d%d",&a,&b,&c);
  scanf("%d",&k);
  if(a>=b){ 
    if(a>=c) {t[0]=a;t[1]=b;t[2]=c;}
    else {t[0]=c;t[1]=a;t[2]=b;}
  }
  else if(a<=b){ 
    if(b>=c) {t[0]=b;t[1]=a;t[2]=c;}
  }
  s=t[0]*pow(2,k)+t[1]+t[2];
  printf("%d",s);
  return 0;
}
  

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


int main() {
    int N;
    cin>>N;
    int H[N];
    rep(i,N)cin>>H[i];
    
    int cnt=1;
    int mx=H[0];
    for(int i=1;i<N;i++){
        if(H[i]>=mx)cnt++;
        mx=max(mx,H[i]);
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
//header{{{
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/graph_utility.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost::multiprecision;
//using namespace boost::math;

typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS,
        boost::no_property, boost::property<boost::edge_weight_t, int> > Graph;
typedef pair<int, int> Edge;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int_fast64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout.setf(ios_base::fixed);
    cout.precision(10);

    int n, x, y;
    cin >> n >> x >> y;

    Graph G;

    for(int i = 1; i < n; ++i){
        add_edge(i, i + 1, 1, G);
    }
    add_edge(x, y, 1, G);

    vector<int> dist(n + 1, INF);
    vector<int> res(n);

    for(int i = 1; i <= n; ++i){
        boost::dijkstra_shortest_paths(G, i, boost::distance_map(&dist[0]));
        for(int j = i; j <= n; ++j){
            res[dist[j]]++;
        }
    }

    for(int i = 1; i < n; ++i){
        cout << res[i] << '\n';
    }

    return 0;
}


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

class Cube {
  public:
    int faces[6];
    Cube(){};
    void roll(int i, int j, int k, int l) {
        int t = faces[i];
        faces[i] = faces[j];
        faces[j] = faces[k];
        faces[k] = faces[l];
        faces[l] = t;
    }
    void roll_z() { roll(1, 2, 4, 3); }
    void roll_y() { roll(0, 2, 5, 3); }
    void roll_x() { roll(0, 1, 5, 4); }
    void move(char ch) {
        switch (ch) {
        case 'E':
            for (int i = 0; i < 3; i++) {
                roll_y();
            }
            break;
        case 'W':
            roll_y();
            break;
        case 'N':
            roll_x();
            break;
        case 'S':
            for (int i = 0; i < 3; i++) {
                roll_x();
            }
        default:
            break;
        }
    }
};

int main(int argc, char const *argv[]) {
    Cube cube;
    string commands;

    for (int i = 0; i < 6; i++) {
        cin >> cube.faces[i];
    }
    cin >> commands;

    for (int i = 0; i < commands.size(); i++) {
        cube.move(commands[i]);
    }

    cout << cube.faces[0] << endl;

    return 0;
}



Measured memory_bytes: 3156
#include <stdio.h>
#include <algorithm>

using namespace std;

int n , q;
char s[210000];
char t[210000] , d[210000];
int x , y;
int check ( int k ) {
	int i;
	for ( i = 1 ; i <= q ; i++ ) {
		if ( t[i] == s[k] ) {
			if ( d[i] == 'L' ) {
				k--;
			}
			else k++;
			if ( k <= 0 ) return -1;
			if ( k > n ) return 1;
		}
	}
	return 0;
}
void work () {
	int i , l , r , mid;
	scanf ( "%d%d" , &n , &q );
	scanf ( "%s" , s + 1 );
	for ( i = 1 ; i <= q ; i++ ) {
		scanf ( "%s%s" , t + i , d + i );
	}
	if ( check ( n ) == -1 ) x = n + 1;
	else {
		l = 0; r = n;
		while ( l < r - 1 ) {
			mid = (l+r)/2;
			if ( check ( mid ) != -1 ) r = mid;
			else l = mid;
		}
		x = r;
	}
	if ( check ( 1 ) == 1 ) l = 0;
	else {
		l = 1; r = n + 1;
		while ( l < r - 1 ) {
			mid = (l+r)/2;
			if ( check ( mid ) != 1 ) l = mid;
			else r = mid;
		}
		y = l;
	}
	//printf ( "%d %d\n" , x , y );
	printf ( "%d\n" , y - x + 1 );
}
int main () {
	work ();
	return 0;
}


Measured memory_bytes: 768
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

x=int(input())
def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

ans=x
while not is_prime(ans):
    ans+=1
print(ans)

Measured memory_bytes: 69464
#pragma GCC optimize("O3,inline,unroll-loops")
#include <iostream>
#include <algorithm>
#include <cstdio>
#define N 20000020
#define MOD 1000000007
using namespace std;

namespace Comb
{
    int f[N], g[N];
 
    int Power(int x, int y)
    {
        int o;
 
        for(o = 1; y; y >>= 1)
        {
            if(y & 1)
                o = (long long)o * x % MOD;
            x = (long long)x * x % MOD;
        }
 
        return o;
    }
 
    void InitComb(void)
    {
        int i;
 
        for(i = f[0] = 1; i < N; i ++)
            f[i] = (long long)f[i - 1] * i % MOD;
        g[N - 1] = Power(f[N - 1], MOD - 2);
        for(i = N - 2; i > -1; i --)
            g[i] = (long long)g[i + 1] * (i + 1) % MOD;
 
        return;
    }

    int C(int n, int m)
    {
        return n >= m ? (long long)f[n] * g[m] % MOD * g[n - m] % MOD : 0;
    }

    int S(int x, int y, int z)
    {
        return (long long)f[x + y + z] * g[x + y] % MOD * f[x + y - 1] % MOD * x % MOD;
    }
}

int main(void)
{
    int n, a;
    int i, j, o;

    Comb::InitComb();
    cin >> n >> a;
    for(i = o = 0; i < a; i ++)
        o = (o + (long long)(i & 1 ? MOD - 1 : 1) * Comb::C(a, i) % MOD * Comb::S(a - i, n - a, 0) % MOD) % MOD;
    for(i = 0; i < a; i ++)
        for(j = 0; j < a; j ++)
            o = (o + (long long)(j & 1 ? MOD - 1 : 1) * Comb::C(i, j) % MOD * Comb::S(i - j, n - a, a - i - 1) % MOD) % MOD;
    cout << o << endl;

    return 0;
}


Measured memory_bytes: 159840
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;


fn main() {
    input! {
    mut a:usize,
    mut b:[usize;a],
    }
    for i in 0..a {
        b[0]|=b[i]
    }
    a=0;
    while b[0]%2==0 {
        a+=1;
        b[0]/=2
    }
    println!("{}",a)
}

Measured memory_bytes: 2156
# coding:utf-8

INF = float('inf')


def inpl(): return list(map(int, input().split()))


N = int(input())

A = inpl()

right = 0
res = 0
ans = 0
for left in range(N):
    while right < N and res + A[right] == res ^ A[right]:
        res += A[right]
        right += 1

    ans += right - left

    if left == right:
        right += 1
    else:
        res -= A[left]

print(ans)

Measured memory_bytes: 24840
#include <iostream>

int main() {
    int N;
    std::cin >> N;

    bool ans = true;
    int p = 0;
    for (int i = 0; i < N; i++) {
        int H;
        std::cin >> H;

        if (p < H)
            p = H - 1;
        else if (p > H)
            ans = false;
    }

    std::cout << (ans ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 384
import numpy as np
N = int(input())
A = list(map(int,input().split()))

if sum((np.sign(A) ==-1)*1)%2 == 0:
    print(sum(abs(np.array(A))))
else:
    print(sum(abs(np.array(A)))-min(abs(np.array(A)))*2)

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

int main() {
  int n, ans=0;

  cin >> n;
  vector<string> s(n);
  rep(i, n)
  {
    cin >> s.at(i);
  }

  int m;
  cin >> m;
  vector<string> t(m);
  rep(i, m)
  {
    cin >> t.at(i);
  }

  int tmp=0;
  rep(i, n)
  {
    tmp = count(s.begin(), s.end(), s.at(i));

    rep(j, m)
    {
      if(s.at(i) == t.at(j))
        tmp--;
    }

    ans = max(ans, tmp);
    
  }


  cout << ans << endl;

}


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

using namespace std;
using ll = long long;

#define INF (1LL << 60)

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll N;
    cin >> N;
    vector<ll> X(N);
    REP(i,0,N) cin >> X[i];

    double P = 0.0;
    REP(i,0,N) P += X[i];
    P /= N;
    ll Q;
    if(P - double(ll(P)) < 0.5) Q = ll(P);
    else Q = ll(P) + 1;

    ll S = 0;
    REP(i,0,N) S += (X[i] - Q) * (X[i] - Q);
    _PR(S);

    return 0;
}

/*



*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > > 
#define pii pair<int,int> 
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define SZ(x) ((int)x.size())
using namespace std;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
const int BufferSize=1<<16;
char buffer[BufferSize],*Bufferhead,*Buffertail;
bool Terminal;
inline char Getchar(){
	if(Bufferhead==Buffertail){
		int l=fread(buffer,1,BufferSize,stdin);
		if(!l){Terminal=1;return 0;}
		Buffertail=(Bufferhead=buffer)+l;
	}
	return *Bufferhead++;
}
template<class T>inline bool read(T &x){
	x=0;char c=Getchar(),rev=0;
	while(c<'0'||c>'9'){c=Getchar();rev|=c=='-';if(Terminal)return 0;}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=Getchar();
	if(c=='.'){
		c=Getchar();double t=0.1;
		while(c>='0'&&c<='9') x=x+(c-'0')*t,c=Getchar(),t=t/10;
	}
	x=rev?-x:x;
	return 1;
}
inline bool reads(char *x){
	char c=Getchar();
	while(c<33||c>126){c=Getchar();if(Terminal)return 0;}
	while(c>=33&&c<=126) (*x++)=c,c=Getchar();
	*x=0;return 1;
}
template<class T>inline void print(T x,const char c='\n'){
	if(!x){putchar('0');putchar(c);return;}
	if(x<0) putchar('-'),x=-x;
	int m=0,a[20];
	while(x) a[m++]=x%10,x/=10;
	while(m--) putchar(a[m]+'0');
	putchar(c);
}
//--------------------------------head---------------------------------------------

const int inf=0x3f3f3f3f;
const int N=100005,M=100005,mod=1e9+7;
template<class T,class S> inline void ch(T &x,const S y){x=(x+y)%mod;}
inline int exp(int x,int y,const int mod=::mod){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

struct node{ll x,y;}p[10];
ll a,b,c,d,n;

bool cmp(node a,node b){return a.x*b.y<a.y*b.x;}

int main(){
#ifdef rqgao2014
	freopen("input.txt","r",stdin);
#endif
cin>>a>>b>>c>>d>>n;
	n*=4;
	p[1]=(node){a,1};
	p[2]=(node){b,2};
	p[3]=(node){c,4};
	p[4]=(node){d,8};
	sort(p+1,p+5,cmp);
	ll ans=0;
	for(int i=1;i<=4;i++)
		ans+=p[i].x*(n/p[i].y),n%=p[i].y;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
//confilm 0LL and 1LL
//confilm cornercases such as 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecVec = vector<Vec>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n;
	cin >> n;
	ll sum = 0, m = n;
	while(m){
		sum += m%10;
		m /= 10;
	}
	if(!(n%sum)) puts("Yes");
	else puts("No");

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    string s;
    cin >> s;
    int n = s.size();
    if(n == 1) {
        cout << 1 << endl;
        return 0;
    }
    vector<int> v;
    rep(i, n-1) {
        if(s[i] != s[i+1]) {
            v.push_back(i+1);
        }
    }
    ll l = 1;
    ll r = s.size() + 1;
    
    auto check = [&](ll m) {
        for(auto& x : v) {
            if(max(x, n - x) < m) {
                return false;
            }
        }
        return true;
    };

    rep(i, 30) {
        ll m = (l + r) / 2;
        if(check(m)) l = m;
        else r = m;
    }
    cout << l << endl;
    return 0;
}

Measured memory_bytes: 768
S = list(input())
ans = 'NO'
while len(S)!=0:
    if(''.join(S[-5:])=='dream' or ''.join(S[-5:])=='erase'):
        del S[-5:]
    elif(''.join(S[-6:])==(('eraser'))):
        del S[-6:]
    elif(''.join(S[-7:])==(('dreamer'))):
        del S[-7:]
    else:
        break

if len(S)==0:
    ans = 'YES'

print(ans)


Measured memory_bytes: 3956
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (N, M, X, Y) = nextIntList()
    val x = nextIntList()
    val y = nextIntList()
    val xmax = x.max()!!
    val ymin = y.min()!!
    println(if (X <= xmax && ymin <= Y && xmax < ymin) "No War" else "War")
}

Measured memory_bytes: 38004
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>

typedef long long LL;

const int N=305;

int n,k,MOD,f[N][N],s[N][N],c[N][N];

int main()
{
    scanf("%d%d%d",&n,&k,&MOD);
    c[0][0]=1;
    for (int i=1;i<=n;i++)
    {
        c[i][0]=1;
        for (int j=1;j<=i;j++)
            c[i][j]=(c[i-1][j]+c[i-1][j-1])%MOD;
    }
    for (int i=0;i<=k;i++) f[1][i]=1,s[1][i]=k-i+1;
    for (int i=2;i<=n+1;i++)
    {
        for (int j=0;j<=k;j++)
            for (int l=1;l<i;l++)
                (f[i][j]+=(LL)f[i-l][j]*s[l][j+1]%MOD*c[i-2][l-1]%MOD)%=MOD;
        for (int j=k;j>=0;j--) s[i][j]=(s[i][j+1]+f[i][j])%MOD;
    }
    printf("%d",f[n+1][0]);
    return 0;
}

Measured memory_bytes: 1280
#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);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	ll n, X;
	cin >> n >> X;
	vector<ll>x(n), dist(n);
	rep(i, n) {
		cin >> x[i];
		dist[i] = abs(x[i] - X);
	}
	ll ans = gcd(dist[0], dist[1]);
	rep(i, n) {
		ans = gcd(ans, dist[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;
//import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
		String s = "NG";
		for(int i = a; i <= b; i++){
			if(i % k == 0){
				s = "OK";
				break;
			}
		}
		System.out.println(s);
	}
}


Measured memory_bytes: 35812
void main()
{
    long n, x;
    rdVals(n, x);
    long[] a = rdRow;

    a ~= x;
    a.sort!"a > b";
    long[] diff = new long[n];
    foreach (i; 0 .. n)
    {
        diff[i] = a[i] - a[i+1];
    }

    diff.reduce!gcd.writeln;
}

enum long mod = 10L^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 7092
object Main extends App {
  val xn =  scala.io.StdIn.readLine()
  val xnArray = xn.split(" ").map(_.toInt).toSeq
  val x = xnArray(0)
  val n = xnArray(1)

  val pInput =  scala.io.StdIn.readLine()

  if (n == 0) {
    println(x)
  } else {
    val pArray = pInput.split(" ").map(_.toInt).toVector.sorted
    if (pArray.find(_ == x).isEmpty) {
      println(x)
    } else {
      val min = pArray.head - 1
      val minSabun = Math.abs(x - min)
      val max = pArray.last + 1
      val maxSabun = Math.abs(x - max)

      var temp = -999
      var sabun = -999
      var result = -999
      if (minSabun > maxSabun) {
        sabun = maxSabun
        result = max
      } else {
        sabun = minSabun
        result = min
      }
      pArray.zipWithIndex.foreach { p =>
        if (temp == -999) {
          temp = p._1
        } else if (temp + 1 == p._1) {
          temp = p._1
        } else {
          // 現状より一つ前の値
          (temp + 1 to p._1 - 1).foreach { i =>
            val tempSabun = Math.abs(x - i)
            if (tempSabun < sabun) {
              sabun = tempSabun
              result = i
            } else if (tempSabun == sabun && i < result) {
              sabun = tempSabun
              result = i
            }
          }
          temp = p._1
        }
      }
      println(result)
    }
  }
}

Measured memory_bytes: 54888
#include <iostream>

using namespace std;

int code(char c) {
  if (c == 'M')
    return 0;
  else if (c == 'A')
    return 1;
  else if (c == 'R')
    return 2;
  else if (c == 'C')
    return 3;
  else if (c == 'H')
    return 4;
  return -1;
}

// "ACH", "ARC", "ARH", "MAC", "MAH", "MAR", "MCH", "MRC", "MRH", "RCH",
constexpr int P[] = {1, 1, 1, 0, 0, 0, 0, 0, 0, 2};
constexpr int Q[] = {3, 2, 2, 1, 1, 1, 3, 2, 2, 3};
constexpr int R[] = {4, 3, 4, 3, 4, 2, 4, 3, 4, 4};

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

  int N;
  cin >> N;

  char s[16];
  long long T[5] = {0};
  for (int i = 0; i < N; ++i) {
    cin >> s;
    const char c = s[0];
    const int j = code(c);
    if (j >= 0) T[j]++;
  }
  long long ans = 0;
  for (int i = 0; i < 10; ++i) {
    ans += T[P[i]] * T[Q[i]] * T[R[i]];
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 200005;
int N;
int A[MAX_N];

vector<int> E[MAX_N];
stack<int> S[MAX_N];
int ans[MAX_N];

bool check(int mid, int a) {
  int s = S[mid].top();
  return a <= s;
}

void solve(int pos = 0, int len = 0, int pre = -1)
{
  int a = A[pos];
  int l = -1, r = N;
  while(r-l>1) {
    int mid = (l+r)/2;
    if (check(mid, a)) {
      r = mid;
    } else {
      l = mid;
    }
  }

  len = max(len, r+1);
  
  ans[pos] = len;
  // Sに挿入
  S[r].push(a);
  for(int next : E[pos]) {
    if (next == pre) continue;
    solve(next, len, pos);
  }
  // Sから削除
  S[r].pop();
}

signed main()
{
  cin >> N;
  REP(n,N) {
    cin >> A[n];
    S[n].push(INF_LL);
  }
  REP(n,N-1) {
    int a, b; cin >> a >> b; a--; b--;
    E[a].push_back(b);
    E[b].push_back(a);
  }

  solve();
  REP(n,N) {
    cout << ans[n] << endl;
  }

  return 0;
}


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

using namespace std;

const int N = 1e5 + 7;

int n, c, k, t[N];

int main() {
	scanf("%d%d%d", &n, &c, &k);
	for (int i = 0; i < n; i++) scanf("%d", &t[i]);
	sort(t, t + n);
	set<int> s;
	int ans = 0;
	for (int i = 0, j = 0; i < n; i = j) {
		int tt = t[i] + k, cnt = 0;
		ans++;
		while (j < n && cnt < c && t[j] <= tt) {
			j++;
			cnt++;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    int m = 0;
    for (int i = n; i > 0; i--) {
        int t = 0;
        for (int j = i; j <= n; j += i) {
            t ^= a[j];
        }
        m += a[i] = t;
    }

    cout << m << '\n';
    for (int i = 1; i <= n; i++) {
        if (a[i]) cout << i << '\n';
    }

    return 0;
}

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

#define For(i,a,b) for(int (i) = (a);(i) < (b);i++)
#define Rep(i,n) For((i),0,(n))
#define All(a) (a).begin(),(a).end()
#define sp " "
#define INF 1e18
#define INT_INF 1e9

typedef long long ll;
const ll MOD = 1000000007;
const ll MOD_9 = 998244353;

vector<char> boin = {'a','i','u','e','o'};
vector<char> alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

int main(){
    int K,X;
    cin >> K >> X;
    if(500*K >= X)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

#define ll long long
#define MOD 1000000007


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

    vector<ll> h(n);
    for(int i=0;i<n;i++)cin>>h.at(i);
    vector<ll> dp(n,9999999999);

    dp.at(0)=0;
    for(int i=0;i<n;i++){
        for(int j=1;j<=k;j++){
            if(i-j<0)break;
            dp.at(i)=min(dp.at(i),dp.at(i-j)+abs(h.at(i-j)-h.at(i)));
        }
    }
    cout<<dp.at(n-1)<<endl;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    int N, R;
    read(N, R);

    if (N >= 10) {
        print(R);
    } else {
        print(R + 100 * (10 - N));
    }

    return 0;
}


Measured memory_bytes: 256