akhauriyash/Code-Regression huggingface dataset:
#include <iomanip>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define PI 3.141592653589793238462643383279502884L

int main() {
	int a,b,h,m;
	cin >> a >> b >> h >> m;
	long double kakudo;

	kakudo = PI * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long double)m / 60.0);


//	cout << fixed;
	long double s = -cosl(kakudo) * (2 * a * b);
	cout << std::setprecision(20) << sqrtl( s + pow(a, 2) + pow(b, 2)) << endl;

	return 0;
}

Measured memory_bytes: 4152
import java.util.Scanner;

class Main{
        public static void main(String[] args){
                Scanner scanner=new Scanner(System.in);
                int N=scanner.nextInt();
                boolean[] a=new boolean[N+2];
                for(int i=1;i<N+1;i++){
                        a[i]=scanner.nextInt()==i;
                }

                int ans=0;
                for(int i=1;i<N+1;i++){
                        if(a[i]){
                                a[i]=a[i+1]=false;
                                ans++;
                        }
                }

                System.out.println(ans);
        }
}

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

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;

const ll MOD = 1000000007;

ll dp[128][16];

void print(const int H, const int W) {
  REP(w, W) {
    cout << w << " " << dp[H][w] << endl;
  }
  cout << endl;
}

void getLegal(vector<vector<int> >& bars, const int W) {
  for(int mask = 0; mask < (1<<(W-1)); mask++) {
    bool ok = true;
    REP(i, W-2) {
      if(((mask >> i)&1) != 0) {
        if(((mask >> (i+1))&1) != 0) {
          ok = false;
        }
      }
    }
    if(ok) {
        vector<int> work(W-1);
      REP(i, W-1) {
        work[i] = (mask >> i) & 1;
      }
      bars.push_back(work);
    }
  }
}

int main() {
  memset(dp, sizeof(dp), 0);
  dp[0][0] = 1LL;
  int H, W, K; cin>>H>>W>>K;
  vector<vector<int> > bars;
  getLegal(bars, W);
  //  cout << "Pat=" << bars.size() << endl;                                     
  //  REP(i,bars.size()) {                                                       
  //    REP(j, bars[i].size()) {                                                 
  //      cout << bars[i][j];                                                    
  //    }                                                                        
  //    cout << endl;                                                            
  //  }                                                                          

  for(int h = 1; h <= H; h++) {
    REP(i, bars.size()) {
      REP(w, W) {
        if(w > 0 && bars[i][w-1] == 1) {
          dp[h][w] += dp[h-1][w-1];
        } else if(w < W-1 && bars[i][w] == 1) {
          dp[h][w] += dp[h-1][w+1];
        } else {
          dp[h][w] += dp[h-1][w];
        }
        dp[h][w] %= MOD;

      }
      //      cout << "H=" << h <<i  << endl;                                    
      //      print(h, W);                                                       
    }
    //    cout << "H=" << h << endl;                                             
    //    print(h, W);                                                           
  }
  cout << dp[H][K-1] << endl;
  return 0;
}


Measured memory_bytes: 256
a=input()
a_l=len(a)
ans=[]
moji=""
for i in range(a_l):
    if a[i]=="0":
        ans.append("0")
    elif a[i]=="1":
        ans.append("1")
    elif a[i]=="B" and len(ans)!=0:
        del ans[len(ans)-1]
    
for i in range(len(ans)):
    moji+=ans[i]
