akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!

//

void solve(long long N, long long K, std::vector<long long> p) {
  vector<__float128> E(N);
  rep(i,N){
    E[i] = (p[i]+1) / 2.0 ;
  }
  //vector<double> cum(N+1);
  vector<__float128> cum(N+1);
  cum[0] = 0.0;
  rep(i,N){
    cum[i+1] = E[i] + cum[i];
  }

  double ret = 0;
  for(int i=0;i<N-K+1;++i){
    if(ret<cum[i+K]-cum[i]) ret = cum[i+K]-cum[i];
  }
  cout << ret << endl;

}

int main() {
  cin.tie(0); cout.precision(12);
  ios::sync_with_stdio(false); // Magic for faster cin
  long long N;
  std::cin >> N;
  long long K;
  std::cin >> K;
  std::vector<long long> p(N);
  for (int i = 0; i < N; i++) {
    std::cin >> p[i];
  }
  solve(N, K, std::move(p));
  return 0;
}


Measured memory_bytes: 11116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll n,d;
    cin >> n >> d;
    ll x[n][d];
    int ans=0;
    for(int i=0;i<n;++i) {
        for(int j=0;j<d;++j) {
            cin >> x[i][j];
        }
    }
    for(int i=0;i<n;++i) {
        for(int j=i+1;j<n;++j) {
            int norm=0;
            for(int k=0;k<d;++k) {
                int diff=abs(x[i][k]-x[j][k]);
                norm+=diff*diff;
            }
            bool flag=false;
            for(int k=0;k<=norm;++k) {
                if(k*k==norm) {
                    flag=true;
                }
            }
            if(flag) ++ans;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map> 
using namespace std;
typedef long long ll;
int n;
char s[45];
typedef pair<string,string> P;
map<P,ll>num;
ll ans;
string l,r;//l从左到右 r从右到左 
int main()
{
	scanf("%d",&n);
	scanf("%s",s);
	for(int i=0;i<(1<<n);++i)
	{
		l="",r=""; 
		for(int j=0;j<n;++j)
		{
			if(i>>j&1)l+=s[j];
			else r+=s[j];
		}
		num[P(l,r)]++;
	} 
	for(int i=0;i<(1<<n);++i)
	{
		l="",r="";
		for(int j=n-1;j>=0;--j)
		{
			if(i>>j&1)l+=s[n+j];
			else r+=s[n+j];
		}
		ans+=num[P(r,l)];
	}
	printf("%lld\n",ans);
} 

Measured memory_bytes: 91904
///                                                     ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
#include <bits/stdc++.h>
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define sc   scanf
#define pr   printf
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define ld   long double
#define N    200256
#define M    998244353
#define I    1000000000000000000
#define pdd  pair < ld, ld >
#define pll  pair < ll, ll >
#define pii  pair < int, int >
#define rep( a, b, c, d )  for( int a = b; a <= c; a += d )
#define rvv( a, b, c, d )  for( int a = b; a >= c; a -= d )
#define en                 printf( "\n" )
#define sqr( a )           a * a
#define all( c )           c.begin(), c.end()
#define srt( c )           sort( all( c ) )
#define rev( c )           reverse( all( c ) )
#define srtr( c )          sort( c.rbegin(), c.rend() )
#define numcounts          __builtin_popcount
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
const int dx[ ] = { 1, -1, 0, 0 };
const int dy[ ] = { 0, 0, -1, 1 };
using namespace std;
ll ttt = 1;
ll n, m, sum;
void solve()
{
    sc( "%I64d", &n );
    m = n % 100;
    n -= m;
    if(m <= n / 20)pr("1");
    else pr("0");
}

int main()
{

   // sc( "%I64d", &tests );
    for(int i = 0; i < ttt; i ++ )
        solve();
}






Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm>
#include <iomanip>
#include <cmath>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <vector>
#include <bitset>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <cstdio>
#include <list>


constexpr int INF = 1050000000;
constexpr int MOD = 1000000007;
constexpr long long LONGINF = 1005000000000000000;
using namespace std;

using ll = long long;

class UnionFind {
private:
	std::vector<int> parent;
	std::vector<int> height;
	std::vector<int> m_size;

public:
	UnionFind(int size_) : parent(size_), height(size_, 0), m_size(size_, 1) {
		for (int i = 0; i < size_; ++i) parent[i] = i;
	}
	void init(int size_) {
		parent.resize(size_);
		height.resize(size_, 0);
		m_size.resize(size_, 1);
		for (int i = 0; i < size_; ++i) parent[i] = i;
	}
	int find(int x) {
		if (parent[x] == x) return x;
		return parent[x] = find(parent[x]);
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		int t = size(x) + size(y);
		m_size[x] = m_size[y] = t;
		if (height[x] < height[y]) parent[x] = y;
		else parent[y] = x;
		if (height[x] == height[y]) ++height[x];
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		if (parent[x] == x) return m_size[x];
		return size(parent[x] = find(parent[x]));
	}
};


int main() {

	int n, a, b, c, x;
	
	while (1) {
		cin >> n >> a >> b >> c >> x;
		if (n == 0) { return 0; }

		int y[100];
		for (int i = 0; i < n; i++) {
			cin >> y[i];
		}

		int i = 0, j = 0;
		bool swich = true;

		while (i <= 10000) {
			if (x == y[j]) { j++; if (j == n) { cout << i << endl; swich = false; break; } }

			x = (a*x + b) % c;
			i++;
		}
		if (swich) {
			cout << "-1" << endl;
		}
	}

}


Measured memory_bytes: 2996
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(a==b&&a!=c)
cout<<"Yes";
else if(a==c&&a!=b)
cout<<"Yes";
else if(b==c &&b!=a)
cout<<"Yes";
else
cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin >> s >> t;
    vector <ll> alp(26,0);
    vector <vector<ll>> alpha(26);
    for (int z=0;z<s.size();z++){
        alp[s[z]-'a']++;
        alpha[s[z]-'a'].push_back(z);
    }
    for (int z=0;z<t.size();z++){
        if (alp[t[z]-'a'] == 0) {
            cout << -1 << endl;
            return 0;
        }
    }
    ll c = 0;
    ll ans = 0;
    ll loop = 0;
    for (int z=0;z<t.size();z++){
        ll i = t[z]-'a';
        auto it = lower_bound(alpha[i].begin(),alpha[i].end(),c);
        if (it == alpha[i].end()){
            it = alpha[i].begin();
            loop++;
            c = *it+1;
            ans = *it;
        }
        else {
            c = *it+1;
            ans = *it;
        }
    }
    cout << loop*ll(s.size())+ans+1 << endl;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

pii qq[MAXN];

void solve(){
	int X, l, r, l1, r1, q1, q2, t, last;
	scanf("%d%d", &X, &q1);
	REP(i, 0, q1){
		scanf("%d", &qq[i]._1);
		qq[i]._2 = -1;
	}
	scanf("%d", &q2);
	REP(i, 0, q2){
		scanf("%d%d", &qq[i + q1]._1, &qq[i + q1]._2);
	}
	sort(qq, qq + q1 + q2);
	l = 0, l1 = 0, r = X, r1 = X, t = 'B', last = 0;
	REP(i, 0, q1 + q2){
		int cur = qq[i]._1;
		if (last != cur){
			int dif = cur - last;
			if (t == 'A'){
				l += dif;
				if (l > X){
					l1 -= l - X;
					l1 = max(l1, 0);
					l = X;
				}
				r += dif;
				if (r > X){
					r1 -= r - X;
					r1 = max(r1, 0);
					r = X;
				}
			} else {
				l -= dif;
				if (l < 0){
					l1 += -l;
					l1 = min(l1, X);
					l = 0;
				}
				r -= dif;
				if (r < 0){
					r1 += -r;
					r1 = min(r1, X);
					r = 0;
				}
			}
			last = cur;
		}
		if (qq[i]._2 != -1){
			int s = qq[i]._2;
			if (s <= l1){
				printf("%d\n", l);
			} else if (s >= r1){
				printf("%d\n", r);
			} else {
				printf("%d\n", l + (s - l1));
			}
		} else {
			t = 'A' + 'B' - t;
		}
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 2816
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>

using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
using pii=pair<int,int>;
using vs=vector<string>;
using vpii=vector<pii>;

#define REP(i,a) for(int i=0;i<a;i++)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rREP(i,a) for(int i=(a)-1;i>=0;i--)
#define rFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define out(S) cout<<(S)<<endl;
#define beginend(v) (v).begin(),(v).end()
#define IfOut(condition,text) if(condition){out(text);return 0;}
#define IfOutElse(condition,if_text,else_text) if(condition){out(if_text);return 0;}else{out(else_text);return 0;}
#define mod(s) ((s)%(ll)(1e9+7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a*modpow((ll)b,(ll)(1e9+5))))
#define pb(i) push_back(i)
#define fst first
#define snd second
#define Foreach(item,collection) for(auto item:collection)
#define INF 1e10
#define removeAll(vec,deleg) auto itr=remove_if(beginend(vec),deleg);vec.erase(itr,vec.end());
void removeAt(string& s, int index) { s.erase(index, 1); }
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
ll manhattanDistance(ll x1, ll y1, ll x2, ll y2) { return (abs(x2 - x1) + abs(y2 - y1)); }
vector<ll> sieveOfEratosthenes(int max) {ll prime;double sqrtmax = sqrt(max);vector<ll> primeVec, searchVec;FOR(i, 2, max + 1) searchVec.push_back(i);do{prime = searchVec[0];primeVec.push_back(prime);auto itr = remove_if(beginend(searchVec), [=](ll x)->bool {return x%prime == 0; });searchVec.erase(itr, searchVec.end());} while (prime < sqrtmax);primeVec.reserve(primeVec.size() + searchVec.size());primeVec.insert(primeVec.end(), beginend(searchVec));return primeVec;}
ll sum(vi v) {ll sum=0;Foreach(i,v){sum+=i;}return sum;}
#define ShowAll(v) Foreach(i,v) out(i);
ll tsum,hsum;

int check(const vi &h,int taro_item){
    REP(i,h.size()){
        if((tsum-taro_item+h[i])==(hsum+taro_item-h[i])) return i;
    } 
    return -1;
}

int main(){
    vs ans;
    int n,m;
    while (cin>>n>>m,!(!n&&!m))
    {
        vi t(n),h(m);
        REP(i,n) cin>>t[i];
        REP(i,m) cin>>h[i];
        int ti=0,hi=-1;
        tsum=sum(t);hsum=sum(h);
        while (ti<n)
        {
            hi=check(h,t[ti]);
            if(hi!=-1) break;
            ti++;
        }
        if(hi!=-1) ans.pb(to_string(t[ti])+" "+to_string(h[hi]));
        else ans.pb("-1");
    }
    ShowAll(ans);
    return 0;
}

Measured memory_bytes: 3176
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn main() {
    let v: Vec<i32> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let (n, x) = (v[0], v[1]);
    
    let limit: i32 = 1_000_000;
    let nums = ((x - n + 1)..(x + n))
        .filter(|&i| -limit <= i && i <= limit)
        .map(|x| x.to_string())
        .collect::<Vec<_>>();

    println!("{}", nums.join(" "));
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    vector<int> d(3);
    cin >> n >> d[0] >> d[1] >> d[2];
    vector<int> l(n);
    for (int i = 0; i < n; ++i)
        cin >> l[i];
    int odp = 3000;
    for (int mask1 = 0; mask1 < (1 << n); ++mask1)
    {
        if (__builtin_popcount(mask1) < 3)
            continue;
        vector<int> l2;
        for (int i = 0; i < n; ++i)
            if ((mask1 & (1 << i)) > 0)
                l2.push_back(l[i]);
        int n2 = l2.size();
        int zb = pow(3, n2);
        for (int mask2 = 0; mask2 < zb; ++mask2)
        {
            int t = mask2;
            vector<int> cyf;
            while (t != 0)
            {
                cyf.push_back(t % 3);
                t /= 3;
            }
            while (cyf.size() < n2)
                cyf.push_back(0);
            vector<int> il(3, 0);
            for (int i = 0; i < n2; ++i)
                ++il[cyf[i]];
            if (il[0] != 0 && il[1] != 0 && il[2] != 0)
            {
                int wyn = (il[0] + il[1] + il[2] - 3) * 10;
                vector<int> akt(3, 0);
                for (int i = 0; i < n2; ++i)
                    akt[cyf[i]] += l2[i];
                wyn += abs(akt[0] - d[0]) + abs(akt[1] - d[1]) + abs(akt[2] - d[2]);
                odp = min(odp, wyn);
            }
        }
    }
    cout << odp;
    return 0;
}


Measured memory_bytes: 512
// #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 1000005
#define INF (ll)1e18
#define pll pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define vv vector
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define repr(i,n) repr2(i,n,0)
#define repr2(i,m,n) for(ll i=m;i>=(n);i--)
#define get(n) ll (n); scanf("%lld",&(n));
#define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
#define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
#define gets(s) string (s); cin >> (s);
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); //cout.tie(0);
#define pi 3.1415926535897
#define db double
#define noop
#define flu fflush(stdout)
#define imp {cout<<"impossible\n"; return ;}
#define debug_vec(vec,n) {rep(idxi,n) cout<<vec[idxi]<<" "; cout<<endl;}

int main() {
    get2(n,k);
    get3(r,s,p);
    gets(t);

    // r = 0, s = 1. p = 2
    auto solve = [&](string ss) {
        ll sc = 0;
        ll nn = ss.size();
        vector<vector<ll>> dp(nn+1, vector<ll>(3,0));
        rep2(i,1,nn+1) {
            if(ss[i-1]=='r') {
                dp[i][0] = max(dp[i-1][1], dp[i-1][2]);
                dp[i][1] = max(dp[i-1][0], dp[i-1][2]);
                dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + p; 
            }
            if(ss[i-1]=='s') {
                dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + r;
                dp[i][1] = max(dp[i-1][0], dp[i-1][2]);
                dp[i][2] = max(dp[i-1][0], dp[i-1][1]); 
            }
            if(ss[i-1]=='p') {
                dp[i][0] = max(dp[i-1][1], dp[i-1][2]);
                dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + s;
                dp[i][2] = max(dp[i-1][0], dp[i-1][1]); 
            }
        }
        return max(dp[nn][0],max(dp[nn][1],dp[nn][2]));
    };

    ll res = 0;
    rep(i,k) {
        string ss; ll j = i;
        while(j<n) {
            ss += t[j];
            j += k;
        }
        res += solve(ss);
    }

    printf("%lld\n", res);
    return 0;  
}

Measured memory_bytes: 6016
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	string s; cin >> s;
	int used[26] = {};
	int n = s.length();
	bool f = true;
	rep(i, n) {
		int c = s[i] - 'a';
		if (used[c])f = false;
		else used[c] = 1;
	}
	if (f)cout << "yes" << endl;
	else cout << "no" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;

signed main(){
    int a, b;
    cin >> a >> b;
    if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0){
        cout << "Possible" << endl;
    }else{
        cout << "Impossible" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef long double ld;
 
//****************************************************                
#define f(var,start,end) for(ll var = start; var <end ; ++var)
#define rf(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define vvll vector<vector<ll>>
#define mtp make_tuple
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define nl cout<<"\n"
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define OC freopen("input.txt" , "r", stdin); freopen("output.txt" , "w", stdout) 
#define MOD (ll)1e9+7; //change it for other mods
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions
void solve();

int binary(int a[],int l,int r,int find)
{
    if(l>r)
    {
        return -1; 
    }else
    {
        int mid=(l+r)/2;
        if(a[mid]==find)
        {
            return mid+1;
        }else if(a[mid]>find)
        {
            binary(a,l,mid-1,find);
        }else
        {
            binary(a,mid+1,r,find);
        }   
    }   
}

int main()
{
    FAST_IO;
    ll testcases = 1;
    // cin >> testcases; //comment for 1 test case
    while(testcases--)
    {
        solve();
    }
}

void solve()
{
	ll n;
	cin>>n;
	ll b=360;
	ll g=__gcd(n,b);
	cout<<b/g;
	nl;
}

Measured memory_bytes: 3652
#include <stdio.h>

char S[55][55];
int board[55][55];

int main(){

	int H,W;

	scanf("%d %d",&H,&W);

	int i,j,k;

	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
		scanf(" %c",&S[i][j]);
		board[i][j]=-1;
		}
	}

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

	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			if(S[i][j]=='.'){
			int cnt=0;
			for(k=0;k<9;k++){
				if(0<=i+dy[k]&&i+dy[k]<H&&0<=j+dx[k]&&j+dx[k]<W){
					if(S[i+dy[k]][j+dx[k]]=='#'){cnt++;}
				}
			}
			board[i][j]=cnt;
			}

		}
	}
	
	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			if(board[i][j]==-1){printf("#");}
			else{printf("%d",board[i][j]);}
		}
		printf("\n");
	}


