akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define setp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
 
}

void solve()
{
	// 2 3 
	// 2 2 
	// 5 
	// 2 3
	// 4 - 2
	// 2 - 3
	// 1 - 5
	// C(7, 4) 
	// 5 * 6 * 7 / 2 / 3
	int n;
	cin >> n;
	vector<ll> cnt(n + 1, 0);
	for(int i = 2; i <= n; ++i){
		int x = i;
		for(int j = 2; j <= sqrt(n); ++j){
			while(x % j == 0){
				x /= j;
				cnt[j]++;
			}
		}
		if(x != 1) ++cnt[x];
	}
	ll res = 1;
	for(int i = 2; i <= n; ++i){
		res *= cnt[i] + 1;
		res %= mod;
	}
	cout << res;
}	 

 
int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
    Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}


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



int main(){
    int n;
    cin >> n;
    cout << "ABC" << n << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int n,m;
	int a[10000];
	int sum=0;
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	if (sum > n)
	{
		sum = n + 1;
	}
	cout << n - sum << endl;
}


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

int main(){
	int n,t;
	cin >> n >> t;
	int ans = 1e9;
	for(int i=0; i<n; i++){
		int a,b;
		cin >> a >> b;
		if(b <= t){
			ans = min(ans, a);
		}
	}
	if(ans == (int)1e9){
		cout << "TLE" << endl;
	}else{
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
  int a, b;
  cin >> a >> b;
  if (a > b) {
    cout << "a > b" << endl;
  } else if (a < b) {
    cout << "a < b" << endl;
  } else {
    cout << "a == b" << endl;
  }
  return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    ll a, b, c; cin>>a>>b>>c;
    if(a%2==0 || b%2==0 || c%2==0) cout << 0 << endl;
    else cout << min({a*b, b*c, c*a}) << endl;
}

Measured memory_bytes: 256
from collections import Counter
MOD = 10**9+7
n, t = map(int, input().split())
d = [int(input()) for _ in range(n)]
d.sort(reverse=True)
c = Counter(d)
cum = [0 for _ in range(200002)]
for i in range(100000, 0, -1):
	cum[i] = cum[i+1] + c[i]
ans = 1
for i, x in enumerate(d):
	mul = i+1 - cum[x+t+1]
	ans *= mul
	ans %= MOD
print(ans)


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

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  
  if(A/K != B/K){
    cout << "OK" << endl;
  }
  else if (A%K == 0){
    cout << "OK" << endl;
  }
  else{
    cout << "NG" << endl;
  }
}
   

