akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;



int main(){
    int n,m; cin >> n >> m;
    if ((n+m)%2) cout << "IMPOSSIBLE";
    else cout << (n+m)/2;
    
    rn 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;

class Main {

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String st;

		while ((st = br.readLine()) != null) {

			String[] str = st.split(" ");

			BigInteger a = new BigInteger(str[0]);

			BigInteger b = new BigInteger(str[1]);

			System.out.println(a.gcd(b) + " " + a.multiply(b).divide(a.gcd(b)));

		}

	}

}

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

using namespace std;

int main()
{
	int H, W;
	cin >> H >> W;
	while (H!=0&&W!=0)
	{
		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				cout << "#" ;
			}
			cout << "" << endl;
			
		}
		cout << "" << endl;
		cin >> H >> W;
	}
	return 0;
}










Measured memory_bytes: 3056
N = gets.to_i
S = gets.chomp.split("")
a = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']

S.each_with_index do |s, i|
  S[i] = a[(N + a.index(s)) % 26]
end
puts S.join


Measured memory_bytes: 2172
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
using namespace std;
using ll = long long;

int main() {
	
	int n;

	cin >> n;

	string s, t;

	cin >> s >> t;

	vector<char> ans(2*n);

	int i, j=0, k=0;
	for (i = 0; i < 2 * n; i++) {
		if (i % 2 == 0) {
			ans[i] = s[j];
			if(j<n) j++;
		}
		else {
			ans[i] = t[k];
			if(k<n) k++;
		}
	}

	for (i = 0; i < 2 * n; i++) {
		cout << ans[i];
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)

ans=0
if n%2==1:
    for i in range(1,n//2):
        ans+=a[i]*2
    ans+=a[0]+a[n//2]
else:
    ans+=a[0]
    for i in range(1,(n//2)):
        ans+=a[i]*2
print(ans)

Measured memory_bytes: 31692
import numpy as np

N, K = map(int, input().split())

A = np.array(list(map(int, input().split()))) - 1

roop = [-1]*N
is_visited = [-1]*N

roop[0] = 0
is_visited[0] = 0

for i in range(N-1):
    if is_visited[A[roop[i]]] >= 0:
        for idx, j in enumerate(roop):
            if j == A[roop[i]]:
                r = i+1-idx
                print(roop[idx + (K - idx) % r] + 1)
                exit()

    elif i == K:
        print(roop[i] + 1)
        exit()

    roop[i+1] =  A[roop[i]]
    is_visited[roop[i]] = i

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

using namespace std;

using int64 = long long;

struct Edge {
  const int from, to;
  Edge(int from, int to) : from(from), to(to) {}
};

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

  int n;
  int k;
  cin >> n >> k;
  vector<int> ps(n);
  for (int i = 0; i < n; i++) {
    cin >> ps[i];
    ps[i]--;
  }

  int ans = 0;
  if (ps[0] != 0) {
    ans++;
    ps[0] = 0;
  }

  vector<vector<Edge>> graph(n);
  for (int i = 1; i < n; i++) {
    graph[ps[i]].emplace_back(ps[i], i);
  }

  function<tuple<int, int>(int)> dfs = [&](int v) -> tuple<int, int> {
    if (graph[v].empty()) {
      return make_tuple(0, 0);
    }
    int cost = 0;
    int depth = 0;
    for (const auto& e : graph[v]) {
      int c_cost, c_depth;
      tie(c_cost, c_depth) = dfs(e.to);
      cost += c_cost;
      if (v != 0 && c_depth >= k - 1) {
        cost++;
      } else {
        depth = max(depth, c_depth + 1);
      }
    }
    return make_tuple(cost, depth);
  };

  int cost;
  tie(cost, ignore) = dfs(0);
  ans += cost;

  cout << ans << endl;
}

Measured memory_bytes: 17024
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define DUMP(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<": "<<(x)<<" (L"<<__LINE__<<")"<<endl
using namespace std;
using vint = vector<int>;
using vdouble = vector<double>;
using vstring = vector<string>;
using ll = long long;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int main() {
    int x, t; cin >> x >> t;
    cout << max(0, x - t) << endl;
    return 0;
}


Measured memory_bytes: 256
H, W = list(map(int, input().split()))

menseki = H * W
_menseki = menseki
ans = 100000000

for i in range(0, H):
    menseki -= W
    _a = W*(i+1)
    if i+1 < H:
        m = W // 2 * (H-(i+1)) # 縦切りの面積
        m2 = menseki - m
        buff_m = min(m, _a)
        buff_mx = max(m2, _a)
        # print('menseki ' + str(menseki))
        # print('m系')
        # # print(W//2, H-(i+1), m, m2)
        # print(buff_mx, buff_m, buff_mx-buff_m, ans)
        ans = min(ans, buff_mx - buff_m)

        # 横切りの面積
        _w = ((H-(i+1)) // 2) * W
        _w2 = menseki - _w
        buff_w = min(_w, _a)
        buff_w2 = max(_w2, _a)
        # print('w系')
        # print(buff_w, buff_w2, buff_w2-buff_w, ans)
        ans = min(ans, buff_w2 - buff_w)

menseki = _menseki
H, W = (W, H)

for i in range(0, H):
    menseki -= W
    _a = W*(i+1)
    if i+1 < H:
        m = W // 2 * (H-(i+1)) # 縦切りの面積
        m2 = menseki - m
        buff_m = min(m, _a)
        buff_mx = max(m2, _a)
        # print('menseki ' + str(menseki))
        # print('m系')
        # # print(W//2, H-(i+1), m, m2)
        # print(buff_mx, buff_m, buff_mx-buff_m, ans)
        ans = min(ans, buff_mx - buff_m)

        # 横切りの面積
        _w = ((H-(i+1)) // 2) * W
        _w2 = menseki - _w
        buff_w = min(_w, _a)
        buff_w2 = max(_w2, _a)
        # print('w系')
        # print(buff_w, buff_w2, buff_w2-buff_w, ans)
        ans = min(ans, buff_w2 - buff_w)




    # if menseki % 2 == 0:
    #     if menseki/2 <= _a:
    #         ans = min(ans, _a-(menseki//2))
    #     else:
    #         ans = min(ans, (menseki//2)-_a)





print(ans)

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;

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

int main(){
	//input
	ll N; cin>>N;
	vector<ll> d(N);
	rep(i,N) cin>>d[i];

	ll ans=0;
	rep(i,N-1){
		FOR(j,i+1,N){
			ans+=d[i]*d[j];
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
n,*t=map(int,open(0).read().split())
e=[[]for _ in[0]*n]
for v,w,c in zip(t[::3],t[1::3],t[2::3]):
  e[v-1]+=(w-1,c),
  e[w-1]+=(v-1,c),
q=[0]
f=[0]+[-1]*~-n
while q:
  v=q.pop()
  for w,c in e[v]:
    if-1<f[w]:continue
    f[w]=(c+f[v])%2
    q+=w,
print(*f)

Measured memory_bytes: 115152
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<numeric>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//最大公約数
template<class T> T gcd(T a, T b)
{
	while (true)
	{
		T r;
		if (a%b == 0) return b;
		else
		{
			r = a % b;
			a = b;
			b = r;
		}
	}
}
//最小公倍数
template<class T> T lcm(T a, T b)
{
	return a / gcd(a, b)*b;
}
//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//int型0~9を文字0~9に変換
char int_to_char(int c) {
	if (c == 0) return '0';
	if (c == 1) return '1';
	if (c == 2) return '2';
	if (c == 3) return '3';
	if (c == 4) return '4';
	if (c == 5) return '5';
	if (c == 6) return '6';
	if (c == 7) return '7';
	if (c == 8) return '8';
	if (c == 9) return '9';
	else return'x';
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn = 1, Kr = 1, Knr = 1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}
//int型10進数をord桁のstring型2進数に変換する
string binary(int x, int ord)
{
	int y;
	string ans = "";
	for (int i = 0; i < ord; i++)
	{
		y = x / (int)pow(2, ord - 1 - i);
		y %= 2;
		if (y == 0) ans += "0";
		else ans += "1";
	}

	return ans;
}
//ord桁のstring型2進数をint型10進数に変換する
int rep_binary(string x, int ord)
{
	int res = 0;
	for (int i = 0; i < ord; i++)
	{
		if (x[i] == '1') res += (int)pow(2, ord - 1 - i);
	}
	return res;
}


/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/



int main()
{
	int n, A[10005];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}

	int ans = 0;
	bool fr = true;

	for (int i = 0; i < n; i++)
	{
		fr = true;
		for (int j = 2; j <= sqrt(A[i]); j++)
		{
			if (A[i] % j == 0) fr = false;
		}
		if (fr) ans++;
	}

	cout << ans << endl;

	return 0;
}


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

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAX_N = 2e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

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

#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

void add_self(int &a,int b)
{
	a+=b;
	a%=MOD;
}
int parent[MAX_N],sz[MAX_N];
void make_set(int v) {
    parent[v] = v;
    sz[v] = 1;
}
int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}
void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (sz[a] < sz[b])
            swap(a, b);
        parent[b] = a;
        sz[a] += sz[b];
    }
}
void solve() {
	int n,m;
	cin>>n>>m;
	map<int,int> mp;
	for(int i=0;i<n;i++)
	make_set(i+1);
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		union_sets(a,b);
	}
	int ans=1;
	unordered_map<int,int> m2;
	for(int i=1;i<=n;i++)
	{
		
		m2[find_set(i)]++;
		//if(mp.find(i)!=mp.end())
		ans=max(ans,m2[find_set(i)]);
	}
	cout<<ans<<endl;

}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

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


Measured memory_bytes: 12976
#include<cstdio>
#include<algorithm>
const int N=2003,INF=1e9+6;
struct edge{int v,nxt;}g[N+N];
int n,head[N],k,f[N],siz[N],ans;char a[N];
inline void Insert(int u,int v){g[++k]=(edge){v,head[u]};head[u]=k;}
void Dfs0(int u,int fa){
	int v;
	siz[u]=a[u]=='1',f[u]=0;
	for(int i=head[u];i;i=g[i].nxt)if((v=g[i].v)!=fa)
	  Dfs0(v,u),f[u]+=siz[v]+f[v],siz[u]+=siz[v];
}
bool Check(int u,int fa,int r,int m){
	int v,p=0,deg=0;
	for(int i=head[u];i;i=g[i].nxt)if((v=g[i].v)!=fa){
	  ++deg;
	  p=siz[v]+f[v]>=siz[p]+f[p]?v:p;
	}
	if((f[u]&1)&&r||!deg||deg==1&&r||f[u]<m*2)return 0;
	if((siz[p]+f[p])*2<=f[u]||f[u]-siz[p]-f[p]>=m)return 1;
	return Check(p,u,0,m-(f[u]-siz[p]-f[p]));
}
int main(){
	int u,v;
	scanf("%d%s",&n,a+1);
	for(int i=1;i<n;i++)scanf("%d%d",&u,&v),Insert(u,v),Insert(v,u);
	ans=INF;
	for(u=1;u<=n;u++){
	  Dfs0(u,0);
	  if(!f[u])return 0*puts("0");
	  if(Check(u,0,1,f[u]/2))ans=std::min(ans,f[u]);
	}
	printf("%d\n",ans==INF?-1:ans/2);
	return 0;
}

Measured memory_bytes: 1904
#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;
#define MX 200009

vector<int>to[MX];
vector<int>c(MX);
vector<int>ans(MX);

void dfs(int v,int s,int p=-1){
  s+=c[v];
  ans[v]=s;
  for(auto u:to[v]){
    if(u==p)continue;
    dfs(u,s,v);
  }
}

int main(){
  int n,q;
  cin>>n>>q;
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  rep(i,q){
    int p,x;
    cin>>p>>x;
    p--;
    c[p]+=x;
  }
  dfs(0,0);
  rep(i,n){
    cout<<ans[i];
    if(i+1==n)cout<<endl;
    else cout<<' ';
  }
  return(0);
}


Measured memory_bytes: 24320
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
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; }



int main() {
	
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	
	int n; cin >> n;
	
	vector<string> a(n); rep(i,n) cin >> a[i];
	vector<int> c(4); 
	
	//s//ort(all(a));
	rep(i,n){
		if(a[i] == "AC") c[0]++;
		if(a[i] == "WA") c[1]++;
		if(a[i] == "TLE") c[2]++;
		if(a[i] == "RE") c[3]++;
	}
	
	
	cout << "AC x " << c[0] << endl;
	cout << "WA x " << c[1] << endl;
	cout << "TLE x " << c[2] << endl;
	cout << "RE x " << c[3] << endl;
	
	return 0;
}


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

#define INF 1e5 

int prise[100006],f[100006];
bool isprise[100006];

void os(int r)
{
	int tot=0;
	memset(isprise,1,sizeof(isprise));
	isprise[1]=isprise[0]=0;
	for(int i=2;i<=r;i++)
	{
		if(isprise[i])
			prise[tot++]=i;
		for(int j=0;i*prise[j]<=r;j++)
		{
			isprise[i*prise[j]]=0;
			if(i%prise[j]==0)
				break;
		}
	}
}

void Prefix_and()
{
	for(int i=2;i<=100005;i++)
	{
		f[i]=f[i-1];
		if(i%2==1&&isprise[i]&&isprise[(i+1)/2])
			f[i]++;
	}
}

int main()
{
	int n,x,y;
	os(100005);
	Prefix_and();
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x>>y;
		cout<<f[y]-f[x-1]<<endl;
	}
	return 0;
}

Measured memory_bytes: 4132
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
string S;
  string T;
  cin >>S>>T;
  cout<<T+S<<endl;
}

Measured memory_bytes: 764
/* Survive. Live. Win. Conquer.*/


#include<bits/stdc++.h>
using namespace std;
typedef long long LL ;
#define get(a) for( int i = 0; i < n; i++) sf("%d", &a[i]) ;
#define bug printf("TRUST\n");
#define pf printf
#define sf scanf
#define lp(i, n) for(int i = 0; i < n; i++)
#define rlp(n, i) for(int i = n - 1; i >= 0; i--)
#define bye vector<LL>
#define pb push_back
#define r0 return 0
#define ff first
#define ss second
#define mp make_pair
#define pii pair <int, int>
#define sz(a) ((int)a.size())
#define set0(a) memset ((a), 0 , sizeof(a))
#define set1(a) memset((a),-1,sizeof (a))
#define si(a) scanf("%d" , &a)
#define sl(a) scanf("%lld" , &a)
#define sii(a,b) scanf("%d %d" , &a , &b)
#define sll(a,b) scanf("%lld %lld" , &a , &b)
#define slll(a,b,c) scanf("%lld %lld %lld" , &a , &b, &c)
#define FOR(i,a,b) for(LL i = (a) ; i <= (b) ; i++)
#define mod 1000000007
#define nod 200003

void func(void)
{
        freopen("input.c","r",stdin);
        freopen("output.c","w",stdout);
}

const int N = 1e5 + 100;
LL co[N];
LL a[N];
set<LL> s;
int main(){
//    ios_base::sync_with_stdio(0); cin.tie(0);
//    system("COLOR F0");
    LL n, q, i,j = 0, temp, t, k, ans = 0, sum = 0, x, y, z, cnt = 0, m, fg = 0, mx = 0, mx1 = 0, mn = 8000000000000000000, mn1 = 8000000000000000000;
    string s;
    cin >>n >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == ')'){
            cnt--;
            if(cnt < 0){
                s.insert(s.begin(), '(');
                cnt++;
                i++;
            }
        }
        else cnt++;
    }

    if(cnt > 0){
        while(cnt != 0){
            s.pb(')');
            cnt--;
        }
    }
    cout << s << endl;
}


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

