akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int n, a[100000];
    cin >> n;
    for(int i=0; i<n; i++) cin >> a[i];

    int two=0, four=0;
    for(int i=0; i<n; i++){
        if(a[i] % 4 == 0) four++;
        else if(a[i] % 2 == 0) two++;
    }

    if(four + two/2 >= n/2) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A[55],B[55];
vector<ll> cand[51][51];
vector<ll> V[51];


void solve() {
	int i,j,k,l,r,x,y,z; string s;
	
	
	for(x=0;x<=50;x++) {
		cand[x][x].push_back(0);
		for(y=0;y<x;y++) {
			for(z=1;z<=x;z++) if(x%z>=y) FORR(v,cand[x%z][y]) cand[x][y].push_back(v|(1LL<<z));
			sort(ALL(cand[x][y]));
			cand[x][y].erase(unique(ALL(cand[x][y])),cand[x][y].end());
		}
	}
	
	cin>>N;
	FOR(i,N) cin>>A[i];
	FOR(i,N) {
		cin>>B[i];
		V[i]=cand[A[i]][B[i]];
		if(cand[A[i]][B[i]].empty()) return _P("-1\n");
	}
	
	ll ret=0;
	for(i=50;i>=0;i--) {
		int ng=0;
		FOR(j,N) {
			int ok=0;
			FORR(v,V[j]) if((v&(1LL<<i))==0) ok=1;
			if(ok==0) ng=1;
		}
		if(ng) {
			ret |= 1LL<<i;
		}
		else {
			FOR(j,N) {
				vector<ll> V2;
				FORR(v,V[j]) if((v&(1LL<<i))==0) V2.push_back(v);
				swap(V[j],V2);
			}
		}
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

template <typename T> inline bool chkmin(T &x,T y) { return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y) { return x < y ? x = y,1 : 0; }

const int INF = 0x3f3f3f3f;
const int N = 250000 + 10,Bs = 19260817;

int Pos[N];
ull Pw[N << 1],Val[N];
char str[N];

unordered_map <ull,int> Map;

inline int read() {
	int x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-')ch = getchar();
	if(ch == '-')flag = -1,ch = getchar();
	while(isdigit(ch))x = (x << 3) + (x << 1) + (ch - '0'),ch = getchar();
	return x * flag;
}

int main() {

	int n = read(),Lim = (n << 1) + 10;
	scanf("%s",str + 1);
	Pw[0] = 1;
	For(i,1,Lim) Pw[i] = Pw[i - 1] * Bs;
	int pos = n + 5;ull Sum = 0;
	For(i,1,n) {
		if(str[i] == '>') pos++;
		if(str[i] == '<') pos--;
		if(str[i] == '+') Sum += Pw[pos];
		if(str[i] == '-') Sum -= Pw[pos];
		Pos[i] = pos,Val[i] = Sum;
	}

	Map[Val[n] * Pw[n + 5]]++;
	ll ans = 0;
	Fordown(i,n - 1,1) {
		ull val = Val[n] * Pw[Pos[i]] + Val[i] * Pw[n + 5];
		ans += Map[val];
		Map[Val[i] * Pw[n + 5]]++;
	}

	For(i,1,n) if(Val[i] == Val[n]) ans++;

	printf("%lld\n",ans);

	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;


int main() {

    ll N; cin >> N;

    for(ll i = 0; i < N; i++){
        ll t; cin >> t;
        vec.push_back(t);
    }

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

    ll ans = 0;

    for(ll i = 0; i < N; i++){
        if(i == 0){
            ans++;
            continue;
        }

        if(vec[i] == vec[i-1]) continue;
        
        ans++;
    }

    cout << ans << endl;


}

Measured memory_bytes: 256
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Text;

namespace Fish.aizu
{
	public static class AizuOnlineJudge
	{
		public static int[] SplitToInts(string line)
		{
			return line.Split(' ').Select(x => int.Parse(x)).ToArray();
		}
		public static double[] SplitToDoubles(string line)
		{
			return line.Split(' ').Select(x => double.Parse(x)).ToArray();
		}
		public static long[] SplitToLongs(string line)
		{
			return line.Split(' ').Select(x => long.Parse(x)).ToArray();
		}
		public static int Main()
		{
			Compute(Console.In, Console.Out);
			return 0;
		}
		
		public static void Compute(TextReader reader, TextWriter writer)
		{
			var line = reader.ReadLine();
			var stringBuilder = new StringBuilder(line.Length);
			foreach (var c in line)
			{
				stringBuilder.Append(char.IsLower(c) ? char.ToUpper(c) : char.ToLower(c));
			}
			writer.WriteLine(stringBuilder.ToString());
		}
	}
}

Measured memory_bytes: 5640
#include <iostream>
#include <vector>

int main() {
    std::vector<int> tasks;
    for (int i = 0; i < 3; ++i) {
        int x;
        std::cin >> x;
        tasks.push_back(x);
    }
    std::sort(tasks.begin(), tasks.end());
    std::cout << std::abs(tasks[1] - tasks[0]) + std::abs(tasks[2] - tasks[1]) << std::endl;
    return 0;
}


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

#define ll long long
const int MOD = 1e9+7;
ll mod(ll x) {
	return (x%MOD + MOD) %MOD;
}
ll mul(ll a,ll b) {
	return mod(mod(a) * mod(b));
}

int main() {
	int n;
	cin >> n;
	int m = 1e6+1;
	vector<int> cnt(m,0);
	vector<int> v(n);
	for (int i = 0; i < n; ++i)
	{
		/* code */
		cin >> v[i];
	}
	sort(v.begin(),v.end());
	
	for(int i = 0 ; i < n; i++)
	{
		auto tmp = v[i];
		if(cnt[tmp] == 0) {
			for(int j = tmp;j < m ; j += tmp)
				cnt[j]++;
		}
		else
			cnt[tmp] = 2;
	}

	int result = 0;
	for(auto i : v)
		if(cnt[i] == 1)
			result++;
	cout << result << endl;
}

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

static const int N = 100;
static const int INFTY = (1<<21);

int n, M[N][N];
int d[N];

void bfs(int s) {
  queue<int> q;
  q.push(s);
  for (int i = 0; i < n; i++) d[i] = INFTY;
  d[s] = 0;
  int u;
  while ( !q.empty() ) {
    u = q.front();
    q.pop();
    for (int v = 0; v < n; v++) {
      if (M[u][v] == 0) continue;
      if ( d[v] != INFTY) continue;
      d[v] = d[u] + 1;
      q.push(v);
    }
  }

  for (int i = 0; i < n; i++) {
    cout << i+1 << " " << ( (d[i] == INFTY) ? (-1) : d[i] ) << endl;
  }
}

int main() {
  int u, k, v;

  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) M[i][j] = 0;
  }

  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    u--;
    for (int j = 0; j < k; j++) {
      cin >> v;
      v--;
      M[u][v] = 1;
    }
  }

  bfs(0);

  return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
  int X, A;
  cin >> X >> A;
  cout << 10 * (X >= A) << endl;
    return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
int main(){
	int h1 , m1, h2, m2 , k;
	cin>>h1>>m1>>h2>>m2>>k;
	if(h2 == 0){
       h2 = 12;
	}
	int l = h1*60 + m1;
    int y = h2*60 + m2;
    cout<<y-l-k<<endl;
}

Measured memory_bytes: 3616
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

template<typename T>
inline T up(const T& l, const T& r) {//SegmentTreeのupdate関数
    T res;
    res = min<T>(l,r);
    return res;
}

template<typename T>
class SegmentTree {
public:
    vector<T> seg;
    int sz = 1;
    T unit;
    //T (*up)(const T& l,const T& r);
    SegmentTree(int n, T unit = 0) {
        this->unit = unit;
        //int sz = 1;
        while (sz < n) sz <<= 1;
        seg.resize(sz * 2, unit);
        //up = &up1;
    }
    void set(const int& k, const T& x) {//左からk番目の葉にxを代入する
        seg[sz - 1 + k] = x;
    }
    T get(const int& k) {//左からk番目の葉を得る
        return seg[sz - 1 + k];
    }
    void update(int k, const T& v) {// k 番目の値をvに変更
        k += sz - 1;
        seg[k] = v;
        while (k > 0) {
            k = (k - 1) / 2;
            seg[k] = up(seg[2 * k + 1], seg[2 * k + 2]);
        }
    }
    T query(int a, int b, int k, int l,int r) {//[a,b)のupの合成を求める(a,b,0,0,sz)のように使う
        if (r <= a || b <= l) {
            return unit;
        }
        if (a <= l && r <= b) {
            return seg[k];
        }
        else {
            T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return up(vl, vr);
        }
    }
};

int main(){
    int n;
    ll x;
    cin >> n >> x;
    vector<ll> a(n*2);
    REP(i,n){
        cin >> a[i];
        a[i+n] = a[i];
    }
    SegmentTree<ll> sg(n*2,LLONG_MAX);
    Rep(i,n){
        sg.update(i,a[i]);
        sg.update(i+n,a[i+n]);
    }
    ll res = LLONG_MAX;
    Rep(k,n){
        ll cost = k*x;
        int sz = sg.sz;
        Rep(j,n){
            if(j-k<0){
                cost+=sg.query(j-k+n,j+1+n,0,0,sz);
            }else{
                cost+=sg.query(j-k,j+1,0,0,sz);
            }
        }
        chmin(res,cost);
    }
    put(res);
    return 0;
}



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

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

void solve()
{
   int A,B;
   cin >> A >> B;
   if (A <= 5)
       cout << 0 << endl;
   else if (A >= 6 && A <= 12)
       cout << B / 2 << endl;
   else
       cout << B << endl;
}

int main()
{
    solve();
    return (0);
}





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

using i64 = int64_t;

template <class BidirectionalIterator>
  inline constexpr bool next_partial_permutation(BidirectionalIterator first,
                                BidirectionalIterator middle,
                                BidirectionalIterator last)
{
  using std::reverse;
  reverse(middle, last);
  return std::next_permutation(first, last);
}

int main(){
    int n, k;
    while(cin >> n >> k, n != 0 || k != 0){
        vector<string> v;
        for(int i=0;i<n;++i){
            string num;
            cin >> num;
            v.push_back(num);
        }
        sort(v.begin(), v.end());
        set<string> st;
        do{
            string s;
            for(int i=0;i<k;++i){
                s += v[i];
            }
            st.insert(s);
        }while(next_partial_permutation(v.begin(), v.begin()+k, v.end()));
        cout << st.size() << endl;
    }

    return 0;
}



Measured memory_bytes: 3428
#include<bits/stdc++.h>
using namespace std;
int main(){



    int n, m;
    string a, b, c;
    cin>>a>>b>>n>>m>>c;

    if(a==c)
        n--;
    else if(b==c)
        m--;

    cout<<n<<" "<<m;


return 0;


}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for(ll i = 0; i < n; i++)
using namespace std;
int dy[4] = { 1, 0, -1, 0 }, dx[4] = { 0, 1, 0, -1 };
const ll MOD = 1e9 + 7;
const ll INF = 1e9;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, k;
  cin >> n >> k;
  vector<char> d(k);
  rep(i, k){
    cin >> d[i];
  }
  while(true) {
    string tmp = to_string(n);
    
    bool hasD = false;
    rep(i, k) {
      if (count(tmp.begin(), tmp.end(), d[i])) {
        hasD = true;
        n++;
        break;
      }
    }
    
    if (!hasD) {
      cout << n << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = 1e9 + 7;
const int MX = (int)2e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

void pre(){
}	

void solve(){
	ll x, k, d;
	cin >> x >> k >> d;
	ll dist = abs(x);

	ll res = 9e18;

	if(k == 1)
		res = abs(dist - d);
	else{
		if(k % 2 == 0)
			res = min(res, dist); // maybe this is okay?
		ll steps_to_origin = min(k, dist / d);
		ll rem = k - steps_to_origin;
		if(rem & 1)
			res = min(res, abs(dist - (steps_to_origin + 1) * d)); // try taking one more step, now u should cross the origin to the other side
		else
			res = min(res, abs(dist - steps_to_origin * d));
	}
	
	cout << res << "\n";
}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	// freopen("input.in", "r", stdin);
	// freopen("output.out", "w", stdout);

	int t;
	t = 1;
	// cin >> t;
	// pre();
	for(int i = 1; i <= t; ++i){
		// cout << "Case #" << i << ": \n";
		solve();
	}

	return 0;
}


Measured memory_bytes: 3504
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC return 0;
using namespace std;
int n, m;
long long x, a[15][15], curr[15], cost, cmin(1e18);
int main() {
    DAU
    cin >> n >> m >> x;
    for (int i = 1; i <= n; ++i)
        for (int j = 0; j <= m; ++j)
            cin >> a[i][j];
    for (int mask = 0; mask < (1 << n); ++mask) {
        memset(curr, 0, sizeof(curr));
        cost = 0;
        for (int i = 1; i <= n; ++i)
            if (mask & (1 << (i - 1))) {
                for (int j = 1; j <= m; ++j)
                    curr[j] += a[i][j];
                cost += a[i][0];
            }
        bool ok(true);
        for (int j = 1; j <= m; ++j)
            if (curr[j] < x)
                ok = false;
        if (ok)
            cmin = min(cost, cmin);
    }
    if (cmin == 1e18)
        cmin = -1;
    cout << cmin;
    PLEC
}


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

int main(void){
  int N,a[25],b[25],c[25],i,count;
  char str[1000],*p;
  
  fgets(str,sizeof(str),stdin);
  N=atoi(str);
  
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  a[1]=atoi(p);
  for(i=2;i<N+1;i++){
    p=strtok(NULL," \n");
  	a[i]=atoi(p);
  }
  
  
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  b[1]=atoi(p);
  for(i=2;i<N+1;i++){
    p=strtok(NULL," \n");
  	b[i]=atoi(p);
  }
  
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  c[1]=atoi(p);
  for(i=2;i<N;i++){
    p=strtok(NULL," \n");
  	c[i]=atoi(p);
  }
  
  
  for(i=1,count=0;i<N+1;i++){
    count+=b[a[i]];
    if(a[i]>1 && a[i]-1==a[i-1]){
      count+=c[a[i-1]];
    }
  }
    
  printf("%d\n",count);
  
 return 0; 
}

Measured memory_bytes: 128
/* おまじない　*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

int main(){
    init();
    ll A,B,K;cin>>A>>B>>K;
    for(int i=0;i<K;i++){
        if(i%2==0){
            //高橋くん
            if(A%2==1)A--;
            B+=(A/2);
            A-=(A/2);
        }
        if(i%2==1){
            //青木くん
            if(B%2==1)B--;

            A+=(B/2);
             B-=(B/2);
        }
       // cout<<A<<" "<<B<<endl;  
    }
    cout<<A<<" "<<B<<endl;  
}

Measured memory_bytes: 256
arr = $stdin.gets.chomp.split(" ")
arr.map! do |a_j|
 a_j.to_i
end

ac = arr[2] - arr[0]
ab = arr[1] - arr[0]
bc = arr[2] - arr[1]

if ac.abs <= arr[3]
  puts "Yes"
elsif
  ac.abs > arr[3] and ab.abs <= arr[3] and bc.abs <= arr[3]
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 1788
let () =
  Scanf.scanf "%d" @@ fun l ->
  let a = Array.init (l+1) @@ fun i ->
    if i = 0 then 0
    else Scanf.scanf " %d" ((+) 0)
  in

  let dp = Array.init 5 (fun _ -> Array.make (l+1) 0) in

  for i = 1 to l do
    dp.(0).(i) <- dp.(0).(i-1) + a.(i);
  done;

  for i = 1 to l do
    dp.(1).(i) <- min dp.(0).(i) @@
      dp.(1).(i-1) + if a.(i) = 0 then 2 else a.(i) mod 2;
  done;

  for i = 1 to l do
    dp.(2).(i) <- min dp.(1).(i) @@
      dp.(2).(i-1) + (a.(i) + 1) mod 2;
  done;

  for i = 1 to l do
    dp.(3).(i) <- min dp.(2).(i) @@
      dp.(3).(i-1) + if a.(i) = 0 then 2 else a.(i) mod 2;
  done;

  for i = 1 to l do
    dp.(4).(i) <- min dp.(3).(i) @@ dp.(4).(i-1) + a.(i);
  done;

  Printf.printf "%d\n" dp.(4).(l)



Measured memory_bytes: 14336
#include <cstdio>
#include <algorithm>
#include <map>

const long long int INF = 1001001001001001LL;

long long int gcd(long long int a, long long int b) {
    if(a < b) std::swap(a, b);
    if(b == 0) return a;
    return gcd(b, a%b);
}

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

long long int Carmichael(long long int n, long long int prime=0, int pow_cnt=0) {
    if(prime == 2) {
        // n = 2^x
        if(pow_cnt == 1) return 1;
        if(pow_cnt == 2) return 2;
        return 1LL << (pow_cnt - 2);
    }
    else if(prime > 0) {
        // n = p^x (p is odd-prime number)
        return n / prime * (prime - 1);
    }
    else {
        long long int ans = 1;
        std::map<long long int, int> primes;
        for(long long int i=2; i*i<=n; i++) {
            while(n % i == 0) {
                primes[i]++;
                n /= i;
            }
        }
        if(n != 1) primes[n]++;

        for(auto x : primes) {
            long long int m = 1;
            for(int i=0; i<x.second; i++) m *= x.first;
            ans = lcm(ans, Carmichael(m, x.first, x.second));
        }
        return ans;
    }
}

// ?´???°??¨??????
std::vector<long long int> OutDivisor(long long int n) {
    std::vector<long long int> ret;
    for(long long int i=1; i*i<=n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i*i!=n) ret.push_back(n / i);
        }
    }
    return ret;
}

long long int mod_pow(long long int x, long long int n, long long int MOD) {
    if(n == 0) return 1;
    long long int  res = mod_pow((x * x) % MOD, n / 2, MOD);
    if(n & 1) res = (res * x) % MOD;
    return res;
}

int main() {
    while(1) {
        long long int ans = 1;
        for(int i=0; i<3; i++) {
            long long int a, m; scanf("%lld%lld", &a, &m);
            if(a == 0) return 0;
            int C = Carmichael(m);
            std::vector<long long int> divisor = OutDivisor(C);
            
            long long int temp = INF;
            for(auto x : divisor) {
                long long int value = C / x;
                if(mod_pow(a, value, m) == 1) {
                    temp = std::min(temp, value);
                }
            }
            ans = lcm(ans, temp);
        }
        printf("%lld\n", ans);
    }
    return 0;
}

Measured memory_bytes: 2804
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cmath>

#define mst(a,b)memset(a, b, sizeof(a))
#define repi(a,b)for(int i = a; i < b; i++)
#define repj(a,b)for(int j = a; j < b; j++)
#define pii pair<int,int>

#ifdef LOCAL
#define fre()freopen("in.txt","r",stdin)
#endif
#ifndef LOCAL
#define fre()
#endif

//static int x = []() {
//	std::ios::sync_with_stdio(false);
//	std::cin.tie(NULL);
//	return 0;
//}();

#define FASTIO
#ifdef FASTIO
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
//#define scanf abcabc
//#define printf abcabc
#endif
//#ifndef FASTIO
//#define cin abcabc
//#define cout abcabc
//#endif

typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;

using namespace std;


int main() {
	string s; cin >> s;
	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])cout << "Bad\n";
	else cout << "Good\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		long x,kk,ans;
		int n;
		Scanner in =new Scanner(System.in);
		n=in.nextInt();x=in.nextLong();
		long []  a=new long[n+1000];
		long [][] dp = new long[n+500][n+500];
		for(int i=1;i<=n;i++) {
			a[i]=in.nextLong();
		}
		ans=9000000000000000000L;kk=-1;
		for(int i=1;i<=n;i++) {
			dp[i][0]=a[i];
			for(int k=1;k<n;k++) {
				int pi=i-k;
				if(pi<=0)pi=n+pi;
				if(dp[i][k-1]>=a[pi])dp[i][k]=a[pi];
				else dp[i][k]=dp[i][k-1];
//				if(bal1>a[pi] + ((long)k)*x) {
//					bal1=a[pi]+(k)*x;bal2=k;bal3=a[pi];
//				}
			}
//			if(bal2>kk)kk=bal2;
//			ans+=bal3;
			
		}
		long sum=0;
		for(int k=0;k<n;k++) {
			sum=0;
			for(int i=1;i<=n;i++) {
				sum+=dp[i][k];
			}
			if(sum+k*x<ans)ans=sum+k*x;
		}
		System.out.println(ans);
	}

}


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

using namespace std;
typedef long long ll;

#define pb push_back
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define forrn(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define PYMOD(a, m) ((((a) % (m)) + (m)) % (m))
#define all(v) v.begin(), v.end()
#define mp make_pair
#define ff first
#define ss second

const int mod = 1e9 + 7;

struct query {
    char t;
    char d;
};

enum result {
    LEFT,
    STAY,
    RIGHT
};

result where(int i, const string& s, const vector<query>& qs) {
    for (const query& q : qs) {
        if (q.t == s[i]) {
            if (q.d == 'L')
                i--;
            else
                i++;
        }
        if (i < 0)
            return LEFT;
        else if (i >= (int)s.size())
            return RIGHT;
    }
    return STAY;
}

int main() {
    // Code here:

    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;

    vector<query> qs(q);
    for (query& qu : qs)
        cin >> qu.t >> qu.d;

    int ans = n;

    int lt = -1, rt = n - 1;
    while (lt < rt - 1) {
        int mid = (lt + rt) / 2;
        if (where(mid, s, qs) == LEFT)
            lt = mid;
        else
            rt = mid;
    }
    cerr << "last LEFT: " << lt << endl;
    ans -= rt;

    rt = n;
    while (lt < rt - 1) {
        int mid = (lt + rt) / 2;
        if (where(mid, s, qs) == STAY)
            lt = mid;
        else
            rt = mid;
    }
    cerr << "first RIGHT: " << rt << endl;
    ans -= n - rt;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 900
#include <stdio.h>
#include <string.h>
#define M 1000

//char x[M],y[M];
//int a=strlen(x),b=strlen(y);

int max(int s,int u){
    if(s>u)return s;
    else return u;
}

int lcs(char x[],char y[]){
  int i,j,k,t;
    int maxl=0;
    int c[M+1][M+1];
    k=strlen(x),t=strlen(y);

    // x[0]='';
    //y[0]='';

    for(i=0;i<=k;i++){
        c[i][0]=0;
    }
    for(j=1;j<=t;j++){
        c[0][j]=0;
    }

    for(i=1;i<=k;i++){
        for(j=1;j<=t;j++){
            if(x[i-1]==y[j-1]){
                c[i][j]=c[i-1][j-1]+1;
            }else{
                c[i][j]=max(c[i-1][j],c[i][j-1]);
            }
            maxl=max(maxl,c[i][j]);
        }
    }
    return maxl;
}

int main(){
    int i,n;
    char x[M],y[M];
    int count[M];

    scanf("%d",&n);

    for(i=1;i<=n;i++){
      scanf("%s%s",x,y);
        count[i]=lcs(x,y);
    }
    for(i=0;i<n;i++){
      printf("%d\n",count[i+1]);
    }
		     
    return 0;
}




Measured memory_bytes: 5648
require 'prime'

class Integer
  def my_divisor_list
    divisors = [1]
    primes = []
    Prime.prime_division(self).each do |prime|
      prime[1].times { primes << prime[0] }
    end

    1.upto(primes.size) do |i|
      primes.combination(i) do |prime|
        divisors << prime.inject { |a, b| a *= b }
      end
    end

    divisors.uniq!
    divisors.sort!
    return divisors
  rescue ZeroDivisionError
    return
  end
end

N = gets.to_i

c = 0

105.step(N, 2) do |i|
  c += 1 if i.my_divisor_list.size >= 8
end

puts c


Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = a; i < b; ++i)
#define ll long long
#define M 100000007
#define fr first
#define sc second
#define endl "\n"
#define vc vector
#define pb push_back
#define pii pair<ll, ll>
#define psi pair<string, ll>
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define PI 3.14159265
#define r0 return 0

/* typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
*/
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
using namespace std;

int main() {
  ll a, b, k;
  cin >> a >> b;
  ll mn = min(a, b), mx = max(a, b);
    if(a==b) cout<<a;
    else if((a+b)%2==0) cout<<(a+b)/2;
    else cout<<"IMPOSSIBLE";

}

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

namespace TYC
{
	typedef long long ll;
	typedef pair<int, int> pii;
	const int N = 505;

	int n, tot, mod, F[N][N];
	pii A[N];

	int solve(const int k)
	{
		memset(F, 0, sizeof(F));
		F[0][0] = 1;
		int c1 = 0, c2 = 0;
		for (int i = 0; i < tot; i++)
			if (A[i].second == 0)
			{
				for (int j = 0; j <= c2; j++)
					F[i + 1][j] = int((ll)F[i][j] * (A[i].first + 1 - c1 - j) % mod);
				c1++;
			}
			else
			{
				for (int j = 0; j <= c2; j++)
				{
					F[i + 1][j + 1] = int((F[i + 1][j + 1] + (ll)F[i][j] * (A[i].first + 1 - c1 - j) % mod) % mod);
					F[i + 1][j] = int((F[i + 1][j] + (ll)F[i][j] * (A[i].second + 1 - n - k - (c2 - j)) % mod) % mod);
				}
				c2++;
			}
		return F[tot][k];
	}

	void work()
	{
		scanf("%d%d", &n, &mod);
		tot = n << 1;
		for (int i = 0; i < n; i++)
		{
			int l = int(ceil(sqrt((double)n * n - (double)i  * i)));
			int r = int(floor(sqrt((double)n * n * 4 - (double)i * i)));
			A[i] = {l - 1, min(tot - 1, r)};
		}
		for (int i = n; i < tot; i++)
			A[i] = {int(floor(sqrt((double)n * n * 4 - (double)i * i))), 0};

		sort(A, A + tot);
		int ans = 0;
		for (int i = 0, d = 1; i <= n; i++, d = -d)
			ans = int(((ll)ans + d * solve(i) + mod) % mod);
		printf("%d\n", ans);
	}
}

int main()
{
	TYC::work();
	return 0;
}

Measured memory_bytes: 1280
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXLEN=100000;

char s[MAXLEN+1]; int n;

bool win() {
	bool same=s[0]==s[n-1];
	if(same) return n%2==0; else return n%2==1;
}

void run() {
	scanf("%s",s); n=strlen(s);
	printf("%s\n",win()?"First":"Second");
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 512
#define ll long long
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n],b[n],c[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        cin>>b[i];
    }
    for(int i=0;i<n-1;i++)
    {
        cin>>c[i];
    }
    int total=b[a[0]-1];
    for(int i=1;i<n;i++)
    {
        if(a[i-1]+1==a[i])
        {
           total+=(b[a[i]-1]+c[a[i]-2]);
        }
        else{
            total+=b[a[i]-1];
        }
    }
     cout<<total<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#define INF 1000000007
using namespace std;

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


int main() {

	int a, b, k;
	cin >> a >> b >> k;

	if (a == b) {

	}

	if (a - 1 + 2 * k >= b) {
		for (int i = a; i <= b; i++) {
			cout << i << endl;
		}
	}
	else {
		for (int i = 0; i < k; i++) {
			cout << a + i << endl;
		}
		for (int i = 0; i < k; i++) {
			cout << b - k + i + 1 << endl;
		}
	}

	return 0;
}




Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);

        long n = scanner.nextLong();

        int mod = 1000000007;

        long ans = pow(10, n, mod) - pow(9, n, mod) - pow(9, n, mod) + pow(8, n, mod);
        ans %= mod;
        ans = (ans + mod) % mod;

        System.out.println(ans);
    }

    //return a^b mod M O(logB)
    private static long pow(long a, long b, int M) {
        long ret = 1;
        long tmp = a;
        while (b > 0) {
            if ((b & 1) == 1) ret = (ret * tmp) % M;
            tmp = (tmp * tmp) % M;
            b = b >> 1;
        }
        return ret;
    }
}

