akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVETSE(c) reverse((c).begin(),(c).end())
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define ALL(a)  (a).begin(),(a).end()
// int gcd(int a,int b){return b?gcd(b,a%b):a;}
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> T maxt(T x,T y) {
    if (x>y) return x;
    else return y;
}
template<class T> T mint(T x,T y) {
    if (x>y) return y;
    else return x;
}
//sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});
//cout << fixed << setprecision(10) << ans << defaultfloat << endl;
typedef long long ll;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<double> Vd;
typedef vector<string> Vs;

long long m = 1e9+7, mod = 1e9+7;
//逆元　a/b の modをとるとき -> a*modinv(b)%mod
long long modinv(long long a, long long m = 1e9+7) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

//約数列挙
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}


int main() {
  int N,x,y;
  double ans,s;
  Vi vx,vy;
  cin >> N;
  rep(i,N){
    cin >> x >> y;
    vx.push_back(x);
    vy.push_back(y);
  }
  rep(i,N){
    rep(j,N){
      if (i==j)continue;
      s += sqrt((vx[i]-vx[j])*(vx[i]-vx[j]) + (vy[i]-vy[j])*(vy[i]-vy[j]));
    }
  }
  printf("%.8f",s/N);


}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;


namespace AtCoderWorkspace
{
    class Program
    {
        static void Main(string[] args)
        {
            var cin = new Scanner();
            var P = cin.nextInt();
            var Q = cin.nextInt();
            var R = cin.nextInt();

            var list = new List<int>();
            list.Add(P+Q);
            list.Add(P+Q);
            list.Add(Q+P);
            list.Add(Q+R);
            list.Add(R+Q);
            list.Add(R+P);
                       
            Console.WriteLine(list.Min());
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=x && x<w && 0<=y && y<h)

const int INF = 10000000;
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};
using namespace std;
typedef pair<int, int> P;

/** Problem0502 : Dice **/

const int North[6] = {2, 1, 5, 3, 0, 4};
const int East[6] = {0, 4, 1, 2, 3, 5};
const int West[6] = {0, 2, 3, 4, 1, 5};
const int South[6] = {4, 1, 0, 3, 5, 2};
const int Right[6] = {1, 5, 2, 0, 4, 3};
const int Left[6] = {3, 0, 2, 5, 4, 1};

int main()
{
	int n;
	while (cin>>n, n) {
		int ans=1;
		int dice[6] = {5, 4, 1, 3, 6, 2};
		int tmp[6] = {5, 4, 1, 3, 6, 2};
		rep(k, n) {
			string s; cin>>s;
			if (s=="North") {
				rep(i, 6)
					dice[i] = tmp[North[i]];
			} else if (s=="East") {
				rep(i, 6)
				dice[i] = tmp[East[i]];
			} else if (s=="West") {
				rep(i, 6)
				dice[i] = tmp[West[i]];
			} else if (s=="South") {
				rep(i, 6)
				dice[i] = tmp[South[i]];
			} else if (s=="Right") {
				rep(i, 6)
				dice[i] = tmp[Right[i]];
			} else if (s=="Left") {
				rep(i, 6)
				dice[i] = tmp[Left[i]];
			}
			
			rep(i, 6) {
				tmp[i] = dice[i];
			}
			
			ans+=dice[2];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1216
import math

n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
count = 0
for i in range(n):
    for k in range(n):
        sum = 0
        if i == k:
            continue
        for j in range(d):
            sum += (x[i][j]-x[k][j])**2
        if math.sqrt(sum) % 1 == 0:
            count += 1
print(count//2)

Measured memory_bytes: 38896
#include <iostream>
#include<stack>
#include<vector>
using namespace std;
vector<stack<long long>>v;
int main()
{
    long long n,T,flag,t,x;
    cin>>n>>T;
    v.resize(n);
    while(T--)
    {
        cin>>flag>>t;
        switch(flag)
        {
            case 0:cin>>x;
                v[t].push(x);
                break;
            case 1:
                if(v[t].empty()!=true)
                {
                  cout<<v[t].top()<<endl;
                }
                break;
            case 2:
                if(v[t].empty()!=true)
                {
                    v[t].pop();
                }
                break;
        }
    }
    return 0;
}



Measured memory_bytes: 5128
#include <iostream>
#include <cstdio>
#include <ctime>
#include <cstdlib>
#include <algorithm>
#define F first
#define S second
using namespace std;

int Q = 1e7, h1, h2, cut = 10;
int n, s, D, l, r, up, mx, a[30], b[400][30], la[400], u[400], ans[400];
pair<int, int> c[400][30];
bool v[400][30];

int f(int p, int q1, int q2) {
	int sz = q2 - q1 + 1;
	return p * sz * (sz + 1) / 2;
}

int main()
{
	int i, j, t, x, t1, t2;
	srand(time(NULL));
	cin >> D;
	for (i = 0; i < 26; i++) {
		scanf ("%d", &a[i]);
	}
	for (i = 1; i <= D; i++) {
		for (j = 0; j < 26; j++) {
			scanf ("%d", &b[i][j]);
			c[i][j].F = b[i][j];
			c[i][j].S = j;
		}
		sort(c[i], c[i] + 26);
		ans[i] = u[i] = c[i][25].S;
	}
//	for (i = 1; i <= D; i++) {
//		ans[i] = u[i] = 1;
//	}
	for(i = 1; i <= D; i++) {
		printf("%d\n", ans[i] + 1);
	}
/*
	for (i = 1; i <= D; i++){
//		scanf ("%d", &t);
		t = u[i] - 1;
		s += b[i][t];
		la[t] = i;
		for (j = 0; j < 26;j++) {
			s -= a[j] * (i - la[j]);
		}
		v[i][t] = 1;
	}
//	cout << s << endl;
//	cin >> Q;
	for (i =0; i < 26; i++) {
		v[0][i] = 1;
		v[D + 1][i] = 1;
	}
	mx = s;
	while (Q--) {
//		scanf ("%d %d", &t1, &t2);
		t1 = rand() % D + 1;
		t2 = rand() % 26;
		if (u[t1] == t2) t2 = (t2 + 1) % 26;
		x = u[t1];
		s -= b[t1][x];
		v[t1][x] = 0;
		v[t1][t2] = 1;
		u[t1] = t2;
		s += b[t1][t2];
		for (l = t1 - 1; l >= 0; l--) if (v[l][x]) break;
		for (r = t1 + 1; r <= D + 1; r++) if (v[r][x]) break;
		s += f(a[x], l + 1, t1 - 1);
		s += f(a[x], t1 + 1, r - 1);
		s -= f(a[x], l + 1, r - 1);
		for (l = t1 - 1; l >= 0; l--) if (v[l][t2]) break;
		for (r = t1 + 1; r <= D +1; r++) if (v[r][t2]) break;
		s += f(a[t2], l + 1, r - 1);
		s -= f(a[t2], l + 1, t1 - 1);
		s -= f(a[t2], t1 + 1, r - 1);
		if (s > mx) {
			up = 0;
			for (i = 1; i <= D; i++) {
				ans[i] = u[i];
			}
			mx = s;
		} else up++;
		if (up == cut) {
			up = 0;
			for (i = 1; i <= D; i++) {
				u[i] = ans[i];
			}
			s = mx;
		}
	}
	for (i = 1; i <= D; i++) {
		printf("%d\n", ans[i] + 1);
	}
*/
    return 0;
}


Measured memory_bytes: 3972
#include <cmath>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>

using namespace std;

#define forsn(i,s,n) for (int i = (s);i < (int)(n);i++)
#define forn(i,n) forsn(i,0,n)
#define dforsn(i,s,n) for (int i = (n-1);i >= (int)(s);i--)
#define dforn(i,n) dforsn(i,0,n)
#define all(v) (v).begin(), (v).end()
#define F first
#define S second

typedef long long int tint;

vector<int> A;
int C[100000];
bool inup[100000];
vector<pair<int,int>> comps[100000];
vector<vector<pair<int,int>>> realcomps;

int find(int x) { return (C[x] == x) ? x : C[x] = find(C[x]); }
bool merge(int x, int y) { int a = find(x), b = find(y); C[a] = b; return a != b; }

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

	int n, m; cin >> n >> m;
	A = vector<int>(n);
	forn(i,n) {C[i] = i; inup[i] = false;}
	forn(i,n) {cin >> A[i];}
	forn(i,m) {
		int x, y; cin >> x >> y;
		merge(x, y);
	}
	forn(i,n) comps[find(i)].push_back({A[i], i});
	forn(i,n) if (!comps[i].empty()) realcomps.push_back(comps[i]);
	
	tint res = 0;
	
	vector<int> ofthem;
	forn(i,realcomps.size()) {
		sort(all(realcomps[i]));
		if (realcomps.size() > 1) res += realcomps[i][0].F;
		forsn(j, 1, realcomps[i].size()) ofthem.push_back(realcomps[i][j].F);
	}
	sort(all(ofthem));
	if ((int)ofthem.size() < (int)realcomps.size() - 2) {
		cout << "Impossible\n";
	} else {
		forn(i, (int)(realcomps.size()) - 2) {
			res += ofthem[i];
		}
		cout << res << endl;
	}
	
}


Measured memory_bytes: 13108
#include<bits/stdc++.h>
using namespace std;
int n,a[100001],ans=0;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
         ans+=a[i];
    }
    if(ans%2==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<Pll> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define vec_max(V) *max_element(all(V))
#define vec_min(V) *min_element(all(V))
#define vec_sum(V) accumulate(all(V), 0LL)
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
  ll N;
  cin >> N;
  vll H(N);
  ll ans = 0;
  rep(i,0,N){
    cin >> H[i];
    if(H[i] == vec_max(H)) ans++;
  }
  print(ans);
 return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <array>

constexpr int inf = 1e9 + 334 + 810 + 1919;
constexpr int MAX_H = 1e4;
std::array<int, MAX_H + 1> DP;

int readInt(void){
    char c;
    do{c = getchar_unlocked();} while(c < '0');
    int res = 0;
    do{res = 10 * res + c - '0'; c = getchar_unlocked();} while(c >= '0');
    return res;
}

int main(void){
    int H, n; H = readInt(); n = readInt();
    for(int i = 0; i < H; ++i) DP[i] = inf; DP[H] = 0;
    for(int _ = 0; _ < n; ++_){
        int a, b; a = readInt(); b = readInt();
        int i;
        for(i = H; i >= a; --i) if(DP[i - a] > DP[i] + b) DP[i - a] = DP[i] + b;
        for(; i; --i) if(DP[0] > DP[i] + b) DP[0] = DP[i] + b;
    }
    printf("%d\n", DP[0]);
    return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

conv = {}
for i in range(13):
  conv[i] = (i * 10) % 13

S = readline().rstrip()
N = len(S)
DIV = 10 ** 9 + 7

dp = [[0] * 13 for i in range(N)]

x0 = S[0]
if x0 == "?":
  for i in range(10):
    dp[0][i] = 1
else:
  dp[0][int(x0)] = 1
  
for i in range(1, N):
  x = S[i]
  if x == "?":
    for j in range(13):
      for k in range(10):
        dp[i][(conv[j] + k) % 13] += dp[i - 1][j]
        dp[i][(conv[j] + k) % 13] %= DIV
  else:
    for j in range(13):
      dp[i][(conv[j] + int(x)) % 13] += dp[i - 1][j]
      dp[i][(conv[j] + int(x)) % 13] %= DIV

print(dp[-1][5])

Measured memory_bytes: 96336
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define F first
#define S second
#define s(x) #x<<" "<<x<<" | "<<
#define f(i,j,k) for(int i = j;i<=k;i++)
#define fr(i,j,k) for(int i = j;i>=k;i--)
#define all(A)  A.begin(),A.end()  
#define has(m,x)   (m.find(x)!=m.end())
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);  
#define endl "\n"
const int MSIZE = 1e5+5;
const int MOD = 1e9+7 ;




int main(){

    FIO
    ll x,k,d; cin>>x>>k>>d;
    x = abs(x);
    ll o = x/d + (x%d!=0);
    if(k<o)    cout<<x-k*d<<endl;
    else {
        k = k-o;
        x = abs(x-o*d);
        if(k%2==0)  cout<<x<<endl;
        else cout<<d-x<<endl;
    }
    

    return 0;
}
    


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define MN 2000
char c[MN*2+5][5];
int a[MN*2+5],x[MN+5],y[MN+5],A[MN*2+5][MN+5],B[MN*2+5][MN+5],f[MN+5][MN+5];
inline void rw(int&x,int y){if(y<x)x=y;}
int main()
{
	int n,i,j;
	scanf("%d",&n);
	for(i=1;i<=2*n;++i)
	{
		scanf("%s%d",c[i],&a[i]);
		for(j=1;j<=n;++j)
			A[i][j]=A[i-1][j]+(c[i][0]=='W'&&a[i]>=j),
			B[i][j]=B[i-1][j]+(c[i][0]=='B'&&a[i]>=j);
		(c[i][0]=='W'?x:y)[a[i]]=i;
	}
	memset(f,40,sizeof(f));f[0][0]=0;
	for(i=0;i<=n;++i)for(j=0;j<=n;++j)
		rw(f[i+1][j],f[i][j]+A[x[i+1]][i+2]+B[x[i+1]][j+1]),
		rw(f[i][j+1],f[i][j]+A[y[j+1]][i+1]+B[y[j+1]][j+2]);
	printf("%d",f[n][n]);
}

Measured memory_bytes: 78720
#include <bits/stdc++.h>
#include<iostream>
#define point complex<double>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int N=1e5+10,mod=1e9+7;
ll inf=LONG_LONG_MAX;
int a[N];
int GCD(int a, int b) {
	if(b==0)
    	return a;
	else
    	return GCD(b, a%b);
}



int main()
{
  /* ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);*/
   int n;
   ll ans=1e9+5;
   cin>>n;
   for(int i=0;i<n;i++)cin>>a[i];
   for(int i=0;i<n;i++){
    if(a[i]%2){
        cout<<0;
        return 0;
    }
    int x=0;
  while(a[i]%2==0){
        x++;

    a[i]/=2;
  }
      ans=ans=min(ans,1LL*x);
   }
   cout<<ans;

    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <cmath>
using namespace std;
int main(){
    int a,b,c,i,n,d,e=0;
    int flag = 0;
    int x,y,x1=0,y1=0;
    cin>>n;
    while(n--){
        cin>>a>>x>>y;
        c = (abs(x1-x)+abs(y1-y));
        if(c%2!=(a-e)%2||a-e<c){
            flag++;
        }
    }
    if(flag!=0){
        cout<<"No";
    }
    else{
        cout<<"Yes";
    }
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
#define INF 114514
using namespace std;




int main(){
	string s;
	int a, b;
	while (cin >> s >> a >> b) {
		cout << s << " " <<a+b<<" "<< a * 200 + b * 300 << endl;
	}
	return 0;
}

Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define n_l '\n'

#ifndef ONLINE_JUDGE
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); } 
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl
#endif

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define forn(i,n) for(int i=0;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef double db;
typedef vector<vi> vvi;
const ll mod=1000000007;
const ll N=200005; //check this
int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};

ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll powb(ll a,ll b) {ll res=1;a ; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a;a=a*a;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    #ifndef ONLINE_JUDGE
    freopen("inputf.in", "r", stdin);
    freopen("outputf.in", "w", stdout);
    #endif

    int t=1;
    //cin>>t;
    while(t--){
    	int n,x,t;cin>>n>>x>>t;
    	cout<<(n+x-1)/x*t;
    }
}


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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

void solve(long long T, long long X) {
  printf("%.8lf", 1.0 * T / X);
}

int main() {
  long long T;
  scanf("%lld", &T);
  long long X;
  scanf("%lld", &X);
  solve(T, X);
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	int x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	int x3,y3,x4,y4;
	cout<<x2+y1-y2<<" "<<x2-x1+y2<<" "<<x1+y1-y2<<" "<<x2-x1+y1;
	return 0;
}

Measured memory_bytes: 256
/*
    JAI JAGANNATH!
*/
//@Author : zanj0
#include <bits/stdc++.h>
#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int lli;
const lli MOD = 1e9 + 7;
void update(vector < vector <lli> >& cnt, lli num){
    for(lli i = 0; i < 71; i++){
        cnt[i][(num >> i) & 1]++;
        cnt[i][(num >> i) & 1] %= MOD;
    }
}
int main(){
    
    fastio
    lli n;
    cin >> n;
    vector <lli> v(n);
    for(lli i = 0; i < n; i++)cin >> v[i];
    vector < vector <lli> > cnt(71, vector <lli>(2));
    lli ans = 0;
    for(lli i = n - 1; i >=0; i-- ){
        lli x = v[i];
        for(lli j = 0; j <= 60; j++){
            lli temp = cnt[j][!((x >> j) & 1)];
            lli toBeAdded = 0;
            if(temp)toBeAdded = ((1ll << j) % MOD * cnt[j][!((x >> j) & 1)] % MOD) % MOD;
            ans = ans + toBeAdded;
            ans %= MOD;
        }
        update(cnt, v[i]);
    }
    cout << ans%MOD << endl;
    return 0;
}



Measured memory_bytes: 2560
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll M =1e9+7;
const int N = 2e5+7;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)


int main()
{
   
     
        int d,t,s;
        scf(d),scf(t),scf(s);
        
        if(s*t>=d)
        printf("Yes\n");
        
        else
        printf("No\n");
            
    
}

Measured memory_bytes: 3760
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define repp(i,a,n) for(i=a;i<n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)

ll binpowmod(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll modInverse(ll n, ll p)
{
    return binpowmod(n, p-2, p);
}

ll calc(ll dp[],ll k,ll a[],ll n)
{
    if(k<a[1]) return -1;
    ll i;
    for(i=1;i<=n&&k>=a[i];++i)
    {
        if(dp[k-a[i]]==0) dp[k-a[i]]=calc(dp,k-a[i],a,n);
        if(dp[k-a[i]]==-1) return 1;
    }
    return -1;
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,i,j,k;
    cin >> n >> k;
    ll a[n+1];
    
    repp(i,1,n+1) cin >> a[i];
    ll dp[k+1];
    memset(dp,0,sizeof(dp));
    ll ans=calc(dp,k,a,n);
    //rep(i,n+1) cout << dp[i] << endl ;
    //cout << ans ;
    if(ans==1) cout <<"First" ;
    else cout << "Second" ;
    return 0;
}

Measured memory_bytes: 7296
/*  ex5_3
    B30095    */
#include <stdio.h>
#include <stdlib.h>
#define MAX_HEIGHT 100
#define MAX_WIDTH 100

 
int main(void){
    int height, width, isRowEmpty, isColEmpty, i, j;
    char matrix[MAX_HEIGHT][MAX_WIDTH];
    
    scanf("%d %d", &height, &width);

    for(i = 0; i < height; i++){
        for(j = 0; j < width; j++){
            scanf(" %c", &(matrix[i][j]));
        }
    }


    // substitue empty rows with whitespaces
    for(i = 0; i < height; i ++){
        isRowEmpty = 1;
        
        for(j = 0; j < width; j++){
            if(matrix[i][j] == '#') {
                isRowEmpty = 0;
            }
        }

        if(isRowEmpty){
            for(j = 0; j < width; j++){
                matrix[i][j] = ' ';
            }
        }
    }

    // substitue empty columns with whitespaces
    for(j = 0; j < width; j ++){
        isColEmpty = 1;
        
        for(i = 0; i < height; i++){
            if(matrix[i][j] == '#') {
                isColEmpty = 0;
            }
        }

        if(isColEmpty){
            for(i = 0; i < height; i++){
                matrix[i][j] = ' ';
            }
        }
    }


    // print compressed result
    for(i = 0; i < height; i++){
        isRowEmpty = 1;

        for(j = 0; j < width; j++){
            if(matrix[i][j] == '#') isRowEmpty = 0;
            if(matrix[i][j] != ' ') printf("%c", matrix[i][j]);
            
        }

        if(!isRowEmpty) printf("\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a, b, c;
  	cin >> a >> b >> c;
  	if((a == b && b != c) || (a == c && b != c) || (b == c && a != c))
       cout << "Yes";
    else
       cout << "No";
 
 
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 100010
#define INFTY 1e18
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;
struct edge{ll to, cost;};

ll n;
ll dist[MAX];
bool check[MAX];
vector<edge> G[MAX];
void dijkstra(ll s)
{
	priority_queue<P, vector<P>, greater<P>> pq;

	for(ll i = 0; i < n; i++)
	{
		dist[i] = INFTY;
		check[i] = false;
	}

	pq.push(P(0, s));
	dist[s] = 0;
	while (!pq.empty())
	{
		P p = pq.top(); pq.pop();
		ll minv = p.first;
		ll u = p.second;
		check[u] = true;
		if (dist[u] < minv) continue;
		rep(i, G[u].size())
		{
			if (check[G[u][i].to]) continue;
			if (dist[G[u][i].to] > dist[u] + G[u][i].cost)
			{
				dist[G[u][i].to] = dist[u] + G[u][i].cost;
				pq.push(P(dist[G[u][i].to], G[u][i].to));
			}
		}
	}
}

signed main(void)
{
	cin >> n;
	rep(i, n - 1)
	{
		int a, b;
		ll c;
		cin >> a >> b >> c;
		a--; b--;
		G[a].push_back({b, c});
		G[b].push_back({a, c});
	}
	int q, k;
	cin >> q >> k;
	k--;
	dijkstra(k);
	rep(i, q)
	{
		int x, y;
		cin >> x >> y;
		x--; y--;
		cout << dist[x] + dist[y] << endl;
	}
	return 0;
}


Measured memory_bytes: 14368
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	ll n; cin >> n;
	ll k; cin >> k;
	vector<ll> a(n), s(n + 1);
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) {
		s[i + 1] += s[i] + a[i] - 1;
		s[i + 1] %= k;
	}
	map<ll, ll> cnt;
	for (int i = 0; i < min(k, n + 1); i++) {
		cnt[s[i]]++;
	}
	ll ans = 0;
	for (int i = 0; i <= n; i++) {
		ans += cnt[s[i]] - 1;
		cnt[s[i]]--;
		if (i + k <= n) cnt[s[i + k]]++;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

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

	vector<long long int> d(n);

	map<long long int, long long int> mp;

	for (long long int i = 0; i < n; i++) {
		cin >> d[i];
		mp[d[i]]++;
	}

	//sort(d.begin(), d.end());

	long long int m;
	cin >> m;

	vector<long long int> t(m);

	for (long long int i = 0; i < m; i++) {
		cin >> t[i];
	}

	bool h = true;


	for (long long int i = 0; i < m; i++) {
		if (mp[t[i]] > 0) {
			mp[t[i]]--;
		}
		else {
			h = false;
			break;
		}

	}

	if (h) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

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

int main() {
    unsigned long N;
    cin >> N;
    vector<string> ans({"NA", "MMYY", "YYMM", "AMBIGUOUS"});
    cout << ans[((N + 99) % 100 < 12) * 2 + ((N / 100) && (N / 100 <= 12))] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
int i,sum=0,byo[4];
int hun,byou;
for(i=0;i<4;i++){
scanf("%d",&byo[i]);
sum+=byo[i];
}
hun=sum/60;
byou=sum%60;

printf("%d\n",hun);
printf("%d\n",byou);

return 0;
}

Measured memory_bytes: 596
from collections import Counter

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

counter = Counter(A)
x = len(counter) - K 
if x <= 0:
    print(0)
else:
    ans = 0
    least_common = counter.most_common()[-x:]
    for a, c in least_common:
        ans += c
    print(ans)


Measured memory_bytes: 41500
#include<bits/stdc++.h>
#include <cstdio>   
#define pb          push_back 
#define endl        "\n"
#define mostrar(x,y) cout<<x<<" "<<y<<endl;
#define f           first
#define s           second
#define mod         1000000007
#define EPS         1e-9
using namespace std;
typedef pair<int,int> ii;
typedef pair<pair<int,int>,int> iii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef long long ll;


ll min(ll a, ll b ){
    if(a<b) return a;
    return b;
}
int a[100004];
int dp[100004];

ll costo_min(int n,int k){
    ll res;
    if(n<0) res = 100000000;
    else if(n==0) res= 0;
    else if(n==1) res= abs(a[n]-a[n-1]);
    else{
        if(dp[n]!=-1){
            res = dp[n];
        }
        else{
            int minimo = 1000000000;
            int aux = n;
            for(ll p = 1; p<=k&&aux>=0; p++){
                minimo = min(minimo,costo_min(n-p,k)+abs(a[n]-a[n-p]));
                aux--;
            }
            dp[n] = minimo;
            res = minimo;
        }
    }
    return res;
}

int main(){
    ofstream out("output.txt");


    ll n,k;
    cin>>n>>k;
    for(int i =0; i<n; i++){
        cin>>a[i];
        dp[i] = -1;
    }

    cout<<costo_min(n-1,k)<<endl;


    return 0;
}



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

int main(){
int x[5];
  for(int i = 0; i < 5; i++){
   	cin >> x[i] ; 
  }
  
  for(int i = 0; i < 5; i++){
   	if(x[i]==0)cout << i+1 << endl;
  }
}

Measured memory_bytes: 3508
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int n;
vector<int> vs[100005];

int ans[100005];

set<int> s[100005];

void dfs(int no){
	rep(i,vs[no].size()){
		dfs(vs[no][i]);
	}
	

	rep(i,vs[no].size()){
		int to=vs[no][i];
		if(s[to].size()>s[no].size())swap(s[no],s[to]);
		
		for(set<int>::iterator ite=s[to].begin(); ite!=s[to].end(); ite++){
			int p=*ite;
			if(s[no].count(p)>=1){
				s[no].erase(p);
				ans[p]=no;
			}
			else{
				s[no].insert(p);
			}
		}
		s[to].clear();
	}
}

int main(void){
	scanf("%d",&n);
	rep(i,n){
		int k;
		scanf("%d",&k);
		rep(j,k){
			int a;
			scanf("%d",&a);
			vs[i].push_back(a);
		}
	}
	
	int q;
	scanf("%d",&q);
	rep(i,q){
		int a,b;
		scanf("%d%d",&a,&b);
		if(a==b)ans[i]=a;
		else{
			s[a].insert(i);
			s[b].insert(i);
		}
	}
	
	dfs(0);
	
	rep(i,q){
		printf("%d\n",ans[i]);
	}
	
	return 0;
}

Measured memory_bytes: 37144
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define rep(i,n) for(int i=0; i<n; i++)
#define pb(a) push_back(a)
#define mp make_pair

int main()
{

  int n;
  int a;
  int flg = 0;

  cin >> n;

  for(int i=0; i<n; i++){
    cin >> a;
    if(a % 2 == 0){
      if( a % 3 != 0 && a % 5 != 0 ){
	flg = 1;
      }
    }
  }

  if(flg) cout << "DENIED" << endl;
  else cout << "APPROVED" << endl;

  return 0;

}


Measured memory_bytes: 256
def check(times):
  for i in range(m):
    if times[i] < x:
      return False
  else:
    return True

n, m, x = map(int, input().split())
c = [0] * n
a = [0] * n
for i in range(n):
  c[i], *a[i] = list(map(int, input().split()))
   
ans = 10**10
for i in range(2**n):
  times = [0] * m
  cnt = 0
  money = 0
  while i > 0:
    if i & 1:
      for j in range(m):
        times[j] += a[cnt][j]
      money += c[cnt]
    i = i >> 1
    cnt += 1
  if check(times):
    ans = min(money, ans)
if ans == 10**10:
  print(-1)
else:
  print(ans)

Measured memory_bytes: 9232
#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

typedef long double ld;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

const ll MOD = 1e9 + 7;
const int oo = 2e9;
const ld PI = acos((ld) -1);
int Getbit(ll x, int k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 1e5 + 5;

ll n, m, k;
ll d[N];

void Solve(){
    cin >> n >> m >> k;
    cout << (k + max(m, n) - 1) / max(m, n);

}

int main(){
    Speed;
    int query = 1;
//    cin >> query;
    while(query--) Solve();
}


Measured memory_bytes: 256
answer::Int->Int->Int->Int
answer i a b | p1 > a || p2 > b = -1
             | p1 == a && p2 == b = i
             | otherwise = answer (i+1) a b
              where p1 = floor $ fromIntegral i * 0.08
                    p2 = floor $ fromIntegral i * 0.10

main = do
  [a,b] <- map read . words <$> getLine
  print $ answer 1 a b

Measured memory_bytes: 508
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        //String n = sc.next();

        if(isPrime(n)){
            System.out.println(n-1);
            return;
        }


        long temp = n-1;
        for(long i =1;i*i<= n ;i++){
            if(n%i==0){
                long add = i + (n/i) -2;
                if(temp > add){
                    temp = add;
                }
            }
        }

        System.out.println(temp);



    }
    public static boolean isPrime(long x) {
        for (long i = 2; i*i <= x; i++) {
            if (x % i == 0) {
                //System.out.println(x + "is divisible by " + i);
                return false;
            }
        }
        return true;
    }

}

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

int main()
{
    int a[3];

    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);

    cout << (a[1] - a[0] + a[2] - a[1]) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int c1,c2;
void updo(string);
int main(){
  int n;
  string x;
  while(1){
    //
    c1=0;//0=down;1=lu;2=ld;3=ru;4=rd;5=up;
    c2=0;
    //in
    cin >> n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin >> x;
      updo(x);
    }
    cout << c2 << endl;
  }
  return 0;
}
void updo(string x){
  if(c1==0){
    if(x=="lu")c1=1;
    else if(x=="ru")c1=3;
  }
  else if(c1==1){
    if(x=="ru"){
      c2++;
      c1=5;
    }
    else if(x=="ld")c1=0;
  }
  else if(c1==2){
    if(x=="rd"){
      c2++;
      c1=0;
    }
    else if(x=="lu")c1=5;
  }
  else if(c1==3){
    if(x=="lu"){
      c2++;
      c1=5;
    }
    if(x=="rd")c1=0;
  }
  else if(c1==4){
    if(x=="ld"){
      c2++;
      c1=0;
    }
    if(x=="ru")c1=5;
  }
  else if(c1==5){
    if(x=="ld")c1=2;
    else if(x=="rd")c1=4;
  }
}
      
    

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define INFLL 0x3fffffffffffffffLL
#define INF 0x7fffffff
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define exist(s,e) (s.find(e)!=s.end())
#define ff first
#define ss second
#define EPS 1e-8
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
const ll MOD=1000000007;
/////////////////// DEBUG MODE ///////////////////////////////////
#define D(x) cerr<<"DEBUG: "<<#x<<" is: "<<x<<'\n'
#define error(args...) {string _s=#args; replace(all(_s),',',' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
void err(istream_iterator<string>) { cout<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
/////////////////// GLOBAL VARIABLES /////////////////////////////
vector<vector<int>> adj; vector<bool> vis;
/////////////////// FUNCTIONS ////////////////////////////////////
template<class T>
T maxx(T a, T b) {return a>b?a:b;}
template<typename T, typename... Args>
T maxx(T a, T b, Args... args){return maxx(a>b?a:b, args...);}
ll mexp(ll x, ll n, ll m){
  ll res=1;  while(n){if(n&1) res=(res*x)%m;n>>=1; x=((x%m)*(x%m))%m;}
  return res;
}
template<class T>
T minn(T a, T b) {return a<b?a:b;}
template<typename T, typename... Args>
T minn(T a, T b, Args... args){return minn(a>b?a:b, args...);}
bool ispow2(ll x){ return x && (!(x&(x-1))); }
ld pow(ld a, int n) {
  if(n == 0) return 1;if(n == 1) return a;
  double t = pow(a, n/2);return t * t * pow(a, n%2);
}
/////////////////// MAIN STARTS //////////////////////////////////
int main(){
  ios::sync_with_stdio(0);  cin.tie(0);   cout<<fixed; cerr<<fixed;
  cout<<setprecision(14); cerr<<setprecision(3);
  #ifdef DEBUG
  freopen("ip.txt","r",stdin); //freopen("op.txt","w",stdout);
  clock_t tStart = clock();
  #endif


	ll n,k,ans=0; cin>>n>>k;
	/*for(int i=1;i<=n;++i){
		for(int j=1;j<=n;++j) cout<<i%j<<" \n"[j==n];
	}*/
	for(ll i=k+1;i<=n;++i){
		if(k==0) ans+=i-1; else{ if(i-k>0) ans+=i-k;}
		ll temp=((n-(i-1))/i)*(i-k);
		if(temp>=0) ans+=temp;
		temp=((n-(i-1))%i)-k;
		if(temp>0) ans+=temp;
	}
	cout<<ans<<'\n';

	#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
	#endif
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int n,x;
  cin >> n;
  int i = 1;
  //3の倍数または、3のつく数字を出力
  while(i <= n){
    if(i % 3 == 0){
      cout << ' ' << i ;
    }
    else{
      x = i;
      while(x){
	if ( x % 10 == 3 ){
	  cout << " " << i;
	  break;
	}
	x /= 10;
      }
    }
    i++;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3064
import java.util.Scanner;

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

	int n, q;
	int dat[];

	void init() {
		dat = new int[n * 2 - 1];
		for (int i = 0; i < n * 2 - 1; i++) {
			dat[i] = Integer.MAX_VALUE;
		}
	}

	int query(int a, int b, int k, int l, int r) {
		if (a <= l && r <= b) return dat[k];
		if (r <= a || b <= l) return Integer.MAX_VALUE;
		int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return Math.min(vl, vr);
	}

	void update(int i, int x) {
		i += n - 1;
		dat[i] = x;
		while (i > 0) {
			i = (i - 1) / 2;
			dat[i] = Math.min(dat[i * 2 + 1], dat[i * 2 + 2]);
		}
	}

	void run() {
		int nn = sc.nextInt();
		n = 1;
		while (n < nn) n *= 2;
		q = sc.nextInt();

		init();
		while (q-- > 0) {
			int com = sc.nextInt();
			if (com == 0) {
				int i = sc.nextInt();
				int x = sc.nextInt();
				update(i, x);
			} else {
				int x = sc.nextInt();
				int y = sc.nextInt();
				System.out.println(query(x, y + 1, 0, 0, n));
			}
		}
	}

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

Measured memory_bytes: 97016
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b)
#define chmin(a, b) (a)=min(a, b)
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/

bool dp[4444][8888*2][2];

int main(void) {
  ll i, j, k;
  
  string s;
  cin >> s;
  ll N=s.size();
  ll x, y;
  cin >> x >> y;
  
  vector<ll> v;
  v.push_back(-1);
  for(i=0; i<N; i++) if(s[i]=='T') v.push_back(i);
  v.push_back(N);
  
  vector<ll> d[2];
  for(i=1; i<(ll)v.size()-1; i++) d[i&1].push_back(v[i+1]-v[i]-1);
  
  
  dp[0][8000+(v[1]-v[0]-1)][0]=1;
  dp[0][8000][1]=1;
  
  ll L[2];
  L[0]=d[0].size(); L[1]=d[1].size();
  
  for(ll r=0; r<2; r++) {
    for(i=0; i<L[r]; i++) {
      ll t=d[r][i];
      for(j=0; j<8080*2; j++) {
        if(j+t<8080*2) chmax(dp[i+1][j+t][r], dp[i][j][r]);
        if(j-t>=0)     chmax(dp[i+1][j-t][r], dp[i][j][r]);
      }
    }
  }
  
  pt((dp[L[0]][8000+x][0]&&dp[L[1]][8000+y][1] ? "Yes":"No"));
  
}





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

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

  if(a > b) swap(a, b);
  if(b > c) swap(b, c);
  if(a > b) swap(a, b);

  cout<<a<<" "<<b<<" "<<c<<endl;
  return 0;
}



Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <sstream>
#include <cstdio>
#include <cstring>
#define ll long long
using namespace std;

ll gcd(ll n, ll x) {
    ll t;
    while (x) {
        t = n % x;
        n = x;
        x = t;
    }
    return n;
}

int main() {
    ios::sync_with_stdio(false);
    ll n, x;
    cin >> n >> x;
    cout << 3 * (n - gcd(n, x));
}


Measured memory_bytes: 256
//ABC074 D Restoring Road Network

#include "bits/stdc++.h"
#define REP(i,n) for(int i=0;i< (n);i++)
#define REPR(i, n) for(int i = (n);i >= 0;i--)
#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define FORR(i, m, n) for(int i = (m);i >= (n);i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define ALL(obj) (obj).begin(),(obj).end()

using namespace std;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
int vx[4] = { 0,1,0,-1 };
int vy[4] = { 1,0,-1,0 };

int n;

int a[300][300];
int after[300][300];

signed main() {

	std::ios::sync_with_stdio(false);
	std::cin.tie(0);

	cin >> n;

	REP(i, n)REP(j, n) {
		cin >> a[i][j];
		after[i][j] = a[i][j];
	}

	REP(i, n)REP(j, n)REP(k, n) after[i][j] = min(after[i][j], after[i][k] + after[k][j]);

	REP(i, n)REP(j, n) {
		if (after[i][j] != a[i][j]) {
			cout << -1 << endl;
			return 0;
		}
	}

	//最短距離だとわかった、続いて道路の和を計算
	ll ans = 0;
	 REP(i,n) {
		REP(j,i) {
			bool need = true;
			REP(k,n) {
				if (k != i and k != j and a[i][j] == a[i][k] + a[k][j])
					need = false;
			}
			if (need) ans += a[i][j];
		}
	}

	 cout << ans << endl;


	return 0;
}


Measured memory_bytes: 1024
n,m,l = map(int, input().split())
wf=[[float("inf") for i in range(n)] for j in range(n)]
for i in range(m):
    a,b,c = list(map(int,input().split()))
    wf[a-1][b-1] = c
    wf[b-1][a-1] = c
q = int(input())
st=[list(map(int,input().split())) for i in range(q)]

for i in range(n):
    wf[i][i]=0
for k in range(n):
    for i in range(n):
        for j in range(i+1,n):
            wf[i][j] = min(wf[i][j],wf[i][k]+wf[k][j])
            wf[j][i] = wf[i][j]

for i in range(n):
    for j in range(n):
        if wf[i][j] <= l:
            wf[i][j] = 1
        else:
            wf[i][j] = float("inf")

for k in range(n):
    for i in range(n):
        for j in range(i+1,n):
            wf[i][j] = min(wf[i][j],wf[i][k]+wf[k][j])
            wf[j][i] = wf[i][j]

for que in st:
    s,t=que
    if wf[s-1][t-1] == float("inf"):
        print(-1)
    else:
        print(wf[s-1][t-1]-1)

Measured memory_bytes: 125660
//設定言語check
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;

int main(){
  int D, check = 0, count = 0 ;
  int C[27] ;
  cin >> D ;
  int S[27][D+1] ;
  for(int i=1;i<27;i++) cin >> C[i] ;
  for(int i=1;i<(D+1);i++){
    for(int j=1;j<27;j++){
      cin >> S[j][i] ;
    }
  }
  for(int date=1;date<(D+1);date++){
    int search = 0, max = -1 ;
    for(int i=1;i<27;i++){
      if(max <= S[i][date]){
        search = i ;
        max = S[i][date] ;
      }
    }
    cout << search << endl ;
  }
  return 0 ;
}  

Measured memory_bytes: 3672
n= int(input())
w=[]
w.append(input())
c=0
for i in range(n-1):
    s=input()
    if s not in w and w[i][len(w[i])-1] == s[0]:
        c+=1
        w.append(s)
    else:
        break


if c==n-1:
    print("Yes")
else:
    print ("No")







Measured memory_bytes: 3060
n,k = map(int,input().split())
s = list(input())

if s[k-1] == 'A':
    s[k-1] = 'a'
if s[k-1] == 'B':
    s[k-1] = 'b'
if s[k-1] == 'C':
    s[k-1] = 'c'

str = ''.join(s)
print(str)

Measured memory_bytes: 3060
def evenChecker(nums):
    for i in nums:
        if i % 2 == 1:
            return False
    return True

N = int(input())
nums = [int(i) for i in input().split()]
flag = True
cnt = 0
while flag == True:
    flag = evenChecker(nums)
    if not flag :
        break
    cnt += 1
    nums = [i/2 for i in nums]

print(cnt)

Measured memory_bytes: 3064