akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
//const long long INF = 1LL<<60;
const int INF = 1e9;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   int N, M;
   cin >> N >> M;
   vector<int> dp((1<<N), INF);
   int a, b;
   int c[N];
   dp[0] = 0;
   for (int i = 0; i < M; i++) {
      memset(c, 0, sizeof(c));
      cin >> a >> b;
      int flg = 0;
      for (int k = 0; k < b; k++) {
         cin >> c[k];
         flg |= (1<<(c[k] - 1));
      }
      // cout << flg << endl;
      for (int j = 0; j < (1<<N); j++) {
         // cout << dp[j] << " " << a << endl;
         chmin(dp[j | flg], dp[j] + a); 
      }
   }
   int ans = dp[(1<<N) - 1];
   if (ans == INF) ans = -1;
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll H,W,K;
    cin >> H >> W >> K;
    string C[10];
    rep(i,0,H) cin >> C[i];
    ll ans = 0;
    rep(bit1,0,(1LL<<H)){
        rep(bit2,0,(1LL<<W)){
            ll cnt = 0;
            rep(i,0,H){
                rep(j,0,W){
                    if((bit1>>i)&1) continue;
                    if((bit2>>j)&1) continue;
                    if(C[i][j] == '#') cnt++;
                }
            }
            if(cnt == K) ans++;
        }
    }
    print(ans);



    

}

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

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

def solve():
    N = int(input())
    Ps = list(map(int, input().split()))

    mn = Ps[0]
    ans = 1  # 0番目は必ず答えになるので
    for i in range(1, N):
        ans += 1 if mn >= Ps[i] else 0
        mn = min(mn, Ps[i])
    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 24744
import java.util.*;
public class Main { 
	static ArrayList<Integer> list = new ArrayList<Integer>();
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		makeList();
		while(true) {
			int n = stdIn.nextInt();
			if(n == 0) break;
			int count = 0;
			for(int i = 0; i < list.size(); i++) {
				if(list.get(i) > n) break;
				for(int j = i; j < list.size(); j++) {
					if(list.get(i) + list.get(j) > n) break;
					for(int k = j; k < list.size(); k++) {
						if(list.get(i) + list.get(j) + list.get(k) > n) break;
						for(int l = k; l < list.size(); l++) {
							if(list.get(i) + list.get(j) + list.get(k) + list.get(l) == n) {
								count++;
								break;
							}
						}
					}
				}
			}
			System.out.println(count);
		}
	}
	public static void makeList() {
		for(int i = 0; i < 32768; i++) {
			if(i * i > 32768) {
				break;
			}
			list.add(i*i);
		}
	}
		
}

Measured memory_bytes: 21348
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys


def main():
    n, k = [int(v) for v in sys.stdin.readline().rstrip().split(' ')]
    x = [int(v) for v in sys.stdin.readline().rstrip().split(' ')]

    c = 0
    while c<n and x[c] < 0:
        c += 1


    def getCost(l, r):
        if l<c and c<=r-1:
            return min(-x[l]*2+x[r-1], x[r-1]*2-x[l])
        elif c>r-1:
            return -x[l]
        else:
            return x[r-1]
    cost = getCost(0, k)

    for i in range(1,n-k+1):
        cost = min(cost, getCost(i, i+k))
    
    print(cost)
        

      
if __name__=="__main__":
    main()


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

int main(){
  int n;

  int i;
  int sum = 0;

  scanf("%d", &n);

  for(i = 1;i <= n;i++) sum += i;

  printf("%d\n", sum);
  return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

unordered_map<ll, ll> mp;

void solve() {
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = unordered_map<ll, ll>();
#pragma clang diagnostic pop
#endif
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        if (a + b == c + d) cout << "Balanced" << endl;
        else cout << (a + b > c + d ? "Left" : "Right") << endl;

        solve();

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

vector<int> z[2];

bool search(int x, vector<int> &v) {
  std::bitset<8000> b;
  b.set(0);

  for (int i : v) {
    b = (b << i) | (b >> i);
  }

  return b[abs(x)];
}

void solve() {
  string s;
  cin >> s;

  int x, y;
  cin >> x >> y;

  int way = 0;
  int n = 0;

  int i = 0;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == 'F') {
      x--;
    } else {
      break;
    }
  }

  for (; i < s.size(); i++) {
    char c = s[i];
    if (c == 'F') {
      n++;
    } else {
      if (n != 0) {
        z[way].push_back(n);
        n = 0;
      }
      way = (way + 1) % 2;
    }
  }
  if (n) {
    z[way].push_back(n);
  }

  if (search(x, z[0]) && search(y, z[1])) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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


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

int main(void){
  int N;
  cin >> N;
  
  bool flag = true;
  
  vector<string> stock(N);
  
  string t;
  cin >> t;
  stock.at(0) = t;
  
  char LastLetter = t.at(t.size()-1);
  
  for (int i = 1; i < N; i++){
    string s;
    cin >> s;
    
    for (int j = 0; j < i; j++) {
      if (s == stock.at(j)) {
        flag = false;
        break;
      }
    }
    
    
    if (LastLetter != s.at(0)) {
      flag = false;
      break;
    }
    else {
      LastLetter = s.at(s.size()-1);
      stock.at(i) = s;
    }
  }
  
  if (flag) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
  
}

Measured memory_bytes: 256
"""
じょえチャンネルおもしろいよ～～～
https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
"""

k=int(input())
a,b=map(int,input().split())
ans="NG"
for i in range(a,b+1):
  if i%k==0:ans="OK"
print(ans)

Measured memory_bytes: 9168
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li      int32_t
#define lli     long long  
#define ulli unsigned long long

#define pn           printf("\n")
#define nl           cout<<'\n'
#define sf(N)        scanf("%lld",&N)
#define pf(N)        printf("%lld",N)
#define sf1(N1,N2)    scanf("%lld %lld",&N1,&N2)
#define pf1(N1,N2)    printf("%lld %lld",N1,N2)
#define sf2(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define pf2(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define sl          cout<<' '
#define ps          printf(" ")

#define rep(i,a,b)  for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define elif        else if
#define mset(a,b)   memset(a,b,sizeof(a))

#define pb      push_back
#define pob     pop_back
#define itr     iterator
#define sz()    size()
#define szof    sizeof
#define lb      lower_bound
#define ub      upper_bound
#define mp      make_pair
#define vlli    vector<lli>
#define plli    pair<lli,lli>
#define vplli   vector<plli >
#define F       first
#define S       second
#define Dup     erase(unique(V.begin(),V.end()),V.end())

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define ALL(V)  V.begin(),V.end()

#define MX1     100000
#define MX2     1000000
#define mod     1000000007
#define Inf     1000000000000000
using namespace std;

lli Power(lli a,lli b)
{
    lli result=1;

    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }

        b=b>>1;
        a=(a*a)%mod;
    }

 return result;
}