Measured memory_bytes: 35680
#include<bits/stdc++.h>
#define pb           push_back
#define pii          pair<int,int>
#define vi           vector<int>
#define vpii         vector<pair<int,int>>
#define gph          map<int, vector<int>>
#define mp           make_pair
#define FOR(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD0(i, n) for (int i = (int)n; i >= 0; i--)
#define FORD1(i, n) for (int i = (int)n; i >= 1; i--)
#define FORS(i, n) for(; i < (int)(n); i++)
#define debug(X) { cout << #X << " = " << (X) << endl; }
#define printArr(A,n) { cout << #A << " = "; FOR(i,n) cout << A[i] << ' '; cout << endl; }
using namespace std;
#define int long long int
char req[3];
pii two(char x){
    pii ans;
    bool first = false;
    FOR(i, 3){
        if(x != req[i]){
            if(!first){
                ans.first = req[i];
                first =true;
            }else{
                ans.second = req[i];
                return ans;
            }
        }
    }
    assert(false);
    return ans;
}
const int mod = 998244353;

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);

    int n;cin >> n;
    map<int, int> cnt;
    req[2] = 'R';
    req[1] = 'G';
    req[0] = 'B';
    string s;cin >> s;
    int ans = 1;
    for(char c: s){
//        debug(ans);
        ans %= mod;
        //find the greatest match
        pii other= two(c);
        //check for two
        int val = other.first*100 + other.second;
        if(cnt[val]){
            ans *= cnt[val];
            cnt[val]--;  
            continue;
        }
        //check for one
        if(cnt[other.first]){
            char d = other.first;
            char e = c;
            if(d > e)swap(d, e);
            cnt[d*100 + e]++;
            ans *= cnt[other.first];
            cnt[other.first]--;
            continue;
        }
        if(cnt[other.second]){
            char d = other.second;
            char e = c;
            if(d > e)swap(d, e);
            cnt[d*100 + e]++;
            ans *= cnt[other.second];
            cnt[other.second]--;
            continue;
        }
        //if none found then insert this into the map
        cnt[c]++;

    }
    FOR1(i, n)ans *= i, ans %= mod;
    cout << ans;
}




