akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define ALL(obj) (obj).begin(),(obj).end()
template<class T>inline bool chmax(T& a,T b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if (a>b){a=b;return 1;}return 0;}
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}


int main(){
    ll q,h,s,d,n,ans=0;
    cin >> q >> h >> s >> d >> n;
    if (2*q<h){
        h=2*q;
    }
    if (2*h<s){
        s=2*h;
    }
    if (2*s<d){
        d=2*s;
    }
    ans=d*(n/2);
    if (n%2){
        ans+=s;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  int n;
  int t[102];

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

    int x;
    cin >> x;

    int lo = 0;
    int hi = n - 1;
    int cnt = 0;

    while(lo <= hi){
      cnt++;
      int med = (lo + hi) / 2;

      if(t[med] == x) break;
      if(t[med] > x){
	hi = med - 1;
      }
      else{
	lo = med + 1;
      }
    }

    cout << cnt << endl;
  }
}

Measured memory_bytes: 1160
#include<stdio.h>

int main(void){


int a,b,c,x;


scanf("%d %d %d\n",&a,&b,&c);


int i;


for(i = a; i <= b; i++){


if(c % i == 0){


x++;


}


}


printf("%d\n",x);


return 0;


}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define pb push_back

typedef long long int ll;
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie();
	
	vector<ll> v;
	ll n, ans = INT_MAX, mini = 101, maxi = -101;
	cin >> n;
	for (ll i = 0; i < n; i++) {
		ll x;
		cin >> x;
		mini = min(x, mini);
		maxi = max(x, maxi);
		v.pb(x);
	}
	for (ll i = mini; i <= maxi; i++) {
		ll res = 0;
		for (ll j = 0; j < n; j++) {
			res += (v[j] - i) * (v[j] - i);
		}
		ans = min(res, ans);
	}
	cout << ans;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s, t;
    cin >> s >> t;

    rep(i, s.size()){
        if(s[i] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3580
//Name: Hot days
//Level: 3
//Category: 動的計画法,DP
//Note:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct Cloth {
    int low, high;
    int cost;

    bool suitable(int temp) const {
        return low <= temp && temp <= high;
    }
};

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

    int D, N;
    cin >> D >> N;
    vector<int> temps(D);
    vector<Cloth> clothes(N);
    for(int i = 0; i < D; ++i) {
        cin >> temps[i];
    }
    for(int i = 0; i < N; ++i) {
        Cloth &cloth = clothes[i];
        cin >> cloth.low >> cloth.high >> cloth.cost;
    }

    vector<int> dp[2];
    dp[0].resize(N, 0);
    dp[1].resize(N, 0);
    for(int i = 1; i < D; ++i) {
        const int temp = temps[i];
        fill(dp[1].begin(), dp[1].end(), 0);
        for(int j = 0; j < N; ++j) {
            if(!clothes[j].suitable(temp)) continue;
            for(int prev = 0; prev < N; ++prev) {
                if(clothes[prev].suitable(temps[i-1])) {
                    dp[1][j] = max(dp[1][j], dp[0][prev] + abs(clothes[j].cost - clothes[prev].cost));
                }
            }
        }
        dp[0].swap(dp[1]);
    }

    cout << *max_element(dp[0].begin(), dp[0].end()) << endl;
    return 0;
}

Measured memory_bytes: 1204
import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;

// import java.text.DecimalFormat; 
// import java.text.DecimalFormatSymbols; 
 
 
// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
 
public class Main {
    
    public static BufferedReader br;
    public static StringTokenizer sto;
    
    public static void main(String args[] ) throws Exception {
        StringBuffer str = new StringBuffer();
        PrintWriter pw=new PrintWriter(System.out);
        br = new BufferedReader(new InputStreamReader(System.in));
    
        int n = nextInt();
        if(n>=30){
            str.append("Yes");
        } else {
            str.append("No");
        }
        
        
        
        pw.println(str.toString());
        
        pw.close();
    }
     
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
    public static int[] arrayInt(int n) throws Exception{
       sto = new StringTokenizer(br.readLine());
       int[] newarray = new int[n];
       for(int i=0;i<n;i++){
           newarray[i] = Integer.parseInt(sto.nextToken());
       }
       return newarray;
    }
    
    public static long[] arrayLong(int n) throws Exception{
       sto = new StringTokenizer(br.readLine());
       long[] newarray = new long[n];
       for(int i=0;i<n;i++){
           newarray[i] = Long.parseLong(sto.nextToken());
       }
       return newarray;
    }
   
   
   public static double nextDouble() throws Exception{
       return Double.parseDouble(br.readLine());
   }
   
   public static long nextLong() throws Exception{
       return Long.parseLong(br.readLine());
   }
   
   
   public static int nextInt() throws Exception{
       return Integer.parseInt(br.readLine());
   }
   
}

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

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

