akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define time_taken_start int begtime = clock();
#define time_taken_end int endtime = clock(); \
cerr << "\n\n" << "Time elapsed: " << \
(endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
return 0;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.0000000001
#define pi acosl(-1)
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define mseti multiset <ll>
#define msetd multiset <ll,greater<ll>>
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound 
#define stp fixed<<setprecision(20)
#define endl '\n'
ll a[24][24];
ll b[24][24];
ll h,w;
ll ma;
queue<pll> q;
void fill()
{
	for(ll i=0;i<=22;i++)
	{
		for(ll j=0;j<=22;j++)
		{
			b[i][j]=a[i][j];
		}
	}
}
void ins(ll x,ll y)
{
	ll dx[4]={1,0,-1,0};
	ll dy[4]={0,1,0,-1};
	for(ll i=0;i<4;i++)
	{
		ll c=x+dx[i];
		ll d=y+dy[i];
		if(b[c][d]==0)
		{
			q.push({c,d});
			b[c][d]=b[x][y]+1;
			ma=max(ma,b[c][d]-1);
		}
	}
}
void check()
{
	while(!(q.empty()))
	{
		pll p=q.front();
		q.pop();
		ins(p.ff,p.ss);
	}
}
int main()
{
	FAST
	#ifdef ayk_16
	freopen("input.txt","rt",stdin);
	freopen("output.txt","wt",stdout);
	#endif
	cin>>h>>w;
	string s;
	for(ll i=0;i<24;i++)
	{
		for(ll j=0;j<24;j++)
		{
			a[i][j]=-1;
		}
	}
	for(ll i=0;i<h;i++)
	{
		cin>>s;
		for(ll j=0;j<w;j++)
		{
			if(s[j]=='.')
				a[i+1][j+1]=0;
		}
	}
	for(ll i=1;i<=h;i++)
	{
		for(ll j=1;j<=w;j++)
		{
			if(b[i][j]==-1)
				continue;
			fill();
			b[i][j]=1;
			q.push({i,j});
			check();
		}
	}
	cout<<ma<<endl;
}

Measured memory_bytes: 256
def ispalindrome(n):
	ok=True
	n=str(n)
	ok=(n[4]==n[0]) and (n[3]==n[1])
	return ok

a,b=map(int,input().split())
cnt=0
for i in range(a,b+1):
	if ispalindrome(i):
		cnt+=1
print(cnt)



Measured memory_bytes: 2940
from collections import deque
n, m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]

q = deque([])
path = [-1] * n
ver = [[] for _ in range(n)]
for i in range(m):
    ab[i].sort()
    if ab[i][0] == 1:
        q.append([ab[i][0]-1,ab[i][1]-1])
        #path[ab[i][1]-1] = 1
    ver[ab[i][0]-1].append(ab[i][1]-1)
    ver[ab[i][1]-1].append(ab[i][0]-1)

def bfs(q, visited_list):
    while len(q) > 0:
        now = q.popleft()
        go = now[1]
        if visited_list[go] == -1:
            visited_list[go] = now[0]+1
            for i in range(len(ver[go])):
                q.append([go,ver[go][i]])
    return visited_list
ans = bfs(q,path)
print('Yes')
for i in range(1,n):
    print(ans[i])

Measured memory_bytes: 102452
N,P= map(int, input().split())
A= list(map(int, input().split()))
A = [A[i] % 2 for i in range(N)] 
even = A.count(0)
odd = A.count(1)

anseven = 1
ansodd = 1

dic = {0:1}
for i in range(1, 51):
    dic[i] = dic[i - 1] * i

#  偶数i個選ぶ
for i in range(1, even + 1):
    anseven += dic[even] // dic[even - i] // dic[i]

if P == 0:
    #  奇数i個選ぶ
    for i in range(2, odd + 1, 2):
        ansodd += dic[odd] // dic[odd - i] // dic[i]

else:
    if odd == 0:
        print(0)
        exit()
    ansodd = 0
    #  奇数i個選ぶ
    for i in range(1, odd + 1, 2):
        ansodd += dic[odd] // dic[odd - i] // dic[i]

print(anseven * ansodd)

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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

#define MOD 1000000007

using ll = long long;
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<P> vpi;


int main() {
    ll n,ans = 0,num = 0;
    cin >> n;
    vi a(n);
    rep(i,n) cin >> a[i];

    if(n%2 == 0) {
        repr(i,n/2) cout << a[i*2+1] << " ";
        rep(i,n/2) cout << a[i*2] << " ";
    } else {
        repr(i,n/2+1) cout << a[i*2] << " ";
        rep(i,n/2) cout << a[i*2+1] << " ";
    }
    
    //printf("%.15lf", ans);
    cout << "\n";
    return 0;
}