Measured memory_bytes: 3636
#include<bits/stdc++.h>                
using namespace std;
typedef long long lint;
#define FOR(i,o,n) for(auto i = (o); (i) < (n); ++(i))
#define REP(i,n) FOR(i,0,n) 
#define REPR(i,n) for(auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr,v) for(auto itr=v.begin(); itr != v.end(); ++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name,h,w)  vector< vector<int> > name((h), vector<int>(w));
int gcd(int vx, int vy)
{
	if(vy == 0) return vx;
	else return gcd(vy, vx % vy);
}
int main(){
	int N; cin >> N;
	vector<int> v(100000);
	REP(i, N) cin >> v[i];

	int answer = v[0];
	FOR(i, 1, N){
		answer = gcd(v[i], answer);
	}
	cout << answer << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <iomanip>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>
#include <random>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define endl '\n'

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7;
const int MAXN = static_cast<int>(1e6) + 17;

int n, m, q;
int cnt[600][600];

bool read() {
    if (!(cin >> n >> m >> q))
        return false;

    forn (i, m) {
        int l, r;
        cin >> l >> r;
        ++cnt[l][r];
    }

    return true;
}

void solve() {
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= n; ++j)
            cnt[i][j] += cnt[i][j - 1];

    forn (i, q) {
        int l, r;
        cin >> l >> r;
        int ans = 0;

        for (int k = l; k <= r; ++k)
            ans += cnt[k][r];

        cout << ans << endl;
    }
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::mt19937 rand('S' + 'E' + 'R' + 'E' + 'Z' + 'H' + 'K' + 'A');

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 2176
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int MAXN = 100000;
int x[MAXN + 5], y[MAXN + 5], c[MAXN + 5];
int y1[MAXN],N,K,Max,cnt;
int main() 
{
	scanf("%d%d",&N,&K);
	for(int i=1;i<=N;i++) 
	{
		char ch;
		scanf("%d %d %c",&x[i],&y[i],&ch);
		x[i]%=(2*K);
		y[i]%=(2*K);
		if(ch=='W' ) c[i] = 1;
	}
	for(int i=0;i<=K;i++) {
		cnt = 0;
		fill(y1,y1+2*K+1,0);
		for(int j=1;j<=N;j++) {
			bool p = (i<=x[j]&&x[j]<i+K);
			bool q = (0<=y[j]&&y[j]<K);
			if( p ^ q == c[j] )
			{
				cnt++;
				y1[y[j]] ++;
			}
			else 
			{
				y1[y[j]] --;
			}
		}
		for(int j=0;j<=K;j++) 
		{
			Max=std::max(Max,std::max(cnt,N-cnt));
			if( j != K )
				cnt = cnt - y1[j] - y1[K+j];
		}
	}
	printf("%d\n",Max);
}


Measured memory_bytes: 1280
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

longth = [a, b, c, d, e]

for i in range(4):
    if longth[i+1] - longth[0] <= k:
        continue
    else:
        print(':(')
        break
else:
    print('Yay!')

Measured memory_bytes: 3060
n = int(input())
mod = 10**9+7
if n == 1:
    print(0)
else:
    ans0, ans1, ans2 = 1, 1, 1
    for i in range(n):
        ans0 *= 10
        ans1 *= 9
        ans2 *= 8
        ans0 %= mod
        ans1 %= mod
        ans2 %= mod
    print((ans0-ans1*2+ans2)%mod)

Measured memory_bytes: 63500
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
using ll = long long;
using P = pair<ll,ll>;
 
int main (){
  ll n;cin>>n;
  ll sum = 100, num = 0;
  while (sum<n){
    sum+=(sum/100);
    num++;
  }
  cout << num << endl;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll q, h, s, d, n; cin >> q >> h >> s >> d >> n;
  q *= 4; h *= 2;
  ll one = min(q, min(h, s));
  ll ans = 0;
  if(n % 2 == 1) ans += one;
  ll two = min(one * 2, d);
  ans += two * (n / 2);
  fin(ans)
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


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

using namespace std;

int main() {
	int n;
	cin >> n;
	map<int, int>m;
	m[n]++;
	for (int i = 2; i <= 10000000; i++) {
		if (n % 2)n = n * 3 + 1;
		else n /= 2;
		if (m[n]) {
			cout << i << endl;
			return 0;
		}
		m[n]++;
	}
}


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

int main()
{
  int n;
  string res = "APPROVED";
  cin >> n;
  for(int i=0; i<n; i++)
  {
    int a;
    cin >> a;
    if(a % 2 == 0)
    {
      if(a % 3 != 0 && a % 5 != 0)
        res = "DENIED";
    }
  }
  
  cout << res << endl;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  int L[N];
  for (int i = 0; i < N; i++) cin >> L[i];
  sort(L, L + N, greater<int>());

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

  if (len > L[0])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
readline = open(0).readline
ans = []
while 1:
    N, X = map(int, readline().split())
    if not N:
        break
    res = 0
    for x in range(1, N+1):
        for y in range(x+1, N+1):
            z = X - x - y
            if y < z <= N:
                res += 1
    ans.append("%d\n" % res)
open(1, 'w').writelines(ans)


Measured memory_bytes: 5608
#include<bits/stdc++.h>
#define fi first
#define se second
#define a first
#define b second
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> T gcd(T a, T b){return !b?a:gcd(b,a%b);}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
mt19937 R(chrono::system_clock().now().time_since_epoch().count());
const int N = 266666,inf=0x3f3f3f3f;
int n,T;Pii s[N];
bool cmp(Pii x, Pii y){
	if(x.a==0&&y.a==0)return x.b>y.b;
	return 1ll*y.a*(x.b+1)<1ll*x.a*(y.b+1);
}
int dp[N][66];
int main() {
	read(n);read(T);
	rep(i,1,n)read(s[i].a),read(s[i].b);
	sort(s+1,s+n+1,cmp);
	/*int p=0,cur=0;
	while(p+1<=n&&s[p+1].a==0&&cur+1+s[p+1].b)cur+=1+s[p+1].b,p++;
	p=max(p-30,0);
	cur=0;rep(i,1,p)cur+=1+s[i].b;*/
	memset(dp,inf,sizeof(dp));
	dp[0][0]=0;int res=0;
	rep(i,0,n)rep(j,0,60)if(dp[i][j]<=T){
		umax(res,j);
		umin(dp[i+1][j],dp[i][j]);
		ll val=(dp[i][j]+1ll)*(s[i+1].a+1)+s[i+1].b;
		if(val<inf)umin(dp[i+1][j+1],(int)val);
	}
	int p=n+1;while(p-1>=1&&s[p-1].a==0)p--;//1..p p+1..n
	rep(j,0,60)if(dp[p][j]<=T){
		int cur=dp[p][j];
		for(int i=n;i>p&&cur+1+s[i].b<=T;i--)cur=cur+1+s[i].b,umax(res,j+n-i+1);
	}
	cout<<res;
	return 0;
}


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

using namespace std;

int t;
int aa, bb, hh, mm;

long double a, b, h, m;

long double pi = 3.1415926535897;

void solve() {
	cin >> aa >> bb >> hh >> mm;

	a =aa, b = bb, h = hh, m = mm;

	long double hours = 2 * pi * (h + (m/60))/12 ;

	long double min = 2 * pi * (m/60);

	long double theta = fabs(hours - min);

	long double dist = sqrt(a * a + b * b - 2 * a * b * cos(theta));

	printf("%.10Lf", dist);
}

int main(){
	t = 1;

	while(t--){
		solve();
	}
}

Measured memory_bytes: 4152
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)

int main(){
  double n,c=0;
  cin>>n;
  REP(i,n) if((i+1)%2) c+=1;
  
  cout<<c/n;
}

Measured memory_bytes: 764
#include <iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<sstream>
using namespace std;
#define MOD 1000000007
#define ll long long
const long long INF = 1LL << 60;

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;
}

class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};


