akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define gcd __gcd
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
#define pr(n) printf("%d ",n)
#define out(n) printf("%d\n",n)
#define inl(a) cin >> a
#define prl(a) cout << a << " "
#define outl(a) cout << a << endl
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define ck printf("continue\n")
#define all(vec) vec.begin(),vec.end()
#define asc(vec) sort(vec.begin(),vec.end())
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
#define tddd tuple<double,double,double>
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<int,pair<int,int> > >
#define vvii vector<vector<pair<int,int> > >
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define N 100005
int dp[N];
int main()
{
    int n,k,i,x,j;
    in2(n,k);
    vi v(n);
    read(v,i,n);
    rep(i,v[0])
        dp[i]=1;
    lp(i,v[0],k+1)
    {
        x=0,j=0;
        while(j<n && v[j]<=i)
            x|=(dp[i-v[j]]),j++;
        dp[i]=1-x;
    }
    if(dp[k])
        printf("Second");
    else
        printf("First");
}








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

int main(){
  int x,y;
  cin>>x>>y;
  if(x==2||y==2){
    cout<<"No";
  }
  else if(x==4||x==6||x==9||x==11){
    if(y==4||y==6||y==9||y==11){
      cout<<"Yes";
    }
    else{
      cout<<"No";
    }
  }
  else{
    cout<<"Yes";
  }
} 

Measured memory_bytes: 256
#include<cstdio>  
#include<iostream>  
#include<algorithm>  
#include<cstdlib>  
#include<cstring>
#include<string>
#include<climits>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#define LL long long
#define pii pair<int,int>
#define mp make_pair
 
using namespace std;
 
inline char nc(){
	/*
  static char buf[100000],*p1=buf,*p2=buf;
  if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) return EOF; }
  return *p1++;
  	*/return getchar();
}
 
inline void read(int &x){
  char c=nc();int b=1;
  for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;
  for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;
}
 
inline void read(LL &x){
  char c=nc();LL b=1;
  for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;
  for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;
}
 
inline int read(char *s)
{
    char c=nc();int len=0;
    for(;!(c>='0' && c<='9');c=nc()) if (c==EOF) return 0;
    for(;(c>='0' && c<='9');s[len++]=c,c=nc());
    s[len++]='\0';
    return len;
}
 
inline void read(char &x){
  for (x=nc();!(x>='A' || x<='B');x=nc());
}
 
int wt,ss[19];
inline void print(int x){
    if (x<0) x=-x,putchar('-'); 
    if (!x) putchar(48); else {
    for (wt=0;x;ss[++wt]=x%10,x/=10);
    for (;wt;putchar(ss[wt]+48),wt--);}
}
inline void print(LL x){
    if (x<0) x=-x,putchar('-');
    if (!x) putchar(48); else {for (wt=0;x;ss[++wt]=x%10,x/=10);for (;wt;putchar(ss[wt]+48),wt--);}
}

int n;
LL a[100010],s[100010];

