akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

void solve() {
    string s; cin >> s; int n = s.size();
    for (int i = 0; i < n; i++) cout << 'x';
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    solve();
}


Measured memory_bytes: 256
#include<stdio.h>
int X[]={-1,-1,-1,0,0,0,1,1,1};
int Y[]={-1,0,1,-1,0,1,-1,0,1};
int mbk(long long a,int n,int m){return n?(mbk((a*a)%m,n/2,m)*(n%2?a:1))%m:1;}
int inv(int a,int m){return mbk((long long)a,m-2,m);}
int aCb(int a,int b,int m){
  int i;
  long long s=1;
  if(b>a-b)b=a-b;
  for(i=0;i<b;i++)s=(((s*(a-i))%m)*inv(i+1,m))%m;  
  return (int)s;
}
int main(){
  //printf("%d\n",aCb(5,2,107));
  int w,h,a,b,x,y,d[10][2],dx,dy,i,min=10000,s=0;
  scanf("%d %d %d %d",&w,&h,&x,&y);
  for(i=0;i<9;i++){
    d[i][0]=x+w*X[i];
    d[i][1]=y+h*Y[i];
  }
  scanf("%d %d",&x,&y);
  for(i=0;i<9;i++){
    dx=abs(d[i][0]-x);
    dy=abs(d[i][1]-y);
    if(dy+dx<min){
      min=dy+dx;
      s=0;
    }//printf("%d %d %d\n",dy,dx,max);
    if(dy+dx==min)s+=aCb(min,dx,100000007);
    s%=100000007;
  }
  printf("%d\n",s);
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    ll ans = 2 * (n / 11);
    n -= ans / 2 * 11;
    cerr << n << endl;
    if (n != 0)
    {
        if (n <= 6)
            ans += 1;
        else
            ans += 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = input()

time = []
time.append(0)

d = [0 for i in xrange(n + 1)]
f = [0 for i in xrange(n + 1)]
color = ['WHITE' for i in xrange(n + 1)]

graph_map = [[0 for j in xrange(n + 1)] for i in xrange(n + 1)]

for i in xrange(1, n + 1):
    tmp = map(int, raw_input().split())
    for j in xrange(tmp[1]):
        graph_map[i][tmp[j + 2]] = 1

def dfs(u):
    color[u] = 'GRAY'
    time[0] += 1
    d[u] = time[0]
    for v in xrange(1, n + 1):
        if graph_map[u][v] == 1 and color[v] == 'WHITE':
            dfs(v)
    color[u] = 'BLACK'
    time[0] += 1
    f[u] = time[0]

for i in xrange(1, n + 1):
    if color[i] == 'WHITE':
        dfs(i)

for i in xrange(1, n + 1):
    print "%d %d %d" % (i, d[i], f[i])

Measured memory_bytes: 6488
/* ＵＴＦ－８ */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int N;
	std::string S;
	std::cin >> N >> S;
	if (S.substr(N/2) == S.substr(0, N/2)) {
		std::cout << "Yes\n";
	} else {
		std::cout << "No\n";
	}
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {
    int N;
    int[] a = new int[]{3, 5, 7};

    private int dfs(long n, int x, int y, int z) {

        if (n > N) {
            return 0;
        }

        int ret = 0;
        if (x > 0 && y > 0 && z > 0) {
            ret += 1;
        }

        ret += dfs(n * 10 + 3, x + 1, y, z);
        ret += dfs(n * 10 + 5, x, y + 1, z);
        ret += dfs(n * 10 + 7, x, y, z + 1);

        return ret;
    }

    private void solve() {
        N = nextInt();

        int ans = dfs(0, 0, 0, 0);

        out.println(ans);
    }

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

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

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

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

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


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n + 1);
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    a[u]++;
    a[v]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << '\n';
  }
}


Measured memory_bytes: 3604
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>

using namespace std;

int m,n;
int p[10001],c[501],e[501];
int sum[10001];

int dp[501][10001];

