akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second
using namespace std;
typedef pair<int,int> P;

const int MOD=1000000007;
int INF=100100100100100;

vector<int> g[100010];
int depth[100010];
int kosuu[100010];
int par[100010];
int n;

int dfs(int v,int p=-1){
  par[v]=p;
  if(p<0)depth[v]=0;
  else depth[v]=depth[p]+1;
  int res=0;
  for(int w:g[v]){
    if(w!=p){
      res+=dfs(w,v);
    }
  }
  kosuu[v]=res+1;
  return kosuu[v];
}

signed main(){
  cin>>n;
  rep(i,n-1){
    int a,b;cin>>a>>b;a--;b--;
    g[a].pb(b);
    g[b].pb(a);
  }
  dfs(0);
  int d=depth[n-1];
  int m=d/2+1;
  int po=n-1;
  for(int i=d;i>m;i--){
    po=par[po];
  }
  
  //cout<<kosuu[po]<<endl;
  if(kosuu[po]>=(n+1)/2)cout<<"Snuke"<<endl;
  else cout<<"Fennec"<<endl;
  return 0;
}

Measured memory_bytes: 12800
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A=sc.nextInt();
    int B=sc.nextInt();
    int H=sc.nextInt();
    int M=sc.nextInt();
    double x=M*6;
    double y=H*30+M*0.5;
    double t=Math.abs(x-y);
    double rad=t*3.141592653589/180;
    double cos=Math.cos(rad);
    double X=Math.sqrt((A*A)+(B*B)-(2*A*B*cos));
    System.out.println(X);
  }
}  

Measured memory_bytes: 35980
#!/usr/bin/python

import sys

def main(argv):
    for line in sys.stdin:
        A, B = map(lambda x: int(x), line.split(" ", 2))
        if (A % 3) == 0 or (B % 3) == 0 or ((A+B) % 3) == 0:
            print("Possible")
        else:
            print("Impossible")

if __name__ == "__main__":
    main(sys.argv)

Measured memory_bytes: 2568
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
#include<set>
using namespace std;
typedef long long LL;
multiset<string> s;
multiset<string> :: iterator it,it1;
int main()
{
	int x,y,z;
	scanf("%d%d%d",&x,&y,&z);
	for (int u=1;u<=x;u++) s.insert("a");
	for (int u=1;u<=y;u++) s.insert("b");
	for (int u=1;u<=z;u++) s.insert("c");
	while (s.size()>1)
	{
		it=s.begin();
		it1=(--s.end());
		s.insert((*it)+(*it1));
		s.erase(it);s.erase(it1);
	}
	cout<<(*s.begin());
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    static Scanner in = new Scanner(System.in);

    void solve() {
		int r = in.nextInt(), g = in.nextInt();
		System.out.println(r +(g-r)*2);
	}
	
    public static void main(String[] args) {
		new Main().solve();
    }
}


Measured memory_bytes: 22228
D=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(D):
  s.append(list(map(int,input().split())))
t=[]
for i in range(D):
  t.append(int(input()))
last_di=[0]*26
m=0
for i in range(D):
  m+=s[i][t[i]-1]
  last_di[t[i]-1]=i+1
  for j in range(26):
    m-=c[j]*((i+1)-last_di[j])
  print(m)


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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

ll mod_pow(ll x, ll n) {
  if (n == 0) return 1;
  ll res = mod_pow(x * x % MOD, n / 2);
  if (n & 1) res = res * x % MOD;
  return res;
}

