akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#define mp make_pair
#define FOR(i, a, b) for (int(i) = a; (i) <= (b); ++(i))
#define rep(i, n) FOR(i, 0, n-1 )
#define FFOR(i, a, b) for (int(i) = a; (i) > (b); --(i))
#define rrep(i, n) FFOR(i, 0, n)
#define vsort(v) sort((v).begin(), (v).end());           //小さい順
#define rvsort(v) sort(v.begin(), v.end(), greater<>()); //大きい順
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define all(c) (c).begin(), (c).end()
#define ll long long
#define lb long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout << (p) << endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 123456789012345
#define int ll
typedef pair<int, int> P;
typedef pair<int, P> PP;

const int maxn = 1e5 + 10;

signed main() {

  int n;cin>>n;

  rep(i,101)rep(j,101) if(4*i+7*j==n)
  {
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << endl;
 
}


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

using namespace std;
typedef long long ll;

int a[1000100];
int z[1000100];
int main(){
    int N;
    cin >> N;
    for(int i=1; i < N+1; i++)cin >> a[i];

    for(int i=N; i > 0; i--){
        int c = 0;
        for(int j=i*2; j < N+1; j+=i){
            c += z[j];
        }
        if(c % 2 != a[i])z[i] = 1;
    }
    int M = 0;
    vector<int> ans;
    for(int i=1; i < N + 1; i++){
        if(z[i]){
            M++;
            ans.push_back(i);
        }
    }

    cout << M << endl;
    if(M == 0)return 0;
    for(int i=0; i < M - 1; i++){
        cout << ans[i] << " ";
    }
    cout << ans[M-1] << endl;
}


Measured memory_bytes: 6392
// -*- coding:utf-8-unix -*-

use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        h: usize,
        w: usize,
        a: [Chars; h],
    }

    let mut tail = 0;
    let mut sharp_appeared = false;
    let mut dot_after_sharp = false;
    for i in 0..w {
        if a[0][i] == '#' {
            if dot_after_sharp {
                // like "##.#"
                println!("Impossible");
                return;
            }

            sharp_appeared = true;
            tail = tail.max(i as u32);
        } else {
            if sharp_appeared {
                dot_after_sharp = true;
            }
        }
    }

    for i in 1..h {
        let mut current_tail = 0;
        let mut sharp_appeared = false;
        dot_after_sharp = false;
        for j in 0..w {
            if a[i][j] == '#' {
                if (j as u32) < tail || dot_after_sharp {
                    println!("Impossible");
                    return;
                }

                sharp_appeared = true;
                current_tail = current_tail.max(j as u32);
            } else {
                if sharp_appeared {
                    dot_after_sharp = true;
                }
            }
        }
        tail = current_tail;
    }
    println!("Possible");
}


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

int main() {

    int K;
    string S;
    cin>>K>>S;

    int l=S.size();

    if(l<=K){

        cout<<S<<endl;
    }

    else {

        cout<<S.substr(0,K)<<"..."<<endl;
    }


}

Measured memory_bytes: 3628
import numpy as np

def judge_prime(num):
    FLAG = True
    
    for i in range(2, int(np.sqrt(num))+1):
        if (num%i == 0):
            FLAG = False
    
    if (num == 2):
        FLAG = True
    
    return(FLAG)

X = int(input())

while (True):
    flag = judge_prime(X)
    
    if (flag):
        break
    
    X += 1

print(X)

Measured memory_bytes: 13232
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

/**
 * Created by zhangrunfeng on 2/21/20
 */
public class Main {
    private int N;
    private int[][] G;

    private int[] distance;

    public Main(Scanner sc) {
        N = sc.nextInt();
        G = new int[N][];
        for (int i = 0; i < N; i++) {
            G[i] = new int[N];
        }
        for (int i = 0; i < N; i++) {
            int u = sc.nextInt() - 1;
            int adjNum = sc.nextInt();
            for (int j = 0; j < adjNum; j++) {
                int v = sc.nextInt() - 1;
                G[u][v] = 1;
            }
        }

        distance = new int[N];
        Arrays.fill(distance, -1);
    }

    public void bfs(int node) {
        Queue<Integer> que = new LinkedList<>();
        que.offer(node);
        distance[node] = 0;

        while (!que.isEmpty()) {
            int currNode = que.poll();
            for (int i = 0; i < N; i++) {
                if (distance[i] < 0 && G[currNode][i] == 1) {
                    que.offer(i);
                    distance[i] = distance[currNode] + 1;
                }
            }
        }
    }

