akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://beta.atcoder.jp/contests/arc094/tasks/arc094_d>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

const ll MOD = 998244353;
ll dp[200010][2][3][3];
ll solve(){
    ll res = 0;
    string S; cin >> S;
    for(auto& c:S) c -= 'a';
    if(count(S.begin(),S.end(),0) == S.length()) return 1;
    if(count(S.begin(),S.end(),1) == S.length()) return 1;
    if(count(S.begin(),S.end(),2) == S.length()) return 1;

    if(S.length() <= 3){
        set<string> T,R;
        T.insert(S);
        while(T.size()){
            set<string> U;
            for(auto& s:T){
                R.insert(s);
                for(int i = 0; i < S.length()-1;i++){
                    if(s[i] != s[i+1]){
                        string a = s;
                        a[i]=a[i+1]=0+1+2-a[i]-a[i+1];
                        if(R.count(a)==0){
                            U.insert(a);
                            R.insert(a);
                        }
                    }
                }
            }
            T = U;
        }
        return R.size();
    }
    
    int hash = accumulate(S.begin(),S.end(),0)%3;
    
    dp[1][0][0][0]=1;
    dp[1][0][1][1]=1;
    dp[1][0][2][2]=1;
    for(int i = 1; i < S.length();i++){
        for(int j = 0; j < 2;j++){
            for(int x = 0; x < 3;x++){
                for(int y = 0; y < 3;y++){
                    for(int z = 0; z < 3;z++){
                        (dp[i+1][j|(x==z)][z][(y+z)%3]+=dp[i][j][x][y])%=MOD;
                    }
                }
            }
        }
    }
    for(int i = 0; i < 3;i++) res += dp[S.length()][1][i][hash];
    [&]{
        for(int i = 0; i < S.length()-1;i++){
            if(S[i]==S[i+1])return;
        }
        res++;
    }();
    res%=MOD;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 28692
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
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 (b < a) { a = b; return true; } return false; }