ll combination(ll n, ll k) {
  ll sum1 = 1;
  ll sum2 = 1;
  for (int i = 1; i <= k; i++) {
    sum1 = sum1 * (n-k+i) % MOD;
    sum2 = sum2 * i % MOD;
  }
  sum2 = mod_pow(sum2, MOD-2);
  return sum1 * sum2 % MOD;
}

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

  ll n, k;
  cin >> n >> k;
  if (k >= n-1) {
    cout << combination(2*n-1, n-1) << endl;
  }
  else {
    ll ans = 0;
    ll a = 1;
    ll b = 1;
    ll c = 1;
    ll d;
    repto(i, k) {
      if (i >= 1) {
        a = a * (n-i+1) % MOD;
        b = b * (n-i) % MOD;
        c = c * i % MOD;
      }
      d = mod_pow(c, MOD-2);
      ans += (a*d%MOD)*(b*d%MOD)%MOD;
      ans %= MOD;
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=525,INF=1<<30;
ll dp[MAX][MAX],mae[MAX][MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,X;cin>>N>>X;
    dp[0][0]=1;
    
    for(int i=0;i<=X;i++){
        for(int j=0;j<=N;j++){
            for(int k=0;k<512;k++){
                dp[j][k]+=mae[j][k];
                dp[j][k]%=mod;
            }
            
            for(int k=0;k<512;k++){
                if(j) dp[j][k]+=dp[j-1][k^i];
                dp[j][k]%=mod;
            }
        }
        
        for(int j=0;j<=N;j++){
            for(int k=0;k<512;k++){
                mae[j][k]=dp[j][k];
                dp[j][k]=0;
            }
        }
    }
    
    cout<<mae[N][X]<<endl;
}




Measured memory_bytes: 7300
type dice = {one : int ; two : int ; three : int ; four : int ; five : int ; six : int };;
type dir = W | E | S | N | L | R ;;

let roll dice =
  let {one = a; two = b; three = c; four = d; five = e; six = f} = dice in
  function
    W -> {dice with one = c; three = f; six = d; four = a}
  | E -> {dice with one = d; four = f; six = c; three = a}
  | S -> {dice with one = e; two = a; six = b; five = f}
  | N -> {dice with one = b; two = f; six = e; five = a}
  | L -> {dice with two = c; three = e; five = d; four = b}
  | R -> {dice with two = d; four = e; five = c; three = b} ;;

let dir_list1 = [[];[W];[E];[S];[N];[W; W]];;
let dir_list2 = [[];[L];[R];[L;L]] ;;

let make_all_dices dice =
  let f d lst = List.fold_left (fun e dir -> roll e dir) d lst in
  let dice_list = List.map (f dice) dir_list1 in 
  List.map (fun x -> List.map (f x) dir_list2) dice_list |> List.concat ;;

let check_eq dice list =
  List.exists (fun x -> x = dice) list ;;

let rec check_same_dices_exist = function
    [] -> false
  | x::xs -> let rec f a = function
                [] -> false
               | y :: ys -> check_eq x (make_all_dices y) || f x ys
             in
             f x xs || check_same_dices_exist xs ;;
             
let () =
  let n = Scanf.scanf "%d\n" (fun a -> a) in 
  let as_ = Array.init n (fun _ -> Scanf.scanf "%d %d %d %d %d %d\n" (fun a b c d e f -> {one = a; two = b; three = c; four = d; five = e; six = f})) in
  let as_list = Array.to_list as_ in
  if not (check_same_dices_exist as_list) then print_endline "Yes" else print_endline "No" ;;


Measured memory_bytes: 4388
#include<stdio.h>
#include<math.h>
//#define DEBUG
//#define FILEIO

int GCD(int a, int b) { int c; while(b > 0) { c = a % b; a = b; b = c; } return a; }
void SWAP(int *a, int *b) { int c; c = *a; *a = *b; *b = c; }
int MAX(int a, int b) { return (a > b) ? a : b; }
int MIN(int a, int b) { return (a < b) ? a : b; }

int main()
{
    #ifdef FILEIO
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    // variables
    int x, a, b, h1, h2, h;

    #ifdef DEBUG
    while(1) {
    # endif

    // code
    scanf("%d", &x);
    if(x >= 500)
    {
        a = x / 500;
        h1 = (a * 1000);
        if((x % 500) >= 5)
        {
            b = (x - (a * 500)) / 5;
            h2 = (b * 5);
        }
        else
        {
            h2 = 0;
        }
        h = h1 + h2;
    }
    else if(x >= 5)
    {
       b = (x - (a * 500)) / 5;
       h = (b * 5);
    }
    else
    {
        h = 0;
    }
    printf("%d\n", h);

    #ifdef DEBUG
    }
    #endif

    return 0;
}




Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  cout << fixed << setprecision(15);
  int n,k; cin >> n >> k;
  vector<double> p(n);
  rep(i,n) cin >> p[i];
  vector<double> a(n-k+1);
  rep(i,k){
    a[0]+=p[i];
  }
  for(int i=1;i<=n-k;i++){
    a[i]=a[i-1]+p[i+k-1]-p[i-1];
  }
  int mx=0,koko=0;
  rep(i,n-k+1){
    if(mx<a[i]){
      mx=a[i];
      koko=i;
    }
  }
  double ans=0;
  for(int i=koko;i<koko+k;i++){
    ans+=(p[i]+1)/2;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3328
#include <cstdio>
#include <algorithm>

using namespace std;

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

typedef long long ll;

const int N_MAX = 100000;

int n;
int a[N_MAX];

ll f(int sgn) {
  ll sum = 0, mv = 0;
  REP(i, n) {
    sum += a[i];
    if (sgn * sum <= 0) {
      mv += abs(sgn - sum);
      sum = sgn;
    }
    sgn = -sgn;
  }
  return mv;
}

void solve() {
  ll ans = min(f(1), f(-1));
  printf("%lld\n", ans);
}

void input() {
  scanf("%d", &n);
  REP(i, n) scanf("%d", a + i);
}

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


Measured memory_bytes: 512
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 100005

struct Edge{
	Edge(int arg_to,int arg_weight){
		to = arg_to;
		weight = arg_weight;
	}
	int to,weight;
};

int V,E,W;
int maximum;
int in_num[SIZE];
bool dp[SIZE][105];
vector<Edge> G[SIZE];

//https://betrue12.hateblo.jp/entry/2020/08/09/150101

int main(){

	scanf("%d %d %d",&V,&E,&W);

	int abs_W = -W;

	for(int i = 0; i < V; i++){

		//dp[終端ノード][重みの総和] := 存在するならtrue
		dp[i][0] = true;
		for(int k = 1; k <= abs_W-1; k++){
			dp[i][k] = false;
		}
	}
	for(int i = 0; i < V; i++){

		in_num[i] = 0;
	}

	int from,to,cost;

	for(int i = 0; i < E; i++){

		scanf("%d %d %d",&from,&to,&cost);
		G[from].push_back(Edge(to,cost));
		in_num[to]++;
	}

	queue<int> Q;
	for(int i = 0; i < V; i++){

		if(in_num[i] == 0){

			Q.push(i);
		}
	}

	int maximum = -BIG_NUM;

	while(!Q.empty()){

		int node_id = Q.front();
		Q.pop();

		for(int i = 0; i <= abs_W-1; i++){

			if(!dp[node_id][i])continue;

			for(int k = 0; k < G[node_id].size(); k++){

				int next_node = G[node_id][k].to;
				int next_cost = i+G[node_id][k].weight;

				if(next_cost >= abs_W)continue;

				maximum = max(maximum,next_cost+W);
				dp[next_node][next_cost] = true;
			}
		}

		for(int i = 0; i < G[node_id].size(); i++){

			int next = G[node_id][i].to;
			in_num[next]--;
			if(in_num[next] == 0){

				Q.push(next);
			}
		}
	}

	if(maximum == -BIG_NUM){

		printf("NA\n");
	}else{

		printf("%d\n",maximum);
	}


	return 0;
}



Measured memory_bytes: 23872
#include <bits/stdc++.h>
#define gc getchar()
#define ll long long
#define inf (ll)1e18
#define N 200009
#define mid (l+r>>1)
#define root 1,1,n
#define lc cur<<1
#define rc lc|1
#define lson lc,l,mid
#define rson rc,mid+1,r
#define now cur,l,r
using namespace std;
ll n,q,A,B,pos[N],tg[N<<2],val[N<<2],last,v1[N<<2],v2[N<<2]; 
ll read()
{
	ll x=1;
	char ch;
	while (ch=gc,ch<'0'||ch>'9') if (ch=='-') x=-1;
	ll s=ch-'0';
	while (ch=gc,ch>='0'&&ch<='9') s=s*10+ch-'0';
	return x*s;
}
void down(ll cur,ll l,ll r)
{
	if (tg[cur]!=0)
	{
		tg[lc]+=tg[cur],tg[rc]+=tg[cur];
		val[lc]+=tg[cur],val[rc]+=tg[cur];
		v1[lc]+=tg[cur],v2[lc]+=tg[cur];
		v1[rc]+=tg[cur],v2[rc]+=tg[cur];
		tg[cur]=0;
	}
}
void build(ll cur,ll l,ll r)
{
	if (l==r)
	{
		val[cur]=(l==B)?0:inf;
		v1[cur]=val[cur]-l;
		v2[cur]=val[cur]+l;
		return;
	}
	build(lson),build(rson);
	val[cur]=min(val[lc],val[rc]);
	v1[cur]=min(v1[lc],v1[rc]);
	v2[cur]=min(v2[lc],v2[rc]);
}
ll get1(ll cur,ll l,ll r,ll L,ll R)
{
	if (L<=l&&R>=r) return v1[cur];
	ll ret=inf;
	down(now);
	if (L<=mid) ret=min(ret,get1(lson,L,R));
	if (R>mid) ret=min(ret,get1(rson,L,R));
	return ret;
}
ll get2(ll cur,ll l,ll r,ll L,ll R)
{
	if (L<=l&&R>=r) return v2[cur];
	ll ret=inf;
	down(now);
	if (L<=mid) ret=min(ret,get2(lson,L,R));
	if (R>mid) ret=min(ret,get2(rson,L,R));
	return ret;
}
void ins(ll cur,ll l,ll r,ll x,ll y)
{
	val[cur]=min(val[cur],y);
	v1[cur]=min(v1[cur],y-x);
	v2[cur]=min(v2[cur],y+x);
	if (l==r) return;
	down(now);
	if (x<=mid) ins(lson,x,y);
	else ins(rson,x,y);
	val[cur]=min(val[lc],val[rc]);
	v1[cur]=min(v1[lc],v1[rc]);
	v2[cur]=min(v2[lc],v2[rc]);
}
int main()
{
	n=read(),q=read();
	A=read(),B=read();
	if (A>B) swap(A,B);
	build(root);
	last=A;
	while (q--)
	{
		ll x=read();
		val[1]+=abs(last-x),tg[1]+=abs(last-x);
		v1[1]+=abs(last-x),v2[1]+=abs(last-x);
		ll ret1=get1(root,1,x);
		ll ret2=get2(root,x,n);
		ins(root,last,min(ret1+x,ret2-x)-abs(last-x));
		last=x;
	}
	printf("%lld\n",val[1]);
	return 0;
}


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


//c++ templte for help............................................................................................................................................
typedef long long ll;

//template<typename... T>
//void print1(T... t){
	//((cout<<t<<" "),...);
//}

//template<typename... T>
//void print2(T... t){
		//vector<vector<ll>> ans={t...};
		//for(ll i=0;i<(ll)ans.size();i++){
			//if(i!=0) cout<<"\t\t";
			//else cout<<"\t";
			//for(ll j=0;j<(ll)ans[i].size();j++){
				//cout<<ans[i][j]<<" ";
			//}
			//if(i!=(ll)ans.size()-1)
			//cout<<endl;
		//}
//}	
//#define deb(...) cout<<" [ "#__VA_ARGS__<<" : "; print1(__VA_ARGS__); cout<<"]"<<endl; 
//#define vdeb(...) cout<<" [ "#__VA_ARGS__<<" : "; print2(__VA_ARGS__); cout<<"]"<<endl;





	
 
//for loop
//#define fo(i,n) for(int i=0;i<(ll)n;i++)
//#define Fo(i,k,n) for(int i=k;i<n;i++)
 
 
//to print vector element 
//template<typename T>
//void printV(T vec){
	//fo(i,vec.size()) cout<<vec[i]<<" "<<flush;
	//cout<<endl;
	//}
	
 
#define M 998244353
const int INF=1e9+5;
 
//iterate map
//template<typename T>
//void itR(T map){
	 //for(auto itr=map.begin();itr!=map.end();itr++){
				//deb(itr->first,itr->second);
			//}
	//cout<<endl;
//}
 
 
 
//c++ template for help...........................................................................................................................................



void solve(){
	char c;
	cin>>c;
	if(c>='A' and c<='Z') cout<<'A'<<endl;
	else cout<<'a'<<endl;
}

int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(50);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	 // TESTCASE KO DEKH KA BHAUT SARA CONDITION GENERATE MAT KRO 
	 // PAPER PD CONFIRM HO JAO THORA JADA TIME HI KYU NA LGA
	 // greedy ma jadatr exceptional case check kr ke dekh lo
	 
	 // WHILE DOING THE QUESTION OF DYNAMIC PROGRAMMING GREEDY KA TRAH SOCHNA BAND KRO
	 // DP M DATA KA BHI USE KRNA PDTA HA BE BHULO MT 
	 // DP BHI WO LEETCODE WALE MATRIX KA QUESTION KI TARAH HA
	 // CONSTRAIN WILL BE THE DIMENSION OF DP
	 // DP MA STATE PTA KRO AUR PHIR FUNCTION GENERATE KRO
	 // OBJECT KO CHOOSE KIA YA NAE KIA AGAR KIA TO KYA HOGA AUR NAE KIA TO KYA HOGA
	 // KYA KYA CHEJ IMPORTANT HA WO STATE BN JAGA AUR HUM LOG STATE KO CHANGE KR SKTA HA JYSA KNPSACK 2 WALE PROBLEM MA KIA THA
	 

	 
	//ll testCase;
	//cin>>testCase;
	//for(ll tt=0;tt<testCase;tt++){
		solve();
		//ll ans=solve();
		//cout<<ans<<endl;
	//}
	return 0;
}


Measured memory_bytes: 3632
#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
#define int long long
typedef pair<int, int> P;
map<P, int> mp;
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, N;
    cin >> H >> W >> N;
    int a[100010], b[100010];
    rep(i, N) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }
    int ans[10] = {};
    rep(i, N) {
        rep(j, 3) {
            rep(k, 3) {
                int xx = a[i] + j - 1;
                int yy = b[i] + k - 1;
                mp[{xx, yy}]++;
            }
        }
    }
    int sum = 0;
    for(auto itr = mp.begin(); itr != mp.end(); itr++) {
        int x = itr->first.first;
        int y = itr->first.second;
        if(x <= 0 || x >= H - 1 || y <= 0 || y >= W - 1) continue;
        //cout << x << " " << y <<" " << itr->second << endl;
        ans[itr->second]++;
        sum++;
    }
    cout << (H - 2) * (W - 2) - sum << endl;
    rep(i, 9) {
        cout << ans[i + 1] << endl;
    }
    return 0;
}


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

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

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

