akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
inline int rnd(int x){
	return (rand()<<16|rand())%x;
}
const int N=200005,mod=1000000007;
#define lowbit(i) i&-i
int n,ans,b[N];
pair<int,int> a[N],c[N];
struct BIT1{
	int c[N];
	void change(int pos,int de){
		for(int i=pos;i<=n;i+=lowbit(i))c[i]=min(c[i],de);
	}
	int ask(int pos){
		int ans=1e9;
		for(int i=pos;i;i-=lowbit(i))ans=min(ans,c[i]);
		return ans;
	}
}T1;
struct BIT2{
	int c[N];
	void change(int pos,int de){
		for(int i=pos;i<=n;i+=lowbit(i))c[i]=(c[i]+de)%mod;
	}
	int ask(int pos){
		int ans=0;
		for(int i=pos;i;i-=lowbit(i))ans=(ans+c[i])%mod;
		return ans;
	}
}T2;
int main(){
	n=read();
	for(int i=1;i<=n;i++){
		int x=read(),v=read();
		a[i]=mp(v,x); b[i]=x;
	}
	sort(&b[1],&b[n+1]);
	for(int i=1;i<=n;i++)a[i].second=lower_bound(&b[1],&b[n+1],a[i].second)-b;
	sort(&a[1],&a[n+1]);
	for(int i=0;i<N;i++)T1.c[i]=1e9;
	for(int i=1;i<=n;i++){
		int t=T1.ask(n-a[i].second+1);
		c[i].first=min(i,t);
		T1.change(n-a[i].second+1,i);
	}
	for(int i=0;i<N;i++)T1.c[i]=1e9;
	for(int i=n;i;i--){
		int t=T1.ask(a[i].second);
		c[i].second=max(i,n-t+1);
		T1.change(a[i].second,n-i+1);
	}
	sort(&c[1],&c[n+1]);
	for(int i=n;i;i--){
		int t=c[i].second==n?T2.ask(n)+1:T2.ask(c[i].second+1);
		T2.change(c[i].first,t);
		if(c[i].first==1)ans=(ans+t)%mod;
	}
	cout<<ans<<endl;
}
/*
2 3 1
3 1 2
*/

Measured memory_bytes: 5760
#include<iostream>

#define     MIN_POINT     0
#define     MAX_POINT     1000

using namespace std;