int main()
{
   int n, m;
   cin >> n >> m;
   vector<int> data[n];
   rep(i,m){
      int a, b;
      cin >> a >> b;
      --a; --b;
      data[a].push_back(b);
      data[b].push_back(a);
   }
   bool update =true;
   int ans =0;
   while(update){
      update = false;
      rep(i,n){
         if(data[i].size() == 0) continue;
         else if(data[i].size() == 1)
         {
            int index = data[i].back(); 
            data[i].pop_back();
            auto e = remove(data[index].begin(), data[index].end(), i);
            data[index].erase(e, data[index].end());
          //  cout << "---" << i << " " << index << "---" << endl;
           // data[index].erase(data[index].begin());
            ++ans;
            update = true;
         }
      }
   }
   cout << ans << endl;
}

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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
  -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

bool cnt(const std::vector<int>& A,
         const int len,
         const int K) {
  ll cnt = 0;
  for(const auto& v : A) {
    cnt += ceil(v / (double)len) - 1;
  }
  return cnt <= K;
}

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

  int N;
  std::cin >> N;
  int K;
  std::cin >> K;
  std::vector<int> A(N);
  REP(i, N) {
    std::cin >> A[i];
  }

  int l = 0;
  int r = *max_element(ALL(A));
  while(abs(l - r) > 1) {
    auto m = (l + r) / 2;
    if(cnt(A, m, K)) {
      r = m;
    } else {
      l = m;
    }
  }
  std::cout << r << std::endl;

  return 0;
}


Measured memory_bytes: 3972
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1e18;
//const ll mod = 1000000007;
ll A[1050000];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    for(int i = 0; i <= 1e6; i++) {
        A[i] = -1;
    }
    for(int i = 2; i <= 1e6; i++) {
        if(A[i] != -1) continue;
        for(ll j = 2 * i; j <= 1e6; j += i) {
            if(A[j] != -1) continue;
            A[j] = i;
        }
    }
    for(ll i = 1; i <= 1e6; i++) {
        if(A[i] == -1) A[i] = i;
    }
    ll N;
    cin >> N;
    ll G = 0;
    set<ll> st;
    bool ok = true;
    for(int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        G = __gcd(G, a);
        set<ll> nowst;
        while(a > 1) {
            ll tmp = A[a];
            nowst.insert(tmp);
            a /= tmp;
            //cerr << tmp << endl;
        }
        for(auto tmp : nowst) {
            if(st.find(tmp) != st.end()) ok = false;
            st.insert(tmp);
        }
    }
    string ans;
    if(ok) ans = "pairwise coprime";
    else if(G == 1) ans = "setwise coprime";
    else ans = "not coprime";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 15104
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
	int n;
	scanf("%d", &n);
	int a;
	long sum = 0;
	int m = 1000000, M = -1000000;
	for(int i = 0; i < n; i++){
		scanf("%d", &a);
		M = max(M, a);
		m = min(m, a);
		sum += a;
	}
	printf("%d %d %ld\n", m, M, sum);
	
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#define debug(x...) cout << #x << " = "; _print(x)
typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
#define rep(i,a,b) for (ll i = (a); i < (b); ++i)
#define per(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL) 

int solve(){
	int n, m, x, ans = INT_MAX;
	cin>> n>> m>> x;
	vi cost(n);
	vector<vi> v(n);
	rep(i, 0, n){
		cin>> cost[i];
		rep(j, 0, m){
			int x;
			cin>> x;
			v[i].pb(x);
		}
	}
	rep(i, 0, 1<<n){
		int pp = 0;
		bool ok = true;
		vi algo(m, 0);
		rep(j, 0, n){
			if(i>>j&1){
				rep(k, 0, m)
					algo[k] += v[j][k];
				pp += cost[j];
			}
		}
		rep(i, 0, m)
			if(algo[i] < x)
				ok = false;
		if(ok)
			ans = min(ans, pp);
	}
	if(ans == INT_MAX)
		return cout<< "-1\n", 0;
	cout<< ans<< "\n";
	return 0;
}
 
int main()
{
	fast;
	int t = 1;
	//cin>> t;
	while(t--){  
		solve();
	}
	return 0;
}
//v.clear(), vis.clear(); vis.resize(n + 1, 0), v.resize(n + 1);
 
/*	inv[1] = 1; // inv is ll
	for(int i=2; i<=mxn; ++i)
		inv[i]=mod-mod/i*inv[mod%i]%mod;*/


Measured memory_bytes: 3660
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;
#pragma unused(M)
 
