akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ls x<<1
#define rs x<<1|1
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=131;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=998244353;
const int maxn=2e5+100;
int ans;
void check(ll n,ll x){
	if(x==1)return ;
	ll now=n;
	while(now%x==0)now/=x;
	if(now%x==1)ans++;
}
void solve(){
	ll n;cin>>n;
	for(ll i=1;i*i<=n-1;i++){
		if((n-1)%i==0){
			ans++;
			if(i*i!=n-1)
				ans++;
		}
	}
	for(ll i=2;i*i<=n;i++){
		if(n%i==0){
			check(n,i);
			if(i*i!=n)
				check(n,n/i);
		}
	}
	ac;
}
int main(){
    //IOS;
    //freopen("D://data.txt","r",stdin);
    solve();
    
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;                                             ;;
	;;         ;;            ;;;;;;;;;       ;;    ;;
	;;        ;; ;;        ;;                ;;    ;;
	;;       ;;   ;;       ;;                ;;    ;;
	;;      ;;;;;;;;;      ;;                ;;    ;;
	;;     ;;       ;;     ;;                      ;;
    ;;    ;;         ;;      ;;;;;;;;;       ;;    ;;
    ;;                                             ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    return 0;
}

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

typedef long long ll;

ll N;
vector<ll> A;
ll S;

int main() {
  cin >> N;
  A.resize(N);
  for (ll i = 0; i < N; ++i) {
    cin >> A[i];
    S ^= A[i];
  }
  for (ll i = 0; i < N; ++i) {
    cout << (i == 0 ? "" : " ") << (S ^ A[i]);
  }
  cout << endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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; }
const ll MOD = 1e9+7;

ll DPX[110][5];
ll DPY[110][5];

