akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  unsigned h,w,m; cin >> h >> w >> m;
  int br[300001];
  int bc[300001];
  int cntr[300001] = {};
  int cntc[300001] = {};
  int maxr=0,maxc=0;
  for(unsigned i = 0; i < m; ++i){
    cin >> br[i] >> bc[i];
    ChangeMax(maxr,++cntr[br[i]]);
    ChangeMax(maxc,++cntc[bc[i]]);    
  }
  bitset<300001>r,c;
  unsigned cr=0,cc=0,cntd=0;
  for(unsigned i = max(w,h); i >= 1; --i){
    if(maxr == cntr[i])cr+=r[i] = 1;
    if(maxc == cntc[i])cc+=c[i] = 1;
  }
  cntd = cr*cc;
  for(unsigned i = 0; i < m; ++i)
    cntd -= c[bc[i]]&r[br[i]];
  cout << maxr + maxc - (!cntd) << '\n';
}


Measured memory_bytes: 8372
x = int(input())

dp = []

for i in range(x + 1):
  if i == 0:
    dp.append(1)
  elif i < 100:
    dp.append(0)
  elif i >= 100 and i <= 105:
    dp.append(1)
  elif dp[i - 100] == 1 or dp[i - 101] == 1 or dp[i - 102] == 1 or dp[i - 103] == 1 or dp[i - 104] == 1 or dp[i - 105] == 1:
    dp.append(1)
  else:
    dp.append(0)
print(dp[x])


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

#define ll long long
#define ld long double
typedef vector <ll> vi;                 // Vector of long long
typedef vector <vi> vvi;                // Vector of vi
typedef vector <pair<ll,ll>> ii;        // Vector of pairs
#define ff first                        // For pairs
#define ss second                       // For pairs
#define sz(a) int((a).size())           // Function to determine size of any container
#define pb push_back                    // Pushback to vector
#define mp make_pair                    // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end()   // Mainly used by me in sorting
// ordered_set adds two new functions to set - (set).find_by_order([kth element based on zero indexing]) and order_of_key()
// order_of_key returns number of elements less that parameter. If element exists, that order is its index
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
#define MAX (ll)(1e5 + 5)

using cd = complex<ld>;
const ld PI = acos(-1);

void fft(vector<cd> & a, bool invert) {
    ll n = a.size();
    if (n == 1)
        return;

    vector<cd> a0(n / 2LL), a1(n / 2LL);
    for (int i = 0; 2 * i < n; i++) {
        a0[i] = a[2LL*i];
        a1[i] = a[2LL*i+1LL];
    }
    fft(a0, invert);
    fft(a1, invert);

    ld ang = 2LL * PI / n * (invert ? -1LL : 1LL);
    cd w(1LL), wn(cos(ang), sin(ang));
    for (int i = 0; 2 * i < n; i++) {
        a[i] = a0[i] + w * a1[i];
        a[i + n/2] = a0[i] - w * a1[i];
        if (invert) {
            a[i] /= 2;
            a[i + n/2] /= 2;
        }
        w *= wn;
    }
}

    vector<ll> multiply(vector<ll> const& a, vector<ll> const& b) {
    vector<cd> fa(a.begin(), a.end()), fb(b.begin(), b.end());
    ll n = 1;
    while (n < a.size() + b.size()) 
        n <<= 1;
    fa.resize(n);
    fb.resize(n);

    fft(fa, false);
    fft(fb, false);
    for (int i = 0; i < n; i++)
        fa[i] *= fb[i];
    fft(fa, true);

    vector<ll> result(n);
    for (int i = 0; i < n; i++)
        result[i] = round(fa[i].real());
    return result;
}

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

    ll n, m;
    cin >> n >> m;

    vi a(MAX, 0);
    for (int i = 0; i < n; i++)
    {
        ll x;
        cin >> x;

        a[x]++;
    }

    vi b = a;
    vi c = multiply(a, b);

    ll s = 0, score = 0;
    for (int i = c.size() - 1; i >= 0; i--)
    {
        score += max(0LL, min(c[i], m - s)) * i;
        s += c[i];

        if (s >= m)
            break;
    }

    cout << score << "\n";
}


