akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#define _USE_MATH_DEFINES
#include<math.h>
#include<algorithm>
#include<memory>
#include<string>
#define Rep(i,n) for(int i = 0;i < (n);i++)	
typedef long long ll;

int gcd(int a, int b) { if (b == 0)  return a;  else  return gcd(b, a % b);  }
int lcm(int a, int b) { return a * b / gcd(a, b); }
void swap(int& a, int& b) { int temp = a; a = b; b = temp; return; }
int ncr(int n, int r) { int a = 1; Rep(i, r) a = (a * (n - i)) / (i + 1); return a; }
int npr(int n, int r) { int a = 1; Rep(i, r) a *= n - i; return a; }
int mod(int a, int b) { return a % b; }


int main() {
	/*
	int k;
	int a, b;
	std::cin >> k;
	std::cin >> a >> b;
	for (int i = a; i <= b; i++) {
		if (i % k == 0) {
			std::cout << "OK" << std::endl;
			return 0;
		}
	}
	std::cout << "NG" << std::endl;
	return 0;
	*/
	ll x;
	ll money = 100;
	std::cin >> x;
	int a = 0;
	while (1) {
		if (money >= x) {
			std::cout << a << std::endl;
			break;
		}
		else {
			a++;
			money *=  1.01;
		}
	}
	return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


int main(){
  int N, M; cin >> N >> M;
  vector<pii> A(N+M); 
  rep(i,N) {
    cin >> A[i].first;
    A[i].second = 1;
  }
  rep(i,M) cin >> A[N+i].second >> A[N+i].first;
  sort(all(A));
  reverse(all(A));
  int cnt = 0;
  ll ans = 0;
  rep(i,M+N) {
    int b = A[i].second;
    ll c = A[i].first;
    cnt += b;
    ans += c*b;
    if (cnt>N){
      ans -= c*(cnt-N);
      break;
    }    
  }
  cout << ans << endl;


  // cout << fixed << setprecision(10);
  
  return 0;
}


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

#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;

template<typename T> istream& operator>>(istream &is, vector<T> &v) { for(auto &it : v) is >> it; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep = ""; for(const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << "\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

const int N = 1e6+5;
bool np[N];
vi prime;

void init(){
    for(int i = 2; i <= sqrt(N); ++i){
        if(!np[i]){
            prime.push_back(i);
            for(int j = i+i; j < N; j+=i)
                np[j] = 1;
        }
    }
}

void solve(){
    init();

    int n;
    cin >> n;
    vi arr(n);
    cin >> arr;

    LL g = arr[0];
    for(int i = 1; i < n; ++i) g = __gcd(g, arr[i]);
    if(g != 1){
        cout << "not coprime\n";
        return;
    }

    unordered_set<LL> st;
    for(int i = 0; i < n; ++i){
        LL t = arr[i];
        for(int j = 0; j < sz(prime); ++j){
            LL px = prime[j];
            if(px > t) break;
            bool f = 0;
            while(t%px == 0){
                t /= px;
                f = 1;
            }
            if(f){
                if(st.count(px)){
                    cout << "setwise coprime\n";
                    return;
                }
                st.insert(px);
            }
        }
        if(t != 1){
            if(st.count(t)){
                cout << "setwise coprime\n";
                return;
            }
            st.insert(t);
        }
    }

    cout << "pairwise coprime\n";
}

int main()
{
    Fast;
    //louisfghbvc{
        solve();
    //}
    return 0;
}


Measured memory_bytes: 11856
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <queue>
#include <string>
#include <complex>

#define REP(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = (s); i < (n); i++)
#define ALLOF(c) c.begin(), c.end()
#define RANGEOF(c,i,n) c.begin() + (i), c.begin() + (i) + (n)
#define EPS 1e-9
#define INF 1000000000
using namespace std;

typedef complex<int> POINT;
template <class T>
class vevector : public vector<vector<T>>
{
public:
	using vector<vector<T>>::operator []; 
	T& operator [](const POINT &index) { return (*this)[index.real()][index.imag()]; }
};

template <class T> T read() { T t; cin >> t; return t; }
template <class T> vector<T> read(int n) { vector<T> v; REP(i,n) { v.push_back(read<T>()); } return v; }
template <class T> vevector<T> read(int n, int m) { vevector<T> v; REP(i,n) v.push_back(read<T>(m)); return v; }
template <class T> void write(const T &t) { cout << t << endl; }
template <class T> void write(const T &t, const T &t2) { cout << t << ' ' << t2 << endl; }

template <class T> void write(const vector<T> &v)
{
	ostringstream ss; 
	for (auto x : v) ss << x << ' ';
	auto s = ss.str();
	cout << s.substr(0, s.length() - 1) << endl;
}

struct _Reader { template <class T> _Reader operator ,(T &rhs) { cin >> rhs; return *this; } };
#define READ(t,...) t __VA_ARGS__; _Reader(), __VA_ARGS__

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

vector<unsigned char> isPrime;
vector<int> primes;
void initPrimes(int n)
{
	isPrime = vector<unsigned char>(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	FOR(i, 2, n)
	{
		if (!isPrime[i]) continue;
		primes.push_back(i);
		for (int j = i * 2; j <= n; j += i)
			isPrime[j] = false;
	}
}
/// template end ///

void solve()
{
	initPrimes(123456 * 2);
	while (true)
	{
		auto n = read<int>();
		if (!n) { break; }
		auto begin = upper_bound(ALLOF(primes), n),
			end = upper_bound(ALLOF(primes), 2 * n);
		write(distance(begin, end));
	}
}

Measured memory_bytes: 1584
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
using ll = long long;
using vll = vector<long long>;

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)

int main() {
	ll l, r,i,j,lm,min=2*pow(10,9),tmp;
	pair<ll, ll> pl, pr;
	ll mod = 2019;
	in(l);
	in(r);

	if (l == 0) {
		out(0);
		return 0;
	}

	rep(i, l, r) {
		repeq(j, i+1, r) {
			tmp = (i * j) % mod;
			if (tmp < min) {
				min = tmp;
			}
			if (min == 0) {
				out(min);
				return 0;
			}
		}
	}
	out(min);
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<queue>
using namespace std;
int main(){
  priority_queue<double> que;
  long long int ans=0,n,m,a[100010],i;
  double b;
  scanf("%lld %lld\n",&n,&m);
  for(i=0;i<n;i++){
    scanf("%lld\n",&a[i]);
    que.push(a[i]);
  }
  for(i=0;i<m;i++){
    b=que.top();
    que.pop();
    b=b/2;
    que.push(b);
  }
  for(i=0;i<n;i++){
    a[i]=que.top();
    ans=ans+a[i];
    que.pop();
  }
  printf("%lld\n",ans);
  return 0;
}
  

Measured memory_bytes: 1912
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//約数を返す
fn get_divs(n: i64) -> Vec<i64> {
  let mut i = 1;
  let mut ret : Vec<i64> = Vec::new();
  while i * i <= n {
    if n % i == 0 {
      ret.push(i);
      if i * i != n {
        ret.push(n / i);
      }
    }
    i+=1;
  }
  
  ret
}

fn main() {
  let n: i64 = read();
  
  let divs = get_divs(n);
  
  let mut mv = -1;
  let mut mvi = 1.0e+18;
  let sqrt_n = (n as f64).sqrt();
  
  for d in divs {
    if mvi > (sqrt_n - (d as f64)).abs() {
      mv = d;
      mvi = (sqrt_n - (d as f64)).abs();
    }
  }
  
  println!("{}", mv + n / mv - 2);
}

Measured memory_bytes: 4352
object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.head.split(' ').map(_.toInt)
  val N = ls(0)
  val K = ls(1)
  val ln2 = Math.log(2)
  private def func(i:Int):Int = {
    Math.max(0, Math.ceil(Math.log(K.toDouble / i) / ln2).toInt)
  }
  val sum = (1 to N).foldLeft(0.toDouble){ (a,i) =>
    val x = func(i)
    //println(x)
    a + Math.pow(0.5.toDouble, x)
  }
  println(sum / N)
}


Measured memory_bytes: 29856
#include <stdio.h>
#include <math.h>

int main(void)
{
	int p[1000];
	int n, m;
	int count;
	int i, j;

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

		for (i = 0, j = 0; i < n - 1; i++){
			count = 0;
			while (1){
				if (p[j]){
					count++;
					if (m == count){
						p[j] = 0;
						break;
					}
				}
				j++;
				if (j == n){
					j = 0;
				}
			}

			j++;
			if (j == n){
				j = 0;
			}
		}

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

	return (0);
}

Measured memory_bytes: 604
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
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() {
  ios::sync_with_stdio(false); cin.tie(nullptr); //入出力高速化
  int N,K,Q; cin >> N >> K >> Q;
  vector<int> A(N);
  rep(i,Q) {
    int a; cin >> a;
    a--;
    A[a]++;
  }

  rep(i,N) cout << (K - Q + A[i] > 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1024
// E - Coprime
#include <bits/stdc++.h>
using namespace std;
#define rpd(i,s,e,d) for(int i=(s);i<(int)(e);i+=(d))

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

	int N; cin>>N;
	vector<int> C(1e6+1, 0);
	int g = 0;
	rpd(i, 0, N, 1){ int a; cin>>a; C[a]++; g = gcd(g, a); }

	auto sum_array = [&](int start, int end, int step){
		int c = 0;
		rpd(i, start, end, step) c += C[i];
		return c;
	};

	auto not_pairwise = [&]{
		rpd(i, 2, C.size(), 1) if(sum_array(i, C.size(), i) > 1) return true;
		return false;
	};

	cout<< vector<string>{"pairwise","setwise","not"}[(g > 1) + not_pairwise()] <<" coprime\n";
}


Measured memory_bytes: 7152
/*****************************************************

@author: vichitr
Compiled On: 27th April 2019

*****************************************************/

#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define pb push_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define ip pair<int, int>

#define loop(i,n) for(int i=0;i<n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1e9+7;
const ll SZ = 107;
const ll N = 2e5+7;

int pow(int x, int y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x);
        y >>= 1;
        x = (x * x);
    }
    return r;
}

void solve()
{
    int a,b,t;cin>>a>>b>>t;
    int ans = 0;
    for(int i=a;i<=t;i+=a)
    {
        ans += b;
    }
    cout<<ans;

}

signed main()
{
    fast;

    int t=1;
    // cin >>t;
    while(t--){
        solve();
    }
    return 0;
}

/*****************************


****************************/

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 10000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;


int main(){
    ll a[11000],b[11000],suma=0,sumb=0,counta=0,countb=0;
    int N;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>a[i];
        suma+=a[i];
    }
    for(int i=0;i<N;i++){
        cin>>b[i];
        sumb+=b[i];
    }
    for(int i=0;i<N;i++){
        if(a[i]==b[i]) continue;
        else if(b[i]>a[i]){
            counta+=(b[i]-a[i]+1)/2;
            if((b[i]-a[i])%2) countb++;
        }else{
            countb+=a[i]-b[i];
        }
    }
    //cout<<counta<<endl;
    //cout<<countb<<endl;
    if(counta>=countb) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split()))
