akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<queue>
#include<utility>
#define INF 1e9
using namespace std;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;//????????????bit?????????

struct edge{
  int to, weight;
};

int dp[1000][5000];//vertex, bit
vector<edge> G[1000];
int drop[10], term[10];

piii init(int a, int b, int c){
  return piii(a, pii(b,c));
}

int update(int bit, int to, int k){
  for(int i = 0; i < k; i++){
    if(drop[i] == to){
      bit = bit | (1 << (2*i));
    }
  }
    
  for(int i = 0; i < k; i++){
    if(term[i] == to && 0 < (bit & (1 << 2*i) ) ){
      bit = bit | (1 << (2*i + 1));
    }
  }

  return bit;
}

int main(){
  int n,m,k,p;

  cin >> n >> m >> k >> p;
  p--;
  for(int i = 0; i < m; i++){
    int from;
    edge e;
    cin >> from >> e.to >> e.weight;
    from--;e.to--;
    G[from].push_back(e);
    G[e.to].push_back((edge){from, e.weight});
  }

  for(int i = 0; i < k; i++){
    cin >> drop[i] >> term[i];
    drop[i]--;term[i]--;
  }

  for(int i = 0; i < 1000; i++){
    for(int j = 0; j < 5000; j++){
      dp[i][j] = INF;
    }
  }

  priority_queue<piii, vector<piii>, greater<piii> > que;
  que.push(init(0, 0, p));
  dp[p][0] = 0;
  while(!que.empty()){
    piii pos = que.top();que.pop();
    int cost = pos.first;
    int bit = pos.second.first;
    int v = pos.second.second;
    // cout << "cost:" << cost << " ";
    // cout << " bit:" << bit  << " ";
    // cout << "   v:" << v    << endl;
    // cout << "G[" << v << "].size():" << G[v].size() << endl;
    // cout << "dp[" << v << "][" << bit << "]:" <<
    //   dp[v][bit] << endl;

    if(bit == (1 << (2*k) ) - 1){
      cout << cost << endl;
      return 0;
    }

    for(int i = 0; i < G[v].size(); i++){
      int new_bit = update(bit, G[v][i].to, k);
      if(G[v][i].weight + cost < dp[G[v][i].to][new_bit]){
        dp[G[v][i].to][new_bit] = G[v][i].weight + cost;
        que.push(init(dp[G[v][i].to][new_bit],
                      new_bit,
                      G[v][i].to) );
      }
    }
  }
  cout << "Cannot deliver" << endl;  
  return 0;
}

Measured memory_bytes: 22348
{-
	AOJ #1608
	title: Selection of Participants of an Experiment
	@kankichi573
-}
import Data.List
import Data.Functor

main = do dat <- getContents
          let mylist  =  map s2Int $  words dat
	  sequence_ $ map print $ map mindiff $ calc mylist [] 

calc :: [Int] -> [[Int]] -> [[Int]]
calc list   acc = if (length list) <= 1 then acc
                                        else calc (drop (head list)(tail list))
					          (acc ++ ((take (head list)(tail list)) <$ [1]))

mindiff :: [Int] -> Int
mindiff list = minimum (zipWith (-) (tail (sort list)) (sort list))

s2Int :: String -> Int
s2Int str = read str :: Int


     

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