print(moji)
   

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int h, a;
    cin >> h >> a;
    int ans = h/a;
    if(h%a != 0) ans ++;
    cout << ans << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define test(t) int t;cin>>t;while(t--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
const int MOD = 1e9+7,MAX = 1e5+5;
ll powN(ll a,ll p,ll b)
{
	if(p==0) return 1;
	ll z=powN(a,p/2,b);
	z=(z*z)%b;
	if(p%2) z=(z*a)%b;
	return z;
}
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
ll modInv(ll a)
{
	return powN(a,MOD-2,MOD);
}


int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	if(n%2) cout<<"No\n";
	else
	{
		for(int i=0;i<n/2;i++)
		{
			if(s[i]!=s[n/2+i]) {cout<<"No"<<endl;return 0;}
		}
		cout<<"Yes"<<endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int N,H,K;
	cin >> N>>H>>K;
	
	if (K>=N && K<=H)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	
	return 0;
}



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

int64_t mem[45][45];
int64_t V;

int64_t dp(int64_t N, int64_t v) {
  if (N == 0) return 0;
  if (mem[N][v] != -1) return mem[N][v];
  int64_t best = -2;
  for (int64_t i = v + 1; i <= N; ++i) {
    if (dp(N - i, i) == -2) continue;
    best = std::max(dp(N - i, i) + 1, best);
  }
  mem[N][v] = best;
  return best;
}
std::unordered_map<int64_t, int64_t> m;


int main() {
  memset(mem, -1, sizeof(mem));
  scanf("%lld", &V);

  int64_t i = 2;
  int64_t count = 0;
  int64_t lim = int64_t(sqrt((long double)(V)) + 1000000);
  while (V != 1 && i <= lim) {
    if (V % i == 0) {
      m[i]++;
      V /= i;
    } else i++;
  }
  if (V != 1)
    m[V]++;
  for (auto kv : m) {
    count += dp(kv.second, 0);
  }
  printf("%lld\n", count);
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N,K; cin>>N>>K;
  vector<ll> DP(N+1,0);
  for(int i=0; i<K; i++){
    ll d; cin>>d;
    for(int j=0; j<d; j++){
      ll a; cin>>a;
      DP[a]++;
    }
  }
  ll ans=0;
  for(int i=1; i<=N; i++){
    if(DP[i]==0) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3632
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);

    int N = in.nextInt();
    int K = in.nextInt();

    int[] arr = new int[N];
    int max = -1;
    for (int i = 0; i < N; i++) {
      arr[i] = in.nextInt();
      max = Math.max(max, arr[i]);
    }

    boolean result = false;
    if (N == 1) {
      result = arr[0] == K;
    } else {
      int gcd = gcd(arr[0], arr[1]);
      for (int i = 2; i < N; i++) {
        gcd = gcd(gcd, arr[i]);
      }

      result = max >= K && (max - K) % gcd == 0;
    }

    System.out.println(result ? "POSSIBLE" : "IMPOSSIBLE");
  }

/**
 * 1を作れるか、そうじゃないかばかり考えていたけど、絶対値を取り続けたときにどんな数になるかを考えるべきだった。
 * 1じゃないときにそれがどんな数になるのかをより考えるべきだった。
 */

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

  public static long gcd(long a, long b) {
    if (b == 0) return a;
    return gcd(b, a % b);
  }
}


Measured memory_bytes: 49116
n,m=map(int,input().split())
ans=[]
for i in range(n):
    a,b=map(int,input().split())
    ans.append([a,b])
ans=sorted(ans,key=lambda a:a[0])
money=0
cnt=m
for i in range(n):
    price=ans[i][0]
    num=ans[i][1]
    if m>0:
        if m <= num:
            money += m*price
            m=0
        else:
            m -= num
            money+=num*price
    elif m==0:
        break
print(money)

Measured memory_bytes: 22112
while 1:
    n = input()
    if n == 0:
        break
    buy = {}
    for i in xrange(n):
        s, p = raw_input().split()
        p = int(p)
        buy[s] = p
    m = input()
    make = {}
    for i in xrange(m):
        ipt = raw_input().split()
        o = ipt[0]
        q = ipt[2:]
        make[o] = q
    used = {}
    def dfs(s):
        if s in used:
            return used[s]
        if s in make:
            res = min(sum(dfs(t) for t in make[s]), buy[s])
        else:
            res = buy[s]
        used[s] = res
        return res
    print dfs(raw_input())

Measured memory_bytes: 6284
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

typedef long long ll;
typedef vector<int> vi;

const double PI=acos(-1.0);

ll X;
void input()
{
    cin>>X;
}

