akhauriyash/Code-Regression huggingface dataset:
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

int n;
int kind[10][10];

signed main(){
    cin >> n;
    REPS(i,n){
        int lo = i % 10;
        int hi = i;
        while ( hi >= 10 ) hi /= 10;
        kind[lo][hi]++;
    }
    int ans = 0;
    REP(i,10) {
        REP(j,10) {
            ans += kind[i][j] * kind[j][i];
            cerr << kind[i][j] << " ";
        }
        cerr << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;

namespace AtCoderProblems
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            var d = double.Parse(str[0]);
            var t = double.Parse(str[1]);
            var s = double.Parse(str[2]);

            if (d/s > t)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}


Measured memory_bytes: 27332
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 1e5+10;
int n;
pa a[N];
bool flag[N];

int main(){
	n=read();
	int mn=1e9;
	For(i,1,n){
		a[i].fi=read(),a[i].se=read();
		mn=min(mn,a[i].se);
	}
	sort(a+1,a+1+n,[](pa a,pa b){
		return (a.fi<b.fi)||(a.fi==b.fi&&a.se>b.se);
	});
	For(i,1,n) if (a[i].se==mn||flag[i-1]) flag[i]=1;
	int R=1e9,ans=0;
	Dow(i,n,1){
		if (i==n){R=min(R,a[i].se);continue;}
		ans=max(ans,a[i].se-a[i].fi+1+max(0,mn-a[n].fi+1));
		if (flag[i]){
			ans=max(ans,max(0,R-a[n].fi+1)+max(0,mn-a[i].fi+1));
		}
		R=min(R,a[i].se);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 4612
n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for y in range(m)]
modify = [[] for x in range(n + 1)]

for value1, value2 in array:
    modify[value1].append(value2)
    modify[value2].append(value1)


def solver(start, array, visited, cnt):
    if visited[start]:
        return cnt
    else:
        visited[start] = True

    for i in array[start]:
        if len(set(visited)) == 1:
            return cnt+1
        else:
            cnt = solver(i, array, list(visited), cnt)

    return cnt



start = modify[1]
res = 0
for i in start:
    visited = [False if x != 0 and x != 1 else True for x in range(n + 1)]
    res += solver(i, modify, visited, 0)

print(res)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;cin >> a >> b;
  for(int i=0;i<=15;i++){
    if(i%2==0) a--;
    else if(i%2==1) b--;
  }

  if(a>0||b>0) cout << ":(" << endl;
  else cout << "Yay!" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector

int main(void)
{
  int n, k;
  cin >> n >> k;
  vec<int> h(n);
  rep(i, n) cin >> h[i];

  sort(h.begin(), h.end());
  int m = h[n - 1] - h[n - k];
  rep(i, n - k) {
    int t = h[i + k - 1] - h[i];
    if (t < m) m = t;
  }
  cout << m << endl;
  return 0;
}


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

void eyeTest( double a, int* b )
{
    if( a >= 1.1 )
        b[0]++;
    else if( a >= 0.6 )
        b[1]++;
    else if( a >= 0.2 )
        b[2]++;
    else
        b[3]++;
}

int main()
{
    int lj[4] = {0}, rj[4] = {0};
    double l, r;

    while( cin >> l >> r )
    {
        eyeTest( l, lj );
        eyeTest( r, rj );
    }
    for( int i = 0; i < 4; i++ )
        cout << lj[i] << " " << rj[i] << endl;
    return 0;
}


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

int a[12][12];
int dx[4]  = {1,0,-1,0};
int dy[4]  = {0,1,0,-1};
char dc[4] = {'R','D','L','U'};
string f[4] = {"¨" , "«" , "©", "ª"};

//©ªÌüÍS}XÌÇÌóÔð²×é
void cheakWall(int* wall , const int& px ,const int& py ,const int& d ){
	for(int i=0 ; i<4 ; ++i ){
		int mx = px + dx[(d+i)%4];
		int my = py + dy[(d+i)%4];
		wall[i] = a[my][mx];
	}
}

//iÞ
void go(int& px, int& py, const int& d,int* wall, string& s){
	px += dx[d]*2;
	py += dy[d]*2;
	//cheakWall( wall , px , py , d );
	if( wall[1] ){
		//iñ¾ü«ðL^
		s.push_back( dc[d] );
	}
}

int main(){
	string s;

	//zñÌú»
	for(int y=0 ; y<12 ; ++y )
		for(int x=0 ; x<12 ; ++x )
			a[y][x] = 0;

	//üÍ
	for(int i=0 ; i<9 ; ++i ){
		cin >> s;
		int y = i+1;
		int x = (i+1)%2 + 1;
		for(int j=0 ; j<(int)s.size() ; ++j , x+=2 ){
			a[y][x] = s[j] - '0';
		}
	}

	int px = 2, py = 0, d = 0;
	bool flag = false;
	s.clear();

	while( 1 ){
		//cout << "x:" << px << " y:" << py << " d:" << f[d] << endl;
		if( px == 0 && py == 0 ) break;

		int wall[4]; 
		//©ªÌüèÌóÔ
		cheakWall( wall , px , py , d );

		if( !wall[1] ){//EªÇ¶áÈ©Á½ç
			//ü«ðEü«Éñé
			d = (d+1)%4;
			//iÞ
			go( px , py , d , wall , s );
			flag = false;
		}else{
			if( !wall[0] ){//OªÇ¶áÈ©Á½ç
				//iÞ
				go( px , py , d , wall , s );
				flag = false;
			}else{
				if( !wall[3] ){//¶ªÇ¶áÈ©Á½ç
					if( wall[1] && flag == false ){
						//iñ¾ü«ðL^
						s.push_back( dc[d] );
					}
					//ü«ð¶ü«Éñé
					d = (d+3)%4;
					//iÞ
					go( px , py , d , wall , s );
					flag = false;
				}else{//OEEE¶ªÇ¾Á½ç
					flag = true;
					if( wall[1] ){
						//iñ¾ü«ðL^
						s.push_back( dc[d] );
					}
					//ü«ðEü«Éñé
					d = (d+3)%4;
					//iñ¾ü«ðL^
					s.push_back( dc[d] );
				}
			}
		}
	}
	cout << s << endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n;
  ll W;
  cin>>n>>W;
  ll w[n];
  int v[n];
  vector<int> a[4];
  rep(i,0,n){
    cin>>w[i]>>v[i];
  }
  rep(i,0,n){
    a[w[i]-w[0]].push_back(v[i]);
  }
  rep(i,0,4){
    sort(a[i].rbegin(),a[i].rend());
  }
  vector<int> b[4];
  rep(i,0,4){
    b[i].push_back(0);
    rep(j,0,a[i].size()){
      b[i].push_back(b[i][b[i].size()-1]+a[i][j]);
    }
  }
  int ans=0;
  rep(i,0,b[0].size()){
    rep(j,0,b[1].size()){
      rep(k,0,b[2].size()){
        rep(l,0,b[3].size()){
          if(i*w[0]+j*(w[0]+1)+k*(w[0]+2)+l*(w[0]+3)<=W){
            ans=max(ans,b[0][i]+b[1][j]+b[2][k]+b[3][l]);
          }
        }
      }
    }
  }
  cout<<ans<<endl;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int x, n;
    cin >> x >> n;
    if (n == 0) {
        cout << x;
        return 0;
    }
    vector<bool> p(100,0);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        p[a-1] = true;
    }
    int i = x;
    int j = x;
    while (true) {
        if (i > 0) {
            if (p[i-1] == true) {
                i -= 1;
            } else {
                cout << i;
                return 0;
            }
        } else {
            cout << i;
            return 0;
        }
        if (j <= 100) {
            if (p[j-1] == true) {
                j += 1;
            } else {
                cout << j;
                return 0;
            }
        } else {
            cout << j;
            return 0;
        }
    }
    cout << 0;
}


Measured memory_bytes: 3664
def solve(A, B, C, K):
    magic = 0
    while A >= B:
        B *= 2
        magic += 1
    while B >= C:
        C *= 2
        magic += 1
    print('Yes' if magic <= K else 'No')


if __name__ == '__main__':
    # S = input()
    # N = int(input())
    A, B, C = map(int, input().split())
    K = int(input())
    # As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(A, B, C, K)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long 
#define INF 1e9
#define LINF 1e18
 
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;
typedef pair<P, P> PP;
 
const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
 
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int cnt[100001];

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

    int N, Q;
    cin >> N >> Q;
    string s;
    cin >> s;
    for(int i = 1; i < s.size(); ++i) {
        cnt[i] += cnt[i - 1];
        if(s[i - 1] == 'A' && s[i] == 'C') ++cnt[i];
    }
    for(int i = 0; i < Q; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        if(a != 0) {
            if(s[a] == 'C' && s[a - 1] == 'A') cout << cnt[b] - cnt[a - 1] - 1 << endl;
            else cout << cnt[b] - cnt[a - 1] << endl;
        }
        else cout << cnt[b] << endl;
    }
    return 0;
}

