akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
typedef long long ll;
typedef long double ld;
long long dx[] = {1,0,-1,0};
long long dy[] = {0,1,0,-1};
long long dx8[] = {1,1,0,-1,-1,-1,0,1};
long long dy8[] = {0,1,1,1,0,-1,-1,-1};
long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};

signed main(){
    ll N;
    cin >> N;
    ll DP[N][3];
    FOR(i,0,N)FOR(j,0,3)DP[i][j] = 0;
    FOR(i,0,N){
        ll a,b,c;
        cin >> a >> b >> c;
        if(i == 0){
            DP[i][0] = a;
            DP[i][1] = b;
            DP[i][2] = c;
        }
        else{
            DP[i][0] = max(DP[i-1][1],DP[i-1][2])+a;
            DP[i][1] = max(DP[i-1][0],DP[i-1][2])+b;
            DP[i][2] = max(DP[i-1][0],DP[i-1][1])+c;
        }
    }
    cout << *max_element(DP[N-1],DP[N-1]+3) << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll N;

int main(){
    cin>>N;

    ll ans=1001001001;
    repn(i,100000){
        if(N%i==0){
            ll a=i;
            ll b=N/i;
            ll res=max(log10(a),log10(b));
            res++;
            if(res<ans) ans=res;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <stdio.h>
 
int main(void)
{
    int n, m;
    int flag[1001], dice[1001];
    int p, c;
    int i;
     
    while (scanf("%d %d", &n, &m), n && m){
        p = 1;
        c = 0;
     
        for (i = 0; i < n; i++){
            scanf("%d", &flag[i]);
        }
        for (i = 0; i < m; i++){
            scanf("%d", &dice[i]);
        }
        for (i = 0; p < n; i++){
            p += dice[i];
            p += flag[p - 1];
            c++;
        }
        printf("%d\n", c);
    }
     
    return (0);
}


Measured memory_bytes: 1908
#include<bits/stdc++.h>
#define rep(i,a) for(int (i)=0; (i)<(a); (i)++)
#define rrep(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define rep2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n,leaves=0; cin >> n;
  
  vector<ll> a(n+100);
  rep(i,n+1){ cin >> a[i]; leaves += a[i];}
  
  vector<ll> s(n+100,0);
  for(int i=n;i>=0;i--) s[i] = s[i+1] + a[i];
  
  vector<ll> internal(n+1,0);
  if(a[0] == 0) internal[0] = 1;
  
  ll ans = 0;
  rep2(i,1,n+1){
    
    if(2*internal[i-1] - a[i] < 0){ cout << "-1"; return 0;} 
    
    internal[i] = min(2*internal[i-1] - a[i], s[i+1]); 
    ans += internal[i] + a[i];
  }
  if(leaves > pow(2,n)){ cout << "-1"; return 0;} 
  cout << ans+1 << endl;

  return 0;
}

Measured memory_bytes: 5588
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>
#include <tuple>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
    ll n, k, a[200020], inf = 1e18;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] %= k;
    }

    map<ll, ll> m, t;

    ll s[n + 20] = {};
    vector<ll> v[n + 20];
    t[0] = 0;
    int idx = 1;
    //v[0].push_back(-1);
    for (int i = 0; i < n; i++) {
        s[i + 1] = (s[i] + a[i] - 1 + k * 1000000000) % k;
        if (m.count(s[i + 1]) == 0) {
            m[s[i + 1]] = 1;
            t[s[i + 1]] = idx;
            v[idx].push_back(i);
            idx++;
        }
        else {
            m[s[i + 1]]++;
            v[t[s[i + 1]]].push_back(i);
        }
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        int ok = -1, ng = v[t[s[i]]].size();
        while (ng - ok > 1) {
            int mid = (ok + ng) / 2;
            if (v[t[s[i]]][mid] - (i - 1) < k) ok = mid;
            else ng = mid;
        }
        int ok2 = -1, ng2 = v[t[s[i]]].size();
        while (ng2 - ok2 > 1) {
            int mid = (ok2 + ng2) / 2;
            if (v[t[s[i]]][mid] <= i - 1) ok2 = mid;
            else ng2 = mid;
        }
        ans += ok - ok2;
        //cout << ok << " " << ok2 << endl;
    }
    cout << ans << endl;

/*
    for (int i = 0; i < idx ;i++) {
        for (int j = 0; j < v[i].size(); j++) {
            cout << v[i][j] << " ";
        }
        cout << endl;
    }*/
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiil;
typedef pair<pll, ll> pplll;
typedef pair<pli, int> pplii;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<pll>> vvpll;
#define rep(i, a, b) for (ll i=(a); i<(b); i++)
#define rrep(i, a, b) for (ll i=(a); i>(b); i--)
#define pb push_back
#define tostr to_string
#define mkp make_pair
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

void print(ld out) { cout << fixed << setprecision(12) << out << '\n'; }
template<typename T> void print(T out) { cout << out << '\n'; }
template<typename T1, typename T2> void print(pair<T1, T2> out) { cout << out.first << ' ' << out.second << '\n'; }
template<typename T> void print(vector<T> A) { rep(i, 0, A.size()) { cout << A[i]; cout << (i == A.size()-1 ? '\n' : ' '); } }
template<typename T> void print(set<T> S) { vector<T> A(S.begin(), S.end()); print(A); }

template<typename T> inline bool chmax(T &x, T y) { return (y > x) ? x = y, true : false; }
template<typename T> inline bool chmin(T &x, T y) { return (y < x) ? x = y, true : false; }

ll sum(vector<ll> A) { ll res = 0; for (ll a: A) res += a; return res; }
ll max(vector<ll> A) { ll res = -INF; for (ll a: A) chmax(res, a); return res; }
ll min(vector<ll> A) { ll res = INF; for (ll a: A) chmin(res, a); return res; }

ll toint(string s) { ll res = 0; for (char c : s) { res *= 10; res += (c - '0'); } return res; }
int toint(char c) { return c - '0'; }
char tochar(int i) { return '0' + i; }

inline ll pow(int x, ll n) { ll res = 1; rep(_, 0, n) res *= x; return res; }
inline ll pow(ll x, ll n, int mod) { ll res = 1; while (n > 0) { if (n & 1) { res = (res * x) % mod; } x = (x * x) % mod; n >>= 1; } return res; }

inline ll floor(ll a, ll b) { if (a < 0) { return (a-b+1) / b; } else { return a / b; } }
inline ll ceil(ll a, ll b) { if (a >= 0) { return (a+b-1) / b; } else { return a / b; } }

int popcount(ll S) { return __builtin_popcountll(S); }
ll gcd(ll a, ll b) { return __gcd(a, b); }

const ll mod = 2019;
ll dp0[2][mod], dp1[2][mod], dp2[2][mod];
ll N;
string S;
vector<ll> A;

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

    cin >> S;
    N = S.size();
    A.resize(N);
    rep(i, 0, N) A[i] = toint(S[i]);
    
    dp0[0][0] = 1;
    ll a, nxt, ans;
    rep(i, 0, N) {
        a = A[i];
        dp0[(i+1)&1][0] = dp0[i&1][0];
        dp1[(i+1)&1][a] = dp0[i&1][0];
        rep(j, 0, mod) {
            nxt = (j*10+a) % mod;
            dp1[(i+1)&1][nxt] += dp1[i&1][j];
            dp2[(i+1)&1][nxt] += dp1[i&1][j];
            dp2[(i+1)&1][j] += dp2[i&1][j];
        }
        memset(dp0[i&1], 0, sizeof(dp0[i&1]));
        memset(dp1[i&1], 0, sizeof(dp0[i&1]));
        memset(dp2[i&1], 0, sizeof(dp0[i&1]));
    }
    ans = dp2[N&1][0];
    print(ans);
    return 0;
}