    public void print() {
        for (int i = 0; i < N; i++) {
            System.out.println(i+1 + " " + distance[i]);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.bfs(0);
        m.print();
    }
}


Measured memory_bytes: 28436
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    vector<long long> inVec;

    long long N, K;
    cin >> N >> K;
    long long l;
    for (long long i = 0; i < N; i++)
    {
        cin >> l;
        inVec.push_back(l);
    }

    sort(inVec.begin(), inVec.end());

    long long ans = 0;
    for (long long i = 1; i <= K; i++)
    {
        ans += inVec[N - i];
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0 ,n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;


signed main(){
    int n, m;
    while(1){
        cin >> n >> m;
        if(n + m == 0) break;
        int a[101][101] = {0};
        int d[4][51][51] = {0};
        REP(i, n){
            REP(j, n){
                cin >> a[i][j];
            }
        }
        REP(i, m){
            REP(j, m){
                cin >> d[0][i][j];
            }
        }
        rep(k, 1, 4){
            REP(i, m){
                REP(j, m){
                    d[k][i][j] = d[k - 1][j][m - 1 - i];
                }
            }
        }
        // rep(k, 0 ,4){
        //     rep(i, 0, m){
        //         rep(j, 0, m){
        //             cout << d[k][i][j] << ' ';
        //         }
        //         cout << endl;
        //     }
        //     cout << endl;
        // }
        vector<pair<int, int> > ans;
        int x = -1, y = -1;
        REP(i, n - m + 1) REP(j, n - m + 1){
            REP(k, 4){
                bool f = false;
                REP(p, m) REP(q, m){
                    if(!(d[k][p][q] == a[i + p][j + q] || d[k][p][q] == -1)){
                        p = m; q = m; break;
                    }
                    if(!f && d[k][p][q] != -1){
                        f = true; y = i + p + 1; x = j + q + 1;
                    }
                    if(p == m - 1 && q == m - 1){
                        ans. push_back(make_pair(y, x));
                    }
                }
            }
        }
        sort(all(ans));
        if(ans.size() == 0) cout << "NA" << endl;
        else cout << ans[0]. second << ' ' << ans[0]. first << endl;
    }
}

Measured memory_bytes: 1620
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
using u8t = std::uint64_t;
using i8t = std::int64_t;
#define F(I,N) for(i8t I=0,I##_N=N;I<I##_N;I++)
#define FR(I,N) for(i8t I=N;I--;)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(_i,N){R(_x)V.push_back(_x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL1(line)
#define RM(V,L,C) std::vector<char> V;F(_i,L){RL(_l)F(_j,C)V.push_back(_l[_j]);}
#define P(X) std::cout<<(X)<<std::endl;
int main() {
  R(N)RV(A,N);
  std::unordered_map<u8t,u8t> L,R;

  F(I,N){
    u8t index=I+1;
    {
      u8t a = index+A[I];
      auto it=L.find(a);
      if (it==L.end())L[a]=1;else L[a]++;
    }

    {
      i8t b = index-A[I];
      if(b>0){
        auto it=R.find(b);
        if (it==R.end())R[b]=1;else R[b]++;
      }
    }
  }
  // for(auto [k,c]:R){
  //   std::cout<<"R:"<<k<<","<<c<<std::endl;
  // }

  u8t count=0;
  for(auto [k,c]:L){
    //std::cout<<"L:"<<k<<","<<c<<std::endl;
    auto it=R.find(k);
    if(it!=R.end()){
      count+=c*R[k];
    }
  }
  P(count);
  return 0;
}


Measured memory_bytes: 18488
//bool comp(const pii &a, const pii &b){
//    if(a.X != b.X)
//        return a.X < b.X;
//    return a.Y > b.Y;
//}
//void _(){
//    int n,m;
//    cin >> n >> m;
//    vpii arr(n);
//    cin >> arr;
//    sort(all(arr),comp);
//    vi other;
//    int l = 0;
//    while(l < n && arr[l].X == 0){
//        other.pb(arr[l].Y);
//        ++l;
//    }
//    priority_queue<int,vector<int>,greater<int>> pq;
//    rep(coord,1,m){
//        while(l < n && arr[l].X <= coord){
//            pq.push(arr[l].Y);
//            ++l;
//        }
//        while(sz(pq) > coord){
//            other.pb(pq.top());
//            pq.pop();
//        }
//    }
//    int ans = n-sz(pq);
//    int r = 0;
//    sort(rall(other));
//    for(int i = m; i >= 1; --i){
//        while(r < sz(other) && other[r] > i){
//            ++r;
//        }
//        if(r < sz(other)){
//            --ans;
//            ++r;
//        }
//    }
//    ans = max(ans,n-m);
//    print(ans);
//}
//
#include <iomanip>
#include <algorithm>
#include <queue>
#include <cassert>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define pb push_back
#define REP_INT(i,l,r) for(int i = l; i <= r; ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) ll(v.size())
#define X first
#define Y second
#define T1 template<typename T> static
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
template <typename F, typename S> static
istream& operator>>(istream& stream, pair<F, S>& t){
    return stream >> t.first >> t.second;
}
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
T1 istream& operator>>(istream& stream, vector<T>& t){
    return read(all(t), stream);
}
T1 istream& read(T b, T e, istream& stream){
    for(T it = b; it != e; ++it)
        stream >> *it;
    return stream;
}
T1 void print(T x, string end = "\n"){
    cout << x << end;
}
bool comp(const pii &a, const pii &b){
    if(a.X != b.X)
        return a.X < b.X;
    return a.Y > b.Y;
}
void _(){
    int n,m;
    cin >> n >> m;
    vpii arr(n);
    cin >> arr;
    sort(all(arr),comp);
    vi other;
    int l = 0;
    while(l < n && arr[l].X == 0){
        other.pb(arr[l].Y);
        ++l;
    }
    priority_queue<int,vector<int>,greater<int>> pq;
    rep(coord,1,m){
        while(l < n && arr[l].X <= coord){
            pq.push(arr[l].Y);
            ++l;
        }
        while(sz(pq) > coord){
            other.pb(pq.top());
            pq.pop();
        }
    }
    int ans = n-sz(pq);
    int r = 0;
    sort(rall(other));
    for(int i = m; i >= 1; --i){
        while(r < sz(other) && other[r] > i){
            ++r;
        }
        if(r < sz(other)){
            --ans;
            ++r;
        }
    }
    ans = max(ans,n-m);
    print(ans);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        _();
}


Measured memory_bytes: 3320
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;

typedef long long ll;

inline ll read()
{
	ll x=0;char ch=getchar();
	while(ch<'0' || '9'<ch)ch=getchar();
	while('0'<=ch && ch<='9')x=x*10+(ch^48),ch=getchar();
	return x;
}

const int N=1e5+9;
ll n,a[N],b[N];

int main()
{
	n=read();
	for(int i=1;i<=n;i++)
		a[i]=read(),b[i]=read();

	ll cnt=0;
	for(int i=n;i>=1;i--)
	{
		a[i]+=cnt;
		if(a[i]%b[i]==0)
			continue;
		cnt+=(a[i]/b[i]+1)*b[i]-a[i];
	}

	printf("%lld\n",cnt);
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z main.cpp
//.\a.exe





int s(int n){
	int sum=0;
	while(n!=0){
		sum+=n%10; 
		n=n/10;
	}
	return sum;
}

int main(void){ios::sync_with_stdio(false);cin.tie(0);
///////////////////////////////////////////////////////
int a,b,n=1050;
cin >> a >> b;
int v[n];
for(int i=0;i<n;i++){
	
	v[i] = i*(i+1)/2;
}

for(int i=0;i<n-1;i++){
	if(v[i]-a==v[i+1]-b){
		cout << v[i]-a << endl;
	}
}
///////////////////////////////////////////////////////
return 0;}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


int main() {
    li a, b;
    cin >> a >> b;
    cout << (b % a == 0 ? a + b : b - a) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B && B == C) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    v,e = map(int,input().split())
    E = [[] for _ in range(v)]
    for _ in range(e):
        s,t = map(int,input().split())
        E[s].append(t)

    res = False
    visited = [False]*v
    checked = [False]*v
    def dfs(u):
        if visited[u]:
            nonlocal res
            res = True
            return
        visited[u] = True
        for nu in E[u]:
            if not checked[nu]:dfs(nu)
        visited[u] = False
        checked[u] = True

    for i in range(v):
        for j in range(v):visited[j] = False
        if not checked[i]:dfs(i)
    print (1 if res else 0)


if __name__ == '__main__':
    main()




Measured memory_bytes: 5620
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define F first
# define S second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define pr(x) prev(x.end())
# define mset multiset
# define umap unordered_map
# define gcd __gcd
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)
# define lr(i,l,r) for(int i=l;(l>r?i>=r:i<=r);(l>r?--i:++i))

using namespace std;

template<class T> void umin(T &a,T b){a=min(a,b);}
template<class T> void umax(T &a,T b){a=max(a,b);}

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int mod = 1e9+7;//998244353
const int N = 1e5+5;



void solve(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a<=b*c)cout<<"Yes";
	else cout<<"No";
}

int main(){
	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)
		solve();
	return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/

Measured memory_bytes: 3644
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        string S = cin.next();
        char[] cs = S.ToCharArray();
        if (S.Length % 2 == 1)
        {
            Console.WriteLine("No");
            return;
        }
        Array.Sort(cs);
        for (int i = 0; i < S.Length; i += 2)
        {
            if (cs[i] != cs[i + 1])
            {
                Console.WriteLine("No");
                return;
            }
        }
        Console.WriteLine("Yes");
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11604
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

#define INF 1e9
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

int gcd(int a, int b) {
    if(a % b == 0) {
        return b;
    }
    else {
        return(gcd(b, a % b));
    }
}


int main() {
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    rep(i, n) cin >> s.at(i);
    sort(s.begin(), s.end());
    string ans;
    rep(i, n) {
        rep(j, l) {
            ans.push_back(s.at(i).at(j));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

int const N = 1000010;
int ans[N];

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

int main(int argc, char ** argv) {
    ans[0] = ans[1] = 0;
    for (int i = 2; i < N; ++i) {
        if (isprime(i)) ans[i] = ans[i - 1] + 1;
        else ans[i] = ans[i - 1];
    }
    int n;
    while (~scanf("%d\n", &n)){
        printf("%d\n",ans[n]);
    }
}

Measured memory_bytes: 5080
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n%1000==0) {
			System.out.println("0");
		}
		else {
			int y = n%1000;
			System.out.println(1000-y);
		}
	}

}

Measured memory_bytes: 35620
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
using namespace std;
int main(){
    int N,K; cin >> N >> K;
    string S; cin >> S;
    int now = 0;
    rep(i,N-1){
        if(S[i] == S[i+1]) now++;
    }

    int opt = N-1;
    int re = now + 2*K;
    int ans = min(opt,re);
    cout << ans <<endl;
}

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

#define fr(i, a, b) for(int i = (a); i <= (b); i++)
#define rf(i, a, b) for(int i = (a); i >= (b); i--)
#define fe(x, y) for(auto& x : y)

#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define pw(x) (1LL << (x))
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename T>
using ve = vector<T>;

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define fbo find_by_order
#define ook order_of_key

mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T>
bool umn(T& a, T b) { return a > b ? a = b, 1 : 0; }
template<typename T>
bool umx(T& a, T b) { return a < b ? a = b, 1 : 0; }

ve<string> verd = {"AC", "WA", "TLE", "RE"};

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
#endif
 
