akhauriyash/Code-Regression huggingface dataset:
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    static String INPUT = "";

    public static void main(String[] args) {
        InputStream is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());

        Scanner scanner = new Scanner(is);

        final int q = scanner.nextInt();
        List<LR> lr = new ArrayList<>();
        for (int i = 0; i < q; i++) {
            lr.add(new LR(scanner.nextInt(), scanner.nextInt()));
        }

        boolean[] sieve = primeSieve(100001);
        List<Integer> ret = solve(sieve, lr);
        for (int r : ret) {
            System.out.println(r);
        }
    }

    static List<Integer> solve(boolean[] sieve, List<LR> lrList) {
        List<Integer> ret = new ArrayList<>();
        List<Integer> primeIndex = similarPrimeIndex(sieve);
        for (LR ele : lrList) {
            int count = 0;

            for (int index : primeIndex) {
                if (ele.l <= index && index <= ele.r) {
                    count++;
                }
                if (ele.r < index) {
                    break;
                }
            }

            ret.add(count);
        }
        return ret;
    }

    static List<Integer> similarPrimeIndex(boolean[] sieve) {
        List<Integer> primeIndex = new ArrayList<>();
        for (int i = 1; i < sieve.length; i += 2) {
            if (sieve[i] && sieve[(i + 1) / 2]) {
                primeIndex.add(i);
            }
        }
        return primeIndex;
    }

    static class LR {
        int l;
        int r;

        LR(int l, int r) {
            this.l = l;
            this.r = r;
        }
    }

    static boolean[] primeSieve(int n) {
        boolean[] isPrime = new boolean[n];
        for (int i = 0; i < isPrime.length; i++) {
            isPrime[i] = true;
        }
        isPrime[1] = false;
        int limit = (int) Math.ceil(Math.sqrt(n));
        for (int i = 2; i < limit; i++) {
            for (int j = 2; j * i < n; j++) {
                isPrime[j * i] = false;
            }
        }
        return isPrime;
    }
}


Measured memory_bytes: 93068
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner as = new Scanner(System.in);
		String st = as.next();
		String a,b,c;
		a=b=c= "";
		for(int i=0;i<5;i++){
			a+=String.valueOf(st.charAt(i));
		}
		for(int i=6;i<13;i++){
			b+=String.valueOf(st.charAt(i));
		}
		for(int i=14;i<19;i++){
			c+=String.valueOf(st.charAt(i));
		}
		System.out.println(a+" "+b+" "+c);
	}
}

