akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            return int.Parse(Next());
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            return Array().Select(int.Parse).ToArray();
        }
        public long[] LongArray()
        {
            return Array().Select(long.Parse).ToArray();
        }
    }

    class HashMap<K, V> : Dictionary<K, V>
    {
        new public V this[K i]
        {
            get
            {
                V v;
                return TryGetValue(i, out v) ? v : base[i] = default(V);
            }
            set { base[i] = value; }
        }
    }

    class Program
    {
        private string S;
        private int X, Y;
        private void Scan()
        {
            var sc = new Scanner();
            S = sc.Next();
            X = sc.NextInt();
            Y = sc.NextInt();
        }

        public void Solve()
        {
            Scan();
            var F = S.Split('T').Select(s => s.Length).ToArray();
            var dpX = new HashMap<int, bool>();
            var dpY = new HashMap<int, bool>();
            dpX[F[0]] = true;
            dpY[0] = true;
            for (int i = 1; i < F.Length; i++)
            {
                var next = new HashMap<int, bool>();
                if (i % 2 == 1)
                {
                    foreach (var p in dpY)
                    {
                        next[p.Key + F[i]] = true;
                        next[p.Key - F[i]] = true;
                    }
                    dpY = next;
                }
                else
                {
                    foreach (var p in dpX)
                    {
                        next[p.Key + F[i]] = true;
                        next[p.Key - F[i]] = true;
                    }
                    dpX = next;
                }
            }
            Console.WriteLine(dpX[X] && dpY[Y] ? "Yes" : "No");
        }

        static void Main(string[] args)
        {
            new Program().Solve();
        }
    }
}

Measured memory_bytes: 37812
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
#define MAX_N 500006

int bit[26][MAX_N+1];
int n;


int sum(int i,int mozi)
{
	int s=0;
	while(i>0)
	{
		s+=bit[mozi][i];
		i-=i&-i;
	}
	return s;
}
void add(int i,int x,int mozi)
{
	while(i<=n)
	{
		bit[mozi][i]+=x;
		i+=i&-i;
	}
}
int nbit[26][MAX_N+1];
int nn;


int nsum(int i,int mozi)
{
	int s=0;
	while(i>0)
	{
		s+=nbit[mozi][i];
		i-=i&-i;
	}
	return s;
}
void nadd(int i,int x,int mozi)
{
	while(i<=n)
	{
		nbit[mozi][i]+=x;
		i+=i&-i;
	}
}
int N;
string s;
int q;
int ot;
int qa,qb;
char cc;
int now;
int before;
int ans;
int main()
{
	cin>>N;
	n=N;nn=N;
	cin>>s;
	rep(i,N)
	{
		now=(int)(s[i]-'a');
		add(i+1,1,now);
	}
	/*cout<<"bitの中"<<endl;
	rep(i,26)
	{
		
		rep(j,N+1)
		{
			cout<<sum(j,i)<<" ";
		}
		cout<<endl;
	}*/
	cin>>q;
	rep(i,q)
	{
		cin>>ot;
		
		if(ot==1)
		{
			//cout<<"aa"<<endl;
			cin>>qa>>cc;
			before=(int)(s[qa-1]-'a');
			now=(int)(cc-'a');
			nadd(qa,1,before);
			add(qa,1,now);
			s[qa-1]=cc;
		}
		else
		{
			//cout<<"bb"<<endl;
			ans=0;
			cin>>qa>>qb;
			rep(ch,26)
			{
				if(sum(qb,ch)-sum(qa-1,ch)-nsum(qb,ch)+nsum(qa-1,ch)>0)
				{
					ans++;
				}
			}
			cout<<ans<<endl;
		}
	}
	return 0;
}

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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  ll k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) {
    cin >> a[i];
    a[i]--;
  }
  vector<int> visit(n, 0), loop;
  visit[0] = 1;
  bool is_loop = false;
  int start, cnt = 1, i = 0;
  while (true) {
    visit[a[i]]++;
    if (cnt == k) {
      cout << a[i] + 1 << '\n';
      return 0;
    }
    if (!is_loop && visit[a[i]] == 2) {
      is_loop = true;
      start = cnt;
    }
    if (is_loop) {
      if (visit[a[i]] == 3) break;
      loop.emplace_back(a[i]);
    }
    i = a[i];
    cnt++;
  }
  cout << loop[(k - start) % (int)loop.size()] + 1 << '\n';
  return 0;
}


Measured memory_bytes: 5360
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