    int n;
    cin >> n;

    ve<int> cnt(4);
    fr(i, 0, n - 1) {
        string s;
        cin >> s;
        fr(j, 0, 3) {
            if(s == verd[j]) {
                cnt[j]++;
            }
        }
    }

    fr(i, 0, 3) {
        cout << verd[i] << " x " << cnt[i] << "\n";
    }

    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;
ll cnt0[MAX],cnt1[MAX];
bool used[MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;cin>>S;
    int N=si(S);
    for(int i=1;i<=N;i++){
        if(S[i-1]=='0') cnt0[i]=1;
        else cnt1[i]=1;
        
        cnt0[i]+=cnt0[i-1];
        cnt1[i]+=cnt1[i-1];
    }
    
    ll ans=0;
    
    ans+=(1+cnt1[N]/2)*(cnt1[N]/2);
    
    if(cnt1[N]&1) ans+=(cnt1[N]+1)/2;
    
    ll cnt=0;
    
    for(int i=1;i<=N;i++){
        if(S[i-1]=='0'){
            if((cnt1[i]+cnt)&1){
                if((cnt1[N]-cnt1[i])&1){
                    ans+=(cnt1[N]-cnt1[i]+1)/2;
                    cnt++;
                }else{
                    ans+=(cnt1[N]-cnt1[i])/2;
                    cnt++;
                }
                
                used[i]=1;
            }
        }
    }
    
    string T;
    vector<int> id;
    
    ll p=0;
    
    for(int i=1;i<=N;i++){
        if(S[i-1]=='1'){
            T+='1';
            id.push_back(i);
            if(si(id)&1) p++;
        }
        if(S[i-1]=='0'&&used[i]){
            T+='0';
            id.push_back(i);
            
            ans+=p;
        }
    }
    
    memset(cnt0,0,sizeof(cnt0));
    
    for(int i=1;i<=N;i++){
        if(S[i-1]=='0'&&(!used[i])) cnt0[i]=1;
        
        cnt0[i]+=cnt0[i-1];
    }
    
    for(int i=0;i<si(T);i++){
        if(T[i]=='1'){
            if(!(i&1)) ans+=cnt0[N]-cnt0[id[i]];
            
            if(i&1) ans+=(cnt0[id[i]]+1)/2;
            else ans+=(cnt0[id[i]])/2;
        }
    }
    
    cout<<ans<<endl;
    
}



Measured memory_bytes: 8124
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int n, k;
    cin>>n;
    k = 2;
    int a[n];
    int dp[n];
    f(i, n) cin>>a[i], dp[i] = INT_MAX;
    dp[0] = 0;
    for(int i = 1; i < n; i++){
        for(int j = i - 1; j >= max(i - k, 0); j--) dp[i] = min(dp[i], dp[j] + abs(a[j] - a[i]));
    }
    cout<<dp[n - 1];
    return 0;
}