int main(){
    int N=0,A=0;
    int ans=0;

    cin>>N;

    if(N%2==0)--N;

    for(int k=N;k>9;k=k-2){
        int count=1;
    for(int i=3;i<=N;i++){
            if(k%i==0){ 
                count++;

            }
        }
        if(count==8){
            ++ans;
        }
    }


    cout<<ans<<endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i = 0; i < n; i++){
    cin>>a[i];
  }
  sort(a,a+n);
  cout<<a[n-1]-a[0]<<endl;
  return 0;
}

  



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES //M_PI
#include <cmath>
using namespace std;

int main(){
	double a, b, C, S, L, h;
	cin >> a >> b >> C;
	double rad = C*M_PI/180;
	S = a*b*sin(rad)/2;
	L = sqrt(a*a + b*b -2*a*b*cos(rad)) +a+b;
	h = 2*S/a;
	cout << fixed << setprecision(12) << S << endl;
	cout << fixed << setprecision(12) << L << endl;
	cout << fixed << setprecision(12) << h << endl;
	return 0;
}

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

using namespace std;

bool isprimeDiv2(int n, int k = 2)
{
	if (n == 1) { return false; }

	if (n < k * k) { return true; }

	if (n % k == 0) { return false; }

	return isprimeDiv2(n, k + 1);
}

