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

using namespace std;

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

    set<int> st;
    for (int i = 0;i < n;++i)
        st.insert(a[i]);

    int k = st.size();
    if (k & 1) cout << k << endl;
    else cout << k - 1 << endl;

    return 0;
}

Measured memory_bytes: 5376
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var ab = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var k2 = Math.Abs(ab[0] + ab[1]);
            Console.WriteLine(k2 % 2 == 0 ? (k2 / 2).ToString() : "IMPOSSIBLE");
        }
    }
}


Measured memory_bytes: 13396
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		int[] cnt = new int[26];
		for(int i=0; i<S.length; i++)
			cnt[S[i]-'A']++;
		boolean ok = true;
		for(int i=0; i<26; i++)
			ok &= (cnt[i]==0 || cnt[i]==2);
		System.out.println(ok ? "Yes" : "No");
		
		sc.close();
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

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

    map <int, int> mp;

    int i, data;
    int flag = 0;
    for(i = 0; i < n; i ++)
    {
    	cin >> data;
    	mp[data] ++;
    	if(mp[data] == 2)
    		flag = 1;
    }

    if(flag == 1)
    	cout << "NO" << endl;
    else
    	cout << "YES" << endl;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
#define re register
inline int read(){
	re int t=0;
	re char v=getchar();
	while(v<'0'||v>'9')v=getchar();
	while(v>='0'&&v<='9'){
		t=(t<<3)+(t<<1)+(v^48);
		v=getchar();
	}
	return t;
}
int n,a,b,c,d;
int main(){
	scanf("%d",&a);
	if(a==1)++a;
	while(1){
		bool ia=0;
		for(re int i=2;i<=sqrt(a);++i){
			if(a%i==0){
				ia=1;
				break;
			}
		}
		if(!ia)break;
		++a;
	}
	printf("%d",a);
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define MAXN 100010

int n, m, q;
int color[MAXN], vq[MAXN], d[MAXN], c[MAXN], maxp[MAXN];
vector<int> adj[MAXN];

void dfs(int u, int p, int col){
	if(p<=maxp[u]) return ;
	maxp[u] = p;
	if(color[u]==0){
		color[u] = col;	
	}
	int tam = adj[u].size();
	for(int i=0; i<tam; i++){
		int v = adj[u][i];
		if(p>=1){
			dfs(v, p-1, col);		
		}
	}
}

int main(){
	while(scanf("%d %d", &n, &m)!=EOF){
		int u, v;
		for(int i=0; i<n; i++){
			adj[i].clear();
		}
		for(int i=0; i<m; i++){
			scanf("%d %d", &u, &v);
			u--; v--;	
			adj[u].push_back(v);
			adj[v].push_back(u);	
		}
		scanf("%d", &q);
		for(int i=0; i<q; i++){
			scanf("%d %d %d", &vq[i], &d[i], &c[i]);
			vq[i]--;
		}
		memset(color, 0, sizeof(color));
		memset(maxp, -1, sizeof(maxp));
		for(int i=q-1; i>=0; i--){
			dfs( vq[i], d[i], c[i]);
		}
		for(int i=0; i<n; i++){
			printf("%d\n", color[i]);
		}
	}
	return 0;
}

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

#define __STDC_FORMAT_MACROS
#define p64 PRId64

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(f, x, ...)                                                         \
    ([&] (decltype ((x)) ALL) {                                                \
        return (f) (begin (ALL), end (ALL), ##__VA_ARGS__);                    \
    }) (x)

using namespace std;
using ll = int64_t;

int main() {
    string S;
    cin >> S;
    string W[] = {"Sunny", "Cloudy", "Rainy"};
    cout << W[(ALL (find, W, S) - begin (W) + 1) % 3] << endl;
    return 0;
}

Measured memory_bytes: 3576
from sys import setrecursionlimit

setrecursionlimit(10**6)

def dfs(i, depth):
    visited[i] = True
    oe = depth%2
    ans[i-1] = oe
    count[oe] += 1
    nodes = tree[i]
    for node in nodes:
        if visited[node]:
            continue
        dfs(node, depth+1)
    


N = int(input())
ans = [-1]*N
tree = [[] for i in range(N+1)]
visited = [False]*(N+1)
count = [0, 0]
base = [1, 2, 3]
for i in range(N-1):
    a, b = map(int, input().split())
    tree[a] += [b]
    tree[b] += [a]
dfs(1, 0)
even_len = count[0]
odd_len = count[1]
if even_len > N//3 and odd_len > N//3:
    for i, oe in enumerate(ans):
        if base[oe] > N:
            ans[i] = str(base[2])
            base[2] += 3
        else:
            ans[i] = str(base[oe])
            base[oe] += 3
elif even_len <= N//3:
    for i, oe in enumerate(ans):
        if oe == 0:
            ans[i] = str(base[2])
            base[2] += 3
        elif base[0] <= N:
            ans[i] = str(base[0])
            base[0] += 3
        elif base[1] <= N:
            ans[i] = str(base[1])
            base[1] += 3
        else:
            ans[i] = str(base[2])
            base[2] += 3
elif odd_len <= N//3:
    for i, oe in enumerate(ans):
        if oe == 1:
            ans[i] = str(base[2])
            base[2] += 3
        elif base[0] <= N:
            ans[i] = str(base[0])
            base[0] += 3
        elif base[1] <= N:
            ans[i] = str(base[1])
            base[1] += 3
        else:
            ans[i] = str(base[2])
            base[2] += 3
print(' '.join(ans))

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

int is_odd(int a) {
	return a % 2 == 1 ? 1 : 0;
}

int is_even(int a) {
	return a % 2 == 0 ? 1 : 0;
}

int is_odd_or_even_both(int a, int b) {
	return ((is_odd(a) & is_odd(b)) || (is_even(a) & is_even(b))) ? 1 : 0;
}

int main()
{
	int h, w;
	while(1) {
		cin >> h >> w;
		if (h == 0 & w == 0) break;

		int i, j;
		for (i = 0; i < h; i++) {
			for (j = 0; j < w; j++) {
				cout << (is_odd_or_even_both(i, j) == 1 ? "#" : ".");
			}
			cout << "\n";
		}
		cout << "\n";
	}
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  string s; std::cin >> s;
  int oc = 0, cc = 0, l = 0;
  rep(i, n) {
    if (s[i] == '(') oc++;
    else if (s[i] == ')' && oc > 0) oc--;
    else l++;
  }
  std::cout << string(l, '(') << s << string(oc, ')') << '\n';
}


Measured memory_bytes: 256
#include <iostream>

int N, D[105][3];

int main() {
  std::cin >> N;
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < 2; ++j)
      std::cin >> D[i][j];

  bool meron = false;
  for (int i = 0; i < N-2; ++i) {
    bool cor = true;
    for (int j = 0; j < 3; ++j)
      if (D[i+j][0] != D[i+j][1])
        cor = false;
    meron |= cor;
  }
  std::cout << (meron ? "Yes" : "No") << "\n";

  return 0;
}


Measured memory_bytes: 3644
"use strict";

const Main = args => {
  const input = args.trim() - 0;
  const max = Math.floor(Math.sqrt(input));

  let result = input.toString().length

  for (let a = 1; a <= max; a++) {
    if (input % a === 0) {
      let b = input / a;
      let tmp = Math.max(a.toString().length, b.toString().length);

      if (tmp < result) {
        result = tmp;
      }
    }
  }

  console.log(result);

}

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

Measured memory_bytes: 7756
fun main(arg: Array<String>) {
    val (N, M) = listOfLong()
    val ans =
    if (N * 2 <= M) {
        N + (M - N * 2) / 4 // s < c
    } else {
        M / 2  // s > c
    }

    println(ans)
}

fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)