Measured memory_bytes: 1024
N, X = list(map(int, input().split()))
nums = list(map(int, input().split()))
cnt = 1
ans = 0

# nn = [0]
# for i in range(1, N):
#     nn.append(nn[i - 1] + nums[i])
    
for i in range(N):
    ans += nums[i]
    if ans <= X:
        cnt += 1
        

print(cnt)


Measured memory_bytes: 2940
#include <cstdio>
#include <cmath>

#define FOR( i, l, r) for(int i = (l)    ; i <  (r); i++)
#define FOR1(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define REV( i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define REV1(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define INC( i, n) FOR( i, 0, n)
#define INC1(i, n) FOR1(i, 1, n)
#define DEC( i, n) REV( i, 0, n)
#define DEC1(i, n) REV1(i, 1, n)

typedef long long   signed int LL;
typedef long long unsigned int LU;

template<typename T> void swap(T &x, T &y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T &a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T &a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int h, w;
char c[300][301];

int a[301][301];
int b[302][302];
int ans;

int main() {
	scanf("%d%d", &h, &w);
	INC(i, h) { scanf("%s", c[i]); }
	
	INC(i, w - 1) {
		DEC(j, h + 1) {
		DEC(k, h + 1) {
			if(j == h || k == h) { a[j][k] = 0; }
			else {
				a[j][k] = a[j + 1][k + 1] + (c[h - 1 - j][i] == c[h - 1 - k][i + 1]);
			}
		}
		}
		
		INC(j, h + 1) {
		INC(k, h + 1) {
			b[j][k] = 1000000;
		}
		}
		
		b[0][0] = 0;
		
		INC(j, h + 1) {
		INC(k, h + 1) {
			setmin(b[j + 1][k], b[j][k] + a[j][k]);
			setmin(b[j][k + 1], b[j][k] + a[j][k]);
		}
		}
		
		ans += b[h][h];
	}
	
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// using cd = complex<double>;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
typedef long long int ll;
typedef long double ld;
const ll N = 1e6;
// const ll m = 1e9 + 7;
const ll inf= 1e14;
const ll mod =1e9+7;
const double PI = acos(-1);
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define pld pair<ld,ld>
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }
void pr(ll x){
    bitset<26> a = x;
    cout<<a<<" "<<x<<'\n';
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt","w",stderr); 
    #endif
    ll t = 1;
    // cin>>t;
    while(t--){

        string s;cin>>s;
        map<ll,ll> dp;
        ll n = s.size();
        ll ct[26],dp1[n];
        memset(ct,0,sizeof(ct));

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

            dp1[i] = inf;
            ct[s[i]-'a']++;
            ll thi = 0;
            ll no_on = 0;
            for(int i = 0;i<26;i++){
                thi+=(ct[i]%2)<<i;
                no_on+=(ct[i]%2);
            }

            // pr(thi);
            if(no_on<2){
                dp[thi] = 1;
                dp1[i] = 1;
            }
            else{
                if(dp[thi]!=0){
                    dp1[i] = dp[thi]+1;
                }

                for(int j = 0;j<26;j++){
                    ll nv = thi^(1ll<<j);
                    // pr(nv);
                    // cout<<dp[nv]<<" "<<dp1[i]<<" ";
                    if(dp[nv]!=0){
                        dp1[i]=min(dp1[i],dp[nv]+1);
                    }
                    // cout<<dp1[i]<<'\n';
                }
            }
            if(dp[thi]==0){
                dp[thi] = dp1[i];
            }
            dp[thi] = min(dp[thi],dp1[i]);

            // cout<<'\n';

        }
        cout<<dp1[n-1]<<'\n';
    }
        
}

