akhauriyash/Code-Regression huggingface dataset:
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {
	
	int a, b;
	scanf("%d%d", &a, &b);
	printf("%s\n", (a * b) % 2 == 0 ? "Even" : "Odd");
	
	Please AC;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int n;
    cin >> n;
    cout << (n>=1200?"ARC":"ABC");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;

int n, a, b;

int main() {
scanf("%d %d %d", &n, &a, &b);
printf("%d %d\n", min(a, b), max(0, a + b - n));
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(){
  int n,*x,i,k,judge=0,r=0;

  scanf("%d",&n);

  x = (int *)malloc(sizeof(int) * n);

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

for(i = 0;i<n;i++){
  judge=1;


  if (x[i] < 2 || x[i]%2==0)judge=0;
  k= 3;
  while (k <= sqrt(x[i])){
    if (x[i] % k ==0)judge=0;
    k = k + 2;
}
if (x[i] == 2)judge =1;
if(judge!=0)r++;
}
printf("%d\n",r );

return 0;
}



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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

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

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)2e6+111;
ll const LG=(ll)log2(N)+1;
ll fact[N];
ll inv[N];

void sol(){
        fact[0]=fact[1]=1;
        ll i;
        for(i=2;i<N;i++){
                fact[i]=i*fact[i-1];
                fact[i]%=MOD;
        }
        inv[N-1]=modinv(fact[N-1]);
        for(i=N-2;i>=0;i--){
                inv[i]=(inv[i+1]*(i+1))%MOD;
        }
}
ll ncr(ll n,ll r){
        ll ans=fact[n];
        ans*=inv[r];
        ans%=MOD;
        ans*=inv[n-r];
        ans%=MOD;
        return ans;
}
void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        sol();
        cin>>k;
        string s;
        cin>>s;
        n=s.sz;
        ll ans=0;
        for(i=n;i<=n+k;i++){
                ll tmp=pow1(26,n+k-i)*pow1(25,i-n);
                tmp%=MOD;
                tmp*=ncr(i-1,n-1);
                tmp%=MOD;
                ans+=tmp;
                ans%=MOD;
        }
        cout<<ans<<endl;
        
        
        
        
        
        
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


Measured memory_bytes: 35500
main :: IO ()
main = do
  n <- readLn :: IO Int
  ts <- map read . words <$> getLine :: IO [Int]
  m <- readLn :: IO Int
  ds <- getDrinks m :: IO [(Int, Int)]
  prints $ spec ds ts 

getDrinks :: Int -> IO [(Int, Int)]
getDrinks m = do
  ns <- sequenceA (replicate m (map read . words <$> getLine :: IO [Int])) :: IO [[Int]]
  return (map (\n -> (head n, last n)) ns)

charged :: [Int] -> (Int, Int) -> [Int]
charged ts d =
  (reverse $ tail $ reverse $ (take p ts)) ++ [x] ++ (drop p ts)
  where p = fst d
        x = snd d

spec :: [(Int, Int)] -> [Int] -> [Int]
spec ds ts = map (\d -> sum $ charged ts d) ds

prints :: [Int] -> IO ()
prints [] = return ()
prints (n:ns) = do
  print n 
  prints ns


Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

bool used[256][256];

int main(){
	
	int n; cin >> n;
	vector<pair<int, int>> rot;
	vector<pair<int, int>> blau;

	for( int i = 0; i < n; ++i ){
		int a, b; cin >> a >> b;
		rot.emplace_back(a, b);
	}
	for( int i = 0; i < n; ++i ){
		int c, d; cin >> c >> d;
		blau.emplace_back(c, d);
	}

	int ans = 0;
	
	sort( blau.begin(), blau.end(), []( const auto &x, const auto &y ){ return x.first < y.first; } );
	for( auto bp : blau ){
		vector<pair<int, int>> redcandy;
		for( auto rp : rot ){
			if( rp.first < bp.first && rp.second < bp.second && !used[rp.first][rp.second] ){
				redcandy.emplace_back( rp.first, rp.second );
			}
		}
		if( !redcandy.empty() ){
			sort( redcandy.begin(), redcandy.end(), []( const auto &x, const auto &y ){ return x.second > y.second; } );
			used[redcandy[0].first][redcandy[0].second] = true;
			++ans;
		}
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n,k;
	scanf("%d %d",&n,&k);
	if(n%2==0){
		if(k<=n/2){
			puts("YES");
		}else{
			puts("NO");
		}
	}else{
		if(k<=n/2 +1){
			puts("YES");
		}else{
			puts("NO");
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

// Activity Selection Problem
// 参加できる活動の個数を最大化
// 個数が同じなら時間を最大化
// O(n log n)
using P = pair<int, int>;
vector<P> activitySelectionProblem(vector<P> schedules) {
	int n = schedules.size();
	sort(schedules.begin(), schedules.end(), [](const P &a, const P &b) {return a.second == b.second ? a.first > b.first : a.second < b.second; });
	vector<P> res;
	if (schedules.size())res.push_back(schedules.front());
	for (auto schedule : schedules)
		if (res.back().second <= schedule.first)
			res.emplace_back(schedule);
	return res;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<P> v;
	rep(i, 0, n) {
		int s, t; cin >> s >> t;
		s--;
		v.emplace_back(s, t);
	}
	auto res = activitySelectionProblem(v);
	cout << res.size() << endl;
	return 0;
}


Measured memory_bytes: 6008
n = int(input())
a = list(map(int, input().split()))
a.sort()
maxa = max(a)

dp = {i: 0 for i in range(1, maxa+1)}

ans = 0
for i in range(n):
    if dp[a[i]] == 1:
        continue

    if i == n - 1 or a[i] != a[i+1]:
        ans += 1

    t = 1
    while a[i]*t <= maxa:
        dp[a[i]*t] = 1
        t += 1

print(ans)

Measured memory_bytes: 103684
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const int INF = 100100100;
typedef long long ll;
 
int main() {
   int n,t[110];
   cin >> n;
   int sum=0;
   for(int i=1; i<=n; i++){
   cin >> t[i];
   sum+=t[i];
   }

   int m,p,x,ans=0;
   cin >> m;
   rep(i,m){
   cin >> p >> x;
   ans=sum-t[p]+x;
   cout << ans << endl;  
   }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define PI acos(-1)
typedef long long ll;

int main() {
    ll L, R;
    cin >> L >> R;
    int bor = (R / 2019) * 2019;
    if (L <= bor) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 2019 * 2019;
    L %= 2019;
    R %= 2019;
    for (int i = L; i < R; i++) {
        for (int j = i + 1; j <= R; j++) {
            ans = min(ans, (ll)i * j % 2019);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <list>
using namespace std;
typedef list<int>l;
int main()  
{   l one;
	l::iterator i;
    int n, m, t=1;  
    scanf("%d",&n);  
    for(int i=0; i<n; ++i)  
    {  
        scanf("%d",&m);  
        t = !t;  
        if(t) one.push_back(m);
        else one.push_front(m);  
    }  
	
    if(!(n&1)) one.reverse(); 
    for (i = one.begin(); i!=one.end(); ++i)
	cout << *i << " ";
    return 0;  
}  

Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int a, b;
    cin >> a >> b;
    cout << max({a + b, a - b, a * b}) << endl;
    return 0;
}


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

int main()
{
  int n;
  scanf("%d",&n);
  static char s[10000];
  scanf("%s",s);
  static int a[3000],b[3000],c[10000];
  int na=0,nb=0;
  for(int i=0;i<2*n;i++){
    if(s[i]=='a'){
      a[na]=i;
      c[i]=na++;
    }
    else{
      b[nb]=i;
      c[i]=nb++;
    }
  }
  vector<int> bg,ed;
  for(int i=0;i<n;){
    if(a[i]>b[i]){
      bg.push_back(i);
      int t=a[i];
      while(b[i]<t){
	t=a[i];
	i++;
      }
      ed.push_back(i);
    }
    else{
      i++;
    }
  }
  string ans;
  for(int t=bg.size()-1;t>=0;t--){
    int x=bg[t],y=ed[t];
    string p="";
    for(int i=x;i<y;i++){
      string q;
      for(int j=0;j<2*n;j++){
	if(c[j]>=i&&c[j]<y){
	  q+=s[j];
	}
      }
      if(p<q){
	p=q;
      }
    }
    if(p+ans>ans){
      ans=p+ans;
    }
  }
  for(int i=n-1;i>=0&&a[i]<b[i];){
    ans+="ab";
    int t=a[i];
    while(i>=0&&b[i]>t)i--;
  }
  printf("%s\n",ans.c_str());
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs

const int MAXN = 305;

int n; // max partition #: 348881876
int a[MAXN];
int cnt[10];
int sum;
double dp[MAXN][MAXN][MAXN];

double calc(int i, int j, int k) {
  if (dp[i][j][k] != -1) {
    return dp[i][j][k];
  }
  int l = n - i - j - k;
  if (i == n) {
    dp[i][j][k] = 0.0;
    return 0.0;
  }

  double tail = 0.0;
  if (j > 0) {
    tail += (1.0 * j / n) * (1.0 + calc(i + 1, j - 1, k));
  }
  if (k > 0) {
    tail += (1.0 * k / n) * (1.0 + calc(i, j + 1, k - 1));
  }
  if (l > 0) {
    tail += (1.0 * l / n) * (1.0 + calc(i, j, k + 1));
  }
  tail += 1.0 * i / n;

  dp[i][j][k] = tail / (1.0 - 1.0 * i / n);
  // cerr << i << " " << j << " " << k << " " << l << " " << dp[i][j][k] << endl;
  return dp[i][j][k];
}

int main() { 

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

  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n - i; j++) {
      for (int k = 0; k <= n - i - j; k++) {
        dp[i][j][k] = -1;
      }
    }
  }

  printf("%.12lf\n", calc(0, cnt[1], cnt[2]));

  return 0;
}


Measured memory_bytes: 219392
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; ++i) // マクロ
using namespace std; // stdの省略
using pii = pair<int, int>; // pairの略記
using ll = long long; // long longの略記



int main(void) {
   
   int n;
   cin >> n;
   
   int a = 1, b;
   int neq = 0, eq = 0;
   while (a*a<n) {
       b = n / a; // Bmax, A<B
       neq += b-a;
       if (a * b == n)  neq--;
       if (b - a >= 0) eq++;
       a++;
   }
   
   neq *= 2; // A>Bを加算

   cout << neq+eq << endl;
   
   return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int N, A, B, C;
int l[8];
int ans = 1 << 30;

void rec(int a, int b, int c, int idx, int m) {
  if (idx == N) {
    if (a == 0 || b == 0 || c == 0) return;
    ans = min(ans, abs(A - a) + abs(B - b) + abs(C - c) + m);
  } else {
    rec(a + l[idx], b, c, idx + 1, m + (a == 0 ? 0 : 10));
    rec(a, b + l[idx], c, idx + 1, m + (b == 0 ? 0 : 10));
    rec(a, b, c + l[idx], idx + 1, m + (c == 0 ? 0 : 10));
    rec(a, b, c, idx + 1, m);
  }
}

int main() {
  cin >> N >> A >> B >> C;
  rep(i, N) cin >> l[i];
  rec(0, 0, 0, 0, 0);

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include <climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF (int)1e9
#define INFL (ll)1e11
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int K;
	cin >> K;
	int res;
	if (K % 2 == 0) {
		res = K*K / 4;
	}
	else {
		res = (K / 2)*(K / 2 + 1);
	}
	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 256
import numpy as np
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
A = np.array(A)
s = np.argsort(A)
l = s[-1]
L = A[l]
for i in range(N):
    if i != l:
        print(L)
    else:
        print(A[s[-2]])

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

int main() {
	int N;
	cin >> N;
	vector<int> X(N,0);
	for (int i = 0; i < N; i++) cin >> X[i];
	int mean = 0;
	for (int x : X) mean += x;
	mean /= N;
	int HP1 = 0;
	for (int x : X) HP1 += (x - mean) * (x - mean);
	mean++;
	int HP2 = 0;
	for (int x : X) HP2 += (x - mean) * (x - mean);
	cout << (HP1 < HP2 ? HP1 : HP2);
}

Measured memory_bytes: 256
N, K = map(int, input().split())
S = input()

left = 0
right = 0
ans = 0
remain = K
if S[0] == "0":
    remain -= 1

while left < N:
    while right < N and remain >= 0:
        if S[right] == "1" and right + 1 < N and S[right + 1] == "0":
            remain -= 1
        right += 1
    ans = max(ans, right - left)
    if left == right:
        right += 1
    else:
        if S[left] == "0" and left + 1 < N and  S[left + 1] == "1":
            remain += 1
    left += 1
print(ans)


Measured memory_bytes: 3316
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int A, B, C;
	cin >> A >> B >> C;
	if (A <= C && C <= B) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
 
#include <bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define f first
#define s second
#define sz(x) ll(x.size())
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
 
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
 
const ll mod = 998244353;
const int inf = 1e9 + 5;
const int N = 4e5 + 5;

signed main(){
    fastio;
    int i,q,rev=0;
    deque<char> d;
    string s,ans;
    cin>>s>>q;
    for(auto i:s){
        d.push_back(i);
    }
    while(q--){
        int t; cin>>t;
        if(t==2){
            int f; char c;
            cin>>f>>c;
            if(f==1){
                if(rev & 1)
                    d.push_back(c);
                else
                    d.push_front(c);
            }
            else{
                if(rev & 1)
                    d.push_front(c);
                else
                    d.push_back(c);
            }
        }
        else
            ++rev;
    }
    for(auto i:d)
        ans+=i;
    if(rev & 1)
        reverse(all(ans));
    cout<<ans;
    return 0;
}

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

#define cc(x) cout << (x) << endl
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); ++i)
typedef long long ll;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }


int n,m;
int a, b, k;
const ll inf = 1LL<<58;
const int iinf = 1<<30;


int main(){
    cin >> a >> b >> k;
    int count = 0;
    for(int i=a; i > 0; i--){
        if(a%i==0&&b%i==0){
            count++;
        }
        if(count==k){
            cc(i);
            break;
        }
    }
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	string s;
	cin >>n >>k >>s;
	
	s[k-1] = s[k-1] -'A'+'a';
	cout <<s <<"\n";
	return 0;
}


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

signed main(){
	int N; cin>>N;
	set<int> que;
	int max_ans=0,min_ans=0;
	for(int i=0;i<N;i++){
		int a; cin>>a; a/=400;
		if(a>=8 and que.count(8))max_ans++;
		que.insert(min(a,8LL));
	}
	min_ans=que.size();
	max_ans+=que.size();
	if(que.count(8)){
		min_ans--;
	}

	cout<<max(1LL,min_ans)<<" "<<max_ans<<endl;
	

}

Measured memory_bytes: 256
antennas = []
5.times do
  antennas << gets.to_i
end
max = gets.to_i
c = 0
4.downto(1) do |i|
  c += 1 if antennas[i] - antennas[0] > max
end
if c > 0
  puts ":("
else
  puts "Yay!"
end

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
using namespace std;

const int UNEXPLORED = 0;
const int UNDEFINED = -1;
int n;

int main(void){
    int k; cin >> n >> k;
    int dp[n][3][3];
    int fixedPasta[n];
    rep(day, n) fixedPasta[day] = UNDEFINED;
    rep(i, n) rep(j, 3) rep(l, 3) dp[i][j][l] = UNEXPLORED;

    while(k --){
        int a, b; cin >> a >> b;
        fixedPasta[a - 1] = b - 1;
    }

    rep(day, n){
        if(fixedPasta[day] != UNDEFINED){
            if(day == 0){ dp[day][fixedPasta[day]][1] = 1; continue; }
            rep(p, 3)
                if(p != fixedPasta[day])
                    for(int d = 1; d <= 2; d ++)
                        (dp[day][fixedPasta[day]][1] += dp[day - 1][p][d]) %= 10000;
            dp[day][fixedPasta[day]][2] = dp[day - 1][fixedPasta[day]][1];
        }

        else{
            if(day == 0){ rep(p, 3) dp[day][p][1] = 1; continue; }
            rep(p, 3){
                rep(pd, 3)
                    if(p != pd)
                        for(int d = 1; d <= 2; d ++)
                            (dp[day][p][1] += dp[day - 1][pd][d]) %= 10000;
                dp[day][p][2] = dp[day - 1][p][1];
            }
        }
    }

    int result = 0;

    rep(p, 3)
        for(int d = 1; d <= 2; d ++)
            (result += dp[n - 1][p][d]) %= 10000;

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 1164
n, k = map(int,input().split())
x = list(map(int,input().split()))
ans =  10 ** 9
for i in range(n-k+1):
    if abs(x[i]) > abs(x[i+k-1]):
        time = abs(x[i+k-1]) + abs(x[i] - x[i+k-1])
    else:
        time = abs(x[i]) + abs(x[i] - x[i+k-1])
    ans = min(ans, time)
print(ans)

Measured memory_bytes: 14224
/**
 * ????????????
???????????????????¨???????????????????????????????????????????????¨???°????????°??????????????°??????????¨???°???????¨??????§??????????????°????????¬?????????????¨??????§?¨???°???????????°???
(1+2)*(5+4) ?????????????????????????¨??????§??? 1 2 + 5 4 + *
??¨?¨???°??????????????????????????????????¨??????§?????????????¨??????§????????¨????????¬??§???????????§???????????¨????????????????????????????????????

???????????????????¨??????§?????????????????°???????¨????????????????????????????????????????

??\???
???????????°??????????????????????????????????????£?¶?????????????????????????????????????????????????????????????????????????????????§????????????????????????????????????

??????
?¨?????????????????????????????????????????????????

??¶?´?
2 ??? ??????????????????????????????????????° ??? 100
1 ??? ????????????????????????????????° ??? 99
???????????? +???-???* ?????????????????????????????????????????????106 ??\????????£?????´??°
-1 ?? 10^9 ??? ?¨???????????????? ??? 10^9
??\?????? 1
1 2 +
????????? 1
3
??\?????? 2
1 2 + 3 4 - *
????????? 2
-3
 */

#include <iostream>
#include <sstream>
#include <stack>

int main(int argc, char const *argv[]) {
  std::stack<int> Stack;

  std::string Param;
  std::istringstream iss;
  std::stringstream ss;
  std::string Token;
  getline(std::cin, Param);
  ss.str(Param);

  while (getline(ss, Token, ' ')) {
    if (Token == "+") {
      int y = Stack.top();
      Stack.pop();
      int x = Stack.top();
      Stack.pop();
      Stack.push(x + y);
    } else if (Token == "-") {
      int y = Stack.top();
      Stack.pop();
      int x = Stack.top();
      Stack.pop();
      Stack.push(x - y);
    } else if (Token == "*") {
      int y = Stack.top();
      Stack.pop();
      int x = Stack.top();
      Stack.pop();
      Stack.push(x * y);
    } else {
      Stack.push(stoi(Token));
    }
  }
  std::cout << Stack.top() << std::endl;

  return 0;
}

Measured memory_bytes: 3160
open System

let N,K = 
    let t = Console.ReadLine().Split() 
            |> Array.map(int)
    t.[0],t.[1]
    
[K+1..N]
|> List.map(fun b -> 
    (int64 <| 
        let e = N % b
        let p = N / b
        let r =  
           if   K = 0  then e
           elif e >= K then e - K + 1
           else             0   
        (b - K) * p + r))                       
|> List.sum
|> printfn "%i" 
        

Measured memory_bytes: 21336
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <numeric>
using namespace std;
#define ll long long int 

int gcd(int a,int b){
  if(a < b)swap(a,b);
  //cout << "a = " << a << ": b = " << b << endl;
  if( a % b == 0){
    return b;  
  }else{
    return( gcd( b,a%b ) );  
  }
}
int main(){
  int n;cin >> n;
  int ans = 1;
  vector< int > a(n);
  for(int i = 0; i < n; ++i){
    cin >> a[i];
  }
  ans = a[0];
  //cout << "入力done" << endl;
  for(int i = 0; i < n; ++i){
    //cout << "-------数列の"<< i << "番目start--------" << endl;
    ans = gcd( ans, a[i]);
    //cout << "-------数列の"<< i << "番目done--------" << endl;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1144
#include <cstring>
#include <cstdio>
int arr[200005], res[200005]; 
inline bool chk(int n, int m)
{
	memset(res, 0, sizeof(res)); 
	for (int i = 1; i < n * 2 - 1; i++)
	{
		if ((arr[i] < m) ^ (arr[i - 1] < m) ^ 1)
			res[i] = res[i - 1] = 1; 
	}
	for (int i = n - 1, j = n - 1; i >= 0; i--, j++)
	{
		if (res[i])
			return arr[i] >= m; 
		if (res[j])
			return arr[j] >= m; 
	}
	return arr[0] >= m; 
}
int main()
{
	// freopen("AGC006-D.in", "r", stdin); 
	int n; 
	scanf("%d", &n); 
	for (int i = 0; i < n * 2 - 1; i++)
		scanf("%d", arr + i); 
	int l = 0, r = n * 2 - 1, ans; 
	while (l <= r)
	{
		int m = l + r >> 1; 
		if (chk(n, m))
		{
			ans = m; 
			l = m + 1; 
		}
		else
			r = m - 1; 
	}
	printf("%d\n", ans);
	return 0; 
}


Measured memory_bytes: 1664
import math
import numpy as np


N = int(input())
S = list(input())

count = 0

for i in range(N):
    l1_l2_and = set(S[0:i+1]) & set(S[i+1::])
    if len(l1_l2_and) > count:
        count = len(l1_l2_and)

print(count)


Measured memory_bytes: 15672
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

// #pragma GCC optimize(2)
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> ppl;
#define ain(a,n) for(ll i=0;i<(n);++i)	cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define mp make_pair
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
#define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 1000005
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 1e8;
ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

signed main() {

	fast
	ll n, m, k;
	cin >> n >> m >> k;
	vector<ll> a, b;
	ll el;
	loop(i, n)	cin >> el , a.pb(el);
	loop(i, m)	cin >> el , b.pb(el);
	FOR(i, 1, n - 1)	a[i] += a[i - 1];
	FOR(i, 1, m - 1)	b[i] += b[i - 1];
	ll ans = 0;
	loop(i, n)
	{
		if (a[i] > k)
			continue;
		ll f = a[i];
		ll s = k - a[i];
		auto low = lower_bound(all(b), s);
		if (*low != s)
			--low;
		ll books = i + 1 + (low - b.begin() + 1);
		ans = max(ans, books);
	}
	loop(i, m)
	{
		if (b[i] > k)
			continue;
		ll f = b[i];
		ll s = k - b[i];
		auto low = lower_bound(all(a), s);
		if (*low != s)
			--low;
		ll books = i + 1 + (low - a.begin() + 1);
		ans = max(ans, books);
	}
	cout << ans << END;




// #ifndef ONLINE_JUDGE
// 	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
// #endif
	return 0;
}

Measured memory_bytes: 7952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll inf = 1e18;
ll mod = 1e9+7;
ll p[100010];
ll rec[100010];
ll n,k;

ll mp(ll a, ll b) {
    if (b == 0) return 1LL;
    ll ret = mp(a,b/2);
    ret *= ret;
    ret %= mod;
    if (b & 1) ret *= a;
    return ret % mod;
}

ll mpp(ll a) {
    if (rec[a] != 0) return rec[a];
    return mp(a,n);
}
ll ans;

int main(){
    cin >> n >> k;
    for (int i = k; i >= 1; i--) {
        p[i] = mp(k/i,n);
        for (int j = i + i; j <= k; j += i) {
            p[i] += mod * mod - p[j];
            p[i] %= mod;
        }
    }
    for (int i = 1; i <= k; i++) {
        // cout << p[i] << endl;
        ans += p[i] * i % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4420
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    int N;
    vector<int> H;
    cin>>N;

    for(int i = 0;i < N;i++) {
        int h;
        cin>>h;
        H.push_back(h);
    }
    H.push_back(TEN(9)+1);

    for(int i = N;i > 0;i--) {
        if(H[i-1] > H[i]) {
            H[i-1]--;
        }
    }

    int ans = 0;
    for(int i = 0;i < N;i++) {
        if(H[i] > H[i+1]) {
            cout<<"No"<<endl;

            return 0;
        }
    }
    
    cout<<"Yes"<<endl;

    return 0;
}




Measured memory_bytes: 892
#include<stdio.h>

int main(void){
	int n,m,c;
	int a[20][20];
	int b[20];
	int buff;

	int i,j;
	int count;
	int result = 0;
	scanf("%d %d %d",&n,&m,&c);
	c *= -1;

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

	for(i=0;i<n;i++){
		count = 0;
		for(j=0;j<m;j++){
			scanf("%d",&buff);
			count += b[j] * buff;
		}
		if(count > c){
			result++;
		}
	}
	
	printf("%d\n",result);

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;

const int N = 1e6 + 69;

int n,x,y,m;

int A[N];

string s,t,u;

int main(){

    cin>>s;
    for(int i=0;i<s.size();i++)
        cout<<'x';

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
 
void func(){

string s;
cin>>s;

if(s[0]!=s[1] && s[2]==s[3] && s[4]==s[5])
  cout<<"Yes"<<endl;
else
  cout<<"No"<<endl;

}
 
 
 
 
 
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
 
     /* #ifndef ONLINE_JUDGE
      freopen("input.txt", "r" , stdin);
      freopen("output.txt", "w" , stdout);
      #endif*/
 
   ll t=1;
   //cin>>t;
   while(t--)
   func();
 }

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 45;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  vector<P> ans;
  vector<int> dp(1000005, INF), odd_dp(1000005, INF);
  dp[0] = odd_dp[0] = 0;
  vector<int> f;
  vector<int> input;
  while(true) {
    int n; cin >> n;
    if(n == 0) break;
    input.push_back(n);
  }

  f.push_back(0);
  for(int i = 1;;++i) {
    if((i*(i+1)*(i+2))/6 > 2000000) break;
    f.push_back((i*(i+1)*(i+2))/6);
  }

  for(int i = 1; i <= 1000000; ++i) {
    for(int j = 1;; ++j) {
      if(i-f[j] < 0) break;
      chmin(dp[i], dp[i-f[j]]+1);
      if(f[j]%2==1) chmin(odd_dp[i], odd_dp[i-f[j]]+1);
    }
  }
  for(auto in : input) ans.emplace_back(dp[in], odd_dp[in]);
  for(auto x : ans) cout << x.first << " " << x.second << "\n";
}


Measured memory_bytes: 10580
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long S = sc.nextLong();

		if (S == 1000000000) {
			for (int i = 0; i < K; i++) {
				System.out.print(S + " ");
			}
			for (int i = 0; i < N - K; i++) {
				if (i == N - K - 1) {
					System.out.print("1");
				}else {
					System.out.print("1" + " ");
				}
			}
		}else {
			for (int i = 0; i < K; i++) {
				System.out.print(S + " ");
			}
			for (int i = 0; i < N - K; i++) {
				if (i == N - K - 1) {
					System.out.print(S+1);
				}else {
					System.out.print(S+1 + " ");
				}
			}
		}

	}
}

Measured memory_bytes: 52560
import math

a,b,h,m = map(int, input().split(" "))

a_radian = 2*math.pi*(h*60+m)/720
b_radian = 2*math.pi*m/60

ab = min(abs(a_radian-b_radian) , 2*math.pi-abs(a_radian-b_radian))

c = (a**2 + b**2 - 2*a*b*math.cos(ab))**0.5

print(round(c,12))

Measured memory_bytes: 9532
import Data.List

main = interact $ unlines . return . cup_game . map (splitOn ',') . lines
cup_game = foldl' swap "A"
 where swap c [c1,c2] | c == c1 = c2 | c == c2 = c1 | otherwise = c

splitOn c xs
 | null xs = []
 | head xs == c = splitOn c (tail xs)
 | otherwise = (takeWhile (/= c)) xs : splitOn c (dropWhile (/= c) xs)

Measured memory_bytes: 3528
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <map>
#include <cmath>
#include <algorithm>
#include <stack>
using namespace std;
int tag[105],num[105];

int main()
{
    int n;
    cin >> n;
    string str;
    cin >> str;
    int ans = 0;
    for(int i = 0;i < n;++i){
        memset(tag,0,sizeof(tag));
        memset(num,0,sizeof(num));
        int tmp = 0;
        for(int j = 0;j <= i;++j){
            num[str[j]-'a']++;
        }
        for(int j = i+1;j < n;++j){
            if(num[str[j]-'a']) tag[str[j]-'a'] = 1;
        }
        for(int j = 0;j <= 26;++j) tmp += tag[j];
        ans = max(ans,tmp);
    }
    cout <<ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int H = int.Parse(str[0]);
		int W = int.Parse(str[1]);
		int A = int.Parse(str[2]);
		int B = int.Parse(str[3]);
		int[,]C = new int[H,W];
		for(var i=0;i<B;i++){
			for(var j=0;j<A;j++){
				C[i,j] = 1;
			}
		}
		for(var i=B;i<H;i++){
			for(var j=A;j<W;j++){
				C[i,j] = 1;
			}
		}
      	var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
		Console.SetOut(sw);
		for(var i=0;i<H;i++){
			for(var j=0;j<W;j++){
				Console.Write(C[i,j]);
			}
			Console.WriteLine();
		}
	    Console.Out.Flush();
	}
}

Measured memory_bytes: 19916
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
#include <bitset>
#include <string>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)


ll modpow(ll x, ll n) {
    if (n == 0) {
        return 1;
    } else if (n % 2 == 0) {
        ll h = modpow(x, n / 2);
        return h * h % MOD;
    } else {
        return x * modpow(x, n - 1) % MOD;
    }
}

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

int main() {
    int A, B, C, X, Y;  cin >> A >> B >> C >> X >> Y;
    int sa = X - Y, half = C / 2, cost = 0;

    cost = min(C*2,A+B)  * min(X,Y);
    if (sa >= 0){
      cost += sa * min(A, C*2);
    }else{
      sa *= -1;
      cost += sa * min(B, C*2);
    }

    cout << cost << endl;

    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9 + 7;
const int inf = 1e8;

int main() {
	string S;
	cin>>S;
	int N = S.size();
	cerr<<S<<endl;
	int ans = inf;
	rep(i,N-2){
		string T = S.substr(i,3);
		int M = stoi(T);
		ans = min(ans, abs(753-M));
		cerr<<S[i]<<endl;
		cerr<<M<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int x, a; cin >> x >> a;
  cout << (x < a ? 0 : 10) << '\n';
}

Measured memory_bytes: 256
require 'set'
x, n = gets.chomp.split.map(&:to_i)
if n == 0
  puts x
  exit
end
p = gets.chomp.split.map(&:to_i)

t = Set.new((0..101).to_a)
t = t - Set.new(p)
t = t.to_a.sort_by! {|i| (x - i).abs }
puts t[0]

Measured memory_bytes: 14236
#include<iostream>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;

int n, data[51];
ll dp[51];

int solve(){

  for(int i = 0 ; i < 51 ; i++ ){
    dp[i] = 1ll << i;
  }
  for(int day = 0 ; day < 30 ; day++ ){
    for(int i = 0 ; i < n ; i++ ){
      if( (data[i] >> day) & 1){ //Happyだね
        for(int j = n - 1 ; j > i ; j-- ){
          if( (data[j] >> day) & 1){ // さらにHappyだね
            dp[i] = dp[j] = ( dp[i] | dp[j] );
            if( dp[i] == (1ll << n) - 1) return day + 1;
          }
        }
      }
    }
  }
  return -1;
}

int main(){

  while(cin >> n , n){
    fill_n( data, 51, 0);
    for(int i = 0 ; i < n ; i++ ){
      int q;
      cin >> q;
      while( q-- ){
        int day;
        cin >> day;
        day--;
        data[i] |= 1 << day;
      }
    }
    cout << solve() << endl;
  }
}

Measured memory_bytes: 1160
n = 5;
a = [int(input()) for i in range(n)];
last = 9;
time = 0;
flag = True;

for i in a:
	if last % 10  >= i % 10 >= 1:
		time += last  // 10 * 10 + 10;
		last = i;
		flag = False;

	elif i % 10 == 0:
		time += i;

 	else:
		time += i  // 10 * 10 + 10;

if flag:
	print(time + last - 9);

else:	
	print(time + last - 10);

Measured memory_bytes: 2568
#include <stdio.h>

int main(void){
    
    int i,j,k=0,l=0;
    long double a,a_tmp,sum;
    
    while(1){
        
        scanf("%Lf",&a);
        if(feof(stdin))break;
        
        sum=a;
        a_tmp=a;
        
        for(i=0;i<4;i++){
            sum+=a_tmp*2.0;
            a_tmp=a_tmp*2.0;
            sum+=a_tmp/3.0;
            a_tmp=a_tmp/3.0;
        }
        sum+=a_tmp*2.0;
        a_tmp=a_tmp*2.0;
        printf("%Lf\n",sum);
    }
    return(0);
}

Measured memory_bytes: 656
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  long D;
  cin >> D;
  vector<long> c(26);
  rep(i,26) cin >> c.at(i);
  vector<vector<long>> s(D,vector<long>(26));
  rep(i,D){
    rep(j,26) cin >> s.at(i).at(j);
  }

  vector<long> t(D);
  rep(i,D) cin >> t.at(i);

  long m;
  cin >> m;
  rep(i,m){
    long d,q;
    cin >> d >> q;
    d--;
    t.at(d) = q;
    long ans = 0;
    vector<long> lastday(26,-1);
    rep(i,D){
      long tt = t.at(i) - 1;
      ans += s.at(i).at(tt);
      lastday.at(tt) = i;
      rep(j,26){
        ans -= (i - lastday.at(j)) * c.at(j);
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3656
import collections
import math

def main():
    N = int(input())
    A = list(map(int, input().split()))

    Cou = collections.Counter(A)
    ans = 0

    oo = 0
    for c in Cou.values():
        oo += c * (c-1) // 2
    #print(Cou)
    for k in range(1, N+1):
        c = Cou[A[k-1]] - 1
        print(oo - c)
    return 0


if __name__ == '__main__':
    main()

Measured memory_bytes: 88140
#include<bits//stdc++.h>
using namespace std;
int a[1000500];
int main(){
	for(int i=2;i*i<1000500;i++){
		for(int j=i*2;j<1000500;j+=i){
			a[j]=1;
		}
	}
	int b;
	while(cin>>b){
		int c=0;
		for(int i=2;i<=b;i++){
			if(a[i]==0) c++;
		}
		cout<<c<<endl;
	}
}

Measured memory_bytes: 6968
<?php
$s = trim(fgets(STDIN));
$t = trim(fgets(STDIN));
$arr_s = str_split($s);
$arr_t = str_split($t);

$count = 0;
for($i=0; $i < 3; $i++){
    if($arr_s[$i] == $arr_t[$i]){
        $count++;
    }
}
echo $count;
?>

Measured memory_bytes: 4728
#include<stdio.h>

int main(void){
  int N;
  scanf("%d",&N);
  int A[N],B[N],C[N - 1];
  for(int i = 0;i < N;i++)
    scanf("%d",&A[i]);  
  for(int i = 0;i < N;i++)
    scanf("%d",&B[i]);
  for(int i = 0;i < N - 1;i++)
    scanf("%d",&C[i]);
  int sum = 0;
  for(int i = 0;i < N;i++){
    sum += B[A[i] - 1];
    if(A[i + 1] == A[i] + 1)
      sum += C[A[i] - 1];    
  }
  printf("%d",sum);
  return 0;
}

Measured memory_bytes: 128