akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,q,l,r,ac[100005];
	string s;
    cin>>n>>q>>s;
    ac[0]=0;
    for(int i=1;i<n;i++){
    	if(s[i]=='C'&&s[i-1]=='A') ac[i]=ac[i-1]+1;
        else ac[i]=ac[i-1];
    }
    for(int i=0;i<q;i++){
    	cin>>l>>r;
        l--;r--;
        cout<<ac[r]-ac[l]<<endl;
    }
}

Measured memory_bytes: 1408
A, B = map(int, input().split())
S = input()

n = [str(i) for i in range(10)]
flag = False
for i in range(A):
    if S[i] not in n:
        flag = True
        
if S[A] != '-':
    flag = True
    
for i in range(A+1, A+B+1):
    if S[i] not in n:
        flag = True
        
if flag:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
	cout << fixed << setprecision(10);
	string s;
	cin >> s;
	if(s.substr(0,4)=="YAKI") cout << "Yes" << endl;
	else cout << "No" << endl;  
	return 0;
}

Measured memory_bytes: 256
S = list(input())
n = len(S)

s1 = 0
s2 = 0

for i in range(n):
    if i % 2 == 0 and S[i] == '0':
        s1 += 1
    elif i % 2 == 1 and S[i] == '1':
        s1 += 1

for i in range(n):
    if i % 2 == 0 and S[i] == '1':
        s2 += 1
    elif i % 2 == 1 and S[i] == '0':
        s2 += 1

print(min(s1, s2))

Measured memory_bytes: 3956
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
ll H, W, K;
vector<string> C;
bool is_good(ll rows, ll cols){
    ll cnt = 0;
    REP(i, H){
        REP(j, W){
            if(!(rows >> i & 1) && !(cols >> j & 1) && C[i][j] == '#') 
                cnt ++;
        }
    }
    if(cnt == K) return true;
    else return false;
}

