akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)
#define _overload4(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload4(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)
#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))
#define d(a) cerr<<#a<<":"<<a<<endl
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl


int main(){
    int a;
    cin>>a;
    if(a==1){
        cout<<"Hello World"<<endl;
    }else{
        int a,b;
        cin>>a>>b;
        cout<<a+b<<endl;
    }
    return 0;
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  lli w;
  while (cin >> n >> w) {
    const int N = 100 + 5;
    const int M = 1000 * N;
    static lli dp[N][M];
    const lli inf = 1LL << 60;
    fill(&dp[0][0], &dp[N - 1][M - 1] + 1, inf);
    dp[0][0] = 0;

    lli x[n];
    lli y[n];
    for (int i = 0; i < n; ++i) {
      cin >> x[i] >> y[i];
    }

    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < M; ++j) {
        setmin(dp[i + 1][j], dp[i][j]);
        if (j + y[i] < M) setmin(dp[i + 1][j + y[i]], dp[i][j] + x[i]);
      }
    }

    lli mx = 0;
    for (int j = 0; j < M; ++j) {
      if (dp[n][j] <= w) {
        mx = j;
      }
    }
    cout << mx << endl;
  }
  
  return 0;
}


Measured memory_bytes: 86400
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

char s[101];
char model[] = "keyence";
int main() {
	scanf("%s", s);
	int front = 0;
	for (; front < 7 && s[front] == model[front]; front++);
	int len = 0;
	for (; s[len] != 0; len++);
	int back = 0;
	for (; back < 7 && s[len - back - 1] == model[6 - back]; back++);
	printf(7 <= (front + back) ? "YES\n" : "NO\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  int n;
  cin >> n;
  int k;
  cin >> k;
  string s;
  cin >> s;
  vector<int> diff;
  int step = 1;
  for(int i=1; i<n; i++) {
    if(s[i]!=s[i-1]) {
      diff.push_back(step);
      step=1;
    }
    else {
      step ++;
    }
  }
  diff.push_back(step);
  ll ans = 0;
  rep(i,diff.size()){
    ans += diff[i]-1;
  }
  if(diff.size() < 2 * k + 1) {
    cout << n-1 << endl;
    return 0;
  }
  else {
    ans += 2 * k;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1020
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=100000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
struct node{int to,nxt;}sq[200200];
int all=0,head[100100];
int n,m,l[100100],r[100100],val[100100],ans[100100],odd[100100];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

void nosol() {puts("No");exit(0);}

void add(int u,int v)
{
	all++;sq[all].to=v;sq[all].nxt=head[u];head[u]=all;
}

void dfs1(int u,int fu)
{
	go(u,i)
	{
		int v=sq[i].to;
		if (v==fu) continue;
		dfs1(v,u);
		l[u]=max(l[u],l[v]-1);
		r[u]=min(r[u],r[v]+1);
		if (odd[v]!=-1)
		{
			if (odd[u]==-1) odd[u]=odd[v]^1;
			else if (odd[u]==odd[v]) nosol();
		}	
	}
}

void dfs2(int u,int fu)
{
	if (fu)
	{
		l[u]=max(l[u],l[fu]-1);
		r[u]=min(r[u],r[fu]+1);
		if (odd[u]==-1) odd[u]=odd[fu]^1;
	}
	if ((l[u]>r[u]) || ((l[u]==r[u]) && ((l[u]&1)!=odd[u]))) nosol();
	go(u,i)
	{
		int v=sq[i].to;
		if (v==fu) continue;
		dfs2(v,u);
	}
}

void getans(int u,int fu)
{
	if (u==1) ans[u]=l[u];
	else 
	{
		ans[u]=ans[fu]-1;
		if (ans[u]<l[u]) ans[u]+=2;
	}
	go(u,i)
	{
		int v=sq[i].to;
		if (v==fu) continue;
		getans(v,u);
	}
}

int main()
{
	n=read();
	rep(i,1,n-1)
	{
		int u=read(),v=read();
		add(u,v);add(v,u);
	}
	m=read();
	rep(i,1,n)
	{
		l[i]=-maxd;r[i]=maxd;odd[i]=-1;
	}
	rep(i,1,m)
	{
		int u=read();val[u]=read();
		l[u]=r[u]=val[u];
		odd[u]=val[u]&1;
	}
	dfs1(1,0);dfs2(1,0);getans(1,0);
	puts("Yes");
	rep(i,1,n) printf("%d\n",ans[i]);
	return 0;
}
		


Measured memory_bytes: 9472
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), M = sc.nextInt(), X = sc.nextInt();
		int[] arr = new int[N+1];
		int[] psa = new int[N+1];
		for(int i=0; i<M; i++) {
			int a = sc.nextInt();
			arr[a]++;
		}
		for(int i=1; i<=N; i++) {
			psa[i] = psa[i-1] + arr[i];
		}
		int ans = Math.min(psa[X], psa[N]-psa[X-1]);
		System.out.println(ans);

		
		
		
		
		
	}

}


Measured memory_bytes: 35604
#include<iostream>
#define INF 1000000000000000000
 
using namespace std;
 
