akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int main() {
	int n,a[110][3],s[110]= {0};
	memset(a,0,sizeof(a));
	cin>>n;
	for(int o=1; o<=2; o++)
		for(int i=1; i<=n; i++)
			cin>>a[i][o];
	for(int i=1; i<=n; i++) {
		int p=1;
		for(int o=1; o<=n; o++) {
			if(i==o) {
				s[i]+=a[o][1];
				s[i]+=a[o][2];
				p=2;
			} else s[i]+=a[o][p];
		}
	}
	sort(s+1,s+1+n);
	cout<<s[n]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  map<ll, ll> m;
  for(ll i=1;i<=1000000;i++) m.emplace((i*(i+1))/2, i);
  auto itr = m.lower_bound(n);
  std::cout << (*itr).second << '\n';
  return 0;
}


Measured memory_bytes: 64768
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>

using namespace std;
int main() {
    vector<int> a(3);
    lp(i,3)
        cin>>a[i];
    sort(a.begin(),a.end());
    if((a[0]==a[1]&&a[0]!=a[2])||(a[1]==a[2]&&a[1]!=a[0]))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


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

using namespace std;
using uint = unsigned int;
using int64 = long long;
using i64 = int64;
using uint64 = unsigned long long;
using vint = vector<int>;
using vint64 = vector<int64>;
template<typename T>
using p_que = priority_queue<T>;
#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 fs first
#define sc second
#define eb emplace_back
#define all(x) x.begin(),x.end()

template<typename T>
vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "[";
	for (auto& e : v) os << e << ", ";
	return os << "]";
}

template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U> p) {
	return os << "P(" << p.first << ", " << p.second << ")";
}

template<class T, class U> ostream& operator<<(ostream& os, const map<T, U>& mp) {
	os << "{";
	for (auto& e : mp) os << e << " ";
	return os << "}";
}

void Main();
signed main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
}

/* Cut from here! */

template <uint mod> struct ModInt {
	uint x;
	ModInt(int64_t y = 0) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
	ModInt& operator+=(const ModInt& p) {
		if ((x += p.x) >= mod) x -= mod;
		return *this;
	}
	ModInt& operator-=(const ModInt& p) {
		x = (int)(1ll * x * p.x % mod);
		return *this;
	}
	ModInt& operator/=(const ModInt& p) {
		*this *= p.inverse();
		return *this;
	}
	ModInt operator-() const {
		return ModInt(-x);
	}
	ModInt operator+(const ModInt& p) const {
		return ModInt(*this) += p;
	}
	ModInt operator-(const ModInt& p) const {
		return ModInt(*this) -= p;
	}
	ModInt operator*(const ModInt& p) const {
		return ModInt(*this) *= p;
	}
	ModInt operator/(const ModInt& p) const {
		return ModInt(*this) /= p;
	}
	bool operator==(const ModInt& p) const {
		return x == p.x;
	}
	bool operator!=(const ModInt& p) const {
		return x != p.x;
	}
	ModInt inverse() const {
		int a = x, b = mod, u = 1, v = 0, t;
		while (b > 0) {
			t = a / b;
			swap(a -= t * b, b);
			swap(u -= t * v, v);
		}
		return ModInt(u);
	}
	ModInt pow(int64_t n) const {
		ModInt ret(1), mul(x);
		while (n > 0) {
			if (n & 1) ret *= mul;
			mul *= mul;
			n >>= 1;
		}return ret;
	}
	friend ostream& operator<<(ostream& os, const ModInt& p) {
		return os << p.x;
	}
};


//#define int long long
const uint MOD = 1e9 + 7;

void Main() {
	using ll = long long;
	ll a, n, m; cin >> a >> n >> m;
	int ans = 0;
	for (int y = 1; pow(y + a, n) <= m; ++y) {
		ll x = pow(y + a, n);
		int ty = 0;
		while (x > 0) ty += x % 10, x /= 10;
		if (y == ty) ++ans;
	}
	cout << ans << endl;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int s;
	cin >> s;

	int cnt = 1;
	map<int, int> mp;
	mp[s] = cnt;

	while(true){
		s = (s % 2 == 0 ? s / 2 : 3 * s + 1);
		cnt++;
		auto it = mp.find(s);

		if(it != mp.end()){
			cout << cnt << endl;
			return 0;
		}
		mp[s] = cnt;
	}
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d;
    cin >> a >> b >> c;
    if(a>b){
        d=a;        
        a=b;
        b=d;
    }
    if(b>c){
        d=b;
        b=c;
        c=d;
    }
    if(a>b){
        d=a;
        a=b;
        b=d;
    }
    
    cout << a << " " << b << " " << c;
    cout << endl;
    
}