Measured memory_bytes: 36692
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define re register
#define LL long long
#define MOD 998244353
#define MAXN 100005
using namespace std;
LL n,ans,bs[3*MAXN];
LL rd(){
	LL x=0,tp=1;char c;c=getchar();
	while(c<'0' || c>'9'){if(c=='-')tp=-1;c=getchar();}
	while(c>='0' && c<='9'){x=(x*10+c-'0');c=getchar();}
	return x*tp;
}
struct Graph{
	LL m,sg[MAXN],f[MAXN];
	vector<int>e[MAXN];
	void work(){
		int x,y;
		m=rd();
		for(int i=1;i<=m;i++){
			x=rd(),y=rd();
			if(x>y)swap(x,y);
			e[x].push_back(y);
		}
		for(int i=n;i>=1;i--){
			set<int>s;
			int sz=e[i].size();
			for(int j=0;j<sz;j++)s.insert(sg[e[i][j]]);
			while(s.count(sg[i]))sg[i]++;
			(f[sg[i]]+=bs[i])%=MOD;
			// printf("sg[%d]=%d\n",i,sg[i]);
		}
	}
}g[3];
int main(){
	// freopen("testdata.in","r",stdin);
	// freopen("shit.out","w",stdout);
	n=rd();int Sqr=sqrt(n);
	bs[0]=1;LL fuck=1000000000000000000ll%MOD;
	for(int i=1;i<=3*n;i++)bs[i]=bs[i-1]*fuck%MOD;
	for(int i=0;i<3;i++)g[i].work();
	for(int i=0;i<=500;i++)
		for(int j=0;j<=500;j++)
			(ans+=g[0].f[i]*g[1].f[j]%MOD*g[2].f[i^j]%MOD)%=MOD;
	printf("%lld\n",ans);
	// printf("%.2lf\n",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}

Measured memory_bytes: 18944
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair
#define sz(x)       int(x.size())
//#define int         int64_t

using namespace std;

typedef pair<int, int> pii;
const int N = 2e5 + 2;
const int mod = 998244353;

int pos, n, f[N], nxt[N], st[N << 2], l[N << 2], h[N << 2];
pii p[N];

void build(int x, int low, int high) {
    l[x] = low, h[x] = high;
    if(low == high) {
        st[x] = low;
        return;
    }
    int mid = (low + high) >> 1;
    build(x << 1, low, mid);
    build(x << 1 | 1, mid + 1, high);
    st[x] = max(st[x << 1], st[x << 1 | 1]);
}

void upd(int x, int pos, int val) {
    if(l[x] > pos || h[x] < pos) return;
    if(l[x] == pos && h[x] == pos) {
        st[x] = max(st[x], val);
        return;
    }
    upd(x << 1, pos, val);
    upd(x << 1 | 1, pos, val);
    st[x] = max(st[x << 1], st[x << 1 | 1]);
}

int get(int x, int low, int high) {
    if(l[x] > high || h[x] < low) return 0;
    if(l[x] >= low && h[x] <= high) return st[x];
    return max(get(x << 1, low, high), get(x << 1 | 1, low, high));
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n; build(1, 1, n + 1);
    for(int i = 1; i <= n; ++i) {
        cin >> p[i].fi >> p[i].se;
        p[i].se += p[i].fi;
    }
    sort(p + 1, p + n + 1);
    for(int i = 1; i <= n; ++i) {
        nxt[i] = lower_bound(p + 1, p + n + 1, pii(p[i].se, -2e9)) - p - 1;
    }
    f[n + 1] = 1;
    for(int i = n; i >= 1; --i) {
        nxt[i] = min(n + 1, get(1, i, nxt[i]) + 1);
        f[i] = f[i + 1] + f[nxt[i]];
        if(f[i] >= mod) f[i] -= mod;
        if(nxt[i] == n + 1) upd(1, i, nxt[i]);
        else upd(1, i, nxt[i] - 1);
    }
    cout << f[1];
}


Measured memory_bytes: 12800
#include<stdio.h>
int main(void)
{
	int h,m,s,h1,m1,s1,p,h2,m2,s2,h3,m3,s3,p1,p2;
	scanf("%d %d %d",&h,&m,&s);
	while(!(h==-1 && m==-1 && s==-1)){
		h1=h*3600;
		m1=m*60;
		s1=s;
		p=h1+m1+s1;
		
		p1=7200-p;
		
		h2=p1/3600;
		p1=p1-(3600*h2);
		m2=p1/60;
		s2=p1%60;
		printf("0%d:",h2);
		if(m2<10){
			printf("0%d:",m2);
		}
		else{
			printf("%d:",m2);
		}
		if(s2<10){
			printf("0%d\n",s2);
		}
		else{
			printf("%d\n",s2);
		}
		
		p2=(7200-p)*3;
		h3=p2/3600;
		p2=p2-(3600*h3);
		m3=p2/60;
		s3=p2%60;
		
		printf("0%d:",h3);
		if(m3<10){
			printf("0%d:",m3);
		}
		else{
			printf("%d:",m3);
		}
		if(s3<10){
			printf("0%d\n",s3);
		}
		else{
			printf("%d\n",s3);
		}
		
		
		scanf("%d %d %d",&h,&m,&s);
	}
	return 0;
}

Measured memory_bytes: 1028
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>

const int N = 100000;

int a[N], b[N];

int main()
{
    int n;
    scanf("%d", &n);
    long long sum_a = 0, sum_b = 0, sum_bad = 0;
    int bad_cnt = 0;
    for (int i = 0; i < n; ++ i) {
        scanf("%d", a + i);
        sum_a += a[i];
    }
    std::vector<int> candidates;
    for (int i = 0; i < n; ++ i) {
        scanf("%d", b + i);
        sum_b += b[i];
        if (a[i] < b[i]) {
            bad_cnt ++;
            sum_bad += b[i] - a[i];
        } else {
            candidates.push_back(a[i] - b[i]);
        }
    }
    if (sum_a < sum_b) {
        puts("-1");
    } else {
        std::sort(candidates.begin(), candidates.end());
        for (int i = (int)candidates.size() - 1; i >= 0 && sum_bad > 0; -- i) {
            bad_cnt ++;
            sum_bad -= candidates[i];
        }
        printf("%d\n", bad_cnt);
    }
}


Measured memory_bytes: 1532
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007
double PI=3.1415926535897932384626;
//not accepted

vector<ll>dp(2*500005,0);
ll n;


ll query(ll pos)
{
  ll ans=0;
  while(pos>=1)
  {
    ans=max(ans,dp[pos]);
    pos-=(pos&-pos);
  }
  return ans;
}

void update(ll pos,ll val)
{
  while(pos<=n)
  {
    dp[pos]=max(dp[pos],val);
    pos+=(pos&-pos);
  }
}

int main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
  cin>>n;
  ll h[n];
  ll a[n];
  for(ll i=1;i<=n;i++)
  {
    cin>>h[i];
  }
  for(ll j=1;j<=n;j++)
  {
    cin>>a[j];
  }
  //base case
  update(h[1],a[1]);


  
  for(ll flower=2;flower<=n;flower++)
  {
      ll temp=query(h[flower])+a[flower];
      update(h[flower],temp);
  }
  cout<<query(n)<<endl;
    return 0;
}