int main()
{
	vector<int> primes;

	for (int i = 1; i <= 1000000; i++)
	{
		if (isprimeDiv2(i))
		{
			primes.push_back(i);
		}
	}

	vector<int> consecutive(1000001,  0);

	for (int i = 0; i < primes.size(); i++)
	{
		for (int j = i; j < primes.size(); j++)
		{
			int sum = 0;

			for (int k = i; k <= j; k++)
			{
				sum += primes[k];

				if (sum > 1000000)
				{
					goto Exit;
				}
			}

			consecutive[sum]++;
		}

	Exit:;
	}

	int n;

	while (true)
	{
		cin >> n;

		if (n == 0) { break; }

		cout << consecutive[n] << endl;
	}

	return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	cin >> N;
	string res;
	if(N/10==9 || N%10==9)  res = "Yes";
	else res = "No";
	cout << res << endl;
    return 0;
}

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

using namespace std;

int main() {
  string str;
  string flag("Good");
  cin >> str;
  for(int i = 1;i < 4; ++i)
    if(str[i] == str[i - 1]){
      flag = "Bad";
      break;
    }

  cout << flag << endl;
  return 0;
}


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

using namespace std;

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

    int n; cin >> n;
    vector<int> v(n);

    for(auto &num : v) cin >> num;

    vector<int> dp(n);

    dp[0] = 0;
    dp[1] = abs(v[1] - v[0]);

    for(int i = 2; i < n; i++)
    {
        dp[i] = min(dp[i - 2] + abs(v[i - 2] - v[i]), dp[i - 1] + abs(v[i - 1] - v[i]));
    }

    cout << dp[n - 1] << '\n';
}

Measured memory_bytes: 1024
r, g, b = list(map(int, input().split()))
k = int(input())

while k:
    if r < g:
        break

    g *= 2
    k -= 1

while k:
    if g < b:
        break

    b *= 2
    k -= 1

ans = 'No'
if r < g < b:
    ans = 'Yes'

print(ans)


Measured memory_bytes: 9168
N = int(input())
S = input()
cnt = 0
cnt1 = 0
for s in S:
    if s == "(":
        cnt += 1
    else:
        cnt -= 1
    if cnt < 0:
        cnt1 += 1
        cnt = 0
ans = ("("*cnt1) + S + (")"*cnt)
print(ans)

Measured memory_bytes: 38384
import math

n, d = list(map(int, input().split()))
count = 0

for i in range(n):
  x, y = list(map(int, input().split()))
  if abs(x) > d or abs(y) > d:
    pass
  else:
    if math.sqrt(x*x + y*y) <= d:
      count += 1

print(count)

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

using namespace std;
typedef long long int lli;

#define all(arr) arr.begin(),arr.end()
#define f first
#define s second
#define debug1(x) cout<<x<<"\n"
#define debug2(x,y) cout<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define nl cout<<"\n";
#define pq priority_queue
#define inf 0x3f3f3f3f
#define test cout<<"abcd\n";
#define pi pair<int,int>
#define pii pair<int,pi>
#define pb push_back
#define MOD 1000000007

template <typename T>
void input(vector<T> &arr,lli n) {
  T temp;
  for(lli i=0;i<n;i++) cin>>temp, arr.push_back(temp);
}

template <typename T>
void output(vector<T> arr) {
  for(auto x:arr) cout<<x<<" ";
  cout<<endl;
}


template <typename T>
void input_set(set<T> &arr,lli n) {
  T temp;
  for(lli i=0;i<n;i++) cin>>temp, arr.insert(temp);
}

lli mul(lli a, lli b) {
  return (a%MOD*b%MOD)%MOD;
}

lli power(lli num,lli base) {
  lli ans = 1;
  while(base>0) {
    if(base&1)
      ans = mul(ans, num);

    num = mul(num, num);
    base >>= 1;
  }

  return ans;
}

const int N = 1e6+1;
void solve() {
  int n;
  vector<int> arr;
  cin >> n;
  input(arr, n);
  vector<bool> marked(N, false);
  vector<bool> ans1(n, false), ans2(n, false);
  for(int i=0; i<n; i++) {
    if(marked[arr[i]])
      continue;
    ans1[i] = true;
    for(int x=arr[i]; x<N; x+=arr[i])
      marked[x] = true;
  }

  marked.clear();
  marked.resize(N, false);
  for(int i=n-1; i>=0; i--) {
    if(marked[arr[i]])
      continue;
    ans2[i] = true;
    for(int x=arr[i]; x<N; x+=arr[i])
      marked[x] = true;
  }

  int ans = 0;
  for(int i=0; i<n; i++)
    if(ans1[i] and ans2[i])
      ++ans;

  cout << ans << endl;
}

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

  lli testcases=1;
  while(testcases--) {
    solve();
  }
}