void solve()
{
    ll money=100;
    ll ans=1;
    while(1){
        if(money*1.01>=X) break;
        else {
            money*=1.01;
            ++ans;
        }
    }
    cout<<ans<<endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3648
m, d = list(map(int, input().split()))

ans = 0
for i in range(1,m+1):
    for j in range(22, d+1):
        d1 = int(str(j)[1])            
        d10 = int(str(j)[0])
        if d1*d10==i and d1 >=2:
            ans += 1


print(ans)

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18 + 1;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N, C;
ll imo[30][(ll)1e5 + 1];

signed main() {
    cin >> N >> C;
    REP(i, N) {
        LCIN(s, t, c);
        c--;
        imo[c][s]++;
        imo[c][t]--;
    }
    REP(i, C) REP(j, (ll)1e5) { imo[i][j + 1] += imo[i][j]; }
    REP(i, C) REP(j, (ll)1e5) {
        if(imo[i][j] == 0 && imo[i][j + 1] == 1) {
            imo[i][j]++;
        }
    }
    ll ans = 0;
    REP(j, (ll)1e5 + 1) {
        ll tmp = 0;
        REP(i, C) tmp += imo[i][j];
        ans = max(tmp, ans);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 23680
#include <iostream>

using namespace std;


int main() {
	int N;
	cin >> N;
	int max = 0, out = 0;
	for(int i = 0; i < N; i++) {
		int n;
		cin >> n;
		if(n >= max) max = n, out++;
	}

	cout << out << endl;
}


Measured memory_bytes: 384
#pragma region def
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

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

using llint = long long;
using vint = vector<int>;
using vvint = vector<vector <int>>;
using pint = pair<int, int>;
const int INF = 1e9;
const llint llINF = 1e18;
#pragma endregion

int main () {
    int n = 5;
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    vint time = {a, b, c, d, e};
    vint nexttime(n);
    for (int i = 0; i < n; i++) {
        if (time[i] % 10 == 0) nexttime[i] = time[i];
        else nexttime[i] = time[i] - time[i] % 10 + 10;
    }
    int besttime = INF;
    for (int i = 0; i < n; i++) {
        int sumtime = 0;
        for (int j = 0; j < n; j++) {
            if (i == j) {
                sumtime += time[j];
            } else {
                sumtime += nexttime[j];
            }
        }
        besttime = min(besttime, sumtime);
    }
    cout << besttime << endl;
    return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int const N=1e5+5;
int vis[N],a[N];
int main()
{
    memset(vis,0,sizeof(vis));
    int n;
    scanf("%d",&n);
    int res=0,x,k=0;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&x);
        if(x>100000)
        res++;
        else
        {
            a[k++]=x;
            vis[x]++;
        }
    }
    sort(a,a+k);
    k=unique(a,a+k)-a;
    for(int i=0;i<k;i++)
    if(a[i]>vis[a[i]])
    res+=vis[a[i]];
    else if(a[i]<vis[a[i]])
    res+=(vis[a[i]]-a[i]);
    printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 896
#include<algorithm>
#include<cstdio>
#include<functional>
#include<iostream>
#include<cfloat>
#include<climits>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<time.h>
#include<vector>
using namespace std;
int main()
{
	int x,y,n;
	cin >> x;
	n=x/15;
	y=x*800-200*n;
	cout << y << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int n, dp[300007][3][3], res;
char s[300007];
int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	dp[0][0][0] = 1;
	for (int i = 1; i <= n; i++)
		for (int j = 0; j <= 2; j++)
			for (int k = 0; k <= 2; k++)
			{
				if (s[i] == '?' || s[i] == '0')
				{
					if (k == 2)dp[i][j][1] = (dp[i][j][1] + dp[i - 1][j][k]) % mod;
					else dp[i][j][k + 1] = (dp[i][j][k + 1] + dp[i - 1][j][k]) % mod;
				}
				if (s[i] == '?' || s[i] == '1')
				{
					if (k)dp[i][j][k - 1] = (dp[i][j][k - 1] + dp[i - 1][j][k]) % mod;
					else dp[i][min(j + 1, 2)][k] = (dp[i][min(j + 1, 2)][k] + dp[i - 1][j][k]) % mod;
				}
			}
	for (int i = 0; i <= 2; i++)
		for (int j = 0; j <= i; j++)
			res = (res + dp[n][i][j]) % mod;
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 11136
#include <stdio.h>

int main(){
    int n, s;
    scanf("%d", &n);
        int a[n];
    for(int i = 1; i < n + 1; i++){
        scanf("%d", &s);
        a[n - i] = s;
    }
    for(int i = 0; i < n; i++){
        printf("%d", a[i]);
        if(i != n - 1){
            printf(" ");
        }
    }
    printf("\n");
    return 0;
}


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


int main(){
  string s;
  vector<string> v;
  char command;

  while( true ){
    getline( cin,s );
    if( s=="END_OF_TEXT" ) break;
    v.push_back( s );
  }

  unsigned int line=0, c=0;
  string buf="";
  bool RE = false;
  while( cin>>command && c!='-' ){
    switch( command ){
    case 'a': c=0;      break;
    case 'e': c=v[line].length();      break;
    case 'p': if( line>0 ) line--;  c=0;      break;
    case 'n': if( line+1<v.size() )line++; c=0;      break;
    case 'f':
      if( c<v[line].length() ) ++c;
      else if( line+1<v.size() ){line++;c=0;  }      break;
    case 'b':
      if( c>0 ) --c;
      else if( line>0 ){ --line; c=v[line].length(); }     break;
    case 'd':
      if( c<v[line].length() ) v[line].erase( c,1 );
      else if( line+1<v.size() ){
	v[line] = v[line] + v[line+1];
	v.erase( v.begin()+line+1 );
      }
      break;
    case 'k':
      if( c==v[line].length() ){
	if( line+1<v.size() ){
	  v[line] = v[line] + v[line+1];
	  v.erase( v.begin()+line+1 );
	  buf=""; RE=true;
	}
      }else{
	buf = v[line].substr( c ); RE=false;
	v[line] = v[line].substr( 0,c );
      }
      break;
    case 'y':
      if( RE ){
	buf = v[line].substr( c );
	v[line] = v[line].substr( 0,c );
	v.insert( v.begin()+line+1, buf );
	buf=""; c=0;line++;	
      }else if( buf!="" ){
	if( c<v[line].length() )
	  v[line] = v[line].substr( 0,c ) + buf + v[line].substr( c );
	else
	  v[line] = v[line] + buf;
	c += buf.length();
      }
    }
  }

  for( unsigned int i=0;i<v.size();i++ )
    cout << v[i] << endl;

  return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n, k, c;
  string s;
  cin >> n >> k >> c >> s;

  vector<int> l, r;

  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'x') continue;
    l.push_back(i);
    i += c;
    cnt++;
    if (cnt == k) break;
  }

  cnt = 0;
  for (int i = n-1; i >= 0; i--) {
    if (s[i] == 'x') continue;
    r.push_back(i);
    i -= c;
    cnt++;
    if (cnt == k) break;
  }
  reverse(r.begin(), r.end());

  for (int i = 0; i < l.size(); i++) {
    if (l[i] == r[i]) cout << l[i]+1 << endl;
  }

  return 0;
}

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

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

  vector<int> l(2 * n);
  rep(i, 2 * n) cin >> l[i];

  sort(l.begin(), l.end());

  int ans = 0;
  for (int i = 0; i < 2 * n; i += 2)
    ans += min(l[i], l[i + 1]);

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

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

int main(){
    string S;
    cin>>S;
    ll sum = 700;
    rep(i,0,3)if(S[i] == 'o')sum += 100;
    cout<<sum;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
int32_t main(){
	if(fopen("input.txt", "r"))
	freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0),cin.tie(0);
    int k,n,x=0;
    cin >> k >> n;
    int a[n];
    for(int i=0;i<n;i++)
    	cin >> a[i];
    for(int i=0;i<n-1;i++){
    	x=max(x,a[i+1]-a[i]);
    }
    x=max(x,a[0]+k-a[n-1]);
    cout << k-x;
}


Measured memory_bytes: 1792
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int a,b;
    string op;
    cin >> a >> op >> b;

    if(op=="+"){
        cout << a+b << endl;
    }else{
        cout << a-b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
using namespace std;
int is(char c)
{
    if(c == 'a' ||c == 'e'|| c == 'i'|| c =='o' || c =='u'||c == 'y')
        return 1;
    return 0;
}

int f[105];
char st[105];
int main()
{
    int n,a;

    scanf("%d%d",&n,&a);
    int cnt = n%500;
    if(a>=cnt)
        printf("Yes\n");
    else printf("No\n");
    return 0;
}


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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2e5 + 5;

typedef pair<int,int>   ii;

vector<int> g[N];

int vis[N];
int deg[N];

int f[N];
int c[N];

int ans = 0;

void dfs(int u,int p)   {
    int mx1 = 0;
    int mx2 = 0;

    for(int v : g[u])   if (v != p) {
        dfs(v,u);

        if (mx2 < f[v]) mx2 = f[v];
        if (mx1 < mx2)  swap(mx1,mx2);
    }
    f[u] = c[u] + mx1;

    if (ans < c[u] + mx1 + mx2)
        ans = c[u] + mx1 + mx2;
}

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

    int n;  cin >> n;

    for(int i = 1 ; i < n ; ++i)    {
        int x;  cin >> x;
        int y;  cin >> y;

        g[x].pb(y); deg[x]++;
        g[y].pb(x); deg[y]++;
    }
    string S;   cin >> S;   S = "#" + S;
    queue<int>  qu;

    for(int i = 1 ; i <= n ; ++i)
        if (deg[i] == 1 && S[i] == 'B')
            vis[i] = 1,
            qu.push(i);

    while (qu.size())   {
        int u = qu.front(); qu.pop();

        for(int v : g[u])   if(!vis[v]) {
            deg[v]--;
            if (deg[v] == 1 && S[v] == 'B') {
                vis[v] = 1;
                qu.push(v);
            }
        }
    }
    int R = 0;
    int s = -2;

    for(int i = 1 ; i <= n ; ++i)   if(!vis[i]) {
        c[i] = (S[i] == 'W') ^ (deg[i] & 1);
        R = i;
        s += 2 + c[i];

        vector<int> vec = g[i]; g[i].clear();

        for(int x : vec)    if(!vis[x])
            g[i].pb(x);
    }
    if (R == 0) return  cout << 0,0;
    else    {
        dfs(R,0);

        cout << abs(s - 2 * ans) << endl;
    }
}

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

#define sz(x) int(x.size())
#define pii pair<int, int>
#define Task "abc"
#define For(i, a, b) for(int i = (a), _b = (b); i <= b; ++i)
#define Debug(X) cout << #X << " = " << X << '\n'
#define All(x) (x).begin(), (x).end()
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;

const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;

int n, m;
pair<int, int> a[maxn];

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//  freopen(Task".inp", "r", stdin);
//  freopen(Task".out", "w", stdout);
  cin >> n >> m;
  for (int i = 0; i < n; ++i){
    cin >> a[i].first >> a[i].second;
  }
  sort(a, a + n);
  ll res = 0;
  for (int i = 0; i < n; ++i){
    if (m > a[i].second){
      res = res + 1ll * a[i].first * a[i].second;
      m -= a[i].second;
    } else {
      res = res + 1ll * a[i].first * m ;
      break;
    }
  }
  cout << res;
return 0;
}



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

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

    long long count=0;
    int black=0;

    for(int i=0; i<s.size(); i++){
        if(s[i]=='W'){
            count+=black;
        }else{
            black++;
        }
    }

    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	int i, j;
	int n;
	double a;
	
	scanf("%d", &n);
	
	if(n % 2 == 0) {//偶数である
		a = (double)1.0 / (double)2.0;
	} else {//奇数である
		a = (double)(n - n / 2) / (double)n;
	}
	
	printf("%f\n", a);
	
	return 0;
}