Measured memory_bytes: 5144
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
#include <numeric>

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << #s << " " << s << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

const int L_MAX = 52; // 51

void printVector(vector<ll> A){
    cout << "[vector]" << endl;
    for(int i=0; i<A.size(); i++){
        cout << A[i] << " ";
    }
    cout << endl;
}

vector<ll> LV;
vector<ll> P;

ll howManyPatti(ll level, ll eatNum){
    //cout << "how many patti " << level << " " << eatNum << endl;

    if(eatNum == 0){
        return 0;
    }

    if(level == 0){
        if(eatNum == 0){
            return 0;
        }else{
            return 1;
        }
    }

    ll center = LV[level] / 2 + 1;
    if(eatNum == 1){
        return 0;
    }else if(eatNum == LV[level]){
        return P[level];
    }
    // just center
    else if(center == eatNum){
        return P[level - 1] + 1;
    }
    // longer than center
    else if(center < eatNum){
        return P[level] - howManyPatti(level - 1, LV[level] - eatNum - 1);
    }
    // shorter than center
    else{
        return howManyPatti(level - 1, eatNum - 1);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    // input
    ll N, X;
    cin >> N >> X;

    //N = 50;
    //X = 4321098765432109;
    
    // layer stats
    ll layer = 1;
    LV.push_back(1);

    FOR(i, 0, L_MAX){
        layer = 2 * layer + 3;
        LV.push_back(layer);
    }

    ll patti = 1;
    P.push_back(1);
    FOR(i, 0, L_MAX){
        patti = 2 * patti + 1;
        P.push_back(patti);
    }

    // printVector(LV);
    // printVector(P);

    p(howManyPatti(N, X));
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define size(s) s.size()
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
int main()
{
	int n,s;
	int a[200100];
	cin>>n>>s;
	REP(i,n)
		cin>>a[i];
	sort(a,a+n);
	reverse(a,a+n);
	ll ans=0;
	for(int i=s;i<n;i++)
		ans+=a[i];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
N,M = map(int,input().split())
H = list(map(int,input().split()))

tmp = [1] * N

AB = [map(int, input().split()) for _ in range(M)]
A, B = [list(i) for i in zip(*AB)]      
    
for i in range(M):
  if H[A[i]-1] > H[B[i]-1]:
    tmp[B[i]-1] = 0
  elif H[A[i]-1] < H[B[i]-1]:
    tmp[A[i]-1] = 0
  else:
    tmp[A[i]-1] = 0
    tmp[B[i]-1] = 0

print(sum(tmp))

Measured memory_bytes: 67796
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;

int a[1000005];

bool cmp(int a, int b){
	return a > b;
}

int main()
{
	int i,n,k;
	while(~scanf("%d %d",&n,&k)){
		int sum = 0;
		for(i = 1; i <= n; i++) scanf("%d",&a[i]);
		sort(a+1, a+1+n,cmp);
		for(i = 1; i <= k; i++) sum += a[i];
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] cityData = new int[m][4];
        for (int i = 0; i < m; i++) {
            int index = i;
            int prefIndex = sc.nextInt();
            int birth = sc.nextInt();
            cityData[i] = new int[]{index, prefIndex, birth, 0};
        }
        
        Arrays.sort(cityData, (a, b) -> Integer.compare(a[2], b[2]));
        Arrays.sort(cityData, (a, b) -> Integer.compare(a[1], b[1]));
        
        int currentPref = cityData[0][1];
        int id = 1;
        for (int i = 0; i < m; i++) {
            int pref = cityData[i][1];
            if (pref != currentPref) {
                currentPref = pref;
                id = 1;
            }
            
            cityData[i][3] = id;
            id++;
        }
        
        Arrays.sort(cityData, (a, b) -> Integer.compare(a[0], b[0]));
        
        for (int[] c : cityData) {
            String prefID = String.valueOf(c[1]);
            String cityID = String.valueOf(c[3]);
            
            while (prefID.length() < 6) {
                prefID = "0" + prefID;
            }
            while (cityID.length() < 6) {
                cityID = "0" + cityID;
            }
            
            System.out.println(prefID + cityID);
        }
    }
}


Measured memory_bytes: 111320
#include<bits/stdc++.h>
#define F(i) for(int i=0;i<n;i++)
using namespace std;long m[2000][2000]={},n,x,a=1e18,s;main(){cin>>n>>x;F(i)cin>>m[0][i];F(i){s=0;F(j){if(i)m[i][j]=min(m[i-1][j],m[0][(i+j)%n]);s+=m[i][j];}a=min(a,s+i*x);}cout<<a<<endl;}

Measured memory_bytes: 31488
#include "bits/stdc++.h"
using namespace std;

int main() {
	string N;
	cin >> N;
	vector<int>Num(N.size());
	for (int n = 0; n < N.size(); ++n) {
		Num[n] = N[n] - '0';
	}
	reverse(Num.begin(),Num.end());
	vector<int>DP0(N.size());//ぴったし
	vector<int>DP1(N.size());//くりあがり
	for (int n = 0;n<N.size();++n) {
		if (0 == n) {
			DP0[n] = Num[n];
			DP1[n] = 10 - Num[n];
		}
		else {
			if (9 == Num[n]) {
				DP0[n] = Num[n]+DP0[n-1];//ここで破綻するから
				DP1[n] = min((10 - Num[n]) + DP0[n - 1], (9 - Num[n]) + DP1[n - 1]);
			}
			else {
				DP0[n] = min(Num[n] + DP0[n - 1], Num[n] + DP1[n - 1] + 1);
				DP1[n] = min((10 - Num[n]) + DP0[n - 1], (9 - Num[n]) + DP1[n - 1]);
			}
		}
	}
	cout << min(DP0[N.size()-1], 1 + DP1[N.size() - 1]) << endl;
	return 0;
}

Measured memory_bytes: 16056
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long a = sc.nextInt();
		long b = sc.nextInt();
		long[] x = new long[n];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
		}
		long cost = 0;
		long dist;
		for (int i = 0; i < n-1; i++) {
			dist=x[i+1]-x[i];
			cost += Math.min(dist * a, b);
		}
		System.out.println(cost);
	}

}


