akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
//#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define int long long
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;

inline ll mod(ll n, ll m ){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}

ll exp(ll a,ll b,ll m){
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

const int N = 100100;
int dist[N],pai[N];
vector<int> g[N];

int32_t main(){
  fastio;
  int n,m;
  cin >> n>>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    g[a].pb(b);
    g[b].pb(a);
  }

  queue<int> q;
  q.push(1);
  ms(dist,-1);
  dist[1] = 0;
  while(!q.empty()){
    int cur = q.front();
    q.pop();
    for(int to : g[cur]){
      if(dist[to]==-1){
        dist[to] = dist[cur] + 1;
        pai[to] = cur;
        q.push(to);
      }
    }
  }
  for(int i=2;i<=n;i++){
    if(dist[i]==-1){
      cout <<"No" << endl;
      return 0;
    }
  }
  cout <<"Yes" << endl;
  for(int i=2;i<=n;i++){
    cout << pai[i] <<endl;
  }


  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}

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

using namespace std;

#define IOS ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);

#define endl "\n";


#define mod 1000000007
#define loop(i,s,n)  for(ll i=s;i<n;i++)
#define test  ll t; cin>>t; while(t--)
#define p push_back
typedef long long ll;
ll  mexp(ll k,ll n,ll m)
{if(n==0)
{return 1;}
else if(n%2==0)
{return mexp((k*k)%m,n/2,m);}
else
{return (k*mexp((k*k)%m,(n-1)/2,m))%m;}}




int main()
{

ll n,i,j,k,count=0,sum=1;
cin>>n;
count=((mexp(10,n,mod)%mod)-((2*mexp(9,n,mod))%mod)+(mexp(8,n,mod)%mod));
count=(count+mod)%mod;

cout<<count;

    return 0;
}




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

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

	stack<char> p;
	for (int i = 0; i < s.size(); ++i){
		if(s[i]=='S')
			p.push(s[i]);
		else if(p.empty()||p.top()=='T')
			p.push(s[i]);
		else
			p.pop();
	}

	cout<<p.size()<<endl;

}


Measured memory_bytes: 644
// Template
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
#include <complex>
#define rep(i, x) for (int i = 0; i < (x); ++i)
#define rng(i, x, y) for (int i = (x); i < (y); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}
void solve();
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solve();
    return 0;
}