Measured memory_bytes: 720
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <cmath>
//小数
#include <iomanip>
using namespace std;

int main()
{
	long double a,b,h,m;
	cin>>a>>b>>h>>m;
	h *= 30;
	h += m*0.5;
	m *= 6;
	long double r = 3.1415926535897932384626433832795028841971;
	r /= 180;
	r*=abs(h-m);
	long double ans = a*a+b*b-2*a*b*cos(r);
	ans = sqrt(ans);
	cout<<fixed<<setprecision(20)<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4164
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll n;
  cin >> n;
  //rep(i,50) cout << i << ",";
  ll up=n/50;
  ll dw=n%50;
  ll s[50];
  rep(i,50){
      s[i]=i+up-dw;
  }
  rep(i,dw){
    s[i]+=51;
  }
  pri(50);
  rep(i,50)cout << s[i] << " ";
  cout << '\n';
  

  //{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49};
  
  


  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int a = sc.nextInt();
   int b = sc.nextInt();
   int c;
   int d = 0;
   for(c=1;c<(b-a);c++){
     d += c;
   }
   System.out.println(d-a);
  }
}

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

using namespace std;

int n,c[11][11]={0},ans=0;

int main() {
	scanf("%d",&n);
	for(int i=1,tmp; i<=n; ++i) {
		tmp=i;
		while(tmp>9) tmp/=10;
		++c[tmp][i%10];
	}
	for(int i=1,j; i<=9; ++i)
		for(j=1; j<=9; ++j) {
			ans+=c[i][j]*c[j][i];
		}
	cout<<ans<<endl; 
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include<stdio.h>
#include <climits>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	string s;
	int n=0,i,flag = 0;
	int ans;

	cin >> n;
	for (i = 1; i < 50000; i++) {
		ans = i * 1.08;
		if (ans == n) {
			cout << i << "\n";
			flag = 1;
		}
	}
	
	if (flag != 1) cout << ":(" << "\n";
}