int main(){
    int N;
    cin >> N;
    int ans=0;
    vector<int> p(N);
    for (int i=0;i<N;i++){
        cin >> p.at(i);
    }
    for (int i=1;i<N-1;i++){
        if ((p[i-1]<p[i] && p[i]<p[i+1]) || (p[i-1]>p[i] && p[i]>p[i+1])) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF=1e18,MOD=1e9+7;
int main(){
	int n;
	ll ans=0,sum_ab=0,sum_end_a=0,sum_start_b=0;
	cin>>n;
	vector<string>s(n);
	for(int i=0;i<n;i++){
		cin>>s[i];
		for(int j=0;j<s[i].length()-1;j++){
			if(s[i][j]=='A'&&s[i][j+1]=='B')ans++;
		}
		if(s[i][0]=='B'&&s[i][s[i].length()-1]=='A')sum_ab++;
		else if(s[i][0]=='B')sum_start_b++;
		else if(s[i][s[i].length()-1]=='A')sum_end_a++;
	}
	ans+=min(sum_end_a,sum_start_b);
	if(sum_ab>0)ans+=sum_ab-1;
	if(sum_ab>0&&(sum_end_a>0||sum_start_b>0))ans++;
	cout<<ans<<endl;
}


Measured memory_bytes: 896
from operator import itemgetter

N = int(input())

l = list()
for n in range(N):
    N, M = map(int, input().strip().split())
    l.append([N, M])

l.sort(key=itemgetter(0), reverse=True)
l.sort(key=itemgetter(1))

current_time = 0
for n, m in l:
    current_time += n
    if current_time > m:
        ans = 'No'
        break
    else:
        ans = 'Yes'

print(ans)

Measured memory_bytes: 38080
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

struct StronglyConnectedComponent {
	int N;
	vector<vector<int>> G, rG, T, C;
	vector<int> vs, used, belong;
	StronglyConnectedComponent(int n) :
		N(n), used(n), belong(n), G(n), rG(n)
	{}

	void add_edge(int from, int to) {
		G[from].push_back(to);
		rG[to].push_back(from);
	}
	void dfs(int v) {
		used[v] = 1;
		for (auto u : G[v]) {
			if (!used[u]) { dfs(u); }
		}
		vs.push_back(v);
	}
	void rdfs(int v, int k) {
		used[v] = 1;
		belong[v] = k;
		C[k].push_back(v);
		for (auto u : rG[v]) {
			if (!used[u]) { rdfs(u, k); }
		}
	}

	int build() {
		fill(used.begin(), used.end(), 0);
		vs.clear();
		for (int i = 0; i < N; ++i) {
			if (!used[i]) { dfs(i); }
		}
		fill(used.begin(), used.end(), 0);
		int k = 0;
		for (int i = vs.size() - 1; i >= 0; --i) {
			if (used[vs[i]]) { continue; }
			T.push_back(vector<int>());
			C.push_back(vector<int>());
			rdfs(vs[i], k++);
		}
		for (int i = 0; i < N; ++i) {
			for (auto u : G[i]) {
				if (belong[i] != belong[u]) {
					T[belong[i]].push_back(belong[u]);
				}
			}
		}
		for (int i = 0; i < k; ++i) {
			sort(T[i].begin(), T[i].end());
			T[i].erase(unique(T[i].begin(), T[i].end()), T[i].end());
		}
		return k;
	}
};

int main() {
	int N, M;
	cin >> N >> M;
	StronglyConnectedComponent scc(N);
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		scc.add_edge(a, b);
	}

	int K = scc.build();
	cout << K << "\n";
	for (int i = 0; i < K; ++i) {
		int n = scc.C[i].size();
		cout << n << " ";
		for (int j = 0; j < n; ++j) {
			cout << scc.C[i][j] << (j < n - 1 ? " " : "\n");
		}
	}

	return 0;
}


Measured memory_bytes: 103120
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long ll;
typedef long double ld;

bool sortdesc(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.first>b.first);
}

int main()
{
    int n,m,b;
    cin>>n>>m;
    ll a,c;
    vector<pair <ll,ll>> v;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        v.push_back({a,1});
    }
    for(int i=0;i<m;i++)
    {
        cin>>b>>c;
        v.push_back({c,b});
    }
    sort(v.begin(),v.end(),sortdesc);
    int num=0;
    ll res=0;
    for(auto i:v){
        if(num+i.second<=n)
        {
            res+=i.first*i.second;
            num+=i.second;
        }
        else
        {
            res+=i.first*(n-num);
            num = n;
            break;
        }
    }
    cout<<res<<endl;

}


Measured memory_bytes: 6256
const main = (input) => {
  const lines = input.trim().split("\n")
  const P = lines[1].split(" ").map(str => parseInt(str))

  const result = P.reduce((acc, cur) => {
    if (acc.minNum > cur) {
      return {minNum: cur, count: acc.count + 1};
    }
    return acc;
  }, {minNum: 1000000, count: 0})

  console.log(result.count);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 34500
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		int n = sc.nextInt();
		int[] a = new int[n + 1];
		//a[0] =0;
		int flag = 1;
		int count = 0;

		for (int i = 1; i < n + 1; i++) {
			a[i] = sc.nextInt();
		}

		for (int i = 1; i < n + 1; i++) {
			if (flag == 2) {
				break;
			}
			flag = a[flag];
			count++;
		}
		if (flag != 2) {
			count = -1;
		}
		System.out.println(count);

	}
}

Measured memory_bytes: 49640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        sc.close();

        int ans = a * b / 2;
        System.out.println(ans);
    }

}


Measured memory_bytes: 21460
def solve(n):
    best = 0
    ans = 0
    for i in range(20):
        for d in range(9, -1, -1):
            v = best + d * (10**i)
            if v <= n:
                best = v
                ans += d
                break
    return ans

assert solve(100) == 18
assert solve(9995) == 35
assert solve(3141592653589793) == 137

n = int(input())
print(solve(n))

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
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; }

// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}

#include <iostream>
using namespace std;

typedef long long ll;

ll mod = 1000000007;
//---------------------------------------------------------------------------------------------------
const int MAX = 1001000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
  int x, y;
  cin >> x >> y;
  if ((x+y) % 3 != 0) { 
    cout << 0 << endl;
    return 0;
  }
  COMinit();
  int move = (x+y)/3;
  int x1y2 = (move - (x-y))/2;
  int x2y1 = (move - (y-x))/2;
  // cout << move << " " << x1y2 << " " << x2y1 << endl;
  cout << COM(move, x1y2) << endl;
}


