akhauriyash/Code-Regression huggingface dataset:
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
#define N 514
void build(){

}
LL H , W , h , w;
LL a[ N ][ N ];
void init(){
  H = getint();
  W = getint();
  h = getint();
  w = getint();
}
void solve(){
  if( H == h and W == w ){
    puts( "No" );
    Bye;
  }
  if( h == 1 and w == 1 ){
    puts( "No" );
    Bye;
  }
  LL sum = 0;
  LL bs = 1000000000 / (h * w);
  for( int i = 0 ; i < H ; i ++ )
    for( int j = 0 ; j < W ; j ++ ){
      a[ i ][ j ] = bs;
      if( i % h == h - 1 and j % w == w - 1 )
        a[ i ][ j ] = -bs * ( h * w - 1 ) - 1;
      sum += a[ i ][ j ];
    }
  if( sum <= 0 ){
    puts( "No" );
    Bye;
  }
  puts( "Yes" );
  for( int i = 0 ; i < H ; i ++ )
    for( int j = 0 ; j < W ; j ++ )
      printf( "%lld%c" , a[ i ][ j ] , " \n"[ j + 1 == W ] );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 4864
//
// Created by 绔ユ闃?on 2018/9/14.
// https://abc044.contest.atcoder.jp/tasks/arc060_a
// 鍔ㄦ€佽鍒掞細dp[i][j][k]琛ㄧず鍓峣涓暟涓€塲涓拰涓簁鐨勬柟娉曟暟
// 閭ｄ箞鏈夛細dp[i][j][k] = dp[i-1][j-1][k-x[i]] + dp[i-1][j][k]
// 鏈€缁堢粨鏋滀负锛歕sum{dp[N][i][A*i]}
//
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
int N, A, x[51], sum[51];
ll dp[51][51][2501];
int main() {
    cin >> N >> A;
    memset(sum, 0, sizeof(sum));
    for (int i = 1; i <= N; i++) {
        cin >> x[i];
        sum[i] = sum[i-1] + x[i];
    }
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= i; j++) {
            for (int k = 0; k <= sum[i]; k++) {
                if (k >= x[i] && j >= 1) {
                    dp[i][j][k] += dp[i-1][j-1][k-x[i]] + dp[i-1][j][k];
                } else {
                    dp[i][j][k] += dp[i-1][j][k];
                }
            }
        }
    }
    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        ans += dp[N][i][i*A];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 51072
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


class FenwickTree {
    public:
        FenwickTree(int n) : N(n), data(n, 0) {

        }

        void put(int x, int v) {
            for (; x < N; x |= x + 1) {
                data[x] += v;
            }
        }

        int get(int x) {
            int res = 0;
            for (; x >= 0; x = (x & (x + 1)) - 1) {
                res += data[x];
            }
            return res;
        }

        int get(int l, int r) {
            if (l > r) {
                return 0;
            }
            return get(r) - get(l - 1);
        }
    private:
        int N;
        vector<int> data;
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n, q;
    cin >> n >> q;

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

    vector<vector<pair<int,int>>> rights(n);

    for (int i = 0; i < q; ++i) {
        int l, r;
        cin >> l >> r;
        --l, --r;
        rights[r].emplace_back(l, i);
    }

    FenwickTree ft(n + 100);
    vector<int> pos(n, -1);
    vector<int> res(q, 0);
    for (int i = 0; i < n; ++i) {
        if (pos[A[i]] >= 0) {
            ft.put(pos[A[i]], -1);
        }
        ft.put(i, 1);
        pos[A[i]] = i;

        for (auto& qr : rights[i]) {
            int l = qr.first;
            int idx = qr.second;
            res[idx] = ft.get(l, i);
        }
    }

    for (int i = 0; i < q; ++i) {
        cout << res[i] << '\n';
    }
    

    return 0;
}

Measured memory_bytes: 33268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<long long> vll;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  string s;
  cin>>s;
  if(s[0]=='a'||s[0]=='e'||s[0]=='i'||s[0]=='o'||s[0]=='u')
  {
      cout<<"vowel"<<endl;
  }
  else
  {
      cout<<"consonant"<<endl;
  }
   return 0;
}


Measured memory_bytes: 256
<?php
$valuetNum = trim(fgets(STDIN));
$values = getSpacesByExplodeInput();
 
echo sprintf("%d %d %d", min($values), max($values), array_sum($values)), PHP_EOL;
 
function getSpacesByExplodeInput()
{
    return explode(' ', trim(fgets(STDIN)));
}
 

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

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'
#define DEBUGP(x) cerr << #x << ": " << x.first << " \t" << x.second << '\n'

int n, x, y;