Measured memory_bytes: 256
//
//  sublime text 3,
//  emre yazicioglu
//

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
#define pb push_back
#define fi first
#define se second
#define INF (ll) 1e18 + 7
#define MOD (ll) 1e9 + 7

const int N = 2e6 + 7;
ll mn = INF, mx = -INF;
ll n, m, k, s, q, t;
ll a, b, c, d, e;
ll ans, cur, sum, cnt;
ll ar[N], p[N], dp[N];
string str; bool h[N];
pll pp[N]; vll v;

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

  // freopen("../in.txt","r",stdin);
  // freopen("../out.txt","w",stdout);

  cin >> n;
  cout << n * n;

}

Measured memory_bytes: 2812
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c; cin >> a >> b >> c;
    int n = a - b;
    int ans = c - n;
    cout << max(ans, 0) << endl;
    return 0;
}



Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


int main() {
	int r, d, x;
	cin >> r >> d >> x;

	REP(i, 10) {
		x = r*x - d;
		ANS(x);
	}
	
	return 0;
}


Measured memory_bytes: 256
h,w=map(int, input().split())
s=[list(input()) for i in range(h)]

s1=[[0]*w for i in range(h)]
s2=[[0]*w for i in range(h)]

for i in range(h):
    count=0
    now=set()
    for j in range(w):
        if s[i][j]=='#':
            s1[i][j]==0
            for j in now:
                s1[i][j]=count
            count=0
            now=set()
        else:
            count+=1
            now.add(j)
    for j in now:
        s1[i][j]=count
        