Measured memory_bytes: 1872
import java.util.*;
public class Main{
	static void sortpoint(int[] x, int[] y, int n){
		for(int i=0; i<n-1; i++){
			for(int j=n-1; j>i; j--){
				if(x[j-1]>x[j]){
					int t = x[j-1];
					x[j-1] = x[j];
					x[j] = t;
					t = y[j-1];
					y[j-1] = y[j];
					y[j] = t;
				}
			}
		}
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];
		int[] d = new int[n];
		for(int i=0; i<n; i++){
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		for(int i=0; i<n; i++){
			c[i] = sc.nextInt();
			d[i] = sc.nextInt();
		}
		sortpoint(a, b, n);
		sortpoint(c, d, n);
		int ans = 0;
		for(int i=0; i<n; i++){
			int j = 0;
			int ymax = -1;
			int index = -1;
			while(j<n && a[j]<c[i]){
				if(a[j]>=0 && b[j]<d[i]){
					if(b[j]>=ymax){
						ymax = b[j];
						index = j;
					}
				}
				j++;
			}
			if(index>=0){
				ans++;
				a[index] = -1;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using P = pair<ll,int>;

const int V = 50000;
const ll INF = LLONG_MAX/3;
struct edge{int to; ll cost;};

vector<edge> G[V];
ll d[V];

int main()
{
    int n,m;
    scanf(" %d %d", &n, &m);
    vector<int> x(m),y(m);
    vector<ll> t(m);
    rep(i,m)
    {
        scanf(" %d %d %lld", &x[i], &y[i], &t[i]);
        --x[i];
        --y[i];
    }
    int v0,a,b,c;
    scanf(" %d %d %d %d", &v0, &a, &b, &c);

    rep(v,c)
    {
        int nv = (a*v+b)%c;
        rep(i,m)
        {
            G[c*x[i]+v].pb({c*y[i]+nv,t[i]*v});
            G[c*y[i]+v].pb({c*x[i]+nv,t[i]*v});
            int A = c*n;
            G[A+c*x[i]+v].pb({A+c*y[i]+nv,t[i]*v});
            G[A+c*y[i]+v].pb({A+c*x[i]+nv,t[i]*v});
        }
    }

    rep(i,c)
    {
        int u = c*(n-1)+i, v = n*c+u;
        G[u].pb({v,0});
        G[v].pb({u,0});
    }

    // dijkstra
    fill(d,d+V,INF);
    d[v0]=0;
    priority_queue<P,vector<P>,greater<P>> que;
    que.push(P(0,v0));
    while(!que.empty())
    {
        P p = que.top();
        que.pop();

        int v = p.se;
        if(p.fi>d[v]) continue;

        for(const auto &e:G[v])
        {
            if(d[e.to]>d[v]+e.cost)
            {
                d[e.to] = d[v]+e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }

    ll ans = INF;
    rep(i,c) ans = min(ans,d[n*c+i]);
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 28988
import numpy
N = int(input())
H = list(map(int, input().split()))
Dif = numpy.array([(H[i] - H[i + 1]) for i in range(N - 1)])
Dif = numpy.append(Dif, -1)

S = list(numpy.where(Dif < 0)[0])

if len(S) == 0:
    print(0)
else:
    if len(S) == 1:
        print(S[0])
    else:
        T = [S[j + 1] - S[j] - 1 for j in range(len(S) - 1)]
        print(max(T))

Measured memory_bytes: 24920
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
using LL = long long;
using ULL = unsigned long long;
#define NUM 1000000007

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    cout << (a - 1)*(b - 1) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <stdio.h>
#include <unistd.h>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define itrep(itr, base) for (auto itr = base.begin(); itr != base.end(); itr++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  int paint = h;
  if (h < w) paint = w;
  int ans = n / paint;
  if (n % paint != 0) ans++;
  P(ans);
  return 0;
}


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

int main(){
    int n,d;
    float x,y,c=0;
    cin >> n >> d;
    for(int i=0;i<n;i++){
        cin >> x >> y;
        if(sqrt(pow(x, 2.0)+pow(y,2.0)) <= d) c++;
    }
    cout << c << endl;
    return 0;
}

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

dp = [[0 for _ in range(N)] for _ in range(N)]

for i in range(N):
    if i > 0 and S[0] == S[i]:
        dp[0][i] = 1

ans = 0
for i in range(0, N-1):
    for j in range(i, N-1):
        if S[i+1] == S[j+1]:
            tmp = dp[i][j] + 1
            tmp2 = min(tmp, j-i)
            dp[i+1][j+1] = tmp2
            if tmp2 > ans:
                ans = tmp2
print(ans)


Measured memory_bytes: 245768
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int halfcount = 200;
		for(int i = 0; i < N; i++) {
			int halfcommand = 0;
			int value = sc.nextInt();
			while(value % 2 == 0) {
				value /= 2;
				halfcommand++;
			}
			halfcount = Integer.min(halfcommand, halfcount);
		}
		System.out.println(halfcount);
	}

}


Measured memory_bytes: 23252
import fractions
N,X=map(int,input().split())
x=list(map(lambda x: abs(int(x)-X), input().split()))
x_min=min(x)
g_min=x_min
for i in x:
  g=fractions.gcd(g_min,i)
  if g==1:
    print(1)
    exit()
  if g < g_min:
    g_min = g
print(g_min)

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl

int H1, M1, H2, M2, K;

int main() {
    cout << fixed << setprecision(15);
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    int t1 = H1*60 + M1, t2 = H2 * 60 + M2;
    cout << max(0, t2-t1-K) << endl;
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	/*
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	*/
	int n,k;
	cin>>n>>k;

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

	int dp[n];
	dp[0]=0;

	for(int i=1;i<n;i++) {
		dp[i]=INT_MAX;
		for(int j=1;j<=k;j++) {
			if(i-j>=0)
				dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	cout<<dp[n-1]<<"\n";
}

Measured memory_bytes: 1024
n,m=map(int,input().split())
a=[]
b=[]
for i in range(n): 
    a.append(input())
for i in range(m):
    b.append(input())
def check(i,j): 
    if i+m>n or j+m>n:
        return 0 
    a1=-1 
    for x in range(i,i+m):
        a1+=1 
        b1=0 
        for y in range(j,j+m):
            if b[a1][b1]!=a[x][y]:
                return 0 
            b1+=1 
    return 1 
for i in range(n):
    for j in range(n): 
        if check(i,j):
            print('Yes')
            exit()
print('No')
#print(a,b)

Measured memory_bytes: 39024
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
s = 0
for i in range(n):
    s += b[a[i]-1]
    if i >= 1:
        if a[i] - a[i-1] == 1:
            s += c[a[i-1]-1]
print(s)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

ll mpow(ll x, ll n) { ll y = 1; for (; n > 0; n /= 2) { y = n % 2 ? y * x % MOD : y; x = x * x % MOD; } return y; }

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    ll exa = 1, exb = 1;
    {
        rep(i, A) exa = exa * (N - i) % MOD * mpow(A - i, MOD - 2) % MOD;
        rep(i, B) exb = exb * (N - i) % MOD * mpow(B - i, MOD - 2) % MOD;
    }
    ll ans = ((mpow(2, N) - 1 - exa - exb) % MOD + MOD) % MOD;
    write(ans);
}

Measured memory_bytes: 384
X,Y=map(int,input().split())
N=10**9+7
def kaizyou(n):
    l=[1]
    for i in range(1,n+1):
        ll=(l[i-1]*i)%N
        l.append(ll)
    return l
def modpow(a,n,p):#a^n mod p ,O(log n)
    res=1
    while n>0:
        if n&1:#１とのビット論理積が１、つまり奇数
            res=res*a%p
        a=a*a%p
        n>>=1
        #ビットの右シフト_2進数表記のnを小数点を固定して右に１桁ずらす_１桁小さくなる
    return res
if (2*X-Y)%3==0 and (2*Y-X)%3==0 and 2*X-Y>=0 and 2*Y-X>=0:
    nx=int((2*X-Y)/3)
    ny=int((2*Y-X)/3)
    l=kaizyou(nx+ny)
    nxdv=modpow(l[nx],N-2,N)
    nydv=modpow(l[ny],N-2,N)
    ans=l[-1]*nxdv%N
    ans=ans*nydv%N
    print(ans)
else:
    print(0)


Measured memory_bytes: 29484
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstring>
#include<bitset>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<numeric>
#include<set>
#include<math.h>
#include<queue>
using namespace std;

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

#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)

long long INF = 1e9;
const long long mod = 2019;
#define ll long long


int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int>a(n),b(n);
	rep(i,n) {
		cin >> a[i];
		b[i] = a[i] - i;
	}
	sort(b.begin(), b.end());
	int x;
	if (n % 2 == 0) {
		x = (b[n / 2] + b[n / 2 - 1])/2;
	}
	else {
		x = b[n / 2];
	}
	ll ans = 0;
	rep(i, n) {
		ans += abs(b[i] - x);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const C = arg[1].split("");
    
    let Rcnt = 0;
    
    for(let i=0; i<N; i++) {
        if(C[i] === "R") {
            Rcnt++;
        }
    }
    
    let tempR = [...Array(Rcnt)].fill("R");
    let tempW = [...Array(N - Rcnt)].fill("W");
    
    const splitted = tempR.concat(tempW);
    let temp = 0;
    
    for(let i=0; i<Rcnt; i++) {
        if(C[i] !== splitted[i]) temp++;
    }
    
    let answer = Math.min(temp, Math.min(Rcnt, N - Rcnt));

    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 39536
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX

int solve(vector<int> &t){
	int res = 0, sum = 0;
	for(int i = t.size()-1; i >= 0; i--){
		// cout<<i<<" "<<t[i]<<endl;;
		if(t[i] == 2) sum++;
		if(t[i] == 1) res += sum;
	}
	
	return res;
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	string s;
	vector<int> t;
	int ans = 0;
	
	cin>>s;
	
	for(int i = 0; i < s.size(); i++){
		bool flag = false;
		// if(i == s.size()-1) flag = true;
		if(s[i] == 'A') t.push_back(1);
		else if(i != s.size() - 1&& s[i] == 'B' && s[i+1] == 'C'){
			t.push_back(2);
			i++;
		} else flag = true;
		if(flag){
			ans += solve(t);
			t.clear();
		}
	}
	ans += solve(t);
	
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 2700
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
i=0
kill=0
while i<N:
    if b[i]>a[i]:
        c=b[i]-a[i]
        if a[i+1]>=c:
            a[i+1]-=c
            kill+=b[i]
        else:
            kill+=a[i]+a[i+1]
            a[i+1]=0
    else:
        kill+=b[i]
    i+=1
print(kill)        

Measured memory_bytes: 18476
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int main(){
  int n;
  char a[10005];
  scanf("%d",&n);
  cin.getline(a,10005);
  cin.getline(a,10005);
  for(int i=0;i<strlen(a);i++){
    int t=a[i]-'A';
    t=(t+n)%26;
    printf("%c",'A'+t);
  }
  printf("\n");
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++) cin >> A[i];
  
  int count=0;
  for(int i=0;i<N;i++){
    while(A[i]%2==0){
      if(A[i]%2==0) count++;
      if(A[i]%2==1) break;
      A[i] /= 2;
    }
  }
  cout << count << endl; 
}

Measured memory_bytes: 256
s=input()
x,y=map(int,input().split())

dpx=[False]*16001
dpy=[False]*16001

dpx[8000],dpy[8000]=True,True

xxx=True
judge=True
s+='T'
cnt=0
for i in s:
  if i=='F':
      cnt+=1

  else:
    if judge:
        judge=False
    
    else:
        judge=True

    if cnt==0:
        xxx=False
        continue

    sin=[False]*16001
    if not judge:
        for j in range(16001):
            if dpx[j]==True:
                if not xxx:
                  sin[j-cnt]=True
                sin[j+cnt]=True
        dpx=sin
    
    else:
        for j in range(16001):
            if dpy[j]==True:
                sin[j-cnt]=True
                sin[j+cnt]=True
        dpy=sin

    cnt=0
    xxx=False




if dpx[x+8000] and dpy[y+8000]:
    print('Yes')

else:
    print('No')

Measured memory_bytes: 84280
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] abx = br.readLine().split(" ");
        long a = Long.parseLong(abx[0]);
        long b = Long.parseLong(abx[1]);
        long x = Long.parseLong(abx[2]);
        
        /*int count = 0;
        for (long i = a; i <= b; i++) {
            if (i % x == 0) count++;
        }*/
        
        long ans = b/x - (a-1)/x;
        
        System.out.println(a==0?b/x+1:ans);
    }
}


Measured memory_bytes: 23252
import java.util.*;

/**
 * B
 */
public class Main {
    public static void main(String[] args) {
        
    Scanner sc  = new Scanner(System.in);
    
    int n = sc.nextInt();
    int min_j, count=0;
    int array[] = new int[n];

    for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
    }

    sc.close();

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

        min_j = i;

        for(int j=i; j<=n-1; j++) {

            if(array[j] < array[min_j]) {

                min_j = j;

            }
        }

        if(i != min_j) {

            int tmp = array[i];
            array[i] = array[min_j];
            array[min_j] = tmp;
            count++;

        }

    }

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

        System.out.print(array[i]);
        if(i != n-1) {
            System.out.print(" ");
        }
    }

        System.out.println("\n" + count);

    }
}


