akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <climits> // INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX, ULLONG_MAX
#include <cmath>
#include <cstdint>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>

#define INF 1e9
#define REP(i,n) for (int i = 0; i < (b); ++i)
#define LOG(x) cerr << #x << " = " << (x) << endl

using namespace std;

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >>  F;

    int maxSugar = 0;
    int maxWater = 0;
    double maxRate = -1.0;

    for (int waterA = 0; waterA <= F; waterA += 100 * A) {
        for (int waterB = 0, water = waterA; water <= F; waterB += 100 * B, water = waterA + waterB) {
            for (int sugarC = 0; water + sugarC <= F; sugarC += C) {
                for (int sugarD = 0, sugar = sugarC; water + sugar <= F; sugarD += D, sugar = sugarC + sugarD) {
                    if (sugar > E * (water / 100))
                        continue;

                    if (sugar + water == 0)
                        continue;
                    
                    double ra = 1.0 * sugar * 100 / (sugar + water);
                    if (ra > maxRate) {
                        maxSugar = sugar;
                        maxWater = water;
                        maxRate = ra;
                    }
                }
            }
        }
    }
    
    cout << maxSugar + maxWater << " " << maxSugar << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
      
print(num2alpha(n).lower())

Measured memory_bytes: 9168
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
VI t;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n,c,k;
  cin>>n>>c>>k;
  t.resize(n);
  forn(i,n)
    cin>>t[i];
  sort(all(t));
  in sm=0;
  in cet=-1,cnb=0;
  forn(i,n){
    if(cet<t[i] || cnb==0){
      cet=t[i]+k;
      cnb=c;
      ++sm;
    }
    --cnb;
  }
  cout<<sm<<endl;
  return 0;
}


Measured memory_bytes: 1152
def main():
    from itertools import product, zip_longest

    s = input()

    for prod in product('+-', repeat=3):
        formula = ''
        for x, op in zip_longest(s, prod, fillvalue=''):
            formula += x + op
        if eval(formula) == 7:
            print('{}=7'.format(formula))
            return


if __name__ == '__main__':
    main()


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

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

using namespace std;

int main() {
  while(1){
    int n,r;
    cin>>n>>r;
    if(!(n||r))break;
    vector<vector<pair<int,int>>> v(10001);
    REP(i,n){
      int x1,y1,x2,y2;
      cin>>x1>>y1>>x2>>y2;
      v[x1].emplace_back(y1,1);
      v[x1].emplace_back(y2,-1);
      v[x2].emplace_back(y1,-1);
      v[x2].emplace_back(y2,1);
    }
    REP(i,10001)sort(begin(v[i]),end(v[i]));
    int area = 0;
    int circ = 0;
    vector<int> val(10001,0);
    REP(i,10001){
      vector<int> tmp(10001);
      int sum = 0;
      int k=0;
      REP(j,10001){
        while(k<v[i].size()&&v[i][k].first<j)k++;
        while(k<v[i].size()&&v[i][k].first==j){
          sum += v[i][k].second;
          k++;
        }
        tmp[j] = val[j] + sum;
        if(tmp[j]>0)++area;
        if((tmp[j] > 0 && val[j] == 0) || (tmp[j] == 0 && val[j] > 0))
          circ++;
        if(j>0&&((tmp[j]==0&&tmp[j-1]>0)||(tmp[j]>0&&tmp[j-1]==0)))
          circ++;
        if(j==0&&tmp[j]>0)
          circ++;
      }
      swap(tmp,val);
    }
    cout << area << endl;
    if(r==2)
      cout << circ << endl;
  }
  return 0;
}

Measured memory_bytes: 1844
#include<iostream>
using namespace std;
int main(){

	int S, h, m, s;

	cin >> S;

	h = S / 3600;
	m = S % 3600 / 60;
	s = S % 3600 % 60;

	cout << h << ":" << m << ":" << s << endl;

	return 0;

}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define tc() ll T;cin>>T;while(T--)
#define pb push_back

struct cmp {
    bool operator() (const pair<ll,ll> &a,const pair<ll,ll> &b){
        return a.first>b.first;
    }
};