Measured memory_bytes: 276888
#include<stdio.h>
int main()
{
    int i,j,n,k,l[51],store,sum=0;
    scanf("%d%d",&n,&k);
    for(i=0;i<n;i++)
    {
        scanf("%d",&l[i]);
    }
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            if(l[i]>l[j])
            {
                store=l[i];
                l[i]=l[j];
                l[j]=store;
            }
        }
    }
    for(i=n-k;i<n;i++)
    {
        sum=sum+l[i];
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <set>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <vector>
#include <string>
#include <map>
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
//#define rep(i, n) for(int (i) = 0, TmP = (n); (i) < (int)TmP ; ++(i))
#define asort(v, n) sort((v), (v + n)) //Using array
#define vsort(v) sort((v).begin(), (v).end()) // Using vector
#define vint vector<int>
typedef long long ll;

using namespace std;

signed main(){
  long double l;
  cin >> l;
  cout << fixed << setprecision(8) << l * l * l / 27 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string s;
  cin >> s;
  if(s[0] == s[1] && s[0] == s[2])
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

int N, K;
bool dp[200005];
int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);

    cin >> N >> K;
    vector<int> A(N);
    REP(i, N) cin >> A.at(i);

    REP(i, K) {
        REP(j, N) {
            if (!dp[i]) dp[i + A[j]] = true;
        }
    }
    if (dp[K]) {
        cout << "First" << endl;
    } else {
        cout << "Second" << endl;
    }

    return 0;
}


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

