akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
int main()
{
    int N;
    string S;
    cin >> N >> S;

    vector<vector<int>> check(4, vector<int>(N));
    check[0][0] = 0; check[0][N - 1] = 0;
    check[1][0] = 0; check[1][N - 1] = 1;
    check[2][0] = 1; check[2][N - 1] = 0;
    check[3][0] = 1; check[3][N - 1] = 1;

    vector<bool> flag(4, true);

    rep(i, N - 2) {
        rep(j, 4) {
            int be = (i == 0) ? N - 1 : i - 1;
            int af = i + 1;
            if (check[j][i] == 0) {
                if (S[i] == 'o') check[j][af] = check[j][be];
                else check[j][af] = (check[j][be] == 1) ? 0 : 1;
            }
            else {
                if (S[i] == 'x') check[j][af] = check[j][be];
                else check[j][af] = (check[j][be] == 1) ? 0 : 1;
            }
        }
    }

    rep(i, N) {
        rep(j, 4) {
            int be = (i == 0) ? N - 1 : i - 1;
            int af = (i == N - 1) ? 0 : i + 1;
            if (check[j][i] == 0) {
                if (S[i] == 'o') {
                    if (check[j][be] != check[j][af]) {
                        flag[j] = false;
                    }
                }
                else {
                    if (check[j][be] == check[j][af]) {
                        flag[j] = false;
                    }
                }
            }
            else {
                if (S[i] == 'o') {
                    if (check[j][be] == check[j][af]) {
                        flag[j] = false;
                    }
                }
                else {
                    if (check[j][be] != check[j][af]) {
                        flag[j] = false;
                    }
                }
            }
        }
    }

    int ans = -1;
    rep(i, 4) {
        if (flag[i]) {
            ans = i;
            break;
        }
    }
    
    if (ans == -1) cout << -1 << endl;
    else {
        rep(i, N) {
            cout << ((check[ans][i] == 0) ? 'S' : 'W');
        }
        cout << endl;
    }
    return 0;
}

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

using namespace std;

long long mod = 1000000007;

