akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

double dist(int x1, int x2, int y1, int y2) {
  int dx = x1 - x2;
  int dy = y1 - y2;
  return ((sqrt((double)(dx*dx + dy*dy))));
}

double rec(int parent, int child, vector<int> &used, vector<int> &x,
            vector<int> &y, int z) {

  double res = 0.0;
  rep(i, used.size()) {
    if (used[i] == 0) {
      used[i] = 1;
      res += rec(child, i, used, x, y, z-1);
      used[i] = 0;
    }
  }

  /*if (res == 0.0) {
    res = dist(x[parent], x[child], y[parent], y[child]);
  }*/

  int dx = x[parent] - x[child];
  int dy = y[parent] - y[child];
  //double ans = res+sqrt(dx*dx+dy*dy);
  int fact = 1;
  for (int i = 1; i <= z; i++) fact *= i;

  double ans = res + (double)fact * dist(x[parent], x[child], y[parent], y[child]);

  return ans;
}

int main() {
  int N; cin >> N;
  vector<int> x(N), y(N);
  vector<int> used(N, 0);

  rep(i, N) {
    cin >> x[i] >> y[i];
  }

  double ans = 0.0;
  rep(i, N) {
    used[i] = 1;

    rep(j, N) {
      if (used[j] == 0) {
        used[j] = 1;
        ans += rec(i, j, used, x, y, N-2);
        used[j] = 0;
      }
    }

    used[i] = 0;
  }

  int nn = 1;
  for (int i = 1; i <= N; i++) nn *= i;

  ans = ans / (double)nn;

  printf("%.10f\n", ans);

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>

using namespace std;

int main(){
   int n;
   cin>>n;
   int l[12];
   int sum=0;
   for(int i=0;i<n;i++){
      cin>>l[i];
      sum += l[i];
   }
   sort(l,l+n);
   if(l[n-1]<sum-l[n-1])cout<<"Yes"<<endl;
   else cout<<"No"<<endl;

   
}

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

int main(){
    int N = 0;
    int Alice = 0;
    int Bob = 0;
    cin >> N;
    int As[110] = {0};

    for(int i = 0; i < N; i++) cin >> As[i];
    sort(As,As + N, greater<int>());

    for(int i = 0; i < N; i++){
        if((i+1) % 2 == 1){
            Alice += As[i];
        } else {
            Bob += As[i];
        }
    }

    cout << Alice - Bob << endl;

}

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

int main()
{
    string S,T;
    cin>>S>>T;
//    This following loop is used to shuffle the string
//    By inserting the last char of the string into the front of the string
//    Then erasing the last char again
    for(int i=0;i<S.length();i++){
        if(S==T){cout<<"Yes"<<endl; return 0;}
        stringstream ss;
        string temp;
        ss<<S[S.length()-1];
        ss>>temp;
        S.insert(0,temp);
        S.erase(S.length()-1,1);
    }
    cout<<"No"<<endl;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

bool check(int r, int c, vector<string>& strs, int n) { // O(n*3)
    for(int i = 0; i < n; i++) {
        for(int j = i+1; j < n; j++) {
            if (strs[r+i][c+j] != strs[r+j][c+i])
                return false;
        }
    }
    return true;
}
int main() {
    int n, ans = 0;
    cin >> n;
    vector<string> strs;
    string s;
    for(int i = 0; i < n; i++) {
        cin >> s;
        strs.push_back(s+s);
    }
    for(int i = 0; i < n; i++) {
        if (check(0, i, strs, n)) {
            ans += n;
        }
    }
    cout << ans << endl;
    return 0;
}




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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextInt();
  int K = nextInt();

  vector<int> H(N);
  REP(i, N) H[i] = nextInt();
  sort(ALL(H));
  ll ans = 0;
  for (int i = 0; i < N - K; i++) {
    ans += H[i];
  }
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

static int
gcd (
  const int a,
  const int b
  )
{
  if ( a == 0 ) return ( b );

  return
  gcd ( b % a, a );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int a, b;

  scanf ( "%d%d", &a, &b );
  printf ( "%d\n", gcd ( a, b ) );

  return ( 0 );
}

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

int main(){
  int N,M;cin>>N>>M;
  int sum[N][2];//0WA1AC
  rep(i,N)rep(j,2)sum[i][j]=0;
  ll ac=0,wa=0;
  rep(i,M){
    int p;string s;cin>>p>>s;p--;
    if(sum[p][1]>0) continue;
    if(s=="WA") sum[p][0]++;
    else{
      sum[p][1]=1;
      ac++;
      wa+=sum[p][0];
    }
  }  
  cout<<ac<<" "<<wa<<endl;
}

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

int main(){
	int b, r, g, c, s, t;
	int num;
	while(cin >> b  >> r >> g >> c >> s >> t, b || r || g || c || s || t){
		num = 100;
		num -= t*3;
		num += (b*5+r*3);
		num += (b*5+r*3) * 15;
		num += g*7;
		num += c*2;
		num += (b+r)*15;
		num += s*3;

		cout << num << endl;
	}
}

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

using namespace std;

#define f(i, n) for(int i = 1; i <= n; i++)

const int N = 1005;
const int M = 100005;

long long dp[N][M];

int main (){

  int n, g, *v, *w;

  cin >> n >> g;

  v = new int[n + 1];
  w = new int[n + 1];
  f(i, n)
    cin >> w[i] >> v[i];

  for (int i = 1; i <= n; i++ )
    for ( int j = 0; j <= g; j++ )
      if (j >= w[i] )
        dp[i][j] = max( dp[i - 1][j], (long long)v[i] + dp [i - 1][j - w[i]]);
      else dp[i][j] = dp[i - 1][j];


  cout << dp[n][g] << '\n';

  delete( v );
  delete( w );

  return 0;
}


Measured memory_bytes: 79360
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;

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

string solve(string cipher)
{
  for ( ; ; ) {
    for (int a = 1; ; ++a) {
      if (gcd(a, 26) != 1)
	continue;
      bool decrypt = false;
      for (int b = 0; b < 26; ++b) {
	string plain = cipher;
	for (unsigned int i = 0; i < plain.size(); ++i) {
	  if (isalpha(plain[i]))
	    plain[i] = ('a' + ((a * (plain[i]-'a') + b) % 26));
	}
	if (plain.find("that") != string::npos || plain.find("this") != string::npos)
	  return plain;
      }
    }
  }
}

int main()
{
  int n;
  cin >> n;
  string cipher;
  getline(cin, cipher);
  for (int i = 0; i < n; ++i) {
    getline(cin, cipher);
    if (cipher.find_first_of("\n") != string::npos)
      cipher.erase(cipher.end()-1);
    if (cipher.find_first_of("\r") != string::npos)
      cipher.erase(cipher.end()-1);
    cout << solve(cipher) << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    
    string s;
    cin >> s;
    if(sz(s) == 2)P(s);
    else{
	reverse(s.begin(),s.end());
	P(s);
    }
    return  0;
}


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

using namespace std;
#define ll long long
const int N = 2e5 + 5;
int pref[N], suf[N];
vector<int> pos;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k, c;
    cin >> n >> k >> c;
//    n = 1e5, k = 1e4, c = 2;
    string s;
    cin >> s;
    s = 'x' + s;
    pos.push_back(-1e9);
    for (int i = 1; i <= n; i++) {
        if (s[i] == 'o')pos.push_back(i);
        pref[i] = pref[i - 1];
        if (s[i] == 'o') {
            int indx = 0;
            auto it = lower_bound(pos.begin(), pos.end(), i - c);
            it--;
            indx = max(0, *it);
            pref[i] = max(pref[i], pref[indx] + 1);
        }
    }
    pos.push_back(1e9);
    for (int i = n; i >= 1; i--) {
        suf[i] = suf[i + 1];
        if (s[i] == 'o') {
            int indx = 0;
            auto it = upper_bound(pos.begin(), pos.end(), i + c);
            indx = min(n + 1, *it);
            suf[i] = max(suf[i], suf[indx] + 1);
        }
    }
//    for (int i = 1; i <= n; i++)
//        cout << pref[i] << " " << suf[i] << endl;
//    return 0;
    priority_queue<pair<int, pair<int, int>>> pq;
    pq.push({0, {n + 1, 0}});
    for (int i = 1; i <= n; i++) {
        if (s[i] == 'x') continue;
        while (pq.top().second.first <= i) {
            int x = pq.top().second.first;
            auto it = upper_bound(pos.begin(), pos.end(), x);
            int indx = pq.top().second.second;
            pq.pop();
            pq.push({pref[indx] + suf[min(n + 1, *it)], {*it, indx}});
        }
        int tmp = pq.top().first;
        tmp = max(tmp, suf[i + 1]);
        tmp = max(tmp, pref[i - 1]);
        if (tmp < k) cout << i << '\n';
        int indx = 0;
        auto it = upper_bound(pos.begin(), pos.end(), i + c);
        indx = min(n + 1, *it);
        pq.push({pref[i] + suf[indx], {indx, i}});
    }

    return 0;
}

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

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

//fill(score, score+202020, 0);
#define NN 202020

int main(){
  ll n;
  cin >> n;
  ll S[n];
  ll a;
  for (int i=0;i<n;i++){
    cin >> a;
    if (i==0) S[i] = a;
    else S[i] = S[i-1] + a;
    //cout << S[i] << " ";
  }
  //cout << endl;

  ll small = 0;
  ll sdif;
  ll large = 2;
  ll ldif;
  ll ans = INF;
  ll _ans;
  ll mine, maxe;
  vector<ll> com(4);
  for (int i=1;i<=n-3;i++){
    sdif = abs(S[i] - 2*S[small]);
    while (sdif > abs(S[i] - 2*S[small+1])){
      small += 1;
      sdif = abs(S[i] - 2*S[small]);
    }
    ldif = abs(S[n-1] - 2*S[large] + S[i]);
    while (ldif > abs(S[n-1] - 2*S[large+1] + S[i])){
      large += 1;
      ldif = abs(S[n-1] - 2*S[large] + S[i]);
    }
    //cout << i << " " << small << " " << large << endl;
    com[0] = S[small];
    com[1] = S[i] - S[small];
    com[2] = S[large] - S[i];
    com[3] = S[n-1] - S[large];
    //for (int i=0;i<com.size();i++) cout << com[i] << " ";
    maxe = distance(com.begin(), max_element(com.begin(), com.end()));
    mine = distance(com.begin(), min_element(com.begin(), com.end()));
    _ans = com[maxe] - com[mine];
    //cout << _ans << endl;
    if (ans > _ans) ans = _ans;
  }

  cout << ans << endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner (System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();

		if (a < b && b < c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

using namespace std;


int main()
{



	IOS;
   
    ll a,b,c,k;

    cin>>a>>b>>c>>k;

   if(k<a)
   {
   	  cout<<k<<endl;
   }



    else if( k <= a+b)
    {
    	cout<< a<<endl;
    }


    else
    {
    	cout<< a - ((k-(a+b)))<<endl;
    }

   
    


}

Measured memory_bytes: 3652
//#define NDEBUG

#include <bits/stdc++.h>
#include <bits/extc++.h>

#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define pf(a) push_front(a)
#define pob pop_back()
#define pof pop_front()
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define mt make_tuple
#define gt(t, i) get<i>(t)
#define iceil(a, b) ((a + b - 1) / b)
#define tomax(a, b) (a = max(a, b))
#define printv(a, b) {bool pvaspace=false; \
for(auto pva : a){ \
    if(pvaspace) b << " "; pvaspace=true;\
    b << pva;\
}\
b << "\n";}

//#define TEST

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
using tiii = tuple<int, int, int>;

const ll MOD = 1000000007;
const ll MAX = 2147483647;

template<typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> p){
    return o << '(' << p.F << ',' << p.S << ')';
}

int main(){
    StarBurstStream

    int n;
    cin >> n;
    map<ll, ll> cnt;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        ll a;
        cin >> a;
        ans += a;
        cnt[a]++;
    }

    int q;
    cin >> q;
    while(q--){
        ll b, c;
        cin >> b >> c;
        ans -= cnt[b] * b;
        ans += cnt[b] * c;
        cnt[c] += cnt[b];
        cnt[b] = 0;
        cout << ans << "\n";
    }


    return 0;
}

Measured memory_bytes: 9472
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	for {
		if sc.Scan() == false {
			break
		}
		str := sc.Text()
		cols := strings.Split(str, " ")
		n, _ := strconv.Atoi(cols[0])
		m, _ := strconv.Atoi(cols[1])
		var gcd int
		if n > m {
			gcd = getGcd(n, m)
		} else {
			gcd = getGcd(m, n)
		}
		fmt.Println(gcd)
	}
}

func getGcd(n int, m int) int {
	var mod int
	nn := n
	mm := m
	for {
		mod = nn % mm
		if mod == 0 {
			break
		}
		nn = mm
		mm = mod
	}
	return mm
}



Measured memory_bytes: 1088
#include<stdio.h>

int binarySearch(int[],int,int);

int main(){
  int i,n,q,key,count=0,s[100000];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
  }

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(binarySearch(s,n,key)!=0)count++;
  }

  printf("%d\n",count);

  return 0;
}