int main() {
    
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    /*-----------------Code Begins Here------------------*/
    
    ll x; cin>>x;
    if(x>=30) cout<<"Yes\n";
    else cout<<"No\n";
    
    /*------------------Code Ends Here-------------------*/
    
    return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define rep(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;

ll n,k;

bool f(ll x){
    ll y=0;
    rep(i,min(70ll,n)){
        y+=x;
        x/=2;
    }
    return y<=k;
}

int main(){
    cin>>n>>k;
    ll l=0,r=1e18+1;
    while(l+1<r){
        ll mid=(r+l)/2;
        if(f(mid))l=mid;
        else r=mid;
    }
    cout<<l<<endl;
}


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

int main() {
    int N;cin >> N;
    map<int, int> mp;
    for (int i = 1; i <= N; i++)
    {
        int j = i, a = i%10, b;
        while(j > 0){
            b = j;
            j /= 10;
        }
        mp[10*b+a]++;
        // string i_str = to_string(i);
        // int s = i_str.size();
        // pair<int, int> p = make_pair((int)i_str[0], (int)i_str[s-1]);
        // mp[p]++;
    }

    int64_t ans = 0;
    for (int i = 1; i <= 9; i++) for (int j = 1; j <= 9; j++) ans += mp[10*i+j]*mp[10*j+i];
    // int keta = 0, ichi = N % 10, sup;
    // int temp = N;
    // while(temp > 0){
    //     keta++;
    //     sup = temp;
    //     temp /= 10;
    // }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const ld eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1; i>=(a); i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl;})

int main(){
	cin.sync_with_stdio(0);

	string s;
	string t;

	cin >> s >> t;

	ll ss = sz(s);
	ll st = sz(t);

	ll len = 0;

	FOR(i,0,ss-st+1){
		ll nlen = 0;
		FOR(j,0,st){
			if(s[i+j] == t[j]){
				nlen++;
			}
		}
		if(nlen > len){
			len = nlen;
		}
	}

	cout << (st - len) << endl;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main() {
	/*int n;
	cin >> n;
	int ans = pow(n, 3);
	cout << ans;*/


	int n;
	cin >> n;
	vector<int>a(n), b(n), c(n);
	rep(i, n)cin >> a[i];
	rep(i, n)cin >> b[i];
	rep(i, n - 1)cin >> c[i];
	int ans = 0;
	ans = accumulate(all(b), 0);
	for (int i = 0; i < n - 1; i++) {
		if (a[i + 1] - a[i] == 1)ans += c[a[i]-1];
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
#include<iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main()
{
    int n, ans = 0;
    cin >> n;
    for(int i = 1; i <= n; i+=2){
        int cnt = 0;
        for(int j = 1; j <= i; j++){
            if(i % j == 0){
                cnt++;
            }
        }
        if(cnt == 8){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int INF=1e9;

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

    string s;
    cin>>s;

    int ans=INF;

    for(int i=0;i<26;i++){
        char c=i+'a';
        int m=0;
        for(int j=0;j<s.size();j++){
            int n=0;//j文字目をcに変換するのに必要な回数
            for(int k=j;k<s.size();k++){
                if(s[k]==c)break;
                n++;
            }
            m=max(m,n);
        }
        ans=min(ans,m);
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 384
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long

void solve()
{
    ll H;
    cin >> H;
    ll count = 0;
    ll monsterCount = 1;
    while (H > 1)
    {
        H = H / 2;
        count += monsterCount;
        monsterCount *= 2;
    }

    cout << count + monsterCount << endl;
}

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


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

# 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 a;
    double b;
    cin >> a >> b;

    int b_int = b * 100 + 0.5;
    ll ans = (a * b_int) / 100;
    cout << ans << endl;
}

Measured memory_bytes: 3688
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	int n;
	long long sum = 0;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		sum = sum + v[i];
	}
	sort(v.begin(), v.end());
	cout << v[0] << " " << v[n - 1] << " " << sum << endl;
}


Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

int main(){
    int r,g,b,n; cin >> r >> g >> b >> n;
    int cnt = 0;
    for(int i = 0; i*r <= n ; i++){
        for(int j = 0 ; j*g <= n; j++){
            int k = n - i*r - j*g;
            int modb = k%b;
            if(modb == 0 and k >= 0) {
                cnt++;
                //cout << i << j << endl;
            }
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL A, B, X;

int main()
{
	in >> A >> B >> X;
	if (A <= X && A + B >= X) out << "YES" << std::endl;
	else out << "NO" << std::endl;
	return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

ll n, k, x[55], y[55], sx[55], sy[55], ans = LONG_LONG_MAX;

int main() {
	cin >> n >> k;
	rep(i,n) {
		cin >> x[i] >> y[i];
		sx[i] = x[i], sy[i] = y[i];
	}
	sort(sx, sx+n);
	sort(sy, sy+n);
	
	rep(xi,n) {
		reps(xj,xi+1,n) {
			rep(yi,n) {
				reps(yj,yi+1,n) {
					int cnt = 0;
					ll x1 = sx[xi], x2 = sx[xj], y1 = sy[yi], y2 = sy[yj];
					rep(i,n) if (x1<=x[i] && x[i]<=x2 && y1<=y[i] && y[i]<=y2) cnt++;
					if (cnt>=k) chmin(ans, (x2-x1)*(y2-y1));
				}
			}
		}
	}
	cout << ans << ln;
}

Measured memory_bytes: 256
n,d=gets.split.map &:to_i
s=[]
kai=[]
n.times{|i|
  s[i]=gets.split.map &:to_i
}
ans=0
[*0...n].combination(2).each{|x,y|
  sum=0
  for j in 0..d-1
    sum+=(s[x][j]-s[y][j])**2
  end
  if Math.sqrt(sum)%1==0
    ans+=1
  end
}
puts ans


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

int n,k;
int a[100011],b[100011];

int f[32];

long long ans;


void gao(int k)
{
    int i;
    //cout<<k<<endl;
    long long t=0;
    for(i=1;i<=n;i++)
    {
        if((a[i]&k)==a[i])
        {
            t+=b[i];
        }
    }
    
    if(ans<t)
    {
        ans=t;
    }
}

int main()
{
    int i,j;
    
    scanf("%d %d",&n,&k);
    for(i=1;i<=n;i++)
    {
        scanf("%d %d",&a[i],&b[i]);
    }
    
    for(i=0;i<=30;i++)
    {
        if((k&(1<<i))!=0)
        {
            f[i]=1;
        }
    }
    
    ans=0;
    int tt=0;
    
    gao(k);
    for(i=30;i>=0;i--)
    {
        if(f[i]==1)
        {
            gao(tt+(1<<i)-1);
            tt+=(1<<i);
        }
    }
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define in insert
#define mp make_pair
#define F first
#define pb push_back
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll exp(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x); x=(x*x); y/=2; } return res;}
ll a[200006];
ll n;
int main(){
     cin>>n;
     if(n%2!=0)
         cout<<0;
     else{
         ll count=0;
         ll x=10;
         while(n>=x){
             count+=n/x;
             x*=5;
         }
         cout<<count;
     }
   
    return 0;
}


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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF 1<<28
#define max 100005
 
 
typedef long long ll;
 
int n, a[100005];
int dp[max];
 
int main()
{
    cin>>n;
    for(int i = 1; i <= n; i++)
        cin>>a[i];
    dp[1] = 0;
    for(int i = 2; i <= n; i++){
        dp[i] = dp[i-1] + abs (a[i] - a[i-1]);
        if(i > 2){
            dp[i] = min(dp[i], dp[i-2] + abs(a[i] - a[i-2]));
        }
    }
    cout << dp[n]<<endl;
    return 0;
}  

Measured memory_bytes: 1024
//  IT'S NEVER TOO LATE...

#include <bits/stdc++.h>
#include <complex>
#define ll long long

#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define forn(i, n) fore(i, 0, n)
#define fori(i, l, r) fore(i, l, (r) + 1)
#define sz(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ms(m) memset(m,0,sizeof(m))

//#define C complex<int>
#define X real()
#define Y imag()

using namespace std; 

const double PI = atan(1)*4;
#define inf 1e9
const int mod=1e9+7;



int main()
{

	#ifndef ONLINE_JUDGE
    freopen("input.txt","r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
    int tt=1;
    //cin>>tt;

    while(tt--)
    {
        //matrix mat(n),m2(n);

    	int x;
    	cin>>x;

    	cout<<!x;
    }
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";

    return 0;
    	
}
                //              NOW IT'S TIME TO WAKE UP... 








Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
constexpr i64 INF = 1010000000000000017LL;
constexpr i64 MOD = 1000000007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) xmax = x; return true;
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) xmin = x; return true;
    return false;
}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr); ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH) cout << unitbuf;
    }
} PROCON_INIT;

void solve() {
    int n, q; cin >> n >> q;
    string s; cin >> s;

    vector<int> sum(n+1, 0);
    for (int i = 0; i < n; ++i) {
        if (i + 1 < n && s[i] == 'A' && s[i+1] == 'C') sum[i+1] = sum[i] + 1;
        else sum[i+1] = sum[i];
    }

    vector<int> ans(q, 0);
    for (int iq = 0; iq < q; ++iq) {
        int l, r; cin >> l >> r;
        --l; --r;
        ans[iq] = sum[r] - sum[l];
    }
    for (auto iq : ans) {
        cout << iq << endl;
    }
}

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

Measured memory_bytes: 1872
#include <stdio.h>
 int main () {
   int a, b, c, d;

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

   if (a > b) {
     d = a;
     a = b;
     b = d;
   }
   if (a > c) {
     d = c;
     c = a;
     a = d;
   }
   if (b > c) {
     d = b;
     b = c;
     c = d;
   }
   
   printf("%d %d %d\n", a, b, c);

   return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
  ll n, k;
  cin>>n>>k;

  if(!k) cout<<n*n<<endl;
  else {

    ll ans=0;
    for(ll b=1;b<=n;b++){
      if(b <= k) continue;
      ll t = n/b;
      ans += (b - k) * t;
      ans += max(n%b-k+1,0LL);
    }
    cout<<ans<<endl;

  }
  return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : c.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>

#include<vector>
using namespace std;

int main() {
	int n;cin>>n;
//	vector<int> dp1(11,0),dp2(11,0),dp3(11,0);
	int def=4;
	for(int i=0;i<9;i++){
		def*=4;
	}
	int ans=0;
	for(int i=0;i<def;i++){
		long long num=0;
		long long numr=0;
		int i2=i;
		int flag3=0;
		int flag5=0;
		int flag7=0;
		int flag0=0;
		while(i2){
			numr*=10;
			if(i2%4==1){
				numr+=3;
				flag3=1;
			}else if(i2%4==2){
				numr+=5;
				flag5=1;
			}else if(i2%4==3){
				numr+=7;
				flag7=1;
			}else{
				flag0=1;
			}

			i2/=4;
		}
		while(numr){
			num*=10;
			num+=numr%10;
			numr/=10;
		}
//		cout<<num<<endl;
		if(flag0)continue;
		if(flag5*flag3*flag7==0)continue;
		if(num<=n){
			ans++;
		}else{
			break;
		}

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

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
int main()
{
    int n, k;
    cin >> n >> k;
    for (int i = k - n + 1; i <= k + n - 1; i++)
    {
        cout << i << " " ;
    }
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<queue<int>> A(N, queue<int>());
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N - 1; j++) {
            int a;
            cin >> a;
            a--;
            A[i].push(a);
        }
    }

    int res = 0;
    queue<int> que1;
    for (int i = 0; i < N; i++) que1.push(i);

    queue<int> que2;
    bool updated = true;

    while (updated) {
        updated = false;
        vector<bool> used(N, false);
        while (!que1.empty()) {
            int i = que1.front(); que1.pop();
            if (!used[i] && !A[i].empty()) {
                int j = A[i].front();
                if (!used[j] && !A[j].empty() && A[j].front() == i) {
                    updated = true;
                    A[i].pop(); A[j].pop();
                    que2.push(i); que2.push(j);
                    used[i] = true; used[j] = true;
                }
            }
        }
        if (updated) res++;
        swap(que1, que2);
    }

    for (int i = 0; i < N; i++) {
        if (!A[i].empty()) {
            cout << "-1" << endl;
            return 0;
        }
    }

    cout << res << endl;
    return 0;
}

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

const int MOD = 1e+9 + 7;


int main()
{
    int N, X;
    cin >> N >> X;
    vector<int> S(N);
    for( int i = 0; i < N; ++i ) cin >> S[i];


    sort( S.begin(), S.end() );
    // dp[i]: 黒板に書かれた文字が i のとき, N回の操作をN!通り行った場合の数の総和
    vector<long long> dp(1000001);
    for( int i = 0; i <= X; ++i ) dp[i] = i;
    for( int i = 0; i < N; ++i ){
        for( int j = X; j > 0; --j ){
            dp[j] = ( i*dp[j] + dp[j%S[i]] ) % MOD;
        }
    }
    cout << dp[X] << endl;

    return 0;
}

Measured memory_bytes: 8064
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){

    string S, T;
    cin >> S >> T;
    int A, B;
    cin >> A >> B;
    string U;
    cin >> U;

    if(U == S){
        A--;
    }
    else{
        B--;
    }

    cout << A << ' ' << B << endl;
}

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

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int N,old,now,flag,qflag;
  cin >> N;
  vector<int> list(N);
  now = 0;
  qflag = 0;
  for (int i = 0; i < N; i++) {
    old=now;
    cin >> now;
    if (old > now) {
      if (old - 1 == now) {
        if (flag == 0) {
          flag = 1;
        } else {
          qflag = 1;
        }
      } else {
        qflag = 1;
      }
    } else if (old == now) {
    } else {
      flag =0;
    }
  }
  if (qflag == 0) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
  cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> vec;
vec.at(i)
vector<vector<int>> vec(10, vector<int>(10));
sort(all(vec));
sort(all(vec), greater<int>());
    //配列の内容表示
dout << "====vecの内容====\n";
for (int i = 0; i < N; i++) dout << vec[i] << endl;
dout << "====ここまで====\n";
*/

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#define MAX_N 1000000
typedef long long ll;
using namespace std;
int main(){
  ll n,z,w;
  ll a,b;
  cin>>n>>z>>w;
  for(int i=0; i<n;i++){
    if(i<n-2)cin>>a;
    if(i==n-2)cin>>a;
    if(i==n-1)cin>>b;
  }
  if(n==1)a=b; 
  cout<<max(abs(w-b), abs(a-b))<<endl;
  return 0;
}

Measured memory_bytes: 256
class Factorial:
    def __init__(self, max_fact, mod):
        #mod should be prime number
        #using homogeneous_product(n,r), max_fact ≧ max(n+r-1)
        f = [1] * 2
        for idx in range(2, max_fact + 1):
            f += [f[idx - 1] * idx % mod]
        fi = [pow(f[-1], mod - 2, mod)]
        for idx in range(max_fact, 0, -1):
            fi += [fi[-1] * idx % mod]
        fi = fi[::-1]
        self.mod = mod
        self.f = f
        self.fi = fi

    def factorial(self, n):
        return self.f[n]

    def factorial_inverse(self, n):
        return self.fi[n]

    def combination(self, n, r):
        f = self.f
        fi = self.fi
        return f[n] * fi[r] * fi[n - r] % self.mod

    def permutation(self, n, r):
        return self.f[n] * self.fi[n - r] % self.mod

    def homogeneous_product(self, n, r):
        f = self.f
        fi = self.fi
        return f[n + r - 1] * fi[r] * fi[n - 1] % self.mod


max_fact = 5 * 10**5
mod = 10**9 + 7
fact_instance = Factorial(max_fact, mod)
comb = fact_instance.combination
perm = fact_instance.permutation

N, M = [int(_) for _ in input().split()]
ans = 0
for p in range(N + 1):
    ans += (-1)**p * comb(N, p) * perm(M - p, N - p)
    ans %= mod
ans *= perm(M, N)
ans %= mod
print(ans)


Measured memory_bytes: 129120
#include<bits/stdc++.h>
using namespace std;
string s;
bool mark[300];
vector <char> vec;
int main(){
	cin>>s;
	int n=s.size();
	for(int i=0;i<n;i++){
		mark[(int)s[i]]=true;
	}
	for(int i=(int)'a';i<(int)'z';i++){
		if(!mark[i]){
			cout<<s<<char (i);
			return 0;
		}
	}
	int t=n;
	for(int i=n-1;i>=0;i--){
		t--;
		for(int j=0;j<(int)vec.size();j++){
			if(vec[j]>s[i]){
				for(int k=0;k<t;k++){
					cout<<s[k];
				}
				cout<<vec[j];
				return 0;
			}
		}
		vec.push_back(s[i]);
		sort(vec.begin(),vec.end());
	}
	cout<<-1;
}


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

using namespace std;


using Graph = vector<vector<int>>;

void solve() {
    int N, M; cin >> N >> M;
    Graph G(N);
    for (int i = 0; i < M; i++) {
        int a, b; cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    queue<int> q;
    vector<int> sign(N, -1);
    
    q.push(0);
    while (!q.empty()) {
        int cur = q.front();
        q.pop();
        for (auto g : G[cur]) {
            if (sign[g] == -1) {
                sign[g] = cur;
                q.push(g);
            }
        }
    }

    for (int i = 1; i < N; i++) {
        if (sign[i] == -1) {
            cout << "No" << endl;
            return;
        }
    }

    cout << "Yes" << endl;
    for (int i = 1; i < N; i++) cout << sign[i] + 1 << endl;
}


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

Measured memory_bytes: 10212
def dfs(cnt, lowest, lst):
    global ans
    if cnt > n:
        return
    for i in range(lowest, m+1):
        lst.append(i)
        dfs(cnt+1, i, lst)
        lst.pop()
    if cnt == n:
        num = 0
        for i in range(q):
            a, b, c, d = ab[i]
            if lst[b-1] - lst[a-1] == c:
                num += d
        ans = max(num, ans)

n,m,q = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(q)]
ans = 0
dfs(0, 1, [])

print(ans)

Measured memory_bytes: 9224
h,w=map(int,input().split())
s=[]
cost=[]
for i in range(h):
	S=list(input())
	COST=[0 for i in range(w)]
	s.append(S)
	cost.append(COST)
#print(s) ->s[h][w]
#print(cost)
if s[0][0]=='#':
	cost[0][0]=1
for i in range(h):
	for j in range(w):
		if s[i][j]=='#':
			if i==0:
				if j!=0:
					if s[0][j-1]!='#':
						cost[0][j]=cost[0][j-1]+1
					else:
						cost[0][j]=cost[0][j-1]
			elif j==0:
				if s[i-1][j]!='#':
					cost[i][0]=cost[i-1][0]+1
				else:
					cost[i][0]=cost[i-1][0]
			else:
				cost1=cost[i-1][j]
				if s[i-1][j]!='#':
					cost1+=1
				cost2=cost[i][j-1]
				if s[i][j-1]!='#':
					cost2+=1
				cost[i][j]=min(cost1,cost2)
		else:
			if i==0:
				if j!=0:
					cost[0][j]=cost[0][j-1]
			elif j==0:
				cost[i][0]=cost[i-1][0]
			else:
				cost[i][j]=min(cost[i-1][j],cost[i][j-1])
print(cost[h-1][w-1])

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  vector<int> b(n + 1), ans;
  for (int i = n; i >= 1; --i) {
    int s = 0;
    for (int j = i + i; j <= n; j += i) {
      s ^= b[j];
    }
    if (s != a[i]) {
      b[i] = 1;
      ans.push_back(i);
    }
  }
  printf("%d\n", int(ans.size()));
  for (size_t i = 0; i < ans.size(); ++i)
    printf("%d%c", ans[i], " \n"[i + 1 == ans.size()]);
  return 0;
}



Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <cctype>

using namespace std;

typedef string::const_iterator State;

string Cipher(State &begin, State &end);
string String(State &begin, State &end);
string Letter(State &begin);

string Cipher(State &begin, State &end)
{
    if (begin == end)
    {
        return "";
    }
    string ret;
    string str = String(begin, end);
    if (str.empty())
    {
        return "";
    }
    ret += str;
    ret += Cipher(begin, end);
    return ret;
}

string String(State &begin, State &end)
{
    string ret;
    if (*begin == '[')
    {
        ++begin;
        ret = Cipher(begin, end);
        reverse(ret.begin(), ret.end());
        ++begin;
    }
    else
    {
        ret = Letter(begin);
    }
    return ret;
}

string Letter(State &begin)
{
    int d = 0;

    while (true)
    {
        if (*begin == '+')
        {
            ++d;
        }
        else if (*begin == '-')
        {
            --d;
        }
        else
        {
            break;
        }
        ++begin;
    }

    int c = *begin;
    if (c == '?')
    {
        c = 'A';
    }
    else if (isupper(c))
    {
        d %= 26;
        c += d;
        if ('Z' < c)
        {
            c -= 26;
        }
        else if (c < 'A')
        {
            c += 26;
        }
    }
    else
    {
        return "";
    }

    ++begin;
    return string(1, c);
}

int main()
{
    string line;
    while (getline(cin, line), line != ".")
    {
        State begin = line.begin();
        State end = line.end();
        cout << Cipher(begin, end) << endl;
    }

    return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define per(i,s,n) for(int i=n-1;i>=s;i--)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

struct Sieve{
  ll n;
  vector<ll> f, primes;
  Sieve(ll n):n(n),f(n+1){
     f[0]=f[1]=-1;
     for(ll i=2;i<=n;i++){
       if(f[i]){
         continue;
       }
       primes.push_back(i);
       f[i]=i;
       for(ll j=i*i;j<=n;j+=i){
         if(!f[j]) f[j]=i;
       }
     }
  }
  bool isPrime(ll x){
    return f[x]==x;
  }
  
  vector<ll> factorlist(ll x){
    vector<ll> res;
    while(x!=1){
      res.push_back(f[x]);
      x/=f[x];
    }
    return res;
  }
  
  vector<P> factor(ll x){
    vector<ll> fl= factorlist(x);
    if(fl.size()==0){
      return {};
    }
    vector<P> res(1,P(fl[0],0));
    for(ll p : fl){
      if(res.back().first==p){
        res.back().se++;
      }
      else{
        res.emplace_back(p,1);
      }
    }
    return res;
  }
  
  ll cnt(ll x){
    vector<P> pri=factor(x);
    ll ans=1;
    rep(i,pri.size()){
      ans*=(pri[i].se+1);
    }
    
    return ans;
  }
};


int main(){
  ll n;
  cin>>n;
  Sieve p(n);
  vector<ll> pri;
  ll ans=0;
  rep(i,n){
    ans+=p.cnt(i+1)*(i+1);
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 89768
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, K = MAP()
xy = [LIST() for _ in range(N)]
x, y = zip(*xy)

x = sorted(x)
y = sorted(y)

ans = INF
for ax, bx in combinations(x, 2):
	for ay, by in combinations(y, 2):
		cnt = 0
		for cx, cy in xy:
			if ax <= cx <= bx and ay <= cy <= by:
				cnt += 1
		if K <= cnt:
			ans = min(ans, (bx-ax)*(by-ay))

print(ans)

Measured memory_bytes: 79688
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int a, b;
    cin >> a >> b;
    cout << a * b;
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
const int N=2e5+7;
int a[N];
int main()
{
	int n;
	cin>>n;
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(i!=1)
		{
			if(a[i]<a[i-1])
			{
				ans+=a[i-1]-a[i];
				a[i]=a[i-1];
			}
		}
	}
	cout<<ans;
	return 0;
	return 0;
} 

Measured memory_bytes: 3936
#include<bits/stdc++.h>
using namespace std;
int main()
{
     int c1=0,c2=0,c3=0,c4=0,n;
     cin>>n;
     string s[n];
     for(int i=0 ; i<n ; i++)
     {
         cin>>s[i];
     }
     for(int i=0 ; i<n ; i++)
     {
         if(s[i]=="AC")c1++;
         else if(s[i]=="WA")c2++;
         else if(s[i]=="TLE")c3++;
         else c4++;
     }

     cout<<"AC x "<<c1<<endl;
     cout<<"WA x "<<c2<<endl;
     cout<<"TLE x "<<c3<<endl;
     cout<<"RE x "<<c4<<endl;
}


Measured memory_bytes: 6740
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>


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

  int n, m;
  std::cin >> n >> m;

  std::vector<std::string> image(n, std::string());
  for (auto&& row : image) {
    std::cin >> row;
  }

  std::vector<std::string> templateImage(m, std::string());
  for (auto&& row : templateImage) {
    std::cin >> row;
  }

  for (int i = 0, im = n - m + 1; i < im; i++) {
    for (int j = 0, jm = n - m + 1; j < jm; j++) {
      bool isDiffer = false;
      for (int k = 0; k < m; k++) {
        for (int l = 0; l < m; l++) {
          if (image[i + k][j + l] != templateImage[k][l]) {
            isDiffer = true;
            break;
          }
        }
      }
      if (!isDiffer) {
        std::cout << "Yes" << std::endl;
        return EXIT_SUCCESS;
      }
    }
  }
  std::cout << "No" << std::endl;

  return EXIT_SUCCESS;
}


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

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	if (n <= 81)
	{
		for (int i = 1; i < 10; i++)
		{
			for (int j = 1; j < 10; j++)
			{
				if (n == i*j)
				{
					cout << "Yes";
					return 0;
				}
			}
		}
	}
	
	cout << "No";

	
	
	return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#define S 100005
using namespace std;
int l[S]={0};

int main(){
    int N,a,b;
    cin>>N;
    l[1]=1;
    for(int i=0;i<N;i++){
        cin>>a>>b;
        l[a]++;
        l[b+1]--;
    }
    for(int i=2;i<S;i++){
        l[i]+=l[i-1];
    }
    int val=0;
    for(int i=1;i<S;i++){
        if(l[i]>=i){val=i;}
    }        
    cout<<val-1<<endl;
    return 0;
}  



Measured memory_bytes: 3492
str = gets.chomp
q = gets.to_i

q.times do
	command = gets.split
	a, b = command[1].to_i, command[2].to_i

	case command[0]
	when 'print'
		puts str[a, b-a+1]
	when 'reverse'
		str = str[0, a] + str[a, b-a+1].reverse + str[b+1, str.length-b]
	when 'replace'
		str = str[0, a] + command[3] + str[b+1, str.length-b]
	end
end

Measured memory_bytes: 6256
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

const int INF=100000;
const int MAX_N=105;
const int MAX_M=105;
const int di[]={1,0},dj[]={0,1};

/* bfs pattern of function */


int main()
{
    int h,w;
    cin>>h>>w;
    vector< vector<char> > sw(h,vector<char>(w,'.'));
    rep(i,h)rep(j,w)
    {
        cin>>sw[i][j];
    }
    vector< vector<int> > dp(h,vector<int>(w,0));
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(i==0 && j==0)
            {
                dp[i][j]=0;
            }
            else if(i==0)
            {
                dp[i][j]=sw[i][j]==sw[i][j-1]?dp[i][j-1]:dp[i][j-1]+1;
            }
            else if(j==0)
            {
                dp[i][j]=sw[i][j]==sw[i-1][j]?dp[i-1][j]:dp[i-1][j]+1;
            }
            else
            {
                dp[i][j]=min(sw[i][j]==sw[i][j-1]?dp[i][j-1]:dp[i][j-1]+1,sw[i][j]==sw[i-1][j]?dp[i-1][j]:dp[i-1][j]+1);
            }
            

        }
    }
    int ans=dp[h-1][w-1]/2;
    if(sw[0][0]=='#' || sw[h-1][w-1]=='#')ans++;
    cout<<ans;

    

    
        
    

}

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

int main(void) {
	int i, n, count_t, count_h;
	char word1[102];
	char word2[102];
	
	scanf("%d\n", &n);
	for(i=0,count_t=0,count_h=0;i<n;i++) {
		scanf("%s %s\n", word1, word2);
		if(strcmp(word1, word2) == 0) {
			count_t += 1;
			count_h += 1;
		} else if(strcmp(word1, word2) > 0) {
			count_t += 3;
		} else {
			count_h += 3;
		}
	}
	
	printf("%d %d\n", count_t, count_h);
	
	return 0;
}

Measured memory_bytes: 608
fn min_option(x: Option<usize>, y: Option<usize>) -> Option<usize> {
    if x == None && y == None {
        return None;
    } else if x == None {
        return y;
    } else if y == None {
        return x;
    } else {
        if x.unwrap() <= y.unwrap() {
            return x;
        } else {
            return y;
        }
    }
}
fn main() {
    let N: usize = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim().parse::<usize>().unwrap()
    };
    let S = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s
    };
    let mut ans = 0;
    let mut index: usize = 0;
    while index < N - 1 {
        match min_option(S[index..].find("OX"), S[index..].find("XO")) {
            None => break,
            Some(i) => {
                ans += 1;
                index += i + 2;
            },
        }
    }
    println!("{}", ans);
}



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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 100010, mod = 1e9 + 7;

