akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

//code by lynmisakura.wish to be accepted!
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

/***************************/
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll>> vpi;

//const long long INF = 1LL << 55;

#define itn ll
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

class ASortedArrays {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int n;cin >> n;
        vector<int> a(n);
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
        }

        int inc;//増加中：１、減少中：−１、不明：０
        int ans = 1;
        if(a[0] < a[1])inc = 1;
        else if(a[0] == a[1])inc = 0;
        else inc = -1;

        for(int i = 1;i < n;i++){
            if(a[i] == a[i-1])continue; //前の要素と同じならそこで区切る必要は絶対にない
            if(inc == 0){
                if(a[i] > a[i-1])inc = 1;
                else inc = -1;
            }else{
                if(inc == 1 and a[i] < a[i-1])ans++,inc = 0;
                else if(inc == -1 and a[i] > a[i-1])ans++,inc = 0;
            }
        }
        cout << ans<< endl;
    }
};

int main() {
	ASortedArrays solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void){
    int size[20] = {};
    int number[100] = {};
    int max, min, total;
    
    for (int i = 0; scanf ("%d", &size[i]), size[i] != 0; i++){
        max = 0, min = 1000, total = 0;
        for (int j = 0; j < size[i]; j++){
            scanf ("%d", &number[j]);
            total += number[j];
            if (max < number[j]) max = number[j];
            if (min > number[j]) min = number[j];
        }
        total -= max + min;
        total /= size[i] - 2;
        printf ("%d\n", total);
    }
}

Measured memory_bytes: 1720
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pll         pair<long long,long long>
#define vll          vector<long long>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (long long)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main(){
	ll n,k;cin>>n>>k;
	ll x=n%k;
	ll y=abs(k-x);
	cout<<min(x,y);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#if 1
#define DEBUG(x) do{cerr << #x << "=" << x << endl;}while(0);
#else
#define DEBUG
#endif


