akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main(){
    ll a, b;
    cin >> a >> b;
    ll ans = 0;
    rep(i, a + 1){
        rep(j, a + 1){
            ll k = b - i - j;
            if(k >= 0 && k <= a)
                ++ans;
        }
    }
    cout << ans << endl;
}
  

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
  int n, l, r;
  cin >> l >> r >> n;
  cout << r / n - (l - 1) / n << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000;
const double PI = acos(-1);
const int mod = 1000000007;

int dp[100001] = {0};

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

    dp[0] = 1;
    for (int i = 100; i <= 105; i++) {
        dp[i] = 1;
    }
    for (int i = 200; i <= x; i++) {
        if (dp[i - 100] || dp[i - 101] || dp[i - 102] || dp[i - 103] || dp[i - 104] || dp[i - 105]) {
            dp[i] = 1;
        }
    }
    cout << dp[x] << endl;
    return 0;
}


Measured memory_bytes: 3896
n = int(input())


def dfs(s):
    if s and int(s) > n:
        return 0
    if '3' in s and '5' in s and '7' in s:
        return dfs(s + '3') + dfs(s + '5') + dfs(s + '7') + 1
    else:
        return dfs(s + '3') + dfs(s + '5') + dfs(s + '7')


print(dfs(''))


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

ll k; ll n; 
vector <int> a;
ll ans = 10e6 + 1;

ll clockwiseFrom(int i) {
    if(i > 0) {
        return (a[i-1] + k) - a[i];
    }else{
        return a[n-1] - a[i];
    }
}

ll anticlockFrom(int i) {
    if(i > 0) {
        return k - (a[i + 1] - a[i]);
    }else{
        return k - (a[1] - a[0]);
    }
}