Measured memory_bytes: 26392
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define N 1000

int main() {
    int n,temp,temp2=0,flag=0,ans=0;
    char lucky[30000], pass[3] = { 0 };

    for (int i = 0; i < 30000; i++) lucky[i] = '10';
    scanf("%d", &n);
    scanf("%s", lucky);
    //printf("%s\n", lucky);
    for (int i = 0; i < N; i++) {
        temp = i;
        for (int j = 0; j < 3; j++) {
            pass[j] = (temp % 10) + '0';
            temp /= 10;
        }
        //printf("\n");
       // for (int h = 0; h < 3; h++) printf("pass[%d]=%d",h, pass[h]);
        flag = 0;
        temp2 = 0;
        for (int k = 0; k < 3; k++) {        
            for (int l=temp2 ; l < n; l++) {            
                if (pass[k] == lucky[l]) {
                    temp2 = l + 1;
                    flag++;
                    if (flag == 3) {
                        ans++;
                        /*
                        printf("\n");
                        for (int h = 0; h < 3; h++)
                            printf("%c",pass[h]);
                            */
                    }
                    break;
                }
                
            }
           
        }
    }
    //printf("\n");
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int n, m;
int main() {
	cin >> n >> m;
	if (n % 2 == 0) {
		for (int i = 0; i < n / 2 + 1; i++) { if (i)cout << ' '; cout << "0"; }
		for (int i = 0; i < n / 2 - 1; i++)cout << ' ' << m;
	}
	else {
		for (int i = 0; i < n / 2 + 1; i++) { if (i)cout << ' '; cout << "0"; }
		for (int i = 0; i < n / 2; i++)cout << ' ' << m;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3076
a = Array.new(3) { Array.new(3, 0) }
3.times do |i|
  a[i] = gets.split.map(&:to_i)
end

n = gets.to_i
b = n.times.map { gets.to_i }

hitted = Array.new(3) { Array.new(3, false) }

3.times do |i|
  3.times do |j|
    hitted[i][j] = true if b.any? { |n| n == a[i][j] }
  end
end

transposed = hitted.transpose
ans = 'No'
0.upto(2) do |i|
  ans = 'Yes' if hitted[i].all? || transposed[i].all?
end

if [hitted[0][0], hitted[1][1], hitted[2][2]].all? || [hitted[0][2], hitted[1][1], hitted[2][0]].all?
  ans = 'Yes'
end

puts ans


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

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr <<">>>>>>"<< #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif
int d[256];
int main()
{
	
int n,an=0;
cin>>n;
int a[n],m=0;;
for(int i=0;i<n;i++){cin>>a[i];if(a[i]>=m){m=a[i];an++;}}

cout<<an<<endl;

}



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

using namespace std;

#define all(x) (x).begin(), (x).end()
typedef long double ld;
typedef long long ll;

const int M = 100100;

vector<int> g[M];
int u[M];
int n;
vector<int> ans;

void read() {
    int m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
}

void dfs(int v) {
    ans.push_back(v);
    u[v] = 2;
    for (int to : g[v])
        if (!u[to]) {
            dfs(to);
            break;
        }
}

void kill() {
    dfs(0);
    reverse(all(ans));
    ans.pop_back();
    dfs(0);
    cout << ans.size() << endl;
    for (int x : ans)
        cout << x + 1 << " ";
    cout << endl;
}

int main() {
#ifdef LOCAL
  assert(freopen("b.in", "r", stdin));
#endif

  ios_base::sync_with_stdio(false);

  read();
  kill();

}



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

int main() {

  int N;
  cin >> N;

  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    
    if (i==N-1 && S!="Y") cout << "Three" << endl;
    
    if (S=="Y") {
      cout << "Four" << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
N=int(input())
A1=list(map(int, input().split()))
A2=list(map(int, input().split()))


ans=0
for i in range(N):
    a1=A1[:(i+1)]
    a2=A2[i:]
    ans=max(ans, sum(a1)+sum(a2))

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;

#define MOD 998244353

int main(){
    ll a;
    string s,t;
    cin >> a >> s >> t;
    for (ll i=0;i<s.size()*2;i++){
        if (i%2==0)cout << s[i/2];
        else cout << t[i/2];
    }
    cout << endl;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    int yen=1000;
    for(int i=0; i<n-1; i++){
        if(a[i]<a[i+1]){
            int kabu=0;
            kabu=yen/a[i];
            yen%=a[i];
            yen+=a[i+1]*kabu;
        }
    }
    cout<<yen<<endl;
}

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

int G[10][10];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    rep(i, M) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        G[s][t] = true;
        G[t][s] = true;
    }  
    int ans = 0;
    int order[8];
    rep(i, N) order[i] = i;
    do {
        bool ok = true;
        rep(i, N - 1) {
            if (!G[order[i]][order[i + 1]]) ok = false;
        }
        ans += ok;
    }while(next_permutation(order + 1, order + N));
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  double v[N];
  for (int i = 0; i < N; i++) {
    cin >> v[i];
  }
  sort(v,v+N);
  for (int i = 1; i < N; i++) {
    v[i] = ((v[i] + v[i - 1]) / 2);
  }
  cout << setprecision(120) << v[N - 1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  int res=1e9;
  rep(i,n){
    int a;
    cin>>a;
    chmin(res,a-(a&(a-1)));
  }
  cout<<(int)log2(res)<<endl;


  return 0;

}


Measured memory_bytes: 384
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int A = Integer.parseInt(sc.nextLine());

		Set<String> items =new HashSet<String>();

		for (int i = 0; i < A; i++) {
			items.add(sc.nextLine());
		}

		System.out.println(items.size());

	}
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int Cnt(int n){
  int ans = 0;
  for(int i = 1; i <= n; ++i){
    if(n % i == 0) ans++;
  }
  return ans;
}

int main(){
  int n; cin >> n;
  int ans = 0;
  for(int i = 1; i <= n; i+=2){
    if(Cnt(i) == 8)ans ++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
//psudora
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define mod 1000000007
#define pi 3.1415926535
#define flash ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
const int INF = 1e9+5;
#ifdef _DEBUG
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

int main(){
	ll n,k,cnt=0,sum=0,r;
	cin>>n>>k;
	while(n!=0){
		r=n%k;
		n/=k;
		sum=sum+r*pow(10,cnt);
		cnt++;
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 256
n = gets.to_i
b = gets.split.map(&:to_i)

sum = 0
n.times do |i|
  if i == 0
    sum += b[i]
    next
  end

  if i == n-1
    sum += b[i-1]
    break
  end

  sum += [b[i], b[i-1]].min
end

puts sum

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

    const int nmax=8;
    bool graph[nmax][nmax];
    
    int dfs(int v,int N,bool visited[nmax])
    {
        
        bool all_visited=true;
        
        for(int i= 0;i<N;i++){
            if(visited[i]==false)
                all_visited=false;
        }
        
        if(all_visited){
            return 1;
        }
        
        int ret = 0;
        
        for(int i = 0;i<N;i++){
            if(graph[v][i]==false) continue;
            if(visited[i]) continue;
            
            visited[i]=true;
            ret+=dfs(i,N,visited);
            visited[i]=false;
        }
        
        return ret;
    }
    
int main(void){
    int N,M;
    cin >> N >> M;
    
    for(int i = 0;i<M;i++){
        int A,B;
        cin >> A >> B;
        graph[A-1][B-1]=graph[B-1][A-1]=true;
    }        
        
    bool visited[nmax];    
    for(int i= 0;i<N;i++){
        visited[i]=false;
    }    
        
    visited[0]=true;    
    cout << dfs(0,N,visited) << endl;
    return 0;    
}
    
    
    


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;
int a[500005];
int main()
{
	int tot=0;
	int n;
	int x;
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	int i=1;
	int k1;
	int k2;
	while (i<n){
		for (int j=i+1;j<=n;j++){
			if (a[j]<a[j-1]){
				k1=j-1;
				break;
			}
			k1=n;
		}
		for (int j=i+1;j<=n;j++){
			if (a[j]>a[j-1]){
				k2=j-1;
				break;
			}
			k2=n;
		}
		k1=max(k2,k1);
		if (k1==n){
			printf("%d",tot+1);
			return 0;
		}
		tot++;
		i=k1+1;
	}
	printf("%d",tot+1);
	return 0;
}

Measured memory_bytes: 640
n = int(input())
m=10**9+7
p=[]
for k in range(2,n+1):
  f=1
  for i in p:
    if k%i==0:
      f=0
      break
  if f==1:
    p+=[k]
l=[1]*len(p)
for i in range(len(p)):
  d=p[i]
  x=n//d
  while x>0:
    l[i]+=x
    x//=d
a=1
for i in l:
  a*=i
  a%=m
print(a)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>

using namespace std;

int main(void){
    int n, t;
    cin>>n>>t;
    int ct[n][2];
    for(int i=0;i<n;i++){
            cin>>ct[i][0]>>ct[i][1];
    }

    vector<int> c;
    for(int i=0; i<n; i++){
            if(ct[i][1]<=t){
                    c.push_back(ct[i][0]);
            }
    }

    if(c.empty()){
        cout<<"TLE"<<endl;
    }else{
    int min = c[0];
        for(int i=0; i<c.size();i++){
                if(c[i]<min){
                        min=c[i];
                }
        }
        cout<<min<<endl;
    }
    return 0;
}

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

int main()
{
  int N; cin >> N;
  vector<int> d(N);
  rep(i,N) cin >> d[i];
  int res = 0;
  for(int i = 0; i < N; i++)
  {
    for(int j = i+1; j < N; j++)
      res += d[i]*d[j];
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl              "\n"
#define pb              push_back
#define fir               first
#define sec               second
#define all(v)            ((v).begin()), ((v).end())
#define sz(v)            ((int)((v).size()))
#define ll              long long
#define ld              long double
#define lp(i, n)        for(int i = 0 ; (int)i<n ; i++)
#define loop(i, x, n)       for(int i=x ; (int)i<=n ; i++)
#define isPowerOfTwo(s) (!(s & (s-1)))
typedef vector<int> vi;
typedef deque<int> de;
void origi() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
}
int a[102];
int b[102];
void tiranga() {
    int n;
    cin >> n;
    lp(i, n-1) cin >> a[i];
    b[0] = a[0];
    int x, y;
    lp(i,n-1){
        if (i != n - 2) {
            x = a[i], y = a[i + 1];
            b[i + 1] = min(x, y);
        }
        else
            b[i + 1] = a[i];
    }
    cout << accumulate(b, b + n, 0);
}
int main() {
#ifndef ONLINE_JUDGE.
    //freopen("input.txt", "r", stdin);
#else
#endif
    
    origi();
    tiranga();
    //cout << sumOfDig(123654);
   // genLarge(10, 10);
   // genSmall(10);

}


Measured memory_bytes: 256
a,b = map(int, input().split())

def max_div(a,b):
    c = max(a,b)
    b = min(a,b)
    a = c
    
    while(c!=0):
        c = a%b
        a = b
        b = c
        
    return a

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a_ = max_div(a,b)
b_ = prime_factorize(a_)
b_ = set(b_)

print(len(b_)+1)

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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define All(v) (v).begin(), (v).end()
#define Pb push_back

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

    ll a,b,minus=0;
    cin >> a >> b;
    if(a<=0 && 0<=b){
        cout << "Zero" << "\n";
        return 0;
    }
    REP(i,a,b+1){
        if(i<0) minus++;
    }
    if(minus%2) cout << "Negative" << "\n";
    else cout << "Positive" << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const ll mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n;
    cin >> n;
    vector<int> c(n-1), s(n-1), f(n-1);
    for(int i = 0; i < n-1; ++i)    cin >> c[i] >> s[i] >> f[i];
    for(int i = 0; i < n-1; ++i){
        int now = s[i] + c[i];
        for(int j = i+1; j < n-1; ++j){
            if(now < s[j])  now = s[j] + c[j];
            else{
                int hoge = ceil((double)(now - s[j]) / f[j]);
                now = s[j] + hoge * f[j] + c[j];
            }
        }
        cout << now << "\n";
    }
    cout << 0 << "\n";
}

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

int main(){
    int n,r;
    cin >> n >> r;
    if (n > 9) cout << r << endl;
    else cout << r+(100*(10-n)) << endl;
    return 0;
}

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

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    long long int n,i,sum=0,x=INT_MAX;
    cin>>n;
    long long int A[n];
    for(i=0;i<n;i++){
        cin>>A[i];
        A[i]=-A[i];
    }
    sort(A,A+n);
    sum+=abs(A[0]);
    x=1;
    i=1;
    while(x<n-1){
        sum+=2*abs(A[i]);
        i+=1;
        x+=2;
    }
    i-=1;
    if(x>n-1)
        sum-=abs(A[i]);
    cout<<sum;
}


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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3604
#include <cstdio>

using namespace std;

int arr[101];

int main()
{
	int n;
	scanf("%d", &n);
	
	int d, x;
	scanf("%d %d", &d, &x);
	
	for (int i = 0; i < n; i++)
		scanf("%d", &arr[i]);
	
	int cnt = 0;
	for (int i = 0; i < d; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (i % arr[j] == 0) cnt++;
		}
	}
	
	printf("%d", cnt + x);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    cout<<a*b<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r;
    cin >> r;
    cout << r * r << endl;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main(){
    lli K;
    string S;
    cin>>K>>S;
    if(S.length() >K){
        
        cout<<S.substr(0,K)<<"..."<<endl;
    }
    else{
        cout<<S<<endl;
    }
    
    
}

Measured memory_bytes: 3592
N = int(input())
A = list(map(int, input().split()))
counter = [0 for _ in range(max(A)+1)]
appeard = []
for k in range(N):
  counter[A[k]] += 1
  if counter[A[k]] == 2:
    appeard.append(A[k])

allsum = 0
for item in appeard:
  allsum += counter[item]*(counter[item]-1)//2
for k in range(N):
  if counter[A[k]] > 1:
    print(allsum - (counter[A[k]]-1))
  else:
    print(allsum)

Measured memory_bytes: 32320