Measured memory_bytes: 11264
N, M, C = map(int, input().split())
B = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(N)]
judge = 0
count = 0

for i in range(N):
    for j in range(M):
        judge += B[j] * A[i][j]
    if judge + C > 0:
        count += 1
    else:
        pass
    judge = 0

print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  string s;
  ll k;
  cin >> s >> k;
  ll cnt1=0,cnt2=0;;
  ll n=s.size();
  ll t=1;
  for(int i=0;i<n-1;i++){
    if(s[i]==s[i+1]){
      t++;
    }
    else{
      cnt1+=t/2;
      t=1;
    }
  }
  if(t==n){
    cout << n*k/2 << endl;
    return 0;
  }
  cnt1+=t/2;
  t=1;
  string u=s+s;
  for(int i=0;i<2*n-1;i++){
    if(u[i]==u[i+1]){
      t++;
    }
    else{
      cnt2+=t/2;
      t=1;
    }
  }
  cnt2+=t/2;
  cout << (cnt2-cnt1)*(k-1)+cnt1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  int k;
  string s;
  cin >> s >> k;
  set<string> sub;
  int len = (int)s.size();
  REP(i,len){
    REP(j,k){
      sub.insert(s.substr(i,j+1));
    }
  }
  auto iter = sub.begin();
  REP(i,k-1) iter++;
  cout << *iter << endl;
  return 0;
}

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