Measured memory_bytes: 23680
/*
 * Remember a 7.0 student can know more than a 10.0 student.
 * Grades don't determine intelligence, they test obedience. 
 * I Never Give Up.
 */
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define pb emplace_back
#define endl "\n"
#define f first
#define mp make_pair
#define s1 second
#define delrep  v.erase(unique(v.begin(),v.end()),v.end());
#define all(a)  (a).begin(),(a).end()
#define sz(x)   (int)x.size()
#define lll __int64
const int N=1e6+10;
const int M=1e3+7;
const int MOD =1e9+7;
using namespace std;
typedef long long ll;
vector<vector<ll>> adj(N);
vector<pair<ll,ll>>adj2[N];
vector<ll> vis(N),out(N); 
vector<ll> vx;
vector<ll>a(N);
set<ll>s;
ll n,m,k,ans,cnt,dis=0,ind;
bool visx[M][M];
int used[M][M];
char ch[M][M];
vector<int>ax(N),bx(N),b(N);
int idx[]={0,-1,0,1};
int idy[]={1,0,-1,0};
inline bool in (int x , int y) { return 1 <= x && x <n+1 && 1<= y && y <m+1; }
ll power(ll a, ll n, ll m = MOD) {
    if(n==0) return 1; ll p = power(a, n>>1, m); p=(p*p)%m;
    if(n&1) p=(p * a) % m;
    return p;
}
void dfs2(ll x, ll y=0)
{
   vis[x]=1; //cout<<x<<" "<<y<<endl;
   y+=ax[x]; bx[x]=y;
   for(auto i : adj[x]) {  if(!vis[i]) dfs2(i,y); } 

}
void dfs(ll x, ll y) 
{
   if(!in(x,y) || ch[x][y]=='*' || visx[x][y]) return;
   visx[x][y]=1;
   cnt++;
   used[x][y]=ind;
   for(int i=0;i<4;i++) dfs(x+idx[i],y+idy[i]);   
}
void dfsz(ll x,ll y, ll z)
{
  vis[x]=1;                                                                  
  if(a[x]^y!=b[x]) { vx.pb(x); y=!y; }
  for(auto i:adj[x]) if(!vis[i]) dfsz(i,z,y);                              
}
                                                    
int main() 
{  
   cin>>n>>k; for(int i=1;i<n;i++) { int x,y; cin>>x>>y; adj[x].pb(y); adj[y].pb(x); }
   while(k--) { int x1,y1; cin>>x1>>y1; ax[x1]+=y1;  }
   dfs2(1);
   for(int i=1;i<=n;i++) cout<<bx[i]<< " ";
}                                                                                                  




Measured memory_bytes: 98816
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define NP next_permutation
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;

template<class T> bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T> void decimal(T a){cout<<fixed<<setprecision(a);}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}

void YesNo(bool a){if(a) out("Yes"); else out("No");}
void yesno(bool a){if(a) out("yes"); else out("no");}
void YESNO(bool a){if(a) out("YES"); else out("NO");}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){ll c=1; while(b>0){if(b&1){c=a*c %mod;}a=a*a %mod;b>>=1;}return c;}
vi calc(ll x){vi res; while(x>0){res.eb(x%10);x/=10;}reverse(all(res)); return res;}

void solve() {
  string s;
  cin>>s;
  bool f=false;
  vector<string> v={"hi","hihi","hihihi","hihihihi","hihihihihi"};
  rep(i,5){
    if(s==v[i]){
      f=true;
      break;
    }
  }
  YesNo(f);
}

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


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

const int maxn=200005;

int a[maxn];

bool cmp(int a,int b)
{
	return a>b;
}

