akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c>21){
        cout << "bust" << endl;
    }else
    {
        cout << "win" << endl;
    }
    
    return 0;
}

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

struct edge {
	int from, to, cost;
	edge(){}
	edge(int from_, int to_, int cost_) {
		from = from_;
		to = to_;
		cost = cost_;
	}
};
 
int main() {
    int n, m;
 
    cin >> n >> m;
    
	vector< edge > es;
	vector< int > d(n, -INT_MAX / 4);

    for(int i = 0; i < m; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		es.push_back(edge(a, b, c));
    }

	d[0] = 0;
	while(true) {
		bool update = false;
		for(int i = 0; i < m; i++) {
			edge e = es[i];
			if(d[e.from] != -INT_MAX / 4 && d[e.to] < d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}
		if(!update) {
			break;
		}
	}

	cout << d[n - 1] << endl;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

class dice {
    private:
    vector<int> face;
    int back = 6;
    unordered_map<string, int> change;

    vector<vector<int>> apper = {
        {-1, 5, -1},
        {4, 1, 3},
        {-1, 2, -1},
    };

    public:
    vector<vector<int>> result;
    void input() {
        face.push_back(0);
        for (int i = 0; i < 6; i++) {
            int temp;
            cin >> temp;
            face.push_back(temp);
            change[to_string(temp)] = i + 1;
        }

        for (int i = 0; i <= 64; i++) {
            rotation('S');
            for (int j = 0; j <= 3 + (i / 4); j++) {
                rotation('W');
                result.push_back({face[apper[0][1]], face[apper[1][0]], face[apper[1][1]], face[apper[1][2]], face[apper[2][1]], face[back]});
                // cerr << apper[0][1] << " " << apper[1][1] << " " << apper[1][2] << endl;
            }
        }

        sort(result.begin(), result.end());
        result.erase(unique(result.begin(), result.end()), result.end());
    }

    void rotation(char S) {
        if (S == 'S') {
            int temp = apper[2][1];
            apper[2][1] = apper[1][1];
            apper[1][1] = apper[0][1];
            apper[0][1] = back;
            back = temp;
        } else if (S == 'W') {
            int temp = apper[1][0];
            apper[1][0] = apper[1][1];
            apper[1][1] = apper[1][2];
            apper[1][2] = back;
            back = temp;
        } else if (S == 'N') {
            int temp = apper[0][1];
            apper[0][1] = apper[1][1];
            apper[1][1] = apper[2][1];
            apper[2][1] = back;
            back = temp;
        } else {
            int temp = apper[1][2];
            apper[1][2] = apper[1][1];
            apper[1][1] = apper[1][0];
            apper[1][0] = back;
            back = temp;
        }
        // cout << back << endl;
    }
};


signed main() {
    int n;
    cin >> n;
    vector<dice> diff(n);
    for (int i = 0; i < n; i++) {
        diff[i].input();
    }
    bool ans = true;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (diff[i].result == diff[j].result) ans = false;
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
}



Measured memory_bytes: 5536
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec[i];
  }
  
  int64_t ans = 0;
  for(int i=1; i<N; i++){
    if(vec[i] < vec[i-1]){
      ans += vec[i-1] - vec[i];
      vec[i] = vec[i-1];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4024
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
    
    int K;
    cin >> K;
    string S;
    cin >> S;
    if (K >= S.size()) {
        cout << S << endl;
    }else{
        string str = S.substr(0, K);
        str += "...";
        cout << str << endl;
    }
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(){
  int n;
  
  scanf( "%d", &n );
  
  if( n <= 111 ) 				printf("111");
  else if(n > 111 && n <= 222 )	printf("222");
  else if(n > 222 && n <= 333 )	printf("333");
  else if(n > 333 && n <= 444 )	printf("444");
  else if(n > 444 && n <= 555 )	printf("555");
  else if(n > 555 && n <= 666 )	printf("666");
  else if(n > 666 && n <= 777 )	printf("777");
  else if(n > 777 && n <= 888 )	printf("888");
  else							printf("999");
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>

using namespace std;

const int INF = 1e9 + 1;

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

  // lets start from 0, to n-1
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  
  vector<int> res(n, INF);
  res[0] = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      if (i - j < 0) break;

      res[i] = min(res[i], res[i - j] + abs(h[i] - h[i - j]));
    }
  }
  
  cout << res[n - 1] << endl;

  return 0;
}


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

int main()
{

	ll n,k;
	cin >> n >> k;
	std::vector<ll> v(n+1,0);
	ll dp1[k+2][k+2],dp2[n+1];
	for(int i=1;i<=n;i++){
		cin >> v[i];
	}
	for(int i=2;i<=k+1;i++){
		for(int j=1;j<i;j++){
			dp1[i][j] = abs(v[i]-v[j]);
		}
		ll ans = dp1[i][1];
		for(int j=2;j<i;j++){
			ans = min(ans,dp1[i][j] + dp2[j]);
		}
		dp2[i]=ans;
	}
	for(int i=k+2;i<=n;i++){
		ll mn= dp2[i-k] + abs(v[i-k]-v[i]);
		for(int j=i-k;j<i;j++){
			mn = min(mn,dp2[j] + abs(v[j]-v[i]));
		}
		dp2[i]=mn;
	}
	cout << dp2[n]<< endl;
}

Measured memory_bytes: 1920
#include <iostream>

using namespace std;

bool p[100010];

void prime(){
    fill(p, p+100010, true);
    p[0] = p[1] = false;
    for(int i=0; i < 100010; i++){
        if(!p[i]) continue;
        for(int j=i+i; j <= 100010; j += i) p[j] = false;
    }
}

int main(){
    prime();
    int n;
    while(cin >> n, n){
        int ans = 0;
        for(int i=0; i <= n; i++){
            if(p[i]){
                int sum = 0;
                for(int j=i; ; j++){
                    if(p[j]){
                        sum += j;
                        if(sum == n){ans++; break;}
                        else if(n < sum) break;
                    }
                }
            }
        }
        cout << (ans==100000?0:ans) << endl;
    }
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll a, b, c;
  cin >> a >> b >> c;
  if(a<=c and c<=b)cout << "Yes";
  else cout << "No";
  return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<map>
#include<string>
#include<set>
#include<vector>
using namespace std;

int solve(){
  int n, k; cin >> n >> k;
  vector<long long> h(n);
  for(int i=0; i<n; i++){
    cin >> h[i];
  }
  sort(h.begin(), h.end());
  long long ans=0;
  for(int i=0; i<n-k; i++){
    ans += h[i];
  }
  cout << ans << endl;
}

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


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

int main()
{
string s;
cin>>s;
if (s.length()>=4 && s[0]=='Y' && s[1]=='A' && s[2]=='K' && s[3]=='I')
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}
return 0;
}


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

using namespace std;

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

    int total = 0;
    for(int i=1; i<=N; i++){
        total += L + (i-1);
    }

    int maxSum =0 ,diffMin = 999999;
    for(int i=1; i<=N; i++){
        int tmp=0;
        for(int j=1; j<=N; j++){
            if(i != j){
                tmp += L + (j-1);
            }
        }
        int diff = abs(total-tmp);
        if(diffMin > diff){
           diffMin = diff;
            maxSum = tmp;
        }
    }
    cout << maxSum << endl;
}

