akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  int m = 1;
  
  for (int i = 0; i < N; i ++) {
    if (m < K) m *= 2;
    else m += K;
  }
  
  cout << m <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second
#define MP make_pair
#define PB push_back

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;


int main()
{
  int n ;
  cin >> n ;
  vector<int> ue(n) ;
  vector<int> sita(n) ;
  int ans = 0 ;
  int tmp = 0 ;
  
  REP(i,n){
    cin >> ue.at(i) ;
  }
  REP(i,n){
    cin >> sita.at(i) ;
  }
  REP(i,n){
    REP(j,i+1){
      tmp += ue.at(j) ;
    }
    FOR(j,i,n){
      tmp += sita.at(j) ;
    }
    ans = max(ans,tmp) ;
    tmp = 0 ;
  }
  
  cout << ans <<endl ;


  return 0 ;
}

Measured memory_bytes: 256
io = STDIN
n=io.gets.chomp.to_i
t=io.gets.chomp.split.map(&:to_i)
m=io.gets.chomp.to_i
m.times do
  p,x=io.gets.chomp.split.map(&:to_i)
  tt=t.clone
  tt[p-1]=x
  p tt.inject(:+)
end

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

using namespace std;

int main(){
  int n;
  cin>>n;
  vector<int> a(n+1);
  for(int i=0;i<n;i++) cin>>a[i];
  sort(a.begin(),a.end()-1);
  vector<int> used(1000011);
  int ans=0;
  for(int i=0;i<n;i++){
    if(used[a[i]]==0) {
      if(a[i]!=a[i+1]) ans++;
  	  for(int j=1;j*a[i]<1000010;j++) used[j*a[i]]=1;
    }
  }
  cout<<ans;
}


Measured memory_bytes: 7992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)x.size()
#define int ll

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	vector<int> cnt(4);
	for (auto it : s) {
		if (it == 'S') {
			cnt[0]++;
		}
		if (it == 'N') {
			cnt[1]++;
		}
		if (it == 'E') {
			cnt[2]++;
		}
		if (it == 'W') {
			cnt[3]++;
		}
	}
	if (max(cnt[0], cnt[1]) > 0 && min(cnt[0], cnt[1]) == 0) {
		cout << "No\n";
		exit(0);
	}
	if (max(cnt[2], cnt[3]) > 0 && min(cnt[2], cnt[3]) == 0) {
		cout << "No\n";
		exit(0);
	}
	cout << "Yes\n";
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define F first
#define S second
#define pb push_back
#define bit __builtin_popcount
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define mkp make_pair
#define ffs fflush(stdout)

using namespace std;
using namespace __gnu_pbds;

//order_of_key(k) : Number of items strictly smaller than k
//find_by_order(k) : K-th element in a set (counting from 0)

template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef vector <int> lnum;
typedef pair <int, int> pii;

const int N = (int)1e6 + 5;
const int MOD = (int)1e9 + 7;
const int inf = (int)1e18;
const int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
const ld eps = 1e9 - 7;
const int pp[] = {29, 31, 53, 67, 71};
const double pi = acos(-1.0);

mt19937 gen(chrono::system_clock::now().time_since_epoch().count());