struct Node{
	char chr;
	Node* par;
	bool used = false;
	map<char, pair<int, Node*>> dests;
	Node(){}
	Node(Node* n):par(n){}
	// Node* make(string& str, int idx){
	// 	chr = str[idx];
	// 	if(str.size() == idx + 1){ return this; }
	// 	char next = str[idx + 1];
	// 	if(dests.count(next)){
	// 		dests[next].first++;
	// 	}else{
	// 		Node* n = new Node(this);
	// 		dests[next] = {1, n};
	// 	}
	// 	return dests[next].second -> make(str, idx + 1);
	// }
	// int calc(vector<int>& ord){
	// 	return par -> _calc(ord, chr) + 1;
	// }
	// int _calc(vector<int>& ord, char from){
	// 	int ret = used;
	// 	for(auto& dest : dests){
	// 		if(ord[dest.first - 'a'] < ord[from - 'a']){
	// 			ret += dest.second.first;
	// 		}
	// 	}
	// 	if(par == nullptr){ return ret; }
	// 	return par -> _calc(ord, chr) + ret;
	// }
};
vector<Node> pool(400000);
int pidx;
Node* make(Node* n, string& str, int idx){
	while(1){
		// n -> chr = str[idx];
		if(str.size() == idx){ return n; }
		char next = str[idx];
		if(n -> dests.count(next)){
			n -> dests[next].first++;
		}else{
			pool[pidx].par = n;
			n -> dests[next] = {1, &pool[pidx++]};
		}
		idx++;
		n = n -> dests[next].second;
		n -> chr = str[idx - 1];
	}
}

void opt(){
	for(Node& n : pool){
		if(n.used == false && n.dests.size() == 1){
			n.dests.begin() -> second.second -> par = n.par;
			n.dests.begin() -> second.second -> chr = n.chr;
			n.par -> dests[n.chr].second = n.dests.begin() -> second.second;
		}
	}
}

int calc(Node* n, vector<int>& ord){
	int ret = 1;
	char from;
	while(1){
		from = n -> chr;
		n = n -> par;
		if(!n){ return ret; }
		ret += n -> used;
		for(auto& dest : n -> dests){
			if(ord[dest.first - 'a'] < ord[from - 'a']){
				ret += dest.second.first;
			}
		}
	}
}
 
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, q;
	cin >> n;
	Node root(nullptr);
	vector<Node*> nodes(n);
	for(int i=0;i<n;i++){
		string s;
		cin >> s;
		// s = 'a' + s;
		// nodes[i] = root.make(s, 0);
		nodes[i] = make(&root, s, 0);
		nodes[i] -> used = true;
	}
 
	opt();
 
	cin >> q;
	vector<int> ord(26);
	for(int i=0;i<q;i++){
		int k;
		string p;
		cin >> k >> p;
		for(int i=0;i<26;i++){
			ord[p[i] - 'a'] = i;
		}
		k--;
		// cout << nodes[k] -> calc(ord) << endl;
		cout << calc(nodes[k], ord) << endl;
	}
	return 0;
}


Measured memory_bytes: 44408
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
using namespace std;
// clang-format on

template<typename InputIterator> constexpr std::string join(InputIterator first, InputIterator last, const std::string &sep) {
  if (first == last) return "";
  std::stringstream ss;
  ss << *(first++);
  for_each(first, last, [&](auto &x) { ss << sep << x; });
  return ss.str();
}

main {
  int k;
  cin >> k;
  int n = 50;
  vi a(50);
  iota(all(a), 0);
  for (auto &x : a) x += k / n;
  k %= n;
  rep(i, k) rep(j, n) a[j] += i == j ? n : -1;
  cout << n << endl;
  cout << join(all(a), " ") << endl;
}


Measured memory_bytes: 256
N,H = map(int,input().split(" "))
a = [0] * N
b = [0] * N
for i in range(N):
	a[i],b[i] =  map(int,input().split(" "))

max_a = max(a)
b_2 = [i for i in b if i > max_a]

b_2.sort(reverse=True)
l = len(b_2)

for i in range(l):
	H -= b_2[i]
	if H <= 0:
		print(i+1)
		exit(0)