struct FordFulkerson {
	using Flow = int;
	struct Edge {
		int to, rev;
		Flow cap;
		Edge() {}
		Edge(int to, int rev, Flow cap) :to(to), rev(rev), cap(cap) {}
	};
	int n;
	vector<vector<Edge>> g;
	vector<bool> used;
	FordFulkerson(int n) :n(n), g(n, vector<Edge>()), used(n) {};
	void addEdge(int from, int to, Flow cap) {
		g[from].emplace_back(to, (int)g[to].size(), cap);
		g[to].emplace_back(from, (int)g[from].size() - 1, 0);
	}
	Flow maxFlow(int s, int t) {
		Flow total = 0;
		while (true) {
			fill(used.begin(), used.end(), false);
			Flow f = augment(s, t, INF);
			if (f == 0)return total;
			total += f;
		}
	}
	Flow augment(int v, int t, Flow f) {
		if (v == t)return f;
		used[v] = true;
		for (int i = 0; i < g[v].size(); i++) {
			Edge &e = g[v][i];
			if (!used[e.to] && e.cap > 0) {
				Flow d = augment(e.to, t, min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					g[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int V, E; cin >> V >> E;
	FordFulkerson ff(V);
	rep(i, 0, E) {
		int u, v, c; cin >> u >> v >> c;
		ff.addEdge(u, v, c);
	}
	cout << ff.maxFlow(0, V - 1) << endl;
	return 0;
}

Measured memory_bytes: 3236
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;


int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

const string MINUSINF = "-";

void chmax(string &a, string b){
  if(a == MINUSINF) a = b; //aが初期値と等しい時ときはbを格納
  else if(a.size() < b.size()) a = b; //bの方が文字数が大きいときは明らかにbが大きいのでbを格納
  else if(a.size() == b.size()){//aとbの文字数が同じ時
    if(a<b) a = b; //もし辞書順比較でbの方が大きければbを格納
  }
  //それ以外の時はaの方が大きいので何もしない
}

ll match[10] = {2,5,5,4,5,6,3,7,6};
string dp[11000]; //i本の時に作れる最大の数を格納

int main(){
  int n,m; cin >> n >> m;
  vector<int> a(m);
  rep(i,m) cin >> a[i];
  rep(i,11000) dp[i] = MINUSINF; //初期化。
  dp[0] = ""; //0本の時は文字が無い
  
  for(int i = 0; i <= n; i++){
    if(dp[i] == MINUSINF) continue; //初期値と同じ時はi本では文字が作れないという意味なので飛ばす
    for(auto a1:a) chmax(dp[i+match[a1-1]], dp[i] + (char)('0'+a1)); //配列aの中の文字全てを試す。一番大きいものをdpテーブルに格納
  }
  cout << dp[n] << endl;
  
  return 0;
}

Measured memory_bytes: 43776
#define _CRT_SECURE_NO_WARNINGS

//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(){
#ifdef DEBUG
	
#endif
	int N;
	scanf("%d", &N);

	int tmp = (int)sqrt(N);
	int ans = tmp*tmp;

	printf("%d\n", ans);
}

Measured memory_bytes: 128
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(18);
}
#define MAX 15
signed main(){
  init_io();
  ll k,sum=0,mk=-1;
  cin >> k;
  string ans;
  ll dp[15][10]={};
  for(int i=0;i<10;i++){
    dp[0][i] = 1;
  }
  for(int i=1;i<MAX;i++){
    for(int j=0;j<10;j++){
      if(j!=0) dp[i][j] += dp[i-1][j-1];
      dp[i][j] += dp[i-1][j];
      if(j!=9) dp[i][j] += dp[i-1][j+1];
    }
  }
  for(int i=0;i<MAX;i++){
    for(int j=1;j<10;j++){
      if(dp[i][j]>=k){
        ll idx = i-1,s,e;
        ans += to_string(j);
        s = max(0,j-1);
        e = min(9,j+1);
        while(idx>=0){
          for(int l=s;l<=e;l++){
            if(dp[idx][l]<k){
              k -= dp[idx][l];
            }else{
              ans += to_string(l);
              s = max(0,l-1);
              e = min(9,l+1);
              break;
            }
          }
          idx--;
        }
        cout << ans << endl;
        return 0;
      }else{
        k -= dp[i][j];
      }
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod ((long long)(1e9 + 7))

int main(void) {
  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  for (int i = 0; i < H; i++) {
    cin >> a[i];
  }
  vector<vector<long long>> dp(H + 1, vector<long long>(W, 0));
  dp[0][0] = 1;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (i == 0 && j == 0) continue;
      if (a[i][j] != '#') {
        if (i - 1 >= 0) dp[i][j] += dp[i - 1][j];
        dp[i][j] %= mod;
        if (j - 1 >= 0) dp[i][j] += dp[i][j - 1];
        dp[i][j] %= mod;
      }
    }
  }
  cout << dp[H - 1][W - 1] << endl;
  return 0;
}

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

int main()
{
    int n, m; std::cin >> n >> m;
    std::vector<int> x(m);
    for (int i = 0; i < m; i++) {
        std::cin >> x[i];
    }
    if (n >= m) {
        std::cout << 0 << std::endl;
        return 0;
    }
    std::sort(x.begin(), x.end());

    int td = x.back() - x.front();

    std::vector<int> d(m-1);
    for (int i = 1; i < m; i++) {
        d.push_back(std::abs(x[i-1] - x[i]));
    }
    std::sort(d.begin(), d.end(), std::greater<int>());

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

    std::cout << td << std::endl;

    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>

int main()
{
	int N, i;
	char S;
	char *ans;
	ans="Three";

	scanf("%d", &N);
	
	for(i=1; i<=N; i++){
		scanf("%c", &S);
		if(S=='Y'){
			ans="Four";
		}
	}
	printf("%s\n", ans);

	return 0;
}

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

int main() {
  int D, N;
  cin >> D >> N;
  int s = N;
  if (s == 100) s++;
  
  for (int i = 0; i < D; i++) {
    s *= 100;
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string str;
	cin >> str;
	int size = str.size();
	for(int i = size - 1; i >= 0; --i)
	{
		cout << str[i];
	}
	cout << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
ll MM = 1000000000; ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
int dh[4] = {-1, 0, 0, 1};
int dw[4] = {0, -1, 1, 0}; 
using P = pair<int, int>;
const double pi = acos(-1.0);

using Graph = vector<vector<ll>>;

int main(){
  int n,k;
  cin>>n>>k;
  if(n==1){cout<<k<<endl;return 0;}

  ll tmp=k;
  rep(i,n-1)tmp=tmp*(k-1);
  cout<<tmp<<endl;
    
    
  return 0;
}


Measured memory_bytes: 3632
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>

using namespace std;

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

typedef pair<int, int> p_i;

int main()
{
    int a, b;
    cin >> a >> b;
    if (a <= 8 && b <= 8)
        cout << "Yay!" << endl;
    else
        cout << ":(" << endl;
    return 0;
}

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

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

long long N;
vector<pair<long, long>> BA;

int main() {

	cin >> N;

	rep(i,N)
	{
		int j, k;
		cin >> j >> k;
		BA.push_back(make_pair(k, j));
	}

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

	int time = 0;

	rep(i,N)
	{
		time += BA.at(i).second;
		if(time > BA.at(i).first)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	return 0;
	
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <string.h>
 
#define rep(i,n)    for(ll i=0;i<n;i++)
#define repu(i,k,n) for(ll i=k;i<=n;i++)
#define repd(i,k,n) for(ll i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define endl "\n"
#define INF (ll)ll_MAX
 
typedef long long ll;
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector<ll> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, ll > > vpp;
 
const ll N = 3*1e5 +5 ;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
const long long inf = 1e18;
 
using namespace std;

 

void solve()
{	
    ll n;
    cin>>n;

    ll ans = 0;
    for(ll i=1;i<=n;i++){
        ans+=i*(n-i+1);
    }

    ll u[n],v[n];
    for(ll i=1;i<n;i++) cin>>u[i]>>v[i];

    for(ll i=1;i<n;i++){
        ll minn = min(u[i],v[i]);
        ll maxx = u[i]+v[i]-minn;
        ans-= minn*(n-maxx+1);
    }

    cout<<ans;

    
}
     
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    //cout<<"helo";
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    ll t = 1;
    // cin>>t;
    ll ctr=0;
    while(t--)
    {   
        ctr++;
        if (ctr==14) cout<<1;
        solve();    
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
}

Measured memory_bytes: 6896
#include<algorithm>
#include<iostream>
#include<cstdio>
#define MN 100000
using namespace std;
inline 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;
}
int n,m,a[MN+5],p[MN+5],vis[MN+5],q[MN+5],top,b[MN+5];
long long K;
int main()
{
	n=read();
	for(int i=1;i<=n;++i) p[i]=read();
	for(int i=1;i<n;++i) a[i]=i;
	m=read();cin>>K;
	for(int i=1;i<=m;++i)
	{
		int x=read();
		swap(a[x-1],a[x]);	
	}
	for(int i=1;i<n;++i) if(!vis[i])
	{
		vis[q[top=1]=i]=1;
		for(int x=a[i];!vis[x];x=a[x]) vis[q[++top]=x]=1;
		int add=top-K%top;
		for(int j=1;j<=top;++j) b[q[(j+add-1)%top+1]]=p[q[j]+1]-p[q[j]];
	}
	long long s=p[1];
	for(int i=1;i<=n;++i) printf("%lld\n",s),s+=b[i];
	return 0;
}



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

using namespace std;
typedef long long ll;
typedef long double lb;
#define mod 10000000007
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n"

int main(){
  int N,R;cin>>N>>R;
  if(N>=10)print(R);
  else print((R+100*(10-N)));
  return 0;
}


Measured memory_bytes: 256
# def gcd(a_gcd, b_gcd):
#     while b_gcd != 0:
#         a_gcd, b_gcd = b_gcd, a_gcd % b_gcd
#     return a_gcd
#
#
# def lcm(a_lcm, b_lcm):
#     return a_lcm * b // gcd(a_lcm, b_lcm)
#
#
# def max_sum(N_max_sum, a_max_sum):
#     dp = [0] * (N_max_sum + 1)
#     for i in range(N_max_sum):
#         dp[i + 1] = max(dp[i], dp[i] + a_max_sum[i])
#     return dp[N]
#
#
# def knapsack(N_knapsack, W, weight, value):
#     inf = float("inf")
#     dp = [[-inf for _ in range(W+1)] for j in range(N_knapsack + 1)]
#     for i in range(W+1):
#         dp[0][i] = 0
#
#     for i in range(N_knapsack):
#         for w in range(W+1):
#             if weight[i] <= w:
#                 dp[i+1][w] = max(dp[i][w-weight[i]]+value[i], dp[i][w])
#             else:
#                 dp[i+1][w] = dp[i][w]
#     return dp[N_knapsack][W]
#
#
# class UnionFind:
#     def __init__(self, n):
#         self.par = [i for i in range(n+1)]
#         self.rank = [0] * (n+1)
#
#     # 検索
#     def find(self, x):
#         if self.par[x] == x:
#             return x
#         else:
#             self.par[x] = self.find(self.par[x])
#             return self.par[x]
#
#     # 併合
#     def union(self, x, y):
#         x = self.find(x)
#         y = self.find(y)
#         if self.rank[x] < self.rank[y]:
#             self.par[x] = y
#         else:
#             self.par[y] = x
#             if self.rank[x] == self.rank[y]:
#                 self.rank[x] += 1
#
#     # 同じ集合に属するか判定
#     def same_check(self, x, y):
#         return self.find(x) == self.find(y)
#
# S = input()
# N = int(input())
# A = list(map(int, input().split()))

N, M = map(int, input().split())
L = []
R = []

for i in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

print(max(0, min(R) - max(L) + 1))




Measured memory_bytes: 55896
"""
~~ Author : Bhaskar
~~ Dated : 13~06~2020
"""

import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque

INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize) - 1
mod = 1000000007
ch = "abcdefghijklmnopqrstuvwxyz"
lcm = lambda a, b: (a * b) // gcd(a, b)
setbit = lambda x: bin(x)[2:].count("1")
INT = lambda type: type(sys.stdin.readline()) if type in [int, float] else type(sys.stdin.readline()).replace("\n", "")
ARRAY = lambda type: list(map(type, sys.stdin.readline().split()))
NUMS = lambda type: map(type, sys.stdin.readline().split())


def solve():

    n = INT(int)
    a = ARRAY(int)
    if 0 in a:
        print(0)
    else:
        p = 1
        ok = False
        for i in a:
            p *= i
            if p > 10**18:
                ok = True
                break
        print(p if not ok else -1)



if __name__ == "__main__":
    # try:
    #     sys.stdin = open("input.txt", "r")
    # except:
    #     pass
    solve()


Measured memory_bytes: 22684
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << -1; return;}

void solve() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    s[k - 1] = char(tolower(s[k - 1]));
    cout << s;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define vout(v) cout<<#v<<": ";for(int i=0;i<(int)v.size()-1;i++){cout<<v[i]<<" ";}cout<<v[v.size()-1]<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL);
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cerr<<#a<<" "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
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;
}

const string YES = "Yes";
const string NO = "No";
#define judge(f) cout<<(f?YES:NO)<<"\n";

void solve(long long N){
    bool flg = false;
    for (ll i = 0; i < 10; i++) {
        for (ll j = 0; j < 10; j++) {
            if(i*j == N){flg = true;}
        }
    }
    judge(flg);
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())

lis = [[] for i in range(N)]
rlis = [[] for i in range(N)]
mlis = [0] * N

for i in range(M):

    s,t = map(int,input().split())
    s -= 1
    t -= 1

    lis[s].append(t)
    rlis[t].append(s)


odp = [0] * N

for i in range(N):

    i = N - 1 - i

    for j in lis[i]:

        odp[i] += (odp[j] + 1)/len(lis[i])
        

ans = odp[0]


for k in range(N):

    dp = [0] * N
    flag = True

    for i in range(N):

        i = N - 1 - i

        if i != k:

            if k < i:
                dp[i] = odp[i]

            else:

                for j in lis[i]:

                    dp[i] += (dp[j] + 1)/len(lis[i])

        else:

            maxi = 0

            for j in lis[i]:

                maxi = max(maxi,dp[j])
                dp[i] += (dp[j] + 1)

            if len(lis[i]) > 1:
                dp[i] = (dp[i]-(maxi+1)) / (len(lis[i])-1)

            else:
                flag = False
                
    #print (k,dp)

    if flag:
        ans = min(ans,dp[0])

print (ans)


    
    


Measured memory_bytes: 76376
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<char>> v(h,vector<char>(w));
    int black=0;
    rep(i,0,h)rep(j,0,w){
        cin>>v[i][j];
        if(v[i][j]=='#')black++;
    }
    
    queue<P> q;
    vector<vector<int>> d(h,vector<int>(w,-1));
    d[0][0]=0;
    q.push(P(0,0));
    
    while(!q.empty()){
        P p;
        p=q.front();
        q.pop();
        if(p.fi==h-1&&p.se==w-1)break;
        rep(i,0,4){
            int nx=p.se+dx[i],ny=p.fi+dy[i];
            if(0<=nx&&0<=ny&&nx<w&&ny<h &&v[ny][nx]!='#' &&d[ny][nx]==-1){
                q.push(P(ny,nx));
                d[ny][nx]=d[p.fi][p.se]+1;
            }
        }
    }
    if(d[h-1][w-1]==-1)cout<<-1<<endl;
    else cout<<h*w-black-d[h-1][w-1]-1<<endl;
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, m, v, p) = readLine()!!.split(' ').map(String::toLong)
    val aList = readLine()!!.split(' ').map(String::toLong).sortedDescending()
    val aListSum = mutableListOf(aList[0])
    (1 until n.toInt()).forEach { aListSum.add(aListSum.last() + aList[it]) }
    val lastP = aList[p.toInt() - 1]
    var ans = p
    while (true) {
        if (aList[ans.toInt()] != lastP || ans == n - 1) break
        ans++
    }
    for (i in ans.toInt() until n.toInt()) {
        val right = n - i
        val cur = aList[i]
        var totalValue = m * v
        totalValue -= (p - 1) * m
        totalValue -= right * m
        val curAdded = (cur + m).toDouble()
        val betweenTotal = aListSum.getOrElse(i - 1){0} - aListSum.getOrElse(p.toInt() - 2) { 0 }
        val temp = (betweenTotal + totalValue).toDouble() / (n - right - (p - 1)).toDouble()

        if (curAdded >= lastP && curAdded >= temp) {
            ans++
        } else {
            break
        }
    }
    println(ans)
}

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

int main() {
    int num_query; cin >> num_query;
    int command, x;
    string key;
    map<string, int> M;
    
    for (int i = 0; i < num_query; ++i) {
        cin >> command >> key;
        switch (command) {
            case 0:
                cin >> x;
                M[key] = x;
                break;
            case 1:
                cout << M[key] << endl;
                break;
        }
    }
    
    return 0;
}


Measured memory_bytes: 27788
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  string s, t;
  cin >> n >> s >> t;
  rep(i, n) cout << s[i] << t[i];
  cout << endl;
}

Measured memory_bytes: 3624
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<int64> dp(n + 1);
  dp[0] = 1000;
  for (int i = 1; i <= n; ++i) {
    dp[i] = dp[i - 1];
    int best = a[i - 1];
    for (int j = i - 2; j >= 0; --j) {
      best = min(best, a[j]);
      if (best < a[i - 1]) {
        dp[i] = max(dp[i], dp[j] / best * a[i - 1] + dp[j] % best);
      }
    }
  }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 3184
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int m;
cin>>m;
int tmp;
long long cnt=0;
for(int i=0;i<m;i++){
    cin>>tmp;
    cnt+=tmp;
}
printf("%d",(n-cnt>=0)?(n-cnt):-1);

}


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

int main(){
    int i, N, digits[4];
    cin >> N;
    for(i=0;i<4;i++){
        digits[3-i] = N % 10;
        N /= 10;
    }
    for(i=0;i<=4-3;i++){
        if(digits[i] == digits[i+1] && digits[i+1] == digits[i+2]){
            cout << "Yes" << endl;
            N = 1;
            break;
        }
    }
    if(N == 0) cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
   long long a,b,c,k;
   cin>>a>>b>>c>>k;
   long long ans=0;
    if(k<=a)
        {
            ans=ans+k;
            cout<<ans<<endl;
            return 0;
        }
        else
        {
            ans=ans+a;
            k=k-a;
        }
        k=k-b;
        if(k<=0)
        {
            cout<<ans<<endl;
        }
        else
        {
            cout<<ans-k<<endl;
        }

}


Measured memory_bytes: 3632
package main

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

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
    buf := make([]byte, 0, 1000000)
    for {
        l, p, e := rdr.ReadLine()
        if e != nil {
            panic(e)
        }
        buf = append(buf, l...)
        if !p {
            break
        }
    }
    return string(buf)
}

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
    sc.Scan()
    return sc.Text()
}


