akhauriyash/Code-Regression huggingface dataset:
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-9
#define M_PI 3.141592653589793
#define bs 1000000007
#define bsize 512

#define ldouble long double

using namespace std;

const int N = 1000031;

long long n,a[N],b[N];
long long cur_moves;

int main(){
	//freopen("tree.in","r",stdin);
	//freopen("tree.out","w",stdout);
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);

	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i];
	}

	for (int i=n;i>=1;--i)
	{
		long long cur_val=a[i]+cur_moves;
		long long cur_rem=cur_val%b[i];
		if (cur_rem!=0)
			cur_moves+=b[i]-cur_rem;
	}
	cout<<cur_moves<<endl;

	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 1792
import java.util.*;
import java.io.*;
import java.util.stream.IntStream;
 
class Main {
    public static void main(String[] args) {
		OriginScanner scanner = new OriginScanner();
		int k = scanner.nextInt();
		
		boolean isPrimeNum = false;
		while (!isPrimeNum) {
			int num = k;
			isPrimeNum = IntStream.range(2, num).allMatch(c -> num % c != 0);
			if (isPrimeNum) System.out.println(num);
			k++;
		}
	}
	static class OriginScanner {
		StringTokenizer token;
		BufferedReader br;
		
		public OriginScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String nextLine() {
			String str = null;
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				System.out.println(e);
			}
			return str;
		}
		
		String next() {
			while (token == null || !token.hasMoreElements()) { 
				token = new StringTokenizer(nextLine());
			}
			return token.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
	}
}

Measured memory_bytes: 28628
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


void solve() {
  string s;
  cin >> s;
  cout << s[0] << s.size()-2 << s[s.size()-1] << endl;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,x,m;
    cin >> n >> x >> m;
    vector<vector<ll>> dub(m, vector<ll>(40, -1));
    vector<vector<ll>> dubsum(m, vector<ll>(40, 0));
    rep(i, m){
        dub[i][0] = i*i%m;
    }
    rep(i, 39){
        rep(j,m){
            dub[j][i + 1] = dub[dub[j][i]][i];
        }
    }
    rep(i,m){
        dubsum[i][0] = i;
    }
    rep(i,39){
        rep(j,m){
            dubsum[j][i+1] = dubsum[j][i] + dubsum[dub[j][i]][i];
        }
    }
    ll ans = 0;
    ll bit = 0;
    ll now = x;
    while(n){
        if(n & 1){
            ans += dubsum[now][bit];
            now = dub[now][bit];
        }
        ++bit;
        n >>= 1;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 73460
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int l1 = s.size(), l2 = t.size();
  int cnt, maxm = 0;
  for (int i = 0; i <= l1 - l2; i++) {
    cnt = 0;
    for (int j = 0; j < l2; j++) {
      if (s[i + j] == t[j]) cnt++;
    }
    maxm = max(maxm, cnt);
  }
  cout << l2 - maxm << endl;
  return 0;
}


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

const char a = 'a', z = 'z', la = 'A';

string conv(string s)
{
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] >= a && s[i] <= z)
		{
			s[i] = la + (s[i] - 'a');
		}
	}
	return s;
}