Measured memory_bytes: 34004
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>

typedef int32_t i32;
typedef int64_t i64;

static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}

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

typedef struct sushi {
  i32 type;
  i32 val;
} sushi;

typedef sushi radix_type;

#define RADIX_WIDTH 10
const uint32_t radix_type_max = 30;
const uint32_t radix_type_begin = 0;
const uint32_t radix_width = RADIX_WIDTH;
const uint32_t radix_mask = (1 << RADIX_WIDTH) - 1;
#undef RADIX_WIDTH

static inline uint32_t radix_get_bit (radix_type v, uint32_t shift) {
  return v.val >> shift & radix_mask;
}

void radix_sort (radix_type *a, uint32_t n) {
  radix_type * const array = (radix_type *) calloc (4 * n, sizeof (radix_type));
  radix_type **bucket = (radix_type **) calloc (1 << radix_width, sizeof (radix_type *));
  uint32_t *len = (uint32_t *) calloc (2 << radix_width, sizeof (uint32_t));
  uint32_t *max_len = len + (1 << radix_width);
  for (uint32_t shift = radix_type_begin; shift < radix_type_max; shift += radix_width) {
    radix_type *p = array;
    memset (len, 0, sizeof (uint32_t) << (radix_width + 1));
    for (uint32_t i = 0; i < n; ++i) {
      uint32_t bit = radix_get_bit (a[i], shift);
      if (len[bit] == max_len[bit]) {
	for (uint32_t j = 0; j < len[bit]; ++j) {
	  p[j] = bucket[bit][j];
	}
	max_len[bit] = 2 * max_len[bit] + 1;
	bucket[bit] = p;
	p += max_len[bit];
      }
      bucket[bit][len[bit]++] = a[i];
    }
    for (uint32_t bit = 0, i = 0; bit < (1 << radix_width); ++bit) {
      for (uint32_t j = 0; j < len[bit]; ++j, ++i) {
	a[i] = bucket[bit][j];
      }
    }
  }
  free (array);
  free (bucket);
  free (len);
}

