akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<bits/stdc++.h>

#define mod 1000000007
#define int long long
using namespace std;

vector<vector<int> > compatible(22, vector<int>(22));
int n;
int dp[22][(1 << 22)];

int solve(int i, int womenSubset) {

	if (i == n + 1) {

		if (womenSubset == 0)
			return 1;
		return 0;
	}

	if (dp[i][womenSubset] != -1)
		return dp[i][womenSubset];

	int ans = 0;
	for (int women = 0; women < n; women++) {

		bool available = ( (womenSubset & (1 << women)) == 0 ? 0 : 1);
		if (available && compatible[i-1][women])
			ans = (ans + solve(i + 1, womenSubset ^ (1 << women))) % mod;

	}

	return dp[i][womenSubset] = ans;
}


int32_t main()
{
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif

	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> compatible[i][j];
		}
	}

	memset(dp, -1, sizeof dp);
	cout << solve(1, ((1 << n) - 1)) << endl;
















}

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

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

  if (a[1] - a[0] == a[2] - a[1]) cout << "YES\n";
  else cout << "NO\n";

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int X,A,B,C;
    scanf("%d%d%d%d",&A,&B,&C,&X);
  
    int count=0;
    for(int i=0;i<=A;i++){
        for(int j=0;j<=B;j++){
            for(int k=0;k<=C;k++){
                int ans = 500*i+100*j+50*k;
                
                if(ans==X){
                    count +=1;
                }
            }
        }
    }
    
  
    printf("%d",count);
}

Measured memory_bytes: 128
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

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

	ll ans = 0;
	if(a >= k) ans += k;
	else{
		k -= a;
		ans += a;
		k -= b;
		if(k > 0) ans -= k;
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 3616
n = int(input())
A =[int(input()) for i in range(n)]

def insertion(A,n,g):
	global cnt
	for i in range(g,n):
		v=A[i]
		j=i-g
		while j >= 0 and A[j]>v:
			A[j+g]=A[j]
			j=j-g
			cnt+=1
		A[j+g]=v

cnt=0
g=[]
h=1
while h<=n:
	g.append(h)
	h=h*3+1
g=g[::-1]

print(len(g))
for i in g:
	insertion(A,n,i)
	if i ==1:
		print(i)
	else:	
		print(i,end=' ')
print(cnt)
for i in A:
	print(i)



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

typedef long long ll;

int n, m, x, t, cnt;
int a[105];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m >> x;
    for (int i = 0; i < m; ++i) {
        cin >> t;
        ++a[t];
    }
    for (int i = x; i < n; ++i) {
        if (a[i])
            ++cnt;
    }
    int ans = cnt;
    cnt = 0;
    for (int i = x; i >= 0; --i) {
        if (a[i])
            ++cnt;
    }
    ans = min(ans, cnt);
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3616
import scala.collection.mutable

object Main {
  val T_REVERSE = 1
  val T_COMMAND = 2
  val F_PREPEND = 1
  val F_APPEND = 2

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val original = sc.next()
    val commandLength = sc.nextInt()

    var isReversed = false
    var prependList: mutable.ListBuffer[Char] = mutable.ListBuffer()
    var appendList: mutable.ListBuffer[Char] = mutable.ListBuffer()

    1.to(commandLength).foreach { _ =>
      val commandT = sc.nextInt()

      if (commandT == T_REVERSE) {
        isReversed = !isReversed
      } else if (commandT == T_COMMAND) {
        val commandF = sc.nextInt()
        val char = sc.next().charAt(0)
        if ((commandF == F_PREPEND && !isReversed) || (commandF == F_APPEND && isReversed)) {
          prependList += char
        } else {
          appendList += char
        }
      }
    }

    val ans =
      if (isReversed) {
        val pre = appendList.mkString.reverse
        val orig = original.reverse
        val post = prependList.mkString
        pre + orig + post
      } else {
        val pre = prependList.mkString.reverse
        val post = appendList.mkString
        pre + original + post
      }

    println(ans)
  }
}


Measured memory_bytes: 114896
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int64_t INF = 1LL << 60;

int main() {
 int A,B;
 cin>>A>>B;
 cout<<max(0,A-2*B)<<endl;
  return 0;}

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