Measured memory_bytes: 3076
#include<iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[], int n, int left, int mid, int right){

	int n1 = mid - left;
	int n2 = right - mid;
	for( int i = 0; i < n1; i++ )	L[i] = A[left + i];
	for( int i = 0; i < n2; i++ )	R[i] = A[mid + i];
	L[n1] = R[n2] = SENTINEL;
	int i = 0, j = 0;
	for( int k = left; k < right; k++ ){
		cnt++;
		if( L[i] <= R[j] ){
			A[k] = L[i++];
		}else{
			A[k] = R[j++];
		}
	}

}

void mergeSort(int A[], int n, int left, int right){

	if(left+1 < right){
		int mid = (left + right) / 2;
		mergeSort(A, n, left, mid);
		mergeSort(A, n, mid, right);
		merge(A, n, left, mid, right);
	}
}

int main(){

	int A[MAX], n, i;
	cnt = 0;
	
	cin >> n;
	for( i = 0; i < n; i++ )	cin >> A[i];

	mergeSort(A, n, 0, n);

	for(i = 0; i < n; i++){
		if(i)	cout << " ";
		cout << A[i];
	}

	cout << endl;

	cout << cnt <<endl;	

	return 0;
}

Measured memory_bytes: 5064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
//cout << fixed << setprecision(15);