string fld[22];
int h, w;
int d[22][22];
int main(){
    cin >> h >> w;
    REP(i, h)cin >> fld[i];
    int ans = 0;
    REP(i, h)REP(j, w){
        if(fld[i][j] == '#')continue;
        REP(k, h)REP(l, w)d[k][l] = HINF<int>();
        d[i][j] = 0;
        queue<pair<int, int>> q;
        q.push(make_pair(i, j));
        while(!q.empty()){
            pair<int, int> p = q.front();
            q.pop();
            REP(k, 4){
                int ny = p.first + dy[k], nx = p.second + dx[k];
                if(0 <= ny && ny < h && 0 <= nx && nx < w && fld[ny][nx] == '.' && d[ny][nx] == HINF<int>()){
                    d[ny][nx] = d[p.first][p.second] + 1;
                    q.push(make_pair(ny, nx));
                }
            }
        }
        REP(k, h)REP(l, w)if(fld[k][l] == '.')ans = max(ans, d[k][l]);
    }
    cout << ans << endl;
}

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



const double pi = 2 * acos(0.0);

int main()
{

    int n,d;
    cin>>d>>n;

    int s=0;

    while(n--){
        int a;
        cin>>a;

        s+=a;
    }



    if(s>d) cout<<-1<<endl;
    else cout<<d-s<<endl;



    return 0;
}



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

int gcd(int a,int b){
    if(b == 0)
        return a;
    return gcd(b,a%b);
}

int main(){
  int K;
  cin >> K;
  
  int sum = 0;
  
  for(int a = 1; a < K+1; a++){
    for(int b = 1; b < K+1; b++){
      for(int c = 1; c < K+1; c++){
        int d = gcd(a,b);
        int e = gcd(d,c);
        sum += e;
      }
    }
  }
  cout << sum << endl;
}
    

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
#define NIL -1
#define MAX 25

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

Node T[MAX];
int H[MAX];
int D[MAX];

void setDepth(int u, int d) {
	if (u == NIL)
		return;
	D[u] = d;
	setDepth(T[u].left, d + 1);
	setDepth(T[u].right, d + 1);
}

int setHeight(int u) {
	int h1, h2;
	h1 = h2 = 0;
	if (T[u].right != NIL) {
		h1 = setHeight(T[u].right) + 1;
	}
	if (T[u].left != NIL) {
		h2 = setHeight(T[u].left) + 1;
	}
	return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u) {
	if (T[u].parent == NIL) {
		return NIL;
	}
	if (T[T[u].parent].left != u && T[T[u].parent].left != NIL) {
		return T[T[u].parent].left;
	}
	if (T[T[u].parent].right != u && T[T[u].parent].right != NIL) {
		return T[T[u].parent].right;
	}
	return NIL;
}

void print(int u) {
	cout << "node " << u << ": ";
	cout << "parent = " << T[u].parent << ", ";
	cout << "sibling = " << getSibling(u) << ", ";
	int deg = 0;
	if (T[u].left != NIL)
		deg++;
	if (T[u].right != NIL)
		deg++;
	cout << "degree = " << deg << ", ";
	cout << "depth = " << D[u] << ", ";
	cout << "height = " << H[u] << ", ";
	if (T[u].parent == NIL) {
		cout << "root" << endl;
	}
	else if ((T[u].left == NIL) && (T[u].right == NIL)) {
		cout << "leaf" << endl;
	}
	else {
		cout << "internal node" << endl;
	}
}

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		T[i].parent = T[i].left = T[i].right = NIL;
	}

	for (int i = 0; i < n; i++) {
		int id, l, r;
		cin >> id >> l >> r;
		T[id].left = l;
		T[id].right = r;
		T[l].parent = id;
		T[r].parent = id;
	}
	int root;
	for (int i = 0; i < n; i++) {
		if (T[i].parent == NIL)
			root = i;
	}
	setDepth(root, 0);
	for (int i = 0; i < n; i++) {
		setHeight(i);
	}
	for (int i = 0; i < n; i++) {
		print(i);
	}
	return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, M;
  cin >> N >> M;

  vector<vector<pair<int, int>>> graph(N);
  REP(i, M){
    int l, r, d;
    cin >> l >> r >> d;
    l--; r--;
    graph[l].emplace_back(r, d);
    graph[r].emplace_back(l, -d);
  }


  bool ans = true;
  vector<int> dist(N, INF);

  REP(i, N){
    if(dist[i] != INF) continue;
    queue<int> q;
    q.push(i);
    dist[i] = 0;

    while(!q.empty()){
      int p = q.front(); q.pop();
      for(auto v : graph[p]){
        if(dist[v.first] == INF){
          dist[v.first] = dist[p]+v.second;
          q.push(v.first);
        }else{
          if(dist[v.first]-dist[p] != v.second) ans = false;
        }
      }
    }
  }

  ans? Yes: No;

  return 0;
}

Measured memory_bytes: 14080
#include <cstdio>
#include <cstring>
#include <map>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

