akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
    int n;
    cin>>n;
    int mx1 = -1e10,mn1 = 1e10,mx2 = -1e10,mn2 = 1e10,mx3 = -1e10,mn3 = 1e10;
    for(int i = 0;i<n;i++){
        int a,b;
        cin>>a>>b;
        mx1 = max(mx1,a+b);
        mn1 = min(mn1,a+b);
        mx2 = max(mx2,b-a);
        mn2 = min(mn2,b-a);
        mx3 = max(mx3,a-b);
        mn3 = min(mn3,a-b);
    }
    cout<<max({mx1-mn1,mx2-mn2,mx3-mn3});
    return 0;
}

Measured memory_bytes: 3576
#include<stdio.h>
int main(){
  int a,b,k,i;
  scanf("%d%d%d",&a,&b,&k);
  if(b-a<2*k)
    for(i=a;i<=b;i++)
      printf("%d\n",i);
  else{
    for(i=0;i<k;i++)
      printf("%d\n",a+i);
    for(i=k-1;i>=0;i--)
      printf("%d\n",b-i);
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main() {
    int c[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++)
            cin >> c[i][j];
    }

    // we assume a1=0
    int a[3], b[3];
    a[0] = 0;
    for (int i = 0; i < 3; i++)
        b[i] = c[0][i] - a[0];

    a[1] = c[1][0] - b[0];
    a[2] = c[2][0] - b[0];

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (a[i] + b[j] != c[i][j]) {
                cout << "No" << endl;
                goto end;
            }
        }
    }

    cout << "Yes" << endl;

end:
    return 0;
}

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll n,cnt=0;
    string a,b,c;
    cin>>n>>a>>b>>c;
    vector<ll> s(n,0);
    rep(i,n){
        s[i] += a[i]==b[i];
        s[i] += b[i]==c[i];
        s[i] += c[i]==a[i];
        if(s[i]==1) cnt++;
        if(s[i]==0) cnt+=2; 
    }
    
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,j,n) for(int i = j; i < (n); i++)
#define rep0(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int main(){
    string s;
    cin >> s;
    if(s[0]=='R'){
        if(s[1]=='R'){
            if(s[2]=='R'){
                cout << "3" << endl;
            }else{
                cout << "2" << endl;
            }
        }
        else{
            if(s[2]=='R'){
                cout << "1" << endl;
            }else{
                cout << "1" << endl;
            }
        }
    }
    else{
        if(s[1]=='R'){
            if(s[2]=='R'){
                cout << "2" << endl;
            }else{
                cout << "1" << endl;
            }
        }
        else{
            if(s[2]=='R'){
                cout << "1" << endl;
            }else{
                cout << "0" << endl;
            }
        }
    }
}

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

public class Test
{
	public static void Main()
	{
		 int R = int.Parse(Console.ReadLine());
		 if(R < 1200){
			 Console.WriteLine("ABC");
		 } else if (R < 2800){
			 Console.WriteLine("ARC");
		 } else {
			 Console.WriteLine("AGC");
		 }
	}
}


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

const int INF = 1e9 + 5;

int N, best;
string S;
vector<vector<int>> adj;
vector<int> depth, piece_count, depth_sum, min_depth_sum;

void depth_dfs(int node, int parent) {
    depth[node] = parent < 0 ? 0 : depth[parent] + 1;
    piece_count[node] = S[node] - '0';
    depth_sum[node] = 0;

    for (int neighbor : adj[node])
        if (neighbor != parent) {
            depth_dfs(neighbor, node);
            depth_sum[node] += depth_sum[neighbor] + piece_count[neighbor];
            piece_count[node] += piece_count[neighbor];
        }
}

void answer_dfs(int node, int parent) {
    min_depth_sum[node] = depth_sum[node];
    vector<pair<int, int>> children;

    for (int neighbor : adj[node])
        if (neighbor != parent) {
            answer_dfs(neighbor, node);
            children.emplace_back(depth_sum[neighbor] + piece_count[neighbor], min_depth_sum[neighbor] + piece_count[neighbor]);
        }

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

    if (!children.empty()) {
        int sum_except = 0;

        for (int i = 0; i < (int) children.size() - 1; i++)
            sum_except += children[i].first;

        if (children.back().second <= sum_except) {
            if (parent < 0 && depth_sum[node] % 2 == 0)
                best = min(best, depth_sum[node] / 2);

            min_depth_sum[node] = depth_sum[node] % 2;
        } else {
            min_depth_sum[node] = children.back().second - sum_except;
        }
    }
}

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

    cin >> N >> S;
    adj.assign(N, {});

    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    best = INF;

    for (int root = 0; root < N; root++) {
        depth.assign(N, 0);
        piece_count.assign(N, 0);
        depth_sum.assign(N, 0);
        min_depth_sum.assign(N, 0);
        depth_dfs(root, -1);
        answer_dfs(root, -1);
    }

    cout << (best < INF ? best : -1) << '\n';
}


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