x = [0] * max(a)
for i in a:
    x[i - 1] += 1
all = 0


def nc2(n):
    return int(n * (n - 1) / 2)


for j in x:
    if j >= 2:
        all += nc2(j)

for i in range(n):
    if x[a[i]-1] >= 2:
        print(all-x[a[i]-1]+1)
    else:
        print(all)


Measured memory_bytes: 26140
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    vector<string> v(3);
    for(int i=0; i<3; i++){
        cin>>v[i];
    }
    
    int te=0;
    char st;
    
    while(1){
        
        if(v[te].empty()){
            break;
        }else{
            st=v[te][0];
            v[te].erase(v[te].begin());
            te=(int)(st-'a');
        }
    }
    
    cout<<(char)(te+'A')<<endl;
}


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

int main() {
    long long L[100];
    L[0] = 2;
    L[1] = 1;
    int N;
    cin >> N;

    for(int i = 2; i <= N; i++) {
        L[i] = L[i - 1] + L[i - 2];
    }

    if(N == 0) {
        cout << L[0] << endl;
    } else if(N == 1) {
        cout << L[1] << endl;
    } else {
        cout << L[N] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int D;
  int Sum =0;
  cin >> N;
  vector<int> weight(N);
  for (int i=0; i<N; i++){
    int w;
    cin >> w;
    weight.at(i) = w;
    Sum += w;
  }
  for (int T=0; T<N+1 ; T++){
    int S1 =0;
    int S2;
    for (int k=0; k<T ; k++){
      S1 += weight.at(k);
    }
    S2 = Sum -S1;
    if(T==0){
      if (S2>=S1){
        D=S2-S1;
      }
      if (S1>S2){
        D=S1-S2;
      }
    }
    else if (T!=0){
      if(S2>=S1){
        if(D>S2-S1){
          D=S2-S1;
        }
      }
      else if (S1>S2){
        if(D>S1-S2){
          D=S1-S2;
        }
      }
    }
  }
  cout << D << endl;
}

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

using namespace std;

int main(void)
{
    int k;
    string str;
    cin >> str;
    cin >> k;

    vector<string> vs;

    for(int i = 0; i < str.size(); i++){
        string temp = "";
        for(int j = 0; j < 5; j++){
            if(i + j >= str.size()){
                break;
            }
            temp += str[i+j];
            if(find(vs.begin(), vs.end(), temp) == vs.end()){
                vs.push_back(temp);
            }
        }
    }

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

    cout << vs[k-1] << endl;;

    return 0;
}


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

using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds; 

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define f(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define inf INT_MAX
#define llinf LONG_LONG_MAX

const int MAXN=1e6+3;
const int M=998244353;

long double calcAngle(long double h, long double m)  
{  
    
    
  
    if (h == 12) h = 0;  
    if (m == 60) m = 0;  
  
   long double pi=acos(-1);
   
    long double hour_angle = 0.5 * (h * 60 + m);  
    long double minute_angle = 6 * m;  
  
    
    long double angle = abs(hour_angle - minute_angle);  
  
    angle = min(360 - angle, angle);  
  
    return (angle*pi)/180;  
}  


void solve(){
	long double a,b,h,m;
	cin>>a>>b>>h>>m;

	long double pi=acos(-1);

	long double diff=calcAngle(h,m);

	long double dis=(a*a)+(b*b)-(2*a*b*cos(diff));
	//cout<<dis<<endl;
	dis=sqrt(dis);

	cout<<setprecision(9)<<fixed<<dis;
}	

int main(){	

			solve();

	return 0;	
}

Measured memory_bytes: 4124
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
int dp[41][401][401];
main(){
    int N,Ma,Mb;
    cin >> N >> Ma >> Mb;
    rep(i,0,401)rep(j,0,401)rep(k,0,41)dp[k][i][j] = INF;
    dp[0][0][0] = 0;
    rep(i,0,N){
        int a,b,c;
        cin >> a >> b >> c;
        rep(j,0,400)rep(k,0,400)dp[i+1][j][k] = dp[i][j][k];
        rep(j,0,400)rep(k,0,400){
            if(j + a > 400 || k + b > 400)continue;
            dp[i+1][j + a][k + b] = min(dp[i+1][j + a][k + b], dp[i][j][k] + c);
        }
    }
    int mini = INF;
    rep(i,1,41)if(i * Ma <= 400 && i * Mb <= 400)mini = min(mini, dp[N][i * Ma][i * Mb]);
    
    if(mini == INF)cout << -1 << endl;
    else cout << mini << endl;
}

Measured memory_bytes: 25984
// This code writed by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
using namespace std;
const double pi=acos(-1);
template <class t> inline void rd(t &s)
{
	s=0;
	reg char c=getchar();
	while(!isdigit(c))
		c=getchar();
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	return;
}
signed main(void)
{
	double a,b,x;
	cin>>a>>b>>x;
	// a=x/a/a;
	if(x<=a*a*b/2.0)
	{
		x/=a;
		a=x*2.0/b;
		// printf("%.9lf %.9lf %.9lf\n",a,b,x);
		printf("%.9lf\n",atan(b/a)/2.0/pi*360.0);
	}
	else
	{
		x=a*a*b-x;
		x/=a;
		b=x*2.0/a;
		// printf("%.9lf %.9lf %.9lf\n",a,b,x);
		printf("%.9lf\n",atan(b/a)/2.0/pi*360.0);
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include<map>
#include<queue>

//最大で2*10^5を5回やるとかいうあたまわるい発想

using namespace std;

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

	vector<string> s(n);
	map<string, int> m;
	
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		if (!m.count(s[i]))
			m[s[i]] = 1;
		else
			m[s[i]] ++;
	}

	int maxcount = 1;

	for (map<string,int>::iterator i = m.begin(); i != m.end(); i++) {
		maxcount = max(maxcount, i->second);
	}

	priority_queue<string,vector<string>,greater<string>> que;

	for (map<string, int>::iterator i = m.begin(); i != m.end(); i++) {
		if (maxcount == i->second) {
			que.push(i->first);
		}
	}

	cout << endl;

	while (!que.empty()) {
		std::cout << que.top() << std::endl;
		que.pop();
	}

	//cout << maxcount;

	return 0;
}

Measured memory_bytes: 28404
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 10000000
#define int long long
#define double long double
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, a[200010], ans[200010];
signed main() {
	cin >> n;
	REP(i, n)cin >> a[i];
	for (int i = n; i >= 1; i--) {
		int cnt = 0;
		for (int j = 2 * i; j <= n; j += i)cnt += ans[j];
		if (cnt % 2 != a[i] % 2)ans[i]++;
	}
	vector<int> vec;
	REP(i, n) {
		if (ans[i])vec.push_back(i);
	}
	cout << vec.size() << endl;
	if(!vec.empty())cout << vec[0];
	REP(i, (int)vec.size() - 1)cout << " " << vec[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 4852
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    long long a, b, c, k;
	cin >> a >> b >> c >> k;
	if (k % 2) cout << b - a;
	else cout << a - b;
}



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

int main()
{
    ll a,b ,c,k;
    cin>>a>>b>>c>>k;
    ll ans =0;
    if( k%2==0)
        ans = a-b;
    else ans = b-a;

    if( ans >1e18)
        cout<<"Unfair";
    else cout<<ans;
}

Measured memory_bytes: 3572
#include <stdio.h>
#include <math.h>

int main(void)
{
	double x1, y1, x2, y2;
	
	scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
	
	printf("%f\n", sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
	
	return (0);
	
}

Measured memory_bytes: 652
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    string s, t;
    while (cin >> s >> t){
        int ans = 0;
        for (int i = -(int)s.length(); i <= (int)t.length(); ++i) {
            int l = 0;
            for (int j = max(i, 0); j < min(s.length()+i, t.length()); ++j) {
                if(s[j-i] == t[j]){
                    l++;
                    ans = max(ans, l);
                } else l = 0;
            }

        }
        cout << ans << "\n";
    }
    return 0;
}



Measured memory_bytes: 3212
# coding: utf-8
# Your code here!


string = list(input())
line=[]

for i in range(len(string)):
    if string[i]!="0":
        line.append(string[i])
        

num = int(''.join(line))
Sum = 0

if num==1:
    print("10")
else:
    for i in range(len(line)):
        Sum += int(line[i])
    print(Sum)

Measured memory_bytes: 3064
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
struct node
{
	int a,b;
}s[200010];
bool cmp(node x,node y)
{
	if(x.a==1 && y.a==1)return x.b<y.b;
	else return 1LL*(x.a-1)*y.b<1LL*(y.a-1)*x.b;
}
long long f[35];
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n=read(),m=read()+1;
    for(int i=1;i<=n;i++)s[i].a=read()+1,s[i].b=read()+1;
    sort(s+1,s+n+1,cmp);
    memset(f,-1,sizeof(f));f[0]=1;
    for(int i=n;i>=1;i--)
    {
    	if(s[i].a==1)break;
    	for(int j=29;j>=0;j--)
    	{
    		if(f[j]==-1)continue;
    		long long uf=1LL*f[j]*s[i].a+s[i].b;
    		if(uf>m)continue;
    		if(f[j+1]==-1)f[j+1]=uf;
    		else f[j+1]=min(f[j+1],uf);
    	}
	}
	int now=1,sum=s[1].b,ans=0;
    for(int i=29;i>=0;i--)
    {
    	if(f[i]==-1)continue;
    	while(f[i]+sum<=m && now<=n && s[now].a==1)now++,sum+=s[now].b;
    	ans=max(ans,i+now-1);
    }pr2(ans);
    return 0;
}

Measured memory_bytes: 1664
fun main(args : Array<String>) {
    val S = readLine()!!

    val condition1 = S.first() == 'A'
    val condition2 = S.subSequence(2, S.length - 1).filter { it == 'C' }.length == 1
    val condition3 = S.filter { it != 'A' && it != 'C' }.filter { it.isUpperCase() }.length == 0

    if (condition1 && condition2 && condition3) {
        println("AC")
    } else {
        println("WA")
    }
}

Measured memory_bytes: 31816
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

N = int(input())
Xs = list(map(int, input().split()))

Ys = Xs[:]
Ys.sort()

a = Ys[N//2 - 1]
b = Ys[N//2]

for x in Xs:
    if x <= a:
        print(b)
    else:
        print(a)


Measured memory_bytes: 29168
#include <stdio.h>
int main(void){
    // Your code here!
    int N;
    int p[51],sum;
    
    scanf("%d\n",&N);

    int i;
    sum = 0;
    for(i=1;N>=i;i++){
        scanf("%d",&p[i]);
        if(p[i]!=i) sum++;
    }
    
    if(sum<=2)  printf("YES\n");
    else        printf("NO\n");
    
    return 0;
    
    
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] c = new int[n];
        int[] s = new int[n];
        int[] f = new int[n];
        for (int i = 1; i < n; i++) {
            c[i] = sc.nextInt();
            s[i] = sc.nextInt();
            f[i] = sc.nextInt();
        }
        long[] a = new long[n+1];
        for (int i = 1; i < n; i++) {
            long[] b = new long[n+1];
            for (int j = i+1; j <= n; j++) {
                if(b[j-1] <= s[j-1]) b[j] = s[j-1] + c[j-1];
                else if(b[j-1]%f[j-1] == 0) b[j] = b[j-1] + c[j-1];
                else b[j] = b[j-1] + (f[j-1] - (b[j-1]%f[j-1])) + c[j-1];
            }
            a[i] = b[n];
        }

        for (int i = 1; i <= n; i++) System.out.println(a[i]);
        sc.close();
    }

}


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

lli max(lli a,lli b)
{
   if(a>b)
   {
       return a;
   }
   return b;
}

lli power(lli x,lli n,lli mod)
{
    lli res=1;
    while(n>0)
    {
        if(n%2==1)
        {
            res=(res*x)%mod;
        }
        x=(x*x)%mod;
        n=n/2;
    }

    return  res%mod;

}




int main()
{

        lli s,w;
        cin>>s>>w;
        if(w>=s)
        {
            cout<<"unsafe"<<"\n";
        }
        else{
            cout<<"safe"<<"\n";
        }


    return 0;
}


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

public class UnionFind
{
    private int[] data;

    public UnionFind(int size)
    {
        data = new int[size];
        for (int i = 0; i < size; i++) data[i] = -1;
    }

    public UnionFind(UnionFind u)
    {
        var len = u.data.Length;
        data = new int[len];
        Buffer.BlockCopy(u.data, 0, data, 0, sizeof(int) * len);
    }

    public bool Unite(int x, int y)
    {
        x = Root(x);
        y = Root(y);

        if (x != y)
        {
            if (data[y] < data[x])
            {
                var tmp = y;
                y = x;
                x = tmp;
            }
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }

    public bool IsSameGroup(int x, int y)
    {
        return Root(x) == Root(y);
    }

    public int Root(int x)
    {
        return data[x] < 0 ? x : data[x] = Root(data[x]);
    }
}

public static class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var N = vals[0];
        var M = vals[1];

        var uf = new UnionFind(N + 1);
        for (int i = 0; i < M; i++)
        {
            vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var a = vals[0];
            var b = vals[1];
            uf.Unite(a, b);
        }

        var count = Enumerable.Range(1, N).Select(v => uf.Root(v)).Distinct().Count() - 1;
        Console.WriteLine(count);
    }
}

Measured memory_bytes: 42184
N = gets.chomp.to_i
s = []
N.times do
  s.push(gets.chomp.to_i)
end
sum = s.inject(:+)
if sum % 10 != 0
  p sum
  exit
end

s.sort!
m = 0
s.each do |ss|
  if ss % 10 != 0
    m = ss
    break
  end
end
if m == 0
  p 0
else
  p sum - m
end


Measured memory_bytes: 1788
#include<stdio.h>
int main(){
int h,w,i,j;
char s[102][101];
  scanf("%d%d",&h,&w);
  for(i=0;i<w;i++){
  s[0][i]='#';
  s[h+1][i]='#';
  }
  for(i=1;i<=h;i++){
    scanf("%s",s[i]);
  }
  for(i=0;i<=h+1;i++){
  printf("#");
    for(j=0;j<w;j++){
    printf("%c",s[i][j]);
    }
  printf("#\n");
  }
  return 0;
}

Measured memory_bytes: 128
N,H = map(int,input().split())
a=[]
b=[]
for i in range(N):
	ai,bi = map(int,input().split())
	a.append(ai)
	b.append(bi)

a.sort(reverse=True)  #[4,3,2,1]
b.sort(reverse=True)  #[3,4,5,6]

lenb=len(b)

for i in range(lenb):
	if a[0] > b[-1]:
		del b[-1]
	else:
		break
cut = 0

for x in b:
	H -= x
	cut +=1
	if(H<=0):
		print(cut)
		quit()

ans = int(H%a[0])
#print('{}%{}={}'.format(H,a[0],ans))

if ans == 0: ans = H/a[0]+cut
else: ans =(H/a[0])+1+cut

print(int(ans))

Measured memory_bytes: 11296
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>
#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>
#include <math.h>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<llint, llint>Pii;
typedef pair<double, double>Pdd;

#define pi 3.141592653589793)
#define mod 1000000007


int main() {
	llint a, b, k;
	cin >> a >> b >> k;
	if (k > (b - a) / 2) {
		for (int i = a; i <= b; i++) {
			cout << i << endl;
		}
		return 0;
	}
	for (llint i = 0; i < k; i++) {
		cout << a + i << endl;
	}
	for (llint i = k-1; i >= 0; i--) {
		cout << b - i << endl;
	}
	return 0;
}


Measured memory_bytes: 256
s = list(input())

for a in range(len(s)) :
    if(s[a]=='R' or s[a]=='U' or s[a]=='D') and (a%2==0) :
        a = 1
    elif(s[a]=='L' or s[a]=='U' or s[a]=='D') and (a%2==1) :
        a = 1
    else :
        print('No')
        break

else :
    print('Yes')


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

int main(){
  int N,L,ans=0;
  cin >> N >> L;
  if(L>0){
    for(int i=2;i<N+1;i++){
      ans+=L+i-1;
    }
  }
  else if(L+N-1>0){
    for(int k=1;k<N+1;k++){
      ans+=L+k-1;
    }
  }
  else{
    for(int j=1;j<N;j++){
      ans+=L+j-1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    w = [0] * n
    v = [0] * n
    for i in range(n):
        w[i], v[i] = list(map(int, input().split()))
    l = [0] * (m + 1)
    for i in range(n):
        for j in range(m, w[i] - 1, -1):
            x = v[i] + l[j-w[i]]
            if x > l[j]:
                l[j] = x
    print(l[-1])
main()


Measured memory_bytes: 9716
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;//not necessarily

#define MAX_N 100000

ll a[MAX_N];

int main(){
	int n;
	scanf("%d",&n);
	int o=0;
	ll ans=0;
	for(int i=0;i<n;++i){
		cin>>a[i];
		ans+=a[i];
		if(a[i]%2==1) ++o;
		if(a[i]==0||i==n-1){
			ans-=(o%2);
			o=0;
		}
	}
	printf("%lld\n",ans/2);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define MAXN
using namespace std;
map <string,int> m;
int main() {
	int n; scanf("%d",&n);
	for(int i = 1;i <= n;i ++) {
		string s; cin >> s;
		m[s] ++;
	}
	printf("AC x %d\n",m["AC"]);
	printf("WA x %d\n",m["WA"]);
	printf("TLE x %d\n",m["TLE"]);
	printf("RE x %d\n",m["RE"]);
	return 0;
}


Measured memory_bytes: 3792
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
  ll nums[4];
  for(int i=0; i<4; ++i) cin>>nums[i];
  ll ans=LONG_MIN;
  for(int i=0; i<=1; ++i){
    for(int j=2; j<=3; ++j) ans=max(ans,nums[i]*nums[j]);
  }
  cout << ans << endl;
}


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

int main() {
	int H, W;
	cin >> H >> W;
	int ans, dist1, dist2;
	ans = min(W % 3 ? H : 0, H % 3 ? W : 0); // 同じ方向に3等分する
	
	// 縦→横に切る
	dist1 = (H - H % 3) / 3; // 縦幅がやや小さいとき
	dist2 = (W - W % 2) / 2; // 次に切った横幅のうち小さい側
	ans = min(max(max(abs(dist1 * W - dist2 * (H - dist1)), abs(dist1 * W - (dist2 + W % 2) * (H - dist1))),(H - dist1) * (W % 2)), ans);
	++ dist1; // 縦幅がやや大きいとき
	ans = min(max(max(abs(dist1 * W - dist2 * (H - dist1)), abs(dist1 * W - (dist2 + W % 2) * (H - dist1))),(H - dist1) * (W % 2)), ans);
	// 横→縦に切る
	dist1 = (W - W % 3) / 3; // 横幅がやや小さいとき
	dist2 = (H - H % 2) / 2; // 次に切った縦幅のうち小さい側
	ans = min(max(max(abs(dist1 * H - dist2 * (W - dist1)), abs(dist1 * H - (dist2 + W % 2) * (W - dist1))), (W - dist1) * (H % 2)), ans);
	++ dist1; // 横幅がやや大きいとき
	ans = min(max(max(abs(dist1 * H - dist2 * (W - dist1)), abs(dist1 * H - (dist2 + W % 2) * (W - dist1))), (W - dist1) * (H % 2)), ans);
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

切り方は、同じ方向に3等分するのと縦横と切るのと横縦と切るのの全3通りある
それぞれについては簡単に計算できるよー
*/

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
	int n;
	int a1, a2, a3, a4;
	scanf("%d", &n);
	a1 = n / 1000;
	a2 = (n - a1 * 1000) / 100;
	a3 = (n - a2 * 100 - a1 * 1000) / 10;
	a4 = n - a3 * 10 - a2 * 100 - a1 * 1000;
	if((a1 == a2&&a2 == a3)  || (a2 == a3&&a3 == a4))
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k, pp, ans int
	var p []int
	fmt.Scan(&n, &k)
	for i := 0; i < n; i++ {
		fmt.Scan(&pp)
		p = append(p, pp)
	}
	sort.Slice(p, func(i, j int) bool {
		return p[i] < p[j]
	})
	for i := 0; i < k; i++ {
		ans += p[i]
	}
	fmt.Println(ans)

}


Measured memory_bytes: 1916
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int t[101];
int pri[26];
int res = 0;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[y] = px;
	}
	else {
		pr[x] = py;
	}
	return true;
}
struct edge {
	int to;
	bool use = false;
	edge(int _to) : to(_to) {}
};

void solv() {

	ll n, m;
	cin >> n >> m;
	pair<ll, ll> p[100010];
	for (size_t i = 0; i < n; i++)
	{
		cin >> p[i].first >> p[i].second;
	}
	sort(p, p + n);
	ll res = 0;
	for (size_t i = 0; i < n; i++)
	{
		if (p[i].second > m) {
			res += p[i].first * m;
		}
		else {
			res += p[i].first * p[i].second;
		}
		m = max(0LL, m - p[i].second);
	}
	cout << res << endl;
}


int main() {
	solv();

	return 0;
}


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

int main() {
	int n[5],tmp;
	scanf("%d %d %d %d %d",&n[0],&n[1],&n[2],&n[3],&n[4]);
	for (int i=0; i<4; i++)
	{
		for (int j=0; j<4-i; j++)
		{
			if (n[j]<n[j+1])
			{
				tmp = n[j];
				n[j] = n[j+1];
				n[j+1] = tmp;
			}
		}
	}
	cout << n[0] << " " << n[1] << " " << n[2] << " " << n[3] << " " << n[4] << endl;
	return 0;
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<int, int> p;

int x, y, z;
vector<ll> all;
vector<ll> all_tmp;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> x >> y >> z;
  ll k;
  cin >> k;
  vector<ll> a(x);
  vector<ll> b(y);
  vector<ll> c(z);
  for (int i = 0; i < x; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < y; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < z; i++) {
    cin >> c[i];
  }

  sort(RALL(a));
  sort(RALL(b));
  sort(RALL(c));

  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++) {
      all.push_back(a[i] + b[j]);
    }
  }
  sort(RALL(all));

  all_tmp = vector<ll> (k);
  for (int i = 0; i < k; i++) {
    if(i >= int(all.size())) break;
    all_tmp[i] = all[i];
  }
  sort(RALL(all_tmp));
  all = vector<ll>();

  for (int i = 0; i < k; i++) {
    for (int j = 0; j < z; j++) {
      all.push_back(all_tmp[i] + c[j]);
    }
  }
  sort(RALL(all));

  for (int i = 0; i < k; i++) {
    cout << all[i] << endl;
  }




}