int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;

	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}


}

void divisor(ll n,vector<ll> &ret) {
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(ret.begin(), ret.end());
	
}

int main() {
	ll N, M;
	cin >> N >> M;
	vector<ll> div;
	divisor(M, div);
	for (int i = 0; i < div.size(); i++) {
		if (div[i] >= N) {
			cout<< M / div[i];
			return 0;
		}			   
	}


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <list>
#include <fstream>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

struct Edge {
	int from, to;
};

signed main()
{
	int n,x;
	cin >> n >> x;

	if (x == 2 * n - 1 || x == 1) {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;

	if (n == 2) {
		cout << "1\n2\n3" << endl;
	}
	else {
		if (x == 2 * n - 2) {
			vector<int> out;
			rep(i, 1, n*2) {
				if (i != x - 2 && i != x - 1 && i != x && i != x + 1)
					out.push_back(i);
				
			}
			REP(i, (n * 2 - 1 -4)/2) {
				cout << out[i] << "\n";
			}
			cout << x-2 << "\n" << x << "\n" << x + 1 << "\n" << x - 1 << "\n";
			 
			rep(i, (n * 2 - 1 - 4) / 2, out.size()) {
				cout << out[i] << "\n";
			}
		}
		else {
			vector<int> out;
			rep(i, 1, n * 2) {
				if (i != x + 2 && i != x + 1 && i != x && i != x - 1)
					out.push_back(i);

			}
			REP(i, (n*2-1 - 4) / 2) {
				cout << out[i] << "\n";
			}
			cout << x + 2 << "\n" << x << "\n" << x - 1 << "\n" << x + 1 << "\n";

			rep(i, (n * 2 - 1 - 4) / 2, out.size()) {
				cout << out[i] << "\n";
			}
		}
	}




	return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


int main(int argc, const char * argv[]) {
  ll K; cin >> K;
  ll N = 50;
  ll q, r, abase, al, ar;
  q = K/N;
  r = K%N;
  abase = N-1+q;
  al = abase - r;
  ar = abase+1 - r + N;
  
  cout << N << endl;
  for(int i=0; i<N; i++){
    if(i<N-r) cout << al << " ";
    else cout << ar << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
 
using namespace std;
int main()
{
  int a,b;
  string A,B;
  cin >> a >> b;
  for(int i = 0; i < b; i++){ A += to_string(a); }
  for(int i = 0; i < a; i++){ B += to_string(b); }
  if(a > b)
    cout << B << endl;
  else
    cout << A << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<set>
#include<vector>
#include<iomanip>
#include<queue>
#include<string>
#include<map>

typedef long long ll;
const int inf = 0x3f3f3f3f,maxn = 120000 + 5;

using namespace std;

int main(){

	int sum,n,ans;
	int a[20];

	while(cin >> n)
	{
		int t = -inf;
		for(int i = 1;i <= n;i++)
		{
			cin >> a[i];

			if(a[i] > t)
			{
				ans = i;
				t = a[i];
			}
		}

		sum = 0;
		for(int i = 1;i <= n;i++)
		{
			if(ans != i)
			{
				sum += a[i];
			}

			else continue;
		}

		if(sum > a[ans]) puts("Yes");

		else puts("No");
	}


	return 0;
}

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

bool isprime(int a){
    
    if(a==2)
    return true;
    
    if(a<2||a%2==0)
    return false;
    
    for(int i=3;i*i<=a;i=i+2){
        if(a%i==0)
        return false;
    }
    
    return true;
}

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

    int num[n];
    int prime=0;
    

        

    
    for(int i=0;i<n;i++){

            cin>>num[i];
    }
    
    for(int j=0;j<n;j++){
        if(isprime(num[j]))
        prime++;
    }
    cout<<prime<<endl;
    
    return 0;
}



Measured memory_bytes: 3152
n = int(input())
num = [[0 for i in range(10)] for j in range(10)]

ans = 0

for _ in range(n):
    i = _ + 1
    if i < 10:
        num[i][i] += 1
    elif i % 10 != 0:
        moji = str(i)
        num[int(moji[0])][int(moji[len(moji)-1])] += 1
    else:
        pass

for i in range(1, 10):
    for j in range(1, 10):
        ans += num[i][j] * num[j][i]

print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T>
bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for(int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T>
vector<T> make_v(size_t a) {
    return vector<T>(a);
}
template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) {
    for(auto& e : t) {
        fill_v(e, v);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    auto dp = make_v<ll>(n + 10, 2);
    fill_v(dp, -LINF);
    vector<ll> a(n + 10);
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    dp[1][0] = a[1];
    for(int i = 2; i <= n; i++) {
        dp[i][0] = dp[i - 1][0] + a[i];
        chmax(dp[i][0], dp[i - 1][1] + a[i]);
        dp[i][1] = dp[i - 1][1] + a[i] * -1LL + a[i - 1] * 2LL;
        chmax(dp[i][1], dp[i - 1][0] + a[i] * -1LL - a[i - 1] * 2LL);
    }
    cout << max(dp[n][0], dp[n][1]) << endl;
}


Measured memory_bytes: 6528
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

int n,m;
vi a;
int f_ind(int i, int x){ // [0,n]
    // int lo = -1;
    // int hi = n;
    // while(hi-lo > 1){
    //     int mid = (lo+hi)/2;
    //     (a[mid] + a[i] >= x ? hi : lo) = mid;
    // }
    // return n - hi;
    auto it = lower_bound(all(a), x - a[i]);
    return a.end() - it;
}
int fint(int x){
    int ans = 0;
    REP(i,n) {
        ans += f_ind(i,x);
        // cerr << f_ind(i,x) << " ";
    }
    // cerr << endl;
    return ans;
}
bool f(int x){
    int det = fint(x);
    // cerr << x << " " << det << endl;
    return det <= m;
}

signed main(){
    I(n); I(m);
    a.resize(n);
    REP(i,n) I(a[i]);
    sort(all(a));
    // for(auto v:a) cerr << v << " "; cerr << endl;

    int lo = 0;
    int hi = 2 * a[n-1] + 1;
    while(hi-lo > 1){
        int mid = (lo + hi)/2;
        (f(mid) ? hi : lo) = mid;
    }
    int rem = m - fint(hi);
    int border = 0;

    // REP(i,n) cerr << f_ind(i,hi) << " "; cerr << endl;
    // cerr << "hi " << hi << endl;
    // cerr << f(hi) << endl;
    REP(i,n) {
        if (f_ind(i,hi) == n) continue;
        border = max(border, a[i] + a[n-1-f_ind(i,hi)]);
    }
    int ans = border * rem;
    cerr << ans << endl;
    vi acum = a;
    acum.pb(0);
    REPN(i,n) acum[i] += acum[i+1];
    REP(i,n) {
        ans += f_ind(i,hi) * a[i] + acum[n-f_ind(i,hi)];
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		int i=0;
		int[] w=new int[10],k=new int[10];

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null ) {
            	if(i<10){
            		w[i]=Integer.parseInt(line);
            	}else{
            		k[i-10]=Integer.parseInt(line);
            	}
            	i++;
            	if(i==20){
            		break;
            	}
            }
            int maxk=0,maxw=0;
            int resultk=0,resultw=0;
            int storek=0,storew=0;
            for(int l=0;l<3;l++){
            	maxk=0;
            	maxw=0;
            	storek=0;
            	storew=0;
            	for(int j=0;j<w.length;j++){
            		if(maxk<k[j]){
            			storek=j;
            			maxk=k[j];
            		}
            		if(maxw<w[j]){
            			storew=j;
            			maxw=w[j];
            		}
            	}
            	resultk+=maxk;
            	resultw+=maxw;
            	k[storek]=-1;
            	w[storew]=-1;

            }
            System.out.println(resultw+" "+resultk);
		}
	}

}

Measured memory_bytes: 24148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

vector<vector<int>> precalc(string &S) {
    int N = S.length();
    vector<vector<int>> res(N + 1, vector<int>(26, N));
    for (int i = N - 1; i >= 0; --i) {
        res[i] = res[i + 1];
        res[i][S[i] - 'a'] = i;
    }
    return res;
}

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

    string A;
    cin >> A;

    auto nxt = precalc(A);
    int N = A.length();
    vector<int> dp(N + 1, 1e9);
    vector<char> mem(N + 1);
    dp[N] = 1;
    for (int i = N - 1; i >= 0; --i) {
        for (int j = 0; j < 26; ++j) {
            int tmp = (nxt[i][j] < N ? dp[nxt[i][j] + 1] : 0) + 1;
            if (dp[i] > tmp) {
                dp[i] = tmp;
                mem[i] = j + 'a';
            }
        }
    }

    int idx = 0;
    while (idx < N) {
        cout << mem[idx];
        idx = nxt[idx][mem[idx] - 'a'] + 1;
    }
    cout << endl;
    return 0;
}


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


int main(){
	string str;
	long long  num;
	cin>>str>>num;
	long long len=str.length();
	long long cnt1=0,cnt2=1,cnt3=1;
	
	for(int i=1;i<str.length();i++)
		if(str[i-1]==str[i]){
			cnt1++;i++;	
		}
	for(int i=1;i<str.length();i++){
		if(str[i]==str[0])cnt2++;
		else break;		
	}

	for(int i=str.length()-2;i>=0;i--){
		if(str[i]==str[str.length()-1])cnt3++;
		else break;		
	}
	//cout<<cnt1<<cnt2<<cnt3<<endl;
	if(cnt2 == str.length()){
		cout<< num*cnt2 /2 << endl;
	}
	else{
		long long ans;
		ans=cnt1*num;
		if(cnt2%2 && cnt3%2 && str[0]==str[str.length()-1])
			ans+=num-1;	
		cout<< ans<< endl;	
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
#include <queue>

using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;
    ll A[N], s[N+1];
    s[0] = 0;
    for(int i = 0; i < N; i++){ 
        cin >> A[i];
        s[i+1] = s[i] + A[i];
    }
    ll ans = 0;
    for(int i = 1; i <= N; i++){
        if(s[i] == s[N]/2 && s[N]%2 == 0){
            cout << 0 << endl;
            return 0;
        } else if(s[i] >= s[N]/2){
            cout << min(abs(2*s[i] - s[N]), abs(s[N]-s[i-1]-s[i-1])) << endl;
            return 0;
        }
    }
}



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

using namespace std;

int main() {

    string s;

    while(getline(cin, s), s != ".") {

        bool find = true;
        string world = "";

        for(int i = 0; i < s.size(); ++i) {
            switch(s[i]) {
                case '(':
                case ')':
                case '[':
                case ']':
                    world += s[i];
            }
        }

        while(find) {

            find = false;

            int balance;

            if((balance = world.find("()")) != string::npos) {
                world.erase(balance, 2);
                find = true;
            }
            if((balance = world.find("[]")) != string::npos) {
                world.erase(balance, 2);
                find = true;
            }

        }

        cout << (world.size() ? "no" : "yes") << endl;

    }

}

Measured memory_bytes: 1200
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

ll a[501][501] = {};
ll y_1[1000001] = {};
ll x_1[1000001] = {};
ll y_2[1000001] = {};
ll x_2[1000001] = {};
int main() {
	ll h, w; cin >> h >> w;

	repe(i, 1, h) {
		repe(j, 1, w) {
			ll A; cin >> A;
			a[i][j] = A % 2;
		}
	}
	ll cnt = 0;
	repe(i, 1, h) {
		repe(j, 1, w - 1) {
			if (a[i][j] & 1) {
				a[i][j]--;
				a[i][j + 1]++;
				y_1[cnt] = i;
				x_1[cnt] = j;
				y_2[cnt] = i;
				x_2[cnt] = j + 1;
				cnt++;
			}
		}
	}
	repe(i, 1, h - 1) {
		if (a[i][w] & 1) {
			a[i][w]--;
			a[i + 1][w]++;
			y_1[cnt] = i;
			x_1[cnt] = w;
			y_2[cnt] = i + 1;
			x_2[cnt] = w;
			cnt++;
		}
	}
	cout << cnt << endl;
	rep(i, 0, cnt) {
		cout << y_1[i] << " " << x_1[i] << " " << y_2[i] << " " << x_2[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 15872
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int x;

void solve(long long d) {
	auto fun = [&](long long b) -> long long {
		return 5*b*b*b*b + 10*b*b*b*d + 10*b*b*d*d + 5*b*d*d*d + d*d*d*d;
	};
	
	for(long long i = -1e5; i <= 1e5; i++) {
		if(fun(i) == x / d) {
			cout << i + d << " " << i;
			exit(0);
		}
	}

}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> x;
	for(long long i = 1; i * i <= x; i++) {
		if(x % i == 0) {
			solve(i);
			solve(x / i);
		}
	}
	return 0;
}


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

using namespace std;

int main() {

int N,M;
cin>>N>>M;
vector<int> a(N);
vector<int> b(N);
for(int i=0;i<N;i++)
{
   cin>>a[i]>>b[i];
   
}
vector<pair<int,int>> AB(N);
for(int i=0;i<N;i++){
   AB[i]=make_pair(a[i],b[i]);
}
sort(AB.begin(),AB.end());
long long ans=0;
for(int i=0;i<N;i++){
int b=min(M,AB[i].second);
ans+=(long long)b*AB[i].first;
M-=b;
}
cout<<ans<<endl;
   return 0;
}






Measured memory_bytes: 4808
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int n;
int A[105];
int ans;
int selectSort(int A[],int n){
	int minj;
	ans=0;
	for(int i=0;i<n;i++){
		minj=i;
	    for(int j=i;j<n;j++){
	    	if(A[j]<A[minj]){
	    		minj=j;
			}
		}
	    swap(A[i],A[minj]);
	    if(i!=minj){
	    	ans++;
		}
	}
    return ans;
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
    ans=selectSort(A,n);
    for(int i=0;i<n;i++){
    	if(i>0){
    		printf(" ");
		}
		printf("%d",A[i]);
	}
	printf("\n%d\n",ans);
	return 0;
}


Measured memory_bytes: 3212
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstdlib>
using namespace std;
typedef long long ll;
int main(){
  ll X, Y;
  cin >> X >>Y;
  ll ans = 0;
  ll element = X;
  while(element<=Y){
    ans++;
    element *= 2;
  }
  cout << ans <<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

void dfs(vector<vector<pair<int,int>>>& adj,vector<int>& col,int v=0,int par=-1){
  static int paint=0;
  col[v]=paint;
  for(auto x: adj[v]){
    if(df) print(x.first,x.second);
    int u=x.first;
    if(u==par) continue;
    paint^=x.second;
    if(df) print("paint:",paint);
    dfs(adj,col,u,v);
    paint^=x.second;
  }
}

int main(){
  int n; cin >>n;
  vector<vector<pair<int,int>>> adj(n);
  rep(i,n-1){
    int u,v,w; cin >>u >>v >>w; u--; v--; w%=2;
    adj[u].push_back({v,w});
    adj[v].push_back({u,w});    
  }
  vector<int> col(n,0);
  dfs(adj,col);
  rep(i,n) print(col[i]);
}


Measured memory_bytes: 9728
import java.util.*;
import java.lang.Math;
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int ans = a + a*a + a*a*a;
        System.out.println(ans);
    }
}


Measured memory_bytes: 35584
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int W = sc.nextInt();
        long DP[][] = new long[N+1][W+1];
        for(int i=0;i<N+1;i++)Arrays.fill(DP[i],0);
        for(int i=1;i<=N;i++) {
            int w = sc.nextInt();
            int v = sc.nextInt();
            for(int j=1;j<W+1;j++){
                DP[i][j]=Math.max(DP[i-1][j],DP[i][j-1]);
                if(j-w>=0)DP[i][j]=Math.max(DP[i][j],DP[i-1][j-w]+v);
            }
        }
        System.out.println(DP[N][W]);
    }
}

Measured memory_bytes: 127444
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

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;}

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  int a, b;
  cin >> a >> b;
  if(a+b >= 24) cout << a+b-24 << endl;
  else cout << a+b << endl;
} 






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

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

    int N, W;
    cin >> N >> W;
    vector<int> Wn(N);
    vector<int> Vn(N);
    for (int i = 0; i < N; i++) cin >> Wn[i] >> Vn[i];
    vector<vector<long long>> dp(100010, vector<long long>(N + 1, INF));
    dp[0][0] = 0;
    for (int j = 0; j < N; j++) {
        for (int i = 0; i < dp.size(); i++) {
            if (i - Vn[j] >= 0) {
                dp[i][j + 1] = min(dp[i - Vn[j]][j] + Wn[j], dp[i][j + 1]);
            }
            dp[i][j + 1] = min(dp[i][j + 1], dp[i][j]);
        }
    }
    long long res = 0;
    for (int i = 0; i < dp.size(); i++) {
        if (dp[i][N] <= W) res = i;
    }
    cout << res << endl;
}


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