Measured memory_bytes: 256
x1, x2, x3, x4, x5 = map(int,input().split())
i = 10
if x1==0:
  i=1
elif x2==0:
  i=2
elif x3==0:
  i=3
elif x4==0:
  i=4
elif x5==0:
  i=5
else:
  i=i

print(i)

Measured memory_bytes: 9112
n = int(input())
p = map(int, input().split())

cnt = 0
index = 0
nl = list(range(1, n + 1))
for pi in p:
  if nl[index] != pi:
    cnt += 1 
  index += 1

print("YES" if cnt == 2 or cnt == 0 else "NO")

Measured memory_bytes: 3060
#include <iostream>
#define int long long

using namespace std;

signed main() {
	int x;
	cin >> x;
	
	int p = 100, cnt = 0;
	while (p < x) {
		p += p / 100;
		cnt++;
	}
	
	cout << cnt << '\n';
	
	return 0;
}

Measured memory_bytes: 3608
package main

import (
	"fmt"
)

func main() {

	var s int
	fmt.Scanf("%d", &s)
	n1 := s / 100
	n2 := s % 100

	if isMM(n1) && isMM(n2) {
		fmt.Println("AMBIGUOUS")
	} else if !isMM(n1) && isMM(n2) {
		fmt.Println("YYMM")
	} else if isMM(n1) && !isMM(n2) {
		fmt.Println("MMYY")
	} else {
		fmt.Println("NA")
	}

}

func isMM(n int) bool {
	if 0 < n && n < 13 {
		return true
	}
	return false
}


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

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define odd(x) ((x) % (2))
#define fastio ios_base::sync_with_stdio(false), cin.tie(0);
#define fileio freopen("template.in", "r", stdin), freopen("template.out", "w", stdout);
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const ll MOD = 1e9 + 7;