for i in range(w):
    count=0
    now=set()
    for j in range(h):
        if s[j][i]=='#':
            s2[j][i]==0
            for j in now:
                s2[j][i]=count
            count=0
            now=set()
        else:
            count+=1
            now.add(j)
    for j in now:
        s2[j][i]=count
ans=0
for i in range(h):
    for j in range(w):
        ans=max(ans, s1[i][j]+s2[i][j]-1)
print(ans)

Measured memory_bytes: 262280
N, M = map(int, input().split())
P = []
for i in range(M):
  p_a = input().split()
  P.append([int(p_a[0]), p_a[1]])

ans_list = [[False, 0] for _ in range(N)]
for i, p in enumerate(P):
  current_prob_index = p[0] - 1
  if (ans_list[current_prob_index][0] == True):
    continue
  else:
    if (p[1] == 'WA'):
      ans_list[current_prob_index][1] += 1
    else:
      ans_list[current_prob_index][0] = True

AC_count = 0
WA_count = 0
for i, a in enumerate(ans_list):
  if (a[0] == True):
    AC_count += 1
    WA_count += a[1]

print(AC_count, WA_count)

Measured memory_bytes: 80728
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define DSORT(c, type) sort(ALL(c), greater<type>())

using namespace std;


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

  int n; cin >> n;

  int max = 0, total = 0;
  for(int i=0; i<n; ++i){
      int p; cin >> p;
      if( p > max )
        max = p;
      total+=p;
  }

  cout << int(total-max/2) << "\n";


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
    int r,g,b;
    cin >> r >> g >> b;
    int x = r*100 + g*10 + b;
    if(x%4 == 0){
     cout << "YES" <<endl;
    }else{
     cout << "NO" <<endl;
    }
    
}