VI res(10000,0);
signed main()
{
    cin >> n >> x >> y;
    x--;y--;;

    res.resize(n);
    
    REP(i, n){
        FOR(j, i+1, n){
            int a =  min(j-i, abs(x-i) + 1 + abs(j-y));
            res[a]++;
        }
    }
    FOR(i, 1, res.size()){
        cout << res[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 384
def main(a,b):
    a1 = a / 0.08
    a2 = (a+1) / 0.08
    b1 = b / 0.1
    b2 = (b+1) / 0.1
    x = max(a1,b1)
    y = min(a2,b2)
    if (y <= x):
        return -1
    else:
        if(x//1 == x):
            return x
        elif(y > (x//1)+1):
            return x+1
    return -1


a,b = list(map(int,input().split()))
print(int(main(a,b)))

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 文字列の入力
      String s = sc.next();
      boolean jud = true;
	  String[] st = new String[4];
      
      for(int i=0; i<4;i++){
        st[i] = s.substring(i,i+1);
      }
      for(int i=0;i<3;i++){
        if(st[i].equals(st[i+1])){
          jud = false;
        }
      }
      if(jud){
        System.out.println("Good");
	}else{
        System.out.println("Bad");
      }
    }
}

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

// ------------------------

void solve() {
    int mat[3][3];
    rep(i, 3)rep(j, 3)cin >> mat[i][j];

    for(int a1 = 0; a1 <= mat[0][0]; ++a1){
        for(int a2 = 0; a2 <= mat[1][0]; ++a2){
            for(int a3 = 0; a3 <= mat[2][0]; ++a3){
                int count = 0;
                rep(i, 3){
                    if( (mat[0][i] - a1) == (mat[1][i] - a2) ){
                        if( (mat[1][i] - a2) == (mat[2][i] - a3) ){
                            ++count;
                        }
                    }
                }
                if(count == 3){
                    cout << "Yes" << "\n";
                    return;
                }
            }
        }
    }

    cout << "No" << "\n";
    return;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
double x[11] = { 48,51,54,57,60,64,69,75,81,91,1000000000 }, a;
string S[11] = { "light fly","fly","bantam","feather","light","light welter","welter","light middle","middle","light heavy","heavy" };
int main() {
	while (cin >> a) {
		for (int i = 0; i < 11; i++) {
			if (a <= x[i]) { cout << S[i] << endl; break; }
		}
	}
}

Measured memory_bytes: 1224
#include <stdio.h>
int main(){
	int n,m,c[200002],i,a,b;
	scanf("%d%d",&n,&m);
	for(i=0;i<200002;i++)
	c[i]=0;
	for(i=0;i<m;i++){
		scanf("%d%d",&a,&b);
		if(a==1)
		c[b]++;
		if(b==n)
		c[a]++;
	}
	for(i=1;i<=n;i++){
		if(c[i]==2){
		   printf("POSSIBLE");
		   return 0;
		 }
	}
	printf("IMPOSSIBLE");
    return 0;
 }

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

int main(){
 int n = 0;
 cin >> n;
 vector<long> S;
 for(int i = 0; i < n; i++){
  long buf = 0;
  cin >> buf;
  if( find(S.begin(), S.end(), buf) == S.end())
   S.push_back(buf);
 }
 sort(S.begin(), S.end());

 int q = 0;
 cin >> q;
 vector<long> T;
 for(int i = 0; i < q; i++){
  long buf = 0;
  cin >> buf;
   T.push_back(buf);
 }
 sort(T.begin(), T.end());

 int n_count = 0;

 vector<long>::iterator itS, itT; 
 for(itS = S.begin(), itT = T.begin(); itS != S.end() || itT != T.end(); itS++){
   if(*itS > *itT){
    vector<long>::iterator pos = find(itT, T.end(), *itS);
    if(pos != T.end()) itT = pos;
   }
   if(*itS == *itT){n_count++; itT++;
   }
 }
 
 cout << n_count << '\n'; 

 return 0;
}

Measured memory_bytes: 2064
#include<bits/stdc++.h>
using namespace std;
int main(){
    long n;
    cin >> n;
    if(n==1){
        cout << 1 << endl;
        return 0;
    }
    long j;
    long log=0;
    for(int i=1;i<=n;i++){
        j=i*i;
        if(j>n){
            
            log=(i-1)*(i-1);
            cout << log <<endl;
            return 0;
        }
    }
    
}

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

#define ll long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;

ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    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;
    }
}
ll 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;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
int main() {
    int N=in();
    vector<ll>a;
    ll temp;
    REP(i,N){
        cin>>temp;
        a.push_back(temp);
    }
    sort(a.begin(),a.end());
    ll m;m=1;
    int cnt;cnt=0;
    int ans;ans=0;
    REP(i,N){
        if(a[i]==m){
            cnt++;
        }else{
            if(m<=cnt){
                ans+=cnt-m;
            }else{
                ans+=cnt;
                
            }
            m=a[i];
            cnt=1;
        }
    }
    
            if(m<=cnt){
                ans+=cnt-m;
            }else{
                ans+=cnt;
            }
            print(ans);
            return 0;

}

Measured memory_bytes: 1400
tmp_list1=[]
tmp_list2=[]
for i in range(4):
    num=int(input())
    tmp_list1.append(num)
    
for i in range(2):
    num=int(input())
    tmp_list2.append(num)
final_ans = sum(sorted(tmp_list1, reverse=True)[0:3])+max(tmp_list2)
print(final_ans)


Measured memory_bytes: 5600
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;
static const ll MAX_L = (ll)1 << 62;

ll D[31][31] = {};
ll c[501][501] = {};
ll dx[31][501][501] = {};

int main() {
	ll n, C; cin >> n >> C;
	repe(i, 1, C)repe(j, 1, C)cin >> D[i][j];
	repe(i, 1, n)repe(j, 1, n)cin >> c[i][j];

	repe(i, 1, C) {
		repe(x, 1, n)repe(y, 1, n) {
			ll color1 = c[x][y];
			ll color2 = i;
			dx[i][x][y] = D[color1][i];
		}
	}

	ll sum[3][31] = {};
	repe(i, 1, C) {
		repe(x, 1, n)repe(y, 1, n) {
			sum[(x + y) % 3][i] += dx[i][x][y];
		}
	}

	ll minV = MAX_L;
	repe(i, 1, C)repe(j, 1, C)repe(k, 1, C) {
		if (i != j && i != k && j != k) {
			minV = min(minV, sum[0][i] + sum[1][j] + sum[2][k]);
		}
	}

	cout << minV << endl;
	return 0;
}

Measured memory_bytes: 61056
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

const int N = 2e5 + 5;
VI adj[N];
VI comp[2];
int ans[N];

void dfs(int u, int p, int d) {
  comp[d].push_back(u);
  for (int v: adj[u]) {
    if (v == p) continue;
    dfs(v, u, d ^ 1);
  }
}

int n;
int f[] = {3, 1, 2};
int get(int x) {
  if (f[x] > n) return -1;
  f[x] += 3;
  return f[x] - 3;
}
template<typename... Args>
int get(int x, Args&&... args) {
  int res = get(x);
  if (res == -1) res = get(args...);
  return res;
}

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b; cin >> a >> b;
    --a, --b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }

  dfs(0, 0, 0);


  if (comp[0].size() > comp[1].size()) {
    swap(comp[0], comp[1]);
  }

  if ((int) comp[0].size() <= n / 3) {
    for (int u: comp[0]) {
      ans[u] = get(0);
    }
    for (int v: comp[1]) {
      ans[v] = get(1, 2, 0);
    }
  } else {
    for (int u: comp[0]) {
      ans[u] = get(1, 0);
    }
    for (int v: comp[1]) {
      ans[v] = get(2, 0);
    }
  }

  for (int i = 0; i < n; i++) {
    cout << ans[i] << ' ';
  }
  cout << endl;

  return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
    char s[4];
    cin >> s;
    int k = (int) (s[0] - 48) * 10 + s[1] - 48;
    int l = (int) (s[2] - 48) * 10 + s[3] - 48;
    int t[2] = {0, 0};
    if (k > 0 && k <= 12)
        t[0] = 1;
    if (l > 0 && l <= 12)
        t[1] = 2;
    int r=t[0]+t[1];
    if (r==3)
        cout << "AMBIGUOUS";
    if (r==0)
        cout << "NA";
    if (r==1)
        cout << "MMYY";
    if (r==2)
        cout << "YYMM";
}


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

int main() {
  string n;
  int k;
  cin >> n >> k;
  vector<int> d(10, 0);
  for(int i = 0; i < k; i++){
    int a;
    cin >> a;
    d.at(a) = 1;
  }
  
  int m;
  for(int i = 0; i < k; i++){
    if(d.at(i)) continue;
    m = i;
    break;
  }
  int l = n.size();
  int kuri = 0;
  vector<int> ans(l, 10);
  for(int i = 0; i < l; i++){
    int a = n.at(l - 1 - i) - '0' + kuri;
    for(int j = 0; j < 10; j++){
      if(d.at(j)) continue;
      if(j == a){
        ans.at(l - 1 - i) = j;
        kuri = 0;
        break;
      }
      if(j > a){
        ans.at(l - 1 - i) = j;
        kuri = 0;
        for(int x = 0; x < i; x++){
          ans.at(l - 1 - x) = m;
        }
        break;
      }
    }
    if(ans.at(l - 1 - i) == 10){
      for(int x = 0; x <= i; x++){
        ans.at(l - 1 - x) = m;
      }
      kuri = 1;
    }
  }
  
  if(kuri){
    for(int i = 1; i < k; i++){
      if(d.at(i)) continue;
      m = i;
      break;
    }
    cout << m;
  }
  for(int i = 0; i < l; i++){
    cout << ans.at(i);
  }
}


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

using namespace std;

#define ll long long

int main(){
    int n,c=0;
    cin>>n;
    char a[n];
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    for(int i=0; i<n; i++){    
        if(a[i]=='Y'){
            c=1;break;
        }

    }
    if(c==1) cout<<"Four"<<endl;
    else cout<<"Three"<<endl;



}


    



Measured memory_bytes: 256
#include<stdio.h>
main(){
    int a,b,c,d,e,f;
    while(~scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)){
        double det=a*e-b*d;
        double x=(e*c-b*f)/det,y=(-d*c+a*f)/det;
        if(-1e-6<x && x<1e-6) x=0;
        if(-1e-6<y && y<1e-6) y=0;
        printf("%.3f %.3f\n",x,y);
    }
    exit(0);
}