signed main() {
  ios_base :: sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  int x = 0;
  if (c > b) {
    x = (b + 1) + b;
    c -= (b + 1);
    x += min(a, c);
  }
  else {
    x = (c * 2) + (b - c);
    c = 0;
  }
  cout << x;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (C - A < 0) {
		cout << "NO" << endl;
		return 0;
	}
	else if (C - A > B) {
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	int A,B,K;
	cin>>A>>B>>K;
	if(B-A<2*K)for(int i=A;i<=B;i++) cout<<i<<endl;
	else{
		for(int i=A;i<=A+K-1;i++)cout<<i<<endl;
		for(int i=B-K+1;i<=B;i++)cout<<i<<endl;
	}
}

Measured memory_bytes: 256
// AtCoder Beginner Contest 147.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include<vector>
#include<cstring>
#include<string>
using namespace std;
#define foradd(i,a,b) for(int i = (a);i<(b);++i)
using ull = unsigned long long;
const int N = 10000;
int arr[N];

int main()
{
	int a, b ,c;
	cin >> a >> b >> c;
	if (a + b + c >= 22)
		cout << "bust";
	else
		cout << "win";


	return 0;
}





Measured memory_bytes: 256
from copy import deepcopy
H, W, K = map(int, input().split())
c = [list(input()) for _ in range(H)]

A = 0
for bit in range(2 ** H):
    D = deepcopy(c)
    for i in range(H):
        if (bit & (1 << i)):
            for k in range(W):
                D[i][k] = '.'
    for bit2 in range(2 ** W):
        E = deepcopy(D)
        for j in range(W):
            if (bit2 & (1 << j)):
                for k in range(H):
                    E[k][j] = '.'
        X = 0
        for k in range(H):
            X += E[k].count('#')
        if X == K:
            A += 1

print(A)

Measured memory_bytes: 9344
#include<stdio.h>
#include<stdlib.h>
#define N 4
#define LIMIT 100
#define TRUE 1
#define FALSE 0
#define NIL -1

typedef struct{
  int map[N*N];
  int space,MD;
}PUZZLE;

int dx[4]={0,-1,0,1};
int dy[4]={1,0,-1,0};
int limit,path[LIMIT];
int MDT[N*N][N*N];
PUZZLE status,in;

int getHeur(PUZZLE);//マンハッタン距離の総和を計算し、その値をヒューリスティック値とする。
int dfs(int,int);//深さ優先探索
void getAns(PUZZLE);//IDA


int main(){
  int i,j,memory;
  PUZZLE p;
  //  for(i=0;i<LIMIT;i++)path[i]=NIL;
   
  
  for(i=0;i<N*N;i++){
    for(j=0;j<N*N;j++){
      MDT[i][j]=abs(i/N-j/N)+abs(i%N-j%N);
    }
  }

  for(i=0;i<N*N;i++){
    scanf("%d",&p.map[i]);
    if(p.map[i]==0)memory=i;
  }
  p.map[memory]=N*N;
  p.space=memory;

  getAns(p);
  // for(i=0;i<100;i++)printf("%d\n",path[i]);
  
  return 0;
}


int getHeur(PUZZLE p){
  int i;
  int h=0;//ヒューリスティック値
  for(i=0;i<N*N;i++){
    if(p.map[i]==N*N){
      continue;
    }
    h+=MDT[i][p.map[i]-1];
  }
  return h;
}

int dfs(int depth,int prev){
  int i;
  PUZZLE pTemp;
  int sx,sy,tx,ty,temp;

  
  if(status.MD==0) return TRUE;
  if(depth+status.MD>limit)return FALSE;

  sx=status.space/N;
  sy=status.space%N;

  for(i=0;i<4;i++){
    tx=sx+dx[i];
    ty=sy+dy[i];
    if(!(tx>=0&&tx<N&&ty>=0&&ty<N))continue;
    if(abs(prev-i)==2)continue;
    
    pTemp=status;
    status.MD+=MDT[sx*N+sy][status.map[tx*N+ty]-1];
    status.MD-=MDT[tx*N+ty][status.map[tx*N+ty]-1];
    temp=status.map[tx*N+ty];
    status.map[tx*N+ty]= status.map[sx*N+sy];
    status.map[sx*N+sy]=temp;
    status.space=tx*N+ty;
    if(dfs(depth+1,i)==TRUE){
      path[depth]=i;
      return TRUE;
    }
    status=pTemp;
  }
  return FALSE;
}



void getAns(PUZZLE p){
  int i,result=0;
  p.MD=getHeur(p);
  for(limit=p.MD;limit<=LIMIT;limit++){
    status=p;
    if(dfs(0,-100)==TRUE){
      for(i=0;i<limit;i++){
	//if(path[i]!=NIL)
	    result++;      
      }
      printf("%d\n",result);
      return;
    }
  }
}





Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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 s, w;
  cin >> s >> w;
  if(s<=w) cout << "unsafe" << endl;
  else cout << "safe" << endl;

  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to)

int main() {
	char s[1010];
	rep(i,1010) {
		s[i] = '\n';
	}
	string x = "apple";
	string y = "peach";
	const char *a = x.c_str();
	const char *b = y.c_str();
	gets(s);
	string ns = s;
	int len = ns.length();
	rep(i,len) {
		string t;
		rep(j,5) {
			t += s[i+j];
		}
		const char *c = t.c_str();
		if(!strcmp(a, c)) {
			rep(j,5) {
				s[i+j] = b[j];
			}
		} else if(!strcmp(b, c)) {
			rep(j,5) {
				s[i+j] = a[j];
			}
		}
	}
	puts(s);
	return 0;
}

Measured memory_bytes: 1156
function main(input) {
    var line = input.split(/\r?\n/g);
    var arr = line[0].split(" ");
    const a = arr[0], b = arr[1];
    console.log(a.repeat(parseInt(b)) < b.repeat(parseInt(a)) ?
        a.repeat(parseInt(b)) : b.repeat(parseInt(a)));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 11976
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)

//{
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();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

string s;
int ans;