using ll = long long int;
using P = pair<int, int>;
using P3 = pair<int,P>;
using PP = pair<P, P>;
constexpr int INF = 1<<30;
constexpr ll MOD = ll(1e9)+7;
constexpr int di[] = {0,1,0,-1};
constexpr int dj[] = {1,0,-1,0};

bool solve(){
    int m, n;
    cin >> m >> n;
    if(m == 0) return false;
    vector<int> a(m);
    for(int i=0;i<m;i++){
        a[i] = i+1;
    }
    for(int t=1,idx=0;t<=n;t++){
        string s;
        cin >> s;
        bool ok = true;
        if(t%3==0 && t%5==0){
            ok &= s == "FizzBuzz";
        }else if(t%3==0){
            ok &= s == "Fizz";
        }else if(t%5==0){
            ok &= s == "Buzz";
        }else{
            ok &= s == to_string(t);
        }
        if(!ok && a.size() > 1){
            a.erase(a.begin()+idx);
        }else{
            idx++;
        }
        if(idx>=a.size()){
            idx = 0;
        }
    }
    for(int i=0;i<a.size();i++){
        cout << a[i] << " \n"[i+1==a.size()];
    }
    return true;
}

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



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

#define SATUAN 9
#define RATUSAN 900
#define PULUHANRIBU 90000