bool visited[MX1+1];

int main()
{
    opt;
    
    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // ONLINE_JUDGE*/
    
    lli M,N,i;
    cin>>M>>N;
    
    if(abs(M-N)>1)
    {
        cout<<0;
        exit(0);
    }
    
    if(M==N)
    {
        lli FACT=1;
        
        rep(i,1,N+1)
        {
            FACT=(FACT*i)%mod;
        }
        
        rep(i,1,M+1)
        {
            FACT=(FACT*i)%mod;
        }
        
        cout<<(2*FACT)%mod;
    }
    else
    {
        lli FACT=1;
        
        rep(i,1,N+1)
        {
            FACT=(FACT*i)%mod;
        }
        
        rep(i,1,M+1)
        {
            FACT=(FACT*i)%mod;
        }
        
        cout<<FACT;
    }
    
    
    
 return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define AfterDecimal(n) cout << fixed << setprecision(n);
#define ll long long int
#define ld long double
#define all(a) a.begin(), a.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define bits(x) __builtin_popcount(x)

using namespace __gnu_pbds;
using namespace std;

// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")

//template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

#ifdef LOCAL
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << "# "<< name << " = " << arg1 << '\n';
}
template<typename Arg1, typename... Args>
void __f(const char* names, Arg1 && arg1, Args &&... args){
        const char* comma = strchr(names + 1 ,',');
        cout << "# ";
        cout.write(names, comma - names)<< " = " << arg1 << " | ";
        __f(comma + 1, args...);
}
#else
#define debug(...) 36
#endif


std::mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int ri(int a, int b) {
    return uniform_int_distribution<int>(a, b)(rng);
}

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

const ll INF = (ll)(8e18);
const ll MOD = (ll)(1e9 + 7);
const ll HMOD = (ll)4222234727;
const ll Hashprime = (ll)31;

const int maxn = 100100;

