akhauriyash/Code-Regression huggingface dataset:
/**
 *    Author:  "Robin Singh" !!!
 *    BrainyIsTheNewSexy     (CodeForces)
 *    rob_in_1               (Other OJs)
**/
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define mp make_pair
#define szz(v) ((int)(v).size())  
#define fr(i, j, k) for(int i = j; i < k; i++)     
#define bk(i, j, k) for(int i = j-1; i >= k; i--)
#define frit(it, a) for(__typeof((a).begin()) it = a.begin(); it != a.end(); ++it)
#define mem(ptr)  memset(ptr, 0, sizeof ptr)
#define str string 
#define rtn return 
#define nl "\n"
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector <int> vi;
typedef vector <long long> vll;
typedef vector < pair<int,int> > vpii;
typedef vector < pair<ll, ll> > vpll;
const long long mod = 1e9+7;
const long double eps = 1e-9;
const long long INF = (1LL<<61);
const int inf = (1<<30);
const int nn = 2e5+5;
//---------------------------------------------*DEBUGGING*--------------------------------------------------------->]
#define dbg( args...) { vector<string> _v = split( #args, ','); err( _v.begin(), args); cerr << '\n'; }
vector<string> split( const string& s, char c) { vector<string> v; stringstream ss( s); string x; 
while ( getline( ss, x, c)) v.emplace_back(x); return move(v); }
void err( vector<string>::iterator it) { } 
template<typename T, typename... Args>
void err( vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr( ( *it)[0] == ' ', it -> length()) << " = " << a << '\t'; err( ++it, args...); }
//----------------------------------------------------------------------------------------------------------------->]
//*****************************************!Template Ends Here!*****************************************************]

int c[26], d[26];
int a[nn], b[nn];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    str s, t;
    cin >> s >> t;
    int n = szz(s);
    fr(i, 0, n){
        c[s[i]-'a']++;
        d[t[i]-'a']++;
    }
    fr(i, 0, 26){
        a[c[i]]++;
        b[d[i]]++;
    }
    fr(i, 1, n+1){
        if(a[i] != b[i]){
            cout << "No";
            rtn 0;
        }
    }
    cout << "Yes";
    return 0;
}

//->INTUITIONS are not to be ignored. They represent data processed too fast for the conscious mind to comprehend !!

Measured memory_bytes: 916
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
int P=998244353;
int main(){
	int a,b,h,m;
	cin >> a >> b >> h >> m;
	double degh = h*30 + m*0.5, degm = m*6, deg=degh-degm;
	double c = a*a+b*b-2*a*b*cos(3.14159265358979*(deg/180));
	printf("%.15f\n", sqrt(c));
	return 0;
}


Measured memory_bytes: 4076
#include<stdio.h>
int main(){
  int x,y,w,h,n,i,j,a,b;

  int z;
  scanf("%d",&z);

  for(j=0;j<z;j++){
    scanf("%d %d %d %d",&x,&y,&w,&h);
    scanf("%d",&n);
    int c=0;
    for(i=0;i<n;i++){
      scanf("%d %d",&a,&b);
      if(a>=x&&a<=w+x&&b>=y&&b<=h+y){
	c++;
      }
    }
    printf("%d\n",c);
  }
  return(0);
}

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

int solve(int N, int K){
  int t = 1;
  int n = 1;
  int a = 1;

  while(1){
    n = (K+a-1)/K;
    a += n;
    if ( N < a ) return t;
    t++;
  }
}

int main() {
  int N, K; cin >> N >> K;
  int t = solve(N, K);
  cout << t << endl;
}


Measured memory_bytes: 3124
/*input
CSS
CSR
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define sz(_a) (ll)(_a.size())
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const ll maxn=200005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;

ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
   string a,b;
   cin>>a>>b;
   int ans=0;
   REP(i,3){
    ans+=a[i]==b[i];
   }
   cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	string s; cin >> s;
	if(s.size() & 1) puts("No");
	else{
		for(ll i=0; i<s.size(); i+=2){
			if(s.substr(i,2) != "hi"){
				puts("No");
				return 0;
			}
		}
		puts("Yes");
	}
}

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

int main() {
	int n, k, l[50];
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> l[i];
	sort(l, l + n, greater<>());
	cout << accumulate(l, l + k, 0) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N,D,X;
  cin>>N>>D>>X;
  rep(i,0,N){
    int k;
    cin>>k;
    int K=k;
    X++;
    while(1){
      if(K>=D)
        break;
      X++;
      K+=k;
      }
    }
  cout<<X;
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll gu,ki;
    
//-------------------------↓↓↓↓↓↓------------------------
    
//------ 自分を天才だと信じる ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    rep(i,n){
        cin>>a[i];
        if(a[i]%2==0)gu++;
        else ki++;
    }
    if(gu==0||ki==0)Cout(0);
    else{
        if(ki%2==0)Cout(n-2);
        else Cout(n-1);
    }
    return 0;
}


Measured memory_bytes: 4744
N = int(input())
h = list(map(int, input().split()))
cost = [0]*(N+1)
for i in range(1,N):
    if(i==1):
        cost[1] =abs(h[1]-h[0])
    else:
        cost[i] = min(abs(h[i-2]-h[i])+cost[i-2],abs(h[i-1]-h[i])+cost[i-1])

print(cost[N-1])


Measured memory_bytes: 20640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*
*/
using Graph = vector<bitset<10>>;
ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}
#define mod 1000000007
ll factorial(ll n){
    ll i = 1;
    ll ans = 1;
    while(i<=n){
        ans = (i*ans)%mod;
        i++;
    }
    return ans;
}
 