Measured memory_bytes: 128
X,Y=map(int, input().split())
v = [300000, 200000, 100000]
x = 0
y = 0
if X <= 3:
    x = int(v[X-1])
if Y <= 3:
    y = int(v[Y-1])
print(int(x + y + ((X==1) & (Y==1)) * 400000))


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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;

constexpr int inf = 1ll<<62;
constexpr int mod = 1e9+7;

main(){
  int n,m; cin >> n >> m;
  string s; cin >> s;
  vvi g(n);
  rep(i,m){
    int a,b; cin >> a >> b; a--; b--;
    if(count(all(g[a]),b) == 0)
      g[a].pb(b);
    if(count(all(g[b]),a) == 0)
      g[b].pb(a);
  }

  vi anum(n),bnum(n); // 隣接するA,Bの数
  rep(i,n) rep(j,g[i].size()){
    if(s[ g[i][j] ] == 'A') anum[i]++;
    else bnum[i]++;
  }

  vi used(n);
  rep(i,n){
    if(used[i] == 0 and anum[i] * bnum[i] == 0){
      used[i] = 1;
      queue<int> q;
      q.push(i);

      while(!q.empty()){
	int now = q.front();
	q.pop();

	rep(j,g[now].size()){
	  int next = g[now][j];
	  if(s[now] == 'A') anum[next]--;
	  else bnum[next]--;
	  
	  if(used[next] == 0 and anum[next]*bnum[next] == 0){
	    used[next] = 1;
	    q.push(next);
	  }
	}
      }
    }
    dump(used,anum,bnum);
  }
  if(accumulate(all(used),0ll) == n) cout << "No\n";
  else cout << "Yes\n";
}

