akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<utility>
#include<stack>
#define LL long long
#define SC(x) scanf("%lld",&x)
#define SCC(x,y) scanf("%lld%lld",&x,&y)
#define SCCC(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define FF(i,a,b) for(long long i=a; i<=b; i++)
#define RR(i,a,b) for(long long i=a; i>=b; i--)
#define FC(i,a,b) for(long long i=a; i<b; i++)
#define SS(x) scanf("%s",x)
#define PR(x) printf("%lld\n",x)
#define CL(a,x) memset(a,x,sizeof(a))
#define MID int mid=((l+r)>>1)
#define lson x<<1,l,mid
#define rson x<<1|1,mid+1,r
#define MK make_pair
#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
#define MAIN 110
using namespace std;
long long n,c,w[MAIN],v[MAIN];
long long wei[5],num;
long long high[5][MAIN];
long long hand[5];
long long que[5][MAIN];
bool cmp(const long long &a,const long long &b)
{
    return a>b;
}
int main()
{
    SCC(n,c);
    num=0;
    CL(hand,0);
    CL(high,0);
    CL(que,0);
    FF(i,1,n)
    {
        SCC(w[i],v[i]);
        if(!num)
        {
            num++;
            wei[num]=w[i];
            hand[num]++;
            high[num][hand[num]]=v[i];
        }
        else
        {
            int judge=0;
            FF(j,1,num)
            {
                if(wei[j]==w[i])
                {
                    judge=j;
                    break;
                }
            }
            if(!judge)
            {
                num++;
                wei[num]=w[i];
                hand[num]++;
                high[num][hand[num]]=v[i];
            }
            else
            {
                hand[judge]++;
                high[judge][hand[judge]]=v[i];
            }
        }
    }
    FF(i,1,num)
        sort(high[i]+1,high[i]+hand[i]+1,cmp);
    FF(i,1,num)
    {
        FF(j,1,hand[i])
        {
            if(j==1) que[i][j]=high[i][j];
            else que[i][j]=que[i][j-1]+high[i][j];
        }
    }
    long long ans=0;
    FF(i,0,hand[1])
    {
        if(num==1)
        {
            if(i*wei[1]<=c) ans=max(ans,que[1][i]);
            continue;
        }
        FF(j,0,hand[2])
        {
            if(num==2)
            {
                if(i*wei[1]+j*wei[2]<=c) ans=max(ans,que[1][i]+que[2][j]);
                continue;
            }
            FF(k,0,hand[3])
            {
                if(num==3)
                {
                    if(i*wei[1]+j*wei[2]+k*wei[3]<=c) ans=max(ans,que[1][i]+que[2][j]+que[3][k]);
                    continue;
                }
                FF(h,0,hand[4])
                    if(i*wei[1]+j*wei[2]+k*wei[3]+h*wei[4]<=c) ans=max(ans,que[1][i]+que[2][j]+que[3][k]+que[4][h]);
            }
        }
    }
    PR(ans);
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int A[4],mx,mix,ans;
int main(void){
	register int i;
	scanf("%d%d%d",&A[1],&A[2],&A[3]);
	sort(A+1,A+4);
	if((A[3]-A[1])%2==0){
		ans+=(A[3]-A[1])/2;
		if((A[3]-A[2])%2==1)ans+=1,--A[2];
		ans+=(A[3]-A[2])/2;
	}else{
		if((A[3]-A[2])%2==0){
			ans+=1,--A[1];
			ans+=(A[3]-A[2])/2;
			ans+=(A[3]-A[1])/2;
		}else{
			ans+=1,--A[3];
			ans+=(A[3]-A[2])/2;
			ans+=(A[3]-A[1])/2;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N;
  cin>>N;
  string S;
  cin>>S;
  if(N%2!=0) {
cout<<"No"<<endl;
    return 0;
  }
  
  for(ll i=0;i<N/2;i++) {
    if(S[i]!=S[N/2+i] ) {
      cout<<"No"<<endl;
    return 0;
  }
  }
  
  cout<<"Yes"<<endl;
}
    
    
    
    
    
    
    
    
    
    


Measured memory_bytes: 3628
#include<cmath>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    string s, k = "keyence"; cin >> s;
    int pos = 0;
    int state=0;
    
    for(int i=0;i<8;i++){
        if(s.substr(0,i)+s.substr(s.length()-(7-i),7-i)==k.substr(0,7)){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 888
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val a = sc.nextInt                 // 入力Bを受け付けて、bに格納する
  val b = sc.nextInt                 // 入力Cを受け付けて、cに格納する
  //println(((k+a-1)/a)*a)
  val res = if(a>b)"safe"else"unsafe"

  println(res)                       // 結果を出力する
}

Measured memory_bytes: 55404
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int N, K, buff, ans = 0;
vi vec;
map<int, int> mp;

int main(){
    cin >> N >> K;

    rep(i,N){
        cin >> buff;
        mp[buff]++;
    }

    for(auto itr = mp.begin(); itr != mp.end(); ++itr){
        vec.push_back(itr->second);
    }

    sort(vec.begin(), vec.end());
    if(vec.size() > K){
        for(int i =0; i < K; i++) vec.pop_back();

        for(auto itr = vec.begin(); itr != vec.end(); ++itr) ans += *itr;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 10748
// D - Flipping Signs
#include <bits/stdc++.h>
using namespace std;

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

	long long sum = 0;
	int mini = 1e9, minus_count = 0;

	for(int i=0; i<N; ++i){
		int a; cin>>a;
		if(a<0){ a = -a; ++minus_count; }
		mini = min(mini, a);
		sum += a;
	}

	sum -= minus_count%2 * mini*2;
	cout<< sum <<endl;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

using ll = long long int;
ll RepeatSquaring(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2, M);
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M);
}

int mod = 1e9 + 7;

ll calc(string str) {
  int i = 1;
  while (i < str.length() && str[i] != '1') {
    i++;
  }
  if (i == str.length()) {
    return (RepeatSquaring(3, str.length()-1, mod) + 2) % mod;
  } else {
    return (RepeatSquaring(3, str.length()-1, mod) + (2 * calc(str.substr(i)) % mod)) % mod;
  }
}

int main() {
  string str;
  cin >> str;
  int len = str.length();

  
  ll ans = 1;
  ll acm = 1;
  ll n = 0;
  for (int i = len-1; i >= 0; i--) {
    if (str[i] == '1') {
      int t = len - i - 1;
      acm = (acm * RepeatSquaring(3, t-n, mod)) % mod;
      //acm = RepeatSquaring(3, t, mod)
      ans = (acm + 2 * ans) % mod;
      n = t;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int keta = 1000000000;
  int N;
  cin >> N;
  int temp1 = 0;
  int temp2 = 0;
  int sum = 0;
  

  for (int i = 0; i < 9; i++){
    temp1 = N / keta;
    temp2 = N - temp1 * keta ;
 	keta = keta / 10;
    temp2 = temp2 / keta;
    sum = sum + temp2;
  }

  if(N % sum == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

}



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

using namespace std;

int n, ans[100000];

int main(){
    cin >> n;
    for(int i = 0; i < n; ++i){
        int c; cin >> c;
        ans[c-1] = i+1;
    }
    for(int i = 0; i < n; ++i) cout << ans[i] << " ";
    cout << endl;
}

Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <string>
#include  <queue>
#include <vector>
#include  <cstdio>
#include <cstring>
#include<map>
#include<set>
//#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T mul(T p, T e, T M)
{
    ll ret = 0;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret + p) ;
        p = (p + p) ;
        if(ret>=M)ret-=M;
        if(p>=M)p-=M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 

#define  mx 200004
#define base 193ll
 
typedef pair<int,int >P;
//////////////////////////
////////////////////////
#define F(i,a,b) for(int i=a;i<b; i++)
#define LL long long
#define MX  200007
#define md 998244353ll
///////////////////////////
///////////////////////////
///

int main(){

    int n, x;
    I2(n, x);

    int ans = 1;

    for(int i = 1;i<= n;i++){
        int x1;
        I(x1);
        if(i == 1)ans = abs(x- x1);
        else {
            ans = gcd(ans, abs(x - x1));
        }
    }
    cout<<ans<<endl;
   
    return 0;
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr ll INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

const int MAX = 6666660;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    COMinit();
    ll A,B;cin >> A >> B;
    ll X = 0,Y = 0;
    if(A == B*2 || B == A*2){
        cout << 1 << endl;
        return 0;
    }
    while(A >= 3 && B >= 3){
        X++;Y++;
        A -= 3;B -= 3;
        if(A == B*2){
            X += B;
            A = 0;B = 0;
            break;
        }
        else if(B == A*2){
            Y += A;
            A= 0;B = 0;
            break;
        }
    }
  if(A != 0 || B != 0){
    cout << 0 << endl;
    return 0;
  }
    ll ans = 1,MOD = 1000000007;
    cout << COM(X+Y,X) << endl;
}

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

using i64 = long long;
#define _overload(_1, _2, _3, _4, name, ...) name
#define _rep1(Itr, N) _rep3(Itr, 0, N, 1)
#define _rep2(Itr, a, b) _rep3(Itr, a, b, 1)
#define _rep3(Itr, a, b, step) for (i64 (Itr) = a; (Itr) < b; (Itr) += step)
#define repeat(...) _overload(__VA_ARGS__, _rep3, _rep2, _rep1)(__VA_ARGS__)

using namespace std;
using llong = long long;

int main() {
    int n, m;
    int k[16];
    int s[16][16];
    int p[16];

    cin >> n >> m;
    repeat(i, m) {
        cin >> k[i];
        repeat(j, k[i]) {
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    repeat(i, m) {
        cin >> p[i];
    }

    int ans = 0;
    repeat(i, 1 << n) {
        bitset<16> st(i);

        int cnt = 0;
        repeat(j, m) {
            int a = 0;
            repeat(it, k[j]) {
                a ^= st[s[j][it]] & 1;
            }

            if (a == p[j]) cnt++;
        }

        if (cnt == m) ans++;
    }

    cout << ans << endl;

    return 0;
};


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(){
  while (1){
    string s1;
    cin >> s1;
    if (s1 == "."){
      break;
    }
    string s2;
    cin >> s2;
    if (s1 == s2){
      cout << "IDENTICAL" << endl;
    } else {
      int N = s1.size();
      vector<string> A(1);
      for (int i = 0; i < N; i++){
        if (s1[i] == '"'){
          A.push_back("");
        } else {
          A.back().push_back(s1[i]);
        }
      }
      int M = s2.size();
      vector<string> B(1);
      for (int i = 0; i < M; i++){
        if (s2[i] == '"'){
          B.push_back("");
        } else {
          B.back().push_back(s2[i]);
        }
      }
      if (A.size() != B.size()){
        cout << "DIFFERENT" << endl;
      } else {
        bool ok = true;
        int cnt = 0;
        int K = A.size();
        for (int i = 0; i < K; i++){
          if (A[i] != B[i]){
            if (i % 2 == 0){
              ok = false;
            } else {
              cnt++;
            }
          }
        }
        if (!ok || cnt >= 2){
          cout << "DIFFERENT" << endl;
        } else {
          cout << "CLOSE" << endl;
        }
      }
    }
  }
}


Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int P = 1000000007;

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

    int n;
    cin >> n;

    constexpr ll T = 1LL << 20, X = 1 + T + T * T;
    ll p[20] = {};

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

        for (int k = 0; k < 20; k++) {
            p[k] += a & X;
            a >>= 1;
        }
    }

    ll r = 0;
    for (int k = 0; k < 20; k++) {
        ll c = p[k];
        for (int h = 0; h < 3; h++) {
            ll t = c & T - 1;
            c /= T;
            r += (1LL << (20 * h + k)) % P * t % P * (n - t) % P;
        }
    }
    r %= P;

    cout << r << endl;

    return 0;
}

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

int main(){
	int q;
	for(cin>>q;q;q--){
		int c,a,n,t=0;
		cin>>c>>a>>n;
		while(c>=1&&a>=1&&n>=1){
			c--;
			a--;
			n--;
			t++;
		}
		while(c>=2&&a>=1){
			c-=2;
			a-=1;
			t++;
		}
		
		while(c>=3){
			c-=3;
			t++;
		}
		cout<<t<<endl;
	}
	
	
	return 0;
}


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

int main()
{
    int a,b = 0;
    cin >> a >> b;
    if(a==1 && b!=1)
    {
        cout << "Alice" << endl;
    }
    else if(a==1  && b == 1 ){
        cout << "Draw" << endl;
    }
    else if(a!=1  && b == 1 ){
        cout << "Bob" << endl;
    }
    else if(a==b){
        cout << "Draw" << endl;
    }
    else if(a > b ){
        cout << "Alice" << endl;
    }
    else if(a < b ){
        cout << "Bob" << endl;
    }
    
    return 0;
}

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

template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

constexpr int INF = 1 << 30;

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

    std::vector<int> xs(n), rs(n);
    for (int i = 0; i < n; ++i) {
        std::cin >> xs[i] >> rs[i];
    }

    std::vector<std::vector<int>> graph(n);
    while (m--) {
        int u, v;
        std::cin >> u >> v;
        --u, --v;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }

    std::vector<int> dist(n, INF);
    dist[0] = 0;
    MinHeap<std::pair<int, int>> heap;
    heap.emplace(dist[0], 0);

    std::vector<int> ds(n);
    while (!heap.empty()) {
        int d, v;
        std::tie(d, v) = heap.top();
        heap.pop();
        if (d > dist[v]) continue;

        std::queue<int> que;
        que.push(v);
        std::fill(ds.begin(), ds.end(), -1);
        ds[v] = 0;

        while (!que.empty()) {
            int u = que.front();
            que.pop();

            if (dist[u] > dist[v] + xs[v]) {
                dist[u] = dist[v] + xs[v];
                heap.emplace(dist[u], u);
            }
            if (ds[u] == rs[v]) continue;

            for (auto w : graph[u]) {
                if (ds[w] != -1) continue;
                ds[w] = ds[u] + 1;
                que.push(w);
            }
        }
    }

    std::cout << dist.back() << "\n";
}

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

    solve();

    return 0;
}



Measured memory_bytes: 3588
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int X,Y;
    cin>>X>>Y;
    if(Y%2==1){
        cout<<"No"<<endl;
        return 0;
    }
    else if(Y>X*4||Y<X*2){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    return 0;
}


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

using namespace std;

int main() {
	vector<int> data(3);
	cin >> data[0] >> data[1] >> data[2];
	int max_val = *std::max_element(data.begin(), data.end());
	int sum = accumulate(data.begin(), data.end(), 0);
	cout << sum - max_val << endl;
	//std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	string s,t;
	cin >> s;
	if (s=="A") {t = "T";}
	if (s == "T") {t = "A";}
	if (s == "C") {t = "G";}
	if (s == "G") {t = "C";}
	cout << t << endl;
}

Measured memory_bytes: 256
using System;

class Program
    {
        static void Main()
        {
            for(int i = 1; i <= 9; i++)
            {
                for (int j = 1; j <= 9; j++)
                {
                    Console.WriteLine(i + "x" + j + "=" + i*j);
                }
            }
        }
    }


Measured memory_bytes: 9084
#include <stdio.h>
#include <math.h>
#define N 100

int main(void){
	int n, i, x[N], y[N];
	double d, d1 = 0.0, d2 = 0.0, d3 = 0.0, dn = 0.0;

	scanf("%d", &n);

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

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

	for(i = 0; i < n; i++){
		d = fabs(x[i] - y[i]);
		d1 += d;
		d2 += d * d;
		d3 += d * d * d;
		if(i == 0){
			dn = d;
		}
		else{
			if(dn < d){
				dn = d;
			}
		}
	}

	d2 = sqrt(d2);
	d3 = cbrt(d3);

	printf("%f\n", d1);
	printf("%f\n", d2);
	printf("%f\n", d3);
	printf("%f\n", dn);
	return 0;
}

Measured memory_bytes: 656
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

    int N;
    ll A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    ll tmp = abs(A - B);

    rep(k, 0, N) {
        if(k * C  - (N - k - 1) * D <= tmp and tmp <= k * D - (N - k - 1) * C) {
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

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

    ll N;
    cin >> N;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];

    ll mx = H[0];
    rep(i, N-1){
        if(mx - H[i+1] > 1){
            print("No");
            return 0;
        }
        mx = max(mx, H[i + 1]);
    }

    print("Yes");

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>


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

int main(){

    vector<int> a(5,0);
    int min =1000;
    int index = 0;
    for(int i=0;i < 5;i++) {

        cin >> a[i];
        if((min > a[i] % 10) && (a[i] % 10 != 0)){
            min = a[i]%10;
            index = i;

        }
    }
    int sum =0;
    for(int i=0;i < 5;i++){
        if(index != i ){

            if(a[i] % 10 != 0)sum += (a[i]/10) * 10 + 10;
            else sum += a[i];
        }
        
    }
    
    sum += a[index];
    cout << sum << endl;




    
    return 0;
}

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

int main() {
	int n, k; cin >> n >> k;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h.at(i);
	}
	sort(h.begin(), h.end());
	int ans = 1000000010;
	for (int i = 0; i + k - 1 < n; i++) {
		ans = min(ans, h.at(i + k - 1) - h.at(i));
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Scanner;
//import java.util..math

public class Main {
    static long[][] dp = null;

    //private static Integer solve(Integer i, Integer total, Integer n, Integer W, int[] ws, int[] vs) {
    //private static BigInteger solve(BigInteger i, BigInteger total, BigInteger n, BigInteger W, int[] ws, int[] vs) {
    private static long solve(int i, int total, int n, int W, int[] ws, int[] vs) {
        if (dp[i][total] > 0) {
            return dp[i][total];
        }

        if (i > n - 1) {
            return 0;
        }

        int weight = ws[i];
        int val = vs[i];

        if (total + weight <= W) {
            long chose = val + solve(i+1, total + weight, n, W, ws, vs);
            long unchose = solve(i+1, total, n, W, ws, vs);
            dp[i][total] = Math.max(chose, unchose);
            //return Math.max(chose, unchose);
            return dp[i][total];
        } else {
            dp[i][total] = solve(i+1, total, n, W, ws, vs);
            return dp[i][total];
        }
    }

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        int w = in.nextInt();
        int[] ws = new int[n];
        int[] vs = new int[n];
        for (int i = 0; i < n; i++) {
            ws[i] = in.nextInt();
            vs[i] = in.nextInt();
        }

        //long[][] dp = new long[n + 1][w + 1];
        dp = new long[n + 1][w + 1];
        long ans = solve(0, 0, n, w, ws, vs);

        System.out.println(ans);

//
//        for (int i = 1; i <= n; i++) {
//            for (int j = 1; j <= w; j++) {
//                if (j - ws[i - 1] >= 0) {
//                    dp[i][j] = Math.max(dp[i - 1][j], dp[i - 1][j - ws[i - 1]] + vs[i - 1]);
//                } else {
//                    dp[i][j] = dp[i - 1][j];
//                }
//            }
//        }
//        System.out.println(dp[n][w]);
    }
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N, K;
	int64 res = 0;
	cin >> N >> K;
	int32 cnt = N/K, cnt2 = (N-K/2)/K+(N >= K/2);
	res = cnt*cnt*cnt;
	if(K%2 == 0){
		res += cnt2*cnt2*cnt2;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ljc 1000000007
using namespace std;
char s[101010];
int n,suma[101010],sumb[101010],lasa[3],lasb[3]/*,nxta[101010],nxtb[101010]*/;
ll dp[101010];
vector<int> e[101010];
signed main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	bool flag=0;
	for (int i=1;i<n;i++){
		if (s[i]==s[i+1]){
			flag=1;break;
		}
	}
	if (!flag){
		puts("1");return 0;
	}
	for (int i=1;i<=n;i++){
		suma[i]=suma[i-1],sumb[i]=sumb[i-1];
		if (s[i]=='a') suma[i]++;
		else sumb[i]++;
	}
	memset(lasa,-1,sizeof lasa);
	memset(lasb,-1,sizeof lasb);
	int i;
	for (i=n;~i;i--){
		int aa=(2+i+suma[i])%3,bb=(2+i+sumb[i])%3;
		if (~lasa[aa]) 
			e[lasa[aa]].push_back(i);
		if (~lasb[bb]) 
			e[lasb[bb]].push_back(i);
		lasa[(i+suma[i])%3]=i,lasb[(i+sumb[i])%3]=i;
	}
	dp[0]=1;
	for (i=1;i<=n;i++){
		for (int j:e[i]) 
			dp[i]=(dp[i]+dp[j])%ljc;
	}
	ll _=0;
	for (i=1;i<=n;i++){
		if (!((n+suma[n]-(suma[i]+i)%3)%3)) _=(_+dp[i])%ljc;
	}
	cout<<_;
	return 0;
}



Measured memory_bytes: 11456
#include <iostream>
#include <algorithm>
using namespace std;
static int const MAX = 100;

void trace(int A[], int N)
{
  for (int i = 0; i < N; i++)
  {
    if (i > 0)
      cout << " ";
    cout << A[i];
  }
  cout << endl;
}

int selectionSort(int A[], int N)
{
  int count = 0;
  int minIndex = 0;
  for (int i = 0; i < N; i++)
  {
    minIndex = i;
    for (int j = i; j < N; j++)
    {
      if (A[j] < A[minIndex])
      {
        minIndex = j;
      }
    }
    swap(A[i], A[minIndex]);
    if (i != minIndex)
    {
      count++;
    }
  }
  return count;
}

int main()
{
  int N;
  int A[MAX];

  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
  }

  int count = selectionSort(A, N);
  trace(A, N);
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 3092
#include<stdio.h>
#define size 55
int main()
{
    int i,j,n,a[size],cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        if(a[i]!=i+1)cnt++;
    }
    if(cnt<=2)printf("YES");
    else printf("NO");
}


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

int main()
{
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int dx = x2 - x1, dy = y2 - y1;
    int x3 = x2 - dy, y3 = y2 + dx;
    int x4 = x3 - dx, y4 = y3 - dy;

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
    return 0;
}


Measured memory_bytes: 3604
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()


int main() {
    long long n,a,b;
    cin>>n>>a>>b;
    
    long long ans;
    ans=n/(a+b)*a+min(a,n%(a+b));
    dunk(ans);
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

import itertools

pi = 0
count = 1
for i in itertools.permutations(range(1, n+1), n):
    if list(i) == p:
        pi = count
        break
    else:
        count += 1

qi = 0
count = 1
for i in itertools.permutations(range(1, n+1), n):
    if list(i) == q:
        qi = count
        break
    else:
        count += 1

ans = abs(pi - qi)
print(ans)

Measured memory_bytes: 3064
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	// for x := 0; x < 10000; x++ {
	// N := x
	a := make([]int, 0)

	for N > 0 {
		a = append(a, N%26)
		N /= 26
	}
	// fmt.Print(x, ":", a)
	for i := 0; i < len(a)-1; i++ {
		if a[i] <= 0 {
			a[i] += 26
			a[i+1]--
		}
	}
	for i := len(a) - 1; i >= 0; i-- {
		if a[i] == 0 {
			continue
		}
		fmt.Print(string(a[i] - 1 + 'a'))
	}
	out()

	// }
}


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


int main(int, char**) {
    std::ios::sync_with_stdio(false);
    int N; 
    string s;
    cin >> N >> s;

    int cntW = 0, cntE = 0;
    for (int i = 0; i < N; ++i) {
        if (s[i] == 'W')
            ++cntW;
        else
            ++cntE;
    }

    int curCntW = 0, curCntE = 0;
    int minV = 1e6, minP = -1;
    for (int i = 0; i < N; ++i) {
        if (s[i] == 'E') ++curCntE;
        int curV = (cntE - curCntE) + curCntW;
        if (s[i] == 'W') ++curCntW;
        if (curV < minV) {
            minV = curV;
            minP = i;
        }
    }
    cout << minV << endl;
    return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=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;

const ll mod = 1e9 + 7;

ll dp[60][3][3];

int main(){
    int n;
    cin >> n;
    string s[2];
    cin >> s[0] >> s[1];

    if (s[0][0] == s[1][0]){
        dp[0][0][0] = dp[0][1][1] = dp[0][2][2] = 1;
    }else{
        REP(i,3) REP(j,3) if (i != j) dp[0][i][j] = 1;
    }

    REP(i,n-1) REP(j,3) REP(k,3){
        if (s[0][i] == s[0][i+1]){
            dp[i+1][j][k] += dp[i][j][k];
        }else if (s[0][i+1] != s[1][i+1]){
            REP(l,3) REP(m,3){
                if (l != m && l != j && m != k){
                    dp[i+1][l][m] = (dp[i+1][l][m] + dp[i][j][k]) % mod;
                }
            }
        }else{
            REP(l,3){
                if (l != j && l != k){
                    dp[i+1][l][l] = (dp[i+1][l][l] + dp[i][j][k]) % mod;
                }
            }
        }
    }
    ll ans = 0;
    REP(i,3) REP(j,3) ans = (ans + dp[n-1][i][j]) % mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
---------author:O7Oo7oO7O-------------
*/

#include <bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

using ll = long long int;



int main()
{
	IOS

	int n;
	set<string> st;
	string s;
	cin>>n;
	for( int i=0;i<n;i++)
	{
		cin>>s;
		st.insert(s);
	}
	cout<<st.size()<<"\n";

	return 0;
}

Measured memory_bytes: 19252
#include <bits/stdc++.h>
#define inf 1000000005
#define mod 1000000007
#define eps 1e-10
#define rep(i,n) for(int i = 0; i < (n); ++i) /*0からn-1までのrepeat*/
#define rrep(i,n) for(int i = 1; i <= (n); ++i) /*1からnまでのrepeat*/
#define drep(i,n) for(int i = (n)-1; i >= 0; --i) /*n-1から0までのrepeat*/
#define srep(i,s,t) for (int i = s; i < t; ++i) /*sからt-1までのrepeat*/
#define isin(x,l,r) ((l) <= (x) && (x) < (r)) /*l以上r未満のx*/
#define each(a,b) for(auto& (a): (b)) /*よくわからん*/
#define pct __builtin_popcountll /*1bitの数*/
#define all(a) a.begin(),a.end() /*範囲*/
#define sz(v) (int)(v).size() /*大きさ*/
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end()) /*重複削除*/
#define cmx(x,y) x=max(x,y) /*最大*/
#define cmn(x,y) x=min(x,y) /*最小*/
#define rev(v) reverse((v).begin(),(v).end()); /*逆順*/
#define so(v) sort((v).begin(), (v).end()); /*ソート*/
#define yn {puts("Yes");}else{puts("No");} /*はい・いいえ*/
#define dame { puts("-1"); return 0;}/*だめ*/
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using namespace std;

using ll = long long;
using unit = unsigned;
using ull = unsigned long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vp = vector<P>;
using vt = vector<T>;
using vs = vector<string>;

int main() {
    int a;
    cin >> a;
    cout<<(a-1)/2<<endl;
    return 0;
}

Measured memory_bytes: 3592
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + 100*j +50*k == x:
                count+=1
print(count)

Measured memory_bytes: 9084
#include <iostream>
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;

int main()
{
    long long a,b;
    cin>>a>>b;
    if(a == b){
        cout<<0;
        return 0;
    }
    if(a > b)swap(a,b);
    if((b-a)%2 == 0){
        cout<<a+(b-a)/2;
    }else{
        cout<<"IMPOSSIBLE";
    }
    return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = [input() for i in range(N)]

Counter = Counter(S)
print("AC x ", str(Counter['AC']))
print("WA x ", Counter['WA'])
print("TLE x ", Counter['TLE'])
print("RE x ", Counter['RE'])

Measured memory_bytes: 17588
import java.util.Scanner;

public class Main {

	public static void main(String... nui) {
		
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		
		int min = (int) 1e9;
		
		for (int i = 0; i < n; i++) {
			
			int a = sc.nextInt();
			
			int cnt = 0;
			
			while (a % 2 == 0) {
				
				a /= 2;
				cnt++;
				
			}
			
			min = Math.min(min, cnt);
			
		}
		
		System.out.println(min);
		
	}

}


Measured memory_bytes: 24020
#include "bits/stdc++.h"
using namespace std;
#define all(v) (v).begin(), (v).end()
#define io ios::sync_with_stdio(0)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rson rt << 1 | 1, mid + 1, r
#define lson rt << 1, l, mid
#define lll __int128
#define pii pair<int, int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
const int mod = 1e9 + 7;
inline int ksm(int a, int b)
{
	int ans = 1;
	for (; b; b >>= 1, a = a * a % mod)
		if (b & 1)
			ans = ans * a % mod;
	return ans;
}


signed main()
{
	io;
	int n;
	cin>>n;
	cout<<(n/2 + n%2);
	
	getchar(); //
	getchar();
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
const int N=550;
int i,j,k,n,m;
char a[N][N],b[N][N];
int main() {
	scanf("%d%d",&n,&m);
	for (i=1;i<=n;i++) {
		scanf("%s",a[i]+1);
		for (j=1;j<=m;j++) b[i][j]=a[i][j];
	}
	for (i=1;i<=n;i++) a[i][1]=b[i][m]='#';
	for (i=2;i<n;i+=2)
		for (j=2;j<m;j++) a[i][j]='#';
	for (i=3;i<n;i+=2)
		for (j=2;j<m;j++) b[i][j]='#';
	for (i=1;i<=n;i++) printf("%s\n",a[i]+1);
	puts("");
	for (i=1;i<=n;i++) printf("%s\n",b[i]+1);
}

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

int main(){
    ll n,x,t;
    cin>>n>>x>>t;
    cout<<(n+x-1)/x*t<<endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pt;

bool cmp(pt p, pt q) {
  if (p.second == q.second) return p.first > q.first;
  return p.second > q.second;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  int n; cin>>n;
  
  vector<pt> red(n), blue(n);
  for (int i=0; i<n; i++) {
    cin>>red[i].first>>red[i].second;
  }
  for (int i=0; i<n; i++) {
    cin>>blue[i].first>>blue[i].second;
  }
  sort(red.begin(),red.end(),cmp);
  sort(blue.begin(), blue.end());
  
  vector<bool> used(n);
  int res = 0;
  
  for (int j=0; j<n; j++) {
    pt p = red[j];
    for (int i=0; i<n; i++) {
      pt r = blue[i];
      if (p.first < r.first && p.second < r.second && !used[i]) {
	res++;
	used[i]=true;
	break;
      }
    }
  }


  cout<<res<<endl;

  return 0;
}


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

#define int long long
#define flash ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define all(x) begin(x),end(x)

int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;
int help(int x,int y,int k)
{
	int res=1;
	while(y>0)
	{
		if(y&1)
		{
			(res*=x)%=k;
		}
		(x*=x)%=k;
		y/=2;
	}
	res%=k;
	//return res;
	int xxx = (res-1+k)%k;
	return (xxx==0);
}		
signed main()
{
    flash
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
		int k;
		cin>>k;
		if(k%2==0)
		{
			cout<<-1;
		}
		else
		{
			if(k%7==0)
			k/=7;
			int res = 1;
			for(int i=1;i<=k;++i)
			{
				(res*=10)%=(9*k);
				int temp = (res-1+(9*k))%(9*k);
				if(temp==0)
				{
					cout<<i;
					return 0;
				}
			}
			cout<<-1;
		}
		cout<<"\n";
		//cout<<help(2,5,mod);		
    }
    return 0;
}


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

using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ll = long long int;
using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using cdouble = complex<double>;

const double eps = 1e-7;
#define Loop(i, n) for(int i = 0; i < int(n); i++)
#define Loopll(i, n) for(ll i = 0; i < ll(n); i++)
#define Loop1(i, n) for(int i = 1; i <= int(n); i++)
#define Loopll1(i, n) for(ll i = 1; i <= ll(n); i++)
#define Loopr(i, n) for(int i = int(n) - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = ll(n) - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = int(n); i >= 1; i--)
#define Looprll1(i, n) for(ll i = ll(n); i >= 1; i--)
#define Foreach(buf, container) for(auto buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(ex_i, vector.size()) { cout << vector[ex_i] << " "; } cout << endl;
#define printmx(matrix) Loop(ex_i, matrix.size()) { Loop(ex_j, matrix[ex_i].size()) { cout << matrix[ex_i][ex_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
#define fst first
#define snd second
#define INF INFINITY
bool feq(double x, double y) { return abs(x - y) <= eps; }
bool inrange(ll x, ll t) { return x >= 0 && x < t; }
bool inrange(vll xs, ll t) { Foreach(x, xs) if (!(x >= 0 && x < t)) return false; return true; }
int ceillog2(ll x) { int ret = 0;	x--; while (x > 0) { ret++; x >>= 1; } return ret; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (m * m <= x ? 0 : -1); }
ll ceilsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

/*******************************************************/

int main() {
	ll x, a; cin >> x >> a;
	if (x < a) {
		cout << 0 << endl;
	}
	else {
		cout << 10 << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k, ct = 0;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x >= k) {
            ct++;
        }
    }
    cout << ct;
}

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

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

int main() {
  int a, b, x;
  std::cin >> a >> b >> x;

  if (2*x > a*a*b) {
    cout << std::setprecision(8) << 180.0/M_PI * atan( (double) 2.0*(a*a*b - x)/(a*a*a) ) << endl;
  } else {
    cout << std::setprecision(8) << 180.0/M_PI * atan( (double) a*b*b/(2.0*x) ) << endl;
  }
}


Measured memory_bytes: 384
program main
  
  implicit none
  integer(16) :: a,b,x, tmp
  integer(16) :: ansa, ansb
  
  read(*,*) x
  
  ansa = 0 
  ansb = 0 
  do a = -130, 130
    tmp = a**int(5,kind=16) - x
    do b = -130, 130
      if (tmp == b**5) then
        ansa = a
        ansb = b
      end if
    end do
  end do
  
  print*, ansa, ansb
  
  
end program main



Measured memory_bytes: 2780
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[]) {
  ll N, M;
  cin >> N >> M;
  ll n[100000];
  n[0] = 1;
  for (ll i = 1; i <= 100000; i++) {
    n[i] = n[i - 1] * i % (ll)(7 + 1e+09);
  }
  if (abs(N - M) > 1) {
    cout << 0 << endl;
    return 0;
  } else if (N == M) {
    cout << (2 * (n[N] * n[M])) % (ll)(7 + 1e+09) << endl;
    return 0;
  } else {
    cout << n[N] * n[M] % (ll)(7 + 1e+09) << endl;
    return 0;
  }

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b)) < EPS)

static const double PI = 3.14159265358979;
 
struct Point{
  double x,y;
  Point(){}
  Point(double x,double y):x(x),y(y){}
  
  Point operator+(Point p){return Point(x+p.x,y+p.y);}
  Point operator-(Point p){return Point(x-p.x,y-p.y);}
  Point operator*(double k){return Point(x*k,y*k);}
  Point operator/(double k){return Point(x/k,y/k);}
   
  double norm(){return x*x+y*y;}
  double abs(){return sqrt(norm());}
 
  bool operator<(const Point &p) const{
    return x!=p.x? x< p.x : y < p.y;
  }
 
  bool operator==(const Point &p) const{
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS ;
  }
};
 
typedef Point Vector;
 
struct Segment{
  Point p1,p2;
  Segment(Point p1,Point p2):p1(p1),p2(p2){}
};

double cross(Vector a,Vector b){
  return a.x*b.y-a.y*b.x;
}
typedef vector<Point> Polygon;


Point getCrossPoint(Segment s1,Segment s2){
  Vector base = s2.p2 - s2.p1;
  double d1 = fabs(cross(base,s1.p1-s2.p1));
  double d2 = fabs(cross(base,s1.p2-s2.p1));
  double t = d1 / (d1+d2);
  return s1.p1 + (s1.p2 - s1.p1) * t;
}

Point getCrossPoint(Point p0,Point p1,Point p2,Point p3){
  return getCrossPoint(Segment(p0,p1),Segment(p2,p3));
}

int main(){
  int n,k;
  cin >> n >> k;
  Polygon v,c;
  int i;
  int d[4]={0,k,1,1-k};
  for(i=0;i<4;i++){
    double x=2*PI/n*d[i];
    v.push_back(Point(cos(x),sin(x)));
  }
  c.push_back(getCrossPoint(v[0],v[1],v[2],v[3]));
  printf("%.8lf\n",cross(v[0],c[0])*n);
  return 0;
}



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

int main () {
    int a, b;
    double A, B;
    cin >> a >> b;

    A = a;
    B = b;

    cout << fixed;
    cout << a / b << " " <<  a % b << " " << setprecision(9) <<  A / B << endl;

    return 0;
}


Measured memory_bytes: 3256
import bisect

N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
c.sort()
count=0

for j in b:
   x=bisect.bisect_left(a,j)
   y=bisect.bisect_right(c,j)
   count+=x*(N-y)
print(count)

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

#define FOR(i, a, b) for(int i=a; i<b; i++)
typedef long long ll;
typedef vector<int> vi;

int main(){
    ios_base::sync_with_stdio(false);
    int n, k;
    cin>>n>>k;
    int a[n];
    FOR(i, 0, n){
        cin>>a[i];
    }
    sort(a, a+n);
    bool dp[k+1];
    dp[0]=0;
    FOR(i, 1, k+1){
        dp[i]=0;
        for(int j=0; j<n && i>=a[j] && !dp[i]; j++){
            dp[i]=!dp[i-a[j]];
        }
    }
    if(dp[k])
        cout<<"First"<<endl;
    else
        cout<<"Second"<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <cassert>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <type_traits>

int main()
{
  int x, y;
  std::cin >> x >> y;
  std::cout << x + y / 2 << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
#define MAX 100


int P[MAX+1];
int n,j;
int m[MAX+1][MAX+1];
void matrix(){
  for(int i=1;i<=n;i++)m[i][i]=0;
  for(int l=2;l<=n;l++){
    for(int i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=(1<<21);
      for(int k=i;k<j;k++){
        m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+P[i-1]*P[k]*P[j]);
      }
    }
  }
  cout<<m[1][n]<<endl;
}

int main(){
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>P[i-1]>>P[i];
    //printf("%d\n", P[i-1]);
  }
  matrix();

}



Measured memory_bytes: 3132