main(){
	cin>>s;
	rep(i,4)if(s[i]=='2')ans++;
	dans;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <utility>
#include <string>
#include <vector>
#include <set>

using namespace std;

set<int> tyoten;
set<int> v[100000];
set<int> v2[100000];
set<int> oya[100000];

void dfs(int node, int prev){
    //auto itr=v[node].begin();
    //auto itr2=oya[node].begin();
//  for(int i=0;i<oya[node].size();i++){
//printf("now %d\n", node+1);
    for(auto itr3=oya[node].begin();itr3!=oya[node].end();itr3++){
        if(tyoten.find(*itr3) != tyoten.end()){
            if(*itr3 !=prev){
//                printf("erase %d %d\n", (*itr3)+1, node+1);
                v[*itr3].erase(node);
                oya[node].erase(*itr3);
                //itr3--;
            }
        }
        else return;
    }
    
    tyoten.insert(node);
    for(auto itr3=v2[node].begin();itr3!=v2[node].end();itr3++){
        if(v[node].find(*itr3)!=v[node].end())dfs(*itr3, node);
    }
    tyoten.erase(node);
}

int main(void){
    
    int N,M;
    scanf("%d %d",&N,&M);
    for(int i=0;i< N-1+M;i++){
        int a,b;
        scanf("%d %d",&a,&b);
        a--;b--;
        v[a].insert(b);
        v2[a].insert(b);
        oya[b].insert(a);
    }
    int ne;
    for(int i=0;i<N;i++){
        if(oya[i].empty())ne=i;
    }
    dfs(ne,-1);
    for(int i=0;i<N;i++){
        if(i==ne)printf("0\n");
        else printf("%d\n", *(oya[i].begin())+1);
//        printf("size%d:%d\n",i+1, oya[i].size());
    }
    //printf("%d\n",ne);
    return 0;
}

Measured memory_bytes: 38272
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
using namespace std;



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

int main(){
  int R,G,B,N;
  cin>>R>>G>>B>>N;
  ll ans = 0;
  for(int i=0;i<=3000;i++){
    for(int j=0;j<=3000-i * R;j++){
      int remain = N - i * R - j * G;
      if(remain >= 0 and remain % B == 0) ans++;
    }
  }
cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <regex>
#include <iomanip>
#include <climits>
#include <utility>
#include <queue>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;
const dd PI = 3.1415926435;

class UnionFind
{
public:
    UnionFind(int N) : par(N)
    {
        for (ll i = 0; i < N; i++)
        {
            par[i] = i;
        }
    }

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

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry)
            return;
        par[rx] = ry;
    }

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

private:
    vector<int> par;
};

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return b;
    }
    return gcd(b, a % b);
}

ll fact(ll n)
{
    if (n == 0)
    {
        return 1;
    }
    if (n == 1)
    {
        return 1;
    }
    return n * fact(n - 1) % MOD;
}

ll pow_fast(ll n, ll k)
{
    if (k == 0)
    {
        return 1;
    }
    if (k == 1)
    {
        return n;
    }

    if (k % 2 == 0)
    {
        ll tmp = pow_fast(n, k / 2LL);
        return tmp * tmp % MOD;
    }
    else
    {
        ll tmp = pow_fast(n, k / 2LL);
        tmp *= tmp;
        tmp %= MOD;
        return tmp * n % MOD;
    }
}

map<ll, ll> sosuu(ll n)
{
    map<ll, ll> res;
    for (ll i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            res[i] += 1;
            n /= i;
        }
    }
    if (n != 1)
    {
        res[n] += 1;
    }
    return res;
}

struct Dish
{
    ll time;
    ll taste;
};

bool isP(ll n)
{
    string s = to_string(n);
    bool is_p = true;
    for (ll i = 0; i < s.size() / 2; i++)
    {
        is_p &= s[i] == s[s.size() - 1 - i];
    }
    return is_p;
}

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

    ll cnt = 0;
    for (ll i = 0; i <= A; i++)
    {
        for (ll j = 0; j <= B; j++)
        {
            for (ll k = 0; k <= C; k++)
            {
                if (500 * i + 100 * j + 50 * k == X) {
                    cnt += 1;
                }
            }
        }
    }
    cout << cnt << endl;
    
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#include<atcoder/all>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; using namespace atcoder;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int H, W;
string S[101];
int dx[2] = { 0, 1 }, dy[2] = { 1, 0 };
int edge_numbers[101][101][2];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> H >> W;
	rep(y, 0, H) cin >> S[y];

	// rule: even -> odd
	mf_graph<int> g(H * W + 2);
	int st = H * W;
	int gl = st + 1;

	rep(y, 0, H) rep(x, 0, W) rep(d, 0, 2) edge_numbers[y][x][d] = -1;

	rep(y, 0, H) rep(x, 0, W) rep(d, 0, 2) {
		int xx = x + dx[d];
		int yy = y + dy[d];

		if (0 <= xx && xx < W && 0 <= yy && yy < H) {
			if (S[y][x] == '.' && S[yy][xx] == '.') {
				int id = y * W + x;
				int id2 = yy * W + xx;

				int num;
				if ((y + x) % 2 == 0) num = g.add_edge(id, id2, 1);
				else num = g.add_edge(id2, id, 1);
				edge_numbers[y][x][d] = num;
			}
		}
	}

	rep(y, 0, H) rep(x, 0, W) {
		if ((x + y) % 2 == 0) g.add_edge(st, x + y * W, 1);
		else g.add_edge(x + y * W, gl, 1);
	}

	int ans = g.flow(st, gl);

	rep(y, 0, H) rep(x, 0, W) rep(d, 0, 2) {
		int id = edge_numbers[y][x][d];
		if (0 <= id) {
			auto edge = g.get_edge(id);
			if (edge.flow == 1) {
				if (d == 0) {
					S[y][x] = 'v';
					S[y + 1][x] = '^';
				}
				else {
					S[y][x] = '>';
					S[y][x + 1] = '<';
				}
			}
		}
	}

	printf("%d\n", ans);
	rep(y, 0, H) printf("%s\n", S[y].c_str());
}







