akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>
#include<bitset>

//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;



int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;
	
	ll n;
	cin >> n;
	ll ans = 0;
	for (ll a = 1; a <= n; a++)
	{
		ll b = n / a;
		if (a * b == n)
			ans += max(0LL, b - 1);
		else
			ans += b;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007
using namespace std;

int main(){
	int k, s; cin>>k>>s;
	int cnt = 0;
	for(int i=0; i<=k; i++)
	for(int j=0; j<=k; j++)
		if(s-i-j <= k and s-i-j >= 0)cnt++;
	
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
//int -> ll
//http://web.mit.edu/~ecprice/acm/acm08/notebook.html#file12
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include<bits/stdc++.h>
typedef long long ll;
#define x first
#define y second
#define all(aaa) (aaa).begin(),(aaa).end()
#define REP(i,sss,eee) for(int i=sss;i<=eee;++i)
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define speed ios_base::sync_with_stdio(0);cin.tie(0);
#define N 1000000007
using namespace __gnu_pbds;
using namespace std;
template <class T>
T MAX(T a, T b){return ((a>b)?a:b);}
template <class T>
T MIN(T a, T b){return ((a<b)?a:b);}
template <class T>
T MOD(T a){return ((a>=0)?a:(-1*a));}
template <class T>
void SWAP(T &a,T &b){T temp=a;a=b;b=temp;}
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
long long ex(long long a, long long b){
	if(b==0||a==1){return 1;}
	if(a==0||b==1){return a;}
	long long tmp=ex(a,(b/2));
	if(b%2){return ((((tmp*tmp)%N)*a)%N);}
	else{return ((tmp*tmp)%N);}
}
long long inv(long long k){
	if(k==1){return 1;}
	else{return ex(k,N-2);}
}
/*****************default********************/
int solve()
{
	int t,x;cin>>t>>x;
	printf("%.10lf\n", ((t*1.00)/(x*1.00)));

}
signed main(){
	speed
	int tt=1;
	//cin>>tt;
	while(tt--)
	{
		solve();
	}
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define orep(i, n) for(int i = 1; i < (int)(n); ++i)
#define rrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main() {
    int a, b;
    cin >> a >> b;
    if (a >= 10 || b >= 10)cout << "-1" << endl;
    else cout << a * b << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int v[n+1];
    for(int i=0; i<n; i++){
        cin >> v[i];
    }
    long long cnt=0, maxi=max(v[0],v[1]);
    for(int i=1; i<n; i++){
        maxi = (v[i]>maxi) ? v[i] : maxi;
        if(v[i] >= v[i-1]) continue;
        else {
            cnt += (maxi-v[i]);
//            cout << cnt <<endl;
            v[i] = maxi;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3828
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
			System.out.println("Possible");
		} else {
			System.out.println("Impossible");
		}
	}
}

Measured memory_bytes: 23124
from collections import namedtuple
from functools import lru_cache

Item = namedtuple('Item', ('v', 'w'))


class Solver():
    def __init__(self, N, W, items):
        self.N = N
        self.W = W
        self.items = items

    @lru_cache(maxsize=None)
    def dfs(self, w, index):
        item = items[index]
        if index == self.N - 1:
            if w + item.w <= self.W:
                return item.v
            else:
                return 0

        if w + item.w <= self.W:
            return max([
                # skip this item
                self.dfs(w, index + 1),
                # Store this item
                item.v + self.dfs(w+item.w, index + 1)
            ])
        else:
            # Skip this item
            return self.dfs(w, index + 1)

    def solve(self):
        # 重さゼロの状態でゼロ番目の品物から評価
        return self.dfs(0, 0)


if __name__ == "__main__":
    N, W = list(map(int, input().split()))
    items = []
    for _ in range(N):
        v, w = list(map(int, input().split()))
        items.append(Item(v=v, w=w))

    s = Solver(N, W, items)
    print(s.solve())



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

using namespace std;
typedef long long int ll;

#define p(V) for(int iiv=0;iiv<V.size();iiv++) cout<<V[iiv]<<" ";
#define mp make_pair
#define pb push_back
#define graph vector<vector<int> >
#define pf first
#define ps second
#define pq priority_queue
const int N = 2e5;
const int l = 18;
const double pi = acos(-1);

int n , dp[N] , k;
vector<int> v;
int main(){   
    cin >> n >> k;
    v.resize(n);
    for(int i=0;i<n;i++) cin >> v[i];
    for(int i=0;i<n;i++) dp[i]=1e9;
    dp[n-1]=0;
    for(int i=n-2;i>=0;i--)
        for(int j=1;j<=k;j++)
            if(j+i < n)
                dp[i]=min(dp[i],dp[i+j]+abs(v[i]-v[i+j]));
    cout<<dp[0];
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    int a, b, c; cin>>a>>b>>c;
    if(a == b && b == c && c == a) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;
typedef long long ll;
// Welcome to my source code!

#define SENTINEL 2000000000

int cnt = 0;

void merge(int A[], int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    int L[n1], R[n2];
    rep(i,n1) L[i] = A[left + i];
    rep(i,n2) R[i] = A[mid + i];
    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;
    for (int k = left; k < right; k++) {
        cnt++;
        if (L[i] <= R[j]) {
            A[k] = L[i];
            i++;
        } else {
            A[k] = R[j];
            j++;
        }
    }
}

void mergeSort(int A[], int left, int right) {
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main() {
    int n;
    cin >> n;
    int A[n];
    rep(i,n) cin >> A[i];

    mergeSort(A, 0, n);

    rep(i,n) {
        if (i) cout << ' ';
        cout << A[i];
    }

    cout << '\n' << cnt << endl;
}


Measured memory_bytes: 6884
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;

int main() {
   int can[3];
   rep(i,3){
       cin>>can[i];
   }
   sort(can,can+3);
   if(can[0]+can[1]==can[2]){
       cout<<"Yes"<<endl;
   }else{
       cout<<"No"<<endl;
   }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        char[] s = scanner.next().toCharArray();
        int p1 = 0;
        int p2 = 0;
        int N = s.length;
        int[] end = new int[N];
        while(p1 < N || p2 < N) {
            while(p2 < N && s[p2] == s[p1]) p2++;
            if (s[p1]=='R') while(p1 != p2) end[p1++] = p2-1;
            else {
                for(int i = p1; i < p2; i++) end[i] = p1;
                p1 = p2;
            }
        }
        int[] ans = new int[N];
        for(int i =0; i < N; i++) {
            int dist = Math.abs(end[i] - i);
            if (dist % 2 == 0 && s[i] == 'R') ans[end[i]]++;
            if (dist % 2 == 1 && s[i] == 'R') ans[end[i]+1]++;
            if (dist % 2 == 0 && s[i] == 'L') ans[end[i]]++;
            if (dist % 2 == 1 && s[i] == 'L') ans[end[i]-1]++;
        }
        for(int i = 0; i < N; i++) {
            if (i > 0) out.print(" " );
            out.print(ans[i]);
        }
        out.println();
        out.flush();
    }
    
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 30208
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  string S,T;
  cin >> S >> T;

  int ans=0;
  for(int i=0;i<sz(S);i++){
    if(S.at(i)!=T.at(i))  ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3728
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;
/*                                                                              
Node treeMinimum(Node x){                                                       
                                                                                
                                                                                
}                                                                               
                                                                                
Node treeMaximum(Node x){                                                       
                                                                                
                                                                                
}                                                                               
*/
Node treeSearch(Node u, int k){
  while(u != NIL && k != u->key){
    if( k < u->key ){
      u = u->left;
    }
    else u = u->right;
  }
  return u;

}
/*                                                                              
Node treeSuccessor(Node x){                                                     
                                                                                
                                                                                
}                                                                               
*/
void treeDelete(Node z){
  Node y; // node to be deleted                                                 
  Node x; // child of y                                                         



}
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y=x;
    if(z->key < x->key)x = x->left;
    else x = x->right;

  }
  z->parent =y;
  if(y == NIL)root = z;
  else {
    if(z->key < y->key)y->left = z;
    else y->right = z;
  }


}

void inorder(Node u){
  if(u == NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);

}
void preorder(Node u){


  if(u == NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);

}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}


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

int main(){
  int n,t[110000],x[110000],y[110000];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>t[i]>>x[i]>>y[i];
  }
  for(int i=1;i<=n;i++){
    if(t[i-1]<x[i-1]+y[i-1]) {cout<<"No"; return 0;}
    if(abs(t[i]-t[i-1])<abs(x[i]-x[i-1])+abs(y[i]-y[i-1])){cout<<"No"; return 0;}
  }
  for(int i=0;i<n;i++){
    if((t[i]%2==0 && (x[i]+y[i])%2==0) ||(t[i]%2!=0 && (x[i]+y[i])%2!=0)) continue;
    else {cout<<"No"; return 0;}
  }
  cout<<"Yes";
}


Measured memory_bytes: 4800
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)