int32_t main(){
    IOS;
    #ifndef ONLINE_JUDGE
    //  freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    #endif
    int TestCases = 1; // cin >> TestCases;
    while(TestCases--){
        int k; cin >> k;
        string s = "ACL";
        string ans = "";
        for(int i = 1; i <= k; i++) ans += s;
        cout << ans << '\n';
    }
    #ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}
//g++ -DLOCAL -std=c++17 -Wshadow -Wall -o "c" "comp.cpp" -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define BM (1<<12)
#define BT (1<<19)
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll memo[BM][BM];
int A[BT],B[BT];

ll score(int s,int t)
{
	if(s==t) return s+1;
	return score((s-1)/2,(t-1)/2)*(ll) (s+1)%MOD*(ll) (t+1)%MOD;
}
int main()
{
	int n;
	scanf("%d",&n);n--;
	int b=min(6,n),block=1<<b;
	//b=2,block=1<<b;
	for(int i=0;i<1<<n;i++)
	{
		scanf("%d",&A[i]);
		A[i]--;
		//A[i]=i;
		B[A[i]]=i;
		
		int a=i+(1<<n)-1,a2=A[i]+(1<<n)-1;
		vector <int> vx,vy;
		vector <ll> vs,vt;
		ll now=1;
		while(1)
		{
			now*=a+1;
			now%=MOD;
			if(a<(1<<(n-b+1))-1)
			{
				vx.push_back(a);
				vs.push_back(now);
			}
			if(a==0) break;
			a=(a-1)/2;
		}
		now=1;
		a=a2;
		while(1)
		{
			now*=a+1;
			now%=MOD;
			if(a<(1<<(n-b+1))-1)
			{
				vy.push_back(a);
				vt.push_back(now);
			}
			if(a==0) break;
			a=(a-1)/2;
		}
		for(int i=0;i<vx.size();i++)
		{
			for(int j=0;j<vy.size();j++)
			{
				memo[vx[i]][vy[j]]+=vs[i]*vt[j]%MOD;
				if(memo[vx[i]][vy[j]]>=MOD) memo[vx[i]][vy[j]]-=MOD;
			}
		}
	}/*
	for(int i=0;i<1<<n ;i++)
	{
		for(int j=0;j<1<<n;j++) printf("%lld ",memo[i][j]);
		puts("");
	}*/
	ll ret=0,ret2=0;
	for(int i=0;i<1<<n;i++)
	{
		int r=i/block;
		int r2=A[i]/block;
		for(int j=i%block+1;j<block;j++)
		{
			int v=r*block+j;
			if(A[v]/block!=r2)
			{
				ret+=score((1<<n)-1+i,(1<<n)-1+v)*score((1<<n)-1+A[i],(1<<n)-1+A[v])%MOD;
				if(ret>=MOD) ret-=MOD;
			}
		}
		for(int j=A[i]%block+1;j<block;j++)
		{
			int v=B[r2*block+j];
			ret+=score((1<<n)-1+i,(1<<n)-1+v)*score((1<<n)-1+A[i],(1<<n)-1+A[v])%MOD;
			if(ret>=MOD) ret-=MOD;
		}
		
		if(b<n)
		{
			int a=i+(1<<n)-1,a2=A[i]+(1<<n)-1;
			vector <int> vx,vy;
			vector <ll> vs,vt;
			ll now=1;
			int bef=-1;
			while(1)
			{
				now*=a+1;
				now%=MOD;
				if(a<(1<<(n-b))-1)
				{
					int to=2*a+1;
					if(bef==to) to++;
					vx.push_back(to);
					vs.push_back(now);
				}
				if(a==0) break;
				bef=a;
				a=(a-1)/2;
			}
			now=1;
			bef=-1;
			a=a2;
			while(1)
			{
				now*=a+1;
				now%=MOD;
				if(a<(1<<(n-b))-1)
				{
					int to=2*a+1;
					if(bef==to) to++;
					vy.push_back(to);
					vt.push_back(now);
				}
				if(a==0) break;
				bef=a;
				a=(a-1)/2;
			}
			for(int j=0;j<vx.size();j++)
			{
				for(int k=0;k<vy.size();k++)
				{
					//if(memo[vx[j]][vy[k]]!=0) printf("%d : %d %d\n",i,vx[j],vy[k]);
					ret2+=vs[j]*vt[k]%MOD*memo[vx[j]][vy[k]]%MOD;
					if(ret2>=MOD) ret2-=MOD;
				}
			}
		}
	}
	if(ret2%2==1) ret2+=MOD;
	ret2/=2;	
	printf("%lld\n",(ret+ret2)%MOD);
}

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

using namespace std;

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

#define int ll

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

	if(n<600){
		cout << "8" << endl;
	}else if(n<800){
		cout << "7" << endl;
	}else if(n<1000){
		cout << "6" << endl;
	}else if(n<1200){
		cout << "5" << endl;
	}else if(n<1400){
		cout << "4" << endl;
	}else if(n<1600){
		cout << "3" << endl;
	}else if(n<1800){
		cout << "2" << endl;
	}else if(n<2000){
		cout << "1" << endl;
	}

	return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<queue>
#include<stack>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	long long sum=0;
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
		if(i%3&&i%5)sum+=i;
	cout<<sum;
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=5005;
const int inf=0x3f3f3f3f;
int n,X[max_n];
vector<int> G[max_n];
int dp[max_n];
void dfs(int u){
    vector<int> inner(X[u]+1,inf),newinner(X[u]+1,inf);
    inner[0]=0;
    for(auto v:G[u]){
        dfs(v);
        for(int i=0;i<=X[u];i++)newinner[i]=inf;
        for(int i=0;i<=X[u];i++){
            if(i+X[v]<=X[u])newinner[i+X[v]]=min(newinner[i+X[v]],inner[i]+dp[v]);
            if(i+dp[v]<=X[u])newinner[i+dp[v]]=min(newinner[i+dp[v]],inner[i]+X[v]);
        }
        for(int i=0;i<=X[u];i++)inner[i]=newinner[i];
    }
    /*
    cout<<u<<endl;
    for(int i=0;i<=X[u];i++)cout<<i<<' '<<inner[i]<<endl;
    */
    dp[u]=inf;
    for(int i=0;i<=X[u];i++)dp[u]=min(dp[u],inner[i]);
}
int main(){
    scanf("%d",&n);
    for(int i=2;i<=n;i++){
        int x;scanf("%d",&x);
        G[x].push_back(i);
    }
    for(int i=1;i<=n;i++)scanf("%d",X+i);
    dfs(1);
    //cout<<dp[1]<<endl;
    //for(int i=1;i<=n;i++)cout<<i<<' '<<dp[i]<<endl;
    if(dp[1]!=inf)printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");
    return 0;
}

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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    int val = A;
    bool flag = false;
    while (val <= A * B) {
        if (val % B == C) {
            flag = true;
            break;
        }
        val += A;
    }
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n,t,a,i,ansi;
    float ans=1<<29,temp;

    scanf("%d%d%d",&n,&t,&a);
    
    float h[n+1];
    for(i=1;i<=n;i++){
        scanf("%f",&h[i]);
    }
    
    for(i=1;i<=n;i++){
        temp=((float)t-h[i]*0.006) - (float)a;
        if(temp<0){
            temp*=-1.0;
        }
        if(temp < ans){
            ans=temp;
            ansi=i;
        }
    }

    printf("%d",ansi);
    return 0;
}