int main() {
	int N,c=0;
	ll m=INF,s=0,A;
	cin >> N;

	rep(i,N) {
		cin >> A;
		if(A < 0)
			++c;
		s += abs(A);
		m = min(m, abs(A));
	}

	cout << s-((c%2)?m*2:0) <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

//素数判定
template <class T>
bool is_prime(T x){
	for(T i=2;i*i<=x;i++){
		if(x%i==0){
			return false;
		}
	}
	return x!=1;
}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	vector<int> sum(200010,0);
	rep(i,100010){
		sum[i+1]=sum[i];
		if(i%2==0) continue;
		if(is_prime(i) && is_prime((i+1)/2)){
			sum[i+1]++;
		}
	}
	int q;
	cin>>q;
	while(q--){
		int l,r;
		cin>>l>>r;
		cout<<sum[r+1]-sum[l-1]<<endl;
	}
}


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

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main() {
    int h = 0, n = 0;
    scanf("%d %d", &h, &n);
    
    int *a = malloc(sizeof(int) * n);
    for (int i = 0; i < n; i++) {
        scanf("%d ", &a[i]);
    }
    for (int i = 0; i < n; i++) {
        h -= a[i];
    }
    if (h <= 0) {
        printf("Yes");
    } else {
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;
bool wall[2][35][35];
int dis[35][35];
queue<pair<int,int> > q1;

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	while(cin>>m>>n){
		if(!n)break;
		for(i=0;i<2*n-1;i++){
			for(j=0;j<m-1+i%2;j++){
				cin>>a;
				if(a==1)wall[i%2][i/2][j]=true;
				else wall[i%2][i/2][j]=false;
			}
		}
		memset(dis,0,sizeof(dis));
		q1.push(make_pair(0,0));
		for(i=1;!q1.empty();i++){
			for(j=q1.size();j>0;j--){
				a=q1.front().first,b=q1.front().second,q1.pop();
				if(a<0 || n<=a || b<0 || m<=b)continue;
				if(dis[a][b])continue;
				dis[a][b]=i;
				if(!wall[0][a][b])q1.push(make_pair(a,b+1));
				if(b>0 && !wall[0][a][b-1])q1.push(make_pair(a,b-1));
				if(!wall[1][a][b])q1.push(make_pair(a+1,b));
				if(a>0 && !wall[1][a-1][b])q1.push(make_pair(a-1,b));
			}
		}
		cout<<dis[n-1][m-1]<<endl;
	}
}



Measured memory_bytes: 3144
#include <stdio.h>
#define MAX 10

int main(void){
	int n, a[MAX+1][MAX+1], i, j, s;
	
	while(scanf("%d",&n), n!=0){
		for(j=0; j<n; j++){
			s=0;
			
			for(i=0; i<n; i++){
				scanf("%d",&a[i][j]), printf("%5d",a[i][j]);
				s+=a[i][j];
			}
			
			a[n][j]=s;
			printf("%5d\n",a[n][j]);
		}
		
		for(i=0; i<=n; i++){
			s=0;
			for(j=0; j<n; j++) s+=a[i][j];
			printf("%5d",s);
		}
		
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define moca(a, s, b) a=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


//for(i=0; i<N; i++) cin >> a[i];

ll D;
ll c[26];
ll s[366][26];

ll calcScore(vector<ll> sche) {
  ll score=0;
  ll i, j, k;
  ll p[26];
  for(i=0; i<26; i++) p[i]=-1;
  
  for(ll d=0; d<sche.size(); d++) {
    score+=s[d][sche[d]];
    
    p[sche[d]]=d;
    for(i=0; i<26; i++) score-=c[i]*(d-p[i]);
    
  }
  
  return score;
}

int main(void) {
  ll i, j, k;
  
  cin >> D;
  for(i=0; i<26; i++) cin >> c[i];
  for(i=0; i<D; i++) {
    for(j=0; j<26; j++) {
      cin >> s[i][j];
    }
  }
  
  ll width=30;
  vector<vector<ll>> tops; tops.push_back({});
  
  for(ll d=0; d<D; d++) {
    
    priority_queue<pair<ll, vector<ll>>> candidates;
    for(k=0; k<tops.size(); k++) {
      for(i=0; i<26; i++) {
        tops[k].push_back(i);
        candidates.push({calcScore(tops[k]), tops[k]});
        tops[k].pop_back();
      }
    }
    
    tops.clear();
    for(i=0; i<min(width, (ll)candidates.size()); i++) {
      tops.push_back(candidates.top().sc);
      candidates.pop();
    }
    
    
  }
  
  for(i=0; i<D; i++) pt(tops[0][i]+1);
  
}



Measured memory_bytes: 6576
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000


int main(){
	
	string S;
	cin>>S;
	
	S.pop_back();
	
	while(true){
		if(S.substr(0,S.size()/2)==S.substr(S.size()/2)){
			cout<<S.size()<<endl;
			return 0;
		}
		S.pop_back();
	}
	
    return 0;
}



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

long long int n;
long double d[3000],dres=0;

int main() {
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>d[i];
    }
    sort(d,d+n);
    dres=d[0];
    for(int i=1;i<n;i++){
        dres=(dres+d[i])/2.0;
    }
    cout<<dres<<endl;
    
} 


Measured memory_bytes: 256
X,N = map(int, input().split())
if N == 0:
    print(X)
else:
    P = list(map(int, input().split()))
    if not X in P:
        print(X)
    else:
        for j in range(2*N):
            if not (X-j) in P:
                print(X-j)
                break
            if not (X+j) in P:
                print(X+j)
                break

Measured memory_bytes: 9132
N,M=map(int,input().split())
S=list(map(int,list(input())))

ans=[]
ind=N
while ind>0:
  j=0
  for i in range(max(ind-M,0),ind):
    if S[i]==0:
      ans.append(ind-i)
      ind=i
      j=1
      break
  if j==0:
    print(-1)
    exit()
      
print(*reversed(ans))

Measured memory_bytes: 7064
using System;

class Tester
{
    static void Main(string[] args)
    {
        string x = Console.ReadLine();
        int a, b;
        string[] result;

        const char Space = ' ';
        char[] delimiters = new char[] { Space };
        result = x.Split(delimiters);

        a = int.Parse(result[0]);
        b = int.Parse(result[1]);

        if (a>b) //a>bの時
        {
            Console.WriteLine("a > b");
        }
        if(a<b) //a<bの時
        {
            Console.WriteLine("a < b");
        }
        if(a==b)
        {
            Console.WriteLine("a == b");
        }
    }
}


Measured memory_bytes: 8956
A=[[int(i) for i in input().split()] for q in range(3)]
n=int(input())

tar=[]
for i in range(n):
    ck=int(input())
    for p in range(9):
        if A[p//3][p%3]==ck:
            tar.append(p)

def check(a,b,c):
    if a in tar and b in tar and c in tar:
        return 1
    else:
        return 0

res=check(0,1,2)+check(3,4,5)+check(6,7,8)+check(0,3,6)+check(1,4,7)+check(2,5,8)+check(0,4,8)+check(2,4,6)
if res==0:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3064
#include <iostream>
#include <queue>

using namespace std;

struct TILE {
	char tile;
	bool hantei;
};

typedef pair<int, int> P;

TILE yuka[20][20];
int w, h;

int main() {
	while (cin >> w >> h) {
		if (w == 0 && h == 0) {
			break;
		}
		int si, sj;
		int imove[4] = {1, 0, -1, 0};
		int jmove[4] = {0, 1, 0, -1};
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				cin >> (yuka[i][j]).tile;
				(yuka[i][j]).hantei = false;
				if ((yuka[i][j]).tile == '@') {
					si = i;
					sj = j;
				}
			}
		}
		queue<P> q;
		q.push(P(si, sj));
		while (!q.empty()) {
			P p = q.front();
			q.pop();
			(yuka[p.first][p.second]).hantei = true;
			for (int k = 0; k < 4; k++) {
				if (0 <= p.first+imove[k] && p.first+imove[k] < h 
					&& 0 <= p.second+jmove[k] && p.second+jmove[k] < w 
					&& (yuka[p.first+imove[k]][p.second+jmove[k]]).tile == '.' 
					&& !(yuka[p.first+imove[k]][p.second+jmove[k]]).hantei) {
						q.push(P(p.first+imove[k], p.second+jmove[k]));
				}
			}
		}
		int counter = 0;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if ((yuka[i][j]).hantei) {
					counter++;
				}
			}
		}
		cout << counter << endl;
	}
	return 0;
}

Measured memory_bytes: 4244
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
inline int partition(vi &a, int p, int r) {
	int x = a[r];
	int i = p - 1;
	rep(j, p, r) {
		if(a[j] <= x) {
			++i;
			swap(a[i], a[j]);
		}
	}
	swap(a[++i], a[r]);
	return i;
}
int main() {
	int n; cin >> n;
	vi v(n); rep(i, 0, n) cin >> v[i];
	int q = partition(v, 0, n - 1);
	rep(i, 0, n) {
		if(i == q) cout << "[" << v[i] << "]";
		else p(v[i]);
		p(i + 1 == n ? "\n" : " ");
	}
	return 0;
}