void run (void) {
  i32 n = read_int();
  i32 k = read_int();
  sushi *s = (sushi *) calloc (n, sizeof (sushi));
  for (i32 i = 0; i < n; ++i) {
    s[i].type = read_int() - 1;
    s[i].val = read_int();
  }
  radix_sort (s, n);
  uint8_t *u = (uint8_t *) calloc (n, sizeof (uint8_t));
  i32 *stack = (i32 *) calloc (k, sizeof (i32));
  i32 top = 0;
  i64 cnt = 0;
  i64 sum = 0;
  for (i32 i = n - 1; i >= n - k; --i) {
    sum += s[i].val;
    if (!u[s[i].type]) {
      u[s[i].type] = 1;
      cnt++;
    } else {
      stack[top++] = s[i].val;
    }
  }
  i64 max = sum + cnt * cnt;
  for (i32 i = n - k - 1; i >= 0 && top > 0; --i) {
    i32 type = s[i].type;
    if (u[type]) continue;
    u[type] = 1;
    sum += s[i].val - stack[--top];
    cnt++;
    max = MAX(max, sum + cnt * cnt);
  }
  printf ("%" PRIi64 "\n", max);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 3968
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	double n;
	cin >> n;
	n = n * n * n;
	cout << n / 27.0 << endl;
}

Measured memory_bytes: 256
S = input()
divedLR = []
begin, end = 0, 0
for i in range(len(S) - 1):
    if S[i] == "L" and S[i + 1] == "R":
        end = i + 1
        divedLR.append(S[begin:end])
        begin = i + 1