int main(){
    string S;
    cin >> S;
    ll N = S.size();
    ll K;
    cin >> K;

    DPX[0][0] = 1;
    REP(i,N){
        int s = S[i] - '0';
        REP(j,4){
            REP(k,s){
                if(k == 0){
                    DPY[i+1][j] += DPX[i][j] + DPY[i][j];
                }
                else{
                    DPY[i+1][j+1] += DPX[i][j] + DPY[i][j];
                }
            }
            //s
            if(s == 0){
                DPX[i+1][j] += DPX[i][j];
                DPY[i+1][j] += DPY[i][j];
            }
            else{
                DPX[i+1][j+1] += DPX[i][j];
                DPY[i+1][j+1] += DPY[i][j];
            }
            
            REPi(k, (s+1),10){
                DPY[i+1][j+1] += DPY[i][j];
            }
        }
    }


    ll ans = 0;
    ans += DPX[N][K]; 
    ans += DPY[N][K]; 

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


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

int main(){
  int n;
  string s;
  cin >> n;
  cin >> s;
  for(int i=0;i<s.length();i++){
    int x=s[i]-'A';
    x=(x+n)%26;
    cout << char('A'+x);
  }
  cout << endl;
  
}

Measured memory_bytes: 256
// need
#include <iostream>
#include <algorithm>
// data structure
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
//#include <deque>
#include <valarray>
#include <unordered_map>
#include <array>
// stream
//#include <istream>
#include <sstream>
//#include <ostream>
#include <fstream>
// etc
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
//#include <chrono>
#include <random>
#include <numeric>
using namespace std;
 
int main()
{
  int N, M;
  long sum = 0;
  cin >> N >> M;
  vector<int> x(M);
  vector<int> s(M-1);
  for(int i = 0; i < M; i++)
    cin >> x[i];
  
  sort(x.begin(), x.end());
  for(int i = 0; i < M-1; i++)
    s[i] = x[i+1] - x[i];
  sort(s.begin(), s.end());
  for(int i = 0; i < M-N; i++)
    sum += s[i];
  
  cout << sum << endl;
    
  return 0;
}


Measured memory_bytes: 1024
/**
 * ABC042 C
 * 
 * @date 2020.05.03
 * @author 焼き鮭 <yaki-shake@up-tri.me>
 */

#include <iostream>
#include <string>

using std::cin;
using std::cout;
using std::endl;

int target;
bool *disallow;

bool is_ok(int target)
{
  int remain_size = std::to_string(target).length();
  while (remain_size != 0)
  {
    int d = target % 10;
    if (disallow[d])
    {
      return false;
    }

    target = target / 10;
    remain_size -= 1;
  }
  return true;
}

int main(int argc, char const *argv[])
{
  int k;

  std::cin >> target;
  std::cin >> k;
  disallow = (bool *)malloc(k * sizeof(bool));

  for (int i = 0; i < k; i++)
  {
    int tmp;
    std::cin >> tmp;
    disallow[tmp] = true;
  }

  int ans = target;
  while (true)
  {
    if (is_ok(ans))
    {
      break;
    }

    ans++;
  }

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

Measured memory_bytes: 3768
#include<cstdio>
#include<algorithm>
#define fo(x,a,b) for(int x=(a),e_=(b);x<=e_;x++)
#define mo 1000000007
#define plus(a,b) (a+=b)%=mo
#define fi first
#define se second
#define ww printf

using namespace std;
const int N=100005;
pair<int,int> q[N];
int pos[N],X[N],a[N],tp[N],n,m,tot=0;

void add(int x,int d){
	for(; x<=tot; x+=(x&(-x))) plus(a[x],d);
}
int qry(int x){
	int ans=a[0];
	for(; x; x-=(x&(-x))) plus(ans,a[x]);
	return ans;
}
int main(){
	int k1,k2;
	scanf("%d %d",&n,&m);
	fo(i,1,n) scanf("%d",&X[i]);
	fo(i,1,m) scanf("%d",&pos[i]);

	fo(i,1,n) {
		if(X[i]<pos[1] || X[i]>pos[m]) continue;
		k2=upper_bound(pos+1,pos+1+m,X[i]) - pos; k1=k2-1;
		if(k1<1 || k2>m) continue;
		
		q[++tot]=make_pair(X[i]-pos[k1],pos[k2]-X[i]);
	}
	fo(i,1,tot) tp[i]=q[i].fi;
	sort(tp+1,tp+1+tot);
	tp[0]=1;fo(i,2,tot) if(tp[i]!=tp[tp[0]]) tp[++tp[0]]=tp[i];
	fo(i,1,tot) q[i].fi=lower_bound(tp+1,tp+1+tp[0],q[i].fi)-tp;

	fo(i,1,tot) tp[i]=q[i].se;
	sort(tp+1,tp+1+tot);
	tp[0]=1;fo(i,2,tot) if(tp[i]!=tp[tp[0]]) tp[++tp[0]]=tp[i];
	fo(i,1,tot) q[i].se=lower_bound(tp+1,tp+1+tp[0],q[i].se)-tp;

	fo(i,1,tot) {
//		ww("now :%d %d\n",q[i].fi,q[i].se);
		q[i].se=-q[i].se;
	}sort(q+1,q+1+tot), a[0]=1;

	fo(i,1,tot) {
		if(i>1 && q[i]==q[i-1]) continue;
//		printf("%d %d\n",q[i].fi,-q[i].se);
		add(-q[i].se,qry(-q[i].se-1));
	}
	printf("%d",qry(tot));
	return 0;
}


Measured memory_bytes: 3788
import sys
readline = sys.stdin.readline

N = int(readline())
L = sorted(list(map(int,readline().split())))

# 2本固定すると、もう一本として選べるのは、2本の和より長いものだけ
# これを二分探索で数える

import bisect
ans = 0
for i in range(N - 1):
  for j in range(i + 1,N):
    ans += bisect.bisect_left(L, L[i] + L[j]) - 1 - j
        
print(ans)

Measured memory_bytes: 9308
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

string m[350];
bool flag[350]; // 空白行なら true
int table[350][350];

int main(){
	int h, w, tmp; cin >> h >> w >> tmp;
	for( int i = 0; i < h; ++i ){
		cin >> m[i];
		flag[i] = true;
		for( int j = 0; j < w; ++j ){
			if( m[i][j] == '#' ) flag[i] = false;
		}
	}
	int offset = 0;
	for( int i = 0; i < h; ++i ){
		if( !flag[i] ){
			offset = i;
			break;
		}
	}
	int s = 0;
	for( int i = offset; i < h; ++i ){
		if( flag[i] ){
			for( int j = 0; j < w; ++j ) table[i][j] = table[i-1][j];
		} else {
			int prev = 0;
			for( int j = 0; j < w; ++j ){
				if( m[i][j] == '#' ){
					++s;
					for( int k = prev; k <= j; ++k ) table[i][k] = s;
					prev = j+1;
				}
			}
			for( int k = prev; k <= w-1; ++k ){
				table[i][k] = s;
			}
		}
	}
	if( offset != 0 ){
		for( int i = offset-1; i >= 0; --i ){
			for( int j = 0; j < w; ++j ) table[i][j] = table[i+1][j];
		}
	}
	for( int i = 0; i < h; ++i ){
		for( int j = 0; j < w; ++j ){
			cout << table[i][j] << ' ';
		} cout << endl;
	}
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std; 
#define ll long long
int main()
{
    ll t=1;
    //cin>>t;
    while(t--)
    {
      int x;
      cin>>x;
      if(x)
       cout<<0<<endl;
       else
       {
          cout<<1<<endl;
       }
       
    }
    return 0;
}

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

const int inf = 1e9;
const ll linf = 1e18;

int main()
{
    string s, str;
    while (cin >> str) s += str;
    cout << s[0] << s[4] << s[8] << endl;
    return 0;
}

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


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


Measured memory_bytes: 4048
#include <iostream>

int main() {
	int a[3];
	std::cin >> a[0];
	std::cin >> a[1];
	std::cin >> a[2];
	if ((a[0] + a[1] + a[2]) >= 22)
		std::cout << "bust";
	else
		std::cout << "win";
	return 0;
}

Measured memory_bytes: 256
function main(arg) {
	arg = arg.trim().split('\n');
  	var n = Number(arg[0]),
        a = 0,
        b = arg[1].split(' ').map(str => parseInt(str, 10));

    for (var i =0; i < n; i++) {
      if(i == 0) {
      	a = a + b[i]
      } else if (i == n-1) {
      	a = a + b[i-1]
      } else {
      	a = a + Math.min((b[i]), (b[i - 1]))
      }
    }

    console.log(a)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

//********************************template END****************************************//

int N, K, ans;
vector <int> adj[MAX/2];


int dfs(int pre = -1, int now = 0)
{
	int res = 0;

	for (int v : adj[now])
	{
		if (v != pre)
		{
			res = max(res, dfs(now, v));
		}
	}

	res++;

	if (res == K + (pre == 0) + (now == 0)*2)
	{
		ans++;
		return 0;
	}

	return res;

}

void solve(void){

	cin >> N >> K;

	rep(N, i)
	{
		int a;
		cin >> a;
		if (i)
		{
			adj[a-1].pb(i);
		}
		else
		{
			ans = a != 1;
		}
	}

	dfs();

	cout << ans << endl;

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 10368
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <map>
#include <cmath>
#include <bitset>
#include <string>
#include <queue>

using namespace std;

#define int long long
const int MOD = 1000000007;

int gcd(int x, int y) {
    if(y == 0) return x;
    return gcd(y, x % y);
}

signed main() {
    int k;
    cin >> k;

    int ans = 0;
    for(int i = 1; i <= k; i++) {
        for(int j = 1; j <=k ; j++) {
            for(int l = 1; l <= k; l++) {
                ans += gcd(i, gcd(j ,l));
            }
        }
    }

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

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

int main() {
	int x,n;
	while(cin>>x>>n){
		int arr[n];
		int p1=x;
		int p2=x+1;
		int k=0;
		for(int i=0;i<n;i++){
			cin>>arr[i];
			k++;
			if(p1==arr[i] or p2==arr[i]){
				if(p1==arr[i]){
					while(true){
						bool stat1=0;
						for(int i=0;i<k;i++){
							if(p1==arr[i]){
								stat1=1;
								p1--;
							}
						}
						if(stat1==0){
							break;
						}
					}
				}
				if(p2==arr[i]){
					while(true){
						bool stat2=0;
						for(int i=0;i<k;i++){
							if(p2==arr[i]){
								stat2=1;
								p2++;
							}
						}
						if(stat2==0){
							break;
						}
					}
				}
			}
		}
		if(x-p1==p2-x){
			cout<<p1<<'\n';
		}else if(x-p1<p2-x){
			cout<<p1<<'\n';
		}else if(x-p1>p2-x){
			cout<<p2<<'\n';
		}
	}
}

Measured memory_bytes: 3628
//temprates
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

using ll = long long;
using namespace std;

#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define LFOR(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define FORR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LFORR(i,a,b) for(ll i = (int)(a); i >= (ll)(b); i--)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define LREP(i,n) LFOR(i,0,(ll)(n)-1)
#define REPR(i,n) FORR(i,(int)(n)-1,0)
#define LREPR(i,n) LFORR(i,(ll)(n)-1,0)

#define SIZ(v) int(v.size())
const int INF = 1e8;
const ll LINF = 1e15;
const int MOD = 1e9+7;




int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  vector<int> d;
  int ans=0;
  cin >> n;
  REP(i,n){int k; cin >> k; d.push_back(k);}
  sort(d.begin(),d.end());
  ans = d[n/2]-d[(n/2)-1];
  cout << ans << endl;
}


Measured memory_bytes: 892
import sys
from collections import Counter, deque, defaultdict
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, k = MAP()
a = LIST()
f = LIST()
a = sorted(a, reverse = True)
f = sorted(f)

def ok(x):
    res = 0
    for i in range(n):
        res += max(a[i] - x//f[i], 0)
    return res <= k

l = -1
r = INF
while l+1 < r:
    mid = (l+r)//2
    if ok(mid):
        r = mid
    else:
        l = mid
print(r)

Measured memory_bytes: 123900
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
static const int giga = pow(10,9);

int main(void){
  vector<int> a;
  for(int i = 0; i < 3; i++){
    int temp;
    cin >> temp;
    a.push_back(temp);
  }
  sort(a.begin(),a.end());
  cout << a[0] + a[1] << endl;
  

  return 0;
}

Measured memory_bytes: 256
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#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 cni cin

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

int n;

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

main(){
	cin>>n;
	int a[n];
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	int ans=a[0];
	for(int i=1;i<n;i++){
		ans*=gcd(a[i],i);
		ans%=998244353;
	}
	dans;
}


Measured memory_bytes: 1024
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input!{
	n:usize,
	x:usize,
	t:usize,
    }
    if n % x == 0 {
	println!("{}",(n/x)*t);
    } else {
	println!("{}",(n/x + 1)*t);
    }
}


Measured memory_bytes: 2164
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

n,w,x=gi
a=gi
l=a.find_all{|ta| ta < x}.size
r=a.find_all{|ta| ta > x}.size
puts min l,r
1

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

using ll = long long;

int main() {
    ll N;
    cin >> N;
    for (int h = 1; h < 3501; h++) {
        for (int n = h; n < 3501; n++) {
            ll x = N * h * n;
            ll y = 4 * h * n - N * h - N * n;
            //cout << h << " " << n << " " << x << " " << y << endl;
            if (y <= 0) continue;
            if (x % y == 0) {
                cout << h << " " << n << " " << x / y << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
import sys


def delta_s(p1,p2,p3):
    a = ( (p2[0]-p1[0])**2 + (p2[1]-p1[1])**2 )**0.5
    b = ( (p3[0]-p2[0])**2 + (p3[1]-p2[1])**2 )**0.5
    c = ( (p1[0]-p3[0])**2 + (p1[1]-p3[1])**2 )**0.5
    z = ( a+b+c )/2
    return (z*(z-a)*(z-b)*(z-c))**0.5
d = []

for s in sys.stdin:
    ds = map(float,s.split(","))
    d.append(ds)

d0 = d[0]
s = 0
for i in xrange(2,len(d)):
    s += delta_s(d[i],d[i-1],d0)
print s

Measured memory_bytes: 4336
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    int n;
    cin>>n;
    vector<int> as(n);
    rep(i, n) cin>>as[i];
    int m;
    cin>>m;
    rep(i, m) {
        int b;
        cin>>b;
        if (b == *lower_bound(as.begin(), as.end(), b)) continue;
        cout<<0<<endl;
        return 0;
    }
    cout<<1<<endl;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=1<<17;

int main(){
    int N;
    cin >> N;
    LL t[N],a[N];
    for(int i=0;i<N;i++){
        cin >> t[i];
    }
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    LL state[N],maxi=0;
    for(int i=0;i<N;i++){
        if(t[i]>maxi) state[i]=1;
        else state[i]=t[i];
        maxi=t[i];
    }
    maxi=0;
    for(int i=N-1;i>=0;i--){
        if(state[i]==1){
            if(t[i]>a[i]) state[i]=0;
        }
        else if(a[i]>maxi){
            state[i]=1;
            if(a[i]>t[i]) state[i]=0;
        }
        else state[i]=min(state[i],a[i]);
        maxi=a[i];
    }
    LL ans=1;
    for(int i=0;i<N;i++){
        ans*=state[i];
        ans%=mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;

int main() {
    int L, R; cin >> L >> R;
    int d; cin >> d;
    int ans = 0;
    for (int i = L; i <= R; i++) {
        if (i % d == 0) ans++;
    }

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

Measured memory_bytes: 3588
/*************************************************\
           In the name of almighty ALLAH
                 MD.Faysal Hasan
                Comilla Univesity
\*************************************************/

#include<bits/stdc++.h>
using namespace std;

#define     ikarus_101  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef     long long             ll;
typedef     long double           ld;
typedef     unsigned long long    ull;
typedef     vector<ll>            vll;
typedef     pair<ll,ll>           pll;
typedef     vector<pll>           vpl;
typedef     map<ll,ll>            mll;
typedef     multiset<ll>          msl;
typedef     multimap<ll,ll>       Mll;
using pqboro=priority_queue<ll,vll,less<ll>>;
using pqchoto=priority_queue<ll,vll,greater<ll>>;

#define    all(str)       str.begin(),str.end()
#define    sajo(str)      sort(str.begin(),str.end())
#define    rev(str)       reverse(str.begin(),str.end())
#define    usajo(str)     sort(str.rbegin(),str.rend())
#define    vin(a)         for(auto &it : a) cin>>it
#define    vout(a)        for(auto it:a) cout<<it<<' ';cout<<nn
#define    pb             push_back
#define    eb             emplace_back
#define    mkp(x,y)       make_pair(x,y)
#define    F              first
#define    S              second
#define    yes            cout<<"YES"<<nn
#define    no             cout<<"NO"<<nn
#define    nn             "\n" ///endl
#define    rep(i,n)       for (i=0;i<n;++i )
#define    rep1(i,n)      for (i=1;i<=n;++i )

#define    min3(a,b,c)    min(a,min(b,c))
#define    max3(a,b,c)    max(a,max(b,c))
#define    sqr(x)         ((x)*(x))
#define    pi             2*acos(0.0)
#define    gcd(a,b)       __gcd(a,b)
#define    lcm(a,b)       (a/gcd(a,b))*b
#define    mem(a,b)       memset(a,b,sizeof (a))
#define    dec(x)         cout<<fixed<<setprecision(x)
#define    none(n)         __builtin_popcountll(n)

template < typename T > string toString ( T Number ) { stringstream ss ; ss << Number ; return ss.str() ; }
template < typename T > ll toll ( T str ) { stringstream ss ; ss << str ; ll num ; ss >> num ; return num ; }
ll power(ll n , ll k) { if(k == 0) return 1 ; if(k&1) return n*sqr(power(n,k/2)) ; else return sqr(power(n,k/2)); }

const   int  N   =   2e6+7;
const   int  M   =   1e9+7;
const   ll  inf  =   0x7f7f7f7f7f7f7f7f;
const   int dx[] =   {+1,+2,+2,+1,-1,-2,-2,-1};
const   int dy[] =   {-2,-1,+1,+2,+2,+1,-1,-2};

int main() {//ikarus_101

    ll n,m,i,j,k,x;


    cin>>n;
    i=1799;
    int ct = 1;
    while( true )
    {
        if(n > i) {
            cout << ct << nn;
            return 0;
        }
        ++ct;
        i-=200;
    }












    return 0;
}


Measured memory_bytes: 3616
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int K = sc.nextInt();
      int S = sc.nextInt();
      int count=0;
      for(int x=0;x<=K && x<=S;x++){
        for(int y=0;y<=K && y<=S;y++){
	          if(S-x-y>=0 && S-x-y<=K){
                count++;
              }
        }
      }
      System.out.println(count);
    }
}

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

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

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


int main(){
  int a,b;
  cin >> a >> b;
  cout << (a<=8 && b<=8 ? "Yay!" : ":(") << endl;
}



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

int main(){
    long long N, M;
    std::cin >> N >> M;
    std::vector< std::pair< int, int > > BA(M);
    for(int i=0; i<M; i++){
        std::pair< int, int > tmp;
        std::cin >> tmp.second >> tmp.first;
        BA[i] = tmp;
    }
    
    std::sort(BA.begin(), BA.end());
    
    int brid = -1;
    int ans = 0;
    for(int i=0; i<M; i++){
        if(BA[i].second >= brid){
            brid = BA[i].first;
            ans++;
        }
    }
    
    std::cout << ans << std::endl;
    
    
    return 0;
    
}


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


fn f(n: usize) -> (usize, usize) {
    let mut n = n;
    let b = n % 10;
    let mut a = b;
    while n > 0 {
        a = n;
        n /= 10;
    }
    (a, b)
}

fn main() {
    let n = read::<usize>();

    let mut c: Vec<Vec<usize>> = vec![];
    for i in 0..10 {
        c.push(vec![]);
        for j in 0..10 {
            c[i].push(0);
            for x in 1..n+1 {
                let (a, b) = f(x);
                if a == i && b == j {
                    c[i][j] += 1;
                }
            }
        }
    }
    let mut ans = 0;
    for i in 0..10 {
        for j in 0..10 {
            ans += c[i][j] * c[j][i];
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ini(n) scanf("%d",&n)
#define inl(n) scanf("%lld",&n)
#define ini2(n,m) scanf("%d%d",&n,&m)
#define inl2(n,m) scanf("%lld%lld",&n,&m)
#define prnti(n) printf("%d",n)
#define prnti2(n, m) printf("%d %d",n,m)
#define prntl(n) printf("%lld",n)
#define prntl2(n, m) printf("%lld %lld",n,m)
#define SP() printf(" ")
#define NL() printf("\n")
int main()
{
    int n;
    cin >> n;
    double circumfrence = 0;
    circumfrence = 2 * acos(-1) * n ;
    printf("%.2f\n",circumfrence);
    return 0;
}


Measured memory_bytes: 3760
#include<iostream>
using namespace std;
int main()
{
	int a,c,d,n,m;
	int ans,yo =0;
	cin>>n>>m>>c;
	int b[m];
	for(int i = 0;i<m;i++)
		cin>>b[i];
	for(int i = 0;i<n;i++){
		ans = 0;
		for(int j = 0;j<m;j++){
			cin>>a;
			ans+=a*b[j];
		}
		if(ans>-c)
			yo++;
	}
	cout<<yo<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int sum = 0,i,N,K;

  scanf("%d",&N);
  scanf("%d",&K);

  int x[N];
  
  for(i = 0;i < N;i++){
    scanf("%d",&x[i]);
  }

  for(i = 0;i < N;i++){
    if(x[i] < (K-x[i])){
      sum+=x[i]*2;
    }else{
      sum+=(K-x[i])*2;
    }
  }

  printf("%d\n",sum);

  return 0;
}


Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N; cin>>N;
    vi v(N);
    rep(i,N) cin>>v[i];
    sort(all(v));
    cout<<v[N-1]-v[0]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 5000006;
const ll MOD = 1000000007;

string s, t;

int z[MAXN], bst, dp[MAXN];
int cnts;

inline char sat (int pos) {
    if (pos < SZ(t)) {
        return t[pos];
    } else if (pos == SZ(t)) {
        return '@';
    } else {
        return s[(pos-SZ(t)-1)%SZ(s)];
    }
}
int calc (int ss) {
    memset(z, 0, sizeof(z));
    memset(dp, 0, sizeof(dp));
    bst = 0;

    int sz = SZ(t) + 1 + ss * SZ(s);
    debug(sz);

    REP1 (i, sz-1) {
        if (i % 100000 == 0) {
            debug(i);
        }
        if (bst+z[bst] > i) {
            z[i] = min(bst+z[bst]-i, z[i-bst]);
        }

        while (i+z[i] < sz && sat(z[i]) == sat(i+z[i])) {
            z[i]++;
        }
        if (i+z[i] >= bst+z[bst]) {
            bst = i;
        }
    }

    int ret = 0;
    for (int i=SZ(t)+1; i<sz; i++) {
        if (z[i] == SZ(t)) {
            dp[i] = dp[i-SZ(t)] + 1;
            ret = max(ret, dp[i]);
        }
    }

    return ret;
}
/*********************GoodLuck***********************/
int main () {
    IOS();

    cin >> s >> t;

    cnts = (SZ(t)+SZ(s)-1)/SZ(s);
    debug(cnts);

    int ans1 = calc(3*cnts);

    int ans2 = calc(4*cnts);

    if (ans2 > ans1) {
        cout << -1 << endl;
    } else {
        cout << ans1 << endl;
    }
    return 0;
}


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

#define MOD_1_000_000_007 (1000000007LL)
#define LINF (1LL<<60)
#define rep(i, n)   for (long long i = 0; i <  (long long)(n); i++)
#define rep1(i, n)  for (long long i = 1; i <  (long long)(n); i++)
#define rep2(i, n)  for (long long i = 2; i <  (long long)(n); i++)
#define rep0c(i, n) for (long long i = 0; i <= (long long)(n); i++)
#define rep1c(i, n) for (long long i = 1; i <= (long long)(n); i++)
#define rep2c(i, n) for (long long i = 2; i <= (long long)(n); i++)
#define repc0(n, i) for (long long i = (long long)(n); i >= 0; i--)
#define repc1(n, i) for (long long i = (long long)(n); i >= 1; i--)
#define repc2(n, i) for (long long i = (long long)(n); i >= 2; i--)

namespace solver {
  using namespace std;
  typedef long long ll;

  double R;

  void init() {
    cin >> R;
  }

  void solve() {
    cout << 2 * M_PI * R << endl;
  }
}

int main() {
  solver::init();
  solver::solve();
  return 0;
}

Measured memory_bytes: 3712
#include <cstdio>
 
const int N = 100500;
 
char buf[N];
 
int main() {
    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);
    scanf("%s", buf);
    int ab = a + b, sum = 0, cb = 0;
    for (int i = 0; i < n; i++) {
        if (buf[i] == 'a') {
            if (sum < ab) {
                sum++;
                puts("Yes");
            } else {
                puts("No");
            }
        } else if (buf[i] == 'b') {
            if (sum < ab && cb < b) {
                sum++;
                cb++;
                puts("Yes");
            } else {
                puts("No");
            }
        } else{
        	puts("No");
        }
    }
}

Measured memory_bytes: 640
import java.util.Scanner;

class Main {

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

		int str1 = scan.nextInt();
		int str2 = scan.nextInt();
		
		while(str1 != 0 && str2 != 0){
			for(int i = 0; i < str1; i++){
				for(int j = 0; j < str2; j++){
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
			str1 = scan.nextInt();
			str2 = scan.nextInt();

		}
		
	}
}

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

int main(void){
    string S;
    cin >> S;
    int l = S.length();
    
    int a,z;
    for(int i = 0 ; i < l ; i++){
        if(S[i] == 'A'){
            a = i;
            break;
        }
    }
    for(int i = 0 ; i < l ; i++){
        if(S[i] == 'Z') z = i;
    }
    
    cout << z-a+1 << endl;
    return 0;
}

Measured memory_bytes: 3480
#include<iostream>
#include<stdio.h>

using namespace std; 

int main (){
	long i = 0, mix = -10000000, min = 1000000, sum = 0,k;
	while ( cin >> i ){
		for ( int o = 0 ; o < i ; o++){
			cin >> k;
			sum += k;
			if ( mix <= k){
				mix = k;
			}
			if ( min >= k){
				min = k;
			}
		}
		cout << min << " " << mix << " " << sum << endl;
	}
	return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

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

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


int main(){
	ll n,m;
	cin>>n>>m;
	m/=gcd(n,m);
	auto mp=Prime_Factor(m);
	ll t=1;
	for(auto p:mp) t*=p.first;
	cout<<t<<endl;
}


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

int main() {
	
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	int h1, m1, h2, m2, k; cin >> h1 >> m1 >> h2 >> m2 >> k;
	int a = h1 * 60 + m1, b = h2 * 60 + m2;
	int ans = b - a;
	if (ans < 0) ans += 24 * 60;
	ans -= k;
	cout << ans << "\n";
	
	return 0;
}


Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		System.out.println(Math.min(a * n, b));
		
		
		
		
		
	}

}


Measured memory_bytes: 23124
import sys
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

MOD = 10**9 + 7

def main(K, N, MOD):
    def fact_table(N, MOD):
        inv = np.empty(N, np.int64)
        inv[0] = 0
        inv[1] = 1
        for n in range(2, N):
            q, r = divmod(MOD, n)
            inv[n] = inv[r] * (-q) % MOD
        fact = np.empty(N, np.int64)
        fact[0] = 1
        for n in range(1, N):
            fact[n] = n * fact[n - 1] % MOD
        fact_inv = np.empty(N, np.int64)
        fact_inv[0] = 1
        for n in range(1, N):
            fact_inv[n] = fact_inv[n - 1] * inv[n] % MOD
        return fact, fact_inv, inv

    fact, fact_inv, inv = fact_table(3_000_000, MOD)
    f = np.zeros(K + 1, np.int64)
    f = fact[N - 1:K + N] * fact_inv[N - 1] % MOD * fact_inv[0:K + 1] % MOD
    x = 1
    for i in range(1, K + 1):
        x = (x * 25) % MOD
        f[i] = f[i] * x % MOD
    for i in range(1, K + 1):
        f[i] += f[i - 1] * 26
        f[i] %= MOD
    return f[-1]

if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    i8 = numba.from_dtype(np.int64)
    signature = (i8, i8, i8)

    cc = CC('my_module')
    cc.export('main', signature)(main)
    cc.compile()

from my_module import main

K = int(readline())
N = len(read().rstrip())

print(main(K, N, MOD))

Measured memory_bytes: 163172
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var s = "";
			while ((s = Console.ReadLine()) != null)
			{
				double[] p = s.Split(' ').Take(8).Select(d => double.Parse(d)).ToArray();
				bool b = f(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
				Console.WriteLine(b ? "YES" : "NO");
			}
		}

		static bool f(double xa1, double ya1, double xa2, double ya2, double xb1, double yb1, double xb2, double yb2)
		{
			return (xa1 <= xb2) && (xb1 <= xa2) && (ya1 <= yb2) && (yb1 <= ya2);
		}
	}
}

Measured memory_bytes: 6104
#include <iostream>
using namespace std;
 
int main(){
    int n,x[3],p[100] = {},ans = 0;
    cin >> n;
    for(int i = 0;i < 3;i++){
        cin >> x[i];
        for(int j = 0;j < x[i];j++){
            int t;
            cin >> t; t--;
            p[t] += 1;
        }
        if(i != 2) for(int j = 0;j < n;j++) p[j] *= 2;
    }
    for(int i = 0;i < n;i++){
        if(p[i] == 7 || p[i] == 3 || p[i] == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3092
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T, class U>using vp = vector<pair<T, U>>;
template<class T>using vv = vector<vector<T>>; template<class T, class U>using vvp = vv<pair<T, U>>;
template<class T>vv<T> vvec(const size_t n, const size_t m, const T v) { return vv<T>(n, vector<T>(m, v)); }
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; }
constexpr int INF = 1 << 28; constexpr ll LINF = 1ll << 60;
constexpr int MAX = 1e5 + 5; constexpr int MOD = 1e9 + 7; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }; constexpr int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int N, K;
vi D;

int main() {
    cin >> N >> K;
    D.resize(K);
    rep(i, K) cin >> D[i];

    vector<char> forbidden;
    rep(i, K) forbidden.push_back(D[i] + '0');

    rep(n, N, 100000) {
        string s = to_string(n);
        bool allowed = true;
        rep(i, K) if (s.find(forbidden[i]) != string::npos) allowed = false;

        if (allowed) {
            write(n);
            return 0;
        }
    }
}

Measured memory_bytes: 256
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    n,q = map(int, input().split())
    s = input().rstrip()
    t = [0]*(n+1)
    for i in range(n):
        if s[i:i+2] == "AC":
            t[i+1] = t[i] + 1
        else:
            t[i+1] = t[i]

    for i in range(q):
        l,r = map(int, input().split())
        print(t[r-1] - t[l-1])

if __name__=="__main__":
    main()


Measured memory_bytes: 74176
// Package main provides
//
// File:  c.go
// Author: ymiyamoto
//
// Created on Wed Dec  5 22:15:09 2018
//
package main

import "fmt"

var n, k int

func main() {
	fmt.Scan(&n, &k)

	if k%2 == 1 {
		m := n / k
		fmt.Println(m + m*(m-1)*3 + m*(m-1)*(m-2))
	} else {
		m := n / k
		m2 := n/(k/2) - m
		fmt.Println(m + m*(m-1)*3 + m*(m-1)*(m-2) + m2 + m2*(m2-1)*3 + m2*(m2-1)*(m2-2))
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <map>
#include <deque>
#include <vector>
#include <algorithm>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define pi(a,b) pair<int,int>(a,b)
#define pis(a,b) pair<int,string>(a,b)
#define pc(c,d) pair<int,pair<int,string>>(c,d)
#define pp(a,b,c) pair<pair<int,int>,int>(pi(a,b),c)
#define ps(a,b,c) pair<string,pair<int,int>>(a,pi(b,c))
using namespace std;

typedef long long ll;
typedef set<int>::iterator sit;
typedef vector <int> ::iterator vit;
typedef map<int,int>::iterator mit;
typedef multimap<int,int>::iterator mmit;

class Task
{
public:
    void solve(istream& in,ostream& out)
    {
        string c;
        in>>c;
        out <<c.substr(0,5)<<" "<<c.substr(6,7)<<" "<<c.substr(14,5)<<endl;
    }
};

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	Task solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in,out);
	out.flush();
    return 0;
}


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


int main(){
    int n, a, b=0,sum=0, avr, c=0;
    vector<int> count(1000000);
    for(int j=0; j<1000000; j++){
        cin >> n;
        if(n==0) break;
        vector<int> s(n);
        for(int i=0; i<n; i++){
            cin >> s[i];
            sum += s[i];
        }
        avr = sum / n;
        for(int i=0; i<n; i++){
            if(s[i] <= avr) c += 1;
        }
        count[j]=c;
        sum=0;
        c=0;
        b+=1;
    }
    for(int i=0; i<b; i++){
        cout << count[i] << endl;
    }
}


Measured memory_bytes: 6556
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
using namespace std;

//ユークリッドの互除法　a,bは最大公約数を求めたい２つの数
class Euclid_Gojyohou{
    public:
    long long int gcd(long long int a, long long int b) {
        long long int tmp;
        long long int r = 1;
        if (b > a) {
            tmp = a;
            a = b;
            b = tmp;
        }
        r = a % b;
        while (r != 0) {


            a = b;
            b = r;
            r = a % b;

        }
        return b;
    }
};


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int n,l[200000],r[200000],a[200000],res=1;

int main() {
	cout << fixed << setprecision(18);
	Euclid_Gojyohou euc;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	l[0]=a[0];
	r[n-1]=a[n-1];
	for(int i=1;i<n;i++){
		l[i]=euc.gcd(l[i-1],a[i]);
	}
	for(int i=n-2;i>=0;i--){
		r[i]=euc.gcd(r[i+1],a[i]);
	}
	res=max({res,l[n-2],r[1]});
    for(int i=0;i<n-2;i++){
        res=max(res,euc.gcd(l[i],r[i+2]));
    }
    cout<<res;
} 


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

using ll=long long;



void solve(){
    int a,b;
    cin>>a>>b;
    if(a+b==15)cout<<'+'<<endl;
    else if(a*b==15)cout<<'*'<<endl;
    else cout<<'x'<<endl;
}

signed main(){
    //while(1)
    solve();
}

Measured memory_bytes: 256
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N, M = map(int, input().split())
# PY = [list(map(int, input().split())) for _ in range(M)]
PY = []
for i in range(M):
    P, Y = map(int, input().split())
    PY.append((i, P, Y))

PYs = sorted(PY, key=lambda x:(x[1], x[2]))
# print(PYs)

d = defaultdict(int)
ress = []
for py in PYs:
    i, p, y = py
    ress.append((i, p, d[p]+1))
    d[p] += 1

ress.sort(key=lambda x: x[0])
for res in ress:
    i, p, o = res
    print(str(p).zfill(6)+str(o).zfill(6))


Measured memory_bytes: 43012