func main(){
	var S, T string
	fmt.Scan(&S)
	fmt.Scan(&T)
	fmt.Println(T+S)
}


Measured memory_bytes: 640
<?php

fscanf(STDIN, "%d", $input_count);
$str_arr = [];

for ($i = 0; $i < $input_count; ++$i) {
    fscanf(STDIN, "%s %s", $command, $str);
    if ($command == "insert") {
        $str_arr[$str] = 1;
        continue;
    }
    
    if (isset($str_arr[$str])) echo "yes\n";
    else echo "no\n";
} 




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

int main()
{
    int n,i;
    double a[55],s=0;

    cin>>n;

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

    s=a[0];

    for(i=1;i<n;i++){
        s=(s+a[i])/2;
    }
    cout<<s<<endl;

    return 0;
}




Measured memory_bytes: 256
import sys

A = input()
B = input()

if len(A)>len(B):
    print("GREATER")
elif len(A)<len(B):
    print("LESS")
else:
    for i in range(len(A)):
        if A[i] > B[i]:
            print("GREATER")
            sys.exit()
        elif A[i] < B[i]:
            print("LESS")
            sys.exit()
        else:
            continue
    else:
        print("EQUAL")

Measured memory_bytes: 9136
#include<stdio.h>
int main()
{
	int n;
	char*p,s[32];
	while(scanf("%d",&n),n)
	{
		sprintf(s,"%o",n);
		for(p=s;*p;++p)if(*p>'4')*p+=2;else if(*p>'3')*p+=1;
		puts(s);
	}
	return 0;
}

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