Measured memory_bytes: 632
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    rep(i,n-1){
        int cmp = 0;
        set<char> x;
        for(int j = 0; j <= i; ++j){
            x.insert(s[j]);
        }
        set<char> y;
        for(int j = i+1; j < n; ++j){
            y.insert(s[j]);
        }
        for(auto p : x){
            if(y.find(p) != y.end()) ++cmp;
        }
        chmax(ans, cmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a, sp = 0;
		int[] stack = new int[10];
		while(sc.hasNext()){
			a = sc.nextInt();
			if(a == 0){
				System.out.println(stack[--sp]);
			}else{
				stack[sp++] = a;
			}
		}
	}
}

Measured memory_bytes: 12000
#include<iostream>  
#include<cmath>
#include<string>
#include<stack>
#include<queue> 
#include<algorithm>
#include<stdlib.h> 
#include<ctime>
#include<iomanip>
#include<vector>
using namespace std;
int main(){
	int x,y,z;
	cin>>x>>y>>z;
	cout<<z<<" "<<x<<" "<<y;
}

Measured memory_bytes: 256
#include <stdio.h>

void swap(int *a, int *b) {
    int temp = *a;
    *a = *b;
    *b = temp;
}


int main(int argc, char const *argv[]) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);

    if (a > b) {
        swap(&a, &b);
    }

    if (b > c) {
        swap(&b, &c);
    }

    if (a > b) {
        swap(&a, &b);
    }

    printf("%d %d %d\n", a, b, c);

    return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
	__INIT() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}__init;