namespace my
{
	//-----------------------------------------------------------------------------
	inline char cn()
	{
		static char buf[1000010],*p1=buf,*p2=buf;
		return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
	}
	#define cn getchar
	template<class TY>void read(TY &x)
	{
		x=0;int f1=1;char ch=cn();
		while(ch<'0'||ch>'9'){if(ch=='-')f1=-1;ch=cn();}
		while(ch>='0'&&ch<='9')x=x*10+(ch-'0'),ch=cn(); x*=f1;
	}
	char OP[1000030],Zhan[30];int op=0,Top;
	void fcheck(int type=0){if(type||op>=1000000)fwrite(OP,1,op,stdout),op=0;}
	template<class TY>inline void write(TY x)
	{
		if(x==0){OP[op++]='0';fcheck();return;}
		Top=0;while(x)Zhan[++Top]=x%10+'0',x/=10;
		while(Top)OP[op++]=Zhan[Top--];fcheck();
	}
	#define K_G OP[op++]=' '
	//----------------------------快读快输 ----------------------------------------
	
	//--------------------------------------------------------------------------------------------
	#define ll long long
	#define uint unsigned int
	#define ull unsigned long long
	#define INV(x) ksm(x,mod-2)
	const int maxn=100010,inf=1000000007;
	int mod=998244353;
	void add(int &x,int y){x=(x+y>=mod?x+y-mod:x+y);}
	int ksm(int x,int y){int re=1;for(;(y&1?re=1ll*re*x%mod:0),y;y>>=1,x=1ll*x*x%mod);return re;}
	int fac[maxn],inv_fac[maxn],inv[maxn];
	void work_math()//阶乘
	{
		inv[1]=1;for(int i=2;i<=maxn-10;i++)inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
		fac[0]=inv_fac[0]=1;for(int i=1;i<=maxn-10;i++)fac[i]=1ll*fac[i-1]*i%mod;
		inv_fac[maxn-10]=INV(fac[maxn-10]);
		for(int i=maxn-11;i>=1;i--)inv_fac[i]=1ll*inv_fac[i+1]*(i+1)%mod;
	}
	struct disc{int x,y;};
	bool compp(disc x,disc y){return x.x<y.x;}
	void discretization(int *darr,int dn)//离散化 
	{
		static disc b[maxn];
		for(int i=1;i<=dn;i++)
		b[i].x=darr[i],b[i].y=i;
		sort(b+1,b+dn+1,compp);
		static int tot=0;b[0].x=-9666;
		for(int i=1;i<=dn;i++)
		if(b[i].x!=b[i-1].x)darr[b[i].y]=++tot;
		else darr[b[i].y]=tot;
	}
	template<class TY>TY gcd(TY x,TY y){return !y?x:gcd(y,x%y);}
	//----------------------------------------------板子---------------------------------------------
	
	//----------------------------------------------------------------------------------------------- 
	int T,n;char s[maxn];ll a[maxn],d[64];
	bool add(ll x)
	{
		for(int i=60;i>=0;i--)
		if(x&(1ll<<i))
		{
			if(d[i])x^=d[i];
			else {d[i]=x;return true;}
		}
		return false;
	}
	
	void main()
	{
		scanf("%d",&T);while(T--)
		{
			scanf("%d",&n);for(int i=1;i<=n;i++)scanf("%lld",&a[i]);scanf("%s",s+1);
			bool ans=true;
			for(int i=1;i<=n;i++)if(s[i]=='1')
			{
				memset(d,0,sizeof(d));
				for(int j=i+1;j<=n;j++)if(s[j]=='0')add(a[j]);
				if(add(a[i]))ans=false;
			}
			if(ans)printf("0\n");else printf("1\n");
		}
//		fcheck(1);return;
	}
}

int main(){my::main();return 0;}

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

// 定義
typedef long long         ll;
typedef pair<ll, ll>      P;
#define ALL(x)            (x).begin(),(x).end()
#define REP(i, n)         for(ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)     for(ll i = m ; i < (ll)n ; ++i)
#define REVREP(i, n)      for(ll i = n - 1; i >= 0 ; i--)
#define VL                vector<ll>
#define VVL               vector<vector<ll>>
#define VVVL              vector<vector<vector<ll>>>
#define VC                vector<char>
#define VVC               vector<vector<char>>
#define INF               (ll)2e9
#define INF_LL            1LL<<60
//#define MOD             998244353
#define MOD               1000000007

ll Ceil(ll val, ll div)   { return (val + div - 1) / div; }
ll CeilN(ll val, ll div)  { return Ceil(val, div) * div; }
ll FloorN(ll x, ll n)     { return (x - x % n); }
bool IsOdd(ll x)          { return ((x & 1) == 1); }
bool IsEven(ll x)         { return ((x & 1) == 0); }
template<class T> bool chmax(T& a, T b) { if (a <= b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }

void Solve()
{
	ll X, N;
	cin >> X >> N;
	VL p(N);
	REP(i, N) cin >> p[i];
	sort(ALL(p), greater<ll>());

	ll ans = INF;
	ll tmp = INF;
	for (ll i = 1000; i >= -1000; i--) {
		bool isOk = true;
		for (auto one : p) {
			if (one == i) {
				isOk = false;
			}
		}
		if (isOk) {
			if (chmin(tmp, abs(i - X))) {
				ans = i;
			}
		}
	}

	cout << ans << endl;
}

// メイン
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Solve();
	return 0;
}