int main(){

  int A,B;
  int i = 1;
  
  cin >> A >> B;
  while(i * 0.08 <= A + 1 || i * 0.1 <= B + 1){
    if((int)(i*0.08) == A && (int)(i*0.1) == B ){
      cout << i <<endl;
      return 0;
    }
    ++i;
  }

  cout  <<-1 << endl;
  
  
  }



Measured memory_bytes: 256
/*****************************************************
 *     created by: nayakashutosh9
 * "Winners Never Quit and Quitters Never Win".
*****************************************************/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define endl '\n'
#define mod 1000000007
#define inf 1e18
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
const int N = 300005;
/**********************************************************************************************/
const int M = 2019;
int f[M];
void solve() {
	string s; cin >> s;
	memset(f, 0, sizeof(f));
	f[0] = 1;
	int cur = 1, val = 0, ans = 0;
	for (int i = s.length() - 1; i >= 0; i--) {
		val = (val + cur * (s[i] - '0')) % M;
		cur = cur * 10 % M;
		ans += f[val];
		f[val]++;
	}
	cout << ans << endl;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int t = 1, z = 1;
	// cin >> t; cin.ignore();
	while (t--) {
		// cout << "Case #" << (z++) << ": ";
		// clock_t start = clock();
		solve();
		// clock_t end = clock();
		// cout << (end-start) << endl;
		//print execution time in ms
	}

	return 0;
}

Measured memory_bytes: 3616
import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int,input().split()))
while True:
    if A.count(0) == n - 1:
        print(max(A))
        exit()
    else:
        B = [ _  for _ in A if _ != 0  ]
        attack = min(B)
        sn = A.index(attack)
        
        for i in range(n):
            if A[i] == 0:
                pass
            else:
                if i != sn:
                    A[i] = A[i] % attack
                else:
                    pass