int main(void){
	scanf("%d%d",&m,&n);
	for(int i=0;i<m;i++)scanf("%d",&p[i]);
	for(int i=0;i<n;i++)scanf("%d%d",&c[i],&e[i]);
	
	sort(p,p+m,greater<int>() );
	for(int i=1;i<=m;i++){
		sum[i]=sum[i-1]+p[i-1];
	}
	int res=0;
	memset(dp,-1,sizeof(dp));
	dp[0][0]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(dp[i][j]>=0){
				dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
				int nex=min(j+c[i],m);
				dp[i+1][nex]=max(dp[i+1][nex],dp[i][j]+sum[nex]-sum[j]-e[i]);
				res=max(res,dp[i+1][nex]);
			}
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 20696
<?php
list($n,$m)=explode(' ',trim(fgets(STDIN)));

for($i=0;$i<$n;$i++)$a[$i]=explode(' ',trim(fgets(STDIN)));

for($i=0;$i<$m;$i++)$b[$i]=trim(fgets(STDIN));
 
for($i=0;$i<$n;$i++){
  $c=0;
  for($j=0;$j<$m;$j++) $c+=$a[$i][$j]*$b[$j];
  $o[]=$c;
}
print implode(PHP_EOL,$o);
?>

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

struct Card{char suit,value;};

void bubble(struct Card A[], int N){
for(int i=0;i<N;i++){
for(int j=N-1;j>=i+1;j--){
if(A[j].value < A[j-1].value){
Card t=A[j] ; A[j]=A[j-1] ; A[j-1]=t;
}
}
}
}
void selectionSort(struct Card A[],int N){
for(int i=0;i<N;i++){
int minj=i;
for(int j=i;j<N;j++){
if(A[j].value < A[minj].value) minj=j;
}
Card t=A[i] ; A[i]=A[minj] ; A[minj]=t;
}
}
void print(struct Card A[],int N){
for(int i=0;i<N;i++){
if(i>0) cout <<" ";
cout << A[i].suit <<A[i].value;
}
cout << endl;
}
bool isStable(struct Card C1[],struct Card C2[],int N){
for(int i=0;i<N;i++){
if (C1[i].suit!=C2[i].suit) return false;
}
return true;
}
int main(){
Card C1[100],C2[100];
int N;
char ch;
cin >>N;
for(int i=0;i<N;i++){
cin >>C1[i].suit >>C1[i].value;
}
for(int i=0;i<N;i++) C2[i]=C1[i];
bubble(C1,N);
selectionSort(C2,N);
print(C1,N);
cout <<"Stable" <<endl;
print(C2,N);
if (isStable(C1,C2,N)){
cout <<"Stable"<<endl;
}
else
{
cout <<"Not stable" <<endl;
}
return 0;
}

Measured memory_bytes: 3068
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N,M = LI()
A,B = LIR(M,2)

class UF():
    def __init__(self,n):
        self.par = [i for i in range(n)]
        self.rank = [0]*n
        self.size = [1]*n

    # x が属する集合の代表値を返す
    def find(self,x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = y = self.find(self.par[x])
            return y

    # x と y の集合を結合する
    def union(self,x,y):
        px = self.find(x)
        py = self.find(y)
        if px == py:
            return
        else:
            if self.rank[px] < self.rank[py]:
                px, py = py, px
            if self.rank[px] == self.rank[py]:
                self.rank[px] += 1
            self.par[py] = px
            self.size[px] += self.size[py]
            return

    # x と y が同じ集合に属するか判定する
    def is_same(self,x,y):
        return self.find(x) == self.find(y)

    # x が属する集合の要素数を返す
    def get_size(self,x):
        return self.size[self.find(x)]

uf = UF(N)
for i in range(M):
    uf.union(A[i]-1,B[i]-1)

ans = 0
for i in range(N):
    ans = max(ans,uf.get_size(i))

print(ans)

Measured memory_bytes: 139440
import java.util.*;

import static java.lang.System.*;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long A = nl();
        long B = nl();
        long C = nl();

        long diff = Long.MAX_VALUE;

        diff = Math.min(diff, (long) (Math.ceil(A / 2.0) - Math.floor(A / 2.0)) * B * C);
        diff = Math.min(diff, (long) (Math.ceil(B / 2.0) - Math.floor(B / 2.0)) * A * C);
        diff = Math.min(diff, (long) (Math.ceil(C / 2.0) - Math.floor(C / 2.0)) * B * A);

        out.println(diff);
    }

    static int ni() {
        return sc.nextInt();
    }

    static long nl() {
        return sc.nextLong();
    }

    static String ns() {
        return sc.next();
    }

    static int[] niarr(int N) {
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
        }
        return a;
    }

    static long[] nlarr(int N) {
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextLong();
        }
        return a;
    }
}