int binarySearch(int a[],int x,int y){
  int l=0,r=x,m;

  while(l<r){
    m = (l+r)/2;
    if(a[m]==y) return 1;
    if(a[m]>y) r=m;
    else if(a[m]<y) l=m+1;
  }
  return 0;
}



Measured memory_bytes: 2156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
	string S;
	cin >> S;

	string A_str = S.substr(0, 2);
	string B_str = S.substr(2, 2);

	int A_num = stoi(A_str);
	int B_num = stoi(B_str);

	if (1 <= A_num && A_num <= 12)
	{
		

		if (1 <= B_num && B_num <= 12)
		{
			cout << "AMBIGUOUS" << endl;
		}else{
			cout << "MMYY" << endl;
		}


	}else{
		

		if (1 <= B_num && B_num <= 12)
		{
			cout << "YYMM" << endl;
		}else{
			cout << "NA" << endl;
		}


	}
}

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


void solve(long long N, std::vector<std::string> s, std::vector<long long> t, std::string X){
    int ans = 0;
    bool f = false;
    for(int i = 0;i < N;i++){
        if(f){
            ans += t[i];
        }
        if(s[i] == X){
            f = true;
        }
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> s(N);
    std::vector<long long> t(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> s[i];
        scanf("%lld",&t[i]);
    }
    std::string X;
    std::cin >> X;
    solve(N, std::move(s), std::move(t), X);
    return 0;
}


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

using namespace std;

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

    vector<int> v(n), c(n);
    for(int i=0; i<n; i++){
        cin >> v[i];
    }
    for(int i=0; i<n; i++){
        cin >> c[i];
    }

    int ans=0;
    for(int i=0; i<n; i++){
        if(v[i]-c[i]>0){
            ans += v[i]-c[i];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt(), b = sc.nextInt();
    if (a < b)      System.out.println("a < b");
    else if (a > b) System.out.println("a > b");
    else            System.out.println("a == b");
  }
}

Measured memory_bytes: 26136
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define mx 1000002
mt19937 myrand(time(0));

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(),cout.tie();
    ll n;
    cin>>n;
    ll a[n];
    ll Xor=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        Xor^=a[i];
    }
    for(int i=0;i<n;i++){
        cout<<(Xor^a[i])<<" ";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 5148
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
int n,a[300000];
int main(){
	scanf("%d",&n);
	fo(i,1,n) scanf("%d",&a[i]);
	for(int i=n;i>0;i-=2) printf("%d ",a[i]);//i
	for(int i=(n&1)?2:1;i<=n;i+=2) printf("%d ",a[i]);
	return 0;
}

Measured memory_bytes: 2816
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  s=S()
  t=S()

  lns=len(s)
  lnt=len(t)

  dp=[[0 for _ in range(lns+1)]for _ in range(lnt+1)]
  for i in range(lnt):
    for j in range(lns):
      if t[i]==s[j]:
        dp[i+1][j+1]=dp[i][j]+1
      else:
        dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j])

  ans=''
  i=lnt
  j=lns
  while dp[i][j]!=0:
    if dp[i][j]==dp[i-1][j]:
      i-=1
    elif dp[i][j]==dp[i][j-1]:
      j-=1
    elif dp[i][j]==dp[i-1][j-1]:
      i-=1
      j-=1
    elif dp[i][j]==dp[i-1][j-1]+1:
      ans=t[i-1]+ans
      i-=1
      j-=1

  return ans