void dfs(int p, int prev, vector<int> &a, vector<int> &dp, int dpl, vector<vector<int>> &v, vector<int> &res)
{
    int l = -1, r = dpl, mid;
    while (r - l > 1)
    {
        mid = (l + r) / 2;
        if (dp[mid] >= a[p])
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    int temp = dp[r];
    dp[r] = a[p];
    if (temp == -1)
    {
        dpl++;
    }
    res[p] = dpl;
    for (int i = 0; i < v[p].size(); i++)
    {
        if (v[p][i] == prev)
        {
            continue;
        }
        dfs(v[p][i], p, a, dp, dpl, v, res);
    }
    dp[r] = temp;
}

int main()
{
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cin.tie();
    cout.tie();
    // ifstream cin("in.txt");
    // ofstream cout("out.txt");
    
    
    // int t;
    // cin >> t;
    // for (int qwe = 0; qwe < t; qwe++)
    // {
    //     cout << "Case #" << qwe + 1 << ": ";
    // }


    int n;
    cin >> n;
    long long k;
    cin >> k;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    int cycle = 0;
    int curr = 1;
    int start;
    vector<int> visited(n + 1, -1);
    for (int i = 0; true; i++)
    {
        if (visited[curr] != -1)
        {
            cycle = i - visited[curr];
            break;
        }
        visited[curr] = i;
        curr = a[curr];
    }
    start = curr;
    curr = 1;
    while (k > 0)
    {
        if (curr == start && k >= cycle)
        {
            k %= cycle;
            continue;
        }
        curr = a[curr];
        k--;
    }
    cout << curr << '\n';


    return 0;
}


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

int main() {
    char N[3]; for (int i = 0; i < 3; ++i) cin >> N[i];

    string res = "No";
    for (int i = 0; i < 3; ++i) {
        if (N[i] == '7') res = "Yes";
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <cstdio>

int main()
{
    int a,b;
    scanf("%d",&a);
    scanf("%d",&b);
    if(a > b)
    {
        printf("a > b\n");
    }
    else if(a < b)
    {
        printf("a < b\n");
    }
    else
    {
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 2688
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int mod = 1e9 + 7;

int main(void)
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n;i++)
        cin >> a[i];
    int ans = (n - 1) / (k - 1);
    if((n-1)%(k-1)!=0)
        ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main() {
	int n;
	cin>>n;
	int p[n];
	rep(i,n)cin>>p[i];
	sort(p,p+n);
	cout<<(p[n/2]-p[n/2-1])<<endl;
	return 0;
}


Measured memory_bytes: 640
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;


int k,cur=0,ans=inf;
set<int> st[2];
string s;

signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
/*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
*/
cin >> s;
s+="~";
k = s.size();
for(int i=0;i<k;i++){
	cur = 0;
	if(s[i]==s[i+1]){
	}
	else {
		cur = max(i+1,k-i-2);
		ans = min(ans,cur);
	}
	
}
cout << ans << endl;



return 0;}
///....


Measured memory_bytes: 512
#include <bits/stdc++.h>
using  namespace  std;
using ll=long long;
int main(){
  int a,b,x,y;
  cin>>a>>b>>x>>y;
  int e=0;
  if(a>b){
    e+=b*x+(a-b)*y;
  }
  else e+=a*x;
  cout<<e<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>p(n+1);
    vector<int>c(n+1);
    for(int i=1;i<=n;i++)
        cin>>p[i];
    for(int i=1;i<=n;i++)
        cin>>c[i];
    long long ans=-1e18;
    for(int i=1;i<=n;i++)
    {
        int cur=i;
        long long sum=0;
        vector<long long> temp;
        while(p[cur]!=i)
        {
            sum+=c[p[cur]];
            temp.push_back(sum);
            cur=p[cur];
        }
        sum+=c[i];
        temp.push_back(sum);
        int sz=(int)temp.size();
        ans=max(ans,*max_element(temp.begin(),temp.begin()+min(k,sz)));
        if(k>sz)
        {
            ans=max(ans,(k/sz)*(temp[sz-1])+((k%sz>0)?(*max_element(temp.begin(),temp.begin()+k%sz)):0));
            ans=max(ans,(k/sz-1)*(temp[sz-1])+*max_element(temp.begin(),temp.end()));
        }
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3716
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

using Weight = int;
struct Edge {
	int s, d; Weight w;
	Edge() {};
	Edge(int s, int d, Weight w) : s(s), d(d), w(w) {};
};
bool operator<(const Edge &e1, const Edge &e2) { return e1.w < e2.w; }
bool operator>(const Edge &e1, const Edge &e2) { return e2 < e1; }
inline ostream &operator<<(ostream &os, const Edge &e) { return (os << '(' << e.s << ", " << e.d << ", " << e.w << ')'); }

using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void addArc(Graph &g, int s, int d, Weight w = 1) {
	g[s].emplace_back(s, d, w);
}
void addEdge(Graph &g, int a, int b, Weight w = 1) {
	addArc(g, a, b, w);
	addArc(g, b, a, w);
}


auto dijkstra = [&](const Graph &g, int s, Array &dist) {
	int n = g.size();
	vector<bool> vis(n);
	vector<int> prev(n, -1);
	dist.assign(n, INF); dist[s] = 0;
	using State = tuple<Weight, int, int>;
	priority_queue<State, vector<State>, greater<State>> pq;
	pq.emplace(0, s, -1);
	while (pq.size()) {
		Weight d; int v, p; tie(d, v, p) = pq.top(); pq.pop();
		if (dist[v] < d)continue;
		vis[v] = true;
		prev[v] = p;
		for (auto &e : g[v]) {
			if (vis[e.d])continue;
			if (dist[e.d] > dist[v] + e.w) {
				dist[e.d] = dist[v] + e.w;
				pq.emplace(dist[e.d], e.d, v);
			}
		}
	}
	return prev;
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M, s, t; cin >> N >> M >> s >> t;
	s--, t--;
	vector<int> a(M), b(M), c(M), d(M); rep(i, 0, M) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		a[i]--, b[i]--, c[i]--;
	}

	Graph g(N);
	rep(i, 0, M) {
		addEdge(g, a[i], b[i], d[i]);
		addEdge(g, b[i], c[i], d[i]);
		addEdge(g, c[i], a[i], d[i]);
	}

	Array dist(N);
	dijkstra(g, s, dist);
	cout << dist[t] << endl;

	return 0;
}


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

int main() {
  int n, q; cin >> n >> q;
  queue<P> que;
  for (int i = 0; i < n; ++i) {
    string name;
    int time;
    cin >> name >> time;
    que.push({name, time});
  }
  int sum = 0;
  while (!que.empty()) {
    P p = que.front(); que.pop();
    int t = p.second;
    if (t > q) {
      sum += q;
      que.push({p.first, t - q});
    } else {
      sum += t;
      cout << p.first << ' ' << sum << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 6288
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <numeric>
 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll K,N;
ll ans;
string S;
vector<ll> p;
vector<ll> q;
vector<ll> v;
ll ansp,ansq;


int main(){
    cin >> N;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        p.push_back(a);
        v.push_back(i+1);
    }
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        q.push_back(a);
    }
    ll j = 0;
    do{
        j++;
        if(p==v){
            ansp = j;
        }
        if(q==v){
            ansq = j;
        }
    }while(next_permutation(v.begin(),v.end()));
    
    cout << abs(ansp-ansq) << endl;
    
}




Measured memory_bytes: 256
#include <stdio.h>
		 #include <string.h>
       int main(void){
	char str[200];
	scanf("%s",str);
	int n=strlen(str);
	for(int i=n-2; i; i-=2){
	    if(strncmp(str, str+i/2, i/2)==0){
		printf("%d\n" ,i);
		return 0;
	}
  }
	return 0;
	
}

Measured memory_bytes: 128
//
//  main.c
//  ITP1_4_D
//
//  Created by k16031kk on 2018/05/21.
//  Copyright © 2018年 AIT. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int n;
    scanf("%d", &n);
    int a[n], min = 10000, max = -10000;
    long sum = 0;
    for(int i=0; i<n; i++) {
        scanf("%d", &a[i]);
        if(i==0) {
            min=a[0];
            max=a[0];
        }
        sum+=a[i];
        if(min>a[i]) {
            min=a[i];
        }
        if(max<a[i]) {
            max=a[i];
        }
    }
    printf("%d %d %ld\n", min, max, sum);
    return 0;
}



Measured memory_bytes: 2104
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

PLL solve() {
    ll a, b, k;
    cin >> a >> b >> k;
    if(k <= a) return make_pair(a - k, b);
    else return make_pair(0, max<ll>(0, b - (k - a)));
}

int main() {
    ll a, b;
    tie(a, b) = solve();
    cout << a << ' ' << b << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>
#include <iomanip>
#include <sstream>
#include <unordered_map>

using namespace std;
typedef long long ll;


ll ans, mx, mn, flag, sum, cnt;


int main(){
	ll a,b;
	cin>>a>>b;
	ans =abs(a-b);
	if(ans%2==0){
		ans /=2;
		cout<<max(a,b)-ans;
	}
	else cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 256
while(1):
    N=int(raw_input())
    if N==0:
        break
    else:
        gems=[]
        okflag=0
        loc=[10,10]
        for i in range(N):
            [gemx,gemy]=[int(x) for x in raw_input().split()]
            gems.append([gemx,gemy])
        M=int(raw_input())
        for i in range(M):
            com=raw_input().split()
            com[1]=int(com[1])
            if com[0]=="N":
                for j in range(com[1]):
                    loc[1]=loc[1]+1
                    if loc in gems:
                        gems.remove(loc)
                #loc[1]=loc[1]+com[1]
            elif com[0]=="S":
                for j in range(com[1]):
                    loc[1]=loc[1]-1
                    if loc in gems:
                        gems.remove(loc)
                #loc[1]=loc[1]-com[1]
            elif com[0]=="E":
                for j in range(com[1]):
                    loc[0]=loc[0]+1
                    if loc in gems:
                        gems.remove(loc)
                #loc[0]=loc[0]+com[1]
            else:
                for j in range(com[1]):
                    loc[0]=loc[0]-1
                    if loc in gems:
                        gems.remove(loc)
                #loc[0]=loc[0]-com[1]
            if len(gems)==0:
                okflag=1
        if okflag:
            print "Yes"
        else:
            print "No"

Measured memory_bytes: 4300
n, a, b = map(int, input().split())
mod = 10**9+7
"""
def factorial_mod(x, y, mod):
    factorial = 1
    for i in range(x,y+1):
        factorial *= i
        factorial %= mod
    return factorial


#conbinationを何回も求める場合はfactorial_k,nkをあらかじめ計算し, リストに入れておけば良い
def n_C_k(n,k,mod):
    factorial_nk = factorial_mod(n-k+1, n, mod)
    factorial_k = factorial_mod(1,k,mod)
    conbi=factorial_nk*pow(factorial_k, mod-2, mod)
    return conbi%mod

ans = (pow(2, n, mod)-1-n_C_k(n, a, mod)-n_C_k(n, b, mod))%mod
print(ans)
"""

#n!を求める
def factorial_mod(n, mod):
    x = 1
    for i in range(1, n+1):
        x *= i
        x %= mod
    return x

#n_P_kを求める
def permutation_mod(n, k, mod):
    x = 1
    for i in range(n-k+1, n+1): #k回for文を回す
        x *= i
        x %= mod
    return x

#conbinationを何回も求める場合はfactorial_k,nkをあらかじめ計算し, リストに入れておけば良い
def n_C_k(n, k, mod): #O(min(k, n-k))
    k = min(k, n-k)
    n_P_k = permutation_mod(n, k, mod)
    factorial_k = factorial_mod(k, mod)
    conbi=n_P_k * pow(factorial_k, mod-2, mod)
    return conbi % mod

ans = (pow(2, n, mod)-1-n_C_k(n, a, mod)-n_C_k(n, b, mod))%mod
print(ans)

Measured memory_bytes: 38768
#include <iostream>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    int a[n+1], b[n];
    for(int i = 0; i < n+1; ++i) cin >> a[i];
    for(int i = 0; i < n; ++i) cin >> b[i];
    long long ans = 0;
    for(int i = 0; i < n; ++i){
        int x = min(a[i], b[i]);
        ans += x;
        a[i] -= x;
        b[i] -= x;
        int y = min(a[i+1], b[i]);
        ans += y;
        a[i+1] -= y;
    }
    cout << ans << endl;
    return 0;
}

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

void winter_is_coming()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL );
}

int main()
{
    winter_is_coming();

    int n,a,b,x,y,z,num;
     x=y=z=0;
     cin>>n;
     cin>>a>>b;
     for(int i=0;i<n;i++)
     {
         cin>>num;
         if(num<=a)x++;
         else if(num>b)z++;
         else y++;
     }
      cout<<min(x,min(y,z))<<"\n";
   return 0;
}


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

using namespace std;

#define MAX 200005
#define ll long long
ll tree[4*MAX], prop[4*MAX];
vector<pair<ll, ll> > V[MAX];

void propagate(int node, int b, int e)
{
    if(prop[node] == 0) return;
    tree[node] += prop[node];
    if(b != e){
        prop[2*node] += prop[node];
        prop[2*node+1] += prop[node];
    }
    prop[node] = 0;
}

void update(int node, int b, int e, int l, int r, ll val)
{
    propagate(node, b, e);
    if(l > e || r < b) return;
    if(b >= l && e <= r){
        prop[node] += val;
        propagate(node, b, e);
        return;
    }
    int left = 2*node;
    int right = 2*node+1;
    int mid = (b+e)/2;
    update(left, b, mid, l, r, val);
    update(right, mid+1, e, l, r, val);
    tree[node] = max(tree[left], tree[right]);
}

ll query(int node, int b, int e, int l, int r)
{
    propagate(node, b, e);
    if(l > r || l > e || r < b) return 0;
    if(b >= l && e <= r){
        return tree[node];
    }
    int left = 2*node;
    int right = 2*node+1;
    int mid = (b+e)/2;
    ll q1 = query(left, b, mid, l, r);
    ll q2 = query(right, mid+1, e, l, r);
    return max(q1, q2);
}

int main()
{
    ll n, m;
    scanf("%lld %lld", &n, &m);
    memset(tree, 0, sizeof tree);
    memset(prop, 0, sizeof prop);
    for(int i=0; i<m; i++){
        int l, r, val;
        scanf("%d %d %d", &l, &r, &val);
        V[r].push_back(make_pair(l, val));
    }
    for(int i=1; i<=n; i++){
        ll q = query(1, 0, n, 0, i-1);
        q = max(0LL, q);
        update(1, 0, n, i, i, q);
        for(int j=0; j<V[i].size(); j++){
            ll l = V[i][j].first;
            ll val = V[i][j].second;
            update(1, 0, n, l, i, val);
        }
    }
    cout << max(0LL, query(1, 0, n, 0, n));
}


Measured memory_bytes: 23808
use proconio::input;

#[allow(unused_mut)]
fn main() {
    input! {
        b: char
    }
    let res = if b == 'A' {
        'T'
    } else if b == 'T' {
        'A'
    } else if b == 'C' {
        'G'
    } else {
        'C'
    };
    println!("{}", res);
}


Measured memory_bytes: 2096
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

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

	string s;
	cin >> s;
	reverse(s.begin(), s.end());
	cout << s << '\n';
	return 0;
}
// Write Here



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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000
#define M 1000000007
int n,t;
int a[111111];

int main(){
	cin.sync_with_stdio(false);
	cin>>n>>t;
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	int l=0;
	ll res=1;
	rep(i,n){
		while(l<n&&a[i]+t>=a[l])l++;
		res=(res*(l-i))%M;
	}
	cout<<res%M<<endl;
	return 0;
}

Measured memory_bytes: 3504
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}


int main() {
  string s;
  cin >> s;
  s>"2019/04/30" ? cout << "TBD" : cout << "Heisei";
  cout << endl;
}


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

#define abs(N) ((N>0)?N:-1*N)
#define min(A,B) ((A>B)?B:A)
#define max(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)

int main() {
	int x,y;
	while(true){
		cin >> x >> y;
		if(x == 0 && y == 0){
			break;
		}
		printf("%d %d\n",min(x,y),max(x,y));
	}
	return 0;
}



Measured memory_bytes: 3044
import java.util.*;

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();

        if(B/A>C){
            System.out.println(C);
        }
        else if (B/A<=C){
            System.out.println(B/A);
        }
    }
}

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