Measured memory_bytes: 3980
#include <bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#define N 105
using namespace __gnu_pbds;
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
LL z = 1;
int read(){
	int x, f = 1;
	char ch;
	while(ch = getchar(), ch < '0' || ch > '9') if(ch == '-') f = -1;
	x = ch - '0';
	while(ch = getchar(), ch >= '0' && ch <= '9') x = x * 10 + ch - 48;
	return x * f;
}
int ksm(int a, int b, int p){
	int s = 1;
	while(b){
		if(b & 1) s = z * s * a % p;
		a = z * a * a % p;
		b >>= 1;
	}
	return s;
}
int a[N];
int main(){
	int i, j, n, m;
	n = read(); m = read();
	printf("%d", n - m + 1);
	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DRestoringRoadNetwork solver = new DRestoringRoadNetwork();
        solver.solve(1, in, out);
        out.close();
    }

    static class DRestoringRoadNetwork {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[][] d = new long[n][n];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    d[i][j] = in.nextLong();
                }
            }

            long res = 0;
            // 各辺が必要かどうかの判断
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    boolean valid = true;
                    boolean need = true;
                    for (int k = 0; k < n; k++) {
                        if (k == i || k == j) continue;
                        if (d[i][k] + d[k][j] < d[i][j]) {
                            valid = false;
                            break;
                        }
                        if (d[i][k] + d[k][j] == d[i][j]) {
                            need = false;
                        }
                    }
                    if (!valid) {
                        out.println(-1);
                        return;
                    }
                    if (need) res += d[i][j];
                }
            }
            out.println(res);

        }

    }
}



Measured memory_bytes: 60992
# coding: utf-8
# Your code here!
N,M = map(int,input().split())
lst = [i for i in range(N)]

def root(n):
    if n == lst[n]:
        return n
    lst[n] = root(lst[n])
    return lst[n]

def union(x,y):
    rootX, rootY = root(x), root(y)
    if rootX != rootY:
        if rootX > rootY:
            lst[rootX] = rootY
        if rootY > rootX:
            lst[rootY] = rootX

for i in range(M):
    X,Y,Z = map(int,input().split())
    X -= 1
    Y -= 1
    union(X, Y)

ans = len([i for i in range(N) if root(i) == i])
print(ans)



Measured memory_bytes: 11032
#include<iostream>
#include<vector>
#include<cstdlib>
#include <cmath>
#define INF 100000000
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; }

using namespace std;

int x=0,y=0,flag=1,t=0;