int n;
int a[N], b[N], c[N];
LL sum[N], cnt[N];

int main()
{
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", a + i);
    for(int i = 1; i <= n; i++) scanf("%d", b + i);
    for(int i = 1; i <= n; i++) scanf("%d", c + i);
    sort(a + 1, a + 1 + n);
    sort(b + 1, b + 1 + n);
    sort(c + 1, c + 1 + n);

    for(int i = 1, j = 1; i <= n; i++)
    {
        while(j <= n && b[i] >= c[j]) j++;
        if(j > n) break;
        cnt[i] = n - j + 1;
    }

    for(int i = 1; i <= n; i++) sum[i] = sum[i - 1] + cnt[i];

    LL res = 0;
    for(int i = 1, j = 1; i <= n; i++)
    {
        while(j <= n && a[i] >= b[j]) j++;
        if(j > n) break;
        res += sum[n] - sum[j - 1];
    }

    printf("%lld\n", res);
    return 0;
}


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


int main() {
long N,M,K;
cin>>N>>M>>K;
vector<long> a(N);
vector<long> b(M);
vector<long> A(N+1);
vector<long> B(M+1);
for(int i=0;i<N;i++){
  cin>>a[i];
}
for(int i=0;i<M;i++){
  cin>>b[i];
}

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

for(int i=1;i<=M;i++){
  B[i]=B[i-1]+b[i-1];
}
int  ans=0;
int j=M;
for(int i=0;i<=N;i++){
  long t=A[i];
  auto it = upper_bound(B.begin(),B.end(),K-t);
  //cout<<it-B.begin()<<endl;
  int j=it-B.begin()-1;
  if(j>=0&&j<=M)  ans=max(ans,i+j);
}
cout<<ans<<endl;
}