int N;

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

	if(N < 10) ans = N;
	if(N >= 10 && N < 100) ans = SATUAN;
	if(N >= 100 && N < 1000) ans = SATUAN + (N - 99);
	if(N >= 1000 && N < 10000) ans = SATUAN + RATUSAN;
	if(N >= 10000 && N < 100000) ans = SATUAN + RATUSAN + (N - 9999); 
	if( N >= 100000 ) ans = SATUAN + RATUSAN + PULUHANRIBU;

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 256
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def r_sort(a) a.sort{|a,b|b<=>a} end

n =gets.to_i
t = ARGF.map(&:to_i)
max = t.max
m_i = t.index(max)
t.delete_at(m_i)
max2 = t.max
n.times.each do |i|
  puts (i==m_i)? max2:max
end


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

int main(int argc, char const *argv[])
{
    int X;
    string ans;
    ans = "NO";
    cin >> X;
    if (X == 3 || X == 5 || X == 7)
    {
        ans = "YES";
    }
    cout << ans << endl;
    return 0;
}


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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define N 111111

const int INF = 1 << 30 ;
typedef long long ll ;
typedef pair < int , int > pii ;

int main() {
  string s , ans = "" ;

  cin >> s ;

  for(int i = 0 ;i<s.length() ;i++){
    if(i%2 == 0)ans+=s[i] ;
  }
  cout << ans << endl ;
	
  return 0 ;
}