divedLR.append(S[begin : len(S)])
ans = []
for div in divedLR:
    i_RL = 0
    for i in range(len(div) - 1):
        if div[i] == "R" and div[i + 1] == "L":
            i_RL = i
            break
    ans += [0] * i_RL
    if i_RL % 2 == 0:
        ans += [len(div) - len(div) // 2, len(div) // 2]
    else:
        ans += [len(div) // 2, len(div) - len(div) // 2]
    ans += [0] * (len(div) - 2 - i_RL)
for i in ans:
    print(i, " ", end="")


Measured memory_bytes: 8228
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
    
     string s;
     cin>>s;
     
     if((s[0]==s[1]&&s[1]==s[2])||(s[1]==s[2]&&s[2]==s[3])){
         cout<<"Yes" <<endl;
     }
     else
        cout<<"No" <<endl;
    
    return 0;
}

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

int main() {
  while (1) {
    char c;
    scanf("%c", &c);

    // アルファベットかどうか
    if (isalpha(c)) {
      // 大文字かどうか
      if (isupper(c)) {
        cout << (char)tolower(c);
      } else {
        cout << (char)toupper(c);
      }
    } else {
      cout << c;
    }

    if (c == '\n') { break; }
  }
  return 0;
}



Measured memory_bytes: 3136
#define _USE_MATH_DEFINES
//#include <windows.h>
#include <algorithm>
#include <cstdio>
#include <list>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <fstream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cstdlib>
#include <cmath>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define INF 1000000007
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
typedef priority_queue<P, vector<P>, greater<P> > minPQ;
struct edge {int to,cost;};
//const int SIZE = 1<<18;

int SOSU[] = {2,3,5,7,11,13,17,19,23,29,31,37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};//11
int num[168];
int main() {
	int N;
	cin >> N;
	REP(i,N) {
		int n = i+1;
		REP(k,168) {
			int sosu = SOSU[k];
			while(sosu<=n) {
				if(n%sosu==0) num[k]++;
				sosu *= SOSU[k];
			}
		}
	}
	LL ans = 1;
	REP(k,168) {
		ans *= (1+num[k]);
		ans %= 1000000007;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        int[] a = Array.ConvertAll(Console.ReadLine().ToCharArray(), c => (int)Char.GetNumericValue(c));
        int[] b = Array.ConvertAll(Console.ReadLine().ToCharArray(), c => (int)Char.GetNumericValue(c));
        if (a.Length > b.Length)
            Console.WriteLine("GREATER");
        else if (a.Length < b.Length)
            Console.WriteLine("LESS");
        else
        {
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] > b[i])
                {
                    Console.WriteLine("GREATER");
                    return;
                }
                else if (a[i] < b[i])
                {
                    Console.WriteLine("LESS");
                    return;
                }
            }
            Console.WriteLine("EQUAL");
        }
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define LL long long
template<class T> inline void chmax(T & a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

int calculate_digits_total(int x) {
	int digits_total = 0;
	while (x) {
		digits_total += x % 10;
		x /= 10;
	}

	return digits_total;
}


int main(void) {
	int A, B;
	cin >> A >> B;
	int count = 0;
	for (int i = A; i <= B; i++){
		int tmp = i;
		int reversed_num = 0;

		for (int i = 4; i >= 0; i--){
			reversed_num += (tmp % 10) * int(pow(10,i));
			tmp /= 10;
		}
		
		if (reversed_num == i) {
			count++;
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;
public class Main 
{ 
    public static void main(String[] args)
    {
       int n,x,p,r,s,t;
       Scanner sc = new Scanner(System.in);
       while((n = sc.nextInt())+(x = sc.nextInt())!=0)
       {
          p =0;
          for(r=1; r<=n; r++)
          {
             for (s = 1; s<=n; s++)
             {
                 for( t = 1; t<=n; t++)
                 {
                     if(t+s+r==x) 
                     {
                         if(r!=s && s!=t && r!=t){
                        p++;
                     }
                 }
             }
          }
       }
          System.out.println(p/6);
    } 
}
}



Measured memory_bytes: 26700
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var ab = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var a = ab[0];
        var b = ab[1];
        
        var d = Math.Abs(a - b);
        Console.WriteLine(d % 2 == 0 ? (Math.Min(a, b) + d / 2).ToString() : "IMPOSSIBLE");
    }
}


Measured memory_bytes: 13396
N, K = [int(i) for i in input().strip().split()]

prob_win = 0.0
for i in range(1, N+1):
    pnt = i
    cnt = 0
    while(True):
        if pnt >= K:
            break
        pnt *= 2
        cnt += 1
    prob_win += (1/N) * (1/2)**cnt

print(prob_win)


Measured memory_bytes: 2940
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
                void solve(){
                    ll n, d;
                    cin>>n>>d;
                    d =d*d;
                    ll ans = 0;
                    while(n--){
                        ll f, s;
                        cin>>f>>s;
                        if(f*f + s*s <= d)
                            ++ans;
                    }
                    cout<<ans;
                }
                int main(){ 
                        hs;
                        ll t;
                        t=1;
                        // cin>>t;
                        for (int i=1; i<=t; i++){
                                //cout<<"Case #"<<i<<": ";
                                solve();
                         }
        return 0; 
}         
 
 

Measured memory_bytes: 3640
while True :
    T, H, S = map(int, input().split())
    if T == -1 and H == -1 and S == -1 :
        break
    
    time = T * 3600 + H * 60 + S
    n = 2*60*60 - time
    b = (2*60*60 - time) * 3
    
    n_T = n // 3600
    n_H = (n % 3600) // 60
    n_S = (n % 3600) % 60
    b_T = b // 3600
    b_H = (b % 3600) // 60
    b_S = (b % 3600) % 60
    print('{0:0=2}:{1:0=2}:{2:0=2}'.format(n_T, n_H, n_S))
    print('{0:0=2}:{1:0=2}:{2:0=2}'.format(b_T, b_H, b_S))


Measured memory_bytes: 5604
#include<bits/stdc++.h>     
  using namespace std;  
  typedef long long  ll;
  typedef pair<ll,ll> pll;  
  #define pb(x) push_back(x)     
  typedef unsigned long long  ull;     
  #define mem(A, X) memset(A, X, sizeof A)
  #define ford(i,l,u) for(ll (i)=(ll)(l);(i)>=(ll)(u);--(i))
  #define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
  #define fori(i,l,u) for(ll (i)=(ll)(l);(i)<=(ll)(u);++(i))    
  typedef pair<int,int> pii;
  #define sec second
  #define fir first  

  const ll mod=1e9+7; 
  const ll maxn=1e5+10; 
  int n;
  ll ans[maxn];
  int main()
  {
       std::ios::sync_with_stdio(false); 
       //freopen("in.txt","r",stdin); 
       ans[1]=1;
       fori(i,2,100000)  ans[i]=i*ans[i-1]%mod;

       while(cin>>n)
       {
        cout<<ans[n]<<endl;
       }
    return 0;
  }

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	int a=0;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='+') a++;
		if(s[i]=='-') a--;
	}
	cout<<a<<endl;return 0;
 } 

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

using namespace std;
#define ll long long

int main()
{
     ll n;
     cin >> n;
     ll pos ;
     for(ll i=1;  ; i++)
     {
         ll val = (i*(i+1))/2;
         if(val>=n)
         {
             pos = i;
             break;
         }
     }
     cout << pos << endl;
}


Measured memory_bytes: 3600
#include<cstdio>
#include<cmath>
using namespace std;
int prime[10000];
int p[10000];
int c[10000];
int main() {
	for (int i = 2; i*i < 10000; i++) {
		for (int j = i*i; j < 10000; j += i) prime[j] = 1;
	}
	int cnt = 0;
	for (int i = 2; i < 10000; i++) {
		if (prime[i] == 0) {
			p[cnt] = i; cnt++;
		}
	}
	for(int i=2;i<10000;i++)c[i]=c[i-1]+(1-prime[i]);
	int n, q, z = 0;
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		scanf("%d", &n); bool OK = true;
		int L=sqrt(n);
		for (int j = 0; j < c[L]; j++) {
			if (n%p[j] == 0){OK = false;break;}
		}
		if (OK == true)z++;
	}
	printf("%d\n", z);
	return 0;
}

