akhauriyash/Code-Regression huggingface dataset:
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

bool sheep[100010] = {};

bool check(string s, int n) {
  for (int i = 1; i < n - 1; i++) {
    if (sheep[i]) {
      if (s[i] == 'o') {
        sheep[i + 1] = sheep[i - 1];
      } else {
        sheep[i + 1] = !sheep[i - 1];
      }
    } else {
      if (s[i] == 'o') {
        sheep[i + 1] = !sheep[i - 1];
      } else {
        sheep[i + 1] = sheep[i - 1];
      }
    }
  }
  if (sheep[0]) {
    if (s[0] == 'o') {
      if (sheep[n - 1] != sheep[1]) return false;
    } else {
      if (sheep[n - 1] == sheep[1]) return false;
    }
  } else {
    if (s[0] == 'o') {
      if (sheep[n - 1] == sheep[1]) return false;
    } else {
      if (sheep[n - 1] != sheep[1]) return false;
    }
  }
  if (sheep[n - 1]) {
    if (s[n - 1] == 'o') {
      if (sheep[n - 2] != sheep[0]) return false;
    } else {
      if (sheep[n - 2] == sheep[0]) return false;
    }
  } else {
    if (s[n - 1] == 'o') {
      if (sheep[n - 2] == sheep[0]) return false;
    } else {
      if (sheep[n - 2] != sheep[0]) return false;
    }
  }
  return true;
}

void output(int n) {
  REP(i, n) {
    if (sheep[i]) {
      cout << "S";
    } else {
      cout << "W";
    }
  }
  cout << endl;
}

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

  int N;
  cin >> N;

  string s;
  cin >> s;

  sheep[0] = true;
  sheep[1] = true;
  if (check(s, N)) {
    output(N);
    return 0;
  }

  sheep[0] = true;
  sheep[1] = false;
  if (check(s, N)) {
    output(N);
    return 0;
  }

  sheep[0] = false;
  sheep[1] = false;
  if (check(s, N)) {
    output(N);
    return 0;
  }

  sheep[0] = false;
  sheep[1] = true;
  if (check(s, N)) {
    output(N);
    return 0;
  }

  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int x[110], y[110], h[110];
    rep(i, n) cin >> x[i] >> y[i] >> h[i];
    int maximam = 0;
    rep(i, n) maximam = max(maximam, h[i]);
    REP(i, 0, 100) {
        REP(j, 0, 100) {
            REP(H, maximam, maximam + 100) {
                bool ok = true;
                rep(k, n) {
                    int tmpH = max(0, H - abs(x[k] - i) - abs(y[k] - j));
                    if(h[k] != tmpH) ok = false;
                    if(!ok) break;
                }
                if(ok) {
                    cout << i << " " << j << " " << H << endl;
                    return 0;
                }
            }
        }
    }

    return 0;
}


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

using namespace std;

int p1( string const& expr, int& pos );
int p2( string const& expr, int& pos );
int p3( string const& expr, int& pos );

int p1( string const& expr, int& pos )
{
    int result = p2(expr, pos);
    if ( result == -1 )
        return -1;

    while( expr[pos] == '+' || expr[pos] == '-' ) {
        int const cp = pos;
        ++pos;
        int const a = p2( expr, pos );
        if ( expr[cp] == '+' )
            result += a;
        else
            result -= a;
    }

    return result;
}

int p2( string const& expr, int& pos )
{
    int result = p3(expr, pos);
    if ( result == -1 )
        return -1;

    while( expr[pos] == '*' || expr[pos] == '/' ) {
        int const cp = pos;
        ++pos;
        int const a = p3( expr, pos );
        if ( expr[cp] == '*' )
            result *= a;
        else
            result /= a;
    }

    return result;
}

int p3( string const& expr, int& pos )
{
    if ( expr[pos] >= '0' && expr[pos] <= '9' ) {
        string s;
        do {
            s += expr[pos];
            ++pos;
        } while( pos < expr.size() && expr[pos] >= '0' && expr[pos] <= '9' );
        
        return atoi( s.c_str() );

    } else if ( expr[pos] == '(' ){
        ++pos;
        int const res = p1( expr, pos );
        ++pos; // ')'
        return res;
    }

    return -1;
}



int main()
{
    int n;
    cin >> n;
    cin.ignore();
    for( int iii=0; iii<n; ++iii ) {
        string s;
        getline( cin, s );
//        cout << s << endl;
        int pos = 0;
        cout << p1( s, pos ) << endl;
    }
}

Measured memory_bytes: 1216
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""
A,B,M = m()
a = l()
b = l()

po = min(a) + min(b)

for i in range(M):
    x,y,z = m()
    po = min(a[x-1] + b[y-1]-z,po)

print(po) 

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