int main()
{
	read(n);
	for (int i=0;i<n;i++)
		read(a[i]);
	s[0]=a[0];
	for (int i=1;i<n;i++)
		s[i]=s[i-1]+a[i];
	LL ans1=0,p=0;
	for (int i=0;i<n;i++)
		if (i%2==0)
		{if (s[i]+p<=0) ans1+=1-(s[i]+p),p+=1-(s[i]+p);}
		else if (s[i]+p>=0) ans1+=(s[i]+p+1),p-=(s[i]+p+1);
	LL ans2=0;p=0;
	for (int i=0;i<n;i++)
    	if (i%2!=0)
		{if (s[i]+p<=0) ans2+=1-(s[i]+p),p+=1-(s[i]+p);}
    	else if (s[i]+p>=0) ans2+=(s[i]+p+1),p-=(s[i]+p+1);
	print(min(ans1,ans2));
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <cassert>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::pair<int,P> State;

const int INF = 1001001001;

// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

int N;
int H[101];

int main(){
    while(std::cin >> N, N){
        REP(i, N+1){
            std::cin >> H[i];
        }

        int res;
        REP(i, N+1){
            std::vector<int> v;
            REP(j, N+1){if(i==j){continue;} v.push_back(j);}
            
            int d = H[v[1]] - H[v[0]];
            bool f = true;
            FOR(j, 1, N){
                if(H[v[j]] - H[v[j-1]] != d){
                    f = false;
                    break;
                }
            }

            if(f){res = H[i];}
        }

        std::cout << res << std::endl;
    }
}

Measured memory_bytes: 1216
x,y;
main(){
    char c[1];
    for(;scanf("%d%s%d",&x,c,&y),c[0]!='?';){
        switch(c[0]){
            case'+':x=x+y;break;
            case'-':x=x-y;break;
            case'*':x=x*y;break;
            case'/':x=x/y;break;
        }
        printf("%d\n",x);
    }
}

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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

void solve();

int main(void){
    int N; cin >> N;
    int A[N], T[N];
    rep(i, N) cin >> T[i];
    rep(i, N) cin >> A[i];
    bool contradict = false;
    int choice1[N], choice2[N];
    int highest = 0;
    if(T[0] > A[0] || T[N-1] < A[N-1]){
        contradict = true;
    }
    choice1[0] = 1;
    choice2[N-1] = 1;
    for(int i = 1; i < N; i++){
        if(T[i] != T[i-1]){
            highest = i;
            choice1[i] = 1;
            if(T[i] > A[i]) contradict = true;
        }
        else{
            choice1[i] = T[highest];
        }
    }
    highest = N-1;
    for(int i = N-2; i >= 0; i--){
        if(A[i] != A[i+1]){
            highest = i;
            choice2[i] = 1;
            if(A[i] > T[i]) contradict = true;
        }
        else{
            choice2[i] = A[highest];
        }
    }
    if(contradict) cout << 0 << endl;
    else{
        ll ans = 1;
        rep(i, N) ans = ans*min(choice1[i], choice2[i]) % mod;
        cout << ans << endl;
    }
    return 0;
}

void solve(){}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	int sum = 0;
	vector<int>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	int s = sum;
	int my = 0;
	for (int i = 0; i < n; i++) {
		my += a[i];
		s = min(s, abs(my * 2 - sum));
	}
	cout << s;
	return 0;
}

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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<string> s(n);
    REP(i,n) cin>>s[i];
    int m; cin>>m;
    vector<string> t(m);
    REP(i,m) cin>>t[i];
    string nows = s[0];
    int memo = 0;
    int cnt = 0;
    REP(j,n){
        if(s[j]!=" ") nows = s[j];
        REP(i,n)
        {
            if(nows == s[i]){
                cnt++;
                s[i] = " ";
            } else continue;
        }
        REP(i,m)
        {
            if(nows == t[i]){
                cnt--;
            } else continue;
        }
        memo = max(memo, cnt);
        cnt = 0;
    }
    print(memo);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
using ll = long long;
using ii = pair<int, int>;

const ll mod = 1e9+7;

bool comp(ll a, ll b){
	return abs(a)>abs(b);
}
int32_t main(){
	ios::sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	vector<ll> vs(n);
	for(auto &x:vs) cin >> x;
	sort(all(vs), comp);
	stack<int> pos, neg;
	int i = 0;
	int w = k;
	while(i<n and w--){
		if(vs[i]>=0) pos.push(i++);
		else neg.push(i++);
	}
	bool neg_res = len(neg)%2==1;
	ll ans = 1;
	if(k!=n and neg_res){
		if(pos.empty()){
			int l = neg.top()+1;
			int pi = -1;
			for(i=l; i<n; ++i){
				if(pi==-1 and vs[i]>=0) pi=i;
			}
			if(pi!=-1){
				neg.pop();
				pos.push(pi);
				neg_res = false;
			}
			else{
				while(not neg.empty()) neg.pop();
				i = n-1;
				w = k;
				while(i>=0 and w--)
					neg.push(i--);
			}
		}
		else{
			int l = max(pos.top(), neg.top())+1;
			ll a = vs[pos.top()];
			ll b = vs[neg.top()];
			int ni = -1, pi = -1;
			for(i=l; i<n; ++i){
				if(pi==-1 and vs[i]>=0) pi=i;
				if(ni==-1 and vs[i]<0) ni=i;
			}
			if(ni==-1 or (pi!=-1 and (a*vs[pi])>=(b*vs[ni])) ){
				neg.pop();
				pos.push(pi);
			}
			else{
				pos.pop();
				neg.push(ni);
			}
			neg_res = false;
		}
	}
	while(not pos.empty()){ 
		i = pos.top(); pos.pop();
		ans = (ans*abs(vs[i]))%mod;
	}
	while(not neg.empty()){ 
		i = neg.top(); neg.pop();
		ans = (ans*abs(vs[i]))%mod;
	}
	if(neg_res) ans = (mod-ans)%mod;
	cout << ans << endl;
}


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