int main() {
  int x1,x2,x3,x4,x5;
  cin >> x1 >> x2 >> x3 >> x4 >> x5;
  if (x1 == 0) cout << 1 << endl;
  if (x2 == 0) cout << 2 << endl;
  if (x3 == 0) cout << 3 << endl;
  if (x4 == 0) cout << 4 << endl;
  if (x5 == 0) cout << 5 << endl;

 }

Measured memory_bytes: 3524
x, k, d = map(int, input().split())
x = abs(x)
ans = 0
if x > d:
    p = x - d*k
    if p >= 0: ans = p
    else:
        skips = x//d
        rem = x - d*skips
        if (k-skips)%2==0: ans = rem
        else: ans = rem-d
else:
    if k%2==0: ans = x
    else: ans = abs(x-d)
print(abs(ans))

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

using namespace std;
using ll = long long;

int main() {
    int N, M;
    cin >> N >> M;
    int l, r;
    int L = 0, R = N;

    for(int i = 0; i < M; i++) {
        cin >> l >> r;
        L = max(L,l);
        R = min(R,r);
        //cout << l << ',' << r << endl;
    }
    cout << (R - L >= 0)*(R - L + 1) << endl;

    return 0;
}

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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

#define DEGTORAD 0.01745329251

using namespace std;