Measured memory_bytes: 36004
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<list>
#include<algorithm>
using namespace std;

int main() {
	int q, x;
	char com[20];
	list<int> v;
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		scanf("%s", com);
		if (com[0] == 'i') {
			scanf("%d", &x);
			v.push_front(x);
		}
		else if (com[6] == 'L') {
			v.pop_back();
		}
		else if (com[6] == 'F') {
			v.pop_front();
		}
		else if (com[0] == 'd') {
			scanf("%d", &x);
			for (list<int>::iterator it = v.begin(); it != v.end(); it++) {
				if (*it == x) {
					v.erase(it);
					break;
				}
			}
		}
	}
	int i = 0;
	for (list<int>::iterator it = v.begin(); it != v.end(); it++) {
		if (i++)printf(" ");
		printf("%d", *it);
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 33908
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long int ll;
ll s[100010];//普通の累積和
ll t[100010];//正の項についての累積和
int main(){
	int n,k; cin >>n>>k;
	vector<ll> a(n);
	for(int i=0;i<n;i++){
		cin >>a[i];
	}
	for(int i=0;i<n;i++){
		s[i+1]=s[i]+a[i];
		t[i+1]=t[i]+max((ll)0,a[i]);
	}
	ll ans=s[n];
	for(int i=0;i<=n-k;i++){
		ll left=t[i];
		ll right=t[n]-t[i+k];
		ans=max(left+right+(s[i+k]-s[i]),ans);//区間を黒に固定する場合
		ans=max(left+right,ans);//区間を白に固定する場合
	}
	cout << ans << endl;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
bool check(int n){
  	int cnt = 0;
	for(int i = 1 ; i <= n ;i++){
     	 if(n % i == 0)
           cnt++;
    }
  	if(cnt == 8)
    	return true;
  	return false;
}
int main(){	
	int n;
  	cin >> n;
  	int cnt = 0;
  	for(int i = 1; i <= n ; i++)
    {
     	if(i % 2 == 1){
         	bool fl = check(i);
          	if(fl == true)
            {  cnt++;
            	//cout << i << endl;
            }
        }
    }
 	cout << cnt << endl;
  	return 0; 
}

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

using namespace std;

typedef long long ll;

const ll MAX_N = 2e5 + 10;

int main(int argc, char const *argv[])
{
    ll n, a[MAX_N], sa[MAX_N];
    scanf("%lld", &n);
    for (ll i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
        sa[i] = a[i];
    }

    sort(sa, sa + n, std::greater<ll>());
    for (ll i = 0; i < n; ++i) {
        if (a[i]!=sa[0]) {
            printf("%lld\n", sa[0]);
        }
        else {
            printf("%lld\n", sa[1]);
        }
    }
    return 0;
}

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

res = []

if N % 2 == 0:
    x = 0
    for i in range(N // 2 // 2):
        res.append((x + 1, (x + 2 * i + 1) % N + 1))
        x -= 1
        x %= N
    for i in range((N // 2 - 1) // 2):
        res.append((x + 1, (x - (N // 2 - 1) // 2 * 2 + 2 * i) % N + 1))
        x -= 1
        x %= N

else:
    for i in range(N // 2):
        res.append((i + 1, N - i - 1))

for i in range(M):
    a, b = res[i]
    print(a, b)

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

//a進法でのnの総和
int wa(int n,int a){
    int res = 0;
    while(n>0){
        res += n%a;
        n /= a;
    }
    return res;
}
int main(){
    int n;
    cin >> n;
    int res = n;
    for (int i=0;i<=n;i++){
        int now = wa(i,6) + wa (n-i,9);
        res = min (res,now);
    }
    cout << res << endl;
    return 0;
}

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

int A[10001];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &A[i]);
  }
  
  int q, key, sum = 0;
  scanf("%d", &q);
  for (int i = 0; i < q; ++i) {
    scanf("%d", &key);
    A[n] = key;
    int j;
    for (j = 0; j < n; ++j) {
      if (A[j] == key) { break; }
    }
    if (n != j) { sum++; }
  }
  
  printf("%d\n", sum);
  return 0;
  
}

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

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

template <class T>
struct Dijkstra {
  struct edge {
    int from, to; T cost;
    edge() {}
    edge(int f, int t, T c) : from(f), to(t), cost(c) {}
  };

  int N;
  vector<vector<edge>> G;
  vector<T> dis;
  vector<int> prev;
  Dijkstra() {}
  Dijkstra(int N) : N(N), G(N), dis(N), prev(N, -1) {}
  void add_edge(int f, int t, T c) {
    G[f].emplace_back(f, t, c);
  }
  void shortest_path(int s, T INF) {
    fill(dis.begin(), dis.end(), INF);
    dis[s] = 0;
    using P = pair<T, int>;
    priority_queue<P, vector<P>, greater<P>> que;
    que.emplace(0, s);
    while (!que.empty()) {
      P p = que.top(); que.pop();
      int v = p.second;
      if (dis[v] < p.first) continue;
      for (auto &e : G[v]) {
        if (dis[e.to] > dis[v] + e.cost) {
          dis[e.to] = dis[v] + e.cost;
          prev[e.to] = v;
          que.emplace(dis[e.to], e.to);
        }
      }
    }
  }
  vector<int> get_path(int t) {
    vector<int> path;
    for(; t != -1; t = prev[t]) path.push_back(t);
    reverse(path.begin(), path.end());
    return path;
  }
};

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int K;
  cin >> K;
  Dijkstra<int> D(K);
  for (int i = 0; i < K; i++) {
    D.add_edge(i, (i + 1) % K, 1);
    if (i) D.add_edge(i, i * 10 % K, 0);
  }
  D.shortest_path(1, 1 << 30);
  cout << D.dis[0] + 1 << endl;

  return 0;
}

Measured memory_bytes: 7164
#!/usr/bin/env python

n = int(input())

if n == 0:
    print(0)
    exit()

ans = ''
while abs(n) > 0:
    r = n%2 
    ans += str(r) 
    n //= 2
    n = -n

if abs(n)%2 == 1:
    print(ans)
else:
    print(ans[::-1])


Measured memory_bytes: 9052
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    elif m == -1 or f == -1:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65 and m + f < 80:
        print("B")
    elif m + f >= 50 and m + f < 65:
        print("C")
    elif m + f >= 30 and m + f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

        


Measured memory_bytes: 5596
class Main {
  public static void main(String[] args) {
    int res = 0;
    for (int num1 = 1; num1 <= 9; num1++) {
      for (int num2 = 1; num2 <= 9; num2++) {
        res = num1 * num2;
        System.out.println(num1 + "x" + num2 +  "=" + res);
      }    
    }
  }
}

Measured memory_bytes: 24152
/*************************************************************************
    > File Name: c.cpp
    > Author: BlockChanZJ
    > Mail: 386636627@qq.com 
    > Created Time: 2018年05月27日 星期日 10时37分52秒
 ************************************************************************/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <cassert>
#include <iomanip>
using namespace std;

#define rep(i,a,b) for(int i = (a); i <= (b); ++i)
#define per(i,a,b) for(int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first 
#define se second
#define SZ(x) ((int)(x).size())
#define sqr(x) (x) * (x)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef pair<PII,int> PIII;
const int N = 100005;
const int P = 1000000007;
const ll mod = P;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld eps = 1e-8;
ll qmod(ll a,ll n,ll mod){ll ans=1;while(n){assert(ans>0);if(n&1ll)ans=ans*a%mod;n>>=1;a=a*a%mod;}return ans%mod;}

//head

//your code goes there

char s[300005];
int pre[300005], suf[300005];
int main()
{
	int n; scanf("%d",&n);
	scanf("%s",s+1);
	int ans = INF;
	rep(i,1,n) pre[i] = pre[i-1] + (s[i]=='W');
	per(i,n,1) suf[i] = suf[i+1] + (s[i]=='E');
	rep(i,1,n) ans=min(ans,pre[i-1]+suf[i+1]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
	int n;
	cin >> n;
	int ans = 1;
	while(ans *2 <= n){
		ans *= 2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
/*input

*/
#include<bits/stdc++.h>
//priority_queue<ll, vector<ll>, std::greater<ll> > q;
//gcc 1.cpp -lstdc++ -o main.o
#define ull                 unsigned long long
#define ll                         long long
#define M                         998244353
#define pb                         emplace_back
#define p_q                 priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define all(a)      (a).begin(),(a).end()
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b))/gcd((a),(b))
#define ios                    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp                         make_pair
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define F first
#define S second
#define N 3005
using namespace std;
ll a[N][N];

int main(void)
{
        ios
        ll n , m , n1 , m1;
        cin>>n>>m>>n1>>m1;
        rep(i,0,n1+1){
                rep(j,0,m1+1)
                        a[i][j] = 0;
        }

        a[n][m] = 1; 
        
        rep(i,1,n1+1){
                rep(j,1,m1+1){
                        a[i][j] = (a[i][j] + (a[i][j-1]*i))%M;
                        a[i][j] =  (a[i][j] + (a[i-1][j]*j))%M;
                        a[i][j] = (a[i][j] - ((a[i-1][j-1]*(i-1)*(j-1))%M) + M)%M;

                }
        }

        cout<<a[n1][m1];
}

Measured memory_bytes: 73956
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,sum=0,t=1;
	cin>>n;
	while(n/2>0){
		sum++;
		n/=2;
	}
	//cout<<sum<<endl;
	for(int i=1;i<=sum;i++){
		t*=2;
	}
	cout<<t;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int A,B,C;
	cin>>A>>B>>C;
	int n5=0;
	int n7=0;
	if (A==5){
		n5++;
	}else if (A==7){
		n7++;
	}
	if (B==5){
		n5++;
	}else if (B==7){
		n7++;
	}
	if (C==5){
		n5++;
	}else if (C==7){
		n7++;
	}
	if (n5==2 && n7==1){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}

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

const ll mod = 998244353;
const ll nmax = 200000;
ll facts[nmax];

void calc_fact() {
  facts[0] = 1;
  for (ll i = 1; i < nmax; i++) {
    facts[i] = facts[i - 1] * i % mod;
  }
}

ll powmod(ll a, ll b) {
  ll ans = 1;
  while (b) {
    if (b % 2) {
      ans *= a;
      ans %= mod;
    }
    a *= a;
    a %= mod;
    b /= 2;
  }
  return ans;
}

ll comb(ll a, ll b) {
  return facts[a] * powmod(facts[b], mod - 2) % mod
                  * powmod(facts[a - b], mod - 2) % mod;
}

int main() {
  ll n, m, K;
  cin >> n >> m >> K;

  calc_fact();

  ll ans = 0;
  for (ll k = 0; k <= K; k++) {
    ans += ((comb(n-1, k) * m) % mod * powmod(m-1, n-k-1)) % mod;
    ans %= mod;
  }

  cout << ans << endl;
}


Measured memory_bytes: 5196
L = int(input())
A = [int(input()) for i in range(L)]

INF = float('inf')
dp = [[INF]*5 for i in range(L+1)]
dp[0][0] = 0

for i,a in enumerate(A):
    cost_even = 2 if a==0 else a%2
    cost_odd = (a+1)%2

    dp[i+1][0] = min(dp[i+1][0], dp[i][0] + a)
    dp[i+1][1] = min(dp[i+1][1], dp[i][0] + cost_even)
    dp[i+1][2] = min(dp[i+1][2], dp[i][0] + cost_odd)
    dp[i+1][3] = min(dp[i+1][3], dp[i][0] + cost_even)
    dp[i+1][4] = min(dp[i+1][4], dp[i][0] + a)

    dp[i+1][1] = min(dp[i+1][1], dp[i][1] + cost_even)
    dp[i+1][2] = min(dp[i+1][2], dp[i][1] + cost_odd)
    dp[i+1][3] = min(dp[i+1][3], dp[i][1] + cost_even)
    dp[i+1][4] = min(dp[i+1][4], dp[i][1] + a)

    dp[i+1][2] = min(dp[i+1][2], dp[i][2] + cost_odd)
    dp[i+1][3] = min(dp[i+1][3], dp[i][2] + cost_even)
    dp[i+1][4] = min(dp[i+1][4], dp[i][2] + a)

    dp[i+1][3] = min(dp[i+1][3], dp[i][3] + cost_even)
    dp[i+1][4] = min(dp[i+1][4], dp[i][3] + a)

    dp[i+1][4] = min(dp[i+1][4], dp[i][4] + a)

print(min(dp[-1]))

Measured memory_bytes: 67788
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

string s;

int main(void){
	cin >> s;

	for(int i = 0; i < s.size(); i++){
		cout << 'x';
	}

	cout << '\n';

	return 0;
}

Measured memory_bytes: 256
/*
 * Code be weshen zyk :'(
 */
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/STACK:1024000000,1024000000")

#include <bits/stdc++.h>

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using orderd_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define S second
#define F first
#define pb push_back

using ii = pair<int, int>;
using ll = long long;
using db = long double;

const int N = 5000 + 5, K = 205, MOD = 1e9 + 7;
const int MX = 1e8;
const int blkSz = 320;

vector<int> adj[N];
int n;
int dp[N][N], sz[N], tmp[N], F[N];

int g[N][N];
inline int mul(int x, int y){
	return 1ll * x * y % MOD;
}
void dfs(int u, int p) {

	dp[u][1] = 1;
	sz[u] = 1;
	for (auto & v : adj[u])
		if (v != p) {
			dfs(v, u);
			for(int j = 0; j <= sz[u]; j++){
				tmp[j] = dp[u][j];
				dp[u][j] = 0;
			}
			for(int j = 0; j <= sz[u]; j++)
				for(int k = 0; k <= sz[v]; k++){
					dp[u][j+k] += mul(tmp[j], dp[v][k]);
					if(dp[u][j+k] >= MOD)
						dp[u][j+k] -= MOD;
				}
			sz[u] += sz[v];
		}
	for(int i = 0; i <= sz[u]; i += 2){
		dp[u][0] = (dp[u][0] + MOD - mul(dp[u][i], F[i])) ;
		if(dp[u][0] >= MOD)
			dp[u][0] -= MOD;
	}
}
int main() {
#ifdef ONLINE_JUDGE
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#endif


	cin >> n;

	F[0] = 1;

	for (int i = 2; i <= n; i += 2)
		F[i] = mul(F[i - 2], i - 1) % MOD;

	for (int i = 1, u, v; i < n; i++) {
		cin >> u >> v;
		adj[u].pb(v);
		adj[v].pb(u);
	}

	dfs(1, 1);

	cout << MOD - dp[1][0] << '\n';

	return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    int A, B, K;
    cin >> A >> B >> K;
    vector<int> ans;
    for(int i = 1; i < 1000; ++i) {
        if(A % i == 0 && B % i == 0) { ans.push_back(i); }
    }
    reverse(ans.begin(), ans.end());
    printf("%lld\n", ans[K-1]);

    return 0;
}


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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

// constexpr int INF = 1e9;
// constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;


int main(){
  int N;
  cin >> N;
  vector<int> L(N);
  REP(i, N){
    cin >> L[i];
  }
  sort(L.begin(), L.end());
  int ans=0;
  REP(i, N){
    FOR(j, i+1, N){
      FOR(k, j+1, N){
        if(L[i] == L[j] || L[j] == L[k]) continue;
        if(L[i] + L[j] > L[k]){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
#include<stdio.h>
int main(void)
{
	int i,cnt=0;
	char s[4],t[4];
	scanf("%s",s);
	scanf("%s",t);
	for(i=0;i<3;i++){
		if(s[i]==t[i]){
			cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h> //ABC 166_e 
#define ll long long
using namespace std;
const int maxn=2e5+5;
int n,a[maxn];
ll ans;
map<int,int> mp;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++){
		if(i-a[i]>0) 
			mp[i-a[i]]++;
	}
	for(int i=1;i<=n;i++){
		if(mp[i+a[i]]>0) 
			ans+=mp[i+a[i]];
	}
	cout<<ans;
	return 0;
}

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

def factorial(n):
    v = 1
    for i in range(1, n + 1):
        v *= i
    return v

def comb(a, b):
    return factorial(a) // (factorial(b) * factorial(a - b))

from collections import Counter
acnt = dict(Counter(a))
value = list(acnt.values())
sv = 0
for i in range(len(value)):
    if value[i] > 1:
        sv += (value[i]*(value[i]-1))//2
for i in range(n):
    cur = a[i]
    cursv = sv
    if acnt[cur] > 2:
        cursv = cursv - acnt[cur] + 1
    elif acnt[cur] == 2:
        cursv -= 1
    print(cursv)


Measured memory_bytes: 99660
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main() {
	int n,mx,ans=0,i,k;
	cin>>n;
	cin>>mx;
	for(i=2;i<=n;i++){cin>>k;
	    ans+=max(0ll,mx-k);
	    mx=max(mx,k);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
constexpr int64_t mod = 1'000'000'007; //'

template <uint32_t mod>
class modint{
    uint64_t value;
public:
    constexpr modint(const int64_t x=0) noexcept: value(x % mod + (x < 0 ? mod : 0)){ }
    constexpr explicit operator uint64_t() const noexcept{ return value; }
    constexpr modint inverse() const noexcept{ return pow(*this, mod-2); }
    constexpr bool operator==(const modint &rhs) const noexcept{ return value == rhs.value; }
    constexpr bool operator!=(const modint &rhs) const noexcept{ return value != rhs.value; }
    constexpr modint operator+() const noexcept{ return modint(*this); }
    constexpr modint operator-() const noexcept{ return modint(mod - value); }
    constexpr modint operator+(const modint &rhs) const noexcept{ return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const noexcept{ return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const noexcept{ return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const noexcept{ return modint(*this) /= rhs; }
    constexpr modint &operator+=(const modint &rhs) noexcept{
        if((value += rhs.value) >= mod) value -= mod;
        return *this;
    }
    constexpr modint &operator-=(const modint &rhs) noexcept{ return *this += mod - rhs.value; }
    constexpr modint &operator*=(const modint &rhs) noexcept{
        if((value *= rhs.value) >= mod) value %= mod;
        return *this;
    }
    constexpr modint &operator/=(const modint &rhs) noexcept{ return *this *= rhs.inverse(); }
    constexpr modint operator++(int) noexcept{
        modint ret(*this);
        if((++value) >= mod) value -= mod;
        return ret;
    }
    constexpr modint operator--(int) noexcept{
        modint ret(*this);
        if((value += mod - 1) >= mod) value -= mod;
        return ret;
    }
    constexpr modint &operator++() noexcept{ return *this += 1; }
    constexpr modint &operator--() noexcept{ return *this -= 1; }
    friend std::ostream &operator<<(std::ostream &os, const modint<mod> &x){ return os << x.value; }
    friend std::istream &operator>>(std::istream &is, modint<mod> &x){
        int64_t i;
        is >> i;
        x = modint<mod>(i);
        return is;
    }
    friend constexpr modint<mod> pow(const modint<mod> &x, uint64_t y){
        modint<mod> ret{1}, m{x};
        while(y > 0){
            if(y & 1) ret *= m;
            m *= m;
            y >>= 1;
        }
        return ret;
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    modint<mod> c[200000];
    for(int i=0;i<n;++i) cin >> c[i];
    sort(c, c+n, [](auto x, auto y){ return (uint64_t)x < (uint64_t)y; });

    modint<mod> ans = 0, two = 2;
    for(int i=0;i<n;++i){
        modint<mod> pw = n-i-2 >= 0 ? pow(two, n-i-2) : modint<mod>{0};
        ans += c[i] * pow(two*2 , i) * 2 * pow(two, n-i-1) * (pow(two, n-i-1) + pw * (n-i-1));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] nexts = new int[n];
		for (int i = 0; i < n; i++) {
		    nexts[i] = sc.nextInt() - 1;
		}
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		}
		HashSet<Integer> used = new HashSet<>();
		ArrayList<Integer> list = new ArrayList<>();
		long max = Long.MIN_VALUE;
		for (int i = 0; i < n; i++) {
		    if (used.contains(i)) {
		        continue;
		    }
		    int idx = i;
		    long total = 0;
		    while (!used.contains(idx)) {
		        used.add(idx);
		        list.add(idx);
		        total += arr[idx];
		        idx = nexts[idx];
		    }
		    int length = list.size();
		    for (int j = 0; j < length; j++) {
		        long sum = 0;
		        for (int l = 0; l <= length && l < k; l++) {
		            sum += arr[list.get((j + l) % length)];
		            max = Math.max(max, sum + Math.max(0, total * ((k - l - 1) / length)));
		        }
		    }
		    list.clear();
		}
		System.out.println(max);
	}
}


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


int dp[1<<17][3] = {0};

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin >> n;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      int a;
      cin >> a;
      dp[i + 1][j] = max(dp[i][(j + 1) % 3], dp[i][(j + 2) % 3]) + a;
    }
  }
  cout << *max_element(dp[n], dp[n] + 3) << '\n';
}


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

int main(void){

  int A[4],B[4],sumA=0,sumB=0;

  for(int i=0; i < 4; i++){
    cin >> A[i];
    sumA+= A[i];
  }

  for(int i=0; i < 4; i++){
    cin >> B[i];
    sumB+=B[i];
  }

  cout << max(sumA,sumB) << endl;

  return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n; cin>>n;
  vector<int> t(n);
  for(int i=0;i<n;i++)cin>>t[i];
  int m; cin>>m;
  vector<int> p(m),x(m);
  for(int i=0;i<m;i++)cin>>p[i]>>x[i];
  
  for(int i=0;i<m;i++){
    int a=p[i];
    int b=t[a-1];
    t[a-1]=x[i];
    int wa=0;
    for(int j=0;j<n;j++) wa+=t[j];
    t[a-1]=b;
    cout<<wa<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n, x, y; cin >> n >> x >> y;
  x--; y--;
  vector<vector<int>> v(n);
  map<int, int> m;
  rep(i, n-1){
    v[i].push_back(i+1);
    v[i+1].push_back(i);
  }
  v[x].push_back(y); v[y].push_back(x);
  for(int i = 0; i < n; i++){
    vector<int> d(n, 1e9);
    d[i] = 0;
    queue<int> q;
    q.push(i);
    while(!q.empty()){
      int t = q.front();
      int k = d[t];
      q.pop();
      for(int i = 0; i < v[t].size(); i++){
        if(d[v[t][i]] > k+1){
          d[v[t][i]] = k+1;
          q.push(v[t][i]);
        }
      }
    }
    for(int j = 0; j < n; j++){
      m[d[j]]++;
    }
  }
  for(int i = 1; i < n; i++){
    cout << m[i]/2 << endl;
  }
  system("pause");
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int D;
    cin >> D;
    vector<int>c(26);
    for(int i = 0; i < 26; i++) {
        cin >> c[i];
    }
    vector<vector<int>>s(D,vector<int>(26));
    for(int i = 0; i < D; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    vector<int>t(D);
    for(int i = 0; i < D; i++) {
        t[i] = rand()%26+1;
    }
    int ans = 0;
    vector<int>Last(26);
    for(int i = 0; i < D; i++) {
        ans+=s[i][t[i]-1];
        Last[t[i]-1] = i+1;
        for(int j = 0; j < 26; j++) {
            ans-=c[j]*(i+1-Last[j]);
        }
    }
    int Z = 1350000;
    for(int i = 0; i < Z; i++) {
        int d = rand()%D+1;
        int q = rand()%26+1;
        int ord = ans;
        int X = 0;
        int Y = 0;
        int A = 0;
        int B = 0;
        ans+=s[d-1][q-1]-s[d-1][t[d-1]-1];
        for(int j = 0; j < D; j++) {
            if(t[j] == t[d-1]) {
                if(j == d-1) {
                    Y = j+1;
                }
                else {
                    X = j+1;
                }
                A = j+1;
            }
            if(t[j] == q) {
                Y = j+1;
                B = j+1;
            }
            ans-=c[t[d-1]-1]*(j+1-X)-c[t[d-1]-1]*(j+1-A);
            ans+=c[q-1]*(j+1-B)-c[q-1]*(j+1-Y);
        }
        if(ans < ord) {
            ord = ans;
            t[d-1] = q;
        }
        else {
            ans = ord;
        }
    }
    int M = 1350000;
    for(int i = 0; i < M; i++) {
        int d = rand()%D+1;
        int q = rand()%26+1;
        int ord = ans;
        int X = 0;
        int Y = 0;
        int A = 0;
        int B = 0;
        ans+=s[d-1][q-1]-s[d-1][t[d-1]-1];
        for(int j = 0; j < D; j++) {
            if(t[j] == t[d-1]) {
                if(j == d-1) {
                    Y = j+1;
                }
                else {
                    X = j+1;
                }
                A = j+1;
            }
            if(t[j] == q) {
                Y = j+1;
                B = j+1;
            }
            ans-=c[t[d-1]-1]*(j+1-X)-c[t[d-1]-1]*(j+1-A);
            ans+=c[q-1]*(j+1-B)-c[q-1]*(j+1-Y);
        }
        if(ans > ord) {
            ord = ans;
            t[d-1] = q;
        }
        else {
            ans = ord;
        }
    }
    for(int i = 0; i < D; i++) {
        cout << t[i] << endl;
    }
}



Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <deque>
#include <utility>

int N;
std::vector< std::vector<int> > to;
std::vector< int > distance[2];

void calc(int player, int start){
    std::deque< std::pair<int,int> > deq;

    deq.push_back(std::make_pair(start, 0));
    while(!deq.empty()){
        auto point = deq.front();
        deq.pop_front();

        distance[player][point.first] = point.second;

        for( int t : to[point.first] ){
            if( distance[player][t] == -1 ){
                deq.push_back(std::make_pair(t, point.second + 1));
            }
        }
    }
}

int main(void){
    std::cin >> N;
    to.resize(N);
    int a, b;
    for(int i=0; i<N-1; ++i){
        std::cin >> a >> b;
        --a, --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    distance[0].resize(N);
    distance[1].resize(N);

    for(int i=0; i<N; ++i){
        distance[0][i] = distance[1][i] = -1;
    }

    calc(0, 0);
    calc(1, N-1);

    int fennec = 0, sunuke = 0;
    for(int i=1; i<N-1; ++i){
        if(distance[0][i] <= distance[1][i]){
            ++fennec;
        }else{
            ++sunuke;
        }
    }
    if(fennec > sunuke){
        std::cout << "Fennec\n";
    }else{
        std::cout << "Snuke\n";
    }
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
using namespace std;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
 
int main(){
  long long L,R;
  cin >> L >> R;
  if(R >= L+2019){
    R = L+ 2019;
  }
  long long m=0, ans =20100008;
  for(long long i =L; i<R ;i++){
    for(long long j = i+1; j <R+1; j++){
      m =i*j%2019;
      if(m < ans){
        ans =m;
      }
    }
  }
  cout <<ans<<endl;
}

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}


bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;


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

    vector<int> speeds = [&]() -> vector<int> {

        vector<int> _times(n), _speeds(n);
        rep(i, n) cin >> _times[i];
        rep(i, n) cin >> _speeds[i];

        vector<int> speeds;
        rep(i, n) {
            rep(j, _times[i]) speeds.push_back(_speeds[i]);
        }

        vector<int> speeds2;
        rep(i, speeds.size()) {
            if (i == 0) {
                speeds2.push_back(0);
                speeds2.push_back(speeds[0]);
            } else {
                int mi = min(speeds[i - 1], speeds[i]);
                speeds2.push_back(mi);
                speeds2.push_back(speeds[i]);

            }
        }
        speeds2.push_back(0);
        return speeds2;

    }();


    int ss = speeds.size();
    vector<double> dp(ss);
    rep(i, ss) dp[i] = speeds[i];
    rep(i, ss) if (i != 0) cmin(dp[i], dp[i - 1] + 0.5);
    for (int i = ss - 2; i > 0; i--) cmin(dp[i], dp[i + 1] + 0.5);

    double sum = 0;

    rep(i, ss) {
        if (i == 0) continue;
        double a = dp[i - 1], b = dp[i];
        double now = (a + b) / 2 * 0.5;
        sum += now;
    }

    cout << setprecision(20) << sum << endl;

}

Measured memory_bytes: 3936
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	int n = 5;
	vector<int> v(n);
	rep(i, n) cin >> v[i];
	rep(i, n) {
		if (v[i] == 0) {
			cout << i + 1 << endl;
			return;
		}
	}
}

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

	solve();
}


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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def yakusu(n):
    yakusu = []
    for i in range(1, int(math.sqrt(n))+1):
        if n % i == 0:
            yakusu.append(i)
            if n // i != i:
                yakusu.append(n//i)
    return yakusu
     
baisu = [False] * (10**6 + 1)
def main():
    N = I()
    A = LI()

    ok = 0
    for a in set(A):
        if baisu[a]:
            continue
        if not baisu[a]:
            num = a + a
            while num < 10**6+1:
                baisu[num] = True
                num += a
    s = collections.Counter(A)
    for a in A:
        if not baisu[a]:
            if s[a] > 1:
                continue
            ok += 1
    print(ok)
main()



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

#define int long long

int modpow(int n, int k, int MOD);

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

      int a, b, c; cin >> a >> b >> c;
      int ans = 0;
      if (c > 0) {
            c--;
            ans++;
      }

      if (a+b >= c) {
            ans += b+c;
      } else {
            ans += b+(a+b);
      }
      cout << ans;

      return 0;
}

int modpow(int n, int k, int MOD) {
      if (k == 0) return 1;
      int tmp = modpow(n, k/2, MOD);
      tmp = (tmp*tmp) % MOD;
      if (k % 2) tmp = (tmp*n) % MOD;
      return tmp;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define method(name,res,...) function<res (__VA_ARGS__) > name = [&](__VA_ARGS__)
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  ll n = in();
  int ans = 0;
  for(ll i=2;i*i<=n;++i){
    int cnt = 0;
    while(n%i==0){
      ++cnt;
      n/=i;
    }
    if(cnt){
      rep(j,1,INF){
        if(cnt<j)break;
        ++ans;
        cnt-=j;
      }
    }
  }
  if(n!=1)++ans;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

void yes() {
  cout << "Yes" << endl;
  exit(0);
}

void no() {
  cout << "No" << endl;
  exit(0);
}

int main() {
  ll n;
  cin >> n;
  FOR(i, 1, 10) FOR(j, 1, 10) {
    if (i * j == n) {
      yes();
    }
  }
  no();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <algorithm>
using namespace std;
 
#define ll long long int 
#define ull unsigned long long int
#define db double
#define ld long double
#define MOD 1000000007
#define inf (1LL << 62)
#define pi acos(-1.0)
#define si(a) scanf("%lld",&a)
#define sd(n) scanf("%lf", &n)
#define for1(i, stop) for(ll i = 1; i <= stop; i++)
#define for0(i, stop) for(ll i = 0; i < stop; i++)
#define rep1(i, start) for(ll i = start; i >= 1; i--)
#define rep0(i, start) for(ll i = (start-1); i >= 0; i--)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define pb(v,a) v.push_back(a)
#define pll pair <ll, ll>
#define mp make_pair
#define pbp(v,a,i) v.push_back(make_pair(a,i)) 
#define srt(v) sort(v.begin(),v.end())
#define rv(v) reverse(v.begin(),v.end())
#define ms(n, i) memset(n, i, sizeof(n))
#define debug printf("Debug\n");
#define en '\n'
 
 
 
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
 map<ll,ll>m;
int main()
{
	_fastio
	ll n;
	cin>>n;
	string s="",ss="abcdefghijklmnopqrstuvwxyz";
	n=n-1;
	while(n>-1)
	{
		ll a=n%26;
		s+=ss[a];
		n=(n/26)-1;
	}
	rv(s);
	cout<<s<<en;
}

Measured memory_bytes: 3652