const long long  int INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
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; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
#define COUT(x) cout<<x<<"\n"

void Main()
{
	ll N;
	ll result=0;
	string S;
	cin>>S;
	REP(i, SIZE(S)) {
		if(S[i]=='+')
			result++;
		else result--;
	}
	
	cout << result << "\n";
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1000000+5;
int m,Pow[20];
int trie[N][3],val[N],tag[N],tot=1;
void insert(int x){
	int pos=x;
	vector<int> vec;
	while(x) vec.push_back(x%3),x/=3;
	while(vec.size()<m) vec.push_back(0);
	int p=1;
	for(int i=0;i<vec.size();++i){
		if(!trie[p][vec[i]]) trie[p][vec[i]]=++tot;
		p=trie[p][vec[i]];
	}
	val[p]=pos;
}
void push_down(int p){
	if(!tag[p]) return;
	for(int i=0;i<3;++i)
		tag[trie[p][i]]^=1;
	tag[p]=0;
	swap(trie[p][1],trie[p][2]);
}
void reverse(int p){
	tag[p]^=1;
}
void add(int p){
	if(!p) return;
	push_down(p);
	int t=trie[p][2];
	trie[p][2]=trie[p][1];
	trie[p][1]=trie[p][0];
	trie[p][0]=t; 
	add(trie[p][0]);
}
map<int,int> res;
void query(int p,int sum,int dep){
	if(!p) return;
	push_down(p);
	res[val[p]]=sum;
	for(int i=0;i<3;++i)
		query(trie[p][i],sum+i*Pow[dep],dep+1);
}
int main(){
	memset(val,-0x3f,sizeof(val));
	cin>>m;
	Pow[0]=1;
	for(int i=1;i<=m;++i)
		Pow[i]=Pow[i-1]*3;
	for(int i=0;i<Pow[m];++i)
		insert(i);
	string T;cin>>T;
	for(int i=0;i<T.size();++i)
		if(T[i]=='S') reverse(1);
		else add(1);
	query(1,0,0);
	for(int i=0;i<Pow[m];++i)
		cout<<res[i]<<" ";
	return 0;
}

Measured memory_bytes: 45588
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n, i;
    cin >> n >> i;
    cout << n - i + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    static void solve() {
        int n = nextInt();
        int a = nextInt();
        int b = nextInt();

        int ans = Math.min(a * n, b);
        out.println(ans);
    }

    static PrintWriter out;
    static Scanner sc;

    static int[][] newIntArray(int h, int w, int value) {
        int[][] ret = new int[h][w];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                ret[i][j] = value;
            }
        }
        return ret;
    }

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

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

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

    static int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    static List<Integer> nextIntList(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextInt());
        }
        return list;
    }

    static List<Long> nextLongList(int n) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextLong());
        }
        return list;
    }

    static char[][] nextCharArray(int h, int w) {
        char[][] c = new char[h][w];
        for (int i = 0; i < h; i++) {
            String str = nextString();
            for (int j = 0; j < w; j++) {
                c[i][j] = str.charAt(j);
            }
        }
        return c;
    }

    static <T extends Comparable<? super T>> void sort(List<T> list) {
        Collections.sort(list);
    }

    // greatest common divisor
    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    // baseのn乗を計算を返す
    static int pow(int base, int n) {
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret *= base;
        }
        return ret;
    }

    // return n^k mod m
    static long powMod(long n, long k, long m) {
        if (k == 0) {
            return 1;
        } else if (k % 2 == 1) {
            return powMod(n, k - 1, m) * n % m;
        } else {
            long tmp = powMod(n, k / 2, m);
            return tmp * tmp % m;
        }
    }

    // intをlength桁のbit文字列に変換
    static String toBinaryString(int input, int length) {
        return toBinaryString(input).substring(29 - length);
    }

    // intを29桁のbit文字列に変換
    static String toBinaryString(int input) {
        String ret = "";
        int max = 0x10000000;
        for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        }
        return ret;
    }

    public static void main(String[] args) {
        out = new PrintWriter(System.out);
        sc = new Scanner(System.in);

        solve();

        out.flush();
        sc.close();
    }

}