Measured memory_bytes: 2840
using System;
public class Hello{
public static void Main(){
  
 string[] str = Console.ReadLine().Split(' ');
       int a = int.Parse(str[0]);
        int b = int.Parse(str[1]);
        
    if(a<b){
        Console.WriteLine("a < b");
    }else if(a>b){
        Console.WriteLine("a > b");
    }else{
        Console.WriteLine("a == b");
    }
    }
}


Measured memory_bytes: 15932
from collections import deque
from fractions import gcd
#from math import factorial
from math import sqrt
from math import ceil
from itertools import permutations
from heapq import *
from collections import defaultdict
from copy import deepcopy

from bisect import bisect_left as bl

S=input()
T=input()
N=len(S)
dic1=defaultdict(int)
for i in range(N):
    s=S[i]
    t=T[i]
    if s in dic1.keys():
        if t!=dic1[s]:
            print("No")
            quit()
    else:
        dic1[s]=t
dic2=defaultdict(int)
for i in range(N):
    s=S[i]
    t=T[i]
    if t in dic2.keys():
        if s!=dic2[t]:
            print("No")
            quit()
    else:
        dic2[t]=s
print("Yes")

Measured memory_bytes: 67656
#include <iostream>
#include <queue>
#include <cmath>

using namespace std;

int32_t judge(int32_t a, int32_t b)
{
	if (a > b)
		return a - b;
	else if (b > a)
		return b - a;
	else
		return a;
}

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

	int32_t numRock{ 1 };
	for (auto i = 0; i < n; ++i) numRock *= 2;

	int32_t temp;
	queue<int32_t> rocks;
	for (; numRock > 0; --numRock) {
		cin >> temp;
		rocks.push(temp);
	}

	int32_t a, b;
	for (; rocks.size() > 1;) {
		a = rocks.front(), rocks.pop();
		b = rocks.front(), rocks.pop();
		a = judge(a, b);
		rocks.push(a);
	}

	cout << rocks.front() << endl;
}

Measured memory_bytes: 1280
n, m, x = map(int, input().split())
lis = [list(map(int, input().split())) for _ in range(n)]
ans = float('inf')
for i in range(2**(n)):
    table = [0]*m
    money = 0
    for j in range(n):
        if ((i >> j) & 1):
            money += lis[j][0]
            for k in range(m):
                table[k] += lis[j][k+1]
    if all([table[i] >= x for i in range(m)]):
        ans = min(ans, money)
if ans == float('inf'):
  print(-1)
else:
  print(ans)