int main(void) {
  int N, Y;
  cin >> N >> Y;

  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= N-i; j++) {
      int k = N - i - j;
      int y = 10000 * i + 5000 * j + 1000 * k;
      if(y == Y) {
        cout << i << " " << j << " " << k << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
  return 0;
}

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

int main() {
  int K;
  int S;
  int cnt;
  int Y;
  int Z;
  cin >> K >> S;
  for (int i = 0 ; i < K+1 ; ++i ){
    for ( int j = 0 ; j < K+1 ; ++j ){
      Y = S - i - j;
      if ( Y >= 0 && Y <= K){ ++cnt; }
    }
  }
  cout << cnt << endl;
}
  
        

Measured memory_bytes: 256
N = int(input())
A = tuple(int(x) for x in input().split())
B = tuple(int(x) for x in input().split())
C = tuple(int(x) for x in input().split())

satisfy = sum(B)

for i in range(N-1):
  if A[i+1]-A[i] is 1:
    satisfy += C[A[i]-1]

print(satisfy)


Measured memory_bytes: 3060
/***********************************************
 *                   _ooOoo_                   *
 *                  o8888888o                  *
 *                  88" . "88                  *
 *                  (| -_- |)                  *
 *                  O\  =  /O                  *
 *               ____/`---'\____               *
 *             .'  \\|     |//  `.             *
 *            /  \\|||  :  |||//  \            *
 *           /  _||||| -:- |||||-  \           *
 *           |   | \\\  -   * |    |           *
 *           | \_|  ''\---/''  |   |           *
 *           \  .-\__  `-`  ___/-. /           *
 *         ___`. .'  /--.--\  `. . __          *
 *      ."" '<  `.___\_<|>_/___.'  >'"".       *
 *     | | :  `- \`.;`\ _ /`;.`/ - ` : | |     *
 *     \  \ `-.   \_ __\ /__ _/   .-` /  /     *
 *======`-.____`-.___\_____/___.-`____.-'======*
 *                   `=---='                   *
 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

             佛祖保佑       永无BUG

   本程序已经经过开光处理，绝无可能再产生bug
 **********************************************/
#include<algorithm>
#include <iostream>
#include  <cstdlib>
#include  <cstring>
#include   <string>
#include   <vector>
#include   <cstdio>
#include    <queue>
#include    <stack>
#include    <ctime>
#include    <cmath>
#include      <map>
#include      <set>
#define ll long long
#define INF 0x3f3f3f3f
#define pii pair<int,int>
#define mkp(a,b) make_pair(a,b)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define db1(x) cout<<#x<<"="<<(x)<<endl
#define db2(x,y) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<endl
#define db3(x,y,z) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<", "<<#z<<"="<<(z)<<endl
#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<22,stdin),p1==p2)?EOF:*p1++)
using namespace std;

char s[110];

int main()
{
    #ifdef test
    freopen("in.txt","r",stdin);
    //freopen("in.txt","w",stdout);
    clock_t start=clock();
    #endif //test

    int l,f=1;
    scanf("%s",s);l=strlen(s);
    for(int i=0;i<l;i++)
    {
        if(i%2==0)
        {
            if(s[i]=='R'||s[i]=='U'||s[i]=='D')
                f=1;
            else
            {
                f=0;break;
            }
        }
        else
        {
            if(s[i]=='L'||s[i]=='U'||s[i]=='D')
                f=1;
            else
            {
                f=0;break;
            }
        }
    }
    if(f)printf("Yes\n");
    else printf("No\n");

    #ifdef test
    clockid_t end=clock();
    double endtime=(double)(end-start)/CLOCKS_PER_SEC;
    printf("\n\n\n\n\n");
    cout<<"Total time:"<<endtime<<"s"<<endl;        //s为单位
    cout<<"Total time:"<<endtime*1000<<"ms"<<endl;    //ms为单位
    #endif //test
    return 0;
}


// ━━━━━━神兽出没━━━━━━
//      ┏┓       ┏┓
//     ┏┛┻━━━━━━━┛┻┓
//     ┃           ┃
//     ┃     ━     ┃
//     ????━????   ┃
//     ┃           ┃
//     ┃    ┻      ┃
//     ┃           ┃
//     ┗━┓       ┏━┛
//       ┃       ┃
//       ┃       ┃
//       ┃       ┗━━━┓
//       ┃           ┣┓
//       ┃           ┏┛
//       ┗┓┓┏━━━━━┳┓┏┛
//        ┃┫┫     ┃┫┫
//        ┗┻┛     ┗┻┛
//
// ━━━━━━感觉萌萌哒━━━━━━


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>

using namespace std;



int main()
{
	int N;
	cin >> N;
	
	int d[N];
	set<int> mochi;
	for(int i = 0; i < N; i++){
		cin >> d[i];
		mochi.insert(d[i]);
	}	
	
	
	cout << mochi.size() << endl;	

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    std::string s, t; std::cin >> s >> t;
    int n = s.size();
    std::vector<std::vector<long long>> dp(n + 1, std::vector<long long>(26, -1e18));
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j <= 'z' - 'a'; j++) {
            dp[i][j] = dp[i + 1][j] + 1;
            if (s[(i + 1)%n] == 'a' + j) dp[i][j] = 1;
        }
    }
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j <= 'z' - 'a'; j++) {
            if (dp[i][j] <= 0) {
                dp[i][j] = dp[(i + 1) % n][j] + 1;
            }
        }
    }

    long long pos = 0;
    int m = t.size();
    for (int i = 0; i < m; i++) {
        if (i == 0 && s[0] == t[0]) continue;
        if (dp[pos % n][t[i] - 'a'] <= 0) {
            std::cout << -1 << std::endl;
            return 0;
        }
        pos += dp[pos % n][t[i] - 'a'];
    }
    std::cout << pos + 1 << std::endl;
    return 0;
}


