akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
int main() {
   
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        ll ans;
        ll n,k;cin>>n>>k;
        if(n>k){
            n=n-(n/k)*k;
        }
        ans=n;
        ans=min(ans,abs(n-k));
        cout<<ans;
    }   
    timecalculater();
    return 0;   
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5;
int n, x[N], a[N], b[N], an, bn, G[N][N], vis[N], id[N];
map<int, int> M;
int pri(int x) {
	if(x == 1) return 0;
	for(int i = 3; i * i <= x; ++i) if (x % i == 0) return 0;
	return 1;
}
int dfs(int x) {
	for(int i = 1; i <= bn; ++i) if (G[x][i] == 1 && !vis[i]) {
		vis[i] = 1;
		if (!id[i] || dfs(id[i])) {
			id[i] = x;
			return 1;
		}
	}
	return 0;
}
int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &x[i]), M[x[i]] ^= 1, M[x[i] + 1] ^= 1;
	for(auto x:M) if (x.second) { (x.first & 1 ? a[++an] : b[++bn]) = x.first; }
	for(int i = 1; i <= an; ++i) for(int j = 1; j <= bn; ++j) if (pri(abs(a[i] - b[j]))) G[i][j] = 1;
	int ans = 0;
	for(int i = 1; i <= an; ++i) {
		memset (vis, 0, sizeof vis);
		ans += dfs(i);
	}
	ans += ((an - ans) / 2 + (bn - ans) / 2) * 2 + ((an - ans) & 1) * 3;
	printf ("%d\n", ans);
	return 0;
}






















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

int main() {
    int64_t n;
    cin >> n, n--;
    vector<int> ans;
    if(n < 26){
        cout << (char)('a' + n) << endl;
        return 0;
    }
    while(n / 26 > 0){
        ans.push_back(n % 26);
        n /= 26;
        n--;
    }
    ans.push_back(n % 26);
    reverse(begin(ans), end(ans));
    for(auto& e : ans) cout << (char)('a' + e);
    cout << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) x.begin(),x.end()
#define P pair<int,int>
#define mod 1000000007

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());
  ll ans = a[0];
  ll lasttwo = (n - 2) / 2;
  for (int i = 1; i <= lasttwo; i++) {
    ans += 2 * a[i];
  }
  if (n % 2 == 1) ans += a[lasttwo + 1];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)

int main() {
    int n, h, w;
    cin >> n >> h >> w;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(a[i] >= h && b[i] >= w){ans++;}
    }

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


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int i, j, k;

    //標準入力
    int n, b, f, r, v;
    int resident[4][3][10];
    for( i = 0; i < 4; ++i )
        for( j = 0; j < 3; ++j )
            for( k = 0; k < 10; ++k )
                resident[i][j][k] = 0;
    scanf("%d", &n);
    for( i = 0; i < n; ++i ){
        scanf("%d%d%d%d", &b, &f, &r, &v);
        resident[b-1][f-1][r-1] += v;
    }

    //標準出力
    for( i = 0; i < 4; ++i ){
        for( j = 0; j < 3; ++j ){
            for( k = 0; k < 10; ++k ){
                printf(" %d", resident[i][j][k]);
            }
            printf("\n");
        }
        if( i < 3 ) printf("####################\n");
    }

    return 0;
}

Measured memory_bytes: 612
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

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

int main()
{
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  double ra = 0, rb = 0;
  ra += M_PI / 6.0 * h;
  ra += M_PI / 360.0 * m;
  rb += M_PI / 30.0 * m;
  double r = abs(ra - rb);
  double ans = a * a + b * b - 2 * a * b * cos(r);
  printf("%.10lf\n", sqrt(ans));

  return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const double PI = 3.1415926535897932384626433832795;
const int mod = 1000000007;
const int INF = 1001001001;

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  vector<ll> h(n);
  rep(i, n) cin >> h[i];

  ll l = -1, r = INF;
  while (l + 1 < r) {
    ll mid = (l + r) / 2;
    ll base = mid * b;
    ll remain = mid;
    ll power = a - b;
    rep(i, n) {
      ll cur = h[i] - base;
      if (cur > 0) remain -= (cur + power - 1) / power;
    }

    if (remain >= 0) r = mid;
    else l = mid;
  }
  cout << r << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int k; cin>>k;
    int a,b; cin>>a>>b;
    for (int i = a; i <= b; ++i) {
        if (i%k == 0) {
            cout << "OK" << '\n';
            return 0;
        }
    }

    cout << "NG" << '\n';
    return 0;
}

Measured memory_bytes: 3636
n,s=map(int,input().split( ))
a=list(map(int,input().split( )))
a.append(0)###
min=10000000000
sum_temp=0

i_first=0
i_next=0
while i_next<n:
    while sum_temp<s and i_next<=n:###
        sum_temp+=a[i_next]
        i_next+=1
    while sum_temp-a[i_first]>=s:
        sum_temp-=a[i_first]
        i_first+=1
    if i_next-i_first<min and sum_temp>=s:###
        min=i_next-i_first
    sum_temp-=a[i_first]
    i_first+=1
    if i_first>=n:
        break
if min<10000000000:
    print(min)
else:
    print(0)