int main(){
	int a,b,c;
	cin >> a >> b >> c;

	int tmp;
	tmp = a;
	a = b;
	b = tmp;

	tmp = a;
	a = c;
	c = tmp;

	cout << a << " " << b << " " << c << endl;

	return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np

read = sys.stdin

N, K = map(int, read.readline().split())
k = 2 * K
xyc = np.array(read.read().split(), np.str)
x = xyc[::3].astype(int)
y = xyc[1::3].astype(int)
c = xyc[2::3]

x[c == 'B'] -= K
x %= k
y %= k

grid = np.zeros((3 * K, 3 * K), np.int64)
np.add.at(grid, (x, y), 1)
np.add.at(grid, (x + K, y + K), 1)
np.subtract.at(grid, (x + K, y), 1)
np.subtract.at(grid, (x, y + K), 1)
np.cumsum(grid, axis=0, out=grid)
np.cumsum(grid, axis=1, out=grid)

p1 = grid[:K, :K] + grid[k:, k:] + grid[K:k, K:k] + grid[k:, :K] + grid[:K, k:]
p2 = grid[K:k, :K] + grid[K:k, k:] + grid[:K, K:k] + grid[k:, K:k]
print(max(p1.max(), p2.max()))


Measured memory_bytes: 118304
class Dice:
    u, s, e, w, n, b = map(int, input().split())
    roll = input()
    for i in roll:
        if i == "E":
            e,u,w,b = u,w,b,e
        elif i == "S":
            s,u,n,b = u,n,b,s
        elif i == "W":
            w,u,e,b = u,e,b,w
        elif i == "N":
            n,u,s,b = u,s,b,n
    print(u)

dice = Dice()

Measured memory_bytes: 7668
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
inf = 10**17
mod = 10**9+7

n, w = map(int, input().split())
weight = []
value = []
for _ in range(n):
    x, y = map(int, input().split())
    weight.append(x)
    value.append(y)


dp = [[0] * (w + 1) for j in range(n + 1)]
for i in range(n):
    for j in range(w + 1):
        if j < weight[i]:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = max(dp[i][j - weight[i]] + value[i], dp[i][j])
print(dp[n][w])


Measured memory_bytes: 149296
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define mp make_pair
#define pb push_back
#define EB emplace_back
#define fi first
#define se second
#define all(v) ALL(v)
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr double eps = 1e-14; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int w,h;
vector<string> a;

int dfs(int x,int y,vector<vector<bool>>& used){
    if(a[x][y]=='B') return 1;
    else if(a[x][y]=='W') return 2;

    used[x][y]=true;

    int ret=0;
    rep(i,4){
        int nx=x+dx[i];
        int ny=y+dy[i];
        if(nx<0 or nx>=h or ny<0 or ny>=w) continue;
        if(used[nx][ny]) continue;
        ret |= dfs(nx,ny,used);
    }
    return ret;
}

void solve(){
    a.assign(h,"");
    rep(i,h) cin>>a[i];

    vvi t(h,vi(w,0));
    rep(i,h) rep(j,w) if(a[i][j]=='.'){
        vector<vector<bool>> used(h,vector<bool>(w,false));
        t[i][j] = dfs(i,j,used);
    }

    int cnt[4]={0};
    rep(i,h) rep(j,w){
        cnt[t[i][j]]++;
    }

    cout << cnt[1] << " " << cnt[2]<< endl;
}

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

Measured memory_bytes: 3256
#include<bits/stdc++.h>
using namespace std;
int ac[100005];
int main()
{
	int n,q;
	string s;
	cin>>n>>q>>s;
	for(int i=1;i<s.size();i++)
		if(s[i-1]=='A'&&s[i]=='C')
			ac[i]=1;
	for(int i=1;i<=s.size();i++)
		ac[i]+=ac[i-1];
	for(int i=1;i<=q;i++)
	{
		int l,r;
		cin>>l>>r;
		cout<<ac[r-1]-ac[l-1]<<endl;
	}
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
using namespace std;
#define outl(x) cout<< (x) << '\n'

int main()
{
   cin.tie(0), ios::sync_with_stdio(false);
   int W, H, x, y, r;
   cin >> W >> H >> x >> y >> r;

   outl( ( x+r <= W && x-r >= 0 && y+r <= H && y-r >= 0) ? "Yes" : "No" );
}




Measured memory_bytes: 3220
#include <cstdio>

using namespace std;

int main(){
    int m1, d1, m2, d2;
    int res = 0;
    scanf("%d %d", &m1, &d1);
    scanf("%d %d", &m2, &d2);
    if(m1 == m2){
        res = 0;
    }else{
        res = 1;
    }
    printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 128
n,c,k = map(int,input().split()) #ｎが合計人数、ｃが定員、ｋが時間
t = [int(input()) for _ in range(n)]
t = sorted(t)
count = 0
bus = []
for i in range(0,n):
    if len(bus)>0: #バスに人が１人以上いるとき
        if  c <= len(bus): #バスに人がｃ人以上いるとき⇒出発する
            count += 1
            bus = []
            
        if len(bus)>0 and k < t[i]-bus[0]: #人が１人以上いて時間が過ぎてしまうとき
            count += 1
            bus = [t[i]]
        else:
            bus.append(t[i])
    else:
        bus.append(t[i])
        
    if i==n-1:
        if len(bus)>0:
            count += 1
            bus = []
print(count)
    

        

Measured memory_bytes: 51416
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

int sumL[2][100010], sumR[2][100010];
int ansL[2][100010], ansR[2][100010];

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, C;
    cin >> N >> C;
    int x[100010], v[100010];
    rep(i, N) cin >> x[i + 1] >> v[i + 1];
    x[0] = 0, v[0] = 0;
    x[N + 1] = C, v[N + 1] = 0;
    rep(i, N) {
        sumL[0][i + 1] = sumL[0][i] + v[i + 1] - (x[i + 1] - x[i]);
        sumL[1][i + 1] = sumL[1][i] + v[i + 1] - (x[i + 1] - x[i]) * 2;
        sumR[0][i + 1] = sumR[0][i] + v[N - i] - (x[N + 1 - i] - x[N - i]);
        sumR[1][i + 1] = sumR[1][i] + v[N - i] - (x[N + 1 - i] - x[N - i]) * 2;
    }
    rep(i, N) {
        rep(j, 2) {
            ansL[j][i + 1] = max(sumL[j][i + 1], ansL[j][i]);
            ansR[j][i + 1] = max(sumR[j][i + 1], ansR[j][i]);
        }
    }
    int ans = 0;
    rep(i, N + 1) {
        ans = max(ans, ansL[0][i] + ansR[1][N - i]);
        ans = max(ans, ansL[1][i] + ansR[0][N - i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

// ??£??\???????????¨
struct Edge { uint32_t to, id; };
using Graph = vector<vector<Edge>>;

struct Bridge {
#define PB push_back
	typedef uint32_t T;
	typedef vector<T> vt;
	explicit Bridge(const Graph & g) : v2cmp(g.size()) {
		T n = g.size(), k = 0;
		vt ord(n, 0), low(n), stk;
		function<void(T, T, T)> f = [&](T c, T p, T id) {
			ord[c] = low[c] = ++k;
			stk.PB(c);
			for (auto e : g[c]) {
				if (!ord[e.to]) {
					f(e.to, c, e.id);
					low[c] = min(low[c], low[e.to]);
				} else if (e.id != id) {
					low[c] = min(low[c], ord[e.to]);
				}
			}
			if (low[c] == ord[c]) {
				if (p != n) bridge.PB({ id, min(c, p), max(c, p) });
				component.PB({});
				T v; do {
					v2cmp[v = stk.back()] = component.size() - 1;
					stk.pop_back();
					component.back().PB(v);
				} while (v != c);
			}
		};
		for (T i = 0; i < n; ++i) if (!ord[i]) f(i, n, T(-1));
	}
	// BridgeEdge : u < v ?????????????????????
	// v2cmp[v]   : ?????? v ????±?????????????????????????????????????????????????
	struct BridgeEdge { T id, u, v; };
	vt v2cmp;
	vector<BridgeEdge> bridge;
	vector<vt> component;
};

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);
	u32 n, m; cin >> n >> m;
	vl w(n); REP(i, n) cin >> w[i];
	Graph g(n);
	REP(i, m) {
		u32 u, v;
		cin >> u >> v;
		u--; v--;
		g[u].push_back({ v, i });
		g[v].push_back({ u, i });
	}

	Bridge dcc(g);
	auto&& cmp = dcc.component;

	vl w_cmp(cmp.size(), 0);
	REP(i, cmp.size()) {
		for (auto&& id : cmp[i]) w_cmp[i] += w[id];
	}

	vb visited(cmp.size(), false);
	function<array<ll, 2>(u32)> dfs = [&](u32 cur_cmp) {
		array<ll, 2> ma = {0, 0};
		visited[cur_cmp] = true;
		for (auto&& v : cmp[cur_cmp]) for (auto&& next : g[v]) {
			u32 next_cmp = dcc.v2cmp[next.to];
			if (visited[next_cmp]) continue;
			auto ret = dfs(next_cmp);
			ma[1] = max(ma[1], ret[1]);
			ma[0] += ret[0];
		}
		if (ma[0] || cmp[cur_cmp].size() > 1) ma[0] += w_cmp[cur_cmp];
		if (!ma[0]) ma[1] += w_cmp[cur_cmp];
		return ma;
	};

	auto p = dfs(dcc.v2cmp[0]);
	cout << p[0] + p[1] << endl;

	return 0;
}

Measured memory_bytes: 28084
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<int,int>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
   
    ll h,n,i,s=0;
    cin>>h>>n;
    for(i=0;i<n;i++)
    {
    	ll x;
    	cin>>x;
    	s += x;
    }
    if(s>=h) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
s = input()
t = input()
dp = [[0]*(len(t)+1) for _ in range(len(s)+1)]
for i in range(1, len(s)+1):
    for j in range(1, len(t)+1):
        dp[i][j] = max(dp[i][j], dp[i-1][j])
        dp[i][j] = max(dp[i][j], dp[i][j-1])
        if s[i-1] == t[j-1]:
            dp[i][j] = max(dp[i][j], dp[i-1][j-1]+1)

ans = []
i = len(s)
j = len(t)
while 0 < i and 0 < j:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        i -= 1
        j -= 1
        ans.append(s[i])
print("".join(ans[::-1]))

Measured memory_bytes: 113500
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws FileNotFoundException {

        Scanner in = new Scanner(System.in);
//        Scanner in = new Scanner(new File("input.txt"));

        int a = in.nextInt();
        int b = in.nextInt();

        System.out.println(a * b);
    }
}


Measured memory_bytes: 35800
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
  #define debug(...) printf(__VA_ARGS__)
#else
  #define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int main() {
  ll A, B, C;
  cin >> A >> B >> C;
  C = min(C, A + B + 1);
  cout << B + C << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
using namespace std;

long long int memo[100001];

long long int fib(int n) {
	long long int ans;
	if (n == 0)
		return 1;
	if (n == 1)
		return 1;

	if (memo[n] != -1)
		return memo[n];
	
    return (memo[n] = (fib(n - 1) + fib(n - 2)) % 1000000007);
}

int main(int argc, char *argv[])
{
	int i;
	int n, m;
	cin >> n >> m;
    vector<int> hole(m);
	long long int answer = 0;

	memset(memo, -1, sizeof(memo));

	for (i = 0; i < m; i++) 
		cin >> hole[i];

	for (i = 0; i < m - 1; i++) {
		if (hole[i + 1] - hole[i] == 1) {
			cout << '0' << endl;
			return 0;
		}
	}

	if (m == 0) {
		cout << fib(n) << endl;
		return 0;
	}

	answer = fib(hole[0] - 1);
	
	for (i = 0; i < m - 1; i++) {
		answer *= fib(hole[i + 1] - hole[i] - 2);
		answer %= 1000000007;
	}
			
	answer *= fib(n - hole[m - 1] - 1);

	cout << answer % 1000000007 << endl;
	
	return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 1000000000000
#define MOD 10000007
typedef long long ll;
//
int last(int d,int i,vector<int> answer){
   
      int t=0;
    for(int k=1;k<=d;k++){
       
       if(i==answer[d-k]) break;
       t++;
    }
   return t;
}
int down(int d,int i,vector<vector<int>> point,vector<int> dism){
   rep(i,26){

   }
}
int main(){
   int D;cin>>D;
   vector<int> dism;
   rep(i,26){
      int a;cin>>a;
      dism.push_back(a);
   }
   vector<vector<int>> point(D,vector<int>(26,0));
   rep(i,D){
      rep(j,26){
         int s;cin>>s;
         point[i][j]=s;
      }
   }
   vector<int> answer;
   rep(i,D){
      int a;cin>>a;
      answer.push_back(a-1);
   }
   int ans=0;
   rep(i,D){
      ans=ans+point[i][answer[i]];
      rep(j,26){
       ans=ans-(dism[j]*(last(i+1,j,answer)));
      }
      cout<<ans<<endl;
      
   }
 //  rep(i,26){  cout<<last(1,i,answer);}
}

Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <map>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;

ll n, k, r, s, p;
string t;
bool win[100010];

int main() {
  cin >> n >> k >> r >> s >> p >> t;
  
  map<char, ll> m;
  m['s'] = r;
  m['p'] = s;
  m['r'] = p;
  ll ans = 0;
  REP(i, n) {
    if (i - k >= 0) {
      if (t[i - k] == t[i] && win[i - k]) continue;
      ans += m[t[i]];
      win[i] = true;
    } else {
      ans += m[t[i]];
      win[i] = true;
    }
  }
    cout << ans;
  return 0;
}




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

int main(void){
    ll a,b,k;
    cin >> a >> b >> k;
    if(a >= k){
        cout << a-k << ' ' << b << endl;
    }else if(a+b >= k){
        cout << "0 " << a+b-k << endl;
    }else{
        cout << "0 0\n";
    }
    return 0;
}

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

using namespace std;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)
typedef long long ll;
typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;


int main() {
	int n;
	cin >> n;
	VI p(n);
	REP(i, n)cin >> p[i];
	VI a(n), b(n);
	REP(i, n) {
		a[i] = 25000 * i+1;
		b[i] = 25000 * (n - i)+1;
	}
	REP(i, n) {
		a[p[i] - 1] += i;
	}
	REP(i, n)cout << a[i] << ' ';
	cout << endl;
	REP(i, n)cout << b[i] << ' ';
	cout << endl;

	return 0;


}

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e5;

int main(){
	int N;
	cin>>N;
	lli A[MAX];
	rep(i,N)cin>>A[i];
	
	lli ans=0;
	//うえから見て、奇数で取れたら取る
	rep(i,N-1){
		if(A[i]%2==1&&A[i+1]>0){
			ans++;
			A[i]-=1;
			A[i+1]-=1;
		}
	}
	rep(i,N) ans+=A[i]/2;
	cout<<ans;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using static Constans;

public static class Constans
{
    public const long Mod = (long)1e9 + 7;
}

public struct ModInt
{
    public long Num;

    public ModInt(long num)
    {
        Num = num;
    }

    // x^n
    public static long Power(long x, long n)
    {
        long pow = 1;
        while (n > 0)
        {
            if (n % 2 == 0)
            {
                x *= x;
                x %= Mod;
                n /= 2;
            }
            else
            {
                pow *= x;
                pow %= Mod;
                n--;
            }
        }

        return pow;
    }

    public static ModInt GetInv(long f)
    {
        // フェルマーの小定理 a^(-1) = a^(mod-2)
        return new ModInt(Power(f, Mod - 2));
    }

    public ModInt GetInv()
    {
        return GetInv(Num);
    }

    public override string ToString()
    {
        return Num.ToString();
    }

    public static ModInt operator +(ModInt l, ModInt r)
    {
        l.Num += r.Num;
        if (l.Num >= Mod)
        {
            l.Num -= Mod;
        }
        return l;
    }

    public static ModInt operator -(ModInt l, ModInt r)
    {
        l.Num -= r.Num;
        if (l.Num < 0)
        {
            l.Num += Mod;
        }
        return l;
    }

    public static ModInt operator *(ModInt l, ModInt r)
    {
        return new ModInt(l.Num * r.Num % Mod);
    }

    public static implicit operator ModInt(long n)
    {
        n %= Mod;
        if (n < 0)
        {
            n += Mod;
        }
        return new ModInt(n);
    }
}

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var N = vals[0];
        var K = vals[1];


        var pattern = new ModInt();
        for (long i = K; i <= N + 1; i++)
        {
            // S(n) = n(a+l)/2
            var min = i * (0 + (i - 1)) / 2;
            var max = i * ((N - (i - 1)) + N) / 2;
            pattern += max - min + 1;
        }

        Console.WriteLine(pattern);
    }
}

Measured memory_bytes: 28252
N, K = map(int, input().split())
x = list(map(int, input().split()))
dis = []
for i in range(N - K + 1):
    dis.append(abs(x[i] - x[i + K - 1]) + abs(x[i]))
    dis.append(abs(x[i] - x[i + K - 1]) + abs(x[i + K - 1]))
print(min(dis))


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

int main(){
  int N,M;cin>>N>>M;
  int IDL=1, IDR=N;
  rep(i,M){
    int L,R;cin>>L>>R;
    if(IDL<L)IDL=L;
    if(R<IDR)IDR=R;
  }
  int ans = IDR-IDL+1;
  if(ans<0)ans=0;
  cout<<ans<<endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<map>
using namespace std;
typedef long long int ll;
 
ll gcd(ll a, ll b){
    if (b == 0) return a;

    return gcd(b, a % b);
}

int main(){
    int N, M;
    cin >> N >> M;

    vector<vector<int>> SC(M, vector<int>(2));
    for(int i = 0; i < M; i++){
        cin >> SC[i][0] >> SC[i][1];
    }

    vector<int> num(N, 10); 
    bool hantei = true;
    for(int i = 0; i < M; i++){
        if (num[SC[i][0] - 1] != SC[i][1]){
            if (num[SC[i][0] - 1] == 10) num[SC[i][0] - 1] = SC[i][1];
            else{
                hantei = false;
                break;
            }
        }
    }

    if (hantei){
        int ans = 0;
        for(int i = 0; i < N; i++){
            if (num[i] == 10){
                if(i == 0 && N != 1) num[i] = 1;
                else num[i] = 0;
            }
            
            if (N - i == 3) ans += 100 * num[i];
            else if (N - i == 2) ans += 10 * num[i];
            else ans += num[i];
        }

        if (num[0] == 0 && N >= 2) cout << -1 << endl;
        else cout << ans << endl;
    }
    else cout << -1 << endl;
}

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

signed main(){
    int n;
    cin >> n;
    double ans;
    if(n % 2 == 0){
        ans = 1.0 / 2.0; 
    }else{
        ans = (double)(n / 2 + 1) / (double)n;
    }
    cout << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import math


def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    n = int(input().rstrip())

    p = tuple(int(x) for x in input().rstrip().split(" "))
    q = tuple(int(x) for x in input().rstrip().split(" "))

    import itertools

    perm = itertools.permutations(list(range(1, n+1)), n)

    for i, v in enumerate(perm):
        if v == p:
            a = i
        if v == q:
            b = i

    print(abs(a-b))



if __name__ == "__main__":
    resolve()


Measured memory_bytes: 67704
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int N; cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    int now = 1;
    int ans = 0;
    rep(i,N){
        if(a[i] == now){
            ans++;
            now++;
        }
    }
    if(ans == 0){
        cout << -1 << endl;
        return 0;
    }
    cout << N-ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 2000 + 100;
const int MOD = 924844033;

int n, m, k;
bool sep[MAXN];
int f[MAXN][MAXN][2][2], g[MAXN];
int fac[MAXN];

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n >> k;
	sep[1] = true;
	for(int i = 1, s = 1; i <= k; i++)
		s += (n - i) / k + 1, sep[s] = true;
	f[0][0][0][0] = 1;
	for(int i = 1; i <= n; i++)
		for(int j = 0; j <= i; j++)
		{
			f[i][j][0][0] = ((long long)f[i - 1][j][0][0] + f[i - 1][j][0][1] + f[i - 1][j][1][0] + f[i - 1][j][1][1]) % MOD;
			if(sep[i])
				continue;
			if(j - 1 >= 0)
				f[i][j][0][1] = (f[i - 1][j - 1][0][0] + f[i - 1][j - 1][0][1]) % MOD;
			if(j - 1 >= 0)
				f[i][j][1][0] = (f[i - 1][j - 1][0][0] + f[i - 1][j - 1][1][0]) % MOD;
			if(j - 2 >= 0)
				f[i][j][1][1] = f[i - 1][j - 2][0][0];
			// cout << i << ' ' << j << ' ' << f[i][j][0][0] << endl;
		}
	fac[0] = 1;
	for(int i = 1; i <= n; i++)
		fac[i] = (long long)fac[i - 1] * i % MOD;
	for(int i = 0; i <= n; i++)
		g[i] = ((long long)f[n][i][0][0] + f[n][i][0][1] + f[n][i][1][0] + f[n][i][1][1]) % MOD;
	// for(int i = 0; i <= n; i++)
	// 	cout << g[i] << ' ' << fac[i] << endl;
	int ans = 0;
	for(int i = 0; i <= n; i++)
		ans = (ans + (long long)g[i] * fac[n - i] % MOD * (i & 1 ? MOD - 1 : 1)) % MOD;
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 66048
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;




int main(){
    string s;
    cin>>s;
    string A="2019/04/30";
    cout<<(s<=A?"Heisei":"TBD")<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;


const long long int mod = 998244353;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 


long long int N,P,A,B,C,K,sum[200200]={},res=0;
long long int dp[300300]={};
string S,T;


int main(){
    cout << fixed << setprecision(18);
    cin>>A>>B>>C>>K;
    if(A+B>=K){
        cout<<min(A,K)<<endl;
    }else{
        K-=A+B;
        cout<<A-K<<endl;
    }
}


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

using namespace std;
typedef long long li;

li sgn(li x) {
    if (x > 0) {
        return 1;
    } else if (x < 0) {
        return -1;
    } else {
        return 0;
    }
}

li solve(vector<li> xs) {
    li acc = 0, ans = 0;
    for (auto x : xs) {
        if (acc == 0) {
            acc += x;
        } else {
            li nacc = acc + x;
            if (sgn(acc) * sgn(nacc) >= 0) {
                const li delta = abs(-sgn(acc) - nacc);
                acc = -sgn(acc);
                ans += delta;
            } else {
                acc = nacc;
            }
        }
    }
    return ans;
}

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

    vector<li> xs(n);
    for (int i = 0; i < n; ++i) {
        cin >> xs[i];
    }

    li ans = 1e18;
    li head = xs[0];
    if (head != 0) {
        ans = solve(xs);
    }
    if (head <= 0) {
        xs[0] = 1;
        ans = min(ans, solve(xs) + abs(1 - head));
    }
    if (head >= 0){
        xs[0] = -1;
        ans = min(ans, solve(xs) + abs(-1 - head));
    }

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

Measured memory_bytes: 1804
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {

int main(void) {
  int n;cin>>n;
  int a[n+10];rep(i,0,n-1) cin>>a[i];
  int ans[n+10];
  vector<int> b;
  for(int i=n-1;i>=0;--i) {
    // cout << i+1 << ": ";
    int sum=a[i];
    for(int j=2*(i+1);j<=n;j+=(i+1)) {
      sum+=ans[j-1];
      // cout << j << " ";
    }
    // cout << endl;
    ans[i]=sum%2;
    if(ans[i]==1) b.push_back(i);
  }
  pr(b.size());
  for(auto e:b) {
    cout << e+1 << " ";
  }
  if(b.size()>0) cout << endl;
  return 0;
}

#if 0
12
1 0 1 0 0 1 0 0 1 0 1 0
#endif


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long M, D;
  cin >> M >> D;
  long result = 0;
  for (long i = 1; i <= D; i++) {
    if (i / 10 < 2) continue;
    if (i % 10 < 2) continue;
    long tmp = (i / 10) * (i % 10);
    if (1 <= tmp and tmp <= M) result++;
  }
  cout << result << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
N,Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
    t[i+1]=t[i]+(1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])

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

using namespace std;

int main()
{
    int w, a, b;
    cin >> w >> a >> b;
    if (a < b)
    {
        if (a+w >= b) cout << "0";
        else cout << (b - (a + w));
    }
    else if (a == b)
    {
        cout << "0";
    }
    else
    {
        if (b+w >= a) cout << "0";
        else cout << (a - (b + w));
    }
}


Measured memory_bytes: 256
//Product Max 

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int a,b,c,d;cin>>a>>b>>c>>d;
    int q=a*c,w=a*d,e=b*c,r=b*d;
    cout<<max(max(q,w),max(e,r))<<nnn;
    return 0;
}

Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                int n = int.Parse(Console.ReadLine());

                if (n == 0) break;

                int sum = 0;

                for (int i = 0; i < n; i++)
                {
                    int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                    int s = input[0] + input[1] + input[2];
                    int w = input[3];

                    s = CheckS(s);
                    w = CheckW(w);

                    int rank = Math.Max(s, w);

                    if (rank > 5) continue;

                    sum += (600 + (200 * rank));
                }
                sb.AppendLine(sum.ToString());
            }
            Console.Write(sb);
        }

        static int CheckS(int s)
        {
            if (s <= 60) return 0;
            if (s <= 80) return 1;
            if (s <= 100) return 2;
            if (s <= 120) return 3;
            if (s <= 140) return 4;
            if (s <= 160) return 5;
            return 6;
        }

        static int CheckW(int w)
        {
            if (w <= 2) return 0;
            if (w <= 5) return 1;
            if (w <= 10) return 2;
            if (w <= 15) return 3;
            if (w <= 20) return 4;
            if (w <= 25) return 5;
            return 6;
        }
    }
}

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

