akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <tuple>

#define rep(i,n) for(ll i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

using Graph = vector<vector<ll>>;
//	std::cout<<std::fixed<<std::setprecision(10);

struct tpl {
  ll place;
  char kind;
  int id;

  // cf. https://qiita.com/a4rcvv/items/7cd217cc5fafef700dff
  bool operator<(const tpl &another) const
  {
    return place < another.place;//年齢を比較
  };
};

int main() {
  int A, B, Q;
  cin >> A >> B >> Q;
  vector<ll> s(A), t(B); // s_i とそれに最も近いt_iまでの距離
  vector<ll> X(Q);

  // arr に全てのs, t, x の位置を格納して、sortして探索する。
  vector<tpl> arr; // place, stx, id

  rep(i, A) {
    tpl tmp;
    cin >> s[i];
    tmp.place = s[i];
    tmp.kind = 's';
    tmp.id = i;
    arr.push_back(tmp);
  }
  rep(i, B) {
    tpl tmp;
    cin >> t[i];
    tmp.place = t[i];
    tmp.kind = 't';
    tmp.id = i;
    arr.push_back(tmp);
  }
  rep(i, Q) {
    tpl tmp;
    cin >> X[i];
    tmp.place = X[i];
    tmp.kind = 'x';
    tmp.id = i;
    arr.push_back(tmp);
  }

  ll s1, sA, t1, tB;
  s1 = arr[0].place;
  sA = arr[A-1].place;
  t1 = arr[A].place;
  tB = arr[A+B-1].place;

  sort(arr.begin(), arr.end());
  
  ll x[Q][4]; // s0 < x < s1, t2 < x < t3

  int ns = 0;
  int nt = 0;
  rep(i, A+B+Q) {
    if(arr[i].kind=='x') {
      x[arr[i].id][0] = s[ns];
      x[arr[i].id][2] = t[nt];

      x[arr[i].id][1] = s[min(ns+1, A-1)];
      x[arr[i].id][3] = t[min(nt+1, B-1)];
    } else if(arr[i].kind=='s') {
      // s
      ns = arr[i].id;
    } else if(arr[i].kind=='t') {
      nt = arr[i].id;
    }
  }


  rep(i, Q) {
    ll ret0 = abs(X[i]-x[i][0]) + abs(x[i][0]-x[i][2]);
    ret0 = min(ret0, abs(X[i]-x[i][1]) + abs(x[i][1]-x[i][2]) );
    ret0 = min(ret0, abs(X[i]-x[i][0]) + abs(x[i][0]-x[i][3]) );
    ret0 = min(ret0, abs(X[i]-x[i][1]) + abs(x[i][1]-x[i][3]) );

    ret0 = min(ret0, abs(X[i]-x[i][2]) + abs(x[i][2]-x[i][0]) );
    ret0 = min(ret0, abs(X[i]-x[i][3]) + abs(x[i][3]-x[i][0]) );
    ret0 = min(ret0, abs(X[i]-x[i][2]) + abs(x[i][2]-x[i][1]) );
    ret0 = min(ret0, abs(X[i]-x[i][3]) + abs(x[i][3]-x[i][1]) );

    cout << ret0 << endl;
  }

  return 0;
}

Measured memory_bytes: 13416
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, t0, x0, y0, t1, x1, y1 int
	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		fmt.Scan(&t1, &x1, &y1)
		if d, t := int(math.Abs(float64(x1-x0)) + math.Abs(float64(y1-y0))), t1-t0;
		d > t || d%2 != t%2 {
			fmt.Println("No")
			return
		}
		t0 = t1; x0 = x1; y0 = y1
	}

	fmt.Println("Yes")
}

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

using namespace std ;

const int MAXN = 1e6 + 100 ; 

int a[MAXN] ; 
int32_t main() {	
	ios_base::sync_with_stdio(0) ; 
	cin . tie(0) ; cout . tie(0) ; 

	long long x , y ; cin >> x >> y ;
	if(abs(x - y) < 2)cout << "Brown" ; 
	else cout << "Alice" ; 

}

Measured memory_bytes: 256
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include <map>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include"time.h"
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define dump(x)  cerr << #x << " = " << (x) << endl

//毎回変える場所
#define N_MAX 200


//問題文のとおり
int A,B,C,D,E,F;
int ans[2] = { 0,0 };
double percent=-10;

double calc1(int water, int sugar) {
	return (double)100 * sugar / (double)(water + sugar);
}
double calc2(int water, int sugar) {
	return (double)sugar*100 / (double)water;
}


int main() {
	cin >> A >> B >> C >> D >> E >> F;
	int a = 0, b = 0, c = 0, d = 0;//各操作回数
	while (100 * A * a <= F) {
		b = 0;
		while (100*A*a+100 * B*b <= F) {
			c = 0;
			if (a == 0 && b == 0) { b++; continue; }
			while (100 * A*a + 100 * B*b + C*c <= F) {
				d = 0;
				while (100 * A*a + 100 * B*b + C*c + D*d <= F) {
					if (calc2(100 * (A*a + B*b), C*c + D*d) <= E) {
						double tmp = calc1(100 * (A*a + B*b), C*c + D*d);
						if (tmp > percent) {
							percent = tmp;
							ans[0] = 100 * (A*a + B*b);
							ans[1] = C*c + D*d;
						}
					}
					d++;
				}
				c++;
			}
			b++;
		}
		a++;
	}
	cout << ans[0]+ans[1] << " " << ans[1] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007;



int main() {
    int N,M;
    cin>>N>>M;
    vector<vector<int>> to(N,vector<int>(0));
    rep(i,M){
        int a,b;
        cin>>a>>b;
        --a;--b;
        to[a].pb(b);
        to[b].pb(a);
    }
    vector<int> checked(N,-1);
    checked.at(0)=0;
    vector<int> ans(N);
    ans.at(0)=0;
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int v=q.front();q.pop();
        
        for(int u:to[v]){
            if(checked[u]!=-1){continue;}
            checked[u]=checked[v]+1;
            ans[u]=v;
            q.push(u);
        }
    }
    rep(i,N){
        if(ans.at(i)==1e9){cout<<"No"<<endl;return 0;}
    }
    cout<<"Yes"<<endl;
    for(int i=1;i<N;i++){
        cout<<ans.at(i)+1<<endl;
    }
}