Measured memory_bytes: 16380
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define DEC(x) fixed<<setprecision(x)
#define FAST ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);
const long long INF=2e18;

template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;}

ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll modinv(ll a,ll m)
{
    return power(a,m-2,m);
}

// #define _NCR_

int TLE_TERROR()
{
 	ll int n,ans=0;
 	cin>>n;
 	ll int a[n];
 	for(ll int i=0;i<n;i++)
 		cin>>a[i];
 	for(ll int i=1;i<n;i++)
 	{
 		if(a[i]<a[i-1])
 		{
 			ans+=a[i-1]-a[i];
 			a[i]=a[i-1];
 		}
 	}
 	cout<<ans;
 	return 0;   
}

int main()
{
    FAST
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ll int TESTS=1;
    // cin>>TESTS;
    #ifdef _NCR_
        initialvalues();
    #endif
    while(TESTS--)
        TLE_TERROR();
    return 0;
}

Measured memory_bytes: 5184
#include <stdio.h>
#include <cmath>
#include <iostream>

using namespace std;

int main() {
	int k;
	char d;
	int a,b;
	int counter;
	int robx;
	int roby;
	int kari;
	while (cin >> k) {
		if (k == 0) {
			break;
		}
		counter = 0;
		int hyou[21][21] = {0};
		int koudou[30][2] = {0};
		for (int i = 0; i < k; i++) {
			cin >> a >> b;
			hyou[a][b] = 1;
			counter++;
		}
		cin >> k;
		for (int i = 0; i < k; i++) {
			cin >> d >> a;
			if (d == 'N') {
				koudou[i][0] = a;
			} else if (d == 'S') {
				koudou[i][0] = -a;
			} else if (d == 'E') {
				koudou[i][1] = a;
			} else {
				koudou[i][1] = -a;
			}
		}
		robx = 10;
		roby = 10;
		
		for (int i = 0; i < k; i++) {
			if (koudou[i][0] == 0) {
				kari = 1;
			} else {
				kari = 0;
			}
			for (int j = 0; j < abs(koudou[i][kari]); j++) {
				if (koudou[i][kari] > 0) {
					if (kari == 0) {
						roby++;
					} else {
						robx++;
					}
				} else {
					if (kari == 0) {
						roby--;
					} else {
						robx--;
					}
				}
				//printf("%d %d\n",robx,roby);
				if (hyou[robx][roby] == 1) {
					hyou[robx][roby] = 0;
					counter--;
				}
			}
		}
		if (counter == 0) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f[29],i,j,zx,xc,pas,ans,bo[29],kaa[29];
bool ki;
vector <pair <int, int> > v[29];
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a;
    for(b=0; b<a; b++){
        cin>>f[b];
        for(c=0; c<f[b]; c++){
            cin>>d>>e;
            d--;
            v[b].push_back(make_pair(d,e));
        }
    }
    for(i=0; i<(1<<a); i++){
        ans=0;
        ki=0;
        for(j=0; j<a; j++){
            bo[j]=2;
            kaa[j]=2;
        }
        for(j=0; j<a; j++){
            if(((1<<j)&i)!=0){
                ans++;
                bo[j]=1;
                kaa[j]=1;
            }
        }
        int hj=1;
        while(hj>0){
        hj=0;
        for(j=0; j<a; j++){
            //if(((1<<j)&i)==0) continue;
            if(kaa[j]!=1) continue;
            kaa[j]=0;
            for(b=0; b<f[j]; b++){
                if(v[j][b].second==0){
                    if(bo[v[j][b].first]==1){
                        ki=1;
                        break;
                    }
//                    if(bo[v[j][b].first]==2) kaa[v[j][b].first]=1;
                    bo[v[j][b].first]=0;
                }else{
                    if(bo[v[j][b].first]==0){
                        ki=1;
                        break;
                    }
                    if(bo[v[j][b].first]==2){
                        kaa[v[j][b].first]=1;
                        hj++;
                    }
                    bo[v[j][b].first]=1;
                }
            }
        }
        }
        if(ki==0){
            if(pas<ans) pas=ans;
        }
    }
    cout<<pas;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
main(){
long long int n,w;
cin>>n>>w;
vector < array <long long int ,2> > vt(n);
for(int i=0;i<n;i++)cin>>vt[i][0]>>vt[i][1];

long long int t_s=0;
for(int i=0;i<n;i++)t_s+=vt[i][1];
vector <long long int > val(t_s+1,10000000000);

val[0]=0;
for(int i=0;i<n;i++)for(int j=t_s;j>=1;j--){

//	cout<<vt[i][0]<<" "<<vt[i][1]<<" "<<j<<endl;
if(vt[i][1]>j)continue;
val[j]=min(val[j],vt[i][0]+val[j-vt[i][1]]);

//cout<<val[j]<<endl;


}

int ans=0;
for(int i=t_s;i>=0;i--){
if(val[i]<=w){ans=i;break;}
}
cout<<ans;




}


Measured memory_bytes: 3988
m1, d1 = map(int, input().split())
m2, d2 = map(int ,input().split())

sanju = [4,6,9,11]
ans = 0

if m1 in sanju:
	if d1 == 30:
		if m2 == m1+1 and d2 == 1:
			ans = 1
elif m1 == 2:
	if d1 == 28:
		if m2 == m1+1 and d2 == 1:
			ans = 1
else:
	if d1 == 31:
		if m2 == m1+1 and d2 == 1:
			ans = 1

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main(){int n,c[510],s[510],f[510];scanf("%d",&n);for(int*pc=c,*ps=s,*pf=f;pc<c+n-1;++pc,++ps,++pf)scanf("%d%d%d",pc,ps,pf);++(f[n-1]=s[n-1]=c[n-1]=0);for(int i=0;i<n;i++)for(int ans=0,j=i;j<n||!printf("%d\n",ans);j++)ans=c[j]+(ans<s[j]?s[j]:(ans/f[j]+(ans%f[j]!=0))*f[j]);}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
const int N = 200010;
long long A[N << 2],B[N << 2],T[N << 2];
//#define min(a,b) (((a)<(b))?(a):(b))
//#define abs(a) (((a)>0)?(a):-(a))
inline void pushdown(int x) {
	if (!T[x])return;
	A[x << 1] += T[x]; A[x << 1 | 1] += T[x];
	B[x << 1] += T[x]; B[x << 1 | 1] += T[x];
	T[x << 1] += T[x]; T[x << 1 | 1] += T[x];
	T[x] = 0;
}
inline void pushup(int x) {
	A[x] = std::min(A[x << 1], A[x << 1 | 1]);
	B[x] = std::min(B[x << 1], B[x << 1 | 1]);
}
void insert(int n, int l, int r, int x, long long v) {
	if (l == r) {
		A[n] = std::min(A[n], v - x); B[n] = std::min(B[n], v + x); return;
	}
	pushdown(n); int mid = (l + r) >> 1;
	if (x <= mid)insert(n << 1, l, mid, x, v);
	else insert(n << 1 | 1, mid + 1, r, x, v);
	pushup(n);
}
void insert(int n, int l, int r, int L, int R, long long v) {
	if (l == L && r == R) {
		A[n] += v; B[n] += v; T[n] += v; return;
	}
	pushdown(n); int mid = (l + r) >> 1;
	if (R <= mid)insert(n << 1, l, mid, L, R, v);
	else if (L > mid)insert(n << 1 | 1, mid + 1, r, L, R, v);
	else insert(n << 1, l, mid, L, mid, v), insert(n << 1 | 1, mid + 1, r, mid + 1, R, v);
	pushup(n);
}
long long a(int n, int l, int r, int L, int R) {
	if (l == L && r == R)return A[n];
	pushdown(n); int mid = (l + r) >> 1;
	if (R <= mid)return a(n << 1, l, mid, L, R);
	else if (L > mid)return a(n << 1 | 1, mid + 1, r, L, R);
	return std::min(a(n << 1, l, mid, L, mid), a(n << 1 | 1, mid + 1, r, mid + 1, R));
}
long long b(int n, int l, int r, int L, int R) {
	if (l == L && r == R)return B[n];
	pushdown(n); int mid = (l + r) >> 1;
	if (R <= mid)return b(n << 1, l, mid, L, R);
	else if (L > mid)return b(n << 1 | 1, mid + 1, r, L, R);
	return std::min(b(n << 1, l, mid, L, mid), b(n << 1 | 1, mid + 1, r, mid + 1, R));
}
int n,q,p[N],x;
int main()
{
    scanf("%d %d %d",&n,&q,&x);
    for(int i = 0;i <= q;i++)scanf("%d",&p[i]);
    memset(A,0x3f,sizeof(A));memset(B,0x3f,sizeof(B));
    insert(1,1,n,x,0);
    for(int i = 1;i <= q;i++)
    {
        long long now = min(a(1,1,n,1,p[i]) + p[i],b(1,1,n,p[i],n) - p[i]);
        insert(1,1,n,1,n,abs(p[i] - p[i - 1]));
        insert(1,1,n,p[i - 1],now);
    }
    long long ans = 0x7fffffffffffffff;
    for(int i = 1;i <= n;i++)ans = min(ans,a(1,1,n,i,i) + i);
    printf("%lld\n",ans);
    return 0;
}


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

int main(){
	int r;
  	cin>>r;
  
  	if(r<1200){
		cout<<"ABC"<<endl;
    }else if(r<2800){
		cout<<"ARC"<<endl;
    }else{
		cout<<"AGC"<<endl;
    }
}

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

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

int main(){
    char a,b;
    int c,d;
    cin>>a>>b;
    string s="ABCDEF";
    for(int i=0;i<6;i++){
        if(s[i]==a){
            c=i;
        }
        if(s[i]==b){
            d=i;
        }
    }
    if(c>d){
        cout<<">"<<endl;
    }
    else if(c<d){
        cout<<"<"<<endl;
    }
    else{
        cout<<"="<<endl;
    }
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using vv = vector<V<T>>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  int n,m;
  cin >> n >> m;
  int k = m/n;
  RFOR(i,1,k+1){
    if(m%i==0){
      k = i;
      break;
    }
  }
  cout << k << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define MP(a,b) make_pair(a,b)
#define MAX 4000001
int N;
string S;
vector<int> R,G,Y;
bool already[401][401][401][3] = {};
int dp[401][401][401][3];//R,G,Y,before
int solve(int r, int g, int y, int b){
	if(r == R.size()-1 && g == G.size()-1 && y == Y.size()-1) return 0;
	if(already[r][g][y][b]) return dp[r][g][y][b];
	already[r][g][y][b] = true;
	int now = r + g + y;
	int re = MAX;
	int realR = R[r];
	int realG = G[g];
	int realY = Y[y];
	if(R[r] < G[g] && R[r] < Y[y]){
		realR = now;
		if(G[g] < Y[y]){
			realG = G[g] + (Y.begin()+y-lower_bound(Y.begin(), Y.end(), G[g]));
		}
		if(Y[y] < G[g]){
			realY = Y[y] + (G.begin()+g-lower_bound(G.begin(), G.end(), Y[y]));
		}
	}
	if(G[g] < R[r] && G[g] < Y[y]){
		realG = now;
		if(R[r] < Y[y]){
			realR = R[r] + (Y.begin()+y-lower_bound(Y.begin(), Y.end(), R[r]));
		}
		if(Y[y] < R[r]){
			realY = Y[y] + (R.begin()+r-lower_bound(R.begin(), R.end(), Y[y]));
		}
	}
	if(Y[y] < R[r] && Y[y] < G[g]){
		realY = now;
		if(R[r] < G[g]){
			realR = R[r] + (G.begin()+g-lower_bound(G.begin(), G.end(), R[r]));
		}
		if(G[g] < R[r]){
			realG = G[g] + (R.begin()+r-lower_bound(R.begin(), R.end(), G[g]));
		}
	}
	if(b != 0 && r < R.size()-1){
		re = min(re, abs(now-realR)+solve(r+1,g,y,0) );
	}
	if(b != 1 && g < G.size()-1){
		re = min(re, abs(now-realG)+solve(r,g+1,y,1) );
	}
	if(b != 2 && y < Y.size()-1){
		re = min(re, abs(now-realY)+solve(r,g,y+1,2) );
	}
	return dp[r][g][y][b] = re;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N >> S;
	for(int i=0; i<N; i++){
		if(S[i] == 'R') R.push_back(i);
		if(S[i] == 'G') G.push_back(i);
		if(S[i] == 'Y') Y.push_back(i);
	}
	if(R.size() > G.size()+Y.size()+1){
		cout << -1 << endl;
		return 0;
	}
	if(G.size() > R.size()+Y.size()+1){
		cout << -1 << endl;
		return 0;
	}
	if(Y.size() > G.size()+R.size()+1){
		cout << -1 << endl;
		return 0;
	}
	R.push_back(400);
	G.push_back(400);
	Y.push_back(400);
	cout << min(solve(0,0,0,0),solve(0,0,0,1)) << endl;
	return 0;
}



Measured memory_bytes: 115760
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
  int N;
  cin >> N;

  if(N%2==0) {
    N/=2;
  } else {
    N = (N+1)/2;
  }
  cout << N <<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
	unsigned long long dp[1001][1001];
int main(){
	int n,m,d[1001],c[1001];
	cin>>n>>m;
	/*for(int i=0;i<=n+1;i++){
		for(int j=0;j<=m+1;j++){
			dp[i][j]=0;
		}
	}*/
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=n;i++){
		cin>>d[i];
	}
	for(int i=1;i<=m;i++){
		cin>>c[i];
	}
	for(int i=0;i<n;i++){
		for(int j=1+i;j<=m;j++){
			if(dp[i+1][j+1]==0){
				dp[i+1][j+1]+=dp[i][j]+c[j]*d[i+1];
				//cout<<dp[i+1][j+1]<<endl;
			}
			if(dp[i][j]!=0&&dp[i][j]<dp[i][j+1]){
				dp[i][j+1]=dp[i][j];
			}
		}
	}
	unsigned long long minx=999999999;
	for(int i=m-n+1;i<=m+1;i++){
		//minx=min(dp[n][i],minx);
		if(dp[n][i]<minx&&dp[n][i]!=0)minx=min(dp[n][i],minx);
	}
	/*for(int i=0;i<n+2;i++){
		for(int j=1;j<=m+1;j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}*/
		
	cout<<minx<<endl;
}

Measured memory_bytes: 10916
#include <iostream>
#include <bitset>
using namespace std;
class SegmentTree{
    public:
    int n = 1, *data;

    SegmentTree(int n_){
        while(n<n_)n *= 2; //要素数nを2の冪乗に
        data=new int[n*2-1];
        for(int i=0;i<n*2-1;i++)data[i] = 0;
    }

    int comp(int a,int b) {return a|b;}

    void updata(int k, int a){
        k += n - 1;
        data[k] = a;
        while (k > 0){
            k=(k-1)/2;
            data[k]=comp(data[k*2+1],data[k*2+2]);
        }
    }
    int query(int a,int b,int k,int l,int r){
        if (r<=a||b<=l)return 0;
        if (a<=l&&r<=b)return data[k];
        int mid=(l+r)/2;
        return comp(query(a,b,k*2+1,l,mid),query(a,b,k*2+2,mid,r));
    }
    int query(int a,int b) {return query(a,b,0,0,n);}
};

int f(int n){
    int ret = 0;
    for(int i=0;i<26;i++)ret+=(n>>i&1);
    return ret;
}
int N,Q,type,i,l,r,shift;
char c;
string S;
int main(){
    cin>>N>>S>>Q;
    SegmentTree st(N);
    for (int i=0;i<N;i++)st.updata(i,1<<(S[i]-'a'));
    for (int query=0;query<Q;query++){
        cin>>type;
        switch(type){
        case 1:
            cin>>i>>c;
            shift=(c-'a');
            st.updata(i - 1, 1 << shift);
            break;
        case 2:
            cin>>l>>r;
            cout<<f(st.query(l-1,r))<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 4996
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		long[] arr = new long[k];
		for (int i = 0; i < k; i++) {
			arr[i] = sc.nextInt();
		}
		long max = 2;
		long min = 2;
		for (int i = k - 1; i >= 0; i--) {
			long x = arr[i];
			long mod = max % x;
			if (max - mod < min) {
				System.out.println(-1);
				return;
			}
			max = (max / x) * x + x - 1;
			min = ((min + x - 1) / x) * x;
		}
		System.out.println(min + " " + max);
	}
}


Measured memory_bytes: 60580
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

const int lim = 1<<10;

map<int,vll> mp;
vector<P> dat;
int n;

void dfs(int v) {
    if (v > lim || v > n) return;
    vll tmp = mp[v/2];
    for (int i = MAX; i >= dat[v-1].second; i--) {
        chmax(tmp[i],tmp[i-dat[v-1].second]+dat[v-1].first);
    }
    mp[v] = tmp;
    dfs(v*2);
    dfs(v*2+1);
}

P get_top(int v) {
    int ct = 0;
    while (v > lim) {
        v >>= 1;
        ct++;
    }
    return P(ct,v);
}

int main() {
    cin >> n;
    dat.resize(n);
    rep(i,n) {
        int v, w; cin >> v >> w;
        dat[i] = P(v,w);
    }
    mp[0] = vll(MAX+1,0);
    dfs(1);
    int q; cin >> q;
    rep(i,q) {
        int v, l; cin >> v >> l;
        if (v <= lim) {
            cout << mp[v][l] << endl;
        } else {
            ll ans = 0;
            P p = get_top(v);
            int top = p.second;
            int ct = p.first;
            rep(i,1<<ct) {
                int tmp = v;
                int V = 0, W = 0;
                rep(j,ct) {
                    if (i>>j&1) {
                        V += dat[tmp-1].first;
                        W += dat[tmp-1].second;
                    }
                    tmp /= 2;
                }
                if (l-W >= 0) chmax(ans,mp[top][l-W]+V);
            }
            cout << ans << endl;
        }
    }
}

Measured memory_bytes: 814776
x = int(input())
 
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)

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

void solve(long long N, long long M, std::vector<long long> x,
           std::vector<long long> y, std::vector<long long> z) {

  long long sum = 0;
  long long ans = 0;
  for (int i = 0; i < 8; i++) {
    int a, b, c;
    a = (i & 1) ? -1 : 1;
    b = (i & 2) ? -1 : 1;
    c = (i & 4) ? -1 : 1;
    // cerr << a << ":" << b << ":" << c << endl;
    sum = 0;
    vector<long long> arr;

    for (int j = 0; j < N; j++) {
      sum = x[j] * a + y[j] * b + z[j] * c;
      arr.push_back(sum);
    }

    sort(arr.rbegin(), arr.rend());

    long long tmp = 0;
    for (int i = 0; i < M; i++) {
      tmp += arr[i];
    }
    ans = max(ans, tmp);
  }

  cout << ans << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long M;
  scanf("%lld", &M);
  std::vector<long long> x(N);
  std::vector<long long> y(N);
  std::vector<long long> z(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &x[i]);
    scanf("%lld", &y[i]);
    scanf("%lld", &z[i]);
  }
  solve(N, M, std::move(x), std::move(y), std::move(z));
  return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_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 ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, H, M = MAP()

t = 60*H+M
deg = 5.5 * t
deg = min(360-deg, deg)

rad = radians(deg)
c2 = A**2 + B**2 - 2*A*B*cos(rad)
print(c2**0.5)


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

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define endl "\n"
#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007
//グリッドグラフの範囲チェック
bool range_validation(int y,int x,int h,int w){
    return y>=0 && y<h && x>=0 && x < w;
}
//ビットカウント
int popcount(long bits){
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int gcd(ll a, ll b){
  if(b == 0){
    return a;
  }else{
    return gcd(b,a%b);
  }
}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n,m;
  cin >> n >> m;
  vector<vector<int>> graph(n,vector<int>(0));
  int a,b;
  REP(i,m){
    cin >> a >> b;
    a--;
    b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  vector<int> dist(n,-1);

  queue<int> queue;
  queue.push(0);
  dist[0] = 0;
  while(queue.size() > 0){
    int from = queue.front();queue.pop();
    for(auto to : graph[from]){
      if(dist[to] == -1){
        dist[to] = dist[from] + 1;
        queue.push(to);
      }
    }
  }
  if(dist[n-1] == 2){
    cout << "POSSIBLE" << endl;
  }else{
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}


Measured memory_bytes: 16076
A, B, C, X = [int(input()) for i in range(4)]

cnt = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500 * i + 100 * j + 50 * k == X:
                cnt += 1
print(cnt)

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

int main() {
    int c[3][3];
    rep(i, 3) rep(j, 3) cin >> c[i][j];

    string ans = "Yes";

    int x[3], y[3];
    x[0] = 0;

    rep(i, 3) y[i] = c[0][i] - x[0];

    rep(i, 3) x[i] = c[i][0] - y[0];

    rep(i, 3) rep(j, 3) {
        if (x[i]+y[j] != c[i][j]) ans = "No";
    }

    cout << ans << endl;

    return 0;
}

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

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


// エラトスネテスの篩
struct Eratos {
    vector<int> primes;
    vector<bool> isprime;
    vector<int> min_factor;

    Eratos(int MAX) : primes(),
                      isprime(MAX+1, true),
                      min_factor(MAX+1, -1) {
        isprime[0] = isprime[1] = false;
        min_factor[0] = 0, min_factor[1] = 1;
        for (int i = 2; i <= MAX; ++i) {
            if (!isprime[i]) continue;
            primes.push_back(i);
            min_factor[i] = i;
            for (int j = i*2; j <= MAX; j += i) {
                isprime[j] = false;
                if (min_factor[j] == -1) min_factor[j] = i;
            }
        }
    }

    // prime factorization
    vector<pair<int,int>> prime_factorize(int n) {
        vector<pair<int,int> > res;
        while (n != 1) {
            int prime = min_factor[n];
            int exp = 0;
            while (min_factor[n] == prime) {
                ++exp;
                n /= prime;
            }
            res.push_back(make_pair(prime, exp));
        }
        return res;
    }
};


int main(){
    int N; cin>>N;
    vector<int> A(N); rep(i,N)cin>>A[i];
    Eratos er(1100000);
    map<int,int> M;
    int flag = 0;
    rep(i,N){
        auto pf = er.prime_factorize(A[i]);
        for(auto p : pf){
            if(i==0){
                M[p.first]++;
            }else{
                if(M.count(p.first)){
                    flag = 1;
                    break;
                }
                M[p.first]++;
            }
        }
        if(flag)break;
    }
    if(!flag){
        cout<<"pairwise coprime"<<endl;
        return 0;
    }
     

    ll res = A[0];
    rep1(i,N-1)res = GCD(res,A[i]);
    if(res==1){
        cout<<"setwise coprime"<<endl;
        return 0;
    }

    cout<<"not coprime"<<endl;


}


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

int main(){
  int n,m;
  bool jems[30][30];
  bool gred[30][30];
  while(cin>>n,n){
    memset(jems,0,sizeof(jems));
    memset(gred,0,sizeof(gred));
    int x,y;
    for(int i=0;i<n;i++){
      cin>>x>>y;
      jems[y][x]=true;
    }
    cin>>m;
    gred[10][10]=true; 
    x=y=10;
    for(int i=0;i<m;i++){
      char dire;
      int dist;
      cin>>dire>>dist;
      for(int j=0;j<dist;j++){
	if(dire=='N'){
	  gred[++y][x]=true;
	}else if(dire=='S'){
	  gred[--y][x]=true;
	}else if(dire=='W'){
	  gred[y][--x]=true;
	}else{
	  gred[y][++x]=true;
	}
      }
    }
    bool ans=true;
    for(int i=0;i<30;i++){
      for(int j=0;j<30;j++){
	//cout << jems[i][j];
	//cout << gred[i][j];
	if(jems[i][j]==false)continue;
	if(jems[i][j]==true && gred[i][j]==false)ans=false;
      }
      //cout << endl;
    }
    if(ans==true){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define M_PI 3.14159265358979323846
using namespace std ;

int main()
{
    double r ;
    cin >> r ;
    double area = M_PI*r*r ;
    double circumference = 2*M_PI*r ;
    printf("%.6lf %.6lf\n" , area , circumference) ;
}


Measured memory_bytes: 3188
let rec mark marked list nums = 
  match list with
  | [] -> marked
  | (r, c, n)::list -> if List.exists (fun x -> n = x) nums then mark ((r, c)::marked) list nums else mark marked list nums

let jedge list =
  let hasRowLine l num = l |> List.filter (fun (r, _) -> r = num) |> List.length |> (fun x -> x >= 3)
  let hasColLine l num = l |> List.filter (fun (_, c) -> c = num) |> List.length |> (fun x -> x >= 3)
  if hasRowLine list 1 then
    "Yes"
  else if hasRowLine list 2 then
    "Yes"
  else if hasRowLine list 3 then
    "Yes"
  else if hasColLine list 1 then
    "Yes"
  else if hasColLine list 2 then
    "Yes"
  else if hasColLine list 3 then
    "Yes"
  else if list |> List.filter (fun (r,c) -> r = c) |> List.length |> (fun x -> x = 3) then
    "Yes"
  else if list |> List.filter (fun (r,c) -> (r = 1 && c = 3) || (r = 3 && c = 1) || (r = 2 && c = 2)) |> List.length |> (fun x -> x = 3) then
    "Yes"
  else
    "No"

let l1 = stdin.ReadLine().Split(" ") |> Array.map int |> Array.indexed |> Array.map (fun (i, num) -> (1, i + 1, num)) |> Array.toList
let l2 = stdin.ReadLine().Split(" ") |> Array.map int |> Array.indexed |> Array.map (fun (i, num) -> (2, i + 1, num)) |> Array.toList
let l3 = stdin.ReadLine().Split(" ") |> Array.map int |> Array.indexed |> Array.map (fun (i, num) -> (3, i + 1, num)) |> Array.toList


let l = List.append l1 l2 |> List.append l3
let n = stdin.ReadLine() |> int

[1 .. n] 
|> List.map (fun _ -> stdin.ReadLine() |> int)
|> mark [] l
|> jedge
|> printfn "%s"

Measured memory_bytes: 30028
import java.util.Scanner;
import java.util.Arrays;

public class Main {
    private static Scanner in;

    private static int n;
    private static double[] p;
    private static double[][] dp;

	public static void main(String[] args) {
        in = new Scanner(System.in);
        
        n = in.nextInt();
        p = new double[n];
        dp = new double[n][n];
        for(int i=0; i<n; i++) {
            Arrays.fill(dp[i], -1);
        }

        for(int i=0; i<n; i++) p[i] = in.nextDouble();

        System.out.println(solve(0, 0));
	}

    private static double solve(int i, int heads) {
        if (i==n) {
            if (heads>n-heads) {
                return 1;
            } else {
                return 0;
            }
        }

        if (dp[i][heads]!=-1) return dp[i][heads];

        return dp[i][heads] = p[i]*solve(i+1, heads+1)+(1-p[i])*solve(i+1, heads);
    }

}


Measured memory_bytes: 136540
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int main() {  
  int64_t N, K;
  cin >> N >> K;

  vector<int64_t> P(N);
  for (int64_t n = 0; n < N; ++n) {
    cin >> P[n];
    --P[n];
  }
  vector<int64_t> C(N);
  for (int64_t n = 0; n < N; ++n) {
    cin >> C[n];
  }
  int64_t res = -1000000001;
  for (int64_t n = 0; n < N; ++n) {
    int64_t i = n;
    int64_t sum = 0;
    vector<int64_t> sums;
    while (true) {
      i = P[i];
      sum += C[i];
      sums.push_back(sum);
      if (i == n) break;
    }
    for (size_t j = 0; j < sums.size(); ++j) {
      if (K < j + 1) break;
      if (sum < 0) {
        res = max(res, sums[j]);
      } else {
        int64_t loop = (K - j - 1) / sums.size();
        res = max(res, loop * sum + sums[j]);
      }
    }
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3796
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
A, B = [list(i) for i in zip(*AB)]
t = 0
bl = True
for i in range(N):
    t += A[i]
    if t > B[i]:
        bl = False

print('Yes' if bl else 'No')

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll a,b,c; cin>>a>>b>>c;
  if(c-a-b>=0 && 4*a*b<(c-a-b)*(c-a-b)) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
def mul(v,u):
    s = 0
    for i in range(len(u)):
        s += v[u[i][0]] * u[i][1]
    return s

[n,m] = list(map(int,input().split()))

t = [ [] for j in range(n) ]

while True:
    d = list(map(int,input().split()))
    if d == [0,0,0]:
        break
    else:
        t[d[0]-1].append([d[1]-1,d[2]])

c = int(input())
p = [ list(map(int,input().split())) for i in range(c) ]

for i in range(c):
    r = []
    for j in range(n):
        r.append( mul(p[i],t[j]) )
    print(" ".join(map(str,r)))

Measured memory_bytes: 48664
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>

// #define INT_MAX 2147483647
// #define LL_MAX 9223372036854775807

using namespace std;
#define i64  long long

void solve(void)
{

  double r;
  cin>>r;

  cout<<std::fixed<<r*r*M_PI<<" "<<2*r*M_PI<<endl;
  
  return;
}
int main(int argc, const char *argv[])
{

  solve();

  return 0;
}



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

int main() {
	long long int x;
	cin >> x;
	long long int yokin = 100;
	int tol = 0;

	while (yokin < x) {
		yokin = yokin *1.01;
		tol++;
	}

	cout << tol << endl;

	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pii pair<lli,lli>
struct triplet{int index,a,b;};bool comp (triplet &t1, triplet &t2){return (t1.a < t2.a);}

int main()
{
    fio;
    string s,t;
    cin>>s>>t;
    int a=s.length(),b=t.length();
    int dp[a+1][b+1];
    for(int i=0;i<=a;i++)
        dp[i][0]=0;
    for(int i=1;i<=b;i++)
        dp[0][i]=0;
    for(int i=1;i<=a;i++)
    {
        for(int j=1;j<=b;j++)
        {
            if(s[i-1]==t[j-1])
                {dp[i][j]=dp[i-1][j-1]+1;}
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    string ans = "";
    int si = s.size(), ti = t.size();
    while (si != 0 && ti != 0) {
        int add = s[si - 1] == t[ti - 1];
        if (dp[si - 1][ti - 1] + add == dp[si][ti]) {
            if (add) {
                ans = s[si - 1] + ans;
            }
            si--;
            ti--;
        } else if (dp[si - 1][ti] == dp[si][ti]) {
            si--;
        } else {
            ti--;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 35456
n,m,q=map(int,input().split())
a=[]
for _ in range(q):
    a.append(list(map(int,input().split())))

ans=0
def search(l):
    global ans
    if len(l)==n+1:
        score=0
        for i in range(q):
            if l[a[i][1]]-l[a[i][0]]==a[i][2]:
                score+=a[i][3]
        ans=max(ans,score)
    
    else:
        for i in range(l[-1],m+1):
            search(l+[i])

search([1])

print(ans)



Measured memory_bytes: 72940
#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define x first
#define y second
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
#define plll pair <pair <ll, ll>, ll>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
#define psl pair <string, ll>
#define all(a) a.begin(), a.end()

typedef long long ll;

typedef long double ld;

using namespace std;

const ll maxn = 1e7;
const ll mod = 998244353;

ll n, m, k, t;

ll st2[maxn];

ll F[maxn];

ll RF[maxn];

inline ll step(ll a, ll x) {
    if (x == 0) {
        return 1;
    }
    if (x % 2 == 1) {
        return step(a, x - 1) * a % mod;
    }
    ll t = step(a, x / 2);
    return t * t % mod;
}

inline ll del(ll a, ll b) {
    return a * step(b, mod - 2) % mod;  
}

inline ll getc(ll n, ll k) {
    return F[n] * RF[k] % mod * RF[n - k] % mod;
}

inline ll wrong(ll a1) {
    // ll mul = st2[n / 2 - a1];
    ll goal = n / 2 - a1 + 1;
    // cout << "GOAL " << goal << endl;
    ll sum = getc(n / 2, goal) * st2[n / 2 - goal] % mod;
    // cout << "SUM " << " " << sum << endl;
    ll ans = sum;
    // cout << "WRONG " << a1 << " " << ans << endl << endl;;
    return ans;
}

int main() {
    pyshnapyshnakaa;
    ll q, w, e, a, b, c;
    F[0] = RF[0] = 1;
    for (q = 1; q < maxn; q++) {
        F[q] = F[q - 1] * q % mod;
    }
    RF[maxn - 1] = del(1, F[maxn - 1]);
    for (q = maxn - 2; q >= 0; q--) {
        RF[q] = RF[q + 1] * (q + 1) % mod;
    }
    cin >> n;
    st2[0] = 1;
    for (q = 1; q < maxn; q++) {
          st2[q] = st2[q - 1] * 2 % mod;
    }
    ll ans = step(3, n);
    ll dans = 0;
    ll cursum = 0;
    for (q = 1; q <= n / 2; q++) {
        ll ddans = wrong(q);
        ll mul = st2[n / 2 - q] * getc(n / 2, q) % mod;
        cursum += ddans;
        cursum %= mod;
        dans += cursum * mul % mod;
        // cout << "CURSUM mul " << cursum << " " << mul << endl << endl;; 
        dans %= mod;
    }
    // cout << dans << " DANS" << endl;
    ans = (ans - 2 * dans + mod * 4) % mod;
    cout << ans;
    return 0;
}

Measured memory_bytes: 234752
#include <iostream>
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod = 1000000007;
using namespace std;
void add(ll& x , ll y){
	x += y;
	if(x >= mod) x -= mod;
}
ll mul(ll x , ll y){
	return (x * y) % mod;
}
ll Pow(ll x , ll y){
	if(y == 0) return 1 ;
	ll z = Pow(x , y / 2) ;
	if(y % 2) return (((z * z) % mod) * x) % mod ;
	return (z * z) % mod  ;
}
bool f(string x , string y){
	string c = x + y ;
	string d = y + x ;
	vll h(c.size() , 0) ;
	h[0] = (c[0] == 'h') ;
	for(int i = 1 ; i < (int)c.size() ; i++){
		h[i] = h[i - 1] + (c[i] == 'h') ;
	}
	vll h1(c.size() , 0) ;
	h1[0] = (d[0] == 'h') ;
	for(int i = 1 ; i < (int)c.size() ; i++){
		h1[i] = h1[i - 1] + (d[i] == 'h') ;
	}
	ll ans1 = 0 ;
	for(int i = 0 ; i < (int)c.size() ; i++){
		if(c[i] == 's')
			ans1 += h[(int)c.size() - 1] - h[i] ;
	}
	ll ans2 = 0 ;
	for(int i = 0 ; i < (int)c.size() ; i++){
		if(d[i] == 's')
			ans2 += h1[(int)c.size() - 1] - h1[i] ;
	}
	return ans1 >  ans2 ;
}
//Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1
///    *check mod
///    *check input file  
int main(){
	IOS;
	int n ; cin >> n ;
	vll a(n) ; for(int i = 0 ; i < n ; i++) cin >> a[i] ;
	vll col = {a[n -1]} ;
	for(int i = n - 2 ; i >= 0 ; i--){
		vll :: iterator up = upper_bound(col.begin() , col.end() , a[i]) ;
		if(up == col.end()) col.pb(a[i]) ;
		else *up = a[i] ;
	}
	cout << col.size() << endl ;
	
	
			
	
	return 0;
}



Measured memory_bytes: 2168