return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define int ll
typedef pair<int, int> pii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
constexpr int INF = 1e9;
constexpr int MOD = 1e9+7;

string x357 = "357";

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

    string n = to_string(N);
    int ans = 0;
    FOR(i, 0, pow(3, n.size())) {
        for(int j = 1; j <= n.size(); j++) {
            string num = "";
            string ternary = "";
            int tmp = i;
            while(1) {
                int x = tmp % 3;
                tmp /= 3;
                ternary = ternary + to_string(x);
                if (tmp == 0) break;
            }
            reverse(ternary.begin(), ternary.end());
            if (j < ternary.size()) continue;
            while (ternary.size() < j) {
                ternary = "0" + ternary;
            }
            //cout << ternary << endl;
            REP(k, ternary.size()) {
                num = num + x357[ternary[k] - '0'];
            }
            //cout << num << endl;
            bool flag3 = false;
            bool flag5 = false;
            bool flag7 = false;
            REP(l, num.size()) {
                if (num[l] == '3') flag3=true;
                else if (num[l] == '5') flag5 = true;
                else if (num[l] == '7') flag7 = true;
            }
            int nn = atoi(num.c_str());
            if (flag3 && flag5 && flag7 && nn <= N) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    int x; cin>>x;
    long sum=0,ans;
    rep(i,x+1){
        sum+=i;
        if(x<=sum) {ans=i;break;}
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
using namespace std;
typedef long long ll;
const int N=200005;
int a[N];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),a[i]-=i;
	sort(a+1,a+n+1);
	int b=a[(n+1)/2];
	ll ans=0;
	for(int i=1;i<=n;i++) ans+=abs(a[i]-b);
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) (a).begin(), (a).end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline int sz(T &x) { return x.size(); }
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int fLog2(const int x) { assert(x > 0); return 31-__builtin_clz(x); } // floor(log2(x))
inline int fLog2(const ll x) { assert(x > 0); return 63-__builtin_clzll(x); }
inline int cLog2(const int x) { assert(x > 0); return (x == 1) ? 0 : 32-__builtin_clz(x-1); } // ceil(log2(x))
inline int cLog2(const ll x) { assert(x > 0); return (x == 1) ? 0 : 64-__builtin_clzll(x-1); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
void fail() { puts("-1"); exit(0); }
// const int INF  = 1<<30;
// const ll INFll = 1ll<<62;
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
// const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  ll n, d; cin >> n >> d;
  d *= d;

  int ans = 0;
  rep(i, n) {
    ll x, y; cin >> x >> y;
    if (x*x + y*y <= d) ++ans;
  }

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>

#define int long long

struct edge {
    int to;
    int cost;
};

using namespace std;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vb = vector<bool>;
using qi = queue<int>;
using P = pair<int, int>;
using graph = vector<vector<edge>>;
// using graph = vector<vector<int>>;


#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define delim(i, n) cout << (i == n-1 ? "\n" : " ");
#define pv(v, n) REP(i, n) { cout << v[i]; delim(i, n); }

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

const int inf = 1LL << 60;
// const int inf = 100000000;
const int mod = 1000000007;

const int maxn = 5000;
int n = 10;
int h, w;
vii dist(n, vi(n));
vi cnt(11);

vi dx = {-1, 0, 0, 1};
vi dy = {0, -1, 1, 0};

void warshall_floyd() {
    REP(i, n) {
        REP(j, n) {
            REP(k, n) {
                if (dist[j][i] == inf || dist[i][k] == inf) continue;
                // min(inf, inf + (N<0)) should be inf but not
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

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

    cin >> h >> w;
    REP(i, 10) {
        REP(j, 10) {
            cin >> dist[i][j];
        }
    }
    REP(i, h) {
        REP(j, w) {
            int tmp; cin >> tmp;
            cnt[tmp+1]++;
        }
    }

    warshall_floyd();

    int ret = cnt[1]*dist[0][1];
    FOR(i, 2, 10) {
        ret += cnt[i+1]*dist[i][1];
    }
    
    cout << std::fixed << std::setprecision(10) << ret << "\n";
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
const int MOD = 1000000007;
using mint = Fp<MOD>;

const int MAX=200000;
mint fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i;
        inv[i] = (mint)MOD - inv[MOD%i] * (MOD / i);
        finv[i] = finv[i - 1] * inv[i];
    }
}

mint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[k] * finv[n - k];
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll s;
    cin>>s;
    COMinit();
    mint ans=0;
    rep1(i,s/3){
        ans+=COM(i-1+s-i*3,i-1);
    }
    cout<<ans;
}

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

int main(){
  int N,K,X,Y;
  cin>>N>>K>>X>>Y;
  int ans=0;
  for(int i=0; i<N; i++){
    if(i<K){
      ans+=X;
    }
    else{
      ans+=Y;
    }
  }
  cout<<ans<<endl;
}

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

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


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

bool check(int a, int b) {
	return a > b;
}

int main() {
	vector<int>a(6);
	rep(i, 6) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int cnt = 0;
	rep(i, 6) {
		if (i >= 5) {
			cnt++;
			break;
		}
		if (a[i] != a[i + 1]) {
			cnt++;
		}
		else {
			i++;
		}
	}
	if (cnt == 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n, k;
  cin >> n >> k;

  vll a(n + 1);
  REP(i, n + 1) {
    cin >> a[i];
  }

  vll visited(n + 1, -1);
  ll idx = 1;
  ll cnt = 0;
  vll trace;

  while (visited[idx] == -1) {
    visited[idx] = cnt;
    trace.push_back(idx);
    idx = a[idx];
    cnt++;
  }

  ll offset = visited[idx];
  ll loop = cnt - offset;

  ll val = k;
  if (val < offset) {
    cout << trace[val] << endl;
  } else {
    val -= offset;
    val %= loop;
    val += offset;
    cout << trace[val] << endl;
  }

  return 0;
}


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

int main(){
	int N, M;
	cin >> N >> M;
	cout << N * (N - 1) / 2 + M * (M - 1) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cctype>
const int maxn=610,mod=1000000007;
int n,m;
int r[maxn],s[maxn];
int f[maxn][maxn],g[maxn];
int w;
int In() {
	register char c;
	for(;c=getchar(),c!='-'&&!isdigit(c););
	register bool f=c=='-';
	register int s=f?0:c-'0';
	for(;c=getchar(),isdigit(c);)s=s*10+c-'0';
	return f?-s:s;
}
int main() {
	n=In(),m=In();
	for(register int i=1,x,y;i<=m;++i)x=In(),y=In(),r[x]=y,r[y]=x;
	g[0]=1;
	for(register int i=2;i<=n*2;i+=2)g[i]=(i-1ll)*g[i-2]%mod,s[i]=(s[i-1]=s[i-2]+!r[i-1])+!r[i];
	for(register int i=1;i<=n*2;++i)for(register int j=i+1;j<=n*2;j+=2) {
		register bool tg=0;
		for(register int k=1;k<i;++k)if(r[k]>=i&&r[k]<=j) tg=1;
		for(register int k=n*2;k>j;--k)if(r[k]>=i&&r[k]<=j) tg=1;
		if(!tg) {
			f[i][j]=g[s[j]-s[i-1]];
			for(register int k=i+1;k<j;k+=2)f[i][j]=(f[i][j]-1ll*f[i][k]*g[s[j]-s[k]])%mod;
			w=(w+1ll*f[i][j]*g[s[i-1]+s[n*2]-s[j]])%mod;
		}
	}
	printf("%d\n",(w+mod)%mod);
	return 0;
}

Measured memory_bytes: 1536
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
  char s[102];
  cin>>s;
  if(strlen(s)<=n) cout<<s;else{for(int i=0;i<n;i++) cout<<s[i];cout<<"...";}


    return 0;
}


Measured memory_bytes: 3640
n=int(input())
ans=0
a=0
b=0
flg=1
for _ in range(n):
  s=input()
  for i in range(len(s)-1):
    if s[i:i+2]=="AB":
      ans+=1
  if s[0]=="B":
    b+=1
    if s[-1]!="A":
      flg=0
  if s[-1]=="A":
    a+=1
    if s[0]!="B":
      flg=0
if flg:
  ans+=max(0,min(a,b)-1)
else:
  ans+=min(a,b)
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <string>

using namespace::std;

int N, A[100000], B[100000];
long long int amax, nmax;
bool m;
void m_sort(int a[], int tmp[], int left, int right);
void m_sort(int a[], int tmp[], int left, int right);
void sort(int a[], int total) {
	int tmp;
	for (int i = 0; i < total; i++) {
		for (int j = i + 1; j < total; j++) {
			if (a[i] < a[j]) {
				tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
	}

}

void mergeSort(int a[], int tmp[], int size)
{
	m_sort(a, tmp, 0, size - 1);
}
void merge(int a[], int tmp[], int left, int mid, int right)
{
	int i, left_end, num_elements, tmp_pos;

	left_end = mid - 1;
	tmp_pos = left;
	num_elements = right - left + 1; // 要素 

	while ((left <= left_end) && (mid <= right))
	{
		if (a[left] <= a[mid])
		{
			tmp[tmp_pos] = a[left];
			tmp_pos = tmp_pos + 1;
			left = left + 1;
		}
		else
		{
			tmp[tmp_pos] = a[mid];
			tmp_pos = tmp_pos + 1;
			mid = mid + 1;
		}
	}


	while (left <= left_end)
	{
		tmp[tmp_pos] = a[left];
		left = left + 1;
		tmp_pos = tmp_pos + 1;
	}

	while (mid <= right)
	{
		tmp[tmp_pos] = a[mid];
		mid = mid + 1;
		tmp_pos = tmp_pos + 1;
	}


	for (i = 0; i <= num_elements; i++)
	{
		a[right] = tmp[right];
		right = right - 1;
	}
}
void m_sort(int a[], int tmp[], int left, int right)
{
	int mid;

	if (right > left)
	{
		mid = (right + left) / 2; 
		m_sort(a, tmp, left, mid);
		m_sort(a, tmp, mid + 1, right);

		merge(a, tmp, left, mid + 1, right);
	}
}


int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	nmax = 0;
	m = false;
	mergeSort(A, B, N);
	for (int i = N-1; i > 0; i--) {
		if (!m) {
			if (A[i] == A[i - 1]) {
				amax = A[i];
				i--;
				m = true;
			}
		}
		else {
		if (A[i] == A[i - 1]) {
			nmax = A[i];
			break;
			}
		}
	}
		cout << amax*nmax;

	
		}


	


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

using namespace std;

int main()
{

    string s, p;
    cin >> s >> p;
    s += s;

    for(int i = 0; i < s.size()/2; i++){
        bool flag = true;
        for(int j = 0; j < p.size(); j++){
            if(s.at(i+j) != p.at(j)){
                flag = false;
                break;
            }
        }
        if(flag){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3220
#include<iostream>
using namespace std;
int main(){
	string n;
	cin>>n;
	int a=n.length();
	if(a==2)
	cout<<n<<endl;
	else if(a==3){
		for(int i=a-1;i>=0;i--){
			printf("%c",n[i]);
		}
		printf("\n");
	}
	return 0;
} 

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

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           ((ll)x.size())
#define hell            (1000000007)
#define inf             ((ll)5e18 + 5)
#define PI              ((double)3.14159265358979323844)
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

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

using namespace std;
using namespace __gnu_pbds;

/*----------------------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
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n;
    cin>>n;
    if (n>=30) {
        cout<<"Yes"<<endl;
        return;
    }
    cout<<"No"<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  //餅の配列
  vector<int> mochis(N);
  for (int i = 0; i < N; i++) {
    cin >> mochis.at(i);
  }
  
  //大きい順に配列
  sort(mochis.begin(), mochis.end());
  reverse(mochis.begin(), mochis.end());
  
  int rank = 1; //段数
  int last = mochis.at(0); //最下段
  
  for (int i = 1; i < N; i++) {
    if (mochis.at(i) < last) {
      rank += 1;
      last = mochis.at(i);
    }
  }
  cout << rank << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int main(){
    int num,i,j,minj,key,cnt=0;
    int data[N];

    scanf("%d",&num);

    for(i=0;i<num;i++){
        scanf("%d",&data[i]);
    }

    for(i=0;i<num;i++){
        minj = i;
        for(j=i;j<num;j++){
            if(data[j] < data[minj]){ 
                minj = j;
            }
        }
        if(minj != i){
            key = data[i];
            data[i] = data[minj];
            data[minj] = key;
            cnt++;
        }
    }

    for(i=0;i<num;i++){
        printf("%d",data[i]);
        if(i == num - 1) printf("\n");
        if(i != num - 1) printf(" ");
    }
    printf("%d\n",cnt);
    return 0;
}



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

int main(){
  string str;
  cin >> str;
  if (str=="SUN") cout<<7<<endl;
  if (str=="MON") cout<<6<<endl;
  if (str=="TUE") cout<<5<<endl;
  if (str=="WED") cout<<4<<endl;
  if (str=="THU") cout<<3<<endl;
  if (str=="FRI") cout<<2<<endl;
  if (str=="SAT") cout<<1<<endl;
  
}

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

typedef long long ll;

int N;
ll A[100010];
ll l = 2,r = 2;

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++)scanf("%lld",A + i);
    for(int i = N - 1; i >= 0; i--)
    {
        if(l % A[i] == 0 || l / A[i] * A[i] + A[i] <= r)
        {
            l = ((l + A[i] - 1) / A[i]) * A[i];
            r = (r / A[i]) * A[i] + A[i] - 1;
        }
        else
        {
            printf("-1\n");
            return 0;
        }
    }

    printf("%lld %lld\n",l,r);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
long long int dp[100001][101],a[101][2];
long long int n,w,i,j,item,wt,v_max,w_max;

long long int solve(long long int value,long long int i)
{
    if (value <= 0) 
        return 0; 
    if (i == n+1) 
        return w_max; 
    if (dp[value][i]) 
        return dp[value][i];
    dp[value][i] = std::min(solve(value,i+1), a[i-1][0]+solve(value-a[i-1][1],i+1)); 
    return dp[value][i]; 
}
int main() {
    cin>>n>>w;
    v_max = 0;
    for(i=0;i<n;i++)
    {
        cin>>a[i][0]>>a[i][1];
        v_max = v_max+ a[i][1];
        w_max = w_max + a[i][0];
    }
    for(i=v_max;i>=0;i--)
    {
        if (solve(i,0) <= w) 
        { 
            cout<<i<<endl;
            break;
        } 
    }
}
    

Measured memory_bytes: 78464
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

MOD = 10**9+7

devices = []

n = ni()
for _ in range(n):
    a = ni()
    devices.append((a, 1))
    
for _ in range(n):
    b = ni()
    devices.append((b, -1))
    
devices.sort()

pc = [0,0]

ans = 1
for point, typ in devices:
    if typ == 1 and pc[1] > 0:
        ans = (ans * pc[1]) % MOD
        pc[1] -= 1
        
    elif typ == 1:
        pc[0] += 1
        
    elif typ == -1 and pc[0] > 0:
        ans = (ans * pc[0]) % MOD
        pc[0] -= 1
        
    elif typ == -1:
        pc[1] += 1
        
print(ans)

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, n, m, c);
  vector<int> b(m);
  rep(i, m) cin >> b[i];
  int ans = 0;
  rep(i, n) {
    vector<int> a(m);
    rep(j, m) cin >> a[j];
    int res = c;
    rep(j, m) res += a[j] * b[j];
    if (res > 0) ++ans;
  }
  out(ans);
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iomanip>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define For(i,x,y) for(int i = x; i <= y; ++i)
#define FOR For
#define rev_For(i,x,y) for(int i = x; i >= y; --i)
#define REV_FOR rev_For
#define ll long long
#define Size(v) ((int)v.size())
#define _section "\n--------------------\n"
#define fi first
#define se second
#define pb push_back
using namespace std;
// using namespace __gnu_pbds;


string s, t;

void input() {
	cin >> s >> t;
}

void solve() {
	int sz = Size(s);
	for (int i = 0; i < sz; ++i) {
		if (s[i] != t[i]) {
			cout << "No";
			return;
		}
	}
	cout << "Yes";
}

signed main() {
#ifdef _DEBUG
	// freopen("INPUT.inp", "r", stdin);
	//freopen("OUTPUT.out", "w", stdout);
	clock_t start, end;
	start = clock();
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
//------------------------------------------------------------------------------------
//----------------------------------MAIN PROGRAM--------------------------------------
	int t = 1;
	while (t--) {
		input();
		solve();
	}
//--------------------------------------END-------------------------------------------
//------------------------------------------------------------------------------------
#ifdef _DEBUG
	end = clock();
	cerr << "\n----------\nTime Elapsed: " << fixed << double(end - start) / double(CLOCKS_PER_SEC) << setprecision(6) << '\n';
#endif
	return 0;
}

Measured memory_bytes: 3684