struct Point{
    double x; double y;
};

void koch(int n, Point p1, Point p2){
    if ( n == 0 ) return;
    Point s,t,u;

    s.x = (2 * p1.x +     p2.x) / 3;
    s.y = (2 * p1.y +     p2.y) / 3;
    t.x = (    p1.x + 2 * p2.x) / 3;
    t.y = (    p1.y + 2 * p2.y) / 3;
    u.x = s.x + ( t.x - s.x ) * cos( 60 * DEGTORAD ) - ( t.y - s.y ) * sin( 60 * DEGTORAD );
    u.y = s.y + ( t.x - s.x ) * sin( 60 * DEGTORAD ) + ( t.y - s.y ) * cos( 60 * DEGTORAD );

    koch(n-1,p1,s);
    printf("%f %f\n",s.x,s.y);
    koch(n-1,s,u);
    printf("%f %f\n",u.x,u.y);
    koch(n-1,u,t);
    printf("%f %f\n",t.x,t.y);
    koch(n-1,t,p2);
}


int main (void) {
    int N;
    scanf("%d", &N);

    Point p1,p2;
    p1.x = 0.0; p1.y = 0.0;
    p2.x = 100.0; p2.y = 0.0;
    printf("%f %f\n",p1.x,p1.y);
    koch(N,p1,p2);
    printf("%f %f\n",p2.x,p2.y);
    return 0;
}


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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