int main(){
    int n; cin >> n;
    int h[n], i; for(i = 0; i < n; i++) cin >> h[i];
    int a = 0, b = abs(h[1] - h[0]), c; i = 2;
    while(i < n){
        c = min(abs(h[i] - h[i-1]) + b, abs(h[i] - h[i-2]) + a);
        a = b;
        b = c;
        i++;
    }
    if(n == 2)  cout << b << endl;
    else cout << c << endl;
    return 0;
}


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

int main()

{
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	int sum=0;
	for (int i=0;i<s.size();i++){
		if (s[i]=='x') sum++;
	}

	if (sum>7) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 256
//
// Created by Hideaki Imamura on 2020-03-18.
//
# include <bits/stdc++.h>

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

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

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

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

int N;
vector<int> a;

int main() {
    cin >> N;
    a.assign(N, 0);
    for (int i = 0; i < N; ++i) cin >> a[i];

    vector<int> b(N, 0);
    for (int i = N - 1; i >= 0; --i) {
        int counter = 2;
        int sum = 0;
        while ((i+1) * counter - 1 < N) {
            sum += b[(i + 1) * counter - 1];
            counter++;
        }
        b[i] = sum % 2 == a[i] ? 0 : 1;
    }

    int M = accumulate(b.begin(), b.end(), 0);
    cout << M << endl;
    for (int i = 0; i < N; ++i) {
        if (b[i]) cout << i + 1 << " ";
    }
    if (M) cout << endl;
    return 0;
}

Measured memory_bytes: 2432
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int a,b,c,d,e,k; cin >> a >> b >> c >> d >>e >>k;
    if ((e-a)<=k) {
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mut x:u128 = read();
    let y:u128 = read();
    let mut ans = 0;
    while x <= y {
        ans += 1;
        x *= 2;
    }
    println!("{}", ans);
}


Measured memory_bytes: 2144
#include <iostream>
#include <string>
#include <queue>
#include <cstdlib>
using namespace std;

typedef struct{
    int time;
    string name;
} process;

int main(){
    int n, q, total_time = 0;
    cin >> n >> q;
    process tmp;
    queue<process> que;
    for (int i = 0; i < n; i++){
        cin >> tmp.name >> tmp.time;
        que.push(tmp);
    }

    while(!que.empty()){
        //先頭要素の時間を見る
        //q以下なら
        if (que.front().time <= q){
            total_time += que.front().time;
            cout << que.front().name << " " <<  total_time << endl;
            //先頭を削除
            que.pop();
        } else {
            total_time += q;
            tmp.time = que.front().time - q;
            tmp.name = que.front().name;
            //先頭を削除
            que.pop();
            //後ろに追加
            que.push(tmp);
        }
    }
    
    return 0;
}


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn =5*100001;
ll power(ll x, ll n) {
    ll res = 1;
    for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    }
    return res;
}
int main()
{
   
  IOS
  ll a,b;
  cin>>a>>b;
  cout<<6-a-b;
  


  

}
  


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

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