int main(){
  int i,j,k,n,d,a,b,c;
  cin >> n;
  for(i=0;i<n;i++){
    cin >>a>>b>>c;
    d=abs(b-x)+abs(c-y);
    if((a-t)>=d){
      if(((a-t)-d)%2==0){
	t=a;
	x=b;
	y=c;
	continue;
      }
      else flag=0;
    }
    else flag=0;

  }
  if(flag)cout << "Yes"<<endl;
  else cout <<"No"<<endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  char s[50];
  int d[5],n,c,i,r;
  int m12=365*13+4-11;
  int d400=365*400+100-4+1;
  int d100=365*100+25 -1;
  int d4  =365*4  +1;
  int a[5];
  int M[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
  unsigned long long dt,t;
  while(scanf("%s",s),s[0]-'#'){
    for(i=c=n=r=0;s[i];i++){
      if(s[i]=='.'){
	c++;
	d[r++]=n;
	n=0;
      }
      else{
	n*=10;
	n+=s[i]-'0';
      }
    }
    d[r]=n;
    dt=0;//-m12;
    if(c==2){
      //printf("%d %d %d\n",d[0],d[1],d[2]);
      for(i=1;i<d[1];i++)dt+=M[i];
      if(d[1]>2&&d[0]%4==0&&(d[0]%100||d[0]%400==0))dt++;
      dt+=(unsigned long long)d[2]-1;
      d[0]-=2001;
      dt+=(unsigned long long)365*d[0]+d[0]/4-d[0]/100+d[0]/400+366-m12;
      //printf("%d\n",m12);
      a[4]=dt%20;
      dt/=20;
      a[3]=dt%18;
      dt/=18;
      a[2]=dt%20;
      dt/=20;
      a[1]=dt%20;
      dt/=20;
      a[0]=dt%13;
      printf("%d.%d.%d.%d.%d\n",a[0],a[1],a[2],a[3],a[4]);      
    }
    else{
      dt=d[0];
      dt=dt*20+d[1];
      dt=dt*20+d[2];
      dt=dt*18+d[3];
      dt=dt*20+d[4];
      dt+=4738+1;
      for(a[0]=2000;dt>365;a[0]++){
	t=dt;
	dt-=365;
	if(a[0]%4==0&&(a[0]%100||a[0]%400==0))dt--;
      }
      if(dt==0){
	dt=t;
	a[0]--;
      }
      /*a[0] =(dt/d400)*400;
      dt%d400;
      a[0]+=(dt/d100)*100;
      dt%=d100;
      a[0]+=(dt/d4  )*4  ;
      dt%=d4  ;
      a[0]+=(dt/365);
      dt%=365;//*/
      //if(59>dt&&a[0]%4==0&&(a[0]%100||a[0]%400==0))dt++;
      for(i=1;i<13;i++){
	if(dt<=M[i])break;
	dt-=M[i];
	if(i==2&&a[0]%4==0&&(a[0]%100||a[0]%400==0)){
	  dt--;
	  if(dt==0){
	    dt=29;
	    break;
	  }
	}
      }
      printf("%d.%d.%lld\n",a[0],i,dt);
    }
  }
  return 0;
}

Measured memory_bytes: 536
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;

int main() {
	int case_id=0;
	while (true) {
		case_id++;
		ld dif;cin>>dif;
		if(dif<1e-9)break;
		ld pi=acos(-1.0);
		for (int i = 1; i < 1e7; ++i) {
			ld num=i*pi;
			int up=int(num)+1;
			int down=int(num);
			if (abs(ld(up)/i - pi) < dif) {
				cout<<up<<"/"<<i<<endl;
				break;
			}
			else if (abs(ld(down)/i - pi) < dif) {
				cout<<down<<"/"<<i<<endl;
				break;
			}
		}
	}
	
	return 0;
}


Measured memory_bytes: 3220
#include <cmath>
#include <cstdlib>
#include <iostream>
using namespace std;

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

	for(int n; cin >> n, n;) {
		int ans = 0;
		for(int a = 0; a * a <= n; ++a) {
			for(int b = a; b * b <= n; ++b) {
				for(int c = b; c * c <= n; ++c) {
					const int d2 = n - a * a - b * b - c * c;
					if(d2 < 0)
						continue;

					const int d = (int)sqrt(d2);
					if(c <= d && d * d == d2)
						++ans;
				}
			}
		}

		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define for1(a,b,i) for(int i=a;i<=b;++i)
#define FOR2(a,b,i) for(int i=a;i>=b;--i)
using namespace std;
typedef long long ll;

#define M 2005
int n;
char s[M];
int a[M][M],f[M][M],l[M][M],r[M][M];

int main () {
//freopen("a.in","r",stdin);
//freopen("zj.out","w",stdout);
	scanf("%d",&n);
	for1(1,n,i) {
		scanf("%s",s+1);
		for1(1,n,j) a[i][j]= s[j]=='#'?0:s[j]-'0';
	}
	
	ll ans=0;
	FOR2(n,1,i) FOR2(n,1,j) { 
		if(a[i][j]) {
			bool t[2]={a[i+1][j],a[i][j+1]};
			if(!(t[0]|t[1])) {
				l[i][j]=r[i][j]=j;
				for1(i+1,n,k) l[k][j]=n+1,r[k][j]=0;
			}
			else if(t[0]&&!t[1]) {
				l[i][j]=r[i][j]=j;
				f[i][j]=f[i+1][j];
			}
			else if(!t[0]&&t[1]) {
				f[i][j]=f[i][j+1];
				l[i][j]=j,r[i][j]=r[i][j+1];
				for1(i+1,n,k) l[k][j]=l[k][j+1],r[k][j]=r[k][j+1];
			}
			else {
				int tot=f[i+1][j]+f[i][j+1];
				l[i][j]=j,r[i][j]=r[i][j+1];
				
				int las_r=0;		
				for1(i+1,n,k) {
					if(l[k][j+1]>r[k][j+1]) break;
					if(l[k][j+1]<=r[k][j]&&l[k][j+1]>las_r) tot-=f[k][l[k][j+1]];
					las_r=r[k][j];
					l[k][j]=min(l[k][j],l[k][j+1]);
					r[k][j]=max(r[k][j],r[k][j+1]);
				}
				f[i][j]=tot;
			}
		}
		else l[i][j]=n+1,r[i][j]=0;
		ans+=a[i][j]*f[i][j];
		f[i][j]+=a[i][j];
	}
	cout<<ans<<endl;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

#define INF 1<<25
#define MAX_V 100010

// graph by adjacency list
struct Edge {
  int dst, weight;
  Edge(int dst, int weight) :
    dst(dst), weight(weight) { }
  bool operator < (const Edge &e) const {
    return weight > e.weight;
  }
};

struct Graph {
  int V;
  std::vector<Edge> E[MAX_V];

  Graph(int V) : V(V) { }

  void add_edge(int src, int dst, int weight) {
    E[src].push_back(Edge(dst, weight));
  }
};

struct Node {
  int v, dist;
  Node(int v, int dist) :
    v(v), dist(dist) { };
  bool operator < (const Node &n) const {
    return dist > n.dist; // reverse
  }
};

struct ShortestPath {
  const Graph g;
  int start;
  int dist[MAX_V], prev[MAX_V];

  ShortestPath(const Graph g, int start) :
    g(g), start(start) { }

  void dijkstra() {
    std::priority_queue<Node> que;
    std::fill(dist, dist + g.V, INF);
    dist[start] = 0;
    que.push(Node(start, 0));
    prev[0] = -1;

    while (!que.empty()) {
      Node n = que.top(); que.pop();
      int v = n.v, cost = n.dist;
      if (dist[v] < cost) continue;
      for (Edge e : g.E[v]) {
	if (dist[v] + e.weight < dist[e.dst]) {
	  dist[e.dst] = dist[v] + e.weight;
	  prev[e.dst] = v;
	  que.push(Node(e.dst, dist[e.dst]));
	}
      }
    }
  }

  std::vector<int> build_path(int goal) {
    std::vector<int> path;
    for (int v = goal; v != -1; v = prev[v]) {
      path.push_back(v);
    }
    std::reverse(path.begin(), path.end());
    return path;
  }
};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  int N;
  cin >> N;
  Graph g(N);
  REP(i, N) {
    int p;
    cin >> p;
    if (p) {
      g.add_edge(i, i+p, 0);
    } else {
      FOR(j, 1, 7) g.add_edge(i, i+j, 1);
    }
  }
  ShortestPath sp(g, 0);
  sp.dijkstra();
  cout << sp.dist[N-1] << endl;
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	if(n == 1){
		cout << 'a' << endl; return 0;
	}
	vector<char> a = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
	vector<int> ans(n);
	vector<int> w(n);
	rep(i, n) w[i] = i;
	do {
		rep(i, n) {
			cout << a[ans[i]];
		}
		cout << endl;
		
		
		int k = 1;
		
		while(1) {
			int mx = -1;
			rep(i, n-k) {
				mx = max(mx, ans[i]);
			}
			if(ans[n-k] <= mx) {
				ans[n-k]++;
				break;
			} else {
				ans[n-k] = 0;
				k++;
			}
		}
	}while(ans != w);
	rep(i, n) {
			cout << a[ans[i]];
		}
		cout << endl;
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b){ return a ? GCD(b % a, a) : b; }
int main(){
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes"; 
    else cout<<"No";

}

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

int main(){
  
  int N, M;
  cin >> N >> M;
  map<int, int> likeCounts;
  for (int i = 0; i < N; i++) {
    int K;
    cin >> K;
    for (int j = 0; j < K; j++) {
      int A;
      cin >> A;
      likeCounts[A]++;
    }
  }

  int ans = 0;
  for (auto count : likeCounts) {
    if(count.second==N) ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

class UnionFind {
public:
    vl parent;  // 親ノード
    vl Siz;  // 集合の大きさ
    
    // コンストラクタ
    UnionFind(ll n): parent(n), Siz(n, 1) {
        rep(i, n) {
            parent[i] = i;
        }
    }

    // n要素で初期化
    void init(ll n) {
        parent.resize(n);
        Siz.assign(n, 1);
        rep(i, n) {
            parent[i] = i;
        }
    }

    // xの属する集合の根を求める
    ll root(ll x) {
        if(parent[x] == x) {
            return x;
        }
        else {
            return parent[x] = root(parent[x]);
        }
    }

    // xとyの属する集合を併合
    void unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if(x == y) {
            return;
        }
        if(Siz[x] < Siz[y]) {
            swap(x, y);
        }
        Siz[x] += Siz[y];
        parent[y] = x;
    }
    
    // xとyが同じ集合に属するかどうか
    bool same(ll x, ll y) {
        return root(x) == root(y);
    }

    // xの属する集合の要素数を求める
    ll size(ll x) {
        return Siz[root(x)];
    }
};

int main() {
    ll n, m;
    cin >> n >> m;

    vl a(m), b(m);
    rep(i, m) {
        cin >> a[i] >> b[i];
        a[i]--;  b[i]--;
    }

    UnionFind Uni(n);
    Uni.init(n);

    vl ans(m+1);
    ans[m] = n*(n-1)/2;
    for(ll i = m-1; i >= 0; i--) {
        ans[i] = ans[i+1];
        if(Uni.root(a[i]) != Uni.root(b[i])) {
            ans[i] -= Uni.size(a[i])*Uni.size(b[i]);
            Uni.unite(a[i], b[i]);
        }
    }
    
    exrep(i, 1, m) {
        out(ans[i]);
    }

    re0;
}

Measured memory_bytes: 5248
// This code writed by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
#define int long long
using namespace std;
const int MaxN=200050;
template <class t> inline void rd(t &s)
{
	s=0;
	reg char c=getchar();
	while(!isdigit(c))
		c=getchar();
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	return;
}
int n,k,q;
int chtholly[MaxN];
signed main(void)
{
    ios::sync_with_stdio(0);cin.tie(0);
    reg int p;
	cin>>n>>k>>q;
	for(int i=1;i<=q;++i)
	{
		cin>>p;
		++chtholly[p];
	}
	for(int i=1;i<=n;++i)
		if(chtholly[i]+k-q<=0)
			cout<<"No"<<endl;
		else
			cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 1408
import java.util.Arrays;
import java.util.BitSet;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			int M = sc.nextInt();
			Log[] logs = new Log[M];
			for (int i = 0; i < M; ++i) {
				int t = sc.nextInt();
				int s = sc.nextInt() - 1;
				int d = sc.nextInt() - 1;
				logs[i] = new Log(t, s, d);
			}
			Arrays.sort(logs);
			BitSet v = new BitSet(N);
			v.set(0);
			for (int i = 0; i < M; ++i) {
				if (v.get(logs[i].s)) v.set(logs[i].d);
			}
			System.out.println(v.cardinality());
		}
	}

	static class Log implements Comparable<Log> {
		int t, s, d;

		public Log(int t, int s, int d) {
			this.t = t;
			this.s = s;
			this.d = d;
		}

		public int compareTo(Log o) {
			return this.t - o.t;
		}
	}
}

Measured memory_bytes: 169624
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
#define all(obj) obj.begin(), obj.end()
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);