ll calc(ll a,ll b ,ll p){
    if(b == 0){
        return 1;
    }
    else if(b %2 == 0){
        ll d = calc(a,b/2,p);
        return ((d%p)*(d%p))%p;
    }
    else{
        return ((a%p)*calc(a,b-1,p))%p;
    }
}


int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  if(n == 2) cout << 0 << endl;
  else{
  ll ca = 1;
  for(ll i = n;i>=n-a+1;i--){
    ca *= i;
    ca %= mod;
  }
  ll nCa = (ca*calc(factorial(a),mod-2,mod))%mod;

  ll cb = 1;
  for(ll i = n;i>=n-b+1;i--){
    cb *= i;
    cb %= mod;
  }
  ll nCb = (cb*calc(factorial(b),mod-2,mod))%mod;
  //cout << nCa << " " << nCb << endl;
  
  ll nzyo = calc(2, n, 1000000007);
  ll ans = nzyo -1;
  if(ans - nCa >= 0) ans -= nCa;
  else ans = ans - nCa + mod;

  if(ans - nCb >= 0) ans -= nCb;
  else ans = ans - nCb + mod;
 
  cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define endl "\n"    
typedef long long ll;
#define int long long
//#define int unsigned long long

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

    int m,d;
    cin>>m>>d;

    int cnt=0;
    for(int i=22;i<=d;i++)
    {
        int f=i,rem,rem2;
        int count=0;
        while(f>0)
        {
            if(count==0)
            rem=f%10;
            else
            rem2=f%10;
            ++count;
            f=f/10;
        }
        int x=rem*rem2;
        if(rem>=2 && rem2>=2 && x<=m)
        {
            ++cnt;
        }
    }
    cout<<cnt;

}    


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