int main()
{
	int n,k;
	cin>>n>>k;
	int max=-0x3f3f;
	for(int i=1;i<=n;++i)
	{
		int x;
		cin>>x;
		max=(x>max)?x:max;
		a[x]++;
	}
	sort(a+1,a+1+max,cmp);
	int ans=0;
	for(int i=k+1;a[i];++i)
	{
		ans+=a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
int main(){
    char  word[10] = {}, moji[1001] = {} ;
    int i, r = 0;
    scanf("%s", word);
    for( i = 0; i < strlen( word ); i++ ){
        word[i] = tolower( word[i] );
    }
    for(;;){
        scanf("%s", moji);
        if( strcmp( moji, "END_OF_TEXT" ) == 0 ){
            break;
        }
        for( i = 0; i < strlen( moji ); i++ ){
            moji[i] = tolower( moji[i] );
        }
        if( strcmp( moji, word ) == 0 ){
            r++;
        }
    }
   printf("%d\n", r);
    return 0;
}

Measured memory_bytes: 552
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

class Main {
static ArrayList<edge> []adj;
static boolean []visited;
static int []dist;
public static boolean dfs(int u,int d)
{
	visited[u]=true;
	boolean ans=true;
	dist[u]=d;
	for(edge e:adj[u])
		if(visited[e.v])
			ans&=dist[e.v]==d+e.w;
		else
			ans &=dfs(e.v,d+e.w);
	return ans;
}
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(),m=sc.nextInt();
		adj=new ArrayList[n];
		visited=new boolean[n];
		dist=new int [n];
		
		for(int i=0;i<n;i++)
			adj[i]=new ArrayList();
		while(m-->0)
		{
			int u=sc.nextInt()-1,v=sc.nextInt()-1,w=sc.nextInt();
			adj[u].add(new edge(v,w));
			adj[v].add(new edge(u,-w));
			
		}
		boolean ans=true;
		for(int i=0;i<n;i++)
			if(!visited[i])
				ans&=dfs(i,0);
		System.out.println(ans?"Yes":"No");

	}
	static class edge
	{
		int v,w;
		edge(int a,int b)
		{
			v=a;w=b;
		}
	}
	static class Scanner
	{
		BufferedReader br;
		StringTokenizer st;
		public Scanner(InputStream S)
		{
			br=new BufferedReader(new InputStreamReader(S));
		}
		public String nextLine() throws IOException
		{
			return br.readLine();
		}
		public String next()  throws IOException
		{
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(nextLine());
			return st.nextToken();
		}
		public int nextInt()  throws IOException
		{
			return Integer.parseInt(next());
		}
		public double nextDouble()  throws IOException
		{
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException
		{
			return br.ready();
		}
	}
}


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

using namespace std;

void insertion_sort(vector<int> &A, int g, int &cnt) {
	for (int i = g; i < A.size(); ++i) {
		int v = A[i];
		int j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j+g] = A[j];
			j -= g;
			cnt++;
		}
		A[j+g] = v;
	}
}

void shell_sort(vector<int> &A, const vector<int> &G, int &cnt) {
	for (auto g: G) {
		insertion_sort(A, g, cnt);
	}
}

int main() {
	int n;
	cin >> n;
	vector<int> A(n);
	for (auto &Ai: A) {
		cin >> Ai;
	}

	vector<int> G;
	G.reserve(20);
	int x = 1;
	do {
		G.push_back(x);
		x *= 2.25;
	} while (x <= n);
	reverse(G.begin(), G.end());
	int cnt = 0;

	shell_sort(A, G, cnt);

	int m = G.size();
	cout << m << '\n';
	cout << G[0];
	for (int i = 1; i < m; ++i) {
		cout << ' ' << G[i];
	}
	cout << '\n' << cnt << '\n';
	for (auto Ai: A) {
		cout << Ai << '\n';
	}
}


Measured memory_bytes: 6628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            /*var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = ab[0];
            var b = ab[1];
            Console.WriteLine("{0} {1}",a*b,(a+b)*2);
            Console.ReadLine();
            var a = int.Parse(Console.ReadLine());
            var b = a / 60;
            var c = b / 60;
            Console.WriteLine("{0}:{1}:{2}", c, b % 60, a % 60);
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = ab[0];
            var b = ab[1];
            {
            if (a > b) 
            Console.WriteLine("a > b");
            if (a < b) 
            Console.WriteLine("a < b");
            if (a == b)
            Console.WriteLine("a == b");

            }
            var abc = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = abc[0];
            var b = abc[1];
            var c = abc[2];
                if (a<b && b<c) 
                {
                Console.WriteLine("Yes");
               }
            else
                Console.WriteLine("No");
        }*/
            var abcde = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = abcde[0];
            var b = abcde[1];
            var c = abcde[2];
            var d = abcde[3];
            var e = abcde[4];
            if (a >= c + e && c >= e && b >= d + e && d >= e) 
            {
                Console.WriteLine("Yes");
            }
                else
                Console.WriteLine("No");










        }
    }
    }

Measured memory_bytes: 9456
#include<stdio.h>

int main(){
	int i,j,a,b;
	while(scanf("%d",&a)!=EOF){
	int A[4]={},B[4]={},hit=0,brow=0,x[4]={};
	A[0]=a;
	for(i=1;i<4;i++){
	scanf("%d",&a);
	A[i]=a;
	}
	for(i=0;i<4;i++){
	scanf("%d",&b);
	B[i]=b;
	}
	hit=0;
		for(i=0;i<4;i++){
			if(A[i]==B[i]){
		hit=hit+1;
		x[i]=1;
	}
	}
	brow=0;
		for(i=0;i<4;i++){
		for(j=0;j<4;j++){
			if(A[i]==B[j] && x[i]!=1){
			brow=brow+1;
	}
	}
	}
	printf("%d %d\n",hit,brow);
	}
	return 0;
}

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

using namespace std;