Measured memory_bytes: 3160
n = int(input())
a = list(map(int,input().split()))
a2 = []
for i in range(n):
    ai = a[i]
    count = 0
    while True:
        if a[i] % 2 != 0:
            a2.append(count)
            break
        else:
            a[i] //= 2
            count += 1
print(sum(a2))

Measured memory_bytes: 4140
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (n-- > 0) {
            int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), d = sc.nextInt();
            System.out.println(Math.min(a * c + b * d, (a * (c < 5 ? 5 : c) + b * (d < 2 ? 2 : d)) * 8 / 10));
        }
    }
}



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

#define rep(i,n) for(int i = 0;i<n;i++)
#define cint(a) int a; cin >> a;
#define cstr(str) string str; cin >> str;


using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);




	int h, w, k;  cin >> h>> w >> k;
	string str[6];
	rep(i, h) cin >> str[i];
	int cnt = 0;
	int ans = 0;

	for (int bit = 0; bit < (1 << h); ++bit) {	
		for (int bit2 = 0; bit2 < (1 << w); ++bit2) {
				 cnt = 0;
			for (int i = 0; i < h; ++i) {
				for (int j = 0; j < w; ++j) {
					
					if ((bit & (1 << i)) || (bit2 & (1 << j))) continue;
					if (str[i][j] == '#') cnt++;
				}
			}
			if (cnt == k) ans++;
		}
	}

	cout << ans << endl;



	return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
int main(){
    double x1, y1, x2, y2, ans;
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    printf("%lf", sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)));
    return 0;
}


Measured memory_bytes: 2132
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<set>
#include<functional>
#include<iomanip>

#define LLI long long int

using namespace std;

int main(){
	int n;cin>>n;
	vector<int>v(n+1);
	for(int i=1;i<=n;i++)cin>>v[i];
	vector<pair<int,int> >o(100010);
	vector<pair<int,int> >e(100010);
	o[0]=pair<int,int>(0,0);
	e[0]=pair<int,int>(0,0);
	for(int i=1;i<100010;i++){
		o[i]=pair<int,int>(-1,i);
		e[i]=pair<int,int>(-1,i);
	}
	for(int i=1;i<=n;i++){
		if(i%2==0){
			if(e[v[i]].first>=0){
				e[v[i]].first++;
			}else{
				e[v[i]].first=1;
			}
		}else{
			if(o[v[i]].first>=0){
				o[v[i]].first++;
			}else{
				o[v[i]].first=1;
			}
		}
	}
	sort(o.begin(),o.end(),greater<pair<int,int> >());
	sort(e.begin(),e.end(),greater<pair<int,int> >());
	int ans;
	if(o[0].second!=e[0].second){
		ans=n-o[0].first-e[0].first;
	}else{
		if(o[0].first+e[1].first>o[1].first+e[0].first){
			ans=n-o[0].first-e[1].first;
		}else{
			ans=n-o[1].first-e[0].first;
		}
	}
	cout<<ans<<endl;

	return 0;
}



Measured memory_bytes: 2176
x = list(map(str, input().split()))
stack = []

for i in x:
    if i == '+':
        stack.append((stack.pop() + stack.pop()))

    elif i == '-':
        stack.append(-(stack.pop()) + stack.pop())

    elif i == '*':
        stack.append((stack.pop() * stack.pop()))

    else:
        stack.append(int(i))

print(stack[0])


Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
int main(){
	int N;cin>>N;
	int A[N];set<int> count;
	bool flag=true;
	rep(i,0,N){
		cin>>A[i];
		count.insert(A[i]);
		if(A[i]) flag=false;
	}
	if(flag){ puts("Yes");return 0; }
	vector<int> v;
	for(int i:count) v.push_back(i);
	if(v.size()==2){
		if(v[0]){ puts("No");return 0; }
		int a=0,b=0;
		rep(i,0,N){
			if(A[i]) a++;
			else b++;
		}if(a==b*2) puts("Yes");
		else puts("No");
	}else if(v.size()==3){
		if((v[0]^v[1])!=v[2]){ puts("No");return 0; }
		int a=0,b=0,c=0;
		rep(i,0,N){
			if(A[i]==v[0]) a++;
			else if(A[i]==v[1]) b++;
			else c++;
		}if(a==b&&b==c) puts("Yes");
		else puts("No");
	}else puts("No");
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    int n;
    cin>>n;
    int arr[n];
    for (int i=0; i< n ; i++){
        arr[i]=0;
    }
    for (int i=1; i< n; i++){
        int a;
        cin>>a;
        arr[a-1]= arr[a-1]+1;
    }
    for (int i=0; i< n; i++){
        cout<< arr[i]<<endl;
    }
  
}

Measured memory_bytes: 4380
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int n;
  cin>>n;
  vector<int> a_(n);
  REP(i,n){
    int temp;
    cin>>temp;
    a_[i]=temp-i-1;
  }
  sort(ALL(a_));

  int b;
  ll ans=0;
  if(n%2){
    b=a_[n/2];
    REP(i,n) ans+=abs(a_[i]-b);
  }else{
    ll v1=0,v2=0;
    b=(a_[n/2-1]+a_[n/2])/2;
    REP(i,n) v1+=abs(a_[i]-b);
    if(b>=0) b++;
    else b--;
    REP(i,n) v2+=abs(a_[i]-b);
    ans=min(v1,v2);
  }
  cout<<ans<<endl;

  return 0;
}

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