// Main Code
void solve() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int cnt = 0;
    while (a >= b) {
        b *= 2;
        ++cnt;
    }
    while (b >= c) {
        c *= 2;
        ++cnt;
    }
    if (cnt <= k) cout << "Yes\n";
    else cout << "No\n";
    return;
}


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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int n;cin>>n;
  vector<int> x1(n);
  vector<int> y1(n);
  vector<int> x2(n);
  vector<int> y2(n);
  int i,j;
  rep(i,n)
  {
    cin>>x1[i]>>y1[i]>>x2[i]>>y2[i];
  }
  vector<ll> xs(n*2);
  vector<ll> ys(n*2);
  rep(i,n)
  {
    xs[i*2]=x1[i];
    xs[i*2+1]=x2[i];
    ys[i*2]=y1[i];
    ys[i*2+1]=y2[i];
  }
  sort(all(xs));
  sort(all(ys));
  auto it=unique(all(xs));
  xs.erase(it,xs.end());
  auto it2=unique(all(ys));
  ys.erase(it2,ys.end());
  vector<vector<int>> cov(xs.size(),vector<int>(ys.size(),0));
  rep(i,n)
  {
    int nx1=lower_bound(all(xs),x1[i])-xs.begin();
    int nx2=lower_bound(all(xs),x2[i])-xs.begin();
    int ny1=lower_bound(all(ys),y1[i])-ys.begin();
    int ny2=lower_bound(all(ys),y2[i])-ys.begin();
    cov[nx1][ny1]++;
    cov[nx1][ny2]--;
    cov[nx2][ny1]--;
    cov[nx2][ny2]++;
  }
  int pi,pj;
  rep(i,xs.size())rep(j,ys.size())
  {
    if(i==0&&j==0)
    {
      pi=0;
      pj=0;
      continue;
    }
    cov[i][j]+=cov[pi][pj];
    pi=i;
    pj=j;
  }
  rep(j,ys.size())rep(i,xs.size())
  {
    if(i==0&&j==0)
    {
      pi=0;
      pj=0;
      continue;
    }
    cov[i][j]+=cov[pi][pj];
    pi=i;
    pj=j;
  }
  ll ans=0;
  rep(i,xs.size()-1)rep(j,ys.size()-1)
  {
    if(cov[i][j]>0)
    {
      ans+=(xs[i+1]-xs[i])*(ys[j+1]-ys[j]);
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 65724
package main

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

	var scan = bufio.NewScanner(os.Stdin)

	func main() {
		scanWords()
		a := readNextInt()
		b := readNextInt()

		d := a / b
		r := a % b
		f := float64(a) / float64(b)

		fmt.Printf("%d %d %0.5f\n", d, r, f)
	}

	func scanWords() {
		scan.Split(bufio.ScanWords)
	}

	func readNextInt() int {
		scan.Scan()

		input, err := strconv.Atoi(scan.Text())
		if err != nil {
			panic(err)
		}
		return input
	}



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

int main(){
    int n;
    cin >> n;
    set<string> s;
    rep(i,n){
        string p;
        cin >> p;
        s.insert(p);
    }
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 19236
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

ll A,B,res;
int g;

int main(){
	cin>>A>>B;
	if (A==B){
		puts("1");
		return 0;
	}
	for (int i=60;~i;i--)
		if ((A>>i&1)!=(B>>i&1)){
			res=(1ll<<i)-(A&(1ll<<i)-1);
			res*=2;
			g=-1;
			for (int k=i-1;~k;k--)
				if (B>>k&1){
					g=k;
					break;
				}
			ll tmp=B>>i<<i;
			for (int j=i-1;~j;j--)
				if (A>>j&1){
					res+=1ll<<min(g+1,j);
					tmp|=1ll<<j;
					if (j>g) break;
					//if (tmp>B) break;
				}
			break;
		}
	cout<<res<<endl;
}

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

typedef long long ll;

const ll mod = (ll) 1e9 + 7;

ll fat[300005];

ll inv[300005];

ll exp(ll a, int b)
{
	ll ans = 1;
	while(b)
	{	
		if(b & 1)
		{
			ans = (ans * a) % mod;
		}
		a = (a*a)%mod;
		b >>= 1;
	}
	return ans;
}

ll C(int n, int k)
{
	return (((fat[n] * inv[k]) % mod) * inv[n - k])%mod;;
}

ll get(int x, int y)
{
	return C(x + y - 2, x - 1);
}

int main()
{

	fat[0] = 1;
	inv[0] = 1;

	for(int i = 1; i <= 300000; i++)
	{
		fat[i] = (i * fat[i-1]) % mod;
		inv[i] = exp(fat[i],mod-2);
	}

	int h,w,a,b;
	//cout << C(10,2) << endl;
	scanf("%d %d %d %d",&h,&w,&a,&b);
	//cout << get(h,w) << " * " <<   << endl;

	ll sum = 0;
	for(int i = 0; i < h-a; i++)
	{
		sum += (get(i+1,b) * get(h-i,w-b)) % mod;
		sum %= mod;
	}

	ll ans = (sum + mod) % mod + mod;
	ans += mod;
	ans %= mod;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int sum=0;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    double search=sum/(double)(4*m);
    int c=0;
    for(auto x:a)
        if(x>=search)c++;
    if(c>=m)cout<<"Yes";
    else cout<<"No";
}



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

int main(){
    int n;
    cin >> n;
    int x[n];
    int y[n];
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
    }
    double ans = 0;

    vector<int> v(n);
    for(int i = 0; i < n; i++){
        v[i] = i;
    }
    int count = 0;
    do {
        for(int i = 0; i < n-1; i++){
            ans += sqrt(pow((x[v[i]]-x[v[i+1]]),2.0)+pow((y[v[i]]-y[v[i+1]]),2.0));
        }         
        count++;       
    } while(next_permutation(v.begin(), v.end()));
    ans = ans/count;    
    cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
K = int(input())
D = int(input())
n = len(str(K))

mod = 10**9+7

s = str(K)

dp = [[[0, 0] for _ in range(D)] for _ in range(n+1)]
dp[0][0][0] = 1

for i in range(n):
    for j in range(D):
        for k in range(2):
            nd = int(s[i])
            for d in range(10):
                ni = i+1
                nj = (j+d)%D
                nk = k
                if k == 0:
                    if d > nd:
                        continue
                    elif d < nd:
                        nk = 1
                    else:
                        pass
                dp[ni][nj][nk] += dp[i][j][k]%mod
print((dp[n][0][0]+dp[n][0][1]-1)%mod)

Measured memory_bytes: 129372
#include <iostream>
//#include <fstream>
#include <vector>

using namespace std;

int main(int argc, const char * argv[]) {
//    ifstream in("input.txt");
//    cin.rdbuf(in.rdbuf());
    
    int L, R;
    cin >> L >> R;
    
    int N = R - L + 1;
    
    if (N >= 2019)
    {
        cout << 0 << endl;
    }
    else{
        vector<int> vec;
        int a,b;
        for (int i=L;i<R;++i)
        {
            for (int j=L+1;j<=R;++j)
            {
                a =i%2019;
                b =j%2019;
                vec.push_back((a*b)%2019);
            }
        }
        int min = *min_element(vec.begin(), vec.end());
        cout << min << endl;
    }

    
    
    return 0;
}


Measured memory_bytes: 18664
N = int(input())
A = list(map(int, input().split()))
if N == 0:
    if A[0] == 1:
        print(1)
    else:
        print(-1)
    exit()
elif A[0] != 0:
    print(-1)
    exit()

leaf = A
not_leaf = [0] * (N + 1)
not_leaf[0] = 1

for i, a in enumerate(A[1:-1], 1):
    not_leaf[i] = not_leaf[i - 1] * 2 - a

for i in reversed(range(1, N + 1)):
    total = not_leaf[i] + leaf[i]
    prev = not_leaf[i - 1]
    if prev > total:
        not_leaf[i - 1] -= prev - total
    if not_leaf[i - 1] * 2 < total:
        print(-1)
        break
else:
    print(sum(leaf) + sum(not_leaf))

Measured memory_bytes: 706276
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
typedef long long int ll;
int main(){
  int n,k;
  cin >>n>>k;
  ll x[n];
  ll ans=10000000000;
  for(int i=0;i<n;i++) cin >>x[i];
  for(int i=0;i<n-k+1;i++){
     ans=min(ans,abs(x[i+k-1]-x[i])+min(abs(x[i]),abs(x[i+k-1])));
  }
   cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
typedef long long ll;
ll n,k;
ll a[200009];

bool judge(ll mid){
  ll cnt=0;
  rep(i,n){
    if(a[i]<0){
      int l=-1,r=n;
      while(r-l>1){
        int j=(l+r)/2;
        if(a[i]*a[j]<mid){
          r=j;
        }
        else{
          l=j;
        }
      }
      cnt+=n-r;
    }
    else{
      int l=-1,r=n;
      while(r-l>1){
        ll j=(l+r)/2;
        if(a[i]*a[j]<mid){
          l=j;
        }
        else{
          r=j;
        }
      }
      cnt+=r;
    }
    if(a[i]*a[i]<mid)cnt--;
  }
  cnt/=2;

  return cnt<k;
}


int main(){
  cin>>n>>k;
  rep(i,n){
    cin>>a[i];
  }
  sort(a,a+n);

  ll l=-lINF,r=lINF;
  while(r-l>1){
    ll mid=(l+r)/2;
    if(judge(mid)){
      l=mid;
    }
    else{
      r=mid;
    }
  }

  cout<<l<<endl;

  return(0);
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int INF = 1<<29;

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

void solve(void){
	int H, W, K;
	cin >> H >> W >> K;
	vector <vector <char>> maze(H, vector <char> (W));
	vector <vector <int>> step(H, vector <int> (W, INF));
	intP s;
	rep(H, i) rep(W, j) {
		cin >> maze[i][j];
		if (maze[i][j] == 'S') {
			s.fst = i, s.snd = j;
		}
	}
	queue <intP> q;
	step[s.fst][s.snd] = 0;
	q.push(s);
	while (!q.empty()) {
		intP n = q.front(); q.pop();
		rep(4, d) {
			int y = n.fst + dy[d], x = n.snd + dx[d];
			if (0 <= x && x < W && 0 <= y && y < H) {
				if (maze[y][x] == '.' && step[y][x] == INF) {
					step[y][x] = step[n.fst][n.snd] + 1;
					q.push(intP(y, x));
				}
			}
		}
	}
	int ans = INF;
	rep(H, i) rep(W, j) {
		if (step[i][j] == INF) continue;
		int cost = max((step[i][j] - 1) / K, 0);
		if (i == 0 || j == 0 || i == H - 1 || j == W - 1) {
			ans = min(ans, cost + 1);
			continue;
		}
		cost += (min(min(i, j), min(H - i - 1, W - j - 1)) + K - 1) / K;
		ans = min(ans, cost + 1);
	}
	cout << ans << endl;

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 3456
#include <iostream>

#include <fstream>

#include <vector>
#include <set>
#include <string>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

#include <algorithm>
#include <iomanip>
#include <cmath>
#include <random>
#include <cstdlib>
#include <ctime>
#include <utility>

using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define F first
#define S second
#define forcin(n, a) for(int i = 0; i < n; ++i) {cin >> a[i];}
#define forcout(n, a) for(int i = 0; i < n; ++i) {cout << a[i] << " ";}
#define PI acos(-1)
#define forup(st, fin) for(int i = st; i < fin; ++i)
#define fordown(st, fin) for(int i = st; i >= fin; --i)
#define reverse_all(v) reverse(v.begin(), v.end())
#define sort_all(v) sort(v.begin(), v.end())
#define sort_allr(v) sort(v.rbegin(), v.rend())
#define mmin(a, b, c) min(min(a, b), c)
#define mmax(a, b, c) max(max(a, b), c)

///#define cin in
///#define cout out
///#define int long long

const ll MAXL = 1e18;
const int N = 10005000;
const int MAXN = 1e9 + 7;

vector<ll> v, pref, suf;
int n;

ll get_dif(int l, int r, int mid) {
    ll sum1 = pref[mid], sum2 = suf[mid + 1];
    if (l) sum1 -= pref[l - 1];
    if (r < n - 1) sum2 -= suf[r + 1];
    return abs(sum1 - sum2);
}

int get_best(int l, int r) {
    int a = l, b = r - 1;
    while (a < b - 2) {
        int ta = a + (b - a) / 3, tb = b - (b - a) / 3;
        if (get_dif(l, r, ta) < get_dif(l, r, tb)) {
            b = tb;
        } else {
            a = ta;
        }
    }
    if (l == 0 && r == 2) {
        ///cout << '(' << a << " " << b << ") - ";
    }
    ll ans = MAXL;
    for (int i = a; i <= b; ++i) {
        ans = min(ans, get_dif(l, r, i));
    }
    for (int i = a; i <= b; ++i) {
        if (ans == get_dif(l, r, i)) {
            ///cout << i << "\n";
            return i;
        }
    }
}

ll get_sum(int l, int r) {
    ll ans = pref[r];
    if (l) {
        ans -= pref[l - 1];
    }
    return ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand(time(NULL));
    cin >> n;
    v.resize(n);
    pref.resize(n);
    suf.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        pref[i]  = v[i];
        if (i) pref[i] += pref[i - 1];
    }
    for (int i = n - 1; i >= 0; --i) {
        suf[i] = v[i];
        if (i < n - 1) suf[i] += suf[i + 1];
    }
    ll ans = MAXL;
    for (int mid = 1; mid < n - 2; ++mid) {
        int split1 = get_best(0, mid), split2 = get_best(mid + 1, n - 1);
        ///cout << mid << " - " << split1 << " " << split2 << "\n";
        ll maxi = max(max(get_sum(0, split1), get_sum(split1 + 1, mid)),
                max(get_sum(mid + 1, split2), get_sum(split2 + 1, n - 1)));
        ll mini = min(min(get_sum(0, split1), get_sum(split1 + 1, mid)),
                      min(get_sum(mid + 1, split2), get_sum(split2 + 1, n - 1)));
        ans = min(ans, abs(maxi - mini));
    }
    cout << ans << "\n";
    return 0;
}

/*
 5
 1 2 3 2 4
 */

Measured memory_bytes: 4992
N = int(input())
edges = [[] for _ in range(N)]

for i in range(N - 1):
    fr, to = map(lambda a: int(a) - 1, input().split())
    edges[fr].append((i, to))
    edges[to].append((i, fr))

ans = [-1] * (N - 1)
A = [set() for _ in range(N)]

st = [0]
while st:
    now = st.pop()
    s = 1
    for i, to in edges[now]:
        if ans[i] != -1:
            continue
        while s in A[now]:
            s += 1
        ans[i] = s
        A[to].add(s)
        A[now].add(s)
        st.append(to)

print(max(ans))
print(*ans, sep="\n")


Measured memory_bytes: 64980
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define vi vector<int>
#define vii vector<vector<int>>
#define vll vector<long long>  
#define vd vector<double>
#define pi (int,int)
#define vpi vector<pair<int,int>>
#define vs vector<string>
#define mp make_pair
#define ll long long
#define vc vector<char>
#define rng(x) x.begin(),x.end()
#define B(x) x.begin()
#define E(x) x.end()
#define F first
#define S second
#define me max_element
#define ne min_element
#define LL "%I64d"
#define pi 3.1415926536
using namespace std;
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  
  ll n,x,t;
  cin>>n>>x>>t;
  if(n%x==0)
  {
    cout<<t*(n/x);
  }
  else
  {
    cout<<t*(n/x+1);
  }
  return 0;
}
 

        

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
 
int FindSum(int x){
  int sum = 0;
  while(x !=0){
    sum += x%10;
    x /= 10;
  }
  return sum;
}
 
int main(){
  int N,A,B;
  cin >> N >> A >> B;
  int Sum;
  
  for (int i = 1; i <= N;i++){
    if(FindSum(i) >= A && FindSum(i) <= B){
      Sum += i;
    }
  }
  
  cout << Sum << endl;
}

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

int a,b;

bool check(int x){
	if (x/10000==x%10&&(x/1000)%10==(x%100)/10) return true;
	return false;
}

int main(){
	cin>>a>>b;
	int cnt=0;
	for (int i=a;i<=b;i++) if (check(i)) cnt++;
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
[n,k] = list(map(int,input().split()))
li = list(map(int,input().split()))

orl = li[0]

for i in range(1,n-k+1):
    in_num = li[i+k-1]
    if in_num>orl:
        print('Yes')
    else:
        print('No')
    orl = li[i]

Measured memory_bytes: 31620
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005


ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=1000000000000;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}


/////////////////////////////////////////////////////////////////

bool check(ll a,ll b){
    while(a>0&&b>0){
        if(a%2==1&&b%2==1){
            return false;
        }
        a/=2;
        b/=2;
    }
    return true;
}


int main(){
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll ans=0,s=0,t=1;
    ll sum=0;
    while(s<=n-1){
        while(t<=n&&check(sum,a[t-1])){
            ans+=(t-s);
            sum+=a[t-1];
            t++;
        }
        sum-=a[s];
        s++;
        if(s==t)t++;
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
	int n; cin>>n;
	map<int,int> mp;
	rep(i,0,n){
		int a; cin>>a;
		mp[a]++;
	}
	cout<<mp.size();

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2999 + 10;
double a[maxn], dp[maxn][maxn];
int n;
bool vis[maxn][maxn];

double f(int pos, int arriba){
	if(pos == n) return 2*arriba > n;
	if(vis[pos][arriba]) return dp[pos][arriba];
	
	double tomo = a[pos]*f(pos + 1, arriba + 1);
	double notomo = (1 - a[pos])*f(pos + 1, arriba);
	
	vis[pos][arriba] = 1;
	return dp[pos][arriba] = tomo + notomo;
}
int main() {
	cin >> n;
	for(int i = 0; i < n; ++i) cin >> a[i];
	memset(vis,0,sizeof(vis));
	printf("%.9f", f(0,0) );
	return 0;
}

Measured memory_bytes: 79872
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
vector<vector<int> > data;
vector<vector<int> > gr;
vector<int> ans, father, ch, kek;
vector<bool> used;
int binup[200000][20];
vector<vector<int> > add;
void dfs(int vertex, int last){
    for (int j=0;j<20;j++) binup[vertex][j] = -1;
    if (last != -1){
        binup[vertex][0] = last;
        int V = binup[vertex][0], lvl = 1;
        while (binup[V][lvl-1] != -1){
            binup[vertex][lvl] = binup[V][lvl-1];
            V = binup[V][lvl-1];
            lvl++;
        }
        int T = binup[last][0];
        ch[vertex] = max(ch[last], T);
    }
    for (int i=0; i < data[vertex].size(); i++){
        int to = data[vertex][i];
        if (to == last) continue;
        dfs(to, vertex);
        gr[vertex].push_back(to);
    }
}
int dfs3(int vertex){
    int S = 1;
    used[vertex] = true;
    for (int i=0;i<gr[vertex].size();i++){
        int to = gr[vertex][i];
        if (used[to]) continue;
        S += dfs3(to);
    }
    return S;
}
int dfs2(int vertex){
    int S = 1;
    for (int i=0;i<gr[vertex].size(); i++) S += dfs2(gr[vertex][i]);
    for (int i=0; i < add[vertex].size(); i++){
        int to = add[vertex][i];
        if (!used[to]) S -= dfs3(to);
        //out << vertex << "!!" << to << " " << S << endl;
    }
   // cout << vertex << " " << S << endl;
    kek[vertex] = S;
    return S;
}
void dfs4(int vertex, int sum){
    sum++;
    vector<int> vl;
    for (int i=0;i<gr[vertex].size(); i++){
        int to = gr[vertex][i];
        sum += kek[to];
        vl.push_back(kek[to]);
    }
    ans[vertex] = sum;
    for (int i=0;i<gr[vertex].size(); i++){
        int to = gr[vertex][i];
        dfs4(to, sum-vl[i]);
    }

}
signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    srand(time(0));
    int n;
    cin >> n;
    data.resize(n,{});
    gr.resize(n, {});
    for (int i=0; i < n-1; i++){
        int a, b;
        cin >> a >> b;
        data[a-1].push_back(b-1);
        data[b-1].push_back(a-1);
    }
    ch.resize(n, -1);
    dfs(0, -1);
    add.resize(n, {});
    for (int i=0; i < n; i++){
        int V = i;
        if (ch[i] < i){
            add[i].push_back(i);
            continue;
        }
        for (int j=19;j>=0;j--){
            int cand = binup[V][j];
            if (cand==-1 || ch[cand] < i) continue;
            V = cand;
        }
        add[binup[V][0]].push_back(i);
    }
    used.resize(n, false);
    kek.resize(n, {});
    ans.resize(n, 0);
    dfs2(0);
    dfs4(0,0);
    for (int i=1;i<n;i++) cout << ans[i]-1<<" ";

}


Measured memory_bytes: 87536
#include <bits/stdc++.h>
#define CFS           \
    cin.tie(nullptr); \
    ios::sync_with_stdio(false);
#define CST(x) cout << fixed << setprecision(x);
using namespace std;
constexpr int IINF = numeric_limits<int>::max();
constexpr long LINF = numeric_limits<long>::max();
constexpr int MOD = (int)1e9 + 7;
// constexpr int MOD = 998244353;

template <typename T>
std::map<T, int> factorize(T n)
{
    std::map<T, int> res;
    for (int i = 2; i * i <= n; ++i) {
        while (n % i == 0) {
            n /= i;
            res[i]++;
        }
    }
    if (n > 1)
        res[n]++;
    return res;
}

int main()
{
    int x;
    cin >> x;
    // auto m = factorize<int>(x);
    // int y = 1;
    // for (const auto p : m) {
    //     for (size_t i = 0; i < p.second; i++) {
    //         y *= p.first;
    //         int l = x / y;
    //         for (int a = 0; a < l; a++) {
    //             int b = a - y;
    //             if (pow(a, 4) + pow(a, 3) * b + pow(a, 2) * pow(b, 2) + a * pow(b, 3) + pow(b, 4) == l) {
    //                 cout << a << " " << b << "\n";
    //                 return 0;
    //             }
    //         }
    //     }
    // }
    // for (size_t i = 1; i * i <= x; i++)
    // {
    //     if (x % i == 0) {
    //         int y = x / i;
    //     }
    // }
    for (size_t i = 1; i < 10000; i++) {
        long a = i;
        long bb = pow(a, 5) - x;
        for (long b = -10000; b < 10000; b++) {
            if (pow(b, 5) == bb) {
                cout << a << " " << b << "\n";
                return 0;
            }
        }
    }
}

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

#define mp       make_pair
#define mt	 make_tuple
#define pb       push_back
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

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

const int INF=1<<29;
const double EPS=1e-9;
const int MOD = 100000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int n,k;
int dist[200][200];
int main(){
  while (cin >> n >> k){
    if (n == 0 && k == 0)break;
    for (int i = 0; i < 200; i++){
      for (int j = 0; j < 200; j++){
	dist[i][j] = INF;
	if (i == j)dist[i][j] = 0;
      }
    }
    for (int i = 0; i < k; i++){
      int t;
      cin >> t;
      if (t == 0){
	int a,b;
	cin >> a >> b;
	a--,b--;
	if (dist[a][b] == INF){
	  cout << -1 << endl;
	}else{
	  cout << dist[a][b] << endl;
	}
      }else{
	int c,d,e;
	cin >> c >> d >> e;
	c--,d--;
	if (dist[c][d] > e){
	  dist[c][d] = e;
	  dist[d][c] = e;
	  //	cout << "e = " << e << endl;
	  for (int a = 0; a < n; a++){
	    for (int b = 0; b < n; b++){
	      dist[a][b] = min(dist[a][b], min(dist[a][c] + dist[c][d] + dist[d][b], dist[a][d] + dist[d][c] + dist[c][b]));
	      dist[b][a] = dist[a][b];
	    }
	  }
	}
      }
    }
  }
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

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

int main(){

  string s;cin>>s;
  string kihbr="KIHBR";

  string t="";
  bool e=true;
  rep(i,0,s.size()){
    if(s[i]!='A')t+=s[i];
  }
  ll Anum=s.size()-t.size();
  if(Anum>4)e=false;
  if(t!=kihbr)e=false;

  if(!e){
    out("NO");
    return 0;
  }

  ll correctAcount=0;

  rep(i,0,s.size()-1){
    string k="";
    k+=s[i];
    k+=s[i+1];
    if(k=="AK")correctAcount++;
    else if(k=="HA")correctAcount++;
    else if(k=="BA")correctAcount++;
    else if(k=="RA")correctAcount++;
  }

  if(correctAcount!=Anum)e=false;

  if(e)out("YES");
  else out("NO");

  return 0;
}


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

int main() {
    int N,a,r=0;
    set<int> c;
    cin >> N;

    rep(i,N) {
        cin >> a;
        if(a >= 3200)
            r++;
        else
            c.insert(a/400);
    }

    cout << ((c.size()==0) ? 1 : c.size()) << " " << c.size()+r << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <random>

using ll = long long;

//各種nil
template <class T>
constexpr T nil = static_cast<T>(-1);

constexpr int nil_i = nil<int>;
constexpr int nil_ll = nil<ll>;
constexpr double nil_d = nil<double>;

//vector
template <class T>
using vec = std::vector<T>;

struct Vec2D
{
    int x, y;
};

struct TimePos
{
    int time;
    Vec2D pos;
};

int ManhattanDistance(Vec2D v1, Vec2D v2)
{
    using namespace std;
    return abs(v1.x - v2.x) + abs(v1.y - v2.y);
}

void solve()
{
    using namespace std;
    int a, b;
    cin >> a >> b;

    cout << static_cast<int>(ceil((a + b) / 2.0)) << endl;

}

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

Measured memory_bytes: 256
s = input()
ans = ""
for i in range(len(s)):
    if s[i] == "0":
        ans += "0"
    elif s[i] == "1":
        ans += "1"
    elif s[i] == "B":
        if len(ans) == 0:
            continue
        else:
            ans = ans[:-1]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i=0; i<(int)(n); ++i)
#define rep2(i, a, b) for(int i=a; i<=(int)(b); ++i)
#define all(v) v.begin(),v.end()
const int m = 2019;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  reverse(all(s));
  ll ans = 0;
  int ten = 1, a = 0;
  vector<int> cnt(m);
  rep(i, n) {
    ++cnt[a];
    a += ten * (s[i]-'0');
    a %= m;
    ten = ten * 10 % m;
    ans += cnt[a];
  }
  cout << ans << endl;
}

Measured memory_bytes: 3736
using System;
class yama
{
    static void Main()
    {
        int[]a = new int[10];
        int[] b = new int[3];
        for(int i = 0; i < 10; i++)
        {
            a[i] = int.Parse(Console.ReadLine());
            for(int j = 0; j < 3; j++)
            {
                if (b[j] <= a[i])
                {
                    if (j == 0)
                    {
                        b[j +2] = b[j + 1];
                        b[j + 1] = b[j];
                        b[j] = a[i];
                        goto stop;
                    }
                    if (j == 1)
                    {
                        b[j + 1] = b[j];
                        b[j] = a[i];
                        goto stop;
                    }
                    if (j == 2)
                    {
                        b[j] = a[i];
                        goto stop;
                    }
                    
                }
                

            }
            stop:;
        }
        for(int i = 0; i < 3; i++)
        {
            Console.WriteLine(b[i]);
        }

    }
}

Measured memory_bytes: 9028
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b >= c) Yes;
  else No;
  return 0;

}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int inf = 1000000000;

int main(void) {

  vector< pair<int, int> > p;
  pair<int, int> t;
  while( true ){
    scanf("%d,%d", &t.second, &t.first);
    if( t.first == 0 && t.second == 0 ) break;
    p.push_back(t);
  }
  sort(p.begin(), p.end());
  vector<int> ans(101, 0);
  int n = 1;
  ans[ p[p.size()-1].second ] = n;
  for(int i=p.size()-2; i>=0; i--){
    if( p[i].first == p[i+1].first ){
      ans[ p[i].second ] = n;
    }else{
      n++;
      ans[ p[i].second ] = n;
    }
    // cerr << ans[ p[i].second ] << endl;
  }
  int a;
  while( scanf("%d", &a) != EOF ){
    cout << ans[a] << endl;
  }

  return 0;
}

// EOF

Measured memory_bytes: 3176
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

int main(){

    string s;
    cin >> s;

    for(int i = 0; i < (int)s.size() - 1; i++){
        if(s[i] == s[i + 1]){
            cout << i + 1 << " " << i + 2 << endl;
            return 0;
        }
    }

    for(int i = 0; i < (int)s.size() - 2; i++){
        if(s[i] == s[i + 2]){
            cout << i + 1 << " " << i + 3 << endl;
            return 0;
        }
    }

    cout << -1 << " " << -1 << endl;

    return 0;
}

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <climits>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)

int main()
{
    cout.precision(18);

    long long K;
    string S;

    cin >> K;
    cin >> S;

    if (S.size() <= K) {
        cout << S << endl;
    }
    else {
        for(long long i = 0; i < K; i++)
            cout << S[i];
        cout << "..." << endl;
    }
}

Measured memory_bytes: 3628
s = input()
n = len(s)
ans = 0
for i in range(2**(n-1)):
  x = s[0]
  for j in range(n-1):
    if i & 1<<j:
      x += '+'
    x += s[j+1]
  ans += sum(map(int, x.split('+')))
print(ans)

Measured memory_bytes: 9184
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
    int w, n;
    cin >> w >> n;
    vector<int> a(n);
    vector<int> dp(w + 1);
    dp[0] = 0;
    for (int i = 1;i <= w;i++)dp[i] = 114514;
    for (int i = 0;i < n;i++)cin >> a[i];
    for (int i = 0;i < n;i++) {
        for (int j = 0;j + a[i] <= w;j++) {
            dp[j + a[i]] = min(dp[j] + 1, dp[j + a[i]]);
        }
    }
    cout << dp[w] << endl;
}


Measured memory_bytes: 3196
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>	
#include <utility>
#include <cinttypes>
#include <string>
#include <iostream>
#include <cmath>
#include<iomanip>
using namespace std;

int main(){
    cout<<std::fixed<<setprecision(10);
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n,m;
    vector<int> l,r;
    cin>>n;
    cin>>m;
    l.reserve(m);
    r.reserve(m);
    for (int i=0;i<m;i++){
        int li,ri;
        cin>>li;
        cin>>ri;
        l.push_back(li);
        r.push_back(ri);
    }
    int lmax = *max_element(l.begin(),l.end());
    int rmin = *min_element(r.begin(),r.end());
    if (rmin<lmax){
        cout<<0<<"\n";
    } else {
        cout<<rmin-lmax+1<<"\n";
    }
}

Measured memory_bytes: 1024
///Water Hyacinth
///Hakuna Matata
///WAKE THE FUCK UP SAMURAI;WE HAVE A CODE TO RUN <3
///Any Verdict
///(Aes)  Dekhe (Tic) lagche = Aesthetic <3
///**********************************************************///

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define D double
int main()
{

	int n,a;

	cin >> n >> a ;

	if(n < a)
        cout << "0" << endl;
    else if(n > a)
        cout << "10" << endl;
    else if(n == a)
        cout << "10" << endl;

	return 0;
}

///Day:36




Measured memory_bytes: 256
n = int(input())
memo =[[0,0,0] for _ in range(n)]
days = []
for i in range(n):
    days.append(list(map(int, input().split())))
memo[-1] = days[-1]


for i in range(n-1, 0, -1):
    memo[i-1][0] = days[i-1][0]+max(memo[i][1], memo[i][2])
    memo[i-1][1] = days[i-1][1]+max(memo[i][2], memo[i][0])
    memo[i-1][2] = days[i-1][2]+max(memo[i][0], memo[i][1])
print(max(memo[0]))

Measured memory_bytes: 50276
#include <stdio.h>
  
void find3(int n);
   
int main(void) {
    int n;
       
    scanf("%d",&n);
    find3(n);
      
    printf("\n");
    return 0;
}
  
void find3(int n)
{
    int i, j;
      
    for(i=1;i<=n;i++){
        if(i % 3 == 0){
            printf(" %d",i);
        } else {
            for(j = i; j > 0;j /= 10){
                if (j % 10 == 3){
                    printf(" %d",i);
                    break;
                } else {
                }
            }
        }
    }
}

Measured memory_bytes: 600
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int mod = 1e9+7;

int main() {


  string s; cin >> s;
  int cnt = 0;
  for(int i=0; i<s.size(); i++) cnt += s[i]-'0';
  cout << cnt << endl;

  return 0;
}


// EOF


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

int main() {
    string S, T;
    cin >> S >> T;
    for(int i = 0; i < S.size(); i++) {
        string s = S.substr(i, S.size()-i) + S.substr(0, i);
        if(s == T) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
main(){
	int a,b,c,tmp,i,j;
	scanf("%d",&i);
	for(j=1;j<=i;j++){
	scanf("%d %d %d",&a,&b,&c);
	
	if(a>b){tmp=a;a=b;b=tmp;}
	if(b>c){tmp=b;b=c;c=tmp;}
	if(a>b){tmp=a;a=b;b=tmp;}
	
	if(a*a+b*b==c*c)printf("YES\n");
	else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 998244353;

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

    int n; cin >> n;
    std::vector<pii> v(n);
    rep(i,n){int x,y; cin >> x >> y; v[i]={x,y};}
    int arr[n]; rep(i,n) arr[i] = i;

    double sum = 0;

    do{
        rep(i,n-1){
            pii s = v[arr[i]];
            pii t = v[arr[i+1]];
            sum += sqrt(pow(s.first-t.first, 2) + pow(s.second-t.second, 2));
        }
    } while(next_permutation(arr, arr+n));

    rep(i,n){
        sum /= i+1.0;
    }

    cout << setprecision(15) << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cctype>
using namespace std;

int main(){
    char str[1000];
    char str2[] = "0";
    char ch;
    int n;
    int sum;
    sum = 0;

    while(1){
        scanf("%s", str);
        if(0 == strcmp(str, "0")){
            break;
        }
        sum = 0;
        for(int i = 0; i < strlen(str); i++){
            // cout << str[i];
            n = str[i] - '0';
            // cout << n;
            sum += n;
        }
        cout << sum << endl;
        // cout << endl;
    }

    // while(1){
    //     scanf("%c", &ch);
    //     if(ch == '0'){
    //         scanf("%c", &ch);
    //         if()
    //         break;
    //     }
    //
    //     if('\n' == ch){
    //         cout << sum;
    //         sum = 0;
    //         printf("%c", ch);
    //     } else {
    //         n = ch - '0';
    //
    //         // printf("%c", ch);
    //         // cout << n;
    //         // printf("%d", n);
    //
    //         sum += n;
    //         // cout << sum;
    //
    //     }
    //        
    // }
    // printf("\n");

    return 0;
}


Measured memory_bytes: 3228
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
	int n;

	cin >> n;
	int a[n];

	for (int i = 0; i < n; i++) {
		int o;
		cin >> o;
		a[--o] = i;
	}
	for (int i = 0; i < n; i++) {
		cout << ++a[i] << " ";
	}
	cout << endl;


	return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>

int abs(int a) {
  return a > 0 ? a : -a;
}

int min(int a, int b) {
  return a < b ? a : b;
}

int main(void) { 
  int i, j, k, n, x, ans = 0;
  scanf("%d%d", &n, &k);
  for(i = 0; i < n; i++) {
    scanf("%d", &x);
    ans += min(abs(x - k), abs(x)) * 2;
  }
  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int x;
	cin >> x;
	cout << 1 - x << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

using namespace std;

const int N = 100010;

int n;
long long c, k, t[N];

int main (int argc, char const *argv[]) {
	scanf("%d %lld %lld", &n, &c, &k);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", t + i);
	}
	sort(t + 1, t + n + 1);
	int bus = 0;
	for (int i = 1; i <= n;) {
		++bus;
		long long now = t[i];
		long long fin = now + k;
		int pos = upper_bound(t + 1, t + n + 1, fin) - t;
		int next = min(i + int(c), pos);
		i = next;
	}
	printf("%d\n", bus);
	return 0;
}



Measured memory_bytes: 1024
import math
from functools import reduce

K = int(input())

def gcd(*numbers):
  return reduce(math.gcd, numbers)

output = 0

for a in range(1, K+1):
  for b in range(a, K+1):
    for c in range(b, K+1):
      if a == b == c:
        output += gcd(a, b, c)
      elif a != b and b != c and c != a:
        output += 6 * gcd(a, b, c)
      else:
        output += 3 * gcd(a, b, c)

print(output)

Measured memory_bytes: 9632
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main() { (new Solver()).Run(); }
}

class Solver
{
    public void Run()
    {
        var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var dict = new Dictionary<int, int>();

        for (var i = 0; i < 3; i++)
        {
            if (dict.ContainsKey(l[i]))
                dict[l[i]]++;
            else
                dict[l[i]] = 1;
        }

        Console.WriteLine(dict.Count == 2 ? "Yes" : "No");
    }
}


Measured memory_bytes: 11348
#include<cstdio>
#define maxn 405
#define maxm 100005
int n,m,x[maxm],y[maxm],ans;
bool s[maxn][maxn],fl[maxn];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++) scanf("%d%d",&x[i],&y[i]);
	for(int i=1;i<=n;i++)
	{
		s[i][i]=true;
		for(int j=m;j;j--)
		{
			if(s[i][x[j]]&&s[i][y[j]]) fl[i]=true;
			else if(s[i][x[j]]) s[i][y[j]]=true;
			else if(s[i][y[j]]) s[i][x[j]]=true;
		//	else s[i][x[j]]=s[i][y[j]]=true;
		}
	}
	for(int i=1;i<=n;i++)
		if(!fl[i])
			for(int j=i+1;j<=n;j++)
				if(!fl[j])
				{
					bool f=true;
					for(int k=1;k<=n&&f;k++)
						if(s[i][k]&&s[j][k]) f=false;
					ans+=f;
				}
	printf("%d\n",ans);
}

Measured memory_bytes: 1152