int main() {
  int n, s = 0;
  string a, b, c;
  cin >> n >> a >> b >> c;
  rep(i, n){
    if (a[i] == b[i] && b[i] == c[i]) continue;
    else if(a[i] == b[i] || a[i] == c[i] || b[i] == c[i]) ++s;
    else s += 2;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n,k,s;
   cin >> n >> k >> s;
   if(s == 1e9){
      f(i,0,k){
         cout << s << ' ';
      }
      f(i,k,n){
         cout << 1 << ' ';
      }
      cout << '\n';
   }else{
      f(i,0,k){
         cout << s << ' ';
      }
      f(i,k,n){
         cout << s+1 << ' ';
      }
      cout << '\n';
   }
   return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }
map<ll, int> PrimeFactor(ll n){
    map<ll,int> ret;
    for(ll i=2;i*i<=n;i++){
        while(n%i==0){
            ret[i]++;
            n/=i;
        }
    }
    if(n!=1) ret[n]=1;
    return ret;
}

int main(){
    ll n,p;cin>>n>>p;
    auto mp=PrimeFactor(p);
    ll ans=1;
    for(auto x:mp){
        ll tmp=x.second/n;
        ans*=(ll)pow(x.first,tmp);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
//#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int n, k;

vector<int> h,dp;

inline void solve(){

    cin >> n >> k;
    h.resize(n);
    dp.resize(n+2);
    for(int i = 0; i < n; i++) {
        cin >> h[i];
    }

    for(int i = 1; i < n; i++) {
        dp[i] = INF;
        for(int j = 1; j<= k; j++){
            if(i>=j)
                chmin(dp[i], dp[i-j]+abs(h[i]-h[i-j]));
        }
        
    }
    
    cout << dp[n-1] << endl;
    
}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


Measured memory_bytes: 1024
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
int a[20][20],n;
pair<int,int> fi(int p,int q){
  int i;
  int sm=q<0?0:a[p][q];
  pair<int,int> mx=make_pair(-1,0);
  for(i=0;i<n;++i){
    if(i==q||!a[p][i])
      continue;
    pair<int,int> tm=fi(i,p);
    sm+=tm.first;
    if(mx.first-mx.second<tm.first-tm.second)
      mx=tm;
  }
  if(mx.first<0)
    return make_pair(0,0);
  return make_pair(sm+(q<0?0:a[p][q]),sm-mx.first+mx.second);
}
int main(){
  int i;
  //int n;
  while(cin>>n,n){
    //int a[20][20];
    memset(a,0,sizeof(a));
    for(i=0;i<n-1;++i){
      int p,q,r;
      cin>>p>>q>>r;
      --p;
      --q;
      a[p][q]=a[q][p]=r;
    }
    cout<<fi(0,-1).second<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()


ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}


int main(){
    int n;
    cin >> n;
    string s;
    int a1=0;
    int a2 = 0;
    int r = 0;
    int w = 0;
    cin >> s;
    rep(i,n){
        if(s[i]=='R') r++;
        else w++;
    }
    for(int i = 0; i < r; i++){
        if(s[i] == 'W') a1++;
    }
    for(int i = r; i < n; i++){
        if(s[i] == 'R') a2++;
    }
    cout<< min(a1,a2) <<endl;
    //cout << r << w;
    return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
#define pi 3.1415926535897932
    
void solve(){
    double n; cin>>n;
    double x=(2*pi)*n;
    cout<<setprecision(10)<<x<<endl;
}
int main(){
    //tc(tt){
        solve();
    //}
}
/*


*/      

Measured memory_bytes: 3788
#include<stdio.h>
int main(){
	int a;
	int b;
	scanf("%d %d",&a,&b);
	int c=a+b;
	int d=a-b;
	int e=a*b;
	int max=c;
	if(max<d){
		max=d;
	}
	if(max<e){
		max=e;
	}
	printf("%d",max);
	return 0;
} 

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

int main(){
  ll H,W;
  cin >> H >> W;
  ll ans = H * W;
  vector<ll> s(3);
  for(int i = 0; i < 2; i++){
    for(ll h = 1; h < H; h++){
      //縦割り
      s.at(0) = h * W;
      s.at(1) = (H-h) * (W/2);
      s.at(2) = H * W - (s.at(0) + s.at(1));
      sort(s.begin(),s.end());
      ans = min(ans, s.at(2) - s.at(0));
      
      //横割り
      s.at(0) = h * W;
      s.at(1) = ((H-h) / 2) * W;
      s.at(2) = H * W - (s.at(0) + s.at(1));
      sort(s.begin(),s.end());
      ans = min(ans, s.at(2) - s.at(0));
      
    }
    swap(H,W);
  }
  cout << ans << endl;
    
}

Measured memory_bytes: 3600
#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

signed main()
{
	ios::sync_with_stdio(false);
	int n;cin>>n;
	vector<int> v1,v2;
	for(int i=1;i<=n;i++){
		int a,b;cin>>a>>b;
		v1.push_back(a+b);
		v2.push_back(a-b);
	}
	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());
	cout<<max(v1[v1.size()-1]-v1[0],v2[v2.size()-1]-v2[0])<<endl;
	return 0;
}

Measured memory_bytes: 5196
q = int(input())
lst = [0] * q
for i in range(q):
    l, r = map(int, input().split())
    lst[i] = (l, r)

import math
def is_prime(n):
    if n == 1:
        return 0
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return 0
    return 1

prime_lst = [0] * (10**5)
for i in range(10**5):
    if (i + 1) % 2 == 0:
        continue
    if is_prime((i + 1)) and is_prime((i + 2) // 2):
        prime_lst[i] = 1

cum = [0] * (10 ** 5 + 1)
for i in range(10 ** 5):
    cum[i + 1] = cum[i] + prime_lst[i]

for x in lst:
    print(cum[x[1]] - cum[x[0]-1])

Measured memory_bytes: 21140
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

  int n; cin >> n;

  cout << (n-2) * 180 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector<pair<int,int>>v(5);
    f(i,0,5){
        cin >> v[i].first;
        v[i].second = i;
    }
    sort(all(v));
    cout << v[0].second+1;
    return 0;
}
 


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

#define OnlineJudge1

#define loop(x,a,n) for(int x = a;x < n;x++)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define readline(s) getline(cin,s)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,ll> pill;
typedef pair<ll,ll> pll;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#define time__(d) \
    for ( \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second; \
        debug("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
    )

void init(){
    cin.tie(0);
    ios::sync_with_stdio(0);
#ifdef OnlineJudge
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
}


int main(){
    init();

    int n, ans = INT_MAX;  cin >> n;
    int arr[n]; for(int i = 0;i < n;i++)    cin >> arr[i];
    for(int i = -100;i <= 100;i++){
        int cost = 0;
        for(int j = 0;j < n;j++){
            cost += (i - arr[j]) * (i - arr[j]);
        }
        ans = min(ans, cost);
    }

    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <stack>
using namespace std;
int main() {
    string base ="abcdefghijklmnopqrstuvwxyz";
    map<int, char> m;
    for (int i = 0; i < 26; i++) m.insert({i, base[i]});
    long N;
    stack<char> ans;
    cin >> N;
    while(N--) {
        ans.push(m[N%26]);
        N /= 26;
    }
    while (!ans.empty()) {
        cout << ans.top(); ans.pop();
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

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

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


int len[50];
int ch[] = {0,5,7,5,7,7};

int main(){
	int n;
	while(1){
		cin >> n;
		if(n == 0) break;
		int ans = 0;
		for(int i = 1;i <= n;i++){
			string tmp;
			cin >> tmp;
			len[i] = tmp.length();
	//		cout << len[i] << endl;
		}
		for(int i = 1;i <= n;i++){
			int level = 1;
			int sum = len[i];
			int j = i;
			while(level != 6){
				j++;
				if(ch[level] == sum){
					level++;
					sum = len[j];
				}else if(ch[level] < sum){
					break;
				}else{
					sum += len[j];
				}
			}
			if(level == 6){
				ans = i;
				break;
			}else{
				continue;
			}
		}
		cout << ans << endl;
		
	}




}
	


Measured memory_bytes: 3128
n = int(input())
flag = False
def isPrime(n):
  if n == 2:
    # 2は素数
    return True
  for p in range(2, int(n **0.5) + 1):
      if n % p == 0:
        return False
  return True
n -= 1
while not(flag):
    n += 1
    flag = isPrime(n)
print(n)
        

Measured memory_bytes: 2940
n = int(input())
p = 10**9+7
cnt = [0 for i in range(n+1)]


def cnt_factor(n):
    i = 2
    k = n
    while i <= n:
        if k % i == 0:
            k = k // i
            cnt[i] += 1
        else:
            i += 1

for i in range(2, n+1):
    cnt_factor(i)


ans = 1
for i in range(2, n+1):
    ans *= (cnt[i]+1) % p

print(ans % p)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
 
    string s;
    cin>>s;

    bool flag=true;
    for(int i=0;i<s.size();i++){
        if(i%2==0){
            if(s.at(i)=='R'||s.at(i)=='U'||s.at(i)=='D')
                ;
            else{
                flag=false;
                break;
            }
        }else{
            if(s.at(i)=='L'||s.at(i)=='U'||s.at(i)=='D')
                ;
            else{
                flag=false;
                break;
            }
        }
    }

    if(flag)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
        
    return 0;
}  

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

using namespace std;

int main() {
    int N, K;
    string S;
    cin >> N;
    cin >> K;
    cin >> S;
    
    
    S[K-1] = S[K-1] - 'A' + 'a';
    
    cout << S;
    return 0;
}

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

using namespace std;
typedef long long ll;

int main(){

    int n,m;
    cin>>n>>m;


    int cnt=0;


  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
        cnt++;
    }
  }
  for(int j=0;j<m;j++){
    for(int k=j+1;k<m;k++){
        cnt++;
    }
  }

   cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  long long d = n / k;
  long long ans = d * d * d;
  if (!(k & 1)) {
    long long e = (n + k / 2) / k;
    ans += e * e * e;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
//#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

LL bfs(int k){
    queue<pair<LL, LL>> q;
    for(int i=1; i<=9; i++){
        q.push(make_pair(i, i));
    }
    int count=9;
    pair<LL, LL> u;
    LL tmp_num;
    LL tmp_tail;
    while(true){
        u=q.front();
        q.pop();
        if(u.second-1>=0){
            tmp_tail=u.second-1;
            tmp_num=u.first*10+tmp_tail;
            count++;
            q.push(make_pair(tmp_num, tmp_tail));
            //cout << count << " " << tmp_num << endl;
        }
        if(count==k){
            //cout << tmp_num << " " << count << endl;
            break;
        }

        tmp_tail=u.second;
        tmp_num=u.first*10+tmp_tail;
        count++;
        q.push(make_pair(tmp_num, tmp_tail));
        //cout << count << " " << tmp_num << endl; 
        if(count==k){
            //cout << tmp_num << " " << count << endl;
            break;
        }

        if(u.second+1<=9){
            tmp_tail=u.second+1;
            tmp_num=u.first*10+tmp_tail;
            count++;
            q.push(make_pair(tmp_num, tmp_tail));
            //cout << count << " " << tmp_num << endl; 
        }
        if(count==k){
            //cout << tmp_num << " " << count << endl;
            break;
        }
    }
    return tmp_num;
}

int main() {
    LL k;
    LL ans;

    cin >> k;

    if(k<=9){
        ans=k;
    }else{
        ans=bfs(k);
    }

    cout << ans << endl;

    return 0;
}

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

using ll = long long;
using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(false)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YN(x)         cout << ((x) ? "YES" : "NO") << endl
#define Yn(x)         cout << ((x) ? "Yes" : "No") << endl
#define yn(x)         cout << ((x) ? "yes" : "no") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;

ll gcd(ll a, ll b) { return __gcd(a, b); }
ll lcm(ll a, ll b) { return (a == 0 || b == 0) ? 0 : (a / __gcd(a, b) * b); }

string str_sort(std::string s) {
	rep(i, s.size()) {
		repd(j, i + 1, s.size()) {
			if(s[i] > s[j]) swap(s[i], s[j]);
		}
	}

	return s;
}

ll nC2(ll n) {
	if(n < 2) return 0;
	return n * (n-1) / 2;
}

int main(int argc, const char* argv[]) {
	ll n;
	cin >> n;
	map<string, ll> m;
	rep(i, n) {
		string tmp;
		cin >> tmp;
		tmp = str_sort(tmp);
		m[tmp] += 1;
	}

	ll ret = 0;
	for(auto itr = m.begin(); itr != m.end(); ++itr) {
		ret += nC2(itr->second);
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 11136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int x, a, b;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        x = sc.nextInt();
        a = sc.nextInt();
        b = sc.nextInt();
        solve();
    }

    void solve() {
        if (b <= a) {
            System.out.println("delicious");
        } else if (b <= a + x) {
            System.out.println("safe");
        } else {
            System.out.println("dangerous");
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


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

#define pb push_back
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

const ll Mod = 1e9 + 7;
const int Maxn = 2e5 + 10;
const ll Inf = 1e17;

vector<pll> G[Maxn];
ll a[Maxn], par[Maxn];

ll get(ll u){
	if(par[u] == u) return u;
	return par[u] = get(par[u]);
}
ll ans = 0;
void merge(ll u, ll v, ll w){
	//cerr << u << " " << v << '\n';
	u = get(u); v = get(v);
	if(u == v) return ;
	ans += w;
	par[u] = v;
	//cerr << "?!?!? " << u << ' ' << v << ' ' << w << '\n';
}

pll mn[Maxn], mn2[Maxn];

void add(ll u, pll nw){
	//if(nw.S == 0) cerr << nw.F << " " << nw.S << " done!\n";
	
	if(nw.S == mn[u].S){
		mn[u].F = min(mn[u].F, nw.F);
		return ;
	}
	if(nw.S == mn2[u].S){
		mn2[u].F = min(mn2[u].F, nw.F);
		if(mn2[u] < mn[u]) swap(mn2[u], mn[u]);
		return ;
	}
	if(mn[u] > nw){
		mn2[u] = mn[u];
		mn[u] = nw;
	} else mn2[u] = min(mn2[u], nw);
}
pll plu(pll nw, ll x){
	return {nw.F + x, nw.S};
}

void DFS(ll u, ll p){
	ll adj, w;
	add(u, {a[u], par[u]});
	//cerr << "!!!! " << par[u] << '\n';
	for(auto e : G[u]){
		adj = e.F; w = e.S;
		if(adj == p) continue;
		DFS(adj, u);
		add(u, plu(mn[adj], w));
		add(u, plu(mn2[adj], w));
	}
}
pll res[Maxn];
void DFS2(ll u, ll p){
	ll adj, w;
	for(auto e : G[u]){
		adj = e.F; w = e.S;
		if(adj == p) continue;
		add(adj, plu(mn[u], w));
		add(adj, plu(mn2[u], w));
		DFS2(adj, u);
	}
	if(mn[u].S != par[u])
		res[par[u]] = min(res[par[u]], plu(mn[u], a[u]));
	if(mn2[u].S != par[u])
		res[par[u]] = min(res[par[u]], plu(mn2[u], a[u]));
}

vector< pair<ll, pll> > E;

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	
	for(int i = 1; i <= n; i++) cin >> a[i];
	ll u, v, w;
	for(int i = 1; i < n; i++){
		cin >> u >> v >> w;
		G[u].pb({v, w});
		G[v].pb({u, w});
	}
	iota(par, par + Maxn, 0);
	for(int it = 0; it < 20; it++){
		
		for(int j = 1; j < Maxn; j++){
			par[j] = get(j);
			mn[j] = {Inf + Inf, j};
			mn2[j] = {Inf + Inf, j};
			res[j] = {Inf, j};
		}
		E.clear();
		
		DFS(1, -1);
		DFS2(1, -1);
		E.clear();
		for(int i = 1; i <= n; i++){
			if(get(i) == i){
				
				E.pb({res[i].F, {res[i].S, i}});
			}
		}
		sort(E.begin(), E.end());
		for(auto ed : E) merge(ed.S.F, ed.S.S, ed.F);	
	
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 48628
#include<stdio.h>
int main(void)
{
    int m,n,i,sum=0,temp=1;
    scanf("%d %d",&m,&n);
    for(i=m-1;i<=m;i++){
        temp*=i;
    }
    sum+=temp/2;
    temp=1;
    for(i=n-1;i<=n;i++){
        temp*=i;
    }
    sum+=temp/2;
    printf("%d",sum);
    return 0;
}


Measured memory_bytes: 128
//#include    <bits/stdc++.h>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <cassert>
#include <iterator>
#include <complex>
#define N  500005
#define mem(a,b) memset(a,b,sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define INF 0x3f3f3f3f
template<typename T> inline T max(T a,T b,T c){
    return max(a,max(b,c));
}
template<typename T> inline T min(T a,T b,T c){
    return min(a,min(b,c));
}
template<typename T> inline T max(T a,T b,T c,T d){
    return max(a,max(b,c,d));
}
template<typename T> inline T min(T a,T b,T c,T d){
    return min(a,min(b,c,d));
}
const int  dx[]={0,1,0,-1,0,1,-1,1,-1};
const int  dy[]={0,0,1,0,-1,1,-1,-1,1};
typedef long long ll;
using namespace std;
char s[110][110],t[110];
int main(){
    int n,l;
    scanf("%d%d",&n,&l);
    for (int i=1;i<=n;i++) scanf("%s",s[i]);
    for (int i=1;i<=n;i++){
        for (int j=i+1;j<=n;j++){
            if (strcmp(s[i],s[j])>0){
                strcpy(t,s[i]);
                strcpy(s[i],s[j]);
                strcpy(s[j],t);
            }
        }
    }
    for (int i=1;i<=n;i++)
        printf("%s",s[i]);
    printf("\n");
   return 0;
}



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

using namespace std;

int main()
{
  int A[2], B[2], C[2];
  cin >> A[0] >> B[0] >> C[0];
  if (A[0] % 2 == 0 && A[0] == B[0] && B[0] == C[0])
  {
    cout << -1 << endl;
    return 0;
  }
  int ans = 0;
  for (; A[ans & 1] % 2 == 0 && B[ans & 1] % 2 == 0 && C[ans & 1] % 2 == 0; ans++)
  {
    A[(ans + 1) & 1] = B[ans & 1] / 2 + C[ans & 1] / 2;
    B[(ans + 1) & 1] = A[ans & 1] / 2 + C[ans & 1] / 2;
    C[(ans + 1) & 1] = A[ans & 1] / 2 + B[ans & 1] / 2;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; // 998'244'353LL
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

vector<pair<long long, long long>> prime_factorization(long long n){
    vector<pair<long long, long long>> ret;
    for(long long i=2; i*i<=n; i++){
        if(n%i == 0) ret.push_back({ i, 0 });
        while(n%i == 0){
            ret.back().second++;
            n /= i;
        }
    }
    if(n != 1) ret.push_back({ n, 1 });
    return ret;
}

ll N;

signed main(){
    cin >> N;
    auto v = prime_factorization(N);
    ll ans = 0;
    rep(i, v.size()){
        int j = 1;
        while(v[i].second >= j){
            v[i].second -= j;
            ans++;
            j++;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {
  int n, m, a[101], b[101];
  cin >> n >> m;
  for(int i = 0; i < m; i++){
    cin >> a[i] >> b[i];
  }

  int pro = 0;
  int room;
  bool save;
  for(room = 1; room <= n;){
    int pm_room = room;
    save = false;

    for(int i = 0; i < m; ++i){    
      if(a[i] <= room){
        pm_room = max(b[i], pm_room);
	      if(b[i] == pm_room){
	        save = true;
        }
      }
    }

    if(!save){
      break;
    }
    room = pm_room + 1;
    ++pro;
  }

  if(save){
    cout<<pro<<endl;
  }
  else{
    cout<<"Impossible"<<endl;
  }

  return 0;
}


Measured memory_bytes: 3088
package main

import "fmt"

func main() {
	var A, B int
	fmt.Scanf("%d %d", &A, &B)

	M, m := maxmin(A, B)
	ans, _ := maxmin(M+M-1, M+m)
	fmt.Println(ans)
}

func maxmin(x, y int) (int, int) {
	if x > y {
		return x, y
	}
	return y, x
}


Measured memory_bytes: 512
fn main() {
    let _n: i32 = read();
    let mut h: Vec<i32> = read_vec();
    let inf: i32 = 10i32.pow(9)+7;
    let ans = h.iter().rev().fold(
        Some(inf),
        |acc, n|
            match acc {
                None => None,
                Some(r) =>
                    if *n-1 > r { None }
                    else if *n > r { Some(n-1) }
                    else { Some(*n) }
            }
    );
    println!("{}", match ans {None => "No", Some(_) => "Yes"});
}

fn get_line() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf.trim().to_owned()
}

fn read<T: std::str::FromStr>() -> T{
    get_line().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T>{
    get_line().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

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

int32_t main()
{
    
    double a,b;
    cin>>a>>b;
    
    
    double res1 = (a+1)/0.08;
    double res2 = b/0.1;
//   cout<<res1<<endl;


    // int num = min(res1,res2);
    
    // cout<<num<<endl;
    
    for(int i = res2 ; i <= res1 ; i++)
    {
        double ii = i;
        int num1 = floor(ii*(0.08));
        int num2 = floor(ii*(0.1));
        
        if(num1 == a && num2 == b)
            {    cout<<i<<endl;
                return 0;}
            
        
    }
    cout<<-1<<endl;
    
}

Measured memory_bytes: 256
// Problem : B - Count ABC
// Contest : AtCoder - AtCoder Beginner Contest 150
// URL : https://atcoder.jp/contests/abc150/tasks/abc150_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define ff first
#define ss second
#define vi vector<int>
#define pii pair<int, int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define mod (int)1e9+7
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define repf(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define N 100005
int main()
{
	FAST
    int t=1;
    // cin>>t;
    while(t--)
    {
		int n,ans=0;
		cin>>n;
		int i;
		string s;
		cin>>s;
		repf(i,0,n-2)
		{
			if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') ans++;
		}
		cout<<ans;
    }
    return 0;
} 


Measured memory_bytes: 3648
package main

import (
	"bufio"
	"flag"
	"fmt"
	"os"
	"sort"
	"strconv"
	"testing"
)

/*-----------Main-----------*/

func main() {
	N, M, K := readI(), readI(), readI()
	a := readIs(N)
	b := readIs(M)

	var ans, aT int
	bT := sum(b)
	j := M
	for i := 0; i <= N; i++ {
		if i != 0 {
			aT += a[i-1]
		}
		if aT > K {
			break
		}

		for j >= 0 {
			if aT+bT <= K {
				s := i + j
				if s > ans {
					ans = s
				}
				break
			}
			j--
			bT -= b[j]

		}
	}

	fmt.Println(ans)
}

func sum(a []int) int {
	b := 0
	for _, v := range a {
		b += v
	}
	return b
}

/*-----------Utilities-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	testing.Init()
	if flag.Parse(); flag.Arg(0) == "debug" {
		debug()
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Println("Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}

func max(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] > m {
			m = a[i]
		}
	}
	return m
}

func min(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] < m {
			m = a[i]
		}
	}
	return m
}

func sortI(a []int) []int {
	sort.Ints(a)
	return a
}

func reverse(a []int) []int {
	l := len(a)
	r := make([]int, l)
	for i := 0; i < l; i++ {
		r[i] = a[l-i-1]
	}
	return r
}

func countI(a []int, b int) int {
	l := len(a)
	var c int
	for i := 0; i < l; i++ {
		if a[i] == b {
			c++
		}
	}
	return c
}


Measured memory_bytes: 7972
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
const int mod = 1000000007;
std::vector<ll> a(3); bool ans=true;
int main(){

  for (size_t i = 0; i < 3; i++) {
    cin >> a[i];
  }
  sort(all(a));
  cout << (a[0]==a[1] && a[0] != a[2] && a[1] != a[2] || a[1]==a[2] && a[0] != a[2] && a[0] != a[1] ? "Yes" : "No") << endl; 
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1e18;



long long int N,M,K,A[200200],sum=0,res=0;

int main()
{
    cout << fixed << setprecision(18);
    cin>>N>>M>>K;
    cout<<K<<" "<<N<<" "<<M<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k;
  cin>>k;
  fflush(stdin);
  string s;
  cin>>s;
  int p=s.size();
  if(p<=k)
    cout<<s<<endl;
  else
  {
    string t="";
    for(int i=0;i<k;i++)
      t+=s[i];
    t+="...";
    cout<<t<<endl;
  }
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
	float a=0, b=0, c=0, d=0, e=0, f=0;
	float x=0, y=0;
	
	while( scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)!=EOF )
	{
		y = (d*c - a*f) / (d*b - a*e);
		x = (c - b*y) / a;
		
		printf("%.3f %.3f\n", x, y);
	}
	
	return 0;
}

Measured memory_bytes: 644
#include "bits/stdc++.h"
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;

//ll gcd(ll a, ll b)
//{
//    if (a == 0)
//        return b;
//    else
//        return gcd(b % a, a);
//}
 
//ll modexp(ll x, ll y, ll p)
//{
//    ll res = 1;      
//    x = x % p;   
//    while (y > 0)
//    {
//        if (y & 1)
//            res = (res * x) % p;
//        y = y >> 1; 
//        x = (x * x) % p;
//    }
//    return res;
//}
 
//ll sub_mod(ll a, ll b, ll m)
//{
//    if (a >= b)
//        return a - b;
//    else
//        return m - b + a;
//}
 
// ll add_mod(ll a, ll b)
// {
//    if (0 == b) 
//        return a;
 
//    b = mod - b;
//    if (a >= b)
//        return a - b;
//    else
//        return mod - b + a;
// }

int main()
{
	fastio;
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
 	//freopen("output.txt", "w", stdout);
	//#endif
	ll k=0,x=0;
	cin>>k>>x;
	if(k*500>=x)
		cout<<"Yes";
	else
		cout<<"No";

	return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: usize,
        ab: [(i64, i64); n - 1],
    }
    let mut res = 0i64;
    for i in 1..=n as i64 {
        res += i * (n as i64 - i + 1);
    }
    for (mut a, mut b) in ab {
        if a > b {
            std::mem::swap(&mut a, &mut b);
        }
        res -= a * (n as i64 - b + 1);
    }
    println!("{}", res);
}


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

int main() {
  int N;
  cin >> N;
  
  int count;
  int ans = 0;

  for (int i = 1; i <= N; i+=2) {
    count = 0;
    for (int j = 1; j <= i; j++) {
      if (i % j == 0) {
        count++;
      }
    }
    if (count == 8) {
      ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
ns=list(map(int,input().split()))
ans=0
for i in range(n):
    minj=i
    for j in range(i,n):
        if(ns[j]<ns[minj]):
            minj=j
    if i!=minj:
        ans+=1
        k=ns[i]
        ns[i]=ns[minj]
        ns[minj]=k
 
for i in range(n):
    if(i!=n-1):
        print(ns[i],end=' ')
print(ns[n-1])
print(ans)


Measured memory_bytes: 5608
#include<stdio.h>
  int main(void)
{
   int a,b,d,r;
   double f;
   scanf("%d %d",&a,&b);
      d = a/b;
      r = a%b;
      f = 1.0 * a/b;
   printf("%d %d %.5lf\n",d,r,f);
    return 0;
}

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

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

using namespace std;

int main() {
  int N, A; cin >> N >> A;
  int x[55];
  rep(i, N) cin >> x[i];
  int64_t dp[50*50+1][55] = {};
  dp[0][0] = 1;
  rep(k, N) {
    for (int i = 50*50; i>=x[k]; i--) {
      rep(sel, k + 1) {
        dp[i][sel + 1] += dp[i - x[k]][sel];
      }
    }
  }
  int64_t sum = 0;
  REP(i, 1, N + 1) {
    sum += dp[A * i][i];
  }
  cout << sum << endl;
}


Measured memory_bytes: 1280