typedef vector<int> VI;
#define PB push_back
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IFOR(v,it) for(VI::iterator it = (v).begin(); it != (v).end(); ++it)


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

  VI A;
  REP(i, N) {
    int a;
    cin >> a;
    A.PB(a);
  }
  SORT(A);
  int before = 0;
  int count = 0;
  int res = 0;
  IFOR(A,it) {
    if (before != *it) {
      if (count % 2 == 1)
        ++res;
      before = *it;
      count = 1;
    } else
      ++count;
  }
  if (count % 2 == 1)
    ++res;
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;int N,a,b,i,V[1<<20],f[1<<20];pair<int,int>R[1<<20];main(){for(cin>>N;i<N;cin>>a>>b,R[i]={a,a+b},i++);for(sort(R,R+N),V[N]=b=1;i--;){for(a=i+1;a<N&&R[a].first<R[i].second;a=f[a]);b=V[i]=(b+V[f[i]=a])%998244353;}cout<<*V;}

Measured memory_bytes: 5888
import java.util.Scanner;

/**
 * Created by zhangrunfeng on 2/21/20
 */
public class Main {

    private int N;
    private int[][] G;

    public int[] start;
    public int[] end;

    private int[] next;
    private int time;

    private boolean[] visit;

    public Main(Scanner sc) {
        N = sc.nextInt();
        G = new int[N][];
        for (int i = 0; i < N; i++) {
            G[i] = new int[N];
        }

        for (int i = 0; i < N; i++) {
            int u = sc.nextInt() - 1;
            int adjNum = sc.nextInt();
            for (int j = 0; j < adjNum; j++) {
                int v = sc.nextInt() - 1;
                G[u][v] = 1;
            }
        }

        start = new int[N];
        end = new int[N];
        next = new int[N];
        visit = new boolean[N];

        time = 1;
    }

//    private int getNext(int currNode) {
//        for(int i = 0; i < N; i++) {
//            if (!visit[i] && G[currNode][i] == 1) {
//                return i;
//            }
//        }
//        return -1;
//    }

    public void dfsVisit(int node) {
        start[node] = time;
        time++;
        visit[node] = true;

//        int nextNode = getNext(node);
//        while (nextNode != -1) {
//            dfsVisit(nextNode);
//            nextNode = getNext(node);
//        }
        for (int i = 0; i < N; i++) {
            if (!visit[i] && G[node][i] == 1) {
                dfsVisit(i);
            }
        }

        end[node] = time;
        time++;
    }

    public void dfs() {
        for (int i = 0; i < N; i++) {
            if (!visit[i]) {
                dfsVisit(i);
            }
        }
    }

    public void printResult() {
        for (int i = 0; i < N; i++) {
            System.out.println(i+1 + " " + start[i] + " " + end[i]);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.dfs();
        m.printResult();
    }
}


Measured memory_bytes: 28528
zipWith' :: (a -> b -> c) -> [a] -> [b] -> [c]
zipWith' f (a:as) (b:bs) = x `seq` x : zipWith' f as bs
  where
    x = f a b
zipWith' _ _ _ = []

lucas :: [Int]
lucas = 2 : 1 : zipWith' (+) lucas (tail lucas)

main :: IO ()
main = readLn >>= (print . (!!) lucas)


Measured memory_bytes: 508
//https://atcoder.jp/contests/abc128/tasks/abc128_a
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/














int A, P;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> A >> P;

	P += A * 3;
	int ans = P / 2;
	cout << ans << endl;
}













/* ///////////////////////// writeup1 start
///////////////////////// writeup1 end */
/* ///////////////////////// writeup2 start
///////////////////////// writeup2 end */

Measured memory_bytes: 256
N,M = map(int,input().split())
d,ans,wrong = [0]*N,0,0
for _ in range(M):
    p,s = input().split()
    p = int(p)-1
    if d[p] != -1:
        if s == "WA":
            d[p] += 1
        else:
            wrong += d[p]
            d[p] = -1
            ans += 1
print(ans,wrong)

Measured memory_bytes: 9584
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;
ll mypow(ll x, ll n, ll m) {
	if (n == 0) {
		return 1;
	}
	if (n % 2 == 0) {
		return mypow(x*x%m, n / 2, m);
	}
	else {
		return x * mypow(x, n - 1, m) % m;
	}
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
//テーブルをつくる前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;//mod pにおける1,2,,,nの逆元
	for (int i = 2; i < MAX; ++i) {
		fac[i] = fac[i - 1] * i%INF;
		inv[i] = INF - inv[INF%i] * (INF / i) % INF;
		finv[i] = finv[i - 1] * inv[i] % INF;
	}
}

ll COM(int n, int k) {
	if (n < k)return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % INF) % INF;
}
///////////////////////////////////////