int main() {
	ios_base::sync_with_stdio( false );

	int a, b, c;
	cin >> a >> b >> c;

	auto p = minmax( { a, b, c } );
	cout << p.first << ' ' << p.second << endl;

	return 0;
}



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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int x, y, ans = 0;
    cin >> x >> y;
    switch (x){
    case 1:
        ans += 3;
        break;
    case 2:
        ans += 2;
        break;
    case 3:
        ans += 1;
        break;
    default:
        break;
    }
    switch (y){
    case 1:
        ans += 3;
        break;
    case 2:
        ans += 2;
        break;
    case 3:
        ans += 1;
        break;
    default:
        break;
    }
    if(x == 1 && y == 1){
        ans += 4;
    }
    ans *= 100000;
    cout << ans << endl;
    return 0;
}


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

int main(){
  ll k, a, b;
  cin >> k >> a >> b;
  if(k > a and b >= a) cout << -1 << endl;
  else if(a >= k) cout << 1 << endl;
  else {
    ll n = (k-b-1)/(a-b);
    cout << 2*n + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 3652
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 300000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real()* b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real()* b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	long long a, b;
	cin >> a >> b;
	if (a <= 5) b = 0;
	else if (a <= 12) b /= 2;
	cout << b << endl;
	return 0;
}

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

public class Main{
  public static void main(String[] args)throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    try{
      int N = Integer.parseInt(br.readLine());
      long ans = 0;
      for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
          for(int k = 1; k <= N; k++){
            ans += gcd(i, gcd(j, k));
          }
        }
      }
      System.out.println(ans);
    }catch(Exception e){
    }
  }
  
  static long gcd(long a, long b){
    if(a > b){
      return gcd(b, a);
    }
    
    if(a == 0){
      return b;
    }
    
    return gcd(b%a, a);
  }
}