Measured memory_bytes: 14252
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int k = sc.nextInt();
      long[][] cood = new long[n][2];
      for(int i = 0; i < n; i++) {
        cood[i][0] = sc.nextInt();
        cood[i][1] = sc.nextInt();
      }

      long maxArea = Long.MAX_VALUE;
      int cnt = 0;

      for(long[] a : cood) {
        for(long[] b : cood) {
          for(long[] c : cood) {
            for(long[] d: cood) {
              cnt = 0;
              long leftX = Math.min(Math.min(a[0], b[0]), Math.min(c[0], d[0])), 
                  rightX = Math.max(Math.max(a[0], b[0]), Math.max(c[0], d[0]));
              long downY = Math.min(Math.min(a[1], b[1]), Math.min(c[1], d[1])), 
                  upY = Math.max(Math.max(a[1], b[1]), Math.max(c[1], d[1]));
              for(long[] p : cood) {
                if(leftX <= p[0] && p[0] <= rightX &&
                  downY <= p[1] && p[1] <= upY
                ) cnt++;
              }
             // System.out.println(rightX + "," + leftX + " - " + upY + "," + downY);
              if(cnt >= k) {
                  
                maxArea = Math.min(maxArea, (rightX - leftX) * (upY - downY));
              }
            }
          }
        }
      }
      System.out.println(maxArea);
  }
}

Measured memory_bytes: 24408
n = int(input())
p = list(range(n+2))

for i in range(1,n+1):
    p[i], p[n+1] = map(int, input().split())

# table[i][j] : M_i??????M_j??????????????????????°?????????°
table = [[0] * (n+1) for i in range(n+1)]

# ??£????????£???2????????????????????????
for i in range(1,n):  # 1<=i,i+1<=n
    table[i][i+1] = p[i]*p[i+1]*p[i+2]


for k in range(3, n+1):    # ?????????k???????????????????????????3<=k<=n
    for i in range(1,n+2-k): # M_i?????????1<=i<=n-k+1
        j = i + k - 1      # M_j?????§???k??????

        table[i][j] = float('inf')

        for x in range(i, j): # M_i~M_x??¨M_(x+1)~M_j??§????????????(i<=x,x+1<=j<=n)
            # print(i, x, j)
            cost = table[i][x] + table[x+1][j] + p[i]*p[x+1]*p[j+1]
            table[i][j] = min(table[i][j], cost)
            

print(table[1][n])

Measured memory_bytes: 7828
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b;
  cin >> a >> b;
  if(a<=8&&b<=8) cout<<"Yay!"<<endl;
  else cout<<":("<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int N;
	cin >> N;
	vector <double> p(N, 0.0);
	for (int ii = 0; ii < N; ++ii){
		cin >> p[ii];
	}

	vector<vector<double>> prob(N+2, vector <double> (N+2, 0.0));

	prob[0][1] = 1.0;
	for (int ii = 0; ii <= N; ++ii){
		for (int jj = 0; jj <= N; ++jj){
			prob[ii+1][jj+1] = prob[ii][jj] * p[ii] + prob[ii][jj+1] * (1-p[ii]);
		}
	}

	double ans = 0;
	for (int jj = N/2 + 2; jj <= N+1; ++jj){
		ans += prob[N][jj];
	}

	cout << fixed << setprecision(12) << ans << "\n";

	return 0;
}


Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
#define int long
main(){
  string s,t;
  cin>>s>>t;
  vector<int> res(t.size(),0);
  int w=0;
  map<char,vector<int>> dic;
  for(int i=0;i<s.size();++i)dic[s[i]].push_back(i+1);
  for(int i=0;i<t.size();++i){
    vector<int>& v=dic[t[i]];
    if(v.empty())cout<<-1,exit(0);
    if(!i)res[i]=v[0];
    else{
      auto itr = upper_bound(v.begin(),v.end(),res[i-1]);
      if(itr==v.end())res[i]=v[0];
      else res[i]=*itr;
    }
  }
  for(int i=1;i<t.size();++i)if(res[i-1]>=res[i])w++;
  cout<<w*s.size()+*(res.end()-1);
}

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