#define ll long long
#define pb push_back
#define vi vector<int>
#define sz(a) (int((a).size()))
#define mp make_pair
#define f first
#define s second
#define pii pair<int, int>

using namespace std;

const int N = 100100;
int n;
int a[N];
int cnt;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		cnt += a[i] & 1;
	}
	
	if (n == 1) {
		cout << "YES\n";
		return 0;
	}
	
	if (cnt & 1) {
		cout << "NO\n";
	} else {
		cout << "YES\n";
	}
				
	return 0;
}

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


int main(){
    int n,m,taro = 0,hanako = 0,memo = 0;
    bool card_t[200] = {false},card_h[200] = {false};
    
    while(1){
        cin >> n;
        if(!n) break;
        
        memo = 0;taro = 0;hanako = 0;
        
        rep(i,0,200){
            card_t[i] = false;
            card_h[i] = false;
        }
        
        rep(i,0,n){
            cin >> m; 
            card_t[m-1] = true;
        }
        
        rep(i,0,2*n){
            if(!card_t[i]) card_h[i] = true;
        }
        
        while(1){
            
            rep(i,0,2*n){
                if(card_t[i] && i+1 > memo){
                    memo = i+1;
                    card_t[i] = false;
                    taro++;
                    break;
                }
                else if(i == 2*n-1){
                    memo = 0;
                }
            }
            
            if(taro == n){
                cout << n-hanako << endl << 0 << endl;
                break;
            }
            else if(hanako == n){
                cout << 0 << endl << n-taro << endl;
                break;
            }
            
            rep(i,0,2*n){
                if(card_h[i] && i+1 > memo){
                    memo = i+1;
                    card_h[i] = false;
                    hanako++;
                    break;
                }
                else if(i == 2*n-1){
                    memo = 0;
                }
            }
            
            
            if(taro == n){
                cout << n-hanako << endl << 0 << endl;
                break;
            }
            else if(hanako == n){
                cout << 0 << endl << n-taro << endl;
                break;
            }
        }
        
    }
    
    return 0;
}


Measured memory_bytes: 3056
#include<bits/stdc++.h>
#include<cstdlib>
using namespace std;
int main(){
int n;
cin>>n;
int a[n+1];
for(int i=0;i<n;i++)
{
    cin>>a[i];
}

long long int dp[n+1]={0};
dp[0]=dp[1]=0;dp[2]=abs(a[1]-a[0]);

for(int i=3;i<=n;i++)
{
    dp[i]=min((dp[i-1]+abs(a[i-1]-a[i-2])),(dp[i-2]+abs(a[i-1]-a[i-3])));
    //cout<<dp[i]<<endl;
}
cout<<dp[n]<<endl;
}

Measured memory_bytes: 4800
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
int main()
{ 
      string c,d,e;
       
      cin>>c>>d>>e;
 
      
      
        int n = c.length(); 
    char g[n + 1]; 
    strcpy(g, c.c_str()); 
    
     int m = d.length(); 
    char h[m + 1]; 
    strcpy(h, d.c_str()); 
    
    
     int o = e.length(); 
    char k[o + 1]; 
    strcpy(k, e.c_str()); 

     if((g[n-1]==h[0])&&(h[m-1]==k[0]))
        cout<<"YES";

     else  cout<<"NO";
     
   return 0;

}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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; }


int main() {
    string s;
    cin >> s;
    ll n = s.size();
    ll blu = 0, red = 0;
    rep1(i, n){
        if (s[i] == '0') red++;
        else blu++;
    }
    ll ans = 2*min(red, blu); 
    cout << ans << endl;
}

Measured memory_bytes: 3756
def inpl(): return list(map(int, input().split()))

N = int(input())
A = inpl()
B = inpl()
sumA = [0] * N
sumB = [0] * N
for i in range(N):
    if i == 0:
        sumA[0] = A[0]
        sumB[0] = B[0]
    else:
        sumA[i] = A[i] + sumA[i-1]
        sumB[i] = B[i] + sumB[i-1]

ans = 0
for i in range(N):
    tmp = sumA[i] + sumB[N-1] - sumB[i] + B[i]
    ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		int max=-1;
		for(int i=0;i<n;i++) {
			a[i]=sc.nextInt();
			max=(max<a[i])?a[i]:max;
		}
		int middle=max/2;
		int mind=Integer.MAX_VALUE;
		int minnum=-1;
		boolean ishanten=false;
		for(int i=0;i<n;i++) {
			ishanten=false;
			if(a[i]>middle) {
				a[i]=max-a[i];
				ishanten=true;
			}
			int buf=middle-a[i];
			if(buf<=mind) {
				mind=buf;
				if(ishanten) {
					a[i]=max-a[i];
				}
				if(max>a[i]) {
					minnum=a[i];
				}

			}
		}
		/*		int l=max;
		int r=mind;
		long ans=1;
		ArrayList<Integer> amari=new ArrayList<>();
		for(int i=0;i<r;i++) {
			ans*=l-i;
			if(ans%(i+1)==0) {
				ans/=(i+1);
			}else {
				amari.add(i+1);
			}
			for(int j=0;j<amari.size();j++) {
				int wari=amari.get(j);
				if(ans%wari==0) {
					ans/=wari;
					amari.remove(j);
				}
			}
		}*/
		System.out.println(max+" "+minnum);
	}
}