int main()
{
	string s;
	getline(cin, s);
	cout << conv(s) << endl;
	return 0;
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void dfs(const vector<vector<int>> &g,vector<int> &depth,const int x,const int d){
	depth[x]=d;
	for(auto p:g[x]){
		dfs(g,depth,p,d+1);
	}
}


int main()
{
	int n;
	cin>>n;
	vector<vector<int>> g(n);
	vector<int> parent(n,-1),depth(n,0);
	rep(i,n){
		int idx,k;
		cin>>idx>>k;
		rep(j,k){
			int x;
			cin>>x;
			g[idx].push_back(x);
			parent[x]=idx;
		}
	}
	rep(i,n){
		if(parent[i]==-1)dfs(g,depth,i,0);
	}
	rep(i,n){
		string node_type="internal node";
		if(parent[i]==-1)node_type="root";
		else if(g[i].size()==0)node_type="leaf";
		printf("node %d: parent = %d, depth = %d, %s, [",i,parent[i],depth[i],node_type.c_str());
		rep(j,g[i].size()) cout<<g[i][j]<<(j!=g[i].size()-1?", ":"");
		cout<<"]"<<endl;
	}
	return 0;
}


Measured memory_bytes: 6728
#include <bits/stdc++.h>
using namespace std;
int fx4[] = {1 , -1 , 0 , 0};
int fy4[] = {0 , 0 , 1 , -1};
int Kfx[]= {-2,-2,2,2,1,1,-1,-1}; ///knight move x - exis
int Kfy[]= {1,-1,1,-1,2,-2,2,-2}; ///knight move y- exis
int fx8[]= {1,1,1,0,0,-1,-1,-1};
int fy8[]= {0,1,-1,1,-1,0,1,-1};
#define ll long long int
#define pii pair<int,int>
#define llu unsigned long long
#define inf 1<<28
#define gama 0.57721566490
#define PI              acos(-1.0)
#define INF             0x7fffffff
#define MOD             1000000007
#define EPS             1e-7
#define all(r)(r).begin(),(r).end()
/*
bool status[mx];
void sieve(){
   long long int  i,j;
    for(i=2;i<=mx;i++)
    {
        status[i]=0;
    }
    for( i=2;i<=sqrt(mx);i++){
        if(status[i]==0)
        {
            for(j=i*i;j<=mx;j+=i){
                status[j]=1;
            }
        }
    }
}*/
ll BM( ll a , ll b , ll m )
{
    if ( b == 0 ) return 1 ;
    ll x = BM(a,b/2,m);
    x = (( x % m) * (x % m))%m;

    if( b % 2 ) x = (( x % m) * (a %m)) % m ;
    return x ;
}
#define dd double
#define sc scanf
#define pr printf
#define VI vector<int>
#define VS vector<string>
#define VC vector<char>
#define VLL vector<long long int>
#define FILE freopen("input.txt","rt",stdin); freopen("output.txt","w",stdout);
#define p_b push_back
#define mem(x,y) memset(x,y,sizeof(x))
#define F(i,a,b) for(i=a;i<=b;i++)
#define sc1(a) scanf("%d",&a)
#define scL1(a) scanf("%lld",&a)
#define scL2(a,b) scanf("%lld%lld",&a,&b)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define fori(N)          for(int i = 0; i<(N); i++)
#define forj(N)         for(int j = 0; j<(N); j++)
#define fork(N)         for(int k = 0; k<(N); k++)
#define forl(N)         for(int l = 0; l<(N); l++)
#define ford(N)         for(int d = 0; d<(N); d++)
#define fori1(N)          for(int i = 1; i<=(N); i++)
#define forj1(N)         for(int j = 1; j<=(N); j++)
#define fork1(N)         for(int k = 1; k<=(N); k++)
#define ford1(N)         for(int d = 1; d<=(N); d++)
#define sqr(x)           (x)*(x)
#define TEST int test,te=0;sc1(test);
#define segment_tree int l=(n*2),r=(n*2)+1,mid=(l+r)/2
#define Mx 100005
#define mx 10005

int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    priority_queue<int>q;
    int n,m;
    cin>>n>>m;
    fori(n){
    int x;
    cin>>x;
    q.push(x);
    }
    while(m--){
        q.push(q.top()/2);
        q.pop();
    }
    ll ans=0;
    while(!q.empty()){
        ans+=q.top();
        q.pop();
    }
    cout<<ans<<endl;
}




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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

