akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n;
    cin >> n;
    int res = 0;
    REP(i, n) {
        int tmp;
        cin >> tmp;
        while (tmp % 2 == 0) {
            tmp /= 2;
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define ALL(v) v.begin(), v.end()
const int INF = 1e9;
const int MAX = 510000;
const int MOD = 1000000007;
using namespace std;
typedef long long ll;

/*DP使ったほうがよくない？？WOWWOW*/

int main(){
  ll a,b,c; cin>>a>>b>>c;
  if(4*a*b<(c-a-b)*(c-a-b) && a+b<c){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            while(Console.ReadLine() != "0") {
                var score = Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
                var avg = score.Average();
                Console.WriteLine(Math.Sqrt(score.Select(q => Math.Pow(avg - q, 2)).Sum() / score.Length));
            }
        }
    }
}

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

int main() {
  int n, m;
  while(cin >> n >> m){
    if(n==0) return 0;
    int ans=0;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    rep(i, n)REP(j, i+1, n){
      int t = v[i]+v[j];
      if(t<=m && ans<t) ans=t;
    }
    if(ans==0) cout << "NONE" << endl;
    else cout << ans << endl;
  }
  return 0;
}


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

#define mod 1000000007
#define ll long long

using namespace std;

void solve() {
    int n;
    cin >> n;

    vector<ll> v(n), pre(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }

    pre[n-1] = v[n-1];
    for (int i = n-2; i >= 0; --i) {
        pre[i] = v[i] + pre[i+1];
        pre[i] %= mod;
    }

    ll ans = 0;
    for (int i = 0; i < n-1; ++i) {
        ans += v[i] * pre[i+1];
        ans %= mod;
    }

    cout << ans << endl;
}

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

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    // cin >> t;

    for (int i = 0; i < t; ++i) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 6356
import java.util.Scanner;

public class Main {
    static final Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        long x = sc.nextLong(), k = sc.nextLong(), d = sc.nextLong(), ans;
        x = Math.abs(x);
        long step = Math.min(k, x/d);
        k -= step;
        x -= d*step;
        if (k%2 == 0){
            ans = x;
        }else{
            ans = d - x;
        }
        System.out.println(ans);
    }    
}

Measured memory_bytes: 35816
#include<cstdio>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
struct node
{
    string name;
    int num;
    int x;
}a[105];
bool cmp(node s1,node s2){
    if(s1.name==s2.name) return s1.num>s2.num;
    return s1.name<s2.name;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i].name;
        a[i].x=i+1;
        cin>>a[i].num;
    }
    sort(a,a+n,cmp);
    for(int i=0;i<n;i++)
    {
        printf("%d\n",a[i].x);
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <map>
#include <algorithm>

using namespace std;

template< typename T>
void print(const vector<T> &data) {
	if (data.empty()) return;
	for (int i = 0; i < data.size(); ++i) {
		cout << data[i];
		if (i != data.size() - 1) cout << " ";
		else cout << endl;
	}
}

long long cnt = 0;
int l;
int A[1000000];
int n;
vector<int> G;

void insSort(int A[], int n, int g){
	for (int i = g; i < n; ++i){
		int v = A[i];
		int j = i - g;
		while (j >= 0 && A[j]>v)
		{
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
	}
}

void shellSort(int A[], int n){
	for (int h = 1;;){
		if (h > n) break;
		G.push_back(h);
		h = 3 * h + 1;
	}

	for (int i = G.size() - 1; i >= 0; --i){
		insSort(A, n, G[i]);
	}
}


int main(){
	cin >> n;
	for (int i = 0; i < n; ++i) scanf("%d", &A[i]);
	cnt = 0;

	shellSort(A, n);

	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0; --i){
		printf("%d", G[i]);
		if (i) printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; ++i) printf("%d\n", A[i]);

	return 0;
}

Measured memory_bytes: 7180
import java.util.*;

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

        for (int i = 1;i<=10;i++) {
            x = r * x - d;
            System.out.println(x);
        }
    }
}

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