Measured memory_bytes: 512
//itp1_5-d
#include <iostream>
using namespace std;

int include3(int x){
 return (! x) ? 0 : (x%10==3 || include3(x/10));
}

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

 for(int i=1;i<=n;i++){
  if(i%3==0) cout<<" "<<i;
  else if(include3(i)) cout<<" "<<i;
 }
 cout<<endl;
 return 0;
}

Measured memory_bytes: 1164
#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>;
void Yes() {
    cout << "Yes" << endl;
}
void No() {
    cout << "No" << endl;
}
int main(void) {
    int n; cin >> n;
    cout << n/3;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <queue>

#define INF 922337203685477580
typedef long long ll;

using namespace std;

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

  cout << a * b << " " << (a + b) * 2 << endl;
  return 0;
}

Measured memory_bytes: 3036
import numpy as np
R, G, B, N = map(int, input().split())
M = N - np.add.outer(np.arange(0, N + 1, R, dtype=np.int32), np.arange(0, N + 1, G, dtype=np.int32))
print(((M >= 0) & (M % B == 0)).sum())

Measured memory_bytes: 100196
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	A, B := sc.nextInt(), sc.nextInt()

	if A%2 == 0 || B%2 == 0 {
		fmt.Fprintln(wtr, "No")
	} else {
		fmt.Fprintln(wtr, "Yes")
	}
	wtr.Flush()
}


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