class UnionFind {
	vector<int> data;
	public:
	int independentSet;
	UnionFind(int size) : data(size, -1), independentSet(size) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
			independentSet--;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

class Solution {
public:
	void solve() {
		long long n, m, q;
		cin >> n >> m >> q;
		UnionFind uf0(n);
		vector<pair<int, int>> c1;
		for(int Q=0; Q < q; Q++){
			int a, b, c;
			cin >> a >> b >> c;
			if(c == 0)uf0.unionSet(a, b);
			else c1.push_back(make_pair(a, b));
		}
		if(m == n-1){
			if(c1.size() != 0)cout << "No" << "\n";
			else cout << "Yes" << "\n";
			return;
		}
		for(auto t: c1){
			if(uf0.findSet(t.first, t.second)){
				cout << "No" << "\n";
				return;
			}
		}
		long long k = uf0.independentSet;
		if(m <= n + (k*(k-3))/2)cout << "Yes" << "\n";
		else cout << "No" << "\n";
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 1784
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
//[1,n]
const int MAX_N=1e+5;
int bit[MAX_N+1], n;
int sum(int i){
    int s=0;
    while(i>0){
        s+=bit[i];
        i-=i&-i;
    }
    return s;
}
void add(int i,int x){
    while(i<=n){
        bit[i]+=x;
        i+=i&-i;
    }
}

int main(void){
    int m;cin>>n>>m;
    vector<pair<int,int>> p(m);
    rep(i,m)cin>>p[i].second>>p[i].first;
    sort(p.begin(),p.end());
    int res=0;
    rep(i,m){
        int a=p[i].second,b=p[i].first;
        int s1=sum(a),s2=sum(b);
        if(s2-s1==0){
            add(b,1);
            res++;
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 1536
#include<stdio.h>
int main(void)
{
  int A,B,i,total;
  total=0;
  scanf("%d",&A);
  scanf("%d",&B);
  for(i=0;total<B;i++)
  {
    total=A*i-(i-1);
  }
  printf("%d\n",i-1);
  return 0;
}
  
  

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

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


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

	return 0;
}



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

int main() {
  string s;
  cin >> s;
  string a = s;
  reverse(s.begin(),s.end());
  int ans = 0;
  for(int i=0; i<s.size(); i++) if(s[i] != a[i]) ans++;
  cout << ans/2 << endl;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    bool f = true;
    rep (i, N) {
        ll A;
        cin >> A;

        if (A%2 == 0) {
            if (A%3 == 0 || A%5 == 0) {
                ;
            } else {
                f = false;
            }
        }
    }

    if (f) {
        cout << "APPROVED" << endl;
    } else {
        cout << "DENIED" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

typedef struct{
  char name[11];
  int time;
}process;

int main(){
  long long  n, q, i, j, sp, ep, stime = 0;
  process p[520000];
  scanf("%lld%lld", &n, &q);
  for(i = 0; i < n; ++i) scanf("%s%d", p[i].name, &p[i].time);

  sp = 0; ep = n - 1;
  while(sp <= ep){
    if(p[sp].time > q){
      stime += q;
      p[sp].time -= q;
      p[++ep] = p[sp];
    }
    else{
      stime += p[sp].time;
      printf("%s %lld\n", p[sp].name, stime);
    }
    sp++;
  }
  return 0;
}


Measured memory_bytes: 4672
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
vi a,b;
bool check(vi use){
    vvi g(51,vi(51,inf));
    rep(i,51)g[i][i]=0;
    rep(i,51)for(ll x:use)g[i][i%x]=0;
    rep(k,51)rep(i,51)rep(j,51)chmin(g[i][j],g[i][k]+g[k][j]);
    rep(i,a.size())if(g[a[i]][b[i]]!=0)return false;
    return true;
}
int main(){
    ll n;cin>>n;
    a=vi(n),b=vi(n);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    vi use;
    vi v;
    rep(i,50)v.pb(i+1);
    if(!check(v))dame(-1);
    ll ans=0;
    for(int i=50;i;i--){
        vi t=use;
        REP(j,1,i)t.pb(j);
        if(!check(t)){
            use.pb(i);
            ans+=1ll<<i;
        }
    }
    out(ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  
  int n,k;
  cin >> n >> k;
  vector<int>p(n);
  rep(i,n) cin >> p[i];
  sort(p.begin(),p.end());
  int sum = 0;
  rep(i,k) sum += p[i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3620
while line = gets
  value = line.chomp
  list = value.split
  if list.length != 3
    next
  end

  res_list = []
  res_list << list[0].to_i
  res_list << list[1].to_i
  res_list << list[2].to_i
  rlist = res_list.sort
  rlist[0] *= rlist[0]
  rlist[1] *= rlist[1]
  rlist[2] *= rlist[2]
  if ((rlist[0] + rlist[1]) == rlist[2])
    puts "YES"
  else
    puts "NO"
  end
end



Measured memory_bytes: 6848
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
using vs = vector<string>;
template <typename T>
using ost = tree<T, null_type, less<T>, rb_tree_tag,
    tree_order_statistics_node_update>;
#define forn(i,n) for(int i=0; i<int(n); ++i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ff first
#define ss second

void no() {
    cout << "Impossible\n";
    exit(0);
}

int main() {
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    vs grid(H);
    for (string& row:grid) cin >> row;
    int i=0, j=0;
    for (; i+1<H || j+1<W;) {
        if (grid[i][j]!='#') no();
        bool down=(i+1<H && grid[i+1][j]=='#');
        bool right=(j+1<W && grid[i][j+1]=='#');
        if (down==right) no();
        grid[i][j]='.';
        i+=down;
        j+=right;
    }
    grid[i][j]='.';
    for (string& row:grid) for (char c:row)
        if (c!='.') no();
    cout << "Possible\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(long long int i=0;i<n;i++)
#define lli long long int
#define ll long long 
#define dd double
#define endl "\n"
#define mod 1000000007
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define limit 1000000000000000000
const double pi=3.14159265358;
const double pie=2*acos(0.0);
	
using namespace std;
lli power(lli a,lli b)
{
	lli res=1;
	while(b>0)
	{
		if(b%2!=0)
		{
			b--;
			res=(res%mod*a%mod)%mod;
		}
		else
		{
			a=(a%mod*a%mod)%mod;
			b/=2;
		}
	}
	return res%mod;
}
bool sortinrev(const pair<lli,lli> &a,  
               const pair<lli,lli> &b) 
{ 
       return (a.first > b.first); 
}

int main() {
	fast
	lli t;
	cin>>t;
	lli sum=t+t*t+t*t*t;
	cout<<sum<<endl;
	
	
		
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define ll long long
#define lld double
#define vi vector<int>
#define pii pair<int,int>
#define piii pair<pii, ll>
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define ppb pop_back
#define d0(x) cout<<x<<" "
#define d1(x) cout<<(x)<<"\n"
#define d2(x,y) cout<<x<<" "<<y<<"\n"
#define d3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<endl
#define d5(x,y,z,w,s) cout<<x<<" "<<y<<" "<<z<<" "<<w<<" "<<s<<endl
using namespace std;
const ll mod = 998244353;

void solve(int t)
{
    double L;
    cin>>L;
    //d1(L);
    L/=3.0;
    //d1(L);
    double ans = L*L*L;
    cout<<fixed<<setprecision(12)<<ans<<"\n";
}


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int T=1;
    //cin>>T;
    for(int t=1;t<=T;t++)
        solve(t);
}


Measured memory_bytes: 256
// AOJ 2578 Disciple Life is Hard
// 2018.3.16 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// library //
//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

// library //

int e[102], c[102], h[102], a[102];
int p[102];
int dp1[102][102*102], dp2[102][102][102], dp3[102][102];
int ee[102];
int cmp(int *a, int *b) { return *a - *b; }

int main()
{
	int S, T, U, N, O, D, i, j, s, x;

	S = in(), T = in(), U = in(), N = in(), O = in(), D = in();
	for (i = 0; i < T; i++) ee[i] = e[i] = in(), c[i] = in();
	for (i = 0; i < N; i++) h[i] = in(), a[i] = in();

	qsort(ee, T, sizeof(int), cmp);
	s = 0; for (i = 0; i < U; i++) s += ee[i];
	if (s > S || S-(D-1)*(s-O) < s) { puts("-1"); return 0; }

	memset(dp1, -1, sizeof(dp1)), dp1[0][0] = 0;
	for (i = 1; i <= N; i++) for (j = 0; j <= 1000; j++) for (s = 0; s*a[i-1] <= j; s++) {
		if (dp1[i-1][j-s*a[i-1]] >= 0) {
			x = dp1[i-1][j-s*a[i-1]]+h[i-1]*s;
			if (dp1[i][j] < x) dp1[i][j] = x;
		}
	}

	memset(dp2, -1, sizeof(dp2)); dp2[0][0][0] = 0;
	for (i = 1; i <= T; i++) {
		dp2[i][0][0] = 0;
		for (j = 1; j <= i; j++) for (s = 0; s <= S; s++) {
			dp2[i][j][s] = dp2[i-1][j][s];
			if (s-e[i-1] >= 0 && dp2[i-1][j-1][s-e[i-1]] >= 0) {
				x = dp2[i-1][j-1][s-e[i-1]]+c[i-1];
				if (dp2[i][j][s] < x) dp2[i][j][s] = x;
			}
		}
	}

	memset(p, -1, sizeof(p));
    for (s = 0; s <= S; s++) for (i = 0; i <= dp2[T][U][s]; i++) if (p[s] < dp1[N][i]) p[s] = dp1[N][i];

	memset(dp3, -1, sizeof(dp3)), memset(dp3[0], 0, sizeof(dp3[0]));
	for (i = 1; i <= D; i++) for (s = 0; s <= S; s++) for (j = 0; j <= s; j++) {
		x = s-j+O; if (x > S) x = S;
		if (dp3[i-1][x] >= 0 && p[j] >= 0) {
			int t = dp3[i-1][x] + p[j];
			if (dp3[i][s] < t) dp3[i][s] = t;
		}
	}
	printf("%d\n", dp3[D][S]);
}


Measured memory_bytes: 10088
f = False
a = input().split(' ')
for i in range(3):
  a[i]=int(a[i])
while True:
  for i in range(3):
    if a[i] != 5 and a[i] != 7:
      print('NO')
      f = True
      break
  if f == True:
    print(2)
    break
  if a[0] + a[1] + a[2] == 17:
    print('YES')
    break
  else:
    print('NO')
    break



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

class Cube {
public:
  int f[6];
  Cube(void){}
  void roll_z(void) {
    roll(1,2,4,3);
  } 
  void roll_y(void) {
    roll(0,2,5,3);
  } 
  void roll_x(void) {
    roll(0,1,5,4);
  }
  void roll(int i,int j,int k,int l) {
    int t = f[i];
    f[i] = f[j];
    f[j] = f[k];
    f[k] = f[l];
    f[l] = t;
  }
};

bool eq(Cube c1,Cube c2) {
  for (int i=0; i<6; i++) {
    if (c1.f[i]!=c2.f[i]) {
      return false;
    }
  }
  return true;
}

bool equal(Cube c1,Cube c2) {
  for (int i=0; i<6; i++) {
    for (int j=0; j<4; j++) {
      if (eq(c1,c2)) {
        return true;
      }
      c1.roll_z();
    }
    if (i%2==0) {
      c1.roll_y();
    } else {
      c1.roll_x();
    }
  }
  return false;
}

int main(void) {
  Cube c1, c2;
  for (int i=0; i<6; i++) {
    cin >> c1.f[i];
  }
  for (int i=0; i<6; i++) {
    cin >> c2.f[i];
  }
  if (equal(c1,c2)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3068
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
 
#define INF (INT_MAX/2)
 
typedef struct{
  int v; 
  int c;
} edge;
 
typedef struct{
  int k; 
  edge* e; 
} vertex; 
 
int* ssspForCost(vertex* g, int n) {
  int i;
  int *dist, color[n];
  int minCost, u;
  dist = (int*)malloc(sizeof( int ) * n);
  for( i=0; i<n; i++ ){ 
    dist[i] = INF;
    color[i] = 0;
  } 
  dist[0] = 0; 
  while(1){ 
    minCost = INF;
    for(i=0; i<n; i++){
      if(color[i] != 1 && dist[i] < minCost){
    minCost = dist[i];
    u = i;
      }
    }
    if(minCost == INF){
      break;
    }
    color[u] = 1; 
    for(i=0; i<g[u].k; i++) {
      if(color[ g[u].e[i].v ] != 1 && dist[u] + g[u].e[i].c < dist[ g[u].e[i].v ]) {
    dist[g[u].e[i].v] = dist[u] + g[u].e[i].c;
      }
    }
  }
  return dist; 
}
 
 
void printDist(int* dist, int n){
  int i;
  for( i=0; i<n; i++ ) {
    printf("%d %d\n", i, dist[i]);
  }
  return;
}
int main() {
  int i, j;
  int n, u; 
  vertex* g; 
  int* dist;
  scanf("%d", &n);
  g = (vertex*)malloc(sizeof( vertex ) * n);
  for( i=0; i<n; i++ ){
    scanf("%d", &u);
    scanf("%d", &g[u].k);
    g[u].e = (edge*)malloc(sizeof( edge ) * g[u].k);
    for(j=0; j<g[u].k; j++){
      scanf("%d%d", &g[u].e[j].v, &g[u].e[j].c);
    }
  }
  dist = ssspForCost(g, n); 
  printDist(dist, n);
  return 0;
}

Measured memory_bytes: 4528
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision


#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

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

int main(int argc, char* argv[]) {
	int k,n;
	cin >> k >> n;
  
	vector<int> a(n);
	rep(i,n) cin >> a[i];

	sort(all(a));

	vector<int> b(n);
	rep(i,n-1) b[i] = a[i+1] - a[i];
	b[n-1] = k - a[n-1] + a[0];

	int sum = 0, mx = 0; 
	rep(i, n) {
		chmax(mx, b[i]);
		sum += b[i];
	}

	cout << sum - mx << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>

#define rep(i,n) for(int i = 0; i < n; ++i)
#define reps(i,f,n) for(int i = f; i < n; ++i)
#define pb push_back
using namespace std;

template<typename T>
class ShortestPath{
  public:
    class Edge{
      public:
        T val;
        int to;
        Edge(T v, int t):val(v), to(t){}
    };

    int n;
    vector< vector<Edge> > g;
    vector<T> d;
    vector<T> p;
    vector<int> used;
    T INF;
    using PTI=pair<T,int>;


    ShortestPath(int _n, const T inf):n(_n),g(n),d(n),p(n), INF(inf){
    }

    void dijkstra(int s){
      priority_queue<PTI, vector<PTI>, greater<PTI> > pq;
      used.resize(n, 0);
      rep(i,n){
        d[i] = INF;
        p[i] = -1;
      }
      d[s] = 0;
      pq.push(PTI(0, s));
      while(!pq.empty()){
        T val = pq.top().first;
        int current = pq.top().second;
        pq.pop();
        if(used[current])continue;
        used[current] = 1;
        rep(i, g[current].size()){
          Edge e = g[current][i];
          if( d[e.to] > d[current] + e.val){
            d[e.to] = d[current] + e.val;
            p[e.to] = current;
            pq.push(PTI(d[e.to], e.to));
          }
        }
      }
    }


    bool bellman_ford(int s){
      rep(i,n){
        d[i] = INF;
        p[i] = -1;
      }
      d[s] = 0;

      reps(i,1,n-1){
        rep(j, g.size()){
          if(d[j] == INF)continue;
          rep(k, g[j].size()){
            int u = j;
            int v = g[j][k].to;
            T c = g[j][k].val;
            if( d[v] > d[u] + c){
              d[v] = d[u] + c;
              p[v] = u;
            }
          }
        }
      }
      rep(i, g.size()){
        if(d[i] == INF)continue;
        rep(j, g[i].size()){
          int u = i;
          int v = g[i][j].to;
          T c = g[i][j].val;
          if( d[v] > d[u] + c){
            return false;
          }
        }
      }
      return true;
    }
};

int main(void){
  int v, e, r;
  int s,t,d;
  cin >> v >> e >> r;
  const int inf = 1000000000;
  ShortestPath<int> sp(v, inf);
  rep(i,e){
    cin >> s >> t >> d;
    sp.g[s].pb(ShortestPath<int>::Edge(d, t));
  }
  sp.dijkstra(r);
//   bool res = sp.bellman_ford(r);
  rep(i,v){
    if(sp.d[i] == inf){
      cout << "INF" << endl;
    }else{
      cout << sp.d[i] << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 13808
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,tmp,count=0;
    cin >> n;
    priority_queue<int> que;
    for(int i=0;i<n;i++){
        cin >> tmp;
        que.push(tmp);
    }
    while(que.size()){
        count+=que.top();
        que.pop();
        if(!que.size())break;
        count-=que.top();
        que.pop();
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    
    string str1, str2;
    cin >> str1 >> str2;
    
    str1 += str1;
    for(int i = 0; i < str1.length()/2;i++){
        if(str1.substr(i,str2.length()) == str2){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

void fst()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}
int nxt()
{
    int x;
    cin >> x;
    return x;
}
int nex_l()
{
    long long x;
    cin >> x;
    return x;
}

typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define binary(n) cout << bitset<31>(n) << "\n";
#define FOR(i, n) for (int i = 0; i < n; i++)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define input_arr(a, n)         \
    for (int i = 0; i < n; i++) \
        cin >> a[i];
#define print_arr(a, n)         \
    for (int i = 0; i < n; i++) \
        cout << a[i] << " ";
#define deb(n) cerr << #n << "=" << n << "\n";

int main()
{
    string s;
    cin >> s;
    if (s <= "Z")
    {
        cout << "A";
    }
    else
        cout << "a";
}


Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();

		long l[]=new long[n+1];
		l[0]=2;
		l[1]=1;
		for(int i=2;i<=n;i++) {
			l[i]=l[i-1]+l[i-2];
		}
		System.out.println(l[n]);
		//System.out.println(func(n));
	}

	/*
	static long func(int n) {
		if(n==0)return 2;
		if(n==1)return 1;
		return func(n-1)+func(n-2);
	}*/
}

Measured memory_bytes: 23508
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

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

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        char[] data = S.toCharArray();
        int len = data.length;
        if (!is_kaibun(data, 1, len)) {
            System.out.println("No");
            return;
        }
        if (!is_kaibun(data, 1, (len-1)/2)) {
            System.out.println("No");
            return;
        }
        if (!is_kaibun(data, (len+3)/2, len)) {
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }

    private boolean is_kaibun(char[] data, int start, int end) {
        int len = end - start;
        for (int i = 0; i < len; i++) {
            if (data[start+i-1] != data[end-i-1]) {
                return false;
            }
        }
        return true;
    }
}


Measured memory_bytes: 22100
#define _USE_MATH_DEFINES //M_PI, M_E
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
ll power(ll a,ll b){ll r=1;for(;b;b>>=1){if(b&1)r=r*a%mod;a=a*a%mod;}return r;}
using namespace std;
int n,m,res = 0;
vector<ar<int,4>> v;
void dfs(int index,int number, int *a)
{
	if(index==n)
	{
		int r = 0;
		for(auto it:v)
			if(a[it[1]]-a[it[0]]==it[2])
				r += it[3];
		res = max(res,r);
		return;
	}
	for(int i = number; i<=m; i++)
	{
		a[index] = i;
		dfs(index+1,i,a);
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int q;
	cin>>n>>m>>q;
	ar<int,4> r;
	for(int i = 0; i<q; i++)
	{
		cin>>r[0]>>r[1]>>r[2]>>r[3],--r[0],--r[1];
		v.pb(r);
	}
	int a[n];
	dfs(0,1,a);
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
#include <random>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

//********************************template END****************************************//

void solve(void){

	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;

	int water = 100*A, sugar = 0;

	rep(31, a) rep(31, b)
	{
		int w = (A*a*100 + B*b*100);
		int res = F - w;
		if (res <= 0)
		{
			continue;
		}

		rep(res/C+1, c) rep(res/D+1, d)
		{
			int s = C*c+D*d;
			//cout << (A*a+B*b)*E << ' ' << s << endl;
			if ((A*a+B*b)*E < s || w+s > F)
			{
				continue;
			}

			if (s*(water+sugar) > (w+s)*sugar)
			{
				water = w;
				sugar = s;
			}
		}
	}

	cout << water+sugar << ' ' << sugar << endl;


}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define exp wadu_hek
long double exp[310][310][310];
int32_t main() {
    ios::sync_with_stdio(false);cin.tie(0);
    int n,x,a=0,b=0,c=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        if(x==3) a++;
        if(x==2) b++;
        if(x==1) c++;
    }
    for(int i=0;i<=n;i++)
    {
        for(int j=0;i+j<=n;j++)
        {
            for(int k=0;i+j+k<=n;k++)
            {
                if(i+j+k==0) continue;
                if(i)
                    exp[i][j][k]+=i*exp[i-1][j+1][k];
                if(j)
                    exp[i][j][k]+=j*exp[i][j-1][k+1];
                if(k)
                    exp[i][j][k]+=k*exp[i][j][k-1];
                exp[i][j][k] += n;
                exp[i][j][k]/=(i+j+k+0.);
            }
        }
    }
    cout<<fixed<<setprecision(14)<<exp[a][b][c];
    return 0;
}

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

const int INF = 1e9;

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N;
    cin >> N;
    map<string, int> m;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        m[s]++;
    }
    int max_cnt = 0;
    for (auto& p : m) {
        max_cnt = max(max_cnt, p.second);
    }
    for (auto& p: m) {
        if (p.second == max_cnt) cout << p.first << endl;
    }
    return 0;
}





Measured memory_bytes: 23808
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leadinz zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll bin_pow(ll a,ll b,ll m)
{
    ll res=1;
    a%=m;
    while(b>0){
        if(b&1)res=res*a%m;
        b>>=1;
        a=a*a%m;
    }
    return res;
}
bool miller_rabin(ll d,ll n)
{
    ll a=2+rand()%(n-4);
    ll x=bin_pow(a,d,n);
    if(x==1 || x==n-1)return true;
    while(d!=n-1){
        x=(x*x)%n;
        d*=2;
        if(x==1)return false;
        if(x==n-1)return true;
    }
    return false;
}
bool prime(ll n,ll k)
{
    if(n==1 || n==4)return false;
    if(n<=3)return true;
    ll d=n-1;
    while(d%2==0)d/=2;
    for(int i=0;i<k;i++){
        if(!miller_rabin(d,n))return false;
    }
    return true;
}
int len(ll x){
    string s=to_string(x);
    return s.size();
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vector<pair<ll,ll> >v;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            v.push_back({i,n/i});
        }
    }
    sort(v.begin(),v.end());
    pair<ll,ll>p=v.back();
    ll x=p.first;
    ll y=p.second;
    cout<<max(len(x),len(y))<<endl;
}


Measured memory_bytes: 256
a,b = map(int,input().split(" "))
count = 0
for i in range(a+1):
    for j in range(a+1):
        if i * 10000 + j * 5000 + (a - (i + j)) * 1000 == b and (a - (i + j)) >= 0:
            print(i,j,(a-(i+j)))
            count = 1
    if count == 1:
        break
if count == 0:
    print(-1,-1,-1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

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

signed main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    int MAX = 0;
    bool f = false;
    int g = a[0];
    rep(i, 0, n){
        cin >> a[i];
        if(a[i] == k) f = true;
        g = gcd(g, a[i]);
        MAX = max(MAX, a[i]);
    }
    if(k % g == 0 && MAX >= k) f = true;
    cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

Measured memory_bytes: 1024
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
ans = 0
for i in range(n):
    l,r = iim()
    ans += r-l+1
print(ans)

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

int main() {
  string S,T;
  cin >> S >> T;
  int N = S.size();
  bool flag = true;
  for(int i = 0 ; i < N ; i++){
  	if(S.at(i)!=T.at(i)){
    	flag = false;
    }
  }
  if(flag){
  	cout << "Yes" << endl;
  }
  else{
  	cout << "No" << endl;
  }
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
  using namespace std;
  #define FASTIO std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);


  int main () {
    FASTIO
    long long int k, x, y, c;
    cin >> k;
    queue<long long int>s, t;
    for (int i = 1; i <= 9; i++) {
      s.push(i);
    }
    while((int)s.size() + (int)t.size() <= k + 10) {
      y = s.front();
      s.pop();
      x = y % 10;
      c = x - 1;
      if (c != -1) {
        s.push(y * 10 + c);
      }
      s.push(y * 10 + x);
      c = x + 1;
      if (c != 10) {
        s.push(y * 10 + c);
      }
      t.push(y);
    }
    vector<long long int>v;
    while(!t.empty()) {
      v.push_back(t.front());
      t.pop();
    }
    while(!s.empty()) {
      v.push_back(s.front());
      s.pop();
    }
    sort(v.begin(), v.end());
    cout << v[k - 1] << endl;
  }


Measured memory_bytes: 2300
#include<stdio.h>

void count(char s[], int n){
    int cnt = 0;
    for(int i = 0; i < n - 2; i++){
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C'){
            cnt ++;
            i += 2;
        }
    }
    printf("%d\n", cnt);
}

int main(void){
    int n;
    scanf("%d", &n);
    char s[n + 1];
    scanf("%s", s);
    count(s, n);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int i,m,r,f,s;
	while(1)
	{
		scanf("%d%d%d",&m,&f,&r);
		if(m==-1 && f == -1 && r == -1)
		{
			break;
		}
		if(m==-1 || f == -1)
		{
			printf("F\n");
			continue;
		}
		if(m + f >= 80)
		{
			printf("A\n");
			continue;
		}
		if(m + f >= 65)
		{
			printf("B\n");
			continue;
		}
		if(m + f >=50)
		{
			printf("C\n");
			continue;
		}
		if(m + f >= 30)
		{
			if(r >= 50)
			{
				printf("C\n");
				continue;
			}
			printf("D\n");
			continue;
		}
		if(m + f < 30)
		{
			printf("F\n");
			continue;
		}
	}
	return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include<cstdio>
using namespace std;
long long a,b,c,d,n,m,i,j,l,r,lh,lb,rh,rb;
int main(){
	cin>>n>>a>>b>>c>>d;
	l=0;r=n;
	if(a>b){
		swap(a,b);
	}
	if(c>d){
		swap(c,d);
	}
	while(l<=r){
		m=(l+r)/2;//left 
		lh=a+d*m;
		lb=a+c*m;
		rh=b+d*(n-m-1);
		rb=b+c*(n-m-1);
		if(max(lb,rb)<=min(lh,rh)){
		//	cout<<m<<endl;
			cout<<"YES"<<endl;
			return 0;
		}else{
			if(lh<rb){
				l=m+1;
			}else{
				r=m-1;
			}
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;



 class Program
 {
     static void Main(string[] args)
     {
         double area,perimeter;
         String nyuryoku;
         nyuryoku = Console.ReadLine();
         string[] data = nyuryoku.Split(' ');
         area = Double.Parse(data[0]) * Double.Parse(data[1]);
         perimeter = 2 * (Double.Parse(data[0]) + Double.Parse(data[1]));
         Console.WriteLine("{0} {1}",area,perimeter);
     }
 }


Measured memory_bytes: 15920
import sys
import math
import bisect

# import copy
# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

# ===CODE===

a, b, n = map(float, input().split())

left = 1
right = n

ans = 0
num = 0
while abs(left - right) > 10 ** (-2):
    tmp_left = left + (right - left) / 3
    tmp_right = left + 2 * (right - left) / 3

    c_left = math.floor(a * left / b) - a * math.floor(left / b)
    c_right = math.floor(a * right / b) - a * math.floor(right / b)

    f_left = math.floor(a * tmp_left / b) - a * math.floor(tmp_left / b)
    f_right = math.floor(a * tmp_right / b) - a * math.floor(tmp_right / b)

    if c_left <= f_left <= f_right:
        left = tmp_left
        if ans < f_left:
            ans = f_left
            num = tmp_left

    else:
        right = tmp_right
        if ans < f_right:
            ans = f_right
            num = tmp_right


ans1 = math.floor(a * int(num) / b) - a * math.floor(int(num) / b)
ans2 = math.floor(a * int(num + 1) / b) - a * math.floor(int(num + 1) / b)

print(int(max(ans1, ans2)))


Measured memory_bytes: 62896
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<iostream>
#define ll long long
#define re register
using namespace std;
inline int gi(){
    int f=1,sum=0;char ch=getchar();
    while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9'){sum=(sum*10)+ch-'0';ch=getchar();}
    return f*sum;
}
int a,b;
int main(){
	a=gi();b=gi();
	if(a<6)b=0;
	else if(a<13)b>>=1;
	printf("%d\n",b); 
	return 0;
}

Measured memory_bytes: 256
s = input()
t = input()
S = sorted(s)
T = sorted(t,reverse=True)
#print(S,T)
ans = "W"
for i in range(min(len(s),len(t))):
    if S[i] > T[i]:
        ans = "No"
        break
    elif ans == "W" and S[i] == T[i]:
        ans = "W"
    elif ans == "W" and S[i] < T[i]:
        ans = "Yes"
        break
if ans == "W":
    if len(s) < len(t):
        ans = "Yes"
    else:
        ans = "No"
print(ans)

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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[], int n) {
	for (int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;
}



int check(int n) {

	int s=0;
	while(n){
		s++;
		n/=10;
	}
	return s;
}



int main() {
	int i, n, m, k, c = 0;
	c_p_c();
	cin>>n;
	for (int i = 1; i <=n; ++i)
	{
		/* code */
		if(check(i)%2)
			c++;
	}

	cout<<c<<endl;
	return 0;
}



Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define r(i,n) for(int i=;i<n;i++)
#define f first
#define s second
#define mk make_pair
using namespace std;
typedef pair<int,int>P;
int ans,a,b,n;
int main(){
  int n;
  cin>>n;
  set<int>se;
  while(n--){
    cin>>a;
    if(se.count(a))se.erase(a);
    else se.insert(a);
  }
  cout<<se.size()<<endl;
}

Measured memory_bytes: 4864