int main() {
	ll x; cin >> x;
	ll ans = 0;
	ans += (x / 500)*1000;
	x %= 500;
	ans += (x / 5)*5;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
from itertools import combinations

def detect_v1(N, A):
    count = 0
    for n, m in combinations(range(len(A)), 2):
        if abs(n - m) == A[n] + A[m]:
            count += 1

    # print(count)
    return count


# i < j より
# j - i == A[j] + A[i]
# j - A[j] == i + A[i]

from collections import defaultdict

def detect_v2(N, A):
    dict_i = defaultdict(set)

    count = 0
    for n in range(N):
        dict_i[n +  A[n]].add(n)
        # print(f'n + A[n]: {n - A[n]}')
        if n - A[n] in dict_i:
            count += len(dict_i[n - A[n]])

    # print('hash_table:', dict_i)
    # print('count:', count)
    return count

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))

    c = detect_v2(N, A)
    print(c)


Measured memory_bytes: 85752
package main

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

var sc = bufio.NewScanner(os.Stdin)

type queue struct {
	q [1000000]process
	head int
	tail int
}

type process struct {
	name string
	time int
}

type processScheduler struct {
	q queue
	quantum int
	execTime int
}

func (q *queue) enqueue(p process) {
	q.q[q.tail] = p
	q.tail++
}

func (q *queue) dequeue() process {
	q.head++
	return q.q[q.head - 1]
}

func (q *queue) isEmpty() bool {
	return q.head == q.tail
}

func (ps *processScheduler) addProcess() bool {
	if ok := sc.Scan(); !ok {
		return false
	}
	pname := sc.Text()

	sc.Scan()
	ptime, _ := strconv.Atoi(sc.Text())
	ps.q.enqueue(process{pname, ptime})
	return true
}

func (ps *processScheduler) executeProcess() {

	// Get target process
	p := ps.q.dequeue()
	var leftTime int

	// Terminate Process
	if leftTime = p.time - ps.quantum; leftTime <= 0 {
		ps.execTime += p.time
		fmt.Println(p.name, ps.execTime)
		return
	}

	// re scheduling
	p.time -= ps.quantum
	ps.execTime += ps.quantum
	ps.q.enqueue(p)
}


func main() {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	pnum, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	quantum, _ := strconv.Atoi(sc.Text())

	ps := processScheduler{queue{}, quantum, 0}

	for i := 0; i < pnum; i++ {
		ps.addProcess()
	}

	for !ps.q.isEmpty() {
		ps.executeProcess()
	}
}


Measured memory_bytes: 54008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    ll A, B, C, K; cin >> A >> B >> C >> K;
    if (1e18 < abs(A - B)) {
        cout << "Unfair" << endl;
        return 0;
    }

    if (K % 2 == 0) cout << A - B << endl;
    else cout << B - A << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
long long int mod=1e9 +7;

long long int fast_exp(long long int base,long long int ex) {
    long long int res=1;
    while(ex>0) {
       if(ex%2==1) res=(res*base)%mod;
       base=(base*base)%mod;
       ex/=2;
    }
    return res%mod;
}
long long int gcd(long long int a, long long int b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
int n;cin>>n;
int cn=0;int an=0;
for(int i=3;i<=n;i+=2)
{   cn=0;
    for(int j=1;j<=i;j++)
    {
        if(i%j==0)cn++;
    }
    if(cn==8)an++;
}
  cout<<an<<"\n";
   return 0;
}


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

using namespace std;

int main()
{
    int h, a;
    cin >> h >> a;
    int ans = 0;
    if(h%a==0){
        ans = h/a;
    }else{
        ans = h/a + 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto P = aryread();
    long m = long.max;
    long ans;
    foreach (i; 0 .. N)
    {
        if (P[i] <= m)
            ans++;
        m = min(P[i], m);
    }
    writeln(ans);
}


Measured memory_bytes: 11664
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ull unsigned long long int
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)

#define PI 3.1415926535897932385
#define INF 1e18
#define EPS 1e-7
#define MAXN 1000000005
#define MOD 1000000007

void ayn(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

ll gcd(ll a, ll b)
{
    if (a == 0) return b;
    return gcd(b % a, a);
}
ll modpow(ll b, ll e, ll mod=MOD) {
    ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans; }
ll mulmod(ll a, ll b, ll mod)
{
    ll res = 0;
    a = a % mod;
    while (b > 0)
    {
        if (b % 2 == 1) res = (res + a) % mod;
        a = (a * 2) % mod;
        b /= 2;
    }
    return res % mod;
}
int binCoeff(int n, int k)
{
    int C[n + 1][k + 1]; int i, j;
    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= min(i, k); j++)
        {
            if (j == 0 || j == i) C[i][j] = 1;
            else C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
        }
    }
    return C[n][k];
}

const int maxn = 100005;
int dfs(ll v, ll ans2, vector<bool>& visited, vector<vector<ll>>& vc){
    visited[v]=true;
    ans2++;
    for(auto z:vc[v])
    {
        if(!visited[z])
        {
           ans2+=dfs(z,0,visited,vc);
        }
    }
    return ans2;
}