int main() {
    int n,m;
    cin >> n >> m;
    if(n == m){
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
    int n, k;
    cin >> n >> k;
    string S;
    cin >> S;
    string s_ = S;

    rep(i, S.size()-1) {
        if(S[i] == S[i+1]) {
            S = S.substr(0, i) + S.substr(i+1);
            --i;
        }
    }

    int num = n - S.size();

    cout << min(n-1, num+2*k) << endl;
}

Measured memory_bytes: 728
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,vl>;
using Tu = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
const ll INF=1LL<<60;
const ll MOD=1000000007;

ll MAX=200001;
vector<ll> F(MAX,1);
 
void fact(){
    for(ll i=1;i<MAX;i++){
    F[i]=F[i-1]*i%MOD;
    }
return;
}


// mod. m での a の逆元 a^{-1} を計算する
//ただしmとaが互いにその時のみ
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

long long comb(long long a, long long b){
    return (((F[a]*modinv(F[b],MOD))%MOD)*modinv(F[a-b],MOD))%MOD;
}

//↓↓↓↓↓↓fact()ってちゃんとつける！！！！！！！！！！！↓↓↓↓↓↓
//↓↓↓↓↓↓fact()ってちゃんとつける！！！！！！！！！！！↓↓↓↓↓↓
//↓↓↓↓↓↓fact()ってちゃんとつける！！！！！！！！！！！↓↓↓↓↓↓
//↓↓↓↓↓↓fact()ってちゃんとつける！！！！！！！！！！！↓↓↓↓↓↓
//↓↓↓↓↓↓fact()ってちゃんとつける！！！！！！！！！！！↓↓↓↓↓↓


int main(){
    fact();
    ll N;
    cin >> N;
    ll M;
    cin >> M;
    ll K;
    cin >> K;

    //x座標だけを見た、和
    ll X=0;
    //Y座標だけを見た和
    ll Y=0;

    //X 
    for(ll i=1;i<=M-1;i++){
        X+=i*N*N*(M-i)%MOD;
        X%=MOD;
    ;}
    //Y
    for(ll i=1;i<=N-1;i++){
        Y+=i*M*M*(N-i)%MOD;
        Y%=MOD;
    ;}

    ll j=(((X+Y)%MOD)*comb(N*M,K))%MOD;
    j%=MOD;
    ll h=modinv(comb(N*M,2),MOD)%MOD;
    h%=MOD;
    ll i=(K*(K-1)/2)%MOD;

    cout<<((j*h%MOD)*i)%MOD<<endl;



    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i, a, n) for (int i=(a); i<(n); i++)
#define per(i, a, n) for (int i=(a); i>(n); i--)
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 1e9+7;
using namespace std;

ll a[maxn];

bool check(ll a, ll b, ll c) {
	if (a + b > c && b + c > a && c + a > b && a != b && b!=c && a!=c)
		return 1;
	return 0;
}

void solve() {
	ll n,ans=0; cin >> n;
	rep(i,0,n) cin >> a[i];
	rep(i,0,n) {
		rep(j,i+1,n) {
			rep(k,j+1,n) {
				if (check(a[i],a[j],a[k]))
					ans++;
			}
		}
	}
	cout << ans << '\n';
}

int main(int argc, char * argv[]) 
{
	ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef DEBUG
	freopen("C:/Users/Fish_Brother/Desktop/in", "r", stdin);
	//freopen("C:/Users/Fish_Brother/Desktop/out", "w", stdout);
#endif

	//int t; cin >> t; while(t--)
	solve();

    return 0;
}

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

 using namespace std;

 int main() {
   int N, D, X, i;

   cin >> N >> D >> X;

   vector<int> A(N);


   for (i = 0; i < N; i++) cin >> A.at(i);

   int choco = 0;
   for (i = 0; i < N; i++) {
     choco += (D - 1) / A.at(i) + 1;
   }

   cout << X + choco << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define go(i, a, n) for (ll i = a; i < n; i++)
#define gor(i, a, n) for (int i = n - 1; i >= a; i--)
#define show(x) cout << x << '\n'
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vpair vector<pair<ll, ll>>
#define vtuple vector<tuple<ll, ll, ll>>
#define ff first
#define ss second
#define mod 1000000007
#define memset(a, k) memset(a, k, sizeof(a))
#define answer(z, k) cout << "Case #" << z << ": " << k << endl;
auto t1 = chrono::high_resolution_clock::now();
bool prime[1000001];
ll expo(ll a, ll b)
{
	if (b == 0)
		return 1;
	if (b % 2)
		return ((a % mod) * (expo((a * a) % mod, b / 2) % mod)) % mod;
	return expo((a * a) % mod, b >> 1) % mod;
}
ll mul(ll a, ll b)
{
	a = a % mod;
	b = b % mod;
	if (b == 0)
		return 0;
	if (b % 2)
		return ((a % mod) + (mul((a + a) % mod, b >> 1) % mod)) % mod;
	return mul((a + a) % mod, b >> 1) % mod;
}

bool ispoweroftwo(ll x)
{
	return x && !(x & (x - 1));
}
ll xorcal(ll n)
{
	if (n % 4 == 0)
		return n;
	if (n % 4 == 1)
		return 1;
	if (n % 4 == 2)
		return n + 1;
	if (n % 4 == 3)
		return 0;
}
void sieve(ll n)
{
	memset(prime, true);
	prime[0] = false;
	prime[1] = false;
	for (ll i = 2; i * i <= n; i++)
	{
		if (prime[i] == true)
		{
			for (ll j = i * i; j <= n; j += i)
				prime[j] = false;
		}
	}
}
bool isprime(ll n)
{
	if (n <= 1)
		return false;
	if (n <= 3)
		return true;

	if (n % 2 == 0 or n % 3 == 0)
		return false;

	for (ll i = 5; i * i <= n; i += 6)
	{
		if (n % i == 0 or n % (i + 2) == 0)
			return false;
	}
	return true;
}

ll modinverse(ll a, ll m)
{
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m;
		a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

ll gcd(ll a, ll b)
{
	if (a == 0)
		return b;
	return (b % a, a);
}
bool ispalindrome(string s)
{
	string t = s;
	reverse(t.begin(), t.end());
	if (t == s)
		return true;
	return false;
}
void binary(ll a[], ll n)
{
	gor(i, 0, 64)
	{
		ll k = n >> i;
		a[i] = k & (ll)1;
	}
}
ll countBits(ll n)
{
	if (n == 0)
		return 0;
	return 1 + countBits(n & (n - 1));
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	set<string> s;
	go(i, 0, n)
	{
		string t;
		cin >> t;
		s.insert(t);
	}
	show(s.size());
	auto t2 = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(t2 - t1).count();
	clog << "Time taken = " << duration * 1.0 / 1000 << " seconds" << endl;
	return 0;
}


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

using namespace std;

#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define MP make_pair
#define PB push_back
#define PH push
#define fst first
#define snd second
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e18 + 7;
const int maxn = 2e5 + 5;

int n, tot = 0;
ll x, d, ans;
vector<pll> seq[maxn];
map<ll, int> mp;

inline int getId(ll x){
	if(mp.find(x) == mp.end())
		mp[x] = tot++;
	return mp[x];
}

int main(){
	scanf("%d%lld%lld", &n, &x, &d);
	if(!d){
		if(x)
			printf("%d\n", n + 1);
		else
			puts("1");
		return 0;
	}
	if(d < 0){
		x = -x;
		d = -d;
	}
	REP(k, 0, n){
		ll r = k * x % d, q = k * x / d;
		if(!k)
			seq[getId(r)].PB(MP(q, q));
		else{
//			printf("%d %d %d\n", k, k * (k - 1) / 2, k * (2 * n - k - 1) / 2);
			seq[getId(r)].PB(MP(q + 1ll * k * (k - 1) / 2, q + 1ll * k * (2 * n - k - 1) / 2));
		}
	}
	FOR(i, 0, tot){
		sort(seq[i].begin(), seq[i].end());
		ll l = -INF + 1, r = -INF;
		FOR(j, 0, seq[i].size()){
//			printf("i = %d [%d, %d]\n", i, seq[i][j].fst, seq[i][j].snd);
			if(seq[i][j].fst > r){
//				printf("l = %lld r = %lld\n", l, r);
				ans += (r - l + 1);
				l = seq[i][j].fst;
				r = seq[i][j].snd;
			}
			else{
				r = max(r, seq[i][j].snd);
			}
		}
		ans += (r - l + 1);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 23680
N, A = map(int, input().split())
x = list(map(int, input().split()))
MAX_J = sum(x)
dp = [[0] * (MAX_J+1) for i in range(N+1)]
dp[0][0] = 1
for n in range(N):
    for i in range(N)[::-1]:
        for j in range(MAX_J-x[n]+1)[::-1]:
            dp[i+1][j+x[n]] += dp[i][j]
ans = 0
for i in range(1, N+1):
    if A * i <= MAX_J:
        ans += dp[i][A * i]
print(ans)


Measured memory_bytes: 43536
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール

// 処理内容
int main() {
    
    ll n, m; cin >> n >> m;
    vector<vector<ll>> g(n);
    REP(i, m) {
        ll a, b; cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    // dp[S][j] := すでに訪れた点の集合S、今点jにいるパスの数
    vector<vector<ll>> dp(1 << n, vector<ll>(n, 0));
    dp[1][0] = 1;

    REP(i, 1 << n) {
        if (!i) continue;
        REP(j, n) {
            for (ll k : g[j]) if (!(i & (1 << k))) {
                dp[i | (1 << k)][k] += dp[i][j];
            }
        }
    }

    cout << accumulate(ALL_OF(dp[(1 << n) - 1]), 0LL) << endl;
    
}

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

#define NAME "Sushi"
#define show(x) cout << (#x) << " is " << (x) << endl
#define ll long long
#define ms(arr,val) memset(arr,val,sizeof(arr))
#define len length()

const int maxn = 2e5;
double dp[301][301][301];
int n;
double cal(int i,int j,int k){
    if(i+j+k==0) return 0;
    //cout<<i<<" "<<j<<" "<<k<<" "<<endl;

    if ((int)dp[i][j][k] != -1) return dp[i][j][k];

    double val =  1.0*n/(i+j+k) ;

    if (i>0) val+= 1.0*i/(i+j+k)*cal(i-1,j,k);
    if (j>0) val+= 1.0*j/(i+j+k)*cal(i+1,j-1,k);
    if (k>0) val+= 1.0*k/(i+j+k)*cal(i,j+1,k-1);
    return dp[i][j][k] = val;
}
int cnt[4];
int main(){
    //ifstream cin(NAME".inp");
    //ofstream cout(NAME".out");
    int tmp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>tmp;
        cnt[tmp]++;
    }

    for(int i =0;i<301;i++)
        for(int j =0;j<301;j++)
            for(int k =0;k<301;k++) dp[i][j][k] =-1;

    cout<<setprecision(15)<<fixed<<cal( cnt[1],cnt[2], cnt[3] );


}


Measured memory_bytes: 216860
#include<iostream>
#include<cstdio>
#define N 101
using namespace std;

int main(){

  int n,n2,data,u;
  int g[N][N]; 
 //load n
  cin >>n;

  //initialize
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      g[i][j]=0;
    }
  }

  for(int i=0;i<n;i++){
    scanf("%d%d",&u,&n2);
    for(int j=0;j<n2;j++){
      scanf("%d",&data);
      g[u][data]=1;
    }
  }

  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      printf("%d",g[i][j]);
      if(j!=n)printf(" ");
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 0
N, K = map(int, input().split())
A = list(map(int, input().split()))
M = 50
l = len(str(N))
dp = [[-1] * 2 for _ in range(M + 1)]
dp[0][0] = 0
for i in range(M):
    mask = 1 << (M - i - 1)
    num = 0
    for j in range(N):
        if A[j] & mask:
            num += 1
    c0 = mask * num
    c1 = mask * (N - num)
    if dp[i][1] != -1:
        dp[i + 1][1] = max(dp[i + 1][1], dp[i][1] + max(c0, c1))
    if dp[i][0] != -1:
        if K & mask:
            dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + c0)
            dp[i + 1][0] = max(dp[i + 1][0], dp[i][0] + c1)
        else:
            dp[i + 1][0] = max(dp[i + 1][0], dp[i][0] + c0)
print(max(dp[M][0], dp[M][1]))




Measured memory_bytes: 14660
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
  int n, quantum;
  string name;
  int time;
  queue<pair<string, int> > Q;

  cin >> n >> quantum;
  for (int i = 0; i < n; i++)
  {
    cin >> name >> time;
    Q.push(make_pair(name, time));
  }

  pair<string, int> u;
  int elaps = 0;
  int duration;

  while (!Q.empty())
  {
    u = Q.front();
    Q.pop();
    duration = min(u.second, quantum);
    u.second -= duration;
    elaps += duration;
    if (u.second > 0)
    {
      Q.push(u);
    }
    else
    {
      cout << u.first << " " << elaps << endl;
    }
  }

  return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;
    vector<double> v(N);
    REP(i, N) cin >> v[i];
    sort(v.begin(), v.end());
    double res = v[0];
    REP(i, N-1){
    	res = 1.0*(res + v[i+1])/2.0;
    }
    printf("%.10f\n", res);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(void)
{
    string s;
    bool b1=0,b2=0;
    cin>>s;
    for(auto i : s) 
    {
        if(!b2&&i=='C') b1=true;
        if(b1&&i=='F') {b2=true;cout<<"Yes";return 0;}
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
dp = [0] * n
dp[1] = (a[1] - a[0]).abs
(2...n).to_a.each do |i|
  dp[i] = [dp[i - 1] + (a[i] - a[i - 1]).abs, dp[i - 2] + (a[i] - a[i - 2]).abs].min
end
puts dp[-1]

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

vector<ll>Sieve(long long n){
  vector<ll>table(n+1,1);
  for(long long i = 2;i <= n;i++){
    if(table[i] == 1){
      for(ll j = i;j <= n;j += i){
        ll k = j,cnt = 1;
        while(1){
          k /= i;
          if(k%i != 0 || k == 1) break;
          cnt += 1;
        }
        table[j] *= cnt+1;
      }
    }
  }
  return table;
}

int main() {
  ll n,ans = 0;
  cin >> n;
  vector<ll>data = Sieve(n);
  rep(i,1,n+1){
    //cout << data[i] << endl;
    ans += data[i]*i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 81388
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>

using namespace std;

int main() {
  long a,b,c,d;
  cin >> a >> b >> c >> d;

  if(0 <= a) {
    if(0 <= d) cout << b*d << endl;
    else cout << a*d << endl;
  }
  else if(0 <= b) {
    if(0 <= c) cout << b*d << endl;
    else if(0 <= d) cout << max(b*d, a*c) << endl;
    else cout << a*c << endl;
  }
  else {
    if(0 <= c) cout << b*c << endl;
    else if(0 <= d) cout << a*c << endl;
    else cout << a*c << endl;
  }
  return 0;
}

Measured memory_bytes: 3668
N, Q = map(int, input().split())
S = input()

t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r - 1] - t[l - 1])

Measured memory_bytes: 7748
/**
 * Stack
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_A&lang=ja
 */

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
  // 計算途中の値を入れておく
  vector <int>stack(100);

  while (true) {
    string s;
    cin >> s;

    // すべての入力値を読み終えたら完了する
    if (cin.eof()) {
      break;

    }

    if (s == "+" || s == "-" || s == "*") {
      // 演算対象の数値を2つ取り出す
      int b = stack.back();
      stack.pop_back();
      int a = stack.back();
      stack.pop_back();

      if (s == "+") {
        stack.push_back(a + b);
      } else if (s == "-") {
        stack.push_back(a - b);
      } else if (s == "*") {
        stack.push_back(a * b);
      }
    } else {
      // stoiが使えるのは、c++11以降である
      stack.push_back(stoi(s));
    }
  }

  // 積まれているstackから、最終結果を取り出す
  cout << stack.back() << endl;
}




Measured memory_bytes: 3196
#include<iostream>
#include<vector>
#include<array>
using namespace std;

int main(){
	int N, M; cin >> N >> M;
	vector<int> K;
	vector< vector<int> > A;
	array<int, 30> arr;
	int cnt = 0;
	
	for(int i = 0; i < 30; ++i){
		arr[i] = 0;
	}

	K.resize(N);
	A.resize(N);
	for(int i = 0; i < N; ++i){
		cin >> K[i];
		for(int j = 0; j < K[i]; ++j){
			A[i].resize(K[i]);
			cin >> A[i][j];
			arr[A[i][j]-1]++;
		}
	}

	for(int i = 0; i < 30; ++i){
		if(arr[i] == N) cnt++;
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	Map<String, Integer> map = new TreeMap<String, Integer>();
    	int N=sc.nextInt();

    	for(int i=1;i<=N;i++) {
    		String s=sc.next();
    		if(map.containsKey(s))map.put(s,map.get(s)+1);
    		else map.put(s, 1);
    	}
    	int M=sc.nextInt();
    	for(int i=1;i<=M;i++) {
    		String s=sc.next();
    		if(map.containsKey(s))map.put(s,map.get(s)-1);
    		else map.put(s, -1);
    	}
    	int ans=0;
    	for(int val : map.values()){
    		ans=Math.max(ans,val);
    	 }
    	System.out.println(ans);
	}
}

Measured memory_bytes: 22996
///
// File:  c.go
// Author: ymiyamoto
//
// Created on Sat Jun  9 00:27:55 2018
//
package main

import "fmt"

var N int

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func main() {
	fmt.Scan(&N)

	var sleft, sright string

	left := 0
	right := N - 1
	fmt.Println(left)
	fmt.Scan(&sleft)
	if sleft == "Vacant" {
		return
	}
	fmt.Println(right)
	fmt.Scan(&sright)
	if sright == "Vacant" {
		return
	}

	for {
		mid := (left + right) / 2
		fmt.Println(mid)
		var s string
		fmt.Scan(&s)
		if s == "Vacant" {
			return
		}
		if (abs(mid-left)%2 == 0 && sleft != s) || (abs(mid-left)%2 == 1 && sleft == s) {
			right = mid
			sright = s
		} else {
			left = mid
			sleft = s
		}
	}
}


Measured memory_bytes: 1100
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		 String s =scn.next();
		 int ans=0;
		 if(s.charAt(0)=='R'){
			 ans=1;
			 if(s.charAt(1)=='R'){
				 ans++;
				 if(s.charAt(2)=='R'){
					 ans++;
				 }
			 }
			 
		 }else{
			 if(s.charAt(1)=='R'){
				 ans++;
				 if(s.charAt(2)=='R'){
					 ans++;
				 }
			 }else{
				 if(s.charAt(2)=='R'){
					 ans++;
				 }
			 }
		 }
		 System.out.println(ans);

	}

}

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

public class Main {

	static long mod = 1000000007;
	static long INF = Long.MAX_VALUE;

	public static void main(String[] args) {
		// AtCoder_A
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int H[] = new int[N+1];
		long cost[] = new long[N];

		Arrays.fill(H, 0);
		Arrays.fill(cost, INF);

		for(int i=0; i<N; i++) {
			H[i] = sc.nextInt();
		}
	    // Scannerクラスのインスタンスをクローズ
		sc.close();

		cost[0] = 0;
		cost[1] = Math.abs(H[0]-H[1]);

		for(int now=2; now<N; now++) {
			cost[now] = Math.min(Math.abs(H[now]-H[now-2])+cost[now-2], Math.abs(H[now]-H[now-1])+cost[now-1]);
		}

		// 出力
		System.out.println(cost[N-1]);
	}
}


Measured memory_bytes: 61360
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        String[] wArr = new String[]{"Sunny", "Cloudy", "Rainy"};
        String s = sc.next();
        List<String> wList = Arrays.asList(wArr);
        int i = wList.indexOf(s);
        System.out.println(wArr[(i + 1) % 3]);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 20564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  string a,b;
  cin>>a>>b;
  if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0]) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int dp[2][101],n;