struct edge {
    int t, c;
    edge(int t, int c): t(t), c(c) {}
};

const int INF = 1e9;
int n, u, k, v, c;
vector<edge> G[100];
int d[100];

void dijkstra(int s) {
    fill(d, d + n, INF);
    d[s] = 0;

    priority_queue<P, vector<P>, greater<P> > que;
    que.push(P(0, s));
    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.t] <= d[v] + e.c) continue;
            d[e.t] = d[v] + e.c;
            que.push(P(d[e.t], e.t));
        }
    }
}

int main(void) {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            cin >> v >> c;
            G[u].push_back(edge(v, c));
        }
    }

    dijkstra(0);

    for (int i = 0; i < n; i++)
        cout << i << " " << d[i] << endl;

    return 0;
}


Measured memory_bytes: 3100
class Process:

    def __init__(self, name, time):
        self.name = name
        self.time = time

    def execute(self, q):
        if self.time == 0:
            raise RuntimeError
        execution_time = min(self.time, q)
        self.time -= execution_time
        return execution_time

    def is_ended(self):
        return self.time == 0


class Queue:

    def __init__(self):
        self.head = 0
        self.tail = 0
        self.queue = [0] * 100005

    def is_empty(self):
        return self.head == self.tail

    def is_full(self):
        return self.head == (self.tail + 1) % len(self.queue)

    def enqueue(self, x):
        self.queue[self.tail] = x
        if self.tail + 1 == len(self.queue):
            self.tail = 0
        else:
            self.tail += 1

    def dequeue(self):
        if self.is_empty():
            raise RuntimeError
        x = self.queue[self.head]
        if self.head + 1 == len(self.queue):
            self.head = 0
        else:
            self.head += 1
        return x


def main():
    # input
    n, q = list(map(int, input().split(' ')))
    processes = []
    for _ in range(n):
        name, time = input().split(' ')
        processes.append(Process(name, int(time)))
    Q = Queue()
    for process in processes:
        Q.enqueue(process)

    # execute
    elapsed_time = 0
    while not Q.is_empty():
        process = Q.dequeue()
        elapsed_time += process.execute(q)
        if process.is_ended():
            print(process.name, elapsed_time)
        else:
            Q.enqueue(process)


if __name__ == "__main__":
    main()



Measured memory_bytes: 18212
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}
 
ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}
 
 
int main() {
    int n;
    cin >> n;
    int mod = 1000000007;
    ll res = 1;
    for(ll i=1; i<=n; ++i) {
        res *= i;
        if (res>mod) res=res%mod;
    }
    cout << res << "\n";
}


Measured memory_bytes: 256