Measured memory_bytes: 256
A, B, C, D = map(int, input().split())
 
# X=ceil(A/D)とY=ceil(C/B)を比較し、X>=Yなら勝ち、X<Yなら負け
X = (A+D-1) // D
Y = (C+B-1) // B
if X >= Y: print('Yes')
else: print('No')

Measured memory_bytes: 9148
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <string.h>
#include <vector>

using namespace std;
int main() {
    int y, m, d;
    char c1, c2;
    cin >> y >> c1 >> m >> c2 >> d;
    cout << (m <= 4 ? "Heisei" : "TBD") << endl;
    return 0;
}

Measured memory_bytes: 256
A,B,C,D = list(map(int,input().split()))
X = B//C - (A-1)//C
Y = B//D - (A-1)//D
x = max(C,D)
y = min(C,D)

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

L = (C*D)//gcd(x,y)
Z = B//L - (A-1)//L
  
print(B-A+1-X-Y+Z)

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

int main(){
  string s,t;
  cin >> s >> t;
  
  int count=0;
    for(int i=0; i<s.size(); i++){
      if(s[i] == t[i]){
        count++;
      }
      }
   cout << count << endl;
    }


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

#include <algorithm>
#include <array>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

int gcd(int x, int y) {
  x = std::abs(x); y = std::abs(y);
  int a = std::max(x,y), b = std::min(x,y);
  int r = a % b;
  while(r!=0){ a = b; b = r; r = a % b; }
  return b;
}

