akhauriyash/Code-Regression huggingface dataset:
#ifdef ONLINE_JUDGE

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

#define ui unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double

#define all(v) v.begin(), v.end()

#define speed ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const ld PI = 3.1415926535897932384626;
ll MOD = 1000000007;
const ld EPS = 1e-9;
const int N = 3e5 + 7;

inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ui setBits(ui v) { ui c; for(c = 0 ; v; ++c) v &= (v - 1); return c; }
inline bool isPowerOfTwo(ui v) { return (v && !(v & (v - 1))); }
ll power(ll base, ull exp, ll mod = MOD) { 
	ll res = 1; base %= mod; 
	while(exp) { 
		if(exp & 1) res = (res * base)%mod; 
		exp >>= 1; base = (base * base)%mod; 
	} 
	return res; 
}
ll modInv(ll a, ll mod = MOD) { 
	if(mod == 1) return 0; 
	ll x = 1, y = 0, m = mod; 
	while(a > 1) { 
		ll q = a/m, t = m; m = a%m; a = t; t = y; y = x - q * y; x = t; 
	} 
	if(x < 0) x += mod; 
	return x; 
}
inline ui iabs(int x) { ui y = x; return (y > 0) ? y : -y; }
inline ll add(ll a, ll b, ll mod = MOD) { ll res = (a%mod + b%mod)%mod; return res; }
inline ll sub(ll a, ll b, ll mod = MOD) { ll res = (a%mod - b%mod + mod)%mod; return res; }
inline ll mult(ll a, ll b, ll mod = MOD) { ll res = (a%mod * b%mod)%mod; return res; }
inline ll div(ll a, ll b, ll mod = MOD) { ll res = (a%mod * modInv(b, mod))%mod; return res; }

#else

#include "custom.h"
using namespace std;

#endif

void openf() {
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif	
}

int main() {
	speed;
	openf();
	ll N;
	cin >> N;
	vector<ll> div(N + 1); 
	for(ll i = 1 ; i <= N ; ++i) {
		for(ll j = 1 ; j*i <= N ; ++j) {
			++div[i * j];
		}
	}
	ll ans = 0;
	for(ll i = 1 ; i <= N ; ++i) {
		ans += (i * div[i]);
	}
	cout << ans << endl;
	return 0;
}  
  

Measured memory_bytes: 81344
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e7+5;
ll f[N],n,ans;
int main(){
   for(int i=1;i<N;i++) 
   	for(int j=i;j<N;j+=i) 
	   	f[j]++;
   cin>>n; for(int i=1;i<=n;i++) ans+=f[i]*i; cout<<ans;
}


Measured memory_bytes: 81752
# coding: utf-8
import math
gu, ki = map(int, input().split())
# 偶数+偶数と奇数+奇数の組み合わせを数える
if gu <= 1:
    sum_gu = 0
elif gu == 2:
    sum_gu = 1
else:
    sum_gu = math.factorial(gu) / (math.factorial(gu-2)*2)

if ki <= 1:
    sum_ki = 0
elif ki == 2:
    sum_ki = 1
else:
    sum_ki = math.factorial(ki) / (math.factorial(ki-2)*2)

print(int(sum_gu+sum_ki))


Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
   int n,y,m,k,x;
     scanf("%d%d%d%d",&n,&k,&x,&y) ;
     int temp=n-k;
     int s=x*k;
     if(n<k) s=x*n;
     else s=s+y*temp;
    printf("%d",s);
    

}

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

#define N 100010