int main()
{
    string s;
    cin >> s;
    vector<int> a(4);
    rep(i, 0, s.size()) a[i] = s[i] - '0';
    rep(bi, 0, 1<<3){
        string ans;
        int sum = a[0];
        rep(i, 1, 4){
            if(bi>>(i-1)&1){
                sum += a[i];
                ans += '+';
            }
            else{
                sum -= a[i];
                ans += '-';
            }
        }
        ans += '=';
        if(sum == 7){
            rep(i, 0, 4){
                cout << a[i] << ans[i];
            }
            cout << 7 << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3632
n = int(raw_input())
nums = map(float, raw_input().split())
sum = 0.0
for i in xrange(n):
	sum += nums[i]
avg = sum / float(n)
ans, idx = 10000.0, 0
for i in xrange(n):
	if abs(avg-nums[i]) < ans:
		ans = abs(avg-nums[i])
		idx = i
print idx 


Measured memory_bytes: 2568
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) int(a.size())
#define clr(a) memset(a,0,sizeof(a))
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int N=110;
const int mod=0;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
int n,mx[N],st[N],tp=0,f[N];
vector<int> E[N];
void dfs(int u,int fa) {
    mx[u]=0;
    for(int v:E[u]) if(v!=fa) dfs(v,u),chkmax(mx[u],mx[v]+1);
}
void dfs2(int u,int fa,int d) {
    int son=0;
    for(int v:E[u]) if(v!=fa) dfs2(v,u,d+1),++son;
    chkmax(f[d],son);
}
int main() {
    n=gi();
    for(int i=1,u,v;i<n;i++) u=gi(),v=gi(),E[u].pb(v),E[v].pb(u);
    int ans=inf;
    for(int i=1;i<=n;i++) dfs(i,0),ans=min(ans,mx[i]);
    for(int i=1;i<=n;i++) {
        dfs(i,0);
        if(ans==mx[i]) st[++tp]=i;
    }
    ll leaf;
    if(tp==1) {
        printf("%d ",++ans);
        int x=st[1];
        dfs2(x,0,0);
        leaf=1;
        for(int i=0;i<ans-1;i++) leaf*=f[i];
        for(int y:E[x]) {
            memset(f,0,sizeof(f));
            dfs2(x,y,0),dfs2(y,x,0);
            ll tmp=2;
            for(int i=0;i<ans-1;i++) tmp*=f[i];
            chkmin(leaf,tmp);
        }
        printf("%lld\n",leaf);
    }
    else {
        printf("%d ",ans);
        int x=st[1],y=st[2];
        dfs2(x,y,0),dfs2(y,x,0);
        leaf=2;
        for(int i=0;i<ans-1;i++) leaf*=f[i];
        printf("%lld\n",leaf);
    }
    return 0;
}


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

using namespace std;

double a,b,c,d,e,f;

int main(){
	while(cin >> a >> b >> c >> d >> e >> f){
		printf("%0.3lf ",(c/a)-((b*c*d-a*b*f)/(a*b*d-a*a*e)));

		printf("%0.3lf\n",(c*d-a*f)/(b*d-a*e));
	}
    return 0;
}

Measured memory_bytes: 3160
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define int long long
using namespace std;
signed main() {
	int X, t;
	cin >> X >> t;

	if (X - t < 0) {
		cout << 0 << endl;
	}
	else {
		cout << X - t << endl;
	}
}


Measured memory_bytes: 3608
// Author :mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

 
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second
 
ll const N=1e5+5;
ll const mod=1e9+7;
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return y; else return gcd(y%x,x);}


struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
       
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
struct compare { 
    bool operator()(const pair<ll, ll>& value,  
                                const ll& key) 
    { 
        return (value.first < key); 
    } 
    bool operator()(const ll& key,  
                    const pair<ll, ll>& value) 
    { 
        return (key < value.first); 
    } 
}; 

bool compare1(const pair<ll,ll> &a, 
            const pair<ll,ll> &b) 
{ 
    if(a.first<b.first) 
        return true ;
    else if(a.first==b.first) 
        return (a.second > b.second); 
    else return false;
} 

ll powmod(ll x, ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        y>>=1;
        if(y<=0)
            break;

        x=(x*x)%mod;
    }

    return res;
}


int main()
{
 
 
       ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
       /* #ifndef ONLINE_JUDGE
            freopen("input.txt", "r", stdin);
            freopen("output.txt", "w", stdout);
        #endif */


        ll tt=1;
        //cin>>tt;

        while(tt--)
        {
            ll n,m;
            cin>>n>>m;


            if(n==m)
                cout<<"Yes"<<endl;
            else
                cout<<"No"<<endl;







        }  
 
}

Measured memory_bytes: 384
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
		sc.close();
		int ans = n * a;
		ans = Math.min(ans, b);
		System.out.println(ans);
	}
}


Measured memory_bytes: 20948
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int[] a=new int[3];
    for(int i=0;i<3;i++){
      a[i]=sc.nextInt();
    }
    Arrays.sort(a);
    System.out.println(a[0]+a[1]);
  }
}

Measured memory_bytes: 20948
#include<cstdio>
using namespace std;
int main(){
	int n,ans=1e7;
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		int a=i,b=n-i,num=0;
		while (a) num+=a%10,a/=10;
		while (b) num+=b%10,b/=10;
		if (num<ans) ans=num;
	}
	printf("%d",ans);
	return 0;	
}

Measured memory_bytes: 128
# https://atcoder.jp/contests/abc088/tasks/abc088_d

H, W = map(int, input().split())
s = [input() for _ in range(H)]
d = [[-1] * W for _ in range(H)]

# 0,0 to h-1, w-1
d[0][0] = 0

queue = []
queue.append([0, 0])

while len(queue) > 0:
    p = queue.pop(0)
    y, x = p[0], p[1]

    dx4 = [0, 0, 1, -1]
    dy4 = [1, -1, 0, 0]

    for dx, dy in zip(dx4, dy4):
        next_y = y + dy
        next_x = x + dx
        if 0 <= next_y < H and 0 <= next_x < W and s[next_y][next_x] != "#" and d[next_y][next_x] == -1:
            d[next_y][next_x] = d[y][x] + 1
            queue.append([next_y, next_x])

count = 0
for l in s:
    count += l.count(".")

if d[H-1][W-1] == -1:
    print(-1)
else:
    print(count - d[H-1][W-1] - 1)

# [print(l) for l in s]
# [print(l) for l in d]


Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
#define ll long long
static const int MAX = 1000010;
static const ll INFTY = 1e12;
static const int NUMMAX = 300;