int main() {
  int N, M;
  cin >> N >> M;
  int ac = 0, wa = 0;
  vi w(N);
  vb finished(N);
  rep(i, M) {
    int p;
    string S;
    cin >> p >> S;
    if(finished[p])
      continue;
    if(S == "AC") {
      ac++;
      finished[p] = true;
      wa += w[p];
    }
    else {
      w[p]++;
    }
  }
  cout << ac << " " << wa << endl;
}

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

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> vec (H);
	for(int i = 0;i < H;i++){
		cin >> vec.at(i);
	}
	
	for(int i = 0;i < H;i++){
		cout << vec.at(i) << endl;
		cout << vec.at(i) << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pl>    vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int main() {
  ios_base::sync_with_stdio(0);
 ll int t, i, j, k, p, q, r, x, y, u, v, n, m;

 string s;
 cin>>s;
 if(s.back()=='s')s+="es";
 else s+="s";
 cout<<s<<endl;


  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;

  return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m) {
  int i, u, v;
  while (m--) {
    cin >> u >> v;
    g[u - 1].pb(v - 1);
    g[v - 1].pb(u - 1);
  }
}

void dfs(int u, int par) {
  for (int v : g[u]) {
    if (v == par) continue;
    dfs(v, u);
  }
}





Measured memory_bytes: 10880
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define SZ(c) int(c.size())
#define pb push_back
#define loop(i,start,n)  for(int i=start;i<n;i++)
#define rloop(i,start,n)  for(int i=start;i>n;i--)

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
const ll inf = 2e9+3;

void solve(){
    int tc=1 ;
    //cin >> tc;
    while(tc--) {
        string s,t;
        cin >> s >> t;
        ll res = 0;
        loop(i,0,SZ(s)){
            res += (s[i]!=t[i]);
        }
        cout << res;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#define nmax_def 220000
#define Cmax_def 2200
#define mod 1000000007
using namespace std;
typedef long long ll;

int main() {
	ll i, j;
	ll N, a[nmax_def], M = 0, b[nmax_def];
	cin >> N;
	for (i = 1; i <= N; i++)
	{
		cin >> a[i];
	}
	for (i = N; i > 0; i--)
	{
		ll sum = 0;
		for (j = i * 2; j <= N; j += i)
		{
			if (b[j] == 1)
				sum++;
		}
		if ((sum % 2) == a[i])
			b[i] = 0;
		else
			b[i] = 1;
	}
	for (i = 1; i <= N; i++)
	{
		if (b[i] == 1)
			M++;
	}
	cout << M << endl;
	for (i = 1; i <= N; i++)
	{
		if (b[i] == 1)
			cout << i << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 4352
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        char[] s = scanner.next().toCharArray();
        long[][] dp = new long[s.length + 1][4];
        for (int i = s.length; i >= 0; i--) {
            for (int j = 3; j >= 0; j--) {
                if (i == s.length) {
                    dp[i][j] = j == 3 ? 1 : 0;
                } else {
                    dp[i][j] = dp[i + 1][j] * (s[i] == '?' ? 3 : 1);
                    if (j < 3 && (s[i] == '?' || s[i] == 'A' + j)) {
                        dp[i][j] += dp[i + 1][j + 1];
                    }
                    dp[i][j] %= 1e9 + 7;
                }
            }
        }
        System.out.println(dp[0][0]);
    }
}

Measured memory_bytes: 30336
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if (500*i + 100*j + 50*k) == x:
                ans += 1

print(ans)

Measured memory_bytes: 9120
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <utility> 
#include <tuple>
#include <iterator>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)

void solve(){
  int a,b,k;
  cin >> a >> b >> k;
  int i=min(a,b);
  int ans=1;
  while(ans <= k){
     if(a%i==0 && b%i==0){
       ans++;
     }
    i--;
  }
  cout << i+1 << endl;

}

int main(){
  solve();
  return 0;
}


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

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++) // repマクロ
#define all(v) v.begin(), v.end() // sort等の関数呼び出しを簡潔にする

using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

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

    int ans;
    if(N >= 10){
        ans = R;
    }else{
        ans = R + 100*(10 - N);
    }

    cout << ans << endl;

return 0;
}

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

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

    vector<vector<int>> dp(n+1, vector<int>(3, 0));// dp[n][a], dp[n][b], dp[n][c]
    for(int i=0; i<n; i++){
        vector<int> a(3);
        for(int j=0; j<3; j++){
            cin >> a[j];
        }
        for(int j=0; j<3; j++){
            int trial = 0;
            for(int k=0; k<3; k++){
                if(j != k) trial = max(trial, dp[i][k] + a[j]);
            }
            dp[i+1][j] = trial;
        }
    }

    int ans = 0;
    for(int i=0; i<3; i++){
        ans = max(ans, dp[n][i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5760
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//https://atcoder.jp/contests/abc155/tasks/abc155_b

int main()
{
    int k= 0;
    int a[10000];
    int b= 0;
    
    printf("\n");
    scanf("%d", &k);
    
        for(int i=0; i<k; i++)
        {
            scanf("%d", &a[i]);
        }
          
        for(int i=0; i<k; i++)
        {
            if(a[i]%2==0)
            {
                if(a[i]%3!=0&&a[i]%5!=0)
                {
                    b++;
                }
            }
        }
        
        if(b==0)
        {
            printf("APPROVED");
        }
        else
        {
            printf("DENIED");
        }
       
        return 0;
        
    
   
}



Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    long long a,b,c,x,y,j;
    long long s;
    scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&x,&y);
    s=0;
    if(c*2<a+b)
    {
        j=min(x,y);
        s=s+j*c*2;
        x=x-j;
        y=y-j;
    if(x)
    {
        if(a>c*2)
            s=s+c*2*x;
        else
            s=s+a*x;
    }
    else
    {
        if(b>c*2)
            s=s+c*2*y;
        else
            s=s+b*y;
    }
    }
    else
        s=x*a+y*b;
    printf("%lld\n",s);
    return 0;
}


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

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

    ll a = 100;

    ll ans = 0;
    while (a < x) {
        a = a*1.01;
        ans++;
    }

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

Measured memory_bytes: 3632
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  if(s[2]==s[3]&&s[4]==s[5]) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string A;
  cin >> A;
  if((A.at(0) == A.at(1)) && (A.at(1) == A.at(2))) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 3620
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int N = scan.nextInt();
			int[]d = new int[N];
			
			for(int i = 0;i<N;i++) {
				d[i] = scan.nextInt();
			}
			
			
			Arrays.sort(d);
			
			int s = d[N/2]-d[N/2-1];
			
			
			System.out.println(s);
			
			
			
			
			
		}
		
		
	}
		

}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void puts_all(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void puts_all(const T &value, const Args&... args){std::cout << value << " ";puts_all(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  i64 h,w;

  while(cin >> h >> w){
    i64 ans = (h * w + 1) / 2;

    if(h == 1 or w == 1) ans = 1;
    
    puts_all(ans);
  }


  return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;

struct cake {
    ll v;
    int i,j,k;
    bool operator<(const cake& a) const {
        return v < a.v;
    }
};

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<ll> a(x),b(y),c(z);
    for (int i = 0;i < x;++i) cin >> a[i];
    for (int i = 0;i < y;++i) cin >> b[i];
    for (int i = 0;i < z;++i) cin >> c[i];
    sort(a.begin(),a.end(),greater<ll>());
    sort(b.begin(),b.end(),greater<ll>());
    sort(c.begin(),c.end(),greater<ll>());
    map<int,bool> used;
    priority_queue<cake> que;
    que.push(cake{a[0]+b[0]+c[0],1,1,1});
    used[1] = true;
    for (int d = 0;d < k;++d) {
        cake t = que.top();
        que.pop();
        if (t.i < x && !used[(t.i+1)*1000000+t.j*1000+t.k]) {
            used[(t.i+1)*1000000+t.j*1000+t.k] = true;
            que.push(cake{a[t.i]+b[t.j-1]+c[t.k-1],t.i+1,t.j,t.k});
        }
        if (t.j < y && !used[t.i*1000000+(t.j+1)*1000+t.k]) {
            used[t.i*1000000+(t.j+1)*1000+t.k] = true;
            que.push(cake{a[t.i-1]+b[t.j]+c[t.k-1],t.i,t.j+1,t.k});
        }
        if (t.k < z && !used[t.i*1000000+t.j*1000+t.k+1]) {
            used[t.i*1000000+t.j*1000+t.k+1] = true;
            que.push(cake{a[t.i-1]+b[t.j-1]+c[t.k],t.i,t.j,t.k+1});
        }
        cout << t.v << endl;
    }
    return 0;
}

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

int sum(int x){
  int sum = 0;
  while(x!=0){
    sum += x%10;
    x /= 10;
  }
  return sum;
}
  
int main() {
  int N;
  cin >>N;
  int mn = 10000;
  for(int i=1;i<=N-1;i++){
    int A = i;
    int B = N-A;
    mn = min(mn,sum(A)+sum(B));
  }
  cout << mn << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
  cout << fixed << setprecision(4);
  double t,x;
  cin >> t >> x;
  cout << t/x << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Scanner;
class Main {
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int m=1000000007;
    long n=sc.nextInt();
    long power=1;
    
    for(int i=1;i<=n;i++) {
      power=(power*i) % m;
    }
    System.out.println(power);
  }
}


Measured memory_bytes: 23764
/**
 *   created: 18 August 2019  19:06:17
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================

int main()
{
    optimizeIO();
    int tt=1;
    // cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector< double > h(n);
        rep(i,0,n)
            cin>>h[i];
        vector< vector<double> > mem(n,vector<double>(n+1,0));
        mem[0][0] = 1-h[0];
        mem[0][1] = h[0];
        rep(i,1,n){
            mem[i][0] = mem[i-1][0]*(1-h[i]);
            rep(j,1,n+1){
                mem[i][j] = mem[i-1][j-1]*h[i] + mem[i-1][j]*(1-h[i]);
            }
        }
        double res = 0;
        rep(i,n/2+1,n+1){
            // trace1(i);
            res += mem[n-1][i];
        }
        // rep(i,0,n){
        //     rep(j,0,n+1)
        //         cout<<mem[i][j]<<" ";
        //     cout<<endl;
        // }
        printf("%0.10f",res);
    }
    return 0;
}


Measured memory_bytes: 70784
while True:
    n, m = map(int, input().split())
    if n == m == 0:
        break
    l = int(input())
    v = [[] for i in range(m + 1)]
    for _ in range(l):
        t, nn, m, s = map(int, input().split())
        s = 1 if s else -1
        v[m].append((t, s))
    q = int(input())
    for _ in range(q):
        s, e, m = map(int, input().split())
        v[m].sort()
        arr = [0] * 1261
        for i, j in v[m]:
            arr[i] += j
        for i in range(540, len(arr) - 1):
            arr[i + 1] += arr[i]
        res = 0
        for i in range(s, e):
            if arr[i] > 0:
                res += 1
        print(res)

Measured memory_bytes: 8824
from collections import Counter
n = int(input())
li = list(map(int,input().split()))
 
r = [i-a for i, a in enumerate(li)]
l = [a+i for i, a in enumerate(li)]
#print(r)
#print(l)

c1 = dict(Counter(r))
c2 = dict(Counter(l))
#print(c1)
#print(c2)

cnt = 0
for k in c2.keys():
    if k in c1:
        cnt += c2[k] * c1[k]

print(cnt)

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

int main()
{
	long long N;

	cin >> N;

	long long L0 = 2;
	long long L1 = 1;

	if (N == 1) {
		cout << L1;
		return 0;
	}

	if (N == 2) {
		cout << L1 + L0;
		return 0;
	}

	long long result = 0;
	long long tempL[N + 1];
	tempL[0] = 2;
	tempL[1] = 1;
	for (int loop = 2; loop <= N; ++loop) {
		tempL[loop] = tempL[loop - 1] + tempL[loop - 2];
	}

	cout << tempL[N];

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include "cstdio"
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#include "cctype"
#include "set"

using namespace std;

int main ()
{
    int N;
    string hon="24579",pon="0168",bon="3";
    cin >> N;

    if (hon.find(std::to_string(N%10)) != std::string::npos) cout << "hon";
    if (pon.find(std::to_string(N%10)) != std::string::npos) cout << "pon";
    if (bon.find(std::to_string(N%10)) != std::string::npos) cout << "bon";
    return 0;
}


Measured memory_bytes: 3660
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		new Main();
	}

	public Main() {
		new aoj0053().doIt();
	}

	class aoj0053 {	
		int prime[] = new int [300001];
		boolean is_prime[] = new boolean[300001];
		void sieve(int n){
			int p = 0;
			for(int i = 0;i <=n;i++)is_prime[i] = true;
			for(int i = 2;i <= n;i++){
				if(is_prime[i]){
					prime[p++]=i;
					for(int j = 2*i;j <= n;j+=i)is_prime[j] = false;
				}
			}
		}
		void doIt() {
			sieve(300000);
			while (true) {
				int n = sc.nextInt();
				if(n == 0)break;
				int cnt = 0;
				int cnt2 = 2;
				int ans = 0;
				while(cnt < n){
					if(is_prime[cnt2]){
						ans = ans + cnt2;
						cnt++;
					}
					cnt2++;
				}
				System.out.println(ans);
			}
		}
	}
}

Measured memory_bytes: 22484
#include <iostream>

int main(void){
    int ans=0, l, r;
    bool flg=false;
    std::string s;
    std::cin >> s;

    for (int i=0; i<s.size(); ++i){
        char a = s.at(i);
        if (a == 'A' && not(flg)){
            flg = true;
            l = i;
        } else if (a == 'Z' && flg){
            r = i;
            ans = r - l + 1;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


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

 //d[u][v]は辺=(u,v)のコスト（存在しない場合はinf,ただしd[i][i]=0）


int main (){
	int n;cin>>n;
	int a[n+5][n+5],b[n+5][n+5];
	int t;
	
	for(int i=0;i<n;i++){
            		for(int j=0;j<n;j++){
            			b[i][j] = 0;	
            		
           			}
            }
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>a[i][j];
		}
	}

	for(int k=0;k<n;k++){
            	for(int i=0;i<n;i++){
            		for(int j=0;j<n;j++){
            			t = a[i][k] + a[k][j];
            			
            			if(a[i][j]>t){
            				cout<<-1<<endl;
            				return 0;
            			}
            			
            			else if(a[i][j] == t && k != i && k != j) {
            				b[i][j]=1;
            			
            			}
            		}
            	}
	}
	long long int ans = 0;
	for(int i=0;i<n;i++){
            		for(int j=0;j<n;j++){
            			if(i>=j) continue;
            			ans += a[i][j] * !b[i][j];	
            		
           			}
            }
            cout<<ans<<endl;
            
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>
int main ( void ) {
    int i,n=0,ban,banm1[3]={0},banm2[3]={0},socnt=0,sonom[100]={0};
    double max1[3]={999,999,999},max2[3]={999,999,999},input,sonota[100]={0};
    for(i=0;i<24;i++){
        if(i==8||i==16){
            n++;
        }
        scanf("%d %lf",&ban,&input);
        if(max1[n]>input&&max2[n]>=input){
            sonota[socnt]=max2[n];
            sonom[socnt]=banm2[n];
            socnt++;
            max2[n]=max1[n];
            banm2[n]=banm1[n];
            max1[n]=input;
            banm1[n]=ban;
        }else if(max1[n]<input&&max2[n]>input){
            sonota[socnt]=max2[n];
            sonom[socnt]=banm2[n];
            socnt++;
            max2[n]=input;
            banm2[n]=ban;
        }else{
            sonota[socnt]=input;
            sonom[socnt]=ban;
            socnt++;
        }
        
    }
    for(i=0;i<3;i++){
        printf("%d %.2f\n",banm1[i],max1[i]);
        printf("%d %.2f\n",banm2[i],max2[i]);
    }
    int s1=0,s2=0;
    double smax1=999,smax2=999;
    for(i=0;i<socnt;i++){
        if(smax1>sonota[i]&&smax2>=sonota[i]){
            smax2=smax1;
            s2=s1;
            smax1=sonota[i];
            s1=sonom[i];
        }else if(smax1<sonota[i]&&smax2>sonota[i]){
            smax2=sonota[i];
            s2=sonom[i];
        }
    }
    printf("%d %.2f\n",s1,smax1);
    printf("%d %.2f\n",s2,smax2);
    return 0;
}

Measured memory_bytes: 652
var n,m,k: int64;
begin
read(n,m,k);
if n-k<0 then
begin
 k:=k-n; n:=0;
end else begin  n:=n-k; k:=0; end;
if k>0 then
if k>=m then m:=0 else m:=m-k;
write(n,' ',m);


end.


Measured memory_bytes: 128
N = int(raw_input())
N -= 1
alphabet = 'abcdefghijklmnopqrstuvwxyz'

p = 26
while N >= p:
  N -= p
  p *= 26
  
p /= 26
answer = ''
while p >= 1:
  answer += alphabet[N/p]
  
  N %= p
  p /= 26
  

print answer


Measured memory_bytes: 64376
#if 1

#include <bits/stdc++.h>
using namespace std;
char a[1005];

int main()
{
    cin >> a;
    int n = strlen(a);
    int ans = 0;
    for(int i = 0;i < n;i++)
    {
        if(a[i] == 'o') ans++;
    }
    ans += 15-n;
    if(ans >= 8)
    {
        cout << "YES";
    }
    else cout << "NO";
}

#endif // 1++

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    string ans = "No";
    for(int i=1;i<=3;i++){
        if((a*b*i)%2 != 0){
            ans = "Yes";
        }
    }
    cout << ans << endl;
}


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

int main() {
	int TA, TH;
	int AA, AH;

	cin >> TH >> TA >> AH >> AA;

	for (int i = 0;; i++) {
		if (i % 2  == 1)
			TH = TH - AA;
		if (i % 2 == 0)
			AH = AH - TA;
		if (AH <= 0 || TH <= 0) {
			if (AH <= 0)
				cout << "Yes" << endl;
			if (TH <= 0)
				cout << "No" << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 3132
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++) cin >> a[i];

    int cnt[9]={0};
    for(int i=0;i<n;i++){
        for(int j=0;j<8;j++){
            if(j*400 <= a[i] && a[i] < (j+1)*400) cnt[j]++;
        }
        if(3200 <= a[i]) cnt[8]++;
    }
    int mn=0,mx=0;
    for(int j=0;j<8;j++){
        if(cnt[j] > 0){
            mn++;
            mx++;
        }
    }
    if(mn == 0) mn++;
    if(cnt[8] > 0) mx += cnt[8];
    cout << mn << ' ' << mx << endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

import collections

n=int(input())
a = [int(i) for i in input().split()]

ae = [a[i] for i in range(n) if i%2==0]
ao = [a[i] for i in range(n) if i%2==1]

aedic = collections.Counter()

aodic = collections.Counter()

for i in ae:
    aedic[i]+=1
for i in ao:
    aodic[i]+=1

p=aedic.most_common(2)
q=aodic.most_common(2)

#print(p,q)

if p[0][0] != q[0][0]:
#    print("a")
    print(n-p[0][1]-q[0][1])
elif len(p)==1 and len(q)!=1:
#    print("b")
    print(n-p[0][1]-q[1][1])
elif len(p)!=1 and len(q)==1:
#    print("c")
    print(n-p[1][1]-q[0][1])
elif len(p)==1 and len(q)==1:
#    print("c")
    print(n//2)
else:
#    print("d")
    a=min(n-p[-1][1]-q[0][1], n-p[0][1]-q[-1][1])
    print(a)
    
    


Measured memory_bytes: 19032
n = int(input())
v = list(map(int, input().split()))
cnt0 = [0 for i in range(100001)]
cnt1 = [0 for i in range(100001)]
for i, elem in enumerate(v):
    if i%2==0:
        cnt0[elem] += 1
    else:
        cnt1[elem] += 1

max_first0 = -1
argmax_first0 = 0
max_second0 = -1
argmax_second0 = 0
for i, elem in enumerate(cnt0):
    if elem>=max_second0:
        max_second0 = elem
        argmax_second0 = i
    if elem>=max_first0:
        max_second0 = max_first0
        argmax_second0 = argmax_first0
        max_first0 = elem
        argmax_first0 = i
max_first1 = -1
argmax_first1 = 0
max_second1 = -1
argmax_second1 = 0
for i, elem in enumerate(cnt1):
    if elem>=max_second1:
        max_second1 = elem
        argmax_second1 = i
    if elem>=max_first1:
        max_second1 = max_first1
        argmax_second1 = argmax_first1
        max_first1 = elem
        argmax_first1 = i
#print(argmax_first0, argmax_first1, argmax_second0, argmax_second1)
#print(max_first0, max_first1, max_second0, max_second1)

if argmax_first0 != argmax_first1:
    ans = n//2-max_first0 + n//2-max_first1
else:
    ans = min(n-max_first0-max_second1, n-max_first1-max_second0)

print(ans)


Measured memory_bytes: 13984
#include <bits/stdc++.h>
using namespace std;
#pragma region
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << (#x) << "] = [", _print(x)
#else
#define debug(x...)
#endif
#pragma endregion
typedef long long ll;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(v) int((v).size())
#define int ll
#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back

int n;
vector<int> a;
void solve()
{
    cin>>n;
    a.resize(n);
    forn(i, n) cin>>a[i];
    int xs = 0;
    forn(i, n) xs ^= a[i];
    forn(i, n) cout << (xs^a[i]) <<' ';
    cout << '\n';
}


signed main()
{
    int T = 1;
    ios_base::sync_with_stdio(0); cin.tie(0);
    //cin >> T;
    for(int i=1;i<=T;++i)
    {
        //cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 4692
n,m=map(int,input().split())
ab=[[int(i) for i in input().split()] for i in range(n)]
cd=[[int(i) for i in input().split()] for i in range(m)]
distance=[[] for i in range(n)]
for i in range(n):
    for l in range(m):
        distance[i].append(abs(ab[i][0]-cd[l][0])+abs(ab[i][1]-cd[l][1]))
for i in range(n):
    print(distance[i].index(min(distance[i]))+1)

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	int [][] ver, hor;
	int ans;
	String [][] boards;
	
	int [] debug;

	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			String inputline = sc.nextLine();
			if(inputline.equals("END")) break;
			boards = new String[2][10];
			boards[0] = inputline.split(" ");
			for(int i = 0; i < 10; i++){
				StringBuilder sb = new StringBuilder(boards[0][i]);
				sb.reverse();
				boards[1][i] = sb.toString();
			}
			ver = new int[5][5];
			hor = new int[5][5];
			for(int i = 0; i < 5; i++){
				Arrays.fill(ver[i], -1);
				Arrays.fill(hor[i], -1);
			}
			
			//debug
			debug = new int[10];
			Arrays.fill(debug, -1);
			
			ans = 0;
			dfs(0);
			System.out.println(ans/ 8);
		}
	}
	
	private void disp(){
		for(int i = 0; i < 5; i++){
			for(int j = 0; j < 5; j ++){
				System.out.print(hor[i][j]);
			}
			System.out.print(" ");
			for(int j = 0; j < 5; j++){
				System.out.print(ver[i][j]);
			}
			System.out.println();
		}
		System.out.println();
		for(int i= 0; i < 10; i++){
			System.out.print(debug[i] + " ");
		}
		System.out.println();
	}
	
	private void dfs(int deep){
		if(deep == 10){
			ans++;
			//disp();
			return ;
		}
		//hor
		for(int i = 0; i < 5; i++){
			if(hor[i][0] == -1){
				for(int dir = 0; dir < 2; dir++){
					boolean isarrange = true;
					for(int j = 0; j < 5; j++){
						hor[i][j] = boards[dir][deep].charAt(j) - '0';
						if(ver[i][j] != -1 && ver[i][j] + hor[i][j] != 1){
							isarrange = false;
						}
					}
					if(isarrange){
						debug[i] = deep;
						dfs(deep + 1);
						debug[i] = -1;
					}
					for(int j = 0; j < 5; j++){
						hor[i][j] = -1;
					}
					if(boards[0][deep].equals(boards[1][deep])){
						break;
					}
				}
			}
		}
		//ver
		for(int i = 0; i < 5; i++){
			if(ver[0][i] == -1){
				for(int dir = 0; dir < 2; dir++){
					boolean isarrange = true;
					for(int j = 0; j < 5; j++){
						ver[j][i] = boards[dir][deep].charAt(j) - '0';
						if(hor[j][i] != -1 && ver[j][i] + hor[j][i] != 1){
							isarrange = false;
						}
					}
					if(isarrange){
						debug[i+5] = deep;
						dfs(deep + 1);
						debug[i+5] = -1;
					}
					for(int j = 0; j < 5; j++){
						ver[j][i] = -1;
					}
					if(boards[0][deep].equals(boards[1][deep])){
						break;
					}
				}
			}
		}
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

Measured memory_bytes: 12000
def main():
    import sys
    input = sys.stdin.readline

    mod = 1000000007
    r1, c1, r2, c2 = map(int, input().split())

    # comb init
    nmax = 2 * 10 ** 6 + 5  # change here
    fac = [0] * (nmax + 1)
    finv = [0] * (nmax + 1)
    inv = [0] * (nmax + 1)
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2, nmax):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

    def comb(n, r):
        if n < r:
            return 0
        else:
            return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod

    def f(r, c):
        ret = 0
        for i in range(r+1):
            ret = (ret + comb(i+1+c, c))%mod
        return ret

    print((f(r2, c2) - f(r2, c1-1) - f(c2, r1-1) + f(r1-1, c1-1))%mod)


if __name__ == '__main__':
    main()


Measured memory_bytes: 86000
#include <bits/stdc++.h>
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MAX max<ll>
#define MIN min<ll>
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define drop(x) cout << (x) << '\n', exit(0)
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
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; }
ll devc(ll x, ll y) { return (x + y - 1) / y; }

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

    ll N, M;
    cin >> N >> M;
    vec O(N + 1);
    rep(i, M){
        ll l, r;
        cin >> l >> r;
        --l, --r;
        ++O[l], --O[r+1];
    }
    rep(i, N) O[i + 1] += O[i];

    ll ans = 0;
    rep(i, N) ans += O[i] == M;
    print(ans);

    return 0;
}

Measured memory_bytes: 1024
from sys import stdin
from sys import setrecursionlimit
from itertools import product
setrecursionlimit(10 ** 7)

a,b,c = map(int,stdin.readline().rstrip().split())

li = ["a","b","c"]
k = int(input())

lin = list(product(li, repeat=k))

for i in lin:
    A = a
    B = b
    C = c
    for j in i:
        if j == "a":
            A *= 2
        elif j == "b":
            B *= 2
        else:
            C *= 2
    if A < B and B < C:
        print("Yes")
        exit()

print("No")

Measured memory_bytes: 9340
//Robs Code
/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define pii pair<int,int>
using namespace std;
int n,m,i,j,l,k,x,y,a,b,cnt[3],sum[3];
/***********MAIN**************/
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n;
	int dp[n+1],h[n+1];
	for(int i=1;i<=n;i++){
		cin>>h[i];
	}
	dp[1] = 0;
	dp[2] = abs(h[2] - h[1]);
	for(int i=3;i<=n;i++){
		dp[i] = min(dp[i-1]+abs(h[i] - h[i-1]), dp[i-2]+abs(h[i] - h[i-2]));
	}
	cout<<dp[n];
	return 0;
}
//.........

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
int a[11],vis[11];
bool check(int n)
{
    while(n)
    {
        if(vis[n%10])
            return false;
        n /= 10;
    }
    return true;
}
int main()
{
     int n,k,num;
    while(scanf("%d%d",&n,&k)!=EOF)
    {
        memset(vis,0,sizeof(vis));
       for(int i=0; i<k; i++)
       {
           scanf("%d",&num);
           vis[num] = 1;
       }
       for(int i=n; ; i++)
       {
           if(check(i))
           {
               cout<<i<<endl;
               break;
           }
       }

    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,ll>;
using Graph= vector<vector<ll>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

int main(){
  ll n; cin>> n ;
  vector<ll> A(n) ;rep(i,n) cin>>A[i] ;
  vector<ll> cnt(n+5) ; rep(i,n) cnt[A[i]]++ ;
  ll ans= 0;
  rep(i,n+5){
    ll a= cnt[i] ;
    ans+= a*(a-1)/2 ;
  }
 rep(i,n) cout<< ans-cnt[A[i]]+1<<endl ;
  return 0;
  }

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin>>s;
	map<char,int> ct;
	for (const char ch : s)
		ct[ch]++;
	cout<<(ct['9']?"Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  long i,n,m,sum = 0;
  scanf("%ld",&n);

  for (i = 1; i * (i+1) <= n; i++) // 約数を探索
    if(n % i == 0){
      m = n / i - 1;
      if(m > i)
        sum += m;
      else
        break;
    }
  printf("%ld\n",sum);
  
  return 0;
}

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

using namespace std;

char a[100][100];

bool ok_H[100];
bool ok_W[100];

int main()
{
	int H, W;
	cin >> H >> W;
	
	char c;

	for (int i = 0; i < H; i++)
	{
		bool allwhite = true;
		for (int j = 0; j < W; j++)
		{
			cin >> c;
			if (c == '#')
			{
				allwhite = false;
			}
			a[i][j] = c;
		}
		
		ok_H[i] = !allwhite;
	}

	for (int j = 0; j < W; j++)
	{
		bool allwhite = true;
		for (int i = 0; i < H; i++)
		{
			if (a[i][j] == '#')
			{
				allwhite = false;
				break;
			}
		}
		
		ok_W[j] = !allwhite;
	}

	for (int i = 0; i < H; i++)
	{
		if (ok_H[i])
		{
			for (int j = 0; j < W; j++)
			{
				if(ok_W[j]) cout << a[i][j];
			}
			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  cout << a * b / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};


int main() {
	bool b[1000001] = { false };
	b[0] = true;
	b[1] = true;
	for (int i = 2;i < 1000001;i++) {
		if (!b[i]) {
			for (int j = i + i;j < 1000001;j += i) {
				b[j] = true;
			}
		}
	}
	int a, d, n;
	while (cin>>a>>d>>n,n) {
		for (int i = a;i < 1000001;i+=d) {
			if (!b[i]) {
				n--;
				if (n == 0) {
					cout << i << endl;
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 3972
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
const long double PI = acos(-1);
const long long INF = (1 << 30);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

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

  ll n;
  cin >> n;
  vector<ll> d(n);
  for(ll i = 0; i < n; i++) cin >> d[i];
  sort(all(d));
  ll l = d[n/2-1], r = d[n/2];
  if(l == r) cout << 0 << endl;
  else cout << r - l << endl; 
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main(){
    int X,A;cin>>X>>A;
    if(X>=A){
        cout<<10<<endl;
    }else
    {
        cout<<0<<endl;
    }
    

}

Measured memory_bytes: 256