Measured memory_bytes: 35124
#include<iostream>	// 入出力
#include<stdio.h>	// printf()が使える小数は%fで
#include<math.h>	// 数学の関数
#include<vector>	// 配列
#include<string>	// 文字列
#include<map>		// 連想配列
#include<stack>		// スタック
#include<queue>		// キュー
#include<algorithm> // ソートとか

using namespace std;



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

	vector<long long int> a(N);

	long long int sub = 0;

	for (int i = 0; i < N; ++i)
	{
		cin >> a[i];
		sub += a[i];
	}

	long long int ans = abs(sub);

	for (int i = 0; i < N-1; ++i)
	{
		sub -= 2 * a[i];


		if (ans > abs(sub)||i==0) { ans = abs(sub); }
	}

	cout << ans << endl;

	return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

ll dp[5005][5005]; // iとjから始めた時、一致する最長の長さ

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  
  ll ans=0;
  ll pow=1;
  rep(i,60){
    ll one=0, zero=0;
    rep(j,n){
      if((a[j]>>i)&1){
        one++;
      }else{
        zero++;
      }
    }
    
    ans+=(one*zero)%MOD*pow%MOD;
    ans%=MOD;
    pow*=2;
    pow%=MOD;
  }
  cout<<ans<<endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int MAX = 1000010;

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

    b += 0.0005;
    b *= 100;

    cout << (ll(a) * ll(b)) / 100 << endl;

    return 0;
}


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