Measured memory_bytes: 33112
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define LLINF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, 0};

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<int, int> mp;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        mp[a]++;
    }
    vector<int> ans1, ans2;
    for (auto p : mp)
    {
        if (p.second >= 2)
        {
            ans1.push_back(p.first);
        }
        if (p.second >= 4)
        {
            ans2.push_back(p.first);
        }
    }
    sort(ans1.rbegin(), ans1.rend());
    sort(ans2.rbegin(), ans2.rend());
    if (ans1.size() <= 1)
    {
        cout << 0 << endl;
    }
    else
    {
        ll res = 0;
        if (ans2.size() >= 1)
        {
            res = max((ll)ans1[0] * ans1[1], (ll)ans2[0] * ans2[0]);
        }
        else
        {
            res = (ll)ans1[0] * ans1[1];
        }
        cout << res << endl;
    }
}

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

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

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

bool is_prime[1000010];


int main() {
    int n,k,s;
    cin >> n >> k >> s;
    if(s == 1000000000){
        for (int i = 0; i < k; ++i) {
            cout << 1000000000 << endl;
        }
        for (int i = 0; i < n-k; ++i) {
            cout << 1 << endl;
        }
    }else{
        for (int i = 0; i < k; ++i) {
            cout << s << endl;
        }
        for (int i = 0; i < n-k; ++i) {
            cout << 1000000000 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3608
#include<cstdio>
#include<cstring>
#include<string>
#define R register
#define rep(i,a,b) for(R int i=a ; i<=b ; ++i)
#define dwn(i,a,b) for(R int i=a ; i>=b ; --i)
#define go(i,u) for(R int i=head[u] ; i ; i=a[i].next)
#define int long long
#define min(a,b) (a<b?a:b)
using namespace std;

inline int read() {
	int res=0,f=1;char ch;
	while(!isdigit(ch=getchar())) if(ch=='-') f=-1;
	do {
		res=res*10+ch-'0';
	} while(isdigit(ch=getchar()));
	return res*f;
}

const int N=3e5+5,P=1e9+7;

char s[N];

int n;

int dp[N][3][3];

signed main() {
	scanf("%s",s+1);
	n=strlen(s+1);
	if(s[1]=='0') dp[1][0][1]=1;
	else if(s[1]=='1') dp[1][1][0]=1;
	else dp[1][0][1]=dp[1][1][0]=1;
	rep(i,2,n) {
		if(s[i]=='0') {
			rep(j,0,2) dp[i][j][1]=(dp[i-1][j][0]+dp[i-1][j][2])%P,dp[i][j][2]=dp[i-1][j][1];
		}
		else if(s[i]=='1') {
			dp[i][0][0]=dp[i-1][0][1];
			dp[i][0][1]=dp[i-1][0][2];
			dp[i][1][0]=(dp[i-1][0][0]+dp[i-1][1][1])%P;
			dp[i][1][1]=dp[i-1][1][2];
			dp[i][2][0]=(dp[i-1][1][0]+dp[i-1][2][1]+dp[i-1][2][0])%P;
			dp[i][2][1]=dp[i-1][2][2];
		}
		else {
			rep(j,0,2) dp[i][j][1]=(dp[i-1][j][0]+dp[i-1][j][2])%P,dp[i][j][2]=dp[i-1][j][1];
			(dp[i][0][0]+=dp[i-1][0][1])%=P;
			(dp[i][0][1]+=dp[i-1][0][2])%=P;
			(dp[i][1][0]+=(dp[i-1][0][0]+dp[i-1][1][1])%P)%=P;
			(dp[i][1][1]+=dp[i-1][1][2])%=P;
			(dp[i][2][0]+=(dp[i-1][1][0]+dp[i-1][2][1]+dp[i-1][2][0])%P)%=P;
			(dp[i][2][1]+=dp[i-1][2][2])%=P;
		}
	}
	int ans=0;
	ans=(((dp[n][1][0]+dp[n][2][0])%P+dp[n][2][1])%P+dp[n][2][2])%P;
	printf("%d",ans);
	return 0;
}

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

int main() {
    int K,N,r=INF,s=0;
    cin >> K >> N;
    vector<int> A(N),d(N);

    cin >> A.at(0);
    rep(i,N-1) {
        cin >> A.at(i+1);
        d.at(i) = A.at(i+1)-A.at(i);
    }
    d.at(N-1) = A.at(0)+K-A.at(N-1);
    
    rep(i,N)
        s += d.at(i);
    
    rep(i,N)
        r = min(r, s-d.at(i));

    cout << r << endl;
}

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

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

void solve() {
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif

	int n, a, b; string str;
	
	cin >> str;
	
	bool ans = str.find('C') != string::npos && str.find('F') != string::npos && str.find_first_of('C') < str.find_last_of('F');


	cout << (ans ? "Yes" : "No") << endl;
}




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


	solve();
	system("PAUSE");
	return 0;
}

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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int g[20][20];

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int H,W;
  cin>>H>>W;

  for(int y=0;y<=9;y++){
    for(int x=0;x<=9;x++){
      cin>>g[y][x];
    }
  }

  int V = 10;

  for(int k=0;k<V;k++){
    for(int i=0;i<V;i++){
      for(int j=0;j<V;j++){
        g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
      }
    }
  }

  ll ans = 0;

  for(int y=0;y<H;y++){
    for(int x = 0;x<W;x++){
      int t;
      cin>>t;
      if(t==-1||t==1)continue;
      ans += g[t][1];
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD (1000000007)
#define asz 500005
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
ll fre[500005];
ll a[500005];
int main(){
    fastread;
    ll n,i,j,k,l,m;
    cin>>n>>m;
    string s;
    cin>>s;
    ll gun=1;
    if(m==2||m==5){
        ll ans=0;
        for(i=0;i<n;i++){
            if((s[i]-'0')%m==0)
                ans+=(i+1);
        }
        cout<<ans<<endl;
        return 0;
    }
    for(i=1;i<=n;i++){
        ///if(i!=0)
        a[i]=(a[i-1]+((s[n-i]-'0')*gun)%m)%m;
        gun=(gun*10LL)%m;
        fre[a[i]]++;
    }
    ll sum=0;
    fre[0]++;
    for(i=0;i<m;i++){
        //if(i==0)
          ///  sum=(sum+fre[i]+((fre[i])*(fre[i]-1))/2);
       /// else
            sum+=(((fre[i])*(fre[i]-1))/2) ;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 4244
import java.util.Scanner;

public class Main{
 public static void main(String[] args) {

  try (Scanner sc = new Scanner(System.in)) {
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] values = new int[w];
    for (int i = 0; i < values.length; i++) {
      values[i] = i + 1;
    }
    for (int i = 0; i < n; i++) {
      String str = sc.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0]) - 1;
      int b = Integer.parseInt(ab[1]) - 1;

        int value = values[a];
        values[a] = values[b];
        values[b] = value;
    
    }
    for(int i=0; i < values.length; i++){
      System.out.println(values[i]);
    }
  }
 }
}


Measured memory_bytes: 25992
#include<iostream>
#include<cmath>
#include<cstdlib>
using namespace std;
struct coo{
	int x;
	int y;
	int h;
}c[110];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>c[i].x;
		cin>>c[i].y;
		cin>>c[i].h;
	}
	int ch;
	int p=0;
	while(c[p].h==0) p++;
	for(int i=0;i<=100;i++)
	{
		for(int j=0;j<=100;j++)
		{
			int ch=c[p].h+abs(i-c[p].x)+abs(j-c[p].y);
			int f=0;
			for(int k=0;k<n;k++)
			{
				int hh=ch-abs(i-c[k].x)-abs(j-c[k].y);
				if(hh<0) hh=0;
				if(hh!=c[k].h)
				{
					f=1;
					break;
				}
			}
			if(!f)
			{
				cout<<i<<' '<<j<<' '<<ch<<endl; return 0;
			} 
		}
	}
} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		if(Character.isUpperCase(str.charAt(0))) {
			System.out.println("A");
		}else {
			System.out.println("a");
		}

	}

}


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

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<int> d(n, -1);
  bool succ = true;
  for (int i = 0; i < m; i++) {
    int s, c;
    scanf("%d %d", &s, &c);
    
    if (d[s - 1] == -1)
      d[s - 1] = c;
    else if (d[s - 1] != c) {
      succ = false;
      break;
    }
  }

  if (n > 1 && d[0] == 0) succ = false;
  
  if (!succ)
    printf("-1\n");
  else {
    if (d[0] == -1) {
      if (n > 1)
        d[0] = 1;
      else
        d[0] = 0;
    }
    
    for (int i = 1; i < n; i++)
      if (d[i] == -1)
        d[i] = 0;

    for (int i = 0; i < n; i++)
      printf("%d", d[i]);
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#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() {
  double r; 
  cin >> r;
  printf("%f %f\n", r * r * M_PI, 2 * M_PI * r);
  return 0;
}


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

 int main() {
   vector<int> a(3);
   for(int i = 0;i<a.size();i++){
     cin >> a.at(i);
   }
   
   sort(a.begin(), a.end());
   reverse(a.begin(), a.end());
   
   int b = a.at(0);
   int c = a.at(1);
   int d = a.at(2);
   int ans = ((b * 10) + c) + d;
   
   cout << ans << endl;
} 

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