int main(){

  string S;

  cin >> S;

  if( S == "Sunny" ){
    S = "Cloudy";
  } else if( S == "Cloudy" ){
    S = "Rainy";
  } else {
    S = "Sunny";
  }

  cout << S << endl;

  return 0;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i, j, minj, temp, count, N, A[100];
  scanf("%d", &N);
  if(N >= 1 && N <= 100){
    for(i = 0; i < N; i++)
      scanf("%d", &A[i]);
    
    for(i = 0; i < N; i++){
      minj = i;
      for(j = i; j < N; j++){
	if (A[j] < A[minj])
	  minj = j;
      }
      if(i != minj){
	temp = A[i];
	A[i] = A[minj];
	A[minj] = temp;
	count++;
      }
    }
    for(i = 0; i < N; i++){
      if(i != N-1) printf("%d ",A[i]);
      else printf("%d\n", A[i]);
    }
    printf("%d\n", count);
  }
  return 0;
}



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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll h, w, m;
  cin >> h >> w >> m;
  vector<ll> H(h), W(w);
  vector<pair<ll, ll>> mem(m);
  for (ll i = 0; i < m; i++) {
    ll x, y;
    cin >> x >> y;
    x--, y--;
    H[x]++;
    W[y]++;
    mem[i] = {x, y};
  }
  ll MH = 0, MHi = 0, MW = 0, MWi = 0;
  for (ll i = 0; i < h; i++) {
    if (H[i] > MH) {
      MH = H[i];
      MHi = i;
    }
  }
  vector<ll> W1(w);
  for (int i = 0; i < w; i++) {
    W1[i] = W[i];
  }
  for (auto&& [x, y] : mem) {
    if (x == MHi) {
      W1[y]--;
    }
  }
  for (ll i = 0; i < w; i++) {
    if (W1[i] > MW) {
      MW = W1[i];
      MWi = i;
    }
  }
  ll ans1 = MH + MW;
  MH = 0, MHi = 0, MW = 0, MWi = 0;
  for (ll i = 0; i < w; i++) {
    if (W[i] > MW) {
      MW = W[i];
      MWi = i;
    }
  }
  for (auto&& [x, y] : mem) {
    if (y == MWi) {
      H[x]--;
    }
  }
  for (ll i = 0; i < h; i++) {
    if (H[i] > MH) {
      MH = H[i];
      MHi = i;
    }
  }
  ll ans2 = MH + MW;
  cout << max(ans1, ans2) << '\n';
  return 0;
}


Measured memory_bytes: 15068
#include <stdio.h>

int main(void)
{
   int total;
   int book;
   int i;

   while (1){
       scanf("%d", &total);
       if (total == 0){
           return (0);
       }

       for (i = 0; i < 9; i++){
           scanf("%d", &book);
           total -= book;
       }
       printf("%d\n", total);
   }
   return (0);
}

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

using ll = long long;

int main() {
    int n; cin >> n;
    string s; cin >> s;
    vector<vector<ll>> sum(n + 1, vector<ll>(3));
    auto to_i = [] (char c) {
                    if(c == 'J') return 0;
                    if(c == 'O') return 1;
                    if(c == 'I') return 2;
                    return -1;
                };
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < 3; ++j) {
            sum[i + 1][j] = sum[i][j];
        }
        sum[i + 1][to_i(s[i])] += 1;
    }
    auto solve =
        [&to_i] (const string& t) {
            const int m = t.size();
            vector<ll> dp(4); dp[0] = 1;
            for(int i = 0; i < m; ++i) {
                dp[to_i(t[i]) + 1] += dp[to_i(t[i])];
            }
            return dp.back();
        };
    ll ans = max(solve("J" + s), solve(s + "I"));
    {
        ll tmp = solve(s);
        for(int i = 1; i < n; ++i) {
            ans = max(ans, tmp + (sum[i][0] * (sum[n][2] - sum[i][2])));
        }
    }
    cout << ans << endl;
}



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

