akhauriyash/Code-Regression huggingface dataset:
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#define INF 100000000000000
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

int main(){
    llong N,M;
    llong cnt=0;
    double total = 0.0;
    cin >> N >> M;
    vector<llong> A(N,0);
    for(int i=0; i<A.size(); i++){
        cin >> A[i];
        total += A[i];
    }
    total = total*(1/((double)4*M));
    for(int i=0; i<A.size(); i++){
        if(A[i]<total){
            continue;
        }
        cnt++;
    }
    if(cnt>=M){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using v = vector<T>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

inline ll inl() {
    ll x;
    cin >> x;
    return x;
}

inline string ins() {
    string x;
    cin >> x;
    return x;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        ll a, b;
        cin >> a >> b;
        if (a == b) {
            cout << 0 << endl;
        } else if ((a + b) % 2 == 0) {
            cout << (a + b) / 2 << endl;
        } else {
            cout << "IMPOSSIBLE" << endl;
        }
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j

int main() {
  int N;
  cin >> N;
  vector<int> b(N);
  // 1のindexのところ
  vector<int> num1idx;
  rep(i, 0, N) {
    cin >> b[i];
  }

  vector<int> ans;

  rep(i, 0, N) {
    for (int j = b.size() - 1; j >= 0; j--) {
      if (b[j] == j + 1) {
        ans.pb(b[j]);
        b.erase(b.begin() + j);
        break;
      }
    }
  }

  if (ans.size() != N) {
    cout << -1 << endl;
    return 0;
  }
  reverse(All(ans));
  rep(i, 0, N) {
    cout << ans[i] << endl;
  }
};


Measured memory_bytes: 256
// 6/14 リアルタイム参加
#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>;
using Graph = vector<vector<int>>;

int main() {
    char a;
    cin >> a;

    // if (a-'a' < 26) {
    //     cout << "a" << endl;
    // } else {
    //     cout << "A" << endl;
    // }
    if (isupper(a)) cout << "A" << endl;
    else cout << "a" << endl;
}

Measured memory_bytes: 3628
#include <iostream>
//#include <iomanip>
#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <math.h>
#include <vector>
//#include <string>
typedef long long LL;
using namespace std;

int main(){
    LL n;
    vector<LL> a(5);
    LL ans;
    cin >> n;
    for(int i=0; i<5; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    if(n%a[0]==0){
        ans = n/a[0]-1;
    }else{
        ans = n/a[0];
    }
    ans += 5;
    cout << ans << endl;
}

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

int main(){
    
    int N; cin >> N;
    
    vector<long long> a(N),b(N);
    
    for(int i = 0; i < N;i++) cin >> a[i];
    for(int i = 0; i < N;i++) cin >> b[i];
    
    long long A = 0, B = 0;
    
    for(int i = 0; i < N;i++){
        if(a[i] > b[i]) A += a[i] - b[i];
        if(b[i] > a[i]) B += (b[i] - a[i])/2;
    }
    
    if(B >= A)cout << "Yes" << endl;
    else cout << "No" <<endl;
    
}

Measured memory_bytes: 384
import collections
s = collections.deque(list(input()))
q = int(input())
cnt = 0
for i in range(q):
    fc = input().split()
    if fc[0] == '1':
        cnt += 1
    else:
        if cnt == 1:
            fc[1] = '1' if fc[1] == '2' else '2'
        if fc[1] == '1':
            s.appendleft(fc[2])
        else:
            s.append(fc[2])
    cnt %= 2
if cnt == 1:
    s.reverse()
print(*s, sep='')


Measured memory_bytes: 12256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int dp[330][330][330];
vector<pair<int,int>> v[330];

int main(){
  int n,m;
  cin>>n>>m;
 
  for(int i=0;i<m;i++){
      int l,r,x;
      cin>>l>>r>>x;
      v[r].push_back(make_pair(l,x));
  }

  dp[0][0][0]=1;
  for(int r=0;r<=n;r++){
      for(int g=0;g<=n;g++){
          if(r==g&&r!=0) continue;
          for(int b=0;b<=n;b++){
              if((r==b||g==b)&&b!=0) continue;
              if(dp[r][g][b]==0) continue;

              int x=max(r,max(g,b));
              int z=min(r,min(g,b));
              int y=0;
              if(x!=r&&z!=r) y=r;
              else if(x!=g&&z!=g) y=g;
              else if(x!=b&&z!=b)y=b;

              bool ng=false;
              for(int l=0;l<v[x].size();l++){
                  int left=v[x][l].first;
                  int type=v[x][l].second;
                  if(type==1){
                      if(y>=left){
                          ng=true;
                          break;
                      }
                  }else if(type==2){
                      if(z>=left||y<left){
                          ng=true;
                          break;
                      }
                  }else{
                      if(z<left){
                          ng=true;
                          break;
                      }
                  }
              }

              if(ng) dp[r][g][b]=0;
              dp[x+1][g][b]=(dp[x+1][g][b]+dp[r][g][b])%MOD;
              dp[r][x+1][b]=(dp[r][x+1][b]+dp[r][g][b])%MOD;
              dp[r][g][x+1]=(dp[r][g][x+1]+dp[r][g][b])%MOD;
          }
      }
  }

  ll ans=0;
  for(int i=0;i<=n;i++){
      for(int j=0;j<=n;j++){
          if(i==j&&i!=0) continue;
          for(int k=0;k<=n;k++){
              if((j==k||i==k)&&k!=0) continue;
              int ma=max(i,max(j,k));
              if(ma==n) ans=(ans+dp[i][j][k])%MOD;
          }
      }
  }
  cout<<ans<<endl;



  return 0;
}


Measured memory_bytes: 129152
//============================================================================
// Name        : b
// Date        : Sun Feb 17 19:19:41 CST 2019
// Author      : landcold7
// Copyright   : Your copyright notice
// Description : None
//============================================================================
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define pvar(x) cout << #x << ": "
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define mst(x, y) memset(x, y, sizeof(x))
#define fora(e, c) for (auto &e : c)
#define fori(i, a, b) for (int i = a; i < b; ++i)
#define ford(i, a, b) for (int i = a; i > b; --i)
#define output(v) cout << (v) << '\n'
#define codejam(ix, v) cout << "Case #" << (ix) << ": " << (v) << '\n'
#define prt(x, a, n) { cout << x[a]; if (a < n - 1) cout << " "; }
#define pvi(x, v) if(v) pvar(x); fora(a, x) cout << a << " "; cout << '\n'
#define par(x, s, n, v) if(v) pvar(x); fori(a, s, n) prt(x, a, n) cout << '\n'

#define trace(...) _f(#__VA_ARGS__, __VA_ARGS__)
template <typename T>
void _f(const char* name, T&& arg) {
    cout << fixed << name << ": " << arg << '\n';
}

template <typename T, typename... Args>
void _f(const char* names, T&& arg, Args&&... args) {
    const char* split = strchr(names + 1, ',');
    cout.write(names, split - names) << ": " << arg << " |";
    _f(split, args...);
}

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

void solve() {
    int n, m;
    cin >> n >> m;
    vvi aa(n + 1, vi(m + 1, 0));
    fori (i, 1, n + 1) {
        int k; cin >> k;
        fori (j, 0, k) {
            int x; cin >> x;
            aa[i][x] = 1;
        }
    }

    int ret = 0;
    fori (j, 1, m + 1) {
        bool ok = 1;
        fori (i, 1, n + 1) {
            if (aa[i][j] == 0) {
                ok = 0;
                break;
            }
        }
        if (ok) ++ret;
    }
    output(ret);
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int main() {
	speed;
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	string s;
	if (e - a <= k)s = "Yay!";
	else s = ":(";
		cout << s;
	ed;
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    r,d,x = map(int, input().split())

    for i in range(10):
        x = r*x-d
        print(x)
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import java.util.Arrays;
import java.util.Scanner;

/**
 * https://atcoder.jp/contests/dp/tasks/dp_d
 */
public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int W = in.nextInt();
        int[] w = new int[N];
        int[] v = new int[N];
        for (int i = 0; i < N; i++) {
            w[i] = in.nextInt();
            v[i] = in.nextInt();
        }
        System.out.println(maxValue(N, W, w, v));
    }

    public static long maxValue(int N, int W, int[] w, int[] v) {
        long[] dp = new long[W + 1];
        for (int i = 0; i < N; i++) {
            for (int j = W; j >= 0; j--) {
                if (j - w[i] >= 0) {
                    dp[j] = Math.max(dp[j], dp[j - w[i]] + v[i]);
                }
            }
        }
        return Arrays.stream(dp).max().getAsLong();
    }

}


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

int main(){
    int N;
    cin >> N;
    vector<char> hum(N);
    
    int lE=0,lW=0,rE=0,rW=0;
    rep(i,N){
        cin >> hum[i];
        if(hum[i]=='E'){
            lE++;
        }else if(hum[i]=='W'){
            lW++;
        }
    }
    
    int ans=1'000'000;
    rep(i,N){
        //int ret_hum=0;
        
        if(hum[i]=='E'){
            lE--;
        }else if(hum[i]=='W'){
            lW--;
        }
        //振り向く人の計算
        ans = min(ans, lE + rW);
        
        //次の人の為に更新
        if(hum[i]=='E'){
            rE++;
        }else if(hum[i]=='W'){
            rW++;
        }
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<ll(n); i++)
#define REPR(i, n) for(ll i=n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=m; i<ll(n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
const ll INF = (1LL<<60);

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,m,l; cin >> n >> m >> l;
  vector<vector<ll>> G1(n, vector<ll>(n, INF));
  REP(i,n) G1[i][i] = 0;
  REP(i,m){
    int a,b,c;
    cin >> a >> b >> c;
    a--, b--;
    G1[a][b] = G1[b][a] = c;
  }

  REP(k,n) REP(i,n) REP(j,n) G1[i][j] = min(G1[i][j], G1[i][k]+G1[k][j]);

  vector<vector<ll>> G2(n, vector<ll>(n, INF));
  REP(i,n) REP(j,n){
    if(i==j) G2[i][j] = 0;
    else if(G1[i][j]<=l) G2[i][j] = 1;
  }
  REP(k,n) REP(i,n) REP(j,n) G2[i][j] = min(G2[i][j], G2[i][k]+G2[k][j]);

  int q; cin >> q;
  REP(qq,q){
    int s,t; cin >> s >> t;
    s--, t--;
    cout <<(G2[s][t]==INF ? -1 : G2[s][t]-1) << '\n';
  }
  return 0;
}


Measured memory_bytes: 4768
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>
#include<time.h>

#define DIV 998244353
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	int A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;
	int sw = 0, s = 0;
	for (int i = 0; i * 100 * A <= F; i++) {
		int a = i * 100 * A;
		for (int j = 0; a + j * 100 * B <= F; j++) {
			int b = j * 100 * B;
			int sm = (i * A + j * B) * E;
			vector<bool> dp(sm + 1);
			dp[0] = true;
			int ts = 0;
			for (int k = 0; k < sm; k++) {
				if (dp[k]) {
					if (k + C <= sm) {
						dp[k + C] = true;
						if (a + b + k + C <= F) {
							ts = max(ts, k + C);
						}
					}
					if (k + D <= sm) {
						dp[k + D] = true;
						if (a + b + k + D <= F) {
							ts = max(ts, k + D);
						}
					}

				}
			}

			//printf("a+b+ts=%d ts=%d\n", a + b + ts, ts);

			if (s * (a + b + ts) <= ts * sw) {
				sw = a + b + ts, s = ts;
			}

		}
	}

	cout << sw << " " << s << endl;
}


Measured memory_bytes: 3648
n = int(input())
s_array = []
t_array = []
sum_time = 0
for i in range(n):
    s, t = input().split()
    t=int(t)
    s_array.append(s)
    t_array.append(t)
    sum_time += t
x = input()
for i in range(n):
    sum_time -= t_array[i]
    if s_array[i] == x:
        break
print(sum_time)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll n, k, s;
	std::cin >> n >> k >> s;

	rep(i, 0, k) {
		outs(s);
	}
	rep(i, k, n) {
		if (s == 1e9) {
			outs(1);
		}
		else {
			outs(s + 1);
		}
	}
	outn("");

	return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define lli long long int
using namespace std;
#define S second
#define F first
#define pb push_back 
#define M1 1000000007
#define M2 998244353
#define plli pair<lli,lli>
#define setit set<lli>::iterator seti
#define mapit map<lli,lli> ::iterator mapi
#define MP make_pair
#define MT make_tuple
#define PI 3.14159265358979323846
// map      iterator->first  iterator.first
// map      mp[key]=value
// set      *s.begin()
// vector   v[j]=value
// pair     p.first p.second
// vector of pairs v[j].first v[j].second
// tuple    get<index>(tuple_name)
// vector of tuples get<index>(v[j])  sort(v.begin(),v.end())
//priority queue .top() .pop() .push()
// __gcd(x,y)
#define mini(x,y) (y + ((x - y) & ((x - y) >>(sizeof(int) * CHAR_BIT - 1))))
#define maxi(x,y) (x - ((x - y) & ((x - y) >> (sizeof(int) * CHAR_BIT - 1))))
#define fr(j,a,b) for(j=a;j<b;j++)

int power(int x, unsigned int y, int p)  
{    int res = 1;    
     x = x % p;
     if (x == 0) return 0;
     while (y > 0)  
     {  if (y & 1)  
        res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
     }  
    return res;  
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lli t,i,j,n,x,y,q;
    t=1;
    for(i=0;i<t;i++){
        cin>>n;
        lli a[n];
        lli b[n];
        b[0]=1;
        x=0;
        for(j=0;j<n;j++){
            cin>>a[j];
            
               x=(a[j]^x);
        }
         for(j=0;j<n;j++){
            cout<<(a[j]^x)<<" ";
        } 
    }
}



Measured memory_bytes: 5172
import os
import heapq
import sys,threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10**5)
from io import BytesIO, IOBase
def gcd(a,b):
    if b==0:

        return a
    else:
        return gcd(b,a%b)
def power(x, p,m):
    res = 1
    while p:
        if p & 1:
            res = (res * x) % m
        x = (x * x) % m
        p >>= 1
    return res
def inar():
    return [int(k) for k in input().split()]

def lcm(num1,num2):
    return (num1*num2)//gcd(num1,num2)

def main():
    #t=int(input())
    t=1
    for _ in range(t):

        #n=int(input())
        x,k,d=inar()
        #arr=inar()
        if abs(x//d)>=k:
            #print(x//d)
            print(abs(x)-k*d)
        else:
            value=x % d
            k-=abs(x//d)
            if k % 2==0:
                print(value)
            else:
                print(min(abs(value-d),abs(value+d)))



BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()
    #threadin.Thread(target=main).start()


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

#define	Rep0(i, n)	for (int i=0; i<n; i++)
#define	Rep1(i, n)	for (int i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	string S;
	cin >>S;
	int x=0;
	Rep0(i, S.size())
		if ('x'==S.at(i))
			x++;
	if (x<8)
		cout <<"YES" <<endl;
	else
		cout <<"NO" <<endl;
	return 0;
}



Measured memory_bytes: 256
D, N = gets.split.map(&:to_i)

if N == 100 then
  if D == 0 then
    ans = N + 1
  elsif D == 1 then
    ans = N * 100 + 100
  elsif D == 2 then
    ans = N * 10000 + 10000
  end
else
  if D == 0 then
    ans = N
  elsif D == 1 then
    ans = N * 100
  elsif D == 2 then
    ans = N * 10000
  end
end

puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 1000483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    int a[M],b[M],c[M][N],now[M] = {};
    int dp[5000];
    REP(i,5000) dp[i] = INF;
    dp[0] = 0;
    REP(i,M){
        cin >> a[i] >> b[i];
        REP(j,b[i]){
            cin >> c[i][j];
            now[i] |= (1 << (c[i][j] - 1));
        }
        REP(j,(1 << N)-1){
            dp[j | now[i]] = min(dp[j | now[i]],dp[j] + a[i]);
        }
    }
    if(dp[(1 << N)-1] != INF) cout << dp[(1 << N)-1] << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 384
;(load "lib.lisp")
(declaim (optimize (speed 3) (safety 0) (debug 0)))
#+sbcl (declaim (sb-ext:muffle-conditions sb-ext:compiler-note))
(defconstant +modulo+ 998244353)

(defun expt-mod (b e m)
  (declare (type fixnum b e m))
  (loop with aa fixnum = 1
	with bb fixnum = b
	with ee fixnum = e
	until (zerop ee) do
	(if (evenp ee)
	    (psetf bb (rem (the fixnum (* bb bb)) m)
		   ee (ash ee -1))
	  (psetf aa (rem (the fixnum (* aa bb)) m)
		 ee (1- ee)))
	finally (return aa)))

(defun make-expt-mod-table (b l u m)
  (let ((a (make-array (+ (abs (- u l)) 1) :element-type 'fixnum)))
    (declare (type (simple-array fixnum (*)) a))
    (if (> u l)
	(loop for e fixnum = (expt-mod b l m) then (rem (the fixnum (* e b)) m)
	      for i fixnum from 0 to (- u l)
	      do (setf (aref a i) e))
      (loop for e fixnum = (expt-mod b u m) then (rem (the fixnum (* e b)) m)
	    for i fixnum from (- l u) downto 0
	    do (setf (aref a i) e)))
    a))

;; nCk = n-1Ck-k + n-1Ck
(defun make-binom-mod-table (n uk m)
  (let ((a (make-array (1+ uk) :element-type 'fixnum)))
    (declare (type (simple-array fixnum (*)) a))
    (setf (aref a 0) 1)
    (loop for nn fixnum from 1 to n do
	  (when (<= nn uk) (setf (aref a nn) 1))
	  (loop for kk fixnum from 1 to (min (1- nn) uk) 
		with temp fixnum = 1 do
		(psetf (aref a kk) (rem (+ temp (aref a kk)) m)
		       temp (aref a kk))))
    a))

;; nCk = (n-k+1)/k nCk-1
(defun make-binom-mod-p-table (n uk p)
  (let ((a (make-array (1+ uk) :element-type 'fixnum)))
    (declare (type (simple-array fixnum (*)) a))
    (setf (aref a 0) 1)
    (loop for kk fixnum from 1 to uk do
	  (setf (aref a kk)
		(rem (* (- n kk -1)
			(aref a (1- kk))
			(expt-mod kk (- p 2) p))
		     p)))
    a))

(defun count-4-a (n m k)
  (declare (type (integer 1 200000) n m))
  (declare (type (integer 0 199999) k))
  (let* ((beta (1- m))
	 (et (make-expt-mod-table beta (1- n) (- n k 1) +modulo+))
	 (bt (make-binom-mod-p-table (1- n) k +modulo+)))
    (declare (type (simple-array fixnum (*)) et bt))
    (loop for e fixnum across et
	  and b fixnum across bt
	  with sum fixnum = 0
	  do (setf sum (rem (the fixnum (+ sum (the fixnum (* e b)))) +modulo+))
	  finally (return (rem (the fixnum (* m sum)) +modulo+)))))

(defun count-4-b (n m k)
  (declare (type (integer 1 200000) n m))
  (declare (type (integer 0 199999) k))
  (when (= (1- n) k)
    (return-from count-4-b (rem (* m (expt-mod m (1- n) +modulo+))
				+modulo+)))
  (let* ((beta (1- m))
	 (et (make-expt-mod-table beta 0 (- n 2 k) +modulo+))
	 (bt (make-binom-mod-p-table (1- n) (- n 2 k) +modulo+)))
    (declare (type (simple-array fixnum (*)) et bt))
    (loop for e fixnum across et
	  and b fixnum across bt
	  with sum fixnum = (expt-mod m (1- n) +modulo+)
	  do (setf sum (mod (the fixnum (- sum (the fixnum (* b e)))) +modulo+))
	  finally (return (rem (the fixnum (* m sum)) +modulo+)))))
	  
(defun count-4 (n m k)
  (if (> k (floor n 2))
      (count-4-b n m k)
    (count-4-a n m k)))

(let* ((n (read))
      (m (read))
      (k (read)))
  (princ (count-4 n m k)))


Measured memory_bytes: 33560
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int main(){
    int H, W;
    cin >> H >> W;
    for(int y = 0; y < H; ++y){
        string str;
        cin >> str;
        cout << str << endl << str << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// AOJ 1172
// Chebyshev's Theorem

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int prime[300001] = { 0 };
int MAX = 300000;

void make_prime(){
  int i, j;

  for (i = 2; i < MAX; i++) {
    prime[i] = 1;
  }

  for (i = 2; i * i < MAX; i++) {
    if (prime[i]){
      for (j = i * 2; j < MAX; j += i) {
        prime[j] = 0;
      }
    }
  }
}

int main() {
  make_prime();

  while (true) {
    int input;
    cin >> input;
    if (input == 0) { break; }
    int n = input;
    int count = 0;

    for (int i = n + 1; i <= n * 2; i++) {
      if (prime[i] == 1) { count++; }
    }

    cout << count << endl;
  }

  return 0;
}

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

int r, c, k, x, y, a;
ll mat[3005][3005];
ll dp[3005][3005][4];

int main() {
    cin >> r >> c >> k;
    for (int i = 0; i < k; i++) {
        cin >> x >> y >> a;
        mat[x][y] = a;
    }

    for (int i = 1; i <= r; i++) {
        for (int j = 1; j <= c; j++) {
            for (int z = 0; z < 4; z++) {
                if (z == 0) {
                    dp[i][j][0] = max(dp[i - 1][j][0], dp[i - 1][j][1]);
                    dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][2]);
                    dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][3]);
                    dp[i][j][0] = max(dp[i][j][0], dp[i][j - 1][0]);
                }
                else if (z == 1) {
                    dp[i][j][1] = max(dp[i - 1][j][0], dp[i - 1][j][1]) + mat[i][j];
                    dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][2] + mat[i][j]);
                    dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][3] + mat[i][j]);
                    dp[i][j][1] = max(dp[i][j][1], dp[i][j - 1][0] + mat[i][j]);
                    dp[i][j][1] = max(dp[i][j][1], dp[i][j - 1][1]);
                }
                else {
                    dp[i][j][z] = max(dp[i][j - 1][z], dp[i][j - 1][z - 1] + mat[i][j]);
                }
            }
        }
    }
    cout << max(max(dp[r][c][0], dp[r][c][1]), max(dp[r][c][2], dp[r][c][3])) << endl;
}


Measured memory_bytes: 355660
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
# 深さ優先探索で各直線を考える


def main():
    def dfs(v, p):
        for u in tree[v]:
            if u == p:
                continue
            # 累積和の計算
            ans[u] += ans[v]
            dfs(u, v)

    n, q = map(int, input().split())
    # tree[i]: 頂点i+1の子どもたち
    tree = [[] for i in range(n)]
    ans = [0] * n

    for _ in range(0, n - 1):
        a, b = map(int, input().split())
        tree[a - 1].append(b - 1)
        tree[b - 1].append(a - 1)

    for _ in range(q):
        p, x = map(int, input().split())
        ans[p - 1] += x

    # 根ノードの頂点 1 から開始
    dfs(0, -1)

    print(*ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 268432
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

ll dp[3010][3010];

int main() {
    string s, t;
    cin >> s >> t;
    ll slen = s.size();
    ll tlen = t.size();
    REP(i, 0, 3010) {
        fill(dp[i], dp[i] + 3010, 0);
    }
    REP(i, 0, slen) {
        REP(j, 0, tlen) {
            if (s[i] == t[j]) {
                dp[i + 1][j + 1] = dp[i][j] + 1;
            } else {
                dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
            }
        }
    }
    string ans = "";
    ll snum = slen;
    ll tnum = tlen;
    while(snum > 0 && tnum > 0) {
        if (dp[snum][tnum] == dp[snum - 1][tnum]) {
            snum--;
        } else if (dp[snum][tnum] == dp[snum][tnum - 1]) {
            tnum--;
        } else {
            ans += s[snum - 1];
            snum--;
            tnum--;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


Measured memory_bytes: 71040
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;


/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back


/*---  Type ---*/
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;


/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// 4-direction
int dy4[] = {0,  1, -1,  0};
int dx4[] = {1,  0,  0, -1};

// 8-direction
int dy8[] = {0,  1,  1,  1,  0, -1, -1, -1};
int dx8[] = {1,  1,  0, -1, -1, -1,  0,  1};

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

int main() {
  int N;
  cin >> N;
  vector< pair<int, int> > p;
  rep(i, N) {
    int x, y;
    cin >> x >> y;
    p.pb(mp(x, y));
  }

  map< pair<int, int>, int> counts;
  rep(i, N) {
    rep(j, N) {
      map< pair<int, int>, int> hoge;
      if(i == j) continue;
      pair<int, int> diff = mp(p[i].first - p[j].first, p[i].second - p[j].second);
      if(diff.first == 0 && diff.second == 0) continue;
      if(counts.count(diff) != 0) {
        if(hoge.count(diff) != 0) continue;
        counts[diff]++;
        hoge.insert(mp(diff, 1));
      } else {
        counts.insert(mp(diff, 1));
        hoge.insert(mp(diff, 1));
      }
    }
  }

  int ans = 1000;
  for(auto d : counts) {
    // cout << d.first.first << ", " << d.first.second << " => " << d.second << endl;
    ans = min(ans, (N-1)-d.second);
  }
  if(N == 1) {
    cout << 1 << endl;
  } else {
    cout << ans+1 << endl;
  }

  return 0;
}

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

template<class T> struct SegmentTree {
    using F = function<T(T, T)>;
private :
    int n;          // size
    T id;           // identity element
    vector<T> node; // data
    F f;            // operation
    F g;            // update
public :
    // sz : size, f : operation, g : update, def : identity
    SegmentTree(int sz, F f, F g, T id) : n(1), f(f), g(g), id(id) {
        while (n < sz) n *= 2;
        node = vector<T>(2*n-1, id);
    }

    // v : vector, f : operation, g : update, def : identity
    SegmentTree(vector<T> v, F f, F g, T id) : n(1), f(f), g(g), id(id) {
        while (n < (int)v.size()) n *= 2;
        node = vector<T>(2*n-1, id);
        for (int i = 0; i < (int)v.size(); i++) node[i+n-1] = v[i];
        for (int i = n-2; i >=0; i--) node[i] = f(node[i*2+1], node[i*2+2]);
    }

    // update
    void update (int i, T x) {
        i += n - 1;
        assert(i < node.size());
        node[i] = g(node[i], x);
        while (i > 0) {
            i = (i-1)/2;
            node[i] = f(node[2*i+1], node[2*i+2]);
        }
    }

    // query [a, b)
    T query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return id;
        if (a <= l && r <= b) return node[k];
        T vl = query(a, b, 2*k+1, l, (l+r)/2);
        T vr = query(a, b, 2*k+2, (l+r)/2, r);
        return f(vl, vr);
    }

    T query (int a, int b) { return query(a, b, 0, 0, n); }

    T operator[] (int i) const { return node[i+n-1]; } 

};

int main() {
    int n, q;
    string s;
    cin >> n >> s >> q;
    vector<int> a(n);
    for (int i = 0; i < n; i++) a[i] = (1<<(s[i]-'a'));
    
    auto f = [](int a, int b) { return (a|b); };
    auto g = [](int a, int b) { return b; };
    SegmentTree<int> seg(a, f, g, 0);
    
    while (q--) {
        int op;
        cin >> op;
        if (op == 1) {
            int i;
            char c;
            cin >> i >> c;
            seg.update(i-1, (1<<(c-'a')));
        } else {
            int l, r;
            cin >> l >> r;
            int b = seg.query(l-1, r);
            cout << __builtin_popcount(b) << endl;
        }
    }
    return 0;
}

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

const int maxn=1e5+7;
int a[maxn],t[maxn],n;

bool cmp(int x,int y)
{
	return a[x]<a[y];
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) {
		scanf("%d",a+i);
		t[i]=i;
	}
	sort(t+1,t+n+1,cmp);
	for(int i=1;i<=n;++i) printf("%d ",t[i]);
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
const double X = 0.006;
int main()
{
	int N, T, A;
	cin >> N >> T >> A;
	int idx = 0;
	double tmp = 1e9,val;
	for (int i = 1; i <= N; i++)
	{
		cin >> val;
		val = T -val * X;
		if (tmp>abs(A - val))tmp =abs(A-val), idx = i;
	}
	cout << idx << endl;
		return 0;
}

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

void solve(long long N, std::vector<long long> A){
    vector<pll> ans(N);
    for(ll i=0; i< N; i++){
        ans[i].first = A[i];
        ans[i].second = i;
    }
    sort(ans.begin(), ans.end());
    for(ll i=0; i< N; i++){
        cout << ans[i].second+1 << ' ';
    }
    cout << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define mod 10e9+7

#define rep(i,n) for(int i=0;i<n;i++)
int main(){
   ll n,mini=INF,time,a=INF,b=INF;
   int cx,cy,pin,i,j;
  string s;
  cin >> s;
  for(int i=0;i<s.size();i++){
     if(s.at(i)=='1'){
     s.at(i)='9';
     continue ;
     }
     if(s.at(i)=='9'){
     s.at(i)='1';
     }
  }
cout << s << endl;



}
   



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a[3], b[3];
	for(int i=0;i<3;i++){
		cin >> a[i] >> b[i];
	}
	int cnt[5];
	for(int i=0;i<5;i++){
		cnt[i] = 0;
	}
	for(int i=0;i<3;i++){
		cnt[a[i]]++;
		cnt[b[i]]++;
	}
	for(int i=1;i<=4;i++){
		if(cnt[i]>2){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

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

using namespace std;

int main(){
  int N;cin>>N;
  int x=0,y=0;
  int ans=0;
  int z=0;
  for(int i=0;i<N;++i){
    string st;cin>>st;
    for(int j=0;j<st.size()-1;++j){
      if(st[j]=='A'&&st[j+1]=='B')ans++;
    }
    int t=0,u=0;
    if(st[0]=='B')t=1;
    if(st.back()=='A')u=1;
    x+=t;
    y+=u;
    z+=(t|u);
    
  }
  if(x&&x==y&&x==z)ans--;
  ans+=min(x,y);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n, x;
int main(void){
    // Your code here!
    cin >> n >> x;
    if (x == 2 * n - 1 || x == 1) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    if (x < n) {
        for (ll i = 1; i < n + 1; i++) if (i != x - 1 && i != x) cout << i << endl;
        cout << x - 1 << endl << x << endl;
        for (ll i = n + 1; i < 2 * n; i++) cout << i << endl;
    } else {
        for (ll i = 1; i < n; i++) if (i != x && i != x + 1) cout << i << endl;
        cout << x << endl << x + 1 << endl;
        for (ll i = n; i < 2 * n; i++) if (i != x && i != x + 1) cout << i << endl;
    }
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int N,M;
  cin>>N>>M;
  vector<int>A(N);
  priority_queue<pair<int,int>>s;
  for(int i=0;i<N;i++){
    cin>>A[i];
    s.push(make_pair(A[i],1));
  }
  vector<int>B(M),C(M);
  for(int i=0;i<M;i++){
    cin>>B[i]>>C[i];
    s.push(make_pair(C[i],B[i]));
  }
  int64_t ans=0;
  for(int i=0;i<N;i++){
    auto p=s.top();
    s.pop();
    ans+=p.first;
    if(p.second>1){
      p.second--;
      s.push(p);
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6480
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, K = iim()
    mod = 10**9 + 7

    if N > K:
        print(0)
        return

    ans = 1
    for i in range(N):
        ans = (K-i) * ans % mod

    print(ans)


if __name__ == "__main__":
    resolve()



Measured memory_bytes: 5600
#!python3

# input
s = input()


def main():
    n = len(s)
    if s[0] != s[-1]:
        ans = "First" if n % 2 == 1 else "Second"
    else:
        ans = "First" if n % 2 == 0 else "Second"
    print(ans)


if __name__ == "__main__":
    main()


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

#define FastRead        ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl            "\n"
#define sq(x)           ((x)*(x))
#define pi              acos(-1.0)
#define NUM             1000005

typedef long long ll;


int main()
{
    FastRead

    ll n, a, b;
    cin >> n >> a >> b;

    ll dif = b - a;

    if(dif == 0 and (a==1 || b==n))
    {
        if(a==1)
            cout << "Borys" << endl;
    }
    
    else
    {

        if(dif%2 == 0)
            cout << "Alice" << endl;
        else
            cout << "Borys" << endl;
    }
}


Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
typedef long long ll;
using namespace std;

int main()
{
	ll k, n;
	cin >> k >> n;
	vector<ll> a;
	ll aa;
	for(int i=0; i<n; i++)
	{
		cin >> aa;
		a.push_back(aa);
	}

	vector<ll> dist;
	ll d;
	for(int i=0; i<n-1; i++)
	{
		d = a[i+1] - a[i];
		dist.push_back(d);
	}
	d = k - a[n-1] + a[0];
	dist.push_back(d);

	sort(dist.begin(), dist.end());
	ll sum = 0;
	for(int i=0; i<n-1; i++)
	{
		sum += dist[i];
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 4976
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A;
  cin >> A;
  if(A < 1200) {
    cout << "ABC" << endl;
  }
  else if(A < 2800) {
    cout << "ARC" << endl;
  }
  else {
    cout << "AGC" << endl;
  }
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define ll long long
int cmp(int a,int b){
	return a>b;
}
int main(){
 	int n,m,s=0;
 	cin >> n >>m;
 	int a[105];
 	for(int i=0;i<n;i++){
 		cin >> a[i] ;
 		s+=a[i];
	}
	sort(a,a+n,cmp);
	int f=0;
	double g=1.0*s/4/m;
	for(int i=0;i<n;i++){
		if(a[i]>=g) {
			f++;
		} 
	}
	if(f>=m){
		cout <<"Yes"<<endl;
	}else{
		cout <<"No"<<endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define db(x) cout << #x << " = " << (x) << "\n";
using ll = long long;
using ld = long double;

static const auto do_fast_io = [] {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return nullptr;
}();

int main() {
    int n;
    cin >> n;
    vector<long double> dp(n + 1);
    dp[0] = 1;
    long double x;
    for (int i = 1; i <= n; ++i) {
        cin >> x;
        for (int j = n; j >= 0; --j) {
            dp[j] = dp[j] * (1 - x);
            if (j - 1 >= 0) {
                dp[j] += dp[j - 1] * x;
            }
        }
    }
    long double ans = 0;
    for (int i = n / 2 + 1; i <= n; ++i) {
        ans += dp[i];
    }
    cout << fixed << setprecision(10) << ans;
    return 0;
}

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

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

    vector<long long int> div;
    for (long long int i=1; i*i<=n; i++){
        if (n % i == 0){
            div.push_back(i);

            long long int j = n / i;// counterpart
            if (j != i) div.push_back(j);
        }
    }
    sort(div.begin(), div.end());

    long long int ans = 0;
    for(auto d :div){
        if(d < n/d - 1) ans += n/d - 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  vector<bool> prime(100101,true);
  prime[1] = false;
  for(int i = 2; i*i <= 100100; i++) {
    if (!prime[i]) continue;
    for(int j = i*2; j <= 100100; j += i) {
      prime[j] = false;
    }
  }
  vector<int> a(100100,0);
  rep(i,3,100001) {
    if (!prime[i]) continue;
    if (prime[(i + 1)/2]) a[i] = 1;
  }
  rep(i,0,100001) {
    a[i+1] += a[i];
  }
  int q;
  cin >> q;
  rep(i,0,q) {
    int l, r;
    cin >> l >> r;
    cout << a[r] - a[l-1] << "\n";
  }
  return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			
			int N = sc.nextInt();
			long T = sc.nextLong();
			long[] t = new long[N];
			long sum = 0;
			
			for(int i=0;i<N;i++) {
				t[i] = sc.nextLong();
			}
			
			if(N==1) {
				System.out.println(T);
				return;
			}
			
			for(int i=1;i<N;i++) {
				if(t[i]-t[i-1]>=T) {
					sum+=T;
				}else {
					sum+=(t[i]-t[i-1]);
				}
				
				if(i==N-1) {
					sum+=T;
				}
			}
			
			System.out.println(sum);
		}
	}

Measured memory_bytes: 65044
#include <cstdio>
#include <cstdlib>
#define MAX 2000001
#define VMAX 10000

int main() {
	unsigned short *A, *B;
	int *p;

	int C[VMAX + 1];
	int n;
	scanf("%d", &n);

	A = (unsigned short *)malloc(sizeof(short) * n + 1);
	B = (unsigned short *)malloc(sizeof(short) * n + 1); 

	for (int i = 0; i <= VMAX; ++i) C[i] = 0;

	for (int i = 0; i < n; ++i) {
		scanf("%hu", &A[i + 1]);
		C[A[i + 1]]++;
	}

	for (int i = 1; i <= VMAX; ++i) C[i] = C[i] + C[i - 1];

	for (int j = 1; j <= n; ++j) {
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}

	for (int i = 1; i <= n; ++i) {
		if (i > 1) printf(" ");
		printf("%d", B[i]);
	}
	printf("\n");
}


Measured memory_bytes: 10544
#include <cstdio>

int n, d, x;
long double a, b;

int main() {
	scanf("%d%d%d", &n, &d, &x);
	a = b = .5 * (2 * n - 1) * x + d;
	for (int i = 2; i <= n; ++i) {
		a = a * (i + 1) / i + b;
	}
	printf("%.12Lf\n", a);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
	int N, a[10];
	int cnt = 1;
	int total = 1;
	scanf("%d", &N);
	for(int i = 0; i < N; i++) scanf("%d", &a[i]);
	for(int i = 0; i < N; i++){
		if(a[i] % 2 == 0){
			cnt *= 2;
		}
		total *= 3;
	}
	printf("%d\n", total - cnt);
	return 0;
}


Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (a, b) = get!(i32, i32);
    let r = if a%3==0 || b%3==0 || (a+b)%3==0 { "Possible" } else { "Impossible" };
    println!("{}", r);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    ll x;
    cin>>x;
    if(x>=400&&x<=599)
    cout<<"8"<<endl;
    if(x>=600&&x<=799)
    cout<<"7"<<endl;
    if(x>=800&&x<=999)
    cout<<"6"<<endl;
    if(x>=1000&&x<=1199)
    cout<<"5"<<endl;
    if(x>=1200&&x<=1399)
    cout<<"4"<<endl;
    if(x>=1400&&x<=1599)
    cout<<"3"<<endl;
    if(x>=1600&&x<=1799)
    cout<<"2"<<endl;
    if(x>=1800&&x<=1999)
    cout<<"1"<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include<cstdlib>
	using namespace std;
	int main() {

		int n, h, w, ans = 0;
		int tate = 0, yoko = 0;
		cin >> n >> h >> w;
		tate = n - h + 1;
		yoko = n - w + 1;
		if (abs(tate*yoko) != tate * yoko) {
			cout << 0 << endl;
		}
		else {
			cout << tate * yoko << endl;
		}


		return 0;
	}


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


using namespace std;

int main() {
	string Ns;
	cin >> Ns;
	int sum=0;

	for (int i = 0; i < Ns.size(); i++) {
		sum = sum + (Ns[i] - '0');
	}

	if (sum % 9 == 0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3740
# -*- coding: utf-8 -*-

n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n+1-i):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            print(i,j,n-i-j)
            exit()

print('-1 -1 -1')


Measured memory_bytes: 9172