int main(void) {
    ll x,k,d;
    cin>>x>>k>>d;
    x = abs(x);
    if(k > x/d){
        k -= (x/d+1);
        if(k%2 == 0) cout<<abs(x-d*(x/d+1))<<endl;
        else cout<<abs(x-d*(x/d))<<endl;
    }
    else{
        cout<<x-d*k<<endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#![allow(non_snake_case)]

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let A = iter.next().unwrap().parse::<isize>().unwrap();
    let B = iter.next().unwrap().parse::<isize>().unwrap();
    let (a, b) = (A as f64, B as f64);

    println!("{} {} {}", A / B, A % B, a / b);
}



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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'; 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) (1ll << 63);
const ll MAXN = (ll) 1e3 + 10;
const ll N = 1e5 + 100;
const ll INF = (ll) 3215;
const ld EPS = (ld) 1e-8;
const ll LOG = 20;

pll adj[] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
ll dis[MAXN][MAXN];
queue<pll> q;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	memset(dis, 31, sizeof dis);
	ll h, w;
	cin >> h >> w;
	char x;
	for(int i = 1; i <= h; i++) for(int j = 1; j <= w; j++){
		cin >> x;
		if(x == '#'){
			q.push({i, j});
			dis[i][j] = 0;
		}
	}
	ll ans = 0;
	while(q.size()){
		pll fr = q.front();
		q.pop();
		for(auto del : adj){
			ll nx = fr.F + del.F;
			ll ny = fr.S + del.S;
			if((nx < 1) or (nx > h) or (ny < 1) or (ny > w)) continue;
			if(dis[nx][ny] > dis[fr.F][fr.S] + 1){
				dis[nx][ny] = dis[fr.F][fr.S] + 1;
				q.push({nx, ny});
				ans = dis[nx][ny];
				//debug(nx); debug(ny);
				//debug(dis[nx][ny]);
			}
		}
	}
	cout << ans;
	return 0;
}