int main(){
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    long long ans = 0;
    vector<long long> a = {2,1};
    for(int i=0;i<n;i++){
        ans = a[a.size()-2] + a[a.size()-1];
        a.push_back(ans);
    }
    cout << a[n] << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cmath>
#include<iostream>
#include<algorithm>
#include <string>
#include <stdexcept>
using namespace std; 
int main(){
  int a,b,c,d,e;
 	cin >>a;
 if(a<1200) cout <<"ABC";
  else if (a<2800)cout <<"ARC";
  else cout <<"AGC";
  	
  
}

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

int main() {
  int n, m;
  cin >> n >> m;
  
  int a, b, c = 0, d = 100001;
  vector<int> v(n);
  for(int i=0; i<m; i++) {
    cin >> a >> b;
    c = max(c, a);
    d = min(d, b);
  } 
  
  if(d-c>=0) cout << d-c+1 << endl;
  else cout << 0 << endl;
  return 0;
}

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

#define ff              first
#define ss              second
#define ll             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define mii             map<ll,ll>
#define pqb             priority_queue<ll>
#define pqs             priority_queue<ll,vi,greater<ll> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            ll x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mx 3000
ll n,m;
ll dp[3005][3005][2];
ll a[3005];
vector<ll>v;

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

}
int main()
{
    FIO;
    ll c,d,e,f=0,sum=0,ck,k,p,q,r,t,add=0,w,x,y,z;
    cin>>n;
        for(int i=0;i<n;i++) {cin>>a[i];sum+=a[i];}
        memset(dp,-1,sizeof dp);
        x=solve(0,n-1,1);
        y=sum-x;
        ll ans=x-y;
        cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 144956
package main

import (
        "fmt"
)

func solution(h, w, k int, c [][]byte) int {
        out := 0
        for row := 0; row < 1<<uint(h); row++ {
                for col := 0; col < 1<<uint(w); col++ {
                        b := 0
                        for i := 0; i < h; i++ {
                                for j := 0; j < w; j++ {
                                        if row>>uint(i)&1 == 0 && col>>uint(j)&1 == 0 && c[i][j] == '#' {
                                                b++
                                        }
                                }
                        }
                        if b == k {
                                out++
                        }
                }
        }
        return out
}

func main() {
        var h, w, k int
        fmt.Scan(&h, &w, &k)
        c := make([][]byte, h)
        for i := range c {
                var t string
                c[i] = make([]byte, w)
                fmt.Scan(&t)
                for j := 0; j < w; j++ {
                        c[i][j] = t[j]
                }
        }
        fmt.Println(solution(h, w, k, c))
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define pb push_back
#define fst first
#define snd second

using namespace std;

typedef long long ll;

inline bool LT(double a,double b) { return !equals(a,b) && b < b; }
inline bool LTE(double a,double b) { return equals(a,b) || b < b; }

#define MAX 110
int H,W;
string s[MAX];

int mini[MAX][MAX];
int dx[] = {+1,+0};
int dy[] = {+0,+1};

void move(deque<int> &deq, char c, int step) {
  while( !deq.empty() ) {
    int cur = deq.front(); deq.pop_front();
    int cx = cur % W, cy = cur / W;
    rep(i,2) {
      int nx = cx + dx[i];
      int ny = cy + dy[i];
      if( !( 0 <= nx && nx < W && 0 <= ny && ny < H ) ) {
	continue;
      }
      if( s[ny][nx] != c ) continue;
      if( mini[ny][nx] == INT_MAX ) {
	mini[ny][nx] = step;
	deq.pb(nx+ny*W);
      }
    }
  }
}

void solve() {
  rep(i,H) rep(j,W) mini[i][j] = INT_MAX;
  string color = ".#";
  int ans = 0;
  if( s[0][0] == '#' ) swap(color[0],color[1]), ++ans;
  {
    deque<int> deq;
    deq.pb(0);
    mini[0][0] = 0;
    move(deq,s[0][0],0);
  }
  
  int step = 0;
  while( mini[H-1][W-1] == INT_MAX ) {
    ++step;
    if( color[step%2] == '#' ) ++ans;
    deque<int> deq;
    rep(i,H) {
      rep(j,W) {
	if( mini[i][j] == step-1 ) {
	  rep(k,2) {
	    int sx = j + dx[k], sy = i + dy[k];
	    if( !( 0 <= sx && sx < W && 0 <= sy && sy < H ) ) continue;
	    if( s[sy][sx] == s[i][j] ) continue;
	    if( mini[sy][sx] != INT_MAX ) continue;
	    deq.pb(sx+sy*W);
	    mini[sy][sx] = step;
	  }
	}
      }
      move(deq, color[step%2], step);
    }
  }

  cout << ans << endl;
}

int main() {
  if( 0 ) {
    srand((unsigned int)time(NULL));
    cout << "100 100" << endl;
    rep(i,100) {
      rep(j,100) {
	//cout << ".#"[rand()%2];
	cout << '#';
      }
      puts("");
    }
  }
  cin >> H >> W;
  rep(i,H) cin >> s[i];
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <iomanip>
using namespace std;
int main()
{
	long long x;
	cin >> x;
	if (x >= 400 && x <= 599)cout << '8';
	else if (x >= 600 && x <= 799)cout << '7';
	else if (x >= 800 && x <= 999)cout << '6';
	else if (x >= 1000 && x <= 1199)cout << '5';
	else if (x >= 1200 && x <= 1399)cout << '4';
	else if (x >= 1400 && x <= 1599)cout << '3';
	else if (x >= 1600 && x <= 1799)cout << '2';
	else if (x >= 1800 && x <= 1999)cout << '1';
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second
#define pii pair<int , int>
#define mp make_pair
#define pb push_back
#define sz(a) (int)(a.size())
ll ans = 0;
int n;
int b[200005];
map<int , ll> a;
int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> b[i];
		a[b[i]]++;
	}
	for(auto x : a)
		ans += x.y * (x.y - 1) / 2;
	for(int i = 0; i < n; i++)
	{
		ans -= a[b[i]] * (a[b[i]] - 1) / 2;
		a[b[i]]--;
		ans += a[b[i]] * (a[b[i]] - 1) / 2;
		cout << ans << endl;
		ans -= a[b[i]] * (a[b[i]] - 1) / 2;
		a[b[i]]++;
		ans += a[b[i]] * (a[b[i]] - 1) / 2;
	}
}


Measured memory_bytes: 10240
#include <stdio.h>

int main(void)
{
	int a,b,c[7],d;
	for(d=0;d<7;d++){	
	scanf("%d %d",&a,&b);
	c[d]=a-b;
	}
	for(d=0;d<7;d++){
	printf("%d\n",c[d]);
	}
	return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#include <bitset>
#include <complex>
#include <cassert>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define GI(i) (scanf("%d",&i))
#define GLL(i) (scanf("%lld",&i))
#define GD(i)  (scanf("%lf",&i))
#define PB          push_back
#define MP          make_pair
#define MT          make_tuple
#define GET0(x)     (get<0>(x))
#define GET1(x)     (get<1>(x))
#define GET2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       (1LL<<60)
#define LLMIN       -(1LL<<60)
#define IMAX        (1<<30)
#define IMIN        -(1<<30)
typedef long long LL;
using namespace std;

int N,A[100000];

int main(void){
    GI(N);
    REP(i,N)
        GI(A[i]);
    sort(A,A+N);
    int d=IMIN,ai=A[N-1],aj;
    REP(i,N-1){
        if(d < min(A[i], A[N-1]-A[i])){
            d = min(A[i], A[N-1]-A[i]);
            aj = A[i];
        }
    }
    printf("%d %d\n",ai,aj);
    return 0;
}

Measured memory_bytes: 640
import sys, math
from collections import deque

readline = sys.stdin.readline

N = int(readline())
S = readline().strip()

P = 10 ** 9 + 7

d = 0
count = 1
for c in S:
    if d % 2 == 0:
        if c == 'B':
            d += 1
        else:
            count *= d
            count %= P
            d -= 1
    else:
        if c == 'B':
            count *= d
            count %= P
            d -= 1

        else:
            d += 1
    if d < 0:
        print(0)
        exit(0)

if d != 0:
    print(0)
    exit(0)

ans = count
for i in range(1, N + 1):
    ans *= i
    ans %= P

print(ans)

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

int main() {
    char a,b,c;
    cin>>a>>b>>c;
    if(a=='7'||b=='7'||c=='7'){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3636
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
    #include "lib/dump.hpp"
#else
    #define dump(...) 42
    #define dump_1d(...) 42
    #define dump_2d(...) 42
    #define cerrendl 42
#endif
//}}}

signed main() {
    int h,w;cin>>h>>w;

    // init
    int n = 10;
    vector<vector<int>> d(n, vector<int>(n, INF));
    rep(i, n)rep(j, n){
        if (i==j) d[i][j] = 0;
    }

    // input
    rep(i, n)rep(j, n){
        cin>>d[i][j];
    }

    // calc
    rep(k, n){
        rep(i, n){
            rep(j, n){
                chmin(d[i][j], d[i][k]+d[k][j]);
            }
        }
    }
    dump_2d(d, n, n);

    int ans = 0;
    rep(i, h) rep(j, w){
        int c;cin>>c;
        if (c==-1) continue;
        ans += d[c][1];
    }
    cout << ans << endl;

    return 0;
}


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

using namespace std;

int main(){
    string s, t;
    cin >> s >> t;

    if (t.size() > s.size() && equal(begin(s), end(s), begin(t))){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
	int n, m, t, i, j;
	scanf("%d %d", &n, &m);

	vector<int> sports;
	vector<int> votes(m, 0);

	for(i = 0;i < n;++i){
		scanf("%d", &t);
		sports.push_back(t);
	}

	for(i = 0;i < m;++i){
		scanf("%d", &t);
		for(j = 0;j < n;++j){
			if(sports[j] <= t){
				votes[j]++;
				break;
			}
		}
	}

	vector<int>::iterator itr = max_element(votes.begin(), votes.end());
	size_t d = distance(votes.begin(), itr);
	printf("%zu\n", d+1);

	return 0;
}


Measured memory_bytes: 2776
n = gets.to_i
arr = []
n.times do |i|
  arr.push(gets.to_i)
end

sorted_arr = arr.sort
max_value = sorted_arr[n-1]
second_value = sorted_arr[n-2]
max_i = arr.index(max_value)

n.times do |i|
  if max_i != i
    puts(max_value)
  else
    puts(second_value)
  end
end

Measured memory_bytes: 8224
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.*;

public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        BigDecimal A;
        BigDecimal B;
        // int[] A;

        // write your code
        void solve(InputReader in, PrintWriter out) {
            A = new BigDecimal(in.next());
            B = new BigDecimal(in.next());
            // A = new int[N];
            // for (int i = 0; i < N; i++) {
            // A[i] = in.nextInt();
            // }
            long ans = A.multiply(B).longValue();
            // ans.setScale(0,BigDecimal.ROUND_DOWN)
            out.println(ans);
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 33300
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int K = scan.nextInt(); //倍数
		int A = scan.nextInt(); //最低値
		int B = scan.nextInt(); //最高値
		String ans = "NG";
      
		for(int i=A; i<=B; i++){
			if(i%K == 0){
				ans = "OK";
				break;
			}
		}
		
		System.out.println(ans);

	}
}


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

void max_self(int &a, int b){
	a = max(a,b);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n, d;
	cin >> n;
	d = n%10;
	if(d == 2 || d == 4 ||
	   d == 5 || d == 7 ||
	   d == 9)
	   cout << "hon";
	else if(d == 0 || d == 1 ||
	        d == 6 || d == 8)
	    cout << "pon";
 	else
		cout << "bon";
	return 0;
}


Measured memory_bytes: 3652
import java.*;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int Count = 0;
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		int length = str.length();
		if(length%2 == 0) {
			for(int i = 0; i <= length/2-1; i++) {
				if(str.charAt(i) != str.charAt(length-1-i)) {
					Count++;
				}
			}
		}else {
			for(int i = 0; i <= (length-1)/2-1; i++) {
				if(str.charAt(i) != str.charAt(length-1-i)) {
					Count++;
				}
			}
		}
		System.out.println(Count);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
typedef struct edge{
	int to, cost;
}edge;

const ll INF = 10000000;
const int MAX_N = 100;

int n, k;

ll dist[MAX_N][MAX_N];
vector<edge> rote[MAX_N];

void search(int);

int main()
{
	while(cin >> n >> k && (n || k)){

		for(int i = 0; i < MAX_N; i++)
			rote[i].clear();
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(i == j)	dist[i][j] = 0;
				else		dist[i][j] = INF;
			}
		}

		for(int i = 0; i < k; i++){
			int s;
			cin>>s;

			if(s == 0){

				int a, b;
				cin >> a >> b; a--; b--;
				search(a);
				if(dist[a][b] != INF)   cout << dist[a][b] << endl;
				else                    cout << -1 << endl;

			}else{

				edge e1, e2;
				cin >> e1.to >> e2.to >> e1.cost; e1.to--; e2.to--;
				e2.cost = e1.cost;
				rote[e2.to].push_back(e1);
				rote[e1.to].push_back(e2);
			}
		}
	}
}

void search(int a)
{
	priority_queue<P, vector<P>, greater<P> > que;

	fill(dist[a], dist[a] + n, INF);
	dist[a][a] = 0;
	que.push(P(0, a));

	while(!que.empty()){
		P p = que.top(); que.pop();
		int v = p.second;
		if(dist[a][v] < p.first) continue;
		for(int i = 0; i < rote[v].size(); i++){
			edge e = rote[v][i];
			if(dist[a][e.to] > dist[a][v] + e.cost){
				dist[a][e.to] = dist[a][v] + e.cost;
				que.push(P(dist[a][e.to], e.to));
			}
		}
	}
}

Measured memory_bytes: 1016
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int t, n, m, k, a[300010], q, l, r;

int32_t main(){
INIT
int d, s ,t; cin>>d>>t>>s;
if(s*t>=d){cout<<"Yes";}
else{cout<<"No";}


return 0;
}





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

using namespace std;

long long a[10000007],b[10000007],c[10000007];
long long dp [10000007][4];
long long n;
int main()
{

   cin>>n;
   for(int i=0;i<n;i++){

   cin>>a[i]>>b[i]>>c[i];
   }

   dp[0][0]=a[0];
   dp[0][1]=b[0];
   dp[0][2]=c[0];

   for (int i=1;i<n;i++){

    dp [i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
    dp [i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
    dp [i][2]=max(dp[i-1][1],dp[i-1][0])+c[i];

   }
   int ans;
   ans =max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
   cout<<ans;

    return 0;
}


Measured memory_bytes: 14592
#include<iostream>
using namespace std;
const int maxn=21;
int n,answer;
int a[maxn];
int main() 
{
    cin>>n;
    for(int i=1;i<=n;i++) 
        cin>>a[i];
    for(int i=2;i<n;i++) 
	{
        if((a[i]-a[i-1])*(a[i]-a[i+1])<0)
            answer++;
    }
    cout<<answer<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,a) REP(i,0,a)
#define rev(s) reverse(s.begin(),s.end())
#define pb push_back

 
int main() 
{   
	

    
	 string S,T,U;
	 cin>>S>>T;
	 ll A,B;
	 cin>>A>>B;
	 cin>>U;
	 if(S==U){
	 	cout<<A-1<<" "<<B;
	 }
	 if (T==U)
	 {
	 	cout<<A<<" "<<B-1;
	 }



	   return 0;
	
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
#include <string.h>
 
typedef struct _node {
    int key;
    struct _node *next;
    struct _node *prev;
} NODE, *PNODE;
 
PNODE root;
 
void init(void) {
    root = malloc(sizeof(NODE));
    root->next = root;
    root->prev = root;
}
 
void insert(key) {
    PNODE t = malloc(sizeof(NODE));
    t->key = key;
    t->next = root->next;
    t->prev = root;
    root->next->prev = t;
    root->next = t;
}
 
void deleteNode(PNODE node) {
    if (node == root) {
        return;
    }
    node->next->prev = node->prev;
    node->prev->next = node->next;
    free(node);
}
 
void delete(key) {
    PNODE cur = root->next;
    while (cur != root) {
        if (cur->key == key) {
            deleteNode(cur);
            return;
        }
        cur = cur->next;
    }
}
void deleteFirst(void) {
    deleteNode(root->next);
}
 
void deleteLast(void) {
    deleteNode(root->prev);
}
 
void printNodes(void) {
    PNODE cur = root->next;
    while (1) {
        printf("%d", cur->key);
        cur = cur->next;
        if (cur != root) {
            putchar(' ');
        } else {
            break;
        }
    }
    putchar('\n');
}
 
void release(void) {
    PNODE tmp, cur = root->next;
    while (cur != root) {
        tmp = cur;
        cur = cur->next;
        deleteNode(tmp);        
    }
    free(root);
}
int main(void) {
    char cmd[100];
    int n, i, f;
    int key;
     
    init(); 
     
    scanf("%d", &n);
     
    f = 0;
    while (scanf("%s", cmd) > 0) {
        if (cmd[0] == 'i') {
            f = 1;
        } else if (cmd[0] == 'd') {
            switch (cmd[6]) {
            case '\0':
                f = 2;
                break;
            case 'F':
                deleteFirst();
                break;
            case 'L':
                deleteLast();
                break;
            }
        } else {
            key = atoi(cmd);
            if (f == 1) {
                insert(key);
            } else if (f == 2) {
                delete(key);
            }
        }
    }
     
    printNodes();
     
    release();
     
    return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
typedef long long ll;

typedef pair<double,ll> P;

int digit(ll n){
	int ret=0;
	while(n>0){
		n/=10;
		ret++;
	}
	return ret;
}

int ds(ll n){
	int ret=0;
	while(n>0){
		ret+=n%10;
		n/=10;
	}
	return ret;
}

int main(){
	ll K;
	cin>>K;
	ll N=1;
	REP(i,K){
		set<P> s;
		int d=digit(N);
		ll p=1;
		REP(j,d){
			p*=10;
			REP(k,10){
				ll x=N/p*p+k*p/10+p/10-1;
				if (x>=N){
					s.insert(P((double)x/ds(x),x));
				}
			}
		}
		auto ite=s.begin();
		cout<<ite->second<<endl;
		N=ite->second+1;
	}
	return 0;
}

Measured memory_bytes: 256
h = int(input())
count2 = 0
if h //2 >1:
    while h // 2 > 1:
        count2 += 1
        h= h//2
    if h //2 == 1:
        count2 += 1
elif h // 2 == 1:
    count2 = 1
elif h // 2 == 0:
    count2 = 0

sig = 0
for i in range(count2):
    sig += 2 ** i

ans = 2**count2 + sig
print(ans)

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

int	main(void)
{
  	int	a;
  	int	b;
  	char	s[10];
  	char	t[10];
  	char	u[10];
  	int	num;
  	
  	num = scanf("%s %s", s, t);
  	if (num != 2)
      	return (0);
  	num = scanf("%d %d", &a, &b);
  	if (num != 2)
      	return (0);
  	num = scanf("%s", u);
  	if (num != 1)
      	return (0);
  
  	if (strcmp(s, u) == 0)
      	printf("%d %d", a - 1, b);
  	else if (strcmp(t, u) == 0)
      	printf("%d %d", a, b - 1);
  
  	return (0);
}

Measured memory_bytes: 128