signed main()
{
 
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   
 
#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif      

    int ans=0;
    long double x,y;
    int n;
    cin>>n;
    long double d;
    cin>>d;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        long double z=x*x+y*y;
        z=sqrt(z);
        if(z<=d)
            ans++;
    }
    cout<<ans;

}


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


int main() {
  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i <= n; i++){
    ll k = n / i;
    ans += i * (k * (k + 1) / 2);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3620
N = int(input())
X = list(map(int, input().strip()))

count_j = X.count(1)

def calc_table(m):
	if m == 1:
		return [0] * N
	elif m == 0:
		return None
	table = []
	x = 1
	for i in range(N):
		table.append(x)
		x = (x * 2) % m
	table.reverse()
	return table

count_m = count_j - 1
count_p = count_j + 1

mod_m = calc_table(count_m)
mod_j = calc_table(count_j)
mod_p = calc_table(count_p)

original_j = 0
original_m = 0
original_p = 0
if count_m > 0:
	for i, b in enumerate(X):
		if b == 1:
			original_j = (original_j + mod_j[i]) % count_j
			original_m = (original_m + mod_m[i]) % count_m
			original_p = (original_p + mod_p[i]) % count_p
else:
	for i, b in enumerate(X):
		if b == 1:
			original_j = (original_j + mod_j[i]) % count_j
			original_p = (original_p + mod_p[i]) % count_p
#print(mod_p)
#print(original_m, original_j, original_p)

f_cache = [None] * N
def calc_f(x):
	if x == 0:
		return 0
	f = f_cache[x]
	if f != None:
		return f
	count = 0
	i = x
	while i > 0:
		if i % 2 == 1:
			count += 1
		i //= 2
	f = calc_f(x % count) + 1
	f_cache[x] = f
	return f

for i, b in enumerate(X):
	if b == 0:
		x = (original_p + mod_p[i]) % count_p
		print(calc_f(x) + 1)
	else:
		if count_m > 0:
			x = (original_m - mod_m[i]) % count_m
			print(calc_f(x) + 1)
		else:
			print(0)


Measured memory_bytes: 36152
import java.io.InputStream;
import java.io.PrintStream;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    String s = sc.next();
    Map<String, List<String>> map = IntStream.range(0, s.length())
      .mapToObj(i -> String.valueOf(s.charAt(i))).collect(
        Collectors.groupingBy(Function.identity()));
    if (map.size() == 2 && map.values().stream().allMatch(l -> l.size() == 2)) {
      pw.println("Yes");
    } else {
      pw.println("No");
    }
  }
}