# main()
print(main())


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

int power(int a, int x) {
  int ans = 1;
  for(int i = 0; i < x; i++) {
    ans *= a;
  }
  return ans;
}

int main() {
  int N1, N2, sum;
  cin >> N1;
  N2 = N1;
  
  for (int i = 8; i >= 0; i--) {
    sum += N1 / power(10, i);
    N1 -= N1 / power(10, i) * power(10, i);
  }
  if (N2 % sum == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(),x.end()
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) //fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=1e5+50;

ll n,L,T,o;
vector<ll> p;

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	read(n),read(L),read(T); 
	lop(i,0,n){
		ll x,w; 
		read(x),read(w); 
		if(w==1)x+=T,o+=x/L,p.pb(x%L);
		else{
			x-=T,o+=x/L,x%=L;
			if(x<0)x+=L,--o;
			p.pb(x);
		}
	}
	o=(o%n+n)%n;
	sort(all(p)); 
	lop(i,0,n)printf("%lld\n",p[(i+o)%n]);
	return 0;
}

Measured memory_bytes: 2164
v,e,r = map(int,input().split())
E = [tuple(map(int,input().split())) for one in range(e)]
D = [10**9 for two in range(v)]
D[r] = 0
for i in range(v):
    update = 0
    for s,t,d in E:
        if D[t]>D[s]+d:
            D[t] = D[s]+d
            update +=1
    if update == 0:
        break