int main() {
    int a, b;
    cin >> a >> b;
    string result = "";
    if (a <= b) {
        rep(i, b) result += to_string(a);
    }
    else {
        rep(i, a) result += to_string(b);
    }
    cout << result << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <tuple>
#include <bitset>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;


int main() {
  int n;
  cin>>n;
  vector<uint64_t> lucas(90,0);
  lucas[0]=2;
  lucas[1]=1;
  for(int i=2;i<=n;i++){
    lucas.at(i)=lucas.at(i-1)+lucas.at(i-2);
  }
  cout<<lucas.at(n)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>

int main(){
    int count[26]={0};
    char ch;
    int i, num;

    while(scanf("%c", &ch)!=EOF){
        if(islower(ch)){
            num=ch-'a';
        }else if(isupper(ch)){
            num=ch-'A';
        }else{
            continue;
        }
        count[num]++;
    }
    for(i=0;i<26;i++){
        printf("%c : %d\n", 'a'+i, count[i]);
    }

    return 0;
}


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

int main() {
    int d;
    cin >> d;
    for (int i = 1; i <= d; i++) {
        int n;
        cin >> n;
        cout << "Case " << i << ":" << endl;
        for (int j = 0; j < 10; j++) {
            n *= n;
            n /= 100;
            n %= 10000;
            cout << n << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3028
def calculate_max(Ans, value):
    temp = Ans
    if (Ans + value) > Ans:
        temp += value
    if temp < 0 :
        temp = 0
    return temp
# input processing 
N = int(input())
Value = list(map(int, input().split()))
Cost = list(map(int, input().split()))
# profit calculation
Profit = [Value[i] - Cost[i] for i in range(N)]
Answer = 0
# process
for i in range(N):
    Answer = calculate_max(Answer, Profit[i])
# Output
print(Answer)


Measured memory_bytes: 3064
#include <iostream>
using namespace std; 
int main() {
	int n, time, c, t, min=1001;
	cin >> n >> time;
	for (int i = 1; i <= n; i++) {
		cin >> c >> t;
		if (t <= time && c < min)
			min = c;
	}
	if (min == 1001)
		cout << "TLE";
	else
		cout << min;
}

Measured memory_bytes: 256
#include <cstdio>

int main() {
	long long n, a[5], k = 0;
	int i, j;
	scanf("%lld", &n);
	for(i = 0; i < 5; i++) {
		scanf("%lld", &a[i]);
		if(a[i] < a[k]) k = i;
	}
	printf("%lld\n", (n + a[k] - 1) / a[k] + 4);
	return 0;
}

Measured memory_bytes: 128
n,w = map(int,input().split())
w1,v1 = map(int,input().split())
if n == 1:
    if w1 <= w:
        print(v1)
    else:
        print(0)
else:
    a = [v1] 
    b = []
    c = []
    d = []
    for i in range(n-1):
        p,q = map(int,input().split())
        if p == w1:
            a.append(q)
        elif p == w1 + 1:
            b.append(q)
        elif p == w1 + 2:
            c.append(q)
        else:
            d.append(q)
    a.sort()
    b.sort()
    c.sort()
    d.sort()
    a = a[::-1]
    b = b[::-1]
    c = c[::-1]
    d = d[::-1]
    #print(a,b,c,d)
    jkl = 0
    ass = 0
    for i in range(len(a)+1):
        for j in range(len(b)+1):
            for h in range(len(c)+1):
                for g in range(len(d)+1):
                    if w1*(i+j+h+g)+j+2*h+3*g <= w:
                        ans = sum(a[:i:]) + sum(b[:j:]) + sum(c[:h:]) + sum(d[:g:])
                        ass = max(ass,ans)
    print(ass)




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

//各桁の和を計算する関数
int findSumOfDigits(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    int total = 0;
    for (int i = 1; i <= N; ++ i) {
        int sum = findSumOfDigits(i); //iの各桁の和
        if (sum >= A && sum <= B) {
            total += i;
        }
    }
    cout << total << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	string O, E;
	cin >> O >> E;
	rep(i, E.length()) cout << O[i] <<  E[i];
	if (O.length() > E.length()) cout << O[O.length() - 1];
	cout << endl;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;

#define MAX 100000
typedef long long llong;

class Allocation
{
	int pasNum;
	int truckNum;
	
public:
	llong cargo[MAX];
	int checkPas(llong p);
	Allocation(int x, int y) { truckNum = x; pasNum = y; }	
	llong solve();
};

int Allocation::checkPas(llong p)
{
	llong mnt;
	int cnt = 0, trk = 1, j = 0;

	for (int i = 0; i < truckNum; i++) {
		mnt = 0;
		while (mnt + cargo[j] <= p) {
			mnt += cargo[j];
			j++;
			//cout << i << " " << mnt << " " << j << endl;
			if (j == pasNum) return j;
		}
		/*for (mnt = 0; mnt + cargo[j] <= p; j++) {
			mnt += cargo[j];
			
			if (j == pasNum) return j;
		}*/
	}
	return j;
}

llong Allocation::solve()
{
	llong mid, left = 0, right = MAX * 10000;
	while ( right - left > 1) {
		mid = (left + right) / 2;
		int p = checkPas(mid);
		if (p < pasNum ) left = mid;
		else right = mid;
		//cout << left << " " << " " << right << endl << p << endl;
	}
	return right;
}

int main()
{
	int n, k, i;
	llong w;
	scanf("%d %d", &n, &k);
	Allocation all(k, n);

	for (i = 0; i < n; i++)
		cin >> all.cargo[i];

	//cout << all.checkPas(10) << endl;
	cout << all.solve() << endl;
	return 0;
}

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

int main() {
    ll A, B, C;
    ll ans;
    cin >> A >> B >> C;

    if (A % 2 != 0 && B % 2 != 0 && C % 2 != 0) {
        ans = min({A * B, B * C, C * A});
    } else {
        ans = 0;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const ll INF = 1e18;

int n, k;
ll x[120000];

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n >> k;
	for (int i = 0; i < n; ++i)
		cin >> x[i];
	ll ans = INF;
	for (int i = 0; i + k <= n; ++i) {
		ll l = x[i];
		ll r = x[i + k - 1];
		if (l >= 0) {
			ans = min(ans, r);
		}
		else if (r <= 0) {
			ans = min(ans, -l);
		}
		else {
			ans = min(ans, 2 * (-l) + r);
			ans = min(ans, 2 * r - l);
		}
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)

int main() {

	for (;;) {
		int n;
		scanf("%d", &n);
		if (!n) break;
		bool u[234] = {};

		REP(i, n) {
			int t;
			scanf("%d", &t);
			u[t] = true;
		}
		vector<int> c[2];
		REP(i, 2 * n) {
			u[i + 1] ? c[0].push_back(i + 1) : c[1].push_back(i + 1);
		}

		sort(c[0].begin(), c[0].end());
		sort(c[1].begin(), c[1].end());

		int a = 0;
		while (c[0].size() && c[1].size()) {
			REP(i, 2) {
				auto itr = upper_bound(c[i].begin(), c[i].end(), a);
				if (itr != c[i].end()) {
					a = *itr;
					c[i].erase(itr);
					if (!c[i].size()) break;
				}
				else a = 0;
			}
		}

		for (int i = 1; i >= 0; i--) printf("%d\n", c[i].size());
	}

	return 0;
}

Measured memory_bytes: 2576
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

string S;
int main(){
    cin>>S;
    cout<<S.substr(0,3)<<endl;

    return 0;
}

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


#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define pli pair<long long,int>
#define pil pair<int,long long>
#define ll long long
#define el '\n'

using namespace std;

const int N = 3e2 + 10;

int n;
ll ar[N];
ll cur;

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

    cin >> n;
    for (int i=1;i<=n;i++){
        cin >> ar[i];
        if (i > 2) cur ^= ar[i];
    }
    ll a = ar[1], b = ar[2];
    if (cur > a + b){
        cout << -1 << el;
        return 0;
    }
    ll anb = (a + b - cur) / 2LL; // supposedly a & b
    ll na = anb, nb = anb; // new a, new b
    if (na > a){
        cout << -1 << el;
        return 0;
    }
    for (ll i=50;i>=0;i--){
        ll bit = (1LL << i);
        if (cur & bit){
            if (na + bit < a) na += bit;
            else nb += bit;
        }
    }
    if (na == 0 || (na ^ nb) != cur || na + nb != a + b){
        cout << -1 << el;
        return 0;
    }
    cout << a - na << el;

    return 0;
}

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

int main() {
  int N, K, x=0; cin >> N >> K;
  vector<vector<int>> sunuke(N, vector<int>(0));
  for (int i=0; i<K; i++) {
    int d; cin >> d;
    for (int j=0; j<d; j++) {
      int A; cin >> A;
      sunuke.at(A-1).push_back(i);
    }
  }
  for (int i=0; i<N; i++) {
    if (sunuke.at(i).size()==0) x++;
  }
  cout << x << endl;
}

Measured memory_bytes: 3636
def North(dice):
    w = dice[0]
    dice[0] = dice[1]
    dice[1] = dice[5]
    dice[5] = dice[4]
    dice[4] = w
    return dice
def East(dice):
    w = dice[1]
    dice[1] = dice[2]
    dice[2] = dice[4]
    dice[4] = dice[3]
    dice[3] = w
    return dice

def West(dice):
    w = dice[0]
    dice[0] = dice[2]
    dice[2] = dice[5]
    dice[5] = dice[3]
    dice[3] = w
    return dice

maxloop = 4
Ncnt = 0
Ecnt = 0
Wcnt = 0

n = int(input())
Dice = [['' for i2 in range(6)] for i1 in range(n)]
for i in range(n):
    Dice[i] = input().split()

Flag = False
Nloop = True
Eloop = True
Wloop = True

for i in range(n - 1):
    for j in range(i + 1, n):
        while Eloop:
            while Nloop:
                while Wloop:
                    if Dice[i] == Dice[j]:
                        Flag = True
                        Nloop = False
                        Eloop = False
                        Wloop = False
                        break
                    Dice[i] = West(Dice[i])
                    Wcnt += 1
                    if Wcnt == maxloop:
                        Wloop = False
                Dice[i] = North(Dice[i])
                Wcnt = 0
                Wloop = True
                Ncnt += 1
                if Ncnt == maxloop:
                    Nloop = False
            Dice[i] = East(Dice[i])
            Ncnt = 0
            Nloop = True
            Ecnt += 1
            if Ecnt == maxloop:
                Eloop = False
        Ecnt = 0
        Eloop = True
        if Flag == True:
            print("No")
            break
    else:
        continue
    break

if Flag == False:
    print("Yes")

Measured memory_bytes: 7932
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

int main(void) {
	int x, a, b;
	cin >> x >> a >> b;

	if (abs(a - x) < abs(b - x)) {
		cout << 'A' << endl;
	}
	else {
		cout << 'B' << endl;
	}

	return 0;
}

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

int main(){
  int c[3][3];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++) cin>>c[i][j];
  }
  for(int a1=0;a1<=100;a1++){
    for(int a2=0;a2<=100;a2++){
      for(int a3=0;a3<=100;a3++){
        int b1=abs(c[0][0]-a1);
        int b2=abs(c[0][1]-a1);
        int b3=abs(c[0][2]-a1);
        if(c[0][0]==a1+b1 && c[0][1]==a1+b2 && c[0][2]==a1+b3 && c[1][0]==a2+b1 && c[1][1]==a2+b2 && c[1][2]==a2+b3 && c[2][0]==a3+b1 && c[2][1]==a3+b2 && c[2][2]==a3+b3){
          cout<<"Yes";
          return 0;
        }
      }
    }
  }
  cout<<"No";
  return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <queue>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vstr=vector<string>;

ll C[51][51]; // C[n][k] -> nCk

void comb_table(int N){
    for(int i=0;i<=N;++i){
        for(int j=0;j<=i;++j){
            if(j==0 or j==i){
                C[i][j]=1LL;
            }else{
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }
    }
}

ll N,A,B;
vector<pll> ranges;
void solve() {

    comb_table(50);

    cin >> N >> A >> B;
    vll vec(N);
    rep(i,N){
        cin >> vec[i];
    }
    sort(RALL(vec));

    ll ave=0;
    rep(i,A){
        ave += vec[i];
    }
    print(1.0*ave/A);

    ll x = 0;
    ll y = 0;
    ll res;
    rep(i,N) {
        if(vec[i]==vec[A-1]) x++;    
        if(vec[i]==vec[0]) y++;    
    }
    if(y>=A){
        res = 0;
        rng(i,A,B+1){
            res += C[y][i];
        }
    }else{
        ll z = 0;
        rep(i,A) if(vec[i]==vec[A-1]) z++;
        res=C[x][z];
    }
    print(res);
}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

Measured memory_bytes: 3756
/*Author : Harsh AKA Codula*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inp freopen("input.txt","r",stdin)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
 
//main class

class Solution
{
	public:
		void run()
		{
			ll t=1;//cin>>t;
			while(t--)
			{
				ll n;
				cin>>n;
				vector<ll> a(n,0);
				ll b=0;
				for(ll& i : a)cin>>i;
				if(n==1)cout<<0;
				else
				{
					for(ll i=0;i<n-1;++i)
					{
						if(a[i]>a[i+1])
						{
							b+=a[i]-a[i+1];
							a[i+1]+=a[i]-a[i+1];
							
						}
					}
					cout<<b;
				}
				cout<<"\n";
			}
		}	
};
//driver func

int main()
{
	//fast;
	//inp;
	Solution MAIN1;
	MAIN1.run();
	return 0;
}


Measured memory_bytes: 4772
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramA
    {
        static void Main(string[] args)
        {
            var a = long.Parse(Console.ReadLine());
            a = a == 0 ? 1 : 0;
            Console.WriteLine(a);
        }
    }
}


Measured memory_bytes: 27520
package main

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

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		n, _ := strconv.Atoi(stdin.Text())
		if n == 0 {
			break
		}

		a := make([][]int, n+1)
		for i := 0; i < n; i++ {
			sum := 0
			stdin.Scan()
			a[i] = make([]int, n+1)
			str := strings.Split(stdin.Text(), " ")
			for j := 0; j < n; j++ {
				a[i][j], _ = strconv.Atoi(str[j])
				sum += a[i][j]
				fmt.Printf("%5d", a[i][j])
			}
			a[i][n] = sum
			fmt.Printf("%5d\n", a[i][n])
		}
		a[n] = make([]int, n+1)
		for i := 0; i <= n; i++ {
			sum := 0
			for j := 0; j < n; j++ {
				sum += a[j][i]
			}
			a[n][i] = sum
			fmt.Printf("%5d", a[n][i])
		}
		fmt.Println()
	}
}



Measured memory_bytes: 1124
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int X;
	cin >> X;

	int c = 100;
	int ans = 0;
	while (c < X)
	{
		c = (c*1.01);
		ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3652
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] sArr = sc.next().split("");

        int num = 0;
        for(int i = 0; i < sArr.length; i++){
            if(sArr[i].equals("+")){
                num++;
            }
            else{
                num--;
            }
        }
        System.out.println(num);
        
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	map<int, int> cnt;
	int n;
	cin >> n;
	ll res = 0;
	rep(i,0,n){
		int x;
		cin >> x;
		int tar = i-x;
		res+=cnt[tar];
		cnt[x+i]++;
	}
	cout << res << '\n';
}


Measured memory_bytes: 20648
h,w,d=gets.split.map(&:to_i)
c=[]
h.times{|i|s=gets.split;w.times{|j|c[s[j].to_i-1]=[i,j]}}
b=[0]*d
(h*w-d).times{|k|b<<b[k]+(c[k][0]-c[k+d][0]).abs+(c[k][1]-c[k+d][1]).abs}
gets.to_i.times{l,r=gets.split;p b[r.to_i-1]-b[l.to_i-1]}	

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

// Shortening code
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

// Macros
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define REP(i, a, b) for (auto i = a; i < b; i++)
#define RREP(i, a, b) for (auto i = a; i >= b; i--)
const ll MOD = 1e9 + 7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    // Your code
    ll n, k;
    cin >> n >> k;
    ll cnt = 0;
    REP(i, k, n + 2)
    {
        ll max_num = n * i - ((i - 1) * i) / 2;
        ll min_num = i * (i - 1) / 2;
        (cnt += (max_num - min_num + 1)) %= MOD;
    }
    cout << cnt % MOD << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>
#include <stack>
#include <vector> 
#include <iostream>
#define N 100000
using namespace std;

vector<int>  G[N];
int color[N];
int n;

void dfs(int s, int c)
{
    stack<int> st;
    color[s] = c;
    st.push(s);
    while(!st.empty())
    {
        int u = st.top();
        st.pop();
        for (int i = 0; i < G[u].size(); i++)
        {
            int v = G[u][i];
            if(color[v] == -1)
            {
                color[v] = c;
                st.push(v);
            }
        } 
    }
    return;
}

void assignColor()
{
    int id = 1;
    for (int i = 0; i < n; i++)
    {
        color[i] = -1;
    } 
    for (int u = 0; u < n; ++u)
    {
        if(color[u]==-1) dfs(u, id++);
    }

    return;
}

int main()
{
    //freopen("in3.txt","r",stdin);
    int m;
    scanf("%d %d",&n, &m);

    for (int i = 0; i < m; i++)
    {
        int s, t;
        scanf("%d %d",&s,&t); 
        G[s].push_back(t);
        G[t].push_back(s);
    } 

    assignColor(); 

    int q,s,t;
    scanf("%d",&q);
    for (int i = 0; i < q; i++)
    {
        scanf("%d %d",&s,&t);
        if (color[s] == color[t])
        { 
            printf("yes\n"); 
        } else
        { 
            printf("no\n"); 
        } 
    } 
    return 0;
}

Measured memory_bytes: 8980
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>

char s[105];
int a[125];

int main(){
    int i,p,l,flag=0,count=0;

    scanf(" %s",s);

    l=strlen(s);

    for(i=0;i<l;i++){
        p=s[i];
        a[p]++;
    }
    for(i=97;i<=122;i++){
        if(a[i]%2==1){
            flag=1;
            break;
        }
    }

    if(flag==1)
        printf("No\n");
    else{
        printf("Yes\n");
    }





    return 0;
}



Measured memory_bytes: 128
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N = i_i()
A = i_l()
B = i_l()

ans = 0
for i in range(len(B)):
    ans += min(A[i], B[i])

    if A[i] < B[i]:
        if A[i+1] >= B[i] - A[i]:
            ans += B[i] - A[i]
            A[i+1] = A[i+1] - (B[i] -A[i])
        else:
            ans += A[i+1]
            A[i+1] = 0

print(ans)


Measured memory_bytes: 19376
#include <iostream>
using namespace std;
#define int long long

signed main() {
	int N, x;
	cin>> N>> x;
	int a[N];
	for(int i=0; i<N; i++){
		cin>> a[i];
	}
	
	int s=0;
	for(int i=0; i<N; i++){
		if(a[i]>x){
			s+=a[i]-x;
			a[i]=x;
		}
	}
	for(int i=0; i<N-1; i++){
		if(a[i]+a[i+1]>x){
			s+=a[i]+a[i+1]-x;
			a[i+1]=x-a[i];
		}
	}
	
	cout<< s<< endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
int n,m,d[200050],p[200050][2],head[200050],q[200050],t,num=1,vis[200050];
struct r{
	int to,last;
}e[400050];
void add(int u,int v){
	e[num].to=v;e[num].last=head[u];head[u]=num++;
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++){
		int c=getchar();
		while (c<'A'||c>'B')c=getchar();
		d[i]=c-'A';
	}
	int u,v;
	for (int i=1;i<=m;i++){
		scanf("%d%d",&u,&v);
		p[u][d[v]]++;p[v][d[u]]++;
		add(u,v);add(v,u);
	}
	for (int i=1;i<=n;i++)if (!p[i][0]||!p[i][1])q[++t]=i,vis[i]=1;
	for (int h=1;h<=t;h++){
		int x=q[h];
		for (int i=head[x];i;i=e[i].last)if (!vis[e[i].to]){	
			p[e[i].to][d[x]]--;
			if (!p[e[i].to][d[x]])q[++t]=e[i].to,vis[e[i].to]=1;
		}
	}
	if (t<n)printf("Yes");
	else printf("No");
}

Measured memory_bytes: 7808
h, w = map(int, input().split())
m = ["." * (w + 2)] + ["." + input() + "." for _ in range(h)] + ["." * (w + 2)]

ans = [[0 for i in range(w)] for i in range(h)]

for i in range(1, h + 1):
    for j in range(1, w + 1):
        cnt = 0
        if m[i][j] == "#":
            ans[i - 1][j - 1] = "#"
            continue
        for dx in [-1, 0, 1]:
            for dy in [-1, 0, 1]:
                if m[i + dx][j + dy] == "#":
                    cnt += 1
        ans[i - 1][j - 1] = str(cnt)

for i in ans:
    print("".join(i))


Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	long long N, Amin = -1;

	cin >> N;
	for (int i = 0; i < 5; i++){
		long long temp;
		cin >> temp;

		if (Amin == -1 || temp < Amin){
			Amin = temp;
		}
	}

	long long ans = 0;
	if (Amin < N){
		ans = (N-1) / Amin + 5;
	} else {
		ans = 5;
	}

	cout << ans << endl;
	return 0;
}


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

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

using namespace std;
using ll = long long;

int main(void)
{
    int n;
    int sum = 0;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        sum += i;
    }
    cout << sum << endl;
    return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/14  Problem: 057_abc_c / Link: https://abc057.contest.atcoder.jp/tasks/abc057_c?lang=en  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;

LL f(LL i) {
	int ret=0;
	while (i) {
		i /= 10;
		ret++;
	}
	return ret;
}

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

	cin >> N;
	ans = LLONG_MAX;
	for (LL i = 1; i*i <= N; i++) {
		if (N%i == 0) {
			ans = min(ans, max(f(i), f(N / i)));
		}
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a, b;
	scanf("%d%d", &a, &b);
	int n = b - a;
	int sum=0;
	for (int i = 1; i < n; i++) {
		sum += i;
	}
	int x = sum - a;
	printf("%d", x);
	return 0;
}

Measured memory_bytes: 128
#参考https://qiita.com/takayg1/items/c811bd07c21923d7ec69

#####segfunc#####
def segfunc(x, y):
    return max(x,y)
#################

#####ide_ele初期値#####
ide_ele = 0
#################

class SegTree:
    """
    init(init_val, ide_ele): 配列init_valで初期化 O(N)
    update(k, x): k番目の値をxに更新 O(logN)
    query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
    """
    def __init__(self, init_val, segfunc, ide_ele):
        """
        init_val: 配列の初期値
        segfunc: 区間にしたい操作
        ide_ele: 単位元
        n: 要素数
        num: n以上の最小の2のべき乗
        tree: セグメント木(1-index)
        """
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        # 配列の値を葉にセット
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        # 構築していく
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        """
        k番目の値をxに更新
        k: index(0-index)
        x: update value
        """
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        """
        [l, r)のsegfuncしたものを得る ※区間注意
        l: index(0-index)
        r: index(0-index)
        """
        res = self.ide_ele

        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

N, K = map(int, input().split())
A = [int(input()) for _ in range(N)]
seg = SegTree([0 for i in range(300050)], segfunc, ide_ele)

answer = 0
for i in range(N):
    
    under = max(0,A[i]-K)
    upper = min(300050,A[i]+K)
    now = seg.query(under, upper+1)
    seg.update(A[i], now+1)
    if answer < now+1:
        answer = now+1
print(answer)

Measured memory_bytes: 121876
n, k = list(map(int, input().split()))
if n >= k:
  ans = (n-k+1)/n
  num = k
else:
  ans = 0
  num = n+1
for i in range(1,num):
  for j in range(1,30):
    if i * (2**j) >= k:
      ans += 1/n * ((1/2)**j)
      break
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <queue>
using namespace std;

using VI = vector <int>;
using VVI = vector <VI>;
using VVVI = vector <VVI>;

long long solve(VI& coor, VVI& diff) {
    long long ret = 0;

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

    priority_queue <int, vector<int>, greater<int>> pq; // min queue

    for (int i = 0; i < coor.size(); ++i) {
        if (i && coor[i] == coor[i-1]) {
            continue;
        }

        int p = coor[i];

        for (int j = 0; j < diff[p].size(); ++j) {
            pq.push(diff[p][j]);
        }

        // popping the min
        int setSize = p;
        while (pq.size() > setSize) {
            pq.pop();
        }
    }

    while (!pq.empty()) {
        if (pq.top() >= 0) {
            ret += pq.top();
        }
        // cout << "RESULT " << pq.top() << endl;
        pq.pop();
    }

    return ret;
}

int main() {
    int T;
    cin >> T;

    while (T--) {
        int N;
        cin >> N;

        vector <int> L(N);
        vector <int> R(N);
        vector <int> K(N);
        VVI coor(2);
        VVVI diff(2, VVI(N+1));

        long long ans = 0;

        for (int i = 0; i < N; ++i) {
            cin >> K[i] >> L[i] >> R[i];
            ans += min(L[i], R[i]);

            coor[0].push_back(K[i]);
            diff[0][coor[0].back()].push_back(L[i] - R[i]);

            coor[1].push_back(N-K[i]);
            diff[1][coor[1].back()].push_back(R[i] - L[i]);
        }

        for (int i = 0; i < 2; ++i) {
            ans += solve(coor[i], diff[i]);
        }

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 25420
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    int n,k;
    cin  >> n >> k;
    vector<ll > a(n);
    rep(i,n){
        cin >> a[i];
    }
    vector<ll> b;
    rep(i,n){
        ll s = 0;
        for(int j = i;j<n;j++){
            s+=a[j];
            b.push_back(s);
        }
    }
    ll ans = 0;
    ll t = 1;
    rep(i,50){
        t*=2;
    }
    rep(i,52){
        int cnt = 0;
        for(auto j:b){
            if(((ans+t)&j)==ans+t){
                cnt++;
            }
        }
        if(cnt>=k){
            ans+=t;
        }
        t/=2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6516
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> L(N);
    for(int i=0; i<N; i++) {
        cin >> L[i];
    }
    sort(L.begin(), L.end());
    int ans = 0;
    for(int i=0;i<N; i++) {
        for(int j=i+1; j<N; j++) {
            ans += distance(L.begin(), upper_bound(L.begin(), L.end(), L.at(i)+L.at(j)-1)) - j-1;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int>ans(N);
    for ( int i = 0 ; i < N - 1 ; ++i )
    {
        int a;
        cin >> a;
        ans.at(a)++;
    }
    for ( int i = 1 ; i < N ; i++ )
        cout << ans.at(i) << endl;
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 4052
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
import java.util.regex.*;
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int count = 0;
        String target = br.readLine().toLowerCase();
        while(true) {
            String line = br.readLine();
            String[] line2 = line.split(" ");
            if(line2[0].equals("END_OF_TEXT"))break;
            for(int i=0;i<line2.length;i++){
                String s= line2[i].toLowerCase();
                if(s.equals(target))count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 16916
#include <bits/stdc++.h>
#include <vector>
#include <string>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
//#define INF 2e9
#define ALL(v) v.begin(), v.end()
 
using namespace std;
typedef long long ll;

int main(){
  int s;
  cin >> s;
  rep(i,s) cout << "ACL";
  cout << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string ans = "YES";
    vector<int> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    rep(i, n - 1)
    {
        if (a[i + 1] == a[i])
        {
            ans = "NO";
            break;
        }
    }
    cout << ans << endl;
 //   system("pause");
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

const int maxN = 100005;
const int INF = 1e9;

class TaskA {
private:
	Debugger debugger;

public:
	void solveOne(int it){
		int k , a , b;
		cin >> k;
		cin >> a >> b;
		for(int i = a; i <= b; i++){
			if(i % k == 0){
				cout << "OK" << endl;
				return;
			}
		}
		cout << "NG" << endl;

	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};

int main(){
	srand(time(NULL));
	ios_base::sync_with_stdio(false);
	TaskA solver;
	solver.solve();
	return 0;
}


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

int n;

int par[10000];


void init(int n){
  for(int i=0;i<n;++i) par[i]=i;
}


int root(int x){
  if(par[x]==x){
    return x;
  }else{
    return par[x]=root(par[x]);
  }
}

bool same(int x,int y){
  return root(x)==root(y);
}

void unite(int x,int y){
  x=root(x);
  y=root(y);
  if(x==y) return;

  par[x]=y;
}

int main(){
  int q,i;
  cin >> n >> q;
  init(n);
  vector<int> com(q),x(q),y(q);
  for(i=0;i<q;++i){
    cin >> com[i] >> x[i] >> y[i];
  }
  for(i=0;i<q;++i){
    if(com[i]==0){
      unite(x[i],y[i]);
    }else{
      if(same(x[i],y[i])){
        cout << '1' << endl;
      }else{
        cout << '0' << endl;
      }
    }
  }
  return 0;
}



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

using namespace std;

int main(){
  
  string s;
  cin >> s;
  
  if(s[0]!=s[1]&&s[1]!=s[2]&&s[2]!=s[3]){
    cout << "Good" << endl;
  } else{
    cout << "Bad" << endl;
  }
}


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

lt = [0 for _ in range(50)]
rt = [0 for _ in range(50)]

lt[0] = 1
rt[0] = 1
lt[1] = -2
rt[1] = -1

for i in range(2, 50):
    if i % 2 == 0:
        lt[i] = rt[i - 2] + 1
        rt[i] = lt[i] + 2**i - 1
    else:
        rt[i] = lt[i - 2] - 1
        lt[i] = rt[i] - 2**i + 1


res = [0 for _ in range(50)]
while N:
    for i in range(50):
        if lt[i] <= N <= rt[i]:
            res[~i] = 1
            N -= (-2)**i
            break
            
print(int(''.join(map(str, res))))

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

#define TRACE(x) cerr << #x << " :: " << x << endl
#define _ << " " <<
#define SZ(x) (int)(x).size()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for (int i=(a);i>=(b);--i)

const int MX_N = 1e5+5;

int N, A[2*MX_N];
bool B[2*MX_N];

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

    cin >> N;
    FOR(i,1,2*N-1){
        cin >> A[i];
    }

    int lo = 0, hi = 2*N;
    while (hi-lo > 1) {
        int mid = (lo+hi)/2;

        FOR(i,1,2*N-1) B[i] = A[i] >= mid;
        bool tp;
        if (B[N] == B[N-1] || B[N] == B[N+1]) tp = B[N];
        else {
            int l = 1, r = 2*N-1;
            RFOR(i,N,1){
                if (B[i] == B[i-1]) { l = i; break; }
            }
            FOR(i,N,2*N-1){
                if (B[i] == B[i+1]) { r = i; break; }
            }
            if (l == 1 && r == N) tp = B[1];
            else tp = l != 1 && (r == 2*N-1 || (N - l) < (r - N)) ? B[l] : B[r];
        }

        if (tp) lo = mid;
        else hi = mid;
    }
    cout << lo << '\n';
}



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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) {
        par = vector<int>(N, -1);
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }

    bool unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry){
            return false;
        }
        if(par[rx]>par[ry]) swap(x,y);
        par[rx] += par[ry];
        par[ry] = rx; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        return true;
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    int N, M;
    cin >> N >> M;

    UnionFind tree(N);

    for(int i = 0; i < M; i++) {
        int  a, b;
        cin >> a >> b;
        tree.unite(a-1, b-1); // xの木とyの木を併合する
    }
    int ans=0;
    rep(i,N){
        ans=max(tree.size(i),ans);
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4464
#include <bits/stdc++.h>
using namespace std;
int main(){
	char c; cin >> c;
	if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') cout << "vowel" << endl;
	else cout << "consonant" << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    ll n, k;
    while(cin>>n>>k){
    	if(n==0){
    		printf("0\n");
    	}
    	else if(n<=k){
    		ll tmp=min(n, k-n);
    		printf("%lld\n",tmp);
    	}
    	else{
    		ll tmp=n%k;
    		tmp=min(tmp, k-tmp);
    		printf("%lld\n",tmp);
    	}
    }
  return 0;
}




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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n,m;
    cin >> n >> m;
    int32 left, right;
    left = 1;
    right = n;
    REP(i,m){
        int32 l,r;
        cin >> l >> r;
        left = max(left, l);
        right = min(right, r);
    }
    ANS(max<int32>(0, right - left + 1));
    return 0;
}

Measured memory_bytes: 256