int main() {
	char a;
	
	for(int i=0;i<12;i++){
		cin>>a;
		cout<<a;
		if(i==3){
			cout<<" ";
		}
	}
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
 
int main(){
 
  int a, b, c;
 
  scanf("%d %d",&a,&b);
 
  /* ?????¶??° a > b ????¢?????????\??? */
  if(a < b){
    a += b;
    b = a - b;
    a -= b;
  }
 
  /* ?????????????????????????????? */
  while(b != 0){
    c = a % b;
    a = b;
    b = c;
  }
 
  /* ?????§??¬?´???°????????? */
  printf("%d\n",a);
 
  return 0;
}

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

string s;
vector<string> V;

int main() {
    cin >> s;
    for (int i = 0; i < s.length(); i++) {
        string cur;
        for (int j = i; j < min((int)s.length(), i + 5); j++) {
            cur.push_back(s[j]), V.push_back(cur);
        }
    }
    sort(V.begin(), V.end());
    V.resize(unique(V.begin(), V.end()) - V.begin());
    int K; cin >> K;
    cout << V[K - 1] << endl;
    return 0;
}

Measured memory_bytes: 1660
#include<stdio.h>
int main(){
int a,b,i,c,j;
scanf("%d\n",&a);
for(i=0;i<a;i++){
scanf("%d\n",&b);
printf("Case %d:\n",i+1);
for(j=0;j<10;j++){
b=b*b;
c=b/100;
if(c>9999){
while(c>9999){
c=c-10000;
}
}
printf("%d\n",c);
b=c;
}
}
return 0;
}



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

  //最大公約数
int64_t gcd(int64_t a,int64_t b){
  int64_t c;
  c=a;
  a=max(a,b);
  b=min(c,b);
  c=a;
  while(b > 0){
    a = b;
    b = c % b;
    c = a;
  }
  return a;
}
int main() {
  int64_t A,B;
  cin>>A>>B;
  int64_t X =gcd(A,B);
  int64_t rootX;
  int64_t y=10000;
  if(X <100000000)
    rootX = X;
  else
    rootX = X/y;
  int answer =1;
  for(int64_t i=2;i<rootX;i++){
    if(X%i ==0){
      answer++;
      while(X%i ==0)
        X=X/i;
    }
  }
  if(X>1)
    answer++;
  cout <<answer;
      
}

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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = int.Parse(Console.ReadLine());
            var coin500 = input / 500;
            var tmp = input % 500;
            var coin5 = tmp / 5;

            Console.WriteLine(coin500 * 1000 + coin5 * 5);
        }
    }
}


Measured memory_bytes: 11092
use std::cmp::min;
use std::collections::VecDeque;
use std::io::{stdin, Read};
use std::rc::Rc;
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let m = read::<usize>();
    let ab = (0..m)
        .map(|_| (read::<usize>(), read::<usize>()))
        .collect::<Vec<_>>();
    let mut edges = vec![vec![]; n + 1];
    for (a, b) in ab {
        edges[a].push(b)
    }

    let mut ans = vec![0; n + 1];
    let u_max = usize::max_value() as usize;

    for i in 1..n + 1 {
        let mut q = VecDeque::new();
        let mut dist = vec![u_max; n + 1];
        let mut prev = vec![0; n + 1];

        q.push_back((i, 0));

        while let Some((a, from)) = q.pop_front() {
            if from != 0 {
                if a == i {
                    if ans.len() > dist[from] + 1 {
                        let mut route = vec![];
                        let mut p = from;
                        while p != 0 {
                            route.push(p);
                            p = prev[p];
                        }
                        ans = route;
                        break;
                    }
                } else {
                    if dist[a] == u_max {
                        prev[a] = from;
                        dist[a] = dist[from] + 1;
                        for &b in &edges[a] {
                            q.push_back((b, a));
                        }
                    }
                }
            } else {
                dist[a] = 0;
                for &b in &edges[a] {
                    q.push_back((b, a));
                }
            }
        }
    }

    let len = ans.len();
    if len <= n {
        println!("{}", len);
        for a in ans {
            println!("{}", a);
        }
    } else {
        println!("-1")
    }
}


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

const int MAXN = 100005;

