akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.IO.Pipes;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        void Omame()
        {
            cin = new Scanner();
            int K = cin.nextInt();
            int N = cin.nextInt();
            List<int> list = new List<int>();
            for (int i = 0; i < N; i++)
            {
                list.Add(cin.nextInt());
            }

            long ans = list[N - 1] - list[0];

            for (int i = 1; i < N; i++)
            {
                long tmpAns = list[i-1] + K - list[i];
                ans = Math.Min(ans, tmpAns);
            }
            Console.WriteLine(ans);
        }

    }
}


Measured memory_bytes: 35676
#include <cstdio>
#include <cmath>
#include <string>
#include <iostream>

#define rep( i, n, m ) for (int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for (int i = ( n ); i < ( m ); i--)

int main( void ){
	int n, k, q;
	if(!scanf( "%d%d%d", &n, &k, &q ))
		return -1;
	int* array = new int[ n ];
	rep( i, 0, n )  array[ i ] = k - q;
	rep( i, 0, q ){
		int num;
		if(!scanf( "%d", &num ))
			return -1;
		array[ num-1 ]++;
	}
	rep( i, 0, n ){
		if (array[ i ] > 0)
			printf( "Yes\n" );
		else
			printf( "No\n" );
	}

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <algorithm>
#include <limits.h>
#include <cmath>
#include <time.h>
#include <cstdio>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/*  */
int main(void)
{
  int test = 1;
  int i,j,k,l;
  int n;
  int min = INT_MAX;
  int rep = INT_MIN;
  int a;
  scanf("%d",&n);
  rep(i,n) {
    scanf("%d",&a);
    if(a - min > rep) rep = a - min;
    if(min > a) min = a;
  }
  printf("%d\n",rep);
  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ;i++)
using namespace std;
using p=pair<int,int>;
const int IMF =100000000;

int main() {
  int n,m,x;
  cin >> n >> m >> x;
  vector<int>c(n);
  vector<vector<int>>a(n, vector<int>(m));
  rep(i,n){
     cin >> c[i];
    rep(j,m){
      cin >> a.at(i).at(j);
    }
  }
  int ans=IMF;
  rep(s,1<<n){
    int cost = 0;
    vector<int>d(m);
    rep(i,n){
      if(s>>i&1){
        cost+=c[i];
        rep(j,m)d[j]+=a[i][j];
      }
    }
    bool f = true;
    rep(j,m){
      if(d[j]<x){
        f=false;
      }
    }
    if(f){
      ans = min(ans,cost);
    }
  }
  if(ans==IMF)cout << -1 << endl;
  else cout << ans << endl;
  
  return 0; 
}



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

typedef long long ll;
int MOD = 1000000007;

int main() {
  int N; cin >> N;
  vector<vector<int>> D(N, vector<int>(2));
  for (int i = 0; i < N; i++) cin >> D[i][0] >> D[i][1];
  
  bool ans = false;
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (D[i][0] == D[i][1]) cnt++;
    else cnt = 0;
    
    if (cnt == 3) ans = true;
  }
  
  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}    