Measured memory_bytes: 10604
#include<stdio.h>

int search(int A[],int n,int key){
  int i = 0;
  A[n] = key;
  while(A[i] != key)i++;
  return i != n;
}

int main(){
  int i,n,A[10000+1],q,key,sum = 0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(search(A,n,key))sum++;
  }
  printf("%d\n",sum);
  return 0;
}



Measured memory_bytes: 2108
x, y = map(int, input().split())
def shokin(z):
  if z == 1:
    return 300000
  elif z == 2:
    return 200000
  elif z == 3:
    return 100000
  else:
    return 0
v = 0
if x == 1 and y == 1:
  v = 400000
  
print(shokin(x)+shokin(y)+v)

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

const long long mod =1e9+7 ;
const int N = 4e2+5;


#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define fr(i,l,m) for(int i=l;i<m;i++)
# define vi vector<int>
#define vii vector<ll>
#define vpr vector<pair<int,int> >
#define dbg(x) cout << #x << " is " << x << endl;
#define spk(x) cout<<x<<endl;
#define inf INT_MAX
/*
stoi - sting to int;
stol - string to long;
stoll - string to ll;
*/

////
////
////
int n;
ll a[N],dp[N][N],b[N];

ll solve(int l,int r)
{
  if(l>r)return 1e18;
  if(l==r)return 0;
  if((l+1)==r)return (b[r]-b[l-1]);
  if(dp[l][r]!=-1)return dp[l][r];
  ll ans=1e18;
  ll sum=(b[r]-b[l-1]);
  fr(i,l,r)
  {
      ll cur=solve(l,i)+solve(i+1,r)+sum;
      ans=min(ans,cur);
  }
  dp[l][r]=ans;
  return ans;
}
////
///
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);

cin>>n;
fr(i,1,n+1)
{
    cin>>a[i];
    b[i]=(b[i-1]+a[i]);

}
memset(dp,-1,sizeof(dp));

cout<<solve(1,n)<<endl;


    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main(){
	char c;
	cin>>c;
	if(c=='A')cout<<"T\n";
	else if(c=='T')cout<<"A\n";
	else if(c=='C')cout<<"G\n";
	else cout<<"C\n";
	return 0;
}

Measured memory_bytes: 256
#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>
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 ALL(x) (x).begin(),(x).end()
#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 main() {
  string L; cin >> L;
  int l_dig = L.size();
  ll dp[l_dig+5][2] = {};
  // dp[0][0] = 0;
  dp[0][1] = 1;

  rep(i, l_dig){
    dp[i+1][0] += dp[i][0]*3%MOD;
    if(L[i]=='0'){
      dp[i+1][1] += dp[i][1]%MOD;
    }else{
      dp[i+1][0] += dp[i][1]%MOD;
      dp[i+1][1] += dp[i][1]*2%MOD;
    }
  }

  // rep(i,l_dig){
  //   cout << dp[i][0] << ' ';
  // }
  // cout << endl;
  // rep(i,l_dig){
  //   cout << dp[i][1] << ' ';
  // }
  // cout << endl;
  cout << (dp[l_dig][0]+dp[l_dig][1])%MOD << endl;
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  ll n;
  cin>>n;
  vector<ll> a(n+1);
  vector<ll> b(n);
  ll sum=0;
  rep(i,n+1){
    cin>>a[i];
  }
  rep(i,n){
    cin>>b[i];
  }
  rep(i,n){
    if(a[i]>=b[i]){
      sum+=b[i];
    }else{
      if(a[i+1]>=b[i]-a[i]){
      sum+=b[i];
      a[i+1]=a[i+1]-(b[i]-a[i]);
      }
      else{
        sum+=a[i]+a[i+1];
        a[i+1]=0;
      }
    }
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iterator>

using namespace std;

int S[2000][2000];
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

ll count_sort(int s, int e, vl &S, vl &temp) {
	if (e - s <= 1) {
		return 0;
	}
	int mean = (e + s) / 2;
	ll ans = 0;
	ans += count_sort(s, mean, S, temp);
	ans += count_sort(mean, e, S, temp);
	for (int i = s; i < e; i++) {
		temp[i] = S[i];
	}
	int i1 = s;
	int i2 = mean;
	int is = s;
	while (is<e) {
		if (i1 != mean && (i2 == e || temp[i1] <= temp[i2])) {
			S[is] = temp[i1];
			is++;
			i1++;
		}
		else {
			S[is] = temp[i2];
			ans += mean - i1;
			is++;
			i2++;
		}
	}
	return ans;
}


int main() {
	ll n;
	ll k;
	cin >> n >> k;
	vl A(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	vl S(n+1);
	S[0] = 0;
	for (int i = 1; i <= n; i++) {
		S[i] = S[i - 1] + A[i - 1];
	}
	for (int i = 0; i <= n; i++) {
		S[i] -= i*k;
	}
	vl temp(n + 1);
	cout << (n + 1)*n / 2 - count_sort(0, n + 1, S, temp) << endl;
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> p;

int field[22][22];
bool visited[22][22];
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int sx, sy;

int main(){
  int w, h;
  char c;
  while(cin >> w >> h, w|h){
    memset(field, 0, sizeof(field));
    memset(visited, false, sizeof(visited));
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
        cin >> c;
        if(c == '.') field[i][j] = 1;
        if(c == '@') sx = i, sy = j;
      }
    }
    queue<p> que;
    int sum = 1;
    visited[sx][sy] = true;
    que.push(p(sx, sy));
    while(!que.empty()){
      p cur = que.front(); que.pop();
      for(int i = 0; i < 4; i++){
        int nx = cur.first + dx[i];
        int ny = cur.second + dy[i];
        if(nx < 0 || nx > 20) continue;
        if(ny < 0 || ny > 20) continue;
        if(visited[nx][ny]) continue;
        if(field[nx][ny] == 0) continue;
        visited[nx][ny] = true;
        sum++;
        que.push(p(nx, ny));
      }
    }
    cout << sum << endl;
  }
  return 0;
}


Measured memory_bytes: 3132
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n  =sc.nextInt(), x = sc.nextInt();
		int a[] = new int[n];
		
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt();
		}
		
		long ans = 0;
		for(int i=0;i<n-1;i++){
			int sum = a[i] + a[i+1];
			if(sum > x){
				ans += sum-x;
				if(a[i+1] >= sum-x){
					a[i+1] -= sum-x;
				}
				else{
					a[i+1] = 0;
				}
			}
		}
		
		System.out.println(ans);
	}

}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, double> pid;
typedef pair<double, int> pdi;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int R[300010], L[300010];

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

	int N;
	string S;
	cin >> N >> S;
	rep(i, 0, N)
	{
		if (S[i] == 'W')
		{
			R[i]++;
		}
		if (i > 0)R[i] += R[i - 1];
	}
	rrep(i, 0, N)
	{
		if (S[i] == 'E')
		{
			L[i]++;
		}
		if (i < N - 1)L[i] += L[i + 1];
	}

	int ans = INF;
	rep(i, 1, N - 1)
	{
		chmin(ans, R[i - 1] + L[i + 1]);
	}
	chmin(ans, R[N - 2]);
	chmin(ans, L[1]);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5396