int bf(int n){
    vi p(n);
    FOR(i,n) p[i]=i+1;
    int ans=0;
    do{
        int este=0;
        FOR(i,n) este += p[i]%(i+1);
        ans=max(ans,este);
    }while (next_permutation(p.begin(),p.end()));
    return ans;
}
int main() {
    READ(0);
    int n;cin>>n;
    cout << (ll)n*(n-1)/2;
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef list<ll> listl;
typedef string str;

#define min(A, B) min(static_cast<ll>(A), static_cast<ll>(B))
#define max(A, B) max(static_cast<ll>(A), static_cast<ll>(B))

void in(ll& I)
{
	cin >> I;
}

void in(vl& I)
{
	for (auto& i : I)
	{
		cin >> i;
	}
}

void in(listl& I)
{
	for (auto& i : I)
	{
		cin >> i;
	}
}

void in(str& s)
{
	cin >> s;
}

void out(ll& O)
{
	cout << O;
}

void out(ll O)
{
	cout << O;
}

void out(vl& O)
{
	for (auto& o : O)
	{
		cout << o;
	}
}

int main()
{
	ll A;
	in(A);

	ll P;
	in(P);

	ll N;
	N = A * 3 + P;

	out(N / 2);
	return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
 
#define MAX INT_MAX
#define ll long long int
#define M 1000000007;
 
int main(){
    ll n,d;
    ll count=0;
    cin>>n>>d;
    while(n--){
        ll p,q;
        cin>>p>>q;
		if((p*p + q*q)<=(d*d)) count++;
    }
  	cout<<count;
  return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;
const int INF = 1e9;
const ll LINF = 1e18;
const long MOD=1e9+7;


template<class T>
T lcm(T a,T b){
    return a/__gcd(a,b)*b;
}

int main(){
    
    int n;
    cin >> n;
    int a=ceil(double(n)/1000.0);
    cout << a*1000-n << endl;
    return 0;
}

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

#define ll long long int
#define pd push_back
#define mp make_pair
#define mod 1000000007

ll power(ll a,ll b){ll ans=1;while(b>0){if(b&1){ans = (ans*a);}b>>=1;a=a*a;}return ans;}
ll gcd(ll a,ll b){if(b==0){return a;}return gcd(b,a%b);}

int main() {
   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
   // cout << fixed << setprecision(10);
  ll n,k;
  cin>>n>>k;
  vector<set<ll>> arr(n);
  for(ll i=0;i<k;i++){
  	ll d,x;
    cin>>d;
    for(ll j=0;j<d;j++){
    	cin>>x;
      	arr[x-1].insert(i+1);
    }
  }
  ll ans=0;
  for(ll i=0;i<n;i++){
      ll p=arr[i].size();
      if(p==0){
          ans++;
      }
  }
  cout<<ans<<endl;
  
	return 0;
}


Measured memory_bytes: 3988
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,x,p,s=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        if(i%5==0 || i%3==0)
            continue;
        else
            s+=i;
    }

cout<<s;
}


Measured memory_bytes: 3648
import java.util.Scanner;

    public class Main{
    public static void main(String[] args){
        int i,count=0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S;
        S = new int[n];
        for(i=0;i<n;i++){
            S[i]=sc.nextInt();
        } 
        int q = sc.nextInt();
        int[] T;
        T = new int[q];
        for(i=0;i<q;i++){
            T[i]=sc.nextInt();
        }
        for(i=0;i<q;i++){
            int l=0,r=n-1;
            while(l<r){
                int m=(l+r)/2;
                if(S[m]<T[i]) l = m+1;
                else r=m;
            }
            if(S[l]==T[i]) count++;
        }
        System.out.println(count);
        sc.close();
    }
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
#define MAX_N 100010

bool primeNumber(ll x){
  if(x == 1)
    return false;
  for(int i = 2; i <= sqrt(x); i++){
    if(x % i == 0)
      return false;
  }

  return true;
}

bool match2017(ll x){
  if(x % 2 == 0)
    return false;
  else
    return primeNumber(x) && primeNumber((x+1)/2);
}

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

  ll q;
  cin >> q;
  vll l(q), r(q);
  REP(i, q)
    cin >> l[i] >> r[i];

  ll now = 0;
  vll cumlative(MAX_N, 0);
  REP1(i, MAX_N){
    if(match2017(i))
      now++;
    cumlative[i] = now;
  }


  REP(i, q)
    cout << cumlative[r[i]] - cumlative[l[i]-1] << endl;


}


Measured memory_bytes: 2944
#include<stdio.h>
int n,h[100000],i,r=0,q=0;
int main(){
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&h[i]);
    for(i=-1;i<n-2;q=0){
        while(h[++i]>=h[i+1]){
            q++;
            if(i>n-3)break;
        }
        if(r<q)r=q;
    }
    printf("%d",r);
    return 0;
}

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