ll conv(string n)
{
    string num = n;
    ll dec_value = 0;
    int base = 1;

    int len = num.length();
    for (int i=0; i<len; i++) {
        if (num[i] == '1') dec_value += base;
        base = base * 2;
    }
    return dec_value;
}

int main(){
    fastio;
    ayn()
;    ll t; t=1;
    while(t--){
        ll x; cin>>x;
        ll c=0;
        ll y=100;
        while(y<x){
            y += (y/100);
            c++;
        }
        cout<<c;
    }
    return 0;
}


Measured memory_bytes: 3640
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using Tup = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fl cout<<flush;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl '\n'
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld pi=3.141592653589793238;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll A;
    cin >> A;
    ll B;
    cin >> B;
    prt(A*B)

    return 0;
}


Measured memory_bytes: 3544
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int A[100010];
int main()
{
	int N; cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	int ans = 0;
	bool d = false, u = false;
	for (int i = 0; i < N; i++) {
		if (!u && !d) {
			if (A[i] < A[i + 1]) u = true;
			else if (A[i] > A[i + 1]) d = true;
			continue;
		}
		else if (u) {
			if (A[i] > A[i + 1]) {
				ans++;
				u = false;
				d = false;
			}
		}
		else if (d) {
			if (A[i] < A[i + 1]) {
				ans++;
				u = false;
				d = false;
			}
		}
	}
	if (u || d) ans++;
	cout << ans << endl;
}


Measured memory_bytes: 640
fn main() {
  let (n, m) = {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut ws = s.split_whitespace(); // 空白区切りの単語に分解する
    let n: i32 = ws.next().unwrap().parse().unwrap(); // イテレータから値を取り出して整数に
    let m: i32 = ws.next().unwrap().parse().unwrap();
    (n, m)
  };

  let mut value = 1;
  let mut count = 0;
  loop {
    if value >= m {
      print!("{}", count);
      break;
    }
    value += n - 1;
    count += 1;
  }
}

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

#define mp make_pair

using namespace std;

typedef int32_t i32;
typedef uint32_t u32;
typedef int64_t i64;
typedef uint64_t u64;
typedef pair<int,int> pii;
typedef pair<i64,int> pli;
typedef pair<int,i64> pil;
typedef pair<i64,i64> pll;
typedef vector<int> vi;
typedef vector<i64> vl;

template <typename T>
T id(T b) {return b;};
template <class It>
bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It>
bool any(It f,It l){return std::any_of(f,l,id<bool>);}

int n,h,w;

int main()
{
  cin >> n >> h >> w;
  cout << (n-h+1)*(n-w+1) << endl;
  return 0;
}


Measured memory_bytes: 256
def v():
 from collections import deque
 H,W,N=map(int,input().split())
 e='X'*(W+2)
 M=e+''.join('X'+input()+'X'for _ in[0]*H)+e
 m=(1,-1,W+2,-W-2)
 def f(s,g):
  p,t=s,0
  q=deque()
  b=[1]*len(M);b[s]=0
  while 1:
   for d in m:
    n=p+d
    if'X'!=M[n]and b[n]:
     if M[n]==g:return(n,t+1)
     b[n]=0;q.append([n,t+1])
   p,t=q.popleft()
 s=M.find('S')
 a=0
 for i in range(1,N+1):
  s,t=f(s,str(i))
  a+=t
 print(a)
if'__main__'==__name__:v()


Measured memory_bytes: 14952
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n_bld = Integer.parseInt(sc.next());
        int wanted_colors = Integer.parseInt(sc.next());
        long[] h_each = new long[n_bld];
        for(int i=0; i<n_bld; i++){
            h_each[i] = Integer.parseInt(sc.next());
        }
        
        int visible_n=0;
        long cost=0, min=Long.MAX_VALUE;
        long highest_former=0;
        
        for(long bit=0; bit < (1<<n_bld); bit++){
            visible_n=0;
            highest_former=0;
            cost=0;
            for(int i=0; i<n_bld; i++){
                if(h_each[i] > highest_former){
                    highest_former=h_each[i];
                    visible_n++;
                }else if((bit&(1<<i)) > 0){
                    visible_n++;
                    highest_former++;
                    cost += (highest_former - h_each[i]);
                }
            }
            if((visible_n >= wanted_colors) && (cost < min)) min=cost;
        }
        
        //long min = get_min_yey(n_bld, wanted_colors, h_each, 0, 0, 0, 0);
        
        
        System.out.println(min);
    }
    /*private static long get_min_yey(int num, int desired, long[] h_each, long highest_former, int visible_n, long cost, int pos_now){
        if(visible_n >= desired) return cost;
        if((num - pos_now) < (desired - visible_n)) return Long.MAX_VALUE;
        
        if(h_each[pos_now] > highest_former) return get_min_yey(num, desired, h_each, h_each[pos_now], visible_n+1, cost, pos_now+1);
        long a = get_min_yey(num, desired, h_each, highest_former, visible_n, cost, pos_now+1);     //自分を無視した場合
        long b = get_min_yey(num, desired, h_each, highest_former+1, visible_n+1, cost+highest_former-h_each[pos_now]+1, pos_now+1);     //かさ上げした場合
        return Math.min(a, b);
    }*/
}