ans = l
if H  % max_a == 0:
	ans += (H//max_a)
else:
	ans += ((H//max_a)+1)

print(ans)





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

struct P{
    int a,b,c,d;
    P(int a,int b,int c,int d):a(a),b(b),c(c),d(d){}
};

int H,W;
int a[500][500];

int main(){
    cin>>H>>W;
    rep(i,H) rep(j,W) cin>>a[i][j];
    
    vector<P> ans; 
    rep(i,H){
        rep(j,W){
            if(a[i][j]&1){
                if(j<W-1){
                    ans.push_back(P(i,j,i,j+1));
                    a[i][j]--;
                    a[i][j+1]++;
                }else if(i<H-1){
                    ans.push_back(P(i,j,i+1,j));
                    a[i][j]--;
                    a[i+1][j]++;
                }
            }
        }
    }

    int N=ans.size();
    cout<<N<<endl;
    repr(ans){
        cout<<e.a+1<<' '<<e.b+1<<' '<<e.c+1<<' '<<e.d+1<<endl;
    }
}

Measured memory_bytes: 5232
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=200005;
int n,m,a[N];
bool check(int mid){
	for (int l=mid*2-1,r=2*n;l<=r;l++,r--)
		if (a[l]+a[r]<m) return 0;
	return 1;
}
int main(){
	scanf("%d%d",&n,&m);
	For(i,1,n*2) scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	int l=1,r=n,ans=n+1;
	while (l<=r){
		int mid=(l+r)/2;
		if (check(mid))
			ans=mid,r=mid-1;
		else l=mid+1;
	}
	int mx=0;
	for (int l=1,r=ans*2-2;l<=r;l++,r--)
		mx=max(mx,a[l]+a[r]);
	for (int l=ans*2-1,r=2*n;l<=r;l++,r--)
		mx=max(mx,a[l]+a[r]-m);
	printf("%d",mx);
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
 
ll A[202020];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
 
	int N;
	ll K;
	cin >> N >> K;
	vector<vector<int>>idx(202020);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		idx[A[i]].pb(i);
	}
	for (int i = 0; i < 202020; i++)sort(all(idx[i]));
 
	int cur = 0;
	int shuuki = 0;
	while (1) {
		if (cur >= idx[A[cur]].back()) {
			shuuki++;
			cur = (idx[A[cur]].front() + 1) % N;
			if (cur == 0) {
				shuuki++;
				break;
			}
		}
		else {
			int ind = *upper_bound(all(idx[A[cur]]),cur);
			cur = (ind + 1) % N;
			if (cur == 0) {
				shuuki++;
				break;
			}
		}
	}
 
	K %= shuuki;
	if (K == 0) {
		puts("");
		return 0;
	}
	shuuki = 0;
	cur = 0;
	while (1) {
		if (cur >= idx[A[cur]].back()) {
			shuuki++;
			if (shuuki == K)break;
			cur = (idx[A[cur]].front() + 1) % N;
		}
		else {
			int ind = *upper_bound(all(idx[A[cur]]), cur);
			cur = (ind + 1) % N;
		}
	}
 
	set<int>st;
	deque<ll>ans;
	for (int i = cur; i < N; i++) {
		if (!st.count(A[i])) {
			ans.push_back(A[i]);
			st.insert(A[i]);
		}else{
			while (ans.back() != A[i]){
              st.erase(ans.back());
              ans.pop_back();
            }
			ans.pop_back();
			st.erase(A[i]);
		}
	}
	fore(x, ans) {
		cout << x << " ";
		ans.pop_front();
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 25088
list = []
count = 0
6.times do
  list << gets.chomp.to_i
end

for i in 0..4 do
  for j in (i + 1)..4 do
    if (list[j] - list[i]) > list[5]
      count += 1
    end
  end
end

if count != 0
  puts ":("
else
  puts "Yay!"
end


Measured memory_bytes: 1788
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b)
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	int N;
	cin >> N;
	vector<int> P(N);
	vector<int> min(N, INF);
	rep(i, N)
	{
		cin >> P[i];
		if (i > 0)	min[i] = min[i - 1];
		if (P[i] < min[i])	min[i] = P[i];
	}

	int ret = 0;
	for (int i = 0; i < N; i++)
	{
		if (min[i] >= P[i])
			ret++;
	}

	cout << ret;
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

const char lf = '\n';

namespace ae86
{
	const int bufl = 1 << 15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0;int b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 100007 , mo = 1000000007;

template<typename T1,typename T2> inline T1 ad(T1 &a,T2 b){return a=a+b>=mo?a+b-mo:a+b;}
template<typename T1,typename T2> inline T1 dl(T1 &a,T2 b){return a=a>=b?a-b:a-b+mo;}
template<typename T1,typename T2> inline T1 add(T1 a,T2 b){return a+b>=mo?a+b-mo:a+b;}
template<typename T1,typename T2> inline T1 del(T1 a,T2 b){return a>=b?a-b:a-b+mo;}

lint powa(lint a,lint t)
{
	lint b=1;a=(a+mo)%mo;
	while(t){if(t&1)b=b*a%mo;a=a*a%mo,t>>=1;}
	return b;
}

inline lint inva(lint a)
{
	return powa(a,mo-2);
}

int n,nex[_]={0},din[_]={0},ed[_]={0};
int isc[_]={0},dlen[_]={0},got[_]={0};
int ccnt[_]={0};

lint ans=1;

void dfs(int x)
{
	int len=0,lasloc=0,firloc=0,firlen=0;
	while(!got[x])
	{
		len++,got[x]=1;
		if(dlen[x])
		{
			if(!firloc)firloc=len,firlen=dlen[x];
			else ans=ans*add<int,int>(dlen[x]<len-lasloc,dlen[x]<=len-lasloc)%mo;
			lasloc=len;
		}
		x=nex[x];
	}
 
	if(!firloc)ccnt[len]++;
	else ans=ans*add<int,int>(firlen<len-lasloc+firloc,firlen<=len-lasloc+firloc)%mo;
}

lint f[_]={0};

int main()
{
	ios::sync_with_stdio(0),cout.tie(nullptr);

	n=ty();
	for(int i=1;i<=n;i++)nex[i]=ty(),din[nex[i]]++;

	for(int i=1;i<=n;i++)
	{
		if(ed[i])continue;
		int now=i;
		while(!ed[now])ed[now]=i,now=nex[now];
		if(ed[now]!=i)continue;
		while(!isc[now])isc[now]=1,now=nex[now];
	}
	
	for(int i=1;i<=n;i++)if(din[i]>1+isc[i]){cout<<0<<lf;return 0;}

	for(int i=1;i<=n;i++)
	{
		if(din[i])continue;
		int x=i,len=0;
		while(!isc[x])len++,x=nex[x];
		dlen[x]=len;
	}

	for(int i=1;i<=n;i++)if(isc[i] && !got[i])dfs(i);

	for(int i=1;i<=n;i++)
	{
		if(!ccnt[i])continue;
		f[0]=1;
		for(int j=1;j<=ccnt[i];j++)
		{
			if(i>1 && (i&1))f[j]=add(f[j-1],f[j-1]);
			else f[j]=f[j-1];
			if(j>1)ad(f[j],f[j-2]*(j-1)%mo*i%mo);
		}
		ans=ans*f[ccnt[i]]%mo;
	}

	cout<<ans<<lf;

	return 0;
}


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

int main()
{
    int n, ans = 0;
    cin >> n;
    rep(i, n) ans += i + 1;

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


Measured memory_bytes: 256
import itertools as it

S = input()
ans = 0
for config in it.product(range(2), repeat=len(S) - 1):
    eq = ""
    for i in range(len(S) - 1):
        eq += S[i] + "+" if config[i] == 1 else S[i]
    eq += S[-1]
    ans += sum([int(i) for i in eq.split("+")])
print(ans)


Measured memory_bytes: 42348
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

ll q, h, s, d;
ll n;

int main() {
	cin >> q >> h >> s >> d >> n;
	s = min(4*q, min(2*h, s));
	cout << (n / 2)*min(d, 2*s) + (n % 2)*s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int	main(void)
{
	int	n, d1, d2;
	int	flg = 0;
	int	max = 0;

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d %d", &d1, &d2);
		if (d1 == d2)
			flg++;
		else
		{
			if (max < flg)
				max = flg;
			flg = 0;
		}
	}
	if (max < flg)
		max = flg;
	if (3 <= max)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 1648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

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

    auto up = [](int x){
        int res = 0;
        while(x){
            res = x%10;
            x /= 10;
        }
        return res;
    };

    vvec<ll> cnt(10,vec<ll>(10));
    for(int i=1;i<=N;i++){
        cnt[up(i)][i%10]++;
    }
    ll ans = 0;
    for(int i=0;i<10;i++) for(int j=0;j<10;j++){
        ans += cnt[i][j]*cnt[j][i];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3620
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> d1(n), d2(n);
  for(int i = 0; i < n; i++) {
    cin >> d1[i] >> d2[i];
  }
  bool ans = false;
  for(int i = 0; i < n - 2; i++) {
    if(d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
      ans = true;
    }
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int H, A;
	cin >> H >> A;
	cout << H / A + (bool)(H % A) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
/**
*   author: j o s e m a g o
*   date:
**/
using namespace std;
#pragma GCC optimize ("Ofast")
#define f first
#define s second
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mset(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define sz(x) ((int)(x).size())
#define rsz resize
#define ln "\n"

typedef double db;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const ld PI = 2*acos(0.0);
const int MOD = 1000000007;


int matriz[100009][3];
int dp[100009][3];



int main(){

  //freopen("input.in","r",stdin);
  //freopen("input.out","w",stdout);

    ios_base::sync_with_stdio(0); cin.tie(0);


    int n;
    cin >> n;
    for(int i = 0;i < n;i++){
        for(int j = 0;j < 3;j++){
            cin >> matriz[i][j];
        }
    }
    int m = 0;
    dp[0][0] = matriz[0][0]; dp[0][1] = matriz[0][1]; dp[0][2] = matriz[0][2];
    for(int i = 1;i < n;i++){

        for(int j = 0;j < 3;j++){

            for(int k = 0;k < 3;k++){
                if(k != j){
                    m = max(dp[i-1][k],m);
                }
            }
            dp[i][j]+=m;
            dp[i][j]+= matriz[i][j];
            m = 0;
        }
    }

    int sol = 0;
    for(int i = 0;i < 3;i++){
        sol = max(dp[n-1][i],sol);
    }
    cout<<sol;



    return 0;
}
/*
7
6 7 8
8 8 3
2 5 2
7 8 6
4 6 8
2 3 4
7 5 1



*/

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

int main() {
  int N;  
  cin >> N;
  vector<int> data(N);
  
  for (int i=0; i<N; i++) {
    cin >> data.at(i);
  }
  sort(data.begin(), data.end());
  
  int a = 0;
  int b = 0;
  int cnt = 0;
  
  for (int i=N-1; i>=0; i--) {
    

    if (cnt%2==0) {
      a += data.at(i);
    }
    else {
      b += data.at(i);
    }
    cnt++;
    
  }
  cout << a-b << endl;
}


Measured memory_bytes: 256
var N = 0
var A = 0

fun main(args: Array<String>) {
    readLine()?.split(" ")?.map {
        it.toInt()
    }?.let {
        N = it[0]
        A = it[1]
    }


    val x = Array(N + 1) { 0 }
    readLine()?.split(" ")?.map {
        it.toInt()
    }?.forEachIndexed { i, n ->
        x[i + 1] = n
    }

    val dp = Array(N + 1) {
        Array(N + 1) {
            Array(N * A + 1) { 0L }
        }
    }
    for (i in 0..N) {
        dp[i][0][0] = 1
    }

    for (i in 1..N) {
        for (j in 1..i) {
            for (k in 1..(N * A)) {
                dp[i][j][k] = if (k < x[i]) {
                    dp[i - 1][j][k]
                } else {
                    dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i]]
                }
            }
        }
    }

    var ans = 0L
    for (j in 1..N) {
        ans += dp[N][j][j * A]
    }

    println(ans)
}



Measured memory_bytes: 63584
import sys
input = sys.stdin.readline
N=int(input())
A=[]
B=[]
for i in range(N):
 a,b=map(int,input().split())
 A.append(a)
 B.append(b)
A.sort()
B.sort()
if N%2==1:
 print(B[int((N-1)/2)]-A[int((N-1)/2)]+1)
else:
 print(B[int(N/2)]+B[int(N/2)-1]-A[int(N/2)]-A[int(N/2)-1]+1)

Measured memory_bytes: 89956
import math

N = int(input())
X = [0]*N
Y = [0]*N
for i in range(N):
    X[i], Y[i] = map(int, input().split())

s = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        s += math.sqrt((X[i] - X[j])**2 + (Y[i] - Y[j])**2)
print(s * 2 / N)


Measured memory_bytes: 38384
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;


/* define */
#define Yes(X) puts ( (X) ? "Yes" : "No")
#define YES(X) puts ( (X) ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = (a); i < (b) ; i++)
#define REP(i, n) for ( int i = 0; i < (n) ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = 1000000007;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
ll Lgcd(ll a, ll b) {
	if (b != 0) return Lgcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
	return a / Lgcd(a, b) * b;
}

/* main */


int main(){
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.rbegin(), t.rend());
	Yes(s.compare(t) < 0);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
double a[10005];
int n,t;
double x,maxx = 0,L,Lmid,rmid,r;
double cal(double x)
{

    double ans=0;
    for(int i=1;i<=n;i++){
       ans+=(a[i]-x)*(a[i]-x);
    }
    return ans;
}
int main()
{

        scanf("%d",&n);
        for(int i=1;i<=n;i++)
            scanf("%lf",&a[i]);
        L = 1,r = 100;
        for(int i=1;i<=100;i++){//三分算法寻找最小值
            Lmid = L + (r-L)/3;
            rmid = r - (r-L)/3;
            if(cal(Lmid) <= cal(rmid))
                r = rmid;
            else
                L = Lmid;
        }
        int xx=ceil(L);
        int ans1=cal(xx);
        int ans2=cal(xx+1);
        int ans3=cal(xx-1);
       // cout<<ans1<<" "<<ans2<<" "<<ans3<<endl;
        printf("%d\n",min(min(ans1,ans2),ans3));

    return 0;
}

Measured memory_bytes: 888
n,d = map(int,input().split())
xys=[] #appendのために宣言が必要
for _ in range(n):
  xys.append(list(map(int,input().split())))

cnt=0
for xy in xys:
  if xy[0]**2+xy[1]**2<=d**2:
    cnt+=1
print(cnt)

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

template<typename T>
istream& operator >> (istream& istr, vector<T>& v){
    for(T& x: v) istr >> x;
    return istr;
}

template<typename T, typename U>
istream& operator >> (istream& istr, pair<T,U>& p){
    istr >> p.first >> p.second;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& v){
    if(!v.empty()){
        ostr << v.front();
        for(auto itr = ++v.begin(); itr != v.end(); itr++)
            // ostr << *itr;
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    // ostr << p.first << p.second;
    ostr << p.first << ", " << p.second;
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& vv){
    if(!vv.empty()){
        ostr << vv.front();
        for(auto itr = ++vv.begin(); itr != vv.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& vp){
    if(!vp.empty()){
        ostr << vp.front();
        for(auto itr = ++vp.begin(); itr != vp.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<double> vd;
// vll x(n); x[i]=a;
typedef vector<vll> vvll;
typedef vector<vc> vvc;
typedef vector<vd> vvd;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef pair<double,double> pd;
typedef vector<pll> vpll;
typedef vector<pd> vpd;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
    // cout << fixed << setprecision(10) << ans << endl;
#define EPS 1e-12
#define INF (ll)1e+12
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

ll sum(vll &v) {return accumulate(all(v), 0LL);}

int main(){
    ll k, n;
    cin >> k >> n;
    vll a(n), b(n);
    cin >> a;
    sort(all(a));
    REP(i,n-1) b[i] = a[i+1]-a[i];
    b[n-1] = k+a[0]-a[n-1];
    sort(all(b));
    cout << k-b[n-1] << endl;
    return 0;
}


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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int x;
  REP(i, 5) {
    cin >> x;
    if (x == 0) {
      cout << i + 1 << endl;
    }
  }

  return 0;
}


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

int main(){
  string S;
  cin>>S;
  if((S=="hi")||(S=="hihi")||(S=="hihihi")||(S=="hihihihi")||(S=="hihihihihi")){
    cout<<"Yes"<<endl;
    return 0;
  }

      cout<<"No"<<endl;

  return 0;

}


Measured memory_bytes: 256
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let mut k: usize = sc.read();
    let mut dist = vec![None; n];
    let a: Vec<_> = (0..n).map(|_| sc.read::<usize>() - 1).collect();
    let mut cur = 0;
    dist[cur] = Some(0);
    loop {
        let next = a[cur];
        if dist[next].is_some() {
            let cycle = dist[cur].unwrap() + 1 - dist[next].unwrap();
            if k >= dist[next].unwrap() {
                k = (k - dist[next].unwrap()) % cycle + dist[next].unwrap();
            }
            break;
        } else {
            dist[next] = Some(dist[cur].unwrap() + 1);
            cur = next;
        }
    }
    if k == 0 {
        println!("1");
    } else {
        let i = dist
            .into_iter()
            .enumerate()
            .find(|&(_, d)| d == Some(k))
            .unwrap()
            .0;
        println!("{}", i + 1);
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        Self(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 6824
# Problem A - Biscuits
# 数の並びのパターンを意識する
# input
N, P = map(int, input().split())
a_list = list(map(int, input().split()))

# initialization
even_count = 0
odd_count = 0

# count
for a in a_list:
    if a%2==0:
        even_count += 1
    else:
        odd_count += 1

if even_count==N:
    if P==0:
        print(2**N)
    else:
        print(0)
else:
    print(2**(N-1))


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

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

	int N, K;
	scanf("%d %d", &N, &K);

	vector<bool> S(N, false);

	int d;
	int a;
	for (int i = 0; i < K; i++) {
		scanf("%d", &d);
		for (int j = 0; j < d; j++) {
			scanf("%d", &a);
			S[a - 1] = true;
		}
	}

	cout << count(S.begin(), S.end(), false);
	return 0;
}

Measured memory_bytes: 3684
n = int(input())
a = list(map(int, input().split()))
dp = [1e9]*n
dp[0] = 0
for i in range(1, n):
  dp[i] = min(dp[i], dp[i-1] + abs(a[i] - a[i-1]))
  if i > 1:
    dp[i] = min(dp[i], dp[i-2] + abs(a[i] - a[i-2]))
print(dp[n-1])


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

int main()
{
	int lcs[3003][3003];
	string s,t;
	cin>>s>>t;
	int n,m,i,j;
	n=s.length();
	m=t.length();
	for(i=0;i<=n;i++)
	{
	    for(j=0;j<=m;j++)
	    {
	        if(i==0||j==0)
	        lcs[i][j]=0;
	        else
	        {
	            if(s[i-1]==t[j-1])
	            lcs[i][j]=lcs[i-1][j-1]+1;
	            else
	            lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]);
	        }
	    }
	}
	string str="";
	i=n,j=m;
	while(i>0&&j>0)
	{
	    if(s[i-1]==t[j-1])
	    {
	        str.push_back(s[i-1]);
	        i--;
	        j--;
	    }
	    else
	    {
	        if(lcs[i-1][j]>lcs[i][j-1])
	        i--;
	        else
	        j--;
	    }
	}
	if(str=="")
	cout<<str;
	else
	{
	reverse(str.begin(),str.end());
	cout<<str;
	}
	return 0;
}

Measured memory_bytes: 38848
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int A,B,C;cin>>A>>B>>C;
  int X=C+10*B+100*A;
  
  if(X%4==0){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 3584
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <bits/stdc++.h>

using namespace std;

class arc098c {
public:
    void solve(istream& in, ostream& out) {
        int N;
        string S;
        in >> N >> S;
        int left_w = 0, right_e = 0;
        for (int i = 1; i < N; ++i) {
            right_e += (S[i] == 'E');
        }
        int ans = left_w + right_e;
        for (int i = 1; i < N; ++i) {
            if (S[i - 1] == 'W') {
                ++left_w;
            }
            if (S[i] == 'E') {
                --right_e;
            }
            ans = min(ans, left_w + right_e);
        }
        out << ans << "\n";
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	arc098c solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 720
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
	string s;
	cin>>s;
	if((s[0]==s[1]&&s[1]==s[2]&&s[2]==s[0])||(s[1]==s[2]&&s[2]==s[3]&&s[3]==s[1])){
		cout<<"Yes"<<endl;
	}
	else{
			cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
int UF[50000];
int p[50000];
int q[50000];
vector<int>h[110000];
vector<int>v[110000];
int FIND(int a){
	if(UF[a]<0)return a;
	return UF[a]=FIND(UF[a]);
}
void UNION(int a,int b){
	a=FIND(a);b=FIND(b);if(a==b)return;
	UF[a]+=UF[b];UF[b]=a;
}
int t[50000];
int d[4];
int main(){
	int a,b,c;scanf("%d%d%d",&a,&b,&c);
	for(int i=0;i<a;i++){
		scanf("%d%d",p+i,q+i);
		p[i]--;q[i]--;
		h[p[i]].push_back(i);
		v[q[i]].push_back(i);
	}
	for(int i=0;i<a;i++)UF[i]=-1;
	for(int i=0;i<110000;i++){
		for(int j=1;j<h[i].size();j++)UNION(h[i][j-1],h[i][j]);
		for(int j=1;j<v[i].size();j++)UNION(v[i][j-1],v[i][j]);
	}
	int ret=0;
	for(int i=0;i<a;i++)if(UF[i]>=0)ret++;
	if(ret==a-1){
		printf("%d\n",ret);return 0;
	}
	for(int i=0;i<a;i++){
		if(p[i]==0)t[FIND(i)]|=1;
		if(q[i]==0)t[FIND(i)]|=2;
		if(p[i]==b-1)t[FIND(i)]|=4;
		if(q[i]==c-1)t[FIND(i)]|=8;
	}
	for(int i=0;i<a;i++){
		for(int j=0;j<4;j++)if(t[i]&(1<<j))d[j]++;
	}
	int tmp=0;
	for(int i=0;i<4;i++)tmp=max(tmp,d[i]);
	int rem=a-ret;
	printf("%d\n",a-1+rem-tmp);
}

Measured memory_bytes: 8752
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n; cin >> n;
    unordered_set<ll> anss;
    anss.insert(n);
    if(n > 2){
        anss.insert(n - 1);
    }
    auto check = [&](ll num){ 
        ll n2 = n;
        while(n2 >= num){
            ll rem = n2 % num;
            if(rem == 0){
                n2 = n2 / num;
            }else{
                n2 = rem;
            }
        }
        if(n2 == 1){
            anss.insert(num);
        }
    };
    for(ll i = 2; i * i <= n; i++){
        check(i);
        check(n / i);
        check(n / i + 1);
    }
    printde(anss);
    cout << anss.size() << '\n';
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
typedef long long ll;
const int mod=1e9+7;
ll power(ll a,ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1) ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}

ll C(ll x,ll y)
{
	ll ans=1;
	if(x-y<y) y=x-y;
	for(int i=1;i<=y;i++)
	{
		ans=ans*x%mod*power(i,mod-2)%mod;
		x--;
	}
	return ((-ans)%mod+mod)%mod;
}

ll n,a,b;
int main()
{
	scanf("%lld%lld%lld",&n,&a,&b);
	printf("%lld\n",((power(2,n)+C(n,a)+C(n,b)-1)%mod+mod)%mod);
	return 0;
}


Measured memory_bytes: 256