int main ()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;++i)
        cin>>dp[0][i];
    for(int i=1;i<=n;++i)
        cin>>dp[1][i];
    for(int i=1;i<=n;++i)
        dp[0][i]=dp[0][i]+dp[0][i-1];
    for(int i=1;i<=n;++i)
        dp[1][i]=dp[1][i]+max(dp[1][i-1],dp[0][i]);
    cout<<dp[1][n]<<endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 3.14159265358979323846

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> oset;

// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

const int mod = 1e9 + 7;
const int inf = 9e18;
const int N = 1e5 + 5;

int x,p=0;

void solve(){
    cin>>x;
    int p=1,ans=100;
    while(ans+ans/100<x){
        ans+=ans/100;
        ++p;
    }
    cout<<p;
}

signed main(){
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long N, M, A[1 << 18], A2[1 << 18];

pair<long long, long long> count_ways(long long border) {
	long long sum = 0, sum2 = 0;
	for (int i = 0; i < N; i++) {
		int pos1 = lower_bound(A, A + N, border - A[i]) - A;
		sum += 1LL * (N - pos1);
		sum2 += A2[pos1] + 1LL * (N - pos1) * A[i];
	}
	return make_pair(sum, sum2);
}

int main() {
	cin >> N >> M;
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A, A + N);
	for (int i = N - 1; i >= 0; i--) A2[i] = A[i] + A2[i + 1];

	long long cl = 0, cr = (1LL << 20), cm, minx = (1 << 30);
	for (int i = 0; i < 25; i++) {
		cm = (cl + cr) / 2;
		pair<long long, long long> B = count_ways(cm);
		if (B.first <= M) { minx = min(minx, cm); cr = cm; }
		else { cl = cm; }
	}

	pair<long long, long long> V = count_ways(minx);
	cout << V.second + (M - V.first) * (minx - 1LL) << endl;
	return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N);
  
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    vec.at(a - 1) += 1;
    vec.at(b - 1) += 1;
  }
  
  for (int i = 0; i < N; i++) {
    cout << vec.at(i) << endl;
  }
}

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