int main(){
int n,cnt=0;
string s;
cin >> n >> s;
for (int i=0;i < n-2;i++){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
        cnt++;
    }
}
cout << cnt << endl;

}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

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

    int n, k;
    cin >> n >> k;

    vector<Pin> v;
    vector<vi> sum(2 * k + 1, vi(2 * k + 1, 0));

    REP(i, n) {
        int x, y; char c;
        cin >> x >> y >> c;

        if (c == 'B') y -= k;

        x = (x + 2*k) % (2*k), y = (y + 2*k) % (2*k);

        v.eb(x, y);

        sum[x + 1][y + 1]++;
    }
    
    auto query = [&](int x0, int y0, int x1, int y1) {
        return sum[y1][x1] - sum[y1][x0 - 1] - sum[y0 - 1][x1] + sum[y0 - 1][x0 - 1];
    };

    FOR(i, 1, 2 * k + 1) FOR(j, 1, 2 * k + 1) {
        sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
    }

    int ans = 0;
    FOR(x, 1, k + 1) FOR(y, 1, k + 1) {
        int a, b ,c ,d ,e;
        a = query(x, y, x + k - 1, y + k - 1);
        b = query(1, 1, x - 1, y - 1);
        c = query(1, y + k, x - 1, 2 * k);
        d = query(x + k, y + k, 2 * k, 2 * k);
        e = query(x + k, 1, 2 * k, y - 1);

        int cur = a + b + c + d + e;
        ans = max(ans, max(n - cur, cur));
    }
    print(ans);

}

Measured memory_bytes: 19988
#include <cstdio>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <utility>
#include <string>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int iinf = 1 << 29;
const long long linf = 1ll << 61;

#define sci(x) scanf("%d", &x)
#define scd(x) scanf("%lf", &x)
#define scs(x) scanf("%s", x)
#define pri(x) printf("%d\n", x)
#define prd(x) printf("%f\n", x)
#define prs(x) printf("%s\n", x)

#define modp(x, y) (((y) + (x) % (y)) % (y))

int main(int argc, char* argv[])
{
	int a, b, c;
	sci(a); sci(b); sci(c);
	if(a + b == c || b + c == a || c + a == b) prs("Yes");
	else prs("No");

	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>
#include <stack>
#include <set>
#include <vector>

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef pair<int,int> pii;

const int INF = 1 << 29;
const double EPS = 1e-10;

int GetDays(int y, int m, int d) {
  int ret = 0;
  REP(i, 1, y + 1) REP(j, 1, i == y ? m : 11) {
    if (i % 3 == 0) ret += 20;
    else ret += j & 1 ? 20 : 19;
  }

  return ret + d;
}

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

  while (n_cases--) {
    int Y, M, D; cin >> Y >> M >> D;

    cout << GetDays(1000, 1, 1) - GetDays(Y, M, D) << endl;

  }
  
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n,r,k,t,p,s,d,v,vec[101][101];
	cin>>n;
	rep(i,n){
		vec[i][i]=0;
		rep(j,n)
			vec[i][j]=1000000;
	}
	rep(i,n)
		vec[i][i]=0;
	rep(i,n){
		cin>>r>>k;
		rep(j,k){
			cin>>t;
			vec[r-1][t-1]=1;
		}
	}
	rep(k,n)
	rep(i,n)
	rep(j,n){
		vec[i][j]=min(vec[i][j],vec[i][k]+vec[k][j]);
	}
	cin>>p;
	rep(i,p){
		cin>>s>>d>>v;
		s--;
		d--;
		if(vec[s][d]+1<=v)
		cout<<vec[s][d]+1<<endl;
		else
		cout<<"NA"<<endl;
		
		
		
	}
	return 0;
}

Measured memory_bytes: 0
object Main extends App {
	val N = scala.io.StdIn.readInt

	if(N<2) println(1)
	else if(N<4) println(2)
	else if(N<8) println(4)
	else if(N<16) println(8)
	else if(N<32) println(16)
	else if(N<64) println(32)
	else println(64)
}

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

