akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 205
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//------------------------------------
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	string s;
	cin>>s;
	ll i,j,k,n=s.length();
	if(n%2){
		cout<<"No";return 0;
	}

	for(i=0;i<n;i+=2){
		if(s[i]!='h'||s[i+1]!='i'){
			cout<<"No";return 0;		
		}
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
//#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >   
#define vpl vector< pair<ll,ll> >   
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double
#define double long double
#define N 200005

int32_t main()
{
    IOS;
   /* #ifndef ONLINE_JUDGE
    freopen("int.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif*/
    int n,x;
    cin>>n>>x;
    vi v(n);
    for(int i=0;i<n;i++)
        cin>>v[i];
    sort(v.begin(),v.end());
    int cnt=0;
    for(int i=0;i<n;i++)
    {
          if(x-v[i]>=0)
            {x-=v[i];cnt++;}
        else
        {
            if(x!=0)
                cnt++;
            break;      
        }
    }
    if(x!=0)
        cnt--;
    cout<<max(0,cnt);
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;
template<class T>void sort(vec<T> &v){sort(v.begin(),v.end());}
template<class T>void rsort(vec<T> &v){sort(v.rbegin(),v.rend());}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x; cin >> x;
    ll i = 0,m = 100;
    while(m < x){
        m += m / 100;
        i++;
    }
    cout << i << endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define all(v) (v.begin(),v.end())
#define ll long long
const int N=1e5+5;
const int inf=2e9;
const ll mod=323232323;
int a[N];
map<int,int>b,c;
int main(){
    ios::sync_with_stdio(0);
    #ifdef _LOCAL_DEBUG
    freopen("in.txt","r",stdin);
    #endif // _LOCAL_DEBUG
    int n;
    cin>>n;
    rep(i,0,n){
		cin>>a[i];
    }
    int even=0,ve=-1,odd=0,vo=-1;
    rep(i,0,n){
		if(i&1){
			++b[a[i]];
			if(b[a[i]]>odd){
				odd=b[a[i]];
				vo=a[i];
			}
		}
		else{
			++c[a[i]];
			if(c[a[i]]>even){
				even=c[a[i]];
				ve=a[i];
			}
		}
    }
    int ans;
    if(ve!=vo){
		ans=n-odd-even;
    }
    else{
		b.clear();
		int num=0;
		for(int i=0;i<n;i+=2){
			if(a[i]==ve) continue;
			++b[a[i]];
			if(b[a[i]]>num){
				num=b[a[i]];
			}
		}
		ans=n-odd-num;
		b.clear();
		num=0;
		for(int i=1;i<n;i+=2){
			if(a[i]==ve) continue;
			++b[a[i]];
			if(b[a[i]]>num){
				num=b[a[i]];
			}
		}
		ans=min(ans,n-even-num);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5376
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <stack>
#include <iomanip>
#include <climits>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<int,int> pii;
int main(){
    int n;
    cin >> n;
    int a[305][305];
    int b[305][305];
    rep(i,n){
        rep(j,n){
            cin >> a[i][j];
            b[i][j] = a[i][j];
        }
    }
    rep(k,n){
        rep(i,n){
            rep(j,n){
                a[i][j] = min(a[i][j], a[i][k] + a[k][j]);
            }
        }
    }
    ll ans = 0;
    rep(i,n){
        rep(j,n){
            ans+=a[i][j];
            if(a[i][j] != b[i][j]){
                cout << -1 << endl;
                return 0;
            }else{
                rep(k,n){
                    if(i!=k && j!=k && a[i][j] == a[i][k] + a[k][j]){
                        //show(a[i][j]);
                        ans -= a[i][j];
                        break;
                    }
                }
            }
        }
    }
    cout << ans/2 << endl;
}

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

using namespace std;
typedef long long ll;
#define INF 1999999999
#define MODA 1000000007 
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main() {
  string S;
  cin >> S;

  ll ans = 0;
  ll count = 0;
  rep(i, S.size()) {
    if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
      count++;
    }
    else {
      ans = ans > count ? ans : count;
      count = 0;
    }
  }
  ans = ans > count ? ans : count;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3632
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main(){
	REP(i, 3) {
		string a;
		cin >> a;
		cout << (char)(a[0] + 'A' - 'a');
	}
	cout << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(X: int, Y: int, Z: int):
    print(Z, X, Y)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    Z = int(next(tokens))  # type: int
    solve(X, Y, Z)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:input()

"""========main code==============="""

#t=ii()
t=1
for _ in range(t):
    s=ip()
    if(s[len(s)-1]=='s'):
        print(s+"es")
    else:
        print(s+"s")

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

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

    ll A, B, C, D;
    cin >> A >> B >> C >> D;

    vvll dp(C-A+1, vll(D-B+1, 0));
    dp[0][0] = 1;
    rep(i, C-A) dp[i+1][0] = dp[i][0] * B % 998244353;
    rep(i, D-B) dp[0][i+1] = dp[0][i] * A % 998244353;
    REP(i, 1, C-A+1) REP(j, 1, D-B+1){
        dp[i][j] = (dp[i-1][j]*(j+B) + dp[i][j-1]*(i+A) - dp[i-1][j-1]*(j+B-1)*(i+A-1)) % 998244353;
        dp[i][j] = (dp[i][j]+998244353) % 998244353;
    }
    cout << dp[C-A][D-B] << endl;
}


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

using vi = vector<int>;
#define f(i,a,b) for (int i = a; i < b; i++)
#define pb push_back

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	clock_t start = clock();
#endif

	int n; cin >> n;
	vi adj[n];
	f(i,0,n-1) {
		int a,b; cin>>a>>b;
		adj[--a].pb(--b); adj[b].pb(a);
	}
	function<int(int,int)> dfs = [&](int v, int p) {
		int ans = 0;
		for (int w : adj[v]) if (w != p)
			ans ^= 1+dfs(w,v);
		return ans;
	};
	cout << (dfs(0,-1)?"Alice":"Bob") << endl;

#ifdef LOCAL
	cout << setprecision(12) << (long double)(clock()-start) / CLOCKS_PER_SEC << endl;
#endif
	
	return 0;
}



Measured memory_bytes: 13568
S = input()
N = len(S)

ans_l = 1
idx = 1
tmp = S[0]
while idx < N:
    for i in range(N-1):
        if tmp != S[idx:idx+i+1]:
            ans_l += 1
            tmp = S[idx:idx+i+1]
            break
        if i + idx == N-1:
            break
    idx += (i+1)

print(ans_l)



Measured memory_bytes: 42204
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

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

    int n, m;
    cin >> n >> m;
    if (m == 1 || n >= m)
    {
        cout << 0 << endl;
        return 0;
    }
    priority_queue<int> xs;
    rep(i, m)
    {
        int x;
        cin >> x;
        xs.push(x);
    }
    priority_queue<int> q;
    int max = xs.top();
    int before = xs.top();
    int after;
    xs.pop();
    rep(i, m - 1)
    {
        after = xs.top();
        q.push(abs(before - after) - 1);
        before = after;
        xs.pop();
    }
    int d = abs(max - after);
    rep(i, n - 1)
    {
        if (q.empty()) break;
        d -= q.top();
        q.pop();
    }
    cout << (d - n + 1) << endl;

    return 0;
}

Measured memory_bytes: 1400
#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()
{
  string S;
  cin >> S;
  vector<string> week = {
    "MON",
    "TUE",
    "WED",
    "THU",
    "FRI",
    "SAT",
    "SUN",
  };
  int index;
  rep(i, week.size()) {
    if (week.at(i) == S) {
      index = i;
    }
  }
  if (S == "SUN") {
    cout << 7 << endl;
  } else {
    cout << 6 - index << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define endl '\n';
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define floop(i,a,b) for(int i=a;i<=b;++i)
const ll mod=1e9+7;
const int N = 10000000;
int lp[N+1];
vector<int> pr;
int32_t main(){
	IOS;	
	for (int i=2; i<=N; ++i) {
	    if (lp[i] == 0) {
	        lp[i] = i;
	        pr.push_back (i);
	    }
	    for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
	        lp[i * pr[j]] = pr[j];
	}
	ll ans=0;
	int n;
	cin>>n;
	floop(i,1,n){
		int curr = 1;
		int x = i;
		while(x>1){
			int temp = 0;
			int flag = lp[x];
			while(x%flag==0){
				x/=flag;
				temp++;
			}
			curr*=(temp+1);
		}
		ans += (ll(i))*(ll(curr));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 89720
import sys
import math
import functools
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
s = []
t = []
for _ in range(n):
    si, ti = stdin.readline().split(" ")
    s.append(si)
    t.append(int(ti))
x = ns()
index = s.index(x)
ans = sum(t[index+1:])
print(ans)



Measured memory_bytes: 3700
#include "bits/stdc++.h"
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vp = vector<Pii>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

  int n, m;
  cin >> n >> m;
  vi s(n + 1);
  rep2(i, 1, n + 1) cin >> s[i];
  vi t(m + 1);
  rep2(j, 1, m + 1) cin >> t[j];

  // printV(s);
  // printV(t);

  vvi dp(n + 1, vi(m + 1));
  vvi dp_sum(n + 1, vi(m + 1));
  dp[0][0] = 1;
  dp_sum[0][0] = 1;
  rep2(i, 1, n + 1) dp_sum[i][0] = 1;
  rep2(j, 1, m + 1) dp_sum[0][j] = 1;
  rep2(i, 1, n + 1) {
    rep2(j, 1, m + 1) {
      // cerr << "i = " << i << ", j = " << j << endl;
      if (s[i] == t[j]) {
        // std::cerr << __LINE__ << std::endl;
        // dp[i][j] = (dp_sum[i - 1][j - 1] + 1) % mod;
        dp[i][j] = dp_sum[i - 1][j - 1];
      }
      else {
        // std::cerr << __LINE__ << std::endl;
        dp[i][j] = 0;
      }
      dp_sum[i][j] = (dp_sum[i - 1][j] + dp_sum[i][j - 1] + (mod - dp_sum[i - 1][j - 1]) + dp[i][j]) % mod;
    }
  }

  // printVV(dp);
  // printVV(dp_sum);

  cout << dp_sum[n][m] << endl;

}


Measured memory_bytes: 62976
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#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(){
  int N;
  cin >> N;
  vector<int> H(N);
  for(int i = 0; i < N; i++){
    cin >> H.at(i);
  }
  reverse(ALL(H));
  bool judge = true;
  for(int i = 0; i < N-1; i++){
    if(H.at(i) == H.at(i+1) - 1) H.at(i+1)--;
    else if(H.at(i) < H.at(i+1) - 1){
      judge = false;
      break;
    }
  }
  if(judge) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int> a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(), (a).end()

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

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

ll keta(ll n)
{
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1, 0, -1, 0};
const int dw[4] = {0, 1, 0, -1};

struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind
{
public:
  vi Parent;
  UnionFind(int n)
  {
    Parent = vi(n, -1);
  }

  int root(int a)
  {
    if (Parent[a] < 0)
      return a;
    else
      return Parent[a] = root(Parent[a]);
  }

  int size(int a)
  {
    return -Parent[root(a)];
  }

  bool merge(int a, int b)
  {
    a = root(a);
    b = root(b);
    if (a == b)
      return false;

    if (size(a) < size(b))
      swap(a, b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial
{
public:
  vl Fac;
  Factrial(int MAX)
  {
    Fac = vl(MAX + 1);
    rep(i, MAX)
    {
      if (i == 0)
        Fac[i + 1] = 1;
      else
        Fac[i + 1] = ((i + 1) * Fac[i]) % MOD;
    }
  }
};

int main(){
  string s,t; cin >> s >> t;
  cout << t+s << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int　main(){
	int a,b;
  	scanf("%d ",&a);
  	scanf("%d",&b);
  	int c;
  	c=a*b;
  	if(c%2==0){
      printf("Even");
    }else{
      printf("Odd");
    }
  return 0;
}

Measured memory_bytes: 128
#65
n = int(input())
a = []
for j in range(n):
    a.append(int(input()))

count = 0
i = 1
for j in range(n+1):
    if a[i-1]==2:
        count += 1
        print(count)
        break
    else:
        i = a[i-1]
        count += 1
    if j ==n:
        print(-1)

Measured memory_bytes: 7084
#include<bits/stdc++.h>
using namespace std;
 
int K,N;
int A[200001];
 
int main(){
	cin>>K>>N;
  	for(int i=1;i<=N;i++){
    	cin>>A[i];
    }
  	A[N+1]=A[1]+K;
  	int kyori=0;
	for(int j=1;j<=N;j++){
    	if(kyori<A[j+1]-A[j]) kyori=A[j+1]-A[j];
    }
  	cout<<K-kyori;
  	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>

typedef long long int ll;


using namespace std;

int calc(int n){
	return 1+n*(n+1)/2;
}

int main(){
	int n;
	while(cin>>n){
		cout<<calc(n)<<endl;
	}
}

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

using namespace std;

string s;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> s;
    string a = s.substr(0, 2), b = s.substr(2, 2);
    int x = atoi(a.c_str()), y = atoi(b.c_str());
    if (0 < x && x <= 12 && 0 < y && y <= 12)
    {
        cout << "AMBIGUOUS" << endl;
    }
    else if (0 < x && x <= 12)
    {
        cout << "MMYY" << endl;
    }
    else if (0 < y && y <= 12)
    {
        cout << "YYMM" << endl;
    }
    else
        cout << "NA" << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll n;
ll ar[100001];
ll dp[100001];
ll func(ll idx)
{
	if(idx==0)
	return 0;
	if(idx<0)
	return 999999999999;
	if(dp[idx]!=-1)
	return dp[idx];
	ll ret=min(func(idx-1)+abs(ar[idx]-ar[idx-1]),func(idx-2)+abs(ar[idx]-ar[idx-2]));
	return dp[idx]=ret;
}
int main()
{
	cin>>n;
	for(ll i=0;i<n;i++)
	cin>>ar[i];
	dp[0]=0;
	dp[1]=abs(ar[0]-ar[1]);
	for(ll i=2;i<100001;i++)
	{
		dp[i]=min(dp[i-1]+abs(ar[i]-ar[i-1]),dp[i-2]+abs(ar[i]-ar[i-2]));
	}
	cout<<func(n-1);
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#define pi 3.14159265358979323846
using namespace std;

int main()
{
	int a, b;
	char op;
	while(true)
	{
		cin>>a>>op>>b;
		switch(op)
		{
			case '+' :
				cout<<a+b<<endl;
				break;
			case '-' :
				cout<<a-b<<endl;
				break;
			case '*' :
				cout<<a*b<<endl;
				break;
			case '/' :
				cout<<a/b<<endl;
				break;
			case '?' :
				return 0;
		}
	}

}


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

using namespace std;

using ll = long long;

ll gcd(ll a, ll b) {
  while (b) {
    ll c = b;
    b = a % b;
    a = c;
  }
  return a;
}

ll lcm(ll a, ll b) {
  if (!a || !b) return 0;
  return a * b / gcd(a, b);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll ans = b - a + 1;
  ans -= b / c - (a - 1) / c;
  ans -= b / d - (a - 1) / d;
  ans += b / lcm(c, d) - (a - 1) / lcm(c, d);
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
#define long long int ll;

struct uf_tree{
	vector<int> par, sizes;
	uf_tree(int n) : par(n), sizes(n,1){
		for(int i=0; i<n; i++){
			par[i]=i;
		}
	}
	int find(int x){
		if(x==par[x])return x;
		return par[x]=find(par[x]);
	}
	void unite(int x, int y){
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(sizes[x] < sizes[y]){ swap(x,y); }
		par[y] = x;
		sizes[x] += sizes[y];
	}
	bool same(int x, int y){
		return find(x)==find(y);
	}
	int size(int x){
		return sizes[find(x)];
	}
};


int main()
{
	/*
	int N, Q;
	int P, A, B;

	cin >> N >> Q;

	uf_tree uf(N);

	for(int i=0; i<Q; i++){
		cin >> P >> A >> B;
		if(P){
			cout << (uf.same(A, B) ? "YES" : "NO") << endl;
		}else{
			uf.unite(A,B);
		}
	}
*/

	int N, M;
	cin >> N >> M;
	uf_tree uf(N);
	int X, Y, Z;
	
	int ans=N;
	for(int i=0; i<M; i++){
		cin >> X >> Y >> Z;
		if(!uf.same(X-1, Y-1)){
			ans--;
		}
		uf.unite(X-1,Y-1);
	}

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

Measured memory_bytes: 1024
import math
N = int(raw_input())
list = map(int,raw_input().split())

k = 0
tot = abs(list[0]) + abs(list[N - 1])

while k < N - 1:
    tot += abs(list[k] - list[k + 1])
    k = k + 1

for i in range(N):
    if i == 0:
        print tot - abs(list[0] - list[1]) - abs(list[0]) + abs(list[1])
    elif i == N - 1:
        print tot - abs(list[N - 1] - list[N - 2]) - abs(list[N - 1]) + abs(list[N - 2]) 
    else:
        print tot - abs(list[i - 1] - list[i]) - abs(list[i] - list[i + 1]) + abs(list[i + 1] - list[i - 1])

Measured memory_bytes: 11280
#include <stdio.h>
#include <ctype.h>
     
int par[100000];
     
void init(int);
int dep(int);
int inp(void);
    
char *p;
char in[1500000];
int tree[100000][15],idx[100000];
    
int main(){
  int n,i,j,id,k,c;
    
  fread(in,sizeof(in),1,stdin);  
  p = in;
    
  n = inp(); init(n);
  for(i = 0 ; i < n ; i++){
    id = inp();
    k = inp();
    for(j = 0 ; j < k ; j++){
      c = inp();
      par[c] = id;
      tree[id][idx[id]++] = c;
    }
  }
     
  for(i = 0 ; i < n ; i++){
    printf("node %d: parent = %d, depth = %d, "
           ,i,par[i],dep(i));
        
    if(par[i] == -1){
      printf("root, [");
    }else if(!idx[i]){
      printf("leaf, [");
    }else{
      printf("internal node, [");
    }
    
    for(j = 0 ; j < idx[i] ; j++){
      printf("%d",tree[i][j]);
      if(j < idx[i]-1) printf(", ");
    }
    puts("]");
  }
  return 0;
}
    
void init(int n){
  int i;
  for(i = 0 ; i < n ; i++){
    par[i] = -1;
  }
}
    
int dep(int x){
  if(par[x] == -1) return 0;
  return dep(par[x]) + 1;
}
    
int inp(){
  int v = 0;
  while(!isdigit(*p)) ++p;
  v = *p++&15;
  while(isdigit(*p)){
    v = (v<<3)+(v<<1)+(*p++&15);
  }
  return v;
}

Measured memory_bytes: 4024
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e18;


signed main(){
	int L, R, d;
	cin >> L >> R >> d;
	int ans = 0;
	FOR(i, L, R + 1) {
		if(i % d == 0)++ans;
	}
	out(ans);
}

Measured memory_bytes: 3568
a,b,c,k=map(int,input().split())

if k>=a+b+c:
  print(a-c)
elif a+b<=k<=a+b+c:
  print(a-(k-(a+b)))
elif a<=k<=a+b:
  print(a)
elif 0<=k<=a:
  print(k)


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

long long a[202];
long long v[202];
char s[202];

int main()
{
	int T;
	scanf("%d", &T);
	while(T--)
	{
		int n;
		scanf("%d", &n);
		for(int i = 1; i <= n; i++)
		{
			scanf("%lld", &a[i]); 
		}
		scanf("%s", s + 1);
		
		memset(v, 0, sizeof(v));
		
		int ans = 0;
		for(int i = n; i >= 1; i--)
		{
			if(s[i] == '0')
			{
				for(int j = 61; j >= 0; j--)
					if(a[i] & (1ll << j))
					{
						if(v[j] == 0)
						{
							v[j] = a[i];
							break;
						}
						else
							a[i] ^= v[j];
					}
			}
			else
			{
				for(int j = 61; j >= 0; j--)
					if(a[i] & (1ll << j))
					{
						if(v[j] == 0)
						{
							ans = 1;
							break;
						}
						else
							a[i] ^= v[j];
					}
				if(ans == 1)
					break;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3756
import java.util.Scanner;



public class Main {

	public static void main(String[] args) {

		Solve s= new Solve();
		s.solve();

	}
}


class Solve{


	 public void solve() {
		 Scanner sc = new Scanner(System.in) ;
		 int N = sc.nextInt();
		 int M = sc.nextInt();
		 int[] a = new int[N];
		 int p=0;
		 int res=0;
		 for(int i = 0;i<M;i++) {
			 int k;
			 k=sc.nextInt();
			 for(int j = 0;j<k;j++) {
				 int s=sc.nextInt();
				 s--;
				 a[s]|=1<<i;
			 }
		 }
		 for(int i =0;i<M;i++) {
			 int x=sc.nextInt();
			 p |= x<<i;
		 }
		 
		 for(int j = 0;j<Math.pow(2, N);j++) {
			 int t = 0;
			 for(int i = 0;i<N;i++) {
				 if((j>>i&1)==1) {
					 t ^= a[i];
				 }
			 }
			 if(t==p) {
				 res++;
			 }
		 }
		 System.out.println(res);
	 }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
const ll INF=1e16+7;
int main(){
	ll N,A[3],ans=INF,K=1;
	cin >> N >> A[0] >> A[1] >> A[2];
	vector<ll> L(N);
	FOR(i,0,N)cin>>L[i];
	FOR(i,0,N)K*=4;
	FOR(t,0,K){
		vector<P> a={{0,0},{0,0},{0,0}};
		ll p = t;
		FOR(i,0,N){
			if(p%4!=3){
				a[p%4].first+=L[i];
				a[p%4].second++;
			}
			p /= 4;
		}
		FOR(i,0,3)p+=abs(a[i].first-A[i]);
		FOR(i,0,3)p+=(a[i].second-1)*10;
		FOR(i,0,3)if(a[i].second==0)p=INF;
		ans = min(ans,p);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
package com.example.alds1.Five

import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = IntArray(n).map { sc.nextInt() }.toIntArray()
    val q = sc.nextInt()
    for (i in 0 until q) {
        if (combination(a, sc.nextInt())) {
            println("yes")
        } else {
            println("no")
        }
    }
}

fun combination(a: IntArray, m: Int, i: Int = 0): Boolean {
    if (m == 0) {
        return true
    }
    if (i >= a.size) {
        return false
    }

    return combination(a, m, i + 1) || combination(a, m - a[i], i + 1)
}



Measured memory_bytes: 28324
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define each(i, c) for (auto& (i) : (c))

using namespace std;
typedef long long int lli;
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }

int main() {
    int n;
    cin >> n;
    vector<string> ws;
    rep(i,n) {
        string w;
        cin >> w;
        ws.push_back(w);
    }
    
    set<string> s;
    bool ok = true;
    rep(i,n) {
        if (s.find(ws[i]) != s.end()) {
            ok = false;
        }
        s.insert(ws[i]);
        if (i > 0 && ws[i-1][ws[i-1].length()-1] != ws[i][0]) {
            ok = false;
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	private BufferedReader br;
	private int n,m,sum;
	private int[] time;
	private StringTokenizer st;

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		new Main().start();
	}
	private void start() throws IOException{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=new StringTokenizer(br.readLine());
		n=Integer.parseInt(st.nextToken());
		m=Integer.parseInt(st.nextToken());
		time=new int[n];
		st=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++){
			time[i]=Integer.parseInt(st.nextToken());
		}
		for(int i=0;i<n-1;i++){
			if(time[i+1]-time[i]<m){
				sum+=time[i+1]-time[i];
			}
			else{
				sum+=m;
			}
		}
		System.out.println(sum+m);
	}
}


Measured memory_bytes: 45780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M = 2e5 + 10;
const int N = 2e5;
ll ans[M];
void init(){
    int sum = 0;
    queue <ll> que;
    for(ll i = 1; i <= 9; i++) que.push(i);
    while(!que.empty()) {
        ll x = que.front();
        que.pop();
        sum++;
        ans[sum] = x;
        if(sum == N) break;
        for(ll i = -1; i <= 1; i++) {
            if((x % 10) + i >= 0 && (x % 10) + i <= 9) {
                que.push(x * 10 + (x % 10) + i);
            }
        }
    }
}
int main(){
    init();
    int k;
    while(~scanf("%d", &k)){
        printf("%lld\n", ans[k]);
    }
    return 0;
}


Measured memory_bytes: 4992
#include<cstdio>
#include<cstring>
int main()
{
    char str[10];
    scanf("%s",str);
    int len=strlen(str);
    if(len==2)
        printf("%s",str);
    else if(len==3)
    {
        printf("%c",str[2]);
        printf("%c",str[1]);
        printf("%c\n",str[0]);
    }
    return 0;
}


Measured memory_bytes: 128
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
// g++ hoge.cpp -std=c++17 -I . でコンパイルできる
// -fsanitize=undefinedでオーバーフロー検出
#include <bits/stdc++.h>
//#include <atcoder/all>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
//using namespace atcoder;
typedef pair<ll,ll> P;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll a,b,c,d,m,n,k,x,y,maxi=0,f=0,mini=INF,sum=0;
    string str;
    ll q;
    cin>>n>>q;
    cin>>str;
    P p[q];
    rep(i,q){
        cin>>a>>b;
        a--;
        b--;
        p[i]=P(a,b);
    }
    vector<ll> imos(n+1);
    rep(i,n-1){
        if(i!=0)imos[i]=imos[i-1];
        if(str.substr(i,2).compare("AC")==0) {
            imos[i]++;
        }
        //cout<<imos[i]<<" ";
    }
    a=0;b=0;
    rep(i,q){ 
        if(p[i].first!=0)sum=imos[p[i].second-1]-imos[p[i].first-1];
        else sum=imos[p[i].second-1];
        cout<<sum<<endl;
    }

    return 0;
}


Measured memory_bytes: 5804
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const S = input[1][0];

  let x = 0;
  let max = 0;

  S.split("").forEach((char) => {
    x = char === "I" ? x + 1 : x - 1;

    if (x > max) {
      max = x;
    }
  });

  return max;
};

console.log(main(read()));


Measured memory_bytes: 29408
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
typedef long long ll;
ll INF = 1LL << 60;

using namespace std;




int main() {
	string s; cin >> s;
	ll ans = 0, cnt = 0;
	rep(i, s.size()) {
		if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
			cnt += 1;
		}
		else {
			ans = max(ans, cnt);
			cnt = 0;
		}
	}
	ans = max(ans, cnt);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x;
	cin >> x;
	for (int i = 1; i <= 100000; ++i) {
		if (i * (i + 1) / 2 >= x) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
m = len(input())

mod = 10**9 + 7

# dp[i][j] = i文字打ってj文字入力されてる0or1 とBの打ち方
dp = [0]*(n+1)
dp[0] = 1

# 遷移 : dp[i][j] →dp[i+1][j+1]+ dp[i+1][max(j-1,0)]+
for i in range(n):
    dpnxt = [0]*(n+1)
    for j in range(n):
        dpnxt[j+1] += dp[j]
        dpnxt[j+1] %= mod
        dpnxt[max(j-1,0)] += dp[j]*(2 - (j==0))%mod
        dpnxt[max(j-1,0)] %= mod
    dp = dpnxt.copy()
print(dp[m])


Measured memory_bytes: 76336
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <cstring>
#include <cstdlib>
#include <map>

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

const int dy[]={-1,0,0,1};
const int dx[]={0,-1,1,0};

int w[2],h[2],x[2],y[2];
int r;
int field[2][501][501];
bool passed[501][501];
map<int,int> visitableRooms[2];

int INF=1000000000;

void bfs(int k,int sx,int sy){
    // FØx1©çÔÉTõ
    priority_queue<P,vector<P>,greater<P> > pq;
    pq.push(make_pair(1,make_pair(sy,sx)));
    // »ÝÌx
    int cL=0;
    // Kê½®Ì
    int sum=0;
    passed[sy][sx]=true;
    while(pq.size()){
        P p=pq.top();
        pq.pop();
        int level=p.first;
        int cx=p.second.second;
        int cy=p.second.first;
        sum++;
        // »ÝÌxðXV·éKvª êÎAXV·é
        if(level>cL)
            cL=level;
        visitableRooms[k][cL]=sum;
        for(int i = 0; i < 4; i++){
            int ny=cy+dy[i];
            int nx=cx+dx[i];
            if(ny>=0&&nx>=0&&ny<h[k]&&nx<w[k]&&!passed[ny][nx]){
                pq.push(P(field[k][ny][nx],make_pair(ny,nx)));
                passed[ny][nx]=true;
            }
        }
    }
    if(visitableRooms[k].find(cL)==visitableRooms[k].end())
        visitableRooms[k][cL]=sum;
}

int main(){
    while(cin>>r&&r!=0){
        for(int k = 0; k < 2; k++){
            visitableRooms[k].clear();
            cin>>w[k]>>h[k]>>x[k]>>y[k];
            x[k]--;y[k]--;
            for(int i = 0; i < h[k]; i++)
                for(int j = 0; j < w[k]; j++)
                    cin>>field[k][i][j];
        }
        for(int k = 0; k < 2; k++){
            visitableRooms[k][0]=0;
            memset(passed,0,sizeof(passed));
            bfs(k,x[k],y[k]);
        }
        map<int,int>::iterator ait=visitableRooms[0].begin();
        map<int,int>::iterator bit=visitableRooms[1].end();
        bit--;
        int minLevelSum=INF;
        // »ê¼êÌiteratorð®©·
        while(1){
            int roomSum=(ait->second)+(bit->second);
            if(roomSum>=r){
                minLevelSum=min(minLevelSum,(int)(ait->first+bit->first));
                if(bit==visitableRooms[1].begin())
                    break;
                bit--;
            }
            else{
                ait++;
                if(ait==visitableRooms[0].end())
                    break;
            }
        }
        cout<<minLevelSum<<endl;
    }
    return 0;
}

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

int main()
{
    int H , N;
    vector<int>v;
    int value;
    cin>>H>>N;
    if(1<=H&&H<=pow(10,9)&&1<=N&&N<=pow(10,5))
    {
        for(int i=0 ; i<N ; i++)
        {
            cin>>value;
            if(1<=value&&value<=pow(10,4))
            {
                v.push_back(value);
            }
        }
        for(int i=0 ; i<N ; i++)
        {
            H=H-v[i];
        }
        if(H<=0)
        {
            cout<<"Yes"<<endl;
        }
        else
            cout<<"No"<<endl;
    }
    return 0;
}


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

const double PI = acos(-1);

int main()
{
    int a, b, h, m;

    cin>>a>>b>>h>>m;

    double th = double(h*60+m)/720 * 2*PI;
    double tm = double(m)/60 * 2*PI;

    double xh = a*cos(th), yh = a*sin(th);
    double xm = b*cos(tm), ym = b*sin(tm);

    double dx = xh-xm, dy = yh-ym;

    double ans = sqrt(dx*dx + dy*dy);

    printf("%.10f\n", ans);

    return 0;
}


Measured memory_bytes: 4040
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define LL long long 
const int INF = 1145141919;

int main(){
	while (1){
		int n, k, memo, steps, ans = 0;
		bool flag = 0, used;
		int deta[100002];
		cin >> n >> k;
		if (n == 0 && k == 0) return 0;
		REP (i, k) cin >> deta[i];
		sort (deta, deta + k);
		if (deta[0] == 0) flag = 1;
		FOR (i, flag, k){
			memo = deta[i];
			steps = 1;
			used = 0;
			FOR (j, i + 1, k){
				if (memo + 1 == deta[j]){
					memo++;
					steps++;
				}else if (flag == 1 && used == 0){
					memo++;
					steps++;
					j--;
					used = 1;
				}else{
					break;
				}
			}
			ans = max (ans, steps);
		}
		cout << ans << endl;
	}	
}

Measured memory_bytes: 1492
#include <bits/stdc++.h>
using namespace std;
#define long long long
#define read cin >>
#define echo cout <<
#define fin << endl
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main() {
  int n;
  read n;
  vector<int> data(n);
  REP(i, n) { read data[i]; }
  int minimum = data[0];
  int ans = 0;
  REP(i, n) {
    if (minimum >= data[i]) {
      ans++;
      minimum = data[i];
    }
  }
  echo ans fin;
}


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

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

	string s;
	cin >> s;

	deque<char> q;
	for (auto c : s) q.push_back(c);

	int n;
	cin >> n;

	bool f = 0;
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		if (x == 1) f = !f;
		else {
			int z;
			char c;
			cin >> z >> c;

			if ((z == 1 && !f) || (z == 2 && f)) q.push_front(c);
			else q.push_back(c);
		}
	}
	while (!q.empty()) {
		if (f) {
			cout << q.back();
			q.pop_back();
		} else {
			cout << q.front();
			q.pop_front();
		}
	}
	cout << '\n';
}


Measured memory_bytes: 976
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    string s;
    cin >> s;
    cout << (s == "ARC" ? "ABC" : "ARC") << endl;
    
    
    

    return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define has(c,i) ((c).find(i) != end(c))
#define DBGDO(X) ({ if(1) cerr << "DBGDO: " << (#X) << " = " << (X) << endl; })

bool check(ll a, ll b, ll mask) {
	ll vmask = 1LL << a;
	FORD(k,1,50) if (mask & (1LL << k)) {
		FOR(i,0,51) if (vmask & (1LL << i)) vmask |= 1LL << (i%k);
		if (vmask & (1LL << b)) return true;
	}
	if (vmask & (1LL << b)) return true;
	return false;
}

const ll N = 55;
bool poss[N][N];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	vl a(n), b(n);
	FOR(i,0,n) cin >> a[i];
	FOR(i,0,n) cin >> b[i];

	bool ok = true;
	FOR(i,0,n) if (b[i] >= (a[i]+1)/2 && b[i] != a[i]) ok = false;

	if (!ok) {
		cout << -1 << endl;
		return 0;
	}
	
	ll res = 0;
	FORD(k,0,50) {
		bool need = false;
		FOR(i,0,n) if (!check(a[i],b[i], res | ((1LL << k) - 1))) need = true;
		if (need) res |= 1LL << k;
	}
	cout << res << endl;
}



Measured memory_bytes: 256
x = int(input())


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


primes = prime_factorize(x)
while len(primes) > 1:
    x += 1
    primes = prime_factorize(x)
print(x)


Measured memory_bytes: 3060
// AOJ 1053: Accelerated Railgun
// 2017.10.31 bal4u@cc

#include <stdio.h>
#include <math.h>

#define EPS 1e-7

int main()
{
	double d, px, py, vx, vy, ans;
	double dp, dv, x;

	while (scanf("%lf", &d) && d > 0) {
		scanf("%lf%lf%lf%lf", &px, &py, &vx, &vy);
		ans = d + 1;
		dp = sqrt(px*px + py*py);
		dv = sqrt(vx*vx + vy*vy);
		x = px*vx + py*vy;
		x = x/(dp*dv);
		if (fabs(x+1) <= EPS) ans = dp;
		else if (fabs(1-x) <= EPS) ans = 2-dp;

		if (fabs(ans-d) <= EPS || ans <= d) printf("%.8lf\n", ans);
		else puts("impossible");
	}
	return 0;
}

Measured memory_bytes: 1748
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n, k = na()
h = na()

inf = 1 << 60
dp = [inf for i in range(n)]
dp[0] = 0

for i in range(n):
    p = min(i + k + 1, n)
    for j in range(i + 1, p):
        dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]))
print(dp[n - 1])

Measured memory_bytes: 56540
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 1e5 + 5;
int n, m;
int a[maxn];
int s[maxn], t[maxn];

int read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &s[i], &t[i]);
  }
  return true;
}

int p[maxn], ts[maxn], mn[maxn];

int get(int x) {
  return (p[x] == x ? x : (p[x] = get(p[x])));
}

void unite(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) {
    return;
  }
  if (ts[x] < ts[y]) {
    swap(x, y);
  }
  ts[x] += ts[y];
  p[y] = x;
  if (a[mn[y]] < a[mn[x]]) {
    mn[x] = mn[y];
  }
}

void solve() {
  for (int i = 0; i < n; i++) {
    p[i] = i;
    ts[i] = 1;
    mn[i] = i;
  }
  for (int i = 0; i < m; i++) {
    unite(s[i], t[i]);
  }
  set< pair<int, int> > st;
  for (int i = 0; i < n; i++) {
    st.insert(make_pair(a[i], i));
  }
  int k = 0;
  long long res = 0;
  for (int i = 0; i < n; i++) {
    if (i == get(i)) {
      res += a[mn[i]];
      st.erase(make_pair(a[mn[i]], mn[i]));
      k++;
    }
  }
  if (k == 1) {
    printf("0\n");
    return;
  }
  for (int it = 0; it < k - 2; it++) {
    if (st.empty()) {
      printf("Impossible\n");
      return;
    }
    res += st.begin()->first;
    st.erase(st.begin());
  }
  printf("%lld\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 7296