Measured memory_bytes: 22996
from collections import Counter
 
N = int(input())
S = list(input())
c = Counter(S)
left_facing_west = 0
right_facing_east = c['E']
ans = float('inf')
for s in S:
    if s == 'W':
        ans = min(ans,left_facing_west+right_facing_east)
        left_facing_west += 1
    else:
        right_facing_east -= 1
        ans = min(ans,left_facing_west+right_facing_east)
print(ans)

Measured memory_bytes: 6048
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

int main() {
  int n;
  S(n);
  string s;
  cin >> s;
  int ans = 0;
  int i = 0, j = n - 1;
  while(i <= j) {
    if(s[i] == 'R') i++;
    else if(s[j] == 'W') j--;
    else {
      ans++;
      i++;
      j--;
    }
  }
  P(ans);
  return 0;
}


Measured memory_bytes: 3876
//FIRST THINK THEN CODE.

  #include <bits/stdc++.h>


  using namespace std;

  typedef long long ll;

  #define rep(i,a,b) for(ll i=a;i<b;++i)
  #define rrep(i,a,b) for(ll i=a;i>b;--i)
  #define FOR(i,n)  for(ll i=0;i<n;i++)
  #define vi vector<int>
  #define vl vector<ll>
  #define ld long double
  #define vld vector<ld>
  #define vvi vector<vector<int>>
  #define vvl vector<vector<long long>>
  #define vvld vector<vector<ld>>
  #define pii pair<int,int>
  #define pll pair<long,long>
  #define vpii vector<pii>
  #define vpll vector<pll>
  #define ff first
  #define ss second
  #define pb push_back
  #define pf push_front
  #define mp make_pair
  #define lb lower_bound
  #define ub upper_bound
  #define bs binary_search
  #define d1(x) cout<<(x)<<endl
  #define d2(x,y) cout<<(x)<<" "<<(y)<<endl
  #define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
  #define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
  #define PI 3.1415926535897932384626433832795
  #define fix(f,n) fixed<<setprecision(n)<<f
  #define all(x) x.begin(),x.end()
  #define rev(p) reverse(p.begin(),p.end());
  #define endl "\n"
  #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  #define popcount(x) __builtin_popcountll(x)
  #define sz(x) ((ll)x.size())
  const ll M=1000000007;
  const ll MM=998244353;
  ll begtime = clock();
  #define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
  //#define _Find_next 
  //#define _Find_first 



  ll newmod(ll a,ll b)
  {
  return ((a%b)+b)%b;
  }


  ll powM(ll a,ll b,ll m )
  { 
  if(a<=0)return 0;
  a%=m;
  if(!b)return 1;
  ll ans=1LL;
  while(b)
  {
  if(b&1)ans=ans*a%m;
  a=a*a%m;
  b>>=1;
  }

  return ans;
  }



  ll poww(ll a,ll b)
  { 

  ll ans=1;
  while(b)
  {
  if(b&1)ans=ans*a;
  a=a*a;
  b>>=1;
  }

  return ans;

  }

  template<typename T,typename F>
  void chmax( T &a,F b){
  if(b>a)a=b;
  }

  template<typename T,typename F>
  void chmin( T &a,F b){
  if(b<a)a=b;
  }



  const ll N=1e5+5;



  int main()
  { 

  IOS;

ll n,x,t;
cin>>n>>x>>t;

ll y=(n+x-1)/x;

cout<<y*t;



  //end_routine();

  return 0;

  }

Measured memory_bytes: 3644
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    REP(i,0,n) if (s[i] == 'R') ++cnt;
    if (cnt > n - cnt) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    VI A(N); REP(i,N) cin >> A[i];

    int allsum = 1;
    int no = 1;
    REP(i,N){
        allsum *= 3;
        if(A[i]%2 == 0){
            no *= 2;
        }
        else{
            no *= 1;
        }
    }
    cout << allsum - no << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int d,t,s;
  cin >> d>>t>>s;
  if (d<=t*s)
  {
      cout << "Yes"<< endl;
  }
  else
  {
      cout << "No"<<endl;
  }
  
}

Measured memory_bytes: 3600
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let (n, m) = read_touple::<usize>();
    let ans = ((n-1) * n) / 2 + ((m-1) * m) / 2;
    println!("{}", ans); 
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_168
{
    class A
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            n = n % 10;
            if (n == 3)
            {
                WriteLine("bon");
            }else if (n == 0 || n == 1 || n == 6 || n == 8)
            {
                WriteLine("pon");
            }
            else
            {
                WriteLine("hon");
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 27468