int main(void){
  int n;
  cin>>n;
  int sum=1;
  int minus=1;
  int a;
  for(int i=0;i<n;i++){
    cin>>a;
    if(a%2==0) minus=minus*2;
    sum=sum*3;
  }
  cout<<sum-minus<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int D = 60; // 2の60乗まででダブリングの表が足りるので60．
const int MAX_N = 200010;
int to[D][MAX_N];

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

    int n;
    long long k;
    cin >> n >> k;

    REP(i, n) {
        cin >> to[0][i];
        to[0][i]--;
    }

    // ダブリングの表をセットする
    REP(i, D - 1) REP(j, n) {
        to[i + 1][j] = to[i][to[i][j]];
    }

    // k を2の指数表記で分解して，
    // 指数の大きい方から辿っていく．
    int v = 0;
    for (int i = D - 1; i >= 0; i--) {
        long long l = 1ll << i;
        if (l <= k) {
            v = to[i][v];
            k -= l;
        }
    }

    cout << v + 1 << '\n';
    return 0;
}

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

void solve() {
    int n;
    cin >> n;

    int x = 1;
    while (x * x <= n) {
        x++;
    }
    x--;

    cout << (x * x) << endl;
}

int main() {
    solve();

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vi vector<int>
#define sl set<ll>
#define sc set<char>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mpi map<ll,ll>
#define mpc map<char,ll>
#define forn(i,n) for(ll i=0;i<n;i++)
#define ff first
#define ss second
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define inf        1000000000000000005
#define MOD        1000000007

void solve(){
	ll n;
	cin>>n;
	ll a[n];
	forn(i,n){
		cin>>a[i];
	}
	//dp[i][j] denotes the cost in the interval i-j
	ll dp[n][n];
	for(ll l=n-1;l>=0;l--){
		for(ll r=l;r<n;r++){
			if(l==r){
				dp[l][r]=0;
			}
			else{
				dp[l][r]=inf;
				ll ans=0;
				for(ll i=l;i<=r;i++){
					ans+=a[i];
				}
				for(ll i=l;i<r;i++){
					dp[l][r]=min(dp[l][r],dp[l][i]+dp[i+1][r]+ans);
				}
			}
		}
	}
	cout<<dp[0][n-1];
}

int main(){
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
		cout<<endl;
	}
}
		


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

int main() {
    long int A, B, C;
    long int K;
    cin >> A >> B >> C >> K;

    long int ans;
    if(K % 2 == 0) {
        ans = A - B;
    } else {
        ans = B - A;
    }
    if(abs(ans) > 1000000000000000000) {
        cout << "Unfair" << endl;
    } else {
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
 
#define int long long int
#define pb push_back
#define mp make_pair
#define loop(i,x,n) for(int i=x;i<=n;i++)
#define rloop(i,x,n) for(int i=x;i>=n;i--)
#define ff first
#define ss second
#define N4RUTO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 
typedef tree<int, null_type, less<int>, rb_tree_tag,  
tree_order_statistics_node_update>
ordered_set;
 
int32_t main(){
    N4RUTO;
    int n,a,b;
    cin>>n>>a>>b;
    int x = n/(a+b);
    int ans = x*a;
    n-=x*(a+b);
    ans+=min(n,a);
    // cout<<n<<" "<<x<<"\n";
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 256
w, h, n = map(int, input().split())
xl = 0
xr = w
yd = 0
yu = h
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1: xl = max(xl, x)
    if a == 2: xr = min(xr, x)
    if a == 3: yd = max(yd, y)
    if a == 4: yu = min(yu, y)
print(max(0, xr - xl) * max(0, yu - yd))

Measured memory_bytes: 3188
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

int main() {
    map<string, int> ma;
    int n, m;
    cin >> n;
    vector<string> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (ma.find(a[i]) == ma.end()) {
            ma.insert(pair<string, int>(a[i], 1));
        } else {
            ma[a[i]]++;
        }
    }
    cin >> m;
    vector<string> b(m);
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        if (ma.find(b[i]) == ma.end()) {
            ma.insert(pair<string, int>(b[i], 0));
        } else {
            ma[b[i]]--;
        }
    }
    int max = 0;
    for (auto p: ma) {
        if (max < p.second) max = p.second;
    }
    cout << max << endl;
    return 0;
}

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

using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, k, x, y; cin >> n >> k >> x >> y;
  int res = min(k, n) * x;
  res += max(n - k, 0) * y;
  cout << res << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6+5;
string s;
int main(){
//    freopen("in.txt","r", stdin);
    cin >> s;
    for(int i = 0; i < s.length()-8; i++)
        cout << s[i];
    return 0;
}


Measured memory_bytes: 256