int main() {
    using namespace std;
    ios::sync_with_stdio(false);cin.tie(nullptr);
    int N, K; cin >> N >> K;
    vector<int> P(N);
    for (auto &p : P) cin >> p;
    sort(P.begin(), P.end());
    int ans = 0;
    for (int i = 0; i < K; ++i) ans += P[i];
    cout << ans << '\n';
}


Measured memory_bytes: 3540
#include<bits/stdc++.h>
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
    fast;
    int i,j=0,n,c=1,d=0;
    cin>>n;
    int a[n];
    vector<int> b;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    b.push_back(a[0]);
    for(i=1;i<n;i++)
    {
        if(a[i]<=b[j])
        {
            c++;
            b.push_back(a[i]);
            j++;
        }
    }
    cout<<c;

}


Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    ll h,w;
    cin>>h>>w;
    ll tmp1=max(h/3,h-(2*h/3))*w-min(h/3,h-(2*h/3))*w;
    ll tmp2=max(w/3,w-(2*w/3))*h-min(w/3,w-(2*w/3))*h;
    ll tmp3=1LL<<60;
    for(ll x=1;x<=w-1;x++){
        ll tmp=max({h*x,(w-x)*(h/2),(w-x)*(h-h/2)})-min({h*x,(w-x)*(h/2),(w-x)*(h-h/2)});
        tmp3=min(tmp3,tmp);
    }
    ll tmp4=1LL<<60;
    for(ll x=1;x<=h-1;x++){
        ll tmp=max({w*x,(h-x)*(w/2),(h-x)*(w-w/2)})-min({w*x,(h-x)*(w/2),(h-x)*(w-w/2)});
        tmp4=min(tmp4,tmp);
    }
    //cout<<tmp1<<" "<<tmp2<<" "<<tmp3<<" "<<tmp4<<endl;
    cout<<min({tmp1,tmp2,tmp3,tmp4})<<endl;
}