#define fi first
#define se second
typedef long long LL;
typedef long double LD;

int A,B,C;

int main(){
    cin >> A >> B >> C;

    int res=0;

    int nA,nB,nC;
    while (A%2==0 && B%2==0 && C%2==0 && res<=200){
        res++;
        nA=(B+C)/2,nB=(A+C)/2,nC=(A+B)/2;
        A=nA,B=nB,C=nC;
    }

    if (res>200) cout << -1 << "\n";
    else cout << res << "\n";
    return 0;
}


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

int main() {
  // input
  string S;
  cin >> S;
  
  // count
  int count_0 = 0;
  int count_1 = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == '0') {
      count_0++;
    } else {
      count_1++;
    }
  }
  int ans = min(count_0, count_1);
  
  // output
  cout << ans * 2 << endl;
  
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <tuple>
#include <functional>
#include <algorithm>
using namespace std;
typedef tuple<int,int,int> tiii;

typedef struct{
	int x;
	int y;
}dir;
vector<dir>D={
	{-1,-1},{0,-1},{1,-1},
	{-1,0},{1,0},
	{-1,1},{0,1},{1,1},
};

const int H=8,W=8;
vector<function<bool(tiii,tiii)> >sorter={
	[](tiii a,tiii b)->bool{
		if(get<0>(a)<get<0>(b))return true;
		if(get<0>(a)>get<0>(b))return false;
		if(get<2>(a)>get<2>(b))return true;
		if(get<2>(a)<get<2>(b))return false;
		if(get<1>(a)>get<1>(b))return true;
		if(get<1>(a)<get<1>(b))return false;
		return false;
	},
	[](tiii a,tiii b)->bool{
		if(get<0>(a)<get<0>(b))return true;
		if(get<0>(a)>get<0>(b))return false;
		if(get<2>(a)<get<2>(b))return true;
		if(get<2>(a)>get<2>(b))return false;
		if(get<1>(a)<get<1>(b))return true;
		if(get<1>(a)>get<1>(b))return false;
		return false;
	}
};