Measured memory_bytes: 3636
#include<bits/stdc++.h>//
using namespace std;
int a;//
int main(){
    cin>>a;//
    switch(a){
        case 19:cout<<"Yes";break;
        case 29:cout<<"Yes";break;
        case 39:cout<<"Yes";break;
        case 49:cout<<"Yes";break;
        case 59:cout<<"Yes";break;
        case 69:cout<<"Yes";break;
        case 79:cout<<"Yes";break;
        case 89:cout<<"Yes";break;
        case 90:cout<<"Yes";break;
        case 91:cout<<"Yes";break;
        case 92:cout<<"Yes";break;
        case 93:cout<<"Yes";break;
        case 94:cout<<"Yes";break;
        case 95:cout<<"Yes";break;
        case 96:cout<<"Yes";break;
        case 97:cout<<"Yes";break;
        case 98:cout<<"Yes";break;
        case 99:cout<<"Yes";break;
        default:cout<<"No";break;
    }//打表大法
    cout<<endl;//回车保平安
    return 0;//结束
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a

L = []
R = []

for i in range(N-1):
  if i == 0:
    L.append(A[0])
  else:
    L.append(gcd(L[i-1], A[i]))

for i in range(N-1):
  if i == 0:
    R.append(A[N-1])
  else:
    R.append(gcd(R[i-1], A[N-1-i]))

M = []
for i in range(N):
  if i == 0:
    M.append(R[N-2])
  elif i == N-1:
    M.append(L[N-2])
  else:
    M.append(gcd(L[i-1], R[N-2-i]))

print(max(M))

Measured memory_bytes: 14488
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<cmath>
#include <bits/stdc++.h>
using namespace std;

signed main(){
	long long int A,B,C,K;
	cin>>A>>B>>C>>K;
	long long int ans = 0;
	if(K >= A){
		ans += A;
		K-=A;
	}else{
		ans = K;
		K = 0;
		goto a;
	}
	if(K >= B){
		K-=B;
	}else{
		K=0;
		goto a;
	}
	ans -= K;
	
	a:
	cout<<ans<<endl;
	
}



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

int main() {
    int N ,Y;
    const int MAN = 10000;
    const int GOSEN = 5000;
    const int SEN = 1000;
    cin >> N >> Y;
    // 金額Yに対して必要な枚数を求めて,Nと等しいか判定
    
    int max_num_man = Y / MAN;
    for(int i = 0; i <= max_num_man; i++) {
        
        int max_num_gosen = (Y - MAN*i) / GOSEN;
        for(int j = 0; j <= max_num_gosen; j++) {
            
            int k = N -i -j;
            if(MAN*i + GOSEN*j +  SEN*k == Y) {
                cout << i << ' ' << j << ' ' << k << endl;
                exit(0);
            }
        }
    }
    cout << -1 << ' '<< -1 << ' '<< -1 << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <tuple>
#include <algorithm>
using namespace std;
#define REP(n) for(int i=0;i<n;i++)

long long buf[1000001] = { 0 };

int main() {

	long long N;

	cin >> N;
	buf[N] += 1;
	int ans = 1;
	while (true) {
		if (N % 2 == 0) {
			N = N / 2;
			buf[N] += 1;
			ans++;
			if (buf[N] > 1) {
				break;
			}
		}
		else {
			N = 3 * N + 1;
			buf[N] += 1;
			ans++;
			if (buf[N] > 1) {
				break;
			}
		}
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 256
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let n: usize = sc.read();
    let mut tree = vec![vec![]; n];
    for _ in 1..n {
        let a = sc.read::<usize>();
        let b = sc.read::<usize>();
        tree[a].push(b);
        tree[b].push(a);
    }

    match (0..n).find(|&i| tree[i].len() > 2) {
        None => println!("1"),
        Some(root) => {
            let (_, ans) = dfs(root, root, &tree);
            println!("{}", ans);
        }
    }
}

fn dfs(v: usize, p: usize, graph: &Vec<Vec<usize>>) -> (bool, usize) {
    let mut children = 0;
    let mut sum = 0;
    let mut has_line = false;
    for &next in graph[v].iter().filter(|&&next| next != p) {
        children += 1;
        let (only_line, count) = dfs(next, v, graph);
        sum += count;
        assert!(!only_line || count == 1);
        has_line |= only_line;
    }

    if children == 0 {
        (true, 1)
    } else if children == 1 {
        (has_line, sum)
    } else {
        if has_line {
            (false, sum - 1)
        } else {
            (false, sum)
        }
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    string s; ll K; cin >> s >> K;
    int n = s.size();
    vec a(n);
    rep(i, n){
        a[i] = (26 - (s[i]-'a'))%26;
    }
    rep(i, n){
        if(a[i] <= K){
            K -= a[i];
            a[i] = 0;
        }
    }
    ll cnt = 0;
    if(K > 0){
        cnt = K%26;
    }
    string t = s;
    rep(i, n){
        if(a[i] == 0){
            t[i] = 'a';
        }
    }
    t[n-1] = char((t[n-1]-'a'+cnt)%26 + 'a');
    cout << t << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
typedef long long ll;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb           push_back
#define ff           first
#define ss           second
#define gcd(a, b)    __gcd(a, b)
#define lcm(a, b)    ((a)*((b)/gcd(a,b)))
#define all(v)       v.begin(),v.end()
#define lllim        2147483648
#define Pi           2*acos(0.0)
#define sci(n)	     scanf("%d",&n)
#define scii(n,m)    scanf("%d%d",&n,&m)
#define scl(n)       scanf("%lld",&n)
#define scll(n,m)    scanf("%lld%lld",&n,&m)
#define pii          pair<int,int>
#define pll 	     pair<ll,ll>
#define mem(a,b)     memset(a, b, sizeof(a))
#define fill_(a,b)   fill(a,a+n,b);
#define MOD          1000000007
#define fast_cin     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define filein       freopen("input.txt","r", stdin)
#define watch(x)   	 cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'

/*------------------------------Graph Moves----------------------------*/
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]= {+0,+0,+1,-1,-1,+1,-1,+1};  // Kings Move
//const int fy[]= {-1,+1,+0,+0,+1,+1,-1,-1}; // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

using namespace std;
using namespace __gnu_pbds;
const int maxn=3000005;

vector<ll>pr;
bool mark[maxn];

void si()
{
    for(ll i=4; i<maxn; i+=2) mark[i]=1;
    for(ll i=3; i*i<maxn; i+=2)
        if(!mark[i])
            for(ll j=i*i; j<maxn; j+=i)
                mark[j]=1;
    pr.pb(2);
    for(ll i=3; i<maxn; i+=2)
        if(!mark[i])
            pr.pb(i);
}


int main()
{
    // fast_cin;
    int t,cas=1;
    //si();
    int n;
    scanf("%d",&n);

    int ara[n+2];

    for(int i=0;i<n;i++) scanf("%d",&ara[i]);

    sort(ara,ara+n);

    int mi=ara[n/2-1];
    int mx=ara[n/2];

    int ans=mx-mi;

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


    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(long long i=0;i<(n);++i)
#define Fr(i,n) for(long long i=1;i<=(n);++i)
#define ifr(i,n) for(long long i=(n)-1;i>=0;--i)
#define iFr(i,n) for(long long i=(n);i>0;--i)
using Graph = vector<vector<int>>;

 
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n,q,p,ans,b,a,c;
  cin>>n;
  ans=0;
  a=0;
  c=0;
  ll arra[n];
  ll arrb[n];
  ll arrc[n];
  fr(i,n){
      ll r;
      cin>>r;
      arra[i]=r;
  }
  fr(i,n){
      ll r;
      cin>>r;
      arrb[i]=r;
  }
  fr(i,n){
      ll r;
      cin>>r;
      arrc[i]=r;
  }
  sort(arra,arra+n);
  sort(arrb,arrb+n);
  sort(arrc,arrc+n);
  fr(i,n){
      while(a!=n and arra[a]<arrb[i]) ++a;
      while(c!=n and arrc[c]<=arrb[i]) ++c;
      ans+=(a)*(n-c);
  }
  cout<<ans;
}

Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] strArray  = Console.ReadLine().Split(' ');
            
            int[]intArray = new int[strArray.Length];
            for (int i = 0; i < strArray.Length; ++i)
            {
                intArray[i] = int.Parse(strArray[i]);
            }
            int w = intArray[0];
            int h = intArray[1];
            int x = intArray[2];
            int y = intArray[3];
            int r = intArray[4];

            if (x - r >= 0 && x + r <= w &&  y - r >= 0 && y + r <= h)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

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

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

#define rep(n) for (int i = 0; i < n; ++i)

#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef pair<int, int> pii;
typedef double D;
typedef complex<D> P;
typedef vector<string> vs;

#define SZ(x) ((int)(x).size())

#define fill(x,y) memset(x,y,sizeof(x))

// with compile option -DLOCAL
#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

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; }

#define pcnt __builtin_popcount
#define pcntll __builtin_popcountll

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};



#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

const int MOD = 1e9 + 7;
const int INF = INT_MAX;

signed main() {
    Fast();

    int n, T;
    cin >> n >> T;
    int minCost = INF;
    rep(n) {
        int c, t;
        cin >> c >> t;
        if (t <= T && c < minCost)
            minCost = c;
    }

    cout << (minCost == INF ? "TLE" : to_string(minCost)) << endl;

    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <stdio.h>
 
#define BUF_SIZE 120000
 
using namespace std;
 
int main(){
 
    int n;
    scanf("%d",&n);
 
    int S[n];
 
    for(int i = 0; i < n; i++){
        scanf("%d",&S[i]);
    }
 
    int q;
    scanf("%d",&q);
 
    int count = 0;
    int tmp;
 
    for(int i = 0; i < q; i++){
        scanf("%d",&tmp);
        for(int k = 0; k < n; k++){
            if(tmp == S[k]){
                count++;
                break;
            }
        }
    }
 
    printf("%d\n",count);
 
}


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

class Program
{
    static void Main(string[] args)
    {
        string s;
        while ((s = Console.ReadLine()) != null)
        {
            var t = Array.ConvertAll(s.Split(), int.Parse);
            double[][] M = new double[2][];
            M[0] = new double[] { t[0], t[1], t[2] };
            M[1] = new double[] { t[3], t[4], t[5] };
            GaussianJordan(M);
            Console.WriteLine(M[0][2].ToString("f3") + " " + M[1][2].ToString("f3"));
        }
    }

    public static bool GaussianJordan(double[][] M)
    {
        const double EPS = 1e-8;
        int R = M.Length;
        int C = M[0].Length;
        Action<int, int> Swap = (r1, r2) => { var t = M[r1]; M[r1] = M[r2]; M[r2] = t; };

        for (int i = 0; i < R; i++)
        {
            int pivot = i;
            for (int k = i; k < R; k++)
                if (Math.Abs(M[k][i]) > Math.Abs(M[pivot][i]))
                    pivot = k;
            Swap(pivot, i);
            if (Math.Abs(M[i][i]) < EPS) return false;
            for (int j = i + 1; j < C; j++) M[i][j] /= M[i][i];
            M[i][i] = 1;
            for (int k = 0; k < R; k++)
                if (k != i)
                {
                    for (int j = i + 1; j < C; j++)
                        M[k][j] -= M[k][i] * M[i][j];
                    M[k][i] = 0;
                }
        }

        return true;
    }

}

Measured memory_bytes: 20132
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,ans=0,i;
	cin>>a>>b>>c;
	for(i=a;i<=b;i++)
	{
		if(i%c==0)ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3520
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pl;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b+c >21)cout<<"bust"<<endl;
    else cout<<"win"<<endl;
   
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    long long int a, b;
    cin >> a >> b;
    if ( a == 1 || b == 1 )
    {
        if ( a * b == 1 )
        {
            cout << 1;
        }
        else
        {
            cout << a * b - 2;
        }
    }
    else if ( a == 2 || b == 2 )
    {
        cout << 0;
    }
    else
    {
        cout << (a-2) * (b-2);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LOOP(val, times)   for(val = 0; val < (times); val++)
int main(){
  int n,m;
  cin>>n>>m;
  long long ans=0;
  if(m==0){
    for(int i=m+1;i<=n;i++){
    int h=i-m;
    int k=n/i;
    ans+=h*k;
    int aa=n%i;
    if(aa>m){
      ans+=aa-m;
    }
  }
  cout<<ans<<endl;
  }
  else{
    
  for(int i=m+1;i<=n;i++){
    int h=i-m;
    int k=n/i;
    ans+=h*k;
    int aa=n%i;
    if(aa>=m){
      ans+=aa-m+1;
    }
  }
  cout<<ans<<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define int long long int
#define all(x) (x).begin(), (x).end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef pair<int,int> pii;
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ub upper_bound
#define lb lower_bound
#define present(c,x) (c.find(x) != c.end())
#define removeDuplicates(a) a.resize(unique(all(a))-a.begin())
#define endl '\n'	
#define fill(s,x,n) vector
 x(n); rep(i,0,n) cin>>x[i];
#define INF 1000000007 
#define MOD 998244353
#define INF64 1e18

void solve(){
	int n,W,V=0,ans=0;
	cin>>n>>W;
	vector<int> w(n+1),v(n+1);
	rep(i,1,n+1){
		cin>>w[i]>>v[i];
		V+=v[i];
	}

	vector<vector<int>> dp(n+1,vector<int> (V+1,W+1));
	rep(i,0,n+1)
		dp[i][0]=0;

	rep(i,1,n+1){
		rep(j,1,V+1){
			dp[i][j]=dp[i-1][j];
			if(j>=v[i])
				dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);

			if(dp[i][j]<=W)
				ans=max(ans,j);
		}
	}

	cout<<ans;
}
 
int32_t main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
 
	int T;
	// cin>>T;
	T=1;
	while(T--){
		solve();
	}
}

Measured memory_bytes: 83156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    ll n, p;
    cin >> n >> p;
    if (n == 1)
    {
        cout << p << endl;
        return 0;
    }
    ll gcd = 1;
    rep(i, 100000000)
    {
        int count = 0;
        if (i < 2)
            continue;
        while (p % i == 0)
        {
            p /= i;
            count++;
        }
        if (count >= n)
        {
            count /= n;
            gcd *= pow(i, count);
        }
    }
    cout << gcd << endl;
    return 0;
}


Measured memory_bytes: 256
import copy

class Card:
    def __init__(self, suit, number):
        self.suit = suit
        self.number = number
        self.view = self.suit + str(self.number)

def bubble_sort(A):
    count = 0
    while True:
        swapped = False
        for i in range(len(A)-1):
            if A[i+1].number < A[i].number:
                A[i+1], A[i] = A[i], A[i+1]
                count += 1
                swapped = True
        if not swapped:
            return count

def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_value = A[i].number
        min_value_index = i
        # print('- i:', i, 'A[i]', A[i], '-')
        for j in range(i, len(A)):
            # print('j:', j, 'A[j]:', A[j])
            
            if A[j].number < min_value:
                min_value = A[j].number
                min_value_index = j
        # print('min_value', min_value, 'min_value_index', min_value_index)
        if i != min_value_index:
            count += 1
            A[i], A[min_value_index] = A[min_value_index], A[i]
            # print('swap!', A)
        
    return count

n = int(input())
A = []
for row in input().split():
    suit, number = list(row)
    A.append(Card(suit, int(number)))

def is_stable(A, B):
    N = len(A)
    for i_A in range(N-1):
        for j_A in range(i_A+1, N):
            for i_B in range(N-1):
                for j_B in range(i_B+1, N):
                    if A[i_A].number == A[j_A].number and A[i_A].view == B[j_B].view and A[j_A].view == B[i_B].view:
                        return False

    return B

bubble_sort_A = copy.deepcopy(A)
selection_sort_A = copy.deepcopy(A)

bubble_sort(bubble_sort_A)
print(*[elem.view for elem in bubble_sort_A])
if is_stable(A, bubble_sort_A):
    print('Stable')
else:
    print('Not stable')

selection_sort(selection_sort_A)
print(*[elem.view for elem in selection_sort_A])

if is_stable(A, selection_sort_A):
    print('Stable')
else:
    print('Not stable')




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

const long double EPS = 1e-10;
const long long INF = 1e18;
const int MOD = (int)1e9 + 7;
const long double PI = acos(-1.0L);

int main() {  // TODO
  ll W, H, x, y;
  cin >> W >> H >> x >> y;

  cout << fixed << setprecision(20) << (double)W * H / 2.0;

  if (W == x * 2 && H == y * 2) {
    cout << " " << 1 << endl;
  } else {
    cout << " " << 0 << endl;
  }

  return 0;
}

Measured memory_bytes: 3768
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

ll n, m, k;

ll mod_pow(ll x, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

ll mod_inverse(ll x) {
    return mod_pow(x, mod-2);
}

const int max_n = 1000000;
ll fact[max_n];
ll fact_inv[max_n];
void calc_fact() {
    fact[0] = 1;
    for (ll i = 1; i < max_n; i++)
        fact[i] = (fact[i-1] * i) % mod;
    fact_inv[max_n-1] = mod_inverse(fact[max_n-1]);
    for (ll i = max_n-2; i >= 0; i--)
        fact_inv[i] = (fact_inv[i+1] * (i+1)) % mod;
}
ll mod_comb(ll n, ll k) {
    if (n < 0 || k < 0 || n < k) return 0;
    return (fact[n] * fact_inv[k] % mod) * fact_inv[n-k] % mod;
}

ll solve() {
    ll b = 0;
    for (int i = 1; i < m; i++) {
        b += n * n * i * (m-i);
        b %= mod;
    }
    for (int i = 1; i < n; i++) {
        b += m * m * i * (n-i);
        b %= mod;
    }

    calc_fact();
    return b * mod_comb(n*m-2, k-2) % mod;
}

void input() {
    cin >> n >> m >> k;
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 15872
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){
   int n,k;
   cin >> n >> k;
   int a[200010]= {0};
   rep(i,n) cin >> a[i];

   int num[200100] = {0};

   rep(i,n){
      num[a[i]]++;
   }

   sort(num,num+n,greater<int>());

   int sum = 0;
   for(int i=k;i<200100;i++){
      sum += num[i];
   }

   cout << sum << endl;



   return 0;
}

Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define INF 1<<30
#define DEBUG 0
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string FILE_NAME = "testcase.TH";
string NAME;
string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}
vector<int> x, y;		// 座標
vector<int> xx, yy;	// 圧縮した座標

int tp[5005][5005];

void compress (void ) 
{
	x.push_back (-INF ); y.push_back (-INF );
	sort (ALL (x ) ); sort (ALL (y ) );
	x.erase (unique (ALL (x ) ), x.end() );
	y.erase (unique (ALL (y ) ), y.end() );
	xx.clear(); yy.clear();
	int sx = x.size();
	int sy = y.size();
	xx.resize (sx, 0 ); yy.resize (sy, 0 );
	rep (j, sx ){
		xx[j] = x[j];
	} // end rep
	rep (i, sy ){
		yy[i] = y[i];
	} // end rep
}

int sum (int sx, int sy, int ex, int ey )
{
	int ssx = max (sx-1, 0 );
	int ssy = max (sy-1, 0 );

	return (tp[ey][ex] - tp[ssy][ex] - tp[ey][ssx] + tp[ssy][ssx] );
}

int main()
{
//	cut here before submit 
#if DEBUG
	NAME = FILE_NAME;
	int CNT = 1;
	NAME += itos (CNT );
	while (freopen (NAME.c_str() , "r", stdin ) != NULL ) {
#endif
	int n, m;
	scanf ("%d %d", &n, &m );
	x.clear(); y.clear();
	vector<int> tx (n, 0 ), ty (n, 0 );
	rep (i, n ){
		scanf ("%d %d", &tx[i], &ty[i] );
		x.push_back (tx[i] ); y.push_back (ty[i] );
	} // end rep

	compress ();

	memset (tp, 0, sizeof (tp ) );
	rep (i, n ){
		int rx = lower_bound (ALL (xx ), tx[i] ) - xx.begin();
		int ry = lower_bound (ALL (yy ), ty[i] ) - yy.begin();
		tp[ry][rx]++;
	} // end rep

	int nx = x.size();
	int ny = y.size();
	for (int i = 0; i < ny; i++ ){
		for (int j = 1; j < nx; j++ ){
			tp[i][j] += tp[i][j-1];
		} // end for
	} // end for

	for (int i = 1; i < ny; i++ ){
		for (int j = 0; j < nx; j++ ){
			tp[i][j] += tp[i-1][j];
		} // end for
	} // end for

	rep (j, m ){
		int x1, y1, x2, y2;
		scanf ("%d %d %d %d", &x1, &y1, &x2, &y2 );
		int xx1 = lower_bound (ALL (xx ), x1 ) - xx.begin();	
		int xx2 = upper_bound (ALL (xx ), x2 ) - xx.begin() - 1;
		int yy1 = lower_bound (ALL (yy ), y1 ) - yy.begin();
		int yy2 = upper_bound (ALL (yy ), y2 ) - yy.begin() - 1;
		int res = 0;
		if (xx1 <= xx2 && yy1 <= yy2 )
			res = sum (xx1, yy1, xx2, yy2 );
		printf ("%d\n", res );
	} // end rep

#if DEBUG
	CNT++;	// cut here before submit
	NAME = FILE_NAME;
	NAME += itos (CNT );
	} // end loop; cut here before submit
#endif			
	return 0;
}

Measured memory_bytes: 99212
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]
dx = [-1,0,1]
dy = [-1,0,1]

for i in range(H):
    for j in range(W):
        if(S[i][j] == '#'):
            continue
        count = 0
        for x in dx:
            for y in dy:
                if(not 0<=i+y<H or not 0<=j+x<W):
                    continue
                if(S[i+y][j+x] == '#'):
                    count += 1
        S[i][j] = str(count)
     
for s in S:
    print("".join(s))

Measured memory_bytes: 3188
program non_triangular_triplets
  implicit none
  integer :: n, k, i
  integer(8) :: a, b, c
  read(*,*) n, k
  if (2*k-1 > n) then
    write(*,'(i0)') -1
    stop
  end if
  a = k
  b = k+n+(n-1)/2
  c = k+2*n
  do i = 0, n-1, 2
    write(*,'(i0,x,i0,x,i0)') a, b, c
    a = a+2
    b = b-1
    c = c+1
  end do
  a = k+1
  b = k+2*n-1
  do i = 1, n-1, 2
    write(*,'(i0,x,i0,x,i0)') a, b, c
    a = a+2
    b = b-1
    c = c+1
  end do
end program non_triangular_triplets

Measured memory_bytes: 2304
import sys
input = sys.stdin.readline
N = int(input())
# （１行読み込み→splitしてlist化→各要素に対して-1する）←を逆順にする（[::-1]）をN回繰り返す
A = [[x-1 for x in list(map(int, input().split()))][::-1] for i in range(N)]

def can_match(i, A, next_set):
    if not A[i]: # A[i]が空の場合
        return
    j = A[i][-1] # j = iさんの次の対戦相手

    if A[j][-1] == i: # jさんの次の対戦相手がiさんの場合（＝相思相愛の場合）
        if i < j: # 常に(小, 大)で格納する
            next_set.add((i,j))
        else: # 常に(小, 大)で格納する
            next_set.add((j,i))

# next_setの初期化
next_set = set() # setは集合を表す
for i in range(N):
    can_match(i, A, next_set)

# 試合できるか？何日かかるか？を判別する
day = 0
battle = 0
while next_set:
    day += 1
    current_set, next_set = next_set, set()
    for match in current_set:
        battle += 1
        del A[match[0]][-1]
        can_match(match[0], A, next_set)
        del A[match[1]][-1]
        can_match(match[1], A, next_set)

if battle == N*(N-1)//2:
    print(day)
else:
    print(-1)

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

using namespace std;

int main(){
  long long A, ibuff;
  string B;
  cin >> A >> B;

  int pos=B.find(".");
  B.erase(pos, 1);

  ibuff=stoll(B);

  long long result=A*ibuff;
  result/=100;
  
  cout << result << endl;
  
  return 0;
}

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

int main() {
    long long A,B,C,K;
    cin >> A >> B >> C >> K;
    if (A > K) {
        cout << K << endl;
    } else if ((A + B) > K) {
        cout << A << endl;
    } else
    {
        cout << A - (K - A - B) << endl;
    }
    
    
    
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<int> A(3);
    rep(i, N) {
        int a;
        cin >> a;
        A[a % 3]++;
    }
    
    if(A[0] == N){
        output(1, 0);
        return 0;
    }
    
//    vector<int> B = A;
//    // 1??????
//    int one = A[0];
//    if(A[1] > 0){
//        one++, A[1]--;
//        while(1){
//            if(A[1] > 0){
//                one++, A[1]--;
//            }
//            else break;
//            if(A[2] > 0){
//                one++, A[2]--;
//            }
//            else break;
//        }
//    }
//    if(A[0] + A[1] + A[2] > 0) one++;
//    int two = B[0];
//    if(B[2] > 0){
//        two++, B[2]--;
//        while(1){
//            if(B[2] > 0){
//                two++, B[2]--;
//            }
//            else break;
//            if(B[1] > 0){
//                two++, B[1]--;
//            }
//            else break;
//        }
//    }
//    if(B[0] + B[1] + B[2] > 0) two++;
    int ma = max(A[1], A[2]), mi = min(A[1], A[2]);
    int ret = A[0];
    ret += mi * 2;
    ret += min(3, ma - mi);
    output(ret, 0);
    return 0;
}

Measured memory_bytes: 3216
#include<stdio.h>
int max(int x,int y){
	if(x>y)
		return x;
	else
		return y;
}
int main(){
	int n,i,M=0,sum=0,l[10];
	scanf("%d",&n);
	for(i=0;i<n;++i){
		scanf("%d",&l[i]);
		sum +=l[i];
        M=max(M,l[i]);
	}
	if(M<sum-M)
		printf("Yes\n");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define  ll long long int

using namespace std;

int main()
{
    ll n,flag=0,fl=0;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }

//    for(ll i=0;i<n;i++)
//    {
//    if(a[i+1]<a[i])
//     flag=1;
//     }

    for(ll i=0;i<n;i++)
        {
            if(a[i]!=i+1)
                fl++;

        }

    if( fl>2)
        cout<< "NO"<<endl;
    else
        cout<< "YES"<<endl;
    return 0;
}


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

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

    int N, M; cin >> N >> M;
    unordered_map<int, int> um;
    int cs = 0;
    for (int i = 0; i < N; i++) {
        int A; cin >> A;
        cs = (cs + A) % M;
        um[cs]++;
    }
    long long ans = 0;
    for (pair<int, int> p : um) {
        if (p.first > 0) p.second--;
        ans += (1LL + p.second) * p.second / 2;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3724
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>

using namespace std;
typedef long long ll;

struct UnionFind {
  vector<int> par;
  
  UnionFind(int N) : par(N) {
    for(int i = 0; i < N; i++) par[i] = i;
  }
  
  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  
  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    par[rx] = ry;
  }
  
  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

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

  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  
  for(int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    tree.unite(a - 1, b - 1);
  }
  
  int res = 0;
  for (int i = 0; i < n; i++) {
    if(tree.same(i, p[i])) {
      res++;
    }
  }
  
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1024
X, Y = map(int, input().split())
mod = 10 ** 9 + 7
m = mod - 2
bin_m = []
while m:
  bin_m.append(m % 2)
  m >>= 1
p = 2 * X - Y
q = -X + 2 * Y
if p >= 0 and q >= 0 and p % 3 == 0:
  a = p // 3
  b = q // 3
  n = a + b
  ANS = 1
  for i in range(1, a+1):
    ANS = (ANS * (n+1-i)) % mod
    inv = 1
    for j in reversed(bin_m):
      inv = (inv * inv) % mod
      if j == 1:
        inv = (inv * i) % mod
    ANS = (ANS * inv) % mod
  print(ANS)
else:
  print(0)

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

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; }

const ll MRINF = 5000000000000000;

int main() {


    int A, B, X;
    cin >> A >> B >> X;
    if(A <= X && X <= A+B) cout << "YES" << endl;
    else cout << "NO" << endl;

    

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

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

#define PI 3.14159265358979323846

#define ll long long int
#define ff first
#define ss second
#define int long long int
#define pb push_back

const int N = 10010;
const int MOD = 1000000007;

int bexp(int a, int b)
{
    if (b < 0)
        return 0;
    int res = 1;
    while(b)
    { 
        if(b & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}

int fac[N], inv[N], finv[N];
void comp() {
    fac[0] = fac[1] = 1;
    inv[1] = 1;
    finv[0] = finv[1] = 1;

    for (int i = 2; i < N; ++i) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = (MOD - (MOD / i) * inv[MOD % i] % MOD);
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

int ncr(int n, int r) {
    if (n < r) return 0;
    return fac[n] * finv[r] % MOD * finv[n - r] % MOD;
}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);

    int n;
    cin >> n;

    comp();
    int ans = 0;
    if (n < 3) ans = 0;
    else {
        for (int i = 1; i < 1000; ++i)
        {
            if (3 * i > n)
                break;

            int s1 = n - 3 * i;
            int j = s1;
            ans = (ans + ncr(i + j - 1, i - 1)) % MOD;
        
        }
    }

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


Measured memory_bytes: 3884
import sys


def main():
    while True:
        list1 = [i for i in sys.stdin.readline().split()]
        if '?' in list1:
            break
        a, b, op = int(list1[0]), int(list1[2]), list1[1]
        if op == '+':
            print(a + b)
        elif op == '-':
            print(a - b)
        elif op == '*':
            print(a * b)
        else:
            print(int(a / b))
    return


if __name__ == '__main__':
    main()



Measured memory_bytes: 5608
#include <iostream>

using namespace std;

int main()
{
	int N;
	int A[2][100];
	int max = 0;
	int sum = 0;

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

	for (int a = 0; a < N; a++)
	{
		sum = 0;
		for (int b = 0; b < N; b++)
		{
			if (a > b)
				sum += A[0][b];
			else if (a == b)
				sum += A[0][b] + A[1][b];
			else
				sum += A[1][b];
		}
		if (sum > max)
			max = sum;
	}

	cout << max << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.BigInteger;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prem_cse
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solution solver = new Solution();
        solver.solve(1, in, out);
        out.close();
    }

    static class Solution{
  
    	
        public void solve(int testNumber, FastReader sc, PrintWriter out) {
        
        	long x = sc.nextLong();
        	long k = sc.nextLong();
        	long d = sc.nextLong();
           
            x = Math.abs(x);
            if(k<=x/d) {
                out.print(x-(k*d));
            }else {
            long q = x/d;
                x-=d*q;
                k-=q;
                x%=d;
                if(k%2==0) out.print(x);
                else out.print(Math.abs(x-d));
            }
        }

	
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            br = new BufferedReader(new
                    InputStreamReader(stream), 32768);
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



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

int main () {
        int n, k; cin >> n >> k;
        set <int> S;
        for (int i = 0; i < k; ++i) {
                int x; cin >> x;
                S.insert (x);
        }
        for (int i = n; i <= 999999; ++i) {
                int t = i;
                bool ok = true;
                while (t && ok) {
                        if (S.count(t%10)) ok = false;
                        t /= 10;
                }
                if (ok) {
                        cout << i << endl;
                        return 0;
                }
        }
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(c)              c.begin(), c.end()
#define CC(x) cout << (x) << endl
#define rep(i,n) for(int i=0;i<n;i++)
#define FastRead ios_base::sync_with_stdio(false);cin.tie(NULL);
#define EPS 1e-9
typedef unsigned long long ull;
using namespace std;

int main()
{

    ll x,y;cin >> x >>y;
    vector<ll>a(x);
    ll sum=0;
    for(int i=0;i<x;i++){
        cin >>a[i];
    }
    sort(all(a));
    ll ans=0;
    ll c=0;
    for(int i=a.size()-1;i>=0;i--)
    {
        if(c<y)
        {
            c++;
        }
        else
            ans+=a[i];
    }
    cout << ans <<endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  for (int i = 0; i < 4; i++) {
    int t, n;
    cin >> t >> n;
    switch(t) {
    case 1: cout << 6000 * n << endl; break;
    case 2: cout << 4000 * n << endl; break;
    case 3: cout << 3000 * n << endl; break;
    case 4: cout << 2000 * n << endl; break;
    }
  }
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <queue>
//#include <tr1/unordered_map>
#include <iostream>
#define maxn 100005
#define M 1000000007
using namespace std;
//using namespace tr1;
int main()
{
    int n,k,num=0;
    scanf("%d%d",&n,&k);
    int a[maxn];
    for(int i=1;i<=n;i++)
    {scanf("%d",&a[i]);if(a[i]>=k) num++;}
    printf("%d",num);
    return 0;
}


Measured memory_bytes: 640