akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MAX (int)1e9 + 99
#define maxof(a,b,c) max(a,max(b,c))
#define minof(a,b,c) min(a,min(b,c))
#define vi vector<int>
#define vb vector<bool>
#define ll long long
#define ull unsigned long long
#define vll vector<ll>
#define pa pair<int, int>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define MOD 1000000007
#define bitcnt(x) __builtin_popcount(x)
#define gcd(a,b) __gcd(a,b)
#define all(x) (x).begin(),(x).end()
#define ts(x) to_string(x)
#define set0(x) memset(x, 0, sizeof(x))
const double pi = 3.14159265358979323846;
template<class T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is;}
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) {if (!v.empty()) {os << v.front();for (int i = 1; i < v.size(); ++i) os << ' ' << v[i];} return os;}
const int N=301;

double p[N][N][N];
double v[N][N][N];

void solve()
{
    int n;
    cin>>n;
    int x;
    vi cnt(4,0);
    rep(i,n)
    {
        cin>>x;
        cnt[x]++;
    }

    p[cnt[1]][cnt[2]][cnt[3]] = 1.0;
    for(int z = n; z>=0;z--)
    {
        for(int y= n; y>=0; y--)
        {
            for(int x = n; x>=0; x--)
            {
                if(x==0 && y==0 && z==0)
                    continue;

                if(x+y+z > n) 
                    continue;

                double p_zero = (double)(n-(x+y+z))/n;

                //no of events where we take to reach a valid choice 1 + 1*p_zero+ 1*p_zero^2+...
                double event_number = 1/(1-p_zero);

                v[x][y][z] += event_number * p[x][y][z];


                //if we remove a sushi from a plate with 1 sushi 
                if(x)
                {
                    double p_this = (double)x/(x+y+z);
                    p[x-1][y][z] += p[x][y][z] * p_this;
                    v[x-1][y][z] += v[x][y][z] * p_this;
                }

                //if we remove a sushi from a plate with 2 sushi...no of 2 sushi plates decreases by 1, no of 1 sushi plates increases by 1
                if(y)
                {
                    double p_this = (double)y/(x+y+z);
                    p[x+1][y-1][z] += p[x][y][z] * p_this;
                    v[x+1][y-1][z] += v[x][y][z] * p_this; 
                }

                //if we remove a sushi from a plate with 3 sushi...no of 3 sushi plates decreases by 1, no of 2 sushi plates increases by 1
                if(z)
                {
                    double p_this = (double)z/(x+y+z);
                    p[x][y+1][z-1] += p[x][y][z] * p_this;
                    v[x][y+1][z-1] += v[x][y][z] * p_this; 
                }
            }
        }
    }


    cout<<fixed<<setprecision(10)<<v[0][0][0];

}

int main()
{
    fastio;
    
    int t=1;
    
    rep(i,t)
    {
        solve();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 218608
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
typedef pair<int, int> P;
bool can[1000][1000];
bool ans[200000];
bool reach[200000];
vector<P> G[200000];
bool vis[1000];
void dfs(int s, int v) {
	can[s][v] = 1;
	for (P e : G[v]) {
		if (!can[s][e.first]) {
			dfs(s, e.first);
		}
	}
}
void dfs2(int v) {
	vis[v] = 1;
	for (P e : G[v]) {
		if (!vis[e.first]) {
			dfs2(e.first);
		}
	}
}
int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].emplace_back(b, i);
	}
	for (int i = 0; i < N; i++) dfs(i, i);
	for (int i = 0; i < N; i++) {
		vector<P> edge = G[i];
		G[i].clear();
		memset(vis, 0, sizeof(vis));
		for (P e : edge) {
			if (vis[e.first]) reach[e.second] = 1;
			G[i].push_back(e);
			dfs2(i);
		}
		reverse(edge.begin(), edge.end());
		G[i].clear();
		memset(vis, 0, sizeof(vis));
		for (P e : edge) {
			if (vis[e.first]) reach[e.second] = 1;
			G[i].push_back(e);
			dfs2(i);
		}
		for (P e : edge) {
			if (can[e.first][i] == reach[e.second]) ans[e.second] = 1;
		}
	}
	for (int i = 0; i < M; i++) {
		if (ans[i]) cout << "same" << endl;
		else cout << "diff" << endl;
	}
}

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

int main(void) {
    long long n, w;
    cin >> n >> w;

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

    vector<long long> kek(w + 1);

    for (int i = 1; i <= n; ++i)
    for (int j = w; j >= weight[i - 1]; --j) {
        kek[j] = max(kek[j], value[i - 1] + kek[j - weight[i - 1]]);
    }

    cout << kek[w] << endl;
}


Measured memory_bytes: 4032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