int check2(int color,dir&d,int x,int y,vector<string>&m){
	if(x<0||W<=x||y<0||H<=y||m[y][x]=='.')return -1;
	if(m[y][x]==color)return 0;
	int r=check2(color,d,x+d.x,y+d.y,m);
	if(r<0)return r;
	return r+1;
}
int check1(int color,int x,int y,vector<string>&m){
	int R=-1;
	for(auto &d:D){
		int r=check2(color,d,x+d.x,y+d.y,m);
		if(r>0){
			if(R<0)R=0;
			R+=r;
		}
	}
	return R;
}

int fill2(int color,dir&d,int x,int y,vector<string>&m){
	if(x<0||W<=x||y<0||H<=y||m[y][x]=='.')return -1;
	if(m[y][x]==color)return 0;
	int r=fill2(color,d,x+d.x,y+d.y,m);
	if(r<0)return r;
	m[y][x]=color;
	return r+1;
}
void fill1(int color,int x,int y,vector<string>&m){
	for(auto &d:D){
		fill2(color,d,x+d.x,y+d.y,m);
	}
}

int main(){
	string color="ox";
	vector<string>m(H);
	for(int h=0;h<H;h++)cin>>m[h];
	int turn=0,pass=0;
	for(;;){
		vector<tiii>v;
		for(int y=0;y<H;y++)for(int x=0;x<W;x++)if(m[y][x]=='.'){
			int r=check1(color[turn],x,y,m);
			if(r>0)v.push_back(make_tuple(r,x,y));
		}
		if(v.empty()){
			pass++;
			if(pass>1)break;
		}else{
			pass=0;
			sort(v.begin(),v.end(),sorter[turn]);
			tiii &t=*v.rbegin();
			fill1(color[turn],get<1>(t),get<2>(t),m);
			m[get<2>(t)][get<1>(t)]=color[turn];
		}
		turn^=1;
	}
	for(int h=0;h<H;h++)cout<<m[h]<<endl;
	return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;

    cout << n * n * n << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<tuple>
#define LL long long
#define PP std::pair<int,int>
#define TT std::tuple<int,int,int>
LL N, T;
LL A[100010];
LL m[100010];
LL M[100010];
int main() {
	std::cin >> N >> T;
	for (LL i = 1; i <= N; i++) {
		std::cin >> A[i];
	}
	M[N] = A[N];
	for (LL i = N - 1; i >= 1; i--) {
		M[i] = std::max(M[i + 1], A[i]);
	}
	LL dif = 0;
	LL ans = 0;
	for (int i = 1; i <= N; i++) {
		if (dif == M[i] - A[i]) {
			ans++;
		}
		else if (dif < M[i] - A[i]) {
			ans = 1;
			dif = M[i] - A[i];
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


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

int main() {
int N;
  cin>>N;
  vector<int>moji(N);
  for(int i=0;i<N;i++){
  	cin>>moji.at(i);
  }
 bool nazo=true;
   for(int i=0;i<N;i++){
  	if(moji.at(i)%2==0){
      if(moji.at(i)%3==0 || moji.at(i)%5==0){
      nazo=true;
      }
      else{
      nazo=false;
        break;
      }
    }
  }
  
if(nazo){
cout<<"APPROVED "<<endl;
}
  else{
  cout<<"DENIED "<<endl;
  }
  
}

Measured memory_bytes: 3620
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class APainting {
public:
	void solve(std::istream& in, std::ostream& out) {
        int h, w, n;
        in >> h >> w >> n;

        int mx = max(h, w);
        int mi = min(h, w);

        int cnt = 0;
        int sum = 0;
        bool flg = false;
        rep(i, h*w){
            if(sum >= n) break;
            if(cnt > mi) flg = true;
            if(flg){
                sum += mi;
                cnt++;
                continue;
            }
            sum += mx;
            cnt++;
        }

        out << cnt << endl;
	}
};


int main() {
	APainting solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

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

Measured memory_bytes: 3568
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
const int maxx=1e5+5;
int read(){
	char x=getchar(); int u=0;
	while(!isdigit(x)) x=getchar();
	while(isdigit(x)) { u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return u;
}
int be[maxx],ne[maxx<<1],to[maxx<<1],e=0;
int color[maxx];
LL ans=0,num[5],n,m;
void add(int x,int y){	
	to[++e]=y;
	ne[e]=be[x];
	be[x]=e;
}
bool pd(int x,int y){
	if(color[x]==1 && color[y]==2) return 1;
	else if( color[x]==2 && color[y]==1) return 1;
	return 0;
	}
void dfs(int id,int fa){
	for(int i=be[id];i;i=ne[i]){
		int go=to[i];
		if(go==fa || pd(go,id) || color[go]==3) continue;
		if(!color[go]){
			if(color[id]==3) color[go]=3;
			else color[go]=(color[id]&1)+1;
		}
		else color[go]=3;
//			printf("%d %d %d %d\n",id,go,color[id],color[go]);
			dfs(go,id);
		}
	}
int main(){
	int u,v;
	n=read(); m=read();
	For(i,1,m){
		u=read(); v=read();
		add(u,v); add(v,u);
	}
	color[1]=1;
	dfs(1,0);
	For(i,1,n) num[color[i]]++; 
	ans=num[1]*num[2]+(2ll*n-1ll-num[3])*num[3]/2ll-1LL*m;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
  int a,b;
  cin>>a>>b;
  vector<int> vec1(a);
  vector<int> vec2(a);
  vector<vector<int>> vec3(b, vector<int>(2));
  rep(i,a){
    cin>>vec1[i];
  }
  rep(j,b){
    rep(k,2){
      cin>>vec3[j][k];
    }
  }
  rep(ab,b){
    if(vec1[vec3[ab][0]-1]>vec1[vec3[ab][1]-1]){
      vec2[vec3[ab][1]-1]--;
    }
    else if(vec1[vec3[ab][0]-1]<vec1[vec3[ab][1]-1]){
      vec2[vec3[ab][0]-1]--;
    }
    else{
      vec2[vec3[ab][1]-1]--;
       vec2[vec3[ab][0]-1]--;
    }
  }
  int dh=0;
  rep(hi,a){
    if(vec2[hi]==0){
      dh++;
    }
  }
  cout<<dh;
}
    

Measured memory_bytes: 10384
import java.util.Scanner;

public class Main {
    void run() {
        Scanner scan = new Scanner(System.in);
        String a = scan.next();
        String b = scan.next();
        int num = Integer.valueOf(a + b);
        int root = (int) Math.sqrt(num);
        if (root*root == num)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<bool> vb;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 1e3+5;
const lli INF = 1e18;
const lli MOD = 1e9+7;

bool mm[N];
vi primes(1,2);
ld nk[N][N];
void sieve(){
	for(int i = 4; i<N; i+=2)mm[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!mm[i])for(int j = i*i; j<N; j+=i)mm[j]=1;
	for(int i = 3; i<N; i+=2)if(!mm[i])primes.pb(i);
}

void pascal(){
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

// ---- コーディングはここから！ ('-')7

int main(){_
	int j = -1;
	fore(i,0,5){
		int a; cin>>a;
		if(a==0)j=i;
	}
	cout<<j+1<<ENDL;

}


Measured memory_bytes: 3680
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(){
    cout << "Yes" << endl;
}

void no (){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

int main() {
    int n; cin >> n;
    int sm = 0;
    int ma = 0;
    rep(i,n){
        int a; cin >> a;
        sm += a;
        ma = max(ma,a);
    }
    if (sm>2*ma) yes();
    else no();
}

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

int main(){
  int A[3][3];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++) cin>>A[i][j];
  }
  bool ans[3][3];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++) ans[i][j]=false;
  }
  int N;cin>>N;
  for(int i=0;i<N;i++){
    int b;cin>>b;
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
        if(A[i][j]==b) ans[i][j]=true;
      }
    }
  }
  bool can=false;
  for(int i=0;i<3;i++){
    if(ans[i][0] && ans[i][1] && ans[i][2]) can=true;
  }
  for(int i=0;i<3;i++){
    if(ans[0][i] && ans[1][i] && ans[2][i]) can=true;
  }
  if(ans[0][0] && ans[1][1] && ans[2][2]) can=true;
  if(ans[2][0] && ans[1][1] && ans[0][2]) can=true;
  cout<<(can?"Yes":"No")<<endl;
}


Measured memory_bytes: 3636
from operator import mul
from functools import reduce
mod = 10**9+7
    
def nCr(n, r, mod):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
    

n, a, b = map(int, input().split())

ans = pow(2, n, mod) - 1

print((ans - nCr(n, a, mod) - nCr(n, b, mod)) % mod)

Measured memory_bytes: 3700
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    mod = 10**9+7
    N = int(input())
    A = list(map(int, input().split()))
    C = [0] * 3
    ret = 1
    for i in range(N):
        ret *= C.count(A[i])
        ret %= mod
        for j in range(3):
            if C[j]==A[i]:
                C[j]+=1
                break
    print(ret)

if __name__ == '__main__':
    main()

Measured memory_bytes: 20520
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    i64 n;
    std::cin >> n;

    i64 ret = 0;
    for (int i = 1; i < (1 << 20); i++) {
        i64 k = i;
        i64 m = 0;
        while (k) {
            if (k % 4 == 1) m = m * 10 + 3;
            else if (k % 4 == 2) m = m * 10 + 5;
            else if (k % 4 == 3) m = m * 10 + 7;
            else goto c;
            k /= 4;
        }
        // std::cout << m << std::endl;
        if (std::to_string(m).find_first_of('7') == -1 ||
            std::to_string(m).find_first_of('5') == -1 ||
            std::to_string(m).find_first_of('3') == -1) {
                // std::cout << "no" << std::endl;
                continue;
            }
        if (m <= n) ret++;
c:
        ;
    }
    std::cout << ret << std::endl;

    return 0;
}

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

typedef long long int ll;
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)

int main() {
	FASTIO;
	int N, X, T;
	cin >> N >> X >> T;
	if (N % X == 0)
		cout << N / X * T;
	else
		cout << (N / X + 1) * T;

	return 0;
}

Measured memory_bytes: 3556
#include<stdio.h>

#define min(a,b) ((a)<(b)?(a):(b))

int main(){
	long long n,b;
	scanf("%lld",&n);b=n;
	long long i,yac[5000],c=0,sum=0,ans=n-1;
	for(i=1;i*i<=n;i++){
		if(n%i==0)ans=min(ans,i+n/i-2);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128