Measured memory_bytes: 128
S = input()

s1 = S[0]
index_f = (len(S)-1)/2
s2 = S[int(index_f)-1]

index_o = (len(S)+3)/2
s3 = S[int(index_o) - 1]
index_l = len(S) - 1
s4 = S[int(index_l)]

ans = 'No'

s_f = S[0:int(index_f)]
s_l = S[int(index_o) - 1:]

# print(s1)
# print(s2)
# print(s3)
# print(s4)
# print(s_f)
# print(s_l)

if (s_f == s_l) and (s1 == s2) and (s3 == s4):
    ans = 'Yes'

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD=1e9+7;
const long double Pi=acos(-1);
int main(){
  ll K,X;
  cin>>K>>X;
  if(500*K>=X){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
}

Measured memory_bytes: 256
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(lo i=1;i<=li;i++)
#define mid (start+end)/2
#define ort (bas+son)/2

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 10000005; 
const lo mod = 1000000007; 

lo n,m,cev=1,b,a[li],k,yes;
string s;
vector<lo> v;

int main(void){
	scanf("%lld %lld",&n,&m);
	FOR{
		k=i;
		int tut=0;
		while(k){
			if(k%100==0) tut++;
			else break;
			k/=100;
		}
		if(tut==n)yes++;
		if(yes==m){printf("%lld\n",i);return 0;}
	}
	//~ cev*=m;
	//~ printf("%lld\n",cev);
	return 0;
}


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

int main(){
  int X;
  cin >> X;
  int sum=0;
  int x = X;
  while(x/10 > 0){
    sum = sum + x%10;
    x = x/10;
  }
  sum = sum + x;
  if(X%sum == 0)cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main() {
	int i, j, k, f = 0, n, t, m, a, b, c, q;

	scanf("%d %d %d", &a, &b, &t);

	c = (t / a)*b;

	printf("%d",c);


	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
	int i = 0;
	vector<int> A(26, -1), B(26, -1);
	string a, b;
	cin >> a >> b;
	for (; i < a.size(); i++) {
		if(A[a[i] - 'a'] == -1)
			A[a[i] - 'a'] = b[i] - 'a';
		else if (A[a[i] - 'a'] != b[i] - 'a') {
			printf("No\n");
			break;
		}
		if(B[b[i] - 'a'] == -1)
			B[b[i] - 'a'] = a[i] - 'a';
		else if (B[b[i] - 'a'] != a[i] - 'a') {
			printf("No\n");
			break;
		}
	}
	if (i == a.size())
		printf("Yes\n");
	return 0;
}

Measured memory_bytes: 776
import Control.Monad (filterM)

main :: IO ()
main = do
    getLine
    elems <- fmap (map read . words) getLine :: IO [Int]
    getLine
    query <- fmap (map read . words) getLine :: IO [Int]
    let sums = map sum . filterM (\x -> [True, False]) $ elems
    mapM_ (\q -> putStrLn (if q `elem` sums then "yes" else "no")) query


Measured memory_bytes: 111620
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.max
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    val pList = readIntegerList()
    var ans = 0
    for (i in 1 until (n - 1)) {
        if (pList[i - 1] < pList[i] && pList[i] < pList[i + 1]
            || pList[i + 1] < pList[i] && pList[i] < pList[i - 1]) ans++
    }
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


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

typedef long long int lli;
#define FOR(i, l, r) for(i=l; i<r; i++)
#define REP(i, n) FOR(i, 0, n);

int main(){
    /*int sum = 0;
    int i;
    

    FOR(i, 1, 3){
        cout << i << endl;
       
    }
    REP(i, 3){
       cout << i << endl;
    }*/
    int N;

    cin >> N;

    string S;

    cin >> S;

    lli r, g, b;

    r = count(S.begin(), S.end(), 'R');
    g = count(S.begin(), S.end(), 'G');
    b = count(S.begin(), S.end(), 'B');

    lli i, j;
    //int count = 0;

    /*FOR(i, 0, N){
        FOR(j, i+1, N){
            if(S[i] != S[j]){
                FOR(k, j+1, N){
                    if(S[i] != S[k] && S[j] != S[k] && j-i != k-j){
                        count++;
                    }
                }
            }
            
        }
    }*/

    lli ans = r * g * b;

    FOR(i, 0, N-2){
        FOR(j, i+1, N-1){
            if(2 * j - i < N){
                if((S[i] != S[j]) && (S[j] != S[2*j - i]) && (S[i] != S[2*j - i])) ans--;;
            }
        }
    }

    /*for(i=0; i<N-2; i++){
        for(j=i+1; j<N-1; j++){
            if((S[i] != S[j]) && (S[j] != S[2*j - i]) && (S[i] != S[2*j - i])) ans--;;
        }
    }*/
    /*int ans = r * g * b;
    for(int i=0;i<N-2;i++){
        for(int j=i+1;j<N-1;j++){
            if(j+j-i<N){
                if((S[j+j-i]!=S[j])&&(S[i]!=S[j])&&(S[i]!=S[j+j-i])) ans --;
            }
        }
    }*/

    //cout << count << endl;

    

    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <iostream>
#include <stack>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <random>
#include <chrono>
using namespace std;

int X;
int k, q;
const int maxn = 1e5 + 5;
int r[maxn], t[maxn], a[maxn];

int L[maxn], R[maxn];
int L1[maxn], R1[maxn];
int f[maxn];

int main(){
    cin >> X;
    cin >> k;
    r[0] = 0;
    for(int i = 1;i <= k;i++){
        scanf("%d", &r[i]);
    }
    L[0] = 0, R[0] = X;
    L1[0] = 0, R1[0] = X;
    f[0] = 0;
    for(int i = 1;i <= k;i++){
        int nl, nr;
        int ll, rr;
        int len = r[i] - r[i - 1];
        if(i & 1){
            R1[i] = max(0, R1[i - 1] - len);
            L1[i] = max(0, L1[i - 1] - len);
            R[i] = R[i - 1] + (R1[i] - (R1[i - 1] - len));
            L[i] = L[i - 1] + (L1[i] - (L1[i - 1] - len));
            R[i] = min(X, R[i]);
            L[i] = min(X, L[i]);
            f[i] = max(0, f[i - 1] - len);
        }else{
            R1[i] = min(X, R1[i - 1] + len);
            L1[i] = min(X, L1[i - 1] + len);
            R[i] = R[i - 1] + (R1[i] - (R1[i - 1] + len));
            L[i] = L[i - 1] + (L1[i] - (L1[i - 1] + len));
            R[i] = max(0, R[i]);
            L[i] = max(0, L[i]);
            f[i] = min(X, f[i - 1] + len);
        }
        //cout << L[i] << " " << R[i] << " " << L1[i] << " " << R1[i] << " " << f[i] << endl;
    }
    cin >> q;
    for(int i = 1;i <= q;i++){
        scanf("%d%d", &t[i], &a[i]);
        int p = upper_bound(r, r + 1 + k, t[i]) - r;
        p--;
        if(a[i] <= L[p]){
            a[i] = L[p];
        }
        if(a[i] >= R[p]){
            a[i] = R[p];
        }
        int len = a[i] - L[p];
        int pp = L1[p] + len;
        int ff = f[p] + len;
        if(p & 1){
            ff = min(X, t[i] - r[p] + ff);
        }else{
            ff = max(0, ff - (t[i] - r[p]));
        }
        printf("%d\n", ff);
    }
    return 0;
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define int long long
#define F first
#define S second
using namespace std;
const int maxN = 1e5 + 13;
int n, sz[maxN], ans, mn = 1e9 + 13, e, cen;
bool f = 0;
vector<pair<int, int>> adj[maxN];
void dfs (int x, int par) {
    sz[x] = 1;
    for (auto a : adj[x]) {
	int v = a.F, w = a.S;
	if (v != par) {
	    dfs(v, x);
	    ans += 2 * min(sz[v], n - sz[v]) * w;
	    //cout << 2 * min(sz[v], n - sz[v]) * w << endl;
	    if (sz[v] == n / 2 && n % 2 == 0) {
		e = w;
		f = 1;
	    }
	    sz[x] += sz[v];
	}
    }
}

void d(int v, int p){
    sz[v] = 1;
    for(auto a : adj[v]){
	int u = a.F;
	if(u != p){
	    d(u, v);
	    sz[v] += sz[u];
	}
    }
}

void fnd_cen(int v){
    d(v, v);
    int root = v, p = -1;
    bool found = true;
    while(found){
	found = false;
	for(auto a : adj[v]){
	    int u = a.F;
	    if(u != p && sz[u] > sz[root] / 2){
		p = v;
		v = u;
		found = true;
		break;
	    }
	}
    }
    cen = v;
}

int32_t main () {
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
	int a, b, w;
	cin >> a >> b >> w;
	adj[a].push_back({b, w});
	adj[b].push_back({a, w});
    }
    dfs(1, 1);
    if (f)
	cout << ans - e << endl;
    else {
	fnd_cen(1);
	for (auto a : adj[cen])
	    mn = min(mn, a.S);
	cout << ans - mn << endl;
    }
    
}

Measured memory_bytes: 13952
import math
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
# def getIntList(): return np.array(input().split(), dtype=np.longlong)
def zeros(n): return [0]*n
# def zeros(n): return np.zeros(n, dtype=np.longlong)
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                w = cmt + ': ' + str(x)
            else:
                w = str(x)
            print(w)
        return x

def getMask(n):
    mask = 2**60
    while n & mask == 0:
        mask >>= 1
    return mask

def prob():  # WA 2
    d = Debug()
    d.off()
    N, K = getIntList()
    d.dmp((N, K), 'N, K')
    A = getIntList()
    d.dmp((A), 'A')
    if K == 0:
        x = 0
    else:
        #lg = int(math.log2(K+0.1))
        #mask = 1 << lg
        mask = getMask(K)
        x = 0
        d.dmp(x,'x')
        #mask >>= 1
        lessK = False  # x<Kか否か
        while mask > 0:
            cz, co = 0, 0
            for i in range(N):
                if A[i] & mask == 0:
                    cz += 1
                else:
                    co += 1
            if cz > co:
                if K & mask or lessK:
                    x += mask
            if (x & mask == 0) and mask & K:
                lessK = True
            mask >>= 1
            d.dmp((mask,x),'mask,x')
    d.dmp((x),'x')
    ans = 0
    for i in range(N):
        d.dmp((x ^ A[i]),'x ^ A[i]')
        ans += x ^ A[i]
    return ans


ans = prob()
print(ans)


Measured memory_bytes: 14748
#include <cstdio>
#include <iostream>

const int MAX_COL = 10;
const int MAX_ROW = 10000;
int field[MAX_COL + 1][MAX_ROW + 1];

int R,C;
void flip(int axis)
{
	for(int i=0;i<C;i++)
		field[axis][i] = -field[axis][i]+1;
}
int solve()
{
	int min_score = R*C;
	int column_sum;
	for(int i=0;i<1<<R;i++)
	{
		for(int j=0;j<R;j++)
			if((i>>j)&1) flip(j);
		int score = 0;
		for(int j=0;j<C;j++)
		{
			column_sum = 0;
			for(int k=0;k<R;k++)
				column_sum+=field[k][j];
			score += std::min(column_sum, R-column_sum);
		}
		min_score = std::min(min_score,score);
		for(int j=0;j<R;j++)
			if((i>>j)&1) flip(j);
	}
	return R*C-min_score;
}

int main()
{
	scanf("%d %d", &R, &C);
	while(C!=0 || R!=0)
	{
        for (int i = 0; i < R; i++)
            for (int j = 0; j < C; j++)
                scanf("%d", &field[i][j]);
        printf("%d\n", solve());
        scanf("%d %d", &R, &C);
    }
	return 0;
}

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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 998244353;

using mint = modint998244353;

vector<mint> aa, bb;

struct S{
	mint num; int size;
};
struct F{
	int num;
};
S e(){ return S{0, 0}; }
F id(){ return F{-1}; }
S op(S a, S b){
  	return S{a.num*aa[b.size]+b.num, a.size+b.size};
}
S mapping(F f, S s){
	if(f.num == -1) return s;
	else return S{bb[s.size] * mint(f.num), s.size};
}
F com(F f2, F f1){
	if(f2.num == -1) return f1;
	else return f2;
}

int main(){
	summon_tourist;

	int N, Q; cin >> N >> Q;
	vector<S> v(N, S{1, 1});
	aa.resize(N+10); bb.resize(N+10);
	aa[0] = 1; bb[0] = 1;
	mint iv = mint(9).inv();
	RANGE(i, 1, N+10){
		aa[i] = aa[i-1] * 10;
		bb[i] = (aa[i]-1) * iv;
	}
	lazy_segtree<S, op, e, F, mapping, com, id> seg(v);
  	// cerr << seg.all_prod().num.val() << ln;
	REP(i, Q){
		lnt L, R, D; cin >> L >> R >> D;
		L--;
		seg.apply(L, R, F{D});
		cout << seg.all_prod().num.val() << ln;
	}
}


Measured memory_bytes: 11384
#include<bits/stdc++.h>
#define MAXN 60
using namespace std;
char a[MAXN][MAXN];
int main()
{
	int h,w,i,j;
	cin>>h>>w;
	for(i=0;i<h;i++)
		for(j=0;j<w;j++)
			cin>>a[i][j];
	for(i=0;i<h;i++)
		for(j=0;j<w;j++)
		{
			bool ok=false;
			if(a[i][j]=='#')
			{
				if(i-1>=0 && a[i-1][j]=='#') ok=true;
				if(i+1<h  && a[i+1][j]=='#') ok=true;
				if(j-1>=0 && a[i][j-1]=='#') ok=true;
				if(j+1<w  && a[i][j+1]=='#') ok=true;
				if(ok==false)
				{
					cout<<"No";
					return 0;
				}
			}
		}
	cout<<"Yes";
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SZ(x) (int)(x).size()
#define ZERO(a) memset(a,0,sizeof(a))
#define dbg(x) cout<<#x<<": "<<(x)<<"\n"
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define vint vector<int>

void solve(string s, ll k) {
    int n = s.size();
    rep(i,n) {
        int dif = 26 - (s[i] - 'a');
        dif %= 26;
        //dbg(dif);
        if(k - dif >= 0) {
            s[i] = 'a';
            k -= dif;
        }
    }
    //dbg(s); dbg(k);

    s[n-1] += k%26;
    cout << s << "\n";
}

int main() {
    string s;
    ll k;
    while(cin>>s>>k) {
        solve(s,k);
    }

    return 0;
}


Measured memory_bytes: 512
N, M = map(int, input().split())
MOD = 10**9+7

def factorial(n):
    ans=1
    for i in range(1, n+1):
        ans = (ans * i) % MOD
    return ans

if N == M:
    print((2* factorial(N) ** 2) % MOD)
elif N == M + 1:
    print((factorial(M)**2*N) % MOD)
elif M == N + 1:
    print((factorial(N)**2*M) % MOD)
else:
    print(0)


Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
  int a;
  int b;
  int c;
  int tmp;

  scanf("%d %d %d",&a,&b,&c);

 if (a>b)
   {
     tmp=a;
     a=b;
     b=tmp;
   }
if (b>c)
  {
    tmp=b;
    b=c;
    c=tmp;
  }
if (a>b)
  {
    tmp=a;
    a=b;
    b=tmp;
  }

 printf("%d %d %d\n",a,b,c);

  return 0;
}

Measured memory_bytes: 596
#include<iostream>
using namespace std;
typedef long long ll;

ll m =10;

ll keta(ll n){
  for(ll i=0;i<20;i++){
    if(n<m) return i;
    m *=10;
  }
}

int main(){
  ll n;
  cin >> n;
  cout << 9*keta((n+1)-1)+(10*(n+1)/m)-1;
}

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

int main() {
    int k;
    cin >> k;
    int n_odd = (k+1)/2;
    int n_even = k/2;
    cout << n_odd * n_even << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;
const static ll MOD = 1e9+7;


int main(){
    double a, b, x; cin >> a >> b >> x;
    double rest = a*a*b - x;
    if(rest == 0.0){ cout << 0.0000000 << endl; return 0;}
    if(rest < x){
        double sq = rest / a;
        double y = (2*sq)/a;
        double deg = atan2(a, y);
        deg = (deg*180.0) / M_PI;
        cout << setprecision(10) << 90.0 - deg << endl;
        return 0;
    }
    else{
        double sq = x / a;
        //cout << sq << endl;
        double y = (2*sq) / b;
        //cout << y << endl;
        double deg = atan2(y, b);
        deg = (deg*180.0) / M_PI;
        //cout << deg << endl;
        cout << setprecision(10) << 90.0 - deg << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define ll long long 
# define skorost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 

using namespace std ;
 
ll z , o , ans ;

ll N = 1e4 + 15820 ;

int main(){ skorost ;

	int a , b , h ;

	cin >> a >> b >> h ;
	
	cout << ( a + b ) * ( h / 2 ) ;

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int,int,int,int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };

multiset<int> S;
Vi v;
int main(){
	int n;
	scanf("%d",&n);
	fup(i,1,1<<n,1)
	{
		int x;
		scanf("%d",&x);
		S.insert(-x);
	}
	v.pb(*S.begin());
	S.erase(S.begin());
	fup(i,1,n,1)
	{
		int N=v.size();
		fup(i,0,N-1,1)
		{
			auto it=S.upper_bound(v[i]);
			if(it==S.end())return !printf("No");
			v.pb(*it);
			S.erase(it);
		}
	}
	puts("Yes");
}

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

int main() {
  ll a,v;
  ll b,w;
  ll t;
  cin >> a >> v >> b >> w >> t;
  
  if(a == b){
    cout << "YES" << endl;
  }
  
  if(v <= w){
    cout << "NO" << endl;
    return(0);
  }
  
  ll dist = abs(a-b);
  ll change = abs(v-w);
  if(dist*1.0/change <= t){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  
  return(0);
}

Measured memory_bytes: 3624
n, k = map(int,input().split())

a=list(map(int,input().split()))

mod = 1000000007

need = (k * (k + 1)) // 2
need2 = ((k - 1) * k) // 2
ans = 0

freq = []
before = []
for i in range(0, 3000):
	freq.append(0)
	before.append(0)
	

for i in range(0, n):
	for j in range(i + 1, n):
		if(a[i] > a[j]):
			freq[i] += 1
			
	j = i - 1
	while j >= 0:
		if(a[i] > a[j]):
			before[i] += 1
		j -= 1
		
	ans += (freq[i] * need)
	ans += (before[i] * need2)

#print(ans)
print(ans % mod)

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

int main() {
    
    string s;

    cin >> s;

    if(s[0] == 'R' && s[1] == 'S' && s[2] == 'R'){
    	cout << "1";
    } else if(s[0] == 'S' && s[1] == 'R' && s[2] == 'S'){
    	cout << "1";
    } else if(s[0] == 'R' && s[1] == 'S' && s[2] == 'S'){
    	cout << "1";
    } else if(s[0] == 'S' && s[1] == 'S' && s[2] == 'R'){
    	cout << "1";
    } else if(s[0] == 'S' && s[1] == 'S' && s[2] == 'S'){
    	cout << "0";
    } else if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R'){
    	cout << "3";
    } else{
		cout << "2";
	}    

    return 0;
}



Measured memory_bytes: 3616
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <random>

using ll = long long;

//各種nil
template <class T>
constexpr T nil = static_cast<T>(-1);

constexpr int nil_i = nil<int>;
constexpr int nil_ll = nil<ll>;
constexpr double nil_d = nil<double>;

//vector
template <class T>
using vec = std::vector<T>;

struct Vec2D
{
    int x, y;
};

struct TimePos
{
    int time;
    Vec2D pos;
};

int ManhattanDistance(Vec2D v1, Vec2D v2)
{
    using namespace std;
    return abs(v1.x - v2.x) + abs(v1.y - v2.y);
}

void solve()
{
    using namespace std;
    string s, t;
    cin >> s >> t;

    sort(s.begin(), s.end());
    sort(make_reverse_iterator(t.end()), make_reverse_iterator(t.begin()));

    if (s.compare(t) < 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
  
int main(){
	vector<pair<int,pair<int,int>>> vx,vy;
	int i=0,r=0,n,x1,y1,x2,y2;
	for(scanf("%d",&n);i<n;i++){
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		if(x1>x2)swap(x1,x2);
		if(y1>y2)swap(y1,y2);
		if(x1==x2)vy.emplace_back(make_pair(x1,make_pair(y1,y2)));
		else vx.emplace_back(make_pair(y1,make_pair(x1,x2)));
	}
	//sort(vx.begin(),vx.end());
	sort(vy.begin(),vy.end());
	for(auto &e:vx){
		auto it1=lower_bound(vy.begin(),vy.end(),make_pair(e.second.first,make_pair(-2000000000,-2000000000)));
		auto it2=lower_bound(vy.begin(),vy.end(),make_pair(e.second.second+1,make_pair(-2000000000,-2000000000)));
		
		for(;it1!=it2;++it1){
			auto &f=*it1;
			if(f.second.first<=e.first&&e.first<=f.second.second)r++;
		}
	}
	printf("%d\n",r);
}

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

int a, b;

int main() {
	cin >> a >> b;
	if(a == 1) a = 100;
	if(b == 1) b = 100;
	if(a == b) cout << "Draw" << endl;
	else cout << ((a > b)? "Alice":"Bob") << endl;
	return 0;
}

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

const int N = 300010;
const int moder = int(1e9) + 7;

char s[N];
int dp[N][2][3][3];
// odd, num, state

void add(int &a, int b){
    a += b;
    a -= a >= moder ? moder : 0;
}

int main(){
    scanf("%s", s);
    int n = strlen(s);
    dp[0][0][0][0] = 1;
    for (int i = 0; i < n; ++ i){
        for (int s1 = 0; s1 < 2; ++ s1){
            for (int s2 = 0; s2 < 3; ++ s2){
                for (int s3 = 0; s3 < 3; ++ s3){
                    for (int j = 0; j < 2; ++ j){
                        if (s[i] != '?' && '0' + j != s[i]){
                            continue;
                        }
                        if (j == 0){
                            int ns1 = s1;
                            int ns2 = s2 + 1;
                            ns2 -= ns2 > 2 ? 2 : 0;
                            int ns3 = s3;
                            add(dp[i + 1][ns1][ns2][ns3], dp[i][s1][s2][s3]);
                        }
                        if (j == 1){
                            int ns1, ns2 = 0, ns3 = s3;
                            if (s2 == 0){
                                if (s1 == 0 && ns3 == 0){
                                    ns3 = 1;
                                }
                                if (s1 == 1 && ns3 == 1){
                                    ns3 = 2;
                                }
                                ns1 = s1 ^ 1;
                            }
                            else if (s2 == 1){
                                ns1 = s1;
                            }
                            else if (s2 == 2){
                                ns1 = s1 ^ 1;
                            }
                            add(dp[i + 1][ns1][ns2][ns3], dp[i][s1][s2][s3]);
                        }
                    }
                }
            }
        }
    }
    int ans = 0;
    for (int s1 = 0; s1 < 2; ++ s1){
        for (int s2 = 0; s2 < 3; ++ s2){
            for (int s3 = 0; s3 < 3; ++ s3){
                int ns3 = s3;
                if (s2 == 0){
                    if (s1 == 0 && ns3 == 0){
                        ns3 = 1;
                    }
                    if (s1 == 1 && ns3 == 1){
                        ns3 = 2;
                    }
                }
                if (ns3 == 2){
                    add(ans, dp[n][s1][s2][s3]);
                }
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 25216
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <functional>
#include <sys/timeb.h>
#include <fstream>

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 reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int a, b;
	cin >> a >> b;

	if (a == b) {
		cout << "Draw" << endl;
	}
	else if (a == 1) {
		cout << "Alice" << endl;
	}
	else if (b == 1) {
		cout << "Bob" << endl;
	}
	else if (a > b) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Bob" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
local n, k, s = io.read("*n", "*n", "*n")
local t = {}
if s < 1000000000 then
  for i = 1, k do
    t[i] = s
  end
  for i = k + 1, n do
    t[i] = s + 1
  end
else
  for i = 1, k do
    t[i] = s
  end
  for i = k + 1, n do
    t[i] = s - 1
  end
end
print(table.concat(t, " "))


Measured memory_bytes: 5744
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// leave to tomorrow anything that can be done today
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    ll acum=1;
    ll maxi = 1e18;
    bool can=1;
    rep(i,0,n){
        ll a;
        cin>>a;
        if(a==0){
            can=1;
            acum=0;
        }
        else if(acum==0 || maxi/acum>=a)acum*=a;
        else can=0;
    }
    if(can || acum==0)cout<<acum<<"\n";
    else cout<<"-1\n";
    return 0;   
}   

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
using namespace std;
int main() {
	int a, b;
	vector<int> nums(5, 0);
	for (int i = 0; i < 3; ++i) {
		cin >> a >> b;
		++nums[a];
		++nums[b];
		if (nums[a] == 3 || nums[b] == 3) {
			cout << "NO";
			return 0;
		}
	}
    cout << "YES";
    return 0;
}

Measured memory_bytes: 256