int main(){
    int n,m,h[N],ma[N];
    cin>>n>>m;

    for(int i=1;i<=n;i++){
        cin>>h[i];
        ma[i]=0;
    }

    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        ma[a]=max(ma[a],h[b]);
        ma[b]=max(ma[b],h[a]);
    }

    int ans=0;
    for(int i=1;i<=n;i++){
        ans+=h[i]>ma[i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3940
#include <stdio.h>
int gcd(int a,int b){
	if(a%b==0)
		return b;
	else
		return(gcd(b,a%b));
}
int main(void)
{
	long long int a,b;
	while(scanf("%lld %lld",&a,&b)>0){
        long long int lcm=(a*b)/gcd(a,b);
        if(lcm==0) break;
        printf("%d %lld\n",gcd(a,b),lcm);
	}
	return 0;
}


Measured memory_bytes: 2040
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

ll LCM(ll x , ll y){
	return (x*y) / __gcd(x,y) ;
}

ll NumOfDiv(ll a , ll b , ll k){
	return b/k - a/k + (a%k == 0) ;
}
void start(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

int res(int a , int b , int c){
	int x[3] = {a,b,c} ;
	sort(x,x+3);
	return x[1] ;
}

int main() 
{ 
    ll n ; cin >> n;
    ll m = LLONG_MAX ;
    for (int i=1; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            m = min( m , ((n/i)-1) + (i-1)) ;
        } 
    } 
    cout << m << endl ;
    return 0; 
} 

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

int main() {
	int H,W,A,B;
	cin >> H >> W >> A >> B;

	if(A*2<W && B*2<H) {
		rep(i,H) {
			rep(j,W)
				if(i<B&&j<A || i>=B&&j>=A)
					cout << 1;
				else
					cout << 0;
			cout << endl;
		}
	} else
		cout << "No" << endl;
}

Measured memory_bytes: 1280
// {{{
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()

//#if __cplusplus >= 201103
typedef long long ll;
//#endif
typedef pair<int, int> P;
typedef pair<int, P> IP;

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

const int INF = 100000000;
//#if __cplusplus >= 201103
const ll LINF = 10000000000000000ll;
//#endif
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
// }}}

typedef pair<ll, ll> LP;
struct edge {
    ll to, cost;
    edge(ll t, ll c): to(t), cost(c) {};
};
vector<edge> g_yen[100010];
vector<edge> g_snook[100010];
int n, m, s, t;
ll d_yen[100010];
ll d_snook[100010];

void dijkstra(int s, vector<edge> *g, ll *d)
{
    priority_queue<LP, vector<LP>, greater<LP> > q;
    REP(i, n) d[i] = LINF;
    d[s] = 0;
    q.push(P(0, s));
    while(!q.empty()){
      P p = q.top(); q.pop();
      ll v = p.se;
      if(p.first > d[v]) continue;
      size_t len = g[v].size();
      for(size_t i = 0; i < len; i++){
        edge e = g[v][i];
        if(d[e.to] > d[v] + e.cost){
          d[e.to] = d[v] + e.cost;
          q.push(mp(d[e.to], e.to));
        }
      }
    }
}

void init()
{
}

void solve()
{
    dijkstra(s, g_yen, d_yen);
    dijkstra(t, g_snook, d_snook);
    priority_queue<LP, vector<LP>, greater<LP> > q;
    REP(i, n){
        auto p = mp(d_yen[i] + d_snook[i], i+1);
        q.push(p);
    }
    REP(i, n){
        while(true){
            auto p = q.top();
            if(p.se > i){
                cout << 1000000000000000ll - p.fi << endl;
                break;
            }else{
                q.pop();
            }
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m >> s >> t;
    s--; t--;
    REP(i, m){
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        g_yen[u].pb(edge(v, a));
        g_yen[v].pb(edge(u, a));
        g_snook[u].pb(edge(v, b));
        g_snook[v].pb(edge(u, b));
    }
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 19904
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include<set>
using namespace std;
using ll = long long;
#define PI (acos(-1))

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

  set<string> S;
  string a;
  for (int i = 0; i < N; i++)
  {
    cin >> a;
    S.insert(a);
  }

  cout << S.size();
}


Measured memory_bytes: 19140
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(a) for(int k=head[a];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef double db;
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=1e6+5,M=5e3+5,INF=1e9,mod=998244353;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
map<int,int>id;
int a[N],b[N],fa[N],n,dex;
int getf(int x){return fa[x]==x?x:fa[x]=getf(fa[x]);}
int main(){
	read(n);rep(i,1,n)read(a[i]);rep(i,1,n)read(b[i]);
	int xo=0;
	rep(i,1,n)xo^=a[i];a[n+1]=xo;
	xo=0;
	rep(i,1,n)xo^=b[i];b[n+1]=xo;
	n++;vector<int>a1,b1;
	rep(i,1,n)a1.pb(a[i]),b1.pb(b[i]);
	sort(a1.begin(),a1.end());sort(b1.begin(),b1.end());
	re(i,0,a1.size())if(a1[i]!=b1[i])return puts("-1"),0;
	int ans=0;
	rep(i,1,n)if(a[i]!=b[i]||i==n){
		if(i!=n)ans++;
		if(!id[a[i]])id[a[i]]=++dex;
		if(!id[b[i]])id[b[i]]=++dex;
	}
	if(!ans)return puts("0\n"),0;
	rep(i,1,dex)fa[i]=i;
	rep(i,1,n)if(a[i]!=b[i])fa[getf(id[a[i]])]=getf(id[b[i]]);
	rep(i,1,dex)if(fa[i]==i)ans++;
	ans--;
	cout<<ans<<endl;
}

Measured memory_bytes: 15860
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;

int main() {
	int X;
	cin >> X;
	int dp[100000 + 106];
	for (int i = 0; i < 100106; ++i) {
		dp[i] = 0;
	}
	dp[0] = 1;
	for (int i = 0; i <= 100000; ++i) {
		if (dp[i] == 1) {
			for (int j = 100; j < 106; ++j) {
				dp[i + j] = 1;
			}
		}
	}

	for (int i = X - 105; i <= X - 100; ++i) {
		if (1 == dp[i]) {
			cout << 1 << endl;
			return 0;
		}
	}
	cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>

using namespace std;

int main()
{
	string W, T;
	cin >> W;

	while (true)
	{
		string s;
		getline(cin, s);

		if (s == "END_OF_TEXT")
			break;

		T += s + " ";
	}

	transform(T.begin(), T.end(), T.begin(), ::tolower);

	istringstream is(T);
	string word;
	int count = 0;
	while (is >> word)
	{
		if (!strcmp(W.c_str(), word.c_str()))
			++count;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

#define for1(n) for (int i = 0 ; i < n ; i++)
#define for2(n) for (int j = 0 ; j < n ; j++)
#define for3(n) for (int k = 0 ; k < n ; k++)
#define for4(n) for (int l = 0 ; l < n ; l++)
int main() {
    ios::sync_with_stdio(false);
    ll n, m, w = 0;
    cin >> n >> m;
    ll x[n], y[n], z[n];
    for1(n) cin >> x[i] >> y[i] >> z[i];
	for1(8) {
		ll a[1003] = {};
		for2(n) {
			if (i == 0) a[j] = x[j] + y[j] + z[j];
			else if (i == 1) a[j] = x[j] + y[j] - z[j];
			else if (i == 2) a[j] = x[j] - y[j] + z[j];
			else if (i == 3) a[j] = x[j] - y[j] - z[j];
			else if (i == 4) a[j] = -x[j] + y[j] + z[j];
			else if (i == 5) a[j] = -x[j] + y[j] - z[j];
			else if (i == 6) a[j] = -x[j] - y[j] + z[j];
			else if (i == 7) a[j] = -x[j] - y[j] - z[j];
		}
		sort(a, a + n);
		reverse(a, a + n);
		ll v = 0;
		for2(m) v += a[j];
		w = max(w, v);
	}
	cout << w;
}
/*
*/

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

int main() {

    int n;
    cin >> n;

    int Fib[50] = {0};
    Fib[0] = Fib[1] = 1;
    for (int i = 2; i <= n; ++i) Fib[i] = Fib[i - 1] + Fib[i - 2];

    cout << Fib[n] << endl;
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

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

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

    int tmp = 0;
    if (a < b)
    {
        tmp = a;
        a = b;
        b = tmp;
    }

    /* ユークリッドの互除法 */
    int r = a % b;
    while (r != 0)
    {
        a = b;
        b = r;
        r = a % b;
    }

    vector<int> v;
    for(int i = b;i>=1;i--){
        if(b%i == 0){
            
            v.push_back(i);
        }

    }

    
    
    cout << v[c-1];
    

}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int a[]=new int[n];
    int num=0;
    boolean isOK=false;
    for(int i=0;i<n;i++){
      a[i]=sc.nextInt();
    }
    sc.close();
    for(int i=0;i<n;i++){
      if(a[num]==2){
        System.out.println(i+1);
        isOK=true;
        break;
      }else{
        num=a[num]-1;
      }
    }
    if(isOK==false){
      System.out.println(-1);
    }
  }
}

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

int main()
{
  int m,d;
  cin >> m >> d;
  
  int cnt = 0;
for (int i = 1; i <= m; i++)
{
 for (int j = 1; j <= d; j++)
 {
	int d1 = j%10,d2=j/10;
   if (d1 >= 2 && d2 >= 2 && d1 * d2 == i)
     cnt++;
 }
}
  cout << cnt << endl;
}

Measured memory_bytes: 384
using System;
using System.Linq;

namespace ABC057_D___Maximum_Average_Sets
{
    class Program
    {
        static void Main(string[] args)
        {
            var NAB = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var N = NAB[0];
            var A = NAB[1];
            var B = NAB[2];

            var V = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            Array.Sort(V);
            Array.Reverse(V);

            decimal average = 0;
            for (int i = 0; i < A; i++) average += V[i];
            average /= (decimal)A;
            Console.WriteLine(average.ToString());

            decimal pattern = 0;
            if (V[0] == V[A - 1])
            {
                var maxCount = V.Count(s => s == V[0]);
                for (int i = A; i <= Math.Min(maxCount, B); i++) pattern += conbination(maxCount, i);
            }
            else
            {
                var minCount = V.Count(s => s == V[A - 1]);
                var pickMin = A - V.Count(s => s > V[A]);
                pattern = conbination(minCount, pickMin);
            }
            Console.WriteLine(pattern);
        }

        static decimal conbination(int N, int K)
        {
            decimal result = 1;
            for (decimal d = 1; d <= K; d++) result = result * (N - d + 1) / d;
            return result;
        }
    }
}


Measured memory_bytes: 13524
/* ex4-1
   kas056*/

#include <stdio.h>
#include <stdlib.h>

#define SIZE 15

typedef struct{
    int size;//格納最大数
    int count;//現在のデータ数
    char data[SIZE];//データ配列
    char *top;//topのポインタ
    char *bottom;//一番下のポインタ
}stack;

//初期化
void initialize(stack *stk){
    stk -> count = 0;
    stk -> size = SIZE;
    stk -> top = &(stk->data[SIZE]);//配列の最終要素の一つ手前
    stk -> bottom = &(stk->data[SIZE]);//初期配列の要素の一つ手前
}

void push(stack *stk, char s){
    if(stk->count >= stk -> size){//格納最大数を超えたらエラー
        fprintf(stderr, "Error: Stack overflow. (s=%c)\n", s);
    }
    else{
        stk -> top--;//一つ上にあげる(=一つ手前に移動)
        *(stk->top) = s;
        stk->count++;
    }
}

void pop(stack *stk){
    //popが指示されたとき、
    if(stk->count > 0){//要素があれば取り出すようにする。
        stk->top++;//一つ下に移動(=一つ後に移動)
        stk->count--;
    }
}

void print_stack(stack *stk){
    char *c;
    int i;
    c = stk->bottom-1;//配列の一番下のポインタを指定する。
    
    for(i = stk->count-1; i>-1; i--){//スタック内の文字数分操作
        printf("%c", *c--);//出力したら一つ上にあげる。
    }
}


stack stk;
int main(void){
    char sentence[SIZE];
    int i;

    initialize(&stk);

    scanf("%s", sentence);

    for(i=0; i<SIZE; i++){
        if(sentence[i] == '0' || sentence[i] == '1'){
            push(&stk, sentence[i]);//B以外はpush
        }
        else if(sentence[i] == 'B'){
            pop(&stk);//Bがでたらpop
        }
    }

    print_stack(&stk);

    return 0;
    

}

Measured memory_bytes: 1660
#include<stdio.h>
int main(){
    int a,b,c,d,e;
    e = 0;
    scanf("%d %d %d",&a,&b,&c);
    for(d = a;d <= b;d++){
        if(c%d == 0){
            e++;
        }
    }
    printf("%d\n",e);
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999
#define itn int
const int MAX = 510000;


using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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



int main(){// index が条件を満たすかどうか
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a, b, c;
    rep(i, n){
        int s;
        cin >> s;
        a.push_back(s);
    }
    rep(i, n){
        int s;
        cin >> s;
        b.push_back(s);
    }
    rep(i, n){
        int s;
        cin >> s;
        c.push_back(s);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    int a_b[n], b_c[n];
    memset(a_b, 0, sizeof(a_b));
    memset(b_c, 0, sizeof(b_c));
    ll ans = 0;
    rep(i, n){
        ll x = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
        ll y = upper_bound(c.begin(), c.end(), b[i]) - c.begin();
        y = n - y;
        //cout << x << " " << y << endl;
        ans += x * y;
    }
    cout << ans << endl;


}

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

using namespace std;
int i,j,k,n,m,a[105],dp[100005];
int main()
{
    cin>>n>>k;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=1;i<=k;i++)
        for(j=1;j<=n;j++)
        if(i-a[j]>=0&&dp[i-a[j]]==0)
            dp[i]=1;
    if(dp[k])cout<<"First";
    else cout<<"Second";
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
using namespace std;
struct dish{
	int t, d;
};
bool cmp(dish a, dish b){
	if (a.t == b.t){
		return a.d > b.d;
	}
	return a.t < b.t;
}
int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	dish a[n];
	int maxd = -1;
	for (int i = 0; i < n; i++){
		scanf("%d %d", &a[i].t, &a[i].d);
		maxd = max(maxd, a[i].d);
	}
	sort(a, a + n, cmp);
	int dp[n + 1][m], p[n + 1][m];
	for (int i = 0; i <= n; i++){
		for (int j = 0; j < m; j++){
			dp[i][j] = -1;
			p[i][j] = -1;
		}
	}
	dp[0][0] = 0;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (dp[i][j] == -1){
				continue;
			}
			if (dp[i][j] > dp[i + 1][j]){
				dp[i + 1][j] = dp[i][j];
				p[i + 1][j] = j;
			}
			if (j + a[i].t < m){
				if (dp[i][j] + a[i].d > dp[i + 1][j + a[i].t]){
					dp[i + 1][j + a[i].t] = dp[i][j] + a[i].d;
					p[i + 1][j + a[i].t] = j;
				}
			}
		}
	}
	int ans = -1, pos;
	for (int i = 0; i < m; i++){
		if (dp[n][i] > ans){
			ans = dp[n][i];
			pos = i;
		}
	}
	if (ans == -1){
		printf("%d\n", maxd);
		return 0;
	}
	maxd = 0;
	for (int i = n; i > 0; i--){
		if (pos - p[i][pos] == 0){
			maxd = max(maxd, a[i - 1].d);
		}
		pos = p[i][pos];
	}
	printf("%d\n", ans + maxd);
}

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

int main(){
	int prime[10001] = { 0 };
	int i,j,n;
	for(i = 3;i<=10000;i+=2){
		prime[i] = 1;
	}
	prime[2] = 1;
	for(i = 3;i<=100;i+=2){
		if(prime[i] == 1){
			for(j = 3;j<=10000/i;j+=2){
				prime[i*j] = 0;
			}
		}
	}
	while(cin >> n && (n != 0)){
		for(i = n;i>=5;i--){
			if(prime[i] == 1 && prime[i-2] == 1){
				cout << i-2 << " " << i << endl;
				break;
			}
		}
	}
	return 0;
}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define EPS 1e-9
 
using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int a[3], b[3], c[3][3];
    rep(3) repp(j, 3) cin >> c[i][j];
    rep(3) b[i] = c[0][i];
    rep(3) a[i] = c[i][0] - c[0][0];

    rep(3) repp(j, 3){
        if(a[i] + b[j] != c[i][j]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

const int N = 2e+5 + 6;
long long int a[N];
int n;

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    map<long long int, long long int> cnt;
    long long int ans = 0;
    for (int i = n; i >= 1; i--)
    {
        ans += cnt[a[i] + i];
        cnt[i - a[i]]++;
    }
    cout<<ans;
}

Measured memory_bytes: 27792
n,m=map(int,input().split())
aa=[[] for i in range(n)]
for x in range(m):
  a,b=input().split()
  d=int(a)-1
  aa[d].append(b)
  
ans_ac=0
ans_wa=0
for y in range(n):
  ans1=0
  ans2=0
  for z in range(len(aa[y])):
    if aa[y][z]=='WA':
      ans1+=1
    else:
      ans2+=1
      break
  if ans2==1:
    ans_wa+=ans1
    ans_ac+=1
    
print(str(ans_ac)+' '+str(ans_wa))
  


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

int main(){
    string s;
    cin >> s;
    int k;
    cin >> k;
    int notOneIndex = s.size();
    int notOneNumber = 1;
    for(int i=0; i<s.size(); i++){
        if(s[i] != '1'){
            notOneIndex = i;
            notOneNumber = s[i] - '0';
            break;
        }
    }
    if(notOneIndex < k){
        cout << notOneNumber << endl;
    }else{
        cout << 1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import collections
n = int(input())
a = list(map(int, input().split()))
b = [a[0]]
for i in range(1, n):
    b.append(b[i-1]+a[i])
ans = b.count(0)
d = collections.Counter(b)
for i in d.values():
    ans += i*(i-1)//2  # iC2 組み合わせ

print(ans)


Measured memory_bytes: 44284
/*
    書籍を買うor買わないについてのbit全探索 O(N*M*2^N)
    もしくは深さ優先探索
*/

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

int main (void){
    int N,M;
    ll X;
    cin >> N >> M >> X;
    vector<ll> C(N);
    vector<vector<ll>> A(N,vector<ll>(M));
    rep(i,N){
        cin >> C[i];
        rep(j,M){
            cin >> A[i][j];
        }
    }
    ll ans = 99999999;
    for(int bit=0; bit < (1 << N); ++bit){
        vector<ll> levels(M);
        ll cost = 0;
        rep(i,N){
            if(bit & (1 << i)){
                cost += C[i];
                rep(j,M){
                    levels[j] += A[i][j];
                }
            }
        }
        bool can_buy = true;
        rep(i,M){
            if(levels[i] < X){
                can_buy = false;
            }
        }
        if(can_buy){
            ans = min(ans,cost);
        }
    }
    
    if(ans == 99999999) cout << "-1" << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <random>
#include <deque>
#include <bitset>
#include <string>
#include <queue>
#include <complex>

//#define int long long

#define endl '\n'
#define all(v) (v).begin(), (v).end()

using namespace std;
typedef long long ll;
typedef long double ld;

mt19937 mrand(random_device{}());

double PI = acos((double)-1);
const double eps = 1e-8;
const ll inf0 = 1023 * 1024 * 1024;
const ll inf = inf0 * inf0;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;

void solve();
void scan();

signed main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	cout << fixed; cout.precision(15);
	solve();
	return 0;
}

void solve() {
	ld a, b, x; cin >> a >> b >> x;
	ld h = 2 * x / (b * a);
	if (h <= a) cout << atan2(b, h) * 180 / PI << endl;
	else {
		h = 2 * x / (a * a) - b;
		cout << atan2(b - h, a) * 180 / PI << endl;
	}
}

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

ll mod_pow(ll a,ll x){
    ll ans=1;
    for(int i=0;i<63;i++){
        if(x>>i&1){ans*=a; ans%=MOD;}
        a*=a;
        a%=MOD;
    }
    return ans;
}

ll R(ll a){
    return mod_pow(a,MOD-2);
}

ll factorial(ll n){
    ll ret=1;
    for(int i=2;i<=n;i++){
        ret*=i%MOD;
        ret%=MOD;
    }
    return ret;
}

ll c(ll n,ll k){
    return factorial(n)*R(factorial(n-k))%MOD*R(factorial(k))%MOD;
}

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

ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}

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

vector<ll> mk_prime(ll mx){
    vector<ll> p={2};
    for(int i=3;i<=mx;i++){
        bool j=true;
        for(int t=0;p[t]*p[t]<=i;t++){
            if(i%p[t]==0){j=false; break;}
        }
        if(j){p.push_back(i);}
    }
    return p;
}


int main(){
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    for(ll i=1;i<=k;i++){
        if((k-i)%2){ans-=c(k,i)*mod_pow(i,n)%MOD;}
        else{ans+=c(k,i)*mod_pow(i,n)%MOD;}
        ans%=MOD;
    }
    ans*=R(factorial(k));
    ans%=MOD;
    if(ans<0){ans+=MOD;}
    cout<<ans<<endl;
    
    
    
    return 0;
}



Measured memory_bytes: 3116
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(N):
    if A[i] < B[i]:
        ans += A[i]
        B[i] -= A[i]
        if A[i + 1] < B[i]:
            ans += A[i + 1]
            A[i + 1] = 0
        else:
            ans += B[i]
            A[i + 1] -= B[i]
    else:
        ans += B[i]
        
print(ans)

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

int main(void){
  int n;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, greater<int>());
  int ans = 0;
  for(int i = 0; i < n; i++){
    if(i % 2 == 0) ans += a[i];
    else ans -= a[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int score;
	while (cin >> score)
	{
		if (score < 1200)
			cout << "ABC";
		else if (1200<=score &&score< 2800)
			cout << "ARC";
		else
			cout << "AGC";
		cout << endl;
	}
	return 0;
}

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

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int dx = tx - sx, dy = ty - sy;
    for (int i = 0; i < dx; i++) cout << 'R';
    for (int i = 0; i < dy; i++) cout << 'U';
    for (int i = 0; i < dx; i++) cout << 'L';
    for (int i = 0; i < dy; i++) cout << 'D';
    cout << 'D';
    for (int i = 0; i < dx + 1; i++) cout << 'R';
    for (int i = 0; i < dy + 1; i++) cout << 'U';
    cout << 'L' << 'U';
    for (int i = 0; i < dx + 1; i++) cout << 'L';
    for (int i = 0; i < dy + 1; i++) cout << 'D';
    cout << 'R' << endl;
}

Measured memory_bytes: 3572
K,N = map(int,input().split())
A = list(map(int,input().split()))

maxi = 0
for i in range(N):
    if i == 0:
        maxi = max(abs(A[0]+K-A[-1]),maxi)
    else:
        maxi = max(abs(A[i]-A[i-1]),maxi)

print(K-maxi)

Measured memory_bytes: 77388
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> P(N), Q(N);
    rep(i,N)cin>>P[i];
    rep(i,N)cin>>Q[i];
    vector<int> tmp(N);
    rep(i,N)tmp[i]=i+1;
    int a = -1, b = -1;
    int cnt = 1;
    do
    {
        if (tmp == P)
            a = cnt;
        if (tmp == Q)
            b = cnt;

        if (a >= 0 && b >= 0)
            break;
        cnt++;
    } while (next_permutation(tmp.begin(), tmp.end()));

    cout<<abs(a-b)<<endl;
 //   system("pause");
    return 0;
}

Measured memory_bytes: 256
N=int(input())
S=input()

cum = [0]*(N+1)
for i in range(N):
  if S[i] == '#':
    cum[i+1] = cum[i]+1
  else:
    cum[i+1] = cum[i]
ans = [0]*(N+1)
for i in range(N+1):
  ans[i] = cum[i] + ((N-i)-(cum[N]-cum[i]))
print(min(ans))

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, A, B;
    cin >> N >> A >> B;

    vector<ll> X(N);
    rep (i, N) {
        cin >> X[i];
    }

    ll ans = 0;
    rep (i, N-1) {
        ans += min((X[i+1]-X[i])*A, B);
    }

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

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n)
     cin>>a[i];
  sort(a.begin(),a.end());
  int last=a.back();
  if(n==2){
     printf("%d %d",last,a.front());
     return 0;
  }
  a.pop_back();
  int r=last/2;
  if(binary_search(a.begin(),a.end(),r)){
     printf("%d %d",last,r);
     return 0;
  }
  auto itr =upper_bound(a.begin(),a.end(),r);
  if(itr==a.end()){
     printf("%d %d",last,a.back());
     return 0;
  }
  int b=*itr;
  if(itr!=a.begin())
    if(abs(b-r)>abs(*--itr-r))
      b=*itr;
  printf("%d %d",last,b);
  return 0;
}

Measured memory_bytes: 640
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	map<string, int> m;
	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		m[s] += 1;
	}
	cout << "AC x " << m["AC"] << endl;
	cout << "WA x " << m["WA"] << endl;
	cout << "TLE x " << m["TLE"] << endl;
	cout << "RE x " << m["RE"] << endl;
	return 0;
}


Measured memory_bytes: 3624
import collections

n = int(input())
counter = collections.Counter()
ls = list(map(int, input().split()))
for k in ls:
    counter[k] += 1
res = 0
for key in sorted(counter.keys()):
    res = max(res, counter[key - 1] + counter[key] + counter[key + 1])
print(res)

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

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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
    ll h, w;
    cin >> h >> w;
    if(h==1||w==1)cout << 1 << endl;
    else cout << h*w/2+h*w%2 << endl;
}

Measured memory_bytes: 3600
#include <iostream>

using namespace std;

int main() {
	int N,M,temp;
	cin >> N>>M;
	for( int i = 0; i < M;i++)
	{
	    cin >> temp;
	    N-=temp;
	    if( N<0 )
	    {
	        N =-1;
	        break;
	    }
	}

	cout << N;
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  cout << (n >= 30 ? "Yes" : "No") << endl;
}

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

int main(){
	
	int a,b;cin>>a>>b;
	if(a*b%2==0)cout << "Even" << endl;
	else cout << "Odd" << endl;
	return 0;
}

//cout << ans << endl;

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

int n, m;

int main(void){
	cin >> n >> m;
	vector<int> favo(m+1);
	rep(i, n){
		int k;
		cin >> k;
		rep(j, k){
			int a;
			cin >> a;
			favo[a]++;
		}
	}
	int ans = 0;
	rep(i, m+1){
		if(favo[i]==n) ans++;
	}
	cout << ans << endl;
	return 0;
}


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

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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; }

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int N,M; cin >> N >> M;
    if(N%2 == 0){
        if(M >= N/2 /2){

            REP(i,N/2 /2){
                cout << i+1 << " " << N-i <<endl;
            }
            M -= N/2/2;
            REP(i,M){
                cout << N/2-1-i << " " << N/2+1+i << endl;
            }

        }else{
            REP(i,M){
                cout << i+1 << " " << N-i <<endl;
            }
        }
    }else{
        REP(i,M){
            cout << i+2 << " " << N-i << endl;
        }
    }

}

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