int main() {
    char s[4];
    cin >> s;

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

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
	
  int ans = 0;
  string a,b;
  cin >> a >> b;

  for(int i=0; i<3; i++){
    if(a[i] == b[i]){
      ans ++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

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

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<int>> AB(N + 1);
	deque<int> deq;
	VB node(N + 1,true);
	
	REP(i,M) {
		int AA, BB;
		cin >> AA >> BB;
		AB[AA].push_back(BB);
		AB[BB].push_back(AA);
	}

	int start = 0,end = 1;
	node[end] = false;
	deq.push_back(end);
	
	while(start != end){
		start = end;
		REP(i, AB[start].size()) {
			if (node[AB[start][i]]) {
				node[AB[start][i]] = false;
				end = AB[start][i];
				deq.push_back(end);
				break;
			}
		}
	}

	start = 0, end = 1;
	while (start != end) {
		start = end;
		REP(i, AB[start].size()) {
			if (node[AB[start][i]]) {
				node[AB[start][i]] = false;
				end = AB[start][i];
				deq.push_front(end);
				break;
			}
		}
	}

	cout << deq.size() << endl;
	REP(i, deq.size()) {
		cout << deq[i] << " ";
	}
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 6656
module aoj;
import std.array;
import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main() {
  int n;
  while ((n = to!int(chomp(readln()))) != 0) {
    int[] I = new int[n];
    int[] U = new int[n];
    int[] A = new int[n];
    int[] P = new int[n];

    foreach (i; 0 .. n) {
      string[] line = split(readln());
      I[i] = to!int(line[0]);
      U[i] = to!int(line[1]);
      A[i] = -to!int(line[2]);
      P[i] = to!int(line[3]);
    }

    sort(zip(A, P, I, U));

    int[] ans;
    int[] count = new int[1001];

    foreach (i; 0 .. n) {
      foreach (j; 0 .. 3) {
        if (ans.length < [10, 20, 26][j]) {
          if (count[U[i]] < 3 - j) {
            ans ~= I[i];
            count[U[i]] += 1;
            break;
          }
        }
      }
    }

    foreach (id; ans) { writeln(id); }
  }
}

Measured memory_bytes: 1080
#include <bits/stdc++.h>
#define MAXN 100001
#define INF INT_MAX
using namespace std;

int n, k;
int h[MAXN];
int dp[MAXN];

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin >> n >> k;
    
    for(int i = 0; i < n; i++){
    	cin >> h[i];
    	dp[i] = INF;
    }
    
    dp[n-1] = 0;

	for(int i = n-2; i >= 0; i--){
		for(int j = 1; j <= k; j++){
			if(i + j >= n) break;
			dp[i] = min(dp[i], dp[i+j] + abs(h[i] - h[i+j]));
		}
	}
    
    cout << dp[0] << "\n";
    
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stack>
#include <cstring>
#include <queue>
#include <set>
#include <map>

using namespace std;

const int maxN = 1e5 + 10, oo = 23041997, modP = 1e7, maxC = 50;

#define FORU(i, l, r) for (int i = l; i <= r; ++i)
#define FORD(i, r, l) for (int i = r; i >= l; --i)
#define REPU(i, r) for (int i = 0; i < r; ++i)
#define F first
#define S second
#define PB push_back
#define LL long long
#define BIT(x, i) ((x >> i) & 1)
#define PINT pair < int, int >

int a[maxN], n, res;

int dist(int i, int j) {
    return (int) abs(a[i] - a[j]);
}

int main() {
    cin >> n;
    FORU(i, 1, n) cin >> a[i];
    a[0] = a[n + 1] = 0;
    FORU(i, 0, n)
        res += dist(i, i + 1);
    FORU(i, 1, n)
        cout << res - dist(i, i - 1) - dist(i, i + 1) + dist(i - 1, i + 1) << endl;
}


Measured memory_bytes: 1664
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N; cin >> N;
    string S; cin >> S;

    int x = 0;
    for(auto c:S){
        if(c == 'I') x++;
        else x--;

        res = max(res,(ll)x);
    }
    return res;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    //solve<ll>(0);
    cout << fixed << setprecision(12) << solve<ll>() << endl;
    return 0;
}

Measured memory_bytes: 3596