int main(){
    cin >> H>>W>>K;
    C.resize(H);
    REP(i, H) cin >> C[i];

    ll ans = 0;
    REP(rows, 1LL << H){
        REP(cols, 1LL << W){
            if(is_good(rows, cols)) {
                ans ++;
                //cout << rows << " "<<cols<<endl;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}


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

#define is_uruu main
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(a);i>(b);--i)
    
int is_uruu() {
	long long N,M;
	cin >> N >> M;
	if(N==1 && M==1){
		cout << 1 << endl;
		return 0;
	}
	if(N==1){
		cout << M-2 << endl;
		return 0;
	}
	if(M==1){
		cout << N-2 << endl;
		return 0;
	}
	if(N==2 || M==2){
		cout << 0 << endl;
		return 0;
	}
	cout << (N-2)*(M-2) << endl;
    return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    int n, q, t, count = 0;
    int a[10001];
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    sort(a, a + n);
    cin >> q;
    for(int i = 0; i < q; ++i){
        cin >> t;
        if(binary_search(a, a + n, t)) {
            ++count;
        }
    }
    
    cout << count << endl;
    
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << "\n"
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
int main() {
	int n, m; cin >> n >> m;
	vi C(m, 0); rep(i, 0, m) cin >> C[i];
	vi dp(n + 1, 1e9);
	dp[0] = 0;
	rep(i, 0, m) {
		rep(j, C[i], n + 1) {
			if(dp[j] > dp[j - C[i]] + 1) {
				dp[j] = dp[j - C[i]] + 1;
			}
		}
	}
	P(dp[n]);
	return 0;
}

Measured memory_bytes: 3216
import java.io.PrintWriter;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		long D = sc.nextLong();
		long X = sc.nextLong();
		long A[] = new long[N];
		
		for(int i=0;i<N;i++){
			A[i] = sc.nextLong();
		}
		for(int i=0;i<N;i++){
			X+= 1+((D-1)/A[i]);
		}
		out.println(X);
		out.flush();	
	}
}

Measured memory_bytes: 22612
#[allow(unused_imports)]
use proconio::{input, marker::*};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

fn main() {
    input! {
        l: usize,
        r: usize,
        d: usize,
    }
    let mut count = 0usize;
    for i in l..r + 1 {
        if i % d == 0 {
            count += 1;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 2148
#include <iostream>
using namespace std;
string s;
long long n;
int main(){
    cin >> s;
    for(int i = 0; i < s.length(); i++){
        n += s[i] - '0';
    }
    if(n % 9) cout << "No";
    else cout << "Yes";
    return 0;
}

Measured memory_bytes: 3708
#include<iostream>
#include<cstdio>
using namespace std;
int a,b;
int main()
{
	scanf("%d%d",&a,&b);
	if(a>0)printf("Positive");
	else if(b<0)
	{
		if((b+1-a)&1)printf("Negative");else printf("Positive");
	} 
	else printf("Zero");
	return 0;
}

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

int counter(int x){
  if(x == 0) return 0;
  return counter(x >> 1) + (x & 1);
}

int main(void){
  int n; cin >> n;
  int a[n];
  int x[n][n],y[n][n];
  rep(i,n){
    cin >> a[i];
    rep(j,a[i]){
      cin >> x[i][j] >> y[i][j];
    }
  }
  int ans = 0;
  for(int bits = 1; bits < (1 << n); bits++){
    bool ok = true;
    for(int i = 0; i < n; i++){
      if(!(bits & (1 << i))) continue;
      for(int j = 0; j < a[i]; j++){
        if(((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false; 
      }
    }
    if(ok) ans = max(ans,counter(bits));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
p,t='+X'
for e in sys.stdin:
 for i in'0123456789'[(e[0]==t)*(e[1]!=p)or('+X'in e)*('+X='not in e):]:
  l,r=e.replace(t,i).split('=')
  if sum(map(int,l.split(p)))==int(r):print(i);break
 else:print('NA')


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

#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT_ON(bit, i) (bit & (1LL << i))

typedef long long LL;
template<typename T> using V = std::vector<T>;
template<typename T> using VV = std::vector<std::vector<T>>;
template<typename T> using VVV = std::vector<std::vector<std::vector<T>>>;
template<typename T> using VVVV = std::vector<std::vector<std::vector<std::vector<T>>>>;

template<class T> inline T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> inline void print(T x) { std::cout << x << std::endl; }
template<class T> inline void print_vec(const std::vector<T> &v) { for (int i = 0; i < v.size(); ++i) {  if (i != 0) {std::cout << " ";} std::cout << v[i];} std::cout << "\n"; }
template<class T> inline bool inside(T y, T x, T H, T W) {return 0 <= y and y < H and 0 <= x and x < W; }
template<class T> inline double euclidean_distance(T y1, T x1, T y2, T x2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }
template<class T> inline double manhattan_distance(T y1, T x1, T y2, T x2) { return abs(x1 - x2) + abs(y1 - y2); }
template<class T> inline std::vector<T> unique(std::vector<T> v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    return v;
}

const int INF = 1 << 30;
const double EPS = 1e-9;
const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy4 = { 0, 1, 0, -1 }, dx4 = { 1, 0, -1, 0 };    // 4近傍（右, 下, 左, 上）
const std::vector<int> dy8 = { 0, -1, 0, 1, 1, -1, -1, 1 }, dx8 = { 1, 0, -1, 0, 1, 1, -1, -1 };

using namespace std;


LL solve(int N, int M, V<int> c, V<int> v) {
    VV<LL> dp(N + 1, V<LL>(M + 1, 0));
    dp[0][0] = 0;
    FOR(i, 0, N) {
        FOR(j, 0, M + 1) {

            // not use
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);

            // use
            if (j - c[i] >= 0) {
                dp[i + 1][j] = max(dp[i + 1][j], max(dp[i][j], dp[i + 1][j - c[i]] + v[i]));
            }
        }
    }

    LL ans = 0;
    FOR(j, 0, M + 1) {
        ans = max(ans, dp[N][j]);
    }
    return ans;
}


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

    int N, M;
    while (cin >> N >> M) {
        V<int> c(N), v(N), d(N), l(N);

        FOR(i, 0, N) {
            string s;
            getline(cin, s);
            getline(cin, s);
            cin >> c[i] >> v[i] >> d[i] >> l[i];
        }

        LL ans = 0;
        ans = max(ans, solve(N, M, c, v));
        ans = max(ans, solve(N, M, c, d));
        ans = max(ans, solve(N, M, c, l));

        print(ans);
    }

    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    int s = 0;
    cin >> N;
    for (int i = 1; i <= N; i++) {
        s += i;
        if (s >= N) {
            for (int j = 1; j <= i; j++) {
                if (j != s-N) {
                    cout << j << endl;
                }
            }
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define data_type long long
#define endl "\n"

int  main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    data_type t,n,k,te=0;
    string str,ans;
    cin>>str;
    for(auto i:str)
        {
            if(i=='B' && ans.size())
                ans.erase(ans.size()-1);
            else if(i!='B')
                ans+=i;
        }


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


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	cin >> N;
	int a=0;
	eFOR(i, 1, N) {
		if (i % 2)a++;
	}
	//cout << a / N << endl;
	printf("%.6f", (double)a / N);
	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>

using namespace std;

int town[105][105];
int used[105][105]={0};

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

/*
int kidx[6]={1,1,1,0,-1,0};
int kidy[6]={-1,0,1,1,0,-1};
*/

int mx,my;

typedef struct{
  int x,y;
}now;

int solve(){
  int ans=0;
  int nx,ny;

  queue<now> p;
  now xy;

  used[0][0]++;
  p.push((now){0,0});

  while(!p.empty()){

    xy=p.front();
    p.pop();

    for(int i=0;i<6;i++){
      nx=xy.x+dx[xy.y%2][i];
      ny=xy.y+dy[xy.y%2][i];
      if(!((0 <= nx && nx <= mx+1)&&(0 <= ny && ny <= my+1))) continue;
      if(used[ny][nx]>=1) continue;
      if(town[ny][nx]) ans++;
      else if(used[ny][nx]==0){
	p.push((now){nx,ny});
	used[ny][nx]++;
      }
    }
    //    printf("%d_%d\n",ans,p.size());
  }
  return ans;
}

int main(void){
  scanf("%d %d",&mx,&my);
  for(int i=1;i<=my;i++){
    for(int j=1;j<=mx;j++){
      scanf("%d",&town[i][j]);
    }
  }
  printf("%d\n",solve());
  /*
  for(int i=0;i<=my;i++){
    for(int j=0;j<=mx;j++){
      printf("%d ",used[i][j]);
    }
    puts("");
  }
  */
}

Measured memory_bytes: 0
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

class data{
public:
  int n;
  char c;
};

int main(){
  char c;
  while(cin >> c && c != '#'){
    int ansNS = 0, ansEW = 0;
    vector<data> v[4];
    for(int i=0;i<4;i++){
      for(int j=0;j<13;j++){
	string str;
	cin >> str;
	data d;
	d.c = str[1];
	if('2' <= str[0] && str[0] <= '9') d.n = str[0] - '0';
	else if(str[0] == 'T') d.n = 10;
	else if(str[0] == 'J') d.n = 11;
	else if(str[0] == 'Q') d.n = 12;
	else if(str[0] == 'K') d.n = 13;
	else if(str[0] == 'A') d.n = 14;
	v[i].push_back(d);
      }
    }

    int b = 0;
    for(int i=0;i<13;i++){
      int n = 0, ans = 0;
      bool f = false;
      for(int j=0;j<4;j++){
	if(!f && v[(j+b)%4][i].c == c){
	  ans = (j+b)%4;
	  n = v[(j+b)%4][i].n;
	  f = true;
	}
	else if(!f && v[(j+b)%4][i].n > n && v[b][i].c == v[(j+b)%4][i].c){
	  ans = (j+b)%4;
	  n = v[(j+b)%4][i].n;
	}
	else if(f && v[(j+b)%4][i].c == c && v[(j+b)%4][i].n > n){
	  ans = (j+b)%4;
	  n = v[(j+b)%4][i].n;
	}
      }
      if(ans % 2 == 0) ansNS++;
      else ansEW++;
      b = ans;
    }

    if(ansNS > ansEW) cout << "NS " << ansNS-6 << endl;
    else cout << "EW " << ansEW-6 << endl;

  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll n;
    cin >> n;

    ll res = n * (n - 1) / 2;
    cout << res << endl;
    return 0;
}

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

int main() {
	vector<int> a;
	int i,j,n,key;
	cin >> n;
	a.resize(n);
	for(i=0; i<n; ++i) {
		cin >> a[i];
	}
	for(i=0; i<n; ++i) {
		key=a[i];
		for(j=i-1;j>=0 && a[j]>key; --j) {
			a[j+1]=a[j];
		}
		a[j+1]=key;
		for(int i=0; i<(int)a.size()-1; ++i) {
			cout << a[i] << " ";;
		}
		cout << a[(size_t)a.size()-1] << endl;
	}
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;

#define pb push_back
#define mp make_pair
#define all(_c) _c.begin(), _c.end()

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

    bool a[10] = {0};
    for (int i = 0, x; i < 4; i++)
        cin >> x, a[x] = 1;
    
    cout << (a[1] && a[9] && a[7] && a[4] ? "YES" : "NO") << '\n';
    return 0;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
mod = 10**9 + 7
path = [set() for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    path[a].add(b)
    path[b].add(a)
fac = [1]*(k+2)
fac_inv = [1]*(k+2)
for i in range(1,k+2):
    fac[i] = fac[i-1] * i %mod
    fac_inv[i] = pow(fac[i],mod-2,mod)

def P(n,k):
    if n-k < 0:
        print(0)
        exit()
    return fac[n] * fac_inv[n-k] %mod

ans = 1
reach = [False] * n
reach[0] = True
que = []
for i in path[0]:
    que.append(i)
ans *= P(k,len(path[0])+1)
while que:
    p = que.pop()
    reach[p] = True
    ans *= P(k-2,len(path[p])-1)
    ans %= mod
    for i in path[p]:
        if not reach[i]:
            que.append(i)
print(ans)


Measured memory_bytes: 83488
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int n;
char s[300005];
int east[300005];
int ans = INF;

int main(){
	scanf("%d", &n);
	scanf("%s", s);
	for(int i = 0; i < n; i++){
		if(i > 0){
			east[i] = east[i-1];
		}
		if(s[i] == 'E'){
			east[i]++;
		}
	}
	ans = east[n-1];
	for(int i = 1; i < n; i++){
		ans = std::min(ans, (east[n-1] - east[i]) + (i - east[i-1]));
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
  int N, M; cin >> N >> M;
  vector<int> p(M);
  vector<string> S(M);
  vector<bool> solved(N, false);
  vector<int> wa(N, 0);
  rep(i, M) cin >> p[i] >> S[i], p[i]--;

  int total_ac = 0, total_wa = 0;
  rep(i, M) {
    if(solved[p[i]]){}
    else {
      if(S[i] == "AC") total_ac++, solved[p[i]] = true, total_wa += wa[p[i]];
      else wa[p[i]]++;
    }
  }
  cout << total_ac << " " << total_wa << endl;

  return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define ENDL '\n'
#define io ios_base::sync_with_stdio(false);cin.tie(0);
#define sayy cout<<"YES"<<ENDL;
#define sayn cout<<"NO"<<ENDL;

using namespace std;

int main(){
    io

    int x; 
    cin >> x;

    if(x==3 || x==5 || x==7){
        sayy
    }
    else
    {
        sayn
    }
    
    return 0;
}

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


int main(){
  vector<int> x(3);
  cin >> x[0] >> x[1] >> x[2];
  sort(x.begin(),x.end());
  int res = 0;
  if ((x[2] - x[1]) & 1) {
    res++;
    x[1]++;x[0]++;
  }
  res += x[2] - x[1];
  int p = x[2] - x[1];
  x[1] += p;
  x[0] += p;
  if((x[2] - x[0]) % 2 == 0)res += (x[2] - x[0]) / 2;
  else res += (x[2] - x[0] + 1) / 2 + 1;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    ll N, K;
    cin >> N >> K;
    ll count = K;
    for (int i = 1; i < N; ++i) {
        count *= (K - 1);
    }
    cout << count << endl;
}

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

template<class Iter> vector<int>Z_Algorithm(Iter a, Iter a_end) {
    int n = a_end - a;
    vector<int>z(n);
    int l = 0, r = 0;
    for (int i=1; i<n; i++) {
	if (i > r) {
	    l = r = i;
	    while (r<n && a[r-l] == a[r]) r++;
	    z[i] = r-l; r--;
	} else {
	    int k = i-l;
	    if (z[k] < r-i+1) z[i] = z[k];
	    else {
		l = i;
		while (r<n && a[r-l] == a[r]) r++;
		z[i] = r-l; r--;
	    }
	}
    }
    return z;
}

int N;
VI calc(char S[]) {
    VI Z = Z_Algorithm(S, S+N);
    VI hit(N+1);
    for (int i=1; i<N; i++) {
	for (int p=i; p+i<=N; p+=i) {
	    if (Z[p] >= i) hit[p+i] = 1;
	    else break;
	}
    }
    return hit;
}
char S[500011];
char R[500011];

void MAIN() {
    scanf("%s", S);
    N = strlen(S);

    if (count(S, S+N, S[0]) == N) {
	printf("%d\n", N);
	puts("1");
	return;
    }

    REP (i, N) R[N-1-i] = S[i];
    VI hs = calc(S);
    if (hs[N] == 0) {
	puts("1");
	puts("1");
	return;
    }

    VI hr = calc(R);

    int cnt = 0;
    for (int i=1; i<N; i++) {
	if (hs[i] == 0 && hr[N-i] == 0) {
	    cnt++;
	}
    }

    puts("2");
    printf("%d\n", cnt);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 7132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int N; cin >> N;
    vector<int> a(N+1), pos(N+1);
    for(int i=1; i<=N; ++i){
        cin >> a[i];
        pos[a[i]] = i;
    }
    
    ll ans = 0LL;
    set<int> se{0, N+1};

    
    for(int i=1; i<=N; ++i){
        int r = *(se.lower_bound(pos[i]));
        int l = *(--se.lower_bound(pos[i]));
        ans += (ll)i*(pos[i]-l)*(r-pos[i]);
        se.insert(pos[i]);
    }

    cout << ans << endl;    
}

Measured memory_bytes: 11136
#include<stdio.h>
int MAX(int a,int b){return a<b?b:a;} 
int main(){
  int r=0,i;
  char s[100010],c[100010];
  scanf("%s",s);
  for(i=0;s[i];i++){
    if(s[i]=='B')r=MAX(r-1,0);
    else c[r++]=s[i];
  }
  c[r]=0;
  printf("%s\n",c);
  return 0;
}


Measured memory_bytes: 128
import java.util.*


private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrintln: (String)->Unit = { msg -> System.err.println(msg) }
private val MOD = 1e9.toLong()+7
private val INF = Int.MAX_VALUE/2
private val LINF = Long.MAX_VALUE/2


class DfsVisitor(val egs: List<MutableList<Int>>) {
    fun oneStrokePath(start: Int): Int {
        val N = egs.size
        var vis = BooleanArray(N){false}
        var res = 0
        tailrec fun dfs(n: Int, x: Int) {
            if (n>=N-1) {
                if (vis.count { it } == vis.size) res++
                return
            }
            for (nx in egs[x]) {
                if (vis[nx]) continue
                vis[nx] = true
                dfs(n+1, nx)
                vis[nx] = false
            }
        }
        vis[start] = true
        dfs(0, start)
        return res
    }
}


fun solveC(eg :Array<ArrayList<Int>>): Int {
    val dfs = DfsVisitor(eg.toList())
    return dfs.oneStrokePath(0)
}


fun main(args: Array<String>) {
    val (N,M) = readListInt()
    val eg = Array(N){ArrayList<Int>()}
    for(i in 0 until M) {
        val (a, b) = readListInt().map{it -1}
        eg[a].add(b)
        eg[b].add(a)
    }

    val ans = solveC(eg)

    println(ans)
}


Measured memory_bytes: 38200
import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    m1,d1=mis()
    m2,d2=mis()
    if m2-m1==1 or (m1==12 and m2==1) :
        print(1)
    else:
        print(0)


if __name__ == "__main__":
    main()

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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long int ll;
typedef unsigned long long int ull;
#define inf INT_MAX
#define minf INT_MIN
#define watch(x)	cout<<(#x)<<"=>"<<x<<'\n';
#define sz(a) (int)(a).size()
#define all(x) x.begin(),x.end()


ll ans;
int arr[300009];
vi vr;
void solve()
{
    string s;   cin>>s;
    char ch;
    for(int i = 0; s[i] != '\0'; ++i)
        ch = s[i];
    if(ch =='s')
        s += "es";
    else
        s += "s";
    cout<<s;

    cout<<'\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int testc;  testc = 1;
    for(int t = 0; t < testc; ++t){
        solve();
    }
    return 0;
}

	//Sat 19 Sep 2020 05:30:10 PM IST


		/***astrainL3gi0N***/


Measured memory_bytes: 3652
L = input()
ll = len(L)
MOD = 10**9 + 7
#[*2 if 1][*1 if 1][*3]

comb = 1
ans = 0
for i, l in enumerate(L):
  if l == '0':
    continue
  ans += comb * pow(3, ll - i - 1, MOD)
  
  comb *= 2
  comb %= MOD

ans += comb
ans %= MOD
print(ans)



Measured memory_bytes: 9228
def main():
    from collections import deque
    H, W = (int(i) for i in input().split())
    c = [input() for j in range(H)]
    st = [(h, w) for h in range(H) for w in range(W)]  # H*W個

    def bfs(sy, sx):
        que = deque()
        dist[sy][sx] = 0
        que.append((sy, sx))
        d = ((1, 0), (0, 1), (-1, 0), (0, -1))
        while que:
            uy, ux = que.popleft()
            for dy, dx in d:
                next_y = uy + dy
                next_x = ux + dx
                if not(0 <= next_y < H and 0 <= next_x < W):
                    continue
                if dist[next_y][next_x] != -1:
                    continue
                if c[next_y][next_x] == '#':
                    continue
                dist[next_y][next_x] = dist[uy][ux] + 1
                que.append((next_y, next_x))

    ans = 0
    for s in st:
        dist = [[-1]*W for h in range(H)]
        if c[s[0]][s[1]] == "#":
            continue
        bfs(*s)
        for t in st:
            if s == t or c[t[0]][t[1]] == "#":
                continue
            ans = max(ans, dist[t[0]][t[1]])
    print(ans)


if __name__ == '__main__':
    main()


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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

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

    n--;
    k--;

    cout << ( n+k-1)/k;
    nl;

    return 0;
}




Measured memory_bytes: 3624
package main

import (
	"fmt"
)

func main() {
	n := SingleInt()

	points := map[int]map[int]int{}
	for i := 1; i <= 2; i++ {
		points[i] = map[int]int{}
		ps := ScanNums(n)
		for idx, item := range ps {
			points[i][idx+1] = item
		}
	}

	line := 1
	row := 1
	max := points[line][row]
	line++
	max += points[line][row]
	for i := 1; i < n; i++ {
		max += points[line][row+i]
	}

	for i := 2; i < n; i++ {
		line := 1
		c := points[line][row]
		for row := 2; row <= n; row++ {
			if i == row {
				c += points[line][row]
				line++
				c += points[line][row]
				continue
			}
			c += points[line][row]
		}
		if c > max {
			max = c
		}
	}

	fmt.Printf("%v\n", max)
}

func SingleInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func ScanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}


Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, M;
  cin>>N>>M;
  vector<vector<int> > edge(N);
  int a, b;
  for(int i=0;i<M;++i) {
    cin>>a>>b;
    a--;
    b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  for(int i=0;i<N;++i) cout<<edge[i].size()<<endl;
}



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

int digit_sum(int n) {
  int digit;
  int ans = 0;
  while(n) {
    digit = n % 10;
    ans += digit;
    n /= 10;
  }
  return ans;
}

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

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

int main() {
  string s;
  cin >> s;
  sort(s.begin(),s.end());
  for(int i=0; i<s.length()-1; i++) {
    if(s[i]==s[i+1]) {
      cout << "no";
      return 0;
    }
  }
  cout << "yes";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,wx,i,a=0,b=0,min=100000000;
  vector<int> w;
  cin >> n;
  for (i=0;i<n;i++){
    cin >> wx;
    w.push_back(wx);
    b+=wx;
  }
  for (i=0;i<n-1;i++){
    a+=w.at(i);
    b-=w.at(i);
    if (min>abs(b-a)) min=abs(b-a);
  }
  cout << min << endl;
  return 0;
}

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

long gcd(long i,long j){

  long counter = i;

  if(i == 0)counter = j;
  //if(j == 0)counter = i;
  if(i != 0 && j != 0){

    if(i > j)swap(i,j);

    long r = j % i;
 
    while(r != 0){
        j = i;
        i = r;
        r = j % i;
    }    
            counter = i;
  }
  
    return counter;
}

int main(){
  int N;
  cin >> N;
  vector<long> A(N);
  vector<long> begin(N);
  vector<long> end(N + 1);

  long counter;
  long counter_max = 0;

  begin[0] = 0;
  end[N] = 0;
 
  for(int i = 0;i < N;i++){
    cin >> A[i];
  }

  for(int i = 1;i < N;i++){
    begin[i] = gcd(begin[i - 1],A[i - 1]);
  }
 
  for(int i = N - 1;i > 0;i--){
    end[i] = gcd(end[i + 1],A[i]);
  }

  for(int i = 0;i < N;i++){
  //  cout << begin[i] << end[i + 1] << gcd(begin[i],end[i + 1]) << endl;
    counter_max = max(counter_max,gcd(begin[i],end[i + 1]));
  }

  cout << counter_max << endl;
}


Measured memory_bytes: 2560
using System;
using System.Linq;

namespace AOJ000
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var a = int.Parse(str.Split(' ')[0]);
            var b = int.Parse(str.Split(' ')[1]);
            var c = int.Parse(str.Split(' ')[2]);

            if (a < b)
            {
                if (b < c)
                {
                    Console.WriteLine("Yes");
                    Environment.Exit(0);
                }
            }
            Console.WriteLine("No");
        }
    }
}

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

int main(){
	int h,w;
	cin>>h>>w;
	vector<vector<int>> a(h,vector<int>(w));
	char temp;
	queue<pair<int,int>> q;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin>>temp;
			if (temp=='#') {
				a[i][j]=1;
				q.push(make_pair(i,j));
			}else {
				a[i][j]=0;
			}
		}
	}
	int task;
	int x,y;
	int ans=0;
	while (q.size()>0) {
		task=q.size();
		for (int i = 0; i < task; i++) {
			x=q.front().first;
			y=q.front().second;
			//left
			if (x-1>=0) {
				if (a[x-1][y]==0) {
					a[x-1][y]=1;
					q.push(make_pair(x-1,y));
				}
			}
			//right
			if (x+1<h) {
				if (a[x+1][y]==0) {
					a[x+1][y]=1;
					q.push(make_pair(x+1,y));
				}
			}
			//up
			if (y-1>=0) {
				if (a[x][y-1]==0) {
					a[x][y-1]=1;
					q.push(make_pair(x,y-1));
				}
			}
			//down
			if (y+1<w) {
				if (a[x][y+1]==0) {
					a[x][y+1]=1;
					q.push(make_pair(x,y+1));
				}
			}
			q.pop();
		}
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				//cout<<a[i][j]<<" ";
			}
			//cout<<endl;
		}
		//cout<<endl;
		ans++;
	}
	cout<<ans-1<<endl;
}

Measured memory_bytes: 12432
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 55;
const int MAXM = 25;
const int MAXK = 16;
const int MAXQ = 200010;

int n, m, par[MAXN], cntEdge, f[MAXN][MAXN];
vector<int> a[MAXN];
vector<II> edges[MAXM];
II b[MAXM];
bool appear[MAXN];

void dfs(int u, int p) {
    FOR(i,0,SZ(a[u])-1) {
        int v = a[u][i];
        if (v == p) continue;
        par[v] = u;
        cntEdge++;
        f[u][v] = cntEdge;
        dfs(v, u);
    }
}

void getPath(int k, int u, int v) {
    vector<int> pU, pV;
    int U = u;
    while (1) {
        pU.emplace_back(U);
        if (U == 1) break;
        U = par[U];
    }
    reverse(ALL(pU));
    int V = v;
    while (1) {
        pV.emplace_back(V);
        if (V == 1) break;
        V = par[V];
    }
    reverse(ALL(pV));

    int i = 0;
    while (i < SZ(pU) && i < SZ(pV)) {
        if (pU[i] == pV[i]) i++;
        else break;
    }

    FOR(j,i,SZ(pU)-1) edges[k].emplace_back(II(pU[j-1], pU[j]));
    FOR(j,i,SZ(pV)-1) edges[k].emplace_back(II(pV[j-1], pV[j]));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    FOR(i,1,n-1) {
        int u, v;
        cin >> u >> v;
        a[u].emplace_back(v);
        a[v].emplace_back(u);
    }
    cin >> m;
    FOR(i,0,m-1) cin >> b[i].FI >> b[i].SE;

    dfs(1, 0);
    FOR(i,0,m-1) getPath(i, b[i].FI, b[i].SE);

    ll res = (1LL<<(n-1));
    FOR(mask,1,(1<<m)-1) {
        int cntBit = 0;
        ll p = 0;
        int dem = n-1;
        FOR(i,1,cntEdge) appear[i] = false;
        FOR(i,0,m-1)
            if (mask & (1<<i)) {
                cntBit++;
                FOR(j,0,SZ(edges[i])-1) appear[f[edges[i][j].FI][edges[i][j].SE]] = true;
            }
        FOR(i,1,cntEdge) dem -= appear[i];
        p = (1LL << dem);
        if (cntBit % 2) res -= p;
        else res += p;
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
typedef long long ll;
typedef pair<int,int>P;
vector<P>vec;

int n,t;
int a[3009],b[3009];
int memo[3009][6009];

int dp(int k,int sum){
  if(memo[k][sum]!=-1)return memo[k][sum];
  if(k==n)return 0;
  int rec=dp(k+1,sum);
  if(sum<t){
    rec=max(rec,dp(k+1,sum+a[k])+b[k]);
  }
  return memo[k][sum]=rec;
}

int main(){
  memset(memo,-1,sizeof(memo));
  cin>>n>>t;
  rep(i,n){
    cin>>a[i]>>b[i];
    vec.push_back(P(a[i],b[i]));
  }
  sort(vec.begin(),vec.end());
  rep(i,n){
    a[i]=vec[i].fi;
    b[i]=vec[i].se;
  }
  
  cout<<dp(0,0)<<endl;

  return(0);
}


Measured memory_bytes: 71040
n = int(input())
li = list(map(int,input().split()))
for i in range(n):
  li[i] -= i+1
li.sort()
if n%2 == 0:
  print(sum(li[int(n/2):])-sum(li[:int(n/2)]))
else:
  tmp = int((n-1)/2)
  print(sum(li[tmp+1:])-sum(li[:tmp]))

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

using namespace std;

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

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

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

map<long long, int> prime_factor(long long n){
    map<long long, int> ret;
    for(long long i=2; i*i<=n; i++){
        while(n%i==0){
            ret[i]++;
            n /= i;
        }
    }
    if(n!=1) ret[n] = 1;
    return ret;
}

int main(){
    long long N;
    bool one=0;
    cin >> N;
    cout << N << ":";
    for(auto p : prime_factor(N)){
        while(p.second--) cout << " " << p.first;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3100
from collections import deque
from heapq import heappush,heappop
import re

def int_raw():
    return int(input())

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int, ss_raw()))

INF = 1<<29


def main():
    r,D,x  = ints_raw()
    for _ in range(10):
        x = r*x-D
        print (x)
            
main()


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

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

    sort(d.begin(), d.end());

    int cnt = 1;
    for(int i=0; i<n-1; i++)
    {
        if(d[i+1]>d[i]) cnt++;
    }     

    cout << cnt;
}


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

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗する

main(){
    int n;
	for (int i=0;i<10000;i++){
	    cin >> n;
	    cout << "Case " << i+1 << ": " << n << endl;
	}
}



Measured memory_bytes: 3040
#include<cstdio>
int main(){
    int p[20];
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&p[i]);
    int ans=0;
    for(int i=1;i<n-1;i++){
        if(p[i-1]<p[i]&&p[i]<p[i+1]||p[i-1]>p[i]&&p[i]>p[i+1])ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
       int n;
       cin >> n;
       vector<int> v(n),freq(200008,0),ans(200008,0);
       for(int i=0;i<n;i++){
           cin >> v[i];
           freq[v[i]]++;
           ans[v[i]]=(freq[v[i]]*(freq[v[i]]-1))/2;
       }
       int sum=0;
       for(int i=0;i<200008;i++)
            sum+=ans[i];
        for(int i=0;i<n;i++){
            int p=sum-ans[v[i]]+((freq[v[i]]-1)*(freq[v[i]]-2))/2;
            cout << p << endl;
        }

}

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

int linearSearch( int s[], int nums, int t ){
	
	int i=0;
	while( s[i] != t )  //??????(s[s.size] ???t ?????\??£??????????????§????????????????????????for????????????????????????
		i++;
	return i != nums;
}

int main()
{
	int *s, *t;
	int nums, numt;
	cin>>nums;
	s=new int[nums+1];
	for( int i=0; i<nums; i++ ){
		cin>>s[i];
	}

	cin>>numt;
	t=new int[numt];
	for( int i=0; i<numt; i++ ){
		cin>>t[i];
	}


	int ans=0;

	for( int i=0; i<numt; i++ ){
		s[nums]=t[i];
		ans +=linearSearch(s, nums, t[i]);

	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1764
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define per(i,s,n) for(int i=n-1;i>=s;i--)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  int n;
  cin>>n;
  int k[n];
  int a;
  rep(i,n){
    cin>>a;
    a--;
    k[a]=i+1;
  }
  
  rep(i,n) cout<<k[i]<<endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n; cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];

  ll x2 = 0;
  REP(i,n) {
    if (i%2) x2 -= a[i];
    else x2 += a[i];
  }

  vector<int> ans(n);
  ans[0] = x2/2;
  REP(i,n-1) {
    ans[i+1] = a[i] - ans[i];
  }
  REP(i,n) ans[i] *= 2;
  REP(i,n) {
    if (i > 0) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3972
N,D=map(int,input().split())
X=[list(map(int, input().split())) for i in range(N)]
result = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        result += (sum((a - b) ** 2 for a, b in zip(X[i], X[j])) ** 0.5).is_integer()
print(result)

Measured memory_bytes: 3188
using System;

class Program
{
    static void Main(string[] args)
    {
        int[] pow2 = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
        string[] input = Console.ReadLine().Split(' ');
        int h = int.Parse(input[0]);
        int w = int.Parse(input[1]);
        int k = int.Parse(input[2]);
        int r = 0;
        char[,] board = new char[h,w];
        char[,] calcBoard = new char[h,w];

        for (int i = 0; i < h; i++)
        {
            char[] line = Console.ReadLine().ToCharArray();
            for (int j = 0; j < w; j++)
            {
                board[i, j] = line[j];
            }
        }


        for (int i = 0; i < pow2[h]; i++)
        {
            for (int j = 0; j < pow2[w]; j++)
            {
                bool[] ri = new bool[6];
                bool[] rj = new bool[6];

                for (int x = 0; x < h; x++)
                {
                    for (int y = 0; y < w; y++)
                    {
                        calcBoard[x, y] = board[x, y];
                    }
                }
                int count = 0;
                
                for (int ki = 0; ki < 6; ki++) ri[ki] = i / pow2[ki] % 2 == 1;
                for (int kj = 0; kj < 6; kj++) rj[kj] = j / pow2[kj] % 2 == 1;
                for (int a = 0; a < h; a++)
                {
                    for (int b = 0; b < w; b++)
                    {
                        if (ri[a] || rj[b])
                        {
                            calcBoard[a, b] = '@';
                        }


                        if (calcBoard[a, b] == '#')
                        {
                            count++;
                        }
                    }
                }

                if (count == k)
                {
                    r++;
                }
            }
        }
        
        Console.WriteLine(r);
    }
}


Measured memory_bytes: 18168
/*
 * Author : Sadi
 * Thu 09/07/2020
 * 17:30:37.90
 */
#include <iostream>
#include <cstdio>
#include <cmath>
#include <climits>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int n;
    cin >> n;
    cout << n * n * n << endl;
    return 0;
}


Measured memory_bytes: 3632
import kotlin.math.min

fun main() = abc167f()

@OptIn(ExperimentalStdlibApi::class)
fun abc167f() {
    data class Bracket(val lowestHeight: Int, val transition: Int)

    val n = readLine()!!.toInt()
    val brackets = (1..n).map {
        val s = readLine()!!
        var currHeight = 0
        var lowestHeight = 0
        for (c in s) {
            when (c) {
                '(' -> currHeight++
                else -> currHeight--
            }
            lowestHeight = min(lowestHeight, currHeight)
        }
        Bracket(lowestHeight, currHeight)
    }

    var currHeight = 0
    val (positives, negatives) = brackets.partition { it.transition >= 0 }

    fun simulate(list: List<Bracket>): Boolean {
        for ((lowestHeight, transition) in list) {
            if (currHeight + lowestHeight < 0) return false
            currHeight += transition
        }
        return true
    }

    val answer = if (simulate(positives.sortedByDescending { it.lowestHeight })
        && simulate(negatives.sortedBy { it.lowestHeight - it.transition })
        && currHeight == 0
    ) "Yes" else "No"

    println(answer)
}


Measured memory_bytes: 97848
s=input() #输入
if(s[0]==s[len(s)-1]): #头尾相等
    if(len(s) & 1): # x&1等价于x%2==1
        print('Second')
    else:
        print('First')
else:
    if(len(s) & 1): #头尾不相等
        print('First')
    else:
        print('Second')

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

int main() {
    int n;
    cin >> n;
    int a;
    rep(i,n) {
        cin >> a;
        if (a % 2 == 0) {
            if (a % 3 != 0 && a % 5 != 0) {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
}

Measured memory_bytes: 256