akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vint x(n);
  vint y(n);
  vint p(n);
  rep(i,n){
    cin>>x[i]>>y[i];
    p[i]=i;
  }
  long double count=0,sum=0;
  do{
    rep(i,n-1){
      sum+=sqrt(pow(x[p[i]]-x[p[i+1]],2.0)+pow(y[p[i]]-y[p[i+1]],2.0));
    }
    count++;
  }while(next_permutation(all(p)));
  cout<<fixed<<stp(8)<<sum/count<<'\n';
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;

// graph template
template<typename T>
class edge{
    public:
        int src, to; T cost;

        edge(int to, T cost): src(-1), to(to), cost(cost){}
        edge(int src, int to, T cost): src(src), to(to), cost(cost){}
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using AdjacencyList = vector<Edges<T>>;
template<typename T>
using Matrix = vector<vector<T>>;

template<typename T>
vector<T> dijkstra(AdjacencyList<T> &g, int s){
    const auto INF = numeric_limits<T>::max();
    vector<T> dist(g.size(), INF);

    using Pr = pair<T, int>;
    priority_queue<Pr, vector<Pr>, greater<Pr>> que;
    dist[s] = 0;
    que.emplace(dist[s], s);

    while(not que.empty()){
        T cost; int v;
        tie(cost, v) = que.top(); que.pop();
        if(dist[v] < cost) continue;

        for(auto &e: g[v]){
            if(dist[e.to] > dist[v] + e.cost){
                dist[e.to] = dist[v] + e.cost;
                que.emplace(dist[e.to], e.to);
            }
        }
    }

    return dist;
}

int main(void){
    int N; 
    cin >> N;
    AdjacencyList<ll> G(N);
    for(int i = 0; i < N-1; i++){
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        G[a].push_back(edge<ll>(b, c));
        G[b].push_back(edge<ll>(a, c));
    }

    int Q, K;
    cin >> Q >> K;
    vector<ll> dist = dijkstra(G, K-1);
    // for(int i = 0; i < N; i++) printf("dist[%d] = %lld\n", i, dist[i]);
    vector<ll> res(Q);
    for(int i = 0; i < Q; i++){
        int x, y;
        cin >> x >> y;
        x--; y--;
        res[i] = (dist[x] + dist[y]);
    }

    for(int i = 0; i < Q; i++){
        cout << res[i] << '\n';
    }

    return 0;
}

Measured memory_bytes: 11120
q = (%w{+ - *}*3).combination(3).to_a
w = %w{
  (%d%s%d)%s(%d%s%d)
  %d%s((%d%s%d)%s%d)
  %d%s(%d%s(%d%s%d))
  ((%d%s%d)%s%d)%s%d
  (%d%s(%d%s%d))%s%d
}
while"0 0 0 0\n"!=s=gets
  f = nil
  s.split.permutation.map{|a,b,c,d|
    q.map{|x,y,z|
      w.map{|e|
        e = e%[a,x,b,y,c,z,d]
        if eval(e) == 10
          f = 1
          puts e
          break
        end
      }
      break if f
    }
    break if f
  }
  p 0 if !f
end

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

int main() {
	long long n,q,s;
	scanf("%lld",&n);
	q=sqrt(n);
	for(int i=q;i>0;i--)
	if (n%i==0) {s=i+n/i;break;}
	printf("%lld",s-2);
	return 0;
}


Measured memory_bytes: 256
S = str(input())
K = int(input())
N = len(S)
L = set([])

for i in range(N):
  temp = S[i]
  L.add(temp)
  for j in range(1,min(N-i,K)):
    temp += S[i+j]
    L.add(temp)
#print(L)
L = list(L)
L.sort()
print(L[K-1])

Measured memory_bytes: 10512
#include <iostream>

using namespace std;

int main() {
	int n, flag = 0;
	int yen[] = { 10,50,100,500 };
	while (cin >> n && n) {
		if (flag) cout << endl;
		int bheld[4], used[4];
		int sum = 0;
		for (int i = 0; i < 4; ++i) {
			cin >> bheld[i];
			sum += bheld[i] * yen[i];
		}
		sum -= n;
		for (int i = 3; i >= 0; --i) {
			int aheld = sum / yen[i]; sum %= yen[i];
			used[i] = (bheld[i] > aheld) ? bheld[i] - aheld : 0;
		}
		for (int i = 0; i < 4; ++i)
			if (used[i] > 0) cout << yen[i] << " " << used[i] << endl;
		flag++;
	}

	return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
int main(int argc, char const *argv[])
{
	ll l,r;
	cin>>l>>r;
	if(r >= l + 2019)
	{
		printf("0\n");
		return 0;
	}
	ll ans = 10000;
	for(ll i = l;i <= r; ++i)
	{
		for(ll j = i + 1;j <= r; ++j)
		{
			ans = min(ans,((i % 2019) * (j % 2019) % 2019));
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;

void solve(){
    int n,m;
    cin>>n>>m;
    int s=0;
    int a[n];
    rep(i,0,n) cin>>a[i],s+=a[i];
    int ctr=0;
    int x=s;
    rep(i,0,n){
        if((a[i]*4*m)>=x) ctr++;
    }
    cout<<(ctr>=m?"Yes":"No");
}

int main(){ 
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC target("avx")
//#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

constexpr int cm = 1<<17;
char cn[cm], *ci = cn + cm, ct;

inline char readchar() {
	if (ci - cn == cm) {
    fread(cn, 1, cm, stdin); 
    ci = cn;
  }
	return *ci++;
}
inline int readint() {
	int ret = 0;
	if (ci - cn + 16 > cm) {
    while ((ct = readchar()) >= '0') {
      ret = (ret<<3) + (ret<<1) + ct - '0';
    }
  } else {
    while ((ct = *ci++) >= '0') {
      ret = (ret<<3) + (ret<<1) + ct - '0';
    }
  }
	return ret;
}

int cnt[202020];
template<typename T> void fastout(T &n) {
  T N = n, rev, count = 0;
  rev = N;
  if (N == 0) {
    putchar_unlocked('0');
    putchar_unlocked('\n');
    return;
  }
  while ((rev % 10) == 0) { 
    ++count; rev /= 10;
  }
  rev = 0;
  while (N != 0) { 
    rev = (rev << 3) + (rev << 1) + N % 10;
    N /= 10;
  }
  while (rev != 0) { 
    putchar_unlocked(rev % 10 + '0');
    rev /= 10;
  }
  while (count--) putchar_unlocked('0');
  putchar_unlocked('\n');
}
int main(){;
  int n = readint(); int k = readint();
  
  for (int i = n - 1; i >= 0; --i) {
    int x = readint();
    ++cnt[x];
  }

  sort(cnt, cnt + n + 1 , greater<int>());

  n -= accumulate(cnt, cnt + k, int());

  fastout(n);

  return 0;
}


Measured memory_bytes: 1152
#pragma warning (disable :4996)
#include <bits/stdc++.h>
#define ll long long
#define eps 1e-7
using namespace std;

int a[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
int main() {
	int n;
	cin >> n;
	cout << a[n - 1] << endl;
}

Measured memory_bytes: 256
//E.H//
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
ll n,arr[200005];  
ll cnt;
vector<pair<ll,int> > v;
ll f(int idx){
    pii x={arr[idx],1};
    while(v.empty()==false && v.back().fi > x.fi ){
        x.se+=v.back().se;
        cnt-=(v.back().fi * v.back().se);
        v.pop_back();
    }
    v.pb(x);
    cnt+=(v.back().fi * v.back().se);
    return cnt;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;
    ll ans=0;
    for(int i=1;i<=n;i++){
        cin>>arr[i];

    }
    for(int i=n;i>=1;i--){
        ans+=f(i);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 8812
import math


def gcd(x, y):
    while (y):
        x, y = y, x % y
    return x


def lcm(x, y):
    return (x * y) // gcd(x, y)


N = int(input())
T = []

for _ in range(N):
    T.append(int(input()))

ans = T[0]

for t in T:
    ans = lcm(ans, t)

print(ans)


Measured memory_bytes: 3060
#pragma GCC optimize "Ofast"
#pragma GCC optimize "unroll-loops"
#pragma GCC target "sse,sse2,sse3,sse4,abm,avx,mmx,popcnt,tune=native"
#include <bits/stdc++.h>
#define scan(x) do{while((x=getchar_unlocked())<'0'); for(x-='0'; '0'<=(_=getchar_unlocked()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define ll long long
#define MAXN 510
#define INF 0x3f3f3f3f
#define min(a, b) (a) < (b) ? (a) : (b)
#define max(a, b) (a) < (b) ? (b) : (a)
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define f first
#define s second
#define mii map<int, int>
#define umii unordered_map<int, int>
#ifdef DEBUG
	#define D(x...) printf(x)
#else
	#define D(x...)
#endif
using namespace std;

int N, M, Q;
vi v[MAXN];

int main (int argc, char const *argv[]) {
	#ifdef NOT_DMOJ
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	#endif // NOT_DMOJ
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> N >> M >> Q;
	for (int i=0, l, r; i<M; i++) {
		cin >> l >> r;
		v[l].pb(r);
	}
	for (int i=0; i<N; i++) sort(v[i].begin(), v[i].end());
	for (int i=0, p, q; i<Q; i++) {
		cin >> p >> q;
		int ans = 0;
		for (int j=p; j<=q; j++) {
			int ind = lower_bound(v[j].begin(), v[j].end(), q + 1) - v[j].begin();
			ans += ind;
		}
		cout << ans << "\n";
	}
	return 0;
}

/* 
 * Look for:
 * the exact constraints (multiple sets are too slow for n=10^6 :( ) 
 * special cases (n=1?)
 * overflow (ll vs int?)
 * array bounds
 */

Measured memory_bytes: 2176
n,m= list(map(int, input().strip().split()))
a = []
for i in range(m):
    a.append(list(map(int, input().strip().split())))
b=[0]*(2*m)
for i in range(m):
    b[2*i]=a[i][0]
    b[2*i+1]=a[i][1]
for i in range(n):
    print(b.count(i+1))

Measured memory_bytes: 9204
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

class comb{
private:
    ll mod;
    ll mx;
    vector<ll> F;
    vector<ll> FR;
    
public:
    comb(ll mod=1000000007,ll mx=1000000):mod(mod),mx(mx),F(mx+1,1),FR(mx+1,1){
        mk_F();
    }
    
    ll mod_pow(ll a,ll x){
        a%=mod;
        ll ans=1;
        while(x>0){
            if(x&1){ans*=a; ans%=mod;}
            a*=a;
            a%=mod;
            x>>=1;
        }
        return ans;
    }
    
    pll Ex_gcd(ll a,ll b){
        if(b==0){return {1,0};}
        pll ret=Ex_gcd(b,a%b);
        ret.F-=a/b*ret.S;
        return {ret.S,ret.F};
    }
    
    ll prime_R(ll a){
        return mod_pow(a,mod-2);
    }
    
    ll R(ll a){
        ll ret=Ex_gcd(a,mod).F;
        ret%=mod;
        if(ret<0){ret+=mod;}
        return ret;
    }
    
    void mk_F(){
        for(ll i=1;i<=mx;i++){F[i]=F[i-1]*i%mod; FR[i]=R(F[i]);}
    }
    
    ll c(ll n,ll k){
        if(n<k){return 0;}
        if(n==k || k==0){return 1;}
        return F[n]*FR[n-k]%mod*FR[k]%mod;
    }
    
    //mod must be prime
    ll Lucas_C(ll n,ll m){
        ll ret=1;
        while(n>0 || m>0){
            ret*=c(n%mod,m%mod);
            ret%=mod;
            n/=mod; m/=mod;
        }
        return ret;
    }
    
    ll Stirling(ll n,ll k){
        ll ret=0;
        for(ll i=1;i<=k;i++){
            if((k-i)%2){ret-=c(k,i)*mod_pow(i,n)%mod;}
            else{ret+=c(k,i)*mod_pow(i,n)%mod;}
            ret%=mod;
        }
        ret*=R(F[k]);
        ret%=mod;
        if(ret<0){ret+=mod;}
        return ret;
    }
    
    ll Bell(ll n,ll k){
        ll ret=0;
        for(ll i=1;i<=k;i++){ret+=Stirling(n,i); ret%=mod;}
        return ret;
    }
};

comb C;

int main(){
    ll b,w;
    cin>>b>>w;
    ll p=0,q=0;
    ll inv=(MOD+1)/2;
    ll T=1;
    ll all=1;
    for(ll i=0;i<b+w;i++){
        ll ans=q*T%MOD;
        ans+=(all-p-q)*T%MOD*inv%MOD;
        ans%=MOD;
        if(ans<0){ans+=MOD;}
        cout<<ans<<endl;
        all*=2;
        all%=MOD;
        p*=2;
        q*=2;
        if(i+1>=b){
            p+=C.c(i,b-1);
        }
        if(i+1>=w){
            q+=C.c(i,w-1);
        }
        p%=MOD;
        q%=MOD;
        T*=inv;
        T%=MOD;
    }
    
    
    return 0;
}


Measured memory_bytes: 17792
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] A = new int[N];
            int[] B = new int[N];

            string[] s = Console.ReadLine().Split(' ');
            for (int i = 0; i < N - 1; i++)
            {
                B[i] = int.Parse(s[i]);
            }

            A[0] = B[0];
            for (int i = 1; i < N - 1; i++)
            {
                A[i] = Math.Min(B[i - 1], B[i]);
            }
            A[N - 1] = B[N - 2];

            long ans = 0;
            for (int i = 0; i < N; i++)
            {
                ans += A[i];
            }

            Console.WriteLine(ans);
        }
    }
}




Measured memory_bytes: 11092
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

signed main(){
	cout<<fixed<<setprecision(7);
	int x;
	
	cin>>x;
	
	
	// cout<<(x/11)*2 + (x%11 > 5 ?1:0) + (x%11?0:-1) + 1<<endl;
	cout<<(x/11)*2 + (x%11 > 6 ?1:0) + (x%11?0:-1) + 1<<endl;
	
	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

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



int main(void) {
	int a, b;
	int total = 0;

	cin >> a >> b;

	if (a > b) {
		total += a;
		a--;
	}
	else {
		total += b;
		b--;
	}
	total += max(a, b);
	cout << total << endl;

	return 0;
}

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 1e18 * 2;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	string s;
	cin >> s;
	int i, j, x, y;
	cin >> x >> y;
	vi tate, yoko;
	int dir = 0;
	int cnt = 0;
	for (i = 0; i < s.size(); i++) {
		if (s[i] == 'F') {
			cnt++;
		}
		else {
			if (dir == 0) {
				yoko.push_back(cnt);
			}
			else {
				tate.push_back(cnt);
			}
			cnt = 0;
			dir = 1 - dir;
		}
	}
	if (dir == 0) {
		yoko.push_back(cnt);
	}
	else {
		tate.push_back(cnt);
	}
	x -= yoko[0];
	if (x < -8050) {
		cout << "No" << endl;
		return 0;
	}
	yoko.erase(yoko.begin());
	/*
	DEBUG_VEC(yoko);
	DEBUG_VEC(tate);
	DEBUG(x);
	DEBUG(y);
	*/
	vector<vector<bool> > dpyoko(yoko.size()+1,vector<bool> (16100, false)), dptate(tate.size()+1,vector<bool>(16100, false));
	dpyoko[0][8050] = dptate[0][8050] = true;
	for (i = 0; i < yoko.size(); i++) {
		for (j = 0; j < 16100; j++) {
			if (dpyoko[i][j]) {
				dpyoko[i + 1][j + yoko[i]] = true;
				dpyoko[i + 1][j - yoko[i]] = true;
			}
		}
	}
	for (i = 0; i < tate.size(); i++) {
		for (j = 0; j < 16100; j++) {
			if (dptate[i][j]) {
				dptate[i + 1][j + tate[i]] = true;
				dptate[i + 1][j - tate[i]] = true;
			}
		}
	}
	if (dpyoko[yoko.size()][x + 8050] && dptate[tate.size()][y + 8050]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 16384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, k;
  cin >> n >> k;
  cout << (k == 1 ? 0 : n - k) << endl;
}

Measured memory_bytes: 3620
s = input()
s1 = s[0:2]
s2 = s[2:4]
if s1[0] == "0":
    s1 = int(s1[1])
else:
    s1 = int(s1)
if s2[0] == "0":
    s2 = int(s2[1])
else:
    s2 = int(s2)
if 0 < s1 < 13 and 0 < s2 < 13:
    print("AMBIGUOUS")
elif 0 < s2 < 13:
    print("YYMM")
elif 0 < s1 < 13:
    print("MMYY")
else:
    print("NA")



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
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 T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=998244353;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};

vector<int> a;
string s;
vector<vector<int>> dp(18,vector<int> (1<<18,-1));
int n;

int dfs(int k,int l,int r){
    if(k == n) return a[l];
    if(~dp[k][l]) return dp[k][l];
    int N = 1 << n;
    int p = 1 << (n - k - 1);
    int L = dfs(k + 1, l, (r - p + N)%N), R = dfs(k + 1, (l + p)%N, r);
    if(R < L) swap(L, R);
    int ret;
    if(s[R - L - 1] == '1'){
        ret = R;
    }
    else{
        ret = L;
    }
    return dp[k][l] = ret;
}




int main(){
    cin >> n;
    int N = 1 << n;
    cin >> s;
    a.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < N; i++) {
        printf("%d\n",dfs(0, i, i));
    }
    return 0;
}




Measured memory_bytes: 23096
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int r = scan.nextInt(), c = scan.nextInt();
        int[][] a = new int[r + 1][c + 1];

        // r ?????c ???????´????????????¨????????????????´?????????¨???
        for (int i = 0; i < r; i++) {
            for (int j = 0; j < c; j++) {
                a[i][c] += a[i][j] = scan.nextInt();
                a[r][j] += a[i][j];
                a[r][c] += a[i][j];
            }
        }
        for (int i = 0; i < r + 1; i++) {
            for (int j = 0; j < c; j++) {
                    System.out.print(a[i][j] + " ");
            }
            System.out.println(a[i][c]);
        }

    }
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e2;
const int M = (int) 1e5;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int n, m;
ll f[N + 1][M + 1];
int v[N + 1];
int w[N + 1];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    cin >> n >> m;
    FOR(i, 1, n)
    {
        cin >> w[i] >> v[i];
    }
    FOR(i, 1, n)
    {
        FOR(j, 1, m)
            if(j >= w[i])
                f[i][j] = max(f[i - 1][j], f[i - 1][j - w[i]] + v[i]);
            else f[i][j] = f[i - 1][j];
    }
    cout << f[n][m];
    return 0;
}


Measured memory_bytes: 78336
n = int(input())
A = list(map(int, input().split()))

ans = 1
up = dn = False
pre = A[0]
for a in A[1:]:
    if pre < a:
        up = True
    elif pre > a:
        dn = True
    if up and dn:
        ans += 1
        up = dn = False
    pre = a

print(ans)


Measured memory_bytes: 86284
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,d;
  cin>>N>>d;
  if(d!=0){
    puts("0");
    return 0;
  }
  vector<int> A(N,0);
  A[0]=1;
  for(int i=0;i<N-1;i++){
    int D;
    cin>>D;
    if(D>=N){
      puts("0");
      return 0;
    }
    A[D]++;
  }
  if(A[0]!=1){
    puts("0");
    return 0;
  }
  int ans=1;
  bool b=true;
  for(int i=1;i<N;i++){
    if(!b && A[i]!=0){
      puts("0");
      return 0;
    }
    for(int j=0;j<A[i];j++)
      ans=ans*A[i-1]%998244353;
    b=A[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4032
//  Copyright 2019 Nikita Golikov

#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::cerr;

int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a, b;
  cin >> a >> b;
  cout << (3 * a + b) / 2 << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

bool used[1000009];

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

    int k;
    cin >> k;

    ll x = 7 % k;
    int cnt = 0;
    while(++cnt) {
        if(x == 0) {
            cout << cnt << endl;
            return 0;
        }
        if(used[x]) {
            cout << -1 << endl;
            return 0;
        }
        used[x] = true;
        x = (x * 10 + 7) % k;
    }

    return 0;
}

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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)


int main(void){
 int n,m,x;
 cin>>n>>m;
 vector<int> a(m+1,0);
int t;
r(i,n){
  cin>>t;
  r(j,t){
    cin>>x;
    a.at(x)++;
  }
}

int cnt=0;
r(i,m+1){
  if(a.at(i)==n)cnt++;
}

cout<<cnt<<endl;

return 0;}


Measured memory_bytes: 256
n = int(input())
s = list(map(int, input().split()))
q = int(input())
t = list(map(int, input().split()))

count = 0
for elT in t:
    minI = 0
    maxI = len(s)-1
    while minI <= maxI:
        middle = (minI+maxI)//2
        if s[middle] == elT:
            count+=1
            break
        elif s[middle] < elT:
            minI = middle+1
        else:
            maxI = middle-1
print(count)


Measured memory_bytes: 16708
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define SORTD(a) sort(a.rbegin(), a.rend());
#define UNIQUE(a) unique(a.begin(), a.end())
#define ll long long
#define INF 1000000000000000000
#define INT_MAX 2147483647

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <cctype>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <utility>
#include <ios>
#include <iomanip>
#include <sstream>
#include <map>

using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

const ll mod = 1e9+7;

int main() {
	int n, m;
	cin >> n >> m;
	vector<string> a(n);
	vector<string> b(m);

	string ans = "No";
	REP(i, n)cin >> a[i];
	REP(i, m)cin >> b[i];

	REP(i, n - m + 1) {
		REP(j, n - m + 1) {
			bool in = true;
			REP(k, m) {
				REP(l, m) {
					if (a[i + k][j + l] != b[k][l]) {
						in = false;
					}
				}
			}
			if (in) { ans = "Yes"; }
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}


int main(){
  string s; cin >> s;
  if(s == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;//list用
using System.Text;//StringBuilder用
using System.Collections;
using System.Linq;
class Program
{
    static List<int> s = new List<int>();
    static decimal result;
static Hashtable ht=new Hashtable();
static StringBuilder sb = new StringBuilder();
static int N,M,K;
static long[,] table;
    static void Main()
    {
        string tmp = Console.ReadLine();
      if(tmp[0]==tmp[1] || tmp[1]==tmp[2] || tmp[2]==tmp[3]){Console.WriteLine("Bad");}
      else{                    Console.WriteLine("Good");}
      return;
             //       Console.WriteLine(result.ToString());

    }


    static void Read1()//1項
    {
        string tmp = Console.ReadLine();
        N = int.Parse(tmp);
    }
 
    static void Read2()//複数項（項目数Ｎ）
    {
        string[] tmp = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++) { s.Add(int.Parse(tmp[i])); }
    }
    static void Read3()//1行複数項
   {
       string[] tmp = Console.ReadLine().Split(' ');
       for (int i = 0; i < tmp.Length; i++) { s.Add(int.Parse(tmp[i])); }
    }
    static void Read4()//NK１行
    {
        string[] tmp = Console.ReadLine().Split(' ');
       N = int.Parse(tmp[0]);
       K = int.Parse(tmp[1]);
    }
    static void Read5()//N行K項
    {

 
    }


}

Measured memory_bytes: 13140
#pragma GCC optimize("Ofast")
#include<iostream>
#include<string>

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

int a[200000],n,b;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    REP(i,n)cin>>a[i];
    REP(i,n)b^=a[i];
    REP(i,n){cout<<(a[i]^b)<<"\n";}
    return 0;
}

Measured memory_bytes: 4372
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

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

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}


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

   int ans = 0;
   for(int i = a; i <= b; i++){
      string s = to_string(i);
      // check
      bool is_ok = true;
      for(int j = 0; j < 2; j++){
         if(s[j] != s[4 - j]){
            is_ok = false;
         }
      }
      if(is_ok){
         ans++;
      }
   }

   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char a[110];
int main()
{
	int s=0,l;
//	for(int i=0;i<=l;i++)
//	{
		gets(a);
//	}
	l=strlen(a);
	for(int j=0;j<=l;j++)
	{
		if(a[j]=='C')
		{
			for(int p=j;p<=l;p++)
			{
				if(a[p]=='F')
				{
					printf("Yes");
					return 0;
				}
			}
		}
	}
	printf("No");
	return 0;
}

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

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> cnt(m, 0);
  for( int i = 0; i < n; i++ ) {
    int k;
    cin >> k;
    for( int j = 0; j < k; j++ ) {
      int a;
      cin >> a;
      cnt[a - 1] += 1;
    }
  }
  int ans = 0;
  for( int i = 0; i < m; i++ ) {
    if( cnt[i] == n )
      ans += 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            var HWK = Sarray();
            var H = HWK[0];
            var W = HWK[1];
            var K = HWK[2];
            var free = new long[8];
            free[0] = 1;free[1] = 1;
            for (var i = 2; i < 8; ++i)
                free[i] = free[i - 1] + free[i - 2];
            var dp = new long[H + 2, W + 2];
            dp[1, 1] = 1;
            for (var h = 1; h <= H; ++h)
            {
                for (var w = 1; w <= W; ++w)
                {
                    var t = 0L;
                    if (1 != w)
                    {
                        t = free[w - 2] * free[W - w] % Mod;
                        t = t * dp[h, w] % Mod;
                        dp[h + 1, w - 1] = (t + dp[h + 1, w - 1]) % Mod;
                    }
                    t = free[w - 1] * free[W - w] % Mod;
                    t = t * dp[h, w] % Mod;
                    dp[h + 1, w] = (t + dp[h + 1, w]) % Mod;
                    if (W != w)
                    {
                        t = free[w - 1] * free[W - w - 1] % Mod;
                        t = t * dp[h, w] % Mod;
                        dp[h + 1, w + 1] = (t + dp[h + 1, w + 1]) % Mod;
                    }
                }
            }
            WriteLine(dp[H + 1, K]);
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    int n ;cin>>n;
    vector<string> s(n);rep(i,n)cin>>s[i];
    map<string ,int>mp;
    mp["AC"]=0;
    mp["WA"]=0;
    mp["TLE"]=0;
    mp["RE"]=0;
    rep(i,n)mp[s[i]]++;
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;


}

Measured memory_bytes: 6432
#include<iostream>

using namespace std;

int main(){
  int n;
  cin>>n;
  int c=0;
  while(n--){
    int a;
    cin>>a;
    bool f=false;
    for(long long i=1;2*i*i+2*1<=a;i++){
      f|=(a-i)%(2*i+1)==0;
    }
    c+=!f;
  }
  cout<<c<<endl;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
using namespace std;
typedef long long int ll;
using ull = unsigned long long;


mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int last[26];
int c[26];
int s[365][26];
int a[365];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int d; cin >> d;
    for(int i=0;i<26;i++){
    	cin >> c[i];
    }
    for(int i=0;i<d;i++){
    	for(int j=0;j<26;j++){
    		cin >> s[i][j];
    	}
    }
    for(int i=0;i<d;i++){
    	a[i]=myRand(26)+1;
    }
    int res=0;
    for(int i=0;i<d;i++){
    	res+=s[i][a[i]-1];
    	last[a[i]-1]=i+1;
    	for(int j=0;j<26;j++){
    		res-=c[j]*(i+1-last[j]);
    	}
    }
    for(int i=0;i<1e6;i++){
    	int day,qq;
    	if(i<1e5){
    		day=myRand(100)+1;
    	}
    	else if(i<2e5){
    		day=myRand(100)+101;
    	}
    	else if(i<3e5){
    		day=myRand(165)+201;
    	}
    	else{
    		day=myRand(d)+1;
    	}
    	qq=myRand(26)+1;
    	int resres=res;
    	int qqq=a[day-1];
        last[qq-1]=last[qqq-1]=0;
        for(int i=0;i<d;i++){
            if(a[i]==qq){
                last[a[i]-1]=i+1;
            }
            if(a[i]==qqq){
                last[a[i]-1]=i+1;
            }
            resres+=c[qq-1]*(i+1-last[qq-1]);
            resres+=c[qqq-1]*(i+1-last[qqq-1]);
        }
        a[day-1]=qq;
        resres-=s[day-1][qqq-1];
        resres+=s[day-1][qq-1];
        last[qq-1]=last[qqq-1]=0;
        for(int i=0;i<d;i++){
            if(a[i]==qq){
                last[a[i]-1]=i+1;
            }
            if(a[i]==qqq){
                last[a[i]-1]=i+1;
            }
            resres-=c[qq-1]*(i+1-last[qq-1]);
            resres-=c[qqq-1]*(i+1-last[qqq-1]);
        }
        if(resres>=res){

        }
        else{
        	if(i<=5e5&&resres<res+15){

        	}
        	else{
        		a[day-1]=qqq;
        	}
        }
    }
    for(int i=0;i<d;i++){
    	printf("%d\n",a[i]);
    }
}



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

string s;

int main() {
	cin >> s;
	
	char c = s[0];
	int ans = 0;
	for (int i = 1; i < s.length(); i++) {
		if (s[i] != c) {
			c = s[i];
			ans++;
		}
	}
	ans++;
	
	cout << ans - 1 << endl;
	return 0;
}

Measured memory_bytes: 512
import collections
import bisect
n, m = map(int, input().split())
p = [[int(j) for j in input().split()] for i in range(m)]
a = collections.defaultdict(list)

for x,y in sorted(p):
  a[x] += [y]

for x,y in p:
  z = bisect.bisect(a[x], y)
  print("%06d%06d" % (x,z))

Measured memory_bytes: 41012
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

void solve()
{
	string S;
	cin >> S;
	if (S[0] != 'A')
	{
		cout << "WA" << endl;
		return;
	}
	int cnt = 0;
	int pos = 0;
	for (int i = 2; i < S.size() - 1; ++i)
	{
		if (S[i] == 'C')
		{
			++cnt;
			pos = i;
		}
	}
	if (cnt != 1)
	{
		cout << "WA" << endl;
		return;
	}
	for (int i = 0; i < S.size(); ++i)
	{
		if (i == 0 || i == pos)
		{
			continue;
		}
		if (!('a' <= S[i] && S[i] <= 'z'))
		{
			cout << "WA" << endl;
			return;
		}
	}
	cout << "AC" << endl;
}

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

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

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

	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			int k = Y - 1000 * i - 5000 * j;
			if (k >= 0 && k % 10000 == 0 && i + j + k / 10000 == N) {
				cout << k / 10000 << " " << j << " " << i << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;

	return 0;
}


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

#define i64 long long int

int n;
int s[11][11];

pair<int, int> calc(int x) {
	pair<int, int> p = make_pair(0, 0);
	p.second = x % 10;
	while(x>=10) x/=10;
	p.first = x;
	return p;
}

int main() {
	scanf("%d", &n);
	
	memset(s, 0, sizeof s);
	for(int i=1;i<=n;i++) {
		pair<int, int> p = calc(i);
		if(p.second==0) continue;
		
		s[p.first][p.second]++;
	}
	
	i64 ans = 0LL;
	for(int i=1;i<=9;i++)
	for(int j=1;j<=9;j++) {
		ans += 1LL*s[i][j]*s[j][i];
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    string S;
    cin >> S;
    for(int i=0; i<3; i++){
        if(S[i] == S[i+1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
let read_floats () =
  let str = read_line() in
  List.map (fun x -> float_of_string x) (Str.split (Str.regexp " +") str)
;;

let input = read_floats() in
let a = List.nth input 0 in
let b = List.nth input 1 in
let h = List.nth input 2 in
let m = List.nth input 3 in
let pi = acos (-1.) in
let x1 = a *. cos (h /. 12. *. 2. *. pi +. m /. 720. *. 2. *. pi) in
let y1 = a *. sin (h /. 12. *. 2. *. pi +. m /. 720. *. 2. *. pi) in
let x2 = b *. cos (m /. 60. *. 2. *. pi) in
let y2 = b *. sin (m /. 60. *. 2. *. pi) in
let sqx = (x1 -. x2) *. (x1 -. x2) in
let sqy = (y1 -. y2) *. (y1 -. y2) in
print_endline (string_of_float (sqrt (sqx +. sqy)))


Measured memory_bytes: 4272
//BISMILLAH
#include<bits/stdc++.h>
#define ll long long

using namespace std;
int main()
{

       ll  c,res,big,small,humty,flag=0,temp=0;
       int n,x,a,b,check;
       cin>>a;
       cout<< a+(a*a)+(a*a*a)<<endl;



return 0;
}


Measured memory_bytes: 3548
#include<stdio.h>
int main(void){
	int n,a,b,c;
	scanf("%d",&n);
	while(scanf("%d %d %d",&a,&b,&c),n!=0,n--){
		if(a*a==b*b+c*c || b*b==a*a+c*c || c*c==a*a+b*b)printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 580
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


def main():
    s = input()
    a = ""
    for i in range(len(s)):
        a+="x"
    print(a)



main()


Measured memory_bytes: 5716
n,m=list(map(int,input().split()))

if n+1 < 2*m:
    print(0)
else:
    a = [int(input()) for _ in range(m)]

    pre2 = 0
    pre1 = 0
    cur = 1
    a_id = 0

    for i in range(n):
        pre2 = pre1
        pre1 = cur 
        cur = pre1 + pre2
        if a_id < m:
            if i+1 == a[a_id]:
                a_id += 1 if a_id < m-1 else 0
                cur = 0
        if cur == 0 and pre1 == 0:
            break
    print(cur%1000000007)

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

int N;
int S;

int main(){
  while( cin >> N ){
    if( !N ) break;
    int nmax = -1000;
    int nmin  = 2000;
    int sum = 0;
    for(int i=0;i<N;i++){
      cin >> S;
      nmax = max( nmax, S );
      nmin = min( nmin,S );
      sum += S;
    }
    sum -= nmax + nmin;
    cout << sum/(N-2) << endl;
  }
}

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

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

void MAIN() {
  int n, m;
  cin >> n >> m;
  int cnt = 0;
  vector<string> s(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    s[i] = "-" + s[i];
    for (int j = 1; j <= m; j++) {
      if (s[i][j] == '#') cnt++;
    }
  }
  vector<vector<int>> v(n + 1, vector<int>(m + 1));
  struct tup {
    int fi, sc, th;
    tup() {}
    tup(int fi, int sc, int th):
      fi(fi), sc(sc), th(th) {}
  };
  vector<int> r = {-1, 0, 1, 0};
  vector<int> c = {0, -1, 0, 1};
  queue<tup> q;
  q.push(tup(1, 1, 1));
  while (q.size()) {
    int x = q.front().fi;
    int y = q.front().sc;
    int z = q.front().th;
    q.pop();
    if (x < 1 || x > n || y < 1 || y > m) continue;
    if (v[x][y] || s[x][y] == '#') continue;
    v[x][y] = z;
    for (int i = 0; i < 4; i++) {
      q.push(tup(x + r[i], y + c[i], z + 1));
    }
  }
  if (v[n][m] == 0) {
    cout << -1 << '\n';
    return;
  }
  cout << n * m - cnt - v[n][m] << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
#endif
  // ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3612
n,m = map(int, input().split())
to = [list() for _ in range(n)]
for i in range(m):
    a,b = map(int, input().split())
    a-=1
    b-=1
    to[a].append(b)
    to[b].append(a)

from collections import deque

d = deque()
d.append(0)
ans = [-1]*n
while d:
    u = d.popleft()
    for v in to[u]:
        if ans[v]==-1:
            ans[v]=u
            d.append(v)

if -1 in ans[1:]:
    print('No')
else:
    print('Yes')
    for i in range(1,n):
        print(ans[i]+1)


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); --i)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = 1LL * INF * INF;

const int MAX = 500500;

int A[MAX];
int RES[MAX];
int L[MAX];

int main()
{
	//freopen("in.txt", "r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int n, d;
	scanf("%d%d", &n, &d);

	FOR (i, 0, n)
	{
		scanf("%d", &A[i]);
	}

	int lmst = 1;
	RFOR(i, n, 0)
	{
		L[i] = lmst;
		int x = A[i];

		if (lmst <= x / 2);
		else lmst += x;
		if (lmst > INF) lmst = INF;
	}

	int pos = d;
	FOR (i, 0, n)
	{
		if (L[i] <= pos) RES[i] = 1;
		else RES[i] = 0;

		pos = min(pos, abs(pos - A[i]));
	}

	int q;
	scanf("%d", &q);
	FOR (i, 0, q)
	{
		int x;
		scanf("%d", &x);
		x--;
		if (RES[x]) printf("YES\n");
		else printf("NO\n");
	}
}


Measured memory_bytes: 7808
loop do

n = gets.to_i

if n == 0 then
break
end

data = gets.split.map(&:to_f)
m = data.inject(:+)/n.to_f
sum = 0
for i in 1..n
sum += (data[i-1]-m)**2
end

dis = sum/n.to_f
puts Math.sqrt(dis)


end


Measured memory_bytes: 6912
#include <stdio.h>
int main()
{
int i;
scanf("%d",&i);
long long int sum=0;

for (int a=1;a<=i;a++)
{
	if((a%3==0) ||  (a%5==0))
	{
    }
    else
    {
		sum=sum+a;	    
	}
}
printf("%lld",sum);
	return 0;
}


Measured memory_bytes: 1684
require 'complex'

n, d = gets.split.map(&:to_i)
spots = []
n.times do
  spots << gets.split.map(&:to_i)
end
ans = 0
0.upto(n - 1) do |index_1|
  0.upto(n - 1) do |index_2|
    next if index_1 == index_2 || index_1 > index_2
    dist = 0
    d.times do |dimention|
      dist += (spots[index_1][dimention].to_f - spots[index_2][dimention].to_f) ** 2
    end
    ans += 1 if Math.sqrt(dist).ceil == Math.sqrt(dist).floor
  end
end
puts ans


Measured memory_bytes: 1788
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    s = read_str()
    if s[0:4] == 'YAKI':
        print('Yes')
    else:
        print('No')


main()


Measured memory_bytes: 3700
#include "bits/stdc++.h"

using namespace std;
int main()
{
    string s;
    cin >> s;

    short cnt = 0;
    for (int i = 0; i < 3; i++)
    {
        if (s[i] == 'o')
        {
            cnt++;
        }
    }
    cout << 700 + (100*cnt) << endl;
	return 0;
}

Measured memory_bytes: 256
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = iil()
cnt = 0

for i in A:
    while i%2 == 0:
        cnt += 1
        i //= 2

print(cnt)

Measured memory_bytes: 4148
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#include<vector>
using namespace std;

typedef long long ll;
const ll maxn=1e5+5;
int main()
{
	ll n,h[maxn],vis[maxn];
	int flag=0;
	memset(vis,0,sizeof(vis));
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&h[i]);
	for(int i=n-1;i>0;i--)
	{

		if(h[i]<h[i-1])
			h[i-1]-=1;
	}
	for(int i=1;i<n;i++)
	{
		if(h[i]<h[i-1])
		{
		flag=1;
		break;
		}
	}
	if(flag)
	printf("No");
	else
	printf("Yes");
	return 0;
 } 

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

typedef long long ll;
typedef pair<ll,ll> pii;

ll n, m, inconvenience[100005];
stack<pii> edges;

struct dsu
{
    ll parent[100005], size[100005];

    void make_set(ll v) {
        parent[v] = v;
        size[v] = 1;
    }

    ll find_set(ll v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    ll union_sets(ll a, ll b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            ll sa = size[a], sb = size[b];
            if (size[a] < size[b])
                swap(a, b);
            parent[b] = a;
            size[a] += size[b];
            return sa * sb;
        }
        return 0;
    }
};

int main()
{
    scanf("%lld%lld", &n, &m);
    dsu comps;
    for (ll i = 1; i <= n; i++)
        comps.make_set(i);
    for (ll i = 1; i <= m; i++)
    {
        ll a, b;
        scanf("%lld%lld", &a, &b);
        edges.push(make_pair(a,b));
    }
    ll ind = m, inc = n * (n-1) / 2;
    while (ind)
    {
        inconvenience[ind] = inc;
        pii ab = edges.top();
        edges.pop();
        inc -= comps.union_sets(ab.first, ab.second);
        ind--;
    }
    for (ll i = 1; i <= m; i++)
    {
        printf("%lld\n", inconvenience[i]);
    }
    return 0;
}


Measured memory_bytes: 4664