Measured memory_bytes: 9224
// in the name of Allah ;
#include<bits/stdc++.h>
using namespace std ;
int main ()
{
	int a,b ;
	cin >> a >> b ;
	if ( a == 0  ) 
		cout << "Zero" << endl;
	else if ( a < 0 && b >= 0 ) 
		cout << "Zero" << endl;
	else if ( a < 0 && b < 0 ) 
	{
		int x = -a - b +1 ;
		if ( x % 2 ) 
			cout << "Negative" << endl;
		else
			cout << "Positive" << endl;
	}
	else
		cout << "Positive" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main() {
  	map<int, int> a,b;
  
    int N; cin >> N;
    rep(i,N) {ll d; cin >> d; a[ d ]++;}
  
    int M; cin >> M;
    vel t(M);
    rep(i,M) {cin >> t[i]; b[ t[i] ]++;}
  
    rep(i,M) {
      int x = t[i];
      if(a[x] < b[x]) {cout << "NO" << endl; return 0;}
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 20608
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

n,k = ip()
x = ip()
dp = [0]*n
for i in range(1,n):
    mn = float('inf')
    for j in range(max(0,i-k),i):
        mn = min(mn,dp[j]+abs(x[j]-x[i]))
    dp[i] = mn
    #print(dp)
print(dp[-1])


Measured memory_bytes: 84840
<?php
// C
fscanf(STDIN, '%d %d', $n, $m);
$h = array_map('intval', explode(' ', trim(fgets(STDIN))));
$g = array_fill(0, $n, 1);
for ($i  = 0; $i < $m; $i++) {
    fscanf(STDIN, '%d %d', $a, $b);
    $a--;
    $b--;
    if ($h[$a] > $h[$b]) {
        $g[$a] *= 1;
        $g[$b] *= 0;
    } elseif ($h[$a] === $h[$b]) {
        $g[$a] *= 0;
        $g[$b] *= 0;
    } else {
        $g[$a] *= 0;
        $g[$b] *= 1;
    }
}
echo array_sum($g);

Measured memory_bytes: 27076
#include <cmath>
#include <complex>
#include <vector>
#include <cfloat>
#include <algorithm>
#include<cstdio>
#include<iostream>
using namespace std;
class point;
class line;
point vec_add(point vec1,point vec2);//ベクトルの足し算
point vec_sub(point vec1,point vec2);//ベクトルの引き算
double inner_product(point a,point b);//内積
double outer_product(point a,point b);//外積
bool vec_parallel(point vec1,point vec2);//ベクトルの並行判定(交差判定falseとしても使える)
bool vec_angle_right(point vec1,point vec2);//ベクトルの直行判定
bool cross_line_segment(line a,point p1,point p2);//直線と線分の交差判定

class point{
public:
	double x,y;
	point(){
		x=0;
		y=0;
	}
	point(double a,double b){
		x=a;
		y=b;
	}
	void in(double a,double b){
		x=a;
		y=b;
		return ;
	}
};
//直線クラス
class line{
public:
	point s,v;
public:
	line(point a,point b){
		s=a;
		v=vec_sub(a,b);
	}
};
//ベクトルの足し算
point vec_add(point vec1,point vec2){
	point res(vec1.x+vec2.x,vec1.y+vec2.y);
	return res;
}
//ベクトルの引き算
point vec_sub(point vec1,point vec2){
	point res(vec1.x-vec2.x,vec1.y-vec2.y);
	return res;
}
//内積
double inner_product(point a,point b){
	return a.x * b.x + a.y * b.y;
}
//外積
double outer_product(point a,point b){
	return a.x * b.y - a.y * b.x;
}

point p[6];

bool solve(){
	bool judge;
	bool ans;
	if(outer_product(p[0],p[1])>0){
		judge=true;
	}else{
		judge =false;
	}
	for(int i=1;i<4;i++){
		if(outer_product(p[i],p[i+1])>0){
			if(judge!=true) return false;
		}else if(outer_product(p[i],p[i+1])==0){
			return false;
		}else{
			if(judge!=false) return false;
		}
	}
	return true;
}



int main(){
	
	
	while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&p[0].x,&p[0].y,&p[1].x,&p[1].y,&p[2].x,&p[2].y,&p[3].x,&p[3].y)!=EOF){
		p[4]=p[0];
		p[5]=p[1];
		for(int i=0;i<5;i++){
			p[i]=vec_sub(p[i],p[i+1]);
		}
		bool ans=solve();
		
		if(ans){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	
}

Measured memory_bytes: 1224
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define fi first
#define se second
#define cl clear()
#define sqr(a) (a*a)
#define mk make_pair
#define pb push_back
string en="\n";
string sp=" ";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<long long>
#define vs  vector<string>
#define MX LLONG_MAX
#define MN LLONG_MIN
#define MOD 1000000007
#define vp(vi,x) cin>>x; vi.pb(x);
#define bsearch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
LL bpow(LL a,LL b){if(b==0)return 1;LL r=bpow(a,b/2);if(b%2)return r*r*a;else return r*r;}
LL binpow(LL a,LL b){LL r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
LL binpow(LL a,LL b,LL m){a%=m;LL r=1;while(b>0){if(b&1) r=r*a%m;a=a*a%m; b>>=1;}return r;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,p,q,a,b,c=0;
    bool f=0,ff=0;
    string st[3];
    while(cin>>st[0]>>st[1]>>st[2])
    {
        i=j=k=p=0;
        char ch='A';
        while(1)
        {
            if(p==0)
            {
                if(i>=st[p].sz) break;
                p=st[p].at(i)-'a';
                i++;
            }
            if(p==1)
            {
                if(j>=st[p].sz) break;
                p=st[p].at(j)-'a';
                j++;
            }
            if(p==2)
            {
                if(k>=st[p].sz)break;
                p=st[p].at(k)-'a';
                k++;
            }
        }
        ch+=p;
        cout<<ch<<en;
    }
}




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

#define mp make_pair
#define pb push_back
#define x first
#define y second
#define all(a) (a).begin(), (a).end()
typedef long long ll;

const int mod = 998244353;

int add(int a, int b) {
    return a + b < mod ? a + b : a + b - mod;
}

int sub(int a, int b) {
    return a >= b ? a - b : a - b + mod;
}

int mult(int a, int b) {
    return (ll)a * b % mod;
}

int dp[3005][3005];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    dp[a][b] = 1;
    for (int i = a; i <= c; i++) {
        for (int j = b; j <= d; j++) {
            if (i + 1 <= c) dp[i + 1][j] = add(dp[i + 1][j], mult(dp[i][j], j));
            if (j + 1 <= d) dp[i][j + 1] = add(dp[i][j + 1], mult(dp[i][j], i));
            if (i + 1 <= c && j + 1 <= d) dp[i + 1][j + 1] = sub(dp[i + 1][j + 1], mult(dp[i][j], mult(i, j)));
        }
    }
    cout << dp[c][d];
    return 0;
}


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

int main(){
  int n; cin>>n;
  vector<int> num(n);
  for(int i=0;i<n;i++){
    cin>>num[i];
  }bool flag=false;
  int count=0;
  for(int i=0;i<101;i++){
    for(int j=0;j<n;j++){
      if(num[j]>i) flag=true;
      else{
        if(flag){
          count++;
          flag=false;
        }
      }
    }if(flag){
      count++;
      flag=false;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define OUT(s) cout << s << "\n";
using namespace std;

long A,B,C,K;
// https://atcoder.jp/contests/abc167
void Main()
{
    long t = K - A;
    long ans = A;
    if (t < 0) {
        ans = K;
    } else {
        t = t - B;
        if (t >= 0) {
            if ((t - C) < 0) {
                ans = ans - t;
            } else {
                ans = ans - C;
            }
        }
    }
    OUT(ans);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    cin >> A >> B >> C >> K;
    Main();
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100001;
int main()
{
    int N, a;
    int b[MAX_N];
    a = 0;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        scanf("%d", &b[i]);
    }
    for (int i = 0; i < N; i++)
    {
        if (b[i] != i+1){
            a += 1;}
    }
    printf((a < 3) ? "YES\n" : "NO\n");
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
 
public class Main {
	private static FastScanner sc = new FastScanner();
	
	public static void main(String[] args) {
		long X = sc.nextLong();
		long Y = sc.nextLong();
		
		int ans = 1;
		while(true) {
			X *= 2;
			if(X > Y) break;
			ans++;
		}
		System.out.println(ans);
	}
	
	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (double NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll INF =1000000000000000;

long double n,k,ans=0;
long double c2(long double x){
  long double y=k/x;
  REP(i,10000){
    if(pow(2,i)>=y)return pow(2,i);
  }
}

int main(){
  cin>>n>>k;
  FOR(i,1,n+1){
    if(i>=k)ans+=c2(1);
    else{
      ans+=c2(1)/c2(i);
    }
  }
  k=c2(1);
  ans=ans/(n*k);
  cout<<fixed<<setprecision(10);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// to container
template <class C>
void input(C &c)
{
    for_each(c.begin(), c.end(), [](auto &i) { cin >> i; });
}

// to number, string
template <class T>
T input()
{
    T data;
    cin >> data;
    return data;
}

int main()
{
    ll N = input<ll>(), T = input<ll>();

    ull res = 0;
    ull pre = -1000000000;

    for (ll i = 0; i < N; i++)
    {
        ll t = input<ll>();
        if (t - pre < T)
        {
            res -= T - (t - pre);
        }
        res += T;
        pre = t;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
class Solution:
    def solve(self, A: int, B: int, K: int) -> str:

        count = 0
        for i in range(A, 0, -1):
            if A % i == 0 and B % i == 0:
                count += 1

            if count == K:
                return i


if __name__ == '__main__':

    # standard input
    A, B, K = map(int, input().split())

    # solve
    solution = Solution()
    print(solution.solve(A, B, K))


Measured memory_bytes: 3060
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd); FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    uint n, k;
    cin >> n >> k;
    vector<pair<uint, uint>> abs;
    ll base = 0;
    for(uint i = 0; i < n; i++){
        uint a, b;
        cin >> a >> b;
        if(a == 0){
            base += b;
        }else if(a <= k){
            abs.emplace_back(a, b);
        }
    }

    int bit = 30;
    for(; bit >= 0; bit--){ if(k & (1 << bit)){ break; } }
    ll ans = 0;
    // solve():
    uint mi = -1;
    for(; bit >= 0; bit--){
        ll cand = 0;
        for(auto ab : abs){
            uint a = ab.first, b = ab.second;
            if(bit){
                if((k & (1 << bit)) == 0){ continue; }
                uint k2 = k & (mi << bit), a2 = a & (mi << bit);
                if((a & (1 << bit)) == 0 && k2 == (k2 | a2)){
                    cand += b;
                }
            }else{
                if(k == (k | a)){
                    cand += b;
                }
            }
        }
        ans = max(ans, cand);
    }

    cout << base + ans << '\n';
}


Measured memory_bytes: 1400
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;

int main ()
{
  int x, y;
  char op;
  int count = 0;
  vector<int> data(10000);
  while (1) {
    scanf("%d", &x);
    scanf(" %c", &op);
    scanf("%d", &y);
    if (op == '?') {
      break;
    } else if (op == '+') {
      data[count] = x + y;
    } else if (op == '-') {
      data[count] = x - y;
    } else if (op == '*') {
      data[count] = x * y;
    } else if (op == '/') {
      data[count] = x / y;
    }
    count++;
  }

  for (int i = 0; i < count; i++) {
    printf("%d\n", data[i]);
  }

  return 0;
}

Measured memory_bytes: 2672
#include <iostream>
 
using namespace std;
 
#define MAX_V (15)
#define INF   (1<<29)
 
int V;
int cost[MAX_V][MAX_V];
int dp[1 << MAX_V][MAX_V];
 
int main() {
   
  cin >> V;
   
  for(int i = 0; i < V; i++)
    for(int j = 0; j < V; j++)
      cost[i][j] = INF;
   
  int m;
   
   
  cin >> m;
  for(int i = 0; i < m; i++) {
    int s, t, c;
    cin >> s >> t >> c;
    cost[s][t] = c;
  }
 
  int SMAX = 1<<V;
   
  for(int i = 0; i < SMAX; i++)
    for(int j = 0; j < V; j++)
      dp[i][j] = INF;
   
  dp[SMAX-1][0] = 0;
  for(int S = SMAX-2; S >= 0; S--)
    for(int i = 0; i < V; i++)
      for(int j = 0; j < V; j++)
    if(!(S >> j & 1))
      dp[S][i] = min(dp[S][i], dp[S|(1 << j)][j] + cost[i][j]);
     
  cout << ( dp[0][0] == INF ? -1 : dp[0][0] ) << endl;
   
  return 0;
}

Measured memory_bytes: 3080