/*
                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/




Measured memory_bytes: 24628
s,t=input(),input()
ls,lt=len(s),len(t)
dp=[[0]*(lt+1) for _ in range(ls+1)]
for i in range(1,ls+1):
  for j in range(1,lt+1):
    if s[i-1]==t[j-1]:dp[i][j]=dp[i-1][j-1]+1
    else:dp[i][j]=max(dp[i-1][j],dp[i][j-1])
l=dp[-1][-1]
i,j,a=ls,lt,""
while l!=0:
  if dp[i][j]==dp[i][j-1]:j-=1
  elif dp[i][j]==dp[i-1][j]:i-=1
  else:a=s[i-1]+a;i-=1;j-=1;l-=1
print(a)

Measured memory_bytes: 112220
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif

//改造
typedef long long int ll;
using namespace std;


//ここから編集する

ll max(ll a,ll b){
    if(a > b) return a;
    return b;
}

ll min(ll a,ll b){
    if(a > b) return b;
    return a;
}

int main() {
    ll H, W;
    int x, y;
    cin >> H >> W;
    ll minv = H * W;
    if (H % 3 == 0 || W % 3 == 0) {
        minv = 0;
    } else {
        ll tmp = min(W, H);
        if (minv > tmp) {
            minv = tmp;
            x = 114514;
            y = 8101919;
        }
        for (int i = 1; i <= H; i++) {
            int k = i;
            ll s1 = k * W;
            ll s2 = (H - k) * (W / 2);
            ll s3 = (H - k) * (W - (W / 2));
            ll maxs = max(s1, max(s2, s3));
            ll mins = min(s1, min(s2, s3));
            tmp = maxs - mins;
            if (minv > tmp) {
                minv = tmp;
                x = k;
                y = W / 2;
            }
        }
        swap(H, W);
        for (int i = 1; i <= H; i++) {
            int k = i;
            ll s1 = k * W;
            ll s2 = (H - k) * (W / 2);
            ll s3 = (H - k) * (W - (W / 2));
            ll maxs = max(s1, max(s2, s3));
            ll mins = min(s1, min(s2, s3));
            tmp = maxs - mins;
            if (minv > tmp) {
                minv = tmp;
                x = k;
                y = W / 2;
            }
        }
        if (minv < 0) {
            cout << "x:" << x << " y:" << y << endl;
            return 0;
        }
    }
    cout << minv << endl;
//    cout << "x:" << x << " y:" << y << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int main(){
  long long T1;
  long long T2;
  long long A1;
  long long A2;
  long long B1;
  long long B2;
  long long x1;
  long long x2;
  long long y1;
  long long y2;
  long long res;
  rd(T1);
  rd(T2);
  rd(A1);
  rd(A2);
  rd(B1);
  rd(B2);
  x1 = T1 * A1;
  x2 = x1 + T2 * A2;
  y1 = T1 * B1;
  y2 = y1 + T2 * B2;
  if(x1 == y1 || x2 == y2){
    wt_L("infinity");
    wt_L('\n');
    return 0;
  }
  if(x2 > y2){
    swap(x1,y1);
    swap(x2,y2);
  }
  if(y1 > x1){
    wt_L(0);
    wt_L('\n');
    return 0;
  }
  res = (x1-y1)/(y2-x2) * 2 + 1;
  if((x1-y1)%(y2-x2) == 0){
    res--;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191227-1

// --- original code ---
// {
//   ll T1, T2, A1, A2, B1, B2;
//   ll x1, x2, y1, y2;
//   ll res;
//   rd(T1,T2,A1,A2,B1,B2);
//   x1 = T1 * A1; x2 = x1 + T2 * A2;
//   y1 = T1 * B1; y2 = y1 + T2 * B2;
// 
//   if(x1 == y1 || x2 == y2) wt("infinity"), return 0;
//   if(x2 > y2){
//     swap(x1,y1);
//     swap(x2,y2);
//   }
//   if(y1 > x1) wt(0), return 0;
// 
//   res = (x1-y1)/(y2-x2) * 2 + 1;
//   if((x1-y1)%(y2-x2) == 0) res--;
//   wt(res);
// }


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

int main(){
  int n;
  cin >> n;
  vector<int> vec(n);
  for(int i=0; i<n; i++){
    cin >> vec.at(i);
  }
  map<int,int> odd;
  map<int,int> even;
  
  for(int i=0; i<n; i++){
    if(i %2 == 0){
      if(odd.count(vec.at(i))){
        odd[vec.at(i)]++;
      }
      else{
        odd[vec.at(i)] = 1;
      }
    }
    else{
      if(even.count(vec.at(i))){
        even[vec.at(i)]++;
      }
      else{
        even[vec.at(i)] = 1;
      }
    }
  }
  
  int max_even = 0;
  int even_x = 0;
  int second_even = 0;
  int sec_even_x = 0;
  
  int max_odd = 0;
  int odd_x = 0;
  int second_odd = 0;
  int sec_odd_x = 0;
  
  for(auto itr = odd.begin(); itr != odd.end(); ++itr){
    int x = itr->second;
    if(second_odd <= x){
      second_odd = x;
      sec_odd_x = itr->first;
    }
    if(second_odd >= max_odd){
      swap(second_odd,max_odd);
      swap(sec_odd_x,odd_x);
    }
  }
  for(auto itr = even.begin(); itr != even.end(); ++itr){
    int x = itr->second;
    if(second_even <= x){
      second_even = x;
      sec_even_x = itr->first;
    }
    if(second_even >= max_even){
      swap(second_even,max_even);
      swap(sec_even_x,even_x);
    }
  }
  
  int ans =  n - max_even - max_odd;
  if(even_x == odd_x){
    ans += min(max_even - second_even, max_odd - second_odd);
  }
  cout << ans << endl;
}

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

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    string s;
    cin >> s;

    cout << stoi(s.substr(0, 1)) + stoi(s.substr(1, 1)) + stoi(s.substr(2, 1)) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//CODE

void solve(void)
{
  int N,K;
  cin>>N>>K;
  vector<int> v;
  v.push_back(0);

  for (int i = 1; i <= N; i++)
  {
    v.push_back(i);
    if( i < N/i)
    {
      v.push_back(N/i);
    }else break;
  }

  sort(ALL(v));

  const int M = v.size() -1;

  vector<vector<int> > DP (K+1,vector<int>(M+1,0));
  vector<vector<int> > AC (K+1,vector<int>(M+1,0));
for (int j = 1; j <= M; j++)
{
  DP[1][j] = v[j] - v[j-1];
  AC[1][j] = (AC[1][j-1] + DP[1][j]) %MOD;
}

for (int i = 2; i <= K; i++)
{
  for (int j = 1; j <= M; j++)
  {
    int op = lower_bound(ALL(v),N/v[j])- v.begin();
    // op = distance(lower_bound(ALL(v),N/v[j]), v.begin());
    // DEBUG(op);
    DP[i][j] = (v[j] - v[j-1])*AC[i-1][op]%MOD;//累積PD
    AC[i][j] = (AC[i][j-1] + DP[i][j])%MOD;
  }
  
}

cout<<AC[K][M]<<endl;


  
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 101256
#include <cstdio>
#include <queue>
#include <map>
using namespace std;
#define N 2005
#define V 40005
#define Inf (1<<30) 
int n,m;
int a[N];
bool b[N][N];
int ans[N];
bool inAns[N];
int ansSz;
int lastNotCoprime[N];
int minOnSuff[N];
int comp[V];
vector<int> g[V];
int C;
int bestForCol[N];
map<int,int> primeId;
int gcd(int a,int b){
	if(b==0){
		return a;
	}
	return gcd(b,a%b);
}
int getId(int p){
	if(primeId.count(p)>0){
		return primeId[p];
	}
	primeId[p]=m;
	return m++;
}
void dfs(int v){
	comp[v]=C;
	int u;
	for(int i=0;i<(int)g[v].size();i++){
		u=g[v][i];
		if(comp[u]!=-1){
			continue;
		}
		if(u<n&&inAns[u]){
			continue;
		}
		dfs(u);
	}
}
void colors(){
	for(int i=0;i<m;i++){
		comp[i]=-1;
	}
	C=0;
	for(int i=0;i<n;i++){
		if(inAns[i]){
			continue;
		}
		if(comp[i]!=-1){
			continue;
		}
		dfs(i);
		C++;
	}
}
int mn(int a,int b){
	return a<b?a:b;
}
int main(){
	scanf("%d",&n);
	m=n;
	int x,id;
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		x=a[i];
		for(int j=2;j*j<=x;j++){
			if(x%j!=0){
				continue;
			}
			id=getId(j);
			g[i].push_back(id);
			g[id].push_back(i);
			while(x%j==0){
				x/=j;
			}
		}
		if(x>1){
			id=getId(x);
			g[i].push_back(id);
			g[id].push_back(i);
		}
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(gcd(a[i],a[j])>1){
				b[i][j]=b[j][i]=1;
			}
		}
	}
	for(int i=0;i<n;i++){
		lastNotCoprime[i]=-1;
	}
	for(int i=0;i<n;i++){
		minOnSuff[i]=Inf;
	}
	while(ansSz<n){
		colors();
		for(int i=0;i<C;i++){
			bestForCol[i]=-1;
		}
		for(int i=0;i<n;i++){
			if(inAns[i]){
				continue;
			}
			if(minOnSuff[lastNotCoprime[i]+1]<a[i]){
				continue;
			}
			if(bestForCol[comp[i]]==-1||a[bestForCol[comp[i]]]>a[i]){
				bestForCol[comp[i]]=i;
			}
		}
		id=-1;
		for(int i=0;i<C;i++){
			if(bestForCol[i]==-1){
				continue;
			}
			if(id==-1||a[id]<a[bestForCol[i]]){
				id=bestForCol[i];
			}
		}
		inAns[id]=1;
		ans[ansSz++]=a[id];
		for(int i=0;i<ansSz;i++){
			minOnSuff[i]=mn(minOnSuff[i],a[id]);
		}
		for(int i=0;i<n;i++){
			if(b[id][i]){
				lastNotCoprime[i]=ansSz-1;
			}
		}
	}
	for(int i=0;i<n;i++){
		printf("%d ",ans[i]);
	}
	puts("");
	return 0;
}


Measured memory_bytes: 5376
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <stdlib.h>
#include <functional>
#define ll long long
#define llu unsigned long long
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
using namespace std;
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
int n, m;
ll A[2*N];
ll psum[2*N];
ll pxor[2*N];

ll combination2(ll n) {
	return n * (n - 1) / 2;
}


int main()
{
	int i, j, k, x, y, u, v, num, t, test;

	scanf("%d", &n);

	for (i = 1; i <= n; ++i) {
		scanf("%lld", &A[i]);
		psum[i] = psum[i - 1] + A[i];
		pxor[i] = (pxor[i - 1] ^ A[i]);
	}

	int left = 1;
	int right = 1;
	ll cnt = 0;
	
	int nn;
	while (1) {
		if (right > n) {
			nn = right - left;
			cnt += combination2(nn + 1);
			break;
		}
		if ((pxor[right] ^ pxor[left - 1]) == (psum[right] - psum[left - 1])) right++;
		else {
			nn = right - left;
			cnt += combination2(nn + 1);
			while ((pxor[right] ^ pxor[left - 1]) != (psum[right] - psum[left - 1])) left++;
			nn = right - left;
			cnt -= combination2(nn + 1);

		}
	}
	printf("%lld\n", cnt);
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

string m[]={"1","1","2","6","24","120","720","5040","40320","362880","3628800","39916800","479001600","6227020800","87178291200","1307674368000","20922789888000","355687428096000","6402373705728000","121645100408832000","2432902008176640000","51090942171709440000"};

int main() {

  int n;cin>>n;cout<<m[n]<<endl;

  return 0;
}

Measured memory_bytes: 1196
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <queue>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

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

  vector<double> p;

  double r;
  for (int i = 0; i < n; i++) {
    cin >> r;
    p.push_back(r);
  }

  double dp[n + 1][n + 1];
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      dp[i][j] = 0.0;
    }
  }
  dp[0][0] = 1.0;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      dp[i + 1][j + 1] += dp[i][j] * p[i];
      dp[i + 1][j] += dp[i][j] * (1.0 - p[i]);
    }
  }

  double ans = 0.0;

  for (int i = (n + 1) / 2; i <= n; i++) {
    ans += dp[n][i];
  }

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

  return 0;
}


Measured memory_bytes: 70656
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using namespace std; using INT = int64_t; using II = pair<INT, INT>;
template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; template <class T> using VVV = V<VV<T>>;
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream &s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream &s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;

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


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<list>
#include<string>
#include<algorithm>
 
using namespace std;
 
int main(){
  int k,s;
  cin >> k >> s;
  int ans=0;
  for(int x=0;x<=k;x++){
    for(int y=0;y<=k;y++){
      int z = s - x -y;
      if(z >= 0 && z <= k){
        ans++;
      }
    }
  }

  cout << ans << endl;
}


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

int main(){
    int n;
    string s;
    cin >> n >> s;
    int start[26];
    int end[26];
    int count[26];
    for(int i = 0; i < 26; i++){
        start[i] = 0;
        end[i] = 0;
        count[i] = 0;
    }
    for(int i = 0; i < n; i++){
        char index = s[i] - 'a';
        int iindex = (int)index;
        if(count[iindex] == 0){
            count[iindex]++;
            start[iindex] = i;
        }else{
            count[iindex]++;
            end[iindex] = i;
        }
    }

    int ans = 0;
    for(int i = 0; i < n-1; i++){
        int tmp_ans = 0;
        for(int j = 0; j < 26; j++){
            if(start[j] <= i && end[j] > i) tmp_ans++;
        }
        ans = max(ans, tmp_ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  int N; cin >> N;
  string s; cin >> s;
  int ans = 1;
  FOR(i,0,N-1) {
    if(s[i] == 'x' && s[i+1] == 'x') break;
    else {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3340
MOD = 998244353

N,K = map(int,input().split())

l = []
dp = [0]*N
sdp = [0]*(N+1)
for i in range(K):
    L,R = map(int,input().split())
    l.append([L,R])
dp[0] = 1
sdp[1] = 1

for i in range(1,N):
    for L, R in l:
        dp[i] += sdp[max(0,i - L+1)] - sdp[max(0,i - R)]
        dp[i] %= MOD
    sdp[i+1] = sdp[i] + dp[i]
    sdp[i+1] %= MOD

print(dp[N-1])

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

int main() {
	unsigned int	N;
	cin >> N;
	int	M;
	cin >> M;
	rep(i, 1 << N)
	{
		if (__builtin_popcount(i) != M)
			continue;
		cout << i << ':';
		rep(j, N)
		{
			if (i & (1 << j))	
				cout << ' ' << j;
		}
		cout << endl;
	}
}



Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29

int main() {
	int n, ans = INF, sumE[300000] = {}, sumW[300000] = {};
	string s;
	cin >> n >> s;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'W') sumW[i + 1] = sumW[i] + 1;
		else sumW[i + 1] = sumW[i];
	}
	for (int i = n - 1; i > 0; i--) {
		if (s[i] == 'E') sumE[i - 1] = sumE[i] + 1;
		else sumE[i - 1] = sumE[i];
	}
	rep(i, n) {
		ans = min(ans, sumW[i] + sumE[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3204
let () = Scanf.scanf "%d\n%d\n" @@ fun n k ->
  let xs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun x -> x in
  Array.map (fun x -> min x @@ abs @@ x - k) xs
  |> Array.map (( * ) 2)
  |> Array.fold_left ( + ) 0
  |> Printf.printf "%d\n"

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
  int r;
  cin >> r;
  cout << 3 * r * r << endl;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define chmin(x,y) x = min(x,y)
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;



int main() {
    int n,k;
    cin>>n>>k;
    vector<int> h(n);
    rep(i,n) cin>>h[i];
    ll dp[110000];
    rep(i,110000) dp[i] = INF;
    dp[0]=0;
    
    rep(i,n){
        for(int j=1;j<=k;j++){
            chmin(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
        }
    }
                      
    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1536
#include<stdio.h>

main(void)
{
  char enki[2];
  
  scanf("%s",enki);
  
  if(('A'==enki[0])||('T'==enki[0])||('C'==enki[0])||('G'==enki[0]))
  {
    if('A'==enki[0])
      printf("T");
    else if('T'==enki[0])
      printf("A");
    else if('C'==enki[0])
      printf("G");
    else 
      printf("C");
  }
  
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
	private static void show(int[] a) {
		for (int t = 0; t < a.length; ++t) {
			System.out.print(a[t]);
			if (t != a.length - 1) 
				System.out.print(" ");
		}
		System.out.println();
	}
	
	public static void insertionSort(int[] a) {
		for (int i = 1; i < a.length; ++i) {
			int v = a[i];
			int j = i - 1;
			
			while (j >= 0 && a[j] > v) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = v;
			show(a);
		}
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; ++i)
			a[i] = scan.nextInt();
		show(a);
		insertionSort(a);
	}
}



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

int main(){
   int N;
   cin >> N;
   vector<int> d(N);
   for (int i=0; i<N; i++){
      cin >> d.at(i);
   }
   sort(d.begin(), d.end());
   vector<int> d_f(N/2);
   vector<int> d_r(N/2);
   for (int i=0; i<N/2; i++){
      d_f.at(i) = d.at(i);
      d_r.at(i) = d.at(N/2+i);
   }

   cout << d_r.at(0) - d_f.at(N/2-1) << endl;
}



Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#define ll int64_t
#define REP(i, n) for (ll i=0; i<n; i++)
using namespace std;

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

    ll N;
    string S;
    cin >> N >> S;

    vector<ll> count(26, 1);

    for (auto e : S) {
        count[e-'a']++;
    }

    ll ans = 1;
    for (auto e : count) {
        ans *= e;
        ans %= 1000000007;
    }

    cout << ans-1 << "\n";
}

Measured memory_bytes: 512