int main() {
    fastio;
    //fileio;
        
    int d, t, s;
    cin >> d >> t >> s;
    if (t * s >= d) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    if(a >= 13) cout << b << endl;
    else if (6 <= a) cout << b / 2 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
K = int(input())
if(K%2 ==0 or K%5 == 0):
    print("-1")
    exit()
sum = 0
a = 7%K
sum += a
if(a == 0):
    print("1")
    exit()
for i in range(2, 10**8):
    sum += (a*10)%K
    sum = sum%K
    a = (a*10)%K
    if(sum == 0):
        print(i)
        exit()

Measured memory_bytes: 9200
#include <cstdio>
#include <cmath>

#define EPS (1e-10)
#define equals( A, B ) (fabs((A) - (B)) < EPS)

class Point {
public:
    double x, y;
    Point( double x = 0, double y = 0 ): x(x), y(y) {}
    
    Point operator + ( Point p ) { return Point( x + p.x, y + p.y ); }
    Point operator - ( Point p ) { return Point( x - p.x, y - p.y ); }
    Point operator * ( double a ) { return Point( a * x, a * y ); }
    Point operator / ( double a ) { return Point( x / a, y / a ); }

    double abs() { return sqrt( norm() ); }
    double norm() { return x * x + y * y; }

    bool operator < ( const Point &p ) const {
	return ( x != p.x ) ? x < p.x : y < p.y;
    }

    bool operator == ( const Point &p ) const {
	return equals( x, p.x ) && equals( y, p.y ); 
    }

    double dot( Point a ) { return x * a.x + y * a.y; }
    double cross( Point a ) { return x * a.y - y * a.x; }
};

typedef Point Vector;

class Line {
public:
    Point p1, p2;
    Line( Point p1 = Point(), Point p2 = Point() ) {}
    // ?????´????????????( cos = 0 )
    bool isOrthogonal( Line a ) {
	return equals( 0.0, (p1 - p2).dot( a.p1 - a.p2 ) );
    }
    // ??????????????????( sin = 0 )
    bool isParallel( Line a ) {
	return equals( 0.0, (p1 - p2).cross( a.p1 - a.p2 ) );
    }
};

typedef Line Segment;

int main()
{
    Point p1, p2, p;
    int q;

    scanf( "%lf %lf %lf %lf", &p1.x, &p1.y, &p2.x, &p2.y );

    if ( p1 == p2 ) return 1;

    Vector v12 = p2 - p1;    
    double abs_v12 = v12.abs();

    scanf( "%d", &q );
    
    for ( int i = 0; i < q; i++ ) {
	scanf( "%lf %lf", &p.x, &p.y );
	
	Vector v10 = p - p1;
	
	Point proj = p1 + v12 * ( v12.dot( v10 ) / ( abs_v12 * abs_v12 ) );

	printf( "%.10lf %.10lf\n", proj.x, proj.y );
    }

    return 0;
}

Measured memory_bytes: 1096
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> v(n);
    int ans = 0;
    for(int i = 0; i < n; i++) cin >> v[i];

    for(int left = 0; left <= k; left++){
        for(int right = 0; right <= k; right++){
            if(right+left > min(n,k)) continue;
            int m = k-left-right;
            int can = 0;
            priority_queue<int,vector<int>,greater<int>> que;
            //cout << "OK" << endl;
            for(int i = 0; i < left; i++){
                que.push(v[i]);
                can += v[i];
            }
            //cout << "OK" << endl;
            for(int i = n-right; i < n; i++){
                que.push(v[i]);
                can += v[i];
            }
            //cout << "OK" << endl;
            for(int i = 0; i < m; i++){
                if(que.empty() || que.top() > 0) break;
                can -= que.top();
                que.pop();
            }
            //cout << "OK" << endl;
            if(ans < can) ans = can;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] c = new int[n];
        int[] s = new int[n];
        int[] f = new int[n];
        for (int i=1;i<n;i++){
            c[i]=sc.nextInt();
            s[i]=sc.nextInt();
            f[i]=sc.nextInt();
        }
        for (int i=1;i<n;i++){
            long time = 0;
            for (int j=i;j<n;j++){
                if (time<=s[j])time=s[j];
                else {
                    if (time%f[j]!=0)time+=f[j]-(time%f[j]);
                }
                time+=c[j];
            }
            System.out.println(time);
        }
        System.out.println(0);
    }
}