Measured memory_bytes: 3628
import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write(' '.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
from decimal import Decimal
from fractions import Fraction
#sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1e9)+7


k=int(data())
cnt=7
for i in range(1000001):
    if cnt%k==0:
        out(i+1)
        exit()
    cnt=(cnt*10+7)%k
out(-1)






Measured memory_bytes: 73120
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define fo(i,n) for(i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define MAXN 1000002
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
void solve()
{
  int n;
  cin>>n;
  vector<int> V(n);
  for(int i=0;i<n;i++)
  cin>>V[i];

  int cnt=0;
  for(int i=0;i<n;i++)
  {
    if(i%2==0 && V[i]%2==1)
    cnt++;
  }
  cout<<cnt<<endl;
}

int main()
{
  fastio
  solve();
}


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

int main() {
  string op;
  stack<int> S;
  while (cin >> op) {
    if (op == "+") {
      auto a = S.top();
      S.pop();
      auto b = S.top();
      S.pop();

      S.push(a + b);
    } else if (op == "-") {
      auto a = S.top();
      S.pop();
      auto b = S.top();
      S.pop();

      S.push(b - a);
    } else if (op == "*") {
      auto a = S.top();
      S.pop();
      auto b = S.top();
      S.pop();

      S.push(a * b);
    } else {
      S.push(stoi(op));
    }
  }
  cout << S.top() << endl;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            input_iter = LazyLoadAllLines();
            //------------------------------------------------//
            //var n = Read<long>();
            var a = Read<long>();
            var b = Read<long>();
            //var c = Read<long>();
            //var x = Read<long>();
            //var als = Read<long>(n);

            //als.Sort((l, r) => (int)(r - l));

            var gcd = a > b ? GCD(a, b) : GCD(b, a);

            Dictionary<long, long> counter = new Dictionary<long, long>();
            long num = 1;
            counter[1] = 1;
            var y = PrimeFactors(gcd).ToList();
            foreach (var x in PrimeFactors(gcd)) {
                if (counter.ContainsKey(x)) ++counter[x];
                else counter.Add(x, 1);
                ++num;
            };

            /*HashSet<long> count = new HashSet<long>();
            foreach(var kv in counter)
            {
                
            }*/

            Console.WriteLine(counter.Keys.Count);

        }

        public static long GCD(long a, long b)
        { // a > b
            if (b == 0) return a;
            a = a % b;
            return a > b ? GCD(a, b) : GCD(b, a);
        }

        public static IEnumerable<long> PrimeFactors(long n)
        {
            long i = 2;
            long tmp = n;

            while (i * i <= n)
            {
                if (tmp % i == 0)
                {
                    tmp /= i;
                    yield return i;
                }
                else
                {
                    i++;
                }
            }
            if (tmp != 1) yield return tmp;
        }



        static IEnumerator<string> input_iter;

        static _T Read<_T>() where _T : struct
        {
            input_iter.MoveNext();
            return (_T)Convert.ChangeType(input_iter.Current, typeof(_T));
        }
        static string Read()
        {
            input_iter.MoveNext();
            return input_iter.Current;
        }
        static List<_T> Read<_T>(long num) where _T : struct { return new List<_T>(Enumerate<_T>(num)); }


        static IEnumerable<_T> Enumerate<_T>(long num)
        {
            for (long i = 0; i < num; ++i)
            {
                input_iter.MoveNext();
                yield return (_T)Convert.ChangeType(input_iter.Current, typeof(_T));
            }
        }
        static IEnumerator<string> LazyLoadAllLines()
        {
            string line;
            do
            {
                line = Console.ReadLine();
                foreach (var s in line.Split(' '))
                    yield return s;
            } while (line != null);
        }
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<set>
using namespace std;

int n,m,k,i,j,a[110],num1,num2,num3;
char ch;

int main()
{
    cin>>n>>m;
    for (i=0;i<n;i++)
    for (j=0;j<m;j++) {cin>>ch;a[ch-'a']++;}
    for (i=0;i<26;i++) 
    {
        if (a[i]>=4)
        {
          num1+=a[i]/4;
          a[i]=a[i]%4;
        }
        if (a[i]>=2)
        {
            num2+=a[i]/2;
            a[i]=a[i]%2;
        }
        if (a[i]==1)
            num3++;
    }
    if ((num3>1)||(num1<(n/2)*(m/2))||(num2+2*(num1-(n/2)*(m/2))<(
    (n*m-(n/2)*(m/2)*4)/2))) {cout<<"No";return 0;}
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 256
square = [input().split(" "), input().split(" "), input().split(" ")]
n = int(input())

for i in range(n):
    num = input()
    for row in square:
        if num in row:
            row[row.index(num)] = 'x'

if square[0][0] == square[0][1] == square[0][2] == 'x' or square[1][0] == square[1][1] == square[1][2] == 'x' or square[2][0] == square[2][1] == square[2][2] == 'x' or square[0][0] == square[1][0] == square[2][0] == 'x' or square[0][1] == square[1][1] == square[2][1] == 'x' or square[0][2] == square[1][2] == square[2][2] == 'x' or square[0][0] == square[1][1] == square[2][2] == 'x' or square[0][2] == square[1][1] == square[2][0] == 'x':
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064