// 比較+dpテーブル更新　最大問題
// 更新する方の参照をaに渡すこと.
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
// 比較+dpテーブル更新 最小問題
// 更新する方の参照をaに渡すこと.　
// 最小問題なので, 更新される側にある数字が比較されてる数字よりも大きければ更新する.こうすることで, 常に小さいものが選ばれていく.
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;

using namespace std;

typedef unsigned long long ull;
typedef int long long ll;
constexpr ll bigNum = 1000000007;

// 入力
long long h[100010];

// DP テーブル
long long dpTable[100010];

signed main()
{
    fast;
    int N;
    cin >> N;

    REP(i, N)
    cin >> h[i];

    REP(i, N)
    dpTable[i] = INF;

    dpTable[0] = 0;

    for (int i = 1; i < N; i++)
    {
        // chminは比較と更新の二つを行うのでここはこのように連続して描いてしまっても問題ない
        if (i > 1)
        {
            chmin(dpTable[i], dpTable[i - 2] + abs(h[i] - h[i - 2]));
        }
        chmin(dpTable[i], dpTable[i - 1] + abs(h[i] - h[i - 1]));
    }
    cout << dpTable[N - 1] << endl;
}


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

struct Stack{
    ll table[1000];
    ll top;
    
    void init(){
        top = 0;
    }
    
    bool isEmpty(){
        return top==0;
    }
    
    bool isFull(){
        return top >= 999;
    }
    
    void push(ll x){
        top++;
        table[top] = x;
    }
    