int main(){
	int n;

	// ループ
	cin >> n;
	while(n >= 3){
		int min = (int)(MAX_POINT), max = (int)(MIN_POINT);
		int sum = (min + max) * (-1);
		int i, buf;

		// 点数の入力・合計処理
		for(i=0;i<n;i++){
			// 入力
			cin >> buf;
			// 入力値のチェック
			if((buf < ((int)(MIN_POINT))) || (buf > ((int)(MAX_POINT)))){
				cerr << "入力された値が範囲外です" << endl;
				i--;
				continue;
			}
			// 合計値に加算
			sum += buf;
			// 最大値のチェック
			if(buf > max){
				sum += max;
				max = buf;
				sum -= max;
			}
			// 最小値のチェック
			if(buf < min){
				sum += min;
				min = buf;
				sum -= min;
			}
		}

		// 合計の表示
		cout << (sum / (n - 2)) << endl;

		// 入力
		cin >> n;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<math.h>
using namespace std;

int a,b;

bool issqrt(double x){
    int num = sqrt(x);
    return x == num*num;
}

int main(){
    cin >> a >> b;
    int bb = b;
    int buf = a;
    while(b != 0){
        buf = buf * 10;
        b = b/10;
    }
    buf = buf + bb;
    if(issqrt((double)buf)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=2e5+500;
int w[N],n;
int main()
{
    scanf("%d",&n);int ans=0;
    for(int i=1;i<=2*n;i++)scanf("%d",w+i);
    sort(w+1,w+n*2+1);
    for(int i=1;i<=2*n;i+=2)ans+=w[i];
    cout<<ans<<endl;
}

Measured memory_bytes: 3744
//@author rohit_0801
// help source : https://www.geeksforgeeks.org/given-an-array-arr-find-the-maximum-j-i-such-that-arrj-arri/

 
#include <bits/stdc++.h>
#define ll int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define debug 0
 
using namespace std;
const ll MOD = 1000000007;
const ll MODD = MOD-1;
 
ll ar[900780], left_max[448390], right_min[123456],br[1234567];
ll dp[505][505], mat[505][505];

vector<ll> vec[555],pec;

void go(int n, int k)
{
    for (int i=0; i<=n; i++)
        for (int j=0;j<=k;j++)
            dp[i][j] = 0;
 
    dp[0][0] = 0;
 

    for (int i=1;i<=n;i++)
		for (int j=1;j<=k;j++)
 			for (int m=i-1;m>=0;m--)
                dp[i][j] = max(dp[i][j], mat[i-1][m]);
 
 
}

ll solve(ll n)
{
	ll c=0;
    for(int i=1;i<=n;i++){
    	if(n%i==0){
    		c++;
		}
	}
	
	if(c==8){
		return 1;
	}
	else{
		return 0;
	}
}
 
 
int main() {
	//srand(time(0));
	ll a,b,n,m,flag=0,r,t,u,v,w,x,y,z,k,res=0,d,maxm=-999999999,i,j,ct,h,ans=0,s,l,e,f,p,minm=999999999,c,type,q,len,siz;
 	
 	vector<ll>::iterator it,jt;
 	
 	string str="",ptr="";
 	char ch;
 	
 	cin>>n>>m>>q;
 	p=m;
 	
 	while(m--){
 		scanf("%d %d",&a,&b);
 		vec[a].pb(b);
	 }
	 
	 for(i=1;i<=n;i++){
	 	if(vec[i].size()>0){
	 		sort(vec[i].begin(),vec[i].end());
		 }
	 }
	 
	 while(q--){
	 	scanf("%d %d",&a,&b);
	 	ans=0;
	 	for(i=a;i<=b;i++){
	 		if(vec[i].size()>0){
	 			it=upper_bound(vec[i].begin(),vec[i].end(),b);
	 			if(it==vec[i].begin()){
	 				ans=ans;
				 }
				 else if(it==vec[i].end()){
				 	ans+=(vec[i].size());
				 }
				 else{
				 	ans+=(it-vec[i].begin());
				 }
			 }
		 }
		 cout<<ans<<"\n";
	 }
 	
	
	return 0;
}  

Measured memory_bytes: 2176
N, K=map(int, input().split())
A=[0]+list(map(int, input().split()))
zerorui=[0]*(N+1)
for i in range(1, N+1):
  if A[i]==0:
    zerorui[i]=zerorui[i-1]+1
  else:
    zerorui[i]=zerorui[i-1]
    
for i in range(K+1, N+1):
  if zerorui[i]-zerorui[i-K]>0:
    print('No')
  elif A[i]>A[i-K]:
    print('Yes')
  else:
    print('No')
  

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

#define OUT(out) { cout << (out) << "\n"; exit(0); }

int main() {
  int N, K; cin >> N >> K;
  vector<int> vs(N);
  rep(i, N) {
    cin >> vs[i];
  }
  if (N == K) OUT(1);
  // 1こずつ重複して左詰めで数え上げる
  cout << (1 + (N - K) / (K - 1) + ((N - K) % (K - 1) > 0)) << "\n";
}


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

using namespace std;

int main(void){
    int N,M;
    cin>>N>>M;
    vector<int> L(M);
    vector<int> R(M);
    for(int i=0;i<M;i++){
        cin>>L[i]>>R[i];
    }
    int L_max=0;
    int R_min=100005;
    for(int i=0;i<M;i++){
        L_max=max(L_max,L[i]);
        R_min=min(R_min,R[i]);
    }
    if(L_max<=R_min) cout<<R_min-L_max+1<<endl;
    else cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int MAXN = 109;
int n,m;
char mat[MAXN][MAXN];
int cnt[30];
int tot[5];

void solve(){
	int i,j;
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			cnt[mat[i][j]-'a'+1]++;
		}
	}
	for(i=1;i<=26;i++){
		if(cnt[i]==0)
			continue;
		tot[cnt[i]%4]++;
	}
	//case1
	if(n%2==0 && m%2==0){
		if((tot[1] | tot[2] | tot[3])>0){
			puts("No");
		}
		else{
			puts("Yes");
		}
	}
	//case2
	else if(n%2 + m%2==1){
		if(tot[1]>0 || tot[3]>0){
			puts("No");
			return;
		}
		if(n%2==1){
			if(tot[2]*2>m){
				puts("No");
				return;
			}
			else{
				puts("Yes");
			}
		}
		else{
			if(tot[2]*2>n){
				puts("No");
				return;
			}
			else{
				puts("Yes");
			}
		}
	}
	//case3
	else{
		bool center=false;
		bool center3=false;
		if(tot[1]>1){
			puts("No");
			return;
		}
		if(tot[1]==1){
			tot[1]=0;
			center=true;
		}
		if(tot[3]>1){
			puts("No");
			return;
		}
		if(tot[3]==1){
			if(center==true){
				puts("No");
				return;
			}
			center=true;
			center3=true;
			tot[3]--;
		}
		if(center==false){
			puts("No");
			return;
		}
		if((center3+tot[2])*2>n-1+m-1){
			puts("No");
		}
		else{
			puts("Yes");
		}
	}
}

int main(){
	scanf("%d%d",&n,&m);
	int i;
	for(i=1;i<=n;i++)
		scanf("%s",mat[i]+1);
	solve();
	return 0;
}

Measured memory_bytes: 128
#include <sstream>
#include <iostream>
#include <string>
#include <algorithm>
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;

int main(){
	int n;
	cin >> n;
	int e[3];
	REP(i,n){
		REP(j,3)cin>>e[j];
		sort(e, e+3);
		if(e[0]*e[0]+e[1]*e[1]==e[2]*e[2])cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define endl "\n"
 
int32_t main()
{
	fast;
	string s;
	cin>>s;
	vector<int> v;
	// char ch=' ';
	int c=0;
	// for(int i=0;i<s.size();i++)
	// {
	// 	if(ch==' ')
	// 	{
	// 		ch=s[i];
	// 		c++;
	// 	}
	// 	else if(s[i]==ch)
	// 	{
	// 		c++;
	// 	}
	// 	else
	// 	{
	// 		v.push_back(c);
	// 		ch=s[i];
	// 		c=1;
	// 	}
	// }
	// v.push_back(c);
	// int ans=0;
	// for(int i=0;i<v.size();i++)
	// {
	// 	int x=v[i]%3;
	// 	int b=v[i]/3;
	// 	ans+=2*b;
	// 	if(x!=0)
	// 		ans++;
	// }
	// cout<<ans<<endl;
	// if(c!=0)
	string prev="";
	string cur="";
	for(int i=0;i<s.size();i++)
	{
		cur+=s[i];
		if(prev=="")
		{
			prev=cur;
			c++;
			cur="";
		}
		else if(cur!=prev)
		{
			c++;
			prev=cur;
			cur="";
		}
		else
			continue;
	}
	cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 720
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    int n,i;   
    char s[100000];
  
    scanf("%s",s);
  
    n=strlen(s);
  
    for(i=0;i<n;i++)
        if((i+1)%2!=0) printf("%c",s[i]);
  
    return 0;
}  

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


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    
    ll n;
    cin>>n;
    array<ll,2> l[n],r[n];
    for(ll i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        l[i] = {a,i};
        r[i] = {b,i};
    }
    sort(l,l+n,greater<array<ll,2>>());
    sort(r,r+n);
    bool used[n]={};
    ll nl=0,nr=0;
    ll ans = max(0LL,0LL - r[nr][0]);
    ll now = r[nr][0];
    used[r[nr][1]] =1;
    nr=1;
    if(now<0)for(ll i=1;i<n;i++){
        while(nr<n && used[r[nr][1]]) nr++;
        while(nl<n && used[l[nl][1]]) nl++;
        ll dl = l[nl][0] - now;
        ll dr = now - r[nr][0];
        if(dl<=0 && dr<=0) break;
        if(dr > dl){
            now = r[nr][0];
            used[r[nr][1]]=1;
            ans += dr;
        }
        else if(dr==dl){
            ans += dr;
            if(nr<nl){
                now = r[nr][0];
                used[r[nr][1]]=1;
            }
            else {
                now = l[nl][0];
                used[l[nl][1]]=1;
            }
        }
        else {
            now = l[nl][0];
            used[l[nl][1]]=1;
            ans += dl;
        }
    }
    ans += abs(now);
    cerr << ans << endl;
    for(ll i=0;i<n;i++) used[i] = 0;
    nr=0,nl=0,now=0;
    ll ret = l[0][0];

    now = l[0][0];
    nl = 1;
    used[l[0][1]]=1;
    if(ret>0)for(ll i=1;i<n;i++){
        while(nr<n && used[r[nr][1]]) nr++;
        while(nl<n && used[l[nl][1]]) nl++;
        ll dl = l[nl][0] - now;
        ll dr = now - r[nr][0];
        if(dl<=0 && dr<=0) break;
        if(dr > dl){
            now = r[nr][0];
            used[r[nr][1]]=1;
            ret += dr;
        }
        else if(dr==dl){
            ret += dr;
            if(nr<nl){
                now = r[nr][0];
                used[r[nr][1]]=1;
            }
            else {
                now = l[nl][0];
                used[l[nl][1]]=1;
            }
        }
        else {
            now = l[nl][0];
            used[l[nl][1]]=1;
            ret += dl;
        }
    }
    ret += abs(now);
    ans = max(ret,ans);

    cout << ans << endl;

}

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

using namespace std;

int n, k;
bool prohibited[10];

bool check (int x) {
    while (x > 0) {
        int num = x % 10;
        x /= 10;
        if (prohibited[num]) return false;
    }

    return true;
}

int main(){
    scanf("%d %d", &n, &k);
    for (int i = 1; i <= k; i++) {
        int x;
        scanf("%d", &x);
        prohibited[x] = true;
    }

    for (int i = n; ; i++) {
        if (check(i)) {
            printf("%d", i);
            return 0;
        }
    }
    return 0;
}


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

map<string, vector<int> > mp;

int main(){
  string s;
  int n;
  while(cin>>s>>n){
    if(mp.find(s)==mp.end()){
      vector<int> tmp;
      tmp.push_back(n);
      mp.insert(map<string, vector<int> >::value_type(s, tmp));
    }
    else{
      mp[s].push_back(n);
    }
  }
  for(map<string, vector<int> >::iterator it=mp.begin(); it!=mp.end(); it++){
    cout<<it->first<<endl;
    sort(it->second.begin(), it->second.end());
    for(int i=0; i<it->second.size(); i++){
      if(i!=it->second.size()-1)cout<<it->second[i]<<' ';
      else cout<<it->second[i]<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1244
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

int main(int argc, char *argv[])
{
	ll N, K;

	cin >> N >> K;

	double p = N / double(K) + 1.0;
	ll t = ll(p);
	ll idx = t - 10;
	ll mn = 0x7FFFFFFFFFFFFFFF;
	if (t - 10 < 1) {
		idx = 1;
	}
	for (ll i = idx; i < t + 10; i++) {
		ll tmp = - K * i + N + K;
		mn = min(abs(tmp), mn);
	}

	cout << mn << endl;

	return 0;
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];
#define debug(x) cout << #x << "= " << x<< endl;
// template starts
typedef long long int ll;

// template ends here
vector<vector<int>> adj;
vector<bool> vis;
int bfs(int root){
	queue<int> q;
	q.push(root);
	
	int cnt = 0;
	vis[root] = true;
	while(!q.empty()){
		int node = q.front();
		//debug(node);
		q.pop();
		
		cnt++;
		
		for(int i = 0; i < (int)adj[node].size(); i++){
			int child = adj[node][i];
			if(vis[child]) continue;
			
			q.push(child);
			vis[child] = true;
		}
	}
	
	return cnt;
}

void solve(){
	// code starts from here
	int N, M;
	cin >> N >> M;
	
	set<pair<int,int>> edges;
	vis.resize(N);
	for(int i = 0; i < N; i++) vis[i] = false;
	
	for(int i = 0; i < M; i++){
		int t1,t2;
		cin >> t1 >> t2;
		t1--;t2--;
		
		if(t1 > t2) swap(t1,t2);
		edges.insert(mp(t1,t2));
	}
	
	adj.resize(N);
	for(auto &p: edges){
		adj[p.first].pb(p.second);
		adj[p.second].pb(p.first);
	}
	
	
	int ans = 1;
	
	for(int i = 0; i < N; i++){
		if(vis[i]) continue;
		ans = max(ans,bfs(i));
	}
	
	cout << ans << endl;
}

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

	int T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


Measured memory_bytes: 23740
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <utility>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cassert>
#include <string.h>

using namespace std;
#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,a,b) for(int i=a;i<b;i++)
typedef long long int lld;
typedef vector<lld> vl;
typedef vector<int> vi;
typedef vector<string> vs;



//int arr[N]
////sort(arr,arr +N)

//vector <int> hoge
////sort(hoge.begin(),hoge.end());
///min_element(hoge.begin(),hoge.end();　最小値　　　最大値はmax_element();

int main() {

	int a,b,c,ans;
ans;
	cin>>a>>b>>c;
 
ans=  (c/a)*b;


cout<<ans ;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var NMK = Sarray();
            var N = NMK[0];
            var M = NMK[1];
            var K = NMK[2];
            for (var i = 0; i <= M; ++i)
            {
                for (var j = 0; j <= N; ++j)
                {
                    if (K == N * i + M * j - 2 * i * j)
                    {
                        WriteLine("Yes");
                        return;
                    }
                }
            }
            WriteLine("No");
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13396
#include <stdio.h>
int main (void)
{
    char a[128];
    char b[128];
    char c[128];

    scanf("%s",a);
    scanf("%s",b);
    scanf("%s",c);

    printf("%c%c%c\n",a[0],b[0],c[0]);

    return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int deta;
	int deta2;
	int a, total;

	while (scanf ("%d %d", &deta, &deta2) != EOF){
		a = deta + deta2;
		total = 0;

		while (1){
			if (a < 10){
				total++;
				break;
			}
			else {
				a = a / 10;
				total++;
			}
		}
		printf("%d\n", total);
	}

	return 0;
}

Measured memory_bytes: 3160
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        for(;;){
                int a,b;
                char op[10];
                //cin>>a>>op>>b;
                scanf("%d %c %d",&a,op,&b);
                if(*op=='?'){
                    break;
                }else if(*op=='+'){
                        cout<<a+b<<endl;
                }else if(*op=='-'){
                        cout<<a-b<<endl;
                }else if(*op=='*'){
                        cout<<a*b<<endl;
                }else if(*op=='/'){
                        cout<<a/b<<endl;
                }
        }
        return 0;
}

Measured memory_bytes: 1200
import java.util.*;

public class Main {
    public static void main(String[] args) {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if(a >= 13){
            b = b;
        }else if(6 <= a && a <= 12){
            b = b / 2;
        }else{
            b = 0;            
        }
       System.out.println(b);
    }
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m;i>n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
   lli A,B,C,N,M,K,L,R,sum=0,num=0;
   cin >> N >> M;
   K=N;
   Vec(P,string,0,"");Vec(Q,int,M,0);
   rep(i,0,N){
       string S;cin >> S;
       if(S.find('#')==string::npos)continue;
       else P.pb(S);
   }
   N=P.size();
   rep(i,0,N)rep(j,0,M)if(P[i][j]=='#')Q[j]++;
   rep(i,0,N){
       rep(j,0,M)if(Q[j])NeOut(P[i][j]);
       cout<<endl;
   }
}

Measured memory_bytes: 256
//package Dynamic;
import java.io.*;
import java.util.*;
class Main 
{
    static public void main(String[] args) throws IOException 
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        
        //int t=Integer.parseInt(br.readLine());
        //long n=Long.parseLong(br.readLine());
        StringTokenizer st=new StringTokenizer(br.readLine());
        long a=Long.parseLong(st.nextToken());
        long b=Long.parseLong(st.nextToken());
        long c=Long.parseLong(st.nextToken());
//        int ar[]=new int[n];
//        for(int x=0;x<n;x++)
//        {
//        	
//        }
        //long d=Long.parseLong(br.readLine());
//        while(st.hasMoreTokens())
//        {
//        	long aa=Long.parseLong(st.nextToken());
//        	
//        }
        System.out.println(Math.min(a*b,c));
    }
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	long x[111], y[111];
	for (int i = 0; i < n; i++)
		cin >> x[i] >> y[i];
	int s = 0;
	for (int i = 0; i < n; i++) {
		if (x[i] > x[s])
			continue;
		if (x[i] < x[s] || y[i] < y[s])
			s = i;
	}
	vector<int> v;
	do {
		v.push_back(s);
		int m = 0;
		for (int i = 1; i < n; i++) {
			if (m == s) m = i;
			else {
				long v = (x[m] - x[s])*(y[i] - y[s]) - (x[i] - x[s])*(y[m] - y[s]);
				if (v > 0 || !v && (x[i] - x[s])*(x[i] - x[s]) + (y[i] - y[s])*(y[i] - y[s]) > (x[m] - x[s])*(x[m] - x[s]) + (y[m] - y[s])*(y[m] - y[s]))
					m = i;
			}
		}
		s = m;
	} while (s != v[0]);
	v.push_back(v[0]);
	v.push_back(v[1]);
	double res[111] = {};
	for (int i = 0; i < v.size() - 2; i++) {
		long a = (x[v[i + 1]] - x[v[i]])*(x[v[i + 2]] - x[v[i + 1]]) + (y[v[i + 1]] - y[v[i]])*(y[v[i + 2]] - y[v[i + 1]]);
		long b = (x[v[i + 1]] - x[v[i]])*(x[v[i + 1]] - x[v[i]]) + (y[v[i + 1]] - y[v[i]])*(y[v[i + 1]] - y[v[i]]);
		long c = (x[v[i + 2]] - x[v[i + 1]])*(x[v[i + 2]] - x[v[i + 1]]) + (y[v[i + 2]] - y[v[i + 1]])*(y[v[i + 2]] - y[v[i + 1]]);
		double co = a;
		co /= sqrt(double(b)*c);
		res[v[i + 1]] = acos(co) / 2 / 3.14159265358979;
	}
	cout.precision(18);
	for (int i = 0; i < n; i++)
		cout << res[i] << '\n';
	cout << flush;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
signed main(){
  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;
  int ans=0;
  if(A+B<=C*2){
    ans+=A*X;
    ans+=B*Y;
    }
  else{
    if(X>Y){
      ans+=Y*C*2;
      ans+=min((X-Y)*C*2,(X-Y)*A);
      }
    else{
      ans+=X*C*2;
      ans+=min((Y-X)*B,(Y-X)*C*2);
      }
    }
  cout<<ans<<endl;
  }

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int i,tmp,x,y;
    for(i=0;i<3000;i++){
        scanf("%d %d",&x,&y);
        if(y<x){
            tmp=y;
            y=x;
            x=tmp;
        }
        if(x==0&&y==0){
            i=3000;
        }else{
            printf("%d %d\n",x,y);
        }
        
    }
    return 0;
}


Measured memory_bytes: 2004
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(" ");
        var N = int.Parse(input[0]);
        var M = int.Parse(input[1]);
        var K = int.Parse(input[2]);

        var A = new List<int>();
        var line = Console.ReadLine().Split(" ");
        for (int i = 0; i < N; i++)
        {
            A.Add(int.Parse(line[i]));
        };
        var B = new List<int>();
        var line2 = Console.ReadLine().Split(" ");
        for (int i = 0; i < M; i++)
        {
            B.Add(int.Parse(line2[i]));
        };

        var count = 0;
        long sum = 0;
        var left = -1;
        for (; left < N - 1; )
        {
            left++;
            sum += A[left];
            if(sum > K)
            {
                sum -= A[left];
                left--;
                break;
            }
            count++;
        }

        var right = -1;
        var countMax = count;
        for (; right < M - 1; )
        {
            right++;
            sum += B[right];
            while(sum > K)
            {
                if (left < 0)
                {
                    break;
                }

                sum -= A[left];
                left--;
                count--;

            }
            if(sum > K)
            {
                break;
            }
            count++;
            countMax = Math.Max(countMax, count);
        }

        Console.WriteLine(countMax);

    }
}

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

int main() {
	string s, p; 
	getline(cin, s);
	getline(cin, p);

	int sLen = s.length();
	int pLen = p.length();

	if(pLen>sLen) return 0; //User can pass bigger pattern then text

    for(int i = 0; i<= s.length() - pLen; i++)
	{
		if(s.substr(i, pLen)==p)
		{
			cout<<i<< "\n" ; 
		}
	}
	return 0;
}


Measured memory_bytes: 4004
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main(){
  int H,W,h,w;
  cin>>H>>W>>h>>w;
  ou((H-h)*(W-w));
}

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

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

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    ll n, k; cin>>n>>k;
    vector<ll> a(n), sum(n+1);
    sum[0]=0;
    for(int i=0; i<n; i++){
        cin>>a[i];
        if(i==0) sum[i+1]=a[i];
        else sum[i+1]=sum[i]+a[i];
    }

    vector<ll> b;
    for(int i=1; i<=n; i++){
        for(int j=i; j<=n; j++){
            b.emplace_back(sum[j]-sum[i-1]);
        }
    }
    sort(b.begin(), b.end(), greater<ll>());

    ll ans=0;
    for(int i=40; i>=0; i--){
        ans+=(1LL<<i);

        int cnt=0;
        for(int j=0; j<b.size(); j++){
            if((ans&b[j])==ans) cnt++;
        }

        if(cnt<k) ans-=(1LL<<i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 6516
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
using namespace std;

int main()
{
    int A, B;
    char op[2];
    if (scanf("%d", &A) < 1) return 0;
    if (scanf("%s", op) < 1) return 0;
    if (scanf("%d", &B) < 1) return 0;

    printf("%d\n", op[0] == '+' ? A + B : A - B);
    return 0;
}


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

int main()
{
  int64_t N;
  cin >> N;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  deque<int64_t> P, Q;
  for (int i = 0; i < N; i++)
    P.push_back(A[i]);
  Q.push_front(P.front()); // 前に最小を入れる
  P.pop_front();
  Q.push_back(P.back()); // 後ろに最大を入れる
  P.pop_back();
  int64_t t = 0, ans = abs(Q.front() - Q.back());
  while (P.size() > 1)
  {
    if (t % 4 == 0)
    {
      ans += abs(P.back() - Q.front()); // 前に最大を入れる
      Q.emplace_front(P.back());
      P.pop_back();
    }
    else if (t % 4 == 1)
    {
      ans += abs(P.front() - Q.back()); // 後ろに最小を入れる
      Q.emplace_back(P.front());
      P.pop_front();
    }
    else if (t % 4 == 2)
    {
      ans += abs(P.front() - Q.front()); // 前に最小を入れる
      Q.emplace_front(P.front());
      P.pop_front();
    }
    else
    {
      ans += abs(P.back() - Q.back()); // 後ろに最大を入れる
      Q.emplace_back(P.back());
      P.pop_back();
    }
    t++;
  }
  if (!P.empty())
    ans += max(abs(P.front() - Q.front()), abs(P.front() - Q.back()));
  cout << ans << endl;
}


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

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

int main() {
    long long a, b;
    cin >> a >> b;
    long long g = gcd(a, b);
    int cnt = 1;
    for (long long i = 2; i * i <= g; i++) {
        if (g % i) continue;
        cnt++;
        while (g % i == 0) g /= i;
    }
    if (g != 1) cnt++;
    cout << cnt << "\n";
    return 0;
}


Measured memory_bytes: 256
// --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstring>

using namespace std;

int main(int argc, char* argv[]) {

	string s, wrk, str1, str2;
	int ans = 0;

	cin >> s;

	for (int i = s.length() - 2; i >= 2; i--) {
		if (i % 2 == 0) {
			wrk = s.substr(0, i);
			str1 = wrk.substr(0, i / 2);
			str2 = wrk.substr(i / 2, i);
			if (str1 == str2) {
				ans = i;
				break;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;
int main(){
	int a,b,c; cin >>a>>b>>c;
	int now=0;
	if((a+b)%60==0){
		if(c<=a){
			cout << c << endl;
			return 0;
		}
		else{
			cout << -1 << endl;
			return 0;
		}
	}
	else if(60%(a+b)==0){
		while(1){
		if(now%60<=c&&c<=(now%60+a)){
			cout << now+(c-now%60) << endl;
			return 0;
		}
		else if(now%60+a>=60&&c<=(now%60+a)%60){
			cout << now+(60-now%60+c%60) << endl;
			return 0;
		}
		now+=(a+b);
		if(now>60){
			cout << -1 << endl;
			return 0;

		}
	}
	}
	while(1){
		if(now%60<=c&&c<=(now%60+a)){
			cout << now+(c-now%60) << endl;
			return 0;
		}
		else if(now%60+a>=60&&c<=(now%60+a)%60){
			cout << now+(60-now%60+c%60) << endl;
			return 0;
		}
		now+=(a+b);
		if(now%60==0){
			cout << -1 << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3108
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>

int a, b;

int main() {
    scanf("%d%d", &a, &b);
    if (a + b == 15)
    {
        printf("+\n");
    }
    else if (a * b == 15)
    {
        printf("*\n");
    }
    else
    {
        printf("x\n");
    }
    return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    s = readline().rstrip().decode()
    if s.isupper():
        print('A')
    else:
        print('a')


if __name__ == '__main__':
    main()


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

const int INF = 1 << 30;

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> A(N), B(N);
	for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
	vector<int> C(M), D(M);
	for (int i = 0; i < M; i++) cin >> C[i] >> D[i];

	for (int i = 0; i < N; i++) {
		int min_p = INF;
		int min_d = INF;
		for (int j = 0; j < M; j++) {
			int tmp_d = abs(A[i]-C[j]) + abs(B[i]-D[j]);
			if (min_d > tmp_d) {
				min_d = tmp_d;
				min_p = j + 1;
			}
		}
		cout << min_p << endl;
	}
}


Measured memory_bytes: 256
#include<bits/extc++.h>
#ifndef __unix__
#define fread_unlocked fread
#endif
#ifdef _debug 
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#include<bits/stdc++.h>
#define dout(i) 0&&0
#endif
#pragma GCC optimize("unroll-loops,no-stack-protector,O3")
#define priority_queue __gnu_pbds::priority_queue
#define unordered_map __gnu_pbds::gp_hash_table
#define pb emplace_back
#define rep(_n) for(int __i = _n;__i--;)
#define rep0(_i, _n) for(int _i = 0; (_i)<(_n) ;++_i)
#define rep1(_i, _n) for(int _i = 1; (_i)<=(_n) ;++_i)
#define yn(i) ((i)?"Yes" : "No")
#define eout(i) {cout << (i) << '\n';exit(0);}
#define rout(i) {return cout << (i) << '\n', 0;}
#define multi int _T;for(read(_T);_T--;)
using namespace std;
using ll = long long;using ull = unsigned long long;using ul = unsigned;using db = double;
using __gnu_pbds::null_type;
inline char readchar(){static const unsigned bufsize = 1 << 16; static unsigned p = 0, end = 0; static char buf[bufsize]; if (p == end) end = fread_unlocked(buf, sizeof(char), bufsize, stdin), p = 0; return p == end ? EOF : buf[p++]; }
inline void read(char &a){while(isspace(a = readchar()));}
inline void read(char *a){while(isspace(*a = readchar()));++a; while(isgraph(*a = readchar()))++a;}
inline void read(string &a){static char p; while(isspace(p = readchar())); a = p; while(isgraph(p = readchar()))a.push_back(p);}
template<typename T> inline void read(T& a){static char p; static bool b;while (!isdigit(p = readchar()))b = p == '-'; a = p ^ '0'; while (isdigit(p = readchar())) a *= 10, a += p ^ '0'; if(b)a *= -1, b = false; }
template<typename T1, typename T2> inline void read(pair<T1, T2> &a){read(a.first), read(a.second);}
template<typename T> inline void read(T begin, const T &end){while(begin != end)read(*begin), ++begin;}
inline void R(){} template<class T1, class... T2> inline void R(T1 &h, T2 &... e){read(h), R(e...);}
template<typename T> inline void write(T begin, const T &end){while(begin != end)cout << *begin << " \n"[next(begin) == end], ++begin;}
template<typename T> using rbtree = __gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T> inline ostream& operator << (ostream &ou, const vector<T> &a){for(auto it = a.begin();it != a.end();++it)ou << (it != a.begin() ? " " : "") << *it;return ou;}
template<typename T1, typename T2>inline istream& operator >> (istream &in, pair<T1, T2> &a){return in >> a.first >> a.second;}
template<typename T1, typename T2>inline ostream& operator << (ostream &ou, const pair<T1, T2> &b){return ou << b.first << ' ' << b.second;}
template<typename T> inline long long pow(long long v, long long t, const T &p){long long res = 1;for(;t;t >>= 1, v = v * v % p)if(t & 1)res = res * v % p;return res;}
const int maxn = 100001;
int dp[maxn]{1};
void init(){
	for(int i = 100;i <= 105;++i)for(int j = i;j < maxn;++j)dp[j] |= dp[j-i];
}
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n;
	init();
	R(n);
	rout(bool(dp[n]));
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define mod pow(10,9)+7
#define lim pow(10,7)

using namespace std;

int a[10];

int verify(int n)
{
	while(n)
	{
		if(a[n%10])
			return 0;
		n/=10;
	}
	return 1;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,k;
	cin>>n>>k;
	for(int i=0;i<k;i++)
	{
		int x;
		cin>>x;
		a[x]=1;
	}
	for(int i=n;;i++)
	{
		if(verify(i))
		{
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    string S;
    cin >> S;
    int max = 0;
    int tmp = 0;
    rep(i,S.size()){
        if(S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T'){
            tmp++;
            if(tmp>max) {
                max = tmp;
            }
        }else{
            tmp =0;
        }
    }

    cout << max;
    return 0;
}

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

typedef long long ll;
int n;
ll A,B,h[110000];

int main(){
    scanf("%d %lld %lld",&n,&A,&B);
    A-=B;
    for(int i=1;i<=n;i++){
        scanf("%lld",&h[i]);
    }ll l=0,r=1000000000;
    while(l+1<r){
        ll cnt=0;
        int mid=(l+r)>>1;
        for(int i=1;i<=n;i++){
            ll x=h[i]-mid*B;
            if(x<=0)continue;
            cnt+=(x-1)/A+1;
        }if(cnt<=mid)r=mid;
        else l=mid;
    }printf("%lld\n",r);
    return 0;
}

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

using namespace std;

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pll pair<long long ,long long >
#define ppll pair < pll , pll >
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define INF 1e18
#define eps 0.00001
#define le length
#define debug(n1) cout << n1 << endl
#define rep(i , j , n) for(ll i = j ; i <= n ; i++)
#define per(i , j , n) for(ll i = j ; i >= n ; i--)
const ll N = 2e5 + 5;
const ll M = 1e7 + 5;
const ll mod = 1e18 + 7;
ll MODULAR_POWER(ll a , ll b , ll MOD) {
    if(b == 0) return 1LL;
    ll d = MODULAR_POWER(a , b / 2 , MOD);
    d *= d;
    d %= MOD;
    if(b % 2) d *= a;
    d %= MOD;
    return d;
}
ll BINARY_SEARCH(ll dp[] , ll n , ll key) {
    ll s = 1;
    ll e = n;
    while(s <= e) {
        ll mid = (s + e) / 2;
        if(dp[mid] == key) return mid;
        else if (dp[mid] > key) e = mid - 1;
        else s = mid + 1;
    }
    return -1;
}
string CONVERT_TO_BINARY(ll s) {
    string res = "";
    while(s != 0) {
        res += (char)('0' + s % 2);
        s /= 2;
    }
    reverse(res.begin() , res.end());
    return res;
}
bool PALIN(string s) {
    int i = 0;
    int j = s.le() - 1;
    while(i <= j) {
        if(s[i] != s[j]) return false;
        j-- , i++;
    }
    return true;
}
queue < int > q;
ll d[N];
int vis[N];
int main() {
    SPEED;
    cout.precision(8);
    cout << fixed;
    ll k;
    cin >> k;
    if(k == 1) {
        cout << 1 << endl;
        return 0;
    }
    rep(i , 0 , k - 1) d[i] = mod;
    rep(i , 1 , 9) {
        q.push(i % k);
        vis[i % k] = 1;
        d[i % k] = min(i , d[i % k]);
    }
    while(!q.empty()) {
        int u = q.front();
        q.pop();
        vis[u] = 0;
        rep(i , 0 , 9) {
            ll v = (u * 10 + i) % k;
            if(d[v] > d[u] + i) {
                d[v] = d[u] + i;
                if(vis[v] == 0) {
                    vis[v] = 1;
                    q.push(v);
                }
            }
        }
    }
    cout << d[0] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define N (200005)
#define ll long long
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define CM cerr<<(&MOP2-&MOP1)/1024.0/1024.0<<endl
using namespace std;
template <class T> inline T Min(T x, T y){
    return x<y?x:y;
}
template <class T> inline T Max(T x, T y){
    return x>y?x:y;
}
bool MOP1;
	int n,m;
int A[N];
vector<int>G[N];
void dfs(int x,int fa){
	A[x]+=A[fa];
	for(int i=0;i<G[x].size();i++){
		int y=G[x][i];
		if(y==fa)continue;
		dfs(y,x);
	}
}
bool MOP2;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		G[x].push_back(y);
		G[y].push_back(x);		
	}
	for(int i=0;i<m;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		A[a]+=b;
	}
	dfs(1,0);
	for(int i=1;i<n;i++)printf("%d ",A[i]);printf("%d\n",A[n]);
	return 0;
}
 





Measured memory_bytes: 23424
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>

// Remove GCC optimizer for codechef
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e16;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 1e9 + 7;


int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    
    int L;
    cin >> L;
    double l;
    l = L;
    double vol = (l * l * l / (3 * 3 * 3));
    cout << setprecision(10) << fixed;
    cout << vol << endl;
    return 0;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.time.chrono.MinguoChronology;

public class Main {
  static InputReader in;
  static PrintWriter out;
  
  static class Solution {
    void solve() throws IOException { 
      int W = in.nextInt();
      int H = in.nextInt();
      int x = in.nextInt();
      int y = in.nextInt();
      int r = in.nextInt();
      
      if (x < r || y < r || y > H - r || x > W - r) {
        out.println("No");
      } else {
        out.println("Yes");
      }
    }
  }

  public static void main(String[] args) throws IOException {
//    ??????
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;
    
    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }
   
    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }
    
    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken()); 
    }
    
    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }
    
    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }
    
  }
  
}

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

#define pii pair <int, int>
#define ll long long
#define f first
#define s second
#define pb push_back

using namespace std;

const int N = 1e5 + 5;
ll d[3][N];
ll p[N];

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    for (int i =  1; i <= n; ++i) {
        scanf("%lld", &p[i]);
    }
    sort(p + 1, p + n + 1);
    int la, ra, lb, rb;
    la = ra = lb = rb = 0;
    d[1][1] = 1;
    d[2][1] = 1;
    d[1][0] = d[2][0] = 1; 
    p[0] = -2e18;
    for (int i = 2; i <= n; ++i) {
        while (p[i] - p[ra + 1] >= a)
            ra++;
        while (p[i] - p[rb + 1] >= b)
            rb++;
        if (la <= ra) {
            if (ra == i - 1)
                d[1][i] = d[1][i - 1] + d[2][i - 1];
            else
                d[1][i] = d[2][ra + 1];
        }
        if (lb <= rb) {
            if (rb == i - 1)
                d[2][i] = d[2][i - 1] + d[1][i - 1];
            else
                d[2][i] = d[1][rb + 1]; 
        }
        d[1][i] %= int(1e9) + 7;
        d[2][i] %= int(1e9) + 7;
        if (p[i] - p[i - 1] < b) {
            la = i - 1;
        }
        if (p[i] - p[i - 1] < a) {
            lb = i - 1;
        }
    }
    cout << (d[1][n] + d[2][n]) % (int(1e9) + 7) << endl;
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	vector<ll> vec(3);
	rep(i,3) cin>>vec[i];
	sort(begin(vec),end(vec));
	rep(i,3){
		if(vec[i]%2==0){
			cout<<0<<endl;
			return 0;
		}
	}
	cout<<vec[0]*vec[1]<<endl;
}

Measured memory_bytes: 3612
#include<stdio.h>

typedef struct{
  int num;
  char mark;
  int index;
}Card;

int partition(Card*,int,int);
void quicksort(Card*,int,int);

int main(){

  Card a[100000];
  int a_num,i,key,stability=0;

  //入力
  scanf("%d",&a_num);
  for(i = 0; i < a_num; i++){
    scanf(" %c %d",&a[i].mark,&a[i].num);
    a[i].index = i;
  }
  
  //ソート
  key = a[a_num-1].num;
  quicksort(a,0,a_num-1);
  for(i = 0; i < a_num-1; i++){
    if(a[i].num == a[i+1].num && a[i].index > a[i+1].index){
      stability=1;
    }
  }

  //出力
  if(stability == 0)printf("Stable\n");
  else if(stability == 1)printf("Not stable\n");
    for(i = 0; i < a_num; i++){
    printf("%c %d\n",a[i].mark,a[i].num);
  }
  
  return 0;
}



int partition(Card *a, int p, int last)
{
  int key,i,j;
  Card swap;

  key = a[last].num;
  i = p-1;


  for(j = p; j < last; j++){
    if(a[j].num <= key){
      i = i+1;
      swap = a[i];
      a[i] = a[j];
      a[j] = swap;
    }
  }
      swap = a[i+1];
      a[i+1] = a[last];
      a[last] = swap;

      return i+1;
}

void quicksort(Card *a, int p, int last){
  int q;

  if(p < last){
    q = partition(a,p,last);
    quicksort(a,p,q-1);
    quicksort(a,q+1,last);
  }
}

Measured memory_bytes: 1780
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	ll n,w,i,j,ans;
	cin>>n>>w;
	ll cost[n+1];
	ll wt[n+1];
	for(i=1;i<=n;i++)
		cin>>wt[i]>>cost[i];
	ll dp[100005];
	for(i=0;i<=100000;i++)
		dp[i]=2*w;
	dp[0]=0;
	for(i=1;i<=n;i++)
	{
		for(j=100000;j>=cost[i];j--)
			dp[j]=min(dp[j],wt[i]+dp[j-cost[i]]);
	}
	for(i=0;i<=100000;i++)
	{
		if(dp[i]<=w)
			ans=i;
	}
	cout<<ans<<endl;
}


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

int main()
{
	double t;
	vector<double> v;
	while(cin >> t)
	{
		v.push_back(t);
	}
	sort(v.begin(), v.end());

	cout << v.back()-v.front() << endl;
}

Measured memory_bytes: 0
# 2019-11-18 00:38:19(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 

def main():
    n, k = [int(x) for x in sys.stdin.readline().split()]
    s = sys.stdin.readline().rstrip()

    happy_count = sum([0] + [1 for i in range(n-1) if s[i] == s[i+1]])
    
    happy_count += 2 * k
    ans = min(happy_count, n - 1)
    print(ans)
        
if __name__ == "__main__":
    main()



Measured memory_bytes: 4724