for j in range(v):
    print(D[j] if D[j] != 10**9 else "INF")


Measured memory_bytes: 94836
n=int(input())
d=list(map(int,input().split()))
mod=998244353
from collections import Counter
dd=Counter(d)
if not(d[0]==0 and sorted(d)[1]!=0):print(0);exit()
d.sort()
a=1
for i in range(1,d[-1]+1):
  if dd[i]==0:a*=0
  else:a*=dd[i-1]**dd[i]
  a%=mod
print(a)

Measured memory_bytes: 19808
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

	vector<int> sis(100000);

	vector<vector<pair<int,int> > > arr(100001);
	//for(int i = 1; i <= 100000; i++) arr[i] = vector<pair<int,int> >();
	for(int i = 0; i < m; i++) {
		int p,y;
		cin >> p >> y;
		arr[p].push_back(pair<int,int>(y,i));
		sis[i] = p;
	}

	for(int i = 1; i <= 100000; i++) {
		sort(arr[i].begin(),arr[i].end());
	}

	vector<pair<int,int> > arr2;
	for(int i = 1; i <= 100000; i++) {
		for(int j = 1; j <= arr[i].size(); j++) {
			//cout << arr[i][j-1].first << "," << arr[i][j-1].second << endl;
			arr2.push_back(pair<int,int>(arr[i][j-1].second,j));
		}
	}

	sort(arr2.begin(),arr2.end());

	for(int i = 0; i < arr2.size(); i++) {
		printf("%06d",sis[i]);
		printf("%06d",arr2[i].second);
		printf("\n");
	}

	return 0;
}