int main()
{
    int val[5];
    cin >> val[0] >> val[1] >> val[2] >> val[3] >> val[4];
    for (int i = 0; i < 5; i++) {
        if (val[i] == 0) {
            cout << i + 1 << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
int n,x;
  cin>>n>>x;
  
//vector<int> a(n);
 // rep(i,n) cin>>a.at(i);
  n<10 && x<10 ?
    cout <<x*n
  : cout <<-1;
}

Measured memory_bytes: 256
/*************************************************************************
    > File Name: test.cpp
    > Author: Akira 
    > Mail: qaq.febr2.qaq@gmail.com 
 ************************************************************************/

#include<bits/stdc++.h>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define Sqr(a) ((a)*(a))
#define ALL(a) a.begin(), a.end()
using namespace std;

#define MaxN 200010
#define MaxM MaxN*10
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626
const int mod = 1E9+7;
const double eps = 1e-6;
#define bug cout<<88888888<<endl;
#define debug(x) cout << #x" = " << x << endl;
template<typename T> T abs(T val){return val>0?val:-val;}
inline int max2(int a, int b) {return ((a > b)? a : b);}
inline int min2(int a, int b) {return ((a < b)? a : b);}
inline int max3(int a, int b, int c) {return max2(a, max2(b, c));}
inline int min3(int a, int b, int c) {return min2(a, min2(b, c));}

int N;
LL a[MaxN],sum[MaxN];
int main()
{
    //std::ios::sync_with_stdio(false);
    while(~scanf("%d", &N))
    {
        sum[0] = 0;
        for(int i=1;i<=N;i++)
        {
            scanf("%lld", &a[i]);
            sum[i] = sum[i-1] + a[i];
        }
        LL ans = LONG_MAX;
        for(int i=1;i<N;i++)
        {
            ans = min(abs(sum[N]-sum[i]-sum[i]), ans);
        }
        printf("%lld\n", ans);
    }
    //system("pause");
    //printf("%lld\n", (x%mod+mod)%mod );
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
string s;
int main()
{
	int n;
	cin>>n;
	ios;
	cin>>s;
	int num=0,len=s.size();
	for(int i=0;i<len-2;++i)
	{
		if(s[i]!='A')continue;
		else
		{
			if(s[i+1]=='B'&&s[i+2]=='C')
			{
				num++;
			}
		}
	}
	cout<<num<<'\n';
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N,A[1001];
    int i,countt=1;

    cin>>N;
    for(i=0;i<N;i++){
        cin>>A[i];
        if((A[i]%2==0)&&(A[i]%6!=0&&A[i]%5!=0)){
                countt=0;
           }
    }
    if(countt==0){
        cout<<"DENIED"<<endl;
    }
    else{
        cout<<"APPROVED"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int pailie(int a,int b)
{
	int i;
	int sum=1;
	
	if(b<a-b) b =  a- b;
	
	for(i=b+1;i<=a;i++) sum *= i;
	
	for(i=1;i<=a-b;i++) sum /= i; 
	
	return sum;
}

int main() {
	int n, m;
	cin >> n >> m;
	
	if (n == 1 && m == 1) {
		cout << 0 << '\n';
		return 0;
	}
	
	int res = 0;
	if (n >=2) {
		res += pailie(n, 2);
	}
	
	if (m >= 2) {
		res += pailie(m, 2);
	}
	
	cout << res << '\n';
	
	return 0;
}

Measured memory_bytes: 256
//BISMILLAH
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    int digit;
    cin>>n>>digit;
    int countt=0;
    while(n!=0)
    {
        n=n/digit; // editorial dekhbo , shundor
        countt++;

    }

    cout<<countt<<endl;
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
//const int mod = 100000;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n, m;
  ll k;
  cin >> n >> m >> k;
  vector<ll> a(n), b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];
  a.insert(a.begin(), 0);
  b.insert(b.begin(), 0);
  rep(i, n) a[i+1] += a[i];
  rep(i, m) b[i+1] += b[i];

  int ans = 0;
  for(int i = 0; i <= n; ++i) {
    if(k-a[i] < 0) break;
    int tmp = i + (int)distance(b.begin(), upper_bound(ALL(b), k-a[i]))-1;
    chmax(ans, tmp);
  }
  for(int i = 0; i <= m; ++i) {
    if(k-b[i] < 0) break;
    int tmp = i + (int)distance(a.begin(), upper_bound(ALL(a), k-b[i]))-1;
    chmax(ans, tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 8000
N = int(input())
a = [0] * (N + 1)
for i in range(N):
	a[i + 1] = int(input())
cnt = 0
j = 1
while cnt <= N and j != 2:
	j = a[j]
	cnt += 1
if j == 2:
	print(cnt)
else:
	print(-1)


Measured memory_bytes: 6980
# 写経
import math


N = int(input())
mod = 10**9 + 7
nFact = math.factorial(N)
i = 2
ans = 1


while i * i <= nFact:
    cnt = 1
    # 何個 i が含まれるか調べる
    while nFact % i == 0:
        cnt += 1
        nFact //= i
    ans *= cnt
    i += 1
if nFact != 1:
    ans *= 2


print(ans % mod)

Measured memory_bytes: 3060
#include <cstdio>

int n, b[110], a[110], ans;

inline int min(int a, int b){
	return a < b ? a : b;
}

inline int max(int a, int b){
	return a > b ? a : b;
}

int main(){

	scanf("%d", &n);
	for(int i = 1; i < n; i++)
		scanf("%d", &b[i]);
	b[n] = b[n - 1];
	b[0] = 23333333;
	for(int i = 1; i <= n; i++){
		a[i] = min(b[i], b[i - 1]);
		//printf("%d\n", a[i]);
		ans += a[i];
	}
	printf("%d\n", ans);

	return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	int T, X; cin >> T >> X;
	cout << (double)T / X << endl;
}


Measured memory_bytes: 256
a, b  = gets.chomp.split(" ").map(&:to_i)

if a == 0 || b == 0
  puts 'Zero'
elsif (a > 0 && b < 0) || (a < 0 && b > 0)
  puts 'Zero'
elsif a > 0 && b > 0
  puts 'Positive'
else
  num = (b - a + 1)
  if (num % 2) == 0
    puts 'Positive'
  else
    puts 'Negative'
  end
end

Measured memory_bytes: 1788
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    string target="keyence";
    cin>>s;
    if(s==target){
        cout<<"YES"<<endl;
        return 0;
    }
    ll n=s.size();
    rep(i,n){
        rep2(j,i,n){
            string S="";
            rep(k,n){
                if(i<=k && k<=j){
					continue;
				}
                else S.pb(s[k]);
            }
            if(S == target){
                cout<<"YES"<<endl;
				return 0;
			}
        }
    }
    cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

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

int main(){
    int a, p;
    cin >> a >> p;
    cout << ( a * 3 + p ) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 25
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
  scanf("%d",&head);
  RI(tail...);
}
using namespace std;
typedef long long LL;
int c[M], v[M];
int main()
{ 
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> v[i];
	for(int i = 0; i < n; i++) cin >> c[i];
	int sum = 0;
	for(int i = 0; i < n; i++) if(v[i]-c[i] > 0) sum += (v[i]-c[i]);
	cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  long long a, b, k;
  cin>>a>>b>>k;
  if(a>k || a==k) cout<<a-k<<" "<<b<<endl;
  else{
      (a-k+b>0 ||a-k+b==0) ? cout<<0<<" "<<a-k+b<<endl : cout<<0<<" "<<0<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, A, B, C);
  print(C >= A && C <= B ? "Yes" : "No");
}


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

struct Point{double x,y; bool high;};
bool comp(Point a,Point b) {return (a.x==b.x ? a.y<b.y : a.x<b.x);}

Point* Intersection(Point p1,Point p2,Point p3,Point p4,bool high){
    double d = (p2.x-p1.x)*(p4.y-p3.y)-(p2.y-p1.y)*(p4.x-p3.x);
    double u = ((p3.x-p1.x)*(p4.y-p3.y)-(p3.y-p1.y)*(p4.x-p3.x))/d;
    double v = ((p3.x-p1.x)*(p2.y-p1.y)-(p3.y-p1.y)*(p2.x-p1.x))/d;
    if(d==0 || u<0 || u>1 || v<0 || v>1) return NULL;
    return new Point{p1.x+u*(p2.x-p1.x), p1.y+u*(p2.y-p1.y), high};
}

int main(void){
    int N,n,o,l;
    cin>>N;
    while(N--){
        Point a,b;
        vector<Point> cross;
        cin>>a.x>>a.y>>b.x>>b.y>>n;
        rep(i,n){
            Point s,t;
            cin>>s.x>>s.y>>t.x>>t.y>>o>>l;
            Point *ret = Intersection(a,b,s,t,o==l);
            if(ret!=NULL)cross.push_back(*ret);
        }

        sort(cross.begin(),cross.end(),comp);
        int cnt=0;
        for(int i=0;i+1<(int)cross.size();i++){
            cnt+=(cross[i].high!=cross[i+1].high);
        }
        cout<<cnt<<endl;
    }

    return 0;
}

Measured memory_bytes: 3508
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    s = input()
    N = len(s)
    gnum = 0
    pnum = 0
    for i in range(N):
        if s[i] == 'g':
            gnum += 1
        else:
            pnum += 1
    print((gnum-pnum)//2)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3572
n = int(input())
s = list(map(int,input().split()))
ans = 1
max = s[0]
for i in range(1,n):
  if s[i] >= s[i-1] and max <= s[i]:
    ans+=1
    if s[i] >= max:
      max = s[i]
print(ans)   

Measured memory_bytes: 3060
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
    int n;
    cin >> n;
    int res = 0;
    int mx = -1;
    FOR(i, 1, n) {
        int tmp = i;
        int tot = 0;
        while ((tmp % 2 == 0) && (tmp != 0)) {
            tmp /= 2;
            tot++;
        }
        if (tot > mx) {
            res = i;
            mx = tot;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#define rep(i, to) for (i = 0; i <= to; i++)
#define rrep(i, from) for (i = from; i >= 0; i--)
#define chmin(i, u) i = min(i, u)
using namespace std;
int D[100][100][100];
int main() {
	int i, j, k;
	rep(i, 90) rep(j, 90) rep(k, 90) {
		D[i][j][k] = 1e9;
		if (i == j && j == k) D[i][j][k] = 0;
	}
	rrep(i, 80) rrep(j, 80) rrep(k, 80) {
		if (i >= 2) chmin(D[i - 2][j][k], D[i][j][k] + 1);
		if (j >= 2) chmin(D[i][j - 2][k], D[i][j][k] + 1);
		if (k >= 2) chmin(D[i][j][k - 2], D[i][j][k] + 1);
		if (i && j) chmin(D[i - 1][j - 1][k], D[i][j][k] + 1);
		if (i && k) chmin(D[i - 1][j][k - 1], D[i][j][k] + 1);
		if (k && j) chmin(D[i][j - 1][k - 1], D[i][j][k] + 1);
	}
	cin >> i >> j >> k;
	cout << D[i][j][k] << endl;
    return 0;
}

Measured memory_bytes: 3840
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

// dp[i][j] := i 枚のコインを投げたときに、j 枚の表が出る確率
double dp[3005][3005];

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

    int n;
    cin >> n;
    vector<double> p(n);
    for(int i = 0; i < n; ++i){
        cin >> p[i];
    }
    dp[0][0] = 1;
    for(int i = 0; i < n; ++i){
        dp[i+1][0] = dp[i][0] * (1 - p[i]);
        dp[i+1][i+1] = dp[i][i] * p[i];
    }
    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= i; ++j){
            dp[i][j] = dp[i-1][j] * (1 - p[i-1]) + dp[i-1][j-1] * p[i-1];
        }
    }
    double res = 0;
    for(int i = n / 2 + 1; i <= n; ++i){
        res += dp[n][i];
    }
    cout << fixed << setprecision(10);
    cout << res << endl;
}

Measured memory_bytes: 68992
#include <stdio.h>
#include <string.h>

int main( void ) {
	char str1[ 100000 ], str2[ 100000 ], fig, tmp;
	int i, n, idx1, idx2, sum;

	while ( scanf( "%d", &n ), n ) {
		scanf( "%s", str1 );

		while ( n-- ) {
			idx1 = idx2 = 0;
			while ( ( fig = str1[ idx1 ] ) != '\0' ) {
				sum = 1;
				while ( ( tmp = str1[ ++idx1 ] ) != '\0' && fig == tmp )
					sum++;
				sprintf( str2 + idx2++, "%d%c", sum, fig );

				do {
					idx2++;
				} while ( sum /= 10 );
			}

			strcpy( str1, str2 );
		}

		printf( "%s\n", str1 );
	}

	return 0;
}

Measured memory_bytes: 708
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_poizcy.hpp>
typedef long long  ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ll, ii>  iii;
typedef pair<double, double>  iidb;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9+7;
const double PI = acos(-1);
#define initseg ll new_nodo=(pnodo*2),mid=(iz+der)/2;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define tam 600000
#define offset 3000
#define ptr nodo*
const ll MOD=1e9+7;

using namespace std;
ll X,n;
ll sig(ll u){return (u%2!=0)?-1:1;}
ll t[tam],d[tam],need[tam];
deque<ii> colaP,colaN;

	
void mover(ll time,ll &iz)
{
	while(iz<=n)
	{
		if (t[iz]<time)
		{
			if (need[iz]<0)
			{
				if (colaN.empty()|| abs(colaN.back().fi)<abs(need[iz]))
					colaN.push_back({need[iz],iz});
			}
			else
			{
				if (colaP.empty()|| abs(colaP.back().fi)<abs(need[iz]))
					colaP.push_back({need[iz],iz});
			}
			iz++;
		}
		else
			break;
	}
}
	
void calc(ll time,ll &pos,ll &vup)
{
	while(pos<=n)
	{
		if (time>t[pos]){
			vup+=d[pos];
			vup=max(0LL,vup);

			vup=min(X,vup);
			pos++;
		}
		else
			break;
	}
}
void apply(ll &valor,ll time,ll i)
{
	
	ll delta=abs(((i>0)?t[i-1]:0)-time)*sig(i);
	valor+=delta;
	valor=max(valor,0LL);
	valor=min(valor,X);
}
int main()
{	
	cin>>X>>n;
	ll vup=X,vdown=0;
	t[0]=0;
	t[n+1]=3e9;
	ll ant=0;
	forr(i,1,n+1)
	{
		cin>>t[i];
		d[i]=abs(t[i]-t[i-1])*sig(i);
		need[i]=ant+d[i];
		ant=need[i];
	}
	ll queries;
	cin>>queries;
	ll time,valor,iztime=0,izup,izdown,lst;
	izup=izdown=1;
	forr(i,0,queries)
	{
		cin>>time>>valor;
		mover(time,iztime);
		if (!colaP.empty()&&colaP.back().fi+valor>=X)
			calc(time,izup,vup),lst=izup,valor=vup;
		
		else if (!colaN.empty() && colaN.back().fi+valor<=0)
			calc(time,izdown,vdown),lst=izdown,valor=vdown;
		else 
		{
			lst=lower_bound(t,t+n+1,time)-t;
			if (lst!=0)
				valor+=need[lst-1];
		}
		apply(valor,time,lst);
		cout<<valor<<endl;

	}
}

Measured memory_bytes: 5988
#include<stdio.h>
int main()
{
	int a,b,c,d,N,n,sum;
	while(scanf("%d",&n)!=EOF)
	{
		sum=0;N=0;
		for(a=0;a<=9;a++)
		{
			for(b=0;b<=9;b++)
			{
				for(c=0;c<=9;c++)
				{
					for(d=0;d<=9;d++)
					{
						sum=a+b+c+d;
						if(sum==n)
							N++;
					}
				}
			}
		}
		
		printf("%d\n",N);
	}
	return 0;
}

Measured memory_bytes: 596
#include<cstdio>

using namespace std;
int main(){
	int masu[2000],n,m;
	while(1){
	scanf("%d%d",&n,&m);
	if(n==0 && m==0){
		break;
	}
	for(int i=1;i<=n;i++){
		scanf("%d",&masu[i]);
	}
	int iti=1;
	int sai[2000];
	for(int i=1;i<=m;i++){
		scanf("%d",&sai[i]);
	}
	for(int i=1;i<=m;i++){
		iti+=sai[i];
		iti+=masu[iti];
		if(iti>=n){
			printf("%d\n",i);
			break;
		}
	}
	}
}

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

static const int MAX = 7368791;

int main(){
    int m,n;

    while(cin>>m>>n,n&&m){
        int cnt = 0;
        int ans;
        vector<bool> prime(MAX+10,false);

        for(int i=m; ; i++){
            if(!prime[i]){
                if(cnt == n){
                    ans = i;
                    break;
                }
                cnt++;

                for(int j=1; i*j<=MAX; j++){
                    prime[i*j] = true;
                }
            }
        }

        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 3988
N, A, B = [int(i) for i in input().split(" ")]
S = input()

cnt = 0
cnt_abroad = 0

for s in S:
  if A + B <= cnt:
    print("No")
    continue
  if s == "c":
    print("No")
    continue
  if s == "a":
    cnt += 1
    print("Yes")
    continue
  if s == "b":
    if B <= cnt_abroad:
      print("No")
      continue
    cnt += 1
    cnt_abroad += 1
    print("Yes")
    continue


Measured memory_bytes: 9316
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n,m;
	cin >> n >> m;
	int k = 0;
	vector <int> v;
	while (n--) {
		int a;
		cin >> a;
		v.push_back(a);
		k = k + a;
	}
	double target = (double)k / (double)(4 * m);
	for (auto e : v) {
		if (m == 0) break;
		if (e >= target) m--;
	}
	if (m == 0) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl

using namespace std;

const int mod=1e9+7;

void run();

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

signed main(){
    init();
    run();
    return 0;
}

class DisjointSet{
    public:
    vi rank, p;
    
    DisjointSet(){}
    DisjointSet(int size){
        rank.resize(size,0);
        p.resize(size,0);
        rep(i,size)makeSet(i);
    }
    
    void makeSet(int x){
        p[x]=x;
        rank[x]=0;
    }
    
    bool same(int x,int y){
        return findSet(x)==findSet(y);
    }
    
    void unite(int x,int y){
        link(findSet(x),findSet(y));
    }
    
    void link(int x,int y){
        if(rank[x]>rank[y]){
            p[y]=x;
        }
        else{
            p[x]=y;
            if(rank[x]==rank[y]){
                rank[y]++;
            }
        }
    }
    
    int findSet(int x){
        if(x!=p[x]){
            p[x]=findSet(p[x]);
        }
        return p[x];
    }
};

void run(){
    vi a(3);
    rep(i,3)cin>>a[i];
    sort(all(a));
    cout<<a[0]+a[1]+a[2]*10<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int s,s1,s2,s3;
  cin>>s;
  s1=s/100;
  s2=s/10-s1*10;
  s3=s-s1*100-s2*10;
  cout<<s1+s2+s3<<endl;
}

Measured memory_bytes: 256
from sys import stdin


def get_result(data):
    N, K = data
    mod = 10**9+7
    e_val = [i for i in range(N+1)]
    # 累積和を使ってsumを計算
    e_cumsum = [0]
    for i in range(N+1):
        e_cumsum.append(e_cumsum[i] + e_val[i])
    ans = 0
    for r in range(K, N+2):
        min_val = e_cumsum[r]
        max_val = e_cumsum[N+1] - e_cumsum[N+1-r]
        ans += (max_val - min_val + 1) % mod
    return ans % mod


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)


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

typedef long long int ll;
const int maxn=1e5+100;
ll dp[maxn],v[maxn],w[maxn];

int main() {
	std::ios::sync_with_stdio(false);
	ll n,m;
	cin >> n >> m;
	for(int i=1; i<=n; i++) cin >> w[i] >> v[i];
	for(int i=1; i<=n; i++)
		for(int j=m; j>=w[i]; j--) dp[j] = max(dp[j],dp[j-w[i]]+v[i]);
	cout << dp[m] << endl;
	return 0;
}

Measured memory_bytes: 1024
# @author 

import sys

class CSkillUp:
    def solve(self, tc=0):
        n, m, x = [int(_) for _ in input().split()]
        a = []
        c = []
        for _ in range(n):
            ci, *line = [int(_) for _ in input().split()]
            a.append(line)
            c.append(ci)

        min_cost = float('inf')
        for mask in range(2 ** n):
            und = [0] * m
            cost = 0
            for i in range(n):
                if (mask >> i) & 1:
                    cost += c[i]
                    for j in range(m):
                        und[j] += a[i][j]

            if min(und) >= x and cost < min_cost:
                min_cost = cost

        print(min_cost if min_cost != float('inf') else -1)




solver = CSkillUp()
input = sys.stdin.readline

solver.solve()


Measured memory_bytes: 9228
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>

typedef long long int64;

int main(void) {
  int l;
  std::cin >> l;
  printf("%.12f\n", (double)(l * l * l) / 27);
  return 0;
}


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

void solve(long long X, long long K, long long D)
{
    if (X < 0)
    {
        X = -X;
    }
    if (X / D <= K)
        K -= X / D, X -= D * (X / D);
    else
        X -= D * K, K = 0;
    if (K & 1)
        cout << D - X << endl;
    else
        cout << X << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long X;
    scanf("%lld", &X);
    long long K;
    scanf("%lld", &K);
    long long D;
    scanf("%lld", &D);
    solve(X, K, D);
    return 0;
}


Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
    int main(){
        int N, C; C = 0;
            string S;
                cin >> N >> S;
                    for(int i = 0; i < N - 2; i++){
                        if(S.at(i) == 'A'){
                            if(S.at(i + 1) == 'B'){
                                if(S.at(i + 2) == 'C'){
                                    C += 1;
                                }
                            }
                        }
                    }
                        cout << C << endl;
    return 0;}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	vector<int> hs;

	scanf("%d", &n);
	hs.resize(n);
	for(int i = 0; i < n; i++) {
		scanf("%d", &hs[i]);
	}

	for(int i = 0; i < n; i++) {
		if(i == 0 || hs[i - 1] < hs[i]) {
			hs[i] -= 1;
		}
	}

	bool yes = true;
	for(int i = 0; i < n - 1; i++) {
		yes = yes && (hs[i] <= hs[i + 1]);
	}

	printf("%s\n", yes ? "Yes" : "No");

	return 0;
}


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

int main(){
    int N, M;
    cin >> N >> M;
    ll minf = -20000000000000;
    vector<vector<ll>> edge;
    for (int i = 0; i < M; i++){
        int a, b, c;
        cin >> a >> b >> c;
        edge.push_back({a, b, c});
    }
    vector<ll> point(N+1, minf);
    point[1] = 0;
    for (int i = 0; i < N; i++) {
        for (auto p : edge) {
            point[p[1]] = max(point[p[0]] + p[2], point[p[1]]);
        }
    }
    ll ans1 = point[N];
    for (int i = 0; i < N; i++) {
        for (auto p : edge) {
            point[p[1]] = max(point[p[0]] + p[2], point[p[1]]);
        }
    }
    ll ans2 = point[N];
    if (ans1 == ans2) cout << ans1 << endl;
    else cout << "inf\n";
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;

namespace abc179_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();

      var ans = 0L;

      for (int A = 1; A < N; A++)
      {
        ans += (N - 1) / A;
      }

      Console.WriteLine(ans);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


Measured memory_bytes: 27888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){ cout << (x[i]) << " ";} cout<<endl;

ll n, x, c[2019][2019];
string s;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n >> x;
	rep(j, 1, n){
		cin >> c[0][j];
	}
	c[0][0] = c[0][n];
	
	rep(i, 1, n-1){
		rep(j, 1, n){
			c[i][j] = min(c[i-1][j-1], c[i-1][j]);
		}
		c[i][0] = c[i][n];
	}
	
	ll sm[2019];
	memset(sm, 0, sizeof(sm));
	rep(i, 0, n-1){
		rep(j, 1, n){
			sm[i] += c[i][j];
		}
	}
	
	ll ans = sm[0];
	rep(i, 1, n-1){
		ans = min(sm[i]+i*x, ans);
	}
	
	print(ans)
	return 0;
}

Measured memory_bytes: 31872
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */


// 逆元 | a と mod は互いに素
int inv_mod(int a, int m = MOD) {
  int b = m, x = 1, y = 0, t;
  while (b > 0) {
    t = a / b;
    swap(a -= t * b, b);
    swap(x -= t * y, y);
  }
  x %= m;
  if (x < 0) x += m;
  return x;
}

// 逆元(配列) | 1...n-1 は mod と互いに素, n <= mod
int fac[1000010], invfac[1000010], inv[1000010];
void init(int n, int mod = MOD) {
  fac[0] = 1;
  for (int i = 1; i < n; i++) fac[i] = fac[i-1]*i%mod;
  invfac[n-1] = inv_mod(fac[n-1]);
  for (int i = n-2; i >= 0; i--) invfac[i] = invfac[i+1]*(i+1)%mod;
  for (int i = 1; i < n; i++) inv[i] = invfac[i]*fac[i-1]%mod;
}

// 二項係数 | n,k < mod, mod は素数
int nCk(int n, int k, int mod = MOD) {
  if (!(0 <= k && k <= n)) return 0;
  return fac[n] * invfac[k] % mod * invfac[n-k] % mod;
}

int H(int n, int r) {
  if (n < 0 || r < 0) return 0;
  return r == 0 ? 1 : nCk(n + r - 1, r);
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int N,K;
  cin >> N >> K;
  init(1000010);
  for (int i = 1; i <= K; i++) {
    int ans = 0;
    for (int x = i-1; x <= N-K; x++) {
      ans += H(i,K-i) * H(i-1,x-i+1) % MOD * (N+MOD-K+MOD-x+1) % MOD;
      ans %= MOD;
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 23808
import sys
input = sys.stdin.readline

def isPrime(x):
	ans = 0
	if x==1:
		ans = 1
	else:
		for i in range(2,x):
			if x%i==0:
				ans = 1
				break;
	return ans

x = int(input())

while 1:
	if isPrime(x)==0:
		break
	if x%10==1 or x%10==3 or x%10==7:
		x += 2
	else:
		x += 1

print(x)

Measured memory_bytes: 3060
a = int(input())
b = list(map(int, input().split()[:a]))
my_list = []
score = 0
for i in b:
    if i%2==0:
        my_list.append(i)
for i in my_list:
    if i%3==0 or i%5==0:
        score += 1
if len(my_list) == score:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 9188
N, K = map(int, input().split())

tab_sum = [0]
sum_tmp = 0
for i in range(N + 1):
    sum_tmp += i
    tab_sum.append(sum_tmp)

ans = 0
DIVIDER = 1000000007
for cnt in range(K, (N + 1) + 1):
    sum_min = tab_sum[cnt] - tab_sum[0]
    sum_max = tab_sum[-1] - tab_sum[-1 - cnt]
    #
    ans = (ans + (sum_max - sum_min + 1)) % DIVIDER

print(ans)

Measured memory_bytes: 19240
#include <iostream>
#include <vector>

using namespace std;


int N;
vector<int> A,B;



int main()
{
	long long  ans = 0;
	cin >> N;
	A = vector<int>(N + 2);
	B = vector<int>(N + 1);

	for (int i = 1; i < N + 2; i++) {
		cin >> A.at(i);
	}
	for (int i = 1; i < N + 1; i++) {
		cin >> B.at(i);
	}


	for (int i = 1; i < N+1; i++) {
		int de = (A.at(i) <= B.at(i)) ? A.at(i) : B.at(i);
		ans += de;
		B.at(i) -= de;

		de = (A.at(i+1) <= B.at(i)) ? A.at(i+1) : B.at(i);
		ans += de;
		A.at(i + 1) -= de;
	}

	cout << ans << endl;

	
	return 0;
}




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


int main() {
	int N;
  vector<pair<string,int>> v;
  cin >> N;
  for(int i = 0; i < N; i++) {
    string s;
    int p;
    cin >> s >> p;
    v.push_back({s,(100-p)*1000 + i+1});
  }
  sort(v.begin(), v.end());
  for(auto p : v)
    cout << p.second % 1000 << "\n";
}






Measured memory_bytes: 256