int main(void){
    int n;
    cin >> n;
    ll sum = 0;
    rep1(i,n) {
        if (i % 5 != 0 && i % 3 != 0) {
            sum += i;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3580
N = gets.to_i
W = N.times.map { gets.chomp }

success = true
checked = Hash.new

W.each_cons(2).each do |a, b|
  if checked[a]
    success = false
    break
  end

  checked[a] = true

  if a[-1] != b[0]
    success = false
    break
  end
end

if success && !checked[W.last]
  puts 'Yes'
else
  puts 'No'
end


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

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

int main() {
    //cout.precision(10);
    vector<int> in(3);
    for(int i = 0; i < 3; i++) {
        cin >> in[i];
    }
    sort(in.begin(), in.end());
    int ans[3] = {5, 5, 7};
    for(int i = 0; i < 3; i++) {
        if(in[i] != ans[i]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<int> P;

P pos(int k, int w) {
	return P(k % w, k / w);
}
int dist(P p1, P p2) {
	return abs(p1.real()-p2.real()) + abs(p1.imag()-p2.imag());
}

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

	int ans = 1e9;
	for (int w = 1; w <= n; ++w) {
		ans = min(ans, dist( pos(a, w), pos(b, w) ) + dist( pos(c, w), pos(d, w) ));
	}
	cout << ans << endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 998244353
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
signed main(){
	int n,m,v,p;
	cin>>n>>m>>v>>p;
	vector<int> a;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		a.pb(x);
	}
	sort(a.begin(), a.end() );
	int ok = n-1, ng = -1;
	while( ok - ng > 1 ){
		int mid = (ok + ng)/2;
		int lef = mid + 1;
		int rig = n - p;
		int plusable = 0;
		int nokori = max( 0LL, v-mid-p ) * m;
		for(int i = lef; i <=rig; i++){
			if( a[i] - a[mid] > m ){
				plusable = -LINF;
			}
			else{
				plusable += m - (a[i]-a[mid]) ;
			}
		}
		if( nokori <= plusable ){
			ok = mid;
		}
		else{
			ng = mid;
		}
	}
	cout<<n-ok<<endl;
	return 0;
}

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

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

typedef long long ll;

const int INF=1e9+7;
const int MAX_N=1e5+5;
int a[MAX_N];
int gcd(int x,int y){
	if(y==0)return x;
	if(x>y)return gcd(y,x%y);
	else return gcd(x,x%y);
}
int main(){
	int n,k;
	cin>>n>>k;
	rep(i,n)cin>>a[i];
	int mi=a[0];
	int ma=0;
	rep(i,n){
		ma=max(ma,a[i]);
		mi=gcd(a[i],mi);
	}
	if(k%mi==0 && ma>=k)cout<<"POSSIBLE"<<endl;
	else cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << "Hello World" << endl;
  } else {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#define INT long long int
using namespace std;
INT n, l, a[100010], p;

int main()
{
    cin>>n>>l;
    for(int i = 0 ; i < n ; i++ )
        scanf("%lld", a+i);
    for(int i = 1 ; i < n ; i++ )
        if( a[i-1] + a[i] >= l ){ p = i; break; }
    if( !p ) puts("Impossible");
    else
    {
        puts("Possible");
        for(int i = 1 ; i <= p-1 ; i++ ) printf("%d\n", i);
        for(int i = n-1 ; i >= p ; i-- ) printf("%d\n", i);
    }
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    map<ll, int> mp;
    rep(i, n) {
        ll a;
        cin >> a;
        ++mp[a];
    }
    ll max_4 = 0;
    ll max_2 = 0;
    ll second_2 = 0;
    for ( auto tmp_mp : mp ) {
        if ( tmp_mp.second >= 4 ) {
            max_4 = max(max_4, tmp_mp.first);
        }
        if ( tmp_mp.second >= 2 ) {
            if ( tmp_mp.first > max_2 ) {
                second_2 = max_2;
                max_2 = tmp_mp.first;
            }
            else if ( tmp_mp.first > second_2 ) {
                second_2 = tmp_mp.first;
            }
        }
    }
    cout << max(max_4 * max_4, max_2 * second_2) << endl;
    return 0;
}


Measured memory_bytes: 6528
#include<iostream>
#include<cstdio>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
#define MAXN 400000+50
#define MAXM 400000+50
struct Edge{
    int from,to,dis,next;
}edge[MAXM];
#define inf 0x7fffffff
int head[MAXM];
int num=0;
void add(int u,int v,int dis)
{
    edge[++num].to=v,edge[num].dis=dis;
    edge[num].next=head[u];
    head[u]=num;
//    edge[++num].from=v,edge[num].to=u,edge[num].dis=dis;
}
bool vis[MAXN];
bool flag;
int pos[MAXN];
int rec[MAXN];
void dfs(int x)
{
    if(!flag) return;
    vis[x]=1;
    for(int i=head[x];i!=0;i=edge[i].next)
    {
        int t=pos[x]+edge[i].dis;
        if(pos[edge[i].to]==inf) pos[edge[i].to]=t,dfs(edge[i].to);
        else if(t!=pos[edge[i].to]) {
            flag=0;return;
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    int cnt=0;
    for(int i=1;i<=m;++i)
    {
        int x,y,z;
        cin>>x>>y>>z;
        add(x,y,z);add(y,x,-z);
        pos[x]=pos[y]=inf;
        rec[++cnt]=x,rec[++cnt]=y;
    }
    sort(rec+1,rec+cnt+1);
    cnt=unique(rec+1,rec+n+1)-rec-1;
    for(int i=1;i<=cnt;++i)
    {
        if(!vis[rec[i]])
        {
            flag=1;
            pos[rec[i]]=0;
            dfs(rec[i]);
            if(!flag) {cout<<"No"<<endl;return 0;}
        }
    }
    puts("Yes");
}

Measured memory_bytes: 13312
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x " = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) \
    TRACE(for (auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V)                   \
    TRACE({                         \
        cout << #V " = ";           \
        WATCHR(V.begin(), V.end()); \
    })
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define mp make_pair
#define st first
#define nd second

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using pll = pair<ll, ll>;

void buff() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod(ll a, ll b, ll mod = MOD) {
    ll res = 1;
    a %= mod;
    assert(b >= 0);
    for (; b; b >>= 1) {
        if (b & 1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}
// End of template code!

int lsb(int i){ return i & -i;}

struct BIT{
	int size;
	vi table;
	BIT(int sz){
		table.resize(sz+2, 0);
		size = sz+1;
	}
	// update position pos by delta
	// pos is zero indexed
	void update(int pos, int delta){
		++pos;
		while(pos <= size){
			table[pos] += delta;
			pos += lsb(pos);
		}
	}

	// update the interval [l, r] by delta
	// l and r should be 0-indexed
	void rangeUpdate(int l, int r, int delta){
		update(l, delta);
		update(r+1, -delta);
	}
	//the i parameter is 0 indexed
	int pointQuery(int i){
		++i;
		int sum = 0;
		while(i > 0){
			sum += table[i];
			i -= lsb(i);
		}
		return sum;
	}
};

void solve(vi& v, int qnt) {
    int n = sz(v);
    vector<pair<int, int> > cur_range;

    auto b = BIT(n);

    rep(i, 0, n) {
        cur_range.emplace_back(max(0, i - v[i]), min(n - 1, i + v[i]));
        b.rangeUpdate(cur_range.back().first, cur_range.back().second, 1); 
    }
    
    rep(i, 0, qnt) {
        int count_n = 0;
        vector< pair< pii, pii > > change;
        rep(j, 0, n) {
            int val = b.pointQuery(j);
            if(val != v[j]) {   
                v[j] = val;
                change.emplace_back( make_pair( cur_range[j], make_pair( max(0, j - val), min(n - 1, j + val) ) ) ); 
                cur_range[j] = make_pair( max(0, j - val), min(n - 1, j + val) );
            }
            if(val == n) count_n++;
        }
        for(const auto& c : change) {
            b.rangeUpdate(c.first.first, c.first.second, -1);
            b.rangeUpdate(c.second.first, c.second.second, 1);
        }
        if(count_n == n) break;
    }
    for(const auto& x : v) cout << x << " ";
    cout << endl;
}

int main() {
    buff();
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for(int& x : v) cin >> x;
    solve(v, k);
    return 0;
}



Measured memory_bytes: 13492
// Aizu 1276: Prime Gap
// 2017.9.21 bal4u@uu

#include <stdio.h>
#include <ctype.h>

#define MAX  1299709
#define SQRT 1140     // sqrt(MAX)
char prime[MAX + 5], *pmax = prime + MAX;

void mkprime()
{
	int k;
	register char *p, *q;
	prime[1] = 0, prime[2] = 0;
	for (p = prime + 4; p <= pmax; p += 2) *p = 1;
	for (k = 3, p = prime + 3; k <= SQRT; k += 2, p += 2)
		if (!*p) for (q = p + k; q <= pmax; q += k) *q = 1;
}

int main()
{
	int n, ans;

	mkprime();
	while (scanf("%d", &n) && n) {
		ans = 0;
		if (prime[n]) {
			ans = n + 1;
			while (prime[--n]);
			while (prime[ans]) ans++;
			ans -= n;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3048
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string.h>
int k, a, b,flg;
using namespace std;
int main() {
    scanf("%d%d%d", &k, &a, &b);
   for(int i=a;i<=b;i++){
       if (i%k) 
       continue;       
       flg = 1;
       break;
   
   }if (flg)printf("OK\n");
   else printf("NG\n");
    return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int

int main()
{
    int h, w;
    cin >> h >> w;
    char s[h][w];
    int H[] = {0, 1, 0, -1}, W[] = {1, 0, -1, 0};
    int ans = 0;
    rep(i, h)
    {
        rep(j, w)
        {
            cin >> s[i][j];
        }
    }
    rep(startx, h)
    {
        rep(starty, w)
        {
            if(s[startx][starty]=='#') continue;
            int visit[h][w];
            rep(i, h)
            {
                rep(j, w)
                {
                    visit[i][j] = -1;
                }
            }
            queue<pair<int, int>> que;
            visit[startx][starty] = 0;
            que.push(make_pair(startx, starty));

            while (!que.empty())
            {
                pair<int, int> now = que.front();
                
                que.pop();
                int nx = now.first, ny = now.second;
                //printf("now==(%d,%d)\n",nx,ny);
                rep(k, 4)
                {
                    if (nx + H[k] < 0  || nx + H[k] > h - 1 || ny + W[k] < 0 || ny + W[k] > w - 1)
                        continue;
                    if (visit[nx + H[k]][ny + W[k]] != -1 || s[nx + H[k]][ny + W[k]] == '#')
                        continue;

                    pair<int, int> next = make_pair(nx + H[k], ny + W[k]);
                    que.push(next);
                    visit[next.first][next.second] = visit[nx][ny] + 1;
                    ans = max(ans, visit[next.first][next.second]);
                }
            }
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;

typedef long long ll;

const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

template<class T>inline void read(T &res)
{
	char c;T flag=1;
	while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
	while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}

const int N=2e5+100;

ll n,k;

ll a[N];

ll vis[N];

int main()
{
	scanf("%lld%lld",&n,&k);
	for(ll i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	vector<ll>v;
	vis[1]=1;
	v.push_back(1);
	ll id=1;
	ll c=0;
	while(true)
	{
		if(vis[a[id]]==1)
		{
			break;
		}
		else
		{
			vis[a[id]]=1;
			v.push_back(a[id]);
			id=a[id];
		}
	}
	ll x=a[id];
	ll pos=0;
	ll len=v.size();
	for(int i=0;i<len;i++)
	{
		if(x==v[i])
		{
			pos=i;
			break;
		}
	}
	c=len-pos;
	if(k<=pos)
	{
		printf("%lld\n",v[k]);
	}
	else
	{
		printf("%lld\n",v[(k-pos)%c+pos]);
	}
	return 0;
}


Measured memory_bytes: 8420
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  ll n, k;
  cin >> n >> k;
  vll a(n);
  rep(i,n) cin >> a[i];
  vll ans;
  rep(i,n-k) {
    if(a[i+k]>a[i]) ans.push_back(1);
    else ans.push_back(0);
  }
  rep(i,n-k) {
    if(ans[i]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 6868
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N, K = MAP()
S = input()

cnt = 0

for i in range(1, len(S)):
	if S[i-1] != S[i]:
		cnt += 1
		
cnt = max(0, cnt-2*K)

print(len(S)-1-cnt)
	



Measured memory_bytes: 10732
#include<iostream>
using namespace std;
int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int dx = x2 - x1;
	int dy = y2 - y1;
	cout << x2 - dy << " ";
	cout << y2 + dx << " ";
	cout << x1 - dy << " ";
	cout << y1 + dx << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F(i, a, b) for (int i = (a); i < (b); ++i)
#define F2(i, a, b) for (int i = (a); i <= (b); ++i)
#define dF(i, a, b) for (int i = (a); i > (b); --i)
#define dF2(i, a, b) for (int i = (a); i >= (b); --i)
#define maxn 110
using namespace std;
typedef long long LL;
char ch[maxn][maxn];
int main() {
    int a, b;
    scanf("%d%d", &a, &b);
    puts("100 100");
    F(i, 0, 50) F(j, 0, 100) ch[i][j] = '.';
    F(i, 50, 100) F(j, 0, 100) ch[i][j] = '#';
    int x = b-1, y = a-1;
    int row = x / 50, col = x % 50;
    F(i, 0, row) {
        F(j, 0, 50) ch[i<<1][j<<1] = '#';
    }
    F(i, 0, col) ch[row<<1][i<<1] = '#';
    row = y / 50, col = y % 50;
    F(i, 0, row) {
        F(j, 0, 50) ch[99-(i<<1)][j<<1] = '.';
    }
    F(i, 0, col) ch[99-(row<<1)][i<<1] = '.';
    F(i, 0, 100) {F(j, 0, 100) printf("%c", ch[i][j]); puts("");}
    return 0;
}


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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

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

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#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 range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

const int kMax_x = 100001;

int main(void){
    for(int n, d, x; cin >> n >> d >> x; cout << x << endl){
        vvi p(d, vi(n));
        rep(i, d) rep(j, n) cin >> p[i][j];

        rep(i, d - 1){
            vi dp(x + 1);
            rep(j, x + 1) dp[j] = j;

            rep(j, n){
                rep(k, x + 1){
                    if(k - p[i][j] >= 0){
                        dp[k] = max(dp[k], dp[k - p[i][j]] + p[i + 1][j]);
                    }
                }
            }

            x = *max_element(all(dp));
        }
    }

	return 0;
}

Measured memory_bytes: 1320
/******************************************************************************
 
рассвет. 
 
*******************************************************************************/
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define all(a) (a).begin(),(a).end()
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define vplli vector <pair <lli,lli> >
#define vvi vector <vector <int> >
#define vvlli vector <vector <lli> >
#define vvpii vector <vector <pair <int,int>> >
#define fr(i,n) for (int i = 0; i < (n); ++i)
#define frbig(i,n) for (lli i = 0; i < (n); ++i)
#define fra(i,a,n) for (int i = a; i < (n); ++i)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define readchar(n) char n; cin >> n;
#define readstr(n) string n; cin >> n;
#define readarr(a,n) fr(i,n) cin >> a[i];
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
 
const lli MOD=1e9+7;
const lli MAXN=1e5+1;
const ld PI=acos(-1);

vi p(MAXN),r(MAXN,0);

int dsu_find(int v){
    if(v==p[v]) return v;
    else return p[v]=dsu_find(p[v]);
}

void dsu_merge(int a,int b){
    a=dsu_find(a);
    b=dsu_find(b);
    if(r[a]<r[b]) swap(a,b);
    p[b]=a;
    r[a]++;
}

int main(){
    rapgame
    //freopen("brokeday.in", "r", stdin);
    //freopen("richday.out", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--){
        read2(n,m);
        fr(i,n) p[i+1]=i+1;
        fr(i,m){
            read2(a,b);read(c);
            dsu_merge(a,b);
        }
        set <int> ans;
        fr(i,n){
            ans.insert(dsu_find(i+1));
        }
        cout << ans.size();
    }
    return 0;
}

Measured memory_bytes: 8752
/**
* @author Ashini Singha
* IIT,Jahangirnagar University
*/
#include<bits/stdc++.h>
using namespace std;
#define     ll          long long int
#define     fo(i,b,n)   for(int i=(b); i<(n) ; i++)
#define     xx          first
#define     yy          second
#define     pb          push_back
#define     sz(n)       int(n.size())
#define     pii         pair
#define     MP          make_pair
#define     PI          acos(-1.0)

#define read(x)         scanf("%d",&x)
#define read2(x,y)      scanf("%d%d",&x,&y)
#define readl(x)        scanf("%lld",&x)
#define readl2(x,y)     scanf("%lld%lld",&x,&y)
#define readd(x)        scanf("%lf",&x)
#define readd2(x,y)     scanf("%lf%lf",&x,&y)

#define pr(n)           printf("%d",n)
#define prn(n)          printf("%d\n",n)
#define prl(n)          printf("%lld",n)
#define prln(n)         printf("%lld\n",n)
#define prd(x)          printf("%lf",x)
#define prdn(x)         printf("%lf\n",x)
#define TC(n) printf("Case %d: ",n)
/*_____________E_N_D______________*/



int main()
{

      ll n;
      readl(n);

      ll lim=sqrt(n);

      ll ans=9999999999999;

      fo(i,1,lim+1){
            if(n%i==0){
                  ll temp=max((ll)i, (ll) (n/i) );
                  ans=min(temp,ans);
            }
      }

      prln( (int)( log10(ans)+1 ) );


      return 0;
}



















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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> void chmax(T& a,const T& b){if(a < b) a = b;}
template<typename T> void chmin(T& a,const T& b){if(b < a) a = b;}
typedef long long ll;

int N,M;
map<int,int> min_cost [100001];
struct state{
	int x,y;
	int cost;
	bool operator>(const state& a) const{
		return this->cost > a.cost;
	}
};
map< int,list<state> > edge [100001];

int dijkstra(int s,int g)
{
	priority_queue< state,vector<state>,greater<state> > pq;
	pq.push(state{s,0,0});

	while(pq.empty() == false){
		int x = pq.top().x,y = pq.top().y;
		int cost = pq.top().cost;
		pq.pop();

		if(x == g){
			return cost;
		}
		if(min_cost [x].count(y) && cost >= min_cost [x] [y]) continue;
		min_cost [x] [y] = cost;

		for(auto&& it : edge [x] [y]){
			pq.push(state{it.x,it.y,cost + it.cost});
		}
	}

	return -1;
}

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

	cin >> N >> M;
	FOR(i,0,M){
		int p,q,c;
		cin >> p >> q >> c;
		edge [p] [c].push_back(state{q,c,0});
		edge [q] [c].push_back(state{p,c,0});
		edge [p] [0].push_back(state{p,c,1});
		edge [p] [c].push_back(state{p,0,0});
		edge [q] [0].push_back(state{q,c,1});
		edge [q] [c].push_back(state{q,0,0});
	}

	int ans = dijkstra(1,N);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 109824
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N, K);
  VEC(int, X, N);
  ll ans = 0;
  rep(i, 0, N) {
    ans += min(X[i], abs(X[i] - K)) * 2;
  }
  print(ans);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn=1e5+10;
char input[maxn];
int res[maxn];
int main()
{
	scanf("%s",input+1);;int n=strlen(input+1);
	for(int i=1;i<=n;i++) res[i]=0;
	int start=1;while(start<n)
	{
		int point=start;
		int l,r;
		while(true)
		{
			if(input[start]=='R'&&input[start+1]=='L')
				r=start,l=start+1;
			if(input[start]=='L'&&(start+1>n||input[start+1]=='R')) break;
			start+=1;
		}
		for(int i=point;i<=start;i++)
		{
			int tar,need;
			if(i<=r)
			{
				need=r-i;
				if(need%2) tar=l;
				else tar=r;
			}else if(i>=l)
			{
				need=i-l;
				if(need%2) tar=r;
				else tar=l;
			}
			res[tar]+=1;
		}
		start+=1;
	}
	for(int i=1;i<=n;i++) printf("%d ",res[i]);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  ll ans=LLINF;
  ll h,w;
  cin>>h>>w;
  if(h%3==0)ans=0;
  else chmin(ans,w);
  if(w%3==0)ans=0;
  else chmin(ans,h);
  for(ll i=0;i<=w;i++){
    ll a=h/2*i;
    ll b=(h+1)/2*i;
    ll c=h*(w-i);
    chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
  }
  for(ll i=0;i<=h;i++){
    ll a=w/2*i;
    ll b=(w+1)/2*i;
    ll c=w*(h-i);
    chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
  }
  cout<<ans<<endl;
  return(0);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <bitset>
#include <functional>
#include <set>
#include <map>
#include <array>

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
//#define int long long int
const int MOD = 1000000007;
const int INF = 1001001000;
const double EPS = 0.000000001;

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

bool pairCompare(const P& pair1, const P& pair2) {
    return pair1.second > pair2.second;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int r, d, x;
  cin >> r >> d >> x;
  REP(i, 10){
    x = r * x - d;
    cout << x << endl;
  }
  return 0;
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const int MAX = 1e5;

int main(){
    int q;
    cin >> q;
    vi l(q), r(q);
    rep(i, q) cin >> l[i] >> r[i];
    vi p(MAX+1, 1);
    p[0] = p[1] = 0;
    for (int i=2; i*i<=MAX; ++i) {
        if (p[i]==0) continue;
        for (int j=i*2; j<=MAX; j+=i) p[j] = 0;
    }
    vi a(MAX+1);
    rep1(i, MAX) if (p[i]==1 && p[(i+1)/2]==1) a[i] = 1;
    vi s(MAX+2);
    rep1(i, MAX) s[i+1] = s[i] + a[i];
    rep(i, q) cout << (s[r[i]+1]-s[l[i]]) << endl;
    return 0;
}


Measured memory_bytes: 5104
#include<bits/stdc++.h>
using namespace std;
int read(){
	int x = 0,f = 0;char ch = getchar();
	while(!isdigit(ch)) {if(ch=='-')f=1;ch=getchar();}
	while(isdigit(ch)) {x=x*10+ch-'0';ch=getchar();}
	return f?-x:x;
}
const int N = 2e6+100;
int c[N],g[N],f[N],a[N],n;
int gcd(int a,int b){
	if(b==0) return a;return gcd(b,a%b);
}
int main()
{
	n = read();
	for(int i = 1;i <= n;i++){
		a[i] = read();c[a[i]]++;
		g[i] = gcd(a[i],g[i-1]);
	}
	if(g[n] != 1){
		cout <<"not coprime"<<endl;
		return 0;
	}
	for(int i = 2;i <= 1e6;i++){
		int sum = 0;
		for(int j = i;j <= 1e6;j+=i) sum+=c[j];
		if(sum>=2) { cout<<"setwise coprime"<<endl; return 0; }
	}
	cout<<"pairwise coprime"<<endl;
	return 0;
}

Measured memory_bytes: 15288
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    s = 0
    for i in range(N):
        input_raw = read_func().strip().split()
        [x, u] = [float(input_raw[0]), (input_raw[1])]
        if u == "JPY":
            s += x
        else:
            s += x *380000.0
    print s




if __name__ == '__main__':
    main()


Measured memory_bytes: 2932
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair

int main(){
	while(true){
		int N;
		cin >> N;
		if(N == 0) break;
		int sum = 0;
		int A[10000];
		for(int i=0; i<N; i++){
			cin >> A[i];
			if(A[i] > 0) sum++;
		}
		int ans = INT_MAX;
		for(int i=0; i<N; i++){
			if(A[i] < 2) continue;
			ans = min(ans, sum+1);
		}
		if(ans == INT_MAX) cout << "NA" << endl;
		else cout << ans << endl;
	}
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int ball;
  int a=0;
  int b;
  int x;
  int sum=0;
   
  cin >> ball >>b;
  
  for (int i = 0; i < ball; i++) {
   cin >>x;
    if(b-x<=x){
     sum+=2*(b-x); 
    }else{
      sum+=2*x;
     }
  }
  cout <<sum <<endl;}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,A,B;
    cin >> N >> A >> B;
    if(A == B){
        print(1);
    }else if(A > B){
        print(0);
    }else{
        print(max(0LL, B * (N-2) - A*(N-2) + 1));
    }

    

}

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

int main(){
  int s_in,h,m,s;

  cin >> s_in;
  h = s_in / 3600;
  m = (s_in - 3600*h) / 60;
  s = s_in - 3600*h - 60*m;

  cout << h << ":" << m << ":" << s << endl;

  return 0;
}

Measured memory_bytes: 3072
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  string s;
  while(cin >> s,s!="-"){
    int n;
    cin >> n;
    int sum = 0;
    REP(i,n){
      int a;
      cin >> a;
      sum += a;
    }
    sum %= s.size();
    REP(i,s.size()){
      cout << s[(i+sum)%s.size()];
    }
    puts("");
  }
}


Measured memory_bytes: 3188
//author:luckYrat(twitter:@luckYrat_)

//#include <bits/stdc++.h>
//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
#define MOD 1000000007

#define pb push_back
#define fir first
#define scn second

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")



/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main() { 
  int X;cin>>X;
  //X = 100*N+A
  for(int i = 1; X/100>= i; i++){
    int t = X-100*i;
    if(0 <= t && t <= 5*i){
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
}




Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int n, h[100005], t, a, ans = 1;
double T[100005];
double Abs(double x) {
	return x < 0 ? -x : x;
}
int main() {
	scanf("%d%d%d", &n, &t, &a);
	for(int i = 1; i <= n; ++i) {
		scanf("%d", h+i);
		T[i] = Abs(t - h[i] * 0.006 - a);
		//printf("%lf ", T[i]);
	}
	for(int i = 2; i <= n; ++i) {
		if(T[i] < T[ans]) {
			ans = i;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func upperBound(list []int, n int) int {
	var l int = 0
	var r int = len(list) - 1
	for l <= r {
		var mid int = l + (r-l)/2
		if list[mid] <= n {
			l = mid + 1
		} else {
			r = mid - 1
		}
	}
	return l
}

// inputに時間かかりすぎてた
func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m, k int
	fmt.Fscan(r, &n, &m, &k)

	ruia := make([]int, n+1)
	ruib := make([]int, m+1)
	ruia[0] = 0
	ruib[0] = 0

	for i := 0; i < n; i++ {
		var tmp int
		fmt.Fscan(r, &tmp)
		ruia[i+1] = ruia[i] + tmp
	}

	for i := 0; i < m; i++ {
		var tmp int
		fmt.Fscan(r, &tmp)
		ruib[i+1] = ruib[i] + tmp
	}
	ans := 0
	// bj := m
	for i := 0; i < n+1; i++ {
		if ruia[i] > k {
			break
		}

		var bpos = upperBound(ruib, k-ruia[i])
		if bpos != 0 {
			bpos--
		}
		if i+bpos > ans {
			ans = i + bpos
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 8516
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>
#include <cmath>

int main(void){
    int n;
    std::cin >> n;
    std::set<int> d;

    for(int i = 0; i < n; i++){
        int x;
        std::cin >> x;
        d.insert(x);
    }

    std::cout << d.size();
    return 0;

}



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

long long N, M;
priority_queue<long long> Q;


int main(){
	cin >> N >> M;
	for(long long i = 0; i < N; i++){
		long long tmp;
		cin >> tmp;
		Q.push(tmp);
	}

	while(M){
		long long high = Q.top();
		Q.pop();
		Q.push(high/2);
		M--;
	}

	long long cost = 0;
	while(!Q.empty()){
		cost += Q.top();
		Q.pop();
	}
	cout << cost << endl;
}

Measured memory_bytes: 1400
#define _USE_MATH_DEFINES
#define INF 100000000
 
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
 
static const double EPS = 1e-8;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
int judge_ai_hand;
 
int path[11][11];
 
int main(){
	int N;
	while(~scanf("%d",&N)){
		for(int y=0;y<N;y++){
			string str;
			cin >> str;
			for(int x=0;x<N;x++){
				if(str[x]=='o') path[y+1][x+1] = 3;
				if(str[x]=='-') path[y+1][x+1] = 1;
				else path[y+1][x+1] = 0;
			}
			
		}
 
		int good_hand = 1;
		int max_score = 0;
		for(int i=1;i<=N;i++){
			int score = 0;
			for(int j=0;j<1000;j++){
				int ai = rand() % N + 1;
				score += path[i][ai];
			}
 
			if(score >= max_score){
				max_score = score;
				good_hand = i;
			}
 
		}
 
 
		int score = 0;
		int decade = 0;
 
		int freq[11];
		memset(freq,0,sizeof(freq));
		for(int i=0;i<1000;i++){
			if(i!=0 && i%50==0){
				if((decade/(i/50))*20 < 350){
					int maxv = 0;
					for(int j=1;j<=N;j++){
						for(int k=1;k<=N;k++){
							if(maxv < path[j][k]*freq[k]){
								maxv = path[j][k]*freq[k];
								good_hand = j;
							}
						}
					}
				}
				decade = 0;
			}
			printf("%d\n",good_hand); fflush(stdout);
			scanf("%d", &judge_ai_hand);
			score += path[good_hand][judge_ai_hand];
			decade += path[good_hand][judge_ai_hand];
			freq[judge_ai_hand]++;
		}
		break;
	}
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int A[21] = {0}, B[21] = {0}, C[21] = {0};
int main()
{
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> A[i];
  for (int i = 1; i <= N; i++) cin >> B[i];
  for (int i = 1; i <= N; i++) cin >> C[i];

  int satisfied = 0;
  for (int i = 1; i <= N; i++) {
    int eaten = A[i];
    satisfied += B[eaten];
    if (A[i-1]==eaten-1) {
      satisfied += C[eaten-1];
    }
  }
  cout << satisfied << endl;
}


Measured memory_bytes: 256
n = gets.chomp.to_i

if(n % 10 == 3 )
  read = "bon"
elsif(n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8)
  read = "pon"
else
  read = "hon"
end

puts read

Measured memory_bytes: 14252
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        int N;
        Map<Integer, Integer> card = new HashMap<>();

        void solve(InputReader in, PrintWriter out) {
            N = in.nextInt();
            for (int i = 0; i < N; ++i) {
                int a = in.nextInt();
                int v = card.containsKey(a) ? card.get(a) : 0;
                card.put(a, v + 1);
            }

            int evenCnt = 0;
            for (int v : card.values()) {
                if ((v & 1) == 0) evenCnt++;
            }

            out.println(evenCnt % 2 == 0 ? card.size() : card.size() - 1);
        }
    }


    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

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

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}

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

int main(){
  int a, b = 0;
  cin >> a >> b;

  int ans;
  ans = a*b;

  if(ans % 2 == 0){
    cout << "Even" << endl;
  }
  else{
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
N, M = map(int, input().split())

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
uf = UnionFind(N+1)

for m in range(M):
  a, b = map(int, input().split())
  uf.union(a, b)
  
print(len(uf.roots()) - 1 - 1)


Measured memory_bytes: 12912