Measured memory_bytes: 8308
#include <stdio.h>


int main(void) {

	// 1_2-A Small,Large, or Equal
	int a,b;
	scanf("%d %d",&a,&b);
	
	// ??????
	if(a<b){
		printf("a < b\n");
	}else if(a>b){
		printf("a > b\n");
	}else{
		printf("a == b\n");
	}

        return 0;
}

Measured memory_bytes: 580
#include <iostream>
using namespace std;
 
int main() {
	string s;
	cin>>s;
	if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	// your code goes here
	return 0;
}

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

using namespace std;

int T, A, B, C, D, k;

bool check(int x) {
	int a = A - x, b = x == 0 ? 0 : B - (x - 1) / k;
	return b <= (long long)(a + 1) * k;
}

int main() {
	scanf("%d", &T);
	while (T--) {
		scanf("%d %d %d %d", &A, &B, &C, &D), k = ceil(1.0 * max(A, B) / (min(A, B) + 1));
		int l = 0, r = A;
		while (l + 1 < r) {
			int mid = (l + r) / 2;
			if (check(mid)) l = mid; else r = mid - 1;
		}
		
		if (check(r)) l = r; 
		
		int a = A - l, b = B - (l - 1) / k;
		l = l + (l - 1) / k, r = l + b - (long long)a * k + 1;
		
		for (int i = C; i <= min(l, D); i++) 
			if (i % (k + 1) == 0) printf("B"); else printf("A");
		for (int i = max(C, l + 1); i <= D; i++)
			if ((i - r) % (k + 1) == 0) printf("A"); else printf("B");
			
		puts("");
	}
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
#define SELECTOR(_1, _2, _3, SELECT, ...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__, _rep1, _rep0)(__VA_ARGS__)
#define _rep0(i, n) for (ll i = 0; i < n; ++i)
#define _rep1(i, k, n) for (ll i = k; i < n; ++i)

void solve() {
  // input
  ll n,m; cin>>n>>m;
  vector<vector<int>> E(n);
  rep(_,m) {
    ll a,b; cin>>a>>b;
    --a; --b; // 0-indexed
    E.at(a).push_back(b);
  }

  function<vector<ll>(ll)> bfs=[&](ll sv){
    vector<ll> prev(n,-1); // also as visited
    ll last=-1;
    queue<ll> q;
    q.push(sv);
    while(!q.empty()) {
      ll v=q.front(); q.pop();
      for(ll nv:E.at(v)) {
        if(nv==sv) { // loop detected
          last=v;
          break;
        } else if(prev.at(nv)==-1) { // unvisited
          prev.at(nv)=v;
          q.push(nv);
        }
      }
    }
    // return loop
    if(last!=-1) {
      vector<ll> loop;
      while(last!=-1) {
        loop.push_back(last);
        last=prev.at(last);
      }
      reverse(loop.begin(),loop.end());
      return loop;
    } else return vector<ll>(n+1);
  };
  // shortest loop
  vector<ll> ans(n+1);
  rep(v,n) {
    vector<ll> now=bfs(v);
    if(now.size()<ans.size()) ans=now;
  }
  // output
  if(ans.size()==n+1) cout<<-1<<"\n";
  else {
    cout<<ans.size()<<"\n";
    for(ll v:ans) cout<<v+1<<"\n"; // 1-indexed
  }

}

int main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[6][1010];//動的計画法
int prime[10000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
int main(){
   int n,no;
   int item[10][7]={{0,1,1,1,1,1,1},
    {0,0,0,0,1,1,0},
    {1,0,1,1,0,1,1},
    {1,0,0,1,1,1,1},
    {1,1,0,0,1,1,0},
    {1,1,0,1,1,0,1},
    {1,1,1,1,1,0,1},
    {0,1,0,0,1,1,1},
    {1,1,1,1,1,1,1},
    {1,1,0,1,1,1,1}};
   while(cin>>n){
       if(n==-1) break;
       int be[]={0,0,0,0,0,0,0};
       for(int i=0;i<n;i++){
          cin>>no;
          for(int j=0;j<7;j++){
              int tmp=be[j]^item[no][j];
              cout<<tmp;
              be[j]=item[no][j];
          }
          cout<<endl;
       }
   }
    return 0;
}


Measured memory_bytes: 5352
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <tuple>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main(void){
  int N;
  cin >> N;
  int A[N];
  long long ans = 0;
  int cur = 1;
  REP(i, N) cin >> A[i];

  for(int i=0;i<N;i++){
    if(A[i] == cur){
      cur++;
      continue;
    }
    ans += (A[i]-1)/cur;
    if(cur == 1) cur++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
while True:
    ch = list(map(int,input().split()))
    if (0 in ch):
        break
    ch.sort()
    n = int(input())
    a = ch[0]
    b = ch[1]
    d = a**2 + b**2
    for i in range(n):
        r = int(input())
        R = 2*r
        if (R**2 > d):
            print('OK')
        else:
            print('NA')


Measured memory_bytes: 5596
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    string s; cin >> s;

    string ans = "";
    rep(i, s.size()) {
        if (i % 2 == 0) ans += s[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 888
n, k = map(int, input().split())
p = list(map(int, input().split()))
e = []
m = 0
arr = []
ans = 0
for i in range(n):
  m += (p[i] + 1) / 2
  e.append(m)
arr.append(e[k - 1])
for i in range(n - k):
  arr.append(e[i + k] - e[i])
ans = max(arr)
print(ans)

Measured memory_bytes: 31716
#include<stdio.h>
int main()
{
    int a,b,i;
    scanf("%d %d",&a,&b);

    if(a>=b)
    {
        for(i=0; i<a; i++)
            printf("%d",b);
    }
    else
    {
        for(i=0; i<b; i++)
            printf("%d",a);
    }
    printf("\n");
}


Measured memory_bytes: 1716
#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<n;i++)

int main(){
  int n;
  cin >> n;
  vector<int> l(n);
  vector<int> r(n);

  rep(i,n) cin >> l.at(i) >> r.at(i);

  int ans=0;

  rep(i,n) ans += 1 + r[i] - l[i];

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

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

int main() {
	int t; cin >> t;
	vector<int> v(t);
	int temp = -9999;
	for(int i = 0; i < t; i++){
		cin >> v[i];
	}

	for(int i = 0; i < t; i++){
		if(temp <= v[i] - 1)
			temp = v[i] -1;
		else if(temp <= v[i])
			temp = v[i];
		else{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 764
ln = input()
n, cap = ln.split()
n = int(n)
cap = int(cap)

'''
weights = [[0 for x in range(2)] for y in range(n)] 
values = [[0 for x in range(2)] for y in range(n)] 
mat = [[0 for x in range(2)] for y in range(1000000)] 
'''
weights = [0 for x in range(n)] 
values =  [0 for x in range(n)] 
mat =  [0 for x in range(1000000)] 

for i in range(n):
    ln = input()
    ln = ln.split()
    weights[i] = int(ln[0])
    values[i] = int(ln[1])
 
for i in range(n):
    for j in range(cap,weights[i]-1,-1):
        '''
        print(j)
        print(values[i])
        print(mat[j-weights[i]])
        '''
        mat[j] = max(mat[j], mat[j-weights[i]] + values[i])
 
        
print(mat[cap])

Measured memory_bytes: 114288
N = int(input())
h = list(map(int, input().split()))

dp = [0] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
  dp[i] = min(abs(h[i] - h[i-2]) + dp[i-2], abs(h[i] - h[i-1]) + dp[i-1])

print(dp[N-1])


Measured memory_bytes: 13980
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <iomanip>
#include <math.h>
using namespace std;
typedef long long ll;
 
ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    ll r = a % b;
    while (r != 0) {
        a = b;  b = r;
        r = a % b;
    }
    return b;
}

int main() {
    ll a, b;
    cin >> a >> b;
    cout << a / gcd(a, b) * b << endl;
}

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

int main() {
  int k;
  string s;
  cin >> k;
  cin >> s;
  if ((int)s.size() < k + 1) {
    cout << s << endl;
  } else {
    cout << s.substr(0, k) << "..." << endl;
  }

  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y,r;
  scanf("%d %d",&x,&y);

  while(x % y != 0){
    r = x % y;
    x = y;
    y = r;
  }

  cout << y << endl;

  return 0;
}

Measured memory_bytes: 3084
// D - Prediction and Restriction
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N,K; cin>>N>>K;
	int R,S,P; cin>>R>>S>>P;
	string T; cin>>T;
	string TT = T;
	int ans = 0;
	rp(i, 0, T.size())
		if(T[i] == 'r'){TT[i] = 'p';ans += P;}
		else if(T[i] == 's'){TT[i] = 'r';ans += R;}
		else {TT[i] = 's';ans += S;}//p

	rp(i, K, T.size()){
		if(TT[i-K] == TT[i]){
			if(TT[i] == 'r') ans -= R;
			else if(TT[i] == 's') ans -= S;
			else ans -= P;//p

			TT[i] = T[i];
			if(i+K>=T.size()) continue;

			if(TT[i] == TT[i+K])
				if(TT[i] == 'r') TT[i] = 's';
				else if(TT[i] == 's') TT[i] = 'p';
				else TT[i] = 'r';//p
		}
	}
	cout<< ans <<endl;
}

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

int main(){
int n;
  cin >> n;
int N=3*n;  
  int a[N];
for(int i=0;i<N;i++){
 cin >> a[i];
}
sort(a,a+N);
long long sum=0;
  for(int i=n;i<3*n;i+=2){
   sum+=a[i];
 }
  cout << sum << endl;
  
}


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

using namespace std;

bool comp(const pair<long long, long long> &lh, pair<long long, long long>& rh);

int main()
{
	int n;
	cin >> n;
	vector<pair<long long, long long>> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
		if (n % 2 == 0) {
			a[i].first *= 2;
			a[i].second *= 2;
		}
	}

	sort(a.begin(), a.end());
	pair<long long, long long> mn1, mn2;
	if (n % 2 == 1) {
		mn1 = a[n / 2];
	} else {
		mn1.first = (a[n / 2 - 1].first + a[n / 2].first) / 2;
		mn1.second = (a[n / 2 - 1].second + a[n / 2].second) / 2;
	}

	sort(a.begin(), a.end(), comp);
	if (n % 2 == 1) {
		mn2 = a[n / 2];
	} else {
		mn2.first = (a[n / 2 - 1].first + a[n / 2].first) / 2;
		mn2.second = (a[n / 2 - 1].second + a[n / 2].second) / 2;
	}

	long long ans;
	if (n % 2 == 1) {
		if (mn1.second < mn2.first) {
			ans = mn2.second - mn2.first + mn1.second - mn1.first + 2;
		} else {
			ans = mn2.second - mn1.first + 1;
		}
	} else {
		if (mn1.second < mn2.first) {
			ans = mn2.second - mn2.first + mn1.second - mn1.first + 2;
		} else {
			ans = mn2.second - mn1.first + 1;
		}
	}
	cout << ans << endl;

	return 0;
}

bool comp(const pair<long long, long long> &lh, pair<long long, long long>& rh)
{
	return lh.second < rh.second;
}

Measured memory_bytes: 6428
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define COUTDOUBLE(d,i) cout << setprecision((i)) << (d) << endl;
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
#define MREP(i,m) for(auto i=(m).begin(); i != (m).end(); ++i) // auto key = i->first;auto value = i->second;

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;
I MAX = LONG_MAX;
I MIN = LONG_MIN;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
I lcm(I a, I b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

I nCr[2006][2006];

int main(){
  int64_t n, k;
  cin >> n >> k;
  int64_t r = n - k;

  nCr[0][0] = 1;
  for(int i = 1; i<2006; i++){
    nCr[i][0] = 1;
    for(int j = 1; j<2006; j++){
      nCr[i][j] = nCr[i-1][j-1] + nCr[i-1][j];
      nCr[i][j] %= MOD;
    }
  }
  REP(i,k){
    int64_t t=0;
    t = nCr[k-1][i] * nCr[r+1][r-i];
    cout << t % MOD << endl;
  }

  /*
  REP(i,k){
    if (i==0){
      cout << r+1 << endl;
    }else{
      int64_t j = r - i;
      if (j < 0 || i >= k){
        cout << 0 << endl;
        continue;
        //break;
      }
      unsigned long long c=1;
      unsigned long long cc=0;
      REP(l,i){ // (k-1)C(i+1-1)
        c *= (k -1 - l);
        if ( c / MOD != 0){
          cc += c / MOD;
          c %= MOD;
        }
      }
      REP(l,i){ // (k-1)C(i+1-1)
        while ( c < MOD && cc > 0 && c % (l+1) != 0){
          c += MOD;
          cc--;
        }
        cc += (c / (l+1)) / MOD;
        c = (c / (l+1)) % MOD;
      }
      unsigned long long t=1;
      unsigned long long tt=0;
      int64_t ccc = i+1;
      ccc = min(r-i,ccc);
      REP(l,ccc){ // (r+1)C(r-i-1+1)
        t *= (r + 1 - l);
        if ( t / MOD != 0){
          tt += t / MOD;
          t %= MOD;
        }
      }
      REP(l,ccc){ // (k-1)C(i+1-1)
        while ( t < MOD && tt > 0 && t % (l+1) != 0){
          t += MOD;
          tt--;
        }
        tt += (t / (l+1)) / MOD;
        t = (t / (l+1)) % MOD;
      }
      //cout << "c:" << c << ",t:" << t << endl;
      cout << (t % MOD) * (c % MOD) % MOD << endl;
    }
  }
  */
  return 0;
}



Measured memory_bytes: 31616
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

# 遅延評価で加えてあげるだけ

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

answer = ' '.join(map(str,value[1:]))
print(answer)


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll big = 1000000007;
const ll mod = 998244353;

ll n,m,k,T;

ll gcd(ll i, ll j){
    if(j == 0)return i;
    return gcd(j,i%j);
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("autput.txt","w",stdout);
    ll a,b,c,d;
    cin >> T;
    while(T--){
        cin >> a >> b >> c >> d;
        if(a < b){
            cout << "No\n";
            continue;
        }
        if(d < b){
            cout << "No\n";
            continue;
        }
        if(c+1 >= b){
            cout << "Yes\n";
            continue;
        }
        ll g = gcd(b,d);
        k = (b-a%b-1)/g;
        if(a%b+k*g > c){
            cout << "No\n";
        }
        else{
            cout << "Yes\n";
        }
    }
    return 0;
}


Measured memory_bytes: 256
gcd3 :: Integral a => a -> a -> a -> a
gcd3 a b c = gcd a $ gcd b c


compute :: Integral a => a -> a
compute k = sum [gcd3 a b c | a <- [1 .. k], b <- [1 .. k], c <- [1 .. k]]


main :: IO ()
main = do
    k <- readLn :: IO Int
    print $ compute k

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

int main(int argc, char const *argv[])
{
	string s,t;
	cin>>s>>t;
	int ans=0;
	for (int i = 0; i < 3; ++i)
	{
		if (s.at(i)==t.at(i))
		{
			++ans;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define all(v) v.begin(),v.end_()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define strep(it,v) for(it=v.begin();it!=v.end_();++it)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a);  a = (a * a);  b/=2;  }  return res; }
#define rs resize
long long readLI(){  register char c;  for(c = getchar(); !(c>='0' && c<='9'); c = getchar());  register long long a=c-'0';
    for(c = getchar(); c>='0' && c<='9'; c = getchar())
        a = (a<<3)+(a<<1)+c-'0';
    return a;
}
const ll N = 1000011;
ll i,n,ans = LLONG_MIN,a[N],f[N];
int main()
{
   std::ios_base::sync_with_stdio(false); cin.tie(NULL);
   cin>>n;
   rep(i,0,n) cin>>a[i],f[a[i]]++;
   rep(i,0,n) ans = max(ans,f[a[i]] + f[a[i] - 1] + f[a[i] + 1]);
   cout<<ans;
   return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl "\n"
#define ll long long
#define oo 0x3f3f3f3fLL
#define sz(s) (int)(s.size())
#define RT(s) return cout<<s,0
#define INF 0x3f3f3f3f3f3f3f3fLL
#define all(v) v.begin(),v.end()
#define watch(x) cout<<(#x)<<" = "<<x<<endl
const int dr[] { -1, -1, 0, 1, 1, 1, 0, -1 };
const int dc[] { 0, 1, 1, 1, 0, -1, -1, -1 };
#if __cplusplus >= 201402L
template<typename T>
vector<T> create(size_t n) {
	return vector<T>(n);
}
template<typename T, typename ... Args>
auto create(size_t n, Args ... args) {
	return vector<decltype(create<T>(args...))>(n, create<T>(args...));
}
#endif
void run() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#else
#endif
}

int main() {
	//run();
	string s;
	cin >> s;
	set<char> st(all(s));
	if (st.size() > 1)
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void Constraints(double r)
{
  if(0.0<r&&r<10000.0){}
  else
  {
    printf("条件を満たす入力をしてください。\n");
    exit(0);
  }
}


int main(void)
{
  double r=0.0;
  double area=0.0;
  double length=0.0;
  scanf("%lf",&r);
  Constraints(r);
  area = M_PI * r * r;
  length =2 * M_PI * r; //M_PI:Π(3.14...)
  printf("%.8f %.8f\n",area,length);
  return 0;
}



Measured memory_bytes: 2104
import java.util.Scanner;
public class Main {
	 public static void main(String args[]){
		 Scanner std = new Scanner(System.in);
		 int p = std.nextInt();
		 int q = std.nextInt();
		 int r = std.nextInt();
		 if(p<=q&&r<=q) {
			 System.out.println(p+r);
		 }
		 else if(q<=p&&r<=p) {
			 System.out.println(q+r);
		 }
		 else if(q<=r&&p<=r) {
			 System.out.println(q+p);
		 }
	 }
}


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

using LL = long long;
using ULL = unsigned long long;

using namespace std;

int main()
{
    string str1, str2, str3;
    cin >> str1 >> str2 >> str3;
    cout << str1[0] << str2[1] << str3[2] << endl;

    return 0;
}

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

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

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

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

}

Cube C[100]; int n;

bool check(){
    for (int i = 0; i < n-1; i++)
        for (int j = i+1; j < n; j++) if (equal(C[i], C[j])) return false;
    return true;
}

int main(){
    cin >> n;

    for (int j = 0; j < n; j++)
        for (int i = 0; i < 6; i++) cin >> C[j].f[i];


    if (check()) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 3120
n,q = map(int,input().split())
s = input()
table = [0]*n
temp = s[0]
for i in range(1,n):
  table[i] = table[i-1]
  if temp=='A' and s[i]=='C':
    table[i]+=1
  temp = s[i]
for _ in range(q):
  l,r = map(int,input().split())
  print(table[r-1]-table[l-1])

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

int main(){
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    if(w/2 == x && h/2 == y){
        printf("%.9lf 1", h*w/2);
    }else{
        printf("%.9lf 0", h*w/2);
    }
    return 0;
}

Measured memory_bytes: 256