Measured memory_bytes: 4284
n = int(input())
C = [[] for _ in range(n)]
for _ in range(n):
    tmp = list(map(int,input().split()))
    for i in range(1,tmp[1]+1):
        C[tmp[0]].append(tuple(tmp[2*i:2*i+2]))


def dijkstra(start = 0):
    INF = 100000000
    d = [INF]*n
    visited = [False]*n

    d[start] = 0
    visited[start] = True
    S = {start}

    while 1:
        for s in S:
            for adj_weight in C[s]:
                if visited[adj_weight[0]] == False:
                    d[adj_weight[0]] = min(d[s] + adj_weight[1],d[adj_weight[0]])
        
        min_d = INF
        min_node = -1
        for i in range(n):
            if visited[i] == False and d[i] < min_d:
                min_d = d[i]
                min_node = i
        if min_node == -1:
            break
        else:
            visited[min_node] = True
            S.add(min_node)
    return d

ans = dijkstra()
for i in range(n):
    print("{} {}".format(i,ans[i]))


Measured memory_bytes: 5868
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>
#include <utility>
#include <iomanip>

using namespace std;




int main(int argc, char *argv[])
{
	int a, b, c;

	//input
	cin >> a >> b >> c;



	//calc
	int ans = 0;
	int space = a - b;
	if (c < space){
		ans = 0;
	}
	else{
		ans = c - space;
	}


	//ans
	cout << ans << endl;




	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		
		String three = S.substring(2,3);
		String four = S.substring(3,4);
		String five = S.substring(4,5);
		String six = S.substring(5,6);
		
		if(three.equals(four) && five.equals(six)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
#include <iostream>

using namespace std;

#define PRIMENUM 1000100

int isPrime[PRIMENUM];
int primeLine[PRIMENUM];

void makePrimeNumber(){

	isPrime[2]=1;
	isPrime[3]=1;

	for(int i=4;i<PRIMENUM;i++){
		int flag=0;
		for(int j=2;j*j<=i;j++){
			if(i%j==0){
				flag=1;
				break;
			}
		}
		if(flag==0){
			isPrime[i]=1;
			//cout<<i<<endl;
		}	
	}

}

void makePrimeLine(){

	int pos=0;

	for(int i=0;i<PRIMENUM;i++){
		if(isPrime[i]==1){
			primeLine[pos]=i;
			pos++;
		}
	}
}

void swap(int *a,int *b){
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

void babbleSort(int *a,int num){
	for(int i=0;i<num;i++){
		for(int j=num-1;j>i;j--){
			if(a[j]<=a[j-1])swap(&a[j],&a[j-1]);
		}
	}
}

int main(){

	int n,p;
	makePrimeNumber();
	makePrimeLine();

	while(cin>>n>>p){
		if(n==-1&&p==-1)break;

		int *ans;
		ans = new int[500];

		for(int i=0;i<500;i++){
			ans[i]=0;
		}

		//primeLineのnの場所を探索する。
		
		int pos=0;

		//まずどの素数を見るか？
		for(int i=n+1;i<PRIMENUM;i++){
			if(isPrime[i]>0){
				pos=i;
				break;
			}
		}
		//そしてその素数がどこにあるのか。
		for(int i=0;i<PRIMENUM;i++){
			if(primeLine[i]==pos){
				pos=i;
			//	cout<<primeLine[pos]<<endl;
				break;
			}
		}

		int ansPos=0;
		for(int i=pos;i<PRIMENUM;i++){
			int insFlag=0;
			for(int j=pos;j<=i;j++){
				insFlag=0;
				if(insFlag==0){
					ans[ansPos]=primeLine[i]+primeLine[j];
				//	cout<<"i="<<i<<"p["<<i<<"]="<<primeLine[i]<<"j="<<j<<" "<<primeLine[j]<<endl;
					ansPos++;
				}
				if(ans[500-1]>0){
					insFlag=5;
					break;
				}
					
			}
			if(insFlag==5)break;
		}

		babbleSort(ans,500);

		cout<<ans[p-1]<<endl;
	}

	return 0;
}

Measured memory_bytes: 10020
/*MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWO:,'..'xXWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO. .:kOo.,kNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMO. .lNWWo..lXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MNOxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMMMMWKxoloxKWNc  .:xxd;  ,dxxxkXMXkxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMM
MKc''''''''''''''''.  ..'''''.   .''''.  .''MMMWx..,:. .xXo''.  .''.  ..'';kMk;'''''.  .'.''.  .''''''.  ..''.   .''MM
MWNXNNNNNNNNNNNNNNNO' ;KNNNNNKo. cKNNNd. lXNMMMK; ,0Wx. :NWXXl .dNNO' ;KNNNWMWNNNNNXc .kNNNNx. cXNNNNNO' ;KNN0; 'ONNMM
MMMMMMMMMMMMMMMMMWM0' :NMMMMWMX: .OMWWx. oWMMMMWx. ';. .dNMWWo .xMM0' :NWWMMMMMMMMWWl .OMMMWk. lWWMMWM0' ;XMMX: ,KMMMM
MMMMMMWMWkccccccccc;. :NMWNNNKd. :XMMWx. oWMMMWKo. .',. .,ldx; .dMM0' :NMMMMMMMNNWMWl .OMMMWk. lWMMMMM0' ;XMMX: ,0MMMM
MMWXKNWMWxcc,. .;cc;. :XMk,''..'lKWMMWx. oWMNx:. .lONNKxl.     .xMM0' :NMMMMMM0:,oKO' ,KMMMMk. lWWNkoc,. .;::;. ,KMMMM
MMXc.lXMMWWWNd..xWM0' :NM0;  ;kXWMMMWNl  oWMK:.;xXWWMWXx:. ,c' .dMM0' :NMMMMMMKc. ...;kWMMMMk. lWWc .:;. .clc:. ,KMMMM
MWWx. lXMWMMMK, lWM0' :NMMNx'.,ldxxoc'   oWMWNKNWWWN0o' .:kNWo .dMM0' :NMMMMMMMNO;  ,OWWWMMMk. lWM' lXx. lNMMX: ,KMMMM
MMMWk'.,xKNX0c..kWM0' :NMMMMNkl;,'',:l:  oWMMMMMWMWO' 'l0WMWWo .xMM0' :NMMMMMMMMMNd. .oXWMMMk. lWMd.....;0WMMX: ,KMMMM
MMMMWKo'...'..:kWMM0' :NMMMMMMMWWNNWWWx. oWMMMMMMMMWOxXWMWMWWo .xMM0' :NMMMMMMMMMMMKl. ,kNMMk. lWMWKkxx0NMWMMX: ,KMMMM
MMMMMMMN0kxk0XNWMMWKl;xNMMMMMMMMMMMMWM0c;kWMMMMMMMMMMMWWMMMMWk;:OMMXl,dNMMMMMMMMMMMMWO; .dNM0c;kWWMMMMMMMMMMMNd,oXMMMM
MMMMMMMMWWMWMMMMMMMMMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWMMWWMMWMMMMMMMMMMMMMMNkxKWMMWWMMMMMMMMMMMMMMWMMWMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM*/

//             Author: Udit "luctivud" Gupta @ (https://www.linkedin.com/in/udit-gupta-1b7863135/)                  //


#include <bits/stdc++.h>
#pragma GCC optimize "trapv"

using namespace std;

typedef long long int lld;
typedef unsigned long long int llu;

#define         TESTCASES()    cin >> (T3X0); T353 = T3X0; while(T3X0--)
#define         _input(V3C)    for(auto &V3C_I7 : (V3C)) cin >> (V3C_I7)
#define   mems(A77AY, V4LU)    memset((A77AY), (V4LU), sizeof((A77AY)))
#define    CH3K(I7, E4, S7)    (((S7)<0) ? (I7)>(E4) : (I7)<(E4))
#define   for4(I7,S4,E4,S7)    for(auto I7=(S4); CH3K(I7,E4,S7); (I7)+=(S7))



void solveEachTest(lld T35TC453N = 1) {
	int n, m; cin>> n >> m;
    vector<string> arr(n);
    for4(i, 0, n, 1) {
    	cin >> arr[i];
    }

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

    for (auto i : arr) cout << i;
    cout << "\n"; 

    return;
}


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

    lld T3X0 = 0, T353 = 1;

    // TESTCASES() 
        solveEachTest(T353 - T3X0);
    return 0;
}
// Random Thought :  null  

Measured memory_bytes: 3668
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;

#define dbg(x) cerr << #x"=" << x << endl;
typedef long long LL;

int main(){
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    LL ans = 0;
    LL x;
    for(int i = 0; i < n; ++i) {
        cin >> x;
        ans ^= x;
    }
    cout << (ans == 0 ? "Yes" : "No") << endl;
    return 0;
}

/*
an a1 a2 .. . an a1
an^a1^a2 = 0
a1^a2^a3 = 0
*/



Measured memory_bytes: 256
#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(){
  int N,M;
  cin >> N >> M;
  
  if(N <= M){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;
typedef pair<int,ll> P;
typedef vector<P> vip;

void solve(){
    string s;cin>>s;
    map<char,bool>mp;
    mp['N']=false;
    mp['S']=false;
    mp['W']=false;
    mp['E']=false;
    int n=s.size();
    fol(i,n){
        if(!mp[s[i]]) mp[s[i]]=true;
    }
    if(!(mp['N']^mp['S'])&&!(mp['E']^mp['W'])){
        cout << "Yes"<<endl;
    }else{
        cout <<"No"<<endl;
    }
}

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


Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
   	 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
   	 static int a_dist[];
//	 static int mod = 998244353;
	 public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        int N = sc.nextInt();
	        int[] a = new int[N];
	        int[] b = new int[N];
	        int et=0;
	        int ot=0;
	        for (int i=0 ; i<N; i++) {
	        	if(i%2==0) {
		            a[i] = Integer.parseInt(sc.next());
		            et++;
	        	} else {
		            b[i] = Integer.parseInt(sc.next());
		            ot++;
	        	}
	        }
	        Arrays.sort(a);
	        Arrays.sort(b);
	        int[][] ec = new int[N][2];
	        int[][] oc = new int[N][2];
	        int tmp=0;
	        int k=0;
	        for(int i=N-1;a[i]!=0;i--) {
	        	if(tmp!=a[i]) {
	        		ec[k][0]++;
	        		ec[k][1]=a[i];
	        		tmp=a[i];
	        		k++;	
	        	} else {
	        		ec[k-1][0]++;
	        	}
	        }
	        
	        tmp=0;
	        k=0;
	        for(int i=N-1;b[i]!=0;i--) {
	        	if(tmp!=b[i]) {
	        		oc[k][0]++;
	        		oc[k][1]=b[i];
	        		tmp=b[i];
	        		k++;	
	        	} else {
	        		oc[k-1][0]++;
	        	}
	        }
	        long ans=0;
	        Arrays.sort(oc, (d, c) -> Integer.compare(c[0], d[0]));
	        Arrays.sort(ec, (d, c) -> Integer.compare(c[0], d[0]));
	        if(oc[0][1]==ec[0][1]) {
	        	int t=N-oc[0][0]-ec[1][0];
	        	int s=N-oc[1][0]-ec[0][0];
	        	ans=Math.min(t, s);
	        } else {
	        	ans=N-oc[0][0]-ec[0][0];
	        }
	        
	        System.out.println(ans);
  	        	        
	 }

}


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

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

	int ans = 0;
	for (int i = 0; i < 1000; i++) {
		int c[3] = { i / 100,(i / 10) % 10,i % 10 };
		int hit = 0;
		for (int j = 0; j < n; j++) {
			if (s[j] == ('0' + c[hit]))hit++;
			if (hit == 3)break;
		}
		if (hit == 3)ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
// Why I cannot use C++14 ?????

#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
template<typename A, typename B> bool cmin(A &a, const B &b) { if (a > b) { a = b; return true; } else return false; }
 
main {
  int d,e;
  while(cin>>d>>e,d) {
    double c=1000000000;
    rep(i,d+1){
      int x=i,y=d-i;
      cmin(c,abs(sqrt(x*x+y*y)-e));
     }
    cout<<prec(32)<<c<<endl;
  }
  bye;
}

Measured memory_bytes: 3244
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

struct Node {
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;

Node *treeMinimum(Node *x) {
	while (x->left != NIL)x = x->left;
	return x;
}

Node *find(Node *u, int k) {
	while (u != NIL&&k != u->key) {
		if (k < u->key)u = u->left;
		else u = u->right;
	}
	return u;
}

Node *treeSuccessor(Node *x) {
	if (x->right != NIL)return treeMinimum(x->right);
	Node *y = x->parent;
	while (y != NIL&&x == y->right) {
		x = y;
		y = y->parent;
	}
	return y;

}

void treeDelete(Node *z) {
	Node *y;
	Node *x;

	if (z->left == NIL || z->right == NIL)y = z;
	else y = treeSuccessor(z);

	if (y->left != NIL) {
		x = y->left;
	}
	else {
		x = y->right;
	}

	if (x != NIL) {
		x->parent = y->parent;
	}
	if (y->parent == NIL) {
		root = x;
	}
	else {
		if (y == y->parent->left) {
			y->parent->left = x;
		}
		else {
			y->parent->right = x;
		}
	}

	if (y != z) {
		z->key = y->key;
	}

	free(y);
}


void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node *)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL) {
		y = x;
		if (z->key < x->key) {
			x = x->left;
		}
		else {
			x = x->right;
		}
	}

	z->parent = y;
	if (y == NIL) {
		root = z;
	}
	else {
		if (z->key < y->key) {
			y->left = z;
		}
		else {
			y->right = z;
		}
	}
}