Measured memory_bytes: 22740
using System;
public class Hello{
    static long Count(long n,long x){
        if(n < 0){
            return 0;
        }else{
            return n / x + 1;
        }
    }
    public static void Main(){
        var array = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
        var a = array[0];
        var b = array[1];
        var x = array[2];
        var count = (Count(b,x) - Count(a - 1,x));
        
        
        Console.WriteLine(count);
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>
#include <unordered_map>

using namespace std;
typedef long long  ll;

int main()
{
	ll N;
	cin >> N;
	vector<ll> seq(N);
	for (ll i = 0; i < N; i++)
	{
		cin >> seq[i];
	}
	ll ans = 0;
	for (ll i = 0; i < N; i++)
	{
		if (i + 1 == seq[i])
		{
			if (i != N - 1)
				swap(seq[i], seq[i + 1]);
			else
				swap(seq[i], seq[i - 1]);
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
ans = 0


def dfs(h):
    global ans

    if len(h) == 0:
        return None

    mi = min(h)
    ans += mi
    h = list(map(lambda i: i - mi, h))

    while True:
        r = h.index(0)
        dfs(h[:r])
        h = h[r+1:]
        if 0 not in h:
            dfs(h)
            break


if __name__ == "__main__":
    N = int(input())
    H = [int(i) for i in input().split()]
    dfs(H)
    print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, mod = 1e9 + 7;
int ans[N], fc[N], ifc[N], n, b, w, eb[N], ew[N];
int power(int a, int b) {
	if (!b)
		return 1;
	int rtr = power(a, b / 2);
	if (b % 2)
		return 1ll * rtr * rtr % mod * a % mod;
	return 1ll * rtr * rtr % mod;
}
void getFc() {
	fc[0] = ifc[0] = 1;
	for (int i = 1; i < N - 5; i++) {
		fc[i] = 1ll * fc[i - 1] * i % mod;
		ifc[i] = 1ll * ifc[i - 1] * power(i, mod - 2) % mod;
	}
	return;
}
int ch(int x, int y) {
	if (x > y)
		return 0;
	return 1ll * fc[y] * ifc[x] % mod * ifc[y - x] % mod;
}
int main() {
	getFc();
	cin >> b >> w;
	n = b + w;
	for (int i = 1; i <= n; i++)
		ew[i] = (1ll * ew[i - 1] + 1ll * (ch(w - 1, i - 1)) * power(power(2, i), mod - 2) % mod) % mod;
	for (int i = 1; i <= n; i++) 
		eb[i] = (1ll * eb[i - 1] + 1ll * (ch(b - 1, i - 1)) * power(power(2, i), mod - 2) % mod) % mod;
	for (int i = 1; i <= n; i++)
		ans[i] = (ew[i - 1] + 1ll * ((1 - eb[i - 1] - ew[i - 1]) % mod + mod) % mod  * power(2, mod - 2) % mod) % mod;
	for (int i = 1; i <= n; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}


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

int main(){
while(1){
	int n,c,a[100000+2],b[100000+2],k=0,ans=0;
	scanf("%d",&n);
	if(n==0)break;
	scanf("%d",&a[0]);
	b[0]=1;
	for(int i=2;i<=n;i++){
		scanf("%d",&c);
		if(c==a[k])b[k]++;
		else {
			if(i%2!=0){
				a[k+1]=c; b[k+1]=1; k++;
			}
			else {
				if(k==0){a[0]=c; b[0]+=1;}
				else {b[k-1]+=b[k]+1; k--;}
			}
		}
	}
	for(int i=a[0];i<=k;i+=2){
		ans+=b[i];
	}
	printf("%d\n",ans);
}
}

Measured memory_bytes: 1192
#pragma region Template
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RNG(i, a, b) for(int i = a; i < b; i++)
#define RBF(i, v) for(auto& i : v)
#define ALL(x) x.begin(), x.end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;
template<typename T> using VP = vector<pair<T, T>>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }
#pragma endregion

signed main() {
	string S, T;
	cin >> S >> T;

	int len = S.size();
	int ans = 0;
	REP(i, len) {
		if (S[i] != T[i]) ans++;
	}
	col(ans);
	return 0;
}


Measured memory_bytes: 3776
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long int
#define INF INT_MAX
#define mod 1000000007
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
    chutiyaap;
    int k,a,b;cin>>k>>a>>b;
    if(a%k==0||b%k==0)
    {
        cout<<"OK";
        return 0;
    }
    int r1=a/k,r2=b/k;
    if(r2>r1)cout<<"OK";
    else cout<<"NG";

}


Measured memory_bytes: 3652
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())
 
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const ll MOD = (ll)1000000007;//10^9+7
const ll INF2 = (ll)100000000000000000;//10^18


int main() {
    int N;
    cin>>N;
    
    cout << N*(N+1)/2 << endl;
}


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

int main() {
    int N, count = 0;
    cin >> N;
    vector<int> S(N);
    for (int i = 0; i < N; i++) {
        cin >> S.at(i);
    }
    sort(S.begin(), S.end());
    for (int i = 0; i < N - 2; i++) {
        for (int j = i + 1; j < N - 1; j++) {
            for (int k = j + 1; k < N; k++) {
                if (S.at(k) < S.at(i) + S.at(j)) {
                    count++;
                }
                else {
                    break;
                }
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int i, n;
    long p;

    n = sc.nextInt();
    p = 3;
    for(i = 1;i < 21;i++){
      if(n <= p){
        out.println(i); break;
      }
      p *= 3;
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 17364
import sys

N = int(input())
li = list(map(int, input().split()))

now = 0
count = 0
t = 0

for i in li:
  t += abs(i - now)
  now = i

t += abs(now)

li.insert(0, 0)
li.append(0)

for n in range(1, N+1):
  print(t - (abs(li[n-1] - li[n])) - abs(li[n] - li[n+1]) + abs(li[n-1] - li[n+1]))

Measured memory_bytes: 14048
#include <iostream>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <memory.h>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#define ll long long
using namespace std;

void solve() {
    ll n;
    cin >> n;
    set<ll> divisors;
    int ans = 1 + (n > 2); // n & n-1
    --n;
    for (ll i = 2; i * i <= n; ++i) { // O(sqrt(n))
        if (n % i == 0) {
            divisors.insert(i);
            ans++;
            if (n / i != i) {
                divisors.insert(n / i);
                ans++;
            }
        }
    }
    ++n;
    for (ll i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            ll rem = n;
            while (rem % i == 0)
                rem /= i;
            // n = i^j*rem
            if (rem % i == 1)
                ans++;
//            if (divisors.find(rem) != divisors.end())
//                ans++;
        }
    }
    cout << ans << endl;
}

int main() {
    int t = 1;
    while(t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()

def divisors(n):
    S,T=[],[]
    for i in range(1,int(n**.5)+1):
        if n%i==0:
            S.append(i)
            T.append(n//i)
    T.reverse()
    return S+T if S[-1]!=T[0] else S+T[1:]

def resolve():
    n,k=map(int,input().split())
    A=list(map(int,input().split()))
    D=divisors(sum(A))

    def check(d):
        B=[a%d for a in A]
        B.sort()
        res=INF
        for i in range(n):
            minus=sum(B[:i])
            plus=sum(d-b for b in B[i:])
            res=min(res,max(minus,plus))
        return res<=k

    print(max(d for d in D if(check(d))))
resolve()

Measured memory_bytes: 47152
#include<bits/stdc++.h>
#include <iomanip>
#include <iostream>
using namespace std;
using ll = long long;
ll INF = 9999999999999999;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll max(ll a, ll b){
    if(a > b) return a;
    else return b;
}
 
ll min(ll a, ll b){
    if(a < b) return a;
    else return b;
}
 
int main(void){
    int N,K; cin >> N >> K;
    vector<int> A(N); for(int i = 0; i < N; i++) cin >> A[i];
    
    int ans = (N-1) / (K-1);
    if( (N-1) % (K-1) != 0) ans++;
    cout << ans << endl;
}

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

int main(void)
{
    using namespace std;

    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            return 0;
        }
        vector<int> score(n);
        double sum_score = 0.0;
        for (int i = 0 ; i < n; i++) {
            cin >> score.at(i);
            sum_score += score.at(i);
        }
        double mean = sum_score / n;

        double sigma = 0;
        for (int i = 0; i < n; i++) {
            sigma += pow(score.at(i) - mean, 2);
        }
        printf("%lf\n", sqrt(sigma / n));
    }
    return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, M;
    cin >> N >> M;
    long long p = 1e+9 + 7;
    vector<bool> is_danger(N + 1, false);
    for (int i = 0; i < M; i++)
    {
        int a;
        cin >> a;
        is_danger[a] = true;
    }
    vector<long long> dp(N + 2, 0);
    dp[0] = 1;
    for (int i = 0; i < N; i++)
    {
        if (!is_danger[i + 1])
        {
            dp[i + 1] += dp[i] % p;
        }
        if (!is_danger[i + 2])
        {
            dp[i + 2] += dp[i] % p;
        }
    }
    cout << dp[N] % p << endl;
}

Measured memory_bytes: 1024
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

a = get_int
b = get_int
c = get_int
d = get_int
e = get_int
k = get_int

if e - a > k
  puts ':('
else
  puts 'Yay!'
end


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

struct Node{
  Node() : left(-1), right(-1), parent(-1) {};
  int left, right, parent;
};

int main(){
  vector<Node> tree;
  int n;
  cin >> n;
  tree.resize(n);

  for(int i=0; i<n; i++){
    int id, left, right;
    cin >> id >> left >> right;
    tree[id].left = left;
    tree[id].right = right;
    if(left!=-1)
      tree[left].parent = id;
    if(right!=-1)
      tree[right].parent = id;
  }

  for(int id=0; id<n; id++){
    cout << "node " << id << ": " << "parent = " << tree[id].parent << ", sibling = ";
    if(tree[id].parent == -1)
      cout << -1;
    else if(tree[tree[id].parent].left == -1 || tree[tree[id].parent].right == -1 )
      cout << -1;
    else if(tree[tree[id].parent].left == id)
      cout << tree[tree[id].parent].right;
    else
      cout << tree[tree[id].parent].left;

    cout << ", degree = ";
    int deg = 2;
    if(tree[id].left == -1)
      deg--;
    if(tree[id].right == -1)
      deg--;
    cout << deg << ", depth = ";

    int a = -1, id_now = id;
    while(id_now != -1){
      id_now = tree[id_now].parent;
      a++;
    }

    cout << a << ", height = ";
    vector<vector<int> > hgt;
    vector<int> tmpp;
    tmpp.push_back(id);
    hgt.push_back(tmpp);

    for(int i=0; i<hgt.size(); i++){
      vector<int> tmp;
      for(int j=0; j<hgt[i].size(); j++){
	if(hgt[i][j] != -1){
	  tmp.push_back(tree[hgt[i][j]].left);	
	  tmp.push_back(tree[hgt[i][j]].right);	
	}
      }
      if(tmp.size()!=0)
	hgt.push_back(tmp);
    }
    
    cout << hgt.size()-2;
    if(tree[id].parent==-1)
      cout << ", root";
    else if(tree[id].left == -1 && tree[id].right == -1)
      cout << ", leaf";
    else
      cout << ", internal node";
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<int, int>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

char rest(char c1, char c2) {
    int arr[128] = {};
    REP(i, 0, 128) {
        arr[i] = -1;
    }
    arr['R'] = arr['G'] = arr['B'] = 0;
    arr[c1] = 1;
    arr[c2] = 1;
    REP(i, 0, 128) {
        if (arr[i] == 0) {
            return i;
        }
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin, n;
    string s;
    cin, s;
    int arr[128] = {};
    ll ans = 0;
    REP(j, 0, n) {
        REP(k, j + 1, n) {
            int i = 2 * j - k;
            if (s[j] == s[k]) continue;
            char c3 = rest(s[j], s[k]);
            int cnt = arr[c3];
            if (i >= 0 && s[i] == c3) {
                cnt--;
            }
            ans += cnt;
        }
        arr[s[j]]++;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  ll N;
  cin >> N;
  ll a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  ll res = min({a, b, c, d, e});
  if (N % res==0)
    cout << N / res + 4 << endl;
  else
    cout << N / res + 5 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long ans=0,ans1=0x3f3f3f3f; 
	int A,B,C;
	int x,y;
	cin>>A>>B>>C>>x>>y;
	if(A+B>=C*2)
	{
		int n=min(x,y)*2;
		ans=ans+n*C;
		if(x>y)
		{
			ans=ans+(x-y)*A;
				
		}
		else
		{
			ans=ans+(y-x)*B;
		}
		ans1=max(x,y)*2*C;
	}
	else
	{
		ans=ans+A*x+B*y;
	}
	cout<<min(ans,ans1);
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = list(map(int, input().split()))
    result = 0
    count = 2
    while all([s % count == 0 for s in S]):
        count *= 2
        result += 1

    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n;
  R n;
  ll a[n];
  rep(i,n) R a[i];
  ll ans=MAXL;
  rep(k,2) {
    ll sum=0,cnt=0;
    rep(i,n) {
      sum+=a[i];
      if((i+k)%2) {
        if(sum<=0) {
          cnt+=abs(sum)+1;
          sum=1;
        }
      } else {
        if(sum>=0) {
          cnt+=abs(sum)+1;
          sum=-1;
        }
      }
    }
    ans=min(ans,cnt);
  }
  pr(ans);
}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
         
typedef long long ll;
using namespace std;
        
#define F first
#define S second
#define sqr(x) x*x
#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define repit(i, n) for(auto it = n.begin(); it != n.end(); ++it)
       
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);}
     
int main(){ios_base::sync_with_stdio(0);cin.tie(0);
    string s;
    cin >> s;
    int cnt = 0;
    for(int i = 0; i  < sz(s); ++i){
        for(int j = 0 ; j < sz(s); ++j){
            if(s[i] == s[j]) cnt++;
        }
        if((cnt % 2) != 0){
            cout << "No";
            exit(0);
        }
        cnt = 0;
    }
    cout << "Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD (ll)(1e9 + 7)
#define MAX (ll)(3e3 + 4)
#define INF (ll)(1e17)
using namespace std;
using ll =  long long;
using ld = long double;

ll dp[MAX][MAX];

bool ch (pair<ll, ll> p1, pair<ll, ll> p2) {
	return p1.second < p2.second;
}

int main () {
	ll n, t;
	cin >> n >> t;
	pair<ll, ll> vp[n];
	for (ll i = 0; i < n; i++) {
		cin >> vp[i].second >> vp[i].first;
	}
	sort (vp, vp + n, ch);
	ll ma = 0;
	memset (dp, -1, sizeof (dp));
	dp[0][0] = 0;
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < t; j++) {
			if (dp[i][j] != -1) {
				dp[i + 1][j] = max (dp[i + 1][j], dp[i][j]);
				if (j + vp[i].second < t) {
					dp[i + 1][j + vp[i].second] = max (dp[i + 1][j + vp[i].second], dp[i][j] + vp[i].first);
				}
				ma = max (ma, dp[i + 1][j]);
				ma = max (ma, dp[i][j] + vp[i].first);
			}
		}
	}
	cout << ma << "\n";
}
		


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

int main() {
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);

  vector<int> v(n);
  v.at(0) = a.at(0) + (k - a.at(n - 1));//跨ぐところ
  for (int i = 0; i + 1 < n; i++) {
    v.at(i + 1) = a.at(i + 1) - a.at(i);
  }

  cout << k - *max_element(v.begin(), v.end()) << "\n";
}//[first, last)の範囲において、最大要素を指す最初のイテレータを取得する。


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int main(){
    int k,s;
    cin>>k>>s;
    
    int ans=0;
    rep(x,k+1){
        rep(y,k+1){
            int z=s-x-y;
            if(0<=z&&z<=k) ans++;
        }
    }
    
    cout<<ans<<endl;
}



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

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

    // input
    ll N, K;
    cin >> N >> K;

    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A.at(i);
    }

    vector<ll> space;
    FOR(i, 0, N-1){
        ll diff = A[i+1] - (A[i]+1);
        space.push_back(diff);
    }
    sort(ALL(space));
    // vprint(space);

    ll sum = 0;
    FOR(i, 0, N-K){
        sum += space[i];
    }

    p(sum + N);
    
    return 0;
}


Measured memory_bytes: 4648
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = (int) 1e5 + 5;
const int mod = (int) 1e9 + 7;

inline bool ask (int x, int y) {
        printf ("? %d %d\n", x - 1, y - 1);
        fflush (stdout);
        char c; cin >> c;
        return c == 'Y';
}

int s[N], a, b, sz, n, x, ans[N];

inline void solve () {
        scanf ("%d%d", &a, &b);
        if (a <= b) {
                puts ("Impossible");
                fflush (stdout);
                return;
        }
        n = a + b;
        for (int i = 1; i <= n; i++) {
                if (!sz || (sz && ask (s[sz], i))) {
                        s[++sz] = i;
                } else {
                        sz--;
                }
        }
        x = s[sz];
        ans[x] = 1;
        for (int i = 1; i <= n; i++) {
                if (i != x) {
                        ans[i] = ask (x, i);
                }
        }
        printf ("! ");
        for (int i = 1; i <= n; i++) {
                printf ("%d", ans[i]);
        }
        puts ("");
        fflush (stdout);
}

int tests = 1;

int main () {
//        freopen (".in", "r", stdin);
//        freopen (".out", "w", stdout);
//        scanf ("%d", &tests);
        while (tests--) {
                solve ();
        }
        return 0;
}


Measured memory_bytes: 724
#include <bits/stdc++.h>
#define inf 1e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main(){
  int a, b;
  cin >> a >> b;
  int c = a;
  int ans = 1;
  while (c < b) {
    c += a-1;
    ans++;
  }
  if (b == 1) ans = 0;
  cout << ans << endl;
}

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

int main(){
    int n;
    int ans;
    int f[44];
    f[0] = 1;
    f[1] = 1;
    cin >> n;
    for(int i=2; i<=n; i++) f[i] = f[i-1] + f[i-2];
    ans = f[n];
    cout << ans << '\n';
}



Measured memory_bytes: 3092
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{
        x: usize
    }

    let ans = match x {
        400..=599 => 8,
        600..=799 => 7,
        800..=999 => 6,
        1000..=1199 => 5,
        1200..=1399 => 4,
        1400..=1599 => 3,
        1600..=1799 => 2,
        _ => 1,
    };  
    println!("{}", ans);
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


Measured memory_bytes: 2196
# -*- coding: utf-8 -*-
n = int(raw_input())
l = []
for i in range(n):
  l.append(int(raw_input()))
#print(l)

flag = [0] *110
#print(flag)
for j in l:
  if flag[j] == 0:
    flag[j] = 1
#print(flag)

num = 0
for k in flag:
#  print(k)
  if k == 1:
    num += 1
print(num)

"""
##これだとエラーでる
##flag[k]だとflag[0]かflag[1]にしかならないことに注意
num = 0
for k in flag:
  print(flag[k])
  if flag[k] == 1:
    num += 1
print(num)
"""

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

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

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

int main()
{
    int q, query, i, cnt;
    int bit[64];
    bool judge;

    for( int j = 0; j < 64; j++ )
        bit[j] = 0;

    cin >> q;

    while( q-- )
    {
        cin >> query;

        switch( query )
        {
            case 0:
                cin >> i;
                if( bit[i] == 0 )
                    cout << 0 << endl;
                else
                    cout << 1 << endl;
                break;
            case 1:
                cin >> i;
                bit[i] = 1;
                break;
            case 2:
                cin >> i;
                bit[i] = 0;
                break;
            case 3:
                cin >> i;
                if( bit[i] == 0 )
                    bit[i] = 1;
                else
                    bit[i] = 0;
                break;
            case 4:
                judge = true;
                for( int j = 0; j < 64; j++ )
                    if( bit[j] == 0 )
                        judge = false;
                cout << judge << endl;
                break;
            case 5:
                judge = false;
                for( int j = 0; j < 64; j++ )
                    if( bit[j] == 1 )
                        judge = true;
                cout << judge << endl;
                break;
            case 6:
                judge = true;
                for( int j = 0; j < 64; j++ )
                    if( bit[j] == 1 )
                        judge = false;
                cout << judge << endl;
                break;
            case 7:
                cnt = 0;
                for( int j = 0; j < 64; j++ )
                    if( bit[j] == 1 )
                        cnt++;
                cout << cnt << endl;
                break;
            case 8:
                unsigned long long sum = 0;
                unsigned long long z = 1;
                for( int j = 0; j < 64; j++ )
                {
                    if( bit[j] == 1 )
                        sum += z;
                    z *= 2;
                }
                cout << sum << endl;
                break;
        }
    }
    return 0;
}



Measured memory_bytes: 3116
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, char> Pc;
typedef pair<int, string> Ps;

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};
const int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const string dir8[8] = {"U", "RU", "R", "RD", "D", "LD", "L", "LU"};

// Self settings
// clang-format off
#define MAX_N 100000
#define MAX 100000
#define INFTY (1<<30)
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } Point operator*(double a) { return Point(a * x, a * y); } Point operator/(double a) { return Point(x / a, y / a); } double abs() { return sqrt(norm()); } double norm() { return x * x + y * y; } bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; } bool operator==(const Point& p) const { return fabs(x - p.y) < EPS && fabs(y - p.y) < EPS; } };
typedef Point Vector;
double norm(Vector a) { return a.x * a.x + a.y * a.y; }
double abs(Vector a) { return sqrt(norm(a));}
double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }
struct Segment { Point p1, p2; };
typedef Segment Line;
struct Node { int data; Node *left, *right; Node(int data) : data(data), left(NULL), right(NULL) {} };
// clang-format on

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int A, B, K;
  cin >> K >> A >> B;
  for (int i = A; i <= B; i++) {
    if (i % K == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;

  return 0;
}


Measured memory_bytes: 3160
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;

namespace AtCoder
{
    class Program
    {
        private static long mod = 1000000007;
        static void Main(string[] args)
        {
            var n = int.Parse(ReadLine());
            //var line = ReadLine().Split(' ').Select(value => long.Parse(value)).ToArray();

            if(n < 600)
            {
                WriteLine(8);
            }
            else if(n < 800)
            {
                WriteLine(7);
            }
            else if(n < 1000)
            {
                WriteLine(6);
            }
            else if (n < 1200)
            {
                WriteLine(5);
            }
            else if (n < 1400)
            {
                WriteLine(4);
            }
            else if (n < 1600)
            {
                WriteLine(3);
            }
            else if (n < 1800)
            {
                WriteLine(2);
            }
            else
            {
                WriteLine(1);
            }
        }
    }
}


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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

int main(){
    init();
    int n;
    cin >> n;
    string arr[n];
    for(int i = 0;i<n;i++){
        string x; cin >> arr[i];
        if(i>0 && arr[i][0] != arr[i-1][arr[i-1].length()-1])
        {

            cout << "No";
            return 0;
        }
    }
    sort(arr,arr+n);
    for(int i = 0;i<n-1;i++){
        if(arr[i] == arr[i+1]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX=200000;
int main()
{
    int R[MAX],n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>R[i];
    }
    int maxv=-2000000000;
    int minv=R[0];
    for(int i=1;i<n;i++)
    {
        maxv=max(maxv,R[i]-minv);
        minv=min(minv,R[i]);

    }
    cout<<maxv<<endl;
    return 0;
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
int const MX = 2e5 + 1, MOD = 1e9 + 7;
int a[MX], b[MX];
int main()
{
    int t = 1;
//    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int ans = 0;
        for(int i = 1; i <= n; i++){
            for(int a = 1; i*a < n; a++){
                ans++;
            }
        }
        cout<<ans;
    }
}


Measured memory_bytes: 3608
#include <iostream>

int n;
int sum;

int main(){
	std::cin >> n;
	for(int i = 0; i < n; ++i){
		int a;
		std::cin >> a;
		if(a % 2)++sum;
	}
	
	std::cout << (sum % 2 == 0 ? "YES" : "NO") << std::endl;
	
	return 0;
}

Measured memory_bytes: 256
fun main() {
    val s = readLn()

    val mod673 = mutableListOf<Int>()
    val mod3 = mutableListOf<Int>()
    val mod = 673


    val mul = mutableListOf<Int>()
    mul.add(1)
    for (i in s.length - 1 downTo 0) {
        val num = (s[i] - '0')
        mod673.add(((if (mod673.isNotEmpty()) mod673.last() else 0) + mul[s.length - i - 1] * num) % mod)
        mod3.add((num + if (mod3.isNotEmpty()) mod3.last() else 0) % 3)
        mul.add((mul.last() * 10) % mod)
    }

    val occurs = mutableMapOf<Pair<Int, Int>, Int>()
    occurs[Pair(0, 0)] = 1

    mod673.forEachIndexed { index, it ->
        val key = Pair(it, mod3[index])
        occurs[key] = occurs[key]?.plus(1) ?: 1
    }
    var ans = 0L
    occurs.forEach { (_, occ) -> ans += (occ.toLong() * (occ - 1)) / 2 }
    println(ans)
}

// Input Reader
private fun readLn() = readLine()!!


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

int main(){
    int A,B;
    int K=0;
    cin >> A >> B;
    K = (A+B)/2;
    if(abs(A-K) == abs(B-K)){
        cout << K << endl;
    }else{
        cout<<"IMPOSSIBLE"<<endl;
    }

}

Measured memory_bytes: 256
*xyz,k = map(int, input().split()) 
xyz_list = []
xyz_list.append(list(map(int, input().split())))
xyz_list.append(list(map(int, input().split())))
xyz_list.append(list(map(int, input().split())))
xyz_list[0].sort(reverse=True)
xyz_list[1].sort(reverse=True)
xyz_list[2].sort(reverse=True)

print(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])
p = [1,0,0]
num = lambda x: [
    [x[0]+p[i], x[1]+p[(4-i)%3], x[2]+p[(5-i)%3],
    xyz_list[0][x[0]+p[i]]+xyz_list[1][x[1]+p[(4-i)%3]]+xyz_list[2][x[2]++p[(5-i)%3]]]
    for i in range(3) if x[i]+1 < xyz[i]]
stack = num([0,0,0])
num_dict={}
for i in stack:
    if i[3] not in num_dict:
        num_dict[i[3]] = [[i[0], i[1], i[2]]]
    else:
        num_dict[i[3]].append([i[0], i[1], i[2]])
k -= 1
while k != 0:
    x, y, z, maxi = max(stack, key=lambda x:x[3])
    print(maxi)
    k -= 1
    if k == 0:
      break
    stack.remove([x,y,z,maxi])
    for i in num([x,y,z]):
        if i[3] not in num_dict:
            num_dict[i[3]] = [[i[0], i[1], i[2]]]
            stack.append([i[0], i[1], i[2], i[3]])
        elif [i[0], i[1], i[2]] not in num_dict[i[3]]:
            num_dict[i[3]].append([i[0], i[1], i[2]])
            stack.append([i[0], i[1], i[2], i[3]])


Measured memory_bytes: 5900