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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int main()
{
    string ok="Possible", ng="Impossible";

    int n;
    scanf(" %d", &n);
    vector<int> a(n);
    rep(i,n) scanf(" %d", &a[i]);

    if(n==2)
    {
        string ans=ng;
        if(a[0]==1 && a[1]==1) ans=ok;
        cout << ans << endl;
        return 0;
    }

    sort(all(a));
    int max_dist=a[n-1];
    int min_dist=max_dist/2+max_dist%2;

    vector<int> ct(n,0);
    rep(i,n) ++ct[a[i]];

    string ans=ok;
    for(int i=0; i<min_dist; ++i)
    {
        if(ct[i]>0) ans=ng;
    }
    if(ct[min_dist] != 1+max_dist%2) ans=ng;
    for(int i=min_dist+1; i<=max_dist; ++i)
    {
        if(ct[i]<2) ans=ng;
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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; }
using namespace std;

void bfs(vi &color, vector<vector<pair<ll, ll>>> &adj, ll node){
    for(auto p: adj[node]){
        // Already done
        if(color[p.first] != -1) continue;
        // Coloring
        (p.second%2 == 0) ? color[p.first] = color[node] : color[p.first] = color[node]^1;
        bfs(color, adj, p.first);
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    ll n; cin >> n;
    vi color(n, -1);        // -1:None 0:White 1:Black
    vector<vector<pair<ll, ll>>> adj(n, vector<pair<ll, ll>>());   // Adjacency list

    // Input
    rep(i, n-1){
        ll u, v, w;
        cin >> u >> v >> w;
        u--; v--; // 0-Based
        adj[u].push_back(make_pair(v, w));
        adj[v].push_back(make_pair(u, w));
    }
    
    // Coloring
    rep(i, n) if(color[i] == -1){
        color[i] = 0;
        bfs(color, adj, i);
    }

    // Output
    for(auto p: color) cout << p << endl;
}

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

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

    set<ll> s;
    rep(i, n) {
        ll a;
        cin >> a;
        if (s.find(a) != s.end())
            s.erase(a);
        else
            s.insert(a);
    }

    cout << s.size() << endl;
    return 0;
}


Measured memory_bytes: 4864
// B - Maximum Difference
#include <bits/stdc++.h>
using namespace std;

int main(){
	int n; cin>>n;
	int amin = INT_MAX, amax = 0;
	for(int i=0; i<n; ++i){
		int a; cin>>a;
		amin = min(amin, a);
		amax = max(amax, a);
	}
	cout<< abs(amax - amin) <<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;

int main() {
	string S;
	cin >> S;
	int cnt = 0;
	for (int i = 0; i < 4; i++) {
		if (S[i] == '2') cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;

struct unionFind{
    int* par;                       //親
    int* rank;                      //木の深さ
    int* scale;                     //木のサイズ
    unionFind(int n);
    ~unionFind();
    int find(int x);                //木の根を求める
    void unite(int x,int y);        //xとyの属する集合を併合
    bool same(int x,int y);         //xとyが同じ集合に属するか否か
    int size(int x);                //xの属する集合のサイズ
};

unionFind::unionFind(int n){
    par=new int[n];
    rank=new int[n];
    scale=new int[n];
    for(int i=0;i<n;i++){
        par[i]=i;
        rank[i]=0;
        scale[i]=1;
    }
}

unionFind::~unionFind(){
    delete[] par,rank,scale;
}

int unionFind::find(int x){
    if(par[x]==x) return x;
    return par[x]=find(par[x]);
}

void unionFind::unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(rank[x]<rank[y]){
        par[x]=y;
        scale[y]+=scale[x];
    }else{
        par[y]=x;
        scale[x]+=scale[y];
        if(rank[x]==rank[y]) rank[x]++;
    }
}

bool unionFind::same(int x,int y){
    return find(x)==find(y);
}

int unionFind::size(int x){
    x=find(x);
    return scale[x];
}

int N,M;
int a[2500],b[2500];

int main(){
    cin>>N>>M;
    rep(i,M) cin>>a[i]>>b[i];

    int ans=0;
    rep(i,M){
        unionFind uf(N+1);
        rep(j,M){
            if(i==j) continue;
            uf.unite(a[j],b[j]);
        }
        repn(j,N-1){
            if(!uf.same(j,j+1)){
                ans++;
                break;
            }
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let s = read::<String>().chars().collect::<Vec<char>>();
    let mut left = 0;
    let mut cnt = 0;
    for i in 0..n {
        if s[i] == '(' {
            cnt += 1;
        } else {
            cnt -= 1;
            if cnt < 0 {
                left += 1;
                cnt += 1;
            }
        }
    }
    for _ in 0..left {
        print!("(");
    }
    for i in 0..n {
        print!("{}", s[i]);
    }
    for _ in 0..cnt {
        print!(")");
    }
    println!("");
}


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

int main() {
	int a, v[20], c[20], s=0;
	cin >> a;
	for (int i = 0; i < a; i++) {
		cin >> v[i];
	}
	for (int j = 0; j < a; j++) {
		cin >> c[j];
	}
	for (int g = 0; g < a; g++) {
		if (v[g] > c[g]) {
			s += v[g] - c[g];
		}
	}
	cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M; cin >> N >> M;
  int H[N], A[M], B[M];
  for(int i = 0; i < N; i++) cin >> H[i];
  for(int i = 0; i < M; i++) cin >> A[i] >> B[i];
  int good[N] = {};
  for(int i = 0; i < M; i++){
    if(H[A[i] - 1] <= H[B[i] - 1] && good[A[i] - 1] == 0) good[A[i] - 1] = 1;
    if(H[A[i] - 1] >= H[B[i] - 1] && good[B[i] - 1] == 0) good[B[i] - 1] = 1;
  }
  int ans = N;
  for(int i = 0; i < N; i++) ans -= good[i];
  cout << ans;
  return 0;
}

Measured memory_bytes: 5188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  string s;
  cin>>s;
  bool ex=true;
  if(s[0]!='A')
    ex=false;
  int c=0,n=s.size();
  for(int i=2;i<n-1;i++){
    if(s[i]=='C'){
      c++;
    }
  }
  if(c!=1) ex=false;
  int cnt=0;
  rep(i,n){
    if(isupper(s[i]))
      cnt++;
  }
  if(cnt!=2){
    ex=false;
  }
  if(ex) cout<<"AC"<<endl;
  else cout<<"WA"<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
template <class T> void chmin(T& x, T y) { if (x > y) x = y; }
int main() {
    int N, M; cin >> N >> M;
    vector<int> A(M), B(M), dp(1 << 12, 1e9);
    for (int i = 0; i < M; i++) {
        int a, b; cin >> a >> b;
        A[i] = a;
        for (int j = 0; j < b; j++) {
            int c; cin >> c; c--;
            B[i] |= (1 << c);
        }
    }
    dp[0] = 0;
    for (int i = 0; i < (1 << N); i++) {
        for (int j = 0; j < M; j++) {
            chmin(dp[i | B[j]], dp[i] + A[j]);
        }
    }
    int ans = dp[(1 << N) - 1];
    if (ans == 1e9) ans = -1;
    cout << ans << endl;
    return 0;
}


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


void solve(long long A, long long B, long long C){
		std::cout << std::min({B/A,C}) << endl;
}

// Generated by 1.1.4 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 A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
//
// Binary Indexed Tree
//
// verified:
//   AOJ Course DSL_2_B Range Query - Range Sum Query (RSQ)
//     http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
//

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


template <class Abel> struct BIT {
    const Abel UNITY_SUM = 0;						// to be set
    vector<Abel> dat;
    
    /* [1, n] */
    BIT(int n) : dat(n + 1, UNITY_SUM) { }
    void init(int n) { dat.assign(n + 1, UNITY_SUM); }
    
    /* a is 1-indexed */
    inline void add(int a, Abel x) {
        for (int i = a; i < (int)dat.size(); i += i & -i)
            dat[i] = dat[i] + x;
    }
    
    /* [1, a], a is 1-indexed */
    inline Abel sum(int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i)
            res = res + dat[i];
        return res;
    }

    /* [a, b), a and b are 1-indexed */
    inline Abel sum(int a, int b) {
        return sum(b - 1) - sum(a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat.size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};



int main() {
    int N, Q; cin >> N >> Q;
    BIT<int> bit(N);
    for (int query = 0; query < Q; ++query) {
        int com, x, y; cin >> com >> x >> y;
        if (com == 0) bit.add(x, y);
        else cout << bit.sum(x, y+1) << endl;
    }
}



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

typedef long long ll;
const int N = 300005;

int n, A[N], S[N];

inline int read() {
	int x = 0, f = 0, ch = getchar();
	while (!isdigit(ch))
		f |= (ch == '-'), ch = getchar();
	while (isdigit(ch))
		x = x * 10 + ch - '0', ch = getchar();
	return f ? -x : x;
}

inline bool check(const int mid) {
	int v = 0;
	for (int i = 1; i < n; i += 2)
		if (S[i] - v >= mid)
			v = min(v, S[i + 1]);
	return S[n] - v >= mid;
}

int main() {
	n = read();
	int B = 0, W = 0;
	for (int i = 1; i <= n; i++)
	{
		A[i] = read();
		if (i & 1)
			B += A[i], S[i] = S[i - 1] + A[i];
		else
			W += A[i], S[i] = S[i - 1] - A[i];
	}
	if (n & 1)
	{
		int l = -N * 1000, r = N * 1000, mid, ans = 0;
		while (l <= r)
		{
			mid = (l + r) >> 1;
			if (check(mid))
				ans = mid + W, l = mid + 1;
			else
				r = mid - 1;
		}
		ans = max(ans, B);
		printf("%d %d\n", ans, B + W - ans);
	}
	else
		printf("%d %d\n", max(B, W), min(B, W));
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>

int n, M[101][101], isVisited[101], stampIN[101], stampOUT[101];
int T = 1;

void visit(int ux){
	stampIN[ux] = T++;
	isVisited[ux] = 1;
	for (int vx = 0; vx < n; vx++){
		if( M[ux][vx] == 1 && isVisited[vx] == 0 ) 
			visit(vx);
	}
	stampOUT[ux] = T++;  
};

int main(){
	int k,u,v;
	scanf("%d\n",&n);
	for (int ix = 0; ix < n; ix++)
		for (int jx = 0; jx < n; jx++)
			M[ix][jx] = 0;
	for (int jx = 0; jx < n; jx++)
			isVisited[jx] = 0;		
		
	for (int ix = 0; ix < n; ix++){
		scanf("%d%d",&u,&k);
		for (int jx = 0 ; jx < k;jx++){
			scanf("%d",&v);
			M[u-1][v-1]=1;      
		}
	}
	for (int ix = 0; ix < n; ix++)
		if( isVisited[ix] == 0 ) visit(ix);
	for (int ix = 0; ix < n; ix++)
		printf("%d %d %d\n",ix+1,stampIN[ix],stampOUT[ix]);
	return 0;
}


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

using namespace std;

int main(){
	char str[3];
	int res = 700;
	scanf("%s", str);
	for(int i=0; i<3; ++i) if(str[i] == 'o') res += 100;
	printf("%d\n", 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 rep2(i, x, n) for(int i = x; i < n; i++)

int main(){
    int N;
    cin >> N;
    int A[N], B[N], C[N-1];
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N-1) cin >> C[i];
    int res = 0;
    rep(i, N){
        res += B[A[i]-1];
        if(i > 0){
            if(A[i] == A[i-1]+1){
                res += C[A[i-1]-1];
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ull unsigned long long
#define ll long long
#define pb push_back
#define mp make_pair
#define y1 my_y1
#define fi first
#define se second
#define lcm mylcm
 
using namespace std;
 
const ll mod = 998244353;
const ll inf = 2e9;
const int N = 1e5 + 5;

ll n, h[N], dp[N], k;

int main () {
	//freopen("a.out", "w", stdout);
    cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> h[i];
		dp[i] = inf;
	}
	dp[1] = 0;
	for (int i = 2; i <= n; i++) {
		for (int j = 1; j <= k; j++) {
			if (i - j > 0) dp[i] = min(dp[i - j] + abs(h[i - j] - h[i]), dp[i]);
		}
	}
	cout << dp[n];
	return 0;
}

Measured memory_bytes: 1792
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
typedef long long ll;
#define clr(x,a) memset(x,a,sizeof(x))
#define sz(x) (int)x.size()
#define see(x) cerr<<#x<<" "<<x<<endl
#define se(x) cerr<<" "<<x
#define pb push_back
#define mp make_pair
#define rep(i,l,r) for (long long i=l;i<=r;i++)
using namespace std;
ll n,can,a[101000];
int main(){
    cin>>n;
    rep(i,1,n) scanf("%lld",&a[i]);
    sort(a+1,a+1+n);
    a[0]=-1;can=0;
    rep(i,1,n){
        if (a[i]<=can+1) can+=a[i];else {
            cout<<can+1<<endl;
            return 0;
        }
    }
    cout<<can+1<<endl;
    return 0;
}

Measured memory_bytes: 1336
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    //final List<Long> list2 = new ArrayList<>();

    int n = sc.nextInt();
    int s1 = 0;
    int s2 = 0;
    int min = 10001;

    for(int i = 0; i < n; i++){
        list.add(sc.nextInt());
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n ; j++){
            if(j <= i){
                s1 += list.get(j);
            }else{
                s2 += list.get(j);
            }
        }

        if(min >= Math.abs(s1 - s2)){
            min = Math.abs(s1 - s2); 
        }

        s1 = 0;
        s2 = 0;
    }

    System.out.println(min);

    



    



   
    





}
}

Measured memory_bytes: 35816
#include<bits/stdc++.h>
using namespace std;
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vec             vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define no_of_test(x)   int x; cin>>x; while(x--)

const int mod = 1e9 + 7;
void very_fast()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int gcd(int a, int b)
{
	if (b == 0) return a;
	return gcd(b, a % b);
}
int binary_exponentation(int a, int b)
{
	int ret = 1;
	while (b)
	{
		if (b & 1) ret = (ret * a) % mod;
		b >>= 1;
		a = (a * a) % mod;
	}
	return ret;
}

int32_t main()
{
	very_fast();
	//no_of_test(x)
	{
		int n;
		cin >> n;
		int a[n];
		for (int i = 0; i < n; i++) cin >> a[i];
		int maxi = a[0], sum = 0;
		for (int i = 1; i < n; i++)
		{
			if (a[i] > maxi)
			{
				maxi = a[i];

			}
			else
			{
				sum += abs(a[i] - maxi);
			}
		}
		cout << sum << endl;
	}
	return 0;
}


Measured memory_bytes: 5176
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>

using namespace std;


int main() {
	
	long long int a, b, c;
	cin >> a >> b >> c;
	for (int i = 1; 1000000000 > (i*a)*i*a; i++){
		if ((i*a) % b == c) {
			cout << "YES" << endl;
			return 0;

		}

	}
	cout << "NO" << endl;
	return 0;
	
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
int main(void){
long double a,b,c;
cin >> a >> b >> c;
long double eps = 1.0E-14;
if(sqrt(a) + sqrt(b) + eps < sqrt(c)){
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}


Measured memory_bytes: 256
//...Bismillahir Rahmanir Rahim...
// Code by    Asad Bin Saber
// 14 06 2020

#include <bits/stdc++.h>

using namespace std;

// typedefs...
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;

// constants...
const double PI = acos(-1);

// defines...
#define MP make_pair
#define PB push_back
#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sl(a) scanf("%lld", &a)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)

int gcd(int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll lcm(ll a, ll b)
{
    return (a*b/gcd(a, b));
}
ll comb(ll a, ll b)
{
    ll x = max(a-b, b), ans=1;

    for(ll K=a, L=1; K>=x+1; K--, L++){
        ans *= K;
        ans /= L;
    }

    return ans;
}


void bruce()
{
    //cout << "\nExpected answer:\n";
    
    //if(x==1 && y==2) cout << "Yes\n";
    //else if(x*4<=y || x*2>=y) cout << "No\n";
    //else cout << "Yes\n";
    //cout << "\nAnswer recieved:\n";
}

void task()
{
    //code here...
    int x, y;

    cin >> x >> y;

    if(x==1 && (y==2 || y==4)) cout << "Yes\n";
    else{
        for(int K=0; K<=x; K++){
            if(2*(x-K)==y){
                cout << "Yes\n";
                return;
            }
            y -= 4;
        }
        cout << "No\n";
    }
}

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    task();

    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <string.h>
 
int main(void) {
    char str[201], tmp[101];
    char p[101];
    int slen, plen;
    int i, j, flag;
     
    scanf("%s %s", str, p);
     
    strcpy(tmp, str);
    strcat(str, tmp);
     
    slen = strlen(str);
    plen = strlen(p);
     
    flag = 0;
    for (i = 0; i < slen - plen; i++) {
        if (strncmp(&str[i], p, plen) == 0) flag = 1;
    }
     
    if (flag) puts("Yes");
    else puts("No");
     
    return 0;
}


Measured memory_bytes: 2148
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	p := make([]int, 0, 0)

	for i := 2; i <= n; i++ {
		tmp := true
		for j := 2; j * j <= i; j++ {
			if i % j == 0 {
				tmp = false
				break
			}
		}
		if tmp {
			p = append(p, i)
		}
	}

	l := len(p)
	a := make([]int, l, l)

	for i := 0; i < l; i++ {
		c := 0
		for d := p[i]; d < n; d *= p[i] {
			c += n / d
		}
		a[i] = c
	}

	answer := 0

	for i := 0; i < l; i++ {
		if a[i] >= 75 - 1 {
			answer++
		}
	}

	for i := 0; i < l; i++ {
		for j := 0; j < l; j++ {
			if (i == j) {
				continue
			}
			if a[i] >= 3 - 1 && a[j] >= 25 - 1 {
				answer++
			}
		}
	}

	for i := 0; i < l; i++ {
		for j := 0; j < l; j++ {
			if (i == j) {
				continue
			}
			if a[i] >= 5 - 1 && a[j] >= 15 - 1 {
				answer++
			}
		}
	}

	for i := 0; i < l; i++ {
		for j := 0; j < l; j++ {
			for k := j + 1; k < l; k++ {
				if (i == j || i == k) {
					continue
				}
				if a[i] >= 3 - 1 && a[j] >= 5 - 1 && a[k] >= 5 - 1 {
					answer++
				}	
			}
		}
	}

	fmt.Println(answer)
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
string s;
int l,i,j,k,piao[2];
int main(){

	cin>>s;
	l=s.size();
	for(i=0;i<l;i++){
	if(s[i]=='C')j=1;
	if(s[i]=='F'&&j==1){
		puts("Yes");
		return 0;
	}
	}
	cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int N, W;
int v[110], w[110];
int dp[110][100100];

int main() {
    cin >> N >> W;
    for (int i = 0; i < N; i++) cin >> v[i] >> w[i];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            if (j < w[i]) {
                dp[i+1][j] = dp[i][j];
            } else {
                dp[i+1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
            }
        }
    }
    cout << dp[N][W] << endl;
}


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

using namespace std;

const long long INF = 2e9 + 3;
const int N = 1e3 + 3;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;

const double PI = acos(-1);

int n, m;
char a[N][N];
pair<int, int> st, en;
vector<char> used(N * N, 0);
set<int> gr[N * N];
int dd[4][2] = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}};

auto h = [] (pair<int, int> x) { return x.first * 1000 + x.second; };
auto p = [] (int x) { return make_pair(x / 1000, x % 1000); };
auto valid = [] (pair<int, int> x) { return x.first >= 0 && x.first < n && x.second >= 0 && x.second < m &&
                                     a[x.first][x.second] != '#'; };

int par[N * N], rnk[N * N];

int find(int v) {
    if (v == par[v])
        return v;
    return par[v] = find(par[v]);
}

void unite(int x, int y) {
    x = find(x), y = find(y);
    if (x != y) {
        if (rnk[x] < rnk[y])
            swap(x, y);
        par[y] = x;
        rnk[x] == rnk[y] ? rnk[x]++ : 1;
    }
}

void join(int cur) {
    used[cur] = 1;
    for (int k = 0; k < 4; k++) {
        auto to = make_pair(p(cur).first + dd[k][0], p(cur).second + dd[k][1]);
        if (valid(to) && !used[h(to)]) {
            unite(cur, h(to));
            join(h(to));
        }
    }
}

void bfs(int start) {
    queue<pair<int, int>> q;
    q.push({start, 0});
    used[start] = 1;
    while (!q.empty()) {
        int cur = q.front().first, lng = q.front().second;
        q.pop();
        if (cur == find(h(en))) {
            cout << lng;
            exit(0);
        }
        for (int to : gr[cur]) {
            if (!used[to]) {
                used[to] = 1;
                q.push({to, lng + 1});
            }
        }
    }
}

void solve() {
    cin >> n >> m >> st.first >> st.second >> en.first >> en.second;
    st.first--, st.second--, en.first--, en.second--;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
            if (a[i][j] == '.')
                par[h({i, j})] = h({i, j});
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (valid({i, j}) && !used[h({i, j})]) {
                join(h({i, j}));
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == '#')
                continue;
            for (int dx = -2; dx <= 2; dx++) {
                for (int dy = -2; dy <= 2; dy++) {
                    auto to = make_pair(i + dx, j + dy);
                    if (!valid(to))
                        continue;
                    int u = h({i, j}), v = h(to);
                    int l1 = find(u), l2 = find(v);
                    if (l1 != l2) {
                        gr[l1].insert(l2);
                        gr[l2].insert(l1);
                    }
                }
            }
        }
    }
    used.assign(N * N, 0);
    bfs(find(h(st)));
    cout << -1;
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t;
    t = 1;
    while (t--) {
        solve();
    }
}

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

typedef long long ll;
typedef pair<int,int> P;
#define INF (int)(1e9)
#define EPS (1e-7)
#define MOD ((ll)1e9+7)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i = 1;i <= (int)(n); i++)
#define FOR(i,k,n) for(int i = (k); i < (int)(n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>


/*--------------------------------------------*/
/*ll factorial(ll);
void list_Prime(ll);
ll divisor(ll);
ll lcm(ll, ll);//AとBの最小公倍数
ll gcd(ll,ll);

int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
*/
/*--------------------------------------------*/
/*--------------------------------------------*/
/*
ll factorial(ll n){
    if(n==1)return 1;
    return n*factorial(n-1);
}
ll lcm(ll A, ll B) {//最小公倍数
    ll a = A;
    ll b = B;
    if (a == 0 || b == 0) { return 0; }
    if (a < 0) { a = -a; }
    if (b < 0) { b = -b; }
    while (b > 0) {
        ll c = a % b;
        a = b;
        b = c;
    }
    return A/a*B;
}

ll gcd(ll a,ll b){
    while (b != 0) {
        int t = b;
        b = a % b;
        a = t;
    }
    return a;
}


void list_Prime(ll n){//n以下の素数を全て見つける
    ll Limit=(int)sqrt((double)n);
    for(ll i=2;i<=n;i++)prime[i]=1;//最初はみんな素数かも
    //素数の整数倍を消していく(ルートnまで)
    for(ll i=2;i<=Limit;i++){
        if(prime[i]){
            for(ll j=2*i;j<=n;j++){
                if(j%i==0){
                    prime[j]=0;                
                }
            }
        }
    }
}

ll divisor(ll n){
    for(ll i=2;i<=n;i++){
        ll d=1;
        ll tmp=i;
        while(tmp>0){
            d++;
            while(tmp%d==0){
                prime[i]++;
                tmp/=i;
            }
        }
    }
    ll sum=1;
    for(ll i=2;;i<=n;i++){
        sum*=(prime[i]+1)/MOD;
    }    
    cout<<"sum="<<sum<<endl;

    return sum%MOD;
}
*/
/*--------------------------------------------*/
const int N=100010;
int main(){
    int n;cin>>n;
    vecll a(n);
    vecll b(n);
    vecll c(n);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    rep(i,n)cin>>c[i];
    //rep(i,n)cout<<b[i]<<endl;
    sort(ALL(a));sort(ALL(b));sort(ALL(c));
    //rep(i,n)cout<<b[i]<<endl;
    ll cnt=0;
    rep(i,n){
        ll temp=b[i];
        //printf("temp=%d\n",temp);
        ll x=lower_bound(ALL(a),temp)-a.begin();
        //printf("x=%d\n",x);
        ll y=n-(upper_bound(ALL(c),temp)-c.begin());//tempを含めてはならないのでupper_bound関数
        //printf("y=%d\n",y);
        cnt+=x*y;
        //printf("cnt=%lld\n",cnt);
    }
    cout<<cnt<<endl;
}



Measured memory_bytes: 2560
import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    double a = sc.nextDouble();
    int aInt = (int) a;
    
    double sqrt = Math.sqrt(a);
    
    double cbrt = Math.cbrt(a);
    
    int ans = 0;
    
    int s = (int) sqrt;
    int s1 = s*s;
    
    int c = (int) cbrt;
    int c1 = c*c*c;
    
    if (s1 < c1){
      ans = c1;
    } else {
      ans = s1;
    }
    
    if (ans < 32 && 32 <= aInt){
      ans = 32;
    } else if (ans < 128 && 128 <= aInt){
      ans = 128;
    } else if (ans < 243 && 243 <= aInt){
      ans = 243;
    }
    
    System.out.println(ans);
    
  }
}

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

template<unsigned long N>
struct precalc{
    unsigned long sz, val[N + 1];
    constexpr precalc() : sz(N), val() {
        for(unsigned long i{1}; i <= N; ++i)val[i] = i;
        for(unsigned long i{2}; i <= N; ++i)if(val[i] == i)for(unsigned long j{i}; j <= N; j += i)(val[j] /= i) *= (i - 1);
        for(unsigned long i{1}; i <= N; ++i)val[i] = (val[i] + val[i - 1]) % 1000000007;
    }
};

constexpr auto v = precalc<100000>{};

int main(){
    using namespace std;
    constexpr unsigned long MOD = 1000000007;
    unsigned long N, K;
    cin >> N >> K;
    const auto& modpow = [](unsigned long a, unsigned long n, unsigned long b = 1) -> unsigned long {
        unsigned long r{b % MOD};
        while(n){
            if(n & 1)(r *= a) %= MOD;
            (a *= a) %= MOD;
            n >>= 1;
        }
        return r;
    };
    unsigned long ans{0};
    for(unsigned long i{K}, p{0}; i; ){
        auto t = K / i;
        auto k = modpow(t, N);
        ans += (k + p) * v.val[i] % MOD;
        i = K / (t + 1);
        p = MOD - k;
    }
    cout << ans % MOD << endl;
    return 0;
}

Measured memory_bytes: 4032
import bisect
import sys
sys.setrecursionlimit(10000)
a=[]
def f(a,bin,n):
    if bin>n:return
    if bin:a+=[bin]
    f(a,bin*10+2,n)
    f(a,bin*10+8,n)

def g(n,p):
    m=-1<<20
    x=bisect.bisect_left(a,n)
    if x!=len(a) and a[x]==n:m=1
    if a[p]**2>n:return m
    if n%a[p]==0:m=g(n//a[p],p)+1
    return max(m,g(n,p+1))

n=int(input())
if n&1:print(-1);exit()
f(a,0,n)
a=sorted(a)+[10**20]
b=g(n,0)
if b<0:b=-1
print(b)

Measured memory_bytes: 40680
"use strict";

function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0].split(" ")[0], 10);
  var M = parseInt(input[0].split(" ")[1], 10);
  var k = [];

  for (var index = 1; index <= M; index++) {
    var element = input[index].split(" ").map(function (v) {
      return parseInt(v, 10);
    });
    k.push(element);
  }

  var p = input[M + 1].split(" ").map(function (v) {
    return parseInt(v, 10);
  });
  var init = [];
  var combs = [init];

  for (var _index = 0; _index < N; _index++) {
    combs = comb(combs);
  }

  var result = 0; // each switch cases

  for (var _index2 = 0; _index2 < combs.length; _index2++) {
    var switches = combs[_index2];
    var match = 0; // each lamp        

    for (var m = 0; m < M; m++) {
      var sum = 0; // each connected switch

      for (var s = 1; s <= k[m][0]; s++) {
        sum += switches[k[m][s] - 1];
      } //console.log("sum, p[m]", sum, p[m]);


      if (sum % 2 != p[m]) {
        break;
      }

      match++;
    } //console.log(match);


    if (match == M) {
      result++;
    }
  }

  console.log(result);
}

function comb(combs) {
  var result = [];

  for (var index = 0; index < combs.length; index++) {
    var element = combs[index];
    result.push(element.concat(0));
    result.push(element.concat(1));
  }

  return result;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
    int n,m;
    cin >> n >> m;
    int l[m]={};
    int r[m]={};
    int lmax=0,rmin=1000000;
    for(int i=0;i<m;i++){
        cin >>l[i] >> r[i];
        lmax=max(l[i],lmax);
        rmin=min(r[i],rmin);
    }
    cout << max(0,rmin-lmax+1);
}


Measured memory_bytes: 1024
S = input()
T = input()
m = len(S)
n = len(T)
dp = [[0]*(n+1) for _ in range(m+1)]
for i in range(1, m+1):
    for j in range(1, n+1):
        if S[i-1] == T[j-1]:
            dp[i][j] = max(dp[i-1][j-1]+1, dp[i][j-1], dp[i-1][j])
        else:
            dp[i][j] = max(dp[i][j-1], dp[i-1][j])

# print(dp)
i, j = m, n
ans = ''
while dp[i][j] > 0:
    if S[i-1] == T[j-1]:
        ans += S[i-1]
        i -= 1
        j -= 1
    elif dp[i-1][j] == dp[i][j]:
        i -= 1
    else:
        j -= 1
ans = ans[::-1]
print(ans)


Measured memory_bytes: 144480
s = input()
 
res = [0] * len(s)
cnt_r = 0
cnt_l = 0
curr = "R"
last_idx = 0
 
for idx, char in enumerate(s):
    if curr == "R":
        if char == "R":
            cnt_r += 1
            #continue
        else:
            res[idx] += cnt_r // 2
            res[idx - 1] += (cnt_r - cnt_r // 2)
            last_idx = idx
            curr = "L"
            cnt_r = 0
            cnt_l = 1
            #continue
    else:
        if char == "L":
            cnt_l += 1
            #continue
        else:
            res[last_idx - 1] += cnt_l // 2
            res[last_idx] += cnt_l - (cnt_l // 2)
            curr = "R"
            cnt_l = 0
            cnt_r = 1
 
res[last_idx - 1] += cnt_l // 2
res[last_idx] += cnt_l - (cnt_l // 2)
 
print(*res)

Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define mod 1000000007
ll fact[50];
ll power(ll a,ll b,ll c){
  ll ans=1;
  while(b){
    if(b&1){
      ans=ans*a%c;
    }
    a=a*a%c;
    b=b/2;
  }
  return ans;
}
ll ncr(ll n,ll r){
    if(r>n)return 0;
    if(r==n)return 1;
    ll z=fact[n];
    z=z*power(fact[r],mod-2,mod)%mod;
    z=z*power(fact[n-r],mod-2,mod)%mod;
    return z;
}
int main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int a,b,c; cin>>a>>b>>c;
        swap(a,b);
        swap(a,c);
        cout<<a<<" "<<b<<" "<<c;
        return 0;
}


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

bool CanMakeTriangle(int a, int b, int c) {
  return (a < b + c) && (b < c + a) && (c < a + b);
}

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

  int n;
  cin >> n;
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  sort(l.begin(), l.end());

  ll ans = 0;
  for (int i = 0; i < n - 2; ++i) {
    int a = l[i];
    for (int j = i + 1; j < n - 1; ++j) {
      int b = l[j];
      int min_c = max(a - b, b - a) + 1;
      int max_c = a + b - 1;
      auto left = lower_bound(l.begin() + j + 1, l.end(), min_c);
      if (left == l.end()) {
        continue;
      }
      auto right = upper_bound(l.begin() + j + 1, l.end(), max_c);
      auto d = distance(left, right);
      ans += d;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main()
{
    auto xs=vector<int>(3);
    cin >> xs[0] >> xs[1] >> xs[2];
    sort(xs.begin(), xs.end());
    int d02=xs[2]-xs[0], d12=xs[2]-xs[1];
    int res=0;
    if(d02%2==1 && d12%2==1){
        --d02;
        --d12;
        ++res;
    } else if(d02%2==0 && d12%2==1){
        ++d12;
        ++res;
    } else if(d02%2==1 && d12%2==0){
        ++d02;
        ++res;
    }
    res+=d02/2 + d12/2;
    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <iostream>
typedef long long ll;
typedef int64_t in;
using namespace std;
#define INF 1000000007


int main() {
	int n;
    cin >> n;
    vector<int> r(n);
    for(int i=0; i<n; i++){
        cin >> r[i];
    }
    int min = r[0];
    int max = -INF;
    for(int i=1; i<n; i++){
        if(r[i] - min > max){
            max = r[i] - min;
        }
        if(r[i] < min){
                min = r[i];
            }
        //cout << max << " " << min << " ";
    }
    cout << max << endl;
}


Measured memory_bytes: 3608
n,a,b = map(int,input().split())
p = 10**9 + 7
def comb(n,r):
	bunshi = 1
	for i in range(n-r+1,n+1):
		bunshi = bunshi * i % p
	bunbo = 1
	for i in range(1,r+1):
		bunbo = bunbo * i % p

	return bunshi * pow(bunbo,p-2,p)


s = -1 + pow(2,n,p) - comb(n,a) -comb(n,b)

print(s%p)




Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	int H, W;
	cin >> H >> W;
	int c[10][10];
	int dist[10];
	for (auto i = 0; i < 10; ++i)
	{
		for (auto j = 0; j < 10; ++j)
		{
			cin >> c[i][j];
		}
		dist[i] = INT_MAX;
	}

	dist[1] = 0;
	while (true)
	{
		auto isUpdate = false;
		for (auto i = 0; i < 10; ++i)
		{
			for (auto j = 0; j < 10; ++j)
			{
				if (dist[i] != INT_MAX && dist[j] > dist[i] + c[j][i])
				{
					dist[j] = dist[i] + c[j][i];
					isUpdate = true;
				}
			}
		}

		if (!isUpdate)
		{
			break;
		}
	}

	auto result = 0ll;
	for (auto i = 0; i < H; ++i)
	{
		for (auto j = 0; j < W; ++j)
		{
			int A;
			cin >> A;
			if (A < 0)
			{
				continue;
			}

			result += dist[A];
		}
	}

	cout << result << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    agc033a()
}

private data class Coordinate(val y: Int, val x: Int)

fun agc033a() {
    val (h, w) = readLine()!!.split(' ').map { it.toInt() }
    val isBlack = (1..h).map { readLine()!!.map { it == '#' }.toBooleanArray() }.toTypedArray()

    val blackIndices = mutableListOf<Coordinate>()
    val distantList = Array(h) { IntArray(w) { 99999 } }

    for (y in 0 until h) {
        for (x in 0 until w) {
            if (isBlack[y][x]) {
                blackIndices.add(Coordinate(y, x))
                distantList[y][x] = 0
            }
        }
    }

    val queue = ArrayDeque(blackIndices)
    val direction = listOf(-1 to 0, 1 to 0, 0 to -1, 0 to 1)
    var answer = 0

    while (queue.isNotEmpty()) {
        val (y, x) = queue.poll()

        val dist = distantList[y][x]
        answer = Math.max(answer, dist)

        direction.forEach {
            val nextY = y + it.first
            val nextX = x + it.second
            if (nextY in 0 until h && nextX in 0 until w && !isBlack[nextY][nextX]) {
                isBlack[nextY][nextX] = true
                queue.add(Coordinate(nextY, nextX))
                distantList[nextY][nextX] = Math.min(distantList[nextY][nextX], dist + 1)
            }
        }
    }

    println(answer)
}


Measured memory_bytes: 112188
N,K=map(int,input().split())
a=[]
for i in range(K):
    d=int(input())
    k=list(map(int,input().split()))
    a.append(k)
b=[]
for m in range(K):
    b+=a[m]
b=set(b)
ans=N-(len(b))
print(ans)

Measured memory_bytes: 9292
//Created by Aminul on 8/2/2020.

import sun.reflect.generics.tree.Tree;

import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args)throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = in.nextInt();
        char[] str = in.next().toCharArray();
        TreeSet<Integer> red = new TreeSet<>(), white = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            if(str[i] == 'R') red.add(i);
            else white.add(i);
        }

        int cnt = 0;
        while (!white.isEmpty() && !red.isEmpty() && white.first() < red.last()) {
            int r = red.pollLast(), w = white.pollFirst();
            red.add(w);
            white.add(r);
            cnt++;
        }

        pw.println(cnt);
          
        pw.close();
    }

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

Measured memory_bytes: 59816
N = gets.to_i
a = gets.chomp.split.map(&:to_i)

divide_2 = a.count { |i| i % 2 == 0 && i % 4 != 0 }
divide_4 = a.count { |i| i % 4 == 0 }

if (a.size - divide_2) - 2 * divide_4 <= 0
  puts "Yes"
elsif a.size / 2 <= divide_4
  puts "Yes"
else
  puts "No"
end


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

using namespace std;

int main()
{
    int a, b, c; cin >> a >> b >> c;
    bool t = false;

    if (a == b && a != c || a == c && a != b || b == c && b != a)
        t = true;

    cout << (t ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a; i<b; i++)
#define dep(i,a,b) for(int i=a; i>=b; i--)
#define sq(a) (a)*(a)
#define ms(a,v)	memset(a,v,sizeof a)
using namespace std;
const long long INF = 1e18 , MAXN =1e5, MOD = 1e9 + 7;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef map<string, string> mss;
 
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;  cin>>n;
  while (n){
    if (n%10==7){
      cout<<"Yes\n";
      return 0;
    }
    n/=10;
  }
  cout<<"No\n";
    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
		printf("a < b\n");
	}
	else if(a>b){
		printf("a > b\n");
	}
	else{
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 2684
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if (AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


const int NM = 20000;//ここを問題の制約を見ながらいじる．配列の確保に使う．
ll A[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．
bool Minus[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．

         //ll dp[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．
//string S[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．
//int B[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．
//double Perf[NM];

ll MOD = 1000000007;
int digit_length(int num)
{
    int count = 0;
    while (num) {
        num = num / 10;
        ++count;
    }
    return count;
}


ll gcd(ll a, ll b) {
    ll v0 = a, v1 = b, v2 = a % b;
    while (v2 != 0) {
        v0 = v1;
        v1 = v2;
        v2 = v0 % v1;
    };
    return v1;
}


// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

//ll lcm(ll a, ll b) {
//    return a / (gcd(a, b) % MOD) * (b % MOD);
//}

ll lcm(ll a, ll b) {
    return( (a % MOD) *modinv(gcd(a, b), MOD) * (b % MOD)) % MOD;
}
       // Main program


void solve() {
    ll  N;
    cin >> N;
 
    cout << (int)(((double)N/2.0)+0.5);

    return;
}



int main() {
    solve();
    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 main(){
    int n; 
    cin >> n;
    int a[n];
    rep(i,n) cin >> a[i];
    int ans = 0;
    rep(i,n){
        if( (i+1)%2 ==1 && a[i]%2 == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
x,n = [int(j) for j in input().split()]
l = set([int(j) for j in input().split()])
ans1 = x+n
for i in range(x, x+n):
    if i not in l:
        ans1 = i
        break
for i in range(x, -1, -1):
    if i not in l:
        ans2 = i
        break
if abs(ans1-x)<abs(ans2-x):
    print(ans1)
else:
    print(ans2)



Measured memory_bytes: 61916
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -O2 #-}

import qualified Data.Vector.Unboxed as VU
import Data.Bits
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import Data.List


-- 1 <= damageOther < damageTarget <= 10^9
isPossibleWith :: VU.Vector Int -> Int -> Int -> Int -> Bool
isPossibleWith !hps !damageTarget !damageOther !numMagics
  = (<= numMagics) $ VU.sum
    $ VU.map ((`div` damageDiff) . (+ (damageDiff - 1)))
    $ VU.filter (> 0)
    $ VU.map (subtract damageMin)
    $ hps
  where
    !damageMin = damageOther * numMagics
    !damageDiff = damageTarget - damageOther

query :: VU.Vector Int -> Int -> Int -> Int
query !hps !damageTarget !damageOther = binSearch 0 (10 ^ 9)
  where
    binSearch !ng !ok
      | ok - ng <= 1 = ok
      | isPossibleWith hps damageTarget damageOther mid = binSearch ng mid
      | otherwise = binSearch mid ok
      where
        !mid = (ng + ok) `shiftR` 1

main :: IO ()
main = do
  [n, damageTarget, damageOther]
    <- unfoldr (BS.readInt . BS.dropWhile (==' ')) <$> BS.getLine
  hps <- VU.unfoldrN n (BSL.readInt . BSL.dropWhile (< '-'))
         <$> BSL.getContents
  print $ query hps damageTarget damageOther


Measured memory_bytes: 2684
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl


signed main(){
    int N;
    int b[114];
    vector<int> B;
    int Ans[114];
    cin >> N;
    REP(i,N){cin >> b[i];B.push_back(b[i]);}
    REP(i,N){
        if(b[i]>i+1){
            cout << -1 << endl;
            return 0;
        }
    }
    REP(i,N){
        int c=-1;
        REP(j,B.size()){
            if(B[j]==j+1){
                c=j;
            }
        }
        if(c==-1){
            cout << -1 << endl;
            return 0;
        }
        Ans[N-i-1]=B[c];
        B.erase(B.begin()+c);
        
    }
    
    REP(i,N){
        cout << Ans[i] << endl;
    }
    
    
    
    return 0;
}


Measured memory_bytes: 896
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
using namespace std;

int main(){

	char buf[11],pre;
	bool FLG;

	for(int loop = 0; loop < 1000; loop++){
		scanf("%s",buf);

		FLG = true;

		//?????????????????£?¶??????????????????????????????????????§?????????§??????
		pre = buf[0];
		for(int i = 1; buf[i] != '\0';i++){
			switch(buf[i]){
			case 'A':
				if(pre == 'B' || pre == 'D'){

				}else{
					FLG = false;
				}
				break;
			case 'B':
				if(pre == 'A' || pre == 'C' || pre == 'E'){

				}else{
					FLG = false;
				}
				break;
			case 'C':
				if(pre == 'B' || pre == 'F'){

				}else{
					FLG = false;
				}
				break;
			case 'D':
				if(pre == 'A' || pre == 'E' || pre == 'G'){

				}else{
					FLG = false;
				}
				break;
			case 'E':
				if(pre == 'B' || pre == 'D' || pre == 'F' || pre == 'H'){

				}else{
					FLG = false;
				}
				break;
			case 'F':
				if(pre == 'C' || pre == 'E' || pre == 'I'){

				}else{
					FLG = false;
				}
				break;
			case 'G':
				if(pre == 'D' || pre == 'H'){

				}else{
					FLG = false;
				}
				break;
			case 'H':
				if(pre == 'E' || pre == 'G' || pre == 'I'){

				}else{
					FLG = false;
				}
				break;
			case 'I':
				if(pre == 'F' || pre == 'H'){

				}else{
					FLG = false;
				}
				break;
			}
			if(!FLG)break;
			pre = buf[i];
		}

		if(!FLG)continue;

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

}

Measured memory_bytes: 2688