Measured memory_bytes: 27848
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		int v = sc.nextInt();
		for(;;) {
			String s = sc.next();
			if(s.equals("+")) v += sc.nextInt();
			if(s.equals("-")) v -= sc.nextInt();
			if(s.equals("*")) v *= sc.nextInt();
			if(s.equals("/")) v /= sc.nextInt();
			if(s.equals("=")) break;
		}
		System.out.println(v);
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 19500
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, xyi):
    plus_max = - 10 ** 18
    plus_min = + 10 ** 18
    minus_max = - 10 ** 18
    minus_min = + 10 ** 18

    for x, y in xyi:
        plus_max = max(plus_max, x + y)
        plus_min = min(plus_min, x + y)
        minus_max = max(minus_max, x - y)
        minus_min = min(minus_min, x - y)
    ans = max(abs(plus_max - plus_min), abs(minus_max - minus_min))
    print(ans)


if __name__ == '__main__':
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    # Ai = [int(i) for i in input().split()]
    # Bi = [int(i) for i in input().split()]
    xyi = [[int(i) for i in input().split()] for _ in range(N)]
    solve(N, xyi)

    # # test
    # from random import randint
    # from func import random_str
    # solve()


Measured memory_bytes: 42324
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	string s;
  	cin >> s;
  	s[3]++;
  	cout << s << endl;
	return;
}

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


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