int main(void) {
  std::array<int,3> a;
  scanf("%d %d %d", &a[0], &a[1], &a[2]);
  std::sort(a.begin(), a.end());
  printf("%d\n", a[2]*10+a[0]+a[1]);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
/*int find(int a){
     if(a==par[a])return a;
     return par[a]=find(par[a]);
}
void unite(int a,int b){
     a=find(a),b=find(b);
     if(a==b)return ;
     par[b]=a;
}
ll modexpo(ll a,ll b)
{
     int ans=1LL;
     while(b>0)
     {
          if(b&1)ans=(ans*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return ans;
}
*/















int main(){
     ll n,m,v,p;
     cin>>n>>m>>v>>p;
     ll a[n];
     for(int i=0;i<n;i++)cin>>a[i];
     ll pref[n+1];
     pref[0]=0;
     sort(a,a+n);reverse(a,a+n);
     for(int i=0;i<n;i++)pref[i+1]=pref[i]+a[i];
     int ans=p;
     for(int i=p;i<n;i++){
          int left=max(v-p-(n-i-1),0LL);
          if(a[i]+m>=a[p-1]&&((a[i]+m)*(i-p+1))>=((pref[i]-pref[p-1])+m*left)){
               ans++;
          }
     }
     cout<<ans;
}



















































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

int main(){
    int n;
    cin>>n;
    int A[MAX],B[MAX];
    int CNT[MAX];
    rep(i,MAX) CNT[i]=0;
    
    //入力の受け取りと入力要素をカウント
   
    rep(i,n){
        cin>>A[i+1];
        CNT[A[i+1]]++;
    }
    /*
    cout<<"A ";
    rep(i,n){
        cout<<A[i];
    }
    cout<<endl;
    
    cout<<"CNT 初期状態　";
    rep(i,n+1){
        cout<<CNT[i];
    }
    cout<<endl;
    */

    //累積和の計算
    rep(i,MAX) CNT[i]+=CNT[i-1];

    /*
    cout<<"CNT 累積和　";
    rep(i,n+1){
        cout<<CNT[i];
    }
    cout<<endl;
    */

    for(int i=1;i<=n;i++){
        B[CNT[A[i]]]=A[i];
        CNT[A[i]]--;
    }
    /*
    cout<<"CNT 操作後　";
    rep(i,n+1){
        cout<<CNT[i];
    }
    cout<<endl;
    */

    for(int i=1;i<=n;i++){
        if(i-1) cout<<" ";
        cout<<B[i];
    }
    cout<<endl;

    return 0;
}


Measured memory_bytes: 26536
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int lli;
#define MAX 100005
#define endl "\n"
lli arr[MAX];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long double a;
	long double b;
	cin>>a>>b;
	long double c = a*b;
	//cout<<c<<endl;
	cout<<fixed<<setprecision(0)<<floor(c)<<endl;
}

Measured memory_bytes: 3812
import numpy as np
 
H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)])
 
for i in range(H):
  for j in range(W):
    if S[i, j] == '.':
      S[i, j] = np.sum(S[max(i-1, 0):i+2, max(j-1, 0):j+2] == '#')
for s in S:
  print(''.join(s))


Measured memory_bytes: 20156