void inorder(Node *u) {
	if (u == NIL)return;
	inorder(u->left);
	printf(" %d", u->key);
	inorder(u->right);
}
void preorder(Node *u) {
	if (u == NIL)return;
	printf(" %d", u->key);
	preorder(u->left);
	preorder(u->right);
}

int main() {
	int n, i, x;
	string com;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		cin >> com;
		if (com[0] == 'f') {
			scanf("%d", &x);
			Node *t = find(root, x);
			if (t != NIL)printf("yes\n");
			else printf("no\n");
		}
		else if (com == "insert") {
			scanf("%d", &x);
			insert(x);
		}
		else if (com == "print") {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
		else if (com == "delete") {
			scanf("%d", &x);
			treeDelete(find(root, x));
		}
	}

	return 0;
}


Measured memory_bytes: 21944
#include <stdio.h>
int main(){
    int test,i,sum=0;
    scanf("%d",&test);
    i=test;
    while(test){
        sum+=test%10;
        test/=10;
    }
    if(i%sum==0) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 128
import sys
s = input()
k = int(input())
n = len(s)
all_same = True
for i in range(n-1):
    if s[i] != s[i+1]:
        all_same = False
if all_same:
    print((n*k)//2)
    sys.exit()
head_same = 1
for i in range(n-1):
    if s[i] == s[i+1]:
        head_same += 1
    else:
        break
tail_same = 1
for i in range(n-1,0,-1):
    if s[i] == s[i-1]:
        tail_same += 1
    else:
        break
head_tail_same = 0
if s[0] == s[-1]:
    head_tail_same = head_same + tail_same
def return_internal_same(ls):
    i = 0
    same_count = 1
    return_value = 0
    while i < len(ls)-1:
        if ls[i] != ls[i+1]:
            i += 1
            return_value += same_count // 2
            same_count = 1
            continue
        else:
            same_count += 1
            i += 1
    return_value += same_count // 2
    return return_value
# head_tial_sameがあるかどうかで場合わけ
if head_tail_same > 0:
    ans = head_same//2 + tail_same//2
    ans += (k-1) * (head_tail_same//2)
    ans += k*(return_internal_same(s[head_same:n-tail_same]))
else:
    ans = k*(head_same//2 + tail_same//2)
    ans += (k-1) * (head_tail_same//2)
    ans += k*(return_internal_same(s[head_same:n-tail_same]))
print(ans)

Measured memory_bytes: 9312
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
 
using namespace std;
 
struct Point{
    double x,y;
};
 
int main(){
 
    int n,m,checkTable[101],path[101],id,start,goal,count,min_index;
    double distance[101][101],x,y,calc[101][101],min_value;
    bool canGO[101];
    Point table[101];
    stack<int> S;
 
    while(true){
        scanf("%d",&n);
        if(n == 0)break;
 
        for(int i=1; i <= n; i++){
            scanf("%d %lf %lf",&id,&x,&y);
            table[id].x = x;
            table[id].y = y;
        }
 
        for(int i = 1; i <= n; i++){
            for(int k = 1; k <= n; k++){
                distance[i][k] = sqrt((table[i].x-table[k].x)*(table[i].x-table[k].x)+(table[i].y-table[k].y)*(table[i].y-table[k].y));
            }
        }
 
        scanf("%d",&m);
 
        for(int i = 1; i <= m; i++){
            scanf("%d %d",&start,&goal);
 
            for(int k = 1; k <= n; k++){
                checkTable[k] = 0;
                if(distance[start][k] < 50 || fabs(distance[start][k] - 50) < 0.00000001){
                    canGO[k] = true;
                }else{
                    canGO[k] = false;
                }
                path[k] = start;
                for(int p = 1; p <= n; p++)calc[k][p] = distance[k][p];
            }
 
            count = 1;
            checkTable[start] = 1;
 
            while(count < n){
                min_value = 1000000000;
 
                for(int k = 1; k <= n; k++){
                    if(checkTable[k] == 0 && canGO[k] == true && calc[start][k] < min_value){
                        min_value = calc[start][k];
                        min_index = k;
                    }
                }
 
                if(min_value == 1000000000)break;
 
                checkTable[min_index] = 1;
                count++;
 
                for(int p = 1; p <= n; p++){
                    if((canGO[p] == false || calc[start][p] > calc[start][min_index]+calc[min_index][p]) && (distance[min_index][p] < 50 || fabs(distance[min_index][p] - 50) < 0.00000001)){
                        calc[start][p] = calc[start][min_index]+calc[min_index][p];
                        canGO[p] = true;
                        path[p] = min_index;
                    }
                }
            }
 
            if(canGO[goal] == false)printf("NA\n");
            else{
                int t = goal;
                while(true){
                    S.push(t);
                    t = path[t];
                    if(t == start)break;
                }
                printf("%d",start);
                while(!S.empty()){
                    printf(" %d",S.top());
                    S.pop();
                }
                printf("\n");
            }
        }
    }
 
 
    return 0;
}


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

#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 repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i,a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
ll mod = static_cast<ll>(1e9 + 7);
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class A, int N, class T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

int n;
int a[1000005];
int f(int div) {
    int ans = 0;
    rep(i, n) {
        if (a[i] / div != 1) continue;
        int res = 0, res2 = 0;
        int tmp = n - 1;
        while (tmp != 0) {
            if ((tmp & 1) == 1) ++res;
            tmp >>= 1;
        }
        tmp = n - i - 1;
        while (tmp != 0) {
            if ((tmp & 1) == 1) ++res2;
            tmp >>= 1;
        }
        tmp = i;
        while (tmp != 0) {
            if ((tmp & 1) == 1) ++res2;
            tmp >>= 1;
        }

        if (res == res2) ans ^= 1;
    }
    return ans;
}

void solve() {
    cin >> n;
    rep(i, n) {
        char c;
        cin >> c;
        a[i] = c - '0' - 1;
    }

    int ans = f(1);
    if (ans == 1) {
        cout << 1 << endl;
        return;
    }

    bool ok = false;
    rep(i, n) if (a[i] == 1) { ok = true; break; }
    if (ok) {
        cout << 0 << endl;
        return;
    }

    ans = f(2);
    if (ans == 1) {
        cout << 2 << endl;
        return;
    }

    cout << 0 << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


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

ll dp[101][100001];
ll dir[101][100001];
ll weight[101]={0};
ll cost[101]={0};
ll n,cap; //n=total element, cap=capacity


ll knapsack(ll i,ll w)
{
    ll profit=0,profit1=0,profit2=0;
    if(i==n)
        return 0;
    if(dp[i][w]!=-1) return dp[i][w];

    if(w+weight[i]<=cap)
    {
        profit1=cost[i]+knapsack(i+1,w+weight[i]);
    }
    else profit1=0;
    profit2=knapsack(i+1,w);

    if(profit1>=profit2)
    {
        return dp[i][w]=profit1;

    }
    else
    {
        return dp[i][w]=profit2;
    }
    //cout<<profit<<endl;
    //return dp[i][w]=profit;
}

int main()
{
    int i,j,k;
    memset(dp,-1,sizeof dp);
    memset(dir,-1,sizeof dir);

    cin>>n>>cap;
    for(i=0;i<n;i++)
        cin>>weight[i]>>cost[i];
    cout<<knapsack(0,0)<<endl;

    return 0;
}


Measured memory_bytes: 158080
#include <cstdio>
int main(){
  int i, j, H, W;
  for (; ;) {
    scanf("%d %d", &H, &W);
    if (H==0 && W==0) break;
    char s1[W+1];
    char s2[W+1];
    for (i=0; i<W; i++) {
      if (i%2==0) {
        s1[i]='#';
        s2[i]='.';
      } else {
        s1[i]='.';
        s2[i]='#';
      }
    }
    s1[i]='\0';
    s2[i]='\0';

    for (i=0; i<H; i++) {
      if (i%2==0) printf("%s\n", s1);
      else printf("%s\n", s2);
    }
    printf("\n");
  }
}


Measured memory_bytes: 2696
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,k,ans=inf; cin>>n>>k;
    vector<int> h(n,0);
    rep(i,n) cin>>h[i];
    sort(al(h));
    rep(i,n-k+1){
        ans=min(ans,h[i+k-1]-h[i]);
    }
    cout<<ans<<endl;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> a(H);
	for (int i = 0; i < H; i++) {
		cin >> a[i];
	}
  
  vector<bool> row(H, false);
  vector<bool> col(W, false);
  
  for(int i = 0 ; i < H ; i++) {
  	for(int j = 0 ; j < W ; j++) {
      if(a[i][j] == '#'){
      	row[i] = true;
        col[j] = true;
      }
    }
  }
  
  for(int i = 0 ; i < H ; i++) {
    if(row[i]) {
      for(int j = 0 ; j < W ; j++) {
        if(col[j]) { 
          cout << a[i][j];
        }
      }
      cout << endl;
    }
  }
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <complex>
#include <cstdio>

#define pb push_back
#define fs first
#define sc second
#define sz size()
using namespace std;

typedef double D;
typedef complex<D> P;
typedef pair<P, P> L;
typedef pair<P, D> C;
typedef vector<P> Poly;
const D EPS=1e-12;


namespace std{
  bool operator<(const P &a, const P &b){
    return real(a)==real(b)?imag(a)<imag(b):real(a)<real(b);
  }
}

P unit(P p){ return p / abs(p);}

D dot(P x, P y){return real(conj(x)*y);}

D cross(P x, P y){return imag(conj(x)*y);}

P rotate(P v, double s){
  return P(real(v)*cos(s) - imag(v) * sin(s), real(v)*sin(s) + imag(v) * cos(s));
}

D arg(P a, P b, P c){ return acos(dot(b-a, c-a)/(abs(b-a)*abs(c-a)));}
D arg(D a, D b, D c){return acos((b*b+c*c-a*a)/(2*b*c));}

int ccw(P a, P b, P c){
  b -= a; c -= a;
  if(cross(b, c) > EPS) return 1;
  if(cross(b, c) < -EPS) return -1;
  if(dot(b, c) < -EPS) return 2;
  if(abs(b) < abs(c)) return -2;
  return 0;
}

bool para(L a, L b){return abs(cross(a.fs - a.sc, b.fs-b.sc))<EPS;}

vector<P> cp_cir_to_cir(C a, C b){
  vector<P> v;
  D s = arg(b.sc, abs(b.fs -a.fs), a.sc);
  P x = a.sc * unit(b.fs - a.fs);
  v.pb(a.fs + rotate(x, s));
  v.pb(a.fs + rotate(x, -s));
  return v;
}

D area(Poly p){
  if(p.sz<3) return 0;
  D res = cross(p[p.sz-1],p[0]);
  for(int i=1;i<p.sz;i++) res += cross(p[i-1], p[i]);
  return res/2;
}

int main(){
  vector<P> v;
  D x, y;
  while(~scanf("%lf,%lf\n", &x, &y)){
    v.pb(P(x, y));
  }
  printf("%.10lf\n", area(v));
  
  return 0;
}





Measured memory_bytes: 3140