    ll pop(){
        if (isEmpty()) return 0;
        top--;
        return table[top+1];
    }
};

int main(){
    ll x;
    char s[100];
    Stack stack;
    ll numA, numB;
    
    stack.init();
    
    while (scanf("%s", s) != EOF) {
        if (s[0] == '+'){
            numA = stack.pop();
            numB = stack.pop();
            stack.push(numA+numB);
        }else if (s[0] == '-'){
            numA = stack.pop();
            numB = stack.pop();
            stack.push(numB-numA);
        }else if (s[0] == '*'){
            numA = stack.pop();
            numB = stack.pop();
            stack.push(numA*numB);
        }else {
            x = atoi(s);
            stack.push(x);
        }
    }
    
    cout << stack.pop() << endl;
    return 0;
    
}


Measured memory_bytes: 3216
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  ll n,ans=0;
  cin >> n;
  for(int i=1;i<=n;i++){
    ans += 800;
    if(i%15==0) ans -= 200;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>

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


int main() {

	int A, B, C;

	scanf("%d%d%d", &A, &B, &C);

	vector<int> vec;
	vec.push_back(A);
	vec.push_back(B);
	vec.push_back(C);

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

	printf("%d\n", vec[2] * 10 + vec[1] + vec[0]);

	return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        int q = 1;
        int input = int.Parse(Console.ReadLine());
        while (input!= 0)
        { 
            Console.WriteLine("Case " + q + ": " + input);
            q++;
            input = int.Parse(Console.ReadLine());

        }
        
    }
}


Measured memory_bytes: 15964
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){

			final String inputLine = br.readLine();
			final String[] inputNumbers = inputLine.split(" ");

			final Integer a = Integer.valueOf(inputNumbers[0]);
			final Integer b = Integer.valueOf(inputNumbers[1]);

			final Integer d = a / b;
			final Integer r = a % b;
			final Double f = a.doubleValue() / b.doubleValue();

			System.out.format("%d %d %.5f\n", d, r, f);
		}
	}
}



Measured memory_bytes: 24728
// B - Minimum Sum

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int a[200000];
int pos[200001];

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

	for (int i=0; i<N; i++) {
		cin >> a[i];
		pos[a[i]] = i; // a[i]の位置を記録
	}

	ll ans = 0;
	set<int> pos_set;
	for (int i=1; i<=N; i++) {
		int k = pos[i];

		ll l, r;
		auto itr = pos_set.lower_bound(k);

		if (itr == pos_set.end()) {
			r = N - 1;
		} else {
			r = *itr - 1;
		}

		if (itr == pos_set.begin()) {
			l = 0;
		} else {
			itr--;
			l = *itr + 1;
		}

		// cout << l << " " << k << " " << r << endl; // **** debug ****

		ans += i * (k - l + 1) * (r - k + 1); // i * (minがiとなる選び方の数)

		pos_set.insert(k);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <string>
#include <map>
#include <list>
using namespace std;

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

  int A=0,B=0,C=0;
  char now='a';
  for(int i = 0; i < (int)a.size() + (int)b.size() + (int)c.size(); ++i){
    if(now == 'a'){
      if(A == (int)a.size()){
        cout << 'A' << endl;
        break;
      }
      now = a[A];
      A++;
      continue;
    }
    if(now == 'b'){
      if(B == (int)b.size()){
        cout << 'B' << endl;
        break;
      }
      now = b[B];
      B++;
      continue;
    }
    if(now == 'c'){
      if(C == (int)c.size()){
        cout << 'C' << endl;
        break;
      }
      now = c[C];
      C++;
      continue;
    }
  }
}



Measured memory_bytes: 3636
#include <stdio.h>

int main()
{   int n;
    char a[101],b[101],c[101];
    scanf("%d",&n);
    scanf("%s",a);
    scanf("%s",b);
    scanf("%s",c);
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]==b[i]&&b[i]==c[i]){
            continue;
        }else if((a[i]==b[i]&&b[i]!=c[i])||(a[i]==c[i]&&a[i]!=b[i])||(b[i]==c[i]&&a[i]!=c[i])){
            ans+=1;
        }else{
            ans+=2;
        }
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    // Your code here!
  int a,b;
  string op;
  while(1){
    cin>>a>>op>>b;
    if(op=="?"){
      break;
    }
    if(op=="+"){
      cout<<a+b<<endl;
    }
    if(op=="-"){
      cout<<a-b<<endl;
    }
    if(op=="*"){
      cout<<a*b<<endl;
    }
    if(op=="/"){
      cout<<a/b<<endl;
    }
  }
}  




Measured memory_bytes: 3120
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;
typedef long long ll;

int main() {
    vector<int> num;
    string S;
    cin >> S;
    for(int i=0;i<S.size();i++){
        num.push_back((int)(S[i]-'0'));
    }
    int temp;
    int mi=100000;
    for(int i=0;i<S.size()-2;i++){
        temp=100*num[i]+10*num[i+1]+num[i+2];
        mi=min(mi,abs(temp-753));
    }
    cout << mi << endl;
}

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

L=list(map(int,input().split()))
S=[0]*110000
for i in range(N):
    S[i]=L[i]

DP=[10**12]*110000

DP[0]=0
for i in range(N):
    for j in range(1,M+1):
        if DP[i+j]>DP[i]+abs(S[i+j]-S[i]):
            DP[i+j]=DP[i]+abs(S[i+j]-S[i])



print(DP[N-1])

            

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

bool palin(string s)
{
    int n=s.length();
    for(int i=0;i<=n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        return false;
        
    }
    return true;
}