Measured memory_bytes: 3648
#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;
using ll = long long;
using P = pair<int,int>;

int main(){
  int k;
  string s;
  cin >> k;
  cin >> s;

  if(s.size() <= k) cout << s << endl;
  else{
    REP(i,k) cout << s[i];
    cout << "..." << endl;
  }

  return 0;

}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ri register int
typedef long long ll;
#define rll register ll
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	template <class I>
	inline void gi (I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = (x << 1) + (x << 3) + (c & 15); x *= f;
	}
	// input a signed integer
	template <class I>
	inline void read (I &x, int p) {
		for (c = gc(); c < '0' || c > '9'; c = gc()) ;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = ( (x << 1) + (x << 3) + (c & 15) ) % p; 
	}
	// print a signed integer
	template <class I>
	inline void print (I x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}
	// no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} 
using io :: gi;
using io :: read;
using io :: putc;
using io :: print;
const int N=1e5+5;
ll s[N],cnt[N],tag[N];
int main(){
	ri n,m,i,top,p;
	rll x,res;
	gi(n);gi(m);
	s[top=1]=n;
	while(m--){
		gi(x);
		while(top&&s[top]>=x) --top;
		s[++top]=x;
	}
	cnt[top]=1;
	for(i=top;i;--i){
		res=s[i];
		while(1){
			p=upper_bound(s+1,s+1+i-1,res)-s-1;
			if(!p){
				tag[res]+=cnt[i];
				break;
			}
			cnt[p]+=res/s[p]*cnt[i];
			res%=s[p]; 
		}
	}
//	printf("top = %d\n",top);
//	for(i=1;i<=top;++i) printf("%lld ",s[i]);
//	puts("");
//	for(i=1;i<=top;++i) printf("%lld ",cnt[i]);
//	puts("");
	for(i=n;i;--i) tag[i]+=tag[i+1];
	for(i=1;i<=n;++i) print(tag[i]),putc('\n');
    return 0;
}

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