int main() {
    cin >> k >> n;    
    sort(a.begin(), a.end());
    for(int i = 0; i < n; i++) {
        int x; cin >> x;
        a.push_back(x);
    }

    for(int i = 0; i < n; i++) {
        ans = min(clockwiseFrom(i), ans);
        ans = min(anticlockFrom(i), ans);
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
ll rand_int(ll l, ll r) //[l, r]
{
    static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
    return uniform_int_distribution<ll>(l, r)(gen);
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=1e5+7;
int tree[maxn];
void add(int x)
{
    while(x<maxn)
    {
        tree[x]++;
        x+=x&-x;
    }
}
int query(int x)
{
    int ret=0;
    while(x)
    {
        ret+=tree[x];
        x-=x&-x;
    }
    return ret;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    vi a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    int L=1,R=1e9,ans=-1;
    ll tot=(ll)n*(n+1)/2;
    ll tar=tot/2+1;
    while(L<=R)
    {
        int mid=L+R>>1;
        memset(tree,0,sizeof(tree));
        vi cur(n),pre(n);
        vi all;
        auto getid=[&](int x){
            return lower_bound(all.begin(),all.end(),x)-all.begin()+1;
        };
        all.push_back(0);
        for(int i=0;i<n;i++)
        {
            if(a[i]<=mid) cur[i]=1;
            else cur[i]=-1;
            if(!i) pre[i]=cur[i];
            else pre[i]=pre[i-1]+cur[i];
            all.push_back(pre[i]);
        }
        mkuni(all);
        add(getid(0));
        ll cnt=0;
        for(int i=0;i<n;i++)
        {
            int id=getid(pre[i]);
            cnt+=query(id-1);
            add(id);
        }
        if(cnt>=tar)
        {
            R=mid-1;
            ans=mid;
        }
        else L=mid+1;
    }
    assert(ans!=-1);
    print(ans);
}

Measured memory_bytes: 2792
class AtCoder {
  // 入力系
  input=[];
  input_i=-1;
  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n){
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n){
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
}
const o = new AtCoder()
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line',(line)=> {
  o.input.push(...line.split(/[\s]/));
});

process.stdin.on('end', ()=> {
  let [n,m]=o.nn(2),sum=0
  for(let i=0;i<m;i++)sum+=o.n()
  o.o(sum>=n?'Yes':'No')
});

Measured memory_bytes: 27724
#include <iostream>
#include <sstream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <fstream>
#include <cmath>
#include <queue>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
# define my_sizeof(type) ((char *)(&type+1)-(char*)(&type))
 
string makestring(int x)
{
    stringstream ss;
    ss << x;
    return ss.str();
}
 
int main()
{
 
 
    int n, l, t, c=-1, x;
    vector<int> v;
    cin >> n >> l;
    for(int i = 0; i < n; i++){
        cin >> t;
        v.push_back(t);
    }
    for(int i = 0; i < n-1; i++){
        t=v[i]+v[i+1];
        if(c<t){
            c=t;
            x=i;
        }
 
    }
    if(c<l){
        cout << "Impossible";
    } else {
        cout << "Possible" << endl;
        for(int i = 1; i <= x; i++){
            cout << i << endl;
        }
        for(int i = n-1; i > x; i--){
            cout << i << endl;
        }
    }
 
 
 
 
    return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define MAXN 1000001
using namespace std;
int gcd(int a,int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
    int n;
    cin>>n;
    vector<int> arr(n);
    vector<int> nums(MAXN+1,0);
    vector<int> spf(MAXN+1);
    spf[1] = 1;
    for(int i=2;i<=MAXN;i++)
        spf[i] = i;
    for(int i=2;i<=MAXN;i+=2)
        spf[i]=2;
    for(int i=3;i*i<=MAXN;i++)
    {
        if(spf[i]==i)
        {
            for(int j=i*i;j<=MAXN;j+=i)
            {
                if(spf[j]==j)
                    spf[j] = i;
            }
        }
    }
    for(int i=0;i<n;i++)
        cin>>arr[i];
    bool isPairWise = true;
    for(int i=n-1;i>=0;i--)
    {
        int curr = arr[i];
        bool isCurr = true;
        while(curr!=1)
        {
            int pf = spf[curr];
            if(nums[pf]!=0)
            {
                isCurr = false;
                break;
            }
            while(curr%pf==0)
            {
                nums[pf]++;
                curr/=pf;
            }
        }
        if(!isCurr)
        {
            isPairWise = false;
            break;
        }
    }
    if(isPairWise)
    {
        cout<<"pairwise coprime";
        return 0;
    }
    int sol = gcd(arr[0],arr[1]);
    for(int i=2;i<n;i++)
    {
        sol = gcd(sol,arr[i]);
    }
    if(sol==1)
    {
        cout<<"setwise coprime";
        return 0;
    }
    cout<<"not coprime";
    return 0;
}



Measured memory_bytes: 14840
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N, M;
    void solve()
    {
        N = cin.nextint;
        M = cin.nextint;
        var A = new int[N][];
        for (int i = 0; i < N; i++)
        {
            A[i] = cin.scanint.Select(j => j - 1).ToArray();
        }
        int ans = int.MaxValue;
        var H = new HashSet<int>();
        for (int i = 0; i < M; i++)
        {
            var C = new int[M];
            for (int j = 0; j < N; j++)
            {
                for (int k = 0; k < M; k++)
                {
                    int d = A[j][k];
                    if (!H.Contains(d))
                    {
                        C[d]++;
                        break;
                    }
                }
            }
            int idx = -1;
            int max = 0;
            //WriteLine(string.Join(" ", C));
            for (int j = 0; j < M; j++)
            {
                if (C[j] > max)
                {
                    max = C[j];
                    idx = j;
                }
            }
            ans = Math.Min(max, ans);
            H.Add(idx);
        }
        WriteLine(ans);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 17996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	//freopen("in.txt","r",stdin);
	ll n;
	cin>>n;
	
	if(n==2) {
		cout<<1<<endl;return 0;
	}
	ll ans=2; //n和n-1 
	for(ll i=2;i*i<=n;i++){
		if(n%i==1){
			if(i*i==n-1) ans++; else ans+=2;
		}
		else if (n%i==0){
			ll t=n;
			while(t%i==0) t/=i;
			if(t%i==1) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s, t;
	cin >> s >> t;
	int len_s = s.size();
	vector<vector<int> > vec('z' + 1);
	for (int i = 0; i < len_s; i++) {
		vec[s[i]].push_back(i);
	}
	int len_t = t.size();
	long long ans1 = 0, ans2 = -1;
	long long ans;
	bool flag = true;
	for (int i = 0; i < len_t; i++) {
		if (vec[t[i]].size() == 0) {
			flag = false;
			break;
		}
		auto it = upper_bound(vec[t[i]].begin(), vec[t[i]].end(), ans2);
		if (it != vec[t[i]].end()) {
			ans2 = *it;
		} else {
			ans1++;
			ans2 = vec[t[i]][0];
		}
	}
	if (flag)
		ans = ans1 * len_s + ans2 + 1;
	else
		ans = -1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1228
#include <bits/stdc++.h>
#include <algorithm>
#include <string>

using namespace std;
int main(void){
    // Your code here!
    int n,k;
    cin>>n>>k;
    int l[n];
    for(int i=0;i<n;i++) cin>>l[i];
    
    sort(l,l+n);
    reverse(l,l+n);
    int ans=0;
    for(int i=0;i<k;i++) ans+=l[i];
    
    cout<<ans<<endl;

}

Measured memory_bytes: 256
n = gets.to_i
nums = gets.split.map &:to_i
cnt = 0
max = 0
 
for i in 0...n-1
    if nums[i]>=nums[i+1]
        cnt += 1
        max = cnt if max < cnt
    else 
        cnt = 0
    end
end
 
puts max

Measured memory_bytes: 8580
//#pragma GCC optimize(2)
// Happy TLE and WA every day!
// by: zxb the vegetable chicken
#include<bits/stdc++.h>
#define mp              make_pair
#define rep(i,n)        for(int i = 0; i < n; i++)
#define foreach(i,c)    for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF            0x7fffffff
#define INF             0x3f3f3f3f
#define LINF            4557430888798830399
#define pb              push_back
#define F               first
#define S               second
#define Time            clock()/CLOCKS_PER_SEC
//#define usingFiles
using namespace std;

typedef unsigned int ui;
typedef pair<int, int> pii;
typedef long long ll;

inline bool Read(int& x){
	x = 0;
	int c;
	int sign = 1;
	while( (c = getchar()) < '0' || c > '9' ) if(c == '-') sign = -1;
	x = c ^ '0';
	while( (c = getchar()) >= '0' && c <= '9' ) x = (x<<3) + (x<<1) + (c ^ '0');
	x *= sign;
	return 1;
}

inline bool Write(int x){
	if(x >= 10) Write(x / 10);
	putchar(x % 10 + '0');
	return 1;
}

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;
const int Mod = 1000000007;

int n, k;
int a[110];
ll dp[2][100100]; //²î·Ö 

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	cin >> n >> k;
	rep(i, n) cin >> a[i];
	dp[0][0] = 1;
	dp[0][a[0] + 1] = -1;
	for(int j = 1; j <= k; j++){
		dp[0][j] = dp[0][j] + dp[0][j - 1];
		dp[0][j] %= Mod;
	}
	for(int i = 1; i < n; i++){
		int now = i & 1;
		int pre = (i - 1) & 1;
		rep(j, k + 1) dp[now][j] = 0;
		for(int j = 0; j <= k; j++){
			dp[now][j] += dp[pre][j];
			dp[now][j] %= Mod;
			dp[now][min(j + a[i] + 1, k + 1)] -= dp[pre][j];
			dp[now][min(j + a[i] + 1, k + 1)] += Mod;
			dp[now][min(j + a[i] + 1, k + 1)] %= Mod;
		}
		for(int j = 1; j <= k; j++){
			dp[now][j] = dp[now][j] + dp[now][j - 1];
			dp[now][j] %= Mod;
		}
	}
	cout << dp[(n - 1) & 1][k];
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

string s;
int ans;

signed main() {
	cin >> s;
	for (int i = 0; i < (int)s.size(); i++)for (int j = i; j < (int)s.size(); j++) {
		bool bl = true;
		for (int k = i; k <= j; k++)if (s[k] != 'A'&&s[k] != 'C'&&s[k] != 'G'&&s[k] != 'T')bl = false;
		if (bl)ans = max(ans, j - i + 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES 
#include <iomanip> 
#include <cmath>  
#include<iostream>
#include <fstream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)

const ll RANGE = 100000 + 10;

ll N, C, ans;
struct TVP {
	ll s, t; 
	bool operator<(const TVP& right) const {
		return s < right.s; 
	}
};
vector<TVP> TVPs[32];
ll timeImos[RANGE];
ll sum[RANGE];

int main() {
	cin >> N >> C;
	repi(i, 0, N) {
		ll s, t, c;
		cin >> s >> t >> c;
		TVP p;
		p.s = max((ll)0, s - 1), p.t = t;
		TVPs[c].push_back(p);
	}
	repi(i, 1, C + 1) {
		sort(TVPs[i].begin(), TVPs[i].end());
		repi(j, 0, TVPs[i].size()) {
			ll left = TVPs[i][j].s, right = TVPs[i][j].t;
			while (1) {
				if (j == TVPs[i].size() - 1)break;
				if (TVPs[i][j].t > TVPs[i][j+1].s) {
					right = TVPs[i][j + 1].t;
					j++;
				}
				else break;
			}
			timeImos[left]++;
			timeImos[right]--;
		}
	}
	repi(i, 0, RANGE) {
		if (i == 0) sum[i] = timeImos[i];
		else sum[i] = sum[i - 1] + timeImos[i];
		ans = max(ans, sum[i]);
	}

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

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    long long int n,k;
    cin>>n>>k;
    vector<long long int> v(n);
    REP(i,n){
        cin>>v[i];
    }
    long long int result=linf;
    REP(i,n-k+1){
        result=min(result,min(abs(v[i]),abs(v[i+k-1]))+v[i+k-1]-v[i]);
    }

    cout<<result<<endl;
    return 0;
}


Measured memory_bytes: 1152
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int A, B;
	cin >> A >> B;

	vector<Int> ketaA;
	vector<Int> ketaB;

	//Bの調査
	//2の0乗
	Int tempB = (B + 1) / 2;
	tempB %= 2;//Bまでの1の偶奇
	ketaB.push_back(tempB);
	ketaA.push_back(0);

	//2のk乗
	Int temp2 = 2;
	while (B >= temp2) {
		tempB = (B + 1 - temp2) % (temp2 * 2);
		tempB = min(temp2, tempB);
		tempB %= 2;//Bまでの1の偶奇
		ketaB.push_back(tempB);
		ketaA.push_back(0);
		temp2 *= 2;
	}

	//A-1の調査
	//2の0乗
	Int tempA = A / 2;
	tempA %= 2;//Bまでの1の偶奇
	ketaA[0] = tempA;

	//2のk乗
	Int k = 1;
	temp2 = 2;
	while (A - 1 >= temp2) {
		tempA = (A - temp2) % (temp2 * 2);
		tempA = min(temp2, tempA);
		tempA %= 2;//Bまでの1の偶奇
		ketaA[k] = tempA;
		temp2 *= 2;
		k++;
	}

	Int ans = 0;
	Int len = ketaA.size();
	Int temp;
	for (Int i = 0; i < len; i++) {
		temp = ketaA[i] + ketaB[i];
		temp %= 2;
		if (temp)ans += (1LL << i);
	}

	cout << ans << "\n";

}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include <string>
using namespace std;
typedef long long ll;

//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(int argc, char *argv[]) {

  ll n;
  cin >> n;
  string result = "";
  while( true ){
    if( n < 27 ){
      char c = n+96;
      result = c + result;
      break;
    }
    char c = (n-1)%26+97;
    result = c + result;
    if(n <= 26) break;
    n = (n-1)/26;
  }

  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
char s[maxn];
int op[maxn]; 
int main()
{
	int n;cin>>n;
	scanf("%s",s+1);
	if(s[1]=='W'){
		puts("0");
		return 0; 
	}
	op[1] = 0;
	int cur = 1;
	ll ans = 1;
	for(int i=2;i<=2*n;i++){
		if(s[i]==s[i-1])op[i] = op[i-1]^1;
		else op[i] = op[i-1];
		if(op[i]==1){
			ans = ans*cur%mod;
			cur--;
		}
		else{
			cur++;
		}
//		cout<<"!"<<i<<" "<<cur<<endl;
		if(cur<0){
			puts("0");
			return 0;
		}
	}
//	cout<<"!"<<cur<<endl;
	if(cur){
		puts("0");
		return 0;
	}
	for(int i=1;i<=n;i++)ans = ans*i%mod;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<cstdlib>

#define N 100000
using namespace std;

class Queue{
private:
  int num[N];
  int head;
  int tail;
public:
  Queue(){
    head=0;
    tail=0;
  }


  //add to head position
  void push(int x){
    num[tail]=x;
    tail++; 
 }
  //delete head position
  void pop(void){
    head++;
  }
  //return now of stck
  int front(void){
    return num[head];
  }

};


int main(){

  Queue que;
  //
  bool finish[N];
  int  n,q,tim=0; 
  string name[N];
  int time[N],i=0;
  int passtime=0;

  //load n and q
  cin >>n>>q;

  //load name and time
  for(i=0;i<n;i++){
    cin >>name[i]>>tim;
    que.push(tim);
    time[i]=0;
  }


  //format finish[]
  for(int k=0;k<n;k++)finish[k]=false;


  while(1){
    int s;
    bool end=true;
    for(int k=0;k<n;k++){
      if(!finish[k]){
	end=false;
	break;
      }
    }
    if(end)break;
    else end=true;
    
    if(i == n)i=0;
    
    
    if(finish[i]){
      i++;
      continue;
    }
    
    
    s=que.front();
    if(s-q>0){
      que.push(s-q);
      que.pop();
      passtime+=q;
      time[i]=passtime;
     
    }
    else{
      que.pop();
      passtime+=s;
      time[i]=passtime;
      finish[i]=true;
      cout << name[i] << " " << time[i]<<endl;
    }
    i++;
  }

  return 0;

}

Measured memory_bytes: 0
#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>;
const double PI = acos(-1);
const ll MOD = 1000000007;

int main() {
  vector<int> ans(4,0);
  int N;
  cin >> N;
  rep(i, N){
    string x;
    cin >> x;
    if(x == "AC") ans[0]++;
    if(x == "WA") ans[1]++;
    if(x == "TLE") ans[2]++;
    if(x == "RE") ans[3]++;
  }

  cout << "AC x " << ans[0] << endl;
  cout << "WA x " << ans[1] << endl;
  cout << "TLE x " << ans[2] << endl;
  cout << "RE x " << ans[3] << endl;

}


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

int main(){
	string s;
	cin >> s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='7'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3624
def main():
    N, M = map(int, input().split())
    S = []
    for n in range(N):
        x, y = map(int, input().split())
        S.append((x, y))
    C = []
    for m in range(M):
        x, y = map(int, input().split())
        C.append((x, y))
    ans = []
    for i, s in enumerate(S):
        d = float('INF')
        ans.append(0)
        for j, c in enumerate(C):
            dd = abs(s[0] - c[0]) + abs(s[1] - c[1])
            if d > dd:
                ans[i] = j + 1
                d = dd
    print('\n'.join(map(str, ans)))


main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define     mod             1e9+7
#define     MOD             998244353
#define     ll              long long
#define     mp              make_pair
#define     F               first
#define     S               second
#define     t()             int test;cin>>test;while(test--)
#define     setbits(x)      __builtin_popcountll(x)
#define     ii              pair<int,int>
#define     que_max         priority_queue <int>
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n"
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif



int32_t main()
 
{  
   #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS;
   //t()
   {
        int x, y,i;
        cin>>x>>y;

       for(int i=0; i<=x; i++)
       {
          if((i*2 + (x-i)*4) == y)
            {
                cout<<"Yes"<<endl;
                return 0;
            }
       }

        cout<<"No"<<endl;

   }
    
}

Measured memory_bytes: 3648
def input_int():
    return int(input())

def input_ints():
    return list(map(int, input().split()))

S = input()
N = len(S)
cnt = [0] * 2019
cnt[0] += 1
ans = 0

p = 1
now = 0

for i in reversed(range(N)):
    now = (now + int(S[i]) * p) % 2019
    p = p * 10 % 2019
    ans += cnt[now]
    cnt[now] += 1

print(ans)




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

#include <assert.h>    // LON
#include <math.h>    // sqrt()


using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

void ok() {
    cout << "Possible" << endl;
}

class CumulativeSum {
    vector<ll> numbers;
    vector<ll> sums;

public:
    CumulativeSum(int n) {
        numbers.resize(n);
        sums.resize(n);
    }

    void set(int i, ll value) {
        numbers[i] = value;
    }

    ll getSum(int i) {
        if (i == -1) return 0;
        if (i == sums.size()) return 0;
        return sums[i];
    }

    ll getSectionSum(int start, int end) {
        return getSum(end) - getSum(start - 1);
    }

    void calculate() {
        for (int i = 0; i < numbers.size(); i++) {
            sums[i] = getSum(i - 1) + numbers[i];
        }
    }

};

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

    CumulativeSum cs(n);
    rep(i, n) {
        int a;
        cin >> a;
        cs.set(i, a);
    }

    cs.calculate();

    cout << endl;

    ll ans = INF;
    for (int i = 0; i < n - 1; i++) {
        ll now = abs(cs.getSum(i) - cs.getSectionSum(i + 1, n - 1));
        cmin(ans, now);
    }
    cout << ans << endl;

}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main()
{
    vector<vector<char>> c(3, vector<char>(3));
    for(int i = 0; i < 3; i++)
    {
        for(int j = 0; j < 3; j++)
        {
            cin >> c[i][j];
        }
    }
    cout << c[0][0] << c[1][1] << c[2][2] << endl;
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define MOD 1000000007
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;

int s,w;

signed main() {
    cin >> s >> w;
    if (s <= w) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}




Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(' ').Select(x => int.Parse(x));
            var sorted = a.OrderBy(x => x).ToList();
            var result = 0;
            for (int i = 1; i < sorted.Count(); i++)
            {
                result += sorted[i] - sorted[i - 1];
            }
            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 13396
N = int(input())
taro = 0
hanako = 0

for i in range(N):
    words = input().lower().split()
    if words[0] > words[1]:
        taro += 3
    elif words[0] < words[1]:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print('{} {}'.format(taro, hanako))


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

int main(){
    int stdin;
    int ans[2] = {0, 0};
    for(int i = 0; i < 3; i++){
        cin >> stdin;
        if(stdin == 5){
            ans[0]++;
        }else if(stdin == 7){
            ans[1]++;
        }
    }
    if(ans[0] == 2 && ans[1] == 1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;

int divisor(int N) {
    int cnt = 0;
    repd(i, 1, N + 1) {
        if (N % i == 0) cnt++;
    }

    return (cnt == 8 ? 1 : 0);
}
int main()
{
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i += 2) {
        ans += divisor(i);
    }

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

Measured memory_bytes: 256
N = int(input())


for a in range(N // 100 + 1):
  for b in range(N // 101 + 1):
    for c in range(N // 102 + 1):
      for d in range(N // 103 + 1):
        for e in range(N // 104 + 1):
          for f in range(N // 105 + 1):
            if a * 100 + b * 101 + c * 102 + d * 103 + e * 104 + f * 105 == N:
              print(1)
              exit()
print(0)




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

int A[100000], n;

int partiton(int p, int r){
  int x, i, j, t;
  x = A[r];
  i = p-1;
  for ( j=p; j<r; j++){
    if(A[j] <= x){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }
  t = A[i+1];
  A[i+1] = A[r];
  A[r] = t;
  return i+1;
}

int main() {
    ios::sync_with_stdio(false);
    int q;
    cin >> n;
    for(int i=0; i<n; i++){
      cin >> A[i];
    }
    q = partiton(0, n-1);
    for(int i=0; i<n; i++){
      if(i) cout << " ";
      if(i==q) cout << "[";
      cout << A[i];
      if(i==q) cout << "]";
    }
    cout << "\n";

}

Measured memory_bytes: 1596
import sys
import math
from collections import deque
from collections import defaultdict

def comb(n, r, mod):
    X, Y = 1, 1
    for i in range(r):
        X = X * (n - i) % mod
        Y = Y * (r - i) % mod
    return X * pow(Y, mod-2, mod)

def main():
    n,a,b = list(map(int,sys.stdin.readline().split()))
    mod = 10**9 + 7
    ans = pow(2, n, mod) - 1
    ans = (ans - comb(n, a, mod) - comb(n, b, mod)) % mod
    print(ans)
    return 0

if __name__ == "__main__":
    main()

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

#define MAX_LENGTH 100

using namespace std;

int main(){

    unsigned int n, i, score[2] = {0};
    string taro, hanako;

    cin >> n;

    for( i = 0; i < n; i++ ){
        
        cin >> taro >> hanako;
        
        unsigned int flag = 0;

        if(taro == hanako){
            score[0]++;
            score[1]++;

        }else{

            unsigned int j = 0;

            while( taro[j] != '\0' || hanako[j] != '\0'){
                if( taro[j] > hanako[j] ){
                    score[0] += 3;
                    flag = 1;
                    break;
                }else if( taro[j] < hanako[j] ){
                    score[1] += 3;
                    flag = 1;
                    break;
                }
                j++;
            }

            if(flag == 0){
                if( taro.length() > hanako.length() ){
                    score[0] += 3;
                }
                else{
                    score[1] += 3;
                }
            }
        }

    }

    cout << score[0] << " " << score[1] << endl;

    return 0;

}


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

cnt = 0
for i in range(N):
    index = i
    for j in range(i, N):
      if A[j] < A[index]:
        index = j
    if i != index:
      A[i], A[index] = A[index], A[i]
      cnt += 1
        
print(' '.join(map(str, A)))
print(cnt)


Measured memory_bytes: 5596
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path, path2;
//***********//
int main() {
	cin >> N;
	cin >> S;
	ll Q;
	cin >> Q;
	vector<set<ll>> A;
	A.resize(26);
	for (i = 0; i < N; i++) {
		A[S[i] - 'a'].insert(i+1);
	}
	for (k = 0; k < Q; k++) {
		ll a;
		cin >> a;
		if (a == 1) {
			ll p; char q;
			cin >> p >> q;
			A[S[p-1]-'a'].erase(p);
			A[q - 'a'].insert(p);
			S[p - 1] = q;
		}
		else {
			ll p, q;
			cin >> p >> q;
			ll pre = 0;
			for (i = 0; i < 26; i++) {
				if (A[i].size() > 0) {
					if (*A[i].rbegin() >= p) {
						if (*A[i].lower_bound(p) <= q) {
							pre++;
						}
					}
				}
			}
			cout << pre << endl;
		}
	}
}


Measured memory_bytes: 26244
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
int main()
{
     ///"In the name of Allah,most gracious and most merciful"///

        ll i,j,count=0,sum=0,n;
        double x,y,z;
        scanf("%lf%lf%lf",&x,&y,&z);
        if((x/z)<=y)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;


    return 0;
}



Measured memory_bytes: 3820
// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0; i<n; i++)

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

    cout << s.substr(0, 3) << endl;

    return 0;
}

Measured memory_bytes: 3628
nums = input().split()
a = int( nums[0])
b = int( nums[1])
c = int( nums[2])

if a > b:
    tmp = a
    a = b
    b = tmp
if b > c:
    tmp = b
    b = c
    c = tmp
if a > b:
    tmp = a
    a = b
    b = tmp

print( a, b, c)

Measured memory_bytes: 6724
def main():
    def add(i,x):
        while i<=size:
            tree[i]+=x
            i+=i&-i
    n,*a=map(int,open(0).read().split())
    size=n-~n
    m=n*-~n//2+1>>1
    ng=max(a)+1
    ok=0
    while ng-ok>1:
        mid=ok+ng>>1
        tree=[0]*-~size
        c=n+1
        s=0
        add(c,1)
        for t in a:
            c+=1if t>=mid else-1
            i=c
            while i:
                s+=tree[i]
                i-=i&-i
            add(c,1)
        if s>=m:ok=mid
        else:ng=mid
    print(ok)
main()

Measured memory_bytes: 100900
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pi pair<int,int>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=1e5+10,size=1<<20;

//char buf[size],*p1=buf,*p2=buf;
template<class o> void qr(o &x) {
	char c=gc; x=0; int f=1;
	while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
	while(isdigit(c)) x=x*10+c-'0',c=gc;
	x*=f;
}
template<class o> void qw(o x) {
	if(x/10) qw(x/10);
	putchar(x%10+'0');
}
template<class o> void pr1(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); puts("");
}

long double a;

int main() {
	qr(a); a/=3.0;
	printf("%12LF\n",a*a*a);
	return 0;
}


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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b&&a==c&&b==c){
    	cout<<"No";
    	return 0;
	}
	else if(a==b||a==c||b==c){
		cout<<"Yes";
		return 0;
	}
	else cout<<"No";
	return 0;
}

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

using namespace std;

const int inf = 1 << 20;

int bfs(const vector<string> &s)
{
	const int H = s.size();
	const int W = s[0].size();
	vector<vector<bool>> v(H, vector<bool>(W, false));

	queue<int> q;
	
	auto visit = [&](int y, int x) {
		if (y < 0 || H <= y) return;
		if (x < 0 || W <= x) return;
		if (s[y][x] != '.') return;
		if (v[y][x]) return;
		v[y][x] = true;
		q.push(y);
		q.push(x);
	};
	visit(0, 0);

	for (int d = 1; !q.empty(); ++d) {
		queue<int> t = move(q);
		while (!t.empty()) {
			int y = t.front(); t.pop();
			int x = t.front(); t.pop();
			if (y == H - 1 && x == W - 1) {
				return d;
			}
			visit(y - 1, x);
			visit(y + 1, x);
			visit(y, x - 1);
			visit(y, x + 1);
		}
	}
	return -1;
}

int main()
{
	int H, W;
	cin >> H >> W;
	vector<string> s(H);
	for (auto &x : s) {
		cin >> x;
	}

	int nb = 0;
	for (auto &x : s) {
		nb += count(x.begin(), x.end(), '#');
	}

	int d = bfs(s);
	if (d < 0) {
		cout << -1 << endl;
	}
	else {
		int ans = H * W - nb - d;
		cout << ans << endl;
	}
}


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

const int maxn=1e3+10;
int n;
bool rest;
long long ans;

int main(){
	scanf("%d",&n);
	while(n--){
		int a;
		scanf("%d",&a);
		if(a&&rest)
			++ans,rest=false,--a;
		ans+=a>>1;
		rest=a&1;
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main() {
    long long A, B;
    cin >> A >> B;
    long long K = 0;
    if (A == B) {
        K = 0;
    }
    else if((A+B) % 2 == 0){
        K = (A+B) / 2;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    
    cout << K << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;

#define huge 1000000007

int main(void) {

	string X;
	cin >> X;



	cout << "ABC" << X << endl;
	return 0;




}


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

int main(){
  int n,x,t;
  cin>>n>>x>>t;
  if(n%x==0) cout<<n/x*t<<endl;
  else cout<<(n/x+1)*t<<endl;
}


Measured memory_bytes: 3632
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
m = map(int,read().split())
SC = list(zip(m,m))

#print(N, M)
#print(SC)

ans = -1
for n in range(10**(N-1) if N != 1 else 0, 10**N):
  str_n = str(n)
  all_ok = True
  for s, c in SC:
    if int(str_n[s-1]) != c:
      all_ok = False
      break
  
  if all_ok:
    ans = n
    break
    
print(ans)

Measured memory_bytes: 3064
IDENTIFICATION DIVISION.
PROGRAM-ID. 167D.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
  SELECT STDIO ASSIGN TO KEYBOARD. 
*>
DATA DIVISION.
FILE SECTION.
FD STDIO.
01 INP        PIC X(1400000).
*>
WORKING-STORAGE SECTION.
01 INW        PIC  X(30).
01 N          PIC  9(06).
01 KX         PIC  X(19).
01 K          PIC  9(18).
01 LP         PIC  9(18).
01 SH         PIC  9(18).
01 AMR        PIC  9(06).
01 P1         PIC  9(07) COMP.
01 P2         PIC  9(07) COMP.
01 I          PIC  9(06) COMP.
01 TBL.
   03 A       PIC  9(06) OCCURS 200000.
   03 B       PIC  9(06) OCCURS 200000.
01 X          PIC  9(06).
01 SA         PIC  9(06).
01 OUT        PIC  Z(05)9.
*> 
PROCEDURE DIVISION.
  ACCEPT INW.
  UNSTRING INW DELIMITED BY ' '
      INTO N KX.
  IF (KX = '1000000000000000000')
    MOVE 999999999999999999 TO K
  ELSE
    MOVE KX TO K
  END-IF.
*>
  OPEN INPUT STDIO.
  READ STDIO.
  CLOSE STDIO.
*>
  MOVE ZERO TO TBL.
  MOVE 1 TO P1.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > N
    PERFORM VARYING P2 FROM P1 BY 1 UNTIL INP(P2:1) = ' '
    END-PERFORM
    MOVE INP(P1:P2 - P1) TO A(I)
    COMPUTE P1 = P2 + 1
  END-PERFORM.
*>
  MOVE A(1) TO X.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > K OR B(X) > 0 OR X = 1
    MOVE I    TO B(X)
    MOVE A(X) TO X
  END-PERFORM.
*>
  IF ((X > 1 AND B(X) = 0) OR B(X) > K) 
    MOVE 1 TO X
    MOVE K TO AMR
  ELSE
    COMPUTE SA = I - B(X)
    COMPUTE LP = K - B(X)
    IF (KX = '1000000000000000000')
      ADD 1 TO LP
    END-IF
    DIVIDE LP BY SA GIVING SH REMAINDER AMR
  END-IF.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > AMR
    MOVE A(X) TO X
  END-PERFORM.
*>
  MOVE X TO OUT.
  DISPLAY FUNCTION TRIM(OUT).
  STOP RUN.


Measured memory_bytes: 7520
s = input()
a = s.count('a')
b = s.count('b')
c = s.count('c')
a, b, c = sorted([a, b, c])
if a==b==c:
    print('YES')
elif a==b and c-b < 2:
    print('YES')
elif b-a < 2 and b==c:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    long long sum=0;
    for(int i=0;i<m;i++)
    {
        int a;
        cin>>a;
        sum+=a;
    }
    cout<<(n>=sum?n-sum:-1);
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

void solve(){
    int N, K, X, Y;
    cin >> N >> K >> X >> Y;

    if (N > K) {
        cout << K*X + (N-K)*Y << endl;
    }else{
        cout << N*X << endl;
    }


    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
const int N = 1e5;
using namespace std;

int main(){
	char a1,a2,a3,a4,a5,a6,a7,a8,a9;
	cin>>a1>>a2>>a3>>a4>>a5>>a6>>a7>>a8>>a9;
	cout<<a1<<a5<<a9;
	return 0;	
}

Measured memory_bytes: 256