int N, a[MAXN];
int main(){
	scanf("%d", &N);
	for(int i = 0; i < N; i++)
		scanf("%d", &a[i]);
		
	int prv = -1;
	for(int i = 0; i < N; i++){
		if(a[i] - 1 >= prv)prv = a[i] - 1;
		else if(a[i] >= prv)prv = a[i];
		else{
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include <vector>
#include <utility>
using namespace std;

int main(){
	unsigned N;
	scanf("%u", &N);
	unsigned A[N];
	vector<pair<unsigned, bool> > testimony[N];
	for (int i = 0; i < N; ++i){
		scanf("%u", A + i);
		for (int j = 0; j < A[i]; ++j){
			unsigned x, y;
			scanf("%u %u", &x, &y);
			testimony[i].push_back(make_pair(x - 1, y == 1));
		}
	}
	unsigned ans = 0;
	for (unsigned i = 0; i < 1 << N; ++i){
		bool flag = false;
		for (unsigned j = 0; j < N; ++j){
			if(i >> j & 1){
				for (int k = 0; k < A[j]; ++k){
					if(i >> testimony[j][k].first & 1 ^ testimony[j][k].second){
						flag = true;
						break;
					}
				}
			}
			if(flag) break;
		}
		if(!flag){
			unsigned honest = 0;
			for (int j = 0; j < N; ++j){
				if(i >> j & 1) honest++;
			}
			if(ans < honest) ans = honest;
		}
	}
	printf("%u\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int n,a[100],m,l,ans=0,set=1;
	scanf("%d",&n);
	for(m=0;m<n;m++) scanf("%d",&a[m]);
	for(m=0;m<n;m++){
		if(a[m]==1)set++;
		else {
			set=1;
		}
		if(ans<set) ans=set;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 2712
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')

def main():
  k, x = map(int, readline().split())
  if 500*k>=x:
    print('Yes')
  else:
    print('No')
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5972
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin>>a;
    int cnt=0;
    for(int i=0;i<a.size();i++)
	{
        if(a[i]=='C')
		{
            cnt=1;
        }
        if(a[i]=='F'&&cnt==1)
		{
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
// 三井住友信託銀行プログラミングコンテスト2019-D
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}

vector<string> kind;
void dfs(string a,int sou){
    if(sou==3){
        kind.push_back(a);
        return;
    }
    for(int i=0;i<10;i++){
        dfs(a+to_string(i),sou+1);
    }
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n;
    string s;
    cin>>n;
    cin>>s;
    dfs("",0);
    //cout<<kind<<endl;
    int ans=0;
    int l=SZ(kind);
    //cout<<l<<endl;
    for(int i=0;i<l;i++){
        int c=0;
        string cur=kind[i];
        for(int j=0;j<n;j++){
            if(s[j]==cur[c]) c+=1;
            if(c==3) break;
        }
        if(c==3){
            ans+=1;
            //cout<<kind[i]<<endl;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

typedef std::pair<int, int> ipair;
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define rf(i, j, k) for (int i = j; i >= k;i--)
#define int long long
#define ld long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define mp make_pair

const int mod = 1000000007;
const ld pi = acos(-1);
const int maxn = 200006;

template<class T> ostream& operator <<(ostream &out,vector<T> &A){for(auto x:A) out<<x<<" ";return out;}
template <class T1,class T2>T1 powr(T1 a,T2 b){T1 res = 1;fr(i,1,b+1)res = res*a;return res;}
#define IOS  std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int32_t main(){
  int n;  cin>>n;
  vector<int>A(n),B(n),C(n-1);
  fr(i,0,n) cin>>A[i];
  fr(i,0,n) cin>>B[i];
  fr(i,0,n-1) cin>>C[i];
  int ans = 0;
  fr(i,0,n) ans += B[A[i]-1];
  fr(i,0,n) if(A[i]+1 == A[i+1])  ans += C[A[i]-1];
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;
using namespace std;
typedef long long  L;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Mx 2000001
#define inf 1e17
const L MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a,b,a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,n,m,m1,m2,n1,n2,o,p1,p2,p3,p4,
q1,q2,q3,q4,r,s,t,x,y,z,sum,mn,flg,flg1,flg2,id1,id2,id3,lim,cost;
L A[15][15],C[15],W[15];

bool check(L mask){
    p1=0;
    cost=0;
    for(L i=0;i<n;i++){
        if(mask&(1<<i)){
            cost+=C[i];
            for(L j=0;j<m;j++){
                if(p1==0)W[j]=A[i][j];
                else W[j]+=A[i][j];
            }p1=1;
        }
    }
    for(L i=0;i<m;i++){
        if(W[i]<x)return false;
    }
    return true;
}

void bitMask(){
    lim=(1<<n);
    for(L i=0;i<lim;i++){
        if(check(i)){
            mn=min(mn,cost);
        }
    }
}

void solve(){
    mn=inf;
    bitMask();
    if(mn==inf)printf("-1\n");
    else printf("%lld\n", mn);
}
int main()
{
    scanf("%lld%lld%lld",&n,&m,&x);
    for(L i=0;i<n;i++){
        scanf("%lld",&C[i]);
        for(L j=0;j<m;j++){
            scanf("%lld",&A[i][j]);
        }
    }
    solve();
    return 0;
}
/// empty() lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 3832
#include<iostream>
using namespace std;
int main() {
  int N;
  cin >> N;
  int cnt = 0;
  int d1,d2;
  int i;
  for(i=0;i<N;i++) {
    cin >> d1 >> d2;
    if(d1 == d2) {
      cnt++;
      if(cnt == 3) {
        cout << "Yes" << endl;
        return 0;
      }
    }
    else cnt = 0;
  }
  cout << "No" << endl;
}

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

using namespace std;

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

	int n;
	cin >> n;
	vector<int> t(n);
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> t[i];
		sum += t[i];
	}
	int m;
	cin >> m;
	for (int i = 0; i < m; i++) {
		int p, x;
		cin >> p >> x;
		--p;
		cout << sum + x - t[p] << '\n';
	}

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;
int main(){
    while(true){
	int n,m;
	cin >> n >> m;
	if(n == 0 && m == 0) break;
	n++;
	vector<ll> a(n);
	a[0] = 0;
	FOR(i,1,n){
	    cin >> a[i];
	}
	int ans = 0;
	vector<int> v;
	REP(i,n)FOR(j,1,n){
	    if(a[i]+a[j] <= m)
		v.PB(a[i]+a[j]);
	}
	sort(ALL(v));
	v.erase(unique(ALL(v)),v.end());
	REP(i,v.size()){
	    int temp = m - v[i];
	    int h,mm,l;
	    h = v.size()+1;
	    l = 0;
	    mm = (h+l)/2;
	    while(h-l>1){
		if(v[mm] > temp) h = mm;
		else if(v[mm] < temp) l = mm;
		else break;
		mm = (h+l)/2;
	    }

	    if(v[mm] + v[i] <= m) ans = max(ans,v[mm]+v[i]);
	}
	cout << ans << endl;
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  int forth_num = N % 10; // 一の位
  int third_num = (N % 100 - N % 10) / 10; // 十の位
  int second_num = (N % 1000 - N % 100) / 100; // 百の位
  int first_num = (N % 10000 - N % 1000) / 1000; // 千の位
  
  if (((first_num == second_num) && (second_num == third_num))
      || ((second_num == third_num) && (third_num == forth_num))) {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define ll long long
#define mset(s, _) memset(s, _, sizeof s)
#define ALL(a) (a).begin(), (a).end()
using namespace std;

int main(void) {
  int H, W, K;
  cin >> H >> W >> K;

  int c[7][7];
  char cha;

  rep(i, 0, H - 1) {
    rep(j, 0, W - 1) {
      cin >> cha;
      if (cha == '.') {
        c[i][j] = 0;
      } else {
        c[i][j] = 1;
      }
    }
  }

  // rep(i, 0, H - 1) {
  //   rep(j, 0, W - 1) { cout << c[i][j] << " "; }
  //   cout << endl;
  // }

  ll ans = 0;

  for (int bit = 0; bit < (1 << H); ++bit) {
    vector<int> height;
    for (int i = 0; i < H; ++i) {
      if (bit & (1 << i)) {
        height.push_back(i);
      }
    }

    for (int bit = 0; bit < (1 << W); ++bit) {
      vector<int> width;
      for (int i = 0; i < W; ++i) {
        if (bit & (1 << i)) {
          width.push_back(i);
        }
      }

      ll count = 0;

      for (auto h : height) {
        for (auto w : width) {
          count += c[h][w];
        }
      }

      if (count == K) {
        ans++;
      }

      // cout << "height: ";
      // for (auto h : height) {
      //   cout << h << " ";
      // }
      // cout << "width: ";
      // for (auto w : width) {
      //   cout << w << " ";
      // }
      // cout << endl;
    }
  }

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


Measured memory_bytes: 3600
import sys
import random
test = False

def solve(c_list, days, now):
    r = sum(c_list[i]*(now-days[i]) for i in range(26))
    return r


if test == True:
    seed = 94
    random.seed(seed)
    d = 365
    c = [random.randrange(0, 101) for _ in range(26)]
    s = [[random.randrange(0, 20001) for _ in range(26)] for _ in range(d)]
    c_ = ' '.join(map(str, c))
    s_ = '\n'.join([' '.join(map(str, i)) for i in s])
    with open('./input.txt', 'w') as f:
        f.write('\n'.join([str(d), c_, s_]))
else:
    d = int(input())
    c = list(map(int, input().split()))
    s = [list(map(int, input().split())) for _i in range(d)]


last_days = [-1 for _i in range(26)]
result = []
score = 0
for today in range(d):
    checker = [c[j]*(today-last_days[j]) for j in range(26)]
    y = sum(checker)

    finder = [s[today][j]-(y-checker[j]) for j in range(26)]

    x = finder.index(max(finder))

    last_days[x] = today
    result.append(x+1)
    score += s[today][x] - solve(c, last_days, today)
#print(score)


if test == True:
    with open('./output.txt', 'w') as f:
        f.write('\n'.join(map(str, result)))
else:
    for i in result:
        print(i)

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

int main(){
  string a, b;
  cin >> a >> b;
  a += b;
  int n = stoi(a);
  
  for(int i = 0; i <= 1000; i++){
    if(i * i == n){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;

#define PI 3.14159265358979323846264338327950L

int res = -1;

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

    int s;
    cin >> s;

    int data[1000000];

    bool flag = true;
    int cnt = 0;
    data[0] = s;

    while (flag)
    {
        if (s % 2 == 0)
        {
            s /= 2;
        }
        else
        {
            s = 3 * s + 1;
        }
        data[cnt + 1] = s;
        for (int i = 0; i <= cnt + 1; i++)
        {
            for (int j = 0; j < cnt + 1; j++)
            {
                if (data[i] == data[j] && i != j)
                {
                    flag = false;
                    res = i + 1;
                    //cout << data[i] << endl;
                    //cout << data[j] << endl;
                    break;
                }
            }
        }
        cnt++;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
// ------------------------------------
// Date:2018/ 3/29
// Problem:_ _ _ a.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "POSSIBLE" : "IMPOSSIBLE") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int N, M;

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

  cin >> N >> M;
  set< int > a;
  set< int > b;
  REP(i, M) {
    CIN(p, q);
    if (p == 1) a.insert(q);
    if (q == 1) a.insert(p);
    if (p == N) b.insert(q);
    if (q == N) b.insert(p);
  }

  bool ok = false;
  EACH(ai, a) {
    if (b.find(ai) != b.end()) {
      ok = true;
      break;
    }
  }
  OK(ok);
  
  return 0;
}



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

using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds; 

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define f(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define inf INT_MAX
#define llinf LONG_LONG_MAX

const int MAXN=2e5+3;
const int M=998244353;

vector<int> v[MAXN];
bool vis[MAXN];

int par[MAXN];

void solve(){
	int n,m,cnt=0;
	sfi(n) sfi(m)

	f(i,0,m){
		int x,y;
		sfi(x) sfi(y)
		v[x].push_back(y);
		v[y].push_back(x);
	}

	queue<int> q;
	q.push(1);
	vis[1]=true;

	while(!q.empty()){
		int tp=q.front();
		q.pop();
		++cnt;

		for(int x:v[tp]){
			if(!vis[x]){
				vis[x]=true;
				par[x]=tp;
				q.push(x);
			}
		}
	}

	if(cnt!=n){
		printf("No\n");
	}
	else{
		printf("Yes\n");
		f(i,2,n+1){
			cout<<par[i]<<endl;
		}
	}
}	

int main(){	

	solve();

	return 0;	
}

Measured memory_bytes: 12896
#include <stdio.h>
int main()
{
  int i, j, n, m;
  char k;
  int card[4][13] = {};
  scanf("%d%*c",&n);
  for(i = 0; i < n; i++){
    scanf("%c %d%*c",&k, &m);
    if(k == 'S'){
      for(j = 0; j < m; j++){
    if(j == (m - 1)){
      card[0][j] = 1;
    }
      }
    } else if(k == 'H'){
      for(j = 0; j < m; j++){
    if(j == (m - 1)){
      card[1][j] = 1;
    }
      }
    } else if(k == 'C'){
      for(j = 0; j < m; j++){
    if(j == (m - 1)){
      card[2][j] = 1;
    }
      }
    } else if(k == 'D'){
      for(j = 0; j < m; j++){
    if(j == (m - 1)){
      card[3][j] = 1;
    }
      }
    }
  }
  for(i = 0; i < 4; i++){
    for(j = 0; j < 13; j++){
      if(card[i][j] != 1){
    if(i == 0){
      printf("S %d\n", j + 1);
    } else if(i == 1){
      printf("H %d\n", j + 1);
    } else if(i == 2){
      printf("C %d\n", j + 1);
    } else if(i == 3){
      printf("D %d\n", j + 1);
    }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1860
import math
import sys


(N, K) = list(map(int,input().split()))
P  = list(map(int,input().split()))

tmp = sum(P[0:K])
max = tmp
# print(tmp,max)
for x in range(K,N):
    tmp = tmp - P[x-K] + P[x]
    if tmp > max:
        max = tmp
    # print(tmp,max)
print((float(max)+K)/float(2))


Measured memory_bytes: 25572
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
//cout << std::fixed << std::setprecision(15) << y << endl;

int main(){
  ll N;
  cin >> N;
  VL d1(N);
  VL d2(N);
  rep(i,0,N) cin >> d1[i] >> d2[i];

  ll ans = 0;
  rep(i,0,N){
    if(d1[i] == d2[i]){
      ans++;
      if(ans == 3){
        cout << "Yes" << endl;
        return 0;
      }
    }
    else ans = 0;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3620