#include<bits/stdc++.h>
using namespace std;
#define maxn 100
int a[maxn];
int main(){
	int n;scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	sort(a,a+n);
	double ans=a[0];
	for(int i=1;i<n;i++){
		(ans+=a[i])/=2;
	}
	printf("%lf",ans);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T>
using max_priority_queue = priority_queue<T>;
template <class T>
using min_priority_queue = priority_queue<T, std::vector<T>, std::greater<T>>;

const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int N;
string A, B, C;
int main()
{
    cin >> N;
    cin >> A;
    cin >> B;
    cin >> C;
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        set<char> cnts;
        cnts.insert(A[i]);
        cnts.insert(B[i]);
        cnts.insert(C[i]);
        if (cnts.size() == 1)
        {
            continue;
        }
        else if (cnts.size() == 2)
        {
            ans++;
        }
        else
        {
            ans += 2;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void)
{
    int  a,b[200000],i,j,m,z=0;
    long long int x=0,y=100;
    long long int n;
    char c[10100],s[10100];

    scanf("%lld",&n);

    while(1){ 
        x=y/100;
        y=y+x;
        z++;
        if(n<=y) break; 
    }
     //printf("/%d /%lld /%lld %lld ",z,x,y,n);
    printf("%d\n",z);
    return 0;
}

Measured memory_bytes: 1704
#include <iostream>
#include <vector>
#include <cstdio>
#include <set>
#include <algorithm>
#include <cmath>
#define ll unsigned long long
using namespace std;
    struct num
    {
        ll a;
        bool b;
    };
    num nu[200005]={0};
ll qkpow(ll x, ll n)
{
    ll res=1;
    while(n>0)
    {
        if(n&1)
            res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}
int main(void)
{
    int n,h;
    cin>>n>>h;
    ll sum=0;
    int i,j;
    ll maxn=-1;
    for(i=0;i<2*n;i+=2)
    {
        cin>>nu[i].a>>nu[i+1].a;
        nu[i].b=0;
        nu[i+1].b=1;
    }
    sort(nu,nu+2*n,[](num x,num y){if(x.a>y.a)return true; return false;});
    //cout<<endl;for(int i=0;i<n;i++) cout<<nu[i].a<<" "<<nu[i].b<<endl;
    for(i=0;i<2*n;i++)
    {
        sum+=nu[i].a;//cout<<sum<<endl;
        if(sum>=h)
        {
            cout<<i+1<<endl;
            return 0;
        }
        if(nu[i].b==0)
        {
            ll temp=(h-sum)/nu[i].a;
            if((h-sum)%nu[i].a)
                temp++;
            //cout<<nu[i].a<<endl;
            cout<<i+1+temp<<endl;
            return 0;
        }

    }
    return 0;
}




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

using namespace std;
using ll = long long;

int freq[100005];
int main() {
    int n;
    scanf("%d", &n);
    int cnt = 0, cntev = 0;
    for(int i=0; i<n; i++){
        int x;
        scanf("%d", &x);
        if(freq[x] && freq[x]%2==0) cntev--;
        if(!freq[x]++) cnt++;
        if(freq[x] %2 == 0) cntev++;
    }
    cnt -= cntev % 2;
    printf("%d\n", cnt);
}


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

#define M_PI 3.14159265358979323846
typedef struct Point
{
	double dX, dY;
} P;


void Koch(int n, P pLeft, P pRight)
{
	if (0 == n)
	{
		return;
	}
	double ti = M_PI / 3.0;
	P s, u, t;
	t.dX = (pRight.dX + 2 * pLeft.dX) / 3;
	t.dY = (pRight.dY + 2 * pLeft.dY) / 3;
	u.dX = (2 * pRight.dX + pLeft.dX) / 3;
	u.dY = (2 * pRight.dY + pLeft.dY) / 3;
	s.dX = (u.dX - t.dX)*cos(ti) - (u.dY - t.dY)*sin(ti) + t.dX;
	s.dY = (u.dX - t.dX)*sin(ti) + (u.dY - t.dY)*cos(ti) + t.dY;

	Koch(n - 1, pLeft, t);
	cout << setiosflags(ios::fixed) << setprecision(8) << t.dX << " " << t.dY << endl;
	Koch(n - 1, t, s);
	cout << setiosflags(ios::fixed) << setprecision(8) << s.dX << " " << s.dY << endl;
	Koch(n - 1, s, u);
	cout << setiosflags(ios::fixed) << setprecision(8) << u.dX << " " << u.dY << endl;
	Koch(n - 1, u, pRight);
}


int main()
{
	P p1, p2;
	int n;
	p1.dX = 0;
	p1.dY = 0;
	p2.dX = 100;
	p2.dY = 0;
	cin >> n;
	cout << setiosflags(ios::fixed) << setprecision(8) << p1.dX << " " << p1.dY << endl;
	Koch(n, p1, p2);
	cout << setiosflags(ios::fixed) << setprecision(8) << p2.dX << " " << p2.dY << endl;
	return 0;
}


Measured memory_bytes: 3212
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define ull       unsigned long long
#define sd(x)     scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
#define MAX       100005
#define maxn 	  200002
#define pb 		  push_back
#define mk 		  make_pair
#define endl	  "\n"
#define INF 	  1000000000
#define MOD		  1000000007
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main ()
{
		ios::sync_with_stdio(0);
		cin.tie(0);
		//CODE TONOY
		int n;
		scanf("%d",&n);
		vector<int> a(n);
		for (int i=0 ;  i<n  ; i++)
		scanf("%d",&a[i]);
		int ans = 0;
		for (int i=0 ; i<n ; i++)
		{
			for (int j=0 ; j<n ; j++)
			if(i==j) continue;
			else
			{
				ans+=a[i]*a[j];
			}
		}
		printf("%d",ans/2);
		return 0;
}  


Measured memory_bytes: 3792
X, Y, A, B, C = map(int, input().split())
P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
P.sort()
Q.sort()
R.sort()

p, q, r = A - X, B - Y, C - 1
ans = 0

Amin = P[p]
Bmin = Q[q]
Cmax = R[r]
for i in range(C):
    if Cmax <= min(Amin, Bmin):
        break
    else:
        if Amin <= Bmin and p < A:
            ans += Cmax
            r -= 1
            p += 1
            if p < A:
                Amin = P[p]
            else:
                Amin = float("inf")
        elif Amin >= Bmin and q < B:
            ans += Cmax
            r -= 1
            q += 1
            if q < B:
                Bmin = Q[q]
            else:
                Bmin = float("inf")
        Cmax = R[r]
ans += sum(P[p:])+sum(Q[q:])
print(ans)

Measured memory_bytes: 104548
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>

#define A 0
#define B 1
#define C 2

using namespace std;

queue<char> que[3];

int main()
{
    string str;
    int player = A;

    for (int j = 0; j < 3; j++) {
        cin >> str;
        for (int i = 0; i < str.size(); i++) {
            que[j].push(str[i]);
        }
    }

    while (!que[player].empty()) {
        char op = que[player].front(); que[player].pop();

        if (op == 'a') player = A;
        if (op == 'b') player = B;
        if (op == 'c') player = C;
    }

    if (player == A) cout << "A" << endl;
    if (player == B) cout << "B" << endl;
    if (player == C) cout << "C" << endl;

    return 0;
}


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

using namespace std;

int main() {
    while (true) {
        int h, w;
        cin >> h >> w;
        if (h == 0 && w == 0) {
            break;
        }
        for (int j = 0; j < w; j++) {
            cout << "#";
        }
        cout << endl;
        for (int i = 1; i < h - 1; i++) {
            cout << "#";
            for (int j = 1; j < w - 1; j++) {
                cout << ".";
            }
            cout << "#";
            cout << endl;    
        }
        for (int j = 0; j < w; j++) {
            cout << "#";
        }
        cout << endl << endl;
    }
    return 0;
}



Measured memory_bytes: 3088
using System;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, d;
            string[] input = Console.ReadLine().Split(' ');
            a = int.Parse(input[0]);
            b = int.Parse(input[1]);
            c = int.Parse(input[2]);
            d = 0;
            for (; a <= b ; a++)
            {
                if (c % a == 0)
                {
                    d++;
                }
            }

            Console.WriteLine(d);
        }
    }
}