int main(){
  unsigned long long ans = 1;
  int N;
  cin >> N;
  unsigned long long A[N];
  
  for(int i = 0;i < N;i++){
    cin >> A[i];
  }
  
  bool zero = false;
  for(int i = 0;i < N;i++){
    if(A[i] == 0) zero = true;
    if(zero){
      cout << 0 << endl;
      return 0;
    }
  }
  
  for(int i = 0;i < N;i++){
    if(A[i] == 0){
      cout << 0 << endl;
      return 0;
    }
    if(A[i] <= INF/ans){
    	ans *= A[i];
    }else{
      cout << -1 << endl;
     	return 0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4420
#include<bits/stdc++.h>
using namespace std;
#define int long long
#undef int
#define pb push_back
#define mk make_pair
typedef long long ll;
typedef pair<int, int> pii;

int N;
int s[10000];

signed main()
{
    cin >> N;
    int ans = 0;
    for(int i = 0; i < N; i++){
        cin >> s[i];
        ans += s[i];
    }
    sort(s, s + N);
    cout << ans - s[N - 1] / 2 << endl;


    return 0;
}
/*


*/


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cfloat>
#include <cmath>
#include <functional>
#include <forward_list>
#include <list>


#define DEBUG(x) cout << #x << "\t:" << x << endl;
#define EPS (1e-9)
#define INF (INT_MAX/3)
#define MOD 1000000007
#define PI 3.14159265358979
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REPV(it,v) for(auto it = (v).begin(); it != (v).end(); ++it)

#define NUM 5000

#define ll long long
#define ull unsigned long long

using namespace std;

typedef pair<int, int> iiPair;


class Main {
public:
	ll getAns(ll n, ll a, ll b) {
		return max(b*(n - 1) + a - (b + (n - 1)*a) + 1, (ll)0);
	}
};

int main(void) {
	Main main;
	int n, a, b;
	cin >> n >> a >> b;
	cout << main.getAns(n,a,b) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x,n,y,z;
  cin>>x>>n;
  y=101;
  vector<int>p(n);
  vector<int>q(100);
  for(int i=0;i<100;i++){
    q.at(i)=i+1;
  }
  for(int i=0;i<n;i++){
    cin>>p.at(i);
    q.at(p.at(i)-1)=0;
  }
  for(int i=0;i<101-x;i++){
    if(q.at(x-1+i)!=0){
      y=q.at(x-1+i);
      break;
    }
  }
  for(int i=0;i<x;i++){
    if(q.at(x-1-i)!=0){
      z=q.at(x-1-i);
      break;
    }
  }
  if(y-x>=x-z){
    cout<<z<<endl;
  }
  else{
    cout<<y<<endl;
  }

  
  

}

Measured memory_bytes: 3628
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

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



int main(){
  int n,r;cin>>n>>r;
  cout << max(0,10-n)*100+r << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include "math.h"
using namespace std;

int main() {

	int N; cin >> N;
	int i;
	int k;
	vector<int> A;
	for (i = 0; i < N; i++) {
		cin >> k;
		A.push_back(k-i-1);
	}

	sort (A.begin(), A.end());
	N = A.size();
	long b[2];
	b[0] = (A[N / 2] + A[N / 2 - 1]) / 2.0;
	b[1] = A[N / 2];
	
	long sum[2] = {};
	for (i = 0; i < N; i++) {
		sum[0] += abs(A[i] - b[0]);
		sum[1] += abs(A[i] - b[1]);
	}
	cout << min(sum[0],sum[1]) << endl;

}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
//     for(int i=0; i<N;i++){
//     }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    int N;
    str S;
    cin>>N>>S;
    int ans = 0;
    int x=0;
    for(int i=0; i<N;i++){
      if(S[i]=='I'){
        x++;
      }else{
        x--;
      }
      ans = max(x, ans);
    }

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


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
constexpr int N = 505050;
char s[N];
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string in;
  cin >> in;
  for (int i = 0; i < (int) in.size(); i++) s[i + 200000] = in[i];
  int l = 200000, r = 200000 + (int) in.size() - 1;
  int q;
  cin >> q;
  int rev = 0;
  while (q--) {
    int t;
    cin >> t;
    if (t == 1) {
      rev ^= 1;
    } else {
      int f;
      cin >> f;
      char ch;
      cin >> ch;
      if (rev) {
        if (f == 1) {
          s[++r] = ch;
        } else {
          s[--l] = ch;
        }
      } else {
        if (f == 1) {
          s[--l] = ch;
        } else {
          s[++r] = ch;
        }
      }
    }
  }
  if (rev) {
    for (int i = r; i >= l; i--) {
      cout << s[i];
    }
    cout << endl;
  } else {
    for (int i = l; i <= r; i++) {
      cout << s[i];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}
//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

int strsum(const int n){
    string s = to_string(n);
    int b(0);
    rep(i,s.size()){
        b += s[i]-'0';
    }
    return b;
}

int main(){
    string s;
    cin >> s;
    rep(i,19){
        if(s[i]==','){
            cout << " ";
        }else{
            cout << s[i];
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
n,A,B,C =map(int, input().split())
l = [int(input()) for i in range(n)]
INF = 10 **9

def dfs(cur, a, b, c):
    if cur == n:
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a, b, c)>0 else INF

    x = dfs(cur+1, a, b, c)
    y = dfs(cur+1, a+l[cur], b, c)+10
    z = dfs(cur+1, a, b+l[cur], c)+10
    w = dfs(cur+1, a, b, c+l[cur])+10
    return min(x,y,z,w)

print(dfs(0,0,0,0))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 
int binary_search(const vector<int> &vec, const int key) {
	auto solve = [&] (int index) {
		if(vec[index] > key) return true;
		else return false;
	};
	int ok = vec.size();	// 解が存在する値
	int ng = -1;	// 解が存在しない値
	while (abs(ok - ng) > 1) {
		int mid = (ok + ng) / 2;
		if(solve(mid)) {
			ok = mid;
		} else {
			ng = mid;
		}
	}
	return ok;
}
 
 
int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n) cin >> c[i];
	sort(all(a));
	sort(all(b));
	sort(all(c));
	ll ans = 0;
	
	// rep(i, n) cout << a[i] << " ";
	// cout << endl;
	// rep(i, n) cout << b[i] << " ";
	// cout << endl;
	// rep(i, n) cout << c[i] << " ";
	// cout << endl;
	ll sum = 0;
	vector<ll> wa(n);
	rep(i, n) {
		sum += binary_search(a, b[i]-1);
		wa[i] = sum;
	}
	// rep(i, n) cout << wa[i] << " ";
	// cout << endl;
	rep(i, n){
		int bc = binary_search(b, c[i]-1);
		if(bc <= 0) continue;
		ans += wa[bc-1];
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2176
#include <stdio.h>
#define int long long

int MOD(int a, int M){
	a %= M;
	return a >= 0 ? a : a + M;
}

int power(int a, int N, int M){
	if(N == 0){
		return 1;
	}
	else if(N % 2 == 0){
		return power(MOD(a * a, M), N / 2, M);
	}
	else{
		return MOD(a * power(a, N - 1, M), M);
	}
}

int gcd(int a, int b){
	if(b == 0){
		return a;
	}
	else{
		return gcd(b, a % b);
	}
}

int lcm(int a, int b){
	return (a / gcd(a, b)) * b;
}

//オイラーのφ関数
//M以下でMと互いに素なものの個数を求める
int Eulers_phi_function(int M){
	int i, j, ans = 1;
	for(i = 2; i * i <= M; i++){
		for(j = 0; M % i == 0; j++, M /= i);
		if(j > 0){
			for(ans *= i - 1; j > 1; j--, ans *= i);
		}
	}
	if(M > 1){
		ans *= M - 1;
	}
	return ans;
}

typedef struct {
	int s;
	int t;
}pair;

//拡張ユークリッドの互除法
//ax + by = gcd(x, y) となる(a, b)を求める
//x > 0, y >= 0 を仮定している
pair Extension_Euclidean(int x, int y){
	if(y == 0){
		return (pair){1, 0};
	}
	else{
		pair p = Extension_Euclidean(y, x % y);
		return (pair){p.t, p.s - p.t * (x / y)};
	}
}

//a = b mod gcd(N, M) を満たすときに連立合同式
//x = a mod N
//x = b mod M
//を解く
int CRT(int a, int b, int N, int M){
	pair p = Extension_Euclidean(N, M);
	return MOD(a + MOD(((b - a) / gcd(N, M)) * p.s, M / gcd(N, M)) * N, lcm(N, M));
}

int solve(int A, int M){
	int x, y;
	if(M == 1){
		x = 100;
	}
	else{
		int phiM = Eulers_phi_function(M);
		y = solve(A, gcd(M, phiM));
		x = CRT(power(A, y, M), MOD(y, phiM), M, phiM);
		if(x < 100){
			x += lcm(M, phiM) * (100 / lcm(M, phiM) + 1);
		}
	}
	return x;
}

signed main(){
	int Q, q, A, M;
	scanf("%lld", &Q);
	for(q = 0; q < Q; q++){
		scanf("%lld%lld", &A, &M);
		printf("%lld\n", solve(A, M));
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template<class T>
using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
int main(){
	int n, m;
	cin >> n >> m;
	V a(m);
	rep(i, m) {
		cin >> a[i];
	}
	sort(all(a));
	V alldist;
	rep1(i, m - 1) {
		alldist.push_back(abs(a[i] - a[i - 1]));
	}
	sort(all(alldist), greater<int>());
	ll ans = 0;
	REP(i, n - 1, alldist.size()) {
		ans += alldist[i];
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
#define lint long long


int main() {
    int H, W, N;
    cin >> H >> W >> N;
    
    map<int, vector<int>> obs;
    
    for(int i = 0; i < N; ++i){
        int x, y;
        cin >> x >> y;
        obs[x].push_back(y);
    }
    
    for(auto e : obs){
        vector<int> v = e.second;
        sort(v.begin(), v.end());
        obs[e.first] = v;
    }
    
    int M = 1;
    for(int i = 2; i < H + 1; ++i){
        
        auto itl = lower_bound(obs[i].begin(), obs[i].end(), 0);
        
        if(itl == obs[i].end()){
            ++M;
        } else if(*itl < M + 1){
            cout << i - 1 << endl;
            return 0;
        } else if(*itl == M + 1){
            continue;
        } else {
            ++M;
        }
    }
    
    cout << H << endl;
}

Measured memory_bytes: 22144
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define ll long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define maxn 200010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buf[20];
	int len=0;
	if(x<0)putchar('-'),x=-x;
	for(;x;x/=10)buf[len++]=x%10+'0';
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]);
}
inline void writesp(ll x){write(x); putchar(' ');}
inline void writeln(ll x){write(x); putchar('\n');}
int n,m,k;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll power(ll a,ll b)
{
	ll ans=1;
	for(;b;b>>=1,a=a*a%mod)
		if(b&1)ans=ans*a%mod;
	return ans;
}
ll solve(int n,int m)
{
	int d=gcd(n,m);
	return (power(2,n)+power(2,m)+power(2,d)+mod-3)%mod;
}
int main()
{
	n=read(); m=read(); k=read();
	int d1=gcd(n,k),d2=gcd(m,k);
	writeln(power(solve(n/d1,m/d2),(ll)d1*d2));
	return 0;
}

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

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

typedef long long LL;
typedef unsigned long UL;

using namespace std;

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

    int k;
    cin >> k;

    int ans = 0;

    if (k % 2 == 0)
    {
        ans = (k / 2) * (k / 2);
    }
    else
    {
        ans = (k / 2) * (k / 2 + 1);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  long long i,j,n,max=-1000000,min=1000000,sum=0;
  scanf("%lld",&i);
  for(j=0;j<i;j++){scanf("%lld",&n);
    if(n>max){max=n;
    }
    if(n<min){min=n;
    }
    sum=sum+n;
  }
  printf("%lld %lld %lld\n",min,max,sum);
   
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define dbg(x) cerr << ">>> " << x << endl
#define _ << ", " <<

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

struct Range {
  int l, r, v;
  
  Range(int a = 0, int b = 0, int c = 0) {
    l = a, r = b, v = c;
  }
};

int main() {
  ios::sync_with_stdio(0);cin.tie(0);
  int n;
  std::cin >> n;
  std::vector<int> b(n);
  for(int i = 0; i < n; i++) {
    std::cin >> b[i];
  }
  auto check = [&](int x) {
    std::vector<Range> a;
    a.emplace_back(0, 1, x);
    for(auto p : b) {
      while(a.back().l > p) a.pop_back();
      if(a.back().r <= p) {
        assert(a.back().l <= p);
        a.emplace_back(a.back().r, p + 1, 1);
      } else {
        while(!a.empty() && a.back().v >= x) a.pop_back();
        if(a.empty()) return false;
        if(a.back().r > p) {
          a.back().r = p;
          int v = a.back().v + 1;
          assert(v <= x);
          if(a.back().l == a.back().r) a.pop_back();
          a.emplace_back(p, p + 1, v);
        } else {
          int v = a.back().v + 1;
          int r = a.back().r;
          a.back().r--;
          if(a.back().l == a.back().r) a.pop_back();
          assert(v <= x);
          a.emplace_back(r - 1, r, v);
          if(a.back().r <= p) a.emplace_back(a.back().r, p + 1, 1);
        }
      }
      assert(a.back().r == p + 1);
    }
    return true;
  };
  int l = 1, r = (int) 1e9;
  while(l != r) {
    int mid = (l + r) / 2;
    if(check(mid)) r = mid;
    else l = mid + 1;
  }
  std::cout << l << '\n';
  return 0;
}

Measured memory_bytes: 6528
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

int64 calc(int *a,int *b,int n,int k){
  int64 sum=0;
  int i;
  for(i=0;i<n;i++) if((a[i]|k)==k) sum+=b[i];
  return sum;
}

void run(void){
  int n,k;
  scanf("%d%d",&n,&k);
  int *a=(int *)malloc(sizeof(int)*n);
  int *b=(int *)malloc(sizeof(int)*n);
  int i;
  for(i=0;i<n;i++) scanf("%d%d",a+i,b+i);
  int64 max=calc(a,b,n,k);
  int bit;
  for(bit=0;bit<30;bit++){
    if((k>>bit)&0x01){
      int64 t=calc(a,b,n,((k>>(bit+1))<<(bit+1))+(1<<bit)-1);
      max=MAX(max,t);
    }
  }
  printf("%lld\n",max);
  return;
}

int main(void){
  run();
  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

//重みある時
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

vector<bool> beki(1010);

int main() {
    int n,ans = 0;
    string s;
    cin >> n >> s;
    s.erase(unique(s.begin(),s.end()),s.end());
    cout << s.size() << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)


int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll taka = a/d;
    ll aoki = c/b;
    if (a%d != 0) taka++;
    if (c%b != 0) aoki++;
    string ans = "No";
    if (taka >=aoki) ans = "Yes";
    cout << ans << endl;
}

Measured memory_bytes: 3624
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_F
# Combinatorial - Knapsack Problem II

n, maxW = gets.split.map(&:to_i)
vw = Array.new
maxV = 0
n.times do
  v, w = gets.split.map(&:to_i)
  vw << { v: v, w: w }
  maxV += v
end

maxV += 1
inf = 2000000000
dp = Array.new(n) { Array.new(maxV, inf) }

n.times do |i|
  dp[i][0] = 0
end

n.times do |i|
  (0...maxV).each do |j|
    if i == 0
      dp[i][j] = vw[i][:w] if vw[i][:v] == j
    else
      if dp[i - 1][j] < inf
        dp[i][j] = [dp[i - 1][j], dp[i][j]].min
        if (dp[i - 1][j] + vw[i][:w] <= maxW)
          dp[i][j + vw[i][:v]] = [dp[i][j + vw[i][:v]], dp[i - 1][j] + vw[i][:w]].min
        end
      end
    end
  end
end

printed = false
(0...maxV).reverse_each do |j|
  if dp[n - 1][j] <= maxW
    puts j
    printed = true
    break
  end
end

puts 0 if !printed



Measured memory_bytes: 14776
#include<stdio.h>

int gcd(int x, int y);

int main(){
  int x,y;
  scanf("%d%d", &x, &y);
  printf("%d\n", gcd(x, y));

  return 0;
}
int gcd(int x, int y){
  return y ? gcd(y, x%y) : x;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n;
  while (cin >> n >> s) {
    int ans = 0, now = 0;
    for (int i = n - 1; i >= 0; i--) {
      if (s[i] == 'R') {
        for (int j = now; j < i; j++) {
          if (s[j] == 'W') {
            now = j + 1;
            ans++;
            break;
          }
          now = j + 1;
        }
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3728
ans_list = []

while True:
    h = int(input())
    if not h:
        break

    stone = [list(map(int, input().split())) for i  in range(h)]
    ans = 0
    while True:
        key = 1
        for i in range(h):
            del_list = []
            for j in range(len(stone[0]) - 2):
                if stone[i][j:j + 3] == [stone[i][j], stone[i][j], stone[i][j]] and stone[i][j] != 0:
                    key = 0
                    del_list.append(j)
            for j in del_list:
                ans += sum(stone[i][j:j + 3])
                stone[i][j:j + 3] = [0, 0, 0]

        key2 = 1
        ij = 0
        while key2:
            import copy
            last_stone = copy.deepcopy(stone)
            key2 = 0
            for i in range(h - 1, -1, -1):
                for j in range(len(stone[i])):
                    if stone[i][j] == 0:
                        if i != 0:
                            key2 = 1
                            stone[i][j] = stone[i - 1][j]
                            stone[i - 1][j] = 0
            ij += 1
            if last_stone == stone:
                key2 = 0

        if key:
            break
    ans_list.append(ans)

for i in ans_list:
    print(i)


Measured memory_bytes: 6360
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    x = I()
    r = 1
    for i in range(2,x):
        t = i*i
        while t <= x:
            if r < t:
                r = t
            t *= i

    return r



print(main())



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

const int INF = 1001001001;
int main(){
	int n,m,x;
	cin >> n >> m >> x;
	vector<int> c(n);
	int a[n][m];
	rep(i,n){
		cin >> c[i];
		rep(j,m){
			cin >> a[i][j];
		}
	}
	int ans = INF;
	rep(s,1<<n){
		int cost=0;
		vector<int> b(m);
		rep(i,n){
			if(s>>i&1){
				cost += c[i];
				rep(j,m) b[j] += a[i][j];
			}
		}
		bool f =-true;
		rep(j,m){
			if(b[j] < x) f = false;
		}
		if(f){
			ans = min(ans,cost);
		}
	}
	if(ans != INF) cout << ans << endl;
	else cout << "-1" << endl;
	return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	string s;
	cin>>s;
	ll i,j,k,l=0,n=s.length();
	for(i=0;i<n;i++){
		if(s[i]=='o') l++;
	}
	if(l+(15-n)>=8){
		cout<<"YES";
	}
	else{
		cout<<"NO";
	}
	return 0;
}


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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;

#define INF 1e9
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (n); i++)
#define each(x, v) for (auto& x: (v))
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl

void solve();
void in(){} template<class T, class... U> void in(T &t, U &...u){ cin >> t; in(u...); }
int main() { cin.tie(0); ios::sync_with_stdio(0); solve(); }

void solve() {
  int N;
  in(N);
  map<string, int> mp;
  int mx = 0;
  rep(i, N) {
    string s;
    in(s);
    mp[s]++;
    mx = max(mx, mp[s]);
  }

  each(x, mp) {
    if (x.second == mx) {
      print(x.first);
    }
  }
}


Measured memory_bytes: 23808
#include<iostream>
using namespace std;
int main(){
long n,m;
while(cin>>n,n){
n=1000-n;m=0;
while(n>=500){m++;n-=500;}
while(n>=100){m++;n-=100;}
while(n>=50){m++;n-=50;}
while(n>=10){m++;n-=10;}
while(n>=5){m++;n-=5;}
while(n>=1){m++;n--;}
cout<<m<<endl;
}
return 0;
}

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

int main()
{
    int n, m, c;
    cin >> n >> m >> c;
    vector<int>b(m);
    for(auto & x: b){
        cin >> x;
    }
    vector<vector<int>>a(n);
    for(auto & x: a){
        for(auto i = 0; i < m ; ++i){
            int y;
            cin >> y;
            x.push_back(y);
        }
    }
    auto ans = 0;
    for(auto i = 0; i < n; ++i){
        auto val = 0;
        for(auto j = 0; j < m; ++j){
            val += a[i][j]*b[j];
        }
        val += c;
        if(val > 0){
            ans++;
        }
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 256
def check(x, y)
  2.times do |z|
    4.times do
      return 'Yes' if x == y
      a, b, c, d, e, f  = x
      x = z.zero? ? [e, a, c, d, f, b] : [d, b, a, f, e, c]
      c = x
      4.times do
        i, j, k, l, m, n = c
        c = [i, k, m, j, l, n]
        return 'Yes' if c == y
      end
    end
  end
  'No'
end
 
puts check(*$<.map(&:chomp).map(&:split))

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : (x))
#define all(x) x.begin(), x.end() // sort(all(x))
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair((x), (y))

typedef long long ll;

typedef double T;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tiii;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<T> vt;
typedef vector<vt> vvt;
typedef vector<pii> vpi;
typedef vector<pii> vpl;
typedef vector<vpi> graph;
typedef complex<T> Pt;
typedef pair<Pt, Pt> Line;

const ll MOD = 1e9 + 7; // 998244353;
const T EPS = 1e-10;
const int INF = 1e9 + 1;

/* Mod Library */

struct Mod {
    ll x;
    Mod (ll x = 0) : x(x) {}
    Mod operator+(Mod b) { return Mod((x + b.x)%MOD); }
    Mod operator-(Mod b) { return Mod((x - b.x + MOD)%MOD); }
    Mod operator*(Mod b) { return Mod((x * b.x)%MOD); }
    Mod operator/(Mod b) { return *this * inverse(b); }
    Mod operator%(Mod b) { return Mod(x % b.x); }

    static ll euclid(ll a, ll b, ll &x, ll &y) {
        if (b) {
            ll d = euclid(b, a%b, y, x);
            y -= a/b*x;
            return d;
        }
        x = 1; 
        y = 0;
        return a;
    }
    
    Mod inverse(Mod a) {
        ll x, y, g = euclid(a.x, MOD, x, y);
        assert(g == 1);
        return Mod((x + MOD)%MOD);
    }

    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this^(e/2);
        r = r*r;
        return e&1 ? *this*r : r;
    }
};

/* Input Library */
template <typename A, typename B>
istream& operator>>(istream &in, pair<A, B> &p) {
    in >> p.first >> p.second;
    return in;
}

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

template <typename I>
istream& operator>>(istream &in, vector<I> &a) {
    trav(i, a) in >> i;
    return in;
}

template <typename I>
ostream& operator<<(ostream &out, vector<I> &a) {
    rep(i, 0, sz(a)) {
        if (i) out << " ";
        out << a[i];
    }
    return out;
}

void fast_io() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    //cout.tie(0);
    cin.exceptions(cin.failbit);
} 

void solve_test() {
  char c;
  cin >> c;
  if (c < 'a') {
    cout << 'A' << endl;
  } else {
    cout << 'a' << endl;
  }

}

void setup() {
}

int main() {
    setup();
    srand(time(0));
    fast_io();
    int t = 1;
    //cin >> t;
    while (t--) {
        solve_test();
    }
}


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

typedef vector<int> vi;
ll mod = 1000000007;


int main(){
    int n, l, m;
    ll k, ans = 0, ans1, ans2;
    cin >> n >> k;
    vi a(n);
    rep(i, n){
        cin >> a[i];
    }
    l = 0;
    m = 0;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            if(a[i]>a[j]){
                l++;
                if(i<j){
                    m++;
                }
            }
        }
    }
    ans1 = k % mod;
    ans2 = (k * (k - 1) / 2) % mod;
    ans = (ans1 * m+ ans2 * l) % mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll K;
    string S;
    cin >> K >> S;
    if(S.size() <= K){
        cout << S << endl;
    }else{
        cout << S.substr(0, K) << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;

	cout << t << s << endl;

	return 0;
}

Measured memory_bytes: 3592
moji = 0
S = input()
Slen = len(S)
check = ["dreamer","eraser","dream","erase"]
flag = True
while flag:
  flag = False
  for i in range(4):
    if len(S) - moji >= len(check[i]) and S[Slen - moji - len(check[i]):Slen - moji] == check[i]:
      moji += len(check[i])
      flag = True
      break
if moji == len(S):
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cfenv>
using namespace std;

int gcd(int a, int b){
    while(1){
        if(a<b) swap(a,b);
        if(!b) break;
        a %= b;
    }

    return a;
}

int main(){

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

    sort(a, a+n);

    int forward[n];
    forward[0] = a[0];
    for(int i=1; i<n; i++){
        forward[i] = gcd(forward[i-1], a[i]);
    }

    int reverse[n];
    reverse[n-1] = a[n-1];
    for(int i=n-2; i>=0; i--){
        reverse[i] = gcd(reverse[i+1], a[i]);
    }

    int answer = -1;
    for(int i=1; i<=n-2; i++){
        answer = max(answer, gcd(forward[i-1], reverse[i+1]));
    }

    answer = max(answer, reverse[1]);
    answer = max(answer, forward[n-2]);

    //cout << forward[0] << forward[1] << forward[2] << endl;
    //cout << reverse[0] << reverse[1] << reverse[2] << endl;

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
struct Tree{
  int node;
  vector<vector<pair<int,int>>> edge;
  vector<int> col;
  int m;
  
  Tree(int n,vector<int> a,vector<int> b,vector<int> c){
    node = n;
    edge.resize(node);
    m = 0;
    col.resize(n-1,0);
    rep(i,node-1){
      edge[a[i]].push_back({b[i],c[i]});
      edge[b[i]].push_back({a[i],c[i]});        
    }
  }

  void dfs(int v,int p){
    int c = 1;
    for(auto w:edge[v]){
      if(p==c) c++;
      if(col[w.second]>0) continue;
      col[w.second] = c;
      dfs(w.first,c);
      m = max(m,c);
      c++;
    }
  }
  
};
int main()
{
  int n;cin >> n;
  vector<int> a(n-1),b(n-1),c(n-1);
  rep(i,n-1){
    cin >> a[i] >> b[i];
    a[i]--;b[i]--;
    c[i] = i;
  }
  Tree tr(n,a,b,c);
  tr.dfs(0,-1);
  cout << tr.m << "\n";
  rep(i,n-1){
    cout << tr.col[i] << "\n";
  }
  
  return 0;
}


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

bool Primechek(int n) {
	int check;
	if (n == 2) return true;
	check = sqrt(n);
	
	for (int i = 2; i <= check; i++) {
		if (n%i == 0) return false;
	}
	return true;
}

int main()
{
	int n;
	int x;
	int count=0;
	cin>>n;
	for (int i = 0; i < n; i++) {
		cin >> x;
		if (Primechek(x) == true) count++;
	}
	cout << count << endl;
    return 0;
} 




Measured memory_bytes: 3068
n = int(input())
a = list(map(int, input().split()))

ans = [0] * n
for i in range(n - 1, -1, -1):
    sum = 0
    for j in range(i + i + 1, n, i + 1):
        sum += ans[j]

    ans[i] = a[i] - sum
    ans[i] %= 2

print(ans.count(1))

for i in range(n):
    if ans[i] == 1:
        print(i + 1, end=" ")


Measured memory_bytes: 64224
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    bool ok = false;
    vector<int> tmp = v;
    sort(tmp.begin(), tmp.end());
    if(tmp == v) ok = true;
    for(int i = 0; i < n; i++)
    {
        for(int j = i + 1; j < n; j++)
        {
            swap(v[i], v[j]);
            bool flag = true;
            for(int k = 0; k < n - 1; k++)
            {
                if(v[k] > v[k + 1]) flag = false;
            }
            if(flag) ok = true;
            swap(v[i], v[j]);
        }
    }
    cout << (ok ? "YES" : "NO") << endl;
    return 0;
}



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

#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair

using namespace std;

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


int main () {
	 ios::sync_with_stdio(false); cin.tie(0);
	 ll n;
	 cin>>n;
	 if(n%2!=0) cout<<0;
	 else{
	 	ll power = 5;
	 	ll total = 0;
	 	while((n/2)/power != 0){
	 		total += (n/2)/power;
	 		power *= 5;
	 	}
	 	cout<<total;
	 }
	 
	 
	 
	 
	 return (0);
}

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

#define _error(args...) { vector<string> _v; _split(_v, #args, ','); cerr << "** "; _output(_v.begin(), args); }
void _split(vector<string>& v, const string& str, const char& ch) {
    v.clear();
    string temp;
    for (int i = 0; i <= str.size(); i++)
        if (i == str.size() || str[i] == ch) 
            v.push_back(temp), temp = "";
        else
            temp += str[i];
}
void _output(vector<string>::iterator it) { cerr << "\n"; }
template<typename T, typename ...Args>
void _output(vector<string>::iterator it, const T& x, const Args& ...args) {
    cerr << it->substr((*it)[0] == ' ') << " = " << x << "   ";
    _output(++it, args...);
}

const int MAX_N = 50 + 5;

long long dp[MAX_N][2], a[MAX_N];

int main() {
    int n, p;
    cin >> n >> p;
    for (int i = 0; i < n; i++) cin >> a[i];
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        dp[i][a[i] & 1] = 1;
        for (int j = 0; j < i; j++) {
            dp[i][a[i] & 1] += dp[j][0];
            dp[i][a[i] & 1 ^ 1] += dp[j][1];
        }
    }
    cout << dp[n][p];
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

const int di[]={1,0,-1,0};
const int dj[]={0,1,0,-1};

int main(){
  int h,w,sx,sy;
  cin >> h >> w;
  vector<string> A(h);
  for(int i=0;i<h;++i){
    cin >> A[i];
  }
  vector<vector<int>> dist(h,vector<int>(w,-1));
  queue<P> q;
  auto update=[&](int i,int j,int x){
    if(dist[i][j]!=-1)return;
    dist[i][j]=x;
    q.push(P(i,j));
  };
  for(int i=0;i<h;++i){
    for(int j=0;j<w;++j){
      if(A[i][j]=='#'){
        update(i,j,0);
      }
    }
  }
  while(!q.empty()){
    int i=q.front().first;
    int j=q.front().second;
    q.pop();
    for(int dir=0;dir<4;++dir){
      int ni=i+di[dir];
      int nj=j+dj[dir];
      if(ni<0 || ni>h-1 || nj<0 || nj>w-1) continue;
      if(dist[ni][nj]==-1){
        update(ni,nj,dist[i][j]+1);
      }
    }
  }
  int ans=0;
  for(int i=0;i<h;++i){
    for(int j=0;j<w;++j){
      ans=max(dist[i][j],ans);
    }
  }
  cout << ans << endl;
  return 0;

}


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

int main()
{
	int h, w;
	cin >> h >> w;
	vector<vector<char>> map(h, vector<char>(w));

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> map[i][j];
		}
	}

	for (int i = 0; i < h; i++) {
		bool emp = true;
		for (int j = 0; j < w; j++) {
			if (map[i][j] == '#') {
				emp = false;
			}
		}

		if (emp) {
			for (int k = 0; k < w; k++)
				map[i][k] = '*';
		}
	}

	for (int i = 0; i < w; i++) {
		bool emp = true;
		for (int j = 0; j < h; j++) {
			if (map[j][i] == '#') {
				emp = false;
			}
		}

		if (emp) {
			for (int k = 0; k < h; k++) {
				map[k][i] = '*';
			}
		}
	}

	for (int i = 0; i < h; i++) {
		bool a = false;
		for (int j = 0; j < w; j++) {
			
			if (map[i][j] != '*') {
				cout << map[i][j];
				a = true;
			}
			
		}
		if (a)
		cout << endl;
	}
	

	return 0;
}

Measured memory_bytes: 384
#!/usr/bin/python3
# vim: set fileencoding=utf-8:
import sys
input = sys.stdin.readline

H = int(input())
h = [int(ele) for ele in input().split()]
h = [0] + h


def main():
    max_heap = HeapHelper.build_max_heap(h)
    ans = ''
    for val in max_heap[1:]:
        ans += ' ' + str(val)

    print(ans)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
        if i != n // i:
            divisors.append(n//i)
    return divisors


class Node():

    def __init__(self):
        self.idx = None
        self.left = None
        self.right = None
        self.parent = None
        return

    def pre_order(self):
        global pre_order_str
        pre_order_str += str(self.idx) + " "
        if self.left:
            self.left.pre_order()

        if self.right:
            self.right.pre_order()

    def in_order(self):
        global in_order_str

        if self.left:
            self.left.in_order()

        in_order_str += str(self.idx) + " "

        if self.right:
            self.right.in_order()

    def post_order(self):
        global post_order_str
        if self.left:
            self.left.post_order()

        if self.right:
            self.right.post_order()

        post_order_str += str(self.idx) + " "


class HeapHelper():
    """HeapContrler.
    完全二分木を二分ヒープで表現した配列 A に対して、
    HeapHelper.parent(idx) とするとそのノードの親の添字を返す
    存在しない場合は Falseを返す

    Returns:
        [type] -- [description]
    """

    def __init__(self):
        return

    @staticmethod
    def parent(i):
        if i == 1:
            return False

        return int(i/2)

    @staticmethod
    def left(i):
        l_idx = 2*i
        if H < l_idx:
            return False

        return l_idx

    @staticmethod
    def right(i):
        r_idx = 2*i + 1
        if H < r_idx:
            return False

        return r_idx

    @staticmethod
    def build_max_heap(heap):
        for idx in range(len(heap)-1, 0, -1):
            HeapHelper.max_heap(heap, idx)

        return heap

    @staticmethod
    def max_heap(heap, i):
        """ 

        Arguments:
            heap {[type]} -- [description]
            i {[type]} -- [description]
        """
        l = HeapHelper.left(i)
        r = HeapHelper.right(i)
        largest = i
        # 左の子、自分、右の子で値が最大のノードを選ぶ
        if l != False and heap[l] > heap[i]:
            largest = l

        if r != False and heap[r] > heap[largest]:
            largest = r

        if largest != i:
            tmp = heap[largest]
            heap[largest] = heap[i]
            heap[i] = tmp
            HeapHelper.max_heap(heap, largest)


if __name__ == "__main__":
    main()



Measured memory_bytes: 61100
package main

import "fmt"

func main() {
	var C []string
	var row string
	for i := 0; i < 3; i ++ {
		fmt.Scan(&row)
		C = append(C, row)
	}

	fmt.Println(C[0][0:1] + C[1][1:2] + C[2][2:3])
}


Measured memory_bytes: 512
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int l,r,d;
    cin>>l>>r>>d;
    int c=0;
    for(int i=l;i<=r;i++)
    {
        if(i%d==0)
        c++;
    }
    cout<<c<<"\n";
    

    return 0;
}


Measured memory_bytes: 3620