Measured memory_bytes: 16004
#include<bits/stdc++.h>
 
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
using namespace std;
 
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;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
const int N = 2e5 +11;
int main(){
	ios::sync_with_stdio(false);
	int x,a;
	cin>>x>>a;
	if(x<a)cout<<0<<endl;
	else cout<<10<<endl;	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
int main(){
	reg int a,b,c,d,e;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	reg int t=(c-a)*60+(d-b);
	printf("%d\n",max(0,t-e));
	return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
int N, Q;
string S;
ll a[26][500001];
ll tree[26][500001];

ll sum(int cur, int i) {
	ll ans = 0;
	while (i > 0) {
		ans += tree[cur][i];
		i -= (i & -i);
	}
	return ans;
}
void update(int cur, int i, int diff) {
	while (i <= N) {
		tree[cur][i] += diff;
		i += (i & -i);
	}
}




int main() {

	cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
	cin >> N;
	cin >> S;
	cin >> Q;

	
	

	for (int i = 1; i <= N; i++) {
		char c = S[i - 1];
		update(c - 97, i, 1);
	}

	for (int i = 1; i <= Q; i++) {
		int c;
		cin >> c;
		if (c == 1) {
			int j; char q;
			cin >> j;
			cin >> q;
			//cout << q << "!" << endl;
			char p = S[j - 1];
			//cout << p << "!" << endl;
			S[j - 1] = q;
			if (p == q) continue;
			update(p - 97, j, -1);
			update(q - 97, j, 1);
		}
		else {
			int a, b, ret;
			cin >> a >> b;
			ret = 0;
			for (int j = 0; j < 26; j++) {
				
				if (sum(j, b) - sum(j, a - 1)) {
					//cout << j << " " << sum(j, b) << " " << sum(j, a - 1) << endl;
					ret++;
				}
			}
			cout << ret << endl;
		}
	}

}

Measured memory_bytes: 103324
import itertools

def main():
    m = 100
    n, m, q = input_list()
    queries = []
    for _ in range(q):
        queries.append(input_list())
    a = []
    for i in range(1, m+1):
        a.append(i)
    ans = []
    for i in itertools.combinations_with_replacement(a, n):
        ans.append(calc(i, queries))
    print(max(ans))


def calc(i, queries):
    ans = 0
    for q in queries:
        a, b, c, d = q
        if i[b-1] - i[a-1] == c:
            ans += d
    #print(i, ans)
    return ans

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


if __name__ == '__main__':
    main()


Measured memory_bytes: 74608
#include<iostream>
using namespace std;
int main()
{
	int n,i,j,s=0,c=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		c=0;
		for(j=1;j<=i;j++)
		{
				if(i%j==0)
				c++;
			
		}
		if(c==8&&i%2!=0)	s++;
	}
	cout<<s;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
using ll = long long;


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

    if (a >= 3200) {
        cout << s << endl;
    } else {
        cout << "red" << endl;
    }
    return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> ab(n);
    for (int i = 0; i < n; ++i) cin >> ab[i].first >> ab[i].second;
    // input

    sort(ab.begin(), ab.end(), [](const pair<int, int> &a, const pair<int, int> &b){return a.second < b.second; });
    ll sum {0};
    for (int i = 0; i < n; ++i) {
        sum += ab[i].first;
        if (sum > ab[i].second) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
  int N, M, x, y, ans = 0;
  scanf("%d %d", &N, &M);
  int num_ball[N];
  bool has_ball[N];
  fill_n(num_ball, N, 1);
  fill_n(has_ball, N, false);
  has_ball[0] = 1;
  for (int i = 0; i < M; ++i) {
    scanf("%d %d", &x, &y);
    has_ball[y - 1] = has_ball[x - 1] || has_ball[y - 1];
    --num_ball[x - 1];
    ++num_ball[y - 1];
	if (num_ball[x - 1] == 0) has_ball[x - 1] = false;
  }
  for (int i = 0; i < N; ++i) {
    if (has_ball[i]) ++ans;
  }
  printf("%d", ans);
  return 0;
}

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

int main()
{
  uint64_t a, b;
  cin >> a >> b;
  if (a > 0) a--;
  uint64_t x[] {a, 1, a + 1, 0};
  uint64_t y[] {b, 1, b + 1, 0};
  cout << (x[a % 4] xor y[b % 4]) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
using str=string;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

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

int main(){
    ios::sync_with_stdio(false);
    int a,b,ans;
    cin >> a >> b;
    if(a+1<=0.8*b||0.8*(b+1)<=a) cout << -1 << endl;
    else{
        rep(i,1300){
            if(12.5*a<=i&&i<12.5*(a+1)&&10*b<=i&&i<10*(b+1)){
                ans=i;
                break;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
use std::io;
fn main(){
    loop{
        let mut buf = String::new();
        let _ = io::stdin().read_line(&mut buf);
        if buf == "" { break; }
        let v: Vec<_> = buf.split_whitespace().collect();
        let a: i32 = v[0].parse().unwrap();
        let b: i32 = v[1].parse().unwrap();
        println!("{}", (a + b).to_string().len());
    
    }

}
    

// --- template ---
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
 
pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n {
        vs.push(readln());
    }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(
    String,
    bool,
    f32,
    f64,
    isize,
    i8,
    i16,
    i32,
    i64,
    usize,
    u8,
    u16,
    u32,
    u64
);
impl<T> FromLn for Vec<T>
where
    T: FromLn,
{
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);



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

using namespace std;

int main(){

	string input;
	cin >> input;
	for(int i = 0; i < input.size(); i++){
		int trans = (input[i]-3)- 'A';
		char fm;
		if(trans < 0)
			fm = 'Z' + trans + 1;
		else
			fm = 'A' + trans;
		cout << fm << flush;
	}
	cout << endl;

	int x;
	cin >> x;

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int n, cnt, a;
int main() {
	cin.tie(0)->sync_with_stdio(false);
	cin >> n;
	while (n--) {
		cin >> a;
		if (a % 2) {
			cout << "first" << '\n';
			return 0;
		}
	}
	cout << "second" << '\n';
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

bool dp[100005];

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

	for (int i = 1; i <= k; i++) {
		bool ok = false;
		rep (j, n) if (i - a[j] >= 0 && !dp[i - a[j]]) ok = true;
		dp[i] = ok;
	}

	cout << (dp[k] ? "First" : "Second") << endl;
	return 0;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
#define reps(i,n) for(ll i=1;i<=(n);++i)
using ll = long long;
using str = string;
constexpr long long INF = (1LL<<60);
constexpr long long MOD = (1e9+7);
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);}
template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}

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

  ll n;
  string s;
  cin>>n>>s;

  ll ans=1;
  rep(i,n-1){
    if(s[i]!=s[i+1])ans++;
  }
  cout<<(ans)<<endl;


}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

typedef long long LL;

const int maxn=305;
const LL mo=1e9+7;

int n,k,op[2*maxn];
bool bz[2*maxn],vis[2*maxn];
LL f[2*maxn][2*maxn];

LL ffac[2*maxn];
void Pre(int n)
{
	ffac[1]=1;
	fo(i,3,n) if (i&1) ffac[i]=ffac[i-2]*i%mo;
}
LL s(int x) {return (x==0) ?1 :ffac[x-1];}

priority_queue<int> Q,Q0;
int main()
{
	//freopen("d.in","r",stdin);
	//freopen("d.out","w",stdout);
	
	Pre(600);
	
	scanf("%d %d",&n,&k);
	fo(i,1,k)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		bz[x]=bz[y]=1;
		op[x]=y, op[y]=x;
	}
	int allfre=2*(n-k);
	
	LL ans=0;
	fo(i,1,2*n)
	{
		memset(vis,0,sizeof(vis));
		vis[i]=1;
		int fre=(!bz[i]);
		Q=Q0;
		if (bz[i]) Q.push(-op[i]);
		for(int j=i+1; j<=2*n; j++)
		{
			vis[j]=1;
			fre+=(!bz[j]);
			if (bz[j] && !vis[op[j]]) Q.push(-op[j]);
			if (!Q.empty() && -Q.top()==j) Q.pop();
			if (Q.empty())
			{
				if (fre%2==0)
				{
					f[i][j]=s(fre);
					for(int k=i+1, nowfre=(!bz[i])+(!bz[k]); k<j; k++, nowfre+=(!bz[k]))
						if (nowfre%2==0) (f[i][j]-=f[i][k]*s(fre-nowfre))%=mo;
				}
			}
			
			(ans+=f[i][j]*s(allfre-fre))%=mo;
		}
	}
	
	printf("%lld\n",(ans+mo)%mo);
}

Measured memory_bytes: 3072
#include <stdio.h>
#include <string>

using namespace std;


int main() {
  int N;

  scanf("%d", &N);

  int ans = 0;

  if(N % 2 == 0){
    ans = N;
  }else{
    ans = N * 2;
  }

  printf("%d", ans);

  return 0;
}


Measured memory_bytes: 128
import itertools
import bisect
n = int(input())
numbers = []
for i in range(3,10):
    for v in itertools.product(["7","5","3"], repeat=i):
        if "5" in v and "7" in v and "3" in v:numbers.append(int("".join(v)))
numbers.sort()
print(bisect.bisect_right(numbers,n))

Measured memory_bytes: 10180
import sys

def main():
    N, K = list(map(int,input().split()))
    h = [0] * N
    for i in range(N):
        h[i] = int(input())

    h = sorted(h)

    ave = []
    for j in range(0,N-K+1):
        ave.append(abs(h[j]-h[j+K-1]))

    print(min(ave))

main()

Measured memory_bytes: 10852
s = input()
k = 0
if s[0] == 'S':
    if s[1] == 'R' and s[2] == 'R':
        k = 2
    elif s[1] == 'S' and s[2] == 'S':
        k = 0
    else:
        k = 1
if s[0] == 'R':
    if s[1] == 'R':
        if s[2] == 'R':
            k = 3
        else:
            k = 2
    else:
        k = 1
print(k)

Measured memory_bytes: 9032
import sys
import itertools
from math import sqrt
input = sys.stdin.readline




N = int(input())

town = []
for _ in range(N):
    x, y = map(int, input().split())
    town.append((x, y))

L = 0
for i, j in list(itertools.combinations([i for i in range(N)], 2)):
    x, y = town[i]
    z, w = town[j]
    L += sqrt((x - z)**2 + (y - w)**2)
print(L * 2 / N)


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



int main()
{
	int n;
	cin >> n;
	vector<int> v;
	int t;
	for (int i = 0; i<n; i++)
	{
		cin >> t;
		v.push_back(t);
	}
	int tmin = v[0];
	int tmax = -1000000000;

	for (int i = 1; i<n; i++)
	{
		tmax = max(tmax, v[i] - tmin);
		tmin = min(tmin, v[i]);
	}
	cout << tmax << endl;
	return 0;
}


Measured memory_bytes: 3920
#import<iostream>
using namespace std;
int main(){
	int n, m;
	char a, b;
	while(cin>>n, n){
		int d[256] = {};
		for(int i=0;i<n;i++){
			cin >> a >> b;
			d[a] = b-a;
		}
		for(cin>>n;n--;putchar(a+d[a]))
			cin>>a;
		puts("");
	}
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = numeric_limits<int>::max()/2;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

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

    int h,w,k;cin>>h>>w>>k;
    vector<string> a(h);
    int sx,sy;
    vector<vector<int>> dis(h,vector<int>(w,INF));
    for(int i=0;i<h;i++){
        cin>>a[i];
        for(int j=0;j<w;j++){
            if(a[i][j]=='S'){
                sx=i;sy=j;
                a[i][j]='.';
            }
        }
    }
    queue<P> q;
    q.push(P(sx,sy));
    dis[sx][sy]=0;
    while(!q.empty()){
        P p=q.front();q.pop();
        if(dis[p.first][p.second]>=k) continue;
        for(int i=0;i<4;i++){
            int nx=p.first+dx[i],ny=p.second+dy[i];
            if(nx<0 || h<=nx || ny<0 || w<=ny) continue;
            if(a[nx][ny]=='#') continue;
            if(dis[nx][ny]!=INF) continue;
            q.push(P(nx,ny));
            dis[nx][ny]=dis[p.first][p.second]+1;
        }
    }
    vector<vector<int>> res(h,vector<int>(w,INF));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(dis[i][j]==INF) continue;
            if(i==0 || i==h-1 || j==0 || j==w-1){
                cout<<1<<endl;
                return 0;
            }
            q.push(P(i,j));
            res[i][j]=0;
        }
    }
    while(!q.empty()){
        P p=q.front();q.pop();
        for(int i=0;i<4;i++){
            int nx=p.first+dx[i],ny=p.second+dy[i];
            if(nx<0 || h<=nx || ny<0 || w<=ny) continue;
            if(res[nx][ny]!=INF) continue;
            q.push(P(nx,ny));
            res[nx][ny]=res[p.first][p.second]+1;
        }
    }
    int ans=INF;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(i!=0 && i!=h-1 && j!=0 && j!=w-1) continue;
            ans = min(ans,1+(res[i][j]-1)/k+1);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6272
#include<stdio.h>
#define MAX 100000
int partition(int,int);
int A[MAX];
int main(){

  int n,i,j,r,p;

  scanf("%d",&n);


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

  p = partition(0,n-1);
  

  for(i = 0;i < p;i++){
    printf("%d ",A[i]);
  }
  
  printf("[%d] ",A[p]);
  
  for(i = p+1;i<n-1;i++){
    printf("%d ",A[i]);
  }

  printf("%d\n",A[n-1]);


  return 0;
}

int partition(int p, int r){

  int i,x,j,change;

  x = A[r];
  i = p-1;

  for(j = p; j < r; j++){
    if(A[j] <= x){
      i = i+1;
      change = A[i];
      A[i] = A[j];
      A[j] = change;
    }
  }
  change = A[i+1];
  A[i+1] = A[r];
  A[r] = change;

  return i+1;
}

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

int main(){
    int s;
    cin >> s;
    int a = (s/1000)*10 + (s/100)%10;
    int b = ((s%100)/10)*10 + s%10;
    if(a >= 1 && a <= 12 && b >= 1 && b <= 12){
        cout << "AMBIGUOUS" << endl;
    }else if (a >= 1 && a <= 12){
        cout << "MMYY" << endl;
    }else if (b >= 1 && b <= 12){
        cout << "YYMM" << endl;
    }else{
        cout << "NA" << endl;
    }
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = 4*atan(1);
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
// ll gcd(ll a, ll b) { 
//     if (a == 0) return b; 
//     return gcd(b % a, a); 
// }
// ll f(ll x) {
// 	x%=MOD;
// 	if(x<0)x+=MOD;
// 	return x;
// }
// ll power(int base, int power) {
// 	ll prod = 1;
// 	ll b = base;
// 	while(power) {
// 		if (power & 1) {
// 			prod = f(prod*b);
// 		}
// 		b = f(b*b);
// 		power/=2;
// 	}
// 	return prod;
// }
// struct line {
//     int m, c;
//     ll eval(int x) { return 1LL * m * x + c; }
//     double intersectX(line l) { return (double) (c - l.c) / (l.m - m); }
// };
ll x;
void solve() {
	cin >> x;
	int lo = 1, hi = 3760;
	while(lo <= hi) {
		int mid = (lo+hi)/2;
		ll cur = 100;
		for (int i = 0; i < mid; i++) cur = floor((double)cur * 1.01); 
		if (cur >= x) {
			hi = mid - 1;
		} else {
			lo = mid + 1;;
		}
	}
	cout << hi + 1 << endl;
	
}
int main() {

	// int t;
	// cin >> t;
	// for (int i = 1; i <= t; i++) { 
		// cout << "Case #" << i << ": ";
		solve();
	// }
}

Measured memory_bytes: 3740
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  long long A, B, C, S = 0;

  std::cin >> A >> B >> C;

  long long x = std::min(B, C);

  B -= x;
  C -= x;
  S += x + x;

  x = std::min(A, C);

  A -= x;
  C -= x;
  S += x;

  x = B;

  B -= x;
  S += x;
  
  x = std::min(C, 1LL);

  C -= x;
  S += x;

  std::cout << S << std::endl;

  return 0;
}


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

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

    std::string ans = "None";
    std::sort(s.begin(), s.end());
    for(char c = 'a'; c <= 'z';c++){
        if(s.find(c) == std::string::npos){
            ans = c;
            break;
        }
    }
    std::cout<<ans<<std::endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,A,B;
    cin >> N >> A >> B;
    N %= 12;
    ll a,b;
    int n = N%6;
    if(n==0){
        a = A,b = B;
    }
    if(n==1){
        a = A-B,b = B;
    }
    if(n==2){
        a = A-B,b = A;
    }
    if(n==3){
        a = -B,b = A;
    }
    if(n==4){
        a = -B,b = A-B;
    }
    if(n==5){
        a = -A,b = A-B;
    }
    if(N>=6) a *= -1,b *= -1;
    cout << a << " " << b << endl;
}


Measured memory_bytes: 3212
N,K = (int(i) for i in input().split())
h = [int(input()) for i in range(N)]
sort = sorted(h)
min = 1000000000
for j in range(N-K+1):
  if sort[j+K-1] - sort[j] < min:
    min = sort[j+K-1] - sort[j]
    
print(min)

Measured memory_bytes: 8280