int main() {
    string s,t;
    cin >> s >> t;
    int cnt = 0;
    rep(i,3){
        if(s[i] == t[i]) cnt++;
    }
    cout << cnt;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
using namespace std;
int		cnt;

int		main(void)
{
	int		N, K;
	cin >> N >> K;
	vector<int> h(N);
	for (int i = 0; i < N; i++)
		cin >> h.at(i);
	for (auto &i : h)
	{
		if (i >= K)
			cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <map>

using namespace std;

vector<int> foo(vector<int> a, int b, int c) {
	vector<int> ret;
	int carry = c;
	for (int i = 0; i < a.size(); i++) {
		ret.push_back((carry + b * a[i]) % 10);
		carry = (carry + b * a[i]) / 10;
	}
	if (carry > 0) {
		ret.push_back(carry);
	}
	return ret;
}

int main() {
	string N;
	cin >> N;

	vector<int> a(N.size());
	for (int i = 0; i < N.size(); i++) {
		a[i] = N[N.size() - 1 - i] - '0';
	}

	int ok = 505050;
	int ng = 0;
	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;
		// 9N+9mid
		auto b = foo(a, 9, 9 * mid);
		int count = 0;
		for (int x : b) {
			count += x;
		}
		if (count <= 9 * mid) {
			ok = mid;
		} else {
			ng = mid;
		}
	}
	cout << ok << endl;
}

Measured memory_bytes: 8864
import sys
n = int(input())
a = list(map(int,input().split()))

m=1
l=10**18

if a.count(0) >= 1:
    print(0)
    sys.exit()

for i in range(n):
    m=m*a[i]
    if m > l:
        print(-1)
        sys.exit()

print(m)


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

int main() {
    string S;
    cin >> S;
    int N = S.size();
    long long ans = 0;

    for(int bit = 0; bit < (1<<N-1); bit++){
        long long tmp = S[0] - '0';
        for(int i = 0; i < N-1; i++){
            if( (bit>>i) & 1){
                ans += tmp;
                tmp = 0;
            }
        tmp = tmp * 10 + (S[i+1] -'0');
        }
        ans += tmp;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
const int MAX=1e6+7;
using namespace std;
int fa[MAX],rem[MAX];
struct node
{
	int x;
	int y;
	int v;
}Map[MAX];
int find(int n)
{
	if(fa[n]==n)
	{
		return n;
	}
	else return fa[n]=find(fa[n]);
} 
void merge(int a,int b)
{
	fa[find(a)]=find(b);
}
bool cmp(node a,node b)
{
	return a.v>b.v;
}
int k=0;
signed main()
{
	int T,n,m,ans=0;
	cin>>T>>n>>m;
	for(int i=1;i<=T;i++)
	{
		cin>>Map[i].x>>Map[i].y>>Map[i].v;
	} 
	sort(Map+1,Map+1+T,cmp);
	for(int i=1;i<=n+m;i++)
	{
		fa[i]=i;
		rem[i]=1;
	}
	for(int i=1;i<=T;i++)
	{
		int fx=find(Map[i].x),fy=find(Map[i].y+n);
		if(fx==fy)
		{
			if(rem[fx])
			{
				rem[fx]--;
				ans+=Map[i].v;
			}
		}
		else
		{
			if(rem[fx]+rem[fy])
			{
				rem[fx]+=rem[fy];
				rem[fx]--;
				merge(Map[i].y+n,Map[i].x);
				ans+=Map[i].v;
			}
		}
		//cout<<"ans="<<ans<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 10800
import java.util.*;

class Main{
	public static void main(String[] args){
		Solve s = new Solve();
		s.solve();
	}	
}

class Solve{
	Solve(){}
	
	Scanner in = new Scanner(System.in);

	void solve(){
		int l = in.nextInt();
		int a = in.nextInt(), b = in.nextInt(), c = in.nextInt(), d = in.nextInt();
		System.out.println(l - Math.max((a + c -1) / c, (b + d - 1) / d));
	}

	
}

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

int main(){
  int A, B;
  cin >> A >> B;
  
  for(int i = 0; i < 3; i++) {
    if(A == i + 1 || B == i + 1) {
      
    } else {
      cout << i + 1 << endl;
    }
  }
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
m = 1000
ind_st = 0
ind = 1
while ind_st < n:
    if ind < n:
        if a[ind]>=a[ind-1]:
            ind+=1
            continue
    
    kb = m//a[ind_st]
    m += kb*(a[ind-1]-a[ind_st])
    ind_st = ind
    ind = ind_st+1

print(m)

Measured memory_bytes: 8920
//Tuvshee
 
#include<iomanip>
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<cmath>
#include<algorithm>
#include<string>
#include<cctype>
#include<vector>
#include<queue>
using namespace std;
#define I int
#define V void
#define D double
#define F float
#define C char
#define S string
#define B bool
#define L long long
#define rep(n) for(int i=0;i<n;i++)
#define reps(m,n,c) for(int c=m;c<n;c++)
#define repd(m,n,j) for(int j=n;j>m;j--)
#define whL while
#define eL endl
#define oR ||
#define anD &&
#define rtn return
#define pause system("PAUSE")
#define Max 300
#define max(m,n) ((n<m)?m:n)
#define min(m,n) ((n>m)?m:n)
int main(){
  int n, i;
  string m, r;
  int a, b;
 
  bool cards[4][13];
  for(int i=0; i<4; i++){
    for(int j=0; j<13; j++){
      cards[i][j] = false;
    }
  }
 
  i=0;
  cin >> n;
 
  while(i < n){
    cin >> m;
    if(m == "S") a=0;
    else if(m == "H") a=1;
    else if(m == "C") a=2;
    else if(m == "D") a=3;
    else break;
 
    cin >> b;
    cards[a][b-1] = true;
    i++;
  }
 
  for(int i=0; i<4; i++){
    if(i==0) r="S";
    if(i==1) r="H";
    if(i==2) r="C";
    if(i==3) r="D";
 
    for(int j=0; j<13; j++){
      if(!cards[i][j]) cout << r << " " << j+1 << endl;
    }
  }
 
  return 0;
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

std::vector<long long> divisors(long long n) {
    std::vector<long long> divisors;
    long long i = 1;
    while (i * i <= n) {
        if (n % i == 0) {
            divisors.push_back(i);
            if (i * i != n) {
                divisors.push_back(n/i);
            }
        }
        i++;
    }

    sort(divisors.begin(), divisors.end());
    return divisors;
}


ll n, m;

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

    Vl div = divisors(m);
    cout << m / *lower_bound(ALL(div), n) << '\n';

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dice_I
{
    class Program
    {
        static void Main(string[] args)
        {
            Start();
            Control();
            Output();
        }

        static int top, front, right, left, back, bottom;
        static List<string> control;

        static void Start()
        {
            string[] input = Console.ReadLine().Split(' ');
            top = int.Parse(input[0]);
            front = int.Parse(input[1]);
            right = int.Parse(input[2]);
            left = int.Parse(input[3]);
            back = int.Parse(input[4]);
            bottom = int.Parse(input[5]);
        }

        static void Control()
        {
            string input = Console.ReadLine();
            control = new List<string>();
            foreach (char item in input)
            {
                control.Add(item.ToString());
            }            
        }

        static void S ()
        {
            int temp;
            temp = front;
            front = top;
            top = back;
            back = bottom;
            bottom = temp;
        }

        static void N()
        {
            int temp;
            temp = front;
            front = bottom;
            bottom = back;
            back = top;
            top = temp;
        }

        static void W()
        {
            int temp;
            temp = left;
            left = top;
            top = right;
            right = bottom;
            bottom = temp;
        
        }

        static void E()
        {
            int temp;
            temp = right;
            right = top;
            top = left;
            left = bottom;
            bottom = temp;
        }

        static void Output()
        {
            for (int i = 0; i < control.Count; i++)
            {
                switch (control[i])
                { 
                    case "S":
                        S();
                        break;
                    case "N":
                        N();
                        break;
                    case "W":
                        W();
                        break;
                    case "E":
                        E();
                        break;
                }
            }
            Console.WriteLine(top);
        }
    }
}



Measured memory_bytes: 17928
#include<iostream>
#include<utility>
#include<vector>

using namespace std;
const long mod = 1000000007;

struct UnionFind {
private:
	vector<long> prisize;//属するグラフの頂点数を返す。参照は根でよい。
public:
	vector<long> par;//親を返す
	UnionFind(long N) : prisize(N), par(N) {
		for (int i = 0; i < N; i++) par[i] = i;//全て根である状態
		for (int i = 0; i < N; i++) prisize[i] = 1;
	}

	long root(long i) {//根を返す
		if (par[i] == i) return i;
		return par[i] = root(par[i]); //根に直接繋ぎなおす
	}

	void unite(long x, long y) {//二つの木の統合(rxをryに繋ぐ)
		long rx = root(x);
		long ry = root(y);

		if (rx == ry) return;
		if (prisize[rx] > prisize[ry]) swap(rx, ry);
		par[rx] = ry;
		prisize[ry] += prisize[rx]; //ここ分解を想定していない & size[rx]は更新されない。
	}

	bool same(long x, long y) { return root(x) == root(y); }//根が等しいか
	long size(long i) { return prisize[root(i)]; }
};

int main() { 
	//逆から走査する(UnionFindなので)
	long N, M; cin >> N >> M;
    
	vector<long> F(M + 1);//崩落後の不便さ
	vector<pair<long, long>> bridge(M);//入力リスト
	F[M] = N * (N - 1) / 2;

	UnionFind tree(N);

	for (int i = 0; i < M; i++) {//入力
		long A, B; cin >> A >> B;
		A--; B--;
		bridge[i] = make_pair(A, B);
	}

	for (int i = M - 1; i >= 0; i--) {
		long A, B; 
		A = bridge[i].first;
		B = bridge[i].second;

		if (tree.same(A, B)) {
			F[i] = F[i + 1];
		}
		else {
			F[i] = F[i + 1] - (tree.size(A) * tree.size(B));
			tree.unite(A, B);
		}
	}

	for (int i = 1; i <= M; i++) cout << F[i] << endl;
}

Measured memory_bytes: 5248