Measured memory_bytes: 9544
from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)

def ReadInput():
	return [int(i) for i in input().split(" ")]

(R, C) = ReadInput()
N = int(input())
VectorSet = set() 
Grid = defaultdict(list)
for i in range(N):
	(r, c, a) = ReadInput()
	Grid[("R", r)].append((("C", c), a))
	Grid[("C", c)].append((("R", r), a))
	VectorSet.add(("R", r))
	VectorSet.add(("C", c))

def iteration(vector):
	VectorSet.discard(vector)
	for (v, a) in Grid[vector]:
		temp = a - VectorCover[vector]
		if (v in VectorCover):
			if(temp != VectorCover[v]):
				print("No")
				exit()
		else:
			VectorCover[v] = temp
			iteration(v) 

while(len(VectorSet) != 0):
	vector = VectorSet.pop()
	VectorCover = dict() 
	VectorCover[vector] = 0
	iteration(vector)
	minR = min(a for (p, a) in VectorCover.items() if (p[0] == "R"))
	minC = min(a for (p, a) in VectorCover.items() if (p[0] == "C"))
	if (minR + minC < 0):
		print("No")
		exit()

print("Yes")

Measured memory_bytes: 166868
#include<stdio.h>

int main(void){
  int n;
  int i = 0;
  scanf("%d", &n);
  while ( i <= n ) {
    if ( (n - i) % 4 == 0 ) {
      printf("Yes\n");
      return 0;
    }
    i += 7; 
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
typedef vector<int> vi;
typedef vector<double> vd;
 
double mypow(double b ,int e){
      if(e == 0) return 1;
      if(e%2==0)
            return mypow( b*b, e/2 );
      else
            return mypow( b*b, e/2 ) * b;
}
 
int main(){
 
 
      int N,M,L; cin >> N >> M >> L ;
      if(N==1){
            cout << 1.0 << endl;
            return 0;
      }
      vector<vd> prob(N,vd(M+1,0.0));
      vector<vd> dist(N,vd(M+1,0.0));
 
      vd p(N),t(N),v(N);
      for(int i=0; i<N; i++) cin >> p[i] >> t[i] >> v[i];
 
      // PRE PROCESS
      for(int i=0; i<N; i++){
            dist[i][0] = (double)L / v[i];
            for(int j=1; j<=M; j++){
                  dist[i][j] = dist[i][j-1] + t[i];
            }
      }
      for(int i=0; i<N; i++)
            prob[i][0] = mypow((100-p[i])/100,M);
      for(int i=0; i<N; i++){
            for(int j=1; j<=M; j++){
                  if(p[i] != 100)
                        prob[i][j] = (prob[i][j-1] * (p[i]/100)) / ((100-p[i])/100);
                  else
                        prob[i][j] = 1.0;
            }
      }
      double comb = 1;
      for(int j=1; j<=M; j++){
            comb = comb * (M - j + 1) / j; 
            for(int i=0; i<N; i++){
                  prob[i][j] *= comb;
            }
      }
       
      vector<vd> sum = prob;
      for(int i=0; i<N; i++){
            for(int j=M-1; j>=0; j--){
                  sum[i][j] += sum[i][j+1];
                  if(sum[i][j] > 1) sum[i][j] = 1;
            }
      }
 
      vector<vd> ans = prob;
      for(int i=0; i<N; i++){
            for(int j=0; j<=M; j++){
                  for(int k=0; k<N; k++){
                        if(i==k) continue;
                        int id = upper_bound(dist[k].begin(),dist[k].end(), dist[i][j]) - dist[k].begin();
                        if(id > M) ans[i][j] = 0.0;
                        else       ans[i][j] *= sum[k][id];
 
                  }
            }
      }
 
      for(int i=0; i<N; i++){
            double tmp = 0.0;
            if(p[i] == 100) tmp = ans[i][M];
            else
                  for(int j=0; j<=M; j++)
                        tmp += ans[i][j];
            if(tmp > 1) tmp = 0;
            printf("%.10f\n",tmp);
      }
                         
}

Measured memory_bytes: 3380
#include<stdio.h>
#include<string.h>
#define LIM 1200
 
int main()
{
  char str[LIM];
  int i, j=0, strnum;
  int num[26];
 
 
  for(i=0; i < 26; i++){
    num[i] = 0;
  }
 
  while( scanf("%c", &str[j]) != EOF){
 
    if('A'<=str[j] && str[j] <= 'Z'){
      str[j] += 'a'-'A';
    }
  
    strnum = str[j]-'a';
      num[strnum]++;
      j++;
 
  }
 
  for(i=0; i<26; i++){
    printf("%c : %d\n", 'a'+i, num[i]);
  }
 
return 0;
}


Measured memory_bytes: 2104
#include <iostream>
using namespace std;
int main(){
    int a,b,c,t;
    cin >>a>>b>>c;
    if(a>b){
        t=a;
        a=b;
        b=t;
    }
    if(b>c){
        t=b;
        b=c;
        c=t;
    }
    if(a>b){
        t=a;
        a=b;
        b=t;
    }
    cout << a <<" "<< b << " "<< c <<endl;
    return 0;
}


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

int main (void) {
    char s[11] = {'\0'};
    char *year, *month;
    char **endptr = NULL;
    scanf("%s", s);

    year = strtok(s, "/");
    long year_l = strtol(year, endptr, 10);
    month = strtok(NULL, "/");
    long month_l = strtol(month, endptr, 10);

    if ( year_l < 2019 ) {
        printf("Heisei\n");
    }
    else if ( year_l == 2019 ) {
        if ( month_l <= 4 ) {
            printf("Heisei\n");
        }
        else {
            printf("TBD\n");
        }
    }
    else {
        printf("TBD\n");
    }
    return 0;
}

Measured memory_bytes: 128