Measured memory_bytes: 24704
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define ft first
#define se second
#define all(x) x.begin(),x.end()
#define eb(x) emplace_back(x)
#define pb(x) push_back(x)
#define mk(a,b) make_back(a,b)
#define endll "\n"

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    string a;cin>>a;
    if(a=="ABC"){
        cout<<"ARC"<<endl;
    }
    else if(a=="ARC"){
        cout<<"ABC"<<endl;
    }
}


Measured memory_bytes: 3608
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>

#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define mod 1000000007
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes printf("Yes\n")
#define no printf("No\n")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

const int INF=1LL<<55;

int n,c,k;
vector<pint> a;
int ans=0;

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

    cin>>n>>c>>k;

    int x;
    rep(i,n){
        cin>>x;
        a.pb(mp(x, x+k));
    }

    sort(all(a));

    int bust=a[0].sc;
    int bussz=0;
    
    rep(i,n){
        if(bussz==c || a[i].fs > bust){
            bust=a[i].sc;
            bussz=1;
            ans++;
        }else{
            bussz++;
        }
    }
    if(bussz!=0) ans++;
    
    cout<<ans<<endl;

    return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<long double> P(N);
  for (int i = 0; i < N; i++) cin >> P.at(i);
  for (int i = 0; i < N; i++) {
    P.at(i) = (P.at(i) + 1) / 2.0;
  }
  vector<long double> R(N + 1);
  for (int i = 1; i < N + 1; i++) R.at(i) = R.at(i - 1) + P.at(i - 1);
  long double ans = 0;
  for (int i = K; i < N + 1; i++) {
    ans = max(ans, R.at(i) - R.at(i - K));
  }
  cout << fixed << setprecision(6) << ans << "\n";
}