Measured memory_bytes: 9096
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,k; cin >> n >> k;
	if(500*n>=k){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
#define MAX (100000)
#define SENTINEL (2000000000)
struct Card{
    char suit;
    int num;
};

struct Card L[MAX/2+2],R[MAX/2+2];

void merge(struct Card A[],int n,int left,int mid,int right){
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0;i<n1;i++)L[i]=A[left+i];
    for(int i=0;i<n2;i++)R[i]=A[mid+i];
    L[n1].num=SENTINEL;
    R[n2].num=SENTINEL;
    int i=0,j=0;
    for(int k=left;k<right;k++){
        if(L[i].num<=R[j].num){
            A[k]=L[i];
            i++;
        }else{
            A[k]=R[j];
            j++;
        }
    }
}

void mergesort(struct Card A[],int n,int left,int right){
    if(left+1<right){
        int mid=(left+right)/2;
        mergesort(A,n,left,mid);
        mergesort(A,n,mid,right);
        merge(A,n,left,mid,right);
    }
}

int partition(struct Card A[], int n, int p,int r){
    int i,j;
    struct Card t,x;
    x=A[r];
    i=p-1;
    for(j=p;j<r;j++){
        if(A[j].num<=x.num){
            i++;
            t=A[i];A[i]=A[j];A[j]=t;
        }
    }
    t=A[i+1];A[i+1]=A[r];A[r]=t;
    return i+1;
}

void quicksort(struct Card A[], int n, int p,int r){
    int q;
    if(p<r){
        q=partition(A,n,p,r);
        quicksort(A,n,p,q-1);
        quicksort(A,n,q+1,r);
    }
}

int main(void){
    int n,v,i;
    struct Card A[MAX],B[MAX];
    char S[10];
    int stable=1;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %d",S,&v);
        A[i].suit=B[i].suit=S[0];
        A[i].num=B[i].num=v;
    }
    mergesort(A,n,0,n);
    quicksort(B,n,0,n-1);
    for(i=0;i<n;i++){
        if(A[i].suit!=B[i].suit)stable=0;
    }
    if(stable)printf("Stable\n");
    else printf("Not stable\n");
    for(i=0;i<n;i++){
        printf("%c %d\n",B[i].suit,B[i].num);
    }
    return 0;
}