ll N, pw[60], A, res, c[60];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A;
		for (int j = 0; j < 60; j++) {
			c[j] += (1 & (A >> j));
		}
	}
	pw[0] = 1;
	for (int i = 1; i < 60; i++) {
		pw[i] = pw[i - 1] * 2 % mod;
	}
	for (int i = 0; i < 60; i++) {
		res += c[i] * (N - c[i]) % mod*pw[i];
		res %= mod;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define lld long long double
#define pb push_back
#define mp make_pair
#define M 1000000007
using namespace std;

ll dp[3001][3001][2];

ll f(ll a[], ll i, ll j, bool turn) {
	if (i > j) return 0;
	if (dp[i][j][turn] != -1) return dp[i][j][turn];
	if (turn == 1) {
		return dp[i][j][turn] = max(a[i] + f(a, i + 1, j, 0), a[j] + f(a, i, j - 1, 0));
	}
	else {
		return dp[i][j][turn] = min(f(a, i + 1, j, 1), f(a, i, j - 1, 1));
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	ll n; cin >> n;
	ll a[n];
	memset(dp, -1, sizeof(dp));
	ll sum = 0;
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	ll sum1 = f(a, 0, n - 1, 1);
	ll sum2 = sum - sum1;
	cout << sum1 - sum2;
	return 0;
}

Measured memory_bytes: 141312
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
using namespace std;
//
const int inf=1e9+7;//0x3f
//
int get(int x){
	cout<<x<<endl;
	string S;
	cin>>S;
	if(S[0]=='V'){
		exit(0);
	}else{
		return S[0]=='F'?1:-1;
	}
}
int main(){
	int N;
	cin>>N;
	if(N<=20){
		for(int i=0;i<N;i++){
			cout<<i<<endl;
			string S;
			cin>>S;
			if(S=="Vacant"){
				return 0;
			}
		}
	}else{
		int l=0,r=N;
		int s=get(0),t=s;
		while(1){
			int m=(l+r)/2;
			int g=get(m);
			if((m-l)%2==0&&s==g){
				l=m;s=g;
			}else if((m-l)%2==0&&s!=g){
				r=m;t=g;
			}else if((m-l)%2==1&&s!=g){
				l=m;s=g;
			}else{
				r=m;t=g;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 852
#include<bits/stdc++.h>
#define ll long long
using namespace std;
// ll dp[100005];
// ll func(ll arr[] , ll n ,  ll ans,ll i){


// 	if(i<n && dp[i]!=0)
// 		return dp[i];

// 	if(i>n-2)
// 	{
// 		return ans;
// 	}
// 	dp[i]=min(ans+abs(arr[i]-arr[i+1]) ,ans+abs(arr[i]-arr[i+2]));
// 	return min(func(arr,n, ans+abs(arr[i]-arr[i+1]),i+1) ,func(arr,n,ans+abs(arr[i]-arr[i+2]),i+2));	
 
// }
int main()
{
	
  	// cout<<"hello";
  	ll n , i ,k,j;
  	cin>>n>>k;
  	ll arr[n];
  	for(i=0;i<n;i++)
  		cin>>arr[i];
  
  	ll dp[n];
  	for(i=0;i<n;i++)
  		dp[i]=LLONG_MAX;
  	dp[0]=0;
  	for(i=1;i<n;i++){
  		if(i-k>=0)
  			j=i-k;
  		else
  			j=0;
  		for(;j<i;j++)
  		dp[i]=min(dp[i] , dp[j] +abs(arr[i]-arr[j]));
  	}
  	cout<<dp[n-1];
  	return 0;
  	
}

Measured memory_bytes: 5008
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC053A___ABC_ARC
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int score = int.Parse(input);

            string output = "ARC";

            if (score < 1200)
            {
                output = "ABC";
            }

            Console.WriteLine(output);


        }
    }
}


Measured memory_bytes: 13140
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef pair<P,P> Edge;
typedef long long ll;

const double PI=4*atan(1.0);

void fast_stream(){
	std::ios_base::sync_with_stdio(0);
}

//#define RED_FILE

#ifdef RED_FILE
ifstream ifs("input.txt");
ofstream ofs("output.txt");
#define cin ifs
#define cout ofs
#endif

int n;
struct info{
	int t,c;
};
info infos[1001];

int main(){
	while(cin>>n&&n!=0){
		vector<pair<int,int> > forward;
		vector<pair<int,int> > back;
		vector<pair<int,int> > tmp;
		for(int i=0;i<n;i++){
			int t,c;
			cin>>t>>c;
			infos[i].t=t;
			infos[i].c=c*2;
			tmp.push_back(make_pair(t,i));
			// »ÝÌoßbÆÔði[
		}
		sort(tmp.begin(),tmp.end());
		// tª¬³¢ÔÉ\[gµÄ¨­
		for(int i = 0; i < n; i++){
			forward.push_back(make_pair(0,tmp[i].second));
		}
		int res=0;
		while(forward.size()!=0||back.size()!=0){
			// forwardÆbackÅAÌCxgª¢ûðÀs(¯ÈçÇ¿çàÀs)
			const int INF=1000000000;
			int fet=INF;
			int bet=INF;
			if(forward.size()!=0){
				int idx=forward[0].second;
				// forwardÅàÁÆàæªÌvfª·é
				fet=abs(infos[idx].t-forward[0].first);
			}
			if(back.size()!=0){
				int idx=back[0].second;
				//backÅàÁÆàæªÌvfª·é
				bet=abs(infos[idx].t-back[0].first);
			}
			int tm=min(fet,bet);
			res+=tm;
			// tmª¾¯SÌÔðißÄ¨­
			for(int i = 0; i < forward.size(); i++)
				forward[i].first+=tm;
			for(int i = 0; i < back.size(); i++)
				back[i].first+=tm;
			// forwardÌÙ¤ª¢
			vector<pair<int,int> > nf;
			vector<pair<int,int> > nb;
			// ðð½·vfðæª©çæè¢Ä¢­
			while(forward.size()){
				int idx=forward[0].second;
				// ðð½·
				if(forward[0].first>=infos[idx].t){
					nf.push_back(make_pair(infos[idx].t,idx));
					infos[idx].c--;
					forward.erase(forward.begin());
				}
				else
					break;
			}
			while(back.size()){
				int idx=back[0].second;
				// ðð½·
				if(back[0].first>=infos[idx].t){
					if(infos[idx].c!=1)
						nb.push_back(make_pair(infos[idx].t,idx));
					infos[idx].c--;
					back.erase(back.begin());
				}
				else
					break;
			}
			// ðð½µ½àÌð\[gµAi[
			sort(nf.begin(),nf.end());
			sort(nb.begin(),nb.end());
			for(int i = 0; i < nf.size(); i++)
				back.push_back(make_pair(0,nf[i].second));
			for(int i = 0; i < nb.size(); i++)
				forward.push_back(make_pair(0,nb[i].second));
		}
		cout<<res<<endl;
	}

	return 0;
}

Measured memory_bytes: 916
#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
double dist(ll x, ll y){
   return sqrt(x * x + y * y);
}
int main() {
	int n;
	ll d;
	cin >> n >> d;
	int cnt = 0;
	while(n--) {
         ll x, y;
         cin >> x >> y;
         if(dist(x, y) <= d)
         	++cnt;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3696
#include<bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

int main(){
	ll n, i, e, k, j, ans, isl, d;
	
	cin>>n;
	
	vector <pair <ll, ll> > b(n+1);
	vector <bool> sink(n+2);
	
	b[0].first=0;
	b[0].second=0;
	sink[0]=true;
	isl=0;
	for(i=1; i<=n; i++){
		cin>>b[i].first;
		b[i].second=i;
		sink[i]=false;
		if(b[i].first>0) isl=1;
	}
	sink[n+1]=true;
	
	sort(b.begin(), b.end());
	
	ans=0;
	for(i=1;i<b.size();i++){
		if(b[i].first!=b[i-1].first) ans=max(ans, isl);
		d=b[i].second;
		sink[d]=true;
		if(sink[d-1]+sink[d+1]==0) isl++;
			else if(sink[d+1]+sink[d-1]==2) isl--;
	}
	
	cout<<max(ans, isl)<<"\n";
}


Measured memory_bytes: 4432
#include<iostream>
#include<string.h>

using namespace std;

int main() {
	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;
	int more = X >= Y ? X : Y;
	int ans = C * 200000;
	for (int i = 0; i <= more * 2; i += 2) {
		int tmp = 0;
		int num_A = X - i / 2;
		int num_B = Y - i / 2;
		tmp += C * i;
		if (num_A > 0)tmp += A * num_A;
		if (num_B > 0)tmp += B * num_B;
		if (tmp < ans)ans = tmp;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
	char c;
	cin >> c;
	cout << (char)(c + 1) << endl;
}


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

using namespace std;

int main(void)
{
  	string str;
  	getline(cin,str);
  	for(int i = 0 ; i < str.size() ; i++)
    {
      if('a' <= str.at(i) && str.at(i) <= 'z')     str.at(i) -= 32;
      else if('A' <= str.at(i) && str.at(i) <= 'Z')str.at(i) += 32;
    }
    
    cout << str << endl;
    
    return 0;
}


Measured memory_bytes: 3220
import sys
input = sys.stdin.readline

class Node:
    def __init__(self):
        self.parent = -1
        self.left = -1
        self.right = -1
        self.sibling = -1
        self.typ = "leaf"
        self.degree = 0

def getDepth(G, v, d=0):
    G[v].depth = d
    if G[v].right != -1:
        getDepth(G, G[v].right, d+1)
    if G[v].left != -1:
        getDepth(G, G[v].left, d+1)

def getHeight(G, v):
    h1, h2 = 0, 0
    if G[v].right != -1:
        getHeight(G, G[v].right)
        h1 = G[G[v].right].height + 1
    if G[v].left != -1:
        getHeight(G, G[v].left)
        h2 = G[G[v].left].height + 1
    G[v].height = max(h1, h2)

def main():
    n = int(input())
    G = [Node() for _ in range(n)]
    for _ in range(n):
        idx, l, r = map(int, input().split())
        G[idx].left = l
        G[idx].right = r
        if l != -1:
            G[l].parent = idx
            G[idx].typ = "internal node"
            G[idx].degree += 1
        if r != -1:
            G[r].parent = idx
            G[idx].typ = "internal node"
            G[idx].degree += 1
        if l != -1 and r != -1:
            G[l].sibling = r
            G[r].sibling = l
    root = [i for i, x in enumerate(G) if x.parent == -1][0]
    G[root].typ = 'root'
    getDepth(G, root)
    getHeight(G, root)
    for i, x in enumerate(G):
        print('node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}'.format(i, x.parent, x.sibling, x.degree, x.depth, x.height, x.typ))

if __name__ == '__main__': main()


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

int main() {
  string s, t;
  cin >> s >> t;
  int count = 0;
  for(int i = 0; i < s.size(); i++) {
    if(s.at(i) != t.at(i)) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 3848
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
 
int main() {
  long long N,M;
	cin>>N>>M;
	if(N==M)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

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

using namespace std;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

typedef long long  ll;
#define endl '\n'


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


const int MOD = 1000000007;



int main() {

  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;

  cin >> n;

  cout << n * n * n << endl;




}



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

bool isHaiku(int a, int b, int c) {
  int five = 0;
  int seven = 0;

  if (a == 5) {
      ++five;
      if (b == 5) {
        ++five;
        if (c == 7) {
            ++seven;
        }
      } else if (b == 7) {
        ++seven;
        if (c == 5) {
            ++five;
        }
      }
  } else if (a == 7) {
      ++seven;
      if (b == 5) {
        ++five;
        if (c == 5) {
            ++five;
        }
      }
  }

    if (five == 2 && seven == 1) {
        return true;
    } 

    return false;
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    bool isHai = isHaiku(a, b, c);
    if (isHai) {
        cout << "YES" << endl;

    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
//初めてのc!!

int main(void){

int a,b,c;

scanf("%d%d%d",&a,&b,&c);

    if(a-b>=c){
        printf("%d",0);
    }else{
        printf("%d",c-(a-b));
    }

    return 0;
}

Measured memory_bytes: 128
A,B,K=map(int,input().split())
if (B-A+1)<=2*K:
	for I in range(A,B+1):
		print(I)
else:
	for I in range(A,A+K):
		print(I)
	for J in range(B-K+1,B+1):
		print(J)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
   #define PP pair<int,pair<int,int>>
const int MAX = 1000001;
const int MOD =1000000007;
const int INV2 = (MOD+1)/2;



     signed main(){
int n,k;
cin>>n>>k;
int a[n];
for(int i=0;i<n;i++){
  cin>>a[i];a[i]--;
}
int t[n];fill(t,t+n,-1);
int b=0,c=0;vector<int> v;
while(t[b]==-1){
  t[b]=c;
  v.push_back(b);
  b=a[b];
  
  c++;
}
if(k<=t[b])cout<<v[k]+1<<endl;
else{
  cout<<v[t[b]+(k-t[b])%(c-t[b])]+1<<endl;
}





}


        


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    ll t = N / 25;
    ll ans = t;
    N -= 25 * t;
    t = N / 10;
    ans += t;
    N -= 10 * t;
    t = N / 5;
    ans += t;
    N -= 5 * t;
    ans += N;
    cout << ans << '\n';
}

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



Measured memory_bytes: 3232
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
mark = [[False, False, False] for _ in range(3)]
for i in range(3):
    for j in range(3):
        if a[i][j] in b:mark[i][j] = True

ans = 'No'
for i in range(3):
    if all(mark[i]):
        ans = 'Yes'
        break      
for j in range(3):
    if mark[0][j] and mark[1][j] and mark[2][j]:
        ans = 'Yes'
        break
if (mark[0][0] and mark[1][1] and mark[2][2]) or (mark[0][2] and mark[1][1] and mark[2][0]): ans = 'Yes'
print(ans)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x

using namespace std;

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    std::ios::sync_with_stdio(false);
    string s1,s2;
    cin>>s1>>s2;
    int cnt = 0;
    for(int i=0;i<s1.size();i++){
        if(s1[i]!=s2[i]) cnt++;
    }
    cout<<cnt;
}

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


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

void putC(int time, char c) {
	loop(time)cout << c;
}

int main() {

	int sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;

	//s→t 上　右

	putC(ty - sy, 'U');
	putC(tx - sx, 'R');

	putC(ty - sy, 'D');
	putC(tx - sx, 'L');

	putC(1, 'L');
	putC(ty - sy+1, 'U');
	putC(tx - sx+1, 'R');
	putC(1, 'D');

	putC(1, 'R');
	putC(ty - sy + 1, 'D');
	putC(tx - sx + 1, 'L');
	putC(1, 'U');


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll t,a,b,i,j,k,n,x;
    vector<ll>v;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>k;
        v.push_back(k);
    }
    ll mn=1000000000;
    for(i=-100;i<=100;i++)
    {
        ll sum=0;
        for(j=0;j<n;j++)
        {
           sum+=(i-v[j])*(i-v[j]);
        }
        mn=min(mn,sum);
    }
    cout<<mn<<endl;
    return 0;
}


Measured memory_bytes: 3564
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){

  //if(x->left == NIL) return x;

}

Node treeMaximum(Node x){


}

Node treeSearch(Node x, int k){
  if(x == NIL || k == x->key) return x;
  if(k < x->key) return treeSearch(x->left, k);
  else return treeSearch(x->right, k);

}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

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

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  //z->parent = 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;
  char com[20];
  scanf("%d", &n);

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

  return 0;
}

Measured memory_bytes: 19364
def binary_search target_array, value
  right = target_array.size
  left = 0
  while right > left
    mid = (right + left) / 2
    return 1 if target_array[mid] == value
    if value < target_array[mid]
      right = mid
    else
      left = mid + 1
    end
  end
  0
end

gets.to_i
s = gets.chomp.split(' ').map(&:to_i)
gets.to_i
t = gets.chomp.split(' ').map(&:to_i)
count = 0
t.each do |value|
  count += binary_search s, value
end
puts count


Measured memory_bytes: 15632
x,k,d=map(int,input().split())
def sign(x):
    if x> 0:return 1
    elif x<0 :return -1
    return 0

if x>0:
    x_distance = x - k*d
else:
    x_distance = x + k*d

if sign(x)==sign(x_distance):
    print(abs(x_distance))
    exit()

x_r= x_distance % d
x_l=x_r -d
kairi=(abs(x-x_r)//d) %2

if k%2==kairi:
    print(abs(x_r))
else:print(abs(x_l))






Measured memory_bytes: 9228
#!usr/bim/python
#! -*- coding: utf-8 -*-

n = raw_input()
n = int(n)

b2 = 2
b1 = 1

if n == 1:
    a = 1
else:
    for i in range(n-1):
        a = b1 + b2
        b2 = b1
        b1 = a
        #print i+2, a

print a


Measured memory_bytes: 2568
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int N,K;
  cin >> N >> K;
  vector<int> A(N);
  REP(i, N) cin >> A[i];
  
  int MIN = INF;
  REP(i,N-K+1){
    if(A[i]<0&&A[i+K-1]<=0){
      MIN=min(MIN,-A[i]);
    }else if(A[i]<0&&A[i+K-1]>0&&A[i+K-1]<=-A[i]){
      MIN=min(MIN,A[i+K-1]*2-A[i]);
    }else if(A[i]<0&&A[i+K-1]>0&&A[i+K-1]>A[i]){
      MIN=min(MIN,-A[i]*2+A[i+K-1]);
    }else if(A[i]>=0&&A[i+K-1]>=0){
      MIN=min(MIN,A[i+K-1]);
    }
  }

  cout << MIN << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
	using namespace std;
	int counter[3011];
	int main(){
		#define int long long
		ios_base::sync_with_stdio(false);
		cin.tie(0);	
		int a;
		cin>>a;
		char b;
		bool three=true;
		while(a--){
			cin>>b;
			if (b=='Y'){
				three=false;
			}
		}
		if (three){
			cout<<"Three";
		}
		else{
			cout<<"Four";
		}
		
		return 0;
	}

Measured memory_bytes: 256
n, m = map(int, input().split())
lst = [[] for _ in range(n)]
dist = [0 for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    lst[a].append(b)
    dist[a] = b
    lst[b].append(a)
    
from collections import deque

visited = [float('inf')] * n

def bfs(x):
    global visited
    queue = deque()
    queue.append(x)
    visited[x] = 0
    while queue:
        now = queue.popleft()
        for _ in lst[now]:
            if visited[_] > visited[now] + 1:
                visited[_] = visited[now] + 1
                queue.append(_)

bfs(0)

ans = []
for i in range(1, n):
    flg = 0
    for _ in lst[i]:
        if visited[i] - visited[_] == 1:
            ans.append(_+1)
            flg = 1
            break
    if not flg:
        break
        
if flg:
    print('Yes')
    for _ in ans:
        print(_)
else:
    print('No')

Measured memory_bytes: 38568
#include <bits/stdc++.h>
using namespace std;
int h , w;
long long mem[1005][1005];
char grid[1005][1005];
int main() {
	cin>>h>>w;
	for(int i = 0; i< h ; i++){
		for(int j= 0 ; j < w; j++)
			cin>>grid[i][j];
	}
	if(grid[0][0]=='.'){
		mem[0][0] = 1;
		mem[0][1] = 1;
	}
	long long mod = 1e9+7;
	for(int i = 0; i < h ; i++){
		for(int j = 0; j < w ; j++){
			if(grid[i][j]=='#')continue;
			mem[i+1][j+1] = (mem[i+1][j] + mem[i][j+1])%mod;
		}
	}
	cout<<mem[h][w];
	return 0;
}


Measured memory_bytes: 9088
#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(){
	string S;
	cin >> S;
	if(S=="keyence"){
		cout << "YES" << endl;
		return 0;
	}
	bool flag = false;
	REP(i, S.size()){
		REP(j, S.size()){
			if(j<i) continue;
			string T = "";
			REP(k, S.size()){
				if(k<i||k>j) T += S[k];
			}
			if(T=="keyence") flag = true;
			//dump(i)
			//dump(j)
			//dump(T)
			//cout << endl;
		}
	}
	cout << (flag?"YES":"NO") << endl;
    return 0;
}

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N+1);
    vector<int> B(N+1);

    for (int i = 1; i <= N; i++)
    {
        cin >> A[i];
        B[A[i]] = i;
    }

    for (int i = 1; i <= N; i++)
    {
        cout << B[i] << " ";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 1664
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

#[allow(unused_macros)]
macro_rules! vec_md {
    ( $ init : expr ; $ ( $ dim : expr ) ;* ) => { vec_md ! ( $ ( $ dim ) ;* => $ init ) };
    ( $ head : expr ; $ ( $ tail : expr ) ;* => $ init : expr ) => { vec ! [ vec_md ! ( $ ( $ tail ) ;* => $ init ) ; $ head ] };
    ( $ head : expr => $ init : expr ) => { vec ! [ $ init ; $ head ] };
}

#[allow(dead_code)]
pub const M: u64 = 1_000_000_007;

fn main() {
    input! {
        k: chars,
        d: usize
    }

    let mut dp = vec_md![0u64;k.len()+1;d;2];
    dp[0][0][0] = 1;
    for i in 0..k.len() {
        for z in 0..d {
            for less in 0..2 {
                let ki_digit = (k[i] as u8 - b'0') as usize;
                for j in if less == 1 {0..10} else {0..ki_digit+1} {
                    dp[i+1][(z + j) % d][less | (j < ki_digit) as usize]
                        += dp[i][z][less];
                    dp[i+1][(z + j) % d][less | (j < ki_digit) as usize] %= M;
                }
            }
        }
    }
    let mut tmp = dp[k.len()][0][0] + dp[k.len()][0][1] % M;
    if tmp < 1 {
        tmp += M;
    }
    tmp -= 1;
    println!("{}", tmp);
}


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

using namespace std;

int main() {
	int n;
	while(cin >> n) {
		if (n == 0) {
			break;
		}
	vector<int> retu[5];
	for (int i = 0; i < n; i++) {
		int d, p, q;
		cin >> d >> p >> q;
		q--;
		if (d == 1) {
			int MAX = 0;
			for (int j = q; j < q+p; j++) {
				int k = retu[j].size();
				MAX = max(MAX, k);
			}
			for (int j = q; j < q+p; j++) {
				for (int k = retu[j].size(); k < MAX; k++) {
					retu[j].push_back(0);
				}
				retu[j].push_back(1);
			}
		} else {
			for (int j = 0; j < p; j++) {
				retu[q].push_back(1);
			}
		}
		int MIN = retu[0].size();
		for (int j = 1; j < 5; j++) {
			int k = retu[j].size();
			MIN = min(MIN, k);
		}
		for (int j = MIN-1; j >= 0; j--) {
			if (retu[0][j]+retu[1][j]+retu[2][j]+retu[3][j]+retu[4][j] == 5) {
				for (int k = 0; k < 5; k++) {
					for (int l = j+1; l < retu[k].size(); l++) {
						retu[k][l-1] = retu[k][l];
					}
					vector<int>::iterator it = retu[k].end();
					it--;
					retu[k].erase(it);
				}
			}
		}
		for (int j = 0; j < 5; j++) {
			vector<int>::iterator it = retu[j].end();
			vector<int>::iterator itt = retu[j].begin();
			it--;
			for (int k = retu[j].size()-1; k >= 0; k--) {
				if (retu[j][k] == 0) {
					retu[j].erase(it);
				} else {
					break;
				}
				it--;
			}
		}
	}
	int counter = 0;
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < retu[i].size(); j++) {
			if (retu[i][j] == 1) {
				counter++;
			}
		}
	}
	cout << counter << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
# -*- coding: utf-8 -*-
N = int(input())
a_list = list(map(int, input().split()))

a_index = -1
ans = 0
for i in range(1, N + 1):
    for j in range(a_index + 1, N):
        if a_list[j] == i:
            a_index = j
            break
        else:
            ans += 1
    if j == N - 1:
        break
if ans == N:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 26012
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		int[] hist = new int[100];
		while (sc.hasNextLine() == true) {
			int tmp = Integer.parseInt(sc.nextLine());
			hist[tmp - 1]++;
		}
		
		int max = 0;
		for (int i = 0; i < hist.length; i++) {
			if (max < hist[i]) max = hist[i];
		}
		
		for (int i = 0; i < hist.length; i++) {
			if (hist[i] == max) System.out.println(i + 1);
		}
	}
}

Measured memory_bytes: 26168
import sys,collections
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

f = S()
s = S()
revf,revs = "",""
for i in range(2,-1,-1):
    revf += s[i]
    revs += f[i]

if f == revf and s == revs:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3316
s = input()
n = len(s)
dp = [0]*(n+1)
t = 0
for e,i in enumerate(s,1):
    if i=='<' :
        dp[e]=dp[e-1]+1
# print(dp)
t = 0
for e in range(n-1,-1,-1):
    i = s[e]
    # print(t)
    if i=='>' :
        dp[e]=max(dp[e],dp[e+1]+1)
# print(dp)
print(sum(dp))

Measured memory_bytes: 23324
#入力を受け取る
N = int(input()) #横の長さ
A1 = list(map(int,input().split())) #1行目のアメの数リスト
A2 = list(map(int,input().split())) #2行目のアメの数リスト

#全通りはN通りあり、A1を1個通るときはA2はN個通る。
#A1を2個通るときはA2はN-1個通る、A1_num=3のときA2_num=N-A1_num-1

sum_candy = []
for i in range(1,N+1):
    sum_candy_1 = 0
    sum_candy_2 = 0
    sum_candy_1 += sum(A1[:i])
    #print("1行目=",sum_candy_1)
    sum_candy_2 += sum(A2[i-1:])
    #print("2行目=",sum_candy_2)
    sum_candy.append(sum_candy_1 + sum_candy_2)

print(max(sum_candy))
#print(sum_candy)


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

main(){
  int s;
  cin >> s;
  int a[1000000];
  for(int ii=0;ii<1000000;ii++){
    a[ii]=0;
  }
  a[s]++;
  for(int ii=2;ii<1000000;ii++){
    if(s%2==0)s/=2;
    else s=3*s+1;
    if(a[s]==1){
      cout << ii << endl;
      break;
    }
    a[s]++;
  }
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll A, B;
  IN(A,B);
  OUT(A*B);

  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
//#pragma GCC optimize(2)

using namespace std;
#define LL long long
#define Rint register int
#define U unsigned
#define forn(i,a,b) for(int i = a;i <= b;++i)
#define nfor(i,a,b) for(int i = a;i >= b;--i)
#define pii pair<int ,int>
#define MS0(X) memset(X,0,sizeof(X))
#define MSf(X) memset(X,false,sizeof(X))
#define MS1(X) memset(X,-1,sizeof(X))
#define BR printf("--------------------\n")
#define pb push_back
#define rep(i,a,b) for(Rint i=a;i<=b;++i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const double PI=atan(1.)*4.;
const int maxn=1e6+5;
const int inf = 0x3f3f3f3f;
const int mod=1e9+7;
const double e=2.71828182845904523536;
int dirx[8]={1,0,-1,0,1,-1,-1,1};
int diry[8]={0,1,0,-1,1,1,-1,-1};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    double a,b,x,ans;
    cin>>a>>b>>x;
    double s=x/a;
    if(s*2.0<=a*b){//sanjiaoxing
        double aa=s*2.0/b;
        //DEBUG(aa);
        ans=90.0-atan(aa/b)*180.0/PI;
    }
    else{//tixing
        double x=(s*2.0-a*b)/a;
        ans=90.0-atan(a/(b-x))*180.0/PI;
    }
    cout<<fixed<<setprecision(10)<<ans<<"\n";
    return 0;
}

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

int main(){
  int H, W;
  cin >> H >> W;
  vector<string> S(H+2);
  vector<string> T(H);
  for(int i=0; i<H+2; i++){
    for(int j=0; j<W+2; j++){
    (S.at(i)).push_back('-');
    }
  }
  for(int i=0; i<H; i++){
    cin >> T.at(i);
    for(int j=0; j<W; j++){
      (S.at(i+1)).at(j+1)=(T.at(i)).at(j);
    }
  }
 
  int Ans=0;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if((S.at(i+1)).at(j+1)=='.'){
        Ans=0;
        if((S.at(i)).at(j)=='#'){
          Ans++;
        }
        if((S.at(i+1)).at(j)=='#'){
          Ans++;
        }
        if((S.at(i+2)).at(j)=='#'){
          Ans++;
        }
        if((S.at(i)).at(j+1)=='#'){
          Ans++;
        }
        if((S.at(i+2)).at(j+1)=='#'){
          Ans++;
        }
        if((S.at(i)).at(j+2)=='#'){
          Ans++;
        }
        if((S.at(i+1)).at(j+2)=='#'){
          Ans++;
        }
        if((S.at(i+2)).at(j+2)=='#'){
          Ans++;
        }
        (T.at(i)).at(j)='0'+Ans;
      }
      else{}
    }
  }
  for(int i=0; i<H; i++){
    cout << T.at(i) << endl;
  }
}


Measured memory_bytes: 384
<?php

$input_line = trim(fgets(STDIN));
$count_arr = [];

$s = trim(fgets(STDIN));
$s = str_replace(array("\r\n","\r","\n"), '', $s);
$s = explode(" ", $s);

for ($i = 0; $i < $input_line; $i++) {
    $count = 0;
    $num = waruni($s[$i], $count);
    $count_arr[] = $num;
}

$min = min($count_arr);

echo $min . "\n";

function waruni($num ,$count) {
    while ($num % 2 == 0) {
        $count = $count + 1;
        $num = $num / 2 ;
    }
    return $count;
}

Measured memory_bytes: 16076
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	int x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
ll fact(ll i) {
	ll sum = 1;
	for (ll j = 2; j <= i; j++)
		sum = (sum* j) % Mod;
	return sum;
}//階乗(正）
//#define int long long
const long long iinf = 4523372036854775807;
const int inf = 1500000000;
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
int n, a, b;
signed main() {
	cin >> n >> a >> b;
	if ((b-a) % 2 == 1)
		cout << "Borys\n";
	else
		cout << "Alice\n";
	getchar(); getchar();
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = ~(1<<31);
const int MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main()
{
	int n;
	cin >> n;
	vi l(n);
	rep(i,n) cin >> l[i];

	sort(all(l));

	ll ans = 0;
	int left,right;
	for(int a = 0; a < l.size(); a++){
		for(int b = a+1; b < l.size(); b++){
			left = l[b];
			right = l[b]+l[a];
			ans += lower_bound(l.begin()+b+1,l.end(),right)-(l.begin()+b+1);

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int r,g, b;
	cin >> r >> g >> b;
	string res;
	if ((100 * r + 10 * g + b) % 4 == 0) {
		res = "YES";
	}
	else {
		res = "NO";
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
//#pragma comment(linker,"/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
#define _for(i, a, b) for (int i = (a); i < (b); ++i)
#define _rep(i, a, b) for (int i = (a); i <= b; ++i)
const int max_number = 1000000;

int main()
{
    int x;
    for (int i = 1;; i++) {
        scanf("%d", &x);
        if (x == 0)
            break;
        printf("Case %d: %d\n", i, x);
        
    }

    return 0;
}


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

int main() {
    ll x; cin >> x;
    ll d = 100;
    int ans = 0;
    while(1) {
        if(x <= d) break;
        d *= 1.01;
        ans++;
    }
    cout << ans << endl;
}

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

void func140b() {
  int n; //料理の種類
  int a[20] = {}; //i番目に食べた料理ai
  int b[20] = {}; //料理iの満足度bi
  int c[20] = {}; //料理iの直後に料理i+1の満足度ci
  int i;

  //入力受け取り
  cin >> n;
  for (i = 0; i < n;i++) cin >> a[i];
  for (i = 0; i < n;i++) cin >> b[i];
  for (i = 1; i < n;i++) cin >> c[i];

  //満足度計算(0皿目はそとがわ)
  i = 0;
  int manzokudo = b[a[0] - 1];
  //cout << i << "皿目終了　満足度:" << manzokudo << endl;
  for (i = 1; i < n;i++) {

    manzokudo += b[a[i] - 1];
    if (a[i] - a[i - 1] == 1) {
      manzokudo += c[a[i] - 1];
    }
    //cout << i << "皿目終了　満足度:" << manzokudo << endl;
  }
  cout << manzokudo;
}

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

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

int main(){
	int n,i,ans = 0;
	int d[100000];

	cin >> n;
	for(i = 0; i < n; i++){
		cin >> d[i];
	}

	sort(d, d + n);

	if(n%2 == 0){
		if(d[n/2-1] != d[n/2]){
			ans = d[n/2] - d[n/2-1];
		}
	}

	cout << ans;

	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


  string s;
  cin >> s;

  string a, b;
  for (int i = 0; i < s.length() / 2; i++) {
    a += "01";
    b += "10";
  }
  if (s.length() % 2 != 0) {
    a += "0";
    b += "1";
  }
  int diff_a = 0;
  int diff_b = 0;

  for (int i = 0; i < s.length(); i++) {
    if (s[i] != a[i]) diff_a++;
    if (s[i] != b[i]) diff_b++;
  }
  pr((diff_a < diff_b ? diff_a : diff_b));


  return 0;
}


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

int A,B,C;

int main(int argc, char *argv[]) {
	int sr;
	int a, b;
	int i, j;

	sr=scanf("%d %d %d", &A, &B, &C);

	if (C-(A-B) > 0) {
		printf("%d\n", C-(A-B));
	} else {
		printf("0\n");
	}
	fflush(stdout);

	return 0;

}


Measured memory_bytes: 128
def check():
    num = set()
    A,B,C = map(int, input().split())
    
    for i in range(B):
        amari = A*i % B
        if amari == C:
            return 'YES'
        if amari in num:
            break
        num.add(amari)
    return 'NO'
  
print(check())

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define pii pair<int,int>
#define endl '\n'
#define mod 1000000007
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define in insert
#define rep(i,a,b) for(int i = a ; i < b ; i++)
#define repr(i,a,b) for(int i = b ; i > a ; i--)

signed main() 
{	
	fast;
	int a, n;
	cin >> n >> a;
	int b[n]={};
	rep(i,0,n)
		cin >> b[i];
	sort(b, b+n);
	int max=0;
	for(int i=0; i<n-a; i++){
		max=max+b[i];
	}	
	cout << max;
}


Measured memory_bytes: 1792