Measured memory_bytes: 9616
// AOJ 2048: Everlasting...?
// 2017.10.4 bal4u@uu

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

#define SIZE  10
int size;
int factor[SIZE];

int ptbl[] = {
         3,   5,   7,  11,  13,  17,  19,  23,  29,
   31,  37,  41,  43,  47,  53,  59,  61,  67,  71,
   73,  79,  83,  89,  97, 101, 103, 107, 109, 113,
  127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
  179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
  233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
  283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
  353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
  419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
  467, 479, 487, 491, 499, 503, 509, 521, 523, 541,
  547, 557, 563, 569, 571, 577, 587, 593, 599, 601,
  607, 613, 617, 619, 631, 641, 643, 647, 653, 659,
  661, 673, 677, 683, 691, 701, 709, 719, 727, 733,
  739, 743, 751, 757, 761, 769, 773, 787, 797, 809,
  811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
  877, 881, 883, 887, 907, 911, 919, 929, 937, 941,
  947, 953, 967, 971, 977, 983, 991, 997, 0 };

void prime_factor(int n)
{
  int i, d;
  int sw;
  int *pp;

  size = 0;
  if ((n & 1) == 0) {
    factor[size] = 2;
	do n >>= 1;
    while ((n & 1) == 0);
    size++;
  }
  if (n <= 1) return;
  for (pp = ptbl; *pp > 0; pp++) {
    if (n % *pp) continue;
    d = *pp;
    factor[size] = d;
    do n /= d;
    while (n % d == 0);
    size++;
  }
  if (n > 1) {
    int b = (int)sqrt(n);
    for (i = 1009, sw = 0; n > 1; ) {
      if (i > b) {
        factor[size++] = n;
        break;
      }
      if (n % i == 0) {
        factor[size] = i;
        do n /= i;
        while (n % i == 0);
        size++;
      }
      if (sw) { i += 2, sw = 0; }
      else    { i += 4, sw = 1; }
    }
  }
}