Measured memory_bytes: 5240
/*input

*/


// assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;

// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll          long long int
#define pb          push_back
#define pii         pair<ll ,ll >
#define vpii        vector< pii >
#define vi          vector<ll >
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll )x.size()
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repr(i,a,b) for(ll  i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define debug(x)     cout << #x << " " << x << endl;
#define debug_p(x)   cout << #x << " " << x.F << " " << x.S << endl;
#define debug_v(x)   {cout << #x << " "; for (auto ioi : x) cout << ioi << " "; cout << endl;}
#define debug_vp(x)  {cout << #x << " "; for (auto ioi : x) cout << '[' << ioi.F << " " << ioi.S << ']'; cout << endl;}
#define debug_v_v(x) {cout << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cout << ioi2 << " "; cout << '\n';} cout << "*/" << #x << endl;}

int solve()
{
	ll n;cin>>n;
	vi f(n+1,0);
	for(ll x=1;x*x<=n;x++) 
		for(ll y=1;y*y<=n;y++)
			for(ll z=1;z*z<=n;z++)
				if(x*x+y*y+z*z+x*y+y*z+x*z<=n) f[x*x+y*y+z*z+x*y+y*z+x*z]++;
	rep(i,1,n+1) cout<<f[i]<<"\n";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	//cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 3656
d, g = map(int, input().split())
dic = {}
ans = 9999999
for i in range(1, d+1):
    dic[i] = list(map(int, input().split()))

for i in range(2**d):
    total = 0
    count = 0
    select_list = list(range(1, d+1))
    for j in range(d):
        if (i >> j) & 1:
            num = dic[j+1][0]
            total += 100*(j+1)*num + dic[j+1][1]
            count += dic[j+1][0]
            select_list.remove(j+1)

    if total >= g:
        if count < ans:
            ans = count
            continue
        else:
            continue

    else:
        select = max(select_list)
        select_num = dic[select][0]
        for _ in range(select_num):
            total += 100*select
            count += 1

            if total >= g:
                if count < ans:
                    ans = count
                    break
                else:
                    break

print(ans)


Measured memory_bytes: 3064
A = int(input())
B = int(input())
C = int(input())
X = int(input())

t = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500*a + 100*b + 50*c == X:
                t = t + 1

print(t)

Measured memory_bytes: 39536
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int INF = 1e8;

int main() {
  int n, q;
  cin >> n >> q;
  while (q--) {
    int v, w;
    cin >> v >> w;
    if (n == 1) cout << min(v, w) << "\n";
    else {
      while (v != w) {
        if (v > w) v = (v + n - 2) / n;
        else w = (w + n - 2) / n;
      }
      cout << v << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3508
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

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

	if(c >= a && c <= b){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;

}


Measured memory_bytes: 256
n, t = map(int, input().split())
A = list(map(int, input().split()))
from collections import defaultdict
prof = defaultdict(int)
low = 10**9
for a in A:
  if a > low: prof[a - low] += 1
  else: low = a
kmax = max(prof.keys())
ans = prof[kmax]
print(ans)

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

int main() {
    lint n;
    cin >> n;
    lint sum = 26;
    lint tn = n - 1;
    lint keta = 1;
    while (tn - sum >= 0) {
        keta++;
        tn -= sum;
        sum *= 26;
    }
    string ans = "";
    while (tn) {
        char c = 'a' + (tn % 26);
        ans += c;
        tn /= 26;
    }
    reverse(ans.begin(), ans.end());
    ans = string(keta - ans.length(), 'a') + ans;
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](int a, int b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/
int main() {
  ll n,k;
  cin >> n >> k;
  n=n%k;
  cout << min(k-n,n) << endl; 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 998244353
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

ll add(ll x, ll y) {ll res=x+y; return(res>=MOD?res-MOD:res);}
ll mul(ll x, ll y) {ll res=x*y; return(res>=MOD?res%MOD:res);}
ll sub(ll x, ll y) {ll res=x-y; return(res<0?res+MOD:res);}
ll lcm(ll x, ll y) {ll res=(x*y)/__gcd(x,y); return res;}
ll power(ll x, ll y) {ll res=1; x%=MOD; while(y){if(y&1)res=mul(res,x); y>>=1; x=mul(x,x);} return res;}

const int MAX = 2e5 + 5;
ll fact[MAX], invf[MAX];
ll nCr(ll n, ll r){if(n<r||n<0||r<0)return 0; return mul(fact[n],mul(invf[n - r],invf[r]));}
void preprocess()
{
	fact[0] = 1;
	invf[0] = 1;
	for(ll i = 1; i < MAX; i++){
		fact[i] = mul(fact[i - 1], i);
		invf[i] = power(fact[i], MOD - 2);
	}
}
int main()
{
	boost;
	preprocess();
	ll n, m, k, i;
	cin >> n >> m >> k;
	ll ans = 0;
	foe(i, n - k, n) {
		ll res = nCr(n - 1, i - 1);
		res = mul(res, mul(m, power(m - 1, i - 1)));
		ans = add(ans, res);
	}
	cout << ans;
}


Measured memory_bytes: 6736
#include <bits/stdc++.h>
using namespace std;
#define maxn 200010
typedef long long ll;
int n;
ll a[maxn];
ll ans;
bool cmp(ll x,ll y){return x>y;}
int main(){
	//freopen("data.in","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1,cmp);
	int lst=1,cnt=1;
	for(int i=2;i<=n;i++){
		ans+=a[lst];
		cnt--; if(cnt==0) lst++,cnt=2;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 5348
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
void noofpaths(string path[],ll n,ll m)
{
    ll dp[n+1][m+1];
    memset(dp,0,sizeof(dp));
    for(ll i=0;i<=n;i++)
    {
        for(ll j=0;j<=m;j++)
        {
            if(i==0||j==0)
            {
                dp[i][j]=0;
            }
            if(i==1&&j==1)
            {
                dp[i][j]=1;
            }
            else if(path[i-1][j-1]=='#')
            {
                dp[i][j]=0;
            }
            else if(path[i-1][j-1]=='.')
            {
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
            }
        }
    }
    cout<< dp[n][m]%mod<<endl;
}
int main()
{
    ll n,m;
    cin>>n>>m;
    string s[n];
    for(ll i=0;i<n;i++)
    {
        cin>>s[i];
    }
    noofpaths(s,n,m);
    return 0;
}

Measured memory_bytes: 9088
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int sz[1009];
int main()
{
	int a,b,c,ans=0;
	cin>>a>>b>>c;
	for(int i=1;i<=a;i++) cin>>sz[i];
	for(int i=1;i<=a;i++){
		if(sz[i]<b||sz[i]>=c) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
import java.math.*;
import java.util.*;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			long h = sc.nextLong();
			int count =0;
			long sumattack = 0;
			
			for(;;) {
				count++;
				
				h = h/2;
				sumattack += Math.pow(2, (count-1));
				if(h==0) {
					System.out.println(sumattack);
					return; 
				}
				
				
			}
			
			
		}

	}

Measured memory_bytes: 23252
def IntToState(X, N):
    ret = []
    bina = bin(X)
    for i in range(2, len(bina)):
        ret.append(int(bina[i]))
    while len(ret) <= N:
        ret.insert(0,0)
    return ret

def solve():
    N, M = [int(_) for _ in raw_input().split()]
    SK = []
    for i in range(M):
        SKi = [int(_) for _ in raw_input().split()]
        SK.append(SKi)
    p = [int(_) for _ in raw_input().split()]
    ans = 0
    MAX_CASE = 1<<N
    for i in range (MAX_CASE):
        state = IntToState(i, N)
        satisfi = True
        for j in range(M):
            tmp_sum = 0
            for k in range(1, SK[j][0] + 1):
                tmp_sum += state[SK[j][k]]
            if tmp_sum % 2 != p[j]:
                satisfi = False
                break
        if satisfi:
            ans += 1
    print ans

if __name__ == '__main__':
    solve()


Measured memory_bytes: 33004
#!/usr/bin/env python3
import sys
import itertools
import collections
import functools
import math
from queue import Queue
# import numpy as np
INF = float("inf")


class Bit:
    def __init__(self, n, m):
        self.size = [n, m]
        self.tree = [[0] * (n + 1) for _ in range(m+1)]

    def sum(self, i, j):
        s = 0
        while i > 0:
            jj = j
            while jj > 0:
                s += self.tree[i][jj]
                jj -= jj & -jj
            i -= i & -i
        return s

    def add(self, i, j, x):
        while i <= self.size[0]:
            jj = j
            while jj <= self.size[1]:
                self.tree[i][jj] += x
                jj += jj & -jj
            i += i & -i


def solve(N: int, M: int, Q: int, L: "List[int]", R: "List[int]", p: "List[int]", q: "List[int]"):
    b = Bit(N, N)

    for l, r in zip(L, R):
        b.add(N-l+1, r, 1)

    for pp, qq in zip(p, q):
        print(b.sum(N-pp+1, qq))

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    L = [int()] * (M)  # type: "List[int]"
    R = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        L[i] = int(next(tokens))
        R[i] = int(next(tokens))
    p = [int()] * (Q)  # type: "List[int]"
    q = [int()] * (Q)  # type: "List[int]"
    for i in range(Q):
        p[i] = int(next(tokens))
        q[i] = int(next(tokens))
    solve(N, M, Q, L, R, p, q)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int a, b;
    cin >> a >> b;
    int n;
    cin >> n;
    bool flag = false;
    for (int i = 0, s, f; i < n; i++) {
        cin >> s >> f;
        bool flag2 = false;
        if (b <= s) flag2 = true;
        if (f <= a) flag2 = true;
        if (!flag2) flag = true;
    }
    cout << flag << endl;
}


Measured memory_bytes: 3116
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	int n,count=0,r,l;
	string s;

	cin >> n>> s;

	r =l = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(')
			r++;

		else if(s[i]==')'){
			if (r == 0)
				count++;
			else
				r--;
		}
	}

	for (int i = 0; i < 100; i++) {
		if (r != 0) {
			s.push_back(')');
			r--;
		}
		if (count != 0) {
			s = '(' + s;
			count--;
		}
	}

	cout << s << endl;

}

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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int maxn = 1e5+5;
struct query { int i,v,ans; } Q[maxn];

bool cmp1(const query& a, const query& b)
{ return a.v < b.v; }

bool cmp2(const query& a, const query& b)
{ return a.i < b.i; }

int main()
{
/* #ifdef foo_ */
/*     freopen("foo", "rt", stdin); */
/* #endif */
/*     ios::sync_with_stdio(false); */
    int a,b; 
    while (cin >> a >> b) {
        string x;
        FOR(i,0,b)
            x += a+'0';
        string y;
        FOR(i,0,a)
            y += b+'0';
        cout << min(x,y) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
"""AtCoder"""

a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())

l = [a1, b1, a2, b2, a3, b3]
sl = set(l)

if l.count(1) < 3 and l.count(2) < 3 and l.count(3) < 3 and l.count(4) < 3 and len(sl) ==4:
  print("YES")
else:
  print("NO")


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

int main(){
  int N,sum,saidai; cin >> N;
  sum=0;saidai=0;
  vector<int> vec(N);
  vector<int> wow(N);
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  reverse(vec.begin(), vec.end());
  for(int i=1;i<N;i++){
    if(vec.at(i-1)<=vec.at(i)) sum++;
    else sum=0;
    saidai=max(saidai,sum);
  }
  cout << saidai << endl;
}

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

int main() {
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> A(Q);
  for(int i = 0; i < Q; i++) {
    cin >> A.at(i);
  }
  vector<int> S(N, K), M(N, 1);
  for(int i = 0; i < Q; i++) {
    S.at(A.at(i) - 1)++;
  }
  for(int i = 0; i < N; i++) {
    if(S.at(i) - Q <= 0) {
      M.at(i) = 0;
    }
    if(M.at(i) == 1) {
      cout << "Yes" << endl;
    }
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if(ch=='A')return 1;
  else if(ch=='C')return 2;
  else if(ch=='G')return 3;
  else if(ch=='T')return 4;
  else return 0;
}

long long getKey(char str[]){
  long long sum =0,p=1,i;
  for(i=0;i<strlen(str);i++){
    sum +=p*(getChar(str[i]));
    //printf("p;%lld sum;%lld\n",p,sum);
    p*=5;
  }
  return sum;
}

int h1(int key){return key % M;}
int h2(int key){return 1+(key%(M-1));}
int find(char str[]){
  long long key,i,h;
  key =getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0)return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key,i,h;
  key =getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){

  int i,n,h;
  char str[L],com[9];
  for(i=0;i<M;i++)H[i][0]='\0';
  scanf("%d",&n);
  //printf("\n");
  for(i=0;i<n;i++){
  scanf("%s%s",com,str);

  if(com[0]=='i'){
    //printf("insert\n");
    insert(str);
  }else{
    //printf("find\n");
    if(find(str)){
      printf("yes\n");
    }else{
      printf("no\n");
    }
  }
}
return 0;

}



Measured memory_bytes: 16100
import sys
def input():
    return sys.stdin.readline()#[:-1]

def main():
    n = int(input())
    for i in range(1, 10):
        if n % i == 0:
            sho = n // i
            if 1 <= sho and sho <= 9:
                print("Yes")
                return 0
    print("No")

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
n, m = gets.split.map(&:to_i)
ary = m.times.map { |i| gets.split.map(&:to_i) + [i] }.sort
ans = []
prev_pref = nil
count = nil
ary.each do |pref, year, index|
  if pref != prev_pref
    count = 1
  end
  ans[index] = "%06d%06d" % [pref, count]
  prev_pref = pref
  count += 1
end
puts ans


Measured memory_bytes: 18156
var
    s:string;
    k:int64;
    i:longint;
begin
    readln(s);
    readln(k);
    for i:=1 to length(s) do
        if (s[i]<>'1') or (i=k) then
            begin
                writeln(s[i]);
                exit;
            end;
end.


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


void solve(long long N, long long M, std::vector<long long> A){
    long long sum = accumulate(A.begin(), A.end(), 0);
    cout << (N - sum < 0 ? -1 : N - sum) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


Measured memory_bytes: 3776
#include<iostream>
using namespace std;
int main() {
	int N; cin >> N;
	int dp[300];
	int res = 0;
	for (int i = 0; i < N + 1; i++)
		dp[i] = 1;
	for (int i = 2; i < N + 1; i++) {
		for (int j = i; j < N + 1; j += i)
			dp[j]++;
	}
	for (int i = 1; i <= N; i += 2)
		if (dp[i] == 8) res++;
	cout << res << endl;
	//system("pause");
	return 0;
}


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

int main(){
    int money,cake,donut;
    cin >> money >> cake >> donut;
    money = money-cake;
    if (money >= 0){
        while(money > 0){
            money -= donut;
        }
        if(money < 0){
            money += donut;
        }
    }
    cout << money << endl;
return 0;
}

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

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

int main()
{
  int A[3][3];
  int N;

  rep(i, 3)
  {
    rep(j, 3)
    {
      cin >> A[i][j];
    }
  }

  cin >> N;

  int b[N];
  rep(i, N)
  {
    cin >> b[i];
  }

  rep(i, 3)
  {
    rep(j, 3)
    {
      rep(k, N)
      {
        if(A[i][j] == b[k])
        {
          A[i][j] = -1;
        }
      }
    }
  }

  if(A[0][0] == -1 && A[0][1] == -1 && A[0][2] == -1)
  {
    cout << "Yes" << endl;
  }
  else if(A[1][0] == -1 && A[1][1] == -1 && A[1][2] == -1)
  {
    cout << "Yes" << endl;
  }
  else if(A[2][0] == -1 && A[2][1] == -1 && A[2][2] == -1)
  {
    cout << "Yes" << endl;
  }
  else if(A[0][0] == -1 && A[1][0] == -1 && A[2][0] == -1)
  {
    cout << "Yes" << endl;
  }
  else if(A[0][1] == -1 && A[1][1] == -1 && A[2][1] == -1)
  {
    cout << "Yes" << endl;
  }
  else if(A[0][2] == -1 && A[1][2] == -1 && A[2][2] == -1)
  {
    cout << "Yes" << endl;
  }
  else if(A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1)
  {
    cout << "Yes" << endl;
  }
  else if(A[0][2] == -1 && A[1][1] == -1 && A[2][0] == -1)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

    // test
    
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        @SuppressWarnings("unchecked")
        List<LR> list[] = new ArrayList[m + 1];
        for (int i = 1; i <= m; i++) {
            list[i] = new ArrayList<>();
        }
        for (int i = 1; i < n + 1; i++) {
            st = new StringTokenizer(in.readLine());
            int start = Integer.parseInt(st.nextToken());
            int end = Integer.parseInt(st.nextToken());
            list[end - start + 1].add(new LR(start, end));
        }
        int[] fen = new int[m + 1];
        int accum = n;
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i < m + 1; i++) {
            int ans = 0;
            for (int j = i; j < m + 1; j += i) {
                ans += accum(fen, j);
            }
            for (LR temp : list[i]) {
                add(temp.l, 1, fen);
                add(temp.r + 1, -1, fen);
            }
            sb.append(ans + accum);
            sb.append('\n');
            accum -= list[i].size();
        }
        System.out.println(sb);
    }

    static class LR {
        final int l, r;

        LR(int start, int end) {
            this.l = start;
            this.r = end;
        }
    }

    static int accum(int[] fen, int i) {
        int ans = 0;
        while (i > 0) {
            ans += fen[i];
            i -= (i & -i);
        }
        return ans;
    }

    static void add(int i, int a, int[] fen) {
        while (i < fen.length) {
            fen[i] += a;
            i += (i & -i);
        }
    }
}

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

int main(){
  int a,n[260];
  cin>>a;
  for(int i=1;i<=a;i++){
    cin>>n[i];
  }
  cout<<"node 1: key = "<<n[1]<<", left key = "<<n[2]<<", right key = "<<n[3]<<", "<<endl;
  for(int i=2;i<=a;i++){
    cout<<"node "<<i<<": key = "<<n[i]<<", parent key = "<<n[i/2]<<", ";
    if(i*2<=a)cout<<"left key = "<<n[i*2]<<", ";
    if(i*2+1<=a)cout<<"right key = "<<n[i*2+1]<<", ";
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1168
#include<iostream>
#include<deque>
#include<cmath>
#include<cstring>
#include<map>
#include<algorithm>
#include<vector>
#include<ios>
#include<sstream>
#include<locale>
using namespace std;
#define ive(cris) int long long 
#define in(out) long double
#define INF 100000007
int main(){
  int n,b=0;
  cin>>n;
  b=n/15;
  cout<<n*800-b*200<<'\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int energy;
  cin>>energy;
  while(energy!=0){
    int z_limit=1;
    int y_limit=1;
    while(z_limit*z_limit*z_limit<=energy){
      z_limit++;
    }
    z_limit--;
    while(y_limit*y_limit<=energy){
      y_limit++;
    }
    y_limit--;
    
    int sum;
    int minimum=energy;
    for(int i=z_limit;i>=0;i--){
      sum=i;
      for(int j=y_limit;j>=0;j--){
	if(i*i*i+j*j<=energy){
	  sum+=j;
	  sum+=energy-i*i*i-j*j;
	  minimum=min(minimum,sum);
	}
      }
    }
    cout<<minimum<<endl;
    cin>>energy;
  }
  return(0);
}



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

int main(void)
{
    int N,M,K;
    scanf("%d %d", &N, &M);
    int A[M];
    for(int i=0;i<M;i++) A[i] = 0;
    for(int i=0;i<N;i++){
        scanf("%d", &K);
        for(int j=0;j<K;j++){
            int a;
            scanf("%d", &a);
            A[a-1]++;
        }
    }
    sort(A, A+M);
    int count=0;
    int b=M-1;
    while(A[b] == N){
        count++;
        b--;
    }
    printf("%d\n", count);
}

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

using namespace std;

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

  int x, y;
  cin >> x >> y;
  for (int i = 0; i <= x; ++i) {
    if (4 * i + 2 * (x - i) == y) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";

  return 0;
}


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

int bubbleSort(int A[],int N) {
	int sw = 0; // 交換回数 0で初期化
	bool flag = 1;
	for(int i=0; flag; i++) {
		flag = 0;
		for(int j=N-1;j>=i+1;j--) {
			if(A[j]<A[j-1]) {
				swap(A[j],A[j-1]);
				flag = 1;
				sw++;
			}
		}
	}
	return sw;
}

int main(void) {
	int A[100], N, sw;
	cin >> N;
	for(int i=0;i<N; i++) cin >> A[i];
	
	sw = bubbleSort(A,N);
	
	for(int i=0;i<N;i++) {
		if(i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw << endl;
	return 0;
}

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

int main(int argc, char const *argv[])
{
  int H, W;
  cin >> H >> W;
  vector<string> C(H);
  for(int i = 0; i < H; i++)
    cin >> C[i];

  for(int i = 0; i < H; i++)
  {
    cout << C[i] << endl
         << C[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<bitset>
using namespace std;
int main() {
  int q,a,b;
  cin >> q;
  bitset<64> bit(0);
  for(int i=0; i<q; i++) {
      cin >> a;
      if(a<4) {
          cin >> b;
      }
      if(a==0) {
          cout << bit.test(b) << endl;
      }
      if(a==1) {
          bit.set(b);
      }
      if(a==2) {
          bit.reset(b);
      }
      if(a==3) {
          bit.flip(b);
      }
      if(a==4) {
          cout << bit.all() << endl;
      }
      if(a==5) {
          cout << bit.any() << endl;
      }
      if(a==6) {
          cout << bit.none() << endl;
      }
      if(a==7) {
          cout << bit.count() << endl;
      }
      if(a==8) {
          cout << bit.to_ullong() << endl;
      }
  }
}


Measured memory_bytes: 3116