Measured memory_bytes: 23764
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>

using namespace std;
int main()
{/*二日目*/
	int k, a, b; cin >> k>> a>> b;
	bool ok=false;
	for (int i = a;i <= b;i++) {
		if (i % k == 0) {
			ok = true;
			break;
		}
	}
	if (ok)
		cout << "OK";
	else
		cout << "NG";
	

	
}
	



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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;

    int dp[n] = {0};
    dp[1] = s.substr(0, 2) == "AC";

    for(int i = 2; i < s.length(); ++i){
        string subs = s.substr(i-1, 2);
        
        if(subs == "AC") dp[i] = dp[i-1] + 1;
        else dp[i] = dp[i-1];
    } 

    for (int i = 0; i < q; ++i){
        int l, r;
        cin >> l >> r;
        cout << dp[r-1] - dp[l-1] << endl;
    }
}

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

int main()
{
	string s; cin >> s;
	
	stack<char> st;
	
	for (int i = 0; i < s.size(); i++) {

		if (s[i] == '0') {
			st.push('0');
		}
		else if (s[i] == '1') {
			st.push('1');
		}
		else {
			if (0 < st.size()) {
				st.pop();
			}
		}

	}
	
	int n = st.size();

	string  ans = "";	
	for (int i = 0; i < n; i++) {
		ans += st.top();
		st.pop();
	}

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _cin      ios_base::sync_with_stdio(0);  cin.tie(0);
#define READ      freopen("input.txt", "r", stdin);
#define WRITE     freopen("output.txt", "w", stdout);
#define endl "\n"
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repd(i,a,b) for(ll i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define vvll vector<vector<ll> >
#define vll vector<ll>
#define mint map<ll,ll>
#define sz(x) (ll)x.size()
#define sll set<ll>
#define pll pair<ll,ll>
#define F first
#define S second
const ll MAX = 1000004;
ll ans = 0;

int main() {

	_cin
	// READ
	// WRITE
	ll n;
	cin >> n;
	ll dp[3];
	memset(dp, 0, sizeof(dp));
	rep(i, 0, n) {
		ll dp_n[3];
		memset(dp_n, 0, sizeof(dp_n));
		ll c[3];
		rep(i, 0, 3) cin >> c[i];
		rep(j, 0, 3) {
			rep(k, 0, 3) {
				if (j != k) {
					dp_n[k] = max(dp_n[k], dp[j] + c[k]);
				}
			}
		}

		rep(i,0,3) dp[i]=dp_n[i];

	}
	cout<<max(dp[0],max(dp[1],dp[2]))<<endl;

}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}



int main() {
    int n,ans = 0;
    string s;
    cin >> n;
    cin >> s;
    // 000 ~ 009までのチェック
    for (int i = 0; i <= 9; ++i) {
        int flg = 0,flg2 = 0;
        for (int a = 0; a < n; ++a) {
            if(s[a]-'0' == 0 && flg == 0){
                flg = 1;
                continue;
            }
            if(s[a]-'0' == 0 && flg == 1 && flg2 == 0){
                flg2 = 1;
                continue;
            }
            if(s[a]-'0' == i && flg == 1 && flg2 == 1){
                ans++;
                break;
            }
        }
    }

    // 010 ~ 099
    for (int i = 10; i <= 99; ++i) {
        int manaka = (i/10);
        int flg = 0,flg2 = 0;
        for (int a = 0; a < n; ++a) {
            if(s[a]-'0' == 0 && flg == 0){
                flg = 1;
                continue;
            }
            if(s[a]-'0' == manaka && flg == 1 && flg2 == 0){
                flg2 = 1;
                continue;
            }
            if(s[a]-'0' == (i%10) && flg == 1 && flg2 == 1){
                ans++;
                break;
            }
        }
    }

    // 100 ~ 999
    for (int i = 100; i <= 999; ++i) {
        int ue = (i/100),manaka = (i/10)%10;
        int flg = 0,flg2 = 0;
        for (int a = 0; a < n; ++a) {
            if(s[a]-'0' == ue && flg == 0){
                flg = 1;
                continue;
            }
            if(s[a]-'0' == manaka && flg == 1 && flg2 == 0){
                flg2 = 1;
                continue;
            }
            if(s[a]-'0' == (i%10) && flg == 1 && flg2 == 1){
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int n;
P sec[101010];

int main()
{
    cin >> n;
    rep(i, n)
    {
        int x, l;
        cin >> x >> l;
        sec[i].first = x + l;
        sec[i].second = x - l;
    }
    sort(sec, sec + n);

    int res = 0, pos = -1000000001;
    rep(i, n)
    {
        if(pos <= sec[i].second)
        {
            pos = sec[i].first;
            res++;
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!(usize);
    let mut tree = vec![vec![]; n];
    use std::collections::HashMap;
    let mut ws = HashMap::new();
    
    for _ in 1..n {
        let u = get!(usize)-1;
        let v = get!(usize)-1;
        let w = get!();
        tree[u].push(v);
        tree[v].push(u);
        let k = (u, v);
        *ws.entry(k).or_insert(0) = w;
        let k = (v, u);
        *ws.entry(k).or_insert(0) = w;
    }
    
    let mut ns = vec![3; n];
    ns[0] = 0;
    let mut tmp = vec![];
    tmp.push(0);
    while tmp.len() > 0 {
        let e = tmp.pop().unwrap();
        let c = ns[e];
        for &r in tree[e].iter() {
            if ns[r] != 3 {
                continue;
            }
            let k = (e, r);
            if (*ws.entry(k).or_insert(0)) % 2 == 0 {
                ns[r] = c;
            } else {
                ns[r] = 1 - c;
            }
            tmp.push(r);
        }
    }
    
    for i in 0..n {
        println!("{}", ns[i]);
    }
}


Measured memory_bytes: 28208
import java.util.*;
import java.io.*;
import java.math.*;
class Main{
	static int mod = 998244353;
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	public static void main(String sp[])throws IOException{
		FastReader sc = new FastReader();
		long n = sc.nextLong();
		long a = sc.nextLong();
		long b = sc.nextLong();
		
		long diff = Math.abs(a-b);
		long min  = Long.MAX_VALUE;
		if(diff%2!=0){
			if(a==1 || b==1 || a==n || b==n){
				System.out.println(1+((diff-1)/2));
			}else{
				min = Math.min(Math.max(a,b)-1 , n - Math.min(a,b));
				long temp1 = (a-1);
				long temp2 = (n-b);
				long temp3 = (b-(a-1));
				long temp4 = (a+(n-b));
				long mod1 = (temp3-1)%2;
				long mod2 = (n-temp4)%2;	
				long g = Math.min(temp1 + mod1 + (temp3-1)/2 , temp2 + mod2 + (n-temp4)/2);
				System.out.println(Math.min(g,min));
			}	
		}
		else if(diff%2==0){
			System.out.println(diff/2);
		}
	}
	
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;


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

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

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

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

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

}

Measured memory_bytes: 23124
//************************
//*  Date: 2018.8.25     *
//*  Problem:            *
//*  Author: xuziyuan    * 
//************************

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,m,w,pos;
string s[110];
bool com=true,col[110][2],row[110][2],vis[110][110];
vector <string> ans;

int main()
{
	cin>>n>>m;
	rep(i,n) cin>>s[i];
	rep(i,n)
	{
		rep(j,m)
		{
			if(vis[i][j]) continue;
			if(s[i][j]=='.')
			{
				row[i][0]=true;
				col[j][0]=true;
			}
			else
			{
				row[i][1]=true;
				col[j][1]=true;
			}
		}
	}
	rep(i,n)
	{
		if(row[i][0]&& !row[i][1])
		{
			com=true;
			rep(j,m) vis[i][j]=true;
		}
	}
	rep(i,m)
	{
		if(col[i][0]&& !col[i][1])
		{
			com=true;
			rep(j,n) vis[j][i]=true;
		}
	}
	rep(i,n)
	{
		string tmp="";
		rep(j,m) if(!vis[i][j]) tmp.pb(s[i][j]);
		if(tmp.size()>0) ans.pb(tmp);
	}
	rep(i,ans.size())
	{
		printf("%s\n",ans[i].c_str());
	}
	rt0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        int n = sc.nextInt();
        long a[] = new long[n];
        long b[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            b[i] = a[i] - (i + 1);
        }

        Arrays.sort(b);
        int cp = n / 2;
        long center = b[cp];

        long sum = 0;
        for (int i = 0; i < n; i++) {
            sum += Math.abs(a[i] - (center + i + 1));
        }
        System.out.println(sum);
    }

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


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

class MainClass
{
    static int N, K;
    static void Main()
    {
        var NK = ReadLine().Split().Select(int.Parse).ToArray();
        N = NK[0];K = NK[1];
        var max = (int)Modular.Ncr(N - 1, 2);
        if (K > max) { WriteLine(-1);return; }
        int d = max - K;
        WriteLine(d + N-1);
        for (int i = 2; i <= N; i++)
        {
            WriteLine($"1 {i}");
        }
        int num = 0;
        if (d == 0) return;
        for (int i = 2; i <=N-1; i++)
        {
            for (int j = i+1 ; j <= N; j++)
            {
                num++;
                WriteLine($"{i} {j}");
                if (num == d) return;
            }
        }
    }
}
class Modular
{
    private const int M = 1000000007;
    private long value;
    public Modular(long value = 0) { this.value = value; }
    public static implicit operator Modular(long a)
    {
        var m = a % M;
        return new Modular((m < 0) ? m + M : m);
    }
    public static Modular operator +(Modular a, Modular b)
    => a.value + b.value;
    public static Modular operator -(Modular a, Modular b)
    => a.value - b.value;
    public static Modular operator *(Modular a, Modular b)
    => a.value * b.value;
    public static Modular Pow(Modular a, int n)
    {
        switch (n)
        {
            case 0:
                return 1;
            case 1:
                return a;
            default:
                var p = Pow(a, n / 2);
                return p * p * Pow(a, n % 2);
        }
    }
    public static Modular operator /(Modular a, Modular b)
    {
        return a * Pow(b, M - 2);
    }
    private static readonly List<int> facs = new List<int> { 1 };
    public static Modular Fac(int n)   //階乗
    {
        for (int i = facs.Count; i <= n; ++i)
        {
            facs.Add((int)(Math.BigMul(facs.Last(), i) % M));
        }
        return facs[n];
    }
    public static Modular Fac(int r, int n)
    {
        int temp = 1;
        for (int i = r; i <= n; i++)
        {
            temp = (int)(Math.BigMul(temp, i) % M);
        }
        return temp;
    }
    public static Modular Ncr(int n, int r) //nCr
    {
        return (n < r) ? 0
             : (n == r) ? 1
                        : (n < 1000000) ? Fac(n) / (Fac(r) * Fac(n - r))
                            : Fac(n - r + 1, n) / Fac(r);
    }
    public static explicit operator int(Modular a)
    {
        return (int)a.value;
    }
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

//-----------------------------------------------------------------------------

int n;
ll y;

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

	cin>>n>>y;
	REP(i,n+1) {
		REP(j,n-i+1) {
			if(i*10000+j*5000+(n-i-j)*1000==y) {
				cout<<i<<' '<<j<<' '<<(n-i-j)<<endl;
				return 0;
			}
		}
	}
	cout<<-1<<' '<<-1<<' '<<-1<<endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = Integer.parseInt(sc.next());
    long A = Long.parseLong(sc.next());
    long B = Long.parseLong(sc.next());
    long K = Long.parseLong(sc.next());

    final long p = 998244353;

    combination nC = new combination(N, p);

    long ans = 0;
    long b = 0;
    for (int a = 0; a <= N; a++) {
      b = (K - A * a) / B;
      if (A * a > K) {
        break;
      } else if ((K - A * a) % B != 0 || b > (long) N) {
        continue;
      } else {
        ans += (nC.C(a, p) * nC.C((int) b, p)) % p;
      }
    }
    System.out.println(ans % p);
  }

  static class combination {
    public int n;
    public long nfact;
    public long reverceTable[];

    public combination(int n, long p) {
      this.n = n;
      reverceTable = new long[n + 1];
      reverceTable[0] = 1;
      nfact = 1;
      for (int i = 1; i < n + 1; i++) {
        nfact = nfact * i % p;
      }
      long sum = 1;
      long x = nfact;
      long m = p - 2;
      while (m > 0) {
        if ((m & 1) == 1) {
          sum = sum * x % p;
        }
        x = x * x % p;
        m >>= 1;
      }
      reverceTable[n] = sum;
      for (int i = n - 1; i > 0; i--) {
        reverceTable[i] = reverceTable[i + 1] * (i + 1) % p;
      }
    }

    public long C(int r, long p) {
      if (r < 0 || r > n) {
        return 0;
      } else {
        return (nfact * reverceTable[r] % p) * reverceTable[n - r] % p;
      }
    }
  }
}


Measured memory_bytes: 25940
# include <bits/stdc++.h>
# define ll long long
# define all(x) x.begin(), x.end()
# define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
# define MOD 1000000007
														
using namespace std;

vector <ll> factmod;
vector <ll> inversemod;
ll powmod(int x,int y){
	ll re=1;
	ll curr=x;
	while(y){
		if (y&1){
			re=(re*curr)%MOD;
		}
		curr=(curr*curr)%MOD;
		y>>=1;
	}
	return re;
}

ll combi (int x,int y){
	return factmod[y]*inversemod[x]%MOD*inversemod[y-x]%MOD;
}

int main(){
	fastio;
	int h,w,a,b;
	cin>>h>>w>>a>>b;
	h--;w--;a--;b--;
	factmod.assign(h+w,1);
	inversemod.assign (h+w,1);
	for (int i=1;i<h+w;i++){
		factmod[i]=factmod[i-1]*i%MOD;
		inversemod[i]=powmod(factmod[i],MOD-2);
	}
	ll ans=0;
	if (b<w){
		for (int h1=0;h1<h-a;h1++){
			ll tmp=combi(h1-0,h1+b-(0+0))%MOD;
			ans=(ans+tmp*combi(h-h1,(h+w)-(b+1+h1)))%MOD;
		}
	}
	cout<<ans<<'\n';
	return 0;
}
	


Measured memory_bytes: 6316
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main() {
	int n;
	while (cin >> n) {
		if (n == 0) break;
		rep(i, 0, n) {
			int x1, y1, z1, w1, x2, y2, z2, w2;
			cin >> x1 >> y1 >> z1 >> w1 >> x2 >> y2 >> z2 >> w2;
			int x, y, z, w;
			x = x1*x2 - y1*y2 - z1*z2 - w1*w2;
			y = x1*y2 + y1*x2 + z1*w2 - w1*z2;
			z = x1*z2 - y1*w2 + z1*x2 + w1*y2;
			w = x1*w2 + y1*z2 - z1*y2 + w1*x2;
			cout << x << " " << y << " " << z << " " << w << endl;
		}
	}
}

Measured memory_bytes: 1156
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
#pragma warning(disable : 4996)
using namespace std;
int A, B, C;
int main() {
	cin >> A >> B >> C;
	cout << (A <= C && C <= B ? "Yes" : "No") << endl;
	return 0;
}

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

int main()
{
    int n, q;
    string s;
    cin >> n >> q >> s;
    vector<int> cnt(n, 0);
    for (int i = 1; i < n; i++)
    {
        cnt[i] += cnt[i - 1] + (s[i - 1] == 'A' && s[i] == 'C');
    }
    while (q)
    {
        int l, r;
        cin >> l >> r;
        cout << cnt[r - 1] - cnt[l - 1] << "\n";
        q--;
    }
    return 0;
}


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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  
  string s;
  cin >> s;
  
  int cnt = 0;
  if(s[0] == '0') {
    for(int i = 1; i < (int)s.size(); ++i) {
      if(i % 2 == 0 && s[i] == '1') ++cnt;
      if(i % 2 != 0 && s[i] == '0') ++cnt;
    }
  }
  if(s[0] == '1') {
    for(int i = 1; i < (int)s.size(); ++i) {
      if(i % 2 == 0 && s[i] == '0') ++cnt;
      if(i % 2 != 0 && s[i] == '1') ++cnt;
    }
  }
  
  cout << cnt << endl;
  return 0;
}
  

Measured memory_bytes: 3648
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  lint S[8][N];
  REP(i,N){
    lint x,y,z;
    cin>>x>>y>>z;
    S[0][i]=x+y+z;
    S[1][i]=x+y-z;
    S[2][i]=x-y+z;
    S[3][i]=x-y-z;
    S[4][i]=-x+y+z;
    S[5][i]=-x+y-z;
    S[6][i]=-x-y+z;
    S[7][i]=-x-y-z;
  }
  REP(i,8)sort(S[i],S[i]+N,greater<lint>());
  // REP(i,8){
  //   REP(j,N)cerr<<S[i][j]<<endl;
  //   cerr<<endl;
  // }
  lint ans=0;
  REP(i,8){
    lint temp=0;
    REP(j,M)temp+=S[i][j];
    ans=max(ans,temp);
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
   int N;
   cin >> N;
   int a=0;
   bool b=false;
   for (int i=0; i<N; i++) {
      int x,y;
      cin >> x >> y;
      if (x==y) a++;
      else a=0;
      if (a==3) b=true;
   }
   if (b) cout << "Yes" << endl;
   else cout << "No" << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;

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

	ll n, k; cin >> n >> k;
	vector<ll> V(n);
	for (int i = 0; i < n; i++) cin >> V[i];
	int bs = 42;
	vector<ll> bc(bs);
	for (int i = 0; i < n; i++) {
		for (int b = 0; b < bs; b++) {
			bc[b] += (V[i] >> b) & 1;
		}
	}

	ll lmt = 0;
	ll fre = 0;
	for (int b = 0; b < bs; b++) {
		if ((k >> b) & 1) lmt = max((bc[b] << b) + fre, ((n - bc[b]) << b) + lmt);
		else  lmt += bc[b] << b;
		fre += max(bc[b], n - bc[b]) << b;
	}
	cout << lmt << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  bool taka=true;
  while(a>0 && c>0){
    if(taka){
      c-=b; taka=false;
    }
    else{
      a-=d; taka=true;
    }
    if(a<=0){
      cout << "No" << endl;
      break;
    }
    else if(c<=0){
      cout << "Yes" << endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

signed main() {
  ll r, D, x2000;
  cin >> r >> D >> x2000;
  ll before = x2000;
  rep(i, 10) {
    before = r * before - D;
    COUT(before);
  }
  return 0;
}

Measured memory_bytes: 256
/*
@author: @sancodemonster
*/
 
#include <bits/stdc++.h>
 
#define flash ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define ll long long int
#define ld long double
#define pb push_back 
#define mp make_pair
#define MOD 1000000007
#define f(i,a,b)  for(long long i=a;i<b;i++)
#define all(c) (c).begin(),(c).end() 
using namespace std;
ll W;
ll knapsack[105][2];
ll dp[105][100005] = {0};
 
ll rec(ll i,ll w,ll n)
{

	if(i > n)
	{
		return 0;
	}

	if(dp[i][w]!=0)
		return dp[i][w];

	ll a = INT_MIN;
	ll b = INT_MIN;
        
        if(w + knapsack[i][0]<=W)
	a = rec(i+1,w+knapsack[i][0],n) + knapsack[i][1];
	b = rec(i+1,w,n);

	dp[i][w] = max(a,b);
	return dp[i][w];


}
int main()
{
 /* #ifndef ONLINE_JUDGE
    freopen("C:\\desktopp\\new coding problems\\in.txt" , "r" , stdin);
    freopen("C:\\desktopp\\new coding problems\\out.txt" , "w" , stdout);
  #endif
*/
     flash;
     /////////////////////////////////////////////////////////////////////////////////////////////////////
      ll n;
      cin>>n>>W;

      ll i,j;
      f(i,1,n+1)
      {
      	f(j,0,2)
      	 cin>>knapsack[i][j];
      }

      ll ans = rec(1,0,n);
      
      cout<<ans;
     /////////////////////////////////////////////////////////////////////////////////////////////////////

     return 0;
}


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

int main(){
  int N;  cin >> N;
  int ans = 0;
  for(int i=1;i<=N;i = i+2){
    int count = 0;
    for(int j=1;j*j<=i;j++){
      if(i%j == 0){
        if(i/j == j)  count++;
        else  count += 2;
      }
    }
    if(count == 8){
      ans++;
    }
  }
  cout << ans << endl;
}

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

int main(){
  long long A,B;
  cin >> A >> B;
  long long res=0;
    
  long long n=B-A+1;
  //偶数nにおいてn xor n+1 = 1
  if(A%2!=0){
    res=A;
    n--;
  }
  if(n%2==0){
    if((n/2)%2==0){
      res=res^0;
    }else{
      res=res^1;
    }
  }else{
    n--;
    if((n/2)%2==0){
      res=res^0;
      res=res^B;
    }else{
      res=res^1;
      res=res^B;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
// const ll INF = 1000000000000000000LL;

int main() {
	string s;
	cin >> s;
	int w;
	cin >> w;
	rep(i,s.size()){
		cout << s[i];
		i+=w-1;
	}
	cout << endl;
	return 0;
}



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

int main(){
    int N;
    cin >> N;
    int digitsum = 0;
    int M;
    M = N;

    rep(i,8){
        digitsum += M % 10;
        M /= 10;
    }
    if (N % digitsum == 0){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256