akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int H,W;
string S[12];
string T[12];

bool ans;

void uku(){
    map<string,int>cnt;
    rep(j,W){
        string s;
        rep(i,H){
            if(T[i][j]=='*')s+=T[H-1-i][j];
            else s+=T[i][j];
        }
        string t=s;
        reverse(all(t));
        cnt[min(s,t)]++;
    }

    bool flag=false;
    for(auto &p:cnt){
        string s=p.fi;
        string t=s;reverse(all(t));

        if(p.se%2==0)continue;
        if(s!=t)return;
        if(flag)return;
        flag=true;
    }
    ans=true;
}

void ei(int b,int k){
    if(b==0){
        uku();
        return;
    }

    int s=0;
    while(~b>>s&1)s++;
    T[k]=S[s];
    for(int i=s+1;i<H;i++)if(b>>i&1){
        T[H-1-k]=S[i];
        ei(b^(1<<s)^(1<<i),k+1);
    }
}

signed main(){
    cin>>H>>W;
    rep(i,H)cin>>S[i];

    if(H&1){
        S[H]=string(W,'*');
        H++;
    }
    ei((1<<H)-1,0);
    if(ans)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define mp make_pair
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int get() { int r; cin >> r; return r; }
typedef pair<int, int>P;
int n, h;
vector<P>xy, yz, xz;
signed main() {
	while (cin >> n >> h, n) {
		int ans = n * n * n;
		xy.clear();
		yz.clear();
		xz.clear();
		for1(hoge, h) {
			string s; int a, b;
			cin >> s >> a >> b;
			if (s == "xy")xy.push_back(mp(a, b));
			if (s == "yz")yz.push_back(mp(a, b));
			if (s == "xz")xz.push_back(mp(a, b));
			ans -= n;
		}
		for (P pxy : xy)for (P pyz : yz)if (pxy.second == pyz.first)ans++;
		for (P pxz : xz)for (P pyz : yz)if (pxz.second == pyz.second)ans++;
		for (P pxy : xy)for (P pxz : xz)if (pxy.first == pxz.first)ans++;
		for (P pxy : xy)for (P pyz : yz)for (P pxz : xz)if (pxy.first == pxz.first && pxy.second == pyz.first && pxz.second == pyz.second)ans--;
		cout << ans << endl;
	}
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
#include<vector>
#include<tuple>

using namespace std;
int main(){
  int n,k;
  cin >> n >> k;

  string s;
  cin >> s;
  if(s[k-1] == 'A'){
    s[k-1] = 'a';
  }else if(s.at(k-1) == 'B'){
    s[k-1] = 'b';
  }else{
    s[k-1] = 'c';
  }
  cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define Vecpr vector<pair<lli,lli>>
int main() {
  lli N,A,C=0,B,D=0;
  vector<int>P(3);
  rep(i,3)cin >> P[i];
  cin >> A;
  Sort(P);
  rep(i,A)P[2]*=2;
  Out(P[0]+P[1]+P[2]);
}

Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

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

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

bool dp[200010];
int main(void){
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];

  dp[0] = 0;
  for(int i = 0; i <= K; i++){
    for(int j = 0; j < N; j++){
      if(i-A[j] < 0) continue;
      if(dp[i-A[j]] == 0) dp[i] = 1;
    }
  }
  if(dp[K]){
    cout << "First" << endl;
  }else{
    cout << "Second" << endl;
  }






}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define rep(i,n) for(int64_t i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr int64_t INF=(1ll<<60);
constexpr int64_t mod=1000000007;
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    string s;cin>>s;
    ll n=s.size();

    bool ok=true;
    rep(i,(n-1)/2-1){
        if(s[i]!=s[n-1-i]) ok=false;
        if(s[i]!=s[(n-1)/2-1-i]) ok=false;
    }
    for(int64_t i=(n+3)/2-1;i<n;i++){
        if(s[i]!=s[n-1-i]) ok=false;
    }

    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3576
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-12;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N;
	vector<pair<long long int, long long int>>v(N);
	for (int i = 0; i < N; i++) {
		cin >> L >> R;
		v[i] = { L + R,L - R };
	}
	sort(v.begin(), v.end());
	int ans = 0;
	R = -MOD * 2;
	for (auto i : v) {
		if (i.second >= R) {
			R = i.first;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  deque<int> dq;
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int q;
    cin >> q;

    if (q == 0) { // push
      int d, x;
      cin >> d >> x;
      if (d == 0)
        dq.push_front(x);
      else
        dq.push_back(x);
    }
    if (q == 1) { // random access
      int p;
      cin >> p;
      cout << dq.at(p) << endl;
    }
    if (q == 2) { // pop
      int d;
      cin >> d;
      if (d == 0)
        dq.pop_front();
      else
        dq.pop_back();
    }
  }
}


Measured memory_bytes: 4580
#include <iostream>
using namespace std;
 
int main(){
  int N,n,S;
  S=0;
  cin >> N;
  n=N;
  for(int i=0;i<10;i++){
      S+=n%10;
      n=n/10;
  }
  if(N%S==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back

using namespace std;

int ans[10];

void solve(vector<int> a,int n)
{
	int count = 0;
	rep(i,a.size()) count += a[i];

	if(count == 0)
	{
		ans[n] = 1;
		return;
	}

	REP(i,1,10)
	{
		if(a[i] >= 3)
		{
			a[i] -= 3;
			solve(a,n);
			a[i] += 3;
		}
	}

	REP(i,3,10)
	{
		if(a[i-2] && a[i-1] && a[i])
		{
			a[i-2]--; a[i-1]--; a[i]--;
			solve(a,n);
			a[i-2]++; a[i-1]++; a[i]++;
		}
	}
}


int main()
{
	string s;
	while(cin >> s)
	{
		vector<int> a;
		memset(ans,0,sizeof(ans));

		rep(i,10) a.pb(0);
		rep(i,s.size()) a[s[i] - '0']++;

		for(int i=1;i <= 9; i++)
		{
			if(a[i] == 4)
			{
				continue;
			}
			else
			{
				a[i]++;
				for(int j=1; j<= 9;j++)
				{
					if(a[j] >= 2)
					{
						a[j] -= 2;
						solve(a,i);
						a[j] += 2;
					}
				}
				a[i]--;
			}
		}

		bool count_0 = true;
		int ans_max = 0;
		REP(i,1,10)
		{
			if(ans[i])
			{
				count_0 = false;
				ans_max = max(ans_max,i);
			}
		}

		if(count_0) 
		{
			cout << 0 << endl;
		}
		else
		{
			bool flag = true;
			REP(i,1,10)
			{
				if(ans[i] == 1)
				{
					if(i == ans_max)
					{
						cout << i << endl;
					}
					else
					{
						cout << i << " ";
					}
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1204
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
const int MAXN    = 2e5+9;
/*-----------------------------------------------------------------------------------------------------*/

ll dp[100001];
signed main() {
	EmiliaMyWife

	ll n, w, ans = 0;
	cin >> n >> w;
	for(int i = 0; i < 100001; i++) dp[i]=LINF;
	dp[0]=0;
	for(int i = 0, a, b; i < n; i++) {
		cin >> a >> b;
		for(int j = 100000; j; j--) {
			if(j<b) break;
			dp[j]=min(dp[j], dp[j-b]+a);
			if(dp[j]<=w)
				ans=max(ans, (ll)j);
		}
		//cout << dp[b] << '\n';
	}
	cout << ans;

	return 0;
}


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

int main() {
    int P, Q, R, dis;
    cin >> P >> Q >> R;
    if(R>=Q && R>=P) dis = P+Q;
    else if(Q>=R && Q>=P) dis = P+R;
    else dis = Q+R;

    cout << dis << endl;
    return 0;
}

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

using namespace std;

void Main() {
    int N;
    cin >> N;
    vector<int> a(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }

    int ans = 40000000;
    for (int target = -100; target <= 100; ++target) {
        int cost = 0;
        for (int i = 0; i < N; ++i) {
            cost += (a[i] - target) * (a[i] - target);
        }
        ans = min(ans, cost);
    }

    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <iomanip>
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cmath>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1001001000;
const int MOD = 1000000007;

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

using Graph = vector<vector<int>>;
//再帰とかグラフを使うときは予めNの最大値のグローバル配列を取っておく
int N;
vector<int> E[200001];
vector<bool> seen;
typedef pair<int, int> P;
int D[101];
//頂点状態を表すcolor[]において、0は未訪問、1は訪問中、2は完了を表す。
int color[101];
int find_time = 0;

//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;
    
    return res %= MOD;;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

int main() {
    int K, N; cin >> K >> N;
    vector<int> distA(N);
    vector<int> distB(N);
    vector<int> retu(N);
    for (int i = 0; i < N; i++) { 
        cin >> retu.at(i);
    }
    int dist = 0;
    int ans = INF;
    for (int i = 0; i < N-1; i++) {
        dist = retu.at(i + 1) - retu.at(i);
        ans = min(ans, K-dist);
    }
    dist = retu.at(N - 1) - retu.at(0);
    ans = min(ans, dist);

    cout << ans << endl;
    
}


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

class Program {

    static readonly long p = Convert.ToInt64(Math.Pow(10, 9)) + 7L;

    static void Main(string[] args) {

        var tmp = Console.ReadLine().Split();
        var n = Convert.ToInt32(tmp[0]);
        var a = Convert.ToInt32(tmp[1]);
        var b = Convert.ToInt32(tmp[2]);

        long ans =
            Util.Mod(
                Util.Power(2, n, p)
                - Util.Combination(n, a, p)
                - Util.Combination(n, b, p)
                - 1,
                p);

        Console.WriteLine(ans.ToString());

    }
}

public static class Util {

    public static long Mod(long x, long p) {
        long tmp = x % p;
        while (tmp < 0) {
            tmp = tmp + p;
        }
        return tmp;
    }

    /// <summary>
    /// メモ化
    /// </summary>
    public static Func<T1, T2> Memoize1<T1, T2>(Func<T1, T2> func) {
        var dic = new Dictionary<T1, T2>();

        return (T1 x) => {
            T2 y;
            if (dic.TryGetValue(x, out y)) {
                return y;
            } else {
                var tmp = func(x);
                dic.Add(x, tmp);
                return tmp;
            }
        };
    }

    /// <summary>
    /// 2bit化、6 -> 110
    /// </summary>
    public static IEnumerable<bool> BitSeq(long x) {
        return BitSeqTmp(x).Reverse();
    }

    static IEnumerable<bool> BitSeqTmp(long x) {
        for (long i = x; i > 0L; i = i / 2L) {
            yield return Convert.ToBoolean(i % 2);
        }
    }

    /// <summary>
    /// べき乗
    /// </summary>
    public static long Power(long x, long y, long mod) {
        var bitSeq = Util.BitSeq(y);
        long tmp = x;
        long total = 1;
        foreach (var bit in bitSeq.Reverse()) {
            if (bit) {
                total = total * tmp % mod;
            }
            tmp = tmp * tmp % mod;
        }
        return total;
    }

    /// <summary>
    /// Combination
    /// </summary>
    /// <param name="x"></param>
    /// <param name="y"></param>
    /// <param name="mod"></param>
    /// <param name="memRev"></param>
    /// <returns></returns>
    public static long Combination(long x, long y, long mod) {
        var memRev = Util.Memoize1<long, long>(Rev);
        var chunk = new List<long>();
        for (long i = x; i > x - y; i--) {
            chunk.Add(i);
        }
        var revChunk = new List<long>();
        for (long i = 1; i < y + 1; i++) {
            revChunk.Add(i);
        }
        return chunk
            .Concat(revChunk.Select(memRev))
            .Aggregate((acc, z) => acc * z % mod);

    }

    /// <summary>
    /// 逆元
    /// </summary>
    public static long Rev(long x) {
        var p = Convert.ToInt64(Math.Pow(10, 9)) + 7L;
        var bitArrayP = Util.BitSeq(p - 2L);
        long tmp = x;
        long total = 1;
        foreach (var bit in bitArrayP.Reverse()) {
            if (bit) {
                total = total * tmp % p;
            }
            tmp = tmp * tmp % p;
        }
        return total;
    }

}

Measured memory_bytes: 36632
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef long double lld;
const ll mod = 1000000007;

vector<vector<ll>> dp(21, vector<ll>(1 << 21, -1));

vector<vector<int>> m; int n;
ll solve(int x, int wmask) {

	if(dp[x][wmask] >= 0) return dp[x][wmask];

	if(x == n - 1) { // last man in world
		for(int i = 0; i < n; i++) {
			if(m[x][i] && ((wmask >> i) & 1)) {dp[x][wmask] = 1; return 1;}
		}
		dp[x][wmask] = 0;
		return 0;
	}

	ll ans = 0;
	for(int i = 0; i < n; i++) {
		if(m[x][i] && ((wmask >> i) & 1)) {
			ans = ans + solve(x + 1, wmask ^ (1 << i));
		 	ans = ans % mod;
		}
	}
	dp[x][wmask] = ans;
	return ans;
}

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

	cin >> n;
	m.resize(n, vector<int>(n, false));
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) cin >> m[i][j];
	}
	
	ll ans = solve(0, (1 << n) - 1);
	cout << ans << endl;
}

Measured memory_bytes: 360832
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int siz = 1e6 + 5;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;
	

void solve(){
  ll n;
  cin >> n;
  ll ans = 1, x = 2;
  while (n != 1) {
  	n /= 2;
  	ans += x;
  	x*=2;
  }
  cout << ans;
}

int main(){
	#ifndef RAY
		//freopen("input.txt", "r", stdin);
	#endif
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		int t = 1;
		//cin >> t;
		while(t--){
			solve();
		}
	return 0;
}


Measured memory_bytes: 256
function main (s) {
    s=s.split(" ");
	for(var i=0;i<2;i++)s[i]=parseInt(s[i]);
	if(s[0]%3==0||s[1]%3==0||(s[0]+s[1])%3==0)console.log("Possible\n");
	else console.log("Impossible\n");
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1000010;
const int inf=0x3f3f3f3f;

ll n;
ll dp[maxn];
ll a[maxn];
ll k;
void dfs()
{
    
    dp[1]=abs(a[1]-a[0]);
    dp[0]=0;
     for(int i=2;i<=n;i++)
    {
        dp[i]=inf;
    }
    
    for(int i=2;i<=n;i++)
    {for(int j=i-1;j>=max(0ll,i-k);j--)
        {
         dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
        }
    }
    cout<<dp[n-1];
    return ;
}

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

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

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

  cout << (a + b + c + (max(a,max(b,c))) * 9) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;
 
int main(){

	int n, w, h;
	cin >> n >> w >> h;
	
	map<int, int> mp1, mp2;
	mp1[0];
	mp1[w];
	mp2[0];
	mp2[h];
	
	rep(i, n){
		int x, y, r;
		cin >> x >> y >> r;
		mp1[x-r]++;
		mp1[x+r]--;
		mp2[y-r]++;
		mp2[y+r]--;
	}
	
	int cnt;
	cnt = 0;
	bool flag1 = true, flag2 = true;
	for(auto it = mp1.begin(); it != mp1.end(); it++){
		if(DEBUG) cout << it->first << "\t" << it->second << endl;
		cnt += it->second;
		if(it->first == w) break;
		if(cnt <= 0) flag1 = false;
	}
	if(DEBUG) cout << endl;
	cnt = 0;
	for(auto it = mp2.begin(); it != mp2.end(); it++){
		if(DEBUG) cout << it->first << "\t" << it->second << endl;
		cnt += it->second;
		if(it->first == h) break;
		if(cnt <= 0) flag2 = false;
	}
	if(DEBUG) cout << endl;
	
	if(flag1 || flag2) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	
	return 0;
}

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

using namespace std;

const int INF = 1e9;

class max_flow {
	struct edge {
		int to, cap, rev;
		edge(int to_, int cap_, int rev_) : to(to_), cap(cap_), rev(rev_) {};
	};
	int V;
	vector<vector<edge>> G;
	vector<int> level;
	vector<int> iter;

	void BFS(int s) {
		fill(level.begin(), level.end(), -1);
		queue<int> que;
		level[s] = 0;
		que.push(s);
		while (!que.empty()) {
			int v = que.front(); que.pop();
			for (size_t i = 0; i < G[v].size(); i++) {
				edge &e = G[v][i];
				if (e.cap > 0 && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					que.push(e.to);
				}
			}
		}
	}
	int DFS(int v, int t, int f) {
		if (v == t) return f;
		for (int &i = iter[v]; i < (int)G[v].size(); i++) {
			edge &e = G[v][i];
			if (e.cap > 0 && level[v] < level[e.to]) {
				int d = DFS(e.to, t, min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					G[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}
public:
	max_flow(int _V) : V(_V), G(_V), level(_V), iter(_V) {}
	int add(int from, int to, int cap) {
        int idx=G[from].size();
		G[from].push_back(edge(to, cap, G[to].size()));
		G[to].push_back(edge(from, 0, G[from].size() - 1));
        return idx;
	}
	int dinic(int s, int t) {
		int flow = 0;
		while (true) {
			BFS(s);
			if (level[t] < 0) return flow;
			fill(iter.begin(), iter.end(), 0);
			int f;
			while ((f = DFS(s, t, INF)) > 0) {
				flow += f;
			}
		}
	}
    int revcap(int from,int idx){
        return G[from][idx].cap;
    }
};

struct Edge{
    int from,to,cap,idx;
    Edge(int from,int to, int cap, int idx):from(from),to(to),cap(cap),idx(idx){}
};

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

    int n,m;cin>>n>>m;
    max_flow mf(n);
    vector<Edge> es;
    for(int i=0;i<m;i++){
        int x,y;cin>>x>>y;
        x--;y--;
        int idx;
        mf.add(x,y,1);
        idx = mf.add(y,x,1);
        es.push_back(Edge(y,x,1,idx));
    }
    int st,gt;cin>>st>>gt;
    st--;gt--;
    cout<<mf.dinic(st,gt)<<endl;
    vector<int> res;
    for(int i=0;i<m;i++){
        if(mf.revcap(es[i].from, es[i].idx)<es[i].cap) res.push_back(i+1);
    }
    int sz=res.size();
    cout<<sz<<endl;
    for(int i=0;i<sz;i++) cout<<res[i]<<endl;
}


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

using namespace std;
using ll = long long;

int main(void) {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  for (int i = 0; i < n; i++) {
    int num = vec[i];
    if (num % 2 == 0 && num % 3 != 0) {
      if (num % 5 != 0) {
      cout << "DENIED" << endl;
      return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}


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

int main(int argc, char const *argv[]) {
  int n, b, f, r, v;
  cin >> n;

  int x[4][3][10] = {};

  for (int i = 0; i < n; i++) {
    cin >> b >> f >> r >> v;
    x[b - 1][f - 1][r - 1] += v;
  }

  for (int i = 0; i < 4; i++) {
    if (i != 0) cout << "####################" << endl;
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 10; k++) {
        if (x[i][j][k] > 0)
          cout << " " << x[i][j][k];
        else
          cout << " " << 0;
      }
      cout << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3080
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println((sc.nextInt()+sc.nextInt()*5+sc.nextInt()*10+sc.nextInt()*50
                +sc.nextInt()*100+sc.nextInt()*500)>=1000?1:0);
    }
}


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

const int S=(1<<20)+5;
char buf[S],*H,*T;
inline char Get()
{
	if(H==T) T=(H=buf)+fread(buf,1,S,stdin);
	if(H==T) return -1;return *H++;
}
inline int read()
{
	int x=0;char c=Get();
	while(!isdigit(c)) c=Get();
	while(isdigit(c)) x=x*10+c-'0',c=Get();
	return x;
}

const int N=200010;
struct Edge{int to,next;} e[N<<1];
int h[N],tot=0,n,m;
int col[N],sum[N],diff[N];
int s1,s2;

void add_edge(int u,int v)
{
	e[++tot].to=v;
	e[tot].next=h[u];
	h[u]=tot;
}

void dfs1(int u,int fa)
{
	sum[u]=col[u];
	for(int tmp=h[u];tmp;tmp=e[tmp].next)
	{
		int v=e[tmp].to;
		if(v==fa) continue;
		if(col[v]){s1=u;s2=v;continue;}
		col[v]=-col[u];
		dfs1(v,u);
		sum[u]+=sum[v];
	}
}

void dfs2(int u,int fa)
{
	sum[u]=col[u];
	for(int tmp=h[u];tmp;tmp=e[tmp].next)
	{
		int v=e[tmp].to;
		if(v==fa) continue;
		if(u==s1&&v==s2||u==s2&&v==s1) continue;
		dfs2(v,u);
		sum[u]+=sum[v];
		diff[u]+=diff[v];
	}
}

int gao()
{
	if(n&1) return -1;
	int ans=0;
	col[1]=1;dfs1(1,0);
	if(m==n-1)
	{
		if(sum[1]) return -1;
		for(int i=2;i<=n;i++)
			ans+=abs(sum[i]);
		return ans;
	}
	if(col[s1]==col[s2])
	{
		if(sum[1])
		{
			ans=abs(sum[1]/2);
			col[s1]-=sum[1]/2;
			col[s2]-=sum[1]/2;
			dfs2(1,0);
		}
		for(int i=2;i<=n;i++)
			ans+=abs(sum[i]);
		return ans;
	}
	if(sum[1]) return -1;
	diff[s1]=1;diff[s2]=-1;
	dfs2(1,0);
	static int c[N],cnt=0;
	for(int i=2;i<=n;i++)
		if(diff[i]) c[cnt++]=sum[i]*diff[i];
		else ans+=abs(sum[i]);
	nth_element(c,c+(cnt>>1),c+cnt);
	int x=c[cnt>>1];
	for(int i=0;i<cnt;i++)
		ans+=abs(c[i]-x);
	return ans+abs(x);
}

int main()
{
	int u,v;
	n=read();m=read();
	for(int i=1;i<=m;i++)
	{
		u=read();v=read();
		add_edge(u,v);
		add_edge(v,u);
	}
	printf("%d\n",gao());
	return 0;
}

Measured memory_bytes: 11648
//G.cpp
#include<bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;


int main(){
	int n, m;
	cin >> m >> n;
	vector< vector<int> > dp(m, vector<int> (n,  0));

	string st;
	for(int i = 0; i < m; i++){
		cin >> st;
		for(int j = 0; j < n; j++){
			if(st[j] == '#')
				dp[i][j] = -1;
		}
	}
	int N = 1000000007;
	dp[0][0] = 1;
	for(int i = 0; i < m; i++){
		for(int j = 0; j < n; j++){
			if(dp[i][j] >= 0){
				if( i && dp[i-1][j] >= 0){
					dp[i][j] = ((long long int)dp[i-1][j] + dp[i][j]) % N;
				}

				if( j && dp[i][j-1] >= 0){
					dp[i][j] = ((long long int)dp[i][j-1] + dp[i][j]) % N;
				}
			}
		}
	}



	cout << dp[m-1][n-1] << endl;
	return 0;
}

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

using namespace std;

int main() {
    long long H, W;
    cin >> H >> W;
    long long ans = 1e5;
    {
        long long s = H % 3 == 0 ? 0 : W;
        ans = min(ans, s);
    }
    {
        long long s = W % 3 == 0 ? 0 : H;
        ans = min(ans, s);
    }
    for (int i = 1; i <= H / 2; i++) {
        long long w1 = W / 2;
        long long w2 = W - w1;
        long long s_max = max({W * i, w1 * (H - i), w2 * (H - i)});
        long long s_min = min({W * i, w1 * (H - i), w2 * (H - i)});
        ans = min(ans, s_max - s_min);
    }
    for (int i = 1; i <= W / 2; i++) {
        long long h1 = H / 2;
        long long h2 = H - h1;
        long long s_max = max({H * i, h1 * (W - i), h2 * (W - i)});
        long long s_min = min({H * i, h1 * (W - i), h2 * (W - i)});
        ans = min(ans, s_max - s_min);
    }
    cout << ans << 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 v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int main(){
    vl pow2(41, 1);
    for(int i =1; i<=40;i++){
        pow2[i] = pow2[i-1]*2;
    }
    vl powsum(41, 0);
    powsum[0] = 0;
    for(int i = 1; i <= 40; i++){
        powsum[i] = powsum[i-1]+pow2[i-1];
    }
    vl attack(41, 0);
    for(int i = 0; i <=40; i++){
        attack[i] = pow2[i] + powsum[i];
    }
    ll H;
    cin >> H;
    int l = 0;
    int r = 41;
    while(l+1 < r){
        ll m = (r+l)/2;
        if(H > pow2[m]) l = m;
        else if(H < pow2[m]) r = m;
        else{
            l = m;
            break;
        }
    }
    cout << attack[l] <<endl;
}

Measured memory_bytes: 3600
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

func main() {
	a := readInt()
	p := readInt()
	fmt.Println((a*3 + p) / 2)
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
char maze[12][12];
signed main() {
	ll n, m, a, ans = 0; cin >> n >> m;
	for (int h = 0; h < 10; h++) {
		for (int i = 0; i < 10; i++) {
			maze[h][i] = '.';
		}
	}
	for (int h = 1; h <= n; h++) {
		for (int i = 1; i <= m; i++) {
			cin >> maze[h][i];
			if (maze[h][i] == '#') { ans++; }
		}
	}
	ll x = 1, y = 1;
	for (int i = 1; i < ans; i++) {
		if (maze[x][y + 1] == '#') { y++; continue; }
		if (maze[x + 1][y] == '#') { x++; continue; }
		cout << "Impossible" << endl; return 0;
	}
	cout << "Possible" << endl;
	return 0;
}

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

namespace ABC043A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            int s;
            int i;
            n = int.Parse(Console.ReadLine());

            s = 0;
            for (i=1; i<=n; i++)   
            {
                s = s + i;
            }



            Console.WriteLine(s);
            Console.ReadKey();
        }
    }
}

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

int main()
{
    long long n,q;
    cin >> n >> q;
    
    string moji;
    cin >> moji;
    
    long long l[q],r[q];
    for (int i = 0 ; i<q ; i++){
        cin >> l[i] >> r[i];
    }
    
    //こっから処理開始
    
    int reading = 0;
    int answer = 0;
    int ansLog[n];
    int flag = 0;
    while (reading < n){
        if (flag == 1 && moji[reading] == 'C'){
            answer ++;
        }
        flag = 0;
        if (moji[reading] == 'A'){
            flag = 1;
        }
        ansLog[reading] = answer;
        reading++;
    }
    
    for (int i; i<q ; i++){
        cout << ansLog[r[i]-1] - ansLog[l[i]-1] << "\n";
    }
}

Measured memory_bytes: 2972
#include <stdio.h>
int main(void){
	int n,i;
	scanf("%d",&n);
	for(i=n;i<1000;i++){
		int a=i%10,b=(i%100-a)/10,c=i/100;
		if(a==b&&b==c)break;
	}
	printf("%d",i);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(void)
{
    int z[3],m[3],s[3],e[3],A[3];
    for(int i=0;i<2;i++){
        cin>>z[i]>>m[i]>>s[i]>>e[i];
        A[i]=z[i]+m[i]+s[i]+e[i];
        if(i==1&&A[i]>A[0])A[0]=A[i];
    }
    cout<<A[0]<<"\n";
}

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

int main(void){
    int a,b;
    cin>>a>>b;
    a*=b;
    cout<<a;
    return 0;
}

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

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var c = Console.ReadLine().Last();
            var result = "";
            if (new []
                {
                    '2',
                    '4',
                    '5',
                    '7',
                    '9'
                }.Contains(c)) { result = "hon"; }
            else if (new []
                {
                    '0',
                    '1',
                    '6',
                    '8'
                }.Contains(c)) { result = "pon"; }
            else { result = "bon"; }

            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 26208
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <list>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

#define xx first
#define yy second
#define $1 first
#define $2 second

void solveCase() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	string s, t;
	cin >> s >> t;
	ll ans = 1e9;
	for (int i = 0; i < s.length() - t.length()+1; i++) {
		ll temp = 0;
		for (int j = 0; j < t.length(); j++) {
			if (s[i + j] != t[j])temp++;
		}
		ans = min(ans, temp);
	}
	cout << ans;
}


int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	solveCase();
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int max2 (int n)
{
    int i;
    for(i=1;i<=n;)
    {
        i=i*2;
    }
    return i/2;


}
int main()
{
    int n;
    cin>>n;
    if(n>=1 && n<=100)
    {
        cout<<max2(n)<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <functional>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,M;
  cin >> N >> M;
  vector<int> cnt(N,0);
  for(int i=0; i<M; i++){
    int a,b;
    cin >> a >> b;
    a--;b--;
    cnt[a]++;
    cnt[b]++;
  }
  for(int i=0; i<N; i++){
    cout << cnt[i] << "\n";
  }
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>

using namespace std;

int main() {
    int n, k, s;
    cin >> n >> k >> s;

    for (int i = 0; i < k; i++) {
        cout << s << (i < n - 1 ? " " : "");
    }

    for (int i = k; i < n; i++) {
        cout << (s <= 100000 ? 100001 : 1) << (i < n - 1 ? " " : "");
    }

    cout << endl;
}


Measured memory_bytes: 1280
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Text;

namespace Fish.aizu
{
	public static class AizuOnlineJudge
	{
		public static int[] SplitToInts(string line)
		{
			return line.Split(' ').Select(x => int.Parse(x)).ToArray();
		}
		public static double[] SplitToDoubles(string line)
		{
			return line.Split(' ').Select(x => double.Parse(x)).ToArray();
		}
		public static long[] SplitToLongs(string line)
		{
			return line.Split(' ').Select(x => long.Parse(x)).ToArray();
		}
		public static int Main()
		{
			Compute(Console.In, Console.Out);
			return 0;
		}
		
		public static void Compute(TextReader reader, TextWriter writer)
		{
/*

    中間試験、期末試験のいずれかを欠席した場合成績は F。
    中間試験と期末試験の合計点数が 80 以上ならば成績は A 。
    中間試験と期末試験の合計点数が 65 以上 80 未満ならば成績は B。
    中間試験と期末試験の合計点数が 50 以上 65 未満ならば成績は C。
    中間試験と期末試験の合計点数が 30 以上 50 未満ならば成績は D。 ただし、再試験の点数が 50 以上ならば成績は C。
    中間試験と期末試験の合計点数が 30 未満ならば成績は F。
*/		
			while (true)
			{
				var line = reader.ReadLine();
				var ary = SplitToInts(line);
				
				var m = ary[0];
				var f = ary[1];
				var r = ary[2];
				
				if (m == -1 && f == -1 && r == -1)
				{
					return;
				}
				else if (m == -1 || f == -1)
				{
					writer.WriteLine("F");
				}
				else if (m + f >= 80)
				{
					writer.WriteLine("A");
				}
				else if (m + f >= 65)
				{
					writer.WriteLine("B");
				}
				else if (m + f >= 50)
				{
					writer.WriteLine("C");
				}
				else if (m + f >= 30)
				{
					if (r >= 50)
					{
						writer.WriteLine("C");
					}
					else
					{
						writer.WriteLine("D");
					}
				}
				else
				{
					writer.WriteLine("F");
				}
			}
		}
	}
}

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

int main() {
	string s; cin>>s;
	int n, chil[100001]={}; n=s.length();
	int leftcheck=0, rightcheck=1, offset=0;
	
	while(rightcheck<n){
		int preleftcheck=leftcheck;
	while(leftcheck<n-1){
		if(s[leftcheck+1]=='L') break;
		leftcheck++;
	}
	if(leftcheck==n-1) leftcheck--;
	
	rightcheck=leftcheck+1;
	
	while(rightcheck<n){
		if(s[rightcheck+1]=='R') break;
		rightcheck++;
	}
	if(rightcheck==n)rightcheck--;
	
	chil[leftcheck]+=(rightcheck+1-offset)/2;
	chil[leftcheck+1]+=(rightcheck+1-offset)/2;
	
	if((rightcheck+1-offset)%2!=0){
		if(leftcheck-preleftcheck>rightcheck-leftcheck-1){
			if((leftcheck-preleftcheck)%2==1) chil[leftcheck+1]++;
			else chil[leftcheck]++;
		}
		else{
			if((rightcheck-leftcheck)%2==0) chil[leftcheck]++;
			else chil[leftcheck+1]++;
		}
	}
	
	leftcheck=rightcheck+1;
	offset=rightcheck+1;
	}
	for(int i=0;i<n;i++) cout<<chil[i]<<' ';
	return 0;
}

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

const int mod = 998244353;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, S;
    cin >> N >> S;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A.at(i);

    vector<vector<ll>> dp(N, vector<ll>(S+1, 0));
    dp[0][0] = 2;
    if(A[0] <= S) dp[0][A[0]] = 1;

    for(int i=1; i<N; i++)
    {
        for(int j=0; j<S+1; j++)
        {
            dp[i][j] += 2*dp[i-1][j];
            dp[i][j] %= mod;
            if(j + A[i] <= S)
            {
                dp[i][j+A[i]] += dp[i-1][j];
                dp[i][j+A[i]] %= mod;
            }
        }
    }
    cout << dp[N-1][S] << endl;

    return 0;
}


Measured memory_bytes: 73608
import math
n,d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
ans = 0

for i in range(n):
  for j in range(i+1,n):
    temp = 0
    for k in range(d):
      temp += (x[i][k] - x[j][k]) ** 2
    l = math.sqrt(temp)
    if l % 1 == 0:
      ans += 1
print(ans)

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int k;
  cin >> k;
  queue<ll> q;
  for (int i = 1; i < 10; ++i) q.push(i);
  rep(i, k - 1) {
    ll n = q.front();
    q.pop();
    for (int j = -1; j <= 1; ++j) {
      int d = n % 10 + j;
      if (d >= 0 && d <= 9) q.push(n * 10 + d);
    }
  }
  cout << q.front() << endl;
}


Measured memory_bytes: 1792
H, W = gets.chomp.split.map(&:to_i)

if H % 3 == 0 || W % 3 == 0
  p 0
  exit
end

def harf(h, w)
  if h % 2 == 0 || w % 2 == 0
    s = (h * w) / 2
    [s, s]
  else
    h, w = w, h if w > h
    hh = h / 2
    [hh * w, (h - hh) * w]
  end
end

ans = 10 ** 10
h = H
w = W
1.upto(h-1).each do |hh|
  arr = harf((h-hh),w).push(hh*w).sort
  s = arr.last - arr.first
  ans = s if s < ans
end
1.upto(w-1).each do |ww|
  arr = harf((w-ww),h).push(h*ww).sort
  s = arr.last - arr.first
  ans = s if s < ans
end
p ans


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

int n;

int main(){
    cin>>n;

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

        if(i > n/2 - 1){
            box[i] = a[i];
            if(a[i] == 1) M++;
        }else box[i] = 0;
    }

    for(int i = n/2; i > 0; i--){
        int sum = 0;
        for(int j = 2*i; j <= n; j += i){
            sum += box[j-1];
        }
        if(sum%2 != a[i-1]){
            box[i-1] = 1;
            M++;
        }
    }
    cout << M << endl;
    for(int i=0; i< n; i++){
        if(box[i]==1) cout << i+1 << " ";
    }
    cout<<endl;
}

Measured memory_bytes: 2560
def main():
    N = int(input())
    x, y = map(int, input().split())
    a1 = x + y
    a2 = x + y
    b1 = y - x
    b2 = y - x
    N -= 1
    while N != 0:
        x, y = map(int, input().split())
        a1 = max(a1, x + y)
        a2 = min(a2, x + y)
        b1 = max(b1, y - x)
        b2 = min(b2, y - x)
        N = N - 1
    print(max(a1 - a2, b1 - b2))

main()


Measured memory_bytes: 9172
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main(){
	int n,wt;
	cin>>n>>wt;
	int a[n],w[n];
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>w[i]>>a[i];
		sum+=a[i];
		}
	ll dp[sum+1];
	fill(dp,dp+sum+1,1e9);
	dp[0]=0;
	for(int i=0;i<n;i++){
		for(int j=sum;j>=a[i];j--){
			dp[j]=min(dp[j],dp[j-a[i]]+w[i]);
			}
		}
		ll ans=0;
		for(ll i=0;i<=sum;i++){
			if(dp[i]<=wt){
				ans=max(i,ans);
				}
			}
			cout<<ans;
	
	return 0;
	}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




int main(){

    int N,K;
    cin >> N >> K;
    
    vi h(N);
    in(N,h);
    
    vi dp(N,infi);
    dp[0] = 0;
    
    rep(i,N){
        reps(j,1,K+1){
            if(i-j < 0) break;
            chmin(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
        }
    }
    
    cout << dp[N-1] << endl;
    
    
    
    

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(void){
  int num;
  long int total;
  
  cin >> num;
  
  total = 0;
  for(int i = 1;i <= num;i++){
   if(i % 3 != 0 && i % 5 != 0) total += i;
  }
  
  cout << total << endl;
  
  return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
int main(){
    int n;
    scanf("%d", &n);
    vector<pair<int, int> > events;
    for(int e = 0; e < n; e++){
        int t, h;
        scanf("%d %d", &t, &h);
        swap(h, t);
        h += t;
        events.push_back({h, t});
    }
    vector<bool> rem(n, false);
    sort(events.begin(), events.end());
    multiset<pair<int, int> > pushed;
    long long sum = 0;
    int rem_cnt = 0;
    for(int e = 0; e < n; e++){
        sum += events[e].second;
        pushed.insert({events[e].second, e});
        while(sum > events[e].first){
            if(rem[e]) break;
            auto lst = *prev(pushed.end());
            sum -= lst.first;
            rem[lst.second] = 1;
            rem_cnt++;
            pushed.erase(prev(pushed.end()));
        }
    }
    cout << n - rem_cnt << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
typedef unsigned long long ULL;

int main() {
	std::string str;
	std::string str2;
	std::string ans;

	std::cin >> str >> str2;

	if (str.size() > str2.size()) {
		for (int i = 0; i < str.size()-1; ++i) {
			ans.push_back(str[i]);
			ans.push_back(str2[i]);
		}
		ans.push_back(str[str.size()-1]);
	}
	else {

		for (int i = 0; i < str.size(); ++i) {
			ans.push_back(str[i]);
			ans.push_back(str2[i]);
		}
	}

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

}

Measured memory_bytes: 256