Measured memory_bytes: 10068
#include<cstdio>
#include<map>
using namespace std;
#define MAXN 100000
#define MO 1000000007
#define LL long long
LL dp[MAXN];
map<LL,LL>G;
LL DP(LL x)
{
	if(x<2||(x<MAXN&&dp[x])) return dp[x];
	if(G[x]!=0) return G[x];
	LL ret=0;
	if(x%2)
		ret=(2*DP(x/2)%MO+DP(x/2-1))%MO;
	else
		ret=(DP(x/2)+2*DP(x/2-1)%MO)%MO;
	if(x<MAXN) dp[x]=ret;
	else G[x]=ret;
	return ret;
}
int main()
{
	LL n;
	dp[0]=1,dp[1]=2;
	scanf("%lld",&n);
	printf("%lld\n",DP(n));
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
flag=True
count=0
while flag:
    flag=False
    for j in range(N-1, 0, -1):
        if A[j] < A[j-1]:
            tmp=A[j]
            A[j]=A[j-1]
            A[j-1]=tmp
            flag=True
            count=count+1

print(' '.join([str(a) for a in A]))
print("{}".format(count))




Measured memory_bytes: 5608
#include<stdio.h>
int main()
{
  int a,b,c,d,e,f;
  char op;
  while(1){
    scanf("%d %c %d",&a,&op,&b);
    c=a+b;
    d=a-b;
    e=a*b;
    f=a/b;
    //printf("\n");
    if(op=='?')
      {
	break;
	//printf("\n");
      }
    /*   else if(a<0 || a>20000)
	 {
	 break;
	 }
	 else if(b<0 || b>20000)
	 {
	 break;
	 }
    */
    else if(op=='+')
      {
	printf("%d\n",c);
      }
    else if(op=='-')
      {
	printf("%d\n",d);	
      }
    else if(op=='*')
      {
	printf("%d\n",e);	
      }
    else if(op=='/')
      {
	printf("%d\n",f);
      }
  }
  return 0;
}

Measured memory_bytes: 600
#include <stdio.h>

int	main()
{
	int	a, b;
	int	ans;

	ans = 0;
	scanf("%d %d\n", &a, &b);
	if (a > 0)
		ans = 1;
	else if (a <= 0 && b >= 0)
		ans = 0;
	else
	{
		if ((b - a) % 2)
			ans = 1;
		else
			ans = -1;
	}
	if (ans == 1)
		printf("Positive\n");
	else if (ans == 0)
		printf("Zero\n");
	else if (ans == -1)
		printf("Negative\n");
	return (0);
}

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

ll n, p, ans = 1;
bool dd[M];
vector<ll> v;

int main(){
	cin >> n >> p;
	if (n == 1){
		cout << p;
		return 0;
	}
	for (int i = 2; i < M; i++){
		if (!dd[i]){
			v.push_back(i);
			for (int j = 2*i; j < M; j += i) dd[j] = true;
		}
	}
	for (int i = 0; i < v.size(); i++){
		ll cnt = 0;
		while (p > 0 && p%v[i] == 0) cnt++, p /= v[i];
		if (cnt > 0) ans *= pow(v[i], cnt/n);
	}
	cout << ans;
	return 0;
}


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

int main(){
  int N; cin >> N;
  vector<int> X(N);
  vector<int> Y(N);
  
  for(int i=0; i<N; i++){
    cin >> X[i];
    Y[i] = X[i];
  }
  
  sort(X.begin(), X.end());
  
  for(int i=0; i<N; i++){
    if(Y[i] <= X[N/2 -1]){
      cout << X[N/2] << endl;
    }
    else{
      cout << X[N/2 -1] << endl;
    }
  }
}


Measured memory_bytes: 3712
///                             In The Name Of Allah                                           
//                             	Mohammad Hosseini
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
#define ld long double
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std; 

const int N = 3e5 + 100, OO = 1e5 + 100, M = 998244353,  P = 6151, SQ = 1300, lg = 6;
typedef pair <int, int> pii;
int aa[N], bb[N], lena, lenb, len, k;

int32_t main() {
	use_fast;
	int a, b, x, y, l, r, ans, ll, rr;
	cin >> a >> b;
	x = a, y = b;
    while(a)
		aa[++lena] = a & 1, a /= 2;
    while(b)
		bb[++lenb] = b & 1, b /= 2;
    for(int i = max(lena,lenb); i; i--) {
        if(aa[i] != bb[i]){
			len=i;
			break;
		}
        x -= 1ll * aa[i] << (i - 1);
        y -= 1ll * bb[i] << (i - 1);
    }
    for(int i = len - 1; i; i--) {
		if(bb[i]) {
			k = i; 
			break;
		}
	}
    l = x, r = (1ll << (len - 1)) + (1ll << k) - 1;
    ll = (1ll << (len - 1)) + x, rr = (1ll << len) - 1;
    if(ll > r)
		ans = r - l + 1 + rr - ll + 1;
    else 
		ans = rr - l + 1;
    cout << ans << endl;
	return 0;
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- uploaded by ubuntu 20.04
5- ...
*/
 


Measured memory_bytes: 3632
#include <stdio.h>


int main(void){
    int n;
    int ans;
    int white = 0;
    int black = 0;
    char order[200100];
    
    fgets(order, 200100, stdin);
    sscanf(order, "%d", &n);
    fgets(order, 200100, stdin);
    
    for(int i = 0; i < n; i++){
        if(order[i] == '.'){
            white++;
        }
    }
    ans = white;
    for(int i = 0; i < n; i++){
        if(order[i] == '.'){
            white--;
        }
        if(order[i] == '#'){
            black++;
        }
        if((white + black) < ans){
            ans = white + black;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 384
A = int(input())
B = int(input())
C = int(input())
X = int(input())

res = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            sum_amm = 500*i + 100*j + 50*k
            if X == sum_amm:
                res += 1
print(res)


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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};



int main(){
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	cout << min(b*(n/a+(n%a?1:0)), d*(n/c+(n%c?1:0))) << endl;

	return 0;
}



Measured memory_bytes: 3136
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <sstream>

#define mp make_pair
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define ll long long

using namespace std;

int main(){
	int l;
	while( cin >> l , l)
	{
		int money=0 , i , ans=0;
		for( i = 0; i<12; i++)  
		{
			int n , m;
			cin >> m >> n;
			money += m-n;
			if( l <= money ) {
				ans = i+1;
				l = 100000000;
			}
		}
		if( ans ) cout << ans;
		else cout << "NA";
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
using namespace std;
int n, cnt;
int has[51][27];
string s;
const int inf = 1e9;
int main(int argc, const char * argv[]){
    cin>>n;
    vector<string> vec(n);
    map<char, int> loc;
    cnt = 0;
    for(char c = 'a'; c <= 'z'; ++c){
        loc[c] = cnt++;
    }
    for(int i = 0; i < n; ++i){
        cin>>s;
        vec[i] = s;
        for(int j = 0; j < (int)s.size(); ++j){
            has[i][loc[s[j]]]++;
        }
    }
    
    // 1: 2 1 1
    // 2: 2 0 2 1
    // 3: 3 0 3
    
    
    vector<int> res(26, inf);
    for(int i = 0; i < 26; ++i){
        for(int j = 0; j < n; ++j){
            res[i] = min(has[j][i], res[i]);
        }
    }
    string t = "";
    string alphabet = "abcdefghijklmnopqrstuvwxyz";
    for(int i = 0; i < 26; ++i){
        for(int j = 0; j < res[i]; ++j){
            t += alphabet[i];
        }
    }
    cout<<t<<endl;
    return 0;
}


Measured memory_bytes: 3612
from collections import deque
n,m,q=[int(_) for _ in input().split()]
lista=[[int(i) for i in input().split()] for j in range(q)]
v=deque()  #0,0,0,0,0....,0
def make(a,b,c): #a=list b=maxlen c=max
    global v
    if len(a)==b:
        v.append(a)
    else:
        for i in range(a[-1],c+1):
            make(a+[i],b,c)
for t in range(1,m+1):
    make([t],n,m)
max=0
for j in v:
    point=0
    for l in lista:
        if j[l[1]-1]-j[l[0]-1]==l[2]:
            point+=l[3]
    if max<point:
        max=point
print(max)


Measured memory_bytes: 23224
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	char s[100005];
	while(scanf("%s",&s)!=EOF)
	{
		int j=0;
		for(int i=0;s[i]!='\0';i++)
		{
			if(s[i]!=s[i+1])
			j++;
		}
		printf("%d\n",j-1);
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

int main()
{
    string s;
    int K;
    cin >> s >> K;
    string t(s);
    set<string> st;
    sort(t.begin(), t.end());

    set<char> cst;
    for(int i = 0; i < t.size(); ++i)
        cst.insert(t[i]);

    for(auto itr = cst.cbegin(); itr != cst.cend(); ++itr){
        for(int i = 0; i < s.size(); ++i){
            if(s[i] == *itr){
                for(int j = 0; j <= s.size() - i && j <= K; ++j){
                    st.insert(s.substr(i, j));
                }
            }
        }
        if(st.size() > K) break;
    }
    st.erase("");

    int cnt = 1;
    for(auto itr = st.cbegin(); itr != st.cend(); ++itr){
        if(cnt == K){
            cout << *itr << endl;
            break;
        }
        cnt++;
    }

    return 0;
}



Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul
from decimal import Decimal

mod = 998244353
INF = 10 ** 13
sys.setrecursionlimit(2147483647)
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


n, s = LI()
A = LI()
dp = [0] * (s + 1)
dp[0] = 1
for i in range(n):
    a = A[i]
    for j in range(s, -1, -1):
        dp[j] = dp[j] * 2 % mod
        if j >= a:
            dp[j] = (dp[j] + dp[j - a]) % mod


print(dp[s])



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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
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);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, p, a[200200], res;

signed main() {
	cin >> n;
	res = n-1;
	rep(i,n) {
		cin >> p;
		a[p-1] = i;
	}
	int l = 0;
	reps(r,1,n) {
		if (a[r-1]<a[r]) chmin(res,n-(r-l+1));
		else l = r;
	}
	cout << res << ln;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(n,k) for(int i = (int)n;i<k;i++)
using Int =long long int;
using Graph =vector<vector<int>>;
int main(){
    int N;cin>>N;
    priority_queue<int>que;
    rep(0,N){
        int a;cin>>a;
        que.push(a);
    } 
    Int sum = que.top();
    que.pop();
    bool parity = (que.size()-1)%2 != 0;//き数か？
    int loop = (que.size()-1)/2;
   
    rep(0,loop){
        sum+= 2*que.top();
        que.pop();
    }
    if(parity)sum+=que.top();
    cout<<sum<<endl;

    
}

Measured memory_bytes: 4328
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES\n":"NO\n");}
void Yn(bool z){cout<<(z?"Yes\n":"No\n");}
void yn(bool z){cout<<(z?"yes\n":"no\n");}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 0;
int n, m, x, y, t;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m >> x >> y;
  FOR(i, 0, n){
    cin >> t;
    maxs(x, t);
  }
  FOR(i, 0, n){
    cin >> t;
    mins(y, t);
  }
  cout << (x < y ? "No War" : "War") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using vector2d = vector<vector<T>>;
template<class S, class T> void map_init(map<S, T> &m, S k, T v){if(!m.count(k)) m[k] = v;}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int ans = 1;
    for(int i = 1; i < S.size(); i++) {
        if(S[i - 1] != S[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	int N;
  	cin>>N;
  vector<long long> a(3*N);
  for(long long &x: a) cin>>x; 
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  long long ans=0;
  for(int i=1;i<2*N;i+=2) ans+=a[i];
  cout<<ans<<endl;
}

Measured memory_bytes: 2560
a, b, c = map(int, input().split())
d = 0
e = {}
for i in range(a, b+1):
    if i not in e:
        e.setdefault(i, i)
    d += 1
    if d >= c:
        break
d = 0
for i in range(b, a-1, -1):
    if i not in e:
        e.setdefault(i, i)
    d += 1
    if d >= c:
        break
e = sorted(e)
for i in e:
    print(i)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    string s;
    cin >> s;
    int cnt = 0;
    rep(i, 0, (int)s.size()) {
        if (s[i] == 'o') cnt++;
    }
    if (cnt >= 8) {
        cout << "YES" << endl;
        return 0;
    }
    if (cnt + 15 - (int)s.size() >= 8) {
        cout << "YES" << endl;
        return 0;
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn
import scala.collection.mutable.ArrayBuffer

/*
 ret
 http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2232735#1
 */
object Main {
  class Point(val x: Double, val y: Double){
    override def toString: String = {
      f"$x%.8f $y%.8f"
    }
  }
  
  final val start = new Point(0, 0)
  final val end   = new Point(100, 0)
  final val th = scala.math.Pi * 60.0 / 180.0
  final val cos = math.cos(th)
  final val sin = math.sin(th)


  @inline def calcuPoint(p1: Point, p2: Point, a: Double, b: Double) = new Point((a*p1.x+b*p2.x)/3.0, (a*p1.y+b*p2.y)/3.0)
  
  
  def koch(d: Double, p1: Point, p2: Point, ret: ArrayBuffer[Point]): Unit = {
    if(d != 0){
      val s = calcuPoint(p1, p2, 2.0, 1.0)
      val t = calcuPoint(p1, p2, 1.0, 2.0)
      val tsx = t.x - s.x
      val tsy = t.y - s.y
      val u = new Point(tsx*cos - tsy*sin + s.x,
                        tsx*sin + tsy*cos + s.y)
      
      koch(d-1, p1, s, ret)
      // println(s)
      ret += s
      
      koch(d-1, s, u, ret)
      //println(u)
      ret += u
      
      koch(d-1, u, t, ret)
      // println(t)
      ret += t

      koch(d-1, t, p2, ret)

    }
  }
  
  def main(args:Array[String]) = {
    var result = ArrayBuffer.empty[Point]
    val n = StdIn.readLine().trim.toInt

    //println(start)
    result += start
    koch(n, start, end, result)
    result += end

    //result.foreach(println)
    println(result.mkString(f"%n"))
  
  }
  
}


Measured memory_bytes: 59216
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int H,W; cin >> H >> W;
	vector<vector<int>> A(H, vector<int>(W));
	auto B = A;
	auto C = A;
	rep(i,H) rep(j,W) cin >> A[i][j];
	rep(i,H) rep(j,W) cin >> B[i][j];

	rep(i,H) rep(j,W)  C[i][j] = abs(A[i][j] - B[i][j]);
	vector<vector<bitset<26000>>> dp(H+1, vector<bitset<26000>>(W+1));
	dp[0][1][13000] = 1;
	rep(i,H) {
		rep(j,W) {
			dp[i+1][j+1] |= dp[i+1][j]<<C[i][j];
			dp[i+1][j+1] |= dp[i+1][j]>>C[i][j];
			dp[i+1][j+1] |= dp[i][j+1]<<C[i][j];
			dp[i+1][j+1] |= dp[i][j+1]>>C[i][j];
		}
	}

	rep(i,13000) {
		if (dp[H][W][13000-i] || dp[H][W][13000+i]) {
			cout << i << ln;
			return 0;
		}
	}

}


Measured memory_bytes: 21632
import math

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.append(-1)
B.append(-1)
C.append(-1)

A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)

l = []

for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i + 1) * (j + 1) * (k + 1) <= K:
                l.append(A[i] + B[j] + C[k])
            else:
                break

l.sort(reverse = True)

for i in range(K):
    print(l[i])


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

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

  char c;
  cin >> c;

  if(isupper(c)) {
    cout << 'A' << '\n';
  } else {
    cout << 'a' << '\n';
  }
}

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

int main() {
  std::string s;
  std::cin >> s;

  std::string str = "";
  int n = s.length();
  for (int i = 0; i < n; ++i) {
    if ( s[i] == 'B' && str.length() > 0 ) {
      str.erase(str.length() - 1);
    } else if ( s[i] != 'B' ) {
      str += s[i];
    }
  }
  std::cout << str << std::endl;

  return 0;
}


Measured memory_bytes: 256
using System;
//using System.Collections;
//using System.Collections.Generic;
using System.Linq;

namespace Abc170
{
    class MainClass
    {


        public static void Main(string[] args)
        {
            int tuLeg = 2;
            int taLeg = 4;

            int tuNumber = 0;
            int taNumber = 0;

            int count = 0;

            int[] inputIntArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            for(int i = 0; i < inputIntArray[0]+1; i++)
            {
                tuNumber = i;
                taNumber = inputIntArray[0] - i;

                if(tuLeg*tuNumber + taNumber*taLeg == inputIntArray[1])
                {
                    count++;
                }
            }
            if (count > 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 27956
a,b,c = [int(x) for x in input().split()]
r = c**2 + a**2 + b**2 - 2*a*c - 2*b*c + 2*a*b
l = 4*a*b
if c - a - b < 0:
  print("No")
elif l < r:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38452
#include<cstdio>
#include<map>
#include<utility>
#include<vector>
#include<algorithm>
using namespace std;

int d[100001];
int n,m,a,b,f6=0,f4=0,f=0,cnt,flag[100000];
map<pair<int,int> ,int> ma;
vector<int> g[100001];
pair<int,int> e[100000];

int dfs(int x,int y,int z){
    int res;
    for(int i=0;i<g[x].size();i++){
        a=min(x,g[x][i]);
        b=max(x,g[x][i]);
        if(flag[ma[make_pair(a,b)]]==0){
            flag[ma[make_pair(a,b)]]=1;
            if(g[x][i]==z){
                return 1;
            }
            return dfs(g[x][i],x,z);
        }
    }
    return 0;
}

int main(){
    int x,y;
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d %d",&a,&b);
        d[a]++;
        d[b]++;
        g[a].push_back(b);
        g[b].push_back(a);
        e[i]=make_pair(min(a,b),max(a,b));
        ma.insert(make_pair(e[i],i));
    }
    for(int i=1;i<=n;i++){
        f+=d[i]%2;
        if(d[i]>=6){
            f6=1;
        }
        if(d[i]==4){
            if(f4){
                y=i;
            }
            else{
                x=i;
            }
            f4++;
        }
    }
    if(f){
        printf("No\n");
    }
    else{
        if(f6||f4>=3){
            printf("Yes\n");
            return 0;
        }
        else if(f4<2){
            printf("No\n");
            return 0;
        }
        for(int i=0;i<4;i++){
            cnt+=dfs(x,-1,y);
        }
        if(cnt==2){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
    }
}

Measured memory_bytes: 12032
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	int N, M;
	cin >> N >> M;
	VI city(N, 0);

	FOR(i, 0, M) {
		int a, b;
		cin >> a >> b;
		city[a-1]++;
		city[b-1]++;
	}
	FOR(i, 0, N)
		cout << city[i] << endl;


	return 0;
}

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

int a, b, c, x;

int ans;

int main(void){
  // Here your code !
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &x);

  for (int ia = 0; ia <= a; ++ia) {
    for (int ib = 0; ib <= b; ++ib) {
      for (int ic = 0; ic <= c; ++ic) {
        if (500 * ia + 100 * ib + 50 * ic == x) ans += 1;
      }
    }
  }

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

  return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

ll N,P[202020];

ll i, j,ans;
int main(){
    scanf("%lld",&N);
    fornum(i,0,N){
        scanf("%lld", &P[i]);
    }
    priority_queue<ll> pq;
    pq.push(-1e9);
    fornum(i,0,N){
        ll a = -pq.top();
        if(P[i]<a){
            ++ans;
        }
        pq.push(-P[i]);
    }
    printf("%lld", ans);
    return 0;
}

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

int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if(0<=a-b) cout << "delicious" << endl;
  else if(b-a-x<=0) cout << "safe" << endl;
  else cout << "dangerous" << endl;
}

Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<62 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

int n, x; 
vector<int> b, l, u;

vector<int> ids;

bool check(int t) {
	int rec = -INF;
	int cnt = t / x;
	int tmp = 0;
	int res = t % x;
	rep(i, n) {
		int j = ids[i];
		if(i == 0) continue;
		else if(i <= cnt) {
			tmp += (x - b[j]) * u[j];
		} else {
			tmp += (0 - b[j]) * l[j];
		}
	}
	tmp += (res > b[ids[0]] ? u[ids[0]] * (res - b[ids[0]]) : l[ids[0]] * (res - b[ids[0]]));
	int bf = (res > b[ids[0]] ? u[ids[0]] * (res - b[ids[0]]) : l[ids[0]] * (res - b[ids[0]]));
	//cerr << t << " " << tmp << endl;
	chmax(rec, tmp);
	for(int i = 1; i < n; ++ i) {
		tmp -= bf;
		if(i <= cnt) {
			tmp -= (x - b[ids[i]]) * u[ids[i]];
			tmp += (x - b[ids[i - 1]]) * u[ids[i - 1]];
			tmp += (res > b[ids[i]] ? u[ids[i]] * (res - b[ids[i]]) : l[ids[i]] * (res - b[ids[i]]));
			bf = (res > b[ids[i]] ? u[ids[i]] * (res - b[ids[i]]) : l[ids[i]] * (res - b[ids[i]]));
		} else {
			tmp -= (0 - b[ids[i]]) * l[ids[i]];
			tmp += (0 - b[ids[i - 1]]) * l[ids[i - 1]];
			tmp += (res > b[ids[i]] ? u[ids[i]] * (res - b[ids[i]]) : l[ids[i]] * (res - b[ids[i]]));
			bf = (res > b[ids[i]] ? u[ids[i]] * (res - b[ids[i]]) : l[ids[i]] * (res - b[ids[i]]));
		}
		chmax(rec, tmp);
	}
	return rec >= 0;
}

void solve() {
	cin >> n >> x;
	b.resize(n), l.resize(n), u.resize(n);
    rep(i, n) {
        cin >> b[i] >> l[i] >> u[i];
    }
    ids.resize(n);
	iota(all(ids), 0);
	sort(all(ids), [&](int i, int j) {return l[i] * b[i] + u[i] * (x - b[i]) > l[j] * b[j] + u[j] * (x - b[j]);});
	int ok = n * x, ng = -1;
	while(ok - ng > 1) {
		int mid = (ok + ng) / 2;
		if(check(mid)) ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3456
#include <iostream>
using namespace std;
int main(){
  int N;
  int64_t T;
  cin >> N >> T;
  int sum = 0;
  int t[200010];
  for(int i = 0; i < N; ++i){
    cin >> t[i];
  }
  int b = 0;
  for(int i = 1; i < N; ++i){
    if(t[i] - t[i-1] < T){
      b += T - (t[i] - t[i-1]);
    }
  }
  sum = T*N - b;
  cout << sum << endl;
}

 

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long 
#define pb push_back
//#define mp make_pair
#define fr first
#define sc second
#define N ((ll)(2e6+100))
#define MAX ((ll)(1e16+100))
#define ARRS ((ll)(3e5+100))
#define MOD ((ll)(1e9+7))
#define M1 ((ll)(1001783))
#define M2 ((ll)(1001941))
#define M3 ((ll)(1002073))
#define pb push_back
 
ll n,m,sr,ed;
struct va{
	ll fr,sc,i;
};
vector<va> v[ARRS];
set<pair<ll,ll> > st;
ll f[ARRS];
ll dp[ARRS];
vector<pair<ll,ll> > tp;
map<pair<ll,ll>,ll> mp;
map<pair<ll,ll>,ll> me;
ll k,p,c;

int main(){
 
	cin>>n>>m;
	cin>>sr>>ed;
	for(int i=0; i<m; i++){
		cin>>k>>p>>c;
		c=2*c;
		v[k].pb({p,c,i});
		v[p].pb({k,c,i});
	}
 
	for(int i=0; i<=n; i++)f[i]=-1;
	st.insert({0,sr});
	while(st.size()){
		auto p=*st.begin();
		st.erase(st.begin());
		ll x=p.sc;
		ll t=p.fr;
		if(f[x]!=-1)continue;
		f[x]=t;
		for(auto y:v[x])
			st.insert({t+y.sc,y.fr});
	}
 
	for(int i=1; i<=n; i++)
		tp.pb({f[i],i});
	sort(tp.begin(),tp.end());
	
	ll wh=f[ed]/2;
	dp[sr]=1;
	for(auto p:tp){
		auto x=p.sc;
		if(f[x]==wh){
			mp[{x,-1}]=dp[x];
			me[{x,-1}]+=f[x];
		}
		for(auto y:v[x]){
			if(f[y.fr]==f[x]+y.sc){
				dp[y.fr]=(dp[y.fr]+dp[x])%MOD;
				if(f[y.fr]>wh&&wh>f[x]){
					mp[{y.i,-2}]=dp[x];
					me[{y.i,-2}]+=f[x];
				}
			}
		}
	}
 
	swap(sr,ed);
	st.clear();
	tp.clear();
	memset(dp,0,sizeof(dp));
	for(int i=0; i<=n; i++)f[i]=-1;
 
 
	st.insert({0,sr});
	while(st.size()){
		auto p=*st.begin();
		st.erase(st.begin());
		ll x=p.sc;
		ll t=p.fr;
		if(f[x]!=-1)continue;
		f[x]=t;
		for(auto y:v[x])
			st.insert({t+y.sc,y.fr});
	}
 
	for(int i=1; i<=n; i++)
		tp.pb({f[i],i});
	sort(tp.begin(),tp.end());
	
	wh=f[ed]/2;
	dp[sr]=1;
	for(auto p:tp){
		auto x=p.sc;
		if(f[x]==wh){
			mp[{x,-1}]*=dp[x];
			me[{x,-1}]+=f[x];
		}
		for(auto y:v[x]){
			if(f[y.fr]==f[x]+y.sc){
				dp[y.fr]=(dp[y.fr]+dp[x])%MOD;
				if(f[y.fr]>wh&&wh>f[x]){
					mp[{y.i,-2}]*=dp[x];
					me[{y.i,-2}]+=f[y.fr];
				}
			}
		}
	}
	ll pas=0;
	ll s=0;
	for(auto x:mp){
		if(me[x.fr]!=f[ed])continue;
		x.sc%=MOD;
		pas=(pas+x.sc*s)%MOD;
		s=(s+x.sc)%MOD;
	}
	cout<<(pas*2ll)%MOD;
}
 


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

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

    int x, y;
    cin>>x>>y;  //入力

    int num = x > y? x%y : y%x;
    if(num == 0) {
        cout<<x<<endl;
        return 0;
    }

    for(int i = num; i > 0; i--) {
        if(num%i==0 && y%i==0) {
            cout<<i<<endl;
            return 0;
        }
    }
}



Measured memory_bytes: 3224
N = int(input())
a = [list(input()) for l in range(N)]
ch = []
for i in range(N):
    if i != 0:
        if a[i-1][len(a[i-1])-1] == a[i][0]:
            continue
        else:
            print('No')
            exit()




for i in a:
    if i not in ch:
        ch.append(i)
    else:
        print('No')
        exit()
else:
    print('Yes')
    
    
    

Measured memory_bytes: 3060
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
ans = 0
for i in range(N):
    if i-K < 0 or T[i-K] != T[i]:
        if T[i] == "r":
            ans += P
        elif T[i] == "s":
            ans += R
        elif T[i] == "p":
            ans += S
    else:
        T[i] = "a"
print (ans)

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

struct edge{
    ll to;
    ll cost;
};

void dfs(ll k,vector<ll> &color, vector<bool> &is_visited, vector<vector<edge>> &G){
    is_visited[k] = true;

    rep(i,0,G[k].size()){
        if(!is_visited[G[k][i].to]){
            if(G[k][i].cost % 2 == 0) color[G[k][i].to] = color[k];
            else color[G[k][i].to] = color[k] ^ 1;
            dfs(G[k][i].to, color, is_visited, G);
        }
    }

}

int main(){
    ll n;
    cin >> n;
    vector<bool> is_visited(n, false);
    vector<ll> color(n);

    vector<vector<edge>> G(n);
    rep(i,0,n-1){
        ll u,v,w;
        cin >> u >> v >> w;
        u--;v--;
        edge e; e.cost = w; e.to = v;
        G[u].push_back(e);
        e.to = u;
        G[v].push_back(e);
    }

    color[0] = 0;
    dfs(0,color,is_visited,G);

    rep(i,0,n){
        cout << color[i] << endl;
    }
    return 0;
}


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

int main()
{
    int n,i,a[2009]={0},j,k,tot=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        int n1;
        scanf("%d",&n1);
        a[i]=n1;
    }
    sort(a+1,a+n+1);
    for(i=1;i<=n-2;i++){
        for(j=i+1;j<=n-1;j++){
            for(k=j+1;k<=n;k++){
                if(a[i]+a[j]>a[k])
                    tot++;
                else
                    break;
            }
        }
    }
    printf("%d\n",tot);
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;

vector<vector<int> > G(101010);
int N;
ll A[101010];

void bad(){
  cout<<"NO\n";
  exit(0);
}

int dfs(int v,int p){
  ll sum=0, ma=0;
  for(auto u:G[v]) if(u!=p){
    ll tmp=dfs(u,v);
    ma=max(ma,tmp);
    sum+=tmp;
  }
  if(p==-1){
    if(G[v].size()==1){
      if(A[v]!=sum) bad();
    }else{
      if(2*A[v]!=sum) bad();
    }
  }else{
    if(G[v].size()==1) return A[v];
    ll ret=2*A[v]-sum;
    sum+=ret;
    ma=max(ma,ret);
    // ma>sum/2であると自己ループが発生する
    if(ret<0||2*ma>sum) bad();
    else return ret;
  }
  return 0;
}

int main(){
  cin>>N;
  rep(i,N) cin>>A[i];
  rep(i,N-1){
    int a,b; cin>>a>>b; a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(0,-1);
  cout<<"YES\n";
  return 0;
}


Measured memory_bytes: 13184
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const int inf = int(1e10);
//const ll inf = ll(1e19);
const int mod = int(1e9) + 7;

int x;
int main(){
    cin >> x;
    if(x == 0) cout << 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 3632
/********************************************//**
 ****** Author: Shivam Kejriwal *****************
 ****** Handle: techno_phyle    *****************
 ***********************************************/

#include<bits/stdc++.h>
using namespace std;

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long ll;

#define mod 1000000007
#define N 100010
#define M 200010
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto it:a) cout << it << " "; cout << endl
#define adbp(a) for(auto it:a) cout << it.first << " " << it.second << endl
#define pb push_back
#define mp make_pair
typedef pair<double, long> key;

struct comp {
    bool operator()(pair<int,int> p1, pair<int,int> p2) {
        if (p1.first < p2.first) return false;
        if (p2.first < p1.first) return true;
        return p1.second < p2.second;
    };
};
//greater<pair<int,int> , greater<int>>
int main(){
	fastIO;
    // #ifndef ONLINE_JUDGE
    //     freopen("../input.txt", "r", stdin);
    //     freopen("../output.txt","w",stdout);
    // #endif
	int n;
	cin >> n;
	int a[n+1];
	for(int i=1;i<=n;i++) cin >> a[i];
	int dp[n+1];
	dp[1] = 0;
	dp[2] = abs(a[2] - a[1]);
	for(int i=3;i<=n;i++){
		dp[i] = min(abs(a[i] - a[i-1]) + dp[i-1] , abs(a[i] - a[i-2]) + dp[i-2]);
	}
	cout << dp[n] << endl;
	return 0;

}



Measured memory_bytes: 1024
N = int(input())
HT, HA = map(int, input().split())

for i in range(1,N):
    T, A = map(int, input().split())
    B = max( -(-HT//T), -(-HA//A) )

    HT = B * T
    HA = B * A

print(HT+HA)


Measured memory_bytes: 2940
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

#include <bits/stdc++.h>
 
using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair
#define debug_vec(x, n) cout << (#x) << ": "; for(int i = 0; i < n; i++) cout << x[i] << (i == n - 1 ? "\n" : " ");

typedef long long ll;
typedef long double ld;

void solve(){
    ll a, b, n, x = 1;
    cin >> a >> b >> n;
    if(n % b == 0){
        x = n - 1;
    }
    else{
        x = min(b - 1, n);
    }
    cout << (a * x / b) - a * (x / b) << "\n";
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}



Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ll long long
#define N 200123
#define endl '\n'

using namespace std;

int n, xall, v[N];

int main() {
    ios_base::sync_with_stdio(0);

    cin >> n;

    for(int i=0; i < n; ++i) {
        cin >> v[i];
        xall ^= v[i];
    }

    for(int i=0; i < n; ++i) {
        cout << (v[i] ^ xall) << ' ';
    }
    cout << endl;

    return 0;

}


Measured memory_bytes: 4348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF=1e18,MOD=1e9+7;
int main(){
	int n,a,b,m[3]={0};
	cin>>n>>a>>b;
	for(int i=0;i<n;i++){
		int hoge;
		cin>>hoge;
		if(hoge<=a)m[0]++;
		else if(hoge>a&&hoge<=b)m[1]++;
		else m[2]++;
	}
	int mini=min(m[0],m[1]);
	mini=min(mini,m[2]);
	cout<<mini<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=3300;
const double pi=acos(-1.0);
long long n,a[N],L;
double X,Y;
int main(){
	scanf("%d%d",&n,&L),L<<=1;
	for(int i=0;i<n;i++) scanf("%d",a+i),a[i]<<=1;
	sort(a,a+n);
	for(int i=0;i<n;i++) for(int j=i+1;j<n;j++){
		X+=(n+i-j-1)*cos(2*pi*(a[i]+a[j]>>1)/L)+(j-i-1)*cos(2*pi*(a[i]+a[j]+L>>1)/L);
		Y+=(n+i-j-1)*sin(2*pi*(a[i]+a[j]>>1)/L)+(j-i-1)*sin(2*pi*(a[i]+a[j]+L>>1)/L);
	}
	printf("%.15lf %.15lf\n",6*X/(n*(n-1)*(n-2)),6*Y/(n*(n-1)*(n-2)));
}


Measured memory_bytes: 640
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
x = 0
for i in range(40, -1, -1):
    c = 0
    for ai in a:
        if (ai >> i) & 1:
            c += 1
    if (n - c) > c and x + (1 << i) <= k:
        x += 1 << i
        ans += (n - c) * (1 << i)
    else:
        ans += c * (1 << i)
print(ans)

Measured memory_bytes: 14620
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    
        var sc = new Scanner(System.in);
    
        int d = Integer.parseInt(sc.next());
        int t = Integer.parseInt(sc.next());
        int s = Integer.parseInt(sc.next());
        
        if(s*t >= d){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

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

int main () {
  int N;
  cin >> N; //Nは９桁以下の自然数
  int n = 0;
  for (int i = 0; i < 9; i++) {
    int M = N;
    for (int j = 0; j < i; j++) {
      M /= 10;
    }
    n += M % 10;
    //cout << i << ":" << n << endl;
  }
  if (N % n == 0) 
    cout << "Yes" << endl;
  
  else 
    cout << "No" << endl;
  
  
}

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

int main(){
	long int N, Q;
	cin >> N >> Q;
	string S;
	cin >> S;
	vector<long int> l(Q),r(Q);
	for(int i=0;i<Q;i++){
		cin >> l[i] >> r[i];
	}
	vector<long int> v;
	v.push_back(0);
	for(int j=1;j<N;j++){
		if(*(S.begin() + j - 1) == 'A' && *(S.begin() + j) == 'C') v.push_back(v[j-1] + 1);
		else v.push_back(v[j-1]);
	}
	for(int i=0;i<Q;i++){
		cout << v[r[i]-1] - v[l[i]-1] << endl;
	}
}

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define de(c) cout << #c << " = " << c << endl
#define dd(c) cout << #c << " = " << c << " "
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
mt19937 mrand(random_device{}());
const ll mod=100000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxn = 233333;
int T;



int main(int argc, char const *argv[])
{
#ifdef indiewar
    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//    cin >> T;
    T =1;
    while(T--)
    {
        int a[12];
        cin >>a[0] >>a[1] >> a[2];
        sort(a,a+3);
        if(a[0] == a[1] && a[1] != a[2])
        {
            cout << "Yes" << endl;
        }
        else if(a[2] == a[1] && a[1] != a[0]){
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    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 rep2(i, a, b) for (int i = a; i < (int)(b); i++)
using ll = long long;
ll item[3001][3001], dp[4][3001][3001];
ll R, C, K, r, c, v, ans;
int main()
{
  cin >> R >> C >> K;
  rep(i, K)
  {
    cin >> r >> c >> v;
    item[r - 1][c - 1] = v;
  }
  rep2(i, 1, R + 1)
  {
    rep2(j, 1, C + 1)
    {
      rep(k, 4)
      {
        dp[k][i][j] = dp[k][i][j - 1];
      }
      dp[0][i][j] = max(dp[0][i][j], dp[3][i - 1][j]);
      if (item[i - 1][j - 1] > 0)
      {
        dp[1][i][j] = max(dp[1][i][j], dp[3][i - 1][j] + item[i - 1][j - 1]);
        rep2(k, 1, 4)
        {
          dp[k][i][j] = max(dp[k][i][j], dp[k - 1][i][j - 1] + item[i - 1][j - 1]);
        }
      }
      rep2(k, 1, 4)
      {
        dp[k][i][j] = max(dp[k - 1][i][j], dp[k][i][j]);
      }
    }
  }
  rep(k, 4)
  {
    ans = max(ans, dp[k][R][C]);
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
	int w,h,x,y,r;cin>>w>>h>>x>>y>>r;
	if(x+r<=w&&x-r>=0&&y+r<=h&&y-r>=0){
		puts("Yes");
	}
	else puts("No");
}

Measured memory_bytes: 3080