Measured memory_bytes: 5464
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define rep(i, n) FOR(i, 0, n)
#define repi(i, n) FOR(i, 1, n + 1)
#define pp(v) cout << #v "=" << (v) << endl;
#define ppa(v) cout << "----\n"; rep(i,v.size()) cout << #v << "[" << i << "] = " << v[i] << endl;
#define div_ceil(a,b) ((a) + ((b) - 1)) / (b)
using namespace std;
using Graph = vector<vector<int>>;

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

  int ans = 0;
  rep(div,n-1) {
    bitset<26> R,L;
    rep(pos,n) (pos <= div ? L : R).set(s[pos]-'a');
    int cnt = (L&R).count();
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}


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

#define For(i, j, k) for (int i = j; i <= k; i++)

using namespace std;

const int N = 3e5 + 10;
const int Mod = 1e9 + 7;

int n;
int dp[N][6][3];
char S[N];

void add(int &x, int y) {
	x += y;
	if (x >= Mod) x -= Mod;
}

int main() {

	scanf("%s", S + 1);
	n = strlen(S + 1);
	
	dp[0][2][0] = 1;
	For(i, 1, n) For(j, 0, 5) For(k, 0, 2) {	
		if (S[i] == '1' || S[i] == '?') {
			add(dp[i][min(5, j + 1)][max(k - 1, 0)], dp[i - 1][j][k]);
		}
		if (S[i] == '0' || S[i] == '?') {
			int d = k <= 1 ? 1 : -1;
			add(dp[i][j - d][k + d], dp[i - 1][j][k]);
		}
	}

	int ans = 0;
	For(j, 3, 5) For(k, 0, 2) add(ans, dp[n][j][k]);
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 21632
#include <cmath>
#include <iomanip>
#include <iostream>

using namespace std;

#define EPS 1e-10
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point {
public:
  double x, y;
  Point() {};
  Point(double x, double y): x(x), y(y) {}

  Point operator + (const Point &p) { return Point(x + p.x, y + p.y); }
  Point operator - (const Point &p) { return Point(x - p.x, y - p.y); }
  Point operator * (double d) { return Point(d * x, d * y); }
  Point operator / (double d) { return Point(d / x, d / y); }

  bool operator < (const Point &p) const {
    return (x == p.x ? y < p.y : x < p.x);
  }

  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }

  friend ostream& operator << (ostream &os, Point &p) {
    return os << "Point(" << p.x << ", " << p.y << ")";
  }
};

typedef Point Vector;

struct Segment {
  Point p1, p2;  
};

double cross (Point p1, Point p2) {
  return p1.x * p2.y - p1.y * p2.x;
}

double dot(Vector v1, Vector v2) {
  return v1.x * v2.x + v1.y * v2.y;
}

double norm(Point p) {
  return p.x * p.x + p.y * p.y;
}

bool isOrthogonal(Segment s1, Segment s2) {
  return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}

bool isParallel(Segment s1, Segment s2) {
  return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}

Point project(Segment s, Point p) {
  Vector v = s.p2 - s.p1;
  double r = dot(p - s.p1, v) / norm(v);
  return s.p1 + v * r;
}

int main() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  Segment s;
  s.p1 = Point(x1, y1);
  s.p2 = Point(x2, y2);

  int n; cin >> n;

  while (n--) {
    int x, y; cin >> x >> y;
    Point p = project(s, Point(x, y));

    cout << fixed << setprecision(10) << p.x << ' ' << p.y << endl;
  }
}

Measured memory_bytes: 1240
from collections import defaultdict

N, M = map(int,input().split())
mod = 10**9+7
d = defaultdict(int)
m = M
while m != 1:
    for i in range(2, int(m**0.5)+1):
        if m % i == 0:
            d[i] += 1
            m //= i
            break
    else:
        d[m] += 1
        m = 1

ans = 1
for k in d.keys():
    r = d[k]
    n = N + r - 1
    r = min(r, N - 1)
    p = 1
    for i  in  range(r):
        p *= n -i
        p //= i + 1
    ans *=p
    ans %= mod
print(ans)