int main()
{
	int a[2], s[2], i, j;

	while (scanf("%d%d", &a[0], &a[1]) && a[0] > 0) {
		for (i = 0; i < 2; i++) {
			prime_factor(a[i]);
			for (s[i] = 0, j = 0; j < size-1; j++) s[i] += factor[j];
			s[i] = factor[size-1] - s[i];
		}
		puts(s[0] > s[1] ? "a" : "b");
	}
	return 0;
}

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

int main() {
  int n;
  cin>>n;
  int ans = 0;
  int p[n];
  p[0] = -1;
  for (int i=1; i<n+1; i++) {
    cin>>p[i];
  }
  int idx = 1;
  while (idx <= n) {
    if (p[idx] != idx) {
      ++idx;
      continue;
    }
    ++ans;
    if (idx == n) {
      break;
    }
    idx += 2;
  }
  cout<<ans<<endl;

}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 1000000;
const int INF = 1e9;
const double pi=acos(-1);

int main(){
  int a,b,m;
  cin >> a >> b >> m;
  vector<int>A(a);
  vector<int>B(b);
  rep(i,a)cin>>A[i];
  rep(i,b)cin>>B[i];
  int ans=INF;
  rep(i,m){
    int x,y,c;
    cin >> x >> y >> c;
    x--;
    y--;
    if(ans>A[x]+B[y]-c)ans=A[x]+B[y]-c;
  }
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  if(ans>A[0]+B[0])ans=A[0]+B[0];
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024