Measured memory_bytes: 40076
/*mjytxdy!*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define ull unsigned long long
#define ldb long double
#define pb push_back
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define inl inline
#define rep(i,l,r) for(int i=(l);i<=(r);i++)
#define per(i,r,l) for(int i=(r);i>=(l);i--)
#define travel(i,u) for(int i=head[u];i;i=e[i].next)
#define lb(x) ((x)&(-(x)))
#define lson root<<1
#define rson root<<1|1
#define Mid (l+r>>1)
#define debug(x) cout<<#x":"<<x<<'\n'
#define myput puts("QaQ")
#define file(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
const int MAXN = 1e5+10;
int n,m,u,v,x=1,y,cnt,vis[MAXN],sum[MAXN],fa[MAXN],head[MAXN],f[MAXN];
ll ans;
struct Edge{int to,next;}e[MAXN<<1];
inl char read(){
	static const int IO_LEN=1024*1024;
	static char buf[IO_LEN],*ioh,*iot;
	if(ioh==iot){
		iot=(ioh=buf)+fread(buf,1,IO_LEN,stdin);
		if(ioh==iot) return -1;
	}
	return *ioh++;
}
template<class T>inl void read(T &x){
	static int iosig;static char ioc;
	for(iosig=0,ioc=read();!isdigit(ioc);ioc=read()) if(ioc=='-') iosig=1;
	for(x=0;isdigit(ioc);ioc=read())x=(x<<1)+(x<<3)+(ioc^'0');
	if(iosig) x=-x;
}
inl void add(int u,int v){
	e[++cnt]=(Edge){v,head[u]},head[u]=cnt;
}
inl void dfs(int now,int dep,int father){
	sum[now]=dep&1?1:-1,fa[now]=father;
	travel(i,now){
		if(e[i].to==father) continue;
		dfs(e[i].to,dep+1,now);
		sum[now]+=sum[e[i].to];
	}
}
inl int find(int x){return f[x]==x?x:f[x]=find(f[x]);}
int main(){
//	freopen("in.txt","r",stdin);
	read(n),read(m);
	rep(i,1,n)f[i]=i;
	rep(i,1,m){
		read(u),read(v);
		if(find(u)!=find(v))add(u,v),add(v,u),f[find(u)]=find(v);
		else x=u,y=v;
	}
	dfs(x,1,0);
	if(m==n-1) {if(sum[x]) return puts("-1")&0;}
	else{
		vector<pii> mjy;int now=y;
		while(now) mjy.pb({sum[now],now}),now=fa[now];
		if(mjy.size()&1) {
			if(sum[x]&1) return puts("-1")&0;
			for(auto i:mjy)sum[i.sec]-=sum[x]>>1;
		}else {
			if(sum[x]) return puts("-1")&0;
			sort(all(mjy));
			int mid=mjy[mjy.size()>>1].fir;
			for(auto i:mjy)sum[i.sec]-=mid;
		}
	}
	rep(i,1,n)ans+=abs(sum[i]);
	printf("%lld\n",ans);
	return 0;
}


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

typedef pair<int, int> P;

int main(){
    int n;
    cin >> n;
    vector<P> node(n);
    int x, y;
    for (int i = 0; i < n; i++){
        cin >> x >> y;
        node[i] = {x, y};
    }
    int ans = 100;
    for (int i = 0; i < n; i++){
        for (int j = i + 1; j < n; j++){
            int p = node[j].first - node[i].first;
            int q = node[j].second - node[i].second;
            vector<bool> check(n, false);
            for (int k = 0; k < n; k++){
                int nx = node[k].first;
                int ny = node[k].second;
                for (int z = 0; z < n; z++){
                    if (node[z].first == nx + p && node[z].second == ny + q){
                        check[z] = true;
                    }
                }
            }
            int cnt = 0;
            for (int k = 0; k < n; k++) if (check[k] == false) cnt++;
            ans = min(ans, cnt);
        }
    }
    if (ans == 100) cout << 1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

    int n, Y;
    int x = -1, y = -1, z = -1;

    scanf("%d %d", &n, &Y);

    for(int a = 0; a <= n; a++){
        for(int b = 0; b + a <= n; b++){
                int c = n - a - b;
                int sum = 10000 * a + 5000 * b + 1000 * c;
                if(sum == Y){
                    x = a;
                    y = b;
                    z = c;
                }
        }
    }

    printf("%d %d %d", x, y, z);


    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
import java.util.Locale;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class Main {
  public static void main(String[] args ){

    Scanner sc = new Scanner(System.in);
    String dateStr = sc.next();

    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
    LocalDate date = LocalDate.parse(dateStr, formatter);
    LocalDate reiwa = LocalDate.of(2019, 4, 30);

    System.out.println(date.isAfter(reiwa) ? "TBD" : "Heisei" );

  }
}


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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")


signed main() {
    string s;
    cin >> s;
    bool b = s[0] == s[1] || s[1] == s[2] || s[2] == s[3] || s[3] == s[4];
    cout << (b ? "Bad" : "Good") << nl;
}


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

using namespace std;
#define BUF (10005)

long long  n;

int main(void){
	cin >> n;
	long long  i=100005;
	while(1){
		if(n>=i*i){ 
			break;
		}
		i--;
	}
	cout << i*i << endl;
	return 0;
}


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

int main() {
    int N;
    cin >> N;
    int a[N], i;
    int b[13] = {};
    for(i=0; i<N; ++i) {
        cin >> a[i];
        ++b[a[i]/400];
    }

    int j=0, k=0;
    for(i=0; i<8; ++i) {
        if(b[i] > 0) ++j;
    }
    for(; i<13; ++i) {
        if(b[i] > 0) k += b[i];
    }

    if(j > 0) cout << j << ' ';
    else cout << 1 << ' ';
    int m = j+k;
    // if(m > 8) cout << 8 << endl;
    // else cout << m << endl;
    cout << m << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
int N,K;
int main(){
    LL ans=1;
    cin>>N>>K;
    REP(i,N){
        ans=min(ans*2,ans+K);
    }
    cout<<ans<<endl;
    return 0;
}

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

#define ll long long
const int mxN = 4e3;

ll n, ans, c1[mxN+1], c2[mxN+1], c3[mxN+1];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s;
	cin >> n >> s; s= '#'+s;
	for (int i=1; i<=n; i++) {
		c1[i] = c1[i-1]; c2[i] = c2[i-1]; c3[i] = c3[i-1];
		if (s[i] == 'R') c1[i] ++;
		if (s[i] == 'G') c2[i] ++;
		if (s[i] == 'B') c3[i] ++;
	}
	for (int i=1; i<=n-2; i++) {
		for (int j=i+1; j<=n-1; j++) {
			if ((s[i] == 'R' && s[j] == 'G') || (s[i] == 'G' && s[j] == 'R')) {
				ans += c3[n]-c3[j];
				if (j+j-i <= n && s[j+j-i] == 'B') ans --;
				continue;
			}
			if ((s[i] == 'R' && s[j] == 'B') || (s[i] == 'B' && s[j] == 'R')) {
				ans += c2[n]-c2[j];
				if (j+j-i <= n && s[j+j-i] == 'G') ans --;
				continue;
			}
			if ((s[i] == 'B' && s[j] == 'G') || (s[i] == 'G' && s[j] == 'B')) {
				ans += c1[n]-c1[j];
				if (j+j-i <= n && s[j+j-i] == 'R') ans --;
				continue;
			}
		}
	}
	cout << ans;
	return 0;
}


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

typedef long long ll;
#define MOD1 1000000007
#define MOD2 1000000009
#define fr(a,b) for(ll i=a;i<b;i++)

int32_t main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n;
    cin>>n;
    string  s;
    ll ac=0,wa=0,tle=0,re=0;
    while (n-->0)
    {
        cin>>s;
        if(s=="AC")
            ac++;
        else if(s == "WA")
            wa++;
        else if( s == "TLE")
            tle++;
        else
            re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;

return 0;
}

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

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

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define x first
#define y second

const int MAX_N = 2e5 + 5;

pair<int, int> obst [MAX_N];
vector<int> at [MAX_N];

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

  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> obst[i].x >> obst[i].y;
    at[obst[i].x].push_back(obst[i].y);
  }

  int acc = 1;
  for (int i = 2; i <= h; i++) {
    // find out if there is an accessible endpiece
    for (int y : at[i]) {
      if (y <= acc) {
        cout << i - 1 << endl;
        return 0;
      }
    }

    int mny = w + 5;
    for (int y : at[i]) {
      mny = min(mny, y);
    }

    if (mny != acc + 1) {
      acc++;
    }
  }

  cout << h << endl;
}


Measured memory_bytes: 12800
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.awt.Point;


public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        int[] b = new int[n];
        
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(br.readLine());
            b[i] = a[i];
        }
        
        Arrays.sort(b);
        
        for (int i = 0; i < n; i++) {
            if (a[i] != b[n-1]) {
                System.out.println(b[n-1]);
            }
            else {
                System.out.println(b[n-2]);
            }
        }
        
    }

    
}





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

int main() {
	ll N,T,t,p,c=0,r=0;
	cin >> N >> T;

	cin >> p;
	rep(i,N-1) {
		cin >> t;
		if(t-p > T) {
			r += p-c+T;
			c = t;
		}
		p = t;
	}

	cout << r+p-c+T << endl;
}

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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    string s1;
    cin >> s1;
    string s2;
    cin >> s2;

    // 処理
    int a = stoi(s1 + s2);
    int b = sqrt(a) + 0.5;
    // 出力
    cout << (b * b == a ? "Yes" : "No") << endl;

    return 0;
}


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

int main(){
  int n, k, a[1010], sum = 0;
  cin >> n >> k;
  for(int i=1; i<=n; i++) cin >> a[i];
  sort(a+1, a+n+1);
  for(int i=1; i<=k; i++) sum += a[i];
  cout << sum;
}

Measured memory_bytes: 3648
N = int(input())
p = list(map(int, input().split()))
n = list(range(N+1))
count = 0
c = 0
for c in range(N):
    if p[c] != n[c+1]:
        count += 1
    if count == 3:
        break
    
if count == 3:
    print('NO')
else:
    print('YES')


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

double exp(int dice) {
	dice++;
	return (double)dice / 2;
}

int main(void) {
	int n, k;
	double exp_array[200001];
	scanf("%d%d", &n, &k);
	int temp;
    exp_array[0] = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &temp);
		exp_array[i] = exp(temp);
	}
	double sum_array[200001];
	double max = exp_array[0];
	sum_array[0] = 0;
    sum_array[1] = exp_array[0];
	for (int i = 2; i <= n; i++)
		sum_array[i] = sum_array[i - 1] + exp_array[i - 1];
	for (int i = 0; i <= n - k; i++) {
		if (max < sum_array[i + k] - sum_array[i])
			max = sum_array[i + k] - sum_array[i];
	}
	printf("%lf\n", max);
	return 0;
}

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

int main() {
  int n,h,ans = 0;
  cin >> n >> h;
  vector<P>data;
  rep(i,n){
    int a,b;
    cin >> a >> b;
    data.push_back(P(a,0));
    data.push_back(P(b,1));
  }
  sort(data.begin(),data.end());
  reverse(data.begin(),data.end());
  rep(i,2*n){
    if(data[i].second == 0){
      ans += h/data[i].first;
      if(h%data[i].first != 0) ans++;
      cout << ans << endl;
      return 0;
    }
    else{
      ans++;
      h -= data[i].first;
      if(h <= 0){
        cout << ans << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 2420
#include<iostream>
using namespace std;
int main()
{
    long long a[200000],i,n,l,m,j,pos=1,k;
    cin>>n>>l;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    m=a[0]+a[1];
    for(j=1;j<n;j++)
    {
        if(m<(a[j]+a[j+1]))
        {
            m=a[j]+a[j+1];
            pos=j;
        }
    }
    if(m<l)
    {
         cout<<"Impossible"<<endl;
    }
    else
    {
        cout<<"Possible"<<endl;
        for(k=1;k<pos;k++)
        {
            cout<<k<<endl;
        }
        for(k=n-1;k>=pos;k--)
        {
            cout<<k<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 4404
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N; cin>>N;
  int M;
  for(int i=sqrt(N);1<=i;i--){
    if(N%i==0){
      M=i;
      break;
    }
  }
  int K=N/M;
  string X=to_string(K);
  int ans=X.size();
  cout<<ans<<endl;
  }



Measured memory_bytes: 256
n = int(input())
d = [0]*n
c = [0]*n
s = []
digit_sum = 0 #前後の和　桁数−１のリスト 予め0を入れとく。
digit_cnt = 0
for i in range(n):
  d[i],c[i] = map(int,input().split())
  digit_sum += d[i]*c[i]
  digit_cnt += c[i]
print((digit_cnt*9+digit_sum-1)//9-1)


Measured memory_bytes: 47448
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;
typedef long long ll;
 
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> meals(M, 0);
    rep(i, N) {
        int k;
        cin >> k;
        rep(j, k) {
            int a;
            cin >> a;
            meals[a-1]++;
        }
    }
    int cnt=0;
    rep(i, M) {
        if(meals[i] == N) cnt++;
    }
 
    cout << cnt << endl;
    return 0;
 
}

Measured memory_bytes: 256
N, A, B, C = map(int, input().split())

L = [int(input()) for i in range(N)]

INF = 10 ** 9


# 最小MPを返す
def rec(index, a, b, c):

    # 終了条件
    if index >= N:
        if a != 0 and b != 0 and c != 0:
            # 不足分は延長魔法、短縮魔法を使う
            return abs(A - a) + abs(B - b) + abs(C - c)
        else:
            return INF

    # L[index] をAの材料に使う
    cost_mp_a = 10 if a != 0 else 0
    result_a = rec(index + 1, a + L[index], b, c) + cost_mp_a

    # L[index] をBの材料に使う
    cost_mp_b = 10 if b != 0 else 0
    result_b = rec(index + 1, a, b + L[index], c) + cost_mp_b

    # L[index] をCの材料に使う
    cost_mp_c = 10 if c != 0 else 0
    result_c = rec(index + 1, a, b, c + L[index]) + cost_mp_c

    # L[index] を使わない
    result_none = rec(index + 1, a, b, c)

    return min(result_a, result_b, result_c, result_none)


print(rec(0, 0, 0, 0))


Measured memory_bytes: 44376
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		long b = sc.nextInt();
		long min = a * (a + 1) % 2019;
		c:for(long i = a; i <= b; i++){
			for(long j = i + 1; j <= b; j++){
				if(i * j % 2019 < min){
					min = i * j % 2019;
				}
				if(min == 0){
					break c;
				}
			}
		}
		System.out.println(min);

	}

}


Measured memory_bytes: 22608
from itertools import starmap
from operator import mul

items = []
while 1:
    try:
        price, amount = map(int, raw_input().split(','))
    except EOFError:
        break
    items.append((price, amount))
print sum(starmap(mul, items))
print int(round(1.0 * sum(map(lambda a: a[1], items)) / len(items)))

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

//int dp[100][4][4][4];
//[s.size()+1]
int dp[101][4][4][4];

int main(){
    int n;
    scanf("%d", &n);
    //長さ０の文字列は1、Sは333と考えてもおｋだから
    dp[0][3][3][3] = 1;
    int mod = 1000000000 + 7;

    for(int len = 0; len < n; len++)
    {
        for (int c1 = 0; c1 < 4; c1++)
        {
            for (int c2 = 0; c2 < 4; c2++)
            {
                for (int c3 = 0; c3 < 4; c3++)
                {
                    //あてはまるものがない場合はcontinue
                    if (dp[len][c1][c2][c3] == 0) continue;
                    //新しく追加する文字
                    for (int a = 0; a < 4; a++)
                    {
                        if ( a == 2 && c1 == 1 && c2 == 0) continue;
                        if ( a == 2 && c1 == 0 && c2 == 1) continue;
                        if ( a == 1 && c1 == 2 && c2 == 0) continue;
                        if ( a == 2 && c1 == 1 && c3 == 0) continue;
                        if ( a == 2 && c2 == 1 && c3 == 0) continue;
                        dp[len+1][a][c1][c2] += dp[len][c1][c2][c3];
                        dp[len+1][a][c1][c2] %= mod;
                    }

                }
            }
        }
    }

    int ans = 0;
    for (int c1 = 0; c1 < 4; c1++)
    {
        for (int c2 = 0; c2 < 4; c2++)
        {
            for (int c3 = 0; c3 < 4; c3++)
            {
                ans += dp[n][c1][c2][c3];
                ans %= mod;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
#define int long long

signed main(void){
  int x;
  cin >> x;
  if(x<1200){
    cout << "ABC\r\n";
  }else{
    cout << "ARC\r\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

auto factorization(long long N){
    map<long long, long long> mp;
    long long n = N;
    for(long long i = 2; i * i <= N; i++){
        while(n % i == 0){
            mp[i]++;
            n /= i;
        }
    }
    if(n > 1) mp[n]++;
    return mp;
}

long long inverse(long long a, long long m) {
    long long b = m, u = 1, v = 0, tmp;
    while(b > 0){
        long long t = a / b;
        a -= t * b;
        tmp = a; a = b; b = tmp;
        u -= t * v;
        tmp = u; u = v; v = tmp;
    }
    u %= m; 
    if(u < 0) u += m;
    return u;
}

ll N, A[10001];
map<ll, ll> M[10001], B;
ll P[1000001][64];

signed main(){
    cin >> N;
    REP(i, N) cin >> A[i];
    REP(i, N){
        M[i] = factorization(A[i]);
    }
    REP(i, N){
        for(auto p : M[i]){
            B[p.first] = max(B[p.first], p.second);
        }
    }
    ll L = 1;
    for(auto p : B){
        REP(i, p.second) L = (L * p.first) % MOD;
    }
    ll ans = 0;
    REP(i, N){
        ans = (ans + L * inverse(A[i], MOD)) % MOD;
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 7244
#include<bits/stdc++.h>
using namespace std ;
#define Next( i, x ) for( register int i = head[x]; i; i = e[i].next )
#define rep( i, s, t ) for( register int i = (s); i <= (t); ++ i )
#define drep( i, s, t ) for( register int i = (t); i >= (s); -- i )
#define re register
#define int long long
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 8e5 + 5 ; 
const int P = 200003 ; 
int n, m, R[N], g[N], ord[N], fc[N], f[N], c[N], tt[N], limit, L, num, cnt, ans[N] ; 
void Init( int x ) {
	limit = 1, L = 0 ; 
	while( limit <= x ) limit <<= 1, ++ L ;
	rep( i, 0, limit ) R[i] = ( R[i >> 1] >> 1 ) | ( ( i & 1 ) << ( L - 1 ) ) ;
}
const double Pi = acos( -1.0 ) ;
struct Complex {
	double x, y ; 
	Complex( double xx = 0, double yy = 0 ) { x = xx, y = yy ; }
} F[N], Q[N], C[N], A1[N], A2[N], B1[N], B2[N] ; 
Complex operator * ( Complex x, Complex y ) { return Complex( x.x * y.x - x.y * y.y, x.x * y.y + x.y * y.x ) ; }
Complex operator + ( Complex x, Complex y ) { return Complex( x.x + y.x, x.y + y.y ) ; }
Complex operator - ( Complex x, Complex y ) { return Complex( x.x - y.x, x.y - y.y ) ; }
Complex operator / ( Complex x, double y ) { return Complex(x.x / y, x.y / y ) ; }
void FFT( Complex *a, int type ) {
	for( int i = 0; i < limit; ++ i ) if( R[i] > i ) swap( a[R[i]], a[i] ) ;
	for( int k = 1; k < limit; k <<= 1 ) {
		Complex Dw = Complex( cos( Pi / k ), type * sin( Pi / k ) );	
		for( int i = 0; i < limit; i += ( k << 1 ) ) {
			Complex w = Complex( 1, 0 ) ;
			for( int j = i; j < i + k; ++ j, w = w * Dw ) {
				Complex Ny = w * a[j + k], Nx = a[j] ;
				a[j + k] = Nx - Ny,	a[j] = Nx + Ny ; 
			} 
		}
	}	
	if( type != 1 ) rep( i, 0, limit ) a[i] = a[i] / (double)limit ;
}
signed main()
{
	n = gi() ; 
	rep( i, 1, n ) c[i] = gi() ; 
	int gg = 2, ff = 1 ; cnt = 400 ; 
	for( re int i = 0; i < P - 1; ++ i ) {
		ord[ff] = i, fc[i] = ff, ff = ff * 2 % P ; 
	}
	int Ans = 0 ; 
	rep( i, 1, n ) if(c[i]) tt[ord[c[i]]] ++, Ans -= c[i] * c[i] % P ; 
	rep( i, 0, P ) A1[i].x = tt[i] / cnt, A2[i].x = tt[i] % cnt ; 
	rep( i, 0, P ) B1[i].x = tt[i] / cnt, B2[i].x = tt[i] % cnt ; 
	Init( 2 * P + 5 ), FFT( A1, 1 ), FFT( A2, 1 ), FFT( B1, 1 ), FFT( B2, 1 ) ; 
	num = cnt * cnt % P ; 
	rep( i, 0, limit ) F[i] = A1[i] * B1[i], Q[i] = ( A1[i] * B2[i] + A2[i] * B1[i] ), C[i] = A2[i] * B2[i] ; 
	FFT( F, -1 ), FFT( Q, -1 ), FFT( C, -1 ) ;
	rep( i, 0, limit ) {
		ans[i] = ( (int)(F[i].x + 0.5) * num + ( (int)(Q[i].x + 0.5) * cnt ) + (int)(C[i].x + 0.5) ) ; 
		Ans += ans[i] * fc[i % (P - 1)] ;
	}
	cout << Ans / 2 << endl ; 
	return 0;
}

Measured memory_bytes: 105920
def IsOdd(n):
    if n % 2 == 0:
        return True
    else:
        return False

A,B,C = map(int,input().split())

cnt = 0
inf = False
while True:
    if IsOdd(A) and IsOdd(B) and IsOdd(C):
        if A == B == C:
            inf = True
            break
        else:
            a,b,c = A//2,B//2,C//2
            A,B,C = b+c,c+a,a+b
            cnt += 1
    else:
        break
if inf:
    print(-1)
else:
    print(cnt)

Measured memory_bytes: 8996
object Main extends App {
	var Array(a, b, k) = io.StdIn.readLine.split(' ').map(BigInt(_))
	
	a -= k
	if (a < 0) {b += a; a = 0}
  	if (b < 0) b = 0
	
	println(s"$a $b")
}

Measured memory_bytes: 25544
n=int(input())
v=map(int,input().split())
vodd={-1:0}
veven={-1:0}
for i,vi in enumerate(v):
    if i%2:
        if(vi in veven):
            veven[vi]+=1
        else:
            veven[vi]=1
    else:
        if(vi in vodd):
            vodd[vi]+=1
        else:
            vodd[vi]=1
veven=list(veven.items())
veven.sort(key=lambda x:-x[1])
vodd=list(vodd.items())
vodd.sort(key=lambda x:-x[1])
if veven[0][0]==vodd[0][0]:
    a=veven[0][1]+vodd[1][1]
    b=veven[1][1]+vodd[0][1]
    changeCnt=n-a if a>b else n-b
else:
    changeCnt=n-veven[0][1]-vodd[0][1]

print(changeCnt)

Measured memory_bytes: 20912
#include <iostream>
#include <vector>

int main()
{
    int n, m;
    std::cin >> n >> m;

    std::vector<bool> is_ok(n + 1, true);
    for (int i = 0; i < m; i++) {
        int temp;
        std::cin >> temp;
        is_ok[temp] = false;
    }

    std::vector<long long> dp(n + 1, 0);
    dp[0] = 1;
    if (is_ok[1]) {
        dp[1] = 1;
    }

    for (int i = 2; i <= n; i++) {
        if (is_ok[i]) {
            const int mod = 1000000007;
            dp[i] = dp[i - 1] + dp[i - 2];
            dp[i] %= mod;
        }
    }

    std::cout << dp[n] << std::endl;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int h1,h2,h3,t;

int main()
{
    for(int i=0;i<10;i++)
    {
        cin >> t;
        if(t>h1){h3 = h2;h2=h1;h1=t;continue;}
        if(t>h2){h3=h2;h2=t;continue;}
        if(t>h3){h3=t;}
    }
    cout << h1 << endl;
    cout << h2 << endl;
    cout << h3 << endl;

    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define forn(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pb push_back
 
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	int n; string s; cin >> n >> s;
	if(s.size() <= n) cout << s;
	else{
		forn(i,0,n) cout << s[i];
		cout << "...";
	}
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <tuple>

using namespace std;

typedef pair <int, int> pii;
typedef vector <pii> vpii;
typedef vector <int> vi;

int B[100001];

int main() {
    int n, m;
    cin >> n >> m;
    
    int u, v;
    vector <tuple <int, int, int> > A;
    for(int i = 0; i < m; ++i) {
        cin >> u >> v;

        A.emplace_back(u, 0, i);
        A.emplace_back(v - 1, 1, i);
    }
    
    sort(A.begin(), A.end());
    
    int mx = 0;
    vi vex;
    
    for(tuple <int, int, int> p : A) {
        int h;
        tie(u, v, h) = p;
        if(v == 0) vex.push_back(h);
        else {
            if(B[h]) continue;
            for(int x : vex) B[x] = 1;
            mx += 1;
            vex.clear();
        }
    }
    
    cout << mx;
    
    return 0;
}

Measured memory_bytes: 4980
#python3
n=int(input())
p=[int(i) for i in input().split()]
cnt=0
for i in range(n-2):
  if (p[i]<p[i+1] and p[i+1]<p[i+2]) or (p[i+2]<p[i+1] and p[i+1]< p[i]):
    cnt+=1
print(cnt)

Measured memory_bytes: 3060
module Main where
import qualified Data.ByteString.Char8         as BS
import qualified Data.ByteString.Lazy.Char8    as BSL
import qualified Data.ByteString.Builder       as BSB
import           Data.Char                      ( isSpace )
import           Data.List
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM
import qualified Data.Vector.Generic           as VG
import qualified Data.Vector.Generic.Mutable   as VGM
import           Data.Map.Strict                ( Map )
import qualified Data.Map.Strict               as Map
import           Data.IntMap.Strict             ( IntMap )
import qualified Data.IntMap.Strict            as IntMap
import           Data.HashMap.Strict            ( HashMap )
import qualified Data.HashMap.Strict           as HashMap
import           Data.HashSet                   ( HashSet )
import qualified Data.HashSet                  as HashSet
import           Data.Tuple                     ( swap )
import qualified Data.Sequence                 as Seq
import           Data.Sequence                  ( Seq )
import           Data.Maybe                     ( fromJust )
import Debug.Trace

type Graph = HashMap Int (HashSet Int)

main :: IO ()
main = do
  [n, m] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  abs <- VU.replicateM m $ (\[x, y] -> (x, y)) . unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let g = VU.foldr' f HashMap.empty $ abs VU.++ VU.map swap abs
  let ans = IntMap.toAscList $ go g Seq.empty 1 HashSet.empty IntMap.empty
  putYN True
  -- print ans
  mapM_ (print . snd) $ tail ans

go :: Graph -> Seq Int -> Int -> HashSet Int -> IntMap Int -> IntMap Int
go graph queue node visited ans = let
  nexts = HashSet.toList $ HashSet.difference (fromJust $ HashMap.lookup node graph) visited
  ans' = foldl' f ans nexts where
    f a next = IntMap.insert next node a
  visited' = foldl' f visited nexts where
    f v next = HashSet.insert next v
  queue' = queue Seq.>< Seq.fromList nexts
  in case Seq.viewl queue' of
    Seq.EmptyL -> ans'
    x Seq.:< queue'' -> go graph queue'' x visited' ans'

f :: (Int, Int) -> Graph -> Graph
f (a, b) = HashMap.insertWith HashSet.union a (HashSet.singleton b)

putYN :: Bool -> IO ()
putYN True  = putStrLn "Yes"
putYN False = putStrLn "No"

Measured memory_bytes: 119120
#include<stdio.h>

int main(){

	int flag=0;
	int i=0;
	int j=0;

	int N;
	scanf("%d",&N);
	
	int s[N];
	for(i; i<N; i++){
		scanf("%d",&s[i]);

		if( s[i] != i+1 ){
			flag =flag+1;
		}
	}

	// for( j; j<N-1; j++ ){
	// 	if( (s[j]+1) == s[j+1] ){		
	// 	;
	// 	}else{
	// 		flag = flag+1;
	// 	}
	// }	

	if( flag<=2 ){
		printf("YES");
	}else{
		printf("NO");
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
long double a,ans;
    cin>>a;
   a=a/3;
    ans=a*a*a;

    cout<<fixed<<setprecision(12)<<ans<<endl;

     return 0;
}


Measured memory_bytes: 3748