Measured memory_bytes: 50864
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int n = 40;
    int m = 5;
    vector<string> s(n, string(n, 'N'));
    for(int i=0; i<n; ++i){
        for(int j=0; j<m; ++j){
            if(i != j)
                s[i][j] = s[j][i] = 'Y';
        }
    }

    cout << n << endl;
    for(int i=0; i<n; ++i)
        cout << s[i] << endl;

    return 0;
}

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

using namespace std;

void swap(int *dat, int i, int j){

  int tmp = dat[i];
  dat[i] = dat[j];
  dat[j] = tmp;

}

void quicksort(int *dat, int first, int last){
  
  int p = dat[first];
  int i = first;
  int j = last;


  while(1){ 
    while( (dat[i] < p) && (i < last) ){
      i++;
    }

    while( (p < dat[j]) && (j > first) ){
      j--;
    }
 
    if(i >= j){
      break;
    }
    
    swap(dat, i, j);
    i++;
    j--;
        
  }
  

  if( first < i - 1 ){
    quicksort(dat, first, i - 1);
  }
  if(j + 1 < last){
    quicksort(dat, j + 1, last);
  }

}

void launch_quick(int *dat, int num){
  
  quicksort(dat, 0, num-1);

}

int main(){

  int N[4];

  cin >> N[0] >> N[1] >> N[2] >> N[3];

  launch_quick(N, 4);

  if(N[0] == 1){
    if(N[1] == 4){
      if(N[2] == 7){
	if(N[3] == 9){
	  cout << "YES" << "\n";
	  return 0;
	}
      }
    }
  }


  cout << "NO" << "\n";
  
  
  return 0;
}


Measured memory_bytes: 256
def main():
    n, k = map(int, input().split())
    a_list = list(map(int, input().split()))
    visited_list = [0] + [-1] * (n - 1)  # 何ワープ目で訪れたか
    path_list = [1]  # 訪れた街の順番
    city, loop, non_loop = 1, 0, 0  # 今いる街、何ワープでループするか、最初にループするまでのワープ数

    for i in range(1, n + 1):
        city = a_list[city - 1]
        if visited_list[city - 1] != -1:
            loop = i - visited_list[city - 1]
            non_loop = visited_list[city - 1]
            break
        else:
            visited_list[city - 1] = i
            path_list.append(city)

    city = 1
    if k <= non_loop:
        city = path_list[k]
    else:
        city = path_list[non_loop + (k - non_loop) % loop]

    print(city)


if __name__ == "__main__":
    main()


Measured memory_bytes: 103604
len = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)

ans = []
ans << arr.join(' ')
if len != 1
  (1..(len-1)).each do |i|
    j = i-1
    o = arr[i]
    while j >= 0 && arr[j] > o
      arr[j+1] = arr[j]
      j -= 1
    end
    arr[j+1] = o
    ans << arr.join(' ')
  end
end
puts ans.join("\n")


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

#define ln '\n'
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k;
    string s;
    cin >> k >> s;
    if (s.length() <= k)
        cout << s << ln;
    else
        cout << s.substr(0, k) + "..." << ln;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, N, a, b) for(int i = a; i < N; i += b)
typedef long long ll;

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

	if (N == 0){
		cout << X << endl;
		return 0;
	}

	vector<pair<int,int>> P(N);
	rep(i, N){
		int tmp;
		cin >> tmp;
		P.at(i).first = abs(X - tmp);
		P.at(i).second = tmp;
	}
	sort(P.begin(), P.end());
	int tmp = 0;
	rep(i, N){
		if (P.at(i).first != tmp) break ;
		// cout << P.at(i).first << ": " << P.at(i).second <<  ": " << tmp << endl;
		if (i % 2 == 0) tmp++;
	}

	// cout << tmp << endl;
	// rep(i,N) cout << P.at(i).first << ": " << P.at(i).second << endl;
	rep(i, N){
		if (P.at(i).second == X - tmp){
			cout << X + tmp << endl;
			return 0;
		}
	}
	cout << X - tmp << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <algorithm>
#include <math.h>

using namespace  std;
#define ll unsigned long long int 
#define mp make_pair
#define pb push_back

ll n,p;