int main() {
	// your code goes here
	string s;
	cin>>s;
	if(!palin(s))
	cout<<"No";
	else if(!palin( s.substr( 0,(s.length()-1)/2) ) )
	cout<<"No";
	else if(!palin( s.substr((s.length()+3)/2-1) ))
	cout<<"No";
	else
	cout<<"Yes";
	
	return 0;
}


Measured memory_bytes: 256
//abc101_c.cpp
//Sat Jun 23 20:52:57 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
using ll=long long;


int main(){
	int n,k;
	cin >> n >> k;

	int a[n];
	int minpos = 0;
	for (int i=0;i<n;i++){
		cin >> a[i];
		if (a[i] == 1){
			minpos = i+1;
		}
	}
	int latterstart = minpos;
	int x = (minpos-1)%(k-1);
	if (x == 0){
		latterstart = minpos-(k-1);
	}else {
		latterstart = minpos-x;
	}
	int ans = (latterstart-1)/(k-1) + (n-latterstart)/(k-1);

	if ((n-latterstart)%(k-1) != 0){
		ans++;
	}


	cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  int S,W;
  cin >> S >> W;
  if(S<=W){
    cout << "unsafe" << endl;
  }
  else{
    cout << "safe" << endl;
  }
  return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i <= n / 4; i++) {
        for (int j = 0; j <= n / 7; j++) {
            if (4 * i + 7 * j == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

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

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string a,b; cin>>a>>b;
	int ans=0;
	For(i,0,2) if(a[i]==b[i]) ans++;
	cout<<ans<<"\n";
	return 0;
}





























Measured memory_bytes: 256
n = int(input())
S = [input() for i in range(n)]

counter = [{} for i in range(n)]
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'

for i in range(n):
    for alphabet in ascii_lowercase:
        counter[i][alphabet] = S[i].count(alphabet)

tmp = {}
for alphabet in ascii_lowercase:
    tmp[alphabet] = 99999999

for alphabet in ascii_lowercase:
    for i in counter:
        tmp[alphabet] = min(tmp[alphabet], i[alphabet])

tmp = sorted(tmp.items(), key=lambda x:x[0])
for i in tmp:
    for j in range(0,i[1]):
        print(i[0], end="")

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<list>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {1, 1, 0, -1, -1, 0};
int dx[] = {1, 0, -1, -1, 0, 1};
#define ceil(a, b) a / b + !!(a % b)

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int tmp = 0;
    int i = 0;
    while (1) {
        i++;
        tmp += a;
        if (i % 7 == 0) tmp += b;
        if (tmp >= c) break;
    }
    cout << i << endl;
}



Measured memory_bytes: 3100
A = [None for i in range(101)]  # 1 ~ 100まで
row = [None, 0, 0, 0]
col = [None, 0, 0, 0]
cross = [None, 0, None, 0]
is_bingo = False


def solve(n):
    global is_bingo
    if is_bingo:
        return
    # 保存場所の取得
    if A[n] is None:
        return
    idx = int(A[n])
    i = int(idx / 10)
    j = int(idx % 10)
    row[i] += 1
    col[j] += 1
    if i == j and i + j == 4:
        cross[1] += 1
        cross[3] += 1
    elif i == j and i + j != 4:
        cross[1] += 1
    elif i != j and i + j == 4:
        cross[3] += 1

    if row[i] == 3 or col[j] == 3 or cross[1] == 3 or cross[3] == 3:
        is_bingo = True


# main
if __name__ == '__main__':
    idx = [int(i) for i in input().split(' ')]
    A[idx[0]] = '11'
    A[idx[1]] = '12'
    A[idx[2]] = '13'
    idx = [int(i) for i in input().split(' ')]
    A[idx[0]] = '21'
    A[idx[1]] = '22'
    A[idx[2]] = '23'
    idx = [int(i) for i in input().split(' ')]
    A[idx[0]] = '31'
    A[idx[1]] = '32'
    A[idx[2]] = '33'
    n = int(input())
    for i in range(0, n):
        solve(int(input()))
    if is_bingo:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
  
/*------------------------------------------------------------------*/
int main(void){
    int n; cin >> n;
    int count = 0;
    vector<int> sei(n + 1, -1);
    int num = 0;
    int l = 0;
    int r = n;
    while(count <= 20){
        if(count > 0){
            num = (l + r) / 2;
        }
        cout << num << endl;
        cout.flush();

        string s; cin >> s;

        if(s == "Vacant") return 0; 
        if(s == "Male") sei[num] = 0;
        else sei[num] = 1;

        if(count == 0){
            count++;
            num = n - 1;
            continue;
        }
        
        if((num - l) % 2 == 0){
            if(sei[num] == sei[l]){
                l = num;
            }else{
                r = num;
            }
        }else{
            if(sei[num] == sei[l]){
                r = num;
            }else{
                l = num;
            }
        }
        count++;
    }
}

Measured memory_bytes: 1236
#pragma GCC optimize ("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define FORD(i, a, b) for (int i=(a); i>(b); i--)
#define PPC(x) __builtin_popcount(x)
#define MSB(x) (31 - __builtin_clz(x))
#define SZ(x) ((int)(x).size())
#define BACK(x) prev((x).end())
#define HASK(x, y) ((x).find(y) != (x).end())
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#define kw(a) ((a) * (a))
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;
 
const int maxN = 1 << 19;
const long long INF = 1000000000000ll;
const long double E = 1e-11;
 
int T[maxN], lck[maxN];
 
void solve()
{
	long long a, b, k;
	scanf ("%lld%lld%lld", &a, &b, &k);
	long long dx = min(a, k);
	a -= dx, k -= dx;
	dx = min(b, k);
	b -= dx, k -= dx;
	printf("%lld %lld\n", a, b);
}			
 
int main()
{
	int t = 1;
	//scanf ("%d", &t);
	FOR(tid, 1, t+1)
	{
		//printf("Case #%d: ", tid);
		solve();
	}
	return 0;
}
 


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

int n,m,q;
vector<int> a,b,c,d;
int ans = 0;

void dfs(vector<int> A){
  if(A.size() == n+1){
    int point = 0;
    for(int i = 0; i < q; i++){
      if(A[b[i]] - A[a[i]] == c[i]) point += d[i];
    }
    ans = max(ans, point);
    return;
  }
  A.push_back(A.back());
  while( A.back() <= m){
    dfs(A);
    A.back()++;
  }
}

int main(){
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q);
  for(int i = 0; i < q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
  vector<int> x;
  x.push_back(1);
  dfs(x);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
int main(){
	string s;
	cin>>s;
	bool a,b,c;
	for(int i=0;i<s.size();i++){
		if(s[0]!=s[1]&&s[1]!=s[2]&&s[0]!=s[2]){
			if(s[i]=='a'){
				a=true;
			}
			if(s[i]=='b'){
				b=true;
			}
			if(s[i]=='c'){
				c=true;
			}
		}
		else{
			cout<<"No"<<endl;
			return 0;
		}
	}
	if(a&&b&&c){
		cout<<"Yes"<<endl;
		return 0;
	}
	else {
		cout<<"No"<<endl;
		return 0;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
using namespace std;
int main(void){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> a(m);
    for(int i = 0;i < m;i++){
          int k;
          cin >> k;
          a[i].resize(k);
          for(int j = 0;j < k;j++){
                cin >> a[i][j];
                a[i][j]--;
          }
    }
    vector<int> p(m);
    for(int i = 0;i < m;i++){
          cin >> p[i];
    }
    int ans = 0;
    for(int i = 0;i < 1 << n;i++){
          bool ok = true;
          for(int j = 0;j < m;j++){
                int c = 0;
                for(int id:a[j]){
                      if(i >> id & 1){
                            c++;
                      }
                }
                if(c % 2 != p[j])ok = false;
          }
          if(ok)ans++;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3624
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	long long n, k;
	cin >> n >> k;
	long long ans = n / k;
	ans = ans * ans * ans;
	if(k % 2 == 0) {
		long long cnt = n / k;
		if(n % k >= k / 2) cnt++;
		ans += cnt*cnt*cnt;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 384
import sys
if __name__ == "__main__":
    N, X = list(map(int, (input().split(' '))))
    M = []
    rest = X
    cnt = 0
    for i in range(N):
        buf = int(input())
        M.append(buf)
        rest -= buf
        cnt += 1
    min_cost = min(M)
    rest_cnt = rest // min_cost
    cnt += rest_cnt
    print(cnt)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<string>
#define pii pair<int, int>
#define mp make_pair
#define ll long long
#define ld long double
#define pb push_back
#define S second
#define F first
using namespace std;

int fun(int n) {
	int ret = 0;
	while (n != 0) {
		ret++;
		n = n % __builtin_popcount(n);
	}

	return ret;
}

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

	int n;
	cin >> n;
	string str;
	cin >> str;
	int a[n + 3] = {0};
	for (int i = 0; i < n + 3; i++) {
		a[i] = fun(i);
	}

	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (str[i] == '1') cnt++;
	}

	

	vector<int> v1;
	int s1 = 0, s2 = 0;
	int temp = 1;
	for (int i = 0; i < n; i++) {
		v1.pb(temp % (cnt + 1));
		if (str[n - 1 - i] == '1') {
			s1 = (s1 + temp) % (cnt + 1);
		}
		temp = (temp * 2) % (cnt + 1);
	}

	reverse(v1.begin(), v1.end());
	vector<int> v2;
	if (cnt >= 2) {
		temp = 1;
		for (int i = 0; i < n; i++) {
			v2.pb(temp % (cnt - 1));
			if (str[n - 1 - i] == '1') {
				s2 = (s2 + temp) % (cnt - 1);
			}
			temp = (temp * 2) % (cnt - 1);
		}
		reverse(v2.begin(), v2.end());
	}

	vector<int> ans;
	for (int i = 0; i < n; i++) {
		if (str[i] == '1') {
			if (cnt == 1) {
				ans.pb(0);
			}
			else {
				int val = (s2 - v2[i] + 2 * cnt - 2) % (cnt - 1);
				ans.pb(a[val] + 1);
			}
		}
		else {
			int val = (s1 + v1[i]) % (cnt + 1);
			int tt = 1 + a[val];
			ans.pb(tt);
		}
	}


	for (int i = 0; i < n; i++) cout << ans[i] << '\n';



}

Measured memory_bytes: 7340
#include <iostream>
#include <string>
#include <iomanip>
#include <vector>

using namespace std;
int main(void){

    int n;
    cin >> n;
    
    vector<int> data;
    for(int i=0; i<n; i++) {
        int temp;
        cin >> temp;
        data.push_back(temp);
    }
    
    int result = 1;
    int max = data[0];

    for(int i=1; i<data.size(); i++) {
        if(data[i]>=max) {
            result++;
            max = data[i];
        }
    }
    
    cout << result << endl;

    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    int N,M; cin >> N >> M;
    vei cnt(N,0); 
    rep(i,M) {
        int a,b; cin >> a >> b;
        a--; b--;
        cnt[a]++; cnt[b]++;
    }
    rep(i,N) if(cnt[i] % 2 != 0) {cout << "NO" << endl; return 0;}
    cout << "YES" << endl;
    return 0;
}



Measured memory_bytes: 640
// ALDS1_2_D
#include <iostream>
#include <vector>
using namespace std;

void insertionSort(vector<int> &A, int &cnt, int g){
	for(int i=g;i<A.size();i++){
		int v = A[i], j = i-g;

		while((j >= 0) && (A[j] > v)){
			A[j+g] = A[j];
			j -= g;
			cnt++;
		}
		A[j+g] = v;
	}
}

void shellSort(vector<int> &A){
	int m, cnt = 0;
	vector<int> G;

	G.push_back(1);
	while(G[G.size()-1] <= A.size())
		G.push_back(3*G[G.size()-1]+1);
	m = G.size();

	for(int i=m-2;i>=0;i--)
		insertionSort(A, cnt, G[i]);

	cout<<m-1<<endl;
	for(int i=m-2;i>=0;i--){
		if(i != m-2)
			cout<<" ";
		cout<<G[i];
	}
	cout<<endl<<cnt<<endl;
}

int main(){
	int n, num;
	vector<int> A;

	cin>>n;
	for(int i=0;i<n;i++){
		cin>>num;
		A.push_back(num);
	}

	shellSort(A);

	for(int i=0;i<n;i++)
		cout<<A[i]<<endl;

	return 0;
}

Measured memory_bytes: 5936
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
int main()
{
	int a[5];
	for(int i=0;i<5;i++) cin>>a[i];
	sort(a,a+5);int k;cin>>k;
	int t=a[4]-a[0];
	if(t<=k) cout<<"Yay!"<<endl;
	else cout<<":("<<endl;
 } 

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#define int long long
#define double long double
#define oku7 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用

using namespace std;
std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

vector<vector<int>> ansvec;
int a[501][501], x[100001],ballNum[100001];
bool can[100001];

vector<string> v;

int count(string s) {
	int cnt = 0;
	for (string st : v) {
		if (st == s) cnt++;
	}
	return cnt;
}

signed main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		v.push_back(s);
	}

	char last = v[0][0];
	bool flag = true;
	for (string s : v) {
		if (last != s[0]) flag = false;
		if (count(s) != 1) flag = false;
		last = s.back();
	}
	if (flag) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

string s;
int main() {
    cin >> s;
    int cnt = 0;
    int n = s.length();
    for (auto c : s) {
        if (c == '1')
            ++cnt;
    }
    cout << min(cnt, n - cnt) * 2 << endl;
    return 0;
}


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

class Program
{
    void Calc()
    {
        var sc = new Scanner();

        int a = sc.NextInt();
        int b = sc.NextInt();
        if (a > b)
        {
            Console.WriteLine("a > b");
        }
        else if (a < b)
        {
            Console.WriteLine("a < b");
        }
        else
        {
            Console.WriteLine("a == b");
        }
    }

    static void Main()
    {
        new Program().Calc();
    }

    class Scanner
    {
        string[] s = new string[0];
        int i = 0;
        char[] cs = new char[] { ' ' };

        public string Next()
        {
            if (i < s.Length) return s[i++];
            s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return s[i++];
        }
        public int NextInt() { return int.Parse(Next()); }
        public long NextLong() { return long.Parse(Next()); }
        public double NextDouble() { return double.Parse(Next()); }
    }
}

Measured memory_bytes: 5296
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k, a int
	fmt.Scan(&n, &k)
	monster := make([]int, n)

	for i, _ := range monster {
		fmt.Scan(&a)
		monster[i] = a
	}

	if n <= k {
		fmt.Println(0)
	} else {
		sort.Sort(sort.IntSlice(monster))
		monster = monster[:n-k]

		MinSum := 0
		for _, value := range monster {
			MinSum += value
		}

		fmt.Println(MinSum)
	}
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+5;
int main() {
    string s,t;cin>>s>>t;
    int n=s.length(),m=t.length();
    int ans=1e9;
    for(int i=0;i+m-1<n;i++) {
    	int now=0;
    	for(int j=0;j<m;j++) {
    		if(s[i+j]!=t[j]) now++;
    	}
    	ans=min(ans,now);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
import java.util.*;

public class Main {

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

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		ArrayList<Integer> a=new ArrayList<Integer>();;
		int total = 0;
		for(int i=0; i<n; i++) {
			int v=sc.nextInt();
			a.add(v);
			total += v;
		}
		Collections.sort(a, Collections.reverseOrder());
		int v=a.get(m-1);
		if(v*4*m>=total) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;

string s;
int w;

int main(){
	cin >> s >> w;
	
	for(int i = 0; i < s.size(); i+=w){
		cout << s[i];
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int w=sc.nextInt();
		int num[]=new int[w+1];
		for(int i=1;i<=w;i++){
			num[i]=i;
		}

		int n=sc.nextInt();
		for(int i=0;i<n;i++){
			String[] str=sc.next().split(",");
			int a=Integer.parseInt(str[0]);
			int b=Integer.parseInt(str[1]);
			int c=num[a];
			num[a]=num[b];
			num[b]=c;
		}

		for(int i=1;i<=w;i++){
			System.out.println(num[i]);
		}
		sc.close();
	}

}

Measured memory_bytes: 26132