struct Node {
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void insertx (int k){
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

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

    z->parent = y;

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

Node * findx(int k){
    Node *x = root;
    while(x != NIL && x->key != k){
        if(x->key > k){
            x = x->left;
        } else {
            x = x->right;
        }
    }
    return x;
}

Node * getMin(Node *z){
    while(z->left != NIL){
        z = z->left;
    }
    return z;
}

Node * getSuc(Node *z){
    if(z->right != NIL){
        return getMin(z->right);
    }

    Node *y = z->parent;
    while(y != NIL && z == y->right){
        z = y;
        y = y->parent;
    }
    return y;
}

void deletex(Node *z){
    Node *y;
    Node *x;
    if(z->left == NIL || z->right == NIL){
        y = z;
    } else {
        y = getSuc(z);
    }

    if(y->left != NIL){
        x = y->left;
    } else {
        x = y->right;
    }

    if(x != NIL){
        x->parent = y->parent;
    }

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

    if(y != z){
        z->key = y->key;
    }
}

void preOrder(Node *z){
    if (z == NIL){
        return;
    }
    cout << " " << z->key;
    preOrder(z->left);
    preOrder(z->right);
}

void inOrder(Node *z){
    if (z == NIL){
        return;
    }
    inOrder(z->left);
    cout << " " << z->key;
    inOrder(z->right);
}

int main() {
    int m; cin >> m;

    rep(i, m){
        string S; cin >> S;
        if(S == "insert"){
            int k; cin >> k;
            insertx(k);
        } else if(S == "print"){
            inOrder(root);
            cout << endl;
            preOrder(root);
            cout << endl;
        } else if(S == "find"){
            int k; cin >> k;
            Node *x = findx(k);
            if(x == NIL){
                cout << "no" << endl;
            } else {
                cout << "yes" << endl;
            }
        } else {
            int k; cin >> k;
            Node *x = findx(k);
            deletex(x);
        }
    }

    return 0;
}


Measured memory_bytes: 21816
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>


// #define INT_MAX 2147483647
// #define LL_MAX 9223372036854775807

using namespace std;
#define i64  long long

void solve(void)
{
  int x;
  cin>>x;
  cout<<x*x*x<<endl;
}
int main(int argc, const char *argv[])
{

  solve();

  return 0;
}



Measured memory_bytes: 3072