bool is_prime(ll n){
	if(n<=1){
		return false;
	}
	if(n<=3){
		return true;
	}
	if(n%2==0 || n%3==0){
		return false;
	}
	for(ll i=5;i*i<=n;i++){
		if(n%i==0 || n%(i+2)==0){
			return false;
		}
	}
	return true;
}
void solve(){
	ll xx=p;
	map<ll,ll> hm;
	for(ll i=2;i*i<=p;i++){
		while(xx%i==0){
			if(hm.count(i)>0){
				hm[i]+=1;
			}
			else{
				hm[i]=1;
			}
			xx=xx/i;
		}
	}
	if(xx!=1){
		if(hm.count(xx)>0){
			hm[xx]+=1;
		}
		else{
			hm[xx]=1;
		}
	}
	ll ans=1;
	for(auto i : hm){
		if(i.second<n){
			continue;
		}
		else{
			ans=ans*pow(i.first,(i.second/n));
		}
	}
	printf("%lld\n",ans);
}
int main(){
	// ll n,p;
	scanf("%lld%lld",&n,&p);
	if(is_prime(p)){
		printf("1\n");
	}
	else{
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
//=====================COMPILER OPTIMIZATION STARTS=======================
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
//======================COMPILER OPTIMIZATION ENDS=======================

#include<bits/stdc++.h>
using namespace std;

typedef vector <int> vi;
typedef pair< int ,int > pii;
#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define MOD 1000000007
#define IMX INT_MAX
#define IMN INT_MIN
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl; 
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);


int main() 
{

  FIO;

  int N, X, T;
  int minTime = 0;
  cin >> N >> X >> T;
  while(N > 0)
  {
    N = N - X;
    minTime += T;
  }
  cout << minTime; 
return 0;
   
}

Measured memory_bytes: 3648
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    int a,b,c;cin>>a>>b>>c;
    cout<<min(b/a,c);
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<stack>
#include<vector>
using namespace std;

const int MAXN = 123456;
int N, L[MAXN], R[MAXN], is_child[MAXN], root;

void preorder_traverse(int root) {
	stack<int> st;
	for(int i=root; ; ) {
		if(i != -1) {
			printf(" %d", i);
			st.push(i);
			i = L[i];
		} else {
			if(st.empty()) break;
			i = R[st.top()];
			st.pop();
		}
	}
}

void inorder_traverse(int root) {
	stack<int> st;
	for(int i=root; ; ) {
		if(i != -1) {
			st.push(i);
			i = L[i];
		} else {
			if(st.empty()) break;
			printf(" %d", st.top());
			i = R[st.top()];
			st.pop();
		}
	}
}

void postorder_traverse(int root) {
	vector<int> list;
	stack<int> st;
	for(int i=root; ; ) {
		if(i != -1) {
			list.push_back(i);
			st.push(i);
			i = R[i];
		} else {
			if(st.empty()) break;
			i = L[st.top()];
			st.pop();
		}
	}
	
	for(int i=list.size()-1; i>=0; i--) {
		printf(" %d", list[i]);
	}
}

void postorder_traverse_2(int root) {
	stack<int> st;
	int prev = -1;
	for(int i=root; ; ) {
		if(i != -1) {
			st.push(i);
			i = L[i];
		} else {
			if(st.empty()) break;
			i = st.top();
			st.pop();
			if(R[i] == -1 || R[i] == prev) {
				printf(" %d", i);
				prev = i;
				i = -1;
			} else {
				st.push(i);
				i = R[i];
			}
		}
	}
}
 
int main() {
	#ifdef LOCAL
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	
	scanf("%d", &N);
	memset(is_child, 0, sizeof(is_child));
	for(int i=0; i<N; ++i) {
		int j;
		scanf("%d", &j);
		scanf("%d%d", &L[j], &R[j]);
		if(L[j] != -1) is_child[L[j]] = 1;
		if(R[j] != -1) is_child[R[j]] = 1;
	}
	
	for(int i=0; i<N; ++i) {
		if(!is_child[i]) {
			root = i;
			break;
		}
	}
	
	puts("Preorder");
	preorder_traverse(root);
	puts("");
	
	puts("Inorder");
	inorder_traverse(root);
	puts("");
	
	puts("Postorder");
	postorder_traverse(root);
	puts("");
	
	return 0;
}

Measured memory_bytes: 3204
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var N = cin.ReadInt;
            var K = cin.ReadInt;
            var a = cin.ReadIntArray(N).OrderByDescending( value => value ).ToArray();
            
            //Array.Sort(a); Array.Reverse(a); // Array.Sortは昇順ソートを行います
            
            var ans = 0;
            
            for (int i = 0; i < K; ++i)
            {
                ans += a[i];
                
            }
            WriteLine(ans);
            
            
        }
        
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
    
    public class Function
    {
        public int findSumOfDigits(int n) {
            int sum = 0;
            while (n > 0) { // n が 0 になるまで
            sum += n % 10;
            n /= 10;
                
            }
            return sum;
            
        }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define ll long long
#define N 300005
using namespace std;
int f[N],k,n,top;
ll g[N];
int main(){
	scanf("%d %d",&k,&n);
	if (k%2==0){
		printf("%d ",k/2);
		for (int i=2;i<=n;i++)
			printf("%d ",k);
	}
	else{
		f[1]=k&1; g[1]=k;
		for (int i=2;i<=n;i++)
			f[i]=((f[i-1]+1)*k)&1;
		for (top=2;;){
			g[top]=(g[top-1]+1)*k;
			if (g[top]>1e12) break;
			if (top>n) break;
			top++;
		}
		int move=0;
		for (int i=n;i>=top;i--){
			printf("%d ",(k+1)/2);
			if (f[i]==1&&i!=n) move++;
		}
		top=min(top-1,n);
		ll rk=(g[top]+(top!=n)+1)/2-move;
		for (int i=top;i;i--){
			if (i!=n) rk--;	
			if (!rk) return 0;
			for (int j=1;j<=k;j++)
				if (rk<=g[i-1]+1){
					printf("%d ",j);
					break;
				}
				else rk-=g[i-1]+1;
		}
	}
}


Measured memory_bytes: 4096
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
def c(a)
  ans = 0
  ans += a%10
  ans += (a/10)%10
  ans += (a/100)%10
  ans += (a/1000)%10
  ans += (a/10000)%10
  ans += (a/100000)%10
  return ans
end
ans = 1e20
n = inp[0]
(1..(n)/2).each do |d|
  a = d
  b = n - d
  ans = [c(a)+c(b),ans].min
end
p ans

Measured memory_bytes: 1788