int main()
{
    long long X, Y;
    std::cin >> X >> Y;

    std::vector<long long> expotenential;
    expotenential.emplace_back(X);

    while(true)
    {
        long long a = expotenential[expotenential.size() - 1] * 2;
        if (Y < a)
            break;

        expotenential.emplace_back(a);
    }

    std::cout << expotenential.size() << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <cstring>
#include <cmath>
using namespace std;
struct node {
	int pos, time;
	node(int pos, int time) {
		this->pos = pos;
		this->time = time;
	}
};
queue<node> q;
int main(int argc, char *argv[]) {
	int x;
	while(cin >> x) {
		
		int i = sqrt(x);
		while(i * (i + 1) >> 1 < x)
			i++;
			
		cout << i << endl;
			
		
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
#define MP make_pair
#define PB push_back
#define ll long long
#define int long long
#define f(i,x,n) for(int i=x;i<n;i++)
#define ld long double
#define mod 1000000007
int n,m;
string s[2005];
int a[2003][2003];
int b[2003][2003];
int c[2003][2003];
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n>>m;
	f(i,0,n)
		cin>>s[i];
	f(i,1,n+1)
		f(j,1,m+1)
		{
			if(s[i-1][j-1]=='.')
				a[i][j]=1;
			if(a[i][j]==0)
			{
				b[i][j]=0;
				c[i][j]=0;
			}
			else
			{
				b[i][j]=a[i][j]+b[i][j-1];
				c[i][j]=a[i][j]+c[i-1][j];
			}
		}
	int ans=0;
	for(int i=n;i>=1;i--)
	{
		for(int j=m;j>=1;j--)
		{
			if(a[i][j]!=0)
			{
				b[i][j]=max(b[i][j+1],b[i][j]);
				c[i][j]=max(c[i+1][j],c[i][j]);
			}
			ans=max(ans,b[i][j]+c[i][j]-1);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 98560
#include <stdio.h>

int get_days(int month, int day);

int main(void)
{
    int month, day;
    while (1) {
        scanf("%d %d", &month, &day);

        if (month == 0 && day == 0) {
            break;
        }

        int days = get_days(month, day);
        int mod = days % 7;
        switch (mod) {
            case 1:
                printf("Thursday\n");
                break;
            case 2:
                printf("Friday\n");
                break;
            case 3:
                printf("Saturday\n");
                break;
            case 4:
                printf("Sunday\n");
                break;
            case 5:
                printf("Monday\n");
                break;
            case 6:
                printf("Tuesday\n");
                break;
            case 0:
                printf("Wednesday\n");
                break;
        }
    }

    return 0;
}

int get_days(int month, int day)
{
    int days = 31 * (month - 1) + day;

    int minus = 0;
    if (month > 2) {
        minus += 2;
    }
    if (month > 4) {
        minus++;
    }
    if (month > 6) {
        minus++;
    }
    if (month > 9) {
        minus++;
    }
    if (month > 11) {
        minus++;
    }

    return days -= minus;
}

Measured memory_bytes: 584
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [a, b, c]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    return a + b + c > 21 ? 'bust' : 'win';
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));

Measured memory_bytes: 7372
import sys
import heapq
from collections import defaultdict
input = sys.stdin.readline

n = 100000

X, Y = map(int, input().split())
if X == 1 and Y == 1:
    print(1000000)
elif X <= 3 and Y <= 3:
    print((4 - X) * n + (4 - Y) * n)
elif X <= 3:
    print((4 - X) * n)
elif Y <= 3:
    print((4 - Y) * n)
else:
    print(0)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7 ;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}



int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int m,d;
    cin>>m>>d;
    int res=0;
    for(int i=1;i<=m;i++){
        for(int j=10;j<=d;j++){
            int a=j%10;
            int b=j/10;
            if((a>=2)&&(b>=2)&&(a*b==i)){res++;}
        }
    }
    cout<<res<<endl;
    return 0;
    }


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

using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<int> B(N - 1);
    rep(i, N - 1) cin >> B[i];
    int ans = B[0] + B[N - 2];
    rep(i, N - 2) {
        ans += min(B[i], B[i + 1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import queue

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
H, W = map(int, input().split())
field = [input() for _ in range(H)]

dist = [[-1] * W for _ in range(H)]
que = queue.Queue()
que.put((0, 0))
dist[0][0] = 0

while not que.empty():
  y, x = que.get()
  for i in range(4):
    ny, nx = y + dy[i], x + dx[i]
    if nx < 0 or nx >= W or ny < 0 or ny >= H:
      continue
    if field[ny][nx] == '#':
      continue
    if dist[ny][nx] != -1:
      continue
    dist[ny][nx] = dist[y][x] + 1
    que.put((ny, nx))
    
count = 0
for y in range(H):
  for x in range(W):
    if field[y][x] == '#':
      count += 1
      
if dist[H - 1][W - 1] != -1:
  print(H * W - count - dist[H - 1][W - 1] - 1)
else:
  print(-1)

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

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        int n = Integer.parseInt(br.readLine());
        char[] s = br.readLine().toCharArray();
        
        for(int i = 0; i < s.length; i++){
            if(s[i] + n <= 90){
                s[i] += n;
            }else{
                s[i] = (char)(65 + (n - (90 - s[i])) - 1);
            }
            out.print(s[i]);
        }
        
        out.close();
        
    }
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

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

    ll X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<ll> A(X), B(Y), C(Z);
    rep(i, X) cin >> A[i];
    rep(i, Y) cin >> B[i];
    rep(i, Z) cin >> C[i];

    vector<ll> AB, nAB(K), ans;
    rep(i, X) rep(j, Y) AB.pb(A[i] + B[j]);
    sort(rall(AB));
    rep(i, min(K, X*Y)) nAB[i] = AB[i];
    rep(i, min(K, X*Y*Z)) rep(j, Z) ans.pb(nAB[i] + C[j]);

    sort(rall(ans));
    rep(i, K) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 43240
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, m;
		int p[];
		int id;
		int num;

		while (true) {
			n = sc.nextInt();
			m = sc.nextInt();
			if ((n | m) == 0) {
				break;
			}

			p = new int[n];
			Arrays.fill(p, 1);
			id = 0;
			num = n;

			for (int i = 1; i <= m; i++) {
				String s = sc.next();
				String c = Integer.toString(i);
				if (1 < num) {
					if (i % 15 == 0) {
						c = "FizzBuzz";
					} else if (i % 3 == 0) {
						c = "Fizz";
					} else if (i % 5 == 0) {
						c = "Buzz";
					}
					if (!s.equals(c)) {
						p[id] = 0;
						num--;
					}
					id = (id + 1) % n;
					while (p[id] == 0) {
						id = (id + 1) % n;
					}
				}
			}

			String s = "";
			for (int i = 0; i < n; i++) {
				if (p[i] == 1) {
					System.out.print(s + (i + 1));
					s = " ";
				}
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 70344
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
	string a, b;
	cin >> a >> b;
	string c = a + b;
	int d = 0;
	int r = 1;
	for(int i =  c.length() - 1; i >= 0; i--){
		d += r * (c[i] - '0');
		r *= 10;
	}
	for(int i = 1; i <= 1000; i++){
		if(i * i == d){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#define inf 0x3f3f3f3f
//extern "C"{void *__dso_handle=0;}
using namespace std;
typedef long long ll;
const int maxn=1005;
vector<int> g[maxn];
int d[maxn];
set <int> s;
void del(int u)
{
	for(int i=0;i<g[u].size();i++)
	{
		d[g[u][i]]--;
		if(d[g[u][i]]==1) 
		{
			s.insert(g[u][i]);
//			cout << i << endl;
			cout.flush();
		}
	}
}

void print(int ans)
{
	cout << "! " << ans << endl;
	cout.flush();
}
int a[3][3];
int b[15];
struct Node
{
	int m[3];
}node[105];
map<int, int> mp;
int main() 
{
	for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
			cin >> a[i][j];
	for(int i=0;i<3;i++)
	{
		node[i].m[0]=a[i][0];
		node[i].m[1]=a[i][1];
		node[i].m[2]=a[i][2];
	}
	int res=3;
	for(int j=0;j<3;j++)
	{
		node[res].m[0]=a[0][j];
		node[res].m[1]=a[1][j];
		node[res].m[2]=a[2][j];
		res++;
	}
	for(int i=0;i<3;i++)
		node[res].m[i]=a[i][i];
	res++;
	node[res].m[0]=a[0][2];
	node[res].m[1]=a[1][1];
	node[res].m[2]=a[2][0];
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> b[i];
		mp[b[i]]=1;
	}
	bool flag= false;
	for(int i=0;i<=res;i++)
	{
		if(mp[node[i].m[0]] && mp[node[i].m[1]] && mp[node[i].m[2]])
			flag=true;
	}
	if(flag) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

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

  ll n;
  cin >> n;
  ll a[n];
  REP(i, n) cin >> a[i];

  SORT(a, n);
  map<ll, ll> mp;

  REP(i, n) mp[a[i]]++;

  if(mp.size() == 1){
    cout << mp[a[0]] << endl;
    return 0;
  }
  else if(mp.size() == 2){
    if(abs(a[n - 1] - a[0]) <= 2) cout << mp[a[0]] + mp[a[n - 1]] << endl;
    else cout << max(mp[a[0]], mp[a[n - 1]]) << endl;
    return 0;
  }

  vector<ll> sum;
  REP(i, mp.size() - 2) sum.pb(mp[i] + mp[i + 1] + mp[i + 2]);
  ll ans = 0;
  REP(i, sum.size()) ans = max(ans, sum[i]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 8052
#include<stdio.h>
#include<string.h>
int main()
{
	int n,j,k,i,l=0;
	char s[100];
	scanf("%s",s);
	n=strlen(s);
	for(i=0;i<n;i++)
    for(j=i+1;j<n;j++)
{
	if(s[i]==s[j]) l=1;
}
if(l==0)printf("yes\n");
else printf("no");	
} 

Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
 ll n,m;
 sc(n);sc(m);
 ll a,b;
 llpvec c(m);
 ll mapb[200010]={0},mapa[200010]={0};
 rep(i,0,m){
  sc(a);sc(b);
  if((mapa[a]&&b==n)||(a==1&&mapb[b])){
   puts("POSSIBLE");
   return 0;
  }
  if(a==1)mapa[b]=1;
  if(b==n)mapb[a]=1;
 }

 puts("IMPOSSIBLE");
  
return 0;}

Measured memory_bytes: 9544
a, b, k = map(int, input().split())
t = 0
for i in range(k):
    if t == 0:
        if a % 2 != 0:
            a -= 1
        b += a//2
        a = a//2
        t = 1
    else:
        if b % 2 != 0:
            b -= 1
        a += b//2
        b = b//2
        t = 0
print('{} {}'.format(a, b))


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

int main() {
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    int i;
    int v[n + 1] = {0}, x = 1;
    for(i = 0; i < n-1; i ++)
    {
        if(s[i] == 'A' && s[i + 1] == 'C') 
        {
            v[i + 1] = x ++;
            v[i + 2] = x ++;
            i ++;
        }
        else
            v[i + 1] = v[i];
    }
    v[i + 1] = v[i];
    // for(i = 0; i <= n; i ++)
    //     cout << v[i] << endl;
    while(q--)
    {
        int l,r;
        cin >> l >> r;
        if(v[r] % 2 == 0) 
        {
            if((v[r] - v[l]) % 2 != 0)  
                cout << (v[r] - v[l] + 1) / 2;
            else
                cout << (v[r] - v[l]) / 2;
        }
        else
        {
            cout << (v[r] - v[l]) / 2;
        }
        cout << endl;
    }
	return 0;
}

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

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define CIN(v) cin >> v;
#define COUT(v) cout << v << "\n";

bool ac[100005];
ll wa[100005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N, M;

  CIN(N >> M);

  if (M == 0) {
    COUT("0 0");
    return 0;
  }

  ll p;
  string S;

  for (ll i = 0; i < M; i++) {
    CIN(p >> S);
    // COUT(p << " " << S);

    if (S == "AC") {
      ac[p] = true;
    } else {
      // wa
      if (!ac[p]) {
        wa[p]++;
      }
    }
  }

  // count ac
  ll countAc = 0;
  ll countWa = 0;
  for (ll i = 1; i <= N; i++) {
    if (ac[i]) {
      countAc++;
      countWa += wa[i];
    }
  }

  COUT(countAc << " " << countWa);
  return 0;
}


Measured memory_bytes: 1152
def gr(x,y):
    while y:
        amari = x % y
        x = y
        y = amari
    return x
n,x = map(int,input().split())
lis = list(map(int,input().split()))
li = []
for i in range(n):
  if abs(lis[i]-x) != 0:
    li.append(abs(lis[i]-x))
li.sort()
if len(li) == 1:
  print(abs(li[0]))
  exit()
ans = abs(li[0]-li[1])

for i in range(len(li)-1):
  ans = gr(ans,abs(li[i+1]))
print(ans)

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

vector<int> to[100010];
const int INF=INT_MAX;

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> past(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  rep(i,n){
    past[i]=INF;
  }
  past[0]=0;
  queue<int> q;
  q.push(0);
  while(!q.empty()){
    int now=q.front(); q.pop();
    for(auto x : to[now]){
      if(past[x]!=INF) continue;
      past[x]=now;
      q.push(x);
    }
  }
  cout<<"Yes"<<endl;
  for(int i=1; i<n; i++){
    cout<<past[i]+1<<endl;
  }
}


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

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;

int main(void) {
  int h, w;
  while(1) {
    cin >> h >> w;
    if(h+w == 0) break;
    rep(_, h) {
      rep(_, w) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    vll a(n);
    rep(i, n) cin >> a[i];
    ll sum = 0;
    rep(i, n) sum += a[i];
    ll ans = LINF;
    ll tmp = 0;
    rep(i, n) {
        tmp += a[i]*2;
        ans = min(ans, abs(sum-tmp));
    }

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

Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
        long long int a,b,k,dif;
        scanf("%lld %lld %lld",&a,&b,&k);
        if(k>=a)
        {
                k=k-a;
                a=0;
        }
        else
        {
                a=a-k;
                k=0;
        }
        if(k>=b)
        {
                b=0;
        }
        else
        {
                b=b-k;
        }
        printf("%lld %lld\n",a,b);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
#define inputv(v, n)                                                           \
    vl v;                                                                      \
    rep(i, n) {                                                                \
        ll x;                                                                  \
        cin >> x;                                                              \
        v.push_back(x);                                                        \
    }
bool chmin(ll& a, ll& b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll& a, ll& b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
ll masu[100][100];
int main() {
    cin >> x >> y;
    rep(i, 50) {
        rep(j, 100) {
            masu[i][j] = 1;
        }
    }

    while (x > 1) {
        p = a / 22;
        q = a % 22;
        masu[p*2][q*2]=0;
        x--;
        a++;
    }

    while (y > 1) {
        p = b / 22;
        q = b % 22;
        masu[99-p * 2][q * 2] = 1;
        y--;
        b++;
    }
    
    cout<<100<<" "<<100<<endl;

    rep(i, 100) {
        rep(j, 100) {
            if (masu[i][j])cout << "#";
            else cout << ".";
        }
        cout << endl;
    }
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;
const ll MOD=1e9+7;

int main() {
    int n,m;
    cin>>n>>m;
    int s[n+1],t[m+1];
    rep(i,n){
        cin>>s[i+1];
    }
    rep(i,m){
        cin>>t[i+1];
    }
    ll dp[n+1][m+1];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for (int i=0;i<n+1;i++){
        for (int j=0;j<m+1;j++){
            if (i==0 || j==0){
                dp[i][j]=1;
            }
            else{
                if (s[i]==t[j]){
                    dp[i][j]=dp[i-1][j-1]+dp[i-1][j-1]+dp[i-1][j]+dp[i][j-1]-2*dp[i-1][j-1];
                }
                else{
                    dp[i][j]=dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1];
                }
                dp[i][j]=(dp[i][j]+MOD)%MOD;
            }
        }
    }
    cout<<dp[n][m]<<endl;

    return 0;
}


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

using namespace std;
#define ll long long
#define pb push_back

int main()
{
	int n;
	cin>>n;
	int cnt = 0;
	int m = 0;
	while(n--) {
		int a, b;
		cin >> a >> b;
		if(a==b) cnt++;
		else cnt=0;
		
		m = max(m, cnt);
	}
	if(m >=3) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
int main()
{
  int a, b;
  cin >> a>> b;
  cout << (((a%2 == 1)&&(b%2 == 1))? "Odd":"Even") << endl;
}


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

int main()
{
    int d,n;
    cin >> d >> n;
    int a = 1;
    
    if(d == 0 && n == 100){
        cout << 101;
    }else if (d == 1 && n == 100){
        cout << 10100;
    }else if(d == 2 && n == 100){
        cout << 1010000;
    }else{
        for (int i = 0; i < d; i++){
            a *= 100;
        }
        n *= a;
        cout << n;
    }
}


Measured memory_bytes: 256
N = int(input())
a = []
for _ in range(N):
    a.append(int(input()))

route = set()
route.add(0)
before = 0
ans = 0
for i in range(N):
    now = a[before] - 1
    ans += 1
    if now == 1:
        break
    elif now not in route:
        route.add(now)
        before = now
    else:
        ans = -1
        break
print(ans)


Measured memory_bytes: 16008
#include<bits/stdc++.h>
using namespace std;
long int dp[11][11][11];
long int n,m,q;
long int ans=0;
void fun(long int ind,long int val,long int sum,vector<int> a)
{
    if(ind==n)
    {
        ans=max(ans,sum);
        return ;
    }
    if(val>m)
    return ;
    vector<int> b=a;
    for(long int i=val;i<=m;i++)
    {
        long int ss=sum;
         b.push_back(i);
         for(long int j=0;j<ind;j++)
         {
            ss+=dp[ind][j][i-b[j]];
         }
         fun(ind+1,i,ss,b);
         b.pop_back();
    }
}
int main()
{
   long int n,m;
   cin>>n>>m;
   vector<long int> a[n+1];
   long long int h[n+1];
   for(long int i=1;i<=n;i++)
   cin>>h[i];
   long int aa,bb;
   for(long int i=0;i<m;i++)
   {
       cin>>aa>>bb;
       a[aa].push_back(bb);
       a[bb].push_back(aa);
   }
   long int ans=0;
   for(long int i=1;i<=n;i++)
   {
       long int temp=0;
       for(long int j=0;j<a[i].size();j++)
       {
           if(h[a[i][j]]<h[i])
           temp++;
       }
       if(temp==a[i].size())
       ans++;
   }
   cout<<ans;
}


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

const double pi = 3.141592653589793;

int main(){
	int a, b, h, m;

	cin >> a >> b >> h >> m;

	double omega_a = 2*pi/(12*60); // [rad/m]
	double omega_b = 2*pi/60; 	// [rad/m]

	double theta_a = omega_a*(h*60 + m);
	double theta_b = omega_b*m;
	double sai = (theta_a > theta_b) ? theta_a - theta_b : theta_b - theta_a;
	double ans = sqrt((double)a*a + (double)b*b - (double)2*a*b*cos(sai));

	cout << setprecision(20) << ans << endl;
	return 0;
}


Measured memory_bytes: 4228
N, M = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))

y = [sum([2 ** i for i in range(N) if i + 1 in x[1:]]) for x in X]

ans = 0
for i in range(2 ** N):
  cnt = []
  for j, v in enumerate(y):
    cnt.append(list(bin(v & i)[2:]).count('1') % 2 == p[j])
  ans += 1 if all(cnt) else 0
  
print(ans)


Measured memory_bytes: 3064
N=int(input())
A=list(map(int,input().split()))
mod=10**9+7

data=[0]
for i in range(N):
    data.append(data[-1]^A[i])

if data[-1]==0:
    ans=0
    zero=[int(data[i]==0) for i in range(N+1)]
    for i in range(1,N+1):
        zero[i]+=zero[i-1]

    val={}
    for i in range(N+1):
        if data[i]!=0:
            if data[i] not in val:
                val[data[i]]=[]
            val[data[i]].append(i)

    for v in val:
        B=0
        W=1
        for i in range(len(val[v])):
            j=val[v][i]
            if i!=len(val[v])-1:
                B+=W
                W+=B*(zero[val[v][i+1]]-zero[j])
                B%=mod;W%=mod
            else:
                B+=W
                B%=mod
        ans+=B
        ans%=mod

    n=data.count(0)
    ans+=pow(2,n-2,mod)
    ans%=mod
    print(ans)
else:
    val=data[-1]
    que=[0]*2**20
    dp=[0]*(N+1)
    dp[0]=1
    que[0]=1
    for i in range(1,N+1):
        j=data[i]
        dp[i]=que[j^val]
        que[data[i]]+=dp[i]
        que[data[i]]%=mod

    print(dp[N]%mod)

Measured memory_bytes: 127020
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var S = Console.ReadLine();
            var ok = true;
            var hash = new HashSet<char>();
            for (var i = 0; i < S.Length; i++)
            {
                if (hash.Contains(S[i])) ok = false;
                hash.Add(S[i]);
            }
            Console.WriteLine(ok ? "yes" : "no");
        }
    }
}


Measured memory_bytes: 26084