Measured memory_bytes: 3316
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string s; cin >> s;
  int n = s.length(), ans = n;
  REP(i, n-1) {
    if (s[i] != s[i+1]) ans = min(ans, max(i+1, n-(i+1)));
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 512
def solve(n, a, b):
    if a > b:
        a, b = b, a
    if (b - a) % 2 == 0:
        return (b - a) // 2
    top = (b + a - 1) // 2
    c, d = n - a - 1, n - b + 1
    boo = (c + d + 1) // 2
    return min(top, boo)


n, a, b = map(int, input().split())
print(solve(n, a, b))


Measured memory_bytes: 3060
def solve (a , d):
    c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
    old =a
    a=""
    for i in old:
        c[ord(i)-97]+=1
    if len(old) == max(c):
            return 0
    for i in range(len(old)-1):
        if old[i]==d or old[i+1]==d:
            a+=d
        else :
            a+=old[i]
    return solve(a,d)+1

a=input()
b=True

an =9999999999
c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
for i in a:
    c[ord(i)-97]+=1
indexes = [i for i, x in enumerate(c) if x == max(c)]
for  i in a:
    t= solve(a,i)
    if t<an:
        an=t

print(an)

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

int main()
{
    long long int a,b,c,d,m,n;
    cin>>a>>b>>c>>d;
    m = a * b;
    n = c * d;
    if(m>n)
        cout<<m<<endl;
    else if(m==n)
        cout<<m<<endl;
    else if(n>m)
        cout<<n<<endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	int a[M], b[M];
	bool c[N + 1] = {};
	rep(i, M) cin >> a[i] >> b[i];
	rep(i, M) if (a[i] == 1) c[b[i]] = true;
	rep(i, M) if (b[i] == N && c[a[i]]) {
		cout << "POSSIBLE" << endl;
		return 0;
	}
	cout << "IMPOSSIBLE" << endl;

    return 0;
}


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


int main(){
  vector<int> A = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  K--;
  cout << A[K] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int t = h2*60+m2-(h1*60+m1)-k;
  
  cout << t << endl;
  
}

Measured memory_bytes: 3624
use std::io;
use std::io::BufRead;
use std::io::BufReader;

fn main() {
    let reader = io::stdin();
    let mut reader = BufReader::new(reader.lock());

    let mut s = String::new();

    let _ = reader.read_line(&mut s);

    let k: u32 = s.trim().parse().unwrap();

    let tmp = k / 2;

    println!("{}", if k % 2 == 0 { tmp * tmp } else { tmp * (tmp + 1) });
}


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

int findSumOfDigits(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main(int argc, const char * argv[]) {
    // insert code here...
    int N;
    cin >> N;
    int res = 10000;
    if (N % 10 == 0) res = 10;
    else {
        for (int i = 0; i <= N; i++) {
            int A = i;
            int B = N - A;
            int Asum = findSumOfDigits(A);
            int Bsum = findSumOfDigits(B);
            if (Asum + Bsum < res) res = Asum + Bsum;
        }
    }
    cout << res << endl;
    return 0;
}


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

int main(void)
{
    int route[17][17];
    int matatabi[16][16][16][16];
    int gx, gy;
    int p;
    int n;
    int i, j;
    int x1, y1, x2, y2;
    int x, y;
    int m;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        memset(route, 0, sizeof(route));
        memset(matatabi, 0, sizeof(matatabi));

        scanf("%d%d", &gx, &gy);
        
        scanf("%d", &p);
        for (j = 0; j < p; j++){
            scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
            matatabi[x1][y1][x2][y2] = matatabi[x2][y2][x1][y1] = 1;
        }
        
        route[0 + 1][0 + 1] = 1;
        for (y = 0; y <= gy; y++){
            for (x = 0; x <= gx; x++){
                if (x == 0 && y == 0){
//printf("<%d>", route[1][1]);
                    continue;
                }
                
                m = 0;
                if (matatabi[x][y][x - 1][y] == 0){
                    m += route[x - 1 + 1][y + 1];
                }
                if (matatabi[x][y][x][y - 1] == 0){
                    m += route[x + 1][y - 1 + 1];
                }
                route[x + 1][y + 1] = m;
//printf("<%d>", m);
            }
//printf("\n");
        }
        
        if (route[gx + 1][gy + 1] == 0){
            printf("Miserable Hokusai!\n");
        }
        else {
            printf("%d\n", route[gx + 1][gy + 1]);
        }
    }
    return (0);
}

Measured memory_bytes: 876
from collections import defaultdict

N, Q = map(int, input().split())
d = defaultdict(list)

for _ in range(N - 1):
    a, b = map(int, input().split())
    d[a].append(b)
    d[b].append(a)

c = defaultdict(int)

for _ in range(Q):
    p, x = map(int, input().split())
    c[p] += x

ans = [0 for i in range(N)]
que = [(1, 0, -1)]
while len(que) > 0:
    tmp = []
    for v, x, par in que:
        x += c[v]
        ans[v - 1] = str(x)
        for w in d[v]:
            if w != par:
                tmp.append((w, x, v))
    que = tmp

print(*ans)


Measured memory_bytes: 104584
package main

import (
	"bufio"
	"fmt"
	"math/bits"
	"os"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	x := getNextString(scanner)
	ones := 0
	for i := 0; i < n; i++ {
		ones += int(x[i] - '0')
	}
	if ones == 0 {
		for i := 0; i < n; i++ {
			fmt.Fprintln(writer, 1)
		}
		return
	}
	mm := calc(ones-1, n)
	pp := calc(ones+1, n)
	ms := 0
	ps := 0
	for i := 0; i < n; i++ {
		if x[n-1-i] == '0' {
			continue
		}
		ps += pp[i]
		ms += mm[i]
	}
	for i := 0; i < n; i++ {
		if x[i] == '0' {
			fmt.Fprintln(writer, 1+f(mod(ps+pp[n-1-i], ones+1)))
			continue
		}
		if ones == 1 {
			fmt.Fprintln(writer, 0)
			continue
		}
		fmt.Fprintln(writer, 1+f(mod(ms-mm[n-1-i], ones-1)))
	}
}
func mod(x, m int) int {
	x %= m
	if x < 0 {
		return x + m
	}
	return x
}
func f(x int) int {
	if x == 0 {
		return 0
	}
	p := bits.OnesCount32(uint32(x))
	return 1 + f(x%p)
}
func calc(ones, n int) []int {
	ans := make([]int, n)
	if ones == 0 {
		return ans
	}
	ans[0] = 1 % ones

	for i := 1; i < n; i++ {
		ans[i] = (ans[i-1] * 2) % ones
	}
	return ans
}


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

int main(){
	int n,m,i,j,x,y;
	cin>>n;
	int a[n];
	for(i=0; i<n; i++){
		cin>>a[i];
	}
	cin>>m;
	int b[m];
	for(i=0; i<m; i++){
		cin>>b[i];
	}
	int cnt=0;
	for(i=0; i<m; i++){
		for(j=0; j<n; j++){
			if(b[i]==a[j]){
				cnt++;
				break;
			}
		}
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 3104
import base64

exec(base64.b64decode(b'aW1wb3J0IHN1YnByb2Nlc3MKaW1wb3J0IHN5cwoKY29kZSA9IHIiIiIjaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Yml0c2V0PgojaW5jbHVkZSA8Y2Fzc2VydD4KI2luY2x1ZGUgPGNjdHlwZT4KI2luY2x1ZGUgPGNocm9ubz4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8Y29tcGxleD4KI2luY2x1ZGUgPGNzdHJpbmc+CiNpbmNsdWRlIDxkZXF1ZT4KI2luY2x1ZGUgPGlvbWFuaXA+CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPG51bWVyaWM+CiNpbmNsdWRlIDxxdWV1ZT4KI2luY2x1ZGUgPHJhbmRvbT4KI2luY2x1ZGUgPHNldD4KI2luY2x1ZGUgPHN0YWNrPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8dHVwbGU+CiNpbmNsdWRlIDx1dGlsaXR5PgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnVzaW5nIGludDY0ID0gbG9uZyBsb25nOwoKI2RlZmluZSBhbGwoXykgYmVnaW4oXyksIGVuZChfKQojZGVmaW5lIHJhbGwoXykgcmJlZ2luKF8pLCByZW5kKF8pCgppbnQgbWFpbigpIHsKICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICBjaW4udGllKG51bGxwdHIpOwoKICBpbnQgaCwgdywgbTsgY2luID4+IGggPj4gdyA+PiBtOwogIHZlY3RvcjxwYWlyPGludCwgaW50Pj4gaW47CgogIHZlY3RvcjxpbnQ+IGNudF9yb3coaCwgMCksIGNudF9jb2wodywgMCk7CgogIGZvciAoaW50IGkgPSAwOyBpIDwgbTsgKytpKSB7CiAgICBpbnQgaGgsIHd3OyBjaW4gPj4gaGggPj4gd3c7CiAgICAtLWhoOyAtLXd3OwogICAgaW4uZW1wbGFjZV9iYWNrKGhoLCB3dyk7CiAgICArK2NudF9yb3dbaGhdOyArK2NudF9jb2xbd3ddOwogIH0KCiAgaW50IG14X3JvdyA9ICptYXhfZWxlbWVudChhbGwoY250X3JvdykpOwogIGludCBteF9jb2wgPSAqbWF4X2VsZW1lbnQoYWxsKGNudF9jb2wpKTsKICBpbnQgYW5zID0gbXhfcm93ICsgbXhfY29sOwogIGludDY0IGNhbiA9IGNvdW50KGFsbChjbnRfcm93KSwgbXhfcm93KSAqIGNvdW50KGFsbChjbnRfY29sKSwgbXhfY29sKTsKICBpZiAoY2FuID4gbSkgewogICAgY291dCA8PCBhbnMgPDwgZW5kbDsKICB9IGVsc2UgewogICAgaW50IGJhZCA9IDA7CiAgICBmb3IgKGF1dG8gZSA6IGluKSBiYWQgKz0gKGNudF9yb3dbZS5maXJzdF0gKyBjbnRfY29sW2Uuc2Vjb25kXSA9PSBhbnMpOwogICAgaWYgKGNhbiA+IGJhZCkgewogICAgICBjb3V0IDw8IGFucyA8PCBlbmRsOwogICAgfSBlbHNlIHsKICAgICAgY291dCA8PCBhbnMgLSAxIDw8IGVuZGw7CiAgICB9CiAgfQoKICByZXR1cm4gMDsKfQoiIiIKCndpdGggb3Blbignc29sLmNwcCcsICd3JykgYXMgZjoKICAgIGYud3JpdGUoY29kZSkKCnN1YnByb2Nlc3MuUG9wZW4oWydnKysnLCAnLXN0ZD1jKysxNycsICctTzInLCAnc29sLmNwcCddKS5jb21tdW5pY2F0ZSgpCnN1YnByb2Nlc3MuUG9wZW4oWycuL2Eub3V0J10sIHN0ZGluPXN5cy5zdGRpbiwgc3Rkb3V0PXN5cy5zdGRvdXQpLmNvbW11bmljYXRlKCk='))

Measured memory_bytes: 127088
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
int main(void){
	vector<pair<int, int>>a;
	int p[300000];
	for (int i = 0; i < 300000; i++)p[i] = 0;
	int n;
	int x;
	int y;
	int z;
	int g;
	n = 0;
	g = 0;
	x = 0;
	for (; a.empty() == 0;)a.clear();
	pair<int, int>t;
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d",&y);
		a.push_back(make_pair(y, i + 1));
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < n; i++){
		t = a[i];
		y = t.first;
		z = t.second;
		p[y - 1] = z;
		for (int j = 0; j < z-1;){
			if (p[x] == 0){
				p[x] = z;
				x++;
				j++;
				if (x > y-1)g = 1;
			}
			else x++;
		}

	}
	for (int i = 0; i < n; i++){
		t = a[i];
		y = t.first;
		z = t.second;
		for (int j = 0; j <n-z;){
			if (p[x] == 0){	
				if (x < y-1)g = 1;
				p[x] = z;
				x++;
				j++;
			}
			else x++;
		}
	}
		if (g != 0)printf("No");
		else{
			printf("Yes\n");
			for (int i = 0; i < n*n-1; i++){
				printf("%d ", p[i]);
			}
			printf("%d", p[n*n - 1]);
		}
	return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<iomanip>
#include<tuple>
#include<bitset>


using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define printfloat(x) cout << fixed << setprecision(7) << (x) << endl;
#define printbit(x) cout << bitset<15>(x) << endl;
using ll = long long int;



long double pi = 3.14159265359;

int n;

int main(){
    cin >> n;
    long double ans;
    long double nn = (long double)n;
    if(n == 1) {
        printfloat(1);
        return 0;
    }
    if(n%2) ans = (n/2+1)/nn;
    else ans = (nn/2)/nn;
    printfloat(ans);

return 0;
}

Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
#define Yes(n) cout << ((n) ? "YES" : "NO") << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))

//vector<string> split(string,string);

//template<typename T>
//void swap(T*,T*);
char ToUpper (char cX) { return toupper(cX); }

int main()
{
    string s,t,r;
    cin >> s >> t >> r;
    transform(s.begin(), s.end(), s.begin(), ToUpper);
    transform(t.begin(), t.end(), t.begin(), ToUpper);
    transform(r.begin(), r.end(), r.begin(), ToUpper);
    cout << s[0] << t[0] << r[0];
}

Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <string>

int main () {
    std::string b;
    std::cin >> b;
    int max_count = -10;

    for(int i = 0; i < (int)b.size(); ++i)
    {
        char c = b[i];
        int count = 0;
        
        for(int j = i; j < (int)b.size(); ++j)
        {
            if('A' == c || 'C' == c || 'G' == c || 'T' == c)
            {
                c = b[j+1];
                ++count;
                if(j+1 >= (int)b.size())
                {
                    if(count > max_count)
                    {
                        max_count = count;
                    }
                    i = j;
                    break;
                }
            } else {
                if(count > max_count)
                {
                    max_count = count;
                }
                i = j;
                break;
            }
        }
    }
    std::cout << max_count << std::endl;
}


Measured memory_bytes: 256
#include <map>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <sstream>
#include <vector>
#include <stack>
#include <utility>
#include <math.h>
using namespace std;

typedef long long ll;

int main()
{
	int N;
	float x[20];
	string u[20];

	float tmp = 0;

	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> x[i];
		cin >> u[i];
		if (u[i] == "BTC")
		{
			x[i] *= (float)380000;
		}
		tmp += x[i];
	}

	cout << tmp << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

const long long INF = 1LL << 60;
const int MAX_V = pow(10, 3) * 100 + 1;

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

    vector<long long> weight(N), value(N);
    for (int i = 0; i < N; ++i)
        cin >> weight[i] >> value[i];

    vector<vector<long long>> dp(N + 1, vector<long long>(MAX_V, INF));

    dp[0][0] = 0;

    // DPループ
    rep(i, N)
    {
        rep(j, MAX_V)
        {
            // i 番目の品物を選ぶ場合
            if (j - value[i] >= 0)
                chmin(dp[i + 1][j], dp[i][j - value[i]] + weight[i]);

            // i 番目の品物を選ばない場合
            chmin(dp[i + 1][j], dp[i][j]);
        }
    }

    long long res = 0;
    rep(j, MAX_V)
    {
        if (dp[N][j] <= W)
        {
            res = j;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 80256
//Be Name Khoda, Besmellah Rahmane Rahim, In The Name Of God;
//#include<bits/std++.h>
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>
#include <stdio.h>
#include <string.h>
#include<iomanip>
#include<unordered_map>
#include<unordered_set>
#include <fstream>

using namespace std;

const int N = 1e5 + 5;
int ans = 0;

vector <int> graph[N];
int dp[N];
int cnt[N][25];
bool mark[N];


void dfs(int v) 
{
    mark[v] = true;
    for (auto u : graph[v]) 
    {
        if (!mark[u]) 
        {
            dfs(u);
            dp[v] =  dp[v] | dp[u];
            for (int i = 0; i < 20; i++) 
            {
                if ((dp[u] >> i) % 2) 
                {
                    cnt[v][i]++;
                }
            }
        }
    }
    int check = -1;
    for (int i = 0; i < 20; i++) 
    {
        if (cnt[v][i] > 1) 
        {
            check = i;
        }
    }
    check++;
    while (cnt[v][check]) 
    {
        check++;
    }
    ans = max(ans, check);
    for (int i = 0; i < check; i++) 
    {
        dp[v] &= (1 << 20) - 1 - (1 << i);
    }
    dp[v] = dp[v] | (1 << check);
}

int main() 
{
    int n;
    cin >> n;
    for (int i = 0; i < n - 1; i++) 
    {
        int u, v;
        cin >> u >> v;
        graph[u - 1].push_back(v - 1);
        graph[v - 1].push_back(u - 1);
    }
    dfs(0);
    cout << ans << endl;;
}



Measured memory_bytes: 19328
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define rep(i,n) for(int i=0;i<n;++i)
#define rep(j,n) for(int j=0;j<n;++j)
#define REP(i,n) for(int i=1;i<=n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define len(s)   ((int)s.size())
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef double db;
typedef vector<int> ve;
typedef vector< vector < int> > vee;
typedef vector<pair<ll,ll> > vepa;
typedef set<int>se;
typedef map<int,int> mpp;
const ll N=1e5+5;
ll arr[N],A[N],ARR[N];
bool visited[N]={};
ll cnt[N],freq[N];
bool f,ff;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);

 int a,b,c;
 cin>>a>>b>>c;
 cout<<c<<' '<<a<<' '<<b;
go;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>

int main(){
	int a,b,c,m=0;
    while(m==0){
		int ap=0,bp=0;
		std::cin>>c;
		if(c==0)break;
		for(int i=0;i<c;i++){
			std::cin>>a>>b;
			if(a>b)ap+=a,ap+=b;
			else if(b>a){
				bp+=a;bp+=b;
			}else{
				ap+=a,bp+=b;
			}
		}
		std::cout<<ap<<" "<<bp<<std::endl;
	}
	return 0;
}

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

int N, T, t[202020];

int main() {
  cin >> N >> T;
  rep(i, N){
    cin >> t[i];
  }
  long long res = 0;
  rep(i, N - 1){
    res += (long)min(t[i + 1] - t[i], T);
  }
  res += T;
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
while(true){
int a = scan.nextInt();
char op = scan.next().charAt(0);
int b = scan.nextInt();

if(op == '?'){break;}

if(op == '+'){System.out.println(a + b);}

if(op == '-'){System.out.println(a - b);}

if(op == '*'){System.out.println(a * b);}

if(op == '/'){System.out.println(a / b);}
}}}

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

const int MOD = 1000000007;

int cntNumberOfDigits(int N)
{
  int num = N;
  int cnt = 0;
  while (num > 0)
  {
    num /= 10;
    cnt++;
  }
  return cnt;
}

int topOfDigits(int N)
{
  int num = N;
  string s = to_string(num);
  char c = s[0];
  int res = (int)(c - '0');
  return res;
}

int endOfDigits(int N)
{
  int num = N;
  string s = to_string(num);
  char c = s[s.size() - 1];
  int res = (int)(c - '0');
  return res;
}

int main()
{
  long long N;
  cin >> N;
  vector<vector<int>> c(10, vector<int>(10));
  for (int k = 1; k <= N; k++)
  {
    int top_digits = topOfDigits(k);
    int end_digits = endOfDigits(k);
    c[top_digits][end_digits]++;
  }
  long long ans = 0;
  for (int i = 1; i <= 9; i++)
  {
    for (int j = 1; j <= 9; j++)
    {
      ans += c[i][j] * c[j][i];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256